- Replace spritetypebase z with pos.Z calls and eliminate spritetypebase pos union.

This commit is contained in:
Mitchell Richters 2021-12-22 22:29:00 +11:00 committed by Christoph Oelckers
parent cecb8dc48e
commit baf78848eb
138 changed files with 1690 additions and 1693 deletions

View file

@ -137,10 +137,10 @@ static int32_t spriteGetZOfSlope(const spritetype* spr, int32_t dax, int32_t day
{ {
int16_t const heinum = spriteGetSlope(spr); int16_t const heinum = spriteGetSlope(spr);
if (heinum == 0) if (heinum == 0)
return spr->z; return spr->pos.Z;
int const j = DMulScale(bsin(spr->ang + 1024), day - spr->pos.Y, -bsin(spr->ang + 512), dax - spr->pos.X, 4); int const j = DMulScale(bsin(spr->ang + 1024), day - spr->pos.Y, -bsin(spr->ang + 512), dax - spr->pos.X, 4);
return spr->z + MulScale(heinum, j, 18); return spr->pos.Z + MulScale(heinum, j, 18);
} }
@ -607,7 +607,7 @@ CollisionBase clipmove_(vec3_t * const pos, int * const sectnum, int32_t xvect,
case CSTAT_SPRITE_ALIGNMENT_FACING: case CSTAT_SPRITE_ALIGNMENT_FACING:
if (p1.X >= clipMin.X && p1.X <= clipMax.X && p1.Y >= clipMin.Y && p1.Y <= clipMax.Y) if (p1.X >= clipMin.X && p1.X <= clipMax.X && p1.Y >= clipMin.Y && p1.Y <= clipMax.Y)
{ {
int32_t height, daz = spr->z+spriteheightofsptr(spr, &height, 1); int32_t height, daz = spr->pos.Z+spriteheightofsptr(spr, &height, 1);
if (pos->Z > daz-height-flordist && pos->Z < daz+ceildist) if (pos->Z > daz-height-flordist && pos->Z < daz+ceildist)
{ {
@ -623,7 +623,7 @@ CollisionBase clipmove_(vec3_t * const pos, int * const sectnum, int32_t xvect,
case CSTAT_SPRITE_ALIGNMENT_WALL: case CSTAT_SPRITE_ALIGNMENT_WALL:
{ {
int32_t height, daz = spr->z+spriteheightofsptr(spr, &height, 1); int32_t height, daz = spr->pos.Z+spriteheightofsptr(spr, &height, 1);
if (pos->Z > daz-height-flordist && pos->Z < daz+ceildist) if (pos->Z > daz-height-flordist && pos->Z < daz+ceildist)
{ {
@ -668,7 +668,7 @@ CollisionBase clipmove_(vec3_t * const pos, int * const sectnum, int32_t xvect,
else else
{ {
heinum = 0; heinum = 0;
sz = spr->z; sz = spr->pos.Z;
} }
if (pos->Z > sz - flordist && pos->Z < sz + ceildist) if (pos->Z > sz - flordist && pos->Z < sz + ceildist)
@ -734,7 +734,7 @@ CollisionBase clipmove_(vec3_t * const pos, int * const sectnum, int32_t xvect,
int32_t zz[3] = { pos->Z, pos->Z + flordist, pos->Z - ceildist }; int32_t zz[3] = { pos->Z, pos->Z + flordist, pos->Z - ceildist };
for (int k = 0; k < 3; k++) for (int k = 0; k < 3; k++)
{ {
int32_t jj = DivScale(spr->z - zz[k], heinum, 18); int32_t jj = DivScale(spr->pos.Z - zz[k], heinum, 18);
int32_t jj2 = MulScale(jj, ratio, 12); int32_t jj2 = MulScale(jj, ratio, 12);
if (jj2 > (centery << 8) || jj2 < ((centery - rspany) << 8)) if (jj2 > (centery << 8) || jj2 < ((centery - rspany) << 8))
continue; continue;
@ -1150,7 +1150,7 @@ void getzrange(const vec3_t& pos, sectortype* sect, int32_t* ceilz, CollisionBas
int32_t k = walldist+(spr->clipdist<<2)+1; int32_t k = walldist+(spr->clipdist<<2)+1;
if ((abs(v1.X-pos.X) <= k) && (abs(v1.Y-pos.Y) <= k)) if ((abs(v1.X-pos.X) <= k) && (abs(v1.Y-pos.Y) <= k))
{ {
daz = spr->z + spriteheightofsptr(spr, &k, 1); daz = spr->pos.Z + spriteheightofsptr(spr, &k, 1);
daz2 = daz - k; daz2 = daz - k;
clipyou = 1; clipyou = 1;
} }
@ -1165,7 +1165,7 @@ void getzrange(const vec3_t& pos, sectortype* sect, int32_t* ceilz, CollisionBas
if (clipinsideboxline(pos.X,pos.Y,v1.X,v1.Y,v2.X,v2.Y,walldist+1) != 0) if (clipinsideboxline(pos.X,pos.Y,v1.X,v1.Y,v2.X,v2.Y,walldist+1) != 0)
{ {
int32_t k; int32_t k;
daz = spr->z + spriteheightofsptr(spr, &k, 1); daz = spr->pos.Z + spriteheightofsptr(spr, &k, 1);
daz2 = daz-k; daz2 = daz-k;
clipyou = 1; clipyou = 1;
} }
@ -1175,7 +1175,7 @@ void getzrange(const vec3_t& pos, sectortype* sect, int32_t* ceilz, CollisionBas
case CSTAT_SPRITE_ALIGNMENT_FLOOR: case CSTAT_SPRITE_ALIGNMENT_FLOOR:
case CSTAT_SPRITE_ALIGNMENT_SLOPE: case CSTAT_SPRITE_ALIGNMENT_SLOPE:
{ {
if ((cstat & CSTAT_SPRITE_ALIGNMENT_MASK) == CSTAT_SPRITE_ALIGNMENT_FLOOR) daz = spr->z; if ((cstat & CSTAT_SPRITE_ALIGNMENT_MASK) == CSTAT_SPRITE_ALIGNMENT_FLOOR) daz = spr->pos.Z;
else daz = spriteGetZOfSlope(spr, pos.X, pos.Y); else daz = spriteGetZOfSlope(spr, pos.X, pos.Y);
if ((cstat & CSTAT_SPRITE_ONE_SIDE) != 0 && (pos.Z > daz) == ((cstat & CSTAT_SPRITE_YFLIP)==0)) if ((cstat & CSTAT_SPRITE_ONE_SIDE) != 0 && (pos.Z > daz) == ((cstat & CSTAT_SPRITE_YFLIP)==0))
@ -1414,7 +1414,7 @@ int hitscan(const vec3_t& start, const sectortype* startsect, const vec3_t& dire
if ((cstat&dasprclipmask) == 0) if ((cstat&dasprclipmask) == 0)
continue; continue;
x1 = spr->pos.X; y1 = spr->pos.Y; z1 = spr->z; x1 = spr->pos.X; y1 = spr->pos.Y; z1 = spr->pos.Z;
switch (cstat&CSTAT_SPRITE_ALIGNMENT_MASK) switch (cstat&CSTAT_SPRITE_ALIGNMENT_MASK)
{ {
case 0: case 0:
@ -1446,7 +1446,7 @@ int hitscan(const vec3_t& start, const sectortype* startsect, const vec3_t& dire
if (abs(intx-sv->X)+abs(inty-sv->Y) > abs((hitinfo.hitpos.X)-sv->X)+abs((hitinfo.hitpos.Y)-sv->Y)) if (abs(intx-sv->X)+abs(inty-sv->Y) > abs((hitinfo.hitpos.X)-sv->X)+abs((hitinfo.hitpos.Y)-sv->Y))
continue; continue;
daz = spr->z + spriteheightofsptr(&actor->s(), &k, 1); daz = spr->pos.Z + spriteheightofsptr(&actor->s(), &k, 1);
if (intz > daz-k && intz < daz) if (intz > daz-k && intz < daz)
{ {
if (picanm[tilenum].sf&PICANM_TEXHITSCAN_BIT) if (picanm[tilenum].sf&PICANM_TEXHITSCAN_BIT)
@ -1507,7 +1507,7 @@ int hitscan(const vec3_t& start, const sectortype* startsect, const vec3_t& dire
if (j == 0) continue; if (j == 0) continue;
if ((cstat & 64) != 0) if ((cstat & 64) != 0)
if ((j < 0) == ((cstat & 8) == 0)) continue; if ((j < 0) == ((cstat & 8) == 0)) continue;
int32_t i = ((spr->z - sv->Z) << 8) + DMulScale(dax, sv->Y - spr->pos.Y, -day, sv->X - spr->pos.X, 15); int32_t i = ((spr->pos.Z - sv->Z) << 8) + DMulScale(dax, sv->Y - spr->pos.Y, -day, sv->X - spr->pos.X, 15);
if ((i ^ j) < 0 || (abs(i) >> 1) >= abs(j)) continue; if ((i ^ j) < 0 || (abs(i) >> 1) >= abs(j)) continue;
i = DivScale(i, j, 30); i = DivScale(i, j, 30);

View file

@ -1180,7 +1180,7 @@ static int32_t polymost_md3draw(md3model_t *m, tspriteptr_t tspr)
a0.Z = m->zadd * m->scale; a0.Z = m->zadd * m->scale;
// Parkar: Moved up to be able to use k0 for the y-flipping code // Parkar: Moved up to be able to use k0 for the y-flipping code
k0 = (float)tspr->z+sext->position_offset.Z; k0 = (float)tspr->pos.Z+sext->position_offset.Z;
f = ((globalorientation & 8) && (spr->cstat & CSTAT_SPRITE_ALIGNMENT_MASK) != CSTAT_SPRITE_ALIGNMENT_FACING) ? -4.f : 4.f; f = ((globalorientation & 8) && (spr->cstat & CSTAT_SPRITE_ALIGNMENT_MASK) != CSTAT_SPRITE_ALIGNMENT_FACING) ? -4.f : 4.f;
k0 -= (tspr->yoffset*tspr->yrepeat)*f; k0 -= (tspr->yoffset*tspr->yrepeat)*f;
if ((globalorientation&128) && !((globalorientation & CSTAT_SPRITE_ALIGNMENT_MASK) == CSTAT_SPRITE_ALIGNMENT_FLOOR)) if ((globalorientation&128) && !((globalorientation & CSTAT_SPRITE_ALIGNMENT_MASK) == CSTAT_SPRITE_ALIGNMENT_FLOOR))

View file

@ -2577,8 +2577,8 @@ static inline int32_t polymost_findwall(tspritetype const * const tspr, vec2_t c
for(auto& wal : wallsofsector(sect)) for(auto& wal : wallsofsector(sect))
{ {
if ((!wal.twoSided() || ((wal.nextSector()->ceilingz > (tspr->z - ((tsiz->Y * tspr->yrepeat) << 2))) || if ((!wal.twoSided() || ((wal.nextSector()->ceilingz > (tspr->pos.Z - ((tsiz->Y * tspr->yrepeat) << 2))) ||
wal.nextSector()->floorz < tspr->z)) && !polymost_getclosestpointonwall((const vec2_t *) tspr, wallnum(&wal), &n)) wal.nextSector()->floorz < tspr->pos.Z)) && !polymost_getclosestpointonwall((const vec2_t *) tspr, wallnum(&wal), &n))
{ {
int const dst = abs(tspr->pos.X - n.X) + abs(tspr->pos.Y - n.Y); int const dst = abs(tspr->pos.X - n.X) + abs(tspr->pos.Y - n.Y);
@ -2639,10 +2639,10 @@ static inline float tspriteGetZOfSlopeFloat(tspriteptr_t const tspr, float dax,
{ {
int16_t const heinum = tspriteGetSlope(tspr); int16_t const heinum = tspriteGetSlope(tspr);
if (heinum == 0) if (heinum == 0)
return float(tspr->z); return float(tspr->pos.Z);
float const f = bsin(tspr->ang + 1024) * (day - tspr->pos.Y) - bsin(tspr->ang + 512) * (dax - tspr->pos.X); float const f = bsin(tspr->ang + 1024) * (day - tspr->pos.Y) - bsin(tspr->ang + 512) * (dax - tspr->pos.X);
return float(tspr->z) + heinum * f * (1.f / 4194304.f); return float(tspr->pos.Z) + heinum * f * (1.f / 4194304.f);
} }
@ -3381,7 +3381,7 @@ static inline int comparetsprites(int const k, int const l)
if (tspriteptr[k]->pos.X == tspriteptr[l]->pos.X && if (tspriteptr[k]->pos.X == tspriteptr[l]->pos.X &&
tspriteptr[k]->pos.Y == tspriteptr[l]->pos.Y && tspriteptr[k]->pos.Y == tspriteptr[l]->pos.Y &&
tspriteptr[k]->z == tspriteptr[l]->z && tspriteptr[k]->pos.Z == tspriteptr[l]->pos.Z &&
(tspriteptr[k]->cstat & CSTAT_SPRITE_ALIGNMENT_MASK) == (tspriteptr[l]->cstat & CSTAT_SPRITE_ALIGNMENT_MASK) && (tspriteptr[k]->cstat & CSTAT_SPRITE_ALIGNMENT_MASK) == (tspriteptr[l]->cstat & CSTAT_SPRITE_ALIGNMENT_MASK) &&
tspriteptr[k]->ownerActor != tspriteptr[l]->ownerActor) tspriteptr[k]->ownerActor != tspriteptr[l]->ownerActor)
return tspriteptr[k]->ownerActor->GetIndex() - tspriteptr[l]->ownerActor->GetIndex(); return tspriteptr[k]->ownerActor->GetIndex() - tspriteptr[l]->ownerActor->GetIndex();
@ -3428,7 +3428,7 @@ static void sortsprites(int const start, int const end)
{ {
auto const s = tspriteptr[k]; auto const s = tspriteptr[k];
spritesxyz[k].Z = s->z; spritesxyz[k].Z = s->pos.Z;
if ((s->cstat & CSTAT_SPRITE_ALIGNMENT_MASK) != CSTAT_SPRITE_ALIGNMENT_FLOOR) if ((s->cstat & CSTAT_SPRITE_ALIGNMENT_MASK) != CSTAT_SPRITE_ALIGNMENT_FLOOR)
{ {
int32_t yoff = tileTopOffset(s->picnum) + s->yoffset; int32_t yoff = tileTopOffset(s->picnum) + s->yoffset;
@ -3826,7 +3826,7 @@ int32_t polymost_voxdraw(voxmodel_t* m, tspriteptr_t const tspr, bool rotate)
f = (float)tspr->yrepeat * k0; f = (float)tspr->yrepeat * k0;
m0.Z *= f; a0.Z *= f; m0.Z *= f; a0.Z *= f;
k0 = (float)(tspr->z + tspr->ownerActor->sx().position_offset.Z); k0 = (float)(tspr->pos.Z + tspr->ownerActor->sx().position_offset.Z);
f = ((globalorientation & 8) && (tspr->ownerActor->spr.cstat & CSTAT_SPRITE_ALIGNMENT_MASK) != 0) ? -4.f : 4.f; f = ((globalorientation & 8) && (tspr->ownerActor->spr.cstat & CSTAT_SPRITE_ALIGNMENT_MASK) != 0) ? -4.f : 4.f;
k0 -= (tspr->yoffset * tspr->yrepeat) * f * m->bscale; k0 -= (tspr->yoffset * tspr->yrepeat) * f * m->bscale;
zoff = m->siz.Z * .5f; zoff = m->siz.Z * .5f;

View file

@ -608,7 +608,7 @@ void renderDrawMapView(int cposx, int cposy, int czoom, int cang)
{ {
auto A = *(spritetype**)a; auto A = *(spritetype**)a;
auto B = *(spritetype**)b; auto B = *(spritetype**)b;
if (A->z != B->z) return B->z - A->z; if (A->pos.Z != B->pos.Z) return B->pos.Z - A->pos.Z;
return A->time - B->time; // ensures stable sort. return A->time - B->time; // ensures stable sort.
}); });

View file

@ -274,10 +274,10 @@ inline int tspriteGetSlope(const tspritetype* spr)
inline int32_t tspriteGetZOfSlope(const tspritetype* tspr, int dax, int day) inline int32_t tspriteGetZOfSlope(const tspritetype* tspr, int dax, int day)
{ {
int heinum = tspriteGetSlope(tspr); int heinum = tspriteGetSlope(tspr);
if (heinum == 0) return tspr->z; if (heinum == 0) return tspr->pos.Z;
int const j = DMulScale(bsin(tspr->ang + 1024), day - tspr->pos.Y, -bsin(tspr->ang + 512), dax - tspr->pos.X, 4); int const j = DMulScale(bsin(tspr->ang + 1024), day - tspr->pos.Y, -bsin(tspr->ang + 512), dax - tspr->pos.X, 4);
return tspr->z + MulScale(heinum, j, 18); return tspr->pos.Z + MulScale(heinum, j, 18);
} }

View file

@ -381,10 +381,7 @@ struct walltype
struct spritetypebase struct spritetypebase
{ {
// todo: get rid of the single variables! // todo: get rid of the single variables!
union {
struct { int32_t BLAHBLAHX, BLAHBLAHY, z; };
vec3_t pos; vec3_t pos;
};
union { union {
struct { int32_t ox, oy, oz; }; struct { int32_t ox, oy, oz; };
vec3_t opos; vec3_t opos;
@ -436,7 +433,7 @@ struct spritetypebase
int32_t interpolatedz(double const smoothratio, int const scale = 16) int32_t interpolatedz(double const smoothratio, int const scale = 16)
{ {
return interpolatedvalue(oz, z, smoothratio, scale); return interpolatedvalue(oz, pos.Z, smoothratio, scale);
} }
vec2_t interpolatedvec2(double const smoothratio, int const scale = 16) vec2_t interpolatedvec2(double const smoothratio, int const scale = 16)

View file

@ -397,7 +397,7 @@ void HWFlat::ProcessFlatSprite(HWDrawInfo* di, tspritetype* sprite, sectortype*
{ {
int tilenum = sprite->picnum; int tilenum = sprite->picnum;
texture = tileGetTexture(tilenum); texture = tileGetTexture(tilenum);
z = sprite->z * (1 / -256.f); z = sprite->pos.Z * (1 / -256.f);
if (z == di->Viewpoint.Pos.Z) return; // looking right at the edge. if (z == di->Viewpoint.Pos.Z) return; // looking right at the edge.
dynlightindex = -1; dynlightindex = -1;

View file

@ -332,7 +332,7 @@ void HWSprite::Process(HWDrawInfo* di, tspritetype* spr, sectortype* sector, int
SetSpriteTranslucency(spr, alpha, RenderStyle); SetSpriteTranslucency(spr, alpha, RenderStyle);
x = spr->pos.X * (1 / 16.f); x = spr->pos.X * (1 / 16.f);
z = spr->z * (1 / -256.f); z = spr->pos.Z * (1 / -256.f);
y = spr->pos.Y * (1 / -16.f); y = spr->pos.Y * (1 / -16.f);
auto vp = di->Viewpoint; auto vp = di->Viewpoint;
@ -396,7 +396,7 @@ void HWSprite::Process(HWDrawInfo* di, tspritetype* spr, sectortype* sector, int
x = spr->pos.X * (1 / 16.f); x = spr->pos.X * (1 / 16.f);
y = spr->pos.Y * (1 / -16.f); y = spr->pos.Y * (1 / -16.f);
z = spr->z * (1 / -256.f); z = spr->pos.Z * (1 / -256.f);
x1 = x - viewvecY * (xoff - (width * 0.5f)); x1 = x - viewvecY * (xoff - (width * 0.5f));
x2 = x - viewvecY * (xoff + (width * 0.5f)); x2 = x - viewvecY * (xoff + (width * 0.5f));
@ -504,7 +504,7 @@ bool HWSprite::ProcessVoxel(HWDrawInfo* di, voxmodel_t* vox, tspritetype* spr, s
scalevec.Z *= sprzscale; scalevec.Z *= sprzscale;
translatevec.Z *= sprzscale; translatevec.Z *= sprzscale;
float zpos = (float)(spr->z + sprext->position_offset.Z); float zpos = (float)(spr->pos.Z + sprext->position_offset.Z);
float zscale = ((spr->cstat & CSTAT_SPRITE_YFLIP) && (spr->ownerActor->spr.cstat & CSTAT_SPRITE_ALIGNMENT_MASK) != 0) ? -4.f : 4.f; float zscale = ((spr->cstat & CSTAT_SPRITE_YFLIP) && (spr->ownerActor->spr.cstat & CSTAT_SPRITE_ALIGNMENT_MASK) != 0) ? -4.f : 4.f;
zpos -= (spr->yoffset * spr->yrepeat) * zscale * voxel->bscale; zpos -= (spr->yoffset * spr->yrepeat) * zscale * voxel->bscale;

View file

@ -114,11 +114,11 @@ static int IsOnWall(tspritetype* tspr, int height)
vec2_t n; vec2_t n;
walltype* closest = nullptr; walltype* closest = nullptr;
int topz = (tspr->z - ((height * tspr->yrepeat) << 2)); int topz = (tspr->pos.Z - ((height * tspr->yrepeat) << 2));
for(auto& wal : wallsofsector(sect)) for(auto& wal : wallsofsector(sect))
{ {
if ((wal.nextsector == -1 || ((wal.nextSector()->ceilingz > topz) || if ((wal.nextsector == -1 || ((wal.nextSector()->ceilingz > topz) ||
wal.nextSector()->floorz < tspr->z)) && !GetClosestPointOnWall(tspr, &wal, &n)) wal.nextSector()->floorz < tspr->pos.Z)) && !GetClosestPointOnWall(tspr, &wal, &n))
{ {
int const dst = abs(tspr->pos.X - n.X) + abs(tspr->pos.Y - n.Y); int const dst = abs(tspr->pos.X - n.X) + abs(tspr->pos.Y - n.Y);

View file

@ -448,7 +448,7 @@ FSerializer &Serialize(FSerializer &arc, const char *key, spritetype &c, spritet
{ {
arc("x", c.pos.X, def->pos.X) arc("x", c.pos.X, def->pos.X)
("y", c.pos.Y, def->pos.Y) ("y", c.pos.Y, def->pos.Y)
("z", c.z, def->z) ("z", c.pos.Z, def->pos.Z)
("cstat", c.cstat, def->cstat) ("cstat", c.cstat, def->cstat)
("picnum", c.picnum, def->picnum) ("picnum", c.picnum, def->picnum)
("shade", c.shade, def->shade) ("shade", c.shade, def->shade)

View file

@ -38,7 +38,7 @@ void collectTSpritesForPortal(int x, int y, int i, int interpolation)
pTSprite->setsector(nSector2); pTSprite->setsector(nSector2);
pTSprite->pos.X = pSprite->pos.X + dx; pTSprite->pos.X = pSprite->pos.X + dx;
pTSprite->pos.Y = pSprite->pos.Y + dy; pTSprite->pos.Y = pSprite->pos.Y + dy;
pTSprite->z = pSprite->z + dz; pTSprite->pos.Z = pSprite->pos.Z + dz;
pTSprite->ang = pSprite->ang; pTSprite->ang = pSprite->ang;
pTSprite->picnum = pSprite->picnum; pTSprite->picnum = pSprite->picnum;
pTSprite->shade = pSprite->shade; pTSprite->shade = pSprite->shade;
@ -53,7 +53,7 @@ void collectTSpritesForPortal(int x, int y, int i, int interpolation)
pTSprite->flags = pSprite->hitag | 0x200; pTSprite->flags = pSprite->hitag | 0x200;
pTSprite->pos.X = dx + interpolatedvalue(pSprite->ox, pSprite->pos.X, interpolation); pTSprite->pos.X = dx + interpolatedvalue(pSprite->ox, pSprite->pos.X, interpolation);
pTSprite->pos.Y = dy + interpolatedvalue(pSprite->oy, pSprite->pos.Y, interpolation); pTSprite->pos.Y = dy + interpolatedvalue(pSprite->oy, pSprite->pos.Y, interpolation);
pTSprite->z = dz + interpolatedvalue(pSprite->oz, pSprite->z, interpolation); pTSprite->pos.Z = dz + interpolatedvalue(pSprite->oz, pSprite->pos.Z, interpolation);
pTSprite->ang = pSprite->interpolatedang(interpolation); pTSprite->ang = pSprite->interpolatedang(interpolation);
int nAnim = 0; int nAnim = 0;

View file

@ -2550,7 +2550,7 @@ static void ConcussSprite(DBloodActor* source, DBloodActor* actor, int x, int y,
auto pSprite = &actor->s(); auto pSprite = &actor->s();
int dx = pSprite->pos.X - x; int dx = pSprite->pos.X - x;
int dy = pSprite->pos.Y - y; int dy = pSprite->pos.Y - y;
int dz = (pSprite->z - z) >> 4; int dz = (pSprite->pos.Z - z) >> 4;
int dist2 = 0x40000 + dx * dx + dy * dy + dz * dz; int dist2 = 0x40000 + dx * dx + dy * dy + dz * dz;
assert(dist2 > 0); assert(dist2 > 0);
damage = scale(0x40000, damage, dist2); damage = scale(0x40000, damage, dist2);
@ -2667,7 +2667,7 @@ void actRadiusDamage(DBloodActor* source, int x, int y, int z, sectortype* pSect
int dx = abs(x - pSprite2->pos.X); int dx = abs(x - pSprite2->pos.X);
int dy = abs(y - pSprite2->pos.Y); int dy = abs(y - pSprite2->pos.Y);
int dz = abs(z - pSprite2->z) >> 4; int dz = abs(z - pSprite2->pos.Z) >> 4;
int dist = ksqrt(dx * dx + dy * dy + dz * dz); int dist = ksqrt(dx * dx + dy * dy + dz * dz);
if (dist > nDist) continue; if (dist > nDist) continue;
@ -2727,7 +2727,7 @@ static void actNapalmMove(DBloodActor* actor)
if (Chance(0x8000)) pSprite->cstat |= CSTAT_SPRITE_XFLIP; if (Chance(0x8000)) pSprite->cstat |= CSTAT_SPRITE_XFLIP;
sfxPlay3DSound(actor, 303, 24 + (pSprite->flags & 3), 1); sfxPlay3DSound(actor, 303, 24 + (pSprite->flags & 3), 1);
actRadiusDamage(pOwner, pSprite->pos.X, pSprite->pos.Y, pSprite->z, pSprite->sector(), 128, 0, 60, kDamageExplode, 15, 120); actRadiusDamage(pOwner, pSprite->pos.X, pSprite->pos.Y, pSprite->pos.Z, pSprite->sector(), 128, 0, 60, kDamageExplode, 15, 120);
if (pXSprite->data4 > 1) if (pXSprite->data4 > 1)
{ {
@ -2895,8 +2895,8 @@ DBloodActor* actDropObject(DBloodActor* actor, int nType)
{ {
int top, bottom; int top, bottom;
GetActorExtents(act2, &top, &bottom); GetActorExtents(act2, &top, &bottom);
if (bottom >= act2->spr.z) if (bottom >= act2->spr.pos.Z)
act2->spr.z -= bottom - act2->spr.z; act2->spr.pos.Z -= bottom - act2->spr.pos.Z;
} }
return act2; return act2;
@ -2917,7 +2917,7 @@ bool actHealDude(DBloodActor* actor, int add, int threshold)
if (pXDude->health < (unsigned)threshold) if (pXDude->health < (unsigned)threshold)
{ {
spritetype* pSprite = &actor->s(); spritetype* pSprite = &actor->s();
if (actor->IsPlayerActor()) sfxPlay3DSound(pSprite->pos.X, pSprite->pos.Y, pSprite->z, 780, pSprite->sector()); if (actor->IsPlayerActor()) sfxPlay3DSound(pSprite->pos.X, pSprite->pos.Y, pSprite->pos.Z, 780, pSprite->sector());
pXDude->health = min<uint32_t>(pXDude->health + add, threshold); pXDude->health = min<uint32_t>(pXDude->health + add, threshold);
return true; return true;
} }
@ -2992,7 +2992,7 @@ static bool actKillModernDude(DBloodActor* actor, DAMAGE_TYPE damageType)
else else
{ {
seqKill(actor); seqKill(actor);
DBloodActor* pEffectA = gFX.fxSpawnActor((FX_ID)52, pSprite->sector(), pSprite->pos.X, pSprite->pos.Y, pSprite->z, pSprite->ang); DBloodActor* pEffectA = gFX.fxSpawnActor((FX_ID)52, pSprite->sector(), pSprite->pos.X, pSprite->pos.Y, pSprite->pos.Z, pSprite->ang);
if (pEffectA != nullptr) if (pEffectA != nullptr)
{ {
auto pEffect = &pEffectA->s(); auto pEffect = &pEffectA->s();
@ -3773,7 +3773,7 @@ static int actDamageThing(DBloodActor* source, DBloodActor* actor, int damage, D
{ {
case -1: case -1:
GibSprite(actor, GIBTYPE_14, nullptr, nullptr); GibSprite(actor, GIBTYPE_14, nullptr, nullptr);
sfxPlay3DSound(pSprite->pos.X, pSprite->pos.Y, pSprite->z, 312, pSprite->sector()); sfxPlay3DSound(pSprite->pos.X, pSprite->pos.Y, pSprite->pos.Z, 312, pSprite->sector());
actPostSprite(actor, kStatFree); actPostSprite(actor, kStatFree);
break; break;
@ -3932,7 +3932,7 @@ static void actImpactMissile(DBloodActor* missileActor, int hitCode)
case 4: case 4:
if (pWallHit) if (pWallHit)
{ {
auto pFX = gFX.fxSpawnActor(FX_52, pMissile->sector(), pMissile->pos.X, pMissile->pos.Y, pMissile->z, 0); auto pFX = gFX.fxSpawnActor(FX_52, pMissile->sector(), pMissile->pos.X, pMissile->pos.Y, pMissile->pos.Z, 0);
if (pFX) pFX->spr.ang = (GetWallAngle(pWallHit) + 512) & 2047; if (pFX) pFX->spr.ang = (GetWallAngle(pWallHit) + 512) & 2047;
} }
break; break;
@ -3953,7 +3953,7 @@ static void actImpactMissile(DBloodActor* missileActor, int hitCode)
case kMissileArcGargoyle: case kMissileArcGargoyle:
sfxKill3DSound(missileActor, -1, -1); sfxKill3DSound(missileActor, -1, -1);
sfxPlay3DSound(pMissile->pos.X, pMissile->pos.Y, pMissile->z, 306, pMissile->sector()); sfxPlay3DSound(pMissile->pos.X, pMissile->pos.Y, pMissile->pos.Z, 306, pMissile->sector());
GibSprite(missileActor, GIBTYPE_6, NULL, NULL); GibSprite(missileActor, GIBTYPE_6, NULL, NULL);
if (hitCode == 3 && pSpriteHit && (pThingInfo || pDudeInfo)) if (hitCode == 3 && pSpriteHit && (pThingInfo || pDudeInfo))
@ -3967,7 +3967,7 @@ static void actImpactMissile(DBloodActor* missileActor, int hitCode)
case kMissileLifeLeechAltNormal: case kMissileLifeLeechAltNormal:
case kMissileLifeLeechAltSmall: case kMissileLifeLeechAltSmall:
sfxKill3DSound(missileActor, -1, -1); sfxKill3DSound(missileActor, -1, -1);
sfxPlay3DSound(pMissile->pos.X, pMissile->pos.Y, pMissile->z, 306, pMissile->sector()); sfxPlay3DSound(pMissile->pos.X, pMissile->pos.Y, pMissile->pos.Z, 306, pMissile->sector());
if (hitCode == 3 && pSpriteHit && (pThingInfo || pDudeInfo)) if (hitCode == 3 && pSpriteHit && (pThingInfo || pDudeInfo))
{ {
@ -4006,7 +4006,7 @@ static void actImpactMissile(DBloodActor* missileActor, int hitCode)
evPostActor(actorHit, 0, kCallbackFXFlameLick); evPostActor(actorHit, 0, kCallbackFXFlameLick);
actBurnSprite(missileOwner, actorHit, 480); actBurnSprite(missileOwner, actorHit, 480);
actRadiusDamage(missileOwner, pMissile->pos.X, pMissile->pos.Y, pMissile->z, pMissile->sector(), 16, 20, 10, kDamageBullet, 6, 480); actRadiusDamage(missileOwner, pMissile->pos.X, pMissile->pos.Y, pMissile->pos.Z, pMissile->sector(), 16, 20, 10, kDamageBullet, 6, 480);
// by NoOne: allow additional bullet damage for Flare Gun // by NoOne: allow additional bullet damage for Flare Gun
if (gGameOptions.weaponsV10x && !VanillaMode()) if (gGameOptions.weaponsV10x && !VanillaMode())
@ -4025,7 +4025,7 @@ static void actImpactMissile(DBloodActor* missileActor, int hitCode)
{ {
pMissile->picnum = 2123; pMissile->picnum = 2123;
missileActor->SetTarget(actorHit); missileActor->SetTarget(actorHit);
pXMissile->targetZ = pMissile->z - pSpriteHit->z; pXMissile->targetZ = pMissile->pos.Z - pSpriteHit->pos.Z;
pXMissile->goalAng = getangle(pMissile->pos.X - pSpriteHit->pos.X, pMissile->pos.Y - pSpriteHit->pos.Y) - pSpriteHit->ang; pXMissile->goalAng = getangle(pMissile->pos.X - pSpriteHit->pos.X, pMissile->pos.Y - pSpriteHit->pos.Y) - pSpriteHit->ang;
pXMissile->state = 1; pXMissile->state = 1;
actPostSprite(missileActor, kStatFlare); actPostSprite(missileActor, kStatFlare);
@ -4081,7 +4081,7 @@ static void actImpactMissile(DBloodActor* missileActor, int hitCode)
case kMissileEctoSkull: case kMissileEctoSkull:
sfxKill3DSound(missileActor, -1, -1); sfxKill3DSound(missileActor, -1, -1);
sfxPlay3DSound(pMissile->pos.X, pMissile->pos.Y, pMissile->z, 522, pMissile->sector()); sfxPlay3DSound(pMissile->pos.X, pMissile->pos.Y, pMissile->pos.Z, 522, pMissile->sector());
actPostSprite(missileActor, kStatDebris); actPostSprite(missileActor, kStatDebris);
seqSpawn(20, missileActor, -1); seqSpawn(20, missileActor, -1);
if (hitCode == 3 && actorHit && actorHit->hasX()) if (hitCode == 3 && actorHit && actorHit->hasX())
@ -4114,7 +4114,7 @@ static void actImpactMissile(DBloodActor* missileActor, int hitCode)
case kMissileTeslaRegular: case kMissileTeslaRegular:
sfxKill3DSound(missileActor, -1, -1); sfxKill3DSound(missileActor, -1, -1);
sfxPlay3DSound(pMissile->pos.X, pMissile->pos.Y, pMissile->z, 518, pMissile->sector()); sfxPlay3DSound(pMissile->pos.X, pMissile->pos.Y, pMissile->pos.Z, 518, pMissile->sector());
GibSprite(missileActor, (hitCode == 2) ? GIBTYPE_23 : GIBTYPE_22, NULL, NULL); GibSprite(missileActor, (hitCode == 2) ? GIBTYPE_23 : GIBTYPE_22, NULL, NULL);
evKillActor(missileActor); evKillActor(missileActor);
seqKill(missileActor); seqKill(missileActor);
@ -4357,7 +4357,7 @@ static void checkHit(DBloodActor* actor)
break; break;
case kThingZombieHead: case kThingZombieHead:
sfxPlay3DSound(pSprite->pos.X, pSprite->pos.Y, pSprite->z, 357, pSprite->sector()); sfxPlay3DSound(pSprite->pos.X, pSprite->pos.Y, pSprite->pos.Z, 357, pSprite->sector());
actKickObject(actor, actor2); actKickObject(actor, actor2);
actDamageSprite(nullptr, actor2, kDamageFall, 80); actDamageSprite(nullptr, actor2, kDamageFall, 80);
break; break;
@ -4439,7 +4439,7 @@ static void checkFloorHit(DBloodActor* actor)
pPlayer->kickPower = PlayClock + 60; pPlayer->kickPower = PlayClock + 60;
} }
actKickObject(actor, actor2); actKickObject(actor, actor2);
sfxPlay3DSound(pSprite->pos.X, pSprite->pos.Y, pSprite->z, 357, pSprite->sector()); sfxPlay3DSound(pSprite->pos.X, pSprite->pos.Y, pSprite->pos.Z, 357, pSprite->sector());
sfxPlay3DSound(actor, 374, 0, 0); sfxPlay3DSound(actor, 374, 0, 0);
break; break;
case kThingZombieHead: case kThingZombieHead:
@ -4449,7 +4449,7 @@ static void checkFloorHit(DBloodActor* actor)
pPlayer->kickPower = PlayClock + 60; pPlayer->kickPower = PlayClock + 60;
} }
actKickObject(actor, actor2); actKickObject(actor, actor2);
sfxPlay3DSound(pSprite->pos.X, pSprite->pos.Y, pSprite->z, 357, pSprite->sector()); sfxPlay3DSound(pSprite->pos.X, pSprite->pos.Y, pSprite->pos.Z, 357, pSprite->sector());
actDamageSprite(nullptr, actor2, kDamageFall, 80); actDamageSprite(nullptr, actor2, kDamageFall, 80);
break; break;
case kTrapSawCircular: case kTrapSawCircular:
@ -4616,7 +4616,7 @@ static Collision MoveThing(DBloodActor* actor)
pSprite->cstat &= ~CSTAT_SPRITE_BLOCK_ALL; pSprite->cstat &= ~CSTAT_SPRITE_BLOCK_ALL;
if ((actor->GetOwner()) && !cl_bloodvanillaexplosions && !VanillaMode()) if ((actor->GetOwner()) && !cl_bloodvanillaexplosions && !VanillaMode())
enginecompatibility_mode = ENGINECOMPATIBILITY_NONE; // improved clipmove accuracy enginecompatibility_mode = ENGINECOMPATIBILITY_NONE; // improved clipmove accuracy
ClipMove(pSprite->pos, &pSector, actor->xvel >> 12, actor->yvel >> 12, pSprite->clipdist << 2, (pSprite->z - top) / 4, (bottom - pSprite->z) / 4, CLIPMASK0, lhit); ClipMove(pSprite->pos, &pSector, actor->xvel >> 12, actor->yvel >> 12, pSprite->clipdist << 2, (pSprite->pos.Z - top) / 4, (bottom - pSprite->pos.Z) / 4, CLIPMASK0, lhit);
actor->hit.hit = lhit; actor->hit.hit = lhit;
enginecompatibility_mode = bakCompat; // restore enginecompatibility_mode = bakCompat; // restore
pSprite->cstat = bakCstat; pSprite->cstat = bakCstat;
@ -4647,10 +4647,10 @@ static Collision MoveThing(DBloodActor* actor)
else else
{ {
assert(pSector); assert(pSector);
FindSector(pSprite->pos.X, pSprite->pos.Y, pSprite->z, &pSector); FindSector(pSprite->pos.X, pSprite->pos.Y, pSprite->pos.Z, &pSector);
} }
pSprite->z += actor->zvel >> 8; pSprite->pos.Z += actor->zvel >> 8;
int ceilZ, floorZ; int ceilZ, floorZ;
Collision ceilColl, floorColl; Collision ceilColl, floorColl;
@ -4659,11 +4659,11 @@ static Collision MoveThing(DBloodActor* actor)
if ((pSprite->flags & 2) && bottom < floorZ) if ((pSprite->flags & 2) && bottom < floorZ)
{ {
pSprite->z += 455; pSprite->pos.Z += 455;
actor->zvel += 58254; actor->zvel += 58254;
if (pSprite->type == kThingZombieHead) if (pSprite->type == kThingZombieHead)
{ {
auto* fxActor = gFX.fxSpawnActor(FX_27, pSprite->sector(), pSprite->pos.X, pSprite->pos.Y, pSprite->z, 0); auto* fxActor = gFX.fxSpawnActor(FX_27, pSprite->sector(), pSprite->pos.X, pSprite->pos.Y, pSprite->pos.Z, 0);
if (fxActor) if (fxActor)
{ {
int v34 = (PlayClock * 3) & 2047; int v34 = (PlayClock * 3) & 2047;
@ -4688,7 +4688,7 @@ static Collision MoveThing(DBloodActor* actor)
{ {
actTouchFloor(actor, pSprite->sector()); actTouchFloor(actor, pSprite->sector());
actor->hit.florhit = floorColl; actor->hit.florhit = floorColl;
pSprite->z += floorZ - bottom; pSprite->pos.Z += floorZ - bottom;
int v20 = actor->zvel - pSprite->sector()->velFloor; int v20 = actor->zvel - pSprite->sector()->velFloor;
if (v20 > 0) if (v20 > 0)
@ -4743,7 +4743,7 @@ static Collision MoveThing(DBloodActor* actor)
if (top <= ceilZ) if (top <= ceilZ)
{ {
actor->hit.ceilhit = ceilColl; actor->hit.ceilhit = ceilColl;
pSprite->z += ClipLow(ceilZ - top, 0); pSprite->pos.Z += ClipLow(ceilZ - top, 0);
if (actor->zvel < 0) if (actor->zvel < 0)
{ {
actor->xvel = MulScale(actor->xvel, 0xc000, 16); actor->xvel = MulScale(actor->xvel, 0xc000, 16);
@ -4819,8 +4819,8 @@ void MoveDude(DBloodActor* actor)
DUDEINFO* pDudeInfo = getDudeInfo(pSprite->type); DUDEINFO* pDudeInfo = getDudeInfo(pSprite->type);
int top, bottom; int top, bottom;
GetActorExtents(actor, &top, &bottom); GetActorExtents(actor, &top, &bottom);
int bz = (bottom - pSprite->z) / 4; int bz = (bottom - pSprite->pos.Z) / 4;
int tz = (pSprite->z - top) / 4; int tz = (pSprite->pos.Z - top) / 4;
int wd = pSprite->clipdist << 2; int wd = pSprite->clipdist << 2;
auto pSector = pSprite->sector(); auto pSector = pSprite->sector();
int nAiStateType = (pXSprite->aiState) ? pXSprite->aiState->stateType : -1; int nAiStateType = (pXSprite->aiState) ? pXSprite->aiState->stateType : -1;
@ -4919,7 +4919,7 @@ void MoveDude(DBloodActor* actor)
else else
{ {
assert(pSector); assert(pSector);
FindSector(pSprite->pos.X, pSprite->pos.Y, pSprite->z, &pSector); FindSector(pSprite->pos.X, pSprite->pos.Y, pSprite->pos.Z, &pSector);
} }
XSECTOR* pXSector = pSector->hasX() ? &pSector->xs() : nullptr; XSECTOR* pXSector = pSector->hasX() ? &pSector->xs() : nullptr;
@ -4955,7 +4955,7 @@ void MoveDude(DBloodActor* actor)
if (pUpperLink && (pUpperLink->spr.type == kMarkerUpWater || pUpperLink->spr.type == kMarkerUpGoo)) bDepth = 1; if (pUpperLink && (pUpperLink->spr.type == kMarkerUpWater || pUpperLink->spr.type == kMarkerUpGoo)) bDepth = 1;
if (pLowerLink && (pLowerLink->spr.type == kMarkerLowWater || pLowerLink->spr.type == kMarkerLowGoo)) bDepth = 1; if (pLowerLink && (pLowerLink->spr.type == kMarkerLowWater || pLowerLink->spr.type == kMarkerLowGoo)) bDepth = 1;
if (pPlayer) wd += 16; if (pPlayer) wd += 16;
if (actor->zvel) pSprite->z += actor->zvel >> 8; if (actor->zvel) pSprite->pos.Z += actor->zvel >> 8;
int ceilZ, floorZ; int ceilZ, floorZ;
Collision ceilColl, floorColl; Collision ceilColl, floorColl;
@ -4991,7 +4991,7 @@ void MoveDude(DBloodActor* actor)
} }
if (vc) if (vc)
{ {
pSprite->z += ((vc * 4) / 2) >> 8; pSprite->pos.Z += ((vc * 4) / 2) >> 8;
actor->zvel += vc; actor->zvel += vc;
} }
} }
@ -5173,7 +5173,7 @@ void MoveDude(DBloodActor* actor)
int floorZ2 = floorZ; int floorZ2 = floorZ;
auto floorColl2 = floorColl; auto floorColl2 = floorColl;
GetZRange(actor, &ceilZ, &ceilColl, &floorZ, &floorColl, pSprite->clipdist << 2, CLIPMASK0, PARALLAXCLIP_CEILING | PARALLAXCLIP_FLOOR); GetZRange(actor, &ceilZ, &ceilColl, &floorZ, &floorColl, pSprite->clipdist << 2, CLIPMASK0, PARALLAXCLIP_CEILING | PARALLAXCLIP_FLOOR);
if (bottom <= floorZ && pSprite->z - floorZ2 < bz) if (bottom <= floorZ && pSprite->pos.Z - floorZ2 < bz)
{ {
floorZ = floorZ2; floorZ = floorZ2;
floorColl = floorColl2; floorColl = floorColl2;
@ -5182,7 +5182,7 @@ void MoveDude(DBloodActor* actor)
if (floorZ <= bottom) if (floorZ <= bottom)
{ {
actor->hit.florhit = floorColl; actor->hit.florhit = floorColl;
pSprite->z += floorZ - bottom; pSprite->pos.Z += floorZ - bottom;
int v30 = actor->zvel - pSprite->sector()->velFloor; int v30 = actor->zvel - pSprite->sector()->velFloor;
if (v30 > 0) if (v30 > 0)
{ {
@ -5222,7 +5222,7 @@ void MoveDude(DBloodActor* actor)
auto pFXs = &pFX->s(); auto pFXs = &pFX->s();
for (int i = 0; i < 7; i++) for (int i = 0; i < 7; i++)
{ {
auto pFX2 = gFX.fxSpawnActor(FX_14, pFXs->sector(), pFXs->pos.X, pFXs->pos.Y, pFXs->z, 0); auto pFX2 = gFX.fxSpawnActor(FX_14, pFXs->sector(), pFXs->pos.X, pFXs->pos.Y, pFXs->pos.Z, 0);
if (pFX2) if (pFX2)
{ {
pFX2->xvel = Random2(0x6aaaa); pFX2->xvel = Random2(0x6aaaa);
@ -5249,7 +5249,7 @@ void MoveDude(DBloodActor* actor)
if (top <= ceilZ) if (top <= ceilZ)
{ {
actor->hit.ceilhit = ceilColl; actor->hit.ceilhit = ceilColl;
pSprite->z += ClipLow(ceilZ - top, 0); pSprite->pos.Z += ClipLow(ceilZ - top, 0);
if (actor->zvel <= 0 && (pSprite->flags & 4)) if (actor->zvel <= 0 && (pSprite->flags & 4))
actor->zvel = MulScale(-actor->zvel, 0x2000, 16); actor->zvel = MulScale(-actor->zvel, 0x2000, 16);
@ -5323,10 +5323,10 @@ int MoveMissile(DBloodActor* actor)
RotatePoint(&vx, &vy, (nTargetAngle + 1536) & 2047, 0, 0); RotatePoint(&vx, &vy, (nTargetAngle + 1536) & 2047, 0, 0);
actor->xvel = vx; actor->xvel = vx;
actor->yvel = vy; actor->yvel = vy;
int dz = pTarget->z - pSprite->z; int dz = pTarget->pos.Z - pSprite->pos.Z;
int deltaz = dz / 10; int deltaz = dz / 10;
if (pTarget->z < pSprite->z) deltaz = -deltaz; if (pTarget->pos.Z < pSprite->pos.Z) deltaz = -deltaz;
actor->zvel += deltaz; actor->zvel += deltaz;
} }
} }
@ -5424,7 +5424,7 @@ int MoveMissile(DBloodActor* actor)
cliptype = 1; cliptype = 1;
} }
pSprite->pos = pos; pSprite->pos = pos;
pSprite->z += vz; pSprite->pos.Z += vz;
updatesector(pos.X, pos.Y, &pSector); updatesector(pos.X, pos.Y, &pSector);
if (pSector != nullptr && pSector != pSprite->sector()) if (pSector != nullptr && pSector != pSprite->sector())
{ {
@ -5435,7 +5435,7 @@ int MoveMissile(DBloodActor* actor)
gHitInfo.hitSector = pSprite->sector(); gHitInfo.hitSector = pSprite->sector();
gHitInfo.hitpos.X = pSprite->pos.X; gHitInfo.hitpos.X = pSprite->pos.X;
gHitInfo.hitpos.Y = pSprite->pos.Y; gHitInfo.hitpos.Y = pSprite->pos.Y;
gHitInfo.hitpos.Z = pSprite->z; gHitInfo.hitpos.Z = pSprite->pos.Z;
break; break;
} }
if (pOwner) pOwner->cstat = bakCstat; if (pOwner) pOwner->cstat = bakCstat;
@ -5519,7 +5519,7 @@ void actExplodeSprite(DBloodActor* actor)
case kThingTNTBarrel: case kThingTNTBarrel:
{ {
auto spawned = actSpawnSprite(pSprite->sector(), pSprite->pos.X, pSprite->pos.Y, pSprite->z, 0, 1); auto spawned = actSpawnSprite(pSprite->sector(), pSprite->pos.X, pSprite->pos.Y, pSprite->pos.Z, 0, 1);
spawned->SetOwner(actor->GetOwner()); spawned->SetOwner(actor->GetOwner());
if (actCheckRespawn(actor)) if (actCheckRespawn(actor))
{ {
@ -5621,7 +5621,7 @@ void actActivateGibObject(DBloodActor* actor)
if (gib1 > 0) GibSprite(actor, (GIBTYPE)(gib1 - 1), nullptr, nullptr); if (gib1 > 0) GibSprite(actor, (GIBTYPE)(gib1 - 1), nullptr, nullptr);
if (gib2 > 0) GibSprite(actor, (GIBTYPE)(gib2 - 1), nullptr, nullptr); if (gib2 > 0) GibSprite(actor, (GIBTYPE)(gib2 - 1), nullptr, nullptr);
if (gib3 > 0 && pXSprite->burnTime > 0) GibSprite(actor, (GIBTYPE)(gib3 - 1), nullptr, nullptr); if (gib3 > 0 && pXSprite->burnTime > 0) GibSprite(actor, (GIBTYPE)(gib3 - 1), nullptr, nullptr);
if (sound > 0) sfxPlay3DSound(pSprite->pos.X, pSprite->pos.Y, pSprite->z, sound, pSprite->sector()); if (sound > 0) sfxPlay3DSound(pSprite->pos.X, pSprite->pos.Y, pSprite->pos.Z, sound, pSprite->sector());
if (dropmsg > 0) actDropObject(actor, dropmsg); if (dropmsg > 0) actDropObject(actor, dropmsg);
if (!(pSprite->cstat & CSTAT_SPRITE_INVISIBLE) && !(pSprite->flags & kHitagRespawn)) if (!(pSprite->cstat & CSTAT_SPRITE_INVISIBLE) && !(pSprite->flags & kHitagRespawn))
@ -5703,7 +5703,7 @@ static void actCheckProximity()
proxyDist = 512; proxyDist = 512;
} }
if (CheckProximity(dudeactor, pSprite->pos.X, pSprite->pos.Y, pSprite->z, pSprite->sector(), proxyDist)) if (CheckProximity(dudeactor, pSprite->pos.X, pSprite->pos.Y, pSprite->pos.Z, pSprite->sector(), proxyDist))
{ {
switch (pSprite->type) switch (pSprite->type)
{ {
@ -5825,7 +5825,7 @@ static void actCheckThings()
case kThingPodGreenBall: case kThingPodGreenBall:
if (hit.type == kHitSector) if (hit.type == kHitSector)
{ {
actRadiusDamage(actor->GetOwner(), pSprite->pos.X, pSprite->pos.Y, pSprite->z, pSprite->sector(), 200, 1, 20, kDamageExplode, 6, 0); actRadiusDamage(actor->GetOwner(), pSprite->pos.X, pSprite->pos.Y, pSprite->pos.Z, pSprite->sector(), 200, 1, 20, kDamageExplode, 6, 0);
evPostActor(actor, 0, kCallbackFXPodBloodSplat); evPostActor(actor, 0, kCallbackFXPodBloodSplat);
} }
else if (hit.type == kHitSprite) else if (hit.type == kHitSprite)
@ -5893,7 +5893,7 @@ static void actCheckExplosion()
const EXPLOSION* pExplodeInfo = &explodeInfo[nType]; const EXPLOSION* pExplodeInfo = &explodeInfo[nType];
int x = pSprite->pos.X; int x = pSprite->pos.X;
int y = pSprite->pos.Y; int y = pSprite->pos.Y;
int z = pSprite->z; int z = pSprite->pos.Z;
auto pSector = pSprite->sector(); auto pSector = pSprite->sector();
int radius = pExplodeInfo->radius; int radius = pExplodeInfo->radius;
@ -5977,7 +5977,7 @@ static void actCheckExplosion()
spritetype* pSprite2 = gPlayer[p].pSprite; spritetype* pSprite2 = gPlayer[p].pSprite;
int dx = (x - pSprite2->pos.X) >> 4; int dx = (x - pSprite2->pos.X) >> 4;
int dy = (y - pSprite2->pos.Y) >> 4; int dy = (y - pSprite2->pos.Y) >> 4;
int dz = (z - pSprite2->z) >> 8; int dz = (z - pSprite2->pos.Z) >> 8;
int nDist = dx * dx + dy * dy + dz * dz + 0x40000; int nDist = dx * dx + dy * dy + dz * dz + 0x40000;
int t = DivScale(pXSprite->data2, nDist, 16); int t = DivScale(pXSprite->data2, nDist, 16);
gPlayer[p].flickerEffect += t; gPlayer[p].flickerEffect += t;
@ -6064,7 +6064,7 @@ static void actCheckTraps()
{ {
int x = pSprite->pos.X; int x = pSprite->pos.X;
int y = pSprite->pos.Y; int y = pSprite->pos.Y;
int z = pSprite->z; int z = pSprite->pos.Z;
int t = (pXSprite->data1 << 23) / 120; int t = (pXSprite->data1 << 23) / 120;
int dx = MulScale(t, Cos(pSprite->ang), 30); int dx = MulScale(t, Cos(pSprite->ang), 30);
int dy = MulScale(t, Sin(pSprite->ang), 30); int dy = MulScale(t, Sin(pSprite->ang), 30);
@ -6158,7 +6158,7 @@ static void actCheckDudes()
if ((unsigned int)pXSprite2->health > 0 && actor2->IsPlayerActor()) if ((unsigned int)pXSprite2->health > 0 && actor2->IsPlayerActor())
{ {
if (CheckProximity(actor2, pSprite->pos.X, pSprite->pos.Y, pSprite->z, pSprite->sector(), 128)) if (CheckProximity(actor2, pSprite->pos.X, pSprite->pos.Y, pSprite->pos.Z, pSprite->sector(), 128))
trTriggerSprite(actor, kCmdSpriteProximity); trTriggerSprite(actor, kCmdSpriteProximity);
} }
} }
@ -6276,7 +6276,7 @@ void actCheckFlares()
{ {
int x = pTarget->pos.X + mulscale30r(Cos(pXSprite->goalAng + pTarget->ang), pTarget->clipdist * 2); int x = pTarget->pos.X + mulscale30r(Cos(pXSprite->goalAng + pTarget->ang), pTarget->clipdist * 2);
int y = pTarget->pos.Y + mulscale30r(Sin(pXSprite->goalAng + pTarget->ang), pTarget->clipdist * 2); int y = pTarget->pos.Y + mulscale30r(Sin(pXSprite->goalAng + pTarget->ang), pTarget->clipdist * 2);
int z = pTarget->z + pXSprite->targetZ; int z = pTarget->pos.Z + pXSprite->targetZ;
vec3_t pos = { x, y, z }; vec3_t pos = { x, y, z };
SetActor(actor, &pos); SetActor(actor, &pos);
actor->xvel = target->xvel; actor->xvel = target->xvel;
@ -6352,7 +6352,7 @@ DBloodActor* actSpawnSprite(DBloodActor* source, int nStat)
spritetype* pSprite = &actor->s(); spritetype* pSprite = &actor->s();
pSprite->pos.X = pSource->pos.X; pSprite->pos.X = pSource->pos.X;
pSprite->pos.Y = pSource->pos.Y; pSprite->pos.Y = pSource->pos.Y;
pSprite->z = pSource->z; pSprite->pos.Z = pSource->pos.Z;
actor->xvel = source->xvel; actor->xvel = source->xvel;
actor->yvel = source->yvel; actor->yvel = source->yvel;
actor->zvel = source->zvel; actor->zvel = source->zvel;
@ -6381,7 +6381,7 @@ DBloodActor* actSpawnDude(DBloodActor* source, int nType, int a3, int a4)
int angle = pSource->ang; int angle = pSource->ang;
int nDude = nType - kDudeBase; int nDude = nType - kDudeBase;
int x, y, z; int x, y, z;
z = a4 + pSource->z; z = a4 + pSource->pos.Z;
if (a3 < 0) if (a3 < 0)
{ {
x = pSource->pos.X; x = pSource->pos.X;
@ -6545,7 +6545,7 @@ DBloodActor* actFireThing(DBloodActor* actor, int a2, int a3, int a4, int thingT
assert(thingType >= kThingBase && thingType < kThingMax); assert(thingType >= kThingBase && thingType < kThingMax);
int x = pSprite->pos.X + MulScale(a2, Cos(pSprite->ang + 512), 30); int x = pSprite->pos.X + MulScale(a2, Cos(pSprite->ang + 512), 30);
int y = pSprite->pos.Y + MulScale(a2, Sin(pSprite->ang + 512), 30); int y = pSprite->pos.Y + MulScale(a2, Sin(pSprite->ang + 512), 30);
int z = pSprite->z + a3; int z = pSprite->pos.Z + a3;
x += MulScale(pSprite->clipdist, Cos(pSprite->ang), 28); x += MulScale(pSprite->clipdist, Cos(pSprite->ang), 28);
y += MulScale(pSprite->clipdist, Sin(pSprite->ang), 28); y += MulScale(pSprite->clipdist, Sin(pSprite->ang), 28);
if (HitScan(actor, z, x - pSprite->pos.X, y - pSprite->pos.Y, 0, CLIPMASK0, pSprite->clipdist) != -1) if (HitScan(actor, z, x - pSprite->pos.X, y - pSprite->pos.Y, 0, CLIPMASK0, pSprite->clipdist) != -1)
@ -6660,7 +6660,7 @@ DBloodActor* actFireMissile(DBloodActor* actor, int a2, int a3, int a4, int a5,
const MissileType* pMissileInfo = &missileInfo[nType - kMissileBase]; const MissileType* pMissileInfo = &missileInfo[nType - kMissileBase];
int x = pSprite->pos.X + MulScale(a2, Cos(pSprite->ang + 512), 30); int x = pSprite->pos.X + MulScale(a2, Cos(pSprite->ang + 512), 30);
int y = pSprite->pos.Y + MulScale(a2, Sin(pSprite->ang + 512), 30); int y = pSprite->pos.Y + MulScale(a2, Sin(pSprite->ang + 512), 30);
int z = pSprite->z + a3; int z = pSprite->pos.Z + a3;
int clipdist = pMissileInfo->clipDist + pSprite->clipdist; int clipdist = pMissileInfo->clipDist + pSprite->clipdist;
x += MulScale(clipdist, Cos(pSprite->ang), 28); x += MulScale(clipdist, Cos(pSprite->ang), 28);
y += MulScale(clipdist, Sin(pSprite->ang), 28); y += MulScale(clipdist, Sin(pSprite->ang), 28);
@ -6854,7 +6854,7 @@ void actFireVector(DBloodActor* shooter, int a2, int a3, int a4, int a5, int a6,
gHitInfo.hitActor = shooter; gHitInfo.hitActor = shooter;
gHitInfo.hitpos.X = pShooter->pos.X; gHitInfo.hitpos.X = pShooter->pos.X;
gHitInfo.hitpos.Y = pShooter->pos.Y; gHitInfo.hitpos.Y = pShooter->pos.Y;
gHitInfo.hitpos.Z = pShooter->z; gHitInfo.hitpos.Z = pShooter->pos.Z;
} }
} }
} }
@ -7093,7 +7093,7 @@ void actFireVector(DBloodActor* shooter, int a2, int a3, int a4, int a5, int a6,
void FireballSeqCallback(int, DBloodActor* actor) void FireballSeqCallback(int, DBloodActor* actor)
{ {
auto pSprite = &actor->s(); auto pSprite = &actor->s();
auto pFX = gFX.fxSpawnActor(FX_11, pSprite->sector(), pSprite->pos.X, pSprite->pos.Y, pSprite->z, 0); auto pFX = gFX.fxSpawnActor(FX_11, pSprite->sector(), pSprite->pos.X, pSprite->pos.Y, pSprite->pos.Z, 0);
if (pFX) if (pFX)
{ {
pFX->xvel = actor->xvel; pFX->xvel = actor->xvel;
@ -7105,7 +7105,7 @@ void FireballSeqCallback(int, DBloodActor* actor)
void NapalmSeqCallback(int, DBloodActor* actor) void NapalmSeqCallback(int, DBloodActor* actor)
{ {
auto pSprite = &actor->s(); auto pSprite = &actor->s();
auto pFX = gFX.fxSpawnActor(FX_12, pSprite->sector(), pSprite->pos.X, pSprite->pos.Y, pSprite->z, 0); auto pFX = gFX.fxSpawnActor(FX_12, pSprite->sector(), pSprite->pos.X, pSprite->pos.Y, pSprite->pos.Z, 0);
if (pFX) if (pFX)
{ {
pFX->xvel = actor->xvel; pFX->xvel = actor->xvel;
@ -7117,7 +7117,7 @@ void NapalmSeqCallback(int, DBloodActor* actor)
void Fx32Callback(int, DBloodActor* actor) void Fx32Callback(int, DBloodActor* actor)
{ {
auto pSprite = &actor->s(); auto pSprite = &actor->s();
auto pFX = gFX.fxSpawnActor(FX_32, pSprite->sector(), pSprite->pos.X, pSprite->pos.Y, pSprite->z, 0); auto pFX = gFX.fxSpawnActor(FX_32, pSprite->sector(), pSprite->pos.X, pSprite->pos.Y, pSprite->pos.Z, 0);
if (pFX) if (pFX)
{ {
pFX->xvel = actor->xvel; pFX->xvel = actor->xvel;
@ -7129,7 +7129,7 @@ void Fx32Callback(int, DBloodActor* actor)
void Fx33Callback(int, DBloodActor* actor) void Fx33Callback(int, DBloodActor* actor)
{ {
auto pSprite = &actor->s(); auto pSprite = &actor->s();
auto pFX = gFX.fxSpawnActor(FX_33, pSprite->sector(), pSprite->pos.X, pSprite->pos.Y, pSprite->z, 0); auto pFX = gFX.fxSpawnActor(FX_33, pSprite->sector(), pSprite->pos.X, pSprite->pos.Y, pSprite->pos.Z, 0);
if (pFX) if (pFX)
{ {
pFX->xvel = actor->xvel; pFX->xvel = actor->xvel;
@ -7249,7 +7249,7 @@ void MakeSplash(DBloodActor* actor)
{ {
auto pSprite = &actor->s(); auto pSprite = &actor->s();
pSprite->flags &= ~2; pSprite->flags &= ~2;
pSprite->z -= 4 << 8; pSprite->pos.Z -= 4 << 8;
int nSurface = tileGetSurfType(actor->hit.florhit); int nSurface = tileGetSurfType(actor->hit.florhit);
switch (pSprite->type) switch (pSprite->type)
{ {

View file

@ -137,7 +137,7 @@ bool CanMove(DBloodActor* actor, DBloodActor* target, int nAngle, int nRange)
GetActorExtents(actor, &top, &bottom); GetActorExtents(actor, &top, &bottom);
int x = pSprite->pos.X; int x = pSprite->pos.X;
int y = pSprite->pos.Y; int y = pSprite->pos.Y;
int z = pSprite->z; int z = pSprite->pos.Z;
HitScan(actor, z, bcos(nAngle), bsin(nAngle), 0, CLIPMASK0, nRange); HitScan(actor, z, bcos(nAngle), bsin(nAngle), 0, CLIPMASK0, nRange);
int nDist = approxDist(x - gHitInfo.hitpos.X, y - gHitInfo.hitpos.Y); int nDist = approxDist(x - gHitInfo.hitpos.X, y - gHitInfo.hitpos.Y);
if (nDist - (pSprite->clipdist << 2) < nRange) if (nDist - (pSprite->clipdist << 2) < nRange)
@ -954,7 +954,7 @@ void aiSetTarget(DBloodActor* actor, DBloodActor* target)
DUDEINFO* pDudeInfo = getDudeInfo(pTarget->type); DUDEINFO* pDudeInfo = getDudeInfo(pTarget->type);
pXSprite->targetX = pTarget->pos.X; pXSprite->targetX = pTarget->pos.X;
pXSprite->targetY = pTarget->pos.Y; pXSprite->targetY = pTarget->pos.Y;
pXSprite->targetZ = pTarget->z - ((pDudeInfo->eyeHeight * pTarget->yrepeat) << 2); pXSprite->targetZ = pTarget->pos.Z - ((pDudeInfo->eyeHeight * pTarget->yrepeat) << 2);
} }
} }
} }
@ -1535,14 +1535,14 @@ void aiThinkTarget(DBloodActor* actor)
continue; continue;
int x = pPlayer->pSprite->pos.X; int x = pPlayer->pSprite->pos.X;
int y = pPlayer->pSprite->pos.Y; int y = pPlayer->pSprite->pos.Y;
int z = pPlayer->pSprite->z; int z = pPlayer->pSprite->pos.Z;
auto pSector = pPlayer->pSprite->sector(); auto pSector = pPlayer->pSprite->sector();
int dx = x - pSprite->pos.X; int dx = x - pSprite->pos.X;
int dy = y - pSprite->pos.Y; int dy = y - pSprite->pos.Y;
int nDist = approxDist(dx, dy); int nDist = approxDist(dx, dy);
if (nDist > pDudeInfo->seeDist && nDist > pDudeInfo->hearDist) if (nDist > pDudeInfo->seeDist && nDist > pDudeInfo->hearDist)
continue; continue;
if (!cansee(x, y, z, pSector, pSprite->pos.X, pSprite->pos.Y, pSprite->z - ((pDudeInfo->eyeHeight * pSprite->yrepeat) << 2), pSprite->sector())) if (!cansee(x, y, z, pSector, pSprite->pos.X, pSprite->pos.Y, pSprite->pos.Z - ((pDudeInfo->eyeHeight * pSprite->yrepeat) << 2), pSprite->sector()))
continue; continue;
int nDeltaAngle = ((getangle(dx, dy) + 1024 - pSprite->ang) & 2047) - 1024; int nDeltaAngle = ((getangle(dx, dy) + 1024 - pSprite->ang) & 2047) - 1024;
@ -1583,14 +1583,14 @@ void aiLookForTarget(DBloodActor* actor)
continue; continue;
int x = pPlayer->pSprite->pos.X; int x = pPlayer->pSprite->pos.X;
int y = pPlayer->pSprite->pos.Y; int y = pPlayer->pSprite->pos.Y;
int z = pPlayer->pSprite->z; int z = pPlayer->pSprite->pos.Z;
auto pSector = pPlayer->pSprite->sector(); auto pSector = pPlayer->pSprite->sector();
int dx = x - pSprite->pos.X; int dx = x - pSprite->pos.X;
int dy = y - pSprite->pos.Y; int dy = y - pSprite->pos.Y;
int nDist = approxDist(dx, dy); int nDist = approxDist(dx, dy);
if (nDist > pDudeInfo->seeDist && nDist > pDudeInfo->hearDist) if (nDist > pDudeInfo->seeDist && nDist > pDudeInfo->hearDist)
continue; continue;
if (!cansee(x, y, z, pSector, pSprite->pos.X, pSprite->pos.Y, pSprite->z - ((pDudeInfo->eyeHeight * pSprite->yrepeat) << 2), pSprite->sector())) if (!cansee(x, y, z, pSector, pSprite->pos.X, pSprite->pos.Y, pSprite->pos.Z - ((pDudeInfo->eyeHeight * pSprite->yrepeat) << 2), pSprite->sector()))
continue; continue;
int nDeltaAngle = ((getangle(dx, dy) + 1024 - pSprite->ang) & 2047) - 1024; int nDeltaAngle = ((getangle(dx, dy) + 1024 - pSprite->ang) & 2047) - 1024;
if (nDist < pDudeInfo->seeDist && abs(nDeltaAngle) <= pDudeInfo->periphery) if (nDist < pDudeInfo->seeDist && abs(nDeltaAngle) <= pDudeInfo->periphery)

View file

@ -100,14 +100,14 @@ static void batThinkTarget(DBloodActor* actor)
continue; continue;
int x = pPlayer->actor->spr.pos.X; int x = pPlayer->actor->spr.pos.X;
int y = pPlayer->actor->spr.pos.Y; int y = pPlayer->actor->spr.pos.Y;
int z = pPlayer->actor->spr.z; int z = pPlayer->actor->spr.pos.Z;
auto pSector = pPlayer->actor->spr.sector(); auto pSector = pPlayer->actor->spr.sector();
int dx = x - actor->spr.pos.X; int dx = x - actor->spr.pos.X;
int dy = y - actor->spr.pos.Y; int dy = y - actor->spr.pos.Y;
int nDist = approxDist(dx, dy); int nDist = approxDist(dx, dy);
if (nDist > pDudeInfo->seeDist && nDist > pDudeInfo->hearDist) if (nDist > pDudeInfo->seeDist && nDist > pDudeInfo->hearDist)
continue; continue;
if (!cansee(x, y, z, pSector, actor->spr.pos.X, actor->spr.pos.Y, actor->spr.z - ((pDudeInfo->eyeHeight * actor->spr.yrepeat) << 2), actor->spr.sector())) if (!cansee(x, y, z, pSector, actor->spr.pos.X, actor->spr.pos.Y, actor->spr.pos.Z - ((pDudeInfo->eyeHeight * actor->spr.yrepeat) << 2), actor->spr.sector()))
continue; continue;
int nDeltaAngle = ((getangle(dx, dy) + 1024 - actor->spr.ang) & 2047) - 1024; int nDeltaAngle = ((getangle(dx, dy) + 1024 - actor->spr.ang) & 2047) - 1024;
if (nDist < pDudeInfo->seeDist && abs(nDeltaAngle) <= pDudeInfo->periphery) if (nDist < pDudeInfo->seeDist && abs(nDeltaAngle) <= pDudeInfo->periphery)
@ -174,7 +174,7 @@ static void batThinkPonder(DBloodActor* actor)
int height2 = (getDudeInfo(pTarget->spr.type)->eyeHeight * pTarget->spr.yrepeat) << 2; int height2 = (getDudeInfo(pTarget->spr.type)->eyeHeight * pTarget->spr.yrepeat) << 2;
int top, bottom; int top, bottom;
GetActorExtents(actor, &top, &bottom); GetActorExtents(actor, &top, &bottom);
if (cansee(pTarget->spr.pos.X, pTarget->spr.pos.Y, pTarget->spr.z, pTarget->spr.sector(), actor->spr.pos.X, actor->spr.pos.Y, actor->spr.z - height, actor->spr.sector())) if (cansee(pTarget->spr.pos.X, pTarget->spr.pos.Y, pTarget->spr.pos.Z, pTarget->spr.sector(), actor->spr.pos.X, actor->spr.pos.Y, actor->spr.pos.Z - height, actor->spr.sector()))
{ {
aiSetTarget(actor, actor->GetTarget()); aiSetTarget(actor, actor->GetTarget());
if (height2 - height < 0x3000 && nDist < 0x1800 && nDist > 0xc00 && abs(nDeltaAngle) < 85) if (height2 - height < 0x3000 && nDist < 0x1800 && nDist > 0xc00 && abs(nDeltaAngle) < 85)
@ -281,7 +281,7 @@ static void batThinkChase(DBloodActor* actor)
int height2 = (pDudeInfo->eyeHeight * pTarget->spr.yrepeat) << 2; int height2 = (pDudeInfo->eyeHeight * pTarget->spr.yrepeat) << 2;
int top, bottom; int top, bottom;
GetActorExtents(actor, &top, &bottom); GetActorExtents(actor, &top, &bottom);
if (cansee(pTarget->spr.pos.X, pTarget->spr.pos.Y, pTarget->spr.z, pTarget->spr.sector(), actor->spr.pos.X, actor->spr.pos.Y, actor->spr.z - height, actor->spr.sector())) if (cansee(pTarget->spr.pos.X, pTarget->spr.pos.Y, pTarget->spr.pos.Z, pTarget->spr.sector(), actor->spr.pos.X, actor->spr.pos.Y, actor->spr.pos.Z - height, actor->spr.sector()))
{ {
if (nDist < pDudeInfo->seeDist && abs(nDeltaAngle) <= pDudeInfo->periphery) if (nDist < pDudeInfo->seeDist && abs(nDeltaAngle) <= pDudeInfo->periphery)
{ {
@ -402,7 +402,7 @@ void batMoveToCeil(DBloodActor* actor)
{ {
int x = actor->spr.pos.X; int x = actor->spr.pos.X;
int y = actor->spr.pos.Y; int y = actor->spr.pos.Y;
int z = actor->spr.z; int z = actor->spr.pos.Z;
if (z - actor->xspr.targetZ < 0x1000) if (z - actor->xspr.targetZ < 0x1000)
{ {
DUDEEXTRA_STATS* pDudeExtraE = &actor->dudeExtra.stats; DUDEEXTRA_STATS* pDudeExtraE = &actor->dudeExtra.stats;

View file

@ -70,7 +70,7 @@ void SlashSeqCallback(int, DBloodActor* actor)
int dx = bcos(pSprite->ang); int dx = bcos(pSprite->ang);
int dy = bsin(pSprite->ang); int dy = bsin(pSprite->ang);
// Correct ? // Correct ?
int dz = pSprite->z - pTarget->z; int dz = pSprite->pos.Z - pTarget->pos.Z;
dx += Random3(4000 - 700 * gGameOptions.nDifficulty); dx += Random3(4000 - 700 * gGameOptions.nDifficulty);
dy += Random3(4000 - 700 * gGameOptions.nDifficulty); dy += Random3(4000 - 700 * gGameOptions.nDifficulty);
actFireVector(actor, 0, 0, dx, dy, dz, kVectorGargSlash); actFireVector(actor, 0, 0, dx, dy, dz, kVectorGargSlash);
@ -86,14 +86,14 @@ void StompSeqCallback(int, DBloodActor* actor1)
int dy = bsin(pSprite->ang); int dy = bsin(pSprite->ang);
int x = pSprite->pos.X; int x = pSprite->pos.X;
int y = pSprite->pos.Y; int y = pSprite->pos.Y;
int z = pSprite->z; int z = pSprite->pos.Z;
int vc = 400; int vc = 400;
auto pSector = pSprite->sector(); auto pSector = pSprite->sector();
int v1c = 5 + 2 * gGameOptions.nDifficulty; int v1c = 5 + 2 * gGameOptions.nDifficulty;
int v10 = 25 + 30 * gGameOptions.nDifficulty; int v10 = 25 + 30 * gGameOptions.nDifficulty;
const bool newSectCheckMethod = !cl_bloodvanillaenemies && !VanillaMode(); // use new sector checking logic const bool newSectCheckMethod = !cl_bloodvanillaenemies && !VanillaMode(); // use new sector checking logic
auto sectorMap = GetClosestSpriteSectors(pSector, x, y, vc, nullptr, newSectCheckMethod); auto sectorMap = GetClosestSpriteSectors(pSector, x, y, vc, nullptr, newSectCheckMethod);
int hit = HitScan(actor1, pSprite->z, dx, dy, 0, CLIPMASK1, 0); int hit = HitScan(actor1, pSprite->pos.Z, dx, dy, 0, CLIPMASK1, 0);
DBloodActor* actor2 = nullptr; DBloodActor* actor2 = nullptr;
actHitcodeToData(hit, &gHitInfo, &actor2); actHitcodeToData(hit, &gHitInfo, &actor2);
@ -250,16 +250,16 @@ static void beastThinkChase(DBloodActor* actor)
{ {
int nDeltaAngle = ((getangle(dx, dy) + 1024 - pSprite->ang) & 2047) - 1024; int nDeltaAngle = ((getangle(dx, dy) + 1024 - pSprite->ang) & 2047) - 1024;
int height = (pDudeInfo->eyeHeight * pSprite->yrepeat) << 2; int height = (pDudeInfo->eyeHeight * pSprite->yrepeat) << 2;
if (cansee(pTarget->pos.X, pTarget->pos.Y, pTarget->z, pTarget->sector(), pSprite->pos.X, pSprite->pos.Y, pSprite->z - height, pSprite->sector())) if (cansee(pTarget->pos.X, pTarget->pos.Y, pTarget->pos.Z, pTarget->sector(), pSprite->pos.X, pSprite->pos.Y, pSprite->pos.Z - height, pSprite->sector()))
{ {
if (nDist < pDudeInfo->seeDist && abs(nDeltaAngle) <= pDudeInfo->periphery) if (nDist < pDudeInfo->seeDist && abs(nDeltaAngle) <= pDudeInfo->periphery)
{ {
aiSetTarget(actor, actor->GetTarget()); aiSetTarget(actor, actor->GetTarget());
actor->dudeSlope = nDist == 0? 0 : DivScale(pTarget->z - pSprite->z, nDist, 10); actor->dudeSlope = nDist == 0? 0 : DivScale(pTarget->pos.Z - pSprite->pos.Z, nDist, 10);
if (nDist < 0x1400 && nDist > 0xa00 && abs(nDeltaAngle) < 85 && (pTarget->flags & 2) if (nDist < 0x1400 && nDist > 0xa00 && abs(nDeltaAngle) < 85 && (pTarget->flags & 2)
&& IsPlayerSprite(pTarget) && Chance(0x8000)) && IsPlayerSprite(pTarget) && Chance(0x8000))
{ {
int hit = HitScan(actor, pSprite->z, dx, dy, 0, CLIPMASK1, 0); int hit = HitScan(actor, pSprite->pos.Z, dx, dy, 0, CLIPMASK1, 0);
if (pXTarget->health > (unsigned)gPlayerTemplate[0].startHealth / 2) if (pXTarget->health > (unsigned)gPlayerTemplate[0].startHealth / 2)
{ {
switch (hit) switch (hit)
@ -291,7 +291,7 @@ static void beastThinkChase(DBloodActor* actor)
} }
if (nDist < 921 && abs(nDeltaAngle) < 28) if (nDist < 921 && abs(nDeltaAngle) < 28)
{ {
int hit = HitScan(actor, pSprite->z, dx, dy, 0, CLIPMASK1, 0); int hit = HitScan(actor, pSprite->pos.Z, dx, dy, 0, CLIPMASK1, 0);
switch (hit) switch (hit)
{ {
case -1: case -1:
@ -382,10 +382,10 @@ static void beastThinkSwimChase(DBloodActor* actor)
if (nDist <= pDudeInfo->seeDist) if (nDist <= pDudeInfo->seeDist)
{ {
int nDeltaAngle = ((getangle(dx, dy) + 1024 - pSprite->ang) & 2047) - 1024; int nDeltaAngle = ((getangle(dx, dy) + 1024 - pSprite->ang) & 2047) - 1024;
int height = pDudeInfo->eyeHeight + pSprite->z; int height = pDudeInfo->eyeHeight + pSprite->pos.Z;
int top, bottom; int top, bottom;
GetActorExtents(actor, &top, &bottom); GetActorExtents(actor, &top, &bottom);
if (cansee(pTarget->pos.X, pTarget->pos.Y, pTarget->z, pTarget->sector(), pSprite->pos.X, pSprite->pos.Y, pSprite->z - height, pSprite->sector())) if (cansee(pTarget->pos.X, pTarget->pos.Y, pTarget->pos.Z, pTarget->sector(), pSprite->pos.X, pSprite->pos.Y, pSprite->pos.Z - height, pSprite->sector()))
{ {
if (nDist < pDudeInfo->seeDist && abs(nDeltaAngle) <= pDudeInfo->periphery) if (nDist < pDudeInfo->seeDist && abs(nDeltaAngle) <= pDudeInfo->periphery)
{ {
@ -468,8 +468,8 @@ static void sub_62AE0(DBloodActor* actor)
DUDEINFO* pDudeInfo = getDudeInfo(pSprite->type); DUDEINFO* pDudeInfo = getDudeInfo(pSprite->type);
if (!actor->ValidateTarget(__FUNCTION__)) return; if (!actor->ValidateTarget(__FUNCTION__)) return;
spritetype* pTarget = &actor->GetTarget()->s(); spritetype* pTarget = &actor->GetTarget()->s();
int z = pSprite->z + getDudeInfo(pSprite->type)->eyeHeight; int z = pSprite->pos.Z + getDudeInfo(pSprite->type)->eyeHeight;
int z2 = pTarget->z + getDudeInfo(pTarget->type)->eyeHeight; int z2 = pTarget->pos.Z + getDudeInfo(pTarget->type)->eyeHeight;
int nAng = ((pXSprite->goalAng + 1024 - pSprite->ang) & 2047) - 1024; int nAng = ((pXSprite->goalAng + 1024 - pSprite->ang) & 2047) - 1024;
int nTurnRange = (pDudeInfo->angSpeed << 2) >> 4; int nTurnRange = (pDudeInfo->angSpeed << 2) >> 4;
pSprite->ang = (pSprite->ang + ClipRange(nAng, -nTurnRange, nTurnRange)) & 2047; pSprite->ang = (pSprite->ang + ClipRange(nAng, -nTurnRange, nTurnRange)) & 2047;
@ -505,8 +505,8 @@ static void sub_62D7C(DBloodActor* actor)
DUDEINFO* pDudeInfo = getDudeInfo(pSprite->type); DUDEINFO* pDudeInfo = getDudeInfo(pSprite->type);
if (!actor->ValidateTarget(__FUNCTION__)) return; if (!actor->ValidateTarget(__FUNCTION__)) return;
spritetype* pTarget = &actor->GetTarget()->s(); spritetype* pTarget = &actor->GetTarget()->s();
int z = pSprite->z + getDudeInfo(pSprite->type)->eyeHeight; int z = pSprite->pos.Z + getDudeInfo(pSprite->type)->eyeHeight;
int z2 = pTarget->z + getDudeInfo(pTarget->type)->eyeHeight; int z2 = pTarget->pos.Z + getDudeInfo(pTarget->type)->eyeHeight;
int nAng = ((pXSprite->goalAng + 1024 - pSprite->ang) & 2047) - 1024; int nAng = ((pXSprite->goalAng + 1024 - pSprite->ang) & 2047) - 1024;
int nTurnRange = (pDudeInfo->angSpeed << 2) >> 4; int nTurnRange = (pDudeInfo->angSpeed << 2) >> 4;
pSprite->ang = (pSprite->ang + ClipRange(nAng, -nTurnRange, nTurnRange)) & 2047; pSprite->ang = (pSprite->ang + ClipRange(nAng, -nTurnRange, nTurnRange)) & 2047;

View file

@ -116,14 +116,14 @@ static void eelThinkTarget(DBloodActor* actor)
continue; continue;
int x = pPlayer->pSprite->pos.X; int x = pPlayer->pSprite->pos.X;
int y = pPlayer->pSprite->pos.Y; int y = pPlayer->pSprite->pos.Y;
int z = pPlayer->pSprite->z; int z = pPlayer->pSprite->pos.Z;
auto pSector = pPlayer->pSprite->sector(); auto pSector = pPlayer->pSprite->sector();
int dx = x - pSprite->pos.X; int dx = x - pSprite->pos.X;
int dy = y - pSprite->pos.Y; int dy = y - pSprite->pos.Y;
int nDist = approxDist(dx, dy); int nDist = approxDist(dx, dy);
if (nDist > pDudeInfo->seeDist && nDist > pDudeInfo->hearDist) if (nDist > pDudeInfo->seeDist && nDist > pDudeInfo->hearDist)
continue; continue;
if (!cansee(x, y, z, pSector, pSprite->pos.X, pSprite->pos.Y, pSprite->z - ((pDudeInfo->eyeHeight * pSprite->yrepeat) << 2), pSprite->sector())) if (!cansee(x, y, z, pSector, pSprite->pos.X, pSprite->pos.Y, pSprite->pos.Z - ((pDudeInfo->eyeHeight * pSprite->yrepeat) << 2), pSprite->sector()))
continue; continue;
int nDeltaAngle = ((getangle(dx, dy) + 1024 - pSprite->ang) & 2047) - 1024; int nDeltaAngle = ((getangle(dx, dy) + 1024 - pSprite->ang) & 2047) - 1024;
if (nDist < pDudeInfo->seeDist && abs(nDeltaAngle) <= pDudeInfo->periphery) if (nDist < pDudeInfo->seeDist && abs(nDeltaAngle) <= pDudeInfo->periphery)
@ -196,7 +196,7 @@ static void eelThinkPonder(DBloodActor* actor)
int height2 = (getDudeInfo(pTarget->type)->eyeHeight * pTarget->yrepeat) << 2; int height2 = (getDudeInfo(pTarget->type)->eyeHeight * pTarget->yrepeat) << 2;
int top, bottom; int top, bottom;
GetActorExtents(actor, &top, &bottom); GetActorExtents(actor, &top, &bottom);
if (cansee(pTarget->pos.X, pTarget->pos.Y, pTarget->z, pTarget->sector(), pSprite->pos.X, pSprite->pos.Y, pSprite->z - height, pSprite->sector())) if (cansee(pTarget->pos.X, pTarget->pos.Y, pTarget->pos.Z, pTarget->sector(), pSprite->pos.X, pSprite->pos.Y, pSprite->pos.Z - height, pSprite->sector()))
{ {
aiSetTarget(actor, actor->GetTarget()); aiSetTarget(actor, actor->GetTarget());
if (height2 - height < -0x2000 && nDist < 0x1800 && nDist > 0xc00 && abs(nDeltaAngle) < 85) if (height2 - height < -0x2000 && nDist < 0x1800 && nDist > 0xc00 && abs(nDeltaAngle) < 85)
@ -308,7 +308,7 @@ static void eelThinkChase(DBloodActor* actor)
GetActorExtents(actor, &top, &bottom); GetActorExtents(actor, &top, &bottom);
int top2, bottom2; int top2, bottom2;
GetSpriteExtents(pTarget, &top2, &bottom2); GetSpriteExtents(pTarget, &top2, &bottom2);
if (cansee(pTarget->pos.X, pTarget->pos.Y, pTarget->z, pTarget->sector(), pSprite->pos.X, pSprite->pos.Y, pSprite->z - height, pSprite->sector())) if (cansee(pTarget->pos.X, pTarget->pos.Y, pTarget->pos.Z, pTarget->sector(), pSprite->pos.X, pSprite->pos.Y, pSprite->pos.Z - height, pSprite->sector()))
{ {
if (nDist < pDudeInfo->seeDist && abs(nDeltaAngle) <= pDudeInfo->periphery) if (nDist < pDudeInfo->seeDist && abs(nDeltaAngle) <= pDudeInfo->periphery)
{ {
@ -427,7 +427,7 @@ void eelMoveToCeil(DBloodActor* actor)
auto pSprite = &actor->s(); auto pSprite = &actor->s();
int x = pSprite->pos.X; int x = pSprite->pos.X;
int y = pSprite->pos.Y; int y = pSprite->pos.Y;
int z = pSprite->z; int z = pSprite->pos.Z;
if (z - pXSprite->targetZ < 0x1000) if (z - pXSprite->targetZ < 0x1000)
{ {
DUDEEXTRA_STATS* pDudeExtraE = &actor->dudeExtra.stats; DUDEEXTRA_STATS* pDudeExtraE = &actor->dudeExtra.stats;

View file

@ -199,7 +199,7 @@ static void burnThinkChase(DBloodActor* actor)
{ {
int nDeltaAngle = ((getangle(dx, dy) + 1024 - pSprite->ang) & 2047) - 1024; int nDeltaAngle = ((getangle(dx, dy) + 1024 - pSprite->ang) & 2047) - 1024;
int height = (pDudeInfo->eyeHeight * pSprite->yrepeat) << 2; int height = (pDudeInfo->eyeHeight * pSprite->yrepeat) << 2;
if (cansee(pTarget->pos.X, pTarget->pos.Y, pTarget->z, pTarget->sector(), pSprite->pos.X, pSprite->pos.Y, pSprite->z - height, pSprite->sector())) if (cansee(pTarget->pos.X, pTarget->pos.Y, pTarget->pos.Z, pTarget->sector(), pSprite->pos.X, pSprite->pos.Y, pSprite->pos.Z - height, pSprite->sector()))
{ {
if (nDist < pDudeInfo->seeDist && abs(nDeltaAngle) <= pDudeInfo->periphery) if (nDist < pDudeInfo->seeDist && abs(nDeltaAngle) <= pDudeInfo->periphery)
{ {

View file

@ -158,15 +158,15 @@ static void calebThinkChase(DBloodActor* actor)
{ {
int nDeltaAngle = ((getangle(dx, dy) + 1024 - pSprite->ang) & 2047) - 1024; int nDeltaAngle = ((getangle(dx, dy) + 1024 - pSprite->ang) & 2047) - 1024;
int height = (pDudeInfo->eyeHeight * pSprite->yrepeat) << 2; int height = (pDudeInfo->eyeHeight * pSprite->yrepeat) << 2;
if (cansee(pTarget->pos.X, pTarget->pos.Y, pTarget->z, pTarget->sector(), pSprite->pos.X, pSprite->pos.Y, pSprite->z - height, pSprite->sector())) if (cansee(pTarget->pos.X, pTarget->pos.Y, pTarget->pos.Z, pTarget->sector(), pSprite->pos.X, pSprite->pos.Y, pSprite->pos.Z - height, pSprite->sector()))
{ {
if (nDist < pDudeInfo->seeDist && abs(nDeltaAngle) <= pDudeInfo->periphery) if (nDist < pDudeInfo->seeDist && abs(nDeltaAngle) <= pDudeInfo->periphery)
{ {
aiSetTarget(actor, actor->GetTarget()); aiSetTarget(actor, actor->GetTarget());
actor->dudeSlope = nDist == 0 ? 0 : DivScale(pTarget->z-pSprite->z, nDist, 10); actor->dudeSlope = nDist == 0 ? 0 : DivScale(pTarget->pos.Z-pSprite->pos.Z, nDist, 10);
if (nDist < 0x599 && abs(nDeltaAngle) < 28) if (nDist < 0x599 && abs(nDeltaAngle) < 28)
{ {
int hit = HitScan(actor, pSprite->z, dx, dy, 0, CLIPMASK1, 0); int hit = HitScan(actor, pSprite->pos.Z, dx, dy, 0, CLIPMASK1, 0);
switch (hit) switch (hit)
{ {
case -1: case -1:
@ -258,10 +258,10 @@ static void calebThinkSwimChase(DBloodActor* actor)
if (nDist <= pDudeInfo->seeDist) if (nDist <= pDudeInfo->seeDist)
{ {
int nDeltaAngle = ((getangle(dx, dy) + 1024 - pSprite->ang) & 2047) - 1024; int nDeltaAngle = ((getangle(dx, dy) + 1024 - pSprite->ang) & 2047) - 1024;
int height = pDudeInfo->eyeHeight + pSprite->z; int height = pDudeInfo->eyeHeight + pSprite->pos.Z;
int top, bottom; int top, bottom;
GetActorExtents(actor, &top, &bottom); GetActorExtents(actor, &top, &bottom);
if (cansee(pTarget->pos.X, pTarget->pos.Y, pTarget->z, pTarget->sector(), pSprite->pos.X, pSprite->pos.Y, pSprite->z - height, pSprite->sector())) if (cansee(pTarget->pos.X, pTarget->pos.Y, pTarget->pos.Z, pTarget->sector(), pSprite->pos.X, pSprite->pos.Y, pSprite->pos.Z - height, pSprite->sector()))
{ {
if (nDist < pDudeInfo->seeDist && abs(nDeltaAngle) <= pDudeInfo->periphery) if (nDist < pDudeInfo->seeDist && abs(nDeltaAngle) <= pDudeInfo->periphery)
{ {
@ -320,8 +320,8 @@ static void sub_65F44(DBloodActor* actor)
if (!actor->ValidateTarget(__FUNCTION__)) return; if (!actor->ValidateTarget(__FUNCTION__)) return;
spritetype* pTarget = &actor->GetTarget()->s(); spritetype* pTarget = &actor->GetTarget()->s();
int z = pSprite->z + getDudeInfo(pSprite->type)->eyeHeight; int z = pSprite->pos.Z + getDudeInfo(pSprite->type)->eyeHeight;
int z2 = pTarget->z + getDudeInfo(pTarget->type)->eyeHeight; int z2 = pTarget->pos.Z + getDudeInfo(pTarget->type)->eyeHeight;
int nAng = ((pXSprite->goalAng + 1024 - pSprite->ang) & 2047) - 1024; int nAng = ((pXSprite->goalAng + 1024 - pSprite->ang) & 2047) - 1024;
int nTurnRange = (pDudeInfo->angSpeed << 2) >> 4; int nTurnRange = (pDudeInfo->angSpeed << 2) >> 4;
pSprite->ang = (pSprite->ang + ClipRange(nAng, -nTurnRange, nTurnRange)) & 2047; pSprite->ang = (pSprite->ang + ClipRange(nAng, -nTurnRange, nTurnRange)) & 2047;
@ -358,8 +358,8 @@ static void sub_661E0(DBloodActor* actor)
if (!actor->ValidateTarget(__FUNCTION__)) return; if (!actor->ValidateTarget(__FUNCTION__)) return;
spritetype* pTarget = &actor->GetTarget()->s(); spritetype* pTarget = &actor->GetTarget()->s();
int z = pSprite->z + getDudeInfo(pSprite->type)->eyeHeight; int z = pSprite->pos.Z + getDudeInfo(pSprite->type)->eyeHeight;
int z2 = pTarget->z + getDudeInfo(pTarget->type)->eyeHeight; int z2 = pTarget->pos.Z + getDudeInfo(pTarget->type)->eyeHeight;
int nAng = ((pXSprite->goalAng + 1024 - pSprite->ang) & 2047) - 1024; int nAng = ((pXSprite->goalAng + 1024 - pSprite->ang) & 2047) - 1024;
int nTurnRange = (pDudeInfo->angSpeed << 2) >> 4; int nTurnRange = (pDudeInfo->angSpeed << 2) >> 4;
pSprite->ang = (pSprite->ang + ClipRange(nAng, -nTurnRange, nTurnRange)) & 2047; pSprite->ang = (pSprite->ang + ClipRange(nAng, -nTurnRange, nTurnRange)) & 2047;

View file

@ -67,7 +67,7 @@ void cerberusBiteSeqCallback(int, DBloodActor* actor)
} }
if (!actor->ValidateTarget(__FUNCTION__)) return; if (!actor->ValidateTarget(__FUNCTION__)) return;
spritetype* pTarget = &actor->GetTarget()->s(); spritetype* pTarget = &actor->GetTarget()->s();
int dz = pTarget->z - pSprite->z; int dz = pTarget->pos.Z - pSprite->pos.Z;
actFireVector(actor, 350, -100, dx, dy, dz, kVectorCerberusHack); actFireVector(actor, 350, -100, dx, dy, dz, kVectorCerberusHack);
actFireVector(actor, -350, 0, dx, dy, dz, kVectorCerberusHack); actFireVector(actor, -350, 0, dx, dy, dz, kVectorCerberusHack);
actFireVector(actor, 0, 0, dx, dy, dz, kVectorCerberusHack); actFireVector(actor, 0, 0, dx, dy, dz, kVectorCerberusHack);
@ -97,7 +97,7 @@ void cerberusBurnSeqCallback(int, DBloodActor* actor)
continue; continue;
int x2 = pSprite2->pos.X; int x2 = pSprite2->pos.X;
int y2 = pSprite2->pos.Y; int y2 = pSprite2->pos.Y;
int z2 = pSprite2->z; int z2 = pSprite2->pos.Z;
int nDist = approxDist(x2 - x, y2 - y); int nDist = approxDist(x2 - x, y2 - y);
if (nDist == 0 || nDist > 0x2800) if (nDist == 0 || nDist > 0x2800)
continue; continue;
@ -126,7 +126,7 @@ void cerberusBurnSeqCallback(int, DBloodActor* actor)
int nDeltaAngle = ((nAngle - pSprite->ang + 1024) & 2047) - 1024; int nDeltaAngle = ((nAngle - pSprite->ang + 1024) & 2047) - 1024;
if (abs(nDeltaAngle) <= tt1.at8) if (abs(nDeltaAngle) <= tt1.at8)
{ {
int tz = pSprite2->z - pSprite->z; int tz = pSprite2->pos.Z - pSprite->pos.Z;
if (cansee(x, y, z, pSprite->sector(), x2, y2, z2, pSprite2->sector())) if (cansee(x, y, z, pSprite->sector(), x2, y2, z2, pSprite2->sector()))
{ {
nClosest = nDist2; nClosest = nDist2;
@ -176,7 +176,7 @@ void cerberusBurnSeqCallback2(int, DBloodActor* actor)
continue; continue;
int x2 = pSprite2->pos.X; int x2 = pSprite2->pos.X;
int y2 = pSprite2->pos.Y; int y2 = pSprite2->pos.Y;
int z2 = pSprite2->z; int z2 = pSprite2->pos.Z;
int nDist = approxDist(x2 - x, y2 - y); int nDist = approxDist(x2 - x, y2 - y);
if (nDist == 0 || nDist > 0x2800) if (nDist == 0 || nDist > 0x2800)
continue; continue;
@ -271,14 +271,14 @@ static void cerberusThinkTarget(DBloodActor* actor)
continue; continue;
int x = pPlayer->pSprite->pos.X; int x = pPlayer->pSprite->pos.X;
int y = pPlayer->pSprite->pos.Y; int y = pPlayer->pSprite->pos.Y;
int z = pPlayer->pSprite->z; int z = pPlayer->pSprite->pos.Z;
auto pSector = pPlayer->pSprite->sector(); auto pSector = pPlayer->pSprite->sector();
int dx = x - pSprite->pos.X; int dx = x - pSprite->pos.X;
int dy = y - pSprite->pos.Y; int dy = y - pSprite->pos.Y;
int nDist = approxDist(dx, dy); int nDist = approxDist(dx, dy);
if (nDist > pDudeInfo->seeDist && nDist > pDudeInfo->hearDist) if (nDist > pDudeInfo->seeDist && nDist > pDudeInfo->hearDist)
continue; continue;
if (!cansee(x, y, z, pSector, pSprite->pos.X, pSprite->pos.Y, pSprite->z - ((pDudeInfo->eyeHeight * pSprite->yrepeat) << 2), pSprite->sector())) if (!cansee(x, y, z, pSector, pSprite->pos.X, pSprite->pos.Y, pSprite->pos.Z - ((pDudeInfo->eyeHeight * pSprite->yrepeat) << 2), pSprite->sector()))
continue; continue;
int nDeltaAngle = ((getangle(dx, dy) + 1024 - pSprite->ang) & 2047) - 1024; int nDeltaAngle = ((getangle(dx, dy) + 1024 - pSprite->ang) & 2047) - 1024;
if (nDist < pDudeInfo->seeDist && abs(nDeltaAngle) <= pDudeInfo->periphery) if (nDist < pDudeInfo->seeDist && abs(nDeltaAngle) <= pDudeInfo->periphery)
@ -388,7 +388,7 @@ static void cerberusThinkChase(DBloodActor* actor)
{ {
int nDeltaAngle = ((getangle(dx, dy) + 1024 - pSprite->ang) & 2047) - 1024; int nDeltaAngle = ((getangle(dx, dy) + 1024 - pSprite->ang) & 2047) - 1024;
int height = (pDudeInfo->eyeHeight * pSprite->yrepeat) << 2; int height = (pDudeInfo->eyeHeight * pSprite->yrepeat) << 2;
if (cansee(pTarget->pos.X, pTarget->pos.Y, pTarget->z, pTarget->sector(), pSprite->pos.X, pSprite->pos.Y, pSprite->z - height, pSprite->sector())) if (cansee(pTarget->pos.X, pTarget->pos.Y, pTarget->pos.Z, pTarget->sector(), pSprite->pos.X, pSprite->pos.Y, pSprite->pos.Z - height, pSprite->sector()))
{ {
if (nDist < pDudeInfo->seeDist && abs(nDeltaAngle) <= pDudeInfo->periphery) { if (nDist < pDudeInfo->seeDist && abs(nDeltaAngle) <= pDudeInfo->periphery) {
aiSetTarget(actor, actor->GetTarget()); aiSetTarget(actor, actor->GetTarget());
@ -416,7 +416,7 @@ static void cerberusThinkChase(DBloodActor* actor)
} }
else if (nDist < 0x200 && abs(nDeltaAngle) < 85) else if (nDist < 0x200 && abs(nDeltaAngle) < 85)
{ {
int hit = HitScan(actor, pSprite->z, dx, dy, 0, CLIPMASK1, 0); int hit = HitScan(actor, pSprite->pos.Z, dx, dy, 0, CLIPMASK1, 0);
switch (pSprite->type) { switch (pSprite->type) {
case kDudeCerberusTwoHead: case kDudeCerberusTwoHead:
switch (hit) { switch (hit) {

View file

@ -136,7 +136,7 @@ void cultThrowSeqCallback(int, DBloodActor* actor)
assert(pSprite->type >= kDudeBase && pSprite->type < kDudeMax); assert(pSprite->type >= kDudeBase && pSprite->type < kDudeMax);
int dx = pTarget->pos.X - pSprite->pos.X; int dx = pTarget->pos.X - pSprite->pos.X;
int dy = pTarget->pos.Y - pSprite->pos.Y; int dy = pTarget->pos.Y - pSprite->pos.Y;
int dz = pTarget->z - pSprite->z; int dz = pTarget->pos.Z - pSprite->pos.Z;
int nDist = approxDist(dx, dy); int nDist = approxDist(dx, dy);
int nDist2 = nDist / 540; int nDist2 = nDist / 540;
if (nDist > 0x1e00) if (nDist > 0x1e00)
@ -170,7 +170,7 @@ void sub_68230(int, DBloodActor* actor)
assert(pSprite->type >= kDudeBase && pSprite->type < kDudeMax); assert(pSprite->type >= kDudeBase && pSprite->type < kDudeMax);
int dx = pTarget->pos.X - pSprite->pos.X; int dx = pTarget->pos.X - pSprite->pos.X;
int dy = pTarget->pos.Y - pSprite->pos.Y; int dy = pTarget->pos.Y - pSprite->pos.Y;
int dz = pTarget->z - pSprite->z; int dz = pTarget->pos.Z - pSprite->pos.Z;
int nDist = approxDist(dx, dy); int nDist = approxDist(dx, dy);
int nDist2 = nDist / 540; int nDist2 = nDist / 540;
auto pMissile = actFireThing(actor, 0, 0, dz / 128 - 14500, nMissile, (nDist2 << 17) / 120); auto pMissile = actFireThing(actor, 0, 0, dz / 128 - 14500, nMissile, (nDist2 << 17) / 120);
@ -284,19 +284,19 @@ static void cultThinkChase(DBloodActor* actor)
{ {
int nDeltaAngle = ((getangle(dx, dy) + 1024 - pSprite->ang) & 2047) - 1024; int nDeltaAngle = ((getangle(dx, dy) + 1024 - pSprite->ang) & 2047) - 1024;
int height = (pDudeInfo->eyeHeight * pSprite->yrepeat) << 2; int height = (pDudeInfo->eyeHeight * pSprite->yrepeat) << 2;
if (cansee(pTarget->pos.X, pTarget->pos.Y, pTarget->z, pTarget->sector(), pSprite->pos.X, pSprite->pos.Y, pSprite->z - height, pSprite->sector())) if (cansee(pTarget->pos.X, pTarget->pos.Y, pTarget->pos.Z, pTarget->sector(), pSprite->pos.X, pSprite->pos.Y, pSprite->pos.Z - height, pSprite->sector()))
{ {
if (nDist < pDudeInfo->seeDist && abs(nDeltaAngle) <= pDudeInfo->periphery) if (nDist < pDudeInfo->seeDist && abs(nDeltaAngle) <= pDudeInfo->periphery)
{ {
aiSetTarget(actor, actor->GetTarget()); aiSetTarget(actor, actor->GetTarget());
actor->dudeSlope = nDist == 0 ? 0 : DivScale(pTarget->z - pSprite->z, nDist, 10); actor->dudeSlope = nDist == 0 ? 0 : DivScale(pTarget->pos.Z - pSprite->pos.Z, nDist, 10);
switch (pSprite->type) { switch (pSprite->type) {
case kDudeCultistTommy: case kDudeCultistTommy:
if (nDist < 0x1e00 && nDist > 0xe00 && abs(nDeltaAngle) < 85 && !TargetNearExplosion(pTarget) if (nDist < 0x1e00 && nDist > 0xe00 && abs(nDeltaAngle) < 85 && !TargetNearExplosion(pTarget)
&& (pTarget->flags & 2) && gGameOptions.nDifficulty > 2 && IsPlayerSprite(pTarget) && gPlayer[pTarget->type - kDudePlayer1].isRunning && (pTarget->flags & 2) && gGameOptions.nDifficulty > 2 && IsPlayerSprite(pTarget) && gPlayer[pTarget->type - kDudePlayer1].isRunning
&& Chance(0x8000)) && Chance(0x8000))
{ {
int hit = HitScan(actor, pSprite->z, dx, dy, 0, CLIPMASK1, 0); int hit = HitScan(actor, pSprite->pos.Z, dx, dy, 0, CLIPMASK1, 0);
switch (hit) switch (hit)
{ {
case -1: case -1:
@ -317,7 +317,7 @@ static void cultThinkChase(DBloodActor* actor)
} }
else if (nDist < 0x4600 && abs(nDeltaAngle) < 28) else if (nDist < 0x4600 && abs(nDeltaAngle) < 28)
{ {
int hit = HitScan(actor, pSprite->z, dx, dy, 0, CLIPMASK1, 0); int hit = HitScan(actor, pSprite->pos.Z, dx, dy, 0, CLIPMASK1, 0);
switch (hit) switch (hit)
{ {
case -1: case -1:
@ -364,7 +364,7 @@ static void cultThinkChase(DBloodActor* actor)
&& (pTarget->flags & 2) && gGameOptions.nDifficulty >= 2 && IsPlayerSprite(pTarget) && !gPlayer[pTarget->type - kDudePlayer1].isRunning && (pTarget->flags & 2) && gGameOptions.nDifficulty >= 2 && IsPlayerSprite(pTarget) && !gPlayer[pTarget->type - kDudePlayer1].isRunning
&& Chance(0x8000)) && Chance(0x8000))
{ {
int hit = HitScan(actor, pSprite->z, dx, dy, 0, CLIPMASK1, 0); int hit = HitScan(actor, pSprite->pos.Z, dx, dy, 0, CLIPMASK1, 0);
switch (hit) switch (hit)
{ {
case -1: case -1:
@ -385,7 +385,7 @@ static void cultThinkChase(DBloodActor* actor)
} }
else if (nDist < 0x3200 && abs(nDeltaAngle) < 28) else if (nDist < 0x3200 && abs(nDeltaAngle) < 28)
{ {
int hit = HitScan(actor, pSprite->z, dx, dy, 0, CLIPMASK1, 0); int hit = HitScan(actor, pSprite->pos.Z, dx, dy, 0, CLIPMASK1, 0);
switch (hit) switch (hit)
{ {
case -1: case -1:
@ -432,7 +432,7 @@ static void cultThinkChase(DBloodActor* actor)
&& (pTarget->flags & 2) && gGameOptions.nDifficulty > 2 && IsPlayerSprite(pTarget) && gPlayer[pTarget->type - kDudePlayer1].isRunning && (pTarget->flags & 2) && gGameOptions.nDifficulty > 2 && IsPlayerSprite(pTarget) && gPlayer[pTarget->type - kDudePlayer1].isRunning
&& Chance(0x8000)) && Chance(0x8000))
{ {
int hit = HitScan(actor, pSprite->z, dx, dy, 0, CLIPMASK1, 0); int hit = HitScan(actor, pSprite->pos.Z, dx, dy, 0, CLIPMASK1, 0);
switch (hit) switch (hit)
{ {
case -1: case -1:
@ -453,7 +453,7 @@ static void cultThinkChase(DBloodActor* actor)
} }
else if (nDist < 0x3200 && abs(nDeltaAngle) < 28) else if (nDist < 0x3200 && abs(nDeltaAngle) < 28)
{ {
int hit = HitScan(actor, pSprite->z, dx, dy, 0, CLIPMASK1, 0); int hit = HitScan(actor, pSprite->pos.Z, dx, dy, 0, CLIPMASK1, 0);
switch (hit) switch (hit)
{ {
case -1: case -1:
@ -499,7 +499,7 @@ static void cultThinkChase(DBloodActor* actor)
if (nDist < 0x2c00 && nDist > 0x1400 && abs(nDeltaAngle) < 85 if (nDist < 0x2c00 && nDist > 0x1400 && abs(nDeltaAngle) < 85
&& (pTarget->flags & 2) && IsPlayerSprite(pTarget)) && (pTarget->flags & 2) && IsPlayerSprite(pTarget))
{ {
int hit = HitScan(actor, pSprite->z, dx, dy, 0, CLIPMASK1, 0); int hit = HitScan(actor, pSprite->pos.Z, dx, dy, 0, CLIPMASK1, 0);
switch (hit) switch (hit)
{ {
case -1: case -1:
@ -520,7 +520,7 @@ static void cultThinkChase(DBloodActor* actor)
else if (nDist < 0x1400 && abs(nDeltaAngle) < 85 else if (nDist < 0x1400 && abs(nDeltaAngle) < 85
&& (pTarget->flags & 2) && IsPlayerSprite(pTarget)) && (pTarget->flags & 2) && IsPlayerSprite(pTarget))
{ {
int hit = HitScan(actor, pSprite->z, dx, dy, 0, CLIPMASK1, 0); int hit = HitScan(actor, pSprite->pos.Z, dx, dy, 0, CLIPMASK1, 0);
switch (hit) switch (hit)
{ {
case -1: case -1:
@ -544,7 +544,7 @@ static void cultThinkChase(DBloodActor* actor)
&& (pTarget->flags & 2) && gGameOptions.nDifficulty > 2 && IsPlayerSprite(pTarget) && gPlayer[pTarget->type - kDudePlayer1].isRunning && (pTarget->flags & 2) && gGameOptions.nDifficulty > 2 && IsPlayerSprite(pTarget) && gPlayer[pTarget->type - kDudePlayer1].isRunning
&& Chance(0x8000)) && Chance(0x8000))
{ {
int hit = HitScan(actor, pSprite->z, dx, dy, 0, CLIPMASK1, 0); int hit = HitScan(actor, pSprite->pos.Z, dx, dy, 0, CLIPMASK1, 0);
switch (hit) switch (hit)
{ {
case -1: case -1:
@ -565,7 +565,7 @@ static void cultThinkChase(DBloodActor* actor)
} }
else if (nDist < 0x3200 && abs(nDeltaAngle) < 28) else if (nDist < 0x3200 && abs(nDeltaAngle) < 28)
{ {
int hit = HitScan(actor, pSprite->z, dx, dy, 0, CLIPMASK1, 0); int hit = HitScan(actor, pSprite->pos.Z, dx, dy, 0, CLIPMASK1, 0);
switch (hit) switch (hit)
{ {
case -1: case -1:

View file

@ -126,7 +126,7 @@ void BlastSSeqCallback(int, DBloodActor* actor)
continue; continue;
int x2 = pSprite2->pos.X; int x2 = pSprite2->pos.X;
int y2 = pSprite2->pos.Y; int y2 = pSprite2->pos.Y;
int z2 = pSprite2->z; int z2 = pSprite2->pos.Z;
int nDist = approxDist(x2 - x, y2 - y); int nDist = approxDist(x2 - x, y2 - y);
if (nDist == 0 || nDist > 0x2800) if (nDist == 0 || nDist > 0x2800)
continue; continue;
@ -155,7 +155,7 @@ void BlastSSeqCallback(int, DBloodActor* actor)
int nDeltaAngle = ((nAngle - pSprite->ang + 1024) & 2047) - 1024; int nDeltaAngle = ((nAngle - pSprite->ang + 1024) & 2047) - 1024;
if (abs(nDeltaAngle) <= tt.at8) if (abs(nDeltaAngle) <= tt.at8)
{ {
int tz = pSprite2->z - pSprite->z; int tz = pSprite2->pos.Z - pSprite->pos.Z;
if (cansee(x, y, z, pSprite->sector(), x2, y2, z2, pSprite2->sector())) if (cansee(x, y, z, pSprite->sector(), x2, y2, z2, pSprite2->sector()))
{ {
nClosest = nDist2; nClosest = nDist2;
@ -228,14 +228,14 @@ static void gargThinkTarget(DBloodActor* actor)
continue; continue;
int x = pPlayer->pSprite->pos.X; int x = pPlayer->pSprite->pos.X;
int y = pPlayer->pSprite->pos.Y; int y = pPlayer->pSprite->pos.Y;
int z = pPlayer->pSprite->z; int z = pPlayer->pSprite->pos.Z;
auto pSector = pPlayer->pSprite->sector(); auto pSector = pPlayer->pSprite->sector();
int dx = x - pSprite->pos.X; int dx = x - pSprite->pos.X;
int dy = y - pSprite->pos.Y; int dy = y - pSprite->pos.Y;
int nDist = approxDist(dx, dy); int nDist = approxDist(dx, dy);
if (nDist > pDudeInfo->seeDist && nDist > pDudeInfo->hearDist) if (nDist > pDudeInfo->seeDist && nDist > pDudeInfo->hearDist)
continue; continue;
if (!cansee(x, y, z, pSector, pSprite->pos.X, pSprite->pos.Y, pSprite->z - ((pDudeInfo->eyeHeight * pSprite->yrepeat) << 2), pSprite->sector())) if (!cansee(x, y, z, pSector, pSprite->pos.X, pSprite->pos.Y, pSprite->pos.Z - ((pDudeInfo->eyeHeight * pSprite->yrepeat) << 2), pSprite->sector()))
continue; continue;
int nDeltaAngle = ((getangle(dx, dy) + 1024 - pSprite->ang) & 2047) - 1024; int nDeltaAngle = ((getangle(dx, dy) + 1024 - pSprite->ang) & 2047) - 1024;
if (nDist < pDudeInfo->seeDist && abs(nDeltaAngle) <= pDudeInfo->periphery) if (nDist < pDudeInfo->seeDist && abs(nDeltaAngle) <= pDudeInfo->periphery)
@ -382,7 +382,7 @@ static void gargThinkChase(DBloodActor* actor)
int height2 = (pDudeInfo->eyeHeight * pTarget->yrepeat) << 2; int height2 = (pDudeInfo->eyeHeight * pTarget->yrepeat) << 2;
int top, bottom; int top, bottom;
GetActorExtents(actor, &top, &bottom); GetActorExtents(actor, &top, &bottom);
if (cansee(pTarget->pos.X, pTarget->pos.Y, pTarget->z, pTarget->sector(), pSprite->pos.X, pSprite->pos.Y, pSprite->z - height, pSprite->sector())) if (cansee(pTarget->pos.X, pTarget->pos.Y, pTarget->pos.Z, pTarget->sector(), pSprite->pos.X, pSprite->pos.Y, pSprite->pos.Z - height, pSprite->sector()))
{ {
if (nDist < pDudeInfo->seeDist && abs(nDeltaAngle) <= pDudeInfo->periphery) if (nDist < pDudeInfo->seeDist && abs(nDeltaAngle) <= pDudeInfo->periphery)
{ {
@ -393,7 +393,7 @@ static void gargThinkChase(DBloodActor* actor)
case kDudeGargoyleFlesh: case kDudeGargoyleFlesh:
if (nDist < 0x1800 && nDist > 0xc00 && abs(nDeltaAngle) < 85) if (nDist < 0x1800 && nDist > 0xc00 && abs(nDeltaAngle) < 85)
{ {
int hit = HitScan(actor, pSprite->z, dx, dy, 0, CLIPMASK1, 0); int hit = HitScan(actor, pSprite->pos.Z, dx, dy, 0, CLIPMASK1, 0);
switch (hit) switch (hit)
{ {
case -1: case -1:
@ -418,7 +418,7 @@ static void gargThinkChase(DBloodActor* actor)
} }
else if (nDist < 0x400 && abs(nDeltaAngle) < 85) else if (nDist < 0x400 && abs(nDeltaAngle) < 85)
{ {
int hit = HitScan(actor, pSprite->z, dx, dy, 0, CLIPMASK1, 0); int hit = HitScan(actor, pSprite->pos.Z, dx, dy, 0, CLIPMASK1, 0);
switch (hit) switch (hit)
{ {
case -1: case -1:
@ -452,7 +452,7 @@ static void gargThinkChase(DBloodActor* actor)
case kDudeGargoyleStone: case kDudeGargoyleStone:
if (nDist < 0x1800 && nDist > 0xc00 && abs(nDeltaAngle) < 85) if (nDist < 0x1800 && nDist > 0xc00 && abs(nDeltaAngle) < 85)
{ {
int hit = HitScan(actor, pSprite->z, dx, dy, 0, CLIPMASK1, 0); int hit = HitScan(actor, pSprite->pos.Z, dx, dy, 0, CLIPMASK1, 0);
switch (hit) switch (hit)
{ {
case -1: case -1:
@ -477,7 +477,7 @@ static void gargThinkChase(DBloodActor* actor)
} }
else if (nDist < 0x400 && abs(nDeltaAngle) < 85) else if (nDist < 0x400 && abs(nDeltaAngle) < 85)
{ {
int hit = HitScan(actor, pSprite->z, dx, dy, 0, CLIPMASK1, 0); int hit = HitScan(actor, pSprite->pos.Z, dx, dy, 0, CLIPMASK1, 0);
switch (hit) switch (hit)
{ {
case -1: case -1:

View file

@ -112,7 +112,7 @@ void ghostBlastSeqCallback(int, DBloodActor* actor)
continue; continue;
int x2 = pSprite2->pos.X; int x2 = pSprite2->pos.X;
int y2 = pSprite2->pos.Y; int y2 = pSprite2->pos.Y;
int z2 = pSprite2->z; int z2 = pSprite2->pos.Z;
int nDist = approxDist(x2 - x, y2 - y); int nDist = approxDist(x2 - x, y2 - y);
if (nDist == 0 || nDist > 0x2800) if (nDist == 0 || nDist > 0x2800)
continue; continue;
@ -141,7 +141,7 @@ void ghostBlastSeqCallback(int, DBloodActor* actor)
int nDeltaAngle = ((nAngle - pSprite->ang + 1024) & 2047) - 1024; int nDeltaAngle = ((nAngle - pSprite->ang + 1024) & 2047) - 1024;
if (abs(nDeltaAngle) <= tt.at8) if (abs(nDeltaAngle) <= tt.at8)
{ {
int tz = pSprite2->z - pSprite->z; int tz = pSprite2->pos.Z - pSprite->pos.Z;
if (cansee(x, y, z, pSprite->sector(), x2, y2, z2, pSprite2->sector())) if (cansee(x, y, z, pSprite->sector(), x2, y2, z2, pSprite2->sector()))
{ {
nClosest = nDist2; nClosest = nDist2;
@ -208,14 +208,14 @@ static void ghostThinkTarget(DBloodActor* actor)
continue; continue;
int x = pPlayer->pSprite->pos.X; int x = pPlayer->pSprite->pos.X;
int y = pPlayer->pSprite->pos.Y; int y = pPlayer->pSprite->pos.Y;
int z = pPlayer->pSprite->z; int z = pPlayer->pSprite->pos.Z;
auto pSector = pPlayer->pSprite->sector(); auto pSector = pPlayer->pSprite->sector();
int dx = x - pSprite->pos.X; int dx = x - pSprite->pos.X;
int dy = y - pSprite->pos.Y; int dy = y - pSprite->pos.Y;
int nDist = approxDist(dx, dy); int nDist = approxDist(dx, dy);
if (nDist > pDudeInfo->seeDist && nDist > pDudeInfo->hearDist) if (nDist > pDudeInfo->seeDist && nDist > pDudeInfo->hearDist)
continue; continue;
if (!cansee(x, y, z, pSector, pSprite->pos.X, pSprite->pos.Y, pSprite->z - ((pDudeInfo->eyeHeight * pSprite->yrepeat) << 2), pSprite->sector())) if (!cansee(x, y, z, pSector, pSprite->pos.X, pSprite->pos.Y, pSprite->pos.Z - ((pDudeInfo->eyeHeight * pSprite->yrepeat) << 2), pSprite->sector()))
continue; continue;
int nDeltaAngle = ((getangle(dx, dy) + 1024 - pSprite->ang) & 2047) - 1024; int nDeltaAngle = ((getangle(dx, dy) + 1024 - pSprite->ang) & 2047) - 1024;
if (nDist < pDudeInfo->seeDist && abs(nDeltaAngle) <= pDudeInfo->periphery) if (nDist < pDudeInfo->seeDist && abs(nDeltaAngle) <= pDudeInfo->periphery)
@ -362,7 +362,7 @@ static void ghostThinkChase(DBloodActor* actor)
int height2 = (pDudeInfo->eyeHeight * pTarget->yrepeat) << 2; int height2 = (pDudeInfo->eyeHeight * pTarget->yrepeat) << 2;
int top, bottom; int top, bottom;
GetActorExtents(actor, &top, &bottom); GetActorExtents(actor, &top, &bottom);
if (cansee(pTarget->pos.X, pTarget->pos.Y, pTarget->z, pTarget->sector(), pSprite->pos.X, pSprite->pos.Y, pSprite->z - height, pSprite->sector())) if (cansee(pTarget->pos.X, pTarget->pos.Y, pTarget->pos.Z, pTarget->sector(), pSprite->pos.X, pSprite->pos.Y, pSprite->pos.Z - height, pSprite->sector()))
{ {
if (nDist < pDudeInfo->seeDist && abs(nDeltaAngle) <= pDudeInfo->periphery) if (nDist < pDudeInfo->seeDist && abs(nDeltaAngle) <= pDudeInfo->periphery)
{ {
@ -371,7 +371,7 @@ static void ghostThinkChase(DBloodActor* actor)
switch (pSprite->type) { switch (pSprite->type) {
case kDudePhantasm: case kDudePhantasm:
if (nDist < 0x2000 && nDist > 0x1000 && abs(nDeltaAngle) < 85) { if (nDist < 0x2000 && nDist > 0x1000 && abs(nDeltaAngle) < 85) {
int hit = HitScan(actor, pSprite->z, dx, dy, 0, CLIPMASK1, 0); int hit = HitScan(actor, pSprite->pos.Z, dx, dy, 0, CLIPMASK1, 0);
switch (hit) switch (hit)
{ {
case -1: case -1:
@ -391,7 +391,7 @@ static void ghostThinkChase(DBloodActor* actor)
} }
else if (nDist < 0x400 && abs(nDeltaAngle) < 85) else if (nDist < 0x400 && abs(nDeltaAngle) < 85)
{ {
int hit = HitScan(actor, pSprite->z, dx, dy, 0, CLIPMASK1, 0); int hit = HitScan(actor, pSprite->pos.Z, dx, dy, 0, CLIPMASK1, 0);
switch (hit) switch (hit)
{ {
case -1: case -1:

View file

@ -64,7 +64,7 @@ void GillBiteSeqCallback(int, DBloodActor* actor)
spritetype* pTarget = &actor->GetTarget()->s(); spritetype* pTarget = &actor->GetTarget()->s();
int dx = bcos(pSprite->ang); int dx = bcos(pSprite->ang);
int dy = bsin(pSprite->ang); int dy = bsin(pSprite->ang);
int dz = pSprite->z - pTarget->z; int dz = pSprite->pos.Z - pTarget->pos.Z;
dx += Random3(2000); dx += Random3(2000);
dy += Random3(2000); dy += Random3(2000);
actFireVector(actor, 0, 0, dx, dy, dz, kVectorGillBite); actFireVector(actor, 0, 0, dx, dy, dz, kVectorGillBite);
@ -147,15 +147,15 @@ static void gillThinkChase(DBloodActor* actor)
{ {
int nDeltaAngle = ((getangle(dx, dy) + 1024 - pSprite->ang) & 2047) - 1024; int nDeltaAngle = ((getangle(dx, dy) + 1024 - pSprite->ang) & 2047) - 1024;
int height = (pDudeInfo->eyeHeight * pSprite->yrepeat) << 2; int height = (pDudeInfo->eyeHeight * pSprite->yrepeat) << 2;
if (cansee(pTarget->pos.X, pTarget->pos.Y, pTarget->z, pTarget->sector(), pSprite->pos.X, pSprite->pos.Y, pSprite->z - height, pSprite->sector())) if (cansee(pTarget->pos.X, pTarget->pos.Y, pTarget->pos.Z, pTarget->sector(), pSprite->pos.X, pSprite->pos.Y, pSprite->pos.Z - height, pSprite->sector()))
{ {
if (nDist < pDudeInfo->seeDist && abs(nDeltaAngle) <= pDudeInfo->periphery) if (nDist < pDudeInfo->seeDist && abs(nDeltaAngle) <= pDudeInfo->periphery)
{ {
aiSetTarget(actor, actor->GetTarget()); aiSetTarget(actor, actor->GetTarget());
actor->dudeSlope = nDist == 0 ? 0 : DivScale(pTarget->z - pSprite->z, nDist, 10); actor->dudeSlope = nDist == 0 ? 0 : DivScale(pTarget->pos.Z - pSprite->pos.Z, nDist, 10);
if (nDist < 921 && abs(nDeltaAngle) < 28) if (nDist < 921 && abs(nDeltaAngle) < 28)
{ {
int hit = HitScan(actor, pSprite->z, dx, dy, 0, CLIPMASK1, 0); int hit = HitScan(actor, pSprite->pos.Z, dx, dy, 0, CLIPMASK1, 0);
switch (hit) switch (hit)
{ {
case -1: case -1:
@ -247,10 +247,10 @@ static void gillThinkSwimChase(DBloodActor* actor)
if (nDist <= pDudeInfo->seeDist) if (nDist <= pDudeInfo->seeDist)
{ {
int nDeltaAngle = ((getangle(dx, dy) + 1024 - pSprite->ang) & 2047) - 1024; int nDeltaAngle = ((getangle(dx, dy) + 1024 - pSprite->ang) & 2047) - 1024;
int height = pDudeInfo->eyeHeight + pSprite->z; int height = pDudeInfo->eyeHeight + pSprite->pos.Z;
int top, bottom; int top, bottom;
GetActorExtents(actor, &top, &bottom); GetActorExtents(actor, &top, &bottom);
if (cansee(pTarget->pos.X, pTarget->pos.Y, pTarget->z, pTarget->sector(), pSprite->pos.X, pSprite->pos.Y, pSprite->z - height, pSprite->sector())) if (cansee(pTarget->pos.X, pTarget->pos.Y, pTarget->pos.Z, pTarget->sector(), pSprite->pos.X, pSprite->pos.Y, pSprite->pos.Z - height, pSprite->sector()))
{ {
if (nDist < pDudeInfo->seeDist && abs(nDeltaAngle) <= pDudeInfo->periphery) if (nDist < pDudeInfo->seeDist && abs(nDeltaAngle) <= pDudeInfo->periphery)
{ {
@ -314,8 +314,8 @@ static void sub_6CD74(DBloodActor* actor)
DUDEINFO* pDudeInfo = getDudeInfo(pSprite->type); DUDEINFO* pDudeInfo = getDudeInfo(pSprite->type);
if (!actor->ValidateTarget(__FUNCTION__)) return; if (!actor->ValidateTarget(__FUNCTION__)) return;
spritetype* pTarget = &actor->GetTarget()->s(); spritetype* pTarget = &actor->GetTarget()->s();
int z = pSprite->z + getDudeInfo(pSprite->type)->eyeHeight; int z = pSprite->pos.Z + getDudeInfo(pSprite->type)->eyeHeight;
int z2 = pTarget->z + getDudeInfo(pTarget->type)->eyeHeight; int z2 = pTarget->pos.Z + getDudeInfo(pTarget->type)->eyeHeight;
int nAng = ((pXSprite->goalAng + 1024 - pSprite->ang) & 2047) - 1024; int nAng = ((pXSprite->goalAng + 1024 - pSprite->ang) & 2047) - 1024;
int nTurnRange = (pDudeInfo->angSpeed << 2) >> 4; int nTurnRange = (pDudeInfo->angSpeed << 2) >> 4;
pSprite->ang = (pSprite->ang + ClipRange(nAng, -nTurnRange, nTurnRange)) & 2047; pSprite->ang = (pSprite->ang + ClipRange(nAng, -nTurnRange, nTurnRange)) & 2047;
@ -351,8 +351,8 @@ static void sub_6D03C(DBloodActor* actor)
DUDEINFO* pDudeInfo = getDudeInfo(pSprite->type); DUDEINFO* pDudeInfo = getDudeInfo(pSprite->type);
if (!actor->ValidateTarget(__FUNCTION__)) return; if (!actor->ValidateTarget(__FUNCTION__)) return;
spritetype* pTarget = &actor->GetTarget()->s(); spritetype* pTarget = &actor->GetTarget()->s();
int z = pSprite->z + getDudeInfo(pSprite->type)->eyeHeight; int z = pSprite->pos.Z + getDudeInfo(pSprite->type)->eyeHeight;
int z2 = pTarget->z + getDudeInfo(pTarget->type)->eyeHeight; int z2 = pTarget->pos.Z + getDudeInfo(pTarget->type)->eyeHeight;
int nAng = ((pXSprite->goalAng + 1024 - pSprite->ang) & 2047) - 1024; int nAng = ((pXSprite->goalAng + 1024 - pSprite->ang) & 2047) - 1024;
int nTurnRange = (pDudeInfo->angSpeed << 2) >> 4; int nTurnRange = (pDudeInfo->angSpeed << 2) >> 4;
pSprite->ang = (pSprite->ang + ClipRange(nAng, -nTurnRange, nTurnRange)) & 2047; pSprite->ang = (pSprite->ang + ClipRange(nAng, -nTurnRange, nTurnRange)) & 2047;

View file

@ -110,7 +110,7 @@ static void handThinkChase(DBloodActor* actor)
{ {
int nDeltaAngle = ((getangle(dx, dy) + 1024 - pSprite->ang) & 2047) - 1024; int nDeltaAngle = ((getangle(dx, dy) + 1024 - pSprite->ang) & 2047) - 1024;
int height = (pDudeInfo->eyeHeight * pSprite->yrepeat) << 2; int height = (pDudeInfo->eyeHeight * pSprite->yrepeat) << 2;
if (cansee(pTarget->pos.X, pTarget->pos.Y, pTarget->z, pTarget->sector(), pSprite->pos.X, pSprite->pos.Y, pSprite->z - height, pSprite->sector())) if (cansee(pTarget->pos.X, pTarget->pos.Y, pTarget->pos.Z, pTarget->sector(), pSprite->pos.X, pSprite->pos.Y, pSprite->pos.Z - height, pSprite->sector()))
{ {
if (nDist < pDudeInfo->seeDist && abs(nDeltaAngle) <= pDudeInfo->periphery) if (nDist < pDudeInfo->seeDist && abs(nDeltaAngle) <= pDudeInfo->periphery)
{ {

View file

@ -57,7 +57,7 @@ void houndBiteSeqCallback(int, DBloodActor* actor)
spritetype* pTarget = &actor->GetTarget()->s(); spritetype* pTarget = &actor->GetTarget()->s();
#ifdef NOONE_EXTENSIONS #ifdef NOONE_EXTENSIONS
if (IsPlayerSprite(pTarget) || gModernMap) // allow to hit non-player targets if (IsPlayerSprite(pTarget) || gModernMap) // allow to hit non-player targets
actFireVector(actor, 0, 0, dx, dy, pTarget->z - pSprite->z, kVectorHoundBite); actFireVector(actor, 0, 0, dx, dy, pTarget->pos.Z - pSprite->pos.Z, kVectorHoundBite);
#else #else
if (IsPlayerSprite(pTarget)) if (IsPlayerSprite(pTarget))
actFireVector(actor, 0, 0, dx, dy, pTarget->z - pSprite->z, kVectorHoundBite); actFireVector(actor, 0, 0, dx, dy, pTarget->z - pSprite->z, kVectorHoundBite);
@ -132,7 +132,7 @@ static void houndThinkChase(DBloodActor* actor)
{ {
int nDeltaAngle = ((getangle(dx, dy) + 1024 - pSprite->ang) & 2047) - 1024; int nDeltaAngle = ((getangle(dx, dy) + 1024 - pSprite->ang) & 2047) - 1024;
int height = (pDudeInfo->eyeHeight * pSprite->yrepeat) << 2; int height = (pDudeInfo->eyeHeight * pSprite->yrepeat) << 2;
if (cansee(pTarget->pos.X, pTarget->pos.Y, pTarget->z, pTarget->sector(), pSprite->pos.X, pSprite->pos.Y, pSprite->z - height, pSprite->sector())) if (cansee(pTarget->pos.X, pTarget->pos.Y, pTarget->pos.Z, pTarget->sector(), pSprite->pos.X, pSprite->pos.Y, pSprite->pos.Z - height, pSprite->sector()))
{ {
if (nDist < pDudeInfo->seeDist && abs(nDeltaAngle) <= pDudeInfo->periphery) if (nDist < pDudeInfo->seeDist && abs(nDeltaAngle) <= pDudeInfo->periphery)
{ {

View file

@ -96,7 +96,7 @@ static void innocThinkChase(DBloodActor* actor)
{ {
int nDeltaAngle = ((getangle(dx, dy) + 1024 - pSprite->ang) & 2047) - 1024; int nDeltaAngle = ((getangle(dx, dy) + 1024 - pSprite->ang) & 2047) - 1024;
int height = (pDudeInfo->eyeHeight * pSprite->yrepeat) << 2; int height = (pDudeInfo->eyeHeight * pSprite->yrepeat) << 2;
if (cansee(pTarget->pos.X, pTarget->pos.Y, pTarget->z, pTarget->sector(), pSprite->pos.X, pSprite->pos.Y, pSprite->z - height, pSprite->sector())) if (cansee(pTarget->pos.X, pTarget->pos.Y, pTarget->pos.Z, pTarget->sector(), pSprite->pos.X, pSprite->pos.Y, pSprite->pos.Z - height, pSprite->sector()))
{ {
if (nDist < pDudeInfo->seeDist && abs(nDeltaAngle) <= pDudeInfo->periphery) if (nDist < pDudeInfo->seeDist && abs(nDeltaAngle) <= pDudeInfo->periphery)
{ {

View file

@ -70,7 +70,7 @@ void podAttack(int, DBloodActor* actor)
DUDEINFO* pDudeInfo = getDudeInfo(pSprite->type); DUDEINFO* pDudeInfo = getDudeInfo(pSprite->type);
int x = pTarget->pos.X - pSprite->pos.X; int x = pTarget->pos.X - pSprite->pos.X;
int y = pTarget->pos.Y - pSprite->pos.Y; int y = pTarget->pos.Y - pSprite->pos.Y;
int dz = pTarget->z - pSprite->z; int dz = pTarget->pos.Z - pSprite->pos.Z;
x += Random2(1000); x += Random2(1000);
y += Random2(1000); y += Random2(1000);
int nDist = approxDist(x, y); int nDist = approxDist(x, y);
@ -125,7 +125,7 @@ void sub_70284(int, DBloodActor* actor)
nDist = 75; nDist = 75;
break; break;
} }
actRadiusDamage(actor, pSprite->pos.X, pSprite->pos.Y, pSprite->z, pSprite->sector(), nDist, 1, 5 * (1 + gGameOptions.nDifficulty), dmgType, 2, nBurn); actRadiusDamage(actor, pSprite->pos.X, pSprite->pos.Y, pSprite->pos.Z, pSprite->sector(), nDist, 1, 5 * (1 + gGameOptions.nDifficulty), dmgType, 2, nBurn);
} }
static void aiPodSearch(DBloodActor* actor) static void aiPodSearch(DBloodActor* actor)
@ -212,7 +212,7 @@ static void aiPodChase(DBloodActor* actor)
{ {
int nDeltaAngle = ((getangle(dx, dy) + 1024 - pSprite->ang) & 2047) - 1024; int nDeltaAngle = ((getangle(dx, dy) + 1024 - pSprite->ang) & 2047) - 1024;
int height = (pDudeInfo->eyeHeight * pSprite->yrepeat) << 2; int height = (pDudeInfo->eyeHeight * pSprite->yrepeat) << 2;
if (cansee(pTarget->pos.X, pTarget->pos.Y, pTarget->z, pTarget->sector(), pSprite->pos.X, pSprite->pos.Y, pSprite->z - height, pSprite->sector())) if (cansee(pTarget->pos.X, pTarget->pos.Y, pTarget->pos.Z, pTarget->sector(), pSprite->pos.X, pSprite->pos.Y, pSprite->pos.Z - height, pSprite->sector()))
{ {
if (nDist < pDudeInfo->seeDist && abs(nDeltaAngle) <= pDudeInfo->periphery) if (nDist < pDudeInfo->seeDist && abs(nDeltaAngle) <= pDudeInfo->periphery)
{ {

View file

@ -50,7 +50,7 @@ void ratBiteSeqCallback(int, DBloodActor* actor)
if (!actor->ValidateTarget(__FUNCTION__)) return; if (!actor->ValidateTarget(__FUNCTION__)) return;
spritetype* pTarget = &actor->GetTarget()->s(); spritetype* pTarget = &actor->GetTarget()->s();
if (IsPlayerSprite(pTarget)) if (IsPlayerSprite(pTarget))
actFireVector(actor, 0, 0, dx, dy, pTarget->z - pSprite->z, kVectorRatBite); actFireVector(actor, 0, 0, dx, dy, pTarget->pos.Z - pSprite->pos.Z, kVectorRatBite);
} }
static void ratThinkSearch(DBloodActor* actor) static void ratThinkSearch(DBloodActor* actor)
@ -106,7 +106,7 @@ static void ratThinkChase(DBloodActor* actor)
{ {
int nDeltaAngle = ((getangle(dx, dy) + 1024 - pSprite->ang) & 2047) - 1024; int nDeltaAngle = ((getangle(dx, dy) + 1024 - pSprite->ang) & 2047) - 1024;
int height = (pDudeInfo->eyeHeight * pSprite->yrepeat) << 2; int height = (pDudeInfo->eyeHeight * pSprite->yrepeat) << 2;
if (cansee(pTarget->pos.X, pTarget->pos.Y, pTarget->z, pTarget->sector(), pSprite->pos.X, pSprite->pos.Y, pSprite->z - height, pSprite->sector())) if (cansee(pTarget->pos.X, pTarget->pos.Y, pTarget->pos.Z, pTarget->sector(), pSprite->pos.X, pSprite->pos.Y, pSprite->pos.Z - height, pSprite->sector()))
{ {
if (nDist < pDudeInfo->seeDist && abs(nDeltaAngle) <= pDudeInfo->periphery) if (nDist < pDudeInfo->seeDist && abs(nDeltaAngle) <= pDudeInfo->periphery)
{ {

View file

@ -73,10 +73,10 @@ void SpidBiteSeqCallback(int, DBloodActor* actor)
spritetype* pTarget = &target->s(); spritetype* pTarget = &target->s();
if (IsPlayerSprite(pTarget)) if (IsPlayerSprite(pTarget))
{ {
int hit = HitScan(actor, pSprite->z, dx, dy, 0, CLIPMASK1, 0); int hit = HitScan(actor, pSprite->pos.Z, dx, dy, 0, CLIPMASK1, 0);
if (hit == 3 && gHitInfo.actor()->IsPlayerActor()) if (hit == 3 && gHitInfo.actor()->IsPlayerActor())
{ {
dz += pTarget->z - pSprite->z; dz += pTarget->pos.Z - pSprite->pos.Z;
PLAYER* pPlayer = &gPlayer[pTarget->type - kDudePlayer1]; PLAYER* pPlayer = &gPlayer[pTarget->type - kDudePlayer1];
switch (pSprite->type) switch (pSprite->type)
{ {
@ -120,7 +120,7 @@ void SpidJumpSeqCallback(int, DBloodActor* actor)
if (!actor->ValidateTarget(__FUNCTION__)) return; if (!actor->ValidateTarget(__FUNCTION__)) return;
spritetype* pTarget = &actor->GetTarget()->s(); spritetype* pTarget = &actor->GetTarget()->s();
if (IsPlayerSprite(pTarget)) { if (IsPlayerSprite(pTarget)) {
dz += pTarget->z - pSprite->z; dz += pTarget->pos.Z - pSprite->pos.Z;
switch (pSprite->type) { switch (pSprite->type) {
case kDudeSpiderBrown: case kDudeSpiderBrown:
case kDudeSpiderRed: case kDudeSpiderRed:
@ -220,7 +220,7 @@ static void spidThinkChase(DBloodActor* actor)
int nDeltaAngle = ((getangle(dx, dy) + 1024 - pSprite->ang) & 2047) - 1024; int nDeltaAngle = ((getangle(dx, dy) + 1024 - pSprite->ang) & 2047) - 1024;
int height = (pDudeInfo->eyeHeight * pSprite->yrepeat) << 2; int height = (pDudeInfo->eyeHeight * pSprite->yrepeat) << 2;
if (cansee(pTarget->pos.X, pTarget->pos.Y, pTarget->z, pTarget->sector(), pSprite->pos.X, pSprite->pos.Y, pSprite->z - height, pSprite->sector())) { if (cansee(pTarget->pos.X, pTarget->pos.Y, pTarget->pos.Z, pTarget->sector(), pSprite->pos.X, pSprite->pos.Y, pSprite->pos.Z - height, pSprite->sector())) {
if (nDist < pDudeInfo->seeDist && abs(nDeltaAngle) <= pDudeInfo->periphery) { if (nDist < pDudeInfo->seeDist && abs(nDeltaAngle) <= pDudeInfo->periphery) {
aiSetTarget(actor, actor->GetTarget()); aiSetTarget(actor, actor->GetTarget());

View file

@ -79,7 +79,7 @@ void sub_71BD4(int, DBloodActor* actor)
continue; continue;
int x2 = pSprite2->pos.X; int x2 = pSprite2->pos.X;
int y2 = pSprite2->pos.Y; int y2 = pSprite2->pos.Y;
int z2 = pSprite2->z; int z2 = pSprite2->pos.Z;
int nDist = approxDist(x2 - x, y2 - y); int nDist = approxDist(x2 - x, y2 - y);
if (nDist == 0 || nDist > 0x2800) if (nDist == 0 || nDist > 0x2800)
continue; continue;
@ -108,7 +108,7 @@ void sub_71BD4(int, DBloodActor* actor)
int nDeltaAngle = ((nAngle - pSprite->ang + 1024) & 2047) - 1024; int nDeltaAngle = ((nAngle - pSprite->ang + 1024) & 2047) - 1024;
if (abs(nDeltaAngle) <= tt.at8) if (abs(nDeltaAngle) <= tt.at8)
{ {
int tz = pSprite2->z - pSprite->z; int tz = pSprite2->pos.Z - pSprite->pos.Z;
if (cansee(x, y, z, pSprite->sector(), x2, y2, z2, pSprite2->sector())) if (cansee(x, y, z, pSprite->sector(), x2, y2, z2, pSprite2->sector()))
{ {
nClosest = nDist2; nClosest = nDist2;
@ -153,7 +153,7 @@ void sub_720AC(int, DBloodActor* actor)
continue; continue;
int x2 = pSprite2->pos.X; int x2 = pSprite2->pos.X;
int y2 = pSprite2->pos.Y; int y2 = pSprite2->pos.Y;
int z2 = pSprite2->z; int z2 = pSprite2->pos.Z;
int nDist = approxDist(x2 - x, y2 - y); int nDist = approxDist(x2 - x, y2 - y);
if (nDist == 0 || nDist > 0x2800) if (nDist == 0 || nDist > 0x2800)
continue; continue;
@ -182,7 +182,7 @@ void sub_720AC(int, DBloodActor* actor)
int nDeltaAngle = ((nAngle - pSprite->ang + 1024) & 2047) - 1024; int nDeltaAngle = ((nAngle - pSprite->ang + 1024) & 2047) - 1024;
if (abs(nDeltaAngle) <= tt.at8) if (abs(nDeltaAngle) <= tt.at8)
{ {
int tz = pSprite2->z - pSprite->z; int tz = pSprite2->pos.Z - pSprite->pos.Z;
if (cansee(x, y, z, pSprite->sector(), x2, y2, z2, pSprite2->sector())) if (cansee(x, y, z, pSprite->sector(), x2, y2, z2, pSprite2->sector()))
{ {
nClosest = nDist2; nClosest = nDist2;
@ -236,14 +236,14 @@ static void sub_725A4(DBloodActor* actor)
continue; continue;
int x = pPlayer->pSprite->pos.X; int x = pPlayer->pSprite->pos.X;
int y = pPlayer->pSprite->pos.Y; int y = pPlayer->pSprite->pos.Y;
int z = pPlayer->pSprite->z; int z = pPlayer->pSprite->pos.Z;
auto pSector = pPlayer->pSprite->sector(); auto pSector = pPlayer->pSprite->sector();
int dx = x - pSprite->pos.X; int dx = x - pSprite->pos.X;
int dy = y - pSprite->pos.Y; int dy = y - pSprite->pos.Y;
int nDist = approxDist(dx, dy); int nDist = approxDist(dx, dy);
if (nDist > pDudeInfo->seeDist && nDist > pDudeInfo->hearDist) if (nDist > pDudeInfo->seeDist && nDist > pDudeInfo->hearDist)
continue; continue;
if (!cansee(x, y, z, pSector, pSprite->pos.X, pSprite->pos.Y, pSprite->z - ((pDudeInfo->eyeHeight * pSprite->yrepeat) << 2), pSprite->sector())) if (!cansee(x, y, z, pSector, pSprite->pos.X, pSprite->pos.Y, pSprite->pos.Z - ((pDudeInfo->eyeHeight * pSprite->yrepeat) << 2), pSprite->sector()))
continue; continue;
int nDeltaAngle = ((getangle(dx, dy) + 1024 - pSprite->ang) & 2047) - 1024; int nDeltaAngle = ((getangle(dx, dy) + 1024 - pSprite->ang) & 2047) - 1024;
if (nDist < pDudeInfo->seeDist && abs(nDeltaAngle) <= pDudeInfo->periphery) if (nDist < pDudeInfo->seeDist && abs(nDeltaAngle) <= pDudeInfo->periphery)
@ -320,7 +320,7 @@ static void sub_72934(DBloodActor* actor)
{ {
int nDeltaAngle = ((getangle(dx, dy) + 1024 - pSprite->ang) & 2047) - 1024; int nDeltaAngle = ((getangle(dx, dy) + 1024 - pSprite->ang) & 2047) - 1024;
int height = (pDudeInfo->eyeHeight * pSprite->yrepeat) << 2; int height = (pDudeInfo->eyeHeight * pSprite->yrepeat) << 2;
if (cansee(pTarget->pos.X, pTarget->pos.Y, pTarget->z, pTarget->sector(), pSprite->pos.X, pSprite->pos.Y, pSprite->z - height, pSprite->sector())) if (cansee(pTarget->pos.X, pTarget->pos.Y, pTarget->pos.Z, pTarget->sector(), pSprite->pos.X, pSprite->pos.Y, pSprite->pos.Z - height, pSprite->sector()))
{ {
if (nDist < pDudeInfo->seeDist && abs(nDeltaAngle) <= pDudeInfo->periphery) if (nDist < pDudeInfo->seeDist && abs(nDeltaAngle) <= pDudeInfo->periphery)
{ {

View file

@ -145,7 +145,7 @@ static bool genDudeAdjustSlope(DBloodActor* actor, int dist, int weaponType, int
for (int i = -8191; i < 8192; i += by) for (int i = -8191; i < 8192; i += by)
{ {
HitScan(actor, pSprite->z, bcos(pSprite->ang), bsin(pSprite->ang), i, clipMask, dist); HitScan(actor, pSprite->pos.Z, bcos(pSprite->ang), bsin(pSprite->ang), i, clipMask, dist);
if (!fStart && actor->GetTarget() == gHitInfo.actor()) fStart = i; if (!fStart && actor->GetTarget() == gHitInfo.actor()) fStart = i;
else if (fStart && actor->GetTarget() != gHitInfo.actor()) else if (fStart && actor->GetTarget() != gHitInfo.actor())
{ {
@ -327,7 +327,7 @@ static void ThrowThing(DBloodActor* actor, bool impact)
int zThrow = 14500; int zThrow = 14500;
int dx = pTarget->pos.X - pSprite->pos.X; int dx = pTarget->pos.X - pSprite->pos.X;
int dy = pTarget->pos.Y - pSprite->pos.Y; int dy = pTarget->pos.Y - pSprite->pos.Y;
int dz = pTarget->z - pSprite->z; int dz = pTarget->pos.Z - pSprite->pos.Z;
int dist = approxDist(dx, dy); int dist = approxDist(dx, dy);
auto actLeech = leechIsDropped(actor); auto actLeech = leechIsDropped(actor);
@ -544,8 +544,8 @@ static void unicultThinkChase(DBloodActor* actor)
int losAngle = ((getangle(dx, dy) + 1024 - pSprite->ang) & 2047) - 1024; int losAngle = ((getangle(dx, dy) + 1024 - pSprite->ang) & 2047) - 1024;
int eyeAboveZ = (pDudeInfo->eyeHeight * pSprite->yrepeat) << 2; int eyeAboveZ = (pDudeInfo->eyeHeight * pSprite->yrepeat) << 2;
if (dist > pDudeInfo->seeDist || !cansee(pTarget->pos.X, pTarget->pos.Y, pTarget->z, pTarget->sector(), if (dist > pDudeInfo->seeDist || !cansee(pTarget->pos.X, pTarget->pos.Y, pTarget->pos.Z, pTarget->sector(),
pSprite->pos.X, pSprite->pos.Y, pSprite->z - eyeAboveZ, pSprite->sector())) pSprite->pos.X, pSprite->pos.Y, pSprite->pos.Z - eyeAboveZ, pSprite->sector()))
{ {
if (spriteIsUnderwater(actor, false)) aiGenDudeNewState(actor, &genDudeSearchW); if (spriteIsUnderwater(actor, false)) aiGenDudeNewState(actor, &genDudeSearchW);
else aiGenDudeNewState(actor, &genDudeSearchL); else aiGenDudeNewState(actor, &genDudeSearchL);
@ -559,7 +559,7 @@ static void unicultThinkChase(DBloodActor* actor)
if ((PlayClock & 64) == 0 && Chance(0x3000) && !spriteIsUnderwater(actor, false)) if ((PlayClock & 64) == 0 && Chance(0x3000) && !spriteIsUnderwater(actor, false))
playGenDudeSound(actor, kGenDudeSndChasing); playGenDudeSound(actor, kGenDudeSndChasing);
actor->dudeSlope = dist == 0 ? 0 : DivScale(pTarget->z - pSprite->z, dist, 10); actor->dudeSlope = dist == 0 ? 0 : DivScale(pTarget->pos.Z - pSprite->pos.Z, dist, 10);
int curWeapon = actor->genDudeExtra.curWeapon; int curWeapon = actor->genDudeExtra.curWeapon;
int weaponType = actor->genDudeExtra.weaponType; int weaponType = actor->genDudeExtra.weaponType;
@ -581,7 +581,7 @@ static void unicultThinkChase(DBloodActor* actor)
} }
else if (dist < 12264 && dist > 7680 && !spriteIsUnderwater(actor, false) && curWeapon != kModernThingEnemyLifeLeech) else if (dist < 12264 && dist > 7680 && !spriteIsUnderwater(actor, false) && curWeapon != kModernThingEnemyLifeLeech)
{ {
int pHit = HitScan(actor, pSprite->z, dx, dy, 0, 16777280, 0); int pHit = HitScan(actor, pSprite->pos.Z, dx, dy, 0, 16777280, 0);
switch (pHit) { switch (pHit) {
case 0: case 0:
case 4: case 4:
@ -606,8 +606,8 @@ static void unicultThinkChase(DBloodActor* actor)
} }
int ldist = aiFightGetTargetDist(targetactor, pDudeInfo, actLeech); int ldist = aiFightGetTargetDist(targetactor, pDudeInfo, actLeech);
if (ldist > 3 || !cansee(pTarget->pos.X, pTarget->pos.Y, pTarget->z, pTarget->sector(), if (ldist > 3 || !cansee(pTarget->pos.X, pTarget->pos.Y, pTarget->pos.Z, pTarget->sector(),
pLeech->pos.X, pLeech->pos.Y, pLeech->z, pLeech->sector()) || actLeech->GetTarget() == nullptr) pLeech->pos.X, pLeech->pos.Y, pLeech->pos.Z, pLeech->sector()) || actLeech->GetTarget() == nullptr)
{ {
aiGenDudeNewState(actor, &genDudeThrow2); aiGenDudeNewState(actor, &genDudeThrow2);
genDudeThrow2.nextState = &genDudeDodgeShortL; genDudeThrow2.nextState = &genDudeDodgeShortL;
@ -680,7 +680,7 @@ static void unicultThinkChase(DBloodActor* actor)
// don't attack slaves // don't attack slaves
if (actor->GetTarget() != nullptr && actor->GetTarget()->GetOwner() == actor) if (actor->GetTarget() != nullptr && actor->GetTarget()->GetOwner() == actor)
{ {
aiSetTarget(actor, pSprite->pos.X, pSprite->pos.Y, pSprite->z); aiSetTarget(actor, pSprite->pos.X, pSprite->pos.Y, pSprite->pos.Z);
return; return;
} }
else if (actor->genDudeExtra.slaveCount > gGameOptions.nDifficulty || dist < meleeVector->maxDist) else if (actor->genDudeExtra.slaveCount > gGameOptions.nDifficulty || dist < meleeVector->maxDist)
@ -751,7 +751,7 @@ static void unicultThinkChase(DBloodActor* actor)
{ {
int nType = curWeapon - kTrapExploder; int nType = curWeapon - kTrapExploder;
const EXPLOSION* pExpl = &explodeInfo[nType]; const EXPLOSION* pExpl = &explodeInfo[nType];
if (CheckProximity(actor, pTarget->pos.X, pTarget->pos.Y, pTarget->z, pTarget->sector(), pExpl->radius >> 1)) if (CheckProximity(actor, pTarget->pos.X, pTarget->pos.Y, pTarget->pos.Z, pTarget->sector(), pExpl->radius >> 1))
{ {
actor->xvel = actor->yvel = actor->zvel = 0; actor->xvel = actor->yvel = actor->zvel = 0;
if (doExplosion(actor, nType) && pXSprite->health > 0) if (doExplosion(actor, nType) && pXSprite->health > 0)
@ -769,9 +769,9 @@ static void unicultThinkChase(DBloodActor* actor)
{ {
int objDist = -1; int targetDist = -1; int hit = -1; int objDist = -1; int targetDist = -1; int hit = -1;
if (weaponType == kGenDudeWeaponHitscan) if (weaponType == kGenDudeWeaponHitscan)
hit = HitScan(actor, pSprite->z, bcos(pSprite->ang), bsin(pSprite->ang), actor->dudeSlope, CLIPMASK1, dist); hit = HitScan(actor, pSprite->pos.Z, bcos(pSprite->ang), bsin(pSprite->ang), actor->dudeSlope, CLIPMASK1, dist);
else if (weaponType == kGenDudeWeaponMissile) else if (weaponType == kGenDudeWeaponMissile)
hit = HitScan(actor, pSprite->z, bcos(pSprite->ang), bsin(pSprite->ang), actor->dudeSlope, CLIPMASK0, dist); hit = HitScan(actor, pSprite->pos.Z, bcos(pSprite->ang), bsin(pSprite->ang), actor->dudeSlope, CLIPMASK0, dist);
if (hit >= 0) if (hit >= 0)
{ {
@ -1442,7 +1442,7 @@ void removeLeech(DBloodActor* actLeech, bool delSprite)
if (actLeech != NULL) if (actLeech != NULL)
{ {
auto const pLeech = &actLeech->s(); auto const pLeech = &actLeech->s();
auto effectactor = gFX.fxSpawnActor((FX_ID)52, pLeech->sector(), pLeech->pos.X, pLeech->pos.Y, pLeech->z, pLeech->ang); auto effectactor = gFX.fxSpawnActor((FX_ID)52, pLeech->sector(), pLeech->pos.X, pLeech->pos.Y, pLeech->pos.Z, pLeech->ang);
if (effectactor != NULL) if (effectactor != NULL)
{ {
spritetype* pEffect = &effectactor->s(); spritetype* pEffect = &effectactor->s();
@ -1841,8 +1841,8 @@ void dudeLeechOperate(DBloodActor* actor, const EVENT& event)
GetActorExtents(actor, &top, &bottom); GetActorExtents(actor, &top, &bottom);
int nType = pTarget->type - kDudeBase; int nType = pTarget->type - kDudeBase;
DUDEINFO* pDudeInfo = &dudeInfo[nType]; DUDEINFO* pDudeInfo = &dudeInfo[nType];
int z1 = (top - pSprite->z) - 256; int z1 = (top - pSprite->pos.Z) - 256;
int x = pTarget->pos.X; int y = pTarget->pos.Y; int z = pTarget->z; int x = pTarget->pos.X; int y = pTarget->pos.Y; int z = pTarget->pos.Z;
int nDist = approxDist(x - pSprite->pos.X, y - pSprite->pos.Y); int nDist = approxDist(x - pSprite->pos.X, y - pSprite->pos.Y);
if (nDist != 0 && cansee(pSprite->pos.X, pSprite->pos.Y, top, pSprite->sector(), x, y, z, pTarget->sector())) if (nDist != 0 && cansee(pSprite->pos.X, pSprite->pos.Y, top, pSprite->sector(), x, y, z, pTarget->sector()))
@ -1854,7 +1854,7 @@ void dudeLeechOperate(DBloodActor* actor, const EVENT& event)
pSprite->ang = getangle(x - pSprite->pos.X, y - pSprite->pos.Y); pSprite->ang = getangle(x - pSprite->pos.X, y - pSprite->pos.Y);
int dx = bcos(pSprite->ang); int dx = bcos(pSprite->ang);
int dy = bsin(pSprite->ang); int dy = bsin(pSprite->ang);
int tz = pTarget->z - (pTarget->yrepeat * pDudeInfo->aimHeight) * 4; int tz = pTarget->pos.Z - (pTarget->yrepeat * pDudeInfo->aimHeight) * 4;
int dz = DivScale(tz - top - 256, nDist, 10); int dz = DivScale(tz - top - 256, nDist, 10);
int nMissileType = kMissileLifeLeechAltNormal + (pXSprite->data3 ? 1 : 0); int nMissileType = kMissileLifeLeechAltNormal + (pXSprite->data3 ? 1 : 0);
int t2; int t2;
@ -1887,7 +1887,7 @@ bool doExplosion(DBloodActor* actor, int nType)
{ {
auto const pSprite = &actor->s(); auto const pSprite = &actor->s();
auto actExplosion = actSpawnSprite(pSprite->sector(), pSprite->pos.X, pSprite->pos.Y, pSprite->z, kStatExplosion, true); auto actExplosion = actSpawnSprite(pSprite->sector(), pSprite->pos.X, pSprite->pos.Y, pSprite->pos.Z, kStatExplosion, true);
auto const pExplosion = &actExplosion->s(); auto const pExplosion = &actExplosion->s();
auto const pXExplosion = &actExplosion->x(); auto const pXExplosion = &actExplosion->x();
if (!actExplosion->hasX()) if (!actExplosion->hasX())
@ -1937,7 +1937,7 @@ DBloodActor* genDudeSpawn(DBloodActor* source, DBloodActor* actor, int nDist)
spritetype* pDude = &spawned->s(); spritetype* pDude = &spawned->s();
XSPRITE* pXDude = &spawned->x(); XSPRITE* pXDude = &spawned->x();
int x, y, z = pSprite->z, nAngle = pSprite->ang, nType = kDudeModernCustom; int x, y, z = pSprite->pos.Z, nAngle = pSprite->ang, nType = kDudeModernCustom;
if (nDist > 0) if (nDist > 0)
{ {
@ -2124,7 +2124,7 @@ void genDudeTransform(DBloodActor* actor)
aiInitSprite(actor); aiInitSprite(actor);
// try to restore target // try to restore target
if (target == nullptr) aiSetTarget(actor, pSprite->pos.X, pSprite->pos.Y, pSprite->z); if (target == nullptr) aiSetTarget(actor, pSprite->pos.X, pSprite->pos.Y, pSprite->pos.Z);
else aiSetTarget(actor, target); else aiSetTarget(actor, target);
// finally activate it // finally activate it
@ -2210,11 +2210,11 @@ void updateTargetOfSlaves(DBloodActor* actor)
if (actTarget != slave[i]->GetTarget()) aiSetTarget(slave[i], actTarget); if (actTarget != slave[i]->GetTarget()) aiSetTarget(slave[i], actTarget);
// check if slave have proper target // check if slave have proper target
if (slave[i]->GetTarget() == nullptr || slave[i]->GetTarget()->GetOwner() == actor) if (slave[i]->GetTarget() == nullptr || slave[i]->GetTarget()->GetOwner() == actor)
aiSetTarget(slave[i], pSprite->pos.X, pSprite->pos.Y, pSprite->z); aiSetTarget(slave[i], pSprite->pos.X, pSprite->pos.Y, pSprite->pos.Z);
} }
else else
{ {
aiSetTarget(slave[i], pSprite->pos.X, pSprite->pos.Y, pSprite->z); // try return to master aiSetTarget(slave[i], pSprite->pos.X, pSprite->pos.Y, pSprite->pos.Z); // try return to master
} }
} }
} }
@ -2558,9 +2558,9 @@ bool genDudePrepare(DBloodActor* actor, int propId)
// make sure dudes aren't in the floor or ceiling // make sure dudes aren't in the floor or ceiling
int zTop, zBot; GetSpriteExtents(pSprite, &zTop, &zBot); int zTop, zBot; GetSpriteExtents(pSprite, &zTop, &zBot);
if (!(pSprite->sector()->ceilingstat & CSTAT_SECTOR_SKY)) if (!(pSprite->sector()->ceilingstat & CSTAT_SECTOR_SKY))
pSprite->z += ClipLow(pSprite->sector()->ceilingz - zTop, 0); pSprite->pos.Z += ClipLow(pSprite->sector()->ceilingz - zTop, 0);
if (!(pSprite->sector()->floorstat & CSTAT_SECTOR_SKY)) if (!(pSprite->sector()->floorstat & CSTAT_SECTOR_SKY))
pSprite->z += ClipHigh(pSprite->sector()->floorz - zBot, 0); pSprite->pos.Z += ClipHigh(pSprite->sector()->floorz - zBot, 0);
pSprite->clipdist = ClipRange((pSprite->xrepeat + pSprite->yrepeat) >> 1, 4, 120); pSprite->clipdist = ClipRange((pSprite->xrepeat + pSprite->yrepeat) >> 1, 4, 120);
if (propId) break; if (propId) break;

View file

@ -141,7 +141,7 @@ static void zombaThinkChase(DBloodActor* actor)
{ {
int nDeltaAngle = ((getangle(dx, dy) + 1024 - pSprite->ang) & 2047) - 1024; int nDeltaAngle = ((getangle(dx, dy) + 1024 - pSprite->ang) & 2047) - 1024;
int height = (pDudeInfo->eyeHeight * pSprite->yrepeat) << 2; int height = (pDudeInfo->eyeHeight * pSprite->yrepeat) << 2;
if (cansee(pTarget->pos.X, pTarget->pos.Y, pTarget->z, pTarget->sector(), pSprite->pos.X, pSprite->pos.Y, pSprite->z - height, pSprite->sector())) if (cansee(pTarget->pos.X, pTarget->pos.Y, pTarget->pos.Z, pTarget->sector(), pSprite->pos.X, pSprite->pos.Y, pSprite->pos.Z - height, pSprite->sector()))
{ {
if (abs(nDeltaAngle) <= pDudeInfo->periphery) if (abs(nDeltaAngle) <= pDudeInfo->periphery)
{ {
@ -188,7 +188,7 @@ static void zombaThinkPonder(DBloodActor* actor)
{ {
int nDeltaAngle = ((getangle(dx, dy) + 1024 - pSprite->ang) & 2047) - 1024; int nDeltaAngle = ((getangle(dx, dy) + 1024 - pSprite->ang) & 2047) - 1024;
int height = (pDudeInfo->eyeHeight * pSprite->yrepeat) << 2; int height = (pDudeInfo->eyeHeight * pSprite->yrepeat) << 2;
if (cansee(pTarget->pos.X, pTarget->pos.Y, pTarget->z, pTarget->sector(), pSprite->pos.X, pSprite->pos.Y, pSprite->z - height, pSprite->sector())) if (cansee(pTarget->pos.X, pTarget->pos.Y, pTarget->pos.Z, pTarget->sector(), pSprite->pos.X, pSprite->pos.Y, pSprite->pos.Z - height, pSprite->sector()))
{ {
if (abs(nDeltaAngle) <= pDudeInfo->periphery) if (abs(nDeltaAngle) <= pDudeInfo->periphery)
{ {
@ -222,14 +222,14 @@ static void myThinkTarget(DBloodActor* actor)
continue; continue;
int x = pPlayer->pSprite->pos.X; int x = pPlayer->pSprite->pos.X;
int y = pPlayer->pSprite->pos.Y; int y = pPlayer->pSprite->pos.Y;
int z = pPlayer->pSprite->z; int z = pPlayer->pSprite->pos.Z;
auto pSector = pPlayer->pSprite->sector(); auto pSector = pPlayer->pSprite->sector();
int dx = x - pSprite->pos.X; int dx = x - pSprite->pos.X;
int dy = y - pSprite->pos.Y; int dy = y - pSprite->pos.Y;
int nDist = approxDist(dx, dy); int nDist = approxDist(dx, dy);
if (nDist > pDudeInfo->seeDist && nDist > pDudeInfo->hearDist) if (nDist > pDudeInfo->seeDist && nDist > pDudeInfo->hearDist)
continue; continue;
if (!cansee(x, y, z, pSector, pSprite->pos.X, pSprite->pos.Y, pSprite->z - ((pDudeInfo->eyeHeight * pSprite->yrepeat) << 2), pSprite->sector())) if (!cansee(x, y, z, pSector, pSprite->pos.X, pSprite->pos.Y, pSprite->pos.Z - ((pDudeInfo->eyeHeight * pSprite->yrepeat) << 2), pSprite->sector()))
continue; continue;
int nDeltaAngle = ((getangle(dx, dy) + 1024 - pSprite->ang) & 2047) - 1024; int nDeltaAngle = ((getangle(dx, dy) + 1024 - pSprite->ang) & 2047) - 1024;
if (nDist < pDudeInfo->seeDist && abs(nDeltaAngle) <= pDudeInfo->periphery) if (nDist < pDudeInfo->seeDist && abs(nDeltaAngle) <= pDudeInfo->periphery)

View file

@ -138,14 +138,14 @@ static void zombfThinkChase(DBloodActor* actor)
{ {
int nDeltaAngle = ((getangle(dx, dy) + 1024 - pSprite->ang) & 2047) - 1024; int nDeltaAngle = ((getangle(dx, dy) + 1024 - pSprite->ang) & 2047) - 1024;
int height = (pDudeInfo->eyeHeight * pSprite->yrepeat) << 2; int height = (pDudeInfo->eyeHeight * pSprite->yrepeat) << 2;
if (cansee(pTarget->pos.X, pTarget->pos.Y, pTarget->z, pTarget->sector(), pSprite->pos.X, pSprite->pos.Y, pSprite->z - height, pSprite->sector())) if (cansee(pTarget->pos.X, pTarget->pos.Y, pTarget->pos.Z, pTarget->sector(), pSprite->pos.X, pSprite->pos.Y, pSprite->pos.Z - height, pSprite->sector()))
{ {
if (abs(nDeltaAngle) <= pDudeInfo->periphery) if (abs(nDeltaAngle) <= pDudeInfo->periphery)
{ {
aiSetTarget(actor, actor->GetTarget()); aiSetTarget(actor, actor->GetTarget());
if (nDist < 0x1400 && nDist > 0xe00 && abs(nDeltaAngle) < 85) if (nDist < 0x1400 && nDist > 0xe00 && abs(nDeltaAngle) < 85)
{ {
int hit = HitScan(actor, pSprite->z, dx, dy, 0, CLIPMASK1, 0); int hit = HitScan(actor, pSprite->pos.Z, dx, dy, 0, CLIPMASK1, 0);
switch (hit) switch (hit)
{ {
case -1: case -1:
@ -164,7 +164,7 @@ static void zombfThinkChase(DBloodActor* actor)
} }
else if (nDist < 0x1400 && nDist > 0x600 && abs(nDeltaAngle) < 85) else if (nDist < 0x1400 && nDist > 0x600 && abs(nDeltaAngle) < 85)
{ {
int hit = HitScan(actor, pSprite->z, dx, dy, 0, CLIPMASK1, 0); int hit = HitScan(actor, pSprite->pos.Z, dx, dy, 0, CLIPMASK1, 0);
switch (hit) switch (hit)
{ {
case -1: case -1:
@ -183,7 +183,7 @@ static void zombfThinkChase(DBloodActor* actor)
} }
else if (nDist < 0x400 && abs(nDeltaAngle) < 85) else if (nDist < 0x400 && abs(nDeltaAngle) < 85)
{ {
int hit = HitScan(actor, pSprite->z, dx, dy, 0, CLIPMASK1, 0); int hit = HitScan(actor, pSprite->pos.Z, dx, dy, 0, CLIPMASK1, 0);
switch (hit) switch (hit)
{ {
case -1: case -1:

View file

@ -150,7 +150,7 @@ static tspritetype *viewAddEffect(tspritetype* tsprite, int& spritesortcnt, int
if (perc >= 75) pNSprite2->pal = 0; if (perc >= 75) pNSprite2->pal = 0;
else if (perc >= 50) pNSprite2->pal = 6; else if (perc >= 50) pNSprite2->pal = 6;
pNSprite2->z = top - 2048; pNSprite2->pos.Z = top - 2048;
pNSprite2->shade = -128; pNSprite2->shade = -128;
break; break;
} }
@ -173,7 +173,7 @@ static tspritetype *viewAddEffect(tspritetype* tsprite, int& spritesortcnt, int
RotateXZ(&x, &y, &z, nRand2); RotateXZ(&x, &y, &z, nRand2);
pNSprite->pos.X = pTSprite->pos.X + x; pNSprite->pos.X = pTSprite->pos.X + x;
pNSprite->pos.Y = pTSprite->pos.Y + y; pNSprite->pos.Y = pTSprite->pos.Y + y;
pNSprite->z = pTSprite->z + (z<<4); pNSprite->pos.Z = pTSprite->pos.Z + (z<<4);
pNSprite->picnum = 1720; pNSprite->picnum = 1720;
pNSprite->shade = -128; pNSprite->shade = -128;
} }
@ -189,7 +189,7 @@ static tspritetype *viewAddEffect(tspritetype* tsprite, int& spritesortcnt, int
pNSprite->shade = -128; pNSprite->shade = -128;
pNSprite->pal = 0; pNSprite->pal = 0;
pNSprite->z = top; pNSprite->pos.Z = top;
if (nViewEffect == kViewEffectFlag) if (nViewEffect == kViewEffectFlag)
pNSprite->xrepeat = pNSprite->yrepeat = 24; pNSprite->xrepeat = pNSprite->yrepeat = 24;
else else
@ -203,7 +203,7 @@ static tspritetype *viewAddEffect(tspritetype* tsprite, int& spritesortcnt, int
if (!pNSprite) if (!pNSprite)
break; break;
pNSprite->z = pTSprite->z; pNSprite->pos.Z = pTSprite->pos.Z;
pNSprite->cstat |= CSTAT_SPRITE_TRANSLUCENT; pNSprite->cstat |= CSTAT_SPRITE_TRANSLUCENT;
pNSprite->shade = -128; pNSprite->shade = -128;
pNSprite->xrepeat = pTSprite->xrepeat; pNSprite->xrepeat = pTSprite->xrepeat;
@ -249,7 +249,7 @@ static tspritetype *viewAddEffect(tspritetype* tsprite, int& spritesortcnt, int
pNSprite->cstat |= CSTAT_SPRITE_TRANSLUCENT; pNSprite->cstat |= CSTAT_SPRITE_TRANSLUCENT;
pNSprite->xrepeat = pNSprite->yrepeat = 24; pNSprite->xrepeat = pNSprite->yrepeat = 24;
pNSprite->picnum = 626; pNSprite->picnum = 626;
pNSprite->z = top; pNSprite->pos.Z = top;
break; break;
} }
case kViewEffectTrail: case kViewEffectTrail:
@ -275,9 +275,9 @@ static tspritetype *viewAddEffect(tspritetype* tsprite, int& spritesortcnt, int
pNSprite->pos.X = pTSprite->pos.X + x; pNSprite->pos.X = pTSprite->pos.X + x;
int y = MulScale(nLen, Sin(nAng), 30); int y = MulScale(nLen, Sin(nAng), 30);
pNSprite->pos.Y = pTSprite->pos.Y + y; pNSprite->pos.Y = pTSprite->pos.Y + y;
pNSprite->z = pTSprite->z; pNSprite->pos.Z = pTSprite->pos.Z;
assert(pSector); assert(pSector);
FindSector(pNSprite->pos.X, pNSprite->pos.Y, pNSprite->z, &pSector); FindSector(pNSprite->pos.X, pNSprite->pos.Y, pNSprite->pos.Z, &pSector);
pNSprite->setsector(pSector); pNSprite->setsector(pSector);
pNSprite->ownerActor = pTSprite->ownerActor; pNSprite->ownerActor = pTSprite->ownerActor;
pNSprite->picnum = pTSprite->picnum; pNSprite->picnum = pTSprite->picnum;
@ -298,7 +298,7 @@ static tspritetype *viewAddEffect(tspritetype* tsprite, int& spritesortcnt, int
break; break;
pNSprite->shade = -128; pNSprite->shade = -128;
pNSprite->z = pTSprite->z; pNSprite->pos.Z = pTSprite->pos.Z;
pNSprite->picnum = 908; pNSprite->picnum = 908;
pNSprite->statnum = kStatDecoration; pNSprite->statnum = kStatDecoration;
pNSprite->xrepeat = pNSprite->yrepeat = (tileWidth(pTSprite->picnum)*pTSprite->xrepeat)/64; pNSprite->xrepeat = pNSprite->yrepeat = (tileWidth(pTSprite->picnum)*pTSprite->xrepeat)/64;
@ -312,7 +312,7 @@ static tspritetype *viewAddEffect(tspritetype* tsprite, int& spritesortcnt, int
int top, bottom; int top, bottom;
GetSpriteExtents(pTSprite, &top, &bottom); GetSpriteExtents(pTSprite, &top, &bottom);
pNSprite->z = top; pNSprite->pos.Z = top;
if (IsDudeSprite(pTSprite)) if (IsDudeSprite(pTSprite))
pNSprite->picnum = 672; pNSprite->picnum = 672;
else else
@ -331,7 +331,7 @@ static tspritetype *viewAddEffect(tspritetype* tsprite, int& spritesortcnt, int
int top, bottom; int top, bottom;
GetSpriteExtents(pTSprite, &top, &bottom); GetSpriteExtents(pTSprite, &top, &bottom);
pNSprite->z = bottom; pNSprite->pos.Z = bottom;
if (pTSprite->type >= kDudeBase && pTSprite->type < kDudeMax) if (pTSprite->type >= kDudeBase && pTSprite->type < kDudeMax)
pNSprite->picnum = 672; pNSprite->picnum = 672;
else else
@ -350,7 +350,7 @@ static tspritetype *viewAddEffect(tspritetype* tsprite, int& spritesortcnt, int
int top, bottom; int top, bottom;
GetSpriteExtents(pTSprite, &top, &bottom); GetSpriteExtents(pTSprite, &top, &bottom);
pNSprite->z = top; pNSprite->pos.Z = top;
pNSprite->picnum = 2101; pNSprite->picnum = 2101;
pNSprite->shade = -128; pNSprite->shade = -128;
pNSprite->xrepeat = pNSprite->yrepeat = (tileWidth(pTSprite->picnum)*pTSprite->xrepeat)/32; pNSprite->xrepeat = pNSprite->yrepeat = (tileWidth(pTSprite->picnum)*pTSprite->xrepeat)/32;
@ -364,7 +364,7 @@ static tspritetype *viewAddEffect(tspritetype* tsprite, int& spritesortcnt, int
int top, bottom; int top, bottom;
GetSpriteExtents(pTSprite, &top, &bottom); GetSpriteExtents(pTSprite, &top, &bottom);
pNSprite->z = bottom; pNSprite->pos.Z = bottom;
pNSprite->picnum = 2101; pNSprite->picnum = 2101;
pNSprite->shade = -128; pNSprite->shade = -128;
pNSprite->xrepeat = pNSprite->yrepeat = (tileWidth(pTSprite->picnum)*pTSprite->xrepeat)/32; pNSprite->xrepeat = pNSprite->yrepeat = (tileWidth(pTSprite->picnum)*pTSprite->xrepeat)/32;
@ -378,7 +378,7 @@ static tspritetype *viewAddEffect(tspritetype* tsprite, int& spritesortcnt, int
if (!pNSprite) if (!pNSprite)
break; break;
pNSprite->z = getflorzofslopeptr(pTSprite->sector(), pNSprite->pos.X, pNSprite->pos.Y); pNSprite->pos.Z = getflorzofslopeptr(pTSprite->sector(), pNSprite->pos.X, pNSprite->pos.Y);
pNSprite->shade = 127; pNSprite->shade = 127;
pNSprite->cstat |= CSTAT_SPRITE_TRANSLUCENT; pNSprite->cstat |= CSTAT_SPRITE_TRANSLUCENT;
pNSprite->xrepeat = pTSprite->xrepeat; pNSprite->xrepeat = pTSprite->xrepeat;
@ -387,7 +387,7 @@ static tspritetype *viewAddEffect(tspritetype* tsprite, int& spritesortcnt, int
pNSprite->pal = 5; pNSprite->pal = 5;
int height = tileHeight(pNSprite->picnum); int height = tileHeight(pNSprite->picnum);
int center = height / 2 + tileTopOffset(pNSprite->picnum); int center = height / 2 + tileTopOffset(pNSprite->picnum);
pNSprite->z -= (pNSprite->yrepeat << 2) * (height - center); pNSprite->pos.Z -= (pNSprite->yrepeat << 2) * (height - center);
} }
break; break;
} }
@ -400,7 +400,7 @@ static tspritetype *viewAddEffect(tspritetype* tsprite, int& spritesortcnt, int
pNSprite->shade = -128; pNSprite->shade = -128;
pNSprite->pal = 2; pNSprite->pal = 2;
pNSprite->cstat |= CSTAT_SPRITE_TRANSLUCENT; pNSprite->cstat |= CSTAT_SPRITE_TRANSLUCENT;
pNSprite->z = pTSprite->z; pNSprite->pos.Z = pTSprite->pos.Z;
pNSprite->xrepeat = pTSprite->xrepeat; pNSprite->xrepeat = pTSprite->xrepeat;
pNSprite->yrepeat = pTSprite->yrepeat; pNSprite->yrepeat = pTSprite->yrepeat;
pNSprite->picnum = 2427; pNSprite->picnum = 2427;
@ -415,9 +415,9 @@ static tspritetype *viewAddEffect(tspritetype* tsprite, int& spritesortcnt, int
sectortype *pSector = pTSprite->sector(); sectortype *pSector = pTSprite->sector();
pNSprite->pos.X = pTSprite->pos.X; pNSprite->pos.X = pTSprite->pos.X;
pNSprite->pos.Y = pTSprite->pos.Y; pNSprite->pos.Y = pTSprite->pos.Y;
pNSprite->z = pSector->ceilingz; pNSprite->pos.Z = pSector->ceilingz;
pNSprite->picnum = 624; pNSprite->picnum = 624;
pNSprite->shade = ((pTSprite->z-pSector->ceilingz)>>8)-64; pNSprite->shade = ((pTSprite->pos.Z-pSector->ceilingz)>>8)-64;
pNSprite->pal = 2; pNSprite->pal = 2;
pNSprite->xrepeat = pNSprite->yrepeat = 64; pNSprite->xrepeat = pNSprite->yrepeat = 64;
pNSprite->cstat |= CSTAT_SPRITE_ONE_SIDE | CSTAT_SPRITE_ALIGNMENT_FLOOR | CSTAT_SPRITE_YFLIP | CSTAT_SPRITE_TRANSLUCENT; pNSprite->cstat |= CSTAT_SPRITE_ONE_SIDE | CSTAT_SPRITE_ALIGNMENT_FLOOR | CSTAT_SPRITE_YFLIP | CSTAT_SPRITE_TRANSLUCENT;
@ -434,9 +434,9 @@ static tspritetype *viewAddEffect(tspritetype* tsprite, int& spritesortcnt, int
sectortype *pSector = pTSprite->sector(); sectortype *pSector = pTSprite->sector();
pNSprite->pos.X = pTSprite->pos.X; pNSprite->pos.X = pTSprite->pos.X;
pNSprite->pos.Y = pTSprite->pos.Y; pNSprite->pos.Y = pTSprite->pos.Y;
pNSprite->z = pSector->floorz; pNSprite->pos.Z = pSector->floorz;
pNSprite->picnum = 624; pNSprite->picnum = 624;
uint8_t nShade = (pSector->floorz-pTSprite->z)>>8; uint8_t nShade = (pSector->floorz-pTSprite->pos.Z)>>8;
pNSprite->shade = nShade-32; pNSprite->shade = nShade-32;
pNSprite->pal = 2; pNSprite->pal = 2;
pNSprite->xrepeat = pNSprite->yrepeat = nShade; pNSprite->xrepeat = pNSprite->yrepeat = nShade;
@ -451,7 +451,7 @@ static tspritetype *viewAddEffect(tspritetype* tsprite, int& spritesortcnt, int
if (!pNSprite) if (!pNSprite)
break; break;
pNSprite->z = pTSprite->z; pNSprite->pos.Z = pTSprite->pos.Z;
if (gDetail > 1) if (gDetail > 1)
pNSprite->cstat |= CSTAT_SPRITE_TRANSLUCENT | CSTAT_SPRITE_TRANS_FLIP; pNSprite->cstat |= CSTAT_SPRITE_TRANSLUCENT | CSTAT_SPRITE_TRANS_FLIP;
pNSprite->shade = ClipLow(pTSprite->shade-32, -128); pNSprite->shade = ClipLow(pTSprite->shade-32, -128);
@ -473,8 +473,8 @@ static tspritetype *viewAddEffect(tspritetype* tsprite, int& spritesortcnt, int
pNSprite->pos.X = pTSprite->pos.X; pNSprite->pos.X = pTSprite->pos.X;
pNSprite->pos.Y = pTSprite->pos.Y; pNSprite->pos.Y = pTSprite->pos.Y;
pNSprite->z = pTSprite->z-(32<<8); pNSprite->pos.Z = pTSprite->pos.Z-(32<<8);
pNSprite->z -= weaponIcon.zOffset<<8; // offset up pNSprite->pos.Z -= weaponIcon.zOffset<<8; // offset up
pNSprite->picnum = nTile; pNSprite->picnum = nTile;
pNSprite->shade = pTSprite->shade; pNSprite->shade = pTSprite->shade;
pNSprite->xrepeat = 32; pNSprite->xrepeat = 32;
@ -811,12 +811,12 @@ void viewProcessSprites(tspritetype* tsprite, int& spritesortcnt, int32_t cX, in
if (pTSprite->type != kMissileFlareRegular) break; if (pTSprite->type != kMissileFlareRegular) break;
sectortype *pSector = pTSprite->sector(); sectortype *pSector = pTSprite->sector();
int zDiff = (pTSprite->z - pSector->ceilingz) >> 8; int zDiff = (pTSprite->pos.Z - pSector->ceilingz) >> 8;
if ((pSector->ceilingstat & CSTAT_SECTOR_SKY) == 0 && zDiff < 64) { if ((pSector->ceilingstat & CSTAT_SECTOR_SKY) == 0 && zDiff < 64) {
viewAddEffect(tsprite, spritesortcnt, nTSprite, kViewEffectCeilGlow); viewAddEffect(tsprite, spritesortcnt, nTSprite, kViewEffectCeilGlow);
} }
zDiff = (pSector->floorz - pTSprite->z) >> 8; zDiff = (pSector->floorz - pTSprite->pos.Z) >> 8;
if ((pSector->floorstat & CSTAT_SECTOR_SKY) == 0 && zDiff < 64) { if ((pSector->floorstat & CSTAT_SECTOR_SKY) == 0 && zDiff < 64) {
viewAddEffect(tsprite, spritesortcnt, nTSprite, kViewEffectFloorGlow); viewAddEffect(tsprite, spritesortcnt, nTSprite, kViewEffectFloorGlow);
} }
@ -865,7 +865,7 @@ void viewProcessSprites(tspritetype* tsprite, int& spritesortcnt, int32_t cX, in
POSTURE *pPosture = &pPlayer->pPosture[pPlayer->lifeMode][pPlayer->posture]; POSTURE *pPosture = &pPlayer->pPosture[pPlayer->lifeMode][pPlayer->posture];
pNTSprite->pos.X += MulScale(pPosture->zOffset, Cos(pTSprite->ang), 28); pNTSprite->pos.X += MulScale(pPosture->zOffset, Cos(pTSprite->ang), 28);
pNTSprite->pos.Y += MulScale(pPosture->zOffset, Sin(pTSprite->ang), 28); pNTSprite->pos.Y += MulScale(pPosture->zOffset, Sin(pTSprite->ang), 28);
pNTSprite->z = pPlayer->pSprite->z-pPosture->xOffset; pNTSprite->pos.Z = pPlayer->pSprite->pos.Z-pPosture->xOffset;
} }
} }

View file

@ -58,7 +58,7 @@ void ambProcess(void)
{ {
int dx = pSprite->pos.X-gMe->pSprite->pos.X; int dx = pSprite->pos.X-gMe->pSprite->pos.X;
int dy = pSprite->pos.Y-gMe->pSprite->pos.Y; int dy = pSprite->pos.Y-gMe->pSprite->pos.Y;
int dz = pSprite->z-gMe->pSprite->z; int dz = pSprite->pos.Z-gMe->pSprite->pos.Z;
dx >>= 4; dx >>= 4;
dy >>= 4; dy >>= 4;
dz >>= 8; dz >>= 8;

View file

@ -105,7 +105,7 @@ void fxFlareSpark(DBloodActor* actor, sectortype*) // 3
{ {
if (!actor) return; if (!actor) return;
spritetype *pSprite = &actor->s(); spritetype *pSprite = &actor->s();
auto pFX = gFX.fxSpawnActor(FX_28, pSprite->sector(), pSprite->pos.X, pSprite->pos.Y, pSprite->z, 0); auto pFX = gFX.fxSpawnActor(FX_28, pSprite->sector(), pSprite->pos.X, pSprite->pos.Y, pSprite->pos.Z, 0);
if (pFX) if (pFX)
{ {
pFX->xvel = actor->xvel + Random2(0x1aaaa); pFX->xvel = actor->xvel + Random2(0x1aaaa);
@ -119,7 +119,7 @@ void fxFlareSparkLite(DBloodActor* actor, sectortype*) // 4
{ {
if (!actor) return; if (!actor) return;
spritetype *pSprite = &actor->s(); spritetype *pSprite = &actor->s();
auto pFX = gFX.fxSpawnActor(FX_28, pSprite->sector(), pSprite->pos.X, pSprite->pos.Y, pSprite->z, 0); auto pFX = gFX.fxSpawnActor(FX_28, pSprite->sector(), pSprite->pos.X, pSprite->pos.Y, pSprite->pos.Z, 0);
if (pFX) if (pFX)
{ {
pFX->xvel = actor->xvel + Random2(0x1aaaa); pFX->xvel = actor->xvel + Random2(0x1aaaa);
@ -161,7 +161,7 @@ void fxBloodSpurt(DBloodActor* actor, sectortype*) // 6
{ {
if (!actor) return; if (!actor) return;
spritetype *pSprite = &actor->s(); spritetype *pSprite = &actor->s();
auto pFX = gFX.fxSpawnActor(FX_27, pSprite->sector(), pSprite->pos.X, pSprite->pos.Y, pSprite->z, 0); auto pFX = gFX.fxSpawnActor(FX_27, pSprite->sector(), pSprite->pos.X, pSprite->pos.Y, pSprite->pos.Z, 0);
if (pFX) if (pFX)
{ {
pFX->spr.ang = 0; pFX->spr.ang = 0;
@ -177,7 +177,7 @@ void fxArcSpark(DBloodActor* actor, sectortype*) // 7
{ {
if (!actor) return; if (!actor) return;
spritetype* pSprite = &actor->s(); spritetype* pSprite = &actor->s();
auto pFX = gFX.fxSpawnActor(FX_15, pSprite->sector(), pSprite->pos.X, pSprite->pos.Y, pSprite->z, 0); auto pFX = gFX.fxSpawnActor(FX_15, pSprite->sector(), pSprite->pos.X, pSprite->pos.Y, pSprite->pos.Z, 0);
if (pFX) if (pFX)
{ {
pFX->xvel = actor->xvel + Random2(0x10000); pFX->xvel = actor->xvel + Random2(0x10000);
@ -197,7 +197,7 @@ void fxDynPuff(DBloodActor* actor, sectortype*) // 8
int nDist = (pSprite->xrepeat*(tileWidth(pSprite->picnum)/2))>>2; int nDist = (pSprite->xrepeat*(tileWidth(pSprite->picnum)/2))>>2;
int x = pSprite->pos.X + MulScale(nDist, Cos(pSprite->ang-512), 30); int x = pSprite->pos.X + MulScale(nDist, Cos(pSprite->ang-512), 30);
int y = pSprite->pos.Y + MulScale(nDist, Sin(pSprite->ang-512), 30); int y = pSprite->pos.Y + MulScale(nDist, Sin(pSprite->ang-512), 30);
int z = pSprite->z; int z = pSprite->pos.Z;
auto pFX = gFX.fxSpawnActor(FX_7, pSprite->sector(), x, y, z, 0); auto pFX = gFX.fxSpawnActor(FX_7, pSprite->sector(), x, y, z, 0);
if (pFX) if (pFX)
{ {
@ -286,7 +286,7 @@ void Respawn(DBloodActor* actor, sectortype*) // 9
pSprite->cstat &= ~CSTAT_SPRITE_INVISIBLE; pSprite->cstat &= ~CSTAT_SPRITE_INVISIBLE;
} }
gFX.fxSpawnActor(FX_29, pSprite->sector(), pSprite->pos.X, pSprite->pos.Y, pSprite->z, 0); gFX.fxSpawnActor(FX_29, pSprite->sector(), pSprite->pos.X, pSprite->pos.Y, pSprite->pos.Z, 0);
sfxPlay3DSound(actor, 350, -1, 0); sfxPlay3DSound(actor, 350, -1, 0);
break; break;
} }
@ -393,12 +393,12 @@ void fxBloodBits(DBloodActor* actor, sectortype*) // 14
GetZRange(actor, &ceilZ, &ceilColl, &floorZ, &floorColl, pSprite->clipdist, CLIPMASK0); GetZRange(actor, &ceilZ, &ceilColl, &floorZ, &floorColl, pSprite->clipdist, CLIPMASK0);
int top, bottom; int top, bottom;
GetSpriteExtents(pSprite, &top, &bottom); GetSpriteExtents(pSprite, &top, &bottom);
pSprite->z += floorZ-bottom; pSprite->pos.Z += floorZ-bottom;
int nAngle = Random(2048); int nAngle = Random(2048);
int nDist = Random(16)<<4; int nDist = Random(16)<<4;
int x = pSprite->pos.X+MulScale(nDist, Cos(nAngle), 28); int x = pSprite->pos.X+MulScale(nDist, Cos(nAngle), 28);
int y = pSprite->pos.Y+MulScale(nDist, Sin(nAngle), 28); int y = pSprite->pos.Y+MulScale(nDist, Sin(nAngle), 28);
gFX.fxSpawnActor(FX_48, pSprite->sector(), x, y, pSprite->z, 0); gFX.fxSpawnActor(FX_48, pSprite->sector(), x, y, pSprite->pos.Z, 0);
if (pSprite->ang == 1024) if (pSprite->ang == 1024)
{ {
int nChannel = 28 + (actor->GetIndex() & 2); // this is a little stupid... int nChannel = 28 + (actor->GetIndex() & 2); // this is a little stupid...
@ -418,7 +418,7 @@ void fxTeslaAlt(DBloodActor* actor, sectortype*) // 15
{ {
if (!actor) return; if (!actor) return;
spritetype* pSprite = &actor->s(); spritetype* pSprite = &actor->s();
auto pFX = gFX.fxSpawnActor(FX_49, pSprite->sector(), pSprite->pos.X, pSprite->pos.Y, pSprite->z, 0); auto pFX = gFX.fxSpawnActor(FX_49, pSprite->sector(), pSprite->pos.X, pSprite->pos.Y, pSprite->pos.Z, 0);
if (pFX) if (pFX)
{ {
pFX->xvel = actor->xvel + Random2(0x1aaaa); pFX->xvel = actor->xvel + Random2(0x1aaaa);
@ -441,7 +441,7 @@ void fxBouncingSleeve(DBloodActor* actor, sectortype*) // 16
GetZRange(actor, &ceilZ, &ceilColl, &floorZ, &floorColl, pSprite->clipdist, CLIPMASK0); GetZRange(actor, &ceilZ, &ceilColl, &floorZ, &floorColl, pSprite->clipdist, CLIPMASK0);
int top, bottom; GetSpriteExtents(pSprite, &top, &bottom); int top, bottom; GetSpriteExtents(pSprite, &top, &bottom);
pSprite->z += floorZ - bottom; pSprite->pos.Z += floorZ - bottom;
int zv = actor->zvel - pSprite->sector()->velFloor; int zv = actor->zvel - pSprite->sector()->velFloor;
@ -527,9 +527,9 @@ void fxPodBloodSpray(DBloodActor* actor, sectortype*) // 18
spritetype* pSprite = &actor->s(); spritetype* pSprite = &actor->s();
DBloodActor* pFX; DBloodActor* pFX;
if (pSprite->type == 53) if (pSprite->type == 53)
pFX = gFX.fxSpawnActor(FX_53, pSprite->sector(), pSprite->pos.X, pSprite->pos.Y, pSprite->z, 0); pFX = gFX.fxSpawnActor(FX_53, pSprite->sector(), pSprite->pos.X, pSprite->pos.Y, pSprite->pos.Z, 0);
else else
pFX = gFX.fxSpawnActor(FX_54, pSprite->sector(), pSprite->pos.X, pSprite->pos.Y, pSprite->z, 0); pFX = gFX.fxSpawnActor(FX_54, pSprite->sector(), pSprite->pos.X, pSprite->pos.Y, pSprite->pos.Z, 0);
if (pFX) if (pFX)
{ {
pFX->spr.ang = 0; pFX->spr.ang = 0;
@ -550,7 +550,7 @@ void fxPodBloodSplat(DBloodActor* actor, sectortype*) // 19
GetZRange(actor, &ceilZ, &ceilColl, &floorZ, &floorColl, pSprite->clipdist, CLIPMASK0); GetZRange(actor, &ceilZ, &ceilColl, &floorZ, &floorColl, pSprite->clipdist, CLIPMASK0);
int top, bottom; int top, bottom;
GetSpriteExtents(pSprite, &top, &bottom); GetSpriteExtents(pSprite, &top, &bottom);
pSprite->z += floorZ-bottom; pSprite->pos.Z += floorZ-bottom;
int nAngle = Random(2048); int nAngle = Random(2048);
int nDist = Random(16)<<4; int nDist = Random(16)<<4;
int x = pSprite->pos.X+MulScale(nDist, Cos(nAngle), 28); int x = pSprite->pos.X+MulScale(nDist, Cos(nAngle), 28);
@ -604,7 +604,7 @@ void sub_76A08(DBloodActor *actor, DBloodActor *actor2, PLAYER *pPlayer) // ???
GetSpriteExtents(pSprite, &top, &bottom); GetSpriteExtents(pSprite, &top, &bottom);
pSprite->pos.X = pSprite2->pos.X; pSprite->pos.X = pSprite2->pos.X;
pSprite->pos.Y = pSprite2->pos.Y; pSprite->pos.Y = pSprite2->pos.Y;
pSprite->z = pSprite2->sector()->floorz-(bottom-pSprite->z); pSprite->pos.Z = pSprite2->sector()->floorz-(bottom-pSprite->pos.Z);
pSprite->ang = pSprite2->ang; pSprite->ang = pSprite2->ang;
ChangeActorSect(actor, pSprite2->sector()); ChangeActorSect(actor, pSprite2->sector());
sfxPlay3DSound(actor2, 201, -1, 0); sfxPlay3DSound(actor2, 201, -1, 0);

View file

@ -523,7 +523,7 @@ void dbLoadMap(const char* pPath, int* pX, int* pY, int* pZ, short* pAngle, sect
pSprite->clear(); pSprite->clear();
pSprite->pos.X = LittleLong(load.x); pSprite->pos.X = LittleLong(load.x);
pSprite->pos.Y = LittleLong(load.y); pSprite->pos.Y = LittleLong(load.y);
pSprite->z = LittleLong(load.z); pSprite->pos.Z = LittleLong(load.z);
pSprite->cstat = ESpriteFlags::FromInt(LittleShort(load.cstat)); pSprite->cstat = ESpriteFlags::FromInt(LittleShort(load.cstat));
pSprite->picnum = LittleShort(load.picnum); pSprite->picnum = LittleShort(load.picnum);
int secno = LittleShort(load.sectnum); int secno = LittleShort(load.sectnum);

View file

@ -85,7 +85,7 @@ extern const char *gWeaponText[];
template<typename T> void GetSpriteExtents(T const * const pSprite, int *top, int *bottom) template<typename T> void GetSpriteExtents(T const * const pSprite, int *top, int *bottom)
{ {
*top = *bottom = pSprite->z; *top = *bottom = pSprite->pos.Z;
if ((pSprite->cstat & CSTAT_SPRITE_ALIGNMENT_MASK) != CSTAT_SPRITE_ALIGNMENT_FLOOR) if ((pSprite->cstat & CSTAT_SPRITE_ALIGNMENT_MASK) != CSTAT_SPRITE_ALIGNMENT_FLOOR)
{ {
int height = tileHeight(pSprite->picnum); int height = tileHeight(pSprite->picnum);

View file

@ -203,9 +203,9 @@ void CFX::fxProcess(void)
actAirDrag(actor, pFXData->drag); actAirDrag(actor, pFXData->drag);
pSprite->pos.X += actor->xvel>>12; pSprite->pos.X += actor->xvel>>12;
pSprite->pos.Y += actor->yvel>>12; pSprite->pos.Y += actor->yvel>>12;
pSprite->z += actor->zvel>>8; pSprite->pos.Z += actor->zvel>>8;
// Weird... // Weird...
if (actor->xvel || (actor->yvel && pSprite->z >= pSprite->sector()->floorz)) if (actor->xvel || (actor->yvel && pSprite->pos.Z >= pSprite->sector()->floorz))
{ {
updatesector(pSprite->pos.X, pSprite->pos.Y, &pSector); updatesector(pSprite->pos.X, pSprite->pos.Y, &pSector);
if (pSector == nullptr) if (pSector == nullptr)
@ -213,7 +213,7 @@ void CFX::fxProcess(void)
remove(actor); remove(actor);
continue; continue;
} }
if (getflorzofslopeptr(pSprite->sector(), pSprite->pos.X, pSprite->pos.Y) <= pSprite->z) if (getflorzofslopeptr(pSprite->sector(), pSprite->pos.X, pSprite->pos.Y) <= pSprite->pos.Z)
{ {
if (pFXData->funcID < 0 || pFXData->funcID >= kCallbackMax) if (pFXData->funcID < 0 || pFXData->funcID >= kCallbackMax)
{ {
@ -233,12 +233,12 @@ void CFX::fxProcess(void)
{ {
int32_t floorZ, ceilZ; int32_t floorZ, ceilZ;
getzsofslopeptr(pSector, pSprite->pos.X, pSprite->pos.Y, &ceilZ, &floorZ); getzsofslopeptr(pSector, pSprite->pos.X, pSprite->pos.Y, &ceilZ, &floorZ);
if (ceilZ > pSprite->z && !(pSector->ceilingstat & CSTAT_SECTOR_SKY)) if (ceilZ > pSprite->pos.Z && !(pSector->ceilingstat & CSTAT_SECTOR_SKY))
{ {
remove(actor); remove(actor);
continue; continue;
} }
if (floorZ < pSprite->z) if (floorZ < pSprite->pos.Z)
{ {
if (pFXData->funcID < 0 || pFXData->funcID >= kCallbackMax) if (pFXData->funcID < 0 || pFXData->funcID >= kCallbackMax)
{ {
@ -259,11 +259,11 @@ void fxSpawnBlood(DBloodActor *actor, int )
if (!pSprite->insector()) if (!pSprite->insector())
return; return;
auto pSector = pSprite->sector(); auto pSector = pSprite->sector();
if (!FindSector(pSprite->pos.X, pSprite->pos.Y, pSprite->z, &pSector)) if (!FindSector(pSprite->pos.X, pSprite->pos.Y, pSprite->pos.Z, &pSector))
return; return;
if (adult_lockout && gGameOptions.nGameType <= 0) if (adult_lockout && gGameOptions.nGameType <= 0)
return; return;
auto bloodactor = gFX.fxSpawnActor(FX_27, pSprite->sector(), pSprite->pos.X, pSprite->pos.Y, pSprite->z, 0); auto bloodactor = gFX.fxSpawnActor(FX_27, pSprite->sector(), pSprite->pos.X, pSprite->pos.Y, pSprite->pos.Z, 0);
if (bloodactor) if (bloodactor)
{ {
bloodactor->spr.ang = 1024; bloodactor->spr.ang = 1024;
@ -280,15 +280,15 @@ void fxSpawnPodStuff(DBloodActor* actor, int )
if (!pSprite->insector()) if (!pSprite->insector())
return; return;
auto pSector = pSprite->sector(); auto pSector = pSprite->sector();
if (!FindSector(pSprite->pos.X, pSprite->pos.Y, pSprite->z, &pSector)) if (!FindSector(pSprite->pos.X, pSprite->pos.Y, pSprite->pos.Z, &pSector))
return; return;
if (adult_lockout && gGameOptions.nGameType <= 0) if (adult_lockout && gGameOptions.nGameType <= 0)
return; return;
DBloodActor *spawnactor; DBloodActor *spawnactor;
if (pSprite->type == kDudePodGreen) if (pSprite->type == kDudePodGreen)
spawnactor = gFX.fxSpawnActor(FX_53, pSprite->sector(), pSprite->pos.X, pSprite->pos.Y, pSprite->z, 0); spawnactor = gFX.fxSpawnActor(FX_53, pSprite->sector(), pSprite->pos.X, pSprite->pos.Y, pSprite->pos.Z, 0);
else else
spawnactor = gFX.fxSpawnActor(FX_54, pSprite->sector(), pSprite->pos.X, pSprite->pos.Y, pSprite->z, 0); spawnactor = gFX.fxSpawnActor(FX_54, pSprite->sector(), pSprite->pos.X, pSprite->pos.Y, pSprite->pos.Z, 0);
if (spawnactor) if (spawnactor)
{ {
spawnactor->spr.ang = 1024; spawnactor->spr.ang = 1024;

View file

@ -112,14 +112,14 @@ bool CheckProximity(DBloodActor *actor, int nX, int nY, int nZ, sectortype* pSec
int oY = abs(nY-pSprite->pos.Y)>>4; int oY = abs(nY-pSprite->pos.Y)>>4;
if (oY >= nDist) return 0; if (oY >= nDist) return 0;
int oZ = abs(nZ-pSprite->z)>>8; int oZ = abs(nZ-pSprite->pos.Z)>>8;
if (oZ >= nDist) return 0; if (oZ >= nDist) return 0;
if (approxDist(oX, oY) >= nDist) return 0; if (approxDist(oX, oY) >= nDist) return 0;
int bottom, top; int bottom, top;
GetActorExtents(actor, &top, &bottom); GetActorExtents(actor, &top, &bottom);
if (cansee(pSprite->pos.X, pSprite->pos.Y, pSprite->z, pSprite->sector(), nX, nY, nZ, pSector)) if (cansee(pSprite->pos.X, pSprite->pos.Y, pSprite->pos.Z, pSprite->sector(), nX, nY, nZ, pSector))
return 1; return 1;
if (cansee(pSprite->pos.X, pSprite->pos.Y, bottom, pSprite->sector(), nX, nY, nZ, pSector)) if (cansee(pSprite->pos.X, pSprite->pos.Y, bottom, pSprite->sector(), nX, nY, nZ, pSector))
return 1; return 1;
@ -387,7 +387,7 @@ int VectorScan(DBloodActor *actor, int nOffset, int nZOffset, int dx, int dy, in
gHitInfo.clearObj(); gHitInfo.clearObj();
int x1 = pSprite->pos.X+MulScale(nOffset, Cos(pSprite->ang+512), 30); int x1 = pSprite->pos.X+MulScale(nOffset, Cos(pSprite->ang+512), 30);
int y1 = pSprite->pos.Y+MulScale(nOffset, Sin(pSprite->ang+512), 30); int y1 = pSprite->pos.Y+MulScale(nOffset, Sin(pSprite->ang+512), 30);
int z1 = pSprite->z+nZOffset; int z1 = pSprite->pos.Z+nZOffset;
auto bakCstat = pSprite->cstat; auto bakCstat = pSprite->cstat;
pSprite->cstat &= ~CSTAT_SPRITE_BLOCK_HITSCAN; pSprite->cstat &= ~CSTAT_SPRITE_BLOCK_HITSCAN;
if (nRange) if (nRange)
@ -419,7 +419,7 @@ int VectorScan(DBloodActor *actor, int nOffset, int nZOffset, int dx, int dy, in
if (tileWidth(nPicnum) == 0 || tileHeight(nPicnum) == 0) if (tileWidth(nPicnum) == 0 || tileHeight(nPicnum) == 0)
return 3; return 3;
int height = (tileHeight(nPicnum)*pOther->yrepeat)<<2; int height = (tileHeight(nPicnum)*pOther->yrepeat)<<2;
int otherZ = pOther->z; int otherZ = pOther->pos.Z;
if (pOther->cstat & CSTAT_SPRITE_YCENTER) if (pOther->cstat & CSTAT_SPRITE_YCENTER)
otherZ += height / 2; otherZ += height / 2;
int nOffset = tileTopOffset(nPicnum); int nOffset = tileTopOffset(nPicnum);
@ -529,7 +529,7 @@ int VectorScan(DBloodActor *actor, int nOffset, int nZOffset, int dx, int dy, in
gHitInfo.clearObj(); gHitInfo.clearObj();
x1 = gHitInfo.hitpos.X + link->spr.pos.X - actor->spr.pos.X; x1 = gHitInfo.hitpos.X + link->spr.pos.X - actor->spr.pos.X;
y1 = gHitInfo.hitpos.Y + link->spr.pos.Y - actor->spr.pos.Y; y1 = gHitInfo.hitpos.Y + link->spr.pos.Y - actor->spr.pos.Y;
z1 = gHitInfo.hitpos.Z + link->spr.z - actor->spr.z; z1 = gHitInfo.hitpos.Z + link->spr.pos.Z - actor->spr.pos.Z;
pos = { x1, y1, z1 }; pos = { x1, y1, z1 };
hitscan(pos, link->spr.sector(), { dx, dy, dz << 4 }, gHitInfo, CLIPMASK1); hitscan(pos, link->spr.sector(), { dx, dy, dz << 4 }, gHitInfo, CLIPMASK1);
@ -543,7 +543,7 @@ int VectorScan(DBloodActor *actor, int nOffset, int nZOffset, int dx, int dy, in
gHitInfo.clearObj(); gHitInfo.clearObj();
x1 = gHitInfo.hitpos.X + link->spr.pos.X - actor->spr.pos.X; x1 = gHitInfo.hitpos.X + link->spr.pos.X - actor->spr.pos.X;
y1 = gHitInfo.hitpos.Y + link->spr.pos.Y - actor->spr.pos.Y; y1 = gHitInfo.hitpos.Y + link->spr.pos.Y - actor->spr.pos.Y;
z1 = gHitInfo.hitpos.Z + link->spr.z - actor->spr.z; z1 = gHitInfo.hitpos.Z + link->spr.pos.Z - actor->spr.pos.Z;
pos = { x1, y1, z1 }; pos = { x1, y1, z1 };
hitscan(pos, link->spr.sector(), { dx, dy, dz << 4 }, gHitInfo, CLIPMASK1); hitscan(pos, link->spr.sector(), { dx, dy, dz << 4 }, gHitInfo, CLIPMASK1);
continue; continue;
@ -580,7 +580,7 @@ void GetZRange(DBloodActor *actor, int *ceilZ, Collision *ceilColl, int *floorZ,
auto link = actor->GetOwner(); auto link = actor->GetOwner();
vec3_t lpos = pSprite->pos + link->spr.pos - actor->spr.pos; vec3_t lpos = pSprite->pos + link->spr.pos - actor->spr.pos;
getzrange(lpos, link->spr.sector(), &nTemp1, scratch, (int32_t*)floorZ, *floorColl, nDist, nMask); getzrange(lpos, link->spr.sector(), &nTemp1, scratch, (int32_t*)floorZ, *floorColl, nDist, nMask);
*floorZ -= link->spr.z - actor->spr.z; *floorZ -= link->spr.pos.Z - actor->spr.pos.Z;
} }
} }
if (ceilColl->type == kHitSector) if (ceilColl->type == kHitSector)
@ -594,7 +594,7 @@ void GetZRange(DBloodActor *actor, int *ceilZ, Collision *ceilColl, int *floorZ,
auto link = actor->GetOwner(); auto link = actor->GetOwner();
vec3_t lpos = pSprite->pos + link->spr.pos - actor->spr.pos; vec3_t lpos = pSprite->pos + link->spr.pos - actor->spr.pos;
getzrange(lpos, link->spr.sector(), (int32_t*)ceilZ, *ceilColl, &nTemp1, scratch, nDist, nMask); getzrange(lpos, link->spr.sector(), (int32_t*)ceilZ, *ceilColl, &nTemp1, scratch, nDist, nMask);
*ceilZ -= link->spr.z - actor->spr.z; *ceilZ -= link->spr.pos.Z - actor->spr.pos.Z;
} }
} }
pSprite->cstat = bakCstat; pSprite->cstat = bakCstat;
@ -622,7 +622,7 @@ void GetZRangeAtXYZ(int x, int y, int z, sectortype* pSector, int *ceilZ, Collis
auto link = actor->GetOwner(); auto link = actor->GetOwner();
vec3_t newpos = lpos + link->spr.pos - actor->spr.pos; vec3_t newpos = lpos + link->spr.pos - actor->spr.pos;
getzrange(newpos, link->spr.sector(), &nTemp1, scratch, (int32_t*)floorZ, *floorColl, nDist, nMask); getzrange(newpos, link->spr.sector(), &nTemp1, scratch, (int32_t*)floorZ, *floorColl, nDist, nMask);
*floorZ -= link->spr.z - actor->spr.z; *floorZ -= link->spr.pos.Z - actor->spr.pos.Z;
} }
} }
if (ceilColl->type == kHitSector) if (ceilColl->type == kHitSector)
@ -636,7 +636,7 @@ void GetZRangeAtXYZ(int x, int y, int z, sectortype* pSector, int *ceilZ, Collis
auto link = actor->GetOwner(); auto link = actor->GetOwner();
vec3_t newpos = lpos + link->spr.pos - actor->spr.pos; vec3_t newpos = lpos + link->spr.pos - actor->spr.pos;
getzrange(newpos, link->spr.sector(), (int32_t*)ceilZ, *ceilColl, &nTemp1, scratch, nDist, nMask); getzrange(newpos, link->spr.sector(), (int32_t*)ceilZ, *ceilColl, &nTemp1, scratch, nDist, nMask);
*ceilZ -= link->spr.z - actor->spr.z; *ceilZ -= link->spr.pos.Z - actor->spr.pos.Z;
} }
} }
} }

View file

@ -269,7 +269,7 @@ void GibFX(DBloodActor* actor, GIBFX *pGFX, CGibPosition *pPos, CGibVelocity *pV
auto pSector = pSprite->sector(); auto pSector = pSprite->sector();
if (adult_lockout && gGameOptions.nGameType == 0 && pGFX->fxId == FX_13) if (adult_lockout && gGameOptions.nGameType == 0 && pGFX->fxId == FX_13)
return; return;
CGibPosition gPos(pSprite->pos.X, pSprite->pos.Y, pSprite->z); CGibPosition gPos(pSprite->pos.X, pSprite->pos.Y, pSprite->pos.Z);
if (pPos) if (pPos)
gPos = *pPos; gPos = *pPos;
int32_t ceilZ, floorZ; int32_t ceilZ, floorZ;

View file

@ -127,7 +127,7 @@ void InitMirrors(void)
mirror[mirrorcnt].type = 2; mirror[mirrorcnt].type = 2;
mirror[mirrorcnt].dx = link2->spr.pos.X - link->spr.pos.X; mirror[mirrorcnt].dx = link2->spr.pos.X - link->spr.pos.X;
mirror[mirrorcnt].dy = link2->spr.pos.Y - link->spr.pos.Y; mirror[mirrorcnt].dy = link2->spr.pos.Y - link->spr.pos.Y;
mirror[mirrorcnt].dz = link2->spr.z - link->spr.z; mirror[mirrorcnt].dz = link2->spr.pos.Z - link->spr.pos.Z;
mirror[mirrorcnt].wallnum = i; mirror[mirrorcnt].wallnum = i;
mirror[mirrorcnt].link = j; mirror[mirrorcnt].link = j;
secti->floorpicnum = 4080 + mirrorcnt; secti->floorpicnum = 4080 + mirrorcnt;
@ -137,7 +137,7 @@ void InitMirrors(void)
mirror[mirrorcnt].type = 1; mirror[mirrorcnt].type = 1;
mirror[mirrorcnt].dx = link->spr.pos.X - link2->spr.pos.X; mirror[mirrorcnt].dx = link->spr.pos.X - link2->spr.pos.X;
mirror[mirrorcnt].dy = link->spr.pos.Y - link2->spr.pos.Y; mirror[mirrorcnt].dy = link->spr.pos.Y - link2->spr.pos.Y;
mirror[mirrorcnt].dz = link->spr.z - link2->spr.z; mirror[mirrorcnt].dz = link->spr.pos.Z - link2->spr.pos.Z;
mirror[mirrorcnt].wallnum = j; mirror[mirrorcnt].wallnum = j;
mirror[mirrorcnt].link = i; mirror[mirrorcnt].link = i;
sectj->ceilingpicnum = 4080 + mirrorcnt; sectj->ceilingpicnum = 4080 + mirrorcnt;

View file

@ -267,7 +267,7 @@ static DBloodActor* nnExtSpawnDude(DBloodActor* sourceActor, DBloodActor* origin
XSPRITE* pXDude = &pDudeActor->x(); XSPRITE* pXDude = &pDudeActor->x();
int angle = pOrigin->ang; int angle = pOrigin->ang;
int x, y, z = a4 + pOrigin->z; int x, y, z = a4 + pOrigin->pos.Z;
if (a3 < 0) if (a3 < 0)
{ {
x = pOrigin->pos.X; x = pOrigin->pos.X;
@ -728,8 +728,8 @@ void nnExtInitModernStuff(TArray<DBloodActor*>& actors)
// very quick fix for floor sprites with Touch trigger flag if their Z is equals sector floorz / ceilgz // very quick fix for floor sprites with Touch trigger flag if their Z is equals sector floorz / ceilgz
if (pSprite->insector() && pXSprite->Touch && (pSprite->cstat & CSTAT_SPRITE_ALIGNMENT_FLOOR)) { if (pSprite->insector() && pXSprite->Touch && (pSprite->cstat & CSTAT_SPRITE_ALIGNMENT_FLOOR)) {
if (pSprite->z == pSprite->sector()->floorz) pSprite->z--; if (pSprite->pos.Z == pSprite->sector()->floorz) pSprite->pos.Z--;
else if (pSprite->z == pSprite->sector()->ceilingz) pSprite->z++; else if (pSprite->pos.Z == pSprite->sector()->ceilingz) pSprite->pos.Z++;
} }
// make Proximity flag work not just for dudes and things... // make Proximity flag work not just for dudes and things...
@ -970,7 +970,7 @@ static DBloodActor* randomDropPickupObject(DBloodActor* sourceactor, int prevIte
pXSource->dropMsg = uint8_t(pSprite2->type); // store dropped item type in dropMsg pXSource->dropMsg = uint8_t(pSprite2->type); // store dropped item type in dropMsg
pSprite2->pos.X = pSource->pos.X; pSprite2->pos.X = pSource->pos.X;
pSprite2->pos.Y = pSource->pos.Y; pSprite2->pos.Y = pSource->pos.Y;
pSprite2->z = pSource->z; pSprite2->pos.Z = pSource->pos.Z;
if ((pSource->flags & kModernTypeFlag1) && (pXSource->txID > 0 || (pXSource->txID != 3 && pXSource->lockMsg > 0))) if ((pSource->flags & kModernTypeFlag1) && (pXSource->txID > 0 || (pXSource->txID != 3 && pXSource->lockMsg > 0)))
{ {
@ -1025,7 +1025,7 @@ static void windGenDoVerticalWind(int factor, sectortype* pSector)
auto sp = &actor->s(); auto sp = &actor->s();
if (sp->type == kMarkerOn && sp->statnum != kStatMarker) if (sp->type == kMarkerOn && sp->statnum != kStatMarker)
{ {
maxZ = sp->z; maxZ = sp->pos.Z;
maxZfound = true; maxZfound = true;
break; break;
} }
@ -1051,9 +1051,9 @@ static void windGenDoVerticalWind(int factor, sectortype* pSector)
continue; continue;
} }
if (maxZfound && pSpr->z <= maxZ) if (maxZfound && pSpr->pos.Z <= maxZ)
{ {
zdiff = pSpr->z - maxZ; zdiff = pSpr->pos.Z - maxZ;
if (actor->zvel < 0) actor->zvel += MulScale(actor->zvel >> 4, zdiff, 16); if (actor->zvel < 0) actor->zvel += MulScale(actor->zvel >> 4, zdiff, 16);
continue; continue;
@ -1063,7 +1063,7 @@ static void windGenDoVerticalWind(int factor, sectortype* pSector)
if (actor->zvel >= 0) actor->zvel += val; if (actor->zvel >= 0) actor->zvel += val;
else actor->zvel = val; else actor->zvel = val;
pSpr->z += actor->zvel >> 12; pSpr->pos.Z += actor->zvel >> 12;
} }
@ -1180,7 +1180,7 @@ void nnExtProcessSuperSprites()
int okDist = (pProx->IsDudeActor()) ? 96 : ClipLow(pProxSpr->clipdist * 3, 32); int okDist = (pProx->IsDudeActor()) ? 96 : ClipLow(pProxSpr->clipdist * 3, 32);
int x = pProxSpr->pos.X; int x = pProxSpr->pos.X;
int y = pProxSpr->pos.Y; int y = pProxSpr->pos.Y;
int z = pProxSpr->z; int z = pProxSpr->pos.Z;
auto pSect = pProxSpr->sector(); auto pSect = pProxSpr->sector();
if (!pXProxSpr->DudeLockout) if (!pXProxSpr->DudeLockout)
@ -1238,7 +1238,7 @@ void nnExtProcessSuperSprites()
int x = pSightSpr->pos.X; int x = pSightSpr->pos.X;
int y = pSightSpr->pos.Y; int y = pSightSpr->pos.Y;
int z = pSightSpr->z; int z = pSightSpr->pos.Z;
auto pSightSect = pSightSpr->sector(); auto pSightSect = pSightSpr->sector();
int ztop2, zbot2; int ztop2, zbot2;
@ -1384,8 +1384,8 @@ void nnExtProcessSuperSprites()
int fz = getflorzofslopeptr(pSector, pDebris->pos.X, pDebris->pos.Y); int fz = getflorzofslopeptr(pSector, pDebris->pos.X, pDebris->pos.Y);
GetActorExtents(debrisactor, &top, &bottom); GetActorExtents(debrisactor, &top, &bottom);
if (fz >= bottom && pSector->lowerLink == nullptr && !(pSector->ceilingstat & CSTAT_SECTOR_SKY)) pDebris->z += ClipLow(cz - top, 0); if (fz >= bottom && pSector->lowerLink == nullptr && !(pSector->ceilingstat & CSTAT_SECTOR_SKY)) pDebris->pos.Z += ClipLow(cz - top, 0);
if (cz <= top && pSector->upperLink == nullptr && !(pSector->floorstat & CSTAT_SECTOR_SKY)) pDebris->z += ClipHigh(fz - bottom, 0); if (cz <= top && pSector->upperLink == nullptr && !(pSector->floorstat & CSTAT_SECTOR_SKY)) pDebris->pos.Z += ClipHigh(fz - bottom, 0);
} }
} }
} }
@ -1587,7 +1587,7 @@ void debrisConcuss(DBloodActor* owneractor, int listIndex, int x, int y, int z,
if (actor != nullptr && actor->hasX()) if (actor != nullptr && actor->hasX())
{ {
spritetype* pSprite = &actor->s(); spritetype* pSprite = &actor->s();
int dx = pSprite->pos.X - x; int dy = pSprite->pos.Y - y; int dz = (pSprite->z - z) >> 4; int dx = pSprite->pos.X - x; int dy = pSprite->pos.Y - y; int dz = (pSprite->pos.Z - z) >> 4;
dmg = scale(0x40000, dmg, 0x40000 + dx * dx + dy * dy + dz * dz); dmg = scale(0x40000, dmg, 0x40000 + dx * dx + dy * dy + dz * dz);
bool thing = (pSprite->type >= kThingBase && pSprite->type < kThingMax); bool thing = (pSprite->type >= kThingBase && pSprite->type < kThingMax);
int size = (tileWidth(pSprite->picnum) * pSprite->xrepeat * tileHeight(pSprite->picnum) * pSprite->yrepeat) >> 1; int size = (tileWidth(pSprite->picnum) * pSprite->xrepeat * tileHeight(pSprite->picnum) * pSprite->yrepeat) >> 1;
@ -1669,8 +1669,8 @@ void debrisMove(int listIndex)
Collision moveHit; Collision moveHit;
moveHit.setNone(); moveHit.setNone();
int floorDist = (bottom - pSprite->z) >> 2; int floorDist = (bottom - pSprite->pos.Z) >> 2;
int ceilDist = (pSprite->z - top) >> 2; int ceilDist = (pSprite->pos.Z - top) >> 2;
int clipDist = pSprite->clipdist << 2; int clipDist = pSprite->clipdist << 2;
int mass = actor->spriteMass.mass; int mass = actor->spriteMass.mass;
@ -1713,7 +1713,7 @@ void debrisMove(int listIndex)
} }
} }
else if (!FindSector(pSprite->pos.X, pSprite->pos.Y, pSprite->z, &pSector)) else if (!FindSector(pSprite->pos.X, pSprite->pos.Y, pSprite->pos.Z, &pSector))
{ {
return; return;
} }
@ -1729,7 +1729,7 @@ void debrisMove(int listIndex)
uwater = pSector->xs().Underwater; uwater = pSector->xs().Underwater;
if (actor->zvel) if (actor->zvel)
pSprite->z += actor->zvel >> 8; pSprite->pos.Z += actor->zvel >> 8;
int ceilZ, floorZ; int ceilZ, floorZ;
Collision ceilColl, floorColl; Collision ceilColl, floorColl;
@ -1752,14 +1752,14 @@ void debrisMove(int listIndex)
if (vc) if (vc)
{ {
pSprite->z += ((vc << 2) >> 1) >> 8; pSprite->pos.Z += ((vc << 2) >> 1) >> 8;
actor->zvel += vc; actor->zvel += vc;
} }
} }
else if ((pXSprite->physAttr & kPhysGravity) && bottom < floorZ) else if ((pXSprite->physAttr & kPhysGravity) && bottom < floorZ)
{ {
pSprite->z += 455; pSprite->pos.Z += 455;
actor->zvel += 58254; actor->zvel += 58254;
} }
@ -1821,7 +1821,7 @@ void debrisMove(int listIndex)
if ((pFX = gFX.fxSpawnActor(FX_10, pSprite->sector(), pSprite->pos.X, pSprite->pos.Y, floorZ, 0)) == NULL) break; if ((pFX = gFX.fxSpawnActor(FX_10, pSprite->sector(), pSprite->pos.X, pSprite->pos.Y, floorZ, 0)) == NULL) break;
for (i = 0; i < 7; i++) for (i = 0; i < 7; i++)
{ {
if ((pFX2 = gFX.fxSpawnActor(FX_14, pFX->spr.sector(), pFX->spr.pos.X, pFX->spr.pos.Y, pFX->spr.z, 0)) == NULL) continue; if ((pFX2 = gFX.fxSpawnActor(FX_14, pFX->spr.sector(), pFX->spr.pos.X, pFX->spr.pos.Y, pFX->spr.pos.Z, 0)) == NULL) continue;
pFX2->xvel = Random2(0x6aaaa); pFX2->xvel = Random2(0x6aaaa);
pFX2->yvel = Random2(0x6aaaa); pFX2->yvel = Random2(0x6aaaa);
pFX2->zvel = -(int)Random(0xd5555); pFX2->zvel = -(int)Random(0xd5555);
@ -1848,7 +1848,7 @@ void debrisMove(int listIndex)
if (top <= ceilZ) if (top <= ceilZ)
{ {
actor->hit.ceilhit = moveHit = ceilColl; actor->hit.ceilhit = moveHit = ceilColl;
pSprite->z += ClipLow(ceilZ - top, 0); pSprite->pos.Z += ClipLow(ceilZ - top, 0);
if (actor->zvel <= 0 && (pXSprite->physAttr & kPhysFalling)) if (actor->zvel <= 0 && (pXSprite->physAttr & kPhysFalling))
actor->zvel = MulScale(-actor->zvel, 0x2000, 16); actor->zvel = MulScale(-actor->zvel, 0x2000, 16);
@ -3003,7 +3003,7 @@ void useTeleportTarget(DBloodActor* sourceactor, DBloodActor* actor)
pSprite->pos.X = pSource->pos.X; pSprite->pos.Y = pSource->pos.Y; pSprite->pos.X = pSource->pos.X; pSprite->pos.Y = pSource->pos.Y;
int zTop, zBot; int zTop, zBot;
GetActorExtents(sourceactor, &zTop, &zBot); GetActorExtents(sourceactor, &zTop, &zBot);
pSprite->z = zBot; pSprite->pos.Z = zBot;
clampSprite(actor, 0x01); clampSprite(actor, 0x01);
@ -3152,7 +3152,7 @@ void useEffectGen(DBloodActor* sourceactor, DBloodActor* actor)
pos = bottom; pos = bottom;
break; break;
case 2: // middle case 2: // middle
pos = pSprite->z + (tileHeight(pSprite->picnum) / 2 + tileTopOffset(pSprite->picnum)); pos = pSprite->pos.Z + (tileHeight(pSprite->picnum) / 2 + tileTopOffset(pSprite->picnum));
break; break;
case 3: case 3:
case 4: case 4:
@ -3587,21 +3587,21 @@ void useSeqSpawnerGen(DBloodActor* sourceactor, int objType, sectortype* pSector
switch (pXSource->data3) switch (pXSource->data3)
{ {
default: default:
pSpawned->z = pSprite->z; pSpawned->pos.Z = pSprite->pos.Z;
break; break;
case 2: case 2:
pSpawned->z = bottom; pSpawned->pos.Z = bottom;
break; break;
case 3: case 3:
pSpawned->z = top; pSpawned->pos.Z = top;
break; break;
case 4: case 4:
pSpawned->z = pSprite->z + tileHeight(pSprite->picnum) / 2 + tileTopOffset(pSprite->picnum); pSpawned->pos.Z = pSprite->pos.Z + tileHeight(pSprite->picnum) / 2 + tileTopOffset(pSprite->picnum);
break; break;
case 5: case 5:
case 6: case 6:
if (!pSprite->insector()) pSpawned->z = top; if (!pSprite->insector()) pSpawned->pos.Z = top;
else pSpawned->z = (pXSource->data3 == 5) ? spawned->sector()->floorz : spawned->sector()->ceilingz; else pSpawned->pos.Z = (pXSource->data3 == 5) ? spawned->sector()->floorz : spawned->sector()->ceilingz;
break; break;
} }
@ -4277,7 +4277,7 @@ bool condCheckDude(DBloodActor* aCond, int cmpOp, bool PUSH)
break; break;
case 3: case 3:
case 4: case 4:
var = cansee(pSpr->pos.X, pSpr->pos.Y, pSpr->z, pSpr->sector(), pTrgt->pos.X, pTrgt->pos.Y, pTrgt->z - eyeAboveZ, pTrgt->sector()); var = cansee(pSpr->pos.X, pSpr->pos.Y, pSpr->pos.Z, pSpr->sector(), pTrgt->pos.X, pTrgt->pos.Y, pTrgt->pos.Z - eyeAboveZ, pTrgt->sector());
if (cond == 4 && var > 0) if (cond == 4 && var > 0)
{ {
var = ((1024 + getangle(dx, dy) - pSpr->ang) & 2047) - 1024; var = ((1024 + getangle(dx, dy) - pSpr->ang) & 2047) - 1024;
@ -4460,15 +4460,15 @@ bool condCheckSprite(DBloodActor* aCond, int cmpOp, bool PUSH)
if ((pPlayer = getPlayerById(pSpr->type)) != NULL) if ((pPlayer = getPlayerById(pSpr->type)) != NULL)
var = HitScan(objActor, pPlayer->zWeapon, pPlayer->aim.dx, pPlayer->aim.dy, pPlayer->aim.dz, arg1, arg3 << 1); var = HitScan(objActor, pPlayer->zWeapon, pPlayer->aim.dx, pPlayer->aim.dy, pPlayer->aim.dz, arg1, arg3 << 1);
else if (objActor->IsDudeActor()) else if (objActor->IsDudeActor())
var = HitScan(objActor, pSpr->z, bcos(pSpr->ang), bsin(pSpr->ang), (!objActor->hasX()) ? 0 : objActor->dudeSlope, arg1, arg3 << 1); var = HitScan(objActor, pSpr->pos.Z, bcos(pSpr->ang), bsin(pSpr->ang), (!objActor->hasX()) ? 0 : objActor->dudeSlope, arg1, arg3 << 1);
else if ((var2 & CSTAT_SPRITE_ALIGNMENT_MASK) == CSTAT_SPRITE_ALIGNMENT_FLOOR) else if ((var2 & CSTAT_SPRITE_ALIGNMENT_MASK) == CSTAT_SPRITE_ALIGNMENT_FLOOR)
{ {
var3 = (var2 & 0x0008) ? 0x10000 << 1 : -(0x10000 << 1); var3 = (var2 & 0x0008) ? 0x10000 << 1 : -(0x10000 << 1);
var = HitScan(objActor, pSpr->z, Cos(pSpr->ang) >> 16, Sin(pSpr->ang) >> 16, var3, arg1, arg3 << 1); var = HitScan(objActor, pSpr->pos.Z, Cos(pSpr->ang) >> 16, Sin(pSpr->ang) >> 16, var3, arg1, arg3 << 1);
} }
else else
{ {
var = HitScan(objActor, pSpr->z, bcos(pSpr->ang), bsin(pSpr->ang), 0, arg1, arg3 << 1); var = HitScan(objActor, pSpr->pos.Z, bcos(pSpr->ang), bsin(pSpr->ang), 0, arg1, arg3 << 1);
} }
if (var >= 0) if (var >= 0)
@ -4986,7 +4986,7 @@ bool aiFightDudeCanSeeTarget(DBloodActor* dudeactor, DUDEINFO* pDudeInfo, DBlood
int eyeAboveZ = pDudeInfo->eyeHeight * pDude->yrepeat << 2; int eyeAboveZ = pDudeInfo->eyeHeight * pDude->yrepeat << 2;
// is there a line of sight to the target? // is there a line of sight to the target?
if (cansee(pDude->pos.X, pDude->pos.Y, pDude->z, pDude->sector(), pTarget->pos.X, pTarget->pos.Y, pTarget->z - eyeAboveZ, pTarget->sector())) if (cansee(pDude->pos.X, pDude->pos.Y, pDude->pos.Z, pDude->sector(), pTarget->pos.X, pTarget->pos.Y, pTarget->pos.Z - eyeAboveZ, pTarget->sector()))
{ {
/*int nAngle = getangle(dx, dy); /*int nAngle = getangle(dx, dy);
int losAngle = ((1024 + nAngle - pDude->ang) & 2047) - 1024; int losAngle = ((1024 + nAngle - pDude->ang) & 2047) - 1024;
@ -5034,7 +5034,7 @@ void aiFightFreeTargets(DBloodActor* actor)
{ {
if (!targetactor->IsDudeActor() || !targetactor->hasX()) continue; if (!targetactor->IsDudeActor() || !targetactor->hasX()) continue;
else if (targetactor->GetTarget() == actor) else if (targetactor->GetTarget() == actor)
aiSetTarget(targetactor, targetactor->spr.pos.X, targetactor->spr.pos.Y, targetactor->spr.z); aiSetTarget(targetactor, targetactor->spr.pos.X, targetactor->spr.pos.Y, targetactor->spr.pos.Z);
} }
} }
@ -5143,7 +5143,7 @@ void aiFightAlarmDudesInSight(DBloodActor* actor, int max)
continue; continue;
auto pDude = &dudeactor->s(); auto pDude = &dudeactor->s();
aiSetTarget(dudeactor, pDude->pos.X, pDude->pos.Y, pDude->z); aiSetTarget(dudeactor, pDude->pos.X, pDude->pos.Y, pDude->pos.Z);
aiActivateDude(dudeactor); aiActivateDude(dudeactor);
if (max-- < 1) if (max-- < 1)
break; break;
@ -6242,9 +6242,9 @@ void useRandomItemGen(DBloodActor* actor)
while (auto iactor = it.Next()) while (auto iactor = it.Next())
{ {
spritetype* pItem = &iactor->s(); spritetype* pItem = &iactor->s();
if ((unsigned int)pItem->type == pXSource->dropMsg && pItem->pos.X == pSource->pos.X && pItem->pos.Y == pSource->pos.Y && pItem->z == pSource->z) if ((unsigned int)pItem->type == pXSource->dropMsg && pItem->pos.X == pSource->pos.X && pItem->pos.Y == pSource->pos.Y && pItem->pos.Z == pSource->pos.Z)
{ {
gFX.fxSpawnActor((FX_ID)29, pSource->sector(), pSource->pos.X, pSource->pos.Y, pSource->z, 0); gFX.fxSpawnActor((FX_ID)29, pSource->sector(), pSource->pos.X, pSource->pos.Y, pSource->pos.Z, 0);
pItem->type = kSpriteDecoration; pItem->type = kSpriteDecoration;
actPostSprite(iactor, kStatFree); actPostSprite(iactor, kStatFree);
break; break;
@ -6481,7 +6481,7 @@ void sprite2sectorSlope(DBloodActor* actor, sectortype* pSector, char rel, bool
} }
spriteSetSlope(pSprite, slope); spriteSetSlope(pSprite, slope);
if (forcez) pSprite->z = z; if (forcez) pSprite->pos.Z = z;
} }
//--------------------------------------------------------------------------- //---------------------------------------------------------------------------
@ -6522,7 +6522,7 @@ void useSlopeChanger(DBloodActor* sourceactor, int objType, sectortype* pSect, D
{ {
auto spr = &iactor->s(); auto spr = &iactor->s();
if (!(spr->cstat & CSTAT_SPRITE_ALIGNMENT_FLOOR)) continue; if (!(spr->cstat & CSTAT_SPRITE_ALIGNMENT_FLOOR)) continue;
else if (getflorzofslopeptr(pSect, spr->pos.X, spr->pos.Y) - kSlopeDist <= spr->z) else if (getflorzofslopeptr(pSect, spr->pos.X, spr->pos.Y) - kSlopeDist <= spr->pos.Z)
{ {
sprite2sectorSlope(iactor, pSect, 0, true); sprite2sectorSlope(iactor, pSect, 0, true);
@ -6559,7 +6559,7 @@ void useSlopeChanger(DBloodActor* sourceactor, int objType, sectortype* pSect, D
{ {
auto spr = &iactor->s(); auto spr = &iactor->s();
if (!(spr->cstat & CSTAT_SPRITE_ALIGNMENT_FLOOR)) continue; if (!(spr->cstat & CSTAT_SPRITE_ALIGNMENT_FLOOR)) continue;
else if (getceilzofslopeptr(pSect, spr->pos.X, spr->pos.Y) + kSlopeDist >= spr->z) else if (getceilzofslopeptr(pSect, spr->pos.X, spr->pos.Y) + kSlopeDist >= spr->pos.Z)
{ {
sprite2sectorSlope(iactor, pSect, 1, true); sprite2sectorSlope(iactor, pSect, 1, true);
@ -6617,8 +6617,8 @@ void useSlopeChanger(DBloodActor* sourceactor, int objType, sectortype* pSect, D
case 1: sprite2sectorSlope(objActor, pSpr->sector(), 0, flag2); break; case 1: sprite2sectorSlope(objActor, pSpr->sector(), 0, flag2); break;
case 2: sprite2sectorSlope(objActor, pSpr->sector(), 1, flag2); break; case 2: sprite2sectorSlope(objActor, pSpr->sector(), 1, flag2); break;
case 3: case 3:
if (getflorzofslopeptr(pSpr->sector(), pSpr->pos.X, pSpr->pos.Y) - kSlopeDist <= pSpr->z) sprite2sectorSlope(objActor, pSpr->sector(), 0, flag2); if (getflorzofslopeptr(pSpr->sector(), pSpr->pos.X, pSpr->pos.Y) - kSlopeDist <= pSpr->pos.Z) sprite2sectorSlope(objActor, pSpr->sector(), 0, flag2);
if (getceilzofslopeptr(pSpr->sector(), pSpr->pos.X, pSpr->pos.Y) + kSlopeDist >= pSpr->z) sprite2sectorSlope(objActor, pSpr->sector(), 1, flag2); if (getceilzofslopeptr(pSpr->sector(), pSpr->pos.X, pSpr->pos.Y) + kSlopeDist >= pSpr->pos.Z) sprite2sectorSlope(objActor, pSpr->sector(), 1, flag2);
break; break;
} }
break; break;
@ -6779,14 +6779,14 @@ void useTargetChanger(DBloodActor* sourceactor, DBloodActor* actor)
auto actLeech = leechIsDropped(actor); auto actLeech = leechIsDropped(actor);
if (pXSource->data4 == 3) if (pXSource->data4 == 3)
{ {
aiSetTarget(actor, pSprite->pos.X, pSprite->pos.Y, pSprite->z); aiSetTarget(actor, pSprite->pos.X, pSprite->pos.Y, pSprite->pos.Z);
aiSetGenIdleState(actor); aiSetGenIdleState(actor);
if (pSprite->type == kDudeModernCustom && actLeech) if (pSprite->type == kDudeModernCustom && actLeech)
removeLeech(actLeech); removeLeech(actLeech);
} }
else if (pXSource->data4 == 4) else if (pXSource->data4 == 4)
{ {
aiSetTarget(actor, pPlayer->pos.X, pPlayer->pos.Y, pPlayer->z); aiSetTarget(actor, pPlayer->pos.X, pPlayer->pos.Y, pPlayer->pos.Z);
if (pSprite->type == kDudeModernCustom && actLeech) if (pSprite->type == kDudeModernCustom && actLeech)
removeLeech(actLeech); removeLeech(actLeech);
} }
@ -6806,7 +6806,7 @@ void useTargetChanger(DBloodActor* sourceactor, DBloodActor* actor)
if (!targetactor->IsDudeActor() || pXTarget->health < 1 || !aiFightDudeCanSeeTarget(actor, pDudeInfo, targetactor)) if (!targetactor->IsDudeActor() || pXTarget->health < 1 || !aiFightDudeCanSeeTarget(actor, pDudeInfo, targetactor))
{ {
aiSetTarget(actor, pSprite->pos.X, pSprite->pos.Y, pSprite->z); aiSetTarget(actor, pSprite->pos.X, pSprite->pos.Y, pSprite->pos.Z);
} }
// dude attack or attacked by target that does not fit by data id? // dude attack or attacked by target that does not fit by data id?
else if (pXSource->data1 != 666 && pXTarget->data1 != pXSource->data1) else if (pXSource->data1 != 666 && pXTarget->data1 != pXSource->data1)
@ -6814,7 +6814,7 @@ void useTargetChanger(DBloodActor* sourceactor, DBloodActor* actor)
if (aiFightDudeIsAffected(targetactor)) if (aiFightDudeIsAffected(targetactor))
{ {
// force stop attack target // force stop attack target
aiSetTarget(actor, pSprite->pos.X, pSprite->pos.Y, pSprite->z); aiSetTarget(actor, pSprite->pos.X, pSprite->pos.Y, pSprite->pos.Z);
if (actor->GetBurnSource() == targetactor) if (actor->GetBurnSource() == targetactor)
{ {
pXSprite->burnTime = 0; pXSprite->burnTime = 0;
@ -6822,7 +6822,7 @@ void useTargetChanger(DBloodActor* sourceactor, DBloodActor* actor)
} }
// force stop attack dude // force stop attack dude
aiSetTarget(targetactor, pTarget->pos.X, pTarget->pos.Y, pTarget->z); aiSetTarget(targetactor, pTarget->pos.X, pTarget->pos.Y, pTarget->pos.Z);
if (targetactor->GetBurnSource() == actor) if (targetactor->GetBurnSource() == actor)
{ {
pXTarget->burnTime = 0; pXTarget->burnTime = 0;
@ -6850,7 +6850,7 @@ void useTargetChanger(DBloodActor* sourceactor, DBloodActor* actor)
// force mate stop attack dude, if he does // force mate stop attack dude, if he does
if (matetarget == actor) if (matetarget == actor)
{ {
aiSetTarget(mateactor, pMate->pos.X, pMate->pos.Y, pMate->z); aiSetTarget(mateactor, pMate->pos.X, pMate->pos.Y, pMate->pos.Z);
} }
else if (pXSprite->rxID != matetarget->x().rxID) else if (pXSprite->rxID != matetarget->x().rxID)
{ {
@ -6861,13 +6861,13 @@ void useTargetChanger(DBloodActor* sourceactor, DBloodActor* actor)
else else
{ {
// force mate to stop attack another mate // force mate to stop attack another mate
aiSetTarget(mateactor, pMate->pos.X, pMate->pos.Y, pMate->z); aiSetTarget(mateactor, pMate->pos.X, pMate->pos.Y, pMate->pos.Z);
} }
} }
// force dude stop attack mate, if target was not changed previously // force dude stop attack mate, if target was not changed previously
if (actor == mateactor) if (actor == mateactor)
aiSetTarget(actor, pSprite->pos.X, pSprite->pos.Y, pSprite->z); aiSetTarget(actor, pSprite->pos.X, pSprite->pos.Y, pSprite->pos.Z);
} }
@ -6894,7 +6894,7 @@ void useTargetChanger(DBloodActor* sourceactor, DBloodActor* actor)
// Make prev target not aim in dude // Make prev target not aim in dude
if (targetactor) if (targetactor)
{ {
aiSetTarget(targetactor, targetactor->spr.pos.X, targetactor->spr.pos.Y, targetactor->spr.z); aiSetTarget(targetactor, targetactor->spr.pos.X, targetactor->spr.pos.Y, targetactor->spr.pos.Z);
if (!isActive(newtargactor)) if (!isActive(newtargactor))
aiActivateDude(newtargactor); aiActivateDude(newtargactor);
} }
@ -6993,7 +6993,7 @@ void useTargetChanger(DBloodActor* sourceactor, DBloodActor* actor)
spritetype* pMate = &pMateTargetActor->GetTarget()->s(); spritetype* pMate = &pMateTargetActor->GetTarget()->s();
pXSprite->targetX = pMate->pos.X; pXSprite->targetX = pMate->pos.X;
pXSprite->targetY = pMate->pos.Y; pXSprite->targetY = pMate->pos.Y;
pXSprite->targetZ = pMate->z; pXSprite->targetZ = pMate->pos.Z;
if (!isActive(actor)) if (!isActive(actor))
aiActivateDude(actor); aiActivateDude(actor);
return; return;
@ -7484,7 +7484,7 @@ bool setDataValueOfObject(int objType, sectortype* sect, walltype* wal, DBloodAc
bool nnExtCanMove(DBloodActor* actor, DBloodActor* target, int nAngle, int nRange) bool nnExtCanMove(DBloodActor* actor, DBloodActor* target, int nAngle, int nRange)
{ {
auto pSprite = &actor->s(); auto pSprite = &actor->s();
int x = pSprite->pos.X, y = pSprite->pos.Y, z = pSprite->z; int x = pSprite->pos.X, y = pSprite->pos.Y, z = pSprite->pos.Z;
auto pSector = pSprite->sector(); auto pSector = pSprite->sector();
HitScan(actor, z, Cos(nAngle) >> 16, Sin(nAngle) >> 16, 0, CLIPMASK0, nRange); HitScan(actor, z, Cos(nAngle) >> 16, Sin(nAngle) >> 16, 0, CLIPMASK0, nRange);
int nDist = approxDist(x - gHitInfo.hitpos.X, y - gHitInfo.hitpos.Y); int nDist = approxDist(x - gHitInfo.hitpos.X, y - gHitInfo.hitpos.Y);
@ -7996,7 +7996,7 @@ void aiPatrolMove(DBloodActor* actor)
int dx = (pTarget->pos.X - pSprite->pos.X); int dx = (pTarget->pos.X - pSprite->pos.X);
int dy = (pTarget->pos.Y - pSprite->pos.Y); int dy = (pTarget->pos.Y - pSprite->pos.Y);
int dz = (pTarget->z - (pSprite->z - pDudeInfo->eyeHeight)) * 6; int dz = (pTarget->pos.Z - (pSprite->pos.Z - pDudeInfo->eyeHeight)) * 6;
int vel = (pXSprite->unused1 & kDudeFlagCrouch) ? kMaxPatrolCrouchVelocity : kMaxPatrolVelocity; int vel = (pXSprite->unused1 & kDudeFlagCrouch) ? kMaxPatrolCrouchVelocity : kMaxPatrolVelocity;
int goalAng = 341; int goalAng = 341;
@ -8078,10 +8078,10 @@ void aiPatrolAlarmLite(DBloodActor* actor, DBloodActor* targetactor)
int eaz2 = (getDudeInfo(pTarget->type)->eyeHeight * pTarget->yrepeat) << 2; int eaz2 = (getDudeInfo(pTarget->type)->eyeHeight * pTarget->yrepeat) << 2;
int nDist = approxDist(pDude->pos.X - pSprite->pos.X, pDude->pos.Y - pSprite->pos.Y); int nDist = approxDist(pDude->pos.X - pSprite->pos.X, pDude->pos.Y - pSprite->pos.Y);
if (nDist >= kPatrolAlarmSeeDist || !cansee(pSprite->pos.X, pSprite->pos.Y, zt1, pSprite->sector(), pDude->pos.X, pDude->pos.Y, pDude->z - eaz2, pDude->sector())) if (nDist >= kPatrolAlarmSeeDist || !cansee(pSprite->pos.X, pSprite->pos.Y, zt1, pSprite->sector(), pDude->pos.X, pDude->pos.Y, pDude->pos.Z - eaz2, pDude->sector()))
{ {
nDist = approxDist(pDude->pos.X - pTarget->pos.X, pDude->pos.Y - pTarget->pos.Y); nDist = approxDist(pDude->pos.X - pTarget->pos.X, pDude->pos.Y - pTarget->pos.Y);
if (nDist >= kPatrolAlarmSeeDist || !cansee(pTarget->pos.X, pTarget->pos.Y, zt2, pTarget->sector(), pDude->pos.X, pDude->pos.Y, pDude->z - eaz2, pDude->sector())) if (nDist >= kPatrolAlarmSeeDist || !cansee(pTarget->pos.X, pTarget->pos.Y, zt2, pTarget->sector(), pDude->pos.X, pDude->pos.Y, pDude->pos.Z - eaz2, pDude->sector()))
continue; continue;
} }
@ -8113,7 +8113,7 @@ void aiPatrolAlarmFull(DBloodActor* actor, DBloodActor* targetactor, bool chain)
return; return;
int eaz2 = (getDudeInfo(pSprite->type)->eyeHeight * pSprite->yrepeat) << 2; int eaz2 = (getDudeInfo(pSprite->type)->eyeHeight * pSprite->yrepeat) << 2;
int x2 = pSprite->pos.X, y2 = pSprite->pos.Y, z2 = pSprite->z - eaz2; int x2 = pSprite->pos.X, y2 = pSprite->pos.Y, z2 = pSprite->pos.Z - eaz2;
auto pSect2 = pSprite->sector(); auto pSect2 = pSprite->sector();
@ -8135,7 +8135,7 @@ void aiPatrolAlarmFull(DBloodActor* actor, DBloodActor* targetactor, bool chain)
continue; continue;
int eaz1 = (getDudeInfo(pDude->type)->eyeHeight * pDude->yrepeat) << 2; int eaz1 = (getDudeInfo(pDude->type)->eyeHeight * pDude->yrepeat) << 2;
int x1 = pDude->pos.X, y1 = pDude->pos.Y, z1 = pDude->z - eaz1; int x1 = pDude->pos.X, y1 = pDude->pos.Y, z1 = pDude->pos.Z - eaz1;
auto pSect1 = pDude->sector(); auto pSect1 = pDude->sector();
@ -8152,7 +8152,7 @@ void aiPatrolAlarmFull(DBloodActor* actor, DBloodActor* targetactor, bool chain)
continue; continue;
if (actor->GetTarget() ) aiSetTarget(dudeactor, actor->GetTarget()); if (actor->GetTarget() ) aiSetTarget(dudeactor, actor->GetTarget());
else aiSetTarget(dudeactor, pSprite->pos.X, pSprite->pos.Y, pSprite->z); else aiSetTarget(dudeactor, pSprite->pos.X, pSprite->pos.Y, pSprite->pos.Z);
aiActivateDude(dudeactor); aiActivateDude(dudeactor);
if (chain) if (chain)
@ -8264,7 +8264,7 @@ DBloodActor* aiPatrolSearchTargets(DBloodActor* actor)
newtarget = nullptr; newtarget = nullptr;
seeChance = hearChance = 0x0000; seeChance = hearChance = 0x0000;
x = pSpr->pos.X, y = pSpr->pos.Y, z = pSpr->z, dx = x - pSprite->pos.X, dy = y - pSprite->pos.Y; nDist = approxDist(dx, dy); x = pSpr->pos.X, y = pSpr->pos.Y, z = pSpr->pos.Z, dx = x - pSprite->pos.X, dy = y - pSprite->pos.Y; nDist = approxDist(dx, dy);
seeDist = (stealth) ? pDudeInfo->seeDist / 3 : pDudeInfo->seeDist >> 1; seeDist = (stealth) ? pDudeInfo->seeDist / 3 : pDudeInfo->seeDist >> 1;
hearDist = pDudeInfo->hearDist; feelDist = hearDist >> 1; hearDist = pDudeInfo->hearDist; feelDist = hearDist >> 1;
@ -8275,7 +8275,7 @@ DBloodActor* aiPatrolSearchTargets(DBloodActor* actor)
{ {
eyeAboveZ = (pDudeInfo->eyeHeight * pSprite->yrepeat) << 2; eyeAboveZ = (pDudeInfo->eyeHeight * pSprite->yrepeat) << 2;
if (nDist < seeDist >> 3) GetActorExtents(pPlayer->actor, &z, &j); //use ztop of the target sprite if (nDist < seeDist >> 3) GetActorExtents(pPlayer->actor, &z, &j); //use ztop of the target sprite
if (!cansee(x, y, z, pSpr->sector(), pSprite->pos.X, pSprite->pos.Y, pSprite->z - eyeAboveZ, pSprite->sector())) if (!cansee(x, y, z, pSpr->sector(), pSprite->pos.X, pSprite->pos.Y, pSprite->pos.Z - eyeAboveZ, pSprite->sector()))
continue; continue;
} }
else else
@ -9109,9 +9109,9 @@ void clampSprite(DBloodActor* actor, int which)
{ {
GetSpriteExtents(pSprite, &zTop, &zBot); GetSpriteExtents(pSprite, &zTop, &zBot);
if (which & 0x01) if (which & 0x01)
pSprite->z += ClipHigh(getflorzofslopeptr(pSprite->sector(), pSprite->pos.X, pSprite->pos.Y) - zBot, 0); pSprite->pos.Z += ClipHigh(getflorzofslopeptr(pSprite->sector(), pSprite->pos.X, pSprite->pos.Y) - zBot, 0);
if (which & 0x02) if (which & 0x02)
pSprite->z += ClipLow(getceilzofslopeptr(pSprite->sector(), pSprite->pos.X, pSprite->pos.Y) - zTop, 0); pSprite->pos.Z += ClipLow(getceilzofslopeptr(pSprite->sector(), pSprite->pos.X, pSprite->pos.Y) - zTop, 0);
} }

View file

@ -591,15 +591,15 @@ void playerSetGodMode(PLAYER *pPlayer, bool bGodMode)
void playerResetInertia(PLAYER *pPlayer) void playerResetInertia(PLAYER *pPlayer)
{ {
POSTURE *pPosture = &pPlayer->pPosture[pPlayer->lifeMode][pPlayer->posture]; POSTURE *pPosture = &pPlayer->pPosture[pPlayer->lifeMode][pPlayer->posture];
pPlayer->zView = pPlayer->pSprite->z-pPosture->eyeAboveZ; pPlayer->zView = pPlayer->pSprite->pos.Z-pPosture->eyeAboveZ;
pPlayer->zWeapon = pPlayer->pSprite->z-pPosture->weaponAboveZ; pPlayer->zWeapon = pPlayer->pSprite->pos.Z-pPosture->weaponAboveZ;
viewBackupView(pPlayer->nPlayer); viewBackupView(pPlayer->nPlayer);
} }
void playerCorrectInertia(PLAYER* pPlayer, vec3_t const *oldpos) void playerCorrectInertia(PLAYER* pPlayer, vec3_t const *oldpos)
{ {
pPlayer->zView += pPlayer->pSprite->z-oldpos->Z; pPlayer->zView += pPlayer->pSprite->pos.Z-oldpos->Z;
pPlayer->zWeapon += pPlayer->pSprite->z-oldpos->Z; pPlayer->zWeapon += pPlayer->pSprite->pos.Z-oldpos->Z;
viewCorrectViewOffsets(pPlayer->nPlayer, oldpos); viewCorrectViewOffsets(pPlayer->nPlayer, oldpos);
} }
@ -674,7 +674,7 @@ void playerStart(int nPlayer, int bNewLevel)
actor->spr.cstat2 |= CSTAT2_SPRITE_MAPPED; actor->spr.cstat2 |= CSTAT2_SPRITE_MAPPED;
int top, bottom; int top, bottom;
GetSpriteExtents(pSprite, &top, &bottom); GetSpriteExtents(pSprite, &top, &bottom);
pSprite->z -= bottom - pSprite->z; pSprite->pos.Z -= bottom - pSprite->pos.Z;
pSprite->pal = 11+(pPlayer->teamId&3); pSprite->pal = 11+(pPlayer->teamId&3);
pSprite->ang = pStartZone->ang; pSprite->ang = pStartZone->ang;
pPlayer->angle.ang = buildang(pSprite->ang); pPlayer->angle.ang = buildang(pSprite->ang);
@ -1091,7 +1091,7 @@ bool PickupItem(PLAYER *pPlayer, DBloodActor* itemactor)
return 1; return 1;
} }
sfxPlay3DSound(pSprite->pos.X, pSprite->pos.Y, pSprite->z, pickupSnd, pSprite->sector()); sfxPlay3DSound(pSprite->pos.X, pSprite->pos.Y, pSprite->pos.Z, pickupSnd, pSprite->sector());
return 1; return 1;
} }
@ -1204,7 +1204,7 @@ void CheckPickUp(PLAYER *pPlayer)
spritetype *pSprite = pPlayer->pSprite; spritetype *pSprite = pPlayer->pSprite;
int x = pSprite->pos.X; int x = pSprite->pos.X;
int y = pSprite->pos.Y; int y = pSprite->pos.Y;
int z = pSprite->z; int z = pSprite->pos.Z;
auto pSector = pSprite->sector(); auto pSector = pSprite->sector();
BloodStatIterator it(kStatItem); BloodStatIterator it(kStatItem);
while (auto itemactor = it.Next()) while (auto itemactor = it.Next())
@ -1221,16 +1221,16 @@ void CheckPickUp(PLAYER *pPlayer)
int top, bottom; int top, bottom;
GetSpriteExtents(pSprite, &top, &bottom); GetSpriteExtents(pSprite, &top, &bottom);
int vb = 0; int vb = 0;
if (pItem->z < top) if (pItem->pos.Z < top)
vb = (top-pItem->z)>>8; vb = (top-pItem->pos.Z)>>8;
else if (pItem->z > bottom) else if (pItem->pos.Z > bottom)
vb = (pItem->z-bottom)>>8; vb = (pItem->pos.Z-bottom)>>8;
if (vb > 32) if (vb > 32)
continue; continue;
if (approxDist(dx,dy) > 48) if (approxDist(dx,dy) > 48)
continue; continue;
GetSpriteExtents(pItem, &top, &bottom); GetSpriteExtents(pItem, &top, &bottom);
if (cansee(x, y, z, pSector, pItem->pos.X, pItem->pos.Y, pItem->z, pItem->sector()) if (cansee(x, y, z, pSector, pItem->pos.X, pItem->pos.Y, pItem->pos.Z, pItem->sector())
|| cansee(x, y, z, pSector, pItem->pos.X, pItem->pos.Y, top, pItem->sector()) || cansee(x, y, z, pSector, pItem->pos.X, pItem->pos.Y, top, pItem->sector())
|| cansee(x, y, z, pSector, pItem->pos.X, pItem->pos.Y, bottom, pItem->sector())) || cansee(x, y, z, pSector, pItem->pos.X, pItem->pos.Y, bottom, pItem->sector()))
PickUp(pPlayer, itemactor); PickUp(pPlayer, itemactor);
@ -1668,8 +1668,8 @@ void playerProcess(PLAYER *pPlayer)
powerupProcess(pPlayer); powerupProcess(pPlayer);
int top, bottom; int top, bottom;
GetSpriteExtents(pSprite, &top, &bottom); GetSpriteExtents(pSprite, &top, &bottom);
int dzb = (bottom-pSprite->z)/4; int dzb = (bottom-pSprite->pos.Z)/4;
int dzt = (pSprite->z-top)/4; int dzt = (pSprite->pos.Z-top)/4;
int dw = pSprite->clipdist<<2; int dw = pSprite->clipdist<<2;
if (!gNoClip) if (!gNoClip)
{ {
@ -1690,14 +1690,14 @@ void playerProcess(PLAYER *pPlayer)
ProcessInput(pPlayer); ProcessInput(pPlayer);
int nSpeed = approxDist(actor->xvel, actor->yvel); int nSpeed = approxDist(actor->xvel, actor->yvel);
pPlayer->zViewVel = interpolatedvalue(pPlayer->zViewVel, actor->zvel, 0x7000); pPlayer->zViewVel = interpolatedvalue(pPlayer->zViewVel, actor->zvel, 0x7000);
int dz = pPlayer->pSprite->z-pPosture->eyeAboveZ-pPlayer->zView; int dz = pPlayer->pSprite->pos.Z-pPosture->eyeAboveZ-pPlayer->zView;
if (dz > 0) if (dz > 0)
pPlayer->zViewVel += MulScale(dz<<8, 0xa000, 16); pPlayer->zViewVel += MulScale(dz<<8, 0xa000, 16);
else else
pPlayer->zViewVel += MulScale(dz<<8, 0x1800, 16); pPlayer->zViewVel += MulScale(dz<<8, 0x1800, 16);
pPlayer->zView += pPlayer->zViewVel>>8; pPlayer->zView += pPlayer->zViewVel>>8;
pPlayer->zWeaponVel = interpolatedvalue(pPlayer->zWeaponVel, actor->zvel, 0x5000); pPlayer->zWeaponVel = interpolatedvalue(pPlayer->zWeaponVel, actor->zvel, 0x5000);
dz = pPlayer->pSprite->z-pPosture->weaponAboveZ-pPlayer->zWeapon; dz = pPlayer->pSprite->pos.Z-pPosture->weaponAboveZ-pPlayer->zWeapon;
if (dz > 0) if (dz > 0)
pPlayer->zWeaponVel += MulScale(dz<<8, 0x8000, 16); pPlayer->zWeaponVel += MulScale(dz<<8, 0x8000, 16);
else else
@ -1786,13 +1786,13 @@ void playerProcess(PLAYER *pPlayer)
DBloodActor* playerFireMissile(PLAYER *pPlayer, int a2, int a3, int a4, int a5, int a6) DBloodActor* playerFireMissile(PLAYER *pPlayer, int a2, int a3, int a4, int a5, int a6)
{ {
return actFireMissile(pPlayer->actor, a2, pPlayer->zWeapon-pPlayer->pSprite->z, a3, a4, a5, a6); return actFireMissile(pPlayer->actor, a2, pPlayer->zWeapon-pPlayer->pSprite->pos.Z, a3, a4, a5, a6);
} }
DBloodActor* playerFireThing(PLAYER *pPlayer, int a2, int a3, int thingType, int a5) DBloodActor* playerFireThing(PLAYER *pPlayer, int a2, int a3, int thingType, int a5)
{ {
assert(thingType >= kThingBase && thingType < kThingMax); assert(thingType >= kThingBase && thingType < kThingMax);
return actFireThing(pPlayer->actor, a2, pPlayer->zWeapon-pPlayer->pSprite->z, pPlayer->slope+a3, thingType, a5); return actFireThing(pPlayer->actor, a2, pPlayer->zWeapon-pPlayer->pSprite->pos.Z, pPlayer->slope+a3, thingType, a5);
} }
void playerFrag(PLAYER *pKiller, PLAYER *pVictim) void playerFrag(PLAYER *pKiller, PLAYER *pVictim)
@ -2107,7 +2107,7 @@ void voodooTarget(PLAYER *pPlayer)
{ {
DBloodActor* actor = pPlayer->actor; DBloodActor* actor = pPlayer->actor;
int v4 = pPlayer->aim.dz; int v4 = pPlayer->aim.dz;
int dz = pPlayer->zWeapon-pPlayer->pSprite->z; int dz = pPlayer->zWeapon-pPlayer->pSprite->pos.Z;
if (UseAmmo(pPlayer, 9, 0) < 8) if (UseAmmo(pPlayer, 9, 0) < 8)
{ {
pPlayer->voodooTargets = 0; pPlayer->voodooTargets = 0;

View file

@ -221,10 +221,10 @@ void LifeLeechOperate(DBloodActor* actor, EVENT event)
GetSpriteExtents(pSprite, &top, &bottom); GetSpriteExtents(pSprite, &top, &bottom);
int nType = pTarget->type-kDudeBase; int nType = pTarget->type-kDudeBase;
DUDEINFO *pDudeInfo = getDudeInfo(nType+kDudeBase); DUDEINFO *pDudeInfo = getDudeInfo(nType+kDudeBase);
int z1 = (top-pSprite->z)-256; int z1 = (top-pSprite->pos.Z)-256;
int x = pTarget->pos.X; int x = pTarget->pos.X;
int y = pTarget->pos.Y; int y = pTarget->pos.Y;
int z = pTarget->z; int z = pTarget->pos.Z;
int nDist = approxDist(x - pSprite->pos.X, y - pSprite->pos.Y); int nDist = approxDist(x - pSprite->pos.X, y - pSprite->pos.Y);
if (nDist != 0 && cansee(pSprite->pos.X, pSprite->pos.Y, top, pSprite->sector(), x, y, z, pTarget->sector())) if (nDist != 0 && cansee(pSprite->pos.X, pSprite->pos.Y, top, pSprite->sector(), x, y, z, pTarget->sector()))
{ {
@ -235,7 +235,7 @@ void LifeLeechOperate(DBloodActor* actor, EVENT event)
pSprite->ang = getangle(x-pSprite->pos.X, y-pSprite->pos.Y); pSprite->ang = getangle(x-pSprite->pos.X, y-pSprite->pos.Y);
int dx = bcos(pSprite->ang); int dx = bcos(pSprite->ang);
int dy = bsin(pSprite->ang); int dy = bsin(pSprite->ang);
int tz = pTarget->z - (pTarget->yrepeat * pDudeInfo->aimHeight) * 4; int tz = pTarget->pos.Z - (pTarget->yrepeat * pDudeInfo->aimHeight) * 4;
int dz = DivScale(tz - top - 256, nDist, 10); int dz = DivScale(tz - top - 256, nDist, 10);
int nMissileType = kMissileLifeLeechAltNormal + (pXSprite->data3 ? 1 : 0); int nMissileType = kMissileLifeLeechAltNormal + (pXSprite->data3 ? 1 : 0);
int t2; int t2;
@ -477,7 +477,7 @@ void OperateSprite(DBloodActor* actor, EVENT event)
spritetype *pPlayerSprite = gPlayer[p].pSprite; spritetype *pPlayerSprite = gPlayer[p].pSprite;
int dx = (pSprite->pos.X - pPlayerSprite->pos.X)>>4; int dx = (pSprite->pos.X - pPlayerSprite->pos.X)>>4;
int dy = (pSprite->pos.Y - pPlayerSprite->pos.Y)>>4; int dy = (pSprite->pos.Y - pPlayerSprite->pos.Y)>>4;
int dz = (pSprite->z - pPlayerSprite->z)>>8; int dz = (pSprite->pos.Z - pPlayerSprite->pos.Z)>>8;
int nDist = dx*dx+dy*dy+dz*dz+0x40000; int nDist = dx*dx+dy*dy+dz*dz+0x40000;
gPlayer[p].quakeEffect = DivScale(pXSprite->data1, nDist, 16); gPlayer[p].quakeEffect = DivScale(pXSprite->data1, nDist, 16);
} }
@ -932,14 +932,14 @@ void ZTranslateSector(sectortype* pSector, XSECTOR *pXSector, int a3, int a4)
if (pSprite->cstat & CSTAT_SPRITE_MOVE_FORWARD) if (pSprite->cstat & CSTAT_SPRITE_MOVE_FORWARD)
{ {
viewBackupSpriteLoc(actor); viewBackupSpriteLoc(actor);
pSprite->z += pSector->floorz-oldZ; pSprite->pos.Z += pSector->floorz-oldZ;
} }
else if (pSprite->flags&2) else if (pSprite->flags&2)
pSprite->flags |= 4; pSprite->flags |= 4;
else if (oldZ <= bottom && !(pSprite->cstat & CSTAT_SPRITE_ALIGNMENT_MASK)) else if (oldZ <= bottom && !(pSprite->cstat & CSTAT_SPRITE_ALIGNMENT_MASK))
{ {
viewBackupSpriteLoc(actor); viewBackupSpriteLoc(actor);
pSprite->z += pSector->floorz-oldZ; pSprite->pos.Z += pSector->floorz-oldZ;
} }
} }
} }
@ -959,7 +959,7 @@ void ZTranslateSector(sectortype* pSector, XSECTOR *pXSector, int a3, int a4)
if (pSprite->cstat & CSTAT_SPRITE_MOVE_REVERSE) if (pSprite->cstat & CSTAT_SPRITE_MOVE_REVERSE)
{ {
viewBackupSpriteLoc(actor); viewBackupSpriteLoc(actor);
pSprite->z += pSector->ceilingz-oldZ; pSprite->pos.Z += pSector->ceilingz-oldZ;
} }
} }
} }
@ -978,9 +978,9 @@ DBloodActor* GetHighestSprite(sectortype* pSector, int nStatus, int *z)
{ {
int top, bottom; int top, bottom;
GetSpriteExtents(pSprite, &top, &bottom); GetSpriteExtents(pSprite, &top, &bottom);
if (top-pSprite->z > *z) if (top-pSprite->pos.Z > *z)
{ {
*z = top-pSprite->z; *z = top-pSprite->pos.Z;
found = actor; found = actor;
} }
} }
@ -1071,7 +1071,7 @@ int VSpriteBusy(sectortype* pSector, unsigned int a2)
if (pSprite->cstat & CSTAT_SPRITE_MOVE_FORWARD) if (pSprite->cstat & CSTAT_SPRITE_MOVE_FORWARD)
{ {
viewBackupSpriteLoc(actor); viewBackupSpriteLoc(actor);
pSprite->z = actor->basePoint.Z+MulScale(dz1, GetWaveValue(a2, nWave), 16); pSprite->pos.Z = actor->basePoint.Z+MulScale(dz1, GetWaveValue(a2, nWave), 16);
} }
} }
} }
@ -1085,7 +1085,7 @@ int VSpriteBusy(sectortype* pSector, unsigned int a2)
if (pSprite->cstat & CSTAT_SPRITE_MOVE_REVERSE) if (pSprite->cstat & CSTAT_SPRITE_MOVE_REVERSE)
{ {
viewBackupSpriteLoc(actor); viewBackupSpriteLoc(actor);
pSprite->z = actor->basePoint.Z + MulScale(dz2, GetWaveValue(a2, nWave), 16); pSprite->pos.Z = actor->basePoint.Z + MulScale(dz2, GetWaveValue(a2, nWave), 16);
} }
} }
} }
@ -1413,7 +1413,7 @@ void OperateTeleport(sectortype* pSector)
} }
pSprite->pos.X = pDest->pos.X; pSprite->pos.X = pDest->pos.X;
pSprite->pos.Y = pDest->pos.Y; pSprite->pos.Y = pDest->pos.Y;
pSprite->z += pDest->sector()->floorz - pSector->floorz; pSprite->pos.Z += pDest->sector()->floorz - pSector->floorz;
pSprite->ang = pDest->ang; pSprite->ang = pDest->ang;
ChangeActorSect(actor, pDest->sector()); ChangeActorSect(actor, pDest->sector());
sfxPlay3DSound(destactor, 201, -1, 0); sfxPlay3DSound(destactor, 201, -1, 0);
@ -1469,8 +1469,8 @@ void OperatePath(sectortype* pSector, EVENT event)
} }
pXSector->marker1 = actor; pXSector->marker1 = actor;
pXSector->offFloorZ = pSprite2->z; pXSector->offFloorZ = pSprite2->pos.Z;
pXSector->onFloorZ = pSprite->z; pXSector->onFloorZ = pSprite->pos.Z;
switch (event.cmd) { switch (event.cmd) {
case kCmdOn: case kCmdOn:
pXSector->state = 0; pXSector->state = 0;
@ -1840,7 +1840,7 @@ void ProcessMotion(void)
if (pSprite->cstat & CSTAT_SPRITE_MOVE_MASK) if (pSprite->cstat & CSTAT_SPRITE_MOVE_MASK)
{ {
viewBackupSpriteLoc(actor); viewBackupSpriteLoc(actor);
pSprite->z += vdi; pSprite->pos.Z += vdi;
} }
} }
if (pXSector->bobFloor) if (pXSector->bobFloor)
@ -1862,7 +1862,7 @@ void ProcessMotion(void)
if (bottom >= floorZ && (pSprite->cstat & CSTAT_SPRITE_ALIGNMENT_MASK) == 0) if (bottom >= floorZ && (pSprite->cstat & CSTAT_SPRITE_ALIGNMENT_MASK) == 0)
{ {
viewBackupSpriteLoc(actor); viewBackupSpriteLoc(actor);
pSprite->z += vdi; pSprite->pos.Z += vdi;
} }
} }
} }
@ -1882,7 +1882,7 @@ void ProcessMotion(void)
if (top <= ceilZ && (pSprite->cstat & CSTAT_SPRITE_ALIGNMENT_MASK) == 0) if (top <= ceilZ && (pSprite->cstat & CSTAT_SPRITE_ALIGNMENT_MASK) == 0)
{ {
viewBackupSpriteLoc(actor); viewBackupSpriteLoc(actor);
pSprite->z += vdi; pSprite->pos.Z += vdi;
} }
} }
} }

View file

@ -84,7 +84,7 @@ void viewCorrectViewOffsets(int nPlayer, vec3_t const *oldpos)
VIEW *pView = &gPrevView[nPlayer]; VIEW *pView = &gPrevView[nPlayer];
pView->x += pPlayer->pSprite->pos.X-oldpos->X; pView->x += pPlayer->pSprite->pos.X-oldpos->X;
pView->y += pPlayer->pSprite->pos.Y-oldpos->Y; pView->y += pPlayer->pSprite->pos.Y-oldpos->Y;
pView->viewz += pPlayer->pSprite->z-oldpos->Z; pView->viewz += pPlayer->pSprite->pos.Z-oldpos->Z;
} }
void viewDrawText(FFont* pFont, const char *pString, int x, int y, int nShade, int nPalette, int position, bool shadow) void viewDrawText(FFont* pFont, const char *pString, int x, int y, int nShade, int nPalette, int position, bool shadow)
@ -749,7 +749,7 @@ FString GameInterface::GetCoordString()
FString out; FString out;
out.Format("pos= %d, %d, %d - angle = %2.3f", out.Format("pos= %d, %d, %d - angle = %2.3f",
gMe->pSprite->pos.X, gMe->pSprite->pos.Y, gMe->pSprite->z, gMe->pSprite->ang * BAngToDegree); gMe->pSprite->pos.X, gMe->pSprite->pos.Y, gMe->pSprite->pos.Z, gMe->pSprite->ang * BAngToDegree);
return out; return out;
} }

View file

@ -75,7 +75,7 @@ void warpInit(TArray<DBloodActor*>& actors)
ZONE *pZone = &gStartZone[pXSprite->data1]; ZONE *pZone = &gStartZone[pXSprite->data1];
pZone->x = pSprite->pos.X; pZone->x = pSprite->pos.X;
pZone->y = pSprite->pos.Y; pZone->y = pSprite->pos.Y;
pZone->z = pSprite->z; pZone->z = pSprite->pos.Z;
pZone->sector = pSprite->sector(); pZone->sector = pSprite->sector();
pZone->ang = pSprite->ang; pZone->ang = pSprite->ang;
} }
@ -88,7 +88,7 @@ void warpInit(TArray<DBloodActor*>& actors)
ZONE* pZone = &gStartZone[pXSprite->data1]; ZONE* pZone = &gStartZone[pXSprite->data1];
pZone->x = pSprite->pos.X; pZone->x = pSprite->pos.X;
pZone->y = pSprite->pos.Y; pZone->y = pSprite->pos.Y;
pZone->z = pSprite->z; pZone->z = pSprite->pos.Z;
pZone->sector = pSprite->sector(); pZone->sector = pSprite->sector();
pZone->ang = pSprite->ang; pZone->ang = pSprite->ang;
@ -99,7 +99,7 @@ void warpInit(TArray<DBloodActor*>& actors)
pZone = &gStartZoneTeam1[team1]; pZone = &gStartZoneTeam1[team1];
pZone->x = pSprite->pos.X; pZone->x = pSprite->pos.X;
pZone->y = pSprite->pos.Y; pZone->y = pSprite->pos.Y;
pZone->z = pSprite->z; pZone->z = pSprite->pos.Z;
pZone->sector = pSprite->sector(); pZone->sector = pSprite->sector();
pZone->ang = pSprite->ang; pZone->ang = pSprite->ang;
team1++; team1++;
@ -108,7 +108,7 @@ void warpInit(TArray<DBloodActor*>& actors)
pZone = &gStartZoneTeam2[team2]; pZone = &gStartZoneTeam2[team2];
pZone->x = pSprite->pos.X; pZone->x = pSprite->pos.X;
pZone->y = pSprite->pos.Y; pZone->y = pSprite->pos.Y;
pZone->z = pSprite->z; pZone->z = pSprite->pos.Z;
pZone->sector = pSprite->sector(); pZone->sector = pSprite->sector();
pZone->ang = pSprite->ang; pZone->ang = pSprite->ang;
team2++; team2++;
@ -136,7 +136,7 @@ void warpInit(TArray<DBloodActor*>& actors)
pSprite->sector()->upperLink = actor; pSprite->sector()->upperLink = actor;
pSprite->cstat |= CSTAT_SPRITE_INVISIBLE; pSprite->cstat |= CSTAT_SPRITE_INVISIBLE;
pSprite->cstat &= ~CSTAT_SPRITE_BLOCK_ALL; pSprite->cstat &= ~CSTAT_SPRITE_BLOCK_ALL;
pSprite->z = getflorzofslopeptr(pSprite->sector(), pSprite->pos.X, pSprite->pos.Y); pSprite->pos.Z = getflorzofslopeptr(pSprite->sector(), pSprite->pos.X, pSprite->pos.Y);
break; break;
case kMarkerLowWater: case kMarkerLowWater:
case kMarkerLowStack: case kMarkerLowStack:
@ -144,7 +144,7 @@ void warpInit(TArray<DBloodActor*>& actors)
pSprite->sector()->lowerLink = actor; pSprite->sector()->lowerLink = actor;
pSprite->cstat |= CSTAT_SPRITE_INVISIBLE; pSprite->cstat |= CSTAT_SPRITE_INVISIBLE;
pSprite->cstat &= ~CSTAT_SPRITE_BLOCK_ALL; pSprite->cstat &= ~CSTAT_SPRITE_BLOCK_ALL;
pSprite->z = getceilzofslopeptr(pSprite->sector(), pSprite->pos.X, pSprite->pos.Y); pSprite->pos.Z = getceilzofslopeptr(pSprite->sector(), pSprite->pos.X, pSprite->pos.Y);
break; break;
} }
} }
@ -199,10 +199,10 @@ int CheckLink(DBloodActor *actor)
spritetype* pUpper = &aUpper->s(); spritetype* pUpper = &aUpper->s();
int z; int z;
if (pUpper->type == kMarkerUpLink) if (pUpper->type == kMarkerUpLink)
z = pUpper->z; z = pUpper->pos.Z;
else else
z = getflorzofslopeptr(pSprite->sector(), pSprite->pos.X, pSprite->pos.Y); z = getflorzofslopeptr(pSprite->sector(), pSprite->pos.X, pSprite->pos.Y);
if (z <= pSprite->z) if (z <= pSprite->pos.Z)
{ {
aLower = aUpper->GetOwner(); aLower = aUpper->GetOwner();
assert(aLower); assert(aLower);
@ -213,10 +213,10 @@ int CheckLink(DBloodActor *actor)
pSprite->pos.Y += pLower->pos.Y - pUpper->pos.Y; pSprite->pos.Y += pLower->pos.Y - pUpper->pos.Y;
int z2; int z2;
if (pLower->type == kMarkerLowLink) if (pLower->type == kMarkerLowLink)
z2 = pLower->z; z2 = pLower->pos.Z;
else else
z2 = getceilzofslopeptr(pSprite->sector(), pSprite->pos.X, pSprite->pos.Y); z2 = getceilzofslopeptr(pSprite->sector(), pSprite->pos.X, pSprite->pos.Y);
pSprite->z += z2-z; pSprite->pos.Z += z2-z;
actor->interpolated = false; actor->interpolated = false;
return pUpper->type; return pUpper->type;
} }
@ -226,10 +226,10 @@ int CheckLink(DBloodActor *actor)
spritetype *pLower = &aLower->s(); spritetype *pLower = &aLower->s();
int z; int z;
if (pLower->type == kMarkerLowLink) if (pLower->type == kMarkerLowLink)
z = pLower->z; z = pLower->pos.Z;
else else
z = getceilzofslopeptr(pSprite->sector(), pSprite->pos.X, pSprite->pos.Y); z = getceilzofslopeptr(pSprite->sector(), pSprite->pos.X, pSprite->pos.Y);
if (z >= pSprite->z) if (z >= pSprite->pos.Z)
{ {
aUpper = aLower->GetOwner(); aUpper = aLower->GetOwner();
assert(aUpper); assert(aUpper);
@ -240,10 +240,10 @@ int CheckLink(DBloodActor *actor)
pSprite->pos.Y += pUpper->pos.Y - pLower->pos.Y; pSprite->pos.Y += pUpper->pos.Y - pLower->pos.Y;
int z2; int z2;
if (pUpper->type == kMarkerUpLink) if (pUpper->type == kMarkerUpLink)
z2 = pUpper->z; z2 = pUpper->pos.Z;
else else
z2 = getflorzofslopeptr(pSprite->sector(), pSprite->pos.X, pSprite->pos.Y); z2 = getflorzofslopeptr(pSprite->sector(), pSprite->pos.X, pSprite->pos.Y);
pSprite->z += z2-z; pSprite->pos.Z += z2-z;
actor->interpolated = false; actor->interpolated = false;
return pLower->type; return pLower->type;
} }
@ -260,7 +260,7 @@ int CheckLink(int *x, int *y, int *z, sectortype** pSector)
spritetype *pUpper = &upper->s(); spritetype *pUpper = &upper->s();
int z1; int z1;
if (pUpper->type == kMarkerUpLink) if (pUpper->type == kMarkerUpLink)
z1 = pUpper->z; z1 = pUpper->pos.Z;
else else
z1 = getflorzofslopeptr(*pSector, *x, *y); z1 = getflorzofslopeptr(*pSector, *x, *y);
if (z1 <= *z) if (z1 <= *z)
@ -274,7 +274,7 @@ int CheckLink(int *x, int *y, int *z, sectortype** pSector)
*y += pLower->pos.Y - pUpper->pos.Y; *y += pLower->pos.Y - pUpper->pos.Y;
int z2; int z2;
if (pUpper->type == kMarkerLowLink) if (pUpper->type == kMarkerLowLink)
z2 = pLower->z; z2 = pLower->pos.Z;
else else
z2 = getceilzofslopeptr(*pSector, *x, *y); z2 = getceilzofslopeptr(*pSector, *x, *y);
*z += z2-z1; *z += z2-z1;
@ -286,7 +286,7 @@ int CheckLink(int *x, int *y, int *z, sectortype** pSector)
spritetype *pLower = &lower->s(); spritetype *pLower = &lower->s();
int z1; int z1;
if (pLower->type == kMarkerLowLink) if (pLower->type == kMarkerLowLink)
z1 = pLower->z; z1 = pLower->pos.Z;
else else
z1 = getceilzofslopeptr(*pSector, *x, *y); z1 = getceilzofslopeptr(*pSector, *x, *y);
if (z1 >= *z) if (z1 >= *z)
@ -300,7 +300,7 @@ int CheckLink(int *x, int *y, int *z, sectortype** pSector)
*y += pUpper->pos.Y - pLower->pos.Y; *y += pUpper->pos.Y - pLower->pos.Y;
int z2; int z2;
if (pLower->type == kMarkerUpLink) if (pLower->type == kMarkerUpLink)
z2 = pUpper->z; z2 = pUpper->pos.Z;
else else
z2 = getflorzofslopeptr(*pSector, *x, *y); z2 = getflorzofslopeptr(*pSector, *x, *y);
*z += z2-z1; *z += z2-z1;

View file

@ -211,7 +211,7 @@ static bool checkAmmo2(const PLAYER *pPlayer, int ammotype, int amount)
void SpawnBulletEject(PLAYER *pPlayer, int a2, int a3) void SpawnBulletEject(PLAYER *pPlayer, int a2, int a3)
{ {
POSTURE *pPosture = &pPlayer->pPosture[pPlayer->lifeMode][pPlayer->posture]; POSTURE *pPosture = &pPlayer->pPosture[pPlayer->lifeMode][pPlayer->posture];
pPlayer->zView = pPlayer->pSprite->z-pPosture->eyeAboveZ; pPlayer->zView = pPlayer->pSprite->pos.Z-pPosture->eyeAboveZ;
int dz = pPlayer->zWeapon-(pPlayer->zWeapon-pPlayer->zView)/2; int dz = pPlayer->zWeapon-(pPlayer->zWeapon-pPlayer->zView)/2;
fxSpawnEjectingBrass(pPlayer->actor, dz, a2, a3); fxSpawnEjectingBrass(pPlayer->actor, dz, a2, a3);
} }
@ -219,7 +219,7 @@ void SpawnBulletEject(PLAYER *pPlayer, int a2, int a3)
void SpawnShellEject(PLAYER *pPlayer, int a2, int a3) void SpawnShellEject(PLAYER *pPlayer, int a2, int a3)
{ {
POSTURE *pPosture = &pPlayer->pPosture[pPlayer->lifeMode][pPlayer->posture]; POSTURE *pPosture = &pPlayer->pPosture[pPlayer->lifeMode][pPlayer->posture];
pPlayer->zView = pPlayer->pSprite->z-pPosture->eyeAboveZ; pPlayer->zView = pPlayer->pSprite->pos.Z-pPosture->eyeAboveZ;
int t = pPlayer->zWeapon - pPlayer->zView; int t = pPlayer->zWeapon - pPlayer->zView;
int dz = pPlayer->zWeapon-t+(t>>2); int dz = pPlayer->zWeapon-t+(t>>2);
fxSpawnEjectingShell(pPlayer->actor, dz, a2, a3); fxSpawnEjectingShell(pPlayer->actor, dz, a2, a3);
@ -374,7 +374,7 @@ void UpdateAimVector(PLAYER * pPlayer)
continue; continue;
int x2 = pSprite->pos.X; int x2 = pSprite->pos.X;
int y2 = pSprite->pos.Y; int y2 = pSprite->pos.Y;
int z2 = pSprite->z; int z2 = pSprite->pos.Z;
int nDist = approxDist(x2-x, y2-y); int nDist = approxDist(x2-x, y2-y);
if (nDist == 0 || nDist > 51200) if (nDist == 0 || nDist > 51200)
continue; continue;
@ -429,7 +429,7 @@ void UpdateAimVector(PLAYER * pPlayer)
continue; continue;
int x2 = pSprite->pos.X; int x2 = pSprite->pos.X;
int y2 = pSprite->pos.Y; int y2 = pSprite->pos.Y;
int z2 = pSprite->z; int z2 = pSprite->pos.Z;
int dx = x2-x; int dx = x2-x;
int dy = y2-y; int dy = y2-y;
int dz = z2-z; int dz = z2-z;
@ -447,7 +447,7 @@ void UpdateAimVector(PLAYER * pPlayer)
int angle = getangle(dx,dy); int angle = getangle(dx,dy);
if (abs(((angle-pPSprite->ang+1024)&2047)-1024) > pWeaponTrack->thingAngle) if (abs(((angle-pPSprite->ang+1024)&2047)-1024) > pWeaponTrack->thingAngle)
continue; continue;
if (pPlayer->aimTargetsCount < 16 && cansee(x,y,z,pPSprite->sector(),pSprite->pos.X,pSprite->pos.Y,pSprite->z,pSprite->sector())) if (pPlayer->aimTargetsCount < 16 && cansee(x,y,z,pPSprite->sector(),pSprite->pos.X,pSprite->pos.Y,pSprite->pos.Z,pSprite->sector()))
pPlayer->aimTargets[pPlayer->aimTargetsCount++] = actor; pPlayer->aimTargets[pPlayer->aimTargetsCount++] = actor;
// Inlined? // Inlined?
int dz2 = (lz-z2)>>8; int dz2 = (lz-z2)>>8;
@ -456,7 +456,7 @@ void UpdateAimVector(PLAYER * pPlayer)
int nDist2 = ksqrt(dx2*dx2+dy2*dy2+dz2*dz2); int nDist2 = ksqrt(dx2*dx2+dy2*dy2+dz2*dz2);
if (nDist2 >= nClosest) if (nDist2 >= nClosest)
continue; continue;
if (cansee(x, y, z, pPSprite->sector(), pSprite->pos.X, pSprite->pos.Y, pSprite->z, pSprite->sector())) if (cansee(x, y, z, pPSprite->sector(), pSprite->pos.X, pSprite->pos.Y, pSprite->pos.Z, pSprite->sector()))
{ {
nClosest = nDist2; nClosest = nDist2;
aim.dx = bcos(angle); aim.dx = bcos(angle);
@ -1065,7 +1065,7 @@ void FirePitchfork(int, PLAYER *pPlayer)
int r2 = Random2(2000); int r2 = Random2(2000);
int r3 = Random2(2000); int r3 = Random2(2000);
for (int i = 0; i < 4; i++) for (int i = 0; i < 4; i++)
actFireVector(actor, (2*i-3)*40, pPlayer->zWeapon-pPlayer->pSprite->z, aim->dx+r1, aim->dy+r2, aim->dz+r3, kVectorTine); actFireVector(actor, (2*i-3)*40, pPlayer->zWeapon-pPlayer->pSprite->pos.Z, aim->dx+r1, aim->dy+r2, aim->dz+r3, kVectorTine);
} }
void FireSpray(int, PLAYER *pPlayer) void FireSpray(int, PLAYER *pPlayer)
@ -1249,7 +1249,7 @@ void FireShotgun(int nTrigger, PLAYER *pPlayer)
r3 = Random3(1500); r3 = Random3(1500);
nType = kVectorShellAP; nType = kVectorShellAP;
} }
actFireVector(actor, 0, pPlayer->zWeapon-pPlayer->pSprite->z, pPlayer->aim.dx+r1, pPlayer->aim.dy+r2, pPlayer->aim.dz+r3, nType); actFireVector(actor, 0, pPlayer->zWeapon-pPlayer->pSprite->pos.Z, pPlayer->aim.dx+r1, pPlayer->aim.dy+r2, pPlayer->aim.dz+r3, nType);
} }
UseAmmo(pPlayer, pPlayer->weaponAmmo, nTrigger); UseAmmo(pPlayer, pPlayer->weaponAmmo, nTrigger);
pPlayer->flashEffect = 1; pPlayer->flashEffect = 1;
@ -1273,7 +1273,7 @@ void FireTommy(int nTrigger, PLAYER *pPlayer)
int r1 = Random3(400); int r1 = Random3(400);
int r2 = Random3(1200); int r2 = Random3(1200);
int r3 = Random3(1200); int r3 = Random3(1200);
actFireVector(actor, 0, pPlayer->zWeapon-pPlayer->pSprite->z, aim->dx+r3, aim->dy+r2, aim->dz+r1, kVectorTommyRegular); actFireVector(actor, 0, pPlayer->zWeapon-pPlayer->pSprite->pos.Z, aim->dx+r3, aim->dy+r2, aim->dz+r1, kVectorTommyRegular);
SpawnBulletEject(pPlayer, -15, -45); SpawnBulletEject(pPlayer, -15, -45);
pPlayer->visibility = 20; pPlayer->visibility = 20;
break; break;
@ -1283,12 +1283,12 @@ void FireTommy(int nTrigger, PLAYER *pPlayer)
int r1 = Random3(400); int r1 = Random3(400);
int r2 = Random3(1200); int r2 = Random3(1200);
int r3 = Random3(1200); int r3 = Random3(1200);
actFireVector(actor, -120, pPlayer->zWeapon-pPlayer->pSprite->z, aim->dx+r3, aim->dy+r2, aim->dz+r1, kVectorTommyRegular); actFireVector(actor, -120, pPlayer->zWeapon-pPlayer->pSprite->pos.Z, aim->dx+r3, aim->dy+r2, aim->dz+r1, kVectorTommyRegular);
SpawnBulletEject(pPlayer, -140, -45); SpawnBulletEject(pPlayer, -140, -45);
r1 = Random3(400); r1 = Random3(400);
r2 = Random3(1200); r2 = Random3(1200);
r3 = Random3(1200); r3 = Random3(1200);
actFireVector(actor, 120, pPlayer->zWeapon-pPlayer->pSprite->z, aim->dx+r3, aim->dy+r2, aim->dz+r1, kVectorTommyRegular); actFireVector(actor, 120, pPlayer->zWeapon-pPlayer->pSprite->pos.Z, aim->dx+r3, aim->dy+r2, aim->dz+r1, kVectorTommyRegular);
SpawnBulletEject(pPlayer, 140, 45); SpawnBulletEject(pPlayer, 140, 45);
pPlayer->visibility = 30; pPlayer->visibility = 30;
break; break;
@ -1313,7 +1313,7 @@ void FireSpread(int nTrigger, PLAYER *pPlayer)
r1 = Random3(300); r1 = Random3(300);
r2 = Random3(600); r2 = Random3(600);
r3 = Random3(600); r3 = Random3(600);
actFireVector(actor, 0, pPlayer->zWeapon-pPlayer->pSprite->z, dx+r3, dy+r2, aim->dz+r1, kVectorTommyAP); actFireVector(actor, 0, pPlayer->zWeapon-pPlayer->pSprite->pos.Z, dx+r3, dy+r2, aim->dz+r1, kVectorTommyAP);
r1 = Random2(90); r1 = Random2(90);
r2 = Random2(30); r2 = Random2(30);
SpawnBulletEject(pPlayer, r2, r1); SpawnBulletEject(pPlayer, r2, r1);
@ -1335,14 +1335,14 @@ void AltFireSpread(int nTrigger, PLAYER *pPlayer)
r1 = Random3(300); r1 = Random3(300);
r2 = Random3(600); r2 = Random3(600);
r3 = Random3(600); r3 = Random3(600);
actFireVector(actor, -120, pPlayer->zWeapon-pPlayer->pSprite->z, dx+r3, dy+r2, aim->dz+r1, kVectorTommyAP); actFireVector(actor, -120, pPlayer->zWeapon-pPlayer->pSprite->pos.Z, dx+r3, dy+r2, aim->dz+r1, kVectorTommyAP);
r1 = Random2(45); r1 = Random2(45);
r2 = Random2(120); r2 = Random2(120);
SpawnBulletEject(pPlayer, r2, r1); SpawnBulletEject(pPlayer, r2, r1);
r1 = Random3(300); r1 = Random3(300);
r2 = Random3(600); r2 = Random3(600);
r3 = Random3(600); r3 = Random3(600);
actFireVector(actor, 120, pPlayer->zWeapon-pPlayer->pSprite->z, dx+r3, dy+r2, aim->dz+r1, kVectorTommyAP); actFireVector(actor, 120, pPlayer->zWeapon-pPlayer->pSprite->pos.Z, dx+r3, dy+r2, aim->dz+r1, kVectorTommyAP);
r1 = Random2(-45); r1 = Random2(-45);
r2 = Random2(-120); r2 = Random2(-120);
SpawnBulletEject(pPlayer, r2, r1); SpawnBulletEject(pPlayer, r2, r1);
@ -1367,14 +1367,14 @@ void AltFireSpread2(int nTrigger, PLAYER *pPlayer)
r1 = Random3(300); r1 = Random3(300);
r2 = Random3(600); r2 = Random3(600);
r3 = Random3(600); r3 = Random3(600);
actFireVector(actor, -120, pPlayer->zWeapon-pPlayer->pSprite->z, dx+r3, dy+r2, aim->dz+r1, kVectorTommyAP); actFireVector(actor, -120, pPlayer->zWeapon-pPlayer->pSprite->pos.Z, dx+r3, dy+r2, aim->dz+r1, kVectorTommyAP);
r1 = Random2(45); r1 = Random2(45);
r2 = Random2(120); r2 = Random2(120);
SpawnBulletEject(pPlayer, r2, r1); SpawnBulletEject(pPlayer, r2, r1);
r1 = Random3(300); r1 = Random3(300);
r2 = Random3(600); r2 = Random3(600);
r3 = Random3(600); r3 = Random3(600);
actFireVector(actor, 120, pPlayer->zWeapon-pPlayer->pSprite->z, dx+r3, dy+r2, aim->dz+r1, kVectorTommyAP); actFireVector(actor, 120, pPlayer->zWeapon-pPlayer->pSprite->pos.Z, dx+r3, dy+r2, aim->dz+r1, kVectorTommyAP);
r1 = Random2(-45); r1 = Random2(-45);
r2 = Random2(-120); r2 = Random2(-120);
SpawnBulletEject(pPlayer, r2, r1); SpawnBulletEject(pPlayer, r2, r1);
@ -1388,7 +1388,7 @@ void AltFireSpread2(int nTrigger, PLAYER *pPlayer)
r1 = Random3(300); r1 = Random3(300);
r2 = Random3(600); r2 = Random3(600);
r3 = Random3(600); r3 = Random3(600);
actFireVector(actor, 0, pPlayer->zWeapon-pPlayer->pSprite->z, dx+r3, dy+r2, aim->dz+r1, kVectorTommyAP); actFireVector(actor, 0, pPlayer->zWeapon-pPlayer->pSprite->pos.Z, dx+r3, dy+r2, aim->dz+r1, kVectorTommyAP);
r1 = Random2(90); r1 = Random2(90);
r2 = Random2(30); r2 = Random2(30);
SpawnBulletEject(pPlayer, r2, r1); SpawnBulletEject(pPlayer, r2, r1);
@ -1764,7 +1764,7 @@ void FireBeast(int , PLAYER * pPlayer)
int r1 = Random2(2000); int r1 = Random2(2000);
int r2 = Random2(2000); int r2 = Random2(2000);
int r3 = Random2(2000); int r3 = Random2(2000);
actFireVector(actor, 0, pPlayer->zWeapon-pPlayer->pSprite->z, pPlayer->aim.dx+r1, pPlayer->aim.dy+r2, pPlayer->aim.dz+r3, kVectorBeastSlash); actFireVector(actor, 0, pPlayer->zWeapon-pPlayer->pSprite->pos.Z, pPlayer->aim.dx+r1, pPlayer->aim.dy+r2, pPlayer->aim.dz+r3, kVectorBeastSlash);
} }
uint8_t gWeaponUpgrade[][13] = { uint8_t gWeaponUpgrade[][13] = {
@ -2663,7 +2663,7 @@ void teslaHit(DBloodActor *missileactor, int a2)
auto pMissile = &missileactor->s(); auto pMissile = &missileactor->s();
int x = pMissile->pos.X; int x = pMissile->pos.X;
int y = pMissile->pos.Y; int y = pMissile->pos.Y;
int z = pMissile->z; int z = pMissile->pos.Z;
int nDist = 300; int nDist = 300;
auto pSector = pMissile->sector(); auto pSector = pMissile->sector();
auto owneractor = missileactor->GetOwner(); auto owneractor = missileactor->GetOwner();

View file

@ -213,7 +213,7 @@ static void geometryEffect(int cposx, int cposy, int cposz, binangle cang, fixed
while (auto act = it.Next()) while (auto act = it.Next())
{ {
ChangeActorSect(act, geosectorwarp[gs]); ChangeActorSect(act, geosectorwarp[gs]);
SetActor(act, { act->spr.pos.X -= geox[gs], act->spr.pos.Y -= geoy[gs], act->spr.z }); SetActor(act, { act->spr.pos.X -= geox[gs], act->spr.pos.Y -= geoy[gs], act->spr.pos.Z });
} }
if (geosector[gs] == sectp) if (geosector[gs] == sectp)
{ {
@ -233,7 +233,7 @@ static void geometryEffect(int cposx, int cposy, int cposz, binangle cang, fixed
while (auto act = it.Next()) while (auto act = it.Next())
{ {
ChangeActorSect(act, geosector[gs]); ChangeActorSect(act, geosector[gs]);
SetActor(act, { act->spr.pos.X += geox[gs], act->spr.pos.Y += geoy[gs], act->spr.z }); SetActor(act, { act->spr.pos.X += geox[gs], act->spr.pos.Y += geoy[gs], act->spr.pos.Z });
} }
} }
fi.animatesprites(pm_tsprite, pm_spritesortcnt, cposx, cposy, cang.asbuild(), smoothratio); fi.animatesprites(pm_tsprite, pm_spritesortcnt, cposx, cposy, cang.asbuild(), smoothratio);
@ -245,7 +245,7 @@ static void geometryEffect(int cposx, int cposy, int cposz, binangle cang, fixed
while (auto act = it.Next()) while (auto act = it.Next())
{ {
ChangeActorSect(act, geosectorwarp2[gs]); ChangeActorSect(act, geosectorwarp2[gs]);
SetActor(act, { act->spr.pos.X -= geox2[gs], act->spr.pos.Y -= geoy2[gs], act->spr.z }); SetActor(act, { act->spr.pos.X -= geox2[gs], act->spr.pos.Y -= geoy2[gs], act->spr.pos.Z });
} }
if (geosector[gs] == sectp) if (geosector[gs] == sectp)
{ {
@ -265,7 +265,7 @@ static void geometryEffect(int cposx, int cposy, int cposz, binangle cang, fixed
while (auto act = it.Next()) while (auto act = it.Next())
{ {
ChangeActorSect(act, geosector[gs]); ChangeActorSect(act, geosector[gs]);
SetActor(act, { act->spr.pos.X += geox2[gs], act->spr.pos.Y += geoy2[gs], act->spr.z }); SetActor(act, { act->spr.pos.X += geox2[gs], act->spr.pos.Y += geoy2[gs], act->spr.pos.Z });
} }
} }
fi.animatesprites(pm_tsprite, pm_spritesortcnt, cposx, cposy, cang.asbuild(), smoothratio); fi.animatesprites(pm_tsprite, pm_spritesortcnt, cposx, cposy, cang.asbuild(), smoothratio);

View file

@ -62,7 +62,7 @@ void RANDOMSCRAP(DDukeActor* origin)
int r1 = krand(), r2 = krand(), r3 = krand(), r4 = krand(), r5 = krand(), r6 = krand(), r7 = krand(); int r1 = krand(), r2 = krand(), r3 = krand(), r4 = krand(), r5 = krand(), r6 = krand(), r7 = krand();
int v = isRR() ? 16 : 48; int v = isRR() ? 16 : 48;
EGS(origin->spr.sector(), EGS(origin->spr.sector(),
origin->spr.pos.X + (r7 & 255) - 128, origin->spr.pos.Y + (r6 & 255) - 128, origin->spr.z - (8 << 8) - (r5 & 8191), origin->spr.pos.X + (r7 & 255) - 128, origin->spr.pos.Y + (r6 & 255) - 128, origin->spr.pos.Z - (8 << 8) - (r5 & 8191),
TILE_SCRAP6 + (r4 & 15), -8, v, v, r3 & 2047, (r2 & 63) + 64, -512 - (r1 & 2047), origin, 5); TILE_SCRAP6 + (r4 & 15), -8, v, v, r3 & 2047, (r2 & 63) + 64, -512 - (r1 & 2047), origin, 5);
} }
@ -265,7 +265,7 @@ void lotsofstuff(DDukeActor* actor, int n, int spawntype)
for (int i = n; i > 0; i--) for (int i = n; i > 0; i--)
{ {
int r1 = krand(), r2 = krand(); // using the RANDCORRECT version from RR. int r1 = krand(), r2 = krand(); // using the RANDCORRECT version from RR.
auto j = EGS(actor->spr.sector(), actor->spr.pos.X, actor->spr.pos.Y, actor->spr.z - (r2 % (47 << 8)), spawntype, -32, 8, 8, r1 & 2047, 0, 0, actor, 5); auto j = EGS(actor->spr.sector(), actor->spr.pos.X, actor->spr.pos.Y, actor->spr.pos.Z - (r2 % (47 << 8)), spawntype, -32, 8, 8, r1 & 2047, 0, 0, actor, 5);
if (j) j->spr.cstat = randomFlip(); if (j) j->spr.cstat = randomFlip();
} }
} }
@ -362,7 +362,7 @@ void movedummyplayers(void)
if (ps[p].on_ground && ps[p].on_warping_sector == 1 && ps[p].cursector->lotag == 1) if (ps[p].on_ground && ps[p].on_warping_sector == 1 && ps[p].cursector->lotag == 1)
{ {
act->spr.cstat = CSTAT_SPRITE_BLOCK_ALL; act->spr.cstat = CSTAT_SPRITE_BLOCK_ALL;
act->spr.z = act->spr.sector()->ceilingz + (27 << 8); act->spr.pos.Z = act->spr.sector()->ceilingz + (27 << 8);
act->spr.ang = ps[p].angle.ang.asbuild(); act->spr.ang = ps[p].angle.ang.asbuild();
if (act->temp_data[0] == 8) if (act->temp_data[0] == 8)
act->temp_data[0] = 0; act->temp_data[0] = 0;
@ -370,7 +370,7 @@ void movedummyplayers(void)
} }
else else
{ {
if (act->spr.sector()->lotag != 2) act->spr.z = act->spr.sector()->floorz; if (act->spr.sector()->lotag != 2) act->spr.pos.Z = act->spr.sector()->floorz;
act->spr.cstat = CSTAT_SPRITE_INVISIBLE; act->spr.cstat = CSTAT_SPRITE_INVISIBLE;
} }
} }
@ -403,7 +403,7 @@ void moveplayers(void)
{ {
act->spr.pos.X = p->oposx; act->spr.pos.X = p->oposx;
act->spr.pos.Y = p->oposy; act->spr.pos.Y = p->oposy;
act->spr.z = p->oposz + gs.playerheight; act->spr.pos.Z = p->oposz + gs.playerheight;
act->spr.backupz(); act->spr.backupz();
act->spr.ang = p->angle.oang.asbuild(); act->spr.ang = p->angle.oang.asbuild();
SetActor(act, act->spr.pos); SetActor(act, act->spr.pos);
@ -463,7 +463,7 @@ void moveplayers(void)
{ {
p->pos.X = act->spr.pos.X; p->pos.X = act->spr.pos.X;
p->pos.Y = act->spr.pos.Y; p->pos.Y = act->spr.pos.Y;
p->pos.Z = act->spr.z - (20 << 8); p->pos.Z = act->spr.pos.Z - (20 << 8);
p->newOwner = nullptr; p->newOwner = nullptr;
@ -499,7 +499,7 @@ void moveplayers(void)
if (act->spr.sector()->lotag != ST_2_UNDERWATER) if (act->spr.sector()->lotag != ST_2_UNDERWATER)
makeitfall(act); makeitfall(act);
if (act->spr.zvel == 0 && act->spr.sector()->lotag == ST_1_ABOVE_WATER) if (act->spr.zvel == 0 && act->spr.sector()->lotag == ST_1_ABOVE_WATER)
act->spr.z += (32 << 8); act->spr.pos.Z += (32 << 8);
} }
if (act->spr.extra < 8) if (act->spr.extra < 8)
@ -650,7 +650,7 @@ void movecrane(DDukeActor *actor, int crane)
case STAT_STANDABLE: case STAT_STANDABLE:
case STAT_PLAYER: case STAT_PLAYER:
actor->spr.ang = getangle(cpt.polex - actor->spr.pos.X, cpt.poley - actor->spr.pos.Y); actor->spr.ang = getangle(cpt.polex - actor->spr.pos.X, cpt.poley - actor->spr.pos.Y);
SetActor(a2, { cpt.polex, cpt.poley, a2->spr.z }); SetActor(a2, { cpt.polex, cpt.poley, a2->spr.pos.Z });
t[0]++; t[0]++;
return; return;
} }
@ -671,19 +671,19 @@ void movecrane(DDukeActor *actor, int crane)
} }
else if (t[0] == 2 || t[0] == 7) else if (t[0] == 2 || t[0] == 7)
{ {
actor->spr.z += (1024 + 512); actor->spr.pos.Z += (1024 + 512);
if (t[0] == 2) if (t[0] == 2)
{ {
if ((sectp->floorz - actor->spr.z) < (64 << 8)) if ((sectp->floorz - actor->spr.pos.Z) < (64 << 8))
if (actor->spr.picnum > crane) actor->spr.picnum--; if (actor->spr.picnum > crane) actor->spr.picnum--;
if ((sectp->floorz - actor->spr.z) < (4096 + 1024)) if ((sectp->floorz - actor->spr.pos.Z) < (4096 + 1024))
t[0]++; t[0]++;
} }
if (t[0] == 7) if (t[0] == 7)
{ {
if ((sectp->floorz - actor->spr.z) < (64 << 8)) if ((sectp->floorz - actor->spr.pos.Z) < (64 << 8))
{ {
if (actor->spr.picnum > crane) actor->spr.picnum--; if (actor->spr.picnum > crane) actor->spr.picnum--;
else else
@ -743,16 +743,16 @@ void movecrane(DDukeActor *actor, int crane)
else if (t[0] == 5 || t[0] == 8) else if (t[0] == 5 || t[0] == 8)
{ {
if (t[0] == 8 && actor->spr.picnum < (crane + 2)) if (t[0] == 8 && actor->spr.picnum < (crane + 2))
if ((sectp->floorz - actor->spr.z) > 8192) if ((sectp->floorz - actor->spr.pos.Z) > 8192)
actor->spr.picnum++; actor->spr.picnum++;
if (actor->spr.z < cpt.z) if (actor->spr.pos.Z < cpt.z)
{ {
t[0]++; t[0]++;
actor->spr.xvel = 0; actor->spr.xvel = 0;
} }
else else
actor->spr.z -= (1024 + 512); actor->spr.pos.Z -= (1024 + 512);
} }
else if (t[0] == 6) else if (t[0] == 6)
{ {
@ -768,7 +768,7 @@ void movecrane(DDukeActor *actor, int crane)
t[0] = 0; t[0] = 0;
if (cpt.poleactor) if (cpt.poleactor)
SetActor(cpt.poleactor, { actor->spr.pos.X, actor->spr.pos.Y, actor->spr.z - (34 << 8) }); SetActor(cpt.poleactor, { actor->spr.pos.X, actor->spr.pos.Y, actor->spr.pos.Z - (34 << 8) });
auto Owner = actor->GetOwner(); auto Owner = actor->GetOwner();
if (Owner != nullptr || actor->IsActiveCrane()) if (Owner != nullptr || actor->IsActiveCrane())
@ -802,7 +802,7 @@ void movecrane(DDukeActor *actor, int crane)
ps[p].oposz = ps[p].pos.Z; ps[p].oposz = ps[p].pos.Z;
ps[p].pos.X = actor->spr.pos.X - bcos(ang, -6); ps[p].pos.X = actor->spr.pos.X - bcos(ang, -6);
ps[p].pos.Y = actor->spr.pos.Y - bsin(ang, -6); ps[p].pos.Y = actor->spr.pos.Y - bsin(ang, -6);
ps[p].pos.Z = actor->spr.z + (2 << 8); ps[p].pos.Z = actor->spr.pos.Z + (2 << 8);
SetActor(ps[p].GetActor(), ps[p].pos); SetActor(ps[p].GetActor(), ps[p].pos);
ps[p].setCursector(ps[p].GetActor()->spr.sector()); ps[p].setCursector(ps[p].GetActor()->spr.sector());
} }
@ -931,7 +931,7 @@ void detonate(DDukeActor *actor, int explosion)
} }
} }
actor->spr.z -= (32 << 8); actor->spr.pos.Z -= (32 << 8);
if ((t[3] == 1 && actor->spr.xrepeat) || actor->spr.lotag == -99) if ((t[3] == 1 && actor->spr.xrepeat) || actor->spr.lotag == -99)
{ {
@ -1056,7 +1056,7 @@ void movewaterdrip(DDukeActor *actor, int drip)
} }
else else
{ {
actor->spr.z = t[0]; actor->spr.pos.Z = t[0];
actor->spr.backupz(); actor->spr.backupz();
t[1] = 48 + (krand() & 31); t[1] = 48 + (krand() & 31);
} }
@ -1076,7 +1076,7 @@ void movedoorshock(DDukeActor* actor)
int j = abs(sectp->ceilingz - sectp->floorz) >> 9; int j = abs(sectp->ceilingz - sectp->floorz) >> 9;
actor->spr.yrepeat = j + 4; actor->spr.yrepeat = j + 4;
actor->spr.xrepeat = 16; actor->spr.xrepeat = 16;
actor->spr.z = sectp->floorz; actor->spr.pos.Z = sectp->floorz;
} }
//--------------------------------------------------------------------------- //---------------------------------------------------------------------------
@ -1112,9 +1112,9 @@ void movetouchplate(DDukeActor* actor, int plate)
} }
else else
{ {
if (x <= actor->spr.z) if (x <= actor->spr.pos.Z)
{ {
sectp->floorz = actor->spr.z; sectp->floorz = actor->spr.pos.Z;
t[1] = 0; t[1] = 0;
} }
else else
@ -1279,7 +1279,7 @@ void bounce(DDukeActor* actor)
int daang = getangle(sectp->firstWall()->delta()); int daang = getangle(sectp->firstWall()->delta());
int k, l; int k, l;
if (actor->spr.z < (actor->floorz + actor->ceilingz) >> 1) if (actor->spr.pos.Z < (actor->floorz + actor->ceilingz) >> 1)
k = sectp->ceilingheinum; k = sectp->ceilingheinum;
else else
k = sectp->floorheinum; k = sectp->floorheinum;
@ -1333,13 +1333,13 @@ void movetongue(DDukeActor *actor, int tongue, int jaw)
actor->spr.pos.X = Owner->spr.pos.X; actor->spr.pos.X = Owner->spr.pos.X;
actor->spr.pos.Y = Owner->spr.pos.Y; actor->spr.pos.Y = Owner->spr.pos.Y;
if (Owner->spr.picnum == TILE_APLAYER) if (Owner->spr.picnum == TILE_APLAYER)
actor->spr.z = Owner->spr.z - (34 << 8); actor->spr.pos.Z = Owner->spr.pos.Z - (34 << 8);
for (int k = 0; k < actor->temp_data[0]; k++) for (int k = 0; k < actor->temp_data[0]; k++)
{ {
auto q = EGS(actor->spr.sector(), auto q = EGS(actor->spr.sector(),
actor->spr.pos.X + MulScale(k, bcos(actor->spr.ang), 9), actor->spr.pos.X + MulScale(k, bcos(actor->spr.ang), 9),
actor->spr.pos.Y + MulScale(k, bsin(actor->spr.ang), 9), actor->spr.pos.Y + MulScale(k, bsin(actor->spr.ang), 9),
actor->spr.z + ((k * Sgn(actor->spr.zvel)) * abs(actor->spr.zvel / 12)), tongue, -40 + (k << 1), actor->spr.pos.Z + ((k * Sgn(actor->spr.zvel)) * abs(actor->spr.zvel / 12)), tongue, -40 + (k << 1),
8, 8, 0, 0, 0, actor, 5); 8, 8, 0, 0, 0, actor, 5);
if (q) if (q)
{ {
@ -1351,7 +1351,7 @@ void movetongue(DDukeActor *actor, int tongue, int jaw)
auto spawned = EGS(actor->spr.sector(), auto spawned = EGS(actor->spr.sector(),
actor->spr.pos.X + MulScale(k, bcos(actor->spr.ang), 9), actor->spr.pos.X + MulScale(k, bcos(actor->spr.ang), 9),
actor->spr.pos.Y + MulScale(k, bsin(actor->spr.ang), 9), actor->spr.pos.Y + MulScale(k, bsin(actor->spr.ang), 9),
actor->spr.z + ((k * Sgn(actor->spr.zvel)) * abs(actor->spr.zvel / 12)), jaw, -40, actor->spr.pos.Z + ((k * Sgn(actor->spr.zvel)) * abs(actor->spr.zvel / 12)), jaw, -40,
32, 32, 0, 0, 0, actor, 5); 32, 32, 0, 0, 0, actor, 5);
if (spawned) if (spawned)
{ {
@ -1385,7 +1385,7 @@ void rpgexplode(DDukeActor *actor, int hit, const vec3_t &pos, int EXPLOSION2, i
else else
{ {
explosion->spr.cstat |= CSTAT_SPRITE_YFLIP; explosion->spr.cstat |= CSTAT_SPRITE_YFLIP;
explosion->spr.z += (48 << 8); explosion->spr.pos.Z += (48 << 8);
} }
} }
if (newextra > 0) actor->spr.extra = newextra; if (newextra > 0) actor->spr.extra = newextra;
@ -1583,9 +1583,9 @@ void forcesphere(DDukeActor* actor, int forcesphere)
{ {
if (actor->spr.zvel < 6144) if (actor->spr.zvel < 6144)
actor->spr.zvel += 192; actor->spr.zvel += 192;
actor->spr.z += actor->spr.zvel; actor->spr.pos.Z += actor->spr.zvel;
if (actor->spr.z > sectp->floorz) if (actor->spr.pos.Z > sectp->floorz)
actor->spr.z = sectp->floorz; actor->spr.pos.Z = sectp->floorz;
t[3]--; t[3]--;
if (t[3] == 0) if (t[3] == 0)
{ {
@ -1623,8 +1623,8 @@ void recon(DDukeActor *actor, int explosion, int firelaser, int attacksnd, int p
actor->spr.shade += (sectp->ceilingshade - actor->spr.shade) >> 1; actor->spr.shade += (sectp->ceilingshade - actor->spr.shade) >> 1;
else actor->spr.shade += (sectp->floorshade - actor->spr.shade) >> 1; else actor->spr.shade += (sectp->floorshade - actor->spr.shade) >> 1;
if (actor->spr.z < sectp->ceilingz + (32 << 8)) if (actor->spr.pos.Z < sectp->ceilingz + (32 << 8))
actor->spr.z = sectp->ceilingz + (32 << 8); actor->spr.pos.Z = sectp->ceilingz + (32 << 8);
if (ud.multimode < 2) if (ud.multimode < 2)
{ {
@ -1648,14 +1648,14 @@ void recon(DDukeActor *actor, int explosion, int firelaser, int attacksnd, int p
if (t[0] == -1) if (t[0] == -1)
{ {
actor->spr.z += 1024; actor->spr.pos.Z += 1024;
t[2]++; t[2]++;
if ((t[2] & 3) == 0) spawn(actor, explosion); if ((t[2] & 3) == 0) spawn(actor, explosion);
getglobalz(actor); getglobalz(actor);
actor->spr.ang += 96; actor->spr.ang += 96;
actor->spr.xvel = 128; actor->spr.xvel = 128;
int j = ssp(actor, CLIPMASK0); int j = ssp(actor, CLIPMASK0);
if (j != 1 || actor->spr.z > actor->floorz) if (j != 1 || actor->spr.pos.Z > actor->floorz)
{ {
for (int l = 0; l < 16; l++) for (int l = 0; l < 16; l++)
RANDOMSCRAP(actor); RANDOMSCRAP(actor);
@ -1669,8 +1669,8 @@ void recon(DDukeActor *actor, int explosion, int firelaser, int attacksnd, int p
} }
else else
{ {
if (actor->spr.z > actor->floorz - (48 << 8)) if (actor->spr.pos.Z > actor->floorz - (48 << 8))
actor->spr.z = actor->floorz - (48 << 8); actor->spr.pos.Z = actor->floorz - (48 << 8);
} }
int x; int x;
@ -1690,7 +1690,7 @@ void recon(DDukeActor *actor, int explosion, int firelaser, int attacksnd, int p
fi.shoot(actor, firelaser); fi.shoot(actor, firelaser);
actor->spr.ang = a; actor->spr.ang = a;
} }
if (t[2] > (26 * 3) || !cansee(actor->spr.pos.X, actor->spr.pos.Y, actor->spr.z - (16 << 8), actor->spr.sector(), ps[p].pos.X, ps[p].pos.Y, ps[p].pos.Z, ps[p].cursector)) if (t[2] > (26 * 3) || !cansee(actor->spr.pos.X, actor->spr.pos.Y, actor->spr.pos.Z - (16 << 8), actor->spr.sector(), ps[p].pos.X, ps[p].pos.Y, ps[p].pos.Z, ps[p].cursector))
{ {
t[0] = 0; t[0] = 0;
t[2] = 0; t[2] = 0;
@ -1706,14 +1706,14 @@ void recon(DDukeActor *actor, int explosion, int firelaser, int attacksnd, int p
if (t[0] == 2) if (t[0] == 2)
{ {
int l = ps[p].pos.Z - actor->spr.z; int l = ps[p].pos.Z - actor->spr.pos.Z;
if (abs(l) < (48 << 8)) t[0] = 3; if (abs(l) < (48 << 8)) t[0] = 3;
else actor->spr.z += Sgn(ps[p].pos.Z - actor->spr.z) << shift; // The shift here differs between Duke and RR. else actor->spr.pos.Z += Sgn(ps[p].pos.Z - actor->spr.pos.Z) << shift; // The shift here differs between Duke and RR.
} }
else else
{ {
t[2]++; t[2]++;
if (t[2] > (26 * 3) || !cansee(actor->spr.pos.X, actor->spr.pos.Y, actor->spr.z - (16 << 8), actor->spr.sector(), ps[p].pos.X, ps[p].pos.Y, ps[p].pos.Z, ps[p].cursector)) if (t[2] > (26 * 3) || !cansee(actor->spr.pos.X, actor->spr.pos.Y, actor->spr.pos.Z - (16 << 8), actor->spr.sector(), ps[p].pos.X, ps[p].pos.Y, ps[p].pos.Z, ps[p].cursector))
{ {
t[0] = 1; t[0] = 1;
t[2] = 0; t[2] = 0;
@ -1786,9 +1786,9 @@ void recon(DDukeActor *actor, int explosion, int firelaser, int attacksnd, int p
t[3] = getincangle(actor->spr.ang, a); t[3] = getincangle(actor->spr.ang, a);
actor->spr.ang += t[3] >> 3; actor->spr.ang += t[3] >> 3;
if (actor->spr.z < Owner->spr.z) if (actor->spr.pos.Z < Owner->spr.pos.Z)
actor->spr.z += 1024; actor->spr.pos.Z += 1024;
else actor->spr.z -= 1024; else actor->spr.pos.Z -= 1024;
} }
if (roamsnd >= 0 && S_CheckActorSoundPlaying(actor, roamsnd) < 1) if (roamsnd >= 0 && S_CheckActorSoundPlaying(actor, roamsnd) < 1)
@ -1816,7 +1816,7 @@ void ooz(DDukeActor *actor)
actor->spr.yrepeat = j; actor->spr.yrepeat = j;
actor->spr.xrepeat = x; actor->spr.xrepeat = x;
actor->spr.z = actor->floorz; actor->spr.pos.Z = actor->floorz;
} }
//--------------------------------------------------------------------------- //---------------------------------------------------------------------------
@ -1893,8 +1893,8 @@ void reactor(DDukeActor* const actor, int REACTOR, int REACTOR2, int REACTORBURN
{ {
t[1]++; t[1]++;
t[4] = actor->spr.z; t[4] = actor->spr.pos.Z;
actor->spr.z = sectp->floorz - (krand() % (sectp->floorz - sectp->ceilingz)); actor->spr.pos.Z = sectp->floorz - (krand() % (sectp->floorz - sectp->ceilingz));
switch (t[1]) switch (t[1])
{ {
@ -1936,7 +1936,7 @@ void reactor(DDukeActor* const actor, int REACTOR, int REACTOR2, int REACTORBURN
for (x = 0; x < 16; x++) for (x = 0; x < 16; x++)
RANDOMSCRAP(actor); RANDOMSCRAP(actor);
actor->spr.z = t[4]; actor->spr.pos.Z = t[4];
t[4] = 0; t[4] = 0;
} }
@ -2054,7 +2054,7 @@ void forcesphereexplode(DDukeActor *actor)
actor->spr.pos.X = Owner->spr.pos.X; actor->spr.pos.X = Owner->spr.pos.X;
actor->spr.pos.Y = Owner->spr.pos.Y; actor->spr.pos.Y = Owner->spr.pos.Y;
actor->spr.z = Owner->spr.z; actor->spr.pos.Z = Owner->spr.pos.Z;
actor->spr.ang += Owner->temp_data[0]; actor->spr.ang += Owner->temp_data[0];
if (l > 64) l = 64; if (l > 64) l = 64;
@ -2160,9 +2160,9 @@ bool money(DDukeActor* actor, int BLOODPOOL)
} }
int l = getflorzofslopeptr(actor->spr.sector(), actor->spr.pos.X, actor->spr.pos.Y); int l = getflorzofslopeptr(actor->spr.sector(), actor->spr.pos.X, actor->spr.pos.Y);
if (actor->spr.z > l) if (actor->spr.pos.Z > l)
{ {
actor->spr.z = l; actor->spr.pos.Z = l;
insertspriteq(actor); insertspriteq(actor);
actor->spr.picnum++; actor->spr.picnum++;
@ -2229,7 +2229,7 @@ bool jibs(DDukeActor *actor, int JIBS6, bool timeout, bool callsetsprite, bool f
return false; return false;
} }
if (actor->spr.z < l - (2 << 8)) if (actor->spr.pos.Z < l - (2 << 8))
{ {
if (t[1] < 2) t[1]++; if (t[1] < 2) t[1]++;
else if (sectp->lotag != 2) else if (sectp->lotag != 2)
@ -2261,9 +2261,9 @@ bool jibs(DDukeActor *actor, int JIBS6, bool timeout, bool callsetsprite, bool f
actor->spr.pos.X += MulScale(actor->spr.xvel, bcos(actor->spr.ang), 14); actor->spr.pos.X += MulScale(actor->spr.xvel, bcos(actor->spr.ang), 14);
actor->spr.pos.Y += MulScale(actor->spr.xvel, bsin(actor->spr.ang), 14); actor->spr.pos.Y += MulScale(actor->spr.xvel, bsin(actor->spr.ang), 14);
actor->spr.z += actor->spr.zvel; actor->spr.pos.Z += actor->spr.zvel;
if (floorcheck && actor->spr.z >= actor->spr.sector()->floorz) if (floorcheck && actor->spr.pos.Z >= actor->spr.sector()->floorz)
{ {
deletesprite(actor); deletesprite(actor);
return false; return false;
@ -2292,7 +2292,7 @@ bool jibs(DDukeActor *actor, int JIBS6, bool timeout, bool callsetsprite, bool f
} }
l = getflorzofslopeptr(actor->spr.sector(), actor->spr.pos.X, actor->spr.pos.Y); l = getflorzofslopeptr(actor->spr.sector(), actor->spr.pos.X, actor->spr.pos.Y);
actor->spr.z = l - (2 << 8); actor->spr.pos.Z = l - (2 << 8);
actor->spr.xvel = 0; actor->spr.xvel = 0;
if (actor->spr.picnum == JIBS6) if (actor->spr.picnum == JIBS6)
@ -2338,7 +2338,7 @@ bool bloodpool(DDukeActor* actor, bool puke, int TIRE)
int x; int x;
int p = findplayer(actor, &x); int p = findplayer(actor, &x);
actor->spr.z = actor->floorz - (FOURSLEIGHT); actor->spr.pos.Z = actor->floorz - (FOURSLEIGHT);
if (t[2] < 32) if (t[2] < 32)
{ {
@ -2469,7 +2469,7 @@ void glasspieces(DDukeActor* actor)
return; return;
} }
if (actor->spr.z == actor->floorz - (FOURSLEIGHT) && t[0] < 3) if (actor->spr.pos.Z == actor->floorz - (FOURSLEIGHT) && t[0] < 3)
{ {
actor->spr.zvel = -((3 - t[0]) << 8) - (krand() & 511); actor->spr.zvel = -((3 - t[0]) << 8) - (krand() & 511);
if (sectp->lotag == 2) if (sectp->lotag == 2)
@ -2518,7 +2518,7 @@ void scrap(DDukeActor* actor, int SCRAP1, int SCRAP6)
sectp = actor->spr.sector(); sectp = actor->spr.sector();
} }
if (actor->spr.z < sectp->floorz - (2 << 8)) if (actor->spr.pos.Z < sectp->floorz - (2 << 8))
{ {
if (t[1] < 1) t[1]++; if (t[1] < 1) t[1]++;
else else
@ -2541,7 +2541,7 @@ void scrap(DDukeActor* actor, int SCRAP1, int SCRAP6)
if (actor->spr.zvel < 4096) actor->spr.zvel += gs.gravity - 50; if (actor->spr.zvel < 4096) actor->spr.zvel += gs.gravity - 50;
actor->spr.pos.X += MulScale(actor->spr.xvel, bcos(actor->spr.ang), 14); actor->spr.pos.X += MulScale(actor->spr.xvel, bcos(actor->spr.ang), 14);
actor->spr.pos.Y += MulScale(actor->spr.xvel, bsin(actor->spr.ang), 14); actor->spr.pos.Y += MulScale(actor->spr.xvel, bsin(actor->spr.ang), 14);
actor->spr.z += actor->spr.zvel; actor->spr.pos.Z += actor->spr.zvel;
} }
else else
{ {
@ -2573,7 +2573,7 @@ void gutsdir(DDukeActor* actor, int gtype, int n, int p)
sx = sy = 8; sx = sy = 8;
else sx = sy = 32; else sx = sy = 32;
int gutz = actor->spr.z - (8 << 8); int gutz = actor->spr.pos.Z - (8 << 8);
int floorz = getflorzofslopeptr(actor->sector(), actor->spr.pos.X, actor->spr.pos.Y); int floorz = getflorzofslopeptr(actor->sector(), actor->spr.pos.X, actor->spr.pos.Y);
if (gutz > (floorz - (8 << 8))) if (gutz > (floorz - (8 << 8)))
@ -2631,20 +2631,20 @@ void handle_se00(DDukeActor* actor, int LASERLINE)
} }
else actor->tempang = 256; else actor->tempang = 256;
if (sect->floorz > actor->spr.z) //z's are touching if (sect->floorz > actor->spr.pos.Z) //z's are touching
{ {
sect->floorz -= 512; sect->floorz -= 512;
zchange = -512; zchange = -512;
if (sect->floorz < actor->spr.z) if (sect->floorz < actor->spr.pos.Z)
sect->floorz = actor->spr.z; sect->floorz = actor->spr.pos.Z;
} }
else if (sect->floorz < actor->spr.z) //z's are touching else if (sect->floorz < actor->spr.pos.Z) //z's are touching
{ {
sect->floorz += 512; sect->floorz += 512;
zchange = 512; zchange = 512;
if (sect->floorz > actor->spr.z) if (sect->floorz > actor->spr.pos.Z)
sect->floorz = actor->spr.z; sect->floorz = actor->spr.pos.Z;
} }
} }
else if (actor->spr.extra == 3) else if (actor->spr.extra == 3)
@ -2740,7 +2740,7 @@ void handle_se00(DDukeActor* actor, int LASERLINE)
act2->spr.ang += (l * q); act2->spr.ang += (l * q);
act2->spr.ang &= 2047; act2->spr.ang &= 2047;
act2->spr.z += zchange; act2->spr.pos.Z += zchange;
rotatepoint(Owner->spr.pos.vec2, act2->spr.pos.vec2, (q* l), &act2->spr.pos.vec2); rotatepoint(Owner->spr.pos.vec2, act2->spr.pos.vec2, (q* l), &act2->spr.pos.vec2);
} }
} }
@ -3382,7 +3382,7 @@ void handle_se05(DDukeActor* actor, int FIRELASER)
actor->SetOwner(Owner); actor->SetOwner(Owner);
if (!Owner) return; // Undefined case - was not checked. if (!Owner) return; // Undefined case - was not checked.
actor->spr.zvel = Sgn(Owner->spr.z - actor->spr.z) << 4; actor->spr.zvel = Sgn(Owner->spr.pos.Z - actor->spr.pos.Z) << 4;
} }
if (ldist(Owner, actor) < 1024) if (ldist(Owner, actor) < 1024)
@ -3422,7 +3422,7 @@ void handle_se05(DDukeActor* actor, int FIRELASER)
} }
} }
actor->spr.z += actor->spr.zvel; actor->spr.pos.Z += actor->spr.zvel;
sc->ceilingz += actor->spr.zvel; sc->ceilingz += actor->spr.zvel;
actor->temp_sect->ceilingz += actor->spr.zvel; actor->temp_sect->ceilingz += actor->spr.zvel;
ms(actor); ms(actor);
@ -3883,7 +3883,7 @@ void handle_se17(DDukeActor* actor)
if (act1->spr.statnum != STAT_EFFECTOR) if (act1->spr.statnum != STAT_EFFECTOR)
{ {
act1->spr.backupz(); act1->spr.backupz();
act1->spr.z += q; act1->spr.pos.Z += q;
} }
act1->floorz = sc->floorz; act1->floorz = sc->floorz;
@ -3948,7 +3948,7 @@ void handle_se17(DDukeActor* actor)
{ {
act3->spr.pos.X += act2->spr.pos.X - actor->spr.pos.X; act3->spr.pos.X += act2->spr.pos.X - actor->spr.pos.X;
act3->spr.pos.Y += act2->spr.pos.Y - actor->spr.pos.Y; act3->spr.pos.Y += act2->spr.pos.Y - actor->spr.pos.Y;
act3->spr.z = act2->spr.sector()->floorz - (sc->floorz - act3->spr.z); act3->spr.pos.Z = act2->spr.sector()->floorz - (sc->floorz - act3->spr.pos.Z);
act3->spr.backupz(); act3->spr.backupz();
@ -4000,7 +4000,7 @@ void handle_se18(DDukeActor *actor, bool morecheck)
if (ps[a2->PlayerIndex()].on_ground == 1) ps[a2->PlayerIndex()].pos.Z += sc->extra; if (ps[a2->PlayerIndex()].on_ground == 1) ps[a2->PlayerIndex()].pos.Z += sc->extra;
if (a2->spr.zvel == 0 && a2->spr.statnum != STAT_EFFECTOR && a2->spr.statnum != STAT_PROJECTILE) if (a2->spr.zvel == 0 && a2->spr.statnum != STAT_EFFECTOR && a2->spr.statnum != STAT_PROJECTILE)
{ {
a2->spr.z += sc->extra; a2->spr.pos.Z += sc->extra;
a2->floorz = sc->floorz; a2->floorz = sc->floorz;
} }
} }
@ -4018,9 +4018,9 @@ void handle_se18(DDukeActor *actor, bool morecheck)
if (actor->spr.ang == 512) if (actor->spr.ang == 512)
{ {
sc->ceilingz += sc->extra; sc->ceilingz += sc->extra;
if (sc->ceilingz >= actor->spr.z) if (sc->ceilingz >= actor->spr.pos.Z)
{ {
sc->ceilingz = actor->spr.z; sc->ceilingz = actor->spr.pos.Z;
deletesprite(actor); deletesprite(actor);
return; return;
} }
@ -4037,14 +4037,14 @@ void handle_se18(DDukeActor *actor, bool morecheck)
if (ps[a2->PlayerIndex()].on_ground == 1) ps[a2->PlayerIndex()].pos.Z -= sc->extra; if (ps[a2->PlayerIndex()].on_ground == 1) ps[a2->PlayerIndex()].pos.Z -= sc->extra;
if (a2->spr.zvel == 0 && a2->spr.statnum != STAT_EFFECTOR && a2->spr.statnum != STAT_PROJECTILE) if (a2->spr.zvel == 0 && a2->spr.statnum != STAT_EFFECTOR && a2->spr.statnum != STAT_PROJECTILE)
{ {
a2->spr.z -= sc->extra; a2->spr.pos.Z -= sc->extra;
a2->floorz = sc->floorz; a2->floorz = sc->floorz;
} }
} }
} }
if (sc->floorz <= actor->spr.z) if (sc->floorz <= actor->spr.pos.Z)
{ {
sc->floorz = actor->spr.z; sc->floorz = actor->spr.pos.Z;
deletesprite(actor); deletesprite(actor);
return; return;
} }
@ -4249,7 +4249,7 @@ void handle_se21(DDukeActor* actor)
if (t[0] == 1) //Decide if the sector should go up or down if (t[0] == 1) //Decide if the sector should go up or down
{ {
actor->spr.zvel = Sgn(actor->spr.z - *lp) * (actor->spr.yvel << 4); actor->spr.zvel = Sgn(actor->spr.pos.Z - *lp) * (actor->spr.yvel << 4);
t[0]++; t[0]++;
} }
@ -4257,9 +4257,9 @@ void handle_se21(DDukeActor* actor)
{ {
*lp += actor->spr.zvel; *lp += actor->spr.zvel;
if (abs(*lp - actor->spr.z) < 1024) if (abs(*lp - actor->spr.pos.Z) < 1024)
{ {
*lp = actor->spr.z; *lp = actor->spr.pos.Z;
deletesprite(actor); deletesprite(actor);
} }
} }
@ -4318,7 +4318,7 @@ void handle_se26(DDukeActor* actor)
{ {
a2->spr.pos.X += l; a2->spr.pos.X += l;
a2->spr.pos.Y += x; a2->spr.pos.Y += x;
a2->spr.z += actor->spr.zvel; a2->spr.pos.Z += actor->spr.zvel;
SetActor(a2, a2->spr.pos); SetActor(a2, a2->spr.pos);
} }
} }
@ -4361,14 +4361,14 @@ void handle_se27(DDukeActor* actor)
} }
else if (ud.recstat == 2 && ps[p].newOwner == nullptr) else if (ud.recstat == 2 && ps[p].newOwner == nullptr)
{ {
if (cansee(actor->spr.pos.X, actor->spr.pos.Y, actor->spr.z, actor->spr.sector(), ps[p].pos.X, ps[p].pos.Y, ps[p].pos.Z, ps[p].cursector)) if (cansee(actor->spr.pos.X, actor->spr.pos.Y, actor->spr.pos.Z, actor->spr.sector(), ps[p].pos.X, ps[p].pos.Y, ps[p].pos.Z, ps[p].cursector))
{ {
if (x < sh) if (x < sh)
{ {
ud.cameraactor = actor; ud.cameraactor = actor;
t[0] = 999; t[0] = 999;
actor->spr.ang += getincangle(actor->spr.ang, getangle(ps[p].pos.X - actor->spr.pos.X, ps[p].pos.Y - actor->spr.pos.Y)) >> 3; actor->spr.ang += getincangle(actor->spr.ang, getangle(ps[p].pos.X - actor->spr.pos.X, ps[p].pos.Y - actor->spr.pos.Y)) >> 3;
actor->spr.yvel = 100 + ((actor->spr.z - ps[p].pos.Z) / 257); actor->spr.yvel = 100 + ((actor->spr.pos.Z - ps[p].pos.Z) / 257);
} }
else if (t[0] == 999) else if (t[0] == 999)
@ -4443,7 +4443,7 @@ void handle_se24(DDukeActor *actor, const int16_t *list1, const int16_t *list2,
if (!(a2->spr.picnum >= CRANE && a2->spr.picnum <= (CRANE + 3))) if (!(a2->spr.picnum >= CRANE && a2->spr.picnum <= (CRANE + 3)))
{ {
if (a2->spr.z > (a2->floorz - (16 << 8))) if (a2->spr.pos.Z > (a2->floorz - (16 << 8)))
{ {
a2->spr.pos.X += x >> shift; a2->spr.pos.X += x >> shift;
a2->spr.pos.Y += l >> shift; a2->spr.pos.Y += l >> shift;
@ -4531,14 +4531,14 @@ void handle_se32(DDukeActor *actor)
{ {
if (actor->spr.ang != 1536) if (actor->spr.ang != 1536)
{ {
if (abs(sc->ceilingz - actor->spr.z) < (actor->spr.yvel << 1)) if (abs(sc->ceilingz - actor->spr.pos.Z) < (actor->spr.yvel << 1))
{ {
sc->ceilingz = actor->spr.z; sc->ceilingz = actor->spr.pos.Z;
callsound(actor->spr.sector(), actor); callsound(actor->spr.sector(), actor);
t[2] = 0; t[2] = 0;
t[0] = 0; t[0] = 0;
} }
else sc->ceilingz += Sgn(actor->spr.z - sc->ceilingz) * actor->spr.yvel; else sc->ceilingz += Sgn(actor->spr.pos.Z - sc->ceilingz) * actor->spr.yvel;
} }
else else
{ {
@ -4556,14 +4556,14 @@ void handle_se32(DDukeActor *actor)
if ((actor->spr.ang & 2047) == 1536) if ((actor->spr.ang & 2047) == 1536)
{ {
if (abs(sc->ceilingz - actor->spr.z) < (actor->spr.yvel << 1)) if (abs(sc->ceilingz - actor->spr.pos.Z) < (actor->spr.yvel << 1))
{ {
t[0] = 0; t[0] = 0;
t[2] = !t[2]; t[2] = !t[2];
callsound(actor->spr.sector(), actor); callsound(actor->spr.sector(), actor);
sc->ceilingz = actor->spr.z; sc->ceilingz = actor->spr.pos.Z;
} }
else sc->ceilingz += Sgn(actor->spr.z - sc->ceilingz) * actor->spr.yvel; else sc->ceilingz += Sgn(actor->spr.pos.Z - sc->ceilingz) * actor->spr.yvel;
} }
else else
{ {
@ -4573,7 +4573,7 @@ void handle_se32(DDukeActor *actor)
t[2] = !t[2]; t[2] = !t[2];
callsound(actor->spr.sector(), actor); callsound(actor->spr.sector(), actor);
} }
else sc->ceilingz -= Sgn(actor->spr.z - t[1]) * actor->spr.yvel; else sc->ceilingz -= Sgn(actor->spr.pos.Z - t[1]) * actor->spr.yvel;
} }
} }
@ -4590,7 +4590,7 @@ void handle_se35(DDukeActor *actor, int SMALLSMOKE, int EXPLOSION2)
int* t = &actor->temp_data[0]; int* t = &actor->temp_data[0];
auto sc = actor->sector(); auto sc = actor->sector();
if (sc->ceilingz > actor->spr.z) if (sc->ceilingz > actor->spr.pos.Z)
for (int j = 0; j < 8; j++) for (int j = 0; j < 8; j++)
{ {
actor->spr.ang += krand() & 511; actor->spr.ang += krand() & 511;
@ -4611,7 +4611,7 @@ void handle_se35(DDukeActor *actor, int SMALLSMOKE, int EXPLOSION2)
sc->ceilingz += actor->spr.yvel; sc->ceilingz += actor->spr.yvel;
if (sc->ceilingz > sc->floorz) if (sc->ceilingz > sc->floorz)
sc->floorz = sc->ceilingz; sc->floorz = sc->ceilingz;
if (sc->ceilingz > actor->spr.z + (32 << 8)) if (sc->ceilingz > actor->spr.pos.Z + (32 << 8))
t[0]++; t[0]++;
break; break;
case 1: case 1:
@ -4691,7 +4691,7 @@ void handle_se130(DDukeActor *actor, int countmax, int EXPLOSION2)
if (k) if (k)
{ {
k->spr.xrepeat = k->spr.yrepeat = 2 + (krand() & 7); k->spr.xrepeat = k->spr.yrepeat = 2 + (krand() & 7);
k->spr.z = sc->floorz - (krand() % x); k->spr.pos.Z = sc->floorz - (krand() % x);
k->spr.ang += 256 - (krand() % 511); k->spr.ang += 256 - (krand() % 511);
k->spr.xvel = krand() & 127; k->spr.xvel = krand() & 127;
ssp(k, CLIPMASK0); ssp(k, CLIPMASK0);
@ -4724,9 +4724,9 @@ void handle_se31(DDukeActor* actor, bool choosedir)
{ {
if (actor->spr.ang != 1536) if (actor->spr.ang != 1536)
{ {
if (abs(sec->floorz - actor->spr.z) < actor->spr.yvel) if (abs(sec->floorz - actor->spr.pos.Z) < actor->spr.yvel)
{ {
sec->floorz = actor->spr.z; sec->floorz = actor->spr.pos.Z;
t[2] = 0; t[2] = 0;
t[0] = 0; t[0] = 0;
if (choosedir) t[3] = actor->spr.hitag; if (choosedir) t[3] = actor->spr.hitag;
@ -4734,7 +4734,7 @@ void handle_se31(DDukeActor* actor, bool choosedir)
} }
else else
{ {
int l = Sgn(actor->spr.z - sec->floorz) * actor->spr.yvel; int l = Sgn(actor->spr.pos.Z - sec->floorz) * actor->spr.yvel;
sec->floorz += l; sec->floorz += l;
DukeSectIterator it(actor->sector()); DukeSectIterator it(actor->sector());
@ -4745,7 +4745,7 @@ void handle_se31(DDukeActor* actor, bool choosedir)
ps[a2->PlayerIndex()].pos.Z += l; ps[a2->PlayerIndex()].pos.Z += l;
if (a2->spr.zvel == 0 && a2->spr.statnum != STAT_EFFECTOR && (!choosedir || a2->spr.statnum != STAT_PROJECTILE)) if (a2->spr.zvel == 0 && a2->spr.statnum != STAT_EFFECTOR && (!choosedir || a2->spr.statnum != STAT_PROJECTILE))
{ {
a2->spr.z += l; a2->spr.pos.Z += l;
a2->floorz = sec->floorz; a2->floorz = sec->floorz;
} }
} }
@ -4774,7 +4774,7 @@ void handle_se31(DDukeActor* actor, bool choosedir)
ps[a2->PlayerIndex()].pos.Z += l; ps[a2->PlayerIndex()].pos.Z += l;
if (a2->spr.zvel == 0 && a2->spr.statnum != STAT_EFFECTOR && (!choosedir || a2->spr.statnum != STAT_PROJECTILE)) if (a2->spr.zvel == 0 && a2->spr.statnum != STAT_EFFECTOR && (!choosedir || a2->spr.statnum != STAT_PROJECTILE))
{ {
a2->spr.z += l; a2->spr.pos.Z += l;
a2->floorz = sec->floorz; a2->floorz = sec->floorz;
} }
} }
@ -4785,7 +4785,7 @@ void handle_se31(DDukeActor* actor, bool choosedir)
if ((actor->spr.ang & 2047) == 1536) if ((actor->spr.ang & 2047) == 1536)
{ {
if (abs(actor->spr.z - sec->floorz) < actor->spr.yvel) if (abs(actor->spr.pos.Z - sec->floorz) < actor->spr.yvel)
{ {
callsound(actor->spr.sector(), actor); callsound(actor->spr.sector(), actor);
t[0] = 0; t[0] = 0;
@ -4794,7 +4794,7 @@ void handle_se31(DDukeActor* actor, bool choosedir)
} }
else else
{ {
int l = Sgn(actor->spr.z - sec->floorz) * actor->spr.yvel; int l = Sgn(actor->spr.pos.Z - sec->floorz) * actor->spr.yvel;
sec->floorz += l; sec->floorz += l;
DukeSectIterator it(actor->sector()); DukeSectIterator it(actor->sector());
@ -4805,7 +4805,7 @@ void handle_se31(DDukeActor* actor, bool choosedir)
ps[a2->PlayerIndex()].pos.Z += l; ps[a2->PlayerIndex()].pos.Z += l;
if (a2->spr.zvel == 0 && a2->spr.statnum != STAT_EFFECTOR && (!choosedir || a2->spr.statnum != STAT_PROJECTILE)) if (a2->spr.zvel == 0 && a2->spr.statnum != STAT_EFFECTOR && (!choosedir || a2->spr.statnum != STAT_PROJECTILE))
{ {
a2->spr.z += l; a2->spr.pos.Z += l;
a2->floorz = sec->floorz; a2->floorz = sec->floorz;
} }
} }
@ -4822,7 +4822,7 @@ void handle_se31(DDukeActor* actor, bool choosedir)
} }
else else
{ {
int l = Sgn(actor->spr.z - t[1]) * actor->spr.yvel; int l = Sgn(actor->spr.pos.Z - t[1]) * actor->spr.yvel;
sec->floorz -= l; sec->floorz -= l;
DukeSectIterator it(actor->sector()); DukeSectIterator it(actor->sector());
@ -4833,7 +4833,7 @@ void handle_se31(DDukeActor* actor, bool choosedir)
ps[a2->PlayerIndex()].pos.Z -= l; ps[a2->PlayerIndex()].pos.Z -= l;
if (a2->spr.zvel == 0 && a2->spr.statnum != STAT_EFFECTOR && (!choosedir || a2->spr.statnum != STAT_PROJECTILE)) if (a2->spr.zvel == 0 && a2->spr.statnum != STAT_EFFECTOR && (!choosedir || a2->spr.statnum != STAT_PROJECTILE))
{ {
a2->spr.z -= l; a2->spr.pos.Z -= l;
a2->floorz = sec->floorz; a2->floorz = sec->floorz;
} }
} }
@ -4861,7 +4861,7 @@ void getglobalz(DDukeActor* actor)
auto cc = actor->spr.cstat2; auto cc = actor->spr.cstat2;
actor->spr.cstat2 |= CSTAT2_SPRITE_NOFIND; // don't clip against self. getzrange cannot detect this because it only receives a coordinate. actor->spr.cstat2 |= CSTAT2_SPRITE_NOFIND; // don't clip against self. getzrange cannot detect this because it only receives a coordinate.
getzrange({ actor->spr.pos.X, actor->spr.pos.Y, actor->spr.z - (FOURSLEIGHT) }, actor->spr.sector(), &actor->ceilingz, hz, &actor->floorz, lz, zr, CLIPMASK0); getzrange({ actor->spr.pos.X, actor->spr.pos.Y, actor->spr.pos.Z - (FOURSLEIGHT) }, actor->spr.sector(), &actor->ceilingz, hz, &actor->floorz, lz, zr, CLIPMASK0);
actor->spr.cstat2 = cc; actor->spr.cstat2 = cc;
if( lz.type == kHitSprite && (lz.actor()->spr.cstat & CSTAT_SPRITE_ALIGNMENT_MASK) == 0 ) if( lz.type == kHitSprite && (lz.actor()->spr.cstat & CSTAT_SPRITE_ALIGNMENT_MASK) == 0 )
@ -4924,7 +4924,7 @@ void makeitfall(DDukeActor* actor)
if ((actor->spr.statnum == STAT_ACTOR || actor->spr.statnum == STAT_PLAYER || actor->spr.statnum == STAT_ZOMBIEACTOR || actor->spr.statnum == STAT_STANDABLE)) if ((actor->spr.statnum == STAT_ACTOR || actor->spr.statnum == STAT_PLAYER || actor->spr.statnum == STAT_ZOMBIEACTOR || actor->spr.statnum == STAT_STANDABLE))
{ {
Collision c; Collision c;
getzrange({ actor->spr.pos.X, actor->spr.pos.Y, actor->spr.z - (FOURSLEIGHT) }, actor->spr.sector(), &actor->ceilingz, c, &actor->floorz, c, 127, CLIPMASK0); getzrange({ actor->spr.pos.X, actor->spr.pos.Y, actor->spr.pos.Z - (FOURSLEIGHT) }, actor->spr.sector(), &actor->ceilingz, c, &actor->floorz, c, 127, CLIPMASK0);
} }
else else
{ {
@ -4932,18 +4932,18 @@ void makeitfall(DDukeActor* actor)
actor->floorz = actor->spr.sector()->floorz; actor->floorz = actor->spr.sector()->floorz;
} }
if( actor->spr.z < actor->floorz-(FOURSLEIGHT) ) if( actor->spr.pos.Z < actor->floorz-(FOURSLEIGHT) )
{ {
if( actor->spr.sector()->lotag == 2 && actor->spr.zvel > 3122 ) if( actor->spr.sector()->lotag == 2 && actor->spr.zvel > 3122 )
actor->spr.zvel = 3144; actor->spr.zvel = 3144;
if(actor->spr.zvel < 6144) if(actor->spr.zvel < 6144)
actor->spr.zvel += c; actor->spr.zvel += c;
else actor->spr.zvel = 6144; else actor->spr.zvel = 6144;
actor->spr.z += actor->spr.zvel; actor->spr.pos.Z += actor->spr.zvel;
} }
if( actor->spr.z >= actor->floorz-(FOURSLEIGHT) ) if( actor->spr.pos.Z >= actor->floorz-(FOURSLEIGHT) )
{ {
actor->spr.z = actor->floorz - FOURSLEIGHT; actor->spr.pos.Z = actor->floorz - FOURSLEIGHT;
actor->spr.zvel = 0; actor->spr.zvel = 0;
} }
} }
@ -5006,7 +5006,7 @@ int furthestangle(DDukeActor *actor, int angs)
for (j = actor->spr.ang; j < (2048 + actor->spr.ang); j += angincs) for (j = actor->spr.ang; j < (2048 + actor->spr.ang); j += angincs)
{ {
hitscan({ actor->spr.pos.X, actor->spr.pos.Y, actor->spr.z - (8 << 8) }, actor->spr.sector(), { bcos(j), bsin(j), 0 }, hit, CLIPMASK1); hitscan({ actor->spr.pos.X, actor->spr.pos.Y, actor->spr.pos.Z - (8 << 8) }, actor->spr.sector(), { bcos(j), bsin(j), 0 }, hit, CLIPMASK1);
d = abs(hit.hitpos.X - actor->spr.pos.X) + abs(hit.hitpos.Y - actor->spr.pos.Y); d = abs(hit.hitpos.X - actor->spr.pos.X) + abs(hit.hitpos.Y - actor->spr.pos.Y);
@ -5039,13 +5039,13 @@ int furthestcanseepoint(DDukeActor *actor, DDukeActor* tosee, int* dax, int* day
for (j = tosee->spr.ang; j < (2048 + tosee->spr.ang); j += (angincs - (krand() & 511))) for (j = tosee->spr.ang; j < (2048 + tosee->spr.ang); j += (angincs - (krand() & 511)))
{ {
hitscan({ tosee->spr.pos.X, tosee->spr.pos.Y, tosee->spr.z - (16 << 8) }, tosee->spr.sector(), { bcos(j), bsin(j), 16384 - (krand() & 32767) }, hit, CLIPMASK1); hitscan({ tosee->spr.pos.X, tosee->spr.pos.Y, tosee->spr.pos.Z - (16 << 8) }, tosee->spr.sector(), { bcos(j), bsin(j), 16384 - (krand() & 32767) }, hit, CLIPMASK1);
d = abs(hit.hitpos.X - tosee->spr.pos.X) + abs(hit.hitpos.Y - tosee->spr.pos.Y); d = abs(hit.hitpos.X - tosee->spr.pos.X) + abs(hit.hitpos.Y - tosee->spr.pos.Y);
da = abs(hit.hitpos.X - actor->spr.pos.X) + abs(hit.hitpos.Y - actor->spr.pos.Y); da = abs(hit.hitpos.X - actor->spr.pos.X) + abs(hit.hitpos.Y - actor->spr.pos.Y);
if (d < da && hit.hitSector) if (d < da && hit.hitSector)
if (cansee(hit.hitpos.X, hit.hitpos.Y, hit.hitpos.Z, hit.hitSector, actor->spr.pos.X, actor->spr.pos.Y, actor->spr.z - (16 << 8), actor->spr.sector())) if (cansee(hit.hitpos.X, hit.hitpos.Y, hit.hitpos.Z, hit.hitSector, actor->spr.pos.X, actor->spr.pos.Y, actor->spr.pos.Z - (16 << 8), actor->spr.sector()))
{ {
*dax = hit.hitpos.X; *dax = hit.hitpos.X;
*day = hit.hitpos.Y; *day = hit.hitpos.Y;
@ -5084,7 +5084,7 @@ void alterang(int ang, DDukeActor* actor, int playernum)
// NOTE: looks like 'Owner' is set to target sprite ID... // NOTE: looks like 'Owner' is set to target sprite ID...
if (holoduke && cansee(holoduke->spr.pos.X, holoduke->spr.pos.Y, holoduke->spr.z, holoduke->spr.sector(), actor->spr.pos.X, actor->spr.pos.Y, actor->spr.z, actor->spr.sector())) if (holoduke && cansee(holoduke->spr.pos.X, holoduke->spr.pos.Y, holoduke->spr.pos.Z, holoduke->spr.sector(), actor->spr.pos.X, actor->spr.pos.Y, actor->spr.pos.Z, actor->spr.sector()))
actor->SetOwner(holoduke); actor->SetOwner(holoduke);
else actor->SetOwner(ps[playernum].GetActor()); else actor->SetOwner(ps[playernum].GetActor());
@ -5166,16 +5166,16 @@ void fall_common(DDukeActor *actor, int playernum, int JIBS6, int DRONE, int BLO
} }
else actor->cgg--; else actor->cgg--;
if (actor->spr.z < (actor->floorz - FOURSLEIGHT)) if (actor->spr.pos.Z < (actor->floorz - FOURSLEIGHT))
{ {
actor->spr.zvel += c; actor->spr.zvel += c;
actor->spr.z += actor->spr.zvel; actor->spr.pos.Z += actor->spr.zvel;
if (actor->spr.zvel > 6144) actor->spr.zvel = 6144; if (actor->spr.zvel > 6144) actor->spr.zvel = 6144;
} }
else else
{ {
actor->spr.z = actor->floorz - FOURSLEIGHT; actor->spr.pos.Z = actor->floorz - FOURSLEIGHT;
if (badguy(actor) || (actor->spr.picnum == TILE_APLAYER && actor->GetOwner())) if (badguy(actor) || (actor->spr.picnum == TILE_APLAYER && actor->GetOwner()))
{ {
@ -5217,7 +5217,7 @@ void fall_common(DDukeActor *actor, int playernum, int JIBS6, int DRONE, int BLO
} }
} }
if (actor->spr.sector()->lotag == 1) if (actor->spr.sector()->lotag == 1)
actor->spr.z += gs.actorinfo[actor->spr.picnum].falladjustz; actor->spr.pos.Z += gs.actorinfo[actor->spr.picnum].falladjustz;
else actor->spr.zvel = 0; else actor->spr.zvel = 0;
} }
} }

View file

@ -267,7 +267,7 @@ void hitradius_d(DDukeActor* actor, int r, int hp1, int hp2, int hp3, int h
while (auto dasectp = search.GetNext()) while (auto dasectp = search.GetNext())
{ {
if (((dasectp->ceilingz - actor->spr.z) >> 8) < r) if (((dasectp->ceilingz - actor->spr.pos.Z) >> 8) < r)
{ {
auto wal = dasectp->firstWall(); auto wal = dasectp->firstWall();
int d = abs(wal->pos.X - actor->spr.pos.X) + abs(wal->pos.Y - actor->spr.pos.Y); int d = abs(wal->pos.X - actor->spr.pos.X) + abs(wal->pos.Y - actor->spr.pos.Y);
@ -294,8 +294,8 @@ void hitradius_d(DDukeActor* actor, int r, int hp1, int hp2, int hp3, int h
int y1 = (((wal.pos.Y + wal.point2Wall()->pos.Y) >> 1) + actor->spr.pos.Y) >> 1; int y1 = (((wal.pos.Y + wal.point2Wall()->pos.Y) >> 1) + actor->spr.pos.Y) >> 1;
sectortype* sect = wal.sectorp(); sectortype* sect = wal.sectorp();
updatesector(x1, y1, &sect); updatesector(x1, y1, &sect);
if (sect && cansee(x1, y1, actor->spr.z, sect, actor->spr.pos.X, actor->spr.pos.Y, actor->spr.z, actor->spr.sector())) if (sect && cansee(x1, y1, actor->spr.pos.Z, sect, actor->spr.pos.X, actor->spr.pos.Y, actor->spr.pos.Z, actor->spr.sector()))
fi.checkhitwall(actor, &wal, wal.pos.X, wal.pos.Y, actor->spr.z, actor->spr.picnum); fi.checkhitwall(actor, &wal, wal.pos.X, wal.pos.Y, actor->spr.pos.Z, actor->spr.picnum);
} }
} }
} }
@ -327,7 +327,7 @@ void hitradius_d(DDukeActor* actor, int r, int hp1, int hp2, int hp3, int h
if (actor->spr.picnum != SHRINKSPARK || (act2->spr.cstat & CSTAT_SPRITE_BLOCK_ALL)) if (actor->spr.picnum != SHRINKSPARK || (act2->spr.cstat & CSTAT_SPRITE_BLOCK_ALL))
if (dist(actor, act2) < r) if (dist(actor, act2) < r)
{ {
if (badguy(act2) && !cansee(act2->spr.pos.X, act2->spr.pos.Y, act2->spr.z + q, act2->spr.sector(), actor->spr.pos.X, actor->spr.pos.Y, actor->spr.z + q, actor->spr.sector())) if (badguy(act2) && !cansee(act2->spr.pos.X, act2->spr.pos.Y, act2->spr.pos.Z + q, act2->spr.sector(), actor->spr.pos.X, actor->spr.pos.Y, actor->spr.pos.Z + q, actor->spr.sector()))
continue; continue;
fi.checkhitsprite(act2, actor); fi.checkhitsprite(act2, actor);
} }
@ -343,11 +343,11 @@ void hitradius_d(DDukeActor* actor, int r, int hp1, int hp2, int hp3, int h
continue; continue;
} }
if (act2->spr.picnum == APLAYER) act2->spr.z -= gs.playerheight; if (act2->spr.picnum == APLAYER) act2->spr.pos.Z -= gs.playerheight;
int d = dist(actor, act2); int d = dist(actor, act2);
if (act2->spr.picnum == APLAYER) act2->spr.z += gs.playerheight; if (act2->spr.picnum == APLAYER) act2->spr.pos.Z += gs.playerheight;
if (d < r && cansee(act2->spr.pos.X, act2->spr.pos.Y, act2->spr.z - (8 << 8), act2->spr.sector(), actor->spr.pos.X, actor->spr.pos.Y, actor->spr.z - (12 << 8), actor->spr.sector())) if (d < r && cansee(act2->spr.pos.X, act2->spr.pos.Y, act2->spr.pos.Z - (8 << 8), act2->spr.sector(), actor->spr.pos.X, actor->spr.pos.Y, actor->spr.pos.Z - (12 << 8), actor->spr.sector()))
{ {
act2->ang = getangle(act2->spr.pos.X - actor->spr.pos.X, act2->spr.pos.Y - actor->spr.pos.Y); act2->ang = getangle(act2->spr.pos.X - actor->spr.pos.X, act2->spr.pos.Y - actor->spr.pos.Y);
@ -449,7 +449,7 @@ int movesprite_ex_d(DDukeActor* actor, int xchange, int ychange, int zchange, un
{ {
actor->spr.pos.X += (xchange * TICSPERFRAME) >> 2; actor->spr.pos.X += (xchange * TICSPERFRAME) >> 2;
actor->spr.pos.Y += (ychange * TICSPERFRAME) >> 2; actor->spr.pos.Y += (ychange * TICSPERFRAME) >> 2;
actor->spr.z += (zchange * TICSPERFRAME) >> 2; actor->spr.pos.Z += (zchange * TICSPERFRAME) >> 2;
if (bg) if (bg)
SetActor(actor, actor->spr.pos); SetActor(actor, actor->spr.pos);
return result.setNone(); return result.setNone();
@ -508,9 +508,9 @@ int movesprite_ex_d(DDukeActor* actor, int xchange, int ychange, int zchange, un
if (dasectp != nullptr) if (dasectp != nullptr)
if (dasectp != actor->spr.sector()) if (dasectp != actor->spr.sector())
ChangeActorSect(actor, dasectp); ChangeActorSect(actor, dasectp);
int daz = actor->spr.z + ((zchange * TICSPERFRAME) >> 3); int daz = actor->spr.pos.Z + ((zchange * TICSPERFRAME) >> 3);
if ((daz > actor->ceilingz) && (daz <= actor->floorz)) if ((daz > actor->ceilingz) && (daz <= actor->floorz))
actor->spr.z = daz; actor->spr.pos.Z = daz;
else if (result.type == kHitNone) else if (result.type == kHitNone)
return result.setSector(dasectp); return result.setSector(dasectp);
@ -554,7 +554,7 @@ void guts_d(DDukeActor* actor, int gtype, int n, int p)
sx = sy = 8; sx = sy = 8;
else sx = sy = 32; else sx = sy = 32;
gutz = actor->spr.z - (8 << 8); gutz = actor->spr.pos.Z - (8 << 8);
floorz = getflorzofslopeptr(actor->spr.sector(), actor->spr.pos.X, actor->spr.pos.Y); floorz = getflorzofslopeptr(actor->spr.sector(), actor->spr.pos.X, actor->spr.pos.Y);
if (gutz > (floorz - (8 << 8))) if (gutz > (floorz - (8 << 8)))
@ -641,13 +641,13 @@ void movefta_d(void)
int r1 = krand(); int r1 = krand();
int r2 = krand(); int r2 = krand();
j = cansee(sx, sy, act->spr.z - (r2 % (52 << 8)), act->spr.sector(), px, py, ps[p].oposz - (r1 % (32 << 8)), ps[p].cursector); j = cansee(sx, sy, act->spr.pos.Z - (r2 % (52 << 8)), act->spr.sector(), px, py, ps[p].oposz - (r1 % (32 << 8)), ps[p].cursector);
} }
else else
{ {
int r1 = krand(); int r1 = krand();
int r2 = krand(); int r2 = krand();
j = cansee(act->spr.pos.X, act->spr.pos.Y, act->spr.z - ((r2 & 31) << 8), act->spr.sector(), ps[p].oposx, ps[p].oposy, ps[p].oposz - ((r1 & 31) << 8), ps[p].cursector); j = cansee(act->spr.pos.X, act->spr.pos.Y, act->spr.pos.Z - ((r2 & 31) << 8), act->spr.sector(), ps[p].oposx, ps[p].oposy, ps[p].oposz - ((r1 & 31) << 8), ps[p].cursector);
} }
@ -843,7 +843,7 @@ void movefallers_d(void)
if (act->temp_data[0] == 0) if (act->temp_data[0] == 0)
{ {
act->spr.z -= (16 << 8); act->spr.pos.Z -= (16 << 8);
act->temp_data[1] = act->spr.ang; act->temp_data[1] = act->spr.ang;
x = act->spr.extra; x = act->spr.extra;
j = fi.ifhitbyweapon(act); j = fi.ifhitbyweapon(act);
@ -874,7 +874,7 @@ void movefallers_d(void)
} }
} }
act->spr.ang = act->temp_data[1]; act->spr.ang = act->temp_data[1];
act->spr.z += (16 << 8); act->spr.pos.Z += (16 << 8);
} }
else if (act->temp_data[0] == 1) else if (act->temp_data[0] == 1)
{ {
@ -904,14 +904,14 @@ void movefallers_d(void)
x = gs.gravity; x = gs.gravity;
} }
if (act->spr.z < (sectp->floorz - FOURSLEIGHT)) if (act->spr.pos.Z < (sectp->floorz - FOURSLEIGHT))
{ {
act->spr.zvel += x; act->spr.zvel += x;
if (act->spr.zvel > 6144) if (act->spr.zvel > 6144)
act->spr.zvel = 6144; act->spr.zvel = 6144;
act->spr.z += act->spr.zvel; act->spr.pos.Z += act->spr.zvel;
} }
if ((sectp->floorz - act->spr.z) < (16 << 8)) if ((sectp->floorz - act->spr.pos.Z) < (16 << 8))
{ {
j = 1 + (krand() & 7); j = 1 + (krand() & 7);
for (x = 0; x < j; x++) RANDOMSCRAP(act); for (x = 0; x < j; x++) RANDOMSCRAP(act);
@ -1008,7 +1008,7 @@ static void movetripbomb(DDukeActor *actor)
actor->temp_data[3] = actor->spr.pos.X; actor->temp_data[4] = actor->spr.pos.Y; actor->temp_data[3] = actor->spr.pos.X; actor->temp_data[4] = actor->spr.pos.Y;
actor->spr.pos.X += bcos(actor->temp_data[5], -9); actor->spr.pos.X += bcos(actor->temp_data[5], -9);
actor->spr.pos.Y += bsin(actor->temp_data[5], -9); actor->spr.pos.Y += bsin(actor->temp_data[5], -9);
actor->spr.z -= (3 << 8); actor->spr.pos.Z -= (3 << 8);
// Laser fix from EDuke32. // Laser fix from EDuke32.
auto const oldSect = actor->spr.sector(); auto const oldSect = actor->spr.sector();
@ -1034,7 +1034,7 @@ static void movetripbomb(DDukeActor *actor)
{ {
SetActor(spawned, spawned->spr.pos); SetActor(spawned, spawned->spr.pos);
spawned->spr.hitag = actor->spr.hitag; spawned->spr.hitag = actor->spr.hitag;
spawned->temp_data[1] = spawned->spr.z; spawned->temp_data[1] = spawned->spr.pos.Z;
if (x < 1024) if (x < 1024)
{ {
@ -1060,7 +1060,7 @@ static void movetripbomb(DDukeActor *actor)
actor->temp_data[0]++; actor->temp_data[0]++;
actor->spr.pos.X = actor->temp_data[3]; actor->spr.pos.Y = actor->temp_data[4]; actor->spr.pos.X = actor->temp_data[3]; actor->spr.pos.Y = actor->temp_data[4];
actor->spr.z += (3 << 8); actor->spr.pos.Z += (3 << 8);
ChangeActorSect(actor, oldSect); ChangeActorSect(actor, oldSect);
actor->temp_data[3] = 0; actor->temp_data[3] = 0;
if (hit && lTripBombControl & TRIPBOMB_TRIPWIRE) if (hit && lTripBombControl & TRIPBOMB_TRIPWIRE)
@ -1078,13 +1078,13 @@ static void movetripbomb(DDukeActor *actor)
actor->temp_data[3] = actor->spr.pos.X; actor->temp_data[4] = actor->spr.pos.Y; actor->temp_data[3] = actor->spr.pos.X; actor->temp_data[4] = actor->spr.pos.Y;
actor->spr.pos.X += bcos(actor->temp_data[5], -9); actor->spr.pos.X += bcos(actor->temp_data[5], -9);
actor->spr.pos.Y += bsin(actor->temp_data[5], -9); actor->spr.pos.Y += bsin(actor->temp_data[5], -9);
actor->spr.z -= (3 << 8); actor->spr.pos.Z -= (3 << 8);
SetActor(actor, actor->spr.pos); SetActor(actor, actor->spr.pos);
x = hitasprite(actor, nullptr); x = hitasprite(actor, nullptr);
actor->spr.pos.X = actor->temp_data[3]; actor->spr.pos.Y = actor->temp_data[4]; actor->spr.pos.X = actor->temp_data[3]; actor->spr.pos.Y = actor->temp_data[4];
actor->spr.z += (3 << 8); actor->spr.pos.Z += (3 << 8);
SetActor(actor, actor->spr.pos); SetActor(actor, actor->spr.pos);
if (actor->lastvx != x && lTripBombControl & TRIPBOMB_TRIPWIRE) if (actor->lastvx != x && lTripBombControl & TRIPBOMB_TRIPWIRE)
@ -1142,7 +1142,7 @@ static void movefireext(DDukeActor* actor)
for (int k = 0; k < 16; k++) for (int k = 0; k < 16; k++)
{ {
auto spawned = EGS(actor->spr.sector(), actor->spr.pos.X, actor->spr.pos.Y, actor->spr.z - (krand() % (48 << 8)), SCRAP3 + (krand() & 3), -8, 48, 48, krand() & 2047, (krand() & 63) + 64, -(krand() & 4095) - (actor->spr.zvel >> 2), actor, 5); auto spawned = EGS(actor->spr.sector(), actor->spr.pos.X, actor->spr.pos.Y, actor->spr.pos.Z - (krand() % (48 << 8)), SCRAP3 + (krand() & 3), -8, 48, 48, krand() & 2047, (krand() & 63) + 64, -(krand() & 4095) - (actor->spr.zvel >> 2), actor, 5);
if(spawned) spawned->spr.pal = 2; if(spawned) spawned->spr.pal = 2;
} }
@ -1463,7 +1463,7 @@ static bool movefireball(DDukeActor* actor)
FireProj* proj = &trail->fproj; FireProj* proj = &trail->fproj;
ball->spr.pos.X = proj->x; ball->spr.pos.X = proj->x;
ball->spr.pos.Y = proj->y; ball->spr.pos.Y = proj->y;
ball->spr.z = proj->z; ball->spr.pos.Z = proj->z;
ball->spr.xvel = proj->xv; ball->spr.xvel = proj->xv;
ball->spr.yvel = proj->yv; ball->spr.yvel = proj->yv;
ball->spr.zvel = proj->zv; ball->spr.zvel = proj->zv;
@ -1473,7 +1473,7 @@ static bool movefireball(DDukeActor* actor)
ball->spr.cstat = actor->spr.cstat; ball->spr.cstat = actor->spr.cstat;
ball->spr.extra = 0; ball->spr.extra = 0;
ball->fproj = { ball->spr.pos.X, ball->spr.pos.Y, ball->spr.z, ball->spr.xvel, ball->spr.yvel, ball->spr.zvel }; ball->fproj = { ball->spr.pos.X, ball->spr.pos.Y, ball->spr.pos.Z, ball->spr.xvel, ball->spr.yvel, ball->spr.zvel };
ChangeActorStat(ball, STAT_PROJECTILE); ChangeActorStat(ball, STAT_PROJECTILE);
} }
@ -1568,7 +1568,7 @@ static bool weaponhitwall(DDukeActor *proj, walltype* wal, const vec3_t &oldpos)
else else
{ {
SetActor(proj, oldpos); SetActor(proj, oldpos);
fi.checkhitwall(proj, wal, proj->spr.pos.X, proj->spr.pos.Y, proj->spr.z, proj->spr.picnum); fi.checkhitwall(proj, wal, proj->spr.pos.X, proj->spr.pos.Y, proj->spr.pos.Z, proj->spr.picnum);
if (proj->spr.picnum == FREEZEBLAST) if (proj->spr.picnum == FREEZEBLAST)
{ {
@ -1669,7 +1669,7 @@ static void weaponcommon_d(DDukeActor* proj)
if (proj->picnum != BOSS2 && proj->spr.xrepeat >= 10 && proj->spr.sector()->lotag != 2) if (proj->picnum != BOSS2 && proj->spr.xrepeat >= 10 && proj->spr.sector()->lotag != 2)
{ {
auto spawned = spawn(proj, SMALLSMOKE); auto spawned = spawn(proj, SMALLSMOKE);
if (spawned) spawned->spr.z += (1 << 8); if (spawned) spawned->spr.pos.Z += (1 << 8);
} }
break; break;
@ -1695,14 +1695,14 @@ static void weaponcommon_d(DDukeActor* proj)
if (coll.type != kHitSprite && proj->spr.picnum != FREEZEBLAST) if (coll.type != kHitSprite && proj->spr.picnum != FREEZEBLAST)
{ {
if (proj->spr.z < proj->ceilingz) if (proj->spr.pos.Z < proj->ceilingz)
{ {
coll.setSector(proj->spr.sector()); coll.setSector(proj->spr.sector());
proj->spr.zvel = -1; proj->spr.zvel = -1;
} }
else else
if ((proj->spr.z > proj->floorz && proj->spr.sector()->lotag != 1) || if ((proj->spr.pos.Z > proj->floorz && proj->spr.sector()->lotag != 1) ||
(proj->spr.z > proj->floorz + (16 << 8) && proj->spr.sector()->lotag == 1)) (proj->spr.pos.Z > proj->floorz + (16 << 8) && proj->spr.sector()->lotag == 1))
{ {
coll.setSector(proj->spr.sector()); coll.setSector(proj->spr.sector());
if (proj->spr.sector()->lotag != 1) if (proj->spr.sector()->lotag != 1)
@ -1717,7 +1717,7 @@ static void weaponcommon_d(DDukeActor* proj)
auto spawned = EGS(proj->spr.sector(), auto spawned = EGS(proj->spr.sector(),
proj->spr.pos.X + MulScale(k, bcos(proj->spr.ang), 9), proj->spr.pos.X + MulScale(k, bcos(proj->spr.ang), 9),
proj->spr.pos.Y + MulScale(k, bsin(proj->spr.ang), 9), proj->spr.pos.Y + MulScale(k, bsin(proj->spr.ang), 9),
proj->spr.z + ((k * Sgn(proj->spr.zvel)) * abs(proj->spr.zvel / 24)), FIRELASER, -40 + (k << 2), proj->spr.pos.Z + ((k * Sgn(proj->spr.zvel)) * abs(proj->spr.zvel / 24)), FIRELASER, -40 + (k << 2),
proj->spr.xrepeat, proj->spr.yrepeat, 0, 0, 0, proj->GetOwner(), 5); proj->spr.xrepeat, proj->spr.yrepeat, 0, 0, 0, proj->GetOwner(), 5);
if (spawned) if (spawned)
{ {
@ -1779,7 +1779,7 @@ static void weaponcommon_d(DDukeActor* proj)
{ {
if (proj->spr.zvel < 0) if (proj->spr.zvel < 0)
{ {
k->spr.cstat |= CSTAT_SPRITE_YFLIP; k->spr.z += (72 << 8); k->spr.cstat |= CSTAT_SPRITE_YFLIP; k->spr.pos.Z += (72 << 8);
} }
} }
} }
@ -1942,7 +1942,7 @@ void movetransports_d(void)
ps[p].bobposx = ps[p].oposx = ps[p].pos.X = Owner->spr.pos.X; ps[p].bobposx = ps[p].oposx = ps[p].pos.X = Owner->spr.pos.X;
ps[p].bobposy = ps[p].oposy = ps[p].pos.Y = Owner->spr.pos.Y; ps[p].bobposy = ps[p].oposy = ps[p].pos.Y = Owner->spr.pos.Y;
ps[p].oposz = ps[p].pos.Z = Owner->spr.z - gs.playerheight; ps[p].oposz = ps[p].pos.Z = Owner->spr.pos.Z - gs.playerheight;
ChangeActorSect(act2, Owner->sector()); ChangeActorSect(act2, Owner->sector());
ps[p].setCursector(act2->spr.sector()); ps[p].setCursector(act2->spr.sector());
@ -1958,7 +1958,7 @@ void movetransports_d(void)
} }
else if (!(sectlotag == 1 && ps[p].on_ground == 1)) break; else if (!(sectlotag == 1 && ps[p].on_ground == 1)) break;
if (onfloorz == 0 && abs(act->spr.z - ps[p].pos.Z) < 6144) if (onfloorz == 0 && abs(act->spr.pos.Z - ps[p].pos.Z) < 6144)
if ((ps[p].jetpack_on == 0) || (ps[p].jetpack_on && (PlayerInput(p, SB_JUMP))) || if ((ps[p].jetpack_on == 0) || (ps[p].jetpack_on && (PlayerInput(p, SB_JUMP))) ||
(ps[p].jetpack_on && PlayerInput(p, SB_CROUCH))) (ps[p].jetpack_on && PlayerInput(p, SB_CROUCH)))
{ {
@ -1966,8 +1966,8 @@ void movetransports_d(void)
ps[p].oposy = ps[p].pos.Y += Owner->spr.pos.Y - act->spr.pos.Y; ps[p].oposy = ps[p].pos.Y += Owner->spr.pos.Y - act->spr.pos.Y;
if (ps[p].jetpack_on && (PlayerInput(p, SB_JUMP) || ps[p].jetpack_on < 11)) if (ps[p].jetpack_on && (PlayerInput(p, SB_JUMP) || ps[p].jetpack_on < 11))
ps[p].pos.Z = Owner->spr.z - 6144; ps[p].pos.Z = Owner->spr.pos.Z - 6144;
else ps[p].pos.Z = Owner->spr.z + 6144; else ps[p].pos.Z = Owner->spr.pos.Z + 6144;
ps[p].oposz = ps[p].pos.Z; ps[p].oposz = ps[p].pos.Z;
auto pa = ps[p].GetActor(); auto pa = ps[p].GetActor();
@ -2035,7 +2035,7 @@ void movetransports_d(void)
for (int l = 0; l < 9; l++) for (int l = 0; l < 9; l++)
{ {
auto q = spawn(ps[p].GetActor(), WATERBUBBLE); auto q = spawn(ps[p].GetActor(), WATERBUBBLE);
if (q) q->spr.z += krand() & 16383; if (q) q->spr.pos.Z += krand() & 16383;
} }
} }
} }
@ -2068,13 +2068,13 @@ void movetransports_d(void)
{ {
warpspriteto = 0; warpspriteto = 0;
if (ll && sectlotag == 2 && act2->spr.z < (sectp->ceilingz + ll)) if (ll && sectlotag == 2 && act2->spr.pos.Z < (sectp->ceilingz + ll))
warpspriteto = 1; warpspriteto = 1;
if (ll && sectlotag == 1 && act2->spr.z > (sectp->floorz - ll)) if (ll && sectlotag == 1 && act2->spr.pos.Z > (sectp->floorz - ll))
warpspriteto = 1; warpspriteto = 1;
if (sectlotag == 0 && (onfloorz || abs(act2->spr.z - act->spr.z) < 4096)) if (sectlotag == 0 && (onfloorz || abs(act2->spr.pos.Z - act->spr.pos.Z) < 4096))
{ {
if ((!Owner || Owner->GetOwner() != Owner) && onfloorz && act->temp_data[0] > 0 && act2->spr.statnum != STAT_MISC) if ((!Owner || Owner->GetOwner() != Owner) && onfloorz && act->temp_data[0] > 0 && act2->spr.statnum != STAT_MISC)
{ {
@ -2134,7 +2134,7 @@ void movetransports_d(void)
{ {
act2->spr.pos.X += (Owner->spr.pos.X - act->spr.pos.X); act2->spr.pos.X += (Owner->spr.pos.X - act->spr.pos.X);
act2->spr.pos.Y += (Owner->spr.pos.Y - act->spr.pos.Y); act2->spr.pos.Y += (Owner->spr.pos.Y - act->spr.pos.Y);
act2->spr.z -= act->spr.z - Owner->sector()->floorz; act2->spr.pos.Z -= act->spr.pos.Z - Owner->sector()->floorz;
act2->spr.ang = Owner->spr.ang; act2->spr.ang = Owner->spr.ang;
act2->spr.backupang(); act2->spr.backupang();
@ -2161,7 +2161,7 @@ void movetransports_d(void)
{ {
act2->spr.pos.X += (Owner->spr.pos.X - act->spr.pos.X); act2->spr.pos.X += (Owner->spr.pos.X - act->spr.pos.X);
act2->spr.pos.Y += (Owner->spr.pos.Y - act->spr.pos.Y); act2->spr.pos.Y += (Owner->spr.pos.Y - act->spr.pos.Y);
act2->spr.z = Owner->spr.z + 4096; act2->spr.pos.Z = Owner->spr.pos.Z + 4096;
act2->spr.backupz(); act2->spr.backupz();
@ -2171,7 +2171,7 @@ void movetransports_d(void)
case 1: case 1:
act2->spr.pos.X += (Owner->spr.pos.X - act->spr.pos.X); act2->spr.pos.X += (Owner->spr.pos.X - act->spr.pos.X);
act2->spr.pos.Y += (Owner->spr.pos.Y - act->spr.pos.Y); act2->spr.pos.Y += (Owner->spr.pos.Y - act->spr.pos.Y);
act2->spr.z = Owner->sector()->ceilingz + ll; act2->spr.pos.Z = Owner->sector()->ceilingz + ll;
act2->spr.backupz(); act2->spr.backupz();
@ -2181,7 +2181,7 @@ void movetransports_d(void)
case 2: case 2:
act2->spr.pos.X += (Owner->spr.pos.X - act->spr.pos.X); act2->spr.pos.X += (Owner->spr.pos.X - act->spr.pos.X);
act2->spr.pos.Y += (Owner->spr.pos.Y - act->spr.pos.Y); act2->spr.pos.Y += (Owner->spr.pos.Y - act->spr.pos.Y);
act2->spr.z = Owner->sector()->floorz - ll; act2->spr.pos.Z = Owner->sector()->floorz - ll;
act2->spr.backupz(); act2->spr.backupz();
@ -2268,7 +2268,7 @@ static void greenslime(DDukeActor *actor)
return; return;
for (j = 16; j >= 0; j--) for (j = 16; j >= 0; j--)
{ {
auto k = EGS(actor->spr.sector(), actor->spr.pos.X, actor->spr.pos.Y, actor->spr.z, GLASSPIECES + (j % 3), -32, 36, 36, krand() & 2047, 32 + (krand() & 63), 1024 - (krand() & 1023), actor, 5); auto k = EGS(actor->spr.sector(), actor->spr.pos.X, actor->spr.pos.Y, actor->spr.pos.Z, GLASSPIECES + (j % 3), -32, 36, 36, krand() & 2047, 32 + (krand() & 63), 1024 - (krand() & 1023), actor, 5);
k->spr.pal = 1; k->spr.pal = 1;
} }
ps[p].actors_killed++; ps[p].actors_killed++;
@ -2306,7 +2306,7 @@ static void greenslime(DDukeActor *actor)
{ {
for (x = 0; x < 8; x++) for (x = 0; x < 8; x++)
{ {
auto j = EGS(actor->spr.sector(), actor->spr.pos.X, actor->spr.pos.Y, actor->spr.z - (8 << 8), SCRAP3 + (krand() & 3), -8, 48, 48, krand() & 2047, (krand() & 63) + 64, -(krand() & 4095) - (actor->spr.zvel >> 2), actor, 5); auto j = EGS(actor->spr.sector(), actor->spr.pos.X, actor->spr.pos.Y, actor->spr.pos.Z - (8 << 8), SCRAP3 + (krand() & 3), -8, 48, 48, krand() & 2047, (krand() & 63) + 64, -(krand() & 4095) - (actor->spr.zvel >> 2), actor, 5);
j->spr.pal = 6; j->spr.pal = 6;
} }
@ -2325,9 +2325,9 @@ static void greenslime(DDukeActor *actor)
return; return;
} }
actor->spr.z = ps[p].pos.Z + ps[p].pyoff - t[2] + (8 << 8); actor->spr.pos.Z = ps[p].pos.Z + ps[p].pyoff - t[2] + (8 << 8);
actor->spr.z += -ps[p].horizon.horiz.asq16() >> 12; actor->spr.pos.Z += -ps[p].horizon.horiz.asq16() >> 12;
if (t[2] > 512) if (t[2] > 512)
t[2] -= 128; t[2] -= 128;
@ -2421,7 +2421,7 @@ static void greenslime(DDukeActor *actor)
for (x = 0; x < 8; x++) for (x = 0; x < 8; x++)
{ {
auto j = EGS(actor->spr.sector(), actor->spr.pos.X, actor->spr.pos.Y, actor->spr.z - (8 << 8), SCRAP3 + (krand() & 3), -8, 48, 48, krand() & 2047, (krand() & 63) + 64, -(krand() & 4095) - (actor->spr.zvel >> 2), actor, 5); auto j = EGS(actor->spr.sector(), actor->spr.pos.X, actor->spr.pos.Y, actor->spr.pos.Z - (8 << 8), SCRAP3 + (krand() & 3), -8, 48, 48, krand() & 2047, (krand() & 63) + 64, -(krand() & 4095) - (actor->spr.zvel >> 2), actor, 5);
if (j) j->spr.pal = 6; if (j) j->spr.pal = 6;
} }
t[0] = -3; t[0] = -3;
@ -2460,7 +2460,7 @@ static void greenslime(DDukeActor *actor)
int l = s5->spr.ang; int l = s5->spr.ang;
actor->spr.z = s5->spr.z; actor->spr.pos.Z = s5->spr.pos.Z;
actor->spr.pos.X = s5->spr.pos.X + bcos(l, -11); actor->spr.pos.X = s5->spr.pos.X + bcos(l, -11);
actor->spr.pos.Y = s5->spr.pos.Y + bsin(l, -11); actor->spr.pos.Y = s5->spr.pos.Y + bsin(l, -11);
@ -2491,7 +2491,7 @@ static void greenslime(DDukeActor *actor)
{ {
if (gs.actorinfo[a2->spr.picnum].flags & SFLAG_GREENSLIMEFOOD) if (gs.actorinfo[a2->spr.picnum].flags & SFLAG_GREENSLIMEFOOD)
{ {
if (ldist(actor, a2) < 768 && (abs(actor->spr.z - a2->spr.z) < 8192)) //Gulp them if (ldist(actor, a2) < 768 && (abs(actor->spr.pos.Z - a2->spr.pos.Z) < 8192)) //Gulp them
{ {
actor->temp_actor = a2; actor->temp_actor = a2;
t[0] = -2; t[0] = -2;
@ -2516,9 +2516,9 @@ static void greenslime(DDukeActor *actor)
actor->spr.zvel = 0; actor->spr.zvel = 0;
actor->spr.cstat &= ~CSTAT_SPRITE_YFLIP; actor->spr.cstat &= ~CSTAT_SPRITE_YFLIP;
if ((sectp->ceilingstat & CSTAT_SECTOR_SKY) || (actor->ceilingz + 6144) < actor->spr.z) if ((sectp->ceilingstat & CSTAT_SECTOR_SKY) || (actor->ceilingz + 6144) < actor->spr.pos.Z)
{ {
actor->spr.z += 2048; actor->spr.pos.Z += 2048;
t[0] = 3; t[0] = 3;
return; return;
} }
@ -2566,10 +2566,10 @@ static void greenslime(DDukeActor *actor)
if (actor->spr.xrepeat > 8) actor->spr.xrepeat -= 4; if (actor->spr.xrepeat > 8) actor->spr.xrepeat -= 4;
if (actor->spr.zvel > -(2048 + 1024)) if (actor->spr.zvel > -(2048 + 1024))
actor->spr.zvel -= 348; actor->spr.zvel -= 348;
actor->spr.z += actor->spr.zvel; actor->spr.pos.Z += actor->spr.zvel;
if (actor->spr.z < actor->ceilingz + 4096) if (actor->spr.pos.Z < actor->ceilingz + 4096)
{ {
actor->spr.z = actor->ceilingz + 4096; actor->spr.pos.Z = actor->ceilingz + 4096;
actor->spr.xvel = 0; actor->spr.xvel = 0;
t[0] = 2; t[0] = 2;
} }
@ -2581,7 +2581,7 @@ static void greenslime(DDukeActor *actor)
makeitfall(actor); makeitfall(actor);
if (actor->spr.z > actor->floorz - (8 << 8)) if (actor->spr.pos.Z > actor->floorz - (8 << 8))
{ {
actor->spr.yrepeat -= 4; actor->spr.yrepeat -= 4;
actor->spr.xrepeat += 2; actor->spr.xrepeat += 2;
@ -2592,9 +2592,9 @@ static void greenslime(DDukeActor *actor)
if (actor->spr.xrepeat > 8) actor->spr.xrepeat -= 4; if (actor->spr.xrepeat > 8) actor->spr.xrepeat -= 4;
} }
if (actor->spr.z > actor->floorz - 2048) if (actor->spr.pos.Z > actor->floorz - 2048)
{ {
actor->spr.z = actor->floorz - 2048; actor->spr.pos.Z = actor->floorz - 2048;
t[0] = 0; t[0] = 0;
actor->spr.xvel = 0; actor->spr.xvel = 0;
} }
@ -2624,7 +2624,7 @@ static void flamethrowerflame(DDukeActor *actor)
int dax = actor->spr.pos.X; int dax = actor->spr.pos.X;
int day = actor->spr.pos.Y; int day = actor->spr.pos.Y;
int daz = actor->spr.z; int daz = actor->spr.pos.Z;
int xvel = actor->spr.xvel; int xvel = actor->spr.xvel;
getglobalz(actor); getglobalz(actor);
@ -2654,13 +2654,13 @@ static void flamethrowerflame(DDukeActor *actor)
if (coll.type != kHitSprite) if (coll.type != kHitSprite)
{ {
if (actor->spr.z < actor->ceilingz) if (actor->spr.pos.Z < actor->ceilingz)
{ {
coll.setSector(actor->spr.sector()); coll.setSector(actor->spr.sector());
actor->spr.zvel = -1; actor->spr.zvel = -1;
} }
else if ((actor->spr.z > actor->floorz && actor->spr.sector()->lotag != 1) else if ((actor->spr.pos.Z > actor->floorz && actor->spr.sector()->lotag != 1)
|| (actor->spr.z > actor->floorz + (16 << 8) && actor->spr.sector()->lotag == 1)) || (actor->spr.pos.Z > actor->floorz + (16 << 8) && actor->spr.sector()->lotag == 1))
{ {
coll.setSector(actor->spr.sector()); coll.setSector(actor->spr.sector());
if (actor->spr.sector()->lotag != 1) if (actor->spr.sector()->lotag != 1)
@ -2679,7 +2679,7 @@ static void flamethrowerflame(DDukeActor *actor)
else if (coll.type == kHitWall) else if (coll.type == kHitWall)
{ {
SetActor(actor, { dax, day, daz }); SetActor(actor, { dax, day, daz });
fi.checkhitwall(actor, coll.hitWall, actor->spr.pos.X, actor->spr.pos.Y, actor->spr.z, actor->spr.picnum); fi.checkhitwall(actor, coll.hitWall, actor->spr.pos.X, actor->spr.pos.Y, actor->spr.pos.Z, actor->spr.picnum);
} }
else if (coll.type == kHitSector) else if (coll.type == kHitSector)
{ {
@ -2748,7 +2748,7 @@ static void heavyhbomb(DDukeActor *actor)
{ {
makeitfall(actor); makeitfall(actor);
if (sectp->lotag != 1 && actor->spr.z >= actor->floorz - (FOURSLEIGHT) && actor->spr.yvel < 3) if (sectp->lotag != 1 && actor->spr.pos.Z >= actor->floorz - (FOURSLEIGHT) && actor->spr.yvel < 3)
{ {
if (actor->spr.yvel > 0 || (actor->spr.yvel == 0 && actor->floorz == sectp->floorz)) if (actor->spr.yvel > 0 || (actor->spr.yvel == 0 && actor->floorz == sectp->floorz))
S_PlayActorSound(PIPEBOMB_BOUNCE, actor); S_PlayActorSound(PIPEBOMB_BOUNCE, actor);
@ -2757,9 +2757,9 @@ static void heavyhbomb(DDukeActor *actor)
actor->spr.zvel >>= 2; actor->spr.zvel >>= 2;
actor->spr.yvel++; actor->spr.yvel++;
} }
if (actor->spr.z < actor->ceilingz) // && sectp->lotag != 2 ) if (actor->spr.pos.Z < actor->ceilingz) // && sectp->lotag != 2 )
{ {
actor->spr.z = actor->ceilingz + (3 << 8); actor->spr.pos.Z = actor->ceilingz + (3 << 8);
actor->spr.zvel = 0; actor->spr.zvel = 0;
} }
} }
@ -2772,7 +2772,7 @@ static void heavyhbomb(DDukeActor *actor)
if (actor->spr.sector()->lotag == 1 && actor->spr.zvel == 0) if (actor->spr.sector()->lotag == 1 && actor->spr.zvel == 0)
{ {
actor->spr.z += (32 << 8); actor->spr.pos.Z += (32 << 8);
if (t[5] == 0) if (t[5] == 0)
{ {
t[5] = 1; t[5] = 1;
@ -2808,7 +2808,7 @@ static void heavyhbomb(DDukeActor *actor)
if (coll.type== kHitWall) if (coll.type== kHitWall)
{ {
auto wal = coll.hitWall; auto wal = coll.hitWall;
fi.checkhitwall(actor, wal, actor->spr.pos.X, actor->spr.pos.Y, actor->spr.z, actor->spr.picnum); fi.checkhitwall(actor, wal, actor->spr.pos.X, actor->spr.pos.Y, actor->spr.pos.Z, actor->spr.picnum);
int k = getangle(wal->delta()); int k = getangle(wal->delta());
@ -2874,7 +2874,7 @@ DETONATEB:
} }
} }
else if (actor->spr.picnum == HEAVYHBOMB && x < 788 && t[0] > 7 && actor->spr.xvel == 0) else if (actor->spr.picnum == HEAVYHBOMB && x < 788 && t[0] > 7 && actor->spr.xvel == 0)
if (cansee(actor->spr.pos.X, actor->spr.pos.Y, actor->spr.z - (8 << 8), actor->spr.sector(), ps[p].pos.X, ps[p].pos.Y, ps[p].pos.Z, ps[p].cursector)) if (cansee(actor->spr.pos.X, actor->spr.pos.Y, actor->spr.pos.Z - (8 << 8), actor->spr.sector(), ps[p].pos.X, ps[p].pos.Y, ps[p].pos.Z, ps[p].cursector))
if (ps[p].ammo_amount[HANDBOMB_WEAPON] < gs.max_ammo_amount[HANDBOMB_WEAPON]) if (ps[p].ammo_amount[HANDBOMB_WEAPON] < gs.max_ammo_amount[HANDBOMB_WEAPON])
{ {
if (ud.coop >= 1 && Owner == actor) if (ud.coop >= 1 && Owner == actor)
@ -3004,7 +3004,7 @@ void moveactors_d(void)
case HELECOPT: case HELECOPT:
case DUKECAR: case DUKECAR:
act->spr.z += act->spr.zvel; act->spr.pos.Z += act->spr.zvel;
t[0]++; t[0]++;
if (t[0] == 4) S_PlayActorSound(WAR_AMBIENCE2, act); if (t[0] == 4) S_PlayActorSound(WAR_AMBIENCE2, act);
@ -3130,7 +3130,7 @@ static void fireflyflyingeffect(DDukeActor *actor)
actor->spr.pos.X = (int) (Owner->spr.pos.X - (dx * -10.0)); actor->spr.pos.X = (int) (Owner->spr.pos.X - (dx * -10.0));
actor->spr.pos.Y = (int) (Owner->spr.pos.Y - (dy * -10.0)); actor->spr.pos.Y = (int) (Owner->spr.pos.Y - (dy * -10.0));
actor->spr.z = Owner->spr.z + 2048; actor->spr.pos.Z = Owner->spr.pos.Z + 2048;
if (Owner->spr.extra <= 0) if (Owner->spr.extra <= 0)
{ {
@ -3184,7 +3184,7 @@ void moveexplosions_d(void) // STATNUM 5
case BLOODSPLAT4: case BLOODSPLAT4:
if (t[0] == 7 * 26) continue; if (t[0] == 7 * 26) continue;
act->spr.z += 16 + (krand() & 15); act->spr.pos.Z += 16 + (krand() & 15);
t[0]++; t[0]++;
if ((t[0] % 9) == 0) act->spr.yrepeat++; if ((t[0] % 9) == 0) act->spr.yrepeat++;
continue; continue;
@ -3245,7 +3245,7 @@ void moveexplosions_d(void) // STATNUM 5
case MONEY + 1: case MONEY + 1:
case MAIL + 1: case MAIL + 1:
case PAPER + 1: case PAPER + 1:
act->floorz = act->spr.z = getflorzofslopeptr(act->spr.sector(), act->spr.pos.X, act->spr.pos.Y); act->floorz = act->spr.pos.Z = getflorzofslopeptr(act->spr.sector(), act->spr.pos.X, act->spr.pos.Y);
break; break;
case MONEY: case MONEY:
case MAIL: case MAIL:
@ -3306,7 +3306,7 @@ void moveexplosions_d(void) // STATNUM 5
case SHELL: case SHELL:
case SHOTGUNSHELL: case SHOTGUNSHELL:
shell(act, (sectp->floorz + (24 << 8)) < act->spr.z); shell(act, (sectp->floorz + (24 << 8)) < act->spr.pos.Z);
continue; continue;
case GLASSPIECES: case GLASSPIECES:
@ -3427,7 +3427,7 @@ static void handle_se28(DDukeActor* actor)
} }
else if (t[2] > (t[1] >> 3) && t[2] < (t[1] >> 2)) else if (t[2] > (t[1] >> 3) && t[2] < (t[1] >> 2))
{ {
int j = !!cansee(actor->spr.pos.X, actor->spr.pos.Y, actor->spr.z, actor->spr.sector(), ps[screenpeek].pos.X, ps[screenpeek].pos.Y, ps[screenpeek].pos.Z, ps[screenpeek].cursector); int j = !!cansee(actor->spr.pos.X, actor->spr.pos.Y, actor->spr.pos.Z, actor->spr.sector(), ps[screenpeek].pos.X, ps[screenpeek].pos.Y, ps[screenpeek].pos.Z, ps[screenpeek].cursector);
if (rnd(192) && (t[2] & 1)) if (rnd(192) && (t[2] & 1))
{ {
@ -3609,7 +3609,7 @@ void moveeffectors_d(void) //STATNUM 3
case SE_29_WAVES: case SE_29_WAVES:
act->spr.hitag += 64; act->spr.hitag += 64;
l = MulScale(act->spr.yvel, bsin(act->spr.hitag), 12); l = MulScale(act->spr.yvel, bsin(act->spr.hitag), 12);
sc->floorz = act->spr.z + l; sc->floorz = act->spr.pos.Z + l;
break; break;
case SE_31_FLOOR_RISE_FALL: // True Drop Floor case SE_31_FLOOR_RISE_FALL: // True Drop Floor
handle_se31(act, true); handle_se31(act, true);
@ -3759,16 +3759,16 @@ void move_d(DDukeActor *actor, int playernum, int xvel)
if (actor->spr.picnum == COMMANDER) if (actor->spr.picnum == COMMANDER)
{ {
actor->floorz = l = getflorzofslopeptr(actor->spr.sector(), actor->spr.pos.X, actor->spr.pos.Y); actor->floorz = l = getflorzofslopeptr(actor->spr.sector(), actor->spr.pos.X, actor->spr.pos.Y);
if (actor->spr.z > (l - (8 << 8))) if (actor->spr.pos.Z > (l - (8 << 8)))
{ {
if (actor->spr.z > (l - (8 << 8))) actor->spr.z = l - (8 << 8); if (actor->spr.pos.Z > (l - (8 << 8))) actor->spr.pos.Z = l - (8 << 8);
actor->spr.zvel = 0; actor->spr.zvel = 0;
} }
actor->ceilingz = l = getceilzofslopeptr(actor->spr.sector(), actor->spr.pos.X, actor->spr.pos.Y); actor->ceilingz = l = getceilzofslopeptr(actor->spr.sector(), actor->spr.pos.X, actor->spr.pos.Y);
if ((actor->spr.z - l) < (80 << 8)) if ((actor->spr.pos.Z - l) < (80 << 8))
{ {
actor->spr.z = l + (80 << 8); actor->spr.pos.Z = l + (80 << 8);
actor->spr.zvel = 0; actor->spr.zvel = 0;
} }
} }
@ -3777,15 +3777,15 @@ void move_d(DDukeActor *actor, int playernum, int xvel)
if (actor->spr.zvel > 0) if (actor->spr.zvel > 0)
{ {
actor->floorz = l = getflorzofslopeptr(actor->spr.sector(), actor->spr.pos.X, actor->spr.pos.Y); actor->floorz = l = getflorzofslopeptr(actor->spr.sector(), actor->spr.pos.X, actor->spr.pos.Y);
if (actor->spr.z > (l - (30 << 8))) if (actor->spr.pos.Z > (l - (30 << 8)))
actor->spr.z = l - (30 << 8); actor->spr.pos.Z = l - (30 << 8);
} }
else else
{ {
actor->ceilingz = l = getceilzofslopeptr(actor->spr.sector(), actor->spr.pos.X, actor->spr.pos.Y); actor->ceilingz = l = getceilzofslopeptr(actor->spr.sector(), actor->spr.pos.X, actor->spr.pos.Y);
if ((actor->spr.z - l) < (50 << 8)) if ((actor->spr.pos.Z - l) < (50 << 8))
{ {
actor->spr.z = l + (50 << 8); actor->spr.pos.Z = l + (50 << 8);
actor->spr.zvel = 0; actor->spr.zvel = 0;
} }
} }
@ -3793,22 +3793,22 @@ void move_d(DDukeActor *actor, int playernum, int xvel)
} }
else if (actor->spr.picnum != ORGANTIC) else if (actor->spr.picnum != ORGANTIC)
{ {
if (actor->spr.zvel > 0 && actor->floorz < actor->spr.z) if (actor->spr.zvel > 0 && actor->floorz < actor->spr.pos.Z)
actor->spr.z = actor->floorz; actor->spr.pos.Z = actor->floorz;
if (actor->spr.zvel < 0) if (actor->spr.zvel < 0)
{ {
l = getceilzofslopeptr(actor->spr.sector(), actor->spr.pos.X, actor->spr.pos.Y); l = getceilzofslopeptr(actor->spr.sector(), actor->spr.pos.X, actor->spr.pos.Y);
if ((actor->spr.z - l) < (66 << 8)) if ((actor->spr.pos.Z - l) < (66 << 8))
{ {
actor->spr.z = l + (66 << 8); actor->spr.pos.Z = l + (66 << 8);
actor->spr.zvel >>= 1; actor->spr.zvel >>= 1;
} }
} }
} }
} }
else if (actor->spr.picnum == APLAYER) else if (actor->spr.picnum == APLAYER)
if ((actor->spr.z - actor->ceilingz) < (32 << 8)) if ((actor->spr.pos.Z - actor->ceilingz) < (32 << 8))
actor->spr.z = actor->ceilingz + (32 << 8); actor->spr.pos.Z = actor->ceilingz + (32 << 8);
daxvel = actor->spr.xvel; daxvel = actor->spr.xvel;
angdif = actor->spr.ang; angdif = actor->spr.ang;
@ -3834,7 +3834,7 @@ void move_d(DDukeActor *actor, int playernum, int xvel)
} }
else if (actor->spr.picnum != DRONE && actor->spr.picnum != SHARK && actor->spr.picnum != COMMANDER) else if (actor->spr.picnum != DRONE && actor->spr.picnum != SHARK && actor->spr.picnum != COMMANDER)
{ {
if (actor->spr.oz != actor->spr.z || (ud.multimode < 2 && ud.player_skill < 2)) if (actor->spr.oz != actor->spr.pos.Z || (ud.multimode < 2 && ud.player_skill < 2))
{ {
if ((t[0] & 1) || ps[playernum].actorsqu == actor) return; if ((t[0] & 1) || ps[playernum].actorsqu == actor) return;
else daxvel <<= 1; else daxvel <<= 1;

View file

@ -518,7 +518,7 @@ void moveminecart(void)
while (auto a2 = it.Next()) while (auto a2 = it.Next())
{ {
if (badguy(a2)) if (badguy(a2))
SetActor(a2, { cx, cy, a2->spr.z }); SetActor(a2, { cx, cy, a2->spr.pos.Z });
} }
} }
} }

View file

@ -225,7 +225,7 @@ void hitradius_r(DDukeActor* actor, int r, int hp1, int hp2, int hp3, int h
while (auto dasectp = search.GetNext()) while (auto dasectp = search.GetNext())
{ {
if (((dasectp->ceilingz - actor->spr.z) >> 8) < r) if (((dasectp->ceilingz - actor->spr.pos.Z) >> 8) < r)
{ {
auto wal = dasectp->firstWall(); auto wal = dasectp->firstWall();
int d = abs(wal->pos.X - actor->spr.pos.X) + abs(wal->pos.Y - actor->spr.pos.Y); int d = abs(wal->pos.X - actor->spr.pos.X) + abs(wal->pos.Y - actor->spr.pos.Y);
@ -252,8 +252,8 @@ void hitradius_r(DDukeActor* actor, int r, int hp1, int hp2, int hp3, int h
int y1 = (((wal.pos.Y + wal.point2Wall()->pos.Y) >> 1) + actor->spr.pos.Y) >> 1; int y1 = (((wal.pos.Y + wal.point2Wall()->pos.Y) >> 1) + actor->spr.pos.Y) >> 1;
auto sect = wal.sectorp(); auto sect = wal.sectorp();
updatesector(x1, y1, &sect); updatesector(x1, y1, &sect);
if (sect != nullptr && cansee(x1, y1, actor->spr.z, sect, actor->spr.pos.X, actor->spr.pos.Y, actor->spr.z, actor->spr.sector())) if (sect != nullptr && cansee(x1, y1, actor->spr.pos.Z, sect, actor->spr.pos.X, actor->spr.pos.Y, actor->spr.pos.Z, actor->spr.sector()))
fi.checkhitwall(actor, &wal, wal.pos.X, wal.pos.Y, actor->spr.z, actor->spr.picnum); fi.checkhitwall(actor, &wal, wal.pos.X, wal.pos.Y, actor->spr.pos.Z, actor->spr.picnum);
} }
} }
} }
@ -272,7 +272,7 @@ void hitradius_r(DDukeActor* actor, int r, int hp1, int hp2, int hp3, int h
if (act2->spr.cstat & CSTAT_SPRITE_BLOCK_ALL) if (act2->spr.cstat & CSTAT_SPRITE_BLOCK_ALL)
if (dist(actor, act2) < r) if (dist(actor, act2) < r)
{ {
if (badguy(act2) && !cansee(act2->spr.pos.X, act2->spr.pos.Y, act2->spr.z + q, act2->spr.sector(), actor->spr.pos.X, actor->spr.pos.Y, actor->spr.z + q, actor->spr.sector())) if (badguy(act2) && !cansee(act2->spr.pos.X, act2->spr.pos.Y, act2->spr.pos.Z + q, act2->spr.sector(), actor->spr.pos.X, actor->spr.pos.Y, actor->spr.pos.Z + q, actor->spr.sector()))
{ {
continue; continue;
} }
@ -290,11 +290,11 @@ void hitradius_r(DDukeActor* actor, int r, int hp1, int hp2, int hp3, int h
continue; continue;
} }
if (act2->spr.picnum == APLAYER) act2->spr.z -= gs.playerheight; if (act2->spr.picnum == APLAYER) act2->spr.pos.Z -= gs.playerheight;
int d = dist(actor, act2); int d = dist(actor, act2);
if (act2->spr.picnum == APLAYER) act2->spr.z += gs.playerheight; if (act2->spr.picnum == APLAYER) act2->spr.pos.Z += gs.playerheight;
if (d < r && cansee(act2->spr.pos.X, act2->spr.pos.Y, act2->spr.z - (8 << 8), act2->spr.sector(), actor->spr.pos.X, actor->spr.pos.Y, actor->spr.z - (12 << 8), actor->spr.sector())) if (d < r && cansee(act2->spr.pos.X, act2->spr.pos.Y, act2->spr.pos.Z - (8 << 8), act2->spr.sector(), actor->spr.pos.X, actor->spr.pos.Y, actor->spr.pos.Z - (12 << 8), actor->spr.sector()))
{ {
if ((isRRRA()) && act2->spr.picnum == MINION && act2->spr.pal == 19) if ((isRRRA()) && act2->spr.picnum == MINION && act2->spr.pal == 19)
{ {
@ -373,7 +373,7 @@ int movesprite_ex_r(DDukeActor* actor, int xchange, int ychange, int zchange, un
{ {
actor->spr.pos.X += (xchange * TICSPERFRAME) >> 2; actor->spr.pos.X += (xchange * TICSPERFRAME) >> 2;
actor->spr.pos.Y += (ychange * TICSPERFRAME) >> 2; actor->spr.pos.Y += (ychange * TICSPERFRAME) >> 2;
actor->spr.z += (zchange * TICSPERFRAME) >> 2; actor->spr.pos.Z += (zchange * TICSPERFRAME) >> 2;
if (bg) if (bg)
SetActor(actor, actor->spr.pos); SetActor(actor, actor->spr.pos);
return result.setNone(); return result.setNone();
@ -419,9 +419,9 @@ int movesprite_ex_r(DDukeActor* actor, int xchange, int ychange, int zchange, un
if (dasectp) if (dasectp)
if ((dasectp != actor->spr.sector())) if ((dasectp != actor->spr.sector()))
ChangeActorSect(actor, dasectp); ChangeActorSect(actor, dasectp);
int daz = actor->spr.z + ((zchange * TICSPERFRAME) >> 3); int daz = actor->spr.pos.Z + ((zchange * TICSPERFRAME) >> 3);
if ((daz > actor->ceilingz) && (daz <= actor->floorz)) if ((daz > actor->ceilingz) && (daz <= actor->floorz))
actor->spr.z = daz; actor->spr.pos.Z = daz;
else if (result.type == kHitNone) else if (result.type == kHitNone)
return result.setSector(dasectp); return result.setSector(dasectp);
@ -457,7 +457,7 @@ void guts_r(DDukeActor* actor, int gtype, int n, int p)
sx = sy = 8; sx = sy = 8;
else sx = sy = 32; else sx = sy = 32;
gutz = actor->spr.z - (8 << 8); gutz = actor->spr.pos.Z - (8 << 8);
floorz = getflorzofslopeptr(actor->spr.sector(), actor->spr.pos.X, actor->spr.pos.Y); floorz = getflorzofslopeptr(actor->spr.sector(), actor->spr.pos.X, actor->spr.pos.Y);
if (gutz > (floorz - (8 << 8))) if (gutz > (floorz - (8 << 8)))
@ -545,14 +545,14 @@ void movefta_r(void)
{ {
int r1 = krand(); int r1 = krand();
int r2 = krand(); int r2 = krand();
j = cansee(sx, sy, act->spr.z - (r2 % (52 << 8)), act->spr.sector(), px, py, ps[p].oposz - (r1 % (32 << 8)), ps[p].cursector); j = cansee(sx, sy, act->spr.pos.Z - (r2 % (52 << 8)), act->spr.sector(), px, py, ps[p].oposz - (r1 % (32 << 8)), ps[p].cursector);
} }
} }
else else
{ {
int r1 = krand(); int r1 = krand();
int r2 = krand(); int r2 = krand();
j = cansee(act->spr.pos.X, act->spr.pos.Y, act->spr.z - ((r2 & 31) << 8), act->spr.sector(), ps[p].oposx, ps[p].oposy, ps[p].oposz - ((r1 & 31) << 8), ps[p].cursector); j = cansee(act->spr.pos.X, act->spr.pos.Y, act->spr.pos.Z - ((r2 & 31) << 8), act->spr.sector(), ps[p].oposx, ps[p].oposy, ps[p].oposz - ((r1 & 31) << 8), ps[p].cursector);
} }
@ -779,7 +779,7 @@ void movefallers_r(void)
if (act->temp_data[0] == 0) if (act->temp_data[0] == 0)
{ {
act->spr.z -= (16 << 8); act->spr.pos.Z -= (16 << 8);
act->temp_data[1] = act->spr.ang; act->temp_data[1] = act->spr.ang;
int x = act->spr.extra; int x = act->spr.extra;
int j = fi.ifhitbyweapon(act); int j = fi.ifhitbyweapon(act);
@ -810,7 +810,7 @@ void movefallers_r(void)
} }
} }
act->spr.ang = act->temp_data[1]; act->spr.ang = act->temp_data[1];
act->spr.z += (16 << 8); act->spr.pos.Z += (16 << 8);
} }
else if (act->temp_data[0] == 1) else if (act->temp_data[0] == 1)
{ {
@ -838,14 +838,14 @@ void movefallers_r(void)
x = gs.gravity; x = gs.gravity;
} }
if (act->spr.z < (sectp->floorz - FOURSLEIGHT)) if (act->spr.pos.Z < (sectp->floorz - FOURSLEIGHT))
{ {
act->spr.zvel += x; act->spr.zvel += x;
if (act->spr.zvel > 6144) if (act->spr.zvel > 6144)
act->spr.zvel = 6144; act->spr.zvel = 6144;
act->spr.z += act->spr.zvel; act->spr.pos.Z += act->spr.zvel;
} }
if ((sectp->floorz - act->spr.z) < (16 << 8)) if ((sectp->floorz - act->spr.pos.Z) < (16 << 8))
{ {
int j = 1 + (krand() & 7); int j = 1 + (krand() & 7);
for (x = 0; x < j; x++) RANDOMSCRAP(act); for (x = 0; x < j; x++) RANDOMSCRAP(act);
@ -1072,7 +1072,7 @@ static void chickenarrow(DDukeActor* actor)
if (actor->picnum != BOSS2 && actor->spr.xrepeat >= 10 && actor->spr.sector()->lotag != 2) if (actor->picnum != BOSS2 && actor->spr.xrepeat >= 10 && actor->spr.sector()->lotag != 2)
{ {
auto spawned = spawn(actor, SMALLSMOKE); auto spawned = spawn(actor, SMALLSMOKE);
if (spawned) spawned->spr.z += (1 << 8); if (spawned) spawned->spr.pos.Z += (1 << 8);
if ((krand() & 15) == 2) if ((krand() & 15) == 2)
{ {
spawn(actor, MONEY); spawn(actor, MONEY);
@ -1210,7 +1210,7 @@ static bool weaponhitwall(DDukeActor *proj, walltype* wal, const vec3_t& oldpos)
else else
{ {
SetActor(proj, oldpos); SetActor(proj, oldpos);
fi.checkhitwall(proj, wal, proj->spr.pos.X, proj->spr.pos.Y, proj->spr.z, proj->spr.picnum); fi.checkhitwall(proj, wal, proj->spr.pos.X, proj->spr.pos.Y, proj->spr.pos.Z, proj->spr.picnum);
if (!isRRRA() && proj->spr.picnum == FREEZEBLAST) if (!isRRRA() && proj->spr.picnum == FREEZEBLAST)
{ {
@ -1351,7 +1351,7 @@ static void weaponcommon_r(DDukeActor *proj)
case RPG: case RPG:
if (proj->picnum != BOSS2 && proj->spr.xrepeat >= 10 && proj->spr.sector()->lotag != 2) if (proj->picnum != BOSS2 && proj->spr.xrepeat >= 10 && proj->spr.sector()->lotag != 2)
{ {
spawn(proj, SMALLSMOKE)->spr.z += (1 << 8); spawn(proj, SMALLSMOKE)->spr.pos.Z += (1 << 8);
} }
break; break;
case RPG2: case RPG2:
@ -1370,7 +1370,7 @@ static void weaponcommon_r(DDukeActor *proj)
makeitfall(proj); makeitfall(proj);
if (proj->spr.xrepeat >= 10 && proj->spr.sector()->lotag != 2) if (proj->spr.xrepeat >= 10 && proj->spr.sector()->lotag != 2)
{ {
spawn(proj, SMALLSMOKE)->spr.z += (1 << 8); spawn(proj, SMALLSMOKE)->spr.pos.Z += (1 << 8);
} }
break; break;
} }
@ -1392,13 +1392,13 @@ static void weaponcommon_r(DDukeActor *proj)
if (coll.type != kHitSprite && proj->spr.picnum != FREEZEBLAST) if (coll.type != kHitSprite && proj->spr.picnum != FREEZEBLAST)
{ {
if (proj->spr.z < proj->ceilingz) if (proj->spr.pos.Z < proj->ceilingz)
{ {
coll.setSector(proj->spr.sector()); coll.setSector(proj->spr.sector());
proj->spr.zvel = -1; proj->spr.zvel = -1;
} }
else else
if (proj->spr.z > proj->floorz) if (proj->spr.pos.Z > proj->floorz)
{ {
coll.setSector(proj->spr.sector()); coll.setSector(proj->spr.sector());
if (proj->spr.sector()->lotag != 1) if (proj->spr.sector()->lotag != 1)
@ -1413,7 +1413,7 @@ static void weaponcommon_r(DDukeActor *proj)
auto x = EGS(proj->spr.sector(), auto x = EGS(proj->spr.sector(),
proj->spr.pos.X + MulScale(k, bcos(proj->spr.ang), 9), proj->spr.pos.X + MulScale(k, bcos(proj->spr.ang), 9),
proj->spr.pos.Y + MulScale(k, bsin(proj->spr.ang), 9), proj->spr.pos.Y + MulScale(k, bsin(proj->spr.ang), 9),
proj->spr.z + ((k * Sgn(proj->spr.zvel)) * abs(proj->spr.zvel / 24)), FIRELASER, -40 + (k << 2), proj->spr.pos.Z + ((k * Sgn(proj->spr.zvel)) * abs(proj->spr.zvel / 24)), FIRELASER, -40 + (k << 2),
proj->spr.xrepeat, proj->spr.yrepeat, 0, 0, 0, proj->GetOwner(), 5); proj->spr.xrepeat, proj->spr.yrepeat, 0, 0, 0, proj->GetOwner(), 5);
if (x) if (x)
@ -1457,7 +1457,7 @@ static void weaponcommon_r(DDukeActor *proj)
if (proj->spr.zvel < 0) if (proj->spr.zvel < 0)
{ {
k->spr.cstat |= CSTAT_SPRITE_YFLIP; k->spr.cstat |= CSTAT_SPRITE_YFLIP;
k->spr.z += (72 << 8); k->spr.pos.Z += (72 << 8);
} }
} }
} }
@ -1606,7 +1606,7 @@ void movetransports_r(void)
ps[p].bobposx = ps[p].oposx = ps[p].pos.X = Owner->spr.pos.X; ps[p].bobposx = ps[p].oposx = ps[p].pos.X = Owner->spr.pos.X;
ps[p].bobposy = ps[p].oposy = ps[p].pos.Y = Owner->spr.pos.Y; ps[p].bobposy = ps[p].oposy = ps[p].pos.Y = Owner->spr.pos.Y;
ps[p].oposz = ps[p].pos.Z = Owner->spr.z - (gs.playerheight - (4 << 8)); ps[p].oposz = ps[p].pos.Z = Owner->spr.pos.Z - (gs.playerheight - (4 << 8));
ChangeActorSect(act2, Owner->sector()); ChangeActorSect(act2, Owner->sector());
ps[p].setCursector(act2->spr.sector()); ps[p].setCursector(act2->spr.sector());
@ -1619,7 +1619,7 @@ void movetransports_r(void)
} }
else break; else break;
if (onfloorz == 0 && abs(act->spr.z - ps[p].pos.Z) < 6144) if (onfloorz == 0 && abs(act->spr.pos.Z - ps[p].pos.Z) < 6144)
if ((ps[p].jetpack_on == 0) || (ps[p].jetpack_on && PlayerInput(p, SB_JUMP)) || if ((ps[p].jetpack_on == 0) || (ps[p].jetpack_on && PlayerInput(p, SB_JUMP)) ||
(ps[p].jetpack_on && PlayerInput(p, SB_CROUCH))) (ps[p].jetpack_on && PlayerInput(p, SB_CROUCH)))
{ {
@ -1627,8 +1627,8 @@ void movetransports_r(void)
ps[p].oposy = ps[p].pos.Y += Owner->spr.pos.Y - act->spr.pos.Y; ps[p].oposy = ps[p].pos.Y += Owner->spr.pos.Y - act->spr.pos.Y;
if (ps[p].jetpack_on && (PlayerInput(p, SB_JUMP) || ps[p].jetpack_on < 11)) if (ps[p].jetpack_on && (PlayerInput(p, SB_JUMP) || ps[p].jetpack_on < 11))
ps[p].pos.Z = Owner->spr.z - 6144; ps[p].pos.Z = Owner->spr.pos.Z - 6144;
else ps[p].pos.Z = Owner->spr.z + 6144; else ps[p].pos.Z = Owner->spr.pos.Z + 6144;
ps[p].oposz = ps[p].pos.Z; ps[p].oposz = ps[p].pos.Z;
ChangeActorSect(act2, Owner->sector()); ChangeActorSect(act2, Owner->sector());
@ -1735,38 +1735,38 @@ void movetransports_r(void)
{ {
warpspriteto = 0; warpspriteto = 0;
if (ll && sectlotag == ST_2_UNDERWATER && act2->spr.z < (sectp->ceilingz + ll)) if (ll && sectlotag == ST_2_UNDERWATER && act2->spr.pos.Z < (sectp->ceilingz + ll))
warpspriteto = 1; warpspriteto = 1;
if (ll && sectlotag == ST_1_ABOVE_WATER && act2->spr.z > (sectp->floorz - ll)) if (ll && sectlotag == ST_1_ABOVE_WATER && act2->spr.pos.Z > (sectp->floorz - ll))
if (!isRRRA() || (act2->spr.picnum != CHEERBOAT && act2->spr.picnum != HULKBOAT && act2->spr.picnum != MINIONBOAT)) if (!isRRRA() || (act2->spr.picnum != CHEERBOAT && act2->spr.picnum != HULKBOAT && act2->spr.picnum != MINIONBOAT))
warpspriteto = 1; warpspriteto = 1;
if (isRRRA()) if (isRRRA())
{ {
if (ll && sectlotag == 161 && act2->spr.z < (sectp->ceilingz + ll) && warpdir == 1) if (ll && sectlotag == 161 && act2->spr.pos.Z < (sectp->ceilingz + ll) && warpdir == 1)
{ {
warpspriteto = 1; warpspriteto = 1;
ll2 = ll - abs(act2->spr.z - sectp->ceilingz); ll2 = ll - abs(act2->spr.pos.Z - sectp->ceilingz);
} }
else if (sectlotag == 161 && act2->spr.z < (sectp->ceilingz + 1000) && warpdir == 1) else if (sectlotag == 161 && act2->spr.pos.Z < (sectp->ceilingz + 1000) && warpdir == 1)
{ {
warpspriteto = 1; warpspriteto = 1;
ll2 = 1; ll2 = 1;
} }
if (ll && sectlotag == 160 && act2->spr.z > (sectp->floorz - ll) && warpdir == 2) if (ll && sectlotag == 160 && act2->spr.pos.Z > (sectp->floorz - ll) && warpdir == 2)
{ {
warpspriteto = 1; warpspriteto = 1;
ll2 = ll - abs(sectp->floorz - act2->spr.z); ll2 = ll - abs(sectp->floorz - act2->spr.pos.Z);
} }
else if (sectlotag == 160 && act2->spr.z > (sectp->floorz - 1000) && warpdir == 2) else if (sectlotag == 160 && act2->spr.pos.Z > (sectp->floorz - 1000) && warpdir == 2)
{ {
warpspriteto = 1; warpspriteto = 1;
ll2 = 1; ll2 = 1;
} }
} }
if (sectlotag == 0 && (onfloorz || abs(act2->spr.z - act->spr.z) < 4096)) if (sectlotag == 0 && (onfloorz || abs(act2->spr.pos.Z - act->spr.pos.Z) < 4096))
{ {
if (Owner->GetOwner() != Owner && onfloorz && act->temp_data[0] > 0 && act2->spr.statnum != 5) if (Owner->GetOwner() != Owner && onfloorz && act->temp_data[0] > 0 && act2->spr.statnum != 5)
{ {
@ -1822,7 +1822,7 @@ void movetransports_r(void)
{ {
act2->spr.pos.X += (Owner->spr.pos.X - act->spr.pos.X); act2->spr.pos.X += (Owner->spr.pos.X - act->spr.pos.X);
act2->spr.pos.Y += (Owner->spr.pos.Y - act->spr.pos.Y); act2->spr.pos.Y += (Owner->spr.pos.Y - act->spr.pos.Y);
act2->spr.z -= act->spr.z - Owner->sector()->floorz; act2->spr.pos.Z -= act->spr.pos.Z - Owner->sector()->floorz;
act2->spr.ang = Owner->spr.ang; act2->spr.ang = Owner->spr.ang;
act2->spr.backupang(); act2->spr.backupang();
@ -1846,7 +1846,7 @@ void movetransports_r(void)
{ {
act2->spr.pos.X += (Owner->spr.pos.X - act->spr.pos.X); act2->spr.pos.X += (Owner->spr.pos.X - act->spr.pos.X);
act2->spr.pos.Y += (Owner->spr.pos.Y - act->spr.pos.Y); act2->spr.pos.Y += (Owner->spr.pos.Y - act->spr.pos.Y);
act2->spr.z = Owner->spr.z + 4096; act2->spr.pos.Z = Owner->spr.pos.Z + 4096;
act2->spr.backupz(); act2->spr.backupz();
@ -1856,7 +1856,7 @@ void movetransports_r(void)
case ST_1_ABOVE_WATER: case ST_1_ABOVE_WATER:
act2->spr.pos.X += (Owner->spr.pos.X - act->spr.pos.X); act2->spr.pos.X += (Owner->spr.pos.X - act->spr.pos.X);
act2->spr.pos.Y += (Owner->spr.pos.Y - act->spr.pos.Y); act2->spr.pos.Y += (Owner->spr.pos.Y - act->spr.pos.Y);
act2->spr.z = Owner->sector()->ceilingz + ll; act2->spr.pos.Z = Owner->sector()->ceilingz + ll;
act2->spr.backupz(); act2->spr.backupz();
@ -1866,7 +1866,7 @@ void movetransports_r(void)
case ST_2_UNDERWATER: case ST_2_UNDERWATER:
act2->spr.pos.X += (Owner->spr.pos.X - act->spr.pos.X); act2->spr.pos.X += (Owner->spr.pos.X - act->spr.pos.X);
act2->spr.pos.Y += (Owner->spr.pos.Y - act->spr.pos.Y); act2->spr.pos.Y += (Owner->spr.pos.Y - act->spr.pos.Y);
act2->spr.z = Owner->sector()->floorz - ll; act2->spr.pos.Z = Owner->sector()->floorz - ll;
act2->spr.backupz(); act2->spr.backupz();
@ -1878,7 +1878,7 @@ void movetransports_r(void)
if (!isRRRA()) break; if (!isRRRA()) break;
act2->spr.pos.X += (Owner->spr.pos.X - act->spr.pos.X); act2->spr.pos.X += (Owner->spr.pos.X - act->spr.pos.X);
act2->spr.pos.Y += (Owner->spr.pos.Y - act->spr.pos.Y); act2->spr.pos.Y += (Owner->spr.pos.Y - act->spr.pos.Y);
act2->spr.z = Owner->sector()->ceilingz + ll2; act2->spr.pos.Z = Owner->sector()->ceilingz + ll2;
act2->spr.backupz(); act2->spr.backupz();
@ -1892,7 +1892,7 @@ void movetransports_r(void)
if (!isRRRA()) break; if (!isRRRA()) break;
act2->spr.pos.X += (Owner->spr.pos.X - act->spr.pos.X); act2->spr.pos.X += (Owner->spr.pos.X - act->spr.pos.X);
act2->spr.pos.Y += (Owner->spr.pos.Y - act->spr.pos.Y); act2->spr.pos.Y += (Owner->spr.pos.Y - act->spr.pos.Y);
act2->spr.z = Owner->sector()->floorz - ll2; act2->spr.pos.Z = Owner->sector()->floorz - ll2;
act2->spr.backupz(); act2->spr.backupz();
@ -2064,7 +2064,7 @@ static void rrra_specialstats()
act->spr.extra = 1; act->spr.extra = 1;
} }
movesprite_ex(act, 0, 0, -300, CLIPMASK0, coll); movesprite_ex(act, 0, 0, -300, CLIPMASK0, coll);
if (act->spr.sector()->ceilingz + (4 << 8) > act->spr.z) if (act->spr.sector()->ceilingz + (4 << 8) > act->spr.pos.Z)
{ {
act->spr.picnum = 0; act->spr.picnum = 0;
act->spr.extra = 100; act->spr.extra = 100;
@ -2295,9 +2295,9 @@ void rr_specialstats()
{ {
if (act->spr.hitag == 100) if (act->spr.hitag == 100)
{ {
act->spr.z += (4 << 8); act->spr.pos.Z += (4 << 8);
if (act->spr.z >= act->spr.sector()->floorz + 15168) if (act->spr.pos.Z >= act->spr.sector()->floorz + 15168)
act->spr.z = act->spr.sector()->floorz + 15168; act->spr.pos.Z = act->spr.sector()->floorz + 15168;
} }
if (act->spr.picnum == LUMBERBLADE) if (act->spr.picnum == LUMBERBLADE)
@ -2306,7 +2306,7 @@ void rr_specialstats()
if (act->spr.extra == 192) if (act->spr.extra == 192)
{ {
act->spr.hitag = 0; act->spr.hitag = 0;
act->spr.z = act->spr.sector()->floorz - 15168; act->spr.pos.Z = act->spr.sector()->floorz - 15168;
act->spr.extra = 0; act->spr.extra = 0;
act->spr.picnum = RRTILE3410; act->spr.picnum = RRTILE3410;
DukeStatIterator it2(STAT_DEFAULT); DukeStatIterator it2(STAT_DEFAULT);
@ -2451,7 +2451,7 @@ void rr_specialstats()
ps[p].angle.ang = buildang(act2->spr.ang); ps[p].angle.ang = buildang(act2->spr.ang);
ps[p].bobposx = ps[p].oposx = ps[p].pos.X = act2->spr.pos.X; ps[p].bobposx = ps[p].oposx = ps[p].pos.X = act2->spr.pos.X;
ps[p].bobposy = ps[p].oposy = ps[p].pos.Y = act2->spr.pos.Y; ps[p].bobposy = ps[p].oposy = ps[p].pos.Y = act2->spr.pos.Y;
ps[p].oposz = ps[p].pos.Z = act2->spr.z - (36 << 8); ps[p].oposz = ps[p].pos.Z = act2->spr.pos.Z - (36 << 8);
auto pact = ps[p].GetActor(); auto pact = ps[p].GetActor();
ChangeActorSect(pact, act2->sector()); ChangeActorSect(pact, act2->sector());
ps[p].setCursector(pact->sector()); ps[p].setCursector(pact->sector());
@ -2509,7 +2509,7 @@ static void heavyhbomb(DDukeActor *actor)
makeitfall(actor); makeitfall(actor);
if (sectp->lotag != 1 && (!isRRRA() || sectp->lotag != 160) && actor->spr.z >= actor->floorz - (FOURSLEIGHT) && actor->spr.yvel < 3) if (sectp->lotag != 1 && (!isRRRA() || sectp->lotag != 160) && actor->spr.pos.Z >= actor->floorz - (FOURSLEIGHT) && actor->spr.yvel < 3)
{ {
if (actor->spr.yvel > 0 || (actor->spr.yvel == 0 && actor->floorz == sectp->floorz)) if (actor->spr.yvel > 0 || (actor->spr.yvel == 0 && actor->floorz == sectp->floorz))
{ {
@ -2528,9 +2528,9 @@ static void heavyhbomb(DDukeActor *actor)
actor->spr.zvel >>= 2; actor->spr.zvel >>= 2;
actor->spr.yvel++; actor->spr.yvel++;
} }
if (actor->spr.picnum != CHEERBOMB && actor->spr.z < actor->ceilingz + (16 << 8) && sectp->lotag != 2) if (actor->spr.picnum != CHEERBOMB && actor->spr.pos.Z < actor->ceilingz + (16 << 8) && sectp->lotag != 2)
{ {
actor->spr.z = actor->ceilingz + (16 << 8); actor->spr.pos.Z = actor->ceilingz + (16 << 8);
actor->spr.zvel = 0; actor->spr.zvel = 0;
} }
@ -2542,7 +2542,7 @@ static void heavyhbomb(DDukeActor *actor)
if (actor->spr.sector()->lotag == 1 && actor->spr.zvel == 0) if (actor->spr.sector()->lotag == 1 && actor->spr.zvel == 0)
{ {
actor->spr.z += (32 << 8); actor->spr.pos.Z += (32 << 8);
if (t[5] == 0) if (t[5] == 0)
{ {
t[5] = 1; t[5] = 1;
@ -2589,7 +2589,7 @@ static void heavyhbomb(DDukeActor *actor)
if (coll.type == kHitWall) if (coll.type == kHitWall)
{ {
auto wal = coll.hitWall; auto wal = coll.hitWall;
fi.checkhitwall(actor, wal, actor->spr.pos.X, actor->spr.pos.Y, actor->spr.z, actor->spr.picnum); fi.checkhitwall(actor, wal, actor->spr.pos.X, actor->spr.pos.Y, actor->spr.pos.Z, actor->spr.picnum);
int k = getangle(wal->delta()); int k = getangle(wal->delta());
@ -2655,7 +2655,7 @@ DETONATEB:
} }
} }
else if (actor->spr.picnum == HEAVYHBOMB && x < 788 && t[0] > 7 && actor->spr.xvel == 0) else if (actor->spr.picnum == HEAVYHBOMB && x < 788 && t[0] > 7 && actor->spr.xvel == 0)
if (cansee(actor->spr.pos.X, actor->spr.pos.Y, actor->spr.z - (8 << 8), actor->spr.sector(), ps[p].pos.X, ps[p].pos.Y, ps[p].pos.Z, ps[p].cursector)) if (cansee(actor->spr.pos.X, actor->spr.pos.Y, actor->spr.pos.Z - (8 << 8), actor->spr.sector(), ps[p].pos.X, ps[p].pos.Y, ps[p].pos.Z, ps[p].cursector))
if (ps[p].ammo_amount[DYNAMITE_WEAPON] < gs.max_ammo_amount[DYNAMITE_WEAPON]) if (ps[p].ammo_amount[DYNAMITE_WEAPON] < gs.max_ammo_amount[DYNAMITE_WEAPON])
if (actor->spr.pal == 0) if (actor->spr.pal == 0)
{ {
@ -2852,7 +2852,7 @@ void moveactors_r(void)
act->spr.picnum = RRTILE3192; act->spr.picnum = RRTILE3192;
break; break;
case 903: case 903:
if (act->spr.z >= sectp->floorz - (8<<8)) if (act->spr.pos.Z >= sectp->floorz - (8<<8))
{ {
deletesprite(act); deletesprite(act);
continue; continue;
@ -2891,7 +2891,7 @@ void moveactors_r(void)
} }
if (sectp->lotag == 903) if (sectp->lotag == 903)
{ {
if (act->spr.z >= sectp->floorz - (4<<8)) if (act->spr.pos.Z >= sectp->floorz - (4<<8))
{ {
deletesprite(act); deletesprite(act);
continue; continue;
@ -2915,12 +2915,12 @@ void moveactors_r(void)
MulScale(act->spr.xvel, bcos(act->spr.ang), 14), MulScale(act->spr.xvel, bcos(act->spr.ang), 14),
MulScale(act->spr.xvel, bsin(act->spr.ang), 14), MulScale(act->spr.xvel, bsin(act->spr.ang), 14),
act->spr.zvel,CLIPMASK0, coll); act->spr.zvel,CLIPMASK0, coll);
if (act->spr.z >= sectp->floorz - (8<<8)) if (act->spr.pos.Z >= sectp->floorz - (8<<8))
{ {
if (sectp->lotag == 1) if (sectp->lotag == 1)
{ {
auto j = spawn(act, WATERSPLASH2); auto j = spawn(act, WATERSPLASH2);
if (j) j->spr.z = j->sector()->floorz; if (j) j->spr.pos.Z = j->sector()->floorz;
} }
deletesprite(act); deletesprite(act);
continue; continue;
@ -3089,7 +3089,7 @@ void moveexplosions_r(void) // STATNUM 5
{ {
case SHOTGUNSPRITE: case SHOTGUNSPRITE:
if (act->spr.sector()->lotag == 800) if (act->spr.sector()->lotag == 800)
if (act->spr.z >= act->spr.sector()->floorz - (8 << 8)) if (act->spr.pos.Z >= act->spr.sector()->floorz - (8 << 8))
{ {
deletesprite(act); deletesprite(act);
continue; continue;
@ -3112,7 +3112,7 @@ void moveexplosions_r(void) // STATNUM 5
case BLOODSPLAT4: case BLOODSPLAT4:
if (t[0] == 7 * 26) continue; if (t[0] == 7 * 26) continue;
act->spr.z += 16 + (krand() & 15); act->spr.pos.Z += 16 + (krand() & 15);
t[0]++; t[0]++;
if ((t[0] % 9) == 0) act->spr.yrepeat++; if ((t[0] % 9) == 0) act->spr.yrepeat++;
continue; continue;
@ -3178,7 +3178,7 @@ void moveexplosions_r(void) // STATNUM 5
deletesprite(act); deletesprite(act);
continue; continue;
case FEATHER + 1: // feather case FEATHER + 1: // feather
act->floorz = act->spr.z = getflorzofslopeptr(act->spr.sector(), act->spr.pos.X, act->spr.pos.Y); act->floorz = act->spr.pos.Z = getflorzofslopeptr(act->spr.sector(), act->spr.pos.X, act->spr.pos.Y);
if (act->spr.sector()->lotag == 800) if (act->spr.sector()->lotag == 800)
{ {
deletesprite(act); deletesprite(act);
@ -3189,7 +3189,7 @@ void moveexplosions_r(void) // STATNUM 5
if (!money(act, BLOODPOOL)) continue; if (!money(act, BLOODPOOL)) continue;
if (act->spr.sector()->lotag == 800) if (act->spr.sector()->lotag == 800)
if (act->spr.z >= act->spr.sector()->floorz - (8 << 8)) if (act->spr.pos.Z >= act->spr.sector()->floorz - (8 << 8))
{ {
deletesprite(act); deletesprite(act);
continue; continue;
@ -3244,7 +3244,7 @@ void moveexplosions_r(void) // STATNUM 5
isRRRA() && (act->spr.picnum == RRTILE2465 || act->spr.picnum == RRTILE2560))) continue; isRRRA() && (act->spr.picnum == RRTILE2465 || act->spr.picnum == RRTILE2560))) continue;
if (act->spr.sector()->lotag == 800) if (act->spr.sector()->lotag == 800)
if (act->spr.z >= act->spr.sector()->floorz - (8 << 8)) if (act->spr.pos.Z >= act->spr.sector()->floorz - (8 << 8))
{ {
deletesprite(act); deletesprite(act);
continue; continue;
@ -3256,7 +3256,7 @@ void moveexplosions_r(void) // STATNUM 5
if (!bloodpool(act, false, TIRE)) continue; if (!bloodpool(act, false, TIRE)) continue;
if (act->spr.sector()->lotag == 800) if (act->spr.sector()->lotag == 800)
if (act->spr.z >= act->spr.sector()->floorz - (8 << 8)) if (act->spr.pos.Z >= act->spr.sector()->floorz - (8 << 8))
{ {
deletesprite(act); deletesprite(act);
} }
@ -3329,7 +3329,7 @@ void handle_se06_r(DDukeActor *actor)
auto ns = spawn(actor, HULK); auto ns = spawn(actor, HULK);
if (ns) if (ns)
{ {
ns->spr.z = ns->sector()->ceilingz; ns->spr.pos.Z = ns->sector()->ceilingz;
ns->spr.pal = 33; ns->spr.pal = 33;
} }
if (!hulkspawn) if (!hulkspawn)
@ -3347,7 +3347,7 @@ void handle_se06_r(DDukeActor *actor)
{ {
ns->spr.cstat = 0; ns->spr.cstat = 0;
ns->spr.cstat |= CSTAT_SPRITE_INVISIBLE; ns->spr.cstat |= CSTAT_SPRITE_INVISIBLE;
ns->spr.z = actor->spr.sector()->floorz - 6144; ns->spr.pos.Z = actor->spr.sector()->floorz - 6144;
} }
deletesprite(actor); deletesprite(actor);
return; return;
@ -3387,7 +3387,7 @@ void handle_se06_r(DDukeActor *actor)
} }
else pn = UFO1_RRRA; else pn = UFO1_RRRA;
auto ns = spawn(actor, pn); auto ns = spawn(actor, pn);
if (ns) ns->spr.z = ns->sector()->ceilingz; if (ns) ns->spr.pos.Z = ns->sector()->ceilingz;
} }
} }
} }
@ -3567,7 +3567,7 @@ void moveeffectors_r(void) //STATNUM 3
case SE_29_WAVES: case SE_29_WAVES:
act->spr.hitag += 64; act->spr.hitag += 64;
l = MulScale(act->spr.yvel, bsin(act->spr.hitag), 12); l = MulScale(act->spr.yvel, bsin(act->spr.hitag), 12);
sc->floorz = act->spr.z + l; sc->floorz = act->spr.pos.Z + l;
break; break;
case SE_31_FLOOR_RISE_FALL: // True Drop Floor case SE_31_FLOOR_RISE_FALL: // True Drop Floor
@ -3815,40 +3815,40 @@ void move_r(DDukeActor *actor, int pnum, int xvel)
actor->floorz = l = getflorzofslopeptr(actor->spr.sector(), actor->spr.pos.X, actor->spr.pos.Y); actor->floorz = l = getflorzofslopeptr(actor->spr.sector(), actor->spr.pos.X, actor->spr.pos.Y);
if (isRRRA()) if (isRRRA())
{ {
if (actor->spr.z > (l - (28 << 8))) if (actor->spr.pos.Z > (l - (28 << 8)))
actor->spr.z = l - (28 << 8); actor->spr.pos.Z = l - (28 << 8);
} }
else else
{ {
if (actor->spr.z > (l - (30 << 8))) if (actor->spr.pos.Z > (l - (30 << 8)))
actor->spr.z = l - (30 << 8); actor->spr.pos.Z = l - (30 << 8);
} }
} }
else else
{ {
actor->ceilingz = l = getceilzofslopeptr(actor->spr.sector(), actor->spr.pos.X, actor->spr.pos.Y); actor->ceilingz = l = getceilzofslopeptr(actor->spr.sector(), actor->spr.pos.X, actor->spr.pos.Y);
if ((actor->spr.z - l) < (50 << 8)) if ((actor->spr.pos.Z - l) < (50 << 8))
{ {
actor->spr.z = l + (50 << 8); actor->spr.pos.Z = l + (50 << 8);
actor->spr.zvel = 0; actor->spr.zvel = 0;
} }
} }
} }
if (actor->spr.zvel > 0 && actor->floorz < actor->spr.z) if (actor->spr.zvel > 0 && actor->floorz < actor->spr.pos.Z)
actor->spr.z = actor->floorz; actor->spr.pos.Z = actor->floorz;
if (actor->spr.zvel < 0) if (actor->spr.zvel < 0)
{ {
l = getceilzofslopeptr(actor->spr.sector(), actor->spr.pos.X, actor->spr.pos.Y); l = getceilzofslopeptr(actor->spr.sector(), actor->spr.pos.X, actor->spr.pos.Y);
if ((actor->spr.z - l) < (66 << 8)) if ((actor->spr.pos.Z - l) < (66 << 8))
{ {
actor->spr.z = l + (66 << 8); actor->spr.pos.Z = l + (66 << 8);
actor->spr.zvel >>= 1; actor->spr.zvel >>= 1;
} }
} }
} }
else if (actor->spr.picnum == APLAYER) else if (actor->spr.picnum == APLAYER)
if ((actor->spr.z - actor->ceilingz) < (32 << 8)) if ((actor->spr.pos.Z - actor->ceilingz) < (32 << 8))
actor->spr.z = actor->ceilingz + (32 << 8); actor->spr.pos.Z = actor->ceilingz + (32 << 8);
daxvel = actor->spr.xvel; daxvel = actor->spr.xvel;
angdif = actor->spr.ang; angdif = actor->spr.ang;
@ -3876,7 +3876,7 @@ void move_r(DDukeActor *actor, int pnum, int xvel)
(!isRRRA() && actor->spr.picnum != DRONE && actor->spr.picnum != SHARK && actor->spr.picnum != UFO1_RR (!isRRRA() && actor->spr.picnum != DRONE && actor->spr.picnum != SHARK && actor->spr.picnum != UFO1_RR
&& actor->spr.picnum != UFO2 && actor->spr.picnum != UFO3 && actor->spr.picnum != UFO4 && actor->spr.picnum != UFO5)) && actor->spr.picnum != UFO2 && actor->spr.picnum != UFO3 && actor->spr.picnum != UFO4 && actor->spr.picnum != UFO5))
{ {
if (actor->spr.oz != actor->spr.z || (ud.multimode < 2 && ud.player_skill < 2)) if (actor->spr.oz != actor->spr.pos.Z || (ud.multimode < 2 && ud.player_skill < 2))
{ {
if ((t[0] & 1) || ps[pnum].actorsqu == actor) return; if ((t[0] & 1) || ps[pnum].actorsqu == actor) return;
else daxvel <<= 1; else daxvel <<= 1;
@ -3986,7 +3986,7 @@ static int fallspecial(DDukeActor *actor, int playernum)
} }
else if (actor->spr.sector()->lotag == 802) else if (actor->spr.sector()->lotag == 802)
{ {
if (actor->spr.picnum != APLAYER && badguy(actor) && actor->spr.z == actor->floorz - FOURSLEIGHT) if (actor->spr.picnum != APLAYER && badguy(actor) && actor->spr.pos.Z == actor->floorz - FOURSLEIGHT)
{ {
fi.guts(actor, JIBS6, 5, playernum); fi.guts(actor, JIBS6, 5, playernum);
S_PlayActorSound(SQUISHED, actor); S_PlayActorSound(SQUISHED, actor);
@ -4010,7 +4010,7 @@ static int fallspecial(DDukeActor *actor, int playernum)
} }
if (actor->spr.picnum != APLAYER && (badguy(actor) || actor->spr.picnum == HEN || actor->spr.picnum == COW || actor->spr.picnum == PIG || actor->spr.picnum == DOGRUN || actor->spr.picnum == RABBIT) && (!isRRRA() || actor->spriteextra < 128)) if (actor->spr.picnum != APLAYER && (badguy(actor) || actor->spr.picnum == HEN || actor->spr.picnum == COW || actor->spr.picnum == PIG || actor->spr.picnum == DOGRUN || actor->spr.picnum == RABBIT) && (!isRRRA() || actor->spriteextra < 128))
{ {
actor->spr.z = actor->floorz - FOURSLEIGHT; actor->spr.pos.Z = actor->floorz - FOURSLEIGHT;
actor->spr.zvel = 8000; actor->spr.zvel = 8000;
actor->spr.extra = 0; actor->spr.extra = 0;
actor->spriteextra++; actor->spriteextra++;

View file

@ -167,8 +167,8 @@ void animatesprites_d(tspritetype* tsprite, int& spritesortcnt, int x, int y, in
{ {
t->pos.X -= MulScale(MaxSmoothRatio - smoothratio, ps[h->spr.yvel].pos.X - ps[h->spr.yvel].oposx, 16); t->pos.X -= MulScale(MaxSmoothRatio - smoothratio, ps[h->spr.yvel].pos.X - ps[h->spr.yvel].oposx, 16);
t->pos.Y -= MulScale(MaxSmoothRatio - smoothratio, ps[h->spr.yvel].pos.Y - ps[h->spr.yvel].oposy, 16); t->pos.Y -= MulScale(MaxSmoothRatio - smoothratio, ps[h->spr.yvel].pos.Y - ps[h->spr.yvel].oposy, 16);
t->z = interpolatedvalue(ps[h->spr.yvel].oposz, ps[h->spr.yvel].pos.Z, smoothratio); t->pos.Z = interpolatedvalue(ps[h->spr.yvel].oposz, ps[h->spr.yvel].pos.Z, smoothratio);
t->z += PHEIGHT_DUKE; t->pos.Z += PHEIGHT_DUKE;
} }
else if (h->spr.picnum != CRANEPOLE) else if (h->spr.picnum != CRANEPOLE)
{ {
@ -183,7 +183,7 @@ void animatesprites_d(tspritetype* tsprite, int& spritesortcnt, int x, int y, in
switch (h->spr.picnum) switch (h->spr.picnum)
{ {
case DUKELYINGDEAD: case DUKELYINGDEAD:
t->z += (24 << 8); t->pos.Z += (24 << 8);
break; break;
case BLOODPOOL: case BLOODPOOL:
case FOOTPRINTS: case FOOTPRINTS:
@ -237,7 +237,7 @@ void animatesprites_d(tspritetype* tsprite, int& spritesortcnt, int x, int y, in
break; break;
case ATOMICHEALTH: case ATOMICHEALTH:
t->z -= (4 << 8); t->pos.Z -= (4 << 8);
break; break;
case CRYSTALAMMO: case CRYSTALAMMO:
t->shade = bsin(PlayClock << 4, -10); t->shade = bsin(PlayClock << 4, -10);
@ -309,7 +309,7 @@ void animatesprites_d(tspritetype* tsprite, int& spritesortcnt, int x, int y, in
p = h->spr.yvel; p = h->spr.yvel;
if (t->pal == 1) t->z -= (18 << 8); if (t->pal == 1) t->pos.Z -= (18 << 8);
if (ps[p].over_shoulder_on > 0 && ps[p].newOwner == nullptr) if (ps[p].over_shoulder_on > 0 && ps[p].newOwner == nullptr)
{ {
@ -359,8 +359,8 @@ void animatesprites_d(tspritetype* tsprite, int& spritesortcnt, int x, int y, in
} }
if (h->GetOwner()) if (h->GetOwner())
newtspr->z = ps[p].pos.Z - (12 << 8); newtspr->pos.Z = ps[p].pos.Z - (12 << 8);
else newtspr->z = h->spr.z - (51 << 8); else newtspr->pos.Z = h->spr.pos.Z - (51 << 8);
if (ps[p].curr_weapon == HANDBOMB_WEAPON) if (ps[p].curr_weapon == HANDBOMB_WEAPON)
{ {
newtspr->xrepeat = 10; newtspr->xrepeat = 10;
@ -393,7 +393,7 @@ void animatesprites_d(tspritetype* tsprite, int& spritesortcnt, int x, int y, in
} }
if (t->sector()->lotag == 2) k += 1795 - 1405; if (t->sector()->lotag == 2) k += 1795 - 1405;
else if ((h->floorz - h->spr.z) > (64 << 8)) k += 60; else if ((h->floorz - h->spr.pos.Z) > (64 << 8)) k += 60;
t->picnum += k; t->picnum += k;
t->pal = ps[p].palookup; t->pal = ps[p].palookup;
@ -403,7 +403,7 @@ void animatesprites_d(tspritetype* tsprite, int& spritesortcnt, int x, int y, in
if (ps[p].on_crane == nullptr && (h->spr.sector()->lotag & 0x7ff) != 1) if (ps[p].on_crane == nullptr && (h->spr.sector()->lotag & 0x7ff) != 1)
{ {
l = h->spr.z - ps[p].GetActor()->floorz + (3 << 8); l = h->spr.pos.Z - ps[p].GetActor()->floorz + (3 << 8);
if (l > 1024 && h->spr.yrepeat > 32 && h->spr.extra > 0) if (l > 1024 && h->spr.yrepeat > 32 && h->spr.extra > 0)
h->spr.yoffset = (int8_t)(l / (h->spr.yrepeat << 2)); h->spr.yoffset = (int8_t)(l / (h->spr.yrepeat << 2));
else h->spr.yoffset = 0; else h->spr.yoffset = 0;
@ -432,8 +432,8 @@ void animatesprites_d(tspritetype* tsprite, int& spritesortcnt, int x, int y, in
if (!h->GetOwner()) continue; if (!h->GetOwner()) continue;
if (t->z > h->floorz && t->xrepeat < 32) if (t->pos.Z > h->floorz && t->xrepeat < 32)
t->z = h->floorz; t->pos.Z = h->floorz;
break; break;
@ -583,7 +583,7 @@ void animatesprites_d(tspritetype* tsprite, int& spritesortcnt, int x, int y, in
daz = h->floorz; daz = h->floorz;
if ((h->spr.z - daz) < (8 << 8) && ps[screenpeek].pos.Z < daz) if ((h->spr.pos.Z - daz) < (8 << 8) && ps[screenpeek].pos.Z < daz)
{ {
auto shadowspr = &tsprite[spritesortcnt++]; auto shadowspr = &tsprite[spritesortcnt++];
*shadowspr = *t; *shadowspr = *t;
@ -595,7 +595,7 @@ void animatesprites_d(tspritetype* tsprite, int& spritesortcnt, int x, int y, in
shadowspr->shade = 127; shadowspr->shade = 127;
shadowspr->cstat |= CSTAT_SPRITE_TRANSLUCENT; shadowspr->cstat |= CSTAT_SPRITE_TRANSLUCENT;
shadowspr->z = daz; shadowspr->pos.Z = daz;
shadowspr->pal = 4; shadowspr->pal = 4;
if (hw_models && md_tilehasmodel(t->picnum, t->pal) >= 0) if (hw_models && md_tilehasmodel(t->picnum, t->pal) >= 0)
@ -629,7 +629,7 @@ void animatesprites_d(tspritetype* tsprite, int& spritesortcnt, int x, int y, in
case LASERLINE: case LASERLINE:
if (!OwnerAc) break; if (!OwnerAc) break;
if (t->sector()->lotag == 2) t->pal = 8; if (t->sector()->lotag == 2) t->pal = 8;
t->z = OwnerAc->spr.z - (3 << 8); t->pos.Z = OwnerAc->spr.pos.Z - (3 << 8);
if (gs.lasermode == 2 && ps[screenpeek].heat_on == 0) if (gs.lasermode == 2 && ps[screenpeek].heat_on == 0)
t->yrepeat = 0; t->yrepeat = 0;
[[fallthrough]]; [[fallthrough]];
@ -659,7 +659,7 @@ void animatesprites_d(tspritetype* tsprite, int& spritesortcnt, int x, int y, in
case BURNING2: case BURNING2:
if (!OwnerAc) break; if (!OwnerAc) break;
if (OwnerAc->spr.picnum != TREE1 && OwnerAc->spr.picnum != TREE2) if (OwnerAc->spr.picnum != TREE1 && OwnerAc->spr.picnum != TREE2)
t->z = t->sector()->floorz; t->pos.Z = t->sector()->floorz;
t->shade = -127; t->shade = -127;
break; break;
case COOLEXPLOSION1: case COOLEXPLOSION1:

View file

@ -148,8 +148,8 @@ void animatesprites_r(tspritetype* tsprite, int& spritesortcnt, int x, int y, in
{ {
t->pos.X -= MulScale(MaxSmoothRatio - smoothratio, ps[h->spr.yvel].pos.X - ps[h->spr.yvel].oposx, 16); t->pos.X -= MulScale(MaxSmoothRatio - smoothratio, ps[h->spr.yvel].pos.X - ps[h->spr.yvel].oposx, 16);
t->pos.Y -= MulScale(MaxSmoothRatio - smoothratio, ps[h->spr.yvel].pos.Y - ps[h->spr.yvel].oposy, 16); t->pos.Y -= MulScale(MaxSmoothRatio - smoothratio, ps[h->spr.yvel].pos.Y - ps[h->spr.yvel].oposy, 16);
t->z = interpolatedvalue(ps[h->spr.yvel].oposz, ps[h->spr.yvel].pos.Z, smoothratio); t->pos.Z = interpolatedvalue(ps[h->spr.yvel].oposz, ps[h->spr.yvel].pos.Z, smoothratio);
t->z += PHEIGHT_RR; t->pos.Z += PHEIGHT_RR;
h->spr.xrepeat = 24; h->spr.xrepeat = 24;
h->spr.yrepeat = 17; h->spr.yrepeat = 17;
} }
@ -182,7 +182,7 @@ void animatesprites_r(tspritetype* tsprite, int& spritesortcnt, int x, int y, in
h->spr.xrepeat = 24; h->spr.xrepeat = 24;
h->spr.yrepeat = 17; h->spr.yrepeat = 17;
if (h->spr.extra > 0) if (h->spr.extra > 0)
t->z += (6 << 8); t->pos.Z += (6 << 8);
break; break;
case BLOODPOOL: case BLOODPOOL:
case FOOTPRINTS: case FOOTPRINTS:
@ -230,7 +230,7 @@ void animatesprites_r(tspritetype* tsprite, int& spritesortcnt, int x, int y, in
break; break;
case ATOMICHEALTH: case ATOMICHEALTH:
t->z -= (4 << 8); t->pos.Z -= (4 << 8);
break; break;
case CRYSTALAMMO: case CRYSTALAMMO:
t->shade = bsin(PlayClock << 4, -10); t->shade = bsin(PlayClock << 4, -10);
@ -350,7 +350,7 @@ void animatesprites_r(tspritetype* tsprite, int& spritesortcnt, int x, int y, in
p = h->spr.yvel; p = h->spr.yvel;
if (t->pal == 1) t->z -= (18 << 8); if (t->pal == 1) t->pos.Z -= (18 << 8);
if (ps[p].over_shoulder_on > 0 && ps[p].newOwner == nullptr) if (ps[p].over_shoulder_on > 0 && ps[p].newOwner == nullptr)
{ {
@ -398,8 +398,8 @@ void animatesprites_r(tspritetype* tsprite, int& spritesortcnt, int x, int y, in
} }
if (h->GetOwner()) if (h->GetOwner())
newtspr->z = ps[p].pos.Z - (12 << 8); newtspr->pos.Z = ps[p].pos.Z - (12 << 8);
else newtspr->z = h->spr.z - (51 << 8); else newtspr->pos.Z = h->spr.pos.Z - (51 << 8);
if (ps[p].curr_weapon == HANDBOMB_WEAPON) if (ps[p].curr_weapon == HANDBOMB_WEAPON)
{ {
newtspr->xrepeat = 10; newtspr->xrepeat = 10;
@ -436,7 +436,7 @@ void animatesprites_r(tspritetype* tsprite, int& spritesortcnt, int x, int y, in
} }
if (t->sector()->lotag == 2) k += 1795 - 1405; if (t->sector()->lotag == 2) k += 1795 - 1405;
else if ((h->floorz - h->spr.z) > (64 << 8)) k += 60; else if ((h->floorz - h->spr.pos.Z) > (64 << 8)) k += 60;
t->picnum += k; t->picnum += k;
t->pal = ps[p].palookup; t->pal = ps[p].palookup;
@ -446,7 +446,7 @@ void animatesprites_r(tspritetype* tsprite, int& spritesortcnt, int x, int y, in
if (ps[p].on_crane == nullptr && (h->spr.sector()->lotag & 0x7ff) != 1) if (ps[p].on_crane == nullptr && (h->spr.sector()->lotag & 0x7ff) != 1)
{ {
l = h->spr.z - ps[p].GetActor()->floorz + (3 << 8); l = h->spr.pos.Z - ps[p].GetActor()->floorz + (3 << 8);
if (l > 1024 && h->spr.yrepeat > 32 && h->spr.extra > 0) if (l > 1024 && h->spr.yrepeat > 32 && h->spr.extra > 0)
h->spr.yoffset = (int8_t)(l / (h->spr.yrepeat << 2)); h->spr.yoffset = (int8_t)(l / (h->spr.yrepeat << 2));
else h->spr.yoffset = 0; else h->spr.yoffset = 0;
@ -475,8 +475,8 @@ void animatesprites_r(tspritetype* tsprite, int& spritesortcnt, int x, int y, in
if (!h->GetOwner()) continue; if (!h->GetOwner()) continue;
if (t->z > h->floorz && t->xrepeat < 32) if (t->pos.Z > h->floorz && t->xrepeat < 32)
t->z = h->floorz; t->pos.Z = h->floorz;
if (ps[p].OnMotorcycle && p == screenpeek) if (ps[p].OnMotorcycle && p == screenpeek)
{ {
@ -737,7 +737,7 @@ void animatesprites_r(tspritetype* tsprite, int& spritesortcnt, int x, int y, in
else else
daz = h->floorz; daz = h->floorz;
if ((h->spr.z - daz) < (8 << 8)) if ((h->spr.pos.Z - daz) < (8 << 8))
if (ps[screenpeek].pos.Z < daz) if (ps[screenpeek].pos.Z < daz)
{ {
auto shadowspr = &tsprite[spritesortcnt++]; auto shadowspr = &tsprite[spritesortcnt++];
@ -750,7 +750,7 @@ void animatesprites_r(tspritetype* tsprite, int& spritesortcnt, int x, int y, in
shadowspr->shade = 127; shadowspr->shade = 127;
shadowspr->cstat |= CSTAT_SPRITE_TRANSLUCENT; shadowspr->cstat |= CSTAT_SPRITE_TRANSLUCENT;
shadowspr->z = daz; shadowspr->pos.Z = daz;
shadowspr->pal = 4; shadowspr->pal = 4;
if (hw_models && md_tilehasmodel(t->picnum, t->pal) >= 0) if (hw_models && md_tilehasmodel(t->picnum, t->pal) >= 0)
@ -814,7 +814,7 @@ void animatesprites_r(tspritetype* tsprite, int& spritesortcnt, int x, int y, in
case FIRE: case FIRE:
case BURNING: case BURNING:
if (OwnerAc && OwnerAc->spr.picnum != TREE1 && OwnerAc->spr.picnum != TREE2) if (OwnerAc && OwnerAc->spr.picnum != TREE1 && OwnerAc->spr.picnum != TREE2)
t->z = t->sector()->floorz; t->pos.Z = t->sector()->floorz;
t->shade = -127; t->shade = -127;
break; break;
case WALLLIGHT3: case WALLLIGHT3:

View file

@ -1187,8 +1187,8 @@ void DoActor(bool bSet, int lVar1, int lLabelID, int lVar2, DDukeActor* sActor,
else SetGameVarID(lVar2, act->spr.pos.Y, sActor, sPlayer); else SetGameVarID(lVar2, act->spr.pos.Y, sActor, sPlayer);
break; break;
case ACTOR_Z: case ACTOR_Z:
if (bSet) act->spr.z = lValue; if (bSet) act->spr.pos.Z = lValue;
else SetGameVarID(lVar2, act->spr.z, sActor, sPlayer); else SetGameVarID(lVar2, act->spr.pos.Z, sActor, sPlayer);
break; break;
case ACTOR_CSTAT: case ACTOR_CSTAT:
if (bSet) act->spr.cstat = ESpriteFlags::FromInt(lValue); if (bSet) act->spr.cstat = ESpriteFlags::FromInt(lValue);
@ -1478,7 +1478,7 @@ static bool ifcansee(DDukeActor* actor, int pnum)
if (ps[pnum].holoduke_on != nullptr && !isRR()) if (ps[pnum].holoduke_on != nullptr && !isRR())
{ {
tosee = ps[pnum].holoduke_on; tosee = ps[pnum].holoduke_on;
j = cansee(actor->spr.pos.X, actor->spr.pos.Y, actor->spr.z - (krand() & ((32 << 8) - 1)), actor->spr.sector(), tosee->spr.pos.X, tosee->spr.pos.Y, tosee->spr.z, tosee->sector()); j = cansee(actor->spr.pos.X, actor->spr.pos.Y, actor->spr.pos.Z - (krand() & ((32 << 8) - 1)), actor->spr.sector(), tosee->spr.pos.X, tosee->spr.pos.Y, tosee->spr.pos.Z, tosee->sector());
if (j == 0) if (j == 0)
{ {
@ -1490,7 +1490,7 @@ static bool ifcansee(DDukeActor* actor, int pnum)
else tosee = ps[pnum].GetActor(); // holoduke not on. look for player else tosee = ps[pnum].GetActor(); // holoduke not on. look for player
// can they see player, (or player's holoduke) // can they see player, (or player's holoduke)
j = cansee(actor->spr.pos.X, actor->spr.pos.Y, actor->spr.z - (krand() & ((47 << 8))), actor->spr.sector(), tosee->spr.pos.X, tosee->spr.pos.Y, tosee->spr.z - ((isRR()? 28 : 24) << 8), tosee->sector()); j = cansee(actor->spr.pos.X, actor->spr.pos.Y, actor->spr.pos.Z - (krand() & ((47 << 8))), actor->spr.sector(), tosee->spr.pos.X, tosee->spr.pos.Y, tosee->spr.pos.Z - ((isRR()? 28 : 24) << 8), tosee->sector());
if (j == 0) if (j == 0)
{ {
@ -1541,12 +1541,12 @@ int ParseState::parse(void)
parseifelse(ifcanshoottarget(g_ac, g_p, g_x)); parseifelse(ifcanshoottarget(g_ac, g_p, g_x));
break; break;
case concmd_ifcanseetarget: case concmd_ifcanseetarget:
j = cansee(g_ac->spr.pos.X, g_ac->spr.pos.Y, g_ac->spr.z - ((krand() & 41) << 8), g_ac->spr.sector(), ps[g_p].pos.X, ps[g_p].pos.Y, ps[g_p].pos.Z/*-((krand()&41)<<8)*/, ps[g_p].GetActor()->sector()); j = cansee(g_ac->spr.pos.X, g_ac->spr.pos.Y, g_ac->spr.pos.Z - ((krand() & 41) << 8), g_ac->spr.sector(), ps[g_p].pos.X, ps[g_p].pos.Y, ps[g_p].pos.Z/*-((krand()&41)<<8)*/, ps[g_p].GetActor()->sector());
parseifelse(j); parseifelse(j);
if (j) g_ac->timetosleep = SLEEPTIME; if (j) g_ac->timetosleep = SLEEPTIME;
break; break;
case concmd_ifnocover: case concmd_ifnocover:
j = cansee(g_ac->spr.pos.X, g_ac->spr.pos.Y, g_ac->spr.z, g_ac->spr.sector(), ps[g_p].pos.X, ps[g_p].pos.Y, ps[g_p].pos.Z, ps[g_p].GetActor()->sector()); j = cansee(g_ac->spr.pos.X, g_ac->spr.pos.Y, g_ac->spr.pos.Z, g_ac->spr.sector(), ps[g_p].pos.X, ps[g_p].pos.Y, ps[g_p].pos.Z, ps[g_p].GetActor()->sector());
parseifelse(j); parseifelse(j);
if (j) g_ac->timetosleep = SLEEPTIME; if (j) g_ac->timetosleep = SLEEPTIME;
break; break;
@ -2001,7 +2001,7 @@ int ParseState::parse(void)
case concmd_larrybird: case concmd_larrybird:
insptr++; insptr++;
ps[g_p].pos.Z = ps[g_p].GetActor()->sector()->ceilingz; ps[g_p].pos.Z = ps[g_p].GetActor()->sector()->ceilingz;
ps[g_p].GetActor()->spr.z = ps[g_p].pos.Z; ps[g_p].GetActor()->spr.pos.Z = ps[g_p].pos.Z;
break; break;
case concmd_destroyit: case concmd_destroyit:
insptr++; insptr++;
@ -2190,7 +2190,7 @@ int ParseState::parse(void)
else s = (krand()%3); else s = (krand()%3);
auto l = EGS(g_ac->spr.sector(), auto l = EGS(g_ac->spr.sector(),
g_ac->spr.pos.X + (krand() & 255) - 128, g_ac->spr.pos.Y + (krand() & 255) - 128, g_ac->spr.z - (8 << 8) - (krand() & 8191), g_ac->spr.pos.X + (krand() & 255) - 128, g_ac->spr.pos.Y + (krand() & 255) - 128, g_ac->spr.pos.Z - (8 << 8) - (krand() & 8191),
dnum + s, g_ac->spr.shade, 32 + (krand() & 15), 32 + (krand() & 15), dnum + s, g_ac->spr.shade, 32 + (krand() & 15), 32 + (krand() & 15),
krand() & 2047, (krand() & 127) + 32, -(krand() & 2047), g_ac, 5); krand() & 2047, (krand() & 127) + 32, -(krand() & 2047), g_ac, 5);
if (l) if (l)
@ -2247,7 +2247,7 @@ int ParseState::parse(void)
pickrandomspot(g_p); pickrandomspot(g_p);
g_ac->spr.pos.X = ps[g_p].bobposx = ps[g_p].oposx = ps[g_p].pos.X; g_ac->spr.pos.X = ps[g_p].bobposx = ps[g_p].oposx = ps[g_p].pos.X;
g_ac->spr.pos.Y = ps[g_p].bobposy = ps[g_p].oposy = ps[g_p].pos.Y; g_ac->spr.pos.Y = ps[g_p].bobposy = ps[g_p].oposy = ps[g_p].pos.Y;
g_ac->spr.z = ps[g_p].oposz = ps[g_p].pos.Z; g_ac->spr.pos.Z = ps[g_p].oposz = ps[g_p].pos.Z;
g_ac->spr.backuppos(); g_ac->spr.backuppos();
updatesector(ps[g_p].pos.X, ps[g_p].pos.Y, &ps[g_p].cursector); updatesector(ps[g_p].pos.X, ps[g_p].pos.Y, &ps[g_p].cursector);
SetActor(ps[g_p].GetActor(), { ps[g_p].pos.X, ps[g_p].pos.Y, ps[g_p].pos.Z + gs.playerheight }); SetActor(ps[g_p].GetActor(), { ps[g_p].pos.X, ps[g_p].pos.Y, ps[g_p].pos.Z + gs.playerheight });
@ -2299,10 +2299,10 @@ int ParseState::parse(void)
parseifelse(ud.coop || numplayers > 2); parseifelse(ud.coop || numplayers > 2);
break; break;
case concmd_ifonmud: case concmd_ifonmud:
parseifelse(abs(g_ac->spr.z - g_ac->spr.sector()->floorz) < (32 << 8) && g_ac->spr.sector()->floorpicnum == 3073); // eew, hard coded tile numbers.. :? parseifelse(abs(g_ac->spr.pos.Z - g_ac->spr.sector()->floorz) < (32 << 8) && g_ac->spr.sector()->floorpicnum == 3073); // eew, hard coded tile numbers.. :?
break; break;
case concmd_ifonwater: case concmd_ifonwater:
parseifelse( abs(g_ac->spr.z-g_ac->spr.sector()->floorz) < (32<<8) && g_ac->spr.sector()->lotag == ST_1_ABOVE_WATER); parseifelse( abs(g_ac->spr.pos.Z-g_ac->spr.sector()->floorz) < (32<<8) && g_ac->spr.sector()->lotag == ST_1_ABOVE_WATER);
break; break;
case concmd_ifmotofast: case concmd_ifmotofast:
parseifelse(ps[g_p].MotoSpeed > 60); parseifelse(ps[g_p].MotoSpeed > 60);
@ -2424,7 +2424,7 @@ int ParseState::parse(void)
j = 1; j = 1;
else if( (l& prunning) && s >= 8 && PlayerInput(g_p, SB_RUN) ) else if( (l& prunning) && s >= 8 && PlayerInput(g_p, SB_RUN) )
j = 1; j = 1;
else if( (l& phigher) && ps[g_p].pos.Z < (g_ac->spr.z-(48<<8)) ) else if( (l& phigher) && ps[g_p].pos.Z < (g_ac->spr.pos.Z-(48<<8)) )
j = 1; j = 1;
else if( (l& pwalkingback) && s <= -8 && !(PlayerInput(g_p, SB_RUN)) ) else if( (l& pwalkingback) && s <= -8 && !(PlayerInput(g_p, SB_RUN)) )
j = 1; j = 1;
@ -2506,7 +2506,7 @@ int ParseState::parse(void)
if( g_ac->spr.sector()->lotag == 0 ) if( g_ac->spr.sector()->lotag == 0 )
{ {
HitInfo hit{}; HitInfo hit{};
neartag({ g_ac->spr.pos.X, g_ac->spr.pos.Y, g_ac->spr.z - (32 << 8) }, g_ac->spr.sector(), g_ac->spr.ang, hit, 768, 1); neartag({ g_ac->spr.pos.X, g_ac->spr.pos.Y, g_ac->spr.pos.Z - (32 << 8) }, g_ac->spr.sector(), g_ac->spr.ang, hit, 768, 1);
auto sectp = hit.hitSector; auto sectp = hit.hitSector;
if (sectp) if (sectp)
{ {
@ -2558,11 +2558,11 @@ int ParseState::parse(void)
break; break;
case concmd_iffloordistl: case concmd_iffloordistl:
insptr++; insptr++;
parseifelse( (g_ac->floorz - g_ac->spr.z) <= ((*insptr)<<8)); parseifelse( (g_ac->floorz - g_ac->spr.pos.Z) <= ((*insptr)<<8));
break; break;
case concmd_ifceilingdistl: case concmd_ifceilingdistl:
insptr++; insptr++;
parseifelse( ( g_ac->spr.z - g_ac->ceilingz ) <= ((*insptr)<<8)); parseifelse( ( g_ac->spr.pos.Z - g_ac->ceilingz ) <= ((*insptr)<<8));
break; break;
case concmd_palfrom: case concmd_palfrom:
insptr++; insptr++;
@ -2813,7 +2813,7 @@ int ParseState::parse(void)
case concmd_pstomp: case concmd_pstomp:
insptr++; insptr++;
if( ps[g_p].knee_incs == 0 && ps[g_p].GetActor()->spr.xrepeat >= (isRR()? 9: 40) ) if( ps[g_p].knee_incs == 0 && ps[g_p].GetActor()->spr.xrepeat >= (isRR()? 9: 40) )
if( cansee(g_ac->spr.pos.X,g_ac->spr.pos.Y,g_ac->spr.z-(4<<8),g_ac->spr.sector(),ps[g_p].pos.X,ps[g_p].pos.Y,ps[g_p].pos.Z+(16<<8),ps[g_p].GetActor()->spr.sector()) ) if( cansee(g_ac->spr.pos.X,g_ac->spr.pos.Y,g_ac->spr.pos.Z-(4<<8),g_ac->spr.sector(),ps[g_p].pos.X,ps[g_p].pos.Y,ps[g_p].pos.Z+(16<<8),ps[g_p].GetActor()->spr.sector()) )
{ {
ps[g_p].knee_incs = 1; ps[g_p].knee_incs = 1;
if(ps[g_p].weapon_pos == 0) if(ps[g_p].weapon_pos == 0)

View file

@ -101,7 +101,7 @@ inline int dist(DDukeActor* s1, DDukeActor* s2)
int vx, vy, vz; int vx, vy, vz;
vx = s1->spr.pos.X - s2->spr.pos.X; vx = s1->spr.pos.X - s2->spr.pos.X;
vy = s1->spr.pos.Y - s2->spr.pos.Y; vy = s1->spr.pos.Y - s2->spr.pos.Y;
vz = s1->spr.z - s2->spr.z; vz = s1->spr.pos.Z - s2->spr.pos.Z;
return(FindDistance3D(vx, vy, vz)); return(FindDistance3D(vx, vy, vz));
} }

View file

@ -194,7 +194,7 @@ int hitasprite(DDukeActor* actor, DDukeActor** hitsp)
else if (actor->spr.picnum == TILE_APLAYER) zoff = (39 << 8); else if (actor->spr.picnum == TILE_APLAYER) zoff = (39 << 8);
else zoff = 0; else zoff = 0;
hitscan({ actor->spr.pos.X, actor->spr.pos.Y, actor->spr.z - zoff }, actor->spr.sector(), { bcos(actor->spr.ang), bsin(actor->spr.ang), 0 }, hit, CLIPMASK1); hitscan({ actor->spr.pos.X, actor->spr.pos.Y, actor->spr.pos.Z - zoff }, actor->spr.sector(), { bcos(actor->spr.ang), bsin(actor->spr.ang), 0 }, hit, CLIPMASK1);
if (hitsp) *hitsp = hit.actor(); if (hitsp) *hitsp = hit.actor();
if (hit.hitWall != nullptr && (hit.hitWall->cstat & CSTAT_WALL_MASKED) && badguy(actor)) if (hit.hitWall != nullptr && (hit.hitWall->cstat & CSTAT_WALL_MASKED) && badguy(actor))
@ -327,10 +327,10 @@ DDukeActor* aim(DDukeActor* actor, int aang)
if (sdist > 512 && sdist < smax) if (sdist > 512 && sdist < smax)
{ {
if (actor->spr.picnum == TILE_APLAYER) if (actor->spr.picnum == TILE_APLAYER)
a = (abs(Scale(act->spr.z - actor->spr.z, 10, sdist) - ps[actor->spr.yvel].horizon.sum().asbuild()) < 100); a = (abs(Scale(act->spr.pos.Z - actor->spr.pos.Z, 10, sdist) - ps[actor->spr.yvel].horizon.sum().asbuild()) < 100);
else a = 1; else a = 1;
cans = cansee(act->spr.pos.X, act->spr.pos.Y, act->spr.z - (32 << 8) + gs.actorinfo[act->spr.picnum].aimoffset, act->spr.sector(), actor->spr.pos.X, actor->spr.pos.Y, actor->spr.z - (32 << 8), actor->spr.sector()); cans = cansee(act->spr.pos.X, act->spr.pos.Y, act->spr.pos.Z - (32 << 8) + gs.actorinfo[act->spr.picnum].aimoffset, act->spr.sector(), actor->spr.pos.X, actor->spr.pos.Y, actor->spr.pos.Z - (32 << 8), actor->spr.sector());
if (a && cans) if (a && cans)
{ {
@ -542,7 +542,7 @@ void playerisdead(int snum, int psectlotag, int fz, int cz)
{ {
SetPlayerPal(p, PalEntry(63, 63, 0, 0)); SetPlayerPal(p, PalEntry(63, 63, 0, 0));
p->pos.Z -= (16 << 8); p->pos.Z -= (16 << 8);
actor->spr.z -= (16 << 8); actor->spr.pos.Z -= (16 << 8);
} }
#if 0 #if 0
if (ud.recstat == 1 && ud.multimode < 2) if (ud.recstat == 1 && ud.multimode < 2)
@ -594,7 +594,7 @@ void playerisdead(int snum, int psectlotag, int fz, int cz)
} }
else else
{ {
actor->spr.z -= 512; actor->spr.pos.Z -= 512;
actor->spr.zvel = -348; actor->spr.zvel = -348;
} }
@ -1030,7 +1030,7 @@ void shootbloodsplat(DDukeActor* actor, int p, int sx, int sy, int sz, int sa, i
spawned->spr.ang = getangle(-delta.X, -delta.Y) + 512; // note the '-' sign here! spawned->spr.ang = getangle(-delta.X, -delta.Y) + 512; // note the '-' sign here!
spawned->spr.pos.X = hit.hitpos.X; spawned->spr.pos.X = hit.hitpos.X;
spawned->spr.pos.Y = hit.hitpos.Y; spawned->spr.pos.Y = hit.hitpos.Y;
spawned->spr.z = hit.hitpos.Z; spawned->spr.pos.Z = hit.hitpos.Z;
spawned->spr.cstat |= randomXFlip(); spawned->spr.cstat |= randomXFlip();
ssp(spawned, CLIPMASK0); ssp(spawned, CLIPMASK0);
SetActor(spawned, spawned->spr.pos); SetActor(spawned, spawned->spr.pos);

View file

@ -200,7 +200,7 @@ static void shootflamethrowerflame(DDukeActor* actor, int p, int sx, int sy, int
spawned->spr.pos.X = sx + bsin(sa + 630) / 448; spawned->spr.pos.X = sx + bsin(sa + 630) / 448;
spawned->spr.pos.Y = sy + bsin(sa + 112) / 448; spawned->spr.pos.Y = sy + bsin(sa + 112) / 448;
spawned->spr.z = sz - 256; spawned->spr.pos.Z = sz - 256;
spawned->spr.setsector(actor->spr.sector()); spawned->spr.setsector(actor->spr.sector());
spawned->spr.cstat = CSTAT_SPRITE_YCENTER; spawned->spr.cstat = CSTAT_SPRITE_YCENTER;
spawned->spr.ang = sa; spawned->spr.ang = sa;
@ -244,7 +244,7 @@ static void shootknee(DDukeActor* actor, int p, int sx, int sy, int sz, int sa)
{ {
int x; int x;
auto pactor = ps[findplayer(actor, &x)].GetActor(); auto pactor = ps[findplayer(actor, &x)].GetActor();
zvel = ((pactor->spr.z - sz) << 8) / (x + 1); zvel = ((pactor->spr.pos.Z - sz) << 8) / (x + 1);
sa = getangle(pactor->spr.pos.X - sx, pactor->spr.pos.Y - sy); sa = getangle(pactor->spr.pos.X - sx, pactor->spr.pos.Y - sy);
} }
@ -264,7 +264,7 @@ static void shootknee(DDukeActor* actor, int p, int sx, int sy, int sz, int sa)
if (p >= 0) if (p >= 0)
{ {
auto k = spawn(knee, SMALLSMOKE); auto k = spawn(knee, SMALLSMOKE);
if (k) k->spr.z -= (8 << 8); if (k) k->spr.pos.Z -= (8 << 8);
S_PlayActorSound(KICK_HIT, knee); S_PlayActorSound(KICK_HIT, knee);
} }
@ -350,7 +350,7 @@ static void shootweapon(DDukeActor *actor, int p, int sx, int sy, int sz, int sa
dal -= (8 << 8); dal -= (8 << 8);
break; break;
} }
zvel = ((aimed->spr.z - sz - dal) << 8) / ldist(ps[p].GetActor(), aimed); zvel = ((aimed->spr.pos.Z - sz - dal) << 8) / ldist(ps[p].GetActor(), aimed);
sa = getangle(aimed->spr.pos.X - sx, aimed->spr.pos.Y - sy); sa = getangle(aimed->spr.pos.X - sx, aimed->spr.pos.Y - sy);
} }
@ -443,7 +443,7 @@ static void shootweapon(DDukeActor *actor, int p, int sx, int sy, int sz, int sa
auto jib = spawn(spark, JIBS6); auto jib = spawn(spark, JIBS6);
if (jib) if (jib)
{ {
jib->spr.z += (4 << 8); jib->spr.pos.Z += (4 << 8);
jib->spr.xvel = 16; jib->spr.xvel = 16;
jib->spr.xrepeat = jib->spr.yrepeat = 24; jib->spr.xrepeat = jib->spr.yrepeat = 24;
jib->spr.ang += 64 - (krand() & 127); jib->spr.ang += 64 - (krand() & 127);
@ -595,7 +595,7 @@ static void shootstuff(DDukeActor* actor, int p, int sx, int sy, int sz, int sa,
if (aimed) if (aimed)
{ {
int dal = ((aimed->spr.xrepeat * tileHeight(aimed->spr.picnum)) << 1) - (12 << 8); int dal = ((aimed->spr.xrepeat * tileHeight(aimed->spr.picnum)) << 1) - (12 << 8);
zvel = ((aimed->spr.z - sz - dal) * vel) / ldist(ps[p].GetActor(), aimed); zvel = ((aimed->spr.pos.Z - sz - dal) * vel) / ldist(ps[p].GetActor(), aimed);
sa = getangle(aimed->spr.pos.X - sx, aimed->spr.pos.Y - sy); sa = getangle(aimed->spr.pos.X - sx, aimed->spr.pos.Y - sy);
} }
else else
@ -693,7 +693,7 @@ static void shootrpg(DDukeActor *actor, int p, int sx, int sy, int sz, int sa, i
if (aimed) if (aimed)
{ {
int dal = ((aimed->spr.xrepeat * tileHeight(aimed->spr.picnum)) << 1) + (8 << 8); int dal = ((aimed->spr.xrepeat * tileHeight(aimed->spr.picnum)) << 1) + (8 << 8);
zvel = ((aimed->spr.z - sz - dal) * vel) / ldist(ps[p].GetActor(), aimed); zvel = ((aimed->spr.pos.Z - sz - dal) * vel) / ldist(ps[p].GetActor(), aimed);
if (aimed->spr.picnum != RECON) if (aimed->spr.picnum != RECON)
sa = getangle(aimed->spr.pos.X - sx, aimed->spr.pos.Y - sy); sa = getangle(aimed->spr.pos.X - sx, aimed->spr.pos.Y - sy);
} }
@ -937,7 +937,7 @@ static void shootgrowspark(DDukeActor* actor, int p, int sx, int sy, int sz, int
dal -= (8 << 8); dal -= (8 << 8);
break; break;
} }
zvel = ((aimed->spr.z - sz - dal) << 8) / (ldist(ps[p].GetActor(), aimed)); zvel = ((aimed->spr.pos.Z - sz - dal) << 8) / (ldist(ps[p].GetActor(), aimed));
sa = getangle(aimed->spr.pos.X - sx, aimed->spr.pos.Y - sy); sa = getangle(aimed->spr.pos.X - sx, aimed->spr.pos.Y - sy);
} }
else else
@ -1036,7 +1036,7 @@ void shoot_d(DDukeActor* actor, int atwith)
sa = actor->spr.ang; sa = actor->spr.ang;
sx = actor->spr.pos.X; sx = actor->spr.pos.X;
sy = actor->spr.pos.Y; sy = actor->spr.pos.Y;
sz = actor->spr.z - (actor->spr.yrepeat * tileHeight(actor->spr.picnum) << 1) + (4 << 8); sz = actor->spr.pos.Z - (actor->spr.yrepeat * tileHeight(actor->spr.picnum) << 1) + (4 << 8);
if (actor->spr.picnum != ROTATEGUN) if (actor->spr.picnum != ROTATEGUN)
{ {
sz -= (7 << 8); sz -= (7 << 8);
@ -1068,7 +1068,7 @@ void shoot_d(DDukeActor* actor, int atwith)
k->spr.setsector(sect); k->spr.setsector(sect);
k->spr.pos.X = sx; k->spr.pos.X = sx;
k->spr.pos.Y = sy; k->spr.pos.Y = sy;
k->spr.z = sz; k->spr.pos.Z = sz;
k->spr.ang = sa; k->spr.ang = sa;
k->spr.xvel = 500; k->spr.xvel = 500;
k->spr.zvel = 0; k->spr.zvel = 0;
@ -1148,7 +1148,7 @@ void shoot_d(DDukeActor* actor, int atwith)
if (aimed) if (aimed)
{ {
dal = ((aimed->spr.xrepeat * tileHeight(aimed->spr.picnum)) << 1); dal = ((aimed->spr.xrepeat * tileHeight(aimed->spr.picnum)) << 1);
zvel = ((aimed->spr.z - sz - dal - (4 << 8)) * 768) / (ldist(ps[p].GetActor(), aimed)); zvel = ((aimed->spr.pos.Z - sz - dal - (4 << 8)) * 768) / (ldist(ps[p].GetActor(), aimed));
sa = getangle(aimed->spr.pos.X - sx, aimed->spr.pos.Y - sy); sa = getangle(aimed->spr.pos.X - sx, aimed->spr.pos.Y - sy);
} }
else zvel = -MulScale(ps[p].horizon.sum().asq16(), 98, 16); else zvel = -MulScale(ps[p].horizon.sum().asq16(), 98, 16);
@ -1998,7 +1998,7 @@ static void underwater(int snum, ESyncBits actions, int fz, int cz)
j->spr.pos.Y += bsin(p->angle.ang.asbuild() + 64 - (global_random & 128), -6); j->spr.pos.Y += bsin(p->angle.ang.asbuild() + 64 - (global_random & 128), -6);
j->spr.xrepeat = 3; j->spr.xrepeat = 3;
j->spr.yrepeat = 2; j->spr.yrepeat = 2;
j->spr.z = p->pos.Z + (8 << 8); j->spr.pos.Z = p->pos.Z + (8 << 8);
} }
} }
} }
@ -2031,7 +2031,7 @@ int operateTripbomb(int snum)
while ((act = it.Next())) while ((act = it.Next()))
{ {
if (act->spr.picnum == TRIPBOMB && if (act->spr.picnum == TRIPBOMB &&
abs(act->spr.z - hit.hitpos.Z) < (12 << 8) && ((act->spr.pos.X - hit.hitpos.X) * (act->spr.pos.X - hit.hitpos.X) + (act->spr.pos.Y - hit.hitpos.Y) * (act->spr.pos.Y - hit.hitpos.Y)) < (290 * 290)) abs(act->spr.pos.Z - hit.hitpos.Z) < (12 << 8) && ((act->spr.pos.X - hit.hitpos.X) * (act->spr.pos.X - hit.hitpos.X) + (act->spr.pos.Y - hit.hitpos.Y) * (act->spr.pos.Y - hit.hitpos.Y)) < (290 * 290))
return 0; return 0;
} }
@ -2217,7 +2217,7 @@ static void operateweapon(int snum, ESyncBits actions)
if (k == 15) if (k == 15)
{ {
spawned->spr.yvel = 3; spawned->spr.yvel = 3;
spawned->spr.z += (8 << 8); spawned->spr.pos.Z += (8 << 8);
} }
k = hits(pact); k = hits(pact);
@ -2382,7 +2382,7 @@ static void operateweapon(int snum, ESyncBits actions)
j->spr.ang += 1024; j->spr.ang += 1024;
j->spr.ang &= 2047; j->spr.ang &= 2047;
j->spr.xvel += 32; j->spr.xvel += 32;
j->spr.z += (3 << 8); j->spr.pos.Z += (3 << 8);
ssp(j, CLIPMASK0); ssp(j, CLIPMASK0);
} }
} }
@ -2780,7 +2780,7 @@ void processinput_d(int snum)
p->footprintcount = 0; p->footprintcount = 0;
p->spritebridge = 1; p->spritebridge = 1;
} }
else if (badguy(clz.actor()) && clz.actor()->spr.xrepeat > 24 && abs(pact->spr.z - clz.actor()->spr.z) < (84 << 8)) else if (badguy(clz.actor()) && clz.actor()->spr.xrepeat > 24 && abs(pact->spr.pos.Z - clz.actor()->spr.pos.Z) < (84 << 8))
{ {
j = getangle(clz.actor()->spr.pos.X - p->pos.X, clz.actor()->spr.pos.Y - p->pos.Y); j = getangle(clz.actor()->spr.pos.X - p->pos.X, clz.actor()->spr.pos.Y - p->pos.Y);
p->posxv -= bcos(j, 4); p->posxv -= bcos(j, 4);

View file

@ -99,7 +99,7 @@ static void shootmelee(DDukeActor *actor, int p, int sx, int sy, int sz, int sa,
{ {
int x; int x;
auto pspr = ps[findplayer(actor, &x)].GetActor(); auto pspr = ps[findplayer(actor, &x)].GetActor();
zvel = ((pspr->spr.z - sz) << 8) / (x + 1); zvel = ((pspr->spr.pos.Z - sz) << 8) / (x + 1);
sa = getangle(pspr->spr.pos.X - sx, pspr->spr.pos.Y - sy); sa = getangle(pspr->spr.pos.X - sx, pspr->spr.pos.Y - sy);
} }
@ -153,7 +153,7 @@ static void shootmelee(DDukeActor *actor, int p, int sx, int sy, int sz, int sa,
if (p >= 0) if (p >= 0)
{ {
auto k = spawn(wpn, SMALLSMOKE); auto k = spawn(wpn, SMALLSMOKE);
if (k) k->spr.z -= (8 << 8); if (k) k->spr.pos.Z -= (8 << 8);
if (atwith == KNEE) S_PlayActorSound(KICK_HIT, wpn); if (atwith == KNEE) S_PlayActorSound(KICK_HIT, wpn);
else if (isRRRA() && atwith == SLINGBLADE) S_PlayActorSound(260, wpn); else if (isRRRA() && atwith == SLINGBLADE) S_PlayActorSound(260, wpn);
} }
@ -216,7 +216,7 @@ static void shootweapon(DDukeActor* actor, int p, int sx, int sy, int sz, int sa
if (aimed) if (aimed)
{ {
int dal = ((aimed->spr.xrepeat * tileHeight(aimed->spr.picnum)) << 1) + (5 << 8); int dal = ((aimed->spr.xrepeat * tileHeight(aimed->spr.picnum)) << 1) + (5 << 8);
zvel = ((aimed->spr.z - sz - dal) << 8) / ldist(ps[p].GetActor(), aimed); zvel = ((aimed->spr.pos.Z - sz - dal) << 8) / ldist(ps[p].GetActor(), aimed);
sa = getangle(aimed->spr.pos.X - sx, aimed->spr.pos.Y - sy); sa = getangle(aimed->spr.pos.X - sx, aimed->spr.pos.Y - sy);
} }
@ -335,7 +335,7 @@ static void shootweapon(DDukeActor* actor, int p, int sx, int sy, int sz, int sa
spark->spr.xrepeat = spark->spr.yrepeat = 0; spark->spr.xrepeat = spark->spr.yrepeat = 0;
if (l) if (l)
{ {
l->spr.z += (4 << 8); l->spr.pos.Z += (4 << 8);
l->spr.xvel = 16; l->spr.xvel = 16;
l->spr.xrepeat = l->spr.yrepeat = 24; l->spr.xrepeat = l->spr.yrepeat = 24;
l->spr.ang += 64 - (krand() & 127); l->spr.ang += 64 - (krand() & 127);
@ -509,7 +509,7 @@ static void shootstuff(DDukeActor* actor, int p, int sx, int sy, int sz, int sa,
if (aimed) if (aimed)
{ {
int dal = ((aimed->spr.xrepeat * tileHeight(aimed->spr.picnum)) << 1) - (12 << 8); int dal = ((aimed->spr.xrepeat * tileHeight(aimed->spr.picnum)) << 1) - (12 << 8);
zvel = ((aimed->spr.z - sz - dal) * vel) / ldist(ps[p].GetActor(), aimed); zvel = ((aimed->spr.pos.Z - sz - dal) * vel) / ldist(ps[p].GetActor(), aimed);
sa = getangle(aimed->spr.pos.X - sx, aimed->spr.pos.Y - sy); sa = getangle(aimed->spr.pos.X - sx, aimed->spr.pos.Y - sy);
} }
else else
@ -624,7 +624,7 @@ static void shootrpg(DDukeActor* actor, int p, int sx, int sy, int sz, int sa, i
act90 = aimed; act90 = aimed;
} }
int dal = ((aimed->spr.xrepeat * tileHeight(aimed->spr.picnum)) << 1) + (8 << 8); int dal = ((aimed->spr.xrepeat * tileHeight(aimed->spr.picnum)) << 1) + (8 << 8);
zvel = ((aimed->spr.z - sz - dal) * vel) / ldist(ps[p].GetActor(), aimed); zvel = ((aimed->spr.pos.Z - sz - dal) * vel) / ldist(ps[p].GetActor(), aimed);
if (aimed->spr.picnum != RECON) if (aimed->spr.picnum != RECON)
sa = getangle(aimed->spr.pos.X - sx, aimed->spr.pos.Y - sy); sa = getangle(aimed->spr.pos.X - sx, aimed->spr.pos.Y - sy);
} }
@ -778,7 +778,7 @@ static void shootwhip(DDukeActor* actor, int p, int sx, int sy, int sz, int sa,
if (aimed) if (aimed)
{ {
int dal = ((aimed->spr.xrepeat * tileHeight(aimed->spr.picnum)) << 1) - (12 << 8); int dal = ((aimed->spr.xrepeat * tileHeight(aimed->spr.picnum)) << 1) - (12 << 8);
zvel = ((aimed->spr.z - sz - dal) * vel) / ldist(ps[p].GetActor(), aimed); zvel = ((aimed->spr.pos.Z - sz - dal) * vel) / ldist(ps[p].GetActor(), aimed);
sa = getangle(aimed->spr.pos.X - sx, aimed->spr.pos.Y - sy); sa = getangle(aimed->spr.pos.X - sx, aimed->spr.pos.Y - sy);
} }
else else
@ -850,7 +850,7 @@ void shoot_r(DDukeActor* actor, int atwith)
sa = actor->spr.ang; sa = actor->spr.ang;
sx = actor->spr.pos.X; sx = actor->spr.pos.X;
sy = actor->spr.pos.Y; sy = actor->spr.pos.Y;
sz = actor->spr.z - ((actor->spr.yrepeat * tileHeight(actor->spr.picnum)) << 1) + (4 << 8); sz = actor->spr.pos.Z - ((actor->spr.yrepeat * tileHeight(actor->spr.picnum)) << 1) + (4 << 8);
sz -= (7 << 8); sz -= (7 << 8);
if (badguy(actor)) if (badguy(actor))
{ {
@ -897,7 +897,7 @@ void shoot_r(DDukeActor* actor, int atwith)
{ {
j->spr.xvel = 32; j->spr.xvel = 32;
j->spr.ang = actor->spr.ang; j->spr.ang = actor->spr.ang;
j->spr.z -= (5 << 8); j->spr.pos.Z -= (5 << 8);
} }
break; break;
} }
@ -908,7 +908,7 @@ void shoot_r(DDukeActor* actor, int atwith)
{ {
j->spr.xvel = 250; j->spr.xvel = 250;
j->spr.ang = actor->spr.ang; j->spr.ang = actor->spr.ang;
j->spr.z -= (15 << 8); j->spr.pos.Z -= (15 << 8);
} }
break; break;
} }
@ -2351,7 +2351,7 @@ static void underwater(int snum, ESyncBits actions, int fz, int cz)
j->spr.pos.Y += bsin(p->angle.ang.asbuild() + 64 - (global_random & 128) + 128, -6); j->spr.pos.Y += bsin(p->angle.ang.asbuild() + 64 - (global_random & 128) + 128, -6);
j->spr.xrepeat = 3; j->spr.xrepeat = 3;
j->spr.yrepeat = 2; j->spr.yrepeat = 2;
j->spr.z = p->pos.Z + (8 << 8); j->spr.pos.Z = p->pos.Z + (8 << 8);
j->spr.cstat = CSTAT_SPRITE_TRANS_FLIP | CSTAT_SPRITE_TRANSLUCENT; j->spr.cstat = CSTAT_SPRITE_TRANS_FLIP | CSTAT_SPRITE_TRANSLUCENT;
} }
} }
@ -2753,7 +2753,7 @@ static void operateweapon(int snum, ESyncBits actions, sectortype* psectp)
if (k == 15) if (k == 15)
{ {
spawned->spr.yvel = 3; spawned->spr.yvel = 3;
spawned->spr.z += (8 << 8); spawned->spr.pos.Z += (8 << 8);
} }
k = hits(p->GetActor()); k = hits(p->GetActor());
@ -2978,7 +2978,7 @@ static void operateweapon(int snum, ESyncBits actions, sectortype* psectp)
j->spr.ang += 1024; j->spr.ang += 1024;
j->spr.ang &= 2047; j->spr.ang &= 2047;
j->spr.xvel += 32; j->spr.xvel += 32;
j->spr.z += (3 << 8); j->spr.pos.Z += (3 << 8);
ssp(j, CLIPMASK0); ssp(j, CLIPMASK0);
} }
} }
@ -3378,7 +3378,7 @@ void processinput_r(int snum)
while (auto act2 = it.Next()) while (auto act2 = it.Next())
{ {
if (act2->spr.picnum == RRTILE380) if (act2->spr.picnum == RRTILE380)
if (act2->spr.z - (8 << 8) < p->pos.Z) if (act2->spr.pos.Z - (8 << 8) < p->pos.Z)
psectlotag = 2; psectlotag = 2;
} }
} }
@ -3471,7 +3471,7 @@ void processinput_r(int snum)
p->MotoSpeed -= p->MotoSpeed / 16.; p->MotoSpeed -= p->MotoSpeed / 16.;
} }
} }
else if (badguy(clz.actor()) && clz.actor()->spr.xrepeat > 24 && abs(pact->spr.z - clz.actor()->spr.z) < (84 << 8)) else if (badguy(clz.actor()) && clz.actor()->spr.xrepeat > 24 && abs(pact->spr.pos.Z - clz.actor()->spr.pos.Z) < (84 << 8))
{ {
int j = getangle(clz.actor()->spr.pos.X - p->pos.X, clz.actor()->spr.pos.Y - p->pos.Y); int j = getangle(clz.actor()->spr.pos.X - p->pos.X, clz.actor()->spr.pos.Y - p->pos.Y);
p->posxv -= bcos(j, 4); p->posxv -= bcos(j, 4);
@ -3484,9 +3484,9 @@ void processinput_r(int snum)
p->stairs = 10; p->stairs = 10;
if ((actions & SB_CROUCH) && !p->OnMotorcycle) if ((actions & SB_CROUCH) && !p->OnMotorcycle)
{ {
cz = clz.actor()->spr.z; cz = clz.actor()->spr.pos.Z;
chz.setNone(); chz.setNone();
fz = clz.actor()->spr.z + (4 << 8); fz = clz.actor()->spr.pos.Z + (4 << 8);
} }
} }
else else

View file

@ -128,7 +128,7 @@ void DoSpawn(struct player_struct *p, int snum)
j->spr.ang += 1024; j->spr.ang += 1024;
j->spr.ang &= 2047; j->spr.ang &= 2047;
j->spr.xvel += 32; j->spr.xvel += 32;
j->spr.z += (3<<8); j->spr.pos.Z += (3<<8);
ssp(j,CLIPMASK0); ssp(j,CLIPMASK0);
} }
@ -361,7 +361,7 @@ void operateweapon_ww(int snum, ESyncBits actions)
if (k == 15) if (k == 15)
{ {
j->spr.yvel = 3; j->spr.yvel = 3;
j->spr.z += (8 << 8); j->spr.pos.Z += (8 << 8);
} }
k = hits(p->GetActor()); k = hits(p->GetActor());

View file

@ -583,7 +583,7 @@ void resetpspritevars(int g)
po[numplayersprites].ox = act->spr.pos.X; po[numplayersprites].ox = act->spr.pos.X;
po[numplayersprites].oy = act->spr.pos.Y; po[numplayersprites].oy = act->spr.pos.Y;
po[numplayersprites].oz = act->spr.z; po[numplayersprites].oz = act->spr.pos.Z;
po[numplayersprites].oa = act->spr.ang; po[numplayersprites].oa = act->spr.ang;
po[numplayersprites].os = act->spr.sector(); po[numplayersprites].os = act->spr.sector();
@ -627,7 +627,7 @@ void resetpspritevars(int g)
ps[j].bobposx = ps[j].oposx = ps[j].pos.X = act->spr.pos.X; ps[j].bobposx = ps[j].oposx = ps[j].pos.X = act->spr.pos.X;
ps[j].bobposy = ps[j].oposy = ps[j].pos.Y = act->spr.pos.Y; ps[j].bobposy = ps[j].oposy = ps[j].pos.Y = act->spr.pos.Y;
ps[j].oposz = ps[j].pos.Z = act->spr.z; ps[j].oposz = ps[j].pos.Z = act->spr.pos.Z;
act->spr.backuppos(); act->spr.backuppos();
ps[j].angle.oang = ps[j].angle.ang = buildang(act->spr.ang); ps[j].angle.oang = ps[j].angle.ang = buildang(act->spr.ang);

View file

@ -115,7 +115,7 @@ void GameInterface::UpdateCameras(double smoothratio)
if (!testnewrenderer) if (!testnewrenderer)
{ {
// Note: no ROR or camera here - Polymost has no means to detect these things before rendering the scene itself. // Note: no ROR or camera here - Polymost has no means to detect these things before rendering the scene itself.
renderDrawRoomsQ16(camera->pos.X, camera->pos.Y, camera->z, ang.asq16(), IntToFixed(camera->shade), camera->sector(), false); // why 'shade'...? renderDrawRoomsQ16(camera->pos.X, camera->pos.Y, camera->pos.Z, ang.asq16(), IntToFixed(camera->shade), camera->sector(), false); // why 'shade'...?
fi.animatesprites(pm_tsprite, pm_spritesortcnt, camera->pos.X, camera->pos.Y, ang.asbuild(), (int)smoothratio); fi.animatesprites(pm_tsprite, pm_spritesortcnt, camera->pos.X, camera->pos.Y, ang.asbuild(), (int)smoothratio);
renderDrawMasks(); renderDrawMasks();
} }
@ -290,7 +290,7 @@ void displayrooms(int snum, double smoothratio)
cang = buildang(interpolatedangle(ud.cameraactor->tempang, s->ang, smoothratio)); cang = buildang(interpolatedangle(ud.cameraactor->tempang, s->ang, smoothratio));
auto bh = buildhoriz(s->yvel); auto bh = buildhoriz(s->yvel);
renderView(s, s->sector(), s->pos.X, s->pos.Y, s->z - (4 << 8), cang, bh, buildang(0), (int)smoothratio); renderView(s, s->sector(), s->pos.X, s->pos.Y, s->pos.Z - (4 << 8), cang, bh, buildang(0), (int)smoothratio);
} }
else else
{ {

View file

@ -360,7 +360,7 @@ void doanimations(void)
if (act->spr.statnum != STAT_EFFECTOR) if (act->spr.statnum != STAT_EFFECTOR)
{ {
act->spr.backupz(); act->spr.backupz();
act->spr.z += v; act->spr.pos.Z += v;
act->floorz = dasectp->floorz + v; act->floorz = dasectp->floorz + v;
} }
} }
@ -607,7 +607,7 @@ static void handle_st15(sectortype* sptr, DDukeActor* actor)
} }
else else
{ {
if (sptr->floorz > a2->spr.z) if (sptr->floorz > a2->spr.pos.Z)
activatewarpelevators(a2, -1); activatewarpelevators(a2, -1);
else else
activatewarpelevators(a2, 1); activatewarpelevators(a2, 1);
@ -720,7 +720,7 @@ REDODOOR:
{ {
if (a2->spr.statnum == 3 && a2->spr.lotag == 9) if (a2->spr.statnum == 3 && a2->spr.lotag == 9)
{ {
j = a2->spr.z; j = a2->spr.pos.Z;
break; break;
} }
} }

View file

@ -199,7 +199,7 @@ void operaterespawns_d(int low)
auto star = spawn(act, TRANSPORTERSTAR); auto star = spawn(act, TRANSPORTERSTAR);
if (star) if (star)
{ {
star->spr.z -= (32 << 8); star->spr.pos.Z -= (32 << 8);
act->spr.extra = 66 - 12; // Just a way to killit act->spr.extra = 66 - 12; // Just a way to killit
} }
@ -1110,7 +1110,7 @@ void checkhitsprite_d(DDukeActor* targ, DDukeActor* proj)
case HEAVYHBOMB: case HEAVYHBOMB:
for (k = 0; k < 64; k++) for (k = 0; k < 64; k++)
{ {
auto j = EGS(targ->spr.sector(), targ->spr.pos.X, targ->spr.pos.Y, targ->spr.z - (krand() % (48 << 8)), SCRAP3 + (krand() & 3), -8, 48, 48, krand() & 2047, (krand() & 63) + 64, -(krand() & 4095) - (targ->spr.zvel >> 2), targ, 5); auto j = EGS(targ->spr.sector(), targ->spr.pos.X, targ->spr.pos.Y, targ->spr.pos.Z - (krand() % (48 << 8)), SCRAP3 + (krand() & 3), -8, 48, 48, krand() & 2047, (krand() & 63) + 64, -(krand() & 4095) - (targ->spr.zvel >> 2), targ, 5);
j->spr.pal = 8; j->spr.pal = 8;
} }
@ -1125,7 +1125,7 @@ void checkhitsprite_d(DDukeActor* targ, DDukeActor* proj)
case HANGLIGHT: case HANGLIGHT:
case GENERICPOLE2: case GENERICPOLE2:
for (k = 0; k < 6; k++) for (k = 0; k < 6; k++)
EGS(targ->spr.sector(), targ->spr.pos.X, targ->spr.pos.Y, targ->spr.z - (8 << 8), SCRAP1 + (krand() & 15), -8, 48, 48, krand() & 2047, (krand() & 63) + 64, -(krand() & 4095) - (targ->spr.zvel >> 2), targ, 5); EGS(targ->spr.sector(), targ->spr.pos.X, targ->spr.pos.Y, targ->spr.pos.Z - (8 << 8), SCRAP1 + (krand() & 15), -8, 48, 48, krand() & 2047, (krand() & 63) + 64, -(krand() & 4095) - (targ->spr.zvel >> 2), targ, 5);
S_PlayActorSound(GLASS_HEAVYBREAK, targ); S_PlayActorSound(GLASS_HEAVYBREAK, targ);
deletesprite(targ); deletesprite(targ);
break; break;
@ -1244,7 +1244,7 @@ void checkhitsprite_d(DDukeActor* targ, DDukeActor* proj)
if (targ->spr.cstat & CSTAT_SPRITE_BLOCK) if (targ->spr.cstat & CSTAT_SPRITE_BLOCK)
{ {
S_PlayActorSound(GLASS_BREAKING, targ); S_PlayActorSound(GLASS_BREAKING, targ);
targ->spr.z += 16 << 8; targ->spr.pos.Z += 16 << 8;
targ->spr.cstat = 0; targ->spr.cstat = 0;
lotsofglass(targ, nullptr, 5); lotsofglass(targ, nullptr, 5);
} }
@ -1311,7 +1311,7 @@ void checkhitsprite_d(DDukeActor* targ, DDukeActor* proj)
} }
{ {
auto j = spawn(targ, STEAM); auto j = spawn(targ, STEAM);
if (j) j->spr.z = targ->spr.sector()->floorz - (32 << 8); if (j) j->spr.pos.Z = targ->spr.sector()->floorz - (32 << 8);
} }
break; break;
@ -1397,7 +1397,7 @@ void checkhitsprite_d(DDukeActor* targ, DDukeActor* proj)
{ {
if (proj->spr.pal == 6) if (proj->spr.pal == 6)
spawned->spr.pal = 6; spawned->spr.pal = 6;
spawned->spr.z += (4 << 8); spawned->spr.pos.Z += (4 << 8);
spawned->spr.xvel = 16; spawned->spr.xvel = 16;
spawned->spr.xrepeat = spawned->spr.yrepeat = 24; spawned->spr.xrepeat = spawned->spr.yrepeat = 24;
spawned->spr.ang += 32 - (krand() & 63); spawned->spr.ang += 32 - (krand() & 63);

View file

@ -313,7 +313,7 @@ void operaterespawns_r(int low)
if (badguypic(act->spr.hitag) && ud.monsters_off) break; if (badguypic(act->spr.hitag) && ud.monsters_off) break;
auto star = spawn(act, TRANSPORTERSTAR); auto star = spawn(act, TRANSPORTERSTAR);
if (star) star->spr.z -= (32 << 8); if (star) star->spr.pos.Z -= (32 << 8);
act->spr.extra = 66 - 12; // Just a way to killit act->spr.extra = 66 - 12; // Just a way to killit
break; break;
@ -939,7 +939,7 @@ static void lotsofpopcorn(DDukeActor *actor, walltype* wal, int n)
for (j = n - 1; j >= 0; j--) for (j = n - 1; j >= 0; j--)
{ {
a = actor->spr.ang - 256 + (krand() & 511) + 1024; a = actor->spr.ang - 256 + (krand() & 511) + 1024;
EGS(actor->spr.sector(), actor->spr.pos.X, actor->spr.pos.Y, actor->spr.z, POPCORN, -32, 36, 36, a, 32 + (krand() & 63), 1024 - (krand() & 1023), actor, 5); EGS(actor->spr.sector(), actor->spr.pos.X, actor->spr.pos.Y, actor->spr.pos.Z, POPCORN, -32, 36, 36, a, 32 + (krand() & 63), 1024 - (krand() & 1023), actor, 5);
} }
return; return;
} }
@ -967,7 +967,7 @@ static void lotsofpopcorn(DDukeActor *actor, walltype* wal, int n)
{ {
z = sect->floorz - (krand() & (abs(sect->ceilingz - sect->floorz))); z = sect->floorz - (krand() & (abs(sect->ceilingz - sect->floorz)));
if (z < -(32 << 8) || z >(32 << 8)) if (z < -(32 << 8) || z >(32 << 8))
z = actor->spr.z - (32 << 8) + (krand() & ((64 << 8) - 1)); z = actor->spr.pos.Z - (32 << 8) + (krand() & ((64 << 8) - 1));
a = actor->spr.ang - 1024; a = actor->spr.ang - 1024;
EGS(actor->spr.sector(), x1, y1, z, POPCORN, -32, 36, 36, a, 32 + (krand() & 63), -(krand() & 1023), actor, 5); EGS(actor->spr.sector(), x1, y1, z, POPCORN, -32, 36, 36, a, 32 + (krand() & 63), -(krand() & 1023), actor, 5);
} }
@ -2072,7 +2072,7 @@ void checkhitsprite_r(DDukeActor* targ, DDukeActor* proj)
lotsofglass(targ, nullptr, 10); lotsofglass(targ, nullptr, 10);
targ->spr.picnum++; targ->spr.picnum++;
for (k = 0; k < 6; k++) for (k = 0; k < 6; k++)
EGS(targ->spr.sector(), targ->spr.pos.X, targ->spr.pos.Y, targ->spr.z - (8 << 8), SCRAP6 + (krand() & 15), -8, 48, 48, krand() & 2047, (krand() & 63) + 64, -(krand() & 4095) - (targ->spr.zvel >> 2), targ, 5); EGS(targ->spr.sector(), targ->spr.pos.X, targ->spr.pos.Y, targ->spr.pos.Z - (8 << 8), SCRAP6 + (krand() & 15), -8, 48, 48, krand() & 2047, (krand() & 63) + 64, -(krand() & 4095) - (targ->spr.zvel >> 2), targ, 5);
break; break;
case BOWLINGBALL: case BOWLINGBALL:
proj->spr.xvel = (targ->spr.xvel >> 1) + (targ->spr.xvel >> 2); proj->spr.xvel = (targ->spr.xvel >> 1) + (targ->spr.xvel >> 2);
@ -2164,7 +2164,7 @@ void checkhitsprite_r(DDukeActor* targ, DDukeActor* proj)
case UWHIP: case UWHIP:
for (k = 0; k < 64; k++) for (k = 0; k < 64; k++)
{ {
auto j = EGS(targ->spr.sector(), targ->spr.pos.X, targ->spr.pos.Y, targ->spr.z - (krand() % (48 << 8)), SCRAP6 + (krand() & 3), -8, 48, 48, krand() & 2047, (krand() & 63) + 64, -(krand() & 4095) - (targ->spr.zvel >> 2), targ, 5); auto j = EGS(targ->spr.sector(), targ->spr.pos.X, targ->spr.pos.Y, targ->spr.pos.Z - (krand() % (48 << 8)), SCRAP6 + (krand() & 3), -8, 48, 48, krand() & 2047, (krand() & 63) + 64, -(krand() & 4095) - (targ->spr.zvel >> 2), targ, 5);
j->spr.pal = 8; j->spr.pal = 8;
} }
@ -2323,7 +2323,7 @@ void checkhitsprite_r(DDukeActor* targ, DDukeActor* proj)
} }
{ {
auto j = spawn(targ, STEAM); auto j = spawn(targ, STEAM);
if (j) j->spr.z = targ->spr.sector()->floorz - (32 << 8); if (j) j->spr.pos.Z = targ->spr.sector()->floorz - (32 << 8);
} }
break; break;
@ -2369,7 +2369,7 @@ void checkhitsprite_r(DDukeActor* targ, DDukeActor* proj)
{ {
if (proj->spr.pal == 6) if (proj->spr.pal == 6)
spawned->spr.pal = 6; spawned->spr.pal = 6;
spawned->spr.z += (4 << 8); spawned->spr.pos.Z += (4 << 8);
spawned->spr.xvel = 16; spawned->spr.xvel = 16;
spawned->spr.xrepeat = spawned->spr.yrepeat = 24; spawned->spr.xrepeat = spawned->spr.yrepeat = 24;
spawned->spr.ang += 32 - (krand() & 63); spawned->spr.ang += 32 - (krand() & 63);

View file

@ -276,7 +276,7 @@ static int GetPositionInfo(DDukeActor* actor, int soundNum, sectortype* sect,
sndist += dist_adjust; sndist += dist_adjust;
if (sndist < 0) sndist = 0; if (sndist < 0) sndist = 0;
if (sect!= nullptr && sndist && actor->spr.picnum != MUSICANDSFX && !cansee(cam->X, cam->Y, cam->Z - (24 << 8), sect, actor->spr.pos.X, actor->spr.pos.Y, actor->spr.z - (24 << 8), actor->spr.sector())) if (sect!= nullptr && sndist && actor->spr.picnum != MUSICANDSFX && !cansee(cam->X, cam->Y, cam->Z - (24 << 8), sect, actor->spr.pos.X, actor->spr.pos.Y, actor->spr.pos.Z - (24 << 8), actor->spr.sector()))
sndist += sndist >> (isRR() ? 2 : 5); sndist += sndist >> (isRR() ? 2 : 5);
// Here the sound distance was clamped to a minimum of 144*4. // Here the sound distance was clamped to a minimum of 144*4.

View file

@ -61,7 +61,7 @@ DDukeActor* EGS(sectortype* whatsectp, int s_x, int s_y, int s_z, int s_pn, int8
act->spr.pos.X = s_x; act->spr.pos.X = s_x;
act->spr.pos.Y = s_y; act->spr.pos.Y = s_y;
act->spr.z = s_z; act->spr.pos.Z = s_z;
act->spr.cstat = 0; act->spr.cstat = 0;
act->spr.picnum = s_pn; act->spr.picnum = s_pn;
act->spr.shade = s_s; act->spr.shade = s_s;
@ -219,7 +219,7 @@ DDukeActor* spawn(DDukeActor* actj, int pn)
{ {
if (actj) if (actj)
{ {
auto spawned = EGS(actj->spr.sector(), actj->spr.pos.X, actj->spr.pos.Y, actj->spr.z, pn, 0, 0, 0, 0, 0, 0, actj, 0); auto spawned = EGS(actj->spr.sector(), actj->spr.pos.X, actj->spr.pos.Y, actj->spr.pos.Z, pn, 0, 0, 0, 0, 0, 0, actj, 0);
if (spawned) if (spawned)
{ {
spawned->picnum = actj->spr.picnum; spawned->picnum = actj->spr.picnum;
@ -304,7 +304,7 @@ void spawntransporter(DDukeActor *actj, DDukeActor* act, bool beam)
{ {
act->spr.xrepeat = 31; act->spr.xrepeat = 31;
act->spr.yrepeat = 1; act->spr.yrepeat = 1;
act->spr.z = actj->spr.sector()->floorz - (isRR() ? PHEIGHT_RR : PHEIGHT_DUKE); act->spr.pos.Z = actj->spr.sector()->floorz - (isRR() ? PHEIGHT_RR : PHEIGHT_DUKE);
} }
else else
{ {
@ -318,7 +318,7 @@ void spawntransporter(DDukeActor *actj, DDukeActor* act, bool beam)
act->spr.xrepeat = 48; act->spr.xrepeat = 48;
act->spr.yrepeat = 64; act->spr.yrepeat = 64;
if (actj->spr.statnum == 10 || badguy(actj)) if (actj->spr.statnum == 10 || badguy(actj))
act->spr.z -= (32 << 8); act->spr.pos.Z -= (32 << 8);
} }
} }
@ -410,7 +410,7 @@ void initfootprint(DDukeActor* actj, DDukeActor* act)
act->spr.ang = actj->spr.ang; act->spr.ang = actj->spr.ang;
} }
act->spr.z = sect->floorz; act->spr.pos.Z = sect->floorz;
if (sect->lotag != 1 && sect->lotag != 2) if (sect->lotag != 1 && sect->lotag != 2)
act->spr.xrepeat = act->spr.yrepeat = 32; act->spr.xrepeat = act->spr.yrepeat = 32;
@ -437,13 +437,13 @@ void initshell(DDukeActor* actj, DDukeActor* act, bool isshell)
a = ps[snum].angle.ang.asbuild() - (krand() & 63) + 8; //Fine tune a = ps[snum].angle.ang.asbuild() - (krand() & 63) + 8; //Fine tune
t[0] = krand() & 1; t[0] = krand() & 1;
act->spr.z = (3 << 8) + ps[snum].pyoff + ps[snum].pos.Z - (ps[snum].horizon.sum().asq16() >> 12) + (!isshell ? (3 << 8) : 0); act->spr.pos.Z = (3 << 8) + ps[snum].pyoff + ps[snum].pos.Z - (ps[snum].horizon.sum().asq16() >> 12) + (!isshell ? (3 << 8) : 0);
act->spr.zvel = -(krand() & 255); act->spr.zvel = -(krand() & 255);
} }
else else
{ {
a = act->spr.ang; a = act->spr.ang;
act->spr.z = actj->spr.z - gs.playerheight + (3 << 8); act->spr.pos.Z = actj->spr.pos.Z - gs.playerheight + (3 << 8);
} }
act->spr.pos.X = actj->spr.pos.X + bcos(a, -7); act->spr.pos.X = actj->spr.pos.X + bcos(a, -7);
@ -482,13 +482,13 @@ void initcrane(DDukeActor* actj, DDukeActor* act, int CRANEPOLE)
act->spr.cstat |= CSTAT_SPRITE_BLOCK_ALL | CSTAT_SPRITE_ONE_SIDE; act->spr.cstat |= CSTAT_SPRITE_BLOCK_ALL | CSTAT_SPRITE_ONE_SIDE;
act->spr.picnum += 2; act->spr.picnum += 2;
act->spr.z = sect->ceilingz + (48 << 8); act->spr.pos.Z = sect->ceilingz + (48 << 8);
t[4] = cranes.Reserve(1); t[4] = cranes.Reserve(1);
auto& apt = cranes[t[4]]; auto& apt = cranes[t[4]];
apt.x = act->spr.pos.X; apt.x = act->spr.pos.X;
apt.y = act->spr.pos.Y; apt.y = act->spr.pos.Y;
apt.z = act->spr.z; apt.z = act->spr.pos.Z;
apt.poleactor = nullptr; apt.poleactor = nullptr;
DukeStatIterator it(STAT_DEFAULT); DukeStatIterator it(STAT_DEFAULT);
@ -508,7 +508,7 @@ void initcrane(DDukeActor* actj, DDukeActor* act, int CRANEPOLE)
act->spr.pos.X = act->spr.pos.X; act->spr.pos.X = act->spr.pos.X;
act->spr.pos.Y = act->spr.pos.Y; act->spr.pos.Y = act->spr.pos.Y;
act->spr.z = act->spr.z; act->spr.pos.Z = act->spr.pos.Z;
act->spr.shade = act->spr.shade; act->spr.shade = act->spr.shade;
SetActor(act, act->spr.pos); SetActor(act, act->spr.pos);
@ -536,17 +536,17 @@ void initwaterdrip(DDukeActor* actj, DDukeActor* actor)
if (actj->spr.pal != 1) if (actj->spr.pal != 1)
{ {
actor->spr.pal = 2; actor->spr.pal = 2;
actor->spr.z -= (18 << 8); actor->spr.pos.Z -= (18 << 8);
} }
else actor->spr.z -= (13 << 8); else actor->spr.pos.Z -= (13 << 8);
actor->spr.ang = getangle(ps[connecthead].pos.X - actor->spr.pos.X, ps[connecthead].pos.Y - actor->spr.pos.Y); actor->spr.ang = getangle(ps[connecthead].pos.X - actor->spr.pos.X, ps[connecthead].pos.Y - actor->spr.pos.Y);
actor->spr.xvel = 48 - (krand() & 31); actor->spr.xvel = 48 - (krand() & 31);
ssp(actor, CLIPMASK0); ssp(actor, CLIPMASK0);
} }
else if (!actj) else if (!actj)
{ {
actor->spr.z += (4 << 8); actor->spr.pos.Z += (4 << 8);
t[0] = actor->spr.z; t[0] = actor->spr.pos.Z;
if (!isRR()) t[1] = krand() & 127; if (!isRR()) t[1] = krand() & 127;
} }
actor->spr.xrepeat = 24; actor->spr.xrepeat = 24;
@ -638,7 +638,7 @@ void spawneffector(DDukeActor* actor, TArray<DDukeActor*>* actors)
} }
else actor->SetOwner(actor); else actor->SetOwner(actor);
t[4] = sectp->floorz == actor->spr.z; t[4] = sectp->floorz == actor->spr.pos.Z;
actor->spr.cstat = 0; actor->spr.cstat = 0;
ChangeActorStat(actor, STAT_TRANSPORT); ChangeActorStat(actor, STAT_TRANSPORT);
return; return;
@ -652,13 +652,13 @@ void spawneffector(DDukeActor* actor, TArray<DDukeActor*>* actors)
{ {
t[1] = sectp->ceilingz; t[1] = sectp->ceilingz;
if (actor->spr.pal) if (actor->spr.pal)
sectp->ceilingz = actor->spr.z; sectp->ceilingz = actor->spr.pos.Z;
} }
else else
{ {
t[1] = sectp->floorz; t[1] = sectp->floorz;
if (actor->spr.pal) if (actor->spr.pal)
sectp->floorz = actor->spr.z; sectp->floorz = actor->spr.pos.Z;
} }
actor->spr.hitag <<= 2; actor->spr.hitag <<= 2;
@ -676,11 +676,11 @@ void spawneffector(DDukeActor* actor, TArray<DDukeActor*>* actors)
else else
t[4] = sectp->ceilingz; t[4] = sectp->ceilingz;
sectp->ceilingz = actor->spr.z; sectp->ceilingz = actor->spr.pos.Z;
StartInterpolation(sectp, Interp_Sect_Ceilingz); StartInterpolation(sectp, Interp_Sect_Ceilingz);
break; break;
case SE_35: case SE_35:
sectp->ceilingz = actor->spr.z; sectp->ceilingz = actor->spr.pos.Z;
break; break;
case SE_27_DEMO_CAM: case SE_27_DEMO_CAM:
if (ud.recstat == 1) if (ud.recstat == 1)
@ -704,18 +704,18 @@ void spawneffector(DDukeActor* actor, TArray<DDukeActor*>* actors)
t[0] = sectp->ceilingz; t[0] = sectp->ceilingz;
t[1] = sectp->floorz; t[1] = sectp->floorz;
bool ceiling = (abs(t[0] - actor->spr.z) < abs(t[1] - actor->spr.z)); bool ceiling = (abs(t[0] - actor->spr.pos.Z) < abs(t[1] - actor->spr.pos.Z));
actor->spriteextra = ceiling; actor->spriteextra = ceiling;
if (actor->spr.ang == 512) if (actor->spr.ang == 512)
{ {
if (ceiling) if (ceiling)
sectp->ceilingz = actor->spr.z; sectp->ceilingz = actor->spr.pos.Z;
else else
sectp->floorz = actor->spr.z; sectp->floorz = actor->spr.pos.Z;
} }
else else
sectp->ceilingz = sectp->floorz = actor->spr.z; sectp->ceilingz = sectp->floorz = actor->spr.pos.Z;
if (sectp->ceilingstat & CSTAT_SECTOR_SKY) if (sectp->ceilingstat & CSTAT_SECTOR_SKY)
{ {
@ -840,7 +840,7 @@ void spawneffector(DDukeActor* actor, TArray<DDukeActor*>* actors)
case SE_31_FLOOR_RISE_FALL: case SE_31_FLOOR_RISE_FALL:
t[1] = sectp->floorz; t[1] = sectp->floorz;
// t[2] = actor->spr.hitag; // t[2] = actor->spr.hitag;
if (actor->spr.ang != 1536) sectp->floorz = actor->spr.z; if (actor->spr.ang != 1536) sectp->floorz = actor->spr.pos.Z;
for (auto& wal : wallsofsector(sectp)) for (auto& wal : wallsofsector(sectp))
if (wal.hitag == 0) wal.hitag = 9999; if (wal.hitag == 0) wal.hitag = 9999;
@ -851,7 +851,7 @@ void spawneffector(DDukeActor* actor, TArray<DDukeActor*>* actors)
case SE_32_CEILING_RISE_FALL: case SE_32_CEILING_RISE_FALL:
t[1] = sectp->ceilingz; t[1] = sectp->ceilingz;
t[2] = actor->spr.hitag; t[2] = actor->spr.hitag;
if (actor->spr.ang != 1536) sectp->ceilingz = actor->spr.z; if (actor->spr.ang != 1536) sectp->ceilingz = actor->spr.pos.Z;
for (auto& wal : wallsofsector(sectp)) for (auto& wal : wallsofsector(sectp))
if (wal.hitag == 0) wal.hitag = 9999; if (wal.hitag == 0) wal.hitag = 9999;
@ -874,7 +874,7 @@ void spawneffector(DDukeActor* actor, TArray<DDukeActor*>* actors)
case SE_9_DOWN_OPEN_DOOR_LIGHTS: case SE_9_DOWN_OPEN_DOOR_LIGHTS:
if (sectp->lotag && if (sectp->lotag &&
labs(sectp->ceilingz - actor->spr.z) > 1024) labs(sectp->ceilingz - actor->spr.pos.Z) > 1024)
sectp->lotag |= 32768; //If its open sectp->lotag |= 32768; //If its open
[[fallthrough]]; [[fallthrough]];
case SE_8_UP_OPEN_DOOR_LIGHTS: case SE_8_UP_OPEN_DOOR_LIGHTS:
@ -1082,7 +1082,7 @@ void lotsofglass(DDukeActor *actor, walltype* wal, int n)
for (j = n - 1; j >= 0; j--) for (j = n - 1; j >= 0; j--)
{ {
a = actor->spr.ang - 256 + (krand() & 511) + 1024; a = actor->spr.ang - 256 + (krand() & 511) + 1024;
EGS(actor->spr.sector(), actor->spr.pos.X, actor->spr.pos.Y, actor->spr.z, TILE_GLASSPIECES + (j % 3), -32, 36, 36, a, 32 + (krand() & 63), 1024 - (krand() & 1023), actor, 5); EGS(actor->spr.sector(), actor->spr.pos.X, actor->spr.pos.Y, actor->spr.pos.Z, TILE_GLASSPIECES + (j % 3), -32, 36, 36, a, 32 + (krand() & 63), 1024 - (krand() & 1023), actor, 5);
} }
return; return;
} }
@ -1105,7 +1105,7 @@ void lotsofglass(DDukeActor *actor, walltype* wal, int n)
{ {
z = sect->floorz - (krand() & (abs(sect->ceilingz - sect->floorz))); z = sect->floorz - (krand() & (abs(sect->ceilingz - sect->floorz)));
if (z < -(32 << 8) || z >(32 << 8)) if (z < -(32 << 8) || z >(32 << 8))
z = actor->spr.z - (32 << 8) + (krand() & ((64 << 8) - 1)); z = actor->spr.pos.Z - (32 << 8) + (krand() & ((64 << 8) - 1));
a = actor->spr.ang - 1024; a = actor->spr.ang - 1024;
EGS(actor->spr.sector(), x1, y1, z, TILE_GLASSPIECES + (j % 3), -32, 36, 36, a, 32 + (krand() & 63), -(krand() & 1023), actor, 5); EGS(actor->spr.sector(), x1, y1, z, TILE_GLASSPIECES + (j % 3), -32, 36, 36, a, 32 + (krand() & 63), -(krand() & 1023), actor, 5);
} }
@ -1123,7 +1123,7 @@ void spriteglass(DDukeActor* actor, int n)
for (int j = n; j > 0; j--) for (int j = n; j > 0; j--)
{ {
int a = krand() & 2047; int a = krand() & 2047;
int z = actor->spr.z - ((krand() & 16) << 8); int z = actor->spr.pos.Z - ((krand() & 16) << 8);
auto k = EGS(actor->spr.sector(), actor->spr.pos.X, actor->spr.pos.Y, z, TILE_GLASSPIECES + (j % 3), krand() & 15, 36, 36, a, 32 + (krand() & 63), -512 - (krand() & 2047), actor, 5); auto k = EGS(actor->spr.sector(), actor->spr.pos.X, actor->spr.pos.Y, z, TILE_GLASSPIECES + (j % 3), krand() & 15, 36, 36, a, 32 + (krand() & 63), -512 - (krand() & 2047), actor, 5);
if (k) k->spr.pal = actor->spr.pal; if (k) k->spr.pal = actor->spr.pal;
} }
@ -1175,7 +1175,7 @@ void lotsofcolourglass(DDukeActor* actor, walltype* wal, int n)
for (j = n - 1; j >= 0; j--) for (j = n - 1; j >= 0; j--)
{ {
a = krand() & 2047; a = krand() & 2047;
auto k = EGS(actor->spr.sector(), actor->spr.pos.X, actor->spr.pos.Y, actor->spr.z - (krand() & (63 << 8)), TILE_GLASSPIECES + (j % 3), -32, 36, 36, a, 32 + (krand() & 63), 1024 - (krand() & 2047), actor, 5); auto k = EGS(actor->spr.sector(), actor->spr.pos.X, actor->spr.pos.Y, actor->spr.pos.Z - (krand() & (63 << 8)), TILE_GLASSPIECES + (j % 3), -32, 36, 36, a, 32 + (krand() & 63), 1024 - (krand() & 2047), actor, 5);
if (k) k->spr.pal = krand() & 15; if (k) k->spr.pal = krand() & 15;
} }
return; return;
@ -1194,7 +1194,7 @@ void lotsofcolourglass(DDukeActor* actor, walltype* wal, int n)
updatesector(x1, y1, &sect); updatesector(x1, y1, &sect);
z = sect->floorz - (krand() & (abs(sect->ceilingz - sect->floorz))); z = sect->floorz - (krand() & (abs(sect->ceilingz - sect->floorz)));
if (z < -(32 << 8) || z >(32 << 8)) if (z < -(32 << 8) || z >(32 << 8))
z = actor->spr.z - (32 << 8) + (krand() & ((64 << 8) - 1)); z = actor->spr.pos.Z - (32 << 8) + (krand() & ((64 << 8) - 1));
a = actor->spr.ang - 1024; a = actor->spr.ang - 1024;
auto k = EGS(actor->spr.sector(), x1, y1, z, TILE_GLASSPIECES + (j % 3), -32, 36, 36, a, 32 + (krand() & 63), -(krand() & 2047), actor, 5); auto k = EGS(actor->spr.sector(), x1, y1, z, TILE_GLASSPIECES + (j % 3), -32, 36, 36, a, 32 + (krand() & 63), -(krand() & 2047), actor, 5);
if (k) k->spr.pal = krand() & 7; if (k) k->spr.pal = krand() & 7;

View file

@ -161,11 +161,11 @@ DDukeActor* spawninit_d(DDukeActor* actj, DDukeActor* act, TArray<DDukeActor*>*
{ {
if (actj->spr.sector()->lotag == 2) if (actj->spr.sector()->lotag == 2)
{ {
act->spr.z = getceilzofslopeptr(act->spr.sector(), act->spr.pos.X, act->spr.pos.Y) + (16 << 8); act->spr.pos.Z = getceilzofslopeptr(act->spr.sector(), act->spr.pos.X, act->spr.pos.Y) + (16 << 8);
act->spr.cstat |= CSTAT_SPRITE_YFLIP; act->spr.cstat |= CSTAT_SPRITE_YFLIP;
} }
else if (actj->spr.sector()->lotag == 1) else if (actj->spr.sector()->lotag == 1)
act->spr.z = getflorzofslopeptr(act->spr.sector(), act->spr.pos.X, act->spr.pos.Y); act->spr.pos.Z = getflorzofslopeptr(act->spr.sector(), act->spr.pos.X, act->spr.pos.Y);
} }
if (sectp->floorpicnum == FLOORSLIME || if (sectp->floorpicnum == FLOORSLIME ||
@ -206,7 +206,7 @@ DDukeActor* spawninit_d(DDukeActor* actj, DDukeActor* act, TArray<DDukeActor*>*
case TONGUE: case TONGUE:
if (actj) if (actj)
act->spr.ang = actj->spr.ang; act->spr.ang = actj->spr.ang;
act->spr.z -= PHEIGHT_DUKE; act->spr.pos.Z -= PHEIGHT_DUKE;
act->spr.zvel = 256 - (krand() & 511); act->spr.zvel = 256 - (krand() & 511);
act->spr.xvel = 64 - (krand() & 127); act->spr.xvel = 64 - (krand() & 127);
ChangeActorStat(act, 4); ChangeActorStat(act, 4);
@ -266,7 +266,7 @@ DDukeActor* spawninit_d(DDukeActor* actj, DDukeActor* act, TArray<DDukeActor*>*
case BLOOD: case BLOOD:
act->spr.xrepeat = act->spr.yrepeat = 16; act->spr.xrepeat = act->spr.yrepeat = 16;
act->spr.z -= (26 << 8); act->spr.pos.Z -= (26 << 8);
if (actj && actj->spr.pal == 6) if (actj && actj->spr.pal == 6)
act->spr.pal = 6; act->spr.pal = 6;
ChangeActorStat(act, STAT_MISC); ChangeActorStat(act, STAT_MISC);
@ -299,9 +299,9 @@ DDukeActor* spawninit_d(DDukeActor* actj, DDukeActor* act, TArray<DDukeActor*>*
if (act->spr.picnum == LAVAPOOL) // Twentieth Anniversary World Tour if (act->spr.picnum == LAVAPOOL) // Twentieth Anniversary World Tour
{ {
int fz = getflorzofslopeptr(act->spr.sector(), act->spr.pos.X, act->spr.pos.Y); int fz = getflorzofslopeptr(act->spr.sector(), act->spr.pos.X, act->spr.pos.Y);
if (fz != act->spr.z) if (fz != act->spr.pos.Z)
act->spr.z = fz; act->spr.pos.Z = fz;
act->spr.z -= 200; act->spr.pos.Z -= 200;
} }
[[fallthrough]]; [[fallthrough]];
@ -318,7 +318,7 @@ DDukeActor* spawninit_d(DDukeActor* actj, DDukeActor* act, TArray<DDukeActor*>*
act->spr.cstat |= CSTAT_SPRITE_ALIGNMENT_WALL; act->spr.cstat |= CSTAT_SPRITE_ALIGNMENT_WALL;
act->spr.xrepeat = 7 + (krand() & 7); act->spr.xrepeat = 7 + (krand() & 7);
act->spr.yrepeat = 7 + (krand() & 7); act->spr.yrepeat = 7 + (krand() & 7);
act->spr.z -= (16 << 8); act->spr.pos.Z -= (16 << 8);
if (actj && actj->spr.pal == 6) if (actj && actj->spr.pal == 6)
act->spr.pal = 6; act->spr.pal = 6;
insertspriteq(act); insertspriteq(act);
@ -531,7 +531,7 @@ DDukeActor* spawninit_d(DDukeActor* actj, DDukeActor* act, TArray<DDukeActor*>*
if (act->spr.picnum == RESPAWNMARKERRED) if (act->spr.picnum == RESPAWNMARKERRED)
{ {
act->spr.xrepeat = act->spr.yrepeat = 24; act->spr.xrepeat = act->spr.yrepeat = 24;
if (actj) act->spr.z = actj->floorz; // -(1<<4); if (actj) act->spr.pos.Z = actj->floorz; // -(1<<4);
} }
else else
{ {
@ -643,15 +643,15 @@ DDukeActor* spawninit_d(DDukeActor* actj, DDukeActor* act, TArray<DDukeActor*>*
if (actj) if (actj)
{ {
int x = getflorzofslopeptr(act->spr.sector(), act->spr.pos.X, act->spr.pos.Y); int x = getflorzofslopeptr(act->spr.sector(), act->spr.pos.X, act->spr.pos.Y);
if (act->spr.z > x - (12 << 8)) if (act->spr.pos.Z > x - (12 << 8))
act->spr.z = x - (12 << 8); act->spr.pos.Z = x - (12 << 8);
} }
if (act->spr.picnum == ONFIRE) if (act->spr.picnum == ONFIRE)
{ {
act->spr.pos.X += krand() % 256 - 128; act->spr.pos.X += krand() % 256 - 128;
act->spr.pos.Y += krand() % 256 - 128; act->spr.pos.Y += krand() % 256 - 128;
act->spr.z -= krand() % 10240; act->spr.pos.Z -= krand() % 10240;
act->spr.cstat |= CSTAT_SPRITE_YCENTER; act->spr.cstat |= CSTAT_SPRITE_YCENTER;
} }
@ -685,7 +685,7 @@ DDukeActor* spawninit_d(DDukeActor* actj, DDukeActor* act, TArray<DDukeActor*>*
} }
case WATERBUBBLE: case WATERBUBBLE:
if (actj && actj->spr.picnum == APLAYER) if (actj && actj->spr.picnum == APLAYER)
act->spr.z -= (16 << 8); act->spr.pos.Z -= (16 << 8);
if (act->spr.picnum == WATERBUBBLE) if (act->spr.picnum == WATERBUBBLE)
{ {
if (actj) if (actj)
@ -726,7 +726,7 @@ DDukeActor* spawninit_d(DDukeActor* actj, DDukeActor* act, TArray<DDukeActor*>*
case TOUCHPLATE: case TOUCHPLATE:
t[2] = sectp->floorz; t[2] = sectp->floorz;
if (sectp->lotag != 1 && sectp->lotag != 2) if (sectp->lotag != 1 && sectp->lotag != 2)
sectp->floorz = act->spr.z; sectp->floorz = act->spr.pos.Z;
if (!isWorldTour()) if (!isWorldTour())
{ {
if (act->spr.pal && ud.multimode > 1) if (act->spr.pal && ud.multimode > 1)
@ -1006,7 +1006,7 @@ DDukeActor* spawninit_d(DDukeActor* actj, DDukeActor* act, TArray<DDukeActor*>*
if (actj) if (actj)
{ {
act->spr.lotag = 0; act->spr.lotag = 0;
act->spr.z -= (32 << 8); act->spr.pos.Z -= (32 << 8);
act->spr.zvel = -1024; act->spr.zvel = -1024;
ssp(act, CLIPMASK0); ssp(act, CLIPMASK0);
if (krand() & 4) act->spr.cstat |= CSTAT_SPRITE_XFLIP; if (krand() & 4) act->spr.cstat |= CSTAT_SPRITE_XFLIP;

View file

@ -213,11 +213,11 @@ DDukeActor* spawninit_r(DDukeActor* actj, DDukeActor* act, TArray<DDukeActor*>*
{ {
if (actj->spr.sector()->lotag == 2) if (actj->spr.sector()->lotag == 2)
{ {
act->spr.z = getceilzofslopeptr(act->spr.sector(), act->spr.pos.X, act->spr.pos.Y) + (16 << 8); act->spr.pos.Z = getceilzofslopeptr(act->spr.sector(), act->spr.pos.X, act->spr.pos.Y) + (16 << 8);
act->spr.cstat |= CSTAT_SPRITE_YFLIP; act->spr.cstat |= CSTAT_SPRITE_YFLIP;
} }
else if (actj->spr.sector()->lotag == 1) else if (actj->spr.sector()->lotag == 1)
act->spr.z = getflorzofslopeptr(act->spr.sector(), act->spr.pos.X, act->spr.pos.Y); act->spr.pos.Z = getflorzofslopeptr(act->spr.sector(), act->spr.pos.X, act->spr.pos.Y);
} }
if (sectp->floorpicnum == FLOORSLIME || if (sectp->floorpicnum == FLOORSLIME ||
@ -285,7 +285,7 @@ DDukeActor* spawninit_r(DDukeActor* actj, DDukeActor* act, TArray<DDukeActor*>*
case TONGUE: case TONGUE:
if (actj) if (actj)
act->spr.ang = actj->spr.ang; act->spr.ang = actj->spr.ang;
act->spr.z -= PHEIGHT_RR; act->spr.pos.Z -= PHEIGHT_RR;
act->spr.zvel = 256 - (krand() & 511); act->spr.zvel = 256 - (krand() & 511);
act->spr.xvel = 64 - (krand() & 127); act->spr.xvel = 64 - (krand() & 127);
ChangeActorStat(act, 4); ChangeActorStat(act, 4);
@ -325,7 +325,7 @@ DDukeActor* spawninit_r(DDukeActor* actj, DDukeActor* act, TArray<DDukeActor*>*
case BLOOD: case BLOOD:
act->spr.xrepeat = act->spr.yrepeat = 4; act->spr.xrepeat = act->spr.yrepeat = 4;
act->spr.z -= (26 << 8); act->spr.pos.Z -= (26 << 8);
ChangeActorStat(act, STAT_MISC); ChangeActorStat(act, STAT_MISC);
break; break;
case BLOODPOOL: case BLOODPOOL:
@ -354,7 +354,7 @@ DDukeActor* spawninit_r(DDukeActor* actj, DDukeActor* act, TArray<DDukeActor*>*
act->spr.cstat |= CSTAT_SPRITE_ALIGNMENT_WALL; act->spr.cstat |= CSTAT_SPRITE_ALIGNMENT_WALL;
act->spr.xrepeat = 7 + (krand() & 7); act->spr.xrepeat = 7 + (krand() & 7);
act->spr.yrepeat = 7 + (krand() & 7); act->spr.yrepeat = 7 + (krand() & 7);
act->spr.z -= (16 << 8); act->spr.pos.Z -= (16 << 8);
if (actj && actj->spr.pal == 6) if (actj && actj->spr.pal == 6)
act->spr.pal = 6; act->spr.pal = 6;
insertspriteq(act); insertspriteq(act);
@ -555,7 +555,7 @@ DDukeActor* spawninit_r(DDukeActor* actj, DDukeActor* act, TArray<DDukeActor*>*
if (act->spr.picnum == RESPAWNMARKERRED) if (act->spr.picnum == RESPAWNMARKERRED)
{ {
act->spr.xrepeat = act->spr.yrepeat = 8; act->spr.xrepeat = act->spr.yrepeat = 8;
if (actj) act->spr.z = actj->floorz; if (actj) act->spr.pos.Z = actj->floorz;
} }
else else
{ {
@ -651,8 +651,8 @@ DDukeActor* spawninit_r(DDukeActor* actj, DDukeActor* act, TArray<DDukeActor*>*
if (actj) if (actj)
{ {
int x = getflorzofslopeptr(act->spr.sector(), act->spr.pos.X, act->spr.pos.Y); int x = getflorzofslopeptr(act->spr.sector(), act->spr.pos.X, act->spr.pos.Y);
if (act->spr.z > x - (12 << 8)) if (act->spr.pos.Z > x - (12 << 8))
act->spr.z = x - (12 << 8); act->spr.pos.Z = x - (12 << 8);
} }
ChangeActorStat(act, STAT_MISC); ChangeActorStat(act, STAT_MISC);
@ -685,7 +685,7 @@ DDukeActor* spawninit_r(DDukeActor* actj, DDukeActor* act, TArray<DDukeActor*>*
} }
case WATERBUBBLE: case WATERBUBBLE:
if (actj && actj->spr.picnum == APLAYER) if (actj && actj->spr.picnum == APLAYER)
act->spr.z -= (16 << 8); act->spr.pos.Z -= (16 << 8);
if (act->spr.picnum == WATERBUBBLE) if (act->spr.picnum == WATERBUBBLE)
{ {
if (actj) if (actj)
@ -718,7 +718,7 @@ DDukeActor* spawninit_r(DDukeActor* actj, DDukeActor* act, TArray<DDukeActor*>*
case TOUCHPLATE: case TOUCHPLATE:
t[2] = sectp->floorz; t[2] = sectp->floorz;
if (sectp->lotag != 1 && sectp->lotag != 2) if (sectp->lotag != 1 && sectp->lotag != 2)
sectp->floorz = act->spr.z; sectp->floorz = act->spr.pos.Z;
if (act->spr.pal && ud.multimode > 1) if (act->spr.pal && ud.multimode > 1)
{ {
act->spr.xrepeat = act->spr.yrepeat = 0; act->spr.xrepeat = act->spr.yrepeat = 0;
@ -908,7 +908,7 @@ DDukeActor* spawninit_r(DDukeActor* actj, DDukeActor* act, TArray<DDukeActor*>*
act->spr.cstat |= CSTAT_SPRITE_TRANS_FLIP; act->spr.cstat |= CSTAT_SPRITE_TRANS_FLIP;
act->spr.pos.X += (krand() & 2047) - 1024; act->spr.pos.X += (krand() & 2047) - 1024;
act->spr.pos.Y += (krand() & 2047) - 1024; act->spr.pos.Y += (krand() & 2047) - 1024;
act->spr.z += (krand() & 2047) - 1024; act->spr.pos.Z += (krand() & 2047) - 1024;
break; break;
case MAMA: case MAMA:
if (act->spr.pal == 30) if (act->spr.pal == 30)
@ -1158,7 +1158,7 @@ DDukeActor* spawninit_r(DDukeActor* actj, DDukeActor* act, TArray<DDukeActor*>*
act->spr.lotag = 0; act->spr.lotag = 0;
if (act->spr.picnum != BOWLINGBALLSPRITE) if (act->spr.picnum != BOWLINGBALLSPRITE)
{ {
act->spr.z -= (32 << 8); act->spr.pos.Z -= (32 << 8);
act->spr.zvel = -(4 << 8); act->spr.zvel = -(4 << 8);
} }
else else

View file

@ -70,7 +70,7 @@ DExhumedActor* BuildAnim(DExhumedActor* pActor, int val, int val2, int x, int y,
pSprite->pos.X = x; pSprite->pos.X = x;
pSprite->pos.Y = y; pSprite->pos.Y = y;
pSprite->z = z; pSprite->pos.Z = z;
pSprite->cstat = 0; pSprite->cstat = 0;
if (nFlag & 4) if (nFlag & 4)
@ -144,7 +144,7 @@ void AIAnim::Tick(RunListEvent* ev)
auto pSpriteB = &pIgniter->s(); auto pSpriteB = &pIgniter->s();
pSprite->pos.X = pSpriteB->pos.X; pSprite->pos.X = pSpriteB->pos.X;
pSprite->pos.Y = pSpriteB->pos.Y; pSprite->pos.Y = pSpriteB->pos.Y;
pSprite->z = pSpriteB->z; pSprite->pos.Z = pSpriteB->pos.Z;
if (pSpriteB->sector() != pSprite->sector()) if (pSpriteB->sector() != pSprite->sector())
{ {
@ -246,12 +246,12 @@ void BuildExplosion(DExhumedActor* pActor)
{ {
edx = 75; edx = 75;
} }
else if (pSprite->z == pSprite->sector()->floorz) else if (pSprite->pos.Z == pSprite->sector()->floorz)
{ {
edx = 34; edx = 34;
} }
BuildAnim(nullptr, edx, 0, pSprite->pos.X, pSprite->pos.Y, pSprite->z, pSprite->sector(), pSprite->xrepeat, 4); BuildAnim(nullptr, edx, 0, pSprite->pos.X, pSprite->pos.Y, pSprite->pos.Z, pSprite->sector(), pSprite->xrepeat, 4);
} }
void BuildSplash(DExhumedActor* actor, sectortype* pSector) void BuildSplash(DExhumedActor* actor, sectortype* pSector)

View file

@ -64,7 +64,7 @@ void BuildAnubis(DExhumedActor* ap, int x, int y, int z, sectortype* pSector, in
sp->pos.X = x; sp->pos.X = x;
sp->pos.Y = y; sp->pos.Y = y;
sp->z = z; sp->pos.Z = z;
sp->cstat = CSTAT_SPRITE_BLOCK_ALL; sp->cstat = CSTAT_SPRITE_BLOCK_ALL;
sp->xoffset = 0; sp->xoffset = 0;
sp->shade = -12; sp->shade = -12;
@ -221,8 +221,8 @@ void AIAnubis::Tick(RunListEvent* ev)
if (pTarget != nullptr) // NOTE: nTarget can be -1. this check wasn't in original code. TODO: demo compatiblity? if (pTarget != nullptr) // NOTE: nTarget can be -1. this check wasn't in original code. TODO: demo compatiblity?
{ {
if (cansee(sp->pos.X, sp->pos.Y, sp->z - GetActorHeight(ap), sp->sector(), if (cansee(sp->pos.X, sp->pos.Y, sp->pos.Z - GetActorHeight(ap), sp->sector(),
pTarget->spr.pos.X, pTarget->spr.pos.Y, pTarget->spr.z - GetActorHeight(pTarget), pTarget->spr.sector())) pTarget->spr.pos.X, pTarget->spr.pos.Y, pTarget->spr.pos.Z - GetActorHeight(pTarget), pTarget->spr.sector()))
{ {
sp->xvel = 0; sp->xvel = 0;
sp->yvel = 0; sp->yvel = 0;
@ -407,7 +407,7 @@ void AIAnubis::Damage(RunListEvent* ev)
pDrumSprite->pos.X = sp->pos.X; pDrumSprite->pos.X = sp->pos.X;
pDrumSprite->pos.Y = sp->pos.Y; pDrumSprite->pos.Y = sp->pos.Y;
pDrumSprite->z = pDrumSprite->sector()->floorz; pDrumSprite->pos.Z = pDrumSprite->sector()->floorz;
pDrumSprite->xrepeat = 40; pDrumSprite->xrepeat = 40;
pDrumSprite->yrepeat = 40; pDrumSprite->yrepeat = 40;
pDrumSprite->shade = -64; pDrumSprite->shade = -64;
@ -431,7 +431,7 @@ void AIAnubis::Damage(RunListEvent* ev)
sp->xvel = 0; sp->xvel = 0;
sp->yvel = 0; sp->yvel = 0;
sp->zvel = 0; sp->zvel = 0;
sp->z = sp->sector()->floorz; sp->pos.Z = sp->sector()->floorz;
sp->cstat &= ~CSTAT_SPRITE_BLOCK_ALL; sp->cstat &= ~CSTAT_SPRITE_BLOCK_ALL;
ap->nHealth = 0; ap->nHealth = 0;

View file

@ -91,11 +91,11 @@ void AIBubble::Tick(RunListEvent* ev)
pActor->nFrame = 0; pActor->nFrame = 0;
} }
pSprite->z += pSprite->zvel; pSprite->pos.Z += pSprite->zvel;
auto pSector = pSprite->sector(); auto pSector = pSprite->sector();
if (pSprite->z <= pSector->ceilingz) if (pSprite->pos.Z <= pSector->ceilingz)
{ {
auto pSectAbove = pSector->pAbove; auto pSectAbove = pSector->pAbove;

View file

@ -168,7 +168,7 @@ void IgniteSprite(DExhumedActor* pActor)
pSprite->hitag += 2; pSprite->hitag += 2;
auto pAnimActor = BuildAnim(nullptr, 38, 0, pSprite->pos.X, pSprite->pos.Y, pSprite->z, pSprite->sector(), 40, 20); auto pAnimActor = BuildAnim(nullptr, 38, 0, pSprite->pos.X, pSprite->pos.Y, pSprite->pos.Z, pSprite->sector(), 40, 20);
if (pAnimActor) if (pAnimActor)
{ {
@ -323,7 +323,7 @@ int MoveBullet(int nBullet)
int x = pSprite->pos.X; int x = pSprite->pos.X;
int y = pSprite->pos.Y; int y = pSprite->pos.Y;
int z = pSprite->z; // ebx int z = pSprite->pos.Z; // ebx
int nSectFlag = pSprite->sector()->Flag; int nSectFlag = pSprite->sector()->Flag;
int x2, y2, z2; int x2, y2, z2;
@ -364,7 +364,7 @@ int MoveBullet(int nBullet)
pSprite->xrepeat = 40; pSprite->xrepeat = 40;
pSprite->yrepeat = 40; pSprite->yrepeat = 40;
pSprite->shade = 0; pSprite->shade = 0;
pSprite->z += 512; pSprite->pos.Z += 512;
} }
} }
else else
@ -382,7 +382,7 @@ MOVEEND:
nVal = 1; nVal = 1;
x2 = pSprite->pos.X; x2 = pSprite->pos.X;
y2 = pSprite->pos.Y; y2 = pSprite->pos.Y;
z2 = pSprite->z; z2 = pSprite->pos.Z;
pHitSect = pSprite->sector(); pHitSect = pSprite->sector();
#if 0 #if 0
@ -432,7 +432,7 @@ MOVEEND:
if (nVal == 0 && nType != 15 && nType != 3) if (nVal == 0 && nType != 15 && nType != 3)
{ {
AddFlash(pSprite->sector(), pSprite->pos.X, pSprite->pos.Y, pSprite->z, 0); AddFlash(pSprite->sector(), pSprite->pos.X, pSprite->pos.Y, pSprite->pos.Z, 0);
if (pSprite->pal != 5) { if (pSprite->pal != 5) {
pSprite->pal = 1; pSprite->pal = 1;
@ -449,7 +449,7 @@ MOVEEND:
auto hitsprite = &hitactor->s(); auto hitsprite = &hitactor->s();
x2 = hitsprite->pos.X; x2 = hitsprite->pos.X;
y2 = hitsprite->pos.Y; y2 = hitsprite->pos.Y;
z2 = hitsprite->z - (GetActorHeight(hitactor) >> 1); z2 = hitsprite->pos.Z - (GetActorHeight(hitactor) >> 1);
pHitSect = hitsprite->sector(); pHitSect = hitsprite->sector();
} }
else else
@ -519,7 +519,7 @@ HITSPRITE:
{ {
pSprite->pos.X = x2; pSprite->pos.X = x2;
pSprite->pos.Y = y2; pSprite->pos.Y = y2;
pSprite->z = z2; pSprite->pos.Z = z2;
BuildSplash(pActor, pHitSect); BuildSplash(pActor, pHitSect);
} }
else else
@ -549,7 +549,7 @@ HITSPRITE:
{ {
pSprite->pos.X = x2; pSprite->pos.X = x2;
pSprite->pos.Y = y2; pSprite->pos.Y = y2;
pSprite->z = z2; pSprite->pos.Z = z2;
ChangeActorSect(pActor, pHitSect); ChangeActorSect(pActor, pHitSect);
} }
@ -562,7 +562,7 @@ HITSPRITE:
nRadialBullet = -1; nRadialBullet = -1;
AddFlash(pSprite->sector(), pSprite->pos.X, pSprite->pos.Y, pSprite->z, 128); AddFlash(pSprite->sector(), pSprite->pos.X, pSprite->pos.Y, pSprite->pos.Z, 128);
} }
} }
} }
@ -605,7 +605,7 @@ DExhumedActor* BuildBullet(DExhumedActor* pActor, int nType, int nZOffset, int n
assert(pTargetSprite->sector()); assert(pTargetSprite->sector());
BulletHitsSprite(&sBullet, pActor, pTarget, pTargetSprite->pos.X, pTargetSprite->pos.Y, pTargetSprite->z - (nHeight >> 1), pTargetSprite->sector()); BulletHitsSprite(&sBullet, pActor, pTarget, pTargetSprite->pos.X, pTargetSprite->pos.Y, pTargetSprite->pos.Z - (nHeight >> 1), pTargetSprite->sector());
DeleteActor(sBullet.pActor); DeleteActor(sBullet.pActor);
return nullptr; return nullptr;
} }
@ -643,7 +643,7 @@ DExhumedActor* BuildBullet(DExhumedActor* pActor, int nType, int nZOffset, int n
pBulletSprite->pos.X = pSprite->pos.X; pBulletSprite->pos.X = pSprite->pos.X;
pBulletSprite->pos.Y = pSprite->pos.Y; pBulletSprite->pos.Y = pSprite->pos.Y;
pBulletSprite->z = pSprite->z; pBulletSprite->pos.Z = pSprite->pos.Z;
Bullet *pBullet = &BulletList[nBullet]; Bullet *pBullet = &BulletList[nBullet];
@ -713,18 +713,18 @@ DExhumedActor* BuildBullet(DExhumedActor* pActor, int nType, int nZOffset, int n
pBullet->nRunRec = runlist_AddRunRec(pBulletSprite->lotag - 1, nBullet, 0xB0000); pBullet->nRunRec = runlist_AddRunRec(pBulletSprite->lotag - 1, nBullet, 0xB0000);
pBullet->nRunRec2 = runlist_AddRunRec(NewRun, nBullet, 0xB0000); pBullet->nRunRec2 = runlist_AddRunRec(NewRun, nBullet, 0xB0000);
pBullet->nDoubleDamage = nDoubleDamage; pBullet->nDoubleDamage = nDoubleDamage;
pBulletSprite->z += nZOffset; pBulletSprite->pos.Z += nZOffset;
pBulletSprite->backuppos(); pBulletSprite->backuppos();
int var_18 = 0; int var_18 = 0;
pSector = pBulletSprite->sector(); pSector = pBulletSprite->sector();
while (pBulletSprite->z < pSector->ceilingz) while (pBulletSprite->pos.Z < pSector->ceilingz)
{ {
if (pSector->pAbove == nullptr) if (pSector->pAbove == nullptr)
{ {
pBulletSprite->z = pSector->ceilingz; pBulletSprite->pos.Z = pSector->ceilingz;
break; break;
} }
@ -757,7 +757,7 @@ DExhumedActor* BuildBullet(DExhumedActor* pActor, int nType, int nZOffset, int n
nHeight -= nHeight >> 1; nHeight -= nHeight >> 1;
} }
int var_20 = pTargetSprite->z - nHeight; int var_20 = pTargetSprite->pos.Z - nHeight;
int x, y; int x, y;
@ -797,7 +797,7 @@ DExhumedActor* BuildBullet(DExhumedActor* pActor, int nType, int nZOffset, int n
int nSqrt = lsqrt(y*y + x*x); int nSqrt = lsqrt(y*y + x*x);
if ((unsigned int)nSqrt > 0) if ((unsigned int)nSqrt > 0)
{ {
var_18 = ((var_20 - pBulletSprite->z) * pBulletInfo->field_4) / nSqrt; var_18 = ((var_20 - pBulletSprite->pos.Z) * pBulletInfo->field_4) / nSqrt;
} }
else else
{ {
@ -842,7 +842,7 @@ void AIBullet::Tick(RunListEvent* ev)
if (nFlag & 0x80) if (nFlag & 0x80)
{ {
BuildAnim(nullptr, 45, 0, pSprite->pos.X, pSprite->pos.Y, pSprite->z, pSprite->sector(), pSprite->xrepeat, 0); BuildAnim(nullptr, 45, 0, pSprite->pos.X, pSprite->pos.Y, pSprite->pos.Z, pSprite->sector(), pSprite->xrepeat, 0);
} }
BulletList[nBullet].nFrame++; BulletList[nBullet].nFrame++;

View file

@ -208,8 +208,8 @@ void DoRedAlert(int nVal)
if (nVal) if (nVal)
{ {
auto spri = &ac->s(); auto spri = &ac->s();
PlayFXAtXYZ(StaticSound[kSoundAlarm], spri->pos.X, spri->pos.Y, spri->z); PlayFXAtXYZ(StaticSound[kSoundAlarm], spri->pos.X, spri->pos.Y, spri->pos.Z);
AddFlash(spri->sector(), spri->pos.X, spri->pos.Y, spri->z, 192); AddFlash(spri->sector(), spri->pos.X, spri->pos.Y, spri->pos.Z, 192);
} }
} }
} }

View file

@ -52,7 +52,7 @@ void BuildFishLimb(DExhumedActor* pActor, int anim)
pSprite2->pos.X = pSprite->pos.X; pSprite2->pos.X = pSprite->pos.X;
pSprite2->pos.Y = pSprite->pos.Y; pSprite2->pos.Y = pSprite->pos.Y;
pSprite2->z = pSprite->z; pSprite2->pos.Z = pSprite->pos.Z;
pSprite2->cstat = 0; pSprite2->cstat = 0;
pSprite2->shade = -12; pSprite2->shade = -12;
pSprite2->pal = 0; pSprite2->pal = 0;
@ -101,17 +101,17 @@ void AIFishLimb::Tick(RunListEvent* ev)
{ {
pActor->nFrame = 0; pActor->nFrame = 0;
if (RandomBit()) { if (RandomBit()) {
BuildBlood(pSprite->pos.X, pSprite->pos.Y, pSprite->z, pSprite->sector()); BuildBlood(pSprite->pos.X, pSprite->pos.Y, pSprite->pos.Z, pSprite->sector());
} }
} }
int FloorZ = pSprite->sector()->floorz; int FloorZ = pSprite->sector()->floorz;
if (FloorZ <= pSprite->z) if (FloorZ <= pSprite->pos.Z)
{ {
pSprite->z += 256; pSprite->pos.Z += 256;
if ((pSprite->z - FloorZ) > 25600) if ((pSprite->pos.Z - FloorZ) > 25600)
{ {
pSprite->zvel = 0; pSprite->zvel = 0;
runlist_DoSubRunRec(pSprite->owner); runlist_DoSubRunRec(pSprite->owner);
@ -119,7 +119,7 @@ void AIFishLimb::Tick(RunListEvent* ev)
runlist_SubRunRec(pSprite->hitag); runlist_SubRunRec(pSprite->hitag);
DeleteActor(pActor); DeleteActor(pActor);
} }
else if ((pSprite->z - FloorZ) > 0) else if ((pSprite->pos.Z - FloorZ) > 0)
{ {
pSprite->zvel = 1024; pSprite->zvel = 1024;
} }
@ -159,14 +159,14 @@ void BuildFish(DExhumedActor* pActor, int x, int y, int z, sectortype* pSector,
pSprite = &pActor->s(); pSprite = &pActor->s();
x = pSprite->pos.X; x = pSprite->pos.X;
y = pSprite->pos.Y; y = pSprite->pos.Y;
z = pSprite->z; z = pSprite->pos.Z;
nAngle = pSprite->ang; nAngle = pSprite->ang;
ChangeActorStat(pActor, 103); ChangeActorStat(pActor, 103);
} }
pSprite->pos.X = x; pSprite->pos.X = x;
pSprite->pos.Y = y; pSprite->pos.Y = y;
pSprite->z = z; pSprite->pos.Z = z;
pSprite->cstat = CSTAT_SPRITE_BLOCK_ALL; pSprite->cstat = CSTAT_SPRITE_BLOCK_ALL;
pSprite->shade = -12; pSprite->shade = -12;
pSprite->clipdist = 80; pSprite->clipdist = 80;
@ -293,7 +293,7 @@ void AIFish::Damage(RunListEvent* ev)
BuildFishLimb(pActor, i); BuildFishLimb(pActor, i);
} }
PlayFXAtXYZ(StaticSound[kSound40], pSprite->pos.X, pSprite->pos.Y, pSprite->z); PlayFXAtXYZ(StaticSound[kSound40], pSprite->pos.X, pSprite->pos.Y, pSprite->pos.Z);
DestroyFish(pActor); DestroyFish(pActor);
} }
else else
@ -361,7 +361,7 @@ void AIFish::Tick(RunListEvent* ev)
pActor->nAction = 2; pActor->nAction = 2;
pActor->nFrame = 0; pActor->nFrame = 0;
int nAngle = GetMyAngle(pTargetActor->spr.pos.X - pSprite->pos.X, pTargetActor->spr.z - pSprite->z); int nAngle = GetMyAngle(pTargetActor->spr.pos.X - pSprite->pos.X, pTargetActor->spr.pos.Z - pSprite->pos.Z);
pSprite->zvel = bsin(nAngle, -5); pSprite->zvel = bsin(nAngle, -5);
pActor->nCount = RandomSize(6) + 90; pActor->nCount = RandomSize(6) + 90;
@ -392,7 +392,7 @@ void AIFish::Tick(RunListEvent* ev)
PlotCourseToSprite(pActor, pTargetActor); PlotCourseToSprite(pActor, pTargetActor);
int nHeight = GetActorHeight(pActor) >> 1; int nHeight = GetActorHeight(pActor) >> 1;
int z = abs(pTargetActor->spr.z - pSprite->z); int z = abs(pTargetActor->spr.pos.Z - pSprite->pos.Z);
if (z <= nHeight) if (z <= nHeight)
{ {
@ -405,7 +405,7 @@ void AIFish::Tick(RunListEvent* ev)
pSprite->yvel = 0; pSprite->yvel = 0;
} }
pSprite->zvel = (pTargetActor->spr.z - pSprite->z) >> 3; pSprite->zvel = (pTargetActor->spr.pos.Z - pSprite->pos.Z) >> 3;
} }
break; break;
} }
@ -436,7 +436,7 @@ void AIFish::Tick(RunListEvent* ev)
int x = pSprite->pos.X; int x = pSprite->pos.X;
int y = pSprite->pos.Y; int y = pSprite->pos.Y;
int z = pSprite->z; int z = pSprite->pos.Z;
auto pSector =pSprite->sector(); auto pSector =pSprite->sector();
// loc_2EF54 // loc_2EF54
@ -447,7 +447,7 @@ void AIFish::Tick(RunListEvent* ev)
ChangeActorSect(pActor, pSector); ChangeActorSect(pActor, pSector);
pSprite->pos.X = x; pSprite->pos.X = x;
pSprite->pos.Y = y; pSprite->pos.Y = y;
pSprite->z = z; pSprite->pos.Z = z;
IdleFish(pActor, 0); IdleFish(pActor, 0);
return; return;

View file

@ -63,7 +63,7 @@ void ThrowGrenade(int nPlayer, int, int, int ecx, int push1)
pGrenadeSprite->pos.X = pPlayerSprite->pos.X; pGrenadeSprite->pos.X = pPlayerSprite->pos.X;
pGrenadeSprite->pos.Y = pPlayerSprite->pos.Y; pGrenadeSprite->pos.Y = pPlayerSprite->pos.Y;
pGrenadeSprite->z = pPlayerSprite->z; pGrenadeSprite->pos.Z = pPlayerSprite->pos.Z;
if (nAngle < 0) { if (nAngle < 0) {
nAngle = pPlayerSprite->ang; nAngle = pPlayerSprite->ang;
@ -109,7 +109,7 @@ void BuildGrenade(int nPlayer)
pSprite->pos.X = pPlayerSprite->pos.X; pSprite->pos.X = pPlayerSprite->pos.X;
pSprite->pos.Y = pPlayerSprite->pos.Y; pSprite->pos.Y = pPlayerSprite->pos.Y;
pSprite->z = pPlayerSprite->z - 3840; pSprite->pos.Z = pPlayerSprite->pos.Z - 3840;
pSprite->shade = -64; pSprite->shade = -64;
pSprite->xrepeat = 20; pSprite->xrepeat = 20;
pSprite->yrepeat = 20; pSprite->yrepeat = 20;
@ -160,7 +160,7 @@ void ExplodeGrenade(DExhumedActor* pActor)
} }
else else
{ {
if (pGrenadeSprite->z < pGrenadeSect->floorz) if (pGrenadeSprite->pos.Z < pGrenadeSect->floorz)
{ {
var_20 = 200; var_20 = 200;
var_28 = 36; var_28 = 36;
@ -182,7 +182,7 @@ void ExplodeGrenade(DExhumedActor* pActor)
auto pPlayerSprite = &pPlayerActor->s(); auto pPlayerSprite = &pPlayerActor->s();
int nAngle = pPlayerSprite->ang; int nAngle = pPlayerSprite->ang;
pGrenadeSprite->z = pPlayerSprite->z; pGrenadeSprite->pos.Z = pPlayerSprite->pos.Z;
pGrenadeSprite->pos.X = bcos(nAngle, -5) + pPlayerSprite->pos.X; pGrenadeSprite->pos.X = bcos(nAngle, -5) + pPlayerSprite->pos.X;
pGrenadeSprite->pos.Y = bsin(nAngle, -5) + pPlayerSprite->pos.Y; pGrenadeSprite->pos.Y = bsin(nAngle, -5) + pPlayerSprite->pos.Y;
@ -201,8 +201,8 @@ void ExplodeGrenade(DExhumedActor* pActor)
runlist_RadialDamageEnemy(pActor, nDamage, BulletInfo[kWeaponGrenade].nRadius); runlist_RadialDamageEnemy(pActor, nDamage, BulletInfo[kWeaponGrenade].nRadius);
BuildAnim(nullptr, var_28, 0, pGrenadeSprite->pos.X, pGrenadeSprite->pos.Y, pGrenadeSprite->z, pGrenadeSprite->sector(), var_20, 4); BuildAnim(nullptr, var_28, 0, pGrenadeSprite->pos.X, pGrenadeSprite->pos.Y, pGrenadeSprite->pos.Z, pGrenadeSprite->sector(), var_20, 4);
AddFlash(pGrenadeSprite->sector(), pGrenadeSprite->pos.X, pGrenadeSprite->pos.Y, pGrenadeSprite->z, 128); AddFlash(pGrenadeSprite->sector(), pGrenadeSprite->pos.X, pGrenadeSprite->pos.Y, pGrenadeSprite->pos.Z, 128);
DestroyGrenade(pActor); DestroyGrenade(pActor);
} }

View file

@ -617,7 +617,7 @@ loc_flag:
pPlayerSprite->sector(), pPlayerSprite->sector(),
pPlayerSprite->pos.X, pPlayerSprite->pos.X,
pPlayerSprite->pos.Y, pPlayerSprite->pos.Y,
pPlayerSprite->z, pPlayerSprite->pos.Z,
0); 0);
} }
@ -651,7 +651,7 @@ loc_flag:
int nAngle = pPlayerSprite->ang; int nAngle = pPlayerSprite->ang;
int theX = pPlayerSprite->pos.X; int theX = pPlayerSprite->pos.X;
int theY = pPlayerSprite->pos.Y; int theY = pPlayerSprite->pos.Y;
int theZ = pPlayerSprite->z; int theZ = pPlayerSprite->pos.Z;
int ebp = bcos(nAngle) * (pPlayerSprite->clipdist << 3); int ebp = bcos(nAngle) * (pPlayerSprite->clipdist << 3);
int ebx = bsin(nAngle) * (pPlayerSprite->clipdist << 3); int ebx = bsin(nAngle) * (pPlayerSprite->clipdist << 3);

View file

@ -765,7 +765,7 @@ void ExamineSprites(TArray<DExhumedActor*>& actors)
pSprite->pos.X = initx; pSprite->pos.X = initx;
pSprite->pos.Y = inity; pSprite->pos.Y = inity;
pSprite->z = initz; pSprite->pos.Z = initz;
pSprite->cstat = CSTAT_SPRITE_INVISIBLE; pSprite->cstat = CSTAT_SPRITE_INVISIBLE;
nNetStartSprite[nNetStartSprites] = pActor; nNetStartSprite[nNetStartSprites] = pActor;
nNetStartSprites++; nNetStartSprites++;

View file

@ -125,7 +125,7 @@ void BuildItemAnim(DExhumedActor* pActor)
if (nItemAnimInfo[nItem].a >= 0) if (nItemAnimInfo[nItem].a >= 0)
{ {
auto pAnimActor = BuildAnim(pActor, 41, nItemAnimInfo[nItem].a, pSprite->pos.X, pSprite->pos.Y, pSprite->z, pSprite->sector(), nItemAnimInfo[nItem].repeat, 20); auto pAnimActor = BuildAnim(pActor, 41, nItemAnimInfo[nItem].a, pSprite->pos.X, pSprite->pos.Y, pSprite->pos.Z, pSprite->sector(), nItemAnimInfo[nItem].repeat, 20);
if (nItem == 44) { if (nItem == 44) {
pAnimActor->spr.cstat |= CSTAT_SPRITE_TRANSLUCENT; pAnimActor->spr.cstat |= CSTAT_SPRITE_TRANSLUCENT;
@ -345,14 +345,14 @@ void DropMagic(DExhumedActor* pActor)
0, 0,
pSprite->pos.X, pSprite->pos.X,
pSprite->pos.Y, pSprite->pos.Y,
pSprite->z, pSprite->pos.Z,
pSprite->sector(), pSprite->sector(),
48, 48,
4); 4);
if (pAnimActor) if (pAnimActor)
{ {
AddFlash(pAnimActor->spr.sector(), pAnimActor->spr.pos.X, pAnimActor->spr.pos.Y, pAnimActor->spr.z, 128); AddFlash(pAnimActor->spr.sector(), pAnimActor->spr.pos.X, pAnimActor->spr.pos.Y, pAnimActor->spr.pos.Z, 128);
ChangeActorStat(pAnimActor, 950); ChangeActorStat(pAnimActor, 950);
} }
nMagicCount = RandomSize(2); nMagicCount = RandomSize(2);
@ -409,7 +409,7 @@ void DoRegenerates()
if (pSprite->extra <= 0) if (pSprite->extra <= 0)
{ {
BuildAnim(nullptr, 38, 0, pSprite->pos.X, pSprite->pos.Y, pSprite->z, pSprite->sector(), 64, 4); BuildAnim(nullptr, 38, 0, pSprite->pos.X, pSprite->pos.Y, pSprite->pos.Z, pSprite->sector(), 64, 4);
D3PlayFX(StaticSound[kSoundTorchOn], pActor); D3PlayFX(StaticSound[kSoundTorchOn], pActor);
} }
else { else {

View file

@ -46,7 +46,7 @@ DExhumedActor* BuildLavaLimb(DExhumedActor* pActor, int move, int ebx)
pLimbSprite->pos.X = pSprite->pos.X; pLimbSprite->pos.X = pSprite->pos.X;
pLimbSprite->pos.Y = pSprite->pos.Y; pLimbSprite->pos.Y = pSprite->pos.Y;
pLimbSprite->z = pSprite->z - RandomLong() % ebx; pLimbSprite->pos.Z = pSprite->pos.Z - RandomLong() % ebx;
pLimbSprite->cstat = 0; pLimbSprite->cstat = 0;
pLimbSprite->shade = -127; pLimbSprite->shade = -127;
pLimbSprite->pal = 1; pLimbSprite->pal = 1;
@ -124,7 +124,7 @@ void BuildLava(DExhumedActor* pActor, int x, int y, int, sectortype* pSector, in
pSprite->pos.X = x; pSprite->pos.X = x;
pSprite->pos.Y = y; pSprite->pos.Y = y;
pSprite->z = pSector->floorz; pSprite->pos.Z = pSector->floorz;
pSprite->cstat = CSTAT_SPRITE_INVISIBLE; pSprite->cstat = CSTAT_SPRITE_INVISIBLE;
pSprite->xrepeat = 200; pSprite->xrepeat = 200;
pSprite->yrepeat = 200; pSprite->yrepeat = 200;
@ -294,7 +294,7 @@ void AILavaDude::Tick(RunListEvent* ev)
int x = pSprite->pos.X; int x = pSprite->pos.X;
int y = pSprite->pos.Y; int y = pSprite->pos.Y;
int z = pSprite->z; int z = pSprite->pos.Z;
auto pSector =pSprite->sector(); auto pSector =pSprite->sector();
auto coll = movesprite(pActor, pSprite->xvel << 8, pSprite->yvel << 8, 0, 0, 0, CLIPMASK0); auto coll = movesprite(pActor, pSprite->xvel << 8, pSprite->yvel << 8, 0, 0, 0, CLIPMASK0);
@ -304,7 +304,7 @@ void AILavaDude::Tick(RunListEvent* ev)
ChangeActorSect(pActor, pSector); ChangeActorSect(pActor, pSector);
pSprite->pos.X = x; pSprite->pos.X = x;
pSprite->pos.Y = y; pSprite->pos.Y = y;
pSprite->z = z; pSprite->pos.Z = z;
pSprite->ang = (pSprite->ang + ((RandomWord() & 0x3FF) + 1024)) & kAngleMask; pSprite->ang = (pSprite->ang + ((RandomWord() & 0x3FF) + 1024)) & kAngleMask;
pSprite->xvel = bcos(pSprite->ang); pSprite->xvel = bcos(pSprite->ang);

View file

@ -61,7 +61,7 @@ void BuildLion(DExhumedActor* pActor, int x, int y, int z, sectortype* pSector,
pSprite->pos.X = x; pSprite->pos.X = x;
pSprite->pos.Y = y; pSprite->pos.Y = y;
pSprite->z = z; pSprite->pos.Z = z;
pSprite->cstat = CSTAT_SPRITE_BLOCK_ALL; pSprite->cstat = CSTAT_SPRITE_BLOCK_ALL;
pSprite->clipdist = 60; pSprite->clipdist = 60;
pSprite->shade = -12; pSprite->shade = -12;
@ -391,7 +391,7 @@ void AILion::Tick(RunListEvent* ev)
int x = pSprite->pos.X; int x = pSprite->pos.X;
int y = pSprite->pos.Y; int y = pSprite->pos.Y;
int z = pSprite->z - (GetActorHeight(pActor) >> 1); int z = pSprite->pos.Z - (GetActorHeight(pActor) >> 1);
int nCheckDist = 0x7FFFFFFF; int nCheckDist = 0x7FFFFFFF;

View file

@ -60,7 +60,7 @@ void DrawMap(double const smoothratio)
template<typename T> void GetSpriteExtents(T const* const pSprite, int* top, int* bottom) template<typename T> void GetSpriteExtents(T const* const pSprite, int* top, int* bottom)
{ {
*top = *bottom = pSprite->z; *top = *bottom = pSprite->pos.Z;
if ((pSprite->cstat & CSTAT_SPRITE_ALIGNMENT_MASK) != CSTAT_SPRITE_ALIGNMENT_FLOOR) if ((pSprite->cstat & CSTAT_SPRITE_ALIGNMENT_MASK) != CSTAT_SPRITE_ALIGNMENT_FLOOR)
{ {
int height = tileHeight(pSprite->picnum); int height = tileHeight(pSprite->picnum);

View file

@ -241,13 +241,13 @@ int BelowNear(DExhumedActor* pActor, int x, int y, int walldist)
{ {
auto pSprite = &pActor->s(); auto pSprite = &pActor->s();
auto pSector = pSprite->sector(); auto pSector = pSprite->sector();
int z = pSprite->z; int z = pSprite->pos.Z;
int z2; int z2;
if (loHit.type == kHitSprite) if (loHit.type == kHitSprite)
{ {
z2 = loHit.actor()->spr.z; z2 = loHit.actor()->spr.pos.Z;
} }
else else
{ {
@ -293,9 +293,9 @@ int BelowNear(DExhumedActor* pActor, int x, int y, int walldist)
} }
if (z2 < pSprite->z) if (z2 < pSprite->pos.Z)
{ {
pSprite->z = z2; pSprite->pos.Z = z2;
overridesect = pSector; overridesect = pSector;
pSprite->zvel = 0; pSprite->zvel = 0;
@ -332,7 +332,7 @@ Collision movespritez(DExhumedActor* pActor, int z, int height, int, int clipdis
z >>= 1; z >>= 1;
} }
int spriteZ = pSprite->z; int spriteZ = pSprite->pos.Z;
int floorZ = pSector->floorz; int floorZ = pSector->floorz;
int ebp = spriteZ + z; int ebp = spriteZ + z;
@ -350,7 +350,7 @@ Collision movespritez(DExhumedActor* pActor, int z, int height, int, int clipdis
if (pSect2 != pSector) if (pSect2 != pSector)
{ {
pSprite->z = ebp; pSprite->pos.Z = ebp;
if (pSect2->Flag & kSectUnderwater) if (pSect2->Flag & kSectUnderwater)
{ {
@ -448,7 +448,7 @@ Collision movespritez(DExhumedActor* pActor, int z, int height, int, int clipdis
// loc_1543B: // loc_1543B:
ebp = mySprfloor; ebp = mySprfloor;
pSprite->z = mySprfloor; pSprite->pos.Z = mySprfloor;
} }
else else
{ {
@ -468,7 +468,7 @@ Collision movespritez(DExhumedActor* pActor, int z, int height, int, int clipdis
} }
pSprite->cstat = cstat; // restore cstat pSprite->cstat = cstat; // restore cstat
pSprite->z = ebp; pSprite->pos.Z = ebp;
if (pSprite->statnum == 100) if (pSprite->statnum == 100)
{ {
@ -496,7 +496,7 @@ Collision movesprite(DExhumedActor* pActor, int dx, int dy, int dz, int ceildist
int x = pSprite->pos.X; int x = pSprite->pos.X;
int y = pSprite->pos.Y; int y = pSprite->pos.Y;
int z = pSprite->z; int z = pSprite->pos.Z;
int nSpriteHeight = GetActorHeight(pActor); int nSpriteHeight = GetActorHeight(pActor);
@ -524,7 +524,7 @@ Collision movesprite(DExhumedActor* pActor, int dx, int dy, int dz, int ceildist
int varA = 0; int varA = 0;
int varB = 0; int varB = 0;
CheckSectorFloor(overridesect, pSprite->z, &varB, &varA); CheckSectorFloor(overridesect, pSprite->pos.Z, &varB, &varA);
if (varB || varA) if (varB || varA)
{ {
@ -537,7 +537,7 @@ Collision movesprite(DExhumedActor* pActor, int dx, int dy, int dz, int ceildist
} }
else else
{ {
CheckSectorFloor(overridesect, pSprite->z, &dx, &dy); CheckSectorFloor(overridesect, pSprite->pos.Z, &dx, &dy);
} }
Collision coll; Collision coll;
@ -630,7 +630,7 @@ Collision MoveCreatureWithCaution(DExhumedActor* pActor)
auto pSprite = &pActor->s(); auto pSprite = &pActor->s();
int x = pSprite->pos.X; int x = pSprite->pos.X;
int y = pSprite->pos.Y; int y = pSprite->pos.Y;
int z = pSprite->z; int z = pSprite->pos.Z;
auto pSectorPre = pSprite->sector(); auto pSectorPre = pSprite->sector();
auto ecx = MoveCreature(pActor); auto ecx = MoveCreature(pActor);
@ -648,7 +648,7 @@ Collision MoveCreatureWithCaution(DExhumedActor* pActor)
{ {
pSprite->pos.X = x; pSprite->pos.X = x;
pSprite->pos.Y = y; pSprite->pos.Y = y;
pSprite->z = z; pSprite->pos.Z = z;
ChangeActorSect(pActor, pSectorPre); ChangeActorSect(pActor, pSectorPre);
@ -713,7 +713,7 @@ DExhumedActor* FindPlayer(DExhumedActor* pActor, int nDistance, bool dontengage)
int y = pSprite->pos.Y; int y = pSprite->pos.Y;
auto pSector =pSprite->sector(); auto pSector =pSprite->sector();
int z = pSprite->z - GetActorHeight(pActor); int z = pSprite->pos.Z - GetActorHeight(pActor);
nDistance <<= 8; nDistance <<= 8;
@ -736,7 +736,7 @@ DExhumedActor* FindPlayer(DExhumedActor* pActor, int nDistance, bool dontengage)
{ {
int v10 = abs(pPlayerSprite->pos.Y - y); int v10 = abs(pPlayerSprite->pos.Y - y);
if (v10 < nDistance && cansee(pPlayerSprite->pos.X, pPlayerSprite->pos.Y, pPlayerSprite->z - 7680, pPlayerSprite->sector(), x, y, z, pSector)) if (v10 < nDistance && cansee(pPlayerSprite->pos.X, pPlayerSprite->pos.Y, pPlayerSprite->pos.Z - 7680, pPlayerSprite->sector(), x, y, z, pSector))
{ {
break; break;
} }
@ -783,8 +783,8 @@ int GetUpAngle(DExhumedActor* pActor1, int nVal, DExhumedActor* pActor2, int ecx
int x = pSprite2->pos.X - pSprite1->pos.X; int x = pSprite2->pos.X - pSprite1->pos.X;
int y = pSprite2->pos.Y - pSprite1->pos.Y; int y = pSprite2->pos.Y - pSprite1->pos.Y;
int ebx = (pSprite2->z + ecx) - (pSprite1->z + nVal); int ebx = (pSprite2->pos.Z + ecx) - (pSprite1->pos.Z + nVal);
int edx = (pSprite2->z + ecx) - (pSprite1->z + nVal); int edx = (pSprite2->pos.Z + ecx) - (pSprite1->pos.Z + nVal);
ebx >>= 4; ebx >>= 4;
edx >>= 8; edx >>= 8;
@ -839,7 +839,7 @@ void CreatePushBlock(sectortype* pSector)
pSprite->pos.X = xAvg; pSprite->pos.X = xAvg;
pSprite->pos.Y = yAvg; pSprite->pos.Y = yAvg;
pSprite->z = pSector->floorz - 256; pSprite->pos.Z = pSector->floorz - 256;
pSprite->cstat = CSTAT_SPRITE_INVISIBLE; pSprite->cstat = CSTAT_SPRITE_INVISIBLE;
int var_28 = 0; int var_28 = 0;
@ -1004,7 +1004,7 @@ void MoveSector(sectortype* pSector, int nAngle, int *nXVel, int *nYVel)
} }
else else
{ {
pos.Z = sp->z; pos.Z = sp->pos.Z;
if ((nSectFlag & kSectUnderwater) || pos.Z != nZVal || sp->cstat & CSTAT_SPRITE_INVISIBLE) if ((nSectFlag & kSectUnderwater) || pos.Z != nZVal || sp->cstat & CSTAT_SPRITE_INVISIBLE)
{ {
@ -1039,7 +1039,7 @@ void MoveSector(sectortype* pSector, int nAngle, int *nXVel, int *nYVel)
if (pSectorB != pNextSector && (pSectorB == pSector || pNextSector == pSector)) if (pSectorB != pNextSector && (pSectorB == pSector || pNextSector == pSector))
{ {
if (pSectorB != pSector || nFloorZ >= pSprite->z) if (pSectorB != pSector || nFloorZ >= pSprite->pos.Z)
{ {
if (pSectorB) { if (pSectorB) {
ChangeActorSect(pActor, pSectorB); ChangeActorSect(pActor, pSectorB);
@ -1075,7 +1075,7 @@ void MoveSector(sectortype* pSector, int nAngle, int *nXVel, int *nYVel)
while (auto pActor = it.Next()) while (auto pActor = it.Next())
{ {
auto pSprite = &pActor->s(); auto pSprite = &pActor->s();
if (pSprite->statnum >= 99 && nZVal == pSprite->z && !(pSprite->cstat & CSTAT_SPRITE_INVISIBLE)) if (pSprite->statnum >= 99 && nZVal == pSprite->pos.Z && !(pSprite->cstat & CSTAT_SPRITE_INVISIBLE))
{ {
pSectorB = pSector; pSectorB = pSector;
Collision scratch; Collision scratch;
@ -1104,7 +1104,7 @@ void MoveSector(sectortype* pSector, int nAngle, int *nXVel, int *nYVel)
auto pSprite = &pActor->s(); auto pSprite = &pActor->s();
initx = pSprite->pos.X; initx = pSprite->pos.X;
inity = pSprite->pos.Y; inity = pSprite->pos.Y;
initz = pSprite->z; initz = pSprite->pos.Z;
inita = pSprite->ang; inita = pSprite->ang;
initsectp = pSprite->sector(); initsectp = pSprite->sector();
} }
@ -1200,7 +1200,7 @@ Collision AngleChase(DExhumedActor* pActor, DExhumedActor* pActor2, int ebx, int
int nSqrt = ksqrt(sqrtNum); int nSqrt = ksqrt(sqrtNum);
int var_18 = GetMyAngle(nSqrt, ((pSprite2->z - nHeight) - pSprite->z) >> 8); int var_18 = GetMyAngle(nSqrt, ((pSprite2->pos.Z - nHeight) - pSprite->pos.Z) >> 8);
int nAngDelta = AngleDelta(pSprite->ang, nMyAngle, 1024); int nAngDelta = AngleDelta(pSprite->ang, nMyAngle, 1024);
int nAngDelta2 = abs(nAngDelta); int nAngDelta2 = abs(nAngDelta);
@ -1399,7 +1399,7 @@ DExhumedActor* BuildCreatureChunk(DExhumedActor* pSrc, int nPic, bool bSpecial)
pSprite->pos.X = pSrcSpr->pos.X; pSprite->pos.X = pSrcSpr->pos.X;
pSprite->pos.Y = pSrcSpr->pos.Y; pSprite->pos.Y = pSrcSpr->pos.Y;
pSprite->z = pSrcSpr->z; pSprite->pos.Z = pSrcSpr->pos.Z;
ChangeActorSect(actor, pSrcSpr->sector()); ChangeActorSect(actor, pSrcSpr->sector());
@ -1448,7 +1448,7 @@ void AICreatureChunk::Tick(RunListEvent* ev)
auto nVal = movesprite(pActor, pSprite->xvel << 10, pSprite->yvel << 10, pSprite->zvel, 2560, -2560, CLIPMASK1); auto nVal = movesprite(pActor, pSprite->xvel << 10, pSprite->yvel << 10, pSprite->zvel, 2560, -2560, CLIPMASK1);
if (pSprite->z >= pSector->floorz) if (pSprite->pos.Z >= pSector->floorz)
{ {
// re-grab this variable as it may have changed in movesprite(). Note the check above is against the value *before* movesprite so don't change it. // re-grab this variable as it may have changed in movesprite(). Note the check above is against the value *before* movesprite so don't change it.
pSector = pSprite->sector(); pSector = pSprite->sector();
@ -1456,7 +1456,7 @@ void AICreatureChunk::Tick(RunListEvent* ev)
pSprite->xvel = 0; pSprite->xvel = 0;
pSprite->yvel = 0; pSprite->yvel = 0;
pSprite->zvel = 0; pSprite->zvel = 0;
pSprite->z = pSector->floorz; pSprite->pos.Z = pSector->floorz;
} }
else else
{ {

View file

@ -50,7 +50,7 @@ void BuildMummy(DExhumedActor* pActor, int x, int y, int z, sectortype* pSector,
pSprite = &pActor->s(); pSprite = &pActor->s();
x = pSprite->pos.X; x = pSprite->pos.X;
y = pSprite->pos.Y; y = pSprite->pos.Y;
z = pSprite->z; z = pSprite->pos.Z;
nAngle = pSprite->ang; nAngle = pSprite->ang;
ChangeActorStat(pActor, 102); ChangeActorStat(pActor, 102);
@ -58,7 +58,7 @@ void BuildMummy(DExhumedActor* pActor, int x, int y, int z, sectortype* pSector,
pSprite->pos.X = x; pSprite->pos.X = x;
pSprite->pos.Y = y; pSprite->pos.Y = y;
pSprite->z = z; pSprite->pos.Z = z;
pSprite->cstat = CSTAT_SPRITE_BLOCK_ALL; pSprite->cstat = CSTAT_SPRITE_BLOCK_ALL;
pSprite->shade = -12; pSprite->shade = -12;
pSprite->clipdist = 32; pSprite->clipdist = 32;
@ -111,8 +111,8 @@ void CheckMummyRevive(DExhumedActor* pActor)
if (x <= 20 && y <= 20) if (x <= 20 && y <= 20)
{ {
if (cansee(pSprite->pos.X, pSprite->pos.Y, pSprite->z - 8192, pSprite->sector(), if (cansee(pSprite->pos.X, pSprite->pos.Y, pSprite->pos.Z - 8192, pSprite->sector(),
pSprite2->pos.X, pSprite2->pos.Y, pSprite2->z - 8192, pSprite2->sector())) pSprite2->pos.X, pSprite2->pos.Y, pSprite2->pos.Z - 8192, pSprite2->sector()))
{ {
pSprite2->cstat = 0; pSprite2->cstat = 0;
pOther->nAction = 6; pOther->nAction = 6;
@ -216,8 +216,8 @@ void AIMummy::Tick(RunListEvent* ev)
{ {
if (RandomBit() && pTarget) if (RandomBit() && pTarget)
{ {
if (cansee(pSprite->pos.X, pSprite->pos.Y, pSprite->z - GetActorHeight(pActor), pSprite->sector(), if (cansee(pSprite->pos.X, pSprite->pos.Y, pSprite->pos.Z - GetActorHeight(pActor), pSprite->sector(),
pTarget->spr.pos.X, pTarget->spr.pos.Y, pTarget->spr.z - GetActorHeight(pTarget), pTarget->spr.sector())) pTarget->spr.pos.X, pTarget->spr.pos.Y, pTarget->spr.pos.Z - GetActorHeight(pTarget), pTarget->spr.sector()))
{ {
pActor->nAction = 3; pActor->nAction = 3;
pActor->nFrame = 0; pActor->nFrame = 0;
@ -459,7 +459,7 @@ void AIMummy::Damage(RunListEvent* ev)
pSprite->xvel = 0; pSprite->xvel = 0;
pSprite->yvel = 0; pSprite->yvel = 0;
pSprite->zvel = 0; pSprite->zvel = 0;
pSprite->z = pSprite->sector()->floorz; pSprite->pos.Z = pSprite->sector()->floorz;
} }
else else
{ {

View file

@ -395,7 +395,7 @@ DExhumedActor* BuildWallSprite(sectortype* pSector)
auto pSprite = &pActor->s(); auto pSprite = &pActor->s();
pSprite->pos.vec2 = wal->center(); pSprite->pos.vec2 = wal->center();
pSprite->z = (pSector->floorz + pSector->ceilingz) / 2; pSprite->pos.Z = (pSector->floorz + pSector->ceilingz) / 2;
pSprite->cstat = CSTAT_SPRITE_INVISIBLE; pSprite->cstat = CSTAT_SPRITE_INVISIBLE;
return pActor; return pActor;
@ -463,7 +463,7 @@ DExhumedActor* FindWallSprites(sectortype* pSector)
pSprite->pos.X = (var_24 + esi) / 2; pSprite->pos.X = (var_24 + esi) / 2;
pSprite->pos.Y = (ecx + edi) / 2; pSprite->pos.Y = (ecx + edi) / 2;
pSprite->z = pSector->floorz; pSprite->pos.Z = pSector->floorz;
pSprite->cstat = CSTAT_SPRITE_INVISIBLE; pSprite->cstat = CSTAT_SPRITE_INVISIBLE;
pSprite->owner = -1; pSprite->owner = -1;
pSprite->lotag = 0; pSprite->lotag = 0;
@ -615,7 +615,7 @@ int CheckSectorSprites(sectortype* pSector, int nVal)
PlayFXAtXYZ(StaticSound[kSoundJonFDie], PlayFXAtXYZ(StaticSound[kSoundJonFDie],
pSprite->pos.X, pSprite->pos.X,
pSprite->pos.Y, pSprite->pos.Y,
pSprite->z, pSprite->pos.Z,
CHANF_NONE, 0x4000); CHANF_NONE, 0x4000);
} }
} }
@ -647,10 +647,10 @@ void MoveSectorSprites(sectortype* pSector, int z)
while (auto pActor = it.Next()) while (auto pActor = it.Next())
{ {
auto pSprite = &pActor->s(); auto pSprite = &pActor->s();
int z = pSprite->z; int z = pSprite->pos.Z;
if ((pSprite->statnum != 200 && z >= minz && z <= maxz) || pSprite->statnum >= 900) if ((pSprite->statnum != 200 && z >= minz && z <= maxz) || pSprite->statnum >= 900)
{ {
pSprite->z = newz; pSprite->pos.Z = newz;
} }
} }
} }
@ -843,7 +843,7 @@ void AIElev::Tick(RunListEvent* ev)
} }
auto sp = &pElevSpr->s(); auto sp = &pElevSpr->s();
PlayFXAtXYZ(StaticSound[kSound26], sp->pos.X, sp->pos.Y, sp->z); PlayFXAtXYZ(StaticSound[kSound26], sp->pos.X, sp->pos.Y, sp->pos.Z);
} }
if (var_18 & 0x4) if (var_18 & 0x4)
@ -869,7 +869,7 @@ void AIElev::Tick(RunListEvent* ev)
// maybe this doesn't go here? // maybe this doesn't go here?
while (pElevSpr) while (pElevSpr)
{ {
pElevSpr->spr.z += ebp; pElevSpr->spr.pos.Z += ebp;
pElevSpr = pElevSpr->pTarget; pElevSpr = pElevSpr->pTarget;
} }
} }
@ -1030,7 +1030,7 @@ int BuildSlide(int nChannel, walltype* pStartWall, walltype* pWall1, walltype* p
pSprite->cstat = CSTAT_SPRITE_INVISIBLE; pSprite->cstat = CSTAT_SPRITE_INVISIBLE;
pSprite->pos.X = pStartWall->pos.X; pSprite->pos.X = pStartWall->pos.X;
pSprite->pos.Y = pStartWall->pos.Y; pSprite->pos.Y = pStartWall->pos.Y;
pSprite->z = pSector->floorz; pSprite->pos.Z = pSector->floorz;
pSprite->backuppos(); pSprite->backuppos();
SlideData[nSlide].nRunC = 0; SlideData[nSlide].nRunC = 0;
@ -1415,7 +1415,7 @@ DExhumedActor* BuildSpark(DExhumedActor* pActor, int nVal)
spr->picnum = kTile985 + nVal; spr->picnum = kTile985 + nVal;
} }
spr->z = pSprite->z; spr->pos.Z = pSprite->pos.Z;
spr->lotag = runlist_HeadRun() + 1; spr->lotag = runlist_HeadRun() + 1;
spr->clipdist = 1; spr->clipdist = 1;
spr->hitag = 0; spr->hitag = 0;
@ -1599,10 +1599,10 @@ DExhumedActor* BuildEnergyBlock(sectortype* pSector)
// GrabTimeSlot(3); // GrabTimeSlot(3);
spr->z = pSector->firstWall()->nextSector()->floorz; spr->pos.Z = pSector->firstWall()->nextSector()->floorz;
// CHECKME - name of this variable? // CHECKME - name of this variable?
int nRepeat = (spr->z - pSector->floorz) >> 8; int nRepeat = (spr->pos.Z - pSector->floorz) >> 8;
if (nRepeat > 255) { if (nRepeat > 255) {
nRepeat = 255; nRepeat = 255;
} }
@ -1679,9 +1679,9 @@ void ExplodeEnergyBlock(DExhumedActor* pActor)
pSector->floorshade = 50; pSector->floorshade = 50;
pSector->extra = -1; pSector->extra = -1;
pSector->floorz = pSprite->z; pSector->floorz = pSprite->pos.Z;
pSprite->z = (pSprite->z + pSector->floorz) / 2; pSprite->pos.Z = (pSprite->pos.Z + pSector->floorz) / 2;
BuildSpark(pActor, 3); BuildSpark(pActor, 3);
@ -1765,7 +1765,7 @@ void AIEnergyBlock::Damage(RunListEvent* ev)
pSprite2->ang = ev->nParam; pSprite2->ang = ev->nParam;
pSprite2->pos.X = lasthitx; pSprite2->pos.X = lasthitx;
pSprite2->pos.Y = lasthity; pSprite2->pos.Y = lasthity;
pSprite2->z = lasthitz; pSprite2->pos.Z = lasthitz;
BuildSpark(pActor2, 0); // shoot out blue orb when damaged BuildSpark(pActor2, 0); // shoot out blue orb when damaged
DeleteActor(pActor2); DeleteActor(pActor2);
@ -1791,14 +1791,14 @@ void AIEnergyBlock::RadialDamage(RunListEvent* ev)
int nFloorZ = pSector->floorz; int nFloorZ = pSector->floorz;
pSector->floorz = spr->z; pSector->floorz = spr->pos.Z;
spr->z -= 256; spr->pos.Z -= 256;
ev->nDamage = runlist_CheckRadialDamage(pActor); ev->nDamage = runlist_CheckRadialDamage(pActor);
// restore previous values // restore previous values
pSector->floorz = nFloorZ; pSector->floorz = nFloorZ;
spr->z += 256; spr->pos.Z += 256;
if (ev->nDamage <= 0) { if (ev->nDamage <= 0) {
return; return;
@ -1855,7 +1855,7 @@ DExhumedActor* BuildObject(DExhumedActor* pActor, int nOjectType, int nHitag)
pSprite2->cstat = CSTAT_SPRITE_INVISIBLE; pSprite2->cstat = CSTAT_SPRITE_INVISIBLE;
pSprite2->pos.X = spr->pos.X; pSprite2->pos.X = spr->pos.X;
pSprite2->pos.Y = spr->pos.Y; pSprite2->pos.Y = spr->pos.Y;
pSprite2->z = spr->z; pSprite2->pos.Z = spr->pos.Z;
} }
else else
{ {
@ -1878,7 +1878,7 @@ DExhumedActor* BuildObject(DExhumedActor* pActor, int nOjectType, int nHitag)
void ExplodeScreen(DExhumedActor* pActor) void ExplodeScreen(DExhumedActor* pActor)
{ {
auto pSprite = &pActor->s(); auto pSprite = &pActor->s();
pSprite->z -= GetActorHeight(pActor) / 2; pSprite->pos.Z -= GetActorHeight(pActor) / 2;
for (int i = 0; i < 30; i++) { for (int i = 0; i < 30; i++) {
BuildSpark(pActor, 0); // shoot out blue orbs BuildSpark(pActor, 0); // shoot out blue orbs
@ -1952,7 +1952,7 @@ void AIObject::Tick(RunListEvent* ev)
int var_18; int var_18;
// red branch // red branch
if ((nStat == kStatExplodeTarget) || (pSprite->z < pSprite->sector()->floorz)) if ((nStat == kStatExplodeTarget) || (pSprite->pos.Z < pSprite->sector()->floorz))
{ {
var_18 = 36; var_18 = 36;
} }
@ -1961,7 +1961,7 @@ void AIObject::Tick(RunListEvent* ev)
var_18 = 34; var_18 = 34;
} }
AddFlash(pSprite->sector(), pSprite->pos.X, pSprite->pos.Y, pSprite->z, 128); AddFlash(pSprite->sector(), pSprite->pos.X, pSprite->pos.Y, pSprite->pos.Z, 128);
BuildAnim(nullptr, var_18, 0, pSprite->pos.X, pSprite->pos.Y, pSprite->sector()->floorz, pSprite->sector(), 240, 4); BuildAnim(nullptr, var_18, 0, pSprite->pos.X, pSprite->pos.Y, pSprite->sector()->floorz, pSprite->sector(), 240, 4);
// int edi = nSprite | 0x4000; // int edi = nSprite | 0x4000;
@ -1997,7 +1997,7 @@ void AIObject::Tick(RunListEvent* ev)
auto pTargSpr = &pActor->pTarget->s(); auto pTargSpr = &pActor->pTarget->s();
pSprite->pos.X = pTargSpr->pos.X; pSprite->pos.X = pTargSpr->pos.X;
pSprite->pos.Y = pTargSpr->pos.Y; pSprite->pos.Y = pTargSpr->pos.Y;
pSprite->z = pTargSpr->z; pSprite->pos.Z = pTargSpr->pos.Z;
ChangeActorSect(pActor, pTargSpr->sector()); ChangeActorSect(pActor, pTargSpr->sector());
return; return;

View file

@ -40,7 +40,7 @@ void GameInterface::WarpToCoords(int x, int y, int z, int ang, int horz)
pSprite->ox = pSprite->pos.X = x; pSprite->ox = pSprite->pos.X = x;
pSprite->oy = pSprite->pos.Y = y; pSprite->oy = pSprite->pos.Y = y;
pSprite->oz = pSprite->z = z; pSprite->oz = pSprite->pos.Z = z;
if (ang != INT_MIN) if (ang != INT_MIN)
{ {

View file

@ -135,7 +135,7 @@ void feebtag(int x, int y, int z, sectortype* pSector, DExhumedActor **nSprite,
{ {
uint32_t xDiff = abs(pSprite->pos.X - x); uint32_t xDiff = abs(pSprite->pos.X - x);
uint32_t yDiff = abs(pSprite->pos.Y - y); uint32_t yDiff = abs(pSprite->pos.Y - y);
int zDiff = pSprite->z - z; int zDiff = pSprite->pos.Z - z;
if (zDiff < 5120 && zDiff > -25600) if (zDiff < 5120 && zDiff > -25600)
{ {
@ -269,7 +269,7 @@ void RestartPlayer(int nPlayer)
nSpr->pos.X = nstspr->pos.X; nSpr->pos.X = nstspr->pos.X;
nSpr->pos.Y = nstspr->pos.Y; nSpr->pos.Y = nstspr->pos.Y;
nSpr->z = nstspr->z; nSpr->pos.Z = nstspr->pos.Z;
ChangeActorSect(pActor, nstspr->sector()); ChangeActorSect(pActor, nstspr->sector());
plr->angle.ang = buildang(nstspr->ang&kAngleMask); plr->angle.ang = buildang(nstspr->ang&kAngleMask);
nSpr->ang = plr->angle.ang.asbuild(); nSpr->ang = plr->angle.ang.asbuild();
@ -279,7 +279,7 @@ void RestartPlayer(int nPlayer)
fspr->pos.X = nSpr->pos.X; fspr->pos.X = nSpr->pos.X;
fspr->pos.Y = nSpr->pos.Y; fspr->pos.Y = nSpr->pos.Y;
fspr->z = nSpr->z; fspr->pos.Z = nSpr->pos.Z;
fspr->yrepeat = 64; fspr->yrepeat = 64;
fspr->xrepeat = 64; fspr->xrepeat = 64;
fspr->cstat = CSTAT_SPRITE_ALIGNMENT_FLOOR; fspr->cstat = CSTAT_SPRITE_ALIGNMENT_FLOOR;
@ -289,7 +289,7 @@ void RestartPlayer(int nPlayer)
{ {
nSpr->pos.X = plr->sPlayerSave.x; nSpr->pos.X = plr->sPlayerSave.x;
nSpr->pos.Y = plr->sPlayerSave.y; nSpr->pos.Y = plr->sPlayerSave.y;
nSpr->z = plr->sPlayerSave.pSector->floorz; nSpr->pos.Z = plr->sPlayerSave.pSector->floorz;
plr->angle.ang = buildang(plr->sPlayerSave.nAngle&kAngleMask); plr->angle.ang = buildang(plr->sPlayerSave.nAngle&kAngleMask);
nSpr->ang = plr->angle.ang.asbuild(); nSpr->ang = plr->angle.ang.asbuild();
@ -325,7 +325,7 @@ void RestartPlayer(int nPlayer)
auto nDSpr = &pDActor->s(); auto nDSpr = &pDActor->s();
nDSpr->pos.X = nSpr->pos.X; nDSpr->pos.X = nSpr->pos.X;
nDSpr->pos.Y = nSpr->pos.Y; nDSpr->pos.Y = nSpr->pos.Y;
nDSpr->z = nSpr->z; nDSpr->pos.Z = nSpr->pos.Z;
nDSpr->xrepeat = nSpr->xrepeat; nDSpr->xrepeat = nSpr->xrepeat;
nDSpr->yrepeat = nSpr->yrepeat; nDSpr->yrepeat = nSpr->yrepeat;
nDSpr->xoffset = 0; nDSpr->xoffset = 0;
@ -472,7 +472,7 @@ void StartDeathSeq(int nPlayer, int nVal)
pGunSprite->pos.X = pSprite->pos.X; pGunSprite->pos.X = pSprite->pos.X;
pGunSprite->pos.Y = pSprite->pos.Y; pGunSprite->pos.Y = pSprite->pos.Y;
pGunSprite->z = pSector->floorz - 512; pGunSprite->pos.Z = pSector->floorz - 512;
ChangeActorStat(pGunActor, nGunLotag[nWeapon] + 900); ChangeActorStat(pGunActor, nGunLotag[nWeapon] + 900);
@ -798,7 +798,7 @@ void AIPlayer::Tick(RunListEvent* ev)
AddFlash(pPlayerSprite->sector(), AddFlash(pPlayerSprite->sector(),
pPlayerSprite->pos.X, pPlayerSprite->pos.X,
pPlayerSprite->pos.Y, pPlayerSprite->pos.Y,
pPlayerSprite->z, 0); pPlayerSprite->pos.Z, 0);
} }
} }
} }
@ -888,7 +888,7 @@ void AIPlayer::Tick(RunListEvent* ev)
int spr_x = pPlayerSprite->pos.X; int spr_x = pPlayerSprite->pos.X;
int spr_y = pPlayerSprite->pos.Y; int spr_y = pPlayerSprite->pos.Y;
int spr_z = pPlayerSprite->z; int spr_z = pPlayerSprite->pos.Z;
auto spr_sect = pPlayerSprite->sector(); auto spr_sect = pPlayerSprite->sector();
// TODO // TODO
@ -903,10 +903,10 @@ void AIPlayer::Tick(RunListEvent* ev)
pPlayerSprite->pos.X += (x >> 14); pPlayerSprite->pos.X += (x >> 14);
pPlayerSprite->pos.Y += (y >> 14); pPlayerSprite->pos.Y += (y >> 14);
vec3_t pos = { pPlayerSprite->pos.X, pPlayerSprite->pos.Y, pPlayerSprite->z }; vec3_t pos = { pPlayerSprite->pos.X, pPlayerSprite->pos.Y, pPlayerSprite->pos.Z };
SetActor(pPlayerActor, &pos); SetActor(pPlayerActor, &pos);
pPlayerSprite->z = pPlayerSprite->sector()->floorz; pPlayerSprite->pos.Z = pPlayerSprite->sector()->floorz;
} }
else else
{ {
@ -1013,7 +1013,7 @@ void AIPlayer::Tick(RunListEvent* ev)
pPlayerSprite->yvel = 0; pPlayerSprite->yvel = 0;
StopActorSound(pPlayerActor); StopActorSound(pPlayerActor);
PlayFXAtXYZ(StaticSound[kSoundJonFDie], pPlayerSprite->pos.X, pPlayerSprite->pos.Y, pPlayerSprite->z, CHANF_NONE, 1); // CHECKME PlayFXAtXYZ(StaticSound[kSoundJonFDie], pPlayerSprite->pos.X, pPlayerSprite->pos.Y, pPlayerSprite->pos.Z, CHANF_NONE, 1); // CHECKME
} }
else else
{ {
@ -1071,7 +1071,7 @@ void AIPlayer::Tick(RunListEvent* ev)
{ {
pPlayerSprite->pos.X = spr_x; pPlayerSprite->pos.X = spr_x;
pPlayerSprite->pos.Y = spr_y; pPlayerSprite->pos.Y = spr_y;
pPlayerSprite->z = spr_z; pPlayerSprite->pos.Z = spr_z;
ChangeActorSect(pPlayerActor, spr_sect); ChangeActorSect(pPlayerActor, spr_sect);
} }
@ -1098,7 +1098,7 @@ void AIPlayer::Tick(RunListEvent* ev)
sectdone: sectdone:
if (!PlayerList[nPlayer].bPlayerPan && !PlayerList[nPlayer].bLockPan) if (!PlayerList[nPlayer].bPlayerPan && !PlayerList[nPlayer].bLockPan)
{ {
PlayerList[nPlayer].nDestVertPan = q16horiz(clamp((spr_z - pPlayerSprite->z) << 9, gi->playerHorizMin(), gi->playerHorizMax())); PlayerList[nPlayer].nDestVertPan = q16horiz(clamp((spr_z - pPlayerSprite->pos.Z) << 9, gi->playerHorizMin(), gi->playerHorizMax()));
} }
playerX -= pPlayerSprite->pos.X; playerX -= pPlayerSprite->pos.X;
@ -1117,7 +1117,7 @@ sectdone:
auto pViewSect = pPlayerSprite->sector(); auto pViewSect = pPlayerSprite->sector();
int EyeZ = PlayerList[nPlayer].eyelevel + pPlayerSprite->z + nQuake[nPlayer]; int EyeZ = PlayerList[nPlayer].eyelevel + pPlayerSprite->pos.Z + nQuake[nPlayer];
while (1) while (1)
{ {
@ -1141,7 +1141,7 @@ sectdone:
{ {
int var_C4 = pPlayerSprite->pos.X; int var_C4 = pPlayerSprite->pos.X;
int var_D4 = pPlayerSprite->pos.Y; int var_D4 = pPlayerSprite->pos.Y;
int var_C8 = pPlayerSprite->z; int var_C8 = pPlayerSprite->pos.Z;
ChangeActorSect(pPlayerActor, pViewSect); ChangeActorSect(pPlayerActor, pViewSect);
@ -1150,7 +1150,7 @@ sectdone:
int var_FC = pViewSect->floorz + (-5120); int var_FC = pViewSect->floorz + (-5120);
pPlayerSprite->z = var_FC; pPlayerSprite->pos.Z = var_FC;
auto coll = movesprite(pPlayerActor, x, y, 0, 5120, 0, CLIPMASK0); auto coll = movesprite(pPlayerActor, x, y, 0, 5120, 0, CLIPMASK0);
if (coll.type == kHitWall) if (coll.type == kHitWall)
@ -1159,11 +1159,11 @@ sectdone:
pPlayerSprite->pos.X = var_C4; pPlayerSprite->pos.X = var_C4;
pPlayerSprite->pos.Y = var_D4; pPlayerSprite->pos.Y = var_D4;
pPlayerSprite->z = var_C8; pPlayerSprite->pos.Z = var_C8;
} }
else else
{ {
pPlayerSprite->z = var_FC - 256; pPlayerSprite->pos.Z = var_FC - 256;
D3PlayFX(StaticSound[kSound42], pPlayerActor); D3PlayFX(StaticSound[kSound42], pPlayerActor);
} }
} }
@ -1256,7 +1256,7 @@ sectdone:
{ {
auto pTmpSect = pPlayerSprite->sector(); auto pTmpSect = pPlayerSprite->sector();
if (PlayerList[nPlayer].totalvel > 25 && pPlayerSprite->z > pTmpSect->floorz) if (PlayerList[nPlayer].totalvel > 25 && pPlayerSprite->pos.Z > pTmpSect->floorz)
{ {
if (pTmpSect->Depth && !pTmpSect->Speed && !pTmpSect->Damage) if (pTmpSect->Depth && !pTmpSect->Speed && !pTmpSect->Damage)
{ {
@ -1301,7 +1301,7 @@ sectdone:
ChangeActorSect(pFloorActor, pPlayerSprite->sector()); ChangeActorSect(pFloorActor, pPlayerSprite->sector());
} }
pFloorSprite->z = pPlayerSprite->sector()->floorz; pFloorSprite->pos.Z = pPlayerSprite->sector()->floorz;
} }
int var_30 = 0; int var_30 = 0;
@ -1323,7 +1323,7 @@ sectdone:
neartag(pPlayerSprite->pos, pPlayerSprite->sector(), pPlayerSprite->ang, near, 1024, 2); neartag(pPlayerSprite->pos, pPlayerSprite->sector(), pPlayerSprite->ang, near, 1024, 2);
DExhumedActor* pActorB; DExhumedActor* pActorB;
feebtag(pPlayerSprite->pos.X, pPlayerSprite->pos.Y, pPlayerSprite->z, pPlayerSprite->sector(), &pActorB, var_30, 768); feebtag(pPlayerSprite->pos.X, pPlayerSprite->pos.Y, pPlayerSprite->pos.Z, pPlayerSprite->sector(), &pActorB, var_30, 768);
// Item pickup code // Item pickup code
if (pActorB != nullptr && pActorB->spr.statnum >= 900) if (pActorB != nullptr && pActorB->spr.statnum >= 900)
@ -2219,7 +2219,7 @@ sectdone:
ChangeActorStat(pActorB, 899); ChangeActorStat(pActorB, 899);
} }
SetSavePoint(nPlayer, pPlayerSprite->pos.X, pPlayerSprite->pos.Y, pPlayerSprite->z, pPlayerSprite->sector(), pPlayerSprite->ang); SetSavePoint(nPlayer, pPlayerSprite->pos.X, pPlayerSprite->pos.Y, pPlayerSprite->pos.Z, pPlayerSprite->sector(), pPlayerSprite->ang);
break; break;
} }
@ -2489,7 +2489,7 @@ sectdone:
{ {
pPlayerSprite->picnum = seq_GetSeqPicnum(kSeqJoe, 120, 0); pPlayerSprite->picnum = seq_GetSeqPicnum(kSeqJoe, 120, 0);
pPlayerSprite->cstat = 0; pPlayerSprite->cstat = 0;
pPlayerSprite->z = pPlayerSprite->sector()->floorz; pPlayerSprite->pos.Z = pPlayerSprite->sector()->floorz;
} }
// will invalidate nPlayerSprite // will invalidate nPlayerSprite
@ -2537,8 +2537,8 @@ sectdone:
case 16: case 16:
PlayerList[nPlayer].nSeqSize = SeqSize[var_AC] - 1; PlayerList[nPlayer].nSeqSize = SeqSize[var_AC] - 1;
if (pPlayerSprite->z < pPlayerSprite->sector()->floorz) { if (pPlayerSprite->pos.Z < pPlayerSprite->sector()->floorz) {
pPlayerSprite->z += 256; pPlayerSprite->pos.Z += 256;
} }
if (!RandomSize(5)) if (!RandomSize(5))
@ -2547,7 +2547,7 @@ sectdone:
sectortype* mouthSect; sectortype* mouthSect;
WheresMyMouth(nPlayer, &pos, &mouthSect); WheresMyMouth(nPlayer, &pos, &mouthSect);
BuildAnim(nullptr, 71, 0, pos.X, pos.Y, pPlayerSprite->z + 3840, mouthSect, 75, 128); BuildAnim(nullptr, 71, 0, pos.X, pos.Y, pPlayerSprite->pos.Z + 3840, mouthSect, 75, 128);
} }
break; break;
case 17: case 17:
@ -2565,7 +2565,7 @@ sectdone:
{ {
initx = pPlayerSprite->pos.X; initx = pPlayerSprite->pos.X;
inity = pPlayerSprite->pos.Y; inity = pPlayerSprite->pos.Y;
initz = pPlayerSprite->z; initz = pPlayerSprite->pos.Z;
initsectp = pPlayerSprite->sector(); initsectp = pPlayerSprite->sector();
inita = pPlayerSprite->ang; inita = pPlayerSprite->ang;
} }

View file

@ -250,7 +250,7 @@ void DestroyEgg(int nEgg)
if (QueenEgg[nEgg].nAction != 4) if (QueenEgg[nEgg].nAction != 4)
{ {
BuildAnim(nullptr, 34, 0, pSprite->pos.X, pSprite->pos.Y, pSprite->z, pSprite->sector(), pSprite->xrepeat, 4); BuildAnim(nullptr, 34, 0, pSprite->pos.X, pSprite->pos.Y, pSprite->pos.Z, pSprite->sector(), pSprite->xrepeat, 4);
} }
else else
{ {
@ -307,7 +307,7 @@ Collision QueenAngleChase(DExhumedActor* pActor, DExhumedActor* pActor2, int val
int nMyAngle = GetMyAngle(pSprite2->pos.X - pSprite->pos.X, pSprite2->pos.Y - pSprite->pos.Y); int nMyAngle = GetMyAngle(pSprite2->pos.X - pSprite->pos.X, pSprite2->pos.Y - pSprite->pos.Y);
int edx = ((pSprite2->z - nTileY) - pSprite->z) >> 8; int edx = ((pSprite2->pos.Z - nTileY) - pSprite->pos.Z) >> 8;
uint32_t xDiff = abs(pSprite2->pos.X - pSprite->pos.X); uint32_t xDiff = abs(pSprite2->pos.X - pSprite->pos.X);
uint32_t yDiff = abs(pSprite2->pos.Y - pSprite->pos.Y); uint32_t yDiff = abs(pSprite2->pos.Y - pSprite->pos.Y);
@ -423,7 +423,7 @@ void BuildTail()
pTailSprite->pal = pTailSprite->sector()->ceilingpal; pTailSprite->pal = pTailSprite->sector()->ceilingpal;
pTailSprite->xoffset = 0; pTailSprite->xoffset = 0;
pTailSprite->yoffset = 0; pTailSprite->yoffset = 0;
pTailSprite->z = z; pTailSprite->pos.Z = z;
pTailSprite->extra = -1; pTailSprite->extra = -1;
} }
@ -462,7 +462,7 @@ void BuildQueenEgg(int nQueen, int nVal)
pSprite2->pos.X = x; pSprite2->pos.X = x;
pSprite2->pos.Y = y; pSprite2->pos.Y = y;
pSprite2->z = nFloorZ; pSprite2->pos.Z = nFloorZ;
pSprite2->pal = 0; pSprite2->pal = 0;
pSprite2->clipdist = 50; pSprite2->clipdist = 50;
pSprite2->xoffset = 0; pSprite2->xoffset = 0;
@ -662,8 +662,8 @@ void AIQueenEgg::Tick(RunListEvent* ev)
pEgg->nCounter--; pEgg->nCounter--;
if (pEgg->nCounter <= 0) if (pEgg->nCounter <= 0)
{ {
auto pWaspSprite = BuildWasp(nullptr, pSprite->pos.X, pSprite->pos.Y, pSprite->z, pSprite->sector(), pSprite->ang, true); auto pWaspSprite = BuildWasp(nullptr, pSprite->pos.X, pSprite->pos.Y, pSprite->pos.Z, pSprite->sector(), pSprite->ang, true);
pSprite->z = pWaspSprite->spr.z; pSprite->pos.Z = pWaspSprite->spr.pos.Z;
DestroyEgg(nEgg); DestroyEgg(nEgg);
} }
@ -727,7 +727,7 @@ void BuildQueenHead(int nQueen)
pSprite2->pos.X = x; pSprite2->pos.X = x;
pSprite2->pos.Y = y; pSprite2->pos.Y = y;
pSprite2->z = z; pSprite2->pos.Z = z;
pSprite2->clipdist = 70; pSprite2->clipdist = 70;
pSprite2->xrepeat = 80; pSprite2->xrepeat = 80;
pSprite2->yrepeat = 80; pSprite2->yrepeat = 80;
@ -880,14 +880,14 @@ void AIQueenHead::Tick(RunListEvent* ev)
[[fallthrough]]; [[fallthrough]];
case 1: case 1:
if ((pTarget->spr.z - 51200) > pSprite->z) if ((pTarget->spr.pos.Z - 51200) > pSprite->pos.Z)
{ {
QueenHead.nAction = 4; QueenHead.nAction = 4;
QueenHead.nFrame = 0; QueenHead.nFrame = 0;
} }
else else
{ {
pSprite->z -= 2048; pSprite->pos.Z -= 2048;
goto __MOVEQS; goto __MOVEQS;
} }
break; break;
@ -938,7 +938,7 @@ void AIQueenHead::Tick(RunListEvent* ev)
__MOVEQS: __MOVEQS:
MoveQX[nQHead] = pSprite->pos.X; MoveQX[nQHead] = pSprite->pos.X;
MoveQY[nQHead] = pSprite->pos.Y; MoveQY[nQHead] = pSprite->pos.Y;
MoveQZ[nQHead] = pSprite->z; MoveQZ[nQHead] = pSprite->pos.Z;
assert(pSprite->sector()); assert(pSprite->sector());
MoveQS[nQHead] = pSprite->sector(); MoveQS[nQHead] = pSprite->sector();
MoveQA[nQHead] = pSprite->ang; MoveQA[nQHead] = pSprite->ang;
@ -966,7 +966,7 @@ void AIQueenHead::Tick(RunListEvent* ev)
pTSprite->pos.X = MoveQX[nHd]; pTSprite->pos.X = MoveQX[nHd];
pTSprite->pos.Y = MoveQY[nHd]; pTSprite->pos.Y = MoveQY[nHd];
pTSprite->z = MoveQZ[nHd]; pTSprite->pos.Z = MoveQZ[nHd];
pTSprite->ang = MoveQA[nHd]; pTSprite->ang = MoveQA[nHd];
} }
} }
@ -991,7 +991,7 @@ void AIQueenHead::Tick(RunListEvent* ev)
{ {
int x = pSprite->pos.X; int x = pSprite->pos.X;
int y = pSprite->pos.Y; int y = pSprite->pos.Y;
int z = pSprite->z; int z = pSprite->pos.Z;
auto pSector =pSprite->sector(); auto pSector =pSprite->sector();
int nAngle = RandomSize(11) & kAngleMask; int nAngle = RandomSize(11) & kAngleMask;
@ -1015,7 +1015,7 @@ void AIQueenHead::Tick(RunListEvent* ev)
pSprite->pos.X = x; pSprite->pos.X = x;
pSprite->pos.Y = y; pSprite->pos.Y = y;
pSprite->z = z; pSprite->pos.Z = z;
if (QueenHead.nIndex2 < 10) { if (QueenHead.nIndex2 < 10) {
for (int i = (10 - QueenHead.nIndex2) * 2; i > 0; i--) for (int i = (10 - QueenHead.nIndex2) * 2; i > 0; i--)
@ -1149,7 +1149,7 @@ void BuildQueen(DExhumedActor* pActor, int x, int y, int z, sectortype* pSector,
pSprite->pos.X = x; pSprite->pos.X = x;
pSprite->pos.Y = y; pSprite->pos.Y = y;
pSprite->z = z; pSprite->pos.Z = z;
pSprite->cstat = CSTAT_SPRITE_BLOCK_ALL; pSprite->cstat = CSTAT_SPRITE_BLOCK_ALL;
pSprite->pal = 0; pSprite->pal = 0;
pSprite->shade = -12; pSprite->shade = -12;
@ -1435,7 +1435,7 @@ void AIQueen::Tick(RunListEvent* ev)
StaticSound[kSound40], StaticSound[kSound40],
pSprite->pos.X, pSprite->pos.X,
pSprite->pos.Y, pSprite->pos.Y,
pSprite->z); pSprite->pos.Z);
BuildQueenHead(nQueen); BuildQueenHead(nQueen);
@ -1501,7 +1501,7 @@ void AIQueen::Damage(RunListEvent* ev)
QueenList[nQueen].nHealth = 4000; QueenList[nQueen].nHealth = 4000;
QueenList[nQueen].nAction = 7; QueenList[nQueen].nAction = 7;
BuildAnim(nullptr, 36, 0, pSprite->pos.X, pSprite->pos.Y, pSprite->z - 7680, pSprite->sector(), pSprite->xrepeat, 4); BuildAnim(nullptr, 36, 0, pSprite->pos.X, pSprite->pos.Y, pSprite->pos.Z - 7680, pSprite->sector(), pSprite->xrepeat, 4);
break; break;
case 2: case 2:
QueenList[nQueen].nHealth = 4000; QueenList[nQueen].nHealth = 4000;

View file

@ -171,7 +171,7 @@ void MoveRaToEnemy(int nPlayer)
pSprite->pos.X = pTargSprite->pos.X; pSprite->pos.X = pTargSprite->pos.X;
pSprite->pos.Y = pTargSprite->pos.Y; pSprite->pos.Y = pTargSprite->pos.Y;
pSprite->z = pTargSprite->z - GetActorHeight(pTarget); pSprite->pos.Z = pTargSprite->pos.Z - GetActorHeight(pTarget);
if (pSprite->sector() != pTargSprite->sector()) { if (pSprite->sector() != pTargSprite->sector()) {
ChangeActorSect(pActor, pTargSprite->sector()); ChangeActorSect(pActor, pTargSprite->sector());

View file

@ -426,7 +426,7 @@ void DoSpiritHead()
if (nCount < (15 * nPixels) / 16) { if (nCount < (15 * nPixels) / 16) {
SoundBigEntrance(); SoundBigEntrance();
AddGlow(pSpiritSpr->sector(), 20); AddGlow(pSpiritSpr->sector(), 20);
AddFlash(pSpiritSpr->sector(), pSpiritSpr->pos.X, pSpiritSpr->pos.Y, pSpiritSpr->z, 128); AddFlash(pSpiritSpr->sector(), pSpiritSpr->pos.X, pSpiritSpr->pos.Y, pSpiritSpr->pos.Z, 128);
nHeadStage = 3; nHeadStage = 3;
TintPalette(255, 255, 255); TintPalette(255, 255, 255);
CopyHeadToWorkTile(kTileRamsesNormal); CopyHeadToWorkTile(kTileRamsesNormal);

View file

@ -86,7 +86,7 @@ void BuildRat(DExhumedActor* pActor, int x, int y, int z, sectortype* pSector, i
pSprite = &pActor->s(); pSprite = &pActor->s();
x = pSprite->pos.X; x = pSprite->pos.X;
y = pSprite->pos.Y; y = pSprite->pos.Y;
z = pSprite->z; z = pSprite->pos.Z;
nAngle = pSprite->ang; nAngle = pSprite->ang;
ChangeActorStat(pActor, 108); ChangeActorStat(pActor, 108);
@ -132,7 +132,7 @@ DExhumedActor* FindFood(DExhumedActor* pActor)
auto pSector = pSprite->sector(); auto pSector = pSprite->sector();
int x = pSprite->pos.X; int x = pSprite->pos.X;
int y = pSprite->pos.Y; int y = pSprite->pos.Y;
int z = pSprite->z; int z = pSprite->pos.Z;
int z2 = (z + pSector->ceilingz) / 2; int z2 = (z + pSector->ceilingz) / 2;
@ -142,7 +142,7 @@ DExhumedActor* FindFood(DExhumedActor* pActor)
if (pActor2 != nullptr) if (pActor2 != nullptr)
{ {
auto pSprite2 = &pActor2->s(); auto pSprite2 = &pActor2->s();
if (cansee(x, y, z2, pSector, pSprite2->pos.X, pSprite2->pos.Y, pSprite2->z, pSprite2->sector())) { if (cansee(x, y, z2, pSector, pSprite2->pos.X, pSprite2->pos.Y, pSprite2->pos.Z, pSprite2->sector())) {
return pActor2; return pActor2;
} }
} }
@ -158,7 +158,7 @@ DExhumedActor* FindFood(DExhumedActor* pActor)
auto pSprite2 = &pActor2->s(); auto pSprite2 = &pActor2->s();
if (nPlayerPic == pSprite2->picnum) if (nPlayerPic == pSprite2->picnum)
{ {
if (cansee(x, y, z, pSector, pSprite2->pos.X, pSprite2->pos.Y, pSprite2->z, pSprite2->sector())) { if (cansee(x, y, z, pSector, pSprite2->pos.X, pSprite2->pos.Y, pSprite2->pos.Z, pSprite2->sector())) {
return pActor2; return pActor2;
} }
} }

View file

@ -58,7 +58,7 @@ void BuildRex(DExhumedActor* pActor, int x, int y, int z, sectortype* pSector, i
pSprite->pos.X = x; pSprite->pos.X = x;
pSprite->pos.Y = y; pSprite->pos.Y = y;
pSprite->z = z; pSprite->pos.Z = z;
pSprite->cstat = CSTAT_SPRITE_BLOCK_ALL; pSprite->cstat = CSTAT_SPRITE_BLOCK_ALL;
pSprite->clipdist = 80; pSprite->clipdist = 80;
pSprite->shade = -12; pSprite->shade = -12;

View file

@ -55,7 +55,7 @@ void BuildRoach(int nType, DExhumedActor* pActor, int x, int y, int z, sectortyp
pSprite->pos.X = x; pSprite->pos.X = x;
pSprite->pos.Y = y; pSprite->pos.Y = y;
pSprite->z = z; pSprite->pos.Z = z;
pSprite->cstat = CSTAT_SPRITE_BLOCK_ALL; pSprite->cstat = CSTAT_SPRITE_BLOCK_ALL;
pSprite->shade = -12; pSprite->shade = -12;
pSprite->xoffset = 0; pSprite->xoffset = 0;

View file

@ -1609,7 +1609,7 @@ int runlist_CheckRadialDamage(DExhumedActor* pActor)
int x = (pSprite->pos.X - pRadialSpr->pos.X) >> 8; int x = (pSprite->pos.X - pRadialSpr->pos.X) >> 8;
int y = (pSprite->pos.Y - pRadialSpr->pos.Y) >> 8; int y = (pSprite->pos.Y - pRadialSpr->pos.Y) >> 8;
int z = (pSprite->z - pRadialSpr->z) >> 12; int z = (pSprite->pos.Z - pRadialSpr->pos.Z) >> 12;
if (abs(x) > nDamageRadius) { if (abs(x) > nDamageRadius) {
return 0; return 0;
@ -1646,11 +1646,11 @@ int runlist_CheckRadialDamage(DExhumedActor* pActor)
if (((kStatExplodeTarget - pSprite->statnum) <= 1) || if (((kStatExplodeTarget - pSprite->statnum) <= 1) ||
cansee(pRadialSpr->pos.X, cansee(pRadialSpr->pos.X,
pRadialSpr->pos.Y, pRadialSpr->pos.Y,
pRadialSpr->z - 512, pRadialSpr->pos.Z - 512,
pRadialSpr->sector(), pRadialSpr->sector(),
pSprite->pos.X, pSprite->pos.X,
pSprite->pos.Y, pSprite->pos.Y,
pSprite->z - 8192, pSprite->pos.Z - 8192,
pSprite->sector())) pSprite->sector()))
{ {
edi = (nRadialDamage * (nDamageRadius - nDist)) / nDamageRadius; edi = (nRadialDamage * (nDamageRadius - nDist)) / nDamageRadius;

View file

@ -60,7 +60,7 @@ void BuildScorp(DExhumedActor* pActor, int x, int y, int z, sectortype* pSector,
pSprite->pos.X = x; pSprite->pos.X = x;
pSprite->pos.Y = y; pSprite->pos.Y = y;
pSprite->z = z; pSprite->pos.Z = z;
pSprite->cstat = CSTAT_SPRITE_BLOCK_ALL; pSprite->cstat = CSTAT_SPRITE_BLOCK_ALL;
pSprite->clipdist = 70; pSprite->clipdist = 70;
pSprite->shade = -12; pSprite->shade = -12;
@ -379,7 +379,7 @@ void AIScorp::Tick(RunListEvent* ev)
return; return;
} }
auto pSpiderActor = BuildSpider(nullptr, pSprite->pos.X, pSprite->pos.Y, pSprite->z, pSprite->sector(), pSprite->ang); auto pSpiderActor = BuildSpider(nullptr, pSprite->pos.X, pSprite->pos.Y, pSprite->pos.Z, pSprite->sector(), pSprite->ang);
if (pSpiderActor) if (pSpiderActor)
{ {
auto pSpiderSprite = &pSpiderActor->s(); auto pSpiderSprite = &pSpiderActor->s();
@ -440,8 +440,8 @@ void AIScorp::Effect(RunListEvent* ev, DExhumedActor* pTarget, int mode)
{ {
pActor->nCount = 45; pActor->nCount = 45;
if (cansee(pSprite->pos.X, pSprite->pos.Y, pSprite->z - GetActorHeight(pActor), pSprite->sector(), if (cansee(pSprite->pos.X, pSprite->pos.Y, pSprite->pos.Z - GetActorHeight(pActor), pSprite->sector(),
pTarget->spr.pos.X, pTarget->spr.pos.Y, pTarget->spr.z - GetActorHeight(pTarget), pTarget->spr.sector())) pTarget->spr.pos.X, pTarget->spr.pos.Y, pTarget->spr.pos.Z - GetActorHeight(pTarget), pTarget->spr.sector()))
{ {
pSprite->xvel = 0; pSprite->xvel = 0;
pSprite->yvel = 0; pSprite->yvel = 0;

View file

@ -575,7 +575,7 @@ int seq_PlotSequence(int nSprite, int16_t edx, int16_t nFrame, int16_t ecx)
tspriteptr_t tsp = &mytsprite[(*myspritesortcnt)++]; tspriteptr_t tsp = &mytsprite[(*myspritesortcnt)++];
tsp->pos.X = pTSprite->pos.X; tsp->pos.X = pTSprite->pos.X;
tsp->pos.Y = pTSprite->pos.Y; tsp->pos.Y = pTSprite->pos.Y;
tsp->z = pTSprite->z; tsp->pos.Z = pTSprite->pos.Z;
tsp->shade = shade; tsp->shade = shade;
tsp->pal = pTSprite->pal; tsp->pal = pTSprite->pal;
tsp->xrepeat = pTSprite->xrepeat; tsp->xrepeat = pTSprite->xrepeat;
@ -619,13 +619,13 @@ int seq_PlotSequence(int nSprite, int16_t edx, int16_t nFrame, int16_t ecx)
{ {
pTSprite->picnum = nShadowPic; pTSprite->picnum = nShadowPic;
int edx = ((tileWidth(nPict) << 5) / nShadowWidth) - ((nFloorZ - pTSprite->z) >> 10); int edx = ((tileWidth(nPict) << 5) / nShadowWidth) - ((nFloorZ - pTSprite->pos.Z) >> 10);
if (edx < 1) { if (edx < 1) {
edx = 1; edx = 1;
} }
pTSprite->cstat = CSTAT_SPRITE_ALIGNMENT_FLOOR | CSTAT_SPRITE_TRANSLUCENT; pTSprite->cstat = CSTAT_SPRITE_ALIGNMENT_FLOOR | CSTAT_SPRITE_TRANSLUCENT;
pTSprite->z = nFloorZ; pTSprite->pos.Z = nFloorZ;
pTSprite->yrepeat = (uint8_t)edx; pTSprite->yrepeat = (uint8_t)edx;
pTSprite->xrepeat = (uint8_t)edx; pTSprite->xrepeat = (uint8_t)edx;
pTSprite->statnum = -3; pTSprite->statnum = -3;

View file

@ -59,7 +59,7 @@ void BuildSet(DExhumedActor* pActor, int x, int y, int z, sectortype* pSector, i
pSprite->pos.X = x; pSprite->pos.X = x;
pSprite->pos.Y = y; pSprite->pos.Y = y;
pSprite->z = z; pSprite->pos.Z = z;
pSprite->cstat = CSTAT_SPRITE_BLOCK_ALL; pSprite->cstat = CSTAT_SPRITE_BLOCK_ALL;
pSprite->shade = -12; pSprite->shade = -12;
pSprite->clipdist = 110; pSprite->clipdist = 110;
@ -120,7 +120,7 @@ void BuildSoul(DExhumedActor* pSet)
pSprite->pos.X = pSetSprite->pos.X; pSprite->pos.X = pSetSprite->pos.X;
pSprite->pos.Y = pSetSprite->pos.Y; pSprite->pos.Y = pSetSprite->pos.Y;
pSprite->z = (RandomSize(8) << 8) + 8192 + pSprite->sector()->ceilingz - GetActorHeight(pActor); pSprite->pos.Z = (RandomSize(8) << 8) + 8192 + pSprite->sector()->ceilingz - GetActorHeight(pActor);
//pSprite->hitag = nSet; //pSprite->hitag = nSet;
pActor->pTarget = pSet; pActor->pTarget = pSet;
@ -165,7 +165,7 @@ void AISoul::Tick(RunListEvent* ev)
pSprite->xrepeat = 1; pSprite->xrepeat = 1;
pSprite->pos.X = pSetSprite->pos.X; pSprite->pos.X = pSetSprite->pos.X;
pSprite->pos.Y = pSetSprite->pos.Y; pSprite->pos.Y = pSetSprite->pos.Y;
pSprite->z = pSetSprite->z - (GetActorHeight(pSet) >> 1); pSprite->pos.Z = pSetSprite->pos.Z - (GetActorHeight(pSet) >> 1);
ChangeActorSect(pActor, pSetSprite->sector()); ChangeActorSect(pActor, pSetSprite->sector());
return; return;
} }
@ -423,9 +423,9 @@ void AISet::Tick(RunListEvent* ev)
if (pSector) if (pSector)
{ {
if ((pSprite->z - pSector->floorz) < 55000) if ((pSprite->pos.Z - pSector->floorz) < 55000)
{ {
if (pSprite->z > pSector->ceilingz) if (pSprite->pos.Z > pSector->ceilingz)
{ {
pActor->nIndex = 1; pActor->nIndex = 1;
pActor->nAction = 7; pActor->nAction = 7;
@ -589,9 +589,9 @@ void AISet::Tick(RunListEvent* ev)
{ {
if (nFlag & 0x80) if (nFlag & 0x80)
{ {
pSprite->z -= GetActorHeight(pActor); pSprite->pos.Z -= GetActorHeight(pActor);
BuildCreatureChunk(pActor, seq_GetSeqPicnum(kSeqSet, 76, 0)); BuildCreatureChunk(pActor, seq_GetSeqPicnum(kSeqSet, 76, 0));
pSprite->z += GetActorHeight(pActor); pSprite->pos.Z += GetActorHeight(pActor);
} }
if (bVal) if (bVal)

View file

@ -119,9 +119,9 @@ void ExplodeSnakeSprite(DExhumedActor* pActor, int nPlayer)
pActor->pTarget = nOwner; pActor->pTarget = nOwner;
BuildAnim(nullptr, 23, 0, pSprite->pos.X, pSprite->pos.Y, pSprite->z, pSprite->sector(), 40, 4); BuildAnim(nullptr, 23, 0, pSprite->pos.X, pSprite->pos.Y, pSprite->pos.Z, pSprite->sector(), 40, 4);
AddFlash(pSprite->sector(), pSprite->pos.X, pSprite->pos.Y, pSprite->z, 128); AddFlash(pSprite->sector(), pSprite->pos.X, pSprite->pos.Y, pSprite->pos.Z, 128);
StopActorSound(pActor); StopActorSound(pActor);
} }
@ -138,7 +138,7 @@ void BuildSnake(int nPlayer, int zVal)
int x = pPlayerSprite->pos.X; int x = pPlayerSprite->pos.X;
int y = pPlayerSprite->pos.Y; int y = pPlayerSprite->pos.Y;
int z = (pPlayerSprite->z + zVal) - 2560; int z = (pPlayerSprite->pos.Z + zVal) - 2560;
int nAngle = pPlayerSprite->ang; int nAngle = pPlayerSprite->ang;
HitInfo hit{}; HitInfo hit{};
@ -164,7 +164,7 @@ void BuildSnake(int nPlayer, int zVal)
auto pSprite = &pActor->s(); auto pSprite = &pActor->s();
pSprite->pos.X = hit.hitpos.X; pSprite->pos.X = hit.hitpos.X;
pSprite->pos.Y = hit.hitpos.Y; pSprite->pos.Y = hit.hitpos.Y;
pSprite->z = hit.hitpos.Z; pSprite->pos.Z = hit.hitpos.Z;
ExplodeSnakeSprite(pActor, nPlayer); ExplodeSnakeSprite(pActor, nPlayer);
DeleteActor(pActor); DeleteActor(pActor);
@ -202,7 +202,7 @@ void BuildSnake(int nPlayer, int zVal)
{ {
pSprite->pos.X = pPlayerSprite->pos.X; pSprite->pos.X = pPlayerSprite->pos.X;
pSprite->pos.Y = pPlayerSprite->pos.Y; pSprite->pos.Y = pPlayerSprite->pos.Y;
pSprite->z = pPlayerSprite->z + zVal; pSprite->pos.Z = pPlayerSprite->pos.Z + zVal;
pSprite->xrepeat = 32; pSprite->xrepeat = 32;
pSprite->yrepeat = 32; pSprite->yrepeat = 32;
pViewSect = pSprite->sector(); pViewSect = pSprite->sector();
@ -212,7 +212,7 @@ void BuildSnake(int nPlayer, int zVal)
{ {
pSprite->pos.X = sprt->spr.pos.X; pSprite->pos.X = sprt->spr.pos.X;
pSprite->pos.Y = sprt->spr.pos.Y; pSprite->pos.Y = sprt->spr.pos.Y;
pSprite->z = sprt->spr.z; pSprite->pos.Z = sprt->spr.pos.Z;
pSprite->xrepeat = 40 - 3 * i; pSprite->xrepeat = 40 - 3 * i;
pSprite->yrepeat = 40 - 3 * i; pSprite->yrepeat = 40 - 3 * i;
} }
@ -351,11 +351,11 @@ void AISnake::Tick(RunListEvent* ev)
goto SEARCH_ENEMY; goto SEARCH_ENEMY;
} }
zVal = pSprite->z; zVal = pSprite->pos.Z;
nMov = AngleChase(pActor, pEnemySprite, 1200, SnakeList[nSnake].nAngle, 32); nMov = AngleChase(pActor, pEnemySprite, 1200, SnakeList[nSnake].nAngle, 32);
zVal = pSprite->z - zVal; zVal = pSprite->pos.Z - zVal;
} }
if (nMov.type || nMov.exbits) if (nMov.type || nMov.exbits)
@ -383,7 +383,7 @@ void AISnake::Tick(RunListEvent* ev)
int x = pSprite->pos.X; int x = pSprite->pos.X;
int y = pSprite->pos.Y; int y = pSprite->pos.Y;
int z = pSprite->z; int z = pSprite->pos.Z;
for (int i = 7; i > 0; i--) for (int i = 7; i > 0; i--)
{ {
@ -394,7 +394,7 @@ void AISnake::Tick(RunListEvent* ev)
pSprite2->ang = nAngle; pSprite2->ang = nAngle;
pSprite2->pos.X = x; pSprite2->pos.X = x;
pSprite2->pos.Y = y; pSprite2->pos.Y = y;
pSprite2->z = z; pSprite2->pos.Z = z;
ChangeActorSect(pActor2, pSector); ChangeActorSect(pActor2, pSector);

View file

@ -565,7 +565,7 @@ void PlayFX2(int nSound, DExhumedActor* pActor, int sectf, EChanFlags chanflags,
hiprio = (sprflags & 0x4000) != 0; hiprio = (sprflags & 0x4000) != 0;
soundx = pActor->spr.pos.X; soundx = pActor->spr.pos.X;
soundy = pActor->spr.pos.Y; soundy = pActor->spr.pos.Y;
soundz = pActor->spr.z; soundz = pActor->spr.pos.Z;
} }
int nVolume = 255; int nVolume = 255;
@ -730,7 +730,7 @@ void UpdateCreepySounds()
if (totalmoves & 2) if (totalmoves & 2)
vax = -vax; vax = -vax;
vec3_t sp = { pSprite->pos.X + vdx, pSprite->pos.Y + vax, pSprite->z }; vec3_t sp = { pSprite->pos.X + vdx, pSprite->pos.Y + vax, pSprite->pos.Z };
creepy = GetSoundPos(&sp); creepy = GetSoundPos(&sp);
if ((vsi & 0x1ff) >= kMaxSounds || !soundEngine->isValidSoundId((vsi & 0x1ff) + 1)) if ((vsi & 0x1ff) >= kMaxSounds || !soundEngine->isValidSoundId((vsi & 0x1ff) + 1))

Some files were not shown because too many files have changed in this diff Show more