Complete disaster-recovery snapshot: engine/game source, game data assets, VC6 toolchain + DX SDKs, build outputs, deployed game, and _UNUSED archive. Large binaries in Git LFS; text preserved byte-for-byte (core.autocrlf=false, no eol attributes). See RECOVERY.md for the one-clone rebuild procedure.
107 lines
2.3 KiB
C++
107 lines
2.3 KiB
C++
|
|
#include "MW4Headers.hpp"
|
|
|
|
#include "AI_Damage.hpp"
|
|
#include "MWDamageObject.hpp"
|
|
|
|
|
|
|
|
using namespace MW4AI;
|
|
using namespace MW4AI::Damage;
|
|
|
|
|
|
|
|
int Damage::GetArmorDamage(MWObject& mwobject, int armor_zone)
|
|
{
|
|
Stuff::SortedChainIteratorOf<Adept::DamageObject*,int> i(&(mwobject.damageObjects));
|
|
Adept::DamageObject* o;
|
|
|
|
while ((o = i.ReadAndNext()) != 0)
|
|
{
|
|
if (o->armorZone == armor_zone)
|
|
{
|
|
return (o->GetCurrentDamageLevel());
|
|
}
|
|
}
|
|
|
|
return (Adept::DamageObject::Destroyed);
|
|
}
|
|
|
|
Stuff::Scalar Damage::GetHighResArmorLevel(MechWarrior4::MWObject& mwobject, int armor_zone)
|
|
{
|
|
Stuff::SortedChainIteratorOf<Adept::DamageObject*,int> i(&(mwobject.damageObjects));
|
|
Adept::DamageObject* o;
|
|
|
|
while ((o = i.ReadAndNext()) != 0)
|
|
{
|
|
if (o->armorZone == armor_zone)
|
|
{
|
|
return (o->GetHighResDamageLevel());
|
|
}
|
|
}
|
|
|
|
return (0);
|
|
}
|
|
|
|
int Damage::GetInternalDamage(MWObject& mwobject, int internal_zone)
|
|
{
|
|
Stuff::SortedChainIteratorOf<MechWarrior4::MWInternalDamageObject*,int> i(&(mwobject.internalDamageObjects));
|
|
MechWarrior4::MWInternalDamageObject* o;
|
|
|
|
while ((o = i.ReadAndNext()) != 0)
|
|
{
|
|
if (o->damageZone == internal_zone)
|
|
{
|
|
return (o->GetCurrentDamageLevel());
|
|
}
|
|
}
|
|
|
|
return (Adept::InternalDamageObject::Destroyed);
|
|
}
|
|
|
|
bool Damage::CanRepair(MechWarrior4::MWObject& mwobject)
|
|
{
|
|
{
|
|
Stuff::SortedChainIteratorOf<MWInternalDamageObject*,int> i(&(mwobject.internalDamageObjects));
|
|
|
|
MWInternalDamageObject* internal_damageobject = 0;
|
|
while ((internal_damageobject = i.ReadAndNext()) != 0)
|
|
{
|
|
if (internal_damageobject->CanRepair() == true)
|
|
{
|
|
return (true);
|
|
}
|
|
}
|
|
}
|
|
|
|
{
|
|
Stuff::SortedChainIteratorOf<Adept::DamageObject*,int> i(&(mwobject.damageObjects));
|
|
|
|
Adept::DamageObject* damageobject = 0;
|
|
while ((damageobject = i.ReadAndNext()) != 0)
|
|
{
|
|
if (damageobject->CanRepair() == true)
|
|
{
|
|
return (true);
|
|
}
|
|
}
|
|
}
|
|
|
|
return (false);
|
|
}
|
|
|
|
Stuff::Scalar Damage::GetDamageRating(MechWarrior4::MWObject& mwobject)
|
|
{
|
|
Stuff::Scalar score = 0;
|
|
|
|
Stuff::SortedChainIteratorOf<Adept::DamageObject*,int> i(&(mwobject.damageObjects));
|
|
|
|
Adept::DamageObject* damageobject = 0;
|
|
while ((damageobject = i.ReadAndNext()) != 0)
|
|
{
|
|
score += damageobject->currentArmorValue;
|
|
}
|
|
|
|
return (score);
|
|
}
|