aboutsummaryrefslogtreecommitdiff
path: root/engines/avalanche/graphics.cpp
diff options
context:
space:
mode:
authoruruk2014-02-16 15:24:13 +0100
committeruruk2014-02-16 15:24:13 +0100
commit58296158200ae9dd441dbb7f77d8299649c94098 (patch)
tree6f7de92d82167f18a755faa736264f555bf49cfc /engines/avalanche/graphics.cpp
parentf8cea0ebea44c675edc2e45243649f121f362da0 (diff)
downloadscummvm-rg350-58296158200ae9dd441dbb7f77d8299649c94098.tar.gz
scummvm-rg350-58296158200ae9dd441dbb7f77d8299649c94098.tar.bz2
scummvm-rg350-58296158200ae9dd441dbb7f77d8299649c94098.zip
AVALANCHE: Implement ShootEmUp::instructions().
Also implement connected functions and add fundamental parts to ShootEmUp::run() during the process.
Diffstat (limited to 'engines/avalanche/graphics.cpp')
-rw-r--r--engines/avalanche/graphics.cpp54
1 files changed, 46 insertions, 8 deletions
diff --git a/engines/avalanche/graphics.cpp b/engines/avalanche/graphics.cpp
index a1087375b2..672a61d8a2 100644
--- a/engines/avalanche/graphics.cpp
+++ b/engines/avalanche/graphics.cpp
@@ -594,15 +594,8 @@ Graphics::Surface GraphicManager::ghostLoadPicture(Common::File &file, Common::P
coord.y = cb._y;
Graphics::Surface picture = loadPictureGraphic(file);
-
- int bytesPerRow = (picture.w / 8);
- if ((picture.w % 8) > 0)
- bytesPerRow += 1;
- int loadedBytes = picture.h * bytesPerRow * 4 + 4;
- // * 4 is for the four planes, + 4 is for the reading of the width and the height at loadPictureGraphic's beginning.
- int bytesToSkip = cb._size - loadedBytes;
- file.skip(bytesToSkip);
+ skipDifference(cb._size, picture, file);
return picture;
}
@@ -730,6 +723,51 @@ void GraphicManager::seuDrawTitle() {
file.close();
}
+void GraphicManager::seuLoad() {
+ Common::File file;
+
+ if (!file.open("notts.avd"))
+ error("AVALANCHE: ShootEmUp: File not found: notts.avd");
+
+ for (int i = 0; i < 99; i++) {
+ int size = file.readUint16LE();
+ _seuPictures[i] = loadPictureGraphic(file);
+ skipDifference(size, _seuPictures[i], file);
+ }
+
+ file.close();
+}
+
+void GraphicManager::seuFree() {
+ for (int i = 0; i < 99; i++)
+ _seuPictures[i].free();
+}
+
+/**
+ * @remarks Originally called 'display'
+ */
+void GraphicManager::seuDrawPicture(int x, int y, byte which) {
+ drawPicture(_surface, _seuPictures[which], x, y);
+}
+
+/**
+ * This function is for skipping the difference between a stored 'size' value associated with a picture
+ * and the actual size of the pictures when reading them from files for Ghostroom and Shoot em' up.
+ * It's needed bacuse the original code loaded the pictures to arrays first and only used the useful parts
+ * of these arrays when drawing the images, but in the ScummVM version, we only read the
+ * useful parts from the files, so we have to skip these differences between readings.
+ */
+void GraphicManager::skipDifference(int size, const Graphics::Surface &picture, Common::File &file) {
+ int bytesPerRow = (picture.w / 8);
+ if ((picture.w % 8) > 0)
+ bytesPerRow += 1;
+ int loadedBytes = picture.h * bytesPerRow * 4 + 4;
+ // * 4 is for the four planes, + 4 is for the reading of the width and the height at loadPictureGraphic's beginning.
+
+ int bytesToSkip = size - loadedBytes;
+ file.skip(bytesToSkip);
+}
+
/**
* This function mimics Pascal's getimage().
*/