From 99743063dd85586b6c768b4d561e6e38bd80ed5a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?M=C3=A1ty=C3=A1s=20Mustoha?= Date: Mon, 27 May 2024 12:17:42 +0200 Subject: [PATCH] Reduced the number of moving object friends --- src/smw/objects/moving/MO_BulletBill.cpp | 2 +- src/smw/objects/moving/MO_CheepCheep.cpp | 2 +- src/smw/objects/moving/MO_PirhanaPlant.cpp | 2 +- src/smw/objects/moving/MovingObject.h | 27 ++++++---------------- src/smw/objects/moving/WalkingEnemy.cpp | 2 +- 5 files changed, 11 insertions(+), 24 deletions(-) diff --git a/src/smw/objects/moving/MO_BulletBill.cpp b/src/smw/objects/moving/MO_BulletBill.cpp index 20801136..7234a1fd 100644 --- a/src/smw/objects/moving/MO_BulletBill.cpp +++ b/src/smw/objects/moving/MO_BulletBill.cpp @@ -184,7 +184,7 @@ void MO_BulletBill::collide(IO_MovingObject* object) ifSoundOnPlay(rm->sfx_bobombsound); } else if (type == movingobject_shell || type == movingobject_throwblock || type == movingobject_throwbox || type == movingobject_attackzone || type == movingobject_explosion) { // Don't kill things with shells that are sitting still - if (type == movingobject_shell && object->state == 2) + if (type == movingobject_shell && object->GetState() == 2) return; // Don't kill things with boxesx that aren't moving fast enough diff --git a/src/smw/objects/moving/MO_CheepCheep.cpp b/src/smw/objects/moving/MO_CheepCheep.cpp index 0f1d9736..a9c265c2 100644 --- a/src/smw/objects/moving/MO_CheepCheep.cpp +++ b/src/smw/objects/moving/MO_CheepCheep.cpp @@ -132,7 +132,7 @@ void MO_CheepCheep::collide(IO_MovingObject* object) if (type == movingobject_fireball || type == movingobject_hammer || type == movingobject_boomerang || type == movingobject_shell || type == movingobject_throwblock || type == movingobject_throwbox || type == movingobject_bulletbill || type == movingobject_podobo || type == movingobject_attackzone || type == movingobject_explosion || type == movingobject_sledgehammer) { // Don't kill goombas with non-moving shells - if (type == movingobject_shell && object->state == 2) + if (type == movingobject_shell && object->GetState() == 2) return; if (type == movingobject_throwbox && !((CO_ThrowBox*)object)->HasKillVelocity()) diff --git a/src/smw/objects/moving/MO_PirhanaPlant.cpp b/src/smw/objects/moving/MO_PirhanaPlant.cpp index c802b482..d62b8bf7 100644 --- a/src/smw/objects/moving/MO_PirhanaPlant.cpp +++ b/src/smw/objects/moving/MO_PirhanaPlant.cpp @@ -253,7 +253,7 @@ void MO_PirhanaPlant::collide(IO_MovingObject* object) if (type == movingobject_fireball || type == movingobject_hammer || type == movingobject_boomerang || type == movingobject_shell || type == movingobject_throwblock || type == movingobject_throwbox || type == movingobject_attackzone || type == movingobject_explosion) { // Don't kill things with shells that are sitting still - if (type == movingobject_shell && object->state == 2) + if (type == movingobject_shell && object->GetState() == 2) return; // Don't kill things with boxesx that aren't moving fast enough diff --git a/src/smw/objects/moving/MovingObject.h b/src/smw/objects/moving/MovingObject.h index 23051ee7..427513a3 100644 --- a/src/smw/objects/moving/MovingObject.h +++ b/src/smw/objects/moving/MovingObject.h @@ -15,35 +15,27 @@ class IO_MovingObject : public CObject { virtual void animate(); virtual bool collide(CPlayer* player); - void collide(IO_MovingObject*) {} - MovingObjectType getMovingObjectType() const - { - return movingObjectType; - } + + MovingObjectType getMovingObjectType() const { return movingObjectType; } + void applyfriction(); void collision_detection_map(); bool collision_detection_checksides(); void flipsidesifneeded(); virtual void SideBounce(bool fRightSide) {} - virtual float BottomBounce() - { - return bounce; - } + virtual float BottomBounce() { return bounce; } void KillObjectMapHazard(short playerID = -1); - virtual void CheckAndDie() - { + virtual void CheckAndDie() { dead = true; } - virtual void Die() - { + virtual void Die() { dead = true; } - bool CollidesWithMap() const - { + bool CollidesWithMap() const { return fObjectCollidesWithMap; } @@ -90,11 +82,6 @@ class IO_MovingObject : public CObject { friend class B_SwitchBlock; friend class B_WeaponBreakableBlock; - friend class MO_BulletBill; - friend class MO_WalkingEnemy; - friend class MO_CheepCheep; - friend class MO_PirhanaPlant; - friend class MovingPlatform; friend void removeifprojectile(IO_MovingObject* object, bool playsound, bool forcedead); diff --git a/src/smw/objects/moving/WalkingEnemy.cpp b/src/smw/objects/moving/WalkingEnemy.cpp index ca80c863..09d78c67 100644 --- a/src/smw/objects/moving/WalkingEnemy.cpp +++ b/src/smw/objects/moving/WalkingEnemy.cpp @@ -230,7 +230,7 @@ void MO_WalkingEnemy::collide(IO_MovingObject* object) if (((type == movingobject_fireball || type == movingobject_hammer || type == movingobject_boomerang) && (fKillOnWeakWeapon || frozen)) || type == movingobject_shell || type == movingobject_throwblock || type == movingobject_throwbox || type == movingobject_bulletbill || type == movingobject_podobo || type == movingobject_attackzone || type == movingobject_explosion || type == movingobject_sledgehammer) { // Don't kill enemies with non-moving shells - if (type == movingobject_shell && object->state == 2) + if (type == movingobject_shell && object->GetState() == 2) return; // Don't kill enemies with slow or non-moving boxes