*/
#include <assert.h>
+#include <stdio.h>
#include <iostream>
#include <stdio.h>
#include <stdlib.h>
#include "gameloop.h"
#include "configfile.h"
#include "scene.h"
+#include "worldmap.h"
#ifdef WIN32
#define mkdir(dir, mode) mkdir(dir)
options_menu->additem(MN_LABEL,"Options",0,0);
options_menu->additem(MN_HL,"",0,0);
+#ifndef NOOPENGL
options_menu->additem(MN_TOGGLE,"OpenGL",use_gl,0);
+#else
+ options_menu->additem(MN_DEACTIVE,"OpenGL (not supported)",use_gl,0);
+#endif
options_menu->additem(MN_TOGGLE,"Fullscreen",use_fullscreen,0);
if(audio_device)
{
highscore_menu->additem(MN_TEXTFIELD,"Enter your name:",0,0);
}
-void update_load_save_game_menu(Menu* pmenu, int load)
+void update_load_save_game_menu(Menu* pmenu)
{
for(int i = 2; i < 7; ++i)
{
// FIXME: Insert a real savegame struct/class here instead of
// doing string vodoo
- std::string tmp = slotinfo(i-1);
-
- if(load && tmp.length() == strlen("Slot X - Free"))
- pmenu->item[i].kind = MN_ACTION;
- else
- pmenu->item[i].kind = MN_ACTION;
+ std::string tmp = slotinfo(i - 1);
+ pmenu->item[i].kind = MN_ACTION;
pmenu->item[i].change_text(tmp.c_str());
}
}
-void process_save_game_menu()
-{
- int slot = save_game_menu->check();
- if (slot != -1)
- GameSession::current()->savegame(slot - 1);
-}
-
bool process_load_game_menu()
{
int slot = load_game_menu->check();
if(slot != -1)
{
- // FIXME: Insert a real savegame struct/class here instead of
- // doing string vodoo
- std::string tmp = slotinfo(slot-1);
+ WorldMapNS::WorldMap worldmap;
- if (tmp.length() == strlen("Slot X - Free"))
- { // Slot is free, so start a new game
- GameSession session("default", 1, ST_GL_PLAY);
- session.run();
+ char slotfile[1024];
+ snprintf(slotfile, 1024, "%s/slot%d.stsg", st_save_dir, slot-1);
+
+ worldmap.loadgame(slotfile);
- show_menu = true;
- Menu::set_current(main_menu);
- }
- else
- {
- puts("Warning: Loading games isn't supported at the moment");
-#if 0
- // Slot contains a level, so load it
- if (game_started)
- {
- GameSession session("default",slot - 1,ST_GL_LOAD_GAME);
- session.run();
+ worldmap.display();
+
+ show_menu = true;
+ Menu::set_current(main_menu);
- show_menu = true;
- Menu::set_current(main_menu);
- }
- else
- {
- //loadgame(slot - 1);
- }
-#endif
- }
st_pause_ticks_stop();
return true;
}
switch (options_menu->check())
{
case 2:
+#ifndef NOOPENGL
if(use_gl != options_menu->item[2].toggled)
{
-#ifndef NOOPENGL
use_gl = !use_gl;
st_video_setup();
-#endif
}
+#endif
break;
case 3:
if(use_fullscreen != options_menu->item[3].toggled)
void st_video_setup(void)
{
-
if(screen != NULL)
SDL_FreeSurface(screen);
else
st_video_setup_sdl();
+ Surface::reload_all();
+
/* Set window manager stuff: */
SDL_WM_SetCaption("SuperTux " VERSION, "SuperTux");
-
}
void st_video_setup_sdl(void)