Skip to content

Commit 07984d6

Browse files
committed
mac fixes
1 parent 1054572 commit 07984d6

File tree

4 files changed

+12
-8
lines changed

4 files changed

+12
-8
lines changed

src/Callback.hpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ class CallerBackerInator {
1919
if (data.isArray()) {
2020
auto arr = data.asArray().unwrap();
2121
int idx = static_cast<ObjWrapper<int>*>(node->getUserObject("customAlertCallbackIndex"_spr))->getValue();
22-
idx = clamp(idx, 0, arr.size() - 1);
22+
idx = std::clamp(idx, 0, (int)(arr.size() - 1));
2323
data = arr[idx];
2424

2525
int newIndex = getInt(data, "goto", idx + 1);

src/CustomAlert.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -294,7 +294,7 @@ void customizeButton(CCMenuItemSpriteExtra* buttonBase, CCObject* parent, matjso
294294
}
295295

296296
auto size = button->getContentSize();
297-
float w = getNum(data, "width", clamp(label->getContentWidth() + 14.0f, size.width, 150.0f));
297+
float w = getNum(data, "width", std::clamp(label->getContentWidth() + 14.0f, size.width, 150.0f));
298298
float h = getNum(data, "height", size.height);
299299

300300
CCScale9Sprite* slice = button->getChildByType<CCScale9Sprite>(0);

src/CustomTextbox.cpp

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -10,12 +10,12 @@
1010

1111
struct CustomDialogData {
1212
std::string customTexture = "";
13-
double iconScale = 1.0f;
13+
float iconScale = 1.0f;
1414
matjson::Value customSound = nullptr;
1515
matjson::Value blipSound = nullptr;
1616
matjson::Value changeBG = nullptr;
1717
bool autoSkip = false;
18-
byte pauseMusic = 0; // 0 = ignore, 1 = unpause, 2 = pause
18+
Toggler pauseMusic = Toggler::Default;
1919
};
2020
std::map<int, CustomDialogData> storedCustomData;
2121

@@ -66,7 +66,7 @@ class $modify(CustomDialogLayer, DialogLayer) {
6666
if (data.customSound != nullptr) playCustomSound(data.customSound);
6767

6868
// Pause music
69-
if (data.pauseMusic > 0) FMODAudioEngine::sharedEngine()->m_backgroundMusicChannel->setPaused(data.pauseMusic == 2);
69+
if (data.pauseMusic != Toggler::Default) FMODAudioEngine::sharedEngine()->m_backgroundMusicChannel->setPaused(data.pauseMusic == Toggler::On);
7070

7171
// Auto skip
7272
if (data.autoSkip) m_fields->autoSkip = true;
@@ -187,9 +187,9 @@ void CustomTextbox::showTextbox(std::string id) {
187187
if (m.contains("setBackground")) data.changeBG = m["setBackground"];
188188
if (m.contains("autoSkip")) data.autoSkip = getBool(m, "autoSkip");
189189
if (m.contains("pauseMusic")) {
190-
byte pauseByte = getBool(m, "pauseMusic") ? 2 : 1;
191-
data.pauseMusic = pauseByte;
192-
if (pauseByte == 2) pausesMusic = true;
190+
Toggler pauseVal = getBool(m, "pauseMusic") ? Toggler::On : Toggler::Off;
191+
data.pauseMusic = pauseVal;
192+
if (pauseVal == Toggler::On) pausesMusic = true;
193193
}
194194
customData[dialogLines->count()] = data;
195195

src/utils.hpp

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,10 @@ struct SoundData {
1919
float speed = 1.0f;
2020
};
2121

22+
enum Toggler {
23+
Default, Off, On
24+
};
25+
2226
inline std::map<std::string, int> TEXTBOX_COLORS = {
2327
{ "brown", 1 },
2428
{ "blue", 2 },

0 commit comments

Comments
 (0)