2019-11-20 16:21:32 +00:00
|
|
|
//-------------------------------------------------------------------------
|
|
|
|
/*
|
|
|
|
Copyright (C) 2010-2019 EDuke32 developers and contributors
|
|
|
|
Copyright (C) 2019 sirlemonhead, Nuke.YKT
|
|
|
|
This file is part of PCExhumed.
|
|
|
|
PCExhumed is free software; you can redistribute it and/or
|
|
|
|
modify it under the terms of the GNU General Public License version 2
|
|
|
|
as published by the Free Software Foundation.
|
|
|
|
This program is distributed in the hope that it will be useful,
|
|
|
|
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
|
|
|
|
See the GNU General Public License for more details.
|
|
|
|
You should have received a copy of the GNU General Public License
|
|
|
|
along with this program; if not, write to the Free Software
|
|
|
|
Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
|
|
|
|
*/
|
|
|
|
//-------------------------------------------------------------------------
|
2019-11-22 23:11:37 +00:00
|
|
|
#include "ns.h"
|
2019-08-26 03:59:14 +00:00
|
|
|
#include "engine.h"
|
2021-02-18 11:14:32 +00:00
|
|
|
#include "gamefuncs.h"
|
2019-08-26 03:59:14 +00:00
|
|
|
#include "names.h"
|
|
|
|
#include "view.h"
|
|
|
|
#include "status.h"
|
|
|
|
#include "exhumed.h"
|
|
|
|
#include "player.h"
|
2020-08-18 07:52:08 +00:00
|
|
|
#include "aistuff.h"
|
2019-08-26 03:59:14 +00:00
|
|
|
#include "sound.h"
|
2020-08-23 14:24:54 +00:00
|
|
|
#include "mapinfo.h"
|
2020-01-12 19:28:07 +00:00
|
|
|
#include "v_video.h"
|
2020-11-26 17:29:20 +00:00
|
|
|
#include "interpolate.h"
|
2020-10-13 19:38:24 +00:00
|
|
|
#include "v_draw.h"
|
2021-03-21 10:48:18 +00:00
|
|
|
#include "render.h"
|
2019-08-26 03:59:14 +00:00
|
|
|
#include <string.h>
|
|
|
|
|
2019-11-22 23:11:37 +00:00
|
|
|
BEGIN_PS_NS
|
|
|
|
|
2021-11-21 19:34:15 +00:00
|
|
|
bool bSubTitles = true;
|
2019-08-26 03:59:14 +00:00
|
|
|
|
2021-11-21 20:09:27 +00:00
|
|
|
int16_t dVertPan[kMaxPlayers];
|
2022-09-07 00:14:46 +00:00
|
|
|
DVector3 nCamerapos;
|
2021-11-21 20:09:27 +00:00
|
|
|
bool bTouchFloor;
|
2019-08-26 03:59:14 +00:00
|
|
|
|
2022-09-07 07:58:41 +00:00
|
|
|
double nQuake[kMaxPlayers] = { 0 };
|
2019-08-26 03:59:14 +00:00
|
|
|
|
2021-11-21 20:09:27 +00:00
|
|
|
int nChunkTotal = 0;
|
2019-08-26 03:59:14 +00:00
|
|
|
|
2021-11-21 20:09:27 +00:00
|
|
|
int nViewTop;
|
2020-09-27 05:46:04 +00:00
|
|
|
bool bCamera = false;
|
2019-08-26 03:59:14 +00:00
|
|
|
|
|
|
|
|
|
|
|
|
2021-04-02 08:28:40 +00:00
|
|
|
// We cannot drag these through the entire event system... :(
|
2022-08-07 08:25:15 +00:00
|
|
|
tspriteArray* mytspriteArray;
|
2021-04-02 08:28:40 +00:00
|
|
|
|
2022-09-11 06:09:26 +00:00
|
|
|
//---------------------------------------------------------------------------
|
|
|
|
//
|
|
|
|
//
|
|
|
|
//
|
|
|
|
//---------------------------------------------------------------------------
|
|
|
|
|
2022-09-10 14:57:21 +00:00
|
|
|
static void analyzesprites(tspriteArray& tsprites, const DVector3& view, double const interpfrac)
|
2019-08-26 03:59:14 +00:00
|
|
|
{
|
2022-08-07 08:25:15 +00:00
|
|
|
mytspriteArray = &tsprites;
|
2020-11-26 08:15:49 +00:00
|
|
|
|
2022-08-07 08:25:15 +00:00
|
|
|
for (unsigned i = 0; i < tsprites.Size(); i++)
|
|
|
|
{
|
|
|
|
auto pTSprite = tsprites.get(i);
|
2020-11-26 08:15:49 +00:00
|
|
|
|
2021-12-04 18:08:50 +00:00
|
|
|
if (pTSprite->ownerActor)
|
2020-11-26 08:15:49 +00:00
|
|
|
{
|
|
|
|
// interpolate sprite position
|
2022-09-07 07:02:14 +00:00
|
|
|
pTSprite->pos = pTSprite->ownerActor->interpolatedpos(interpfrac);
|
2022-11-25 10:21:14 +00:00
|
|
|
pTSprite->Angles.Yaw = pTSprite->ownerActor->interpolatedyaw(interpfrac);
|
2020-11-26 08:15:49 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2021-12-26 07:47:54 +00:00
|
|
|
auto pPlayerActor = PlayerList[nLocalPlayer].pActor;
|
2019-08-26 03:59:14 +00:00
|
|
|
|
2022-09-10 14:57:21 +00:00
|
|
|
double bestclose = 20;
|
|
|
|
double bestside = 30000;
|
2019-08-26 03:59:14 +00:00
|
|
|
|
2019-10-11 12:49:39 +00:00
|
|
|
|
2021-10-21 20:18:29 +00:00
|
|
|
bestTarget = nullptr;
|
2019-08-26 03:59:14 +00:00
|
|
|
|
2021-12-30 15:51:56 +00:00
|
|
|
auto pSector =pPlayerActor->sector();
|
2019-08-26 03:59:14 +00:00
|
|
|
|
2022-11-25 12:13:50 +00:00
|
|
|
DAngle nAngle = -pPlayerActor->spr.Angles.Yaw;
|
2019-08-26 03:59:14 +00:00
|
|
|
|
2022-08-07 08:25:15 +00:00
|
|
|
for (int nTSprite = int(tsprites.Size()-1); nTSprite >= 0; nTSprite--)
|
2019-08-31 07:47:15 +00:00
|
|
|
{
|
2022-08-07 08:25:15 +00:00
|
|
|
auto pTSprite = tsprites.get(nTSprite);
|
2021-12-04 18:08:50 +00:00
|
|
|
auto pActor = static_cast<DExhumedActor*>(pTSprite->ownerActor);
|
2019-08-31 07:47:15 +00:00
|
|
|
|
2021-12-30 15:58:48 +00:00
|
|
|
if (pTSprite->sectp != nullptr)
|
2019-10-11 12:49:39 +00:00
|
|
|
{
|
2021-12-30 15:58:48 +00:00
|
|
|
sectortype *pTSector = pTSprite->sectp;
|
2021-12-24 09:48:35 +00:00
|
|
|
int nSectShade = (pTSector->ceilingstat & CSTAT_SECTOR_SKY) ? pTSector->ceilingshade : pTSector->floorshade;
|
2019-10-11 12:49:39 +00:00
|
|
|
int nShade = pTSprite->shade + nSectShade + 6;
|
|
|
|
pTSprite->shade = clamp(nShade, -128, 127);
|
2019-08-31 07:47:15 +00:00
|
|
|
}
|
2019-10-11 12:49:39 +00:00
|
|
|
|
2019-10-27 13:53:20 +00:00
|
|
|
pTSprite->pal = RemapPLU(pTSprite->pal);
|
|
|
|
|
2020-12-06 16:04:24 +00:00
|
|
|
// PowerSlaveGDX: Torch bouncing fix
|
2021-12-18 17:40:25 +00:00
|
|
|
if ((pTSprite->picnum == kTorch1 || pTSprite->picnum == kTorch2) && (pTSprite->cstat & CSTAT_SPRITE_YCENTER) == 0)
|
2020-12-06 16:04:24 +00:00
|
|
|
{
|
2021-12-18 17:40:25 +00:00
|
|
|
pTSprite->cstat |= CSTAT_SPRITE_YCENTER;
|
2022-12-09 13:24:36 +00:00
|
|
|
auto tex = TexMan.GetGameTexture(pTSprite->spritetexture());
|
|
|
|
double nTileY = (tex->GetDisplayHeight() * pTSprite->scale.Y) * 0.5;
|
2022-08-20 14:47:27 +00:00
|
|
|
pTSprite->pos.Z -= nTileY;
|
2020-12-06 16:04:24 +00:00
|
|
|
}
|
|
|
|
|
2023-01-28 10:44:05 +00:00
|
|
|
if (pTSprite->pal == 4 && pTSprite->shade >= numshades && !hw_int_useindexedcolortextures) pTSprite->shade = numshades - 1;
|
2021-12-27 09:29:09 +00:00
|
|
|
|
2021-12-23 16:05:32 +00:00
|
|
|
if (pActor->spr.statnum > 0)
|
2019-08-31 07:47:15 +00:00
|
|
|
{
|
2021-10-28 16:57:50 +00:00
|
|
|
RunListEvent ev{};
|
|
|
|
ev.pTSprite = pTSprite;
|
2021-12-23 16:05:32 +00:00
|
|
|
runlist_SignalRun(pActor->spr.lotag - 1, nTSprite, &ExhumedAI::Draw, &ev);
|
2019-08-31 07:47:15 +00:00
|
|
|
|
2021-12-23 16:05:32 +00:00
|
|
|
if ((pActor->spr.statnum < 150) && (pActor->spr.cstat & CSTAT_SPRITE_BLOCK_ALL) && (pActor != pPlayerActor))
|
2019-08-31 07:47:15 +00:00
|
|
|
{
|
2022-09-10 14:57:21 +00:00
|
|
|
DVector2 delta = pActor->spr.pos.XY() - view.XY();
|
2019-08-31 07:47:15 +00:00
|
|
|
|
2022-09-10 14:57:21 +00:00
|
|
|
double vcos = nAngle.Cos();
|
|
|
|
double vsin = nAngle.Sin();
|
2019-08-31 07:47:15 +00:00
|
|
|
|
|
|
|
|
2022-09-10 14:57:21 +00:00
|
|
|
double fwd = ((vcos * delta.Y) + (delta.X * vsin));
|
|
|
|
double side = abs((vcos * delta.X) - (delta.Y * vsin));
|
2019-08-31 07:47:15 +00:00
|
|
|
|
2022-09-10 14:57:21 +00:00
|
|
|
if (!side)
|
2019-10-11 12:49:39 +00:00
|
|
|
continue;
|
2019-08-31 07:47:15 +00:00
|
|
|
|
2022-09-10 14:57:21 +00:00
|
|
|
double close = (abs(fwd) * 32) / side;
|
|
|
|
if (side < 1000 / 16. && side < bestside && close < 10)
|
2019-10-11 12:49:39 +00:00
|
|
|
{
|
2021-10-21 20:18:29 +00:00
|
|
|
bestTarget = pActor;
|
2022-09-10 14:57:21 +00:00
|
|
|
bestclose = close;
|
|
|
|
bestside = side;
|
2019-10-11 12:49:39 +00:00
|
|
|
}
|
2022-09-10 14:57:21 +00:00
|
|
|
else if (side < 30000 / 16.)
|
2019-10-11 12:49:39 +00:00
|
|
|
{
|
2022-09-10 14:57:21 +00:00
|
|
|
double t = bestclose - close;
|
|
|
|
if (t > 3 || (side < bestside && abs(t) < 5))
|
2019-08-31 07:47:15 +00:00
|
|
|
{
|
2022-09-10 14:57:21 +00:00
|
|
|
bestclose = close;
|
|
|
|
bestside = side;
|
2021-10-21 20:18:29 +00:00
|
|
|
bestTarget = pActor;
|
2019-08-31 07:47:15 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
2019-10-11 12:49:39 +00:00
|
|
|
}
|
2021-12-23 18:09:43 +00:00
|
|
|
auto targ = bestTarget;
|
|
|
|
if (targ != nullptr)
|
2019-10-11 12:49:39 +00:00
|
|
|
{
|
2019-11-03 17:32:02 +00:00
|
|
|
nCreepyTimer = kCreepyCount;
|
2019-08-31 07:47:15 +00:00
|
|
|
|
2022-09-10 19:24:40 +00:00
|
|
|
if (!cansee(view, pSector, targ->spr.pos.plusZ(-GetActorHeight(targ)), targ->sector()))
|
2019-10-11 12:49:39 +00:00
|
|
|
{
|
2021-10-21 20:18:29 +00:00
|
|
|
bestTarget = nullptr;
|
2019-10-11 12:49:39 +00:00
|
|
|
}
|
2019-08-31 07:47:15 +00:00
|
|
|
}
|
2021-04-02 08:28:40 +00:00
|
|
|
|
2022-08-07 08:25:15 +00:00
|
|
|
mytspriteArray = nullptr;
|
2021-04-02 08:28:40 +00:00
|
|
|
|
2019-08-26 03:59:14 +00:00
|
|
|
}
|
|
|
|
|
2022-09-11 06:09:26 +00:00
|
|
|
//---------------------------------------------------------------------------
|
|
|
|
//
|
|
|
|
//
|
|
|
|
//
|
|
|
|
//---------------------------------------------------------------------------
|
|
|
|
|
2019-08-26 03:59:14 +00:00
|
|
|
void ResetView()
|
|
|
|
{
|
2021-11-21 19:13:19 +00:00
|
|
|
EraseScreen(0);
|
2019-10-12 22:27:12 +00:00
|
|
|
videoTintBlood(0, 0, 0);
|
2019-08-26 03:59:14 +00:00
|
|
|
}
|
|
|
|
|
2020-08-22 09:56:54 +00:00
|
|
|
static TextOverlay subtitleOverlay;
|
|
|
|
|
2022-09-11 06:09:26 +00:00
|
|
|
//---------------------------------------------------------------------------
|
|
|
|
//
|
|
|
|
//
|
|
|
|
//
|
|
|
|
//---------------------------------------------------------------------------
|
|
|
|
|
2022-09-06 13:16:13 +00:00
|
|
|
void DrawView(double interpfrac, bool sceneonly)
|
2019-08-26 03:59:14 +00:00
|
|
|
{
|
2021-12-07 17:53:02 +00:00
|
|
|
DExhumedActor* pEnemy = nullptr;
|
|
|
|
int nEnemyPal = -1;
|
2021-11-22 23:20:15 +00:00
|
|
|
sectortype* pSector = nullptr;
|
2022-12-05 05:09:43 +00:00
|
|
|
DRotator nCameraangles{};
|
2019-08-31 07:47:15 +00:00
|
|
|
|
2022-09-06 13:16:13 +00:00
|
|
|
DoInterpolations(interpfrac);
|
2020-11-26 17:29:20 +00:00
|
|
|
|
2022-12-02 03:45:37 +00:00
|
|
|
auto pPlayer = &PlayerList[nLocalPlayer];
|
|
|
|
auto pPlayerActor = pPlayer->pActor;
|
2021-12-23 18:09:43 +00:00
|
|
|
auto nPlayerOldCstat = pPlayerActor->spr.cstat;
|
2022-12-02 03:45:37 +00:00
|
|
|
auto pDop = pPlayer->pDoppleSprite;
|
2021-12-23 18:09:43 +00:00
|
|
|
auto nDoppleOldCstat = pDop->spr.cstat;
|
2019-08-31 07:47:15 +00:00
|
|
|
|
2022-12-09 06:55:13 +00:00
|
|
|
// update render angles.
|
2023-03-17 03:20:36 +00:00
|
|
|
pPlayer->Angles.updateCameraAngles(interpfrac);
|
2022-12-09 06:55:13 +00:00
|
|
|
UpdatePlayerSpriteAngle(pPlayer);
|
|
|
|
|
2020-01-14 20:48:01 +00:00
|
|
|
if (nSnakeCam >= 0 && !sceneonly)
|
2019-08-31 07:47:15 +00:00
|
|
|
{
|
2021-12-07 17:53:02 +00:00
|
|
|
DExhumedActor* pActor = SnakeList[nSnakeCam].pSprites[0];
|
2019-08-31 07:47:15 +00:00
|
|
|
|
2022-09-07 00:14:46 +00:00
|
|
|
nCamerapos = pActor->spr.pos;
|
2021-12-30 15:51:56 +00:00
|
|
|
pSector = pActor->sector();
|
2022-12-05 05:09:43 +00:00
|
|
|
nCameraangles.Yaw = pActor->spr.Angles.Yaw;
|
2019-08-31 07:47:15 +00:00
|
|
|
|
|
|
|
SetGreenPal();
|
|
|
|
|
2021-10-19 09:19:50 +00:00
|
|
|
pEnemy = SnakeList[nSnakeCam].pEnemy;
|
2019-08-31 07:47:15 +00:00
|
|
|
|
2021-10-19 09:19:50 +00:00
|
|
|
if (pEnemy == nullptr || totalmoves & 1)
|
2019-08-31 07:47:15 +00:00
|
|
|
{
|
|
|
|
nEnemyPal = -1;
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
2021-12-21 22:18:23 +00:00
|
|
|
nEnemyPal = pEnemy->spr.pal;
|
|
|
|
pEnemy->spr.pal = 5;
|
2019-08-31 07:47:15 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
2022-11-23 09:47:45 +00:00
|
|
|
nCamerapos = pPlayerActor->getRenderPos(interpfrac);
|
2021-01-10 17:15:28 +00:00
|
|
|
|
2021-11-22 23:20:15 +00:00
|
|
|
pSector = PlayerList[nLocalPlayer].pPlayerViewSect;
|
2022-09-07 00:14:46 +00:00
|
|
|
updatesector(nCamerapos, &pSector);
|
2021-11-22 23:20:15 +00:00
|
|
|
if (pSector == nullptr) pSector = PlayerList[nLocalPlayer].pPlayerViewSect;
|
2020-09-21 10:37:09 +00:00
|
|
|
|
2022-12-05 05:09:43 +00:00
|
|
|
nCameraangles = PlayerList[nLocalPlayer].Angles.getRenderAngles(interpfrac);
|
2019-11-03 17:20:05 +00:00
|
|
|
|
2019-11-12 12:25:16 +00:00
|
|
|
if (!bCamera)
|
|
|
|
{
|
2021-12-23 18:09:43 +00:00
|
|
|
pPlayerActor->spr.cstat |= CSTAT_SPRITE_INVISIBLE;
|
|
|
|
pDop->spr.cstat |= CSTAT_SPRITE_INVISIBLE;
|
2019-11-12 12:25:16 +00:00
|
|
|
}
|
2021-02-18 11:14:32 +00:00
|
|
|
else
|
|
|
|
{
|
2021-12-23 18:09:43 +00:00
|
|
|
pPlayerActor->spr.cstat |= CSTAT_SPRITE_TRANSLUCENT;
|
|
|
|
pDop->spr.cstat |= CSTAT_SPRITE_INVISIBLE;
|
2021-02-18 11:14:32 +00:00
|
|
|
}
|
2019-08-31 07:47:15 +00:00
|
|
|
}
|
|
|
|
|
2023-03-17 03:11:27 +00:00
|
|
|
const auto ampos = nCamerapos.XY();
|
|
|
|
|
2021-02-18 11:14:32 +00:00
|
|
|
if (nSnakeCam >= 0 && !sceneonly)
|
2019-08-31 07:47:15 +00:00
|
|
|
{
|
2022-12-05 05:09:43 +00:00
|
|
|
nCameraangles.Pitch = nullAngle;
|
2019-08-31 07:47:15 +00:00
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
2022-09-07 07:58:41 +00:00
|
|
|
nCamerapos.Z = min(nCamerapos.Z + nQuake[nLocalPlayer], pPlayerActor->sector()->floorz);
|
2022-12-05 05:09:43 +00:00
|
|
|
nCameraangles.Yaw += DAngle::fromDeg(fmod(nQuake[nLocalPlayer], 16.) * (45. / 128.));
|
2019-08-31 07:47:15 +00:00
|
|
|
|
2021-02-18 11:14:32 +00:00
|
|
|
if (bCamera)
|
|
|
|
{
|
2022-09-07 00:14:46 +00:00
|
|
|
nCamerapos.Z -= 10;
|
2022-12-05 05:09:43 +00:00
|
|
|
if (!calcChaseCamPos(nCamerapos, pPlayerActor, &pSector, nCameraangles, interpfrac, 96.))
|
2021-02-18 11:14:32 +00:00
|
|
|
{
|
2022-09-07 00:14:46 +00:00
|
|
|
nCamerapos.Z += 10;
|
2022-12-05 05:09:43 +00:00
|
|
|
calcChaseCamPos(nCamerapos, pPlayerActor, &pSector, nCameraangles, interpfrac, 96.);
|
2021-02-18 11:14:32 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
2019-08-31 07:47:15 +00:00
|
|
|
|
2021-11-22 23:20:15 +00:00
|
|
|
if (pSector != nullptr)
|
2019-08-31 07:47:15 +00:00
|
|
|
{
|
2022-09-07 00:14:46 +00:00
|
|
|
nCamerapos.Z = min(max(nCamerapos.Z, pSector->ceilingz + 1), pSector->floorz - 1);
|
2019-08-31 07:47:15 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
if (nFreeze == 2 || nFreeze == 1)
|
|
|
|
{
|
|
|
|
nSnakeCam = -1;
|
2022-08-04 21:47:01 +00:00
|
|
|
viewport3d = { 0, 0, screen->GetWidth(), screen->GetHeight() };
|
2019-08-31 07:47:15 +00:00
|
|
|
}
|
|
|
|
|
2019-11-18 20:31:08 +00:00
|
|
|
UpdateMap();
|
|
|
|
|
2019-08-31 07:47:15 +00:00
|
|
|
if (nFreeze != 3)
|
|
|
|
{
|
2021-12-21 08:54:21 +00:00
|
|
|
TArray<uint8_t> paldata(sector.Size() * 2 + wall.Size(), true);
|
2019-10-11 12:14:30 +00:00
|
|
|
|
2019-10-27 13:53:20 +00:00
|
|
|
if (HavePLURemap())
|
|
|
|
{
|
2021-11-22 20:17:43 +00:00
|
|
|
auto p = paldata.Data();
|
2021-12-21 08:23:39 +00:00
|
|
|
for (auto& sect: sector)
|
2019-10-27 13:53:20 +00:00
|
|
|
{
|
2021-11-22 20:17:43 +00:00
|
|
|
uint8_t v;
|
|
|
|
v = *p++ = sect.floorpal;
|
|
|
|
sect.floorpal = RemapPLU(v);
|
|
|
|
v = *p++ = sect.ceilingpal;
|
|
|
|
sect.ceilingpal = RemapPLU(v);
|
2019-10-27 13:53:20 +00:00
|
|
|
}
|
2021-12-21 08:23:39 +00:00
|
|
|
for (auto& wal : wall)
|
2019-10-27 13:53:20 +00:00
|
|
|
{
|
2021-11-22 20:17:43 +00:00
|
|
|
uint8_t v;
|
|
|
|
v = *p++ = wal.pal;
|
|
|
|
wal.pal = RemapPLU(v);
|
2019-10-27 13:53:20 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2022-08-03 13:50:27 +00:00
|
|
|
if (!nFreeze && !sceneonly)
|
2022-09-07 05:34:55 +00:00
|
|
|
DrawWeapons(interpfrac);
|
2022-12-05 05:09:43 +00:00
|
|
|
render_drawrooms(nullptr, nCamerapos, pSector, nCameraangles, interpfrac);
|
2019-08-31 07:47:15 +00:00
|
|
|
|
2019-10-27 13:53:20 +00:00
|
|
|
if (HavePLURemap())
|
|
|
|
{
|
2021-11-22 20:17:43 +00:00
|
|
|
auto p = paldata.Data();
|
2021-12-21 08:23:39 +00:00
|
|
|
for (auto& sect: sector)
|
2019-10-27 13:53:20 +00:00
|
|
|
{
|
2021-11-22 20:17:43 +00:00
|
|
|
sect.floorpal = *p++;
|
|
|
|
sect.ceilingpal = *p++;
|
2019-10-27 13:53:20 +00:00
|
|
|
}
|
2021-12-21 08:23:39 +00:00
|
|
|
for (auto& wal : wall)
|
2019-10-27 13:53:20 +00:00
|
|
|
{
|
2021-11-22 20:17:43 +00:00
|
|
|
wal.pal = *p++;
|
2019-10-27 13:53:20 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2019-08-31 07:47:15 +00:00
|
|
|
if (nFreeze)
|
|
|
|
{
|
|
|
|
nSnakeCam = -1;
|
|
|
|
|
|
|
|
if (nFreeze == 2)
|
|
|
|
{
|
|
|
|
if (nHeadStage == 4)
|
|
|
|
{
|
|
|
|
nHeadStage = 5;
|
|
|
|
|
2021-12-23 18:09:43 +00:00
|
|
|
pPlayerActor->spr.cstat |= CSTAT_SPRITE_INVISIBLE;
|
2019-08-31 07:47:15 +00:00
|
|
|
|
2022-12-05 05:09:43 +00:00
|
|
|
auto ang2 = nCameraangles.Yaw - pPlayerActor->spr.Angles.Yaw;
|
2022-09-07 07:48:05 +00:00
|
|
|
if (ang2.Degrees() < 0)
|
2019-08-31 07:47:15 +00:00
|
|
|
ang2 = -ang2;
|
2019-11-20 16:21:32 +00:00
|
|
|
|
2022-09-11 12:02:04 +00:00
|
|
|
if (ang2 > mapangle(10))
|
2019-08-31 07:47:15 +00:00
|
|
|
{
|
2022-09-07 07:48:05 +00:00
|
|
|
inita -= ang2 * (1. / 8.);
|
2019-08-31 07:47:15 +00:00
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
|
|
|
if (bSubTitles)
|
|
|
|
{
|
2020-09-06 07:10:45 +00:00
|
|
|
subtitleOverlay.Start(I_GetTimeNS() * (120. / 1'000'000'000));
|
2021-05-02 13:54:19 +00:00
|
|
|
subtitleOverlay.ReadyCinemaText(currentLevel->ex_ramses_text);
|
2019-08-31 07:47:15 +00:00
|
|
|
}
|
2020-08-26 20:22:46 +00:00
|
|
|
inputState.ClearAllInput();
|
2019-08-31 07:47:15 +00:00
|
|
|
}
|
2020-08-26 20:22:46 +00:00
|
|
|
else if (nHeadStage == 5)
|
2019-08-31 07:47:15 +00:00
|
|
|
{
|
2020-09-06 07:10:45 +00:00
|
|
|
if ((bSubTitles && !subtitleOverlay.AdvanceCinemaText(I_GetTimeNS() * (120. / 1'000'000'000))) || inputState.CheckAllInput())
|
2019-08-31 07:47:15 +00:00
|
|
|
{
|
2020-08-26 20:22:46 +00:00
|
|
|
inputState.ClearAllInput();
|
2020-09-24 18:14:25 +00:00
|
|
|
LevelFinished();
|
2020-09-04 19:59:38 +00:00
|
|
|
EndLevel = 1;
|
2019-08-31 07:47:15 +00:00
|
|
|
|
2019-11-28 20:40:17 +00:00
|
|
|
if (CDplaying()) {
|
2019-08-31 07:47:15 +00:00
|
|
|
fadecdaudio();
|
2019-11-28 20:40:17 +00:00
|
|
|
}
|
2019-08-31 07:47:15 +00:00
|
|
|
}
|
2020-08-26 20:22:46 +00:00
|
|
|
else subtitleOverlay.DisplayText();
|
2019-08-31 07:47:15 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
2020-01-14 20:48:01 +00:00
|
|
|
else if (!sceneonly)
|
2019-08-31 07:47:15 +00:00
|
|
|
{
|
2023-01-12 07:57:00 +00:00
|
|
|
if (nSnakeCam >= 0)
|
2019-08-31 07:47:15 +00:00
|
|
|
{
|
|
|
|
RestoreGreenPal();
|
|
|
|
if (nEnemyPal > -1) {
|
2021-12-21 22:18:23 +00:00
|
|
|
pEnemy->spr.pal = (uint8_t)nEnemyPal;
|
2019-08-31 07:47:15 +00:00
|
|
|
}
|
|
|
|
}
|
2023-01-12 07:57:00 +00:00
|
|
|
|
2023-03-17 03:11:27 +00:00
|
|
|
DrawMap(ampos, nCameraangles.Yaw, interpfrac);
|
2019-08-31 07:47:15 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
2020-06-12 18:52:01 +00:00
|
|
|
twod->ClearScreen();
|
2019-08-31 07:47:15 +00:00
|
|
|
}
|
|
|
|
|
2021-12-23 18:09:43 +00:00
|
|
|
pPlayerActor->spr.cstat = nPlayerOldCstat;
|
|
|
|
pDop->spr.cstat = nDoppleOldCstat;
|
2020-11-26 17:29:20 +00:00
|
|
|
RestoreInterpolations();
|
2019-11-03 17:20:05 +00:00
|
|
|
|
2019-08-31 07:47:15 +00:00
|
|
|
flash = 0;
|
2019-08-26 03:59:14 +00:00
|
|
|
}
|
|
|
|
|
2022-09-11 06:09:26 +00:00
|
|
|
//---------------------------------------------------------------------------
|
|
|
|
//
|
|
|
|
//
|
|
|
|
//
|
|
|
|
//---------------------------------------------------------------------------
|
|
|
|
|
2020-01-14 20:48:01 +00:00
|
|
|
bool GameInterface::GenerateSavePic()
|
|
|
|
{
|
|
|
|
DrawView(65536, true);
|
|
|
|
return true;
|
|
|
|
}
|
|
|
|
|
2022-09-16 17:20:35 +00:00
|
|
|
void GameInterface::processSprites(tspriteArray& tsprites, const DVector3& view, DAngle viewang, double interpfrac)
|
2021-03-26 00:35:23 +00:00
|
|
|
{
|
2022-09-16 17:20:35 +00:00
|
|
|
analyzesprites(tsprites, view, interpfrac);
|
2021-03-26 00:35:23 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
2022-09-11 06:09:26 +00:00
|
|
|
//---------------------------------------------------------------------------
|
|
|
|
//
|
|
|
|
//
|
|
|
|
//
|
|
|
|
//---------------------------------------------------------------------------
|
2019-12-26 21:00:04 +00:00
|
|
|
|
2020-11-29 22:32:28 +00:00
|
|
|
void SerializeView(FSerializer& arc)
|
|
|
|
{
|
2021-11-07 20:45:51 +00:00
|
|
|
if (arc.BeginObject("view"))
|
|
|
|
{
|
2022-09-10 08:15:45 +00:00
|
|
|
arc("camerapos", nCamerapos)
|
2021-11-07 20:45:51 +00:00
|
|
|
("touchfloor", bTouchFloor)
|
|
|
|
("chunktotal", nChunkTotal)
|
|
|
|
("camera", bCamera)
|
|
|
|
.Array("vertpan", dVertPan, countof(dVertPan))
|
|
|
|
.Array("quake", nQuake, countof(nQuake))
|
|
|
|
.EndObject();
|
|
|
|
}
|
2020-11-29 22:32:28 +00:00
|
|
|
}
|
2019-12-26 21:00:04 +00:00
|
|
|
|
2019-11-22 23:11:37 +00:00
|
|
|
END_PS_NS
|