mirror of
https://github.com/ZDoom/Raze.git
synced 2024-11-15 17:01:28 +00:00
- InitTankShell + InitEMP.
This commit is contained in:
parent
a25bdf2354
commit
5900ac7db4
1 changed files with 28 additions and 32 deletions
|
@ -17502,14 +17502,13 @@ InitUzi(PLAYERp pp)
|
||||||
}
|
}
|
||||||
|
|
||||||
// Electro Magnetic Pulse gun
|
// Electro Magnetic Pulse gun
|
||||||
int
|
int InitEMP(PLAYERp pp)
|
||||||
InitEMP(PLAYERp pp)
|
|
||||||
{
|
{
|
||||||
USERp u = User[pp->PlayerSprite].Data();
|
USERp u = pp->Actor()->u();
|
||||||
SPRITEp wp, hsp=nullptr;
|
SPRITEp wp, hsp=nullptr;
|
||||||
USERp wu;
|
USERp wu;
|
||||||
short daang, j;
|
short daang;
|
||||||
hitdata_t hitinfo;
|
HITINFO hitinfo;
|
||||||
int daz, nz;
|
int daz, nz;
|
||||||
short cstat = 0;
|
short cstat = 0;
|
||||||
|
|
||||||
|
@ -17542,15 +17541,14 @@ InitEMP(PLAYERp pp)
|
||||||
daz, // Z vector of 3D ang
|
daz, // Z vector of 3D ang
|
||||||
&hitinfo, CLIPMASK_MISSILE);
|
&hitinfo, CLIPMASK_MISSILE);
|
||||||
|
|
||||||
j = SpawnSprite(STAT_MISSILE, EMP, s_EMPBurst, hitinfo.sect, hitinfo.pos.x, hitinfo.pos.y, hitinfo.pos.z, daang, 0);
|
auto missileActor = SpawnActor(STAT_MISSILE, EMP, s_EMPBurst, hitinfo.sect, hitinfo.pos.x, hitinfo.pos.y, hitinfo.pos.z, daang, 0);
|
||||||
|
|
||||||
auto missileActor = &swActors[j];
|
wp = &missileActor->s();
|
||||||
wp = &sprite[j];
|
wu = missileActor->u();
|
||||||
wu = User[j].Data();
|
|
||||||
|
|
||||||
wu->WaitTics = SEC(7);
|
wu->WaitTics = SEC(7);
|
||||||
wp->shade = -127;
|
wp->shade = -127;
|
||||||
SetOwner(pp->PlayerSprite, j);
|
SetOwner(pp->Actor(), missileActor);
|
||||||
SET(wp->cstat, cstat | CSTAT_SPRITE_YCENTER);
|
SET(wp->cstat, cstat | CSTAT_SPRITE_YCENTER);
|
||||||
wp->clipdist = 8 >> 2;
|
wp->clipdist = 8 >> 2;
|
||||||
|
|
||||||
|
@ -17562,7 +17560,7 @@ InitEMP(PLAYERp pp)
|
||||||
SetVisHigh();
|
SetVisHigh();
|
||||||
|
|
||||||
// check to see what you hit
|
// check to see what you hit
|
||||||
if (hitinfo.sprite < 0 && hitinfo.wall < 0)
|
if (hitinfo.hitactor == nullptr && hitinfo.wall < 0)
|
||||||
{
|
{
|
||||||
if (labs(hitinfo.pos.z - sector[hitinfo.sect].ceilingz) <= Z(1))
|
if (labs(hitinfo.pos.z - sector[hitinfo.sect].ceilingz) <= Z(1))
|
||||||
{
|
{
|
||||||
|
@ -17595,7 +17593,7 @@ InitEMP(PLAYERp pp)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
HitscanSpriteAdjust(j, hitinfo.wall);
|
HitscanSpriteAdjust(missileActor->GetSpriteIndex(), hitinfo.wall);
|
||||||
if (wall[hitinfo.wall].lotag == TAG_WALL_BREAK)
|
if (wall[hitinfo.wall].lotag == TAG_WALL_BREAK)
|
||||||
{
|
{
|
||||||
HitBreakWall(&wall[hitinfo.wall], hitinfo.pos.x, hitinfo.pos.y, hitinfo.pos.z, daang, u->ID);
|
HitBreakWall(&wall[hitinfo.wall], hitinfo.pos.x, hitinfo.pos.y, hitinfo.pos.z, daang, u->ID);
|
||||||
|
@ -17604,36 +17602,36 @@ InitEMP(PLAYERp pp)
|
||||||
}
|
}
|
||||||
|
|
||||||
// hit a sprite?
|
// hit a sprite?
|
||||||
if (hitinfo.sprite >= 0)
|
if (hitinfo.hitactor != nullptr)
|
||||||
{
|
{
|
||||||
hsp = &sprite[hitinfo.sprite];
|
hsp = &hitinfo.hitactor->s();
|
||||||
|
|
||||||
if (hsp->lotag == TAG_SPRITE_HIT_MATCH)
|
if (hsp->lotag == TAG_SPRITE_HIT_MATCH)
|
||||||
{
|
{
|
||||||
if (MissileHitMatch(-1, WPN_UZI, hitinfo.sprite))
|
if (MissileHitMatch(-1, WPN_UZI, hitinfo.hitactor->GetSpriteIndex()))
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (TEST(hsp->extra, SPRX_BREAKABLE))
|
if (TEST(hsp->extra, SPRX_BREAKABLE))
|
||||||
{
|
{
|
||||||
HitBreakSprite(&swActors[hitinfo.sprite],0);
|
HitBreakSprite(hitinfo.hitactor,0);
|
||||||
//return(0);
|
//return(0);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (BulletHitSprite(pp->SpriteP, hitinfo.sprite, hitinfo.pos.x, hitinfo.pos.y, hitinfo.pos.z,0))
|
if (BulletHitSprite(pp->SpriteP, hitinfo.hitactor->GetSpriteIndex(), hitinfo.pos.x, hitinfo.pos.y, hitinfo.pos.z,0))
|
||||||
//return(0);
|
//return(0);
|
||||||
|
|
||||||
// hit a switch?
|
// hit a switch?
|
||||||
if (TEST(hsp->cstat, CSTAT_SPRITE_ALIGNMENT_WALL) && (hsp->lotag || hsp->hitag))
|
if (TEST(hsp->cstat, CSTAT_SPRITE_ALIGNMENT_WALL) && (hsp->lotag || hsp->hitag))
|
||||||
{
|
{
|
||||||
ShootableSwitch(&swActors[hitinfo.sprite]);
|
ShootableSwitch(hitinfo.hitactor);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (TEST(hsp->extra, SPRX_PLAYER_OR_ENEMY))
|
if (TEST(hsp->extra, SPRX_PLAYER_OR_ENEMY))
|
||||||
{
|
{
|
||||||
// attach weapon to sprite
|
// attach weapon to sprite
|
||||||
SetAttach(&swActors[hitinfo.sprite], missileActor);
|
SetAttach(hitinfo.hitactor, missileActor);
|
||||||
wu->sz = sprite[hitinfo.sprite].z - wp->z;
|
wu->sz = hitinfo.hitactor->s().z - wp->z;
|
||||||
if (RandomRange(1000) > 500)
|
if (RandomRange(1000) > 500)
|
||||||
PlayerSound(DIGI_YOULOOKSTUPID, v3df_follow|v3df_dontpan,pp);
|
PlayerSound(DIGI_YOULOOKSTUPID, v3df_follow|v3df_dontpan,pp);
|
||||||
}
|
}
|
||||||
|
@ -17653,7 +17651,7 @@ InitEMP(PLAYERp pp)
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
KillSprite(j);
|
KillActor(missileActor);
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -17662,25 +17660,23 @@ InitEMP(PLAYERp pp)
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
int
|
int InitTankShell(DSWActor* actor, PLAYERp pp)
|
||||||
InitTankShell(short SpriteNum, PLAYERp pp)
|
|
||||||
{
|
{
|
||||||
USERp u = User[SpriteNum].Data();
|
USERp u = actor->u();
|
||||||
SPRITEp sp = u->SpriteP;
|
SPRITEp sp = &actor->s();
|
||||||
SPRITEp wp;
|
SPRITEp wp;
|
||||||
USERp wu;
|
USERp wu;
|
||||||
short w;
|
|
||||||
|
|
||||||
if (!SW_SHAREWARE)
|
if (!SW_SHAREWARE)
|
||||||
PlaySound(DIGI_CANNON, pp, v3df_dontpan|v3df_doppler);
|
PlaySound(DIGI_CANNON, pp, v3df_dontpan|v3df_doppler);
|
||||||
|
|
||||||
w = SpawnSprite(STAT_MISSILE, 0, s_TankShell, sp->sectnum,
|
auto actorNew = SpawnActor(STAT_MISSILE, 0, s_TankShell, sp->sectnum,
|
||||||
sp->x, sp->y, sp->z, sp->ang, TANK_SHELL_VELOCITY);
|
sp->x, sp->y, sp->z, sp->ang, TANK_SHELL_VELOCITY);
|
||||||
|
|
||||||
wp = &sprite[w];
|
wu = actorNew->u();
|
||||||
wu = User[w].Data();
|
wp = &actorNew->s();
|
||||||
|
|
||||||
SetOwner(pp->PlayerSprite, w);
|
SetOwner(pp->Actor(), actorNew);
|
||||||
wp->yrepeat = 8;
|
wp->yrepeat = 8;
|
||||||
wp->xrepeat = 8;
|
wp->xrepeat = 8;
|
||||||
wp->shade = -40;
|
wp->shade = -40;
|
||||||
|
@ -17697,7 +17693,7 @@ InitTankShell(short SpriteNum, PLAYERp pp)
|
||||||
|
|
||||||
wp->zvel = xs_CRoundToInt(-MulScaleF(pp->horizon.horiz.asq16(), wp->xvel / 8., 16));
|
wp->zvel = xs_CRoundToInt(-MulScaleF(pp->horizon.horiz.asq16(), wp->xvel / 8., 16));
|
||||||
|
|
||||||
WeaponAutoAim(sp, w, 64, false);
|
WeaponAutoAim(sp, actorNew->GetSpriteIndex(), 64, false);
|
||||||
// a bit of randomness
|
// a bit of randomness
|
||||||
wp->ang += RandomRange(30) - 15;
|
wp->ang += RandomRange(30) - 15;
|
||||||
wp->ang = NORM_ANGLE(wp->ang);
|
wp->ang = NORM_ANGLE(wp->ang);
|
||||||
|
@ -18171,7 +18167,7 @@ int InitSobjGun(PLAYERp pp)
|
||||||
SpawnVis(actor, -1, -1, -1, -1, 8);
|
SpawnVis(actor, -1, -1, -1, -1, 8);
|
||||||
SpawnBigGunFlames(actor->GetSpriteIndex(), pp->PlayerSprite, pp->sop, false);
|
SpawnBigGunFlames(actor->GetSpriteIndex(), pp->PlayerSprite, pp->sop, false);
|
||||||
SetGunQuake(actor->GetSpriteIndex());
|
SetGunQuake(actor->GetSpriteIndex());
|
||||||
InitTankShell(actor->GetSpriteIndex(), pp);
|
InitTankShell(actor, pp);
|
||||||
if (!SP_TAG5(sp))
|
if (!SP_TAG5(sp))
|
||||||
pp->FirePause = 80;
|
pp->FirePause = 80;
|
||||||
else
|
else
|
||||||
|
|
Loading…
Reference in a new issue