Skip to content

Commit

Permalink
Remove set_next_worldmap and VideoSystem::set_gamma
Browse files Browse the repository at this point in the history
  • Loading branch information
Vankata453 committed Dec 16, 2024
1 parent 8ccae8b commit fc15b78
Show file tree
Hide file tree
Showing 7 changed files with 0 additions and 72 deletions.
13 changes: 0 additions & 13 deletions src/squirrel/supertux_api.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -294,18 +294,6 @@ static void load_worldmap(const std::string& filename, const std::string& sector
WorldMap::current()->change(filename, sector, spawnpoint);
}
}
/**
* @scripting
* @description Switches to a different worldmap after unloading the current one, after ""exit_screen()"" is called.
* @param string $dirname The world directory, where the "worldmap.stwm" file is located.
* @param string $sector Forced sector to spawn in the worldmap on. Leave empty to use last sector from savegame.
* @param string $spawnpoint Forced spawnpoint to spawn in the worldmap on. Leave empty to use last position from savegame.
*/
static void set_next_worldmap(const std::string& dirname, const std::string& sector, const std::string& spawnpoint)
{
// TODO: remove this function
GameManager::current()->set_next_worldmap(dirname, sector, spawnpoint);
}
/**
* @scripting
* @description Loads and displays a level (on next screenswitch), using the savegame of the current level.
Expand Down Expand Up @@ -851,7 +839,6 @@ void register_supertux_scripting_api(ssq::VM& vm)
vm.addFunc("__", &scripting::Globals::translate_plural);
vm.addFunc("display_text_file", &scripting::Globals::display_text_file);
vm.addFunc("load_worldmap", &scripting::Globals::load_worldmap);
vm.addFunc("set_next_worldmap", &scripting::Globals::set_next_worldmap);
vm.addFunc("load_level", &scripting::Globals::load_level);
vm.addFunc("import", &scripting::Globals::import);
vm.addFunc("debug_collrects", &scripting::Globals::debug_collrects);
Expand Down
26 changes: 0 additions & 26 deletions src/supertux/game_manager.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -106,30 +106,4 @@ GameManager::start_worldmap(const World& world, const std::string& worldmap_file
return true;
}

bool
GameManager::load_next_worldmap()
{
if (!m_next_worldmap)
return false;

const auto next_worldmap = std::move(*m_next_worldmap);
m_next_worldmap.reset();

std::unique_ptr<World> world = World::from_directory(next_worldmap.world);
if (!world)
{
log_warning << "Cannot load world '" << next_worldmap.world << "'" << std::endl;
return false;
}

return start_worldmap(*world, "", next_worldmap.sector, next_worldmap.spawnpoint); // New world, new savegame.
}

void
GameManager::set_next_worldmap(const std::string& world, const std::string& sector,
const std::string& spawnpoint)
{
m_next_worldmap.emplace(world, sector, spawnpoint);
}

/* EOF */
20 changes: 0 additions & 20 deletions src/supertux/game_manager.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,6 @@

#include "util/currenton.hpp"

#include <optional>
#include <memory>
#include <string>

Expand All @@ -40,28 +39,9 @@ class GameManager final : public Currenton<GameManager>
void start_level(const World& world, const std::string& level_filename,
const std::optional<std::pair<std::string, Vector>>& start_pos = std::nullopt);

bool load_next_worldmap();
void set_next_worldmap(const std::string& world, const std::string& sector = "",
const std::string& spawnpoint = "");

private:
struct NextWorldMap
{
NextWorldMap(const std::string& w, const std::string& s,
const std::string& sp) :
world(w), sector(s), spawnpoint(sp)
{}

const std::string world;
const std::string sector;
const std::string spawnpoint;
};

private:
std::unique_ptr<Savegame> m_savegame;

std::optional<NextWorldMap> m_next_worldmap;

private:
GameManager(const GameManager&) = delete;
GameManager& operator=(const GameManager&) = delete;
Expand Down
8 changes: 0 additions & 8 deletions src/video/sdlbase_video_system.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -51,14 +51,6 @@ SDLBaseVideoSystem::set_title(const std::string& title)
SDL_SetWindowTitle(m_sdl_window.get(), title.c_str());
}

void
SDLBaseVideoSystem::set_gamma(float gamma)
{
Uint16 ramp[256];
SDL_CalculateGammaRamp(gamma, ramp);
SDL_SetWindowGammaRamp(m_sdl_window.get(), ramp, ramp, ramp);
}

void
SDLBaseVideoSystem::set_icon(const SDL_Surface& icon)
{
Expand Down
1 change: 0 additions & 1 deletion src/video/sdlbase_video_system.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,6 @@ class SDLBaseVideoSystem : public VideoSystem

virtual void set_title(const std::string& title) override;
virtual void set_icon(const SDL_Surface& icon) override;
virtual void set_gamma(float gamma) override;

virtual Size get_window_size() const override;
virtual void on_resize(int w, int h) override;
Expand Down
1 change: 0 additions & 1 deletion src/video/video_system.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,6 @@ class VideoSystem : public Currenton<VideoSystem>

virtual void set_vsync(int mode) = 0;
virtual int get_vsync() const = 0;
virtual void set_gamma(float gamma) = 0;
virtual void set_title(const std::string& title) = 0;
virtual void set_icon(const SDL_Surface& icon) = 0;
virtual SDLSurfacePtr make_screenshot() = 0;
Expand Down
3 changes: 0 additions & 3 deletions src/worldmap/worldmap.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,6 @@
#include "physfs/util.hpp"
#include "supertux/constants.hpp"
#include "supertux/fadetoblack.hpp"
#include "supertux/game_manager.hpp"
#include "supertux/gameconfig.hpp"
#include "supertux/level.hpp"
#include "supertux/menu/menu_storage.hpp"
Expand Down Expand Up @@ -123,8 +122,6 @@ WorldMap::leave()
{
save_state();
m_sector->leave();

GameManager::current()->load_next_worldmap();
}


Expand Down

0 comments on commit fc15b78

Please sign in to comment.