Skip to content

Commit

Permalink
KYRA: (EOB) - fix some bugs
Browse files Browse the repository at this point in the history
- fix monster movement
- fix character level gain
- add some static res for party transfer
  • Loading branch information
athrxx authored and Johannes Schickel committed Dec 26, 2011
1 parent b3c8173 commit f7032c1
Show file tree
Hide file tree
Showing 20 changed files with 130 additions and 64 deletions.
6 changes: 6 additions & 0 deletions devtools/create_kyradat/create_kyradat.cpp
Expand Up @@ -463,6 +463,8 @@ const ExtractFilename extractFilenames[] = {

// EYE OF THE BEHOLDER II
{ kEob2MainMenuStrings, kTypeStringList, true },
{ kEob2TransferConvertTable, kTypeRawData, false },
{ kEob2TransferExpTable, kLolTypeRaw32, false },

{ kEob2IntroStrings, k2TypeSfxList, true },
{ kEob2IntroCPSFiles, kTypeStringList, true },
Expand Down Expand Up @@ -1779,6 +1781,10 @@ const char *getIdString(const int id) {
return "kEob1Npc7Strings";
case kEob2MainMenuStrings:
return "kEob2MainMenuStrings";
case kEob2TransferConvertTable:
return "kEob2TransferConvertTable";
case kEob2TransferExpTable:
return "kEob2TransferExpTable";
case kEob2IntroStrings:
return "kEob2IntroStrings";
case kEob2IntroCPSFiles:
Expand Down
3 changes: 3 additions & 0 deletions devtools/create_kyradat/create_kyradat.h
Expand Up @@ -463,6 +463,9 @@ enum kExtractID {
kEob1Npc7Strings,

kEob2MainMenuStrings,
kEob2TransferConvertTable,
kEob2TransferExpTable,

kEob2IntroStrings,
kEob2IntroCPSFiles,
kEob2IntroSeqData00,
Expand Down
2 changes: 2 additions & 0 deletions devtools/create_kyradat/games.cpp
Expand Up @@ -1485,6 +1485,8 @@ const int eob2FloppyNeed[] = {
kEobBaseFlightObjSclIndex,

kEob2MainMenuStrings,
kEob2TransferConvertTable,
kEob2TransferExpTable,

kEob2IntroStrings,
kEob2IntroCPSFiles,
Expand Down
13 changes: 13 additions & 0 deletions devtools/create_kyradat/tables.cpp
Expand Up @@ -2649,6 +2649,16 @@ const ExtractEntrySearchData kEob2MainMenuStringsProvider[] = {
EXTRACT_END_ENTRY
};

const ExtractEntrySearchData kEob2TransferConvertTableProvider[] = {
{ UNK_LANG, kPlatformUnknown, { 0x00000031, 0x000004BC, { { 0x96, 0x53, 0xA2, 0xF1, 0x26, 0xFE, 0x1B, 0x5E, 0xDF, 0x62, 0x2C, 0x8C, 0xBD, 0x62, 0x5A, 0xF9 } } } },
EXTRACT_END_ENTRY
};

const ExtractEntrySearchData kEob2TransferExpTableProvider[] = {
{ UNK_LANG, kPlatformUnknown, { 0x00000018, 0x0000076B, { { 0x91, 0x65, 0x5B, 0x8D, 0xE8, 0x5B, 0x28, 0x32, 0x4D, 0x7A, 0x57, 0x8E, 0x18, 0x5B, 0x1A, 0xE9 } } } },
EXTRACT_END_ENTRY
};

const ExtractEntrySearchData kEob2IntroStringsProvider[] = {
{ EN_ANY, kPlatformUnknown, { 0x00000321, 0x0000DBC3, { { 0x11, 0x9B, 0x54, 0xB3, 0x34, 0xF0, 0xB5, 0xE1, 0xFA, 0x6A, 0x31, 0x02, 0x59, 0x29, 0xCA, 0x94 } } } },
{ DE_DEU, kPlatformUnknown, { 0x0000038E, 0x0001119C, { { 0x92, 0x63, 0x18, 0xDD, 0x9F, 0x62, 0xF5, 0xBC, 0x3D, 0x93, 0xDC, 0x6E, 0xE5, 0xBE, 0x8C, 0x0B } } } },
Expand Down Expand Up @@ -4078,6 +4088,9 @@ const ExtractEntry extractProviders[] = {
{ kEob1Npc7Strings, kEob1Npc7StringsProvider },

{ kEob2MainMenuStrings, kEob2MainMenuStringsProvider },
{ kEob2TransferConvertTable, kEob2TransferConvertTableProvider },
{ kEob2TransferExpTable, kEob2TransferExpTableProvider },

{ kEob2IntroStrings, kEob2IntroStringsProvider },
{ kEob2IntroCPSFiles, kEob2IntroCPSFilesProvider },
{ kEob2IntroSeqData00, kEob2IntroSeqData00Provider },
Expand Down
Binary file modified dists/engine-data/kyra.dat
Binary file not shown.
13 changes: 9 additions & 4 deletions engines/kyra/chargen.cpp
Expand Up @@ -108,10 +108,6 @@ class CharacterGenerator {
Screen_Eob *_screen;
};

bool EobCoreEngine::startCharacterGeneration() {
return CharacterGenerator(this, _screen).start(_characters, &_faceShapes);
}

CharacterGenerator::CharacterGenerator(EobCoreEngine *vm, Screen_Eob *screen) : _vm(vm), _screen(screen),
_characters(0), _faceShapes(0), _chargenMagicShapes(0), _chargenButtonLabels(0), _chargenMagicShapeTimer(0),
_updateBoxShapesIndex(0), _lastUpdateBoxShapesIndex(0), _magicShapesBox(6), _activeBox(0) {
Expand Down Expand Up @@ -1445,6 +1441,15 @@ const int16 CharacterGenerator::_raceModifiers[] = {
0, 0, 0, 0, 1, -1, 0, 1, -1, 0, 0, 0, -1, 0, 0, 1, 0, 0
};

bool EobCoreEngine::startCharacterGeneration() {
return CharacterGenerator(this, _screen).start(_characters, &_faceShapes);
}

bool EobCoreEngine::transferParty() {

return false;
}

} // End of namespace Kyra

#endif // ENABLE_EOB
4 changes: 2 additions & 2 deletions engines/kyra/eob1.cpp
Expand Up @@ -78,8 +78,8 @@ Common::Error EobEngine::init() {

_scriptTimersCount = 1;

_wllWallFlags[132] = 1;
_wllWallFlags[133] = 1;
//_wllWallFlags[132] = 1;
//_wllWallFlags[133] = 1;

return Common::kNoError;
}
Expand Down
30 changes: 21 additions & 9 deletions engines/kyra/eobcommon.cpp
Expand Up @@ -40,14 +40,16 @@ EobCoreEngine::EobCoreEngine(OSystem *system, const GameFlags &flags) : LolEobBa
_teleporterWallId(flags.gameID == GI_EOB1 ? 52 : 44) {
_screen = 0;
_gui = 0;
//_processingButtons=false;
//_runLoopUnk2 = 0;
//_runLoopTimerUnk = 0;

_playFinale = false;
_runFlag = true;
_configMouse = true;
_loading = false;

_envAudioTimer = 0;
_flashShapeTimer = 0;
_drawSceneTimer = 0;

_largeItemShapes = _smallItemShapes = _thrownItemShapes = _spellShapes = _firebeamShapes = _itemIconShapes =
_wallOfForceShapes = _teleporterShapes = _sparkShapes = _compassShapes = 0;
_redSplatShape = _greenSplatShape = _deadCharShape = _disabledCharGrid = _blackBoxSmallGrid =
Expand All @@ -60,6 +62,9 @@ EobCoreEngine::EobCoreEngine(OSystem *system, const GameFlags &flags) : LolEobBa
_beholderSpellList = 0;
_beholderSfx = 0;

_transferConvertTable = 0;
_transferExpTable = 0;

_faceShapes = 0;
_characters = 0;
_items = 0;
Expand Down Expand Up @@ -297,6 +302,13 @@ Common::Error EobCoreEngine::init() {
memset(&_wllShapeMap[3], -1, 5);
memset(&_wllShapeMap[13], -1, 5);

/*int clen = _flags.gameID == GI_EOB2 ? 80 : 70;
memcpy(&_wllShapeMap[256 - clen], _wllVmpMap, clen);
memcpy(&_specialWallTypes[256 - 2 * clen], _wllVmpMap, clen);
memcpy(&_specialWallTypes[256 - clen], _wllShapeMap, clen);
memcpy(&_wllWallFlags[256 - 2 * clen], _wllShapeMap, clen);
memcpy(&_wllWallFlags[256 - clen], _specialWallTypes, clen);*/

_wllVcnOffset = 16;

_monsters = new EobMonsterInPlay[30];
Expand Down Expand Up @@ -384,7 +396,9 @@ Common::Error EobCoreEngine::go() {
startupNew();
} else if (action == -3) {
// transfer party
repeatLoop = false;
repeatLoop = transferParty();
if (repeatLoop && !shouldQuit())
startupNew();
}
}

Expand Down Expand Up @@ -441,15 +455,13 @@ void EobCoreEngine::runLoop() {
_envAudioTimer = _system->getMillis() + (rollDice(1, 10, 3) * 18 * _tickLength);
_flashShapeTimer = 0;
_drawSceneTimer = _system->getMillis();
//__unkB__ = 1;

_screen->setFont(Screen::FID_6_FNT);
_screen->setScreenDim(7);

//_runLoopUnk2 = _currentBlock;
_runFlag = true;

while (!shouldQuit() && _runFlag) {
//_runLoopUnk2 = _currentBlock;
checkPartyStatus(true);
checkInput(_activeButtons, true, 0);
removeInputTop();
Expand Down Expand Up @@ -723,7 +735,7 @@ int EobCoreEngine::generateCharacterHitpointsByLevel(int charIndex, int levelInd

int EobCoreEngine::getClassAndConstHitpointsModifier(int cclass, int constitution) {
int res = _hpConstModifiers[constitution];

// This also applies to EOB1 despite being coded differently there
if (res <= 2 || (_classModifierFlags[cclass] & 0x31))
return res;

Expand Down Expand Up @@ -1176,7 +1188,7 @@ uint32 EobCoreEngine::getRequiredExperience(int cClass, int levelIndex, int leve

void EobCoreEngine::increaseCharacterLevel(int charIndex, int levelIndex) {
_characters[charIndex].level[levelIndex]++;
int hpInc = generateCharacterHitpointsByLevel(charIndex, levelIndex);
int hpInc = generateCharacterHitpointsByLevel(charIndex, 1 << levelIndex);
_characters[charIndex].hitPointsCur += hpInc;
_characters[charIndex].hitPointsMax += hpInc;

Expand Down
8 changes: 6 additions & 2 deletions engines/kyra/eobcommon.h
Expand Up @@ -317,8 +317,9 @@ friend class CharacterGenerator;
bool _runFlag;
//int _runLoopUnk2;

// Create Party
// Character generation / party transfer
bool startCharacterGeneration();
bool transferParty();

uint8 **_faceShapes;

Expand All @@ -329,6 +330,9 @@ friend class CharacterGenerator;
static const uint8 _charClassModUnk[];

const uint8 *_classModifierFlags;

const uint8 *_transferConvertTable;
const uint32 *_transferExpTable;

// timers
void setupTimers();
Expand Down Expand Up @@ -509,7 +513,7 @@ friend class CharacterGenerator;

void updateMonsters(int unit);
void updateMonsterDest(EobMonsterInPlay *m);
void updateMonsterDest2(EobMonsterInPlay *m);
void updateMonsterAttackMode(EobMonsterInPlay *m);
void updateAllMonsterDests();
void turnFriendlyMonstersHostile();
int getNextMonsterDirection(int curBlock, int destBlock);
Expand Down
4 changes: 1 addition & 3 deletions engines/kyra/gui_eob.cpp
Expand Up @@ -1978,8 +1978,6 @@ int GUI_Eob::processButtonList(Kyra::Button *buttonList, uint16 inputFlags, int8
if (!result)
result = inputFlags;

//_vm->_processingButtons=false;

return result;
}

Expand Down Expand Up @@ -2773,7 +2771,6 @@ int GUI_Eob::selectSaveSlotDialogue(int x, int y, int id) {

// Display highlighted slot index in the bottom left corner to avoid people getting lost with the 990 save slots
_screen->setFont(Screen::FID_6_FNT);
_screen->fillRect(_saveSlotX + 5, _saveSlotY + 135, _saveSlotX + 46, _saveSlotY + 140, _vm->_bkgColor_1);
int sli = (newHighlight == 6) ? _savegameOffset : (_savegameOffset + newHighlight);
_screen->printText(Common::String::format("%03d/989", sli).c_str(), _saveSlotX + 5, _saveSlotY + 135, _vm->_color2_1, _vm->_bkgColor_1);
_screen->setFont(Screen::FID_8_FNT);
Expand Down Expand Up @@ -3980,6 +3977,7 @@ void GUI_Eob::releaseButtons(Button *list) {
delete list;
list = n;
}
_vm->gui_notifyButtonListChanged();
}

void GUI_Eob::setupSaveMenuSlots() {
Expand Down
1 change: 1 addition & 0 deletions engines/kyra/lol.cpp
Expand Up @@ -1163,6 +1163,7 @@ void LoLEngine::setCharacterUpdateEvent(int charNum, int updateType, int updateD
l->characterUpdateEvents[i] = updateType;
l->characterUpdateDelay[i] = updateDelay;
_timer->setNextRun(3, _system->getMillis());
_timer->resetNextRun();
_timer->enable(3);
break;
}
Expand Down
16 changes: 8 additions & 8 deletions engines/kyra/loleobbase.cpp
Expand Up @@ -164,14 +164,14 @@ Common::Error LolEobBaseEngine::init() {
_levelBlockProperties = new LevelBlockProperty[1025];
memset(_levelBlockProperties, 0, 1025 * sizeof(LevelBlockProperty));

_wllVmpMap = new uint8[255];
memset(_wllVmpMap, 0, 255);
_wllShapeMap = new int8[255];
memset(_wllShapeMap, 0, 255);
_specialWallTypes = new uint8[255];
memset(_specialWallTypes, 0, 255);
_wllWallFlags = new uint8[255];
memset(_wllWallFlags, 0, 255);
_wllVmpMap = new uint8[256];
memset(_wllVmpMap, 0, 256);
_wllShapeMap = new int8[256];
memset(_wllShapeMap, 0, 256);
_specialWallTypes = new uint8[256];
memset(_specialWallTypes, 0, 256);
_wllWallFlags = new uint8[256];
memset(_wllWallFlags, 0, 256);

_blockDrawingBuffer = new uint16[1320];
memset(_blockDrawingBuffer, 0, 1320 * sizeof(uint16));
Expand Down
3 changes: 3 additions & 0 deletions engines/kyra/resource.h
Expand Up @@ -537,6 +537,9 @@ enum KyraResources {
kEob1Npc7Strings,

kEob2MainMenuStrings,
kEob2TransferConvertTable,
kEob2TransferExpTable,

kEob2IntroStrings,
kEob2IntroCPSFiles,
kEob2IntroSeqData00,
Expand Down
8 changes: 4 additions & 4 deletions engines/kyra/scene_eob.cpp
Expand Up @@ -1012,8 +1012,8 @@ void EobCoreEngine::drawScene(int refresh) {
}

if (_sceneDefaultUpdate) {
resetSkipFlag();
delayUntil(_drawSceneTimer);
removeInputTop();
}

if (refresh && !_partyResting)
Expand All @@ -1029,7 +1029,7 @@ void EobCoreEngine::drawScene(int refresh) {

if (_sceneDefaultUpdate) {
_sceneDefaultUpdate = false;
_drawSceneTimer = _system->getMillis() /*+ 4 * _tickLength*/;
_drawSceneTimer = _system->getMillis() + 4 * _tickLength;
}

_sceneUpdateRequired = false;
Expand Down Expand Up @@ -1141,8 +1141,8 @@ int EobCoreEngine::calcNewBlockPositionAndTestPassability(uint16 curBlock, uint1
int w = _levelBlockProperties[b].walls[direction ^ 2];
int f = _wllWallFlags[w];

if (!f)
assert((_flags.gameID == GI_EOB1 && w < 70) || (_flags.gameID == GI_EOB2 && w < 80));
//if (!f)
assert((_flags.gameID == GI_EOB1 && w < 70) || (_flags.gameID == GI_EOB2 && w < 80));

if (_flags.gameID == GI_EOB2 && w == 74 && _currentBlock == curBlock) {
for (int i = 0; i < 5; i++) {
Expand Down
24 changes: 13 additions & 11 deletions engines/kyra/screen_eob.cpp
Expand Up @@ -151,9 +151,6 @@ void Screen_Eob::loadShapeSetBitmap(const char *file, int tempPage, int destPage
}

void Screen_Eob::loadEobBitmap(const char *file, const uint8 *ditheringData, int tempPage, int destPage, int copyToPage) {
//Common::String tmp = file;
//if (_vm->game() == GI_EOB1 && tmp.equalsIgnoreCase("spider"))
// tmp += "1";
Common::String tmp = Common::String::format("%s.CPS", file);
Common::SeekableReadStream *s = _vm->resource()->createReadStream(tmp);
bool loadAlternative = false;
Expand All @@ -170,15 +167,20 @@ void Screen_Eob::loadEobBitmap(const char *file, const uint8 *ditheringData, int
}

if (loadAlternative) {
tmp.setChar('X', 0);
s = _vm->resource()->createReadStream(tmp);
if (!s)
error("Screen_Eob::loadEobBitmap(): CPS file loading failed.");
s->seek(768);
loadFileDataToPage(s, destPage, 64000);
delete s;
if (_vm->game() == GI_EOB1) {
tmp.insertChar('1', tmp.size() - 4);
loadBitmap(tmp.c_str(), tempPage, destPage, 0);
} else {
tmp.setChar('X', 0);
s = _vm->resource()->createReadStream(tmp);
if (!s)
error("Screen_Eob::loadEobBitmap(): CPS file loading failed.");
s->seek(768);
loadFileDataToPage(s, destPage, 64000);
delete s;
}
}

if (copyToPage == -1) {
return;
} else if (copyToPage == 0) {
Expand Down

0 comments on commit f7032c1

Please sign in to comment.