Subversion Repositories eduke32

Rev

Rev 864 | Details | Compare with Previous | Last modification | View Log | RSS feed

Rev Author Line No. Line
5 Plagman 1
#include "duke3d.h"
2
#include "build.h"
3
#include "namesdyn.h"
4
 
5
void GAME_drawosdchar(int x, int y, char ch, int shade, int pal)
6
{
7
    short ac;
8
 
9
    if (ch == 32) return;
10
    ac = ch-'!'+STARTALPHANUM;
11
    if (ac < STARTALPHANUM || ac > ENDALPHANUM) return;
12
 
13
    rotatesprite(((x<<3)+x)<<16, (y<<3)<<16, 65536l, 0, ac, shade, pal, 8|16, 0, 0, xdim-1, ydim-1);
14
}
15
 
821 terminx 16
#define OSDCHAR_WIDTH 8
17
 
5 Plagman 18
void GAME_drawosdstr(int x, int y, char *ch, int len, int shade, int pal)
19
{
20
    short ac;
21
 
865 terminx 22
    UNREFERENCED_PARAMETER(shade);
23
    UNREFERENCED_PARAMETER(pal);
24
 
335 terminx 25
    for (x = (x<<3)+x; len>0; len--, ch++, x++)
26
    {
27
        if (*ch == 32)
28
        {
821 terminx 29
            x += OSDCHAR_WIDTH;
335 terminx 30
            continue;
31
        }
5 Plagman 32
        ac = *ch-'!'+STARTALPHANUM;
33
        if (ac < STARTALPHANUM || ac > ENDALPHANUM) return;
34
 
865 terminx 35
        if (ch > OSD_GetTextPtr() && ch < OSD_GetTextPtr() + TEXTSIZE)
36
            rotatesprite(x<<16, (y<<3)<<16, 65536l, 0, ac, (*(ch-OSD_GetTextPtr()+OSD_GetFmtPtr())&~0x1F)>>4,
37
                *(ch-OSD_GetTextPtr()+OSD_GetFmtPtr())&~0xE0, 8|16, 0, 0, xdim-1, ydim-1);
38
        else
39
            rotatesprite(x<<16, (y<<3)<<16, 65536l, 0, ac, shade,
40
                pal, 8|16, 0, 0, xdim-1, ydim-1);
821 terminx 41
        x += OSDCHAR_WIDTH;
5 Plagman 42
    }
43
}
44
 
45
void GAME_drawosdcursor(int x, int y, int type, int lastkeypress)
46
{
47
    short ac;
48
 
49
    if (type) ac = SMALLFNTCURSOR;
50
    else ac = '_'-'!'+STARTALPHANUM;
51
 
52
    if (!((GetTime()-lastkeypress) & 0x40l))
53
        rotatesprite(((x<<3)+x)<<16, ((y<<3)+(type?-1:2))<<16, 65536l, 0, ac, 0, 8, 8|16, 0, 0, xdim-1, ydim-1);
54
}
55
 
56
int GAME_getcolumnwidth(int w)
57
{
58
    return w/9;
59
}
60
 
61
int GAME_getrowheight(int w)
62
{
63
    return w>>3;
64
}
65
 
66
void GAME_onshowosd(int shown)
67
{
500 terminx 68
    vscrn();
5 Plagman 69
    if (numplayers == 1)
70
        if ((shown && !ud.pause_on) || (!shown && ud.pause_on))
71
            KB_KeyDown[sc_Pause] = 1;
72
}
73
 
74
//#define BGTILE 311
75
//#define BGTILE 1156
76
#define BGTILE 1141     // BIGHOLE
77
#define BORDTILE 3250   // VIEWBORDER
78
#define BITSTH 1+32+8+16        // high translucency
79
#define BITSTL 1+8+16   // low translucency
80
#define BITS 8+16+64            // solid
81
#define SHADE 16
82
#define PALETTE 4
83
void GAME_clearbackground(int c, int r)
84
{
584 terminx 85
    int x, y, xsiz, ysiz, tx2, ty2;
86
    int daydim, bits;
5 Plagman 87
 
654 terminx 88
    UNREFERENCED_PARAMETER(c);
649 terminx 89
 
335 terminx 90
    if (getrendermode() < 3) bits = BITS;
91
    else bits = BITSTL;
5 Plagman 92
 
93
    daydim = r<<3;
94
 
335 terminx 95
    xsiz = tilesizx[BGTILE];
96
    tx2 = xdim/xsiz;
97
    ysiz = tilesizy[BGTILE];
98
    ty2 = daydim/ysiz;
5 Plagman 99
 
331 terminx 100
    for (x=0;x<=tx2;x++)
101
        for (y=0;y<=ty2;y++)
5 Plagman 102
            rotatesprite(x*xsiz<<16,y*ysiz<<16,65536L,0,BGTILE,SHADE,PALETTE,bits,0,0,xdim,daydim);
103
 
335 terminx 104
    xsiz = tilesizy[BORDTILE];
105
    tx2 = xdim/xsiz;
5 Plagman 106
    ysiz = tilesizx[BORDTILE];
107
 
331 terminx 108
    for (x=0;x<=tx2;x++)
5 Plagman 109
        rotatesprite(x*xsiz<<16,(daydim+ysiz+1)<<16,65536L,1536,BORDTILE,SHADE-12,PALETTE,BITS,0,0,xdim,daydim+ysiz+1);
110
}
111