- eliminated int_hitpos in Exhumed

This commit is contained in:
Christoph Oelckers 2022-09-09 18:50:48 +02:00
parent 8e48911723
commit f62b9ac118
2 changed files with 10 additions and 25 deletions

View file

@ -375,7 +375,7 @@ void AILion::Tick(RunListEvent* ev)
pActor->set_int_zvel(-4000); pActor->set_int_zvel(-4000);
pActor->nCount = 0; pActor->nCount = 0;
int nCheckDist = 0x7FFFFFFF; double nCheckDist = 0x7FFFFFFF;
int nAngle = pActor->int_ang(); int nAngle = pActor->int_ang();
int nScanAngle = (nAngle - 512) & kAngleMask; int nScanAngle = (nAngle - 512) & kAngleMask;
@ -388,8 +388,8 @@ void AILion::Tick(RunListEvent* ev)
if (hit.hitWall) if (hit.hitWall)
{ {
int theX = abs(hit.int_hitpos().X - pActor->int_pos().X); double theX = abs(hit.hitpos.X - pActor->spr.pos.X);
int theY = abs(hit.int_hitpos().Y - pActor->int_pos().Y); double theY = abs(hit.hitpos.Y - pActor->spr.pos.Y);
if ((theX + theY) < nCheckDist) if ((theX + theY) < nCheckDist)
{ {

View file

@ -124,37 +124,22 @@ void ExplodeSnakeSprite(DExhumedActor* pActor, int nPlayer)
StopActorSound(pActor); StopActorSound(pActor);
} }
void BuildSnake(int nPlayer, int zVal) void BuildSnake(int nPlayer, int zVal_)
{ {
double zVal = zVal_ * zinttoworld - 5;
zVal -= 1280;
auto pPlayerActor = PlayerList[nPlayer].pActor; auto pPlayerActor = PlayerList[nPlayer].pActor;
auto pViewSect = PlayerList[nPlayer].pPlayerViewSect; auto pViewSect = PlayerList[nPlayer].pPlayerViewSect;
int nPic = seq_GetSeqPicnum(kSeqSnakBody, 0, 0); int nPic = seq_GetSeqPicnum(kSeqSnakBody, 0, 0);
int x = pPlayerActor->int_pos().X; auto pos = pPlayerActor->spr.pos.plusZ(zVal - 10);
int y = pPlayerActor->int_pos().Y;
int z = (pPlayerActor->int_pos().Z + zVal) - 2560;
int nAngle = pPlayerActor->int_ang();
HitInfo hit{}; HitInfo hit{};
hitscan(vec3_t( x, y, z ), pPlayerActor->sector(), { bcos(nAngle), bsin(nAngle), 0 }, hit, CLIPMASK1); hitscan(pos, pPlayerActor->sector(), DVector3(pPlayerActor->spr.angle.ToVector() * 1024, 0), hit, CLIPMASK1);
uint32_t yDiff = abs(hit.int_hitpos().Y - y); double nSize = (hit.hitpos.XY() - pos.XY()).Length();
uint32_t xDiff = abs(hit.int_hitpos().X - x);
uint32_t sqrtNum = xDiff * xDiff + yDiff * yDiff; if (nSize < 64)
if (sqrtNum > INT_MAX)
{
DPrintf(DMSG_WARNING, "%s %d: overflow\n", __func__, __LINE__);
sqrtNum = INT_MAX;
}
int nSqrt = ksqrt(sqrtNum);
if (nSqrt < bsin(512, -4))
{ {
hit.hitpos -= pPlayerActor->spr.angle.ToVector() * 0.5; hit.hitpos -= pPlayerActor->spr.angle.ToVector() * 0.5;
auto pActor = insertActor(hit.hitSector, 202); auto pActor = insertActor(hit.hitSector, 202);
@ -193,7 +178,7 @@ void BuildSnake(int nPlayer, int zVal)
if (i == 0) if (i == 0)
{ {
pActor->spr.pos = pPlayerActor->spr.pos.plusZ(zVal * zinttoworld); pActor->spr.pos = pPlayerActor->spr.pos.plusZ(zVal);
pActor->spr.xrepeat = 32; pActor->spr.xrepeat = 32;
pActor->spr.yrepeat = 32; pActor->spr.yrepeat = 32;
pViewSect = pActor->sector(); pViewSect = pActor->sector();