void AGOSEngine::vc36_pause() { const char *message1 = "Press any key to continue"; bool oldWiped = _wiped; _wiped = 0; _videoLockOut |= 8; windowPutChar(_windowArray[2], 13); for (; *message1; message1++) windowPutChar(_windowArray[2], *message1); while (!shouldQuit()) { if (_keyPressed.ascii != 0) break; delay(1); } _keyPressed.reset(); windowPutChar(_windowArray[2], 13); _wiped = oldWiped; _videoLockOut &= ~8; }
void AGOSEngine_PN::interact(char *buffer, uint8 size) { if (!_inputting) { memset(_keyboardBuffer, 0, sizeof(_keyboardBuffer)); _intputCounter = 0; _inputMax = size; _inputWindow = _windowArray[_curWindow]; windowPutChar(_inputWindow, 128); windowPutChar(_inputWindow, 8); _inputting = true; _inputReady = true; } while (!shouldQuit() && _inputReady) { if (!_noScanFlag && _scanFlag) { buffer[0] = 1; buffer[1] = 0; _scanFlag = 0; break; } delay(1); } if (!_inputReady) { memcpy(buffer, _keyboardBuffer, size); _inputting = false; } }
void AGOSEngine_PN::clearCursor(WindowBlock *window) { byte oldTextColor = window->textColor; window->textColor = window->fillColor; windowPutChar(window, 128); window->textColor = oldTextColor; windowPutChar(window, 8); }
void AGOSEngine::showActionString(const byte *string) { WindowBlock *window; uint x; const uint len = (getGameType() == GType_WW) ? 29 : 53; window = _windowArray[1]; if (window == NULL || window->textColor == 0) return; // Arisme : hack for long strings in the French version if ((strlen((const char*)string) - 1) <= len) x = (len - (strlen((const char *)string) - 1)) * 3; else x = 0; window->textColumn = x / 8; window->textColumnOffset = x & 7; if (_language == Common::HE_ISR && window->textColumnOffset != 0) { window->textColumnOffset = 8 - window->textColumnOffset; window->textColumn++; } for (; *string; string++) windowPutChar(window, *string); }
void AGOSEngine_PN::pcl(const char *s) { strcat(_sb, s); if (strchr(s, '\n') == 0) { for (char *str = _sb; *str; str++) windowPutChar(_windowArray[_curWindow], *str); strcpy(_sb, ""); } }
void AGOSEngine_FeebleDemo::waitForSpace() { const char *message; if (_language == Common::DE_DEU) { message = "Dr\x81""cken Sie die <Leertaste>, um fortzufahren..."; } else { message = "Press <SPACE> to continue..."; } windowPutChar(_textWindow, 12); for (; *message; message++) windowPutChar(_textWindow, *message); mouseOff(); do { delay(1); } while (!shouldQuit() && (_keyPressed.keycode != Common::KEYCODE_SPACE)); _keyPressed.reset(); mouseOn(); }
int AGOSEngine_PN::inventoryOn(int val) { writeVariable(210, val); if (_videoLockOut & 0x10) { iconPage(); } else { _videoLockOut |= 0x10; _hitAreaList = _invHitAreas; _windowArray[2]->textColor = 0; windowPutChar(_windowArray[2], 13); clearVideoWindow(4, 0); drawIconHitBar(); _objects = _variableArray[211]; _objectCountS = -1; iconPage(); } return 1; }
void AGOSEngine_PN::addChar(uint8 chr) { if (chr == 13) { _keyboardBuffer[_intputCounter++] = chr; windowPutChar(_inputWindow, 13); } else if (chr == 8 && _intputCounter) { clearCursor(_inputWindow); windowPutChar(_inputWindow, 8); windowPutChar(_inputWindow, 128); windowPutChar(_inputWindow, 8); _keyboardBuffer[--_intputCounter] = 0; } else if (chr >= 32 && _intputCounter < _inputMax) { _keyboardBuffer[_intputCounter++] = chr; clearCursor(_inputWindow); windowPutChar(_inputWindow, chr); windowPutChar(_inputWindow, 128); windowPutChar(_inputWindow, 8); } }
void AGOSEngine::vc48_specialEffect() { uint16 num = vcReadNextWord(); vcReadNextWord(); if (getPlatform() == Common::kPlatformPC) { if (num == 1) { Graphics::Surface *screen = _system->lockScreen(); byte *dst = (byte *)screen->pixels; for (uint h = 0; h < _screenHeight; h++) { for (uint w = 0; w < _screenWidth; w++) { if (dst[w] == 15) dst[w] = 4; } dst += screen->pitch; } _system->unlockScreen(); } else if (num == 2) { const char *str = "There are gurgling noises from the sink."; for (; *str; str++) windowPutChar(_textWindow, *str); } } }
// Elvira 1 specific void AGOSEngine::drawMenuStrip(uint windowNum, uint menuNum) { WindowBlock *window = _windowArray[windowNum % 8]; mouseOff(); byte *srcPtr = _menuBase; int menu = (menuNum != 0) ? menuNum * 4 + 1 : 0; while (menu--) { if (READ_LE_UINT16(srcPtr) != 0xFFFF) { srcPtr += 2; while (*srcPtr != 0) srcPtr++; srcPtr++; } else { srcPtr += 2; } } clearWindow(window); int newline = 0; while (READ_LE_UINT16(srcPtr) != 0xFFFF) { byte *tmp = srcPtr; srcPtr += 2; if (newline != 0) { windowPutChar(window, 10); } uint len = 0; while (*srcPtr != 0 && *srcPtr != 1) { len++; srcPtr++; } if (*srcPtr == 1) srcPtr++; uint maxLen = window->textMaxLength - len; if (window->flags & 1) window->textColumnOffset += 4; maxLen /= 2; while (maxLen--) windowPutChar(window, 32); srcPtr = tmp; uint verb = READ_BE_UINT16(srcPtr); srcPtr += 2; while (*srcPtr != 0) { windowPutChar(window, *srcPtr++); } srcPtr++; if (verb != 0xFFFE) { HitArea *ha = findEmptyHitArea(); ha->x = window->x * 8 + 3; ha->y = window->textRow * 8 + window->y; ha->data = menuNum; ha->width = window->width * 8 - 6; ha->height = 7; ha->flags = kBFBoxInUse | kBFInvertTouch; ha->id = 30000; ha->priority = 1; ha->verb = verb; } newline = 0xFFFF; } mouseOn(); }
void AGOSEngine_Feeble::saveUserGame(int slot) { WindowBlock *window; Common::InSaveFile *in; char name[108]; int len; memset(name, 0, 108); window = _windowArray[3]; window->textRow = (slot + 1 - window->scrollY) * 15; window->textColumn = 26; if ((in = _saveFileMan->openForLoading(genSaveName(readVariable(55))))) { in->read(name, 100); delete in; } len = 0; while (name[len]) { byte chr = name[len]; window->textColumn += getFeebleFontSize(chr); len++; } windowPutChar(window, 0x7f); while (!shouldQuit()) { _keyPressed.reset(); delay(1); if (_keyPressed.ascii == 0 || _keyPressed.ascii >= 127) continue; window->textColumn -= getFeebleFontSize(127); name[len] = 0; windowBackSpace(_windowArray[3]); if (_keyPressed.keycode == Common::KEYCODE_ESCAPE) { _variableArray[55] = 27; break; } if (_keyPressed.keycode == Common::KEYCODE_KP_ENTER || _keyPressed.keycode == Common::KEYCODE_RETURN) { if (!saveGame(readVariable(55), name)) _variableArray[55] = (int16)0xFFFF; else _variableArray[55] = 0; break; } if (_keyPressed.keycode == Common::KEYCODE_BACKSPACE && len != 0) { len--; byte chr = name[len]; window->textColumn -= getFeebleFontSize(chr); name[len] = 0; windowBackSpace(_windowArray[3]); } if (_keyPressed.ascii >= 32 && window->textColumn + 26 <= window->width) { name[len++] = _keyPressed.ascii; windowPutChar(_windowArray[3], _keyPressed.ascii); } windowPutChar(window, 0x7f); } }