aboutsummaryrefslogtreecommitdiff
path: root/engines
diff options
context:
space:
mode:
authorNicola Mettifogo2008-01-28 20:40:05 +0000
committerNicola Mettifogo2008-01-28 20:40:05 +0000
commit1a36ba488c336d1b52636b9a9a96bd31e28fc843 (patch)
tree4ade968df6a450b8740c94e8edd9e34dbfc00f87 /engines
parent8e4f5b6f82bf6e2cff76a45b22229d4f206ef3a5 (diff)
downloadscummvm-rg350-1a36ba488c336d1b52636b9a9a96bd31e28fc843.tar.gz
scummvm-rg350-1a36ba488c336d1b52636b9a9a96bd31e28fc843.tar.bz2
scummvm-rg350-1a36ba488c336d1b52636b9a9a96bd31e28fc843.zip
Cleanup (step 1).
svn-id: r30689
Diffstat (limited to 'engines')
-rw-r--r--engines/parallaction/callables_ns.cpp2
-rw-r--r--engines/parallaction/graphics.cpp85
-rw-r--r--engines/parallaction/graphics.h15
-rw-r--r--engines/parallaction/gui_ns.cpp6
-rw-r--r--engines/parallaction/parallaction.cpp4
5 files changed, 21 insertions, 91 deletions
diff --git a/engines/parallaction/callables_ns.cpp b/engines/parallaction/callables_ns.cpp
index 9708f1581c..a493a41a29 100644
--- a/engines/parallaction/callables_ns.cpp
+++ b/engines/parallaction/callables_ns.cpp
@@ -428,7 +428,7 @@ void Parallaction_ns::_c_ridux(void *parm) {
}
void Parallaction_ns::_c_testResult(void *parm) {
- _gfx->swapBuffers();
+ _gfx->updateScreen();
_disk->selectArchive("disk1");
parseLocation("common");
diff --git a/engines/parallaction/graphics.cpp b/engines/parallaction/graphics.cpp
index 5cc8ce6b98..fcdf752168 100644
--- a/engines/parallaction/graphics.cpp
+++ b/engines/parallaction/graphics.cpp
@@ -379,11 +379,6 @@ void Gfx::updateScreen() {
}
-void Gfx::swapBuffers() {
- updateScreen();
- return;
-}
-
//
// graphic primitives
@@ -393,17 +388,13 @@ void Gfx::clearScreen(Gfx::Buffers buffer) {
}
-void Gfx::copyScreen(Gfx::Buffers srcbuffer, Gfx::Buffers dstbuffer) {
- memcpy(_buffers[dstbuffer]->pixels, _buffers[srcbuffer]->pixels, _vm->_screenSize);
-}
-
void Gfx::patchBackground(Graphics::Surface &surf, int16 x, int16 y, bool mask) {
if (mask) {
uint16 z = queryMask(y);
- blitCnv(&surf, x, y, z, kBit2);
+ blitCnv(&surf, x, y, z);
} else {
- flatBlitCnv(&surf, x, y, kBit2);
+ flatBlitCnv(&surf, x, y);
}
}
@@ -682,58 +673,20 @@ void Label::resetPosition() {
}
-//
-// Cnv management
-//
-void Gfx::flatBlitCnv(Frames *cnv, uint16 frame, int16 x, int16 y, Gfx::Buffers buffer) {
-
- Graphics::Surface scnv;
- Common::Rect r;
-
- cnv->getRect(frame, r);
-
- scnv.w = r.width();
- scnv.h = r.height();
- scnv.pixels = cnv->getData(frame);
-
- flatBlitCnv(&scnv, x, y, buffer);
-}
-void Gfx::flatBlitCnv(Graphics::Surface *cnv, int16 x, int16 y, Gfx::Buffers buffer) {
+void Gfx::flatBlitCnv(Graphics::Surface *cnv, int16 x, int16 y) {
Common::Rect r(cnv->w, cnv->h);
r.moveTo(x, y);
- blt(r, (byte*)cnv->pixels, _buffers[buffer], BUFFER_FOREGROUND, 0);
+ blt(r, (byte*)cnv->pixels, _buffers[kBit2], BUFFER_FOREGROUND, 0);
}
-void Gfx::blitCnv(Graphics::Surface *cnv, int16 x, int16 y, uint16 z, Gfx::Buffers buffer) {
+void Gfx::blitCnv(Graphics::Surface *cnv, int16 x, int16 y, uint16 z) {
Common::Rect r(cnv->w, cnv->h);
r.moveTo(x, y);
- blt(r, (byte*)cnv->pixels, _buffers[buffer], z, 0);
-}
-
-void Gfx::backupDoorBackground(DoorData *data, int16 x, int16 y) {
-}
-
-void Gfx::backupGetBackground(GetData *data, int16 x, int16 y) {
-
-}
-
-//
-// restores background according to specified frame
-//
-void Gfx::restoreDoorBackground(const Common::Rect& r, byte *data, byte* background) {
-
-}
-
-
-//
-// copies a rectangular bitmap on the background
-//
-void Gfx::restoreGetBackground(const Common::Rect& r, byte *data) {
-
+ blt(r, (byte*)cnv->pixels, _buffers[kBit2], z, 0);
}
@@ -790,7 +743,8 @@ void Gfx::setFont(Font *font) {
void Gfx::setBackground(Graphics::Surface *surface) {
_buffers[kBit2] = surface;
- initBuffers(surface->w, surface->h);
+ _backgroundWidth = surface->w;
+ _backgroundHeight = surface->h;
}
void Gfx::setMask(MaskBuffer *buffer) {
@@ -809,13 +763,6 @@ void Gfx::copyRect(uint width, uint height, byte *dst, uint dstPitch, byte *src,
return;
}
-void Gfx::copyRect(Gfx::Buffers dstbuffer, const Common::Rect& r, byte *src, uint16 pitch) {
- byte *d = (byte*)_buffers[dstbuffer]->getBasePtr(r.left, r.top);
- copyRect(r.width(), r.height(), d, _backgroundWidth, src, pitch);
- return;
-}
-
-
void Gfx::grabRect(byte *dst, const Common::Rect& r, Gfx::Buffers srcbuffer, uint16 pitch) {
byte *s = (byte*)_buffers[srcbuffer]->getBasePtr(r.left, r.top);
copyRect(r.width(), r.height(), dst, pitch, s, _backgroundWidth);
@@ -843,7 +790,9 @@ Gfx::Gfx(Parallaction* vm) :
_buffers[kBit2] = 0;
_depthMask = 0;
- initBuffers(_vm->_screenWidth, _vm->_screenHeight);
+ // FIXME: screen size must be decoupled from background size
+ _backgroundWidth = _vm->_screenWidth;
+ _backgroundHeight = _vm->_screenHeight;
setPalette(_palette);
@@ -870,24 +819,12 @@ Gfx::Gfx(Parallaction* vm) :
Gfx::~Gfx() {
- freeBuffers();
-
freeBackground();
delete _backgroundInfo;
return;
}
-void Gfx::initBuffers(int w, int h) {
-
- _backgroundWidth = w;
- _backgroundHeight = h;
-
-}
-
-void Gfx::freeBuffers() {
-
-}
int Gfx::setItem(Frames* frames, uint16 x, uint16 y) {
diff --git a/engines/parallaction/graphics.h b/engines/parallaction/graphics.h
index a898fd7840..eb8108544c 100644
--- a/engines/parallaction/graphics.h
+++ b/engines/parallaction/graphics.h
@@ -384,14 +384,6 @@ public:
// cut/paste
void patchBackground(Graphics::Surface &surf, int16 x, int16 y, bool mask = false);
- void flatBlitCnv(Graphics::Surface *cnv, int16 x, int16 y, Gfx::Buffers buffer);
- void flatBlitCnv(Frames *cnv, uint16 frame, int16 x, int16 y, Gfx::Buffers buffer);
- void blitCnv(Graphics::Surface *cnv, int16 x, int16 y, uint16 z, Gfx::Buffers buffer);
- void restoreBackground(const Common::Rect& r);
- void backupDoorBackground(DoorData *data, int16 x, int16 y);
- void restoreDoorBackground(const Common::Rect& r, byte *data, byte* background);
- void backupGetBackground(GetData *data, int16 x, int16 y);
- void restoreGetBackground(const Common::Rect& r, byte *data);
int setLocationBalloon(char *text, bool endGame);
int setDialogueBalloon(char *text, uint16 winding, byte textColor);
@@ -407,8 +399,6 @@ public:
// low level surfaces
void clearScreen(Gfx::Buffers buffer);
- void copyScreen(Gfx::Buffers srcbuffer, Gfx::Buffers dstbuffer);
- void copyRect(Gfx::Buffers dstbuffer, const Common::Rect& r, byte *src, uint16 pitch);
void grabRect(byte *dst, const Common::Rect& r, Gfx::Buffers srcbuffer, uint16 pitch);
void floodFill(Gfx::Buffers buffer, const Common::Rect& r, byte color);
void invertRect(Gfx::Buffers buffer, const Common::Rect& r);
@@ -424,7 +414,6 @@ public:
// misc
uint16 queryMask(uint16 v);
- void swapBuffers();
void updateScreen();
void setBackground(Graphics::Surface *surf);
void setMask(MaskBuffer *buffer);
@@ -505,6 +494,10 @@ protected:
void drawText(Graphics::Surface* surf, uint16 x, uint16 y, const char *text, byte color);
bool drawWrappedText(Graphics::Surface* surf, char *text, byte color, int16 wrapwidth);
+
+ void flatBlitCnv(Graphics::Surface *cnv, int16 x, int16 y);
+ void blitCnv(Graphics::Surface *cnv, int16 x, int16 y, uint16 z);
+
void blt(const Common::Rect& r, byte *data, Graphics::Surface *surf, uint16 z, byte transparentColor);
};
diff --git a/engines/parallaction/gui_ns.cpp b/engines/parallaction/gui_ns.cpp
index 625cc8b8ab..8bdc71514c 100644
--- a/engines/parallaction/gui_ns.cpp
+++ b/engines/parallaction/gui_ns.cpp
@@ -194,7 +194,7 @@ int Parallaction_ns::guiNewGame() {
setBackground("test", NULL, NULL);
- _gfx->swapBuffers();
+ _gfx->updateScreen();
uint id[4];
id[0] = _gfx->createLabel(_menuFont, v14[0], 1);
@@ -427,7 +427,7 @@ int Parallaction_ns::guiSelectCharacter() {
if (_si != -1) {
_gfx->grabRect((byte*)block.pixels, codeTrueBlocks[_si], Gfx::kBit2, BLOCK_WIDTH);
- _gfx->flatBlitCnv(&block, _di * SLOT_WIDTH + SLOT_X, SLOT_Y, Gfx::kBit2);
+ _gfx->patchBackground(block, _di * SLOT_WIDTH + SLOT_X, SLOT_Y, false);
if (keys[0][_di] == _si) {
points[0]++;
@@ -455,7 +455,7 @@ int Parallaction_ns::guiSelectCharacter() {
break;
}
- _gfx->flatBlitCnv(&v14, SLOT_X, SLOT_Y, Gfx::kBit2);
+ _gfx->patchBackground(v14, SLOT_X, SLOT_Y, false);
_gfx->hideLabel(id[0]);
_gfx->showLabel(id[1], 60, 30);
diff --git a/engines/parallaction/parallaction.cpp b/engines/parallaction/parallaction.cpp
index 5f5414032d..8ac5fd6ff6 100644
--- a/engines/parallaction/parallaction.cpp
+++ b/engines/parallaction/parallaction.cpp
@@ -302,7 +302,7 @@ void Parallaction::updateView() {
}
_gfx->animatePalette();
- _gfx->swapBuffers();
+ _gfx->updateScreen();
g_system->delayMillis(30);
}
@@ -784,7 +784,7 @@ void Parallaction::doLocationEnterTransition() {
runScripts();
drawAnimations();
- _gfx->swapBuffers();
+ _gfx->updateScreen();
showLocationComment(_location._comment, false);
waitUntilLeftClick();