- some more.

This commit is contained in:
Christoph Oelckers 2021-12-23 14:07:07 +01:00
parent 0d5ea0f314
commit b848a9c980
2 changed files with 30 additions and 37 deletions

View file

@ -1267,18 +1267,17 @@ int ActionScan(PLAYER *pPlayer, HitInfo* out)
auto hitactor = gHitInfo.actor(); auto hitactor = gHitInfo.actor();
if (!hitactor || !hitactor->hasX()) return -1; if (!hitactor || !hitactor->hasX()) return -1;
out->hitActor = hitactor; out->hitActor = hitactor;
XSPRITE* pXSprite = &hitactor->x();
if (hitactor->spr.statnum == kStatThing) if (hitactor->spr.statnum == kStatThing)
{ {
if (hitactor->spr.type == kThingDroppedLifeLeech) if (hitactor->spr.type == kThingDroppedLifeLeech)
{ {
if (gGameOptions.nGameType > 1 && findDroppedLeech(pPlayer, hitactor)) if (gGameOptions.nGameType > 1 && findDroppedLeech(pPlayer, hitactor))
return -1; return -1;
pXSprite->data4 = pPlayer->nPlayer; hitactor->xspr.data4 = pPlayer->nPlayer;
pXSprite->isTriggered = 0; hitactor->xspr.isTriggered = 0;
} }
} }
if (pXSprite->Push) if (hitactor->xspr.Push)
return 3; return 3;
if (hitactor->spr.statnum == kStatDude) if (hitactor->spr.statnum == kStatDude)
{ {
@ -1290,7 +1289,7 @@ int ActionScan(PLAYER *pPlayer, HitInfo* out)
hitactor->yvel += MulScale(y, t2, 16); hitactor->yvel += MulScale(y, t2, 16);
hitactor->zvel += MulScale(z, t2, 16); hitactor->zvel += MulScale(z, t2, 16);
} }
if (pXSprite->Push && !pXSprite->state && !pXSprite->isTriggered) if (hitactor->xspr.Push && !hitactor->xspr.state && !hitactor->xspr.isTriggered)
trTriggerSprite(hitactor, kCmdSpritePush); trTriggerSprite(hitactor, kCmdSpritePush);
} }
break; break;
@ -1570,7 +1569,6 @@ void ProcessInput(PLAYER *pPlayer)
case 3: case 3:
{ {
auto act = result.actor(); auto act = result.actor();
XSPRITE *pXSprite = &act->x();
int key = actor->xspr.key; int key = actor->xspr.key;
if (actor->xspr.locked && pPlayer == gMe && actor->xspr.lockMsg) if (actor->xspr.locked && pPlayer == gMe && actor->xspr.lockMsg)
trTextOver(actor->xspr.lockMsg); trTextOver(actor->xspr.lockMsg);
@ -1671,7 +1669,6 @@ void ProcessInput(PLAYER *pPlayer)
void playerProcess(PLAYER *pPlayer) void playerProcess(PLAYER *pPlayer)
{ {
DBloodActor* actor = pPlayer->actor; DBloodActor* actor = pPlayer->actor;
XSPRITE *pXSprite = pPlayer->pXSprite;
POSTURE* pPosture = &pPlayer->pPosture[pPlayer->lifeMode][pPlayer->posture]; POSTURE* pPosture = &pPlayer->pPosture[pPlayer->lifeMode][pPlayer->posture];
powerupProcess(pPlayer); powerupProcess(pPlayer);
int top, bottom; int top, bottom;
@ -1724,7 +1721,7 @@ void playerProcess(PLAYER *pPlayer)
} }
else else
{ {
if (pXSprite->height < 256) if (actor->xspr.height < 256)
{ {
bool running = pPlayer->isRunning && !cl_bloodvanillabobbing; bool running = pPlayer->isRunning && !cl_bloodvanillabobbing;
pPlayer->bobAmp = (pPlayer->bobAmp+pPosture->pace[running]*4) & 2047; pPlayer->bobAmp = (pPlayer->bobAmp+pPosture->pace[running]*4) & 2047;
@ -1752,9 +1749,9 @@ void playerProcess(PLAYER *pPlayer)
pPlayer->painEffect = ClipLow(pPlayer->painEffect-4, 0); pPlayer->painEffect = ClipLow(pPlayer->painEffect-4, 0);
pPlayer->blindEffect = ClipLow(pPlayer->blindEffect-4, 0); pPlayer->blindEffect = ClipLow(pPlayer->blindEffect-4, 0);
pPlayer->pickupEffect = ClipLow(pPlayer->pickupEffect-4, 0); pPlayer->pickupEffect = ClipLow(pPlayer->pickupEffect-4, 0);
if (pPlayer == gMe && gMe->pXSprite->health == 0) if (pPlayer == gMe && gMe->actor->xspr.health == 0)
pPlayer->hand = 0; pPlayer->hand = 0;
if (!pXSprite->health) if (!actor->xspr.health)
return; return;
pPlayer->isUnderwater = 0; pPlayer->isUnderwater = 0;
if (pPlayer->posture == 1) if (pPlayer->posture == 1)
@ -1945,13 +1942,12 @@ int playerDamageSprite(DBloodActor* source, PLAYER *pPlayer, DAMAGE_TYPE nDamage
nDamage = playerDamageArmor(pPlayer, nDamageType, nDamage); nDamage = playerDamageArmor(pPlayer, nDamageType, nDamage);
pPlayer->painEffect = ClipHigh(pPlayer->painEffect+(nDamage>>3), 600); pPlayer->painEffect = ClipHigh(pPlayer->painEffect+(nDamage>>3), 600);
XSPRITE *pXSprite = pPlayer->pXSprite;
DBloodActor* pActor = pPlayer->actor; DBloodActor* pActor = pPlayer->actor;
DUDEINFO *pDudeInfo = getDudeInfo(pActor->spr.type); DUDEINFO *pDudeInfo = getDudeInfo(pActor->spr.type);
int nDeathSeqID = -1; int nDeathSeqID = -1;
int nKneelingPlayer = -1; int nKneelingPlayer = -1;
bool va = playerSeqPlaying(pPlayer, 16); bool va = playerSeqPlaying(pPlayer, 16);
if (!pXSprite->health) if (!pActor->xspr.health)
{ {
if (va) if (va)
{ {
@ -1985,15 +1981,15 @@ int playerDamageSprite(DBloodActor* source, PLAYER *pPlayer, DAMAGE_TYPE nDamage
} }
else else
{ {
int nHealth = pXSprite->health-nDamage; int nHealth = pActor->xspr.health-nDamage;
pXSprite->health = ClipLow(nHealth, 0); pActor->xspr.health = ClipLow(nHealth, 0);
if (pXSprite->health > 0 && pXSprite->health < 16) if (pActor->xspr.health > 0 && pActor->xspr.health < 16)
{ {
nDamageType = kDamageBullet; nDamageType = kDamageBullet;
pXSprite->health = 0; pActor->xspr.health = 0;
nHealth = -25; nHealth = -25;
} }
if (pXSprite->health > 0) if (pActor->xspr.health > 0)
{ {
DAMAGEINFO *pDamageInfo = &damageInfo[nDamageType]; DAMAGEINFO *pDamageInfo = &damageInfo[nDamageType];
int nSound; int nSound;
@ -2001,7 +1997,7 @@ int playerDamageSprite(DBloodActor* source, PLAYER *pPlayer, DAMAGE_TYPE nDamage
nSound = pDamageInfo->Kills[0]; nSound = pDamageInfo->Kills[0];
else else
nSound = pDamageInfo->Kills[Random(3)]; nSound = pDamageInfo->Kills[Random(3)];
if (nDamageType == kDamageDrown && pXSprite->medium == kMediumWater && !pPlayer->hand) if (nDamageType == kDamageDrown && pActor->xspr.medium == kMediumWater && !pPlayer->hand)
nSound = 714; nSound = 714;
sfxPlay3DSound(pPlayer->actor, nSound, 0, 6); sfxPlay3DSound(pPlayer->actor, nSound, 0, 6);
return nDamage; return nDamage;
@ -2071,21 +2067,21 @@ int playerDamageSprite(DBloodActor* source, PLAYER *pPlayer, DAMAGE_TYPE nDamage
#ifdef NOONE_EXTENSIONS #ifdef NOONE_EXTENSIONS
// allow drop items and keys in multiplayer // allow drop items and keys in multiplayer
if (gModernMap && gGameOptions.nGameType != 0 && pPlayer->pXSprite->health <= 0) { if (gModernMap && gGameOptions.nGameType != 0 && pPlayer->actor->xspr.health <= 0) {
DBloodActor* pItem = nullptr; DBloodActor* pItem = nullptr;
if (pPlayer->pXSprite->dropMsg && (pItem = actDropItem(pActor, pPlayer->pXSprite->dropMsg)) != NULL) if (pPlayer->actor->xspr.dropMsg && (pItem = actDropItem(pActor, pPlayer->actor->xspr.dropMsg)) != NULL)
evPostActor(pItem, 500, kCallbackRemove); evPostActor(pItem, 500, kCallbackRemove);
if (pPlayer->pXSprite->key) { if (pPlayer->actor->xspr.key) {
int i; // if all players have this key, don't drop it int i; // if all players have this key, don't drop it
for (i = connecthead; i >= 0; i = connectpoint2[i]) { for (i = connecthead; i >= 0; i = connectpoint2[i]) {
if (!gPlayer[i].hasKey[pPlayer->pXSprite->key]) if (!gPlayer[i].hasKey[pPlayer->actor->xspr.key])
break; break;
} }
if (i == 0 && (pItem = actDropKey(pActor, (pPlayer->pXSprite->key + kItemKeyBase) - 1)) != NULL) if (i == 0 && (pItem = actDropKey(pActor, (pPlayer->actor->xspr.key + kItemKeyBase) - 1)) != NULL)
evPostActor(pItem, 500, kCallbackRemove); evPostActor(pItem, 500, kCallbackRemove);
} }

View file

@ -1682,9 +1682,8 @@ void AltFireNapalm(int , PLAYER *pPlayer)
auto missile = playerFireThing(pPlayer, 0, -4730, kThingNapalmBall, nSpeed); auto missile = playerFireThing(pPlayer, 0, -4730, kThingNapalmBall, nSpeed);
if (missile) if (missile)
{ {
XSPRITE *pXSprite = &missile->x(); missile->xspr.data4 = ClipHigh(pPlayer->ammoCount[4], 12);
pXSprite->data4 = ClipHigh(pPlayer->ammoCount[4], 12); UseAmmo(pPlayer, 4, missile->xspr.data4);
UseAmmo(pPlayer, 4, pXSprite->data4);
seqSpawn(22, missile, -1); seqSpawn(22, missile, -1);
actBurnSprite(pPlayer->actor, missile, 600); actBurnSprite(pPlayer->actor, missile, 600);
evPostActor(missile, 0, kCallbackFXFlameLick); evPostActor(missile, 0, kCallbackFXFlameLick);
@ -1723,27 +1722,26 @@ void AltFireLifeLeech(int , PLAYER *pPlayer)
if (missile) if (missile)
{ {
missile->spr.cstat |= CSTAT_SPRITE_BLOOD_BIT1; missile->spr.cstat |= CSTAT_SPRITE_BLOOD_BIT1;
XSPRITE *pXSprite = &missile->x(); missile->xspr.Push = 1;
pXSprite->Push = 1; missile->xspr.Proximity = 1;
pXSprite->Proximity = 1; missile->xspr.DudeLockout = 1;
pXSprite->DudeLockout = 1; missile->xspr.data4 = ClipHigh(pPlayer->ammoCount[4], 12);
pXSprite->data4 = ClipHigh(pPlayer->ammoCount[4], 12); missile->xspr.stateTimer = 1;
pXSprite->stateTimer = 1;
evPostActor(missile, 120, kCallbackLeechStateTimer); evPostActor(missile, 120, kCallbackLeechStateTimer);
if (gGameOptions.nGameType <= 1) if (gGameOptions.nGameType <= 1)
{ {
int nAmmo = pPlayer->ammoCount[8]; int nAmmo = pPlayer->ammoCount[8];
if (nAmmo < 25 && pPlayer->pXSprite->health > unsigned((25-nAmmo)<<4)) if (nAmmo < 25 && pPlayer->missile->xspr.health > unsigned((25-nAmmo)<<4))
{ {
actDamageSprite(actor, actor, kDamageSpirit, ((25-nAmmo)<<4)); actDamageSprite(actor, actor, kDamageSpirit, ((25-nAmmo)<<4));
nAmmo = 25; nAmmo = 25;
} }
pXSprite->data3 = nAmmo; missile->xspr.data3 = nAmmo;
UseAmmo(pPlayer, 8, nAmmo); UseAmmo(pPlayer, 8, nAmmo);
} }
else else
{ {
pXSprite->data3 = pPlayer->ammoCount[8]; missile->xspr.data3 = pPlayer->ammoCount[8];
pPlayer->ammoCount[8] = 0; pPlayer->ammoCount[8] = 0;
} }
pPlayer->hasWeapon[9] = 0; pPlayer->hasWeapon[9] = 0;
@ -2690,8 +2688,7 @@ void teslaHit(DBloodActor *missileactor, int a2)
continue; continue;
if (CheckSector(sectorMap, hitactor) && CheckProximity(hitactor, x, y, z, pSector, nDist)) if (CheckSector(sectorMap, hitactor) && CheckProximity(hitactor, x, y, z, pSector, nDist))
{ {
XSPRITE *pXSprite = &hitactor->x(); if (!hitactor->xspr.locked)
if (!pXSprite->locked)
{ {
int dx = missileactor->spr.pos.X - hitactor->spr.pos.X; int dx = missileactor->spr.pos.X - hitactor->spr.pos.X;
int dy = missileactor->spr.pos.Y - hitactor->spr.pos.Y; int dy = missileactor->spr.pos.Y - hitactor->spr.pos.Y;