- removed all automap code from SW and the flat drawer from the backend.

This should have been the last parts of automap code.
Now on to rebuild this thing in a cleaner fashion...
This commit is contained in:
Christoph Oelckers 2020-09-06 12:14:08 +02:00
parent 2c183bf504
commit a6c92aec64
10 changed files with 4 additions and 895 deletions

View file

@ -1788,33 +1788,10 @@ drawscreen(PLAYERp pp, double smoothratio)
#endif
i = pp->cursectnum;
if (i >= 0)
{
show2dsector.Set(i);
walltype *wal = &wall[sector[i].wallptr];
for (j=sector[i].wallnum; j>0; j--,wal++)
{
i = wal->nextsector;
if (i < 0) continue;
if (wal->cstat&0x0071) continue;
uint16_t const nextwall = wal->nextwall;
if (nextwall < MAXWALLS && wall[nextwall].cstat&0x0071) continue;
if (sector[i].lotag == 32767) continue;
if (sector[i].ceilingz >= sector[i].floorz) continue;
show2dsector.Set(i);
}
}
MarkSectorSeen(pp->cursectnum);
if ((automapMode != am_off) && pp == Player+myconnectindex)
{
if (automapFollow)
{
tx = Follow_posx;
ty = Follow_posy;
}
for (j = 0; j < MAXSPRITES; j++)
{
// Don't show sprites tagged with 257
@ -1827,16 +1804,7 @@ drawscreen(PLAYERp pp, double smoothratio)
}
}
}
if (automapMode == am_full)
{
// only clear the actual window.
twod->AddColorOnlyQuad(windowxy1.x, windowxy1.y, (windowxy2.x + 1) - windowxy1.x, (windowxy2.y + 1) - windowxy1.y, 0xff000000);
renderDrawMapView(tx, ty, zoom*2, FixedToInt(tq16ang));
}
// Draw the line map on top of texture 2d map or just stand alone
drawoverheadmap(tx, ty, zoom*2, FixedToInt(tq16ang));
DrawOverheadMap(tx, ty, FixedToInt(tq16ang));
}
for (j = 0; j < MAXSPRITES; j++)
@ -1872,8 +1840,6 @@ drawscreen(PLAYERp pp, double smoothratio)
SyncStatMessage();
#endif
zoom = GetAutomapZoom(zoom);
restoreinterpolations(); // Stick at end of drawscreen
short_restoreinterpolations(); // Stick at end of drawscreen
if (cl_sointerpolation)

View file

@ -106,7 +106,6 @@ SWBOOL SavegameLoaded = false;
SWBOOL FinishedLevel = false;
short screenpeek = 0;
void drawoverheadmap(int cposx, int cposy, int czoom, short cang);
SWBOOL PreCaching = TRUE;
int GodMode = false;
short Skill = 2;
@ -266,7 +265,6 @@ void InitLevelGlobals(void)
{
ChopTics = 0;
automapMode = am_off;
zoom = 768 / 2;
PlayerGravity = 24;
wait_active_check_offset = 0;
PlaxCeilGlobZadjust = PlaxFloorGlobZadjust = Z(500);

View file

@ -2052,8 +2052,6 @@ extern char keys[];
extern short screenpeek;
extern int zoom;
#define STAT_DAMAGE_LIST_SIZE 20
extern int16_t StatDamageList[STAT_DAMAGE_LIST_SIZE];
@ -2086,7 +2084,6 @@ int BunnyHatch2(short Weapon); // bunny.c
int DoSkullBeginDeath(int16_t SpriteNum); // skull.c
void TerminateLevel(void); // game.c
void drawoverheadmap(int cposx,int cposy,int czoom,short cang); // game.c
void DrawMenuLevelScreen(void); // game.c
void DebugWriteString(char *string); // game.c

View file

@ -107,12 +107,6 @@ static void getinput(InputPacket *loc)
if (paused)
return;
// If in 2D follow mode, scroll around using glob vars
// Tried calling this in domovethings, but key response it too poor, skips key presses
// Note: this get called only during follow mode
if (automapFollow && automapMode != am_off && pp == Player + myconnectindex && !Prediction)
MoveScrollMode2D(Player + myconnectindex);
// !JIM! Added M_Active() so that you don't move at all while using menus
if (M_Active() || (automapFollow && automapMode != am_off))
return;

View file

@ -1,378 +0,0 @@
//-------------------------------------------------------------------------
/*
Copyright (C) 1997, 2005 - 3D Realms Entertainment
This file is part of Shadow Warrior version 1.2
Shadow Warrior is free software; you can redistribute it and/or
modify it under the terms of the GNU General Public License
as published by the Free Software Foundation; either version 2
of the License, or (at your option) any later version.
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.
Original Source: 1997 - Frank Maddin and Jim Norwood
Prepared for public release: 03/28/2005 - Charlie Wiederhold, 3D Realms
*/
//-------------------------------------------------------------------------
#include "ns.h"
#include "build.h"
#include "game.h"
#include "menus.h"
#include "network.h"
#include "pal.h"
#include "v_draw.h"
BEGIN_SW_NS
extern SWBOOL mapcheat;
enum
{
MAP_WHITE_SECTOR = (LT_GREY + 2),
MAP_RED_SECTOR = (RED + 6),
MAP_FLOOR_SPRITE = (RED + 8),
MAP_ENEMY = (RED + 10),
MAP_SPRITE = (FIRE + 8),
MAP_PLAYER = (GREEN + 6),
MAP_BLOCK_SPRITE = (DK_BLUE + 6),
};
void drawoverheadmap(int cposx, int cposy, int czoom, short cang)
{
int i, j, k, l, x1, y1, x2, y2, x3, y3, x4, y4, ox, oy, xoff, yoff;
int dax, day, cosang, sinang, xspan, yspan, sprx, spry;
int xrepeat, yrepeat, z1, z2, startwall, endwall, tilenum, daang;
int xvect, yvect, xvect2, yvect2;
char col;
walltype *wal, *wal2;
spritetype *spr;
short p;
static int pspr_ndx[8]= {0,0,0,0,0,0,0,0};
SWBOOL sprisplayer = FALSE;
short txt_x, txt_y;
int32_t tmpydim = (xdim * 5) / 8;
renderSetAspect(65536, divscale16(tmpydim * 320, xdim * 200));
xvect = sintable[(2048 - cang) & 2047] * czoom;
yvect = sintable[(1536 - cang) & 2047] * czoom;
xvect2 = mulscale16(xvect, yxaspect);
yvect2 = mulscale16(yvect, yxaspect);
// Draw red lines
for (i = 0; i < numsectors; i++)
{
startwall = sector[i].wallptr;
endwall = sector[i].wallptr + sector[i].wallnum - 1;
z1 = sector[i].ceilingz;
z2 = sector[i].floorz;
for (j = startwall, wal = &wall[startwall]; j <= endwall; j++, wal++)
{
k = wal->nextwall;
if ((unsigned)k >= MAXWALLS)
continue;
if (!mapcheat)
{
if ((show2dwall[j >> 3] & (1 << (j & 7))) == 0)
continue;
if ((k > j) && ((show2dwall[k >> 3] & (1 << (k & 7))) > 0))
continue;
}
if (sector[wal->nextsector].ceilingz == z1)
if (sector[wal->nextsector].floorz == z2)
if (((wal->cstat | wall[wal->nextwall].cstat) & (16 + 32)) == 0)
continue;
col = 152;
if (automapMode == am_full)
{
if (sector[i].floorz != sector[i].ceilingz)
if (sector[wal->nextsector].floorz != sector[wal->nextsector].ceilingz)
if (((wal->cstat | wall[wal->nextwall].cstat) & (16 + 32)) == 0)
if (sector[i].floorz == sector[wal->nextsector].floorz)
continue;
if (sector[i].floorpicnum != sector[wal->nextsector].floorpicnum)
continue;
if (sector[i].floorshade != sector[wal->nextsector].floorshade)
continue;
col = 12; // 1=white / 31=black / 44=green / 56=pink / 128=yellow / 210=blue / 248=orange / 255=purple
}
ox = wal->x - cposx;
oy = wal->y - cposy;
x1 = mulscale16(ox, xvect) - mulscale16(oy, yvect);
y1 = mulscale16(oy, xvect2) + mulscale16(ox, yvect2);
wal2 = &wall[wal->point2];
ox = wal2->x - cposx;
oy = wal2->y - cposy;
x2 = mulscale16(ox, xvect) - mulscale16(oy, yvect);
y2 = mulscale16(oy, xvect2) + mulscale16(ox, yvect2);
renderDrawLine(x1 + (xdim << 11), y1 + (ydim << 11), x2 + (xdim << 11), y2 + (ydim << 11), col);
}
}
// Draw sprites
k = Player[screenpeek].PlayerSprite;
for (i = 0; i < numsectors; i++)
for (j = headspritesect[i]; j >= 0; j = nextspritesect[j])
{
for (p=connecthead; p >= 0; p=connectpoint2[p])
{
if (Player[p].PlayerSprite == j)
{
if (sprite[Player[p].PlayerSprite].xvel > 16)
pspr_ndx[myconnectindex] = ((PlayClock >> 4)&3);
sprisplayer = TRUE;
goto SHOWSPRITE;
}
}
if (mapcheat || (show2dsprite[j >> 3] & (1 << (j & 7))) > 0)
{
SHOWSPRITE:
spr = &sprite[j];
col = 56; // 1=white / 31=black / 44=green / 56=pink / 128=yellow / 210=blue / 248=orange / 255=purple
if ((spr->cstat & 1) > 0)
col = 248;
if (j == k)
col = 31;
sprx = spr->x;
spry = spr->y;
k = spr->statnum;
if ((k >= 1) && (k <= 8) && (k != 2)) // Interpolate moving
{
sprx = sprite[j].x;
spry = sprite[j].y;
}
switch (spr->cstat & 48)
{
case 0: // Regular sprite
if (Player[p].PlayerSprite == j)
{
ox = sprx - cposx;
oy = spry - cposy;
x1 = mulscale16(ox, xvect) - mulscale16(oy, yvect);
y1 = mulscale16(oy, xvect2) + mulscale16(ox, yvect2);
if (automapMode == am_overlay && (gNet.MultiGameType != MULTI_GAME_COMMBAT || j == Player[screenpeek].PlayerSprite))
{
ox = (sintable[(spr->ang + 512) & 2047] >> 7);
oy = (sintable[(spr->ang) & 2047] >> 7);
x2 = mulscale16(ox, xvect) - mulscale16(oy, yvect);
y2 = mulscale16(oy, xvect) + mulscale16(ox, yvect);
if (j == Player[screenpeek].PlayerSprite)
{
x2 = 0L;
y2 = -(czoom << 5);
}
x3 = mulscale16(x2, yxaspect);
y3 = mulscale16(y2, yxaspect);
renderDrawLine(x1 - x2 + (xdim << 11), y1 - y3 + (ydim << 11),
x1 + x2 + (xdim << 11), y1 + y3 + (ydim << 11), col);
renderDrawLine(x1 - y2 + (xdim << 11), y1 + x3 + (ydim << 11),
x1 + x2 + (xdim << 11), y1 + y3 + (ydim << 11), col);
renderDrawLine(x1 + y2 + (xdim << 11), y1 - x3 + (ydim << 11),
x1 + x2 + (xdim << 11), y1 + y3 + (ydim << 11), col);
}
else
{
if (((gotsector[i >> 3] & (1 << (i & 7))) > 0) && (czoom > 192))
{
daang = (spr->ang - cang) & 2047;
if (j == Player[screenpeek].PlayerSprite)
{
x1 = 0;
//y1 = (yxaspect << 2);
y1 = 0;
daang = 0;
}
// Special case tiles
if (spr->picnum == 3123) break;
int spnum = -1;
if (sprisplayer)
{
if (gNet.MultiGameType != MULTI_GAME_COMMBAT || j == Player[screenpeek].PlayerSprite)
spnum = 1196 + pspr_ndx[myconnectindex];
}
else spnum = spr->picnum;
double xd = ((x1 << 4) + (xdim << 15)) / 65536.;
double yd = ((y1 << 4) + (ydim << 15)) / 65536.;
double sc = mulscale16(czoom * (spr->yrepeat), yxaspect) / 65536.;
if (spnum >= 0)
{
DrawTexture(twod, tileGetTexture(5407, true), xd, yd, DTA_FullscreenScale, FSMode_Fit320x200,
DTA_CenterOffsetRel, true, DTA_TranslationIndex, TRANSLATION(Translation_Remap, spr->pal), DTA_Color, shadeToLight(spr->shade),
DTA_Alpha, (spr->cstat & 2) ? 0.33 : 1., TAG_DONE);
}
}
}
}
break;
case 16: // Rotated sprite
x1 = sprx;
y1 = spry;
tilenum = spr->picnum;
xoff = (int)tileLeftOffset(tilenum) + (int)spr->xoffset;
if ((spr->cstat & 4) > 0)
xoff = -xoff;
k = spr->ang;
l = spr->xrepeat;
dax = sintable[k & 2047] * l;
day = sintable[(k + 1536) & 2047] * l;
l = tilesiz[tilenum].x;
k = (l >> 1) + xoff;
x1 -= mulscale16(dax, k);
x2 = x1 + mulscale16(dax, l);
y1 -= mulscale16(day, k);
y2 = y1 + mulscale16(day, l);
ox = x1 - cposx;
oy = y1 - cposy;
x1 = mulscale16(ox, xvect) - mulscale16(oy, yvect);
y1 = mulscale16(oy, xvect2) + mulscale16(ox, yvect2);
ox = x2 - cposx;
oy = y2 - cposy;
x2 = mulscale16(ox, xvect) - mulscale16(oy, yvect);
y2 = mulscale16(oy, xvect2) + mulscale16(ox, yvect2);
renderDrawLine(x1 + (xdim << 11), y1 + (ydim << 11),
x2 + (xdim << 11), y2 + (ydim << 11), col);
break;
case 32: // Floor sprite
if (automapMode == am_overlay)
{
tilenum = spr->picnum;
xoff = (int)tileLeftOffset(tilenum) + (int)spr->xoffset;
yoff = (int)tileTopOffset(tilenum) + (int)spr->yoffset;
if ((spr->cstat & 4) > 0)
xoff = -xoff;
if ((spr->cstat & 8) > 0)
yoff = -yoff;
k = spr->ang;
cosang = sintable[(k + 512) & 2047];
sinang = sintable[k];
xspan = tilesiz[tilenum].x;
xrepeat = spr->xrepeat;
yspan = tilesiz[tilenum].y;
yrepeat = spr->yrepeat;
dax = ((xspan >> 1) + xoff) * xrepeat;
day = ((yspan >> 1) + yoff) * yrepeat;
x1 = sprx + mulscale16(sinang, dax) + mulscale16(cosang, day);
y1 = spry + mulscale16(sinang, day) - mulscale16(cosang, dax);
l = xspan * xrepeat;
x2 = x1 - mulscale16(sinang, l);
y2 = y1 + mulscale16(cosang, l);
l = yspan * yrepeat;
k = -mulscale16(cosang, l);
x3 = x2 + k;
x4 = x1 + k;
k = -mulscale16(sinang, l);
y3 = y2 + k;
y4 = y1 + k;
ox = x1 - cposx;
oy = y1 - cposy;
x1 = mulscale16(ox, xvect) - mulscale16(oy, yvect);
y1 = mulscale16(oy, xvect2) + mulscale16(ox, yvect2);
ox = x2 - cposx;
oy = y2 - cposy;
x2 = mulscale16(ox, xvect) - mulscale16(oy, yvect);
y2 = mulscale16(oy, xvect2) + mulscale16(ox, yvect2);
ox = x3 - cposx;
oy = y3 - cposy;
x3 = mulscale16(ox, xvect) - mulscale16(oy, yvect);
y3 = mulscale16(oy, xvect2) + mulscale16(ox, yvect2);
ox = x4 - cposx;
oy = y4 - cposy;
x4 = mulscale16(ox, xvect) - mulscale16(oy, yvect);
y4 = mulscale16(oy, xvect2) + mulscale16(ox, yvect2);
renderDrawLine(x1 + (xdim << 11), y1 + (ydim << 11),
x2 + (xdim << 11), y2 + (ydim << 11), col);
renderDrawLine(x2 + (xdim << 11), y2 + (ydim << 11),
x3 + (xdim << 11), y3 + (ydim << 11), col);
renderDrawLine(x3 + (xdim << 11), y3 + (ydim << 11),
x4 + (xdim << 11), y4 + (ydim << 11), col);
renderDrawLine(x4 + (xdim << 11), y4 + (ydim << 11),
x1 + (xdim << 11), y1 + (ydim << 11), col);
}
break;
}
}
}
// Draw white lines
for (i = 0; i < numsectors; i++)
{
startwall = sector[i].wallptr;
endwall = sector[i].wallptr + sector[i].wallnum - 1;
for (j = startwall, wal = &wall[startwall]; j <= endwall; j++, wal++)
{
if ((uint16_t)wal->nextwall < MAXWALLS)
continue;
if (!mapcheat && (show2dwall[j >> 3] & (1 << (j & 7))) == 0)
continue;
if (!tileGetTexture(wal->picnum)->isValid()) continue;
ox = wal->x - cposx;
oy = wal->y - cposy;
x1 = mulscale16(ox, xvect) - mulscale16(oy, yvect);
y1 = mulscale16(oy, xvect2) + mulscale16(ox, yvect2);
wal2 = &wall[wal->point2];
ox = wal2->x - cposx;
oy = wal2->y - cposy;
x2 = mulscale16(ox, xvect) - mulscale16(oy, yvect);
y2 = mulscale16(oy, xvect2) + mulscale16(ox, yvect2);
renderDrawLine(x1 + (xdim << 11), y1 + (ydim << 11), x2 + (xdim << 11), y2 + (ydim << 11), 24);
}
}
videoSetCorrectedAspect();
}
END_SW_NS

View file

@ -126,7 +126,6 @@ extern SWBOOL DebugOperate;
//unsigned char synctics, lastsynctics;
int zoom;
int ChopTics;
PLAYER Player[MAX_SW_PLAYERS_REG + 1];
@ -2434,94 +2433,6 @@ void PlayerCheckValidMove(PLAYERp pp)
}
}
void
MoveScrollMode2D(PLAYERp pp)
{
#define TURBOTURNTIME (120/8)
#define NORMALTURN (12+6)
#define RUNTURN (28)
#define PREAMBLETURN 3
#define NORMALKEYMOVE 35
#define MAXVEL ((NORMALKEYMOVE*2)+10)
#define MAXSVEL ((NORMALKEYMOVE*2)+10)
#define MAXANGVEL 100
ControlInfo scrl_input;
int32_t keymove;
int32_t momx, momy;
static int mfvel=0, mfsvel=0;
CONTROL_GetInput(&scrl_input);
mfsvel = mfvel = 0;
if (M_Active())
return;
if (buttonMap.ButtonDown(gamefunc_Strafe))
mfsvel -= scrl_input.dyaw / 4;
mfsvel -= scrl_input.dx / 4;
mfvel = -scrl_input.dz /4;
keymove = NORMALKEYMOVE;
if (buttonMap.ButtonDown(gamefunc_Turn_Left))
{
mfsvel -= -keymove;
}
if (buttonMap.ButtonDown(gamefunc_Turn_Right))
{
mfsvel -= keymove;
}
if (buttonMap.ButtonDown(gamefunc_Strafe_Left))
{
mfsvel += keymove;
}
if (buttonMap.ButtonDown(gamefunc_Strafe_Right))
{
mfsvel += -keymove;
}
if (buttonMap.ButtonDown(gamefunc_Move_Forward))
{
mfvel += keymove;
}
if (buttonMap.ButtonDown(gamefunc_Move_Backward))
{
mfvel += -keymove;
}
if (mfvel < -MAXVEL)
mfvel = -MAXVEL;
if (mfvel > MAXVEL)
mfvel = MAXVEL;
if (mfsvel < -MAXSVEL)
mfsvel = -MAXSVEL;
if (mfsvel > MAXSVEL)
mfsvel = MAXSVEL;
momx = mulscale9(mfvel, sintable[NORM_ANGLE(FixedToInt(pp->q16ang) + 512)]);
momy = mulscale9(mfvel, sintable[NORM_ANGLE(FixedToInt(pp->q16ang))]);
momx += mulscale9(mfsvel, sintable[NORM_ANGLE(FixedToInt(pp->q16ang))]);
momy += mulscale9(mfsvel, sintable[NORM_ANGLE(FixedToInt(pp->q16ang) + 1536)]);
//mfvel = momx;
//mfsvel = momy;
Follow_posx += momx;
Follow_posy += momy;
Follow_posx = max(Follow_posx, x_min_bound);
Follow_posy = max(Follow_posy, y_min_bound);
Follow_posx = min(Follow_posx, x_max_bound);
Follow_posy = min(Follow_posy, y_max_bound);
}
void PlayerSectorBound(PLAYERp pp, int amt)
{
if (pp->cursectnum < 9)