- cleanup of gloadtile_art.

This commit is contained in:
Christoph Oelckers 2019-10-10 19:30:05 +02:00
parent 34b7759b7e
commit 46ffea94a4
3 changed files with 12 additions and 20 deletions

View file

@ -187,7 +187,7 @@ typedef struct pthtyp_t
char skyface; char skyface;
} pthtyp; } pthtyp;
extern void gloadtile_art(int32_t,int32_t,int32_t,int32_t,int32_t,pthtyp *,int32_t); void gloadtile_art(int32_t dapic, int32_t dameth, pthtyp* pth, int32_t doalloc);
extern int32_t gloadtile_hi(int32_t,int32_t,int32_t,hicreplctyp *,int32_t,pthtyp *,int32_t, polytintflags_t); extern int32_t gloadtile_hi(int32_t,int32_t,int32_t,hicreplctyp *,int32_t,pthtyp *,int32_t, polytintflags_t);
extern int32_t globalnoeffect; extern int32_t globalnoeffect;

View file

@ -674,11 +674,11 @@ void FlipNonSquareBlock(T* dst, const T* src, int x, int y, int srcpitch)
} }
} }
TArray<uint8_t> emptiness; void gloadtile_art(int32_t dapic, int32_t dameth, pthtyp* pth, int32_t doalloc)
static void gloadtile_art_indexed(int32_t dapic, int32_t dameth, pthtyp* pth, int32_t doalloc)
{ {
vec2_16_t const& tsizart = tilesiz[dapic]; vec2_16_t const& tsizart = tilesiz[dapic];
vec2_t siz = { tsizart.x, tsizart.y }; vec2_t siz = { tsizart.x, tsizart.y };
vec2_t ssiz = siz;
//POGOTODO: npoty //POGOTODO: npoty
char npoty = 0; char npoty = 0;
@ -687,10 +687,10 @@ static void gloadtile_art_indexed(int32_t dapic, int32_t dameth, pthtyp* pth, in
uint8_t *p = (uint8_t*)waloff[dapic]; uint8_t *p = (uint8_t*)waloff[dapic];
if (!waloff[dapic]) if (!waloff[dapic])
{ {
emptiness.Resize(siz.x*siz.y); static uint8_t pix = 255;
memset(emptiness.Data(), 255, siz.x * siz.y); siz.x = siz.y = 1;
p = emptiness.Data();
p = &pix;
} }
{ {
if (doalloc) if (doalloc)
@ -698,7 +698,8 @@ static void gloadtile_art_indexed(int32_t dapic, int32_t dameth, pthtyp* pth, in
assert(pth->glpic == nullptr); assert(pth->glpic == nullptr);
pth->glpic = GLInterface.NewTexture(); pth->glpic = GLInterface.NewTexture();
pth->glpic->CreateTexture(siz.x, siz.y, true, false); pth->glpic->CreateTexture(siz.x, siz.y, true, false);
pth->glpic->SetSampler(SamplerNoFilter); pth->glpic->SetSampler((dameth & DAMETH_CLAMPED)? SamplerClampXY : SamplerRepeat);
polymost_setuptexture(pth->glpic, dameth, 0); polymost_setuptexture(pth->glpic, dameth, 0);
} }
TArray<uint8_t> flipped(siz.x*siz.y, true); TArray<uint8_t> flipped(siz.x*siz.y, true);
@ -712,17 +713,9 @@ static void gloadtile_art_indexed(int32_t dapic, int32_t dameth, pthtyp* pth, in
pth->palnum = 0; pth->palnum = 0;
pth->shade = 0; pth->shade = 0;
pth->effects = 0; pth->effects = 0;
pth->flags = (PTH_HASALPHA|PTH_ONEBITALPHA) | (npoty*PTH_NPOTWALL) | PTH_INDEXED; pth->flags = PTH_HASALPHA|PTH_ONEBITALPHA| PTH_INDEXED;
pth->hicr = NULL; pth->hicr = NULL;
pth->siz = siz; pth->siz = ssiz;
}
void gloadtile_art(int32_t dapic, int32_t dapal, int32_t tintpalnum, int32_t dashade, int32_t dameth, pthtyp *pth, int32_t doalloc)
{
if (dameth & PTH_INDEXED)
{
return gloadtile_art_indexed(dapic, dameth, pth, doalloc);
}
} }
int32_t gloadtile_hi(int32_t dapic,int32_t dapalnum, int32_t facen, hicreplctyp *hicr, int32_t gloadtile_hi(int32_t dapic,int32_t dapalnum, int32_t facen, hicreplctyp *hicr,

View file

@ -39,7 +39,7 @@ static pthtyp *texcache_tryart(int32_t const dapicnum, int32_t const dapalnum, i
if (pth->flags & PTH_INVALIDATED) if (pth->flags & PTH_INVALIDATED)
{ {
pth->flags &= ~PTH_INVALIDATED; pth->flags &= ~PTH_INVALIDATED;
gloadtile_art(dapicnum, searchpalnum, tintpalnum, dashade, dameth, pth, 0); gloadtile_art(dapicnum, dameth, pth, 0);
pth->palnum = dapalnum; pth->palnum = dapalnum;
} }
@ -48,8 +48,7 @@ static pthtyp *texcache_tryart(int32_t const dapicnum, int32_t const dapalnum, i
pth = (pthtyp *)Xcalloc(1,sizeof(pthtyp)); pth = (pthtyp *)Xcalloc(1,sizeof(pthtyp));
gloadtile_art(dapicnum, searchpalnum, tintpalnum, dashade, dameth, pth, 1); gloadtile_art(dapicnum, dameth, pth, 1);
//thl.AddToCache(dapicnum, dapalnum, dameth);
pth->palnum = dapalnum; pth->palnum = dapalnum;
pth->next = texcache.list[j]; pth->next = texcache.list[j];