Skip to content

Commit 9649cce

Browse files
authored
Merge pull request #8 from CubicCommunity/beta
Beta
2 parents fd4c162 + d6c342c commit 9649cce

File tree

7 files changed

+199
-198
lines changed

7 files changed

+199
-198
lines changed

CMakeLists.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ else()
99
set(CMAKE_OSX_ARCHITECTURES "arm64;x86_64")
1010
endif()
1111

12-
project(AvalancheIndex VERSION 1.2.0)
12+
project(AvalancheIndex VERSION 1.2.1)
1313

1414
file(GLOB_RECURSE SOURCES
1515
src/*.cpp

changelog.md

Lines changed: 16 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,19 @@
1+
### v1.2.1
2+
##### Patches
3+
4+
#### Changes
5+
- **Fixed** previews not showing with [Mod Previews](mod:alphalaneous.mod_previews) mod
6+
- Huge code cleanup
7+
- Minor optimizations
8+
- Several tweaks
9+
10+
#### Developers
11+
- **Added** Geode and Geometry Dash version information to featured project pop-up
12+
13+
###### Latest
14+
---
15+
###### Older
16+
117
## v1.2.0
218
#### Team Project pop-up
319

@@ -10,10 +26,6 @@
1026
#### Developers
1127
- **Updated** URLs to use Cubic Studios API endpoints for all web requests
1228

13-
###### Latest
14-
---
15-
###### Older
16-
1729
### v1.1.2
1830
##### Patches
1931

incl/src/Avalanche.cpp

Lines changed: 125 additions & 151 deletions
Large diffs are not rendered by default.

mod.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88
},
99
"id": "cubicstudios.avalancheindex",
1010
"name": "Avalanche Index",
11-
"version": "1.2.0",
11+
"version": "1.2.1",
1212
"developers": [
1313
"Cheeseworks"
1414
],
@@ -18,7 +18,7 @@
1818
"enhancement"
1919
],
2020
"links": {
21-
"source": "https://www.github.com/CubicCommunity/AvalancheIndex/",
21+
"source": "https://github.com/CubicCommunity/AvalancheIndex",
2222
"homepage": "https://avalanche.cubicstudios.xyz/",
2323
"community": "https://www.dsc.gg/cubic"
2424
},

src/headers/src/AvalancheFeatured.cpp

Lines changed: 23 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -197,7 +197,7 @@ bool AvalancheFeatured::setup() {
197197
infoSprite,
198198
this,
199199
menu_selector(AvalancheFeatured::openApplicationPopup));
200-
m_infoBtn->setPosition({ widthCS / 2.f, 5.f });
200+
m_infoBtn->setPosition({ widthCS / 2.f, 2.5f });
201201
m_infoBtn->setVisible(true);
202202
m_infoBtn->setZOrder(3);
203203

@@ -229,9 +229,12 @@ bool AvalancheFeatured::setup() {
229229
if (AVAL_GEODE_MOD->getSettingValue<bool>("dev-mode")) {
230230
AVAL_LOG_INFO("Dev buttons are enabled");
231231

232+
// geode loader
233+
auto loader = Loader::get();
234+
232235
// geode changelog popup button
233-
auto changelogBtnSprite = CCSprite::createWithSpriteFrameName("GJ_chatBtn_001.png");
234-
changelogBtnSprite->setScale(0.75f);
236+
auto changelogBtnSprite = CCSprite::createWithSpriteFrameName("GJ_menuBtn_001.png");
237+
changelogBtnSprite->setScale(0.625f);
235238

236239
auto changelogBtn = CCMenuItemSpriteExtra::create(
237240
changelogBtnSprite,
@@ -258,6 +261,23 @@ bool AvalancheFeatured::setup() {
258261
verLabel->setZOrder(3);
259262

260263
m_overlayMenu->addChild(verLabel);
264+
265+
// game and geode version text label
266+
std::ostringstream gdVerLabelText;
267+
gdVerLabelText << "Geode " << loader->getVersion().toVString(true) << " for v" << loader->getGameVersion();
268+
269+
auto gdVerLabelTextStr = gdVerLabelText.str();
270+
271+
auto gdVerLabel = CCLabelBMFont::create(gdVerLabelTextStr.c_str(), "bigFont.fnt");
272+
gdVerLabel->setID("gd-version-label");
273+
gdVerLabel->ignoreAnchorPointForPosition(false);
274+
gdVerLabel->setPosition({ m_overlayMenu->getScaledContentWidth() - 5.f, 12.5f });
275+
gdVerLabel->setAnchorPoint({ 1, 0 });
276+
gdVerLabel->setOpacity(100);
277+
gdVerLabel->setScale(0.25f);
278+
gdVerLabel->setZOrder(3);
279+
280+
m_overlayMenu->addChild(gdVerLabel);
261281
} else {
262282
AVAL_LOG_DEBUG("Dev buttons are disabled");
263283
};

src/headers/src/ProjectInfoPopup.cpp

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -699,8 +699,8 @@ ProjectInfoPopup* ProjectInfoPopup::setProject(GJGameLevel* level) {
699699

700700
linkedProjThumb->setPosition(linkedProjClippingNode->getPosition());
701701
linkedProjThumb->ignoreAnchorPointForPosition(false);
702-
linkedProjThumb->setColor({ 250, 250, 250 });
703-
linkedProjThumb->setOpacity(250);
702+
linkedProjThumb->setColor({ 175, 175, 175 });
703+
linkedProjThumb->setOpacity(175);
704704
} else {
705705
AVAL_LOG_ERROR("Failed to load linked project thumbnail: {}", res.unwrapErr());
706706
linkedProjThumb->removeMeAndCleanup();
@@ -749,7 +749,7 @@ ProjectInfoPopup* ProjectInfoPopup::setProject(GJGameLevel* level) {
749749
auto linkedProjLabel = CCLabelBMFont::create("Play Now!", "bigFont.fnt");
750750
linkedProjLabel->setID("label");
751751
linkedProjLabel->setAlignment(CCTextAlignment::kCCTextAlignmentCenter);
752-
linkedProjLabel->setPosition({ linkedProjMenu->getScaledContentWidth() / 2.f, linkedProjMenu->getScaledContentHeight() - 10.f });
752+
linkedProjLabel->setPosition({ linkedProjMenu->getScaledContentWidth() / 2.f, linkedProjMenu->getScaledContentHeight() - 12.5f });
753753
linkedProjLabel->setScale(0.25f);
754754

755755
linkedProjMenu->addChild(linkedProjLabel);

src/main.cpp

Lines changed: 29 additions & 34 deletions
Original file line numberDiff line numberDiff line change
@@ -207,17 +207,17 @@ class $modify(LevelInfo, LevelInfoLayer) {
207207
bool displayCollabLayers = AVAL_GEODE_MOD->getSettingValue<bool>("collab-layers");
208208

209209
// get main bg color layer
210-
auto bg = this->getChildByID("background");
210+
auto bg = getChildByID("background");
211211
auto background = as<CCSprite*>(bg);
212212

213213
// get level name node
214-
auto nameText = this->getChildByID("title-label");
214+
auto nameText = getChildByID("title-label");
215215
auto levelName = dynamic_cast<CCLabelBMFont*>(nameText);
216216

217217
// whether or not display for classics only
218218
bool onlyClassic = AVAL_GEODE_MOD->getSettingValue<bool>("classic-only") && level->isPlatformer();
219219

220-
CCMenu* leftMenu = typeinfo_cast<CCMenu*>(this->getChildByID("left-side-menu"));
220+
CCMenu* leftMenu = typeinfo_cast<CCMenu*>(getChildByID("left-side-menu"));
221221

222222
Project thisProj = getHandler->GetProject(level->m_levelID.value());
223223

@@ -228,17 +228,12 @@ class $modify(LevelInfo, LevelInfoLayer) {
228228
auto showProjectInfo = AVAL_GEODE_MOD->getSettingValue<bool>("show-proj-info");
229229

230230
if (showProjectInfo) {
231-
CCSprite* avalBtnSprite = CCSprite::createWithSpriteFrameName("GJ_plainBtn_001.png");
232-
avalBtnSprite->setScale(0.944f);
233-
234-
CCSprite* avalBtnSpriteIcon = CCSprite::createWithSpriteFrameName("button-logo.png"_spr);
235-
avalBtnSpriteIcon->setPositionX(avalBtnSprite->getContentWidth() / 2.025f);
236-
avalBtnSpriteIcon->setPositionY(avalBtnSprite->getContentHeight() / 2.f);
237-
avalBtnSpriteIcon->ignoreAnchorPointForPosition(false);
238-
avalBtnSpriteIcon->setAnchorPoint({ 0.5, 0.5 });
239-
avalBtnSpriteIcon->setScale(0.875f);
240-
241-
avalBtnSprite->addChild(avalBtnSpriteIcon);
231+
CCSprite* avalBtnSprite = CircleButtonSprite::createWithSpriteFrameName(
232+
"button-logo.png"_spr,
233+
1.25f,
234+
CircleBaseColor::Green,
235+
CircleBaseSize::Medium
236+
);
242237

243238
CCMenuItemSpriteExtra* avalBtn = CCMenuItemSpriteExtra::create(
244239
avalBtnSprite,
@@ -330,8 +325,8 @@ class $modify(LevelInfo, LevelInfoLayer) {
330325
bgSprite->setColor({ 66, 94, 255 });
331326
bgSprite->setAnchorPoint({ 0.5, 0.5 });
332327
bgSprite->ignoreAnchorPointForPosition(false);
333-
bgSprite->setContentSize({ this->getScaledContentWidth(), this->getScaledContentWidth() });
334-
bgSprite->setPosition({ this->getScaledContentWidth() / 2, this->getScaledContentHeight() / 2 });
328+
bgSprite->setContentSize({ getScaledContentWidth(), getScaledContentWidth() });
329+
bgSprite->setPosition({ getScaledContentWidth() / 2, getScaledContentHeight() / 2 });
335330
bgSprite->setZOrder(background->getZOrder());
336331
bgSprite->setID("team_background"_spr);
337332

@@ -343,7 +338,7 @@ class $modify(LevelInfo, LevelInfoLayer) {
343338
bgThumbnail->setZOrder(background->getZOrder() + 1);
344339
bgThumbnail->setID("team_thumbnail"_spr);
345340

346-
auto ogHeight = this->getContentHeight();
341+
auto ogHeight = getContentHeight();
347342
auto thumbHeight = bgThumbnail->getContentHeight();
348343

349344
// checks if the heights are valid before rescaling
@@ -354,12 +349,12 @@ class $modify(LevelInfo, LevelInfoLayer) {
354349
bgThumbnail->setScale(scaleFactor);
355350
};
356351

357-
this->addChild(bgThumbnail);
352+
addChild(bgThumbnail);
358353
} else {
359354
AVAL_LOG_ERROR("Failed to load sprite: project-bg.png");
360355
};
361356

362-
this->addChild(bgSprite);
357+
addChild(bgSprite);
363358
} else {
364359
AVAL_LOG_ERROR("Failed to load sprite: game_bg_19_001.png");
365360
};
@@ -402,11 +397,11 @@ class $modify(LevelInfo, LevelInfoLayer) {
402397
bgThumbnail->setOpacity(125);
403398
bgThumbnail->setAnchorPoint({ 0.5, 0 });
404399
bgThumbnail->ignoreAnchorPointForPosition(false);
405-
bgThumbnail->setPosition({ this->getContentWidth() / 2, 0 });
400+
bgThumbnail->setPosition({ getContentWidth() / 2, 0 });
406401
bgThumbnail->setZOrder(background->getZOrder() + 1);
407402
bgThumbnail->setID("team_thumbnail"_spr);
408403

409-
auto ogWidth = this->getContentWidth();
404+
auto ogWidth = getContentWidth();
410405
auto scaledWidth = bgThumbnail->getContentWidth();
411406

412407
if (ogWidth <= 0 || scaledWidth <= 0) {
@@ -418,7 +413,7 @@ class $modify(LevelInfo, LevelInfoLayer) {
418413
background->setZOrder(-5);
419414
};
420415

421-
this->addChild(bgThumbnail);
416+
addChild(bgThumbnail);
422417
} else {
423418
AVAL_LOG_ERROR("Failed to load sprite: fame-bg.png");
424419
};
@@ -432,7 +427,7 @@ class $modify(LevelInfo, LevelInfoLayer) {
432427

433428
// when player presses the avalanche button
434429
void onAvalancheButton(CCObject * sender) {
435-
ProjectInfoPopup::create()->setProject(this->m_level)->show();
430+
ProjectInfoPopup::create()->setProject(m_level)->show();
436431
};
437432
};
438433

@@ -449,7 +444,7 @@ class $modify(Level, LevelCell) {
449444
bool displayCollabCells = AVAL_GEODE_MOD->getSettingValue<bool>("collab-cells");
450445

451446
// get main bg color layer
452-
auto color = this->getChildByType<CCLayerColor>(0);
447+
auto color = getChildByType<CCLayerColor>(0);
453448

454449
// get level name text
455450
auto nameText = m_mainLayer->getChildByID("level-name");
@@ -518,7 +513,7 @@ class $modify(Level, LevelCell) {
518513
newColor->setID("solo_color"_spr);
519514

520515
colorNode->removeMeAndCleanup();
521-
this->addChild(newColor);
516+
addChild(newColor);
522517

523518
if (fame) Level::setFame(newColor, { 255, 255, 255 });
524519
} else {
@@ -541,7 +536,7 @@ class $modify(Level, LevelCell) {
541536
newColor->setID("collab_color"_spr);
542537

543538
colorNode->removeMeAndCleanup();
544-
this->addChild(newColor);
539+
addChild(newColor);
545540

546541
if (fame) Level::setFame(newColor, { 255, 255, 255 });
547542
} else {
@@ -572,7 +567,7 @@ class $modify(Level, LevelCell) {
572567
levelName->setScale(levelName->getScale() * scaleDownBy);
573568

574569
colorNode->removeMeAndCleanup();
575-
this->addChild(newColor);
570+
addChild(newColor);
576571

577572
if (fame) Level::setFame(newColor, { 255, 244, 95 });
578573
} else {
@@ -595,7 +590,7 @@ class $modify(Level, LevelCell) {
595590
newColor->setID("event_color"_spr);
596591

597592
colorNode->removeMeAndCleanup();
598-
this->addChild(newColor);
593+
addChild(newColor);
599594

600595
if (fame) Level::setFame(newColor, { 85, 249, 255 });
601596
} else {
@@ -621,10 +616,10 @@ class $modify(Level, LevelCell) {
621616
fameGlow->setID("fame"_spr);
622617

623618
// for compact lists
624-
float reScale = (this->m_height / fameGlow->getContentHeight()) * this->getScale();
619+
float reScale = (m_height / fameGlow->getContentHeight()) * getScale();
625620
fameGlow->setScale(reScale);
626621

627-
this->addChild(fameGlow);
622+
addChild(fameGlow);
628623
} else {
629624
AVAL_LOG_ERROR("Failed to load sprite: fame-glow.png");
630625
};
@@ -647,7 +642,7 @@ class $modify(Pause, PauseLayer) {
647642
void customSetup() {
648643
PauseLayer::customSetup();
649644

650-
if (auto rightMenu = this->getChildByID("right-button-menu")) {
645+
if (auto rightMenu = getChildByID("right-button-menu")) {
651646
if (m_fields->m_level) {
652647
Project thisProj = getHandler->GetProject(m_fields->m_level->m_levelID.value());
653648

@@ -746,8 +741,8 @@ class $modify(Menu, MenuLayer) {
746741
AVAL_LOG_DEBUG("Changelog alert disabled");
747742
};
748743

749-
auto winSizeX = this->getScaledContentWidth();
750-
auto winSizeY = this->getScaledContentHeight();
744+
auto winSizeX = getScaledContentWidth();
745+
auto winSizeY = getScaledContentHeight();
751746

752747
bool showAvalButton = AVAL_GEODE_MOD->getSettingValue<bool>("show-aval-featured");
753748

@@ -757,7 +752,7 @@ class $modify(Menu, MenuLayer) {
757752
avalMenu->setPosition({ winSizeX / 2, (winSizeY / 2) - 70.f });
758753
avalMenu->setScaledContentSize({ winSizeX - 75.f, 50.f });
759754

760-
this->addChild(avalMenu);
755+
addChild(avalMenu);
761756

762757
auto avalBtnSprite = CCSprite::createWithSpriteFrameName("button-logo-framed.png"_spr);
763758
avalBtnSprite->ignoreAnchorPointForPosition(false);

0 commit comments

Comments
 (0)