mirror of
https://github.com/DrBeef/Raze.git
synced 2025-01-19 23:51:01 +00:00
- all wp not referencing actorNew.
This commit is contained in:
parent
2398073529
commit
cd7f13c4ba
2 changed files with 64 additions and 79 deletions
|
@ -1699,11 +1699,9 @@ int PlayerInitCaltrops(PLAYERp pp)
|
||||||
{
|
{
|
||||||
USERp u = pp->Actor()->u();
|
USERp u = pp->Actor()->u();
|
||||||
USERp wu;
|
USERp wu;
|
||||||
SPRITEp wp;
|
|
||||||
int nx, ny, nz;
|
int nx, ny, nz;
|
||||||
short oclipdist;
|
short oclipdist;
|
||||||
|
|
||||||
|
|
||||||
PlaySound(DIGI_THROW, pp, v3df_dontpan | v3df_doppler);
|
PlaySound(DIGI_THROW, pp, v3df_dontpan | v3df_doppler);
|
||||||
|
|
||||||
if (!pp->insector())
|
if (!pp->insector())
|
||||||
|
@ -1716,49 +1714,48 @@ int PlayerInitCaltrops(PLAYERp pp)
|
||||||
auto spawnedActor = SpawnActor(STAT_DEAD_ACTOR, CALTROPS, s_Caltrops, pp->cursector,
|
auto spawnedActor = SpawnActor(STAT_DEAD_ACTOR, CALTROPS, s_Caltrops, pp->cursector,
|
||||||
nx, ny, nz, pp->angle.ang.asbuild(), (CHEMBOMB_VELOCITY + RandomRange(CHEMBOMB_VELOCITY)) / 2);
|
nx, ny, nz, pp->angle.ang.asbuild(), (CHEMBOMB_VELOCITY + RandomRange(CHEMBOMB_VELOCITY)) / 2);
|
||||||
|
|
||||||
wp = &spawnedActor->s();
|
|
||||||
wu = spawnedActor->u();
|
wu = spawnedActor->u();
|
||||||
|
|
||||||
// don't throw it as far if crawling
|
// don't throw it as far if crawling
|
||||||
if (TEST(pp->Flags, PF_CRAWLING))
|
if (TEST(pp->Flags, PF_CRAWLING))
|
||||||
{
|
{
|
||||||
wp->xvel -= (wp->xvel >> 2);
|
spawnedActor->spr.xvel -= (spawnedActor->spr.xvel >> 2);
|
||||||
}
|
}
|
||||||
|
|
||||||
SET(wu->Flags, SPR_XFLIP_TOGGLE);
|
SET(wu->Flags, SPR_XFLIP_TOGGLE);
|
||||||
|
|
||||||
SetOwner(pp->Actor(), spawnedActor);
|
SetOwner(pp->Actor(), spawnedActor);
|
||||||
wp->yrepeat = 64;
|
spawnedActor->spr.yrepeat = 64;
|
||||||
wp->xrepeat = 64;
|
spawnedActor->spr.xrepeat = 64;
|
||||||
wp->shade = -15;
|
spawnedActor->spr.shade = -15;
|
||||||
wu->WeaponNum = u->WeaponNum;
|
wu->WeaponNum = u->WeaponNum;
|
||||||
wu->Radius = 200;
|
wu->Radius = 200;
|
||||||
wu->ceiling_dist = Z(3);
|
wu->ceiling_dist = Z(3);
|
||||||
wu->floor_dist = Z(3);
|
wu->floor_dist = Z(3);
|
||||||
wu->Counter = 0;
|
wu->Counter = 0;
|
||||||
// SET(wp->cstat, CSTAT_SPRITE_BLOCK);
|
// SET(spawnedActor->spr.cstat, CSTAT_SPRITE_BLOCK);
|
||||||
|
|
||||||
if (TEST(pp->Flags, PF_DIVING) || SpriteInUnderwaterArea(wp))
|
if (TEST(pp->Flags, PF_DIVING) || SpriteInUnderwaterArea(spawnedActor))
|
||||||
SET(wu->Flags, SPR_UNDERWATER);
|
SET(wu->Flags, SPR_UNDERWATER);
|
||||||
|
|
||||||
// They go out at different angles
|
// They go out at different angles
|
||||||
// wp->ang = NORM_ANGLE(pp->angle.ang.asbuild() + (RandomRange(50) - 25));
|
// spawnedActor->spr.ang = NORM_ANGLE(pp->angle.ang.asbuild() + (RandomRange(50) - 25));
|
||||||
|
|
||||||
wp->zvel = -pp->horizon.horiz.asq16() >> 9;
|
spawnedActor->spr.zvel = -pp->horizon.horiz.asq16() >> 9;
|
||||||
|
|
||||||
auto psp = &pp->Actor()->s();
|
auto psp = &pp->Actor()->s();
|
||||||
oclipdist = psp->clipdist;
|
oclipdist = psp->clipdist;
|
||||||
psp->clipdist = 0;
|
psp->clipdist = 0;
|
||||||
wp->clipdist = 0;
|
spawnedActor->spr.clipdist = 0;
|
||||||
|
|
||||||
MissileSetPos(spawnedActor, DoCaltrops, 1000);
|
MissileSetPos(spawnedActor, DoCaltrops, 1000);
|
||||||
|
|
||||||
psp->clipdist = uint8_t(oclipdist);
|
psp->clipdist = uint8_t(oclipdist);
|
||||||
wp->clipdist = 80L >> 2;
|
spawnedActor->spr.clipdist = 80L >> 2;
|
||||||
|
|
||||||
wu->xchange = MOVEx(wp->xvel, wp->ang);
|
wu->xchange = MOVEx(spawnedActor->spr.xvel, spawnedActor->spr.ang);
|
||||||
wu->ychange = MOVEy(wp->xvel, wp->ang);
|
wu->ychange = MOVEy(spawnedActor->spr.xvel, spawnedActor->spr.ang);
|
||||||
wu->zchange = wp->zvel >> 1;
|
wu->zchange = spawnedActor->spr.zvel >> 1;
|
||||||
|
|
||||||
// adjust xvel according to player velocity
|
// adjust xvel according to player velocity
|
||||||
wu->xchange += pp->xvect >> 14;
|
wu->xchange += pp->xvect >> 14;
|
||||||
|
@ -1772,10 +1769,8 @@ int InitCaltrops(DSWActor* actor)
|
||||||
{
|
{
|
||||||
USERp u = actor->u();
|
USERp u = actor->u();
|
||||||
USERp wu;
|
USERp wu;
|
||||||
SPRITEp wp;
|
|
||||||
int nx, ny, nz;
|
int nx, ny, nz;
|
||||||
|
|
||||||
|
|
||||||
PlaySound(DIGI_THROW, actor, v3df_dontpan | v3df_doppler);
|
PlaySound(DIGI_THROW, actor, v3df_dontpan | v3df_doppler);
|
||||||
|
|
||||||
nx = actor->spr.pos.X;
|
nx = actor->spr.pos.X;
|
||||||
|
@ -1787,30 +1782,29 @@ int InitCaltrops(DSWActor* actor)
|
||||||
auto spawnedActor = SpawnActor(STAT_DEAD_ACTOR, CALTROPS, s_Caltrops, actor->spr.sector(),
|
auto spawnedActor = SpawnActor(STAT_DEAD_ACTOR, CALTROPS, s_Caltrops, actor->spr.sector(),
|
||||||
nx, ny, nz, actor->spr.ang, CHEMBOMB_VELOCITY / 2);
|
nx, ny, nz, actor->spr.ang, CHEMBOMB_VELOCITY / 2);
|
||||||
|
|
||||||
wp = &spawnedActor->s();
|
|
||||||
wu = spawnedActor->u();
|
wu = spawnedActor->u();
|
||||||
|
|
||||||
SET(wu->Flags, SPR_XFLIP_TOGGLE);
|
SET(wu->Flags, SPR_XFLIP_TOGGLE);
|
||||||
|
|
||||||
SetOwner(actor, spawnedActor);
|
SetOwner(actor, spawnedActor);
|
||||||
wp->yrepeat = 64;
|
spawnedActor->spr.yrepeat = 64;
|
||||||
wp->xrepeat = 64;
|
spawnedActor->spr.xrepeat = 64;
|
||||||
wp->shade = -15;
|
spawnedActor->spr.shade = -15;
|
||||||
// !FRANK - clipbox must be <= weapon otherwise can clip thru walls
|
// !FRANK - clipbox must be <= weapon otherwise can clip thru walls
|
||||||
wp->clipdist = actor->spr.clipdist;
|
spawnedActor->spr.clipdist = actor->spr.clipdist;
|
||||||
wu->WeaponNum = u->WeaponNum;
|
wu->WeaponNum = u->WeaponNum;
|
||||||
wu->Radius = 200;
|
wu->Radius = 200;
|
||||||
wu->ceiling_dist = Z(3);
|
wu->ceiling_dist = Z(3);
|
||||||
wu->floor_dist = Z(3);
|
wu->floor_dist = Z(3);
|
||||||
wu->Counter = 0;
|
wu->Counter = 0;
|
||||||
|
|
||||||
wp->zvel = short(-RandomRange(100) * HORIZ_MULT);
|
spawnedActor->spr.zvel = short(-RandomRange(100) * HORIZ_MULT);
|
||||||
|
|
||||||
// wp->clipdist = 80L>>2;
|
// spawnedActor->spr.clipdist = 80L>>2;
|
||||||
|
|
||||||
wu->xchange = MOVEx(wp->xvel, wp->ang);
|
wu->xchange = MOVEx(spawnedActor->spr.xvel, spawnedActor->spr.ang);
|
||||||
wu->ychange = MOVEy(wp->xvel, wp->ang);
|
wu->ychange = MOVEy(spawnedActor->spr.xvel, spawnedActor->spr.ang);
|
||||||
wu->zchange = wp->zvel >> 1;
|
wu->zchange = spawnedActor->spr.zvel >> 1;
|
||||||
|
|
||||||
SetupSpriteForBreak(spawnedActor); // Put Caltrops in the break queue
|
SetupSpriteForBreak(spawnedActor); // Put Caltrops in the break queue
|
||||||
return 0;
|
return 0;
|
||||||
|
@ -1989,8 +1983,6 @@ void DoFlagScore(int16_t pal)
|
||||||
|
|
||||||
DSWActor* DoFlagRangeTest(DSWActor* actor, int range)
|
DSWActor* DoFlagRangeTest(DSWActor* actor, int range)
|
||||||
{
|
{
|
||||||
SPRITEp wp = &actor->s();
|
|
||||||
|
|
||||||
unsigned int stat;
|
unsigned int stat;
|
||||||
int dist, tx, ty;
|
int dist, tx, ty;
|
||||||
int tmin;
|
int tmin;
|
||||||
|
@ -2000,7 +1992,7 @@ DSWActor* DoFlagRangeTest(DSWActor* actor, int range)
|
||||||
SWStatIterator it(StatDamageList[stat]);
|
SWStatIterator it(StatDamageList[stat]);
|
||||||
while (auto itActor = it.Next())
|
while (auto itActor = it.Next())
|
||||||
{
|
{
|
||||||
DISTANCE(itActor->spr.pos.X, itActor->spr.pos.Y, wp->pos.X, wp->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 > range)
|
if (dist > range)
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
|
@ -2013,10 +2005,10 @@ DSWActor* DoFlagRangeTest(DSWActor* actor, int range)
|
||||||
if (!TEST(itActor->spr.extra, SPRX_PLAYER_OR_ENEMY))
|
if (!TEST(itActor->spr.extra, SPRX_PLAYER_OR_ENEMY))
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
if (!FAFcansee(itActor->spr.pos.X, itActor->spr.pos.Y, itActor->spr.pos.Z, itActor->spr.sector(), wp->pos.X, wp->pos.Y, wp->pos.Z, wp->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, actor->spr.sector()))
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
dist = FindDistance3D(wp->pos.X - itActor->spr.pos.X, wp->pos.Y - itActor->spr.pos.Y, wp->pos.Z - itActor->spr.pos.Z);
|
dist = FindDistance3D(actor->spr.pos.X - itActor->spr.pos.X, actor->spr.pos.Y - itActor->spr.pos.Y, actor->spr.pos.Z - itActor->spr.pos.Z);
|
||||||
if (dist > range)
|
if (dist > range)
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
|
|
|
@ -11450,7 +11450,6 @@ int DoMirv(DSWActor* actor)
|
||||||
|
|
||||||
bool MissileSetPos(DSWActor* actor, ANIMATORp DoWeapon, int dist)
|
bool MissileSetPos(DSWActor* actor, ANIMATORp DoWeapon, int dist)
|
||||||
{
|
{
|
||||||
SPRITEp wp = &actor->s();
|
|
||||||
USERp wu = actor->u();
|
USERp wu = actor->u();
|
||||||
int oldvel, oldzvel;
|
int oldvel, oldzvel;
|
||||||
int oldxc, oldyc, oldzc;
|
int oldxc, oldyc, oldzc;
|
||||||
|
@ -11460,18 +11459,18 @@ bool MissileSetPos(DSWActor* actor, ANIMATORp DoWeapon, int dist)
|
||||||
oldxc = wu->xchange;
|
oldxc = wu->xchange;
|
||||||
oldyc = wu->ychange;
|
oldyc = wu->ychange;
|
||||||
oldzc = wu->zchange;
|
oldzc = wu->zchange;
|
||||||
oldvel = wp->xvel;
|
oldvel = actor->spr.xvel;
|
||||||
oldzvel = wp->zvel;
|
oldzvel = actor->spr.zvel;
|
||||||
|
|
||||||
// make missile move in smaller increments
|
// make missile move in smaller increments
|
||||||
wp->xvel = short((dist * 6) / MISSILEMOVETICS);
|
actor->spr.xvel = short((dist * 6) / MISSILEMOVETICS);
|
||||||
//wp->zvel = (wp->zvel*4) / MISSILEMOVETICS;
|
//actor->spr.zvel = (actor->spr.zvel*4) / MISSILEMOVETICS;
|
||||||
wp->zvel = short((wp->zvel*6) / MISSILEMOVETICS);
|
actor->spr.zvel = short((actor->spr.zvel*6) / MISSILEMOVETICS);
|
||||||
|
|
||||||
// some Weapon Animators use this
|
// some Weapon Animators use this
|
||||||
wu->xchange = MOVEx(wp->xvel, wp->ang);
|
wu->xchange = MOVEx(actor->spr.xvel, actor->spr.ang);
|
||||||
wu->ychange = MOVEy(wp->xvel, wp->ang);
|
wu->ychange = MOVEy(actor->spr.xvel, actor->spr.ang);
|
||||||
wu->zchange = wp->zvel;
|
wu->zchange = actor->spr.zvel;
|
||||||
|
|
||||||
SET(wu->Flags, SPR_SET_POS_DONT_KILL);
|
SET(wu->Flags, SPR_SET_POS_DONT_KILL);
|
||||||
if ((*DoWeapon)(actor))
|
if ((*DoWeapon)(actor))
|
||||||
|
@ -11482,18 +11481,17 @@ bool MissileSetPos(DSWActor* actor, ANIMATORp DoWeapon, int dist)
|
||||||
wu->xchange = oldxc;
|
wu->xchange = oldxc;
|
||||||
wu->ychange = oldyc;
|
wu->ychange = oldyc;
|
||||||
wu->zchange = oldzc;
|
wu->zchange = oldzc;
|
||||||
wp->xvel = oldvel;
|
actor->spr.xvel = oldvel;
|
||||||
wp->zvel = oldzvel;
|
actor->spr.zvel = oldzvel;
|
||||||
|
|
||||||
// update for interpolation
|
// update for interpolation
|
||||||
wp->backuppos();
|
actor->spr.backuppos();
|
||||||
|
|
||||||
return retval;
|
return retval;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool TestMissileSetPos(DSWActor* actor, ANIMATORp DoWeapon, int dist, int zvel)
|
bool TestMissileSetPos(DSWActor* actor, ANIMATORp DoWeapon, int dist, int zvel)
|
||||||
{
|
{
|
||||||
SPRITEp wp = &actor->s();
|
|
||||||
USERp wu = actor->u();
|
USERp wu = actor->u();
|
||||||
int oldvel, oldzvel;
|
int oldvel, oldzvel;
|
||||||
int oldxc, oldyc, oldzc;
|
int oldxc, oldyc, oldzc;
|
||||||
|
@ -11503,17 +11501,17 @@ bool TestMissileSetPos(DSWActor* actor, ANIMATORp DoWeapon, int dist, int zvel)
|
||||||
oldxc = wu->xchange;
|
oldxc = wu->xchange;
|
||||||
oldyc = wu->ychange;
|
oldyc = wu->ychange;
|
||||||
oldzc = wu->zchange;
|
oldzc = wu->zchange;
|
||||||
oldvel = wp->xvel;
|
oldvel = actor->spr.xvel;
|
||||||
oldzvel = wp->zvel;
|
oldzvel = actor->spr.zvel;
|
||||||
|
|
||||||
// make missile move in smaller increments
|
// make missile move in smaller increments
|
||||||
wp->xvel = short((dist * 6) / MISSILEMOVETICS);
|
actor->spr.xvel = short((dist * 6) / MISSILEMOVETICS);
|
||||||
//wp->zvel = (wp->zvel*4) / MISSILEMOVETICS;
|
//actor->spr.zvel = (actor->spr.zvel*4) / MISSILEMOVETICS;
|
||||||
zvel = short((zvel*6) / MISSILEMOVETICS);
|
zvel = short((zvel*6) / MISSILEMOVETICS);
|
||||||
|
|
||||||
// some Weapon Animators use this
|
// some Weapon Animators use this
|
||||||
wu->xchange = MOVEx(wp->xvel, wp->ang);
|
wu->xchange = MOVEx(actor->spr.xvel, actor->spr.ang);
|
||||||
wu->ychange = MOVEy(wp->xvel, wp->ang);
|
wu->ychange = MOVEy(actor->spr.xvel, actor->spr.ang);
|
||||||
wu->zchange = zvel;
|
wu->zchange = zvel;
|
||||||
|
|
||||||
SET(wu->Flags, SPR_SET_POS_DONT_KILL);
|
SET(wu->Flags, SPR_SET_POS_DONT_KILL);
|
||||||
|
@ -11525,11 +11523,11 @@ bool TestMissileSetPos(DSWActor* actor, ANIMATORp DoWeapon, int dist, int zvel)
|
||||||
wu->xchange = oldxc;
|
wu->xchange = oldxc;
|
||||||
wu->ychange = oldyc;
|
wu->ychange = oldyc;
|
||||||
wu->zchange = oldzc;
|
wu->zchange = oldzc;
|
||||||
wp->xvel = oldvel;
|
actor->spr.xvel = oldvel;
|
||||||
wp->zvel = oldzvel;
|
actor->spr.zvel = oldzvel;
|
||||||
|
|
||||||
// update for interpolation
|
// update for interpolation
|
||||||
wp->backuppos();
|
actor->spr.backuppos();
|
||||||
|
|
||||||
return retval;
|
return retval;
|
||||||
}
|
}
|
||||||
|
@ -12669,19 +12667,19 @@ int InitSumoNapalm(DSWActor* actor)
|
||||||
{
|
{
|
||||||
for (size_t i = 0; i < countof(mp); i++)
|
for (size_t i = 0; i < countof(mp); i++)
|
||||||
{
|
{
|
||||||
auto wActor = SpawnActor(STAT_MISSILE, FIREBALL1, s_Napalm, actor->spr.sector(),
|
auto actorNew = SpawnActor(STAT_MISSILE, FIREBALL1, s_Napalm, actor->spr.sector(),
|
||||||
actor->spr.pos.X, actor->spr.pos.Y, ActorZOfTop(actor), ang, NAPALM_VELOCITY);
|
actor->spr.pos.X, actor->spr.pos.Y, ActorZOfTop(actor), ang, NAPALM_VELOCITY);
|
||||||
|
|
||||||
wp = &wActor->s();
|
wp = &actorNew->s();
|
||||||
wu = wActor->u();
|
wu = actorNew->u();
|
||||||
|
|
||||||
wp->hitag = LUMINOUS; //Always full brightness
|
wp->hitag = LUMINOUS; //Always full brightness
|
||||||
if (i == 0) // Only attach sound to first projectile
|
if (i == 0) // Only attach sound to first projectile
|
||||||
{
|
{
|
||||||
PlaySound(DIGI_NAPWIZ, wActor, v3df_follow);
|
PlaySound(DIGI_NAPWIZ, actorNew, v3df_follow);
|
||||||
}
|
}
|
||||||
|
|
||||||
SetOwner(actor, wActor);
|
SetOwner(actor, actorNew);
|
||||||
wp->shade = -40;
|
wp->shade = -40;
|
||||||
wp->xrepeat = 32;
|
wp->xrepeat = 32;
|
||||||
wp->yrepeat = 32;
|
wp->yrepeat = 32;
|
||||||
|
@ -12700,7 +12698,7 @@ int InitSumoNapalm(DSWActor* actor)
|
||||||
if (mp[i].dist_over != 0)
|
if (mp[i].dist_over != 0)
|
||||||
{
|
{
|
||||||
wp->ang = NORM_ANGLE(wp->ang + mp[i].ang);
|
wp->ang = NORM_ANGLE(wp->ang + mp[i].ang);
|
||||||
HelpMissileLateral(wActor, mp[i].dist_over);
|
HelpMissileLateral(actorNew, mp[i].dist_over);
|
||||||
wp->ang = NORM_ANGLE(wp->ang - mp[i].ang);
|
wp->ang = NORM_ANGLE(wp->ang - mp[i].ang);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -12714,7 +12712,7 @@ int InitSumoNapalm(DSWActor* actor)
|
||||||
wu->ychange = MOVEy(wp->xvel, wp->ang);
|
wu->ychange = MOVEy(wp->xvel, wp->ang);
|
||||||
wu->zchange = wp->zvel;
|
wu->zchange = wp->zvel;
|
||||||
|
|
||||||
MissileSetPos(wActor, DoNapalm, mp[i].dist_out);
|
MissileSetPos(actorNew, DoNapalm, mp[i].dist_out);
|
||||||
|
|
||||||
actor->spr.clipdist = oclipdist;
|
actor->spr.clipdist = oclipdist;
|
||||||
|
|
||||||
|
@ -12858,7 +12856,6 @@ int WeaponAutoAim(DSWActor* actor, DSWActor* mislActor, short ang, bool test)
|
||||||
{
|
{
|
||||||
USERp u = actor->u();
|
USERp u = actor->u();
|
||||||
USERp wu = mislActor->u();
|
USERp wu = mislActor->u();
|
||||||
SPRITEp wp = &mislActor->s();
|
|
||||||
int dist;
|
int dist;
|
||||||
int zh;
|
int zh;
|
||||||
|
|
||||||
|
@ -12880,15 +12877,15 @@ int WeaponAutoAim(DSWActor* actor, DSWActor* mislActor, short ang, bool test)
|
||||||
SET(hu->Flags, SPR_TARGETED);
|
SET(hu->Flags, SPR_TARGETED);
|
||||||
SET(hu->Flags, SPR_ATTACKED);
|
SET(hu->Flags, SPR_ATTACKED);
|
||||||
|
|
||||||
wp->ang = NORM_ANGLE(getangle(hp->pos.X - wp->pos.X, hp->pos.Y - wp->pos.Y));
|
mislActor->spr.ang = NORM_ANGLE(getangle(hp->pos.X - mislActor->spr.pos.X, hp->pos.Y - mislActor->spr.pos.Y));
|
||||||
dist = FindDistance2D(wp->pos.X - hp->pos.X, wp->pos.Y - hp->pos.Y);
|
dist = FindDistance2D(mislActor->spr.pos.X - hp->pos.X, mislActor->spr.pos.Y - hp->pos.Y);
|
||||||
|
|
||||||
if (dist != 0)
|
if (dist != 0)
|
||||||
{
|
{
|
||||||
int tos, diff, siz;
|
int tos, diff, siz;
|
||||||
|
|
||||||
tos = GetSpriteZOfTop(hp);
|
tos = GetSpriteZOfTop(hp);
|
||||||
diff = wp->pos.Z - tos;
|
diff = mislActor->spr.pos.Z - tos;
|
||||||
siz = GetSpriteSizeZ(hp);
|
siz = GetSpriteSizeZ(hp);
|
||||||
|
|
||||||
// hit_sprite is below
|
// hit_sprite is below
|
||||||
|
@ -12901,7 +12898,7 @@ int WeaponAutoAim(DSWActor* actor, DSWActor* mislActor, short ang, bool test)
|
||||||
else
|
else
|
||||||
zh = tos + (siz >> 2);
|
zh = tos + (siz >> 2);
|
||||||
|
|
||||||
wp->zvel = (wp->xvel * (zh - wp->pos.Z)) / dist;
|
mislActor->spr.zvel = (mislActor->spr.xvel * (zh - mislActor->spr.pos.Z)) / dist;
|
||||||
}
|
}
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
@ -12914,7 +12911,6 @@ int WeaponAutoAimZvel(DSWActor* actor, DSWActor* missileActor, int *zvel, short
|
||||||
USERp u = actor->u();
|
USERp u = actor->u();
|
||||||
|
|
||||||
USERp wu = missileActor->u();
|
USERp wu = missileActor->u();
|
||||||
SPRITEp wp = &missileActor->s();
|
|
||||||
int dist;
|
int dist;
|
||||||
int zh;
|
int zh;
|
||||||
|
|
||||||
|
@ -12923,7 +12919,7 @@ int WeaponAutoAimZvel(DSWActor* actor, DSWActor* missileActor, int *zvel, short
|
||||||
#if 0
|
#if 0
|
||||||
//formula for leading a player
|
//formula for leading a player
|
||||||
dist = Distance(actor->spr.pos.X, actor->spr.pos.Y, hp->pos.X, hp->pos.Y);
|
dist = Distance(actor->spr.pos.X, actor->spr.pos.Y, hp->pos.X, hp->pos.Y);
|
||||||
time_to_target = dist/wp->xvel;
|
time_to_target = dist/missileActor->spr.xvel;
|
||||||
lead_dist = time_to_target*hp->vel;
|
lead_dist = time_to_target*hp->vel;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
@ -12945,16 +12941,16 @@ int WeaponAutoAimZvel(DSWActor* actor, DSWActor* missileActor, int *zvel, short
|
||||||
SET(hu->Flags, SPR_TARGETED);
|
SET(hu->Flags, SPR_TARGETED);
|
||||||
SET(hu->Flags, SPR_ATTACKED);
|
SET(hu->Flags, SPR_ATTACKED);
|
||||||
|
|
||||||
wp->ang = NORM_ANGLE(getangle(hp->pos.X - wp->pos.X, hp->pos.Y - wp->pos.Y));
|
missileActor->spr.ang = NORM_ANGLE(getangle(hp->pos.X - missileActor->spr.pos.X, hp->pos.Y - missileActor->spr.pos.Y));
|
||||||
//dist = FindDistance2D(wp->pos.X, wp->pos.Y, hp->pos.X, hp->pos.Y);
|
//dist = FindDistance2D(missileActor->spr.pos.X, missileActor->spr.pos.Y, hp->pos.X, hp->pos.Y);
|
||||||
dist = FindDistance2D(wp->pos.X - hp->pos.X, wp->pos.Y - hp->pos.Y);
|
dist = FindDistance2D(missileActor->spr.pos.X - hp->pos.X, missileActor->spr.pos.Y - hp->pos.Y);
|
||||||
|
|
||||||
if (dist != 0)
|
if (dist != 0)
|
||||||
{
|
{
|
||||||
int tos, diff, siz;
|
int tos, diff, siz;
|
||||||
|
|
||||||
tos = GetSpriteZOfTop(hp);
|
tos = GetSpriteZOfTop(hp);
|
||||||
diff = wp->pos.Z - tos;
|
diff = missileActor->spr.pos.Z - tos;
|
||||||
siz = GetSpriteSizeZ(hp);
|
siz = GetSpriteSizeZ(hp);
|
||||||
|
|
||||||
// hit_sprite is below
|
// hit_sprite is below
|
||||||
|
@ -12967,7 +12963,7 @@ int WeaponAutoAimZvel(DSWActor* actor, DSWActor* missileActor, int *zvel, short
|
||||||
else
|
else
|
||||||
zh = tos + (siz >> 2);
|
zh = tos + (siz >> 2);
|
||||||
|
|
||||||
*zvel = (wp->xvel * (zh - wp->pos.Z)) / dist;
|
*zvel = (missileActor->spr.xvel * (zh - missileActor->spr.pos.Z)) / dist;
|
||||||
}
|
}
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
@ -18270,8 +18266,6 @@ void QueueReset(void)
|
||||||
|
|
||||||
bool TestDontStick(DSWActor* actor, walltype* hit_wall)
|
bool TestDontStick(DSWActor* actor, walltype* hit_wall)
|
||||||
{
|
{
|
||||||
WALLp wp;
|
|
||||||
|
|
||||||
if (hit_wall == nullptr)
|
if (hit_wall == nullptr)
|
||||||
{
|
{
|
||||||
ASSERT(actor != nullptr);
|
ASSERT(actor != nullptr);
|
||||||
|
@ -18280,13 +18274,12 @@ bool TestDontStick(DSWActor* actor, walltype* hit_wall)
|
||||||
hit_wall = u->coll.hitWall;
|
hit_wall = u->coll.hitWall;
|
||||||
}
|
}
|
||||||
|
|
||||||
wp = hit_wall;
|
|
||||||
|
|
||||||
if (TEST(wp->extra, WALLFX_DONT_STICK))
|
if (TEST(hit_wall->extra, WALLFX_DONT_STICK))
|
||||||
return true;
|
return true;
|
||||||
|
|
||||||
// if blocking red wallo
|
// if blocking red wallo
|
||||||
if (TEST(wp->cstat, CSTAT_WALL_BLOCK) && wp->twoSided())
|
if (TEST(hit_wall->cstat, CSTAT_WALL_BLOCK) && hit_wall->twoSided())
|
||||||
return true;
|
return true;
|
||||||
|
|
||||||
return false;
|
return false;
|
||||||
|
|
Loading…
Reference in a new issue