Skip to content

Commit

Permalink
Reduced the number of moving object friends
Browse files Browse the repository at this point in the history
  • Loading branch information
mmatyas committed May 27, 2024
1 parent 12d0028 commit 123f5fa
Show file tree
Hide file tree
Showing 5 changed files with 11 additions and 24 deletions.
2 changes: 1 addition & 1 deletion src/smw/objects/moving/MO_BulletBill.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
2 changes: 1 addition & 1 deletion src/smw/objects/moving/MO_CheepCheep.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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())
Expand Down
2 changes: 1 addition & 1 deletion src/smw/objects/moving/MO_PirhanaPlant.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
27 changes: 7 additions & 20 deletions src/smw/objects/moving/MovingObject.h
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}

Expand Down Expand Up @@ -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);
Expand Down
2 changes: 1 addition & 1 deletion src/smw/objects/moving/WalkingEnemy.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit 123f5fa

Please sign in to comment.