Skip to content
Open
Show file tree
Hide file tree
Changes from 6 commits
Commits
Show all changes
33 commits
Select commit Hold shift + click to select a range
b3aa1e5
Split SEGMENTSIZE_XY and add an autosize conifg
realSquidCoder Jan 13, 2025
6c8bdcc
Merge branch 'DFHack:master' into squid-segmentsize-changes
realSquidCoder Jan 15, 2025
166e8c8
change how we do autosizing
realSquidCoder Jan 15, 2025
8914fae
forgot cmath and the renaming of vars
realSquidCoder Jan 15, 2025
2e49f32
Merge branch 'DFHack:master' into squid-segmentsize-changes
realSquidCoder Jan 15, 2025
0f3a8e0
remove use of std::min
realSquidCoder Jan 15, 2025
59b0f47
Resolve code review things and add keybinds
realSquidCoder Jan 15, 2025
234a2fd
cleaned autosizer
realSquidCoder Jan 16, 2025
5904d00
Update changelog.txt
realSquidCoder Jan 16, 2025
f0c0520
Forgot cmath
realSquidCoder Jan 16, 2025
c23aa74
fixing up autosizer
realSquidCoder Jan 16, 2025
5291b38
Code review changes
realSquidCoder Jan 16, 2025
260a255
Revert keys and add my name
realSquidCoder Jan 16, 2025
ed6d416
Fix typo in keys
realSquidCoder Jan 16, 2025
7ad9b31
cleaned up use of getAutoSegmentSize
realSquidCoder Jan 16, 2025
7d3e3b9
Update docs/changelog.txt
realSquidCoder Jan 16, 2025
eeb3305
remove my name. (belongs in a new PR with Rome added too!)
realSquidCoder Jan 16, 2025
e74be9f
Apply suggestions from code review
realSquidCoder Jan 17, 2025
833708c
Merge branch 'DFHack:master' into squid-segmentsize-changes
realSquidCoder Jan 19, 2025
949ac83
Merge files
realSquidCoder Jan 19, 2025
135e2d8
Merge remote-tracking branch 'upstream/master' into squid-segmentsize…
realSquidCoder Jan 19, 2025
ce4ff34
missed a few lines
realSquidCoder Jan 19, 2025
1a88f44
Merge
realSquidCoder Jan 20, 2025
e5c4ca5
Merge branch 'master' into squid-segmentsize-changes
realSquidCoder Jan 21, 2025
1aceaaa
Merge branch 'master' into squid-segmentsize-changes
realSquidCoder Jan 21, 2025
ab3fb1f
Merge branch 'master' into squid-segmentsize-changes
realSquidCoder Jan 23, 2025
f5b81e3
Remember to do an initial resize.
realSquidCoder Jan 25, 2025
1dd470e
Merge branch 'master' into squid-segmentsize-changes
realSquidCoder Jan 25, 2025
07b545f
Use auto bc we made it for a reason
realSquidCoder Feb 13, 2025
4b9957a
Merge branch 'master' into squid-segmentsize-changes
realSquidCoder Feb 13, 2025
8456049
Merge branch 'master' into squid-segmentsize-changes
myk002 Feb 22, 2025
571d3dd
Merge remote-tracking branch 'upstream/master' into squid-segmentsize…
realSquidCoder Mar 6, 2025
1d96ef9
Merge branch 'master' into squid-segmentsize-changes
myk002 Mar 9, 2025
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
52 changes: 43 additions & 9 deletions Config.cpp
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
#include <cmath>
#include <iostream>
#include <fstream>
#include <string>
Expand Down Expand Up @@ -83,26 +84,59 @@ namespace {
string result = parseStrFromLine("WINDOWED", line);
ssConfig.Fullscreen = (result == "NO");
}
int autoSegForXY = (int)std::ceil(std::sqrt(2) * (ssState.ScreenW + ssState.ScreenH) / TILEWIDTH);
if (line.find("[SEGMENTSIZE_XY") != string::npos) {
int value = parseIntFromLine("SEGMENTSIZE_XY", line);
if (value < 1) {
value = DEFAULT_SIZE;
bool autosize = (parseStrFromLine("SEGMENTSIZE_XY", line) == "AUTO");
int value = DEFAULT_SEGSIZE_XY;
if (autosize) {
value = autoSegForXY;
} else {
value = parseIntFromLine("SEGMENTSIZE_XY", line);
value = ((value < MIN_SEGSIZE) ? DEFAULT_SEGSIZE_XY : value);
value = ((value > MAX_SEGSIZE) ? MAX_SEGSIZE : value);
}
if (value > 100) {
value = 100;
//plus 2 to allow edge readings
value += 2;
ssState.Size.x = value;
ssState.Size.y = value;
}
if (line.find("[SEGMENTSIZE_X") != string::npos) {
bool autosize = (parseStrFromLine("SEGMENTSIZE_X", line) == "AUTO");
int value = DEFAULT_SEGSIZE_XY;
if (autosize) {
value = autoSegForXY;
}
else {
value = parseIntFromLine("SEGMENTSIZE_X", line);
value = ((value < MIN_SEGSIZE) ? DEFAULT_SEGSIZE_XY : value);
value = ((value > MAX_SEGSIZE) ? MAX_SEGSIZE : value);
}
//plus 2 to allow edge readings
ssState.Size.x = value + 2;
ssState.Size.y = value + 2;
value += 2;
ssState.Size.x = value;
}
if (line.find("[SEGMENTSIZE_Y") != string::npos) {
bool autosize = (parseStrFromLine("SEGMENTSIZE_Y", line) == "AUTO");
int value = DEFAULT_SEGSIZE_XY;
if (autosize) {
value = autoSegForXY;
}
else {
value = parseIntFromLine("SEGMENTSIZE_Y", line);
value = ((value < MIN_SEGSIZE) ? DEFAULT_SEGSIZE_XY : value);
value = ((value > MAX_SEGSIZE) ? MAX_SEGSIZE : value);
}
//plus 2 to allow edge readings
value += 2;
ssState.Size.y = value;
}
if (line.find("[SEGMENTSIZE_Z") != string::npos) {
int value = parseIntFromLine("SEGMENTSIZE_Z", line);
if (value < 1) {
value = DEFAULT_SIZE_Z;
value = DEFAULT_SEGSIZE_Z;
}
ssState.Size.z = value;
}

if (line.find("[ALLCREATURES") != string::npos) {
string result = parseStrFromLine("ALLCREATURES", line);
ssConfig.show_all_creatures = (result == "YES");
Expand Down
6 changes: 4 additions & 2 deletions common.h
Original file line number Diff line number Diff line change
Expand Up @@ -88,8 +88,10 @@ constexpr auto SPRITEWIDTH = TILEWIDTH;
constexpr auto SPRITEHEIGHT = (TILETOPHEIGHT + WALLHEIGHT);
constexpr auto WALL_CUTOFF_HEIGHT = 15;

constexpr auto DEFAULT_SIZE = 20;
constexpr auto DEFAULT_SIZE_Z = 6;
constexpr auto MIN_SEGSIZE = 1;
constexpr auto MAX_SEGSIZE = 100;;
constexpr auto DEFAULT_SEGSIZE_XY = 20;
constexpr auto DEFAULT_SEGSIZE_Z = 6;
constexpr auto MAPNAVIGATIONSTEP = 1;
constexpr auto MAPNAVIGATIONSTEPBIG = 10;

Expand Down
1 change: 1 addition & 0 deletions commonTypes.h
Original file line number Diff line number Diff line change
Expand Up @@ -143,6 +143,7 @@ class dfColors

struct GameConfiguration {
bool overlay_mode;
bool autosize_segment;
bool show_zones;
bool show_stockpiles;
bool show_designations;
Expand Down
6 changes: 4 additions & 2 deletions configs/init.txt
Original file line number Diff line number Diff line change
Expand Up @@ -12,9 +12,11 @@ using WIDTH and HEIGHT for resolution. Try and use resolutions compatible
with your drivers, or the program will still load in window mode.
[WINDOWED:YES]

These two options set how large the cube loaded from Dwarf Fortress is.
These three options set how large the cube loaded from Dwarf Fortress is.
Each entry expects the number of tiles to load.
[SEGMENTSIZE_XY:70]
SEGMENTSIZE_X and SEGMENTSIZE_Y allow using "AUTO" (for example "[SEGMENTSIZE_X:AUTO]").
[SEGMENTSIZE_X:70]
[SEGMENTSIZE_Y:70]
[SEGMENTSIZE_Z:4]

Change this to off to skip the intro.
Expand Down
13 changes: 10 additions & 3 deletions main.cpp
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
#include <assert.h>
#include <cmath>
#include <vector>
#include <list>

Expand Down Expand Up @@ -340,6 +341,11 @@ static void main_loop(ALLEGRO_DISPLAY * display, ALLEGRO_EVENT_QUEUE *queue, ALL
case ALLEGRO_EVENT_DISPLAY_RESIZE:
if (ssConfig.overlay_mode) {
break;

}
if (ssConfig.autosize_segment) {
ssState.Size.x = (int)std::ceil(std::sqrt(2) * (ssState.ScreenW + ssState.ScreenH) / TILEWIDTH);
ssState.Size.y = (int)std::ceil(std::sqrt(2) * (ssState.ScreenW + ssState.ScreenH) / TILEWIDTH);
}
timeToReloadSegment = true;
redraw = true;
Expand Down Expand Up @@ -400,15 +406,16 @@ static void * stonesense_thread(ALLEGRO_THREAD * main_thread, void * parms)
ssConfig.shade_hidden_tiles = true;
ssConfig.load_ground_materials = true;
ssConfig.automatic_reload_time = 0;
ssConfig.autosize_segment = false;
ssConfig.automatic_reload_step = 500;
ssConfig.lift_segment_offscreen_x = 0;
ssConfig.lift_segment_offscreen_y = 0;
ssConfig.Fullscreen = FULLSCREEN;
ssState.ScreenH = RESOLUTION_HEIGHT;
ssState.ScreenW = RESOLUTION_WIDTH;
ssState.Size.x = DEFAULT_SIZE;
ssState.Size.y = DEFAULT_SIZE;
ssState.Size.z = DEFAULT_SIZE_Z;
ssState.Size.x = DEFAULT_SEGSIZE_XY;
ssState.Size.y = DEFAULT_SEGSIZE_XY;
ssState.Size.z = DEFAULT_SEGSIZE_Z;
ssConfig.show_creature_names = false;
ssConfig.show_osd = true;
ssConfig.show_designations = true;
Expand Down