- eliminated the last access to playerActors in trigger.cpp and made AimTargets a pointer array.

This commit is contained in:
Christoph Oelckers 2021-09-05 08:41:44 +02:00
parent 6dd7cbe8fa
commit 5b9152abfd
8 changed files with 15 additions and 13 deletions

View file

@ -4970,7 +4970,7 @@ void MoveDude(DBloodActor* actor)
if (pXSector && pXSector->Enter && (pPlayer || !pXSector->dudeLockout))
{
if (sector[nSector].type == kSectorTeleport)
pXSector->data = pPlayer ? pSprite->index : -1;
pXSector->actordata = actor;
trTriggerSector(nSector, pXSector, kCmdSectorEnter);
}

View file

@ -203,6 +203,7 @@ struct XSECTOR {
DBloodActor* marker0;
DBloodActor* marker1;
DBloodActor* basePath;
DBloodActor* actordata;
uint16_t windAng; // Wind ang
uint16_t bobTheta; // Motion Theta
int16_t bobSpeed; // Motion speed

View file

@ -572,6 +572,7 @@ FSerializer& Serialize(FSerializer& arc, const char* keyname, XSECTOR& w, XSECTO
("marker0", w.marker0, def->marker0)
("marker1", w.marker1, def->marker1)
("basepath", w.basePath, def->basePath)
("actordata", w.actordata, def->actordata)
("windang", w.windAng, def->windAng)
("bobtheta", w.bobTheta, def->bobTheta)
("bobspeed", w.bobSpeed, def->bobSpeed)

View file

@ -2445,7 +2445,7 @@ DEFINE_FIELD_X(BloodPlayer, PLAYER, throwTime)
DEFINE_FIELD_X(BloodPlayer, PLAYER, throwPower)
DEFINE_FIELD_X(BloodPlayer, PLAYER, aim) // world
DEFINE_FIELD_X(BloodPlayer, PLAYER, aimTargetsCount)
DEFINE_FIELD_X(BloodPlayer, PLAYER, aimTargets)
//DEFINE_FIELD_X(BloodPlayer, PLAYER, aimTargets)
DEFINE_FIELD_X(BloodPlayer, PLAYER, deathTime)
DEFINE_FIELD_X(BloodPlayer, PLAYER, pwUpTime)
DEFINE_FIELD_X(BloodPlayer, PLAYER, teamId)

View file

@ -141,7 +141,7 @@ struct PLAYER
//int at1d2;
DBloodActor* aimTarget; // aim target sprite
int aimTargetsCount;
short aimTargets[16];
DBloodActor* aimTargets[16];
int deathTime;
int pwUpTime[kMaxPowerUps];
int fragCount;

View file

@ -1447,8 +1447,10 @@ void OperateTeleport(unsigned int nSector, XSECTOR *pXSector)
pPlayer = NULL;
if (bPlayer || !SectorContainsDudes(pDest->sectnum))
{
if (!(gGameOptions.uNetGameFlags&2))
TeleFrag(&bloodActors[pXSector->data], pDest->sectnum);
if (!(gGameOptions.uNetGameFlags & 2))
{
TeleFrag(pXSector->actordata, pDest->sectnum);
}
pSprite->x = pDest->x;
pSprite->y = pDest->y;
pSprite->z += sector[pDest->sectnum].floorz-sector[nSector].floorz;

View file

@ -398,7 +398,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++] = pSprite->index;
pPlayer->aimTargets[pPlayer->aimTargetsCount++] = actor;
// Inlined?
int dz = (lz-z2)>>8;
int dy = (ly-y2)>>4;
@ -449,7 +449,7 @@ void UpdateAimVector(PLAYER * pPlayer)
if (abs(((angle-pPSprite->ang+1024)&2047)-1024) > pWeaponTrack->thingAngle)
continue;
if (pPlayer->aimTargetsCount < 16 && cansee(x,y,z,pPSprite->sectnum,pSprite->x,pSprite->y,pSprite->z,pSprite->sectnum))
pPlayer->aimTargets[pPlayer->aimTargetsCount++] = pSprite->index;
pPlayer->aimTargets[pPlayer->aimTargetsCount++] = actor;
// Inlined?
int dz2 = (lz-z2)>>8;
int dy2 = (ly-y2)>>4;
@ -1517,8 +1517,7 @@ void AltFireVoodoo(int nTrigger, PLAYER *pPlayer)
{
for (int i = 0; i < pPlayer->aimTargetsCount; i++)
{
int nTarget = pPlayer->aimTargets[i];
auto targetactor = &bloodActors[nTarget];
auto targetactor = pPlayer->aimTargets[i];
spritetype* pTarget = &targetactor->s();
if (!gGameOptions.bFriendlyFire && IsTargetTeammate(pPlayer, pTarget))
continue;
@ -1554,8 +1553,7 @@ void AltFireVoodoo(int nTrigger, PLAYER *pPlayer)
int v4 = pPlayer->ammoCount[9] - (pPlayer->ammoCount[9] / nCount) * nCount;
for (int i = 0; i < pPlayer->aimTargetsCount; i++)
{
int nTarget = pPlayer->aimTargets[i];
auto targetactor = &bloodActors[nTarget];
auto targetactor = pPlayer->aimTargets[i];
spritetype* pTarget = &targetactor->s();
if (!gGameOptions.bFriendlyFire && IsTargetTeammate(pPlayer, pTarget))
continue;
@ -1738,7 +1736,7 @@ void AltFireLifeLeech(int , PLAYER *pPlayer)
pXSprite->DudeLockout = 1;
pXSprite->data4 = ClipHigh(pPlayer->ammoCount[4], 12);
pXSprite->stateTimer = 1;
evPostActor(&bloodActors[pMissile->index], 120, kCallbackLeechStateTimer);
evPostActor(missile, 120, kCallbackLeechStateTimer);
if (gGameOptions.nGameType <= 1)
{
int nAmmo = pPlayer->ammoCount[8];

View file

@ -100,7 +100,7 @@ struct BloodPlayer native
//native Aim aim; // world
//native int aimTarget; // aim target sprite
native int aimTargetsCount;
native short aimTargets[16];
//native short aimTargets[16];
native int deathTime;
native int pwUpTime[51]; // kMaxPowerUps
native int fragCount;