mirror of
https://github.com/ZDoom/Raze.git
synced 2025-01-22 00:11:56 +00:00
- Consolidate Exhumed's nCamerapos
and SW's DSWPlayer::si
into something inside DCorePlayer
.
This commit is contained in:
parent
7921eedda2
commit
bd3184cf49
7 changed files with 12 additions and 12 deletions
|
@ -15,6 +15,7 @@ protected:
|
||||||
CameraAngles = PrevLerpAngles = PrevViewAngles = ViewAngles = {};
|
CameraAngles = PrevLerpAngles = PrevViewAngles = ViewAngles = {};
|
||||||
PrevStrafeVel = StrafeVel = 0;
|
PrevStrafeVel = StrafeVel = 0;
|
||||||
YawSpin = nullAngle;
|
YawSpin = nullAngle;
|
||||||
|
CameraPos = {};
|
||||||
memset(&lastcmd, 0, sizeof(lastcmd));
|
memset(&lastcmd, 0, sizeof(lastcmd));
|
||||||
memset(&cmd, 0, sizeof(cmd));
|
memset(&cmd, 0, sizeof(cmd));
|
||||||
actor = nullptr;
|
actor = nullptr;
|
||||||
|
@ -26,6 +27,7 @@ public:
|
||||||
DRotator PrevViewAngles, ViewAngles;
|
DRotator PrevViewAngles, ViewAngles;
|
||||||
double PrevStrafeVel, StrafeVel;
|
double PrevStrafeVel, StrafeVel;
|
||||||
DAngle YawSpin;
|
DAngle YawSpin;
|
||||||
|
DVector3 CameraPos;
|
||||||
ticcmd_t lastcmd, cmd;
|
ticcmd_t lastcmd, cmd;
|
||||||
DCoreActor* actor;
|
DCoreActor* actor;
|
||||||
uint8_t pnum;
|
uint8_t pnum;
|
||||||
|
|
|
@ -409,7 +409,7 @@ void seq_PlotArrowSequence(const int nSprite, const FName seqFile, const int16_t
|
||||||
{
|
{
|
||||||
tspritetype* pTSprite = mytspriteArray->get(nSprite);
|
tspritetype* pTSprite = mytspriteArray->get(nSprite);
|
||||||
|
|
||||||
const DAngle nAngle = (nCamerapos.XY() - pTSprite->pos.XY()).Angle();
|
const DAngle nAngle = (getPlayer(nLocalPlayer)->CameraPos.XY() - pTSprite->pos.XY()).Angle();
|
||||||
const int seqOffset = (((pTSprite->Angles.Yaw + DAngle90 + DAngle22_5 - nAngle).Buildang()) & kAngleMask) >> 8;
|
const int seqOffset = (((pTSprite->Angles.Yaw + DAngle90 + DAngle22_5 - nAngle).Buildang()) & kAngleMask) >> 8;
|
||||||
|
|
||||||
const auto& seqFrame = getSequence(seqFile, seqIndex + seqOffset)->frames[frameIndex];
|
const auto& seqFrame = getSequence(seqFile, seqIndex + seqOffset)->frames[frameIndex];
|
||||||
|
@ -453,12 +453,13 @@ void seq_PlotArrowSequence(const int nSprite, const FName seqFile, const int16_t
|
||||||
void seq_PlotSequence(const int nSprite, const FName seqFile, const int16_t seqIndex, const int16_t frameIndex, const int16_t nFlags)
|
void seq_PlotSequence(const int nSprite, const FName seqFile, const int16_t seqIndex, const int16_t frameIndex, const int16_t nFlags)
|
||||||
{
|
{
|
||||||
tspritetype* pTSprite = mytspriteArray->get(nSprite);
|
tspritetype* pTSprite = mytspriteArray->get(nSprite);
|
||||||
|
const auto pPlayer = getPlayer(nLocalPlayer);
|
||||||
|
|
||||||
int seqOffset = 0;
|
int seqOffset = 0;
|
||||||
|
|
||||||
if (!(nFlags & 1))
|
if (!(nFlags & 1))
|
||||||
{
|
{
|
||||||
const DAngle nAngle = (nCamerapos.XY() - pTSprite->pos.XY()).Angle();
|
const DAngle nAngle = (pPlayer->CameraPos.XY() - pTSprite->pos.XY()).Angle();
|
||||||
seqOffset = (((pTSprite->Angles.Yaw + DAngle22_5 - nAngle).Buildang()) & kAngleMask) >> 8;
|
seqOffset = (((pTSprite->Angles.Yaw + DAngle22_5 - nAngle).Buildang()) & kAngleMask) >> 8;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -508,7 +509,7 @@ void seq_PlotSequence(const int nSprite, const FName seqFile, const int16_t seqI
|
||||||
const auto pSector = pTSprite->sectp;
|
const auto pSector = pTSprite->sectp;
|
||||||
const double nFloorZ = pSector->floorz;
|
const double nFloorZ = pSector->floorz;
|
||||||
|
|
||||||
if (nFloorZ <= getPlayer(nLocalPlayer)->GetActor()->getOffsetZ())
|
if (nFloorZ <= pPlayer->GetActor()->getOffsetZ())
|
||||||
{
|
{
|
||||||
pTSprite->ownerActor = nullptr;
|
pTSprite->ownerActor = nullptr;
|
||||||
}
|
}
|
||||||
|
|
|
@ -34,7 +34,6 @@ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
|
||||||
BEGIN_PS_NS
|
BEGIN_PS_NS
|
||||||
|
|
||||||
bool bSubTitles = true;
|
bool bSubTitles = true;
|
||||||
DVector3 nCamerapos;
|
|
||||||
bool bTouchFloor;
|
bool bTouchFloor;
|
||||||
int nChunkTotal = 0;
|
int nChunkTotal = 0;
|
||||||
int nViewTop;
|
int nViewTop;
|
||||||
|
@ -77,6 +76,7 @@ void DrawView(double interpfrac, bool sceneonly)
|
||||||
auto nPlayerOldCstat = pPlayerActor->spr.cstat;
|
auto nPlayerOldCstat = pPlayerActor->spr.cstat;
|
||||||
auto pDop = pPlayer->pDoppleSprite;
|
auto pDop = pPlayer->pDoppleSprite;
|
||||||
auto nDoppleOldCstat = pDop->spr.cstat;
|
auto nDoppleOldCstat = pDop->spr.cstat;
|
||||||
|
DVector3 nCamerapos;
|
||||||
|
|
||||||
// update render angles.
|
// update render angles.
|
||||||
pPlayer->updateCameraAngles(interpfrac);
|
pPlayer->updateCameraAngles(interpfrac);
|
||||||
|
@ -125,6 +125,7 @@ void DrawView(double interpfrac, bool sceneonly)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
pPlayer->CameraPos = nCamerapos;
|
||||||
const auto ampos = nCamerapos.XY();
|
const auto ampos = nCamerapos.XY();
|
||||||
|
|
||||||
if (nSnakeCam >= 0 && !sceneonly)
|
if (nSnakeCam >= 0 && !sceneonly)
|
||||||
|
@ -339,8 +340,7 @@ void SerializeView(FSerializer& arc)
|
||||||
{
|
{
|
||||||
if (arc.BeginObject("view"))
|
if (arc.BeginObject("view"))
|
||||||
{
|
{
|
||||||
arc("camerapos", nCamerapos)
|
arc("chunktotal", nChunkTotal)
|
||||||
("chunktotal", nChunkTotal)
|
|
||||||
("camera", bCamera)
|
("camera", bCamera)
|
||||||
.EndObject();
|
.EndObject();
|
||||||
}
|
}
|
||||||
|
|
|
@ -28,7 +28,6 @@ void DrawStatusBar();
|
||||||
void DrawView(double interpfrac, bool sceneonly = false);
|
void DrawView(double interpfrac, bool sceneonly = false);
|
||||||
void ResetView();
|
void ResetView();
|
||||||
|
|
||||||
extern DVector3 nCamerapos;
|
|
||||||
extern int nChunkTotal;
|
extern int nChunkTotal;
|
||||||
|
|
||||||
extern tspriteArray* mytspriteArray;
|
extern tspriteArray* mytspriteArray;
|
||||||
|
|
|
@ -329,7 +329,7 @@ void DoShadows(tspriteArray& tsprites, tspritetype* tsp, double viewz)
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
// Alter the shadow's position so that it appears behind the sprite itself.
|
// Alter the shadow's position so that it appears behind the sprite itself.
|
||||||
auto look = (tSpr->pos.XY() - getPlayer(screenpeek)->si.XY()).Angle();
|
auto look = (tSpr->pos.XY() - getPlayer(screenpeek)->CameraPos.XY()).Angle();
|
||||||
tSpr->pos.XY() += look.ToVector() * 2;
|
tSpr->pos.XY() += look.ToVector() * 2;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -749,7 +749,7 @@ static void analyzesprites(tspriteArray& tsprites, const DVector3& viewpos, doub
|
||||||
if (pp->Flags & (PF_VIEW_FROM_OUTSIDE))
|
if (pp->Flags & (PF_VIEW_FROM_OUTSIDE))
|
||||||
tsp->cstat |= (CSTAT_SPRITE_TRANSLUCENT);
|
tsp->cstat |= (CSTAT_SPRITE_TRANSLUCENT);
|
||||||
|
|
||||||
auto pos = pp->si.plusZ(tsp->pos.Z);
|
auto pos = pp->CameraPos.plusZ(tsp->pos.Z);
|
||||||
|
|
||||||
if (pp->Flags & (PF_CLIMBING))
|
if (pp->Flags & (PF_CLIMBING))
|
||||||
{
|
{
|
||||||
|
@ -1218,7 +1218,7 @@ void drawscreen(DSWPlayer* pp, double interpfrac, bool sceneonly)
|
||||||
updatesectorz(tpos, &tsect);
|
updatesectorz(tpos, &tsect);
|
||||||
}
|
}
|
||||||
|
|
||||||
pp->si = tpos.plusZ(-pp->GetActor()->getOffsetZ());
|
pp->CameraPos = tpos.plusZ(-pp->GetActor()->getOffsetZ());
|
||||||
|
|
||||||
QuakeViewChange(camerapp, tpos, tangles.Yaw);
|
QuakeViewChange(camerapp, tpos, tangles.Yaw);
|
||||||
int vis = g_visibility;
|
int vis = g_visibility;
|
||||||
|
|
|
@ -1718,7 +1718,6 @@ public:
|
||||||
sectortype* hi_sectp, *lo_sectp;
|
sectortype* hi_sectp, *lo_sectp;
|
||||||
|
|
||||||
double circle_camera_dist;
|
double circle_camera_dist;
|
||||||
DVector3 si; // save player interp position for PlayerSprite
|
|
||||||
|
|
||||||
DVector2 vect, ovect, slide_vect; // these need floatification, but must be done together. vect is in 14.18 format!
|
DVector2 vect, ovect, slide_vect; // these need floatification, but must be done together. vect is in 14.18 format!
|
||||||
|
|
||||||
|
|
|
@ -335,7 +335,6 @@ void DSWPlayer::Serialize(FSerializer& arc)
|
||||||
("lo_sp", lowActor)
|
("lo_sp", lowActor)
|
||||||
("last_camera_sp", last_camera_act)
|
("last_camera_sp", last_camera_act)
|
||||||
("circle_camera_dist", circle_camera_dist)
|
("circle_camera_dist", circle_camera_dist)
|
||||||
("si", si)
|
|
||||||
("vect", vect)
|
("vect", vect)
|
||||||
("friction", friction)
|
("friction", friction)
|
||||||
("slide_vect", slide_vect)
|
("slide_vect", slide_vect)
|
||||||
|
|
Loading…
Reference in a new issue