#!/bin/sh
-aclocal-1.7
+aclocal-1.7 -I mk/autoconf
automake-1.7 --copy --add-missing
autoconf
AC_PROG_CC
AC_PROG_CXX
AC_PROG_INSTALL
-AC_LANG(C++)
dnl Checks for header files.
AC_HEADER_DIRENT
AC_ARG_ENABLE(debug,
AC_HELP_STRING([--enable-debug], [enable debugging mode]),, enable_debug="yes")
if test "x${enable_debug}" != "xno"; then
- CXXFLAGS="$CXXFLAGS -DDEBUG"
+ CXXFLAGS="$CXXFLAGS -Wall -W -DDEBUG"
AC_MSG_RESULT([enabled])
else
AC_MSG_RESULT([disabled])
fi
-AC_MSG_CHECKING(weather OpenGL should be used)
+AC_MSG_CHECKING(wether OpenGL should be used)
AC_ARG_ENABLE(opengl,
AC_HELP_STRING([--disable-opengl], [disable OpenGL support]),, enable_opengl="yes")
if test "x${enable_opengl}" != "xno"; then
- CXXFLAGS="$CXXFLAGS -D__OPENGL"
AC_MSG_RESULT([yes])
else
- CXXFLAGS="$CXXFLAGS -DNOOPENGL"
- AC_MSG_RESULT([no])
-fi
-
-AC_MSG_CHECKING(weather Sound should be supported)
-AC_ARG_ENABLE(sound,
- AC_HELP_STRING([--disable-sound], [disable sound support]),, enable_sound="yes")
-if test "x${enable_sound}" != "xno"; then
- CXXFLAGS="$CXXFLAGS -D__SOUND"
- AC_MSG_RESULT([yes])
-else
- CXXFLAGS="$CXXFLAGS -DNOSOUND"
AC_MSG_RESULT([no])
fi
dnl ===========================================================================
dnl Check for SDL
-AC_LANG_PUSH(C)
AM_PATH_SDL($SDL_VERSION,
:,
AC_MSG_ERROR([*** SDL version $SDL_VERSION not found!]))
CXXFLAGS="$CXXFLAGS $SDL_CFLAGS"
-LDFLAGS="$LDFLAGS $SDL_LIBS"
+CFLAGS="$CFLAGS $SDL_CFLAGS"
+LIBS="$LIBS $SDL_LIBS"
dnl Checks for additional libraries.
-if test "x${enable_sound}" != "xno"; then
- AC_CHECK_LIB(SDL_mixer, SDL_OpenAudio,,
- [CXXFLAGS="$CXXFLAGS -DNOSOUND"
- enable_sound="no"])
-fi
+AC_CHECK_LIB(SDL_mixer, Mix_OpenAudio,,
+ AC_MSG_ERROR([SDL_mixer library required]))
-AC_CHECK_LIB(SDL_image, IMG_Load, ,AC_MSG_ERROR(SDL_image library required))
+AC_CHECK_LIB(SDL_image, IMG_Load,,
+ AC_MSG_ERROR([SDL_image library required]))
if test "x${enable_opengl}" != "xno"; then
- # grumbel: xlib path is needed on my system to get OpenGL right,
- # else I end up with a black screen, might be a debian issue or a
- # local issue on my system, not sure
- AC_PATH_XTRA
- CXXFLAGS="$CXXFLAGS $X_CFLAGS"
- LDFLAGS="$LDFLAGS $X_LIBS"
-
- AC_CHECK_LIB(GL, glBegin,,
- [CXXFLAGS="$CXXFLAGS -DNOOPENGL"
- enable_opengl="no"])
+ AX_CHECK_GL
+fi
+if test "x$no_gl" = "xyes" -o "x$enable_opengl" = "xno"; then
+ CXXFLAGS="$CXXFLAGS -DNOOPENGL"
+ enable_opengl="no"
+else
+ CFLAGS="$CFLAGS $GL_CFLAGS"
+ CXXFLAGS="$CXXFLAGS $GL_CFLAGS"
+ LIBS="$LIBS $GL_LIBS"
fi
-AC_LANG_POP()
AC_CHECK_LIB(z, gzopen,, AC_MSG_ERROR([*** zlib is missing]))
-# FIXME: Evil
-CXXFLAGS="$CXXFLAGS -DDATA_PREFIX='\"$datadir/supertux/\"' -DLINUX"
+CXXFLAGS="$CXXFLAGS -DDATA_PREFIX='\"$datatdir/supertux\"'"
dnl Checks for library functions.
AC_CHECK_FUNCS(mkdir strdup strstr)
echo " Profile Mode: $enable_gprof"
echo " Debug Mode: $enable_debug"
echo " OpenGL Support: $enable_opengl"
-echo " Sound Support: $enable_sound"
echo ""
# EOF #
$(wildcard images/shared/*.png) \
$(wildcard images/status/*.png) \
$(wildcard images/themes/*/*.png) \
+ $(wildcard images/worldmap/*.png) \
$(wildcard images/title/*.png) \
levels/default/info.png \
levels/default/info \
sprintf(str,"(%s)", SDL_GetKeyName(pbutton->shortcut));
text_draw(&white_small_text, str, i + pbutton->x - strlen(str) * white_small_text.w, pbutton->y + white_small_text.h+2, 1, NO_UPDATE);
}
- if(pbutton->state == BN_PRESSED)
+ if(pbutton->state == BUTTON_PRESSED)
fillrect(pbutton->x,pbutton->y,pbutton->w,pbutton->h,75,75,75,200);
- else if(pbutton->state == BN_HOVER)
+ else if(pbutton->state == BUTTON_HOVER)
fillrect(pbutton->x,pbutton->y,pbutton->w,pbutton->h,150,150,150,128);
}
{
if(event->button.button == SDL_BUTTON_LEFT)
{
- pbutton->state = BN_PRESSED;
+ pbutton->state = BUTTON_PRESSED;
}
else
{
}
else if(event->type == SDL_MOUSEBUTTONUP)
{
- if(event->button.button == SDL_BUTTON_LEFT && pbutton->state == BN_PRESSED)
+ if(event->button.button == SDL_BUTTON_LEFT && pbutton->state == BUTTON_PRESSED)
{
- pbutton->state = BN_CLICKED;
+ pbutton->state = BUTTON_CLICKED;
}
- else if(event->button.button != SDL_BUTTON_LEFT && pbutton->state != BN_PRESSED)
+ else if(event->button.button != SDL_BUTTON_LEFT && pbutton->state != BUTTON_PRESSED)
{
pbutton->show_info = YES;
}
}
- if(pbutton->state != BN_PRESSED && pbutton->state != BN_CLICKED)
+ if(pbutton->state != BUTTON_PRESSED && pbutton->state != BUTTON_CLICKED)
{
- pbutton->state = BN_HOVER;
+ pbutton->state = BUTTON_HOVER;
}
}
else if(event->type != SDL_KEYDOWN && event->type != SDL_KEYUP)
if(event->type == SDL_KEYDOWN)
{
if(key == pbutton->shortcut)
- pbutton->state = BN_PRESSED;
+ pbutton->state = BUTTON_PRESSED;
}
else if(event->type == SDL_KEYUP)
{
- if(pbutton->state == BN_PRESSED && key == pbutton->shortcut)
- pbutton->state = BN_CLICKED;
+ if(pbutton->state == BUTTON_PRESSED && key == pbutton->shortcut)
+ pbutton->state = BUTTON_CLICKED;
}
else if(event->type == SDL_MOUSEMOTION)
{
int button_get_state(button_type* pbutton)
{
int state;
- if(pbutton->state == BN_CLICKED)
+ if(pbutton->state == BUTTON_CLICKED)
{
state = pbutton->state;
pbutton->state = -1;
#include "texture.h"
enum {
- BN_CLICKED,
- BN_PRESSED,
- BN_HOVER
+ BUTTON_CLICKED,
+ BUTTON_PRESSED,
+ BUTTON_HOVER
};
typedef struct button_type
#include <SDL.h>
#include <SDL_image.h>
-#ifndef LINUX
#include <sys/types.h>
#include <ctype.h>
-#endif
#include "defines.h"
#include "globals.h"
{
/* Check for button events */
button_event(&le_test_level_bt,&event);
- if(button_get_state(&le_test_level_bt) == BN_CLICKED)
+ if(button_get_state(&le_test_level_bt) == BUTTON_CLICKED)
le_testlevel();
button_event(&le_save_level_bt,&event);
- if(button_get_state(&le_save_level_bt) == BN_CLICKED)
+ if(button_get_state(&le_save_level_bt) == BUTTON_CLICKED)
level_save(le_current_level,le_level_subset.name.c_str(),le_level);
button_event(&le_next_level_bt,&event);
- if(button_get_state(&le_next_level_bt) == BN_CLICKED)
+ if(button_get_state(&le_next_level_bt) == BUTTON_CLICKED)
{
if(le_level < le_level_subset.levels)
{
}
}
button_event(&le_previous_level_bt,&event);
- if(button_get_state(&le_previous_level_bt) == BN_CLICKED)
+ if(button_get_state(&le_previous_level_bt) == BUTTON_CLICKED)
{
if(le_level > 1)
le_goto_level(--le_level);
}
button_event(&le_rubber_bt,&event);
- if(button_get_state(&le_rubber_bt) == BN_CLICKED)
+ if(button_get_state(&le_rubber_bt) == BUTTON_CLICKED)
le_current_tile = '.';
button_event(&le_select_mode_one_bt,&event);
- if(button_get_state(&le_select_mode_one_bt) == BN_CLICKED)
+ if(button_get_state(&le_select_mode_one_bt) == BUTTON_CLICKED)
le_selection_mode = CURSOR;
button_event(&le_select_mode_two_bt,&event);
- if(button_get_state(&le_select_mode_two_bt) == BN_CLICKED)
+ if(button_get_state(&le_select_mode_two_bt) == BUTTON_CLICKED)
le_selection_mode = SQUARE;
button_event(&le_bad_bt,&event);
- if(button_get_state(&le_bad_bt) == BN_CLICKED)
+ if(button_get_state(&le_bad_bt) == BUTTON_CLICKED)
{
le_bad_panel.hidden = NO;
le_fgd_panel.hidden = YES;
}
button_event(&le_fgd_bt,&event);
- if(button_get_state(&le_fgd_bt) == BN_CLICKED)
+ if(button_get_state(&le_fgd_bt) == BUTTON_CLICKED)
{
le_bad_panel.hidden = YES;
le_fgd_panel.hidden = NO;
le_bkgd_panel.hidden = YES;
}
button_event(&le_bkgd_bt,&event);
- if(button_get_state(&le_bkgd_bt) == BN_CLICKED)
+ if(button_get_state(&le_bkgd_bt) == BUTTON_CLICKED)
{
le_bad_panel.hidden = YES;
le_fgd_panel.hidden = YES;
le_bkgd_panel.hidden = NO;
}
button_event(&le_settings_bt,&event);
- if(button_get_state(&le_settings_bt) == BN_CLICKED)
+ if(button_get_state(&le_settings_bt) == BUTTON_CLICKED)
{
if(show_menu == NO)
{
}
if((pbutton = button_panel_event(&le_bkgd_panel,&event)) != NULL)
{
- if(button_get_state(pbutton) == BN_CLICKED)
+ if(button_get_state(pbutton) == BUTTON_CLICKED)
{
char c = '\0';
if(pbutton->tag >= 0 && pbutton->tag <= 3)
}
if((pbutton = button_panel_event(&le_fgd_panel,&event)) != NULL)
{
- if(button_get_state(pbutton) == BN_CLICKED)
+ if(button_get_state(pbutton) == BUTTON_CLICKED)
{
char c = '\0';
if(pbutton->tag == 0)
}
if((pbutton = button_panel_event(&le_bad_panel,&event)) != NULL)
{
- if(button_get_state(pbutton) == BN_CLICKED)
+ if(button_get_state(pbutton) == BUTTON_CLICKED)
{
char c = '\0';
if(pbutton->tag >= 0 && pbutton->tag <= 2)
else
{
button_event(&le_settings_bt,&event);
- if(button_get_state(&le_settings_bt) == BN_CLICKED)
+ if(button_get_state(&le_settings_bt) == BUTTON_CLICKED)
{
if(show_menu == NO)
{
}
if(show_menu == NO)
{
- if(button_get_state(&le_move_left_bt) == BN_PRESSED)
+ if(button_get_state(&le_move_left_bt) == BUTTON_PRESSED)
{
pos_x -= 192;
}
- else if(button_get_state(&le_move_left_bt) == BN_HOVER)
+ else if(button_get_state(&le_move_left_bt) == BUTTON_HOVER)
{
pos_x -= 96;
}
- if(button_get_state(&le_move_right_bt) == BN_PRESSED)
+ if(button_get_state(&le_move_right_bt) == BUTTON_PRESSED)
{
pos_x += 192;
}
- else if(button_get_state(&le_move_right_bt) == BN_HOVER)
+ else if(button_get_state(&le_move_right_bt) == BUTTON_HOVER)
{
pos_x += 96;
}
#include <SDL_opengl.h>
#endif
-#ifndef WIN32
#include <sys/stat.h>
#include <sys/types.h>
#include <dirent.h>
+#ifndef WIN32
#include <libgen.h>
-#include <ctype.h>
#endif
+#include <ctype.h>
#include "defines.h"
#include "globals.h"
#include "menu.h"
#include "gameloop.h"
+#ifdef WIN32
+#define mkdir(dir, mode) mkdir(dir)
+// on win32 we typically don't want LFS paths
+#undef DATA_PREFIX
+#define DATA_PREFIX "./data"
+#endif
+
/* Local function prototypes: */
void seticon(void);
strcat(st_save_dir,"/save");
/* Create them. In the case they exist they won't destroy anything. */
-#ifndef WIN32
mkdir(st_dir, 0755);
mkdir(st_save_dir, 0755);
sprintf(str, "%s/levels", st_dir);
mkdir(str, 0755);
-#else
- mkdir(st_dir);
- mkdir(st_save_dir);
- sprintf(str, "%s/levels", st_dir);
- mkdir(str);
-#endif
// User has not that a datadir, so we try some magic
if (datadir.empty())
{
+#ifndef WIN32
// Detect datadir
char exe_file[PATH_MAX];
if (readlink("/proc/self/exe", exe_file, PATH_MAX) < 0)
}
}
}
+#else
+ datadir = DATA_PREFIX;
+#endif
}
printf("Datadir: %s\n", datadir.c_str());
}
show_fps = NO;
use_gl = NO;
-#ifndef NOSOUND
-
use_sound = YES;
use_music = YES;
audio_device = YES;
-#else
-
- use_sound = NO;
- use_music = NO;
- audio_device = NO;
-#endif
/* Parse arguments: */
else if (strcmp(argv[i], "--disable-sound") == 0)
{
/* Disable the compiled in sound feature */
-#ifndef NOSOUND
printf("Sounds disabled \n");
use_sound = NO;
-#else
-
- printf("Warning: Sound capability has not been compiled into this build.\n");
-#endif
-
}
else if (strcmp(argv[i], "--disable-music") == 0)
{
/* Disable the compiled in sound feature */
-#ifndef NOSOUND
printf("Music disabled \n");
use_music = NO;
-#else
-
- printf("Warning: Music feature is not compiled in \n");
-#endif
-
}
else if (strcmp(argv[i], "--debug-mode") == 0)
{
};
-#ifndef NOSOUND
-
#include <SDL_mixer.h>
Mix_Chunk * sounds[NUM_SOUNDS];
/* use halt_music whenever you want to stop it */
}
-#else
-
-void* sounds[NUM_SOUNDS];
-void* level_song, * level_song_fast, * herring_song;
-
-int open_audio (int frequency, int format, int channels, int chunksize)
-{
- return -1;
-}
-
-
-void close_audio(void)
-{}
-
-
-void* load_sound(void* file)
-{
- return NULL;
-}
-
-
-void play_sound(void * snd, enum Sound_Speaker whichSpeaker)
-{}
-
-
-void* load_song(void* file)
-{
- return NULL;
-}
-
-
-int playing_music()
-{
- return 0;
-}
-
-
-void halt_music()
-{}
-
-
-int play_music(void *music, int loops)
-{
- return 0;
-}
-
-
-void free_music(void *music)
-{}
-
-
-void free_chunk(void *chunk)
-{}
-
-int get_current_music()
-{
-}
-
-void set_current_music(int music)
-{
-}
-
-void play_current_music(void)
-{}
-
-#endif
extern char* soundfilenames[NUM_SOUNDS];
-#ifndef NOSOUND
-
#include <string>
#include <SDL_mixer.h>
void set_current_music(int music);
void play_current_music();
-#else
-
-/* fake variables */
-extern void* sounds[NUM_SOUNDS];
-extern void * level_song, * level_song_fast, * herring_song;
-
-/* fake sound handlers */
-int open_audio (int frequency, int format, int channels, int chunksize);
-void close_audio( void );
-
-void* load_sound(void* file);
-void play_sound(void * snd, enum Sound_Speaker whichSpeaker);
-void* load_song(void* file);
-
-int playing_music();
-void halt_music();
-int play_music(void *music, int loops);
-void free_music(void *music);
-void free_chunk(void *chunk);
-
-int get_current_music();
-void set_current_music(int music);
-void play_current_music(void);
-
-#endif
-
#endif /*SUPERTUX_SOUND_H*/
/* --- MAIN --- */
-#ifdef WIN32
-main(int argc, char * argv[])
-#else
int main(int argc, char * argv[])
-#endif
{
int done;
#ifndef SUPERTUX_SUPERTUX_H
#define SUPERTUX_SUPERTUX_H
-#ifdef LINUX
-#include <pwd.h>
#include <sys/types.h>
#include <ctype.h>
-#endif
#include "defines.h"
#include "globals.h"
#ifndef SUPERTUX_TEXTURE_H
#define SUPERTUX_TEXTURE_H
+#include <SDL.h>
#include <string>
-
-#include "SDL.h"
#ifndef NOOPENGL
-#include "SDL_opengl.h"
+#include <SDL_opengl.h>
#endif
#include "screen.h"
#include <vector>
#include <string>
+#include <SDL_mixer.h>
+
namespace WorldMapNS {
struct Point