- 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); dy = SinScale16(pSprite->ang);
dx = CosScale16(pSprite->ang); dx = CosScale16(pSprite->ang);
gVectorData[kVectorTchernobogBurn].maxDist = pXSprite->data1 << 9; 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; break;
} }
@ -6889,44 +6889,56 @@ bool actCheckRespawn(DBloodActor* actor)
return 0; return 0;
} }
//---------------------------------------------------------------------------
//
//
//
//---------------------------------------------------------------------------
bool actCanSplatWall(int nWall) bool actCanSplatWall(int nWall)
{ {
assert(nWall >= 0 && nWall < kMaxWalls); assert(nWall >= 0 && nWall < kMaxWalls);
walltype* pWall = &wall[nWall]; walltype* pWall = &wall[nWall];
if (pWall->cstat & 16384) if (pWall->cstat & 16384) return 0;
return 0; if (pWall->cstat & 32768) return 0;
if (pWall->cstat & 32768)
return 0;
int nType = GetWallType(nWall); int nType = GetWallType(nWall);
if (nType >= kWallBase && nType < kWallMax) if (nType >= kWallBase && nType < kWallMax) return 0;
return 0;
if (pWall->nextsector != -1) if (pWall->nextsector != -1)
{ {
sectortype* pSector = &sector[pWall->nextsector]; sectortype* pSector = &sector[pWall->nextsector];
if (pSector->type >= kSectorBase && pSector->type < kSectorMax) if (pSector->type >= kSectorBase && pSector->type < kSectorMax) return 0;
return 0;
} }
return 1; 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); assert(vectorType >= 0 && vectorType < kVectorMax);
const VECTORDATA* pVectorData = &gVectorData[vectorType]; const VECTORDATA* pVectorData = &gVectorData[vectorType];
int nRange = pVectorData->maxDist; int nRange = pVectorData->maxDist;
int hit = VectorScan(pShooter, a2, a3, a4, a5, a6, nRange, 1); int hit = VectorScan(pShooter, a2, a3, a4, a5, a6, nRange, 1);
if (hit == 3) if (hit == 3)
{ {
int nSprite = gHitInfo.hitsprite; int nSprite_ = gHitInfo.hitsprite;
assert(nSprite >= 0 && nSprite < kMaxSprites); assert(nSprite_ >= 0 && nSprite_ < kMaxSprites);
spritetype *pSprite = &sprite[nSprite]; auto actor = &bloodActors[nSprite_];
spritetype* pSprite = &actor->s();
if (!gGameOptions.bFriendlyFire && IsTargetTeammate(pShooter, pSprite)) return; if (!gGameOptions.bFriendlyFire && IsTargetTeammate(pShooter, pSprite)) return;
if (IsPlayerSprite(pSprite)) { if (IsPlayerSprite(pSprite))
{
PLAYER* pPlayer = &gPlayer[pSprite->type - kDudePlayer1]; PLAYER* pPlayer = &gPlayer[pSprite->type - kDudePlayer1];
if (powerupCheck(pPlayer, kPwUpReflectShots)) if (powerupCheck(pPlayer, kPwUpReflectShots))
{ {
gHitInfo.hitsprite = nShooter; gHitInfo.hitsprite = pShooter->index;
gHitInfo.hitx = pShooter->x; gHitInfo.hitx = pShooter->x;
gHitInfo.hity = pShooter->y; gHitInfo.hity = pShooter->y;
gHitInfo.hitz = pShooter->z; gHitInfo.hitz = pShooter->z;
@ -6974,11 +6986,11 @@ void actFireVector(spritetype *pShooter, int a2, int a3, int a4, int a5, int a6,
assert(nSurf < kSurfMax); assert(nSurf < kSurfMax);
if (pVectorData->surfHit[nSurf].fx1 >= 0) 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) if (pFX)
{ {
pFX->ang = (GetWallAngle(nWall)+512)&2047; pFX->s().ang = (GetWallAngle(nWall) + 512) & 2047;
pFX->cstat |= 16; pFX->s().cstat |= 16;
} }
} }
} }
@ -7001,48 +7013,44 @@ void actFireVector(spritetype *pShooter, int a2, int a3, int a4, int a5, int a6,
case 3: case 3:
{ {
int nSprite = gHitInfo.hitsprite; int nSprite = gHitInfo.hitsprite;
nSurf = surfType[sprite[nSprite].picnum];
assert(nSprite >= 0 && nSprite < kMaxSprites); 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); x -= MulScale(a4, 112, 14);
y -= MulScale(a5, 112, 14); y -= MulScale(a5, 112, 14);
z -= MulScale(a6, 112 << 4, 14); z -= MulScale(a6, 112 << 4, 14);
int shift = 4; int shift = 4;
if (vectorType == kVectorTine && !IsPlayerSprite(pSprite)) if (vectorType == kVectorTine && !actor->IsPlayerActor()) shift = 3;
shift = 3;
actDamageSprite(nShooter, pSprite, pVectorData->dmgType, pVectorData->dmg<<shift); actDamageSprite(shooter, actor, pVectorData->dmgType, pVectorData->dmg << shift);
int nXSprite = pSprite->extra; if (actor->hasX() && actor->x().Vector) trTriggerSprite(actor, kCmdSpriteImpact);
if (nXSprite > 0)
{
XSPRITE *pXSprite = &xsprite[nXSprite];
if (pXSprite->Vector)
trTriggerSprite(nSprite, pXSprite, kCmdSpriteImpact);
}
if (pSprite->statnum == kStatThing) if (pSprite->statnum == kStatThing)
{ {
int t = thingInfo[pSprite->type - kThingBase].mass; int t = thingInfo[pSprite->type - kThingBase].mass;
if (t > 0 && pVectorData->impulse) if (t > 0 && pVectorData->impulse)
{ {
int t2 = DivScale(pVectorData->impulse, t, 8); int t2 = DivScale(pVectorData->impulse, t, 8);
xvel[nSprite] += MulScale(a4, t2, 16); actor->xvel() += MulScale(a4, t2, 16);
yvel[nSprite] += MulScale(a5, t2, 16); actor->yvel() += MulScale(a5, t2, 16);
zvel[nSprite] += MulScale(a6, t2, 16); actor->zvel() += MulScale(a6, t2, 16);
} }
if (pVectorData->burnTime) if (pVectorData->burnTime)
{ {
XSPRITE *pXSprite = &xsprite[nXSprite]; if (!actor->x().burnTime) evPost(actor, 0, kCallbackFXFlameLick);
if (!pXSprite->burnTime) actBurnSprite(shooter->GetOwner(), actor, pVectorData->burnTime);
evPost(nSprite, 3, 0, kCallbackFXFlameLick);
actBurnSprite(sprite[nShooter].owner, pXSprite, pVectorData->burnTime);
} }
} }
if (pSprite->statnum == kStatDude) if (pSprite->statnum == kStatDude && actor->hasX())
{ {
int t = getDudeInfo(pSprite->type)->mass; int t = getDudeInfo(pSprite->type)->mass;
#ifdef NOONE_EXTENSIONS #ifdef NOONE_EXTENSIONS
if (IsDudeSprite(pSprite)) { if (actor->IsDudeActor())
switch (pSprite->type) { {
switch (pSprite->type)
{
case kDudeModernCustom: case kDudeModernCustom:
case kDudeModernCustomBurning: case kDudeModernCustomBurning:
t = getSpriteMassBySize(pSprite); t = getSpriteMassBySize(pSprite);
@ -7054,16 +7062,14 @@ void actFireVector(spritetype *pShooter, int a2, int a3, int a4, int a5, int a6,
if (t > 0 && pVectorData->impulse) if (t > 0 && pVectorData->impulse)
{ {
int t2 = DivScale(pVectorData->impulse, t, 8); int t2 = DivScale(pVectorData->impulse, t, 8);
xvel[nSprite] += MulScale(a4, t2, 16); actor->xvel() += MulScale(a4, t2, 16);
yvel[nSprite] += MulScale(a5, t2, 16); actor->yvel() += MulScale(a5, t2, 16);
zvel[nSprite] += MulScale(a6, t2, 16); actor->zvel() += MulScale(a6, t2, 16);
} }
if (pVectorData->burnTime) if (pVectorData->burnTime)
{ {
XSPRITE *pXSprite = &xsprite[nXSprite]; if (!actor->x().burnTime) evPost(actor, 0, kCallbackFXFlameLick);
if (!pXSprite->burnTime) actBurnSprite(shooter->GetOwner(), actor, pVectorData->burnTime);
evPost(nSprite, 3, 0, kCallbackFXFlameLick);
actBurnSprite(sprite[nShooter].owner, pXSprite, pVectorData->burnTime);
} }
if (Chance(pVectorData->fxChance)) if (Chance(pVectorData->fxChance))
{ {
@ -7086,16 +7092,15 @@ void actFireVector(spritetype *pShooter, int a2, int a3, int a4, int a5, int a6,
const VECTORDATA* pVectorData = &gVectorData[19]; const VECTORDATA* pVectorData = &gVectorData[19];
FX_ID t2 = pVectorData->surfHit[nSurf].fx2; FX_ID t2 = pVectorData->surfHit[nSurf].fx2;
FX_ID t3 = pVectorData->surfHit[nSurf].fx3; FX_ID t3 = pVectorData->surfHit[nSurf].fx3;
spritetype *pFX = NULL;
if (t2 > FX_NONE && (t3 == FX_NONE || Chance(0x4000))) DBloodActor* pFX = nullptr;
pFX = gFX.fxSpawn(t2, nSector, x, y, z, 0); if (t2 > FX_NONE && (t3 == FX_NONE || Chance(0x4000))) pFX = gFX.fxSpawnActor(t2, nSector, x, y, z, 0);
else if(t3 > FX_NONE) else if (t3 > FX_NONE) pFX = gFX.fxSpawnActor(t3, nSector, x, y, z, 0);
pFX = gFX.fxSpawn(t3, nSector, x, y, z, 0);
if (pFX) if (pFX)
{ {
zvel[pFX->index] = 0x2222; pFX->zvel() = 0x2222;
pFX->ang = (GetWallAngle(nWall)+512)&2047; pFX->s().ang = (GetWallAngle(nWall) + 512) & 2047;
pFX->cstat |= 16; pFX->s().cstat |= 16;
} }
} }
} }
@ -7107,11 +7112,12 @@ void actFireVector(spritetype *pShooter, int a2, int a3, int a4, int a5, int a6,
} }
#ifdef NOONE_EXTENSIONS #ifdef NOONE_EXTENSIONS
// add impulse for sprites from physics list // add impulse for sprites from physics list
if (gPhysSpritesCount > 0 && pVectorData->impulse) { if (gPhysSpritesCount > 0 && pVectorData->impulse)
{
if (xspriRangeIsFine(pSprite->extra)) { if (actor->hasX())
{
XSPRITE* pXSprite = &xsprite[pSprite->extra]; XSPRITE* pXSprite = &actor->x();
if (pXSprite->physAttr & kPhysDebrisVector) { if (pXSprite->physAttr & kPhysDebrisVector) {
int impulse = DivScale(pVectorData->impulse, ClipLow(gSpriteMass[pSprite->extra].mass, 10), 6); 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); zvel[nSprite] += MulScale(a6, impulse, 16);
if (pVectorData->burnTime != 0) { if (pVectorData->burnTime != 0) {
if (!xsprite[nXSprite].burnTime) evPost(nSprite, 3, 0, kCallbackFXFlameLick); if (!pXSprite->burnTime) evPost(nSprite, 3, 0, kCallbackFXFlameLick);
actBurnSprite(sprite[nShooter].owner, &xsprite[nXSprite], pVectorData->burnTime); actBurnSprite(shooter->GetOwner(), actor, pVectorData->burnTime);
} }
if (pSprite->type >= kThingBase && pSprite->type < kThingMax) { if (pSprite->type >= kThingBase && pSprite->type < kThingMax) {
pSprite->statnum = kStatThing; // temporary change statnum property 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 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); sfxPlay3DSound(x, y, z, pVectorData->surfHit[nSurf].fxSnd, nSector);
} }
//---------------------------------------------------------------------------
//
//
//
//---------------------------------------------------------------------------
void FireballSeqCallback(int, DBloodActor* actor) void FireballSeqCallback(int, DBloodActor* actor)
{ {
XSPRITE* pXSprite = &actor->x(); 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); int actGetRespawnTime(DBloodActor *pSprite);
bool actCheckRespawn(DBloodActor *pSprite); bool actCheckRespawn(DBloodActor *pSprite);
bool actCanSplatWall(int nWall); 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(int nSprite, int nStatus);
void actPostSprite(DBloodActor* actor, int status); void actPostSprite(DBloodActor* actor, int status);
void actPostProcess(void); void actPostProcess(void);

View file

@ -75,7 +75,7 @@ void batBiteSeqCallback(int, DBloodActor* actor)
int height = (pSprite->yrepeat*pDudeInfo->eyeHeight)<<2; int height = (pSprite->yrepeat*pDudeInfo->eyeHeight)<<2;
int height2 = (pTarget->yrepeat*pDudeInfoT->eyeHeight)<<2; int height2 = (pTarget->yrepeat*pDudeInfoT->eyeHeight)<<2;
assert(pXSprite->target >= 0 && pXSprite->target < kMaxSprites); 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) static void batThinkTarget(DBloodActor* actor)

View file

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

View file

@ -86,7 +86,7 @@ void eelBiteSeqCallback(int, DBloodActor* actor)
return; return;
} }
assert(pXSprite->target >= 0 && pXSprite->target < kMaxSprites); 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) static void eelThinkTarget(DBloodActor* actor)

View file

@ -72,7 +72,7 @@ void SeqAttackCallback(int, DBloodActor* actor)
int r1 = Random3(500); int r1 = Random3(500);
int r2 = Random3(1000); int r2 = Random3(1000);
int r3 = 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)) if (Chance(0x8000))
sfxPlay3DSound(pSprite, 10000+Random(5), -1, 0); sfxPlay3DSound(pSprite, 10000+Random(5), -1, 0);

View file

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

View file

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

View file

@ -89,13 +89,13 @@ void SlashFSeqCallback(int, DBloodActor* actor)
int dz = height-height2; int dz = height-height2;
int dx = CosScale16(pSprite->ang); int dx = CosScale16(pSprite->ang);
int dy = SinScale16(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 r1 = Random(50);
int r2 = 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); r1 = Random(50);
r2 = 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) void ThrowFSeqCallback(int, DBloodActor* actor)

View file

@ -74,13 +74,13 @@ void ghostSlashSeqCallback(int, DBloodActor* actor)
int dx = CosScale16(pSprite->ang); int dx = CosScale16(pSprite->ang);
int dy = SinScale16(pSprite->ang); int dy = SinScale16(pSprite->ang);
sfxPlay3DSound(pSprite, 1406, 0, 0); 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 r1 = Random(50);
int r2 = 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); r1 = Random(50);
r2 = 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) void ghostThrowSeqCallback(int, DBloodActor* actor)

View file

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

View file

@ -53,7 +53,7 @@ void HandJumpSeqCallback(int, DBloodActor* actor)
if (!pPlayer->hand) if (!pPlayer->hand)
{ {
pPlayer->hand = 1; 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]; spritetype *pTarget = &sprite[pXSprite->target];
#ifdef NOONE_EXTENSIONS #ifdef NOONE_EXTENSIONS
if (IsPlayerSprite(pTarget) || gModernMap) // allow to hit non-player targets 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 #else
if (IsPlayerSprite(pTarget)) 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 #endif
} }

View file

@ -52,7 +52,7 @@ void ratBiteSeqCallback(int, DBloodActor* actor)
assert(pXSprite->target >= 0 && pXSprite->target < kMaxSprites); assert(pXSprite->target >= 0 && pXSprite->target < kMaxSprites);
spritetype *pTarget = &sprite[pXSprite->target]; spritetype *pTarget = &sprite[pXSprite->target];
if (IsPlayerSprite(pTarget)) 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) static void ratThinkSearch(DBloodActor* actor)

View file

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

View file

@ -199,7 +199,7 @@ void punchCallback(int, DBloodActor* actor)
if (!playGenDudeSound(pSprite, kGenDudeSndAttackMelee)) if (!playGenDudeSound(pSprite, kGenDudeSndAttackMelee))
sfxPlay3DSound(pSprite, 530, 1, 0); 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); 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)) if (!playGenDudeSound(pSprite, kGenDudeSndAttackNormal))
sfxPlayVectorSound(pSprite, pExtra->curWeapon); sfxPlayVectorSound(pSprite, pExtra->curWeapon);

View file

@ -75,7 +75,7 @@ void HackSeqCallback(int, DBloodActor* actor)
int dx = CosScale16(nAngle); int dx = CosScale16(nAngle);
int dy = SinScale16(nAngle); int dy = SinScale16(nAngle);
sfxPlay3DSound(pSprite, 1101, 1, 0); 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) void StandSeqCallback(int, DBloodActor* actor)

View file

@ -57,7 +57,7 @@ void zombfHackSeqCallback(int, DBloodActor* actor)
int height = (pDudeInfo->eyeHeight*pSprite->yrepeat); int height = (pDudeInfo->eyeHeight*pSprite->yrepeat);
DUDEINFO *pDudeInfoT = getDudeInfo(pTarget->type); DUDEINFO *pDudeInfoT = getDudeInfo(pTarget->type);
int height2 = (pDudeInfoT->eyeHeight*pTarget->yrepeat); 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) void PukeSeqCallback(int, DBloodActor* actor)

View file

@ -2109,6 +2109,7 @@ int UseAmmo(PLAYER *pPlayer, int nAmmoType, int nDec)
void voodooTarget(PLAYER *pPlayer) void voodooTarget(PLAYER *pPlayer)
{ {
auto actor = &bloodActors[pPlayer->pSprite->index];
int v4 = pPlayer->aim.dz; int v4 = pPlayer->aim.dz;
int dz = pPlayer->zWeapon-pPlayer->pSprite->z; int dz = pPlayer->zWeapon-pPlayer->pSprite->z;
if (UseAmmo(pPlayer, 9, 0) < 8) if (UseAmmo(pPlayer, 9, 0) < 8)
@ -2119,9 +2120,9 @@ void voodooTarget(PLAYER *pPlayer)
for (int i = 0; i < 4; i++) for (int i = 0; i < 4; i++)
{ {
int ang1 = (pPlayer->voodooVar1+pPlayer->vodooVar2)&2047; 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; 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); 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 dx = CosScale16(pSprite->ang)+Random2(1000);
int dy = SinScale16(pSprite->ang)+Random2(1000); int dy = SinScale16(pSprite->ang)+Random2(1000);
int dz = 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); sfxPlay3DSound(pSprite, 359, -1, 0);
} }
} }

View file

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