Skip to content

Commit cd1972a

Browse files
committed
fhh
1 parent c60ad52 commit cd1972a

File tree

3 files changed

+27
-1
lines changed

3 files changed

+27
-1
lines changed

changelog.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
# 1.5.8
22

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

56
# 1.5.7
67

src/Hacks/CoinsInPractice.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ class $modify (GJBaseGameLayer)
88
{
99
void collisionCheckObjects(PlayerObject* p0, gd::vector<GameObject*>* p1, int p2, float p3)
1010
{
11-
if (m_isPracticeMode)
11+
if (m_isPracticeMode && p0 && p1)
1212
{
1313
for (size_t i = 0; i < p1->size(); i++)
1414
{

src/Hacks/PracticeComplete.cpp

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,8 +9,20 @@ class $modify (PlayLayer)
99
struct Fields
1010
{
1111
bool hasRespawnedWithCheckpoint;
12+
13+
std::vector<GameObject*> coins;
1214
};
1315

16+
void addObject(GameObject* p0)
17+
{
18+
PlayLayer::addObject(p0);
19+
20+
if (p0->m_objectType == GameObjectType::UserCoin || p0->m_objectType == GameObjectType::SecretCoin) // 142
21+
{
22+
m_fields->coins.push_back(p0);
23+
}
24+
}
25+
1426
void resetLevel()
1527
{
1628
m_fields->hasRespawnedWithCheckpoint = false;
@@ -28,8 +40,21 @@ class $modify (PlayLayer)
2840
void levelComplete()
2941
{
3042
if (m_isPracticeMode)
43+
{
3144
m_isPracticeMode = m_fields->hasRespawnedWithCheckpoint;
3245

46+
if (!m_isPracticeMode)
47+
{
48+
for (auto coin : m_fields->coins)
49+
{
50+
if (coin->getOpacity() == 0)
51+
{
52+
pickupItem(as<EffectGameObject*>(coin));
53+
}
54+
}
55+
}
56+
}
57+
3358
PlayLayer::levelComplete();
3459
}
3560

0 commit comments

Comments
 (0)