aboutsummaryrefslogtreecommitdiff
path: root/engines/kyra
diff options
context:
space:
mode:
authorathrxx2011-12-17 22:39:11 +0100
committerJohannes Schickel2011-12-26 16:18:16 +0100
commit60330556ff5bf319db7815e6f3c635bc98edecc5 (patch)
tree99fb53e89ea5dc9897cc0eee8d8d1b866ec287f2 /engines/kyra
parent8716ed1703f55b4c0e33a87cf40b65d06151c641 (diff)
downloadscummvm-rg350-60330556ff5bf319db7815e6f3c635bc98edecc5.tar.gz
scummvm-rg350-60330556ff5bf319db7815e6f3c635bc98edecc5.tar.bz2
scummvm-rg350-60330556ff5bf319db7815e6f3c635bc98edecc5.zip
KYRA: (EOB/LOL) - move eob/lol specific screen code to new class
Diffstat (limited to 'engines/kyra')
-rw-r--r--engines/kyra/eobcommon.h1
-rw-r--r--engines/kyra/kyra_rpg.h1
-rw-r--r--engines/kyra/lol.cpp4
-rw-r--r--engines/kyra/lol.h1
-rw-r--r--engines/kyra/module.mk1
-rw-r--r--engines/kyra/scene_rpg.cpp5
-rw-r--r--engines/kyra/screen.h2
-rw-r--r--engines/kyra/screen_eob.cpp36
-rw-r--r--engines/kyra/screen_eob.h11
-rw-r--r--engines/kyra/screen_hof.cpp2
-rw-r--r--engines/kyra/screen_lol.cpp41
-rw-r--r--engines/kyra/screen_lol.h12
-rw-r--r--engines/kyra/screen_mr.cpp2
-rw-r--r--engines/kyra/screen_rpg.cpp126
-rw-r--r--engines/kyra/screen_rpg.h61
-rw-r--r--engines/kyra/screen_v2.h2
-rw-r--r--engines/kyra/text_lol.cpp4
-rw-r--r--engines/kyra/text_lol.h2
-rw-r--r--engines/kyra/text_rpg.cpp48
-rw-r--r--engines/kyra/text_rpg.h8
20 files changed, 238 insertions, 132 deletions
diff --git a/engines/kyra/eobcommon.h b/engines/kyra/eobcommon.h
index 77a8198abd..18fe893d80 100644
--- a/engines/kyra/eobcommon.h
+++ b/engines/kyra/eobcommon.h
@@ -250,6 +250,7 @@ public:
virtual ~EoBCoreEngine();
Screen *screen() { return _screen; }
+ Screen_Rpg *screen_rpg() { return _screen; }
GUI *gui() const { return _gui; }
protected:
diff --git a/engines/kyra/kyra_rpg.h b/engines/kyra/kyra_rpg.h
index 31fb9bc8d7..5d217b6f28 100644
--- a/engines/kyra/kyra_rpg.h
+++ b/engines/kyra/kyra_rpg.h
@@ -87,6 +87,7 @@ public:
virtual ~KyraRpgEngine();
virtual Screen *screen() = 0;
+ virtual Screen_Rpg *screen_rpg() = 0;
virtual GUI *gui() const = 0;
protected:
diff --git a/engines/kyra/lol.cpp b/engines/kyra/lol.cpp
index 01b1bdf065..d90b5c9523 100644
--- a/engines/kyra/lol.cpp
+++ b/engines/kyra/lol.cpp
@@ -361,6 +361,10 @@ Screen *LoLEngine::screen() {
return _screen;
}
+Screen_Rpg *LoLEngine::screen_rpg() {
+ return _screen;
+}
+
GUI *LoLEngine::gui() const {
return _gui;
}
diff --git a/engines/kyra/lol.h b/engines/kyra/lol.h
index eeaa1b51ad..3a6486b30e 100644
--- a/engines/kyra/lol.h
+++ b/engines/kyra/lol.h
@@ -279,6 +279,7 @@ public:
virtual void initKeymap();
Screen *screen();
+ Screen_Rpg *screen_rpg();
GUI *gui() const;
private:
diff --git a/engines/kyra/module.mk b/engines/kyra/module.mk
index 21e3ba3dff..edadcdbcbb 100644
--- a/engines/kyra/module.mk
+++ b/engines/kyra/module.mk
@@ -78,6 +78,7 @@ KYRARPG_COMMON_OBJ = \
kyra_rpg.o \
saveload_rpg.o \
scene_rpg.o \
+ screen_rpg.o \
sprites_rpg.o \
staticres_rpg.o \
text_rpg.o \
diff --git a/engines/kyra/scene_rpg.cpp b/engines/kyra/scene_rpg.cpp
index 07a7a879b1..88e992ff0c 100644
--- a/engines/kyra/scene_rpg.cpp
+++ b/engines/kyra/scene_rpg.cpp
@@ -23,6 +23,7 @@
#if defined(ENABLE_EOB) || defined(ENABLE_LOL)
#include "kyra/kyra_rpg.h"
+#include "kyra/screen_rpg.h"
#include "kyra/resource.h"
#include "kyra/timer.h"
#include "kyra/sound.h"
@@ -117,11 +118,11 @@ void KyraRpgEngine::scaleLevelShapesDim(int index, int16 &y1, int16 &y2, int dim
const ScreenDim *cDim = screen()->getScreenDim(dim);
- screen()->modifyScreenDim(dim, cDim->sx, y1, cDim->w, y2 - y1);
+ screen_rpg()->modifyScreenDim(dim, cDim->sx, y1, cDim->w, y2 - y1);
}
void KyraRpgEngine::drawLevelModifyScreenDim(int dim, int16 x1, int16 y1, int16 x2, int16 y2) {
- screen()->modifyScreenDim(dim, x1, y1 << 3, x2 - x1, (y2 - y1) << 3);
+ screen_rpg()->modifyScreenDim(dim, x1, y1 << 3, x2 - x1, (y2 - y1) << 3);
}
void KyraRpgEngine::generateBlockDrawingBuffer() {
diff --git a/engines/kyra/screen.h b/engines/kyra/screen.h
index 192e267014..f58a072869 100644
--- a/engines/kyra/screen.h
+++ b/engines/kyra/screen.h
@@ -458,8 +458,6 @@ public:
virtual void setScreenDim(int dim) = 0;
virtual const ScreenDim *getScreenDim(int dim) = 0;
- virtual int curDimIndex() const { return 0; }
- virtual void modifyScreenDim(int dim, int x, int y, int w, int h) {}
virtual int screenDimTableCount() const = 0;
const ScreenDim *_curDim;
diff --git a/engines/kyra/screen_eob.cpp b/engines/kyra/screen_eob.cpp
index 869f4375ae..15a9fefc37 100644
--- a/engines/kyra/screen_eob.cpp
+++ b/engines/kyra/screen_eob.cpp
@@ -36,7 +36,7 @@
namespace Kyra {
-Screen_EoB::Screen_EoB(EoBCoreEngine *vm, OSystem *system) : Screen(vm, system) {
+Screen_EoB::Screen_EoB(EoBCoreEngine *vm, OSystem *system) : Screen(vm, system), Screen_Rpg(vm, system, _screenDimTable, _screenDimTableCount) {
_shapeFadeMode[0] = _shapeFadeMode[1] = 0;
_shapeFadeInternal = 0;
_fadeData = 0;
@@ -44,9 +44,7 @@ Screen_EoB::Screen_EoB(EoBCoreEngine *vm, OSystem *system) : Screen(vm, system)
_dsX1 = _dsX2 = _dsY1 = _dsY2 = 0;
_gfxX = _gfxY = 0;
_gfxCol = 0;
- _customDimTable = 0;
_dsTempPage = 0;
- _curDimIndex = 0;
_dsDiv = 0;
_dsRem = 0;
_dsScaleTmp = 0;
@@ -55,19 +53,11 @@ Screen_EoB::Screen_EoB(EoBCoreEngine *vm, OSystem *system) : Screen(vm, system)
Screen_EoB::~Screen_EoB() {
delete[] _fadeData;
- if (_customDimTable) {
- for (int i = 0; i < _screenDimTableCount; i++)
- delete _customDimTable[i];
- }
- delete[] _customDimTable;
delete[] _dsTempPage;
}
bool Screen_EoB::init() {
if (Screen::init()) {
- _customDimTable = new ScreenDim*[_screenDimTableCount];
- memset(_customDimTable, 0, sizeof(ScreenDim*) * _screenDimTableCount);
-
int temp;
_gfxMaxY = _vm->staticres()->loadRawData(kEoBBaseExpObjectY, temp);
_fadeData = _vm->resource()->fileData("FADING.DAT", 0);
@@ -88,30 +78,6 @@ bool Screen_EoB::init() {
return false;
}
-void Screen_EoB::setScreenDim(int dim) {
- assert(dim < _screenDimTableCount);
- _curDim = _customDimTable[dim] ? (const ScreenDim *)_customDimTable[dim] : &_screenDimTable[dim];
- _curDimIndex = dim;
-}
-
-const ScreenDim *Screen_EoB::getScreenDim(int dim) {
- assert(dim < _screenDimTableCount);
- return _customDimTable[dim] ? (const ScreenDim *)_customDimTable[dim] : &_screenDimTable[dim];
-}
-
-void Screen_EoB::modifyScreenDim(int dim, int x, int y, int w, int h) {
- if (!_customDimTable[dim])
- _customDimTable[dim] = new ScreenDim;
-
- memcpy(_customDimTable[dim], &_screenDimTable[dim], sizeof(ScreenDim));
- _customDimTable[dim]->sx = x;
- _customDimTable[dim]->sy = y;
- _customDimTable[dim]->w = w;
- _customDimTable[dim]->h = h;
- if (dim == _curDimIndex)
- setScreenDim(dim);
-}
-
void Screen_EoB::setClearScreenDim(int dim) {
setScreenDim(dim);
clearCurDim();
diff --git a/engines/kyra/screen_eob.h b/engines/kyra/screen_eob.h
index 6406587980..2ede813cd6 100644
--- a/engines/kyra/screen_eob.h
+++ b/engines/kyra/screen_eob.h
@@ -25,22 +25,18 @@
#ifdef ENABLE_EOB
-#include "kyra/screen.h"
+#include "kyra/screen_rpg.h"
namespace Kyra {
class EoBCoreEngine;
-class Screen_EoB : public Screen{
+class Screen_EoB : public Screen_Rpg{
public:
Screen_EoB(EoBCoreEngine *vm, OSystem *system);
virtual ~Screen_EoB();
bool init();
- void setScreenDim(int dim);
- const ScreenDim *getScreenDim(int dim);
- int curDimIndex() const { return _curDimIndex; }
- void modifyScreenDim(int dim, int x, int y, int w, int h);
int screenDimTableCount() const { return _screenDimTableCount; }
void setClearScreenDim(int dim);
@@ -98,9 +94,6 @@ private:
static const ScreenDim _screenDimTable[];
static const int _screenDimTableCount;
-
- ScreenDim **_customDimTable;
- int _curDimIndex;
};
} // End of namespace Kyra
diff --git a/engines/kyra/screen_hof.cpp b/engines/kyra/screen_hof.cpp
index 24e0751c0e..7d4d0744a8 100644
--- a/engines/kyra/screen_hof.cpp
+++ b/engines/kyra/screen_hof.cpp
@@ -26,7 +26,7 @@
namespace Kyra {
Screen_HoF::Screen_HoF(KyraEngine_HoF *vm, OSystem *system)
- : Screen_v2(vm, system), _vm(vm) {
+ : Screen(vm, system), Screen_v2(vm, system), _vm(vm) {
}
void Screen_HoF::setScreenDim(int dim) {
diff --git a/engines/kyra/screen_lol.cpp b/engines/kyra/screen_lol.cpp
index 0f02165ac5..bef83f419e 100644
--- a/engines/kyra/screen_lol.cpp
+++ b/engines/kyra/screen_lol.cpp
@@ -31,7 +31,7 @@
namespace Kyra {
-Screen_LoL::Screen_LoL(LoLEngine *vm, OSystem *system) : Screen_v2(vm, system), _vm(vm) {
+Screen_LoL::Screen_LoL(LoLEngine *vm, OSystem *system) : Screen(vm, system), Screen_v2(vm, system), Screen_Rpg(vm, system, _screenDimTable = vm->gameFlags().use16ColorMode ? _screenDimTable16C : _screenDimTable256C, _screenDimTableCount), _vm(vm) {
_paletteOverlay1 = new uint8[0x100];
_paletteOverlay2 = new uint8[0x100];
_grayOverlay = new uint8[0x100];
@@ -43,16 +43,10 @@ Screen_LoL::Screen_LoL(LoLEngine *vm, OSystem *system) : Screen_v2(vm, system),
_levelOverlays[i] = new uint8[256];
_screenDimTable = 0;
- _customDimTable = 0;
- _curDimIndex = 0;
_fadeFlag = 2;
}
Screen_LoL::~Screen_LoL() {
- for (int i = 0; i < _screenDimTableCount; i++)
- delete _customDimTable[i];
- delete[] _customDimTable;
-
for (int i = 0; i < 8; i++)
delete[] _levelOverlays[i];
@@ -61,39 +55,6 @@ Screen_LoL::~Screen_LoL() {
delete[] _grayOverlay;
}
-bool Screen_LoL::init() {
- if (Screen::init()) {
- _screenDimTable = _use16ColorMode ? _screenDimTable16C : _screenDimTable256C;
- _customDimTable = new ScreenDim*[_screenDimTableCount];
- memset(_customDimTable, 0, sizeof(ScreenDim *)* _screenDimTableCount);
- return true;
- }
- return false;
-}
-
-
-void Screen_LoL::setScreenDim(int dim) {
- assert(dim < _screenDimTableCount);
- _curDim = _customDimTable[dim] ? (const ScreenDim *)_customDimTable[dim] : &_screenDimTable[dim];
- _curDimIndex = dim;
-}
-
-const ScreenDim *Screen_LoL::getScreenDim(int dim) {
- assert(dim < _screenDimTableCount);
- return _customDimTable[dim] ? (const ScreenDim *)_customDimTable[dim] : &_screenDimTable[dim];
-}
-
-void Screen_LoL::modifyScreenDim(int dim, int x, int y, int w, int h) {
- delete _customDimTable[dim];
- _customDimTable[dim] = new ScreenDim;
- memcpy(_customDimTable[dim], &_screenDimTable[dim], sizeof(ScreenDim));
- _customDimTable[dim]->sx = x;
- _customDimTable[dim]->sy = y;
- _customDimTable[dim]->w = w;
- _customDimTable[dim]->h = h;
- setScreenDim(dim);
-}
-
void Screen_LoL::fprintString(const char *format, int x, int y, uint8 col1, uint8 col2, uint16 flags, ...) {
if (!format)
return;
diff --git a/engines/kyra/screen_lol.h b/engines/kyra/screen_lol.h
index 02b78606b9..eb025fb1cf 100644
--- a/engines/kyra/screen_lol.h
+++ b/engines/kyra/screen_lol.h
@@ -26,22 +26,17 @@
#define KYRA_SCREEN_LOL_H
#include "kyra/screen_v2.h"
+#include "kyra/screen_rpg.h"
namespace Kyra {
class LoLEngine;
-class Screen_LoL : public Screen_v2 {
+class Screen_LoL : public Screen_v2, public Screen_Rpg {
public:
Screen_LoL(LoLEngine *vm, OSystem *system);
~Screen_LoL();
- bool init();
-
- void setScreenDim(int dim);
- const ScreenDim *getScreenDim(int dim);
- int curDimIndex() const { return _curDimIndex; }
- void modifyScreenDim(int dim, int x, int y, int w, int h);
int screenDimTableCount() const { return _screenDimTableCount; }
void fprintString(const char *format, int x, int y, uint8 col1, uint8 col2, uint16 flags, ...) GCC_PRINTF(2, 8);
@@ -105,9 +100,6 @@ private:
static const ScreenDim _screenDimTable256C[];
static const ScreenDim _screenDimTable16C[];
- ScreenDim **_customDimTable;
- int _curDimIndex;
-
uint8 *_levelOverlays[8];
void mergeOverlay(int x, int y, int w, int h);
diff --git a/engines/kyra/screen_mr.cpp b/engines/kyra/screen_mr.cpp
index 2687dc8041..d4446c6d91 100644
--- a/engines/kyra/screen_mr.cpp
+++ b/engines/kyra/screen_mr.cpp
@@ -25,7 +25,7 @@
namespace Kyra {
-Screen_MR::Screen_MR(KyraEngine_MR *vm, OSystem *system) : Screen_v2(vm, system) {
+Screen_MR::Screen_MR(KyraEngine_MR *vm, OSystem *system) : Screen(vm, system), Screen_v2(vm, system) {
}
Screen_MR::~Screen_MR() {
diff --git a/engines/kyra/screen_rpg.cpp b/engines/kyra/screen_rpg.cpp
new file mode 100644
index 0000000000..3b29f0adb5
--- /dev/null
+++ b/engines/kyra/screen_rpg.cpp
@@ -0,0 +1,126 @@
+/* ScummVM - Graphic Adventure Engine
+ *
+ * ScummVM is the legal property of its developers, whose names
+ * are too numerous to list here. Please refer to the COPYRIGHT
+ * file distributed with this source distribution.
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version 2
+ * of the License, or (at your option) any later version.
+
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+ *
+ */
+
+
+#if defined(ENABLE_EOB) || defined(ENABLE_LOL)
+
+#include "kyra/screen_rpg.h"
+#include "kyra/kyra_v1.h"
+
+#include "common/endian.h"
+
+namespace Kyra {
+
+Screen_Rpg::Screen_Rpg(KyraEngine_v1 *vm, OSystem *system, const ScreenDim *dimTable, int dimTableSize) : Screen(vm, system), _screenDimTable(dimTable), _screenDimTableCount(dimTableSize) {
+ _customDimTable = new ScreenDim*[_screenDimTableCount];
+ memset(_customDimTable, 0, sizeof(ScreenDim *)* _screenDimTableCount);
+ _curDimIndex = 0;
+}
+
+Screen_Rpg::~Screen_Rpg() {
+ for (int i = 0; i < _screenDimTableCount; i++)
+ delete _customDimTable[i];
+ delete[] _customDimTable;
+}
+
+void Screen_Rpg::setScreenDim(int dim) {
+ assert(dim < _screenDimTableCount);
+ _curDim = _customDimTable[dim] ? (const ScreenDim *)_customDimTable[dim] : &_screenDimTable[dim];
+ _curDimIndex = dim;
+}
+
+const ScreenDim *Screen_Rpg::getScreenDim(int dim) {
+ assert(dim < _screenDimTableCount);
+ return _customDimTable[dim] ? (const ScreenDim *)_customDimTable[dim] : &_screenDimTable[dim];
+}
+
+void Screen_Rpg::modifyScreenDim(int dim, int x, int y, int w, int h) {
+ if (!_customDimTable[dim])
+ _customDimTable[dim] = new ScreenDim;
+
+ memcpy(_customDimTable[dim], &_screenDimTable[dim], sizeof(ScreenDim));
+ _customDimTable[dim]->sx = x;
+ _customDimTable[dim]->sy = y;
+ _customDimTable[dim]->w = w;
+ _customDimTable[dim]->h = h;
+ if (dim == _curDimIndex || _vm->game() == GI_LOL)
+ setScreenDim(dim);
+}
+
+void Screen_Rpg::crossFadeRegion(int x1, int y1, int x2, int y2, int w, int h, int srcPage, int dstPage) {
+ if (srcPage > 13 || dstPage > 13)
+ error("Screen_Rpg::crossFadeRegion(): attempting to use temp page as source or dest page.");
+
+ hideMouse();
+
+ uint16 *wB = (uint16*)_pagePtrs[14];
+ uint8 *hB = _pagePtrs[14] + 640;
+
+ for (int i = 0; i < w; i++)
+ wB[i] = i;
+
+ for (int i = 0; i < h; i++)
+ hB[i] = i;
+
+ for (int i = 0; i < w; i++)
+ SWAP(wB[_vm->_rnd.getRandomNumberRng(0, w - 1)], wB[i]);
+
+ for (int i = 0; i < h; i++)
+ SWAP(hB[_vm->_rnd.getRandomNumberRng(0, h - 1)], hB[i]);
+
+ uint8 *s = _pagePtrs[srcPage];
+ uint8 *d = _pagePtrs[dstPage];
+
+ for (int i = 0; i < h; i++) {
+ int iH = i;
+ uint32 end = _system->getMillis() + 3;
+ for (int ii = 0; ii < w; ii++) {
+ int sX = x1 + wB[ii];
+ int sY = y1 + hB[iH];
+ int dX = x2 + wB[ii];
+ int dY = y2 + hB[iH];
+
+ if (++iH >= h)
+ iH = 0;
+
+ d[dY * 320 + dX] = s[sY * 320 + sX];
+ addDirtyRect(dX, dY, 1, 1);
+ }
+
+ // This tries to speed things up, to get similiar speeds as in DOSBox etc.
+ // We can't write single pixels directly into the video memory like the original did.
+ // We also (unlike the original) want to aim at similiar speeds for all platforms.
+ if (!(i % 10))
+ updateScreen();
+
+ uint32 cur = _system->getMillis();
+ if (end > cur)
+ _system->delayMillis(end - cur);
+ }
+
+ updateScreen();
+ showMouse();
+}
+
+} // End of namespace Kyra
+
+#endif // ENABLE_EOB || ENABLE_LOL
diff --git a/engines/kyra/screen_rpg.h b/engines/kyra/screen_rpg.h
new file mode 100644
index 0000000000..e9b15c25ef
--- /dev/null
+++ b/engines/kyra/screen_rpg.h
@@ -0,0 +1,61 @@
+/* ScummVM - Graphic Adventure Engine
+ *
+ * ScummVM is the legal property of its developers, whose names
+ * are too numerous to list here. Please refer to the COPYRIGHT
+ * file distributed with this source distribution.
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version 2
+ * of the License, or (at your option) any later version.
+
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+ *
+ */
+
+#ifndef KYRA_SCREEN_RPG_H
+#define KYRA_SCREEN_RPG_H
+
+#if defined(ENABLE_EOB) || defined(ENABLE_LOL)
+
+#include "kyra/screen.h"
+#include "common/system.h"
+
+namespace Kyra {
+
+class Screen;
+class KyraEngine_v1;
+
+class Screen_Rpg : virtual public Screen {
+public:
+ Screen_Rpg(KyraEngine_v1 *vm, OSystem *system, const ScreenDim *dimTable, int dimTableSize);
+ virtual ~Screen_Rpg();
+
+ virtual void setScreenDim(int dim);
+ virtual const ScreenDim *getScreenDim(int dim);
+ virtual int screenDimTableCount() const = 0;
+
+ void modifyScreenDim(int dim, int x, int y, int w, int h);
+ int curDimIndex() const { return _curDimIndex; }
+
+ void crossFadeRegion(int x1, int y1, int x2, int y2, int w, int h, int srcPage, int dstPage);
+
+private:
+ int _curDimIndex;
+ int _screenDimTableCount;
+ ScreenDim **_customDimTable;
+ const ScreenDim *_screenDimTable;
+};
+
+} // End of namespace Kyra
+
+#endif // ENABLE_EOB || ENABLE_LOL
+
+#endif
diff --git a/engines/kyra/screen_v2.h b/engines/kyra/screen_v2.h
index d85c762038..f50c81e912 100644
--- a/engines/kyra/screen_v2.h
+++ b/engines/kyra/screen_v2.h
@@ -28,7 +28,7 @@
namespace Kyra {
-class Screen_v2 : public Screen {
+class Screen_v2 : virtual public Screen {
public:
Screen_v2(KyraEngine_v1 *vm, OSystem *system);
~Screen_v2();
diff --git a/engines/kyra/text_lol.cpp b/engines/kyra/text_lol.cpp
index d07956b3ff..8535516bf9 100644
--- a/engines/kyra/text_lol.cpp
+++ b/engines/kyra/text_lol.cpp
@@ -32,7 +32,7 @@
namespace Kyra {
-TextDisplayer_LoL::TextDisplayer_LoL(LoLEngine *engine, Screen_LoL *screenLoL) : TextDisplayer_rpg(engine, engine->screen()),
+TextDisplayer_LoL::TextDisplayer_LoL(LoLEngine *engine, Screen_LoL *screenLoL) : TextDisplayer_rpg(engine, engine->screen_rpg()),
_vm(engine), _screen(screenLoL), _scriptTextParameter(0) {
memset(_stringParameters, 0, 15 * sizeof(char *));
@@ -337,7 +337,7 @@ KyraRpgEngine *TextDisplayer_LoL::vm() {
return _vm;
}
-Screen *TextDisplayer_LoL::screen() {
+Screen_Rpg *TextDisplayer_LoL::screen() {
return _screen;
}
diff --git a/engines/kyra/text_lol.h b/engines/kyra/text_lol.h
index 6da217e30e..baf0f2f2c5 100644
--- a/engines/kyra/text_lol.h
+++ b/engines/kyra/text_lol.h
@@ -51,7 +51,7 @@ public:
private:
KyraRpgEngine *vm();
- Screen *screen();
+ Screen_Rpg *screen();
void preprocessString(char *str, EMCState *script, const uint16 *paramList, int16 paramIndex);
void textPageBreak();
diff --git a/engines/kyra/text_rpg.cpp b/engines/kyra/text_rpg.cpp
index 1201cdcb45..ca1fd04269 100644
--- a/engines/kyra/text_rpg.cpp
+++ b/engines/kyra/text_rpg.cpp
@@ -24,7 +24,7 @@
#if defined(ENABLE_EOB) || defined(ENABLE_LOL)
#include "kyra/kyra_rpg.h"
-#include "kyra/screen.h"
+#include "kyra/screen_rpg.h"
#include "kyra/timer.h"
#include "common/system.h"
@@ -35,7 +35,7 @@ enum {
kEoBTextBufferSize = 2048
};
-TextDisplayer_rpg::TextDisplayer_rpg(KyraRpgEngine *engine, Screen *sScreen) : _vm(engine), _screen(sScreen),
+TextDisplayer_rpg::TextDisplayer_rpg(KyraRpgEngine *engine, Screen_Rpg *scr) : _vm(engine), _screen(scr),
_lineCount(0), _printFlag(false), _lineWidth(0), _numCharsTotal(0), _allowPageBreak(true),
_numCharsLeft(0), _numCharsPrinted(0), _sjisLineBreakFlag(false), _waitButtonMode(1) {
@@ -462,7 +462,7 @@ void TextDisplayer_rpg::printLine(char *str) {
}
void TextDisplayer_rpg::printDialogueText(int stringId, const char *pageBreakString) {
- const char * str = (const char *)(screen()->getCPagePtr(5) + READ_LE_UINT16(&screen()->getCPagePtr(5)[(stringId - 1) << 1]));
+ const char * str = (const char *)(_screen->getCPagePtr(5) + READ_LE_UINT16(&_screen->getCPagePtr(5)[(stringId - 1) << 1]));
assert (strlen(str) < kEoBTextBufferSize);
Common::strlcpy(_dialogueBuffer, str, kEoBTextBufferSize);
@@ -488,10 +488,10 @@ void TextDisplayer_rpg::printDialogueText(const char *str, bool wait) {
}
void TextDisplayer_rpg::printMessage(const char *str, int textColor, ...) {
- int tc = _textDimData[screen()->curDimIndex()].color1;
+ int tc = _textDimData[_screen->curDimIndex()].color1;
if (textColor != -1)
- _textDimData[screen()->curDimIndex()].color1 = textColor;
+ _textDimData[_screen->curDimIndex()].color1 = textColor;
va_list args;
va_start(args, textColor);
@@ -501,28 +501,28 @@ void TextDisplayer_rpg::printMessage(const char *str, int textColor, ...) {
displayText(_dialogueBuffer);
if (vm()->game() != GI_EOB1)
- _textDimData[screen()->curDimIndex()].color1 = tc;
+ _textDimData[_screen->curDimIndex()].color1 = tc;
- if (!screen()->_curPage)
- screen()->updateScreen();
+ if (!_screen->_curPage)
+ _screen->updateScreen();
}
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;
+ 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;
clearCurDim();
return res;
}
void TextDisplayer_rpg::clearCurDim() {
- int d = screen()->curDimIndex();
- const ScreenDim *tmp = screen()->getScreenDim(d);
+ int d = _screen->curDimIndex();
+ const ScreenDim *tmp = _screen->getScreenDim(d);
if (vm()->gameFlags().use16ColorMode) {
- screen()->fillRect(tmp->sx << 3, tmp->sy, ((tmp->sx + tmp->w) << 3) - 2, (tmp->sy + tmp->h) - 2, _textDimData[d].color2);
+ _screen->fillRect(tmp->sx << 3, tmp->sy, ((tmp->sx + tmp->w) << 3) - 2, (tmp->sy + tmp->h) - 2, _textDimData[d].color2);
} else
- screen()->fillRect(tmp->sx << 3, tmp->sy, ((tmp->sx + tmp->w) << 3) - 1, (tmp->sy + tmp->h) - 1, _textDimData[d].color2);
+ _screen->fillRect(tmp->sx << 3, tmp->sy, ((tmp->sx + tmp->w) << 3) - 1, (tmp->sy + tmp->h) - 1, _textDimData[d].color2);
_lineCount = 0;
_textDimData[d].column = _textDimData[d].line = 0;
@@ -533,7 +533,7 @@ void TextDisplayer_rpg::textPageBreak() {
SWAP(vm()->_dialogueButtonLabelCol1, vm()->_dialogueButtonLabelCol2);
int cp = _screen->setCurPage(0);
- Screen::FontId cf = screen()->setFont(vm()->gameFlags().use16ColorMode ? Screen::FID_SJIS_FNT : Screen::FID_6_FNT);
+ Screen::FontId cf = _screen->setFont(vm()->gameFlags().use16ColorMode ? Screen::FID_SJIS_FNT : Screen::FID_6_FNT);
if (vm()->game() == GI_LOL)
vm()->_timer->pauseSingleTimer(11, true);
@@ -554,7 +554,7 @@ void TextDisplayer_rpg::textPageBreak() {
if (vm()->speechEnabled() && vm()->_activeVoiceFileTotalTime && _numCharsTotal)
speechPartTime = vm()->_system->getMillis() + ((_numCharsPrinted * vm()->_activeVoiceFileTotalTime) / _numCharsTotal);
- const ScreenDim *dim = screen()->getScreenDim(screen()->curDimIndex());
+ const ScreenDim *dim = _screen->getScreenDim(_screen->curDimIndex());
int x = ((dim->sx + dim->w) << 3) - (_vm->_dialogueButtonW + 3);
int y = 0;
@@ -579,10 +579,10 @@ void TextDisplayer_rpg::textPageBreak() {
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);
+ _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);
+ _screen->printText(_pageBreakString, x + (w >> 1) - (vm()->screen()->getTextWidth(_pageBreakString) >> 1), y + 2, vm()->_dialogueButtonLabelCol1, 0);
}
vm()->removeInputTop();
@@ -627,9 +627,9 @@ void TextDisplayer_rpg::textPageBreak() {
} while (loop && !_vm->shouldQuit());
if (vm()->gameFlags().use16ColorMode)
- screen()->fillRect(x + 8, y, x + 57, y + 9, _textDimData[screen()->curDimIndex()].color2);
+ _screen->fillRect(x + 8, y, x + 57, y + 9, _textDimData[_screen->curDimIndex()].color2);
else
- screen()->fillRect(x, y, x + w - 1, y + 8, _textDimData[screen()->curDimIndex()].color2);
+ _screen->fillRect(x, y, x + w - 1, y + 8, _textDimData[_screen->curDimIndex()].color2);
clearCurDim();
_screen->updateScreen();
@@ -647,8 +647,8 @@ void TextDisplayer_rpg::textPageBreak() {
vm()->_updatePortraitSpeechAnimDuration = updatePortraitSpeechAnimDuration;
}
- screen()->setFont(cf);
- screen()->setCurPage(cp);
+ _screen->setFont(cf);
+ _screen->setCurPage(cp);
if (vm()->game() != GI_LOL)
SWAP(vm()->_dialogueButtonLabelCol1, vm()->_dialogueButtonLabelCol2);
diff --git a/engines/kyra/text_rpg.h b/engines/kyra/text_rpg.h
index fcafcc0f4d..ff3473dc56 100644
--- a/engines/kyra/text_rpg.h
+++ b/engines/kyra/text_rpg.h
@@ -29,12 +29,12 @@
namespace Kyra {
-class Screen;
+class Screen_Rpg;
class KyraRpgEngine;
class TextDisplayer_rpg {
public:
- TextDisplayer_rpg(KyraRpgEngine *engine, Screen *sScreen);
+ TextDisplayer_rpg(KyraRpgEngine *engine, Screen_Rpg *scr);
virtual ~TextDisplayer_rpg();
virtual void setupField(int dim, bool mode);
@@ -57,7 +57,7 @@ public:
protected:
virtual KyraRpgEngine *vm() { return _vm; }
- virtual Screen *screen() { return _screen; }
+ virtual Screen_Rpg *screen() { return _screen; }
void displayText(char *str, ...);
char parseCommand();
@@ -102,7 +102,7 @@ protected:
private:
KyraRpgEngine *_vm;
- Screen *_screen;
+ Screen_Rpg *_screen;
char *_table1;
char *_table2;