mirror of
https://github.com/DrBeef/Raze.git
synced 2024-11-15 17:01:51 +00:00
- cansee in Duke
This commit is contained in:
parent
085839af32
commit
113980ca8e
5 changed files with 25 additions and 19 deletions
|
@ -290,11 +290,11 @@ void hitradius_d(DDukeActor* actor, int r, int hp1, int hp2, int hp3, int h
|
|||
{
|
||||
search.Add(wal.nextSector());
|
||||
}
|
||||
int x1 = (((wal.wall_int_pos().X + wal.point2Wall()->wall_int_pos().X) >> 1) + actor->int_pos().X) >> 1;
|
||||
int y1 = (((wal.wall_int_pos().Y + wal.point2Wall()->wall_int_pos().Y) >> 1) + actor->int_pos().Y) >> 1;
|
||||
DVector3 w1(((wal.pos + wal.point2Wall()->pos) * 0.5 + actor->spr.pos) * 0.5, actor->spr.pos.Z); // half way between the actor and the wall's center.
|
||||
sectortype* sect = wal.sectorp();
|
||||
updatesector(x1, y1, §);
|
||||
if (sect && cansee(x1, y1, actor->int_pos().Z, sect, actor->int_pos().X, actor->int_pos().Y, actor->int_pos().Z, actor->sector()))
|
||||
updatesector(w1, §);
|
||||
|
||||
if (sect && cansee(w1, sect, actor->spr.pos, actor->sector()))
|
||||
fi.checkhitwall(actor, &wal, wal.wall_int_pos().X, wal.wall_int_pos().Y, actor->int_pos().Z, actor->spr.picnum);
|
||||
}
|
||||
}
|
||||
|
@ -327,7 +327,7 @@ void hitradius_d(DDukeActor* actor, int r, int hp1, int hp2, int hp3, int h
|
|||
if (actor->spr.picnum != SHRINKSPARK || (act2->spr.cstat & CSTAT_SPRITE_BLOCK_ALL))
|
||||
if (dist(actor, act2) < r)
|
||||
{
|
||||
if (badguy(act2) && !cansee(act2->int_pos().X, act2->int_pos().Y, act2->int_pos().Z + q, act2->sector(), actor->int_pos().X, actor->int_pos().Y, actor->int_pos().Z + q, actor->sector()))
|
||||
if (badguy(act2) && !cansee(act2->spr.pos.plusZ(q * maptoworld), act2->sector(), actor->spr.pos.plusZ(q * maptoworld), actor->sector()))
|
||||
continue;
|
||||
fi.checkhitsprite(act2, actor);
|
||||
}
|
||||
|
@ -347,7 +347,7 @@ void hitradius_d(DDukeActor* actor, int r, int hp1, int hp2, int hp3, int h
|
|||
int d = dist(actor, act2);
|
||||
if (act2->spr.picnum == APLAYER) act2->spr.pos.Z += gs.playerheight;
|
||||
|
||||
if (d < r && cansee(act2->int_pos().X, act2->int_pos().Y, act2->int_pos().Z - (8 << 8), act2->sector(), actor->int_pos().X, actor->int_pos().Y, actor->int_pos().Z - (12 << 8), actor->sector()))
|
||||
if (d < r && cansee(act2->spr.pos.plusZ(-8), act2->sector(), actor->spr.pos.plusZ(-12), actor->sector()))
|
||||
{
|
||||
act2->hitang = getangle(act2->int_pos().X - actor->int_pos().X, act2->int_pos().Y - actor->int_pos().Y);
|
||||
|
||||
|
|
|
@ -248,18 +248,18 @@ void hitradius_r(DDukeActor* actor, int r, int hp1, int hp2, int hp3, int h
|
|||
{
|
||||
search.Add(wal.nextSector());
|
||||
}
|
||||
int x1 = (((wal.wall_int_pos().X + wal.point2Wall()->wall_int_pos().X) >> 1) + actor->int_pos().X) >> 1;
|
||||
int y1 = (((wal.wall_int_pos().Y + wal.point2Wall()->wall_int_pos().Y) >> 1) + actor->int_pos().Y) >> 1;
|
||||
auto sect = wal.sectorp();
|
||||
updatesector(x1, y1, §);
|
||||
if (sect != nullptr && cansee(x1, y1, actor->int_pos().Z, sect, actor->int_pos().X, actor->int_pos().Y, actor->int_pos().Z, actor->sector()))
|
||||
DVector3 w1(((wal.pos + wal.point2Wall()->pos) * 0.5 + actor->spr.pos) * 0.5, actor->spr.pos.Z); // half way between the actor and the wall's center.
|
||||
sectortype* sect = wal.sectorp();
|
||||
updatesector(w1, §);
|
||||
|
||||
if (sect && cansee(w1, sect, actor->spr.pos, actor->sector()))
|
||||
fi.checkhitwall(actor, &wal, wal.wall_int_pos().X, wal.wall_int_pos().Y, actor->int_pos().Z, actor->spr.picnum);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
int q = -(24 << 8) + (krand() & ((32 << 8) - 1));
|
||||
double q = zrand(32) - 24;
|
||||
|
||||
auto Owner = actor->GetOwner();
|
||||
for (int x = 0; x < 7; x++)
|
||||
|
@ -272,10 +272,9 @@ void hitradius_r(DDukeActor* actor, int r, int hp1, int hp2, int hp3, int h
|
|||
if (act2->spr.cstat & CSTAT_SPRITE_BLOCK_ALL)
|
||||
if (dist(actor, act2) < r)
|
||||
{
|
||||
if (badguy(act2) && !cansee(act2->int_pos().X, act2->int_pos().Y, act2->int_pos().Z + q, act2->sector(), actor->int_pos().X, actor->int_pos().Y, actor->int_pos().Z + q, actor->sector()))
|
||||
{
|
||||
if (badguy(act2) && !cansee(act2->spr.pos.plusZ(q), act2->sector(), actor->spr.pos.plusZ(q), actor->sector()))
|
||||
continue;
|
||||
}
|
||||
|
||||
fi.checkhitsprite(act2, actor);
|
||||
}
|
||||
}
|
||||
|
@ -294,7 +293,7 @@ void hitradius_r(DDukeActor* actor, int r, int hp1, int hp2, int hp3, int h
|
|||
int d = dist(actor, act2);
|
||||
if (act2->spr.picnum == APLAYER) act2->spr.pos.Z += gs.playerheight;
|
||||
|
||||
if (d < r && cansee(act2->int_pos().X, act2->int_pos().Y, act2->int_pos().Z - (8 << 8), act2->sector(), actor->int_pos().X, actor->int_pos().Y, actor->int_pos().Z - (12 << 8), actor->sector()))
|
||||
if (d < r && cansee(act2->spr.pos.plusZ(-8), act2->sector(), actor->spr.pos.plusZ(-12), actor->sector()))
|
||||
{
|
||||
if ((isRRRA()) && act2->spr.picnum == MINION && act2->spr.pal == 19)
|
||||
{
|
||||
|
|
|
@ -245,6 +245,13 @@ void loadcons();
|
|||
void recordoldspritepos();
|
||||
void DrawStatusBar();
|
||||
|
||||
[[deprecated]]
|
||||
inline double zrand(int spread, int ofs)
|
||||
{
|
||||
int r = krand() % (spread << 8);
|
||||
return r * zmaptoworld;
|
||||
}
|
||||
|
||||
inline double zrand(int spread)
|
||||
{
|
||||
int r = krand() % (spread << 8);
|
||||
|
|
|
@ -1459,7 +1459,7 @@ static bool ifcansee(DDukeActor* actor, int pnum)
|
|||
if (ps[pnum].holoduke_on != nullptr && !isRR())
|
||||
{
|
||||
tosee = ps[pnum].holoduke_on;
|
||||
j = cansee(actor->int_pos().X, actor->int_pos().Y, actor->int_pos().Z - (krand() & ((32 << 8) - 1)), actor->sector(), tosee->int_pos().X, tosee->int_pos().Y, tosee->int_pos().Z, tosee->sector());
|
||||
j = cansee(actor->spr.pos.plusZ(-zrand(32)), actor->sector(), tosee->spr.pos, tosee->sector());
|
||||
|
||||
if (j == 0)
|
||||
{
|
||||
|
@ -1471,7 +1471,7 @@ static bool ifcansee(DDukeActor* actor, int pnum)
|
|||
else tosee = ps[pnum].GetActor(); // holoduke not on. look for player
|
||||
|
||||
// can they see player, (or player's holoduke)
|
||||
j = cansee(actor->int_pos().X, actor->int_pos().Y, actor->int_pos().Z - (krand() & ((47 << 8))), actor->sector(), tosee->int_pos().X, tosee->int_pos().Y, tosee->int_pos().Z - ((isRR()? 28 : 24) << 8), tosee->sector());
|
||||
j = cansee(actor->spr.pos.plusZ(-zrand(48)), actor->sector(), tosee->spr.pos.plusZ(isRR()? -28 : -24), tosee->sector());
|
||||
|
||||
if (j == 0)
|
||||
{
|
||||
|
|
|
@ -352,7 +352,7 @@ DDukeActor* aim(DDukeActor* actor, int aang)
|
|||
a = (abs(Scale(act->int_pos().Z - actor->int_pos().Z, 10, sdist) - ps[actor->spr.yvel].horizon.sum().asbuild()) < 100);
|
||||
else a = 1;
|
||||
|
||||
cans = cansee(act->int_pos().X, act->int_pos().Y, act->int_pos().Z - (32 << 8) + gs.actorinfo[act->spr.picnum].aimoffset, act->sector(), actor->int_pos().X, actor->int_pos().Y, actor->int_pos().Z - (32 << 8), actor->sector());
|
||||
cans = cansee(act->spr.pos.plusZ(-32 + gs.actorinfo[act->spr.picnum].aimoffset), act->sector(), actor->spr.pos.plusZ(-32), actor->sector());
|
||||
|
||||
if (a && cans)
|
||||
{
|
||||
|
|
Loading…
Reference in a new issue