Skip to content

Commit

Permalink
Save target tilemap alpha in worldmap sector state
Browse files Browse the repository at this point in the history
Saving the target tilemap alpha ensures that quitting a worldmap, while a tilemap fade is taking place, would not cause the tilemap to have an unintended alpha value on next enter.
  • Loading branch information
Vankata453 committed May 6, 2024
1 parent cc98597 commit afdbb8e
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 1 deletion.
2 changes: 2 additions & 0 deletions src/object/tilemap.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -210,6 +210,8 @@ class TileMap final :
target alpha. */
float get_alpha() const;

float get_target_alpha() const { return m_alpha; }

void set_tileset(const TileSet* new_tileset);

const std::vector<uint32_t>& get_tiles() const { return m_tiles; }
Expand Down
2 changes: 1 addition & 1 deletion src/worldmap/worldmap_state.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -361,7 +361,7 @@ WorldMapState::save_tilemap_visibility() const
{
sq_pushstring(vm.get_vm(), tilemap.get_name().c_str(), -1);
sq_newtable(vm.get_vm());
vm.store_float("alpha", tilemap.get_alpha());
vm.store_float("alpha", tilemap.get_target_alpha());
if (SQ_FAILED(sq_createslot(vm.get_vm(), -3)))
{
throw std::runtime_error("failed to create '" + m_worldmap.m_name + "' table entry");
Expand Down

0 comments on commit afdbb8e

Please sign in to comment.