2006-04-13 20:47:06 +00:00
|
|
|
#include "duke3d.h"
|
|
|
|
#include "build.h"
|
|
|
|
#include "namesdyn.h"
|
2008-07-19 00:50:20 +00:00
|
|
|
#include "osdfuncs.h"
|
2006-04-13 20:47:06 +00:00
|
|
|
|
2009-01-09 09:29:17 +00:00
|
|
|
int32_t osdhightile = 0;
|
2008-07-25 04:33:33 +00:00
|
|
|
|
2009-01-09 09:29:17 +00:00
|
|
|
void GAME_drawosdchar(int32_t x, int32_t y, char ch, int32_t shade, int32_t pal)
|
2006-04-13 20:47:06 +00:00
|
|
|
{
|
2009-01-09 09:29:17 +00:00
|
|
|
int16_t ac;
|
2008-09-12 02:07:44 +00:00
|
|
|
#if !defined(POLYMOST) || !defined(USE_OPENGL)
|
2009-01-09 09:29:17 +00:00
|
|
|
int32_t usehightile = 0;
|
2008-09-12 02:07:44 +00:00
|
|
|
#endif
|
2009-01-09 09:29:17 +00:00
|
|
|
int32_t ht = usehightile;
|
2006-04-13 20:47:06 +00:00
|
|
|
|
|
|
|
if (ch == 32) return;
|
|
|
|
ac = ch-'!'+STARTALPHANUM;
|
|
|
|
if (ac < STARTALPHANUM || ac > ENDALPHANUM) return;
|
2008-07-26 07:20:57 +00:00
|
|
|
usehightile = (osdhightile && ht);
|
2006-04-13 20:47:06 +00:00
|
|
|
rotatesprite(((x<<3)+x)<<16, (y<<3)<<16, 65536l, 0, ac, shade, pal, 8|16, 0, 0, xdim-1, ydim-1);
|
2008-07-25 01:09:39 +00:00
|
|
|
usehightile = ht;
|
2006-04-13 20:47:06 +00:00
|
|
|
}
|
|
|
|
|
2009-01-09 09:29:17 +00:00
|
|
|
void GAME_drawosdstr(int32_t x, int32_t y, char *ch, int32_t len, int32_t shade, int32_t pal)
|
2006-04-13 20:47:06 +00:00
|
|
|
{
|
2009-01-09 09:29:17 +00:00
|
|
|
int16_t ac;
|
2008-07-18 23:29:20 +00:00
|
|
|
char *ptr = OSD_GetTextPtr();
|
2008-07-21 03:06:34 +00:00
|
|
|
char *fmt = OSD_GetFmtPtr();
|
2008-09-12 02:07:44 +00:00
|
|
|
#if !defined(POLYMOST) || !defined(USE_OPENGL)
|
2009-01-09 09:29:17 +00:00
|
|
|
int32_t usehightile = 0;
|
2008-09-12 02:07:44 +00:00
|
|
|
#endif
|
2009-01-09 09:29:17 +00:00
|
|
|
int32_t ht = usehightile;
|
2008-07-25 01:09:39 +00:00
|
|
|
|
2008-07-26 07:20:57 +00:00
|
|
|
usehightile = (osdhightile && ht);
|
2008-08-24 04:35:35 +00:00
|
|
|
x = (x<<3)+x;
|
2006-04-13 20:47:06 +00:00
|
|
|
|
2008-08-24 04:35:35 +00:00
|
|
|
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(x<<16, (y<<3)<<16, 65536, 0, ac, (*(ch-ptr+fmt)&~0x1F)>>4,
|
2008-08-24 06:17:09 +00:00
|
|
|
*(ch-ptr+fmt)&~0xE0, 8|16, 0, 0, xdim-1, ydim-1);
|
2008-08-24 04:35:35 +00:00
|
|
|
x += OSDCHAR_WIDTH+1;
|
|
|
|
ch++;
|
2008-08-24 06:17:09 +00:00
|
|
|
}
|
|
|
|
while (--len);
|
2008-08-24 04:35:35 +00:00
|
|
|
|
|
|
|
usehightile = ht;
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
|
|
|
do
|
2006-11-15 01:16:55 +00:00
|
|
|
{
|
|
|
|
if (*ch == 32)
|
|
|
|
{
|
2008-08-24 04:35:35 +00:00
|
|
|
x += OSDCHAR_WIDTH+1;
|
|
|
|
ch++;
|
2006-11-15 01:16:55 +00:00
|
|
|
continue;
|
|
|
|
}
|
2006-04-13 20:47:06 +00:00
|
|
|
ac = *ch-'!'+STARTALPHANUM;
|
2008-07-25 01:09:39 +00:00
|
|
|
if (ac < STARTALPHANUM || ac > ENDALPHANUM) { usehightile = ht; return; }
|
2006-04-13 20:47:06 +00:00
|
|
|
|
2008-08-24 04:35:35 +00:00
|
|
|
rotatesprite(x<<16, (y<<3)<<16, 65536, 0, ac, shade, pal, 8|16, 0, 0, xdim-1, ydim-1);
|
|
|
|
x += OSDCHAR_WIDTH+1;
|
|
|
|
ch++;
|
2008-08-24 06:17:09 +00:00
|
|
|
}
|
|
|
|
while (--len);
|
2008-08-24 04:35:35 +00:00
|
|
|
|
2008-07-25 01:09:39 +00:00
|
|
|
usehightile = ht;
|
2006-04-13 20:47:06 +00:00
|
|
|
}
|
|
|
|
|
2009-01-09 09:29:17 +00:00
|
|
|
void GAME_drawosdcursor(int32_t x, int32_t y, int32_t type, int32_t lastkeypress)
|
2006-04-13 20:47:06 +00:00
|
|
|
{
|
2009-01-09 09:29:17 +00:00
|
|
|
int16_t ac;
|
2006-04-13 20:47:06 +00:00
|
|
|
|
|
|
|
if (type) ac = SMALLFNTCURSOR;
|
|
|
|
else ac = '_'-'!'+STARTALPHANUM;
|
|
|
|
|
|
|
|
if (!((GetTime()-lastkeypress) & 0x40l))
|
|
|
|
rotatesprite(((x<<3)+x)<<16, ((y<<3)+(type?-1:2))<<16, 65536l, 0, ac, 0, 8, 8|16, 0, 0, xdim-1, ydim-1);
|
|
|
|
}
|
|
|
|
|
2009-01-09 09:29:17 +00:00
|
|
|
int32_t GAME_getcolumnwidth(int32_t w)
|
2006-04-13 20:47:06 +00:00
|
|
|
{
|
|
|
|
return w/9;
|
|
|
|
}
|
|
|
|
|
2009-01-09 09:29:17 +00:00
|
|
|
int32_t GAME_getrowheight(int32_t w)
|
2006-04-13 20:47:06 +00:00
|
|
|
{
|
|
|
|
return w>>3;
|
|
|
|
}
|
|
|
|
|
|
|
|
//#define BGTILE 311
|
|
|
|
//#define BGTILE 1156
|
|
|
|
#define BGTILE 1141 // BIGHOLE
|
2008-08-04 03:48:46 +00:00
|
|
|
#define BGTILE_SIZEX 128
|
|
|
|
#define BGTILE_SIZEY 128
|
2006-04-13 20:47:06 +00:00
|
|
|
#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
|
2008-08-11 23:22:29 +00:00
|
|
|
#define SHADE 0
|
2006-04-13 20:47:06 +00:00
|
|
|
#define PALETTE 4
|
2008-08-04 03:48:46 +00:00
|
|
|
|
2009-01-09 09:29:17 +00:00
|
|
|
void GAME_onshowosd(int32_t shown)
|
2008-08-04 03:48:46 +00:00
|
|
|
{
|
|
|
|
// 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])
|
|
|
|
{
|
2009-01-09 09:29:17 +00:00
|
|
|
int32_t j;
|
2008-08-04 03:48:46 +00:00
|
|
|
|
|
|
|
tilesizx[BGTILE] = BGTILE_SIZEX;
|
|
|
|
tilesizy[BGTILE] = BGTILE_SIZEY;
|
2009-11-15 09:10:50 +00:00
|
|
|
faketilesiz[BGTILE] = -1;
|
2008-08-04 03:48:46 +00:00
|
|
|
picanm[BGTILE] = 0;
|
|
|
|
|
|
|
|
j = 15; while ((j > 1) && (pow2long[j] > BGTILE_SIZEX)) j--;
|
2009-01-09 09:29:17 +00:00
|
|
|
picsiz[BGTILE] = ((uint8_t)j);
|
2008-08-04 03:48:46 +00:00
|
|
|
j = 15; while ((j > 1) && (pow2long[j] > BGTILE_SIZEY)) j--;
|
2009-01-09 09:29:17 +00:00
|
|
|
picsiz[BGTILE] += ((uint8_t)(j<<4));
|
2008-08-04 03:48:46 +00:00
|
|
|
}
|
|
|
|
|
2008-11-20 14:06:36 +00:00
|
|
|
G_UpdateScreenArea();
|
2009-11-15 09:10:50 +00:00
|
|
|
|
|
|
|
if (numplayers == 1 && ((shown && !ud.pause_on) || (!shown && ud.pause_on)))
|
|
|
|
KB_KeyDown[sc_Pause] = 1;
|
2008-08-04 03:48:46 +00:00
|
|
|
}
|
|
|
|
|
2009-01-09 09:29:17 +00:00
|
|
|
void GAME_clearbackground(int32_t c, int32_t r)
|
2006-04-13 20:47:06 +00:00
|
|
|
{
|
2009-01-09 09:29:17 +00:00
|
|
|
int32_t x, y, xsiz, ysiz, tx2, ty2;
|
|
|
|
int32_t daydim, bits;
|
2006-04-13 20:47:06 +00:00
|
|
|
|
2008-03-22 10:23:57 +00:00
|
|
|
UNREFERENCED_PARAMETER(c);
|
2008-03-21 04:01:38 +00:00
|
|
|
|
2006-11-15 01:16:55 +00:00
|
|
|
if (getrendermode() < 3) bits = BITS;
|
|
|
|
else bits = BITSTL;
|
2006-04-13 20:47:06 +00:00
|
|
|
|
|
|
|
daydim = r<<3;
|
|
|
|
|
2006-11-15 01:16:55 +00:00
|
|
|
xsiz = tilesizx[BGTILE];
|
|
|
|
tx2 = xdim/xsiz;
|
|
|
|
ysiz = tilesizy[BGTILE];
|
2008-08-11 23:22:29 +00:00
|
|
|
// ty2 = ydim/ysiz;
|
2006-11-15 01:16:55 +00:00
|
|
|
ty2 = daydim/ysiz;
|
2006-04-13 20:47:06 +00:00
|
|
|
|
2009-02-19 16:47:54 +00:00
|
|
|
for (x=tx2; x>=0; x--)
|
|
|
|
for (y=ty2; y>=0; y--)
|
2008-08-11 23:22:29 +00:00
|
|
|
// 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);
|
2006-04-13 20:47:06 +00:00
|
|
|
rotatesprite(x*xsiz<<16,y*ysiz<<16,65536L,0,BGTILE,SHADE,PALETTE,bits,0,0,xdim,daydim);
|
|
|
|
|
2006-11-15 01:16:55 +00:00
|
|
|
xsiz = tilesizy[BORDTILE];
|
|
|
|
tx2 = xdim/xsiz;
|
2006-04-13 20:47:06 +00:00
|
|
|
ysiz = tilesizx[BORDTILE];
|
|
|
|
|
2009-02-19 16:47:54 +00:00
|
|
|
for (x=tx2; x>=0; x--)
|
2006-04-13 20:47:06 +00:00
|
|
|
rotatesprite(x*xsiz<<16,(daydim+ysiz+1)<<16,65536L,1536,BORDTILE,SHADE-12,PALETTE,BITS,0,0,xdim,daydim+ysiz+1);
|
|
|
|
}
|
|
|
|
|