Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Obsidian unstable -> stable #175

Merged
merged 4 commits into from
Aug 27, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
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
7 changes: 7 additions & 0 deletions modules/ui_arch.lua
Original file line number Diff line number Diff line change
Expand Up @@ -73,6 +73,13 @@ function UI_ARCH.setup(self)
end
end
end
if type(float_size) == "string" then -- Use upper bound for Mix It Up, Progressive, and Episodic level sizes
SEED_W = PARAM.float_level_upper_bound
SEED_H = PARAM.float_level_upper_bound
else
SEED_W = PARAM.float_size
SEED_H = PARAM.float_size
end
end

OB_MODULES["ui_arch"] =
Expand Down
4 changes: 2 additions & 2 deletions scripts/grower.lua
Original file line number Diff line number Diff line change
Expand Up @@ -1014,8 +1014,8 @@ function Grower_decide_extents()
LEVEL.has_streets = false
end

assert(int(LEVEL.map_W) < SEED_W)
assert(int(LEVEL.map_H) < SEED_H)
assert(int(LEVEL.map_W) <= SEED_W)
assert(int(LEVEL.map_H) <= SEED_H)

local map_x1 = 1 + int((SEED_W - LEVEL.map_W) / 2)
local map_y1 = 1 + int((SEED_H - LEVEL.map_H) / 2)
Expand Down
4 changes: 2 additions & 2 deletions scripts/level.lua
Original file line number Diff line number Diff line change
Expand Up @@ -254,8 +254,8 @@ function Episode_determine_map_sizes()
H = W
end

assert(W + 4 <= SEED_W)
assert(H + 4 <= SEED_H)
assert(W <= SEED_W)
assert(H <= SEED_H)

LEV.map_W = W
LEV.map_H = H
Expand Down
2 changes: 1 addition & 1 deletion source_files/fltk_src/CMake/options.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -331,7 +331,7 @@ option (OPTION_USE_SYSTEM_ZLIB "use system zlib" ON)

if (OPTION_USE_SYSTEM_ZLIB AND NOT MSYS)
include (FindZLIB)
endif (OPTION_USE_SYSTEM_ZLIB)
endif (OPTION_USE_SYSTEM_ZLIB AND NOT MSYS)

if (ZLIB_FOUND)
set (FLTK_ZLIB_LIBRARIES ${ZLIB_LIBRARIES})
Expand Down
4 changes: 1 addition & 3 deletions source_files/obsidian_src/m_dialog.cc
Original file line number Diff line number Diff line change
Expand Up @@ -282,9 +282,7 @@ std::filesystem::path DLG_OutputFilename(const char *ext, const char *preset) {
src_name.replace_extension(ext);

// check if exists, ask for confirmation
std::ifstream fp{src_name};
if (fp) {
fp.close();
if (std::filesystem::exists(src_name)) {
if (!fl_choice("%s", fl_cancel, fl_ok, NULL,
Fl_Native_File_Chooser::file_exists_message)) {
return ""; // cancelled
Expand Down
4 changes: 2 additions & 2 deletions source_files/obsidian_src/main.cc
Original file line number Diff line number Diff line change
Expand Up @@ -266,8 +266,8 @@ void Determine_InstallDir(const char *argv0) {
install_dir.clear();
}

if (Verify_InstallDir(GetExecutablePath())) {
install_dir = GetExecutablePath();
if (Verify_InstallDir(std::filesystem::current_path().c_str())) {
install_dir = std::filesystem::current_path();
}
#endif

Expand Down
27 changes: 20 additions & 7 deletions source_files/obsidian_src/ui_widgets.cc
Original file line number Diff line number Diff line change
Expand Up @@ -608,6 +608,26 @@ UI_ModuleDropDown::UI_ModuleDropDown(int x, int y, int w, int h)

UI_ModuleDropDown::~UI_ModuleDropDown() {}

int UI_ModuleDropDown::handle(int event) {
switch (event) {
case FL_RELEASE:
if (box()) {
if (value()) {
copy_label(" ");
redraw();
copy_label("@-2line");
} else {
copy_label(" ");
redraw();
copy_label("@-2+");
}
redraw();
}
default:
return Fl_Button::handle(event);
}
}

// Custom draw function to use the checkmark style regardless of box type and
// respect custom colors
void UI_ModuleDropDown::draw() {
Expand All @@ -619,13 +639,6 @@ void UI_ModuleDropDown::draw() {

draw_box(FL_FLAT_BOX, x() + dx, y() + dy, W, W, WINDOW_BG);
lx = dx + W + 2;
copy_label(" ");
redraw();
if (value()) {
copy_label("@-2line");
} else {
copy_label("@-2+");
}
draw_label(x() + lx, y(), w() - lx - bx, h());
}

Expand Down
2 changes: 2 additions & 0 deletions source_files/obsidian_src/ui_widgets.h
Original file line number Diff line number Diff line change
Expand Up @@ -282,6 +282,8 @@ class UI_ModuleDropDown : public Fl_Check_Button {

private:
void draw();

int handle(int event);
};

#endif /* __UI_WIDGETS_H__ */
Expand Down