From a944990a6896e9e667e987a3cb3d3d8affc0e5b3 Mon Sep 17 00:00:00 2001 From: athrxx Date: Sun, 6 Nov 2011 23:06:05 +0100 Subject: KYRA: (EOB) - rename some saving throw related data --- engines/kyra/chargen.cpp | 2 +- engines/kyra/eobcommon.cpp | 24 ++++++++++++------------ engines/kyra/eobcommon.h | 12 ++++++------ engines/kyra/resource.h | 14 +++++++------- engines/kyra/staticres_eob.cpp | 16 ++++++++-------- 5 files changed, 34 insertions(+), 34 deletions(-) (limited to 'engines') diff --git a/engines/kyra/chargen.cpp b/engines/kyra/chargen.cpp index 5231093133..a288359092 100644 --- a/engines/kyra/chargen.cpp +++ b/engines/kyra/chargen.cpp @@ -639,7 +639,7 @@ void CharacterGenerator::generateStats(int index) { _chargenMaxStats[i] = _chargenRaceMaxStats[rc * 6 + i]; } - if (_vm->_charClassModUnk[c->cClass]) + if (_vm->_charClassModifier[c->cClass]) _chargenMaxStats[0] = 18; uint16 sv[6]; diff --git a/engines/kyra/eobcommon.cpp b/engines/kyra/eobcommon.cpp index 9e75be017c..6f58d3a4f6 100644 --- a/engines/kyra/eobcommon.cpp +++ b/engines/kyra/eobcommon.cpp @@ -157,7 +157,7 @@ EobCoreEngine::EobCoreEngine(OSystem *system, const GameFlags &flags) : LolEobBa _mainMenuStrings = _levelGainStrings = _monsterSpecAttStrings = _characterGuiStringsHp = _characterGuiStringsWp = _characterGuiStringsWr = _characterGuiStringsSt = _characterGuiStringsIn = _characterStatusStrings7 = _characterStatusStrings8 = _characterStatusStrings9 = _characterStatusStrings12 = _characterStatusStrings13 = 0; - _classModifierFlags = _constModLevelIndex = _constModDiv = _constModExt = _wandTypes = _drawObjPosIndex = _flightObjFlipIndex = _expObjectTblIndex = + _classModifierFlags = _saveThrowLevelIndex = _saveThrowModDiv = _saveThrowModExt = _wandTypes = _drawObjPosIndex = _flightObjFlipIndex = _expObjectTblIndex = _expObjectShpStart = _expObjectTlMode = _expObjectAnimTbl1 = _expObjectAnimTbl2 = _expObjectAnimTbl3 = 0; _monsterStepTable0 = _monsterStepTable1 = _monsterStepTable2 = _monsterStepTable3 = _projectileWeaponAmmoTypes = _flightObjShpMap = _flightObjSclIndex = 0; _monsterCloseAttPosTable1 = _monsterCloseAttPosTable2 = _monsterCloseAttChkTable1 = _monsterCloseAttChkTable2 = _monsterCloseAttDstTable1 = _monsterCloseAttDstTable2 = 0; @@ -190,7 +190,7 @@ EobCoreEngine::EobCoreEngine(OSystem *system, const GameFlags &flags) : LolEobBa _mnNumWord = _numSpells = _mageSpellListSize = _spellLevelsMageSize = _spellLevelsClericSize = 0; _inventorySlotsX = _slotValidationFlags = _encodeMonsterShpTable = 0; memset(_expRequirementTables, 0, sizeof(_expRequirementTables)); - memset(_constModTables, 0, sizeof(_constModTables)); + memset(_saveThrowTables, 0, sizeof(_saveThrowTables)); memset(_doorType, 0, sizeof(_doorType)); memset(_noDoorSwitch, 0, sizeof(_noDoorSwitch)); memset(_scriptTimers, 0, sizeof(_scriptTimers)); @@ -1867,7 +1867,7 @@ int EobCoreEngine::calcCharacterDamage(int charIndex, int times, int itemOrPips, EobCharacter *c = &_characters[charIndex]; if (savingThrowType != 5) { - if (trySavingThrow(c, _charClassModUnk[c->cClass], c->level[0], savingThrowType, c->raceSex >> 1 /*fix bug in original code by adding a right shift*/)) + if (trySavingThrow(c, _charClassModifier[c->cClass], c->level[0], savingThrowType, c->raceSex >> 1 /*fix bug in original code by adding a right shift*/)) s = savingThrowReduceDamage(savingThrowEffect, s); } @@ -2197,7 +2197,7 @@ bool EobCoreEngine::trySavingThrow(void *target, int hpModifier, int level, int if (type == 5) return false; - int s = getConstModifierTableValue(hpModifier, level, type); + int s = getSaveThrowModifier(hpModifier, level, type); if (((race == 3 || race == 5) && (type == 4 || type == 1 || type == 0)) || (race == 4 && (type == 4 || type == 1))) { EobCharacter *c = (EobCharacter*)target; s -= constMod[c->constitutionCur]; @@ -2207,15 +2207,15 @@ bool EobCoreEngine::trySavingThrow(void *target, int hpModifier, int level, int } bool EobCoreEngine::specialAttackSavingThrow(int charIndex, int type) { - return trySavingThrow(&_characters[charIndex], _charClassModUnk[_characters[charIndex].cClass], _characters[charIndex].level[0], type, _characters[charIndex].raceSex >> 1); + return trySavingThrow(&_characters[charIndex], _charClassModifier[_characters[charIndex].cClass], _characters[charIndex].level[0], type, _characters[charIndex].raceSex >> 1); } -int EobCoreEngine::getConstModifierTableValue(int hpModifier, int level, int b) { - const uint8 *tbl = _constModTables[hpModifier]; - if (_constModLevelIndex[hpModifier] < level) - level = _constModLevelIndex[hpModifier]; - level /= _constModDiv[hpModifier]; - level += (_constModExt[hpModifier] * b); +int EobCoreEngine::getSaveThrowModifier(int hpModifier, int level, int type) { + const uint8 *tbl = _saveThrowTables[hpModifier]; + if (_saveThrowLevelIndex[hpModifier] < level) + level = _saveThrowLevelIndex[hpModifier]; + level /= _saveThrowModDiv[hpModifier]; + level += (_saveThrowModExt[hpModifier] * type); return tbl[level]; } @@ -2281,7 +2281,7 @@ int EobCoreEngine::getMonsterAcHitChanceModifier(int charIndex, int monsterAc) { static const uint8 mod2[] = { 1, 1, 2, 1 }; int l = _characters[charIndex].level[0] - 1; - int cm = _charClassModUnk[_characters[charIndex].cClass]; + int cm = _charClassModifier[_characters[charIndex].cClass]; return (20 - ((l / mod1[cm]) * mod2[cm])) - monsterAc; } diff --git a/engines/kyra/eobcommon.h b/engines/kyra/eobcommon.h index 795b0178d2..e4c06fefcd 100644 --- a/engines/kyra/eobcommon.h +++ b/engines/kyra/eobcommon.h @@ -326,7 +326,7 @@ protected: static const uint8 _hpIncrPerLevel[]; static const uint8 _numLevelsPerClass[]; static const int16 _hpConstModifiers[]; - static const uint8 _charClassModUnk[]; + static const uint8 _charClassModifier[]; const uint8 *_classModifierFlags; @@ -406,10 +406,10 @@ protected: const char *const *_levelGainStrings; const uint32 *_expRequirementTables[6]; - const uint8 *_constModTables[6]; - const uint8 *_constModLevelIndex; - const uint8 *_constModDiv; - const uint8 *_constModExt; + const uint8 *_saveThrowTables[6]; + const uint8 *_saveThrowLevelIndex; + const uint8 *_saveThrowModDiv; + const uint8 *_saveThrowModExt; const EobCharacter *_npcPreset; int _npcSequenceSub; @@ -891,7 +891,7 @@ protected: int calcDamageModifers(int charIndex, EobMonsterInPlay *m, int item, int itemType, int useStrModifier); bool trySavingThrow(void *target, int hpModifier, int level, int type, int race); bool specialAttackSavingThrow(int charIndex, int type); - int getConstModifierTableValue(int hpModifier, int level, int b); + int getSaveThrowModifier(int hpModifier, int level, int type); bool calcDamageCheckItemType(int itemType); int savingThrowReduceDamage(int savingThrowEffect, int damage); bool tryMonsterAttackEvasion(EobMonsterInPlay *m); diff --git a/engines/kyra/resource.h b/engines/kyra/resource.h index a7060cdf6d..8edfd0a174 100644 --- a/engines/kyra/resource.h +++ b/engines/kyra/resource.h @@ -277,13 +277,13 @@ enum KyraResources { kEobBaseChargenRaceMinStats, kEobBaseChargenRaceMaxStats, - kEobBaseConstModTable1, - kEobBaseConstModTable2, - kEobBaseConstModTable3, - kEobBaseConstModTable4, - kEobBaseConstModLvlIndex, - kEobBaseConstModDiv, - kEobBaseConstModExt, + kEobBaseSaveThrowTable1, + kEobBaseSaveThrowTable2, + kEobBaseSaveThrowTable3, + kEobBaseSaveThrowTable4, + kEobBaseSaveThrwLvlIndex, + kEobBaseSaveThrwModDiv, + kEobBaseSaveThrwModExt, kEobBasePryDoorStrings, kEobBaseWarningStrings, diff --git a/engines/kyra/staticres_eob.cpp b/engines/kyra/staticres_eob.cpp index 72b09e45b4..ec5d184c28 100644 --- a/engines/kyra/staticres_eob.cpp +++ b/engines/kyra/staticres_eob.cpp @@ -274,7 +274,7 @@ const int8 EobCoreEngine::_characterClassType[] = { const int16 EobCoreEngine::_hpConstModifiers[] = { -1, -3, -2, -2, -1, -1, -1, 0, 0, 0, 0, 0, 0, 0, 0, 1, 2, 3, 4, 5, 6, 6, 6, 7, 7 }; -const uint8 EobCoreEngine::_charClassModUnk[] = { +const uint8 EobCoreEngine::_charClassModifier[] = { 0x00, 0x00, 0x00, 0x01, 0x02, 0x03, 0x00, 0x00, 0x00, 0x00, 0x03, 0x02, 0x00, 0x00, 0x02 }; @@ -436,13 +436,13 @@ void EobCoreEngine::initStaticResource() { _classModifierFlags = _staticres->loadRawData(kEobBaseClassModifierFlags, temp); - _constModTables[0] = _constModTables[4] = _constModTables[5] = _staticres->loadRawData(kEobBaseConstModTable1, temp); - _constModTables[1] = _staticres->loadRawData(kEobBaseConstModTable2, temp); - _constModTables[2] = _staticres->loadRawData(kEobBaseConstModTable3, temp); - _constModTables[3] = _staticres->loadRawData(kEobBaseConstModTable4, temp); - _constModLevelIndex = _staticres->loadRawData(kEobBaseConstModLvlIndex, temp); - _constModDiv = _staticres->loadRawData(kEobBaseConstModDiv, temp); - _constModExt = _staticres->loadRawData(kEobBaseConstModExt, temp); + _saveThrowTables[0] = _saveThrowTables[4] = _saveThrowTables[5] = _staticres->loadRawData(kEobBaseSaveThrowTable1, temp); + _saveThrowTables[1] = _staticres->loadRawData(kEobBaseSaveThrowTable2, temp); + _saveThrowTables[2] = _staticres->loadRawData(kEobBaseSaveThrowTable3, temp); + _saveThrowTables[3] = _staticres->loadRawData(kEobBaseSaveThrowTable4, temp); + _saveThrowLevelIndex = _staticres->loadRawData(kEobBaseSaveThrwLvlIndex, temp); + _saveThrowModDiv = _staticres->loadRawData(kEobBaseSaveThrwModDiv, temp); + _saveThrowModExt = _staticres->loadRawData(kEobBaseSaveThrwModExt, temp); _encodeMonsterShpTable = _staticres->loadRawDataBe16(kEobBaseEncodeMonsterDefs, temp); _npcPreset = _staticres->loadEobNpcData(kEobBaseNpcPresets, temp); -- cgit v1.2.3