mirror of
https://github.com/ZDoom/raze-gles.git
synced 2024-12-27 20:20:40 +00:00
- removed all remains of projection math weirdness from the automap code in the games plus a bit more cleanup of the engine code.
This commit is contained in:
parent
022edd2dc2
commit
d8627a2b3f
12 changed files with 68 additions and 185 deletions
|
@ -48,11 +48,6 @@ enum
|
|||
|
||||
MAXVOXMIPS = 5,
|
||||
|
||||
MAXXDIM = 7680,
|
||||
MAXYDIM = 3200,
|
||||
MINXDIM = 640,
|
||||
MINYDIM = 480,
|
||||
|
||||
MAXWALLSB = ((MAXWALLS >> 2) + (MAXWALLS >> 3)),
|
||||
|
||||
MAXVOXELS = 1024,
|
||||
|
@ -100,24 +95,11 @@ enum {
|
|||
};
|
||||
|
||||
|
||||
enum {
|
||||
SPR_XFLIP = 4,
|
||||
SPR_YFLIP = 8,
|
||||
|
||||
SPR_WALL = 16,
|
||||
SPR_FLOOR = 32,
|
||||
SPR_ALIGN_MASK = 32+16,
|
||||
};
|
||||
|
||||
#include "buildtypes.h"
|
||||
|
||||
using usectortype = sectortype;
|
||||
using uwalltype = walltype;
|
||||
using uspritetype = spritetype;
|
||||
|
||||
using uspriteptr_t = uspritetype const *;
|
||||
using uwallptr_t = uwalltype const *;
|
||||
using usectorptr_t = usectortype const *;
|
||||
using uspriteptr_t = spritetype const *;
|
||||
using uwallptr_t = walltype const *;
|
||||
using usectorptr_t = sectortype const *;
|
||||
using tspriteptr_t = tspritetype *;
|
||||
|
||||
|
||||
|
@ -150,17 +132,11 @@ typedef struct {
|
|||
#define SPREXT_TSPRACCESS 16
|
||||
#define SPREXT_TEMPINVISIBLE 32
|
||||
|
||||
#define NEG_ALPHA_TO_BLEND(alpha, blend, orientation) do { \
|
||||
if ((alpha) < 0) { (blend) = -(alpha); (alpha) = 0; (orientation) |= RS_TRANS1; } \
|
||||
} while (0)
|
||||
|
||||
// using the clipdist field
|
||||
enum
|
||||
{
|
||||
TSPR_FLAGS_MDHACK = 1u<<0u,
|
||||
TSPR_FLAGS_DRAW_LAST = 1u<<1u,
|
||||
TSPR_FLAGS_NO_SHADOW = 1u<<2u,
|
||||
TSPR_FLAGS_INVISIBLE_WITH_SHADOW = 1u<<3u,
|
||||
};
|
||||
|
||||
EXTERN int32_t guniqhudid;
|
||||
|
@ -176,25 +152,6 @@ struct usermaphack_t
|
|||
EXTERN spriteext_t *spriteext;
|
||||
EXTERN spritesmooth_t *spritesmooth;
|
||||
|
||||
// Wrapper that makes an array of pointers look like an array of references. (Refactoring helper.)
|
||||
|
||||
template<class T, int size>
|
||||
class ReferenceArray
|
||||
{
|
||||
T* data[size];
|
||||
public:
|
||||
T& operator[](size_t index)
|
||||
{
|
||||
assert(index < size);
|
||||
return *data[index];
|
||||
}
|
||||
|
||||
void set(int pos, T* spr)
|
||||
{
|
||||
data[pos] = spr;
|
||||
}
|
||||
};
|
||||
|
||||
EXTERN sectortype *sector;
|
||||
EXTERN walltype *wall;
|
||||
EXTERN spritetype *sprite;
|
||||
|
@ -222,7 +179,6 @@ static inline tspriteptr_t renderAddTSpriteFromSprite(uint16_t const spritenum)
|
|||
}
|
||||
|
||||
|
||||
EXTERN int16_t maskwall[MAXWALLSB], maskwallcnt;
|
||||
EXTERN tspriteptr_t tspriteptr[MAXSPRITESONSCREEN + 1];
|
||||
|
||||
EXTERN int32_t xdim, ydim;
|
||||
|
|
|
@ -25,9 +25,9 @@ void polymost_completeMirror();
|
|||
void polymost_precache(int32_t dapicnum, int32_t dapalnum, int32_t datype);
|
||||
void polymost_deletesprite(int num);
|
||||
|
||||
int32_t polymost_maskWallHasTranslucency(uwalltype const * const wall);
|
||||
int32_t polymost_spriteHasTranslucency(tspritetype const * const tspr);
|
||||
int32_t polymost_spriteIsModelOrVoxel(tspritetype const * const tspr);
|
||||
int32_t polymost_maskWallHasTranslucency(walltype const * const wall);
|
||||
int32_t polymost_spriteHasTranslucency(spritetype const * const tspr);
|
||||
int32_t polymost_spriteIsModelOrVoxel(spritetype const * const tspr);
|
||||
|
||||
void polymost_glreset(void);
|
||||
void polymost_scansector(int32_t sectnum);
|
||||
|
|
|
@ -27,41 +27,9 @@ static uint8_t clipignore[(MAXCLIPNUM+7)>>3];
|
|||
|
||||
int32_t quickloadboard=0;
|
||||
|
||||
static int32_t numclipmaps;
|
||||
|
||||
static int32_t numclipsects; // number in sectq[]
|
||||
static int16_t *sectoidx;
|
||||
static int16_t *sectq; // [numsectors]
|
||||
static int16_t pictoidx[MAXTILES]; // maps tile num to clipinfo[] index
|
||||
static int16_t *tempictoidx;
|
||||
|
||||
static usectortype *loadsector;
|
||||
static uwalltype *loadwall, *loadwallinv;
|
||||
static uspritetype *loadsprite;
|
||||
|
||||
vec2_t hitscangoal = { (1<<29)-1, (1<<29)-1 };
|
||||
int32_t hitallsprites = 0;
|
||||
|
||||
void engineInitClipMaps()
|
||||
{
|
||||
numclipmaps = 0;
|
||||
numclipsects = 0;
|
||||
|
||||
DO_FREE_AND_NULL(sectq);
|
||||
DO_FREE_AND_NULL(sectoidx);
|
||||
DO_FREE_AND_NULL(tempictoidx);
|
||||
DO_FREE_AND_NULL(loadsector);
|
||||
DO_FREE_AND_NULL(loadwall);
|
||||
DO_FREE_AND_NULL(loadwallinv);
|
||||
DO_FREE_AND_NULL(loadsprite);
|
||||
|
||||
// two's complement trick, -1 = 0xff
|
||||
memset(&pictoidx, -1, sizeof(pictoidx));
|
||||
|
||||
numsectors = 0;
|
||||
numwalls = 0;
|
||||
}
|
||||
|
||||
////////// CLIPMOVE //////////
|
||||
|
||||
int32_t clipmoveboxtracenum = 3;
|
||||
|
@ -530,7 +498,7 @@ int32_t clipmove(vec3_t * const pos, int16_t * const sectnum, int32_t xvect, int
|
|||
|
||||
if (clipyou)
|
||||
{
|
||||
int16_t const objtype = curspr ? (int16_t)(curspr - (uspritetype *)sprite) + 49152 : (int16_t)j + 32768;
|
||||
int16_t const objtype = curspr ? (int16_t)(curspr - sprite) + 49152 : (int16_t)j + 32768;
|
||||
|
||||
//Add 2 boxes at endpoints
|
||||
int32_t bsz = walldist; if (diff.x < 0) bsz = -bsz;
|
||||
|
@ -1214,22 +1182,22 @@ static int32_t hitscan_trysector(const vec3_t *sv, usectorptr_t sec, hitdata_t *
|
|||
{
|
||||
if (tmp==NULL)
|
||||
{
|
||||
if (inside(x1,y1,sec-(usectortype *)sector) == 1)
|
||||
if (inside(x1,y1,sec-sector) == 1)
|
||||
{
|
||||
hit_set(hit, sec-(usectortype *)sector, -1, -1, x1, y1, z1);
|
||||
hit_set(hit, sec-sector, -1, -1, x1, y1, z1);
|
||||
hitscan_hitsectcf = (how+1)>>1;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
const int32_t curidx=(int32_t)tmp[0];
|
||||
auto const curspr=(uspritetype *)tmp[1];
|
||||
auto const curspr=(spritetype *)tmp[1];
|
||||
const int32_t thislastsec = tmp[2];
|
||||
|
||||
if (!thislastsec)
|
||||
{
|
||||
if (inside(x1,y1,sec-(usectortype *)sector) == 1)
|
||||
hit_set(hit, curspr->sectnum, -1, curspr-(uspritetype *)sprite, x1, y1, z1);
|
||||
if (inside(x1,y1,sec-sector) == 1)
|
||||
hit_set(hit, curspr->sectnum, -1, curspr-sprite, x1, y1, z1);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -161,7 +161,6 @@ int16_t globalpicnum;
|
|||
|
||||
static int32_t globaly1, globalx2;
|
||||
|
||||
int16_t sectorborder[256];
|
||||
int16_t pointhighlight=-1, linehighlight=-1, highlightcnt=0;
|
||||
|
||||
static int16_t numhits;
|
||||
|
@ -1526,35 +1525,10 @@ int findwallbetweensectors(int sect1, int sect2)
|
|||
//
|
||||
void updatesector(int32_t const x, int32_t const y, int16_t * const sectnum)
|
||||
{
|
||||
#if 0
|
||||
if (enginecompatibility_mode != ENGINECOMPATIBILITY_NONE)
|
||||
{
|
||||
if (inside_p(x, y, *sectnum))
|
||||
return;
|
||||
|
||||
if ((unsigned)*sectnum < (unsigned)numsectors)
|
||||
{
|
||||
const uwalltype *wal = (uwalltype *)&wall[sector[*sectnum].wallptr];
|
||||
int wallsleft = sector[*sectnum].wallnum;
|
||||
|
||||
do
|
||||
{
|
||||
int const next = wal->nextsector;
|
||||
if (inside_p(x, y, next))
|
||||
SET_AND_RETURN(*sectnum, next);
|
||||
wal++;
|
||||
}
|
||||
while (--wallsleft);
|
||||
}
|
||||
}
|
||||
else
|
||||
#endif
|
||||
{
|
||||
int16_t sect = *sectnum;
|
||||
updatesectorneighbor(x, y, §, INITIALUPDATESECTORDIST, MAXUPDATESECTORDIST);
|
||||
if (sect != -1)
|
||||
SET_AND_RETURN(*sectnum, sect);
|
||||
}
|
||||
int16_t sect = *sectnum;
|
||||
updatesectorneighbor(x, y, §, INITIALUPDATESECTORDIST, MAXUPDATESECTORDIST);
|
||||
if (sect != -1)
|
||||
SET_AND_RETURN(*sectnum, sect);
|
||||
|
||||
// we need to support passing in a sectnum of -1, unfortunately
|
||||
|
||||
|
@ -1570,7 +1544,6 @@ void updatesector(int32_t const x, int32_t const y, int16_t * const sectnum)
|
|||
// as starting sector and the 'initial' z check is skipped
|
||||
// (not initial anymore because it follows the sector updating due to TROR)
|
||||
|
||||
// NOTE: This comes from Duke, therefore it's GPL!
|
||||
void updatesectorz(int32_t const x, int32_t const y, int32_t const z, int16_t * const sectnum)
|
||||
{
|
||||
if (enginecompatibility_mode != ENGINECOMPATIBILITY_NONE)
|
||||
|
@ -1593,7 +1566,7 @@ void updatesectorz(int32_t const x, int32_t const y, int32_t const z, int16_t *
|
|||
if (inside_p(x, y, *sectnum))
|
||||
return;
|
||||
|
||||
uwalltype const * wal = (uwalltype *)&wall[sector[*sectnum].wallptr];
|
||||
walltype const * wal = &wall[sector[*sectnum].wallptr];
|
||||
int wallsleft = sector[*sectnum].wallnum;
|
||||
do
|
||||
{
|
||||
|
@ -1733,32 +1706,11 @@ void videoSetViewableArea(int32_t x1, int32_t y1, int32_t x2, int32_t y2)
|
|||
ydimen = (y2-y1)+1;
|
||||
|
||||
fxdimen = (float) xdimen;
|
||||
#ifdef USE_OPENGL
|
||||
fydimen = (float) ydimen;
|
||||
#endif
|
||||
videoSetCorrectedAspect();
|
||||
}
|
||||
|
||||
|
||||
//
|
||||
// setaspect
|
||||
//
|
||||
void renderSetAspect(int32_t daxrange, int32_t daaspect)
|
||||
{
|
||||
if (daxrange == 65536) daxrange--; // This doesn't work correctly with 65536. All other values are fine. No idea where this is evaluated wrong.
|
||||
viewingrange = daxrange;
|
||||
viewingrangerecip = DivScale(1,daxrange, 32);
|
||||
#ifdef USE_OPENGL
|
||||
fviewingrange = (float) daxrange;
|
||||
#endif
|
||||
|
||||
yxaspect = daaspect;
|
||||
xyaspect = DivScale(1,yxaspect, 32);
|
||||
xdimenscale = Scale(xdimen,yxaspect,320);
|
||||
xdimscale = Scale(320,xyaspect,xdimen);
|
||||
}
|
||||
|
||||
|
||||
|
||||
#include "v_2ddrawer.h"
|
||||
|
||||
|
|
|
@ -13,7 +13,6 @@
|
|||
#ifndef ENGINE_PRIV_H
|
||||
#define ENGINE_PRIV_H
|
||||
|
||||
extern int16_t maskwall[MAXWALLSB], maskwallcnt;
|
||||
extern tspriteptr_t tspriteptr[MAXSPRITESONSCREEN + 1];
|
||||
extern int32_t xdimen, xdimenscale, xdimscale, ydimen;
|
||||
extern float fxdimen;
|
||||
|
@ -31,7 +30,6 @@ extern int32_t globalorientation;
|
|||
|
||||
extern char inpreparemirror;
|
||||
|
||||
extern int16_t sectorborder[256];
|
||||
extern int32_t hitallsprites;
|
||||
|
||||
int32_t animateoffs(int tilenum, int fakevar);
|
||||
|
|
|
@ -49,6 +49,8 @@ static int16_t bunchp2[MAXWALLSB], thesector[MAXWALLSB];
|
|||
static int16_t bunchfirst[MAXWALLSB], bunchlast[MAXWALLSB];
|
||||
static float rollang;
|
||||
static int16_t numscans, numbunches;
|
||||
static int16_t maskwall[MAXWALLSB], maskwallcnt;
|
||||
static int16_t sectorborder[256];
|
||||
|
||||
|
||||
|
||||
|
@ -250,7 +252,7 @@ static int32_t pow2xsplit = 0, skyzbufferhack = 0, flatskyrender = 0;
|
|||
static float drawpoly_alpha = 0.f;
|
||||
static uint8_t drawpoly_blend = 0;
|
||||
|
||||
int32_t polymost_maskWallHasTranslucency(uwalltype const * const wall)
|
||||
int32_t polymost_maskWallHasTranslucency(walltype const * const wall)
|
||||
{
|
||||
if (wall->cstat & CSTAT_WALL_TRANSLUCENT)
|
||||
return true;
|
||||
|
@ -258,7 +260,7 @@ int32_t polymost_maskWallHasTranslucency(uwalltype const * const wall)
|
|||
return checkTranslucentReplacement(tileGetTexture(wall->picnum)->GetID(), wall->pal);
|
||||
}
|
||||
|
||||
int32_t polymost_spriteHasTranslucency(tspritetype const * const tspr)
|
||||
int32_t polymost_spriteHasTranslucency(spritetype const * const tspr)
|
||||
{
|
||||
if ((tspr->cstat & CSTAT_SPRITE_TRANSLUCENT) || (tspr->clipdist & TSPR_FLAGS_DRAW_LAST) ||
|
||||
((unsigned)tspr->owner < MAXSPRITES && spriteext[tspr->owner].alpha))
|
||||
|
@ -2604,7 +2606,7 @@ void polymost_deletesprite(int num)
|
|||
static inline int32_t polymost_findwall(tspritetype const * const tspr, vec2_t const * const tsiz, int32_t * rd)
|
||||
{
|
||||
int32_t dist = 4, closest = -1;
|
||||
auto const sect = (usectortype * )§or[tspr->sectnum];
|
||||
auto const sect = §or[tspr->sectnum];
|
||||
vec2_t n;
|
||||
|
||||
for (bssize_t i=sect->wallptr; i<sect->wallptr + sect->wallnum; i++)
|
||||
|
@ -3610,7 +3612,7 @@ void renderDrawMasks(void)
|
|||
maskwallcnt = 0;
|
||||
for (i = 0; i < numMaskWalls; i++)
|
||||
{
|
||||
if (Polymost::polymost_maskWallHasTranslucency((uwalltype*)&wall[thewall[maskwall[i]]]))
|
||||
if (Polymost::polymost_maskWallHasTranslucency(&wall[thewall[maskwall[i]]]))
|
||||
{
|
||||
maskwall[maskwallcnt] = maskwall[i];
|
||||
maskwallcnt++;
|
||||
|
@ -3779,3 +3781,21 @@ void videoSetCorrectedAspect()
|
|||
renderSetAspect(vr, yx);
|
||||
}
|
||||
|
||||
|
||||
//
|
||||
// setaspect
|
||||
//
|
||||
void renderSetAspect(int32_t daxrange, int32_t daaspect)
|
||||
{
|
||||
if (daxrange == 65536) daxrange--; // This doesn't work correctly with 65536. All other values are fine. No idea where this is evaluated wrong.
|
||||
viewingrange = daxrange;
|
||||
viewingrangerecip = DivScale(1, daxrange, 32);
|
||||
fviewingrange = (float)daxrange;
|
||||
|
||||
yxaspect = daaspect;
|
||||
xyaspect = DivScale(1, yxaspect, 32);
|
||||
xdimenscale = Scale(xdimen, yxaspect, 320);
|
||||
xdimscale = Scale(320, xyaspect, xdimen);
|
||||
}
|
||||
|
||||
|
||||
|
|
|
@ -157,7 +157,6 @@ void hudDraw(PLAYER *gView, int nSectnum, double bobx, double boby, double zDelt
|
|||
{
|
||||
DoLensEffect();
|
||||
viewingRange = viewingrange;
|
||||
yxAspect = yxaspect;
|
||||
r otatesprite(IntToFixed(280), IntToFixed(35), 53248, 512, 4077, v10, v14, 512 + 6, gViewX0, gViewY0, gViewX1, gViewY1);
|
||||
r otatesprite(IntToFixed(280), IntToFixed(35), 53248, 0, 1683, v10, 0, 512 + 35, gViewX0, gViewY0, gViewX1, gViewY1);
|
||||
}
|
||||
|
|
|
@ -868,8 +868,6 @@ bool GameInterface::DrawAutomapPlayer(int x, int y, int z, int a, double const s
|
|||
// [MR]: Confirm that this is correct as math doesn't match the variable names.
|
||||
int nCos = z * -bsin(a);
|
||||
int nSin = z * -bcos(a);
|
||||
int nCos2 = MulScale(nCos, yxaspect, 16);
|
||||
int nSin2 = MulScale(nSin, yxaspect, 16);
|
||||
int nPSprite = gView->pSprite->index;
|
||||
|
||||
for (int i = connecthead; i >= 0; i = connectpoint2[i])
|
||||
|
@ -886,7 +884,7 @@ bool GameInterface::DrawAutomapPlayer(int x, int y, int z, int a, double const s
|
|||
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);
|
||||
int nScale = (pSprite->yrepeat + ((floorZ - nBottom) >> 8)) * z;
|
||||
nScale = ClipRange(nScale, 8000, 65536 << 1);
|
||||
// Players on automap
|
||||
double x = xdim / 2. + x1 / double(1 << 12);
|
||||
|
|
|
@ -399,15 +399,13 @@ bool GameInterface::DrawAutomapPlayer(int cposx, int cposy, int czoom, int 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, tilenum, daang;
|
||||
int xvect, yvect, xvect2, yvect2;
|
||||
int xvect, yvect;
|
||||
int p;
|
||||
PalEntry col;
|
||||
spritetype* spr;
|
||||
|
||||
xvect = -bsin(cang) * czoom;
|
||||
yvect = -bcos(cang) * czoom;
|
||||
xvect2 = MulScale(xvect, yxaspect, 16);
|
||||
yvect2 = MulScale(yvect, yxaspect, 16);
|
||||
|
||||
//Draw sprites
|
||||
auto pactor = ps[screenpeek].GetActor();
|
||||
|
@ -435,15 +433,15 @@ bool GameInterface::DrawAutomapPlayer(int cposx, int cposy, int czoom, int cang,
|
|||
ox = sprx - cposx;
|
||||
oy = spry - cposy;
|
||||
x1 = DMulScale(ox, xvect, -oy, yvect, 16);
|
||||
y1 = DMulScale(oy, xvect2, ox, yvect2, 16);
|
||||
y1 = DMulScale(oy, xvect, ox, yvect, 16);
|
||||
|
||||
ox = bcos(spr->ang, -7);
|
||||
oy = bsin(spr->ang, -7);
|
||||
x2 = DMulScale(ox, xvect, -oy, yvect, 16);
|
||||
y2 = DMulScale(oy, xvect, ox, yvect, 16);
|
||||
|
||||
x3 = MulScale(x2, yxaspect, 16);
|
||||
y3 = MulScale(y2, yxaspect, 16);
|
||||
x3 = x2;
|
||||
y3 = y2;
|
||||
|
||||
drawlinergb(x1 - x2 + (xdim << 11), y1 - y3 + (ydim << 11),
|
||||
x1 + x2 + (xdim << 11), y1 + y3 + (ydim << 11), col);
|
||||
|
@ -475,12 +473,12 @@ bool GameInterface::DrawAutomapPlayer(int cposx, int cposy, int czoom, int cang,
|
|||
ox = x1 - cposx;
|
||||
oy = y1 - cposy;
|
||||
x1 = DMulScale(ox, xvect, -oy, yvect, 16);
|
||||
y1 = DMulScale(oy, xvect2, ox, yvect2, 16);
|
||||
y1 = DMulScale(oy, xvect, ox, yvect, 16);
|
||||
|
||||
ox = x2 - cposx;
|
||||
oy = y2 - cposy;
|
||||
x2 = DMulScale(ox, xvect, -oy, yvect, 16);
|
||||
y2 = DMulScale(oy, xvect2, ox, yvect2, 16);
|
||||
y2 = DMulScale(oy, xvect, ox, yvect, 16);
|
||||
|
||||
drawlinergb(x1 + (xdim << 11), y1 + (ydim << 11),
|
||||
x2 + (xdim << 11), y2 + (ydim << 11), col);
|
||||
|
@ -521,22 +519,22 @@ bool GameInterface::DrawAutomapPlayer(int cposx, int cposy, int czoom, int cang,
|
|||
ox = x1 - cposx;
|
||||
oy = y1 - cposy;
|
||||
x1 = DMulScale(ox, xvect, -oy, yvect, 16);
|
||||
y1 = DMulScale(oy, xvect2, ox, yvect2, 16);
|
||||
y1 = DMulScale(oy, xvect, ox, yvect, 16);
|
||||
|
||||
ox = x2 - cposx;
|
||||
oy = y2 - cposy;
|
||||
x2 = DMulScale(ox, xvect, -oy, yvect, 16);
|
||||
y2 = DMulScale(oy, xvect2, ox, yvect2, 16);
|
||||
y2 = DMulScale(oy, xvect, ox, yvect, 16);
|
||||
|
||||
ox = x3 - cposx;
|
||||
oy = y3 - cposy;
|
||||
x3 = DMulScale(ox, xvect, -oy, yvect, 16);
|
||||
y3 = DMulScale(oy, xvect2, ox, yvect2, 16);
|
||||
y3 = DMulScale(oy, xvect, ox, yvect, 16);
|
||||
|
||||
ox = x4 - cposx;
|
||||
oy = y4 - cposy;
|
||||
x4 = DMulScale(ox, xvect, -oy, yvect, 16);
|
||||
y4 = DMulScale(oy, xvect2, ox, yvect2, 16);
|
||||
y4 = DMulScale(oy, xvect, ox, yvect, 16);
|
||||
|
||||
drawlinergb(x1 + (xdim << 11), y1 + (ydim << 11),
|
||||
x2 + (xdim << 11), y2 + (ydim << 11), col);
|
||||
|
@ -571,7 +569,7 @@ bool GameInterface::DrawAutomapPlayer(int cposx, int cposy, int czoom, int cang,
|
|||
i = TILE_APLAYERTOP;
|
||||
|
||||
j = abs(pp.truefz - pp.posz) >> 8;
|
||||
j = MulScale(czoom * (pspr->yrepeat + j), yxaspect, 16);
|
||||
j = czoom * (pspr->yrepeat + j);
|
||||
|
||||
if (j < 22000) j = 22000;
|
||||
else if (j > (65536 << 1)) j = (65536 << 1);
|
||||
|
|
|
@ -77,8 +77,6 @@ bool GameInterface::DrawAutomapPlayer(int x, int y, int z, int a, double const s
|
|||
// [MR]: Confirm that this is correct as math doesn't match the variable names.
|
||||
int nCos = z * -bsin(a);
|
||||
int nSin = z * -bcos(a);
|
||||
int nCos2 = MulScale(nCos, yxaspect, 16);
|
||||
int nSin2 = MulScale(nSin, yxaspect, 16);
|
||||
|
||||
for (int i = connecthead; i >= 0; i = connectpoint2[i])
|
||||
{
|
||||
|
@ -94,7 +92,7 @@ bool GameInterface::DrawAutomapPlayer(int x, int y, int z, int a, double const s
|
|||
getzrange_old(pSprite->x, pSprite->y, pSprite->z, pSprite->sectnum, &ceilZ, &ceilHit, &floorZ, &floorHit, (pSprite->clipdist << 2) + 16, CLIPMASK0);
|
||||
int nTop, nBottom;
|
||||
GetSpriteExtents(pSprite, &nTop, &nBottom);
|
||||
int nScale = MulScale((pSprite->yrepeat + ((floorZ - nBottom) >> 8)) * z, yxaspect, 16);
|
||||
int nScale = (pSprite->yrepeat + ((floorZ - nBottom) >> 8)) * z;
|
||||
nScale = clamp(nScale, 8000, 65536 << 1);
|
||||
// Players on automap
|
||||
double x = xdim / 2. + x1 / double(1 << 12);
|
||||
|
|
|
@ -71,7 +71,7 @@ extern short f_c;
|
|||
|
||||
extern ParentalStruct aVoxelArray[MAXTILES];
|
||||
|
||||
int ConnectCopySprite(uspritetype const * tsp);
|
||||
int ConnectCopySprite(spritetype const * tsp);
|
||||
void PreDrawStackedWater(void);
|
||||
|
||||
void SW_InitMultiPsky(void)
|
||||
|
@ -794,8 +794,7 @@ analyzesprites(int viewx, int viewy, int viewz, bool mirror)
|
|||
|
||||
if (OverlapDraw && FAF_ConnectArea(tsp->sectnum) && tsp->owner >= 0)
|
||||
{
|
||||
static_assert(sizeof(uspritetype) == sizeof(tspritetype)); // see TSPRITE_SIZE
|
||||
ConnectCopySprite((uspriteptr_t)tsp);
|
||||
ConnectCopySprite(tsp);
|
||||
}
|
||||
|
||||
//
|
||||
|
@ -902,7 +901,6 @@ post_analyzesprites(void)
|
|||
{
|
||||
if (tu->ID == FIREBALL_FLAMES && tu->Attach >= 0)
|
||||
{
|
||||
//uspritetype * const atsp = &sprite[tu->Attach];
|
||||
tspriteptr_t const atsp = get_tsprite(tu->Attach);
|
||||
|
||||
if (!atsp)
|
||||
|
@ -1281,7 +1279,7 @@ PostDraw(void)
|
|||
}
|
||||
}
|
||||
|
||||
int CopySprite(uspritetype const * tsp, short newsector)
|
||||
int CopySprite(spritetype const * tsp, short newsector)
|
||||
{
|
||||
short New;
|
||||
SPRITEp sp;
|
||||
|
@ -1310,7 +1308,7 @@ int CopySprite(uspritetype const * tsp, short newsector)
|
|||
return New;
|
||||
}
|
||||
|
||||
int ConnectCopySprite(uspritetype const * tsp)
|
||||
int ConnectCopySprite(spritetype const * tsp)
|
||||
{
|
||||
short newsector;
|
||||
int testz;
|
||||
|
@ -1375,7 +1373,7 @@ void PreDrawStackedWater(void)
|
|||
sp = &sprite[i];
|
||||
u = User[i];
|
||||
|
||||
New = ConnectCopySprite((uspritetype const *)sp);
|
||||
New = ConnectCopySprite((spritetype const *)sp);
|
||||
if (New >= 0)
|
||||
{
|
||||
// spawn a user
|
||||
|
@ -1706,7 +1704,7 @@ bool GameInterface::DrawAutomapPlayer(int cposx, int cposy, int czoom, int 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;
|
||||
int xvect, yvect;
|
||||
walltype* wal, * wal2;
|
||||
spritetype* spr;
|
||||
short p;
|
||||
|
@ -1716,8 +1714,6 @@ bool GameInterface::DrawAutomapPlayer(int cposx, int cposy, int czoom, int cang,
|
|||
|
||||
xvect = -bsin(cang) * czoom;
|
||||
yvect = -bcos(cang) * czoom;
|
||||
xvect2 = MulScale(xvect, yxaspect, 16);
|
||||
yvect2 = MulScale(yvect, yxaspect, 16);
|
||||
|
||||
|
||||
// Draw sprites
|
||||
|
@ -1784,7 +1780,7 @@ bool GameInterface::DrawAutomapPlayer(int cposx, int cposy, int czoom, int cang,
|
|||
|
||||
double xd = ((x1 << 4) + (xdim << 15)) / 65536.;
|
||||
double yd = ((y1 << 4) + (ydim << 15)) / 65536.;
|
||||
double sc = MulScale(czoom * (spr->yrepeat), yxaspect, 16) / 32768.;
|
||||
double sc = czoom * (spr->yrepeat) / 32768.;
|
||||
if (spnum >= 0)
|
||||
{
|
||||
DrawTexture(twod, tileGetTexture(1196 + pspr_ndx[myconnectindex], true), xd, yd, DTA_ScaleX, sc, DTA_ScaleY, sc, DTA_Rotate, daang * (-360. / 2048),
|
||||
|
@ -1815,12 +1811,12 @@ bool GameInterface::DrawAutomapPlayer(int cposx, int cposy, int czoom, int cang,
|
|||
ox = x1 - cposx;
|
||||
oy = y1 - cposy;
|
||||
x1 = MulScale(ox, xvect, 16) - MulScale(oy, yvect, 16);
|
||||
y1 = MulScale(oy, xvect2, 16) + MulScale(ox, yvect2, 16);
|
||||
y1 = MulScale(oy, xvect, 16) + MulScale(ox, yvect, 16);
|
||||
|
||||
ox = x2 - cposx;
|
||||
oy = y2 - cposy;
|
||||
x2 = MulScale(ox, xvect, 16) - MulScale(oy, yvect, 16);
|
||||
y2 = MulScale(oy, xvect2, 16) + MulScale(ox, yvect2, 16);
|
||||
y2 = MulScale(oy, xvect, 16) + MulScale(ox, yvect, 16);
|
||||
|
||||
drawlinergb(x1 + (xdim << 11), y1 + (ydim << 11),
|
||||
x2 + (xdim << 11), y2 + (ydim << 11), col);
|
||||
|
@ -1863,22 +1859,22 @@ bool GameInterface::DrawAutomapPlayer(int cposx, int cposy, int czoom, int cang,
|
|||
ox = x1 - cposx;
|
||||
oy = y1 - cposy;
|
||||
x1 = MulScale(ox, xvect, 16) - MulScale(oy, yvect, 16);
|
||||
y1 = MulScale(oy, xvect2, 16) + MulScale(ox, yvect2, 16);
|
||||
y1 = MulScale(oy, xvect, 16) + MulScale(ox, yvect, 16);
|
||||
|
||||
ox = x2 - cposx;
|
||||
oy = y2 - cposy;
|
||||
x2 = MulScale(ox, xvect, 16) - MulScale(oy, yvect, 16);
|
||||
y2 = MulScale(oy, xvect2, 16) + MulScale(ox, yvect2, 16);
|
||||
y2 = MulScale(oy, xvect, 16) + MulScale(ox, yvect, 16);
|
||||
|
||||
ox = x3 - cposx;
|
||||
oy = y3 - cposy;
|
||||
x3 = MulScale(ox, xvect, 16) - MulScale(oy, yvect, 16);
|
||||
y3 = MulScale(oy, xvect2, 16) + MulScale(ox, yvect2, 16);
|
||||
y3 = MulScale(oy, xvect, 16) + MulScale(ox, yvect, 16);
|
||||
|
||||
ox = x4 - cposx;
|
||||
oy = y4 - cposy;
|
||||
x4 = MulScale(ox, xvect, 16) - MulScale(oy, yvect, 16);
|
||||
y4 = MulScale(oy, xvect2, 16) + MulScale(ox, yvect2, 16);
|
||||
y4 = MulScale(oy, xvect, 16) + MulScale(ox, yvect, 16);
|
||||
|
||||
drawlinergb(x1 + (xdim << 11), y1 + (ydim << 11),
|
||||
x2 + (xdim << 11), y2 + (ydim << 11), col);
|
||||
|
|
|
@ -639,7 +639,7 @@ TrackSetup(void)
|
|||
if (t->NumPoints == 0)
|
||||
{
|
||||
int i;
|
||||
auto const sp = (uspritetype const *)&sprite[StatIterator::First(STAT_TRACK+ndx)];
|
||||
auto const sp = (spritetype const *)&sprite[StatIterator::First(STAT_TRACK+ndx)];
|
||||
Printf("WARNING: Did not find first point of Track Number %d, x %d, y %d\n", ndx, sp->x, sp->y);
|
||||
StatIterator it(STAT_TRACK + ndx);
|
||||
while ((i = it.NextIndex()) >= 0)
|
||||
|
|
Loading…
Reference in a new issue