From aac7e16afa8546232a27754c6928cd43cd6ba876 Mon Sep 17 00:00:00 2001 From: athrxx Date: Mon, 28 Nov 2011 18:44:40 +0100 Subject: KYRA: (EOB) - fix some more bugs - wrong usage of static array which caused issues when restarting after RTL - portability issue with dialog labels - (original code) bug in hold person spell --- engines/kyra/eob1.cpp | 30 +++++++++++++-------------- engines/kyra/eob1.h | 12 +---------- engines/kyra/eob2.cpp | 10 ++++----- engines/kyra/eob2.h | 3 +-- engines/kyra/eobcommon.cpp | 46 ++++++++++++++++++++++++++---------------- engines/kyra/eobcommon.h | 5 +++-- engines/kyra/gui_eob.cpp | 3 +-- engines/kyra/magic_eob.cpp | 4 ++-- engines/kyra/scene_eob.cpp | 20 +++++------------- engines/kyra/script_eob.cpp | 2 +- engines/kyra/staticres_eob.cpp | 24 ++++++---------------- 11 files changed, 69 insertions(+), 90 deletions(-) (limited to 'engines') diff --git a/engines/kyra/eob1.cpp b/engines/kyra/eob1.cpp index c345b4710a..ae24b14efb 100644 --- a/engines/kyra/eob1.cpp +++ b/engines/kyra/eob1.cpp @@ -33,8 +33,8 @@ EobEngine::EobEngine(OSystem *system, const GameFlags &flags) : EobCoreEngine(sy _menuChoiceInit = 4; _turnUndeadString = _introFilesOpening = _introFilesTower = _introFilesOrb = _introFilesWdEntry = _introFilesKing = _introFilesHands = _introFilesWdExit = - _introFilesTunnel = _finBonusStrings = _npc11Strings = _npc12Strings = _npc21Strings = _npc22Strings = _npc31Strings = _npc32Strings = _npc4Strings = - _npc5Strings = _npc6Strings = _npc7Strings = 0; + _introFilesTunnel = _finBonusStrings = _npcStrings[1] = _npcStrings[2] = _npcStrings[3] = _npcStrings[4] = _npcStrings[5] = _npcStrings[6] = _npcStrings[7] = + _npcStrings[8] = _npcStrings[9] = _npcStrings[10] = 0; _introOpeningFrmDelay = _introWdEncodeX = _introWdEncodeY = _introWdEncodeWH = _npcShpData = _npcSubShpIndex1 = _npcSubShpIndex2 = _npcSubShpY = _introWdDsY = _introTvlX1 = _introTvlY1 = _introTvlX2 = _introTvlY2 = _introTvlW = _introTvlH = _dscDoorScaleMult4 = _dscDoorScaleMult5 = _dscDoorScaleMult6 = _dscDoorY3 = _dscDoorY4 = _dscDoorY5 = _dscDoorY6 = _dscDoorY7 = _doorShapeEncodeDefs = _doorSwitchShapeEncodeDefs = _doorSwitchCoords = 0; @@ -164,8 +164,8 @@ void EobEngine::encodeDrawNpcSeqShape(int npcIndex, int drawX, int drawY) { delete[] shp; } -#define DLG2(txt, buttonstr) (runDialogue(txt, 0, _npc##buttonstr##Strings[0], _npc##buttonstr##Strings[1], 0) - 1) -#define DLG3(txt, buttonstr) (runDialogue(txt, 1, _npc##buttonstr##Strings[0], _npc##buttonstr##Strings[1], _npc##buttonstr##Strings[2], 0) - 1) +#define DLG2(txt, buttonstr) (runDialogue(txt, 2, _npcStrings[buttonstr][0], _npcStrings[buttonstr][1]) - 1) +#define DLG3(txt, buttonstr) (runDialogue(txt, 3, _npcStrings[buttonstr][0], _npcStrings[buttonstr][1], _npcStrings[buttonstr][2]) - 1) #define DLG2A3(cond, txt, buttonstr1, buttonstr2) ((cond) ? (DLG2(txt, buttonstr1) ? 2 : 0) : DLG3(txt, buttonstr2)) #define TXT(txt) _txt->printDialogueText(txt, _moreStrings[0]) @@ -178,7 +178,7 @@ void EobEngine::runNpcDialogue(int npcIndex) { case 0: for (r = 1; r == 1; ) { gui_drawDialogueBox(); - r = DLG2A3(checkScriptFlags(0x2000), 8, 12, 11); + r = DLG2A3(checkScriptFlags(0x2000), 8, 2, 1); if (r == 1) { TXT(1); setScriptFlags(0x2000); @@ -195,10 +195,10 @@ void EobEngine::runNpcDialogue(int npcIndex) { a = 1; } else { setScriptFlags(0x8000); - r = DLG2(3, 21); + r = DLG2(3, 3); } if (!r) - r = DLG2(a ? 13 : 4, 22); + r = DLG2(a ? 13 : 4, 4); if (!r) { for (a = 0; a < 6; a++) @@ -238,7 +238,7 @@ void EobEngine::runNpcDialogue(int npcIndex) { } if (!r) - _txt->printDialogueText(_npc0Strings[0], true); + _txt->printDialogueText(_npcStrings[0][0], true); break; @@ -247,7 +247,7 @@ void EobEngine::runNpcDialogue(int npcIndex) { if (checkScriptFlags(0x20000)) { TXT(11); } else { - r = DLG2A3(!countResurrectionCandidates(), 9, 31, 32); + r = DLG2A3(!countResurrectionCandidates(), 9, 5, 6); if (r < 2) { if (r == 0) healParty(); @@ -262,7 +262,7 @@ void EobEngine::runNpcDialogue(int npcIndex) { break; case 3: - if (!DLG2(18, 4)) { + if (!DLG2(18, 7)) { setScriptFlags(0x8400000); for (a = 0; a < 30; a++) { if (_monsters[a].mode == 8) @@ -277,7 +277,7 @@ void EobEngine::runNpcDialogue(int npcIndex) { break; case 4: - r = DLG3(14, 5); + r = DLG3(14, 8); if (r == 0) setScriptFlags(0x200000); else if (r == 1) @@ -286,7 +286,7 @@ void EobEngine::runNpcDialogue(int npcIndex) { break; case 5: - if (!DLG2(16, 6)) { + if (!DLG2(16, 9)) { TXT(17); for (a = 0; a < 6; a++) { for (r = 0; r < 2; r++) { @@ -307,7 +307,7 @@ void EobEngine::runNpcDialogue(int npcIndex) { break; case 7: - r = DLG3(22, 7); + r = DLG3(22, 10); if (r < 2) { if (r == 0) npcJoinDialogue(8, 27, 44, 45); @@ -531,9 +531,9 @@ bool EobEngine::checkPartyStatusExtra() { int EobEngine::resurrectionSelectDialogue() { gui_drawDialogueBox(); - _txt->printDialogueText(_npc0Strings[1]); + _txt->printDialogueText(_npcStrings[0][1]); - int r = _rrId[runDialogue(-1, 1, _rrNames[0], _rrNames[1], _rrNames[2], _rrNames[3], _rrNames[4], _rrNames[5], _rrNames[6], _rrNames[7], _rrNames[8]) - 1]; + int r = _rrId[runDialogue(-1, 9, _rrNames[0], _rrNames[1], _rrNames[2], _rrNames[3], _rrNames[4], _rrNames[5], _rrNames[6], _rrNames[7], _rrNames[8]) - 1]; if (r < 0) { r = -r; diff --git a/engines/kyra/eob1.h b/engines/kyra/eob1.h index 3eade85e6f..00583e9330 100644 --- a/engines/kyra/eob1.h +++ b/engines/kyra/eob1.h @@ -102,17 +102,7 @@ private: const uint8 *_npcSubShpIndex1; const uint8 *_npcSubShpIndex2; const uint8 *_npcSubShpY; - const char *const *_npc0Strings; - const char *const *_npc11Strings; - const char *const *_npc12Strings; - const char *const *_npc21Strings; - const char *const *_npc22Strings; - const char *const *_npc31Strings; - const char *const *_npc32Strings; - const char *const *_npc4Strings; - const char *const *_npc5Strings; - const char *const *_npc6Strings; - const char *const *_npc7Strings; + const char *const *_npcStrings[11]; // items void updateUsedCharacterHandItem(int charIndex, int slot); diff --git a/engines/kyra/eob2.cpp b/engines/kyra/eob2.cpp index afaef0b43a..60df8f8520 100644 --- a/engines/kyra/eob2.cpp +++ b/engines/kyra/eob2.cpp @@ -35,7 +35,7 @@ DarkMoonEngine::DarkMoonEngine(OSystem *system, const GameFlags &flags) : EobCor _numSpells = 70; _menuChoiceInit = 4; - _introStrings = _cpsFilesIntro = _cpsFilesFinale = _finaleStrings = _kheldranStrings = _npc1Strings = _npc2Strings = _hornStrings = 0; + _introStrings = _cpsFilesIntro = _cpsFilesFinale = _finaleStrings = _kheldranStrings = _npcStrings[0] = _npcStrings[1] = _hornStrings = 0; _seqIntro = _seqFinale = 0; _shapesIntro = _shapesFinale = 0; _creditsData = _npcShpData = _dscDoorType5Offs = _hornSounds = 0; @@ -118,7 +118,7 @@ void DarkMoonEngine::runNpcDialogue(int npcIndex) { gui_drawDialogueBox(); _txt->printDialogueText(4, 0); - int r = runDialogue(-1, 0, _npc1Strings[0], _npc1Strings[1], 0) - 1; + int r = runDialogue(-1, 2, _npcStrings[0][0], _npcStrings[0][1]) - 1; if (r == 0) { snd_stopSound(); @@ -134,7 +134,7 @@ void DarkMoonEngine::runNpcDialogue(int npcIndex) { gui_drawDialogueBox(); _txt->printDialogueText(8, 0); - int r = runDialogue(-1, 0, _npc2Strings[0], _npc2Strings[1], 0) - 1; + int r = runDialogue(-1, 2, _npcStrings[1][0], _npcStrings[1][1]) - 1; if (r == 0) { if (rollDice(1, 2, -1)) @@ -422,7 +422,7 @@ int DarkMoonEngine::resurrectionSelectDialogue() { _rrNames[_rrCount] = _abortStrings[0]; _rrId[_rrCount++] = 99; - int r = _rrId[runDialogue(-1, 1, _rrNames[0], _rrNames[1], _rrNames[2], _rrNames[3], _rrNames[4], _rrNames[5], _rrNames[6], _rrNames[7], _rrNames[8]) - 1]; + int r = _rrId[runDialogue(-1, 9, _rrNames[0], _rrNames[1], _rrNames[2], _rrNames[3], _rrNames[4], _rrNames[5], _rrNames[6], _rrNames[7], _rrNames[8]) - 1]; if (r == 99) return 0; @@ -450,7 +450,7 @@ int DarkMoonEngine::charSelectDialogue() { namesList[cnt++] = _abortStrings[0]; - int r = runDialogue(-1, 1, namesList[0], namesList[1], namesList[2], namesList[3], namesList[4], namesList[5], namesList[6], 0) - 1; + int r = runDialogue(-1, 7, namesList[0], namesList[1], namesList[2], namesList[3], namesList[4], namesList[5], namesList[6]) - 1; if (r == cnt - 1) return 99; diff --git a/engines/kyra/eob2.h b/engines/kyra/eob2.h index 8c9b6dd9fa..35eb90a9dc 100644 --- a/engines/kyra/eob2.h +++ b/engines/kyra/eob2.h @@ -99,8 +99,7 @@ private: void runNpcDialogue(int npcIndex); const uint8 *_npcShpData; - const char *const *_npc1Strings; - const char *const *_npc2Strings; + const char *const *_npcStrings[2]; // items void updateUsedCharacterHandItem(int charIndex, int slot); diff --git a/engines/kyra/eobcommon.cpp b/engines/kyra/eobcommon.cpp index 6f58d3a4f6..389a0e9947 100644 --- a/engines/kyra/eobcommon.cpp +++ b/engines/kyra/eobcommon.cpp @@ -196,6 +196,20 @@ EobCoreEngine::EobCoreEngine(OSystem *system, const GameFlags &flags) : LolEobBa memset(_scriptTimers, 0, sizeof(_scriptTimers)); memset(_monsterBlockPosArray, 0, sizeof(_monsterBlockPosArray)); memset(_foundMonstersArray, 0, sizeof(_foundMonstersArray)); + +#define DWM0 _dscWallMapping.push_back(0) +#define DWM(x) _dscWallMapping.push_back(&_sceneDrawVar##x) + DWM0; DWM0; DWM(Down); DWM(Right); + DWM(Down); DWM(Right); DWM(Down); DWM0; + DWM(Down); DWM(Left); DWM(Down); DWM(Left); + DWM0; DWM0; DWM(Down); DWM(Right); + DWM(Down); DWM(Right); DWM(Down); DWM0; + DWM(Down); DWM(Left); DWM(Down); DWM(Left); + DWM(Down); DWM(Right); DWM(Down); DWM0; + DWM(Down); DWM(Left); DWM0; DWM(Right); + DWM(Down); DWM0; DWM0; DWM(Left); +#undef DWM +#undef DWM0 } EobCoreEngine::~EobCoreEngine() { @@ -254,6 +268,7 @@ EobCoreEngine::~EobCoreEngine() { releaseDecorations(); delete[] _levelDecorationRects; + _dscWallMapping.clear(); delete[] _spells; delete[] _spellAnimBuffer; @@ -757,8 +772,7 @@ void EobCoreEngine::setHandItem(Item itemIndex) { } int EobCoreEngine::getDexterityArmorClassModifier(int dexterity) { - static const int mod[] = { 5, 5, 5, 4, 3, 2, 1, 0, 0, - 0, 0, 0, 0, 0, 0, -1, -2, -3, -4, -4, -5, -5, -5, -6, -6 }; + static const int8 mod[] = { 5, 5, 5, 4, 3, 2, 1, 0, 0, 0, 0, 0, 0, 0, 0, -1, -2, -3, -4, -4, -5, -5, -5, -6, -6 }; return mod[dexterity]; } @@ -1111,7 +1125,7 @@ int EobCoreEngine::npcJoinDialogue(int npcIndex, int queryJoinTextId, int confir gui_drawDialogueBox(); _txt->printDialogueText(queryJoinTextId, 0); - int r = runDialogue(-1, 0, _yesNoStrings[0], _yesNoStrings[1], 0) - 1; + int r = runDialogue(-1, 2, _yesNoStrings[0], _yesNoStrings[1]) - 1; if (r == 0) { if (confirmJoinTextId == -1) { Common::String tmp = Common::String::format(_npcJoinStrings[0], _npcPreset[npcIndex].name); @@ -1140,8 +1154,8 @@ int EobCoreEngine::prepareForNewPartyMember(int16 itemType, int16 itemValue) { } else { gui_drawDialogueBox(); _txt->printDialogueText(_npcMaxStrings[0]); - int r = runDialogue(-1, 1, _characters[0].name, _characters[1].name, _characters[2].name, _characters[3].name, - _characters[4].name, _characters[5].name, _abortStrings[0], 0, 0) - 1; + int r = runDialogue(-1, 7, _characters[0].name, _characters[1].name, _characters[2].name, _characters[3].name, + _characters[4].name, _characters[5].name, _abortStrings[0]) - 1; if (r == 6) return 0; @@ -1264,16 +1278,14 @@ void EobCoreEngine::setWeaponSlotStatus(int charIndex, int mode, int slot) { gui_drawCharPortraitWithStats(charIndex); } -void EobCoreEngine::setupDialogueButtons(int presetfirst, int numStr, const char *str1, va_list &args) { +void EobCoreEngine::setupDialogueButtons(int presetfirst, int numStr, va_list &args) { _dialogueNumButtons = numStr; - _dialogueButtonString[0] = str1; _dialogueHighlightedButton = 0; - const char *tmp = 0; - for (int i = 1; i < numStr; i++) { - tmp = va_arg(args, const char*); - if (tmp) - _dialogueButtonString[i] = tmp; + for (int i = 0; i < numStr; i++) { + const char *s = va_arg(args, const char*); + if (s) + _dialogueButtonString[i] = s; else _dialogueNumButtons = numStr = i; } @@ -1364,16 +1376,16 @@ void EobCoreEngine::drawSequenceBitmap(const char *file, int destRect, int x1, i _screen->updateScreen(); } -int EobCoreEngine::runDialogue(int dialogueTextId, int style, const char *button1, ...) { +int EobCoreEngine::runDialogue(int dialogueTextId, int numStr, ...) { if (dialogueTextId != -1) txt()->printDialogueText(dialogueTextId, 0); va_list args; - va_start(args, button1); - if (style) - setupDialogueButtons(2, 9, button1, args); + va_start(args, numStr); + if (numStr > 2) + setupDialogueButtons(2, numStr, args); else - setupDialogueButtons(0, 2, button1, args); + setupDialogueButtons(0, numStr, args); va_end(args); int res = 0; diff --git a/engines/kyra/eobcommon.h b/engines/kyra/eobcommon.h index 06d43272cc..93db0b3623 100644 --- a/engines/kyra/eobcommon.h +++ b/engines/kyra/eobcommon.h @@ -620,6 +620,7 @@ protected: uint32 _envAudioTimer; uint16 _teleporterPulse; + Common::Array _dscWallMapping; const int16 *_dscShapeCoords; const uint8 *_dscItemPosIndex; @@ -756,11 +757,11 @@ protected: bool _configHpBarGraphs; // text - void setupDialogueButtons(int presetfirst, int numStr, const char *str1, va_list &args); + void setupDialogueButtons(int presetfirst, int numStr, va_list &args); void initDialogueSequence(); void restoreAfterDialogueSequence(); void drawSequenceBitmap(const char *file, int destRect, int x1, int y1, int flags); - int runDialogue(int dialogueTextId, int style, const char *button1, ...); + int runDialogue(int dialogueTextId, int numStr, ...); char _dialogueLastBitmap[13]; int _moveCounter; diff --git a/engines/kyra/gui_eob.cpp b/engines/kyra/gui_eob.cpp index f084bc9978..7d8e9250cd 100644 --- a/engines/kyra/gui_eob.cpp +++ b/engines/kyra/gui_eob.cpp @@ -2100,7 +2100,7 @@ void GUI_Eob::runCampMenu() { int newMenu = 0; int lastMenu = -1; bool redrawPortraits = false; - bool res = false; + _charSelectRedraw = false; _needRest = false; Button *buttonList = 0; @@ -2250,7 +2250,6 @@ void GUI_Eob::runCampMenu() { if (cnt > 4) { _vm->dropCharacter(selectCharacterDialogue(53)); _vm->gui_drawPlayField(false); - res = true; _screen->copyRegion(0, 120, 0, 0, 176, 24, 0, 12, Screen::CR_NO_P_CHECK); _screen->setFont(Screen::FID_6_FNT); _vm->gui_drawAllCharPortraitsWithStats(); diff --git a/engines/kyra/magic_eob.cpp b/engines/kyra/magic_eob.cpp index b70058d7ff..21bb10a1de 100644 --- a/engines/kyra/magic_eob.cpp +++ b/engines/kyra/magic_eob.cpp @@ -919,7 +919,7 @@ bool EobCoreEngine::spellCallback_end_holdPerson(void *obj) { if (_flags.gameID == GI_EOB2 && fo->curBlock == _currentBlock) { // party hit int numChar = rollDice(1, 4, 0); - int charIndex = rollDice(1, 6, 0); + int charIndex = rollDice(1, 6, -1); for (int i = 0; i < 6 && numChar; i++) { if (testCharacter(charIndex, 3)) { statusAttack(charIndex, 4, _magicStrings8[1], 4, 5, 9, 1); @@ -1010,7 +1010,7 @@ void EobCoreEngine::spellCallback_start_removeCurse() { } void EobCoreEngine::spellCallback_start_coneOfCold() { - static const int8 *dirTables[] = { _coneOfColdDest1, _coneOfColdDest2, _coneOfColdDest3, _coneOfColdDest4 }; + const int8 *dirTables[] = { _coneOfColdDest1, _coneOfColdDest2, _coneOfColdDest3, _coneOfColdDest4 }; int cl = getMageLevel(_openBookChar); diff --git a/engines/kyra/scene_eob.cpp b/engines/kyra/scene_eob.cpp index 0aaad6d35c..e2a2e794ff 100644 --- a/engines/kyra/scene_eob.cpp +++ b/engines/kyra/scene_eob.cpp @@ -896,6 +896,7 @@ void EobCoreEngine::loadDecorations(const char *cpsFile, const char *decFile) { _levelDecorationDataSize = s->readUint16LE(); delete[] _levelDecorationData; _levelDecorationData = new LevelDecorationProperty[_levelDecorationDataSize]; + memset(_levelDecorationData, 0, _levelDecorationDataSize * sizeof(LevelDecorationProperty)); for (int i = 0; i < _levelDecorationDataSize; i++) { LevelDecorationProperty *l = &_levelDecorationData[i]; @@ -944,6 +945,7 @@ void EobCoreEngine::assignWallsAndDecorations(int wallIndex, int vmpIndex, int d } do { + assert(decIndex < _levelDecorationDataSize); memcpy(&_levelDecorationProperties[_mappedDecorationsCount], &_levelDecorationData[decIndex], sizeof(LevelDecorationProperty)); for (int i = 0; i < 10; i++) { @@ -956,7 +958,7 @@ void EobCoreEngine::assignWallsAndDecorations(int wallIndex, int vmpIndex, int d EobRect8 *r = &_levelDecorationRects[t]; if (r->w == 0 || r->h == 0) - error("Error trying to make decoration %d x: %d y:%d w:%d h:%d", decIndex, r->x, r->y, r->w, r->h); + error("Error trying to make decoration %d (x: %d, y: %d, w: %d, h: %d)", decIndex, r->x, r->y, r->w, r->h); _levelDecorationShapes[t] = _screen->encodeShape(r->x, r->y, r->w, r->h); } @@ -1095,22 +1097,10 @@ void EobCoreEngine::drawSceneShapes(int start) { } void EobCoreEngine::drawDecorations(int index) { - static const int16 *dscWalls[] = { - 0, 0, &_sceneDrawVarDown, &_sceneDrawVarRight, - &_sceneDrawVarDown, &_sceneDrawVarRight, &_sceneDrawVarDown, 0, - &_sceneDrawVarDown, &_sceneDrawVarLeft, &_sceneDrawVarDown, &_sceneDrawVarLeft, - 0, 0, &_sceneDrawVarDown, &_sceneDrawVarRight, - &_sceneDrawVarDown, &_sceneDrawVarRight, &_sceneDrawVarDown, 0, - &_sceneDrawVarDown, &_sceneDrawVarLeft, &_sceneDrawVarDown, &_sceneDrawVarLeft, - &_sceneDrawVarDown, &_sceneDrawVarRight, &_sceneDrawVarDown, 0, - &_sceneDrawVarDown, &_sceneDrawVarLeft, 0, &_sceneDrawVarRight, - &_sceneDrawVarDown, 0, 0, &_sceneDrawVarLeft - }; - for (int i = 1; i >= 0; i--) { int s = index * 2 + i; - if (dscWalls[s]) { - int16 d = *dscWalls[s]; + if (_dscWallMapping[s]) { + int16 d = *_dscWallMapping[s]; int8 l = _wllShapeMap[_visibleBlocks[index]->walls[d]]; uint8 *shapeData = 0; diff --git a/engines/kyra/script_eob.cpp b/engines/kyra/script_eob.cpp index e85b1dc11a..4123e89a14 100644 --- a/engines/kyra/script_eob.cpp +++ b/engines/kyra/script_eob.cpp @@ -1527,7 +1527,7 @@ int EobInfProcessor::oeob_dialogue(int8 *data) { break; case -40: - _dlgResult = _vm->runDialogue(READ_LE_UINT16(pos), READ_LE_UINT16(pos + 6) == 0xffff ? 0 : 1, getString(READ_LE_UINT16(pos + 2)), getString(READ_LE_UINT16(pos + 4)), getString(READ_LE_UINT16(pos + 6)), 0); + _dlgResult = _vm->runDialogue(READ_LE_UINT16(pos), READ_LE_UINT16(pos + 6) == 0xffff ? 2 : 3, getString(READ_LE_UINT16(pos + 2)), getString(READ_LE_UINT16(pos + 4)), getString(READ_LE_UINT16(pos + 6))); pos += 8; break; diff --git a/engines/kyra/staticres_eob.cpp b/engines/kyra/staticres_eob.cpp index ec5d184c28..7433fbf126 100644 --- a/engines/kyra/staticres_eob.cpp +++ b/engines/kyra/staticres_eob.cpp @@ -427,11 +427,8 @@ void EobCoreEngine::initStaticResource() { _characterStatusStrings13 = _staticres->loadStrings(_flags.gameID == GI_EOB2 ? kEobBaseCharStatusStrings132 : kEobBaseCharStatusStrings131, temp); _levelGainStrings = _staticres->loadStrings(kEobBaseLevelGainStrings, temp); - _expRequirementTables[0] = _staticres->loadRawDataBe32(kEobBaseExperienceTable0, temp); - _expRequirementTables[1] = _staticres->loadRawDataBe32(kEobBaseExperienceTable1, temp); - _expRequirementTables[2] = _staticres->loadRawDataBe32(kEobBaseExperienceTable2, temp); - _expRequirementTables[3] = _staticres->loadRawDataBe32(kEobBaseExperienceTable3, temp); - _expRequirementTables[4] = _staticres->loadRawDataBe32(kEobBaseExperienceTable4, temp); + for (int i = 0; i < 5; i++) + _expRequirementTables[i] = _staticres->loadRawDataBe32(kEobBaseExperienceTable0 + i, temp); _expRequirementTables[5] = _staticres->loadRawDataBe32(kEobBaseExperienceTable4, temp); _classModifierFlags = _staticres->loadRawData(kEobBaseClassModifierFlags, temp); @@ -1153,17 +1150,8 @@ void EobEngine::initStaticResource() { _npcSubShpIndex1 = _staticres->loadRawData(kEob1NpcSubShpIndex1, temp); _npcSubShpIndex2 = _staticres->loadRawData(kEob1NpcSubShpIndex2, temp); _npcSubShpY = _staticres->loadRawData(kEob1NpcSubShpY, temp); - _npc0Strings = _staticres->loadStrings(kEob1Npc0Strings, temp); - _npc11Strings = _staticres->loadStrings(kEob1Npc11Strings, temp); - _npc12Strings = _staticres->loadStrings(kEob1Npc12Strings, temp); - _npc21Strings = _staticres->loadStrings(kEob1Npc21Strings, temp); - _npc22Strings = _staticres->loadStrings(kEob1Npc22Strings, temp); - _npc31Strings = _staticres->loadStrings(kEob1Npc31Strings, temp); - _npc32Strings = _staticres->loadStrings(kEob1Npc32Strings, temp); - _npc4Strings = _staticres->loadStrings(kEob1Npc4Strings, temp); - _npc5Strings = _staticres->loadStrings(kEob1Npc5Strings, temp); - _npc6Strings = _staticres->loadStrings(kEob1Npc6Strings, temp); - _npc7Strings = _staticres->loadStrings(kEob1Npc7Strings, temp); + for (int i = 0; i < 11; i++) + _npcStrings[i] = _staticres->loadStrings(kEob1Npc0Strings + i, temp); const uint8 *ps = _staticres->loadRawData(kEob1MonsterProperties, temp); temp /= 27; @@ -1321,8 +1309,8 @@ void DarkMoonEngine::initStaticResource() { _dscDoorType5Offs = _staticres->loadRawData(kEobBaseDscDoorType5Offs, temp); _npcShpData = _staticres->loadRawData(kEob2NpcShapeData, temp); - _npc1Strings = _staticres->loadStrings(kEob2Npc1Strings, temp); - _npc2Strings = _staticres->loadStrings(kEob2Npc2Strings, temp); + _npcStrings[0] = _staticres->loadStrings(kEob2Npc1Strings, temp); + _npcStrings[1] = _staticres->loadStrings(kEob2Npc2Strings, temp); _monsterDustStrings = _staticres->loadStrings(kEob2MonsterDustStrings, temp); _dreamSteps = (const int8*)_staticres->loadRawData(kEob2DreamSteps, temp); _kheldranStrings = _staticres->loadStrings(kEob2KheldranStrings, temp); -- cgit v1.2.3