aboutsummaryrefslogtreecommitdiff
path: root/engines/drascula
diff options
context:
space:
mode:
authorFilippos Karapetis2009-08-04 17:22:18 +0000
committerFilippos Karapetis2009-08-04 17:22:18 +0000
commitd14f0ccfb51d44e36a8508be7e7795306b785ed8 (patch)
treeda21ed160b3484914f3fe4ab08a3bc9df9d7896a /engines/drascula
parent7b4d3c1289085812cbcacbb6868dc8cca9bf6140 (diff)
downloadscummvm-rg350-d14f0ccfb51d44e36a8508be7e7795306b785ed8.tar.gz
scummvm-rg350-d14f0ccfb51d44e36a8508be7e7795306b785ed8.tar.bz2
scummvm-rg350-d14f0ccfb51d44e36a8508be7e7795306b785ed8.zip
Removed the superfluous VGA buffer, replacing it with direct writes to the video buffer
svn-id: r43048
Diffstat (limited to 'engines/drascula')
-rw-r--r--engines/drascula/drascula.cpp5
-rw-r--r--engines/drascula/drascula.h2
-rw-r--r--engines/drascula/graphics.cpp39
-rw-r--r--engines/drascula/rooms.cpp1
4 files changed, 25 insertions, 22 deletions
diff --git a/engines/drascula/drascula.cpp b/engines/drascula/drascula.cpp
index 84c2dd8073..46524b03db 100644
--- a/engines/drascula/drascula.cpp
+++ b/engines/drascula/drascula.cpp
@@ -182,10 +182,6 @@ Common::Error DrasculaEngine::run() {
for (;;) {
int i;
-
- VGA = (byte *)malloc(320 * 200);
- memset(VGA, 0, 64000);
-
takeObject = 0;
_menuBar = false;
_menuScreen = false;
@@ -296,7 +292,6 @@ void DrasculaEngine::endChapter() {
MusicFadeout();
stopMusic();
freeMemory();
- free(VGA);
}
bool DrasculaEngine::runCurrentChapter() {
diff --git a/engines/drascula/drascula.h b/engines/drascula/drascula.h
index 1e87690bea..85f31ea2d1 100644
--- a/engines/drascula/drascula.h
+++ b/engines/drascula/drascula.h
@@ -344,7 +344,6 @@ public:
byte *mouseCursor;
// Graphics buffers/pointers
- byte *VGA;
byte *bgSurface;
byte *backSurface;
byte *drawSurface3;
@@ -353,7 +352,6 @@ public:
byte *extraSurface; // not sure about this one, was "dir_hare_dch"
byte *screenSurface;
byte *frontSurface;
- byte *textSurface;
byte *memPtr;
byte *mSession;
diff --git a/engines/drascula/graphics.cpp b/engines/drascula/graphics.cpp
index 7f1efa5d83..e6c5f69235 100644
--- a/engines/drascula/graphics.cpp
+++ b/engines/drascula/graphics.cpp
@@ -24,6 +24,7 @@
*/
#include "drascula/drascula.h"
+#include "graphics/surface.h"
namespace Drascula {
@@ -126,16 +127,18 @@ void DrasculaEngine::showFrame(bool firstFrame) {
}
byte *prevFrame = (byte *)malloc(64000);
- memcpy(prevFrame, VGA, 64000);
+ byte *screenBuffer = (byte *)_system->lockScreen()->pixels;
+ memcpy(prevFrame, screenBuffer, 64000);
- decodeRLE(pcxData, VGA);
+ decodeRLE(pcxData, screenBuffer);
free(pcxData);
if (!firstFrame)
- mixVideo(VGA, prevFrame);
+ mixVideo(screenBuffer, prevFrame);
- _system->copyRectToScreen((const byte *)VGA, 320, 0, 0, 320, 200);
+ _system->unlockScreen();
_system->updateScreen();
+
if (firstFrame)
setPalette(cPal);
@@ -192,8 +195,9 @@ void DrasculaEngine::copyRect(int xorg, int yorg, int xdes, int ydes, int width,
}
void DrasculaEngine::updateScreen(int xorg, int yorg, int xdes, int ydes, int width, int height, byte *buffer) {
- copyBackground(xorg, yorg, xdes, ydes, width, height, buffer, VGA);
- _system->copyRectToScreen((const byte *)VGA, 320, 0, 0, 320, 200);
+ byte *screenBuffer = (byte *)_system->lockScreen()->pixels;
+ copyBackground(xorg, yorg, xdes, ydes, width, height, buffer, screenBuffer);
+ _system->unlockScreen();
_system->updateScreen();
}
@@ -421,6 +425,7 @@ void DrasculaEngine::screenSaver() {
int x1_, y1_, off1, off2;
+ byte *screenBuffer = (byte *)_system->lockScreen()->pixels;
for (int i = 0; i < 200; i++) {
for (int j = 0; j < 320; j++) {
x1_ = j + tempRow[i];
@@ -438,10 +443,11 @@ void DrasculaEngine::screenSaver() {
y1_ = checkWrapY(y1_);
off2 = 320 * y1_ + x1_;
- VGA[320 * i + j] = ghost[bgSurface[off2] + (copia[off1] << 8)];
+ screenBuffer[320 * i + j] = ghost[bgSurface[off2] + (copia[off1] << 8)];
}
}
- _system->copyRectToScreen((const byte *)VGA, 320, 0, 0, 320, 200);
+
+ _system->unlockScreen();
_system->updateScreen();
_system->delayMillis(20);
@@ -534,11 +540,14 @@ int DrasculaEngine::playFrameSSN() {
decodeRLE(BufferSSN, screenSurface);
free(BufferSSN);
waitFrameSSN();
+
+ byte *screenBuffer = (byte *)_system->lockScreen()->pixels;
if (FrameSSN)
- mixVideo(VGA, screenSurface);
+ mixVideo(screenBuffer, screenSurface);
else
- memcpy(VGA, screenSurface, 64000);
- _system->copyRectToScreen((const byte *)VGA, 320, 0, 0, 320, 200);
+ memcpy(screenBuffer, screenSurface, 64000);
+
+ _system->unlockScreen();
_system->updateScreen();
FrameSSN++;
} else {
@@ -553,11 +562,13 @@ int DrasculaEngine::playFrameSSN() {
decodeOffset(BufferSSN, screenSurface, length);
free(BufferSSN);
waitFrameSSN();
+ byte *screenBuffer = (byte *)_system->lockScreen()->pixels;
if (FrameSSN)
- mixVideo(VGA, screenSurface);
+ mixVideo(screenBuffer, screenSurface);
else
- memcpy(VGA, screenSurface, 64000);
- _system->copyRectToScreen((const byte *)VGA, 320, 0, 0, 320, 200);
+ memcpy(screenBuffer, screenSurface, 64000);
+
+ _system->unlockScreen();
_system->updateScreen();
FrameSSN++;
}
diff --git a/engines/drascula/rooms.cpp b/engines/drascula/rooms.cpp
index 8284112c1e..560f516a84 100644
--- a/engines/drascula/rooms.cpp
+++ b/engines/drascula/rooms.cpp
@@ -1866,7 +1866,6 @@ void DrasculaEngine::enterRoom(int roomIndex) {
}
void DrasculaEngine::clearRoom() {
- memset(VGA, 0, 64000);
_system->fillScreen(0);
_system->updateScreen();
}