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) ...@@ -274,24 +274,29 @@ void VW_Plot(int x, int y, int color)
VL_Plot(x, y, 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) void VW_DrawPropString(char *string)
{ {
fontstruct *font; byte *font;
int width, step, height, x, xs, y; int width, step, height, x, xs, y;
byte *source, *ptrs; byte *source, *ptrs;
/* byte *dest, *ptrd; */
byte ch; byte ch;
font = (fontstruct *)grsegs[STARTFONT+fontnumber]; font = grsegs[STARTFONT+fontnumber];
height = font->height; height = font[0] | (font[1] << 8);
xs = 0; xs = 0;
while ((ch = *string++) != 0) { while ((ch = *string++) != 0) {
width = step = font->width[ch]; width = step = font[2 + 512 + ch];
source = ((byte *)font)+font->location[ch]; source = font+font[2+ch*2+0]+(font[2+ch*2+1]<<8);
for (x = 0; x < width; x++) { for (x = 0; x < width; x++) {
height = font->height;
ptrs = source; ptrs = source;
for (y = 0; y < height; y++) { for (y = 0; y < height; y++) {
if (*ptrs) if (*ptrs)
...@@ -302,45 +307,24 @@ void VW_DrawPropString(char *string) ...@@ -302,45 +307,24 @@ void VW_DrawPropString(char *string)
source++; 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; int w, mw;
w = 0; w = 0;
mw = 0; mw = 0;
*height = font->height; *height = font[0] | (font[1] << 8);
for (;*string; string++) { for (;*string; string++) {
if (*string == '\n') { if (*string == '\n') {
if (mw < w) if (mw < w)
mw = w; mw = w;
w = 0; w = 0;
*height += font->height; *height += font[0] | (font[1] << 8);
} else { } else {
w += font->width[*((byte *)string)]; w += font[2 + 512 + *(byte *)string];
} }
} }
if (mw < w) if (mw < w)
...@@ -351,7 +335,7 @@ void VWL_MeasureString(char *string, word *width, word *height, fontstruct *font ...@@ -351,7 +335,7 @@ void VWL_MeasureString(char *string, word *width, word *height, fontstruct *font
void VW_MeasurePropString(char *string, word *width, word *height) 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) void VWB_DrawTile8(int x, int y, int tile)
......
...@@ -4,22 +4,11 @@ ...@@ -4,22 +4,11 @@
#define WHITE 15 #define WHITE 15
#define BLACK 0 #define BLACK 0
/* ======================================================================== */
typedef struct typedef struct
{ {
int width, height; int width, height;
} pictabletype; } pictabletype;
typedef struct
{
word height;
word location[256];
byte width[256];
} __attribute__((packed)) fontstruct;
/* ======================================================================== */
extern pictabletype pictable[NUMPICS]; extern pictabletype pictable[NUMPICS];
extern byte fontcolor; extern byte fontcolor;
......
...@@ -258,6 +258,10 @@ int XKeysymToScancode(unsigned int keysym) ...@@ -258,6 +258,10 @@ int XKeysymToScancode(unsigned int keysym)
return sc_B; return sc_B;
case SDLK_c: case SDLK_c:
return sc_C; return sc_C;
case SDLK_e:
return sc_E;
case SDLK_g:
return sc_G;
case SDLK_h: case SDLK_h:
return sc_H; return sc_H;
case SDLK_i: case SDLK_i:
...@@ -268,10 +272,18 @@ int XKeysymToScancode(unsigned int keysym) ...@@ -268,10 +272,18 @@ int XKeysymToScancode(unsigned int keysym)
return sc_M; return sc_M;
case SDLK_n: case SDLK_n:
return sc_N; return sc_N;
case SDLK_r:
return sc_R;
case SDLK_t: case SDLK_t:
return sc_T; return sc_T;
case SDLK_v:
return sc_V;
case SDLK_y: case SDLK_y:
return sc_Y; return sc_Y;
case SDLK_F8:
return sc_F8;
case SDLK_F9:
return sc_F9;
case SDLK_LEFT: case SDLK_LEFT:
case SDLK_KP4: case SDLK_KP4:
return sc_LeftArrow; return sc_LeftArrow;
......
...@@ -630,42 +630,46 @@ void CheckKeys() ...@@ -630,42 +630,46 @@ void CheckKeys()
scan == sc_F7 || scan == sc_F7 ||
scan == sc_F8) // pop up quit dialog scan == sc_F8) // pop up quit dialog
{ {
ClearMemory (); ClearMemory();
ClearSplitVWB (); ClearSplitVWB();
US_ControlPanel(scan); US_ControlPanel(scan);
DrawPlayBorderSides (); DrawPlayBorderSides();
VW_UpdateScreen(); VW_UpdateScreen();
if (scan == sc_F9) if (scan == sc_F9)
StartMusic (); StartMusic();
SETFONTCOLOR(0,15); SETFONTCOLOR(0,15);
IN_ClearKeysDown(); IN_ClearKeysDown();
lasttimecount = get_TimeCount();
return; return;
} }
if ( (scan >= sc_F1 && scan <= sc_F9) || scan == sc_Escape) if ( (scan >= sc_F1 && scan <= sc_F9) || scan == sc_Escape)
{ {
StopMusic (); StopMusic();
ClearMemory (); ClearMemory();
VW_FadeOut (); VW_FadeOut();
US_ControlPanel(scan); US_ControlPanel(scan);
SETFONTCOLOR(0,15); SETFONTCOLOR(0,15);
IN_ClearKeysDown(); IN_ClearKeysDown();
DrawPlayScreen (); DrawPlayScreen();
VW_UpdateScreen(); VW_UpdateScreen();
if (!startgame && !loadedgame) if (!startgame && !loadedgame)
{ {
VW_FadeIn (); VW_FadeIn();
StartMusic (); StartMusic();
} }
if (loadedgame) if (loadedgame)
playstate = ex_abort; playstate = ex_abort;
lasttimecount = get_TimeCount(); lasttimecount = get_TimeCount();
return; 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