mirror of
https://github.com/ZDoom/Raze.git
synced 2025-02-20 18:42:26 +00:00
- removed remaining direct access to the velocity arrays.
This commit is contained in:
parent
ff9a86b7b4
commit
6a8f59e991
8 changed files with 47 additions and 46 deletions
|
@ -121,9 +121,9 @@ void StartLevel(MapRecord* level, bool newgame)
|
|||
automapping = 1;
|
||||
|
||||
int modernTypesErased = 0;
|
||||
for (int i = 0; i < kMaxSprites; i++)
|
||||
BloodLinearSpriteIterator it;
|
||||
while (auto actor = it.Next())
|
||||
{
|
||||
DBloodActor* actor = &bloodActors[i];
|
||||
spritetype* pSprite = &actor->s();
|
||||
if (pSprite->statnum < kMaxStatus && actor->hasX())
|
||||
{
|
||||
|
@ -133,7 +133,7 @@ void StartLevel(MapRecord* level, bool newgame)
|
|||
|| (pXSprite->lB && gGameOptions.nGameType == 2) || (pXSprite->lT && gGameOptions.nGameType == 3)
|
||||
|| (pXSprite->lC && gGameOptions.nGameType == 1)) {
|
||||
|
||||
DeleteSprite(i);
|
||||
DeleteSprite(actor);
|
||||
continue;
|
||||
}
|
||||
|
||||
|
|
|
@ -200,7 +200,7 @@ void CFX::fxProcess(void)
|
|||
assert(nSector >= 0 && nSector < kMaxSectors);
|
||||
assert(pSprite->type < kFXMax);
|
||||
FXDATA *pFXData = &gFXData[pSprite->type];
|
||||
actAirDrag(&bloodActors[pSprite->index], pFXData->drag);
|
||||
actAirDrag(actor, pFXData->drag);
|
||||
pSprite->x += actor->xvel()>>12;
|
||||
pSprite->y += actor->yvel()>>12;
|
||||
pSprite->z += actor->zvel()>>8;
|
||||
|
|
|
@ -8162,7 +8162,7 @@ void aiPatrolMove(DBloodActor* actor)
|
|||
if (pExtra->flying || spriteIsUnderwater(actor))
|
||||
{
|
||||
goalAng >>= 1;
|
||||
zvel[pSprite->index] = dz;
|
||||
actor->zvel() = dz;
|
||||
if (pSprite->flags & kPhysGravity)
|
||||
pSprite->flags &= ~kPhysGravity;
|
||||
}
|
||||
|
|
|
@ -1273,15 +1273,16 @@ int ActionScan(PLAYER *pPlayer, int *a2, int *a3)
|
|||
return 3;
|
||||
if (sprite[*a2].statnum == kStatDude)
|
||||
{
|
||||
spritetype *pSprite = &sprite[*a2];
|
||||
auto actor = &bloodActors[*a2];
|
||||
spritetype *pSprite = &actor->s();
|
||||
XSPRITE *pXSprite = &xsprite[*a3];
|
||||
int nMass = getDudeInfo(pSprite->type)->mass;
|
||||
if (nMass)
|
||||
{
|
||||
int t2 = DivScale(0xccccc, nMass, 8);
|
||||
xvel[*a2] += MulScale(x, t2, 16);
|
||||
yvel[*a2] += MulScale(y, t2, 16);
|
||||
zvel[*a2] += MulScale(z, t2, 16);
|
||||
actor->xvel() += MulScale(x, t2, 16);
|
||||
actor->yvel() += MulScale(y, t2, 16);
|
||||
actor->zvel() += MulScale(z, t2, 16);
|
||||
}
|
||||
if (pXSprite->Push && !pXSprite->state && !pXSprite->isTriggered)
|
||||
trTriggerSprite(*a2, pXSprite, kCmdSpritePush);
|
||||
|
@ -1356,9 +1357,9 @@ void ProcessInput(PLAYER *pPlayer)
|
|||
pPlayer->horizon.resetadjustment();
|
||||
pPlayer->angle.resetadjustment();
|
||||
|
||||
auto actor = pPlayer->actor();
|
||||
spritetype *pSprite = pPlayer->pSprite;
|
||||
XSPRITE *pXSprite = pPlayer->pXSprite;
|
||||
int nSprite = pPlayer->nSprite;
|
||||
POSTURE *pPosture = &pPlayer->pPosture[pPlayer->lifeMode][pPlayer->posture];
|
||||
InputPacket *pInput = &pPlayer->input;
|
||||
|
||||
|
@ -1419,15 +1420,15 @@ void ProcessInput(PLAYER *pPlayer)
|
|||
forward = MulScale(pPosture->frontAccel, forward, 8);
|
||||
else
|
||||
forward = MulScale(pPosture->backAccel, forward, 8);
|
||||
xvel[nSprite] += MulScale(forward, x, 30);
|
||||
yvel[nSprite] += MulScale(forward, y, 30);
|
||||
actor->xvel() += MulScale(forward, x, 30);
|
||||
actor->yvel() += MulScale(forward, y, 30);
|
||||
}
|
||||
if (pInput->svel)
|
||||
{
|
||||
int strafe = pInput->svel;
|
||||
strafe = MulScale(pPosture->sideAccel, strafe, 8);
|
||||
xvel[nSprite] += MulScale(strafe, y, 30);
|
||||
yvel[nSprite] -= MulScale(strafe, x, 30);
|
||||
actor->xvel() += MulScale(strafe, y, 30);
|
||||
actor->yvel() -= MulScale(strafe, x, 30);
|
||||
}
|
||||
}
|
||||
else if (pXSprite->height < 256)
|
||||
|
@ -1446,8 +1447,8 @@ void ProcessInput(PLAYER *pPlayer)
|
|||
forward = MulScale(pPosture->backAccel, forward, 8);
|
||||
if (pXSprite->height)
|
||||
forward = MulScale(forward, speed, 16);
|
||||
xvel[nSprite] += MulScale(forward, x, 30);
|
||||
yvel[nSprite] += MulScale(forward, y, 30);
|
||||
actor->xvel() += MulScale(forward, x, 30);
|
||||
actor->yvel() += MulScale(forward, y, 30);
|
||||
}
|
||||
if (pInput->svel)
|
||||
{
|
||||
|
@ -1455,8 +1456,8 @@ void ProcessInput(PLAYER *pPlayer)
|
|||
strafe = MulScale(pPosture->sideAccel, strafe, 8);
|
||||
if (pXSprite->height)
|
||||
strafe = MulScale(strafe, speed, 16);
|
||||
xvel[nSprite] += MulScale(strafe, y, 30);
|
||||
yvel[nSprite] -= MulScale(strafe, x, 30);
|
||||
actor->xvel() += MulScale(strafe, y, 30);
|
||||
actor->yvel() -= MulScale(strafe, x, 30);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -1475,9 +1476,9 @@ void ProcessInput(PLAYER *pPlayer)
|
|||
switch (pPlayer->posture) {
|
||||
case 1:
|
||||
if (pInput->actions & SB_JUMP)
|
||||
zvel[nSprite] -= pPosture->normalJumpZ;//0x5b05;
|
||||
actor->zvel() -= pPosture->normalJumpZ;//0x5b05;
|
||||
if (pInput->actions & SB_CROUCH)
|
||||
zvel[nSprite] += pPosture->normalJumpZ;//0x5b05;
|
||||
actor->zvel() += pPosture->normalJumpZ;//0x5b05;
|
||||
break;
|
||||
case 2:
|
||||
if (!(pInput->actions & SB_CROUCH))
|
||||
|
@ -1490,8 +1491,8 @@ void ProcessInput(PLAYER *pPlayer)
|
|||
#endif
|
||||
sfxPlay3DSound(pSprite, 700, 0, 0);
|
||||
|
||||
if (packItemActive(pPlayer, 4)) zvel[nSprite] = pPosture->pwupJumpZ; //-0x175555;
|
||||
else zvel[nSprite] = pPosture->normalJumpZ; //-0xbaaaa;
|
||||
if (packItemActive(pPlayer, 4)) actor->zvel() = pPosture->pwupJumpZ; //-0x175555;
|
||||
else actor->zvel() = pPosture->normalJumpZ; //-0xbaaaa;
|
||||
pPlayer->cantJump = 1;
|
||||
}
|
||||
|
||||
|
@ -1581,9 +1582,9 @@ void ProcessInput(PLAYER *pPlayer)
|
|||
int nSprite = pPlayer->pSprite->index;
|
||||
int x = bcos(pPlayer->pSprite->ang);
|
||||
int y = bsin(pPlayer->pSprite->ang);
|
||||
xvel[pSprite2->index] = xvel[nSprite] + MulScale(0x155555, x, 14);
|
||||
yvel[pSprite2->index] = yvel[nSprite] + MulScale(0x155555, y, 14);
|
||||
zvel[pSprite2->index] = zvel[nSprite];
|
||||
spawned->xvel() = pPlayer->actor()->xvel() + MulScale(0x155555, x, 14);
|
||||
spawned->yvel() = pPlayer->actor()->yvel() + MulScale(0x155555, y, 14);
|
||||
spawned->zvel() = pPlayer->actor()->zvel();
|
||||
pPlayer->hand = 0;
|
||||
}
|
||||
pInput->actions &= ~SB_OPEN;
|
||||
|
@ -1972,7 +1973,7 @@ int playerDamageSprite(DBloodActor* source, PLAYER *pPlayer, DAMAGE_TYPE nDamage
|
|||
int top, bottom;
|
||||
GetSpriteExtents(pSprite, &top, &bottom);
|
||||
CGibPosition gibPos(pSprite->x, pSprite->y, top);
|
||||
CGibVelocity gibVel(xvel[pSprite->index]>>1, yvel[pSprite->index]>>1, -0xccccc);
|
||||
CGibVelocity gibVel(pActor->xvel() >> 1, pActor->yvel() >> 1, -0xccccc);
|
||||
GibSprite(pActor, GIBTYPE_27, &gibPos, &gibVel);
|
||||
GibSprite(pActor, GIBTYPE_7, NULL, NULL);
|
||||
fxSpawnBlood(pActor, nDamage<<4);
|
||||
|
|
|
@ -62,9 +62,9 @@ void viewInitializePrediction(void)
|
|||
predict.z = gMe->pSprite->z;
|
||||
predict.sectnum = gMe->pSprite->sectnum;
|
||||
predict.at73 = gMe->pSprite->flags;
|
||||
predict.xvel = xvel[gMe->pSprite->index];
|
||||
predict.yvel = yvel[gMe->pSprite->index];
|
||||
predict.zvel = zvel[gMe->pSprite->index];
|
||||
predict.xvel = gMe->actor()->xvel();
|
||||
predict.yvel = gMe->actor()->yvel();
|
||||
predict.zvel = gMe->actor()->zvel();
|
||||
predict.floordist = gMe->pXSprite->height;
|
||||
predict.at48 = gMe->posture;
|
||||
predict.spin = gMe->angle.spin;
|
||||
|
|
|
@ -350,7 +350,6 @@ void SEQINST::Update()
|
|||
break;
|
||||
case 3:
|
||||
{
|
||||
|
||||
UpdateSprite(index, &pSequence->frames[frameIndex]);
|
||||
if (pSequence->frames[frameIndex].playsound) {
|
||||
|
||||
|
@ -366,7 +365,8 @@ void SEQINST::Update()
|
|||
|
||||
// by NoOne: add surfaceSound trigger feature
|
||||
spritetype* pSprite = &sprite[xsprite[index].reference];
|
||||
if (!VanillaMode() && pSequence->frames[frameIndex].surfaceSound && zvel[pSprite->index] == 0 && xvel[pSprite->index] != 0) {
|
||||
auto actor = &bloodActors[pSprite->index];
|
||||
if (!VanillaMode() && pSequence->frames[frameIndex].surfaceSound && actor->zvel() == 0 && actor->xvel() != 0) {
|
||||
|
||||
if (gUpperLink[pSprite->sectnum] >= 0) break; // don't play surface sound for stacked sectors
|
||||
int surf = tileGetSurfType(sector[pSprite->sectnum].floorpicnum);
|
||||
|
|
|
@ -89,12 +89,13 @@ void BloodSoundEngine::CalcPosVel(int type, const void* source, const float pt[3
|
|||
}
|
||||
else if (type == SOURCE_Actor)
|
||||
{
|
||||
auto actor = (spritetype*)source;
|
||||
assert(actor != nullptr);
|
||||
size_t index = actor - sprite;
|
||||
auto sprt = (spritetype*)source;
|
||||
assert(sprt != nullptr);
|
||||
auto actor = &bloodActors[sprt->index];
|
||||
|
||||
// Engine expects velocity in units per second, not units per tic.
|
||||
if (vel) *vel = { xvel[index] * (30 / 65536.f), zvel[index] * (-30 / 65536.f), yvel[index] * (-30 / 65536.f) };
|
||||
*pos = GetSoundPos(&actor->pos);
|
||||
if (vel) *vel = { actor->xvel() * (30 / 65536.f), actor->zvel() * (-30 / 65536.f), actor->yvel() * (-30 / 65536.f) };
|
||||
*pos = GetSoundPos(&sprt->pos);
|
||||
}
|
||||
else if (type == SOURCE_Ambient)
|
||||
{
|
||||
|
|
|
@ -363,11 +363,10 @@ void UpdateAimVector(PLAYER * pPlayer)
|
|||
if (autoaim == 1 || (autoaim == 2 && !pWeaponTrack->bIsProjectile) || pPlayer->curWeapon == kWeapVoodooDoll || pPlayer->curWeapon == kWeapLifeLeech)
|
||||
{
|
||||
int nClosest = 0x7fffffff;
|
||||
int nSprite;
|
||||
StatIterator it(kStatDude);
|
||||
while ((nSprite = it.NextIndex()) >= 0)
|
||||
BloodStatIterator it(kStatDude);
|
||||
while (auto actor = it.Next())
|
||||
{
|
||||
pSprite = &sprite[nSprite];
|
||||
pSprite = &actor->s();
|
||||
if (pSprite == pPSprite)
|
||||
continue;
|
||||
if (!gGameOptions.bFriendlyFire && IsTargetTeammate(pPlayer, pSprite))
|
||||
|
@ -384,10 +383,10 @@ void UpdateAimVector(PLAYER * pPlayer)
|
|||
continue;
|
||||
if (pWeaponTrack->seeker)
|
||||
{
|
||||
int t = DivScale(nDist,pWeaponTrack->seeker, 12);
|
||||
x2 += (xvel[nSprite]*t)>>12;
|
||||
y2 += (yvel[nSprite]*t)>>12;
|
||||
z2 += (zvel[nSprite]*t)>>8;
|
||||
int t = DivScale(nDist, pWeaponTrack->seeker, 12);
|
||||
x2 += (actor->xvel() * t) >> 12;
|
||||
y2 += (actor->yvel() * t) >> 12;
|
||||
z2 += (actor->zvel() * t) >> 8;
|
||||
}
|
||||
int lx = x + MulScale(Cos(pPSprite->ang), nDist, 30);
|
||||
int ly = y + MulScale(Sin(pPSprite->ang), nDist, 30);
|
||||
|
@ -401,7 +400,7 @@ void UpdateAimVector(PLAYER * pPlayer)
|
|||
if (abs(((angle-pPSprite->ang+1024)&2047)-1024) > pWeaponTrack->angleRange)
|
||||
continue;
|
||||
if (pPlayer->aimTargetsCount < 16 && cansee(x,y,z,pPSprite->sectnum,x2,y2,z2,pSprite->sectnum))
|
||||
pPlayer->aimTargets[pPlayer->aimTargetsCount++] = nSprite;
|
||||
pPlayer->aimTargets[pPlayer->aimTargetsCount++] = pSprite->index;
|
||||
// Inlined?
|
||||
int dz = (lz-z2)>>8;
|
||||
int dy = (ly-y2)>>4;
|
||||
|
@ -418,7 +417,7 @@ void UpdateAimVector(PLAYER * pPlayer)
|
|||
aim.dx = bcos(angle);
|
||||
aim.dy = bsin(angle);
|
||||
aim.dz = DivScale(dzCenter, nDist, 10);
|
||||
nTarget = nSprite;
|
||||
nTarget = pSprite->index;
|
||||
}
|
||||
}
|
||||
if (pWeaponTrack->thingAngle > 0)
|
||||
|
|
Loading…
Reference in a new issue