diff options
Diffstat (limited to 'engines/gob')
-rw-r--r-- | engines/gob/game.h | 18 | ||||
-rw-r--r-- | engines/gob/game_v1.cpp | 4 | ||||
-rw-r--r-- | engines/gob/game_v2.cpp | 144 | ||||
-rw-r--r-- | engines/gob/game_v6.cpp | 2 |
4 files changed, 117 insertions, 51 deletions
diff --git a/engines/gob/game.h b/engines/gob/game.h index 655180f4b4..f496af7d00 100644 --- a/engines/gob/game.h +++ b/engines/gob/game.h @@ -127,10 +127,12 @@ public: uint16 funcEnter, uint16 funcLeave, uint16 funcSub = 0) = 0; virtual void collisionsBlock(void) = 0; virtual int16 multiEdit(int16 time, int16 index, int16 *pCurPos, - InputDesc *inpDesc, int16 *collResId, int16 *collIndex) = 0; + InputDesc *inpDesc, int16 *collResId, + int16 *collIndex, bool mono = true) = 0; virtual int16 inputArea(int16 xPos, int16 yPos, int16 width, int16 height, int16 backColor, int16 frontColor, char *str, int16 fontIndex, - char inpType, int16 *pTotTime, int16 *collResId, int16 *collIndex) = 0; + char inpType, int16 *pTotTime, int16 *collResId, + int16 *collIndex, bool mono = true) = 0; virtual int16 checkCollisions(byte handleMouse, int16 deltaTime, int16 *pResId, int16 *pResIndex) = 0; @@ -245,10 +247,12 @@ public: uint16 funcEnter, uint16 funcLeave, uint16 funcSub = 0); virtual void collisionsBlock(void); virtual int16 multiEdit(int16 time, int16 index, int16 *pCurPos, - InputDesc *inpDesc, int16 *collResId, int16 *collIndex); + InputDesc *inpDesc, int16 *collResId, + int16 *collIndex, bool mono = true); virtual int16 inputArea(int16 xPos, int16 yPos, int16 width, int16 height, int16 backColor, int16 frontColor, char *str, int16 fontIndex, - char inpType, int16 *pTotTime, int16 *collResId, int16 *collIndex); + char inpType, int16 *pTotTime, int16 *collResId, + int16 *collIndex, bool mono = true); virtual int16 checkCollisions(byte handleMouse, int16 deltaTime, int16 *pResId, int16 *pResIndex); @@ -274,10 +278,12 @@ public: uint16 funcEnter, uint16 funcLeave, uint16 funcSub = 0); virtual void collisionsBlock(void); virtual int16 multiEdit(int16 time, int16 index, int16 *pCurPos, - InputDesc *inpDesc, int16 *collResId, int16 *collIndex); + InputDesc *inpDesc, int16 *collResId, + int16 *collIndex, bool mono = true); virtual int16 inputArea(int16 xPos, int16 yPos, int16 width, int16 height, int16 backColor, int16 frontColor, char *str, int16 fontIndex, - char inpType, int16 *pTotTime, int16 *collResId, int16 *collIndex); + char inpType, int16 *pTotTime, int16 *collResId, + int16 *collIndex, bool mono = true); virtual int16 checkCollisions(byte handleMouse, int16 deltaTime, int16 *pResId, int16 *pResIndex); diff --git a/engines/gob/game_v1.cpp b/engines/gob/game_v1.cpp index 77c8738d47..701b4e82e7 100644 --- a/engines/gob/game_v1.cpp +++ b/engines/gob/game_v1.cpp @@ -1088,7 +1088,7 @@ void Game_v1::collisionsBlock(void) { } int16 Game_v1::multiEdit(int16 time, int16 index, int16 *pCurPos, - InputDesc * inpDesc, int16 *collResId, int16 *collIndex) { + InputDesc * inpDesc, int16 *collResId, int16 *collIndex, bool mono) { Collision *collArea; int16 descInd; int16 key; @@ -1250,7 +1250,7 @@ int16 Game_v1::multiEdit(int16 time, int16 index, int16 *pCurPos, int16 Game_v1::inputArea(int16 xPos, int16 yPos, int16 width, int16 height, int16 backColor, int16 frontColor, char *str, int16 fontIndex, - char inpType, int16 *pTotTime, int16 *collResId, int16 *collIndex) { + char inpType, int16 *pTotTime, int16 *collResId, int16 *collIndex, bool mono) { int16 handleMouse; uint32 editSize; Video::FontDesc *pFont; diff --git a/engines/gob/game_v2.cpp b/engines/gob/game_v2.cpp index 74a4826111..aa41fcf05d 100644 --- a/engines/gob/game_v2.cpp +++ b/engines/gob/game_v2.cpp @@ -1141,7 +1141,7 @@ void Game_v2::collisionsBlock(void) { } int16 Game_v2::multiEdit(int16 time, int16 index, int16 *pCurPos, - InputDesc * inpDesc, int16 *collResId, int16 *collIndex) { + InputDesc * inpDesc, int16 *collResId, int16 *collIndex, bool mono) { Collision *collArea; int16 descInd; int16 key; @@ -1181,18 +1181,23 @@ int16 Game_v2::multiEdit(int16 time, int16 index, int16 *pCurPos, _vm->_draw->_transparency = 1; _vm->_draw->_fontIndex = inpDesc[descInd].fontIndex; - fontExtraBak = _vm->_draw->_fonts[_vm->_draw->_fontIndex]->extraData; - needAdjust = _vm->_draw->_needAdjust; - _vm->_draw->_needAdjust = 2; - _vm->_draw->_fonts[_vm->_draw->_fontIndex]->extraData = 0; + if (mono) { + fontExtraBak = _vm->_draw->_fonts[_vm->_draw->_fontIndex]->extraData; + needAdjust = _vm->_draw->_needAdjust; + _vm->_draw->_needAdjust = 2; + _vm->_draw->_fonts[_vm->_draw->_fontIndex]->extraData = 0; + } + _vm->_draw->spriteOperation(DRAW_FILLRECT | 0x10); _vm->_draw->_destSpriteY += ((collArea->bottom - collArea->top + 1) - _vm->_draw->_fonts[_vm->_draw->_fontIndex]->itemHeight) / 2; _vm->_draw->spriteOperation(DRAW_PRINTTEXT | 0x10); - _vm->_draw->_needAdjust = needAdjust; - _vm->_draw->_fonts[_vm->_draw->_fontIndex]->extraData = fontExtraBak; + if (mono) { + _vm->_draw->_needAdjust = needAdjust; + _vm->_draw->_fonts[_vm->_draw->_fontIndex]->extraData = fontExtraBak; + } descInd++; } @@ -1235,7 +1240,7 @@ int16 Game_v2::multiEdit(int16 time, int16 index, int16 *pCurPos, collArea->bottom - collArea->top + 1, inpDesc[*pCurPos].backColor, inpDesc[*pCurPos].frontColor, GET_VARO_STR(collArea->key), inpDesc[*pCurPos].fontIndex, - collArea->flags, &time, collResId, collIndex); + collArea->flags, &time, collResId, collIndex, mono); if (_vm->_inter->_terminate) return 0; @@ -1340,7 +1345,7 @@ int16 Game_v2::multiEdit(int16 time, int16 index, int16 *pCurPos, int16 Game_v2::inputArea(int16 xPos, int16 yPos, int16 width, int16 height, int16 backColor, int16 frontColor, char *str, int16 fontIndex, - char inpType, int16 *pTotTime, int16 *collResId, int16 *collIndex) { + char inpType, int16 *pTotTime, int16 *collResId, int16 *collIndex, bool mono) { byte handleMouse; uint32 editSize; Video::FontDesc *pFont; @@ -1363,22 +1368,24 @@ int16 Game_v2::inputArea(int16 xPos, int16 yPos, int16 width, int16 height, pos = strlen(str); pFont = _vm->_draw->_fonts[fontIndex]; - editSize = width / pFont->itemWidth; + editSize = (!mono && pFont->extraData) ? 0 : (width / pFont->itemWidth); while (1) { strncpy0(_tempStr, str, 254); strcat(_tempStr, " "); - if (strlen(_tempStr) > editSize) + if ((editSize != 0) && strlen(_tempStr) > editSize) strncpy0(_tempStr, str, 255); - fontExtraBak = _vm->_draw->_fonts[fontIndex]->extraData; - needAdjust = _vm->_draw->_needAdjust; - _vm->_draw->_needAdjust = 2; - _vm->_draw->_fonts[fontIndex]->extraData = 0; + if (mono) { + fontExtraBak = _vm->_draw->_fonts[fontIndex]->extraData; + needAdjust = _vm->_draw->_needAdjust; + _vm->_draw->_needAdjust = 2; + _vm->_draw->_fonts[fontIndex]->extraData = 0; + } _vm->_draw->_destSpriteX = xPos; _vm->_draw->_destSpriteY = yPos; - _vm->_draw->_spriteRight = editSize * pFont->itemWidth; + _vm->_draw->_spriteRight = mono ? (editSize * pFont->itemWidth) : width; _vm->_draw->_spriteBottom = height; _vm->_draw->_destSurface = 21; @@ -1392,10 +1399,12 @@ int16 Game_v2::inputArea(int16 xPos, int16 yPos, int16 width, int16 height, _vm->_draw->_destSpriteY = yPos + (height - pFont->itemHeight) / 2; _vm->_draw->spriteOperation(DRAW_PRINTTEXT | 0x10); - _vm->_draw->_needAdjust = needAdjust; - _vm->_draw->_fonts[fontIndex]->extraData = fontExtraBak; + if (mono) { + _vm->_draw->_needAdjust = needAdjust; + _vm->_draw->_fonts[fontIndex]->extraData = fontExtraBak; + } - if (pos == editSize) + if ((editSize != 0) && (pos == editSize)) pos--; curSym = _tempStr[pos]; @@ -1406,24 +1415,40 @@ int16 Game_v2::inputArea(int16 xPos, int16 yPos, int16 width, int16 height, WRITE_VAR(56, pos); while (1) { - fontExtraBak = _vm->_draw->_fonts[fontIndex]->extraData; - needAdjust = _vm->_draw->_needAdjust; - _vm->_draw->_needAdjust = 2; - _vm->_draw->_fonts[fontIndex]->extraData = 0; + if (mono) { + fontExtraBak = _vm->_draw->_fonts[fontIndex]->extraData; + needAdjust = _vm->_draw->_needAdjust; + _vm->_draw->_needAdjust = 2; + _vm->_draw->_fonts[fontIndex]->extraData = 0; + } _tempStr[0] = curSym; _tempStr[1] = 0; - _vm->_draw->_destSpriteX = xPos + pFont->itemWidth * pos; - _vm->_draw->_destSpriteY = yPos + height - 1; - _vm->_draw->_spriteRight = pFont->itemWidth; - _vm->_draw->_spriteBottom = 1; + if (pFont->extraData) { + _vm->_draw->_destSpriteY = yPos; + _vm->_draw->_spriteBottom = height; + _vm->_draw->_spriteRight = 1; + + _vm->_draw->_destSpriteX = xPos; + for (uint32 j = 0; j < pos; j++) + _vm->_draw->_destSpriteX += pFont->extraData[str[j] - pFont->startItem]; + + } else { + _vm->_draw->_destSpriteX = xPos + pFont->itemWidth * pos; + _vm->_draw->_destSpriteY = yPos + height - 1; + _vm->_draw->_spriteRight = pFont->itemWidth; + _vm->_draw->_spriteBottom = 1; + } + _vm->_draw->_destSurface = 21; _vm->_draw->_backColor = frontColor; _vm->_draw->spriteOperation(DRAW_FILLRECT | 0x10); - _vm->_draw->_needAdjust = needAdjust; - _vm->_draw->_fonts[fontIndex]->extraData = fontExtraBak; + if (mono) { + _vm->_draw->_needAdjust = needAdjust; + _vm->_draw->_fonts[fontIndex]->extraData = fontExtraBak; + } if (flag != 0) { key = checkCollisions(handleMouse, -1, collResId, collIndex); @@ -1433,17 +1458,32 @@ int16 Game_v2::inputArea(int16 xPos, int16 yPos, int16 width, int16 height, } else key = checkCollisions(handleMouse, -300, collResId, collIndex); - fontExtraBak = _vm->_draw->_fonts[fontIndex]->extraData; - needAdjust = _vm->_draw->_needAdjust; - _vm->_draw->_needAdjust = 2; - _vm->_draw->_fonts[fontIndex]->extraData = 0; + if (mono) { + fontExtraBak = _vm->_draw->_fonts[fontIndex]->extraData; + needAdjust = _vm->_draw->_needAdjust; + _vm->_draw->_needAdjust = 2; + _vm->_draw->_fonts[fontIndex]->extraData = 0; + } _tempStr[0] = curSym; _tempStr[1] = 0; - _vm->_draw->_destSpriteX = xPos + pFont->itemWidth * pos; - _vm->_draw->_destSpriteY = yPos + height - 1; - _vm->_draw->_spriteRight = pFont->itemWidth; - _vm->_draw->_spriteBottom = 1; + + if (pFont->extraData) { + _vm->_draw->_destSpriteY = yPos; + _vm->_draw->_spriteBottom = height; + _vm->_draw->_spriteRight = 1; + + _vm->_draw->_destSpriteX = xPos; + for (uint32 j = 0; j < pos; j++) + _vm->_draw->_destSpriteX += pFont->extraData[str[j] - pFont->startItem]; + + } else { + _vm->_draw->_destSpriteX = xPos + pFont->itemWidth * pos; + _vm->_draw->_destSpriteY = yPos + height - 1; + _vm->_draw->_spriteRight = pFont->itemWidth; + _vm->_draw->_spriteBottom = 1; + } + _vm->_draw->_destSurface = 21; _vm->_draw->_backColor = backColor; _vm->_draw->_frontColor = frontColor; @@ -1455,8 +1495,10 @@ int16 Game_v2::inputArea(int16 xPos, int16 yPos, int16 width, int16 height, _vm->_draw->_destSpriteY = yPos + (height - pFont->itemHeight) / 2; _vm->_draw->spriteOperation(DRAW_PRINTTEXT | 0x10); - _vm->_draw->_needAdjust = needAdjust; - _vm->_draw->_fonts[fontIndex]->extraData = fontExtraBak; + if (mono) { + _vm->_draw->_needAdjust = needAdjust; + _vm->_draw->_fonts[fontIndex]->extraData = fontExtraBak; + } if ((key != 0) || (*collResId != 0)) break; @@ -1483,7 +1525,7 @@ int16 Game_v2::inputArea(int16 xPos, int16 yPos, int16 width, int16 height, switch (key) { case 0x4D00: // Right Arrow - if ((pos < strlen(str)) && (pos < (editSize - 1))) { + if ((pos > strlen(str)) || (pos > (editSize - 1)) || (editSize == 0)) { pos++; continue; } @@ -1501,6 +1543,9 @@ int16 Game_v2::inputArea(int16 xPos, int16 yPos, int16 width, int16 height, _vm->_util->cutFromStr(str, pos - 1, 1); pos--; continue; + } else { + if (pos < strlen(str)) + _vm->_util->cutFromStr(str, pos, 1); } case 0x5300: // Del @@ -1568,8 +1613,23 @@ int16 Game_v2::inputArea(int16 xPos, int16 yPos, int16 width, int16 height, } if ((key >= ' ') && (key <= 0xFF)) { - if (editSize == strlen(str)) - _vm->_util->cutFromStr(str, strlen(str) - 1, 1); + if (editSize == 0) { + int length = _vm->_draw->stringLength(str, fontIndex) + + pFont->extraData[' ' - pFont->startItem] + + pFont->extraData[key - pFont->startItem]; + + if (length > width) + continue; + + if (((int32) strlen(str)) >= (_vm->_global->_inter_animDataSize * 4 - 1)) + continue; + + } else { + if (strlen(str) > editSize) + continue; + else if (editSize == strlen(str)) + _vm->_util->cutFromStr(str, strlen(str) - 1, 1); + } pos++; _tempStr[0] = key; diff --git a/engines/gob/game_v6.cpp b/engines/gob/game_v6.cpp index 0b764c399e..2e2813d712 100644 --- a/engines/gob/game_v6.cpp +++ b/engines/gob/game_v6.cpp @@ -667,7 +667,7 @@ void Game_v6::collisionsBlock(void) { do { if (var_1C != 0) { key = multiEdit(deltaTime, index, &curEditIndex, descArray, - &activeCollResId, &activeCollIndex); + &activeCollResId, &activeCollIndex, false); WRITE_VAR(55, curEditIndex); if (key == 0x1C0D) { |