removed all calls to getMassBySize.

This should be handled more transparently if it gets reimplemented.
This commit is contained in:
Christoph Oelckers 2023-10-09 18:57:59 +02:00
parent 7f0b501aa2
commit 2f6998f980
3 changed files with 6 additions and 42 deletions

View file

@ -983,22 +983,13 @@ static void ConcussSprite(DBloodActor* source, DBloodActor* actor, const DVector
if (actor->spr.flags & kPhysMove)
{
double mass = actor->mass();
if (actor->IsDudeActor())
{
#ifdef NOONE_EXTENSIONS
if (actor->GetType() == kDudeModernCustom || actor->GetType() == kDudeModernCustomBurning)
{
mass = getSpriteMassBySize(actor);
}
#endif
}
else if (actor->GetType() < kThingBase || actor->GetType() >= kThingMax)
if (!actor->IsDudeActor() && !actor->IsThingActor())
{
Printf(PRINT_HIGH, "Unexpected type in ConcussSprite(): Sprite: %d Type: %d Stat: %d", actor->GetIndex(), (int)actor->GetType(), (int)actor->spr.statnum);
return;
}
double mass = actor->mass();
if (mass > 0)
{
auto tex = TexMan.GetGameTexture(actor->spr.spritetexture());
@ -2288,13 +2279,6 @@ static void checkCeilHit(DBloodActor* actor)
int mass1 = actor2->mass();
int mass2 = actor->mass();
switch (actor->GetType())
{
case kDudeModernCustom:
case kDudeModernCustomBurning:
mass2 = getSpriteMassBySize(actor);
break;
}
if (mass1 > mass2)
{
int dmg = int(4 * (abs((mass1 - mass2) * actor2->clipdist) - actor->clipdist));
@ -2317,7 +2301,7 @@ static void checkCeilHit(DBloodActor* actor)
case kDudeModernCustom:
case kDudeModernCustomBurning:
int dmg = 0;
if (!actor->IsDudeActor() || (dmg = ClipLow((getSpriteMassBySize(actor2) - getSpriteMassBySize(actor)) >> 1, 0)) == 0)
if (!actor->IsDudeActor() || (dmg = ClipLow((actor2->mass() - actor->mass()) >> 1, 0)) == 0)
break;
if (!actor->IsPlayerActor())
@ -2376,13 +2360,6 @@ static void checkHit(DBloodActor* actor)
{
int mass1 = actor->mass();
int mass2 = actor2->mass();
switch (actor2->GetType())
{
case kDudeModernCustom:
case kDudeModernCustomBurning:
mass2 = getSpriteMassBySize(actor2);
break;
}
if (mass1 > mass2)
{
actKickObject(actor, actor2);
@ -4676,19 +4653,6 @@ void actFireVector(DBloodActor* shooter, double offset, double zoffset, DVector3
}
else if (actor->spr.statnum == kStatDude && actor->hasX())
{
#ifdef NOONE_EXTENSIONS
if (actor->IsDudeActor())
{
switch (actor->GetType())
{
case kDudeModernCustom:
case kDudeModernCustomBurning:
mass = getSpriteMassBySize(actor);
break;
}
}
#endif
if (mass > 0 && pVectorData->impulse)
{
double thrust = double(pVectorData->impulse) / (mass * 1024);

View file

@ -1714,7 +1714,7 @@ int getBaseChanceModifier(int baseChance)
int getRecoilChance(DBloodActor* actor)
{
int mass = getSpriteMassBySize(actor);
int mass = actor->mass();
int baseChance = (!dudeIsMelee(actor) ? 0x8000 : 0x4000);
baseChance = getBaseChanceModifier(baseChance) + actor->xspr.data3;
@ -1724,7 +1724,7 @@ int getRecoilChance(DBloodActor* actor)
int getDodgeChance(DBloodActor* actor)
{
int mass = getSpriteMassBySize(actor);
int mass = actor->mass();
int baseChance = (!dudeIsMelee(actor) ? 0x6000 : 0x1000);
baseChance = getBaseChanceModifier(baseChance) + actor->xspr.data3;

View file

@ -215,7 +215,7 @@ public:
return *(int*)(GetClass()->Meta + o_startHealth);
}
inline int mass() const
/* virtual */inline int mass() const // if we decide to add nnext, this will need a virtual override on the script side or some comparable means to branch off!
{
return *(int*)(GetClass()->Meta + o_mass);
}