- various sectnums,

This commit is contained in:
Christoph Oelckers 2021-11-23 00:13:30 +01:00
parent 9b19845dfb
commit eaa155d52e
8 changed files with 29 additions and 33 deletions

View file

@ -168,7 +168,7 @@ void DoRegenerates();
// lavadude
void BuildLava(DExhumedActor* nSprite, int x, int y, int z, int nSector, int nAngle, int nChannel);
void BuildLava(DExhumedActor* nSprite, int x, int y, int z, sectortype* nSector, int nAngle, int nChannel);
DExhumedActor* BuildLavaLimb(DExhumedActor* nSprite, int edx, int ebx);
void FuncLavaLimb(int, int, int, int);
void FuncLava(int, int, int, int);

View file

@ -411,7 +411,7 @@ MOVEEND:
nVal = coll.type || coll.exbits? 1:0;
// pSprite->sectnum may have changed since we set nSectFlag ?
// pSprite.sectnum may have changed since we set nSectFlag ?
int nFlagVal = nSectFlag ^ pSprite->sector()->Flag;
if (nFlagVal & kSectUnderwater)
{

View file

@ -437,14 +437,14 @@ void AIFish::Tick(RunListEvent* ev)
int x = pSprite->x;
int y = pSprite->y;
int z = pSprite->z;
int nSector =pSprite->sectnum;
auto pSector =pSprite->sector();
// loc_2EF54
Collision coll = movesprite(pActor, pSprite->xvel << 13, pSprite->yvel << 13, pSprite->zvel << 2, 0, 0, CLIPMASK0);
if (!(pSprite->sector()->Flag & kSectUnderwater))
{
ChangeActorSect(pActor, nSector);
ChangeActorSect(pActor, pSector);
pSprite->x = x;
pSprite->y = y;
pSprite->z = z;

View file

@ -241,7 +241,7 @@ void ResetSwordSeqs()
WeaponInfo[kWeaponSword].b[3] = 7;
}
Collision CheckCloseRange(int nPlayer, int *x, int *y, int *z, int *nSector)
Collision CheckCloseRange(int nPlayer, int *x, int *y, int *z, sectortype* *nSector)
{
int hitSect, hitWall, hitSprite;
int hitX, hitY, hitZ;
@ -254,7 +254,7 @@ Collision CheckCloseRange(int nPlayer, int *x, int *y, int *z, int *nSector)
vec3_t startPos = { *x, *y, *z };
hitdata_t hitData;
hitscan(&startPos, *nSector, xVect, yVect, 0, &hitData, CLIPMASK1);
hitscan(&startPos, sectnum(*nSector), xVect, yVect, 0, &hitData, CLIPMASK1);
hitX = hitData.pos.x;
hitY = hitData.pos.y;
hitZ = hitData.pos.z;
@ -282,7 +282,7 @@ Collision CheckCloseRange(int nPlayer, int *x, int *y, int *z, int *nSector)
*x = hitX;
*y = hitY;
*z = hitZ;
*nSector = hitSect;
*nSector = &sector[hitSect];
if (hitSprite > -1) {
c.setSprite(&exhumedActors[hitSprite]);
@ -697,7 +697,7 @@ loc_flag:
}
}
int nSectorB = pPlayerSprite->sectnum;
auto pSectorB = pPlayerSprite->sector();
switch (nWeapon)
{
@ -717,8 +717,7 @@ loc_flag:
var_28 = 9;
}
auto cRange = CheckCloseRange(nPlayer, &theX, &theY, &theZ, &nSectorB);
auto pSectorB = &sector[nSectorB];
auto cRange = CheckCloseRange(nPlayer, &theX, &theY, &theZ, &pSectorB);
if (cRange.type != kHitNone)
{
@ -820,7 +819,7 @@ loc_flag:
auto t = sPlayerInput[nPlayer].pTarget;
// only autoaim if target is in front of the player.
auto pTargetSprite = &t->s();
assert(validSectorIndex(pTargetSprite->sectnum));
assert(pTargetSprite->sector());
int angletotarget = bvectangbam(pTargetSprite->x - pPlayerSprite->x, pTargetSprite->y - pPlayerSprite->y).asbuild();
int anglediff = (pPlayerSprite->ang - angletotarget) & 2047;
if (anglediff < 512 || anglediff > 1536)

View file

@ -460,7 +460,7 @@ void ProcessSpriteTag(DExhumedActor* pActor, int nLotag, int nHitag)
return;
}
BuildLava(pActor, 0, 0, 0, 0, 0, nChannel);
BuildLava(pActor, 0, 0, 0, nullptr, 0, nChannel);
return;
}
case 107:

View file

@ -40,9 +40,8 @@ static actionSeq LavadudeSeq[] = {
DExhumedActor* BuildLavaLimb(DExhumedActor* pActor, int move, int ebx)
{
auto pSprite = &pActor->s();
int nSector =pSprite->sectnum;
auto pLimbActor = insertActor(nSector, 118);
auto pLimbActor = insertActor(pSprite->sector(), 118);
auto pLimbSprite = &pLimbActor->s();
pLimbSprite->x = pSprite->x;
@ -104,18 +103,18 @@ void AILavaDudeLimb::Draw(RunListEvent* ev)
}
void BuildLava(DExhumedActor* pActor, int x, int y, int, int nSector, int nAngle, int nChannel)
void BuildLava(DExhumedActor* pActor, int x, int y, int, sectortype* pSector, int nAngle, int nChannel)
{
spritetype* pSprite;
if (pActor == nullptr)
{
pActor = insertActor(nSector, 118);
pActor = insertActor(pSector, 118);
pSprite = &pActor->s();
}
else
{
pSprite = &pActor->s();
nSector = pSprite->sectnum;
pSector = pSprite->sector();
nAngle = pSprite->ang;
x = pSprite->x;
y = pSprite->y;
@ -125,7 +124,7 @@ void BuildLava(DExhumedActor* pActor, int x, int y, int, int nSector, int nAngle
pSprite->x = x;
pSprite->y = y;
pSprite->z = sector[nSector].floorz;
pSprite->z = pSector->floorz;
pSprite->cstat = 0x8000;
pSprite->xrepeat = 200;
pSprite->yrepeat = 200;
@ -296,13 +295,13 @@ void AILavaDude::Tick(RunListEvent* ev)
int x = pSprite->x;
int y = pSprite->y;
int z = pSprite->z;
int nSector =pSprite->sectnum;
auto pSector =pSprite->sector();
auto coll = movesprite(pActor, pSprite->xvel << 8, pSprite->yvel << 8, 0, 0, 0, CLIPMASK0);
if (nSector != pSprite->sectnum)
if (pSector != pSprite->sector())
{
ChangeActorSect(pActor, nSector);
ChangeActorSect(pActor, pSector);
pSprite->x = x;
pSprite->y = y;
pSprite->z = z;

View file

@ -298,12 +298,11 @@ int BelowNear(DExhumedActor* pActor, int x, int y, int walldist, int _nSector)
Collision movespritez(DExhumedActor* pActor, int z, int height, int, int clipdist)
{
spritetype* pSprite = &pActor->s();
int nSector =pSprite->sectnum;
auto pSector = pSprite->sector();
assert(validSectorIndex(nSector));
assert(pSector);
overridesect = nSector;
int edi = nSector;
overridesect = sectnum(pSector);
auto pSect2 = pSector;
// backup cstat
uint16_t cstat = pSprite->cstat;
@ -312,17 +311,17 @@ Collision movespritez(DExhumedActor* pActor, int z, int height, int, int clipdis
Collision nRet(0);
int nSectFlags = sector[nSector].Flag;
int nSectFlags = pSector->Flag;
if (nSectFlags & kSectUnderwater) {
z >>= 1;
}
int spriteZ = pSprite->z;
int floorZ = sector[nSector].floorz;
int floorZ = pSector->floorz;
int ebp = spriteZ + z;
int eax = sector[nSector].ceilingz + (height >> 1);
int eax = pSector->ceilingz + (height >> 1);
if ((nSectFlags & kSectUnderwater) && ebp < eax) {
ebp = eax;
@ -334,11 +333,11 @@ Collision movespritez(DExhumedActor* pActor, int z, int height, int, int clipdis
ChangeActorSect(pActor, pSprite->sector()->pBelow);
}
if (edi != nSector)
if (pSect2 != pSector)
{
pSprite->z = ebp;
if (sector[edi].Flag & kSectUnderwater)
if (pSect2->Flag & kSectUnderwater)
{
if (pActor == PlayerList[nLocalPlayer].Actor()) {
D3PlayFX(StaticSound[kSound2], pActor);
@ -451,9 +450,8 @@ Collision movespritez(DExhumedActor* pActor, int z, int height, int, int clipdis
if (spriteZ <= floorZ && ebp > floorZ)
{
if ((sector[nSector].Depth != 0) || (edi != nSector && (sector[edi].Flag & kSectUnderwater)))
if ((pSector->Depth != 0) || (pSect2 != pSector && (pSect2->Flag & kSectUnderwater)))
{
assert(validSectorIndex(nSector));
BuildSplash(pActor, pSector);
}
}

View file

@ -78,7 +78,7 @@ static int osdcmd_spawn(CCmdFuncPtr parm)
else if (!stricmp(c, "mummy")) BuildMummy(nullptr, initx, inity, sectp->floorz, initsect, inita);
else if (!stricmp(c, "fish")) BuildFish(nullptr, initx, inity, initz + PlayerList[nLocalPlayer].eyelevel, initsect, inita);
else if (!stricmp(c, "lion")) BuildLion(nullptr, initx, inity, sectp->floorz, initsect, inita);
else if (!stricmp(c, "lava")) BuildLava(nullptr, initx, inity, sectp->floorz, initsect, inita, nNetPlayerCount);
else if (!stricmp(c, "lava")) BuildLava(nullptr, initx, inity, sectp->floorz, sectp, inita, nNetPlayerCount);
else if (!stricmp(c, "rex")) BuildRex(nullptr, initx, inity, sectp->floorz, initsect, inita, nNetPlayerCount);
else if (!stricmp(c, "set")) BuildSet(nullptr, initx, inity, sectp->floorz, initsect, inita, nNetPlayerCount);
else if (!stricmp(c, "queen")) BuildQueen(nullptr, initx, inity, sectp->floorz, initsect, inita, nNetPlayerCount);