From 23bd9918af145e8011d4d5c6b6f935b2a76bf62f Mon Sep 17 00:00:00 2001 From: Christoph Oelckers Date: Mon, 29 Aug 2022 19:29:20 +0200 Subject: [PATCH] - pass a DVector3 to updatesectorneighbor --- source/core/updatesector.h | 10 +++++----- source/games/duke/src/actors_d.cpp | 4 ++-- 2 files changed, 7 insertions(+), 7 deletions(-) diff --git a/source/core/updatesector.h b/source/core/updatesector.h index 0d6e99d93..ad8d63623 100644 --- a/source/core/updatesector.h +++ b/source/core/updatesector.h @@ -82,14 +82,14 @@ int FindSector(double x, double y, double z, Inside checker) } -constexpr int MAXUPDATESECTORDIST = 1536; +constexpr int MAXUPDATESECTORDIST = 96; inline void updatesector(int x_, int y_, int* sectnum) { double x = x_ * inttoworld; double y = y_ * inttoworld; - DoUpdateSector(x, y, 0, sectnum, MAXUPDATESECTORDIST * inttoworld, inside0); + DoUpdateSector(x, y, 0, sectnum, MAXUPDATESECTORDIST, inside0); if (*sectnum == -1) *sectnum = FindSector(x, y, 0, inside0); } @@ -99,7 +99,7 @@ inline void updatesectorz(int x_, int y_, int z_, int* sectnum) double y = y_ * inttoworld; double z = z_ * zinttoworld; - DoUpdateSector(x, y, z, sectnum, MAXUPDATESECTORDIST * inttoworld, insideZ); + DoUpdateSector(x, y, z, sectnum, MAXUPDATESECTORDIST, insideZ); if (*sectnum == -1) *sectnum = FindSector(x, y, z, insideZ); } @@ -137,9 +137,9 @@ inline void updatesectorz(const DVector3& pos, sectortype** const sectp) *sectp = sectno == -1 ? nullptr : §or[sectno]; } -inline void updatesectorneighbor(int x, int y, sectortype** const sect, int maxDistance = MAXUPDATESECTORDIST) +inline void updatesectorneighbor(const DVector3& pos, sectortype** const sect, double maxDistance = MAXUPDATESECTORDIST) { int sectno = *sect? sector.IndexOf(*sect) : -1; - DoUpdateSector(x * inttoworld, y * inttoworld, 0, §no, maxDistance * inttoworld, inside0); + DoUpdateSector(pos.X, pos.Y, 0, §no, maxDistance, inside0); *sect = sectno < 0? nullptr : §or[sectno]; } diff --git a/source/games/duke/src/actors_d.cpp b/source/games/duke/src/actors_d.cpp index ced0e3fc6..23bc4f632 100644 --- a/source/games/duke/src/actors_d.cpp +++ b/source/games/duke/src/actors_d.cpp @@ -878,7 +878,7 @@ static void movetripbomb(DDukeActor *actor) auto const oldSect = actor->sector(); auto curSect = actor->sector(); - updatesectorneighbor(actor->int_pos().X, actor->int_pos().Y, &curSect, 2048); + updatesectorneighbor(actor->spr.pos, &curSect, 128); ChangeActorSect(actor, curSect); DDukeActor* hit; @@ -908,7 +908,7 @@ static void movetripbomb(DDukeActor *actor) x -= 1024; actor->add_int_pos({ bcos(actor->temp_data[5], -4), bsin(actor->temp_data[5], -4), 0 }); - updatesectorneighbor(actor->int_pos().X, actor->int_pos().Y, &curSect, 2048); + updatesectorneighbor(actor->spr.pos, &curSect, 128); if (curSect == nullptr) break;