- actFireVector

This commit is contained in:
Christoph Oelckers 2021-08-30 20:28:24 +02:00
parent d6724185b3
commit 663ecc79d1
21 changed files with 155 additions and 136 deletions

View file

@ -6143,7 +6143,7 @@ static void actCheckTraps()
dy = SinScale16(pSprite->ang);
dx = CosScale16(pSprite->ang);
gVectorData[kVectorTchernobogBurn].maxDist = pXSprite->data1 << 9;
actFireVector(pSprite, 0, 0, dx, dy, Random2(0x8888), kVectorTchernobogBurn);
actFireVector(actor, 0, 0, dx, dy, Random2(0x8888), kVectorTchernobogBurn);
}
break;
}
@ -6889,63 +6889,75 @@ bool actCheckRespawn(DBloodActor* actor)
return 0;
}
//---------------------------------------------------------------------------
//
//
//
//---------------------------------------------------------------------------
bool actCanSplatWall(int nWall)
{
assert(nWall >= 0 && nWall < kMaxWalls);
walltype *pWall = &wall[nWall];
if (pWall->cstat & 16384)
return 0;
if (pWall->cstat & 32768)
return 0;
walltype* pWall = &wall[nWall];
if (pWall->cstat & 16384) return 0;
if (pWall->cstat & 32768) return 0;
int nType = GetWallType(nWall);
if (nType >= kWallBase && nType < kWallMax)
return 0;
if (nType >= kWallBase && nType < kWallMax) return 0;
if (pWall->nextsector != -1)
{
sectortype *pSector = &sector[pWall->nextsector];
if (pSector->type >= kSectorBase && pSector->type < kSectorMax)
return 0;
sectortype* pSector = &sector[pWall->nextsector];
if (pSector->type >= kSectorBase && pSector->type < kSectorMax) return 0;
}
return 1;
}
void actFireVector(spritetype *pShooter, int a2, int a3, int a4, int a5, int a6, VECTOR_TYPE vectorType)
//---------------------------------------------------------------------------
//
//
//
//---------------------------------------------------------------------------
void actFireVector(DBloodActor* shooter, int a2, int a3, int a4, int a5, int a6, VECTOR_TYPE vectorType)
{
int nShooter = pShooter->index;
auto pShooter = &shooter->s();
assert(vectorType >= 0 && vectorType < kVectorMax);
const VECTORDATA *pVectorData = &gVectorData[vectorType];
const VECTORDATA* pVectorData = &gVectorData[vectorType];
int nRange = pVectorData->maxDist;
int hit = VectorScan(pShooter, a2, a3, a4, a5, a6, nRange, 1);
if (hit == 3)
{
int nSprite = gHitInfo.hitsprite;
assert(nSprite >= 0 && nSprite < kMaxSprites);
spritetype *pSprite = &sprite[nSprite];
int nSprite_ = gHitInfo.hitsprite;
assert(nSprite_ >= 0 && nSprite_ < kMaxSprites);
auto actor = &bloodActors[nSprite_];
spritetype* pSprite = &actor->s();
if (!gGameOptions.bFriendlyFire && IsTargetTeammate(pShooter, pSprite)) return;
if (IsPlayerSprite(pSprite)) {
PLAYER *pPlayer = &gPlayer[pSprite->type-kDudePlayer1];
if (IsPlayerSprite(pSprite))
{
PLAYER* pPlayer = &gPlayer[pSprite->type - kDudePlayer1];
if (powerupCheck(pPlayer, kPwUpReflectShots))
{
gHitInfo.hitsprite = nShooter;
gHitInfo.hitsprite = pShooter->index;
gHitInfo.hitx = pShooter->x;
gHitInfo.hity = pShooter->y;
gHitInfo.hitz = pShooter->z;
}
}
}
int x = gHitInfo.hitx-MulScale(a4, 16, 14);
int y = gHitInfo.hity-MulScale(a5, 16, 14);
int z = gHitInfo.hitz-MulScale(a6, 256, 14);
int x = gHitInfo.hitx - MulScale(a4, 16, 14);
int y = gHitInfo.hity - MulScale(a5, 16, 14);
int z = gHitInfo.hitz - MulScale(a6, 256, 14);
short nSector = gHitInfo.hitsect;
uint8_t nSurf = kSurfNone;
if (nRange == 0 || approxDist(gHitInfo.hitx-pShooter->x, gHitInfo.hity-pShooter->y) < nRange)
if (nRange == 0 || approxDist(gHitInfo.hitx - pShooter->x, gHitInfo.hity - pShooter->y) < nRange)
{
switch (hit)
{
case 1:
{
int nSector = gHitInfo.hitsect;
if (sector[nSector].ceilingstat&1)
if (sector[nSector].ceilingstat & 1)
nSurf = kSurfNone;
else
nSurf = surfType[sector[nSector].ceilingpicnum];
@ -6954,7 +6966,7 @@ void actFireVector(spritetype *pShooter, int a2, int a3, int a4, int a5, int a6,
case 2:
{
int nSector = gHitInfo.hitsect;
if (sector[nSector].floorstat&1)
if (sector[nSector].floorstat & 1)
nSurf = kSurfNone;
else
nSurf = surfType[sector[nSector].floorpicnum];
@ -6967,18 +6979,18 @@ void actFireVector(spritetype *pShooter, int a2, int a3, int a4, int a5, int a6,
nSurf = surfType[wall[nWall].picnum];
if (actCanSplatWall(nWall))
{
int x = gHitInfo.hitx-MulScale(a4, 16, 14);
int y = gHitInfo.hity-MulScale(a5, 16, 14);
int z = gHitInfo.hitz-MulScale(a6, 256, 14);
int x = gHitInfo.hitx - MulScale(a4, 16, 14);
int y = gHitInfo.hity - MulScale(a5, 16, 14);
int z = gHitInfo.hitz - MulScale(a6, 256, 14);
int nSurf = surfType[wall[nWall].picnum];
assert(nSurf < kSurfMax);
if (pVectorData->surfHit[nSurf].fx1 >= 0)
{
spritetype *pFX = gFX.fxSpawn(pVectorData->surfHit[nSurf].fx1, nSector, x, y, z, 0);
auto pFX = gFX.fxSpawnActor(pVectorData->surfHit[nSurf].fx1, nSector, x, y, z, 0);
if (pFX)
{
pFX->ang = (GetWallAngle(nWall)+512)&2047;
pFX->cstat |= 16;
pFX->s().ang = (GetWallAngle(nWall) + 512) & 2047;
pFX->s().cstat |= 16;
}
}
}
@ -6992,7 +7004,7 @@ void actFireVector(spritetype *pShooter, int a2, int a3, int a4, int a5, int a6,
int nXWall = wall[nWall].extra;
if (nXWall > 0)
{
XWALL *pXWall = &xwall[nXWall];
XWALL* pXWall = &xwall[nXWall];
if (pXWall->triggerVector)
trTriggerWall(nWall, pXWall, kCmdWallImpact);
}
@ -7001,69 +7013,63 @@ void actFireVector(spritetype *pShooter, int a2, int a3, int a4, int a5, int a6,
case 3:
{
int nSprite = gHitInfo.hitsprite;
nSurf = surfType[sprite[nSprite].picnum];
assert(nSprite >= 0 && nSprite < kMaxSprites);
spritetype *pSprite = &sprite[nSprite];
auto actor = &bloodActors[nSprite];
spritetype* pSprite = &actor->s();
nSurf = surfType[pSprite->picnum];
x -= MulScale(a4, 112, 14);
y -= MulScale(a5, 112, 14);
z -= MulScale(a6, 112<<4, 14);
z -= MulScale(a6, 112 << 4, 14);
int shift = 4;
if (vectorType == kVectorTine && !IsPlayerSprite(pSprite))
shift = 3;
actDamageSprite(nShooter, pSprite, pVectorData->dmgType, pVectorData->dmg<<shift);
int nXSprite = pSprite->extra;
if (nXSprite > 0)
{
XSPRITE *pXSprite = &xsprite[nXSprite];
if (pXSprite->Vector)
trTriggerSprite(nSprite, pXSprite, kCmdSpriteImpact);
}
if (vectorType == kVectorTine && !actor->IsPlayerActor()) shift = 3;
actDamageSprite(shooter, actor, pVectorData->dmgType, pVectorData->dmg << shift);
if (actor->hasX() && actor->x().Vector) trTriggerSprite(actor, kCmdSpriteImpact);
if (pSprite->statnum == kStatThing)
{
int t = thingInfo[pSprite->type-kThingBase].mass;
int t = thingInfo[pSprite->type - kThingBase].mass;
if (t > 0 && pVectorData->impulse)
{
int t2 = DivScale(pVectorData->impulse, t, 8);
xvel[nSprite] += MulScale(a4, t2, 16);
yvel[nSprite] += MulScale(a5, t2, 16);
zvel[nSprite] += MulScale(a6, t2, 16);
actor->xvel() += MulScale(a4, t2, 16);
actor->yvel() += MulScale(a5, t2, 16);
actor->zvel() += MulScale(a6, t2, 16);
}
if (pVectorData->burnTime)
{
XSPRITE *pXSprite = &xsprite[nXSprite];
if (!pXSprite->burnTime)
evPost(nSprite, 3, 0, kCallbackFXFlameLick);
actBurnSprite(sprite[nShooter].owner, pXSprite, pVectorData->burnTime);
if (!actor->x().burnTime) evPost(actor, 0, kCallbackFXFlameLick);
actBurnSprite(shooter->GetOwner(), actor, pVectorData->burnTime);
}
}
if (pSprite->statnum == kStatDude)
if (pSprite->statnum == kStatDude && actor->hasX())
{
int t = getDudeInfo(pSprite->type)->mass;
#ifdef NOONE_EXTENSIONS
if (IsDudeSprite(pSprite)) {
switch (pSprite->type) {
#ifdef NOONE_EXTENSIONS
if (actor->IsDudeActor())
{
switch (pSprite->type)
{
case kDudeModernCustom:
case kDudeModernCustomBurning:
t = getSpriteMassBySize(pSprite);
break;
}
}
#endif
#endif
if (t > 0 && pVectorData->impulse)
{
int t2 = DivScale(pVectorData->impulse, t, 8);
xvel[nSprite] += MulScale(a4, t2, 16);
yvel[nSprite] += MulScale(a5, t2, 16);
zvel[nSprite] += MulScale(a6, t2, 16);
actor->xvel() += MulScale(a4, t2, 16);
actor->yvel() += MulScale(a5, t2, 16);
actor->zvel() += MulScale(a6, t2, 16);
}
if (pVectorData->burnTime)
{
XSPRITE *pXSprite = &xsprite[nXSprite];
if (!pXSprite->burnTime)
evPost(nSprite, 3, 0, kCallbackFXFlameLick);
actBurnSprite(sprite[nShooter].owner, pXSprite, pVectorData->burnTime);
if (!actor->x().burnTime) evPost(actor, 0, kCallbackFXFlameLick);
actBurnSprite(shooter->GetOwner(), actor, pVectorData->burnTime);
}
if (Chance(pVectorData->fxChance))
{
@ -7073,7 +7079,7 @@ void actFireVector(spritetype *pShooter, int a2, int a3, int a4, int a5, int a6,
a6 += Random3(4000);
if (HitScan(pSprite, gHitInfo.hitz, a4, a5, a6, CLIPMASK1, t) == 0)
{
if (approxDist(gHitInfo.hitx-pSprite->x, gHitInfo.hity-pSprite->y) <= t)
if (approxDist(gHitInfo.hitx - pSprite->x, gHitInfo.hity - pSprite->y) <= t)
{
int nWall = gHitInfo.hitwall;
int nSector = gHitInfo.hitsect;
@ -7081,21 +7087,20 @@ void actFireVector(spritetype *pShooter, int a2, int a3, int a4, int a5, int a6,
{
int x = gHitInfo.hitx - MulScale(a4, 16, 14);
int y = gHitInfo.hity - MulScale(a5, 16, 14);
int z = gHitInfo.hitz - MulScale(a6, 16<<4, 14);
int z = gHitInfo.hitz - MulScale(a6, 16 << 4, 14);
int nSurf = surfType[wall[nWall].picnum];
const VECTORDATA *pVectorData = &gVectorData[19];
const VECTORDATA* pVectorData = &gVectorData[19];
FX_ID t2 = pVectorData->surfHit[nSurf].fx2;
FX_ID t3 = pVectorData->surfHit[nSurf].fx3;
spritetype *pFX = NULL;
if (t2 > FX_NONE && (t3 == FX_NONE || Chance(0x4000)))
pFX = gFX.fxSpawn(t2, nSector, x, y, z, 0);
else if(t3 > FX_NONE)
pFX = gFX.fxSpawn(t3, nSector, x, y, z, 0);
DBloodActor* pFX = nullptr;
if (t2 > FX_NONE && (t3 == FX_NONE || Chance(0x4000))) pFX = gFX.fxSpawnActor(t2, nSector, x, y, z, 0);
else if (t3 > FX_NONE) pFX = gFX.fxSpawnActor(t3, nSector, x, y, z, 0);
if (pFX)
{
zvel[pFX->index] = 0x2222;
pFX->ang = (GetWallAngle(nWall)+512)&2047;
pFX->cstat |= 16;
pFX->zvel() = 0x2222;
pFX->s().ang = (GetWallAngle(nWall) + 512) & 2047;
pFX->s().cstat |= 16;
}
}
}
@ -7103,15 +7108,16 @@ void actFireVector(spritetype *pShooter, int a2, int a3, int a4, int a5, int a6,
}
for (int i = 0; i < pVectorData->bloodSplats; i++)
if (Chance(pVectorData->splatChance))
fxSpawnBlood(pSprite, pVectorData->dmg<<4);
fxSpawnBlood(pSprite, pVectorData->dmg << 4);
}
#ifdef NOONE_EXTENSIONS
#ifdef NOONE_EXTENSIONS
// add impulse for sprites from physics list
if (gPhysSpritesCount > 0 && pVectorData->impulse) {
if (gPhysSpritesCount > 0 && pVectorData->impulse)
{
if (xspriRangeIsFine(pSprite->extra)) {
XSPRITE* pXSprite = &xsprite[pSprite->extra];
if (actor->hasX())
{
XSPRITE* pXSprite = &actor->x();
if (pXSprite->physAttr & kPhysDebrisVector) {
int impulse = DivScale(pVectorData->impulse, ClipLow(gSpriteMass[pSprite->extra].mass, 10), 6);
@ -7120,13 +7126,13 @@ void actFireVector(spritetype *pShooter, int a2, int a3, int a4, int a5, int a6,
zvel[nSprite] += MulScale(a6, impulse, 16);
if (pVectorData->burnTime != 0) {
if (!xsprite[nXSprite].burnTime) evPost(nSprite, 3, 0, kCallbackFXFlameLick);
actBurnSprite(sprite[nShooter].owner, &xsprite[nXSprite], pVectorData->burnTime);
if (!pXSprite->burnTime) evPost(nSprite, 3, 0, kCallbackFXFlameLick);
actBurnSprite(shooter->GetOwner(), actor, pVectorData->burnTime);
}
if (pSprite->type >= kThingBase && pSprite->type < kThingMax) {
pSprite->statnum = kStatThing; // temporary change statnum property
actDamageSprite(nShooter, pSprite, pVectorData->dmgType, pVectorData->dmg << 4);
actDamageSprite(shooter, actor, pVectorData->dmgType, pVectorData->dmg << 4);
pSprite->statnum = kStatDecoration; // return statnum property back
}
@ -7173,6 +7179,11 @@ void actFireVector(spritetype *pShooter, int a2, int a3, int a4, int a5, int a6,
sfxPlay3DSound(x, y, z, pVectorData->surfHit[nSurf].fxSnd, nSector);
}
//---------------------------------------------------------------------------
//
//
//
//---------------------------------------------------------------------------
void FireballSeqCallback(int, DBloodActor* actor)
{
XSPRITE* pXSprite = &actor->x();

View file

@ -242,7 +242,7 @@ DBloodActor* actFireThing(DBloodActor* pSprite, int a2, int a3, int a4, int thin
int actGetRespawnTime(DBloodActor *pSprite);
bool actCheckRespawn(DBloodActor *pSprite);
bool actCanSplatWall(int nWall);
void actFireVector(spritetype *pShooter, int a2, int a3, int a4, int a5, int a6, VECTOR_TYPE vectorType);
void actFireVector(DBloodActor *pShooter, int a2, int a3, int a4, int a5, int a6, VECTOR_TYPE vectorType);
void actPostSprite(int nSprite, int nStatus);
void actPostSprite(DBloodActor* actor, int status);
void actPostProcess(void);

View file

@ -75,7 +75,7 @@ void batBiteSeqCallback(int, DBloodActor* actor)
int height = (pSprite->yrepeat*pDudeInfo->eyeHeight)<<2;
int height2 = (pTarget->yrepeat*pDudeInfoT->eyeHeight)<<2;
assert(pXSprite->target >= 0 && pXSprite->target < kMaxSprites);
actFireVector(pSprite, 0, 0, dx, dy, height2-height, kVectorBatBite);
actFireVector(actor, 0, 0, dx, dy, height2-height, kVectorBatBite);
}
static void batThinkTarget(DBloodActor* actor)

View file

@ -74,9 +74,9 @@ void SlashSeqCallback(int, DBloodActor* actor)
int dz = pSprite->z-pTarget->z;
dx += Random3(4000-700*gGameOptions.nDifficulty);
dy += Random3(4000-700*gGameOptions.nDifficulty);
actFireVector(pSprite, 0, 0, dx, dy, dz, kVectorGargSlash);
actFireVector(pSprite, 0, 0, dx, dy, dz, kVectorGargSlash);
actFireVector(pSprite, 0, 0, dx, dy, dz, kVectorGargSlash);
actFireVector(actor, 0, 0, dx, dy, dz, kVectorGargSlash);
actFireVector(actor, 0, 0, dx, dy, dz, kVectorGargSlash);
actFireVector(actor, 0, 0, dx, dy, dz, kVectorGargSlash);
sfxPlay3DSound(pSprite, 9012+Random(2), -1, 0);
}

View file

@ -86,7 +86,7 @@ void eelBiteSeqCallback(int, DBloodActor* actor)
return;
}
assert(pXSprite->target >= 0 && pXSprite->target < kMaxSprites);
actFireVector(pSprite, 0, 0, dx, dy, height2-height, kVectorBoneelBite);
actFireVector(actor, 0, 0, dx, dy, height2-height, kVectorBoneelBite);
}
static void eelThinkTarget(DBloodActor* actor)

View file

@ -72,7 +72,7 @@ void SeqAttackCallback(int, DBloodActor* actor)
int r1 = Random3(500);
int r2 = Random3(1000);
int r3 = Random3(1000);
actFireVector(pSprite, 0, 0, dx+r3, dy+r2, dz+r1, kVectorShell);
actFireVector(actor, 0, 0, dx+r3, dy+r2, dz+r1, kVectorShell);
}
if (Chance(0x8000))
sfxPlay3DSound(pSprite, 10000+Random(5), -1, 0);

View file

@ -74,9 +74,9 @@ void cerberusBiteSeqCallback(int, DBloodActor* actor)
}
spritetype *pTarget = &sprite[pXSprite->target];
int dz = pTarget->z-pSprite->z;
actFireVector(pSprite, 350, -100, dx, dy, dz, kVectorCerberusHack);
actFireVector(pSprite, -350, 0, dx, dy, dz, kVectorCerberusHack);
actFireVector(pSprite, 0, 0, dx, dy, dz, kVectorCerberusHack);
actFireVector(actor, 350, -100, dx, dy, dz, kVectorCerberusHack);
actFireVector(actor, -350, 0, dx, dy, dz, kVectorCerberusHack);
actFireVector(actor, 0, 0, dx, dy, dz, kVectorCerberusHack);
}
void cerberusBurnSeqCallback(int, DBloodActor* actor)

View file

@ -83,7 +83,7 @@ void TommySeqCallback(int, DBloodActor* actor)
dx += Random3((5-gGameOptions.nDifficulty)*1000);
dy += Random3((5-gGameOptions.nDifficulty)*1000);
dz += Random3((5-gGameOptions.nDifficulty)*500);
actFireVector(pSprite, 0, 0, dx, dy, dz, kVectorBullet);
actFireVector(actor, 0, 0, dx, dy, dz, kVectorBullet);
sfxPlay3DSound(pSprite, 4001, -1, 0);
}
@ -119,7 +119,7 @@ void ShotSeqCallback(int, DBloodActor* actor)
int r1 = Random3(500);
int r2 = Random3(1000);
int r3 = Random3(1000);
actFireVector(pSprite, 0, 0, dx+r3, dy+r2, dz+r1, kVectorShell);
actFireVector(actor, 0, 0, dx+r3, dy+r2, dz+r1, kVectorShell);
}
if (Chance(0x8000))
sfxPlay3DSound(pSprite, 1001, -1, 0);

View file

@ -89,13 +89,13 @@ void SlashFSeqCallback(int, DBloodActor* actor)
int dz = height-height2;
int dx = CosScale16(pSprite->ang);
int dy = SinScale16(pSprite->ang);
actFireVector(pSprite, 0, 0, dx, dy, dz, kVectorGargSlash);
actFireVector(actor, 0, 0, dx, dy, dz, kVectorGargSlash);
int r1 = Random(50);
int r2 = Random(50);
actFireVector(pSprite, 0, 0, dx+r2, dy-r1, dz, kVectorGargSlash);
actFireVector(actor, 0, 0, dx+r2, dy-r1, dz, kVectorGargSlash);
r1 = Random(50);
r2 = Random(50);
actFireVector(pSprite, 0, 0, dx-r2, dy+r1, dz, kVectorGargSlash);
actFireVector(actor, 0, 0, dx-r2, dy+r1, dz, kVectorGargSlash);
}
void ThrowFSeqCallback(int, DBloodActor* actor)

View file

@ -74,13 +74,13 @@ void ghostSlashSeqCallback(int, DBloodActor* actor)
int dx = CosScale16(pSprite->ang);
int dy = SinScale16(pSprite->ang);
sfxPlay3DSound(pSprite, 1406, 0, 0);
actFireVector(pSprite, 0, 0, dx, dy, dz, kVectorGhost);
actFireVector(actor, 0, 0, dx, dy, dz, kVectorGhost);
int r1 = Random(50);
int r2 = Random(50);
actFireVector(pSprite, 0, 0, dx+r2, dy-r1, dz, kVectorGhost);
actFireVector(actor, 0, 0, dx+r2, dy-r1, dz, kVectorGhost);
r1 = Random(50);
r2 = Random(50);
actFireVector(pSprite, 0, 0, dx-r2, dy+r1, dz, kVectorGhost);
actFireVector(actor, 0, 0, dx-r2, dy+r1, dz, kVectorGhost);
}
void ghostThrowSeqCallback(int, DBloodActor* actor)

View file

@ -68,9 +68,9 @@ void GillBiteSeqCallback(int, DBloodActor* actor)
int dz = pSprite->z-pTarget->z;
dx += Random3(2000);
dy += Random3(2000);
actFireVector(pSprite, 0, 0, dx, dy, dz, kVectorGillBite);
actFireVector(pSprite, 0, 0, dx, dy, dz, kVectorGillBite);
actFireVector(pSprite, 0, 0, dx, dy, dz, kVectorGillBite);
actFireVector(actor, 0, 0, dx, dy, dz, kVectorGillBite);
actFireVector(actor, 0, 0, dx, dy, dz, kVectorGillBite);
actFireVector(actor, 0, 0, dx, dy, dz, kVectorGillBite);
}
static void gillThinkSearch(DBloodActor* actor)

View file

@ -53,7 +53,7 @@ void HandJumpSeqCallback(int, DBloodActor* actor)
if (!pPlayer->hand)
{
pPlayer->hand = 1;
actPostSprite(pSprite->index, kStatFree);
actPostSprite(actor, kStatFree);
}
}
}

View file

@ -63,10 +63,10 @@ void houndBiteSeqCallback(int, DBloodActor* actor)
spritetype *pTarget = &sprite[pXSprite->target];
#ifdef NOONE_EXTENSIONS
if (IsPlayerSprite(pTarget) || gModernMap) // allow to hit non-player targets
actFireVector(pSprite, 0, 0, dx, dy, pTarget->z - pSprite->z, kVectorHoundBite);
actFireVector(actor, 0, 0, dx, dy, pTarget->z - pSprite->z, kVectorHoundBite);
#else
if (IsPlayerSprite(pTarget))
actFireVector(pSprite, 0, 0, dx, dy, pTarget->z - pSprite->z, VECTOR_TYPE_15);
actFireVector(actor, 0, 0, dx, dy, pTarget->z - pSprite->z, kVectorHoundBite);
#endif
}

View file

@ -52,7 +52,7 @@ void ratBiteSeqCallback(int, DBloodActor* actor)
assert(pXSprite->target >= 0 && pXSprite->target < kMaxSprites);
spritetype *pTarget = &sprite[pXSprite->target];
if (IsPlayerSprite(pTarget))
actFireVector(pSprite, 0, 0, dx, dy, pTarget->z-pSprite->z, kVectorRatBite);
actFireVector(actor, 0, 0, dx, dy, pTarget->z-pSprite->z, kVectorRatBite);
}
static void ratThinkSearch(DBloodActor* actor)

View file

@ -84,25 +84,25 @@ void SpidBiteSeqCallback(int, DBloodActor* actor)
PLAYER *pPlayer = &gPlayer[pTarget->type - kDudePlayer1];
switch (pSprite->type) {
case kDudeSpiderBrown:
actFireVector(pSprite, 0, 0, dx, dy, dz, kVectorSpiderBite);
actFireVector(actor, 0, 0, dx, dy, dz, kVectorSpiderBite);
if (IsPlayerSprite(pTarget) && !pPlayer->godMode && powerupCheck(pPlayer, kPwUpDeathMask) <= 0 && Chance(0x4000))
powerupActivate(pPlayer, kPwUpDeliriumShroom);
break;
case kDudeSpiderRed:
actFireVector(pSprite, 0, 0, dx, dy, dz, kVectorSpiderBite);
actFireVector(actor, 0, 0, dx, dy, dz, kVectorSpiderBite);
if (Chance(0x5000)) SpidPoisonPlayer(pXTarget, 4, 16);
break;
case kDudeSpiderBlack:
actFireVector(pSprite, 0, 0, dx, dy, dz, kVectorSpiderBite);
actFireVector(actor, 0, 0, dx, dy, dz, kVectorSpiderBite);
SpidPoisonPlayer(pXTarget, 8, 16);
break;
case kDudeSpiderMother: {
actFireVector(pSprite, 0, 0, dx, dy, dz, kVectorSpiderBite);
actFireVector(actor, 0, 0, dx, dy, dz, kVectorSpiderBite);
dx += Random2(2000);
dy += Random2(2000);
dz += Random2(2000);
actFireVector(pSprite, 0, 0, dx, dy, dz, kVectorSpiderBite);
actFireVector(actor, 0, 0, dx, dy, dz, kVectorSpiderBite);
SpidPoisonPlayer(pXTarget, 8, 16);
break;
}

View file

@ -199,7 +199,7 @@ void punchCallback(int, DBloodActor* actor)
if (!playGenDudeSound(pSprite, kGenDudeSndAttackMelee))
sfxPlay3DSound(pSprite, 530, 1, 0);
actFireVector(pSprite, 0, 0, dx, dy, dz,kVectorGenDudePunch);
actFireVector(actor, 0, 0, dx, dy, dz,kVectorGenDudePunch);
}
}
@ -226,7 +226,7 @@ void genDudeAttack1(int, DBloodActor* actor)
dx += Random3(dispersion); dy += Random3(dispersion); dz += Random3(dispersion);
}
actFireVector(pSprite, 0, 0, dx, dy, dz,(VECTOR_TYPE)pExtra->curWeapon);
actFireVector(actor, 0, 0, dx, dy, dz,(VECTOR_TYPE)pExtra->curWeapon);
if (!playGenDudeSound(pSprite, kGenDudeSndAttackNormal))
sfxPlayVectorSound(pSprite, pExtra->curWeapon);

View file

@ -75,7 +75,7 @@ void HackSeqCallback(int, DBloodActor* actor)
int dx = CosScale16(nAngle);
int dy = SinScale16(nAngle);
sfxPlay3DSound(pSprite, 1101, 1, 0);
actFireVector(pSprite, 0, 0, dx, dy, dz, kVectorAxe);
actFireVector(actor, 0, 0, dx, dy, dz, kVectorAxe);
}
void StandSeqCallback(int, DBloodActor* actor)

View file

@ -57,7 +57,7 @@ void zombfHackSeqCallback(int, DBloodActor* actor)
int height = (pDudeInfo->eyeHeight*pSprite->yrepeat);
DUDEINFO *pDudeInfoT = getDudeInfo(pTarget->type);
int height2 = (pDudeInfoT->eyeHeight*pTarget->yrepeat);
actFireVector(pSprite, 0, 0, CosScale16(pSprite->ang), SinScale16(pSprite->ang), height-height2, kVectorCleaver);
actFireVector(actor, 0, 0, CosScale16(pSprite->ang), SinScale16(pSprite->ang), height-height2, kVectorCleaver);
}
void PukeSeqCallback(int, DBloodActor* actor)

View file

@ -2109,6 +2109,7 @@ int UseAmmo(PLAYER *pPlayer, int nAmmoType, int nDec)
void voodooTarget(PLAYER *pPlayer)
{
auto actor = &bloodActors[pPlayer->pSprite->index];
int v4 = pPlayer->aim.dz;
int dz = pPlayer->zWeapon-pPlayer->pSprite->z;
if (UseAmmo(pPlayer, 9, 0) < 8)
@ -2119,9 +2120,9 @@ void voodooTarget(PLAYER *pPlayer)
for (int i = 0; i < 4; i++)
{
int ang1 = (pPlayer->voodooVar1+pPlayer->vodooVar2)&2047;
actFireVector(pPlayer->pSprite, 0, dz, CosScale16(ang1), SinScale16(ang1), v4, kVectorVoodoo10);
actFireVector(actor, 0, dz, CosScale16(ang1), SinScale16(ang1), v4, kVectorVoodoo10);
int ang2 = (pPlayer->voodooVar1+2048-pPlayer->vodooVar2)&2047;
actFireVector(pPlayer->pSprite, 0, dz, CosScale16(ang2), SinScale16(ang2), v4, kVectorVoodoo10);
actFireVector(actor, 0, dz, CosScale16(ang2), SinScale16(ang2), v4, kVectorVoodoo10);
}
pPlayer->voodooTargets = ClipLow(pPlayer->voodooTargets-1, 0);
}

View file

@ -2275,7 +2275,7 @@ void MGunFireSeqCallback(int, DBloodActor* actor)
int dx = CosScale16(pSprite->ang)+Random2(1000);
int dy = SinScale16(pSprite->ang)+Random2(1000);
int dz = Random2(1000);
actFireVector(pSprite, 0, 0, dx, dy, dz, kVectorBullet);
actFireVector(actor, 0, 0, dx, dy, dz, kVectorBullet);
sfxPlay3DSound(pSprite, 359, -1, 0);
}
}

View file

@ -1058,12 +1058,13 @@ void WeaponUpdateState(PLAYER *pPlayer)
void FirePitchfork(int, PLAYER *pPlayer)
{
auto actor = &bloodActors[pPlayer->pSprite->index];
Aim *aim = &pPlayer->aim;
int r1 = Random2(2000);
int r2 = Random2(2000);
int r3 = Random2(2000);
for (int i = 0; i < 4; i++)
actFireVector(pPlayer->pSprite, (2*i-3)*40, pPlayer->zWeapon-pPlayer->pSprite->z, aim->dx+r1, aim->dy+r2, aim->dz+r3, kVectorTine);
actFireVector(actor, (2*i-3)*40, pPlayer->zWeapon-pPlayer->pSprite->z, aim->dx+r1, aim->dy+r2, aim->dz+r3, kVectorTine);
}
void FireSpray(int, PLAYER *pPlayer)
@ -1198,6 +1199,7 @@ enum { kMaxShotgunBarrels = 4 };
void FireShotgun(int nTrigger, PLAYER *pPlayer)
{
auto actor = &bloodActors[pPlayer->pSprite->index];
assert(nTrigger > 0 && nTrigger <= kMaxShotgunBarrels);
if (nTrigger == 1)
{
@ -1230,7 +1232,7 @@ void FireShotgun(int nTrigger, PLAYER *pPlayer)
r3 = Random3(1500);
nType = kVectorShellAP;
}
actFireVector(pPlayer->pSprite, 0, pPlayer->zWeapon-pPlayer->pSprite->z, pPlayer->aim.dx+r1, pPlayer->aim.dy+r2, pPlayer->aim.dz+r3, nType);
actFireVector(actor, 0, pPlayer->zWeapon-pPlayer->pSprite->z, pPlayer->aim.dx+r1, pPlayer->aim.dy+r2, pPlayer->aim.dz+r3, nType);
}
UseAmmo(pPlayer, pPlayer->weaponAmmo, nTrigger);
pPlayer->flashEffect = 1;
@ -1244,6 +1246,7 @@ void EjectShell(int, PLAYER *pPlayer)
void FireTommy(int nTrigger, PLAYER *pPlayer)
{
auto actor = &bloodActors[pPlayer->pSprite->index];
Aim *aim = &pPlayer->aim;
sfxPlay3DSound(pPlayer->pSprite, 431, -1, 0);
switch (nTrigger)
@ -1253,7 +1256,7 @@ void FireTommy(int nTrigger, PLAYER *pPlayer)
int r1 = Random3(400);
int r2 = Random3(1200);
int r3 = Random3(1200);
actFireVector(pPlayer->pSprite, 0, pPlayer->zWeapon-pPlayer->pSprite->z, aim->dx+r3, aim->dy+r2, aim->dz+r1, kVectorTommyRegular);
actFireVector(actor, 0, pPlayer->zWeapon-pPlayer->pSprite->z, aim->dx+r3, aim->dy+r2, aim->dz+r1, kVectorTommyRegular);
SpawnBulletEject(pPlayer, -15, -45);
pPlayer->visibility = 20;
break;
@ -1263,12 +1266,12 @@ void FireTommy(int nTrigger, PLAYER *pPlayer)
int r1 = Random3(400);
int r2 = Random3(1200);
int r3 = Random3(1200);
actFireVector(pPlayer->pSprite, -120, pPlayer->zWeapon-pPlayer->pSprite->z, aim->dx+r3, aim->dy+r2, aim->dz+r1, kVectorTommyRegular);
actFireVector(actor, -120, pPlayer->zWeapon-pPlayer->pSprite->z, aim->dx+r3, aim->dy+r2, aim->dz+r1, kVectorTommyRegular);
SpawnBulletEject(pPlayer, -140, -45);
r1 = Random3(400);
r2 = Random3(1200);
r3 = Random3(1200);
actFireVector(pPlayer->pSprite, 120, pPlayer->zWeapon-pPlayer->pSprite->z, aim->dx+r3, aim->dy+r2, aim->dz+r1, kVectorTommyRegular);
actFireVector(actor, 120, pPlayer->zWeapon-pPlayer->pSprite->z, aim->dx+r3, aim->dy+r2, aim->dz+r1, kVectorTommyRegular);
SpawnBulletEject(pPlayer, 140, 45);
pPlayer->visibility = 30;
break;
@ -1282,6 +1285,7 @@ enum { kMaxSpread = 14 };
void FireSpread(int nTrigger, PLAYER *pPlayer)
{
auto actor = &bloodActors[pPlayer->pSprite->index];
assert(nTrigger > 0 && nTrigger <= kMaxSpread);
Aim *aim = &pPlayer->aim;
int angle = (getangle(aim->dx, aim->dy)+((112*(nTrigger-1))/14-56))&2047;
@ -1292,7 +1296,7 @@ void FireSpread(int nTrigger, PLAYER *pPlayer)
r1 = Random3(300);
r2 = Random3(600);
r3 = Random3(600);
actFireVector(pPlayer->pSprite, 0, pPlayer->zWeapon-pPlayer->pSprite->z, dx+r3, dy+r2, aim->dz+r1, kVectorTommyAP);
actFireVector(actor, 0, pPlayer->zWeapon-pPlayer->pSprite->z, dx+r3, dy+r2, aim->dz+r1, kVectorTommyAP);
r1 = Random2(90);
r2 = Random2(30);
SpawnBulletEject(pPlayer, r2, r1);
@ -1303,6 +1307,7 @@ void FireSpread(int nTrigger, PLAYER *pPlayer)
void AltFireSpread(int nTrigger, PLAYER *pPlayer)
{
auto actor = &bloodActors[pPlayer->pSprite->index];
assert(nTrigger > 0 && nTrigger <= kMaxSpread);
Aim *aim = &pPlayer->aim;
int angle = (getangle(aim->dx, aim->dy)+((112*(nTrigger-1))/14-56))&2047;
@ -1313,14 +1318,14 @@ void AltFireSpread(int nTrigger, PLAYER *pPlayer)
r1 = Random3(300);
r2 = Random3(600);
r3 = Random3(600);
actFireVector(pPlayer->pSprite, -120, pPlayer->zWeapon-pPlayer->pSprite->z, dx+r3, dy+r2, aim->dz+r1, kVectorTommyAP);
actFireVector(actor, -120, pPlayer->zWeapon-pPlayer->pSprite->z, dx+r3, dy+r2, aim->dz+r1, kVectorTommyAP);
r1 = Random2(45);
r2 = Random2(120);
SpawnBulletEject(pPlayer, r2, r1);
r1 = Random3(300);
r2 = Random3(600);
r3 = Random3(600);
actFireVector(pPlayer->pSprite, 120, pPlayer->zWeapon-pPlayer->pSprite->z, dx+r3, dy+r2, aim->dz+r1, kVectorTommyAP);
actFireVector(actor, 120, pPlayer->zWeapon-pPlayer->pSprite->z, dx+r3, dy+r2, aim->dz+r1, kVectorTommyAP);
r1 = Random2(-45);
r2 = Random2(-120);
SpawnBulletEject(pPlayer, r2, r1);
@ -1332,6 +1337,7 @@ void AltFireSpread(int nTrigger, PLAYER *pPlayer)
void AltFireSpread2(int nTrigger, PLAYER *pPlayer)
{
auto actor = &bloodActors[pPlayer->pSprite->index];
assert(nTrigger > 0 && nTrigger <= kMaxSpread);
Aim *aim = &pPlayer->aim;
int angle = (getangle(aim->dx, aim->dy)+((112*(nTrigger-1))/14-56))&2047;
@ -1344,14 +1350,14 @@ void AltFireSpread2(int nTrigger, PLAYER *pPlayer)
r1 = Random3(300);
r2 = Random3(600);
r3 = Random3(600);
actFireVector(pPlayer->pSprite, -120, pPlayer->zWeapon-pPlayer->pSprite->z, dx+r3, dy+r2, aim->dz+r1, kVectorTommyAP);
actFireVector(actor, -120, pPlayer->zWeapon-pPlayer->pSprite->z, dx+r3, dy+r2, aim->dz+r1, kVectorTommyAP);
r1 = Random2(45);
r2 = Random2(120);
SpawnBulletEject(pPlayer, r2, r1);
r1 = Random3(300);
r2 = Random3(600);
r3 = Random3(600);
actFireVector(pPlayer->pSprite, 120, pPlayer->zWeapon-pPlayer->pSprite->z, dx+r3, dy+r2, aim->dz+r1, kVectorTommyAP);
actFireVector(actor, 120, pPlayer->zWeapon-pPlayer->pSprite->z, dx+r3, dy+r2, aim->dz+r1, kVectorTommyAP);
r1 = Random2(-45);
r2 = Random2(-120);
SpawnBulletEject(pPlayer, r2, r1);
@ -1365,7 +1371,7 @@ void AltFireSpread2(int nTrigger, PLAYER *pPlayer)
r1 = Random3(300);
r2 = Random3(600);
r3 = Random3(600);
actFireVector(pPlayer->pSprite, 0, pPlayer->zWeapon-pPlayer->pSprite->z, dx+r3, dy+r2, aim->dz+r1, kVectorTommyAP);
actFireVector(actor, 0, pPlayer->zWeapon-pPlayer->pSprite->z, dx+r3, dy+r2, aim->dz+r1, kVectorTommyAP);
r1 = Random2(90);
r2 = Random2(30);
SpawnBulletEject(pPlayer, r2, r1);
@ -1733,10 +1739,11 @@ void AltFireLifeLeech(int , PLAYER *pPlayer)
void FireBeast(int , PLAYER * pPlayer)
{
auto actor = &bloodActors[pPlayer->pSprite->index];
int r1 = Random2(2000);
int r2 = Random2(2000);
int r3 = Random2(2000);
actFireVector(pPlayer->pSprite, 0, pPlayer->zWeapon-pPlayer->pSprite->z, pPlayer->aim.dx+r1, pPlayer->aim.dy+r2, pPlayer->aim.dz+r3, kVectorBeastSlash);
actFireVector(actor, 0, pPlayer->zWeapon-pPlayer->pSprite->z, pPlayer->aim.dx+r1, pPlayer->aim.dy+r2, pPlayer->aim.dz+r3, kVectorBeastSlash);
}
uint8_t gWeaponUpgrade[][13] = {