mirror of
https://github.com/ZDoom/raze-gles.git
synced 2025-01-12 03:00:38 +00:00
- stripped most of the image processing code from kplib, because it's not needed anymore - and also not salvageable for any refactoring.
This commit is contained in:
parent
93ad83b380
commit
0dfe99356d
3 changed files with 9 additions and 1655 deletions
|
@ -23,13 +23,6 @@ typedef struct
|
||||||
|
|
||||||
extern kzfilestate kzfs;
|
extern kzfilestate kzfs;
|
||||||
|
|
||||||
//High-level (easy) picture loading function:
|
|
||||||
extern void kpzdecode (int32_t, intptr_t *, int32_t *, int32_t *);
|
|
||||||
extern void kpzload (const char *, intptr_t *, int32_t *, int32_t *);
|
|
||||||
//Low-level PNG/JPG functions:
|
|
||||||
extern void kpgetdim (const char *, int32_t, int32_t *, int32_t *);
|
|
||||||
extern int32_t kprender (const char *, int32_t, intptr_t, int32_t, int32_t, int32_t);
|
|
||||||
|
|
||||||
//ZIP functions:
|
//ZIP functions:
|
||||||
extern int32_t kzaddstack (const char *);
|
extern int32_t kzaddstack (const char *);
|
||||||
extern void kzuninit ();
|
extern void kzuninit ();
|
||||||
|
|
|
@ -16,6 +16,7 @@
|
||||||
#include "common.h"
|
#include "common.h"
|
||||||
#include "mdsprite.h" // md3model_t
|
#include "mdsprite.h" // md3model_t
|
||||||
#include "colmatch.h"
|
#include "colmatch.h"
|
||||||
|
#include "textures.h"
|
||||||
|
|
||||||
#ifdef USE_OPENGL
|
#ifdef USE_OPENGL
|
||||||
# include "hightile.h"
|
# include "hightile.h"
|
||||||
|
@ -254,14 +255,14 @@ static int32_t Defs_ImportTileFromTexture(char const * const fn, int32_t const t
|
||||||
int32_t xsiz = 0, ysiz = 0;
|
int32_t xsiz = 0, ysiz = 0;
|
||||||
palette_t *picptr = NULL;
|
palette_t *picptr = NULL;
|
||||||
|
|
||||||
int32_t const length = kpzbufload(fn);
|
FTexture* tex = FTexture::GetTexture(fn);
|
||||||
#ifdef WITHKPLIB
|
|
||||||
kpzdecode(length, (intptr_t *)&picptr, &xsiz, &ysiz);
|
|
||||||
#endif
|
|
||||||
|
|
||||||
if (!picptr)
|
// This should be implemented as a separate texture type to avoid maintenance problems elsewhere.
|
||||||
|
if (!tex)
|
||||||
{
|
{
|
||||||
int32_t const artstatus = artCheckUnitFileHeader((uint8_t *)kpzbuf, length);
|
auto fr = kopenFileReader(fn, 0);
|
||||||
|
auto data = fr.Read();
|
||||||
|
int32_t const artstatus = artCheckUnitFileHeader(data.Data(), data.Size());
|
||||||
if (artstatus < 0)
|
if (artstatus < 0)
|
||||||
return artstatus<<8;
|
return artstatus<<8;
|
||||||
|
|
||||||
|
@ -282,7 +283,7 @@ static int32_t Defs_ImportTileFromTexture(char const * const fn, int32_t const t
|
||||||
tileSetSize(tile, xsiz, ysiz);
|
tileSetSize(tile, xsiz, ysiz);
|
||||||
int32_t const dasiz = xsiz * ysiz;
|
int32_t const dasiz = xsiz * ysiz;
|
||||||
|
|
||||||
if (EDUKE32_PREDICT_FALSE(ARTv1_UNITOFFSET + dasiz > length))
|
if (EDUKE32_PREDICT_FALSE(ARTv1_UNITOFFSET + dasiz > (int)data.Size()))
|
||||||
{
|
{
|
||||||
tileSetupDummy(tile);
|
tileSetupDummy(tile);
|
||||||
return 3;
|
return 3;
|
||||||
|
@ -304,7 +305,7 @@ static int32_t Defs_ImportTileFromTexture(char const * const fn, int32_t const t
|
||||||
if (!(paletteloaded & PALETTE_MAIN))
|
if (!(paletteloaded & PALETTE_MAIN))
|
||||||
return -3;
|
return -3;
|
||||||
|
|
||||||
tileSetSize(tile, xsiz, ysiz);
|
tileSetSize(tile, tex->GetWidth(), tex->GetHeight());
|
||||||
|
|
||||||
tile_from_truecolpic(tile, picptr, alphacut);
|
tile_from_truecolpic(tile, picptr, alphacut);
|
||||||
|
|
||||||
|
@ -2057,45 +2058,6 @@ static int32_t defsparser(scriptfile *script)
|
||||||
if (check_file_exist(fn))
|
if (check_file_exist(fn))
|
||||||
break;
|
break;
|
||||||
|
|
||||||
#ifdef POLYMER
|
|
||||||
fd = kopen4load(fn, 0);
|
|
||||||
|
|
||||||
// load the highpalookup and send it to polymer
|
|
||||||
highpaldata = (char *)Xmalloc(PR_HIGHPALOOKUP_DATA_SIZE);
|
|
||||||
|
|
||||||
{
|
|
||||||
char *filebuf;
|
|
||||||
int32_t xsiz, ysiz, filesize, i;
|
|
||||||
|
|
||||||
filesize = kfilelength(fd);
|
|
||||||
|
|
||||||
filebuf = (char *)Xmalloc(filesize);
|
|
||||||
|
|
||||||
klseek(fd, 0, SEEK_SET);
|
|
||||||
if (kread(fd, filebuf, filesize)!=filesize)
|
|
||||||
{ kclose(fd); Xfree(highpaldata); initprintf("Error: didn't read all of \"%s\".\n", fn); break; }
|
|
||||||
|
|
||||||
kclose(fd);
|
|
||||||
kpgetdim(filebuf, filesize, &xsiz, &ysiz);
|
|
||||||
|
|
||||||
if (EDUKE32_PREDICT_FALSE(xsiz != PR_HIGHPALOOKUP_DIM*PR_HIGHPALOOKUP_DIM || ysiz != PR_HIGHPALOOKUP_DIM))
|
|
||||||
{
|
|
||||||
initprintf("Error: image dimensions of \"%s\" must be %dx%d.\n",
|
|
||||||
fn, PR_HIGHPALOOKUP_DIM*PR_HIGHPALOOKUP_DIM, PR_HIGHPALOOKUP_DIM);
|
|
||||||
Xfree(filebuf); Xfree(highpaldata);
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
|
|
||||||
i = kprender(filebuf, filesize, (intptr_t)highpaldata, xsiz*sizeof(coltype), xsiz, ysiz);
|
|
||||||
Xfree(filebuf);
|
|
||||||
if (EDUKE32_PREDICT_FALSE(i))
|
|
||||||
{ Xfree(highpaldata); initprintf("Error: failed rendering \"%s\".\n", fn); break; }
|
|
||||||
}
|
|
||||||
|
|
||||||
polymer_definehighpalookup(basepal, pal, highpaldata);
|
|
||||||
|
|
||||||
Xfree(highpaldata);
|
|
||||||
#endif
|
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case T_TINT:
|
case T_TINT:
|
||||||
|
|
File diff suppressed because it is too large
Load diff
Loading…
Reference in a new issue