- floatified the remaining parts of draw.cpp

This commit is contained in:
Christoph Oelckers 2022-09-08 16:30:43 +02:00
parent 4f6aea576b
commit 05af0c81d5
2 changed files with 25 additions and 25 deletions

View file

@ -316,7 +316,7 @@ void DoShadows(tspriteArray& tsprites, tspritetype* tsp, double viewz)
view_dist = 0; view_dist = 0;
// make shadow smaller depending on height from ground // make shadow smaller depending on height from ground
ground_dist = abs(iloz - GetSpriteZOfBottom(tsp)) >> 12; ground_dist = int(abs(loz - GetSpriteZOfBottom(tsp)) * (1./16));
xrepeat = max(xrepeat - ground_dist - view_dist, 4); xrepeat = max(xrepeat - ground_dist - view_dist, 4);
yrepeat = max(yrepeat - ground_dist - view_dist, 4); yrepeat = max(yrepeat - ground_dist - view_dist, 4);
@ -513,15 +513,15 @@ DSWActor* CopySprite(sprt const* tsp, sectortype* newsector)
DSWActor* ConnectCopySprite(spritetypebase const* tsp) DSWActor* ConnectCopySprite(spritetypebase const* tsp)
{ {
sectortype* newsector; sectortype* newsector;
int testz; double testz;
if (FAF_ConnectCeiling(tsp->sectp)) if (FAF_ConnectCeiling(tsp->sectp))
{ {
newsector = tsp->sectp; newsector = tsp->sectp;
testz = GetSpriteZOfTop(tsp) - Z(10); testz = GetSpriteZOfTop(tsp) - 10;
if (testz < tsp->sectp->int_ceilingz()) if (testz < tsp->sectp->ceilingz)
updatesectorz(tsp->int_pos().X, tsp->int_pos().Y, testz, &newsector); updatesectorz(DVector3(tsp->pos, testz), &newsector);
if (newsector != nullptr && newsector != tsp->sectp) if (newsector != nullptr && newsector != tsp->sectp)
{ {
@ -532,10 +532,10 @@ DSWActor* ConnectCopySprite(spritetypebase const* tsp)
if (FAF_ConnectFloor(tsp->sectp)) if (FAF_ConnectFloor(tsp->sectp))
{ {
newsector = tsp->sectp; newsector = tsp->sectp;
testz = GetSpriteZOfBottom(tsp) + Z(10); testz = GetSpriteZOfBottom(tsp) + 10;
if (testz > tsp->sectp->int_floorz()) if (testz > tsp->sectp->floorz)
updatesectorz(tsp->int_pos().X, tsp->int_pos().Y, testz, &newsector); updatesectorz(DVector3(tsp->pos, testz), &newsector);
if (newsector != nullptr && newsector != tsp->sectp) if (newsector != nullptr && newsector != tsp->sectp)
{ {
@ -641,7 +641,7 @@ static void analyzesprites(tspriteArray& tsprites, const DVector3& viewpos, doub
{ {
tsp->picnum = DART_PIC; tsp->picnum = DART_PIC;
tsp->set_int_ang(NORM_ANGLE(tsp->int_ang() - 512 - 24)); tsp->angle -= DAngle90 + DAngle::fromBuild(24);
tsp->xrepeat = tsp->yrepeat = DART_REPEAT; tsp->xrepeat = tsp->yrepeat = DART_REPEAT;
tsp->cstat |= (CSTAT_SPRITE_ALIGNMENT_WALL); tsp->cstat |= (CSTAT_SPRITE_ALIGNMENT_WALL);
} }
@ -705,7 +705,7 @@ static void analyzesprites(tspriteArray& tsprites, const DVector3& viewpos, doub
if (tsp->statnum == STAT_STAR_QUEUE) if (tsp->statnum == STAT_STAR_QUEUE)
{ {
tsp->picnum = DART_PIC; tsp->picnum = DART_PIC;
tsp->set_int_ang(NORM_ANGLE(tsp->int_ang() - 512)); tsp->angle -= DAngle90;
tsp->xrepeat = tsp->yrepeat = DART_REPEAT; tsp->xrepeat = tsp->yrepeat = DART_REPEAT;
tsp->cstat |= (CSTAT_SPRITE_ALIGNMENT_WALL); tsp->cstat |= (CSTAT_SPRITE_ALIGNMENT_WALL);
} }
@ -929,10 +929,10 @@ void PrintSpriteInfo(PLAYER* pp)
} }
{ {
Printf("POSX:%d, ", actor->int_pos().X); Printf("POSX:%2.3f, ", actor->spr.pos.X);
Printf("POSY:%d, ", actor->int_pos().Y); Printf("POSY:%2.3f, ", actor->spr.pos.Y);
Printf("POSZ:%d,", actor->int_pos().Z); Printf("POSZ:%2.3f,", actor->spr.pos.Z);
Printf("ANG:%d\n", actor->int_ang()); Printf("ANG:%2.0f\n", actor->spr.angle.Degrees());
} }
} }
} }
@ -1318,7 +1318,7 @@ bool GameInterface::DrawAutomapPlayer(const DVector2& mxy, const DVector2& cpos,
if (p == screenpeek) if (p == screenpeek)
{ {
auto actor = Player[p].actor; auto actor = Player[p].actor;
if (actor->int_xvel() > 16) pspr_ndx[myconnectindex] = ((PlayClock >> 4) & 3); if (actor->vel.X > 1) pspr_ndx[myconnectindex] = ((PlayClock >> 4) & 3);
sprisplayer = true; sprisplayer = true;
if (czoom > 0.1875) if (czoom > 0.1875)

View file

@ -227,25 +227,25 @@ inline void DISTANCE(const DVector2& p1, const DVector2& p2, int& dist, int& tx,
dist = tx + ty - (tmin >> 1); dist = tx + ty - (tmin >> 1);
} }
inline int GetSpriteSizeZ(const spritetypebase* sp) inline double GetSpriteSizeZ(const spritetypebase* sp)
{ {
return (tileHeight(sp->picnum) * sp->yrepeat) << 2; return (tileHeight(sp->picnum) * sp->yrepeat) * REPEAT_SCALE;
} }
// actual Z for TOS and BOS - handles both WYSIWYG and old style // actual Z for TOS and BOS - handles both WYSIWYG and old style
inline int GetSpriteZOfTop(const spritetypebase* sp) inline double GetSpriteZOfTop(const spritetypebase* sp)
{ {
return (sp->cstat & CSTAT_SPRITE_YCENTER) ? return (sp->cstat & CSTAT_SPRITE_YCENTER) ?
sp->int_pos().Z - ((GetSpriteSizeZ(sp) >> 1) + (tileTopOffset(sp->picnum) << 8)) : sp->pos.Z - ((GetSpriteSizeZ(sp) * 0.5) + tileTopOffset(sp->picnum)) :
sp->int_pos().Z - GetSpriteSizeZ(sp); sp->pos.Z - GetSpriteSizeZ(sp);
} }
inline int GetSpriteZOfBottom(const spritetypebase* sp) inline double GetSpriteZOfBottom(const spritetypebase* sp)
{ {
return (sp->cstat & CSTAT_SPRITE_YCENTER) ? return (sp->cstat & CSTAT_SPRITE_YCENTER) ?
sp->int_pos().Z + ((GetSpriteSizeZ(sp) >> 1) - (tileTopOffset(sp->picnum) << 8)) : sp->pos.Z + ((GetSpriteSizeZ(sp) * 0.5) - tileTopOffset(sp->picnum)) :
sp->int_pos().Z; sp->pos.Z;
} }
// mid and upper/lower sprite calculations // mid and upper/lower sprite calculations
@ -2054,7 +2054,7 @@ inline void SET_SP_TAG13(DSWActor* actor, int val) { actor->spr.xoffset = uint8_
// actual Z for TOS and BOS - handles both WYSIWYG and old style // actual Z for TOS and BOS - handles both WYSIWYG and old style
inline double ActorZOfTop(DSWActor* actor) inline double ActorZOfTop(DSWActor* actor)
{ {
return GetSpriteZOfTop(&actor->spr) * zinttoworld; return GetSpriteZOfTop(&actor->spr);
} }
inline DVector3 ActorVectOfTop(DSWActor* actor) inline DVector3 ActorVectOfTop(DSWActor* actor)
@ -2064,7 +2064,7 @@ inline DVector3 ActorVectOfTop(DSWActor* actor)
inline double ActorZOfBottom(DSWActor* actor) inline double ActorZOfBottom(DSWActor* actor)
{ {
return GetSpriteZOfBottom(&actor->spr) * zinttoworld; return GetSpriteZOfBottom(&actor->spr);
} }
inline double ActorZOfMiddle(DSWActor* actor) inline double ActorZOfMiddle(DSWActor* actor)