Skip to content

Commit

Permalink
fhh
Browse files Browse the repository at this point in the history
  • Loading branch information
TheSillyDoggo committed Aug 15, 2024
1 parent c60ad52 commit cd1972a
Show file tree
Hide file tree
Showing 3 changed files with 27 additions and 1 deletion.
1 change: 1 addition & 0 deletions changelog.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
# 1.5.8

- Fixed not being able to use checkpoints in platformer with all modes platformer enabled
- Coins are now collected if you complete a level with 1 attempt practice complete

# 1.5.7

Expand Down
2 changes: 1 addition & 1 deletion src/Hacks/CoinsInPractice.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ class $modify (GJBaseGameLayer)
{
void collisionCheckObjects(PlayerObject* p0, gd::vector<GameObject*>* p1, int p2, float p3)
{
if (m_isPracticeMode)
if (m_isPracticeMode && p0 && p1)
{
for (size_t i = 0; i < p1->size(); i++)
{
Expand Down
25 changes: 25 additions & 0 deletions src/Hacks/PracticeComplete.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,20 @@ class $modify (PlayLayer)
struct Fields
{
bool hasRespawnedWithCheckpoint;

std::vector<GameObject*> coins;
};

void addObject(GameObject* p0)
{
PlayLayer::addObject(p0);

if (p0->m_objectType == GameObjectType::UserCoin || p0->m_objectType == GameObjectType::SecretCoin) // 142
{
m_fields->coins.push_back(p0);
}
}

void resetLevel()
{
m_fields->hasRespawnedWithCheckpoint = false;
Expand All @@ -28,8 +40,21 @@ class $modify (PlayLayer)
void levelComplete()
{
if (m_isPracticeMode)
{
m_isPracticeMode = m_fields->hasRespawnedWithCheckpoint;

if (!m_isPracticeMode)
{
for (auto coin : m_fields->coins)
{
if (coin->getOpacity() == 0)
{
pickupItem(as<EffectGameObject*>(coin));
}
}
}
}

PlayLayer::levelComplete();
}

Expand Down

0 comments on commit cd1972a

Please sign in to comment.