aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJohannes Schickel2011-12-26 19:27:20 +0100
committerJohannes Schickel2011-12-26 19:32:05 +0100
commit487e73bd218775dec22818477ad75dd230d97052 (patch)
treebd83a597ab7c48358f77212562bcf32cb1b7a286
parentc2a94132c8adf8bec5914ca6fa2e312248e1c2bd (diff)
downloadscummvm-rg350-487e73bd218775dec22818477ad75dd230d97052.tar.gz
scummvm-rg350-487e73bd218775dec22818477ad75dd230d97052.tar.bz2
scummvm-rg350-487e73bd218775dec22818477ad75dd230d97052.zip
KYRA: Merge Screen_Rpg with Screen (for now).
This should(!) fix ARM compilation issues due to virtual inheritance.
-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.cpp90
-rw-r--r--engines/kyra/screen.h20
-rw-r--r--engines/kyra/screen_eob.cpp2
-rw-r--r--engines/kyra/screen_eob.h6
-rw-r--r--engines/kyra/screen_hof.cpp12
-rw-r--r--engines/kyra/screen_hof.h4
-rw-r--r--engines/kyra/screen_lok.cpp12
-rw-r--r--engines/kyra/screen_lok.h4
-rw-r--r--engines/kyra/screen_lol.cpp3
-rw-r--r--engines/kyra/screen_lol.h9
-rw-r--r--engines/kyra/screen_mr.cpp13
-rw-r--r--engines/kyra/screen_mr.h4
-rw-r--r--engines/kyra/screen_rpg.cpp126
-rw-r--r--engines/kyra/screen_rpg.h61
-rw-r--r--engines/kyra/screen_v2.cpp3
-rw-r--r--engines/kyra/screen_v2.h4
-rw-r--r--engines/kyra/text_lol.cpp4
-rw-r--r--engines/kyra/text_lol.h4
-rw-r--r--engines/kyra/text_rpg.cpp3
-rw-r--r--engines/kyra/text_rpg.h8
26 files changed, 129 insertions, 276 deletions
diff --git a/engines/kyra/eobcommon.h b/engines/kyra/eobcommon.h
index dfc99ea13a..fa65c93a4e 100644
--- a/engines/kyra/eobcommon.h
+++ b/engines/kyra/eobcommon.h
@@ -251,7 +251,6 @@ 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 13a67c6d56..1a5acb8e63 100644
--- a/engines/kyra/kyra_rpg.h
+++ b/engines/kyra/kyra_rpg.h
@@ -87,7 +87,6 @@ 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 d90b5c9523..01b1bdf065 100644
--- a/engines/kyra/lol.cpp
+++ b/engines/kyra/lol.cpp
@@ -361,10 +361,6 @@ 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 3a6486b30e..eeaa1b51ad 100644
--- a/engines/kyra/lol.h
+++ b/engines/kyra/lol.h
@@ -279,7 +279,6 @@ 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 edadcdbcbb..21e3ba3dff 100644
--- a/engines/kyra/module.mk
+++ b/engines/kyra/module.mk
@@ -78,7 +78,6 @@ 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 88e992ff0c..07a7a879b1 100644
--- a/engines/kyra/scene_rpg.cpp
+++ b/engines/kyra/scene_rpg.cpp
@@ -23,7 +23,6 @@
#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"
@@ -118,11 +117,11 @@ void KyraRpgEngine::scaleLevelShapesDim(int index, int16 &y1, int16 &y2, int dim
const ScreenDim *cDim = screen()->getScreenDim(dim);
- screen_rpg()->modifyScreenDim(dim, cDim->sx, y1, cDim->w, y2 - y1);
+ screen()->modifyScreenDim(dim, cDim->sx, y1, cDim->w, y2 - y1);
}
void KyraRpgEngine::drawLevelModifyScreenDim(int dim, int16 x1, int16 y1, int16 x2, int16 y2) {
- screen_rpg()->modifyScreenDim(dim, x1, y1 << 3, x2 - x1, (y2 - y1) << 3);
+ screen()->modifyScreenDim(dim, x1, y1 << 3, x2 - x1, (y2 - y1) << 3);
}
void KyraRpgEngine::generateBlockDrawingBuffer() {
diff --git a/engines/kyra/screen.cpp b/engines/kyra/screen.cpp
index 3d94189fc9..fa1daa2b1a 100644
--- a/engines/kyra/screen.cpp
+++ b/engines/kyra/screen.cpp
@@ -36,8 +36,8 @@
namespace Kyra {
-Screen::Screen(KyraEngine_v1 *vm, OSystem *system)
- : _system(system), _vm(vm), _sjisInvisibleColor(0),
+Screen::Screen(KyraEngine_v1 *vm, OSystem *system, const ScreenDim *dimTable, const int dimTableSize)
+ : _system(system), _vm(vm), _sjisInvisibleColor(0), _dimTable(dimTable), _dimTableCount(dimTableSize),
_cursorColorKey((vm->game() == GI_KYRA1) ? 0xFF : 0x00) {
_debugEnabled = false;
_maskMinY = _maskMaxY = -1;
@@ -70,6 +70,10 @@ Screen::~Screen() {
for (uint i = 0; i < _palettes.size(); ++i)
delete _palettes[i];
+
+ for (int i = 0; i < _dimTableCount; ++i)
+ delete _customDimTable[i];
+ delete[] _customDimTable;
}
bool Screen::init() {
@@ -146,6 +150,10 @@ bool Screen::init() {
_system->getPaletteManager()->setPalette(palette, 16, 8);
}
+ _customDimTable = new ScreenDim *[_dimTableCount];
+ memset(_customDimTable, 0, sizeof(ScreenDim *) * _dimTableCount);
+
+ _curDimIndex = -1;
_curDim = 0;
_charWidth = 0;
_charOffset = 0;
@@ -375,6 +383,29 @@ void Screen::mergeOverlay(int x, int y, int w, int h) {
}
}
+const ScreenDim *Screen::getScreenDim(int dim) const {
+ assert(dim < _dimTableCount);
+ return _customDimTable[dim] ? _customDimTable[dim] : &_dimTable[dim];
+}
+
+void Screen::modifyScreenDim(int dim, int x, int y, int w, int h) {
+ if (!_customDimTable[dim])
+ _customDimTable[dim] = new ScreenDim;
+
+ memcpy(_customDimTable[dim], &_dimTable[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::setScreenDim(int dim) {
+ _curDim = getScreenDim(dim);
+ _curDimIndex = dim;
+}
+
uint8 *Screen::getPagePtr(int pageNum) {
assert(pageNum < SCREEN_PAGE_NUM);
return _pagePtrs[pageNum];
@@ -3170,6 +3201,61 @@ void Screen::copyOverlayRegion(int x, int y, int x2, int y2, int w, int h, int s
}
}
+void Screen::crossFadeRegion(int x1, int y1, int x2, int y2, int w, int h, int srcPage, int dstPage) {
+ if (srcPage > 13 || dstPage > 13)
+ error("Screen::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();
+}
+
#pragma mark -
DOSFont::DOSFont() {
diff --git a/engines/kyra/screen.h b/engines/kyra/screen.h
index 1118c97d93..dd74692a5d 100644
--- a/engines/kyra/screen.h
+++ b/engines/kyra/screen.h
@@ -366,7 +366,7 @@ public:
FID_NUM
};
- Screen(KyraEngine_v1 *vm, OSystem *system);
+ Screen(KyraEngine_v1 *vm, OSystem *system, const ScreenDim *dimTable, const int dimTableSize);
virtual ~Screen();
// init
@@ -449,9 +449,12 @@ public:
virtual void setTextColorMap(const uint8 *cmap) = 0;
void setTextColor(const uint8 *cmap, int a, int b);
- virtual void setScreenDim(int dim) = 0;
- virtual const ScreenDim *getScreenDim(int dim) = 0;
- virtual int screenDimTableCount() const = 0;
+ const ScreenDim *getScreenDim(int dim) const;
+ void modifyScreenDim(int dim, int x, int y, int w, int h);
+ int screenDimTableCount() const { return _dimTableCount; }
+
+ void setScreenDim(int dim);
+ int curDimIndex() const { return _curDimIndex; }
const ScreenDim *_curDim;
@@ -513,6 +516,9 @@ public:
static void convertAmigaGfx(uint8 *data, int w, int h, int depth = 5, bool wsa = false, int bytesPerPlane = -1);
static void convertAmigaMsc(uint8 *data);
+ // RPG specific, this does not belong here
+ void crossFadeRegion(int x1, int y1, int x2, int y2, int w, int h, int srcPage, int dstPage);
+
protected:
uint8 *getPagePtr(int pageNum);
void updateDirtyRects();
@@ -560,6 +566,12 @@ protected:
uint8 *_animBlockPtr;
int _animBlockSize;
+ // dimension handling
+ const ScreenDim * const _dimTable;
+ ScreenDim **_customDimTable;
+ const int _dimTableCount;
+ int _curDimIndex;
+
// mouse handling
int _mouseLockCount;
const uint8 _cursorColorKey;
diff --git a/engines/kyra/screen_eob.cpp b/engines/kyra/screen_eob.cpp
index 62d8bca201..7061ada4ac 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_Rpg(vm, system, _screenDimTable, _screenDimTableCount) {
+Screen_EoB::Screen_EoB(EoBCoreEngine *vm, OSystem *system) : Screen(vm, system, _screenDimTable, _screenDimTableCount) {
_shapeFadeMode[0] = _shapeFadeMode[1] = 0;
_shapeFadeInternal = 0;
_fadeData = 0;
diff --git a/engines/kyra/screen_eob.h b/engines/kyra/screen_eob.h
index 2efed83c0c..7040177266 100644
--- a/engines/kyra/screen_eob.h
+++ b/engines/kyra/screen_eob.h
@@ -25,20 +25,18 @@
#ifdef ENABLE_EOB
-#include "kyra/screen_rpg.h"
+#include "kyra/screen.h"
namespace Kyra {
class EoBCoreEngine;
-class Screen_EoB : public Screen_Rpg{
+class Screen_EoB : public Screen {
public:
Screen_EoB(EoBCoreEngine *vm, OSystem *system);
virtual ~Screen_EoB();
bool init();
- int screenDimTableCount() const { return _screenDimTableCount; }
-
void setClearScreenDim(int dim);
void clearCurDim();
diff --git a/engines/kyra/screen_hof.cpp b/engines/kyra/screen_hof.cpp
index 7d4d0744a8..ac6ee5eb77 100644
--- a/engines/kyra/screen_hof.cpp
+++ b/engines/kyra/screen_hof.cpp
@@ -26,17 +26,7 @@
namespace Kyra {
Screen_HoF::Screen_HoF(KyraEngine_HoF *vm, OSystem *system)
- : Screen(vm, system), Screen_v2(vm, system), _vm(vm) {
-}
-
-void Screen_HoF::setScreenDim(int dim) {
- assert(dim < _screenDimTableCount);
- _curDim = &_screenDimTable[dim];
-}
-
-const ScreenDim *Screen_HoF::getScreenDim(int dim) {
- assert(dim < _screenDimTableCount);
- return &_screenDimTable[dim];
+ : Screen_v2(vm, system, _screenDimTable, _screenDimTableCount), _vm(vm) {
}
void Screen_HoF::generateGrayOverlay(const Palette &srcPal, uint8 *grayOverlay, int factor, int addR, int addG, int addB, int lastColor, bool flag) {
diff --git a/engines/kyra/screen_hof.h b/engines/kyra/screen_hof.h
index edcb339da9..51c6a001fa 100644
--- a/engines/kyra/screen_hof.h
+++ b/engines/kyra/screen_hof.h
@@ -34,10 +34,6 @@ friend class Debugger_v2;
public:
Screen_HoF(KyraEngine_HoF *vm, OSystem *system);
- void setScreenDim(int dim);
- const ScreenDim *getScreenDim(int dim);
- int screenDimTableCount() const { return _screenDimTableCount; }
-
// sequence player
void generateGrayOverlay(const Palette &pal, uint8 *grayOverlay, int factor, int addR, int addG, int addB, int lastColor, bool flag);
void cmpFadeFrameStep(int srcPage, int srcW, int srcH, int srcX, int srcY, int dstPage, int dstW, int dstH, int dstX, int dstY, int cmpW, int cmpH, int cmpPage);
diff --git a/engines/kyra/screen_lok.cpp b/engines/kyra/screen_lok.cpp
index 106ef5df29..447e1428be 100644
--- a/engines/kyra/screen_lok.cpp
+++ b/engines/kyra/screen_lok.cpp
@@ -30,7 +30,7 @@
namespace Kyra {
Screen_LoK::Screen_LoK(KyraEngine_LoK *vm, OSystem *system)
- : Screen(vm, system) {
+ : Screen(vm, system, _screenDimTable, _screenDimTableCount) {
_vm = vm;
_unkPtr1 = _unkPtr2 = 0;
_bitBlitNum = 0;
@@ -70,16 +70,6 @@ bool Screen_LoK::init() {
return true;
}
-void Screen_LoK::setScreenDim(int dim) {
- assert(dim < _screenDimTableCount);
- _curDim = &_screenDimTable[dim];
-}
-
-const ScreenDim *Screen_LoK::getScreenDim(int dim) {
- assert(dim < _screenDimTableCount);
- return &_screenDimTable[dim];
-}
-
void Screen_LoK::fadeSpecialPalette(int palIndex, int startIndex, int size, int fadeTime) {
if (_vm->gameFlags().platform == Common::kPlatformAmiga)
return;
diff --git a/engines/kyra/screen_lok.h b/engines/kyra/screen_lok.h
index 3b74912986..3cb92543e5 100644
--- a/engines/kyra/screen_lok.h
+++ b/engines/kyra/screen_lok.h
@@ -38,10 +38,6 @@ public:
int getRectSize(int w, int h);
- void setScreenDim(int dim);
- const ScreenDim *getScreenDim(int dim);
- int screenDimTableCount() const { return _screenDimTableCount; }
-
void setTextColorMap(const uint8 *cmap);
void fadeSpecialPalette(int palIndex, int startIndex, int size, int fadeTime);
diff --git a/engines/kyra/screen_lol.cpp b/engines/kyra/screen_lol.cpp
index bef83f419e..4b8b443bd9 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(vm, system), Screen_v2(vm, system), Screen_Rpg(vm, system, _screenDimTable = vm->gameFlags().use16ColorMode ? _screenDimTable16C : _screenDimTable256C, _screenDimTableCount), _vm(vm) {
+Screen_LoL::Screen_LoL(LoLEngine *vm, OSystem *system) : Screen_v2(vm, system, vm->gameFlags().use16ColorMode ? _screenDimTable16C : _screenDimTable256C, _screenDimTableCount), _vm(vm) {
_paletteOverlay1 = new uint8[0x100];
_paletteOverlay2 = new uint8[0x100];
_grayOverlay = new uint8[0x100];
@@ -42,7 +42,6 @@ Screen_LoL::Screen_LoL(LoLEngine *vm, OSystem *system) : Screen(vm, system), Scr
for (int i = 0; i < 8; i++)
_levelOverlays[i] = new uint8[256];
- _screenDimTable = 0;
_fadeFlag = 2;
}
diff --git a/engines/kyra/screen_lol.h b/engines/kyra/screen_lol.h
index eb025fb1cf..3bba9f8b70 100644
--- a/engines/kyra/screen_lol.h
+++ b/engines/kyra/screen_lol.h
@@ -26,19 +26,16 @@
#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, public Screen_Rpg {
+class Screen_LoL : public Screen_v2 {
public:
Screen_LoL(LoLEngine *vm, OSystem *system);
~Screen_LoL();
- int screenDimTableCount() const { return _screenDimTableCount; }
-
void fprintString(const char *format, int x, int y, uint8 col1, uint8 col2, uint16 flags, ...) GCC_PRINTF(2, 8);
void fprintStringIntro(const char *format, int x, int y, uint8 c1, uint8 c2, uint8 c3, uint16 flags, ...) GCC_PRINTF(2, 9);
@@ -94,11 +91,9 @@ public:
private:
LoLEngine *_vm;
- const ScreenDim *_screenDimTable;
- static const int _screenDimTableCount;
-
static const ScreenDim _screenDimTable256C[];
static const ScreenDim _screenDimTable16C[];
+ static const int _screenDimTableCount;
uint8 *_levelOverlays[8];
diff --git a/engines/kyra/screen_mr.cpp b/engines/kyra/screen_mr.cpp
index d4446c6d91..337860db30 100644
--- a/engines/kyra/screen_mr.cpp
+++ b/engines/kyra/screen_mr.cpp
@@ -25,22 +25,13 @@
namespace Kyra {
-Screen_MR::Screen_MR(KyraEngine_MR *vm, OSystem *system) : Screen(vm, system), Screen_v2(vm, system) {
+Screen_MR::Screen_MR(KyraEngine_MR *vm, OSystem *system)
+ : Screen_v2(vm, system, _screenDimTable, _screenDimTableCount) {
}
Screen_MR::~Screen_MR() {
}
-void Screen_MR::setScreenDim(int dim) {
- assert(dim < _screenDimTableCount);
- _curDim = &_screenDimTable[dim];
-}
-
-const ScreenDim *Screen_MR::getScreenDim(int dim) {
- assert(dim < _screenDimTableCount);
- return &_screenDimTable[dim];
-}
-
int Screen_MR::getLayer(int x, int y) {
if (x < 0)
x = 0;
diff --git a/engines/kyra/screen_mr.h b/engines/kyra/screen_mr.h
index 0cb3240954..e10afcc5d2 100644
--- a/engines/kyra/screen_mr.h
+++ b/engines/kyra/screen_mr.h
@@ -34,10 +34,6 @@ public:
Screen_MR(KyraEngine_MR *vm, OSystem *system);
~Screen_MR();
- void setScreenDim(int dim);
- const ScreenDim *getScreenDim(int dim);
- int screenDimTableCount() const { return _screenDimTableCount; }
-
int getLayer(int x, int y);
byte getShapeFlag1(int x, int y);
diff --git a/engines/kyra/screen_rpg.cpp b/engines/kyra/screen_rpg.cpp
deleted file mode 100644
index 3b29f0adb5..0000000000
--- a/engines/kyra/screen_rpg.cpp
+++ /dev/null
@@ -1,126 +0,0 @@
-/* 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
deleted file mode 100644
index e9b15c25ef..0000000000
--- a/engines/kyra/screen_rpg.h
+++ /dev/null
@@ -1,61 +0,0 @@
-/* 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.cpp b/engines/kyra/screen_v2.cpp
index 57581fa750..c608c6e683 100644
--- a/engines/kyra/screen_v2.cpp
+++ b/engines/kyra/screen_v2.cpp
@@ -26,7 +26,8 @@
namespace Kyra {
-Screen_v2::Screen_v2(KyraEngine_v1 *vm, OSystem *system) : Screen(vm, system), _wsaFrameAnimBuffer(0) {
+Screen_v2::Screen_v2(KyraEngine_v1 *vm, OSystem *system, const ScreenDim *dimTable, const int dimTableSize)
+ : Screen(vm, system, dimTable, dimTableSize), _wsaFrameAnimBuffer(0) {
_wsaFrameAnimBuffer = new uint8[1024];
assert(_wsaFrameAnimBuffer);
}
diff --git a/engines/kyra/screen_v2.h b/engines/kyra/screen_v2.h
index f50c81e912..f84c923128 100644
--- a/engines/kyra/screen_v2.h
+++ b/engines/kyra/screen_v2.h
@@ -28,9 +28,9 @@
namespace Kyra {
-class Screen_v2 : virtual public Screen {
+class Screen_v2 : public Screen {
public:
- Screen_v2(KyraEngine_v1 *vm, OSystem *system);
+ Screen_v2(KyraEngine_v1 *vm, OSystem *system, const ScreenDim *dimTable, const int dimTableSize);
~Screen_v2();
// screen page handling
diff --git a/engines/kyra/text_lol.cpp b/engines/kyra/text_lol.cpp
index 8535516bf9..ee42d6db92 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_rpg()),
+TextDisplayer_LoL::TextDisplayer_LoL(LoLEngine *engine, Screen_LoL *screenLoL) : TextDisplayer_rpg(engine, screenLoL),
_vm(engine), _screen(screenLoL), _scriptTextParameter(0) {
memset(_stringParameters, 0, 15 * sizeof(char *));
@@ -337,7 +337,7 @@ KyraRpgEngine *TextDisplayer_LoL::vm() {
return _vm;
}
-Screen_Rpg *TextDisplayer_LoL::screen() {
+Screen *TextDisplayer_LoL::screen() {
return _screen;
}
diff --git a/engines/kyra/text_lol.h b/engines/kyra/text_lol.h
index a5eebd67c4..e2b10e8d4d 100644
--- a/engines/kyra/text_lol.h
+++ b/engines/kyra/text_lol.h
@@ -50,8 +50,8 @@ public:
int16 _scriptTextParameter;
private:
- KyraRpgEngine *vm();
- Screen_Rpg *screen();
+ virtual KyraRpgEngine *vm();
+ virtual Screen *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 ca1fd04269..78206d3a06 100644
--- a/engines/kyra/text_rpg.cpp
+++ b/engines/kyra/text_rpg.cpp
@@ -24,7 +24,6 @@
#if defined(ENABLE_EOB) || defined(ENABLE_LOL)
#include "kyra/kyra_rpg.h"
-#include "kyra/screen_rpg.h"
#include "kyra/timer.h"
#include "common/system.h"
@@ -35,7 +34,7 @@ enum {
kEoBTextBufferSize = 2048
};
-TextDisplayer_rpg::TextDisplayer_rpg(KyraRpgEngine *engine, Screen_Rpg *scr) : _vm(engine), _screen(scr),
+TextDisplayer_rpg::TextDisplayer_rpg(KyraRpgEngine *engine, Screen *scr) : _vm(engine), _screen(scr),
_lineCount(0), _printFlag(false), _lineWidth(0), _numCharsTotal(0), _allowPageBreak(true),
_numCharsLeft(0), _numCharsPrinted(0), _sjisLineBreakFlag(false), _waitButtonMode(1) {
diff --git a/engines/kyra/text_rpg.h b/engines/kyra/text_rpg.h
index ff3473dc56..8ef8fdd0ca 100644
--- a/engines/kyra/text_rpg.h
+++ b/engines/kyra/text_rpg.h
@@ -29,12 +29,12 @@
namespace Kyra {
-class Screen_Rpg;
+class Screen;
class KyraRpgEngine;
class TextDisplayer_rpg {
public:
- TextDisplayer_rpg(KyraRpgEngine *engine, Screen_Rpg *scr);
+ TextDisplayer_rpg(KyraRpgEngine *engine, Screen *scr);
virtual ~TextDisplayer_rpg();
virtual void setupField(int dim, bool mode);
@@ -57,7 +57,7 @@ public:
protected:
virtual KyraRpgEngine *vm() { return _vm; }
- virtual Screen_Rpg *screen() { return _screen; }
+ virtual Screen *screen() { return _screen; }
void displayText(char *str, ...);
char parseCommand();
@@ -102,7 +102,7 @@ protected:
private:
KyraRpgEngine *_vm;
- Screen_Rpg *_screen;
+ Screen *_screen;
char *_table1;
char *_table2;