From cc465076eef6194eb32320704a0855a21438bd95 Mon Sep 17 00:00:00 2001 From: athrxx Date: Fri, 28 Dec 2012 14:29:41 +0100 Subject: KYRA: (LOL/FM-TOWNS) - adapt static resources --- engines/kyra/eobcommon.h | 16 ++++++++-------- engines/kyra/gui_lol.cpp | 2 +- engines/kyra/gui_rpg.cpp | 4 ++-- engines/kyra/kyra_rpg.h | 2 +- engines/kyra/lol.cpp | 4 +++- engines/kyra/lol.h | 22 +++++++++++++--------- engines/kyra/resource.h | 5 ++++- engines/kyra/saveload_lol.cpp | 2 +- engines/kyra/script_lol.cpp | 2 +- engines/kyra/sequences_lol.cpp | 13 +++++++++++-- engines/kyra/sprites_lol.cpp | 19 +++++-------------- engines/kyra/staticres.cpp | 2 +- engines/kyra/staticres_eob.cpp | 32 ++++++++++++++++---------------- engines/kyra/staticres_lol.cpp | 21 ++++++++++++--------- 14 files changed, 79 insertions(+), 67 deletions(-) (limited to 'engines') diff --git a/engines/kyra/eobcommon.h b/engines/kyra/eobcommon.h index e42130cde0..70200d3049 100644 --- a/engines/kyra/eobcommon.h +++ b/engines/kyra/eobcommon.h @@ -722,21 +722,21 @@ protected: void gui_processWeaponSlotClickRight(int charIndex, int slotIndex); void gui_processInventorySlotClick(int slot); - static const int16 _buttonList1[]; + static const uint8 _buttonList1[]; int _buttonList1Size; - static const int16 _buttonList2[]; + static const uint8 _buttonList2[]; int _buttonList2Size; - static const int16 _buttonList3[]; + static const uint8 _buttonList3[]; int _buttonList3Size; - static const int16 _buttonList4[]; + static const uint8 _buttonList4[]; int _buttonList4Size; - static const int16 _buttonList5[]; + static const uint8 _buttonList5[]; int _buttonList5Size; - static const int16 _buttonList6[]; + static const uint8 _buttonList6[]; int _buttonList6Size; - static const int16 _buttonList7[]; + static const uint8 _buttonList7[]; int _buttonList7Size; - static const int16 _buttonList8[]; + static const uint8 _buttonList8[]; int _buttonList8Size; const EoBGuiButtonDef *_buttonDefs; diff --git a/engines/kyra/gui_lol.cpp b/engines/kyra/gui_lol.cpp index 8b95230b88..38478aa8d2 100644 --- a/engines/kyra/gui_lol.cpp +++ b/engines/kyra/gui_lol.cpp @@ -322,7 +322,7 @@ void LoLEngine::gui_changeCharacterStats(int charNum) { void LoLEngine::gui_drawCharInventoryItem(int itemIndex) { static const uint8 slotShapes[] = { 0x30, 0x34, 0x30, 0x34, 0x2E, 0x2F, 0x32, 0x33, 0x31, 0x35, 0x35 }; - + //2Eh, 32h, 2Eh, 32h, 2Ch, 2Dh, 30h, 31h, 2Fh, 33h, 33h const uint8 *coords = &_charInvDefs[_charInvIndex[_characters[_selectedCharacter].raceClassSex] * 22 + itemIndex * 2]; uint8 x = *coords++; uint8 y = *coords; diff --git a/engines/kyra/gui_rpg.cpp b/engines/kyra/gui_rpg.cpp index 71c1d1ddb5..ab25f95df8 100644 --- a/engines/kyra/gui_rpg.cpp +++ b/engines/kyra/gui_rpg.cpp @@ -76,8 +76,8 @@ void KyraRpgEngine::gui_drawHorizontalBarGraph(int x, int y, int w, int h, int32 screen()->fillRect(x + t, y, x + w - 1, y + h, col2); } -void KyraRpgEngine::gui_initButtonsFromList(const int16 *list) { - while (*list != -1) +void KyraRpgEngine::gui_initButtonsFromList(const uint8 *list) { + while (*list != 0xFF) gui_initButton(*list++); } diff --git a/engines/kyra/kyra_rpg.h b/engines/kyra/kyra_rpg.h index 2615875f4d..cd36d2a5cd 100644 --- a/engines/kyra/kyra_rpg.h +++ b/engines/kyra/kyra_rpg.h @@ -283,7 +283,7 @@ protected: void removeInputTop(); void gui_drawBox(int x, int y, int w, int h, int frameColor1, int frameColor2, int fillColor); virtual void gui_drawHorizontalBarGraph(int x, int y, int w, int h, int32 curVal, int32 maxVal, int col1, int col2); - void gui_initButtonsFromList(const int16 *list); + void gui_initButtonsFromList(const uint8 *list); virtual void gui_initButton(int index, int x = -1, int y = -1, int val = -1) = 0; void gui_resetButtonList(); void gui_notifyButtonListChanged(); diff --git a/engines/kyra/lol.cpp b/engines/kyra/lol.cpp index aa4e7a212a..d1da375ed0 100644 --- a/engines/kyra/lol.cpp +++ b/engines/kyra/lol.cpp @@ -3356,7 +3356,9 @@ int LoLEngine::battleHitSkillTest(int16 attacker, int16 target, int skill) { } if (target & 0x8000) { - evadeChanceModifier = (_monsterModifiers[9 + _monsterDifficulty] * _monsters[target & 0x7FFF].properties->fightingStats[3]) >> 8; + evadeChanceModifier = _monsters[target & 0x7FFF].properties->fightingStats[3]; + if (_monsterModifiers4) + evadeChanceModifier = (evadeChanceModifier * _monsterModifiers4[_monsterDifficulty]) >> 8; _monsters[target & 0x7FFF].flags |= 0x10; } else { evadeChanceModifier = _characters[target].defaultModifiers[3]; diff --git a/engines/kyra/lol.h b/engines/kyra/lol.h index d8df6b6703..9a251f0652 100644 --- a/engines/kyra/lol.h +++ b/engines/kyra/lol.h @@ -558,14 +558,14 @@ private: int clickedStatusIcon(Button *button); const LoLButtonDef *_buttonData; - const int16 *_buttonList1; - const int16 *_buttonList2; - const int16 *_buttonList3; - const int16 *_buttonList4; - const int16 *_buttonList5; - const int16 *_buttonList6; - const int16 *_buttonList7; - const int16 *_buttonList8; + const uint8 *_buttonList1; + const uint8 *_buttonList2; + const uint8 *_buttonList3; + const uint8 *_buttonList4; + const uint8 *_buttonList5; + const uint8 *_buttonList6; + const uint8 *_buttonList7; + const uint8 *_buttonList8; // text int characterSays(int track, int charId, bool redraw); @@ -1137,7 +1137,11 @@ private: uint16 _monsterCurBlock; int _objectLastDirection; - const uint16 *_monsterModifiers; + const uint16 *_monsterModifiers1; + const uint16 *_monsterModifiers2; + const uint16 *_monsterModifiers3; + const uint16 *_monsterModifiers4; + const int8 *_monsterShiftOffs; const uint8 *_monsterDirFlags; const uint8 *_monsterScaleX; diff --git a/engines/kyra/resource.h b/engines/kyra/resource.h index 5364cce270..5c179a7864 100644 --- a/engines/kyra/resource.h +++ b/engines/kyra/resource.h @@ -679,7 +679,10 @@ enum KyraResources { kLoLCharDefsKieran, kLoLCharDefsAkshel, kLoLExpRequirements, - kLoLMonsterModifiers, + kLoLMonsterModifiers1, + kLoLMonsterModifiers2, + kLoLMonsterModifiers3, + kLoLMonsterModifiers4, kLoLMonsterShiftOffsets, kLoLMonsterDirFlags, kLoLMonsterScaleY, diff --git a/engines/kyra/saveload_lol.cpp b/engines/kyra/saveload_lol.cpp index 58e3d94c78..6c83ebd51b 100644 --- a/engines/kyra/saveload_lol.cpp +++ b/engines/kyra/saveload_lol.cpp @@ -547,7 +547,7 @@ void LoLEngine::restoreTempDataAdjustMonsterStrength(int index) { if (_lvlTempData[index]->monsterDifficulty == _monsterDifficulty) return; - uint16 d = (_monsterModifiers[_lvlTempData[index]->monsterDifficulty] << 8) / _monsterModifiers[_monsterDifficulty]; + uint16 d = (_monsterModifiers1[_lvlTempData[index]->monsterDifficulty] << 8) / _monsterModifiers1[_monsterDifficulty]; for (int i = 0; i < 30; i++) { if (_monsters[i].mode >= 14 || _monsters[i].block == 0 || _monsters[i].hitPoints <= 0) diff --git a/engines/kyra/script_lol.cpp b/engines/kyra/script_lol.cpp index e9fc1c7971..0bbe66f530 100644 --- a/engines/kyra/script_lol.cpp +++ b/engines/kyra/script_lol.cpp @@ -823,7 +823,7 @@ int LoLEngine::olol_initMonster(EMCState *script) { l->type = stackPos(4); l->properties = &_monsterProperties[l->type]; l->direction = l->facing << 1; - l->hitPoints = (l->properties->hitPoints * _monsterModifiers[_monsterDifficulty]) >> 8; + l->hitPoints = (l->properties->hitPoints * _monsterModifiers1[_monsterDifficulty]) >> 8; if (_currentLevel != 12 || l->type != 2) l->hitPoints = (l->hitPoints * (rollDice(1, 128) + 192)) >> 8; diff --git a/engines/kyra/sequences_lol.cpp b/engines/kyra/sequences_lol.cpp index 3ff25d970c..7cdcc987eb 100644 --- a/engines/kyra/sequences_lol.cpp +++ b/engines/kyra/sequences_lol.cpp @@ -145,7 +145,12 @@ void LoLEngine::setupPrologueData(bool load) { static const char *const fileListFloppy[] = { "INTRO.PAK", "INTROVOC.PAK", 0 }; - const char *const *fileList = _flags.isTalkie ? fileListCD : fileListFloppy; + + static const char *const fileListTowns[] = { + "INTRO.PAK", "TINTROVO.PAK", 0 + }; + + const char *const *fileList = _flags.isTalkie ? fileListCD : (_flags.platform == Common::kPlatformFMTowns ? fileListTowns : fileListFloppy); char filename[32]; for (uint i = 0; fileList[i]; ++i) { @@ -1015,7 +1020,11 @@ void LoLEngine::setupEpilogueData(bool load) { "GENERAL.PAK", "INTRO.PAK", "FINALE1.PAK", "FINALE2.PAK", 0 }; - const char *const *fileList = _flags.isTalkie ? fileListCD : fileListFloppy; + static const char *const fileListTowns[] = { + "GENERAL.PAK", "INTRO.PAK", "FINALE1.PAK", "TFINALE2.PAK", 0 + }; + + const char *const *fileList = _flags.isTalkie ? fileListCD : (_flags.platform == Common::kPlatformFMTowns ? fileListTowns : fileListFloppy); assert(fileList); char filename[32]; diff --git a/engines/kyra/sprites_lol.cpp b/engines/kyra/sprites_lol.cpp index 9b602d9dc4..88b24e1367 100644 --- a/engines/kyra/sprites_lol.cpp +++ b/engines/kyra/sprites_lol.cpp @@ -481,19 +481,8 @@ int LoLEngine::calcMonsterSkillLevel(int id, int a) { const uint16 *c = getCharacterOrMonsterStats(id); int r = (a << 8) / c[4]; - /* - if (!(id & 0x8000)) - r = (r * _monsterModifiers[3 + _monsterDifficulty]) >> 8; - - id &= 0x7FFF; - - if (_characters[id].skillLevels[1] <= 3) - return r; - else if (_characters[id].skillLevels[1] <= 7) - return (r- (r >> 2));*/ - if (id & 0x8000) { - r = (r * _monsterModifiers[3 + _monsterDifficulty]) >> 8; + r = (r * _monsterModifiers2[3 + _monsterDifficulty]) >> 8; } else { if (_characters[id].skillLevels[1] > 7) r = (r - (r >> 1)); @@ -708,7 +697,9 @@ int LoLEngine::getMonsterCurFrame(LoLMonster *m, uint16 dirFlags) { break; case 1: // monsters whose outward appearance reflects the damage they have taken - tmp = (m->properties->hitPoints * _monsterModifiers[_monsterDifficulty]) >> 8; + tmp = m->properties->hitPoints; + if (_flags.isTalkie) + tmp = (tmp * _monsterModifiers1[_monsterDifficulty]) >> 8; if (m->hitPoints > (tmp >> 1)) tmp = 0; else if (m->hitPoints > (tmp >> 2)) @@ -1127,7 +1118,7 @@ void LoLEngine::updateMonster(LoLMonster *monster) { // first recovery phase after delivering an attack if (++monster->fightCurTick > 2) { setMonsterMode(monster, 5); - monster->fightCurTick = (int8)((((8 << 8) / monster->properties->fightingStats[4]) * _monsterModifiers[6 + _monsterDifficulty]) >> 8); + monster->fightCurTick = (int8)((((8 << 8) / monster->properties->fightingStats[4]) * _monsterModifiers3[_monsterDifficulty]) >> 8); } checkSceneUpdateNeed(monster->block); break; diff --git a/engines/kyra/staticres.cpp b/engines/kyra/staticres.cpp index 38481d9ac6..bac31f0a3e 100644 --- a/engines/kyra/staticres.cpp +++ b/engines/kyra/staticres.cpp @@ -39,7 +39,7 @@ namespace Kyra { -#define RESFILE_VERSION 83 +#define RESFILE_VERSION 84 namespace { bool checkKyraDat(Common::SeekableReadStream *file) { diff --git a/engines/kyra/staticres_eob.cpp b/engines/kyra/staticres_eob.cpp index 872ab40143..e0a2862dea 100644 --- a/engines/kyra/staticres_eob.cpp +++ b/engines/kyra/staticres_eob.cpp @@ -220,44 +220,44 @@ const uint8 EoBCoreEngine::_wallOfForceShapeDefs[] = { 0x0C, 0x00, 0x05, 0x10 }; -const int16 EoBCoreEngine::_buttonList1[] = { +const uint8 EoBCoreEngine::_buttonList1[] = { 58, 0, 1, 2, 3, 90, 91, 4, 5, 6, 7, 8, 9, 10, 11, 12, 78, 79, 13, 14, 15, 16, - 80, 81, 17, 18, 19, 20, 82, 83, 49, 50, 51, 52, 53, 54, 56, 57, -1 + 80, 81, 17, 18, 19, 20, 82, 83, 49, 50, 51, 52, 53, 54, 56, 57, 255 }; -const int16 EoBCoreEngine::_buttonList2[] = { +const uint8 EoBCoreEngine::_buttonList2[] = { 58, 61, 62, 63, 64, 65, 93, 94, 66, 67, 68, 69, 70, 71, 76, 77, 88, 0, 1, 2, 3, 90, 91, 4, 5, 6, 7, 8, 9, 10, 11, 12, 78, 79, 13, 14, 15, 16, 80, 81, 17, 18, - 19, 20, 82, 83, 49, 50, 51, 52, 53, 54, 56, 57, -1 + 19, 20, 82, 83, 49, 50, 51, 52, 53, 54, 56, 57, 255 }; -const int16 EoBCoreEngine::_buttonList3[] = { +const uint8 EoBCoreEngine::_buttonList3[] = { 58, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 84, 85, 46, 47, 48, 60, 59, 92, 4, 5, 6, 7, 8, 49, 50, - 51, 52, 53, 54, 56, 57, -1 + 51, 52, 53, 54, 56, 57, 255 }; -const int16 EoBCoreEngine::_buttonList4[] = { - 58, 47, 48, 60, 59, 92, 4, 5, 6, 7, 8, 49, 50, 51, 52, 53, 54, 56, 57, -1 +const uint8 EoBCoreEngine::_buttonList4[] = { + 58, 47, 48, 60, 59, 92, 4, 5, 6, 7, 8, 49, 50, 51, 52, 53, 54, 56, 57, 255 }; -const int16 EoBCoreEngine::_buttonList5[] = { +const uint8 EoBCoreEngine::_buttonList5[] = { 58, 61, 62, 63, 64, 65, 93, 66, 67, 68, 69, 70, 71, 88, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 84, - 85, 46, 47, 48, 60, 59, 92, 4, 5, 6, 7, 8, 49, 50, 51, 52, 53, 54, 56, 57, -1 + 85, 46, 47, 48, 60, 59, 92, 4, 5, 6, 7, 8, 49, 50, 51, 52, 53, 54, 56, 57, 255 }; -const int16 EoBCoreEngine::_buttonList6[] = { +const uint8 EoBCoreEngine::_buttonList6[] = { 58, 61, 62, 63, 64, 65, 93, 66, 67, 68, 69, 70, 71, 88, 46, 47, 48, 60, 59, 92, - 4, 5, 6, 7, 8, 49, 50, 51, 52, 53, 54, 56, 57, -1 + 4, 5, 6, 7, 8, 49, 50, 51, 52, 53, 54, 56, 57, 255 }; -const int16 EoBCoreEngine::_buttonList7[] = { - 17, 18, 19, 20, 82, 83, 55, -1 +const uint8 EoBCoreEngine::_buttonList7[] = { + 17, 18, 19, 20, 82, 83, 55, 255 }; -const int16 EoBCoreEngine::_buttonList8[] = { - 72, 73, 74, 75, 86, 87, 89, -1 +const uint8 EoBCoreEngine::_buttonList8[] = { + 72, 73, 74, 75, 86, 87, 89, 255 }; const uint8 EoBCoreEngine::_clock2Timers[] = { diff --git a/engines/kyra/staticres_lol.cpp b/engines/kyra/staticres_lol.cpp index 6b3064558c..ff104bf66b 100644 --- a/engines/kyra/staticres_lol.cpp +++ b/engines/kyra/staticres_lol.cpp @@ -261,7 +261,10 @@ void LoLEngine::initStaticResource() { _charDefsKieran = _staticres->loadRawDataBe16(kLoLCharDefsKieran, tempSize); _charDefsAkshel = _staticres->loadRawDataBe16(kLoLCharDefsAkshel, tempSize); _expRequirements = (const int32 *)_staticres->loadRawDataBe32(kLoLExpRequirements, tempSize); - _monsterModifiers = _staticres->loadRawDataBe16(kLoLMonsterModifiers, tempSize); + _monsterModifiers1 = _staticres->loadRawDataBe16(kLoLMonsterModifiers1, tempSize); + _monsterModifiers2 = _staticres->loadRawDataBe16(kLoLMonsterModifiers2, tempSize); + _monsterModifiers3 = _staticres->loadRawDataBe16(kLoLMonsterModifiers3, tempSize); + _monsterModifiers4 = _staticres->loadRawDataBe16(kLoLMonsterModifiers4, tempSize); _monsterShiftOffs = (const int8 *)_staticres->loadRawData(kLoLMonsterShiftOffsets, tempSize); _monsterDirFlags = _staticres->loadRawData(kLoLMonsterDirFlags, tempSize); _monsterScaleX = _staticres->loadRawData(kLoLMonsterScaleX, tempSize); @@ -304,14 +307,14 @@ void LoLEngine::initStaticResource() { } _buttonData = _staticres->loadButtonDefs(kLoLButtonDefs, tempSize); - _buttonList1 = (const int16 *)_staticres->loadRawDataBe16(kLoLButtonList1, tempSize); - _buttonList2 = (const int16 *)_staticres->loadRawDataBe16(kLoLButtonList2, tempSize); - _buttonList3 = (const int16 *)_staticres->loadRawDataBe16(kLoLButtonList3, tempSize); - _buttonList4 = (const int16 *)_staticres->loadRawDataBe16(kLoLButtonList4, tempSize); - _buttonList5 = (const int16 *)_staticres->loadRawDataBe16(kLoLButtonList5, tempSize); - _buttonList6 = (const int16 *)_staticres->loadRawDataBe16(kLoLButtonList6, tempSize); - _buttonList7 = (const int16 *)_staticres->loadRawDataBe16(kLoLButtonList7, tempSize); - _buttonList8 = (const int16 *)_staticres->loadRawDataBe16(kLoLButtonList8, tempSize); + _buttonList1 = _staticres->loadRawData(kLoLButtonList1, tempSize); + _buttonList2 = _staticres->loadRawData(kLoLButtonList2, tempSize); + _buttonList3 = _staticres->loadRawData(kLoLButtonList3, tempSize); + _buttonList4 = _staticres->loadRawData(kLoLButtonList4, tempSize); + _buttonList5 = _staticres->loadRawData(kLoLButtonList5, tempSize); + _buttonList6 = _staticres->loadRawData(kLoLButtonList6, tempSize); + _buttonList7 = _staticres->loadRawData(kLoLButtonList7, tempSize); + _buttonList8 = _staticres->loadRawData(kLoLButtonList8, tempSize); _autoMapStrings = _staticres->loadRawDataBe16(kLoLMapStringId, tempSize); -- cgit v1.2.3