mirror of
https://github.com/ZDoom/raze-gles.git
synced 2025-02-23 11:51:23 +00:00
Mapster32: 2d mode performance improvements
git-svn-id: https://svn.eduke32.com/eduke32@5290 1a8010ca-5511-0410-912e-c29ae57300e0
This commit is contained in:
parent
253f0b8771
commit
21e9125f2d
4 changed files with 166 additions and 197 deletions
|
@ -65,33 +65,31 @@ void hlineasm4(int32_t cnt, int32_t skiploadincs, int32_t paloffs, uint32_t by,
|
|||
{
|
||||
if (!skiploadincs) { gbxinc = asm1; gbyinc = asm2; }
|
||||
|
||||
{
|
||||
const char *const A_C_RESTRICT palptr = &ghlinepal[paloffs];
|
||||
const char *const A_C_RESTRICT buf = gbuf;
|
||||
const int32_t bxinc = gbxinc, byinc = gbyinc;
|
||||
const int32_t logx = glogx, logy = glogy;
|
||||
const vec2_t inc ={ gbxinc, gbyinc };
|
||||
const vec2_t log ={ glogx, glogy };
|
||||
const vec2_t log32 ={ 32-log.x, 32-log.y };
|
||||
char *pp = (char *)p;
|
||||
const uint8_t logx32 = 32-logx, logy32 = 32-logy;
|
||||
|
||||
#ifdef CLASSIC_SLICE_BY_4
|
||||
for (; cnt>=4; cnt-=4, pp-=4)
|
||||
{
|
||||
*pp = palptr[buf[((bx>>logx32)<<logy)+(by>>logy32)]];
|
||||
*(pp-1) = palptr[buf[(((bx-bxinc)>>logx32)<<logy)+((by-byinc)>>logy32)]];
|
||||
*(pp-2) = palptr[buf[(((bx-(bxinc<<1))>>logx32)<<logy)+((by-(byinc<<1))>>logy32)]];
|
||||
*(pp-3) = palptr[buf[(((bx-(bxinc*3))>>logx32)<<logy)+((by-(byinc*3))>>logy32)]];
|
||||
*pp = palptr[buf[((bx>>log32.x)<<log.y)+(by>>log32.y)]];
|
||||
*(pp-1) = palptr[buf[(((bx-inc.x)>>log32.x)<<log.y)+((by-inc.y)>>log32.y)]];
|
||||
*(pp-2) = palptr[buf[(((bx-(inc.x<<1))>>log32.x)<<log.y)+((by-(inc.y<<1))>>log32.y)]];
|
||||
*(pp-3) = palptr[buf[(((bx-(inc.x*3))>>log32.x)<<log.y)+((by-(inc.y*3))>>log32.y)]];
|
||||
|
||||
bx -= bxinc<<2;
|
||||
by -= byinc<<2;
|
||||
bx -= inc.x<<2;
|
||||
by -= inc.y<<2;
|
||||
}
|
||||
#endif
|
||||
|
||||
for (; cnt>=0; cnt--, pp--)
|
||||
{
|
||||
*pp = palptr[buf[((bx>>logx32)<<logy)+(by>>logy32)]];
|
||||
bx -= bxinc;
|
||||
by -= byinc;
|
||||
}
|
||||
*pp = palptr[buf[((bx>>log32.x)<<log.y)+(by>>log32.y)]];
|
||||
bx -= inc.x;
|
||||
by -= inc.y;
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -44,9 +44,9 @@ static void CallExtSetupMapFilename(const char *mapname);
|
|||
static void CallExtLoadMap(const char *mapname);
|
||||
static int32_t CallExtPreSaveMap(void);
|
||||
static void CallExtSaveMap(const char *mapname);
|
||||
static const char *CallExtGetSectorCaption(int16_t sectnum);
|
||||
static const char *CallExtGetWallCaption(int16_t wallnum);
|
||||
static const char *CallExtGetSpriteCaption(int16_t spritenum);
|
||||
static inline const char *CallExtGetSectorCaption(int16_t sectnum) { return ExtGetSectorCaption(sectnum); }
|
||||
static inline const char *CallExtGetWallCaption(int16_t wallnum) { return ExtGetWallCaption(wallnum); }
|
||||
static inline const char *CallExtGetSpriteCaption(int16_t spritenum) { return ExtGetSpriteCaption(spritenum); }
|
||||
static void CallExtShowSectorData(int16_t sectnum);
|
||||
static void CallExtShowWallData(int16_t wallnum);
|
||||
static void CallExtShowSpriteData(int16_t spritenum);
|
||||
|
@ -3253,25 +3253,22 @@ static void isc_transform(int32_t *x, int32_t *y)
|
|||
static void drawspritelabel(int i)
|
||||
{
|
||||
const char *dabuffer = CallExtGetSpriteCaption(i);
|
||||
if (dabuffer[0] != 0)
|
||||
{
|
||||
int const blocking = (sprite[i].cstat & 1);
|
||||
|
||||
if (!dabuffer[0])
|
||||
return;
|
||||
|
||||
// int const blocking = (sprite[i].cstat & 1);
|
||||
|
||||
int col = spritecol2d[sprite[i].picnum][0] ? editorcolors[spritecol2d[sprite[i].picnum][0]] : getspritecol(i);
|
||||
|
||||
if (col == -1)
|
||||
col = editorcolors[3];
|
||||
|
||||
if ((i == pointhighlight - 16384) && (totalclock & 32))
|
||||
col += 4;
|
||||
|
||||
if (sprite[i].sectnum < 0)
|
||||
else if (sprite[i].sectnum < 0)
|
||||
col = editorcolors[4]; // red
|
||||
|
||||
drawsmallabel(dabuffer, editorcolors[0], col, /*blocking ? editorcolors[5] :*/ col - 3,
|
||||
sprite[i].x, sprite[i].y, sprite[i].z);
|
||||
}
|
||||
}
|
||||
|
||||
#define EDITING_MAP_P() (newnumwalls>=0 || joinsector[0]>=0 || circlewall>=0 || (bstatus&1) || isc.active)
|
||||
|
||||
|
@ -11080,18 +11077,6 @@ static void CallExtSaveMap(const char *mapname)
|
|||
saveboard("backup.map", &pos, ang, cursectnum);
|
||||
VM_OnEvent(EVENT_SAVEMAP, -1);
|
||||
}
|
||||
static const char *CallExtGetSectorCaption(int16_t sectnum)
|
||||
{
|
||||
return ExtGetSectorCaption(sectnum);
|
||||
}
|
||||
static const char *CallExtGetWallCaption(int16_t wallnum)
|
||||
{
|
||||
return ExtGetWallCaption(wallnum);
|
||||
}
|
||||
static const char *CallExtGetSpriteCaption(int16_t spritenum)
|
||||
{
|
||||
return ExtGetSpriteCaption(spritenum);
|
||||
}
|
||||
static void CallExtShowSectorData(int16_t sectnum)
|
||||
{
|
||||
ExtShowSectorData(sectnum);
|
||||
|
|
|
@ -16483,145 +16483,124 @@ uint32_t drawlinepat = 0xffffffff;
|
|||
|
||||
int32_t drawline16(int32_t x1, int32_t y1, int32_t x2, int32_t y2, char col)
|
||||
{
|
||||
int32_t i, dx, dy, pinc, d;
|
||||
uint32_t patc=0;
|
||||
intptr_t p;
|
||||
|
||||
//int32_t odx,ody;
|
||||
//int32_t ox1=x1,oy1=y1, ox2=x2,oy2=y2;
|
||||
|
||||
dx = x2-x1;
|
||||
dy = y2-y1;
|
||||
vec2_t d ={ x2-x1, y2-y1 };
|
||||
|
||||
//odx=dx;
|
||||
//ody=dy;
|
||||
|
||||
if (dx >= 0)
|
||||
if (d.x < 0)
|
||||
{
|
||||
if (x1 >= xres || x2 < 0)
|
||||
return 0;
|
||||
if (x1 < 0)
|
||||
{
|
||||
if (dy) y1 += scale(0-x1,dy,dx);
|
||||
x1 = 0;
|
||||
}
|
||||
if (x2 >= xres)
|
||||
{
|
||||
if (dy) y2 += scale(xres-1-x2,dy,dx);
|
||||
x2 = xres-1;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
if (x2 >= xres || x1 < 0)
|
||||
return 0;
|
||||
if (x2 < 0)
|
||||
{
|
||||
if (dy) y2 += scale(0-x2,dy,dx);
|
||||
x2 = 0;
|
||||
}
|
||||
if (x1 >= xres)
|
||||
{
|
||||
if (dy) y1 += scale(xres-1-x1,dy,dx);
|
||||
x1 = xres-1;
|
||||
}
|
||||
swaplong(&x1, &x2);
|
||||
swaplong(&y1, &y2);
|
||||
}
|
||||
|
||||
if (dy >= 0)
|
||||
if (x1 >= xres || x2 < 0)
|
||||
return 0;
|
||||
|
||||
if (x1 < 0)
|
||||
{
|
||||
if (d.y) y1 += scale(0-x1,d.y,d.x);
|
||||
x1 = 0;
|
||||
}
|
||||
|
||||
if (x2 >= xres)
|
||||
{
|
||||
if (d.y) y2 += scale(xres-1-x2,d.y,d.x);
|
||||
x2 = xres-1;
|
||||
}
|
||||
|
||||
if ((d.x < 0 && d.y >= 0) || (d.y < 0 && d.x >= 0))
|
||||
{
|
||||
swaplong(&x1, &x2);
|
||||
swaplong(&y1, &y2);
|
||||
}
|
||||
|
||||
if (y1 >= ydim16 || y2 < 0)
|
||||
return 0;
|
||||
|
||||
if (y1 < 0)
|
||||
{
|
||||
if (dx) x1 += scale(0-y1,dx,dy);
|
||||
if (d.x) x1 += scale(0-y1,d.x,d.y);
|
||||
y1 = 0;
|
||||
x1 = clamp(x1, 0, xres-1);
|
||||
}
|
||||
|
||||
if (y2 >= ydim16)
|
||||
{
|
||||
if (dx) x2 += scale(ydim16-1-y2,dx,dy);
|
||||
if (d.x) x2 += scale(ydim16-1-y2,d.x,d.y);
|
||||
y2 = ydim16-1;
|
||||
x2 = clamp(x2, 0, xres-1);
|
||||
}
|
||||
}
|
||||
else
|
||||
|
||||
if (d.y < 0)
|
||||
{
|
||||
if (y2 >= ydim16 || y1 < 0)
|
||||
return 0;
|
||||
if (y2 < 0)
|
||||
{
|
||||
if (dx) x2 += scale(0-y2,dx,dy);
|
||||
y2 = 0;
|
||||
x2 = clamp(x2, 0, xres-1);
|
||||
}
|
||||
if (y1 >= ydim16)
|
||||
{
|
||||
if (dx) x1 += scale(ydim16-1-y1,dx,dy);
|
||||
y1 = ydim16-1;
|
||||
x1 = clamp(x1, 0, xres-1);
|
||||
}
|
||||
swaplong(&x1, &x2);
|
||||
swaplong(&y1, &y2);
|
||||
}
|
||||
|
||||
//if (ox1||ox2||oy1||oy2)
|
||||
// if (x1<0||x1>=xres || y2<0||y2>=yres)
|
||||
// attach_here();
|
||||
|
||||
dx = klabs(x2-x1)+1; dy = klabs(y2-y1)+1;
|
||||
if (dx >= dy)
|
||||
d.x = klabs(x2-x1)+1;
|
||||
d.y = klabs(y2-y1)+1;
|
||||
|
||||
if ((d.x >= d.y && x2 < x1) || (d.x < d.y && y2 < y1))
|
||||
{
|
||||
if (x2 < x1)
|
||||
{
|
||||
i = x1; x1 = x2; x2 = i;
|
||||
i = y1; y1 = y2; y2 = i;
|
||||
swaplong(&x1, &x2);
|
||||
swaplong(&y1, &y2);
|
||||
}
|
||||
d = 0;
|
||||
if (y2 > y1) pinc = bytesperline; else pinc = -bytesperline;
|
||||
|
||||
int df = 0;
|
||||
uint32_t patc=UINT_MAX;
|
||||
int pinc, inc = 1;
|
||||
|
||||
begindrawing(); //{{{
|
||||
p = (y1*bytesperline)+x1+frameplace;
|
||||
if (dy == 0 && drawlinepat == 0xffffffff)
|
||||
|
||||
intptr_t p = (y1*bytesperline)+x1+frameplace;
|
||||
|
||||
if (d.x >= d.y)
|
||||
{
|
||||
i = ((int32_t)col<<24)|((int32_t)col<<16)|((int32_t)col<<8)|col;
|
||||
clearbufbyte((void *)p, dx, i);
|
||||
pinc = (y2 > y1) ? bytesperline : -bytesperline;
|
||||
}
|
||||
else
|
||||
for (i=dx; i>0; i--)
|
||||
{
|
||||
if (drawlinepat & pow2long[(patc++)&31])
|
||||
drawpixel((char *)p, col);
|
||||
d += dy;
|
||||
if (d >= dx) { d -= dx; p += pinc; }
|
||||
p++;
|
||||
pinc = (x2 > x1) ? 1 : -1;
|
||||
swaplong(&d.x, &d.y);
|
||||
inc = bytesperline;
|
||||
}
|
||||
|
||||
if (inc == 1 && d.y == 1 && drawlinepat == 0xffffffff)
|
||||
clearbufbyte((void *)p, d.x, ((int32_t) col<<24)|((int32_t) col<<16)|((int32_t) col<<8)|col);
|
||||
else if (drawlinepat == 0xffffffff)
|
||||
{
|
||||
for (int i=d.x; i>0; i--)
|
||||
{
|
||||
drawpixel((char *) p, col);
|
||||
df += d.y;
|
||||
if (df >= d.x) { df -= d.x; p += pinc; }
|
||||
p += inc;
|
||||
}
|
||||
}
|
||||
else
|
||||
for (int i=d.x; i>0; i--)
|
||||
{
|
||||
if (drawlinepat & pow2long[(++patc)&31])
|
||||
drawpixel((char *) p, col);
|
||||
df += d.y;
|
||||
if (df >= d.x) { df -= d.x; p += pinc; }
|
||||
p += inc;
|
||||
}
|
||||
|
||||
enddrawing(); //}}}
|
||||
|
||||
return 1;
|
||||
}
|
||||
|
||||
if (y2 < y1)
|
||||
{
|
||||
i = x1; x1 = x2; x2 = i;
|
||||
i = y1; y1 = y2; y2 = i;
|
||||
}
|
||||
d = 0;
|
||||
if (x2 > x1) pinc = 1; else pinc = -1;
|
||||
|
||||
begindrawing(); //{{{
|
||||
p = (y1*bytesperline)+x1+frameplace;
|
||||
for (i=dy; i>0; i--)
|
||||
{
|
||||
if (drawlinepat & pow2long[(patc++)&31])
|
||||
drawpixel((char *)p, col);
|
||||
d += dx;
|
||||
if (d >= dy) { d -= dy; p += pinc; }
|
||||
p += bytesperline;
|
||||
}
|
||||
enddrawing(); //}}}
|
||||
|
||||
return 1;
|
||||
}
|
||||
|
||||
static void drawline16mid(int32_t x1, int32_t y1, int32_t x2, int32_t y2, char col)
|
||||
FORCE_INLINE void drawline16mid(int32_t x1, int32_t y1, int32_t x2, int32_t y2, char col)
|
||||
{
|
||||
drawline16(halfxdim16+x1,midydim16+y1, halfxdim16+x2,midydim16+y2, col);
|
||||
}
|
||||
|
@ -17246,7 +17225,7 @@ int32_t getspritecol(int32_t spr)
|
|||
if (tilecols[picnum]) return palookup[pal][tilecols[picnum]];
|
||||
|
||||
if (!waloff[picnum]) loadtile(picnum);
|
||||
if (!waloff[picnum]) return -1;
|
||||
if (!waloff[picnum]) return editorcolors[3];
|
||||
|
||||
uint32_t cols[256];
|
||||
|
||||
|
@ -17284,12 +17263,8 @@ static void drawscreen_drawsprite(int32_t j, int32_t posxe, int32_t posye, int32
|
|||
if (spritecol2d[sprite[j].picnum][0])
|
||||
col = spritecol2d[sprite[j].picnum][0];
|
||||
else
|
||||
{
|
||||
col = getspritecol(j);
|
||||
|
||||
if (col == -1) col = editorcolors[3];
|
||||
}
|
||||
|
||||
/*
|
||||
else if ((sprite[j].cstat&1) > 0)
|
||||
{
|
||||
|
@ -17725,20 +17700,34 @@ int32_t printext16(int32_t xpos, int32_t ypos, int16_t col, int16_t backcol, con
|
|||
|
||||
letptr = &fontptr[name[i]<<3];
|
||||
ptr = (char *)(bytesperline*ypos + (stx-(fontsize&1)) + frameplace);
|
||||
|
||||
if (backcol >= 0)
|
||||
{
|
||||
for (y=ymin; y<=ymax; y++)
|
||||
{
|
||||
for (x=0; x<charxsiz; x++)
|
||||
{
|
||||
if ((unsigned)(stx+x) >= xdim || ptr < (char *)frameplace)
|
||||
continue;
|
||||
if (letptr[y]&pow2char[7-(fontsize&1)-x])
|
||||
ptr[x] = (uint8_t)col;
|
||||
else if (backcol >= 0)
|
||||
ptr[x] = (uint8_t)backcol;
|
||||
if ((unsigned) (stx+x) >= (unsigned)xdim || ptr < (char *) frameplace) break;
|
||||
ptr[x] = (letptr[y]&pow2char[7-(fontsize&1)-x]) ? (uint8_t) col : (uint8_t) backcol;
|
||||
}
|
||||
ptr += bytesperline;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
for (y=ymin; y<=ymax; y++)
|
||||
{
|
||||
for (x=0; x<charxsiz; x++)
|
||||
{
|
||||
if ((unsigned) (stx+x) >= (unsigned)xdim || ptr < (char *) frameplace) break;
|
||||
ptr[x] = (letptr[y]&pow2char[7-(fontsize&1)-x]) ? (uint8_t) col : ptr[x];
|
||||
}
|
||||
ptr += bytesperline;
|
||||
}
|
||||
}
|
||||
|
||||
stx += charxsiz;
|
||||
|
||||
if (stx >= xdim)
|
||||
break;
|
||||
}
|
||||
|
|
|
@ -623,9 +623,7 @@ int32_t taglab_getnextfreetag(int32_t *duetoptr)
|
|||
|
||||
static void taglab_handle1(int32_t linktagp, int32_t tagnum, char *buf)
|
||||
{
|
||||
const char *label = NULL;
|
||||
if (linktagp && showtags==2)
|
||||
label = taglab_getlabel(tagnum);
|
||||
char const * const label = (linktagp && showtags==2) ? taglab_getlabel(tagnum) : NULL;
|
||||
|
||||
if (label)
|
||||
Bsprintf(buf, "%d<%s>", tagnum, label);
|
||||
|
@ -901,16 +899,15 @@ const char *ExtGetSpriteCaption(int16_t spritenum)
|
|||
SpriteName(spritenum,lo);
|
||||
if (lo[0]!=0)
|
||||
{
|
||||
if (sprite[spritenum].pal==1)
|
||||
Bsprintf(tempbuf,"%s (MULTIPLAYER)",lo);
|
||||
else
|
||||
Bsprintf(tempbuf,"%s",lo);
|
||||
|
||||
if (sprite[spritenum].pal==1)
|
||||
Bstrcat(tempbuf," (MULTIPLAYER)");
|
||||
}
|
||||
|
||||
return tempbuf;
|
||||
}
|
||||
|
||||
{
|
||||
char histr[TAGLAB_MAX+16], lostr[TAGLAB_MAX+16];
|
||||
|
||||
taglab_handle1(lt&2, sprite[spritenum].hitag, histr);
|
||||
|
@ -928,12 +925,12 @@ const char *ExtGetSpriteCaption(int16_t spritenum)
|
|||
taglab_handle1(lt&1, sprite[spritenum].lotag, lostr);
|
||||
|
||||
SpriteName(spritenum,lo);
|
||||
|
||||
if (sprite[spritenum].extra != -1)
|
||||
Bsprintf(tempbuf,"%s,%s,%d %s", histr, lostr, TrackerCast(sprite[spritenum].extra), lo);
|
||||
else
|
||||
Bsprintf(tempbuf,"%s,%s %s", histr, lostr, lo);
|
||||
}
|
||||
}
|
||||
|
||||
return tempbuf;
|
||||
|
||||
|
|
Loading…
Reference in a new issue