From a1769f0eae4edd6aa5367bd31105b5629b7f0215 Mon Sep 17 00:00:00 2001 From: Eugene Sandulenko Date: Wed, 6 Apr 2005 14:33:31 +0000 Subject: o Implemented pDrawLetter o F5 now can be used to open menu o Minor cleanup svn-id: r17414 --- gob/driver_vga.cpp | 26 +++++++++++++++++++++++++- gob/game.cpp | 2 +- gob/inter.cpp | 5 ++--- gob/util.cpp | 16 ++++------------ 4 files changed, 32 insertions(+), 17 deletions(-) (limited to 'gob') diff --git a/gob/driver_vga.cpp b/gob/driver_vga.cpp index 8398fc9e7f..ab569518a3 100644 --- a/gob/driver_vga.cpp +++ b/gob/driver_vga.cpp @@ -65,7 +65,31 @@ void VGAVideoDriver::putPixel(int16 x, int16 y, byte color, SurfaceDesc *dest) { } void VGAVideoDriver::drawLetter(char item, int16 x, int16 y, FontDesc *fontDesc, byte color1, byte color2, byte transp, SurfaceDesc *dest) { - STUB_FUNC; + byte *src, *dst; + uint16 data; + int i, j; + + src = (byte *)fontDesc->dataPtr + (item - fontDesc->startItem) * (fontDesc->itemSize & 0xff); + dst = dest->vidPtr + x + dest->width * y; + + for (i = 0; i < fontDesc->itemHeight; i++) { + data = READ_BE_UINT16(src); + src += 2; + if (fontDesc->itemSize <= 8) + src--; + + for (j = 0; j < fontDesc->itemWidth; j++) { + if (data & 0x8000) { + *dst = color2; + } else { + if (color1 == 0) + *dst = transp; + } + dst++; + data <<= 1; + } + dst += dest->width - fontDesc->itemWidth; + } } void VGAVideoDriver::drawLine(SurfaceDesc *dest, int16 x0, int16 y0, int16 x1, int16 y1, byte color) { diff --git a/gob/game.cpp b/gob/game.cpp index 06c164a03b..cd2072bc8a 100644 --- a/gob/game.cpp +++ b/gob/game.cpp @@ -840,7 +840,6 @@ int16 game_inputArea(int16 xPos, int16 yPos, int16 width, int16 height, int16 ba case 0x3c00: // F2 case 0x3d00: // F3 case 0x3e00: // F4 - case 0x3f00: // F5 case 0x4000: // F6 case 0x4100: // F7 case 0x4200: // F8 @@ -1693,6 +1692,7 @@ void game_loadImFile(void) { char path[20]; int16 handle; + // If demo if (game_totFileData[0x3d] != 0 && game_totFileData[0x3b] == 0) return; diff --git a/gob/inter.cpp b/gob/inter.cpp index f1b0bdab0c..6010ed8a69 100644 --- a/gob/inter.cpp +++ b/gob/inter.cpp @@ -146,7 +146,7 @@ void inter_printText(void) { char buf[60]; int16 i; - debug(0, "inter_printText"); + debug(3, "inter_printText"); draw_destSpriteX = parse_parseValExpr(); draw_destSpriteY = parse_parseValExpr(); @@ -811,9 +811,9 @@ void inter_loadCursor(void) { debug(0, "inter_loadCursor"); id = inter_load16(); index = *inter_execPtr++; - itemPtr = &game_totResourceTable->items[id]; offset = itemPtr->offset; + if (offset >= 0) { dataBuf = ((char *)game_totResourceTable) + szGame_TotResTable + @@ -895,7 +895,6 @@ void inter_storeKey(int16 key) { else if ((key & 0xff) != 0) key &= 0xff; - debug(0, "key: %d", key); WRITE_LE_UINT32(inter_variables, key); if (key != 0) diff --git a/gob/util.cpp b/gob/util.cpp index 15d1d68a7b..77eb5bd1bc 100644 --- a/gob/util.cpp +++ b/gob/util.cpp @@ -47,9 +47,9 @@ int16 util_translateKey(int16 key) { int16 from; int16 to; } keys[] = { - {8, 0xe08 }, // Backspace - {13, 0x1C0D }, // Enter - {27, 0x11b }, // ESC + {8, 0x0e08}, // Backspace + {13, 0x1C0D}, // Enter + {27, 0x011b}, // ESC {127, 0x5300}, // Del {273, 0x4800}, // Up arrow {274, 0x5000}, // Down arrow @@ -59,7 +59,7 @@ int16 util_translateKey(int16 key) { {283, 0x3c00}, // F2 {284, 0x3d00}, // F3 {285, 0x3E00}, // F4 - {286, 0x3F00}, // F5 + {286, 0x011b}, // F5 {287, 0x4000}, // F6 {288, 0x4100}, // F7 {289, 0x4200}, // F8 @@ -136,19 +136,11 @@ void util_processInput() { } void util_getMouseState(int16 *pX, int16 *pY, int16 *pButtons) { -// int16 x = 0; -// int16 y = 0; -// int16 buttons = 0; - *pX = _mouseX; *pY = _mouseY; if (pButtons != 0) *pButtons = _mouseButtons; -// if (pX != 0) -// *pX = x >> mouseXShift; -// if (pY != 0) -// *pY = y >> mouseYShift; } void util_setMousePos(int16 x, int16 y) { -- cgit v1.2.3