Skip to content

Commit

Permalink
KYRA: (EOB) - lots of fixes towards EOB1 playability
Browse files Browse the repository at this point in the history
also implement some new code (EOB1 portals, burning hands spell, etc.)
  • Loading branch information
athrxx authored and Johannes Schickel committed Dec 26, 2011
1 parent aab9e62 commit bac0cae
Show file tree
Hide file tree
Showing 26 changed files with 291 additions and 66 deletions.
9 changes: 9 additions & 0 deletions devtools/create_kyradat/create_kyradat.cpp
Expand Up @@ -332,11 +332,13 @@ const ExtractFilename extractFilenames[] = {
{ kEobBaseDscDoorScaleMult5, kTypeRawData, false },
{ kEobBaseDscDoorScaleMult6, kTypeRawData, false },
{ kEobBaseDscDoorType5Offs, kTypeRawData, false },
{ kEobBaseDscDoorXE, kTypeRawData, false },
{ kEobBaseDscDoorY1, kTypeRawData, false },
{ kEobBaseDscDoorY3, kTypeRawData, false },
{ kEobBaseDscDoorY4, kTypeRawData, false },
{ kEobBaseDscDoorY5, kTypeRawData, false },
{ kEobBaseDscDoorY6, kTypeRawData, false },
{ kEobBaseDscDoorY7, kTypeRawData, false },
{ kEobBaseDscDoorCoordsExt, kLolTypeRaw16, false },

{ kEobBaseDscItemPosIndex, kTypeRawData, false },
Expand Down Expand Up @@ -401,6 +403,7 @@ const ExtractFilename extractFilenames[] = {
{ kEobBaseSpellProperties, kTypeRawData, false },
{ kEobBaseMagicFlightProps, kTypeRawData, false },
{ kEobBaseTurnUndeadEffect, kTypeRawData, false },
{ kEobBaseBurningHandsDest, kTypeRawData, false },

// EYE OF THE BEHOLDER I
{ kEob1MainMenuStrings, kTypeStringList, true },
Expand Down Expand Up @@ -1516,6 +1519,8 @@ const char *getIdString(const int id) {
return "kEobBaseDscDoorScaleMult6";
case kEobBaseDscDoorType5Offs:
return "kEobBaseDscDoorType5Offs";
case kEobBaseDscDoorXE:
return "kEobBaseDscDoorXE";
case kEobBaseDscDoorY1:
return "kEobBaseDscDoorY1";
case kEobBaseDscDoorY3:
Expand All @@ -1526,6 +1531,8 @@ const char *getIdString(const int id) {
return "kEobBaseDscDoorY5";
case kEobBaseDscDoorY6:
return "kEobBaseDscDoorY6";
case kEobBaseDscDoorY7:
return "kEobBaseDscDoorY7";
case kEobBaseDscDoorCoordsExt:
return "kEobBaseDscDoorCoordsExt";
case kEobBaseDscItemPosIndex:
Expand Down Expand Up @@ -1635,6 +1642,8 @@ const char *getIdString(const int id) {
return "kEobBaseMagicFlightProps";
case kEobBaseTurnUndeadEffect:
return "kEobBaseTurnUndeadEffect";
case kEobBaseBurningHandsDest:
return "kEobBaseBurningHandsDest";
case kEob1MainMenuStrings:
return "kEob1MainMenuStrings";
case kEob1DoorShapeDefs:
Expand Down
3 changes: 3 additions & 0 deletions devtools/create_kyradat/create_kyradat.h
Expand Up @@ -332,11 +332,13 @@ enum kExtractID {
kEobBaseDscDoorScaleMult5,
kEobBaseDscDoorScaleMult6,
kEobBaseDscDoorType5Offs,
kEobBaseDscDoorXE,
kEobBaseDscDoorY1,
kEobBaseDscDoorY3,
kEobBaseDscDoorY4,
kEobBaseDscDoorY5,
kEobBaseDscDoorY6,
kEobBaseDscDoorY7,
kEobBaseDscDoorCoordsExt,

kEobBaseDscItemPosIndex,
Expand Down Expand Up @@ -402,6 +404,7 @@ enum kExtractID {
kEobBaseSpellProperties,
kEobBaseMagicFlightProps,
kEobBaseTurnUndeadEffect,
kEobBaseBurningHandsDest,

kEob1MainMenuStrings,
kEob1DoorShapeDefs,
Expand Down
5 changes: 4 additions & 1 deletion devtools/create_kyradat/games.cpp
Expand Up @@ -1189,6 +1189,7 @@ const int eob1FloppyNeed[] = {
kEobBaseSpellProperties,
kEobBaseMagicFlightProps,
kEobBaseTurnUndeadEffect,
kEobBaseBurningHandsDest,

kLolEobCommonDscDoorShapeIndex,
kEobBaseWllFlagPreset,
Expand All @@ -1200,12 +1201,13 @@ const int eob1FloppyNeed[] = {
kEobBaseDscDoorScaleMult4,
kEobBaseDscDoorScaleMult5,
kEobBaseDscDoorScaleMult6,
kEobBaseDscDoorXE,
kEobBaseDscDoorY1,
kLolEobCommonDscDoorY2,
kEobBaseDscDoorY3,
kEobBaseDscDoorY4,
kEobBaseDscDoorY5,
kEobBaseDscDoorY6,
kEobBaseDscDoorY7,
kEobBaseDscDoorCoordsExt,

kEobBaseDscItemPosIndex,
Expand Down Expand Up @@ -1408,6 +1410,7 @@ const int eob2FloppyNeed[] = {
kEobBaseSpellProperties,
kEobBaseMagicFlightProps,
kEobBaseTurnUndeadEffect,
kEobBaseBurningHandsDest,

kLolEobCommonDscDoorShapeIndex,
kEobBaseWllFlagPreset,
Expand Down
22 changes: 21 additions & 1 deletion devtools/create_kyradat/tables.cpp
Expand Up @@ -2001,6 +2001,11 @@ const ExtractEntrySearchData kEobBaseDscDoorType5OffsProvider[] = {
EXTRACT_END_ENTRY
};

const ExtractEntrySearchData kEobBaseDscDoorXEProvider[] = {
{ UNK_LANG, kPlatformPC, { 0x00000020, 0x0000010F, { { 0x7B, 0x7D, 0x03, 0xDE, 0x33, 0x95, 0xB8, 0xFD, 0xAD, 0x72, 0x44, 0x7D, 0x47, 0xFE, 0x04, 0x3D } } } },
EXTRACT_END_ENTRY
};

const ExtractEntrySearchData kEobBaseDscDoorY1Provider[] = {
{ UNK_LANG, kPlatformPC, { 0x00000004, 0x000000D7, { { 0x25, 0xAE, 0xF4, 0x99, 0xE8, 0x97, 0x47, 0xAE, 0x75, 0xF3, 0xA9, 0x70, 0x4C, 0x70, 0xF3, 0x11 } } } }, // EOB 1
{ UNK_LANG, kPlatformPC, { 0x00000004, 0x000000D8, { { 0xB4, 0xAA, 0x0D, 0x91, 0x58, 0x22, 0x16, 0xCF, 0xC5, 0x9D, 0x8D, 0xA1, 0xB4, 0x40, 0x83, 0x0E } } } }, // EOB 2
Expand All @@ -2027,6 +2032,11 @@ const ExtractEntrySearchData kEobBaseDscDoorY6Provider[] = {
EXTRACT_END_ENTRY
};

const ExtractEntrySearchData kEobBaseDscDoorY7Provider[] = {
{ UNK_LANG, kPlatformPC, { 0x00000004, 0x000000DA, { { 0xA9, 0x24, 0x71, 0x8A, 0x18, 0x24, 0x6D, 0x0A, 0x65, 0x12, 0xBB, 0x1F, 0xE7, 0x95, 0xC5, 0xA4 } } } },
EXTRACT_END_ENTRY
};

const ExtractEntrySearchData kEobBaseDscDoorCoordsExtProvider[] = {
{ UNK_LANG, kPlatformPC, { 0x00000048, 0x00000C8E, { { 0x2E, 0x0E, 0xB2, 0xAC, 0xE7, 0x0F, 0xDF, 0x38, 0xDF, 0x92, 0xB7, 0xB5, 0xA2, 0xFD, 0x40, 0x2D } } } },
EXTRACT_END_ENTRY
Expand Down Expand Up @@ -2340,7 +2350,14 @@ const ExtractEntrySearchData kEobBaseMagicFlightPropsProvider[] = {
};

const ExtractEntrySearchData kEobBaseTurnUndeadEffectProvider[] = {
{ UNK_LANG, kPlatformUnknown, { 0x0000008C, 0x00002E8B, { { 0x96, 0x15, 0x61, 0x12, 0x43, 0xCF, 0x3A, 0x84, 0x1A, 0x89, 0xB5, 0x32, 0x0D, 0xB3, 0x20, 0x67 } } } },
{ UNK_LANG, kPlatformPC, { 0x0000008C, 0x00002E8B, { { 0x96, 0x15, 0x61, 0x12, 0x43, 0xCF, 0x3A, 0x84, 0x1A, 0x89, 0xB5, 0x32, 0x0D, 0xB3, 0x20, 0x67 } } } },

EXTRACT_END_ENTRY
};

const ExtractEntrySearchData kEobBaseBurningHandsDestProvider[] = {
{ UNK_LANG, kPlatformPC, { 0x00000008, 0x0000000C, { { 0x61, 0xD7, 0xAB, 0xE1, 0x56, 0x54, 0x51, 0x5B, 0xD9, 0x59, 0x2D, 0x3D, 0xAE, 0xA4, 0x49, 0x31 } } } }, // EOB1
{ UNK_LANG, kPlatformPC, { 0x00000020, 0x0000003E, { { 0xA5, 0x8C, 0xCA, 0x13, 0xED, 0x0F, 0xB7, 0xA2, 0xD7, 0x9C, 0xCD, 0x11, 0x65, 0x11, 0x4B, 0xD8 } } } }, // EOB2

EXTRACT_END_ENTRY
};
Expand Down Expand Up @@ -3775,11 +3792,13 @@ const ExtractEntry extractProviders[] = {
{ kEobBaseDscDoorScaleMult5, kEobBaseDscDoorScaleMult5Provider },
{ kEobBaseDscDoorScaleMult6, kEobBaseDscDoorScaleMult6Provider },
{ kEobBaseDscDoorType5Offs, kEobBaseDscDoorType5OffsProvider },
{ kEobBaseDscDoorXE, kEobBaseDscDoorXEProvider },
{ kEobBaseDscDoorY1, kEobBaseDscDoorY1Provider },
{ kEobBaseDscDoorY3, kEobBaseDscDoorY3Provider },
{ kEobBaseDscDoorY4, kEobBaseDscDoorY4Provider },
{ kEobBaseDscDoorY5, kEobBaseDscDoorY5Provider },
{ kEobBaseDscDoorY6, kEobBaseDscDoorY6Provider },
{ kEobBaseDscDoorY7, kEobBaseDscDoorY7Provider },
{ kEobBaseDscDoorCoordsExt, kEobBaseDscDoorCoordsExtProvider },
{ kEobBaseDscItemPosIndex, kEobBaseDscItemPosIndexProvider },
{ kEobBaseDscItemShpX, kEobBaseDscItemShpXProvider },
Expand Down Expand Up @@ -3843,6 +3862,7 @@ const ExtractEntry extractProviders[] = {
{ kEobBaseSpellProperties, kEobBaseSpellPropertiesProvider },
{ kEobBaseMagicFlightProps, kEobBaseMagicFlightPropsProvider },
{ kEobBaseTurnUndeadEffect, kEobBaseTurnUndeadEffectProvider },
{ kEobBaseBurningHandsDest, kEobBaseBurningHandsDestProvider },

{ kEob1MainMenuStrings, kEob1MainMenuStringsProvider },
{ kEob1DoorShapeDefs, kEob1DoorShapeDefsProvider },
Expand Down
Binary file modified dists/engine-data/kyra.dat
Binary file not shown.
6 changes: 3 additions & 3 deletions engines/kyra/chargen.cpp
Expand Up @@ -236,7 +236,7 @@ bool CharacterGenerator::start(EobCharacter *characters, uint8 ***faceShapes) {
}

void CharacterGenerator::init() {
_screen->loadEobBitmap("CHARGENA", 3, 3);
_screen->loadShapeSetBitmap("CHARGENA", 3, 3);
if (_faceShapes) {
for (int i = 0; i < 44; i++)
delete[] _faceShapes[i];
Expand All @@ -248,8 +248,8 @@ void CharacterGenerator::init() {
_faceShapes[i] = _screen->encodeShape((i % 10) << 2, (i / 10) << 5, 4, 32, true);
_screen->_curPage = 0;

_screen->loadEobCpsFileToPage("CHARGEN", 0, 3, 3, 0);
_screen->loadEobBitmap("CHARGENB", 3, 3);
_screen->loadEobBitmap("CHARGEN", 0, 3, 3, 0);
_screen->loadShapeSetBitmap("CHARGENB", 3, 3);
if (_chargenMagicShapes) {
for (int i = 0; i < 10; i++)
delete[] _chargenMagicShapes[i];
Expand Down
34 changes: 27 additions & 7 deletions engines/kyra/eob1.cpp
Expand Up @@ -78,6 +78,9 @@ Common::Error EobEngine::init() {

_scriptTimersCount = 1;

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

return Common::kNoError;
}

Expand Down Expand Up @@ -341,8 +344,25 @@ void EobEngine::replaceMonster(int unit, uint16 block, int pos, int dir, int typ
}
}

void EobEngine::updateScriptTimersExtra() {
int cnt = 0;
for (int i = 1; i < 30; i++) {
if (_monsters[i].hitPointsCur <= 0)
cnt++;
}

if (!cnt) {
for (int i = 1; i < 30; i++) {
if (getBlockDistance(_monsters[i].block, _currentBlock) > 3) {
killMonster(&_monsters[i], true);
break;
}
}
}
}

void EobEngine::loadDoorShapes(int doorType1, int shapeId1, int doorType2, int shapeId2) {
_screen->loadEobBitmap("DOOR", 5, 3);
_screen->loadShapeSetBitmap("DOOR", 5, 3);
_screen->_curPage = 2;

if (doorType1 != 0xff) {
Expand All @@ -351,8 +371,8 @@ void EobEngine::loadDoorShapes(int doorType1, int shapeId1, int doorType2, int s
_doorShapes[shapeId1 + i] = _screen->encodeShape(enc[0], enc[1], enc[2], enc[3]);
enc = &_doorSwitchShapeEncodeDefs[(doorType1 * 3 + i) << 2];
_doorSwitches[shapeId1 + i].shp = _screen->encodeShape(enc[0], enc[1], enc[2], enc[3]);
_doorSwitches[shapeId1 + i].x = _doorSwitchCoords[doorType1 << 1];
_doorSwitches[shapeId1 + i].y = _doorSwitchCoords[(doorType1 << 1) + 1];
_doorSwitches[shapeId1 + i].x = _doorSwitchCoords[doorType1 * 6 + i * 2];
_doorSwitches[shapeId1 + i].y = _doorSwitchCoords[doorType1 * 6 + i * 2 + 1];
}
}

Expand All @@ -362,8 +382,8 @@ void EobEngine::loadDoorShapes(int doorType1, int shapeId1, int doorType2, int s
_doorShapes[shapeId2 + i] = _screen->encodeShape(enc[0], enc[1], enc[2], enc[3]);
enc = &_doorSwitchShapeEncodeDefs[(doorType2 * 3 + i) << 2];
_doorSwitches[shapeId2 + i].shp = _screen->encodeShape(enc[0], enc[1], enc[2], enc[3]);
_doorSwitches[shapeId2 + i].x = _doorSwitchCoords[doorType2 << 1];
_doorSwitches[shapeId2 + i].y = _doorSwitchCoords[(doorType2 << 1) + 1];
_doorSwitches[shapeId2 + i].x = _doorSwitchCoords[doorType2 * 6 + i * 2];
_doorSwitches[shapeId2 + i].y = _doorSwitchCoords[doorType2 * 6 + i * 2+ 1];
}
}

Expand All @@ -383,7 +403,7 @@ void EobEngine::drawDoorIntern(int type, int index, int x, int y, int w, int wal
case 4:
case 5:
case 6:
y = _dscDoorY2[mDim] - shp[1];
y = _dscDoorY6[mDim] - shp[1];
d1 = _dscDoorCoordsExt[index << 1] >> 3;
d2 = _dscDoorCoordsExt[(index << 1) + 1] >> 3;
if (_shpDmX1 > d1)
Expand All @@ -403,7 +423,7 @@ void EobEngine::drawDoorIntern(int type, int index, int x, int y, int w, int wal
case 7:
case 8:
case 9:
y = _dscDoorY3[mDim] - _doorShapes[shapeIndex + 3][1];
y = _dscDoorY7[mDim] - _doorShapes[shapeIndex + 3][1];
d1 = x - (_doorShapes[shapeIndex + 3][2] << 2);
x -= (shp[2] << 2);
drawBlockObject(0, 2, _doorShapes[shapeIndex + 3], d1, y, 5);
Expand Down
2 changes: 2 additions & 0 deletions engines/kyra/eob1.h
Expand Up @@ -81,6 +81,7 @@ friend class GUI_Eob;

// Monsters
void replaceMonster(int unit, uint16 block, int d, int dir, int type, int shpIndex, int mode, int h2, int randItem, int fixedItem);
void updateScriptTimersExtra();

// Level
void loadDoorShapes(int doorType1, int shapeId1, int doorType2, int shapeId2);
Expand All @@ -94,6 +95,7 @@ friend class GUI_Eob;
const uint8 *_dscDoorY4;
const uint8 *_dscDoorY5;
const uint8 *_dscDoorY6;
const uint8 *_dscDoorY7;

const uint8 *_doorShapeEncodeDefs;
const uint8 *_doorSwitchShapeEncodeDefs;
Expand Down
4 changes: 2 additions & 2 deletions engines/kyra/eob2.cpp
Expand Up @@ -159,7 +159,7 @@ void DarkMoonEngine::updateUsedCharacterHandItem(int charIndex, int slot) {

void DarkMoonEngine::generateMonsterPalettes(const char *file, int16 monsterIndex) {
int cp = _screen->setCurPage(2);
_screen->loadEobBitmap(file, 3, 3);
_screen->loadShapeSetBitmap(file, 3, 3);
uint8 tmpPal[16];
uint8 newPal[16];

Expand Down Expand Up @@ -291,7 +291,7 @@ bool DarkMoonEngine::killMonsterExtra(EobMonsterInPlay *m) {
}

const uint8 *DarkMoonEngine::loadDoorShapes(const char *filename, int doorIndex, const uint8 *shapeDefs) {
_screen->loadEobBitmap(filename, 3, 3);
_screen->loadShapeSetBitmap(filename, 3, 3);
for (int i = 0; i < 3; i++) {
_doorShapes[doorIndex * 3 + i] = _screen->encodeShape(READ_LE_UINT16(shapeDefs), READ_LE_UINT16(shapeDefs + 2), READ_LE_UINT16(shapeDefs + 4), READ_LE_UINT16(shapeDefs + 6));
shapeDefs += 8;
Expand Down

0 comments on commit bac0cae

Please sign in to comment.