void AgiEngine::clearPrompt() { int l; l = _game.lineUserInput; clearLines(l, l, _game.colorBg); flushLines(l, l); _gfx->doUpdate(); }
/** * Write the status line. */ void AgiEngine::writeStatus() { char x[64]; if (_debug.statusline) { printStatus("%3d(%03d) %3d,%3d(%3d,%3d) ", getvar(0), getvar(1), _game.viewTable[0].xPos, _game.viewTable[0].yPos, WIN_TO_PIC_X(_mouse.x), WIN_TO_PIC_Y(_mouse.y)); return; } if (!_game.statusLine) { clearLines(_game.lineStatus, _game.lineStatus, 0); flushLines(_game.lineStatus, _game.lineStatus); #if 0 // FIXME: Breaks wrist watch prompt in SQ2 // Clear the user input line as well when clearing the status line // Fixes bug #1893564 - AGI: Texts messed out in Naturette 1 clearLines(_game.lineUserInput, _game.lineUserInput, 0); flushLines(_game.lineUserInput, _game.lineUserInput); #endif return; } switch (getLanguage()) { case Common::RU_RUS: sprintf(x, " \x91\xe7\xa5\xe2: %i \xa8\xa7 %-3i", _game.vars[vScore], _game.vars[vMaxScore]); printStatus("%-17s \x87\xa2\xe3\xaa:%s", x, getflag(fSoundOn) ? "\xa2\xaa\xab " : "\xa2\xeb\xaa\xab"); break; default: sprintf(x, " Score:%i of %-3i", _game.vars[vScore], _game.vars[vMaxScore]); printStatus("%-17s Sound:%s ", x, getflag(fSoundOn) ? "on " : "off"); break; } }
void DebugDraw::drawLine(const btVector3& from, const btVector3& to, const btVector3& fromColor, const btVector3& toColor) { _bufferData.emplace_back(from); _bufferData.push_back(Color3(fromColor)); _bufferData.emplace_back(to); _bufferData.push_back(Color3(toColor)); /* The flushLines() API was added at some point between 2.83 and 2.83.4, but that's below the resolution of the constant below. Moreover, 284 corresponds to 2.83.6, while 2.84 is 285. Fun, right? Relevant commit: https://github.com/bulletphysics/bullet3/commit/7b28e86c7b9ab3c4bb8d479f843b9b5c2e1c9a06 The Bullet API and documentation and everything is utter crap, so I'm not bothering more here. Yes, every call to drawLine() will cause a new drawcall with a single line segment to be submitted. Just to be clear why I did that: Ubuntu 14.04, which is now the oldest supported platform, has only 2.81 in the repositories. */ #if BT_BULLET_VERSION < 284 flushLines(); #endif }
virtual void drawLine(const btVector3& from1,const btVector3& to1,const btVector3& color1) { //float from[4] = {from1[0],from1[1],from1[2],from1[3]}; //float to[4] = {to1[0],to1[1],to1[2],to1[3]}; //float color[4] = {color1[0],color1[1],color1[2],color1[3]}; //m_glApp->m_instancingRenderer->drawLine(from,to,color); if (m_currentLineColor!=color1 || m_linePoints.size() >= BT_LINE_BATCH_SIZE) { flushLines(); m_currentLineColor = color1; } MyDebugVec3 from(from1); MyDebugVec3 to(to1); m_linePoints.push_back(from); m_linePoints.push_back(to); m_lineIndices.push_back(m_lineIndices.size()); m_lineIndices.push_back(m_lineIndices.size()); }
/** * Print user input prompt. */ void AgiEngine::writePrompt() { int l, fg, bg, pos; int promptLength = strlen(agiSprintf(_game.strings[0])); if (!_game.inputEnabled || _game.inputMode != INPUT_NORMAL) return; l = _game.lineUserInput; fg = _game.colorFg; bg = _game.colorBg; pos = _game.cursorPos; debugC(4, kDebugLevelText, "erase line %d", l); clearLines(l, l, _game.colorBg); debugC(4, kDebugLevelText, "prompt = '%s'", agiSprintf(_game.strings[0])); printText(_game.strings[0], 0, 0, l, promptLength + 1, fg, bg); printText((char *)_game.inputBuffer, 0, promptLength, l, pos + 1, fg, bg); _gfx->printCharacter(pos + promptLength, l, _game.cursorChar, fg, bg); flushLines(l, l); _gfx->doUpdate(); }
/** * Display inventory items. */ void AgiEngine::inventory() { int oldFg, oldBg; int n; // screen is white with black text oldFg = _game.colorFg; oldBg = _game.colorBg; _game.colorFg = 0; _game.colorBg = 15; _gfx->clearScreen(_game.colorBg); switch (getLanguage()) { case Common::RU_RUS: printText(YOUHAVE_MSG_RU, 0, YOUHAVE_X_RU, YOUHAVE_Y_RU, 40, STATUS_FG, STATUS_BG); break; default: printText(YOUHAVE_MSG, 0, YOUHAVE_X, YOUHAVE_Y, 40, STATUS_FG, STATUS_BG); break; } // FIXME: doesn't check if objects overflow off screen... _intobj = (uint8 *)malloc(4 + _game.numObjects); memset(_intobj, 0, (4 + _game.numObjects)); n = showItems(); switch (getLanguage()) { case Common::RU_RUS: if (getflag(fStatusSelectsItems)) { printText(SELECT_MSG_RU, 0, SELECT_X_RU, SELECT_Y_RU, 40, STATUS_FG, STATUS_BG); } else { printText(ANY_KEY_MSG_RU, 0, ANY_KEY_X_RU, ANY_KEY_Y_RU, 40, STATUS_FG, STATUS_BG); } break; default: if (getflag(fStatusSelectsItems)) { printText(SELECT_MSG, 0, SELECT_X, SELECT_Y, 40, STATUS_FG, STATUS_BG); } else { printText(ANY_KEY_MSG, 0, ANY_KEY_X, ANY_KEY_Y, 40, STATUS_FG, STATUS_BG); } break; } _gfx->flushScreen(); // If flag 13 is set, we want to highlight & select an item. // opon selection, put objnum in var 25. Then on esc put in // var 25 = 0xff. if (getflag(fStatusSelectsItems)) selectItems(n); free(_intobj); if (!getflag(fStatusSelectsItems)) waitAnyKey(); _gfx->clearScreen(0); writeStatus(); _picture->showPic(); _game.colorFg = oldFg; _game.colorBg = oldBg; _game.hasPrompt = 0; flushLines(_game.lineUserInput, 24); }
void AgiEngine::handleKeys(int key) { uint8 *p = NULL; int c = 0; static uint8 formattedEntry[40]; int l = _game.lineUserInput; int fg = _game.colorFg, bg = _game.colorBg; int promptLength = strlen(agiSprintf(_game.strings[0])); setvar(vWordNotFound, 0); debugC(3, kDebugLevelInput, "handling key: %02x", key); switch (key) { case KEY_ENTER: debugC(3, kDebugLevelInput, "KEY_ENTER"); _game.keypress = 0; // Remove all leading spaces for (p = _game.inputBuffer; *p && *p == 0x20; p++) ; // Copy to internal buffer for (; *p && c < 40-1; p++) { // Squash spaces if (*p == 0x20 && *(p + 1) == 0x20) { p++; continue; } formattedEntry[c++] = tolower(*p); } formattedEntry[c++] = 0; // Handle string only if it's not empty if (formattedEntry[0]) { strcpy((char *)_game.echoBuffer, (const char *)_game.inputBuffer); strcpy(_lastSentence, (const char *)formattedEntry); dictionaryWords(_lastSentence); } // Clear to start a new line _game.hasPrompt = 0; _game.inputBuffer[_game.cursorPos = 0] = 0; debugC(3, kDebugLevelInput | kDebugLevelText, "clear lines"); clearLines(l, l + 1, bg); flushLines(l, l + 1); #ifdef __DS__ DS::findWordCompletions((char *) _game.inputBuffer); #endif break; case KEY_ESCAPE: debugC(3, kDebugLevelInput, "KEY_ESCAPE"); newInputMode(INPUT_MENU); break; case KEY_BACKSPACE: // Ignore backspace at start of line if (_game.cursorPos == 0) break; // erase cursor _gfx->printCharacter(_game.cursorPos + promptLength, l, ' ', fg, bg); _game.inputBuffer[--_game.cursorPos] = 0; // Print cursor _gfx->printCharacter(_game.cursorPos + promptLength, l, _game.cursorChar, fg, bg); #ifdef __DS__ DS::findWordCompletions((char *) _game.inputBuffer); #endif break; default: // Ignore invalid keystrokes if (key < 0x20 || key > 0x7f) break; // Maximum input size reached if (_game.cursorPos >= getvar(vMaxInputChars)) break; _game.inputBuffer[_game.cursorPos++] = key; _game.inputBuffer[_game.cursorPos] = 0; #ifdef __DS__ DS::findWordCompletions((char *) _game.inputBuffer); #endif // echo _gfx->printCharacter(_game.cursorPos + promptLength - 1, l, _game.inputBuffer[_game.cursorPos - 1], fg, bg); // Print cursor _gfx->printCharacter(_game.cursorPos + promptLength, l, _game.cursorChar, fg, bg); break; } }