// // ProjectileObj::Collided // // Called when the projectile colides with something // void ProjectileObj::Collided(MapObj *with, const Vector *veloc) { // Call Parent scope first MapObj::Collided(with, veloc); StartGenericFX(0xF288B23E, NULL, TRUE); // "ProjectileObj::Hit" // If the projectile explodes on impact then detonate if (ProjectileType()->GetImpact()) { // If it hit something then apply some damage to it if (with && !ProjectileType()->explosionType.Alive()) { //FIXME(925491294, "aiarossi"); // Fri Apr 30 09:54:54 1999 // this is passing the impulse velocity of the projectile to the map obj S32 deltaHp = -GetDamage(with->MapType()->GetArmourClass()); with->ModifyHitPoints(deltaHp, source.GetPointer(), sourceTeam, veloc); // Apply hit modifiers if (deltaHp) { weaponType->GetDamage().GetModifiers().Apply(with); } } // Kaboom Detonate(); } }
// // ProjectileObj::AddToMapHook // // Add to map // void ProjectileObj::AddToMapHook() { // Call parent scope first MapObj::AddToMapHook(); StartGenericFX(0x66D3CF88, TrailCallBack); // "ProjectileObj::Trail" }
// // Apply // void ExplosionObjType::Apply(const Vector &location, UnitObj *unit, Team *team) { MapObjIter::All i(NULL, MapObjIter::FilterData(location, areaOuter)); MapObj *obj; while ((obj = i.Next()) != NULL) { // Is the object within the full damage area F32 dist2 = i.GetProximity2() - areaInner2; S32 deltaHp; //Vector dir = obj->WorldMatrix().posit - location; //dir.Normalize(); if (dist2 <= 0.0f) { // Apply the full damage to this object deltaHp = -damage.GetAmount(obj->MapType()->GetArmourClass()); obj->ModifyHitPoints(deltaHp, unit, team/*, &dir*/); } else { F32 mod = 1.0f - (dist2 * areaDiff2Inv); ASSERT(mod >= 0 && mod <= 1.0f) // Apply a proportional damage to this object //Vector v = dir * mod; deltaHp = -(S32) (((F32) damage.GetAmount(obj->MapType()->GetArmourClass())) * mod); obj->ModifyHitPoints(deltaHp, unit, team/*, &v*/); } // Apply hit modifiers if (ArmourClass::Lookup(damage.GetDamageId(), obj->MapType()->GetArmourClass())) { damage.GetModifiers().Apply(obj); // Set blind target time if (blindTargetTime) { UnitObj *unitObj = Promote::Object<UnitObjType, UnitObj>(obj); if (unitObj) { unitObj->FlushTasks(); unitObj->StartBlindTarget(blindTargetTime); } } // Apply the generic effect StartGenericFX(obj, 0x32FBA304); // "ExplosionObj::ApplyTarget" } // Is there an action to execute if (action && team) { Action::Execute(team, action); } } }
// // ExplosionObj::AddToMapHook // // Add to map // void ExplosionObj::AddToMapHook() { // Call parent scope first MapObj::AddToMapHook(); StartGenericFX(0xCD5518E0, ExplosionCallBack); // "ExplosionObj::Explode" // Modify the bounding sphere //meshEnt->worldSphere.radius = ExplosionType()->areaOuter; //meshEnt->worldSphere.radius2 = ExplosionType()->areaOuter * ExplosionType()->areaOuter; }