- Mirvs and Meteors.

This commit is contained in:
Christoph Oelckers 2021-11-05 00:05:40 +01:00
parent 6f0c477e85
commit f8a74df87e

View file

@ -12080,11 +12080,8 @@ DoNapalm(DSWActor* actor)
return false; return false;
} }
#define WORM 1
#if WORM == 1 int DoBloodWorm(DSWActor* actor)
int
DoBloodWorm(DSWActor* actor)
{ {
USER* u = actor->u(); USER* u = actor->u();
int Weapon = u->SpriteNum; int Weapon = u->SpriteNum;
@ -12174,21 +12171,17 @@ DoBloodWorm(DSWActor* actor)
return false; return false;
} }
#endif
int int DoMeteor(DSWActor* actor)
DoMeteor(DSWActor* actor)
{ {
return false; return false;
} }
int int DoSerpMeteor(DSWActor* actor)
DoSerpMeteor(DSWActor* actor)
{ {
USER* u = actor->u(); USER* u = actor->u();
int Weapon = u->SpriteNum; SPRITEp sp = &actor->s();
SPRITEp sp = &sprite[Weapon];
int ox, oy, oz; int ox, oy, oz;
ox = sp->x; ox = sp->x;
@ -12199,16 +12192,16 @@ DoSerpMeteor(DSWActor* actor)
if (sp->xrepeat > 80) if (sp->xrepeat > 80)
sp->xrepeat = 80; sp->xrepeat = 80;
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));
if (u->ret) if (u->coll.type != kHitNone)
{ {
// 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)
{ {
SPRITEp hsp = &sprite[NORM_SPRITE(u->ret)]; SPRITEp hsp = &u->coll.actor->s();
USERp hu = User[NORM_SPRITE(u->ret)].Data(); USERp hu = u->coll.actor->u();
if (hu && hu->ID >= SKULL_R0 && hu->ID <= SKULL_SERP) if (hu && hu->ID >= SKULL_R0 && hu->ID <= SKULL_SERP)
{ {
@ -12219,71 +12212,55 @@ DoSerpMeteor(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;
} }
} }
}
if (u->ret) if (WeaponMoveHit(actor->GetSpriteIndex()))
{
if (WeaponMoveHit(Weapon))
{ {
SpawnMeteorExp(Weapon); SpawnMeteorExp(actor->GetSpriteIndex());
KillActor(actor); KillActor(actor);
return true; return true;
} }
} }
return false; return false;
} }
int int DoMirvMissile(DSWActor* actor)
DoMirvMissile(DSWActor* actor)
{ {
USER* u = actor->u(); USER* u = actor->u();
int Weapon = u->SpriteNum; SPRITEp sp = &actor->s();
SPRITEp sp = &sprite[Weapon];
sp->xrepeat += MISSILEMOVETICS * 2; sp->xrepeat += MISSILEMOVETICS * 2;
if (sp->xrepeat > 80) if (sp->xrepeat > 80)
sp->xrepeat = 80; sp->xrepeat = 80;
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));
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) if (u->coll.type == kHitNone)
{ {
if (WeaponMoveHit(Weapon)) if (WeaponMoveHit(actor->GetSpriteIndex()))
{ {
SpawnMeteorExp(Weapon); SpawnMeteorExp(actor->GetSpriteIndex());
KillActor(actor); KillActor(actor);
return true; return true;
} }
} }
return false; return false;
} }
int int DoMirv(DSWActor* actor)
DoMirv(DSWActor* actor)
{ {
USER* u = actor->u(); USER* u = actor->u();
int Weapon = u->SpriteNum; SPRITEp sp = &actor->s(), np;
SPRITEp sp = &sprite[Weapon], np;
USERp nu; USERp nu;
short New;
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);
@ -12305,18 +12282,17 @@ DoMirv(DSWActor* actor)
for (i = 0; i < 2; i++) for (i = 0; i < 2; i++)
{ {
New = SpawnSprite(STAT_MISSILE, MIRV_METEOR, &sg_MirvMeteor[0][0], sp->sectnum, auto actorNew = SpawnActor(STAT_MISSILE, MIRV_METEOR, &sg_MirvMeteor[0][0], sp->sectnum,
sp->x, sp->y, sp->z, NORM_ANGLE(sp->ang + angs[i]), 800); sp->x, sp->y, sp->z, NORM_ANGLE(sp->ang + angs[i]), 800);
auto actorNew = &swActors[New]; np = &actorNew->s();
np = &sprite[New]; nu = actorNew->u();
nu = User[New].Data();
nu->RotNum = 5; nu->RotNum = 5;
NewStateGroup(actorNew, &sg_MirvMeteor[0]); NewStateGroup(actorNew, &sg_MirvMeteor[0]);
nu->StateEnd = s_MirvMeteorExp; nu->StateEnd = s_MirvMeteorExp;
SetOwner(Weapon, New); SetOwner(actor, actorNew);
np->shade = -40; np->shade = -40;
np->xrepeat = 40; np->xrepeat = 40;
np->yrepeat = 40; np->yrepeat = 40;
@ -12341,8 +12317,7 @@ DoMirv(DSWActor* actor)
if (u->ret) if (u->ret)
{ {
SpawnMeteorExp(Weapon); SpawnMeteorExp(actor->GetSpriteIndex());
//SpawnBasicExp(Weapon);
KillActor(actor); KillActor(actor);
return true; return true;
} }