Skip to content

Commit

Permalink
Update AllModesPlatformer.cpp
Browse files Browse the repository at this point in the history
  • Loading branch information
TheSillyDoggo committed Aug 16, 2024
1 parent 6be51a6 commit a85ae76
Showing 1 changed file with 19 additions and 21 deletions.
40 changes: 19 additions & 21 deletions src/Hacks/AllModesPlatformer.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -15,30 +15,28 @@ class $modify (GJBaseGameLayer)
{
for (size_t i = 0; i < p1->size(); i++)
{
auto obj = p1->at(i);

if (!obj)
break;

if (p0->getObjectRect().intersectsRect(obj->getObjectRect()))
if (auto obj = p1->at(i))
{
if (obj->m_objectType == GameObjectType::WavePortal || obj->m_objectType == GameObjectType::SwingPortal)
if (p0->getObjectRect().intersectsRect(obj->getObjectRect()))
{
if(this->canBeActivatedByPlayer(p0, as<EffectGameObject*>(obj)))
if (obj->m_objectType == GameObjectType::WavePortal || obj->m_objectType == GameObjectType::SwingPortal)
{
this->playerWillSwitchMode(p0, obj);
#ifdef GEODE_IS_WINDOWS
p0->switchedToMode(obj->m_objectType);

if (obj->m_objectType == GameObjectType::SwingPortal)
p0->toggleSwingMode(true, false);
else
p0->toggleDartMode(true, false);

#else
this->switchToFlyMode(p0, obj, false, as<int>(obj->m_objectType));
#endif
obj->playShineEffect();
if(this->canBeActivatedByPlayer(p0, as<EffectGameObject*>(obj)))
{
this->playerWillSwitchMode(p0, obj);
#ifdef GEODE_IS_WINDOWS
p0->switchedToMode(obj->m_objectType);

if (obj->m_objectType == GameObjectType::SwingPortal)
p0->toggleSwingMode(true, false);
else
p0->toggleDartMode(true, false);

#else
this->switchToFlyMode(p0, obj, false, as<int>(obj->m_objectType));
#endif
obj->playShineEffect();
}
}
}
}
Expand Down

0 comments on commit a85ae76

Please sign in to comment.