Skip to content

Commit c398568

Browse files
committed
Change std::min and std::max references
1 parent d19f865 commit c398568

File tree

2 files changed

+37
-36
lines changed

2 files changed

+37
-36
lines changed

bindings/2.2074/GeometryDash.bro

Lines changed: 36 additions & 36 deletions
Original file line numberDiff line numberDiff line change
@@ -94,7 +94,7 @@ class AccountLayer : GJDropDownLayer, GJAccountDelegate, GJAccountBackupDelegate
9494
label->setPosition(position + cocos2d::CCPoint { onSprite->getContentSize().width * .5f + 6.4f, 0.f });
9595
auto width = label->getContentSize().width;
9696
if (width > 120.f) label->setScale(120.f / width);
97-
label->setScale((std::min)(label->getScale(), .35f));
97+
label->setScale(std::min(label->getScale(), .35f));
9898
}
9999
void doBackup() = ios 0x169c3c, win inline, m1 0xb6708, imac 0xcd8a0 {
100100
this->updatePage(false);
@@ -504,7 +504,7 @@ class AchievementsLayer : GJDropDownLayer {
504504
m_prevPageButton->setVisible(pageStartIdx != 0);
505505
auto nextIndex = pageStartIdx + pageEndIdx;
506506
m_nextPageButton->setVisible(itemCount > nextIndex);
507-
nextIndex = (std::min)(nextIndex, itemCount);
507+
nextIndex = std::min(nextIndex, itemCount);
508508
m_pageLabel->setString(cocos2d::CCString::createWithFormat("%i to %i of %i", pageStartIdx + 1, nextIndex, itemCount)->getCString());
509509
}
510510

@@ -1165,7 +1165,7 @@ class AudioEffectsLayer : cocos2d::CCLayerColor {
11651165
else if (pulse == .9f) scale = .6f;
11661166
else if (pulse == .8f) scale = .4f;
11671167
else scale = pulse * .2f;
1168-
auto pulseMod = (std::min)(scale + m_audioScale, 1.1f);
1168+
auto pulseMod = std::min(scale + m_audioScale, 1.1f);
11691169
if (!m_goingDown && m_audioPulseMod > pulseMod) return;
11701170
m_audioPulseMod = pulseMod;
11711171
m_goingDown = false;
@@ -2469,8 +2469,8 @@ class CCMenuItemToggler : cocos2d::CCMenuItem {
24692469
auto sprOff = cocos2d::CCSprite::createWithSpriteFrameName("GJ_checkOff_001.png");
24702470
auto sprOn = cocos2d::CCSprite::createWithSpriteFrameName("GJ_checkOn_001.png");
24712471

2472-
float maxWidth = (std::max)(sprOff->getContentSize().width, sprOn->getContentSize().width);
2473-
float maxHeight = (std::max)(sprOff->getContentSize().height, sprOn->getContentSize().height);
2472+
float maxWidth = std::max(sprOff->getContentSize().width, sprOn->getContentSize().width);
2473+
float maxHeight = std::max(sprOff->getContentSize().height, sprOn->getContentSize().height);
24742474

24752475
sprOff->setScale(scale);
24762476
sprOn->setScale(scale);
@@ -5982,7 +5982,7 @@ class DrawGridLayer : cocos2d::CCLayer {
59825982
if (objectType == GameObjectType::BallPortal) height = 240.f;
59835983
else if (objectType == GameObjectType::SpiderPortal) height = 270.f;
59845984
else height = 300.f;
5985-
auto minimum = (std::max)((int)((object->getPosition().y - height * .5f) / 30.f) * 30.f, 90.f);
5985+
auto minimum = std::max((int)((object->getPosition().y - height * .5f) / 30.f) * 30.f, 90.f);
59865986
return { minimum, minimum + height };
59875987
}
59885988
bool init(cocos2d::CCNode* parent, LevelEditorLayer* layer) = win inline, m1 0xd9aa0, imac 0xf59b0, ios 0x3655bc {
@@ -6825,7 +6825,7 @@ class EditorUI : cocos2d::CCLayer, FLAlertLayerProtocol, ColorSelectDelegate, GJ
68256825
cocos2d::CCArray* getSelectedObjects() = win 0x10f780, m1 0x37eac, imac 0x3d330, ios 0x3e6210;
68266826
CCMenuItemSpriteExtra* getSimpleButton(gd::string frameName, cocos2d::SEL_MenuHandler selector, cocos2d::CCMenu* menu) = win inline, m1 0x2ea98, imac 0x2f0a0, ios inline {
68276827
auto sprite = cocos2d::CCSprite::createWithSpriteFrameName(frameName.c_str());
6828-
sprite->setScale((std::min)(18.f / sprite->getContentSize().width, 18.f / sprite->getContentSize().height));
6828+
sprite->setScale(std::min(18.f / sprite->getContentSize().width, 18.f / sprite->getContentSize().height));
68296829
auto button = CCMenuItemSpriteExtra::create(sprite, this, selector);
68306830
if (menu) menu->addChild(button);
68316831
return button;
@@ -7203,13 +7203,13 @@ class EditorUI : cocos2d::CCLayer, FLAlertLayerProtocol, ColorSelectDelegate, GJ
72037203
void updateZoom(float zoom) = ios 0x3e6980, win 0x110ef0, m1 0x38b14, imac 0x3e050;
72047204
float valueFromXPos(float xPos) = win inline, m1 0x2ef70, imac 0x2f590, ios 0x3df884 {
72057205
auto xMin = this->getXMin(0);
7206-
auto sectionCount = (std::max)(m_editorLayer->getSectionCount(), 100);
7206+
auto sectionCount = std::max(m_editorLayer->getSectionCount(), 100);
72077207
auto scale = m_editorLayer->m_objectLayer->getScale();
72087208
return std::clamp(-(xPos - xMin) / (sectionCount * 100.f * scale), 0.f, 1.f);
72097209
}
72107210
float xPosFromValue(float value) = win inline, m1 0x2edec, imac 0x2f3d0, ios 0x3df710 {
72117211
auto xMin = this->getXMin(0);
7212-
auto sectionCount = (std::max)(m_editorLayer->getSectionCount(), 100);
7212+
auto sectionCount = std::max(m_editorLayer->getSectionCount(), 100);
72137213
auto scale = m_editorLayer->m_objectLayer->getScale();
72147214
return sectionCount * 100.f * scale * value - xMin;
72157215
}
@@ -11600,7 +11600,7 @@ class GameObject : CCSpritePlus {
1160011600
}
1160111601
int getObjectDirection() = win 0x1995a0, m1 0x4e07b0, imac 0x5a6360, ios 0x25c360;
1160211602
float getObjectRadius() = win inline, m1 0x4eba3c, imac 0x5b3170, ios 0x2619d0 {
11603-
return m_scaleX == 1.f && m_scaleY == 1.f ? m_objectRadius : m_objectRadius * (std::max)(m_scaleX, m_scaleY);
11603+
return m_scaleX == 1.f && m_scaleY == 1.f ? m_objectRadius : m_objectRadius * std::max(m_scaleX, m_scaleY);
1160411604
}
1160511605
cocos2d::CCRect* getObjectRectPointer() = win inline, m1 0x4ddb20, imac 0x5a36a0, ios 0x259d30 {
1160611606
if (m_isObjectRectDirty) this->getObjectRect();
@@ -13128,7 +13128,7 @@ class GameToolbox {
1312813128
static void stringSetupToMap(gd::string const& str, char const* separator, gd::map<gd::string, gd::string>& setup) = win 0x65890, m1 0x440a60, imac 0x4ddb60, ios 0x48d50;
1312913129
static cocos2d::ccColor3B strongColor(cocos2d::ccColor3B color) = win inline, m1 0x4412f4, imac 0x4de4c0, ios 0x492a0 {
1313013130
if (color.r != 255 && color.b != 255 && color.g != 255) {
13131-
auto factor = (std::min)(1.5f, 255.f / (std::max)({ color.r, color.g, color.b }));
13131+
auto factor = std::min(1.5f, 255.f / std::max({ color.r, color.g, color.b }));
1313213132
color.r *= factor;
1313313133
color.g *= factor;
1313413134
color.b *= factor;
@@ -13881,7 +13881,7 @@ class GJBaseGameLayer : cocos2d::CCLayer, TriggerEffectDelegate {
1388113881
}
1388213882
int atlasValue(int atlas) = win inline, m1 0xed20c, imac 0x10d7d0, ios inline {
1388313883
if (atlas < 30) return 0;
13884-
return (int)(std::min)(atlas * 1.1f, 9999.f);
13884+
return (int)std::min(atlas * 1.1f, 9999.f);
1388513885
}
1388613886
void bumpPlayer(PlayerObject* player, EffectGameObject* object) = ios 0x1eab1c, win 0x2124f0, imac 0x117ce0, m1 0xf6b04;
1388713887
int buttonIDToButton(int id) = win inline, m1 0x11cc4c, imac 0x146b60, ios inline {
@@ -13989,7 +13989,7 @@ class GJBaseGameLayer : cocos2d::CCLayer, TriggerEffectDelegate {
1398913989
this->triggerGradientCommand(object);
1399013990
}
1399113991
else {
13992-
if (auto gradientLayer = static_cast<GJGradientLayer*>(m_gradientLayers->objectForKey((std::min)(object->m_gradientID, 999)))) {
13992+
if (auto gradientLayer = static_cast<GJGradientLayer*>(m_gradientLayers->objectForKey(std::min(object->m_gradientID, 999)))) {
1399313993
gradientLayer->removeFromParentAndCleanup(false);
1399413994
gradientLayer->m_triggerObject = nullptr;
1399513995
}
@@ -14189,7 +14189,7 @@ class GJBaseGameLayer : cocos2d::CCLayer, TriggerEffectDelegate {
1418914189
if (height1 == 240.f) height1 = 270.f;
1419014190
auto otherPlayer = this->getOtherPlayer(player);
1419114191
auto height2 = this->getGroundHeightForMode(otherPlayer->isFlying() ? 5 : otherPlayer->m_isBall ? 16 : 6);
14192-
return (std::max)(height1, height2);
14192+
return std::max(height1, height2);
1419314193
}
1419414194
return this->getGroundHeightForMode(type);
1419514195
}
@@ -16299,7 +16299,7 @@ class GJEffectManager : cocos2d::CCNode {
1629916299
void calculateInheritedColor(int id, ColorAction* action) = win 0x2544b0, m1 0x26e0c8, imac 0x2cb180, ios 0x1332c;
1630016300
void calculateLightBGColor(cocos2d::ccColor3B color) = win 0x25c090, m1 0x2792bc, imac 0x2d8f40, ios 0x1a4e8;
1630116301
bool checkCollision(int const& blockAID, int const& blockBID) = win inline, m1 0x26eef4, imac 0x2cc1c0, ios 0x13c3c {
16302-
auto key = (std::min)(blockAID, blockBID) * 10000 + (std::max)(blockAID, blockBID) + 10000000;
16302+
auto key = std::min(blockAID, blockBID) * 10000 + std::max(blockAID, blockBID) + 10000000;
1630316303
return m_unkMap288.count(key) != 0;
1630416304
}
1630516305
void colorActionChanged(ColorAction* action) = win inline, m1 0x26e59c, imac 0x2cb670, ios 0x13794 {
@@ -16444,7 +16444,7 @@ class GJEffectManager : cocos2d::CCNode {
1644416444
}
1644516445
void loadFromState(EffectManagerState& state) = win 0x25cb40, m1 0x27a3c0, imac 0x2da290, ios 0x1af0c;
1644616446
void objectsCollided(int blockAID, int blockBID) = win inline, m1 0x26f310, imac 0x2cc680, ios 0x13eb0 {
16447-
auto key = (std::min)(blockAID, blockBID) * 10000 + (std::max)(blockAID, blockBID) + 10000000;
16447+
auto key = std::min(blockAID, blockBID) * 10000 + std::max(blockAID, blockBID) + 10000000;
1644816448
if (auto it = m_unkMap288.find(key); it != m_unkMap288.end()) {
1644916449
it->second = true;
1645016450
}
@@ -17840,7 +17840,7 @@ class GJLevelList : cocos2d::CCNode {
1784017840
cocos2d::CCArray* getListLevelsArray(cocos2d::CCArray* levels) = win 0x174160, m1 0x4a3af8, imac 0x54b780, ios 0xb45c4;
1784117841
gd::string getUnpackedDescription() = win 0x173b80, imac 0x54b670, m1 0x4a39d0, ios 0xb44a8;
1784217842
void handleStatsConflict(GJLevelList* list) = win inline, imac 0x54b4a0, m1 0x4a37fc, ios 0xb4378 {
17843-
m_listOrder = (std::max)(m_listOrder, list->m_listOrder);
17843+
m_listOrder = std::max(m_listOrder, list->m_listOrder);
1784417844
}
1784517845
bool hasMatchingLevels(GJLevelList* list) = ios 0xb4390, win 0x173970, imac 0x54b4c0, m1 0x4a3814;
1784617846
int orderForLevel(int id) = win inline, m1 0x4a44a8, imac 0x54c3c0, ios 0xb4c10 {
@@ -19238,7 +19238,7 @@ class GJSearchObject : cocos2d::CCNode {
1923819238
}
1923919239
GJSearchObject* getPageObject(int page) = win 0x171d90, imac 0x54aca0, m1 0x4a312c, ios 0xb3eb4;
1924019240
GJSearchObject* getPrevPageObject() = win inline, m1 0x4a331c, imac 0x54af60, ios 0xb4064 {
19241-
return this->getPageObject((std::max)(m_page - 1, 0));
19241+
return this->getPageObject(std::max(m_page - 1, 0));
1924219242
}
1924319243
static char const* getSearchKey(SearchType searchType, gd::string searchQuery, gd::string difficulty, gd::string length, int page, bool star, bool uncompleted, bool featured, int songID, bool original, bool twoPlayer, bool customSong, bool songFilter, bool noStar, bool coins, bool epic, bool legendary, bool mythic, bool onlyCompleted, int demonFilter, int folder, int searchMode) = win 0x171f00, m1 0x4a2da8, imac 0x54a780, ios 0xb3c14;
1924419244
bool init(SearchType searchType, gd::string searchQuery, gd::string difficulty, gd::string length, int page, bool star, bool uncompleted, bool featured, int songID, bool original, bool twoPlayer, bool customSong, bool songFilter, bool noStar, bool coins, bool epic, bool legendary, bool mythic, bool onlyCompleted, int demonFilter, int folder, int searchMode) = win inline, m1 0x4a2c64, imac 0x54a650, ios 0xb3ad0 {
@@ -20098,7 +20098,7 @@ class GJSongBrowser : GJDropDownLayer, FLAlertLayerProtocol, TableViewCellDelega
2009820098
m_leftArrow->setVisible(pageStartIdx != 0);
2009920099
auto nextIndex = pageStartIdx + pageEndIdx;
2010020100
m_rightArrow->setVisible(itemCount > nextIndex);
20101-
nextIndex = (std::min)(nextIndex, itemCount);
20101+
nextIndex = std::min(nextIndex, itemCount);
2010220102
m_countText->setString(cocos2d::CCString::createWithFormat("%i to %i of %i", pageStartIdx + 1, nextIndex, itemCount)->getCString());
2010320103
}
2010420104
void setupSongBrowser(cocos2d::CCArray* songs) = win inline, m1 0x51986c, imac 0x5e7c60, ios 0x2650c4 {
@@ -20424,12 +20424,12 @@ class GJUINode : cocos2d::CCNode {
2042420424
}
2042520425
auto centerX = m_rect.size.width * .5f;
2042620426
auto reverseCenterX = -m_rect.size.width * .5f;
20427-
if ((std::min)(rangePos.x, centerX) > reverseCenterX) rangePos.x = reverseCenterX;
20428-
else rangePos.x = (std::min)(rangePos.x, centerX);
20427+
if (std::min(rangePos.x, centerX) > reverseCenterX) rangePos.x = reverseCenterX;
20428+
else rangePos.x = std::min(rangePos.x, centerX);
2042920429
auto centerY = 40.f + m_rect.size.height * .5f;
2043020430
auto reverseCenterY = 40.f - m_rect.size.height * .5f;
20431-
if ((std::min)(rangePos.y, centerY) > reverseCenterY) rangePos.y = reverseCenterY;
20432-
else rangePos.y = (std::min)(rangePos.y, centerY);
20431+
if (std::min(rangePos.y, centerY) > reverseCenterY) rangePos.y = reverseCenterY;
20432+
else rangePos.y = std::min(rangePos.y, centerY);
2043320433
m_firstSprite->setVisible(true);
2043420434
m_firstSprite->setPosition(rangePos);
2043520435
return touchResult;
@@ -20700,12 +20700,12 @@ class GJUserScore : cocos2d::CCNode {
2070020700

2070120701
bool isCurrentUser() = win 0x16fb90, m1 0x4a21b8, imac 0x549af0, ios 0xb3320;
2070220702
void mergeWithScore(GJUserScore* score) = win inline, m1 0x4a218c, imac 0x549ab0, ios inline {
20703-
m_stars = (std::max)(m_stars, score->m_stars);
20704-
m_moons = (std::max)(m_moons, score->m_moons);
20705-
m_diamonds = (std::max)(m_diamonds, score->m_diamonds);
20706-
m_demons = (std::max)(m_demons, score->m_demons);
20707-
m_creatorPoints = (std::max)(m_creatorPoints, score->m_creatorPoints);
20708-
m_secretCoins = (std::max)(m_secretCoins, score->m_secretCoins);
20703+
m_stars = std::max(m_stars, score->m_stars);
20704+
m_moons = std::max(m_moons, score->m_moons);
20705+
m_diamonds = std::max(m_diamonds, score->m_diamonds);
20706+
m_demons = std::max(m_demons, score->m_demons);
20707+
m_creatorPoints = std::max(m_creatorPoints, score->m_creatorPoints);
20708+
m_secretCoins = std::max(m_secretCoins, score->m_secretCoins);
2070920709
}
2071020710

2071120711
gd::string m_userName;
@@ -26247,7 +26247,7 @@ class OptionsLayer : GJDropDownLayer, FLAlertLayerProtocol {
2624726247
label->setPosition(position + cocos2d::CCPoint { onSprite->getContentSize().width * .5f + 6.4f, 0.f });
2624826248
auto width = label->getContentSize().width;
2624926249
if (width > 120.f) label->setScale(120.f / width);
26250-
label->setScale((std::min)(label->getScale(), .35f));
26250+
label->setScale(std::min(label->getScale(), .35f));
2625126251
return toggler;
2625226252
}
2625326253
void exitLayer() = win inline, m1 0x6993e8, imac 0x785230, ios inline {
@@ -30283,11 +30283,11 @@ class SequenceTriggerGameObject : ChanceTriggerGameObject {
3028330283
void addCount(int index, int count) = win inline, m1 0x174ed0, imac 0x1b51b0, ios 0x383ad8 {
3028430284
if (index < 0 || index >= m_chanceObjects.size()) return;
3028530285
auto& object = m_chanceObjects[index];
30286-
object.m_chance = (std::max)(object.m_chance + count, 1);
30286+
object.m_chance = std::max(object.m_chance + count, 1);
3028730287
m_sequenceTotalCount = -1;
3028830288
}
3028930289
void addTarget(int groupID, int count) = win inline, m1 0x174ca4, imac 0x1b4f40, ios 0x3838e0 {
30290-
count = (std::max)(count, 1);
30290+
count = std::max(count, 1);
3029130291
m_chanceObjects.emplace_back(groupID, count);
3029230292
m_sequenceTotalCount = -1;
3029330293
}
@@ -33689,7 +33689,7 @@ class ShaderLayer : cocos2d::CCLayer {
3368933689
if (m_state.m_colorChangeCR != 1.f || m_state.m_colorChangeCG != 1.f || m_state.m_colorChangeCB != 1.f ||
3369033690
m_state.m_colorChangeBR != 0.f || m_state.m_colorChangeBG != 0.f || m_state.m_colorChangeBB != 0.f) {
3369133691
m_state.m_usesShaders = true;
33692-
shaderProgram->setUniformLocationWith3f(m_colorChangeCUniform, (std::max)(m_state.m_colorChangeCR, .001f), m_state.m_colorChangeCG, m_state.m_colorChangeCB);
33692+
shaderProgram->setUniformLocationWith3f(m_colorChangeCUniform, std::max(m_state.m_colorChangeCR, .001f), m_state.m_colorChangeCG, m_state.m_colorChangeCB);
3369333693
shaderProgram->setUniformLocationWith3f(m_colorChangeBUniform, m_state.m_colorChangeBR, m_state.m_colorChangeBG, m_state.m_colorChangeBB);
3369433694
}
3369533695
else {
@@ -33741,9 +33741,9 @@ class ShaderLayer : cocos2d::CCLayer {
3374133741
auto g = edit * m_state.m_invertColorG;
3374233742
auto b = edit * m_state.m_invertColorB;
3374333743
if (m_state.m_invertColorClampRGB) {
33744-
r = (std::min)(r, 1.f);
33745-
g = (std::min)(g, 1.f);
33746-
b = (std::min)(b, 1.f);
33744+
r = std::min(r, 1.f);
33745+
g = std::min(g, 1.f);
33746+
b = std::min(b, 1.f);
3374733747
}
3374833748
shaderProgram->setUniformLocationWith4f(m_invertColorValueUniform, r, g, b, edit);
3374933749
}

test/members/CMakeLists.txt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -39,6 +39,7 @@ if (GEODE_TARGET_PLATFORM STREQUAL "Win64")
3939
)
4040

4141
target_sources(${PROJECT_NAME} PRIVATE Windows.cpp)
42+
target_compile_definitions(${PROJECT_NAME} PUBLIC -DNOMINMAX)
4243
elseif (GEODE_TARGET_PLATFORM STREQUAL "Android64")
4344
set(GEODE_MEMBER_TEST_PLATFORM "android64")
4445
set(GEODE_MEMBER_TEST_BINARY "Geode.android64.so")

0 commit comments

Comments
 (0)