Skip to content

Commit

Permalink
KYRA: (EOB) - fix EOB1 door clipping
Browse files Browse the repository at this point in the history
(this was done in the same way as in EOB2 and LOL, but it has to be slightly different)
  • Loading branch information
athrxx committed Feb 21, 2012
1 parent 151d314 commit a4223e9
Show file tree
Hide file tree
Showing 14 changed files with 89 additions and 16 deletions.
16 changes: 14 additions & 2 deletions devtools/create_kyradat/create_kyradat.cpp
Expand Up @@ -45,7 +45,7 @@
#include <map>

enum {
kKyraDatVersion = 81
kKyraDatVersion = 82
};

const ExtractFilename extractFilenames[] = {
Expand Down Expand Up @@ -656,6 +656,10 @@ const ExtractFilename extractFilenames[] = {
{ kRpgCommonDscBlockIndex, kTypeRawData, false },
{ kLoLDscDoor4, kLoLTypeRaw16, false },
{ kRpgCommonDscDoorY2, kTypeRawData, false },
{ kRpgCommonDscDoorFrameY1, kTypeRawData, false },
{ kRpgCommonDscDoorFrameY2, kTypeRawData, false },
{ kRpgCommonDscDoorFrameIndex1, kTypeRawData, false },
{ kRpgCommonDscDoorFrameIndex2, kTypeRawData, false },
{ kLoLDscDoorX, kLoLTypeRaw16, false },
{ kLoLDscDoorY, kLoLTypeRaw16, false },

Expand Down Expand Up @@ -1786,7 +1790,7 @@ const char *getIdString(const int id) {
case kEoB1CgaMappingIcons:
return "kEoB1CgaMappingIcons";
case kEoB1CgaMappingDeco:
return "kEoB1CgaMappingDeco";
return "kEoB1CgaMappingDeco";
case kEoB1CgaLevelMappingIndex:
return "kEoB1CgaLevelMappingIndex";
case kEoB1CgaMappingLevel0:
Expand Down Expand Up @@ -2165,6 +2169,14 @@ const char *getIdString(const int id) {
return "kRpgCommonDscBlockIndex";
case kRpgCommonDscDoorY2:
return "kRpgCommonDscDoorY2";
case kRpgCommonDscDoorFrameY1:
return "kRpgCommonDscDoorFrameY1";
case kRpgCommonDscDoorFrameY2:
return "kRpgCommonDscDoorFrameY2";
case kRpgCommonDscDoorFrameIndex1:
return "kRpgCommonDscDoorFrameIndex1";
case kRpgCommonDscDoorFrameIndex2:
return "kRpgCommonDscDoorFrameIndex2";
case kLoLDscDoorScale:
return "kLoLDscDoorScale";
case kLoLDscDoor4:
Expand Down
4 changes: 4 additions & 0 deletions devtools/create_kyradat/create_kyradat.h
Expand Up @@ -190,6 +190,10 @@ enum kExtractID {
kRpgCommonDscBlockMap,
kRpgCommonDscDimMap,
kRpgCommonDscDoorY2,
kRpgCommonDscDoorFrameY1,
kRpgCommonDscDoorFrameY2,
kRpgCommonDscDoorFrameIndex1,
kRpgCommonDscDoorFrameIndex2,
kRpgCommonDscBlockIndex,

kEoBBaseChargenStrings1,
Expand Down
12 changes: 12 additions & 0 deletions devtools/create_kyradat/games.cpp
Expand Up @@ -827,6 +827,8 @@ const int lolFloppyNeed[] = {
kLoLDscOvlIndex,
kRpgCommonDscBlockIndex,
kRpgCommonDscDoorY2,
kRpgCommonDscDoorFrameY1,
kRpgCommonDscDoorFrameY2,
kLoLDscDoorScale,
kLoLDscDoor4,
kLoLDscDoorX,
Expand Down Expand Up @@ -907,6 +909,8 @@ const int lolPC98Need[] = {
kLoLDscOvlIndex,
kRpgCommonDscBlockIndex,
kRpgCommonDscDoorY2,
kRpgCommonDscDoorFrameY1,
kRpgCommonDscDoorFrameY2,
kLoLDscDoorScale,
kLoLDscDoor4,
kLoLDscDoorX,
Expand Down Expand Up @@ -992,6 +996,8 @@ const int lolCDNeed[] = {
kLoLDscOvlIndex,
kRpgCommonDscBlockIndex,
kRpgCommonDscDoorY2,
kRpgCommonDscDoorFrameY1,
kRpgCommonDscDoorFrameY2,
kLoLDscDoorScale,
kLoLDscDoor4,
kLoLDscDoorX,
Expand Down Expand Up @@ -1253,6 +1259,10 @@ const int eob1FloppyNeed[] = {
kEoBBaseDscDoorY6,
kEoBBaseDscDoorY7,
kEoBBaseDscDoorCoordsExt,
kRpgCommonDscDoorFrameY1,
kRpgCommonDscDoorFrameY2,
kRpgCommonDscDoorFrameIndex1,
kRpgCommonDscDoorFrameIndex2,

kEoBBaseDscItemPosIndex,
kEoBBaseDscItemShpX,
Expand Down Expand Up @@ -1472,6 +1482,8 @@ const int eob2FloppyNeed[] = {
kEoBBaseDscDoorType5Offs,
kEoBBaseDscDoorY1,
kRpgCommonDscDoorY2,
kRpgCommonDscDoorFrameY1,
kRpgCommonDscDoorFrameY2,

kEoBBaseDscItemPosIndex,
kEoBBaseDscItemShpX,
Expand Down
26 changes: 26 additions & 0 deletions devtools/create_kyradat/tables.cpp
Expand Up @@ -3647,6 +3647,28 @@ const ExtractEntrySearchData kRpgCommonDscDoorY2Provider[] = {
EXTRACT_END_ENTRY
};

const ExtractEntrySearchData kRpgCommonDscDoorFrameY1Provider[] = {
{ UNK_LANG, kPlatformUnknown, { 0x00000020, 0x0000053B, { { 0xF0, 0x9E, 0xC5, 0xB1, 0xEA, 0x5A, 0x58, 0xBD, 0xAC, 0x7B, 0xB2, 0xD4, 0xFE, 0x3F, 0x4F, 0x51 } } } }, // EOB I
{ UNK_LANG, kPlatformUnknown, { 0x00000004, 0x00000046, { { 0xD4, 0xA4, 0xEC, 0xA2, 0x99, 0xB6, 0x5E, 0x12, 0x98, 0xFF, 0xF2, 0x55, 0xC8, 0xBD, 0xC5, 0x8F } } } }, // EOB II
EXTRACT_END_ENTRY
};

const ExtractEntrySearchData kRpgCommonDscDoorFrameY2Provider[] = {
{ UNK_LANG, kPlatformUnknown, { 0x00000020, 0x0000053B, { { 0xF0, 0x9E, 0xC5, 0xB1, 0xEA, 0x5A, 0x58, 0xBD, 0xAC, 0x7B, 0xB2, 0xD4, 0xFE, 0x3F, 0x4F, 0x51 } } } }, // EOB I
{ UNK_LANG, kPlatformUnknown, { 0x00000004, 0x00000150, { { 0x49, 0x7E, 0xF4, 0xDF, 0x8D, 0x04, 0x0A, 0xCE, 0x49, 0xBB, 0xA2, 0x1D, 0x8D, 0xC2, 0x14, 0x9E } } } }, // EOB II
EXTRACT_END_ENTRY
};

const ExtractEntrySearchData kRpgCommonDscDoorFrameIndex1Provider[] = {
{ UNK_LANG, kPlatformUnknown, { 0x0000000C, 0x00000058, { { 0xC9, 0xAF, 0x1F, 0x68, 0xF1, 0xDE, 0x96, 0x9B, 0x3B, 0xCB, 0x56, 0xEC, 0x2E, 0x62, 0x9A, 0x0A } } } },
EXTRACT_END_ENTRY
};

const ExtractEntrySearchData kRpgCommonDscDoorFrameIndex2Provider[] = {
{ UNK_LANG, kPlatformUnknown, { 0x0000000C, 0x000000E8, { { 0x8C, 0x10, 0x56, 0xEA, 0x4D, 0x1A, 0x9C, 0xB2, 0x55, 0x54, 0xA5, 0x61, 0x1D, 0x19, 0x4E, 0x50 } } } },
EXTRACT_END_ENTRY
};

const ExtractEntrySearchData kLoLDscDoorScaleProvider[] = {
{ UNK_LANG, kPlatformUnknown, { 0x00000010, 0x0000024C, { { 0x8D, 0x83, 0x26, 0xEE, 0xDC, 0xF7, 0x13, 0xC0, 0xAA, 0x88, 0xC2, 0xAA, 0x66, 0xA7, 0x59, 0x41 } } } },

Expand Down Expand Up @@ -4382,6 +4404,10 @@ const ExtractEntry extractProviders[] = {
{ kLoLDscOvlIndex, kLoLDscOvlIndexProvider },
{ kRpgCommonDscBlockIndex, kRpgCommonDscBlockIndexProvider },
{ kRpgCommonDscDoorY2, kRpgCommonDscDoorY2Provider },
{ kRpgCommonDscDoorFrameY1, kRpgCommonDscDoorFrameY1Provider },
{ kRpgCommonDscDoorFrameY2, kRpgCommonDscDoorFrameY2Provider },
{ kRpgCommonDscDoorFrameIndex1, kRpgCommonDscDoorFrameIndex1Provider },
{ kRpgCommonDscDoorFrameIndex2, kRpgCommonDscDoorFrameIndex2Provider },
{ kLoLDscDoorScale, kLoLDscDoorScaleProvider },
{ kLoLDscDoor4, kLoLDscDoor4Provider },
{ kLoLDscDoorX, kLoLDscDoorXProvider },
Expand Down
Binary file modified dists/engine-data/kyra.dat
Binary file not shown.
2 changes: 1 addition & 1 deletion engines/kyra/eob.cpp
Expand Up @@ -421,7 +421,7 @@ void EoBEngine::drawDoorIntern(int type, int index, int x, int y, int w, int wal
d1 = x - (_doorShapes[shapeIndex + 3][2] << 2);
x -= (shp[2] << 2);
drawBlockObject(0, 2, _doorShapes[shapeIndex + 3], d1, y, 5);
scaleLevelShapesDim(index, y1, y2, 5);
setDoorShapeDim(index, y1, y2, 5);
y = _dscDoorY3[mDim] - ((wall < 30) ? (wall - _dscDoorScaleOffs[wall]) * _dscDoorScaleMult1[mDim] : _dscDoorScaleMult2[mDim]);
drawBlockObject(0, 2, shp, x, y, 5);
if (_wllShapeMap[wall] == -1)
Expand Down
4 changes: 4 additions & 0 deletions engines/kyra/kyra_rpg.cpp
Expand Up @@ -94,6 +94,10 @@ KyraRpgEngine::KyraRpgEngine(OSystem *system, const GameFlags &flags) : KyraEngi
_dscDimMap = 0;
_dscDoorShpIndex = 0;
_dscDoorY2 = 0;
_dscDoorFrameY1 = 0;
_dscDoorFrameY2 = 0;
_dscDoorFrameIndex1 = 0;
_dscDoorFrameIndex2 = 0;

_shpDmX1 = _shpDmX2 = 0;

Expand Down
6 changes: 5 additions & 1 deletion engines/kyra/kyra_rpg.h
Expand Up @@ -183,7 +183,7 @@ friend class TextDisplayer_rpg;

virtual const uint8 *getBlockFileData(int levelIndex) = 0;
void setLevelShapesDim(int index, int16 &x1, int16 &x2, int dim);
void scaleLevelShapesDim(int index, int16 &y1, int16 &y2, int dim);
void setDoorShapeDim(int index, int16 &y1, int16 &y2, int dim);
void drawLevelModifyScreenDim(int dim, int16 x1, int16 y1, int16 x2, int16 y2);
void generateBlockDrawingBuffer();
void generateVmpTileData(int16 startBlockX, uint8 startBlockY, uint8 wllVmpIndex, int16 vmpOffset, uint8 numBlocksX, uint8 numBlocksY);
Expand Down Expand Up @@ -271,6 +271,10 @@ friend class TextDisplayer_rpg;
const uint8 *_dscDoorShpIndex;
int _dscDoorShpIndexSize;
const uint8 *_dscDoorY2;
const uint8 *_dscDoorFrameY1;
const uint8 *_dscDoorFrameY2;
const uint8 *_dscDoorFrameIndex1;
const uint8 *_dscDoorFrameIndex2;

// Script
virtual void runLevelScript(int block, int flags) = 0;
Expand Down
4 changes: 4 additions & 0 deletions engines/kyra/resource.h
Expand Up @@ -263,6 +263,10 @@ enum KyraResources {
kRpgCommonDscBlockMap,
kRpgCommonDscDimMap,
kRpgCommonDscDoorY2,
kRpgCommonDscDoorFrameY1,
kRpgCommonDscDoorFrameY2,
kRpgCommonDscDoorFrameIndex1,
kRpgCommonDscDoorFrameIndex2,
kRpgCommonDscBlockIndex,

kEoBBaseChargenStrings1,
Expand Down
2 changes: 1 addition & 1 deletion engines/kyra/scene_lol.cpp
Expand Up @@ -1436,7 +1436,7 @@ void LoLEngine::drawSceneShapes(int) {
if (v > 80)
v = 80;

scaleLevelShapesDim(t, dimY1, dimY2, _sceneShpDim);
setDoorShapeDim(t, dimY1, dimY2, _sceneShpDim);
drawDoor(_doorShapes[(s < 23 ? _dscDoorShpIndex[s] : 0)], 0, t, 10, 0, -v, 2);
setLevelShapesDim(t, dimY1, dimY2, _sceneShpDim);
}
Expand Down
21 changes: 12 additions & 9 deletions engines/kyra/scene_rpg.cpp
Expand Up @@ -51,15 +51,15 @@ void KyraRpgEngine::setLevelShapesDim(int index, int16 &x1, int16 &x2, int dim)
if (t > x1) {
x1 = t;
if (!(a & 0x10))
scaleLevelShapesDim(index, y1, y2, -1);
setDoorShapeDim(index, y1, y2, -1);
}

t = _dscDim2[((m + i) << 1) + 1];

if (t < x2) {
x2 = t;
if (!(a & 0x10))
scaleLevelShapesDim(index, y1, y2, -1);
setDoorShapeDim(index, y1, y2, -1);
}
} else {
int t = _dscDim1[m + i];
Expand Down Expand Up @@ -100,17 +100,20 @@ void KyraRpgEngine::setLevelShapesDim(int index, int16 &x1, int16 &x2, int dim)
drawLevelModifyScreenDim(dim, x1, 0, x2, 15);
}

void KyraRpgEngine::scaleLevelShapesDim(int index, int16 &y1, int16 &y2, int dim) {
static const int8 dscY1[] = { 0x1E, 0x18, 0x10, 0x00 };
static const int8 dscY2[] = { 0x3B, 0x47, 0x56, 0x78 };

void KyraRpgEngine::setDoorShapeDim(int index, int16 &y1, int16 &y2, int dim) {
uint8 a = _dscDimMap[index];

if (dim == -1 && a != 3)
if (_flags.gameID != GI_EOB1 && dim == -1 && a != 3)
a++;

y1 = dscY1[a];
y2 = dscY2[a];
uint8 b = a;
if (_flags.gameID == GI_EOB1) {
a += _dscDoorFrameIndex1[_currentLevel - 1];
b += _dscDoorFrameIndex2[_currentLevel - 1];
}

y1 = _dscDoorFrameY1[a];
y2 = _dscDoorFrameY2[b];

if (dim == -1)
return;
Expand Down
2 changes: 1 addition & 1 deletion engines/kyra/sprites_eob.cpp
Expand Up @@ -462,7 +462,7 @@ void EoBCoreEngine::drawDoor(int index) {

int16 y1 = 0;
int16 y2 = 0;
scaleLevelShapesDim(index, y1, y2, 5);
setDoorShapeDim(index, y1, y2, 5);
drawDoorIntern(type, index, x, y, w, s, d, y1, y2);
drawLevelModifyScreenDim(5, _shpDmX1, 0, _shpDmX2, 15);
}
Expand Down
2 changes: 1 addition & 1 deletion engines/kyra/staticres.cpp
Expand Up @@ -38,7 +38,7 @@

namespace Kyra {

#define RESFILE_VERSION 81
#define RESFILE_VERSION 82

namespace {
bool checkKyraDat(Common::SeekableReadStream *file) {
Expand Down
4 changes: 4 additions & 0 deletions engines/kyra/staticres_rpg.cpp
Expand Up @@ -88,6 +88,10 @@ void KyraRpgEngine::initStaticResource() {
_dscDimMap = _staticres->loadRawData(kRpgCommonDscDimMap, temp);
_dscDoorShpIndex = _staticres->loadRawData(kRpgCommonDscDoorShapeIndex, _dscDoorShpIndexSize);
_dscDoorY2 = _staticres->loadRawData(kRpgCommonDscDoorY2, temp);
_dscDoorFrameY1 = _staticres->loadRawData(kRpgCommonDscDoorFrameY1, temp);
_dscDoorFrameY2 = _staticres->loadRawData(kRpgCommonDscDoorFrameY2, temp);
_dscDoorFrameIndex1 = _staticres->loadRawData(kRpgCommonDscDoorFrameIndex1, temp);
_dscDoorFrameIndex2 = _staticres->loadRawData(kRpgCommonDscDoorFrameIndex2, temp);
_moreStrings = _staticres->loadStrings(kRpgCommonMoreStrings, temp);
}

Expand Down

0 comments on commit a4223e9

Please sign in to comment.