- floatified smaller stuff

This commit is contained in:
Christoph Oelckers 2022-09-29 14:08:56 +02:00
parent f3bae2b0b8
commit d525d41ed2
3 changed files with 7 additions and 14 deletions

View file

@ -7673,9 +7673,8 @@ bool setDataValueOfObject(int objType, sectortype* sect, walltype* wal, DBloodAc
//
//---------------------------------------------------------------------------
bool nnExtCanMove(DBloodActor* actor, DBloodActor* target, DAngle nAngle, int nRange_)
bool nnExtCanMove(DBloodActor* actor, DBloodActor* target, DAngle nAngle, double nRange)
{
double nRange = nRange_ * inttoworld;
DVector3 pos = actor->spr.pos;
DVector3 nAngVect(nAngle.ToVector(), 0);
@ -7712,11 +7711,8 @@ void nnExtAiSetDirection(DBloodActor* actor, DAngle direction)
assert(actor->spr.type >= kDudeBase && actor->spr.type < kDudeMax);
DAngle vc = deltaangle(actor->spr.angle, direction);
double nCos = actor->spr.angle.Cos();
double nSin = actor->spr.angle.Sin();
double t1 = actor->vel.X * nCos + actor->vel.Y * nSin;
int range = FloatToFixed(t1 * (15 / 8192.));
DAngle v8 = vc > nullAngle ? DAngle180 / 3 : -DAngle180 / 3;
double range = actor->vel.XY().dot(actor->spr.angle.ToVector()) * 120;
if (nnExtCanMove(actor, actor->GetTarget(), actor->spr.angle + vc, range))
actor->xspr.goalAng = actor->spr.angle + vc;

View file

@ -29,7 +29,7 @@ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
BEGIN_BLD_NS
TArray<DBloodActor*> getSpritesNearWalls(sectortype* pSrcSect, int nDist);
TArray<DBloodActor*> getSpritesNearWalls(sectortype* pSrcSect, double nDist);
// - CLASSES ------------------------------------------------------------------
@ -41,7 +41,6 @@ class SPRINSECT
{
public:
static const int kMaxSprNear = 256;
static const int kWallDist = 16;
struct SPRITES
{
@ -52,7 +51,7 @@ private:
TArray<SPRITES> db;
public:
void Free() { db.Clear(); }
void Init(int nDist = kWallDist); // used in trInit to collect the sprites before translation
void Init(double nDist = 1); // used in trInit to collect the sprites before translation
void Serialize(FSerializer& pSave);
TArray<TObjPtr<DBloodActor*>>* GetSprPtr(int nSector);
void Mark()
@ -74,7 +73,7 @@ void MarkSprInSect()
gSprNSect.Mark();
}
void SPRINSECT::Init(int nDist)
void SPRINSECT::Init(double nDist)
{
Free();
@ -178,9 +177,8 @@ bool isMovableSector(sectortype* pSect)
return false;
}
TArray<DBloodActor*> getSpritesNearWalls(sectortype* pSrcSect, int nDist)
TArray<DBloodActor*> getSpritesNearWalls(sectortype* pSrcSect, double nDist)
{
double dist = nDist * inttoworld;
TArray<DBloodActor*> out;
for(auto& wal : wallsofsector(pSrcSect))

View file

@ -2094,8 +2094,7 @@ void ProcessMotion(void)
continue;
else
pXSector->bobTheta += MulScale(pXSector->bobSpeed, pXSector->busy, 16);
int zoff_i = int(BobVal(pXSector->bobTheta) * (pXSector->bobZRange << 8));
double zoff = zoff_i * zinttoworld;
double zoff = BobVal(pXSector->bobTheta) * pXSector->bobZRange;
BloodSectIterator it(pSector);
while (auto actor = it.Next())