From adb3cb888ec5520fab60bb1226c5f8445b91437f Mon Sep 17 00:00:00 2001 From: Christoph Oelckers Date: Thu, 6 Oct 2022 00:04:37 +0200 Subject: [PATCH] - manual repeats in Blood. --- source/core/maploader.cpp | 15 +++++++++------ source/games/blood/src/actor.cpp | 15 ++++++--------- source/games/blood/src/aiunicult.cpp | 2 +- source/games/blood/src/animatesprite.cpp | 18 ++++++++---------- source/games/blood/src/db.cpp | 3 +-- 5 files changed, 25 insertions(+), 28 deletions(-) diff --git a/source/core/maploader.cpp b/source/core/maploader.cpp index 6d2a58559..dc54328e9 100644 --- a/source/core/maploader.cpp +++ b/source/core/maploader.cpp @@ -307,8 +307,9 @@ static void ReadSpriteV7(FileReader& fr, spritetype& spr, int& secno) spr.pal = fr.ReadUInt8(); spr.clipdist = fr.ReadUInt8(); spr.blend = fr.ReadUInt8(); - spr.xrepeat = fr.ReadUInt8(); - spr.yrepeat = fr.ReadUInt8(); + x = fr.ReadUInt8(); + y = fr.ReadUInt8(); + spr.SetScale(x * REPEAT_SCALE, y * REPEAT_SCALE); spr.xoffset = fr.ReadInt8(); spr.yoffset = fr.ReadInt8(); secno = fr.ReadInt16(); @@ -335,8 +336,9 @@ static void ReadSpriteV6(FileReader& fr, spritetype& spr, int& secno) spr.shade = fr.ReadInt8(); spr.pal = fr.ReadUInt8(); spr.clipdist = fr.ReadUInt8(); - spr.xrepeat = fr.ReadUInt8(); - spr.yrepeat = fr.ReadUInt8(); + x = fr.ReadUInt8(); + y = fr.ReadUInt8(); + spr.SetScale(x * REPEAT_SCALE, y * REPEAT_SCALE); spr.xoffset = fr.ReadInt8(); spr.yoffset = fr.ReadInt8(); spr.picnum = fr.ReadInt16(); @@ -365,8 +367,9 @@ static void ReadSpriteV5(FileReader& fr, spritetype& spr, int& secno) spr.SetMapPos(x, y, z); spr.cstat = ESpriteFlags::FromInt(fr.ReadUInt16()); spr.shade = fr.ReadInt8(); - spr.xrepeat = fr.ReadUInt8(); - spr.yrepeat = fr.ReadUInt8(); + x = fr.ReadUInt8(); + y = fr.ReadUInt8(); + spr.SetScale(x * REPEAT_SCALE, y * REPEAT_SCALE); spr.picnum = fr.ReadInt16(); spr.intangle = fr.ReadInt16(); spr.angle = mapangle(spr.intangle); diff --git a/source/games/blood/src/actor.cpp b/source/games/blood/src/actor.cpp index f6b890fd7..44547e1cd 100644 --- a/source/games/blood/src/actor.cpp +++ b/source/games/blood/src/actor.cpp @@ -2746,8 +2746,7 @@ static DBloodActor* actDropAmmo(DBloodActor* actor, int nType) act2->spr.type = nType; act2->spr.picnum = pAmmo->picnum; act2->spr.shade = pAmmo->shade; - act2->spr.xrepeat = pAmmo->xrepeat; - act2->spr.yrepeat = pAmmo->yrepeat; + act2->spr.SetScale(pAmmo->xrepeat * REPEAT_SCALE, pAmmo->yrepeat * REPEAT_SCALE); return act2; } return nullptr; @@ -2763,8 +2762,7 @@ static DBloodActor* actDropWeapon(DBloodActor* actor, int nType) act2->spr.type = nType; act2->spr.picnum = pWeapon->picnum; act2->spr.shade = pWeapon->shade; - act2->spr.xrepeat = pWeapon->xrepeat; - act2->spr.yrepeat = pWeapon->yrepeat; + act2->spr.SetScale(pWeapon->xrepeat * REPEAT_SCALE, pWeapon->yrepeat * REPEAT_SCALE); return act2; } return nullptr; @@ -2780,8 +2778,7 @@ static DBloodActor* actDropItem(DBloodActor* actor, int nType) act2->spr.type = nType; act2->spr.picnum = pItem->picnum; act2->spr.shade = pItem->shade; - act2->spr.xrepeat = pItem->xrepeat; - act2->spr.yrepeat = pItem->yrepeat; + act2->spr.SetScale(pItem->xrepeat * REPEAT_SCALE, pItem->yrepeat * REPEAT_SCALE); return act2; } return nullptr; @@ -5454,7 +5451,7 @@ void actExplodeSprite(DBloodActor* actor) } actor->ZeroVelocity(); actPostSprite(actor, kStatExplosion); - actor->spr.xrepeat = actor->spr.yrepeat = explodeInfo[nType].repeat; + actor->spr.SetScale(explodeInfo[nType].repeat * REPEAT_SCALE, explodeInfo[nType].repeat* REPEAT_SCALE); actor->spr.flags &= ~3; actor->spr.type = nType; @@ -6467,8 +6464,8 @@ DBloodActor* actFireMissile(DBloodActor* actor, double xyoff, double zoff, DVect spawned->spr.pal = 0; spawned->clipdist = pMissileInfo->fClipDist(); spawned->spr.flags = 1; - spawned->spr.xrepeat = pMissileInfo->xrepeat; - spawned->spr.yrepeat = pMissileInfo->yrepeat; + + spawned->spr.SetScale(pMissileInfo->xrepeat * REPEAT_SCALE, pMissileInfo->yrepeat * REPEAT_SCALE); spawned->spr.picnum = pMissileInfo->picnum; spawned->spr.angle = actor->spr.angle += mapangle(pMissileInfo->angleOfs); spawned->vel = dv * pMissileInfo->fVelocity(); diff --git a/source/games/blood/src/aiunicult.cpp b/source/games/blood/src/aiunicult.cpp index f89759b3b..88f67a9ec 100644 --- a/source/games/blood/src/aiunicult.cpp +++ b/source/games/blood/src/aiunicult.cpp @@ -1838,7 +1838,7 @@ bool doExplosion(DBloodActor* actor, int nType) actExplosion->SetOwner(actor); actExplosion->spr.shade = -127; - actExplosion->spr.yrepeat = actExplosion->spr.xrepeat = pExpl->repeat; + actExplosion->spr.SetScale(pExpl->repeat * REPEAT_SCALE, pExpl->repeat * REPEAT_SCALE); actExplosion->xspr.data1 = pExpl->ticks; actExplosion->xspr.data2 = pExpl->quakeEffect; diff --git a/source/games/blood/src/animatesprite.cpp b/source/games/blood/src/animatesprite.cpp index c6ef9c51f..38b919ff7 100644 --- a/source/games/blood/src/animatesprite.cpp +++ b/source/games/blood/src/animatesprite.cpp @@ -45,6 +45,9 @@ BEGIN_BLD_NS static DAngle gCameraAng; DAngle random_angles[16][3]; +// to allow quick replacement later +#define COPY_SCALE pNSprite->xrepeat = pTSprite->xrepeat; pNSprite->yrepeat = pTSprite->yrepeat; + //--------------------------------------------------------------------------- // // @@ -194,8 +197,7 @@ static tspritetype* viewAddEffect(tspriteArray& tsprites, int nTSprite, VIEW_EFF pNSprite->pos.Z = pTSprite->pos.Z; pNSprite->cstat |= CSTAT_SPRITE_TRANSLUCENT; pNSprite->shade = -128; - pNSprite->xrepeat = pTSprite->xrepeat; - pNSprite->yrepeat = pTSprite->yrepeat; + COPY_SCALE; pNSprite->picnum = 2135; break; } @@ -272,8 +274,7 @@ static tspritetype* viewAddEffect(tspriteArray& tsprites, int nTSprite, VIEW_EFF if (i < 2) pNSprite->cstat |= CSTAT_SPRITE_TRANSLUCENT | CSTAT_SPRITE_TRANS_FLIP; pNSprite->shade = ClipLow(pTSprite->shade - 16, -128); - pNSprite->xrepeat = pTSprite->xrepeat; - pNSprite->yrepeat = pTSprite->yrepeat; + COPY_SCALE; pNSprite->picnum = pTSprite->picnum; } break; @@ -307,8 +308,7 @@ static tspritetype* viewAddEffect(tspriteArray& tsprites, int nTSprite, VIEW_EFF pNSprite->picnum = 754; pNSprite->cstat |= CSTAT_SPRITE_TRANSLUCENT; pNSprite->shade = 8; - pNSprite->xrepeat = pTSprite->xrepeat; - pNSprite->yrepeat = pTSprite->yrepeat; + COPY_SCALE; break; } case kViewEffectSmokeLow: @@ -326,8 +326,7 @@ static tspritetype* viewAddEffect(tspriteArray& tsprites, int nTSprite, VIEW_EFF pNSprite->picnum = 754; pNSprite->cstat |= CSTAT_SPRITE_TRANSLUCENT; pNSprite->shade = 8; - pNSprite->xrepeat = pTSprite->xrepeat; - pNSprite->yrepeat = pTSprite->yrepeat; + COPY_SCALE; break; } case kViewEffectTorchHigh: @@ -407,8 +406,7 @@ static tspritetype* viewAddEffect(tspriteArray& tsprites, int nTSprite, VIEW_EFF pNSprite->pal = 2; pNSprite->cstat |= CSTAT_SPRITE_TRANSLUCENT; pNSprite->pos.Z = pTSprite->pos.Z; - pNSprite->xrepeat = pTSprite->xrepeat; - pNSprite->yrepeat = pTSprite->yrepeat; + COPY_SCALE; pNSprite->picnum = 2427; break; } diff --git a/source/games/blood/src/db.cpp b/source/games/blood/src/db.cpp index a30241723..8926e86dc 100644 --- a/source/games/blood/src/db.cpp +++ b/source/games/blood/src/db.cpp @@ -485,8 +485,7 @@ void dbLoadMap(const char* pPath, DVector3& pos, short* pAngle, sectortype** cur pSprite->extra = LittleShort(load.extra); pSprite->pal = load.pal; pSprite->clipdist = load.clipdist; - pSprite->xrepeat = load.xrepeat; - pSprite->yrepeat = load.yrepeat; + pSprite->SetScale(load.xrepeat * REPEAT_SCALE, load.yrepeat * REPEAT_SCALE); pSprite->xoffset = load.xoffset; pSprite->yoffset = load.yoffset; pSprite->detail = load.detail;