- DoPlasma, DoCoolgFire, DoEelFire.

This commit is contained in:
Christoph Oelckers 2021-11-05 20:02:24 +01:00
parent 0377f3348c
commit 05a812f066

View file

@ -8450,12 +8450,10 @@ DoPlasmaFountain(DSWActor* actor)
return 0; return 0;
} }
int int DoPlasma(DSWActor* actor)
DoPlasma(DSWActor* actor)
{ {
USER* u = actor->u(); USER* u = actor->u();
int Weapon = u->SpriteNum; SPRITEp sp = &actor->s();
SPRITEp sp = &sprite[Weapon];
int32_t dax, day, daz; int32_t dax, day, daz;
int ox,oy,oz; int ox,oy,oz;
@ -8463,36 +8461,35 @@ DoPlasma(DSWActor* actor)
oy = sp->y; oy = sp->y;
oz = sp->z; oz = sp->z;
DoBlurExtend(Weapon, 0, 4); DoBlurExtend(actor->GetSpriteIndex(), 0, 4);
dax = MOVEx(sp->xvel, sp->ang); dax = MOVEx(sp->xvel, sp->ang);
day = MOVEy(sp->xvel, sp->ang); day = MOVEy(sp->xvel, sp->ang);
daz = sp->zvel; daz = sp->zvel;
SetCollision(u, move_missile(Weapon, dax, day, daz, Z(16), Z(16), CLIPMASK_MISSILE, MISSILEMOVETICS)); SetCollision(u, move_missile(actor->GetSpriteIndex(), dax, day, daz, Z(16), Z(16), CLIPMASK_MISSILE, MISSILEMOVETICS));
if (u->ret)
{ {
// this sprite is supposed to go through players/enemys // this sprite is supposed to go through players/enemys
// if hit a player/enemy back up and do it again with blocking reset // if hit a player/enemy back up and do it again with blocking reset
if (TEST(u->ret, HIT_MASK) == HIT_SPRITE) if (u->coll.type == kHitSprite)
{ {
short hit_sprite = NORM_SPRITE(u->ret); auto hitActor = u->coll.actor;
SPRITEp hsp = &sprite[hit_sprite]; SPRITEp hsp = &hitActor->s();
USERp hu = User[hit_sprite].Data(); USERp hu = hitActor->u();
if (TEST(hsp->cstat, CSTAT_SPRITE_BLOCK) && !TEST(hsp->cstat, CSTAT_SPRITE_ALIGNMENT_WALL)) if (TEST(hsp->cstat, CSTAT_SPRITE_BLOCK) && !TEST(hsp->cstat, CSTAT_SPRITE_ALIGNMENT_WALL))
{ {
short hcstat = hsp->cstat; short hcstat = hsp->cstat;
if (hu && hit_sprite != u->WpnGoalActor->GetSpriteIndex()) if (hu && hitActor != u->WpnGoalActor)
{ {
sp->x = ox; sp->x = ox;
sp->y = oy; sp->y = oy;
sp->z = oz; sp->z = oz;
RESET(hsp->cstat, CSTAT_SPRITE_BLOCK | CSTAT_SPRITE_BLOCK_HITSCAN); RESET(hsp->cstat, CSTAT_SPRITE_BLOCK | CSTAT_SPRITE_BLOCK_HITSCAN);
SetCollision(u, move_missile(Weapon, dax, day, daz, Z(16), Z(16), CLIPMASK_MISSILE, MISSILEMOVETICS)); SetCollision(u, move_missile(actor->GetSpriteIndex(), dax, day, daz, Z(16), Z(16), CLIPMASK_MISSILE, MISSILEMOVETICS));
hsp->cstat = hcstat; hsp->cstat = hcstat;
} }
} }
@ -8503,11 +8500,10 @@ DoPlasma(DSWActor* actor)
MissileHitDiveArea(actor); MissileHitDiveArea(actor);
if (TEST(u->Flags, SPR_UNDERWATER) && (RANDOM_P2(1024 << 4) >> 4) < 256) if (TEST(u->Flags, SPR_UNDERWATER) && (RANDOM_P2(1024 << 4) >> 4) < 256)
SpawnBubble(actor); SpawnBubble(actor);
//DoDamageTest(Weapon);
if (u->ret) if (u->coll.type != kHitNone)
{ {
if (WeaponMoveHit(Weapon)) if (WeaponMoveHit(actor->GetSpriteIndex()))
{ {
if (TEST(u->Flags, SPR_SUICIDE)) if (TEST(u->Flags, SPR_SUICIDE))
{ {
@ -8528,14 +8524,12 @@ DoPlasma(DSWActor* actor)
} }
int int DoCoolgFire(DSWActor* actor)
DoCoolgFire(DSWActor* actor)
{ {
USER* u = actor->u(); USER* u = actor->u();
int Weapon = u->SpriteNum; SPRITEp sp = &actor->s();
SPRITEp sp = &sprite[Weapon];
SetCollision(u, move_missile(Weapon, u->xchange, u->ychange, u->zchange, u->ceiling_dist, u->floor_dist, CLIPMASK_MISSILE, MISSILEMOVETICS)); SetCollision(u, move_missile(actor->GetSpriteIndex(), u->xchange, u->ychange, u->zchange, u->ceiling_dist, u->floor_dist, CLIPMASK_MISSILE, MISSILEMOVETICS));
MissileHitDiveArea(actor); MissileHitDiveArea(actor);
if (TEST(u->Flags, SPR_UNDERWATER) && (RANDOM_P2(1024 << 4) >> 4) < 256) if (TEST(u->Flags, SPR_UNDERWATER) && (RANDOM_P2(1024 << 4) >> 4) < 256)
@ -8546,11 +8540,12 @@ DoCoolgFire(DSWActor* actor)
if (u->ret) if (u->ret)
{ {
if (WeaponMoveHit(Weapon)) if (WeaponMoveHit(actor->GetSpriteIndex()))
{ {
PlaySound(DIGI_CGMAGICHIT, sp, v3df_follow); PlaySound(DIGI_CGMAGICHIT, actor, v3df_follow);
ChangeState(actor, s_CoolgFireDone); ChangeState(actor, s_CoolgFireDone);
if (sp->owner >= 0 && User[sp->owner].Data() && User[sp->owner]->ID != RIPPER_RUN_R0) // JBF: added range check auto own = GetOwner(actor);
if (own && own->hasU() && own->u()->ID != RIPPER_RUN_R0) // JBF: added range check
SpawnDemonFist(actor); // Just a red magic circle flash SpawnDemonFist(actor); // Just a red magic circle flash
return true; return true;
} }
@ -8559,17 +8554,13 @@ DoCoolgFire(DSWActor* actor)
return false; return false;
} }
int int DoEelFire(DSWActor* actor)
DoEelFire(DSWActor* actor)
{ {
USER* u = actor->u(); USER* u = actor->u();
int Weapon = u->SpriteNum;
if (TEST(u->Flags, SPR_UNDERWATER) && (RANDOM_P2(1024 << 4) >> 4) < 256) if (TEST(u->Flags, SPR_UNDERWATER) && (RANDOM_P2(1024 << 4) >> 4) < 256)
SpawnBubble(actor); SpawnBubble(actor);
//DoDamageTest(Weapon);
return false; return false;
} }