[Tux4kids-commits] r574 - in tuxmath/trunk: . data/missions data/missions/campaign data/missions/campaign/ace data/missions/campaign/cadet data/missions/campaign/commando data/missions/campaign/ranger data/missions/campaign/scout mingw nsis src
cheezmeister-guest at alioth.debian.org
cheezmeister-guest at alioth.debian.org
Sat Jul 26 17:19:32 UTC 2008
Author: cheezmeister-guest
Date: 2008-07-26 17:19:32 +0000 (Sat, 26 Jul 2008)
New Revision: 574
Added:
tuxmath/trunk/data/missions/campaign/
tuxmath/trunk/data/missions/campaign/ace/
tuxmath/trunk/data/missions/campaign/ace/ace
tuxmath/trunk/data/missions/campaign/cadet/
tuxmath/trunk/data/missions/campaign/cadet/cadet
tuxmath/trunk/data/missions/campaign/cadet/round1
tuxmath/trunk/data/missions/campaign/cadet/round2
tuxmath/trunk/data/missions/campaign/cadet/round3
tuxmath/trunk/data/missions/campaign/campaign
tuxmath/trunk/data/missions/campaign/commando/
tuxmath/trunk/data/missions/campaign/commando/commando
tuxmath/trunk/data/missions/campaign/ranger/
tuxmath/trunk/data/missions/campaign/ranger/ranger
tuxmath/trunk/data/missions/campaign/scout/
tuxmath/trunk/data/missions/campaign/scout/scout
tuxmath/trunk/mingw/
tuxmath/trunk/mingw/SDL_win32_main.c
tuxmath/trunk/mingw/tuxmath.cbp
tuxmath/trunk/mingw/version.h
Modified:
tuxmath/trunk/nsis/tuxmath.nsi
tuxmath/trunk/nsis/tuxmath_with_conf.nsi
tuxmath/trunk/src/credits.c
tuxmath/trunk/src/credits.h
tuxmath/trunk/src/game.c
tuxmath/trunk/src/game.h
tuxmath/trunk/src/mathcards.c
tuxmath/trunk/src/titlescreen.c
Log:
Completed majority of code for campaign, including a generalized rewrite
of credit scrolling. Began designing settings & presentation. Press 'c'
in a menu to test.
Added: tuxmath/trunk/data/missions/campaign/ace/ace
===================================================================
--- tuxmath/trunk/data/missions/campaign/ace/ace (rev 0)
+++ tuxmath/trunk/data/missions/campaign/ace/ace 2008-07-26 17:19:32 UTC (rev 574)
@@ -0,0 +1,24 @@
+# campaign ace stage lesson file
+
+addition_allowed = 1
+subtraction_allowed = 1
+multiplication_allowed = 1
+division_allowed = 1
+typing_practice_allowed = 0
+allow_negatives = 1
+max_formula_nums = 2
+min_formula_nums = 2
+question_copies = 1
+copies_repeated_wrongs = 1
+format_add_answer_last = 1
+format_add_answer_first = 1
+format_add_answer_middle = 1
+max_answer = 200
+starting_comets = 3
+extra_comets_per_wave = 3
+max_comets = 12
+speed = 1.6
+speedup_factor = 1.25
+bonus_comet_interval = 20
+vary_list_length = 1
+
Property changes on: tuxmath/trunk/data/missions/campaign/ace/ace
___________________________________________________________________
Name: svn:executable
+ *
Added: tuxmath/trunk/data/missions/campaign/cadet/cadet
===================================================================
--- tuxmath/trunk/data/missions/campaign/cadet/cadet (rev 0)
+++ tuxmath/trunk/data/missions/campaign/cadet/cadet 2008-07-26 17:19:32 UTC (rev 574)
@@ -0,0 +1,23 @@
+# campaign cadet stage lesson file
+
+addition_allowed = 1
+subtraction_allowed = 0
+multiplication_allowed = 0
+division_allowed = 0
+allow_negatives = 0
+max_formula_nums = 2
+min_formula_nums = 2
+question_copies = 1
+copies_repeated_wrongs = 1
+format_add_answer_last = 1
+format_add_answer_first = 0
+format_add_answer_middle = 0
+max_answer = 50
+starting_comets = 2
+extra_comets_per_wave = 2
+max_comets = 6
+speed = 1.00
+speedup_factor = 1.1
+bonus_comet_interval = 10
+vary_list_length = 0
+
Property changes on: tuxmath/trunk/data/missions/campaign/cadet/cadet
___________________________________________________________________
Name: svn:executable
+ *
Added: tuxmath/trunk/data/missions/campaign/cadet/round1
===================================================================
--- tuxmath/trunk/data/missions/campaign/cadet/round1 (rev 0)
+++ tuxmath/trunk/data/missions/campaign/cadet/round1 2008-07-26 17:19:32 UTC (rev 574)
@@ -0,0 +1,7 @@
+#cadet round 1
+
+typing_practice_allowed = 1
+addition_allowed = 0
+min_typing_num = 0
+max_typing_num = 20
+avg_list_length = 0
Property changes on: tuxmath/trunk/data/missions/campaign/cadet/round1
___________________________________________________________________
Name: svn:executable
+ *
Added: tuxmath/trunk/data/missions/campaign/cadet/round2
===================================================================
--- tuxmath/trunk/data/missions/campaign/cadet/round2 (rev 0)
+++ tuxmath/trunk/data/missions/campaign/cadet/round2 2008-07-26 17:19:32 UTC (rev 574)
@@ -0,0 +1,7 @@
+#cadet round 2
+
+min_augend = 0
+max_augend = 10
+min_augend = 0
+min_augend = 10
+avg_list_length = 30
Property changes on: tuxmath/trunk/data/missions/campaign/cadet/round2
___________________________________________________________________
Name: svn:executable
+ *
Added: tuxmath/trunk/data/missions/campaign/cadet/round3
===================================================================
--- tuxmath/trunk/data/missions/campaign/cadet/round3 (rev 0)
+++ tuxmath/trunk/data/missions/campaign/cadet/round3 2008-07-26 17:19:32 UTC (rev 574)
@@ -0,0 +1,10 @@
+#cadet round 3
+
+typing_practice_allowed = 1
+min_typing_num = 0
+max_typing_num = 100
+min_augend = 0
+max_augend = 20
+min_augend = 0
+min_augend = 20
+avg_list_length = 50
Property changes on: tuxmath/trunk/data/missions/campaign/cadet/round3
___________________________________________________________________
Name: svn:executable
+ *
Added: tuxmath/trunk/data/missions/campaign/campaign
===================================================================
--- tuxmath/trunk/data/missions/campaign/campaign (rev 0)
+++ tuxmath/trunk/data/missions/campaign/campaign 2008-07-26 17:19:32 UTC (rev 574)
@@ -0,0 +1,16 @@
+# campaign master lesson file
+
+play_through_list = 1
+allow_speedup = 1
+use_feedback = 0
+use_bkgd = 1
+demo_mode = 0
+repeat_wrongs = 1
+slow_after_wrong = 0
+max_questions = 5000
+randomize = 1
+comprehensive = 1
+allow_pause = 1
+bonus_speed_ratio = 1.8
+max_speed = 10.00
+fraction_to_keep = 0.10
Property changes on: tuxmath/trunk/data/missions/campaign/campaign
___________________________________________________________________
Name: svn:executable
+ *
Added: tuxmath/trunk/data/missions/campaign/commando/commando
===================================================================
--- tuxmath/trunk/data/missions/campaign/commando/commando (rev 0)
+++ tuxmath/trunk/data/missions/campaign/commando/commando 2008-07-26 17:19:32 UTC (rev 574)
@@ -0,0 +1,24 @@
+# campaign commando stage lesson file
+
+addition_allowed = 1
+subtraction_allowed = 1
+multiplication_allowed = 1
+division_allowed = 1
+typing_practice_allowed = 0
+allow_negatives = 1
+max_formula_nums = 5
+min_formula_nums = 2
+question_copies = 1
+copies_repeated_wrongs = 1
+format_add_answer_last = 1
+format_add_answer_first = 1
+format_add_answer_middle = 1
+max_answer = 250
+starting_comets = 3
+extra_comets_per_wave = 3
+max_comets = 12
+speed = 1.6
+speedup_factor = 1.25
+bonus_comet_interval = 20
+vary_list_length = 1
+
Property changes on: tuxmath/trunk/data/missions/campaign/commando/commando
___________________________________________________________________
Name: svn:executable
+ *
Added: tuxmath/trunk/data/missions/campaign/ranger/ranger
===================================================================
--- tuxmath/trunk/data/missions/campaign/ranger/ranger (rev 0)
+++ tuxmath/trunk/data/missions/campaign/ranger/ranger 2008-07-26 17:19:32 UTC (rev 574)
@@ -0,0 +1,24 @@
+# campaign ranger stage lesson file
+
+addition_allowed = 1
+subtraction_allowed = 1
+multiplication_allowed = 1
+division_allowed = 0
+typing_practice_allowed = 0
+allow_negatives = 0
+max_formula_nums = 2
+min_formula_nums = 2
+question_copies = 1
+copies_repeated_wrongs = 1
+format_add_answer_last = 1
+format_add_answer_first = 1
+format_add_answer_middle = 1
+max_answer = 150
+starting_comets = 3
+extra_comets_per_wave = 2
+max_comets = 10
+speed = 1.5
+speedup_factor = 1.2
+bonus_comet_interval = 20
+vary_list_length = 1
+
Property changes on: tuxmath/trunk/data/missions/campaign/ranger/ranger
___________________________________________________________________
Name: svn:executable
+ *
Added: tuxmath/trunk/data/missions/campaign/scout/scout
===================================================================
--- tuxmath/trunk/data/missions/campaign/scout/scout (rev 0)
+++ tuxmath/trunk/data/missions/campaign/scout/scout 2008-07-26 17:19:32 UTC (rev 574)
@@ -0,0 +1,24 @@
+# campaign scout stage lesson file
+
+addition_allowed = 0
+subtraction_allowed = 1
+multiplication_allowed = 0
+division_allowed = 0
+typing_practice_allowed = 0
+allow_negatives = 0
+max_formula_nums = 2
+min_formula_nums = 2
+question_copies = 1
+copies_repeated_wrongs = 1
+format_add_answer_last = 1
+format_add_answer_first = 0
+format_add_answer_middle = 0
+max_answer = 100
+starting_comets = 2
+extra_comets_per_wave = 2
+max_comets = 8
+speed = 1.00
+speedup_factor = 1.2
+bonus_comet_interval = 15
+vary_list_length = 0
+
Property changes on: tuxmath/trunk/data/missions/campaign/scout/scout
___________________________________________________________________
Name: svn:executable
+ *
Added: tuxmath/trunk/mingw/SDL_win32_main.c
===================================================================
--- tuxmath/trunk/mingw/SDL_win32_main.c (rev 0)
+++ tuxmath/trunk/mingw/SDL_win32_main.c 2008-07-26 17:19:32 UTC (rev 574)
@@ -0,0 +1,357 @@
+/*
+ SDL_main.c, placed in the public domain by Sam Lantinga 4/13/98
+
+ The WinMain function -- calls your program's main() function
+*/
+
+#include <stdio.h>
+#include <stdlib.h>
+
+#define WIN32_LEAN_AND_MEAN
+#include <windows.h>
+
+#ifdef _WIN32_WCE
+# define DIR_SEPERATOR TEXT("\\")
+# undef _getcwd
+# define _getcwd(str,len) wcscpy(str,TEXT(""))
+# define setbuf(f,b)
+# define setvbuf(w,x,y,z)
+# define fopen _wfopen
+# define freopen _wfreopen
+# define remove(x) DeleteFile(x)
+#else
+# define DIR_SEPERATOR TEXT("/")
+# include <direct.h>
+#endif
+
+/* Include the SDL main definition header */
+#include "SDL.h"
+#include "SDL_main.h"
+
+#ifdef main
+# ifndef _WIN32_WCE_EMULATION
+# undef main
+# endif /* _WIN32_WCE_EMULATION */
+#endif /* main */
+
+/* The standard output files */
+#define STDOUT_FILE TEXT("stdout.txt")
+#define STDERR_FILE TEXT("stderr.txt")
+
+#ifndef NO_STDIO_REDIRECT
+# ifdef _WIN32_WCE
+ static wchar_t stdoutPath[MAX_PATH];
+ static wchar_t stderrPath[MAX_PATH];
+# else
+ static char stdoutPath[MAX_PATH];
+ static char stderrPath[MAX_PATH];
+# endif
+#endif
+
+#if defined(_WIN32_WCE) && _WIN32_WCE < 300
+/* seems to be undefined in Win CE although in online help */
+#define isspace(a) (((CHAR)a == ' ') || ((CHAR)a == '\t'))
+#endif /* _WIN32_WCE < 300 */
+
+/* Parse a command line buffer into arguments */
+static int ParseCommandLine(char *cmdline, char **argv)
+{
+ char *bufp;
+ int argc;
+
+ argc = 0;
+ for ( bufp = cmdline; *bufp; ) {
+ /* Skip leading whitespace */
+ while ( isspace(*bufp) ) {
+ ++bufp;
+ }
+ /* Skip over argument */
+ if ( *bufp == '"' ) {
+ ++bufp;
+ if ( *bufp ) {
+ if ( argv ) {
+ argv[argc] = bufp;
+ }
+ ++argc;
+ }
+ /* Skip over word */
+ while ( *bufp && (*bufp != '"') ) {
+ ++bufp;
+ }
+ } else {
+ if ( *bufp ) {
+ if ( argv ) {
+ argv[argc] = bufp;
+ }
+ ++argc;
+ }
+ /* Skip over word */
+ while ( *bufp && ! isspace(*bufp) ) {
+ ++bufp;
+ }
+ }
+ if ( *bufp ) {
+ if ( argv ) {
+ *bufp = '\0';
+ }
+ ++bufp;
+ }
+ }
+ if ( argv ) {
+ argv[argc] = NULL;
+ }
+ return(argc);
+}
+
+/* Show an error message */
+static void ShowError(const char *title, const char *message)
+{
+/* If USE_MESSAGEBOX is defined, you need to link with user32.lib */
+#ifdef USE_MESSAGEBOX
+ MessageBox(NULL, message, title, MB_ICONEXCLAMATION|MB_OK);
+#else
+ fprintf(stderr, "%s: %s\n", title, message);
+#endif
+}
+
+/* Pop up an out of memory message, returns to Windows */
+static BOOL OutOfMemory(void)
+{
+ ShowError("Fatal Error", "Out of memory - aborting");
+ return FALSE;
+}
+
+/* SDL_Quit() shouldn't be used with atexit() directly because
+ calling conventions may differ... */
+static void cleanup(void)
+{
+ SDL_Quit();
+}
+
+/* Remove the output files if there was no output written */
+static void cleanup_output(void)
+{
+#ifndef NO_STDIO_REDIRECT
+ FILE *file;
+ int empty;
+#endif
+
+ /* Flush the output in case anything is queued */
+ fclose(stdout);
+ fclose(stderr);
+
+#ifndef NO_STDIO_REDIRECT
+ /* See if the files have any output in them */
+ if ( stdoutPath[0] ) {
+ file = fopen(stdoutPath, TEXT("rb"));
+ if ( file ) {
+ empty = (fgetc(file) == EOF) ? 1 : 0;
+ fclose(file);
+ if ( empty ) {
+ remove(stdoutPath);
+ }
+ }
+ }
+ if ( stderrPath[0] ) {
+ file = fopen(stderrPath, TEXT("rb"));
+ if ( file ) {
+ empty = (fgetc(file) == EOF) ? 1 : 0;
+ fclose(file);
+ if ( empty ) {
+ remove(stderrPath);
+ }
+ }
+ }
+#endif
+}
+
+#if defined(_MSC_VER) && !defined(_WIN32_WCE)
+/* The VC++ compiler needs main defined */
+#define console_main main
+#endif
+
+/* This is where execution begins [console apps] */
+int console_main(int argc, char *argv[])
+{
+ size_t n;
+ char *bufp, *appname;
+ int status;
+
+ /* Get the class name from argv[0] */
+ appname = argv[0];
+ if ( (bufp=SDL_strrchr(argv[0], '\\')) != NULL ) {
+ appname = bufp+1;
+ } else
+ if ( (bufp=SDL_strrchr(argv[0], '/')) != NULL ) {
+ appname = bufp+1;
+ }
+
+ if ( (bufp=SDL_strrchr(appname, '.')) == NULL )
+ n = SDL_strlen(appname);
+ else
+ n = (bufp-appname);
+
+ bufp = SDL_stack_alloc(char, n+1);
+ if ( bufp == NULL ) {
+ return OutOfMemory();
+ }
+ SDL_strlcpy(bufp, appname, n+1);
+ appname = bufp;
+
+ /* Load SDL dynamic link library */
+ if ( SDL_Init(SDL_INIT_NOPARACHUTE) < 0 ) {
+ ShowError("WinMain() error", SDL_GetError());
+ return(FALSE);
+ }
+ atexit(cleanup_output);
+ atexit(cleanup);
+
+ /* Sam:
+ We still need to pass in the application handle so that
+ DirectInput will initialize properly when SDL_RegisterApp()
+ is called later in the video initialization.
+ */
+ SDL_SetModuleHandle(GetModuleHandle(NULL));
+
+ /* Run the application main() code */
+ status = SDL_main(argc, argv);
+
+ /* Exit cleanly, calling atexit() functions */
+ exit(status);
+
+ /* Hush little compiler, don't you cry... */
+ return 0;
+}
+
+/* This is where execution begins [windowed apps] */
+#ifdef _WIN32_WCE
+int WINAPI WinMain(HINSTANCE hInst, HINSTANCE hPrev, LPWSTR szCmdLine, int sw)
+#else
+int WINAPI WinMain(HINSTANCE hInst, HINSTANCE hPrev, LPSTR szCmdLine, int sw)
+#endif
+{
+ HINSTANCE handle;
+ char **argv;
+ int argc;
+ char *cmdline;
+ DWORD pathlen;
+#ifdef _WIN32_WCE
+ wchar_t path[MAX_PATH];
+#else
+ char path[MAX_PATH];
+#endif
+#ifdef _WIN32_WCE
+ wchar_t *bufp;
+ int nLen;
+#else
+ char *bufp;
+ size_t nLen;
+#endif
+#ifndef NO_STDIO_REDIRECT
+ FILE *newfp;
+#endif
+
+ /* Start up DDHELP.EXE before opening any files, so DDHELP doesn't
+ keep them open. This is a hack.. hopefully it will be fixed
+ someday. DDHELP.EXE starts up the first time DDRAW.DLL is loaded.
+ */
+ handle = LoadLibrary(TEXT("DDRAW.DLL"));
+ if ( handle != NULL ) {
+ FreeLibrary(handle);
+ }
+
+#ifndef NO_STDIO_REDIRECT
+ pathlen = GetModuleFileName(NULL, path, SDL_arraysize(path));
+ while ( pathlen > 0 && path[pathlen] != '\\' ) {
+ --pathlen;
+ }
+ path[pathlen] = '\0';
+
+#ifdef _WIN32_WCE
+ wcsncpy( stdoutPath, path, SDL_arraysize(stdoutPath) );
+ wcsncat( stdoutPath, DIR_SEPERATOR STDOUT_FILE, SDL_arraysize(stdoutPath) );
+#else
+ SDL_strlcpy( stdoutPath, path, SDL_arraysize(stdoutPath) );
+ SDL_strlcat( stdoutPath, DIR_SEPERATOR STDOUT_FILE, SDL_arraysize(stdoutPath) );
+#endif
+
+ /* Redirect standard input and standard output */
+ newfp = freopen(stdoutPath, TEXT("w"), stdout);
+
+#ifndef _WIN32_WCE
+ if ( newfp == NULL ) { /* This happens on NT */
+#if !defined(stdout)
+ stdout = fopen(stdoutPath, TEXT("w"));
+#else
+ newfp = fopen(stdoutPath, TEXT("w"));
+ if ( newfp ) {
+ *stdout = *newfp;
+ }
+#endif
+ }
+#endif /* _WIN32_WCE */
+
+#ifdef _WIN32_WCE
+ wcsncpy( stderrPath, path, SDL_arraysize(stdoutPath) );
+ wcsncat( stderrPath, DIR_SEPERATOR STDOUT_FILE, SDL_arraysize(stdoutPath) );
+#else
+ SDL_strlcpy( stderrPath, path, SDL_arraysize(stderrPath) );
+ SDL_strlcat( stderrPath, DIR_SEPERATOR STDERR_FILE, SDL_arraysize(stderrPath) );
+#endif
+
+ newfp = freopen(stderrPath, TEXT("w"), stderr);
+#ifndef _WIN32_WCE
+ if ( newfp == NULL ) { /* This happens on NT */
+#if !defined(stderr)
+ stderr = fopen(stderrPath, TEXT("w"));
+#else
+ newfp = fopen(stderrPath, TEXT("w"));
+ if ( newfp ) {
+ *stderr = *newfp;
+ }
+#endif
+ }
+#endif /* _WIN32_WCE */
+
+ setvbuf(stdout, NULL, _IOLBF, BUFSIZ); /* Line buffered */
+ setbuf(stderr, NULL); /* No buffering */
+#endif /* !NO_STDIO_REDIRECT */
+
+#ifdef _WIN32_WCE
+ nLen = wcslen(szCmdLine)+128+1;
+ bufp = SDL_stack_alloc(wchar_t, nLen*2);
+ wcscpy (bufp, TEXT("\""));
+ GetModuleFileName(NULL, bufp+1, 128-3);
+ wcscpy (bufp+wcslen(bufp), TEXT("\" "));
+ wcsncpy(bufp+wcslen(bufp), szCmdLine,nLen-wcslen(bufp));
+ nLen = wcslen(bufp)+1;
+ cmdline = SDL_stack_alloc(char, nLen);
+ if ( cmdline == NULL ) {
+ return OutOfMemory();
+ }
+ WideCharToMultiByte(CP_ACP, 0, bufp, -1, cmdline, nLen, NULL, NULL);
+#else
+ /* Grab the command line */
+ bufp = GetCommandLine();
+ nLen = SDL_strlen(bufp)+1;
+ cmdline = SDL_stack_alloc(char, nLen);
+ if ( cmdline == NULL ) {
+ return OutOfMemory();
+ }
+ SDL_strlcpy(cmdline, bufp, nLen);
+#endif
+
+ /* Parse it into argv and argc */
+ argc = ParseCommandLine(cmdline, NULL);
+ argv = SDL_stack_alloc(char*, argc+1);
+ if ( argv == NULL ) {
+ return OutOfMemory();
+ }
+ ParseCommandLine(cmdline, argv);
+
+ /* Run the main program (after a little SDL initialization) */
+ console_main(argc, argv);
+
+ /* Hush little compiler, don't you cry... */
+ return 0;
+}
Added: tuxmath/trunk/mingw/tuxmath.cbp
===================================================================
--- tuxmath/trunk/mingw/tuxmath.cbp (rev 0)
+++ tuxmath/trunk/mingw/tuxmath.cbp 2008-07-26 17:19:32 UTC (rev 574)
@@ -0,0 +1,173 @@
+<?xml version="1.0" encoding="UTF-8" standalone="yes" ?>
+<CodeBlocks_project_file>
+ <FileVersion major="1" minor="6" />
+ <Project>
+ <Option title="tuxmath" />
+ <Option pch_mode="2" />
+ <Option compiler="gcc" />
+ <Build>
+ <Target title="WinDebug">
+ <Option platforms="Windows;" />
+ <Option output="../src/tuxmath-mingw" prefix_auto="1" extension_auto="1" />
+ <Option object_output="obj/debug" />
+ <Option type="1" />
+ <Option compiler="gcc" />
+ <Compiler>
+ <Add option="-g" />
+ <Add option="-DBUILD_MINGW32" />
+ <Add option='-DPROGRAM_NAME=\"TuxMath\"' />
+ <Add option='-DDATA_PREFIX=\"../data\"' />
+ <Add option='-DVERSION=\"1.6.3\"' />
+ </Compiler>
+ <Linker>
+ <Add library="SDL" />
+ <Add library="SDL_image" />
+ <Add library="SDL_mixer" />
+ <Add library="SDL_ttf" />
+ </Linker>
+ </Target>
+ <Target title="WinRelease">
+ <Option platforms="Windows;" />
+ <Option output="C:/Program Files/TuxMath/tuxmath" prefix_auto="1" extension_auto="1" />
+ <Option object_output="obj/release" />
+ <Option type="1" />
+ <Option compiler="gcc" />
+ <Compiler>
+ <Add option="-g" />
+ <Add option="-DBUILD_MINGW32" />
+ <Add option="-DNO_STDIO_REDIRECT" />
+ <Add option='-DPROGRAM_NAME=\"TuxMath\"' />
+ <Add option='-DDATA_PREFIX="\"C:/Program Files/TuxMath/data\""' />
+ <Add option='-DVERSION=\"1.6.3\"' />
+ </Compiler>
+ <Linker>
+ <Add library="SDL" />
+ <Add library="SDL_image" />
+ <Add library="SDL_mixer" />
+ <Add library="SDL_ttf" />
+ </Linker>
+ </Target>
+ <Target title="NixDebug">
+ <Option platforms="Unix;" />
+ <Option output="../src/tuxmath-mingw" prefix_auto="1" extension_auto="1" />
+ <Option object_output="obj/debug" />
+ <Option type="1" />
+ <Option compiler="gcc" />
+ <Compiler>
+ <Add option="-g" />
+ <Add option='-DPROGRAM_NAME=\\"tuxmath\\"' />
+ <Add option='-DDATA_PREFIX=\\"../data\\"' />
+ <Add option='-DLOCALEDIR=\\"/usr/local/share/locale\\"' />
+ </Compiler>
+ <Linker>
+ <Add library="SDL" />
+ <Add library="SDL_image" />
+ <Add library="SDL_mixer" />
+ <Add library="SDL_ttf" />
+ </Linker>
+ </Target>
+ </Build>
+ <Compiler>
+ <Add option="-Wall" />
+ <Add option='-DPACKAGE=\\"tuxmath\\"' />
+ <Add directory="NOTE: CHANGE TO WHEREVER CONFIG.H IS LOCATED" />
+ <Add directory="../" />
+ </Compiler>
+ <Unit filename="../config.h" />
+ <Unit filename="SDL_win32_main.c">
+ <Option compilerVar="CC" />
+ <Option target="WinDebug" />
+ <Option target="WinRelease" />
+ </Unit>
+ <Unit filename="version.h">
+ <Option target="WinRelease" />
+ </Unit>
+ <Unit filename="../src/ConvertUTF.c">
+ <Option compilerVar="CC" />
+ </Unit>
+ <Unit filename="../src/ConvertUTF.h" />
+ <Unit filename="../src/SDL_extras.c">
+ <Option compilerVar="CC" />
+ </Unit>
+ <Unit filename="../src/SDL_extras.h" />
+ <Unit filename="../src/audio.c">
+ <Option compilerVar="CC" />
+ </Unit>
+ <Unit filename="../src/campaign.c">
+ <Option compilerVar="CC" />
+ </Unit>
+ <Unit filename="../src/campaign.h" />
+ <Unit filename="../src/compiler.h" />
+ <Unit filename="../src/credits.c">
+ <Option compilerVar="CC" />
+ </Unit>
+ <Unit filename="../src/credits.h" />
+ <Unit filename="../src/exercise_mathcards.c">
+ <Option compilerVar="CC" />
+ <Option target="WinRelease" />
+ </Unit>
+ <Unit filename="../src/fileops.c">
+ <Option compilerVar="CC" />
+ </Unit>
+ <Unit filename="../src/fileops.h" />
+ <Unit filename="../src/game.c">
+ <Option compilerVar="CC" />
+ </Unit>
+ <Unit filename="../src/game.h" />
+ <Unit filename="../src/gettext.h" />
+ <Unit filename="../src/highscore.c">
+ <Option compilerVar="CC" />
+ </Unit>
+ <Unit filename="../src/highscore.h" />
+ <Unit filename="../src/lessons.c">
+ <Option compilerVar="CC" />
+ </Unit>
+ <Unit filename="../src/lessons.h" />
+ <Unit filename="../src/loaders.c">
+ <Option compilerVar="CC" />
+ </Unit>
+ <Unit filename="../src/mathcards.c">
+ <Option compilerVar="CC" />
+ </Unit>
+ <Unit filename="../src/mathcards.h" />
+ <Unit filename="../src/options.c">
+ <Option compilerVar="CC" />
+ </Unit>
+ <Unit filename="../src/options.h" />
+ <Unit filename="../src/pixels.c">
+ <Option compilerVar="CC" />
+ </Unit>
+ <Unit filename="../src/pixels.h" />
+ <Unit filename="../src/scandir.c">
+ <Option compilerVar="CC" />
+ </Unit>
+ <Unit filename="../src/scandir.h" />
+ <Unit filename="../src/setup.c">
+ <Option compilerVar="CC" />
+ </Unit>
+ <Unit filename="../src/setup.h" />
+ <Unit filename="../src/titlescreen.c">
+ <Option compilerVar="CC" />
+ </Unit>
+ <Unit filename="../src/titlescreen.h" />
+ <Unit filename="../src/tuxmath.c">
+ <Option compilerVar="CC" />
+ </Unit>
+ <Unit filename="../src/tuxmath.h" />
+ <Unit filename="../src/tuxmathadmin.c">
+ <Option compilerVar="CC" />
+ <Option target="<{~None~}>" />
+ </Unit>
+ <Extensions>
+ <code_completion />
+ <envvars />
+ <debugger />
+ <lib_finder disable_auto="1" />
+ <AutoVersioning>
+ <Scheme minor_max="100" build_max="0" rev_max="0" rev_rand_max="10" build_times_to_increment_minor="100" />
+ <Settings autoincrement="1" date_declarations="1" do_auto_increment="0" ask_to_increment="0" language="C" svn="1" svn_directory="../../" header_path="version.h" />
+ <Changes_Log show_changes_editor="0" app_title="released version %M.%m.%b of %p" changeslog_path="ChangesLog.txt" />
+ </AutoVersioning>
+ </Extensions>
+ </Project>
+</CodeBlocks_project_file>
Added: tuxmath/trunk/mingw/version.h
===================================================================
--- tuxmath/trunk/mingw/version.h (rev 0)
+++ tuxmath/trunk/mingw/version.h 2008-07-26 17:19:32 UTC (rev 574)
@@ -0,0 +1,34 @@
+#ifndef VERSION_H
+#define VERSION_H
+
+ //Date Version Types
+ static const char DATE[] = "12";
+ static const char MONTH[] = "07";
+ static const char YEAR[] = "2008";
+ static const double UBUNTU_VERSION_STYLE = 8.07;
+
+ //Software Status
+ static const char STATUS[] = "Custom";
+ static const char STATUS_SHORT[] = "r";
+
+ //Standard Version Type
+ static const long MAJOR = 1;
+ static const long MINOR = 6;
+ static const long BUILD = 3;
+ static const long REVISION = 0;
+
+ //Miscellaneous Version Types
+ static const long BUILDS_COUNT = 1;
+ #define RC_FILEVERSION 1,6,3,0
+ #define RC_FILEVERSION_STRING "1, 6, 3, 0\0"
+ static const char FULLVERSION_STRING[] = "1.6.3.0";
+
+ //SVN Version
+ static const char SVN_REVISION[] = "0";
+ static const char SVN_DATE[] = "unknown date";
+
+ //These values are to keep track of your versioning state, don't modify them.
+ static const long BUILD_HISTORY = 0;
+
+
+#endif //VERSION_h
Property changes on: tuxmath/trunk/mingw/version.h
___________________________________________________________________
Name: svn:executable
+ *
Modified: tuxmath/trunk/nsis/tuxmath.nsi
===================================================================
--- tuxmath/trunk/nsis/tuxmath.nsi 2008-07-24 17:40:22 UTC (rev 573)
+++ tuxmath/trunk/nsis/tuxmath.nsi 2008-07-26 17:19:32 UTC (rev 574)
@@ -3,7 +3,7 @@
# modified for tuxmath by Yves Combe (yves at ycombe.net)
# modified more for tuxmath by David Bruce <dbruce at tampabay.rr.com>
-!define PKG_VERSION "1.6.0"
+!define PKG_VERSION "1.6.3"
!define PKG_PREFIX "tuxmath"
!define APP_PREFIX "TuxMath"
Modified: tuxmath/trunk/nsis/tuxmath_with_conf.nsi
===================================================================
--- tuxmath/trunk/nsis/tuxmath_with_conf.nsi 2008-07-24 17:40:22 UTC (rev 573)
+++ tuxmath/trunk/nsis/tuxmath_with_conf.nsi 2008-07-26 17:19:32 UTC (rev 574)
@@ -2,7 +2,7 @@
# with a few tiny modifications by Phil Harper(philh at theopencd.org)
# modified for tuxmath by Yves Combe (yves at ycombe.net)
-!define PKG_VERSION "1.6.0"
+!define PKG_VERSION "1.6.3"
!define PKG_PREFIX "tuxmath"
!define APP_PREFIX "TuxMath"
Modified: tuxmath/trunk/src/credits.c
===================================================================
--- tuxmath/trunk/src/credits.c 2008-07-24 17:40:22 UTC (rev 573)
+++ tuxmath/trunk/src/credits.c 2008-07-26 17:19:32 UTC (rev 574)
@@ -27,8 +27,8 @@
#include "options.h"
#include "fileops.h"
#include "setup.h"
+#include "credits.h"
-
char * credit_text[] = {
"-TUX, OF MATH COMMAND", /* '-' at beginning makes highlighted: */
"COPYRIGHT 2001-2006",
@@ -94,23 +94,6 @@
"",
"-WEBSITE",
"WWW.TUX4KIDS.COM",
- "", /* The following blanks cause the screen to scroll to complete blank: */
- "",
- "",
- "",
- "",
- "",
- "",
- "",
- "",
- "",
- "",
- "",
- "",
- "",
- "",
- "",
- "",
NULL
};
@@ -354,7 +337,7 @@
};
-void draw_text(char * str, int offset);
+void draw_text(char * str, SDL_Rect dest);
int line;
@@ -363,10 +346,7 @@
int credits(void)
{
int done, quit, scroll;
- SDL_Rect src, dest;
- SDL_Event event;
- Uint32 last_time, now_time;
- SDLKey key;
+ SDL_Rect subscreen, dest;
/* Clear window: */
@@ -390,97 +370,115 @@
quit = 0;
scroll = 0;
line = 0;
+
+ subscreen.x = 0;
+ subscreen.y = images[IMG_TITLE]->h;
+ subscreen.w = screen->w;
+ subscreen.h = screen->h - images[IMG_TITLE]->h;
+ quit = scroll_text(credit_text, subscreen, 2);
- 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;
- }
- }
- else if (event.type == SDL_MOUSEBUTTONDOWN)
- {
- 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;
}
+int scroll_text(char* text[], SDL_Rect subscreen, int speed)
+{
+ int done = 0, quit = 0, scroll = 0, clearing = 0;
+ SDL_Event event;
+ SDL_Rect src, dest;
+ Uint32 last_time = SDL_GetTicks(), now_time;
+
+ line = 0;
+
+ do
+ {
+ /* 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)
+ {
+ if (event.key.keysym.sym == SDLK_ESCAPE)
+ {
+ /* Escape key - quit! */
+ done = 1;
+ }
+ }
+ else if (event.type == SDL_MOUSEBUTTONDOWN)
+ {
+ done = 1;
+ }
+ }
+
+
+ /* Scroll: */
+
+ src = dest = subscreen;
+ src.y += speed; //amount to scroll by
+
+ SDL_BlitSurface(screen, &src, screen, &dest);
+
+ dest.x = subscreen.x;
+ dest.y = subscreen.y + subscreen.h - speed;
+ dest.w = subscreen.w;
+ dest.h = speed;
+
+ SDL_FillRect(screen, &dest, SDL_MapRGB(screen->format, 0, 0, 0));
+
+ ++scroll;
+ if (clearing) //scroll/check, but don't display any more text
+ {
+ if (scroll > subscreen.h / speed)
+ done = 1;
+ }
+ else
+ {
+ dest.x = subscreen.x + subscreen.w / 2;
+ dest.y = subscreen.y + (subscreen.h - scroll * speed);
+ dest.w = 1;
+ dest.h = 1;
+ draw_text(text[line], dest);
+
+
+ if (scroll * speed >= TTF_FontHeight(default_font) )
+ {
+ scroll = 0;
+ line++;
+
+ if (text[line] == NULL) //end of text
+ {
+ clearing = 1; //scroll to blank
+ }
+ else
+ tmdprintf("text[line]: %s\n", text[line]);
+ }
+ }
+
+
+ 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);
+ last_time = SDL_GetTicks();
+ }
+ }
+ while (!done);
+ return quit;
+}
+#if 0
void draw_text(char * str, int offset)
{
int i, c, x, y, cur_x, start, hilite;
@@ -503,54 +501,54 @@
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';
+ c = str[i] - '0';
else if (str[i] >= 'A' && str[i] <= 'Z')
- c = str[i] - 'A' + 10;
+ c = str[i] - 'A' + 10;
else if (str[i] == ',')
- c = 36;
+ c = 36;
else if (str[i] == '.')
- c = 37;
+ c = 37;
else if (str[i] == '\'')
- c = 38;
+ 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));
- }
- }
- }
- }
+ {
+ 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: */
@@ -558,3 +556,53 @@
cur_x = cur_x + 18;
}
}
+
+#else
+
+//FIXME it's possible that generating the surface every frame taxes
+//slower machines. If so consider returning the surface to be used
+//as long as it's needed.
+void draw_text(char* str, SDL_Rect dest)
+{
+ int hloffset = 0;
+ SDL_Color col;
+ SDL_Surface* surf = NULL;
+ if (!str || *str == '\0')
+ return;
+
+ tmdprintf("Entering draw_text(%s)\n", str);
+
+ if (str[0] == '-') //highlight text
+ {
+ hloffset = 1;
+ col.r = 128;
+ col.g = 192;
+ col.b = 255 - (40);
+ }
+ else //normal color
+ {
+ col.r = 255 - (line % 256);
+ col.g = 255 / 2;
+ col.b = (line * line * 2) % 256;
+ }
+
+#ifndef SDL_Pango
+ surf = TTF_RenderUTF8_Blended(default_font, str+hloffset, col);
+#else
+ if( context != NULL)
+ {
+ SDLPango_SetDefaultColor(context, MATRIX_TRANSPARENT_BACK_BLACK_LETTER);
+ SDLPango_SetText(context, t, -1);
+ surf = SDLPango_CreateSurfaceDraw(context);
+ }
+ else {
+ surf = TTF_RenderUTF8_Blended(default_font, str+hloffset, col);
+ }
+#endif
+
+ dest.x -= surf->w / 2; //center text
+ SDL_BlitSurface(surf, NULL, screen, &dest);
+ SDL_FreeSurface(surf);
+ tmdprintf("done\n");
+}
+#endif
Modified: tuxmath/trunk/src/credits.h
===================================================================
--- tuxmath/trunk/src/credits.h 2008-07-24 17:40:22 UTC (rev 573)
+++ tuxmath/trunk/src/credits.h 2008-07-26 17:19:32 UTC (rev 574)
@@ -21,5 +21,5 @@
#define CREDITS_H
int credits(void);
-
+int scroll_text(char* text[], SDL_Rect subscreen, int speed);
#endif
Modified: tuxmath/trunk/src/game.c
===================================================================
--- tuxmath/trunk/src/game.c 2008-07-24 17:40:22 UTC (rev 573)
+++ tuxmath/trunk/src/game.c 2008-07-26 17:19:32 UTC (rev 574)
@@ -133,7 +133,9 @@
SDL_Surface* current_bkgd()
{ return screen->flags & SDL_FULLSCREEN ? scaled_bkgd : bkgd; }
-static game_message s1, s2, s3, s4, s5;
+static game_message s1, s2, s3, s4, s5;
+static int start_message_chosen = 0;
+
typedef struct {
int x_is_blinking;
int extra_life_is_blinking;
@@ -209,7 +211,7 @@
//see if the option matches the actual screen
if (Opts_Fullscreen() == !(screen->flags & SDL_FULLSCREEN) )
{
- SwitchScreenMode();
+ ;//SwitchScreenMode();
}
@@ -226,7 +228,7 @@
if (Opts_HelpMode()) {
game_handle_help();
game_cleanup();
- return 0;
+ return GAME_OVER_OTHER;
}
@@ -462,12 +464,24 @@
else
{
/* return to title() screen: */
- return 0;
+
+ return game_status;
}
}
+/*
+Set one to four lines of text to display at the game's start. Eventually
+this should stylishly fade out over the first few moments of the game.
+*/
+void game_set_start_message(const char* m1, const char* m2,
+ const char* m3, const char* m4)
+{
+ game_set_message(&s1, m1, screen->w / 2 - 40, RES_Y * 0 / 4);
+ game_set_message(&s2, m2, screen->w / 2 - 40, RES_Y * 1 / 4);
+ game_set_message(&s3, m3, screen->w / 2 - 40, RES_Y * 2 / 4);
+ game_set_message(&s4, m4, screen->w / 2 - 40, RES_Y * 3 / 4);
+ start_message_chosen = 1;
+}
-
-
int game_initialize(void)
{
int i,img;
@@ -618,10 +632,13 @@
tux_anim_frame = 0;
// Initialize the messages
- game_clear_message(&s1);
- game_clear_message(&s2);
- game_clear_message(&s3);
- game_clear_message(&s4);
+ if (!start_message_chosen)
+ {
+ game_clear_message(&s1);
+ game_clear_message(&s2);
+ game_clear_message(&s3);
+ game_clear_message(&s4);
+ }
game_clear_message(&s5);
help_controls.x_is_blinking = 0;
@@ -2150,6 +2167,7 @@
/* determine if game won (i.e. all questions in mission answered correctly): */
if (MC_MissionAccomplished())
{
+ tmdprintf("Mission accomplished!\n");
return GAME_OVER_WON;
}
Modified: tuxmath/trunk/src/game.h
===================================================================
--- tuxmath/trunk/src/game.h 2008-07-24 17:40:22 UTC (rev 573)
+++ tuxmath/trunk/src/game.h 2008-07-26 17:19:32 UTC (rev 574)
@@ -136,6 +136,7 @@
};
int game(void);
+void game_set_start_message(const char*, const char*, const char*, const char*);
/* draw_nums() is used in options.c so need extern linkage */
void draw_nums(const char* str, int x, int y);
Modified: tuxmath/trunk/src/mathcards.c
===================================================================
--- tuxmath/trunk/src/mathcards.c 2008-07-24 17:40:22 UTC (rev 573)
+++ tuxmath/trunk/src/mathcards.c 2008-07-26 17:19:32 UTC (rev 574)
@@ -2882,6 +2882,9 @@
MC_MathQuestion** tmp_vect = NULL;
int i = 0;
+ if (!old_list || !*old_list) //invalid/empty list
+ return 0;
+
int old_length = list_length(old_tmp);
/* set random seed: */
Modified: tuxmath/trunk/src/titlescreen.c
===================================================================
--- tuxmath/trunk/src/titlescreen.c 2008-07-24 17:40:22 UTC (rev 573)
+++ tuxmath/trunk/src/titlescreen.c 2008-07-26 17:19:32 UTC (rev 574)
@@ -31,6 +31,7 @@
#include "options.h"
#include "fileops.h"
#include "game.h"
+#include "campaign.h"
#include "mathcards.h"
#include "setup.h" //for cleanup()
#include "credits.h"
@@ -1594,8 +1595,14 @@
audioMusicLoad("tuxi.ogg", -1);
}
break;
+ }
+#ifdef TESTING_CAMPAIGN
+ case SDLK_c:
+ {
+ start_campaign();
+ redraw = 1;
}
-
+#endif
default:
{
/* Some other key - do nothing. */
More information about the Tux4kids-commits
mailing list