mirror of
https://github.com/ZDoom/Raze.git
synced 2024-11-15 17:01:28 +00:00
- the remaining s()'s in jweapon.cpp
This commit is contained in:
parent
571dccda76
commit
eba5d222c0
1 changed files with 41 additions and 54 deletions
|
@ -403,13 +403,12 @@ int DoBloodSpray(DSWActor* actor)
|
||||||
{
|
{
|
||||||
short wall_ang;
|
short wall_ang;
|
||||||
auto hitActor = u->coll.actor();
|
auto hitActor = u->coll.actor();
|
||||||
SPRITEp hsp = &hitActor->s();
|
|
||||||
|
|
||||||
if (TEST(hsp->cstat, CSTAT_SPRITE_ALIGNMENT_WALL))
|
if (TEST(hitActor->spr.cstat, CSTAT_SPRITE_ALIGNMENT_WALL))
|
||||||
{
|
{
|
||||||
wall_ang = NORM_ANGLE(hsp->ang);
|
wall_ang = NORM_ANGLE(hitActor->spr.ang);
|
||||||
SpawnMidSplash(actor);
|
SpawnMidSplash(actor);
|
||||||
QueueWallBlood(actor, hsp->ang);
|
QueueWallBlood(actor, hitActor->spr.ang);
|
||||||
WallBounce(actor, wall_ang);
|
WallBounce(actor, wall_ang);
|
||||||
ScaleSpriteVector(actor, 32000);
|
ScaleSpriteVector(actor, 32000);
|
||||||
}
|
}
|
||||||
|
@ -417,7 +416,7 @@ int DoBloodSpray(DSWActor* actor)
|
||||||
{
|
{
|
||||||
u->xchange = u->ychange = 0;
|
u->xchange = u->ychange = 0;
|
||||||
SpawnMidSplash(actor);
|
SpawnMidSplash(actor);
|
||||||
QueueWallBlood(actor, hsp->ang);
|
QueueWallBlood(actor, hitActor->spr.ang);
|
||||||
KillActor(actor);
|
KillActor(actor);
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
@ -598,26 +597,23 @@ int DoPhosphorus(DSWActor* actor)
|
||||||
case kHitSprite:
|
case kHitSprite:
|
||||||
{
|
{
|
||||||
short wall_ang;
|
short wall_ang;
|
||||||
SPRITEp hsp;
|
|
||||||
USERp hu;
|
USERp hu;
|
||||||
|
|
||||||
|
|
||||||
auto hitActor = u->coll.actor();
|
auto hitActor = u->coll.actor();
|
||||||
hsp = &hitActor->s();
|
|
||||||
hu = hitActor->u();
|
hu = hitActor->u();
|
||||||
|
|
||||||
if (TEST(hsp->cstat, CSTAT_SPRITE_ALIGNMENT_WALL))
|
if (TEST(hitActor->spr.cstat, CSTAT_SPRITE_ALIGNMENT_WALL))
|
||||||
{
|
{
|
||||||
wall_ang = NORM_ANGLE(hsp->ang);
|
wall_ang = NORM_ANGLE(hitActor->spr.ang);
|
||||||
WallBounce(actor, wall_ang);
|
WallBounce(actor, wall_ang);
|
||||||
ScaleSpriteVector(actor, 32000);
|
ScaleSpriteVector(actor, 32000);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
if (TEST(hsp->extra, SPRX_BURNABLE))
|
if (TEST(hitActor->spr.extra, SPRX_BURNABLE))
|
||||||
{
|
{
|
||||||
if (!hu)
|
if (!hu)
|
||||||
hu = SpawnUser(hitActor, hsp->picnum, nullptr);
|
hu = SpawnUser(hitActor, hitActor->spr.picnum, nullptr);
|
||||||
SpawnFireballExp(actor);
|
SpawnFireballExp(actor);
|
||||||
if (hu)
|
if (hu)
|
||||||
SpawnFireballFlames(actor, hitActor);
|
SpawnFireballFlames(actor, hitActor);
|
||||||
|
@ -1047,11 +1043,10 @@ int DoCaltrops(DSWActor* actor)
|
||||||
PlaySound(DIGI_CALTROPS, actor, v3df_dontpan);
|
PlaySound(DIGI_CALTROPS, actor, v3df_dontpan);
|
||||||
|
|
||||||
auto hitActor = u->coll.actor();
|
auto hitActor = u->coll.actor();
|
||||||
auto hsp = &hitActor->s();
|
|
||||||
|
|
||||||
if (TEST(hsp->cstat, CSTAT_SPRITE_ALIGNMENT_WALL))
|
if (TEST(hitActor->spr.cstat, CSTAT_SPRITE_ALIGNMENT_WALL))
|
||||||
{
|
{
|
||||||
wall_ang = NORM_ANGLE(hsp->ang);
|
wall_ang = NORM_ANGLE(hitActor->spr.ang);
|
||||||
WallBounce(actor, wall_ang);
|
WallBounce(actor, wall_ang);
|
||||||
ScaleSpriteVector(actor, 10000);
|
ScaleSpriteVector(actor, 10000);
|
||||||
}
|
}
|
||||||
|
@ -1326,14 +1321,14 @@ int PlayerInitChemBomb(PLAYERp pp)
|
||||||
|
|
||||||
actorNew->spr.zvel = -pp->horizon.horiz.asq16() >> 9;
|
actorNew->spr.zvel = -pp->horizon.horiz.asq16() >> 9;
|
||||||
|
|
||||||
auto psp = &pp->Actor()->s();
|
DSWActor* plActor = pp->actor;
|
||||||
oclipdist = psp->clipdist;
|
oclipdist = plActor->spr.clipdist;
|
||||||
psp->clipdist = 0;
|
plActor->spr.clipdist = 0;
|
||||||
actorNew->spr.clipdist = 0;
|
actorNew->spr.clipdist = 0;
|
||||||
|
|
||||||
MissileSetPos(actorNew, DoChemBomb, 1000);
|
MissileSetPos(actorNew, DoChemBomb, 1000);
|
||||||
|
|
||||||
psp->clipdist = uint8_t(oclipdist);
|
plActor->spr.clipdist = uint8_t(oclipdist);
|
||||||
actorNew->spr.clipdist = 80L >> 2;
|
actorNew->spr.clipdist = 80L >> 2;
|
||||||
|
|
||||||
wu->xchange = MOVEx(actorNew->spr.xvel, actorNew->spr.ang);
|
wu->xchange = MOVEx(actorNew->spr.xvel, actorNew->spr.ang);
|
||||||
|
@ -1486,20 +1481,19 @@ int PlayerInitFlashBomb(PLAYERp pp)
|
||||||
SWStatIterator it(StatDamageList[stat]);
|
SWStatIterator it(StatDamageList[stat]);
|
||||||
while (auto itActor = it.Next())
|
while (auto itActor = it.Next())
|
||||||
{
|
{
|
||||||
auto hp = &itActor->s();
|
|
||||||
hu = itActor->u();
|
hu = itActor->u();
|
||||||
|
|
||||||
if (itActor == pp->Actor())
|
if (itActor == pp->Actor())
|
||||||
break;
|
break;
|
||||||
|
|
||||||
DISTANCE(hp->pos.X, hp->pos.Y, actor->spr.pos.X, actor->spr.pos.Y, dist, tx, ty, tmin);
|
DISTANCE(itActor->spr.pos.X, itActor->spr.pos.Y, actor->spr.pos.X, actor->spr.pos.Y, dist, tx, ty, tmin);
|
||||||
if (dist > 16384) // Flash radius
|
if (dist > 16384) // Flash radius
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
if (!TEST(actor->spr.cstat, CSTAT_SPRITE_BLOCK))
|
if (!TEST(actor->spr.cstat, CSTAT_SPRITE_BLOCK))
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
if (!FAFcansee(hp->pos.X, hp->pos.Y, hp->pos.Z, hp->sector(), actor->spr.pos.X, actor->spr.pos.Y, actor->spr.pos.Z - ActorSizeZ(actor), actor->spr.sector()))
|
if (!FAFcansee(itActor->spr.pos.X, itActor->spr.pos.Y, itActor->spr.pos.Z, itActor->spr.sector(), actor->spr.pos.X, actor->spr.pos.Y, actor->spr.pos.Z - ActorSizeZ(actor), actor->spr.sector()))
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
damage = GetDamage(itActor, pp->Actor(), DMG_FLASHBOMB);
|
damage = GetDamage(itActor, pp->Actor(), DMG_FLASHBOMB);
|
||||||
|
@ -1542,7 +1536,6 @@ int InitFlashBomb(DSWActor* actor)
|
||||||
unsigned int stat;
|
unsigned int stat;
|
||||||
int dist, tx, ty, tmin;
|
int dist, tx, ty, tmin;
|
||||||
short damage;
|
short damage;
|
||||||
SPRITEp hp;
|
|
||||||
USERp hu;
|
USERp hu;
|
||||||
PLAYERp pp = Player + screenpeek;
|
PLAYERp pp = Player + screenpeek;
|
||||||
|
|
||||||
|
@ -1553,17 +1546,16 @@ int InitFlashBomb(DSWActor* actor)
|
||||||
SWStatIterator it(StatDamageList[stat]);
|
SWStatIterator it(StatDamageList[stat]);
|
||||||
while (auto itActor = it.Next())
|
while (auto itActor = it.Next())
|
||||||
{
|
{
|
||||||
hp = &itActor->s();
|
|
||||||
hu = itActor->u();
|
hu = itActor->u();
|
||||||
|
|
||||||
DISTANCE(hp->pos.X, hp->pos.Y, actor->spr.pos.X, actor->spr.pos.Y, dist, tx, ty, tmin);
|
DISTANCE(itActor->spr.pos.X, itActor->spr.pos.Y, actor->spr.pos.X, actor->spr.pos.Y, dist, tx, ty, tmin);
|
||||||
if (dist > 16384) // Flash radius
|
if (dist > 16384) // Flash radius
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
if (!TEST(actor->spr.cstat, CSTAT_SPRITE_BLOCK))
|
if (!TEST(actor->spr.cstat, CSTAT_SPRITE_BLOCK))
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
if (!FAFcansee(hp->pos.X, hp->pos.Y, hp->pos.Z, hp->sector(), actor->spr.pos.X, actor->spr.pos.Y, actor->spr.pos.Z - ActorSizeZ(actor), actor->spr.sector()))
|
if (!FAFcansee(itActor->spr.pos.X, itActor->spr.pos.Y, itActor->spr.pos.Z, itActor->spr.sector(), actor->spr.pos.X, actor->spr.pos.Y, actor->spr.pos.Z - ActorSizeZ(actor), actor->spr.sector()))
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
damage = GetDamage(itActor, actor, DMG_FLASHBOMB);
|
damage = GetDamage(itActor, actor, DMG_FLASHBOMB);
|
||||||
|
@ -1729,14 +1721,14 @@ int PlayerInitCaltrops(PLAYERp pp)
|
||||||
|
|
||||||
spawnedActor->spr.zvel = -pp->horizon.horiz.asq16() >> 9;
|
spawnedActor->spr.zvel = -pp->horizon.horiz.asq16() >> 9;
|
||||||
|
|
||||||
auto psp = &pp->Actor()->s();
|
DSWActor* plActor = pp->actor;
|
||||||
oclipdist = psp->clipdist;
|
oclipdist = plActor->spr.clipdist;
|
||||||
psp->clipdist = 0;
|
plActor->spr.clipdist = 0;
|
||||||
spawnedActor->spr.clipdist = 0;
|
spawnedActor->spr.clipdist = 0;
|
||||||
|
|
||||||
MissileSetPos(spawnedActor, DoCaltrops, 1000);
|
MissileSetPos(spawnedActor, DoCaltrops, 1000);
|
||||||
|
|
||||||
psp->clipdist = uint8_t(oclipdist);
|
plActor->spr.clipdist = uint8_t(oclipdist);
|
||||||
spawnedActor->spr.clipdist = 80L >> 2;
|
spawnedActor->spr.clipdist = 80L >> 2;
|
||||||
|
|
||||||
wu->xchange = MOVEx(spawnedActor->spr.xvel, spawnedActor->spr.ang);
|
wu->xchange = MOVEx(spawnedActor->spr.xvel, spawnedActor->spr.ang);
|
||||||
|
@ -2008,7 +2000,6 @@ int DoCarryFlag(DSWActor* actor)
|
||||||
const int FLAG_DETONATE_STATE = 99;
|
const int FLAG_DETONATE_STATE = 99;
|
||||||
DSWActor* fown = u->flagOwnerActor;
|
DSWActor* fown = u->flagOwnerActor;
|
||||||
if (!fown) return 0;
|
if (!fown) return 0;
|
||||||
SPRITEp fp = &fown->s();
|
|
||||||
USERp fu = fown->u();
|
USERp fu = fown->u();
|
||||||
|
|
||||||
DSWActor* attached = u->attachActor;
|
DSWActor* attached = u->attachActor;
|
||||||
|
@ -2044,34 +2035,33 @@ int DoCarryFlag(DSWActor* actor)
|
||||||
// not already in detonate state
|
// not already in detonate state
|
||||||
if (u->Counter2 < FLAG_DETONATE_STATE)
|
if (u->Counter2 < FLAG_DETONATE_STATE)
|
||||||
{
|
{
|
||||||
SPRITEp ap = &u->attachActor->s();
|
USERp au = attached->u();
|
||||||
USERp au = u->attachActor->u();
|
|
||||||
|
|
||||||
if (!au || au->Health <= 0)
|
if (!attached->hasU() || au->Health <= 0)
|
||||||
{
|
{
|
||||||
u->Counter2 = FLAG_DETONATE_STATE;
|
u->Counter2 = FLAG_DETONATE_STATE;
|
||||||
u->WaitTics = SEC(1) / 2;
|
u->WaitTics = SEC(1) / 2;
|
||||||
}
|
}
|
||||||
// if in score box, score.
|
// if in score box, score.
|
||||||
if (ap->sector()->hitag == 9000 && ap->sector()->lotag == ap->pal
|
if (attached->spr.sector()->hitag == 9000 && attached->spr.sector()->lotag == attached->spr.pal
|
||||||
&& ap->pal != actor->spr.pal)
|
&& attached->spr.pal != actor->spr.pal)
|
||||||
{
|
{
|
||||||
if (fown != nullptr)
|
if (fown != nullptr)
|
||||||
{
|
{
|
||||||
if (fp->lotag) // Trigger everything if there is a lotag
|
if (fown->spr.lotag) // Trigger everything if there is a lotag
|
||||||
DoMatchEverything(nullptr, fp->lotag, ON);
|
DoMatchEverything(nullptr, fown->spr.lotag, ON);
|
||||||
}
|
}
|
||||||
if (!TEST_BOOL1(fp))
|
if (!TEST_BOOL1(fown))
|
||||||
{
|
{
|
||||||
PlaySound(DIGI_BIGITEM, u->attachActor, v3df_none);
|
PlaySound(DIGI_BIGITEM, u->attachActor, v3df_none);
|
||||||
DoFlagScore(ap->pal);
|
DoFlagScore(attached->spr.pal);
|
||||||
if (SP_TAG5(fp) > 0)
|
if (SP_TAG5(fown) > 0)
|
||||||
{
|
{
|
||||||
fu->filler++;
|
fu->filler++;
|
||||||
if (fu->filler >= SP_TAG5(fp))
|
if (fu->filler >= SP_TAG5(fown))
|
||||||
{
|
{
|
||||||
fu->filler = 0;
|
fu->filler = 0;
|
||||||
DoMatchEverything(nullptr, SP_TAG6(fp), ON);
|
DoMatchEverything(nullptr, SP_TAG6(fown), ON);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -2163,7 +2153,6 @@ int DoCarryFlagNoDet(DSWActor* actor)
|
||||||
USERp au = attached->u();
|
USERp au = attached->u();
|
||||||
DSWActor* fown = u->flagOwnerActor;
|
DSWActor* fown = u->flagOwnerActor;
|
||||||
if (!fown) return 0;
|
if (!fown) return 0;
|
||||||
SPRITEp fp = &fown->s();
|
|
||||||
USERp fu = fown->u();
|
USERp fu = fown->u();
|
||||||
|
|
||||||
|
|
||||||
|
@ -2193,21 +2182,21 @@ int DoCarryFlagNoDet(DSWActor* actor)
|
||||||
{
|
{
|
||||||
if (u->flagOwnerActor != nullptr)
|
if (u->flagOwnerActor != nullptr)
|
||||||
{
|
{
|
||||||
if (fp->lotag) // Trigger everything if there is a lotag
|
if (fown->spr.lotag) // Trigger everything if there is a lotag
|
||||||
DoMatchEverything(nullptr, fp->lotag, ON);
|
DoMatchEverything(nullptr, fown->spr.lotag, ON);
|
||||||
fu->WaitTics = 0; // Tell it to respawn
|
fu->WaitTics = 0; // Tell it to respawn
|
||||||
}
|
}
|
||||||
if (!TEST_BOOL1(fp))
|
if (!TEST_BOOL1(fown))
|
||||||
{
|
{
|
||||||
PlaySound(DIGI_BIGITEM, u->attachActor, v3df_none);
|
PlaySound(DIGI_BIGITEM, u->attachActor, v3df_none);
|
||||||
DoFlagScore(attached->spr.pal);
|
DoFlagScore(attached->spr.pal);
|
||||||
if (SP_TAG5(fp) > 0)
|
if (SP_TAG5(fown) > 0)
|
||||||
{
|
{
|
||||||
fu->filler++;
|
fu->filler++;
|
||||||
if (fu->filler >= SP_TAG5(fp))
|
if (fu->filler >= SP_TAG5(fown))
|
||||||
{
|
{
|
||||||
fu->filler = 0;
|
fu->filler = 0;
|
||||||
DoMatchEverything(nullptr, SP_TAG6(fp), ON);
|
DoMatchEverything(nullptr, SP_TAG6(fown), ON);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -2246,17 +2235,15 @@ int DoFlag(DSWActor* actor)
|
||||||
|
|
||||||
if (hitActor)
|
if (hitActor)
|
||||||
{
|
{
|
||||||
SPRITEp hsp = &hitActor->s();
|
|
||||||
|
|
||||||
SetCarryFlag(actor);
|
SetCarryFlag(actor);
|
||||||
|
|
||||||
// check to see if sprite is player or enemy
|
// check to see if sprite is player or enemy
|
||||||
if (TEST(hsp->extra, SPRX_PLAYER_OR_ENEMY))
|
if (TEST(hitActor->spr.extra, SPRX_PLAYER_OR_ENEMY))
|
||||||
{
|
{
|
||||||
// attach weapon to sprite
|
// attach weapon to sprite
|
||||||
RESET(actor->spr.cstat, CSTAT_SPRITE_BLOCK | CSTAT_SPRITE_BLOCK_HITSCAN);
|
RESET(actor->spr.cstat, CSTAT_SPRITE_BLOCK | CSTAT_SPRITE_BLOCK_HITSCAN);
|
||||||
SetAttach(hitActor, actor);
|
SetAttach(hitActor, actor);
|
||||||
u->sz = hsp->pos.Z - DIV2(GetSpriteSizeZ(hsp));
|
u->sz = hitActor->spr.pos.Z - (ActorSizeZ(hitActor) >> 1);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue