From 360df11aa6da7f080a5236739c8653951a0895c7 Mon Sep 17 00:00:00 2001 From: Alug Date: Wed, 13 Mar 2024 08:35:30 +0100 Subject: [PATCH] Revert "LUT for bmapwidth imul instructions." This reverts commit e45a7f911f0d156b7cc38675bec1a14a2080c367. --- src/p_local.h | 1 - src/p_maputl.c | 6 +++--- src/p_setup.c | 26 -------------------------- 3 files changed, 3 insertions(+), 30 deletions(-) diff --git a/src/p_local.h b/src/p_local.h index 875b8862a..e93d4b411 100644 --- a/src/p_local.h +++ b/src/p_local.h @@ -386,7 +386,6 @@ extern INT32 bmapheight; // in mapblocks extern fixed_t bmaporgx; extern fixed_t bmaporgy; // origin of block map extern mobj_t **blocklinks; // for thing chains -extern int *bmapwidthmuls; // LUT bmapwidth muls // // P_INTER diff --git a/src/p_maputl.c b/src/p_maputl.c index 57e59e903..22651e421 100644 --- a/src/p_maputl.c +++ b/src/p_maputl.c @@ -824,7 +824,7 @@ void P_SetThingPosition(mobj_t *thing) // pointer-to-pointer prev pointers -- // allows head nodes to be treated like everything else - mobj_t **link = &blocklinks[bmapwidthmuls[blocky] + blockx]; + mobj_t **link = &blocklinks[blocky*bmapwidth + blockx]; mobj_t *bnext = *link; if ((thing->bnext = bnext) != NULL) bnext->bprev = &thing->bnext; @@ -928,7 +928,7 @@ boolean P_BlockLinesIterator(INT32 x, INT32 y, boolean (*func)(line_t *)) if (x < 0 || y < 0 || x >= bmapwidth || y >= bmapheight) return true; - offset = bmapwidthmuls[y] + x; + offset = y*bmapwidth + x; // haleyjd 02/22/06: consider polyobject lines plink = polyblocklinks[offset]; @@ -984,7 +984,7 @@ boolean P_BlockThingsIterator(INT32 x, INT32 y, boolean (*func)(mobj_t *)) return true; // Check interaction with the objects in the blockmap. - for (mobj = blocklinks[bmapwidthmuls[y] + x]; mobj; mobj = bnext) + for (mobj = blocklinks[y*bmapwidth + x]; mobj; mobj = bnext) { P_SetTarget(&bnext, mobj->bnext); // We want to note our reference to bnext here incase it is MF_NOTHINK and gets removed! if (!func(mobj)) diff --git a/src/p_setup.c b/src/p_setup.c index 149f32efb..1014d6806 100644 --- a/src/p_setup.c +++ b/src/p_setup.c @@ -127,8 +127,6 @@ INT32 *blockmaplump; // Big blockmap fixed_t bmaporgx, bmaporgy; // for thing chains mobj_t **blocklinks; -// LUT bmapwidth muls -int *bmapwidthmuls; // REJECT // For fast sight rejection. @@ -1945,14 +1943,6 @@ static void P_CreateBlockMap(void) blocklinks = Z_Calloc(count, PU_LEVEL, NULL); blockmap = blockmaplump + 4; - // LUT bmapwidth muls - count = sizeof(int) * bmapheight; - bmapwidthmuls = Z_Calloc(count, PU_LEVEL, NULL); - - for (int f = 0; f < bmapheight; f++){ - bmapwidthmuls[f] = f * bmapwidth; - } - // haleyjd 2/22/06: setup polyobject blockmap count = sizeof(*polyblocklinks) * bmapwidth * bmapheight; polyblocklinks = Z_Calloc(count, PU_LEVEL, NULL); @@ -2027,14 +2017,6 @@ static boolean P_LoadBlockMap(lumpnum_t lumpnum) count = sizeof (*blocklinks)* bmapwidth*bmapheight; blocklinks = Z_Calloc(count, PU_LEVEL, NULL); blockmap = blockmaplump+4; - - // LUT bmapwidth muls - count = sizeof(int) * bmapheight; - bmapwidthmuls = Z_Calloc(count, PU_LEVEL, NULL); - - for (int i = 0; i < bmapheight; i++){ - bmapwidthmuls[i] = i * bmapwidth; - } // haleyjd 2/22/06: setup polyobject blockmap count = sizeof(*polyblocklinks) * bmapwidth * bmapheight; @@ -2099,14 +2081,6 @@ static boolean P_LoadRawBlockMap(UINT8 *data, size_t count, const char *lumpname count = sizeof (*blocklinks)* bmapwidth*bmapheight; blocklinks = Z_Calloc(count, PU_LEVEL, NULL); blockmap = blockmaplump+4; - - // LUT bmapwidth muls - count = sizeof(int) * bmapheight; - bmapwidthmuls = Z_Calloc(count, PU_LEVEL, NULL); - - for (int i = 0; i < bmapheight; i++){ - bmapwidthmuls[i] = i * bmapwidth; - } // haleyjd 2/22/06: setup polyobject blockmap count = sizeof(*polyblocklinks) * bmapwidth * bmapheight;