mirror of
https://github.com/ZDoom/raze-gles.git
synced 2024-11-10 23:02:03 +00:00
- cleaned out most of the software renderer's static global variables.
This commit is contained in:
parent
7392b699e4
commit
41545b644a
18 changed files with 26 additions and 751 deletions
|
@ -664,7 +664,6 @@ set (PCH_SOURCES
|
|||
build/src/compat.cpp
|
||||
build/src/defs.cpp
|
||||
build/src/engine.cpp
|
||||
build/src/glsurface.cpp
|
||||
build/src/hash.cpp
|
||||
build/src/hightile.cpp
|
||||
build/src/mdsprite.cpp
|
||||
|
|
|
@ -560,7 +560,6 @@ EXTERN int32_t g_visibility, parallaxvisibility;
|
|||
EXTERN uint8_t numalphatabs;
|
||||
|
||||
EXTERN vec2_t windowxy1, windowxy2;
|
||||
EXTERN TArray<int16_t> startumost, startdmost;
|
||||
|
||||
// The maximum tile offset ever used in any tiled parallaxed multi-sky.
|
||||
#define PSKYOFF_MAX 16
|
||||
|
@ -616,7 +615,6 @@ EXTERN int16_t headspritesect[MAXSECTORS+1], headspritestat[MAXSTATUS+1];
|
|||
EXTERN int16_t prevspritesect[MAXSPRITES], prevspritestat[MAXSPRITES];
|
||||
EXTERN int16_t nextspritesect[MAXSPRITES], nextspritestat[MAXSPRITES];
|
||||
|
||||
extern const char pow2char_[];
|
||||
static CONSTEXPR const int32_t pow2long[32] =
|
||||
{
|
||||
1, 2, 4, 8,
|
||||
|
|
|
@ -1,39 +0,0 @@
|
|||
/*
|
||||
* glsurface.h
|
||||
* A 32-bit rendering surface that can quickly blit 8-bit paletted buffers implemented in OpenGL.
|
||||
*
|
||||
* Copyright © 2018, Alex Dawson. All rights reserved.
|
||||
*/
|
||||
|
||||
#ifndef GLSURFACE_H_
|
||||
#define GLSURFACE_H_
|
||||
|
||||
#include "compat.h"
|
||||
|
||||
// Initialize the glsurface with the Software renderer's buffer resolution.
|
||||
// If the Software renderer's resolution and the actual resolution don't match,
|
||||
// glsurface will still render at the full size of the screen.
|
||||
// If a surface already exists, glsurface_destroy() will be automatically called before re-initializing.
|
||||
// Returns whether or not the glsurface could be successfully initialized.
|
||||
bool glsurface_initialize(vec2_t bufferResolution);
|
||||
|
||||
// Destroy an existing surface.
|
||||
void glsurface_destroy();
|
||||
|
||||
// Sets the palette to contain the RGBA byte buffer pointed to by pPalette.
|
||||
// If the surface is not initialized, the function returns immediately.
|
||||
void glsurface_setPalette(void* pPalette);
|
||||
|
||||
// Returns a pointer to the start of the surface's pixel buffer
|
||||
// Returns NULL if the surface is not initialized.
|
||||
void* glsurface_getBuffer();
|
||||
|
||||
// Returns the resolution of the surface's buffer
|
||||
vec2_t glsurface_getBufferResolution();
|
||||
|
||||
// Blit the surface's pixel buffer to the screen using the palette set with glsurface_setPalette().
|
||||
// Renders as soon as the data has been uploaded.
|
||||
// If the surface is not initialized, the function returns immediately.
|
||||
void glsurface_blitBuffer();
|
||||
|
||||
#endif /* GLSURFACE_H_ */
|
|
@ -49,7 +49,7 @@ struct palette_t
|
|||
typedef struct {
|
||||
uint8_t r, g, b;
|
||||
} rgb24_t;
|
||||
extern palette_t curpalette[256], curpalettefaded[256], palfadergb;
|
||||
extern palette_t curpalette[256], palfadergb;
|
||||
|
||||
extern unsigned char palfadedelta;
|
||||
void paletteMakeLookupTable(int32_t palnum, const char *remapbuf, uint8_t r, uint8_t g, uint8_t b, char noFloorPal);
|
||||
|
|
|
@ -20,7 +20,7 @@
|
|||
EDUKE32_SCALER_PRAGMA(25) EDUKE32_SCALER_PRAGMA(26) EDUKE32_SCALER_PRAGMA(27) EDUKE32_SCALER_PRAGMA(28) \
|
||||
EDUKE32_SCALER_PRAGMA(29) EDUKE32_SCALER_PRAGMA(30) EDUKE32_SCALER_PRAGMA(31)
|
||||
|
||||
extern int32_t reciptable[2048], fpuasm;
|
||||
extern int32_t reciptable[2048];
|
||||
|
||||
// break the C version of divscale out from the others
|
||||
// because asm version overflows in drawmapview()
|
||||
|
@ -154,20 +154,9 @@ static FORCE_INLINE void swapchar2(void *a, void *b, int32_t s)
|
|||
}
|
||||
#endif
|
||||
|
||||
static FORCE_INLINE CONSTEXPR char readpixel(void *s) { return *(char *)s; }
|
||||
|
||||
|
||||
#ifndef pragmas_have_klabs
|
||||
#if 0
|
||||
static FORCE_INLINE int32_t klabs(int32_t const a)
|
||||
{
|
||||
uint32_t const m = a >> (sizeof(uint32_t) * CHAR_BIT - 1);
|
||||
return (a ^ m) - m;
|
||||
}
|
||||
#else
|
||||
#define klabs(x) abs(x)
|
||||
#endif
|
||||
#endif
|
||||
#ifndef pragmas_have_ksgn
|
||||
static FORCE_INLINE CONSTEXPR int ksgn(int32_t a) { return (a > 0) - (a < 0); }
|
||||
#endif
|
||||
|
@ -185,25 +174,12 @@ void qinterpolatedown16(intptr_t bufptr, int32_t num, int32_t val, int32_t add);
|
|||
void qinterpolatedown16short(intptr_t bufptr, int32_t num, int32_t val, int32_t add);
|
||||
#endif
|
||||
|
||||
#ifndef pragmas_have_clearbuf
|
||||
void clearbuf(void *d, int32_t c, int32_t a);
|
||||
#endif
|
||||
#ifndef pragmas_have_copybuf
|
||||
void copybuf(const void *s, void *d, int32_t c);
|
||||
#endif
|
||||
#ifndef pragmas_have_swaps
|
||||
void swapbuf4(void *a, void *b, int32_t c);
|
||||
#endif
|
||||
|
||||
#ifndef pragmas_have_clearbufbyte
|
||||
void clearbufbyte(void *D, int32_t c, int32_t a);
|
||||
#endif
|
||||
#ifndef pragmas_have_copybufbyte
|
||||
void copybufbyte(const void *S, void *D, int32_t c);
|
||||
#endif
|
||||
#ifndef pragmas_have_copybufreverse
|
||||
void copybufreverse(const void *S, void *D, int32_t c);
|
||||
#endif
|
||||
|
||||
#ifndef pragmas_have_krecipasm
|
||||
static inline int32_t krecipasm(int32_t i)
|
||||
|
@ -221,23 +197,4 @@ static inline int32_t krecipasm(int32_t i)
|
|||
#undef wo
|
||||
#undef by
|
||||
|
||||
static inline void swapbufreverse(void *s, void *d, int32_t c)
|
||||
{
|
||||
uint8_t *src = (uint8_t *)s, *dst = (uint8_t *)d;
|
||||
Bassert(c >= 4);
|
||||
|
||||
do
|
||||
{
|
||||
swapchar(dst, src);
|
||||
swapchar(dst + 1, src - 1);
|
||||
swapchar(dst + 2, src - 2);
|
||||
swapchar(dst + 3, src - 3);
|
||||
dst += 4, src -= 4;
|
||||
} while ((c -= 4) > 4);
|
||||
|
||||
while (c--)
|
||||
swapchar(dst++, src--);
|
||||
}
|
||||
|
||||
|
||||
#endif // pragmas_h_
|
||||
|
|
|
@ -30,7 +30,6 @@
|
|||
#include "version.h"
|
||||
|
||||
#ifdef USE_OPENGL
|
||||
# include "glsurface.h"
|
||||
# include "hightile.h"
|
||||
# include "mdsprite.h"
|
||||
# include "polymost.h"
|
||||
|
@ -103,27 +102,9 @@ int32_t novoxmips = 1;
|
|||
#define MAXXSIZ 256
|
||||
#define MAXYSIZ 256
|
||||
#define MAXZSIZ 255
|
||||
#ifdef EDUKE32_TOUCH_DEVICES
|
||||
# define DISTRECIPSIZ (65536+256)
|
||||
#else
|
||||
# define DISTRECIPSIZ 131072
|
||||
#endif
|
||||
|
||||
int32_t voxscale[MAXVOXELS];
|
||||
|
||||
static int32_t ggxinc[MAXXSIZ+1], ggyinc[MAXXSIZ+1];
|
||||
static int32_t lowrecip[1024], nytooclose;
|
||||
static const int32_t nytoofar = DISTRECIPSIZ*16384ull - 1048576;
|
||||
static uint32_t *distrecip;
|
||||
#define DISTRECIPCACHESIZE 3
|
||||
static struct {
|
||||
uint32_t *distrecip;
|
||||
int32_t xdimen;
|
||||
int32_t age;
|
||||
} distrecipcache[DISTRECIPCACHESIZE];
|
||||
static int32_t distrecipagecnt = 0;
|
||||
|
||||
static TArray<int32_t> lookups;
|
||||
static int32_t beforedrawrooms = 1;
|
||||
|
||||
static int32_t oxdimen = -1, oviewingrange = -1, oxyaspect = -1;
|
||||
|
@ -135,30 +116,16 @@ int32_t newaspect_enable=0;
|
|||
int32_t r_fpgrouscan = 1;
|
||||
int32_t globalflags;
|
||||
|
||||
//Textured Map variables
|
||||
static char globalpolytype;
|
||||
static TArray<int16_t *>dotp1, dotp2;
|
||||
|
||||
static int8_t tempbuf[MAXWALLS];
|
||||
|
||||
// referenced from asm
|
||||
int32_t ebpbak, espbak;
|
||||
int32_t reciptable[2048], fpuasm;
|
||||
intptr_t asm1, asm2, asm3, asm4, palookupoffse[4];
|
||||
uint32_t vplce[4];
|
||||
int32_t vince[4];
|
||||
intptr_t bufplce[4];
|
||||
int32_t globaltilesizy;
|
||||
int32_t reciptable[2048];
|
||||
intptr_t asm1, asm2, asm3;
|
||||
int32_t globalx1, globaly2, globalx3, globaly3;
|
||||
|
||||
#define SLOPALOOKUPSIZ 16384
|
||||
static intptr_t slopalookup[SLOPALOOKUPSIZ]; // was 2048
|
||||
|
||||
static int32_t no_radarang2 = 0;
|
||||
static int16_t radarang[1280];
|
||||
static int32_t qradarang[10240];
|
||||
static TArray<int32_t> radarang2;
|
||||
const char ATTRIBUTE((used)) pow2char_[8] = {1,2,4,8,16,32,64,128};
|
||||
|
||||
uint16_t ATTRIBUTE((used)) sqrtable[4096], ATTRIBUTE((used)) shlookup[4096+256], ATTRIBUTE((used)) sqrtable_old[2048];
|
||||
|
||||
|
@ -205,15 +172,6 @@ static void getclosestpointonwall_internal(vec2_t const p, int32_t const dawall,
|
|||
*closest = { (int32_t)(w.x + ((d.x * i) >> 30)), (int32_t)(w.y + ((d.y * i) >> 30)) };
|
||||
}
|
||||
|
||||
////////// YAX //////////
|
||||
|
||||
#ifdef YAX_DEBUG
|
||||
// XXX: This could be replaced with the use of gethiticks().
|
||||
double u64tickspersec;
|
||||
#endif
|
||||
#ifdef ENGINE_SCREENSHOT_DEBUG
|
||||
int32_t engine_screenshot = 0;
|
||||
#endif
|
||||
|
||||
void faketimerhandler()
|
||||
{
|
||||
|
@ -271,16 +229,6 @@ int16_t yax_getbunch(int16_t i, int16_t cf)
|
|||
|
||||
return (*(§or[i].ceilingstat + cf) & YAX_BIT) ? YAX_BUNCHNUM(i, cf) : -1;
|
||||
}
|
||||
# else
|
||||
# define YAX_PTRBUNCHNUM(Ptr, Sect, Cf) (*((Cf) ? &(Ptr)[Sect].floorbunch : &(Ptr)[Sect].ceilingbunch))
|
||||
# define YAX_BUNCHNUM(Sect, Cf) YAX_PTRBUNCHNUM(sector, Sect, Cf)
|
||||
|
||||
# if !defined NEW_MAP_FORMAT
|
||||
static FORCE_INLINE int32_t yax_islockededge(int32_t line, int32_t cf)
|
||||
{
|
||||
return (yax_getnextwall(line, cf) >= 0);
|
||||
}
|
||||
# endif
|
||||
# endif
|
||||
|
||||
// bunchnum: -1: also clear yax-nextwalls (forward and reverse)
|
||||
|
@ -290,11 +238,7 @@ void yax_setbunch(int16_t i, int16_t cf, int16_t bunchnum)
|
|||
{
|
||||
if (editstatus==0)
|
||||
{
|
||||
#ifdef NEW_MAP_FORMAT
|
||||
YAX_BUNCHNUM(i, cf) = bunchnum;
|
||||
#else
|
||||
yax_bunchnum[i][cf] = bunchnum;
|
||||
#endif
|
||||
return;
|
||||
}
|
||||
|
||||
|
@ -721,8 +665,8 @@ void yax_preparedrawrooms(void)
|
|||
return;
|
||||
|
||||
g_nodraw = 1;
|
||||
Bmemset(yax_spritesortcnt, 0, sizeof(yax_spritesortcnt));
|
||||
Bmemset(haveymost, 0, (numyaxbunches+7)>>3);
|
||||
memset(yax_spritesortcnt, 0, sizeof(yax_spritesortcnt));
|
||||
memset(haveymost, 0, (numyaxbunches+7)>>3);
|
||||
|
||||
}
|
||||
|
||||
|
@ -1142,8 +1086,6 @@ int16_t bunchp2[MAXWALLSB], thesector[MAXWALLSB];
|
|||
int16_t bunchfirst[MAXWALLSB], bunchlast[MAXWALLSB];
|
||||
|
||||
|
||||
TArray<uint8_t> mirrorBuffer;
|
||||
|
||||
static vec3_t spritesxyz[MAXSPRITESONSCREEN+1];
|
||||
|
||||
int32_t xdimen = -1, xdimenrecip, halfxdimen, xdimenscale, xdimscale;
|
||||
|
@ -1154,8 +1096,7 @@ static int32_t nrx1[8], nry1[8], nrx2[8], nry2[8]; // JBF 20031206: Thanks Ken
|
|||
|
||||
int32_t rxi[8], ryi[8];
|
||||
static int32_t rzi[8], rxi2[8], ryi2[8], rzi2[8];
|
||||
static int32_t xsi[8], ysi[8], horizycent;
|
||||
static int32_t *horizlookup=0, *horizlookup2=0;
|
||||
static int32_t xsi[8], ysi[8];
|
||||
|
||||
int32_t globalposx, globalposy, globalposz, globalhoriz;
|
||||
fix16_t qglobalhoriz;
|
||||
|
@ -1194,7 +1135,6 @@ static int32_t globaly1, globalx2;
|
|||
int16_t sectorborder[256];
|
||||
int32_t ydim16, qsetmode = 0;
|
||||
int16_t pointhighlight=-1, linehighlight=-1, highlightcnt=0;
|
||||
static TArray<int32_t> lastx;
|
||||
|
||||
int32_t halfxdim16, midydim16;
|
||||
|
||||
|
@ -1664,20 +1604,6 @@ static void dosetaspect(void)
|
|||
{
|
||||
oxyaspect = xyaspect;
|
||||
j = xyaspect*320;
|
||||
horizycent = (ydim*4)>>1;
|
||||
horizlookup2[horizycent-1] = divscale32(131072,j);
|
||||
|
||||
for (i=0; i < horizycent-1; i++)
|
||||
{
|
||||
horizlookup[i] = divscale28(1, i-(horizycent-1));
|
||||
horizlookup2[i] = divscale20(klabs(horizlookup[i]), j);
|
||||
}
|
||||
|
||||
for (i=horizycent; i < ydim*4-1; i++)
|
||||
{
|
||||
horizlookup[i] = divscale28(1, i-(horizycent-1));
|
||||
horizlookup2[i] = divscale20(klabs(horizlookup[i]), j);
|
||||
}
|
||||
}
|
||||
|
||||
if (xdimen != oxdimen || viewingrange != oviewingrange)
|
||||
|
@ -1697,55 +1623,11 @@ static void dosetaspect(void)
|
|||
if (k < 0 || k >= (int32_t)ARRAY_SIZE(qradarang)-1)
|
||||
{
|
||||
no_radarang2 = 1;
|
||||
#ifdef DEBUGGINGAIDS
|
||||
if (editstatus)
|
||||
initprintf("no rad2\n");
|
||||
#endif
|
||||
break;
|
||||
}
|
||||
|
||||
if (j != 0)
|
||||
j = mulscale16(qradarang[k+1]-qradarang[k], j);
|
||||
radarang2[i] = ((qradarang[k]+j)>>6);
|
||||
}
|
||||
|
||||
if (xdimen != oxdimen && (voxoff[0][0] || playing_blood))
|
||||
{
|
||||
distrecip = NULL;
|
||||
for (i = 0; i < DISTRECIPCACHESIZE; i++)
|
||||
{
|
||||
if (distrecipcache[i].xdimen == xdimen)
|
||||
distrecip = distrecipcache[i].distrecip;
|
||||
}
|
||||
if (distrecip == NULL)
|
||||
{
|
||||
int32_t minAge = 0;
|
||||
for (i = 1; i < DISTRECIPCACHESIZE; i++)
|
||||
{
|
||||
if (distrecipcache[i].age < distrecipcache[minAge].age)
|
||||
minAge = i;
|
||||
}
|
||||
if (distrecipcache[minAge].distrecip == NULL)
|
||||
distrecipcache[minAge].distrecip = (uint32_t *)Xaligned_alloc(16, DISTRECIPSIZ * sizeof(uint32_t));
|
||||
|
||||
distrecipcache[minAge].age = ++distrecipagecnt;
|
||||
distrecipcache[minAge].xdimen = xdimen;
|
||||
|
||||
distrecip = distrecipcache[minAge].distrecip;
|
||||
|
||||
if (xdimen < 1 << 11)
|
||||
{
|
||||
for (i = 1; i < DISTRECIPSIZ; i++)
|
||||
distrecip[i] = tabledivide32(xdimen << 20, i);
|
||||
}
|
||||
else
|
||||
{
|
||||
for (i = 1; i < DISTRECIPSIZ; i++)
|
||||
distrecip[i] = tabledivide64((uint64_t)xdimen << 20, i);
|
||||
}
|
||||
}
|
||||
|
||||
nytooclose = xdimen*2100;
|
||||
}
|
||||
|
||||
oxdimen = xdimen;
|
||||
|
@ -2083,13 +1965,6 @@ int32_t lintersect(const int32_t originX, const int32_t originY, const int32_t o
|
|||
|
||||
int64_t t = tabledivide64(((int64_t) originDiffCrossLineVec) << 24L, rayCrossLineVec);
|
||||
// For sake of completeness/readability, alternative to the above approach for an early out & avoidance of an extra division:
|
||||
#if 0
|
||||
int64_t u = tabledivide64(((int64_t) originDiffCrossRay) << 24L, rayCrossLineVec);
|
||||
if (u < 0 || u > 1 << 24 || t < 0 || t > 1 << 24)
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
#endif
|
||||
|
||||
*intersectionX = originX + mulscale24(ray.x, t);
|
||||
*intersectionY = originY + mulscale24(ray.y, t);
|
||||
|
@ -2257,12 +2132,6 @@ int32_t engineInit(void)
|
|||
if (i) return i;
|
||||
}
|
||||
|
||||
#ifdef YAX_DEBUG
|
||||
u64tickspersec = (double)timerGetFreqU64();
|
||||
if (u64tickspersec==0.0)
|
||||
u64tickspersec = 1.0;
|
||||
#endif
|
||||
|
||||
if (engineLoadTables())
|
||||
return 1;
|
||||
|
||||
|
@ -2273,15 +2142,12 @@ int32_t engineInit(void)
|
|||
|
||||
showinvisibility = 0;
|
||||
|
||||
for (i=1; i<1024; i++)
|
||||
lowrecip[i] = ((1<<24)-1)/i;
|
||||
|
||||
voxelmemory.Reset();
|
||||
|
||||
for (i=0; i<MAXTILES; i++)
|
||||
tiletovox[i] = -1;
|
||||
clearbuf(voxscale, sizeof(voxscale)>>2, 65536);
|
||||
clearbufbyte(voxrotate, sizeof(voxrotate), 0);
|
||||
for (auto& v : voxscale) v = 65536;
|
||||
memset(voxrotate, 0, sizeof(voxrotate));
|
||||
|
||||
paletteloaded = 0;
|
||||
|
||||
|
@ -2335,10 +2201,6 @@ void engineUnInit(void)
|
|||
|
||||
TileFiles.CloseAll();
|
||||
|
||||
for (bssize_t i=0; i<DISTRECIPCACHESIZE; i++)
|
||||
ALIGNED_FREE_AND_NULL(distrecipcache[i].distrecip);
|
||||
Bmemset(distrecipcache, 0, sizeof(distrecipcache));
|
||||
|
||||
paletteloaded = 0;
|
||||
|
||||
for (bssize_t i=0; i<MAXPALOOKUPS; i++)
|
||||
|
@ -2457,7 +2319,6 @@ int32_t renderDrawRoomsQ16(int32_t daposx, int32_t daposy, int32_t daposz,
|
|||
fix16_t daang, fix16_t dahoriz, int16_t dacursectnum)
|
||||
{
|
||||
int32_t i;
|
||||
int16_t *shortptr1, *shortptr2;
|
||||
|
||||
beforedrawrooms = 0;
|
||||
|
||||
|
@ -2501,8 +2362,6 @@ int32_t renderDrawRoomsQ16(int32_t daposx, int32_t daposy, int32_t daposz,
|
|||
#endif
|
||||
)
|
||||
{
|
||||
shortptr1 = (int16_t *)&startumost[windowxy1.x];
|
||||
shortptr2 = (int16_t *)&startdmost[windowxy1.x];
|
||||
i = xdimen-1;
|
||||
}
|
||||
|
||||
|
@ -3199,7 +3058,6 @@ void renderDrawMapView(int32_t dax, int32_t day, int32_t zoome, int16_t ang)
|
|||
globalshade = max(min<int>(sec->floorshade, numshades - 1), 0);
|
||||
globvis = globalhisibility;
|
||||
if (sec->visibility != 0) globvis = mulscale4(globvis, (uint8_t)(sec->visibility+16));
|
||||
globalpolytype = 0;
|
||||
if ((globalorientation&64) == 0)
|
||||
{
|
||||
set_globalpos(dax, day, globalposz);
|
||||
|
@ -3320,7 +3178,6 @@ void renderDrawMapView(int32_t dax, int32_t day, int32_t zoome, int16_t ang)
|
|||
asm3 = FP_OFF(palookup[spr->pal]+(globalshade<<8));
|
||||
globvis = globalhisibility;
|
||||
if (sec->visibility != 0) globvis = mulscale4(globvis, (uint8_t)(sec->visibility+16));
|
||||
globalpolytype = ((spr->cstat&2)>>1)+1;
|
||||
|
||||
//relative alignment stuff
|
||||
ox = v2.x-v1.x; oy = v2.y-v1.y;
|
||||
|
@ -3910,26 +3767,6 @@ int32_t engineLoadBoardV5V6(const char *filename, char fromwhere, vec3_t *dapos,
|
|||
|
||||
#define YSAVES ((xdim*MAXSPRITES)>>7)
|
||||
|
||||
static void videoAllocateBuffers(void)
|
||||
{
|
||||
// Needed for the game's TILT_SETVIEWTOTILE_320.
|
||||
const int32_t clamped_ydim = max(ydim, 320);
|
||||
|
||||
startumost.Resize(xdim);
|
||||
startdmost.Resize(xdim);
|
||||
radarang2.Resize(xdim);
|
||||
dotp1.Resize(clamped_ydim);
|
||||
dotp2.Resize(clamped_ydim);
|
||||
lastx.Resize(clamped_ydim);
|
||||
mirrorBuffer.Resize(xdim * ydim);
|
||||
|
||||
if (videoGetRenderMode() == REND_CLASSIC)
|
||||
{
|
||||
glsurface_initialize({ xdim, ydim });
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
//
|
||||
// setgamemode
|
||||
//
|
||||
|
@ -3967,14 +3804,7 @@ int32_t videoSetGameMode(char davidoption, int32_t daupscaledxdim, int32_t daups
|
|||
fydim = (float) ydim;
|
||||
#endif
|
||||
|
||||
videoAllocateBuffers();
|
||||
|
||||
j = ydim*4; //Leave room for horizlookup&horizlookup2
|
||||
lookups.Resize(2 * j);
|
||||
|
||||
horizlookup = lookups.Data();
|
||||
horizlookup2 = lookups.Data() + j;
|
||||
horizycent = ((ydim*4)>>1);
|
||||
|
||||
//Force drawrooms to call dosetaspect & recalculate stuff
|
||||
oxyaspect = oxdimen = oviewingrange = -1;
|
||||
|
@ -4015,8 +3845,6 @@ void videoNextPage(void)
|
|||
videoShowFrame(0);
|
||||
}
|
||||
|
||||
faketimerhandler();
|
||||
|
||||
#ifdef USE_OPENGL
|
||||
omdtims = mdtims;
|
||||
mdtims = timerGetTicks();
|
||||
|
@ -5211,12 +5039,6 @@ void videoSetViewableArea(int32_t x1, int32_t y1, int32_t x2, int32_t y2)
|
|||
fydimen = (float) ydimen;
|
||||
#endif
|
||||
videoSetCorrectedAspect();
|
||||
|
||||
for (bssize_t i=0; i<windowxy1.x; i++) { startumost[i] = 1, startdmost[i] = 0; }
|
||||
Bassert(windowxy2.x < xdim); // xdim is the number of alloc'd elements in start*most[].
|
||||
for (bssize_t i=windowxy1.x; i<=windowxy2.x; i++)
|
||||
{ startumost[i] = windowxy1.y, startdmost[i] = windowxy2.y+1; }
|
||||
for (bssize_t i=windowxy2.x+1; i<xdim; i++) { startumost[i] = 1, startdmost[i] = 0; }
|
||||
}
|
||||
|
||||
|
||||
|
|
|
@ -11,7 +11,6 @@
|
|||
#ifndef ENGINE_PRIV_H
|
||||
#define ENGINE_PRIV_H
|
||||
|
||||
#define MAXPERMS 512
|
||||
#define MAXARTFILES_BASE 200
|
||||
#define MAXARTFILES_TOTAL 220
|
||||
#define MAXCLIPDIST 1024
|
||||
|
@ -24,7 +23,7 @@
|
|||
# define YAX_MAXDRAWS 8
|
||||
#endif
|
||||
|
||||
extern intptr_t asm1, asm2, asm3, asm4;
|
||||
extern intptr_t asm1, asm2, asm3;
|
||||
extern int32_t globalx1, globaly2;
|
||||
|
||||
|
||||
|
@ -64,11 +63,6 @@ extern uint16_t sqrtable[4096], shlookup[4096+256],sqrtable_old[2048];
|
|||
return (((d<<4)^0xf0)|d);
|
||||
}
|
||||
|
||||
inline int32_t getkensmessagecrc(int32_t b)
|
||||
{
|
||||
UNREFERENCED_PARAMETER(b);
|
||||
return 0x56c764d4l;
|
||||
}
|
||||
|
||||
|
||||
inline int32_t ksqrtasm_old(int32_t n)
|
||||
|
@ -92,7 +86,6 @@ extern int16_t thesector[MAXWALLSB], thewall[MAXWALLSB];
|
|||
extern int16_t bunchfirst[MAXWALLSB], bunchlast[MAXWALLSB];
|
||||
extern int16_t maskwall[MAXWALLSB], maskwallcnt;
|
||||
extern tspriteptr_t tspriteptr[MAXSPRITESONSCREEN + 1];
|
||||
extern TArray<uint8_t> mirrorBuffer;
|
||||
extern int32_t xdimen, xdimenrecip, halfxdimen, xdimenscale, xdimscale, ydimen;
|
||||
extern float fxdimen;
|
||||
extern int32_t globalposx, globalposy, globalposz, globalhoriz;
|
||||
|
|
|
@ -1,80 +0,0 @@
|
|||
/*
|
||||
* glsurface.cpp
|
||||
* A 32-bit rendering surface that can quickly blit 8-bit paletted buffers implemented in OpenGL.
|
||||
*
|
||||
* Copyright © 2018, Alex Dawson. All rights reserved.
|
||||
*/
|
||||
|
||||
#include "glsurface.h"
|
||||
|
||||
#include "baselayer.h"
|
||||
#include "build.h"
|
||||
#include "tarray.h"
|
||||
#include "flatvertices.h"
|
||||
#include "../../glbackend/glbackend.h"
|
||||
|
||||
static TArray<uint8_t> buffer;
|
||||
static FHardwareTexture* bufferTexture;
|
||||
static vec2_t bufferRes;
|
||||
|
||||
static FHardwareTexture* paletteTexture;
|
||||
|
||||
bool glsurface_initialize(vec2_t bufferResolution)
|
||||
{
|
||||
if (buffer.Size())
|
||||
glsurface_destroy();
|
||||
|
||||
bufferRes = bufferResolution;
|
||||
buffer.Resize(bufferRes.x * bufferRes.y);
|
||||
|
||||
bufferTexture = GLInterface.NewTexture();
|
||||
bufferTexture->CreateTexture(bufferRes.x, bufferRes.y, FHardwareTexture::Indexed, false);
|
||||
|
||||
glsurface_setPalette(curpalettefaded);
|
||||
GLInterface.SetSurfaceShader();
|
||||
return true;
|
||||
}
|
||||
|
||||
void glsurface_destroy()
|
||||
{
|
||||
if (bufferTexture) delete bufferTexture;
|
||||
bufferTexture = nullptr;
|
||||
if (paletteTexture) delete paletteTexture;
|
||||
paletteTexture = nullptr;
|
||||
}
|
||||
|
||||
void glsurface_setPalette(void* pPalette)
|
||||
{
|
||||
if (!buffer.Size())
|
||||
return;
|
||||
if (!pPalette)
|
||||
return;
|
||||
|
||||
if (!paletteTexture)
|
||||
{
|
||||
paletteTexture = GLInterface.NewTexture();
|
||||
paletteTexture->CreateTexture(256, 1, FHardwareTexture::TrueColor, false);
|
||||
}
|
||||
paletteTexture->LoadTexture(palette);
|
||||
GLInterface.BindTexture(1, paletteTexture, SamplerNoFilterClampXY);
|
||||
}
|
||||
|
||||
void* glsurface_getBuffer()
|
||||
{
|
||||
return buffer.Data();
|
||||
}
|
||||
|
||||
vec2_t glsurface_getBufferResolution()
|
||||
{
|
||||
return bufferRes;
|
||||
}
|
||||
|
||||
void glsurface_blitBuffer()
|
||||
{
|
||||
if (!buffer.Size())
|
||||
return;
|
||||
|
||||
bufferTexture->LoadTexture(buffer.Data());
|
||||
GLInterface.BindTexture(0, bufferTexture, SamplerNoFilterClampXY);
|
||||
GLInterface.Draw(DT_TRIANGLE_STRIP, FFlatVertexBuffer::PRESENT_INDEX, 4);
|
||||
}
|
|
@ -24,7 +24,6 @@ int32_t globalblend;
|
|||
|
||||
uint32_t g_lastpalettesum = 0;
|
||||
palette_t curpalette[256]; // the current palette, unadjusted for brightness or tint
|
||||
palette_t curpalettefaded[256]; // the current palette, adjusted for brightness and tint (ie. what gets sent to the card)
|
||||
palette_t palfadergb = { 0, 0, 0, 0 };
|
||||
unsigned char palfadedelta = 0;
|
||||
ESetPalFlags curpaletteflags;
|
||||
|
@ -43,7 +42,6 @@ int8_t g_noFloorPal[MAXPALOOKUPS];
|
|||
|
||||
int32_t curbrightness = 0;
|
||||
|
||||
static void paletteSetFade(uint8_t offset);
|
||||
void setBlendFactor(int index, int alpha);
|
||||
|
||||
|
||||
|
@ -723,18 +721,8 @@ void videoSetPalette(int dabrightness, int dapalid, ESetPalFlags flags)
|
|||
curpalette[i].g = dapal[i * 3 + 1];
|
||||
curpalette[i].b = dapal[i * 3 + 2];
|
||||
curpalette[i].f = 0;
|
||||
|
||||
// brightness adjust the palette
|
||||
curpalettefaded[i].b = britable[j][curpalette[i].b];
|
||||
curpalettefaded[i].g = britable[j][curpalette[i].g];
|
||||
curpalettefaded[i].r = britable[j][curpalette[i].r];
|
||||
curpalettefaded[i].f = 0;
|
||||
}
|
||||
|
||||
if ((flags & Pal_DontResetFade) && palfadedelta) // keep the fade
|
||||
paletteSetFade(palfadedelta >> 2);
|
||||
|
||||
|
||||
if ((flags & Pal_DontResetFade) == 0)
|
||||
{
|
||||
palfadergb.r = palfadergb.g = palfadergb.b = 0;
|
||||
|
@ -749,19 +737,6 @@ palette_t paletteGetColor(int32_t col)
|
|||
return curpalette[col];
|
||||
}
|
||||
|
||||
static void paletteSetFade(uint8_t offset)
|
||||
{
|
||||
for (native_t i=0; i<256; i++)
|
||||
{
|
||||
palette_t const p = paletteGetColor(i);
|
||||
|
||||
curpalettefaded[i].b = p.b + (((palfadergb.b - p.b) * offset) >> 8);
|
||||
curpalettefaded[i].g = p.g + (((palfadergb.g - p.g) * offset) >> 8);
|
||||
curpalettefaded[i].r = p.r + (((palfadergb.r - p.r) * offset) >> 8);
|
||||
curpalettefaded[i].f = 0;
|
||||
}
|
||||
}
|
||||
|
||||
//
|
||||
// setpalettefade
|
||||
//
|
||||
|
@ -770,11 +745,5 @@ void videoFadePalette(uint8_t r, uint8_t g, uint8_t b, uint8_t offset)
|
|||
palfadergb.r = r;
|
||||
palfadergb.g = g;
|
||||
palfadergb.b = b;
|
||||
#ifdef DEBUG_PALETTEFADE
|
||||
if (offset)
|
||||
offset = max(offset, 128);
|
||||
#endif
|
||||
palfadedelta = offset;
|
||||
|
||||
paletteSetFade(offset);
|
||||
}
|
||||
|
|
|
@ -53,50 +53,6 @@ void qinterpolatedown16short(intptr_t bufptr, int32_t num, int32_t val, int32_t
|
|||
}
|
||||
#endif
|
||||
|
||||
#ifndef pragmas_have_clearbuf
|
||||
void clearbuf(void *d, int32_t c, int32_t a)
|
||||
{
|
||||
auto p = (int32_t *)d;
|
||||
|
||||
#if 0
|
||||
if (a == 0)
|
||||
{
|
||||
clearbufbyte(d, c<<2, 0);
|
||||
return;
|
||||
}
|
||||
#endif
|
||||
|
||||
while (c--)
|
||||
*p++ = a;
|
||||
}
|
||||
#endif
|
||||
|
||||
#ifndef pragmas_have_copybuf
|
||||
void copybuf(const void *s, void *d, int32_t c)
|
||||
{
|
||||
auto p = (const int32_t *) s;
|
||||
auto q = (int32_t *) d;
|
||||
|
||||
while (c--)
|
||||
*q++ = *p++;
|
||||
}
|
||||
#endif
|
||||
|
||||
#ifndef pragmas_have_swaps
|
||||
void swapbuf4(void *a, void *b, int32_t c)
|
||||
{
|
||||
auto p = (int32_t *) a;
|
||||
auto q = (int32_t *) b;
|
||||
|
||||
while ((c--) > 0)
|
||||
{
|
||||
int x = *q, y = *p;
|
||||
*(q++) = y;
|
||||
*(p++) = x;
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
#ifndef pragmas_have_clearbufbyte
|
||||
void clearbufbyte(void *D, int32_t c, int32_t a)
|
||||
{
|
||||
|
@ -125,17 +81,3 @@ void copybufbyte(const void *s, void *d, int32_t c)
|
|||
#endif
|
||||
|
||||
|
||||
// copybufreverse() is a special case: use the assembly version for GCC on x86
|
||||
// *and* x86_64, and the C version otherwise.
|
||||
// XXX: we don't honor NOASM in the x86_64 case.
|
||||
|
||||
#if !defined pragmas_have_copybufreverse
|
||||
void copybufreverse(const void *s, void *d, int32_t c)
|
||||
{
|
||||
auto src = (const char *)s;
|
||||
auto dst = (char *)d;
|
||||
|
||||
while (c--)
|
||||
*dst++ = *src--;
|
||||
}
|
||||
#endif
|
||||
|
|
|
@ -240,89 +240,16 @@ void WaitTicks(int nTicks)
|
|||
// unused
|
||||
void DoFadeToRed()
|
||||
{
|
||||
#ifdef USE_OPENGL
|
||||
if (videoGetRenderMode() >= REND_POLYMOST)
|
||||
{
|
||||
videoTintBlood(-255, -255, -255);
|
||||
videoNextPage();
|
||||
return;
|
||||
}
|
||||
#endif
|
||||
for (int i = 0; i < 256; i++)
|
||||
{
|
||||
if (curpalettefaded[i].g > 0)
|
||||
{
|
||||
curpalettefaded[i].g -= 4;
|
||||
if (curpalettefaded[i].g < 0)
|
||||
curpalettefaded[i].g = 0;
|
||||
}
|
||||
|
||||
if (curpalettefaded[i].b > 0)
|
||||
{
|
||||
curpalettefaded[i].b -= 4;
|
||||
if (curpalettefaded[i].b < 0)
|
||||
curpalettefaded[i].b = 0;
|
||||
}
|
||||
}
|
||||
|
||||
//videoUpdatePalette(0, 256);
|
||||
g_lastpalettesum = -1;
|
||||
// fixme
|
||||
videoTintBlood(-255, -255, -255);
|
||||
videoNextPage();
|
||||
}
|
||||
|
||||
void FadeToWhite()
|
||||
{
|
||||
int ebx = 0;
|
||||
|
||||
#ifdef USE_OPENGL
|
||||
if (videoGetRenderMode() >= REND_POLYMOST)
|
||||
{
|
||||
videoTintBlood(255, 255, 255);
|
||||
videoNextPage();
|
||||
return;
|
||||
}
|
||||
#endif
|
||||
|
||||
for (int i = 0; i < 64; i++)
|
||||
{
|
||||
palette_t *pPal = curpalettefaded;
|
||||
|
||||
for (int j = 0; j < 256; j++)
|
||||
{
|
||||
if (pPal->r < 255)
|
||||
{
|
||||
pPal->r += 4;
|
||||
if (pPal->r > 255)
|
||||
pPal->r = 255;
|
||||
ebx++;
|
||||
}
|
||||
if (pPal->g < 255)
|
||||
{
|
||||
pPal->g += 4;
|
||||
if (pPal->g > 255)
|
||||
pPal->g = 255;
|
||||
ebx++;
|
||||
}
|
||||
if (pPal->b < 255)
|
||||
{
|
||||
pPal->b += 4;
|
||||
if (pPal->b > 255)
|
||||
pPal->b = 255;
|
||||
ebx++;
|
||||
}
|
||||
pPal++;
|
||||
}
|
||||
|
||||
//videoUpdatePalette(0, 256);
|
||||
g_lastpalettesum = -1;
|
||||
WaitTicks(2);
|
||||
|
||||
// need to page flip in each iteration of the loop for non DOS version
|
||||
videoNextPage();
|
||||
|
||||
if (!ebx) {
|
||||
return;
|
||||
}
|
||||
}
|
||||
// fixme
|
||||
videoTintBlood(255, 255, 255);
|
||||
videoNextPage();
|
||||
}
|
||||
|
||||
void FadeOut(int bFadeMusic)
|
||||
|
@ -332,60 +259,8 @@ void FadeOut(int bFadeMusic)
|
|||
}
|
||||
|
||||
|
||||
#ifdef USE_OPENGL
|
||||
if (videoGetRenderMode() >= REND_POLYMOST)
|
||||
{
|
||||
videoTintBlood(-255, -255, -255);
|
||||
videoNextPage();
|
||||
}
|
||||
else
|
||||
#endif
|
||||
for (int i = 64; i > 0; i--)
|
||||
{
|
||||
int v4 = 0;
|
||||
palette_t *pPal = curpalettefaded;
|
||||
|
||||
for (int j = 0; j < 256; j++)
|
||||
{
|
||||
if (pPal->r > 0)
|
||||
{
|
||||
pPal->r -= 4;
|
||||
if (pPal->r < 0)
|
||||
pPal->r = 0;
|
||||
v4++;
|
||||
}
|
||||
if (pPal->g > 0)
|
||||
{
|
||||
pPal->g -= 4;
|
||||
if (pPal->g < 0)
|
||||
pPal->g = 0;
|
||||
v4++;
|
||||
}
|
||||
if (pPal->b > 0)
|
||||
{
|
||||
pPal->b -= 4;
|
||||
if (pPal->b < 0)
|
||||
pPal->b = 0;
|
||||
v4++;
|
||||
}
|
||||
pPal++;
|
||||
}
|
||||
|
||||
//videoUpdatePalette(0, 256);
|
||||
g_lastpalettesum = -1;
|
||||
WaitTicks(2);
|
||||
|
||||
// need to page flip in each iteration of the loop for non DOS version
|
||||
videoNextPage();
|
||||
|
||||
if (v4 == 0) {
|
||||
break;
|
||||
}
|
||||
|
||||
if (bFadeMusic) {
|
||||
StepFadeCDaudio();
|
||||
}
|
||||
}
|
||||
videoTintBlood(-255, -255, -255);
|
||||
videoNextPage();
|
||||
|
||||
if (bFadeMusic) {
|
||||
while (StepFadeCDaudio() != 0) {}
|
||||
|
@ -402,76 +277,17 @@ void StartFadeIn()
|
|||
|
||||
int DoFadeIn()
|
||||
{
|
||||
#ifdef USE_OPENGL
|
||||
if (videoGetRenderMode() >= REND_POLYMOST)
|
||||
{
|
||||
paletteSetColorTable(curbasepal, basepaltable[BASEPAL]);
|
||||
videoSetPalette(0, curbasepal, 0);
|
||||
videoNextPage();
|
||||
return 0;
|
||||
}
|
||||
#endif
|
||||
int v2 = 0;
|
||||
|
||||
for (int i = 0; i < 256; i++)
|
||||
{
|
||||
if (curpalettefaded[i].r != curpalette[i].r)
|
||||
{
|
||||
v2++;
|
||||
int diff = curpalette[i].r - curpalettefaded[i].r;
|
||||
if (klabs(diff) < 4)
|
||||
curpalettefaded[i].r = curpalette[i].r;
|
||||
else
|
||||
curpalettefaded[i].r += 4 * ksgn(diff);
|
||||
}
|
||||
if (curpalettefaded[i].g != curpalette[i].g)
|
||||
{
|
||||
v2++;
|
||||
int diff = curpalette[i].g - curpalettefaded[i].g;
|
||||
if (klabs(diff) < 4)
|
||||
curpalettefaded[i].g = curpalette[i].g;
|
||||
else
|
||||
curpalettefaded[i].g += 4 * ksgn(diff);
|
||||
}
|
||||
if (curpalettefaded[i].b != curpalette[i].b)
|
||||
{
|
||||
v2++;
|
||||
int diff = curpalette[i].b - curpalettefaded[i].b;
|
||||
if (klabs(diff) < 4)
|
||||
curpalettefaded[i].b = curpalette[i].b;
|
||||
else
|
||||
curpalettefaded[i].b += 4 * ksgn(diff);
|
||||
}
|
||||
}
|
||||
|
||||
//videoUpdatePalette(0, 256);
|
||||
g_lastpalettesum = -1;
|
||||
|
||||
return v2;
|
||||
paletteSetColorTable(curbasepal, basepaltable[BASEPAL]);
|
||||
videoSetPalette(0, curbasepal, 0);
|
||||
videoNextPage();
|
||||
return 0;
|
||||
}
|
||||
|
||||
void FadeIn()
|
||||
{
|
||||
#ifdef USE_OPENGL
|
||||
if (videoGetRenderMode() >= REND_POLYMOST)
|
||||
{
|
||||
videoSetPalette(0, BASEPAL, 0);
|
||||
videoNextPage();
|
||||
return;
|
||||
}
|
||||
#endif
|
||||
StartFadeIn();
|
||||
videoSetPalette(0, BASEPAL, 0);
|
||||
videoNextPage();
|
||||
|
||||
int val;
|
||||
|
||||
do
|
||||
{
|
||||
val = DoFadeIn();
|
||||
WaitTicks(2);
|
||||
|
||||
// need to page flip in each iteration of the loop for non DOS version
|
||||
videoNextPage();
|
||||
} while (val);
|
||||
}
|
||||
|
||||
void FixPalette()
|
||||
|
@ -522,8 +338,6 @@ void FixPalette()
|
|||
|
||||
void TintPalette(int r, int g, int b)
|
||||
{
|
||||
palette_t *pPal = curpalettefaded;
|
||||
|
||||
if (bCamera) {
|
||||
return;
|
||||
}
|
||||
|
@ -596,48 +410,13 @@ void TintPalette(int r, int g, int b)
|
|||
|
||||
nPalDiff += nVal;
|
||||
|
||||
#ifdef USE_OPENGL
|
||||
if (videoGetRenderMode() >= REND_POLYMOST) videoTintBlood(rtint, gtint, btint);
|
||||
else
|
||||
#endif
|
||||
for (int i = 0; i < 256; i++)
|
||||
{
|
||||
nVal = pPal->r + r;
|
||||
if (nVal > 255) {
|
||||
nVal = 255;
|
||||
}
|
||||
pPal->r = nVal;
|
||||
|
||||
nVal = pPal->g + g;
|
||||
if (nVal > 255) {
|
||||
nVal = 255;
|
||||
}
|
||||
pPal->g = nVal;
|
||||
|
||||
nVal = pPal->b + b;
|
||||
if (nVal > 255) {
|
||||
nVal = 255;
|
||||
}
|
||||
pPal->b = nVal;
|
||||
|
||||
pPal++;
|
||||
}
|
||||
videoTintBlood(rtint, gtint, btint);
|
||||
|
||||
nPalDelay = 0;
|
||||
}
|
||||
|
||||
void DoOverscanSet(short someval)
|
||||
{
|
||||
#ifdef __WATCOMC__
|
||||
union REGS regs;
|
||||
|
||||
regs.h.al = 1;
|
||||
regs.h.ah = 0x10;
|
||||
regs.h.ch = someval;
|
||||
|
||||
int386(0x10, ®s, ®s);
|
||||
|
||||
#endif
|
||||
}
|
||||
|
||||
// unused
|
||||
|
@ -648,30 +427,5 @@ void SetWhiteOverscan()
|
|||
|
||||
void SetOverscan(int id)
|
||||
{
|
||||
if (basepaltable[id] == NULL)
|
||||
return;
|
||||
uint8_t *palette = basepaltable[id];
|
||||
int edi = 1000;
|
||||
overscanindex = 0;
|
||||
|
||||
for (int i = 0; i < 256; i++)
|
||||
{
|
||||
int ebx = 0;
|
||||
|
||||
for (int j = 0; j < 3; j++)
|
||||
{
|
||||
uint8_t cl = *palette;
|
||||
palette++;
|
||||
ebx += cl;
|
||||
}
|
||||
|
||||
if (ebx < edi)
|
||||
{
|
||||
edi = ebx;
|
||||
overscanindex = i;
|
||||
}
|
||||
}
|
||||
|
||||
DoOverscanSet(overscanindex);
|
||||
}
|
||||
END_PS_NS
|
||||
|
|
|
@ -244,7 +244,6 @@ void ResetView()
|
|||
//videoSetGameMode(gSetup.fullscreen, gSetup.xdim, gSetup.ydim, gSetup.bpp, 0);
|
||||
DoOverscanSet(overscanindex);
|
||||
EraseScreen(overscanindex);
|
||||
memcpy(curpalettefaded, curpalette, sizeof(curpalette));
|
||||
//videoUpdatePalette(0, 256);
|
||||
#ifdef USE_OPENGL
|
||||
videoTintBlood(0, 0, 0);
|
||||
|
|
|
@ -92,7 +92,6 @@ void GLInstance::Init(int ydim)
|
|||
glGetFloatv(GL_MAX_TEXTURE_MAX_ANISOTROPY_EXT, &glinfo.maxanisotropy);
|
||||
|
||||
new(&renderState) PolymostRenderState; // reset to defaults.
|
||||
LoadSurfaceShader();
|
||||
LoadPolymostShader();
|
||||
}
|
||||
|
||||
|
@ -110,20 +109,6 @@ void GLInstance::LoadPolymostShader()
|
|||
SetPolymostShader();
|
||||
}
|
||||
|
||||
void GLInstance::LoadSurfaceShader()
|
||||
{
|
||||
auto fr1 = GetResource("engine/shaders/glsl/glsurface.vp");
|
||||
TArray<uint8_t> Vert = fr1.Read();
|
||||
fr1 = GetResource("engine/shaders/glsl/glsurface.fp");
|
||||
TArray<uint8_t> Frag = fr1.Read();
|
||||
// Zero-terminate both strings.
|
||||
Vert.Push(0);
|
||||
Frag.Push(0);
|
||||
surfaceShader = new SurfaceShader();
|
||||
surfaceShader->Load("SurfaceShader", (const char*)Vert.Data(), (const char*)Frag.Data());
|
||||
}
|
||||
|
||||
|
||||
void GLInstance::InitGLState(int fogmode, int multisample)
|
||||
{
|
||||
glShadeModel(GL_SMOOTH); // GL_FLAT
|
||||
|
|
|
@ -178,7 +178,6 @@ public:
|
|||
void Init(int y);
|
||||
void InitGLState(int fogmode, int multisample);
|
||||
void LoadPolymostShader();
|
||||
void LoadSurfaceShader();
|
||||
void Draw2D(F2DDrawer* drawer);
|
||||
void DrawImGui(ImDrawData*);
|
||||
void ResetFrame();
|
||||
|
|
|
@ -162,24 +162,6 @@ SetConsoleDmost(void)
|
|||
|
||||
if (ydim == 480 && gs.BorderNum == 2)
|
||||
adj = 1;
|
||||
|
||||
//for (i = FIXED(0, 0); i < f_320; i += x_pix_size)
|
||||
for (i = 0; i < xdim; i++)
|
||||
// define picture
|
||||
// boundaries
|
||||
{
|
||||
startdmost[i] = MSW(ystart) + adj;
|
||||
}
|
||||
}
|
||||
|
||||
void ClearStartMost(void)
|
||||
{
|
||||
int i;
|
||||
|
||||
for (i = 0; i < xdim; i++)
|
||||
startdmost[i] = ydim;
|
||||
|
||||
memset(startumost.Data(), 0, xdim * sizeof(int16_t));
|
||||
}
|
||||
|
||||
void
|
||||
|
@ -207,9 +189,6 @@ SetFragBar(PLAYERp pp)
|
|||
{
|
||||
y = (tilesiz[FRAG_BAR].y * num_frag_bars) - (2 * (num_frag_bars-1));
|
||||
y = y * (ydim/200.0);
|
||||
|
||||
if (windowxy1.y < y)
|
||||
startumost[i] = y;
|
||||
}
|
||||
|
||||
for (i = 0, y = 0; i < num_frag_bars; i++)
|
||||
|
|
|
@ -1482,7 +1482,6 @@ void CreditsLevel(void)
|
|||
// get rid of all PERM sprites!
|
||||
renderFlushPerms();
|
||||
save = gs.BorderNum;
|
||||
ClearStartMost();
|
||||
gs.BorderNum = save;
|
||||
twod->ClearScreen();
|
||||
videoNextPage();
|
||||
|
|
|
@ -2347,7 +2347,6 @@ void ManualPlayerInsert(PLAYERp pp); // game.c
|
|||
|
||||
void SetRedrawScreen(PLAYERp pp); // border.c
|
||||
void SetupAspectRatio(void); // border.c
|
||||
void ClearStartMost(void); // border.c
|
||||
void SetCrosshair(void); // border.c
|
||||
|
||||
void initsynccrc(void); // sync.c
|
||||
|
|
|
@ -3161,7 +3161,7 @@ void movelava(char *dapic)
|
|||
offs2 = (LAVASIZ + 2) + 1 + ((intptr_t) lavabakpic);
|
||||
for (x = 0; x < LAVASIZ; x++)
|
||||
{
|
||||
copybuf(offs, offs2, LAVASIZ >> 2);
|
||||
memcpy(offs2, offs, LAVASIZ);
|
||||
offs += LAVASIZ;
|
||||
offs2 += LAVASIZ + 2;
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue