mirror of
https://github.com/DrBeef/Raze.git
synced 2024-11-15 17:01:51 +00:00
Cleanup of console/on-screen-display (OSD) functionality.
- Rewrite the "clear background" routine in a no-brainer way instead of juggling around with rotatesprite(). Make it common to game+editor. Expose glRectd to glbuild. - Don't stop OSD text line drawing when encountering a non-printable char. Instead, treat it as space. - In OSD_SetTextMode(), don't use swaplong (which really swaps 32-bit ints) to swap pointers. Write an analogous "swapptr" instead. - When changing from/to OSD, don't inject a pause key. This *might* have been the cause of the reported pausing problems. - clean up the code... (Yes, this commit throws together too much stuff. I suck sometimes. :P) git-svn-id: https://svn.eduke32.com/eduke32@3321 1a8010ca-5511-0410-912e-c29ae57300e0
This commit is contained in:
parent
fa2ac57674
commit
0dd78fb029
13 changed files with 106 additions and 259 deletions
|
@ -82,6 +82,9 @@ extern "C" {
|
|||
#define SPRITES_OF(Statnum, Iter) Iter=headspritestat[Statnum]; Iter>=0; Iter=nextspritestat[Iter]
|
||||
#define SPRITES_OF_SECT(Sectnum, Iter) Iter=headspritesect[Sectnum]; Iter>=0; Iter=nextspritesect[Iter]
|
||||
|
||||
#define CLEARLINES2D(Startline, Numlines, Color) \
|
||||
clearbuf((char *)(frameplace + ((Startline)*bytesperline)), (bytesperline*(Numlines))>>2, (Color))
|
||||
|
||||
|
||||
////////// True Room over Room (YAX == rot -17 of "PRO") //////////
|
||||
#define YAX_ENABLE
|
||||
|
|
|
@ -70,6 +70,8 @@ int32_t maybe_append_ext(char *wbuf, int32_t wbufsiz, const char *fn, const char
|
|||
int32_t ldist(const spritetype *s1, const spritetype *s2);
|
||||
int32_t dist(const spritetype *s1, const spritetype *s2);
|
||||
|
||||
void COMMON_clearbackground(int32_t numcols, int32_t numrows);
|
||||
|
||||
// timer defs for profiling function chunks the simple way
|
||||
#define EDUKE32_TMRDEF int32_t t[20], ti=0; const char *tmrstr=__func__; fprintf(stderr,"%s\n",tmrstr); t[ti++]=getticks();
|
||||
#define EDUKE32_TMRTIC t[ti++]=getticks()
|
||||
|
|
|
@ -294,8 +294,6 @@ int32_t select_sprite_tag(int32_t spritenum);
|
|||
#define POINT2(i) (wall[wall[i].point2])
|
||||
#define SPRITESEC(j) (sector[sprite[j].sectnum])
|
||||
|
||||
#define CLEARLINES2D(Startline, Numlines, Color) clearbuf((char *)(frameplace + ((Startline)*bytesperline)), (bytesperline*(Numlines))>>2, (Color))
|
||||
|
||||
#define SCRIPTHISTSIZ 32 // should be the same as OSD_HISTORYDEPTH for maximum win, should be a power of two
|
||||
extern char *scripthist[SCRIPTHISTSIZ];
|
||||
extern int32_t scripthistend;
|
||||
|
|
|
@ -155,6 +155,8 @@ typedef void (APIENTRY * bglVertex3fvProcPtr)( const GLfloat *v );
|
|||
extern bglVertex3fvProcPtr bglVertex3fv;
|
||||
typedef void (APIENTRY * bglVertex3dvProcPtr)( const GLdouble *v );
|
||||
extern bglVertex3dvProcPtr bglVertex3dv;
|
||||
typedef void (APIENTRY * bglRectdProcPtr)( GLdouble x1, GLdouble y1, GLdouble x2, GLdouble y2 );
|
||||
extern bglRectdProcPtr bglRectd;
|
||||
typedef void (APIENTRY * bglColor4fProcPtr)( GLfloat red, GLfloat green, GLfloat blue, GLfloat alpha );
|
||||
extern bglColor4fProcPtr bglColor4f;
|
||||
typedef void (APIENTRY * bglColor4ubProcPtr)( GLubyte red, GLubyte green, GLubyte blue, GLubyte alpha );
|
||||
|
|
|
@ -116,7 +116,7 @@ void OSD_SetLogFile(const char *fn);
|
|||
// sets the functions the OSD will call to interrogate the environment
|
||||
void OSD_SetFunctions(
|
||||
void (*drawchar)(int32_t,int32_t,char,int32_t,int32_t),
|
||||
void (*drawstr)(int32_t,int32_t,char*,int32_t,int32_t,int32_t),
|
||||
void (*drawstr)(int32_t,int32_t,const char*,int32_t,int32_t,int32_t),
|
||||
void (*drawcursor)(int32_t,int32_t,int32_t,int32_t),
|
||||
int32_t (*colwidth)(int32_t),
|
||||
int32_t (*rowheight)(int32_t),
|
||||
|
|
|
@ -66,6 +66,7 @@ bglVertex3fProcPtr bglVertex3f;
|
|||
bglVertex3dProcPtr bglVertex3d;
|
||||
bglVertex3fvProcPtr bglVertex3fv;
|
||||
bglVertex3dvProcPtr bglVertex3dv;
|
||||
bglRectdProcPtr bglRectd;
|
||||
bglColor4fProcPtr bglColor4f;
|
||||
bglColor4ubProcPtr bglColor4ub;
|
||||
bglTexCoord2dProcPtr bglTexCoord2d;
|
||||
|
@ -421,6 +422,7 @@ int32_t loadgldriver(const char *driver)
|
|||
bglVertex3d = (bglVertex3dProcPtr) GETPROC("glVertex3d");
|
||||
bglVertex3fv = (bglVertex3fvProcPtr) GETPROC("glVertex3fv");
|
||||
bglVertex3dv = (bglVertex3dvProcPtr) GETPROC("glVertex3dv");
|
||||
bglRectd = (bglRectdProcPtr) GETPROC("glRectd");
|
||||
bglColor4f = (bglColor4fProcPtr) GETPROC("glColor4f");
|
||||
bglColor4ub = (bglColor4ubProcPtr) GETPROC("glColor4ub");
|
||||
bglTexCoord2d = (bglTexCoord2dProcPtr) GETPROC("glTexCoord2d");
|
||||
|
|
|
@ -292,7 +292,7 @@ int32_t hicclearsubst(int32_t picnum, int32_t palnum)
|
|||
return 0;
|
||||
}
|
||||
|
||||
#else /* POLYMOST */
|
||||
#else /* USE_OPENGL */
|
||||
|
||||
#include "inttypes.h"
|
||||
|
||||
|
|
|
@ -27,7 +27,7 @@ static int32_t _internal_osdfunc_alias(const osdfuncparm_t *);
|
|||
|
||||
static int32_t white=-1; // colour of white (used by default display routines)
|
||||
static void _internal_drawosdchar(int32_t, int32_t, char, int32_t, int32_t);
|
||||
static void _internal_drawosdstr(int32_t, int32_t, char *, int32_t, int32_t, int32_t);
|
||||
static void _internal_drawosdstr(int32_t, int32_t, const char *, int32_t, int32_t, int32_t);
|
||||
static void _internal_drawosdcursor(int32_t,int32_t,int32_t,int32_t);
|
||||
static int32_t _internal_getcolumnwidth(int32_t);
|
||||
static int32_t _internal_getrowheight(int32_t);
|
||||
|
@ -105,7 +105,7 @@ static hashtable_t h_osd = { MAXSYMBOLS<<1, NULL };
|
|||
|
||||
// application callbacks
|
||||
static void (*drawosdchar)(int32_t, int32_t, char, int32_t, int32_t) = _internal_drawosdchar;
|
||||
static void (*drawosdstr)(int32_t, int32_t, char *, int32_t, int32_t, int32_t) = _internal_drawosdstr;
|
||||
static void (*drawosdstr)(int32_t, int32_t, const char *, int32_t, int32_t, int32_t) = _internal_drawosdstr;
|
||||
static void (*drawosdcursor)(int32_t, int32_t, int32_t, int32_t) = _internal_drawosdcursor;
|
||||
static int32_t (*getcolumnwidth)(int32_t) = _internal_getcolumnwidth;
|
||||
static int32_t (*getrowheight)(int32_t) = _internal_getrowheight;
|
||||
|
@ -114,7 +114,7 @@ static int32_t (*gettime)(void) = _internal_gettime;
|
|||
static void (*onshowosd)(int32_t) = _internal_onshowosd;
|
||||
|
||||
static void (*_drawosdchar)(int32_t, int32_t, char, int32_t, int32_t) = _internal_drawosdchar;
|
||||
static void (*_drawosdstr)(int32_t, int32_t, char *, int32_t, int32_t, int32_t) = _internal_drawosdstr;
|
||||
static void (*_drawosdstr)(int32_t, int32_t, const char *, int32_t, int32_t, int32_t) = _internal_drawosdstr;
|
||||
static void (*_drawosdcursor)(int32_t, int32_t, int32_t, int32_t) = _internal_drawosdcursor;
|
||||
static int32_t (*_getcolumnwidth)(int32_t) = _internal_getcolumnwidth;
|
||||
static int32_t (*_getrowheight)(int32_t) = _internal_getrowheight;
|
||||
|
@ -314,6 +314,13 @@ int32_t OSD_GetTextMode(void)
|
|||
return osdtextmode;
|
||||
}
|
||||
|
||||
static inline void swapptr(void *a, void *b)
|
||||
{
|
||||
intptr_t t = *(intptr_t*)a;
|
||||
*(intptr_t*)a = *(intptr_t*)b;
|
||||
*(intptr_t*)b = t;
|
||||
}
|
||||
|
||||
void OSD_SetTextMode(int32_t mode)
|
||||
{
|
||||
osdtextmode = (mode != 0);
|
||||
|
@ -321,20 +328,20 @@ void OSD_SetTextMode(int32_t mode)
|
|||
{
|
||||
if (drawosdchar != _internal_drawosdchar)
|
||||
{
|
||||
swaplong(&_drawosdchar,&drawosdchar);
|
||||
swaplong(&_drawosdstr,&drawosdstr);
|
||||
swaplong(&_drawosdcursor,&drawosdcursor);
|
||||
swaplong(&_getcolumnwidth,&getcolumnwidth);
|
||||
swaplong(&_getrowheight,&getrowheight);
|
||||
swapptr(&_drawosdchar,&drawosdchar);
|
||||
swapptr(&_drawosdstr,&drawosdstr);
|
||||
swapptr(&_drawosdcursor,&drawosdcursor);
|
||||
swapptr(&_getcolumnwidth,&getcolumnwidth);
|
||||
swapptr(&_getrowheight,&getrowheight);
|
||||
}
|
||||
}
|
||||
else if (drawosdchar == _internal_drawosdchar)
|
||||
{
|
||||
swaplong(&_drawosdchar,&drawosdchar);
|
||||
swaplong(&_drawosdstr,&drawosdstr);
|
||||
swaplong(&_drawosdcursor,&drawosdcursor);
|
||||
swaplong(&_getcolumnwidth,&getcolumnwidth);
|
||||
swaplong(&_getrowheight,&getrowheight);
|
||||
swapptr(&_drawosdchar,&drawosdchar);
|
||||
swapptr(&_drawosdstr,&drawosdstr);
|
||||
swapptr(&_drawosdcursor,&drawosdcursor);
|
||||
swapptr(&_getcolumnwidth,&getcolumnwidth);
|
||||
swapptr(&_getrowheight,&getrowheight);
|
||||
}
|
||||
if (qsetmode == 200)
|
||||
OSD_ResizeDisplay(xdim, ydim);
|
||||
|
@ -415,7 +422,7 @@ static void _internal_drawosdchar(int32_t x, int32_t y, char ch, int32_t shade,
|
|||
printext256(4+(x<<3),4+(y<<3), white, -1, st, 0);
|
||||
}
|
||||
|
||||
static void _internal_drawosdstr(int32_t x, int32_t y, char *ch, int32_t len, int32_t shade, int32_t pal)
|
||||
static void _internal_drawosdstr(int32_t x, int32_t y, const char *ch, int32_t len, int32_t shade, int32_t pal)
|
||||
{
|
||||
char st[1024];
|
||||
|
||||
|
@ -792,7 +799,7 @@ void OSD_SetLogFile(const char *fn)
|
|||
//
|
||||
void OSD_SetFunctions(
|
||||
void (*drawchar)(int32_t,int32_t,char,int32_t,int32_t),
|
||||
void (*drawstr)(int32_t,int32_t,char *,int32_t,int32_t,int32_t),
|
||||
void (*drawstr)(int32_t,int32_t,const char *,int32_t,int32_t,int32_t),
|
||||
void (*drawcursor)(int32_t,int32_t,int32_t,int32_t),
|
||||
int32_t (*colwidth)(int32_t),
|
||||
int32_t (*rowheight)(int32_t),
|
||||
|
@ -2133,4 +2140,3 @@ void OSD_WriteCvars(FILE *fp)
|
|||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -9521,138 +9521,22 @@ static int32_t registerosdcommands(void)
|
|||
return 0;
|
||||
}
|
||||
|
||||
#define DUKEOSD
|
||||
#ifdef DUKEOSD
|
||||
# if 0
|
||||
void GAME_drawosdchar(int32_t x, int32_t y, char ch, int32_t shade, int32_t pal)
|
||||
{
|
||||
int32_t ac;
|
||||
|
||||
if (ch == 32) return;
|
||||
ac = ch-'!'+STARTALPHANUM;
|
||||
if (ac < STARTALPHANUM || ac > ENDALPHANUM) return;
|
||||
|
||||
rotatesprite_fs(((x<<3)+x)<<16, (y<<3)<<16, 65536l, 0, ac, shade, pal, 8|16);
|
||||
}
|
||||
|
||||
void GAME_drawosdstr(int32_t x, int32_t y, char *ch, int32_t len, int32_t shade, int32_t pal)
|
||||
{
|
||||
int32_t ac;
|
||||
|
||||
for (x = (x<<3)+x; len>0; len--, ch++, x++)
|
||||
{
|
||||
if (*ch == 32)
|
||||
{
|
||||
x+=5;
|
||||
continue;
|
||||
}
|
||||
ac = *ch-'!'+STARTALPHANUM;
|
||||
if (ac < STARTALPHANUM || ac > ENDALPHANUM) return;
|
||||
|
||||
rotatesprite_fs(x<<16, (y<<3)<<16, 65536l, 0, ac, shade, pal, 8|16);
|
||||
if (*ch >= '0' && *ch <= '9') x+=8;
|
||||
else x += tilesizx[ac];
|
||||
}
|
||||
}
|
||||
# endif
|
||||
|
||||
////////// ALL THINGS OSD //////////
|
||||
static int32_t GetTime(void)
|
||||
{
|
||||
return totalclock;
|
||||
}
|
||||
|
||||
# if 0
|
||||
void GAME_drawosdcursor(int32_t x, int32_t y, int32_t type, int32_t lastkeypress)
|
||||
{
|
||||
int32_t ac;
|
||||
|
||||
if (type) ac = SMALLFNTCURSOR;
|
||||
else ac = '_'-'!'+STARTALPHANUM;
|
||||
|
||||
if (!((GetTime()-lastkeypress) & 0x40l))
|
||||
rotatesprite_fs(((x<<3)+x)<<16, ((y<<3)+(type?-1:2))<<16, 65536l, 0, ac, 0, 8, 8|16);
|
||||
}
|
||||
|
||||
int32_t GAME_getcolumnwidth(int32_t w)
|
||||
{
|
||||
return w/9;
|
||||
}
|
||||
|
||||
int32_t GAME_getrowheight(int32_t w)
|
||||
{
|
||||
return w>>3;
|
||||
}
|
||||
# endif
|
||||
|
||||
//#define BGTILE 311
|
||||
//#define BGTILE 1156
|
||||
#define BGTILE 1141 // BIGHOLE
|
||||
#define BORDTILE 3250 // VIEWBORDER
|
||||
#define BITSTH 1+32+8+16 // high translucency
|
||||
#define BITSTL 1+8+16 // low translucency
|
||||
#define BITS 8+16+64 // solid
|
||||
#define SHADE 16
|
||||
#define PALETTE 4
|
||||
void GAME_clearbackground(int32_t numcols, int32_t numrows)
|
||||
{
|
||||
UNREFERENCED_PARAMETER(numcols);
|
||||
|
||||
# ifdef USE_OPENGL
|
||||
// if (getrendermode() < 3) bits = BITS;
|
||||
// else
|
||||
if (rendmode>=3 && qsetmode==200)
|
||||
{
|
||||
int32_t x, y, xsiz, ysiz, tx2, ty2;
|
||||
int32_t daydim, bits;
|
||||
|
||||
bits = BITSTL;
|
||||
|
||||
daydim = numrows<<3;
|
||||
|
||||
xsiz = tilesizx[BGTILE];
|
||||
tx2 = xdim/xsiz;
|
||||
ysiz = tilesizy[BGTILE];
|
||||
ty2 = daydim/ysiz;
|
||||
|
||||
setpolymost2dview();
|
||||
bglEnable(GL_TEXTURE_2D);
|
||||
|
||||
for (x=0; x<=tx2; x++)
|
||||
for (y=0; y<=ty2; y++)
|
||||
rotatesprite(x*xsiz<<16,y*ysiz<<16,65536L,0,BGTILE,SHADE,PALETTE,bits,0,0,xdim,daydim);
|
||||
|
||||
xsiz = tilesizy[BORDTILE];
|
||||
tx2 = xdim/xsiz;
|
||||
ysiz = tilesizx[BORDTILE];
|
||||
|
||||
for (x=0; x<=tx2; x++)
|
||||
rotatesprite(x*xsiz<<16,(daydim+ysiz+1)<<16,65536L,1536,
|
||||
BORDTILE,SHADE-12,PALETTE,BITS,0,0,xdim,daydim+ysiz+1);
|
||||
|
||||
return;
|
||||
}
|
||||
# endif
|
||||
|
||||
CLEARLINES2D(0, min(ydim, numrows*8+8), editorcolors[16]);
|
||||
}
|
||||
|
||||
static void m32_osdsetfunctions(void)
|
||||
{
|
||||
OSD_SetFunctions(
|
||||
/*
|
||||
GAME_drawosdchar,
|
||||
GAME_drawosdstr,
|
||||
GAME_drawosdcursor,
|
||||
GAME_getcolumnwidth,
|
||||
GAME_getrowheight,
|
||||
*/
|
||||
0,0,0,0,0,
|
||||
GAME_clearbackground,
|
||||
/*(int32_t( *)(void))*/GetTime,
|
||||
NULL, NULL, NULL, NULL, NULL,
|
||||
COMMON_clearbackground,
|
||||
GetTime,
|
||||
NULL
|
||||
);
|
||||
}
|
||||
#endif // defined DUKEOSD
|
||||
|
||||
enum
|
||||
{
|
||||
|
@ -10560,9 +10444,7 @@ int32_t ExtInit(void)
|
|||
Bsprintf(apptitle, "Mapster32 %s %s", VERSION, s_buildRev);
|
||||
autosavetimer = totalclock+120*autosave;
|
||||
|
||||
#if defined(DUKEOSD)
|
||||
m32_osdsetfunctions();
|
||||
#endif
|
||||
|
||||
OSD_SetParameters(0,2, 0,0, 4,0);
|
||||
registerosdcommands();
|
||||
|
@ -11229,9 +11111,8 @@ static void Keys2d3d(void)
|
|||
{
|
||||
getmessageleng = 0;
|
||||
getmessagetimeoff = 0;
|
||||
#if defined(DUKEOSD)
|
||||
|
||||
m32_osdsetfunctions();
|
||||
#endif
|
||||
}
|
||||
|
||||
if (getmessageleng > 0)
|
||||
|
|
|
@ -418,3 +418,25 @@ int32_t dist(const spritetype *s1, const spritetype *s2)
|
|||
return (x - (x>>4) + (t>>2) + (t>>3));
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
// Clear OSD background
|
||||
void COMMON_clearbackground(int32_t numcols, int32_t numrows)
|
||||
{
|
||||
UNREFERENCED_PARAMETER(numcols);
|
||||
|
||||
# ifdef USE_OPENGL
|
||||
if (rendmode>=3 && qsetmode==200)
|
||||
{
|
||||
setpolymost2dview();
|
||||
bglColor4f(0,0,0,0.67f);
|
||||
bglEnable(GL_BLEND);
|
||||
bglRectd(0,0, xdim,8*numrows+8);
|
||||
bglColor4f(0,0,0,1);
|
||||
bglRectd(0,8*numrows+4, xdim,8*numrows+8);
|
||||
return;
|
||||
}
|
||||
# endif
|
||||
|
||||
CLEARLINES2D(0, min(ydim, numrows*8+8), editorcolors[16]);
|
||||
}
|
||||
|
|
|
@ -10015,8 +10015,8 @@ int32_t app_main(int32_t argc, const char **argv)
|
|||
GAME_drawosdcursor,
|
||||
GAME_getcolumnwidth,
|
||||
GAME_getrowheight,
|
||||
GAME_clearbackground,
|
||||
(int32_t( *)(void))GetTime,
|
||||
COMMON_clearbackground,
|
||||
GetTime,
|
||||
GAME_onshowosd
|
||||
);
|
||||
Bstrcpy(tempbuf, APPNAME);
|
||||
|
|
|
@ -28,6 +28,19 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
|||
|
||||
int32_t osdhightile = 0;
|
||||
|
||||
static int32_t GAME_isspace(int32_t ch)
|
||||
{
|
||||
return (ch==32 || ch==9);
|
||||
}
|
||||
|
||||
static int32_t GAME_getchartile(int32_t ch)
|
||||
{
|
||||
int32_t ac = ch-'!'+STARTALPHANUM;
|
||||
if (ac < STARTALPHANUM || ac > ENDALPHANUM)
|
||||
ac = -1;
|
||||
return ac;
|
||||
}
|
||||
|
||||
void GAME_drawosdchar(int32_t x, int32_t y, char ch, int32_t shade, int32_t pal)
|
||||
{
|
||||
int16_t ac;
|
||||
|
@ -36,70 +49,48 @@ void GAME_drawosdchar(int32_t x, int32_t y, char ch, int32_t shade, int32_t pal)
|
|||
#endif
|
||||
int32_t ht = usehightile;
|
||||
|
||||
if (ch == 32) return;
|
||||
ac = ch-'!'+STARTALPHANUM;
|
||||
if (ac < STARTALPHANUM || ac > ENDALPHANUM) return;
|
||||
if (GAME_isspace(ch)) return;
|
||||
if ((ac = GAME_getchartile(ch)) == -1)
|
||||
return;
|
||||
|
||||
usehightile = (osdhightile && ht);
|
||||
rotatesprite_fs(((x<<3)+x)<<16, (y<<3)<<16, 65536l, 0, ac, shade, pal, 8|16);
|
||||
rotatesprite_fs((9*x)<<16, (y<<3)<<16, 65536, 0, ac, shade, pal, 8|16);
|
||||
usehightile = ht;
|
||||
}
|
||||
|
||||
void GAME_drawosdstr(int32_t x, int32_t y, char *ch, int32_t len, int32_t shade, int32_t pal)
|
||||
void GAME_drawosdstr(int32_t x, int32_t y, const char *ch, int32_t len, int32_t shade, int32_t pal)
|
||||
{
|
||||
int16_t ac;
|
||||
char *ptr = OSD_GetTextPtr();
|
||||
char *fmt = OSD_GetFmtPtr();
|
||||
#ifndef USE_OPENGL
|
||||
int32_t usehightile = 0;
|
||||
#endif
|
||||
int32_t ht = usehightile;
|
||||
|
||||
const char *const ptr = OSD_GetTextPtr();
|
||||
const char *const fmt = OSD_GetFmtPtr();
|
||||
const int32_t use_format = (ch > ptr && ch < (ptr + TEXTSIZE));
|
||||
#ifdef USE_OPENGL
|
||||
const int32_t ht = usehightile;
|
||||
usehightile = (osdhightile && ht);
|
||||
x = (x<<3)+x;
|
||||
#endif
|
||||
|
||||
if (ch > ptr && ch < (ptr + TEXTSIZE))
|
||||
{
|
||||
do
|
||||
{
|
||||
if (*ch == 32)
|
||||
{
|
||||
x += OSDCHAR_WIDTH+1;
|
||||
ch++;
|
||||
continue;
|
||||
}
|
||||
ac = *ch-'!'+STARTALPHANUM;
|
||||
if (ac < STARTALPHANUM || ac > ENDALPHANUM) { usehightile = ht; return; }
|
||||
|
||||
// use the format byte if the text falls within the bounds of the console buffer
|
||||
rotatesprite_fs(x<<16, (y<<3)<<16, 65536, 0, ac, (*(ch-ptr+fmt)&~0x1F)>>4,
|
||||
*(ch-ptr+fmt)&~0xE0, 8|16);
|
||||
x += OSDCHAR_WIDTH+1;
|
||||
ch++;
|
||||
}
|
||||
while (--len);
|
||||
|
||||
usehightile = ht;
|
||||
return;
|
||||
}
|
||||
x *= 9;
|
||||
|
||||
do
|
||||
{
|
||||
if (*ch == 32)
|
||||
{
|
||||
x += OSDCHAR_WIDTH+1;
|
||||
ch++;
|
||||
continue;
|
||||
}
|
||||
ac = *ch-'!'+STARTALPHANUM;
|
||||
if (ac < STARTALPHANUM || ac > ENDALPHANUM) { usehightile = ht; return; }
|
||||
if (!GAME_isspace(*ch))
|
||||
if ((ac = GAME_getchartile(*ch)) >= 0)
|
||||
{
|
||||
// use the format byte if the text falls within the bounds of the console buffer
|
||||
const int32_t tshade = use_format ? (fmt[ch-ptr]&~0x1F)>>4 : shade;
|
||||
const int32_t tpal = use_format ? fmt[ch-ptr]&~0xE0 : pal;
|
||||
|
||||
rotatesprite_fs(x<<16, (y<<3)<<16, 65536, 0, ac, tshade, tpal, 8|16);
|
||||
}
|
||||
|
||||
rotatesprite_fs(x<<16, (y<<3)<<16, 65536, 0, ac, shade, pal, 8|16);
|
||||
x += OSDCHAR_WIDTH+1;
|
||||
ch++;
|
||||
}
|
||||
while (--len);
|
||||
|
||||
#ifdef USE_OPENGL
|
||||
usehightile = ht;
|
||||
#endif
|
||||
}
|
||||
|
||||
void GAME_drawosdcursor(int32_t x, int32_t y, int32_t type, int32_t lastkeypress)
|
||||
|
@ -109,8 +100,8 @@ void GAME_drawosdcursor(int32_t x, int32_t y, int32_t type, int32_t lastkeypress
|
|||
if (type) ac = SMALLFNTCURSOR;
|
||||
else ac = '_'-'!'+STARTALPHANUM;
|
||||
|
||||
if (!((GetTime()-lastkeypress) & 0x40l))
|
||||
rotatesprite_fs(((x<<3)+x)<<16, ((y<<3)+(type?-1:2))<<16, 65536l, 0, ac, 0, 8, 8|16);
|
||||
if (((GetTime()-lastkeypress) & 0x40)==0)
|
||||
rotatesprite_fs((9*x)<<16, ((y<<3)+(type?-1:2))<<16, 65536, 0, ac, 0, 8, 8|16);
|
||||
}
|
||||
|
||||
int32_t GAME_getcolumnwidth(int32_t w)
|
||||
|
@ -123,71 +114,12 @@ int32_t GAME_getrowheight(int32_t w)
|
|||
return w>>3;
|
||||
}
|
||||
|
||||
//#define BGTILE 311
|
||||
//#define BGTILE 1156
|
||||
#define BGTILE 1141 // BIGHOLE
|
||||
#define BGTILE_SIZEX 128
|
||||
#define BGTILE_SIZEY 128
|
||||
#define BORDTILE 3250 // VIEWBORDER
|
||||
#define BITSTH 1+32+8+16 // high translucency
|
||||
#define BITSTL 1+8+16 // low translucency
|
||||
#define BITS 8+16+64 // solid
|
||||
#define SHADE 0
|
||||
#define PALETTE 4
|
||||
|
||||
void GAME_onshowosd(int32_t shown)
|
||||
{
|
||||
// fix for TCs like Layre which don't have the BGTILE for some reason
|
||||
// most of this is copied from my dummytile stuff in defs.c
|
||||
if (!tilesizx[BGTILE] || !tilesizy[BGTILE])
|
||||
{
|
||||
set_tilesiz(BGTILE, BGTILE_SIZEX, BGTILE_SIZEY);
|
||||
Bmemset(&picanm[BGTILE], 0, sizeof(picanm_t));
|
||||
faketilesiz[BGTILE] = -1;
|
||||
}
|
||||
|
||||
G_UpdateScreenArea();
|
||||
|
||||
if (numplayers == 1 && ((shown && !ud.pause_on) || (!shown && ud.pause_on)))
|
||||
KB_KeyDown[sc_Pause] = 1;
|
||||
UNREFERENCED_PARAMETER(shown);
|
||||
// XXX: it's weird to fake a keypress like this.
|
||||
// if (numplayers == 1 && ((shown && !ud.pause_on) || (!shown && ud.pause_on)))
|
||||
// KB_KeyDown[sc_Pause] = 1;
|
||||
}
|
||||
|
||||
void GAME_clearbackground(int32_t c, int32_t r)
|
||||
{
|
||||
int32_t x, y, xsiz, ysiz, tx2, ty2;
|
||||
int32_t daydim, bits;
|
||||
|
||||
UNREFERENCED_PARAMETER(c);
|
||||
|
||||
if (getrendermode() < 3) bits = BITS;
|
||||
else bits = BITSTL;
|
||||
|
||||
daydim = r<<3;
|
||||
|
||||
xsiz = tilesizx[BGTILE];
|
||||
ysiz = tilesizy[BGTILE];
|
||||
|
||||
if (xsiz <= 0 || ysiz <= 0)
|
||||
return;
|
||||
|
||||
tx2 = xdim/xsiz;
|
||||
// ty2 = ydim/ysiz;
|
||||
ty2 = daydim/ysiz;
|
||||
|
||||
for (x=tx2; x>=0; x--)
|
||||
for (y=ty2; y>=0; y--)
|
||||
// for (y=ty2+1;y>=1;y--)
|
||||
// rotatesprite(x*xsiz<<16,((daydim-ydim)+(y*ysiz))<<16,65536L,0,BGTILE,SHADE,PALETTE,bits,0,0,xdim,daydim);
|
||||
rotatesprite(x*xsiz<<16,y*ysiz<<16,65536L,0,BGTILE,SHADE,PALETTE,bits,0,0,xdim,daydim);
|
||||
|
||||
xsiz = tilesizy[BORDTILE];
|
||||
if (xsiz <= 0)
|
||||
return;
|
||||
|
||||
tx2 = xdim/xsiz;
|
||||
ysiz = tilesizx[BORDTILE];
|
||||
|
||||
for (x=tx2; x>=0; x--)
|
||||
rotatesprite(x*xsiz<<16,(daydim+ysiz+1)<<16,65536L,1536,BORDTILE,SHADE-12,PALETTE,BITS,0,0,xdim,daydim+ysiz+1);
|
||||
}
|
||||
|
||||
|
|
|
@ -21,11 +21,10 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
|||
//-------------------------------------------------------------------------
|
||||
|
||||
void GAME_drawosdchar(int32_t x, int32_t y, char ch, int32_t shade, int32_t pal);
|
||||
void GAME_drawosdstr(int32_t x, int32_t y, char *ch, int32_t len, int32_t shade, int32_t pal);
|
||||
void GAME_drawosdstr(int32_t x, int32_t y, const char *ch, int32_t len, int32_t shade, int32_t pal);
|
||||
void GAME_drawosdcursor(int32_t x, int32_t y, int32_t type, int32_t lastkeypress);
|
||||
int32_t GAME_getcolumnwidth(int32_t w);
|
||||
int32_t GAME_getrowheight(int32_t w);
|
||||
void GAME_clearbackground(int32_t c, int32_t r);
|
||||
void GAME_onshowosd(int32_t shown);
|
||||
|
||||
extern int32_t osdhightile;
|
||||
|
|
Loading…
Reference in a new issue