mirror of
https://github.com/ZDoom/raze-gles.git
synced 2024-11-13 07:58:04 +00:00
Patch from hunter_rus
git-svn-id: https://svn.eduke32.com/eduke32@665 1a8010ca-5511-0410-912e-c29ae57300e0
This commit is contained in:
parent
697b640ea7
commit
c5d5cdc879
9 changed files with 170 additions and 52 deletions
|
@ -278,6 +278,8 @@ extern int usevoxels, voxscale[MAXVOXELS];
|
||||||
#ifdef POLYMOST
|
#ifdef POLYMOST
|
||||||
extern int usemodels, usehightile;
|
extern int usemodels, usehightile;
|
||||||
#endif
|
#endif
|
||||||
|
EXTERN int h_xsize[MAXTILES], h_ysize[MAXTILES];
|
||||||
|
EXTERN signed char h_xoffs[MAXTILES], h_yoffs[MAXTILES];
|
||||||
|
|
||||||
extern char *engineerrstr;
|
extern char *engineerrstr;
|
||||||
extern char noclip;
|
extern char noclip;
|
||||||
|
|
|
@ -19,7 +19,7 @@
|
||||||
#if defined(__APPLE__)
|
#if defined(__APPLE__)
|
||||||
# include <OpenGL/glext.h>
|
# include <OpenGL/glext.h>
|
||||||
#else
|
#else
|
||||||
# include "glext.h"
|
# include "GL/glext.h"
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#ifndef GL_MAX_TEXTURE_MAX_ANISOTROPY_EXT
|
#ifndef GL_MAX_TEXTURE_MAX_ANISOTROPY_EXT
|
||||||
|
|
|
@ -69,6 +69,7 @@ enum
|
||||||
T_FOGPAL,
|
T_FOGPAL,
|
||||||
T_LOADGRP,
|
T_LOADGRP,
|
||||||
T_DUMMYTILE,T_DUMMYTILERANGE,
|
T_DUMMYTILE,T_DUMMYTILERANGE,
|
||||||
|
T_SETUPTILE,T_SETUPTILERANGE,
|
||||||
T_CACHESIZE,
|
T_CACHESIZE,
|
||||||
T_MUSIC,T_ID,T_SOUND,
|
T_MUSIC,T_ID,T_SOUND,
|
||||||
T_REDPAL,T_BLUEPAL,T_BROWNPAL,T_GREYPAL,T_GREENPAL,T_SPECPAL
|
T_REDPAL,T_BLUEPAL,T_BROWNPAL,T_GREYPAL,T_GREENPAL,T_SPECPAL
|
||||||
|
@ -120,6 +121,8 @@ static tokenlist basetokens[] =
|
||||||
{ "loadgrp", T_LOADGRP },
|
{ "loadgrp", T_LOADGRP },
|
||||||
{ "dummytile", T_DUMMYTILE },
|
{ "dummytile", T_DUMMYTILE },
|
||||||
{ "dummytilerange", T_DUMMYTILERANGE },
|
{ "dummytilerange", T_DUMMYTILERANGE },
|
||||||
|
{ "setuptile", T_SETUPTILE },
|
||||||
|
{ "setuptilerange", T_SETUPTILERANGE },
|
||||||
{ "cachesize", T_CACHESIZE },
|
{ "cachesize", T_CACHESIZE },
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -516,6 +519,52 @@ static int defsparser(scriptfile *script)
|
||||||
if (scriptfile_getnumber(script,&j)) break;
|
if (scriptfile_getnumber(script,&j)) break;
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
case T_SETUPTILE:
|
||||||
|
{
|
||||||
|
int tile, tmp;
|
||||||
|
|
||||||
|
if (scriptfile_getsymbol(script,&tile)) break;
|
||||||
|
if (tile >= MAXTILES)break;
|
||||||
|
if (scriptfile_getsymbol(script,&h_xsize[tile])) break;
|
||||||
|
if (scriptfile_getsymbol(script,&h_ysize[tile])) break;
|
||||||
|
if (scriptfile_getsymbol(script,&tmp)) break;
|
||||||
|
h_xoffs[tile]=tmp;
|
||||||
|
if (scriptfile_getsymbol(script,&tmp)) break;
|
||||||
|
h_yoffs[tile]=tmp;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
case T_SETUPTILERANGE:
|
||||||
|
{
|
||||||
|
int tile1,tile2,xsiz,ysiz,xoffs,yoffs,i;
|
||||||
|
|
||||||
|
if (scriptfile_getnumber(script,&tile1)) break;
|
||||||
|
if (scriptfile_getnumber(script,&tile2)) break;
|
||||||
|
if (scriptfile_getnumber(script,&xsiz)) break;
|
||||||
|
if (scriptfile_getnumber(script,&ysiz)) break;
|
||||||
|
if (scriptfile_getsymbol(script,&xoffs)) break;
|
||||||
|
if (scriptfile_getsymbol(script,&yoffs)) break;
|
||||||
|
if (tile2 < tile1)
|
||||||
|
{
|
||||||
|
initprintf("Warning: backwards tile range on line %s:%d\n", script->filename, scriptfile_getlinum(script,cmdtokptr));
|
||||||
|
i = tile2;
|
||||||
|
tile2 = tile1;
|
||||||
|
tile1 = i;
|
||||||
|
}
|
||||||
|
if ((tile1 >= 0 && tile1 < MAXTILES) && (tile2 >= 0 && tile2 < MAXTILES))
|
||||||
|
{
|
||||||
|
for (i=tile1;i<=tile2;i++)
|
||||||
|
{
|
||||||
|
if ((unsigned int)i < MAXTILES)
|
||||||
|
{
|
||||||
|
h_xsize[i] = xsiz;
|
||||||
|
h_ysize[i] = ysiz;
|
||||||
|
h_xoffs[i] = xoffs;
|
||||||
|
h_yoffs[i] = yoffs;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
}
|
||||||
case T_DUMMYTILE:
|
case T_DUMMYTILE:
|
||||||
{
|
{
|
||||||
int tile, xsiz, ysiz, j;
|
int tile, xsiz, ysiz, j;
|
||||||
|
|
|
@ -7909,6 +7909,8 @@ int loadpics(char *filename, int askedsize)
|
||||||
//
|
//
|
||||||
char cachedebug = 0;
|
char cachedebug = 0;
|
||||||
char faketile[MAXTILES];
|
char faketile[MAXTILES];
|
||||||
|
int h_xsize[MAXTILES], h_ysize[MAXTILES];
|
||||||
|
signed char h_xoffs[MAXTILES], h_yoffs[MAXTILES];
|
||||||
|
|
||||||
void loadtile(short tilenume)
|
void loadtile(short tilenume)
|
||||||
{
|
{
|
||||||
|
|
|
@ -154,7 +154,7 @@ void (APIENTRY * bglBeginQueryARB)(GLenum target, GLuint id);
|
||||||
void (APIENTRY * bglEndQueryARB)(GLenum target);
|
void (APIENTRY * bglEndQueryARB)(GLenum target);
|
||||||
void (APIENTRY * bglGetQueryivARB)(GLenum target, GLenum pname, GLint *params);
|
void (APIENTRY * bglGetQueryivARB)(GLenum target, GLenum pname, GLint *params);
|
||||||
void (APIENTRY * bglGetQueryObjectivARB)(GLuint id, GLenum pname, GLint *params);
|
void (APIENTRY * bglGetQueryObjectivARB)(GLuint id, GLenum pname, GLint *params);
|
||||||
void (APIENTRY * bglGetQueryObjectuivARB)(uint id, GLenum pname, GLuint *params);
|
void (APIENTRY * bglGetQueryObjectuivARB)(GLuint id, GLenum pname, GLuint *params);
|
||||||
|
|
||||||
// GLU
|
// GLU
|
||||||
void (APIENTRY * bgluTessBeginContour)(GLUtesselator* tess);
|
void (APIENTRY * bgluTessBeginContour)(GLUtesselator* tess);
|
||||||
|
|
|
@ -6,7 +6,7 @@
|
||||||
|
|
||||||
#include "kplib.h"
|
#include "kplib.h"
|
||||||
|
|
||||||
#define HICEFFECTMASK (1|2)
|
#define HICEFFECTMASK (1|2|4)
|
||||||
palette_t hictinting[MAXPALOOKUPS];
|
palette_t hictinting[MAXPALOOKUPS];
|
||||||
|
|
||||||
//moved into polymost.h
|
//moved into polymost.h
|
||||||
|
|
|
@ -660,6 +660,7 @@ static int daskinloader(int filh, int *fptr, int *bpl, int *sizx, int *sizy, int
|
||||||
char *picfil,*cptr,al=255;
|
char *picfil,*cptr,al=255;
|
||||||
coltype *pic;
|
coltype *pic;
|
||||||
int xsiz, ysiz, tsizx, tsizy;
|
int xsiz, ysiz, tsizx, tsizy;
|
||||||
|
int r, g, b;
|
||||||
|
|
||||||
picfillen = kfilelength(filh);
|
picfillen = kfilelength(filh);
|
||||||
picfil = (char *)malloc(picfillen); if (!picfil) { return -1; }
|
picfil = (char *)malloc(picfillen); if (!picfil) { return -1; }
|
||||||
|
@ -692,6 +693,9 @@ static int daskinloader(int filh, int *fptr, int *bpl, int *sizx, int *sizy, int
|
||||||
|
|
||||||
applypalmapSkin((char *)pic,tsizx,tsizy,pal);
|
applypalmapSkin((char *)pic,tsizx,tsizy,pal);
|
||||||
cptr = &britable[gammabrightness ? 0 : curbrightness][0];
|
cptr = &britable[gammabrightness ? 0 : curbrightness][0];
|
||||||
|
r=(glinfo.bgra)?hictinting[pal].b:hictinting[pal].r;
|
||||||
|
g=hictinting[pal].g;
|
||||||
|
b=(glinfo.bgra)?hictinting[pal].r:hictinting[pal].b;
|
||||||
for (y=0,j=0;y<tsizy;y++,j+=xsiz)
|
for (y=0,j=0;y<tsizy;y++,j+=xsiz)
|
||||||
{
|
{
|
||||||
coltype *rpptr = &pic[j], tcol;
|
coltype *rpptr = &pic[j], tcol;
|
||||||
|
@ -715,6 +719,13 @@ static int daskinloader(int filh, int *fptr, int *bpl, int *sizx, int *sizy, int
|
||||||
tcol.g = 255-tcol.g;
|
tcol.g = 255-tcol.g;
|
||||||
tcol.r = 255-tcol.r;
|
tcol.r = 255-tcol.r;
|
||||||
}
|
}
|
||||||
|
if (effect & 4)
|
||||||
|
{
|
||||||
|
// colorize
|
||||||
|
tcol.b = min((int)(tcol.b)*b/64,255);
|
||||||
|
tcol.g = min((int)(tcol.g)*g/64,255);
|
||||||
|
tcol.r = min((int)(tcol.r)*r/64,255);
|
||||||
|
}
|
||||||
|
|
||||||
rpptr[x].b = tcol.b;
|
rpptr[x].b = tcol.b;
|
||||||
rpptr[x].g = tcol.g;
|
rpptr[x].g = tcol.g;
|
||||||
|
@ -1735,6 +1746,8 @@ static int md3draw(md3model *m, spritetype *tspr)
|
||||||
bglEnable(GL_TEXTURE_2D);
|
bglEnable(GL_TEXTURE_2D);
|
||||||
|
|
||||||
pc[0] = pc[1] = pc[2] = ((float)(numpalookups-min(max((globalshade * shadescale)+m->shadeoff,0),numpalookups)))/((float)numpalookups);
|
pc[0] = pc[1] = pc[2] = ((float)(numpalookups-min(max((globalshade * shadescale)+m->shadeoff,0),numpalookups)))/((float)numpalookups);
|
||||||
|
if (!(hictinting[globalpal].f&4))
|
||||||
|
{
|
||||||
if (!(m->flags&1)||sector[sprite[tspr->owner].sectnum].floorpal!=0)
|
if (!(m->flags&1)||sector[sprite[tspr->owner].sectnum].floorpal!=0)
|
||||||
{
|
{
|
||||||
pc[0] *= (float)hictinting[globalpal].r / 255.0;
|
pc[0] *= (float)hictinting[globalpal].r / 255.0;
|
||||||
|
@ -1748,6 +1761,7 @@ static int md3draw(md3model *m, spritetype *tspr)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else globalnoeffect=1;
|
else globalnoeffect=1;
|
||||||
|
}
|
||||||
|
|
||||||
if (tspr->cstat&2) { if (!(tspr->cstat&512)) pc[3] = 0.66; else pc[3] = 0.33; }
|
if (tspr->cstat&2) { if (!(tspr->cstat&512)) pc[3] = 0.66; else pc[3] = 0.33; }
|
||||||
else pc[3] = 1.0;
|
else pc[3] = 1.0;
|
||||||
|
|
|
@ -1472,6 +1472,7 @@ int gloadtile_hi(int dapic,int dapalnum, int facen, hicreplctyp *hicr, int damet
|
||||||
{
|
{
|
||||||
coltype *pic = NULL, *rpptr;
|
coltype *pic = NULL, *rpptr;
|
||||||
int j, x, y, xsiz=0, ysiz=0, tsizx, tsizy;
|
int j, x, y, xsiz=0, ysiz=0, tsizx, tsizy;
|
||||||
|
int r, g, b;
|
||||||
|
|
||||||
char *picfil = NULL, *fn, hasalpha = 255;
|
char *picfil = NULL, *fn, hasalpha = 255;
|
||||||
int picfillen, texfmt = GL_RGBA, intexfmt = GL_RGBA, filh;
|
int picfillen, texfmt = GL_RGBA, intexfmt = GL_RGBA, filh;
|
||||||
|
@ -1549,6 +1550,10 @@ int gloadtile_hi(int dapic,int dapalnum, int facen, hicreplctyp *hicr, int damet
|
||||||
|
|
||||||
if (kprender(picfil,picfillen,(int)pic,xsiz*sizeof(coltype),xsiz,ysiz,0,0)) { free(picfil); free(pic); return -2; }
|
if (kprender(picfil,picfillen,(int)pic,xsiz*sizeof(coltype),xsiz,ysiz,0,0)) { free(picfil); free(pic); return -2; }
|
||||||
applypalmapsT((char *)pic,tsizx,tsizy,dapalnum);
|
applypalmapsT((char *)pic,tsizx,tsizy,dapalnum);
|
||||||
|
|
||||||
|
r=(glinfo.bgra)?hictinting[dapalnum].r:hictinting[dapalnum].b;
|
||||||
|
g=hictinting[dapalnum].g;
|
||||||
|
b=(glinfo.bgra)?hictinting[dapalnum].b:hictinting[dapalnum].r;
|
||||||
for (y=0,j=0;y<tsizy;y++,j+=xsiz)
|
for (y=0,j=0;y<tsizy;y++,j+=xsiz)
|
||||||
{
|
{
|
||||||
coltype tcol;
|
coltype tcol;
|
||||||
|
@ -1575,6 +1580,13 @@ int gloadtile_hi(int dapic,int dapalnum, int facen, hicreplctyp *hicr, int damet
|
||||||
tcol.g = 255-tcol.g;
|
tcol.g = 255-tcol.g;
|
||||||
tcol.r = 255-tcol.r;
|
tcol.r = 255-tcol.r;
|
||||||
}
|
}
|
||||||
|
if (effect & 4)
|
||||||
|
{
|
||||||
|
// colorize
|
||||||
|
tcol.b = min((int)((tcol.b)*r)/64,255);
|
||||||
|
tcol.g = min((int)((tcol.g)*g)/64,255);
|
||||||
|
tcol.r = min((int)((tcol.r)*b)/64,255);
|
||||||
|
}
|
||||||
|
|
||||||
rpptr[x].b = tcol.b;
|
rpptr[x].b = tcol.b;
|
||||||
rpptr[x].g = tcol.g;
|
rpptr[x].g = tcol.g;
|
||||||
|
@ -1973,6 +1985,7 @@ void drawpoly(double *dpx, double *dpy, int n, int method)
|
||||||
}
|
}
|
||||||
// tinting happens only to hightile textures, and only if the texture we're
|
// tinting happens only to hightile textures, and only if the texture we're
|
||||||
// rendering isn't for the same palette as what we asked for
|
// rendering isn't for the same palette as what we asked for
|
||||||
|
if (!(hictinting[globalpal].f&4))
|
||||||
if (pth && (pth->flags & 2))
|
if (pth && (pth->flags & 2))
|
||||||
{
|
{
|
||||||
if (pth->palnum != globalpal)
|
if (pth->palnum != globalpal)
|
||||||
|
@ -2831,6 +2844,7 @@ static void polymost_drawalls(int bunch)
|
||||||
double t, r, t0, t1, ocy0, ocy1, ofy0, ofy1, oxp0, oyp0, ft[4];
|
double t, r, t0, t1, ocy0, ocy1, ofy0, ofy1, oxp0, oyp0, ft[4];
|
||||||
double oguo, ogux, oguy;
|
double oguo, ogux, oguy;
|
||||||
int i, x, y, z, cz, fz, wallnum, sectnum, nextsectnum;
|
int i, x, y, z, cz, fz, wallnum, sectnum, nextsectnum;
|
||||||
|
int ypan; // for panning correction
|
||||||
|
|
||||||
sectnum = thesector[bunchfirst[bunch]]; sec = §or[sectnum];
|
sectnum = thesector[bunchfirst[bunch]]; sec = §or[sectnum];
|
||||||
|
|
||||||
|
@ -3711,7 +3725,12 @@ static void polymost_drawalls(int bunch)
|
||||||
t1 = ((float)(i-globalposz))*ryp1 + ghoriz;
|
t1 = ((float)(i-globalposz))*ryp1 + ghoriz;
|
||||||
t = ((gdx*x0 + gdo) * (float)wal->yrepeat) / ((x1-x0) * ryp0 * 2048.f);
|
t = ((gdx*x0 + gdo) * (float)wal->yrepeat) / ((x1-x0) * ryp0 * 2048.f);
|
||||||
i = (1<<(picsiz[globalpicnum]>>4)); if (i < tilesizy[globalpicnum]) i <<= 1;
|
i = (1<<(picsiz[globalpicnum]>>4)); if (i < tilesizy[globalpicnum]) i <<= 1;
|
||||||
fy = (float)wal->ypanning * ((float)i) / 256.0;
|
|
||||||
|
ypan = wal->ypanning;
|
||||||
|
if (ypan>256-(i-tilesizy[globalpicnum])*(256./i))
|
||||||
|
ypan -= (i-tilesizy[globalpicnum])*(256./i);
|
||||||
|
|
||||||
|
fy = (float)ypan * ((float)i) / 256.0;
|
||||||
gvx = (t0-t1)*t;
|
gvx = (t0-t1)*t;
|
||||||
gvy = (x1-x0)*t;
|
gvy = (x1-x0)*t;
|
||||||
gvo = -gvx*x0 - gvy*t0 + fy*gdo; gvx += fy*gdx; gvy += fy*gdy;
|
gvo = -gvx*x0 - gvy*t0 + fy*gdo; gvx += fy*gdx; gvy += fy*gdy;
|
||||||
|
@ -3753,7 +3772,12 @@ static void polymost_drawalls(int bunch)
|
||||||
t1 = ((float)(i-globalposz))*ryp1 + ghoriz;
|
t1 = ((float)(i-globalposz))*ryp1 + ghoriz;
|
||||||
t = ((gdx*x0 + gdo) * (float)wal->yrepeat) / ((x1-x0) * ryp0 * 2048.f);
|
t = ((gdx*x0 + gdo) * (float)wal->yrepeat) / ((x1-x0) * ryp0 * 2048.f);
|
||||||
i = (1<<(picsiz[globalpicnum]>>4)); if (i < tilesizy[globalpicnum]) i <<= 1;
|
i = (1<<(picsiz[globalpicnum]>>4)); if (i < tilesizy[globalpicnum]) i <<= 1;
|
||||||
fy = (float)nwal->ypanning * ((float)i) / 256.0;
|
|
||||||
|
ypan = nwal->ypanning;
|
||||||
|
if (ypan>256-(i-tilesizy[globalpicnum])*(256./i))
|
||||||
|
ypan -= (i-tilesizy[globalpicnum])*(256./i);
|
||||||
|
|
||||||
|
fy = (float)ypan * ((float)i) / 256.0;
|
||||||
gvx = (t0-t1)*t;
|
gvx = (t0-t1)*t;
|
||||||
gvy = (x1-x0)*t;
|
gvy = (x1-x0)*t;
|
||||||
gvo = -gvx*x0 - gvy*t0 + fy*gdo; gvx += fy*gdx; gvy += fy*gdy;
|
gvo = -gvx*x0 - gvy*t0 + fy*gdo; gvx += fy*gdx; gvy += fy*gdy;
|
||||||
|
@ -3791,7 +3815,12 @@ static void polymost_drawalls(int bunch)
|
||||||
t1 = ((float)(i-globalposz))*ryp1 + ghoriz;
|
t1 = ((float)(i-globalposz))*ryp1 + ghoriz;
|
||||||
t = ((gdx*x0 + gdo) * (float)wal->yrepeat) / ((x1-x0) * ryp0 * 2048.f);
|
t = ((gdx*x0 + gdo) * (float)wal->yrepeat) / ((x1-x0) * ryp0 * 2048.f);
|
||||||
i = (1<<(picsiz[globalpicnum]>>4)); if (i < tilesizy[globalpicnum]) i <<= 1;
|
i = (1<<(picsiz[globalpicnum]>>4)); if (i < tilesizy[globalpicnum]) i <<= 1;
|
||||||
fy = (float)wal->ypanning * ((float)i) / 256.0;
|
|
||||||
|
ypan = wal->ypanning;
|
||||||
|
if (ypan>256-(i-tilesizy[globalpicnum])*(256./i))
|
||||||
|
ypan -= (i-tilesizy[globalpicnum])*(256./i);
|
||||||
|
|
||||||
|
fy = (float)ypan * ((float)i) / 256.0;
|
||||||
gvx = (t0-t1)*t;
|
gvx = (t0-t1)*t;
|
||||||
gvy = (x1-x0)*t;
|
gvy = (x1-x0)*t;
|
||||||
gvo = -gvx*x0 - gvy*t0 + fy*gdo; gvx += fy*gdx; gvy += fy*gdy;
|
gvo = -gvx*x0 - gvy*t0 + fy*gdo; gvx += fy*gdx; gvy += fy*gdy;
|
||||||
|
@ -4359,6 +4388,8 @@ void polymost_drawsprite(int snum)
|
||||||
int i, j, spritenum, xoff=0, yoff=0, method, npoints;
|
int i, j, spritenum, xoff=0, yoff=0, method, npoints;
|
||||||
spritetype *tspr;
|
spritetype *tspr;
|
||||||
int posx,posy;
|
int posx,posy;
|
||||||
|
int oldsizx, oldsizy;
|
||||||
|
int tsizx, tsizy;
|
||||||
|
|
||||||
tspr = tspriteptr[snum];
|
tspr = tspriteptr[snum];
|
||||||
if (tspr->owner < 0 || tspr->picnum < 0) return;
|
if (tspr->owner < 0 || tspr->picnum < 0) return;
|
||||||
|
@ -4371,10 +4402,13 @@ void polymost_drawsprite(int snum)
|
||||||
|
|
||||||
if ((globalorientation&48) != 48) // only non-voxel sprites should do this
|
if ((globalorientation&48) != 48) // only non-voxel sprites should do this
|
||||||
{
|
{
|
||||||
|
int flag;
|
||||||
if (picanm[globalpicnum]&192) globalpicnum += animateoffs(globalpicnum,spritenum+32768);
|
if (picanm[globalpicnum]&192) globalpicnum += animateoffs(globalpicnum,spritenum+32768);
|
||||||
|
flag = usehightile&&h_xsize[globalpicnum];
|
||||||
xoff = (int)((signed char)((picanm[globalpicnum]>>8)&255))+((int)tspr->xoffset);
|
xoff = (int)tspr->xoffset;
|
||||||
yoff = (int)((signed char)((picanm[globalpicnum]>>16)&255))+((int)tspr->yoffset);
|
yoff = (int)tspr->yoffset;
|
||||||
|
xoff += (signed char)((flag)?(h_xoffs[globalpicnum]):((picanm[globalpicnum]>>8)&255));
|
||||||
|
yoff += (signed char)((flag)?(h_yoffs[globalpicnum]):((picanm[globalpicnum]>>16)&255));
|
||||||
}
|
}
|
||||||
|
|
||||||
method = 1+4;
|
method = 1+4;
|
||||||
|
@ -4434,6 +4468,13 @@ void polymost_drawsprite(int snum)
|
||||||
posx-=(sintable[(tspr->ang+512)&2047]>>13);
|
posx-=(sintable[(tspr->ang+512)&2047]>>13);
|
||||||
posy-=(sintable[(tspr->ang)&2047]>>13);
|
posy-=(sintable[(tspr->ang)&2047]>>13);
|
||||||
}
|
}
|
||||||
|
oldsizx=tsizx=tilesizx[globalpicnum];
|
||||||
|
oldsizy=tsizy=tilesizy[globalpicnum];
|
||||||
|
if (usehightile&&h_xsize[globalpicnum])
|
||||||
|
{
|
||||||
|
tsizx=h_xsize[globalpicnum];
|
||||||
|
tsizy=h_ysize[globalpicnum];
|
||||||
|
}
|
||||||
|
|
||||||
switch ((globalorientation>>4)&3)
|
switch ((globalorientation>>4)&3)
|
||||||
{
|
{
|
||||||
|
@ -4451,10 +4492,10 @@ void polymost_drawsprite(int snum)
|
||||||
f = ryp0*(float)xdimen/160.0;
|
f = ryp0*(float)xdimen/160.0;
|
||||||
fx = ((float)tspr->xrepeat)*f;
|
fx = ((float)tspr->xrepeat)*f;
|
||||||
fy = ((float)tspr->yrepeat)*f*((float)yxaspect/65536.0);
|
fy = ((float)tspr->yrepeat)*f*((float)yxaspect/65536.0);
|
||||||
sx0 -= fx*(float)xoff; if (tilesizx[globalpicnum]&1) sx0 += fx*.5;
|
sx0 -= fx*(float)xoff; if (tsizx&1) sx0 += fx*.5;
|
||||||
sy0 -= fy*(float)yoff;
|
sy0 -= fy*(float)yoff;
|
||||||
fx *= ((float)tilesizx[globalpicnum]);
|
fx *= ((float)tsizx);
|
||||||
fy *= ((float)tilesizy[globalpicnum]);
|
fy *= ((float)tsizy);
|
||||||
|
|
||||||
px[0] = px[3] = sx0-fx*.5; px[1] = px[2] = sx0+fx*.5;
|
px[0] = px[3] = sx0-fx*.5; px[1] = px[2] = sx0+fx*.5;
|
||||||
if (!(globalorientation&128)) { py[0] = py[1] = sy0-fy; py[2] = py[3] = sy0; }
|
if (!(globalorientation&128)) { py[0] = py[1] = sy0-fy; py[2] = py[3] = sy0; }
|
||||||
|
@ -4462,17 +4503,17 @@ void polymost_drawsprite(int snum)
|
||||||
|
|
||||||
gdx = gdy = guy = gvx = 0; gdo = ryp0*gviewxrange;
|
gdx = gdy = guy = gvx = 0; gdo = ryp0*gviewxrange;
|
||||||
if (!(globalorientation&4))
|
if (!(globalorientation&4))
|
||||||
{ gux = (float)tilesizx[globalpicnum]*gdo/(px[1]-px[0]+.002); guo = -gux*(px[0]-.001); }
|
{ gux = (float)tsizx*gdo/(px[1]-px[0]+.002); guo = -gux*(px[0]-.001); }
|
||||||
else { gux = (float)tilesizx[globalpicnum]*gdo/(px[0]-px[1]-.002); guo = -gux*(px[1]+.001); }
|
else { gux = (float)tsizx*gdo/(px[0]-px[1]-.002); guo = -gux*(px[1]+.001); }
|
||||||
if (!(globalorientation&8))
|
if (!(globalorientation&8))
|
||||||
{ gvy = (float)tilesizy[globalpicnum]*gdo/(py[3]-py[0]+.002); gvo = -gvy*(py[0]-.001); }
|
{ gvy = (float)tsizy*gdo/(py[3]-py[0]+.002); gvo = -gvy*(py[0]-.001); }
|
||||||
else { gvy = (float)tilesizy[globalpicnum]*gdo/(py[0]-py[3]-.002); gvo = -gvy*(py[3]+.001); }
|
else { gvy = (float)tsizy*gdo/(py[0]-py[3]-.002); gvo = -gvy*(py[3]+.001); }
|
||||||
|
|
||||||
// sprite panning
|
// sprite panning
|
||||||
guy -= gdy*((float)(spriteext[spritenum].xpanning)/255.f)*tilesizx[globalpicnum];
|
guy -= gdy*((float)(spriteext[spritenum].xpanning)/255.f)*tsizx;
|
||||||
guo -= gdo*((float)(spriteext[spritenum].xpanning)/255.f)*tilesizx[globalpicnum];
|
guo -= gdo*((float)(spriteext[spritenum].xpanning)/255.f)*tsizx;
|
||||||
gvy -= gdy*((float)(spriteext[spritenum].ypanning)/255.f)*tilesizy[globalpicnum];
|
gvy -= gdy*((float)(spriteext[spritenum].ypanning)/255.f)*tsizy;
|
||||||
gvo -= gdo*((float)(spriteext[spritenum].ypanning)/255.f)*tilesizy[globalpicnum];
|
gvo -= gdo*((float)(spriteext[spritenum].ypanning)/255.f)*tsizy;
|
||||||
|
|
||||||
//Clip sprites to ceilings/floors when no parallaxing and not sloped
|
//Clip sprites to ceilings/floors when no parallaxing and not sloped
|
||||||
if (!(sector[tspr->sectnum].ceilingstat&3))
|
if (!(sector[tspr->sectnum].ceilingstat&3))
|
||||||
|
@ -4492,7 +4533,8 @@ void polymost_drawsprite(int snum)
|
||||||
if (spriteext[spritenum].ypanning)
|
if (spriteext[spritenum].ypanning)
|
||||||
trepeat = 1;
|
trepeat = 1;
|
||||||
#endif
|
#endif
|
||||||
|
tilesizx[globalpicnum] = tsizx;
|
||||||
|
tilesizy[globalpicnum] = tsizy;
|
||||||
pow2xsplit = 0; drawpoly(px,py,4,method);
|
pow2xsplit = 0; drawpoly(px,py,4,method);
|
||||||
|
|
||||||
#ifdef USE_OPENGL
|
#ifdef USE_OPENGL
|
||||||
|
@ -4511,9 +4553,9 @@ void polymost_drawsprite(int snum)
|
||||||
|
|
||||||
xv = (float)tspr->xrepeat * (float)sintable[(tspr->ang)&2047] / 65536.0;
|
xv = (float)tspr->xrepeat * (float)sintable[(tspr->ang)&2047] / 65536.0;
|
||||||
yv = (float)tspr->xrepeat * (float)sintable[(tspr->ang+1536)&2047] / 65536.0;
|
yv = (float)tspr->xrepeat * (float)sintable[(tspr->ang+1536)&2047] / 65536.0;
|
||||||
f = (float)(tilesizx[globalpicnum]>>1) + (float)xoff;
|
f = (float)(tsizx>>1) + (float)xoff;
|
||||||
x0 = (float)(posx-globalposx) - xv*f; x1 = xv*(float)tilesizx[globalpicnum] + x0;
|
x0 = (float)(posx-globalposx) - xv*f; x1 = xv*(float)tsizx + x0;
|
||||||
y0 = (float)(posy-globalposy) - yv*f; y1 = yv*(float)tilesizx[globalpicnum] + y0;
|
y0 = (float)(posy-globalposy) - yv*f; y1 = yv*(float)tsizx + y0;
|
||||||
|
|
||||||
yp0 = x0*gcosang2 + y0*gsinang2;
|
yp0 = x0*gcosang2 + y0*gsinang2;
|
||||||
yp1 = x1*gcosang2 + y1*gsinang2;
|
yp1 = x1*gcosang2 + y1*gsinang2;
|
||||||
|
@ -4528,7 +4570,7 @@ void polymost_drawsprite(int snum)
|
||||||
if (yp1 < SCISDIST) { t1 = (SCISDIST-oyp0)/(yp1-oyp0); xp1 = (xp1-oxp0)*t1+oxp0; yp1 = SCISDIST; }
|
if (yp1 < SCISDIST) { t1 = (SCISDIST-oyp0)/(yp1-oyp0); xp1 = (xp1-oxp0)*t1+oxp0; yp1 = SCISDIST; }
|
||||||
else { t1 = 1.f; }
|
else { t1 = 1.f; }
|
||||||
|
|
||||||
f = ((float)tspr->yrepeat) * (float)tilesizy[globalpicnum] * 4;
|
f = ((float)tspr->yrepeat) * (float)tsizy * 4;
|
||||||
|
|
||||||
ryp0 = 1.0/yp0;
|
ryp0 = 1.0/yp0;
|
||||||
ryp1 = 1.0/yp1;
|
ryp1 = 1.0/yp1;
|
||||||
|
@ -4540,8 +4582,8 @@ void polymost_drawsprite(int snum)
|
||||||
tspr->z -= ((yoff*tspr->yrepeat)<<2);
|
tspr->z -= ((yoff*tspr->yrepeat)<<2);
|
||||||
if (globalorientation&128)
|
if (globalorientation&128)
|
||||||
{
|
{
|
||||||
tspr->z += ((tilesizy[globalpicnum]*tspr->yrepeat)<<1);
|
tspr->z += ((tsizy*tspr->yrepeat)<<1);
|
||||||
if (tilesizy[globalpicnum]&1) tspr->z += (tspr->yrepeat<<1); //Odd yspans
|
if (tsizy&1) tspr->z += (tspr->yrepeat<<1); //Odd yspans
|
||||||
}
|
}
|
||||||
|
|
||||||
sc0 = ((float)(tspr->z-globalposz-f))*ryp0 + ghoriz;
|
sc0 = ((float)(tspr->z-globalposz-f))*ryp0 + ghoriz;
|
||||||
|
@ -4554,29 +4596,29 @@ void polymost_drawsprite(int snum)
|
||||||
gdo = ryp0*gxyaspect - gdx*sx0;
|
gdo = ryp0*gxyaspect - gdx*sx0;
|
||||||
|
|
||||||
//Original equations:
|
//Original equations:
|
||||||
//(gux*sx0 + guo)/(gdx*sx1 + gdo) = tilesizx[globalpicnum]*t0
|
//(gux*sx0 + guo)/(gdx*sx1 + gdo) = tsizx*t0
|
||||||
//(gux*sx1 + guo)/(gdx*sx1 + gdo) = tilesizx[globalpicnum]*t1
|
//(gux*sx1 + guo)/(gdx*sx1 + gdo) = tsizx*t1
|
||||||
//
|
//
|
||||||
// gvx*sx0 + gvy*sc0 + gvo = 0
|
// gvx*sx0 + gvy*sc0 + gvo = 0
|
||||||
// gvy*sx1 + gvy*sc1 + gvo = 0
|
// gvy*sx1 + gvy*sc1 + gvo = 0
|
||||||
//(gvx*sx0 + gvy*sf0 + gvo)/(gdx*sx0 + gdo) = tilesizy[globalpicnum]
|
//(gvx*sx0 + gvy*sf0 + gvo)/(gdx*sx0 + gdo) = tsizy
|
||||||
//(gvx*sx1 + gvy*sf1 + gvo)/(gdx*sx1 + gdo) = tilesizy[globalpicnum]
|
//(gvx*sx1 + gvy*sf1 + gvo)/(gdx*sx1 + gdo) = tsizy
|
||||||
|
|
||||||
//gux*sx0 + guo = t0*tilesizx[globalpicnum]*yp0
|
//gux*sx0 + guo = t0*tsizx*yp0
|
||||||
//gux*sx1 + guo = t1*tilesizx[globalpicnum]*yp1
|
//gux*sx1 + guo = t1*tsizx*yp1
|
||||||
if (globalorientation&4) { t0 = 1.f-t0; t1 = 1.f-t1; }
|
if (globalorientation&4) { t0 = 1.f-t0; t1 = 1.f-t1; }
|
||||||
|
|
||||||
//sprite panning
|
//sprite panning
|
||||||
t0 -= ((float)(spriteext[spritenum].xpanning)/255.f);
|
t0 -= ((float)(spriteext[spritenum].xpanning)/255.f);
|
||||||
t1 -= ((float)(spriteext[spritenum].xpanning)/255.f);
|
t1 -= ((float)(spriteext[spritenum].xpanning)/255.f);
|
||||||
gux = (t0*ryp0 - t1*ryp1)*gxyaspect*(float)tilesizx[globalpicnum] / (sx0-sx1);
|
gux = (t0*ryp0 - t1*ryp1)*gxyaspect*(float)tsizx / (sx0-sx1);
|
||||||
guy = 0;
|
guy = 0;
|
||||||
guo = t0*ryp0*gxyaspect*(float)tilesizx[globalpicnum] - gux*sx0;
|
guo = t0*ryp0*gxyaspect*(float)tsizx - gux*sx0;
|
||||||
|
|
||||||
//gvx*sx0 + gvy*sc0 + gvo = 0
|
//gvx*sx0 + gvy*sc0 + gvo = 0
|
||||||
//gvx*sx1 + gvy*sc1 + gvo = 0
|
//gvx*sx1 + gvy*sc1 + gvo = 0
|
||||||
//gvx*sx0 + gvy*sf0 + gvo = tilesizy[globalpicnum]*(gdx*sx0 + gdo)
|
//gvx*sx0 + gvy*sf0 + gvo = tsizy*(gdx*sx0 + gdo)
|
||||||
f = ((float)tilesizy[globalpicnum])*(gdx*sx0 + gdo) / ((sx0-sx1)*(sc0-sf0));
|
f = ((float)tsizy)*(gdx*sx0 + gdo) / ((sx0-sx1)*(sc0-sf0));
|
||||||
if (!(globalorientation&8))
|
if (!(globalorientation&8))
|
||||||
{
|
{
|
||||||
gvx = (sc0-sc1)*f;
|
gvx = (sc0-sc1)*f;
|
||||||
|
@ -4591,14 +4633,14 @@ void polymost_drawsprite(int snum)
|
||||||
}
|
}
|
||||||
|
|
||||||
// sprite panning
|
// sprite panning
|
||||||
gvx -= gdx*((float)(spriteext[spritenum].ypanning)/255.f)*tilesizy[globalpicnum];
|
gvx -= gdx*((float)(spriteext[spritenum].ypanning)/255.f)*tsizy;
|
||||||
gvy -= gdy*((float)(spriteext[spritenum].ypanning)/255.f)*tilesizy[globalpicnum];
|
gvy -= gdy*((float)(spriteext[spritenum].ypanning)/255.f)*tsizy;
|
||||||
gvo -= gdo*((float)(spriteext[spritenum].ypanning)/255.f)*tilesizy[globalpicnum];
|
gvo -= gdo*((float)(spriteext[spritenum].ypanning)/255.f)*tsizy;
|
||||||
|
|
||||||
//Clip sprites to ceilings/floors when no parallaxing
|
//Clip sprites to ceilings/floors when no parallaxing
|
||||||
if (!(sector[tspr->sectnum].ceilingstat&1))
|
if (!(sector[tspr->sectnum].ceilingstat&1))
|
||||||
{
|
{
|
||||||
f = ((float)tspr->yrepeat) * (float)tilesizy[globalpicnum] * 4;
|
f = ((float)tspr->yrepeat) * (float)tsizy * 4;
|
||||||
if (sector[tspr->sectnum].ceilingz > tspr->z-f)
|
if (sector[tspr->sectnum].ceilingz > tspr->z-f)
|
||||||
{
|
{
|
||||||
sc0 = ((float)(sector[tspr->sectnum].ceilingz-globalposz))*ryp0 + ghoriz;
|
sc0 = ((float)(sector[tspr->sectnum].ceilingz-globalposz))*ryp0 + ghoriz;
|
||||||
|
@ -4634,6 +4676,8 @@ void polymost_drawsprite(int snum)
|
||||||
trepeat = 1;
|
trepeat = 1;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
tilesizx[globalpicnum] = tsizx;
|
||||||
|
tilesizy[globalpicnum] = tsizy;
|
||||||
pow2xsplit = 0; drawpoly(px,py,4,method);
|
pow2xsplit = 0; drawpoly(px,py,4,method);
|
||||||
|
|
||||||
#ifdef USE_OPENGL
|
#ifdef USE_OPENGL
|
||||||
|
@ -4655,10 +4699,10 @@ void polymost_drawsprite(int snum)
|
||||||
i = (tspr->ang&2047);
|
i = (tspr->ang&2047);
|
||||||
c = sintable[(i+512)&2047]/65536.0;
|
c = sintable[(i+512)&2047]/65536.0;
|
||||||
s = sintable[i]/65536.0;
|
s = sintable[i]/65536.0;
|
||||||
x0 = ((tilesizx[globalpicnum]>>1)-xoff)*tspr->xrepeat;
|
x0 = ((tsizx>>1)-xoff)*tspr->xrepeat;
|
||||||
y0 = ((tilesizy[globalpicnum]>>1)-yoff)*tspr->yrepeat;
|
y0 = ((tsizy>>1)-yoff)*tspr->yrepeat;
|
||||||
x1 = ((tilesizx[globalpicnum]>>1)+xoff)*tspr->xrepeat;
|
x1 = ((tsizx>>1)+xoff)*tspr->xrepeat;
|
||||||
y1 = ((tilesizy[globalpicnum]>>1)+yoff)*tspr->yrepeat;
|
y1 = ((tsizy>>1)+yoff)*tspr->yrepeat;
|
||||||
|
|
||||||
//Project 3D to 2D
|
//Project 3D to 2D
|
||||||
for (j=0;j<4;j++)
|
for (j=0;j<4;j++)
|
||||||
|
@ -4727,16 +4771,16 @@ void polymost_drawsprite(int snum)
|
||||||
f =-4.0/(float)tspr->yrepeat; gvx *= f; gvy *= f; gvo *= f;
|
f =-4.0/(float)tspr->yrepeat; gvx *= f; gvy *= f; gvo *= f;
|
||||||
if (globalorientation&4)
|
if (globalorientation&4)
|
||||||
{
|
{
|
||||||
gux = ((float)tilesizx[globalpicnum])*gdx - gux;
|
gux = ((float)tsizx)*gdx - gux;
|
||||||
guy = ((float)tilesizx[globalpicnum])*gdy - guy;
|
guy = ((float)tsizx)*gdy - guy;
|
||||||
guo = ((float)tilesizx[globalpicnum])*gdo - guo;
|
guo = ((float)tsizx)*gdo - guo;
|
||||||
}
|
}
|
||||||
|
|
||||||
// sprite panning
|
// sprite panning
|
||||||
guy -= gdy*((float)(spriteext[spritenum].xpanning)/255.f)*tilesizx[globalpicnum];
|
guy -= gdy*((float)(spriteext[spritenum].xpanning)/255.f)*tsizx;
|
||||||
guo -= gdo*((float)(spriteext[spritenum].xpanning)/255.f)*tilesizx[globalpicnum];
|
guo -= gdo*((float)(spriteext[spritenum].xpanning)/255.f)*tsizx;
|
||||||
gvy -= gdy*((float)(spriteext[spritenum].ypanning)/255.f)*tilesizy[globalpicnum];
|
gvy -= gdy*((float)(spriteext[spritenum].ypanning)/255.f)*tsizy;
|
||||||
gvo -= gdo*((float)(spriteext[spritenum].ypanning)/255.f)*tilesizy[globalpicnum];
|
gvo -= gdo*((float)(spriteext[spritenum].ypanning)/255.f)*tsizy;
|
||||||
|
|
||||||
#ifdef USE_OPENGL
|
#ifdef USE_OPENGL
|
||||||
if (spriteext[spritenum].xpanning)
|
if (spriteext[spritenum].xpanning)
|
||||||
|
@ -4745,6 +4789,8 @@ void polymost_drawsprite(int snum)
|
||||||
trepeat = 1;
|
trepeat = 1;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
tilesizx[globalpicnum] = tsizx;
|
||||||
|
tilesizy[globalpicnum] = tsizy;
|
||||||
pow2xsplit = 0; drawpoly(px,py,npoints,method);
|
pow2xsplit = 0; drawpoly(px,py,npoints,method);
|
||||||
|
|
||||||
#ifdef USE_OPENGL
|
#ifdef USE_OPENGL
|
||||||
|
@ -4759,6 +4805,8 @@ void polymost_drawsprite(int snum)
|
||||||
case 3: //Voxel sprite
|
case 3: //Voxel sprite
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
tilesizx[globalpicnum]=oldsizx;
|
||||||
|
tilesizy[globalpicnum]=oldsizy;
|
||||||
}
|
}
|
||||||
|
|
||||||
//sx,sy center of sprite; screen coods*65536
|
//sx,sy center of sprite; screen coods*65536
|
||||||
|
|
|
@ -2425,6 +2425,9 @@ static int DrawTiles(int iTopLeft, int iSelected, int nXTiles, int nYTiles, int
|
||||||
Bsprintf(szT,"%dx%d",tilesizx[idTile],tilesizy[idTile]);
|
Bsprintf(szT,"%dx%d",tilesizx[idTile],tilesizy[idTile]);
|
||||||
printext256(xdim>>2,ydim-8,whitecol,-1,szT,0);
|
printext256(xdim>>2,ydim-8,whitecol,-1,szT,0);
|
||||||
|
|
||||||
|
Bsprintf(szT,"%d, %d",(picanm[idTile]>>8)&0xFF,(picanm[idTile]>>16)&0xFF);
|
||||||
|
printext256((xdim>>2)+100,ydim-8,whitecol,-1,szT,0);
|
||||||
|
|
||||||
enddrawing();
|
enddrawing();
|
||||||
showframe(1);
|
showframe(1);
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue