KYRA: (EOB) - more work on ingame menus

This commit is contained in:
athrxx 2011-06-23 22:42:12 +02:00 committed by Johannes Schickel
parent 045d08986d
commit 97e5036bf0
31 changed files with 668 additions and 252 deletions

View File

@ -266,6 +266,8 @@ const ExtractFilename extractFilenames[] = {
{ kEobBaseMenuStringsMgc, kTypeStringList, true },
{ kEobBaseMenuStringsPrefs, kTypeStringList, true },
{ kEobBaseMenuStringsRest2, kTypeStringList, true },
{ kEobBaseMenuStringsRest3, kTypeStringList, true },
{ kEobBaseMenuStringsRest4, kTypeStringList, true },
{ kEobBaseMenuStringsDefeat, kTypeStringList, true },
{ kEobBaseMenuStringsTransfer, kTypeStringList, true },
{ kEobBaseMenuStringsSpec, kTypeStringList, true },
@ -1342,6 +1344,10 @@ const char *getIdString(const int id) {
return "kEobBaseMenuStringsPrefs";
case kEobBaseMenuStringsRest2:
return "kEobBaseMenuStringsRest2";
case kEobBaseMenuStringsRest3:
return "kEobBaseMenuStringsRest3";
case kEobBaseMenuStringsRest4:
return "kEobBaseMenuStringsRest4";
case kEobBaseMenuStringsDefeat:
return "kEobBaseMenuStringsDefeat";
case kEobBaseMenuStringsTransfer:

View File

@ -241,6 +241,8 @@ enum kExtractID {
kEobBaseMenuStringsMgc,
kEobBaseMenuStringsPrefs,
kEobBaseMenuStringsRest2,
kEobBaseMenuStringsRest3,
kEobBaseMenuStringsRest4,
kEobBaseMenuStringsDefeat,
kEobBaseMenuStringsTransfer,
kEobBaseMenuStringsSpec,

View File

@ -1092,6 +1092,7 @@ const int eob1FloppyNeed[] = {
kEobBaseMenuStringsMgc,
kEobBaseMenuStringsPrefs,
kEobBaseMenuStringsRest2,
kEobBaseMenuStringsRest4,
kEobBaseMenuStringsDefeat,
kEobBaseCharGuiStringsHp,
@ -1268,6 +1269,8 @@ const int eob2FloppyNeed[] = {
kEobBaseMenuStringsMgc,
kEobBaseMenuStringsPrefs,
kEobBaseMenuStringsRest2,
kEobBaseMenuStringsRest3,
kEobBaseMenuStringsRest4,
kEobBaseMenuStringsDefeat,
kEobBaseMenuStringsTransfer,
kEobBaseMenuStringsSpec,

View File

@ -1629,10 +1629,24 @@ const ExtractEntrySearchData kEobBaseMenuStringsPrefsProvider[] = {
};
const ExtractEntrySearchData kEobBaseMenuStringsRest2Provider[] = {
{ EN_ANY, kPlatformUnknown, { 0x00000076, 0x00002530, { { 0xAD, 0x7A, 0x80, 0x8B, 0x97, 0x65, 0x67, 0xB2, 0x67, 0xE3, 0xF8, 0xDA, 0x0B, 0x9A, 0x61, 0x26 } } } }, // EOB1
{ DE_DEU, kPlatformUnknown, { 0x00000082, 0x000029A1, { { 0x02, 0x83, 0xBC, 0x56, 0xB4, 0xFE, 0xF0, 0x03, 0x3D, 0xFD, 0x2C, 0x3B, 0x14, 0x8F, 0x44, 0x1B } } } }, // EOB
{ EN_ANY, kPlatformUnknown, { 0x000000A5, 0x000033C9, { { 0xC4, 0x69, 0x00, 0x7B, 0x93, 0x98, 0x0E, 0xD1, 0x94, 0xF8, 0x39, 0x19, 0xBA, 0x53, 0x37, 0x35 } } } }, // EOB2
{ DE_DEU, kPlatformUnknown, { 0x000000A4, 0x000033C1, { { 0x3B, 0x3A, 0x01, 0x8F, 0x3F, 0x9E, 0xC2, 0xC7, 0x70, 0xF8, 0x9C, 0x84, 0x6D, 0xFE, 0xC2, 0x40 } } } }, // EOB2
{ EN_ANY, kPlatformUnknown, { 0x0000004D, 0x00001744, { { 0x63, 0xA5, 0x6F, 0x09, 0x6F, 0x5E, 0x4B, 0x89, 0xFF, 0x33, 0x63, 0xCB, 0xAA, 0x04, 0x59, 0x63 } } } }, // EOB1
{ DE_DEU, kPlatformUnknown, { 0x0000004D, 0x00001769, { { 0x2C, 0xA9, 0x7D, 0x4C, 0xC5, 0x13, 0xE2, 0xEB, 0x89, 0x6C, 0xAE, 0x25, 0xC3, 0x3E, 0x56, 0x7E } } } }, // EOB1
{ EN_ANY, kPlatformUnknown, { 0x00000052, 0x000017F6, { { 0x7C, 0x49, 0xFC, 0x89, 0x90, 0x5D, 0xFF, 0x86, 0x86, 0xE9, 0xB2, 0x29, 0x60, 0xB2, 0x22, 0x7F } } } }, // EOB2
{ DE_DEU, kPlatformUnknown, { 0x0000004C, 0x000014FF, { { 0x0C, 0x94, 0x6D, 0x5A, 0x42, 0x68, 0xE0, 0xDC, 0xCD, 0xB9, 0x1A, 0x4A, 0xC1, 0xCC, 0xE6, 0x91 } } } }, // EOB2
EXTRACT_END_ENTRY
};
const ExtractEntrySearchData kEobBaseMenuStringsRest3Provider[] = {
{ EN_ANY, kPlatformUnknown, { 0x0000002B, 0x00000DF4, { { 0x42, 0x90, 0x49, 0xA7, 0x2E, 0x61, 0x77, 0x7F, 0x9F, 0x53, 0xAD, 0x3C, 0x87, 0xE2, 0x0E, 0x36 } } } }, // EOB2
{ DE_DEU, kPlatformUnknown, { 0x00000027, 0x00000D45, { { 0x8D, 0xAB, 0xBF, 0x57, 0xF3, 0x2C, 0x3F, 0x93, 0xBF, 0x33, 0x58, 0x2D, 0x97, 0x78, 0x71, 0x7F } } } }, // EOB2
EXTRACT_END_ENTRY
};
const ExtractEntrySearchData kEobBaseMenuStringsRest4Provider[] = {
{ EN_ANY, kPlatformUnknown, { 0x00000029, 0x00000DEC, { { 0x1C, 0x86, 0x3D, 0x40, 0x2C, 0x5E, 0xCA, 0xA0, 0xA1, 0xB8, 0x23, 0x42, 0x9C, 0x6B, 0xFA, 0xBB } } } }, // EOB1
{ DE_DEU, kPlatformUnknown, { 0x00000034, 0x00001238, { { 0xE9, 0x95, 0x27, 0x79, 0x1C, 0x0D, 0xF5, 0x94, 0x92, 0xFC, 0xCA, 0x22, 0x17, 0xA8, 0x36, 0x96 } } } }, // EOB1
{ EN_ANY, kPlatformUnknown, { 0x0000002A, 0x00000DEB, { { 0x0E, 0xD3, 0xC5, 0xA9, 0x8B, 0x06, 0x57, 0xB0, 0x20, 0x1A, 0xEE, 0x42, 0x49, 0x2E, 0xA1, 0x50 } } } }, // EOB2
{ DE_DEU, kPlatformUnknown, { 0x00000033, 0x00001189, { { 0x56, 0x1B, 0x6B, 0x00, 0x47, 0xFD, 0x56, 0xD3, 0x12, 0x03, 0x79, 0x7D, 0xFF, 0x83, 0xCF, 0xAA } } } }, // EOB2
EXTRACT_END_ENTRY
};
@ -3378,6 +3392,8 @@ const ExtractEntry extractProviders[] = {
{ kEobBaseMenuStringsMgc, kEobBaseMenuStringsMgcProvider },
{ kEobBaseMenuStringsPrefs, kEobBaseMenuStringsPrefsProvider },
{ kEobBaseMenuStringsRest2, kEobBaseMenuStringsRest2Provider },
{ kEobBaseMenuStringsRest3, kEobBaseMenuStringsRest3Provider },
{ kEobBaseMenuStringsRest4, kEobBaseMenuStringsRest4Provider },
{ kEobBaseMenuStringsDefeat, kEobBaseMenuStringsDefeatProvider },
{ kEobBaseMenuStringsTransfer, kEobBaseMenuStringsTransferProvider },
{ kEobBaseMenuStringsSpec, kEobBaseMenuStringsSpecProvider },

View File

@ -42,7 +42,6 @@ private:
void checkForCompleteParty();
void toggleSpecialButton(int index, int bodyCustom, int pageNum);
void processSpecialButton(int index);
void highlightBoxFrame(int index);
int viewDeleteCharacter();
void createPartyMember();
int raceSexMenu();
@ -67,11 +66,8 @@ private:
uint8 **_chargenButtonLabels;
int _activeBox;
int _magicShapesBox;
int _updateBoxIndex;
int _updateBoxColorIndex;
int _updateBoxShapesIndex;
int _lastUpdateBoxShapesIndex;
uint32 _chargenBoxTimer;
uint32 _chargenMagicShapeTimer;
int8 _chargenSelectedPortraits[4];
int8 _chargenSelectedPortraits2[4];
@ -95,7 +91,6 @@ private:
static const EobChargenButtonDef _chargenButtonDefs[];
static const CreatePartyModButton _chargenModButtons[];
static const EobRect8 _chargenButtonBodyCoords[];
static const EobRect16 _chargenPortraitBoxFrames[];
static const int16 _chargenBoxX[];
static const int16 _chargenBoxY[];
static const int16 _chargenNameFieldX[];
@ -118,9 +113,8 @@ bool EobCoreEngine::startCharacterGeneration() {
}
CharacterGenerator::CharacterGenerator(EobCoreEngine *vm, Screen_Eob *screen) : _vm(vm), _screen(screen),
_characters(0), _faceShapes(0), _chargenMagicShapes(0), _chargenButtonLabels(0), _updateBoxIndex(-1),
_chargenBoxTimer(0), _chargenMagicShapeTimer(0), _updateBoxColorIndex(0), _updateBoxShapesIndex(0),
_lastUpdateBoxShapesIndex(0), _magicShapesBox(6), _activeBox(0) {
_characters(0), _faceShapes(0), _chargenMagicShapes(0), _chargenButtonLabels(0), _chargenMagicShapeTimer(0),
_updateBoxShapesIndex(0), _lastUpdateBoxShapesIndex(0), _magicShapesBox(6), _activeBox(0) {
_chargenStatStrings = _vm->_chargenStatStrings;
_chargenRaceSexStrings = _vm->_chargenRaceSexStrings;
@ -178,7 +172,7 @@ bool CharacterGenerator::start(EobCharacter *characters, uint8 ***faceShapes) {
_activeBox = 0;
for (bool loop = true; loop && (!_vm->shouldQuit()); ) {
highlightBoxFrame(_activeBox + 6);
_vm->_gui->highLightBoxFrame(_activeBox + 6);
_vm->sound()->process();
int inputFlag = _vm->checkInput(_vm->_activeButtons, false, 0);
_vm->removeInputTop();
@ -193,7 +187,7 @@ bool CharacterGenerator::start(EobCharacter *characters, uint8 ***faceShapes) {
_vm->sound()->haltTrack();
return false;
}
highlightBoxFrame(-1);
_vm->_gui->highLightBoxFrame(-1);
}
if (inputFlag & 0x8000) {
@ -207,7 +201,7 @@ bool CharacterGenerator::start(EobCharacter *characters, uint8 ***faceShapes) {
}
if (inputFlag == _vm->_keyMap[Common::KEYCODE_RETURN] || inputFlag == _vm->_keyMap[Common::KEYCODE_SPACE] || inputFlag == _vm->_keyMap[Common::KEYCODE_KP5]) {
highlightBoxFrame(-1);
_vm->_gui->highLightBoxFrame(-1);
if (_characters[_activeBox].name[0]) {
int b = _activeBox;
if (viewDeleteCharacter())
@ -381,50 +375,16 @@ void CharacterGenerator::processSpecialButton(int index) {
toggleSpecialButton(index, 0, 0);
}
void CharacterGenerator::highlightBoxFrame(int index) {
static const uint8 colorTable[] = { 0x0F, 0xB0, 0xB2, 0xB4, 0xB6,
0xB8, 0xBA, 0xBC, 0x0C, 0xBC, 0xBA, 0xB8, 0xB6, 0xB4, 0xB2, 0xB0, 0x00
};
if (_updateBoxIndex == index) {
if (_updateBoxIndex == -1)
return;
if (_vm->_system->getMillis() <= _chargenBoxTimer)
return;
if (!colorTable[_updateBoxColorIndex])
_updateBoxColorIndex = 0;
const EobRect16 *r = &_chargenPortraitBoxFrames[_updateBoxIndex];
_screen->drawBox(r->x1, r->y1, r->x2, r->y2, colorTable[_updateBoxColorIndex++]);
_screen->updateScreen();
_chargenBoxTimer = _vm->_system->getMillis() + _vm->_tickLength;
} else {
if (_updateBoxIndex != -1) {
const EobRect16 *r = &_chargenPortraitBoxFrames[_updateBoxIndex];
_screen->drawBox(r->x1, r->y1, r->x2, r->y2, 12);
_screen->updateScreen();
}
_updateBoxColorIndex = 0;
_updateBoxIndex = index;
_chargenBoxTimer = _vm->_system->getMillis();
}
}
int CharacterGenerator::viewDeleteCharacter() {
initButtonsFromList(0, 7);
_vm->removeInputTop();
highlightBoxFrame(-1);
_vm->_gui->highLightBoxFrame(-1);
printStats(_activeBox, 2);
int res = 0;
for (bool loop = true; loop && _characters[_activeBox].name[0] && !_vm->shouldQuit(); ) {
highlightBoxFrame(_activeBox + 6);
_vm->_gui->highLightBoxFrame(_activeBox + 6);
_vm->sound()->process();
int inputFlag = _vm->checkInput(_vm->_activeButtons, false, 0);
@ -463,14 +423,14 @@ int CharacterGenerator::viewDeleteCharacter() {
}
if (loop == false)
highlightBoxFrame(-1);
_vm->_gui->highLightBoxFrame(-1);
if (!_characters[cbx].name[0])
loop = false;
if (cbx != _activeBox) {
_activeBox = cbx;
highlightBoxFrame(-1);
_vm->_gui->highLightBoxFrame(-1);
if (loop)
printStats(_activeBox, 2);
}
@ -480,8 +440,8 @@ int CharacterGenerator::viewDeleteCharacter() {
}
void CharacterGenerator::createPartyMember() {
_screen->setScreenDim(2);
_chargenBoxTimer = 0;
_screen->setScreenDim(2);
assert(_vm->_gui);
for (int i = 0; i != 3 && !_vm->shouldQuit(); i++) {
bool bck = false;
@ -528,11 +488,11 @@ int CharacterGenerator::raceSexMenu() {
_screen->printShadedText(_chargenStrings2[8], 147, 67, 9, 0);
_vm->removeInputTop();
_vm->_gui->setupMenu(1, 0, _chargenRaceSexStrings, -1, 0, 0);
_vm->_gui->simpleMenu_setup(1, 0, _chargenRaceSexStrings, -1, 0, 0);
int16 res = -1;
while (res == -1 && !_vm->shouldQuit()) {
res = _vm->_gui->handleMenu(1, _chargenRaceSexStrings, 0, -1, 0);
res = _vm->_gui->simpleMenu_process(1, _chargenRaceSexStrings, 0, -1, 0);
updateMagicShapes();
}
@ -557,7 +517,7 @@ int CharacterGenerator::classMenu(int raceSex) {
toggleSpecialButton(5, 0, 0);
itemsMask &=_classMenuMasks[raceSex / 2];
_vm->_gui->setupMenu(2, 15, _chargenClassStrings, itemsMask, 0, 0);
_vm->_gui->simpleMenu_setup(2, 15, _chargenClassStrings, itemsMask, 0, 0);
_vm->_mouseX = _vm->_mouseY = 0;
int16 res = -1;
@ -576,7 +536,7 @@ int CharacterGenerator::classMenu(int raceSex) {
else
_vm->removeInputTop();
} else {
res = _vm->_gui->handleMenu(2, _chargenClassStrings, 0, itemsMask, 0);
res = _vm->_gui->simpleMenu_process(2, _chargenClassStrings, 0, itemsMask, 0);
}
}
@ -606,7 +566,7 @@ int CharacterGenerator::alignmentMenu(int cClass) {
toggleSpecialButton(5, 0, 0);
itemsMask &=_alignmentMenuMasks[cClass];
_vm->_gui->setupMenu(3, 9, _chargenAlignmentStrings, itemsMask, 0, 0);
_vm->_gui->simpleMenu_setup(3, 9, _chargenAlignmentStrings, itemsMask, 0, 0);
_vm->_mouseX = _vm->_mouseY = 0;
int16 res = -1;
@ -625,7 +585,7 @@ int CharacterGenerator::alignmentMenu(int cClass) {
else
_vm->removeInputTop();
} else {
res = _vm->_gui->handleMenu(3, _chargenAlignmentStrings, 0, itemsMask, 0);
res = _vm->_gui->simpleMenu_process(3, _chargenAlignmentStrings, 0, itemsMask, 0);
}
}
@ -793,8 +753,8 @@ void CharacterGenerator::statsAndFacesMenu() {
}
}
highlightBoxFrame(6 + _activeBox);
highlightBoxFrame(-1);
_vm->_gui->highLightBoxFrame(6 + _activeBox);
_vm->_gui->highLightBoxFrame(-1);
}
void CharacterGenerator::faceSelectMenu() {
@ -809,7 +769,7 @@ void CharacterGenerator::faceSelectMenu() {
printStats(_activeBox, 4);
toggleSpecialButton(12, 0, 0);
toggleSpecialButton(13, 0, 0);
highlightBoxFrame(-1);
_vm->_gui->highLightBoxFrame(-1);
shp = getNextFreeFaceShape(shp, charSex, 1, _chargenSelectedPortraits);
@ -833,7 +793,7 @@ void CharacterGenerator::faceSelectMenu() {
in = _vm->checkInput(_vm->_activeButtons, false, 0);
_vm->removeInputTop();
highlightBoxFrame(box + 10);
_vm->_gui->highLightBoxFrame(box + 10);
if (in == 0x8002 || in == _vm->_keyMap[Common::KEYCODE_RIGHT]) {
processSpecialButton(13);
@ -853,7 +813,7 @@ void CharacterGenerator::faceSelectMenu() {
}
}
highlightBoxFrame(-1);
_vm->_gui->highLightBoxFrame(-1);
if (in == 1)
shp = getNextFreeFaceShape(shp - 1, charSex, -1, _chargenSelectedPortraits);
@ -864,7 +824,7 @@ void CharacterGenerator::faceSelectMenu() {
}
if (!_vm->shouldQuit()) {
highlightBoxFrame(-1);
_vm->_gui->highLightBoxFrame(-1);
updateMagicShapes();
_chargenSelectedPortraits[_activeBox] = sp[res];
@ -899,7 +859,7 @@ int CharacterGenerator::getNextFreeFaceShape(int shpIndex, int charSex, int step
}
void CharacterGenerator::processFaceMenuSelection(int index) {
highlightBoxFrame(-1);
_vm->_gui->highLightBoxFrame(-1);
if (index <= 48)
_screen->drawShape(0, _characters[_activeBox].faceShape, _chargenBoxX[_activeBox], _chargenBoxY[_activeBox] + 1, 0);
else
@ -1127,15 +1087,15 @@ int CharacterGenerator::getMaxHp(int cclass, int constitution, int level1, int l
int res = 0;
constitution = _vm->getClassAndConstHitpointsModifier(cclass, constitution);
int m = _vm->getClassHpIncreaseType(cclass, 0);
int m = _vm->getCharacterClassType(cclass, 0);
if (m != -1)
res = _vm->getModifiedHpLimits(m, constitution, level1, false);
m = _vm->getClassHpIncreaseType(cclass, 1);
m = _vm->getCharacterClassType(cclass, 1);
if (m != -1)
res += _vm->getModifiedHpLimits(m, constitution, level2, false);
m = _vm->getClassHpIncreaseType(cclass, 2);
m = _vm->getCharacterClassType(cclass, 2);
if (m != -1)
res += _vm->getModifiedHpLimits(m, constitution, level3, false);
@ -1148,15 +1108,15 @@ int CharacterGenerator::getMinHp(int cclass, int constitution, int level1, int l
int res = 0;
constitution = _vm->getClassAndConstHitpointsModifier(cclass, constitution);
int m = _vm->getClassHpIncreaseType(cclass, 0);
int m = _vm->getCharacterClassType(cclass, 0);
if (m != -1)
res = _vm->getModifiedHpLimits(m, constitution, level1, true);
m = _vm->getClassHpIncreaseType(cclass, 1);
m = _vm->getCharacterClassType(cclass, 1);
if (m != -1)
res += _vm->getModifiedHpLimits(m, constitution, level2, true);
m = _vm->getClassHpIncreaseType(cclass, 2);
m = _vm->getCharacterClassType(cclass, 2);
if (m != -1)
res += _vm->getModifiedHpLimits(m, constitution, level3, true);
@ -1443,7 +1403,7 @@ const EobRect8 CharacterGenerator::_chargenButtonBodyCoords[] = {
{ 0x14, 0x90, 0x0B, 0x10 }
};
const EobRect16 CharacterGenerator::_chargenPortraitBoxFrames[] = {
const EobRect16 GUI_Eob::_highLightBoxFrames[] = {
{ 0x00B7, 0x0001, 0x00F7, 0x0034 },
{ 0x00FF, 0x0001, 0x013F, 0x0034 },
{ 0x00B7, 0x0035, 0x00F7, 0x0068 },

View File

@ -48,6 +48,7 @@ EobCoreEngine::EobCoreEngine(OSystem *system, const GameFlags &flags) : LolEobBa
_saveLoadMode = 0;
_updateHandItemCursor = false;
_configMouse = true;
_resting = false;
_largeItemShapes = _smallItemShapes = _thrownItemShapes = _spellShapes = _firebeamShapes = _itemIconShapes =
_wallOfForceShapes = _teleporterShapes = _sparkShapes = _compassShapes = 0;
@ -257,6 +258,8 @@ Common::Error EobCoreEngine::init() {
_screen->loadFont(Screen::FID_6_FNT, "FONT6.FNT");
_screen->loadFont(Screen::FID_8_FNT, "FONT8.FNT");
readSettings();
Common::Error err = LolEobBaseEngine::init();
if (err.getCode() != Common::kNoError)
return err;
@ -365,7 +368,7 @@ Common::Error EobCoreEngine::go() {
} else if (action == -2) {
// new game
repeatLoop = startCharacterGeneration();
if (repeatLoop)
if (repeatLoop && !shouldQuit())
startupNew();
} else if (action == -3) {
// transfer party
@ -382,6 +385,34 @@ Common::Error EobCoreEngine::go() {
return Common::kNoError;
}
void EobCoreEngine::registerDefaultSettings() {
KyraEngine_v1::registerDefaultSettings();
ConfMan.registerDefault("hpbargraphs", true);
}
void EobCoreEngine::readSettings() {
_configHpBarGraphs = ConfMan.getBool("hpbargraphs");
_configSounds = ConfMan.getBool("sfx_mute") ? 0 : 1;
_configMusic = _configSounds ? 1 : 0;
if (_sound)
_sound->enableSFX(_configSounds);
}
void EobCoreEngine::writeSettings() {
ConfMan.setBool("hpbargraphs", _configHpBarGraphs);
ConfMan.setBool("sfx_mute", _configSounds == 0);
if (_sound) {
if (!_configSounds)
_sound->beginFadeOut();
_sound->enableMusic(_configSounds ? 1 : 0);
_sound->enableSFX(_configSounds);
}
ConfMan.flushToDisk();
}
void EobCoreEngine::startupNew() {
gui_setPlayFieldButtons();
_screen->_curPage = 0;
@ -659,7 +690,7 @@ int EobCoreEngine::generateCharacterHitpointsByLevel(int charIndex, int levelInd
if (!(levelIndex & (1 << i)))
continue;
int d = getClassHpIncreaseType(c->cClass, i);
int d = getCharacterClassType(c->cClass, i);
if (c->level[i] <= _hpIncrPerLevel[6 + i])
h += rollDice(1, (d >= 0) ? _hpIncrPerLevel[d] : 0);
@ -686,8 +717,8 @@ int EobCoreEngine::getClassAndConstHitpointsModifier(int cclass, int constitutio
return 2;
}
int EobCoreEngine::getClassHpIncreaseType(int cclass, int levelIndex) {
return _classHpIncreaseType[cclass * 3 + levelIndex];
int EobCoreEngine::getCharacterClassType(int cclass, int levelIndex) {
return _characterClassType[cclass * 3 + levelIndex];
}
int EobCoreEngine::getModifiedHpLimits(int hpModifier, int constModifier, int level, bool mode) {
@ -867,11 +898,11 @@ int EobCoreEngine::getCharacterClericPaladinLevel(int index) {
if (index == -1)
return (_currentLevel < 7) ? 5 : 9;
int l = getLevelIndexForHpIncType(2, _characters[index].cClass);
int l = getCharacterLevelIndex(2, _characters[index].cClass);
if (l > -1)
return _characters[index].level[l];
l = getLevelIndexForHpIncType(4, _characters[index].cClass);
l = getCharacterLevelIndex(4, _characters[index].cClass);
if (l > -1) {
if (_characters[index].level[l] > 8)
return _characters[index].level[l] - 8;
@ -887,18 +918,18 @@ int EobCoreEngine::getCharacterMageLevel(int index) {
if (index == -1)
return (_currentLevel < 7) ? 5 : 9;
int l = getLevelIndexForHpIncType(1, _characters[index].cClass);
int l = getCharacterLevelIndex(1, _characters[index].cClass);
return (l > -1) ? _characters[index].level[l] : 1;
}
int EobCoreEngine::getLevelIndexForHpIncType(int hpIncType, int cClass) {
if (getClassHpIncreaseType(cClass, 0) == hpIncType)
int EobCoreEngine::getCharacterLevelIndex(int type, int cClass) {
if (getCharacterClassType(cClass, 0) == type)
return 0;
if (getClassHpIncreaseType(cClass, 1) == hpIncType)
if (getCharacterClassType(cClass, 1) == type)
return 1;
if (getClassHpIncreaseType(cClass, 2) == hpIncType)
if (getCharacterClassType(cClass, 2) == type)
return 2;
return -1;
@ -1020,6 +1051,20 @@ int EobCoreEngine::prepareForNewPartyMember(int16 itemType, int16 itemValue) {
return 1;
}
void EobCoreEngine::dropCharacter(int charIndex) {
if (!testCharacter(charIndex, 1))
return;
removeCharacterFromParty(charIndex);
if (charIndex < 5)
exchangeCharacters(charIndex, testCharacter(5, 1) ? 5 : 4);
gui_processCharPortraitClick(0);
gui_setPlayFieldButtons();
setupCharacterTimers();
}
void EobCoreEngine::removeCharacterFromParty(int charIndex) {
EobCharacter *c = &_characters[charIndex];
c->flags = 0;
@ -1043,6 +1088,13 @@ void EobCoreEngine::removeCharacterFromParty(int charIndex) {
setupCharacterTimers();
}
void EobCoreEngine::exchangeCharacters(int charIndex1, int charIndex2) {
EobCharacter temp;
memcpy(&temp, &_characters[charIndex1], sizeof(EobCharacter));
memcpy(&_characters[charIndex1], &_characters[charIndex2], sizeof(EobCharacter));
memcpy(&_characters[charIndex2], &temp, sizeof(EobCharacter));
}
void EobCoreEngine::increasePartyExperience(int16 points) {
int cnt = 0;
for (int i = 0; i < 6; i++) {
@ -1067,7 +1119,7 @@ void EobCoreEngine::increaseCharacterExperience(int charIndex, int32 points) {
points /= _numLevelsPerClass[cl];
for (int i = 0; i < 3; i++) {
if (getClassHpIncreaseType(cl, i) == -1)
if (getCharacterClassType(cl, i) == -1)
continue;
_characters[charIndex].experience[i] += points;
@ -1081,7 +1133,7 @@ void EobCoreEngine::increaseCharacterExperience(int charIndex, int32 points) {
}
uint32 EobCoreEngine::getRequiredExperience(int cClass, int levelIndex, int level) {
cClass = getClassHpIncreaseType(cClass, levelIndex);
cClass = getCharacterClassType(cClass, levelIndex);
if (cClass == -1)
return 0xffffffff;
@ -1275,6 +1327,28 @@ void EobCoreEngine::displayParchment(int id) {
restoreAfterDialogueSequence();
}
bool EobCoreEngine::restParty() {
if (_inf->preventRest()) {
assert(_menuStringsRest3[0]);
displayRestWarning(_menuStringsRest3[0]);
return true;
}
return true;
}
void EobCoreEngine::displayRestWarning(const char *str) {
int od = _screen->curDimIndex();
_screen->setScreenDim(7);
Screen::FontId of = _screen->setFont(Screen::FID_6_FNT);
_screen->setCurPage(0);
_txt->printMessage(Common::String::format("\r%s\r", str).c_str());
_screen->setFont(of);
_screen->setScreenDim(od);
}
void EobCoreEngine::useSlotWeapon(int charIndex, int slotIndex, int item) {
EobCharacter *c = &_characters[charIndex];
int tp = item ? _items[item].type : 0;

View File

@ -55,13 +55,6 @@ struct EobRect8 {
uint8 h;
};
struct EobRect16 {
int16 x1;
int16 y1;
uint16 x2;
uint16 y2;
};
struct EobChargenButtonDef {
uint8 x;
uint8 y;
@ -258,7 +251,7 @@ public:
virtual ~EobCoreEngine();
Screen *screen() { return _screen; }
GUI *gui() const { return _gui; }
GUI_v1 *gui() const { return _gui; }
protected:
// Startup
@ -270,14 +263,18 @@ protected:
virtual void seq_playFinale() = 0;
bool _playFinale;
//Init
//Init, config
void loadItemsAndDecorationsShapes();
void releaseItemsAndDecorationsShapes();
void initButtonData();
void initMenus();
void initStaticResource();
virtual void initSpells();
virtual void initSpells();
void registerDefaultSettings();
void readSettings();
void writeSettings();
const uint8 **_largeItemShapes;
const uint8 **_smallItemShapes;
@ -324,7 +321,7 @@ protected:
uint8 **_faceShapes;
static const int8 _classHpIncreaseType[];
static const int8 _characterClassType[];
static const uint8 _hpIncrPerLevel[];
static const uint8 _numLevelsPerClass[];
static const int16 _hpConstModifiers[];
@ -361,7 +358,7 @@ protected:
int getDexterityArmorClassModifier(int dexterity);
int generateCharacterHitpointsByLevel(int charIndex, int levelIndex);
int getClassAndConstHitpointsModifier(int cclass, int constitution);
int getClassHpIncreaseType(int cclass, int levelIndex);
int getCharacterClassType(int cclass, int levelIndex);
int getModifiedHpLimits(int hpModifier, int constModifier, int level, bool mode);
Common::String getCharStrength(int str, int strExt);
int testCharacter(int index, int flags);
@ -371,7 +368,7 @@ protected:
int validateWeaponSlotItem(int index, int slot);
int getCharacterClericPaladinLevel(int index);
int getCharacterMageLevel(int index);
int getLevelIndexForHpIncType(int unk, int cClass);
int getCharacterLevelIndex(int type, int cClass);
int countCharactersWithSpecificItems(int16 itemType, int16 itemValue);
int checkCharacterInventoryForItem(int character, int16 itemType, int16 itemValue);
@ -382,7 +379,9 @@ protected:
void initNpc(int npcIndex);
int npcJoinDialogue(int npcIndex, int queryJoinTextId, int confirmJoinTextId, int noJoinTextId);
int prepareForNewPartyMember(int16 itemType, int16 itemValue);
void dropCharacter(int charIndex);
void removeCharacterFromParty(int charIndex);
void exchangeCharacters(int charIndex1, int charIndex2);
void increasePartyExperience(int16 points);
void increaseCharacterExperience(int charIndex, int32 points);
@ -773,6 +772,9 @@ protected:
void delay(uint32 millis, bool doUpdate = false, bool isMainLoop = false);
void displayParchment(int id);
bool restParty();
void displayRestWarning(const char *str);
virtual void drawLightningColumn() {}
virtual int resurrectionSelectDialogue() { return -1; }
virtual int charSelectDialogue() { return -1; }
@ -786,6 +788,7 @@ protected:
void releaseMonsterTempData(LevelTempData *tmp);
int _saveLoadMode;
bool _resting;
Screen_Eob *_screen;
GUI_Eob *_gui;
@ -996,6 +999,8 @@ protected:
const char *const *_menuStringsMgc;
const char *const *_menuStringsPrefs;
const char *const *_menuStringsRest2;
const char *const *_menuStringsRest3;
const char *const *_menuStringsRest4;
const char *const *_menuStringsDefeat;
const char *const *_menuStringsTransfer;

View File

@ -30,15 +30,15 @@
namespace Kyra {
GUI::GUI(KyraEngine_v1 *kyra)
GUI_v1::GUI_v1(KyraEngine_v1 *kyra)
: _vm(kyra), _screen(kyra->screen()), _text(kyra->text()) {
_menuButtonList = 0;
_redrawButtonFunctor = BUTTON_FUNCTOR(GUI, this, &GUI::redrawButtonCallback);
_redrawShadedButtonFunctor = BUTTON_FUNCTOR(GUI, this, &GUI::redrawShadedButtonCallback);
_redrawButtonFunctor = BUTTON_FUNCTOR(GUI_v1, this, &GUI_v1::redrawButtonCallback);
_redrawShadedButtonFunctor = BUTTON_FUNCTOR(GUI_v1, this, &GUI_v1::redrawShadedButtonCallback);
}
Button *GUI::addButtonToList(Button *list, Button *newButton) {
Button *GUI_v1::addButtonToList(Button *list, Button *newButton) {
if (!newButton)
return list;
@ -56,7 +56,7 @@ Button *GUI::addButtonToList(Button *list, Button *newButton) {
return list;
}
void GUI::initMenuLayout(Menu &menu) {
void GUI_v1::initMenuLayout(Menu &menu) {
if (menu.x == -1)
menu.x = (320 - menu.width) >> 1;
if (menu.y == -1)
@ -68,7 +68,7 @@ void GUI::initMenuLayout(Menu &menu) {
}
}
void GUI::initMenu(Menu &menu) {
void GUI_v1::initMenu(Menu &menu) {
_menuButtonList = 0;
_screen->hideMouse();
@ -197,7 +197,7 @@ void GUI::initMenu(Menu &menu) {
_screen->updateScreen();
}
void GUI::processHighlights(Menu &menu) {
void GUI_v1::processHighlights(Menu &menu) {
int x1, y1, x2, y2;
Common::Point p = _vm->getMousePos();
int mouseX = p.x;
@ -242,7 +242,7 @@ void GUI::processHighlights(Menu &menu) {
_screen->updateScreen();
}
void GUI::redrawText(const Menu &menu) {
void GUI_v1::redrawText(const Menu &menu) {
int textX;
int i = menu.highlightedItem;
@ -271,7 +271,7 @@ void GUI::redrawText(const Menu &menu) {
}
}
void GUI::redrawHighlight(const Menu &menu) {
void GUI_v1::redrawHighlight(const Menu &menu) {
int textX;
int i = menu.highlightedItem;
@ -301,12 +301,12 @@ void GUI::redrawHighlight(const Menu &menu) {
}
}
void GUI::updateAllMenuButtons() {
void GUI_v1::updateAllMenuButtons() {
for (Button *cur = _menuButtonList; cur; cur = cur->nextButton)
updateMenuButton(cur);
}
void GUI::updateMenuButton(Button *button) {
void GUI_v1::updateMenuButton(Button *button) {
if (!_displayMenu)
return;
@ -316,7 +316,7 @@ void GUI::updateMenuButton(Button *button) {
_screen->showMouse();
}
void GUI::updateButton(Button *button) {
void GUI_v1::updateButton(Button *button) {
if (!button || (button->flags & 8))
return;
@ -337,7 +337,7 @@ void GUI::updateButton(Button *button) {
processButton(button);
}
int GUI::redrawButtonCallback(Button *button) {
int GUI_v1::redrawButtonCallback(Button *button) {
if (!_displayMenu)
return 0;
@ -351,7 +351,7 @@ int GUI::redrawButtonCallback(Button *button) {
return 0;
}
int GUI::redrawShadedButtonCallback(Button *button) {
int GUI_v1::redrawShadedButtonCallback(Button *button) {
if (!_displayMenu)
return 0;
@ -365,7 +365,7 @@ int GUI::redrawShadedButtonCallback(Button *button) {
return 0;
}
void GUI::updateSaveList(bool excludeQuickSaves) {
void GUI_v1::updateSaveList(bool excludeQuickSaves) {
Common::String pattern = _vm->_targetName + ".???";
Common::StringArray saveFileList = _vm->_saveFileMan->listSavefiles(pattern);
_saveSlots.clear();
@ -391,13 +391,13 @@ void GUI::updateSaveList(bool excludeQuickSaves) {
sortSaveSlots();
}
void GUI::sortSaveSlots() {
void GUI_v1::sortSaveSlots() {
Common::sort(_saveSlots.begin(), _saveSlots.end(), Common::Less<int>());
if (_saveSlots.size() > 2)
Common::sort(_saveSlots.begin()+1, _saveSlots.end(), Common::Greater<int>());
}
int GUI::getNextSavegameSlot() {
int GUI_v1::getNextSavegameSlot() {
Common::InSaveFile *in;
int start = _vm->game() == GI_LOL ? 0 : 1;
@ -412,7 +412,7 @@ int GUI::getNextSavegameSlot() {
return 0;
}
void GUI::checkTextfieldInput() {
void GUI_v1::checkTextfieldInput() {
Common::Event event;
uint32 now = _vm->_system->getMillis();
@ -461,11 +461,11 @@ void GUI::checkTextfieldInput() {
_vm->_system->delayMillis(3);
}
void GUI::printMenuText(const char *str, int x, int y, uint8 c0, uint8 c1, uint8 c2) {
void GUI_v1::printMenuText(const char *str, int x, int y, uint8 c0, uint8 c1, uint8 c2) {
_text->printText(str, x, y, c0, c1, c2);
}
int GUI::getMenuCenterStringX(const char *str, int x1, int x2) {
int GUI_v1::getMenuCenterStringX(const char *str, int x1, int x2) {
return _text->getCenterStringX(str, x1, x2);
}

View File

@ -146,10 +146,10 @@ struct Menu {
class Screen;
class TextDisplayer;
class GUI {
class GUI_v1 {
public:
GUI(KyraEngine_v1 *vm);
virtual ~GUI() {}
GUI_v1(KyraEngine_v1 *vm);
virtual ~GUI_v1() {}
// button specific
virtual Button *addButtonToList(Button *list, Button *newButton);

View File

@ -151,7 +151,7 @@ void EobCoreEngine::gui_drawPlayField(int pageNum) {
int cp = _screen->setCurPage(2);
gui_drawCompass(true);
if (pageNum && !_sceneDrawPage1)
if (pageNum && !_sceneDrawPage2)
drawScene(0);
_screen->setCurPage(cp);
@ -280,7 +280,7 @@ void EobCoreEngine::gui_drawCharPortraitWithStats(int index) {
_screen->printText(Common::String::format("%d", c->armorClass).c_str(), 275, 124, 15, _color6);
for (int i = 0; i < 3; i++) {
int t = getClassHpIncreaseType(c->cClass, i);
int t = getCharacterClassType(c->cClass, i);
if (t == -1)
continue;
@ -862,8 +862,8 @@ int EobCoreEngine::clickedCamp(Button *button) {
const ScreenDim *dm = _screen->getScreenDim(10);
_screen->copyRegion(dm->sx << 3, dm->sy, dm->sx << 3, dm->sy, dm->w << 3, dm->h, 2, 0, Screen::CR_NO_P_CHECK);
//if (displayInv)
// _screen->loadEobCpsFileToPage("INVENT", 0, 5, 3, 2);
/*if (reloadInv)
_screen->loadEobCpsFileToPage("INVENT", 0, 5, 3, 2);*/
_screen->updateScreen();
@ -948,11 +948,7 @@ int EobCoreEngine::clickedCharNameLabelRight(Button *button) {
} else {
int d = _exchangeCharacterId;
_exchangeCharacterId = -1;
EobCharacter temp;
memcpy(&temp, &_characters[d], sizeof(EobCharacter));
memcpy(&_characters[d], &_characters[button->arg], sizeof(EobCharacter));
memcpy(&_characters[button->arg], &temp, sizeof(EobCharacter));
exchangeCharacters(d, button->arg);
_timer->disable(0);
gui_drawCharPortraitWithStats(d);
@ -1432,11 +1428,11 @@ void EobCoreEngine::gui_processInventorySlotClick(int slot) {
}
}
GUI_Eob::GUI_Eob(EobCoreEngine *vm) : GUI(vm), _vm(vm), _screen(vm->_screen) {
GUI_Eob::GUI_Eob(EobCoreEngine *vm) : GUI_v1(vm), _vm(vm), _screen(vm->_screen) {
_scrollUpFunctor = _scrollDownFunctor = BUTTON_FUNCTOR(GUI_Eob, this, 0);
_redrawButtonFunctor = BUTTON_FUNCTOR(GUI, this, &GUI::redrawButtonCallback);
_redrawShadedButtonFunctor = BUTTON_FUNCTOR(GUI, this, &GUI::redrawShadedButtonCallback);
_redrawButtonFunctor = BUTTON_FUNCTOR(GUI_v1, this, &GUI_v1::redrawButtonCallback);
_redrawShadedButtonFunctor = BUTTON_FUNCTOR(GUI_v1, this, &GUI_v1::redrawShadedButtonCallback);
_menuStringsPrefsTemp = new char*[4];
memset(_menuStringsPrefsTemp, 0, 4 * sizeof(char*));
@ -1453,7 +1449,12 @@ GUI_Eob::GUI_Eob(EobCoreEngine *vm) : GUI(vm), _vm(vm), _screen(vm->_screen) {
_menuLastInFlags = 0;
_menuCur = 0;
_menuNumItems = 0;
_menuButtons = 0;
_charSelectRedraw = false;
_updateBoxIndex = -1;
_highLightBoxTimer = 0;
_updateBoxColorIndex = 0;
}
GUI_Eob::~GUI_Eob() {
@ -1950,17 +1951,17 @@ int GUI_Eob::processButtonList(Kyra::Button *buttonList, uint16 inputFlags, int8
return result;
}
void GUI_Eob::setupMenu(int sd, int maxItem, const char *const *strings, int32 menuItemsMask, int unk, int lineSpacing) {
initMenuItemsMask(sd, maxItem, menuItemsMask, unk);
void GUI_Eob::simpleMenu_setup(int sd, int maxItem, const char *const *strings, int32 menuItemsMask, int unk, int lineSpacing) {
simpleMenu_initMenuItemsMask(sd, maxItem, menuItemsMask, unk);
const ScreenDim *dm = _screen->getScreenDim(19 + sd);
int x = (_screen->_curDim->sx + dm->sx) << 3;
int y = _screen->_curDim->sy + dm->sy;
int v = getMenuItem(_menuCur, menuItemsMask, unk);
int v = simpleMenu_getMenuItem(_menuCur, menuItemsMask, unk);
for (int i = 0; i < _menuNumItems; i++) {
int item = getMenuItem(i, menuItemsMask, unk);
int item = simpleMenu_getMenuItem(i, menuItemsMask, unk);
int ty = y + i * (lineSpacing + _screen->getFontHeight());
_screen->printShadedText(strings[item], x, ty, dm->unkA, 0);
if (item == v)
@ -1974,7 +1975,7 @@ void GUI_Eob::setupMenu(int sd, int maxItem, const char *const *strings, int32 m
_vm->removeInputTop();
}
int GUI_Eob::handleMenu(int sd, const char *const *strings, void *b, int32 menuItemsMask, int unk) {
int GUI_Eob::simpleMenu_process(int sd, const char *const *strings, void *b, int32 menuItemsMask, int unk) {
const ScreenDim *dm = _screen->getScreenDim(19 + sd);
int h = _menuNumItems - 1;
int currentItem = _menuCur % _menuNumItems;
@ -2016,14 +2017,14 @@ int GUI_Eob::handleMenu(int sd, const char *const *strings, void *b, int32 menuI
}
if (newItem != currentItem) {
_screen->printText(strings[getMenuItem(currentItem, menuItemsMask, unk)], x, y + currentItem * lineH , dm->unkA, 0);
_screen->printText(strings[getMenuItem(newItem, menuItemsMask, unk)], x, y + newItem * lineH , dm->unkC, 0);
_screen->printText(strings[simpleMenu_getMenuItem(currentItem, menuItemsMask, unk)], x, y + currentItem * lineH , dm->unkA, 0);
_screen->printText(strings[simpleMenu_getMenuItem(newItem, menuItemsMask, unk)], x, y + newItem * lineH , dm->unkC, 0);
_screen->updateScreen();
}
if (result != -1) {
result = getMenuItem(result, menuItemsMask, unk);
menuFlashSelection(strings[result], x, y + newItem * lineH, dm->unkA, dm->unkC, 0);
result = simpleMenu_getMenuItem(result, menuItemsMask, unk);
simpleMenu_flashSelection(strings[result], x, y + newItem * lineH, dm->unkA, dm->unkC, 0);
}
_menuCur = newItem;
@ -2031,7 +2032,7 @@ int GUI_Eob::handleMenu(int sd, const char *const *strings, void *b, int32 menuI
return result;
}
int GUI_Eob::getMenuItem(int index, int32 menuItemsMask, int unk) {
int GUI_Eob::simpleMenu_getMenuItem(int index, int32 menuItemsMask, int unk) {
if (menuItemsMask == -1)
return index;
@ -2049,7 +2050,7 @@ int GUI_Eob::getMenuItem(int index, int32 menuItemsMask, int unk) {
return res;
}
void GUI_Eob::menuFlashSelection(const char *str, int x, int y, int color1, int color2, int color3) {
void GUI_Eob::simpleMenu_flashSelection(const char *str, int x, int y, int color1, int color2, int color3) {
for (int i = 0; i < 3; i++) {
_screen->printText(str, x, y, color2, color3);
_screen->updateScreen();
@ -2060,7 +2061,7 @@ void GUI_Eob::menuFlashSelection(const char *str, int x, int y, int color1, int
}
}
int GUI_Eob::runCampMenu() {
void GUI_Eob::runCampMenu() {
Screen::FontId of = _screen->setFont(Screen::FID_8_FNT);
Button *highlightButton = 0;
@ -2068,17 +2069,18 @@ int GUI_Eob::runCampMenu() {
int newMenu = 0;
int lastMenu = -1;
int e = 0;
int menuG = 0;
int menuH = 0;
_menuButtons = 0;
bool redrawPortraits = false;
bool res = false;
_charSelectRedraw = false;
_vm->_resting = false;
Button *buttonList = 0;
for (bool runLoop = true; runLoop && !_vm->shouldQuit(); ) {
if (newMenu == 2)
updateOptionsStrings();
if (newMenu != -1) {
releaseButtons(_menuButtons);
releaseButtons(buttonList);
_vm->_menuDefs[0].titleStrId = newMenu ? 1 : 56;
if (newMenu == 2)
@ -2086,10 +2088,10 @@ int GUI_Eob::runCampMenu() {
else if (newMenu == 1)
_vm->_menuDefs[1].titleStrId = 58;
_menuButtons = initMenu(newMenu);
buttonList = initMenu(newMenu);
if (newMenu != lastMenu) {
highlightButton = _menuButtons;
highlightButton = buttonList;
prevHighlightButton = 0;
}
@ -2097,7 +2099,7 @@ int GUI_Eob::runCampMenu() {
newMenu = -1;
}
int inputFlag = _vm->checkInput(_menuButtons, false, 0) & 0x80ff;
int inputFlag = _vm->checkInput(buttonList, false, 0) & 0x80ff;
_vm->removeInputTop();
if (inputFlag == _vm->_keyMap[Common::KEYCODE_ESCAPE])
@ -2106,7 +2108,7 @@ int GUI_Eob::runCampMenu() {
inputFlag = 0x8000 + prevHighlightButton->index;
}
Button *clickedButton = _vm->gui_getButton(_menuButtons, inputFlag & 0x7fff);
Button *clickedButton = _vm->gui_getButton(buttonList, inputFlag & 0x7fff);
if (clickedButton) {
drawMenuButton(prevHighlightButton, false, false, true);
@ -2120,10 +2122,10 @@ int GUI_Eob::runCampMenu() {
}
if (inputFlag == _vm->_keyMap[Common::KEYCODE_KP3] || inputFlag == _vm->_keyMap[Common::KEYCODE_PAGEDOWN] || inputFlag == _vm->_keyMap[Common::KEYCODE_KP1] || inputFlag == _vm->_keyMap[Common::KEYCODE_END]) {
highlightButton = _vm->gui_getButton(_menuButtons, _vm->_menuDefs[lastMenu].firstButtonStrId + _vm->_menuDefs[lastMenu].numButtons);
highlightButton = _vm->gui_getButton(buttonList, _vm->_menuDefs[lastMenu].firstButtonStrId + _vm->_menuDefs[lastMenu].numButtons);
inputFlag = _vm->_keyMap[Common::KEYCODE_UP];
} else if (inputFlag == _vm->_keyMap[Common::KEYCODE_KP7] || inputFlag == _vm->_keyMap[Common::KEYCODE_HOME] || inputFlag == _vm->_keyMap[Common::KEYCODE_KP9] || inputFlag == _vm->_keyMap[Common::KEYCODE_PAGEUP]) {
highlightButton = _vm->gui_getButton(_menuButtons, _vm->_menuDefs[lastMenu].firstButtonStrId + 1);
highlightButton = _vm->gui_getButton(buttonList, _vm->_menuDefs[lastMenu].firstButtonStrId + 1);
} else if (inputFlag == _vm->_keyMap[Common::KEYCODE_KP8] || inputFlag == _vm->_keyMap[Common::KEYCODE_UP] || inputFlag == _vm->_keyMap[Common::KEYCODE_KP2] || inputFlag == _vm->_keyMap[Common::KEYCODE_DOWN]) {
if (prevHighlightButton) {
int dir = (inputFlag == _vm->_keyMap[Common::KEYCODE_UP]) ? -1 : 1;
@ -2141,29 +2143,50 @@ int GUI_Eob::runCampMenu() {
s += dir;
} while(!_vm->shouldQuit());
highlightButton = _vm->gui_getButton(_menuButtons, s);
highlightButton = _vm->gui_getButton(buttonList, s);
}
} else if (inputFlag > 0x8001 && inputFlag < 0x8010) {
} else if (inputFlag > 0x8000 && inputFlag < 0x8010) {
int i = 0;
int cnt = 0;
switch (inputFlag) {
case 0x8001:
if (_vm->restParty())
runLoop = false;
else
_vm->_resting = false;
redrawPortraits = true;
break;
case 0x8002:
runMemorizePrayMenu(selectCharacterDialogue(23), 0);
newMenu = 0;
break;
case 0x8003:
runMemorizePrayMenu(selectCharacterDialogue(26), 1);
newMenu = 0;
break;
case 0x8004:
scribeScrollDialogue();
newMenu = 0;
break;
case 0x8005:
newMenu = 2;
break;
case 0x8006:
newMenu = 1;
break;
case 0x8007:
if (menuH)
if (_vm->_resting)
displayTextBox(44);
// fall through
case 0x800c:
case 0x800f:
if (lastMenu == 1 || lastMenu == 2)
@ -2173,38 +2196,74 @@ int GUI_Eob::runCampMenu() {
else
runLoop = false;
break;
case 0x8008:
// load
break;
case 0x8009:
// save
break;
case 0x800a:
for (; i < 6; i++) {
if (_vm->testCharacter(i, 1))
cnt++;
}
if (cnt > 4) {
_vm->dropCharacter(selectCharacterDialogue(53));
_vm->gui_drawPlayField(0);
res = true;
_screen->copyRegion(0, 120, 0, 0, 176, 24, 0, 14, Screen::CR_NO_P_CHECK);
_screen->setFont(Screen::FID_6_FNT);
_vm->gui_drawAllCharPortraitsWithStats();
_screen->setFont(Screen::FID_8_FNT);
} else {
displayTextBox(45);
}
newMenu = 0;
break;
case 0x800b:
if (confirmDialogue(46))
_vm->quitGame();
newMenu = 0;
break;
case 0x800d:
_vm->_configSounds ^= true;
_vm->_configMusic = _vm->_configSounds ? 1 : 0;
newMenu = 2;
break;
case 0x800e:
_vm->_configHpBarGraphs ^= true;
newMenu = 2;
redrawPortraits = true;
break;
default:
break;
}
} else {
Common::Point p = _vm->getMousePos();
for (Button *b = _menuButtons; b; b = b->nextButton) {
for (Button *b = buttonList; b; b = b->nextButton) {
if ((b->arg & 2) && _vm->posWithinRect(p.x, p.y, b->x, b->y, b->x + b->width, b->y + b->height))
highlightButton = b;
}
}
if (menuG || e) {
if (_charSelectRedraw || redrawPortraits) {
for (int i = 0; i < 6; i++) {
_vm->gui_drawCharPortraitWithStats(i);
_vm->cleanupCharacterSpellList(i);
}
}
menuG = e = 0;
_charSelectRedraw = redrawPortraits = false;
if (prevHighlightButton != highlightButton && newMenu == -1 && runLoop) {
drawMenuButton(prevHighlightButton, false, false, true);
@ -2214,18 +2273,51 @@ int GUI_Eob::runCampMenu() {
}
}
releaseButtons(_menuButtons);
_menuButtons = 0;
releaseButtons(buttonList);
_vm->writeSettings();
_screen->setFont(of);
return 0;
}
int GUI_Eob::runLoadMenu(int x, int y) {
return 0;
}
void GUI_Eob::highLightBoxFrame(int box) {
static const uint8 colorTable[] = { 0x0F, 0xB0, 0xB2, 0xB4, 0xB6,
0xB8, 0xBA, 0xBC, 0x0C, 0xBC, 0xBA, 0xB8, 0xB6, 0xB4, 0xB2, 0xB0, 0x00
};
if (_updateBoxIndex == box) {
if (_updateBoxIndex == -1)
return;
if (_vm->_system->getMillis() <= _highLightBoxTimer)
return;
if (!colorTable[_updateBoxColorIndex])
_updateBoxColorIndex = 0;
const EobRect16 *r = &_highLightBoxFrames[_updateBoxIndex];
_screen->drawBox(r->x1, r->y1, r->x2, r->y2, colorTable[_updateBoxColorIndex++]);
_screen->updateScreen();
_highLightBoxTimer = _vm->_system->getMillis() + _vm->_tickLength;
} else {
if (_updateBoxIndex != -1) {
const EobRect16 *r = &_highLightBoxFrames[_updateBoxIndex];
_screen->drawBox(r->x1, r->y1, r->x2, r->y2, 12);
_screen->updateScreen();
}
_updateBoxColorIndex = 0;
_updateBoxIndex = box;
_highLightBoxTimer = _vm->_system->getMillis();
}
}
int GUI_Eob::getTextInput(char *dest, int x, int y, int destMaxLen, int textColor1, int textColor2, int cursorColor) {
uint8 cursorState = 1;
char sufx[] = " ";
@ -2344,7 +2436,7 @@ int GUI_Eob::getTextInput(char *dest, int x, int y, int destMaxLen, int textColo
return _keyPressed.keycode == Common::KEYCODE_ESCAPE ? -1 : len;
}
void GUI_Eob::initMenuItemsMask(int menuId, int maxItem, int32 menuItemsMask, int unk) {
void GUI_Eob::simpleMenu_initMenuItemsMask(int menuId, int maxItem, int32 menuItemsMask, int unk) {
if (menuItemsMask == -1) {
_menuNumItems = _screen->getScreenDim(19 + menuId)->h;
_menuCur = _screen->getScreenDim(19 + menuId)->unk8;
@ -2361,6 +2453,253 @@ void GUI_Eob::initMenuItemsMask(int menuId, int maxItem, int32 menuItemsMask, in
_menuCur = 0;
}
void GUI_Eob::runSaveMenu() {
}
void GUI_Eob::runMemorizePrayMenu(int charIndex, int spellType) {
}
void GUI_Eob::scribeScrollDialogue() {
}
bool GUI_Eob::confirmDialogue(int id) {
int od = _screen->curDimIndex();
Screen::FontId of = _screen->setFont(Screen::FID_8_FNT);
Button *buttonList = initMenu(5);
_screen->printShadedText(getMenuString(id), (_screen->_curDim->sx + 1) << 3, _screen->_curDim->sy + 4, 15, 0);
int newHighlight = 0;
int lastHighlight = -1;
bool result = false;
for (bool runLoop = true; runLoop && !_vm->shouldQuit(); ) {
if (newHighlight != lastHighlight) {
if (lastHighlight != -1)
drawMenuButton(_vm->gui_getButton(buttonList, lastHighlight + 33), false, false, true);
drawMenuButton(_vm->gui_getButton(buttonList, newHighlight + 33), false, true, true);
_screen->updateScreen();
lastHighlight = newHighlight;
}
int inputFlag = _vm->checkInput(buttonList, false, 0) & 0x80ff;
_vm->removeInputTop();
if (inputFlag == _vm->_keyMap[Common::KEYCODE_KP5] || inputFlag == _vm->_keyMap[Common::KEYCODE_SPACE] || inputFlag == _vm->_keyMap[Common::KEYCODE_RETURN]) {
result = lastHighlight ? false : true;
inputFlag = 0x8021 + lastHighlight;
runLoop = false;
} else if (inputFlag == _vm->_keyMap[Common::KEYCODE_KP4] || inputFlag == _vm->_keyMap[Common::KEYCODE_LEFT] || inputFlag == _vm->_keyMap[Common::KEYCODE_KP6] || inputFlag == _vm->_keyMap[Common::KEYCODE_RIGHT]) {
newHighlight ^= 1;
} else if (inputFlag == 0x8021) {
result = true;
runLoop = false;
} else if (inputFlag == 0x8022) {
result = false;
runLoop = false;
} else {
Common::Point p = _vm->getMousePos();
for (Button *b = buttonList; b; b = b->nextButton) {
if ((b->arg & 2) && _vm->posWithinRect(p.x, p.y, b->x, b->y, b->x + b->width, b->y + b->height))
newHighlight = b->index - 33;
}
}
if (!runLoop) {
Button *b = _vm->gui_getButton(buttonList, lastHighlight + 33);
drawMenuButton(b, true, true, true);
_screen->updateScreen();
_vm->_system->delayMillis(80);
drawMenuButton(b, false, true, true);
_screen->updateScreen();
}
}
releaseButtons(buttonList);
_screen->setFont(of);
_screen->setScreenDim(od);
return result;
}
int GUI_Eob::selectCharacterDialogue(int id) {
uint8 flags = (id == 26) ? 0x14 : 0x02;
_vm->removeInputTop();
_charSelectRedraw = false;
bool abort = false;
int count = 0;
int result = -1;
int found[6];
for (int i = 0; i < 6; i++) {
found[i] = -1;
if (!_vm->testCharacter(i, 1))
continue;
if (!(_vm->_classModifierFlags[_vm->_characters[i].cClass] & flags) && (id != 53))
continue;
if (id != 53 && (!_vm->_characters[i].food || !_vm->testCharacter(i, 4))) {
abort = true;
} else {
found[i] = 0;
result = i;
count++;
}
}
if (!count) {
int eid = 0;
if (id == 23)
eid = abort ? 28 : 72;
else if (id == 26)
eid = abort ? 27 : 73;
else if (id == 49)
eid = 52;
displayTextBox(eid);
return -1;
}
static const uint16 selX[] = { 184, 256, 184, 256, 184, 256 };
static const uint8 selY[] = { 2, 2, 54, 54, 106, 106};
for (int i = 0; i < 6; i++) {
if (found[i] != -1 || !_vm->testCharacter(i, 1))
continue;
_screen->drawShape(0, _vm->_blackBoxSmallGrid, selX[i], selY[i], 0);
_screen->drawShape(0, _vm->_blackBoxSmallGrid, selX[i] + 16, selY[i], 0);
_screen->drawShape(0, _vm->_blackBoxSmallGrid, selX[i] + 32, selY[i], 0);
_screen->drawShape(0, _vm->_blackBoxSmallGrid, selX[i] + 48, selY[i], 0);
_charSelectRedraw = true;
}
if (count == 1) {
int l = _vm->getCharacterLevelIndex(4, _vm->_characters[result].cClass);
if (l == -1)
return result;
if (_vm->_characters[result].level[l] > 8)
return result;
displayTextBox(24);
return -1;
}
_vm->_menuDefs[3].titleStrId = id;
Button *buttonList = initMenu(3);
result = -2;
int hlCur = -1;
Screen::FontId of = _screen->setFont(Screen::FID_6_FNT);
while (result == -2 && !_vm->shouldQuit()) {
int inputFlag = _vm->checkInput(buttonList, false, 0);
_vm->removeInputTop();
highLightBoxFrame(hlCur);
if (inputFlag == _vm->_keyMap[Common::KEYCODE_KP4] || inputFlag == _vm->_keyMap[Common::KEYCODE_LEFT] || inputFlag == _vm->_keyMap[Common::KEYCODE_KP8] || inputFlag == _vm->_keyMap[Common::KEYCODE_UP] || inputFlag == _vm->_keyMap[Common::KEYCODE_a] || inputFlag == _vm->_keyMap[Common::KEYCODE_w]) {
highLightBoxFrame(-1);
_vm->gui_drawCharPortraitWithStats(hlCur--);
if (hlCur < 0)
hlCur = 5;
while (found[hlCur]) {
if (--hlCur < 0)
hlCur = 5;
}
} else if (inputFlag == _vm->_keyMap[Common::KEYCODE_KP6] || inputFlag == _vm->_keyMap[Common::KEYCODE_RIGHT] || inputFlag == _vm->_keyMap[Common::KEYCODE_KP2] || inputFlag == _vm->_keyMap[Common::KEYCODE_DOWN] || inputFlag == _vm->_keyMap[Common::KEYCODE_z] || inputFlag == _vm->_keyMap[Common::KEYCODE_s]) {
highLightBoxFrame(-1);
_vm->gui_drawCharPortraitWithStats(hlCur++);
if (hlCur == 6)
hlCur = 0;
while (found[hlCur]) {
if (++hlCur == 6)
hlCur = 0;
}
} else if (inputFlag == _vm->_keyMap[Common::KEYCODE_KP5] || inputFlag == _vm->_keyMap[Common::KEYCODE_RETURN]) {
if (found >= 0)
result = hlCur;
} else if (inputFlag == _vm->_keyMap[Common::KEYCODE_ESCAPE] || inputFlag == 0x8010) {
_screen->setFont(Screen::FID_8_FNT);
drawMenuButton(buttonList, true, true, true);
_screen->updateScreen();
_vm->_system->delayMillis(80);
drawMenuButton(buttonList, false, false, true);
_screen->updateScreen();
_screen->setFont(Screen::FID_6_FNT);
result = -1;
} else if (inputFlag > 0x8010 && inputFlag < 0x8017) {
result = inputFlag - 0x8011;
if (found[result])
result = -2;
}
}
highLightBoxFrame(-1);
if (hlCur >= 0)
_vm->gui_drawCharPortraitWithStats(hlCur);
_screen->setFont(Screen::FID_8_FNT);
if (result != -1 && id != 53) {
if (flags == 0x14) {
if (_vm->_classModifierFlags[_vm->_characters[result].cClass] & 0x10 && _vm->_characters[result].level[0] < 9) {
displayTextBox(24);
result = -1;
}
} else {
if (_vm->checkCharacterInventoryForItem(result, 29, -1) == -1) {
displayTextBox(25);
result = -1;
}
}
}
releaseButtons(buttonList);
_screen->setFont(of);
return result;
}
void GUI_Eob::displayTextBox(int id) {
int op = _screen->setCurPage(2);
int od = _screen->curDimIndex();
Screen::FontId of = _screen->setFont(Screen::FID_8_FNT);
_screen->setClearScreenDim(11);
const ScreenDim *dm = _screen->getScreenDim(11);
drawMenuButtonBox(dm->sx << 3, dm->sy, dm->w << 3, dm->h, false, false);
_screen->printShadedText(getMenuString(id), (dm->sx << 3) + 5, dm->sy + 5, 15, 0);
_screen->copyRegion(dm->sx << 3, dm->sy, dm->sx << 3, dm->sy, dm->w << 3, dm->h, 2, 0, Screen::CR_NO_P_CHECK);
_screen->updateScreen();
for (uint32 timeOut = _vm->_system->getMillis() + 1440; _vm->_system->getMillis() < timeOut && !_vm->shouldQuit(); ) {
int in = _vm->checkInput(0, false, 0);
_vm->removeInputTop();
if (in && !(in & 0x800))
break;
_vm->_system->delayMillis(4);
}
_screen->setCurPage(op);
_screen->setFont(of);
_screen->setScreenDim(od);
}
Button *GUI_Eob::initMenu(int id) {
_screen->setCurPage(2);
@ -2443,10 +2782,6 @@ void GUI_Eob::drawMenuButtonBox(int x, int y, int w, int h, bool clicked, bool n
_vm->gui_drawBox(x + 1, y + 1, w - 2, h - 2, _vm->_color1_1, _vm->_color2_1, noFill ? -1 : _vm->_bkgColor_1);
}
void GUI_Eob::displayTextBox(int id) {
}
void GUI_Eob::updateOptionsStrings() {
for (int i = 0; i < 4; i++) {
delete _menuStringsPrefsTemp[i];
@ -2460,6 +2795,8 @@ void GUI_Eob::updateOptionsStrings() {
}
const char *GUI_Eob::getMenuString(int id) {
static const char empty[] = "";
if (id >= 69)
return _vm->_menuStringsTransfer[id - 69];
else if (id >= 67)
@ -2477,11 +2814,11 @@ const char *GUI_Eob::getMenuString(int id) {
else if (id >= 48)
return _vm->_menuStringsScribe[id - 48];
else if (id == 47)
_vm->_menuStringsStarve[0];
return _vm->_menuStringsStarve[0];
else if (id == 46)
_vm->_menuStringsExit[0];
return _vm->_menuStringsExit[0];
else if (id == 45)
_vm->_menuStringsDrop[0];
return _vm->_menuStringsDrop[0];
else if (id >= 40)
return _vm->_menuStringsRest[id - 40];
else if (id >= 23)
@ -2494,7 +2831,7 @@ const char *GUI_Eob::getMenuString(int id) {
return _vm->_menuStringsSaveLoad[id - 9];
else if (id >= 1)
return _vm->_menuStringsMain[id - 1];
return 0;
return empty;
}
Button *GUI_Eob::linkButton(Button *list, Button *newbt) {

View File

@ -31,10 +31,17 @@
namespace Kyra {
struct EobRect16 {
int16 x1;
int16 y1;
uint16 x2;
uint16 y2;
};
class DarkMoonEngine;
class Screen_Eob;
class GUI_Eob : public GUI {
class GUI_Eob : public GUI_v1 {
friend class EobCoreEngine;
friend class CharacterGenerator;
public:
@ -47,69 +54,49 @@ public:
void processButton(Button *button);
int processButtonList(Button *buttonList, uint16 inputFlags, int8 mouseWheel);
int redrawShadedButtonCallback(Button *button) { return 0; }
int redrawButtonCallback(Button *button) { return 0; }
// Non button based menu handling (main menu, character generation)
void setupMenu(int sd, int maxItem, const char *const *strings, int32 menuItemsMask, int unk, int lineSpacing);
int handleMenu(int sd, const char *const *strings, void *b, int32 menuItemsMask, int unk);
int getMenuItem(int index, int32 menuItemsMask, int unk);
void menuFlashSelection(const char *str, int x, int y, int color1, int color2, int color3);
void simpleMenu_setup(int sd, int maxItem, const char *const *strings, int32 menuItemsMask, int unk, int lineSpacing);
int simpleMenu_process(int sd, const char *const *strings, void *b, int32 menuItemsMask, int unk);
// Button based menus (camp menu, options, save/load)
int runCampMenu();
void runCampMenu();
int runLoadMenu(int x, int y);
void highLightBoxFrame(int box);
int getTextInput(char *dest, int x, int y, int destMaxLen, int textColor1, int textColor2, int cursorColor);
// utilities for thumbnail creation
void createScreenThumbnail(Graphics::Surface &dst) {}
// unused
int redrawShadedButtonCallback(Button *button) { return 0; }
int redrawButtonCallback(Button *button) { return 0; }
private:
void initMenuItemsMask(int menuId, int maxItem, int32 menuItemsMask, int unk);
int simpleMenu_getMenuItem(int index, int32 menuItemsMask, int unk);
void simpleMenu_flashSelection(const char *str, int x, int y, int color1, int color2, int color3);
void simpleMenu_initMenuItemsMask(int menuId, int maxItem, int32 menuItemsMask, int unk);
//void backupPage0();
//void restorePage0();
void runSaveMenu();
void runMemorizePrayMenu(int charIndex, int spellType);
void scribeScrollDialogue();
//void setupSavegameNames(Menu &menu, int num);
//void printMenuText(const char *str, int x, int y, uint8 c0, uint8 c1, uint8 flags);
//int getMenuCenterStringX(const char *str, int x1, int x2);
//int getInput();
Button *initMenu(int id);
bool confirmDialogue(int id);
int selectCharacterDialogue(int id);
void displayTextBox(int id);
Button *initMenu(int id);
void drawMenuButton(Button *b, bool clicked, bool highlight, bool noFill);
void drawMenuButtonBox(int x, int y, int w, int h, bool clicked, bool noFill);
void displayTextBox(int id);
void updateOptionsStrings();
const char *getMenuString(int id);
Button *linkButton(Button *list, Button *newbt);
void releaseButtons(Button *list);
Button *getButtonListData() { return _menuButtons; }
Button *getScrollUpButton() { return &_scrollUpButton; }
Button *getScrollDownButton() { return &_scrollDownButton; }
Button::Callback getScrollUpButtonHandler() const { return _scrollUpFunctor; }
Button::Callback getScrollDownButtonHandler() const { return _scrollDownFunctor; }
uint8 defaultColor1() const { return 0xFE; }
uint8 defaultColor2() const { return 0x00; }
const char *getMenuTitle(const Menu &menu) { return 0; }
const char *getMenuItemTitle(const MenuItem &menuItem) { return 0; }
const char *getMenuItemLabel(const MenuItem &menuItem) { return 0; }
//Button _menuButtons[10];
Button *_menuButtons;
Button _scrollUpButton;
Button _scrollUpButton;//////////////////77
Button _scrollDownButton;
//Menu _mainMenu, _gameOptions, _audioOptions, _choiceMenu, _loadMenu, _saveMenu, _deleteMenu, _savenameMenu, _deathMenu;
//Menu *_currentMenu, *_lastMenu, *_newMenu;
//int _menuResult;
//char *_saveDescription;
char **_menuStringsPrefsTemp;
@ -124,7 +111,7 @@ private:
uint16 _flagsMouseRight;
uint16 _flagsModifier;
uint16 _progress;
uint16 _prcButtonUnk3; /// ALWAYS 1?? REMOVE ??
uint16 _prcButtonUnk3;
uint16 _cflag;
Button::Callback _scrollUpFunctor;
@ -136,6 +123,27 @@ private:
int _menuCur;
int _menuNumItems;
bool _charSelectRedraw;
int _updateBoxIndex;
int _updateBoxColorIndex;
uint32 _highLightBoxTimer;
static const EobRect16 _highLightBoxFrames[];
// unused
Button *getButtonListData() { return 0; }
Button *getScrollUpButton() { return &_scrollUpButton; }
Button *getScrollDownButton() { return &_scrollDownButton; }
Button::Callback getScrollUpButtonHandler() const { return _scrollUpFunctor; }
Button::Callback getScrollDownButtonHandler() const { return _scrollDownFunctor; }
uint8 defaultColor1() const { return 0xFE; }
uint8 defaultColor2() const { return 0x00; }
const char *getMenuTitle(const Menu &menu) { return 0; }
const char *getMenuItemTitle(const MenuItem &menuItem) { return 0; }
const char *getMenuItemLabel(const MenuItem &menuItem) { return 0; }
};
} // End of namespace Kyra

View File

@ -184,7 +184,7 @@ int KyraEngine_LoK::buttonAmuletCallback(Button *caller) {
#pragma mark -
GUI_LoK::GUI_LoK(KyraEngine_LoK *vm, Screen_LoK *screen) : GUI(vm), _vm(vm), _screen(screen) {
GUI_LoK::GUI_LoK(KyraEngine_LoK *vm, Screen_LoK *screen) : GUI_v1(vm), _vm(vm), _screen(screen) {
_lastScreenUpdate = 0;
_menu = 0;
_pressFlag = false;

View File

@ -92,7 +92,7 @@ namespace Kyra {
class KyraEngine_LoK;
class GUI_LoK : public GUI {
class GUI_LoK : public GUI_v1 {
friend class KyraEngine_LoK;
public:
GUI_LoK(KyraEngine_LoK *vm, Screen_LoK *screen);

View File

@ -1838,12 +1838,12 @@ int LoLEngine::clickedStatusIcon(Button *button) {
return 1;
}
GUI_LoL::GUI_LoL(LoLEngine *vm) : GUI(vm), _vm(vm), _screen(vm->_screen) {
GUI_LoL::GUI_LoL(LoLEngine *vm) : GUI_v1(vm), _vm(vm), _screen(vm->_screen) {
_scrollUpFunctor = BUTTON_FUNCTOR(GUI_LoL, this, &GUI_LoL::scrollUp);
_scrollDownFunctor = BUTTON_FUNCTOR(GUI_LoL, this, &GUI_LoL::scrollDown);
_redrawButtonFunctor = BUTTON_FUNCTOR(GUI, this, &GUI::redrawButtonCallback);
_redrawShadedButtonFunctor = BUTTON_FUNCTOR(GUI, this, &GUI::redrawShadedButtonCallback);
_redrawButtonFunctor = BUTTON_FUNCTOR(GUI_v1, this, &GUI_v1::redrawButtonCallback);
_redrawShadedButtonFunctor = BUTTON_FUNCTOR(GUI_v1, this, &GUI_v1::redrawShadedButtonCallback);
_specialProcessButton = _backUpButtonList = 0;
_flagsModifier = 0;

View File

@ -88,7 +88,7 @@ namespace Kyra {
class LoLEngine;
class Screen_LoL;
class GUI_LoL : public GUI {
class GUI_LoL : public GUI_v1 {
friend class LoLEngine;
public:
GUI_LoL(LoLEngine *vm);

View File

@ -30,7 +30,7 @@
namespace Kyra {
GUI_v2::GUI_v2(KyraEngine_v2 *vm) : GUI(vm), _vm(vm), _screen(vm->screen_v2()) {
GUI_v2::GUI_v2(KyraEngine_v2 *vm) : GUI_v1(vm), _vm(vm), _screen(vm->screen_v2()) {
_backUpButtonList = _specialProcessButton = 0;
_buttonListChanged = false;
_lastScreenUpdate = 0;
@ -48,7 +48,7 @@ GUI_v2::GUI_v2(KyraEngine_v2 *vm) : GUI(vm), _vm(vm), _screen(vm->screen_v2()) {
}
Button *GUI_v2::addButtonToList(Button *list, Button *newButton) {
list = GUI::addButtonToList(list, newButton);
list = GUI_v1::addButtonToList(list, newButton);
_buttonListChanged = true;
return list;
}

View File

@ -99,7 +99,7 @@ namespace Kyra {
class KyraEngine_v2;
class Screen_v2;
class GUI_v2 : public GUI {
class GUI_v2 : public GUI_v1 {
public:
GUI_v2(KyraEngine_v2 *vm);

View File

@ -199,7 +199,7 @@ public:
Screen *screen() { return _screen; }
Screen_v2 *screen_v2() const { return _screen; }
GUI *gui() const { return _gui; }
GUI_v1 *gui() const { return _gui; }
virtual TextDisplayer *text() { return _text; }
int language() const { return _lang; }
protected:

View File

@ -109,7 +109,7 @@ public:
Screen *screen() { return _screen; }
Animator_LoK *animator() { return _animator; }
GUI *gui() const { return _gui; }
GUI_v1 *gui() const { return _gui; }
virtual Movie *createWSAMovie();
uint8 **shapes() { return _shapes; }

View File

@ -54,7 +54,7 @@ public:
Screen *screen() { return _screen; }
Screen_v2 *screen_v2() const { return _screen; }
GUI *gui() const { return _gui; }
GUI_v1 *gui() const { return _gui; }
SoundDigital *soundDigital() { return _soundDigital; }
int language() const { return _lang; }
bool heliumMode() const { return _configHelium; }

View File

@ -345,7 +345,7 @@ int KyraEngine_v1::checkInput(Button *buttonList, bool mainLoop, int eventFlag)
_eventList.erase(_eventList.begin());
}
GUI *guiInstance = gui();
GUI_v1 *guiInstance = gui();
if (guiInstance) {
if (keys)
return guiInstance->processButtonList(buttonList, keys | eventFlag, mouseWheel);

View File

@ -176,14 +176,14 @@ class TextDisplayer;
class StaticResource;
class TimerManager;
class Debugger;
class GUI;
class GUI_v1;
struct Button;
class KyraEngine_v1 : public Engine {
friend class Debugger;
friend class ::KyraMetaEngine;
friend class GUI;
friend class GUI_v1;
friend class SoundMidiPC; // For _eventMan
public:
KyraEngine_v1(OSystem *system, const GameFlags &flags);
@ -196,7 +196,7 @@ public:
Resource *resource() { return _res; }
virtual Screen *screen() = 0;
virtual TextDisplayer *text() { return _text; }
virtual GUI *gui() const { return 0; }
virtual GUI_v1 *gui() const { return 0; }
Sound *sound() { return _sound; }
StaticResource *staticres() { return _staticres; }
TimerManager *timer() { return _timer; }

View File

@ -357,7 +357,7 @@ Screen *LoLEngine::screen() {
return _screen;
}
GUI *LoLEngine::gui() const {
GUI_v1 *LoLEngine::gui() const {
return _gui;
}

View File

@ -279,7 +279,7 @@ public:
virtual void initKeymap();
Screen *screen();
GUI *gui() const;
GUI_v1 *gui() const;
private:
Screen_LoL *_screen;

View File

@ -86,7 +86,7 @@ public:
virtual ~LolEobBaseEngine();
virtual Screen *screen() = 0;
virtual GUI *gui() const = 0;
virtual GUI_v1 *gui() const = 0;
protected:
// Startup

View File

@ -314,6 +314,8 @@ enum KyraResources {
kEobBaseMenuStringsMgc,
kEobBaseMenuStringsPrefs,
kEobBaseMenuStringsRest2,
kEobBaseMenuStringsRest3,
kEobBaseMenuStringsRest4,
kEobBaseMenuStringsDefeat,
kEobBaseMenuStringsTransfer,
kEobBaseMenuStringsSpec,

View File

@ -122,7 +122,7 @@ EobInfProcessor::EobInfProcessor(EobCoreEngine *engine, Screen_Eob *screen) : _v
_abortScript = 0;
_abortAfterSubroutine = 0;
_dlgResult = 0;
_script2 = 0;
_preventRest = 0;
_lastScriptFunc = 0;
_lastScriptSub = 0;
@ -192,13 +192,13 @@ void EobInfProcessor::run(int func, int sub) {
}
void EobInfProcessor::loadState(Common::SeekableSubReadStreamEndian &in) {
_script2 = in.readByte();
_preventRest = in.readByte();
for (int i = 0; i < 18; i++)
_flagTable[i] = in.readUint16BE();
}
void EobInfProcessor::saveState(Common::OutSaveFile *out) {
out->writeByte(_script2);
out->writeByte(_preventRest);
for (int i = 0; i < 18; i++)
out->writeUint16BE(_flagTable[i]);
}
@ -521,7 +521,7 @@ int EobInfProcessor::oeob_setFlags(int8 *data) {
switch (*pos++) {
case -47:
_script2 = 0;
_preventRest = 0;
break;
case -28:
@ -570,7 +570,7 @@ int EobInfProcessor::oeob_removeFlags(int8 *data) {
switch (a) {
case -47:
_script2 = 1;
_preventRest = 1;
break;
case -28:

View File

@ -43,7 +43,8 @@ public:
void run(int func, int sub);
void setFlag(int flag) { _flagTable[17] |= flag; }
bool checkFlag(int flag) { return (_flagTable[17] & flag) ? true : false; }
bool checkFlag(int flag) const { return (_flagTable[17] & flag) ? true : false; }
bool preventRest() const { return _preventRest ? true : false; }
void loadState(Common::SeekableSubReadStreamEndian &in);
void saveState(Common::OutSaveFile *out);
@ -96,7 +97,7 @@ private:
uint8 _abortScript;
uint16 _abortAfterSubroutine;
int _dlgResult;
uint8 _script2;
uint8 _preventRest;
uint16 _lastScriptFunc;
uint16 _lastScriptSub;

View File

@ -94,10 +94,10 @@ int EobEngine::mainMenuLoop() {
int sel = -1;
do {
_screen->setScreenDim(28);
_gui->setupMenu(8, 0, _mainMenuStrings, -1, 0, 0);
_gui->simpleMenu_setup(8, 0, _mainMenuStrings, -1, 0, 0);
while (sel == -1 && !shouldQuit())
sel = _gui->handleMenu(8, _mainMenuStrings, 0, -1, 0);
sel = _gui->simpleMenu_process(8, _mainMenuStrings, 0, -1, 0);
} while ((sel < 0 || sel > 5) && !shouldQuit());
return sel + 1;

View File

@ -155,10 +155,10 @@ int DarkMoonEngine::mainMenuLoop() {
int sel = -1;
do {
_screen->setScreenDim(6);
_gui->setupMenu(6, 0, _mainMenuStrings, -1, 0, 0);
_gui->simpleMenu_setup(6, 0, _mainMenuStrings, -1, 0, 0);
while (sel == -1 && !shouldQuit())
sel = _gui->handleMenu(6, _mainMenuStrings, 0, -1, 0);
sel = _gui->simpleMenu_process(6, _mainMenuStrings, 0, -1, 0);
} while ((sel < 0 || sel > 5) && !shouldQuit());
return sel + 1;

View File

@ -266,7 +266,7 @@ const uint8 EobCoreEngine::_hpIncrPerLevel[] = { 10, 4, 8, 6, 10, 10, 9, 10, 9,
const uint8 EobCoreEngine::_numLevelsPerClass[] = { 1, 1, 1, 1, 1, 1, 2, 2, 2, 3, 2, 2, 3, 2, 2 };
const int8 EobCoreEngine::_classHpIncreaseType[] = {
const int8 EobCoreEngine::_characterClassType[] = {
0, -1, -1, 5, -1, -1, 4, -1, -1, 1, -1, -1, 2, -1, -1, 3, -1, -1, 0,
2, -1, 0, 3, -1, 0, 1, -1, 0, 1, 3, 3, 1, -1, 2, 3, -1, 0, 2, 1, 5,
2, -1, 2, 1, -1
@ -381,6 +381,8 @@ void EobCoreEngine::initStaticResource() {
_menuStringsMgc = _staticres->loadStrings(kEobBaseMenuStringsMgc, temp);
_menuStringsPrefs = _staticres->loadStrings(kEobBaseMenuStringsPrefs, temp);
_menuStringsRest2 = _staticres->loadStrings(kEobBaseMenuStringsRest2, temp);
_menuStringsRest3 = _staticres->loadStrings(kEobBaseMenuStringsRest3, temp);
_menuStringsRest4 = _staticres->loadStrings(kEobBaseMenuStringsRest4, temp);
_menuStringsDefeat = _staticres->loadStrings(kEobBaseMenuStringsDefeat, temp);
_menuStringsTransfer = _staticres->loadStrings(kEobBaseMenuStringsTransfer, temp);
_menuStringsSpec = _staticres->loadStrings(kEobBaseMenuStringsSpec, temp);