make sure that all places that read from SpriteMass ensure that the cache is up to date.

This allows removing the serializer for it.
This commit is contained in:
Christoph Oelckers 2023-10-17 18:17:22 +02:00
parent b8aee5a730
commit 5dd0a43bca
3 changed files with 5 additions and 24 deletions

View file

@ -4660,7 +4660,7 @@ void actFireVector(DBloodActor* shooter, double offset, double zoffset, DVector3
{
if (actor->xspr.physAttr & kPhysDebrisVector)
{
int mass = max(actor->spriteMass.mass, 10);
int mass = max(getSpriteMassBySize(actor), 10);
double thrust = double(pVectorData->impulse) / (mass * 4096);
actor->vel += dv * thrust;

View file

@ -544,8 +544,7 @@ void DBloodActor::Serialize(FSerializer& arc)
#ifdef NOONE_EXTENSIONS
if (gModernMap)
{
arc//("spritemass", spriteMass) // should always be cached and not written out.
("prevmarker", prevmarker)
arc("prevmarker", prevmarker)
("customdude", customDude)
.Array("conditions", condition, 4);

View file

@ -1785,9 +1785,10 @@ void debrisConcuss(DBloodActor* owneractor, DBloodActor* actor, const DVector3&
double size = (tex->GetDisplayWidth() * actor->spr.scale.X * tex->GetDisplayHeight() * actor->spr.scale.Y) * 2048;
if (actor->xspr.physAttr & kPhysDebrisExplode)
{
if (actor->spriteMass.mass > 0)
int mass = getSpriteMassBySize(actor);
if (mass > 0)
{
double t = double(dmg) * size / actor->spriteMass.mass;
double t = double(dmg) * size / mass;
actor->vel += dv * t / (1 << 24);
}
@ -8901,25 +8902,6 @@ int nnExtDudeStartHealth(DBloodActor* pSpr, int nHealth)
return getDudeInfo(pSpr->GetType())->startHealth << 4;
}
#if 0 // no need to save if we ensure it never gets accessed directly without validating the content
FSerializer& Serialize(FSerializer& arc, const char* keyname, SPRITEMASS& w, SPRITEMASS* def)
{
static SPRITEMASS nul;
if (arc.isReading()) w = {};
if (arc.BeginObject(keyname))
{
arc("seq", w.seqId, &nul.seqId)
("texid", w.texid, &nul.texid)
("scale", w.scale, &nul.scale)
("clipdist", w.clipDist)
("mass", w.mass)
("airvel", w.airVel)
("fraction", w.fraction)
.EndObject();
}
return arc;
}
#endif
void SerializeConditions(FSerializer& arc);