Skip to content

Commit d982d86

Browse files
author
Erymanthus (RayDeeUx)
authored
chore: add geode addition inline to detect if playerobject is from globed/champions or not (#1307)
* chore: add geode addition inline to detect if playerobject is from globed/champions or not * fix: rename function per suggestion from dankmeme * fix: broma syntax * fix: move declaration * fix: add namespace * chore: remove extra newline * chore: extra utils bindings courtesy of jasmine * chore: add the warnings to the broma file as well * fix: extra technicalities * fix: more conditional tweask
1 parent 2a2a10c commit d982d86

3 files changed

Lines changed: 57 additions & 0 deletions

File tree

bindings/2.2074/GeometryDash.bro

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -27850,6 +27850,27 @@ class PlayerObject : GameObject, AnimatedSpriteDelegate {
2785027850
this->logValues();
2785127851
}
2785227852

27853+
/// @note geode addition
27854+
/// @note this will return false for PlayerObjects in MenuGameLayer
27855+
/// @note this might break if you call from PlayerObject::init
27856+
bool isVanillaPlayer() {
27857+
return m_gameLayer && (this == m_gameLayer->m_player1 || this == m_gameLayer->m_player2);
27858+
}
27859+
27860+
/// @note geode addition
27861+
/// @note this will return false for PlayerObjects in MenuGameLayer
27862+
/// @note this might break if you call from PlayerObject::init
27863+
bool isPlayer1() {
27864+
return m_gameLayer && this == m_gameLayer->m_player1;
27865+
}
27866+
27867+
/// @note geode addition
27868+
/// @note this will return false for PlayerObjects in MenuGameLayer
27869+
/// @note this might break if you call from PlayerObject::init
27870+
bool isPlayer2() {
27871+
return m_gameLayer && this == m_gameLayer->m_player2;
27872+
}
27873+
2785327874
cocos2d::CCNode* m_mainLayer;
2785427875
bool m_wasTeleported;
2785527876
bool m_fixGravityBug;

bindings/2.2081/GeometryDash.bro

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14603,6 +14603,21 @@ class PlayerObject : GameObject, AnimatedSpriteDelegate {
1460314603
void yStartDown() = win inline, imac 0x41d670, m1 0x391c4c, ios inline;
1460414604
void yStartUp() = win inline, imac 0x41d650, m1 0x391c2c, ios inline;
1460514605

14606+
/// @note geode addition
14607+
/// @note this will return false for PlayerObjects in MenuGameLayer
14608+
/// @note this might break if you call from PlayerObject::init
14609+
bool isVanillaPlayer() = inline;
14610+
14611+
/// @note geode addition
14612+
/// @note this will return false for PlayerObjects in MenuGameLayer
14613+
/// @note this might break if you call from PlayerObject::init
14614+
bool isPlayer1() = inline;
14615+
14616+
/// @note geode addition
14617+
/// @note this will return false for PlayerObjects in MenuGameLayer
14618+
/// @note this might break if you call from PlayerObject::init
14619+
bool isPlayer2() = inline;
14620+
1460614621
cocos2d::CCNode* m_mainLayer;
1460714622
bool m_wasTeleported;
1460814623
bool m_fixGravityBug;

bindings/2.2081/inline/PlayerObject.cpp

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,27 @@ PlayerObject::PlayerObject() {
3535
}
3636
#endif
3737

38+
/// @note Geode addition
39+
/// @note this will return false for PlayerObjects in MenuGameLayer
40+
/// @note this might break if you call from PlayerObject::init
41+
bool PlayerObject::isVanillaPlayer() {
42+
return m_gameLayer && (this == m_gameLayer->m_player1 || this == m_gameLayer->m_player2);
43+
}
44+
45+
/// @note geode addition
46+
/// @note this will return false for PlayerObjects in MenuGameLayer
47+
/// @note this might break if you call from PlayerObject::init
48+
bool PlayerObject::isPlayer1() {
49+
return m_gameLayer && this == m_gameLayer->m_player1;
50+
}
51+
52+
/// @note geode addition
53+
/// @note this will return false for PlayerObjects in MenuGameLayer
54+
/// @note this might break if you call from PlayerObject::init
55+
bool PlayerObject::isPlayer2() {
56+
return m_gameLayer && this == m_gameLayer->m_player2;
57+
}
58+
3859
#if defined(GEODE_IS_WINDOWS) || defined(GEODE_IS_IOS)
3960
void PlayerObject::addToYVelocity(double yVelocity, int type) {
4061
this->setYVelocity(m_yVelocity + yVelocity, type);

0 commit comments

Comments
 (0)