Added a new orientation bit for precise coordinates.

This is simmilar to the rotatesprite16 but it works for other drawing commands now.



git-svn-id: https://svn.eduke32.com/eduke32@966 1a8010ca-5511-0410-912e-c29ae57300e0
This commit is contained in:
hnt_ts 2008-08-11 09:31:49 +00:00
parent b8188a8fc3
commit 0ef5551037
2 changed files with 44 additions and 27 deletions

View file

@ -263,8 +263,14 @@ int gametext_z(int small, int starttile, int x,int y,const char *t,int s,int p,i
char centre, *oldt;
int squishtext = ((small&2)!=0);
int ht = usehightile;
int shift = 16, widthx = 320, ox, oy;
centre = (x == (320>>1));
if (orientation & 256)
{
widthx = 320<<16;
shift = 0;
}
centre = (x == (widthx>>1));
newx = 0;
oldt = (char *)t;
@ -306,9 +312,11 @@ int gametext_z(int small, int starttile, int x,int y,const char *t,int s,int p,i
}
t = oldt;
x = (320>>1)-(newx>>1);
x = (widthx>>1)-((orientation & 256)?newx<<15:newx>>1);
}
usehightile = (ht && r_downsize < 2);
ox=x;
oy=y;
while (*t)
{
if (*t == '^' && isdigit(*(t+1)))
@ -344,7 +352,13 @@ int gametext_z(int small, int starttile, int x,int y,const char *t,int s,int p,i
if (ac < starttile || ac > (starttile + 93))
break;
rotatesprite(x<<16,(y<<16)+((small&4)?ud.config.ScreenHeight<<15:0),z,0,ac,s,p,(small&1)?(8|16):(2|orientation),x1,y1,x2,y2);
if (orientation&256)
{
x+=(x-ox)<<16;
y+=(y-oy)<<16;
ox=x;oy=y;
}
rotatesprite(x<<shift,(y<<shift)+((small&4)?ud.config.ScreenHeight<<15:0),z,0,ac,s,p,(small&1)?(8|16):(2|orientation),x1,y1,x2,y2);
if ((*t >= '0' && *t <= '9'))
x += (8)*z/65536;
@ -352,6 +366,7 @@ int gametext_z(int small, int starttile, int x,int y,const char *t,int s,int p,i
x += (8-squishtext)*z/65536;//(tilesizx[ac]>>small);
else x += (tilesizx[ac]-squishtext)*z/65536;//(tilesizx[ac]>>small);
if ((orientation&256) == 0) // warpping long strings doesn't work for precise coordinates due to overflow
if (x > (ud.config.ScreenWidth - 14)) oldt = (char *)t, x = oldx, y+=8*z/65536;
t++;
}
@ -1539,7 +1554,7 @@ void myos(int x, int y, int tilenum, int shade, int orientation)
if (orientation&4)
a = 1024;
rotatesprite(x<<16,y<<16,65536L,a,tilenum,shade,p,2|orientation,windowx1,windowy1,windowx2,windowy2);
rotatesprite((orientation&256)?x:(x<<16),(orientation&256)?y:(y<<16),65536L,a,tilenum,shade,p,2|orientation,windowx1,windowy1,windowx2,windowy2);
}
void myospal(int x, int y, int tilenum, int shade, int orientation, int p)
@ -1549,7 +1564,7 @@ void myospal(int x, int y, int tilenum, int shade, int orientation, int p)
if (orientation&4)
a = 1024;
rotatesprite(x<<16,y<<16,65536L,a,tilenum,shade,p,2|orientation,windowx1,windowy1,windowx2,windowy2);
rotatesprite((orientation&256)?x:(x<<16),(orientation&256)?y:(y<<16),65536L,a,tilenum,shade,p,2|orientation,windowx1,windowy1,windowx2,windowy2);
}
void myosx(int x, int y, int tilenum, int shade, int orientation)
@ -1559,7 +1574,7 @@ void myosx(int x, int y, int tilenum, int shade, int orientation)
if (orientation&4)
a = 1024;
rotatesprite(x<<16,y<<16,32768L,a,tilenum,shade,p,2|orientation,windowx1,windowy1,windowx2,windowy2);
rotatesprite((orientation&256)?x:(x<<16),(orientation&256)?y:(y<<16),32768L,a,tilenum,shade,p,2|orientation,windowx1,windowy1,windowx2,windowy2);
}
void myospalx(int x, int y, int tilenum, int shade, int orientation, int p)
@ -1569,7 +1584,7 @@ void myospalx(int x, int y, int tilenum, int shade, int orientation, int p)
if (orientation&4)
a = 1024;
rotatesprite(x<<16,y<<16,32768L,a,tilenum,shade,p,2|orientation,windowx1,windowy1,windowx2,windowy2);
rotatesprite((orientation&256)?x:(x<<16),(orientation&256)?y:(y<<16),32768L,a,tilenum,shade,p,2|orientation,windowx1,windowy1,windowx2,windowy2);
}
static void invennum(int x,int y,char num1,char ha,char sbits)
@ -1800,6 +1815,7 @@ void txdigitalnumberz(int starttile, int x,int y,int n,int s,int pal,int cs,int
{
int i, j = 0, k, p, c;
char b[10];
int shift = (cs&256)?0:16;
//ltoa(n,b,10);
Bsnprintf(b,10,"%d",n);
@ -1810,16 +1826,17 @@ void txdigitalnumberz(int starttile, int x,int y,int n,int s,int pal,int cs,int
p = starttile+*(b+k)-'0';
j += (tilesizx[p]+1)*z/65536;
}
if (cs&256) j<<=16;
c = x-(j>>1);
j = 0;
for (k=0;k<i;k++)
{
p = starttile+*(b+k)-'0';
rotatesprite((c+j)<<16,y<<16,z,0,p,s,pal,2|cs,x1,y1,x2,y2);
rotatesprite((c+j)<<shift,y<<shift,z,0,p,s,pal,2|cs,x1,y1,x2,y2);
/* rotatesprite((c+j)<<16,y<<16,65536L,0,p,s,pal,cs,0,0,xdim-1,ydim-1);
rotatesprite(x<<16,y<<16,32768L,a,tilenum,shade,p,2|orientation,windowx1,windowy1,windowx2,windowy2);*/
j += (tilesizx[p]+1)*z/65536;
j += ((tilesizx[p]+1)*z/65536)<<((cs&256)?16:0);
}
}

View file

@ -5948,7 +5948,7 @@ static int parse(void)
int x1=GetGameVarID(*insptr++,g_i,g_p), y1=GetGameVarID(*insptr++,g_i,g_p);
int x2=GetGameVarID(*insptr++,g_i,g_p), y2=GetGameVarID(*insptr++,g_i,g_p);
if (tw == CON_ROTATESPRITE) {x<<=16;y<<=16;}
if (tw == CON_ROTATESPRITE && !(orientation & 256)) {x<<=16;y<<=16;}
rotatesprite(x,y,z,a,tilenum,shade,pal,2|orientation,x1,y1,x2,y2);
break;
}