[Scummvm-cvs-logs] scummvm master -> 0e2b8413e55eb9fa2839d89d7ff3e8270b8b8c29
athrxx
athrxx at scummvm.org
Wed Dec 28 00:02:35 CET 2011
This automated email contains information about 10 new commits which have been
pushed to the 'scummvm' repo located at https://github.com/scummvm/scummvm .
Summary:
536abf6d3d KYRA: (EOB) - fix signed/unsigned mismatch
4fef4743fd KYRA: (EOB) - fix 2 gcc (-Woverloaded-virtual) warnings
37c046339d KYRA: (EOB) - cleanup dialog settings a bit
e6b6099d54 KYRA: (EOB) - fix minor color glitch
a35550d200 KYRA: (EOB) - fix invalid string access in EOB 1
99b14c5dbc KYRA: (EOB) - fix spell book tab 5 in EOB1
75c0036925 KYRA: (LOL) - add support for loading original DOS version save files
cbfdd227a1 KYRA: (LOL) - minor reduction of save file size
6786c41f4f KYRA: (LOL) - refactor item/monster structs
0e2b8413e5 KYRA: add support for another Russian HOF fan translation
Commit: 536abf6d3de82f67342d73eefea7b63e3172f4d0
https://github.com/scummvm/scummvm/commit/536abf6d3de82f67342d73eefea7b63e3172f4d0
Author: athrxx (athrxx at scummvm.org)
Date: 2011-12-27T15:01:25-08:00
Commit Message:
KYRA: (EOB) - fix signed/unsigned mismatch
Changed paths:
engines/kyra/magic_eob.cpp
diff --git a/engines/kyra/magic_eob.cpp b/engines/kyra/magic_eob.cpp
index 1c29206..fbddd62 100644
--- a/engines/kyra/magic_eob.cpp
+++ b/engines/kyra/magic_eob.cpp
@@ -711,7 +711,7 @@ Item EoBCoreEngine::createMagicWeaponItem(int flags, int icon, int value, int ty
void EoBCoreEngine::removeMagicWeaponItem(Item item) {
_itemTypes[_items[item].type].armorClass = -30;
_items[item].block = -2;
- _items[item].level = -1;
+ _items[item].level = 0xff;
}
void EoBCoreEngine::updateWallOfForceTimers() {
Commit: 4fef4743fd5a2000a96c55c7b961d60e53562504
https://github.com/scummvm/scummvm/commit/4fef4743fd5a2000a96c55c7b961d60e53562504
Author: athrxx (athrxx at scummvm.org)
Date: 2011-12-27T15:01:26-08:00
Commit Message:
KYRA: (EOB) - fix 2 gcc (-Woverloaded-virtual) warnings
Changed paths:
engines/kyra/kyra_rpg.cpp
engines/kyra/kyra_rpg.h
engines/kyra/text_rpg.h
diff --git a/engines/kyra/kyra_rpg.cpp b/engines/kyra/kyra_rpg.cpp
index a4c92b6..92aa12b 100644
--- a/engines/kyra/kyra_rpg.cpp
+++ b/engines/kyra/kyra_rpg.cpp
@@ -313,7 +313,7 @@ uint16 KyraRpgEngine::processDialogue() {
return res;
}
-void KyraRpgEngine::delayUntil(uint32 time, bool doUpdate, bool isMainLoop) {
+void KyraRpgEngine::delayUntil(uint32 time, bool doUpdate, bool isMainLoop, bool) {
uint32 curTime = _system->getMillis();
if (time > curTime)
delay(time - curTime, doUpdate, isMainLoop);
diff --git a/engines/kyra/kyra_rpg.h b/engines/kyra/kyra_rpg.h
index 1a5acb8..678f812 100644
--- a/engines/kyra/kyra_rpg.h
+++ b/engines/kyra/kyra_rpg.h
@@ -304,7 +304,7 @@ protected:
// misc
virtual void delay(uint32 millis, bool doUpdate = false, bool isMainLoop = false) = 0;
- void delayUntil(uint32 time, bool doUpdate = false, bool isMainLoop = false);
+ void delayUntil(uint32 time, bool doUpdate = false, bool isMainLoop = false, bool unused = false);
int rollDice(int times, int pips, int inc = 0);
virtual Common::Error loadGameState(int slot) = 0;
diff --git a/engines/kyra/text_rpg.h b/engines/kyra/text_rpg.h
index 8ef8fdd..5ad8899 100644
--- a/engines/kyra/text_rpg.h
+++ b/engines/kyra/text_rpg.h
@@ -37,7 +37,7 @@ public:
TextDisplayer_rpg(KyraRpgEngine *engine, Screen *scr);
virtual ~TextDisplayer_rpg();
- virtual void setupField(int dim, bool mode);
+ void setupField(int dim, bool mode);
void printDialogueText(int stringId, const char *pageBreakString);
void printDialogueText(const char *str, bool wait = false);
Commit: 37c046339dfc70f29c163457c72158e02a6c1cdb
https://github.com/scummvm/scummvm/commit/37c046339dfc70f29c163457c72158e02a6c1cdb
Author: athrxx (athrxx at scummvm.org)
Date: 2011-12-27T15:01:27-08:00
Commit Message:
KYRA: (EOB) - cleanup dialog settings a bit
Changed paths:
engines/kyra/chargen.cpp
engines/kyra/darkmoon.cpp
engines/kyra/darkmoon.h
engines/kyra/eob.cpp
engines/kyra/eob.h
engines/kyra/eobcommon.cpp
engines/kyra/eobcommon.h
engines/kyra/gui_eob.cpp
engines/kyra/kyra_rpg.cpp
engines/kyra/kyra_rpg.h
engines/kyra/lol.cpp
engines/kyra/lol.h
engines/kyra/sequences_eob.cpp
engines/kyra/staticres_eob.cpp
engines/kyra/staticres_lol.cpp
engines/kyra/text_rpg.cpp
diff --git a/engines/kyra/chargen.cpp b/engines/kyra/chargen.cpp
index e4b89c9..50153d7 100644
--- a/engines/kyra/chargen.cpp
+++ b/engines/kyra/chargen.cpp
@@ -1616,15 +1616,15 @@ int TransferPartyWiz::selectCharactersMenu() {
_screen->setFont(Screen::FID_6_FNT);
_screen->clearCurPage();
- _vm->gui_drawBox(0, 0, 320, 163, _vm->_color1_1, _vm->_color2_1, _vm->_bkgColor_1);
+ _vm->gui_drawBox(0, 0, 320, 163, _vm->guiSettings()->colors.frame1, _vm->guiSettings()->colors.frame2, _vm->guiSettings()->colors.fill);
_screen->printText(_strings2[0], 5, 3, 15, 0);
_screen->printText(_strings2[1], 5, 10, 15, 0);
for (int i = 0; i < 6; i++)
drawCharPortraitWithStats(i, 0);
- _vm->gui_drawBox(4, 148, 43, 12, _vm->_color1_1, _vm->_color2_1, _vm->_bkgColor_1);
- _vm->gui_drawBox(272, 148, 43, 12, _vm->_color1_1, _vm->_color2_1, _vm->_bkgColor_1);
+ _vm->gui_drawBox(4, 148, 43, 12, _vm->guiSettings()->colors.frame1, _vm->guiSettings()->colors.frame2, _vm->guiSettings()->colors.fill);
+ _vm->gui_drawBox(272, 148, 43, 12, _vm->guiSettings()->colors.frame1, _vm->guiSettings()->colors.frame2, _vm->guiSettings()->colors.fill);
_screen->printShadedText(_labels[0], 9, 151, 15, 0);
_screen->printShadedText(_labels[1], 288, 151, 15, 0);
@@ -1686,10 +1686,10 @@ int TransferPartyWiz::selectCharactersMenu() {
}
int x = (highlight - 6) * 268 + 4;
- _vm->gui_drawBox(x, 148, 43, 12, _vm->_bkgColor_1, _vm->_bkgColor_1, -1);
+ _vm->gui_drawBox(x, 148, 43, 12, _vm->guiSettings()->colors.fill, _vm->guiSettings()->colors.fill, -1);
_screen->updateScreen();
_vm->_system->delayMillis(80);
- _vm->gui_drawBox(x, 148, 43, 12, _vm->_color1_1, _vm->_color2_1, -1);
+ _vm->gui_drawBox(x, 148, 43, 12, _vm->guiSettings()->colors.frame1, _vm->guiSettings()->colors.frame2, -1);
_screen->updateScreen();
if (highlight == 6 || _vm->shouldQuit()) {
@@ -1726,7 +1726,7 @@ void TransferPartyWiz::drawCharPortraitWithStats(int charIndex, bool enabled) {
EoBCharacter *c = &_vm->_characters[charIndex];
_screen->fillRect(x + 4, y + 24, x + 36, y + 57, 12);
- _vm->gui_drawBox(x + 40, y + 24, 118, 34, _vm->_color1_1, _vm->_color2_1, _vm->_bkgColor_1);
+ _vm->gui_drawBox(x + 40, y + 24, 118, 34, _vm->guiSettings()->colors.frame1, _vm->guiSettings()->colors.frame2, _vm->guiSettings()->colors.fill);
if (!(c->flags & 1))
return;
diff --git a/engines/kyra/darkmoon.cpp b/engines/kyra/darkmoon.cpp
index 304e5c9..c12ef10 100644
--- a/engines/kyra/darkmoon.cpp
+++ b/engines/kyra/darkmoon.cpp
@@ -58,31 +58,6 @@ Common::Error DarkMoonEngine::init() {
_monsterProps = new EoBMonsterProperty[10];
- static const uint16 wX[] = { 221, 76 };
- static const uint8 wY[] = { 189, 162 };
- static const uint16 wW[] = { 95, 95 };
-
- _dialogueButtonLabelCol1 = 9;
- _dialogueButtonLabelCol2 = 15;
- _dialogueButtonW = 95;
- _dialogueButtonH = 9;
- _waitButtonPresX = wX;
- _waitButtonPresY = wY;
- _waitButtonPresW = wW;
- _waitButtonReverveW = 7;
-
- _bkgColor_1 = 183;
- _color1_1 = 186;
- _color2_1 = 181;
- _color4 = 133;
- _color5 = 184;
- _color6 = 183;
- _color7 = 181;
- _color8 = 186;
- _color12 = 180;
- _color13 = 177;
- _color14 = 182;
-
return Common::kNoError;
}
@@ -475,6 +450,10 @@ void DarkMoonEngine::characterLevelGain(int charIndex) {
}
}
+const KyraRpgGUISettings *DarkMoonEngine::guiSettings() {
+ return &_guiSettings;
+}
+
} // End of namespace Kyra
#endif // ENABLE_EOB
diff --git a/engines/kyra/darkmoon.h b/engines/kyra/darkmoon.h
index 590b2f4..8abbc2b 100644
--- a/engines/kyra/darkmoon.h
+++ b/engines/kyra/darkmoon.h
@@ -128,8 +128,12 @@ private:
int charSelectDialogue();
void characterLevelGain(int charIndex);
+ const KyraRpgGUISettings *guiSettings();
+
const char *const *_hornStrings;
const uint8 *_hornSounds;
+
+ static const KyraRpgGUISettings _guiSettings;
};
} // End of namespace Kyra
diff --git a/engines/kyra/eob.cpp b/engines/kyra/eob.cpp
index 96eb388..7524b07 100644
--- a/engines/kyra/eob.cpp
+++ b/engines/kyra/eob.cpp
@@ -61,32 +61,6 @@ Common::Error EoBEngine::init() {
_itemsOverlay = _res->fileData("ITEMRMP.VGA", 0);
- static const uint16 wX[] = { 285, 139 };
- static const uint8 wY[] = { 189, 162 };
- static const uint16 wW[] = { 31, 31 };
-
- _dialogueButtonLabelCol1 = 9;
- _dialogueButtonLabelCol2 = 15;
- _dialogueButtonW = 95;
- _dialogueButtonH = 9;
- _waitButtonPresX = wX;
- _waitButtonPresY = wY;
- _waitButtonPresW = wW;
- _waitButtonReverveW = 7;
-
- _bkgColor_1 = 132;
- _color1_1 = 135;
- _color2_1 = 130;
- _color4 = 133;
- _color5 = 133;
- _color6 = 180;
- _color7 = 177;
- _color8 = 184;
-
- _color14 = _color8;
- _color13 = _color7;
- _color12 = _color6;
-
_screen->modifyScreenDim(7, 0x01, 0xB3, 0x22, 0x12);
_screen->modifyScreenDim(9, 0x01, 0x7D, 0x26, 0x3F);
_screen->modifyScreenDim(12, 0x01, 0x04, 0x14, 0xA0);
@@ -520,7 +494,7 @@ void EoBEngine::turnUndeadAutoHit() {
bool EoBEngine::checkPartyStatusExtra() {
_screen->copyPage(0, 10);
int cd = _screen->curDimIndex();
- gui_drawBox(0, 121, 320, 80, _color1_1, _color2_1, _bkgColor_1);
+ gui_drawBox(0, 121, 320, 80, guiSettings()->colors.frame1, guiSettings()->colors.frame2, guiSettings()->colors.fill);
_txt->setupField(9, false);
_txt->printMessage(_menuStringsDefeat[0]);
while (!shouldQuit()) {
@@ -573,6 +547,10 @@ void EoBEngine::healParty() {
}
}
+const KyraRpgGUISettings *EoBEngine::guiSettings() {
+ return &_guiSettings;
+}
+
} // End of namespace Kyra
#endif // ENABLE_EOB
diff --git a/engines/kyra/eob.h b/engines/kyra/eob.h
index 0f83c47..6123c26 100644
--- a/engines/kyra/eob.h
+++ b/engines/kyra/eob.h
@@ -139,6 +139,10 @@ private:
bool checkPartyStatusExtra();
int resurrectionSelectDialogue();
void healParty();
+
+ const KyraRpgGUISettings *guiSettings();
+
+ static const KyraRpgGUISettings _guiSettings;
};
diff --git a/engines/kyra/eobcommon.cpp b/engines/kyra/eobcommon.cpp
index 8e14b89..bc01fea 100644
--- a/engines/kyra/eobcommon.cpp
+++ b/engines/kyra/eobcommon.cpp
@@ -107,11 +107,6 @@ EoBCoreEngine::EoBCoreEngine(OSystem *system, const GameFlags &flags)
_dscDoorY1 = 0;
_dscDoorXE = 0;
- _color9 = 17;
- _color10 = 23;
- _color11 = 20;
- _color4 = _color5 = _color6 = _color7 = _color8 = _color12 = _color13 = _color14 = 0;
-
_menuDefs = 0;
_exchangeCharacterId = -1;
@@ -1106,7 +1101,7 @@ void EoBCoreEngine::npcSequence(int npcIndex) {
_screen->loadFileDataToPage(s, 5, 32000);
delete s;
- gui_drawBox(0, 121, 320, 79, _color1_1, _color2_1, _bkgColor_1);
+ gui_drawBox(0, 121, 320, 79, guiSettings()->colors.frame1, guiSettings()->colors.frame2, guiSettings()->colors.fill);
_txt->setupField(9, true);
_txt->resetPageBreakString();
@@ -1544,7 +1539,7 @@ void EoBCoreEngine::displayParchment(int id) {
// display text
Common::SeekableReadStream *s = _res->createReadStream("TEXT.DAT");
_screen->loadFileDataToPage(s, 5, 32000);
- gui_drawBox(0, 0, 176, 175, _color1_1, _color2_1, _bkgColor_1);
+ gui_drawBox(0, 0, 176, 175, guiSettings()->colors.frame1, guiSettings()->colors.frame2, guiSettings()->colors.fill);
_txt->setupField(12, 1);
if (_flags.gameID == GI_EOB2)
id++;
@@ -1686,21 +1681,21 @@ bool EoBCoreEngine::checkPassword() {
_screen->copyPage(0, 10);
_screen->setScreenDim(13);
- gui_drawBox(_screen->_curDim->sx << 3, _screen->_curDim->sy, _screen->_curDim->w << 3, _screen->_curDim->h, _color1_1, _color2_1, -1);
- gui_drawBox((_screen->_curDim->sx << 3) + 1, _screen->_curDim->sy + 1, (_screen->_curDim->w << 3) - 2, _screen->_curDim->h - 2, _color1_1, _color2_1, _bkgColor_1);
+ gui_drawBox(_screen->_curDim->sx << 3, _screen->_curDim->sy, _screen->_curDim->w << 3, _screen->_curDim->h, guiSettings()->colors.frame1, guiSettings()->colors.frame2, -1);
+ gui_drawBox((_screen->_curDim->sx << 3) + 1, _screen->_curDim->sy + 1, (_screen->_curDim->w << 3) - 2, _screen->_curDim->h - 2, guiSettings()->colors.frame1, guiSettings()->colors.frame2, guiSettings()->colors.fill);
_screen->modifyScreenDim(13, _screen->_curDim->sx + 1, _screen->_curDim->sy + 2, _screen->_curDim->w - 2, _screen->_curDim->h - 16);
for (int i = 0; i < 3; i++) {
- _screen->fillRect(_screen->_curDim->sx << 3, _screen->_curDim->sy, ((_screen->_curDim->sx + _screen->_curDim->w) << 3) - 1, (_screen->_curDim->sy + _screen->_curDim->h) - 1, _bkgColor_1);
+ _screen->fillRect(_screen->_curDim->sx << 3, _screen->_curDim->sy, ((_screen->_curDim->sx + _screen->_curDim->w) << 3) - 1, (_screen->_curDim->sy + _screen->_curDim->h) - 1, guiSettings()->colors.fill);
int c = rollDice(1, _mnNumWord - 1, -1);
const uint8 *shp = (_mnDef[c << 2] < _numLargeItemShapes) ? _largeItemShapes[_mnDef[c << 2]] : (_mnDef[c << 2] < 15 ? 0 : _smallItemShapes[_mnDef[c << 2] - 15]);
assert(shp);
_screen->drawShape(0, shp, 100, 2, 13);
- _screen->printShadedText(Common::String::format(_mnPrompt[0], _mnDef[(c << 2) + 1], _mnDef[(c << 2) + 2]).c_str(), (_screen->_curDim->sx + 1) << 3, _screen->_curDim->sy, _screen->_curDim->unk8, _bkgColor_1);
+ _screen->printShadedText(Common::String::format(_mnPrompt[0], _mnDef[(c << 2) + 1], _mnDef[(c << 2) + 2]).c_str(), (_screen->_curDim->sx + 1) << 3, _screen->_curDim->sy, _screen->_curDim->unk8, guiSettings()->colors.fill);
memset(answ, 0, 20);
- gui_drawBox(76, 100, 133, 14, _color2_1, _color1_1, -1);
- gui_drawBox(77, 101, 131, 12, _color2_1, _color1_1, -1);
- if (_gui->getTextInput(answ, 10, 103, 15, _screen->_curDim->unk8, _bkgColor_1, 8) < 0)
+ gui_drawBox(76, 100, 133, 14, guiSettings()->colors.frame2, guiSettings()->colors.frame1, -1);
+ gui_drawBox(77, 101, 131, 12, guiSettings()->colors.frame2, guiSettings()->colors.frame1, -1);
+ if (_gui->getTextInput(answ, 10, 103, 15, _screen->_curDim->unk8, guiSettings()->colors.fill, 8) < 0)
i = 3;
if (!scumm_stricmp(_mnWord[c], answ))
break;
diff --git a/engines/kyra/eobcommon.h b/engines/kyra/eobcommon.h
index fa65c93..9284a18 100644
--- a/engines/kyra/eobcommon.h
+++ b/engines/kyra/eobcommon.h
@@ -764,18 +764,6 @@ protected:
char _dialogueLastBitmap[13];
int _moveCounter;
- uint8 _color4;
- uint8 _color5;
- uint8 _color6;
- uint8 _color7;
- uint8 _color8;
- uint8 _color9;
- uint8 _color10;
- uint8 _color11;
- uint8 _color12;
- uint8 _color13;
- uint8 _color14;
-
const char *const *_chargenStatStrings;
const char *const *_chargenRaceSexStrings;
const char *const *_chargenClassStrings;
diff --git a/engines/kyra/gui_eob.cpp b/engines/kyra/gui_eob.cpp
index 51a9e52..1ccb60a 100644
--- a/engines/kyra/gui_eob.cpp
+++ b/engines/kyra/gui_eob.cpp
@@ -100,9 +100,9 @@ void EoBCoreEngine::gui_drawCharPortraitWithStats(int index) {
int cp = _screen->setCurPage(2);
if (index == _exchangeCharacterId)
- _screen->printText(_characterGuiStringsSt[0], x2 + 2, y2 + 2, 8, _bkgColor_1);
+ _screen->printText(_characterGuiStringsSt[0], x2 + 2, y2 + 2, 8, guiSettings()->colors.fill);
else
- _screen->printText(c->name, x2 + 2, y2 + 2, txtCol1, _bkgColor_1);
+ _screen->printText(c->name, x2 + 2, y2 + 2, txtCol1, guiSettings()->colors.fill);
gui_drawFaceShape(index);
gui_drawWeaponSlot(index, 0);
@@ -129,23 +129,23 @@ void EoBCoreEngine::gui_drawCharPortraitWithStats(int index) {
_screen->copyRegion(176, 0, 0, 0, 144, 168, 2, 2, Screen::CR_NO_P_CHECK);
_screen->_curPage = 2;
gui_drawFaceShape(index);
- _screen->printShadedText(c->name, 219, 6, txtCol2, _bkgColor_1);
+ _screen->printShadedText(c->name, 219, 6, txtCol2, guiSettings()->colors.fill);
gui_drawHitpoints(index);
gui_drawFoodStatusGraph(index);
if (_currentControlMode == 1) {
if (c->hitPointsCur == -10)
- _screen->printShadedText(_characterGuiStringsSt[1], 247, 158, 6, _color6);
+ _screen->printShadedText(_characterGuiStringsSt[1], 247, 158, 6, guiSettings()->colors.extraFill);
else if (c->hitPointsCur < 1)
- _screen->printShadedText(_characterGuiStringsSt[2], 226, 158, 6, _color6);
+ _screen->printShadedText(_characterGuiStringsSt[2], 226, 158, 6, guiSettings()->colors.extraFill);
else if (c->effectFlags & (_flags.gameID == GI_EOB1 ? 0x80 : 0x2000))
- _screen->printShadedText(_characterGuiStringsSt[3], 220, 158, 6, _color6);
+ _screen->printShadedText(_characterGuiStringsSt[3], 220, 158, 6, guiSettings()->colors.extraFill);
else if (c->flags & 2)
- _screen->printShadedText(_characterGuiStringsSt[4], 235, 158, 6, _color6);
+ _screen->printShadedText(_characterGuiStringsSt[4], 235, 158, 6, guiSettings()->colors.extraFill);
else if (c->flags & 4)
- _screen->printShadedText(_characterGuiStringsSt[5], 232, 158, 6, _color6);
+ _screen->printShadedText(_characterGuiStringsSt[5], 232, 158, 6, guiSettings()->colors.extraFill);
else if (c->flags & 8)
- _screen->printShadedText(_characterGuiStringsSt[6], 232, 158, 6, _color6);
+ _screen->printShadedText(_characterGuiStringsSt[6], 232, 158, 6, guiSettings()->colors.extraFill);
for (int i = 0; i < 27; i++)
gui_drawInventoryItem(i, 0, 2);
@@ -158,38 +158,38 @@ void EoBCoreEngine::gui_drawCharPortraitWithStats(int index) {
static const uint16 cm2Y2[] = { 165, 165, 147 };
for (int i = 0; i < 3; i++)
- _screen->fillRect(cm2X1[i], cm2Y1[i], cm2X2[i], cm2Y2[i], _color6);
+ _screen->fillRect(cm2X1[i], cm2Y1[i], cm2X2[i], cm2Y2[i], guiSettings()->colors.extraFill);
- _screen->printShadedText(_characterGuiStringsIn[0], 183, 42, 15, _color6);
- _screen->printText(_chargenClassStrings[c->cClass], 183, 55, 12, _color6);
- _screen->printText(_chargenAlignmentStrings[c->alignment], 183, 62, 12, _color6);
- _screen->printText(_chargenRaceSexStrings[c->raceSex], 183, 69, 12, _color6);
+ _screen->printShadedText(_characterGuiStringsIn[0], 183, 42, 15, guiSettings()->colors.extraFill);
+ _screen->printText(_chargenClassStrings[c->cClass], 183, 55, 12, guiSettings()->colors.extraFill);
+ _screen->printText(_chargenAlignmentStrings[c->alignment], 183, 62, 12, guiSettings()->colors.extraFill);
+ _screen->printText(_chargenRaceSexStrings[c->raceSex], 183, 69, 12, guiSettings()->colors.extraFill);
for (int i = 0; i < 6; i++)
- _screen->printText(_chargenStatStrings[6 + i], 183, 82 + i * 7, 12, _color6);
+ _screen->printText(_chargenStatStrings[6 + i], 183, 82 + i * 7, 12, guiSettings()->colors.extraFill);
- _screen->printText(_characterGuiStringsIn[1], 183, 124, 12, _color6);
- _screen->printText(_characterGuiStringsIn[2], 239, 138, 12, _color6);
- _screen->printText(_characterGuiStringsIn[3], 278, 138, 12, _color6);
+ _screen->printText(_characterGuiStringsIn[1], 183, 124, 12, guiSettings()->colors.extraFill);
+ _screen->printText(_characterGuiStringsIn[2], 239, 138, 12, guiSettings()->colors.extraFill);
+ _screen->printText(_characterGuiStringsIn[3], 278, 138, 12, guiSettings()->colors.extraFill);
- _screen->printText(getCharStrength(c->strengthCur, c->strengthExtCur).c_str(), 275, 82, 15, _color6);
- _screen->printText(Common::String::format("%d", c->intelligenceCur).c_str(), 275, 89, 15, _color6);
- _screen->printText(Common::String::format("%d", c->wisdomCur).c_str(), 275, 96, 15, _color6);
- _screen->printText(Common::String::format("%d", c->dexterityCur).c_str(), 275, 103, 15, _color6);
- _screen->printText(Common::String::format("%d", c->constitutionCur).c_str(), 275, 110, 15, _color6);
- _screen->printText(Common::String::format("%d", c->charismaCur).c_str(), 275, 117, 15, _color6);
- _screen->printText(Common::String::format("%d", c->armorClass).c_str(), 275, 124, 15, _color6);
+ _screen->printText(getCharStrength(c->strengthCur, c->strengthExtCur).c_str(), 275, 82, 15, guiSettings()->colors.extraFill);
+ _screen->printText(Common::String::format("%d", c->intelligenceCur).c_str(), 275, 89, 15, guiSettings()->colors.extraFill);
+ _screen->printText(Common::String::format("%d", c->wisdomCur).c_str(), 275, 96, 15, guiSettings()->colors.extraFill);
+ _screen->printText(Common::String::format("%d", c->dexterityCur).c_str(), 275, 103, 15, guiSettings()->colors.extraFill);
+ _screen->printText(Common::String::format("%d", c->constitutionCur).c_str(), 275, 110, 15, guiSettings()->colors.extraFill);
+ _screen->printText(Common::String::format("%d", c->charismaCur).c_str(), 275, 117, 15, guiSettings()->colors.extraFill);
+ _screen->printText(Common::String::format("%d", c->armorClass).c_str(), 275, 124, 15, guiSettings()->colors.extraFill);
for (int i = 0; i < 3; i++) {
int t = getCharacterClassType(c->cClass, i);
if (t == -1)
continue;
- _screen->printText(_chargenClassStrings[t + 15], 180, 145 + 7 * i, 12, _color6);
+ _screen->printText(_chargenClassStrings[t + 15], 180, 145 + 7 * i, 12, guiSettings()->colors.extraFill);
Common::String tmpStr = Common::String::format("%d", c->experience[i]);
- _screen->printText(tmpStr.c_str(), 251 - tmpStr.size() * 3, 145 + 7 * i, 15, _color6);
+ _screen->printText(tmpStr.c_str(), 251 - tmpStr.size() * 3, 145 + 7 * i, 15, guiSettings()->colors.extraFill);
tmpStr = Common::String::format("%d", c->level[i]);
- _screen->printText(tmpStr.c_str(), 286 - tmpStr.size() * 3, 145 + 7 * i, 15, _color6);
+ _screen->printText(tmpStr.c_str(), 286 - tmpStr.size() * 3, 145 + 7 * i, 15, guiSettings()->colors.extraFill);
}
}
@@ -272,7 +272,7 @@ void EoBCoreEngine::gui_drawWeaponSlot(int charIndex, int slot) {
x += 176;
int itm = _characters[charIndex].inventory[slot];
- gui_drawBox(x, y, 31, 16, _color1_1, _color2_1, _bkgColor_1);
+ gui_drawBox(x, y, 31, 16, guiSettings()->colors.frame1, guiSettings()->colors.frame2, guiSettings()->colors.fill);
if (_characters[charIndex].slotStatus[slot]) {
gui_drawWeaponSlotStatus(x, y, _characters[charIndex].slotStatus[slot]);
@@ -297,7 +297,7 @@ void EoBCoreEngine::gui_drawWeaponSlotStatus(int x, int y, int status) {
if (status > -3 || status == -5)
_screen->drawShape(_screen->_curPage, _greenSplatShape, x - 1, y, 0);
else
- gui_drawBox(x, y, 31, 16, _color9, _color10, _color11);
+ gui_drawBox(x, y, 31, 16, guiSettings()->colors.warningFrame1, guiSettings()->colors.warningFrame2, guiSettings()->colors.warningFill);
switch (status + 5) {
case 0:
@@ -369,7 +369,7 @@ void EoBCoreEngine::gui_drawHitpoints(int index) {
_screen->printText(_characterGuiStringsHp[0], x - 13, y - 1, 12, 0);
- gui_drawHorizontalBarGraph(x, y, w, h, bgCur, bgMax, barColor[col], _color5);
+ gui_drawHorizontalBarGraph(x, y, w, h, bgCur, bgMax, barColor[col], guiSettings()->colors.barGraph);
} else {
Common::String tmpString = Common::String::format(_characterGuiStringsHp[1], c->hitPointsCur, c->hitPointsMax);
@@ -379,7 +379,7 @@ void EoBCoreEngine::gui_drawHitpoints(int index) {
y -= 1;
}
- _screen->printText(tmpString.c_str(), x, y, 12, _bkgColor_1);
+ _screen->printText(tmpString.c_str(), x, y, 12, guiSettings()->colors.fill);
}
}
@@ -398,11 +398,11 @@ void EoBCoreEngine::gui_drawFoodStatusGraph(int index) {
return;
uint8 col = c->food < 20 ? 8 : (c->food < 33 ? 5 : 3);
- gui_drawHorizontalBarGraph(250, 25, 51, 5, c->food, 100, col, _color5);
+ gui_drawHorizontalBarGraph(250, 25, 51, 5, c->food, 100, col, guiSettings()->colors.barGraph);
}
void EoBCoreEngine::gui_drawHorizontalBarGraph(int x, int y, int w, int h, int32 curVal, int32 maxVal, int col1, int col2) {
- gui_drawBox(x - 1, y - 1, w + 3, h + 2, _color2_1, _color1_1, -1);
+ gui_drawBox(x - 1, y - 1, w + 3, h + 2, guiSettings()->colors.frame2, guiSettings()->colors.frame1, -1);
KyraRpgEngine::gui_drawHorizontalBarGraph(x, y, w + 2, h, curVal, maxVal, col1, col2);
}
@@ -464,8 +464,8 @@ void EoBCoreEngine::gui_drawCharPortraitStatusFrame(int index) {
}
} else {
- _screen->drawClippedLine(x, y, x + 62, y, _color1_1);
- _screen->drawClippedLine(x, y + 49, x + 62, y + 49, _color2_1);
+ _screen->drawClippedLine(x, y, x + 62, y, guiSettings()->colors.frame1);
+ _screen->drawClippedLine(x, y + 49, x + 62, y + 49, guiSettings()->colors.frame2);
_screen->drawClippedLine(x - 1, y, x - 1, y + 50, 12);
_screen->drawClippedLine(x + 63, y, x + 63, y + 50, 12);
}
@@ -480,7 +480,7 @@ void EoBCoreEngine::gui_drawInventoryItem(int slot, int special, int pageNum) {
if (special) {
int wh = (slot == 25 || slot == 26) ? 10 : 18;
- gui_drawBox(x - 1, y - 1, wh, wh, _color1_1, _color2_1, slot == 16 ? -1 : _bkgColor_1);
+ gui_drawBox(x - 1, y - 1, wh, wh, guiSettings()->colors.frame1, guiSettings()->colors.frame2, slot == 16 ? -1 : guiSettings()->colors.fill);
if (slot == 16) {
_screen->fillRect(227, 65, 238, 69, 12);
@@ -517,7 +517,7 @@ void EoBCoreEngine::gui_drawCompass(bool force) {
}
void EoBCoreEngine::gui_drawDialogueBox() {
- gui_drawBox(0, 121, 320, 79, _color1_1, _color2_1, _bkgColor_1);
+ gui_drawBox(0, 121, 320, 79, guiSettings()->colors.frame1, guiSettings()->colors.frame2, guiSettings()->colors.fill);
txt()->clearCurDim();
}
@@ -527,14 +527,14 @@ void EoBCoreEngine::gui_drawSpellbook() {
_screen->copyRegion(64, 121, 64, 121, 112, 56, 0, 2, Screen::CR_NO_P_CHECK);
for (int i = 0; i < numTab; i++) {
- int col1 = _color14;
- int col2 = _color13;
- int col3 = _color12;
+ int col1 = guiSettings()->colors.inactiveTabFrame1;
+ int col2 = guiSettings()->colors.inactiveTabFrame2;
+ int col3 = guiSettings()->colors.inactiveTabFill;
if (i == _openBookSpellLevel) {
- col1 = _color1_1;
- col2 = _color2_1;
- col3 = _bkgColor_1;
+ col1 = guiSettings()->colors.frame1;
+ col2 = guiSettings()->colors.frame2;
+ col3 = guiSettings()->colors.fill;
}
if (_flags.gameID == GI_EOB1) {
@@ -547,12 +547,12 @@ void EoBCoreEngine::gui_drawSpellbook() {
}
if (_flags.gameID == GI_EOB1)
- gui_drawBox(71, 131, 105, 44, _color1_1, _color2_1, _bkgColor_1);
+ gui_drawBox(71, 131, 105, 44, guiSettings()->colors.frame1, guiSettings()->colors.frame2, guiSettings()->colors.fill);
else {
- gui_drawBox(68, 130, 108, 47, _color1_1, _color2_1, _bkgColor_1);
- gui_drawBox(68, 168, 78, 9, _color8, _color7, _color6);
- gui_drawBox(146, 168, 14, 9, _color8, _color7, _color6);
- gui_drawBox(160, 168, 16, 9, _color8, _color7, _color6);
+ gui_drawBox(68, 130, 108, 47, guiSettings()->colors.frame1, guiSettings()->colors.frame2, guiSettings()->colors.fill);
+ gui_drawBox(68, 168, 78, 9, guiSettings()->colors.extraFrame1, guiSettings()->colors.extraFrame2, guiSettings()->colors.extraFill);
+ gui_drawBox(146, 168, 14, 9, guiSettings()->colors.extraFrame1, guiSettings()->colors.extraFrame2, guiSettings()->colors.extraFill);
+ gui_drawBox(160, 168, 16, 9, guiSettings()->colors.extraFrame1, guiSettings()->colors.extraFrame2, guiSettings()->colors.extraFill);
gui_drawSpellbookScrollArrow(150, 169, 0);
gui_drawSpellbookScrollArrow(165, 169, 1);
}
@@ -562,14 +562,14 @@ void EoBCoreEngine::gui_drawSpellbook() {
int textXa = 74;
int textXs = 71;
int textY = 170;
- int col3 = _bkgColor_1;
- int col4 = _color6;
+ int col3 = guiSettings()->colors.fill;
+ int col4 = guiSettings()->colors.extraFill;
if (_flags.gameID == GI_EOB1) {
textCol2 = 11;
textXa = textXs = 73;
textY = 168;
- col4 = _bkgColor_1;
+ col4 = guiSettings()->colors.fill;
}
for (int i = 0; i < 7; i++) {
@@ -2377,7 +2377,7 @@ void GUI_EoB::messageDialogue2(int dim, int id, int buttonTextCol) {
}
}
- _vm->gui_drawBox(x, y, w, 14, _vm->_color2_1, _vm->_bkgColor_1, -1);
+ _vm->gui_drawBox(x, y, w, 14, _vm->guiSettings()->colors.frame2, _vm->guiSettings()->colors.fill, -1);
_screen->updateScreen();
_vm->_system->delayMillis(80);
drawMenuButtonBox(x, y, w, 14, false, false);
@@ -2657,7 +2657,7 @@ bool GUI_EoB::runSaveMenu(int x, int y) {
int fy = y + slot * 17 + 23;
for (int in = -1; in == -1 && !_vm->shouldQuit();) {
- _screen->fillRect(fx - 2, fy, fx + 160, fy + 8, _vm->_bkgColor_1);
+ _screen->fillRect(fx - 2, fy, fx + 160, fy + 8, _vm->guiSettings()->colors.fill);
in = getTextInput(_saveSlotStringsTemp[slot], x + 1, fy, 19, 2, 0, 8);
if (!strlen(_saveSlotStringsTemp[slot])) {
messageDialogue(11, 54, 6);
@@ -2665,7 +2665,7 @@ bool GUI_EoB::runSaveMenu(int x, int y) {
}
};
- _screen->fillRect(fx - 2, fy, fx + 160, fy + 8, _vm->_bkgColor_1);
+ _screen->fillRect(fx - 2, fy, fx + 160, fy + 8, _vm->guiSettings()->colors.fill);
_screen->printShadedText(_saveSlotStringsTemp[slot], (x + 1) << 3, fy, 15, 0);
Graphics::Surface thumb;
@@ -2778,7 +2778,7 @@ 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);
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->printText(Common::String::format("%03d/989", sli).c_str(), _saveSlotX + 5, _saveSlotY + 135, _vm->guiSettings()->colors.frame2, _vm->guiSettings()->colors.fill);
_screen->setFont(Screen::FID_8_FNT);
_screen->updateScreen();
@@ -2937,7 +2937,7 @@ void GUI_EoB::runMemorizePrayMenu(int charIndex, int spellType) {
if (updateDesc) {
updateDesc = false;
- _screen->printShadedText(Common::String::format(_vm->_menuStringsMgc[1], np[lastHighLightButton] - numAssignedSpellsPerBookPage[lastHighLightButton], np[lastHighLightButton]).c_str(), 8, 38, 9, _vm->_bkgColor_1);
+ _screen->printShadedText(Common::String::format(_vm->_menuStringsMgc[1], np[lastHighLightButton] - numAssignedSpellsPerBookPage[lastHighLightButton], np[lastHighLightButton]).c_str(), 8, 38, 9, _vm->guiSettings()->colors.fill);
}
if (newHighLightText < 0)
@@ -3721,7 +3721,7 @@ Button *GUI_EoB::initMenu(int id) {
if (m->dim) {
const ScreenDim *dm = _screen->getScreenDim(m->dim);
- _screen->fillRect(dm->sx << 3, dm->sy, ((dm->sx + dm->w) << 3) - 1, (dm->sy + dm->h) - 1, _vm->_bkgColor_1);
+ _screen->fillRect(dm->sx << 3, dm->sy, ((dm->sx + dm->w) << 3) - 1, (dm->sy + dm->h) - 1, _vm->guiSettings()->colors.fill);
_screen->setScreenDim(m->dim);
drawMenuButtonBox(dm->sx << 3, dm->sy, dm->w << 3, dm->h, false, false);
}
@@ -3789,14 +3789,14 @@ void GUI_EoB::drawMenuButton(Button *b, bool clicked, bool highlight, bool noFil
}
void GUI_EoB::drawMenuButtonBox(int x, int y, int w, int h, bool clicked, bool noFill) {
- uint8 col1 = _vm->_color1_1;
- uint8 col2 = _vm->_color2_1;
+ uint8 col1 = _vm->guiSettings()->colors.frame1;
+ uint8 col2 = _vm->guiSettings()->colors.frame2;
if (clicked)
- col1 = col2 = _vm->_bkgColor_1;
+ col1 = col2 = _vm->guiSettings()->colors.fill;
_vm->gui_drawBox(x, y, w, h, col1, col2, -1);
- _vm->gui_drawBox(x + 1, y + 1, w - 2, h - 2, _vm->_color1_1, _vm->_color2_1, noFill ? -1 : _vm->_bkgColor_1);
+ _vm->gui_drawBox(x + 1, y + 1, w - 2, h - 2, _vm->guiSettings()->colors.frame1, _vm->guiSettings()->colors.frame2, noFill ? -1 : _vm->guiSettings()->colors.fill);
}
void GUI_EoB::drawTextBox(int dim, int id) {
@@ -3852,10 +3852,10 @@ void GUI_EoB::memorizePrayMenuPrintString(int spellId, int bookPageIndex, int sp
if (noFill)
_screen->printText(s.c_str(), 8, y, highLight ? 6 : 15, 0);
else
- _screen->printShadedText(s.c_str(), 8, y, highLight ? 6 : 15, _vm->_bkgColor_1);
+ _screen->printShadedText(s.c_str(), 8, y, highLight ? 6 : 15, _vm->guiSettings()->colors.fill);
} else {
- _screen->fillRect(6, y, 168, y + 8, _vm->_bkgColor_1);
+ _screen->fillRect(6, y, 168, y + 8, _vm->guiSettings()->colors.fill);
}
}
@@ -4000,7 +4000,7 @@ void GUI_EoB::restParty_updateRestTime(int hours, bool init) {
}
_screen->setCurPage(2);
- _screen->printShadedText(Common::String::format(_vm->_menuStringsRest2[3], hours).c_str(), (_screen->_curDim->sx + 1) << 3, _screen->_curDim->sy + 20, 15, _vm->_bkgColor_1);
+ _screen->printShadedText(Common::String::format(_vm->_menuStringsRest2[3], hours).c_str(), (_screen->_curDim->sx + 1) << 3, _screen->_curDim->sy + 20, 15, _vm->guiSettings()->colors.fill);
_screen->setCurPage(0);
_screen->copyRegion(((_screen->_curDim->sx + 1) << 3) - 1, _screen->_curDim->sy + 20, ((_screen->_curDim->sx + 1) << 3) - 1, _screen->_curDim->sy + 20, 144, 8, 2, 0, Screen::CR_NO_P_CHECK);
_screen->updateScreen();
diff --git a/engines/kyra/kyra_rpg.cpp b/engines/kyra/kyra_rpg.cpp
index 92aa12b..4487290 100644
--- a/engines/kyra/kyra_rpg.cpp
+++ b/engines/kyra/kyra_rpg.cpp
@@ -103,15 +103,6 @@ KyraRpgEngine::KyraRpgEngine(OSystem *system, const GameFlags &flags) : KyraEngi
_dialogueNumButtons = _dialogueButtonYoffs = _dialogueHighlightedButton = 0;
_currentControlMode = 0;
_specialSceneFlag = 0;
- _dialogueButtonLabelCol1 = 0;
- _dialogueButtonLabelCol2 = 0;
- _dialogueButtonW = 0;
- _dialogueButtonH = 0;
- _waitButtonPresX = 0;
- _waitButtonPresY = 0;
- _waitButtonPresW = 0;
- _waitButtonReverveW = 0;
-
_updateCharNum = -1;
_activeVoiceFileTotalTime = 0;
_updatePortraitSpeechAnimDuration = _resetPortraitAfterSpeechAnim = _needSceneRestore = 0;
@@ -193,6 +184,10 @@ Common::Error KyraRpgEngine::init() {
_envSfxDistThreshold = (_sound->getSfxType() == Sound::kAdLib || _sound->getSfxType() == Sound::kPCSpkr) ? 15 : 3;
+ _dialogueButtonLabelColor1 = guiSettings()->buttons.labelColor1;
+ _dialogueButtonLabelColor2 = guiSettings()->buttons.labelColor2;
+ _dialogueButtonWidth = guiSettings()->buttons.width;
+
return Common::kNoError;
}
@@ -213,9 +208,9 @@ void KyraRpgEngine::drawDialogueButtons() {
screen()->printText(_dialogueButtonString[i], (x + 37 - (screen()->getTextWidth(_dialogueButtonString[i])) / 2) & ~3,
((_dialogueButtonYoffs + _dialogueButtonPosY[i]) + 2) & ~7, _dialogueHighlightedButton == i ? 0xc1 : 0xe1, 0);
} else {
- gui_drawBox(x, (_dialogueButtonYoffs + _dialogueButtonPosY[i]), _dialogueButtonW, _dialogueButtonH, _color1_1, _color2_1, _bkgColor_1);
- screen()->printText(_dialogueButtonString[i], x + (_dialogueButtonW >> 1) - (screen()->getTextWidth(_dialogueButtonString[i])) / 2,
- (_dialogueButtonYoffs + _dialogueButtonPosY[i]) + 2, _dialogueHighlightedButton == i ? _dialogueButtonLabelCol1 : _dialogueButtonLabelCol2, 0);
+ gui_drawBox(x, (_dialogueButtonYoffs + _dialogueButtonPosY[i]), _dialogueButtonWidth, guiSettings()->buttons.height, guiSettings()->colors.frame1, guiSettings()->colors.frame2, guiSettings()->colors.fill);
+ screen()->printText(_dialogueButtonString[i], x + (_dialogueButtonWidth >> 1) - (screen()->getTextWidth(_dialogueButtonString[i])) / 2,
+ (_dialogueButtonYoffs + _dialogueButtonPosY[i]) + 2, _dialogueHighlightedButton == i ? _dialogueButtonLabelColor1 : _dialogueButtonLabelColor2, 0);
}
}
screen()->setFont(of);
@@ -230,7 +225,7 @@ uint16 KyraRpgEngine::processDialogue() {
int x = _dialogueButtonPosX[i];
int y = (gameFlags().use16ColorMode ? ((_dialogueButtonYoffs + _dialogueButtonPosY[i]) & ~7) - 1 : (_dialogueButtonYoffs + _dialogueButtonPosY[i]));
Common::Point p = getMousePos();
- if (posWithinRect(p.x, p.y, x, y, x + _dialogueButtonW, y + _dialogueButtonH)) {
+ if (posWithinRect(p.x, p.y, x, y, x + _dialogueButtonWidth, y + guiSettings()->buttons.height)) {
_dialogueHighlightedButton = i;
break;
}
@@ -266,7 +261,7 @@ uint16 KyraRpgEngine::processDialogue() {
int x = _dialogueButtonPosX[i];
int y = (gameFlags().use16ColorMode ? ((_dialogueButtonYoffs + _dialogueButtonPosY[i]) & ~7) - 1 : (_dialogueButtonYoffs + _dialogueButtonPosY[i]));
Common::Point p = getMousePos();
- if (posWithinRect(p.x, p.y, x, y, x + _dialogueButtonW, y + _dialogueButtonH)) {
+ if (posWithinRect(p.x, p.y, x, y, x + _dialogueButtonWidth, y + guiSettings()->buttons.height)) {
_dialogueHighlightedButton = i;
res = _dialogueHighlightedButton + 1;
break;
diff --git a/engines/kyra/kyra_rpg.h b/engines/kyra/kyra_rpg.h
index 678f812..24c1910 100644
--- a/engines/kyra/kyra_rpg.h
+++ b/engines/kyra/kyra_rpg.h
@@ -80,6 +80,40 @@ struct EoBFlyingObject {
uint8 unused;
};
+struct KyraRpgGUISettings {
+ struct DialogueButtons {
+ uint8 labelColor1;
+ uint8 labelColor2;
+ uint16 width;
+ uint16 height;
+ int waitReserve;
+ const uint16 waitX[2];
+ const uint8 waitY[2];
+ const uint16 waitWidth[2];
+ } buttons;
+
+ struct Colors {
+ uint8 frame1;
+ uint8 frame2;
+ int fill;
+
+ uint8 unused;
+ uint8 barGraph;
+
+ uint8 warningFrame1;
+ uint8 warningFrame2;
+ int warningFill;
+
+ uint8 extraFrame1;
+ uint8 extraFrame2;
+ int extraFill;
+
+ uint8 inactiveTabFrame1;
+ uint8 inactiveTabFrame2;
+ int inactiveTabFill;
+ } colors;
+};
+
class KyraRpgEngine : public KyraEngine_v1 {
friend class TextDisplayer_rpg;
public:
@@ -251,6 +285,8 @@ protected:
bool clickedShape(int shapeIndex);
+ virtual const KyraRpgGUISettings *guiSettings() = 0;
+
int _clickedShapeXOffs;
int _clickedShapeYOffs;
@@ -283,22 +319,13 @@ protected:
const uint16 *_dialogueButtonPosX;
const uint8 *_dialogueButtonPosY;
int16 _dialogueButtonYoffs;
- uint16 _dialogueButtonW;
- uint16 _dialogueButtonH;
- const uint16 *_waitButtonPresX;
- const uint8 *_waitButtonPresY;
- const uint16 *_waitButtonPresW;
- int _waitButtonReverveW;
+ uint16 _dialogueButtonWidth;
int _dialogueNumButtons;
int _dialogueHighlightedButton;
int _currentControlMode;
int _specialSceneFlag;
- uint8 _dialogueButtonLabelCol1;
- uint8 _dialogueButtonLabelCol2;
-
- int _bkgColor_1;
- uint8 _color1_1;
- uint8 _color2_1;
+ uint8 _dialogueButtonLabelColor1;
+ uint8 _dialogueButtonLabelColor2;
const char *const *_moreStrings;
diff --git a/engines/kyra/lol.cpp b/engines/kyra/lol.cpp
index 01b1bdf..a57fe4f 100644
--- a/engines/kyra/lol.cpp
+++ b/engines/kyra/lol.cpp
@@ -380,18 +380,8 @@ Common::Error LoLEngine::init() {
assert(_gui);
_gui->initStaticData();
- _dialogueButtonLabelCol1 = 144;
- _dialogueButtonLabelCol2 = 254;
- _dialogueButtonW = 74;
- _dialogueButtonH = 9;
- _waitButtonReverveW = 80;
-
_txt = new TextDisplayer_LoL(this, _screen);
- _bkgColor_1 = -1;
- _color1_1 = 136;
- _color2_1 = 251;
-
_screen->setAnimBlockPtr(10000);
_screen->setScreenDim(0);
@@ -1941,7 +1931,7 @@ void LoLEngine::setupDialogueButtons(int numStr, const char *s1, const char *s2,
_dialogueButtonPosY = posY;
if (numStr == 1) {
- posX[0] = posX[1] = posX[2] = d->sx + d->w - (_dialogueButtonW + 3);
+ posX[0] = posX[1] = posX[2] = d->sx + d->w - (_dialogueButtonWidth + 3);
} else {
int xOffs = d->w / numStr;
posX[0] = d->sx + (xOffs >> 1) - 37;
@@ -1989,6 +1979,10 @@ void LoLEngine::delay(uint32 millis, bool doUpdate, bool) {
}
}
+const KyraRpgGUISettings *LoLEngine::guiSettings() {
+ return &_guiSettings;
+}
+
// spells
int LoLEngine::castSpell(int charNum, int spellType, int spellLevel) {
diff --git a/engines/kyra/lol.h b/engines/kyra/lol.h
index eeaa1b5..c6d05c4 100644
--- a/engines/kyra/lol.h
+++ b/engines/kyra/lol.h
@@ -1149,6 +1149,8 @@ private:
// misc
void delay(uint32 millis, bool doUpdate = false, bool isMainLoop = false);
+ const KyraRpgGUISettings *guiSettings();
+
uint8 _compassBroken;
uint8 _drainMagic;
uint16 _globalScriptVars2[8];
@@ -1156,6 +1158,8 @@ private:
uint8 *_pageBuffer1;
uint8 *_pageBuffer2;
+ static const KyraRpgGUISettings _guiSettings;
+
// spells
typedef Common::Functor1Mem<ActiveSpell *, int, LoLEngine> SpellProc;
Common::Array<const SpellProc*> _spellProcs;
diff --git a/engines/kyra/sequences_eob.cpp b/engines/kyra/sequences_eob.cpp
index 8fdd868..2d8e854 100644
--- a/engines/kyra/sequences_eob.cpp
+++ b/engines/kyra/sequences_eob.cpp
@@ -166,7 +166,7 @@ void EoBEngine::seq_playFinale() {
_txt->resetPageBreakString();
_txt->setWaitButtonMode(1);
_txt->setupField(12, true);
- gui_drawBox(0, 0, 176, 175, _color1_1, _color2_1, _bkgColor_1);
+ gui_drawBox(0, 0, 176, 175, guiSettings()->colors.frame1, guiSettings()->colors.frame2, guiSettings()->colors.fill);
_txt->printDialogueText(51, _moreStrings[0]);
if (!checkScriptFlags(0x1ffe)) {
diff --git a/engines/kyra/staticres_eob.cpp b/engines/kyra/staticres_eob.cpp
index d51bf4e..ce43d22 100644
--- a/engines/kyra/staticres_eob.cpp
+++ b/engines/kyra/staticres_eob.cpp
@@ -1190,6 +1190,11 @@ void EoBEngine::initSpells() {
}
}
+const KyraRpgGUISettings EoBEngine::_guiSettings = {
+ { 9, 15, 95, 9, 7, { 285, 139 }, { 189, 162 }, { 31, 31 } },
+ { 135, 130, 132, 133, 133, 17, 23, 20, 184, 177, 180, 184, 177, 180 }
+};
+
void DarkMoonEngine::initStaticResource() {
int temp;
_mainMenuStrings = _staticres->loadStrings(kEoB2MainMenuStrings, temp);
@@ -1312,6 +1317,11 @@ const char *DarkMoonEngine::_palFilesFinale[] = {
0
};
+const KyraRpgGUISettings DarkMoonEngine::_guiSettings = {
+ { 9, 15, 95, 9, 7, { 221, 76 }, { 189, 162 }, { 95, 95 } },
+ { 186, 181, 183, 133, 184, 17, 23, 20, 186, 181, 183, 182, 177, 180 }
+};
+
#endif // ENABLE_EOB
} // End of namespace Kyra
diff --git a/engines/kyra/staticres_lol.cpp b/engines/kyra/staticres_lol.cpp
index 3faef7b..deb6355 100644
--- a/engines/kyra/staticres_lol.cpp
+++ b/engines/kyra/staticres_lol.cpp
@@ -764,6 +764,11 @@ const int8 LoLEngine::_mapCoords[12][4] = {
{ 3, 1, 3, 1 }, { -1, 6, -1, -8 }, { -7, -1, 5, -1 }
};
+const KyraRpgGUISettings LoLEngine::_guiSettings = {
+ { 144, 254, 74, 9, 80, { 0, 0 }, { 0, 0 }, { 0, 0 } },
+ { 136, 251, -1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }
+};
+
const MistOfDoomAnimData LoLEngine::_mistAnimData[] = {
{ 0, 7, 7, 13, 155 },
{ 0, 16, 16, 17, 155 },
diff --git a/engines/kyra/text_rpg.cpp b/engines/kyra/text_rpg.cpp
index 78206d3..a78adb9 100644
--- a/engines/kyra/text_rpg.cpp
+++ b/engines/kyra/text_rpg.cpp
@@ -73,7 +73,7 @@ TextDisplayer_rpg::~TextDisplayer_rpg() {
void TextDisplayer_rpg::setupField(int dim, bool mode) {
setPageBreakFlag();
- _textDimData[dim].color2 = _vm->_bkgColor_1;
+ _textDimData[dim].color2 = _vm->guiSettings()->colors.fill;
_screen->setScreenDim(dim);
if (mode)
@@ -335,13 +335,13 @@ void TextDisplayer_rpg::printLine(char *str) {
if ((lw + _textDimData[sdx].column) > w) {
if ((lines - 1 - (_waitButtonSpace << 1)) <= _lineCount)
// cut off line to leave space for "MORE" button
- w -= vm()->_waitButtonReverveW;
+ w -= vm()->guiSettings()->buttons.waitReserve;
} else {
if (!_sjisLineBreakFlag || (_lineCount + 1 < lines - 1))
ct = false;
else
// cut off line to leave space for "MORE" button
- w -= vm()->_waitButtonReverveW;
+ w -= vm()->guiSettings()->buttons.waitReserve;
}
if (ct) {
@@ -363,7 +363,7 @@ void TextDisplayer_rpg::printLine(char *str) {
if ((lw + _textDimData[sdx].column) > w) {
if ((lines - 1) <= _lineCount && _allowPageBreak)
// cut off line to leave space for "MORE" button
- w -= vm()->_waitButtonReverveW;
+ w -= vm()->guiSettings()->buttons.waitReserve;
w -= _textDimData[sdx].column;
@@ -510,7 +510,7 @@ int TextDisplayer_rpg::clearDim(int dim) {
int res = _screen->curDimIndex();
_screen->setScreenDim(dim);
_textDimData[dim].color1 = _screen->_curDim->unk8;
- _textDimData[dim].color2 = vm()->game() == GI_LOL ? _screen->_curDim->unkA : vm()->_bkgColor_1;
+ _textDimData[dim].color2 = vm()->game() == GI_LOL ? _screen->_curDim->unkA : vm()->guiSettings()->colors.fill;
clearCurDim();
return res;
}
@@ -529,7 +529,7 @@ void TextDisplayer_rpg::clearCurDim() {
void TextDisplayer_rpg::textPageBreak() {
if (vm()->game() != GI_LOL)
- SWAP(vm()->_dialogueButtonLabelCol1, vm()->_dialogueButtonLabelCol2);
+ SWAP(vm()->_dialogueButtonLabelColor1, vm()->_dialogueButtonLabelColor2);
int cp = _screen->setCurPage(0);
Screen::FontId cf = _screen->setFont(vm()->gameFlags().use16ColorMode ? Screen::FID_SJIS_FNT : Screen::FID_6_FNT);
@@ -555,9 +555,9 @@ void TextDisplayer_rpg::textPageBreak() {
const ScreenDim *dim = _screen->getScreenDim(_screen->curDimIndex());
- int x = ((dim->sx + dim->w) << 3) - (_vm->_dialogueButtonW + 3);
+ int x = ((dim->sx + dim->w) << 3) - (_vm->_dialogueButtonWidth + 3);
int y = 0;
- int w = vm()->_dialogueButtonW;
+ int w = vm()->_dialogueButtonWidth;
if (vm()->game() == GI_LOL) {
if (vm()->_needSceneRestore && (vm()->_updateFlags & 2)) {
@@ -571,17 +571,17 @@ void TextDisplayer_rpg::textPageBreak() {
y = dim->sy + dim->h - 10;
}
} else {
- y = vm()->_waitButtonPresY[_waitButtonMode];
- x = vm()->_waitButtonPresX[_waitButtonMode];
- w = vm()->_waitButtonPresW[_waitButtonMode];
+ y = vm()->guiSettings()->buttons.waitY[_waitButtonMode];
+ x = vm()->guiSettings()->buttons.waitX[_waitButtonMode];
+ w = vm()->guiSettings()->buttons.waitWidth[_waitButtonMode];
}
if (vm()->gameFlags().use16ColorMode) {
vm()->gui_drawBox(x + 8, (y & ~7) - 1, 66, 10, 0xee, 0xcc, -1);
_screen->printText(_pageBreakString, (x + 37 - (strlen(_pageBreakString) << 1) + 4) & ~3, (y + 2) & ~7, 0xc1, 0);
} else {
- vm()->gui_drawBox(x, y, w, vm()->_dialogueButtonH, vm()->_color1_1, vm()->_color2_1, vm()->_bkgColor_1);
- _screen->printText(_pageBreakString, x + (w >> 1) - (vm()->screen()->getTextWidth(_pageBreakString) >> 1), y + 2, vm()->_dialogueButtonLabelCol1, 0);
+ vm()->gui_drawBox(x, y, w, vm()->guiSettings()->buttons.height, vm()->guiSettings()->colors.frame1, vm()->guiSettings()->colors.frame2, vm()->guiSettings()->colors.fill);
+ _screen->printText(_pageBreakString, x + (w >> 1) - (vm()->screen()->getTextWidth(_pageBreakString) >> 1), y + 2, vm()->_dialogueButtonLabelColor1, 0);
}
vm()->removeInputTop();
@@ -650,7 +650,7 @@ void TextDisplayer_rpg::textPageBreak() {
_screen->setCurPage(cp);
if (vm()->game() != GI_LOL)
- SWAP(vm()->_dialogueButtonLabelCol1, vm()->_dialogueButtonLabelCol2);
+ SWAP(vm()->_dialogueButtonLabelColor1, vm()->_dialogueButtonLabelColor2);
vm()->removeInputTop();
}
@@ -662,12 +662,12 @@ void TextDisplayer_rpg::displayWaitButton() {
vm()->_dialogueButtonString[2] = 0;
vm()->_dialogueHighlightedButton = 0;
- vm()->_dialogueButtonPosX = &vm()->_waitButtonPresX[_waitButtonMode];
- vm()->_dialogueButtonPosY = &vm()->_waitButtonPresY[_waitButtonMode];
- vm()->_dialogueButtonW = vm()->_waitButtonPresW[_waitButtonMode];
+ vm()->_dialogueButtonPosX = &vm()->guiSettings()->buttons.waitX[_waitButtonMode];
+ vm()->_dialogueButtonPosY = &vm()->guiSettings()->buttons.waitY[_waitButtonMode];
+ vm()->_dialogueButtonWidth = vm()->guiSettings()->buttons.waitWidth[_waitButtonMode];
vm()->_dialogueButtonYoffs = 0;
- SWAP(vm()->_dialogueButtonLabelCol1, vm()->_dialogueButtonLabelCol2);
+ SWAP(vm()->_dialogueButtonLabelColor1, vm()->_dialogueButtonLabelColor2);
vm()->drawDialogueButtons();
if (!vm()->shouldQuit())
@@ -675,10 +675,10 @@ void TextDisplayer_rpg::displayWaitButton() {
while (!vm()->processDialogue() && !vm()->shouldQuit()) {}
- _screen->fillRect(vm()->_dialogueButtonPosX[0], vm()->_dialogueButtonPosY[0], vm()->_dialogueButtonPosX[0] + vm()->_dialogueButtonW - 1, vm()->_dialogueButtonPosY[0] + vm()->_dialogueButtonH - 1, vm()->_bkgColor_1);
+ _screen->fillRect(vm()->_dialogueButtonPosX[0], vm()->_dialogueButtonPosY[0], vm()->_dialogueButtonPosX[0] + vm()->_dialogueButtonWidth - 1, vm()->_dialogueButtonPosY[0] + vm()->guiSettings()->buttons.height - 1, vm()->guiSettings()->colors.fill);
_screen->updateScreen();
- vm()->_dialogueButtonW = 95;
- SWAP(vm()->_dialogueButtonLabelCol1, vm()->_dialogueButtonLabelCol2);
+ vm()->_dialogueButtonWidth = 95;
+ SWAP(vm()->_dialogueButtonLabelColor1, vm()->_dialogueButtonLabelColor2);
clearCurDim();
}
Commit: e6b6099d54c05a95530125e95da69a90aff4863d
https://github.com/scummvm/scummvm/commit/e6b6099d54c05a95530125e95da69a90aff4863d
Author: athrxx (athrxx at scummvm.org)
Date: 2011-12-27T15:01:28-08:00
Commit Message:
KYRA: (EOB) - fix minor color glitch
Changed paths:
engines/kyra/gui_eob.cpp
diff --git a/engines/kyra/gui_eob.cpp b/engines/kyra/gui_eob.cpp
index 1ccb60a..a80ef03 100644
--- a/engines/kyra/gui_eob.cpp
+++ b/engines/kyra/gui_eob.cpp
@@ -464,8 +464,8 @@ void EoBCoreEngine::gui_drawCharPortraitStatusFrame(int index) {
}
} else {
- _screen->drawClippedLine(x, y, x + 62, y, guiSettings()->colors.frame1);
- _screen->drawClippedLine(x, y + 49, x + 62, y + 49, guiSettings()->colors.frame2);
+ _screen->drawClippedLine(x, y, x + 62, y, guiSettings()->colors.frame2);
+ _screen->drawClippedLine(x, y + 49, x + 62, y + 49, guiSettings()->colors.frame1);
_screen->drawClippedLine(x - 1, y, x - 1, y + 50, 12);
_screen->drawClippedLine(x + 63, y, x + 63, y + 50, 12);
}
Commit: a35550d200a9e19894571758afe992185c6c6176
https://github.com/scummvm/scummvm/commit/a35550d200a9e19894571758afe992185c6c6176
Author: athrxx (athrxx at scummvm.org)
Date: 2011-12-27T15:01:29-08:00
Commit Message:
KYRA: (EOB) - fix invalid string access in EOB 1
(when entering the memorize/pray menu without having a mage/cleric)
Changed paths:
engines/kyra/eobcommon.cpp
engines/kyra/gui_eob.cpp
diff --git a/engines/kyra/eobcommon.cpp b/engines/kyra/eobcommon.cpp
index bc01fea..304d1a4 100644
--- a/engines/kyra/eobcommon.cpp
+++ b/engines/kyra/eobcommon.cpp
@@ -1059,6 +1059,9 @@ int EoBCoreEngine::countCharactersWithSpecificItems(int16 itemType, int16 itemVa
}
int EoBCoreEngine::checkInventoryForItem(int character, int16 itemType, int16 itemValue) {
+ if (character < 0 )
+ return -1;
+
for (int i = 0; i < 27; i++) {
uint16 inv = _characters[character].inventory[i];
if (!inv)
diff --git a/engines/kyra/gui_eob.cpp b/engines/kyra/gui_eob.cpp
index a80ef03..512c13a 100644
--- a/engines/kyra/gui_eob.cpp
+++ b/engines/kyra/gui_eob.cpp
@@ -3543,7 +3543,7 @@ int GUI_EoB::selectCharacterDialogue(int id) {
_vm->removeInputTop();
_charSelectRedraw = false;
- bool abort = false;
+ bool starvedUnconscious = false;
int count = 0;
int result = -1;
int found[6];
@@ -3558,7 +3558,7 @@ int GUI_EoB::selectCharacterDialogue(int id) {
continue;
if (id != 53 && (!_vm->_characters[i].food || !_vm->testCharacter(i, 4))) {
- abort = true;
+ starvedUnconscious = true;
} else {
found[i] = 0;
result = i;
@@ -3569,9 +3569,9 @@ int GUI_EoB::selectCharacterDialogue(int id) {
if (!count) {
int eid = 0;
if (id == 23)
- eid = abort ? 28 : 72;
+ eid = (starvedUnconscious || _vm->game() == GI_EOB1) ? 28 : 72;
else if (id == 26)
- eid = abort ? 27 : 73;
+ eid = (starvedUnconscious || _vm->game() == GI_EOB1) ? 27 : 73;
else if (id == 49)
eid = 52;
Commit: 99b14c5dbc9414b46afffabafb4be9c9c4c51fd1
https://github.com/scummvm/scummvm/commit/99b14c5dbc9414b46afffabafb4be9c9c4c51fd1
Author: athrxx (athrxx at scummvm.org)
Date: 2011-12-27T15:01:30-08:00
Commit Message:
KYRA: (EOB) - fix spell book tab 5 in EOB1
Changed paths:
engines/kyra/gui_eob.cpp
diff --git a/engines/kyra/gui_eob.cpp b/engines/kyra/gui_eob.cpp
index 512c13a..a378fe1 100644
--- a/engines/kyra/gui_eob.cpp
+++ b/engines/kyra/gui_eob.cpp
@@ -708,8 +708,8 @@ void EoBCoreEngine::gui_initButton(int index, int, int, int) {
if (_flags.gameID == GI_EOB1) {
// EOB1 spellbook modifications
if (index > 60 && index < 66) {
- d = &_buttonDefs[index + 33];
- b->buttonCallback = _buttonCallbacks[index + 33];
+ d = &_buttonDefs[index + 34];
+ b->buttonCallback = _buttonCallbacks[index + 34];
} else if (index == 88) {
d = &_buttonDefs[index + 12];
b->buttonCallback = _buttonCallbacks[index + 12];
Commit: 75c0036925107a844d211854f7194aebcbedd718
https://github.com/scummvm/scummvm/commit/75c0036925107a844d211854f7194aebcbedd718
Author: athrxx (athrxx at scummvm.org)
Date: 2011-12-27T15:01:31-08:00
Commit Message:
KYRA: (LOL) - add support for loading original DOS version save files
Changed paths:
engines/kyra/saveload.cpp
engines/kyra/saveload_lol.cpp
diff --git a/engines/kyra/saveload.cpp b/engines/kyra/saveload.cpp
index 3bca6b0..9fd470f 100644
--- a/engines/kyra/saveload.cpp
+++ b/engines/kyra/saveload.cpp
@@ -54,7 +54,7 @@ KyraEngine_v1::kReadSaveHeaderError KyraEngine_v1::readSaveHeader(Common::Seekab
header.gameID = in->readByte();
} else {
// try checking for original save header
- const int descriptionSize[2] = { 30, 80 };
+ const int descriptionSize[3] = { 30, 80, 60 };
char descriptionBuffer[81];
bool saveOk = false;
@@ -78,6 +78,16 @@ KyraEngine_v1::kReadSaveHeaderError KyraEngine_v1::readSaveHeader(Common::Seekab
header.description = descriptionBuffer;
header.gameID = GI_KYRA3;
break;
+ } else if (type == MKTAG('C','D','0','4')) {
+ header.version = in->readUint32BE();
+ // We don't check the minor version, since the original doesn't do that either and it isn't required.
+ if (header.version != MKTAG(' ','C','D','1'))
+ continue;
+ saveOk = true;
+ header.description = descriptionBuffer;
+ header.gameID = GI_LOL;
+ in->seek(6, SEEK_CUR);
+ break;
}
}
diff --git a/engines/kyra/saveload_lol.cpp b/engines/kyra/saveload_lol.cpp
index c4262c0..2b7236f 100644
--- a/engines/kyra/saveload_lol.cpp
+++ b/engines/kyra/saveload_lol.cpp
@@ -27,6 +27,7 @@
#include "common/savefile.h"
#include "common/substream.h"
+#include "common/memstream.h"
#include "graphics/scaler.h"
@@ -44,6 +45,9 @@ Common::Error LoLEngine::loadGameState(int slot) {
return Common::kNoError;
}
+ if (header.originalSave)
+ warning("Trying to load savegame from original interpreter, while this is possible, it is not officially supported");
+
_screen->fadeClearSceneWindow(10);
completeDoorOperations();
_screen->fillRect(112, 0, 287, 119, 0, 0);
@@ -53,38 +57,40 @@ Common::Error LoLEngine::loadGameState(int slot) {
for (int i = 0; i < 4; i++) {
LoLCharacter *c = &_characters[i];
- c->flags = in.readUint16BE();
+ c->flags = in.readUint16();
in.read(c->name, 11);
c->raceClassSex = in.readByte();
- c->id = in.readSint16BE();
+ c->id = in.readSint16();
c->curFaceFrame = in.readByte();
c->tempFaceFrame = in.readByte();
c->screamSfx = in.readByte();
+ if (header.originalSave)
+ in.skip(4);
for (int ii = 0; ii < 8; ii++)
- c->itemsMight[ii] = in.readUint16BE();
+ c->itemsMight[ii] = in.readUint16();
for (int ii = 0; ii < 8; ii++)
- c->protectionAgainstItems[ii] = in.readUint16BE();
- c->itemProtection = in.readUint16BE();
- c->hitPointsCur = in.readSint16BE();
- c->hitPointsMax = in.readUint16BE();
- c->magicPointsCur = in.readSint16BE();
- c->magicPointsMax = in.readUint16BE();
+ c->protectionAgainstItems[ii] = in.readUint16();
+ c->itemProtection = in.readUint16();
+ c->hitPointsCur = in.readSint16();
+ c->hitPointsMax = in.readUint16();
+ c->magicPointsCur = in.readSint16();
+ c->magicPointsMax = in.readUint16();
c->field_41 = in.readByte();
- c->damageSuffered = in.readUint16BE();
- c->weaponHit = in.readUint16BE();
- c->totalMightModifier = in.readUint16BE();
- c->totalProtectionModifier = in.readUint16BE();
- c->might = in.readUint16BE();
- c->protection = in.readUint16BE();
- c->nextAnimUpdateCountdown = in.readSint16BE();
+ c->damageSuffered = in.readUint16();
+ c->weaponHit = in.readUint16();
+ c->totalMightModifier = in.readUint16();
+ c->totalProtectionModifier = in.readUint16();
+ c->might = in.readUint16();
+ c->protection = in.readUint16();
+ c->nextAnimUpdateCountdown = in.readSint16();
for (int ii = 0; ii < 11; ii++)
- c->items[ii] = in.readUint16BE();
+ c->items[ii] = in.readUint16();
for (int ii = 0; ii < 3; ii++)
c->skillLevels[ii] = in.readByte();
for (int ii = 0; ii < 3; ii++)
c->skillModifiers[ii] = in.readSByte();
for (int ii = 0; ii < 3; ii++)
- c->experiencePts[ii] = in.readUint32BE();
+ c->experiencePts[ii] = in.readUint32();
for (int ii = 0; ii < 5; ii++)
c->characterUpdateEvents[ii] = in.readByte();
for (int ii = 0; ii < 5; ii++)
@@ -96,39 +102,48 @@ Common::Error LoLEngine::loadGameState(int slot) {
}
}
- in.read(_wllAutomapData, 80);
+ if (!header.originalSave)
+ in.read(_wllAutomapData, 80);
- _currentBlock = in.readUint16BE();
- _partyPosX = in.readUint16BE();
- _partyPosY = in.readUint16BE();
- _updateFlags = in.readUint16BE();
+ _currentBlock = in.readUint16();
+ _partyPosX = in.readUint16();
+ _partyPosY = in.readUint16();
+ _updateFlags = in.readUint16();
_scriptDirection = in.readByte();
_selectedSpell = in.readByte();
+
+ if (header.originalSave)
+ in.skip(2);
+
_sceneDefaultUpdate = in.readByte();
_compassBroken = in.readByte();
_drainMagic = in.readByte();
- _currentDirection = in.readUint16BE();
- _compassDirection = in.readUint16BE();
+ _currentDirection = in.readUint16();
+ _compassDirection = in.readUint16();
_selectedCharacter = in.readSByte();
+
+ if (header.originalSave)
+ in.skip(1);
+
_currentLevel = in.readByte();
for (int i = 0; i < 48; i++)
- _inventory[i] = in.readSint16BE();
- _inventoryCurItem = in.readSint16BE();
- _itemInHand = in.readSint16BE();
- _lastMouseRegion = in.readSint16BE();
+ _inventory[i] = in.readSint16();
+ _inventoryCurItem = in.readSint16();
+ _itemInHand = in.readSint16();
+ _lastMouseRegion = in.readSint16();
- if (header.version <= 15) {
+ if (header.originalSave || header.version <= 15) {
uint16 flags[40];
memset(flags, 0, sizeof(flags));
if (header.version == 14) {
for (int i = 0; i < 16; i++)
- flags[i] = in.readUint16BE();
- flags[26] = in.readUint16BE();
- flags[36] = in.readUint16BE();
- } else if (header.version == 15) {
+ flags[i] = in.readUint16();
+ flags[26] = in.readUint16();
+ flags[36] = in.readUint16();
+ } else if (header.originalSave || header.version == 15) {
for (int i = 0; i < 40; i++)
- flags[i] = in.readUint16BE();
+ flags[i] = in.readUint16();
}
memset(_flagsTable, 0, sizeof(_flagsTable));
@@ -139,37 +154,56 @@ Common::Error LoLEngine::loadGameState(int slot) {
}
}
} else {
- uint32 flagsSize = in.readUint32BE();
+ uint32 flagsSize = in.readUint32();
assert(flagsSize <= sizeof(_flagsTable));
in.read(_flagsTable, flagsSize);
}
+ if (header.originalSave)
+ in.skip(120);
+
for (int i = 0; i < 24; i++)
- _globalScriptVars[i] = in.readUint16BE();
+ _globalScriptVars[i] = in.readUint16();
+
+ if (header.originalSave)
+ in.skip(152);
+
_brightness = in.readByte();
_lampOilStatus = in.readByte();
_lampEffect = in.readSByte();
- _credits = in.readUint16BE();
+
+ if (header.originalSave)
+ in.skip(1);
+
+ _credits = in.readUint16();
for (int i = 0; i < 8; i++)
- _globalScriptVars2[i] = in.readUint16BE();
+ _globalScriptVars2[i] = in.readUint16();
in.read(_availableSpells, 7);
- _hasTempDataFlags = in.readUint32BE();
+ _hasTempDataFlags = in.readUint32();
+
+ uint8 *origCmp = 0;
+ if (header.originalSave) {
+ in.skip(6);
+ origCmp = new uint8[2496];
+ }
for (int i = 0; i < 400; i++) {
ItemInPlay *t = &_itemsInPlay[i];
- t->nextAssignedObject = in.readUint16BE();
- t->nextDrawObject = in.readUint16BE();
+ t->nextAssignedObject = in.readUint16();
+ t->nextDrawObject = in.readUint16();
t->flyingHeight = in.readByte();
- t->block = in.readUint16BE();
- t->x = in.readUint16BE();
- t->y = in.readUint16BE();
+ t->block = in.readUint16();
+ t->x = in.readUint16();
+ t->y = in.readUint16();
t->level = in.readSByte();
- t->itemPropertyIndex = in.readUint16BE();
- t->shpCurFrame_flg = in.readUint16BE();
- t->destDirection = in.readByte();
- t->hitOffsX = in.readSByte();
- t->hitOffsY = in.readSByte();
- t->currentSubFrame = in.readByte();
+ t->itemPropertyIndex = in.readUint16();
+ t->shpCurFrame_flg = in.readUint16();
+ if (!header.originalSave) {
+ t->destDirection = in.readByte();
+ t->hitOffsX = in.readSByte();
+ t->hitOffsY = in.readSByte();
+ t->currentSubFrame = in.readByte();
+ }
}
for (int i = 0; i < 1024; i++) {
@@ -179,8 +213,13 @@ Common::Error LoLEngine::loadGameState(int slot) {
}
for (int i = 0; i < 29; i++) {
- if (!(_hasTempDataFlags & (1 << i)))
+ if (!(_hasTempDataFlags & (1 << i))) {
+ if (header.originalSave) {
+ if (in.size() - in.pos() >= 2500)
+ in.skip(2500);
+ }
continue;
+ }
if (_lvlTempData[i]) {
delete[] _lvlTempData[i]->wallsXorData;
@@ -195,26 +234,40 @@ Common::Error LoLEngine::loadGameState(int slot) {
_lvlTempData[i]->wallsXorData = new uint8[4096];
_lvlTempData[i]->flags = new uint16[1024];
LoLMonsterInPlay *lm = new LoLMonsterInPlay[30];
- _lvlTempData[i]->monsters = lm;
+ _lvlTempData[i]->monsters = lm;
FlyingObject *lf = new FlyingObject[_numFlyingObjects];
_lvlTempData[i]->flyingObjects = lf;
LevelTempData *l = _lvlTempData[i];
+
+ uint32 next = in.pos() + 2500;
+
+ if (header.originalSave) {
+ in.skip(4);
+ in.read(origCmp, in.readUint16());
+ _screen->decodeFrame4(origCmp, _tempBuffer5120, 5120);
+ memcpy(l->wallsXorData, _tempBuffer5120, 4096);
+ for (int ii = 0; ii < 1024; ii++)
+ l->flags[ii] = _tempBuffer5120[4096 + ii];
+ } else {
+ in.read(l->wallsXorData, 4096);
+ for (int ii = 0; ii < 1024; ii++)
+ l->flags[ii] = in.readByte();
+ }
- in.read(l->wallsXorData, 4096);
- for (int ii = 0; ii < 1024; ii++)
- l->flags[ii] = in.readByte();
+ if (header.originalSave)
+ l->monsterDifficulty = in.readUint16();
for (int ii = 0; ii < 30; ii++) {
LoLMonsterInPlay *m = &lm[ii];
- m->nextAssignedObject = in.readUint16BE();
- m->nextDrawObject = in.readUint16BE();
+ m->nextAssignedObject = in.readUint16();
+ m->nextDrawObject = in.readUint16();
m->flyingHeight = in.readByte();
- m->block = in.readUint16BE();
- m->x = in.readUint16BE();
- m->y = in.readUint16BE();
+ m->block = in.readUint16();
+ m->x = in.readUint16();
+ m->y = in.readUint16();
m->shiftStep = in.readSByte();
- m->destX = in.readUint16BE();
- m->destY = in.readUint16BE();
+ m->destX = in.readUint16();
+ m->destY = in.readUint16();
m->destDirection = in.readByte();
m->hitOffsX = in.readSByte();
m->hitOffsY = in.readSByte();
@@ -224,15 +277,19 @@ Common::Error LoLEngine::loadGameState(int slot) {
m->id = in.readByte();
m->direction = in.readByte();
m->facing = in.readByte();
- m->flags = in.readUint16BE();
- m->damageReceived = in.readUint16BE();
- m->hitPoints = in.readSint16BE();
+ m->flags = in.readUint16();
+ m->damageReceived = in.readUint16();
+ m->hitPoints = in.readSint16();
m->speedTick = in.readByte();
m->type = in.readByte();
+
+ if (header.originalSave)
+ in.skip(4);
+
m->numDistAttacks = in.readByte();
m->curDistWeapon = in.readByte();
m->distAttackTick = in.readSByte();
- m->assignedItems = in.readUint16BE();
+ m->assignedItems = in.readUint16();
m->properties = &_monsterProperties[m->type];
in.read(m->equipmentShapes, 4);
}
@@ -241,10 +298,10 @@ Common::Error LoLEngine::loadGameState(int slot) {
FlyingObject *m = &lf[ii];
m->enable = in.readByte();
m->objectType = in.readByte();
- m->attackerId = in.readUint16BE();
- m->item = in.readSint16BE();
- m->x = in.readUint16BE();
- m->y = in.readUint16BE();
+ m->attackerId = in.readUint16();
+ m->item = in.readSint16();
+ m->x = in.readUint16();
+ m->y = in.readUint16();
m->flyingHeight = in.readByte();
m->direction = in.readByte();
m->distance = in.readByte();
@@ -253,9 +310,15 @@ Common::Error LoLEngine::loadGameState(int slot) {
m->flags = in.readByte();
m->wallFlags = in.readByte();
}
- l->monsterDifficulty = in.readByte();
+
+ if (header.originalSave)
+ in.seek(next, SEEK_SET);
+ else
+ l->monsterDifficulty = in.readByte();
}
+ delete[] origCmp;
+
calcCharPortraitXpos();
memset(_moneyColumnHeight, 0, sizeof(_moneyColumnHeight));
int t = _credits;
@@ -369,6 +432,7 @@ Common::Error LoLEngine::saveGameStateIntern(int slot, const char *saveName, con
out->writeSByte(t->level);
out->writeUint16BE(t->itemPropertyIndex);
out->writeUint16BE(t->shpCurFrame_flg);
+
out->writeByte(t->destDirection);
out->writeSByte(t->hitOffsX);
out->writeSByte(t->hitOffsY);
Commit: cbfdd227a173238cd7069264c2f83bdf247ca1d6
https://github.com/scummvm/scummvm/commit/cbfdd227a173238cd7069264c2f83bdf247ca1d6
Author: athrxx (athrxx at scummvm.org)
Date: 2011-12-27T15:01:32-08:00
Commit Message:
KYRA: (LOL) - minor reduction of save file size
Changed paths:
engines/kyra/lol.h
engines/kyra/saveload.cpp
engines/kyra/saveload_lol.cpp
diff --git a/engines/kyra/lol.h b/engines/kyra/lol.h
index c6d05c4..e44857e 100644
--- a/engines/kyra/lol.h
+++ b/engines/kyra/lol.h
@@ -118,11 +118,11 @@ struct LoLMonsterInPlay {
int8 shiftStep;
uint16 destX;
uint16 destY;
+
uint8 destDirection;
int8 hitOffsX;
int8 hitOffsY;
uint8 currentSubFrame;
-
uint8 mode;
int8 fightCurTick;
uint8 id;
@@ -130,7 +130,6 @@ struct LoLMonsterInPlay {
uint8 facing;
uint16 flags;
uint16 damageReceived;
- //uint8 field_1C;
int16 hitPoints;
uint8 speedTick;
uint8 type;
@@ -152,10 +151,6 @@ struct ItemInPlay {
int8 level;
uint16 itemPropertyIndex;
uint16 shpCurFrame_flg;
- uint8 destDirection;
- int8 hitOffsX;
- int8 hitOffsY;
- uint8 currentSubFrame;
};
struct ItemProperty {
diff --git a/engines/kyra/saveload.cpp b/engines/kyra/saveload.cpp
index 9fd470f..f4fd466 100644
--- a/engines/kyra/saveload.cpp
+++ b/engines/kyra/saveload.cpp
@@ -29,7 +29,7 @@
#include "graphics/thumbnail.h"
#include "graphics/surface.h"
-#define CURRENT_SAVE_VERSION 16
+#define CURRENT_SAVE_VERSION 17
#define GF_FLOPPY (1 << 0)
#define GF_TALKIE (1 << 1)
diff --git a/engines/kyra/saveload_lol.cpp b/engines/kyra/saveload_lol.cpp
index 2b7236f..3edc475 100644
--- a/engines/kyra/saveload_lol.cpp
+++ b/engines/kyra/saveload_lol.cpp
@@ -102,8 +102,8 @@ Common::Error LoLEngine::loadGameState(int slot) {
}
}
- if (!header.originalSave)
- in.read(_wllAutomapData, 80);
+ if (header.version < 17)
+ in.skip(80);
_currentBlock = in.readUint16();
_partyPosX = in.readUint16();
@@ -198,12 +198,8 @@ Common::Error LoLEngine::loadGameState(int slot) {
t->level = in.readSByte();
t->itemPropertyIndex = in.readUint16();
t->shpCurFrame_flg = in.readUint16();
- if (!header.originalSave) {
- t->destDirection = in.readByte();
- t->hitOffsX = in.readSByte();
- t->hitOffsY = in.readSByte();
- t->currentSubFrame = in.readByte();
- }
+ if (header.version < 17)
+ in.skip(4);
}
for (int i = 0; i < 1024; i++) {
@@ -385,9 +381,7 @@ Common::Error LoLEngine::saveGameStateIntern(int slot, const char *saveName, con
for (int ii = 0; ii < 5; ii++)
out->writeByte(c->characterUpdateDelay[ii]);
}
-
- out->write(_wllAutomapData, 80);
-
+
out->writeUint16BE(_currentBlock);
out->writeUint16BE(_partyPosX);
out->writeUint16BE(_partyPosY);
@@ -432,11 +426,6 @@ Common::Error LoLEngine::saveGameStateIntern(int slot, const char *saveName, con
out->writeSByte(t->level);
out->writeUint16BE(t->itemPropertyIndex);
out->writeUint16BE(t->shpCurFrame_flg);
-
- out->writeByte(t->destDirection);
- out->writeSByte(t->hitOffsX);
- out->writeSByte(t->hitOffsY);
- out->writeByte(t->currentSubFrame);
}
addLevelItems();
Commit: 6786c41f4fd56d588e61f329b6d81f580e9b040f
https://github.com/scummvm/scummvm/commit/6786c41f4fd56d588e61f329b6d81f580e9b040f
Author: athrxx (athrxx at scummvm.org)
Date: 2011-12-27T15:01:32-08:00
Commit Message:
KYRA: (LOL) - refactor item/monster structs
Changed paths:
engines/kyra/items_lol.cpp
engines/kyra/lol.cpp
engines/kyra/lol.h
engines/kyra/saveload_lol.cpp
engines/kyra/scene_lol.cpp
engines/kyra/script_lol.cpp
engines/kyra/sprites_lol.cpp
diff --git a/engines/kyra/items_lol.cpp b/engines/kyra/items_lol.cpp
index 0d6e99a..e6cd935 100644
--- a/engines/kyra/items_lol.cpp
+++ b/engines/kyra/items_lol.cpp
@@ -27,6 +27,68 @@
namespace Kyra {
+LoLObject *LoLEngine::findObject(uint16 index) {
+ if (index & 0x8000)
+ return &_monsters[index & 0x7fff];
+ else
+ return &_itemsInPlay[index];
+}
+
+int LoLEngine::calcObjectPosition(LoLObject *i, uint16 direction) {
+ int x = i->x;
+ int y = i->y;
+
+ calcSpriteRelPosition(_partyPosX, _partyPosY, x, y, direction);
+
+ if (y < 0)
+ y = 0;
+
+ int res = (i->flyingHeight << 12);
+ res |= (4095 - y);
+
+ return res;
+}
+
+void LoLEngine::removeAssignedObjectFromBlock(LevelBlockProperty *l, uint16 id) {
+ uint16 *blockItemIndex = &l->assignedObjects;
+ LoLObject *i = 0;
+
+ while (*blockItemIndex) {
+ if (*blockItemIndex == id) {
+ i = findObject(id);
+ *blockItemIndex = i->nextAssignedObject;
+ i->nextAssignedObject = 0;
+ return;
+ }
+
+ i = findObject(*blockItemIndex);
+ blockItemIndex = &i->nextAssignedObject;
+ }
+}
+
+void LoLEngine::removeDrawObjectFromBlock(LevelBlockProperty *l, uint16 id) {
+ uint16 *blockItemIndex = &l->drawObjects;
+ LoLObject *i = 0;
+
+ while (*blockItemIndex) {
+ if (*blockItemIndex == id) {
+ i = findObject(id);
+ *blockItemIndex = i->nextDrawObject;
+ i->nextDrawObject = 0;
+ return;
+ }
+
+ i = findObject(*blockItemIndex);
+ blockItemIndex = &i->nextDrawObject;
+ }
+}
+
+void LoLEngine::assignObjectToBlock(uint16 *assignedBlockObjects, uint16 id) {
+ LoLObject *t = findObject(id);
+ t->nextAssignedObject = *assignedBlockObjects;
+ *assignedBlockObjects = id;
+}
+
void LoLEngine::giveCredits(int credits, int redraw) {
if (redraw)
snd_playSoundEffect(101, -1);
@@ -156,7 +218,7 @@ Item LoLEngine::makeItem(int itemType, int curFrame, int flags) {
}
}
- memset(&_itemsInPlay[slot], 0, sizeof(ItemInPlay));
+ memset(&_itemsInPlay[slot], 0, sizeof(LoLItem));
_itemsInPlay[slot].itemPropertyIndex = itemType;
_itemsInPlay[slot].shpCurFrame_flg = (curFrame & 0x1fff) | flags;
@@ -221,17 +283,10 @@ bool LoLEngine::isItemMoveable(Item itemIndex) {
}
void LoLEngine::deleteItem(Item itemIndex) {
- memset(&_itemsInPlay[itemIndex], 0, sizeof(ItemInPlay));
+ memset(&_itemsInPlay[itemIndex], 0, sizeof(LoLItem));
_itemsInPlay[itemIndex].shpCurFrame_flg |= 0x8000;
}
-ItemInPlay *LoLEngine::findObject(uint16 index) {
- if (index & 0x8000)
- return (ItemInPlay *)&_monsters[index & 0x7fff];
- else
- return &_itemsInPlay[index];
-}
-
void LoLEngine::runItemScript(int charNum, Item item, int flags, int next, int reg4) {
EMCState scriptState;
memset(&scriptState, 0, sizeof(EMCState));
@@ -443,7 +498,7 @@ void LoLEngine::objectFlightProcessHits(FlyingObject *t, int x, int y, int objec
if (_itemProperties[_itemsInPlay[t->item].itemPropertyIndex].flags & 0x4000) {
int o = _levelBlockProperties[_itemsInPlay[t->item].block].assignedObjects;
while (o & 0x8000) {
- ItemInPlay *i = findObject(o);
+ LoLObject *i = findObject(o);
o = i->nextAssignedObject;
runItemScript(t->attackerId, t->item, 0x8000, o, 0);
}
@@ -502,13 +557,13 @@ void LoLEngine::updateFlyingObject(FlyingObject *t) {
void LoLEngine::assignItemToBlock(uint16 *assignedBlockObjects, int id) {
while (*assignedBlockObjects & 0x8000) {
- ItemInPlay *tmp = findObject(*assignedBlockObjects);
+ LoLObject *tmp = findObject(*assignedBlockObjects);
assignedBlockObjects = &tmp->nextAssignedObject;
}
- ItemInPlay *newObject = findObject(id);
+ LoLObject *newObject = findObject(id);
newObject->nextAssignedObject = *assignedBlockObjects;
- newObject->level = -1;
+ ((LoLItem*)newObject)->level = -1;
*assignedBlockObjects = id;
}
@@ -531,7 +586,7 @@ int LoLEngine::checkSceneForItems(uint16 *blockDrawObjects, int color) {
return *blockDrawObjects;
}
- ItemInPlay *i = findObject(*blockDrawObjects);
+ LoLObject *i = findObject(*blockDrawObjects);
blockDrawObjects = &i->nextDrawObject;
}
diff --git a/engines/kyra/lol.cpp b/engines/kyra/lol.cpp
index a57fe4f..62143e5 100644
--- a/engines/kyra/lol.cpp
+++ b/engines/kyra/lol.cpp
@@ -390,8 +390,8 @@ Common::Error LoLEngine::init() {
_pageBuffer2 = new uint8[0xfa00];
memset(_pageBuffer2, 0, 0xfa00);
- _itemsInPlay = new ItemInPlay[400];
- memset(_itemsInPlay, 0, sizeof(ItemInPlay) * 400);
+ _itemsInPlay = new LoLItem[400];
+ memset(_itemsInPlay, 0, sizeof(LoLItem) * 400);
_characters = new LoLCharacter[4];
memset(_characters, 0, sizeof(LoLCharacter) * 4);
@@ -404,8 +404,8 @@ Common::Error LoLEngine::init() {
_wllAutomapData = new uint8[80];
memset(_wllAutomapData, 0, 80);
- _monsters = new LoLMonsterInPlay[30];
- memset(_monsters, 0, 30 * sizeof(LoLMonsterInPlay));
+ _monsters = new LoLMonster[30];
+ memset(_monsters, 0, 30 * sizeof(LoLMonster));
_monsterProperties = new LoLMonsterProperty[5];
memset(_monsterProperties, 0, 5 * sizeof(LoLMonsterProperty));
@@ -821,7 +821,7 @@ void LoLEngine::startup() {
for (int i = 0; i < _numHealiShapes; i++)
_healiShapes[i] = _screen->makeShapeCopy(shp, i);
- memset(_itemsInPlay, 0, 400 * sizeof(ItemInPlay));
+ memset(_itemsInPlay, 0, 400 * sizeof(LoLItem));
for (int i = 0; i < 400; i++)
_itemsInPlay[i].shpCurFrame_flg |= 0x8000;
@@ -1946,7 +1946,7 @@ void LoLEngine::setupDialogueButtons(int numStr, const char *s1, const char *s2,
removeInputTop();
}
-void LoLEngine::giveItemToMonster(LoLMonsterInPlay *monster, Item item) {
+void LoLEngine::giveItemToMonster(LoLMonster *monster, Item item) {
uint16 *c = &monster->assignedItems;
while (*c)
c = &_itemsInPlay[*c].nextAssignedObject;
@@ -2397,7 +2397,7 @@ int LoLEngine::processMagicIce(int charNum, int spellLevel) {
int might = rollDice(iceDamageMin[spellLevel], iceDamageMax[spellLevel]) + iceDamageAdd[spellLevel];
int dmg = calcInflictableDamagePerItem(charNum, 0, might, 3, 2);
- LoLMonsterInPlay *m = &_monsters[o & 0x7fff];
+ LoLMonster *m = &_monsters[o & 0x7fff];
if (m->hitPoints <= dmg) {
increaseExperience(charNum, 2, m->hitPoints);
o = m->nextAssignedObject;
@@ -2476,7 +2476,7 @@ int LoLEngine::processMagicFireball(int charNum, int spellLevel) {
while (o & 0x8000) {
static const uint8 fireballDamage[] = { 20, 40, 80, 100 };
int dmg = calcInflictableDamagePerItem(charNum, o, fireballDamage[spellLevel], 4, 1);
- LoLMonsterInPlay *m = &_monsters[o & 0x7fff];
+ LoLMonster *m = &_monsters[o & 0x7fff];
o = m->nextAssignedObject;
_envSfxUseQueue = true;
inflictDamage(m->id | 0x8000, dmg, charNum, 2, 4);
@@ -2641,7 +2641,7 @@ int LoLEngine::processMagicHandOfFate(int spellLevel) {
uint16 o = _levelBlockProperties[b1].assignedObjects;
while (o & 0x8000) {
uint16 o2 = o;
- LoLMonsterInPlay *m = &_monsters[o & 0x7fff];
+ LoLMonster *m = &_monsters[o & 0x7fff];
o = findObject(o)->nextAssignedObject;
int nX = 0;
int nY = 0;
@@ -2910,7 +2910,7 @@ int LoLEngine::processMagicVaelansCube() {
uint16 o = _levelBlockProperties[bl].assignedObjects;
while (o & 0x8000) {
- LoLMonsterInPlay *m = &_monsters[o & 0x7fff];
+ LoLMonster *m = &_monsters[o & 0x7fff];
if (m->properties->flags & 0x1000) {
inflictDamage(o, 100, 0xffff, 0, 0x80);
v = 1;
@@ -3390,7 +3390,7 @@ int LoLEngine::calcInflictableDamage(int16 attacker, int16 target, int hitType)
}
int LoLEngine::inflictDamage(uint16 target, int damage, uint16 attacker, int skill, int flags) {
- LoLMonsterInPlay *m = 0;
+ LoLMonster *m = 0;
LoLCharacter *c = 0;
if (target & 0x8000) {
@@ -3607,7 +3607,7 @@ void LoLEngine::checkForPartyDeath() {
}
}
-void LoLEngine::applyMonsterAttackSkill(LoLMonsterInPlay *monster, int16 target, int16 damage) {
+void LoLEngine::applyMonsterAttackSkill(LoLMonster *monster, int16 target, int16 damage) {
if (rollDice(1, 100) > monster->properties->attackSkillChance)
return;
@@ -3677,7 +3677,7 @@ void LoLEngine::applyMonsterAttackSkill(LoLMonsterInPlay *monster, int16 target,
}
}
-void LoLEngine::applyMonsterDefenseSkill(LoLMonsterInPlay *monster, int16 attacker, int flags, int skill, int damage) {
+void LoLEngine::applyMonsterDefenseSkill(LoLMonster *monster, int16 attacker, int flags, int skill, int damage) {
if (rollDice(1, 100) > monster->properties->defenseSkillChance)
return;
@@ -3936,7 +3936,7 @@ uint16 LoLEngine::getNearestMonsterFromCharacterForBlock(uint16 block, int charN
int o = _levelBlockProperties[block].assignedObjects;
while (o & 0x8000) {
- LoLMonsterInPlay *m = &_monsters[o & 0x7fff];
+ LoLMonster *m = &_monsters[o & 0x7fff];
if (m->mode >= 13) {
o = m->nextAssignedObject;
continue;
diff --git a/engines/kyra/lol.h b/engines/kyra/lol.h
index e44857e..bb8f24e 100644
--- a/engines/kyra/lol.h
+++ b/engines/kyra/lol.h
@@ -108,18 +108,21 @@ struct LoLMonsterProperty {
uint8 sounds[3];
};
-struct LoLMonsterInPlay {
+struct LoLObject {
uint16 nextAssignedObject;
uint16 nextDrawObject;
uint8 flyingHeight;
uint16 block;
uint16 x;
uint16 y;
+};
+
+struct LoLMonster : public LoLObject {
+ uint8 destDirection;
int8 shiftStep;
uint16 destX;
uint16 destY;
- uint8 destDirection;
int8 hitOffsX;
int8 hitOffsY;
uint8 currentSubFrame;
@@ -141,13 +144,7 @@ struct LoLMonsterInPlay {
uint8 equipmentShapes[4];
};
-struct ItemInPlay {
- uint16 nextAssignedObject;
- uint16 nextDrawObject;
- uint8 flyingHeight;
- uint16 block;
- uint16 x;
- uint16 y;
+struct LoLItem : public LoLObject {
int8 level;
uint16 itemPropertyIndex;
uint16 shpCurFrame_flg;
@@ -906,7 +903,7 @@ private:
void loadLevel(int index);
void addLevelItems();
void loadLevelWallData(int fileIndex, bool mapShapes);
- void assignBlockObject(LevelBlockProperty *l, uint16 item);
+ void assignBlockItem(LevelBlockProperty *l, uint16 item);
int assignLevelDecorationShapes(int index);
uint8 *getLevelDecorationShapes(int index);
void releaseDecorations(int first = 0, int num = 400);
@@ -1028,6 +1025,13 @@ private:
const int16 *_dscDoorMonsterX;
const int16 *_dscDoorMonsterY;
+ // objects (item/monster common)
+ LoLObject *findObject(uint16 index);
+ int calcObjectPosition(LoLObject *obj, uint16 direction);
+ void removeAssignedObjectFromBlock(LevelBlockProperty *l, uint16 id);
+ void removeDrawObjectFromBlock(LevelBlockProperty *l, uint16 id);
+ void assignObjectToBlock(uint16 *assignedBlockObjects, uint16 id);
+
// items
void giveCredits(int credits, int redraw);
void takeCredits(int credits, int redraw);
@@ -1036,7 +1040,6 @@ private:
bool addItemToInventory(Item itemIndex);
bool isItemMoveable(Item itemIndex);
void deleteItem(Item itemIndex);
- ItemInPlay *findObject(uint16 index);
void runItemScript(int charNum, Item item, int flags, int next, int reg4);
void setHandItem(Item itemIndex);
bool itemEquipped(int charNum, uint16 itemType);
@@ -1057,7 +1060,7 @@ private:
uint8 _moneyColumnHeight[5];
uint16 _credits;
- ItemInPlay *_itemsInPlay;
+ LoLItem *_itemsInPlay;
ItemProperty *_itemProperties;
Item _itemInHand;
@@ -1084,16 +1087,13 @@ private:
void loadMonsterShapes(const char *file, int monsterIndex, int b);
void releaseMonsterShapes(int monsterIndex);
int deleteMonstersFromBlock(int block);
- void setMonsterMode(LoLMonsterInPlay *monster, int mode);
- bool updateMonsterAdjustBlocks(LoLMonsterInPlay *monster);
- void placeMonster(LoLMonsterInPlay *monster, uint16 x, uint16 y);
+ void setMonsterMode(LoLMonster *monster, int mode);
+ bool updateMonsterAdjustBlocks(LoLMonster *monster);
+ void placeMonster(LoLMonster *monster, uint16 x, uint16 y);
int calcMonsterDirection(uint16 x1, uint16 y1, uint16 x2, uint16 y2);
- void setMonsterDirection(LoLMonsterInPlay *monster, int dir);
- void monsterDropItems(LoLMonsterInPlay *monster);
- void removeAssignedObjectFromBlock(LevelBlockProperty *l, uint16 id);
- void removeDrawObjectFromBlock(LevelBlockProperty *l, uint16 id);
- void assignMonsterToBlock(uint16 *assignedBlockObjects, uint16 id);
- void giveItemToMonster(LoLMonsterInPlay *monster, Item item);
+ void setMonsterDirection(LoLMonster *monster, int dir);
+ void monsterDropItems(LoLMonster *monster);
+ void giveItemToMonster(LoLMonster *monster, Item item);
int checkBlockBeforeObjectPlacement(uint16 x, uint16 y, uint16 objectWidth, uint16 testFlag, uint16 wallFlag);
int checkBlockForWallsAndSufficientSpace(int block, int x, int y, int objectWidth, int testFlag, int wallFlag);
int calcMonsterSkillLevel(int id, int a);
@@ -1104,30 +1104,29 @@ private:
void drawBlockObjects(int blockArrayIndex);
void drawMonster(uint16 id);
- int getMonsterCurFrame(LoLMonsterInPlay *m, uint16 dirFlags);
+ int getMonsterCurFrame(LoLMonster *m, uint16 dirFlags);
void reassignDrawObjects(uint16 direction, uint16 itemIndex, LevelBlockProperty *l, bool flag);
void redrawSceneItem();
- int calcItemMonsterPosition(ItemInPlay *i, uint16 direction);
void calcSpriteRelPosition(uint16 x1, uint16 y1, int &x2, int &y2, uint16 direction);
void drawDoor(uint8 *shape, uint8 *doorPalette, int index, int unk2, int w, int h, int flags);
void drawDoorOrMonsterEquipment(uint8 *shape, uint8 *objectPalette, int x, int y, int flags, const uint8 *brightnessOverlay);
uint8 *drawItemOrMonster(uint8 *shape, uint8 *monsterPalette, int x, int y, int fineX, int fineY, int flags, int tblValue, bool vflip);
int calcDrawingLayerParameters(int srcX, int srcY, int &x2, int &y2, uint16 &w, uint16 &h, uint8 *shape, int vflip);
- void updateMonster(LoLMonsterInPlay *monster);
- void moveMonster(LoLMonsterInPlay *monster);
- void walkMonster(LoLMonsterInPlay *monster);
- bool chasePartyWithDistanceAttacks(LoLMonsterInPlay *monster);
- void chasePartyWithCloseAttacks(LoLMonsterInPlay *monster);
- int walkMonsterCalcNextStep(LoLMonsterInPlay *monster);
+ void updateMonster(LoLMonster *monster);
+ void moveMonster(LoLMonster *monster);
+ void walkMonster(LoLMonster *monster);
+ bool chasePartyWithDistanceAttacks(LoLMonster *monster);
+ void chasePartyWithCloseAttacks(LoLMonster *monster);
+ int walkMonsterCalcNextStep(LoLMonster *monster);
int checkForPossibleDistanceAttack(uint16 monsterBlock, int direction, int distance, uint16 curBlock);
- int walkMonsterCheckDest(int x, int y, LoLMonsterInPlay *monster, int unk);
+ int walkMonsterCheckDest(int x, int y, LoLMonster *monster, int unk);
void getNextStepCoords(int16 monsterX, int16 monsterY, int &newX, int &newY, uint16 direction);
- void rearrangeAttackingMonster(LoLMonsterInPlay *monster);
- void moveStrayingMonster(LoLMonsterInPlay *monster);
- void killMonster(LoLMonsterInPlay *monster);
+ void rearrangeAttackingMonster(LoLMonster *monster);
+ void moveStrayingMonster(LoLMonster *monster);
+ void killMonster(LoLMonster *monster);
- LoLMonsterInPlay *_monsters;
+ LoLMonster *_monsters;
LoLMonsterProperty *_monsterProperties;
uint8 **_monsterDecorationShapes;
uint8 _monsterAnimType[3];
@@ -1241,8 +1240,8 @@ private:
int calcInflictableDamagePerItem(int16 attacker, int16 target, uint16 itemMight, int index, int hitType);
void checkForPartyDeath();
- void applyMonsterAttackSkill(LoLMonsterInPlay *monster, int16 target, int16 damage);
- void applyMonsterDefenseSkill(LoLMonsterInPlay *monster, int16 attacker, int flags, int skill, int damage);
+ void applyMonsterAttackSkill(LoLMonster *monster, int16 target, int16 damage);
+ void applyMonsterDefenseSkill(LoLMonster *monster, int16 attacker, int flags, int skill, int damage);
int removeCharacterItem(int charNum, int itemFlags);
int paralyzePoisonCharacter(int charNum, int typeFlag, int immunityFlags, int hitChance, int redraw);
void paralyzePoisonAllCharacters(int typeFlag, int immunityFlags, int hitChance);
diff --git a/engines/kyra/saveload_lol.cpp b/engines/kyra/saveload_lol.cpp
index 3edc475..7736d45 100644
--- a/engines/kyra/saveload_lol.cpp
+++ b/engines/kyra/saveload_lol.cpp
@@ -188,7 +188,7 @@ Common::Error LoLEngine::loadGameState(int slot) {
}
for (int i = 0; i < 400; i++) {
- ItemInPlay *t = &_itemsInPlay[i];
+ LoLItem *t = &_itemsInPlay[i];
t->nextAssignedObject = in.readUint16();
t->nextDrawObject = in.readUint16();
t->flyingHeight = in.readByte();
@@ -229,12 +229,12 @@ Common::Error LoLEngine::loadGameState(int slot) {
_lvlTempData[i] = new LevelTempData;
_lvlTempData[i]->wallsXorData = new uint8[4096];
_lvlTempData[i]->flags = new uint16[1024];
- LoLMonsterInPlay *lm = new LoLMonsterInPlay[30];
+ LoLMonster *lm = new LoLMonster[30];
_lvlTempData[i]->monsters = lm;
FlyingObject *lf = new FlyingObject[_numFlyingObjects];
_lvlTempData[i]->flyingObjects = lf;
LevelTempData *l = _lvlTempData[i];
-
+
uint32 next = in.pos() + 2500;
if (header.originalSave) {
@@ -254,7 +254,7 @@ Common::Error LoLEngine::loadGameState(int slot) {
l->monsterDifficulty = in.readUint16();
for (int ii = 0; ii < 30; ii++) {
- LoLMonsterInPlay *m = &lm[ii];
+ LoLMonster *m = &lm[ii];
m->nextAssignedObject = in.readUint16();
m->nextDrawObject = in.readUint16();
m->flyingHeight = in.readByte();
@@ -381,7 +381,7 @@ Common::Error LoLEngine::saveGameStateIntern(int slot, const char *saveName, con
for (int ii = 0; ii < 5; ii++)
out->writeByte(c->characterUpdateDelay[ii]);
}
-
+
out->writeUint16BE(_currentBlock);
out->writeUint16BE(_partyPosX);
out->writeUint16BE(_partyPosY);
@@ -416,7 +416,7 @@ Common::Error LoLEngine::saveGameStateIntern(int slot, const char *saveName, con
resetItems(0);
for (int i = 0; i < 400; i++) {
- ItemInPlay *t = &_itemsInPlay[i];
+ LoLItem *t = &_itemsInPlay[i];
out->writeUint16BE(t->nextAssignedObject);
out->writeUint16BE(t->nextDrawObject);
out->writeByte(t->flyingHeight);
@@ -439,11 +439,11 @@ Common::Error LoLEngine::saveGameStateIntern(int slot, const char *saveName, con
for (int ii = 0; ii < 1024; ii++)
out->writeByte(l->flags[ii] & 0xff);
- LoLMonsterInPlay *lm = (LoLMonsterInPlay*)_lvlTempData[i]->monsters;
+ LoLMonster *lm = (LoLMonster*)_lvlTempData[i]->monsters;
FlyingObject *lf = (FlyingObject*)_lvlTempData[i]->flyingObjects;
for (int ii = 0; ii < 30; ii++) {
- LoLMonsterInPlay *m = &lm[ii];
+ LoLMonster *m = &lm[ii];
out->writeUint16BE(m->nextAssignedObject);
out->writeUint16BE(m->nextDrawObject);
out->writeByte(m->flyingHeight);
@@ -537,8 +537,8 @@ void LoLEngine::restoreBlockTempData(int levelIndex) {
}
void *LoLEngine::generateMonsterTempData(LevelTempData *tmp) {
- LoLMonsterInPlay *m = new LoLMonsterInPlay[30];
- memcpy(m, _monsters, sizeof(LoLMonsterInPlay) * 30);
+ LoLMonster *m = new LoLMonster[30];
+ memcpy(m, _monsters, sizeof(LoLMonster) * 30);
tmp->monsterDifficulty = _monsterDifficulty;
return m;
}
@@ -562,7 +562,7 @@ void LoLEngine::restoreTempDataAdjustMonsterStrength(int index) {
}
void LoLEngine::restoreMonsterTempData(LevelTempData *tmp) {
- memcpy(_monsters, tmp->monsters, sizeof(LoLMonsterInPlay) * 30);
+ memcpy(_monsters, tmp->monsters, sizeof(LoLMonster) * 30);
for (int i = 0; i < 30; i++) {
if (_monsters[i].block) {
@@ -574,7 +574,7 @@ void LoLEngine::restoreMonsterTempData(LevelTempData *tmp) {
}
void LoLEngine::releaseMonsterTempData(LevelTempData *tmp) {
- LoLMonsterInPlay *p = (LoLMonsterInPlay*)tmp->monsters;
+ LoLMonster *p = (LoLMonster*)tmp->monsters;
delete[] p;
}
diff --git a/engines/kyra/scene_lol.cpp b/engines/kyra/scene_lol.cpp
index 8610d20..fea9b27 100644
--- a/engines/kyra/scene_lol.cpp
+++ b/engines/kyra/scene_lol.cpp
@@ -105,16 +105,16 @@ void LoLEngine::addLevelItems() {
if (_itemsInPlay[i].level != _currentLevel)
continue;
- assignBlockObject(&_levelBlockProperties[_itemsInPlay[i].block], i);
+ assignBlockItem(&_levelBlockProperties[_itemsInPlay[i].block], i);
_levelBlockProperties[_itemsInPlay[i].block].direction = 5;
_itemsInPlay[i].nextDrawObject = 0;
}
}
-void LoLEngine::assignBlockObject(LevelBlockProperty *l, uint16 item) {
+void LoLEngine::assignBlockItem(LevelBlockProperty *l, uint16 item) {
uint16 *index = &l->assignedObjects;
- ItemInPlay *tmp = 0;
+ LoLObject *tmp = 0;
while (*index & 0x8000) {
tmp = findObject(*index);
@@ -122,7 +122,7 @@ void LoLEngine::assignBlockObject(LevelBlockProperty *l, uint16 item) {
}
tmp = findObject(item);
- tmp->level = -1;
+ ((LoLItem*)tmp)->level = -1;
uint16 ix = *index;
@@ -474,17 +474,17 @@ void LoLEngine::resetItems(int flag) {
for (int i = 0; i < 1024; i++) {
_levelBlockProperties[i].direction = 5;
uint16 id = _levelBlockProperties[i].assignedObjects;
- LoLMonsterInPlay *r = 0;
+ LoLObject *r = 0;
while (id & 0x8000) {
- r = (LoLMonsterInPlay *)findObject(id);
+ r = findObject(id);
id = r->nextAssignedObject;
}
if (!id)
continue;
- ItemInPlay *it = &_itemsInPlay[id];
+ LoLItem *it = &_itemsInPlay[id];
it->level = _currentLevel;
it->block = i;
if (r)
@@ -496,7 +496,7 @@ void LoLEngine::resetItems(int flag) {
}
void LoLEngine::disableMonsters() {
- memset(_monsters, 0, 30 * sizeof(LoLMonsterInPlay));
+ memset(_monsters, 0, 30 * sizeof(LoLMonster));
for (int i = 0; i < 30; i++)
_monsters[i].mode = 0x10;
}
diff --git a/engines/kyra/script_lol.cpp b/engines/kyra/script_lol.cpp
index 342014b..f81961a 100644
--- a/engines/kyra/script_lol.cpp
+++ b/engines/kyra/script_lol.cpp
@@ -286,7 +286,7 @@ int LoLEngine::olol_getItemPara(EMCState *script) {
if (!stackPos(0))
return 0;
- ItemInPlay *i = &_itemsInPlay[stackPos(0)];
+ LoLItem *i = &_itemsInPlay[stackPos(0)];
ItemProperty *p = &_itemProperties[i->itemPropertyIndex];
switch (stackPos(1)) {
@@ -811,11 +811,11 @@ int LoLEngine::olol_initMonster(EMCState *script) {
return -1;
for (uint8 i = 0; i < 30; i++) {
- LoLMonsterInPlay *l = &_monsters[i];
+ LoLMonster *l = &_monsters[i];
if (l->hitPoints || l->mode == 13)
continue;
- memset(l, 0, sizeof(LoLMonsterInPlay));
+ memset(l, 0, sizeof(LoLMonster));
l->id = i;
l->x = x;
l->y = y;
@@ -998,7 +998,7 @@ int LoLEngine::olol_inflictDamage(EMCState *script) {
int LoLEngine::olol_moveMonster(EMCState *script) {
debugC(3, kDebugLevelScriptFuncs, "LoLEngine::olol_moveMonster(%p) (%d, %d, %d, %d, %d)", (const void *)script, stackPos(0), stackPos(1), stackPos(2), stackPos(3), stackPos(4));
- LoLMonsterInPlay *m = &_monsters[stackPos(0)];
+ LoLMonster *m = &_monsters[stackPos(0)];
if (m->mode == 1 || m->mode == 2) {
calcCoordinates(m->destX, m->destY, stackPos(1), stackPos(2), stackPos(3));
@@ -1193,7 +1193,7 @@ int LoLEngine::olol_changeMonsterStat(EMCState *script) {
if (stackPos(0) == -1)
return 1;
- LoLMonsterInPlay *m = &_monsters[stackPos(0) & 0x7fff];
+ LoLMonster *m = &_monsters[stackPos(0) & 0x7fff];
int16 d = stackPos(2);
uint16 x = 0;
@@ -1234,7 +1234,7 @@ int LoLEngine::olol_getMonsterStat(EMCState *script) {
if (stackPos(0) == -1)
return 0;
- LoLMonsterInPlay *m = &_monsters[stackPos(0) & 0x7fff];
+ LoLMonster *m = &_monsters[stackPos(0) & 0x7fff];
int d = stackPos(1);
switch (d) {
@@ -1547,7 +1547,7 @@ int LoLEngine::olol_moveBlockObjects(EMCState *script) {
l &= 0x7fff;
- LoLMonsterInPlay *m = &_monsters[l];
+ LoLMonster *m = &_monsters[l];
setMonsterMode(m, 14);
checkSceneUpdateNeed(m->block);
@@ -1618,7 +1618,7 @@ int LoLEngine::olol_dummy1(EMCState *script) {
int LoLEngine::olol_suspendMonster(EMCState *script) {
debugC(3, kDebugLevelScriptFuncs, "LoLEngine::olol_suspendMonster(%p) (%d)", (const void *)script, stackPos(0));
- LoLMonsterInPlay *m = &_monsters[stackPos(0) & 0x7fff];
+ LoLMonster *m = &_monsters[stackPos(0) & 0x7fff];
setMonsterMode(m, 14);
checkSceneUpdateNeed(m->block);
placeMonster(m, 0, 0);
@@ -2035,7 +2035,7 @@ int LoLEngine::olol_changeItemTypeOrFlag(EMCState *script) {
if (stackPos(0) < 1)
return 0;
- ItemInPlay *i = &_itemsInPlay[stackPos(0)];
+ LoLItem *i = &_itemsInPlay[stackPos(0)];
int16 val = stackPos(2);
if (stackPos(1) == 4)
diff --git a/engines/kyra/sprites_lol.cpp b/engines/kyra/sprites_lol.cpp
index 06d7813..2fe896b 100644
--- a/engines/kyra/sprites_lol.cpp
+++ b/engines/kyra/sprites_lol.cpp
@@ -159,7 +159,7 @@ int LoLEngine::deleteMonstersFromBlock(int block) {
continue;
}
- LoLMonsterInPlay *m = &_monsters[i & 0x7fff];
+ LoLMonster *m = &_monsters[i & 0x7fff];
cnt++;
setMonsterMode(m, 14);
@@ -173,7 +173,7 @@ int LoLEngine::deleteMonstersFromBlock(int block) {
return cnt;
}
-void LoLEngine::setMonsterMode(LoLMonsterInPlay *monster, int mode) {
+void LoLEngine::setMonsterMode(LoLMonster *monster, int mode) {
if (monster->mode == 13 && mode != 14)
return;
@@ -210,7 +210,7 @@ void LoLEngine::setMonsterMode(LoLMonsterInPlay *monster, int mode) {
}
}
-bool LoLEngine::updateMonsterAdjustBlocks(LoLMonsterInPlay *monster) {
+bool LoLEngine::updateMonsterAdjustBlocks(LoLMonster *monster) {
static const uint8 dims[] = { 0, 13, 9, 3 };
if (monster->properties->flags & 8)
return true;
@@ -251,7 +251,7 @@ bool LoLEngine::updateMonsterAdjustBlocks(LoLMonsterInPlay *monster) {
return (fx1 >= fx2) ? false : true;
}
-void LoLEngine::placeMonster(LoLMonsterInPlay *monster, uint16 x, uint16 y) {
+void LoLEngine::placeMonster(LoLMonster *monster, uint16 x, uint16 y) {
bool cont = true;
int t = monster->block;
if (monster->block) {
@@ -273,7 +273,7 @@ void LoLEngine::placeMonster(LoLMonsterInPlay *monster, uint16 x, uint16 y) {
if (monster->block == 0)
return;
- assignMonsterToBlock(&_levelBlockProperties[monster->block].assignedObjects, ((uint16)monster->id) | 0x8000);
+ assignObjectToBlock(&_levelBlockProperties[monster->block].assignedObjects, ((uint16)monster->id) | 0x8000);
_levelBlockProperties[monster->block].direction = 5;
checkSceneUpdateNeed(monster->block);
@@ -329,7 +329,7 @@ int LoLEngine::calcMonsterDirection(uint16 x1, uint16 y1, uint16 x2, uint16 y2)
return retVal[r];
}
-void LoLEngine::setMonsterDirection(LoLMonsterInPlay *monster, int dir) {
+void LoLEngine::setMonsterDirection(LoLMonster *monster, int dir) {
monster->direction = dir;
if (!(dir & 1) || ((monster->direction - (monster->facing << 1)) >= 2))
@@ -338,7 +338,7 @@ void LoLEngine::setMonsterDirection(LoLMonsterInPlay *monster, int dir) {
checkSceneUpdateNeed(monster->block);
}
-void LoLEngine::monsterDropItems(LoLMonsterInPlay *monster) {
+void LoLEngine::monsterDropItems(LoLMonster *monster) {
uint16 a = monster->assignedItems;
while (a) {
uint16 b = a;
@@ -347,46 +347,6 @@ void LoLEngine::monsterDropItems(LoLMonsterInPlay *monster) {
}
}
-void LoLEngine::removeAssignedObjectFromBlock(LevelBlockProperty *l, uint16 id) {
- uint16 *blockItemIndex = &l->assignedObjects;
- ItemInPlay *i = 0;
-
- while (*blockItemIndex) {
- if (*blockItemIndex == id) {
- i = findObject(id);
- *blockItemIndex = i->nextAssignedObject;
- i->nextAssignedObject = 0;
- return;
- }
-
- i = findObject(*blockItemIndex);
- blockItemIndex = &i->nextAssignedObject;
- }
-}
-
-void LoLEngine::removeDrawObjectFromBlock(LevelBlockProperty *l, uint16 id) {
- uint16 *blockItemIndex = &l->drawObjects;
- ItemInPlay *i = 0;
-
- while (*blockItemIndex) {
- if (*blockItemIndex == id) {
- i = findObject(id);
- *blockItemIndex = i->nextDrawObject;
- i->nextDrawObject = 0;
- return;
- }
-
- i = findObject(*blockItemIndex);
- blockItemIndex = &i->nextDrawObject;
- }
-}
-
-void LoLEngine::assignMonsterToBlock(uint16 *assignedBlockObjects, uint16 id) {
- ItemInPlay *t = findObject(id);
- t->nextAssignedObject = *assignedBlockObjects;
- *assignedBlockObjects = id;
-}
-
int LoLEngine::checkBlockBeforeObjectPlacement(uint16 x, uint16 y, uint16 objectWidth, uint16 testFlag, uint16 wallFlag) {
_objectLastDirection = 0;
uint16 x2 = 0;
@@ -503,7 +463,7 @@ int LoLEngine::checkBlockForWallsAndSufficientSpace(int block, int x, int y, int
uint16 b = _levelBlockProperties[block].assignedObjects;
while (b & 0x8000) {
- LoLMonsterInPlay *monster = &_monsters[b & 0x7fff];
+ LoLMonster *monster = &_monsters[b & 0x7fff];
if (monster->mode < 13) {
int r = checkDrawObjectSpace(x, y, monster->x, monster->y);
@@ -554,7 +514,7 @@ int LoLEngine::checkBlockOccupiedByParty(int x, int y, int testFlag) {
void LoLEngine::drawBlockObjects(int blockArrayIndex) {
LevelBlockProperty *l = _visibleBlocks[blockArrayIndex];
uint16 s = l->assignedObjects;
- ItemInPlay *i = findObject(s);
+ LoLObject *obj = findObject(s);
if (l->direction != _currentDirection) {
l->drawObjects = 0;
@@ -562,8 +522,8 @@ void LoLEngine::drawBlockObjects(int blockArrayIndex) {
while (s) {
reassignDrawObjects(_currentDirection, s, l, true);
- i = findObject(s);
- s = i->nextAssignedObject;
+ obj = findObject(s);
+ s = obj->nextAssignedObject;
}
}
@@ -575,7 +535,7 @@ void LoLEngine::drawBlockObjects(int blockArrayIndex) {
drawMonster(s);
s = _monsters[s].nextDrawObject;
} else {
- i = &_itemsInPlay[s];
+ LoLItem *i = &_itemsInPlay[s];
int fx = _sceneItemOffs[s & 7] << 1;
int fy = _sceneItemOffs[(s >> 1) & 7] + 5;
@@ -645,7 +605,7 @@ void LoLEngine::drawBlockObjects(int blockArrayIndex) {
}
void LoLEngine::drawMonster(uint16 id) {
- LoLMonsterInPlay *m = &_monsters[id];
+ LoLMonster *m = &_monsters[id];
int16 flg = _monsterDirFlags[(_currentDirection << 2) + m->facing];
int curFrm = getMonsterCurFrame(m, flg & 0xffef);
uint8 *shp = 0;
@@ -721,7 +681,7 @@ void LoLEngine::drawMonster(uint16 id) {
delete[] tbl;
}
-int LoLEngine::getMonsterCurFrame(LoLMonsterInPlay *m, uint16 dirFlags) {
+int LoLEngine::getMonsterCurFrame(LoLMonster *m, uint16 dirFlags) {
int tmp = 0;
switch (_monsterAnimType[m->properties->shapeIndex]) {
case 0:
@@ -796,19 +756,19 @@ void LoLEngine::reassignDrawObjects(uint16 direction, uint16 itemIndex, LevelBlo
return;
}
- ItemInPlay *newObject = findObject(itemIndex);
- int r = calcItemMonsterPosition(newObject, direction);
+ LoLObject *newObject = findObject(itemIndex);
+ int r = calcObjectPosition(newObject, direction);
uint16 *b = &l->drawObjects;
- ItemInPlay *lastObject = 0;
+ LoLObject *lastObject = 0;
while (*b) {
lastObject = findObject(*b);
if (flag) {
- if (calcItemMonsterPosition(lastObject, direction) >= r)
+ if (calcObjectPosition(lastObject, direction) >= r)
break;
} else {
- if (calcItemMonsterPosition(lastObject, direction) > r)
+ if (calcObjectPosition(lastObject, direction) > r)
break;
}
@@ -838,7 +798,7 @@ void LoLEngine::redrawSceneItem() {
if (s & 0x8000) {
s = _monsters[s & 0x7fff].nextDrawObject;
} else {
- ItemInPlay *item = &_itemsInPlay[s];
+ LoLItem *item = &_itemsInPlay[s];
if (item->shpCurFrame_flg & 0x4000) {
if (checkDrawObjectSpace(item->x, item->y, _partyPosX, _partyPosY) < 320) {
@@ -862,21 +822,6 @@ void LoLEngine::redrawSceneItem() {
}
}
-int LoLEngine::calcItemMonsterPosition(ItemInPlay *i, uint16 direction) {
- int x = i->x;
- int y = i->y;
-
- calcSpriteRelPosition(_partyPosX, _partyPosY, x, y, direction);
-
- if (y < 0)
- y = 0;
-
- int res = (i->flyingHeight << 12);
- res |= (4095 - y);
-
- return res;
-}
-
void LoLEngine::calcSpriteRelPosition(uint16 x1, uint16 y1, int &x2, int &y2, uint16 direction) {
int a = x2 - x1;
int b = y1 - y2;
@@ -1080,7 +1025,7 @@ int LoLEngine::calcDrawingLayerParameters(int x1, int y1, int &x2, int &y2, uint
return l;
}
-void LoLEngine::updateMonster(LoLMonsterInPlay *monster) {
+void LoLEngine::updateMonster(LoLMonster *monster) {
static const uint8 flags[] = { 1, 0, 1, 3, 3, 0, 0, 3, 4, 1, 0, 0, 4, 0, 0 };
if (monster->mode > 14)
return;
@@ -1228,7 +1173,7 @@ void LoLEngine::updateMonster(LoLMonsterInPlay *monster) {
monster->flags &= 0xffef;
}
-void LoLEngine::moveMonster(LoLMonsterInPlay *monster) {
+void LoLEngine::moveMonster(LoLMonster *monster) {
static const int8 turnPos[] = { 0, 2, 6, 6, 0, 2, 4, 4, 2, 2, 4, 6, 0, 0, 4, 6, 0 };
if (monster->x != monster->destX || monster->y != monster->destY) {
walkMonster(monster);
@@ -1238,7 +1183,7 @@ void LoLEngine::moveMonster(LoLMonsterInPlay *monster) {
}
}
-void LoLEngine::walkMonster(LoLMonsterInPlay *monster) {
+void LoLEngine::walkMonster(LoLMonster *monster) {
if (monster->properties->flags & 0x400)
return;
@@ -1269,7 +1214,7 @@ void LoLEngine::walkMonster(LoLMonsterInPlay *monster) {
placeMonster(monster, fx, fy);
}
-bool LoLEngine::chasePartyWithDistanceAttacks(LoLMonsterInPlay *monster) {
+bool LoLEngine::chasePartyWithDistanceAttacks(LoLMonster *monster) {
if (!monster->numDistAttacks)
return false;
@@ -1347,7 +1292,7 @@ bool LoLEngine::chasePartyWithDistanceAttacks(LoLMonsterInPlay *monster) {
return true;
}
-void LoLEngine::chasePartyWithCloseAttacks(LoLMonsterInPlay *monster) {
+void LoLEngine::chasePartyWithCloseAttacks(LoLMonster *monster) {
if (!(monster->flags & 8)) {
int dir = calcMonsterDirection(monster->x & 0xff00, monster->y & 0xff00, _partyPosX & 0xff00, _partyPosY & 0xff00);
int x1 = _partyPosX;
@@ -1389,7 +1334,7 @@ void LoLEngine::chasePartyWithCloseAttacks(LoLMonsterInPlay *monster) {
}
}
-int LoLEngine::walkMonsterCalcNextStep(LoLMonsterInPlay *monster) {
+int LoLEngine::walkMonsterCalcNextStep(LoLMonster *monster) {
static const int8 walkMonsterTable1[] = { 7, -6, 5, -4, 3, -2, 1, 0 };
static const int8 walkMonsterTable2[] = { -7, 6, -5, 4, -3, 2, -1, 0 };
@@ -1479,7 +1424,7 @@ int LoLEngine::checkForPossibleDistanceAttack(uint16 monsterBlock, int direction
return 5;
}
-int LoLEngine::walkMonsterCheckDest(int x, int y, LoLMonsterInPlay *monster, int unk) {
+int LoLEngine::walkMonsterCheckDest(int x, int y, LoLMonster *monster, int unk) {
uint8 m = monster->mode;
monster->mode = 15;
@@ -1497,7 +1442,7 @@ void LoLEngine::getNextStepCoords(int16 srcX, int16 srcY, int &newX, int &newY,
newY = (srcY + shiftTableY[direction]) & 0x1fff;
}
-void LoLEngine::rearrangeAttackingMonster(LoLMonsterInPlay *monster) {
+void LoLEngine::rearrangeAttackingMonster(LoLMonster *monster) {
int t = (monster->direction >> 1);
uint16 mx = monster->x;
uint16 my = monster->y;
@@ -1564,7 +1509,7 @@ void LoLEngine::rearrangeAttackingMonster(LoLMonsterInPlay *monster) {
placeMonster(monster, mx, my);
}
-void LoLEngine::moveStrayingMonster(LoLMonsterInPlay *monster) {
+void LoLEngine::moveStrayingMonster(LoLMonster *monster) {
int x = 0;
int y = 0;
@@ -1601,7 +1546,7 @@ void LoLEngine::moveStrayingMonster(LoLMonsterInPlay *monster) {
}
}
-void LoLEngine::killMonster(LoLMonsterInPlay *monster) {
+void LoLEngine::killMonster(LoLMonster *monster) {
setMonsterMode(monster, 14);
monsterDropItems(monster);
checkSceneUpdateNeed(monster->block);
Commit: 0e2b8413e55eb9fa2839d89d7ff3e8270b8b8c29
https://github.com/scummvm/scummvm/commit/0e2b8413e55eb9fa2839d89d7ff3e8270b8b8c29
Author: athrxx (athrxx at scummvm.org)
Date: 2011-12-27T15:01:33-08:00
Commit Message:
KYRA: add support for another Russian HOF fan translation
Changed paths:
devtools/create_kyradat/create_kyradat.cpp
devtools/create_kyradat/extract.cpp
devtools/create_kyradat/games.cpp
devtools/create_kyradat/tables.cpp
dists/engine-data/kyra.dat
engines/kyra/detection_tables.h
engines/kyra/script.h
engines/kyra/staticres.cpp
diff --git a/devtools/create_kyradat/create_kyradat.cpp b/devtools/create_kyradat/create_kyradat.cpp
index 13f9711..0b7d4af 100644
--- a/devtools/create_kyradat/create_kyradat.cpp
+++ b/devtools/create_kyradat/create_kyradat.cpp
@@ -45,7 +45,7 @@
#include <map>
enum {
- kKyraDatVersion = 79
+ kKyraDatVersion = 80
};
const ExtractFilename extractFilenames[] = {
diff --git a/devtools/create_kyradat/extract.cpp b/devtools/create_kyradat/extract.cpp
index 420b661..3c19cf0 100644
--- a/devtools/create_kyradat/extract.cpp
+++ b/devtools/create_kyradat/extract.cpp
@@ -178,7 +178,7 @@ bool extractStrings(PAKFile &out, const ExtractInformation *info, const byte *da
if (id == k2IngamePakFiles)
patch = 4;
- if (info->lang == Common::RU_RUS) {
+ if (info->lang == Common::RU_RUS && info->special == kNoSpecial) {
patch = 5;
if (id == k2SeqplayStrings) {
rusFanSkipId = rusFanSkip_k2SeqplayStrings;
diff --git a/devtools/create_kyradat/games.cpp b/devtools/create_kyradat/games.cpp
index 74f8517..e0e6f01 100644
--- a/devtools/create_kyradat/games.cpp
+++ b/devtools/create_kyradat/games.cpp
@@ -77,6 +77,7 @@ const Game kyra2Games[] = {
// talkie games
{ kKyra2, { EN_ANY, FR_FRA, DE_DEU }, kPlatformPC, kTalkieVersion, { "85bbc1cc6c4cef6ad31fc6ee79518efb", "e20d0d2e500f01e399ec588247a7e213" } },
{ kKyra2, { IT_ITA, FR_FRA, DE_DEU }, kPlatformPC, kTalkieVersion, { "130795aa8f2333250c895dae9028b9bb", "e20d0d2e500f01e399ec588247a7e213" } }, // Italian Fan Translation
+ { kKyra2, { RU_RUS, FR_FRA, DE_DEU }, kPlatformPC, kTalkieVersion, { "c3afd22959f515355b2a33cde950f418", "e20d0d2e500f01e399ec588247a7e213" } }, // Russian Fan Translation
// FM-TOWNS games
{ kKyra2, { EN_ANY, JA_JPN, -1 }, kPlatformFMTowns, kNoSpecial, { "74f50d79c919cc8e7196c24942ce43d7", "a9a7fd4f05d00090e9e8bda073e6d431" } },
diff --git a/devtools/create_kyradat/tables.cpp b/devtools/create_kyradat/tables.cpp
index 3ff10c2..e3f658a 100644
--- a/devtools/create_kyradat/tables.cpp
+++ b/devtools/create_kyradat/tables.cpp
@@ -1113,6 +1113,7 @@ const ExtractEntrySearchData k2SeqplayStringsProvider[] = {
{ IT_ITA, kPlatformPC, { 0x00000916, 0x0003188F, { { 0xDC, 0x46, 0x06, 0xE1, 0xB0, 0x66, 0xBC, 0x18, 0x2E, 0x6E, 0x9E, 0xC9, 0xA4, 0x14, 0x8D, 0x08 } } } }, // floppy
{ IT_ITA, kPlatformPC, { 0x000008C8, 0x00030947, { { 0x7F, 0x75, 0x5F, 0x99, 0x94, 0xFE, 0xA1, 0xE6, 0xEF, 0xB8, 0x93, 0x71, 0x83, 0x1B, 0xAC, 0x4A } } } }, // (fan) CD
+ { RU_RUS, kPlatformPC, { 0x00000916, 0x00032C49, { { 0xEA, 0x5C, 0xE5, 0x06, 0x05, 0x5F, 0x36, 0xE8, 0x31, 0x3E, 0xBF, 0x74, 0x73, 0xFB, 0xAB, 0xFF } } } }, // (fan) CD - intro and outro strings haven't been translated in this fan translation
{ RU_RUS, kPlatformPC, { 0x000008C8, 0x00028639, { { 0xF9, 0x1D, 0x6A, 0x85, 0x23, 0x5E, 0x2A, 0x64, 0xBC, 0x45, 0xB2, 0x48, 0x13, 0x49, 0xD4, 0xF7 } } } }, // (fan) floppy
{ EN_ANY, kPlatformFMTowns, { 0x00000990, 0x00030C61, { { 0x60, 0x51, 0x11, 0x83, 0x3F, 0x06, 0xC3, 0xA3, 0xE0, 0xC0, 0x2F, 0x41, 0x29, 0xDE, 0x65, 0xB1 } } } },
@@ -1142,6 +1143,7 @@ const ExtractEntrySearchData k2SeqplayTlkFilesProvider[] = {
{ FR_FRA, kPlatformPC, { 0x0000009D, 0x00002878, { { 0x28, 0x5D, 0x7F, 0x5B, 0x57, 0xC2, 0xFF, 0x73, 0xC1, 0x8E, 0xD6, 0xE0, 0x4D, 0x03, 0x99, 0x2C } } } },
{ DE_DEU, kPlatformPC, { 0x0000009D, 0x00002885, { { 0x87, 0x24, 0xB6, 0xE9, 0xD6, 0xAA, 0x68, 0x2D, 0x6B, 0x05, 0xDF, 0xE1, 0x2B, 0xA4, 0x79, 0xE5 } } } },
{ IT_ITA, kPlatformPC, { 0x0000009D, 0x0000286B, { { 0x58, 0x30, 0x72, 0x62, 0xC8, 0x77, 0x2A, 0x06, 0xD6, 0x24, 0x1A, 0x7A, 0xAF, 0x79, 0xFF, 0xAE } } } },
+ { RU_RUS, kPlatformPC, { 0x0000009D, 0x0000286B, { { 0x58, 0x30, 0x72, 0x62, 0xC8, 0x77, 0x2A, 0x06, 0xD6, 0x24, 0x1A, 0x7A, 0xAF, 0x79, 0xFF, 0xAE } } } },
EXTRACT_END_ENTRY
};
diff --git a/dists/engine-data/kyra.dat b/dists/engine-data/kyra.dat
index 56c7184..7fd8be0 100644
Binary files a/dists/engine-data/kyra.dat and b/dists/engine-data/kyra.dat differ
diff --git a/engines/kyra/detection_tables.h b/engines/kyra/detection_tables.h
index 31d7d6e..2b37085 100644
--- a/engines/kyra/detection_tables.h
+++ b/engines/kyra/detection_tables.h
@@ -645,6 +645,20 @@ const KYRAGameDescription adGameDescs[] = {
KYRA2_CD_FAN_FLAGS(Common::IT_ITA, Common::EN_ANY)
},
+ // Russian fan translation
+ { // CD version
+ {
+ "kyra2",
+ "CD",
+ AD_ENTRY1("FERRY.CPS", "763e2103858347d4ffffc329910d323f"),
+ Common::RU_RUS,
+ Common::kPlatformPC,
+ ADGF_DROPLANGUAGE | ADGF_CD,
+ GUIO4(GUIO_MIDIADLIB, GUIO_MIDIMT32, GUIO_MIDIGM, GUIO_MIDIPCSPK)
+ },
+ KYRA2_CD_FAN_FLAGS(Common::RU_RUS, Common::EN_ANY)
+ },
+
{ // Interactive Demo
{
"kyra2",
diff --git a/engines/kyra/script.h b/engines/kyra/script.h
index 858b2b1..dffb4e2 100644
--- a/engines/kyra/script.h
+++ b/engines/kyra/script.h
@@ -81,6 +81,23 @@ public:
// Both lead to some problems in our IFF parser, either reading after the end
// of file or producing a "Chunk overread" error message. To work around this
// we need to adjust the size field properly.
+
+ // Fix for certain Russian fan translations:
+ // Westwood's original code completely ignores the FORM chunk and its size
+ // setting. After opening a TIM or EMC file they just check whether the FORM
+ // chunk exists (as a kind of file type verification) and then immediately seek
+ // behind the FORM chunk.
+ // This means that their parser is immune to weird fan translation scripts
+ // where the file size doesn't match the form chunk size. In our implemetation
+ // this would produce "Chunk overread" errors.
+ // Westwood also always pads all chunk sizes to 2 byte alignment after reading
+ // them from the file (not with FORM though, since they completely ignore it).
+ // This seems to do the trick for our FORM chunk size issue with the Russian
+ // fan translations. Another method which I have tried and which seems to work
+ // well would be simply setting _formChunk.size to the file size (-12 for TIM).
+
+ _formChunk.size = (_formChunk.size + 1) & ~1;
+
if (_formType == MKTAG('E','M','C','2'))
_formChunk.size -= 8;
else if (_formType == MKTAG('A','V','F','S'))
diff --git a/engines/kyra/staticres.cpp b/engines/kyra/staticres.cpp
index e2a86d7..6c95451 100644
--- a/engines/kyra/staticres.cpp
+++ b/engines/kyra/staticres.cpp
@@ -38,7 +38,7 @@
namespace Kyra {
-#define RESFILE_VERSION 79
+#define RESFILE_VERSION 80
namespace {
bool checkKyraDat(Common::SeekableReadStream *file) {
More information about the Scummvm-git-logs
mailing list