Skip to content

Commit

Permalink
Merge pull request #156 from SquidCoderIndustries/squid-stonesense-zo…
Browse files Browse the repository at this point in the history
…omtrack

Make Stonesense zoom follow the DF window zoom
  • Loading branch information
myk002 authored Jan 21, 2025
2 parents 9353a43 + b021bc6 commit d92965b
Show file tree
Hide file tree
Showing 4 changed files with 11 additions and 2 deletions.
4 changes: 4 additions & 0 deletions MapLoading.cpp
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
#include <cmath>

#include "common.h"
#include "MapLoading.h"
#include "GUI.h"
Expand Down Expand Up @@ -959,6 +961,8 @@ void read_segment( void *arg)
followCurrentDFFocus();
stonesenseState.ssConfig.follow_DFcursor = true;
}
stonesenseState.ssConfig.zoom = (df::global::gps->viewport_zoom_factor - 64) / 16;
stonesenseState.ssConfig.scale = std::pow(SCALEZOOMFACTOR, stonesenseState.ssConfig.zoom);
}
segment = stonesenseState.map_segment.getRead();
readMapSegment(segment, ssState);
Expand Down
6 changes: 4 additions & 2 deletions UserInput.cpp
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
#include <cmath>

#include "common.h"
#include "GUI.h"
#include "BuildingConfiguration.h"
Expand Down Expand Up @@ -457,14 +459,14 @@ void action_incrzoom(uint32_t keymod)
{
auto& ssConfig = stonesenseState.ssConfig;
ssConfig.zoom++;
ssConfig.scale = pow(1.1f, ssConfig.zoom);
ssConfig.scale = std::pow(SCALEZOOMFACTOR, ssConfig.zoom);
}

void action_decrzoom(uint32_t keymod)
{
auto& ssConfig = stonesenseState.ssConfig;
ssConfig.zoom--;
ssConfig.scale = pow(1.1f, ssConfig.zoom);
ssConfig.scale = std::pow(SCALEZOOMFACTOR, ssConfig.zoom);
}

void action_screenshot(uint32_t keymod)
Expand Down
2 changes: 2 additions & 0 deletions common.h
Original file line number Diff line number Diff line change
Expand Up @@ -232,3 +232,5 @@ constexpr auto FORM_BAR = 1;
constexpr auto FORM_BLOCK = 2;
constexpr auto FORM_BOULDER = 3;
constexpr auto FORM_LOG = 4;

constexpr auto SCALEZOOMFACTOR = 1.1f;
1 change: 1 addition & 0 deletions docs/changelog.txt
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,7 @@ Template for new versions:
- `stonesense`: added some missing artwork for bookcases, displays, and offering places
- `stonesense`: reorganized the position of some existing art to be more intuitive
- `stonesense`: added index numbers empty sprite slots to aid in making the xml files for the sprites
- `stonesense`: zoom levels in stonesense now mirror the main game when in follow mode

## Removed

Expand Down

0 comments on commit d92965b

Please sign in to comment.