Skip to content

Commit

Permalink
MenuMiniMap: Add default_zoom_level property
Browse files Browse the repository at this point in the history
  • Loading branch information
dorkster committed Jan 8, 2024
1 parent e5bfbfd commit 3cc70cc
Show file tree
Hide file tree
Showing 5 changed files with 20 additions and 11 deletions.
1 change: 1 addition & 0 deletions RELEASE_NOTES.txt
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ Engine features:
* Horizontal list widgets can now display 2 or fewer options at once
* Added support for more than one of each chain power (pre_power/post_power/wall_power) to be attached to a single power.
* Added randomized items. Items can now be spawned with random level, quality, and bonus attributes.
* Added 'default_zoom_level' property to menu/minimap.txt config.

Engine fixes:

Expand Down
2 changes: 2 additions & 0 deletions docs/attribute-reference.html
Original file line number Diff line number Diff line change
Expand Up @@ -1594,6 +1594,8 @@ <h4>MenuMiniMap</h4>

<p><strong>button_config</strong> | <code>point</code> | Position of the 'Configuration' button. The button will be hidden if not defined.</p>

<p><strong>default_zoom_level</strong> | <code>int</code> | Zoom level of the map when viewed at "1x". By default, this is 1, which equates to each tile being 1 pixel tall.</p>

<hr />

<h4>MenuMovementType</h4>
Expand Down
25 changes: 15 additions & 10 deletions src/MenuMiniMap.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -70,6 +70,7 @@ MenuMiniMap::MenuMiniMap()
, button_config(NULL)
, visible_radius(0)
, current_zoom(1)
, base_zoom(1)
, lock_zoom_change(false)
, clicked_config(false)

Expand Down Expand Up @@ -126,6 +127,10 @@ MenuMiniMap::MenuMiniMap()
Point p = Parse::toPoint(infile.val);
button_config->setBasePos(p.x, p.y, Utils::ALIGN_TOPLEFT);
}
// @ATTR default_zoom_level|int|Zoom level of the map when viewed at "1x". By default, this is 1, which equates to each tile being 1 pixel tall.
else if (infile.key == "default_zoom_level") {
base_zoom = Parse::toInt(infile.val);
}
else {
infile.error("MenuMiniMap: '%s' is not a valid key.", infile.key.c_str());
}
Expand Down Expand Up @@ -246,9 +251,9 @@ void MenuMiniMap::render(const FPoint& hero_pos) {
label->render();

if (settings->minimap_mode == Settings::MINIMAP_NORMAL)
current_zoom = 1;
current_zoom = 1 * base_zoom;
else if (settings->minimap_mode == Settings::MINIMAP_2X)
current_zoom = 2;
current_zoom = 2 * base_zoom;

renderMapSurface(hero_pos);

Expand All @@ -265,24 +270,24 @@ void MenuMiniMap::prerender(MapCollision *collider, int map_w, int map_h) {
map_size.y = map_h;

if (eset->tileset.orientation == eset->tileset.TILESET_ISOMETRIC) {
prerenderIso(collider, &map_surface, &map_surface_entities, 1);
prerenderIso(collider, &map_surface_2x, &map_surface_entities_2x, 2);
prerenderIso(collider, &map_surface, &map_surface_entities, base_zoom);
prerenderIso(collider, &map_surface_2x, &map_surface_entities_2x, base_zoom*2);
}
else {
// eset->tileset.TILESET_ORTHOGONAL
prerenderOrtho(collider, &map_surface, &map_surface_entities, 1);
prerenderOrtho(collider, &map_surface_2x, &map_surface_entities_2x, 2);
prerenderOrtho(collider, &map_surface, &map_surface_entities, base_zoom);
prerenderOrtho(collider, &map_surface_2x, &map_surface_entities_2x, base_zoom*2);
}
}
void MenuMiniMap::update(MapCollision *collider, Rect *bounds) {
if (eset->tileset.orientation == eset->tileset.TILESET_ISOMETRIC) {
updateIso(collider, &map_surface, 1, bounds);
updateIso(collider, &map_surface_2x, 2, bounds);
updateIso(collider, &map_surface, base_zoom, bounds);
updateIso(collider, &map_surface_2x, base_zoom*2, bounds);
}
else {
// eset->tileset.TILESET_ORTHOGONAL
updateOrtho(collider, &map_surface, 1, bounds);
updateOrtho(collider, &map_surface_2x, 2, bounds);
updateOrtho(collider, &map_surface, base_zoom, bounds);
updateOrtho(collider, &map_surface_2x, base_zoom*2, bounds);
}
}

Expand Down
1 change: 1 addition & 0 deletions src/MenuMiniMap.h
Original file line number Diff line number Diff line change
Expand Up @@ -72,6 +72,7 @@ class MenuMiniMap : public Menu {

float visible_radius;
int current_zoom;
int base_zoom;
bool lock_zoom_change;

std::vector<PixelEntity*> entities;
Expand Down
2 changes: 1 addition & 1 deletion src/Version.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ FLARE. If not, see http://www.gnu.org/licenses/

#include <SDL.h>

Version VersionInfo::ENGINE(1, 14, 32);
Version VersionInfo::ENGINE(1, 14, 33);
Version VersionInfo::MIN(0, 0, 0);
Version VersionInfo::MAX(USHRT_MAX, USHRT_MAX, USHRT_MAX);

Expand Down

0 comments on commit 3cc70cc

Please sign in to comment.