Fix clipupdatesector()

git-svn-id: https://svn.eduke32.com/eduke32@7573 1a8010ca-5511-0410-912e-c29ae57300e0
This commit is contained in:
terminx 2019-04-10 09:31:09 +00:00 committed by Christoph Oelckers
parent ad59875fa3
commit 74944c9ed0
1 changed files with 24 additions and 2 deletions

View File

@ -921,8 +921,8 @@ static void clipupdatesector(int32_t const x, int32_t const y, int16_t * const s
if (inside_p(x, y, *sectnum))
return;
static int16_t sectlist[MAXCLIPSECTORS];
static uint8_t sectbitmap[MAXCLIPSECTORS >> 3];
static int16_t sectlist[MAXSECTORS];
static uint8_t sectbitmap[MAXSECTORS >> 3];
int32_t nsecs;
bfirst_search_init(sectlist, sectbitmap, &nsecs, numsectors, *sectnum);
@ -948,6 +948,28 @@ static void clipupdatesector(int32_t const x, int32_t const y, int16_t * const s
}
}
bfirst_search_init(sectlist, sectbitmap, &nsecs, numsectors, *sectnum);
for (int sectcnt = 0; sectcnt < nsecs; sectcnt++)
{
if (inside_p(x, y, sectlist[sectcnt]))
{
// add sector to clipping list so the next call to clipdatesector()
// finishes in the loop above this one
addclipsect(sectlist[sectcnt]);
SET_AND_RETURN(*sectnum, sectlist[sectcnt]);
}
auto const sec = &sector[sectlist[sectcnt]];
int const startwall = sec->wallptr;
int const endwall = sec->wallptr + sec->wallnum;
// check floor curbs here?
for (int j = startwall; j < endwall; j++)
if (wall[j].nextsector >= 0)
bfirst_search_try(sectlist, sectbitmap, &nsecs, wall[j].nextsector);
}
*sectnum = -1;
}