diff options
Diffstat (limited to 'src/meteor.cpp')
-rwxr-xr-x | src/meteor.cpp | 25 |
1 files changed, 24 insertions, 1 deletions
diff --git a/src/meteor.cpp b/src/meteor.cpp index 91e90c0..aa76f5d 100755 --- a/src/meteor.cpp +++ b/src/meteor.cpp @@ -27,6 +27,9 @@ class dMeteor : public dEn_c { void updateModelMatrices(); void playerCollision(ActivePhysics *apThis, ActivePhysics *apOther); void collisionCat7_GroundPound(ActivePhysics *apThis, ActivePhysics *apOther); + + public: + void kill(); }; dMeteor *dMeteor::build() { @@ -47,6 +50,18 @@ void dMeteor::playerCollision(ActivePhysics *apThis, ActivePhysics *apOther) { DamagePlayer(this, apThis, apOther); } +void MeteorPhysicsCallback(dMeteor *self, dEn_c *other) { + if (other->name == 657) { + OSReport("CANNON COLLISION"); + + SpawnEffect("Wm_en_burst_m", 0, &other->pos, &(S16Vec){0,0,0}, &(Vec){1.0, 1.0, 1.0}); + PlaySound(other, SE_OBJ_TARU_BREAK); + other->Delete(1); + + self->kill(); + } +} + void dMeteor::collisionCat7_GroundPound(ActivePhysics *apThis, ActivePhysics *apOther) { DamagePlayer(this, apThis, apOther); } @@ -97,7 +112,7 @@ int dMeteor::onCreate() { this->aPhysics.addToList(); } - MakeItRound.baseSetup(this, 0, 0, 0, 1, 0); + MakeItRound.baseSetup(this, (void*)&MeteorPhysicsCallback, 0, 0, 1, 0); MakeItRound.x = 0.0; MakeItRound.y = 0.0; @@ -157,4 +172,12 @@ void dMeteor::updateModelMatrices() { bodyModel.calcWorld(false); } +void dMeteor::kill() { + PlaySound(this, SE_OBJ_ROCK_LAND); + SpawnEffect("Wm_ob_cmnboxsmoke", 0, &pos, &rot, &scale); + SpawnEffect("Wm_ob_cmnboxgrain", 0, &pos, &rot, &scale); + + this->Delete(1); +} + |