- damageactor

This commit is contained in:
Christoph Oelckers 2021-11-14 17:33:22 +01:00
parent 705c89de68
commit 858ac6bf35
4 changed files with 17 additions and 25 deletions

View file

@ -585,7 +585,7 @@ void gonzoProcess(PLAYER& plr)
for (int j = 0; j < 15; j++) {
shards(k, 1);
}
damageactor(plr, moveStat.actor->GetSpriteIndex(), i);
damageactor(plr, moveStat.actor, actor);
}
break;

View file

@ -195,7 +195,7 @@ void explosion(int i, int x, int y, int z, int owner);
void explosion2(int i, int x, int y, int z, int owner);
void trailingsmoke(DWHActor* i, boolean ball);
void icecubes(int i, int x, int y, int z, int owner);
boolean damageactor(PLAYER& plr, int hitobject, short i);
boolean damageactor(PLAYER& plr, DWHActor* hitobject, DWHActor* actor);
Collision movesprite(DWHActor*, int dx, int dy, int dz, int ceildist, int flordist, int cliptype);
void trowajavlin(int s);
void spawnhornskull(short i);

View file

@ -784,7 +784,7 @@ void animateobjs(PLAYER& plr) {
if (moveStat.type == kHitSprite) { // Bullet hit a sprite
if (spr.owner != moveStat.actor->GetSpriteIndex()) {
hitdamage = damageactor(plr, moveStat.actor->GetSpriteIndex(), i);
hitdamage = damageactor(plr, moveStat.actor, actor);
if (hitdamage) {
SetNewStatus(actor, BROKENVASE);
continue;
@ -1015,7 +1015,7 @@ void animateobjs(PLAYER& plr) {
}
if (spr.owner != moveStat.actor->GetSpriteIndex())
hitdamage = damageactor(plr, moveStat.actor->GetSpriteIndex(), i);
hitdamage = damageactor(plr, moveStat.actor, actor);
if (hitdamage) {
DeleteActor(actor);
continue;
@ -1114,19 +1114,13 @@ void animateobjs(PLAYER& plr) {
}
if (moveStat.type == kHitSprite) { // Bullet hit a sprite
j = moveStat.actor->GetSpriteIndex(); // j is the spritenum that the bullet (spritenum i) hit
hitdamage = damageactor(plr, j, i);
hitdamage = damageactor(plr, moveStat.actor, actor);
if (hitdamage)
continue;
// if (spr.owner != hitobject) {
// hitdamage = damageactor(plr, hitobject, i);
// continue;
// }
if (!hitdamage)
if (isBlades(sprite[j].picnum)) {
if (isBlades(moveStat.actor->s().picnum)) {
DeleteActor(actor);
continue;
}

View file

@ -1533,16 +1533,14 @@ void icecubes(int i, int x, int y, int z, int owner) {
}
boolean damageactor(PLAYER& plr, int hitobject, short const i)
boolean damageactor(PLAYER& plr, DWHActor* hitactor, DWHActor* actor)
{
auto actor = &whActors[i];
short const j = (short) (hitobject & 4095); // j is the spritenum that the bullet (spritenum i) hit
auto& spr = actor->s();
auto& hitspr = sprite[j];
if (j == plr.spritenum && spr.owner == sprite[plr.spritenum].owner)
auto& hitspr = hitactor->s();
if (hitactor == plr.actor() && spr.owner == sprite[plr.spritenum].owner)
return false;
if (j == plr.spritenum && spr.owner != sprite[plr.spritenum].owner) {
if (hitactor == plr.actor() && spr.owner != sprite[plr.spritenum].owner) {
if (plr.invincibletime > 0 || plr.godMode) {
DeleteActor(actor);
return false;
@ -1610,8 +1608,8 @@ boolean damageactor(PLAYER& plr, int hitobject, short const i)
return true;
}
if (j != plr.spritenum && !netgame) // Les 08/11/95
if (spr.owner != j) {
if (hitactor == plr.actor() && !netgame) // Les 08/11/95
if (spr.owner != hitactor->GetSpriteIndex()) {
// final int DEMONTYPE = 1; XXX
// final int DRAGONTYPE = 3;
@ -1671,10 +1669,10 @@ boolean damageactor(PLAYER& plr, int hitobject, short const i)
}
if (hitspr.hitag <= 0) {
newstatus(j, DIE);
SetNewStatus(hitactor, DIE);
DeleteActor(actor);
} else
newstatus(j, PAIN);
SetNewStatus(hitactor, PAIN);
return true;
}
@ -1695,10 +1693,10 @@ boolean damageactor(PLAYER& plr, int hitobject, short const i)
// raf because monsters could shatter a guy thats been frozen
if (hitspr.pal == 6) {
for (int k = 0; k < 32; k++)
icecubes(j, hitspr.x, hitspr.y, hitspr.z, j);
icecubes(hitactor->GetSpriteIndex(), hitspr.x, hitspr.y, hitspr.z, hitactor->GetSpriteIndex());
// EG 26 Oct 2017: Move this here from medusa (anti multi-freeze exploit)
addscore(&plr, 100);
deletesprite(j);
DeleteActor(hitactor);
}
return true;
}
@ -1719,7 +1717,7 @@ boolean damageactor(PLAYER& plr, int hitobject, short const i)
case STAINGLASS9:
hitspr.hitag = 0;
hitspr.lotag = 0;
newstatus(j, BROKENVASE);
SetNewStatus(hitactor, BROKENVASE);
break;
default:
DeleteActor(actor);