From b176d94ede84f3f6944dc4699bf2dd5264941a7f Mon Sep 17 00:00:00 2001 From: Christoph Oelckers Date: Wed, 14 Sep 2022 00:15:45 +0200 Subject: [PATCH] - floatified hitasprite --- source/games/duke/src/funct.h | 2 +- source/games/duke/src/player.cpp | 12 ++++++------ 2 files changed, 7 insertions(+), 7 deletions(-) diff --git a/source/games/duke/src/funct.h b/source/games/duke/src/funct.h index db31bdad7..1dd6070d6 100644 --- a/source/games/duke/src/funct.h +++ b/source/games/duke/src/funct.h @@ -166,7 +166,7 @@ int setanimation(sectortype* animsect, int animtype, walltype* animtarget, doubl int setanimation(sectortype* animsect, int animtype, sectortype* animtarget, double thegoal, double thevel); void dofurniture(walltype* wallNum, sectortype* sectnum, int playerNum); void dotorch(); -int hitawall(player_struct* pl, walltype** hitWall); +double hitawall(player_struct* pl, walltype** hitWall); double hits(DDukeActor* snum); DDukeActor* LocateTheLocator(int n, sectortype* sectnum); diff --git a/source/games/duke/src/player.cpp b/source/games/duke/src/player.cpp index 91257002b..f82b577b1 100644 --- a/source/games/duke/src/player.cpp +++ b/source/games/duke/src/player.cpp @@ -180,22 +180,22 @@ double hits(DDukeActor* actor) double hitasprite(DDukeActor* actor, DDukeActor** hitsp) { - int zoff; + double zoff; HitInfo hit{}; if (badguy(actor)) - zoff = (42 << 8); - else if (actor->spr.picnum == TILE_APLAYER) zoff = gs.int_playerheight; + zoff = 42; + else if (actor->spr.picnum == TILE_APLAYER) zoff = gs.playerheight; else zoff = 0; - auto pos = actor->int_pos(); - hitscan(pos.withZOffset(-zoff), actor->sector(), { bcos(actor->int_ang()), bsin(actor->int_ang()), 0 }, hit, CLIPMASK1); + auto pos = actor->spr.pos; + hitscan(pos.plusZ(-zoff), actor->sector(), DVector3(actor->spr.angle.ToVector() * 1024, 0), hit, CLIPMASK1); if (hitsp) *hitsp = hit.actor(); if (hit.hitWall != nullptr && (hit.hitWall->cstat & CSTAT_WALL_MASKED) && badguy(actor)) return INT_MAX; - return (FindDistance2D(hit.int_hitpos().vec2 - actor->int_pos().vec2)) * inttoworld; + return (hit.hitpos.XY() - actor->spr.pos.XY()).Length(); } //---------------------------------------------------------------------------