mirror of
https://github.com/ZDoom/Raze.git
synced 2024-11-15 08:51:24 +00:00
- handled all remaining x/yrepeat in Blood.
This commit is contained in:
parent
1d48b0776e
commit
1c82d19d37
7 changed files with 42 additions and 41 deletions
|
@ -2303,7 +2303,7 @@ bool genDudePrepare(DBloodActor* actor, int propId)
|
|||
// to ensure mass gets updated, let's clear all cache
|
||||
SPRITEMASS* pMass = &actor->spriteMass;
|
||||
pMass->seqId = pMass->picnum = 0;
|
||||
pMass->scalex = pMass->scaley = 0;
|
||||
pMass->scale.Zero();
|
||||
pMass->clipDist = 0;
|
||||
pMass->mass = pMass->airVel = pMass->fraction = 0;
|
||||
getSpriteMassBySize(actor);
|
||||
|
|
|
@ -170,7 +170,7 @@ struct GENDUDEEXTRA
|
|||
uint16_t slaveCount; // how many dudes is summoned
|
||||
TObjPtr<DBloodActor*> pLifeLeech; // spritenum of dropped dude's leech
|
||||
TObjPtr<DBloodActor*> slave[kGenDudeMaxSlaves]; // index of the ones dude is summon
|
||||
signed short dmgControl[kDamageMax]; // depends of current weapon, drop armor item, sprite yrepeat and surface type
|
||||
signed short dmgControl[kDamageMax]; // depends of current weapon, drop armor item, sprite repeat and surface type
|
||||
bool updReq[kGenDudePropertyMax]; // update requests
|
||||
union
|
||||
{
|
||||
|
|
|
@ -46,7 +46,7 @@ static DAngle gCameraAng;
|
|||
DAngle random_angles[16][3];
|
||||
|
||||
// to allow quick replacement later
|
||||
#define COPY_SCALE pNSprite->xrepeat = pTSprite->xrepeat; pNSprite->yrepeat = pTSprite->yrepeat;
|
||||
#define COPY_SCALE pNSprite->CopyScale(pTSprite);
|
||||
|
||||
//---------------------------------------------------------------------------
|
||||
//
|
||||
|
@ -132,9 +132,8 @@ static tspritetype* viewAddEffect(tspriteArray& tsprites, int nTSprite, VIEW_EFF
|
|||
break;
|
||||
|
||||
pNSprite2->picnum = 2203;
|
||||
pNSprite2->SetScale(width * REPEAT_SCALE, 0.3125);
|
||||
|
||||
pNSprite2->xrepeat = width;
|
||||
pNSprite2->yrepeat = 20;
|
||||
pNSprite2->pal = 10;
|
||||
if (perc >= 75) pNSprite2->pal = 0;
|
||||
else if (perc >= 50) pNSprite2->pal = 6;
|
||||
|
@ -456,8 +455,7 @@ static tspritetype* viewAddEffect(tspriteArray& tsprites, int nTSprite, VIEW_EFF
|
|||
if (gDetail > 1)
|
||||
pNSprite->cstat |= CSTAT_SPRITE_TRANSLUCENT | CSTAT_SPRITE_TRANS_FLIP;
|
||||
pNSprite->shade = ClipLow(pTSprite->shade - 32, -128);
|
||||
pNSprite->xrepeat = pTSprite->xrepeat;
|
||||
pNSprite->yrepeat = 64;
|
||||
pNSprite->SetScale(pTSprite->ScaleX(), 1);
|
||||
pNSprite->picnum = 775;
|
||||
break;
|
||||
}
|
||||
|
@ -798,7 +796,7 @@ void viewProcessSprites(tspriteArray& tsprites, const DVector3& cPos, DAngle cA,
|
|||
case kStatProjectile: {
|
||||
switch (pTSprite->type) {
|
||||
case kMissileTeslaAlt:
|
||||
pTSprite->yrepeat = 128;
|
||||
pTSprite->SetScaleY(2);
|
||||
pTSprite->cstat |= CSTAT_SPRITE_ALIGNMENT_FLOOR;
|
||||
break;
|
||||
case kMissileTeslaRegular:
|
||||
|
|
|
@ -172,9 +172,9 @@ DBloodActor* CFX::fxSpawnActor(FX_ID nFx, sectortype* pSector, const DVector3& p
|
|||
actor->spr.pal = pFX->pal;
|
||||
actor->spr.detail = pFX->detail;
|
||||
if (pFX->_xrepeat > 0)
|
||||
actor->spr.xrepeat = pFX->_xrepeat;
|
||||
actor->spr.SetScaleX(pFX->_xrepeat * REPEAT_SCALE);
|
||||
if (pFX->_yrepeat > 0)
|
||||
actor->spr.yrepeat = pFX->_yrepeat;
|
||||
actor->spr.SetScaleY(pFX->_yrepeat * REPEAT_SCALE);
|
||||
if ((pFX->flags & 1) && Chance(0x8000))
|
||||
actor->spr.cstat |= CSTAT_SPRITE_XFLIP;
|
||||
if ((pFX->flags & 2) && Chance(0x8000))
|
||||
|
|
|
@ -1432,8 +1432,8 @@ int getSpriteMassBySize(DBloodActor* actor)
|
|||
}
|
||||
|
||||
SPRITEMASS* cached = &actor->spriteMass;
|
||||
if (((seqId >= 0 && seqId == cached->seqId) || actor->spr.picnum == cached->picnum) && actor->spr.xrepeat == cached->scalex &&
|
||||
actor->spr.yrepeat == cached->scaley && clipDist == cached->clipDist)
|
||||
if (((seqId >= 0 && seqId == cached->seqId) || actor->spr.picnum == cached->picnum) && actor->spr.ScaleX() == cached->scale.X &&
|
||||
actor->spr.ScaleY() == cached->scale.Y && clipDist == cached->clipDist)
|
||||
{
|
||||
return cached->mass;
|
||||
}
|
||||
|
@ -1457,8 +1457,8 @@ int getSpriteMassBySize(DBloodActor* actor)
|
|||
clipDist = max(actor->clipdist, 0.25);
|
||||
int x = tileWidth(picnum);
|
||||
int y = tileHeight(picnum);
|
||||
int xscale = actor->spr.xrepeat * 64;
|
||||
int yscale = actor->spr.yrepeat * 64;
|
||||
int xscale = int(actor->spr.ScaleX() * 64);
|
||||
int yscale = int(actor->spr.ScaleY() * 64);
|
||||
|
||||
// take surface type into account
|
||||
switch (tileGetSurfType(actor->spr.picnum))
|
||||
|
@ -1513,8 +1513,8 @@ int getSpriteMassBySize(DBloodActor* actor)
|
|||
cached->airVel = ClipRange(400 - cached->mass, 32, 400);
|
||||
cached->fraction = ClipRange(60000 - (cached->mass << 7), 8192, 60000);
|
||||
|
||||
cached->scalex = actor->spr.xrepeat;
|
||||
cached->scaley = actor->spr.yrepeat;
|
||||
cached->scale.X = actor->spr.ScaleX();
|
||||
cached->scale.Y = actor->spr.ScaleY();
|
||||
cached->picnum = actor->spr.picnum;
|
||||
cached->seqId = seqId;
|
||||
cached->clipDist = actor->clipdist;
|
||||
|
@ -1572,7 +1572,7 @@ void debrisConcuss(DBloodActor* owneractor, int listIndex, const DVector3& pos,
|
|||
|
||||
dmg = int(dmg * (0x4000 / (0x4000 + dv.LengthSquared())));
|
||||
bool thing = (actor->spr.type >= kThingBase && actor->spr.type < kThingMax);
|
||||
int size = (tileWidth(actor->spr.picnum) * actor->spr.xrepeat * tileHeight(actor->spr.picnum) * actor->spr.yrepeat) >> 1;
|
||||
int size = (tileWidth(actor->spr.picnum) * actor->spr.ScaleX() * tileHeight(actor->spr.picnum) * actor->spr.ScaleY()) * 2048;
|
||||
if (actor->xspr.physAttr & kPhysDebrisExplode)
|
||||
{
|
||||
if (actor->spriteMass.mass > 0)
|
||||
|
@ -2450,13 +2450,13 @@ void useObjResizer(DBloodActor* sourceactor, int targType, sectortype* targSect,
|
|||
{
|
||||
if (valueIsBetween(sourceactor->xspr.data1, -1, 32767))
|
||||
{
|
||||
targetactor->spr.xrepeat = ClipRange(sourceactor->xspr.data1, 0, 255);
|
||||
targetactor->spr.SetScaleX(ClipRange(sourceactor->xspr.data1, 0, 255) * REPEAT_SCALE);
|
||||
fit = true;
|
||||
}
|
||||
|
||||
if (valueIsBetween(sourceactor->xspr.data2, -1, 32767))
|
||||
{
|
||||
targetactor->spr.yrepeat = ClipRange(sourceactor->xspr.data2, 0, 255);
|
||||
targetactor->spr.SetScaleY(ClipRange(sourceactor->xspr.data2, 0, 255) * REPEAT_SCALE);
|
||||
fit = true;
|
||||
}
|
||||
}
|
||||
|
@ -3353,8 +3353,7 @@ void useEffectGen(DBloodActor* sourceactor, DBloodActor* actor)
|
|||
pEffect->spr.pal = sourceactor->spr.pal;
|
||||
pEffect->spr.xoffset = sourceactor->spr.xoffset;
|
||||
pEffect->spr.yoffset = sourceactor->spr.yoffset;
|
||||
pEffect->spr.xrepeat = sourceactor->spr.xrepeat;
|
||||
pEffect->spr.yrepeat = sourceactor->spr.yrepeat;
|
||||
pEffect->spr.CopyScale(&sourceactor->spr);
|
||||
pEffect->spr.shade = sourceactor->spr.shade;
|
||||
}
|
||||
|
||||
|
@ -3768,7 +3767,7 @@ void useSeqSpawnerGen(DBloodActor* sourceactor, int objType, sectortype* pSector
|
|||
pos.Z = top;
|
||||
break;
|
||||
case 4:
|
||||
// this had no value shift and no yrepeat handling, which looks like a bug.
|
||||
// this had no value shift and no repeat handling, which looks like a bug.
|
||||
pos.Z += (tileHeight(iactor->spr.picnum) / 2 + tileTopOffset(iactor->spr.picnum)) * iactor->spr.ScaleY();
|
||||
break;
|
||||
case 5:
|
||||
|
@ -3788,8 +3787,7 @@ void useSeqSpawnerGen(DBloodActor* sourceactor, int objType, sectortype* pSector
|
|||
{
|
||||
spawned->spr.pal = sourceactor->spr.pal;
|
||||
spawned->spr.shade = sourceactor->spr.shade;
|
||||
spawned->spr.xrepeat = sourceactor->spr.xrepeat;
|
||||
spawned->spr.yrepeat = sourceactor->spr.yrepeat;
|
||||
spawned->spr.CopyScale(&sourceactor->spr);
|
||||
spawned->spr.xoffset = sourceactor->spr.xoffset;
|
||||
spawned->spr.yoffset = sourceactor->spr.yoffset;
|
||||
}
|
||||
|
@ -3986,9 +3984,9 @@ bool condCheckMixed(DBloodActor* aCond, const EVENT& event, int cmpOp, bool PUSH
|
|||
case 27: return condCmp(actor->spr.shade, arg1, arg2, cmpOp);
|
||||
case 28: return (arg3) ? condCmp((actor->spr.cstat & ESpriteFlags::FromInt(arg3)), arg1, arg2, cmpOp) : (actor->spr.cstat & ESpriteFlags::FromInt(arg1));
|
||||
case 29: return (arg3) ? condCmp((actor->spr.hitag & arg3), arg1, arg2, cmpOp) : (actor->spr.hitag & arg1);
|
||||
case 30: return condCmp(actor->spr.xrepeat, arg1, arg2, cmpOp);
|
||||
case 30: return condCmp(int(actor->spr.ScaleX() / REPEAT_SCALE), arg1, arg2, cmpOp);
|
||||
case 31: return condCmp(actor->spr.xoffset, arg1, arg2, cmpOp);
|
||||
case 32: return condCmp(actor->spr.yrepeat, arg1, arg2, cmpOp);
|
||||
case 32: return condCmp(int(actor->spr.ScaleY() / REPEAT_SCALE), arg1, arg2, cmpOp);
|
||||
case 33: return condCmp(actor->spr.yoffset, arg1, arg2, cmpOp);
|
||||
}
|
||||
}
|
||||
|
@ -6528,10 +6526,10 @@ void useUniMissileGen(DBloodActor* sourceactor, DBloodActor* actor)
|
|||
if (canInherit != 0)
|
||||
{
|
||||
if (canInherit & 0x2)
|
||||
missileactor->spr.xrepeat = (from == kModernTypeFlag1) ? sourceactor->spr.xrepeat : actor->spr.xrepeat;
|
||||
missileactor->spr.SetScaleX((from == kModernTypeFlag1) ? sourceactor->spr.ScaleX() : actor->spr.ScaleX());
|
||||
|
||||
if (canInherit & 0x1)
|
||||
missileactor->spr.yrepeat = (from == kModernTypeFlag1) ? sourceactor->spr.yrepeat : actor->spr.yrepeat;
|
||||
missileactor->spr.SetScaleY((from == kModernTypeFlag1) ? sourceactor->spr.ScaleY() : actor->spr.ScaleY());
|
||||
|
||||
if (canInherit & 0x4)
|
||||
missileactor->spr.pal = (from == kModernTypeFlag1) ? sourceactor->spr.pal : actor->spr.pal;
|
||||
|
@ -8221,7 +8219,7 @@ void aiPatrolAlarmLite(DBloodActor* actor, DBloodActor* targetactor)
|
|||
if (actor->xspr.health <= 0)
|
||||
return;
|
||||
|
||||
double zt1, zb1, zt2, zb2; //int eaz1 = (getDudeInfo(actor->spr.type)->eyeHeight * actor->spr.yrepeat) << 2;
|
||||
double zt1, zb1, zt2, zb2;
|
||||
GetActorExtents(actor, &zt1, &zb1);
|
||||
GetActorExtents(targetactor, &zt2, &zb2);
|
||||
|
||||
|
@ -9191,8 +9189,10 @@ void callbackUniMissileBurst(DBloodActor* actor, sectortype*) // 22
|
|||
burstactor->spr.pal = actor->spr.pal;
|
||||
burstactor->clipdist = actor->clipdist * 0.25;
|
||||
burstactor->spr.flags = actor->spr.flags;
|
||||
burstactor->spr.xrepeat = actor->spr.xrepeat / 2;
|
||||
burstactor->spr.yrepeat = actor->spr.yrepeat / 2;
|
||||
burstactor->spr.CopyScale(&actor->spr);
|
||||
burstactor->spr.MultScaleX(0.5);
|
||||
burstactor->spr.MultScaleY(0.5);
|
||||
|
||||
burstactor->spr.angle = actor->spr.angle + mapangle(missileInfo[actor->spr.type - kMissileBase].angleOfs);
|
||||
burstactor->SetOwner(actor);
|
||||
|
||||
|
@ -9349,8 +9349,7 @@ FSerializer& Serialize(FSerializer& arc, const char* keyname, SPRITEMASS& w, SPR
|
|||
{
|
||||
arc("seq", w.seqId, &nul.seqId)
|
||||
("picnum", w.picnum, &nul.picnum)
|
||||
("scalex", w.scalex, &nul.scalex)
|
||||
("scaley", w.scaley, &nul.scaley)
|
||||
("scale", w.scale, &nul.scale)
|
||||
("clipdist", w.clipDist)
|
||||
("mass", w.mass)
|
||||
("airvel", w.airVel)
|
||||
|
|
|
@ -194,8 +194,7 @@ enum {
|
|||
struct SPRITEMASS { // sprite mass info for getSpriteMassBySize();
|
||||
int seqId;
|
||||
int16_t picnum; // mainly needs for moving debris
|
||||
int16_t scalex;
|
||||
int16_t scaley;
|
||||
DVector2 scale;
|
||||
int16_t airVel; // mainly needs for moving debris
|
||||
double clipDist; // mass multiplier
|
||||
int mass;
|
||||
|
|
|
@ -245,7 +245,7 @@ void UpdateSprite(DBloodActor* actor, SEQFRAME* pFrame)
|
|||
if (actor->spr.flags & 2)
|
||||
{
|
||||
if (tileHeight(actor->spr.picnum) != tileHeight(seqGetTile(pFrame)) || tileTopOffset(actor->spr.picnum) != tileTopOffset(seqGetTile(pFrame))
|
||||
|| (pFrame->scaley && pFrame->scaley != actor->spr.yrepeat))
|
||||
|| (pFrame->scaley && pFrame->scaley != int(actor->spr.ScaleY() / REPEAT_SCALE)))
|
||||
actor->spr.flags |= 4;
|
||||
}
|
||||
actor->spr.picnum = seqGetTile(pFrame);
|
||||
|
@ -254,14 +254,19 @@ void UpdateSprite(DBloodActor* actor, SEQFRAME* pFrame)
|
|||
actor->spr.shade = pFrame->shade;
|
||||
|
||||
int scale = actor->xspr.scale; // SEQ size scaling
|
||||
if (pFrame->scalex) {
|
||||
if (scale) actor->spr.xrepeat = ClipRange(MulScale(pFrame->scalex, scale, 8), 0, 255);
|
||||
else actor->spr.xrepeat = pFrame->scalex;
|
||||
if (pFrame->scalex)
|
||||
{
|
||||
int s;
|
||||
if (scale) s = ClipRange(MulScale(pFrame->scalex, scale, 8), 0, 255);
|
||||
else s = pFrame->scalex;
|
||||
actor->spr.SetScaleX(s * REPEAT_SCALE);
|
||||
}
|
||||
|
||||
if (pFrame->scaley) {
|
||||
if (scale) actor->spr.yrepeat = ClipRange(MulScale(pFrame->scaley, scale, 8), 0, 255);
|
||||
else actor->spr.yrepeat = pFrame->scaley;
|
||||
int s;
|
||||
if (scale) s = ClipRange(MulScale(pFrame->scaley, scale, 8), 0, 255);
|
||||
else s = pFrame->scaley;
|
||||
actor->spr.SetScaleY(s * REPEAT_SCALE);
|
||||
}
|
||||
|
||||
if (pFrame->transparent)
|
||||
|
|
Loading…
Reference in a new issue