Moved some keyboard code from Winnie together with the other keyboard functions
svn-id: r28965
This commit is contained in:
parent
85b1bc594d
commit
a89694c0d6
3 changed files with 31 additions and 28 deletions
|
@ -75,6 +75,8 @@ public:
|
||||||
// Keyboard
|
// Keyboard
|
||||||
int getSelection(SelectionTypes type);
|
int getSelection(SelectionTypes type);
|
||||||
bool waitAnyKeyChoice();
|
bool waitAnyKeyChoice();
|
||||||
|
bool getSelOkBack();
|
||||||
|
|
||||||
int rnd(int hi) { return (_rnd->getRandomNumber(hi) + 1); }
|
int rnd(int hi) { return (_rnd->getRandomNumber(hi) + 1); }
|
||||||
|
|
||||||
// Text
|
// Text
|
||||||
|
|
|
@ -208,4 +208,31 @@ bool PreAgiEngine::waitAnyKeyChoice() {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
bool PreAgiEngine::getSelOkBack() {
|
||||||
|
Common::Event event;
|
||||||
|
|
||||||
|
for (;;) {
|
||||||
|
while (_eventMan->pollEvent(event)) {
|
||||||
|
switch (event.type) {
|
||||||
|
case Common::EVENT_QUIT:
|
||||||
|
_system->quit();
|
||||||
|
break;
|
||||||
|
case Common::EVENT_LBUTTONUP:
|
||||||
|
return true;
|
||||||
|
case Common::EVENT_RBUTTONUP:
|
||||||
|
return false;
|
||||||
|
case Common::EVENT_KEYDOWN:
|
||||||
|
switch (event.kbd.keycode) {
|
||||||
|
case Common::KEYCODE_BACKSPACE:
|
||||||
|
return false;
|
||||||
|
default:
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
default:
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -218,7 +218,7 @@ int Winnie::parser(int pc, int index, uint8 *buffer) {
|
||||||
default:
|
default:
|
||||||
// print description
|
// print description
|
||||||
_vm->printStrXOR((char *)(buffer + pc));
|
_vm->printStrXOR((char *)(buffer + pc));
|
||||||
if (getSelOkBack())
|
if (_vm->getSelOkBack())
|
||||||
return IDI_WTP_PAR_OK;
|
return IDI_WTP_PAR_OK;
|
||||||
else
|
else
|
||||||
return IDI_WTP_PAR_BACK;
|
return IDI_WTP_PAR_BACK;
|
||||||
|
@ -854,7 +854,7 @@ void Winnie::getMenuSel(char *szMenu, int *iSel, int fCanSel[]) {
|
||||||
break;
|
break;
|
||||||
case Common::KEYCODE_s:
|
case Common::KEYCODE_s:
|
||||||
if (event.kbd.flags & Common::KBD_CTRL) {
|
if (event.kbd.flags & Common::KBD_CTRL) {
|
||||||
//FlipSound();
|
_vm->flipflag(fSoundOn);
|
||||||
} else {
|
} else {
|
||||||
*iSel = IDI_WTP_SEL_SOUTH;
|
*iSel = IDI_WTP_SEL_SOUTH;
|
||||||
makeSel();
|
makeSel();
|
||||||
|
@ -1018,32 +1018,6 @@ void Winnie::drawRoomPic() {
|
||||||
delete [] buffer;
|
delete [] buffer;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool Winnie::getSelOkBack() {
|
|
||||||
Common::Event event;
|
|
||||||
|
|
||||||
for (;;) {
|
|
||||||
while (_vm->_system->getEventManager()->pollEvent(event)) {
|
|
||||||
switch (event.type) {
|
|
||||||
case Common::EVENT_QUIT:
|
|
||||||
_vm->_system->quit();
|
|
||||||
break;
|
|
||||||
case Common::EVENT_LBUTTONUP:
|
|
||||||
return true;
|
|
||||||
case Common::EVENT_RBUTTONUP:
|
|
||||||
return false;
|
|
||||||
case Common::EVENT_KEYDOWN:
|
|
||||||
switch (event.kbd.keycode) {
|
|
||||||
case Common::KEYCODE_BACKSPACE:
|
|
||||||
return false;
|
|
||||||
default:
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
default:
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
void Winnie::clrMenuSel(int *iSel, int fCanSel[]) {
|
void Winnie::clrMenuSel(int *iSel, int fCanSel[]) {
|
||||||
*iSel = IDI_WTP_SEL_OPT_1;
|
*iSel = IDI_WTP_SEL_OPT_1;
|
||||||
while (!fCanSel[*iSel]) {
|
while (!fCanSel[*iSel]) {
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue