DREAMWEB: added keyboard handling

This commit is contained in:
Vladimir Menshakov 2011-06-10 11:30:11 +04:00 committed by Alyssa Milburn
parent b04f590898
commit e535e6e295
2 changed files with 23 additions and 3 deletions

View File

@ -138,6 +138,7 @@ void DreamWebEngine::processEvents() {
} }
break; break;
default: default:
keyPressed(event.kbd.ascii);
break; break;
} }
break; break;
@ -183,6 +184,19 @@ void DreamWebEngine::closeFile() {
_file.close(); _file.close();
} }
void DreamWebEngine::keyPressed(uint16 ascii) {
debug(1, "key pressed = %04x", ascii);
uint8* keybuf = _context.data.ptr(5715, 16); //fixme: some hardcoded offsets are not added as consts
uint16 in = (_context.data.word(dreamgen::kBufferin) + 1) % 0x0f;
uint16 out = _context.data.word(dreamgen::kBufferout);
if (in == out) {
warning("keyboard buffer is full");
return;
}
_context.data.word(dreamgen::kBufferin) = in;
keybuf[in] = ascii;
}
void DreamWebEngine::mouseCall() { void DreamWebEngine::mouseCall() {
processEvents(); processEvents();
Common::Point pos = _mouse; Common::Point pos = _mouse;
@ -215,8 +229,10 @@ void DreamWebEngine::fadeDos() {
if (dst[c]) { if (dst[c]) {
--dst[c]; --dst[c];
} }
dst[c] = c / 3;
} }
palette->setPalette(dst, 0, 64); //Common::hexdump(dst, 64 * 3);
//palette->setPalette(dst, 0, 64);
waitForVSync(); waitForVSync();
} }
} }
@ -225,7 +241,8 @@ void DreamWebEngine::setPalette() {
PaletteManager *palette = _system->getPaletteManager(); PaletteManager *palette = _system->getPaletteManager();
unsigned n = (uint16)_context.cx; unsigned n = (uint16)_context.cx;
uint8 *colors = _context.ds.ptr(_context.si, n * 3); uint8 *colors = _context.ds.ptr(_context.si, n * 3);
palette->setPalette(colors, _context.al, n); //Common::hexdump(colors, n * 3);
//palette->setPalette(colors, _context.al, n);
_context.si += n * 3; _context.si += n * 3;
_context.cx = 0; _context.cx = 0;
} }
@ -318,7 +335,7 @@ void quickquit2(Context &context) {
} }
void keyboardread(Context &context) { void keyboardread(Context &context) {
::error("keyboardread"); ::error("keyboardread"); //this keyboard int handler, must never be called
} }
void resetkeyboard(Context &context) { void resetkeyboard(Context &context) {

View File

@ -89,6 +89,9 @@ public:
void fadeDos(); void fadeDos();
private: private:
void keyPressed(uint16 ascii);
const DreamWebGameDescription *_gameDescription; const DreamWebGameDescription *_gameDescription;
Common::RandomSource _rnd; Common::RandomSource _rnd;
Common::Point _mouse; Common::Point _mouse;