/* ScummVM - Graphic Adventure Engine * * ScummVM is the legal property of its developers, whose names * are too numerous to list here. Please refer to the COPYRIGHT * file distributed with this source distribution. * * This program is free software; you can redistribute it and/or * modify it under the terms of the GNU General Public License * as published by the Free Software Foundation; either version 2 * of the License, or (at your option) any later version. * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. * */ #include "dreamweb/dreamweb.h" namespace DreamGen { void DreamGenContext::getUnderMenu() { multiGet(segRef(data.word(kBuffers)).ptr(kUndertimedtext, 0), kMenux, kMenuy, 48, 48); } void DreamGenContext::putUnderMenu() { multiPut(segRef(data.word(kBuffers)).ptr(kUndertimedtext, 0), kMenux, kMenuy, 48, 48); } void DreamGenContext::singleKey(uint8 key, uint16 x, uint16 y) { if (key == data.byte(kGraphicpress)) { key += 11; if (data.byte(kPresscount) < 8) key -= 11; } key -= 20; showFrame(tempGraphics(), x, y, key, 0); } void DreamGenContext::showKeypad() { singleKey(22, kKeypadx+9, kKeypady+5); singleKey(23, kKeypadx+31, kKeypady+5); singleKey(24, kKeypadx+53, kKeypady+5); singleKey(25, kKeypadx+9, kKeypady+23); singleKey(26, kKeypadx+31, kKeypady+23); singleKey(27, kKeypadx+53, kKeypady+23); singleKey(28, kKeypadx+9, kKeypady+41); singleKey(29, kKeypadx+31, kKeypady+41); singleKey(30, kKeypadx+53, kKeypady+41); singleKey(31, kKeypadx+9, kKeypady+59); singleKey(32, kKeypadx+31, kKeypady+59); if (data.byte(kLightcount)) { --data.byte(kLightcount); uint8 frameIndex; uint16 y; if (data.byte(kLockstatus)) { frameIndex = 36; y = kKeypady-1+63; } else { frameIndex = 41; y = kKeypady+4+63; } if ((data.byte(kLightcount) >= 60) && (data.byte(kLightcount) < 100)) --frameIndex; showFrame(tempGraphics(), kKeypadx+60, y, frameIndex, 0); } } void DreamGenContext::enterCode() { enterCode(ax, cx); } void DreamGenContext::enterCode(uint16 keypadAx, uint16 keypadCx) { RectWithCallback keypadList[] = { { kKeypadx+9,kKeypadx+30,kKeypady+9,kKeypady+22,&DreamGenContext::buttonOne }, { kKeypadx+31,kKeypadx+52,kKeypady+9,kKeypady+22,&DreamGenContext::buttonTwo }, { kKeypadx+53,kKeypadx+74,kKeypady+9,kKeypady+22,&DreamGenContext::buttonThree }, { kKeypadx+9,kKeypadx+30,kKeypady+23,kKeypady+40,&DreamGenContext::buttonFour }, { kKeypadx+31,kKeypadx+52,kKeypady+23,kKeypady+40,&DreamGenContext::buttonFive }, { kKeypadx+53,kKeypadx+74,kKeypady+23,kKeypady+40,&DreamGenContext::buttonSix }, { kKeypadx+9,kKeypadx+30,kKeypady+41,kKeypady+58,&DreamGenContext::buttonSeven }, { kKeypadx+31,kKeypadx+52,kKeypady+41,kKeypady+58,&DreamGenContext::buttonEight }, { kKeypadx+53,kKeypadx+74,kKeypady+41,kKeypady+58,&DreamGenContext::buttonNine }, { kKeypadx+9,kKeypadx+30,kKeypady+59,kKeypady+73,&DreamGenContext::buttonNought }, { kKeypadx+31,kKeypadx+74,kKeypady+59,kKeypady+73,&DreamGenContext::buttonEnter }, { kKeypadx+72,kKeypadx+86,kKeypady+80,kKeypady+94,&DreamGenContext::quitKey }, { 0,320,0,200,&DreamGenContext::blank }, { 0xFFFF,0,0,0,0 } }; data.word(kKeypadax) = keypadAx; data.word(kKeypadcx) = keypadCx; getRidOfReels(); loadKeypad(); createPanel(); showIcon(); showOuterPad(); showKeypad(); readMouse(); showPointer(); workToScreen(); delPointer(); data.word(kPresspointer) = 0; data.byte(kGetback) = 0; while (true) { delPointer(); readMouse(); showKeypad(); showPointer(); vSync(); if (data.byte(kPresscount) == 0) { data.byte(kPressed) = 255; data.byte(kGraphicpress) = 255; vSync(); } else --data.byte(kPresscount); dumpPointer(); dumpKeypad(); dumpTextLine(); checkCoords(keypadList); if (quitRequested() || (data.byte(kGetback) == 1)) break; if (data.byte(kLightcount) == 1) { if (data.byte(kLockstatus) == 0) break; } else { if (data.byte(kPresscount) == 40) { addToPressList(); if (data.byte(kPressed) == 11) { ax = data.word(kKeypadax); cx = data.word(kKeypadcx); isItRight(); if (flags.z()) data.byte(kLockstatus) = 0; playChannel1(11); data.byte(kLightcount) = 120; data.word(kPresspointer) = 0; } } } } data.byte(kManisoffscreen) = 0; getRidOfTemp(); restoreReels(); redrawMainScrn(); workToScreenM(); } void DreamGenContext::buttonOne() { cl = 1; buttonPress(); } void DreamGenContext::buttonTwo() { cl = 2; buttonPress(); } void DreamGenContext::buttonThree() { cl = 3; buttonPress(); } void DreamGenContext::buttonFour() { cl = 4; buttonPress(); } void DreamGenContext::buttonFive() { cl = 5; buttonPress(); } void DreamGenContext::buttonSix() { cl = 6; buttonPress(); } void DreamGenContext::buttonSeven() { cl = 7; buttonPress(); } void DreamGenContext::buttonEight() { cl = 8; buttonPress(); } void DreamGenContext::buttonNine() { cl = 9; buttonPress(); } void DreamGenContext::buttonNought() { cl = 10; buttonPress(); } void DreamGenContext::buttonEnter() { cl = 11; buttonPress(); } } /*namespace dreamgen */