- the rest of Duke’s sectnum, except RR's geo hack

This commit is contained in:
Christoph Oelckers 2021-11-21 09:08:05 +01:00
parent 714b5ac872
commit 9c7eecb55f
8 changed files with 40 additions and 38 deletions

View file

@ -83,7 +83,7 @@ struct ParseState
int furthestcanseepoint(DDukeActor* i, DDukeActor* ts, int* dax, int* day);
bool ifsquished(DDukeActor* i, int p);
void fakebubbaspawn(DDukeActor* actor, int g_p);
void tearitup(int sect);
void tearitup(sectortype* sect);
void destroyit(DDukeActor* actor);
void mamaspawn(DDukeActor* actor);
void forceplayerangle(int snum);
@ -1817,7 +1817,7 @@ int ParseState::parse(void)
break;
case concmd_tearitup:
insptr++;
tearitup(g_sp->sectnum);
tearitup(g_sp->sector());
break;
case concmd_fall:
insptr++;

View file

@ -86,7 +86,7 @@ void incur_damage_r(struct player_struct* p)
static void shootmelee(DDukeActor *actor, int p, int sx, int sy, int sz, int sa, int atwith)
{
spritetype* const s = actor->s;
int sect = s->sectnum;
auto sectp = s->sector();
int zvel;
int hitx, hity, hitz;
DDukeActor* hitsprt;
@ -107,7 +107,7 @@ static void shootmelee(DDukeActor *actor, int p, int sx, int sy, int sz, int sa,
sa = getangle(pspr->s->x - sx, pspr->s->y - sy);
}
hitscan(sx, sy, sz, sect,
hitscan(sx, sy, sz, sectp,
bcos(sa),
bsin(sa), zvel << 6,
&hitsectp, &wal, &hitsprt, &hitx, &hity, &hitz, CLIPMASK1);
@ -132,7 +132,7 @@ static void shootmelee(DDukeActor *actor, int p, int sx, int sy, int sz, int sa,
{
nz = effector->GetOwner()->sector()->ceilingz;
}
hitscan(nx, ny, nz, effector->GetOwner()->s->sectnum, bcos(sa), bsin(sa), zvel << 6,
hitscan(nx, ny, nz, effector->GetOwner()->s->sector(), bcos(sa), bsin(sa), zvel << 6,
&hitsectp, &wal, &hitsprt, &hitx, &hity, &hitz, CLIPMASK1);
break;
}
@ -213,7 +213,7 @@ static void shootmelee(DDukeActor *actor, int p, int sx, int sy, int sz, int sa,
static void shootweapon(DDukeActor* actor, int p, int sx, int sy, int sz, int sa, int atwith)
{
auto s = actor->s;
int sect = s->sectnum;
auto sectp = s->sector();
int zvel = 0;
int hitx, hity, hitz;
DDukeActor* hitsprt;
@ -271,7 +271,7 @@ static void shootweapon(DDukeActor* actor, int p, int sx, int sy, int sz, int sa
}
s->cstat &= ~257;
hitscan(sx, sy, sz, sect, bcos(sa), bsin(sa),
hitscan(sx, sy, sz, sectp, bcos(sa), bsin(sa),
zvel << 6, &hitsectp, &wal, &hitsprt, &hitx, &hity, &hitz, CLIPMASK1);
if (isRRRA() && hitsectp != nullptr && (((hitsectp->lotag == 160 && zvel > 0) || (hitsectp->lotag == 161 && zvel < 0))
@ -294,7 +294,7 @@ static void shootweapon(DDukeActor* actor, int p, int sx, int sy, int sz, int sa
{
nz = effector->GetOwner()->sector()->ceilingz;
}
hitscan(nx, ny, nz, effector->GetOwner()->s->sectnum, bcos(sa), bsin(sa), zvel << 6,
hitscan(nx, ny, nz, effector->GetOwner()->s->sector(), bcos(sa), bsin(sa), zvel << 6,
&hitsectp, &wal, &hitsprt, &hitx, &hity, &hitz, CLIPMASK1);
break;
}

View file

@ -506,14 +506,15 @@ void prelevel_r(int g)
{
dist = sj->lotag << 4;
speed = sj->hitag;
for (ii = 0; ii < MAXSPRITES; ii++)
DukeSpriteIterator itt;
while(auto act = itt.Next())
{
auto spr = &sprite[ii];
auto spr = act->s;
if (spr->picnum == RRTILE66)
if (spr->lotag == sj->sectnum)
{
childsectnum = spr->sector();
deletesprite(ii);
deletesprite(act);
}
}
deletesprite(act);

View file

@ -129,7 +129,7 @@ int check_activator_motion(int lotag)
DukeStatIterator it1(STAT_EFFECTOR);
while (auto act2 = it1.Next())
{
if (act->s->sectnum == act2->s->sectnum)
if (act->s->sector() == act2->s->sector())
switch (act2->s->lotag)
{
case SE_11_SWINGING_DOOR:

View file

@ -1424,10 +1424,10 @@ void checkhitsprite_d(DDukeActor* targ, DDukeActor* proj)
if ((s->cstat & 48) == 0)
s->ang = (pspr->ang + 1024) & 2047;
s->xvel = -(pspr->extra << 2);
j = s->sectnum;
pushmove(&s->pos, &j, 128L, (4 << 8), (4 << 8), CLIPMASK0);
if (j != s->sectnum && validSectorIndex(j))
changeactorsect(targ, j);
auto sp = s->sector();
pushmove(&s->pos, &sp, 128L, (4 << 8), (4 << 8), CLIPMASK0);
if (sp != s->sector() && sp != nullptr)
changeactorsect(targ, sp);
}
if (s->statnum == 2)
@ -1623,17 +1623,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(), &ntsector, &ntwall, &neartagsprite, &neartaghitdist, 1280L, 1);
neartag(p->oposx, p->oposy, p->oposz, p->GetActor()->sector(), 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(), &ntsector, &ntwall, &neartagsprite, &neartaghitdist, 1280L, 1);
neartag(p->pos.x, p->pos.y, p->pos.z, p->GetActor()->sector(), 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);
neartag(p->pos.x, p->pos.y, p->pos.z + (8 << 8), p->GetActor()->sector(), 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);
neartag(p->pos.x, p->pos.y, p->pos.z + (16 << 8), p->GetActor()->sector(), 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, 3);
neartag(p->pos.x, p->pos.y, p->pos.z + (16 << 8), p->GetActor()->sector(), p->angle.oang.asbuild(), &ntsector, &ntwall, &neartagsprite, &neartaghitdist, 1280L, 3);
if (neartagsprite != nullptr)
{
switch (neartagsprite->s->picnum)

View file

@ -2572,21 +2572,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(), &ntsector, &ntwall, &neartagsprite, &neartaghitdist, 1280L, 3);
neartag(p->pos.x, p->pos.y, p->pos.z, p->GetActor()->sector(), 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(), &ntsector, &ntwall, &neartagsprite, &neartaghitdist, 1280L, 1);
neartag(p->oposx, p->oposy, p->oposz, p->GetActor()->sector(), 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(), &ntsector, &ntwall, &neartagsprite, &neartaghitdist, 1280L, 1);
neartag(p->pos.x, p->pos.y, p->pos.z, p->GetActor()->sector(), 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);
neartag(p->pos.x, p->pos.y, p->pos.z + (8 << 8), p->GetActor()->sector(), 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);
neartag(p->pos.x, p->pos.y, p->pos.z + (16 << 8), p->GetActor()->sector(), 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, 3);
neartag(p->pos.x, p->pos.y, p->pos.z + (16 << 8), p->GetActor()->sector(), p->angle.oang.asbuild(), &ntsector, &ntwall, &neartagsprite, &neartaghitdist, 1280L, 3);
if (neartagsprite != nullptr)
{
switch (neartagsprite->s->picnum)
@ -2915,7 +2915,7 @@ void dofurniture(walltype* wlwal, sectortype* sectp, int snum)
//
//---------------------------------------------------------------------------
void tearitup(int sect)
void tearitup(sectortype* sect)
{
DukeSectIterator it(sect);
while (auto act = it.Next())

View file

@ -265,7 +265,7 @@ inline bool S_IsAmbientSFX(DDukeActor* actor)
//
//==========================================================================
static int GetPositionInfo(DDukeActor* actor, int soundNum, int sectNum,
static int GetPositionInfo(DDukeActor* actor, int soundNum, sectortype* sect,
const vec3_t *cam, const vec3_t *pos, int *distPtr, FVector3 *sndPos)
{
// There's a lot of hackery going on here that could be mapped to rolloff and attenuation parameters.
@ -291,7 +291,7 @@ static int GetPositionInfo(DDukeActor* actor, int soundNum, int sectNum,
sndist += dist_adjust;
if (sndist < 0) sndist = 0;
if (sectNum > -1 && sndist && sp->picnum != MUSICANDSFX && !cansee(cam->x, cam->y, cam->z - (24 << 8), sectNum, sp->x, sp->y, sp->z - (24 << 8), sp->sectnum))
if (sect!= nullptr && sndist && sp->picnum != MUSICANDSFX && !cansee(cam->x, cam->y, cam->z - (24 << 8), sect, sp->x, sp->y, sp->z - (24 << 8), sp->sector()))
sndist += sndist >> (isRR() ? 2 : 5);
// Here the sound distance was clamped to a minimum of 144*4.
@ -325,19 +325,19 @@ static int GetPositionInfo(DDukeActor* actor, int soundNum, int sectNum,
//
//==========================================================================
void S_GetCamera(vec3_t** c, int32_t* ca, int32_t* cs)
void S_GetCamera(vec3_t** c, int32_t* ca, sectortype** cs)
{
if (ud.cameraactor == nullptr)
{
auto p = &ps[screenpeek];
if (c) *c = &p->pos;
if (cs) *cs = sectnum(p->cursector);
if (cs) *cs = p->cursector;
if (ca) *ca = p->angle.ang.asbuild();
}
else
{
if (c) *c = &ud.cameraactor->s->pos;
if (cs) *cs = ud.cameraactor->s->sectnum;
if (cs) *cs = ud.cameraactor->s->sector();
if (ca) *ca = ud.cameraactor->s->ang;
}
}
@ -355,7 +355,7 @@ void DukeSoundEngine::CalcPosVel(int type, const void* source, const float pt[3]
if (pos != nullptr)
{
vec3_t* campos;
int32_t camsect;
sectortype* camsect;
S_GetCamera(&campos, nullptr, &camsect);
if (vel) vel->Zero();
@ -402,7 +402,8 @@ void GameInterface::UpdateSounds(void)
{
SoundListener listener;
vec3_t* c;
int32_t ca, cs;
int32_t ca;
sectortype* cs;
if (isRR() && !Mus_IsPlaying() && !paused && gamestate == GS_LEVEL)
S_PlayRRMusic();
@ -480,7 +481,7 @@ int S_PlaySound3D(int sndnum, DDukeActor* actor, const vec3_t* pos, int channel,
FVector3 sndpos; // this is in sound engine space.
vec3_t* campos;
int32_t camsect;
sectortype* camsect;
S_GetCamera(&campos, nullptr, &camsect);
GetPositionInfo(actor, sndnum, camsect, campos, pos, &sndist, &sndpos);

View file

@ -1476,7 +1476,7 @@ void PreMapCombineFloors(void)
int i, j, k;
int base_offset;
int dx, dy;
int dasect, startwall, endwall, nextsector;
int startwall, endwall, nextsector;
short pnum;
typedef struct
@ -1544,7 +1544,7 @@ void PreMapCombineFloors(void)
TRAVERSE_CONNECT(pnum)
{
PLAYERp pp = &Player[pnum];
dasect = pp->cursectnum;
unsigned dasect = pp->cursectnum;
search.Rewind();
for (unsigned itsect; (itsect = search.GetNext()) != BFSSearch::EOL;)
{