mirror of
https://github.com/DrBeef/Raze.git
synced 2025-02-21 19:21:44 +00:00
- eliminated sector[] in position checkers
This commit is contained in:
parent
27af8a52e9
commit
c79dace730
2 changed files with 16 additions and 10 deletions
|
@ -439,6 +439,12 @@ int32_t try_facespr_intersect(uspriteptr_t const spr, vec3_t const in,
|
||||||
#define MAXUPDATESECTORDIST 1536
|
#define MAXUPDATESECTORDIST 1536
|
||||||
#define INITIALUPDATESECTORDIST 256
|
#define INITIALUPDATESECTORDIST 256
|
||||||
void updatesector(int const x, int const y, int * const sectnum) ATTRIBUTE((nonnull(3)));
|
void updatesector(int const x, int const y, int * const sectnum) ATTRIBUTE((nonnull(3)));
|
||||||
|
inline void updatesector(int const x, int const y, sectortype** const sectp)
|
||||||
|
{
|
||||||
|
int sectno = *sectp? (*sectp) - sector : -1;
|
||||||
|
updatesector(x, y, §no);
|
||||||
|
*sectp = §or[sectno];
|
||||||
|
}
|
||||||
void updatesectorz(int32_t const x, int32_t const y, int32_t const z, int * const sectnum) ATTRIBUTE((nonnull(4)));
|
void updatesectorz(int32_t const x, int32_t const y, int32_t const z, int * const sectnum) ATTRIBUTE((nonnull(4)));
|
||||||
|
|
||||||
void updatesectorneighbor(int32_t const x, int32_t const y, int * const sectnum, int32_t initialMaxDistance = INITIALUPDATESECTORDIST, int32_t maxDistance = MAXUPDATESECTORDIST) ATTRIBUTE((nonnull(3)));
|
void updatesectorneighbor(int32_t const x, int32_t const y, int * const sectnum, int32_t initialMaxDistance = INITIALUPDATESECTORDIST, int32_t maxDistance = MAXUPDATESECTORDIST) ATTRIBUTE((nonnull(3)));
|
||||||
|
|
|
@ -342,19 +342,19 @@ void spawntransporter(DDukeActor *actj, DDukeActor* acti, bool beam)
|
||||||
int spawnbloodpoolpart1(DDukeActor *actj, DDukeActor* acti)
|
int spawnbloodpoolpart1(DDukeActor *actj, DDukeActor* acti)
|
||||||
{
|
{
|
||||||
auto sp = acti->s;
|
auto sp = acti->s;
|
||||||
int s1 = sp->sectnum;
|
auto s1 = sp->sector();
|
||||||
|
|
||||||
updatesector(sp->x + 108, sp->y + 108, &s1);
|
updatesector(sp->x + 108, sp->y + 108, &s1);
|
||||||
if (s1 >= 0 && sector[s1].floorz == sp->sector()->floorz)
|
if (s1 && s1->floorz == sp->sector()->floorz)
|
||||||
{
|
{
|
||||||
updatesector(sp->x - 108, sp->y - 108, &s1);
|
updatesector(sp->x - 108, sp->y - 108, &s1);
|
||||||
if (s1 >= 0 && sector[s1].floorz == sp->sector()->floorz)
|
if (s1 && s1->floorz == sp->sector()->floorz)
|
||||||
{
|
{
|
||||||
updatesector(sp->x + 108, sp->y - 108, &s1);
|
updatesector(sp->x + 108, sp->y - 108, &s1);
|
||||||
if (s1 >= 0 && sector[s1].floorz == sp->sector()->floorz)
|
if (s1 && s1->floorz == sp->sector()->floorz)
|
||||||
{
|
{
|
||||||
updatesector(sp->x - 108, sp->y + 108, &s1);
|
updatesector(sp->x - 108, sp->y + 108, &s1);
|
||||||
if (s1 >= 0 && sector[s1].floorz != sp->sector()->floorz)
|
if (s1 && s1->floorz != sp->sector()->floorz)
|
||||||
{
|
{
|
||||||
sp->xrepeat = sp->yrepeat = 0; changeactorstat(acti, STAT_MISC); return true;
|
sp->xrepeat = sp->yrepeat = 0; changeactorstat(acti, STAT_MISC); return true;
|
||||||
}
|
}
|
||||||
|
@ -385,19 +385,19 @@ void initfootprint(DDukeActor* actj, DDukeActor* acti)
|
||||||
int sect = sp->sectnum;
|
int sect = sp->sectnum;
|
||||||
if (actj)
|
if (actj)
|
||||||
{
|
{
|
||||||
int s1 = sp->sectnum;
|
auto s1 = sp->sector();
|
||||||
|
|
||||||
updatesector(sp->x + 84, sp->y + 84, &s1);
|
updatesector(sp->x + 84, sp->y + 84, &s1);
|
||||||
if (s1 >= 0 && sector[s1].floorz == sp->sector()->floorz)
|
if (s1 && s1->floorz == sp->sector()->floorz)
|
||||||
{
|
{
|
||||||
updatesector(sp->x - 84, sp->y - 84, &s1);
|
updatesector(sp->x - 84, sp->y - 84, &s1);
|
||||||
if (s1 >= 0 && sector[s1].floorz == sp->sector()->floorz)
|
if (s1 && s1->floorz == sp->sector()->floorz)
|
||||||
{
|
{
|
||||||
updatesector(sp->x + 84, sp->y - 84, &s1);
|
updatesector(sp->x + 84, sp->y - 84, &s1);
|
||||||
if (s1 >= 0 && sector[s1].floorz == sp->sector()->floorz)
|
if (s1 && s1->floorz == sp->sector()->floorz)
|
||||||
{
|
{
|
||||||
updatesector(sp->x - 84, sp->y + 84, &s1);
|
updatesector(sp->x - 84, sp->y + 84, &s1);
|
||||||
if (s1 >= 0 && sector[s1].floorz != sp->sector()->floorz)
|
if (s1 && s1->floorz != sp->sector()->floorz)
|
||||||
{
|
{
|
||||||
sp->xrepeat = sp->yrepeat = 0; changeactorstat(acti, STAT_MISC); return;
|
sp->xrepeat = sp->yrepeat = 0; changeactorstat(acti, STAT_MISC); return;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue