From dbd4e83d6e76db1322012ea77f3dddce1b556885 Mon Sep 17 00:00:00 2001 From: terminx Date: Thu, 5 Jun 2008 10:10:26 +0000 Subject: [PATCH] colorized printext16() git-svn-id: https://svn.eduke32.com/eduke32@765 1a8010ca-5511-0410-912e-c29ae57300e0 --- polymer/build/src/build.c | 9 ++--- polymer/build/src/engine.c | 66 +++++++++++++++++++++++++++++++++-- polymer/eduke32/source/game.c | 4 +-- 3 files changed, 71 insertions(+), 8 deletions(-) diff --git a/polymer/build/src/build.c b/polymer/build/src/build.c index 452376e7a..acdb29752 100644 --- a/polymer/build/src/build.c +++ b/polymer/build/src/build.c @@ -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); diff --git a/polymer/build/src/engine.c b/polymer/build/src/engine.c index 5e5184664..156c55910 100644 --- a/polymer/build/src/engine.c +++ b/polymer/build/src/engine.c @@ -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--) diff --git a/polymer/eduke32/source/game.c b/polymer/eduke32/source/game.c index e657cbc3a..71a0c20c0 100644 --- a/polymer/eduke32/source/game.c +++ b/polymer/eduke32/source/game.c @@ -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++);