mirror of
https://github.com/ZDoom/raze-gles.git
synced 2024-12-24 02:30:46 +00:00
Support for changing shade of console characters by using the 3 high bits of osdfmt to represent a shade value (0-7)
Lower 5 bits are used for palette git-svn-id: https://svn.eduke32.com/eduke32@865 1a8010ca-5511-0410-912e-c29ae57300e0
This commit is contained in:
parent
6374609c4d
commit
3aefb0edaa
8 changed files with 47 additions and 62 deletions
|
@ -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__
|
||||
|
||||
|
|
|
@ -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<len; x++)
|
||||
drawosdchar(3+x,osdrowscur,osdeditbuf[osdeditwinstart+x],osdeditshade,osdeditpal);
|
||||
drawosdchar(3+x,osdrowscur,osdeditbuf[osdeditwinstart+x],osdeditshade<<1,osdeditpal);
|
||||
|
||||
drawosdcursor(3+osdeditcursor-osdeditwinstart,osdrowscur,osdovertype,keytime);
|
||||
|
||||
|
@ -1295,7 +1293,7 @@ static inline void linefeed(void)
|
|||
|
||||
void OSD_Printf(const char *fmt, ...)
|
||||
{
|
||||
char tmpstr[1024], *chp, p=osdtextpal;
|
||||
char tmpstr[1024], *chp, p=osdtextpal, s=osdtextshade;
|
||||
va_list va;
|
||||
|
||||
if (!osdinited) OSD_Init();
|
||||
|
@ -1336,6 +1334,12 @@ void OSD_Printf(const char *fmt, ...)
|
|||
p = atol(smallbuf);
|
||||
}
|
||||
}
|
||||
else if (*chp == '^' && Btoupper(*(chp+1)) == 'S')
|
||||
{
|
||||
chp++;
|
||||
if (isdigit(*(++chp)))
|
||||
s = *chp;
|
||||
}
|
||||
else if (*chp == '\r') osdpos=0;
|
||||
else if (*chp == '\n')
|
||||
{
|
||||
|
@ -1346,7 +1350,7 @@ void OSD_Printf(const char *fmt, ...)
|
|||
else
|
||||
{
|
||||
osdtext[osdpos] = *chp;
|
||||
osdfmt[osdpos++] = p;
|
||||
osdfmt[osdpos++] = p+(s<<5);
|
||||
if (osdpos == osdcols)
|
||||
{
|
||||
osdpos = 0;
|
||||
|
@ -1506,7 +1510,7 @@ int OSD_Dispatch(const char *cmd)
|
|||
symb = findexactsymbol(wp);
|
||||
if (!symb)
|
||||
{
|
||||
OSD_Printf("Error: \"%s\" is not defined\n", wp);
|
||||
OSD_Printf(OSDTEXT_RED "Error: \"%s\" is not a valid command or cvar\n", wp);
|
||||
free(workbuf);
|
||||
return -1;
|
||||
}
|
||||
|
|
|
@ -10139,7 +10139,7 @@ void app_main(int argc,const char **argv)
|
|||
#endif
|
||||
|
||||
OSD_SetLogFile("eduke32.log");
|
||||
OSD_SetParameters(10,0, 0,12, 4,12);
|
||||
OSD_SetParameters(6,0, 0,12, 2,12);
|
||||
|
||||
wm_setapptitle(HEAD2);
|
||||
|
||||
|
@ -10509,7 +10509,6 @@ void app_main(int argc,const char **argv)
|
|||
(int(*)(void))GetTime,
|
||||
GAME_onshowosd
|
||||
);
|
||||
OSD_SetParameters(10,0, 0,12, 4,12);
|
||||
OSD_SetVersionString(HEAD2, 10,0);
|
||||
registerosdcommands();
|
||||
|
||||
|
@ -10795,7 +10794,7 @@ static int opendemoread(int which_demo) // 0 = mine
|
|||
if (ver == BYTEVERSION_JF) initprintf("Demo %s is for Regular edition.\n", d);
|
||||
else if (ver == BYTEVERSION_JF+1) initprintf("Demo %s is for Atomic edition.\n", d);
|
||||
else if (ver == BYTEVERSION_JF+2) initprintf("Demo %s is for Shareware version.\n", d);
|
||||
else OSD_Printf("Demo %s is of an incompatible version (%d).\n", d, ver);
|
||||
// else OSD_Printf("Demo %s is of an incompatible version (%d).\n", d, ver);
|
||||
kclose(recfilep);
|
||||
ud.reccnt=0;
|
||||
demo_version = 0;
|
||||
|
@ -10865,7 +10864,7 @@ static int opendemoread(int which_demo) // 0 = mine
|
|||
newgame(ud.volume_number,ud.level_number,ud.player_skill);
|
||||
return(1);
|
||||
corrupt:
|
||||
OSD_Printf("Demo %d header is corrupt.\n",which_demo);
|
||||
OSD_Printf(OSDTEXT_DARKRED "Demo %d header is corrupt.\n",which_demo);
|
||||
ud.reccnt = 0;
|
||||
kclose(recfilep);
|
||||
return 0;
|
||||
|
@ -11018,7 +11017,7 @@ RECHECK:
|
|||
l = min(ud.reccnt,RECSYNCBUFSIZ);
|
||||
if (kdfread(recsync,sizeof(input)*ud.multimode,l/ud.multimode,recfilep) != l/ud.multimode)
|
||||
{
|
||||
OSD_Printf("Demo %d is corrupt.\n", which_demo-1);
|
||||
OSD_Printf(OSDTEXT_DARKRED "Demo %d is corrupt.\n", which_demo-1);
|
||||
foundemo = 0;
|
||||
ud.reccnt = 0;
|
||||
kclose(recfilep);
|
||||
|
|
|
@ -621,13 +621,13 @@ int GetGameVarID(int id, int iActor, int iPlayer)
|
|||
// OSD_Printf("GetGameVarID(): reading from array\n");
|
||||
if ((index < aGameArrays[id].size)&&(index>=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;
|
||||
}
|
||||
|
|
|
@ -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)
|
||||
{
|
||||
|
|
|
@ -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;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -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;
|
||||
}
|
||||
|
||||
|
|
|
@ -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;
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue