Skip to content

Commit

Permalink
KYRA: Some formatting fixes.
Browse files Browse the repository at this point in the history
  • Loading branch information
Johannes Schickel committed Dec 27, 2011
1 parent 5dd3e1f commit a95f34b
Show file tree
Hide file tree
Showing 12 changed files with 658 additions and 649 deletions.
134 changes: 70 additions & 64 deletions engines/kyra/eob.cpp
Expand Up @@ -28,16 +28,22 @@

namespace Kyra {

EoBEngine::EoBEngine(OSystem *system, const GameFlags &flags) : EoBCoreEngine(system, flags) {
EoBEngine::EoBEngine(OSystem *system, const GameFlags &flags)
: EoBCoreEngine(system, flags) {
_numSpells = 53;
_menuChoiceInit = 4;

_turnUndeadString = _introFilesOpening = _introFilesTower = _introFilesOrb = _introFilesWdEntry = _introFilesKing = _introFilesHands = _introFilesWdExit =
_introFilesTunnel = _finBonusStrings = _npcStrings[1] = _npcStrings[2] = _npcStrings[3] = _npcStrings[4] = _npcStrings[5] = _npcStrings[6] = _npcStrings[7] =
_npcStrings[8] = _npcStrings[9] = _npcStrings[10] = 0;
_introOpeningFrmDelay = _introWdEncodeX = _introWdEncodeY = _introWdEncodeWH = _npcShpData = _npcSubShpIndex1 = _npcSubShpIndex2 = _npcSubShpY = _introWdDsY =
_introTvlX1 = _introTvlY1 = _introTvlX2 = _introTvlY2 = _introTvlW = _introTvlH = _dscDoorScaleMult4 = _dscDoorScaleMult5 = _dscDoorScaleMult6 =
_dscDoorY3 = _dscDoorY4 = _dscDoorY5 = _dscDoorY6 = _dscDoorY7 = _doorShapeEncodeDefs = _doorSwitchShapeEncodeDefs = _doorSwitchCoords = 0;
_turnUndeadString = _introFilesOpening = _introFilesTower = _introFilesOrb = 0;
_introFilesWdEntry = _introFilesKing = _introFilesHands = _introFilesWdExit = 0;
_introFilesTunnel = _finBonusStrings = _npcStrings[1] = _npcStrings[2] = 0;
_npcStrings[3] = _npcStrings[4] = _npcStrings[5] = _npcStrings[6] = 0;
_npcStrings[7] = _npcStrings[8] = _npcStrings[9] = _npcStrings[10] = 0;
_introOpeningFrmDelay = _introWdEncodeX = _introWdEncodeY = _introWdEncodeWH = 0;
_npcShpData = _npcSubShpIndex1 = _npcSubShpIndex2 = _npcSubShpY = _introWdDsY = 0;
_introTvlX1 = _introTvlY1 = _introTvlX2 = _introTvlY2 = _introTvlW = _introTvlH = 0;
_dscDoorScaleMult4 = _dscDoorScaleMult5 = _dscDoorScaleMult6 = _dscDoorY3 = 0;
_dscDoorY4 = _dscDoorY5 = _dscDoorY6 = _dscDoorY7 = _doorShapeEncodeDefs = 0;
_doorSwitchShapeEncodeDefs = _doorSwitchCoords = 0;
_introWdDsX = 0;
_dscDoorCoordsExt = 0;
}
Expand Down Expand Up @@ -176,7 +182,7 @@ void EoBEngine::runNpcDialogue(int npcIndex) {

switch (npcIndex) {
case 0:
for (r = 1; r == 1; ) {
for (r = 1; r == 1;) {
gui_drawDialogueBox();
r = DLG2A3(checkScriptFlags(0x2000), 8, 2, 1);
if (r == 1) {
Expand Down Expand Up @@ -238,7 +244,7 @@ void EoBEngine::runNpcDialogue(int npcIndex) {
}

if (!r)
_txt->printDialogueText(_npcStrings[0][0], true);
_txt->printDialogueText(_npcStrings[0][0], true);

break;

Expand Down Expand Up @@ -293,7 +299,7 @@ void EoBEngine::runNpcDialogue(int npcIndex) {
itm = _characters[a].inventory[r];
if (itm && (_items[itm].type < 51 || _items[itm].type > 56)) {
_characters[a].inventory[r] = 0;
setItemPosition((Item*)&_levelBlockProperties[_currentBlock].drawObjects, _currentBlock, itm, _dropItemDirIndex[(_currentDirection << 2) + rollDice(1, 2, -1)]);
setItemPosition((Item *)&_levelBlockProperties[_currentBlock].drawObjects, _currentBlock, itm, _dropItemDirIndex[(_currentDirection << 2) + rollDice(1, 2, -1)]);
}
}
}
Expand Down Expand Up @@ -391,7 +397,7 @@ void EoBEngine::loadDoorShapes(int doorType1, int shapeId1, int doorType2, int s
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 * 6 + i * 2];
_doorSwitches[shapeId2 + i].y = _doorSwitchCoords[doorType2 * 6 + i * 2+ 1];
_doorSwitches[shapeId2 + i].y = _doorSwitchCoords[doorType2 * 6 + i * 2 + 1];
}
}

Expand All @@ -408,62 +414,62 @@ void EoBEngine::drawDoorIntern(int type, int index, int x, int y, int w, int wal
const ScreenDim *td = _screen->getScreenDim(5);

switch (_currentLevel) {
case 4:
case 5:
case 6:
y = _dscDoorY6[mDim] - shp[1];
d1 = _dscDoorCoordsExt[index << 1] >> 3;
d2 = _dscDoorCoordsExt[(index << 1) + 1] >> 3;
if (_shpDmX1 > d1)
d1 = _shpDmX1;
if (_shpDmX2 < d2)
d2 = _shpDmX2;
_screen->modifyScreenDim(5, d1, td->sy, d2 - d1, td->h);
v = ((wall < 30) ? (wall - _dscDoorScaleOffs[wall]) * _dscDoorScaleMult3[mDim] : _dscDoorScaleMult4[mDim]) * -1;
v -= (shp[2] << 3);
drawBlockObject(0, 2, shp, x + v, y, 5);
v += (shp[2] << 3);
drawBlockObject(1, 2, shp, x - v, y, 5);
if (_wllShapeMap[wall] == -1)
drawBlockObject(0, 2, _doorSwitches[shapeIndex].shp, _doorSwitches[shapeIndex].x + w - v, _doorSwitches[shapeIndex].y, 5);
break;
case 4:
case 5:
case 6:
y = _dscDoorY6[mDim] - shp[1];
d1 = _dscDoorCoordsExt[index << 1] >> 3;
d2 = _dscDoorCoordsExt[(index << 1) + 1] >> 3;
if (_shpDmX1 > d1)
d1 = _shpDmX1;
if (_shpDmX2 < d2)
d2 = _shpDmX2;
_screen->modifyScreenDim(5, d1, td->sy, d2 - d1, td->h);
v = ((wall < 30) ? (wall - _dscDoorScaleOffs[wall]) * _dscDoorScaleMult3[mDim] : _dscDoorScaleMult4[mDim]) * -1;
v -= (shp[2] << 3);
drawBlockObject(0, 2, shp, x + v, y, 5);
v += (shp[2] << 3);
drawBlockObject(1, 2, shp, x - v, y, 5);
if (_wllShapeMap[wall] == -1)
drawBlockObject(0, 2, _doorSwitches[shapeIndex].shp, _doorSwitches[shapeIndex].x + w - v, _doorSwitches[shapeIndex].y, 5);
break;

case 7:
case 8:
case 9:
y = _dscDoorY3[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);
scaleLevelShapesDim(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)
drawBlockObject(0, 2, _doorSwitches[shapeIndex].shp, _doorSwitches[shapeIndex].x + w, _doorSwitches[shapeIndex].y, 5);
break;
case 7:
case 8:
case 9:
y = _dscDoorY3[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);
scaleLevelShapesDim(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)
drawBlockObject(0, 2, _doorSwitches[shapeIndex].shp, _doorSwitches[shapeIndex].x + w, _doorSwitches[shapeIndex].y, 5);
break;

case 10:
case 11:
v = ((wall < 30) ? (wall - _dscDoorScaleOffs[wall]) * _dscDoorScaleMult5[mDim] : _dscDoorScaleMult6[mDim]) * -1;
x -= (shp[2] << 2);
y = _dscDoorY4[mDim] + v;
drawBlockObject(0, 2, shp, x, y + v, 5);
v = (v >> 3) + (v >> 2);
y = _dscDoorY5[mDim];
drawBlockObject(0, 2, _doorShapes[shapeIndex + 3], x, y - v, 5);
if (_wllShapeMap[wall] == -1)
drawBlockObject(0, 2, _doorSwitches[shapeIndex].shp, _doorSwitches[shapeIndex].x + w, _doorSwitches[shapeIndex].y, 5);
break;
case 10:
case 11:
v = ((wall < 30) ? (wall - _dscDoorScaleOffs[wall]) * _dscDoorScaleMult5[mDim] : _dscDoorScaleMult6[mDim]) * -1;
x -= (shp[2] << 2);
y = _dscDoorY4[mDim] + v;
drawBlockObject(0, 2, shp, x, y + v, 5);
v = (v >> 3) + (v >> 2);
y = _dscDoorY5[mDim];
drawBlockObject(0, 2, _doorShapes[shapeIndex + 3], x, y - v, 5);
if (_wllShapeMap[wall] == -1)
drawBlockObject(0, 2, _doorSwitches[shapeIndex].shp, _doorSwitches[shapeIndex].x + w, _doorSwitches[shapeIndex].y, 5);
break;

default:
y = (_currentLevel == 12 ? _dscDoorY6[mDim] : _dscDoorY1[mDim]) - shp[1];
x -= (shp[2] << 2);
y -= (wall >= 30 ? _dscDoorScaleMult2[mDim] : (wall - _dscDoorScaleOffs[wall]) * _dscDoorScaleMult1[mDim]);
drawBlockObject(0, 2, shp, x, y, 5);
default:
y = (_currentLevel == 12 ? _dscDoorY6[mDim] : _dscDoorY1[mDim]) - shp[1];
x -= (shp[2] << 2);
y -= (wall >= 30 ? _dscDoorScaleMult2[mDim] : (wall - _dscDoorScaleOffs[wall]) * _dscDoorScaleMult1[mDim]);
drawBlockObject(0, 2, shp, x, y, 5);

if (_wllShapeMap[wall] == -1)
drawBlockObject(0, 2, _doorSwitches[shapeIndex].shp, _doorSwitches[shapeIndex].x + w, _doorSwitches[shapeIndex].y, 5);
break;
if (_wllShapeMap[wall] == -1)
drawBlockObject(0, 2, _doorSwitches[shapeIndex].shp, _doorSwitches[shapeIndex].x + w, _doorSwitches[shapeIndex].y, 5);
break;
}
}

Expand Down Expand Up @@ -567,6 +573,6 @@ void EoBEngine::healParty() {
}
}

} // End of namespace Kyra
} // End of namespace Kyra

#endif // ENABLE_EOB

0 comments on commit a95f34b

Please sign in to comment.