mirror of
https://github.com/DrBeef/Raze.git
synced 2025-01-19 15:40:58 +00:00
- Duke: let neartag return pointers
This commit is contained in:
parent
a9aadfd63d
commit
45519f67c1
4 changed files with 36 additions and 39 deletions
|
@ -209,15 +209,15 @@ inline int hitscan(int x, int y, int z, int sectnum, int32_t vx, int32_t vy, int
|
|||
}
|
||||
|
||||
inline void neartag(int32_t xs, int32_t ys, int32_t zs, int sectnum, int ange,
|
||||
int* neartagsector, int* neartagwall, DDukeActor** neartagsprite,
|
||||
sectortype** neartagsector, walltype** neartagwall, DDukeActor** neartagsprite,
|
||||
int32_t* neartaghitdist, int32_t neartagrange, uint8_t tagsearch)
|
||||
{
|
||||
int16_t nts;
|
||||
int16_t ntsec, ntwal;
|
||||
::neartag(xs, ys, zs, sectnum, ange, &ntsec, &ntwal, &nts, neartaghitdist, neartagrange, tagsearch);
|
||||
*neartagsprite = nts == -1 ? nullptr : &hittype[nts];
|
||||
*neartagsector = ntsec;
|
||||
*neartagwall = ntwal;
|
||||
*neartagsector = ntsec == -1? nullptr : §or[ntsec];
|
||||
*neartagwall = ntwal == -1? nullptr : &wall[ntwal];
|
||||
}
|
||||
|
||||
|
||||
|
|
|
@ -2475,18 +2475,18 @@ int ParseState::parse(void)
|
|||
insptr++;
|
||||
if( g_sp->sector()->lotag == 0 )
|
||||
{
|
||||
int neartagsector, neartagwall;
|
||||
sectortype* sectp;
|
||||
walltype* neartagwall;
|
||||
DDukeActor* neartagsprite;
|
||||
int32_t neartaghitdist;
|
||||
neartag(g_sp->x, g_sp->y, g_sp->z - (32 << 8), g_sp->sectnum, g_sp->ang, &neartagsector, &neartagwall, &neartagsprite, &neartaghitdist, 768L, 1);
|
||||
if (neartagsector >= 0)
|
||||
neartag(g_sp->x, g_sp->y, g_sp->z - (32 << 8), g_sp->sectnum, g_sp->ang, §p, &neartagwall, &neartagsprite, &neartaghitdist, 768L, 1);
|
||||
if (sectp)
|
||||
{
|
||||
auto sectp = §or[neartagsector];
|
||||
if (isanearoperator(sectp->lotag))
|
||||
if ((sectp->lotag & 0xff) == ST_23_SWINGING_DOOR || sectp->floorz == sectp->ceilingz)
|
||||
if ((sectp->lotag & 16384) == 0 && (sectp->lotag & 32768) == 0)
|
||||
{
|
||||
DukeSectIterator it(neartagsector);
|
||||
DukeSectIterator it(sectp);
|
||||
DDukeActor* a2;
|
||||
while ((a2 = it.Next()))
|
||||
{
|
||||
|
@ -2495,7 +2495,7 @@ int ParseState::parse(void)
|
|||
break;
|
||||
}
|
||||
if (a2 == nullptr)
|
||||
operatesectors(neartagsector, g_ac);
|
||||
operatesectors(sectnum(sectp), g_ac);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1520,7 +1520,8 @@ void checksectors_d(int snum)
|
|||
struct player_struct* p;
|
||||
int j;
|
||||
walltype* hitscanwall;
|
||||
int neartagsector = -1, neartagwall = -1;
|
||||
sectortype* ntsector = nullptr;
|
||||
walltype* ntwall = nullptr;
|
||||
DDukeActor* neartagsprite = nullptr;
|
||||
int neartaghitdist = 0;
|
||||
|
||||
|
@ -1606,17 +1607,17 @@ void checksectors_d(int snum)
|
|||
return;
|
||||
}
|
||||
if (p->newOwner != nullptr)
|
||||
neartag(p->oposx, p->oposy, p->oposz, p->GetActor()->s->sectnum, p->angle.oang.asbuild(), &neartagsector, &neartagwall, &neartagsprite, &neartaghitdist, 1280L, 1);
|
||||
neartag(p->oposx, p->oposy, p->oposz, p->GetActor()->s->sectnum, p->angle.oang.asbuild(), &ntsector, &ntwall, &neartagsprite, &neartaghitdist, 1280L, 1);
|
||||
else
|
||||
{
|
||||
neartag(p->pos.x, p->pos.y, p->pos.z, p->GetActor()->s->sectnum, p->angle.oang.asbuild(), &neartagsector, &neartagwall, &neartagsprite, &neartaghitdist, 1280L, 1);
|
||||
if (neartagsprite == nullptr && neartagwall == -1 && neartagsector == -1)
|
||||
neartag(p->pos.x, p->pos.y, p->pos.z + (8 << 8), p->GetActor()->s->sectnum, p->angle.oang.asbuild(), &neartagsector, &neartagwall, &neartagsprite, &neartaghitdist, 1280L, 1);
|
||||
if (neartagsprite == nullptr && neartagwall == -1 && neartagsector == -1)
|
||||
neartag(p->pos.x, p->pos.y, p->pos.z + (16 << 8), p->GetActor()->s->sectnum, p->angle.oang.asbuild(), &neartagsector, &neartagwall, &neartagsprite, &neartaghitdist, 1280L, 1);
|
||||
if (neartagsprite == nullptr && neartagwall == -1 && neartagsector == -1)
|
||||
neartag(p->pos.x, p->pos.y, p->pos.z, p->GetActor()->s->sectnum, p->angle.oang.asbuild(), &ntsector, &ntwall, &neartagsprite, &neartaghitdist, 1280L, 1);
|
||||
if (neartagsprite == nullptr && ntwall == nullptr && ntsector == nullptr)
|
||||
neartag(p->pos.x, p->pos.y, p->pos.z + (8 << 8), p->GetActor()->s->sectnum, p->angle.oang.asbuild(), &ntsector, &ntwall, &neartagsprite, &neartaghitdist, 1280L, 1);
|
||||
if (neartagsprite == nullptr && ntwall == nullptr && ntsector == nullptr)
|
||||
neartag(p->pos.x, p->pos.y, p->pos.z + (16 << 8), p->GetActor()->s->sectnum, p->angle.oang.asbuild(), &ntsector, &ntwall, &neartagsprite, &neartaghitdist, 1280L, 1);
|
||||
if (neartagsprite == nullptr && ntwall == nullptr && ntsector == nullptr)
|
||||
{
|
||||
neartag(p->pos.x, p->pos.y, p->pos.z + (16 << 8), p->GetActor()->s->sectnum, p->angle.oang.asbuild(), &neartagsector, &neartagwall, &neartagsprite, &neartaghitdist, 1280L, 3);
|
||||
neartag(p->pos.x, p->pos.y, p->pos.z + (16 << 8), p->GetActor()->s->sectnum, p->angle.oang.asbuild(), &ntsector, &ntwall, &neartagsprite, &neartaghitdist, 1280L, 3);
|
||||
if (neartagsprite != nullptr)
|
||||
{
|
||||
switch (neartagsprite->s->picnum)
|
||||
|
@ -1640,12 +1641,10 @@ void checksectors_d(int snum)
|
|||
}
|
||||
|
||||
neartagsprite = nullptr;
|
||||
neartagwall = -1;
|
||||
neartagsector = -1;
|
||||
ntwall = nullptr;
|
||||
ntsector = nullptr;
|
||||
}
|
||||
}
|
||||
auto ntwall = neartagwall < 0? nullptr : &wall[neartagwall];
|
||||
auto ntsector = neartagsector < 0 ? nullptr : §or[neartagsector];
|
||||
|
||||
if (p->newOwner == nullptr && neartagsprite == nullptr && ntsector == nullptr && ntwall == nullptr)
|
||||
if (isanunderoperator(p->GetActor()->getSector()->lotag))
|
||||
|
|
|
@ -2440,9 +2440,10 @@ void checksectors_r(int snum)
|
|||
int oldz;
|
||||
struct player_struct* p;
|
||||
walltype* hitscanwall;
|
||||
int neartagsector, neartagwall;
|
||||
DDukeActor* neartagsprite;
|
||||
int neartaghitdist;
|
||||
sectortype* ntsector = nullptr;
|
||||
walltype* ntwall = nullptr;
|
||||
DDukeActor* neartagsprite = nullptr;
|
||||
int neartaghitdist = 0;
|
||||
|
||||
p = &ps[snum];
|
||||
auto pact = p->GetActor();
|
||||
|
@ -2559,21 +2560,21 @@ void checksectors_r(int snum)
|
|||
}
|
||||
return;
|
||||
}
|
||||
neartag(p->pos.x, p->pos.y, p->pos.z, p->GetActor()->s->sectnum, p->angle.oang.asbuild(), &neartagsector, &neartagwall, &neartagsprite, &neartaghitdist, 1280L, 3);
|
||||
neartag(p->pos.x, p->pos.y, p->pos.z, p->GetActor()->s->sectnum, p->angle.oang.asbuild(), &ntsector, &ntwall, &neartagsprite, &neartaghitdist, 1280L, 3);
|
||||
}
|
||||
|
||||
if (p->newOwner != nullptr)
|
||||
neartag(p->oposx, p->oposy, p->oposz, p->GetActor()->s->sectnum, p->angle.oang.asbuild(), &neartagsector, &neartagwall, &neartagsprite, &neartaghitdist, 1280L, 1);
|
||||
neartag(p->oposx, p->oposy, p->oposz, p->GetActor()->s->sectnum, p->angle.oang.asbuild(), &ntsector, &ntwall, &neartagsprite, &neartaghitdist, 1280L, 1);
|
||||
else
|
||||
{
|
||||
neartag(p->pos.x, p->pos.y, p->pos.z, p->GetActor()->s->sectnum, p->angle.oang.asbuild(), &neartagsector, &neartagwall, &neartagsprite, &neartaghitdist, 1280L, 1);
|
||||
if (neartagsprite == nullptr && neartagwall == -1 && neartagsector == -1)
|
||||
neartag(p->pos.x, p->pos.y, p->pos.z + (8 << 8), p->GetActor()->s->sectnum, p->angle.oang.asbuild(), &neartagsector, &neartagwall, &neartagsprite, &neartaghitdist, 1280L, 1);
|
||||
if (neartagsprite == nullptr && neartagwall == -1 && neartagsector == -1)
|
||||
neartag(p->pos.x, p->pos.y, p->pos.z + (16 << 8), p->GetActor()->s->sectnum, p->angle.oang.asbuild(), &neartagsector, &neartagwall, &neartagsprite, &neartaghitdist, 1280L, 1);
|
||||
if (neartagsprite == nullptr && neartagwall == -1 && neartagsector == -1)
|
||||
neartag(p->pos.x, p->pos.y, p->pos.z, p->GetActor()->s->sectnum, p->angle.oang.asbuild(), &ntsector, &ntwall, &neartagsprite, &neartaghitdist, 1280L, 1);
|
||||
if (neartagsprite == nullptr && ntwall == nullptr && ntsector == nullptr)
|
||||
neartag(p->pos.x, p->pos.y, p->pos.z + (8 << 8), p->GetActor()->s->sectnum, p->angle.oang.asbuild(), &ntsector, &ntwall, &neartagsprite, &neartaghitdist, 1280L, 1);
|
||||
if (neartagsprite == nullptr && ntwall == nullptr && ntsector == nullptr)
|
||||
neartag(p->pos.x, p->pos.y, p->pos.z + (16 << 8), p->GetActor()->s->sectnum, p->angle.oang.asbuild(), &ntsector, &ntwall, &neartagsprite, &neartaghitdist, 1280L, 1);
|
||||
if (neartagsprite == nullptr && ntwall == nullptr && ntsector == nullptr)
|
||||
{
|
||||
neartag(p->pos.x, p->pos.y, p->pos.z + (16 << 8), p->GetActor()->s->sectnum, p->angle.oang.asbuild(), &neartagsector, &neartagwall, &neartagsprite, &neartaghitdist, 1280L, 3);
|
||||
neartag(p->pos.x, p->pos.y, p->pos.z + (16 << 8), p->GetActor()->s->sectnum, p->angle.oang.asbuild(), &ntsector, &ntwall, &neartagsprite, &neartaghitdist, 1280L, 3);
|
||||
if (neartagsprite != nullptr)
|
||||
{
|
||||
switch (neartagsprite->s->picnum)
|
||||
|
@ -2590,18 +2591,15 @@ void checksectors_r(int snum)
|
|||
}
|
||||
|
||||
neartagsprite = nullptr;
|
||||
neartagwall = -1;
|
||||
neartagsector = -1;
|
||||
ntwall = nullptr;
|
||||
ntsector = nullptr;
|
||||
}
|
||||
}
|
||||
auto ntwall = neartagwall < 0? nullptr : &wall[neartagwall];
|
||||
auto ntsector = neartagsector < 0 ? nullptr : §or[neartagsector];
|
||||
|
||||
if (p->newOwner == nullptr && neartagsprite == nullptr && ntsector == nullptr && ntwall == nullptr)
|
||||
if (isanunderoperator(p->GetActor()->getSector()->lotag))
|
||||
ntsector = p->GetActor()->s->sector();
|
||||
|
||||
|
||||
if (ntsector && (ntsector->lotag & 16384))
|
||||
return;
|
||||
|
||||
|
|
Loading…
Reference in a new issue