LAB: Make setUpScreens() a bit easier to read

This commit is contained in:
Filippos Karapetis 2015-12-18 00:57:43 +02:00 committed by Willem Jan Palenstijn
parent b6bed0aed7
commit 318dc59382

View File

@ -401,6 +401,12 @@ void DisplayMan::drawPanel() {
* Sets up the Labyrinth screens, and opens up the initial windows.
*/
void DisplayMan::setUpScreens() {
EventManager *e = _vm->_event;
ButtonList *moveButtonList = &_vm->_moveButtonList;
ButtonList *invButtonList = &_vm->_invButtonList;
Image **moveImages = _vm->_moveImages;
Image **invImages = _vm->_invImages;
createScreen(_vm->_isHiRes);
Common::File *controlFile = _vm->_resource->openDataFile("P:Control");
@ -409,21 +415,20 @@ void DisplayMan::setUpScreens() {
delete controlFile;
// Creates the buttons for the movement control panel
uint16 y = _vm->_utils->vgaScaleY(173) - _vm->_utils->svgaCord(2);
// The key mapping was only set for the Windows version.
// It's very convenient to have those shortcut, so I added them
// for all versions. (Strangerke)
_vm->_moveButtonList.push_back(_vm->_event->createButton( 1, y, 0, 't', _vm->_moveImages[0], _vm->_moveImages[1]));
_vm->_moveButtonList.push_back(_vm->_event->createButton( 33, y, 1, 'm', _vm->_moveImages[2], _vm->_moveImages[3]));
_vm->_moveButtonList.push_back(_vm->_event->createButton( 65, y, 2, 'o', _vm->_moveImages[4], _vm->_moveImages[5]));
_vm->_moveButtonList.push_back(_vm->_event->createButton( 97, y, 3, 'c', _vm->_moveImages[6], _vm->_moveImages[7]));
_vm->_moveButtonList.push_back(_vm->_event->createButton(129, y, 4, 'l', _vm->_moveImages[8], _vm->_moveImages[9]));
_vm->_moveButtonList.push_back(_vm->_event->createButton(161, y, 5, 'i', _vm->_moveImages[12], _vm->_moveImages[13]));
_vm->_moveButtonList.push_back(_vm->_event->createButton(193, y, 6, VKEY_LTARROW, _vm->_moveImages[14], _vm->_moveImages[15]));
_vm->_moveButtonList.push_back(_vm->_event->createButton(225, y, 7, VKEY_UPARROW, _vm->_moveImages[16], _vm->_moveImages[17]));
_vm->_moveButtonList.push_back(_vm->_event->createButton(257, y, 8, VKEY_RTARROW, _vm->_moveImages[18], _vm->_moveImages[19]));
_vm->_moveButtonList.push_back(_vm->_event->createButton(289, y, 9, 'p', _vm->_moveImages[10], _vm->_moveImages[11]));
uint16 y = _vm->_utils->vgaScaleY(173) - _vm->_utils->svgaCord(2);
moveButtonList->push_back(e->createButton( 1, y, 0, 't', moveImages[0], moveImages[1]));
moveButtonList->push_back(e->createButton( 33, y, 1, 'm', moveImages[2], moveImages[3]));
moveButtonList->push_back(e->createButton( 65, y, 2, 'o', moveImages[4], moveImages[5]));
moveButtonList->push_back(e->createButton( 97, y, 3, 'c', moveImages[6], moveImages[7]));
moveButtonList->push_back(e->createButton(129, y, 4, 'l', moveImages[8], moveImages[9]));
moveButtonList->push_back(e->createButton(161, y, 5, 'i', moveImages[12], moveImages[13]));
moveButtonList->push_back(e->createButton(193, y, 6, VKEY_LTARROW, moveImages[14], moveImages[15]));
moveButtonList->push_back(e->createButton(225, y, 7, VKEY_UPARROW, moveImages[16], moveImages[17]));
moveButtonList->push_back(e->createButton(257, y, 8, VKEY_RTARROW, moveImages[18], moveImages[19]));
moveButtonList->push_back(e->createButton(289, y, 9, 'p', moveImages[10], moveImages[11]));
Common::File *invFile = _vm->_resource->openDataFile("P:Inv");
if (_vm->getPlatform() == Common::kPlatformWindows) {
@ -433,18 +438,18 @@ void DisplayMan::setUpScreens() {
for (uint16 imgIdx = 0; imgIdx < 6; imgIdx++)
_vm->_invImages[imgIdx] = new Image(invFile, _vm);
}
_vm->_invButtonList.push_back(_vm->_event->createButton( 24, y, 0, 'm', _vm->_invImages[0], _vm->_invImages[1]));
_vm->_invButtonList.push_back(_vm->_event->createButton( 56, y, 1, 'g', _vm->_invImages[2], _vm->_invImages[3]));
_vm->_invButtonList.push_back(_vm->_event->createButton( 94, y, 2, 'u', _vm->_invImages[4], _vm->_invImages[5]));
_vm->_invButtonList.push_back(_vm->_event->createButton(126, y, 3, 'l', _vm->_moveImages[8], _vm->_moveImages[9]));
_vm->_invButtonList.push_back(_vm->_event->createButton(164, y, 4, VKEY_LTARROW, _vm->_moveImages[14], _vm->_moveImages[15]));
_vm->_invButtonList.push_back(_vm->_event->createButton(196, y, 5, VKEY_RTARROW, _vm->_moveImages[18], _vm->_moveImages[19]));
invButtonList->push_back(e->createButton( 24, y, 0, 'm', invImages[0], invImages[1]));
invButtonList->push_back(e->createButton( 56, y, 1, 'g', invImages[2], invImages[3]));
invButtonList->push_back(e->createButton( 94, y, 2, 'u', invImages[4], invImages[5]));
invButtonList->push_back(e->createButton(126, y, 3, 'l', moveImages[8], moveImages[9]));
invButtonList->push_back(e->createButton(164, y, 4, VKEY_LTARROW, moveImages[14], moveImages[15]));
invButtonList->push_back(e->createButton(196, y, 5, VKEY_RTARROW, moveImages[18], moveImages[19]));
// The windows version has 2 extra buttons for breadcrumb trail
// CHECKME: the game is really hard to play without those, maybe we could add something to enable that.
if (_vm->getPlatform() == Common::kPlatformWindows) {
_vm->_invButtonList.push_back(_vm->_event->createButton(234, y, 6, 'b', _vm->_invImages[6], _vm->_invImages[7]));
_vm->_invButtonList.push_back(_vm->_event->createButton(266, y, 7, 'f', _vm->_invImages[8], _vm->_invImages[9]));
invButtonList->push_back(e->createButton(234, y, 6, 'b', invImages[6], invImages[7]));
invButtonList->push_back(e->createButton(266, y, 7, 'f', invImages[8], invImages[9]));
}
delete invFile;