Skip to content

Commit

Permalink
Check for .zip extensions instead of .oaf; disable 7z support; do not…
Browse files Browse the repository at this point in the history
… collapse disabled modules
  • Loading branch information
dashodanger committed Oct 25, 2024
1 parent 95f7d2d commit 8e573a9
Show file tree
Hide file tree
Showing 5 changed files with 36 additions and 29 deletions.
2 changes: 1 addition & 1 deletion libraries/physfs/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -109,7 +109,7 @@ if(NOT PHYSFS_ARCHIVE_ZIP)
add_definitions(-DPHYSFS_SUPPORTS_ZIP=0)
endif()

option(PHYSFS_ARCHIVE_7Z "Enable 7zip support" TRUE)
option(PHYSFS_ARCHIVE_7Z "Enable 7zip support" OFF)
if(NOT PHYSFS_ARCHIVE_7Z)
add_definitions(-DPHYSFS_SUPPORTS_7Z=0)
endif()
Expand Down
2 changes: 1 addition & 1 deletion source/m_addons.cc
Original file line number Diff line number Diff line change
Expand Up @@ -225,7 +225,7 @@ void VFS_ScanForAddons()
continue;
}

if (statter.filetype == PHYSFS_FILETYPE_DIRECTORY || (statter.filetype == PHYSFS_FILETYPE_REGULAR && GetExtension(*p) == ".oaf"))
if (statter.filetype == PHYSFS_FILETYPE_DIRECTORY || (statter.filetype == PHYSFS_FILETYPE_REGULAR && GetExtension(*p) == ".zip"))
{
addon_info_t info;

Expand Down
2 changes: 1 addition & 1 deletion source/main.cc
Original file line number Diff line number Diff line change
Expand Up @@ -1715,7 +1715,7 @@ softrestart:;
FL_MENU_TOGGLE | (randomize_misc ? FL_MENU_VALUE : 0));
if (all_addons.size() == 0)
{
main_win->menu_bar->add(_("Addons/No folders or *.oaf files"), nullptr, nullptr, nullptr,
main_win->menu_bar->add(_("Addons/No folders or *.zip files"), nullptr, nullptr, nullptr,
FL_MENU_INACTIVE);
main_win->menu_bar->add(_("Addons/found in the \\/addons directory!"), nullptr, nullptr, nullptr,
FL_MENU_INACTIVE);
Expand Down
57 changes: 31 additions & 26 deletions source/ui_module.cc
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,7 @@ UI_Module::UI_Module(int X, int Y, int W, int H, const std::string &id, const st
box(box_style);

id_name = id;
og_label = label;

if ((red >= 0) && (green >= 0) && (blue >= 0))
{
Expand Down Expand Up @@ -115,7 +116,7 @@ void UI_Module::AddHeader(const std::string &opt, const std::string &label, int

if (!mod_button->value())
{
rhead->hide();
rhead->deactivate();
}

add(rhead);
Expand Down Expand Up @@ -145,7 +146,7 @@ void UI_Module::AddUrl(const std::string &opt, const std::string &label, const s

if (!mod_button->value())
{
rurl->hide();
rurl->deactivate();
}

add(rurl);
Expand Down Expand Up @@ -211,7 +212,7 @@ void UI_Module::AddOption(const std::string &opt, const std::string &label, cons

if (!mod_button->value())
{
rch->hide();
rch->deactivate();
}

add(rch);
Expand All @@ -230,7 +231,6 @@ void UI_Module::AddSliderOption(const std::string &opt, std::string &label, cons
const std::string &randomize_group, const std::string &default_value)
{
int nw = this->parent()->w();
// int nh = KromulentHeight(30);

int nx = x() + KromulentWidth(6);
int ny = y() + cur_opt_y - KromulentHeight(15);
Expand Down Expand Up @@ -401,7 +401,7 @@ void UI_Module::AddSliderOption(const std::string &opt, std::string &label, cons

if (!mod_button->value())
{
rsl->hide();
rsl->deactivate();
}

add(rsl);
Expand Down Expand Up @@ -466,7 +466,7 @@ void UI_Module::AddButtonOption(const std::string &opt, const std::string &label

if (!mod_button->value())
{
rbt->hide();
rbt->deactivate();
}

add(rbt);
Expand All @@ -481,18 +481,18 @@ void UI_Module::AddButtonOption(const std::string &opt, const std::string &label

int UI_Module::CalcHeight() const
{
if (mod_button->value())
{
return cur_opt_y + KromulentHeight(6);
}
else
{
return KromulentHeight(34);
}
return cur_opt_y + KromulentHeight(6);
}

void UI_Module::update_Enable()
{
if (!Is_UI())
{
if (mod_button->value())
heading->copy_label(og_label.c_str());
else
heading->copy_label(StringFormat("%s (DISABLED)", og_label.c_str()).c_str());
}

std::map<std::string, UI_RChoice *>::const_iterator IT;
std::map<std::string, UI_RSlide *>::const_iterator IT2;
Expand All @@ -506,11 +506,11 @@ void UI_Module::update_Enable()

if (mod_button->value())
{
M->show();
M->activate();
}
else
{
M->hide();
M->deactivate();
}
}

Expand All @@ -520,11 +520,11 @@ void UI_Module::update_Enable()

if (mod_button->value())
{
M->show();
M->activate();
}
else
{
M->hide();
M->deactivate();
}
}

Expand All @@ -533,11 +533,11 @@ void UI_Module::update_Enable()
UI_RButton *M = IT3->second;
if (mod_button->value())
{
M->show();
M->activate();
}
else
{
M->hide();
M->deactivate();
}
}

Expand All @@ -546,11 +546,11 @@ void UI_Module::update_Enable()
UI_RHeader *M = IT4->second;
if (mod_button->value())
{
M->show();
M->activate();
}
else
{
M->hide();
M->deactivate();
}
}

Expand All @@ -559,11 +559,11 @@ void UI_Module::update_Enable()
UI_RLink *M = IT5->second;
if (mod_button->value())
{
M->show();
M->activate();
}
else
{
M->hide();
M->deactivate();
}
}
}
Expand Down Expand Up @@ -1266,11 +1266,16 @@ bool UI_CustomMods::ShowModule(const std::string &id, bool new_shown)
return true;
}

// visibility definitely changed

if (new_shown)
{
M->show();
if (!M->Is_UI())
{
if (M->mod_button->value())
M->heading->copy_label(M->og_label.c_str());
else
M->heading->copy_label(StringFormat("%s (DISABLED)", M->og_label.c_str()).c_str());
}
}
else
{
Expand Down
2 changes: 2 additions & 0 deletions source/ui_module.h
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,8 @@ class UI_Module : public Fl_Group

std::string id_name;

std::string og_label; // For toggling the (Disabled) text

// only used while positioning the options (as they are added)
int cur_opt_y;

Expand Down

0 comments on commit 8e573a9

Please sign in to comment.