- excised Blood's entire automap code.

This commit is contained in:
Christoph Oelckers 2020-09-06 10:59:45 +02:00
parent 8f6f368445
commit d61d279168
15 changed files with 31 additions and 278 deletions

View File

@ -45,7 +45,6 @@ set( PCH_SOURCES
src/inifile.cpp
src/levels.cpp
src/loadsave.cpp
src/map2d.cpp
src/messages.cpp
src/mirrors.cpp
src/misc.cpp

View File

@ -33,7 +33,6 @@ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
#include "endgame.h"
#include "aistate.h"
#include "map2d.h"
#include "loadsave.h"
#include "sectorfx.h"
#include "choke.h"

View File

@ -62,7 +62,6 @@ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
#include "choke.h"
#include "d_net.h"
#include "v_video.h"
#include "map2d.h"
BEGIN_BLD_NS
@ -495,8 +494,6 @@ void GameInterface::Startup()
void GameInterface::Render()
{
gZoom = GetAutomapZoom(gZoom);
gViewMap.nZoom = gZoom;
drawtime.Reset();
drawtime.Clock();
viewDrawScreen();

View File

@ -31,7 +31,6 @@ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
#include "controls.h"
#include "globals.h"
#include "levels.h"
#include "map2d.h"
#include "view.h"
#include "d_event.h"
#include "gamestate.h"
@ -167,19 +166,21 @@ void GetInputInternal(InputPacket &inputParm)
input.q16horz -= FloatToFixed(scaleAdjustmentToInterval(info.dpitch / mlookScale));
if (!automapFollow && automapMode != am_off)
if (automapFollow && automapMode != am_off)
{
gViewMap.turn += input.q16avel<<2;
gViewMap.forward += input.fvel;
gViewMap.strafe += input.svel;
input.q16avel = 0;
input.fvel = 0;
input.svel = 0;
inputParm.q16horz = 0;
inputParm.q16avel = 0;
inputParm.fvel = 0;
inputParm.svel = 0;
}
inputParm.fvel = clamp(inputParm.fvel + input.fvel, -2048, 2048);
inputParm.svel = clamp(inputParm.svel + input.svel, -2048, 2048);
inputParm.q16avel += input.q16avel;
inputParm.q16horz = clamp(inputParm.q16horz + input.q16horz, IntToFixed(-127)>>2, IntToFixed(127)>>2);
else
{
inputParm.fvel = clamp(inputParm.fvel + input.fvel, -2048, 2048);
inputParm.svel = clamp(inputParm.svel + input.svel, -2048, 2048);
inputParm.q16avel += input.q16avel;
inputParm.q16horz = clamp(inputParm.q16horz + input.q16horz, IntToFixed(-127) >> 2, IntToFixed(127) >> 2);
}
if (gMe && gMe->pXSprite && gMe->pXSprite->health != 0 && !paused)
{
int upAngle = 289;

View File

@ -594,9 +594,7 @@ const int nXWallSize = 24;
int dbLoadMap(const char *pPath, int *pX, int *pY, int *pZ, short *pAngle, short *pSector, unsigned int *pCRC) {
int16_t tpskyoff[256];
show2dsector.Zero();
memset(show2dwall, 0, sizeof(show2dwall));
memset(show2dsprite, 0, sizeof(show2dsprite));
ClearAutomap();
#ifdef NOONE_EXTENSIONS
gModernMap = false;
#endif

View File

@ -33,7 +33,6 @@ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
#include "endgame.h"
#include "aistate.h"
#include "map2d.h"
#include "loadsave.h"
#include "sectorfx.h"
#include "choke.h"

View File

@ -26,7 +26,6 @@ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
#include "mmulti.h"
#include "common_game.h"
#include "levels.h"
#include "map2d.h"
#include "view.h"
#include "v_2ddrawer.h"
#include "v_draw.h"
@ -34,200 +33,5 @@ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
BEGIN_BLD_NS
void sub_2541C(int x, int y, int z, short a)
{
int tmpydim = (xdim * 5) / 8;
renderSetAspect(65536, divscale16(tmpydim * 320, xdim * 200));
int nCos = z*sintable[(0-a)&2047];
int nSin = z*sintable[(1536-a)&2047];
int nCos2 = mulscale16(nCos, yxaspect);
int nSin2 = mulscale16(nSin, yxaspect);
for (int i = 0; i < numsectors; i++)
{
if (gFullMap || show2dsector[i])
{
int nStartWall = sector[i].wallptr;
int nEndWall = nStartWall+sector[i].wallnum;
int nZCeil = sector[i].ceilingz;
int nZFloor = sector[i].floorz;
walltype *pWall = &wall[nStartWall];
for (int j = nStartWall; j < nEndWall; j++, pWall++)
{
int nNextWall = pWall->nextwall;
if (nNextWall < 0)
continue;
if (sector[pWall->nextsector].ceilingz == nZCeil && sector[pWall->nextsector].floorz == nZFloor
&& ((wall[nNextWall].cstat | pWall->cstat) & 0x30) == 0)
continue;
if (gFullMap || show2dsector[pWall->nextsector])
continue;
int wx = pWall->x-x;
int wy = pWall->y-y;
int cx = xdim<<11;
int x1 = cx+dmulscale16(wx, nCos, -wy, nSin);
int cy = ydim<<11;
int y1 = cy+dmulscale16(wy, nCos2, wx, nSin2);
walltype *pWall2 = &wall[pWall->point2];
wx = pWall2->x-x;
wy = pWall2->y-y;
int x2 = cx+dmulscale16(wx, nCos, -wy, nSin);
int y2 = cy+dmulscale16(wy, nCos2, wx, nSin2);
renderDrawLine(x1,y1,x2,y2,24);
}
}
}
int nPSprite = gView->pSprite->index;
for (int i = 0; i < numsectors; i++)
{
if (gFullMap || show2dsector[i])
{
for (int nSprite = headspritesect[i]; nSprite >= 0; nSprite = nextspritesect[nSprite])
{
spritetype *pSprite = &sprite[nSprite];
if (nSprite == nPSprite)
continue;
if (pSprite->cstat&32768)
continue;
}
}
}
for (int i = 0; i < numsectors; i++)
{
if (gFullMap || show2dsector[i])
{
int nStartWall = sector[i].wallptr;
int nEndWall = nStartWall+sector[i].wallnum;
walltype *pWall = &wall[nStartWall];
int nNWall = -1;
int x1, y1, x2 = 0, y2 = 0;
for (int j = nStartWall; j < nEndWall; j++, pWall++)
{
int nNextWall = pWall->nextwall;
if (nNextWall >= 0)
continue;
if (!tilesiz[pWall->picnum].x || !tilesiz[pWall->picnum].y)
continue;
if (nNWall == j)
{
x1 = x2;
y1 = y2;
}
else
{
int wx = pWall->x-x;
int wy = pWall->y-y;
x1 = (xdim<<11)+dmulscale16(wx, nCos, -wy, nSin);
y1 = (ydim<<11)+dmulscale16(wy, nCos2, wx, nSin2);
}
nNWall = pWall->point2;
walltype *pWall2 = &wall[nNWall];
int wx = pWall2->x-x;
int wy = pWall2->y-y;
x2 = (xdim<<11)+dmulscale16(wx, nCos, -wy, nSin);
y2 = (ydim<<11)+dmulscale16(wy, nCos2, wx, nSin2);
renderDrawLine(x1,y1,x2,y2,24);
}
}
}
videoSetCorrectedAspect();
for (int i = connecthead; i >= 0; i = connectpoint2[i])
{
if (automapFollow || gView->nPlayer != i)
{
PLAYER *pPlayer = &gPlayer[i];
spritetype *pSprite = pPlayer->pSprite;
int px = pSprite->x-x;
int py = pSprite->y-y;
int pa = (pSprite->ang-a)&2047;
if (i == gView->nPlayer)
{
px = 0;
py = 0;
pa = 0;
}
int x1 = dmulscale16(px, nCos, -py, nSin);
int y1 = dmulscale16(py, nCos2, px, nSin2);
if (i == gView->nPlayer || gGameOptions.nGameType == 1)
{
int nTile = pSprite->picnum;
int ceilZ, ceilHit, floorZ, floorHit;
GetZRange(pSprite, &ceilZ, &ceilHit, &floorZ, &floorHit, (pSprite->clipdist<<2)+16, CLIPMASK0, PARALLAXCLIP_CEILING|PARALLAXCLIP_FLOOR);
int nTop, nBottom;
GetSpriteExtents(pSprite, &nTop, &nBottom);
int nScale = mulscale((pSprite->yrepeat+((floorZ-nBottom)>>8))*z, yxaspect, 16);
nScale = ClipRange(nScale, 8000, 65536<<1);
// Players on automap
double x = xdim/2. + x1 / double(1<<12);
double y = ydim/2. + y1 / double(1<<12);
// This very likely needs fixing later
DrawTexture(twod, tileGetTexture(nTile, true), x, y, DTA_FullscreenScale, FSMode_Fit320x200, DTA_ViewportX, windowxy1.x, DTA_ViewportY, windowxy1.y,
DTA_ViewportWidth, windowxy2.x - windowxy1.x+1, DTA_ViewportHeight, windowxy2.y - windowxy1.y+1, DTA_Alpha, (pSprite->cstat&2? 0.5:1.), TAG_DONE);
}
}
}
}
void CViewMap::sub_25C38(int _x, int _y, int _angle, short zoom)
{
x = _x;
y = _y;
angle = _angle;
nZoom = zoom;
forward = 0;
turn = 0;
strafe = 0;
}
void CViewMap::sub_25C74(void)
{
int tm = 0;
if (windowxy1.x > 0)
{
setViewport(Hud_Stbar);
tm = 1;
}
// only clear the actual window.
twod->AddColorOnlyQuad(windowxy1.x, windowxy1.y, (windowxy2.x + 1) - windowxy1.x, (windowxy2.y + 1) - windowxy1.y, 0xff000000);
renderDrawMapView(x,y,nZoom>>1,angle);
sub_2541C(x,y,nZoom>>1,angle);
if (tm)
setViewport(hud_size);
}
void CViewMap::sub_25DB0(spritetype *pSprite)
{
nZoom = gZoom;
if (automapFollow)
{
x = pSprite->x;
y = pSprite->y;
angle = pSprite->ang;
}
else
{
angle += FixedToInt(turn)>>3;
x += mulscale24(forward>>8, Cos(angle));
y += mulscale24(forward>>8, Sin(angle));
x -= mulscale24(strafe>>8, Cos(angle+512));
y -= mulscale24(strafe>>8, Sin(angle+512));
forward = 0;
strafe = 0;
turn = 0;
}
sub_25C74();
}
void CViewMap::sub_25E84(int *_x, int *_y)
{
if (_x)
*_x = x;
if (_y)
*_y = y;
}
CViewMap gViewMap;
END_BLD_NS

View File

@ -1,43 +0,0 @@
//-------------------------------------------------------------------------
/*
Copyright (C) 2010-2019 EDuke32 developers and contributors
Copyright (C) 2019 Nuke.YKT
This file is part of NBlood.
NBlood 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.
*/
//-------------------------------------------------------------------------
#pragma once
#include "build.h"
BEGIN_BLD_NS
class CViewMap {
public:
char bActive;
int x, y, nZoom;
short angle;
int forward, strafe;
fixed_t turn;
void sub_25C38(int, int, int, short);
void sub_25C74(void);
void sub_25DB0(spritetype *pSprite);
void sub_25E84(int *, int*);
};
extern CViewMap gViewMap;
END_BLD_NS

View File

@ -37,7 +37,6 @@ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
#include "globals.h"
#include "levels.h"
#include "loadsave.h"
#include "map2d.h"
#include "player.h"
#include "seq.h"
#include "sound.h"
@ -806,9 +805,6 @@ void playerStart(int nPlayer, int bNewLevel)
viewInitializePrediction();
gViewLook = pPlayer->q16look;
gViewAngle = pPlayer->q16ang;
gViewMap.x = pPlayer->pSprite->x;
gViewMap.y = pPlayer->pSprite->y;
gViewMap.angle = pPlayer->pSprite->ang;
}
if (IsUnderwaterSector(pSprite->sectnum))
{

View File

@ -33,7 +33,6 @@ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
#include "endgame.h"
#include "aistate.h"
#include "map2d.h"
#include "loadsave.h"
#include "sectorfx.h"
#include "choke.h"

View File

@ -33,7 +33,6 @@ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
#include "endgame.h"
#include "aistate.h"
#include "map2d.h"
#include "loadsave.h"
#include "sectorfx.h"
#include "choke.h"

View File

@ -33,7 +33,6 @@ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
#include "endgame.h"
#include "aistate.h"
#include "map2d.h"
#include "loadsave.h"
#include "sectorfx.h"
#include "choke.h"
@ -45,6 +44,7 @@ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
#include "v_2ddrawer.h"
#include "v_video.h"
#include "v_font.h"
#include "statusbar.h"
#include "glbackend/glbackend.h"
BEGIN_BLD_NS
@ -266,8 +266,6 @@ void viewDrawAimedPlayerName(void)
static TArray<uint8_t> lensdata;
int *lensTable;
int gZoom = 1024;
extern int dword_172CE0[16][3];
void viewInit(void)
@ -299,7 +297,6 @@ void viewInit(void)
dword_172CE0[i][1] = mulscale16(wrand(), 2048);
dword_172CE0[i][2] = mulscale16(wrand(), 2048);
}
gViewMap.sub_25C38(0, 0, gZoom, 0);
}
int othercameradist = 1280;
@ -597,6 +594,21 @@ int gLastPal = 0;
int32_t g_frameRate;
static void DrawMap(spritetype* pSprite)
{
int tm = 0;
if (windowxy1.x > 0)
{
setViewport(Hud_Stbar);
tm = 1;
}
DrawOverheadMap(pSprite->x, pSprite->y, pSprite->ang);
if (tm)
setViewport(hud_size);
}
void viewDrawScreen(bool sceneonly)
{
int nPalette = 0;
@ -985,7 +997,7 @@ void viewDrawScreen(bool sceneonly)
UpdateDacs(0, true); // keep the view palette active only for the actual 3D view and its overlays.
if (automapMode != am_off)
{
gViewMap.sub_25DB0(gView->pSprite);
DrawMap (gView->pSprite);
}
UpdateStatusBar();
int zn = ((gView->zWeapon-gView->zView-(12<<8))>>7)+220;

View File

@ -127,7 +127,6 @@ enum
#define kFontNum 5
extern int gZoom;
extern FFont *gFont[kFontNum];
extern VIEWPOS gViewPos;
extern int gViewIndex;

View File

@ -50,7 +50,6 @@ struct GameInterface : public ::GameInterface
void ExitFromMenu() override;
ReservedSpace GetReservedScreenSpace(int viewsize) override;
void DrawPlayerSprite(const DVector2& origin, bool onteam) override;
void ResetFollowPos(bool message) override;
void GetInput(InputPacket* packet) override;
void UpdateSounds() override;
void Startup() override;

View File

@ -46,11 +46,6 @@ static int lastcontroltime;
static double lastCheck;
static InputPacket loc; // input accumulation buffer.
void GameInterface::ResetFollowPos(bool message)
{
if (message) FTA(automapFollow? QUOTE_MAP_FOLLOW_ON : QUOTE_MAP_FOLLOW_OFF, &ps[myconnectindex]);
}
//---------------------------------------------------------------------------
//
// handles all HUD related input, i.e. inventory item selection and activation plus weapon selection.