Fix menu and tutorial it Troll's Tale

svn-id: r28941
This commit is contained in:
Eugene Sandulenko 2007-09-18 17:01:45 +00:00
parent bf75630b42
commit 34ceaf208f
4 changed files with 27 additions and 13 deletions

View File

@ -68,8 +68,9 @@ public:
Common::String getTargetName() { return _targetName; }
// Screen
void clearScreen(int attr);
void clearScreen(int attr, bool overrideDefault = true);
void clearGfxScreen(int attr);
void setDefaultTextColor(int attr) { _defaultColor = attr; }
// Keyboard
int getSelection(SelectionTypes type);

View File

@ -36,8 +36,9 @@
namespace Agi {
// Screen functions
void PreAgiEngine::clearScreen(int attr) {
_defaultColor = attr;
void PreAgiEngine::clearScreen(int attr, bool overrideDefault) {
if (overrideDefault)
_defaultColor = attr;
_gfx->clearScreen((attr & 0xF0) / 0x10);
}
@ -85,7 +86,12 @@ void PreAgiEngine::drawStrMiddle(int row, int attr, const char *buffer) {
}
void PreAgiEngine::clearTextArea() {
for (int row = IDI_MAX_ROW_PIC; row < 200 / 8; row++) {
int start = IDI_MAX_ROW_PIC;
if (getGameID() == GID_TROLL)
start = 21;
for (int row = start; row < 200 / 8; row++) {
clearRow(row);
}
}
@ -126,7 +132,7 @@ int PreAgiEngine::getSelection(SelectionTypes type) {
case Common::EVENT_QUIT:
_system->quit();
case Common::EVENT_LBUTTONUP:
if (type == 0)
if (type == kSelYesNo)
return 1;
case Common::EVENT_RBUTTONUP:
return 0;
@ -158,7 +164,7 @@ int PreAgiEngine::getSelection(SelectionTypes type) {
default:
if (type == kSelYesNo) {
return 2;
} else {
} else if (type == kSelNumber) {
return 10;
}
}

View File

@ -47,8 +47,8 @@ void Troll::pressAnyKey() {
void Troll::drawMenu(const char *szMenu, int iSel) {
_vm->clearTextArea();
_vm->drawStr(20, 0, kColorDefault, szMenu);
_vm->drawStr(21 + iSel, 0, kColorDefault, " *");
_vm->drawStr(21, 0, kColorDefault, szMenu);
_vm->drawStr(22 + iSel, 0, kColorDefault, " *");
_vm->_gfx->doUpdate();
}
@ -66,8 +66,9 @@ void Troll::getMenuSel(const char *szMenu, int *iSel, int nSel) {
case Common::EVENT_MOUSEMOVE:
y = event.mouse.y / 8;
if (nSel > y - 21)
*iSel = y - 21;
if (y >= 22)
if (nSel > y - 22)
*iSel = y - 22;
drawMenu(szMenu, *iSel);
break;
@ -239,20 +240,24 @@ void Troll::tutorial() {
//char szTreasure[16] = {0};
for (;;) {
//SetGfxMode();
_vm->clearScreen(0xFF);
_vm->printStr(IDS_TRO_TUTORIAL_0);
_vm->getSelection(kSelSpace);
_vm->clearScreen(0x55);
_vm->setDefaultTextColor(0x0F);
done = false;
while (!done) {
getMenuSel(IDS_TRO_TUTORIAL_1, &iSel, IDI_TRO_MAX_OPTION);
switch(iSel) {
case IDI_TRO_SEL_OPTION_1:
_vm->clearGfxScreen(0x0B);
_vm->clearScreen(0x22, false);
_vm->_gfx->doUpdate();
break;
case IDI_TRO_SEL_OPTION_2:
_vm->clearGfxScreen(0x00);
_vm->clearScreen(0x00, false);
_vm->_gfx->doUpdate();
break;
case IDI_TRO_SEL_OPTION_3:

View File

@ -115,6 +115,8 @@ const char IDS_TRO_NAME_TREASURE[][16] = {
#define IDI_TRO_SEL_OPTION_2 1
#define IDI_TRO_SEL_OPTION_3 2
#define IDI_TRO_MAX_ROW_PIC 21
// offsets
#define IDA_TRO_BINNAME "troll.exe"