- DoNapalm, DoBloodWorm

This commit is contained in:
Christoph Oelckers 2021-11-05 00:07:18 +01:00
parent a96cffc4ef
commit f0c670603e
2 changed files with 20 additions and 36 deletions

View file

@ -5049,7 +5049,7 @@ int move_actor(DSWActor* actor, int xchange, int ychange, int zchange)
SET(u->Flags, SPR_MOVED); SET(u->Flags, SPR_MOVED);
if (!u->ret) if (u->coll.type == kHitNone)
{ {
// Keep track of how far sprite has moved // Keep track of how far sprite has moved
dist = Distance(x, y, sp->x, sp->y); dist = Distance(x, y, sp->x, sp->y);

View file

@ -11850,19 +11850,14 @@ int DoFindGroundPoint(DSWActor* actor)
return false; return false;
} }
int int DoNapalm(DSWActor* actor)
DoNapalm(DSWActor* actor)
{ {
USER* u = actor->u(); USER* u = actor->u();
int Weapon = u->SpriteNum; SPRITEp sp = &actor->s(), exp;
SPRITEp sp = &sprite[Weapon], exp;
short explosion;
int ox, oy, oz; int ox, oy, oz;
DoBlurExtend(Weapon, 1, 7); DoBlurExtend(actor->GetSpriteIndex(), 1, 7);
u = User[Weapon].Data();
if (TEST(u->Flags, SPR_UNDERWATER)) if (TEST(u->Flags, SPR_UNDERWATER))
{ {
@ -11879,20 +11874,19 @@ DoNapalm(DSWActor* actor)
oy = sp->y; oy = sp->y;
oz = sp->z; oz = sp->z;
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)
SpawnBubble(actor); SpawnBubble(actor);
if (u->ret)
{ {
// this sprite is suPlayerosed to go through players/enemys // this sprite is suPlayerosed 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)
{ {
SPRITEp hsp = &sprite[NORM_SPRITE(u->ret)]; SPRITEp hsp = &u->coll.actor->s();
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))
{ {
@ -11903,7 +11897,7 @@ DoNapalm(DSWActor* actor)
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, 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));
hsp->cstat = hcstat; hsp->cstat = hcstat;
} }
} }
@ -11919,14 +11913,13 @@ DoNapalm(DSWActor* actor)
PlaySound(DIGI_NAPPUFF, sp, v3df_none); PlaySound(DIGI_NAPPUFF, sp, v3df_none);
explosion = SpawnSprite(STAT_MISSILE, NAP_EXP, s_NapExp, sp->sectnum, auto expActor = SpawnActor(STAT_MISSILE, NAP_EXP, s_NapExp, sp->sectnum,
sp->x, sp->y, sp->z, sp->ang, 0); sp->x, sp->y, sp->z, sp->ang, 0);
auto expActor = &swActors[explosion]; exp = &expActor->s();
exp = &sprite[explosion]; eu = expActor->u();
eu = User[explosion].Data();
exp->hitag = LUMINOUS; //Always full brightness exp->hitag = LUMINOUS; //Always full brightness
SetOwner(sp->owner, explosion); SetOwner(actor, expActor);
exp->shade = -40; exp->shade = -40;
exp->cstat = sp->cstat; exp->cstat = sp->cstat;
exp->xrepeat = 48; exp->xrepeat = 48;
@ -11949,18 +11942,14 @@ DoNapalm(DSWActor* actor)
ASSERT(eu->Tics == 0); ASSERT(eu->Tics == 0);
} }
// DoDamageTest(Weapon);
if (u->ret) if (u->ret)
{ {
if (WeaponMoveHit(Weapon)) if (WeaponMoveHit(actor->GetSpriteIndex()))
{ {
KillActor(actor); KillActor(actor);
return true; return true;
} }
} }
return false; return false;
} }
@ -11968,17 +11957,14 @@ DoNapalm(DSWActor* actor)
int DoBloodWorm(DSWActor* actor) int DoBloodWorm(DSWActor* actor)
{ {
USER* u = actor->u(); USER* u = actor->u();
int Weapon = u->SpriteNum; SPRITEp sp = &actor->s();
SPRITEp sp = &sprite[Weapon];
short ang; short ang;
int xvect,yvect; int xvect,yvect;
int bx,by; int bx,by;
int amt; int amt;
int sectnum; int sectnum;
u = User[Weapon].Data(); SetCollision(u, move_ground_missile(actor->GetSpriteIndex(), u->xchange, u->ychange, u->ceiling_dist, u->floor_dist, CLIPMASK_MISSILE, MISSILEMOVETICS));
SetCollision(u, move_ground_missile(Weapon, u->xchange, u->ychange, u->ceiling_dist, u->floor_dist, CLIPMASK_MISSILE, MISSILEMOVETICS));
if (u->ret) if (u->ret)
{ {
@ -12005,14 +11991,12 @@ int DoBloodWorm(DSWActor* actor)
InitBloodSpray(actor, false, 1); InitBloodSpray(actor, false, 1);
// Kill any old zombies you own // Kill any old zombies you own
StatIterator it(STAT_ENEMY); SWStatIterator it(STAT_ENEMY);
while ((i = it.NextIndex()) >= 0) while (auto itActor = it.Next())
{ {
auto itActor = &swActors[i]; if (!itActor->hasU()) continue;
tsp = &sprite[i]; tsp = &itActor->s();
tu = User[i].Data(); tu = itActor->u();
ASSERT(tu);
if (tu->ID == ZOMBIE_RUN_R0 && tsp->owner == sp->owner) if (tu->ID == ZOMBIE_RUN_R0 && tsp->owner == sp->owner)
{ {