colorized printext16()

git-svn-id: https://svn.eduke32.com/eduke32@765 1a8010ca-5511-0410-912e-c29ae57300e0
This commit is contained in:
terminx 2008-06-05 10:10:26 +00:00
parent 5c6a1ae789
commit dbd4e83d6e
3 changed files with 71 additions and 8 deletions

View file

@ -6724,7 +6724,8 @@ int getnumber16(char namestart[80], int num, int maxnumber, char sign)
ch = bgetchar();
Bsprintf(buffer,"%s%d_ ",namestart,danum);
Bsprintf(buffer,"%s^011%d",namestart,danum);
if (totalclock & 32) Bstrcat(buffer,"_ ");
printmessage16(buffer);
showframe(1);
@ -7559,7 +7560,7 @@ void showsectordata(short sectnum)
{
char snotbuf[80];
Bsprintf(snotbuf,"Sector %d (F7 to edit)",sectnum);
Bsprintf(snotbuf,"^10Sector %d ^O(F7 to edit)",sectnum);
printext16(8,ydim-STATUS2DSIZ+32,11,-1,snotbuf,0);
Bsprintf(snotbuf,"Firstwall: %d",sector[sectnum].wallptr);
printext16(8,ydim-STATUS2DSIZ+48,11,-1,snotbuf,0);
@ -7616,7 +7617,7 @@ void showwalldata(short wallnum)
int dax, day, dist;
char snotbuf[80];
Bsprintf(snotbuf,"Wall %d (F8 to edit)",wallnum);
Bsprintf(snotbuf,"^10Wall %d ^O(F8 to edit)",wallnum);
printext16(8,ydim-STATUS2DSIZ+32,11,-1,snotbuf,0);
Bsprintf(snotbuf,"X-coordinate: %d",wall[wallnum].x);
printext16(8,ydim-STATUS2DSIZ+48,11,-1,snotbuf,0);
@ -7674,7 +7675,7 @@ void showspritedata(short spritenum)
{
char snotbuf[80];
Bsprintf(snotbuf,"Sprite %d (F8 to edit)",spritenum);
Bsprintf(snotbuf,"^10Sprite %d ^O(F8 to edit)",spritenum);
printext16(8,ydim-STATUS2DSIZ+32,11,-1,snotbuf,0);
Bsprintf(snotbuf,"X-coordinate: %d",sprite[spritenum].x);
printext16(8,ydim-STATUS2DSIZ+48,11,-1,snotbuf,0);

View file

@ -11437,9 +11437,9 @@ void draw2dscreen(int posxe, int posye, short ange, int zoome, short gride)
//
void printext16(int xpos, int ypos, short col, short backcol, char *name, char fontsize)
{
int stx, i, x, y, charxsiz;
int stx, i, x, y, charxsiz, ocol = col, obackcol = backcol;
char *fontptr, *letptr, *ptr;
char smallbuf[4];
stx = xpos;
if (fontsize) { fontptr = smalltextfont; charxsiz = 4; }
@ -11448,6 +11448,68 @@ void printext16(int xpos, int ypos, short col, short backcol, char *name, char f
begindrawing(); //{{{
for (i=0;name[i];i++)
{
if (name[i] == '^')
{
i++;
if (name[i] == 'O') // ^O resets formatting
{
col = ocol;
backcol = obackcol;
continue;
}
if (isdigit(name[i]))
{
if (isdigit(name[i+1]))
{
if (isdigit(name[i+2]))
{
Bmemcpy(&smallbuf[0],&name[i],3);
i += 2;
smallbuf[3] = '\0';
}
else
{
Bmemcpy(&smallbuf[0],&name[i],2);
i++;
smallbuf[2] = '\0';
}
}
else
{
smallbuf[0] = name[i];
smallbuf[1] = '\0';
}
col = atol(smallbuf);
if (name[i+1] == ',' && isdigit(name[i+2]))
{
i+=2;
if (isdigit(name[i+1]))
{
if (isdigit(name[i+2]))
{
Bmemcpy(&smallbuf[0],&name[i],3);
i += 2;
smallbuf[3] = '\0';
}
else
{
Bmemcpy(&smallbuf[0],&name[i],2);
i++;
smallbuf[2] = '\0';
}
}
else
{
smallbuf[0] = name[i];
smallbuf[1] = '\0';
}
backcol = atol(smallbuf);
}
continue;
}
}
letptr = &fontptr[name[i]<<3];
ptr = (char *)(bytesperline*(ypos+7)+(stx-fontsize)+frameplace);
for (y=7;y>=0;y--)

View file

@ -446,8 +446,8 @@ int gametext_z(int small, int starttile, int x,int y,const char *t,int s,int p,i
{
if (*t == '^' && isdigit(*(t+1)))
{
char smallbuf[3];
t += 1;
char smallbuf[4];
t++;
if (isdigit(*(t+1)))
{
smallbuf[0] = *(t++);