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-31 07:47:15 +00:00
|
|
|
#include "compat.h"
|
2019-08-26 03:59:14 +00:00
|
|
|
#include "engine.h"
|
|
|
|
#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-05-30 22:01:00 +00:00
|
|
|
#include "glbackend/glbackend.h"
|
2019-08-26 03:59:14 +00:00
|
|
|
#include <string.h>
|
|
|
|
|
2019-11-22 23:11:37 +00:00
|
|
|
BEGIN_PS_NS
|
|
|
|
|
2020-08-18 08:28:19 +00:00
|
|
|
short bSubTitles = true;
|
2019-08-26 03:59:14 +00:00
|
|
|
|
|
|
|
int zbob;
|
|
|
|
|
2020-09-01 13:00:35 +00:00
|
|
|
fixed_t nDestVertPan[kMaxPlayers] = { 0 };
|
2019-08-26 03:59:14 +00:00
|
|
|
short dVertPan[kMaxPlayers];
|
|
|
|
int nCamerax;
|
|
|
|
int nCameray;
|
|
|
|
int nCameraz;
|
|
|
|
|
2020-08-19 22:55:31 +00:00
|
|
|
|
2019-08-26 03:59:14 +00:00
|
|
|
short bTouchFloor;
|
|
|
|
|
|
|
|
short nQuake[kMaxPlayers] = { 0 };
|
|
|
|
|
|
|
|
short nChunkTotal = 0;
|
|
|
|
|
2020-09-01 13:00:35 +00:00
|
|
|
fixed_t nCameraa;
|
|
|
|
fixed_t nCamerapan;
|
2019-08-26 03:59:14 +00:00
|
|
|
short nViewTop;
|
2020-08-18 08:28:19 +00:00
|
|
|
short bCamera = false;
|
2019-08-26 03:59:14 +00:00
|
|
|
|
|
|
|
int viewz;
|
|
|
|
|
|
|
|
short enemy;
|
|
|
|
|
|
|
|
short nEnemyPal = 0;
|
|
|
|
|
2019-11-03 17:20:05 +00:00
|
|
|
#define MAXINTERPOLATIONS MAXSPRITES
|
|
|
|
int32_t g_interpolationCnt;
|
|
|
|
int32_t oldipos[MAXINTERPOLATIONS];
|
|
|
|
int32_t* curipos[MAXINTERPOLATIONS];
|
|
|
|
int32_t bakipos[MAXINTERPOLATIONS];
|
|
|
|
|
|
|
|
int viewSetInterpolation(int32_t *const posptr)
|
|
|
|
{
|
|
|
|
if (g_interpolationCnt >= MAXINTERPOLATIONS)
|
|
|
|
return 1;
|
|
|
|
|
2020-08-30 21:34:40 +00:00
|
|
|
for (int i = 0; i < g_interpolationCnt; ++i)
|
2019-11-03 17:20:05 +00:00
|
|
|
if (curipos[i] == posptr)
|
|
|
|
return 0;
|
|
|
|
|
|
|
|
curipos[g_interpolationCnt] = posptr;
|
|
|
|
oldipos[g_interpolationCnt] = *posptr;
|
|
|
|
g_interpolationCnt++;
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
|
|
|
void viewStopInterpolation(const int32_t * const posptr)
|
|
|
|
{
|
2020-08-30 21:34:40 +00:00
|
|
|
for (int i = 0; i < g_interpolationCnt; ++i)
|
2019-11-03 17:20:05 +00:00
|
|
|
if (curipos[i] == posptr)
|
|
|
|
{
|
|
|
|
g_interpolationCnt--;
|
|
|
|
oldipos[i] = oldipos[g_interpolationCnt];
|
|
|
|
bakipos[i] = bakipos[g_interpolationCnt];
|
|
|
|
curipos[i] = curipos[g_interpolationCnt];
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
void viewDoInterpolations(int smoothRatio)
|
|
|
|
{
|
|
|
|
int32_t ndelta = 0;
|
|
|
|
|
2020-08-30 21:34:40 +00:00
|
|
|
for (int i = 0, j = 0; i < g_interpolationCnt; ++i)
|
2019-11-03 17:20:05 +00:00
|
|
|
{
|
|
|
|
int32_t const odelta = ndelta;
|
|
|
|
bakipos[i] = *curipos[i];
|
|
|
|
ndelta = (*curipos[i]) - oldipos[i];
|
|
|
|
if (odelta != ndelta)
|
|
|
|
j = mulscale16(ndelta, smoothRatio);
|
|
|
|
*curipos[i] = oldipos[i] + j;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
void viewUpdateInterpolations(void) //Stick at beginning of G_DoMoveThings
|
|
|
|
{
|
2020-08-30 21:34:40 +00:00
|
|
|
for (int i=g_interpolationCnt-1; i>=0; i--) oldipos[i] = *curipos[i];
|
2019-11-03 17:20:05 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
void viewRestoreInterpolations(void) //Stick at end of drawscreen
|
|
|
|
{
|
|
|
|
int32_t i=g_interpolationCnt-1;
|
|
|
|
|
|
|
|
for (; i>=0; i--) *curipos[i] = bakipos[i];
|
|
|
|
}
|
2019-08-26 03:59:14 +00:00
|
|
|
|
|
|
|
void InitView()
|
|
|
|
{
|
2019-10-27 14:22:40 +00:00
|
|
|
polymostcenterhoriz = 92;
|
2019-08-26 03:59:14 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
// NOTE - not to be confused with Ken's analyzesprites()
|
|
|
|
static void analyzesprites()
|
|
|
|
{
|
2019-08-31 07:47:15 +00:00
|
|
|
short nPlayerSprite = PlayerList[nLocalPlayer].nSprite;
|
2019-08-26 03:59:14 +00:00
|
|
|
|
2019-08-31 07:47:15 +00:00
|
|
|
int var_38 = 20;
|
|
|
|
int var_2C = 30000;
|
2019-08-26 03:59:14 +00:00
|
|
|
|
2019-10-11 12:49:39 +00:00
|
|
|
spritetype *pPlayerSprite = &sprite[nPlayerSprite];
|
|
|
|
|
2019-08-31 07:47:15 +00:00
|
|
|
besttarget = -1;
|
2019-08-26 03:59:14 +00:00
|
|
|
|
2019-10-11 12:49:39 +00:00
|
|
|
int x = pPlayerSprite->x;
|
|
|
|
int y = pPlayerSprite->y;
|
2019-08-26 03:59:14 +00:00
|
|
|
|
2019-10-11 12:49:39 +00:00
|
|
|
int z = pPlayerSprite->z - (GetSpriteHeight(nPlayerSprite) / 2);
|
2019-08-26 03:59:14 +00:00
|
|
|
|
2019-10-11 12:49:39 +00:00
|
|
|
short nSector = pPlayerSprite->sectnum;
|
2019-08-26 03:59:14 +00:00
|
|
|
|
2019-10-11 12:49:39 +00:00
|
|
|
int nAngle = (2048 - pPlayerSprite->ang) & kAngleMask;
|
2019-08-26 03:59:14 +00:00
|
|
|
|
2019-10-11 12:49:39 +00:00
|
|
|
int nTSprite;
|
|
|
|
tspritetype *pTSprite;
|
2019-08-26 03:59:14 +00:00
|
|
|
|
2019-11-20 16:21:32 +00:00
|
|
|
// int var_20 = var_24;
|
2019-08-26 03:59:14 +00:00
|
|
|
|
2019-10-11 12:49:39 +00:00
|
|
|
for (nTSprite = spritesortcnt-1, pTSprite = &tsprite[nTSprite]; nTSprite >= 0; nTSprite--, pTSprite--)
|
2019-08-31 07:47:15 +00:00
|
|
|
{
|
2019-10-11 12:49:39 +00:00
|
|
|
int nSprite = pTSprite->owner;
|
|
|
|
spritetype *pSprite = &sprite[nSprite];
|
2019-08-31 07:47:15 +00:00
|
|
|
|
2019-10-11 12:49:39 +00:00
|
|
|
if (pTSprite->sectnum >= 0)
|
|
|
|
{
|
|
|
|
sectortype *pSector = §or[pTSprite->sectnum];
|
|
|
|
int nSectShade = (pSector->ceilingstat & 1) ? pSector->ceilingshade : pSector->floorshade;
|
|
|
|
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);
|
|
|
|
|
2019-10-11 12:49:39 +00:00
|
|
|
if (pSprite->statnum > 0)
|
2019-08-31 07:47:15 +00:00
|
|
|
{
|
2019-10-11 12:49:39 +00:00
|
|
|
runlist_SignalRun(pSprite->lotag - 1, nTSprite | 0x90000);
|
2019-08-31 07:47:15 +00:00
|
|
|
|
2019-10-11 12:49:39 +00:00
|
|
|
if ((pSprite->statnum < 150) && (pSprite->cstat & 0x101) && (nSprite != nPlayerSprite))
|
2019-08-31 07:47:15 +00:00
|
|
|
{
|
2019-10-11 12:49:39 +00:00
|
|
|
int xval = pSprite->x - x;
|
|
|
|
int yval = pSprite->y - y;
|
2019-08-31 07:47:15 +00:00
|
|
|
|
2019-10-11 12:49:39 +00:00
|
|
|
int vcos = Cos(nAngle);
|
|
|
|
int vsin = Sin(nAngle);
|
2019-08-31 07:47:15 +00:00
|
|
|
|
|
|
|
|
2019-10-11 12:49:39 +00:00
|
|
|
int edx = ((vcos * yval) + (xval * vsin)) >> 14;
|
2019-08-31 07:47:15 +00:00
|
|
|
|
|
|
|
|
2019-10-11 12:49:39 +00:00
|
|
|
int ebx = klabs(((vcos * xval) - (yval * vsin)) >> 14);
|
2019-08-31 07:47:15 +00:00
|
|
|
|
2019-10-11 12:49:39 +00:00
|
|
|
if (!ebx)
|
|
|
|
continue;
|
2019-08-31 07:47:15 +00:00
|
|
|
|
2019-10-11 12:49:39 +00:00
|
|
|
edx = (klabs(edx) * 32) / ebx;
|
|
|
|
if (ebx < 1000 && ebx < var_2C && edx < 10)
|
|
|
|
{
|
|
|
|
besttarget = nSprite;
|
|
|
|
var_38 = edx;
|
|
|
|
var_2C = ebx;
|
|
|
|
}
|
|
|
|
else if (ebx < 30000)
|
|
|
|
{
|
|
|
|
int t = var_38 - edx;
|
|
|
|
if (t > 3 || (ebx < var_2C && klabs(t) < 5))
|
2019-08-31 07:47:15 +00:00
|
|
|
{
|
2019-10-11 12:49:39 +00:00
|
|
|
var_38 = edx;
|
|
|
|
var_2C = ebx;
|
|
|
|
besttarget = nSprite;
|
2019-08-31 07:47:15 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
2019-10-11 12:49:39 +00:00
|
|
|
}
|
|
|
|
if (besttarget != -1)
|
|
|
|
{
|
|
|
|
spritetype *pTarget = &sprite[besttarget];
|
|
|
|
|
2019-11-03 17:32:02 +00:00
|
|
|
nCreepyTimer = kCreepyCount;
|
2019-08-31 07:47:15 +00:00
|
|
|
|
2019-10-11 12:49:39 +00:00
|
|
|
if (!cansee(x, y, z, nSector, pTarget->x, pTarget->y, pTarget->z - GetSpriteHeight(besttarget), pTarget->sectnum))
|
|
|
|
{
|
|
|
|
besttarget = -1;
|
|
|
|
}
|
2019-08-31 07:47:15 +00:00
|
|
|
}
|
2019-08-26 03:59:14 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
void ResetView()
|
|
|
|
{
|
2019-08-31 07:47:15 +00:00
|
|
|
EraseScreen(overscanindex);
|
2019-10-12 22:27:12 +00:00
|
|
|
#ifdef USE_OPENGL
|
|
|
|
videoTintBlood(0, 0, 0);
|
|
|
|
#endif
|
2019-08-26 03:59:14 +00:00
|
|
|
}
|
|
|
|
|
2019-11-03 17:20:05 +00:00
|
|
|
static inline int interpolate16(int a, int b, int smooth)
|
|
|
|
{
|
|
|
|
return a + mulscale16(b - a, smooth);
|
|
|
|
}
|
|
|
|
|
2020-08-22 09:56:54 +00:00
|
|
|
static TextOverlay subtitleOverlay;
|
|
|
|
|
2020-08-24 03:22:52 +00:00
|
|
|
void DrawView(double smoothRatio, bool sceneonly)
|
2019-08-26 03:59:14 +00:00
|
|
|
{
|
2019-08-31 07:47:15 +00:00
|
|
|
int playerX;
|
|
|
|
int playerY;
|
|
|
|
int playerZ;
|
|
|
|
short nSector;
|
2020-09-01 13:00:35 +00:00
|
|
|
fixed_t nAngle;
|
|
|
|
fixed_t pan;
|
2019-08-31 07:47:15 +00:00
|
|
|
|
|
|
|
zbob = Sin(2 * bobangle) >> 3;
|
|
|
|
|
|
|
|
int nPlayerSprite = PlayerList[nLocalPlayer].nSprite;
|
2019-11-03 17:20:05 +00:00
|
|
|
int nPlayerOldCstat = sprite[nPlayerSprite].cstat;
|
2019-11-08 17:04:07 +00:00
|
|
|
int nDoppleOldCstat = sprite[nDoppleSprite[nLocalPlayer]].cstat;
|
2019-08-31 07:47:15 +00:00
|
|
|
|
2020-01-14 20:48:01 +00:00
|
|
|
if (nSnakeCam >= 0 && !sceneonly)
|
2019-08-31 07:47:15 +00:00
|
|
|
{
|
|
|
|
int nSprite = SnakeList[nSnakeCam].nSprites[0];
|
|
|
|
|
|
|
|
playerX = sprite[nSprite].x;
|
|
|
|
playerY = sprite[nSprite].y;
|
|
|
|
playerZ = sprite[nSprite].z;
|
|
|
|
nSector = sprite[nSprite].sectnum;
|
2020-09-01 13:00:35 +00:00
|
|
|
nAngle = IntToFixed(sprite[nSprite].ang);
|
2019-08-31 07:47:15 +00:00
|
|
|
|
|
|
|
SetGreenPal();
|
|
|
|
|
|
|
|
enemy = SnakeList[nSnakeCam].nEnemy;
|
|
|
|
|
|
|
|
if (enemy <= -1 || totalmoves & 1)
|
|
|
|
{
|
|
|
|
nEnemyPal = -1;
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
nEnemyPal = sprite[enemy].pal;
|
|
|
|
sprite[enemy].pal = 5;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
2019-11-03 17:20:05 +00:00
|
|
|
playerX = interpolate16(PlayerList[nLocalPlayer].opos.x, sprite[nPlayerSprite].x, smoothRatio);
|
|
|
|
playerY = interpolate16(PlayerList[nLocalPlayer].opos.y, sprite[nPlayerSprite].y, smoothRatio);
|
2019-11-08 16:45:10 +00:00
|
|
|
playerZ = interpolate16(PlayerList[nLocalPlayer].opos.z, sprite[nPlayerSprite].z, smoothRatio)
|
|
|
|
+ interpolate16(oeyelevel[nLocalPlayer], eyelevel[nLocalPlayer], smoothRatio);
|
2019-08-31 07:47:15 +00:00
|
|
|
nSector = nPlayerViewSect[nLocalPlayer];
|
2020-04-04 04:31:27 +00:00
|
|
|
nAngle = PlayerList[nLocalPlayer].q16angle;
|
2019-11-03 17:20:05 +00:00
|
|
|
|
2019-11-12 12:25:16 +00:00
|
|
|
if (!bCamera)
|
|
|
|
{
|
|
|
|
sprite[nPlayerSprite].cstat |= CSTAT_SPRITE_INVISIBLE;
|
|
|
|
sprite[nDoppleSprite[nLocalPlayer]].cstat |= CSTAT_SPRITE_INVISIBLE;
|
|
|
|
}
|
2019-08-31 07:47:15 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
nCameraa = nAngle;
|
|
|
|
|
2020-01-14 20:48:01 +00:00
|
|
|
if (!bCamera || nFreeze || sceneonly)
|
2019-08-31 07:47:15 +00:00
|
|
|
{
|
2020-01-14 20:48:01 +00:00
|
|
|
if (nSnakeCam >= 0 && !sceneonly)
|
2019-08-31 07:47:15 +00:00
|
|
|
{
|
2020-09-01 13:00:35 +00:00
|
|
|
pan = IntToFixed(92);
|
2019-08-31 07:47:15 +00:00
|
|
|
viewz = playerZ;
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
viewz = playerZ + nQuake[nLocalPlayer];
|
|
|
|
int floorZ = sector[sprite[nPlayerSprite].sectnum].floorz;
|
|
|
|
|
2020-04-04 04:31:27 +00:00
|
|
|
pan = PlayerList[nLocalPlayer].q16horiz;
|
2019-08-31 07:47:15 +00:00
|
|
|
|
|
|
|
if (viewz > floorZ)
|
|
|
|
viewz = floorZ;
|
|
|
|
|
2020-09-01 13:00:35 +00:00
|
|
|
nCameraa += IntToFixed((nQuake[nLocalPlayer] >> 7) % 31);
|
2019-10-29 17:35:22 +00:00
|
|
|
nCameraa &= 0x7FFFFFF;
|
2019-08-31 07:47:15 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
clipmove_old((int32_t*)&playerX, (int32_t*)&playerY, (int32_t*)&playerZ, &nSector,
|
2019-11-20 16:21:32 +00:00
|
|
|
-2000 * Sin(inita + 512),
|
2019-08-31 07:47:15 +00:00
|
|
|
-2000 * Sin(inita),
|
|
|
|
4, 0, 0, CLIPMASK1);
|
|
|
|
|
2020-09-01 13:00:35 +00:00
|
|
|
pan = IntToFixed(92);
|
2019-08-31 07:47:15 +00:00
|
|
|
viewz = playerZ;
|
|
|
|
}
|
|
|
|
|
|
|
|
nCamerax = playerX;
|
|
|
|
nCameray = playerY;
|
|
|
|
nCameraz = playerZ;
|
|
|
|
|
|
|
|
int Z = sector[nSector].ceilingz + 256;
|
|
|
|
if (Z <= viewz)
|
|
|
|
{
|
|
|
|
Z = sector[nSector].floorz - 256;
|
|
|
|
|
|
|
|
if (Z < viewz)
|
|
|
|
viewz = Z;
|
|
|
|
}
|
|
|
|
else {
|
|
|
|
viewz = Z;
|
|
|
|
}
|
|
|
|
|
|
|
|
nCamerapan = pan;
|
|
|
|
|
|
|
|
if (nFreeze == 2 || nFreeze == 1)
|
|
|
|
{
|
|
|
|
nSnakeCam = -1;
|
|
|
|
videoSetViewableArea(0, 0, xdim - 1, ydim - 1);
|
|
|
|
}
|
|
|
|
|
2019-11-18 20:31:08 +00:00
|
|
|
UpdateMap();
|
|
|
|
|
2019-08-31 07:47:15 +00:00
|
|
|
if (nFreeze != 3)
|
|
|
|
{
|
2019-10-27 13:53:20 +00:00
|
|
|
static uint8_t sectorFloorPal[MAXSECTORS];
|
|
|
|
static uint8_t sectorCeilingPal[MAXSECTORS];
|
|
|
|
static uint8_t wallPal[MAXWALLS];
|
2019-10-11 12:14:30 +00:00
|
|
|
int const viewingRange = viewingrange;
|
2020-09-04 19:24:48 +00:00
|
|
|
int const vr = xs_CRoundToInt(65536.f * tanf(r_fov * (fPI / 360.f)));
|
2019-10-11 12:14:30 +00:00
|
|
|
|
2020-08-28 07:06:49 +00:00
|
|
|
|
|
|
|
videoSetCorrectedAspect();
|
|
|
|
renderSetAspect(mulscale16(vr, viewingrange), yxaspect);
|
2019-10-11 12:14:30 +00:00
|
|
|
|
2019-10-27 13:53:20 +00:00
|
|
|
if (HavePLURemap())
|
|
|
|
{
|
|
|
|
for (int i = 0; i < numsectors; i++)
|
|
|
|
{
|
|
|
|
sectorFloorPal[i] = sector[i].floorpal;
|
|
|
|
sectorCeilingPal[i] = sector[i].ceilingpal;
|
2019-10-29 07:37:34 +00:00
|
|
|
sector[i].floorpal = RemapPLU(sectorFloorPal[i]);
|
|
|
|
sector[i].ceilingpal = RemapPLU(sectorCeilingPal[i]);
|
2019-10-27 13:53:20 +00:00
|
|
|
}
|
|
|
|
for (int i = 0; i < numwalls; i++)
|
|
|
|
{
|
|
|
|
wallPal[i] = wall[i].pal;
|
2019-10-29 07:37:34 +00:00
|
|
|
wall[i].pal = RemapPLU(wallPal[i]);
|
2019-10-27 13:53:20 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2019-10-29 17:35:22 +00:00
|
|
|
renderDrawRoomsQ16(nCamerax, nCameray, viewz, nCameraa, nCamerapan, nSector);
|
2019-08-31 07:47:15 +00:00
|
|
|
analyzesprites();
|
|
|
|
renderDrawMasks();
|
|
|
|
|
2019-10-27 13:53:20 +00:00
|
|
|
if (HavePLURemap())
|
|
|
|
{
|
|
|
|
for (int i = 0; i < numsectors; i++)
|
|
|
|
{
|
|
|
|
sector[i].floorpal = sectorFloorPal[i];
|
|
|
|
sector[i].ceilingpal = sectorCeilingPal[i];
|
|
|
|
}
|
|
|
|
for (int i = 0; i < numwalls; i++)
|
|
|
|
{
|
|
|
|
wall[i].pal = wallPal[i];
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2020-08-28 07:06:49 +00:00
|
|
|
|
|
|
|
renderSetAspect(viewingRange, divscale16(ydim * 8, xdim * 5));
|
2019-10-11 12:14:30 +00:00
|
|
|
|
2019-08-31 07:47:15 +00:00
|
|
|
if (nFreeze)
|
|
|
|
{
|
|
|
|
nSnakeCam = -1;
|
|
|
|
|
|
|
|
if (nFreeze == 2)
|
|
|
|
{
|
2020-09-02 19:42:12 +00:00
|
|
|
int myclock = leveltime + mulscale16(4, (int)smoothRatio);
|
2019-08-31 07:47:15 +00:00
|
|
|
if (nHeadStage == 4)
|
|
|
|
{
|
|
|
|
nHeadStage = 5;
|
|
|
|
|
|
|
|
sprite[nPlayerSprite].cstat |= 0x8000;
|
|
|
|
|
2020-09-01 13:00:35 +00:00
|
|
|
int ang2 = FixedToInt(nCameraa) - sprite[nPlayerSprite].ang;
|
2019-08-31 07:47:15 +00:00
|
|
|
if (ang2 < 0)
|
|
|
|
ang2 = -ang2;
|
2019-11-20 16:21:32 +00:00
|
|
|
|
2019-08-31 07:47:15 +00:00
|
|
|
if (ang2 > 10)
|
|
|
|
{
|
|
|
|
inita -= (ang2 >> 3);
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
|
|
|
if (bSubTitles)
|
|
|
|
{
|
2020-09-02 19:42:12 +00:00
|
|
|
subtitleOverlay.Start(myclock);
|
2020-08-23 14:24:54 +00:00
|
|
|
if (currentLevel->levelNumber == 1)
|
2020-09-04 21:16:21 +00:00
|
|
|
subtitleOverlay.ReadyCinemaText(1);
|
2019-11-20 16:21:32 +00:00
|
|
|
else
|
2020-09-04 21:16:21 +00:00
|
|
|
subtitleOverlay.ReadyCinemaText(5);
|
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-02 19:42:12 +00:00
|
|
|
if ((bSubTitles && !subtitleOverlay.AdvanceCinemaText(myclock)) || inputState.CheckAllInput())
|
2019-08-31 07:47:15 +00:00
|
|
|
{
|
2020-08-26 20:22:46 +00:00
|
|
|
inputState.ClearAllInput();
|
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
|
|
|
{
|
|
|
|
if (nSnakeCam < 0)
|
|
|
|
{
|
2019-11-08 16:55:26 +00:00
|
|
|
DrawWeapons(smoothRatio);
|
2019-11-18 20:31:08 +00:00
|
|
|
DrawMap();
|
2019-08-31 07:47:15 +00:00
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
RestoreGreenPal();
|
|
|
|
if (nEnemyPal > -1) {
|
|
|
|
sprite[enemy].pal = nEnemyPal;
|
|
|
|
}
|
|
|
|
|
2019-11-18 20:31:08 +00:00
|
|
|
DrawMap();
|
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
|
|
|
}
|
|
|
|
|
2019-11-03 17:20:05 +00:00
|
|
|
sprite[nPlayerSprite].cstat = nPlayerOldCstat;
|
2019-11-08 17:04:07 +00:00
|
|
|
sprite[nDoppleSprite[nLocalPlayer]].cstat = nDoppleOldCstat;
|
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
|
|
|
}
|
|
|
|
|
2020-01-14 20:48:01 +00:00
|
|
|
bool GameInterface::GenerateSavePic()
|
|
|
|
{
|
|
|
|
DrawView(65536, true);
|
|
|
|
return true;
|
|
|
|
}
|
|
|
|
|
2019-08-26 03:59:14 +00:00
|
|
|
void NoClip()
|
|
|
|
{
|
|
|
|
}
|
|
|
|
|
|
|
|
void Clip()
|
|
|
|
{
|
|
|
|
}
|
2019-12-26 21:00:04 +00:00
|
|
|
|
|
|
|
|
|
|
|
static SavegameHelper sgh("view",
|
|
|
|
SV(nCamerax),
|
|
|
|
SV(nCameray),
|
|
|
|
SV(nCameraz),
|
|
|
|
SV(bTouchFloor),
|
|
|
|
SV(nChunkTotal),
|
|
|
|
SV(nCameraa),
|
|
|
|
SV(nCamerapan),
|
|
|
|
SV(bCamera),
|
|
|
|
SV(viewz),
|
|
|
|
SV(enemy),
|
|
|
|
SV(nEnemyPal),
|
|
|
|
SA(nDestVertPan),
|
|
|
|
SA(dVertPan),
|
|
|
|
SA(nQuake),
|
2019-12-26 22:17:11 +00:00
|
|
|
SV(g_interpolationCnt),
|
|
|
|
SA(oldipos),
|
|
|
|
SA(curipos),
|
|
|
|
SA(bakipos),
|
2019-12-26 21:00:04 +00:00
|
|
|
nullptr);
|
|
|
|
|
2019-11-22 23:11:37 +00:00
|
|
|
END_PS_NS
|