diff --git a/polymer/build/include/osd.h b/polymer/build/include/osd.h index c4b1f9c7e..6cb846b15 100644 --- a/polymer/build/include/osd.h +++ b/polymer/build/include/osd.h @@ -105,6 +105,7 @@ int OSD_RegisterFunction(const char *name, const char *help, int (*func)(const o // ...but I don't care #define OSDTEXT_BLUE "^00" +#define OSDTEXT_GOLD "^07" #define OSDTEXT_DARKRED "^10" #define OSDTEXT_GREEN "^11" #define OSDTEXT_GRAY "^12" @@ -114,6 +115,9 @@ int OSD_RegisterFunction(const char *name, const char *help, int (*func)(const o #define OSDTEXT_DARKBLUE "^16" #define OSDTEXT_RED "^21" #define OSDTEXT_YELLOW "^23" +#define OSDTEXT_BRIGHT "^S0" + +#define TEXTSIZE 32768 #endif // __osd_h__ diff --git a/polymer/build/src/osd.c b/polymer/build/src/osd.c index 06632d58c..20acf5038 100644 --- a/polymer/build/src/osd.c +++ b/polymer/build/src/osd.c @@ -31,8 +31,6 @@ static void _internal_clearbackground(int,int); static int _internal_gettime(void); static void _internal_onshowosd(int); -#define TEXTSIZE 32768 - // history display static char osdtext[TEXTSIZE]; static char osdfmt[TEXTSIZE]; @@ -369,8 +367,8 @@ static int _internal_osdfunc_vars(const osdfuncparm_t *parm) else { osdeditshade = atoi(parm->parms[0]); - if (osdeditshade < -128) osdeditshade = -128; - else if (osdeditshade > 127) osdeditshade = 127; + if (osdeditshade < 0) osdeditshade = 0; + else if (osdeditshade > 7) osdeditshade = 7; OSD_Printf("%s\n",parm->raw); return OSDCMD_OK; } @@ -381,8 +379,8 @@ static int _internal_osdfunc_vars(const osdfuncparm_t *parm) else { osdtextshade = atoi(parm->parms[0]); - if (osdtextshade < -128) osdtextshade = -128; - else if (osdtextshade > 127) osdtextshade = 127; + if (osdtextshade < 0) osdtextshade = 0; + else if (osdtextshade > 7) osdtextshade = 7; OSD_Printf("%s\n",parm->raw); return OSDCMD_OK; } @@ -495,7 +493,7 @@ static int _internal_osdfunc_clear(const osdfuncparm_t *parm) { UNREFERENCED_PARAMETER(parm); Bmemset(osdtext,0,sizeof(osdtext)); - Bmemset(osdfmt,osdtextpal,sizeof(osdfmt)); + Bmemset(osdfmt,osdtextpal+(osdtextshade<<5),sizeof(osdfmt)); osdlines = 1; return OSDCMD_OK; } @@ -540,7 +538,7 @@ void OSD_Cleanup(void) void OSD_Init(void) { Bmemset(osdtext, 32, TEXTSIZE); - Bmemset(osdfmt, osdtextpal, TEXTSIZE); + Bmemset(osdfmt, osdtextpal+(osdtextshade<<5), TEXTSIZE); osdlines=1; osdinited=1; @@ -861,7 +859,7 @@ int OSD_HandleChar(char ch) else if (ch == 12) // control l, clear screen { Bmemset(osdtext,0,sizeof(osdtext)); - Bmemset(osdfmt,osdtextpal,sizeof(osdfmt)); + Bmemset(osdfmt,osdtextpal+(osdtextshade<<5),sizeof(osdfmt)); osdlines = 1; } else if (ch == 13) // control m, enter @@ -1271,7 +1269,7 @@ void OSD_Draw(void) len = min(osdcols-1-3, osdeditlen-osdeditwinstart); for (x=0; x=0)) return(m * aGameArrays[id].plValues[index]); - OSD_Printf("GetGameVarID(): invalid array index (%s[%d])\n",aGameArrays[id].szLabel,index); + OSD_Printf(OSDTEXT_DARKRED "GetGameVarID(): invalid array index (%s[%d])\n",aGameArrays[id].szLabel,index); return -1; } if (!(id&(MAXGAMEVARS<<1))) { - OSD_Printf("GetGameVarID(): invalid gamevar ID (%d)\n",id); + OSD_Printf(OSDTEXT_DARKRED "GetGameVarID(): invalid gamevar ID (%d)\n",id); return -1; } @@ -681,7 +681,7 @@ void SetGameArrayID(int id,int index, int lValue) { if (id<0 || id >= iGameArrayCount || !((index < aGameArrays[id].size)&&(index>=0))) { - OSD_Printf("SetGameVarID(): tried to set invalid array ID (%d) or index out of bounds from sprite %d (%d), player %d\n",id,g_i,sprite[g_i].picnum,g_p); + OSD_Printf(OSDTEXT_DARKRED "SetGameVarID(): tried to set invalid array ID (%d) or index out of bounds from sprite %d (%d), player %d\n",id,g_i,sprite[g_i].picnum,g_p); return; } aGameArrays[id].plValues[index]=lValue; @@ -691,7 +691,7 @@ void SetGameVarID(int id, int lValue, int iActor, int iPlayer) { if (id<0 || id >= iGameVarCount) { - OSD_Printf("SetGameVarID(): tried to set invalid gamevar ID (%d) from sprite %d (%d), player %d\n",id,g_i,sprite[g_i].picnum,g_p); + OSD_Printf(OSDTEXT_DARKRED "SetGameVarID(): tried to set invalid gamevar ID (%d) from sprite %d (%d), player %d\n",id,g_i,sprite[g_i].picnum,g_p); return; } //Bsprintf(g_szBuf,"SGVI: %d ('%s') to %d for %d %d",id,aGameVars[id].szLabel,lValue,iActor,iPlayer); @@ -700,7 +700,7 @@ void SetGameVarID(int id, int lValue, int iActor, int iPlayer) { if (iPlayer < 0 || iPlayer > MAXPLAYERS-1) { - OSD_Printf("SetGameVarID(): invalid player (%d) for per-player gamevar %s from sprite %d (%d), player %d\n",iPlayer,aGameVars[id].szLabel,g_i,sprite[g_i].picnum,g_p); + OSD_Printf(OSDTEXT_DARKRED "SetGameVarID(): invalid player (%d) for per-player gamevar %s from sprite %d (%d), player %d\n",iPlayer,aGameVars[id].szLabel,g_i,sprite[g_i].picnum,g_p); return; } // for the current player @@ -712,7 +712,7 @@ void SetGameVarID(int id, int lValue, int iActor, int iPlayer) { if (iActor < 0 || iActor > MAXSPRITES-1) { - OSD_Printf("SetGameVarID(): invalid sprite (%d) for per-actor gamevar %s from sprite %d (%d), player %d\n",iActor,aGameVars[id].szLabel,g_i,sprite[g_i].picnum,g_p); + OSD_Printf(OSDTEXT_DARKRED "SetGameVarID(): invalid sprite (%d) for per-actor gamevar %s from sprite %d (%d), player %d\n",iActor,aGameVars[id].szLabel,g_i,sprite[g_i].picnum,g_p); return; } // for the current actor @@ -774,7 +774,7 @@ static intptr_t *GetGameValuePtr(const char *szGameLabel) { if (!aGameVars[i].plValues) { - OSD_Printf("GetGameValuePtr(): INTERNAL ERROR: NULL array !!!\n"); + OSD_Printf(OSDTEXT_DARKRED "GetGameValuePtr(): INTERNAL ERROR: NULL array !!!\n"); } return aGameVars[i].plValues; } diff --git a/polymer/eduke32/source/menus.c b/polymer/eduke32/source/menus.c index 6c38f8cc2..c9dd5d1a0 100644 --- a/polymer/eduke32/source/menus.c +++ b/polymer/eduke32/source/menus.c @@ -389,14 +389,8 @@ static void bar_(int type, int x,int y,short *p,int dainc,int damodify,int s, in rotatesprite((x<<16)+((65-xloc)<<(16-type)),(y<<16)+(1<<(16-type)),65536L>>type,0,SLIDEBAR+1,s,pa,10,0,0,xdim-1,ydim-1); } -static inline void bar(int x,int y,short *p,int dainc,int damodify,int s, int pa) -{ - bar_(0,x,y,p,dainc,damodify,s,pa); -} -static inline void barsm(int x,int y,short *p,int dainc,int damodify,int s, int pa) -{ - bar_(1,x,y,p,dainc,damodify,s,pa); -} +#define bar(x,y,p,dainc,damodify,s,pa) bar_(0,x,y,p,dainc,damodify,s,pa); +#define barsm(x,y,p,dainc,damodify,s,pa) bar_(1,x,y,p,dainc,damodify,s,pa); static void modval(int min, int max,int *p,int dainc,int damodify) { diff --git a/polymer/eduke32/source/osdfuncs.c b/polymer/eduke32/source/osdfuncs.c index 94067a2ca..18126b34f 100644 --- a/polymer/eduke32/source/osdfuncs.c +++ b/polymer/eduke32/source/osdfuncs.c @@ -19,41 +19,25 @@ void GAME_drawosdstr(int x, int y, char *ch, int len, int shade, int pal) { short ac; + UNREFERENCED_PARAMETER(shade); + UNREFERENCED_PARAMETER(pal); + for (x = (x<<3)+x; len>0; len--, ch++, x++) { - /* if (*ch == '^' && isdigit(*(ch+1))) - { - char smallbuf[4]; - ch++, len--; - if (isdigit(*(ch+1))) - { - smallbuf[0] = *(ch++); - len--; - smallbuf[1] = *(ch); - smallbuf[2] = '\0'; - pal = atol(smallbuf); - } - else - { - smallbuf[0] = *(ch); - smallbuf[1] = '\0'; - pal = atol(smallbuf); - } - x--; - continue; - } */ if (*ch == 32) { -// x+=5; x += OSDCHAR_WIDTH; continue; } ac = *ch-'!'+STARTALPHANUM; if (ac < STARTALPHANUM || ac > ENDALPHANUM) return; - rotatesprite(x<<16, (y<<3)<<16, 65536l, 0, ac, shade, *(ch-OSD_GetTextPtr()+OSD_GetFmtPtr()), 8|16, 0, 0, xdim-1, ydim-1); - /* if (*ch >= '0' && *ch <= '9') x+=8; - else x += tilesizx[ac]; */ + if (ch > OSD_GetTextPtr() && ch < OSD_GetTextPtr() + TEXTSIZE) + rotatesprite(x<<16, (y<<3)<<16, 65536l, 0, ac, (*(ch-OSD_GetTextPtr()+OSD_GetFmtPtr())&~0x1F)>>4, + *(ch-OSD_GetTextPtr()+OSD_GetFmtPtr())&~0xE0, 8|16, 0, 0, xdim-1, ydim-1); + else + rotatesprite(x<<16, (y<<3)<<16, 65536l, 0, ac, shade, + pal, 8|16, 0, 0, xdim-1, ydim-1); x += OSDCHAR_WIDTH; } } diff --git a/polymer/eduke32/source/premap.c b/polymer/eduke32/source/premap.c index e3debab84..bbb62317e 100644 --- a/polymer/eduke32/source/premap.c +++ b/polymer/eduke32/source/premap.c @@ -1657,7 +1657,7 @@ int enterlevel(int g) } else { - initprintf("Map E%dL%d not defined!\n",ud.volume_number+1,ud.level_number+1); + OSD_Printf(OSDTEXT_RED "Map E%dL%d not defined!\n",ud.volume_number+1,ud.level_number+1); return 1; } } @@ -1858,7 +1858,7 @@ int enterlevel(int g) // variables are set by pointer... OnEvent(EVENT_ENTERLEVEL, -1, -1, -1); - initprintf("^21E%dL%d: %s\n",ud.volume_number+1,ud.level_number+1,map[(ud.volume_number*MAXLEVELS)+ud.level_number].name); + OSD_Printf(OSDTEXT_BROWN OSDTEXT_BRIGHT "E%dL%d: %s\n",ud.volume_number+1,ud.level_number+1,map[(ud.volume_number*MAXLEVELS)+ud.level_number].name); return 0; } diff --git a/polymer/eduke32/source/sounds.c b/polymer/eduke32/source/sounds.c index a56e0a9aa..9c2f1a48f 100644 --- a/polymer/eduke32/source/sounds.c +++ b/polymer/eduke32/source/sounds.c @@ -250,7 +250,7 @@ int loadsound(unsigned int num) if (g_sounds[num].filename == NULL) { - OSD_Printf("Sound (#%d) not defined!\n",num); + OSD_Printf(OSDTEXT_DARKRED "Sound (#%d) not defined!\n",num); return 0; } @@ -260,7 +260,7 @@ int loadsound(unsigned int num) { // Bsprintf(fta_quotes[113],"g_sounds %s(#%d) not found.",sounds[num],num); // FTA(113,g_player[myconnectindex].ps); - OSD_Printf("Sound %s(#%d) not found.\n",g_sounds[num].filename,num); + OSD_Printf(OSDTEXT_RED "Sound %s(#%d) not found.\n",g_sounds[num].filename,num); return 0; }