Skip to content
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
2 changes: 1 addition & 1 deletion CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ else()
set(CMAKE_OSX_ARCHITECTURES "arm64;x86_64")
endif()

project(AvalancheIndex VERSION 1.2.0)
project(AvalancheIndex VERSION 1.2.1)

file(GLOB_RECURSE SOURCES
src/*.cpp
Expand Down
20 changes: 16 additions & 4 deletions changelog.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,19 @@
### v1.2.1
##### Patches

#### Changes
- **Fixed** previews not showing with [Mod Previews](mod:alphalaneous.mod_previews) mod
- Huge code cleanup
- Minor optimizations
- Several tweaks

#### Developers
- **Added** Geode and Geometry Dash version information to featured project pop-up

###### Latest
---
###### Older

## v1.2.0
#### Team Project pop-up

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

###### Latest
---
###### Older

### v1.1.2
##### Patches

Expand Down
276 changes: 125 additions & 151 deletions incl/src/Avalanche.cpp

Large diffs are not rendered by default.

4 changes: 2 additions & 2 deletions mod.json
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
},
"id": "cubicstudios.avalancheindex",
"name": "Avalanche Index",
"version": "1.2.0",
"version": "1.2.1",
"developers": [
"Cheeseworks"
],
Expand All @@ -18,7 +18,7 @@
"enhancement"
],
"links": {
"source": "https://www.github.com/CubicCommunity/AvalancheIndex/",
"source": "https://github.com/CubicCommunity/AvalancheIndex",
"homepage": "https://avalanche.cubicstudios.xyz/",
"community": "https://www.dsc.gg/cubic"
},
Expand Down
26 changes: 23 additions & 3 deletions src/headers/src/AvalancheFeatured.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -197,7 +197,7 @@ bool AvalancheFeatured::setup() {
infoSprite,
this,
menu_selector(AvalancheFeatured::openApplicationPopup));
m_infoBtn->setPosition({ widthCS / 2.f, 5.f });
m_infoBtn->setPosition({ widthCS / 2.f, 2.5f });
m_infoBtn->setVisible(true);
m_infoBtn->setZOrder(3);

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

// geode loader
auto loader = Loader::get();

// geode changelog popup button
auto changelogBtnSprite = CCSprite::createWithSpriteFrameName("GJ_chatBtn_001.png");
changelogBtnSprite->setScale(0.75f);
auto changelogBtnSprite = CCSprite::createWithSpriteFrameName("GJ_menuBtn_001.png");
changelogBtnSprite->setScale(0.625f);

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

m_overlayMenu->addChild(verLabel);

// game and geode version text label
std::ostringstream gdVerLabelText;
gdVerLabelText << "Geode " << loader->getVersion().toVString(true) << " for v" << loader->getGameVersion();

auto gdVerLabelTextStr = gdVerLabelText.str();

auto gdVerLabel = CCLabelBMFont::create(gdVerLabelTextStr.c_str(), "bigFont.fnt");
gdVerLabel->setID("gd-version-label");
gdVerLabel->ignoreAnchorPointForPosition(false);
gdVerLabel->setPosition({ m_overlayMenu->getScaledContentWidth() - 5.f, 12.5f });
gdVerLabel->setAnchorPoint({ 1, 0 });
gdVerLabel->setOpacity(100);
gdVerLabel->setScale(0.25f);
gdVerLabel->setZOrder(3);

m_overlayMenu->addChild(gdVerLabel);
} else {
AVAL_LOG_DEBUG("Dev buttons are disabled");
};
Expand Down
6 changes: 3 additions & 3 deletions src/headers/src/ProjectInfoPopup.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -699,8 +699,8 @@ ProjectInfoPopup* ProjectInfoPopup::setProject(GJGameLevel* level) {

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

linkedProjMenu->addChild(linkedProjLabel);
Expand Down
63 changes: 29 additions & 34 deletions src/main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -207,17 +207,17 @@ class $modify(LevelInfo, LevelInfoLayer) {
bool displayCollabLayers = AVAL_GEODE_MOD->getSettingValue<bool>("collab-layers");

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

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

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

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

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

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

if (showProjectInfo) {
CCSprite* avalBtnSprite = CCSprite::createWithSpriteFrameName("GJ_plainBtn_001.png");
avalBtnSprite->setScale(0.944f);

CCSprite* avalBtnSpriteIcon = CCSprite::createWithSpriteFrameName("button-logo.png"_spr);
avalBtnSpriteIcon->setPositionX(avalBtnSprite->getContentWidth() / 2.025f);
avalBtnSpriteIcon->setPositionY(avalBtnSprite->getContentHeight() / 2.f);
avalBtnSpriteIcon->ignoreAnchorPointForPosition(false);
avalBtnSpriteIcon->setAnchorPoint({ 0.5, 0.5 });
avalBtnSpriteIcon->setScale(0.875f);

avalBtnSprite->addChild(avalBtnSpriteIcon);
CCSprite* avalBtnSprite = CircleButtonSprite::createWithSpriteFrameName(
"button-logo.png"_spr,
1.25f,
CircleBaseColor::Green,
CircleBaseSize::Medium
);

CCMenuItemSpriteExtra* avalBtn = CCMenuItemSpriteExtra::create(
avalBtnSprite,
Expand Down Expand Up @@ -330,8 +325,8 @@ class $modify(LevelInfo, LevelInfoLayer) {
bgSprite->setColor({ 66, 94, 255 });
bgSprite->setAnchorPoint({ 0.5, 0.5 });
bgSprite->ignoreAnchorPointForPosition(false);
bgSprite->setContentSize({ this->getScaledContentWidth(), this->getScaledContentWidth() });
bgSprite->setPosition({ this->getScaledContentWidth() / 2, this->getScaledContentHeight() / 2 });
bgSprite->setContentSize({ getScaledContentWidth(), getScaledContentWidth() });
bgSprite->setPosition({ getScaledContentWidth() / 2, getScaledContentHeight() / 2 });
bgSprite->setZOrder(background->getZOrder());
bgSprite->setID("team_background"_spr);

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

auto ogHeight = this->getContentHeight();
auto ogHeight = getContentHeight();
auto thumbHeight = bgThumbnail->getContentHeight();

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

this->addChild(bgThumbnail);
addChild(bgThumbnail);
} else {
AVAL_LOG_ERROR("Failed to load sprite: project-bg.png");
};

this->addChild(bgSprite);
addChild(bgSprite);
} else {
AVAL_LOG_ERROR("Failed to load sprite: game_bg_19_001.png");
};
Expand Down Expand Up @@ -402,11 +397,11 @@ class $modify(LevelInfo, LevelInfoLayer) {
bgThumbnail->setOpacity(125);
bgThumbnail->setAnchorPoint({ 0.5, 0 });
bgThumbnail->ignoreAnchorPointForPosition(false);
bgThumbnail->setPosition({ this->getContentWidth() / 2, 0 });
bgThumbnail->setPosition({ getContentWidth() / 2, 0 });
bgThumbnail->setZOrder(background->getZOrder() + 1);
bgThumbnail->setID("team_thumbnail"_spr);

auto ogWidth = this->getContentWidth();
auto ogWidth = getContentWidth();
auto scaledWidth = bgThumbnail->getContentWidth();

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

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

// when player presses the avalanche button
void onAvalancheButton(CCObject * sender) {
ProjectInfoPopup::create()->setProject(this->m_level)->show();
ProjectInfoPopup::create()->setProject(m_level)->show();
};
};

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

// get main bg color layer
auto color = this->getChildByType<CCLayerColor>(0);
auto color = getChildByType<CCLayerColor>(0);

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

colorNode->removeMeAndCleanup();
this->addChild(newColor);
addChild(newColor);

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

colorNode->removeMeAndCleanup();
this->addChild(newColor);
addChild(newColor);

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

colorNode->removeMeAndCleanup();
this->addChild(newColor);
addChild(newColor);

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

colorNode->removeMeAndCleanup();
this->addChild(newColor);
addChild(newColor);

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

// for compact lists
float reScale = (this->m_height / fameGlow->getContentHeight()) * this->getScale();
float reScale = (m_height / fameGlow->getContentHeight()) * getScale();
fameGlow->setScale(reScale);

this->addChild(fameGlow);
addChild(fameGlow);
} else {
AVAL_LOG_ERROR("Failed to load sprite: fame-glow.png");
};
Expand All @@ -647,7 +642,7 @@ class $modify(Pause, PauseLayer) {
void customSetup() {
PauseLayer::customSetup();

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

Expand Down Expand Up @@ -746,8 +741,8 @@ class $modify(Menu, MenuLayer) {
AVAL_LOG_DEBUG("Changelog alert disabled");
};

auto winSizeX = this->getScaledContentWidth();
auto winSizeY = this->getScaledContentHeight();
auto winSizeX = getScaledContentWidth();
auto winSizeY = getScaledContentHeight();

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

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

this->addChild(avalMenu);
addChild(avalMenu);

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