Commit 8decf6bd authored by Steven Fuller's avatar Steven Fuller

id_vh.c, id_vh.h: removed the last of fontstruct

vi_sdl.c: added support for a few more keys

wl_play.c: F8/F9 no longer cause game to pause for a long time in CalcTics()
parent d331fdbc
......@@ -274,24 +274,29 @@ void VW_Plot(int x, int y, int color)
VL_Plot(x, y, color);
}
/*
font is:
height is a word
256 word offsets from start
256 byte widths
data
*/
void VW_DrawPropString(char *string)
{
fontstruct *font;
byte *font;
int width, step, height, x, xs, y;
byte *source, *ptrs;
/* byte *dest, *ptrd; */
byte ch;
font = (fontstruct *)grsegs[STARTFONT+fontnumber];
height = font->height;
font = grsegs[STARTFONT+fontnumber];
height = font[0] | (font[1] << 8);
xs = 0;
while ((ch = *string++) != 0) {
width = step = font->width[ch];
source = ((byte *)font)+font->location[ch];
width = step = font[2 + 512 + ch];
source = font+font[2+ch*2+0]+(font[2+ch*2+1]<<8);
for (x = 0; x < width; x++) {
height = font->height;
ptrs = source;
for (y = 0; y < height; y++) {
if (*ptrs)
......@@ -302,45 +307,24 @@ void VW_DrawPropString(char *string)
source++;
}
}
/*
dest = gfxbuf + py * vwidth + px;
while ((ch = *string++) != 0) {
width = step = font->width[ch];
source = ((byte *)font)+font->location[ch];
while (width--) {
height = font->height;
ptrs = source;
ptrd = dest;
while (height--) {
if (*ptrs)
*ptrd = fontcolor;
ptrs += step;
ptrd += vwidth;
}
source++;
dest++;
}
}
*/
}
void VWL_MeasureString(char *string, word *width, word *height, fontstruct *font)
static void VWL_MeasureString(char *string, word *width, word *height, byte *font)
{
int w, mw;
w = 0;
mw = 0;
*height = font->height;
*height = font[0] | (font[1] << 8);
for (;*string; string++) {
if (*string == '\n') {
if (mw < w)
mw = w;
w = 0;
*height += font->height;
*height += font[0] | (font[1] << 8);
} else {
w += font->width[*((byte *)string)];
w += font[2 + 512 + *(byte *)string];
}
}
if (mw < w)
......@@ -351,7 +335,7 @@ void VWL_MeasureString(char *string, word *width, word *height, fontstruct *font
void VW_MeasurePropString(char *string, word *width, word *height)
{
VWL_MeasureString(string,width,height,(fontstruct *)grsegs[STARTFONT+fontnumber]);
VWL_MeasureString(string,width,height,grsegs[STARTFONT+fontnumber]);
}
void VWB_DrawTile8(int x, int y, int tile)
......
......@@ -4,22 +4,11 @@
#define WHITE 15
#define BLACK 0
/* ======================================================================== */
typedef struct
{
int width, height;
} pictabletype;
typedef struct
{
word height;
word location[256];
byte width[256];
} __attribute__((packed)) fontstruct;
/* ======================================================================== */
extern pictabletype pictable[NUMPICS];
extern byte fontcolor;
......
......@@ -258,6 +258,10 @@ int XKeysymToScancode(unsigned int keysym)
return sc_B;
case SDLK_c:
return sc_C;
case SDLK_e:
return sc_E;
case SDLK_g:
return sc_G;
case SDLK_h:
return sc_H;
case SDLK_i:
......@@ -268,10 +272,18 @@ int XKeysymToScancode(unsigned int keysym)
return sc_M;
case SDLK_n:
return sc_N;
case SDLK_r:
return sc_R;
case SDLK_t:
return sc_T;
case SDLK_v:
return sc_V;
case SDLK_y:
return sc_Y;
case SDLK_F8:
return sc_F8;
case SDLK_F9:
return sc_F9;
case SDLK_LEFT:
case SDLK_KP4:
return sc_LeftArrow;
......
......@@ -630,42 +630,46 @@ void CheckKeys()
scan == sc_F7 ||
scan == sc_F8) // pop up quit dialog
{
ClearMemory ();
ClearSplitVWB ();
ClearMemory();
ClearSplitVWB();
US_ControlPanel(scan);
DrawPlayBorderSides ();
DrawPlayBorderSides();
VW_UpdateScreen();
if (scan == sc_F9)
StartMusic ();
StartMusic();
SETFONTCOLOR(0,15);
IN_ClearKeysDown();
lasttimecount = get_TimeCount();
return;
}
if ( (scan >= sc_F1 && scan <= sc_F9) || scan == sc_Escape)
{
StopMusic ();
ClearMemory ();
VW_FadeOut ();
StopMusic();
ClearMemory();
VW_FadeOut();
US_ControlPanel(scan);
SETFONTCOLOR(0,15);
IN_ClearKeysDown();
DrawPlayScreen ();
DrawPlayScreen();
VW_UpdateScreen();
if (!startgame && !loadedgame)
{
VW_FadeIn ();
StartMusic ();
VW_FadeIn();
StartMusic();
}
if (loadedgame)
playstate = ex_abort;
lasttimecount = get_TimeCount();
return;
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment