From 3ced58e189a58140fc8c4985a25c98fab4160d7b Mon Sep 17 00:00:00 2001 From: Eugene Sandulenko Date: Sat, 7 Nov 2015 22:35:10 +0100 Subject: ENGINES: Add ScummVM splash --- dists/scummvm_logo.bmp | Bin 0 -> 13556 bytes engines/engine.cpp | 48 +++ engines/logo_data.h | 930 +++++++++++++++++++++++++++++++++++++++++++++++++ 3 files changed, 978 insertions(+) create mode 100644 dists/scummvm_logo.bmp create mode 100644 engines/logo_data.h diff --git a/dists/scummvm_logo.bmp b/dists/scummvm_logo.bmp new file mode 100644 index 0000000000..d924222588 Binary files /dev/null and b/dists/scummvm_logo.bmp differ diff --git a/engines/engine.cpp b/engines/engine.cpp index 24008dd073..1956322fc7 100644 --- a/engines/engine.cpp +++ b/engines/engine.cpp @@ -41,6 +41,7 @@ #include "common/error.h" #include "common/list.h" #include "common/list_intern.h" +#include "common/memstream.h" #include "common/scummsys.h" #include "common/taskbar.h" #include "common/textconsole.h" @@ -57,6 +58,7 @@ #include "graphics/cursorman.h" #include "graphics/pixelformat.h" +#include "image/bmp.h" #ifdef _WIN32_WCE extern bool isSmartphone(); @@ -240,6 +242,49 @@ void initCommonGFX(bool defaultTo1XScaler) { g_system->setFeatureState(OSystem::kFeatureFullscreenMode, ConfMan.getBool("fullscreen")); } +// Please leave the splashscreen in wokring order for your releases, even if they're commercial. +// This is a proper and good way to show your appreciation for our hard work over these years. +bool splash = false; + +#include "logo_data.h" + +void splashScreen() { + Common::MemoryReadStream stream(logo_data, ARRAYSIZE(logo_data)); + + Image::BitmapDecoder bitmap; + + if (!bitmap.loadStream(stream)) { + warning("Error loading logo file"); + return; + } + + g_system->showOverlay(); + + // Fill with white + Graphics::Surface screen; + screen.create(g_system->getOverlayWidth(), g_system->getOverlayHeight(), g_system->getOverlayFormat()); + screen.fillRect(Common::Rect(screen.w, screen.h), screen.format.ARGBToColor(0xff, 0xff, 0xff, 0xff)); + g_system->copyRectToOverlay(screen.getPixels(), screen.pitch, 0, 0, screen.w, screen.h); + + // Draw logo + Graphics::Surface *logo = bitmap.getSurface()->convertTo(g_system->getOverlayFormat(), bitmap.getPalette()); + int x = (g_system->getOverlayWidth() - logo->w) / 2; + int y = (g_system->getOverlayHeight() - logo->h) / 2; + g_system->copyRectToOverlay(logo->getPixels(), logo->pitch, x, y, logo->w, logo->h); + + // Delay 0.6 secs + uint time0 = g_system->getMillis(); + Common::Event event; + while (time0 + 600 > g_system->getMillis()) { + g_system->updateScreen(); + g_system->getEventManager()->pollEvent(event); + g_system->delayMillis(10); + } + g_system->hideOverlay(); + + splash = true; +} + void initGraphics(int width, int height, bool defaultTo1xScaler, const Graphics::PixelFormat *format) { g_system->beginGFXTransaction(); @@ -258,6 +303,9 @@ void initGraphics(int width, int height, bool defaultTo1xScaler, const Graphics: OSystem::TransactionError gfxError = g_system->endGFXTransaction(); + if (!splash) + splashScreen(); + if (gfxError == OSystem::kTransactionSuccess) return; diff --git a/engines/logo_data.h b/engines/logo_data.h new file mode 100644 index 0000000000..84858bc770 --- /dev/null +++ b/engines/logo_data.h @@ -0,0 +1,930 @@ +/* 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. + * + */ + +// recode ../d1 logo_data.h + +byte logo_data[] = { + 66, 77, 244, 52, 0, 0, 0, 0, 0, 0, 54, 4, 0, 0, 40, + 0, 0, 0, 44, 1, 0, 0, 82, 0, 0, 0, 1, 0, 8, 0, + 1, 0, 0, 0, 190, 48, 0, 0, 193, 3, 0, 0, 193, 3, 0, + 0, 0, 1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 0, 2, 6, + 3, 0, 6, 10, 7, 0, 0, 11, 12, 0, 4, 17, 10, 0, 12, + 16, 14, 0, 5, 16, 17, 0, 2, 20, 17, 0, 17, 19, 18, 0, + 20, 23, 21, 0, 2, 26, 21, 0, 9, 25, 22, 0, 24, 27, 25, + 0, 3, 31, 25, 0, 27, 29, 28, 0, 0, 34, 26, 0, 14, 33, + 28, 0, 30, 32, 31, 0, 9, 39, 32, 0, 33, 36, 34, 0, 20, + 37, 36, 0, 6, 43, 35, 0, 37, 40, 38, 0, 4, 48, 37, 0, + 41, 43, 42, 0, 44, 46, 45, 0, 32, 51, 44, 0, 4, 55, 42, + 0, 25, 53, 47, 0, 49, 51, 50, 0, 16, 56, 46, 0, 3, 60, + 50, 0, 3, 63, 46, 0, 55, 57, 56, 0, 40, 60, 52, 0, 4, + 70, 53, 0, 60, 63, 61, 0, 14, 70, 56, 0, 6, 70, 60, 0, + 21, 70, 58, 0, 29, 69, 59, 0, 64, 67, 65, 0, 7, 79, 61, + 0, 68, 71, 69, 0, 72, 75, 73, 0, 13, 85, 64, 0, 4, 87, + 66, 0, 14, 85, 71, 0, 76, 79, 77, 0, 80, 83, 81, 0, 36, + 89, 78, 0, 1, 95, 70, 0, 83, 86, 84, 0, 86, 89, 87, 0, + 8, 102, 79, 0, 29, 101, 82, 0, 3, 107, 72, 0, 2, 109, 66, + 0, 90, 93, 91, 0, 6, 108, 78, 0, 0, 113, 72, 0, 95, 97, + 96, 0, 0, 113, 80, 0, 0, 117, 69, 0, 0, 117, 76, 0, 98, +101, 99, 0, 4, 121, 73, 0, 56, 109, 96, 0, 4, 120, 79, 0, + 41, 112, 94, 0, 3, 119, 86, 0, 102, 105, 103, 0, 0, 124, 77, + 0, 0, 123, 83, 0, 105, 107, 106, 0, 107, 110, 108, 0, 31, 120, +101, 0, 1, 129, 82, 0, 62, 118, 102, 0, 3, 132, 77, 0, 2, +129, 89, 0, 109, 112, 110, 0, 0, 133, 80, 0, 7, 128, 97, 0, +113, 116, 114, 0, 0, 137, 83, 0, 0, 137, 92, 0, 0, 136, 98, + 0, 117, 119, 118, 0, 2, 141, 88, 0, 3, 136, 105, 0, 18, 135, +105, 0, 31, 134, 107, 0, 6, 144, 84, 0, 6, 143, 90, 0, 120, +123, 121, 0, 0, 144, 100, 0, 0, 146, 94, 0, 0, 148, 89, 0, + 0, 144, 106, 0, 125, 128, 126, 0, 3, 153, 94, 0, 5, 152, 101, + 0, 54, 142, 119, 0, 2, 151, 109, 0, 129, 132, 130, 0, 0, 157, +100, 0, 4, 151, 122, 0, 0, 156, 107, 0, 133, 136, 134, 0, 73, +145, 128, 0, 0, 162, 97, 0, 0, 161, 104, 0, 47, 152, 123, 0, + 0, 163, 107, 0, 138, 141, 140, 0, 7, 166, 101, 0, 7, 165, 108, + 0, 0, 168, 105, 0, 36, 159, 128, 0, 0, 166, 118, 0, 142, 145, +143, 0, 0, 169, 113, 0, 0, 172, 108, 0, 25, 167, 131, 0, 147, +150, 148, 0, 6, 176, 112, 0, 10, 175, 119, 0, 10, 172, 131, 0, + 0, 178, 116, 0, 0, 176, 124, 0, 14, 179, 116, 0, 153, 156, 154, + 0, 0, 182, 120, 0, 72, 169, 141, 0, 0, 181, 129, 0, 1, 186, +116, 0, 22, 183, 120, 0, 87, 170, 147, 0, 24, 183, 127, 0, 6, +186, 124, 0, 159, 162, 160, 0, 44, 180, 144, 0, 0, 191, 123, 0, + 0, 193, 117, 0, 0, 190, 130, 0, 42, 186, 131, 0, 16, 190, 128, + 0, 66, 179, 149, 0, 32, 189, 127, 0, 30, 189, 135, 0, 44, 186, +144, 0, 165, 168, 166, 0, 0, 196, 128, 0, 2, 198, 122, 0, 36, +188, 147, 0, 6, 196, 136, 0, 25, 194, 141, 0, 41, 195, 140, 0, +170, 174, 172, 0, 51, 195, 142, 0, 0, 204, 130, 0, 31, 199, 138, + 0, 43, 194, 151, 0, 0, 203, 136, 0, 0, 207, 125, 0, 0, 202, +143, 0, 33, 195, 156, 0, 62, 196, 146, 0, 100, 187, 164, 0, 20, +202, 142, 0, 0, 202, 151, 0, 176, 179, 177, 0, 4, 211, 129, 0, + 72, 198, 150, 0, 33, 202, 150, 0, 5, 210, 135, 0, 74, 195, 165, + 0, 0, 214, 133, 0, 12, 210, 144, 0, 14, 209, 150, 0, 69, 200, +164, 0, 0, 214, 141, 0, 180, 184, 182, 0, 84, 199, 167, 0, 33, +210, 150, 0, 87, 202, 160, 0, 98, 198, 170, 0, 0, 214, 150, 0, + 68, 205, 159, 0, 0, 219, 138, 0, 37, 210, 159, 0, 0, 218, 145, + 0, 57, 208, 160, 0, 48, 210, 158, 0, 25, 212, 161, 0, 26, 216, +150, 0, 186, 189, 187, 0, 7, 224, 135, 0, 27, 216, 157, 0, 10, +223, 143, 0, 0, 228, 141, 0, 191, 194, 192, 0, 0, 227, 148, 0, + 35, 220, 162, 0, 95, 211, 175, 0, 36, 223, 157, 0, 20, 226, 153, + 0, 18, 224, 161, 0, 22, 228, 148, 0, 90, 213, 178, 0, 195, 198, +196, 0, 0, 231, 152, 0, 56, 220, 172, 0, 107, 214, 178, 0, 29, +231, 151, 0, 42, 223, 175, 0, 94, 218, 181, 0, 199, 202, 200, 0, + 32, 232, 160, 0, 122, 215, 188, 0, 47, 233, 159, 0, 202, 206, 204, + 0, 36, 234, 171, 0, 85, 225, 186, 0, 50, 234, 168, 0, 113, 221, +192, 0, 62, 233, 174, 0, 62, 235, 168, 0, 206, 209, 207, 0, 55, +236, 178, 0, 74, 236, 174, 0, 210, 213, 211, 0, 84, 238, 175, 0, + 85, 235, 188, 0, 85, 237, 182, 0, 75, 237, 186, 0, 213, 216, 214, + 0, 95, 239, 187, 0, 104, 239, 188, 0, 216, 220, 218, 0, 113, 240, +193, 0, 104, 240, 198, 0, 220, 223, 221, 0, 122, 242, 195, 0, 126, +240, 209, 0, 223, 226, 224, 0, 126, 243, 203, 0, 118, 244, 207, 0, +226, 229, 227, 0, 230, 233, 231, 0, 233, 236, 234, 0, 235, 238, 236, + 0, 241, 245, 242, 0, 248, 252, 250, 0, 252, 255, 254, 0, 255, 255, + 24, 255, 0, 13, 250, 229, 172, 132, 100, 65, 44, 25, 9, 0, 9, + 52, 218, 0, 8, 255, 0, 0, 255, 255, 20, 255, 0, 4, 240, 75, + 24, 1, 12, 0, 1, 1, 1, 105, 7, 255, 0, 0, 255, 255, 19, +255, 1, 141, 1, 2, 17, 0, 1, 141, 6, 255, 0, 0, 250, 255, + 0, 12, 253, 197, 125, 100, 61, 43, 24, 8, 14, 33, 115, 252, 11, +255, 1, 183, 1, 1, 18, 0, 1, 8, 1, 254, 5, 255, 0, 0, +204, 255, 0, 3, 246, 240, 253, 0, 41, 255, 0, 3, 253, 88, 2, + 0, 10, 0, 1, 12, 1, 197, 9, 255, 1, 254, 1, 19, 10, 0, + 0, 6, 1, 5, 9, 12, 14, 5, 4, 0, 1, 183, 5, 255, 0, + 0, 202, 255, 0, 10, 172, 22, 0, 0, 1, 22, 53, 109, 183, 250, + 17, 255, 0, 5, 254, 249, 229, 222, 252, 0, 13, 255, 1, 250, 1, + 22, 13, 0, 1, 1, 1, 211, 8, 255, 1, 211, 4, 0, 0, 7, + 2, 14, 14, 19, 22, 19, 9, 0, 5, 33, 1, 25, 4, 0, 1, +109, 5, 255, 0, 0, 201, 255, 1, 152, 1, 1, 9, 0, 0, 4, + 12, 44, 109, 246, 5, 255, 0, 8, 253, 159, 105, 75, 52, 36, 22, + 8, 5, 0, 1, 36, 1, 211, 10, 255, 1, 254, 1, 29, 15, 0, + 1, 12, 1, 253, 7, 255, 1, 132, 4, 0, 1, 25, 4, 36, 1, + 29, 1, 8, 5, 36, 1, 33, 1, 1, 3, 0, 1, 81, 5, 255, + 0, 0, 78, 255, 0, 8, 240, 172, 121, 95, 109, 109, 172, 251, 3, +255, 0, 12, 254, 211, 152, 125, 115, 109, 100, 115, 132, 159, 197, 243, + 22, 255, 0, 7, 253, 246, 240, 222, 222, 240, 250, 0, 70, 255, 1, +250, 1, 5, 13, 0, 1, 2, 1, 132, 3, 255, 1, 109, 1, 5, + 13, 0, 1, 1, 1, 132, 9, 255, 1, 141, 7, 0, 0, 6, 1, + 5, 12, 14, 14, 1, 4, 0, 1, 84, 7, 255, 1, 125, 4, 0, + 1, 29, 4, 36, 1, 33, 1, 5, 6, 36, 1, 2, 3, 0, 1, + 53, 5, 255, 0, 0, 13, 255, 0, 14, 250, 152, 88, 43, 24, 9, + 0, 5, 5, 17, 43, 71, 115, 229, 21, 255, 0, 4, 252, 211, 141, + 95, 3, 65, 0, 4, 81, 121, 172, 243, 16, 255, 0, 3, 222, 71, + 17, 0, 7, 0, 0, 5, 1, 22, 44, 29, 1, 0, 11, 0, 0, + 6, 24, 115, 218, 211, 152, 121, 4, 109, 0, 12, 125, 141, 152, 211, +253, 255, 255, 240, 109, 41, 19, 1, 7, 0, 0, 3, 8, 53, 211, + 0, 6, 255, 0, 29, 253, 211, 125, 95, 65, 84, 159, 253, 255, 255, +237, 141, 115, 109, 100, 88, 95, 109, 125, 152, 183, 251, 255, 255, 246, +105, 43, 24, 9, 0, 3, 5, 4, 0, 0, 4, 5, 33, 121, 253, + 5, 255, 0, 8, 246, 197, 132, 95, 71, 71, 109, 232, 8, 255, 1, + 58, 15, 0, 0, 4, 1, 197, 255, 71, 16, 0, 1, 1, 1, 218, + 8, 255, 1, 33, 4, 0, 0, 3, 17, 29, 33, 0, 5, 36, 1, + 29, 1, 1, 3, 0, 1, 1, 1, 240, 6, 255, 1, 152, 4, 0, + 1, 29, 5, 36, 1, 5, 6, 36, 1, 9, 3, 0, 1, 41, 5, +255, 0, 0, 10, 255, 0, 4, 253, 121, 36, 1, 13, 0, 0, 3, + 14, 71, 218, 0, 15, 255, 0, 4, 222, 100, 33, 1, 10, 0, 0, + 3, 24, 88, 222, 0, 11, 255, 1, 202, 1, 33, 40, 0, 0, 3, + 1, 19, 17, 0, 15, 0, 0, 6, 29, 84, 109, 84, 48, 17, 7, + 0, 0, 3, 2, 25, 5, 0, 11, 0, 0, 4, 1, 14, 24, 1, + 14, 0, 0, 6, 14, 75, 109, 74, 41, 8, 7, 0, 0, 3, 1, +100, 254, 0, 5, 255, 1, 211, 1, 1, 4, 0, 0, 4, 9, 12, + 9, 1, 8, 0, 1, 44, 1, 172, 18, 0, 1, 43, 7, 255, 1, +250, 1, 1, 3, 0, 1, 14, 9, 41, 1, 19, 4, 0, 1, 48, + 6, 255, 1, 197, 4, 0, 1, 25, 5, 41, 1, 5, 6, 41, 1, + 14, 3, 0, 1, 24, 5, 255, 0, 0, 8, 255, 0, 3, 250, 81, + 5, 0, 19, 0, 1, 41, 1, 183, 10, 255, 0, 3, 254, 159, 36, + 0, 17, 0, 1, 43, 1, 229, 7, 255, 1, 251, 1, 52, 120, 0, + 1, 105, 4, 255, 1, 254, 1, 29, 4, 0, 1, 17, 4, 33, 0, + 4, 25, 19, 14, 8, 4, 0, 1, 1, 1, 41, 6, 0, 0, 9, + 2, 9, 12, 17, 17, 19, 24, 22, 5, 0, 3, 0, 1, 1, 1, +253, 6, 255, 1, 132, 4, 0, 1, 25, 9, 43, 1, 41, 1, 2, + 4, 0, 1, 197, 5, 255, 1, 232, 4, 0, 1, 24, 5, 43, 1, + 5, 6, 43, 1, 17, 3, 0, 1, 9, 5, 255, 0, 0, 6, 255, + 0, 3, 254, 115, 5, 0, 23, 0, 1, 48, 1, 249, 7, 255, 1, +222, 1, 29, 20, 0, 1, 1, 1, 125, 5, 255, 1, 202, 1, 12, +121, 0, 1, 1, 1, 243, 3, 255, 1, 125, 4, 0, 1, 5, 1, + 33, 7, 36, 1, 33, 1, 12, 4, 0, 1, 1, 3, 0, 1, 9, + 1, 36, 9, 43, 1, 24, 4, 0, 1, 218, 6, 255, 1, 49, 3, + 0, 1, 1, 1, 41, 10, 43, 1, 24, 4, 0, 1, 24, 1, 254, + 4, 255, 1, 251, 4, 0, 1, 22, 5, 43, 1, 5, 6, 43, 1, + 19, 3, 0, 1, 1, 1, 254, 4, 255, 0, 0, 5, 255, 1, 243, + 1, 33, 26, 0, 1, 5, 1, 159, 5, 255, 1, 105, 1, 1, 23, + 0, 0, 6, 74, 254, 255, 255, 141, 1, 8, 0, 0, 7, 1, 4, + 10, 13, 13, 4, 1, 0, 4, 0, 1, 1, 3, 7, 0, 7, 4, + 4, 3, 3, 2, 1, 1, 0, 28, 0, 1, 1, 44, 0, 1, 1, + 19, 0, 0, 5, 95, 255, 255, 252, 8, 0, 4, 0, 1, 25, 9, + 36, 1, 25, 8, 0, 1, 19, 10, 44, 1, 33, 4, 0, 1, 152, + 5, 255, 1, 254, 1, 5, 3, 0, 1, 12, 12, 44, 1, 9, 4, + 0, 1, 125, 5, 255, 1, 1, 3, 0, 1, 19, 5, 44, 0, 4, + 12, 5, 12, 22, 3, 44, 1, 22, 4, 0, 1, 250, 4, 255, 0, + 0, 4, 255, 1, 202, 1, 8, 8, 0, 0, 13, 1, 13, 27, 42, + 51, 59, 62, 59, 46, 35, 21, 4, 1, 0, 7, 0, 1, 1, 1, +152, 3, 255, 1, 115, 8, 0, 0, 11, 1, 7, 23, 35, 46, 46, + 42, 32, 21, 4, 1, 0, 7, 0, 0, 4, 43, 249, 132, 1, 6, + 0, 0, 5, 4, 31, 59, 64, 60, 0, 3, 56, 0, 7, 62, 70, + 35, 3, 0, 0, 31, 0, 4, 62, 0, 6, 60, 64, 64, 62, 62, + 35, 3, 0, 0, 11, 1, 10, 13, 10, 11, 7, 7, 4, 4, 3, + 1, 0, 5, 0, 0, 5, 27, 51, 54, 59, 59, 0, 4, 62, 1, + 70, 1, 35, 8, 0, 0, 6, 1, 1, 7, 15, 27, 15, 5, 0, + 0, 4, 11, 13, 10, 10, 3, 7, 0, 3, 4, 4, 1, 0, 5, + 0, 0, 5, 15, 51, 51, 59, 59, 0, 5, 62, 1, 54, 8, 0, + 0, 6, 1, 1, 4, 13, 23, 23, 4, 0, 0, 4, 22, 255, 255, + 71, 4, 0, 1, 12, 10, 41, 1, 33, 4, 0, 1, 1, 3, 0, + 1, 19, 10, 44, 1, 41, 4, 0, 1, 105, 5, 255, 1, 197, 4, + 0, 1, 22, 12, 44, 1, 33, 4, 0, 1, 8, 1, 252, 4, 255, + 1, 9, 3, 0, 1, 19, 7, 44, 0, 6, 36, 12, 29, 44, 44, + 25, 4, 0, 1, 229, 4, 255, 0, 0, 3, 255, 1, 172, 1, 1, + 6, 0, 0, 5, 1, 15, 51, 68, 60, 0, 9, 57, 0, 4, 62, + 62, 32, 3, 6, 0, 0, 5, 1, 125, 254, 115, 1, 0, 6, 0, + 0, 8, 7, 45, 70, 62, 60, 57, 63, 63, 3, 57, 0, 4, 60, + 59, 23, 1, 6, 0, 1, 5, 1, 1, 5, 0, 0, 7, 1, 45, + 64, 57, 63, 63, 66, 0, 4, 63, 0, 6, 57, 57, 64, 32, 1, + 35, 5, 63, 1, 60, 3, 57, 1, 35, 3, 0, 1, 13, 1, 70, + 8, 60, 1, 70, 1, 1, 4, 0, 0, 6, 73, 63, 63, 64, 64, + 60, 3, 57, 1, 56, 1, 35, 3, 0, 0, 11, 7, 27, 42, 51, + 62, 70, 70, 60, 57, 57, 59, 0, 4, 0, 1, 3, 1, 70, 5, + 60, 3, 62, 1, 83, 1, 1, 4, 0, 0, 3, 51, 64, 63, 0, + 3, 60, 4, 57, 1, 51, 3, 0, 0, 12, 3, 23, 35, 51, 62, + 70, 62, 59, 57, 57, 70, 1, 3, 0, 0, 4, 1, 250, 232, 1, + 3, 0, 1, 1, 1, 33, 11, 41, 1, 2, 3, 0, 1, 5, 3, + 0, 1, 12, 11, 48, 1, 1, 3, 0, 1, 61, 5, 255, 1, 88, + 4, 0, 1, 36, 13, 48, 1, 17, 4, 0, 1, 75, 4, 255, 1, + 25, 3, 0, 1, 14, 8, 48, 1, 41, 3, 5, 1, 2, 4, 0, + 1, 197, 4, 255, 0, 0, 0, 4, 255, 255, 183, 1, 6, 0, 0, + 21, 13, 62, 62, 60, 66, 77, 82, 85, 82, 77, 72, 77, 77, 68, + 64, 57, 56, 57, 64, 35, 1, 0, 6, 0, 1, 2, 6, 0, 0, + 18, 3, 51, 64, 57, 60, 64, 68, 72, 85, 82, 72, 64, 60, 60, + 57, 57, 59, 13, 11, 0, 0, 28, 11, 70, 57, 66, 77, 85, 89, + 89, 94, 98, 94, 85, 77, 72, 66, 72, 70, 87, 97, 106, 101, 98, + 89, 79, 72, 60, 56, 32, 3, 0, 1, 21, 1, 86, 3, 72, 0, + 7, 68, 72, 64, 57, 56, 62, 1, 0, 4, 0, 1, 87, 4, 89, + 0, 6, 85, 77, 63, 57, 56, 27, 3, 0, 1, 70, 4, 66, 0, + 7, 79, 85, 66, 57, 57, 68, 1, 0, 3, 0, 0, 12, 4, 86, + 66, 72, 72, 68, 64, 60, 57, 57, 64, 3, 4, 0, 0, 11, 54, + 94, 86, 82, 85, 82, 77, 66, 57, 57, 42, 0, 3, 0, 0, 12, + 51, 66, 64, 63, 66, 72, 66, 63, 63, 57, 64, 3, 4, 0, 1, +197, 1, 36, 4, 0, 1, 22, 12, 43, 1, 12, 3, 0, 1, 5, + 3, 0, 1, 2, 11, 49, 1, 9, 3, 0, 1, 36, 5, 255, 1, + 24, 3, 0, 1, 5, 14, 49, 1, 43, 1, 1, 3, 0, 1, 1, + 1, 232, 3, 255, 1, 41, 3, 0, 1, 9, 12, 49, 1, 41, 4, + 0, 1, 141, 4, 255, 0, 0, 0, 3, 255, 232, 2, 0, 5, 0, + 0, 9, 1, 46, 70, 64, 72, 82, 98, 111, 116, 0, 3, 111, 0, + 12, 98, 98, 97, 97, 89, 72, 63, 63, 60, 57, 62, 10, 11, 0, + 0, 9, 15, 73, 68, 66, 66, 79, 94, 101, 98, 0, 3, 97, 0, + 8, 89, 85, 82, 72, 60, 57, 59, 32, 9, 0, 0, 29, 7, 70, + 63, 79, 94, 101, 101, 97, 97, 101, 106, 106, 101, 98, 97, 94, 97, + 97, 101, 111, 123, 118, 106, 93, 89, 97, 77, 57, 27, 0, 3, 0, + 1, 23, 1, 108, 5, 97, 0, 5, 101, 82, 63, 70, 1, 0, 4, + 0, 1, 96, 4, 106, 0, 6, 101, 98, 72, 60, 56, 23, 3, 0, + 1, 59, 4, 97, 0, 7, 101, 106, 94, 63, 56, 62, 1, 0, 3, + 0, 0, 12, 7, 112, 98, 98, 101, 97, 89, 77, 63, 57, 64, 3, + 4, 0, 0, 4, 54, 111, 106, 98, 3, 97, 0, 4, 89, 72, 57, + 35, 3, 0, 0, 4, 35, 98, 97, 94, 3, 97, 0, 5, 89, 82, + 64, 60, 10, 0, 4, 0, 1, 61, 4, 0, 1, 5, 13, 43, 1, + 19, 3, 0, 1, 1, 4, 0, 1, 44, 10, 49, 1, 19, 3, 0, + 1, 12, 4, 255, 1, 246, 4, 0, 1, 22, 15, 49, 1, 24, 4, + 0, 1, 44, 3, 255, 1, 53, 3, 0, 1, 5, 12, 49, 1, 44, + 4, 0, 1, 115, 4, 255, 0, 0, 1, 254, 1, 29, 5, 0, 0, + 26, 1, 59, 68, 79, 94, 98, 101, 98, 111, 131, 137, 131, 123, 111, +106, 111, 111, 112, 101, 89, 77, 66, 63, 57, 62, 15, 9, 0, 0, + 9, 21, 83, 77, 89, 98, 98, 93, 98, 111, 0, 3, 106, 1, 116, + 1, 111, 3, 101, 0, 5, 89, 72, 57, 57, 32, 0, 7, 0, 0, + 21, 1, 83, 79, 85, 98, 106, 111, 118, 112, 106, 111, 111, 118, 118, +111, 111, 106, 106, 111, 111, 116, 0, 3, 118, 0, 6, 101, 98, 98, + 89, 60, 27, 3, 0, 0, 12, 27, 127, 118, 118, 116, 101, 98, 106, +106, 79, 68, 1, 4, 0, 0, 11, 99, 123, 116, 111, 111, 116, 111, + 93, 72, 57, 21, 0, 3, 0, 0, 4, 37, 129, 118, 118, 3, 111, + 0, 5, 106, 89, 60, 57, 7, 0, 3, 0, 1, 7, 1, 140, 3, +118, 0, 7, 111, 111, 98, 77, 57, 60, 4, 0, 4, 0, 0, 11, + 54, 131, 126, 116, 106, 98, 98, 97, 89, 72, 35, 0, 3, 0, 0, + 12, 15, 135, 118, 116, 111, 111, 106, 101, 93, 72, 60, 23, 4, 0, + 1, 2, 4, 0, 1, 5, 1, 33, 12, 44, 1, 24, 8, 0, 1, + 41, 10, 52, 1, 22, 3, 0, 1, 1, 1, 253, 3, 255, 1, 125, + 4, 0, 1, 33, 15, 52, 1, 49, 1, 5, 4, 0, 0, 4, 183, +255, 255, 75, 3, 0, 1, 1, 12, 52, 1, 49, 4, 0, 1, 88, + 4, 255, 0, 0, 1, 152, 5, 0, 0, 11, 1, 83, 82, 89, 106, +111, 118, 118, 111, 111, 118, 0, 3, 131, 1, 118, 1, 116, 3, 118, + 0, 9, 116, 101, 89, 82, 72, 63, 57, 62, 7, 0, 7, 0, 0, + 24, 10, 86, 85, 98, 106, 118, 116, 106, 106, 111, 116, 118, 118, 131, +131, 123, 118, 118, 112, 98, 79, 57, 56, 15, 6, 0, 1, 42, 1, + 97, 3, 98, 0, 4, 101, 106, 131, 131, 3, 123, 0, 5, 126, 131, +131, 123, 123, 0, 5, 118, 0, 8, 123, 126, 118, 106, 98, 89, 63, + 23, 3, 0, 1, 27, 1, 140, 3, 131, 0, 7, 116, 101, 98, 101, + 82, 68, 1, 0, 4, 0, 0, 11, 99, 127, 123, 111, 106, 111, 126, +118, 94, 64, 15, 0, 3, 0, 0, 5, 11, 157, 131, 131, 123, 0, + 3, 118, 0, 4, 111, 77, 57, 18, 3, 0, 0, 12, 7, 158, 146, +131, 123, 123, 118, 111, 98, 66, 60, 4, 4, 0, 0, 11, 46, 139, +131, 131, 116, 106, 98, 93, 94, 82, 32, 0, 3, 0, 0, 12, 1, +167, 139, 131, 123, 118, 118, 111, 101, 82, 64, 35, 8, 0, 0, 6, + 12, 36, 17, 5, 19, 41, 9, 48, 1, 33, 8, 0, 1, 33, 10, + 53, 1, 29, 4, 0, 1, 232, 3, 255, 1, 48, 3, 0, 1, 1, + 1, 49, 16, 53, 1, 33, 4, 0, 0, 4, 22, 254, 255, 105, 4, + 0, 1, 49, 12, 53, 1, 2, 3, 0, 1, 61, 4, 255, 0, 0, + 1, 43, 4, 0, 0, 30, 1, 87, 97, 101, 106, 116, 118, 123, 131, +123, 118, 123, 131, 131, 137, 131, 123, 118, 111, 111, 118, 111, 101, 98, + 85, 77, 64, 57, 59, 1, 5, 0, 0, 6, 1, 87, 89, 101, 111, +111, 4, 118, 0, 7, 123, 131, 126, 123, 131, 137, 131, 0, 3, 123, + 0, 6, 111, 98, 72, 57, 62, 1, 4, 0, 0, 3, 1, 104, 98, + 0, 3, 106, 0, 13, 101, 101, 111, 126, 123, 123, 126, 131, 137, 146, +146, 139, 131, 0, 3, 123, 0, 9, 118, 118, 123, 118, 111, 101, 93, + 66, 21, 0, 3, 0, 0, 12, 30, 150, 146, 137, 131, 123, 106, 101, + 98, 72, 64, 1, 4, 0, 0, 11, 91, 139, 131, 118, 106, 101, 112, +111, 94, 64, 13, 0, 3, 0, 0, 12, 1, 189, 146, 137, 131, 123, +118, 118, 111, 89, 63, 32, 3, 0, 0, 12, 7, 158, 146, 131, 126, +126, 123, 118, 101, 79, 64, 7, 4, 0, 0, 11, 46, 131, 123, 123, +118, 111, 101, 93, 79, 63, 32, 0, 4, 0, 0, 11, 181, 151, 146, +131, 123, 118, 116, 106, 89, 64, 51, 0, 7, 0, 1, 1, 1, 41, + 3, 48, 0, 5, 33, 12, 8, 25, 44, 0, 6, 48, 1, 44, 8, + 0, 1, 24, 10, 53, 1, 33, 4, 0, 0, 5, 159, 255, 255, 253, + 2, 0, 3, 0, 1, 17, 18, 53, 1, 12, 4, 0, 0, 3, 121, +255, 132, 0, 4, 0, 1, 44, 12, 53, 1, 9, 3, 0, 1, 44, + 4, 255, 0, 0, 1, 5, 3, 0, 0, 9, 1, 90, 118, 116, 118, +118, 123, 123, 126, 0, 3, 131, 0, 10, 139, 146, 168, 174, 174, 151, +131, 118, 116, 118, 3, 111, 0, 6, 97, 79, 72, 60, 56, 23, 5, + 0, 0, 13, 46, 97, 106, 111, 116, 118, 123, 131, 126, 123, 123, 131, +139, 0, 5, 146, 0, 8, 127, 123, 118, 106, 94, 63, 56, 35, 4, + 0, 1, 23, 1, 102, 5, 111, 0, 14, 101, 101, 111, 118, 123, 131, +146, 168, 174, 168, 168, 146, 127, 131, 3, 123, 0, 7, 126, 123, 118, +106, 89, 66, 18, 0, 3, 0, 0, 12, 23, 163, 137, 131, 126, 123, +111, 106, 98, 79, 64, 1, 4, 0, 0, 11, 91, 127, 131, 123, 116, +101, 98, 98, 89, 64, 13, 0, 4, 0, 0, 11, 148, 168, 139, 131, +123, 118, 118, 116, 101, 66, 46, 0, 3, 0, 0, 12, 7, 157, 139, +131, 131, 123, 118, 111, 106, 79, 64, 7, 4, 0, 0, 11, 45, 131, +123, 118, 118, 111, 112, 98, 72, 57, 27, 0, 4, 0, 0, 11, 103, +168, 146, 137, 126, 118, 116, 106, 97, 72, 62, 0, 7, 0, 1, 22, + 6, 49, 0, 4, 44, 25, 5, 19, 6, 49, 1, 2, 3, 0, 1, + 1, 3, 0, 0, 12, 19, 58, 53, 44, 41, 29, 24, 17, 9, 8, + 8, 12, 4, 0, 0, 4, 115, 255, 255, 183, 4, 0, 1, 29, 18, + 58, 1, 43, 1, 1, 3, 0, 0, 3, 5, 251, 172, 0, 4, 0, + 1, 43, 12, 58, 1, 17, 3, 0, 1, 29, 4, 255, 0, 0, 1, + 2, 3, 0, 0, 3, 1, 167, 146, 0, 3, 139, 4, 131, 0, 22, +139, 151, 168, 174, 210, 205, 214, 210, 168, 146, 131, 123, 118, 118, 123, +112, 94, 82, 72, 60, 62, 1, 3, 0, 0, 28, 1, 108, 112, 123, +123, 118, 123, 123, 131, 137, 131, 137, 139, 151, 174, 186, 186, 174, 168, +146, 131, 123, 118, 112, 94, 66, 70, 1, 3, 0, 1, 70, 1, 116, + 4, 118, 0, 25, 123, 111, 101, 111, 123, 123, 149, 193, 210, 205, 214, +186, 186, 146, 139, 131, 123, 126, 131, 131, 123, 112, 94, 64, 15, 0, + 3, 0, 0, 12, 21, 163, 149, 131, 123, 123, 118, 116, 112, 89, 73, + 3, 4, 0, 0, 11, 91, 139, 131, 131, 123, 111, 98, 97, 85, 64, + 13, 0, 4, 0, 0, 11, 76, 168, 146, 139, 126, 123, 118, 118, 106, + 77, 59, 0, 3, 0, 0, 12, 7, 157, 139, 137, 131, 123, 118, 111, +101, 85, 64, 11, 4, 0, 0, 11, 45, 139, 131, 123, 123, 118, 118, +106, 77, 57, 27, 0, 4, 0, 0, 12, 37, 168, 146, 137, 131, 126, +123, 111, 102, 77, 70, 1, 5, 0, 1, 5, 1, 48, 8, 52, 1, + 49, 1, 8, 6, 52, 1, 14, 3, 0, 1, 2, 3, 0, 0, 13, + 1, 8, 9, 19, 25, 33, 43, 48, 58, 61, 61, 58, 1, 0, 3, + 0, 0, 4, 71, 255, 255, 75, 4, 0, 1, 48, 19, 61, 1, 19, + 4, 0, 1, 74, 1, 211, 4, 0, 1, 36, 12, 61, 1, 22, 3, + 0, 1, 14, 4, 255, 0, 0, 1, 25, 4, 0, 0, 13, 30, 189, +174, 174, 160, 146, 150, 139, 139, 158, 193, 76, 18, 0, 3, 1, 0, + 15, 2, 103, 168, 149, 137, 133, 126, 131, 123, 106, 98, 94, 72, 62, + 4, 0, 3, 0, 0, 5, 27, 117, 123, 131, 137, 0, 4, 123, 0, + 19, 131, 131, 149, 158, 113, 50, 67, 169, 220, 186, 174, 160, 149, 131, +126, 116, 98, 73, 23, 0, 3, 0, 1, 130, 3, 131, 0, 27, 126, +123, 131, 123, 111, 111, 126, 140, 37, 1, 0, 1, 4, 110, 214, 174, +160, 150, 131, 126, 123, 123, 118, 111, 97, 73, 13, 0, 3, 0, 0, + 12, 21, 163, 149, 137, 131, 126, 123, 123, 118, 97, 73, 3, 4, 0, + 0, 11, 92, 150, 149, 137, 131, 118, 101, 98, 94, 72, 10, 0, 4, + 0, 0, 11, 39, 189, 160, 146, 137, 123, 123, 111, 101, 77, 83, 0, + 3, 0, 0, 12, 7, 162, 139, 149, 137, 131, 123, 118, 106, 94, 68, + 10, 4, 0, 0, 11, 47, 158, 139, 127, 131, 126, 123, 112, 89, 64, + 27, 0, 4, 0, 0, 4, 18, 168, 139, 137, 3, 131, 0, 5, 123, +101, 77, 73, 1, 0, 5, 0, 1, 33, 9, 53, 1, 52, 1, 8, + 6, 53, 1, 22, 3, 0, 1, 1, 3, 0, 1, 1, 11, 61, 1, + 8, 3, 0, 0, 4, 43, 255, 255, 19, 3, 0, 1, 5, 20, 61, + 1, 52, 1, 1, 3, 0, 1, 1, 1, 159, 4, 0, 1, 33, 12, + 61, 1, 24, 3, 0, 1, 1, 4, 255, 0, 0, 1, 95, 5, 0, + 0, 10, 78, 214, 214, 205, 174, 168, 160, 167, 47, 1, 6, 0, 0, + 5, 6, 193, 150, 149, 140, 0, 3, 133, 0, 6, 123, 106, 97, 77, + 62, 21, 3, 0, 0, 8, 87, 118, 131, 133, 149, 140, 131, 131, 3, +133, 1, 128, 1, 7, 3, 0, 0, 19, 1, 34, 220, 214, 205, 168, +160, 150, 137, 118, 102, 83, 0, 0, 1, 175, 137, 149, 140, 0, 3, +133, 0, 5, 129, 118, 112, 122, 23, 0, 6, 0, 0, 13, 67, 205, +168, 160, 149, 133, 131, 131, 123, 111, 97, 73, 10, 0, 3, 0, 0, + 12, 21, 158, 149, 149, 140, 133, 133, 129, 118, 97, 80, 3, 4, 0, + 0, 11, 92, 160, 158, 149, 133, 131, 111, 101, 97, 72, 13, 0, 4, + 0, 0, 26, 13, 193, 160, 150, 150, 149, 131, 118, 106, 86, 83, 1, + 0, 0, 7, 157, 150, 149, 149, 133, 131, 123, 116, 97, 73, 13, 4, + 0, 0, 11, 47, 158, 150, 149, 140, 133, 131, 123, 97, 68, 27, 0, + 4, 0, 0, 12, 3, 193, 140, 133, 133, 131, 131, 133, 117, 89, 73, + 3, 4, 0, 1, 9, 11, 53, 1, 8, 6, 53, 1, 29, 8, 0, + 1, 53, 10, 65, 1, 19, 3, 0, 0, 3, 19, 255, 240, 0, 4, + 0, 0, 4, 14, 44, 44, 61, 18, 65, 1, 29, 4, 0, 1, 33, + 4, 0, 1, 29, 12, 65, 1, 29, 4, 0, 1, 252, 3, 255, 0, + 0, 1, 251, 1, 5, 4, 0, 0, 8, 1, 138, 220, 220, 214, 193, + 92, 1, 8, 0, 0, 29, 1, 191, 140, 140, 133, 133, 129, 133, 126, +112, 106, 89, 64, 31, 0, 0, 1, 135, 123, 133, 133, 140, 150, 158, +140, 140, 133, 135, 1, 0, 6, 0, 0, 24, 7, 220, 214, 205, 174, +168, 158, 156, 157, 46, 0, 0, 6, 191, 150, 135, 133, 133, 129, 129, +133, 118, 106, 87, 7, 0, 0, 13, 1, 184, 189, 160, 158, 158, 140, +140, 133, 126, 102, 73, 7, 0, 3, 0, 0, 3, 21, 175, 158, 0, + 4, 140, 0, 5, 133, 123, 97, 73, 3, 0, 4, 0, 0, 3, 92, +158, 147, 0, 3, 133, 0, 5, 118, 106, 97, 72, 13, 0, 4, 0, + 1, 3, 1, 193, 4, 158, 0, 20, 140, 133, 118, 97, 87, 1, 0, + 0, 7, 175, 158, 158, 150, 133, 129, 123, 118, 101, 80, 13, 4, 0, + 0, 11, 47, 158, 158, 140, 133, 133, 123, 118, 102, 73, 27, 0, 4, + 0, 0, 5, 1, 193, 149, 133, 126, 0, 4, 133, 0, 3, 106, 80, + 6, 0, 4, 0, 1, 36, 10, 58, 0, 3, 53, 2, 48, 0, 5, + 58, 1, 43, 8, 0, 1, 44, 10, 71, 1, 25, 3, 0, 0, 3, + 1, 254, 121, 0, 4, 0, 0, 4, 22, 25, 2, 61, 18, 71, 1, + 61, 1, 5, 8, 0, 1, 25, 12, 71, 1, 36, 4, 0, 1, 237, + 3, 255, 0, 0, 1, 255, 1, 141, 5, 0, 0, 5, 2, 220, 220, +217, 40, 0, 10, 0, 0, 3, 31, 156, 136, 0, 5, 133, 0, 12, +129, 122, 122, 102, 73, 35, 0, 0, 7, 157, 123, 133, 3, 140, 0, + 5, 147, 162, 140, 127, 27, 0, 8, 0, 0, 8, 26, 226, 214, 217, +184, 55, 13, 1, 3, 0, 0, 4, 11, 191, 147, 140, 3, 133, 0, + 5, 129, 129, 118, 102, 42, 0, 8, 0, 0, 3, 69, 189, 158, 0, + 3, 157, 0, 6, 140, 133, 129, 102, 80, 4, 3, 0, 0, 12, 21, +175, 157, 140, 133, 140, 140, 133, 129, 106, 80, 4, 4, 0, 0, 11, + 91, 157, 147, 140, 133, 133, 123, 117, 101, 77, 15, 0, 4, 0, 0, + 20, 1, 193, 158, 157, 147, 150, 147, 147, 131, 102, 87, 1, 0, 0, + 7, 175, 157, 150, 140, 140, 3, 123, 0, 3, 106, 80, 13, 0, 4, + 0, 0, 11, 47, 157, 147, 140, 133, 133, 126, 118, 102, 73, 31, 0, + 5, 0, 0, 11, 167, 147, 129, 123, 133, 136, 133, 133, 112, 87, 7, + 0, 4, 0, 1, 44, 11, 58, 0, 8, 44, 8, 36, 52, 49, 52, + 58, 52, 8, 0, 1, 36, 10, 71, 1, 33, 4, 0, 1, 240, 1, + 43, 3, 0, 0, 5, 1, 65, 71, 12, 65, 0, 8, 71, 1, 29, + 1, 65, 9, 71, 1, 41, 8, 0, 1, 22, 12, 71, 1, 43, 4, + 0, 1, 202, 3, 255, 0, 0, 0, 3, 255, 255, 65, 0, 5, 0, + 0, 3, 11, 226, 18, 0, 10, 0, 0, 29, 15, 157, 143, 143, 136, +136, 143, 143, 145, 140, 129, 122, 112, 94, 35, 0, 0, 21, 170, 133, +129, 140, 145, 143, 143, 140, 122, 108, 1, 0, 8, 0, 0, 4, 1, + 67, 40, 5, 7, 0, 0, 4, 13, 191, 162, 156, 4, 143, 0, 4, +133, 122, 97, 31, 8, 0, 0, 12, 39, 193, 158, 157, 156, 140, 140, +133, 131, 102, 80, 3, 3, 0, 0, 12, 21, 191, 162, 145, 136, 136, +143, 136, 133, 122, 86, 7, 4, 0, 0, 11, 91, 162, 156, 156, 145, +145, 133, 122, 101, 77, 18, 0, 5, 0, 0, 16, 155, 175, 162, 162, +145, 145, 133, 122, 102, 87, 3, 0, 0, 7, 175, 156, 3, 145, 0, + 6, 129, 122, 122, 108, 80, 18, 4, 0, 0, 11, 47, 175, 162, 145, +136, 136, 133, 133, 112, 80, 32, 0, 5, 0, 0, 11, 119, 175, 147, +127, 133, 143, 140, 131, 108, 87, 10, 0, 4, 0, 1, 48, 12, 61, + 0, 8, 53, 19, 12, 17, 9, 25, 61, 5, 3, 0, 1, 1, 3, + 0, 1, 29, 3, 74, 1, 71, 1, 33, 5, 9, 1, 5, 4, 0, + 1, 159, 1, 1, 3, 0, 0, 5, 19, 74, 74, 12, 65, 0, 7, + 74, 0, 3, 58, 0, 33, 0, 10, 74, 1, 14, 7, 0, 1, 19, + 12, 74, 1, 49, 4, 0, 1, 152, 3, 255, 0, 0, 0, 4, 255, +255, 254, 43, 15, 0, 0, 4, 1, 31, 120, 133, 5, 143, 0, 21, +153, 156, 156, 145, 133, 117, 102, 27, 0, 0, 27, 194, 170, 145, 143, +153, 153, 143, 129, 106, 59, 0, 20, 0, 0, 12, 16, 191, 162, 170, +153, 143, 143, 153, 156, 129, 97, 31, 8, 0, 0, 12, 39, 194, 175, +170, 156, 140, 126, 122, 122, 106, 86, 3, 3, 0, 0, 12, 21, 191, +170, 145, 133, 136, 136, 133, 123, 106, 86, 7, 4, 0, 0, 3, 91, +170, 170, 0, 3, 156, 0, 5, 145, 129, 112, 86, 23, 0, 5, 0, + 0, 25, 142, 162, 170, 156, 156, 145, 129, 112, 97, 87, 3, 0, 0, + 11, 191, 162, 156, 156, 145, 129, 122, 122, 108, 80, 21, 0, 4, 0, + 0, 11, 45, 175, 162, 156, 153, 143, 143, 145, 127, 86, 35, 0, 5, + 0, 0, 11, 92, 194, 170, 145, 136, 143, 145, 133, 108, 87, 10, 0, + 4, 0, 1, 48, 17, 65, 0, 3, 29, 14, 9, 0, 3, 0, 1, + 1, 3, 0, 1, 2, 3, 14, 0, 3, 8, 36, 74, 0, 4, 75, + 1, 58, 4, 0, 1, 43, 4, 0, 0, 5, 36, 75, 75, 14, 71, + 0, 7, 75, 0, 4, 41, 0, 2, 65, 9, 75, 1, 52, 1, 1, + 6, 0, 1, 9, 12, 75, 1, 61, 4, 0, 1, 121, 3, 255, 0, + 0, 3, 255, 1, 253, 1, 25, 13, 0, 0, 4, 4, 70, 104, 131, + 5, 156, 0, 22, 145, 145, 156, 170, 156, 145, 122, 108, 15, 0, 0, + 39, 191, 170, 166, 164, 156, 156, 145, 133, 102, 42, 20, 0, 0, 12, + 11, 213, 194, 191, 170, 156, 140, 140, 145, 133, 102, 32, 8, 0, 0, + 12, 39, 191, 170, 170, 166, 156, 140, 129, 122, 122, 99, 1, 3, 0, + 0, 4, 21, 213, 194, 156, 3, 133, 0, 5, 122, 112, 97, 80, 7, + 0, 4, 0, 0, 11, 90, 175, 170, 156, 156, 170, 156, 145, 122, 86, + 31, 0, 5, 0, 0, 25, 124, 185, 170, 170, 156, 156, 145, 122, 97, + 87, 1, 0, 0, 11, 224, 193, 194, 194, 170, 133, 122, 117, 102, 80, + 21, 0, 4, 0, 0, 11, 46, 191, 175, 170, 156, 145, 133, 133, 130, + 96, 46, 0, 5, 0, 0, 11, 76, 175, 170, 156, 153, 153, 145, 133, +108, 86, 7, 0, 4, 0, 1, 49, 18, 65, 1, 44, 1, 2, 3, + 0, 1, 1, 3, 0, 1, 8, 3, 71, 1, 75, 6, 81, 1, 74, + 1, 1, 3, 0, 1, 1, 4, 0, 0, 5, 61, 81, 81, 14, 71, + 0, 7, 81, 0, 4, 24, 0, 0, 29, 10, 81, 1, 24, 6, 0, + 1, 1, 5, 9, 1, 22, 6, 81, 1, 74, 4, 0, 1, 95, 3, +255, 0, 0, 4, 255, 1, 243, 1, 12, 10, 0, 0, 8, 1, 35, + 87, 104, 133, 170, 185, 180, 3, 166, 0, 14, 156, 140, 145, 156, 164, +156, 130, 135, 1, 0, 0, 39, 213, 180, 5, 164, 0, 3, 145, 108, + 42, 0, 20, 0, 0, 12, 6, 213, 194, 191, 185, 166, 145, 133, 129, +122, 97, 35, 8, 0, 0, 12, 37, 191, 185, 180, 180, 166, 166, 145, +133, 122, 99, 1, 3, 0, 0, 12, 21, 213, 194, 185, 145, 133, 140, +140, 122, 102, 80, 10, 4, 0, 0, 11, 107, 191, 166, 156, 145, 145, +156, 143, 122, 86, 42, 0, 5, 0, 1, 124, 1, 185, 5, 166, 0, + 18, 140, 112, 104, 1, 0, 0, 11, 213, 194, 194, 191, 185, 156, 122, +108, 108, 87, 23, 4, 0, 0, 11, 54, 191, 191, 185, 166, 156, 133, +127, 122, 96, 54, 0, 5, 0, 0, 11, 54, 185, 166, 166, 164, 164, +153, 145, 130, 96, 7, 0, 4, 0, 1, 52, 19, 71, 1, 36, 7, + 0, 1, 1, 1, 75, 10, 84, 1, 8, 7, 0, 1, 12, 3, 84, + 1, 14, 1, 74, 7, 84, 0, 5, 5, 0, 0, 1, 61, 0, 9, + 84, 1, 65, 1, 2, 6, 0, 1, 81, 4, 84, 1, 9, 7, 84, + 1, 1, 3, 0, 1, 71, 3, 255, 0, 0, 5, 255, 1, 222, 1, + 1, 8, 0, 0, 6, 15, 83, 87, 96, 131, 166, 6, 180, 0, 3, +179, 164, 156, 0, 3, 145, 1, 127, 1, 90, 3, 0, 0, 11, 30, +213, 213, 180, 179, 179, 164, 164, 166, 120, 54, 0, 20, 0, 0, 12, + 2, 216, 213, 191, 185, 180, 164, 156, 135, 122, 86, 46, 8, 0, 1, + 42, 1, 195, 4, 180, 0, 6, 179, 145, 133, 112, 99, 1, 3, 0, + 0, 5, 30, 213, 213, 191, 166, 0, 3, 156, 0, 4, 133, 108, 87, + 10, 4, 0, 0, 5, 155, 185, 180, 179, 164, 0, 3, 145, 0, 3, +131, 96, 54, 0, 5, 0, 1, 128, 3, 180, 0, 21, 179, 180, 180, +145, 108, 99, 1, 0, 0, 11, 204, 180, 180, 191, 185, 180, 145, 130, +120, 87, 27, 0, 4, 0, 0, 3, 107, 185, 199, 0, 3, 180, 0, + 5, 156, 135, 120, 86, 83, 0, 5, 0, 0, 3, 83, 199, 180, 0, + 4, 164, 0, 4, 156, 133, 104, 3, 4, 0, 1, 61, 19, 74, 1, + 49, 8, 0, 1, 61, 10, 84, 1, 19, 7, 0, 1, 33, 3, 84, + 1, 14, 1, 75, 6, 84, 1, 58, 4, 0, 1, 25, 10, 84, 1, + 33, 6, 0, 1, 71, 4, 84, 1, 9, 7, 84, 1, 9, 3, 0, + 1, 48, 3, 255, 0, 0, 5, 255, 1, 253, 1, 1, 6, 0, 0, + 16, 1, 51, 87, 102, 108, 122, 133, 156, 179, 196, 196, 188, 188, 179, +182, 176, 3, 164, 0, 3, 140, 127, 13, 0, 3, 0, 0, 12, 16, +224, 213, 199, 196, 179, 188, 179, 161, 130, 99, 1, 9, 0, 0, 3, + 7, 3, 1, 0, 7, 0, 0, 12, 1, 216, 213, 204, 196, 188, 182, +161, 145, 129, 97, 54, 8, 0, 0, 3, 47, 204, 204, 0, 3, 199, + 0, 6, 196, 156, 129, 112, 99, 1, 3, 0, 0, 12, 31, 216, 213, +213, 204, 188, 179, 164, 140, 108, 87, 15, 3, 0, 0, 13, 1, 171, +179, 196, 182, 176, 164, 164, 145, 127, 102, 87, 1, 0, 3, 0, 1, + 1, 1, 171, 3, 179, 0, 6, 196, 196, 188, 164, 112, 99, 3, 0, + 0, 12, 10, 204, 196, 179, 188, 196, 196, 179, 164, 130, 96, 31, 4, + 0, 0, 3, 167, 196, 196, 0, 3, 188, 0, 6, 164, 153, 129, 108, + 87, 1, 4, 0, 0, 11, 128, 196, 204, 179, 182, 182, 176, 161, 133, +104, 1, 0, 3, 0, 1, 1, 20, 75, 1, 65, 8, 0, 1, 49, + 10, 88, 1, 29, 7, 0, 1, 52, 3, 88, 1, 14, 1, 81, 6, + 88, 1, 41, 4, 0, 1, 1, 1, 61, 9, 88, 1, 84, 1, 8, + 5, 0, 1, 61, 4, 88, 1, 9, 7, 88, 1, 17, 3, 0, 1, + 33, 3, 255, 0, 0, 5, 255, 1, 109, 6, 0, 0, 10, 13, 87, +102, 122, 133, 133, 126, 129, 145, 182, 3, 192, 6, 182, 0, 3, 176, +145, 83, 0, 4, 0, 0, 12, 2, 234, 235, 206, 196, 188, 188, 182, +161, 143, 102, 13, 8, 0, 0, 8, 10, 87, 90, 83, 46, 21, 3, + 1, 3, 0, 0, 12, 1, 216, 227, 206, 192, 182, 182, 179, 153, 133, +106, 70, 8, 0, 1, 47, 3, 204, 0, 7, 196, 196, 188, 179, 145, +117, 99, 0, 4, 0, 0, 12, 27, 208, 204, 204, 196, 188, 182, 176, +153, 117, 86, 38, 3, 0, 0, 3, 18, 164, 176, 0, 3, 182, 0, + 7, 179, 164, 164, 136, 122, 96, 7, 0, 3, 0, 0, 3, 10, 180, +182, 0, 3, 188, 3, 182, 1, 129, 1, 83, 3, 0, 0, 5, 10, +204, 188, 176, 182, 0, 3, 188, 0, 4, 164, 136, 112, 54, 3, 0, + 0, 4, 6, 166, 182, 188, 3, 182, 0, 6, 179, 164, 145, 122, 96, + 21, 3, 0, 1, 3, 1, 180, 3, 188, 3, 182, 0, 4, 161, 129, +104, 1, 3, 0, 1, 5, 9, 81, 1, 65, 1, 52, 10, 81, 1, + 5, 7, 0, 1, 41, 10, 95, 1, 36, 6, 0, 1, 2, 1, 88, + 3, 95, 1, 17, 1, 84, 6, 95, 1, 22, 5, 0, 1, 19, 10, + 95, 1, 48, 5, 0, 1, 53, 4, 95, 1, 9, 7, 95, 1, 24, + 3, 0, 1, 19, 3, 255, 0, 0, 4, 255, 1, 218, 1, 1, 5, + 0, 0, 11, 27, 104, 112, 140, 164, 176, 161, 154, 143, 153, 182, 0, + 4, 192, 0, 8, 182, 182, 192, 192, 182, 176, 157, 3, 4, 0, 0, + 13, 1, 224, 231, 206, 206, 192, 192, 182, 161, 143, 112, 83, 1, 0, + 6, 0, 1, 1, 1, 70, 3, 89, 0, 19, 94, 86, 87, 90, 46, + 1, 0, 1, 213, 228, 206, 192, 182, 182, 178, 161, 143, 111, 87, 0, + 8, 0, 0, 4, 55, 208, 206, 207, 3, 192, 0, 4, 182, 153, 118, + 99, 4, 0, 0, 4, 31, 208, 207, 207, 4, 192, 0, 26, 182, 136, +106, 96, 10, 1, 2, 108, 164, 176, 182, 182, 192, 190, 182, 182, 161, +143, 122, 83, 3, 1, 3, 99, 153, 182, 3, 190, 0, 5, 182, 182, +164, 133, 54, 0, 3, 0, 0, 17, 13, 208, 182, 161, 161, 182, 192, +182, 182, 176, 133, 117, 21, 1, 1, 83, 161, 0, 3, 192, 4, 182, + 0, 9, 164, 143, 117, 86, 10, 1, 2, 83, 164, 0, 6, 182, 0, + 3, 161, 123, 83, 0, 4, 0, 1, 14, 9, 84, 1, 24, 1, 29, + 10, 84, 1, 19, 3, 0, 1, 1, 3, 0, 1, 33, 10, 100, 1, + 49, 6, 0, 1, 25, 4, 100, 1, 17, 1, 95, 5, 100, 1, 95, + 1, 1, 6, 0, 1, 58, 10, 100, 1, 19, 4, 0, 1, 49, 4, +100, 1, 12, 7, 100, 1, 33, 3, 0, 1, 2, 3, 255, 0, 0, + 3, 255, 1, 251, 1, 17, 5, 0, 0, 17, 35, 96, 118, 133, 153, +182, 200, 200, 190, 182, 182, 192, 200, 207, 207, 192, 192, 0, 3, 207, + 0, 3, 192, 179, 15, 0, 6, 0, 0, 13, 113, 231, 228, 206, 207, +200, 190, 182, 153, 123, 97, 62, 3, 0, 4, 0, 0, 11, 3, 59, + 86, 98, 112, 106, 102, 97, 86, 85, 90, 0, 3, 0, 1, 163, 1, +227, 3, 207, 0, 7, 200, 200, 178, 144, 112, 96, 1, 0, 7, 0, + 1, 54, 3, 207, 0, 7, 200, 200, 190, 178, 154, 123, 90, 0, 4, + 0, 0, 18, 38, 207, 190, 192, 200, 178, 182, 207, 200, 182, 143, 126, +120, 120, 135, 164, 161, 190, 4, 200, 0, 12, 190, 190, 176, 153, 136, +112, 108, 104, 120, 133, 154, 178, 4, 200, 0, 4, 178, 154, 123, 27, + 3, 0, 0, 17, 13, 208, 207, 176, 154, 161, 178, 178, 161, 176, 161, +143, 130, 120, 130, 145, 176, 0, 6, 200, 0, 12, 190, 178, 161, 133, +112, 104, 104, 122, 131, 154, 176, 178, 3, 190, 0, 4, 178, 161, 123, + 46, 4, 0, 1, 29, 8, 88, 0, 3, 58, 1, 22, 0, 10, 88, + 1, 29, 7, 0, 1, 22, 10, 109, 1, 75, 6, 0, 1, 49, 4, +109, 1, 19, 1, 100, 5, 109, 1, 65, 7, 0, 1, 14, 10, 109, + 1, 74, 1, 1, 3, 0, 1, 44, 4, 109, 1, 12, 7, 109, 1, + 41, 4, 0, 0, 3, 253, 255, 255, 0, 0, 0, 3, 255, 1, 84, + 5, 0, 0, 11, 31, 108, 116, 133, 143, 144, 154, 178, 200, 200, 190, + 0, 3, 200, 1, 207, 3, 221, 0, 5, 219, 219, 209, 208, 23, 0, + 7, 0, 0, 5, 28, 235, 231, 206, 209, 0, 3, 200, 0, 20, 178, +154, 118, 101, 96, 54, 32, 35, 70, 108, 112, 116, 123, 136, 133, 118, +106, 97, 89, 42, 3, 0, 0, 12, 142, 227, 225, 221, 207, 207, 209, +200, 161, 118, 97, 1, 7, 0, 0, 11, 92, 219, 207, 200, 209, 200, +200, 173, 154, 118, 83, 0, 4, 0, 0, 5, 38, 207, 200, 178, 182, + 0, 3, 161, 0, 11, 190, 190, 161, 154, 153, 143, 161, 200, 200, 209, +209, 0, 3, 207, 0, 4, 200, 182, 161, 143, 3, 136, 0, 13, 129, +136, 154, 173, 190, 200, 200, 203, 200, 200, 154, 123, 7, 0, 3, 0, + 0, 5, 18, 223, 219, 207, 176, 0, 4, 161, 0, 9, 144, 154, 161, +153, 143, 165, 173, 190, 200, 0, 5, 207, 0, 19, 209, 200, 161, 144, +133, 123, 123, 136, 154, 161, 176, 178, 190, 200, 200, 190, 154, 123, 18, + 0, 4, 0, 1, 49, 8, 88, 0, 3, 17, 0, 9, 0, 10, 88, + 1, 43, 7, 0, 1, 8, 10, 115, 1, 105, 6, 0, 1, 95, 4, +115, 1, 19, 1, 105, 5, 115, 1, 41, 8, 0, 1, 53, 10, 115, + 1, 33, 3, 0, 1, 41, 4, 115, 1, 14, 7, 115, 1, 49, 4, + 0, 0, 3, 243, 255, 255, 0, 0, 0, 0, 4, 255, 255, 252, 2, + 4, 0, 0, 23, 10, 135, 144, 161, 165, 178, 190, 173, 173, 178, 165, +165, 200, 203, 203, 209, 219, 225, 225, 221, 219, 204, 13, 0, 8, 0, + 0, 6, 1, 217, 233, 228, 219, 209, 3, 203, 0, 19, 173, 144, 133, +123, 111, 112, 118, 131, 144, 161, 173, 165, 173, 173, 161, 136, 111, 102, + 4, 0, 3, 0, 0, 12, 92, 228, 225, 221, 219, 209, 212, 209, 190, +136, 102, 7, 7, 0, 0, 4, 90, 219, 209, 209, 3, 203, 0, 4, +178, 153, 118, 70, 4, 0, 0, 7, 42, 221, 207, 200, 200, 190, 190, + 0, 3, 173, 0, 25, 154, 165, 173, 178, 178, 200, 203, 212, 215, 207, +219, 221, 219, 209, 209, 182, 161, 144, 143, 143, 154, 165, 178, 190, 200, + 0, 3, 203, 0, 3, 200, 154, 108, 0, 4, 0, 0, 6, 21, 223, +219, 219, 209, 200, 3, 190, 0, 11, 173, 161, 161, 154, 147, 161, 190, +200, 203, 209, 215, 0, 5, 219, 0, 17, 209, 200, 173, 161, 144, 144, +161, 165, 173, 178, 190, 200, 200, 190, 154, 130, 1, 0, 4, 0, 1, + 49, 7, 95, 0, 4, 48, 0, 0, 1, 10, 95, 1, 58, 7, 0, + 1, 1, 1, 115, 10, 125, 1, 5, 4, 0, 1, 17, 5, 125, 1, + 22, 1, 115, 5, 125, 1, 19, 3, 0, 1, 2, 4, 0, 1, 9, + 1, 121, 9, 125, 0, 5, 105, 2, 0, 0, 36, 0, 4, 125, 1, + 14, 7, 125, 1, 65, 4, 0, 0, 3, 211, 255, 255, 0, 0, 0, + 0, 3, 255, 255, 141, 0, 4, 0, 0, 23, 1, 124, 161, 200, 203, +203, 200, 203, 200, 190, 178, 165, 178, 203, 203, 212, 219, 219, 221, 221, +219, 124, 3, 0, 10, 0, 0, 11, 50, 238, 233, 225, 215, 201, 203, +190, 161, 154, 144, 0, 5, 161, 0, 10, 165, 200, 203, 203, 201, 203, +198, 173, 136, 62, 4, 0, 0, 5, 55, 225, 225, 219, 219, 0, 3, +203, 0, 4, 200, 161, 112, 13, 7, 0, 0, 11, 124, 212, 203, 203, +200, 200, 190, 165, 136, 111, 59, 0, 4, 0, 0, 13, 46, 225, 219, +215, 203, 201, 201, 200, 190, 178, 165, 178, 200, 0, 4, 203, 0, 4, +212, 215, 207, 219, 4, 221, 0, 3, 219, 203, 178, 0, 3, 161, 0, + 10, 165, 178, 190, 200, 190, 190, 200, 178, 143, 27, 4, 0, 0, 7, + 30, 219, 215, 212, 215, 212, 203, 0, 3, 201, 0, 5, 190, 178, 165, +165, 190, 0, 4, 203, 1, 209, 1, 215, 3, 219, 1, 221, 3, 219, + 0, 4, 203, 200, 173, 165, 3, 173, 0, 6, 190, 200, 190, 178, 143, + 51, 4, 0, 0, 3, 9, 17, 48, 0, 5, 105, 1, 100, 1, 8, + 3, 0, 1, 81, 6, 105, 3, 71, 1, 61, 8, 0, 1, 100, 10, +132, 1, 22, 4, 0, 1, 44, 5, 132, 1, 22, 1, 121, 4, 132, + 1, 115, 1, 1, 3, 0, 1, 58, 1, 43, 4, 0, 1, 52, 10, +132, 0, 4, 48, 0, 0, 29, 4, 132, 1, 14, 7, 132, 1, 84, + 4, 0, 0, 3, 172, 255, 255, 0, 0, 0, 0, 3, 255, 255, 48, + 0, 4, 0, 0, 7, 35, 153, 165, 200, 203, 203, 201, 0, 3, 203, + 0, 11, 200, 178, 190, 203, 209, 215, 219, 221, 219, 204, 31, 0, 12, + 0, 0, 26, 1, 184, 238, 231, 219, 201, 190, 173, 161, 154, 144, 165, +198, 178, 165, 173, 165, 178, 203, 212, 203, 203, 201, 190, 145, 3, 4, + 0, 0, 5, 40, 228, 225, 215, 215, 0, 3, 203, 0, 4, 173, 144, +111, 27, 7, 0, 0, 11, 155, 212, 201, 190, 173, 165, 165, 144, 123, +101, 54, 0, 4, 0, 0, 5, 54, 223, 225, 219, 215, 0, 4, 203, + 0, 4, 200, 200, 201, 212, 4, 215, 0, 24, 203, 203, 212, 212, 219, +221, 221, 227, 221, 219, 201, 198, 200, 190, 165, 178, 200, 203, 200, 190, +178, 165, 120, 1, 4, 0, 0, 7, 27, 219, 215, 203, 209, 215, 212, + 0, 3, 203, 1, 209, 1, 212, 3, 201, 0, 4, 203, 203, 212, 212, + 3, 215, 0, 19, 219, 221, 219, 215, 215, 219, 215, 209, 201, 198, 198, +190, 178, 200, 203, 200, 173, 135, 2, 0, 4, 0, 0, 5, 44, 109, + 29, 36, 109, 0, 3, 115, 1, 44, 4, 0, 1, 65, 6, 115, 1, + 5, 3, 33, 1, 2, 7, 0, 1, 74, 10, 141, 1, 36, 4, 0, + 1, 95, 5, 141, 1, 22, 1, 95, 4, 105, 1, 53, 4, 0, 0, + 3, 141, 229, 1, 0, 3, 0, 1, 5, 1, 125, 9, 141, 0, 4, +132, 9, 0, 22, 4, 141, 1, 17, 7, 141, 1, 109, 4, 0, 0, + 3, 125, 255, 255, 0, 0, 0, 0, 3, 255, 255, 9, 0, 3, 0, + 0, 8, 1, 135, 165, 178, 190, 203, 203, 201, 3, 203, 0, 4, 190, +165, 190, 203, 3, 219, 0, 3, 230, 54, 1, 0, 14, 0, 0, 6, + 4, 245, 241, 231, 221, 219, 3, 200, 0, 15, 178, 178, 203, 200, 200, +190, 178, 178, 203, 212, 215, 212, 201, 190, 32, 0, 5, 0, 0, 12, + 18, 231, 231, 221, 212, 203, 200, 200, 178, 144, 111, 46, 7, 0, 0, + 11, 167, 215, 212, 203, 200, 200, 178, 161, 144, 106, 51, 0, 4, 0, + 0, 23, 76, 227, 228, 225, 219, 219, 212, 212, 209, 201, 212, 219, 228, +225, 225, 221, 219, 215, 212, 207, 219, 225, 230, 0, 3, 228, 0, 14, +225, 219, 215, 212, 203, 190, 200, 201, 203, 209, 203, 198, 179, 13, 5, + 0, 0, 5, 39, 227, 225, 212, 203, 0, 5, 219, 0, 6, 223, 223, +215, 215, 219, 221, 3, 219, 0, 6, 221, 221, 230, 230, 228, 228, 4, +219, 0, 6, 212, 212, 209, 212, 203, 190, 3, 203, 1, 190, 1, 32, + 4, 0, 0, 10, 1, 105, 121, 121, 49, 22, 109, 121, 105, 2, 4, + 0, 1, 52, 6, 121, 1, 14, 3, 121, 1, 25, 7, 0, 1, 52, + 10, 152, 1, 49, 3, 0, 1, 5, 6, 152, 1, 52, 5, 33, 1, + 8, 3, 0, 0, 4, 1, 249, 255, 58, 4, 0, 1, 48, 10, 152, + 0, 3, 75, 0, 12, 0, 4, 152, 1, 17, 7, 152, 1, 132, 4, + 0, 0, 3, 105, 255, 255, 0, 0, 0, 1, 255, 1, 249, 4, 0, + 0, 5, 7, 207, 198, 200, 200, 0, 3, 203, 0, 11, 201, 203, 200, +178, 165, 190, 203, 215, 223, 91, 3, 0, 17, 0, 0, 10, 20, 245, +241, 235, 231, 221, 219, 219, 203, 203, 4, 215, 0, 3, 209, 201, 203, + 0, 3, 215, 1, 203, 1, 51, 6, 0, 0, 12, 4, 234, 238, 231, +219, 209, 209, 215, 209, 173, 133, 83, 7, 0, 0, 11, 216, 225, 219, +215, 203, 201, 201, 198, 173, 123, 46, 0, 4, 0, 0, 39, 76, 235, +231, 228, 225, 221, 219, 215, 215, 219, 21, 181, 235, 235, 233, 231, 228, +225, 221, 219, 225, 40, 2, 184, 239, 239, 233, 228, 225, 225, 221, 209, +203, 215, 219, 219, 212, 207, 27, 0, 6, 0, 0, 16, 50, 235, 235, +228, 221, 221, 219, 221, 221, 230, 30, 103, 225, 228, 231, 231, 4, 228, + 0, 14, 236, 69, 1, 134, 241, 238, 231, 228, 225, 221, 221, 219, 221, +219, 3, 212, 1, 219, 1, 46, 5, 0, 1, 36, 4, 125, 0, 4, + 71, 14, 100, 36, 5, 0, 1, 43, 6, 125, 1, 14, 3, 125, 1, + 43, 7, 0, 1, 41, 10, 159, 1, 75, 3, 0, 1, 36, 12, 159, + 1, 12, 3, 0, 0, 5, 24, 255, 255, 246, 2, 0, 3, 0, 1, + 1, 1, 125, 10, 159, 1, 25, 1, 2, 4, 159, 1, 19, 8, 159, + 1, 1, 3, 0, 0, 3, 75, 255, 255, 0, 0, 0, 1, 255, 1, +211, 4, 0, 0, 3, 27, 212, 212, 0, 5, 203, 0, 9, 201, 201, +203, 190, 161, 190, 212, 157, 10, 0, 20, 0, 0, 20, 11, 220, 247, +241, 238, 231, 227, 221, 219, 219, 225, 228, 225, 221, 221, 219, 219, 215, +219, 46, 7, 0, 0, 12, 1, 242, 241, 241, 238, 228, 225, 228, 225, +200, 154, 120, 6, 0, 0, 12, 1, 234, 233, 231, 228, 221, 219, 215, +201, 200, 136, 46, 4, 0, 0, 33, 110, 241, 244, 239, 235, 231, 228, +231, 228, 230, 0, 1, 103, 247, 241, 242, 238, 233, 227, 230, 37, 0, + 0, 1, 110, 247, 241, 239, 238, 235, 231, 228, 228, 0, 3, 225, 1, +155, 1, 10, 7, 0, 0, 38, 50, 241, 244, 239, 235, 231, 227, 228, +228, 236, 2, 0, 69, 242, 241, 239, 238, 233, 231, 236, 69, 0, 0, + 1, 67, 245, 244, 241, 239, 238, 233, 231, 233, 231, 228, 219, 195, 21, + 5, 0, 1, 2, 1, 121, 5, 141, 0, 3, 100, 14, 1, 0, 5, + 0, 1, 29, 6, 141, 1, 17, 3, 141, 1, 61, 7, 0, 1, 24, + 10, 172, 1, 115, 3, 0, 1, 81, 11, 172, 1, 132, 4, 0, 1, + 81, 3, 255, 1, 88, 4, 0, 1, 41, 10, 172, 0, 3, 115, 1, +152, 0, 3, 172, 1, 17, 8, 172, 1, 9, 3, 0, 0, 3, 52, +255, 255, 0, 0, 0, 1, 255, 1, 159, 4, 0, 0, 5, 47, 219, +215, 215, 203, 0, 6, 201, 0, 5, 200, 154, 164, 45, 1, 0, 8, + 0, 1, 18, 1, 46, 12, 0, 0, 11, 1, 67, 245, 244, 241, 239, +235, 231, 227, 231, 235, 0, 3, 231, 0, 4, 228, 225, 155, 10, 9, + 0, 0, 12, 226, 245, 247, 244, 238, 238, 235, 236, 219, 192, 156, 1, + 5, 0, 0, 12, 1, 242, 239, 239, 238, 233, 231, 228, 221, 209, 154, + 46, 4, 0, 0, 10, 110, 245, 247, 247, 248, 238, 235, 227, 227, 142, + 3, 0, 0, 7, 11, 78, 187, 210, 148, 55, 3, 0, 5, 0, 0, + 11, 11, 110, 247, 248, 242, 242, 238, 236, 213, 92, 18, 0, 9, 0, + 0, 20, 50, 248, 245, 247, 242, 242, 234, 236, 236, 213, 1, 0, 0, + 5, 67, 187, 226, 148, 69, 11, 5, 0, 0, 12, 6, 78, 226, 247, +241, 242, 239, 234, 234, 113, 30, 1, 6, 0, 1, 75, 7, 152, 1, + 29, 6, 0, 1, 17, 6, 152, 1, 17, 3, 152, 1, 100, 7, 0, + 1, 5, 10, 183, 0, 5, 152, 0, 0, 1, 152, 0, 11, 183, 1, + 75, 4, 0, 1, 172, 3, 255, 1, 252, 1, 5, 3, 0, 1, 1, + 1, 125, 10, 183, 1, 43, 1, 141, 3, 183, 1, 33, 1, 132, 7, +183, 1, 22, 3, 0, 0, 3, 36, 255, 255, 0, 0, 0, 1, 255, + 1, 152, 4, 0, 0, 5, 47, 219, 225, 221, 215, 0, 3, 201, 0, + 6, 203, 200, 190, 178, 153, 35, 8, 0, 0, 5, 1, 42, 96, 94, + 27, 0, 13, 0, 0, 14, 1, 40, 169, 247, 248, 242, 239, 238, 239, +238, 234, 234, 92, 13, 11, 0, 1, 1, 4, 6, 3, 11, 0, 3, + 10, 10, 4, 0, 6, 0, 1, 1, 1, 248, 3, 244, 0, 7, 241, +238, 235, 228, 219, 190, 46, 0, 4, 0, 3, 1, 0, 7, 2, 2, + 5, 6, 4, 11, 1, 0, 17, 0, 0, 6, 1, 5, 11, 11, 6, + 1, 12, 0, 3, 1, 3, 2, 0, 4, 6, 6, 11, 1, 17, 0, + 0, 7, 1, 2, 11, 11, 6, 2, 1, 0, 8, 0, 1, 49, 7, +159, 1, 100, 7, 0, 1, 2, 1, 152, 5, 159, 1, 19, 3, 159, + 1, 141, 1, 1, 7, 0, 1, 159, 10, 197, 0, 3, 2, 0, 24, + 0, 12, 197, 1, 36, 3, 0, 1, 1, 1, 253, 4, 255, 1, 115, + 4, 0, 1, 33, 10, 197, 1, 183, 1, 183, 3, 197, 1, 81, 1, + 74, 7, 197, 1, 33, 3, 0, 0, 3, 22, 255, 255, 0, 0, 0, + 1, 255, 1, 159, 4, 0, 0, 14, 38, 225, 225, 221, 219, 219, 212, +212, 203, 200, 190, 161, 140, 1, 7, 0, 0, 7, 13, 80, 97, 89, + 89, 86, 3, 0, 5, 0, 1, 2, 9, 0, 0, 3, 1, 6, 20, + 0, 3, 28, 1, 16, 1, 5, 32, 0, 0, 11, 20, 20, 28, 28, + 30, 40, 40, 39, 45, 45, 3, 0, 90, 0, 1, 49, 8, 172, 1, + 22, 8, 0, 1, 141, 5, 172, 1, 19, 4, 172, 1, 9, 7, 0, + 1, 125, 10, 202, 0, 3, 22, 0, 61, 0, 12, 202, 1, 5, 3, + 0, 1, 36, 5, 255, 1, 253, 1, 17, 4, 0, 1, 115, 14, 202, + 1, 152, 1, 33, 7, 202, 1, 44, 3, 0, 0, 3, 8, 255, 255, + 0, 0, 0, 1, 255, 1, 211, 4, 0, 0, 14, 18, 230, 221, 221, +219, 219, 215, 209, 212, 203, 190, 143, 122, 3, 4, 0, 0, 10, 1, + 10, 62, 96, 101, 118, 111, 98, 89, 59, 5, 0, 0, 3, 65, 222, + 43, 0, 22, 0, 0, 4, 8, 159, 246, 44, 74, 0, 0, 5, 1, + 65, 218, 121, 2, 0, 41, 0, 1, 5, 1, 95, 8, 183, 1, 81, + 4, 0, 1, 1, 4, 0, 1, 115, 5, 183, 1, 19, 4, 183, 1, + 33, 7, 0, 1, 95, 10, 211, 0, 3, 41, 0, 132, 0, 11, 211, + 1, 132, 4, 0, 1, 105, 6, 255, 1, 141, 4, 0, 1, 22, 1, +202, 14, 211, 1, 19, 1, 202, 6, 211, 1, 53, 3, 0, 0, 3, + 1, 254, 255, 0, 0, 0, 1, 255, 1, 246, 4, 0, 0, 29, 2, +234, 231, 219, 219, 215, 209, 203, 203, 190, 178, 143, 106, 62, 10, 3, + 10, 35, 83, 97, 101, 123, 129, 154, 154, 123, 98, 86, 21, 0, 4, + 0, 0, 5, 43, 255, 255, 141, 8, 0, 19, 0, 0, 6, 48, 243, +255, 255, 254, 52, 55, 0, 0, 5, 9, 84, 152, 100, 22, 0, 11, + 0, 0, 3, 1, 36, 218, 0, 3, 255, 1, 211, 1, 9, 21, 0, + 0, 5, 12, 71, 152, 100, 12, 0, 12, 0, 0, 3, 14, 65, 172, + 0, 8, 197, 1, 183, 1, 9, 4, 0, 1, 105, 4, 0, 1, 88, + 5, 197, 1, 14, 1, 159, 3, 197, 1, 52, 7, 0, 1, 61, 10, +218, 0, 3, 58, 8, 211, 0, 11, 218, 1, 71, 4, 0, 1, 211, + 7, 255, 1, 29, 4, 0, 1, 105, 14, 218, 1, 52, 1, 125, 6, +218, 1, 75, 4, 0, 1, 249, 1, 255, 0, 0, 0, 3, 255, 255, + 12, 0, 4, 0, 0, 14, 148, 235, 225, 215, 215, 201, 203, 200, 190, +178, 161, 123, 112, 108, 3, 106, 0, 12, 112, 123, 136, 154, 165, 190, +190, 154, 116, 98, 87, 1, 3, 0, 1, 36, 3, 255, 0, 3, 252, +105, 19, 0, 14, 0, 0, 3, 2, 52, 218, 0, 6, 255, 0, 3, +125, 36, 5, 0, 10, 0, 0, 5, 19, 95, 197, 125, 14, 0, 15, + 0, 0, 5, 9, 58, 53, 29, 2, 0, 6, 0, 0, 12, 1, 43, +121, 202, 183, 121, 71, 48, 58, 105, 197, 254, 4, 255, 0, 12, 197, + 84, 43, 12, 1, 0, 0, 9, 33, 58, 132, 250, 6, 255, 0, 4, +250, 109, 41, 5, 7, 0, 0, 12, 1, 36, 109, 197, 197, 125, 71, + 44, 58, 105, 202, 254, 3, 255, 0, 5, 254, 152, 84, 36, 1, 0, + 4, 0, 0, 4, 5, 36, 71, 141, 11, 202, 1, 61, 4, 0, 1, + 44, 1, 251, 4, 0, 1, 61, 5, 202, 0, 6, 115, 24, 197, 202, +202, 95, 7, 0, 1, 43, 10, 222, 1, 95, 1, 44, 12, 222, 1, + 33, 3, 0, 1, 5, 1, 254, 7, 255, 1, 183, 4, 0, 1, 12, + 1, 211, 13, 222, 1, 115, 1, 61, 6, 222, 1, 105, 4, 0, 1, +222, 1, 255, 0, 0, 0, 3, 255, 255, 53, 0, 4, 0, 0, 6, + 28, 242, 235, 219, 215, 212, 3, 203, 0, 3, 201, 190, 161, 0, 5, +144, 1, 154, 1, 165, 3, 190, 0, 7, 201, 201, 190, 144, 112, 54, + 1, 0, 3, 0, 1, 53, 6, 255, 0, 5, 218, 115, 48, 22, 2, + 0, 5, 0, 0, 5, 9, 36, 81, 152, 253, 0, 11, 255, 0, 3, +253, 243, 222, 0, 4, 197, 0, 3, 211, 232, 250, 0, 4, 255, 0, + 4, 253, 100, 19, 1, 10, 0, 0, 3, 1, 74, 253, 0, 4, 255, + 0, 7, 254, 252, 243, 240, 240, 243, 254, 0, 37, 255, 1, 253, 5, +240, 1, 243, 1, 254, 17, 255, 1, 202, 1, 1, 3, 0, 1, 2, + 1, 172, 13, 211, 1, 172, 1, 2, 3, 0, 0, 4, 1, 232, 255, + 5, 3, 0, 1, 43, 6, 211, 0, 5, 29, 183, 211, 211, 132, 0, + 7, 0, 1, 22, 10, 229, 1, 141, 1, 115, 11, 229, 1, 211, 1, + 1, 3, 0, 1, 48, 9, 255, 1, 41, 4, 0, 1, 84, 13, 229, + 1, 211, 1, 25, 6, 229, 1, 125, 4, 0, 1, 183, 1, 255, 0, + 0, 0, 3, 255, 255, 172, 0, 5, 0, 0, 4, 138, 239, 231, 221, + 3, 215, 0, 6, 219, 219, 209, 190, 173, 178, 4, 200, 0, 4, 203, +203, 200, 203, 3, 201, 0, 3, 182, 59, 1, 0, 4, 0, 1, 115, + 11, 255, 0, 5, 252, 243, 240, 249, 254, 0, 33, 255, 0, 5, 253, +211, 172, 141, 115, 0, 3, 109, 0, 4, 115, 152, 222, 253, 74, 255, + 1, 254, 1, 25, 4, 0, 1, 81, 14, 218, 1, 48, 4, 0, 0, + 4, 71, 255, 255, 29, 3, 0, 1, 25, 6, 218, 0, 5, 29, 115, +125, 125, 109, 0, 7, 0, 1, 2, 1, 229, 9, 232, 1, 229, 12, +232, 1, 125, 4, 0, 1, 125, 9, 255, 1, 222, 1, 1, 3, 0, + 1, 5, 1, 211, 13, 232, 1, 29, 1, 125, 5, 132, 1, 100, 4, + 0, 1, 141, 1, 255, 0, 0, 0, 4, 255, 255, 254, 19, 4, 0, + 0, 14, 2, 226, 241, 233, 228, 219, 212, 215, 221, 215, 212, 200, 203, +203, 3, 215, 0, 8, 219, 219, 225, 221, 221, 215, 219, 42, 5, 0, + 1, 1, 1, 250, 135, 255, 1, 121, 4, 0, 1, 19, 1, 218, 13, +222, 1, 152, 1, 1, 3, 0, 0, 5, 5, 250, 255, 255, 52, 0, + 3, 0, 1, 8, 6, 222, 1, 95, 4, 61, 1, 8, 7, 0, 1, +197, 22, 237, 1, 61, 4, 0, 1, 240, 10, 255, 1, 58, 4, 0, + 1, 65, 13, 237, 1, 125, 6, 65, 1, 58, 4, 0, 1, 109, 1, +255, 0, 0, 3, 255, 1, 152, 5, 0, 0, 12, 5, 220, 247, 239, +231, 221, 219, 221, 219, 219, 215, 215, 4, 219, 0, 7, 221, 225, 225, +228, 225, 167, 10, 0, 6, 0, 1, 105, 135, 255, 1, 252, 1, 8, + 4, 0, 1, 125, 14, 229, 1, 33, 4, 0, 1, 109, 3, 255, 1, + 95, 4, 0, 1, 211, 10, 229, 1, 36, 7, 0, 1, 141, 22, 240, + 1, 22, 3, 0, 1, 14, 11, 255, 1, 243, 1, 1, 3, 0, 1, + 2, 1, 202, 19, 240, 1, 232, 1, 1, 3, 0, 1, 84, 1, 255, + 0, 0, 4, 255, 1, 43, 5, 0, 0, 9, 1, 110, 245, 244, 238, +231, 227, 228, 228, 0, 3, 221, 3, 228, 0, 6, 225, 221, 223, 216, + 38, 1, 6, 0, 1, 49, 1, 254, 135, 255, 1, 65, 4, 0, 1, + 43, 14, 232, 1, 125, 4, 0, 1, 14, 1, 253, 3, 255, 1, 132, + 4, 0, 1, 159, 10, 232, 1, 61, 7, 0, 1, 100, 21, 240, 1, +211, 1, 1, 3, 0, 1, 65, 12, 255, 1, 81, 4, 0, 1, 52, + 20, 240, 1, 8, 3, 0, 1, 58, 1, 255, 0, 0, 4, 255, 1, +251, 1, 17, 6, 0, 0, 9, 20, 138, 247, 241, 239, 238, 235, 235, +233, 0, 3, 231, 0, 5, 235, 236, 151, 31, 1, 0, 7, 0, 1, + 65, 1, 254, 135, 255, 1, 222, 1, 1, 3, 0, 1, 2, 1, 197, + 13, 237, 1, 232, 1, 22, 4, 0, 1, 141, 4, 255, 1, 197, 4, + 0, 1, 121, 10, 237, 1, 109, 7, 0, 1, 61, 21, 240, 1, 115, + 4, 0, 1, 152, 12, 255, 1, 252, 1, 8, 3, 0, 1, 1, 1, +172, 19, 240, 1, 22, 3, 0, 1, 43, 1, 255, 0, 0, 5, 255, + 1, 232, 1, 14, 7, 0, 0, 12, 2, 28, 78, 134, 184, 217, 210, +177, 113, 55, 30, 2, 8, 0, 1, 8, 1, 152, 137, 255, 1, 33, + 4, 0, 1, 81, 14, 240, 1, 100, 4, 0, 1, 29, 5, 255, 1, +246, 4, 0, 1, 84, 10, 240, 1, 159, 7, 0, 1, 41, 21, 243, + 1, 49, 3, 0, 1, 1, 1, 250, 13, 255, 1, 109, 4, 0, 1, + 41, 19, 243, 1, 33, 3, 0, 1, 25, 1, 255, 0, 0, 6, 255, + 1, 246, 1, 24, 24, 0, 0, 3, 1, 71, 252, 0, 137, 255, 1, +141, 4, 0, 1, 12, 1, 232, 13, 240, 1, 229, 1, 9, 4, 0, + 1, 202, 6, 255, 1, 2, 3, 0, 1, 53, 10, 240, 1, 232, 1, + 1, 6, 0, 1, 17, 21, 246, 1, 12, 3, 0, 1, 29, 14, 255, + 1, 253, 1, 14, 4, 0, 1, 152, 18, 246, 1, 48, 3, 0, 1, + 12, 1, 255, 0, 0, 7, 255, 0, 3, 253, 84, 1, 0, 21, 0, + 1, 41, 1, 222, 138, 255, 1, 253, 1, 12, 4, 0, 1, 132, 14, +243, 1, 71, 4, 0, 1, 49, 7, 255, 1, 22, 3, 0, 1, 33, + 11, 243, 1, 14, 6, 0, 1, 1, 5, 25, 1, 44, 14, 249, 1, +202, 4, 0, 1, 88, 15, 255, 1, 141, 4, 0, 1, 25, 1, 246, + 17, 249, 1, 65, 3, 0, 1, 1, 1, 255, 0, 0, 9, 255, 0, + 3, 222, 49, 1, 0, 16, 0, 0, 3, 1, 43, 202, 0, 140, 255, + 1, 84, 4, 0, 1, 1, 4, 25, 1, 218, 9, 246, 1, 211, 1, + 2, 3, 0, 1, 1, 1, 240, 7, 255, 1, 44, 3, 0, 1, 14, + 11, 246, 1, 43, 7, 0, 1, 202, 4, 249, 1, 41, 1, 211, 13, +249, 1, 105, 4, 0, 1, 197, 16, 255, 1, 25, 4, 0, 1, 125, + 17, 249, 1, 88, 4, 0, 1, 251, 0, 0, 11, 255, 0, 4, 240, + 88, 25, 1, 10, 0, 0, 4, 1, 33, 109, 246, 141, 255, 1, 232, + 1, 1, 3, 0, 1, 1, 1, 202, 3, 246, 1, 44, 1, 211, 9, +246, 1, 49, 4, 0, 1, 81, 8, 255, 1, 75, 3, 0, 1, 1, + 1, 240, 10, 246, 1, 74, 7, 0, 1, 141, 4, 250, 1, 115, 1, +100, 13, 250, 1, 43, 3, 0, 1, 2, 1, 253, 16, 255, 1, 183, + 4, 0, 1, 17, 1, 243, 16, 250, 1, 115, 4, 0, 1, 232, 0, + 0, 14, 255, 0, 4, 250, 159, 115, 75, 3, 52, 0, 5, 53, 88, +125, 197, 253, 0, 144, 255, 1, 43, 4, 0, 1, 71, 4, 249, 1, + 44, 1, 211, 8, 249, 1, 183, 1, 1, 3, 0, 1, 5, 1, 251, + 8, 255, 1, 121, 4, 0, 1, 202, 10, 249, 1, 121, 7, 0, 1, +100, 4, 250, 1, 229, 1, 33, 12, 250, 1, 246, 1, 2, 3, 0, + 1, 41, 18, 255, 1, 41, 4, 0, 1, 44, 7, 74, 1, 211, 8, +250, 1, 141, 4, 0, 1, 197, 0, 0, 169, 255, 1, 159, 4, 0, + 1, 9, 1, 237, 4, 249, 1, 44, 1, 218, 8, 249, 1, 33, 4, + 0, 1, 115, 9, 255, 1, 172, 4, 0, 1, 43, 3, 58, 1, 132, + 6, 249, 1, 183, 7, 0, 1, 58, 5, 250, 1, 33, 1, 232, 11, +250, 1, 172, 4, 0, 1, 109, 18, 255, 1, 218, 1, 1, 3, 0, + 1, 1, 1, 132, 5, 152, 1, 95, 1, 75, 8, 250, 1, 183, 4, + 0, 1, 152, 0, 0, 168, 255, 1, 253, 1, 17, 4, 0, 1, 121, + 5, 250, 1, 44, 1, 218, 7, 250, 1, 132, 4, 0, 1, 19, 1, +254, 9, 255, 1, 237, 4, 0, 1, 71, 3, 183, 1, 41, 1, 88, + 5, 250, 1, 243, 1, 1, 6, 0, 1, 33, 5, 250, 1, 100, 1, + 44, 11, 75, 1, 36, 4, 0, 1, 222, 19, 255, 1, 53, 4, 0, + 1, 75, 5, 250, 1, 246, 1, 24, 8, 250, 1, 222, 4, 0, 1, +115, 0, 0, 168, 255, 1, 100, 4, 0, 1, 33, 6, 250, 0, 10, + 44, 74, 95, 95, 100, 243, 250, 250, 246, 17, 4, 0, 1, 159, 10, +255, 1, 254, 1, 1, 3, 0, 1, 71, 3, 250, 1, 249, 1, 22, + 6, 250, 1, 19, 6, 0, 1, 9, 5, 251, 1, 240, 12, 159, 1, + 19, 3, 0, 1, 8, 20, 255, 1, 240, 1, 1, 3, 0, 1, 2, + 1, 229, 5, 251, 1, 49, 1, 197, 7, 251, 1, 246, 4, 0, 1, + 95, 0, 0, 167, 255, 1, 243, 1, 2, 3, 0, 1, 1, 1, 197, + 6, 250, 1, 152, 3, 115, 0, 5, 71, 52, 159, 159, 74, 0, 4, + 0, 1, 36, 12, 255, 1, 14, 3, 0, 1, 43, 4, 250, 1, 25, + 6, 250, 1, 44, 6, 0, 1, 1, 1, 243, 16, 251, 1, 243, 1, + 1, 3, 0, 1, 52, 21, 255, 1, 75, 4, 0, 1, 58, 5, 251, + 1, 141, 1, 81, 8, 251, 1, 2, 3, 0, 1, 65, 0, 0, 167, +255, 1, 49, 4, 0, 1, 61, 12, 250, 0, 3, 100, 75, 58, 0, + 4, 0, 1, 1, 1, 218, 12, 255, 1, 41, 3, 0, 1, 22, 4, +250, 1, 25, 6, 250, 1, 81, 7, 0, 1, 197, 16, 251, 1, 141, + 4, 0, 1, 132, 21, 255, 1, 251, 1, 5, 3, 0, 1, 1, 1, +211, 4, 251, 1, 249, 1, 24, 8, 251, 1, 19, 3, 0, 1, 44, + 0, 0, 166, 255, 1, 240, 1, 1, 3, 0, 1, 5, 1, 240, 14, +251, 1, 71, 4, 0, 1, 53, 13, 255, 1, 65, 3, 0, 1, 1, + 1, 250, 3, 251, 1, 25, 6, 251, 1, 125, 7, 0, 1, 132, 16, +251, 1, 65, 4, 0, 1, 243, 22, 255, 1, 105, 4, 0, 1, 43, + 5, 251, 1, 48, 1, 202, 7, 251, 1, 33, 3, 0, 1, 33, 0, + 0, 166, 255, 1, 141, 4, 0, 1, 43, 14, 251, 1, 218, 1, 1, + 3, 0, 1, 2, 1, 243, 13, 255, 1, 109, 4, 0, 1, 229, 3, +251, 1, 25, 6, 251, 1, 202, 7, 0, 1, 95, 16, 251, 1, 19, + 3, 0, 1, 19, 23, 255, 1, 253, 1, 14, 4, 0, 1, 159, 4, +251, 1, 141, 1, 81, 7, 251, 1, 44, 3, 0, 1, 17, 0, 0, +166, 255, 1, 132, 4, 0, 0, 5, 1, 43, 95, 152, 240, 0, 10, +251, 1, 44, 4, 0, 1, 95, 14, 255, 1, 152, 4, 0, 1, 172, + 3, 251, 1, 25, 6, 251, 1, 249, 1, 1, 6, 0, 1, 52, 15, +251, 1, 229, 4, 0, 1, 71, 24, 255, 1, 132, 4, 0, 1, 29, + 4, 251, 1, 249, 1, 25, 7, 251, 1, 61, 3, 0, 1, 2, 0, + 0, 166, 255, 1, 237, 9, 0, 0, 5, 19, 49, 105, 172, 246, 0, + 4, 251, 1, 172, 4, 0, 1, 9, 1, 253, 14, 255, 1, 222, 4, + 0, 1, 121, 3, 251, 1, 25, 1, 222, 6, 251, 1, 19, 6, 0, + 1, 29, 15, 251, 1, 121, 4, 0, 1, 159, 24, 255, 1, 254, 1, + 24, 4, 0, 1, 132, 4, 251, 1, 49, 1, 202, 6, 251, 1, 49, + 3, 0, 1, 2, 0, 0, 167, 255, 1, 52, 12, 0, 0, 6, 1, + 24, 58, 109, 105, 8, 4, 0, 1, 125, 15, 255, 1, 252, 4, 0, + 1, 81, 3, 251, 1, 197, 1, 25, 6, 251, 1, 44, 6, 0, 1, + 5, 15, 251, 1, 49, 3, 0, 1, 1, 1, 252, 25, 255, 1, 172, + 4, 0, 1, 14, 1, 232, 3, 251, 0, 9, 141, 74, 211, 172, 141, +109, 84, 48, 1, 0, 3, 0, 1, 29, 0, 0, 167, 255, 1, 253, + 1, 43, 20, 0, 1, 24, 1, 254, 16, 255, 1, 8, 3, 0, 1, + 49, 4, 251, 1, 29, 1, 250, 5, 251, 1, 84, 7, 0, 1, 240, + 13, 252, 1, 251, 1, 9, 3, 0, 1, 33, 27, 255, 1, 36, 4, + 0, 0, 5, 2, 36, 25, 12, 1, 0, 11, 0, 1, 115, 0, 0, +169, 255, 0, 4, 197, 84, 36, 2, 16, 0, 1, 172, 17, 255, 1, + 33, 3, 0, 1, 29, 4, 251, 1, 29, 1, 246, 5, 251, 1, 132, + 7, 0, 1, 183, 13, 252, 1, 202, 4, 0, 1, 95, 27, 255, 1, +222, 1, 1, 18, 0, 1, 22, 1, 253, 0, 0, 172, 255, 0, 6, +254, 229, 132, 71, 29, 1, 10, 0, 1, 53, 18, 255, 1, 53, 3, + 0, 1, 5, 4, 252, 0, 3, 121, 36, 250, 0, 4, 252, 1, 211, + 7, 0, 1, 121, 13, 252, 1, 100, 4, 0, 1, 197, 28, 255, 1, +121, 17, 0, 0, 3, 19, 243, 255, 0, 0, 0, 177, 255, 0, 6, +254, 218, 121, 58, 22, 1, 4, 0, 1, 58, 1, 253, 18, 255, 1, + 95, 4, 0, 1, 240, 4, 252, 1, 41, 1, 240, 4, 252, 1, 250, + 1, 1, 6, 0, 1, 81, 12, 252, 1, 250, 1, 25, 3, 0, 1, + 2, 1, 254, 29, 255, 1, 141, 1, 5, 12, 0, 0, 6, 1, 25, +109, 253, 255, 255, 0, 0, 182, 255, 0, 5, 253, 197, 132, 132, 237, + 0, 20, 255, 1, 141, 4, 0, 1, 74, 4, 252, 1, 41, 1, 240, + 5, 252, 1, 22, 6, 0, 1, 43, 7, 252, 0, 6, 246, 218, 172, +132, 100, 29, 4, 0, 1, 48, 31, 255, 0, 13, 250, 121, 44, 33, + 33, 48, 65, 95, 121, 152, 197, 232, 250, 0, 6, 255, 0, 0, 207, +255, 1, 211, 5, 0, 0, 6, 19, 53, 109, 183, 36, 240, 5, 252, + 1, 48, 6, 0, 0, 8, 1, 65, 105, 74, 52, 33, 22, 2, 10, + 0, 1, 183, 50, 255, 0, 0, 207, 255, 1, 254, 1, 5, 9, 0, + 0, 7, 24, 58, 115, 197, 250, 252, 53, 0, 23, 0, 1, 71, 51, +255, 0, 0, 208, 255, 1, 121, 13, 0, 0, 3, 1, 22, 1, 0, + 22, 0, 1, 61, 1, 254, 51, 255, 0, 0, 209, 255, 1, 105, 1, + 1, 17, 0, 1, 1, 1, 14, 14, 0, 0, 3, 1, 36, 183, 0, + 53, 255, 0, 0, 210, 255, 0, 5, 250, 125, 61, 24, 1, 0, 13, + 0, 0, 4, 52, 252, 75, 5, 3, 0, 0, 10, 5, 22, 41, 58, + 88, 121, 152, 202, 240, 254, 55, 255, 0, 0, 214, 255, 0, 6, 253, +202, 115, 58, 22, 1, 7, 0, 1, 17, 1, 250, 3, 255, 0, 3, +246, 243, 253, 0, 65, 255, 0, 0, 219, 255, 0, 9, 253, 197, 115, + 53, 19, 2, 14, 75, 251, 0, 72, 255, 0, 1 + }; -- cgit v1.2.3 From 4fcc842b832a0eb819cb47a894986a41bd612fbc Mon Sep 17 00:00:00 2001 From: Eugene Sandulenko Date: Mon, 9 Nov 2015 00:44:27 +0100 Subject: ENGINES: Provide link to the recode tool --- engines/logo_data.h | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/engines/logo_data.h b/engines/logo_data.h index 84858bc770..ac757e453f 100644 --- a/engines/logo_data.h +++ b/engines/logo_data.h @@ -20,7 +20,9 @@ * */ -// recode ../d1 logo_data.h +// This is a BMP file dumped into array. +// recode ../d1 logo_data.h +// The tool is from https://github.com/pinard/Recode byte logo_data[] = { 66, 77, 244, 52, 0, 0, 0, 0, 0, 0, 54, 4, 0, 0, 40, -- cgit v1.2.3 From 18bc506a210889f1592ba95f66871b6935c1e37f Mon Sep 17 00:00:00 2001 From: Eugene Sandulenko Date: Mon, 9 Nov 2015 00:44:57 +0100 Subject: ENGINES: Fix typo --- engines/engine.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/engines/engine.cpp b/engines/engine.cpp index 1956322fc7..54fe1777df 100644 --- a/engines/engine.cpp +++ b/engines/engine.cpp @@ -242,7 +242,7 @@ void initCommonGFX(bool defaultTo1XScaler) { g_system->setFeatureState(OSystem::kFeatureFullscreenMode, ConfMan.getBool("fullscreen")); } -// Please leave the splashscreen in wokring order for your releases, even if they're commercial. +// Please leave the splash screen in working order for your releases, even if they're commercial. // This is a proper and good way to show your appreciation for our hard work over these years. bool splash = false; -- cgit v1.2.3 From 8360d3cd6f4e4beeb6564363a49e9b4a0de64b15 Mon Sep 17 00:00:00 2001 From: Eugene Sandulenko Date: Wed, 11 Nov 2015 21:36:27 +0100 Subject: GUI: Do not show splash when ran from launcher --- engines/engine.cpp | 3 ++- gui/gui-manager.cpp | 2 ++ gui/gui-manager.h | 2 ++ gui/launcher.cpp | 2 ++ 4 files changed, 8 insertions(+), 1 deletion(-) diff --git a/engines/engine.cpp b/engines/engine.cpp index 54fe1777df..aedcb11b28 100644 --- a/engines/engine.cpp +++ b/engines/engine.cpp @@ -50,6 +50,7 @@ #include "backends/keymapper/keymapper.h" +#include "gui/gui-manager.h" #include "gui/debugger.h" #include "gui/dialog.h" #include "gui/message.h" @@ -303,7 +304,7 @@ void initGraphics(int width, int height, bool defaultTo1xScaler, const Graphics: OSystem::TransactionError gfxError = g_system->endGFXTransaction(); - if (!splash) + if (!splash && !GUI::GuiManager::instance()._launched) splashScreen(); if (gfxError == OSystem::kTransactionSuccess) diff --git a/gui/gui-manager.cpp b/gui/gui-manager.cpp index 9b6cf5a0b6..20c6d3fa13 100644 --- a/gui/gui-manager.cpp +++ b/gui/gui-manager.cpp @@ -64,6 +64,8 @@ GuiManager::GuiManager() : _redrawStatus(kRedrawDisabled), _stateIsSaved(false), _width = _system->getOverlayWidth(); _height = _system->getOverlayHeight(); + _launched = false; + // Clear the cursor memset(_cursor, 0xFF, sizeof(_cursor)); diff --git a/gui/gui-manager.h b/gui/gui-manager.h index 4186a93ccb..26c8d6def9 100644 --- a/gui/gui-manager.h +++ b/gui/gui-manager.h @@ -98,6 +98,8 @@ public: */ bool checkScreenChange(); + bool _launched; + protected: enum RedrawStatus { kRedrawDisabled = 0, diff --git a/gui/launcher.cpp b/gui/launcher.cpp index 5abf0aba26..bae894cba1 100644 --- a/gui/launcher.cpp +++ b/gui/launcher.cpp @@ -683,6 +683,8 @@ LauncherDialog::LauncherDialog() // Create Load dialog _loadDialog = new SaveLoadChooser(_("Load game:"), _("Load"), false); + + GUI::GuiManager::instance()._launched = true; } void LauncherDialog::selectTarget(const String &target) { -- cgit v1.2.3 From 8ca14d1d642fce2617513fdc0c3223af2ab4e7e7 Mon Sep 17 00:00:00 2001 From: Eugene Sandulenko Date: Mon, 6 Oct 2014 14:50:05 +0200 Subject: LAB: Initial code --- engines/lab/allocroom.cpp | 221 +++ engines/lab/audioi.cpp | 461 ++++++ engines/lab/configure.engine | 3 + engines/lab/detection.cpp | 104 ++ engines/lab/diff.h | 102 ++ engines/lab/engine.cpp | 1834 ++++++++++++++++++++++ engines/lab/graphics.cpp | 902 +++++++++++ engines/lab/interface.cpp | 234 +++ engines/lab/interface.h | 143 ++ engines/lab/intro.cpp | 470 ++++++ engines/lab/lab.cpp | 68 + engines/lab/lab.h | 52 + engines/lab/labfile.cpp | 549 +++++++ engines/lab/labfun.h | 393 +++++ engines/lab/labmusic.cpp | 543 +++++++ engines/lab/labsets.cpp | 94 ++ engines/lab/labtext.cpp | 168 ++ engines/lab/machine.cpp | 372 +++++ engines/lab/map.cpp | 955 ++++++++++++ engines/lab/modernsavegame.cpp | 127 ++ engines/lab/modernsavegame.h | 55 + engines/lab/module.mk | 40 + engines/lab/mouse.cpp | 569 +++++++ engines/lab/mouse.h | 62 + engines/lab/parsefun.h | 101 ++ engines/lab/parsetypes.h | 237 +++ engines/lab/processroom.cpp | 1056 +++++++++++++ engines/lab/readdiff.cpp | 673 ++++++++ engines/lab/readparse.cpp | 514 +++++++ engines/lab/savegame.cpp | 323 ++++ engines/lab/savegamepalmap.cpp | 3316 ++++++++++++++++++++++++++++++++++++++++ engines/lab/special.cpp | 2219 +++++++++++++++++++++++++++ engines/lab/stddefines.h | 105 ++ engines/lab/storage.cpp | 89 ++ engines/lab/storage.h | 48 + engines/lab/text.cpp | 293 ++++ engines/lab/text.h | 69 + engines/lab/timing.cpp | 147 ++ engines/lab/timing.h | 47 + engines/lab/undiff.cpp | 498 ++++++ engines/lab/vga.cpp | 1082 +++++++++++++ engines/lab/vga.h | 100 ++ 42 files changed, 19438 insertions(+) create mode 100644 engines/lab/allocroom.cpp create mode 100644 engines/lab/audioi.cpp create mode 100644 engines/lab/configure.engine create mode 100644 engines/lab/detection.cpp create mode 100644 engines/lab/diff.h create mode 100644 engines/lab/engine.cpp create mode 100644 engines/lab/graphics.cpp create mode 100644 engines/lab/interface.cpp create mode 100644 engines/lab/interface.h create mode 100644 engines/lab/intro.cpp create mode 100644 engines/lab/lab.cpp create mode 100644 engines/lab/lab.h create mode 100644 engines/lab/labfile.cpp create mode 100644 engines/lab/labfun.h create mode 100644 engines/lab/labmusic.cpp create mode 100644 engines/lab/labsets.cpp create mode 100644 engines/lab/labtext.cpp create mode 100644 engines/lab/machine.cpp create mode 100644 engines/lab/map.cpp create mode 100644 engines/lab/modernsavegame.cpp create mode 100644 engines/lab/modernsavegame.h create mode 100644 engines/lab/module.mk create mode 100644 engines/lab/mouse.cpp create mode 100644 engines/lab/mouse.h create mode 100644 engines/lab/parsefun.h create mode 100644 engines/lab/parsetypes.h create mode 100644 engines/lab/processroom.cpp create mode 100644 engines/lab/readdiff.cpp create mode 100644 engines/lab/readparse.cpp create mode 100644 engines/lab/savegame.cpp create mode 100644 engines/lab/savegamepalmap.cpp create mode 100644 engines/lab/special.cpp create mode 100644 engines/lab/stddefines.h create mode 100644 engines/lab/storage.cpp create mode 100644 engines/lab/storage.h create mode 100644 engines/lab/text.cpp create mode 100644 engines/lab/text.h create mode 100644 engines/lab/timing.cpp create mode 100644 engines/lab/timing.h create mode 100644 engines/lab/undiff.cpp create mode 100644 engines/lab/vga.cpp create mode 100644 engines/lab/vga.h diff --git a/engines/lab/allocroom.cpp b/engines/lab/allocroom.cpp new file mode 100644 index 0000000000..208d7ce8c3 --- /dev/null +++ b/engines/lab/allocroom.cpp @@ -0,0 +1,221 @@ +/* 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. + * + */ + +/* + * This code is based on Labyrinth of Time code with assistance of + * + * Copyright (c) 1993 Terra Nova Development + * Copyright (c) 2004 The Wyrmkeep Entertainment Co. + * + */ + +#include "lab/storage.h" +#include "lab/parsetypes.h" +#include "lab/stddefines.h" + +namespace Lab { + +/* Have to make sure that ROOMBUFFERSIZE is bigger than the biggest piece of memory + that we need */ +#define ROOMBUFFERSIZE (2 * 20480L) +#define EMPTYROOM ((uint16) -1) +#define MAXMARKERS 10 + +extern RoomData *Rooms; +extern uint16 ManyRooms; + + +typedef struct { + uint16 RoomNum; + void *Start0, *End0, *Start1, *End1; +} RoomMarker; + + + +static RoomMarker RoomMarkers[MAXMARKERS]; +static void *RoomBuffer = NULL; +static uint16 CurMarker = 0; +static void *MemPlace = NULL, *NextMemPlace = NULL; +static int32 MemLeftInBuffer = 0L; + +/*****************************************************************************/ +/* Allocates the memory for the room buffers. */ +/*****************************************************************************/ +bool initRoomBuffer(void) { + uint16 counter; + + CurMarker = 0; + + if (allocate((void **)&RoomBuffer, ROOMBUFFERSIZE)) { + MemPlace = RoomBuffer; + MemLeftInBuffer = ROOMBUFFERSIZE; + + for (counter = 0; counter < MAXMARKERS; counter++) + RoomMarkers[counter].RoomNum = EMPTYROOM; + + return true; + } else + return false; +} + + + + +/*****************************************************************************/ +/* Frees the memory for the room buffers. */ +/*****************************************************************************/ +void freeRoomBuffer(void) { + if (RoomBuffer) + deallocate(RoomBuffer, ROOMBUFFERSIZE); +} + + +/*****************************************************************************/ +/* Frees a room's resources. */ +/*****************************************************************************/ +static void freeRoom(uint16 RMarker) { + uint16 RoomNum; + + RoomNum = RoomMarkers[RMarker].RoomNum; + + if (RoomNum != EMPTYROOM) { + Rooms[RoomNum].NorthView = NULL; + Rooms[RoomNum].SouthView = NULL; + Rooms[RoomNum].EastView = NULL; + Rooms[RoomNum].WestView = NULL; + Rooms[RoomNum].RuleList = NULL; + Rooms[RoomNum].RoomMsg = NULL; + } + + RoomMarkers[RMarker].RoomNum = EMPTYROOM; + RoomMarkers[RMarker].Start0 = NULL; + RoomMarkers[RMarker].End0 = NULL; + RoomMarkers[RMarker].Start1 = NULL; + RoomMarkers[RMarker].End1 = NULL; +} + +/*****************************************************************************/ +/* Gets a chunk of memory from the buffer. */ +/*****************************************************************************/ +static void *getCurMem(uint16 Size) { + uint16 counter; + void *Ptr, *Start0, *Start1, *End0, *End1; + + if (((int32) Size) > MemLeftInBuffer) { + MemPlace = RoomBuffer; + MemLeftInBuffer = ROOMBUFFERSIZE; + NextMemPlace = NULL; + } + + Ptr = MemPlace; + MemPlace = (char *)MemPlace + Size; + MemLeftInBuffer -= Size; + + if (MemPlace > NextMemPlace) { + NextMemPlace = NULL; + + for (counter = 0; counter < MAXMARKERS; counter++) { + if (RoomMarkers[counter].RoomNum != EMPTYROOM) { + Start0 = RoomMarkers[counter].Start0; + Start1 = RoomMarkers[counter].Start1; + End0 = RoomMarkers[counter].End0; + End1 = RoomMarkers[counter].End1; + + if (((Start0 >= Ptr) && (Start0 < MemPlace)) || + ((End0 >= Ptr) && (End0 < MemPlace)) || + ((Ptr >= Start0) && (Ptr <= End0)) || + + ((Start1 >= Ptr) && (Start1 < MemPlace)) || + ((End1 >= Ptr) && (End1 < MemPlace)) || + ((Ptr >= Start1) && (Ptr <= End1))) { + freeRoom(counter); + } else { + if (Start0 >= MemPlace) + if ((NextMemPlace == NULL) || (Start0 < NextMemPlace)) + NextMemPlace = Start0; + + if (Start1 >= MemPlace) + if ((NextMemPlace == NULL) || (Start1 < NextMemPlace)) + NextMemPlace = Start1; + } + } + } + + if (NextMemPlace == NULL) { + NextMemPlace = RoomBuffer; + NextMemPlace = (char *)NextMemPlace + ROOMBUFFERSIZE; + } + } + + return Ptr; +} + + + + + +/*****************************************************************************/ +/* Grabs a chunk of memory from the room buffer, and manages it for a */ +/* particular room. */ +/*****************************************************************************/ +void allocRoom(void **Ptr, uint16 Size, uint16 RoomNum) { + uint16 RMarker; + bool doit = true; + + if (1 & Size) /* Memory is required to be even aligned */ + Size++; + + RMarker = 0; + + while ((RMarker < MAXMARKERS) && doit) { + if (RoomMarkers[RMarker].RoomNum == RoomNum) + doit = false; + else + RMarker++; + } + + if (RMarker >= MAXMARKERS) { + RMarker = CurMarker; + CurMarker++; + + if (CurMarker >= MAXMARKERS) + CurMarker = 0; + + freeRoom(RMarker); + RoomMarkers[RMarker].RoomNum = RoomNum; + } + + *Ptr = getCurMem(Size); + + if (RoomMarkers[RMarker].Start0 == NULL) { + RoomMarkers[RMarker].Start0 = *Ptr; + RoomMarkers[RMarker].End0 = (void *)(((char *)(*Ptr)) + Size - 1); + } else if (*Ptr < RoomMarkers[RMarker].Start0) { + if (RoomMarkers[RMarker].Start1 == NULL) + RoomMarkers[RMarker].Start1 = *Ptr; + + RoomMarkers[RMarker].End1 = (void *)(((char *)(*Ptr)) + Size - 1); + } else + RoomMarkers[RMarker].End0 = (void *)(((char *)(*Ptr)) + Size - 1); +} + +} // End of namespace Lab diff --git a/engines/lab/audioi.cpp b/engines/lab/audioi.cpp new file mode 100644 index 0000000000..44ba56e6c5 --- /dev/null +++ b/engines/lab/audioi.cpp @@ -0,0 +1,461 @@ +/* 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. + * + */ + +/* + * This code is based on Labyrinth of Time code with assistance of + * + * Copyright (c) 1993 Terra Nova Development + * Copyright (c) 2004 The Wyrmkeep Entertainment Co. + * + */ + +#include "lab/stddefines.h" + +#include "lab/labfun.h" + +namespace Lab { + +#define PLAYBUFSIZE 65536L + +#if defined(DOSCODE) +const char VERSION[] = "1.01"; + +char *AudioI_DriverName = "a32sbdg.dll"; +#endif + +extern bool MusicOn; + +#if defined(DOSCODE) +static HTIMER server; +static HDRIVER hdriver; +static char *drvr; +static char *dll; +static drvr_desc *desc; +#endif +//static sound_buff firstblock, tempblock; +static int bufnum; +#if defined(DOSCODE) +static unsigned seg1; +static unsigned seg2; +static union REGS inregs, outregs; +#endif + + +bool EffectPlaying = false, ContMusic = false, DoMusic = false; +static char *CurMusic, *startMusic; +static uint32 StartMusicLen; + + +#if defined(DOSCODE) +static uint16 *mem, *head, *tail, counter; + +#pragma off (check_stack) +void cdecl timer_callback(void) { + + head = (uint16 *)(0x41A); + tail = (uint16 *)(0x41C); + mem = (uint16 *)(0x400 + *head); + + if (*tail > *head) + counter = (*tail - *head) >> 1; + else + counter = (*head - *tail) >> 1; + + if (counter > 16) + counter = 16; + + while (counter) { + if ((*mem == 0x2e03) || (*mem == 0x300) || (*mem == 0x0003)) { + *tail = *head; + return; + } + + mem++; + counter--; + } +} +#endif + +void freeAudio(void) { + if (!DoMusic) + return; + +#if defined(DOSCODE) + AIL_release_timer_handle(server); + + AIL_shutdown(NULL); +#else + //SDLWrapAudio(); +#endif +} + + + +bool initAudio(void) { + if (!DoMusic) + return true; + +#if 0 +#if defined(DOSCODE) + + AudioI_DriverName = "a32sbdg.dll"; + + // + // Allocate two 16K buffers from real-mode (lower 1MB) memory + // + // *buf1, *buf2 -> protected-mode pointers to buffers (sel:0000) + // *seg1, *seg2 -> real-mode (physical) pointers to buffers (seg:0000) + // + // Note: DPMI calculations assume flat model near pointer offset 0 = + // segment 0, offset 0 (Rational DOS4GW). The reason -- our simple + // file loader function can't use the far pointer formed by the selector + // returned by the DPMI call. + + // Note that these examples do not implement out-of-memory error + // checking + // + + inregs.x.eax = 0x100; + inregs.x.ebx = (16384 / 16); + int386(0x31, &inregs, &outregs); + + seg1 = outregs.x.eax << 16; + buf1 = (char *)(outregs.x.eax * 16); + + if (buf1 == NULL) + return false; + + inregs.x.eax = 0x100; + inregs.x.ebx = (16384 / 16); + int386(0x31, &inregs, &outregs); + + seg2 = outregs.x.eax << 16; + buf2 = (char *)(outregs.x.eax * 16); + + if (buf2 == NULL) + return false; + + // + // Load driver file + // + + dll = FILE_read(AudioI_DriverName, NULL); + + if (dll == NULL) { + return false; + } + + drvr = DLL_load(dll, DLLMEM_ALLOC | DLLSRC_MEM, NULL); + + if (drvr == NULL) { + return false; + } + + free(dll); + + // + // Initialize API before calling any Library functions + // + + AIL_startup(); + + hdriver = AIL_register_driver(drvr); + + if (hdriver == -1) { + AIL_shutdown(NULL); + return false; + } + + // + // Get driver type and factory default I/O parameters; exit if + // driver is not capable of interpreting PCM sound data + // + + desc = AIL_describe_driver(hdriver); + + if (desc->drvr_type != DSP_DRVR) { + AIL_shutdown(NULL); + return false; + } + + if (!AIL_detect_device(hdriver, desc->default_IO, desc->default_IRQ, desc->default_DMA, desc->default_DRQ)) { + desc->default_IRQ = 5; + + if (!AIL_detect_device(hdriver, desc->default_IO, desc->default_IRQ, desc->default_DMA, desc->default_DRQ)) { + AIL_shutdown(NULL); + return false; + } + } + + AIL_init_driver(hdriver, desc->default_IO, desc->default_IRQ, desc->default_DMA, desc->default_DRQ); + + // + // Register a timer function; set up for 10-millisecond (100 Hz.) + // callback intervals + // + + server = AIL_register_timer(timer_callback); + + if (server != -1) { + AIL_set_timer_period(server, 20000L); + AIL_start_timer(server); + } + +#else + // we allocate extra mempory for 16-bit samples + buf1 = malloc(PLAYBUFSIZE); + + if (buf1 == NULL) + return false; + + buf2 = malloc(PLAYBUFSIZE); + + if (buf2 == NULL) + return false; + + if (!SDLInitAudio()) + return false; + +#endif +#endif + + return true; +} + + +void initSampleRate(uint16 SampleSpeed) { + flushAudio(); + + if (SampleSpeed < 4000) + SampleSpeed = 4000; + +#if defined(DOSCODE) + firstblock.sample_rate = 256 - (1000000L / SampleSpeed); + firstblock.pack_type = 0 | 0x80; // 8-bit mono sample +#else + //firstblock.sample_rate = SampleSpeed; + //firstblock.pack_type = AUDIO_S16; // SOUND_MONO | SOUND_16BIT; // 16-bit mono sample +#endif +} + + + + +bool musicBufferEmpty(uint16 i) { +#if defined(NEWCODE) + return (AIL_sound_buffer_status(hdriver, i) == DAC_DONE); +#else + //return (SDLSoundBufferStatus(i) == DAC_DONE); + return true; +#endif +} + + + +void playMusicBlock(void *Ptr, uint32 Size, uint16 BufferNum, uint16 SampleSpeed) { +#if defined(DOSCODE) + uint32 TempPtr; + uint32 seg; + char *buf; + + TempPtr = ((uint32) Ptr) / 16L; + + seg = TempPtr << 16; + buf = (char *)(TempPtr * 16); + + if (SampleSpeed < 4000) + SampleSpeed = 4000; + + firstblock.sample_rate = 256 - (1000000L / SampleSpeed); + firstblock.pack_type = 0 | 0x80; // 8-bit mono sample + + tempblock = firstblock; + tempblock.sel_data = buf; + tempblock.seg_data = seg; + tempblock.len = Size; + + AIL_register_sound_buffer(hdriver, BufferNum, &tempblock); + AIL_format_sound_buffer(hdriver, &tempblock); + + AIL_start_digital_playback(hdriver); + AIL_set_digital_playback_volume(hdriver, 127); +#else +#if 0 + + if (SampleSpeed < 4000) + SampleSpeed = 4000; + + firstblock.sample_rate = SampleSpeed; + firstblock.pack_type = SOUND_MONO | SOUND_16BIT; // 16-bit mono sample + + tempblock = firstblock; + tempblock.sel_data = Ptr; + tempblock.len = Size; + + SDLPlayBuffer(BufferNum, &tempblock); +#endif +#endif +} + + +void updateSoundBuffers(void) { + if (!DoMusic) + return; + + if (!EffectPlaying) + return; + +#if defined(DOSCODE) + + for (int i = 0; i < 2; i++) { + if ((AIL_sound_buffer_status(hdriver, i) == DAC_DONE) && firstblock.len) { + tempblock.len = min(16384L, firstblock.len); + firstblock.len -= tempblock.len; + + if (!(bufnum ^= 1)) { + memcpy(buf1, CurMusic, (unsigned) tempblock.len); + tempblock.sel_data = buf1; + tempblock.seg_data = seg1; + } else { + memcpy(buf2, CurMusic, (unsigned) tempblock.len); + tempblock.sel_data = buf2; + tempblock.seg_data = seg2; + } + + CurMusic += tempblock.len; + + AIL_register_sound_buffer(hdriver, i, &tempblock); + AIL_format_sound_buffer(hdriver, &tempblock); + + AIL_start_digital_playback(hdriver); + AIL_set_digital_playback_volume(hdriver, 127); + } + } + + // + // Playback ends when no bytes are left in the source data and + // the status of both buffers equals DAC_DONE + // + + if (!firstblock.len) { + if (ContMusic) { + CurMusic = startMusic; + firstblock.len = StartMusicLen; + } else if ((AIL_sound_buffer_status(hdriver, 0) == DAC_DONE) && + (AIL_sound_buffer_status(hdriver, 1) == DAC_DONE)) { + flushAudio(); + EffectPlaying = false; + } + } + +#else +#if 0 + + for (int i = 0; i < 2; i++) { + if ((SDLSoundBufferStatus(i) == DAC_DONE) && firstblock.len) { + // use extra memory for 16-bit samples + tempblock.len = min(PLAYBUFSIZE, firstblock.len); + firstblock.len -= tempblock.len; + + if (!(bufnum ^= 1)) { + memcpy(buf1, CurMusic, (unsigned) tempblock.len); + tempblock.sel_data = buf1; + } else { + memcpy(buf2, CurMusic, (unsigned) tempblock.len); + tempblock.sel_data = buf2; + } + + CurMusic += tempblock.len; + + SDLPlayBuffer(i, &tempblock); + } + } + + // + // Playback ends when no bytes are left in the source data and + // the status of both buffers equals DAC_DONE + // + + if (!firstblock.len) { + if (ContMusic) { + CurMusic = startMusic; + firstblock.len = StartMusicLen; + } else if ((SDLSoundBufferStatus(0) == DAC_DONE) && + (SDLSoundBufferStatus(1) == DAC_DONE)) { + flushAudio(); + EffectPlaying = false; + } + } + +#endif +#endif +} + + + +void flushAudio(void) { + if (!DoMusic) + return; + +#if defined(DOSCODE) + AIL_stop_digital_playback(hdriver); +#else + //SDLStopPlayback(); +#endif + EffectPlaying = false; +} + + + + +void playMusic(uint16 SampleSpeed, uint16 Volume, uint32 Length, bool flush, void *Data) { + if (!DoMusic) + return; + + g_music->pauseBackMusic(); + + if (flush) + flushAudio(); + + if (SampleSpeed < 4000) + SampleSpeed = 4000; + +#if defined(DOSCODE) + firstblock.sample_rate = 256 - (1000000L / SampleSpeed); + firstblock.pack_type = 0 | 0x80; // 8-bit mono sample +#else + //firstblock.sample_rate = SampleSpeed; + //firstblock.pack_type = SOUND_MONO | SOUND_16BIT; // 16-bit mono sample +#endif + //firstblock.len = Length; + bufnum = 0; + + //tempblock = firstblock; + EffectPlaying = true; + CurMusic = (char *)Data; + startMusic = CurMusic; + StartMusicLen = Length; + + updateSoundBuffers(); +} + +} // End of namespace Lab diff --git a/engines/lab/configure.engine b/engines/lab/configure.engine new file mode 100644 index 0000000000..df154b4d8e --- /dev/null +++ b/engines/lab/configure.engine @@ -0,0 +1,3 @@ +# This file is included from the main "configure" script +# add_engine [name] [desc] [build-by-default] [subengines] [base games] [deps] +add_engine lab "Labirynth of Time" no diff --git a/engines/lab/detection.cpp b/engines/lab/detection.cpp new file mode 100644 index 0000000000..f7632c76be --- /dev/null +++ b/engines/lab/detection.cpp @@ -0,0 +1,104 @@ +/* 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. + * + */ + + /* + * This code is based on Labyrinth of Time code with assistance of + * + * Copyright (c) 1993 Terra Nova Development + * Copyright (c) 2004 The Wyrmkeep Entertainment Co. + * + */ + +#include "engines/advancedDetector.h" +#include "common/system.h" + +#include "base/plugins.h" + +#include "lab/lab.h" + +static const PlainGameDescriptor lab_setting[] = { + { "lab", "Labyrith of Time Engine game" }, + { 0, 0 } +}; + +static const ADGameDescription labDescriptions[] = { + { + "lab", + "", + { + { "doors", 0, "d77536010e7e5ae17ee066323ceb9585", 2537 }, + { "notes11", 0, "63e873f659f8f46f9809d16a2bf653c7", 3562 }, + { NULL, 0, NULL, 0 } + }, + Common::EN_ANY, + Common::kPlatformDOS, + ADGF_NO_FLAGS, + GUIO0() + }, + { + "lab", + "", + AD_ENTRY1s("doors", "7bf458df6ec30cc8ef4665e4d7c77f59", 2537), + Common::EN_ANY, + Common::kPlatformAmiga, + ADGF_NO_FLAGS, + GUIO0() + }, + AD_TABLE_END_MARKER +}; + +static const char *const directoryGlobs[] = { + "fonts", + "game", + 0 +}; + +class LabMetaEngine : public AdvancedMetaEngine { +public: + LabMetaEngine() : AdvancedMetaEngine(labDescriptions, sizeof(ADGameDescription), lab_setting) { + _singleid = "lab"; + + _maxScanDepth = 2; + _directoryGlobs = directoryGlobs; + } + + virtual const char *getName() const { + return "Lab"; + } + + virtual const char *getOriginalCopyright() const { + return "Labytinth of Time (c) 2004 The Wyrmkeep Entertainment Co."; + } + + virtual bool createInstance(OSystem *syst, Engine **engine, const ADGameDescription * /* desc */) const { + // Instantiate Engine even if the game data is not found. + *engine = new Lab::LabEngine(syst); + return true; + } + +}; + +#if PLUGIN_ENABLED_DYNAMIC(LAB) + REGISTER_PLUGIN_DYNAMIC(LAB, PLUGIN_TYPE_ENGINE, LabMetaEngine); +#else + REGISTER_PLUGIN_STATIC(LAB, PLUGIN_TYPE_ENGINE, LabMetaEngine); +#endif diff --git a/engines/lab/diff.h b/engines/lab/diff.h new file mode 100644 index 0000000000..e46e320a13 --- /dev/null +++ b/engines/lab/diff.h @@ -0,0 +1,102 @@ +/* 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. + * + */ + +/* + * This code is based on Labyrinth of Time code with assistance of + * + * Copyright (c) 1993 Terra Nova Development + * Copyright (c) 2004 The Wyrmkeep Entertainment Co. + * + */ + +#ifndef LAB_DIFF_H +#define LAB_DIFF_H + +#include "lab/stddefines.h" + +namespace Lab { + + +struct DIFFHeader { + uint16 Version, x, y; + char depth, fps; + uint32 BufferSize; + uint16 Machine; + uint32 Flags; +}; + +struct BitMap { + uint16 BytesPerRow, Rows; + byte Flags, Depth; + byte *Planes[16]; +}; + +#if !defined(DOSCODE) +#define BITMAPF_VIDEO (1<<7) +#endif + +/* unDiff.c */ + +void initOffsets(uint16 bytesperrow); + +bool unDIFFMemory(byte *Dest, /* Where to Un-DIFF */ + byte *diff, /* The DIFFed code. */ + uint16 HeaderSize, /* Size of header (1, 2 or 4 bytes) + (only supports 1 currently */ + uint16 CopySize); /* Size of minimum copy or skip. + (1, 2 or 4 bytes) */ + +bool VUnDIFFMemory(byte *Dest, byte *diff, uint16 HeaderSize, uint16 CopySize, uint16 bytesperrow); + +void runLengthDecode(byte *Dest, byte *Source); + +void VRunLengthDecode(byte *Dest, byte *Source, uint16 bytesperrow); + +/* readDiff.c */ + +void blackScreen(); + +void blackAllScreen(); + +void whiteScreen(void); + +bool readDiff(bool playonce); + +void diffNextFrame(void); + +void playCntMusic(void); + +void readSound(void); + +void stopDiff(void); + +void stopDiffEnd(void); + +void stopSound(void); + +void diffSetMusic(void); + +} // End of namespace Lab + +#endif /* LAB_DIFF_H */ + + diff --git a/engines/lab/engine.cpp b/engines/lab/engine.cpp new file mode 100644 index 0000000000..b0b8614d74 --- /dev/null +++ b/engines/lab/engine.cpp @@ -0,0 +1,1834 @@ +/* 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. + * + */ + +/* + * This code is based on Labyrinth of Time code with assistance of + * + * Copyright (c) 1993 Terra Nova Development + * Copyright (c) 2004 The Wyrmkeep Entertainment Co. + * + */ + +#include "lab/stddefines.h" +#include "lab/labfun.h" +#include "lab/diff.h" +#include "lab/vga.h" +#include "lab/timing.h" +#include "lab/text.h" +#include "lab/storage.h" +#include "lab/parsefun.h" +#include "lab/interface.h" +#include "lab/mouse.h" + +namespace Lab { + +const char *CurFileName = " "; + +bool LongWinInFront = false; + +struct TextFont *MsgFont; + +extern bool DoBlack, waiteffect, EffectPlaying, stopsound, DoNotDrawMessage, IsHiRes, nopalchange, DoMusic; + +/* Global parser data */ + +extern RoomData *Rooms; +extern InventoryData *Inventory; +extern uint16 NumInv, RoomNum, ManyRooms, HighestCondition, Direction; +extern LargeSet Conditions, RoomsFound; +CloseDataPtr CPtr; + +#if !defined(DOSCODE) +CrumbData BreadCrumbs[MAX_CRUMBS]; +uint16 NumCrumbs; +bool DroppingCrumbs; +bool FollowingCrumbs; +bool FollowCrumbsFast; +bool IsCrumbTurning; +uint32 CrumbSecs, CrumbMicros; +bool IsCrumbWaiting; + +int followCrumbs(); +void mayShowCrumbIndicator(); +void mayShowCrumbIndicatorOff(); +#endif + +bool Alternate = false, ispal = false, noupdatediff = false, MainDisplay = true, QuitLab = false, DoNotReset = false; + +extern char *NewFileName; /* When ProcessRoom.c decides to change the filename + of the current picture. */ + +extern char *LAMPONMSG, *TURNLEFT, *TURNRIGHT; +extern char *GOFORWARDDIR, *NOPATH, *TAKEITEM, *USEONWHAT, *TAKEWHAT, *MOVEWHAT, *OPENWHAT, *CLOSEWHAT, *LOOKWHAT, *NOTHING, *USEMAP, *USEJOURNAL, *TURNLAMPON, *TURNLAMPOFF, *USEWHISKEY, *USEPITH, *USEHELMET; + + +#define BIGBUFFERSIZE 850000L +#define SMALLBUFFERSIZE 250000L + +static uint32 BUFFERSIZE = BIGBUFFERSIZE; + + +/* LAB: Labyrinth specific code for the special puzzles */ +#define SPECIALLOCK 100 +#define SPECIALBRICK 101 +#define SPECIALBRICKNOMOUSE 102 + +#define MAPNUM 28 +#define JOURNALNUM 9 +#define WESTPAPERNUM 18 +#define NOTESNUM 12 +#define WHISKEYNUM 25 +#define PITHHELMETNUM 7 +#define HELMETNUM 1 + +#define LAMPNUM 27 +#define LAMPON 151 + +#define BELTNUM 3 +#define BELTGLOW 70 + +#define USEDHELMET 184 + +#define QUARTERNUM 30 + + +#define MUSEUMMONITOR 71 +#define GRAMAPHONEMONITOR 72 +#define UNICYCLEMONITOR 73 +#define STATUEMONITOR 74 +#define TALISMANMONITOR 75 +#define LUTEMONITOR 76 +#define CLOCKMONITOR 77 +#define WINDOWMONITOR 78 +#define BELTMONITOR 79 +#define LIBRARYMONITOR 80 +#define TERMINALMONITOR 81 +#define LEVERSMONITOR 82 + + +#define CLOWNROOM 123 +#define DIMROOM 80 + + + +static byte *MovePanelBuffer, *InvPanelBuffer; +static uint32 MovePanelBufferSize, InvPanelBufferSize; +static struct Image *MoveImages[20], +#if defined(DOSCODE) + *InvImages[6]; +#else + *InvImages[10]; +#endif +static struct Gadget *MoveGadgetList, *InvGadgetList; + + +static char initcolors[] = { '\x00', '\x00', '\x00', '\x30', + '\x30', '\x30', '\x10', '\x10', + '\x10', '\x14', '\x14', '\x14', + '\x20', '\x20', '\x20', '\x24', + '\x24', '\x24', '\x2c', '\x2c', + '\x2c', '\x08', '\x08', '\x08'}; + + + + +/******************************************************************************/ +/* Draws the control panel display. */ +/******************************************************************************/ +void drawPanel(void) { + mouseHide(); + + setAPen(3); /* Clear Area */ + rectFill(0, VGAScaleY(149) + SVGACord(2), VGAScaleX(319), VGAScaleY(199)); + + setAPen(0); /* First Line */ + drawHLine(0, VGAScaleY(149) + SVGACord(2), VGAScaleX(319)); + setAPen(5); /* Second Line */ + drawHLine(0, VGAScaleY(149) + 1 + SVGACord(2), VGAScaleX(319)); + + /* Gadget Seperators */ + setAPen(0); + drawHLine(0, VGAScaleY(170), VGAScaleX(319)); /* First black line to seperate buttons */ + + if (!Alternate) { + setAPen(4); + drawHLine(0, VGAScaleY(170) + 1, VGAScaleX(319)); /* The horizontal lines under the black one */ + drawGadgetList(MoveGadgetList); + } else { +#if defined(DOSCODE) + drawVLine(VGAScaleX(124), VGAScaleY(170) + 1, VGAScaleY(199)); /* Vertical Black lines */ + drawVLine(VGAScaleX(194), VGAScaleY(170) + 1, VGAScaleY(199)); +#else + drawVLine(VGAScaleX(90), VGAScaleY(170) + 1, VGAScaleY(199)); /* Vertical Black lines */ + drawVLine(VGAScaleX(160), VGAScaleY(170) + 1, VGAScaleY(199)); + drawVLine(VGAScaleX(230), VGAScaleY(170) + 1, VGAScaleY(199)); +#endif + + setAPen(4); + drawHLine(0, VGAScaleY(170) + 1, VGAScaleX(122)); /* The horizontal lines under the black one */ + drawHLine(VGAScaleX(126), VGAScaleY(170) + 1, VGAScaleX(192)); + drawHLine(VGAScaleX(196), VGAScaleY(170) + 1, VGAScaleX(319)); + + drawVLine(VGAScaleX(1), VGAScaleY(170) + 2, VGAScaleY(198)); /* The vertical high light lines */ +#if defined(DOSCODE) + drawVLine(VGAScaleX(126), VGAScaleY(170) + 2, VGAScaleY(198)); + drawVLine(VGAScaleX(196), VGAScaleY(170) + 2, VGAScaleY(198)); +#else + drawVLine(VGAScaleX(92), VGAScaleY(170) + 2, VGAScaleY(198)); + drawVLine(VGAScaleX(162), VGAScaleY(170) + 2, VGAScaleY(198)); + drawVLine(VGAScaleX(232), VGAScaleY(170) + 2, VGAScaleY(198)); +#endif + + drawGadgetList(InvGadgetList); + } + + mouseShow(); +} + + +extern bool LastMessageLong; + +static bool LastTooLong = false; + + + + +/******************************************************************************/ +/* Draws the message for the room. */ +/******************************************************************************/ +static void drawRoomMessage(uint16 CurInv, CloseDataPtr cptr) { + char text[250], ManyText[8], *ManyPtr; + + if (LastTooLong) { + LastTooLong = false; + return; + } + + if (Alternate) { + if ((CurInv <= NumInv) && In(Conditions, CurInv) && Inventory[CurInv].BInvName) { + if ((CurInv == LAMPNUM) && In(Conditions, LAMPON)) /* LAB: Labyrith specific */ + drawMessage(LAMPONMSG); + else if (Inventory[CurInv].Many > 1) { + ManyPtr = numtostr(ManyText, Inventory[CurInv].Many); + strcpy(text, Inventory[CurInv].name); + strcat(text, " ("); + strcat(text, ManyPtr); + strcat(text, ")"); + drawMessage(text); + } else + drawMessage(Inventory[CurInv].name); + } + } else + drawDirection(cptr); + + LastTooLong = LastMessageLong; +} + + +static uint16 OldMode; + +/******************************************************************************/ +/* Sets up the Labyrinth screens, and opens up the initial windows. */ +/******************************************************************************/ +bool setUpScreens(void) { + uint16 counter; + byte *bufferstorage, **buffer = &bufferstorage; + struct Gadget *curgad; + uint16 y; + + if (!createScreen(IsHiRes)) + return false; + + /* Loads in the graphics for the movement control panel */ + MovePanelBufferSize = sizeOfFile("P:Control"); + + if (MovePanelBufferSize == 0L) + return false; + + if (!allocate((void **) &MovePanelBuffer, MovePanelBufferSize)) + return false; + + Common::File *file = openPartial("P:Control"); + + if (!file) + return false; + + file->read(MovePanelBuffer, MovePanelBufferSize); + file->close(); + + *buffer = MovePanelBuffer; + + for (counter = 0; counter < 20; counter++) + readImage(buffer, &(MoveImages[counter])); + + /* Creates the gadgets for the movement control panel */ + y = VGAScaleY(173) - SVGACord(2); +#if !defined(DOSCODE) + MoveGadgetList = createButton(VGAScaleX(1), y, 0, 't', MoveImages[0], MoveImages[1]); + curgad = MoveGadgetList; + curgad->NextGadget = createButton(VGAScaleX(33), y, 1, 'm', MoveImages[2], MoveImages[3]); + curgad = curgad->NextGadget; + curgad->NextGadget = createButton(VGAScaleX(65), y, 2, 'o', MoveImages[4], MoveImages[5]); + curgad = curgad->NextGadget; + curgad->NextGadget = createButton(VGAScaleX(97), y, 3, 'c', MoveImages[6], MoveImages[7]); + curgad = curgad->NextGadget; + curgad->NextGadget = createButton(VGAScaleX(129), y, 4, 'l', MoveImages[8], MoveImages[9]); + curgad = curgad->NextGadget; + curgad->NextGadget = createButton(VGAScaleX(161), y, 5, 'i', MoveImages[12], MoveImages[13]); + curgad = curgad->NextGadget; + curgad->NextGadget = createButton(VGAScaleX(193), y, 6, VKEY_LTARROW, MoveImages[14], MoveImages[15]); + curgad = curgad->NextGadget; + curgad->NextGadget = createButton(VGAScaleX(225), y, 7, VKEY_UPARROW, MoveImages[16], MoveImages[17]); + curgad = curgad->NextGadget; + curgad->NextGadget = createButton(VGAScaleX(257), y, 8, VKEY_RTARROW, MoveImages[18], MoveImages[19]); + curgad = curgad->NextGadget; + curgad->NextGadget = createButton(VGAScaleX(289), y, 9, 'p', MoveImages[10], MoveImages[11]); +#else + MoveGadgetList = createButton(VGAScaleX(1), y, 0, MoveImages[0], MoveImages[1]); + curgad = MoveGadgetList; + curgad->NextGadget = createButton(VGAScaleX(33), y, 1, MoveImages[2], MoveImages[3]); + curgad = curgad->NextGadget; + curgad->NextGadget = createButton(VGAScaleX(65), y, 2, MoveImages[4], MoveImages[5]); + curgad = curgad->NextGadget; + curgad->NextGadget = createButton(VGAScaleX(97), y, 3, MoveImages[6], MoveImages[7]); + curgad = curgad->NextGadget; + curgad->NextGadget = createButton(VGAScaleX(129), y, 4, MoveImages[8], MoveImages[9]); + curgad = curgad->NextGadget; + curgad->NextGadget = createButton(VGAScaleX(161), y, 5, MoveImages[12], MoveImages[13]); + curgad = curgad->NextGadget; + curgad->NextGadget = createButton(VGAScaleX(193), y, 6, MoveImages[14], MoveImages[15]); + curgad = curgad->NextGadget; + curgad->NextGadget = createButton(VGAScaleX(225), y, 7, MoveImages[16], MoveImages[17]); + curgad = curgad->NextGadget; + curgad->NextGadget = createButton(VGAScaleX(257), y, 8, MoveImages[18], MoveImages[19]); + curgad = curgad->NextGadget; + curgad->NextGadget = createButton(VGAScaleX(289), y, 9, MoveImages[10], MoveImages[11]); +#endif + + InvPanelBufferSize = sizeOfFile("P:Inv"); + + if (InvPanelBufferSize == 0L) + return false; + + if (!allocate((void **) &InvPanelBuffer, InvPanelBufferSize)) + return false; + + file = openPartial("P:Inv"); + + if (!file) + return false; + + file->read(InvPanelBuffer, InvPanelBufferSize); + file->close(); + + *buffer = InvPanelBuffer; +#if !defined(DOSCODE) + + for (counter = 0; counter < 10; counter++) + readImage(buffer, &(InvImages[counter])); + + InvGadgetList = createButton(VGAScaleX(24), y, 0, 'm', InvImages[0], InvImages[1]); + curgad = InvGadgetList; + curgad->NextGadget = createButton(VGAScaleX(56), y, 1, 'g', InvImages[2], InvImages[3]); + curgad = curgad->NextGadget; + curgad->NextGadget = createButton(VGAScaleX(94), y, 2, 'u', InvImages[4], InvImages[5]); + curgad = curgad->NextGadget; + curgad->NextGadget = createButton(VGAScaleX(126), y, 3, 'l', MoveImages[8], MoveImages[9]); + curgad = curgad->NextGadget; + curgad->NextGadget = createButton(VGAScaleX(164), y, 4, VKEY_LTARROW, MoveImages[14], MoveImages[15]); + curgad = curgad->NextGadget; + curgad->NextGadget = createButton(VGAScaleX(196), y, 5, VKEY_RTARROW, MoveImages[18], MoveImages[19]); + curgad = curgad->NextGadget; + curgad->NextGadget = createButton(VGAScaleX(234), y, 6, 'b', InvImages[6], InvImages[7]); + curgad = curgad->NextGadget; + curgad->NextGadget = createButton(VGAScaleX(266), y, 7, 'f', InvImages[8], InvImages[9]); + curgad = curgad->NextGadget; +#else + + for (counter = 0; counter < 6; counter++) + readImage(buffer, &(InvImages[counter])); + + InvGadgetList = createButton(VGAScaleX(58), y, 0, InvImages[0], InvImages[1]); + curgad = InvGadgetList; + curgad->NextGadget = createButton(VGAScaleX(90), y, 1, InvImages[2], InvImages[3]); + curgad = curgad->NextGadget; + curgad->NextGadget = createButton(VGAScaleX(128), y, 2, InvImages[4], InvImages[5]); + curgad = curgad->NextGadget; + curgad->NextGadget = createButton(VGAScaleX(160), y, 3, MoveImages[8], MoveImages[9]); + curgad = curgad->NextGadget; + curgad->NextGadget = createButton(VGAScaleX(198), y, 4, MoveImages[14], MoveImages[15]); + curgad = curgad->NextGadget; + curgad->NextGadget = createButton(VGAScaleX(230), y, 5, MoveImages[18], MoveImages[19]); + curgad = curgad->NextGadget; +#endif + + return true; +} + + + + + +uint16 curmousex = 0, curmousey = 0; + + + +/******************************************************************************/ +/* Permanently flips the imagry of a gadget. */ +/******************************************************************************/ +static void perFlipGadget(uint16 GadID) { + struct Image *Temp; + struct Gadget *TopGad; + + TopGad = MoveGadgetList; + + while (TopGad) { + if (TopGad->GadgetID == GadID) { + Temp = TopGad->Im; + TopGad->Im = TopGad->ImAlt; + TopGad->ImAlt = Temp; + + if (!Alternate) { + mouseHide(); + drawImage(TopGad->Im, TopGad->x, TopGad->y); + mouseShow(); + } + + return; + } else + TopGad = TopGad->NextGadget; + } +} + + + +/******************************************************************************/ +/* Eats all the available messages. */ +/******************************************************************************/ +void eatMessages(void) { + struct IntuiMessage *Msg; + + do { + Msg = getMsg(); + + if (Msg) { + replyMsg((void *) Msg); + } + } while (Msg); + + return; +} + + + + + +static uint16 lastmusicroom = 1; + + +/******************************************************************************/ +/* Checks the music that should be playing in a particular room. */ +/******************************************************************************/ +static void checkRoomMusic(void) { + if ((lastmusicroom == RoomNum) || !g_music->_musicOn) + return; + + if (RoomNum == CLOWNROOM) + g_music->changeMusic("Music:Laugh"); + else if (RoomNum == DIMROOM) + g_music->changeMusic("Music:Rm81"); + else if (!DoNotReset) + g_music->resetMusic(); + + lastmusicroom = RoomNum; +} + + + +#if defined(DOSCODE) +#define MONLTMARGIN 0 +#define MONRTMARGIN 319 +#define MONTOPMARGIN 0 +#define LUTERTMARGIN 124 +#else +#define MONLTMARGIN 2 +#define MONRTMARGIN 317 +#define MONTOPMARGIN 2 +#define LUTERTMARGIN 128 +#endif + +/******************************************************************************/ +/* Checks whether the close up is one of the special case closeups. */ +/******************************************************************************/ +static bool doCloseUp(CloseDataPtr cptr) { + if (cptr == NULL) + return false; + + if ((cptr->CloseUpType == MUSEUMMONITOR) || (cptr->CloseUpType == LIBRARYMONITOR) || + (cptr->CloseUpType == WINDOWMONITOR)) + doMonitor(cptr->GraphicName, cptr->Message, false, MONLTMARGIN, MONTOPMARGIN, MONRTMARGIN, 165); + else if (cptr->CloseUpType == GRAMAPHONEMONITOR) + doMonitor(cptr->GraphicName, cptr->Message, false, MONLTMARGIN, MONTOPMARGIN, 171, 165); + else if (cptr->CloseUpType == UNICYCLEMONITOR) + doMonitor(cptr->GraphicName, cptr->Message, false, 100, MONTOPMARGIN, MONRTMARGIN, 165); + else if (cptr->CloseUpType == STATUEMONITOR) + doMonitor(cptr->GraphicName, cptr->Message, false, 117, MONTOPMARGIN, MONRTMARGIN, 165); + else if (cptr->CloseUpType == TALISMANMONITOR) + doMonitor(cptr->GraphicName, cptr->Message, false, MONLTMARGIN, MONTOPMARGIN, 184, 165); + else if (cptr->CloseUpType == LUTEMONITOR) + doMonitor(cptr->GraphicName, cptr->Message, false, MONLTMARGIN, MONTOPMARGIN, LUTERTMARGIN, 165); + else if (cptr->CloseUpType == CLOCKMONITOR) + doMonitor(cptr->GraphicName, cptr->Message, false, MONLTMARGIN, MONTOPMARGIN, 206, 165); + else if (cptr->CloseUpType == TERMINALMONITOR) + doMonitor(cptr->GraphicName, cptr->Message, true, MONLTMARGIN, MONTOPMARGIN, MONRTMARGIN, 165); + else + return false; + + CurFileName = " "; + drawPanel(); + + return true; +} + + + + +/******************************************************************************/ +/* Gets the current inventory name. */ +/******************************************************************************/ +static const char *getInvName(uint16 CurInv) { + if (MainDisplay) + return Inventory[CurInv].BInvName; + + if ((CurInv == LAMPNUM) && In(Conditions, LAMPON)) + return "P:Mines/120"; + + else if ((CurInv == BELTNUM) && In(Conditions, BELTGLOW)) + return "P:Future/BeltGlow"; + + else if (CurInv == WESTPAPERNUM) { + CurFileName = Inventory[CurInv].BInvName; + nopalchange = true; + readPict(CurFileName, false); + nopalchange = false; + doWestPaper(); + } + + else if (CurInv == NOTESNUM) { + CurFileName = Inventory[CurInv].BInvName; + nopalchange = true; + readPict(CurFileName, false); + nopalchange = false; + doNotes(); + } + + return Inventory[CurInv].BInvName; +} + + + + +static bool interfaceisoff = false; + + +/******************************************************************************/ +/* Turns the interface off. */ +/******************************************************************************/ +static void interfaceOff(void) { + if (!interfaceisoff) { + attachGadgetList(NULL); + mouseHide(); + interfaceisoff = true; + } +} + + + + +/******************************************************************************/ +/* Turns the interface on. */ +/******************************************************************************/ +static void interfaceOn(void) { + if (interfaceisoff) { + interfaceisoff = false; + + mouseShow(); + } + + if (LongWinInFront) + attachGadgetList(NULL); + else if (Alternate) + attachGadgetList(InvGadgetList); + else + attachGadgetList(MoveGadgetList); +} + + + +static const char *Test; + + +/******************************************************************************/ +/* If the user hits the "Use" gadget; things that can get used on themselves. */ +/******************************************************************************/ +static bool doUse(uint16 CurInv) { + + if (CurInv == MAPNUM) { /* LAB: Labyrinth specific */ + drawMessage(USEMAP); + interfaceOff(); + stopDiff(); + CurFileName = " "; + CPtr = NULL; + doMap(RoomsFound, RoomNum); + VGASetPal(initcolors, 8); + drawMessage(NULL); + drawPanel(); + } + + else if (CurInv == JOURNALNUM) { /* LAB: Labyrinth specific */ + drawMessage(USEJOURNAL); + interfaceOff(); + stopDiff(); + CurFileName = " "; + CPtr = NULL; + doJournal(Conditions); + drawPanel(); + drawMessage(NULL); + } + + else if (CurInv == LAMPNUM) { /* LAB: Labyrinth specific */ + interfaceOff(); + + if (In(Conditions, LAMPON)) { + drawMessage(TURNLAMPOFF); + exclElement(Conditions, LAMPON); + } else { + drawMessage(TURNLAMPON); + inclElement(Conditions, LAMPON); + } + + DoBlack = false; + waiteffect = true; + readPict("Music:Click", true); + waiteffect = false; + + DoBlack = false; + Test = getInvName(CurInv); + } + + else if (CurInv == BELTNUM) { /* LAB: Labyrinth specific */ + if (!In(Conditions, BELTGLOW)) + inclElement(Conditions, BELTGLOW); + + DoBlack = false; + Test = getInvName(CurInv); + } + + else if (CurInv == WHISKEYNUM) { /* LAB: Labyrinth specific */ + inclElement(Conditions, USEDHELMET); + drawMessage(USEWHISKEY); + } + + else if (CurInv == PITHHELMETNUM) { /* LAB: Labyrinth specific */ + inclElement(Conditions, USEDHELMET); + drawMessage(USEPITH); + } + + else if (CurInv == HELMETNUM) { /* LAB: Labyrinth specific */ + inclElement(Conditions, USEDHELMET); + drawMessage(USEHELMET); + } + + else + return false; + + return true; +} + + + + +/******************************************************************************/ +/* Decrements the current inventory number. */ +/******************************************************************************/ +static void decIncInv(uint16 *CurInv, bool dec) { + interfaceOff(); + + if (dec) + (*CurInv)--; + else + (*CurInv)++; + + while (*CurInv && (*CurInv <= NumInv)) { + if (In(Conditions, *CurInv) && Inventory[*CurInv].BInvName) { + Test = getInvName(*CurInv); + break; + } + + if (dec) + (*CurInv)--; + else + (*CurInv)++; + } + + if ((*CurInv == 0) || (*CurInv > NumInv)) { + if (dec) + *CurInv = NumInv; + else + *CurInv = 1; + + while (*CurInv && (*CurInv <= NumInv)) { + if (In(Conditions, *CurInv) && Inventory[*CurInv].BInvName) { + Test = getInvName(*CurInv); + break; + } + + if (dec) + (*CurInv)--; + else + (*CurInv)++; + } + } +} + + +#if defined(DOSCODE) +static bool nosvgamem = false; +static bool didintro = false; +#else +int didintro = false; // change to int do labw.c can access +#endif +static bool novesa = false, noaudio = false; + + +void processEvents() { + warning("STUB: processEvents()"); +} + +/******************************************************************************/ +/* Processes user input events. */ +/******************************************************************************/ +static void process(void) { + struct IntuiMessage *Msg; + uint32 Class; + + uint16 Code, Qualifier, MouseX, MouseY, ActionMode = 4, CurInv = MAPNUM, /* Lab: Labyrinth specific initialization */ + LastInv = MAPNUM, /* Lab: Labyrinth specific initialization */ + Old; + + bool ForceDraw = false, doit, GotMessage = true; + + uint16 OldRoomNum, +#if !defined(DOSCODE) + OldDirection, +#endif + GadID, NewDir; + + CloseDataPtr OldCPtr, TempCPtr, HCPtr = NULL; + ViewDataPtr VPtr; + + VGASetPal(initcolors, 8); + + CPtr = NULL; + RoomNum = 1; + Direction = NORTH; + + readRoomData("LAB:Doors"); + readInventory("LAB:Inventor"); + + if (!createSet(&Conditions, HighestCondition + 1)) + return; + + if (!createSet(&RoomsFound, ManyRooms + 1)) + return; + + readInitialConditions(Conditions, "LAB:Conditio"); + + LongWinInFront = false; + drawPanel(); + + perFlipGadget(ActionMode); + + /* Set up initial picture. */ + + while (1) { + processEvents(); + + if (GotMessage) { + if (QuitLab) { + stopDiff(); + break; + } + + g_music->restartBackMusic(); + + /* Sees what kind of close up we're in and does the appropriate stuff, if any. */ + if (doCloseUp(CPtr)) { + CPtr = NULL; +#if !defined(DOSCODE) + mayShowCrumbIndicator(); + g_system->updateScreen(); +#endif + } + + /* Sets the current picture properly on the screen */ + if (MainDisplay) + Test = getPictName(&CPtr); + + if (noupdatediff) { + inclElement(RoomsFound, RoomNum); /* Potentially entered another room */ + ForceDraw = (strcmp(Test, CurFileName) != 0) || ForceDraw; + + noupdatediff = false; + CurFileName = Test; + } + + else if (strcmp(Test, CurFileName) != 0) { + interfaceOff(); + inclElement(RoomsFound, RoomNum); /* Potentially entered another room */ + CurFileName = Test; + + if (CPtr) { + if ((CPtr->CloseUpType == SPECIALLOCK) && MainDisplay) /* LAB: Labyrinth specific code */ + showCombination(CurFileName); + else if (((CPtr->CloseUpType == SPECIALBRICK) || + (CPtr->CloseUpType == SPECIALBRICKNOMOUSE)) && + MainDisplay) /* LAB: Labyrinth specific code */ + showTile(CurFileName, (bool)(CPtr->CloseUpType == SPECIALBRICKNOMOUSE)); + else + readPict(CurFileName, false); + } else + readPict(CurFileName, false); + + drawRoomMessage(CurInv, CPtr); + ForceDraw = false; + +#if !defined(DOSCODE) + mayShowCrumbIndicator(); + g_system->updateScreen(); + + if (!FollowingCrumbs) + eatMessages(); + +#else + eatMessages(); +#endif + } + + if (ForceDraw) { + drawRoomMessage(CurInv, CPtr); + ForceDraw = false; +#if !defined(DOSCODE) + g_system->updateScreen(); +#endif + } + } + + g_music->checkMusic(); /* Make sure we check the music at least after every message */ + interfaceOn(); + Msg = getMsg(); + + if (Msg == NULL) { /* Does music load and next animation frame when you've run out of messages */ + GotMessage = false; + checkRoomMusic(); + g_music->newCheckMusic(); + diffNextFrame(); +#if !defined(DOSCODE) + + if (FollowingCrumbs) { + int result = followCrumbs(); + + if (result != 0) { + int x = 0, y = 0; + + warning("STUB: getMousePos()"); + //SDL_GetMousePos(&x, &y); + + Class = GADGETUP; + Qualifier = 0; + MouseX = x; + MouseY = y; + + if (result == VKEY_UPARROW) { + Code = GadID = 7; + } else if (result == VKEY_LTARROW) { + Code = GadID = 6; + } else if (result == VKEY_RTARROW) { + Code = GadID = 8; + } + + GotMessage = true; + mayShowCrumbIndicator(); + g_system->updateScreen(); + goto from_crumbs; + } + } + + mayShowCrumbIndicator(); + g_system->updateScreen(); +#endif + } else { + GotMessage = true; + + Class = Msg->Class; + Code = Msg->Code; + Qualifier = Msg->Qualifier; + MouseX = Msg->MouseX; + MouseY = Msg->MouseY; + GadID = Msg->GadgetID; + + replyMsg((void *) Msg); + +#if !defined(DOSCODE) + FollowingCrumbs = false; + +from_crumbs: +#endif + DoBlack = false; + + if ((Class == RAWKEY) && (!LongWinInFront)) { + if (Code == 13) { /* The return key */ + Class = MOUSEBUTTONS; + Qualifier = IEQUALIFIER_LEFTBUTTON; + mouseXY(&MouseX, &MouseY); + } + +#if !defined(DOSCODE) + else if (Code == 'b' || Code == 'B') { /* Start bread crumbs */ + BreadCrumbs[0].RoomNum = 0; + NumCrumbs = 0; + DroppingCrumbs = true; + mayShowCrumbIndicator(); + g_system->updateScreen(); + } + + else if (Code == 'f' || Code == 'F' || + Code == 'r' || Code == 'R') { /* Follow bread crumbs */ + if (DroppingCrumbs) { + if (NumCrumbs > 0) { + FollowingCrumbs = true; + FollowCrumbsFast = (Code == 'r' || Code == 'R'); + IsCrumbTurning = false; + IsCrumbWaiting = false; + getTime(&CrumbSecs, &CrumbMicros); + + if (Alternate) { + eatMessages(); + Alternate = false; + DoBlack = true; + DoNotDrawMessage = false; + + MainDisplay = true; + interfaceOn(); /* Sets the correct gadget list */ + drawPanel(); + drawRoomMessage(CurInv, CPtr); + g_system->updateScreen(); + } + } else { + BreadCrumbs[0].RoomNum = 0; + DroppingCrumbs = false; + + // Need to hide indicator!!!! + mayShowCrumbIndicatorOff(); + g_system->updateScreen(); + } + } + } + +#endif + + else if ((Code == 315) || (Code == 'x') || (Code == 'X') + || (Code == 'q') || (Code == 'Q')) { /* Quit? */ + DoNotDrawMessage = false; + drawMessage("Do you want to quit? (Y/N)"); + doit = false; + eatMessages(); + interfaceOff(); + + while (1) { + g_music->checkMusic(); /* Make sure we check the music at least after every message */ + Msg = getMsg(); + + if (Msg == NULL) { /* Does music load and next animation frame when you've run out of messages */ + g_music->newCheckMusic(); + diffNextFrame(); + } else { + replyMsg((void *) Msg); /* Can't do this in non-IBM versions */ + + if (Msg->Class == RAWKEY) { +#if defined(DOSCODE) + + if ((Msg->Code == 'Y') || (Msg->Code == 'y')) +#else + if ((Msg->Code == 'Y') || (Msg->Code == 'y') || (Msg->Code == 'Q') || (Msg->Code == 'q')) +#endif + { + doit = true; + break; + } else if (Msg->Code < 128) { + break; + } + } else if (Msg->Class == MOUSEBUTTONS) { + break; + } + } + } + + if (doit) { + stopDiff(); + break; + } else { + ForceDraw = true; + interfaceOn(); + } + } + +#ifdef undef + else if (Code == 324) { + if (BUFFERSIZE >= BIGBUFFERSIZE) { /* F10 key to switch resolutions */ + blackAllScreen(); + setMode((char) OldMode); + + Alternate = false; + MainDisplay = true; + attachGadgetList(NULL); + fillUpMusic(true); + g_system->delayMillis(750); + + IsHiRes = !IsHiRes; + + deallocate(MovePanelBuffer, MovePanelBufferSize); + deallocate(InvPanelBuffer, InvPanelBufferSize); + freeButtonList(MoveGadgetList); + freeButtonList(InvGadgetList); + MoveGadgetList = NULL; + InvGadgetList = NULL; + + if (!setUpScreens()) { + IsHiRes = false; + setUpScreens(); + } + + blackAllScreen(); + resetBuffer(); + CPtr = NULL; + DoBlack = true; + CurFileName = " "; + closeFont(MsgFont); + openFont("P:AvanteG.12", &MsgFont); + /* + mouseReset(); + */ + initMouse(); + drawPanel(); + perFlipGadget(ActionMode); + } else + drawMessage("Not enough memory to change resolutions."); + } + +#endif + + else if (Code == 9) { /* TAB key */ + Class = DELTAMOVE; + } + + else if (Code == 27) { /* ESC key */ + CPtr = NULL; + } + + eatMessages(); + } + + if (LongWinInFront) { + if ((Class == RAWKEY) || + ((Class == MOUSEBUTTONS) && + ((IEQUALIFIER_LEFTBUTTON & Qualifier) || + (IEQUALIFIER_RBUTTON & Qualifier)))) { + LongWinInFront = false; + DoNotDrawMessage = false; + drawPanel(); + drawRoomMessage(CurInv, CPtr); +#if !defined(DOSCODE) + g_system->updateScreen(); +#endif + } + } + + else if ((Class == GADGETUP) && !Alternate) { + if (GadID <= 5) { + if ((ActionMode == 4) && (GadID == 4) && (CPtr != NULL)) { + doMainView(&CPtr); + + DoBlack = true; + HCPtr = NULL; + CPtr = NULL; +#if !defined(DOSCODE) + mayShowCrumbIndicator(); + g_system->updateScreen(); +#endif + } + + else if (GadID == 5) { + eatMessages(); + + Alternate = true; + DoBlack = true; + DoNotDrawMessage = false; + interfaceOn(); /* Sets the correct gadget list */ + + MainDisplay = false; + + if (LastInv && In(Conditions, LastInv)) { + CurInv = LastInv; + Test = getInvName(CurInv); + } else + decIncInv(&CurInv, false); + + drawPanel(); + drawRoomMessage(CurInv, CPtr); +#if !defined(DOSCODE) + mayShowCrumbIndicator(); + g_system->updateScreen(); +#endif + } else { + Old = ActionMode; + ActionMode = GadID; + + if (Old < 5) + perFlipGadget(Old); + + perFlipGadget(ActionMode); + + if (GadID == 0) + drawMessage(TAKEWHAT); + else if (GadID == 1) + drawMessage(MOVEWHAT); + else if (GadID == 2) + drawMessage(OPENWHAT); + else if (GadID == 3) + drawMessage(CLOSEWHAT); + else if (GadID == 4) + drawMessage(LOOKWHAT); + +#if !defined(DOSCODE) + g_system->updateScreen(); +#endif + } + } + + else if (GadID == 9) { + doUse(MAPNUM); +#if !defined(DOSCODE) + mayShowCrumbIndicator(); + g_system->updateScreen(); +#endif + } + + else if (GadID >= 6) { /* Arrow Gadgets */ + CPtr = NULL; + HCPtr = NULL; + + if ((GadID == 6) || (GadID == 8)) { + if (GadID == 6) + drawMessage(TURNLEFT); + else + drawMessage(TURNRIGHT); + + CurFileName = " "; +#if !defined(DOSCODE) + OldDirection = Direction; +#endif + NewDir = Direction; + processArrow(&NewDir, GadID - 6); + doTurn(Direction, NewDir, &CPtr); + DoBlack = true; + Direction = NewDir; + ForceDraw = true; +#if !defined(DOSCODE) + mayShowCrumbIndicator(); + g_system->updateScreen(); +#endif + } else if (GadID == 7) { + OldRoomNum = RoomNum; + + if (doGoForward(&CPtr)) { + if (OldRoomNum == RoomNum) + DoBlack = true; + } else { + DoBlack = true; + processArrow(&Direction, GadID - 6); + + if (OldRoomNum != RoomNum) { + drawMessage(GOFORWARDDIR); + inclElement(RoomsFound, RoomNum); /* Potentially entered a new room */ + CurFileName = " "; + ForceDraw = true; + } else { + DoBlack = true; + drawMessage(NOPATH); + } + } + +#if defined(DEMODATA) + { + void writeDemoData(); + writeDemoData(); + } +#endif + +#if !defined(DOSCODE) + + if (FollowingCrumbs) { + if (IsCrumbTurning) { + if (Direction == OldDirection) { + FollowingCrumbs = false; + } + } else { + if (RoomNum == OldRoomNum) { // didn't get there? + FollowingCrumbs = false; + } + } + } else if (DroppingCrumbs && OldRoomNum != RoomNum) { + // If in surreal maze, turn off DroppingCrumbs. + // Note: These numbers were generated by parsing the + // "Maps" file, which is why they are hard-coded. Bleh! + if (RoomNum >= 245 && RoomNum <= 280) { + FollowingCrumbs = false; + DroppingCrumbs = false; + NumCrumbs = 0; + BreadCrumbs[0].RoomNum = 0; + } else { + bool intersect = false; + int i; + + for (i = 0; i < NumCrumbs; i++) { + if (BreadCrumbs[i].RoomNum == RoomNum) { + NumCrumbs = i + 1; + BreadCrumbs[NumCrumbs].RoomNum = 0; + intersect = true; + } + } + + if (!intersect) { + if (NumCrumbs == MAX_CRUMBS) { + NumCrumbs = MAX_CRUMBS - 1; + memcpy(&BreadCrumbs[0], &BreadCrumbs[1], NumCrumbs * sizeof BreadCrumbs[0]); + } + + BreadCrumbs[NumCrumbs].RoomNum = RoomNum; + BreadCrumbs[NumCrumbs++].Direction = Direction; + } + } + } + + mayShowCrumbIndicator(); + g_system->updateScreen(); +#endif + } + } + } + + else if ((Class == GADGETUP) && Alternate) { + DoBlack = true; + + if (GadID == 0) { + eatMessages(); + Alternate = false; + DoBlack = true; + DoNotDrawMessage = false; + + MainDisplay = true; + interfaceOn(); /* Sets the correct gadget list */ + drawPanel(); + drawRoomMessage(CurInv, CPtr); +#if !defined(DOSCODE) + g_system->updateScreen(); +#endif + } + + GadID--; + + if (GadID == 0) { + interfaceOff(); + stopDiff(); + CurFileName = " "; + + doit = !saveRestoreGame(); + CPtr = NULL; + + MainDisplay = true; + + CurInv = MAPNUM; + LastInv = MAPNUM; + + Test = getInvName(CurInv); + + drawPanel(); + + if (doit) { + drawMessage("Disk operation failed."); + VGASetPal(initcolors, 8); +#if !defined(DOSCODE) + g_system->updateScreen(); +#endif + g_system->delayMillis(1000); + } + +#if !defined(DOSCODE) + else { + g_system->updateScreen(); + } + +#endif + } + + else if (GadID == 1) { + if (!doUse(CurInv)) { + Old = ActionMode; + ActionMode = 5; /* Use button */ + + if (Old < 5) + perFlipGadget(Old); + + drawMessage(USEONWHAT); + MainDisplay = true; +#if !defined(DOSCODE) + g_system->updateScreen(); +#endif + } + } + + else if (GadID == 2) { + MainDisplay = !MainDisplay; + + if ((CurInv == 0) || (CurInv > NumInv)) { + CurInv = 1; + + while ((CurInv <= NumInv) && (!In(Conditions, CurInv))) + CurInv++; + } + + if ((CurInv <= NumInv) && In(Conditions, CurInv) && + Inventory[CurInv].BInvName) + Test = getInvName(CurInv); + +#if !defined(DOSCODE) + g_system->updateScreen(); +#endif + } + + else if (GadID == 3) { /* Left gadget */ + decIncInv(&CurInv, true); + LastInv = CurInv; + DoNotDrawMessage = false; + drawRoomMessage(CurInv, CPtr); +#if !defined(DOSCODE) + g_system->updateScreen(); +#endif + } + + else if (GadID == 4) { /* Right gadget */ + decIncInv(&CurInv, false); + LastInv = CurInv; + DoNotDrawMessage = false; + drawRoomMessage(CurInv, CPtr); +#if !defined(DOSCODE) + g_system->updateScreen(); +#endif + } + +#if !defined(DOSCODE) + else if (GadID == 5) { /* bread crumbs */ + BreadCrumbs[0].RoomNum = 0; + NumCrumbs = 0; + DroppingCrumbs = true; + mayShowCrumbIndicator(); + g_system->updateScreen(); + } + + else if (GadID == 6) { /* follow crumbs */ + if (DroppingCrumbs) { + if (NumCrumbs > 0) { + FollowingCrumbs = true; + FollowCrumbsFast = false; + IsCrumbTurning = false; + IsCrumbWaiting = false; + getTime(&CrumbSecs, &CrumbMicros); + + eatMessages(); + Alternate = false; + DoBlack = true; + DoNotDrawMessage = false; + + MainDisplay = true; + interfaceOn(); /* Sets the correct gadget list */ + drawPanel(); + drawRoomMessage(CurInv, CPtr); + g_system->updateScreen(); + } else { + BreadCrumbs[0].RoomNum = 0; + DroppingCrumbs = false; + + // Need to hide indicator!!!! + mayShowCrumbIndicatorOff(); + g_system->updateScreen(); + } + } + } + } + +#endif + + else if ((Class == MOUSEBUTTONS) && (IEQUALIFIER_LEFTBUTTON & Qualifier) && MainDisplay) { + interfaceOff(); + MainDisplay = true; + + doit = false; + + if (CPtr) { + if ((CPtr->CloseUpType == SPECIALLOCK) && MainDisplay) /* LAB: Labrinth specific code */ + mouseCombination(Conditions, MouseX, MouseY); + else if ((CPtr->CloseUpType == SPECIALBRICK) && MainDisplay) + mouseTile(Conditions, MouseX, MouseY); + else + doit = true; + } else + doit = true; + + + if (doit) { + HCPtr = NULL; + eatMessages(); + + if (ActionMode == 0) { /* Take something. */ + if (doActionRule(MouseX, MouseY, ActionMode, RoomNum, &CPtr)) + CurFileName = NewFileName; + else if (takeItem(MouseX, MouseY, &CPtr)) + drawMessage(TAKEITEM); + else if (doActionRule(MouseX, MouseY, TAKEDEF - 1, RoomNum, &CPtr)) + CurFileName = NewFileName; + else if (doActionRule(MouseX, MouseY, TAKE - 1, 0, &CPtr)) + CurFileName = NewFileName; + else if (MouseY < (VGAScaleY(149) + SVGACord(2))) + drawMessage(NOTHING); + } + + else if ((ActionMode == 1) /* Manipulate an object */ || + (ActionMode == 2) /* Open up a "door" */ || + (ActionMode == 3)) { /* Close a "door" */ + if (doActionRule(MouseX, MouseY, ActionMode, RoomNum, &CPtr)) + CurFileName = NewFileName; + else if (!doActionRule(MouseX, MouseY, ActionMode, 0, &CPtr)) { + if (MouseY < (VGAScaleY(149) + SVGACord(2))) + drawMessage(NOTHING); + } + } + + else if (ActionMode == 4) { /* Look at closeups */ + TempCPtr = CPtr; + setCurClose(MouseX, MouseY, &TempCPtr); + + if (CPtr == TempCPtr) { + if (MouseY < (VGAScaleY(149) + SVGACord(2))) + drawMessage(NOTHING); + } else if (TempCPtr->GraphicName) { + if (*(TempCPtr->GraphicName)) { + DoBlack = true; + CPtr = TempCPtr; + } else if (MouseY < (VGAScaleY(149) + SVGACord(2))) + drawMessage(NOTHING); + } else if (MouseY < (VGAScaleY(149) + SVGACord(2))) + drawMessage(NOTHING); + } + + else if ((ActionMode == 5) && + In(Conditions, CurInv)) { /* Use an item on something else */ + if (doOperateRule(MouseX, MouseY, CurInv, &CPtr)) { + CurFileName = NewFileName; + + if (!In(Conditions, CurInv)) + decIncInv(&CurInv, false); + } else if (MouseY < (VGAScaleY(149) + SVGACord(2))) + drawMessage(NOTHING); + } + } + +#if !defined(DOSCODE) + mayShowCrumbIndicator(); + g_system->updateScreen(); +#endif + } + + else if (Class == DELTAMOVE) { + VPtr = getViewData(RoomNum, Direction); + OldCPtr = VPtr->closeUps; + + if (HCPtr == NULL) { + TempCPtr = CPtr; + setCurClose(MouseX, MouseY, &TempCPtr); + + if ((TempCPtr == NULL) || (TempCPtr == CPtr)) { + if (CPtr == NULL) + HCPtr = OldCPtr; + else + HCPtr = CPtr->SubCloseUps; + } else + HCPtr = TempCPtr->NextCloseUp; + } else + HCPtr = HCPtr->NextCloseUp; + + + if (HCPtr == NULL) { + if (CPtr == NULL) + HCPtr = OldCPtr; + else + HCPtr = CPtr->SubCloseUps; + } + + if (HCPtr) + mouseMove(scaleX((HCPtr->x1 + HCPtr->x2) / 2), scaleY((HCPtr->y1 + HCPtr->y2) / 2)); + } + + else if ((Class == MOUSEBUTTONS) && (IEQUALIFIER_RBUTTON & Qualifier)) { + eatMessages(); + Alternate = !Alternate; + DoBlack = true; + DoNotDrawMessage = false; + MainDisplay = true; + interfaceOn(); /* Sets the correct gadget list */ + + if (Alternate) { + if (LastInv && In(Conditions, LastInv)) + CurInv = LastInv; + else + decIncInv(&CurInv, false); + } + + drawPanel(); + drawRoomMessage(CurInv, CPtr); +#if !defined(DOSCODE) + mayShowCrumbIndicator(); + g_system->updateScreen(); +#endif + } + } + } + + if (Conditions) + deleteSet(Conditions); + + if (RoomsFound) + deleteSet(RoomsFound); + + if (Rooms) + deallocate(Rooms, (ManyRooms + 1) * sizeof(RoomData)); + + if (Inventory) { + for (Code = 1; Code <= NumInv; Code++) { + if (Inventory[Code].name) + deallocate(Inventory[Code].name, strlen(Inventory[Code].name) + 1); + + if (Inventory[Code].BInvName) + deallocate(Inventory[Code].BInvName, strlen(Inventory[Code].BInvName) + 1); + } + + deallocate(Inventory, (NumInv + 1) * sizeof(InventoryData)); + } +} + + +/* + void mySignalHandler(int sig) + { + signal(sig, mySignalHandler); + } + */ + + + +#if defined(DOSCODE) +void (__interrupt __far *oldctrlc)(), (__interrupt __far *oldctrlcb)(); + +uint16 iretdummy; +void __interrupt __far myiret() { + iretdummy++; +} +#endif + + +void inner_main() { + bool mem, dointro = false; + uint16 counter; + + getMode(&OldMode); + + IsHiRes = true; + DoMusic = true; + g_music->_turnMusicOn = true; + dointro = true; + +#if 0 + for (counter = 1; counter < argc; counter++) { +#if defined(DOSCODE) + + if (((argv[counter])[0] == 'v') || ((argv[counter])[0] == 'V')) { + IsHiRes = false; + } else +#endif + if (((argv[counter])[0] == 'q') || ((argv[counter])[0] == 'Q')) { + DoMusic = false; + g_music->_turnMusicOn = false; + } + +#ifdef _DEBUG + else if (((argv[counter])[0] == 'i') || ((argv[counter])[0] == 'I')) { + dointro = false; + } + +#endif + else if (((argv[counter])[0] == '/') && ((argv[counter])[1] == '?')) { + debug("\n\nPlayer Version 1.0. Copyright (c) 1993 Terra Nova Development\n"); + debug("Player v q\n"); +#ifdef _DEBUG + debug(" i : Skip intro (debug only).\n"); +#endif +#if defined(DOSCODE) + debug(" v : Open up on a low res VGA display.\n"); +#endif + debug(" q : Start in quiet mode; no sound output.\n\n"); + return; + } + } +#endif + + if (initBuffer(BUFFERSIZE, true)) { + mem = true; + } else { +#if defined(DOSCODE) + BUFFERSIZE = SMALLBUFFERSIZE; + mem = initBuffer(BUFFERSIZE, true); + IsHiRes = false; + nosvgamem = true; +#else + // unacceptable !!!! + warning("initBuffer() failed"); + return; +#endif + } + + if (!initAudio()) { + noaudio = true; + DoMusic = false; + g_music->_turnMusicOn = false; + debug("Could not open Audio."); + g_system->delayMillis(500); + } + + if (!setUpScreens()) { + IsHiRes = false; + novesa = true; + mem = mem && setUpScreens(); + } + + if (!initMouse()) { + setMode((char) OldMode); +#if defined(DOSCODE) + _dos_setvect(0x23, oldctrlc); + _dos_setvect(0x1B, oldctrlcb); +#endif + debug("\n\nMouse or mouse driver not installed!\n\n"); + return; + } + + mem = mem && initRoomBuffer() && + initLabText(); + + doDisks(); + + if (!dointro) + g_music->initMusic(); + + openFont("P:AvanteG.12", &MsgFont); + + if (dointro && mem) { +#if defined(DOSCODE) + didintro = true; +#endif + introSequence(); +#if !defined(DOSCODE) + didintro = true; +#endif + } else + DoBlack = true; + + if (mem) { + mouseShow(); + process(); + } else + debug("\n\nNot enough memory to start game.\n\n"); + + if (QuitLab) { /* Won the game */ + blackAllScreen(); + readPict("P:End/L2In.1", true); + + for (counter = 0; counter < 120; counter++) { + g_music->newCheckMusic(); + waitTOF(); + } + + readPict("P:End/L2In.9", true); + readPict("P:End/Lost", true); + +#if defined(DOSCODE) + counter = 600; + + while (counter) { + newCheckMusic(); + diffNextFrame(); + waitTOF(); + counter--; + } + +#else + + warning("STUB: waitForPress"); + while (!1) { // 1 means ignore SDL_ProcessInput calls + g_music->newCheckMusic(); + diffNextFrame(); + waitTOF(); + } + + // If we weren't exiting, a call to a mythical SDL_StopWaitForPress() would be in order. +#endif + } + + closeFont(MsgFont); + + freeLabText(); + freeRoomBuffer(); + freeBuffer(); + + g_music->freeMusic(); + freeAudio(); + + mouseReset(); + setMode((char) OldMode); + +#if defined(DOSCODE) + _dos_setvect(0x23, oldctrlc); + _dos_setvect(0x1B, oldctrlcb); +#endif +} + +#if !defined(DOSCODE) +/*****************************************************************************/ +/* New code to allow quick(er) return navigation in game. */ +/*****************************************************************************/ +int followCrumbs() { + // NORTH, SOUTH, EAST, WEST + static int movement[4][4] = { + { VKEY_UPARROW, VKEY_RTARROW, VKEY_RTARROW, VKEY_LTARROW }, { VKEY_RTARROW, VKEY_UPARROW, VKEY_LTARROW, VKEY_RTARROW }, { VKEY_LTARROW, VKEY_RTARROW, VKEY_UPARROW, VKEY_RTARROW }, { VKEY_RTARROW, VKEY_LTARROW, VKEY_RTARROW, VKEY_UPARROW } +#if 0 + { -1, EAST, EAST, WEST }, { WEST, -1, EAST, WEST }, { NORTH, SOUTH, -1, SOUTH }, { NORTH, SOUTH, NORTH, -1 } +#endif + }; + + int ExitDir; + int MoveDir; + + if (IsCrumbWaiting) { + uint32 Secs; + uint32 Micros; + + timeDiff(CrumbSecs, CrumbMicros, &Secs, &Micros); + + if (Secs != 0 || Micros != 0) + return 0; + + IsCrumbWaiting = false; + } + + if (!IsCrumbTurning) + BreadCrumbs[NumCrumbs--].RoomNum = 0; + + // Is the current crumb this room? If not, logic error. + if (RoomNum != BreadCrumbs[NumCrumbs].RoomNum) { + NumCrumbs = 0; + BreadCrumbs[0].RoomNum = 0; + DroppingCrumbs = false; + FollowingCrumbs = false; + return 0; + } + + // which direction is last crumb + if (BreadCrumbs[NumCrumbs].Direction == EAST) + ExitDir = WEST; + else if (BreadCrumbs[NumCrumbs].Direction == WEST) + ExitDir = EAST; + else if (BreadCrumbs[NumCrumbs].Direction == NORTH) + ExitDir = SOUTH; + else + ExitDir = NORTH; + + MoveDir = movement[Direction][ExitDir]; + + if (NumCrumbs == 0) { + IsCrumbTurning = false; + BreadCrumbs[0].RoomNum = 0; + DroppingCrumbs = false; + FollowingCrumbs = false; + } else { + int theDelay = (FollowCrumbsFast ? ONESECOND / 4 : ONESECOND); + + IsCrumbTurning = (MoveDir != VKEY_UPARROW); + IsCrumbWaiting = true; + + addCurTime(theDelay / ONESECOND, theDelay % ONESECOND, &CrumbSecs, &CrumbMicros); + } + + return MoveDir; +} + +byte dropCrumbs[] = { 0x00 }; +byte dropCrumbsOff[] = { 0x00 }; + +struct Image DropCrumbsImage = { 24, 24, dropCrumbs }; +struct Image DropCrumbsOffImage = { 24, 24, dropCrumbsOff }; + +void mayShowCrumbIndicator() { + if (DroppingCrumbs && MainDisplay) { + mouseHide(); + drawMaskImage(&DropCrumbsImage, 612, 4); + mouseShow(); + } +} + +void mayShowCrumbIndicatorOff() { + if (MainDisplay) { + mouseHide(); + drawMaskImage(&DropCrumbsOffImage, 612, 4); + mouseShow(); + } +} +#endif + +} // End of namespace Lab diff --git a/engines/lab/graphics.cpp b/engines/lab/graphics.cpp new file mode 100644 index 0000000000..bcaed9ceab --- /dev/null +++ b/engines/lab/graphics.cpp @@ -0,0 +1,902 @@ +/* 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. + * + */ + +/* + * This code is based on Labyrinth of Time code with assistance of + * + * Copyright (c) 1993 Terra Nova Development + * Copyright (c) 2004 The Wyrmkeep Entertainment Co. + * + */ + +#include "lab/stddefines.h" +#include "lab/diff.h" +#include "lab/parsetypes.h" +#include "lab/labfun.h" +#include "lab/parsefun.h" +#include "lab/mouse.h" +#include "lab/vga.h" +#include "lab/text.h" + +namespace Lab { + +struct BitMap bit1, bit2, *DispBitMap = &bit1, *DrawBitMap = &bit1; + + +extern struct BitMap RawDiffBM; +extern char diffcmap[256 * 3], lastcmap[256 * 3]; +extern bool IsBM, NoFlip, nopalchange, ContMusic; + +extern int32 ReadSoFar; +extern bool ReadIsDone, ReadIsError; +extern bool DoBlack, EffectPlaying, stopsound; +extern bool IsHiRes; +extern struct TextFont *MsgFont; +extern const char *CurFileName; + + + + + +/*---------------------------------------------------------------------------*/ +/*------ From readPict.c. Reads in pictures and animations from disk. ------*/ +/*---------------------------------------------------------------------------*/ + + +extern uint32 VGAScreenWidth, VGAScreenHeight, VGAPages, VGABytesPerPage; + +/*****************************************************************************/ +/* Reads in a picture into the dest bitmap. */ +/*****************************************************************************/ +bool readPict(const char *filename, bool PlayOnce) { + byte **file = NULL; +#if defined(DOSCODE) + uint16 counter; +#endif + + stopDiff(); + + ReadSoFar = 0L; + ReadIsDone = false; + ReadIsError = false; + + file = g_music->newOpen(filename); + + if (file == NULL) { + if ((filename[0] == 'p') || (filename[0] == 'P')) + blackScreen(); + + return false; + } + + DispBitMap->BytesPerRow = VGAScreenWidth; + DispBitMap->Rows = VGAScreenHeight; +#if defined(DOSCODE) + DispBitMap->Flags = 0; +#else + DispBitMap->Flags = BITMAPF_VIDEO; +#endif + DispBitMap->Depth = VGAPages; +#if defined(DOSCODE) + + for (counter = 0; counter < VGAPages; counter++) + DispBitMap->Planes[counter] = getVGABaseAddr(); + +#else + // playDiff deals with resetting planes for the "video" display. +#endif + + readDiff(PlayOnce); + +#if !defined(DOSCODE) + ungetVGABaseAddr(); +#endif + + return true; +} + + + + +/*****************************************************************************/ +/* Reads in a music file. Ignores any graphics. */ +/*****************************************************************************/ +bool readMusic(const char *filename) { + byte **file = NULL; + + file = g_music->newOpen(filename); + + if (file == NULL) { + return false; + } + + DoBlack = false; + readSound(); + + return true; +} + + + + +/*****************************************************************************/ +/* Reads in a picture into buffer memory. */ +/*****************************************************************************/ +byte *readPictToMem(const char *filename, uint16 x, uint16 y) { + byte **file = NULL; + byte *Mem, *CurMem; +#if defined(DOSCODE) + uint16 counter; +#endif + + stopDiff(); + + ReadSoFar = 0L; + ReadIsDone = false; + ReadIsError = false; + + allocFile((void **)&Mem, (int32) x * (int32) y, "Bitmap"); + CurMem = Mem; + + file = g_music->newOpen(filename); + + if (file == NULL) + return NULL; + + DispBitMap->BytesPerRow = x; + DispBitMap->Rows = y; + DispBitMap->Flags = 0; + DispBitMap->Depth = VGAPages; +#if defined(DOSCODE) + + for (counter = 0; counter < VGAPages; counter++) { + DispBitMap->Planes[counter] = CurMem; + CurMem += VGABytesPerPage; + } + +#else + DispBitMap->Planes[0] = CurMem; + DispBitMap->Planes[1] = DispBitMap->Planes[0] + 0x10000; + DispBitMap->Planes[2] = DispBitMap->Planes[1] + 0x10000; + DispBitMap->Planes[3] = DispBitMap->Planes[2] + 0x10000; + DispBitMap->Planes[4] = DispBitMap->Planes[3] + 0x10000; +#endif + + readDiff(true); + + return Mem; +} + + + + +/*---------------------------------------------------------------------------*/ +/*------------ Does all the text rendering to the message boxes. ------------*/ +/*---------------------------------------------------------------------------*/ + + +bool DoNotDrawMessage = false; + +extern bool LongWinInFront, Alternate; + + +/*----- The flowText routines -----*/ + + + + +/******************************************************************************/ +/* Extracts the first word from a string. */ +/******************************************************************************/ +static void getWord(char *WordBuffer, const char *MainBuffer, uint16 *WordWidth) { + uint16 width = 0; + + while ((MainBuffer[width] != ' ') && MainBuffer[width] && + (MainBuffer[width] != '\n')) { + WordBuffer[width] = MainBuffer[width]; + width++; + } + + WordBuffer[width] = 0; + + *WordWidth = width; +} + + + + + +/******************************************************************************/ +/* Gets a line of text for flowText; makes sure that its length is less than */ +/* or equal to the maximum width. */ +/******************************************************************************/ +static void getLine(struct TextFont *tf, char *LineBuffer, const char **MainBuffer, uint16 LineWidth) { + uint16 CurWidth = 0, WordWidth; + char WordBuffer[100]; + bool doit = true; + + LineWidth += textLength(tf, " ", 1); + + LineBuffer[0] = 0; + + while ((*MainBuffer)[0] && doit) { + getWord(WordBuffer, *MainBuffer, &WordWidth); + strcat(WordBuffer, " "); + + if ((CurWidth + textLength(tf, WordBuffer, WordWidth + 1)) <= LineWidth) { + strcat(LineBuffer, WordBuffer); + (*MainBuffer) += WordWidth; + + if ((*MainBuffer)[0] == '\n') + doit = false; + + if ((*MainBuffer)[0]) + (*MainBuffer)++; + + CurWidth = textLength(tf, LineBuffer, strlen(LineBuffer)); + } else + doit = false; + } + + /* NYI: Would add code here to break up words in case they were longer than a line */ +} + + + + +/******************************************************************************/ +/* Dumps a chunk of text to an arbitrary box; flows it within that box and */ +/* optionally centers it. Returns the number of characters that were */ +/* processed. */ +/* */ +/* Note: Every individual word MUST be int16 enough to fit on a line, and */ +/* each line less than 255 characters. */ +/******************************************************************************/ +uint32 flowText(void *font, /* the TextAttr pointer */ + uint16 spacing, /* How much vertical spacing between the lines */ + uint16 pencolor, /* pen number to use for text */ + uint16 backpen, /* the background color */ + bool fillback, /* Whether to fill the background */ + bool centerh, /* Whether to center the text horizontally */ + bool centerv, /* Whether to center the text vertically */ + bool output, /* Whether to output any text */ + uint16 x1, /* Cords */ + uint16 y1, uint16 x2, uint16 y2, const char *str) { /* The text itself */ + struct TextFont *msgfont = (TextFont *)font; + char linebuffer[256]; + const char *temp; + uint16 numlines, actlines, fontheight, width; + uint16 x, y; + + if (fillback) { + setAPen(backpen); + rectFill(x1, y1, x2, y2); + } + + if (str == NULL) + return 0L; + + setAPen(pencolor); + + fontheight = textHeight(msgfont) + spacing; + numlines = (y2 - y1 + 1) / fontheight; + width = x2 - x1 + 1; + y = y1; + + if (centerv && output) { + temp = str; + actlines = 0; + + while (temp[0]) { + getLine(msgfont, linebuffer, &temp, width); + actlines++; + } + + if (actlines <= numlines) + y += ((y2 - y1 + 1) - (actlines * fontheight)) / 2; + } + + temp = str; + + while (numlines && str[0]) { + getLine(msgfont, linebuffer, &str, width); + + x = x1; + + if (centerh) + x += (width - textLength(msgfont, linebuffer, strlen(linebuffer))) / 2; + + if (output) + text(msgfont, x, y, pencolor, linebuffer, strlen(linebuffer)); + + numlines--; + y += fontheight; + } + + return (str - temp); +} + + +extern uint32 VGABASEADDRESS, VGABytesPerPage; + + +/******************************************************************************/ +/* Calls flowText, but flows it to memory. Same restrictions as flowText. */ +/******************************************************************************/ +uint32 flowTextToMem(struct Image *DestIm, void *font, /* the TextAttr pointer */ + uint16 spacing, /* How much vertical spacing between the lines */ + uint16 pencolor, /* pen number to use for text */ + uint16 backpen, /* the background color */ + bool fillback, /* Whether to fill the background */ + bool centerh, /* Whether to center the text horizontally */ + bool centerv, /* Whether to center the text vertically */ + bool output, /* Whether to output any text */ + uint16 x1, /* Cords */ + uint16 y1, uint16 x2, uint16 y2, const char *str) { /* The text itself */ + uint32 res, vgabyte = VGABytesPerPage; + + //VGABASEADDRESS = (uint32)(DestIm->ImageData); + VGABytesPerPage = (uint32) DestIm->Width * (int32) DestIm->Height; + + res = flowText(font, spacing, pencolor, backpen, fillback, centerh, centerv, output, x1, y1, x2, y2, str); + + VGABytesPerPage = vgabyte; + + return res; +} + + + + +/*----- The control panel stuff -----*/ + + + +void createBox(uint16 y2) { + setAPen(7); /* Message box area */ + rectFill(VGAScaleX(4), VGAScaleY(154), VGAScaleX(315), VGAScaleY(y2 - 2)); + + setAPen(0); /* Box around message area */ + drawHLine(VGAScaleX(2), VGAScaleY(152), VGAScaleX(317)); + drawVLine(VGAScaleX(317), VGAScaleY(152), VGAScaleY(y2)); + drawHLine(VGAScaleX(2), VGAScaleY(y2), VGAScaleX(317)); + drawVLine(VGAScaleX(2), VGAScaleY(152), VGAScaleY(y2)); +} + + + + +int32 longcharsdrawn = 0L; +bool LastMessageLong = false; + +void longDrawMessage(const char *str) { + char NewText[512]; + + if (str == NULL) + return; + + attachGadgetList(NULL); + mouseHide(); + strcpy(NewText, str); + + if (!LongWinInFront) { + LongWinInFront = true; + setAPen(3); /* Clear Area */ + rectFill(0, VGAScaleY(149) + SVGACord(2), VGAScaleX(319), VGAScaleY(199)); + } + + createBox(198); + longcharsdrawn = flowText(MsgFont, 0, 1, 7, false, true, true, true, VGAScaleX(6), VGAScaleY(155), VGAScaleX(313), VGAScaleY(195), str); + mouseShow(); +} + + + + +/******************************************************************************/ +/* Draws a message to the message box. */ +/******************************************************************************/ +void drawMessage(const char *str) { + if (DoNotDrawMessage) { + DoNotDrawMessage = false; + return; + } + + if (str) { + if ((textLength(MsgFont, str, strlen(str)) > VGAScaleX(306))) { + longDrawMessage(str); + LastMessageLong = true; + } else { + if (LongWinInFront) { + LongWinInFront = false; + drawPanel(); + } + + mouseHide(); + createBox(168); + text(MsgFont, VGAScaleX(7), VGAScaleY(155) + SVGACord(2), 1, str, strlen(str)); + mouseShow(); + LastMessageLong = false; + } + } +} + + +/*---------------------------------------------------------------------------*/ +/*--------------------------- All the wipe stuff. ---------------------------*/ +/*---------------------------------------------------------------------------*/ + + + +#define TRANSWIPE 1 +#define SCROLLWIPE 2 +#define SCROLLBLACK 3 +#define SCROLLBOUNCE 4 +#define TRANSPORTER 5 +#define READFIRSTFRAME 6 +#define READNEXTFRAME 7 + + + + +/*****************************************************************************/ +/* Copies memory from one location to another 64 bytes at a time. */ +/*****************************************************************************/ +void copyLong64(uint32 *Dest, uint32 *Source, uint32 Many64) { + while (Many64) { + *Dest = *Source; + Dest++; + Source++; + *Dest = *Source; + Dest++; + Source++; + *Dest = *Source; + Dest++; + Source++; + *Dest = *Source; + Dest++; + Source++; + *Dest = *Source; + Dest++; + Source++; + *Dest = *Source; + Dest++; + Source++; + *Dest = *Source; + Dest++; + Source++; + *Dest = *Source; + Dest++; + Source++; + *Dest = *Source; + Dest++; + Source++; + *Dest = *Source; + Dest++; + Source++; + *Dest = *Source; + Dest++; + Source++; + *Dest = *Source; + Dest++; + Source++; + *Dest = *Source; + Dest++; + Source++; + *Dest = *Source; + Dest++; + Source++; + *Dest = *Source; + Dest++; + Source++; + *Dest = *Source; + Dest++; + Source++; + + Many64--; + } +} + + + + +/*****************************************************************************/ +/* Scrolls the display to black. */ +/*****************************************************************************/ +static void doScrollBlack(void) { + byte *mem, *tempmem; + struct Image Im; + uint16 width, height, by, nheight, CurPage; + uint32 size, copysize; + uint32 *BaseAddr; + + mouseHide(); + width = VGAScaleX(320); + height = VGAScaleY(149) + SVGACord(2); + + /* + while (EffectPlaying) + { + g_music->updateMusic(); + waitTOF(); + } + */ + + allocFile((void **) &mem, (int32) width * (int32) height, "Temp Mem"); + /* + mem = stealBufMem((int32) width * (int32) height); + */ + Im.Width = width; + Im.Height = height; + Im.ImageData = mem; + g_music->fillUpMusic(true); + readScreenImage(&Im, 0, 0); + g_music->fillUpMusic(true); + + BaseAddr = (uint32 *) getVGABaseAddr(); + + by = VGAScaleX(4); + nheight = height; + + while (nheight) { + g_music->newCheckMusic(); + + if (!IsHiRes) + waitTOF(); + +#if !defined(DOSCODE) + BaseAddr = (uint32 *) getVGABaseAddr(); +#endif + + if (by > nheight) + by = nheight; + + mem += by * width; + nheight -= by; + size = (int32) nheight * (int32) width; + CurPage = 0; + tempmem = mem; + + while (size) { + if (size > VGABytesPerPage) + copysize = VGABytesPerPage; + else + copysize = size; + + size -= copysize; + + setPage(CurPage); + copyLong64(BaseAddr, (uint32 *) tempmem, copysize >> 6); + tempmem += copysize; + CurPage++; + } + + setAPen(0); + rectFill(0, nheight, width - 1, nheight + by - 1); + + g_system->updateScreen(); + + if (!IsHiRes) { + if (nheight <= (height / 8)) + by = 1; + else if (nheight <= (height / 4)) + by = 2; + else if (nheight <= (height / 2)) + by = 3; + } + } + + freeAllStolenMem(); + mouseShow(); + +#if !defined(DOSCODE) + ungetVGABaseAddr(); +#endif +} + + + + +extern struct BitMap RawDiffBM; +extern DIFFHeader headerdata; + + + + +static void copyPage(uint16 width, uint16 height, uint16 nheight, uint16 startline, byte *mem) { + uint32 size, OffSet, copysize; + uint16 CurPage; + uint32 *BaseAddr; + + BaseAddr = (uint32 *) getVGABaseAddr(); + + size = (int32)(height - nheight) * (int32) width; + mem += startline * width; + CurPage = ((int32) nheight * (int32) width) / VGABytesPerPage; + OffSet = ((int32) nheight * (int32) width) - (CurPage * VGABytesPerPage); + + while (size) { + if (size > (VGABytesPerPage - OffSet)) + copysize = VGABytesPerPage - OffSet; + else + copysize = size; + + size -= copysize; + + setPage(CurPage); + copyLong64(BaseAddr + (OffSet >> 2), (uint32 *) mem, copysize >> 6); + mem += copysize; + CurPage++; + OffSet = 0; + } + +#if !defined(DOSCODE) + ungetVGABaseAddr(); +#endif +} + + +/*****************************************************************************/ +/* Scrolls the display to a new picture from a black screen. */ +/*****************************************************************************/ +static void doScrollWipe(char *filename) { + byte *mem; + uint16 width, height, by, nheight, startline = 0, onrow = 0; + + mouseHide(); + width = VGAScaleX(320); + height = VGAScaleY(149) + SVGACord(2); + + while (EffectPlaying) { + g_music->newCheckMusic(); + waitTOF(); + } + + IsBM = true; + readPict(filename, true); + VGASetPal(diffcmap, 256); + IsBM = false; + mem = RawDiffBM.Planes[0]; + + g_music->fillUpMusic(true); + by = VGAScaleX(3); + nheight = height; + + while (onrow < headerdata.y) { + g_music->newCheckMusic(); + + if ((by > nheight) && nheight) + by = nheight; + + if ((startline + by) > (headerdata.y - height - 1)) + break; + + if (nheight) + nheight -= by; + + copyPage(width, height, nheight, startline, mem); + + g_system->updateScreen(); + + if (!nheight) + startline += by; + + onrow += by; + + if (nheight <= (height / 4)) + by = VGAScaleX(5); + else if (nheight <= (height / 3)) + by = VGAScaleX(4); + else if (nheight <= (height / 2)) + by = VGAScaleX(3); + } + + mouseShow(); +} + + + + +/*****************************************************************************/ +/* Does the scroll bounce. Assumes bitmap already in memory. */ +/*****************************************************************************/ +static void doScrollBounce(void) { + byte *mem; + uint16 width, height, startline, counter, +#if defined(DOSCODE) + newby[5] = {5, 4, 3, 2, 1}, newby1[8] = {3, 3, 2, 2, 2, 1, 1, 1}; +#else + newby[5] = {10, 8, 6, 4, 2}, newby1[8] = {6, 6, 4, 4, 4, 2, 2, 2}; +#endif + + mouseHide(); + width = VGAScaleX(320); + height = VGAScaleY(149) + SVGACord(2); + mem = RawDiffBM.Planes[0]; + + g_music->fillUpMusic(true); + startline = headerdata.y - height - 1; + + for (counter = 0; counter < 5; counter++) { + g_music->newCheckMusic(); + startline -= newby[counter]; + copyPage(width, height, 0, startline, mem); + + g_system->updateScreen(); + waitTOF(); + } + + for (counter = 8; counter > 0; counter--) { + g_music->newCheckMusic(); + startline += newby1[counter - 1]; + copyPage(width, height, 0, startline, mem); + + g_system->updateScreen(); + waitTOF(); + + } + + mouseShow(); +} + + + +/*****************************************************************************/ +/* Does the transporter wipe. */ +/*****************************************************************************/ +static void doTransWipe(CloseDataPtr *CPtr, char *filename) { + uint16 LastY, CurY, counter, linesdone = 0, lineslast; + struct Image ImSource, ImDest; + + if (IsHiRes) { + lineslast = 3; + LastY = 358; + } else { + lineslast = 1; + LastY = 148; + } + + for (counter = 0; counter < 2; counter++) { + CurY = counter * 2; + + while (CurY < LastY) { + if (linesdone >= lineslast) { + g_music->updateMusic(); + waitTOF(); + linesdone = 0; + } + + ghoastRect(0, 0, CurY, VGAScreenWidth - 1, CurY + 1); + CurY += 4; + linesdone++; + } + } + + setAPen(0); + + for (counter = 0; counter < 2; counter++) { + CurY = counter * 2; + + while (CurY <= LastY) { + if (linesdone >= lineslast) { + g_music->updateMusic(); + waitTOF(); + linesdone = 0; + } + + rectFill(0, CurY, VGAScreenWidth - 1, CurY + 1); + CurY += 4; + linesdone++; + } + } + + if (filename == NULL) + CurFileName = getPictName(CPtr); + else if (filename[0] > ' ') + CurFileName = filename; + else + CurFileName = getPictName(CPtr); + + byte *BitMapMem = readPictToMem(CurFileName, VGAScreenWidth, LastY + 5); + VGASetPal(diffcmap, 256); + + if (BitMapMem) { + ImSource.Width = VGAScreenWidth; + ImSource.Height = LastY; + ImSource.ImageData = BitMapMem; + + ImDest.Width = VGAScreenWidth; + ImDest.Height = VGAScreenHeight; + ImDest.ImageData = getVGABaseAddr(); + + for (counter = 0; counter < 2; counter++) { + CurY = counter * 2; + + while (CurY < LastY) { + if (linesdone >= lineslast) { + g_music->updateMusic(); + waitTOF(); + linesdone = 0; + } + +#if !defined(DOSCODE) + ImDest.ImageData = getVGABaseAddr(); +#endif + + bltBitMap(&ImSource, 0, CurY, &ImDest, 0, CurY, VGAScreenWidth, 2); + ghoastRect(0, 0, CurY, VGAScreenWidth - 1, CurY + 1); + CurY += 4; + linesdone++; + } + } + + for (counter = 0; counter < 2; counter++) { + CurY = counter * 2; + + while (CurY <= LastY) { + if (linesdone >= lineslast) { + g_music->updateMusic(); + waitTOF(); + linesdone = 0; + } + +#if !defined(DOSCODE) + ImDest.ImageData = getVGABaseAddr(); +#endif + + if (CurY == LastY) + bltBitMap(&ImSource, 0, CurY, &ImDest, 0, CurY, VGAScreenWidth, 1); + else + bltBitMap(&ImSource, 0, CurY, &ImDest, 0, CurY, VGAScreenWidth, 2); + + CurY += 4; + linesdone++; + } + } + } + +#if !defined(DOSCODE) + ungetVGABaseAddr(); +#endif +} + + + +/*****************************************************************************/ +/* Does a certain number of pre-programmed wipes. */ +/*****************************************************************************/ +void doWipe(uint16 WipeType, CloseDataPtr *CPtr, char *filename) { + if ((WipeType == TRANSWIPE) || (WipeType == TRANSPORTER)) + doTransWipe(CPtr, filename); + else if (WipeType == SCROLLWIPE) + doScrollWipe(filename); + else if (WipeType == SCROLLBLACK) + doScrollBlack(); + else if (WipeType == SCROLLBOUNCE) + doScrollBounce(); + else if (WipeType == READFIRSTFRAME) + readPict(filename, false); + else if (WipeType == READNEXTFRAME) + diffNextFrame(); +} + +} // End of namespace Lab diff --git a/engines/lab/interface.cpp b/engines/lab/interface.cpp new file mode 100644 index 0000000000..91111ae949 --- /dev/null +++ b/engines/lab/interface.cpp @@ -0,0 +1,234 @@ +/* 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. + * + */ + +/* + * This code is based on Labyrinth of Time code with assistance of + * + * Copyright (c) 1993 Terra Nova Development + * Copyright (c) 2004 The Wyrmkeep Entertainment Co. + * + */ + +#include "lab/stddefines.h" +#include "lab/interface.h" +#include "lab/storage.h" +#include "lab/timing.h" +#include "lab/mouse.h" +#include "lab/vga.h" +#include "common/util.h" + +namespace Lab { + +extern bool IsHiRes; + +Common::KeyState _keyPressed; + +struct Gadget *createButton(uint16 x, uint16 y, uint16 id, uint16 key, Image *im, Image *imalt) { + Gadget *gptr; + + if (allocate((void **)&gptr, sizeof(struct Gadget))) { + gptr->x = x; + gptr->y = y; + gptr->GadgetID = id; +#if !defined(DOSCODE) + gptr->KeyEquiv = key; +#endif + gptr->Im = im; + gptr->ImAlt = imalt; + gptr->NextGadget = NULL; + + return gptr; + } else + return NULL; +} + + + + +void freeButtonList(Gadget *gptrlist) { + struct Gadget *gptr, *next = gptrlist; + + while (next) { + gptr = next; + next = next->NextGadget; + + deallocate(gptr, sizeof(struct Gadget)); + } +} + + + + +/*****************************************************************************/ +/* Draws a gadget list to the screen. */ +/*****************************************************************************/ +void drawGadgetList(struct Gadget *gadlist) { + while (gadlist) { + drawImage(gadlist->Im, gadlist->x, gadlist->y); + + if (GADGETOFF & gadlist->GadgetFlags) + ghoastGadget(gadlist, 1); + + gadlist = gadlist->NextGadget; + } +} + + +/*****************************************************************************/ +/* Ghoasts a gadget, and makes it unavailable for using. */ +/*****************************************************************************/ +void ghoastGadget(struct Gadget *curgad, uint16 pencolor) { + ghoastRect(pencolor, curgad->x, curgad->y, curgad->x + curgad->Im->Width - 1, curgad->y + curgad->Im->Height - 1); + curgad->GadgetFlags |= GADGETOFF; +} + + + +/*****************************************************************************/ +/* Unghoasts a gadget, and makes it available again. */ +/*****************************************************************************/ +void unGhoastGadget(struct Gadget *curgad) { + drawImage(curgad->Im, curgad->x, curgad->y); + curgad->GadgetFlags &= !(GADGETOFF); +} + + +/*****************************************************************************/ +/* Make a key press have the right case for a gadget KeyEquiv value. */ +/*****************************************************************************/ +#if !defined(DOSCODE) +uint16 makeGadgetKeyEquiv(uint16 key) { + if (Common::isAlnum(key)) + key = tolower(key); + + return key; +} +#endif + +/*****************************************************************************/ +/* Checks whether or not the cords fall within one of the gadgets in a list */ +/* of gadgets. */ +/*****************************************************************************/ +static struct Gadget *checkNumGadgetHit(struct Gadget *gadlist, uint16 key) { +#if !defined(DOSCODE) + uint16 gkey = key - '0'; +#else + key = key - '0'; +#endif + + while (gadlist != NULL) { +#if !defined(DOSCODE) + + if ((gkey - 1 == gadlist->GadgetID || (gkey == 0 && gadlist->GadgetID == 9) || + (gadlist->KeyEquiv != 0 && makeGadgetKeyEquiv(key) == gadlist->KeyEquiv)) + && !(GADGETOFF & gadlist->GadgetFlags)) +#else + if ((((key - 1) == gadlist->GadgetID) || ((key == 0) && (gadlist->GadgetID == 9))) && + !(GADGETOFF & gadlist->GadgetFlags)) +#endif + { + mouseHide(); + drawImage(gadlist->ImAlt, gadlist->x, gadlist->y); + mouseShow(); + g_system->delayMillis(80); + mouseHide(); + drawImage(gadlist->Im, gadlist->x, gadlist->y); + mouseShow(); + + return gadlist; + } else { + gadlist = gadlist->NextGadget; + } + } + + return NULL; +} + + + +/*****************************************************************************/ +/* Checks whether or not a key has been pressed. */ +/*****************************************************************************/ +static bool keyPress(uint16 *KeyCode) { + if (_keyPressed.keycode) { + *KeyCode = _keyPressed.keycode; + return true; + } + + return false; +} + + +struct IntuiMessage IMessage; +extern struct Gadget *ScreenGadgetList; + +struct IntuiMessage *getMsg(void) { + struct Gadget *curgad; + int Qualifiers; + + updateMouse(); +#if !defined(DOSCODE) + Qualifiers = _keyPressed.flags; +#endif + + if ((curgad = mouseGadget()) != NULL) { + updateMouse(); + IMessage.Class = GADGETUP; + IMessage.Code = curgad->GadgetID; + IMessage.GadgetID = curgad->GadgetID; + IMessage.Qualifier = Qualifiers; + return &IMessage; + } + + else if (mouseButton(&IMessage.MouseX, &IMessage.MouseY, true)) { /* Left Button */ + IMessage.Qualifier = IEQUALIFIER_LEFTBUTTON | Qualifiers; + IMessage.Class = MOUSEBUTTONS; + return &IMessage; + } + + else if (mouseButton(&IMessage.MouseX, &IMessage.MouseY, false)) { /* Right Button */ + IMessage.Qualifier = IEQUALIFIER_RBUTTON | Qualifiers; + IMessage.Class = MOUSEBUTTONS; + return &IMessage; + } + + else if (keyPress(&IMessage.Code)) { /* Keyboard key */ + curgad = checkNumGadgetHit(ScreenGadgetList, IMessage.Code); + + if (curgad) { + IMessage.Class = GADGETUP; + IMessage.Code = curgad->GadgetID; + IMessage.GadgetID = curgad->GadgetID; + } else + IMessage.Class = RAWKEY; + + IMessage.Qualifier = Qualifiers; + return &IMessage; + } else + return NULL; +} + +void replyMsg(void *Msg) { + return; +} + +} // End of namespace Lab diff --git a/engines/lab/interface.h b/engines/lab/interface.h new file mode 100644 index 0000000000..cb0115daf9 --- /dev/null +++ b/engines/lab/interface.h @@ -0,0 +1,143 @@ +/* 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. + * + */ + +/* + * This code is based on Labyrinth of Time code with assistance of + * + * Copyright (c) 1993 Terra Nova Development + * Copyright (c) 2004 The Wyrmkeep Entertainment Co. + * + */ + +#include "lab/vga.h" +#include "common/keyboard.h" + +#ifndef LAB_INTEFACE_H +#define LAB_INTEFACE_H + +namespace Lab { + +struct IntuiMessage { + uint32 Class; + uint16 Code, Qualifier, MouseX, MouseY, GadgetID; + uint32 Seconds, Micros; +}; + + +struct Gadget { + uint16 x, y, GadgetID; +#if !defined(DOSCODE) + uint16 KeyEquiv; // if not zero, a key that activates gadget +#endif + uint32 GadgetFlags; + struct Image *Im, *ImAlt; + struct Gadget *NextGadget; +}; + +extern Common::KeyState _keyPressed; + +/* Defines for the GadgetFlags portion */ + +#define GADGETOFF 0x01 + + + +/* Defines for the Class variable in IntuiMessage */ +#define SIZEVERIFY 0x00000001 +#define NEWSIZE 0x00000002 +#define REFRESHWINDOW 0x00000004 +#define MOUSEBUTTONS 0x00000008 +#define MOUSEMOVE 0x00000010 +#define GADGETDOWN 0x00000020 +#define GADGETUP 0x00000040 +#define REQSET 0x00000080 +#define MENUPICK 0x00000100 +#define CLOSEWINDOW 0x00000200 +#define RAWKEY 0x00000400 +#define REQVERIFY 0x00000800 +#define REQCLEAR 0x00001000 +#define MENUVERIFY 0x00002000 +#define NEWPREFS 0x00004000 +#define DISKINSERTED 0x00008000 +#define DISKREMOVED 0x00010000 +#define WBENCHMESSAGE 0x00020000 /* System use only */ +#define ACTIVEWINDOW 0x00040000 +#define INACTIVEWINDOW 0x00080000 +#define DELTAMOVE 0x00100000 +#define VANULLLAKEY 0x00200000 + + +/* Defines for the Qualifier variable in IntuiMessage */ +#define IEQUALIFIER_LSHIFT 0x0001 +#define IEQUALIFIER_RSHIFT 0x0002 +#define IEQUALIFIER_CAPSLOCK 0x0004 +#define IEQUALIFIER_CONTROL 0x0008 +#define IEQUALIFIER_LALT 0x0010 +#define IEQUALIFIER_RALT 0x0020 +#define IEQUALIFIER_LCOMMAND 0x0040 +#define IEQUALIFIER_RCOMMAND 0x0080 +#define IEQUALIFIER_NUMERICPAD 0x0100 +#define IEQUALIFIER_REPEAT 0x0200 +#define IEQUALIFIER_INTERRUPT 0x0400 +#define IEQUALIFIER_MULTIBROADCAST 0x0800 +#define IEQUALIFIER_MIDBUTTON 0x1000 +#define IEQUALIFIER_RBUTTON 0x2000 +#define IEQUALIFIER_LEFTBUTTON 0x4000 + +#if !defined(DOSCODE) +// these values come from the SDL virtual key table +#define VKEY_UPARROW 273 +#define VKEY_DNARROW 274 +#define VKEY_RTARROW 275 +#define VKEY_LTARROW 276 +#endif + + +/*---------------------------------------------------------------------------*/ +/*--------------------------- Function Prototypes ---------------------------*/ +/*---------------------------------------------------------------------------*/ + + + + +struct Gadget *createButton(uint16 x, uint16 y, uint16 id, +#if !defined(DOSCODE) + uint16 key, +#endif + struct Image *im, struct Image *imalt); + +void freeButtonList(void *gptrlist); + +void drawGadgetList(struct Gadget *gadlist); + +void ghoastGadget(struct Gadget *curgad, uint16 pencolor); + +void unGhoastGadget(struct Gadget *curgad); + +struct IntuiMessage *getMsg(void); + +void replyMsg(void *Msg); + +} // End of namespace Lab + +#endif /* LAB_INTEFACE_H */ + diff --git a/engines/lab/intro.cpp b/engines/lab/intro.cpp new file mode 100644 index 0000000000..ae822cb72c --- /dev/null +++ b/engines/lab/intro.cpp @@ -0,0 +1,470 @@ +/* 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. + * + */ + +/* + * This code is based on Labyrinth of Time code with assistance of + * + * Copyright (c) 1993 Terra Nova Development + * Copyright (c) 2004 The Wyrmkeep Entertainment Co. + * + */ + +#include "lab/stddefines.h" +#include "lab/labfun.h" +#include "lab/timing.h" +#include "lab/diff.h" +#include "lab/text.h" +#include "lab/interface.h" + +namespace Lab { + +static struct TextFont filler, *msgfont = &filler; + +extern bool nopalchange, noscreenchange, hidemouse, DoBlack, NoFlip, IsHiRes; + +extern char diffcmap[256 * 3]; + +extern uint32 VGAScreenWidth, VGAScreenHeight; + + +extern uint16 *FadePalette; + +static uint16 Palette[16] = { + 0x0000, 0x0855, 0x0FF9, 0x0EE7, 0x0ED5, 0x0DB4, 0x0CA2, 0x0C91, 0x0B80, 0x0B80, 0x0B91, 0x0CA2, 0x0CB3, 0x0DC4, 0x0DD6, 0x0EE7 +}; + + +static bool QuitIntro = false, IntroDoBlack; +extern int32 longcharsdrawn; + + + +/******************************************************************************/ +/* Goes thru, and responds to all the intuition messages currently in the */ +/* the message port. */ +/******************************************************************************/ +void introEatMessages(void) { + struct IntuiMessage *Msg; + + while (1) { + Msg = getMsg(); + + if (Msg == NULL) + return; + else { + if (((Msg->Class == MOUSEBUTTONS) && (IEQUALIFIER_RBUTTON & Msg->Qualifier)) || + ((Msg->Class == RAWKEY) && (Msg->Code == 27))) + QuitIntro = true; + + replyMsg(Msg); + } + } +} + + + + +/*****************************************************************************/ +/* Reads in a picture. */ +/*****************************************************************************/ +static void doPictText(const char *Filename, bool isscreen) { + uint32 lastsecs = 0L, lastmicros = 0L, secs = 0L, micros = 0L; + struct IntuiMessage *Msg; + char filename[50] = "Lab:rooms/Intro/"; + byte *curplace, **tfile; + bool DrawNextText = true, End = false, Begin = true; + + int32 Class, Code, Drawn; + int16 Qualifier; + uint timedelay; + + strcat(filename, Filename); + + if (isscreen) { + g_music->fillUpMusic(true); + timedelay = 35; + } else { + g_music->newCheckMusic(); + timedelay = 7; + } + + if (QuitIntro) + return; + + while (1) { + if (DrawNextText) { + if (Begin) { + Begin = false; + + tfile = g_music->newOpen(filename); + + if (!tfile) + return; + + curplace = *tfile; + } else if (isscreen) + fade(false, 0); + + if (isscreen) { + setAPen(7L); + rectFill(VGAScaleX(10), VGAScaleY(10), VGAScaleX(310), VGAScaleY(190)); + + Drawn = flowText(msgfont, (!IsHiRes) * -1, 5, 7, false, false, true, true, VGAScaleX(14), VGAScaleY(11), VGAScaleX(306), VGAScaleY(189), (char *)curplace); + fade(true, 0); + } else { + longDrawMessage((char *)curplace); + Drawn = longcharsdrawn; + } + + curplace += Drawn; + + End = (*curplace == 0); + + DrawNextText = false; + introEatMessages(); + + if (QuitIntro) { + if (isscreen) + fade(false, 0); + + return; + } + + getTime(&lastsecs, &lastmicros); + } + + Msg = getMsg(); + + if (Msg == NULL) { + g_music->newCheckMusic(); + diffNextFrame(); + + getTime(&secs, µs); + anyTimeDiff(lastsecs, lastmicros, secs, micros, &secs, µs); + + if (secs > timedelay) { + if (End) { + if (isscreen) + fade(false, 0); + + return; + } else { + DrawNextText = true; + } + } + + waitTOF(); + } else { + Class = Msg->Class; + Qualifier = Msg->Qualifier; + Code = Msg->Code; + replyMsg(Msg); + + if (((Class == MOUSEBUTTONS) && (IEQUALIFIER_RBUTTON & Qualifier)) || + ((Class == RAWKEY) && (Code == 27))) { + QuitIntro = true; + + if (isscreen) + fade(false, 0); + + return; + } + + else if (Class == MOUSEBUTTONS) { + if (IEQUALIFIER_LEFTBUTTON & Qualifier) { + if (End) { + if (isscreen) + fade(false, 0); + + return; + } else + DrawNextText = true; + } + + introEatMessages(); + + if (QuitIntro) { + if (isscreen) + fade(false, 0); + + return; + } + } + + if (End) { + if (isscreen) + fade(false, 0); + + return; + } else + DrawNextText = true; + } + } +} + + + + + +/*****************************************************************************/ +/* Does a one second delay, but checks the music while doing it. */ +/*****************************************************************************/ +void musicDelay(void) { + int16 counter; + + g_music->newCheckMusic(); + + if (QuitIntro) + return; + + for (counter = 0; counter < 20; counter++) { + g_music->newCheckMusic(); + waitTOF(); + waitTOF(); + waitTOF(); + } +} + + + +static void NReadPict(const char *Filename, bool PlayOnce) { + char filename[20] = "P:Intro/"; + + g_music->newCheckMusic(); + + if (QuitIntro) + return; + + strcat(filename, Filename); + + DoBlack = IntroDoBlack; + stopDiffEnd(); + readPict(filename, PlayOnce); +} + + +//#define ALL_LOGOS + +/*****************************************************************************/ +/* Does the introduction sequence for Labyrinth. */ +/*****************************************************************************/ +void introSequence(void) { + uint16 counter, counter1; + + DoBlack = true; + +#if defined(DOSCODE) + readPict("p:Intro/EA0", true); + readPict("p:Intro/EA1", true); + readPict("p:Intro/EA2", true); + readPict("p:Intro/EA3", true); +#elif defined(ALL_LOGOS) || defined(NDEBUG) + readPict("p:Intro/WYRMKEEP", true); + microDelay(4, 0, NULL); +#endif + blackAllScreen(); + + g_music->initMusic(); + + nopalchange = true; + noscreenchange = true; + readPict("p:Intro/TNDcycle2.pic", true); + nopalchange = false; + noscreenchange = false; + + FadePalette = Palette; +#if defined(ALL_LOGOS) || defined(NDEBUG) + + for (counter = 0; counter < 16; counter++) { + Palette[counter] = ((diffcmap[counter * 3] >> 2) << 8) + + ((diffcmap[counter * 3 + 1] >> 2) << 4) + + (diffcmap[counter * 3 + 2] >> 2); + } + + newCheckMusic(); + fade(true, 0); + + for (int times = 0; times < 150; times++) { + newCheckMusic(); + uint16 temp = Palette[2]; + + for (counter = 2; counter < 15; counter++) + Palette[counter] = Palette[counter + 1]; + + Palette[15] = temp; + + setAmigaPal(Palette, 16); + waitTOF(); + } + + fade(false, 0); + blackAllScreen(); +#endif + g_music->newCheckMusic(); + + readPict("p:Intro/Title.A", true); + readPict("p:Intro/AB", true); + musicDelay(); + readPict("p:Intro/BA", true); + readPict("p:Intro/AC", true); + musicDelay(); +#if !defined(DOSCODE) + musicDelay(); // more credits on this page now +#endif + readPict("p:Intro/CA", true); + readPict("p:Intro/AD", true); + musicDelay(); +#if !defined(DOSCODE) + musicDelay(); // more credits on this page now +#endif + readPict("p:Intro/DA", true); + musicDelay(); + + g_music->newOpen("p:Intro/Intro.1"); /* load the picture into the buffer */ + + g_music->newCheckMusic(); + blackAllScreen(); + g_music->fillUpMusic(true); + + getFont("P:Map.font", msgfont); + + nopalchange = true; + noscreenchange = true; + readPict("p:Intro/Intro.1", true); + noscreenchange = false; + nopalchange = false; + + for (counter = 0; counter < 16; counter++) { + Palette[counter] = ((diffcmap[counter * 3] >> 2) << 8) + + ((diffcmap[counter * 3 + 1] >> 2) << 4) + + (diffcmap[counter * 3 + 2] >> 2); + } + + doPictText("i.1", true); + doPictText("i.2A", true); + doPictText("i.2B", true); + + freeAllStolenMem(); + + blackAllScreen(); + g_music->fillUpMusic(true); + + IntroDoBlack = true; + NReadPict("Station1", true); + doPictText("i.3", false); + + NReadPict("Station2", true); + doPictText("i.4", false); + + NReadPict("Stiles4", true); + doPictText("i.5", false); + + NReadPict("Stiles3", true); + doPictText("i.6", false); + + NReadPict("Platform2", true); + doPictText("i.7", false); + + NReadPict("Subway.1", true); + doPictText("i.8", false); + + NReadPict("Subway.2", true); + + doPictText("i.9", false); + doPictText("i.10", false); + doPictText("i.11", false); + + if (!QuitIntro) + for (counter = 0; counter < 50; counter++) { + for (counter1 = (8 * 3); counter1 < (255 * 3); counter1++) + diffcmap[counter1] = 255 - diffcmap[counter1]; + + g_music->newCheckMusic(); + waitTOF(); + VGASetPal(diffcmap, 256); + waitTOF(); + waitTOF(); + } + + doPictText("i.12", false); + doPictText("i.13", false); + + IntroDoBlack = false; + NReadPict("Daed0", true); + doPictText("i.14", false); + + NReadPict("Daed1", true); + doPictText("i.15", false); + + NReadPict("Daed2", true); + doPictText("i.16", false); + doPictText("i.17", false); + doPictText("i.18", false); + + NReadPict("Daed3", true); + doPictText("i.19", false); + doPictText("i.20", false); + + NReadPict("Daed4", true); + doPictText("i.21", false); + + NReadPict("Daed5", true); + doPictText("i.22", false); + doPictText("i.23", false); + doPictText("i.24", false); + + NReadPict("Daed6", true); + doPictText("i.25", false); + doPictText("i.26", false); + + NReadPict("Daed7", false); + doPictText("i.27", false); + doPictText("i.28", false); + stopDiffEnd(); + + NReadPict("Daed8", true); + doPictText("i.29", false); + doPictText("i.30", false); + + NReadPict("Daed9", true); + doPictText("i.31", false); + doPictText("i.32", false); + doPictText("i.33", false); + + NReadPict("Daed9a", true); + NReadPict("Daed10", true); + doPictText("i.34", false); + doPictText("i.35", false); + doPictText("i.36", false); + + NReadPict("SubX", true); + + if (QuitIntro) { + setAPen(0); + rectFill(0, 0, VGAScreenWidth - 1, VGAScreenHeight - 1); + DoBlack = true; + } + + hidemouse = false; +} + +} // End of namespace Lab diff --git a/engines/lab/lab.cpp b/engines/lab/lab.cpp new file mode 100644 index 0000000000..edde50bb5d --- /dev/null +++ b/engines/lab/lab.cpp @@ -0,0 +1,68 @@ +/* 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. + * + */ + + /* + * This code is based on Labyrinth of Time code with assistance of + * + * Copyright (c) 1993 Terra Nova Development + * Copyright (c) 2004 The Wyrmkeep Entertainment Co. + * + */ + +#include "common/debug-channels.h" +#include "common/scummsys.h" +#include "common/error.h" +#include "common/fs.h" +#include "common/rect.h" + +#include "engines/util.h" + +#include "lab/lab.h" +#include "lab/labfun.h" + +namespace Lab { + +bool LabEngine::hasFeature(EngineFeature f) const { + return (f == kSupportsRTL) ? true : false; +} + +LabEngine::LabEngine(OSystem *syst) + : Engine(syst) { +} + +LabEngine::~LabEngine() { + // Remove all of our debug levels here + DebugMan.clearAllDebugChannels(); +} + +Common::Error LabEngine::run() { + // Initialize graphics using following: + initGraphics(320, 200, false); + + g_music = new Music(); + + inner_main(); + + return Common::kNoError; +} + +} // End of namespace Lab diff --git a/engines/lab/lab.h b/engines/lab/lab.h new file mode 100644 index 0000000000..3b1e411e7c --- /dev/null +++ b/engines/lab/lab.h @@ -0,0 +1,52 @@ +/* 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. + * + */ + + /* + * This code is based on Labyrinth of Time code with assistance of + * + * Copyright (c) 1993 Terra Nova Development + * Copyright (c) 2004 The Wyrmkeep Entertainment Co. + * + */ + +#ifndef LAB_H +#define LAB_H + +#include "common/array.h" + +#include "engines/engine.h" + +namespace Lab { + +class LabEngine : public Engine { +public: + LabEngine(OSystem *syst); + ~LabEngine(); + + virtual Common::Error run(); + + bool hasFeature(EngineFeature f) const; +}; + +} // End of namespace Lab + +#endif // LAB_H diff --git a/engines/lab/labfile.cpp b/engines/lab/labfile.cpp new file mode 100644 index 0000000000..90db66fcbb --- /dev/null +++ b/engines/lab/labfile.cpp @@ -0,0 +1,549 @@ +/* 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. + * + */ + +/* + * This code is based on Labyrinth of Time code with assistance of + * + * Copyright (c) 1993 Terra Nova Development + * Copyright (c) 2004 The Wyrmkeep Entertainment Co. + * + */ + +#include "lab/labfun.h" +#include "lab/mouse.h" +#include "lab/storage.h" +#include "common/file.h" + +namespace Lab { + +#define MAXREADSIZE 30720L +#define DMABUGSIZE 0 /* The number of bytes the DMA driver might screw */ +/* NOTE: set to 0 for non-CDTV machines. */ + + + +static byte *buffer = NULL, *realbufferstart = NULL, *startoffilestorage = NULL; + +byte **startoffile = &startoffilestorage; +static uint32 buffersize, realbuffersize; + +uint32 ReadSoFar; +bool ReadIsError, ReadIsDone; + + +#if defined(WIN32) +#define stat _stat +#endif + +/*****************************************************************************/ +/* Returns the size of a file. */ +/*****************************************************************************/ +uint32 sizeOfFile(const char *name) { + Common::File file; + + file.open(translateFileName(name)); + if (!file.isOpen()) { + warning("Cannot open file %s", translateFileName(name)); + + return 0; + } + uint32 size = file.size(); + file.close(); + + return size; +} + + + + +/*-------------------- Routines that buffer a whole file --------------------*/ + + + +/*----- divides up and manages the buffer -----*/ + + + +#define MAXMARKERS 15 + + + +typedef struct { + char name[32]; + void *Start, *End; +} FileMarker; + + + +static FileMarker FileMarkers[MAXMARKERS]; +static uint16 CurMarker = 0; +static void *MemPlace = NULL; + + + + + +/*****************************************************************************/ +/* Frees a File's resources. */ +/*****************************************************************************/ +static void freeFile(uint16 RMarker) { + FileMarkers[RMarker].name[0] = 0; + FileMarkers[RMarker].Start = NULL; + FileMarkers[RMarker].End = NULL; +} + + + + + +/*****************************************************************************/ +/* Gets a chunk of memory from the buffer. */ +/*****************************************************************************/ +static void *getCurMem(uint32 size) { + void *ptr = 0; + + warning ("STUB: getCurMem(%d)", size); + +#if 0 + if ((((char *) MemPlace) + size - 1) >= + (((char *) buffer) + buffersize)) + MemPlace = buffer; + + ptr = MemPlace; + ((char *)MemPlace) += size; + + for (int counter = 0; counter < MAXMARKERS; counter++) { + if (FileMarkers[counter].name[0]) { + if (((FileMarkers[counter].Start >= ptr) && + (FileMarkers[counter].Start < MemPlace)) || + ((FileMarkers[counter].End >= ptr) && + (FileMarkers[counter].End < MemPlace)) || + ((ptr >= FileMarkers[counter].Start) && + (ptr <= FileMarkers[counter].End))) + + freeFile(counter); + } + } +#endif + return ptr; +} + + + + +/*****************************************************************************/ +/* Checks if a file is already buffered. */ +/*****************************************************************************/ +byte **isBuffered(const char *fileName) { + uint16 RMarker; + + if (fileName == NULL) + return NULL; + + RMarker = 0; + + while (RMarker < MAXMARKERS) { + if (strcmp(FileMarkers[RMarker].name, fileName) == 0) { + *startoffile = (byte *) FileMarkers[RMarker].Start; + return startoffile; + } else + RMarker++; + } + + return NULL; +} + + + + +/*****************************************************************************/ +/* Grabs a chunk of memory from the room buffer, and manages it for a */ +/* particular room. If it returns true, then the file is already in memory. */ +/*****************************************************************************/ +bool allocFile(void **Ptr, uint32 Size, const char *fileName) { + uint16 RMarker; + byte **temp; + + Size += DMABUGSIZE; + + if (1 & Size) /* Memory is required to be even aligned */ + Size++; + + temp = isBuffered(fileName); + + if (temp) { + *Ptr = *temp; + return true; + } + + RMarker = CurMarker; + CurMarker++; + + if (CurMarker >= MAXMARKERS) + CurMarker = 0; + + freeFile(RMarker); + strcpy(FileMarkers[RMarker].name, fileName); + + *Ptr = getCurMem(Size); + FileMarkers[RMarker].Start = *Ptr; + FileMarkers[RMarker].End = (void *)(((char *)(*Ptr)) + Size - 1); + + return false; +} + + + + + +/*----- Main routines -----*/ + + +/*****************************************************************************/ +/* Reads a file into memory. */ +/*****************************************************************************/ +byte **openFile(const char *name) { + warning("STUB: openFile"); + + return NULL; +#if 0 + char *tempbuffer, *Buffer; + int32 Size, Left; + int FPtr, ReadSize, myread; + + ReadSoFar = 0L; + ReadIsError = false; + ReadIsDone = false; + + if ((buffer == NULL) || (name == NULL)) { + ReadIsError = true; + ReadIsDone = true; + return NULL; + } + + Size = sizeOfFile(name); + + if (!Size || (Size > ((int32) buffersize))) { + ReadIsError = true; + ReadIsDone = true; + return NULL; + } + + if (allocFile((void **) &Buffer, Size, name)) { /* Get place in Buffer */ + *startoffile = Buffer; /* If the file is buffered */ + + ReadSoFar = Size; + ReadIsError = false; + ReadIsDone = true; + + return startoffile; + } + +#if defined(WIN32) +#if defined(DEMODATA) + { + FILE *fh = fopen("c:\\depot\\labyrinth\\demodata.log", "a+w"); + fprintf(fh, "%s\n", name); + fclose(fh); + } +#endif + + FPtr = open(translateFileName(name), O_RDONLY | O_BINARY); +#else + FPtr = open(translateFileName(name), O_RDONLY); +#endif + + if (FPtr != -1) { + Left = Size; + tempbuffer = Buffer; + *startoffile = Buffer; + + while (Left) { + fileCheckMusic(Left); + + if (Left > MAXREADSIZE) + ReadSize = MAXREADSIZE; + else + ReadSize = (int) Left; + + if (!(myread = read(FPtr, tempbuffer, ReadSize + DMABUGSIZE))) { + ReadIsError = false; + ReadIsDone = true; + + close(FPtr); + return NULL; + } + + /* Not necessary for IBM version + if ((ReadSize == MAXREADSIZE) && DMABUGSIZE) + Seek(FPtr, -DMABUGSIZE, (int32) OFFSET_CURRENT); + */ + + ReadSoFar += ReadSize; + tempbuffer += ReadSize; + Left -= ReadSize; + } + + ReadIsDone = true; + close(FPtr); + return startoffile; + } else { + ReadIsError = false; + ReadIsDone = true; + + return NULL; + } +#endif +} + + + +/*****************************************************************************/ +/* Reads a block of memory. */ +/*****************************************************************************/ +void readBlock(void *Buffer, uint32 Size, byte **File) { + memcpy(Buffer, *File, (size_t) Size); + (*File) += Size; +} + + + +/*****************************************************************************/ +/* Reads on character. */ +/*****************************************************************************/ +char readChar(char **File) { + char c = **File; + + (*File)++; + return c; +} + + + + +/*****************************************************************************/ +/* Skips a chunk of memory. */ +/*****************************************************************************/ +void skip(byte **File, uint32 skip) { + (*File) += skip; +} + + + +/*****************************************************************************/ +/* Resets the internal buffers to empty. */ +/*****************************************************************************/ +void resetBuffer(void) { + uint16 RMarker; + + CurMarker = 0; + RMarker = 0; + MemPlace = buffer; + + while (RMarker < MAXMARKERS) { + freeFile(RMarker); + RMarker++; + } +} + + + +/*****************************************************************************/ +/* Initializes the buffer. */ +/*****************************************************************************/ +bool initBuffer(uint32 BufSize, bool IsGraphicsMem) { + if (!allocate((void **) &buffer, BufSize)) + buffer = NULL; + + buffersize = BufSize; + realbuffersize = buffersize; + realbufferstart = buffer; + + resetBuffer(); + + return (buffer != NULL); +} + + + + +/*****************************************************************************/ +/* Frees the buffer. */ +/*****************************************************************************/ +void freeBuffer(void) { + freeAllStolenMem(); + + if (buffer) + deallocate(buffer, buffersize); +} + + + + +/*------------------------------------------------------------------------*/ +/* The following routines allow stealing of memory from the buffer (which */ +/* later may or may not be given back). */ +/*------------------------------------------------------------------------*/ + + + + +/*****************************************************************************/ +/* Clears all the buffers. */ +/*****************************************************************************/ +static void flushBuffers(void) { + uint16 RMarker; + + RMarker = 0; + + while (RMarker < MAXMARKERS) { + freeFile(RMarker); + RMarker++; + } +} + + + +/*****************************************************************************/ +/* Steal some memory from the buffer */ +/*****************************************************************************/ +void *stealBufMem(int32 Size) { + void *Mem; + + Size += DMABUGSIZE; + + flushBuffers(); + Mem = buffer; + + buffer += Size; + buffersize -= Size; + MemPlace = buffer; + + return Mem; +} + + +Common::File *openPartial(const char *name) { + Common::File *f; + + f = new Common::File(); + f->open(translateFileName(name)); + + if (!f->isOpen()) { + delete f; + return 0; + } + + return f; +} + + +/*****************************************************************************/ +/* Frees all the memory stolen from the buffer. */ +/*****************************************************************************/ +void freeAllStolenMem(void) { + flushBuffers(); + + buffer = realbufferstart; + buffersize = realbuffersize; + MemPlace = buffer; +} + + + + +/*--------------- Routines that read partial chunks of a file ---------------*/ + + + +/*****************************************************************************/ +/* Reads Size amount of bytes into buffer. */ +/*****************************************************************************/ +uint32 readPartial(int32 File, void *buf, uint32 Size) { + uint32 haveread = 0; + + warning("STUB: readPartial"); + +#if 0 + uint32 nsize; + + while (Size) { + if (Size > MAXREADSIZE) + nsize = MAXREADSIZE; + else + nsize = Size; + + haveread += (uint32)(read((int) File, buf, (int) nsize)); + Size -= nsize; + ((char *) buf) += nsize; + updateMouse(); + } +#endif + return haveread; +} + + + +/*****************************************************************************/ +/* Reads Size amount of bytes into buffer. Use this one if the data must */ +/* absolutely be correct (compressed data for example). Otherwise, because */ +/* of the DMA bug, last two bytes may be screwed. */ +/*****************************************************************************/ +uint32 newReadPartial(int32 File, void *buf, uint32 Size) { + return readPartial((int) File, buf, Size); +} + + + +/*****************************************************************************/ +/* Reads Size amount of bytes into buffer. Use this one if the data must */ +/* absolutely be correct (compressed data for example). Otherwise, because */ +/* of the DMA bug, last two bytes may be screwed. This one will work if the */ +/* data is not padded the extra two bytes. */ +/*****************************************************************************/ +uint32 bufferedReadPartial(int32 File, void *buf, uint32 Size) { + return readPartial(File, buf, Size); +} + + + +/*****************************************************************************/ +/* Sets the current position in the file relative to the beginning of the */ +/* file. */ +/*****************************************************************************/ +void setPos(int32 File, uint32 Place) { + warning("STUB: setPos"); + //lseek((int) File, (int32) Place, SEEK_SET); +} + + + +/*****************************************************************************/ +/* Skips a certain number of bytes either forward or backwards. */ +/*****************************************************************************/ +void skipPartial(int32 File, int32 Skip) { + warning("STUB: skipPartial"); + + //lseek((int) File, Skip, SEEK_CUR); +} + +} // End of namespace Lab diff --git a/engines/lab/labfun.h b/engines/lab/labfun.h new file mode 100644 index 0000000000..08130f3e0b --- /dev/null +++ b/engines/lab/labfun.h @@ -0,0 +1,393 @@ +/* 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. + * + */ + +/* + * This code is based on Labyrinth of Time code with assistance of + * + * Copyright (c) 1993 Terra Nova Development + * Copyright (c) 2004 The Wyrmkeep Entertainment Co. + * + */ + +#ifndef LAB_LABFUN_H +#define LAB_LABFUN_H + +#include "lab/stddefines.h" +#include "lab/parsetypes.h" +#include "common/file.h" + +namespace Lab { + +/* Direction defines */ +#define NORTH 0 +#define SOUTH 1 +#define EAST 2 +#define WEST 3 + + + +/* Generic co-ordinate define. */ +typedef struct { + uint16 x1, y1; +} Cords; + +struct Image; +struct TextFont; + +/*----------------------------*/ +/*------ From Audioi.c -------*/ +/*----------------------------*/ + +bool initAudio(void); + +void freeAudio(void); + +void initSampleRate(uint16 SampleSpeed); + +bool musicBufferEmpty(uint16 i); + +void playMusicBlock(void *Ptr, uint32 Size, uint16 BufferNum, uint16 SampleSpeed); + +void updateSoundBuffers(void); + +void flushAudio(void); + +void playMusic(uint16 SampleSpeed, uint16 Volume, uint32 Length, bool flush, void *Data); + + + + +/*----------------------------*/ +/*----- From graphics.c ------*/ +/*----------------------------*/ + +/* Reads in pictures */ + +bool readPict(const char *filename, bool PlayOnce); + +bool readMusic(const char *filename); + +byte *readPictToMem(const char *filename, uint16 x, uint16 y); + +/* Window text stuff */ + +uint32 flowText(void *font, /* the TextAttr pointer */ + uint16 spacing, /* How much vertical spacing between the lines */ + uint16 pencolor, /* pen number to use for text */ + uint16 backpen, /* the background color */ + bool fillback, /* Whether to fill the background */ + bool centerh, /* Whether to center the text horizontally */ + bool centerv, /* Whether to center the text vertically */ + bool output, /* Whether to output any text */ + uint16 x1, /* Cords */ + uint16 y1, uint16 x2, uint16 y2, const char *text); /* The text itself */ + +uint32 flowTextToMem(struct Image *DestIm, void *font, /* the TextAttr pointer */ + uint16 spacing, /* How much vertical spacing between the lines */ + uint16 pencolor, /* pen number to use for text */ + uint16 backpen, /* the background color */ + bool fillback, /* Whether to fill the background */ + bool centerh, /* Whether to center the text horizontally */ + bool centerv, /* Whether to center the text vertically */ + bool output, /* Whether to output any text */ + uint16 x1, /* Cords */ + uint16 y1, uint16 x2, uint16 y2, const char *text); /* The text itself */ + +void drawMessage(const char *text); + +void longDrawMessage(const char *text); + +bool readFont(char *filename, void *font, void *data); + +/* The Wipes */ + +void doWipe(uint16 WipeType, CloseDataPtr *CPtr, char *filename); + + +/* Double Buffer stuff */ + +void newFlipViews(void *scrPtr, uint16 *newpal, uint16 numcolors); + +void flipViews(void *scrPtr); + + + + +/*----------------------------*/ +/*----- From Interface.c -----*/ +/*----------------------------*/ + +struct Gadget *addGadButton(uint16 x, uint16 y, void *UpImage, void *DownImage, uint16 id); + +void gadgetsOnOff(void *gptr, void *win, int32 num, bool on); + +/*----------------------*/ +/*---- From Intro.c ----*/ +/*----------------------*/ + +void introSequence(void); + + + +/*----------------------*/ +/*----- From Lab.c -----*/ +/*----------------------*/ + +void eatMessages(void); + +bool setUpScreens(void); + +void drawPanel(void); + +bool quitPlaying(void); + + + +/*---------------------------*/ +/*------ From LabFile.c -----*/ +/*---------------------------*/ + +uint32 sizeOfFile(const char *name); + +/* Buffer a whole file */ + +byte **isBuffered(const char *fileName); + +byte **openFile(const char *name); + +void readBlock(void *Buffer, uint32 Size, byte **File); + +char readChar(char **File); + +void skip(byte **File, uint32 skip); + +void resetBuffer(void); + +bool initBuffer(uint32 BufSize, bool IsGraphicsMem); + +void freeBuffer(void); + + +/* Functions that borrow memory from the buffer */ + +bool allocFile(void **Ptr, uint32 Size, const char *fileName); + +void *stealBufMem(int32 Size); + +void freeAllStolenMem(void); + + +/* Read chunks of a file */ + + +Common::File *openPartial(const char *name); + +void closePartial(int32 File); + +uint32 readPartial(int32 File, void *buffer, uint32 Size); + +uint32 newReadPartial(int32 File, void *buffer, uint32 Size); + +uint32 bufferedReadPartial(int32 File, void *buffer, uint32 Size); + + +void setPos(int32 File, uint32 Place); + +void skipPartial(int32 File, int32 Skip); + + + +/*---------------------------*/ +/*------ From LabText.c -----*/ +/*---------------------------*/ + +bool initLabText(void); + +void freeLabText(void); + +void decrypt(byte *text); + + + +/*---------------------------*/ +/*----- From LabMusic.c -----*/ +/*---------------------------*/ + +#define MANYBUFFERS 5L +#define MAXBUFFERS 5L +#define MINBUFFERS 2L + +class Music { +public: + Music(); + + byte **newOpen(const char *name); + bool initMusic(void); + void freeMusic(void); + void fillUpMusic(bool doit); + void updateMusic(void); + void checkMusic(void); + void newCheckMusic(void); + void closeMusic(void); + void setMusic(bool on); + void restartBackMusic(void); + void pauseBackMusic(void); + void changeMusic(const char *newmusic); + void resetMusic(void); + void fileCheckMusic(uint32 filelength); + + bool _winmusic, _doNotFileFlushAudio; + bool _turnMusicOn; + bool _musicOn; + +private: + void fillbuffer(uint16 unit); + uint16 getManyBuffersLeft(void); + void startMusic(bool startatbegin); + + Common::File *_file; + Common::File *_tFile; + bool _musicPaused; + + bool _tMusicOn; + uint32 _tFileLength; + uint32 _tLeftInFile; + + uint16 _manyBuffers; + + void *_musicBuffer[MAXBUFFERS]; + uint16 _musicFilledTo, _musicPlaying, _musicOnBuffer; + + uint32 _filelength, _leftinfile; +}; + + +extern Music *g_music; + +/*---------------------------*/ +/*----- From LabSets.c ------*/ +/*---------------------------*/ + +typedef struct { + uint16 lastElement, array[1]; +} LargeSetRecord; + +typedef LargeSetRecord *LargeSet; + + + +bool createSet(LargeSet *set, uint16 last); + +void deleteSet(LargeSet set); + +bool In(LargeSet set, uint16 element); + +void inclElement(LargeSet set, uint16 element); + +void exclElement(LargeSet set, uint16 element); + + + + +/*---------------------------*/ +/*----- From Machine.c ------*/ +/*---------------------------*/ + +uint16 scaleX(uint16 x); + +uint16 scaleY(uint16 y); + +uint16 VGAScaleX(uint16 x); + +uint16 VGAScaleY(uint16 y); + +int16 VGAScaleXs(int16 x); + +int16 VGAScaleYs(int16 y); + +uint16 SVGACord(uint16 cord); + +uint16 VGAUnScaleX(uint16 x); + +uint16 VGAUnScaleY(uint16 y); + +char *translateFileName(const char *filename); + + + +/*---------------------------*/ +/*-------- From Map.c -------*/ +/*---------------------------*/ + +void fade(bool fadein, uint16 res); + +void setAmigaPal(uint16 *pal, uint16 numcolors); + +char *getText(const char *filename); + +bool getFont(const char *filename, TextFont *textfont); + +void readImage(byte **buffer, Image **im); + +void doMap(LargeSet RoomsFound, uint16 CurRoom); + +void doJournal(LargeSet Conditions); + +void doNotes(void); + +void doWestPaper(void); + +void doMonitor(char *background, char *textfile, bool isinteractive, uint16 x1, uint16 y1, uint16 x2, uint16 y2); + +uint16 doDisks(void); + +bool saveRestoreGame(void); + + + +/*--------------------------*/ +/*----- From saveGame.c ----*/ +/*--------------------------*/ + +bool saveFloppy(char *path, uint16 RoomNum, uint16 Direction, uint16 NumQuarters, LargeSet Conditions, LargeSet Rooms, uint16 filenum, uint16 type); + +bool readFloppy(char *path, uint16 *RoomNum, uint16 *Direction, uint16 *NumQuarters, LargeSet Conditions, LargeSet Rooms, uint16 filenum, uint16 type); + + + +/*--------------------------*/ +/*----- From Special.c -----*/ +/*--------------------------*/ + +void showCombination(const char *filename); + +void mouseCombination(LargeSet Conditions, uint16 x, uint16 y); + +void showTile(const char *filename, bool showsolution); + +void mouseTile(LargeSet Conditions, uint16 x, uint16 y); + +void inner_main(); + +} // End of namespace Lab + +#endif /* LAB_LABFUN_H */ diff --git a/engines/lab/labmusic.cpp b/engines/lab/labmusic.cpp new file mode 100644 index 0000000000..e15dfa70f4 --- /dev/null +++ b/engines/lab/labmusic.cpp @@ -0,0 +1,543 @@ +/* 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. + * + */ + +/* + * This code is based on Labyrinth of Time code with assistance of + * + * Copyright (c) 1993 Terra Nova Development + * Copyright (c) 2004 The Wyrmkeep Entertainment Co. + * + */ + +#include "lab/stddefines.h" +#include "lab/storage.h" +#include "lab/labfun.h" +#include "lab/timing.h" +#include "lab/mouse.h" + +namespace Lab { + +#define MUSICBUFSIZE (2 * 65536L) + +#define SAMPLESPEED 15000L + +extern bool EffectPlaying; +Music *g_music; + +Music::Music() { + _file = 0; + _tFile = 0; + _musicPaused = false; + + _tMusicOn = false; + _tFileLength = 0; + _tLeftInFile = 0; + + _manyBuffers = MANYBUFFERS; + + _musicFilledTo = 0; + _musicPlaying = 0; + _musicOnBuffer = 0; + + _filelength = 0; + _leftinfile = 0; + + _musicOn = false; + _turnMusicOn = false; + _winmusic = false; + _doNotFileFlushAudio = false; +} + +/*****************************************************************************/ +/* Figures out which buffer is currently playing based on messages sent to */ +/* it from the Audio device. */ +/*****************************************************************************/ +void Music::updateMusic(void) { + uint16 i; + +#if !defined(DOSCODE) + //SDL_ProcessInput(0); +#endif + updateMouse(); + + if (EffectPlaying) + updateSoundBuffers(); + else if (_musicOn) { + for (i = 0; i < 2; i++) { + if (musicBufferEmpty(i)) { + playMusicBlock(_musicBuffer[_musicPlaying], MUSICBUFSIZE, i, SAMPLESPEED); + + if (_musicPlaying) + _musicOnBuffer = _musicPlaying - 1; + else + _musicOnBuffer = _manyBuffers - 1; + + _musicPlaying++; + + if (_musicPlaying >= _manyBuffers) + _musicPlaying = 0; + } + } + } +} + + +void Music::fillbuffer(uint16 unit) { + uint32 Size = MUSICBUFSIZE; + void *ptr = _musicBuffer[unit]; +#if defined(DOSCODE) + char *endptr; +#endif + + if (Size < _leftinfile) { + _file->read(ptr, Size); + _leftinfile -= Size; + } else { + _file->read(ptr, _leftinfile); + +#if defined(DOSCODE) + endptr = ptr; + endptr += _leftinfile - 2; + + memset((void *)(((uint32) ptr) + _leftinfile), *endptr, Size - _leftinfile); +#else + memset((char *)ptr + _leftinfile, 0, Size - _leftinfile); +#endif + + _file->seek(0); + _leftinfile = _filelength; + } +} + + + +/*****************************************************************************/ +/* Figures out how many *complete* buffers of music left to play. */ +/*****************************************************************************/ +uint16 Music::getManyBuffersLeft(void) { + uint16 mp = _musicOnBuffer; + + if (mp == _musicFilledTo) /* Already filled */ + return _manyBuffers; + else if (mp > _musicFilledTo) + return _manyBuffers - (mp - _musicFilledTo); + else + return _musicFilledTo - mp; +} + + + +/*****************************************************************************/ +/* Fills up the buffers that have already been played if necessary; if doit */ +/* is set to TRUE then it will fill up all empty buffers. Otherwise, it */ +/* Check if there are MINBUFFERS or less buffers that are playing. */ +/*****************************************************************************/ +void Music::fillUpMusic(bool doit) { + int16 ManyLeft, ManyFill; + + updateMusic(); + + if (!_musicOn) + return; + + ManyLeft = getManyBuffersLeft(); + + if (ManyLeft < MINBUFFERS) + doit = true; + else if (ManyLeft == _manyBuffers) /* All the buffers are already full */ + doit = false; + + if (doit && (ManyLeft < _manyBuffers) && ManyLeft) { + ManyFill = _manyBuffers - ManyLeft - 1; + + while (ManyFill > 0) { + _musicFilledTo++; + + if (_musicFilledTo >= _manyBuffers) + _musicFilledTo = 0; + + fillbuffer(_musicFilledTo); + updateMusic(); + + ManyFill--; + } + + updateMusic(); + + ManyLeft = getManyBuffersLeft(); + + if (ManyLeft < _manyBuffers) { + ManyFill = _manyBuffers - ManyLeft - 1; + + while (ManyFill > 0) { + _musicFilledTo++; + + if (_musicFilledTo >= _manyBuffers) + _musicFilledTo = 0; + + fillbuffer(_musicFilledTo); + updateMusic(); + + ManyFill--; + } + } + } + + updateMusic(); + + /* NYI: A check for dirty cds; for instance, if lots of buffers already + played */ +} + + + + +/*****************************************************************************/ +/* Starts up the music initially. */ +/*****************************************************************************/ +void Music::startMusic(bool startatbegin) { + uint16 counter; + + if (!_musicOn) + return; + + flushAudio(); + + if (startatbegin) { + _file->seek(0); + _leftinfile = _filelength; + } + + initSampleRate(SAMPLESPEED); + + _musicPlaying = 0; + _musicOnBuffer = 0; + _musicFilledTo = _manyBuffers - 1; + + _musicOn = false; + + for (counter = 0; counter < _manyBuffers; counter++) + fillbuffer(counter); + + _musicOn = true; + updateMusic(); +} + + + + + + +/*****************************************************************************/ +/* Initializes the music buffers. */ +/*****************************************************************************/ +bool Music::initMusic(void) { + uint16 counter; + bool mem; + + if (!_turnMusicOn) + return true; + + _musicOn = true; + _musicPaused = false; + + const char *filename; + + if (_winmusic) + filename = "Music:WinGame"; + else + filename = "Music:BackGrou"; + + mem = true; + + if (_musicBuffer[0] == NULL) { + for (counter = 0; counter < _manyBuffers; counter++) + mem = mem && allocatedos((void **) & (_musicBuffer[counter]), MUSICBUFSIZE); + } + + if (mem) { + _filelength = sizeOfFile(filename); + _file = openPartial(filename); + + if (_file) { + startMusic(true); + return true; + } + } + + _musicOn = false; + return false; +} + + + +/*****************************************************************************/ +/* Frees up the music buffers and closes the file. */ +/*****************************************************************************/ +void Music::freeMusic(void) { + _musicOn = false; + + if (_file->isOpen()) + _file->close(); + + _file = 0; +} + + +/*****************************************************************************/ +/* Pauses the background music. */ +/*****************************************************************************/ +void Music::pauseBackMusic(void) { + if (!_musicPaused && _musicOn) { + updateMusic(); + _musicOn = false; + flushAudio(); + + if (_musicPlaying) + _musicPlaying--; + else + _musicPlaying = _manyBuffers - 1; + + _musicPaused = true; + } +} + + + +/*****************************************************************************/ +/* Restarts the paused background music. */ +/*****************************************************************************/ +void Music::restartBackMusic(void) { + if (_musicPaused) { + flushAudio(); + _musicOn = true; + updateMusic(); + _musicPaused = false; + } +} + + + + + +/*****************************************************************************/ +/* Checks to see if need to fill buffers fill of music. */ +/*****************************************************************************/ +void Music::checkMusic(void) { + updateMusic(); + + if (!_musicOn) + return; + + fillUpMusic(false); +} + + + +/*****************************************************************************/ +/* Checks to see if need to fill buffers fill of music. */ +/*****************************************************************************/ +void Music::newCheckMusic(void) { + checkMusic(); +} + + + + + +/*****************************************************************************/ +/* Turns the music on and off. */ +/*****************************************************************************/ +void Music::setMusic(bool on) { + flushAudio(); + + if (on && !_musicOn) { + _musicOn = true; + startMusic(true); + } else if (!on && _musicOn) { + _musicOn = false; + updateMusic(); + } else + _musicOn = on; +} + +/*****************************************************************************/ +/* Changes the background music to something else. */ +/*****************************************************************************/ +void Music::changeMusic(const char *newmusic) { + if (!_tFile) { + _tFile = _file; + _tMusicOn = _musicOn; + _tFileLength = _filelength; +#if defined(DOSCODE) + _tLeftInFile = _leftinfile; +#else + _tLeftInFile = _leftinfile + 65536L; + + if (_tLeftInFile > _tFileLength) + _tLeftInFile = _leftinfile; + +#endif + } + + _file = openPartial(newmusic); + + if (_file) { + _musicOn = true; /* turn it off */ + setMusic(false); + + _filelength = sizeOfFile(newmusic); + + _musicOn = false; /* turn it back on */ + setMusic(true); + } else { + _file = _tFile; + _tFile = 0; + } +} + + + +/*****************************************************************************/ +/* Changes the background music to the original piece playing. */ +/*****************************************************************************/ +void Music::resetMusic(void) { + if (!_tFile) + return; + + if (_file->isOpen()) + _file->close(); + + _file = _tFile; + _filelength = _tFileLength; + _leftinfile = _tLeftInFile; + + _file->seek(_filelength - _leftinfile); + + _musicOn = true; + setMusic(false); + updateMusic(); + + if (!_tMusicOn) { + _tFile = 0; + return; + } + + _musicOn = _tMusicOn; + startMusic(false); + + _tFile = 0; +} + + + + + +#define FUDGEFACTOR 5L +#define READSPEED (2 * 130000L) + + + +/*****************************************************************************/ +/* Checks whether or note enough memory in music buffer before loading any */ +/* files. Fills it if not. Does not take into account the current buffer */ +/* playing; a built in fudge factor. We've also got another FUDGEFACTOR */ +/* defined above in case things go wrong. */ +/* */ +/* Here, the seconds are multipled by 10. */ +/*****************************************************************************/ +byte **Music::newOpen(const char *name) { + uint32 filelength, LeftSecs, Time; + + byte **file; + + if (name == NULL) { + return NULL; + } + + if ((strcmp(name, "") == 0) || (strcmp(name, " ") == 0)) { + return NULL; + } + + if ((file = isBuffered(name))) { + return file; + } + + if (_musicOn) { + updateMusic(); + +#if defined(DOSCODE) + LeftSecs = (getManyBuffersLeft() * MUSICBUFSIZE * 10) / SAMPLESPEED; +#else + LeftSecs = (getManyBuffersLeft() * MUSICBUFSIZE * 10) / (2 * SAMPLESPEED); +#endif + + filelength = sizeOfFile(name) * 10; + Time = 10 + /* Seek time for the music and the file */ + (filelength / READSPEED) + /* Read time for the file */ + FUDGEFACTOR; + + if (Time >= LeftSecs) + fillUpMusic(true); + } + + if (!_doNotFileFlushAudio && EffectPlaying) + flushAudio(); + + file = openFile(name); + checkMusic(); + return file; +} + + + +/*****************************************************************************/ +/* Checks whether or note enough memory in music buffer to continue loading */ +/* in a file. Fills the music buffer if not. Does not take into account */ +/* the current buffer playing; a built in fudge factor. We've also got */ +/* another FUDGEFACTOR defined above in case things go wrong. */ +/* */ +/* Here, the seconds are multipled by 10. */ +/*****************************************************************************/ +void Music::fileCheckMusic(uint32 filelength) { + uint32 LeftSecs, Time; + + if (_musicOn) { + updateMusic(); + +#if defined(DOSCODE) + LeftSecs = (getManyBuffersLeft() * MUSICBUFSIZE * 10) / SAMPLESPEED; +#else + LeftSecs = (getManyBuffersLeft() * MUSICBUFSIZE * 10) / (2 * SAMPLESPEED); +#endif + + filelength *= 10; + Time = 5 + /* Seek time for the music */ + (filelength / READSPEED) + /* Read time for the file */ + FUDGEFACTOR; + + if (Time >= LeftSecs) + fillUpMusic(true); + } +} + +} // End of namespace Lab diff --git a/engines/lab/labsets.cpp b/engines/lab/labsets.cpp new file mode 100644 index 0000000000..5faf1cce8a --- /dev/null +++ b/engines/lab/labsets.cpp @@ -0,0 +1,94 @@ +/* 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. + * + */ + +/* + * This code is based on Labyrinth of Time code with assistance of + * + * Copyright (c) 1993 Terra Nova Development + * Copyright (c) 2004 The Wyrmkeep Entertainment Co. + * + */ + +#include "lab/stddefines.h" +#include "lab/labfun.h" +#include "lab/storage.h" + +namespace Lab { + +const uint32 LargeSetSIZE = sizeof(LargeSetRecord) - 2; + + + +/*****************************************************************************/ +/* Creates a large set. */ +/*****************************************************************************/ +bool createSet(LargeSet *set, uint16 last) { + last = (((last + 15) >> 4) << 4); + + if (allocate((void **) set, (last >> 3) + LargeSetSIZE)) { + (*set)->lastElement = last; + return true; + } else /* Not Enough Memory! */ + return false; + +} + + + + +/*****************************************************************************/ +/* Deletes a large set. */ +/*****************************************************************************/ +void deleteSet(LargeSet set) { + if (set != NULL) + deallocate(set, (set->lastElement >> 3) + LargeSetSIZE); +} + + + + +/*****************************************************************************/ +/* Tests if an element is in the set. */ +/*****************************************************************************/ +bool In(LargeSet set, uint16 element) { + return ((1 << ((element - 1) % 16)) & (set->array[(element - 1) >> 4])) > 0; +} + + + +/*****************************************************************************/ +/* Sets an element in the Large set. */ +/*****************************************************************************/ +void inclElement(LargeSet set, uint16 element) { + INCL((set->array[(element - 1) >> 4]), (1 << ((element - 1) % 16))); +} + + + +/*****************************************************************************/ +/* Removes an element in the Large set. */ +/*****************************************************************************/ +void exclElement(LargeSet set, uint16 element) { + EXCL((set->array[(element - 1) >> 4]), (1 << ((element - 1) % 16))); +} + +} // End of namespace Lab diff --git a/engines/lab/labtext.cpp b/engines/lab/labtext.cpp new file mode 100644 index 0000000000..d90929fc8e --- /dev/null +++ b/engines/lab/labtext.cpp @@ -0,0 +1,168 @@ +/* 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. + * + */ + +/* + * This code is based on Labyrinth of Time code with assistance of + * + * Copyright (c) 1993 Terra Nova Development + * Copyright (c) 2004 The Wyrmkeep Entertainment Co. + * + */ + +#include "lab/stddefines.h" +#include "lab/storage.h" +#include "lab/labfun.h" + +namespace Lab { + +static uint32 SizeOfMemChunk; +static char *BeginOfMemChunk, *CurPlace; + + +char *LOWERFLOORS, *MIDDLEFLOORS, *UPPERFLOORS, *MEDMAZEFLOORS, *HEDGEMAZEFLOORS, *SURMAZEFLOORS, *CARNIVALFLOOR, *SURMAZEMSG, *FACINGNORTH, *FACINGEAST, *FACINGSOUTH, *FACINGWEST, *LAMPONMSG, *TURNLEFT, *TURNRIGHT, *GOFORWARDDIR, *NOPATH, *TAKEITEM, *SAVETEXT, *LOADTEXT, *BOOKMARKTEXT, *PERSONALTEXT, *DISKTEXT, *SAVEBOOK, *RESTOREBOOK, *SAVEFLASH, *RESTOREFLASH, *SAVEDISK, *RESTOREDISK, *NODISKINDRIVE, *WRITEPROTECTED, *SELECTDISK, *FORMATFLOPPY, *FORMATTING, *NOTHING, *USEONWHAT, *TAKEWHAT, *MOVEWHAT, *OPENWHAT, *CLOSEWHAT, *LOOKWHAT, *USEMAP, *USEJOURNAL, *TURNLAMPON, *TURNLAMPOFF, *USEWHISKEY, *USEPITH, *USEHELMET; + + +#define LABTEXTFILE "Lab:Rooms/LabText" + + + + +/*****************************************************************************/ +/* Gets the next string from the list, and changes the end of string marker */ +/* from an end of line to a null character. */ +/*****************************************************************************/ +static void setString(char **string) { + *string = CurPlace; + + while (*CurPlace != '\n') + CurPlace++; + + *CurPlace = 0; + CurPlace++; +} + + + +/*****************************************************************************/ +/* Initializes everything for the Labyrinth text stuff */ +/*****************************************************************************/ +bool initLabText(void) { + if ((SizeOfMemChunk = sizeOfFile(LABTEXTFILE))) + if (allocate((void **) &BeginOfMemChunk, SizeOfMemChunk)) { + Common::File *file = openPartial(LABTEXTFILE); + + if (file) { + file->read(BeginOfMemChunk, SizeOfMemChunk); + file->close(); + + CurPlace = BeginOfMemChunk; + + setString(&LOWERFLOORS); + setString(&MIDDLEFLOORS); + setString(&UPPERFLOORS); + setString(&MEDMAZEFLOORS); + setString(&HEDGEMAZEFLOORS); + setString(&SURMAZEFLOORS); + setString(&CARNIVALFLOOR); + setString(&SURMAZEMSG); + + setString(&FACINGNORTH); + setString(&FACINGEAST); + setString(&FACINGSOUTH); + setString(&FACINGWEST); + + setString(&LAMPONMSG); + + setString(&TURNLEFT); + setString(&TURNRIGHT); + setString(&GOFORWARDDIR); + setString(&NOPATH); + setString(&TAKEITEM); + + setString(&SAVETEXT); + setString(&LOADTEXT); + setString(&BOOKMARKTEXT); + setString(&PERSONALTEXT); + setString(&DISKTEXT); + + setString(&SAVEBOOK); + setString(&RESTOREBOOK); + setString(&SAVEFLASH); + setString(&RESTOREFLASH); + setString(&SAVEDISK); + setString(&RESTOREDISK); + setString(&NODISKINDRIVE); + setString(&WRITEPROTECTED); + setString(&SELECTDISK); + + setString(&FORMATFLOPPY); + setString(&FORMATTING); + + setString(&NOTHING); + setString(&USEONWHAT); + setString(&TAKEWHAT); + setString(&MOVEWHAT); + setString(&OPENWHAT); + setString(&CLOSEWHAT); + setString(&LOOKWHAT); + + setString(&USEMAP); + setString(&USEJOURNAL); + setString(&TURNLAMPON); + setString(&TURNLAMPOFF); + setString(&USEWHISKEY); + setString(&USEPITH); + setString(&USEHELMET); + + return true; + } + } + + return false; +} + + +/*****************************************************************************/ +/* Frees the memory from the Labyrinth text stuff. */ +/*****************************************************************************/ +void freeLabText(void) { + if (SizeOfMemChunk && BeginOfMemChunk) + deallocate(BeginOfMemChunk, SizeOfMemChunk); +} + + + + +/*****************************************************************************/ +/* Decrypts a chunk of text. */ +/*****************************************************************************/ +void decrypt(byte *text) { + if (text == NULL) + return; + + while (*text != '\0') { + (*text) -= (byte) 95; + text++; + } +} + +} // End of namespace Lab diff --git a/engines/lab/machine.cpp b/engines/lab/machine.cpp new file mode 100644 index 0000000000..ab46ce600e --- /dev/null +++ b/engines/lab/machine.cpp @@ -0,0 +1,372 @@ +/* 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. + * + */ + +/* + * This code is based on Labyrinth of Time code with assistance of + * + * Copyright (c) 1993 Terra Nova Development + * Copyright (c) 2004 The Wyrmkeep Entertainment Co. + * + */ + +#include "lab/stddefines.h" + +namespace Lab { + +bool IsHiRes = false; + +/*****************************************************************************/ +/* Scales the x co-ordinates to that of the new display. In the room parser */ +/* file, co-ordinates are set up on a 360x336 display. */ +/*****************************************************************************/ +uint16 scaleX(uint16 x) { + if (IsHiRes) + return (uint16)((x * 16) / 9); + else + return (uint16)((x * 8) / 9); +} + + + + +/*****************************************************************************/ +/* Scales the y co-ordinates to that of the new display. In the room parser */ +/* file, co-ordinates are set up on a 368x336 display. */ +/*****************************************************************************/ +uint16 scaleY(uint16 y) { + if (IsHiRes) + return (y + (y / 14)); + else + return ((y * 10) / 24); +} + + + + +/*****************************************************************************/ +/* Scales the VGA cords to SVGA if necessary; otherwise, returns VGA cords. */ +/*****************************************************************************/ +uint16 VGAScaleX(uint16 x) { + if (IsHiRes) + return (x * 2); + else + return x; +} + + + + +/*****************************************************************************/ +/* Scales the VGA cords to SVGA if necessary; otherwise, returns VGA cords. */ +/*****************************************************************************/ +uint16 VGAScaleY(uint16 y) { + if (IsHiRes) + return ((y * 12) / 5); + else + return y; +} + + + +/*****************************************************************************/ +/* Scales the VGA cords to SVGA if necessary; otherwise, returns VGA cords. */ +/*****************************************************************************/ +int16 VGAScaleXs(int16 x) { + if (IsHiRes) + return (x * 2); + else + return x; +} + + + + +/*****************************************************************************/ +/* Scales the VGA cords to SVGA if necessary; otherwise, returns VGA cords. */ +/*****************************************************************************/ +int16 VGAScaleYs(int16 y) { + if (IsHiRes) + return ((y * 12) / 5); + else + return y; +} + + + + +uint16 SVGACord(uint16 cord) { + if (IsHiRes) + return cord; + else + return 0; +} + + + + +/*****************************************************************************/ +/* Converts SVGA cords to VGA if necessary, otherwise returns VGA cords. */ +/*****************************************************************************/ +uint16 VGAUnScaleX(uint16 x) { + if (IsHiRes) + return (x / 2); + else + return x; +} + + + + +/*****************************************************************************/ +/* Converts SVGA cords to VGA if necessary, otherwise returns VGA cords. */ +/*****************************************************************************/ +uint16 VGAUnScaleY(uint16 y) { + if (IsHiRes) + return ((y * 5) / 12); + else + return y; +} + + + + +#if defined(WIN32) +/*****************************************************************************/ +/* Replaces all occurences of a character in a string with a new one. */ +/*****************************************************************************/ +static void strrplc(char *text, char orig, char replace) { + uint16 counter; + + counter = 0; + + while (text[counter]) { + if (text[counter] == orig) + text[counter] = replace; + + counter++; + } +} +#endif + + +/*****************************************************************************/ +/* Checks to see if all the characters in the second string are at the start */ +/* of the first. */ +/*****************************************************************************/ +static bool strstart(const char **Source, const char *Start) { + uint16 len1, len2, counter; + + len1 = strlen(*Source); + len2 = strlen(Start); + + if (len1 < len2) + return false; + + for (counter = 0; counter < len2; counter++) + if ((*Source)[counter] != Start[counter]) + return false; + + (*Source) += len2; + return true; +} + + +static char NewFileName[255]; + +/*****************************************************************************/ +/* Modifes the filename so that paths and stuff are correct. Should mostly */ +/* deal with assigns and the '/' instead of '\' on IBM systems. */ +/* */ +/* NOTE: Make a *copy* of the string, and modify that. It would be a real */ +/* *bad* idea to modify the original. Since Labyrinth only focuses its */ +/* attention to one file at a time, it would be fine to have one variable */ +/* not on the stack which is used to store the new filename. */ +/*****************************************************************************/ +static void mystrupr(char *s) { + char c; + + while ((c = *s) != 0) + *s++ = toupper(c); +} + +char *translateFileName(const char *filename) { + char tempfilename[255]; + char *dot; + + strcpy(tempfilename, filename); + mystrupr(tempfilename); + + *NewFileName = 0; + filename = tempfilename; + + if (strstart(&filename, "P:")) { + if (IsHiRes) + strcat(NewFileName, "GAME/SPICT/"); + else + strcat(NewFileName, "GAME/PICT/"); + } else if (strstart(&filename, "LAB:")) + strcat(NewFileName, "GAME/"); + else if (strstart(&filename, "MUSIC:")) + strcat(NewFileName, "GAME/MUSIC/"); + + strcat(NewFileName, filename); + + dot = strrchr(NewFileName, '.'); + + if (dot != NewFileName && dot != NULL && dot[4] != '/') { // Linux may start with '.' + dot[4] = 0; // Back to the days of 8.3, even if your OS was never DOSish!! + } + + return NewFileName; +} + +#if defined(USE_SWAP) + +uint16 swapUShort(uint16 value) { + char *b = (char *)&value; + char t = b[0]; + b[0] = b[1]; + b[1] = t; + return value; +} +uint16 *swapUShortPtr(uint16 *ptr, int count) { + while (count-- > 0) { + char *b = (char *)ptr++; + char t = b[0]; + b[0] = b[1]; + b[1] = t; + } + + return ptr; +} +int16 swapShort(int16 value) { + char *b = (char *)&value; + char t = b[0]; + b[0] = b[1]; + b[1] = t; + return value; +} +int16 *swapShortPtr(int16 *ptr, int count) { + while (count-- > 0) { + char *b = (char *)ptr++; + char t = b[0]; + b[0] = b[1]; + b[1] = t; + } + + return ptr; +} +unsigned int swapUInt(unsigned int value) { + char *b = (char *)&value; + char t = b[0]; + b[0] = b[3]; + b[3] = t; + t = b[1]; + b[1] = b[2]; + b[2] = t; + return value; +} +unsigned int *swapUIntPtr(unsigned int *ptr, int count) { + while (count-- > 0) { + char *b = (char *)ptr++; + char t = b[0]; + b[0] = b[3]; + b[3] = t; + t = b[1]; + b[1] = b[2]; + b[2] = t; + } + + return ptr; +} +int swapInt(int value) { + char *b = (char *)&value; + char t = b[0]; + b[0] = b[3]; + b[3] = t; + t = b[1]; + b[1] = b[2]; + b[2] = t; + return value; +} +int *swapIntPtr(int *ptr, int count) { + while (count-- > 0) { + char *b = (char *)ptr++; + char t = b[0]; + b[0] = b[3]; + b[3] = t; + t = b[1]; + b[1] = b[2]; + b[2] = t; + } + + return ptr; +} +uint32 swapULong(uint32 value) { + char *b = (char *)&value; + char t = b[0]; + b[0] = b[3]; + b[3] = t; + t = b[1]; + b[1] = b[2]; + b[2] = t; + return value; +} +uint32 *swapULongPtr(uint32 *ptr, int count) { + while (count-- > 0) { + char *b = (char *)ptr++; + char t = b[0]; + b[0] = b[3]; + b[3] = t; + t = b[1]; + b[1] = b[2]; + b[2] = t; + } + + return ptr; +} +int32 swapLong(int32 value) { + char *b = (char *)&value; + char t = b[0]; + b[0] = b[3]; + b[3] = t; + t = b[1]; + b[1] = b[2]; + b[2] = t; + return value; +} +int32 *swapLongPtr(int32 *ptr, int count) { + while (count-- > 0) { + char *b = (char *)ptr++; + char t = b[0]; + b[0] = b[3]; + b[3] = t; + t = b[1]; + b[1] = b[2]; + b[2] = t; + } + + return ptr; +} +#endif + +} // End of namespace Lab diff --git a/engines/lab/map.cpp b/engines/lab/map.cpp new file mode 100644 index 0000000000..f6e94990b5 --- /dev/null +++ b/engines/lab/map.cpp @@ -0,0 +1,955 @@ +/* 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. + * + */ + +/* + * This code is based on Labyrinth of Time code with assistance of + * + * Copyright (c) 1993 Terra Nova Development + * Copyright (c) 2004 The Wyrmkeep Entertainment Co. + * + */ + +#include "lab/storage.h" +#include "lab/labfun.h" +#include "lab/diff.h" +#include "lab/vga.h" +#include "lab/text.h" +#include "lab/mouse.h" +#include "lab/parsefun.h" +#include "lab/parsetypes.h" +#include "lab/interface.h" +#include "lab/text.h" +#include "lab/stddefines.h" + +namespace Lab { + +static struct TextFont *BigMsgFont; +static struct TextFont bmf; + + +extern uint16 Direction; +extern bool IsHiRes; +extern uint32 VGAScreenWidth, VGAScreenHeight; + +#if !defined(DOSCODE) +extern CloseDataPtr CPtr; +extern uint16 RoomNum; +#endif + +/*****************************************************************************/ +/* Converts an Amiga palette (up to 16 colors) to a VGA palette, then sets */ +/* the VGA palette. */ +/*****************************************************************************/ +void setAmigaPal(uint16 *pal, uint16 numcolors) { + char vgapal[16 * 3]; + uint16 counter, vgacount; + + if (numcolors > 16) + numcolors = 16; + + vgacount = 0; + + for (counter = 0; counter < numcolors; counter++) { + vgapal[vgacount] = (char)(((pal[counter] & 0xf00) >> 8) << 2); + vgacount++; + vgapal[vgacount] = (char)(((pal[counter] & 0x0f0) >> 4) << 2); + vgacount++; + vgapal[vgacount] = (char)(((pal[counter] & 0x00f)) << 2); + vgacount++; + } + + writeColorRegsSmooth(vgapal, 0, 16); +} + + +/*****************************************************************************/ +/* Gets a font from disk and puts it into temporary memory. */ +/*****************************************************************************/ +bool getFont(const char *filename, TextFont *textfont) { + byte *fontbuffer; + + fontbuffer = (byte *)stealBufMem(sizeOfFile(filename) - + (sizeof(struct TextFont) + 4)); + g_music->checkMusic(); + + if (fontbuffer == NULL) + return false; + + return openFontMem(filename, textfont, fontbuffer); +} + + + + +/*****************************************************************************/ +/* Gets a chunk of text and puts it into the graphics memory. */ +/*****************************************************************************/ +char *getText(const char *filename) { + bool dodecrypt; + byte **tfile; + + g_music->checkMusic(); + dodecrypt = (isBuffered(filename) == NULL); + tfile = g_music->newOpen(filename); + + if (!tfile) + return NULL; + + if (dodecrypt) + decrypt(*tfile); + + return (char *)*tfile; +} + + + +/*****************************************************************************/ +/* Reads in an image from disk. */ +/*****************************************************************************/ +void readImage(byte **buffer, Image **im) { + uint32 size; + + (*im) = (Image *)(*buffer); + + (*im)->Width = READ_LE_UINT16(*buffer); + (*im)->Height = READ_LE_UINT16(*buffer + 2); + + *buffer += 8; /* sizeof(struct Image); */ + + size = (*im)->Width * (*im)->Height; + + if (1L & size) + size++; + + (*im)->ImageData = (byte *)(*buffer); + (*buffer) += size; +} + + + + + + +/*---------------------------------------------------------------------------*/ +/*------------------------------ The Map stuff ------------------------------*/ +/*---------------------------------------------------------------------------*/ + + + +extern RoomData *Rooms; +extern char *ViewPath; + +static Image *Map, *Room, *UpArrowRoom, *DownArrowRoom, *Bridge, + *HRoom, *VRoom, *Maze, *HugeMaze, *Path, *MapNorth, + *MapEast, *MapSouth, *MapWest, *XMark, *Back, *BackAlt, + *Down, *DownAlt, *Up, *UpAlt; + +static uint16 MaxRooms; +static MapData *Maps; + +extern char *LOWERFLOORS, *MIDDLEFLOORS, *UPPERFLOORS, *MEDMAZEFLOORS, *HEDGEMAZEFLOORS, *SURMAZEFLOORS, *CARNIVALFLOOR, *SURMAZEMSG; + +extern TextFont *MsgFont; + +uint16 *FadePalette; + +static uint16 MapGadX[3] = {101, 55, 8}, MapGadY[3] = {105, 105, 105}; +#if !defined(DOSCODE) +static Gadget downgadget = { 101, 105, 2, VKEY_DNARROW, 0L, NULL, NULL, NULL }, + upgadget = { 55, 105, 1, VKEY_UPARROW, 0L, NULL, NULL, &downgadget }, + backgadget = { 8, 105, 0, 0, 0L, NULL, NULL, &upgadget }, +#else +static Gadget downgadget = { 101, 105, 2, 0L, NULL, NULL, NULL }, + upgadget = { 55, 105, 1, 0L, NULL, NULL, &downgadget }, + backgadget = { 8, 105, 0, 0L, NULL, NULL, &upgadget }, +#endif +*MapGadgetList = &backgadget; + +static uint16 AmigaMapPalette[] = { + 0x0BA8, 0x0C11, 0x0A74, 0x0076, + 0x0A96, 0x0DCB, 0x0CCA, 0x0222, + 0x0444, 0x0555, 0x0777, 0x0999, + 0x0AAA, 0x0ED0, 0x0EEE, 0x0694 +}; + + +#define LOWERFLOOR 1 +#define MIDDLEFLOOR 2 +#define UPPERFLOOR 3 +#define MEDMAZEFLOOR 4 +#define HEDGEMAZEFLOOR 5 +#define SURMAZEFLOOR 6 +#define CARNIVAL 7 + + + +static uint16 mapScaleX(uint16 x) { + if (IsHiRes) + return (x - 45); + else + return ((x - 45) >> 1); +} + + + +static uint16 mapScaleY(uint16 y) { + if (IsHiRes) + return y; + else + return ((y - 35) >> 1) - (y >> 6); +} + + + + +/*****************************************************************************/ +/* Loads in the map data. */ +/*****************************************************************************/ +static bool loadMapData(void) { + byte **buffer, Temp[5]; + int32 Size; + struct Gadget *gptr; + uint16 counter; + + BigMsgFont = &bmf; + + if (!getFont("P:Map.fon", BigMsgFont)) + BigMsgFont = MsgFont; + + Size = sizeOfFile("P:MapImage"); + resetBuffer(); /* Make images load into start of buffer */ + buffer = g_music->newOpen("P:MapImage"); + + if (!buffer) + return false; + + stealBufMem(Size); /* Now freeze that buffer from further use */ + + readImage(buffer, &Map); + + readImage(buffer, &Room); + readImage(buffer, &UpArrowRoom); + readImage(buffer, &DownArrowRoom); + readImage(buffer, &HRoom); + readImage(buffer, &VRoom); + readImage(buffer, &Maze); + readImage(buffer, &HugeMaze); + + readImage(buffer, &MapNorth); + readImage(buffer, &MapEast); + readImage(buffer, &MapSouth); + readImage(buffer, &MapWest); + + readImage(buffer, &Path); + readImage(buffer, &Bridge); + + readImage(buffer, &Back); + readImage(buffer, &BackAlt); + readImage(buffer, &Up); + readImage(buffer, &UpAlt); + readImage(buffer, &Down); + readImage(buffer, &DownAlt); + + backgadget.Im = Back; + backgadget.ImAlt = BackAlt; + upgadget.Im = Up; + upgadget.ImAlt = UpAlt; + downgadget.Im = Down; + downgadget.ImAlt = DownAlt; + + counter = 0; + gptr = MapGadgetList; + + while (gptr) { + gptr->x = VGAScaleX(MapGadX[counter]); + gptr->y = VGAScaleY(MapGadY[counter]); + gptr = gptr->NextGadget; + counter++; + } + + buffer = g_music->newOpen("Lab:Maps"); + stealBufMem(sizeOfFile("Lab:Maps")); /* Freeze the memory for the maps */ + readBlock(Temp, 4L, buffer); + Temp[4] = 0; + + if (strcmp((char *)Temp, "MAP0") == 0) { + readBlock(&MaxRooms, 2L, buffer); +#if !defined(DOSCODE) + swapUShortPtr(&MaxRooms, 1); +#endif + Maps = (MapData *)(*buffer); +#if !defined(DOSCODE) + + for (counter = 1; counter <= MaxRooms; counter++) { + swapUShortPtr(&Maps[counter].x, 4); + swapULongPtr(&Maps[counter].MapFlags, 1); + } + +#endif + } else + return false; + + return true; +} + + + + +static uint16 fadeNumIn(uint16 num, uint16 res, uint16 counter) { + return (num - ((((int32)(15 - counter)) * ((int32)(num - res))) / 15)); +} + + +static uint16 fadeNumOut(uint16 num, uint16 res, uint16 counter) { + return (num - ((((int32) counter) * ((int32)(num - res))) / 15)); +} + + + +/*****************************************************************************/ +/* Does the fading of the Palette on the screen. */ +/*****************************************************************************/ +void fade(bool fadein, uint16 res) { + uint16 pennum, counter, newpal[16]; + + for (counter = 0; counter < 16; counter++) { + for (pennum = 0; pennum < 16; pennum++) { + if (fadein) + newpal[pennum] = (0x00F & fadeNumIn(0x00F & FadePalette[pennum], 0x00F & res, counter)) + + (0x0F0 & fadeNumIn(0x0F0 & FadePalette[pennum], 0x0F0 & res, counter)) + + (0xF00 & fadeNumIn(0xF00 & FadePalette[pennum], 0xF00 & res, counter)); + else + newpal[pennum] = (0x00F & fadeNumOut(0x00F & FadePalette[pennum], 0x00F & res, counter)) + + (0x0F0 & fadeNumOut(0x0F0 & FadePalette[pennum], 0x0F0 & res, counter)) + + (0xF00 & fadeNumOut(0xF00 & FadePalette[pennum], 0xF00 & res, counter)); + } + + setAmigaPal(newpal, 16); + waitTOF(); + g_music->updateMusic(); + } +} + + + +/*****************************************************************************/ +/* Figures out what a room's coordinates should be. */ +/*****************************************************************************/ +static void roomCords(uint16 CurRoom, uint16 *x1, uint16 *y1, uint16 *x2, uint16 *y2) { + *x1 = mapScaleX(Maps[CurRoom].x); + *y1 = mapScaleY(Maps[CurRoom].y); + *x2 = *x1; + *y2 = *y1; + + switch (Maps[CurRoom].SpecialID) { + case NORMAL: + case UPARROWROOM: + case DOWNARROWROOM: + (*x2) += Room->Width; + (*y2) += Room->Height; + break; + + case BRIDGEROOM: + (*x2) += Bridge->Width; + (*y2) += Bridge->Height; + break; + + case VCORRIDOR: + (*x2) += VRoom->Width; + (*y2) += VRoom->Height; + break; + + case HCORRIDOR: + (*x2) += HRoom->Width; + (*y2) += HRoom->Height; + break; + } +} + + + + + +/*****************************************************************************/ +/* Draws a room to the bitmap. */ +/*****************************************************************************/ +static void drawRoom(uint16 CurRoom, bool drawx) { + uint16 x, y, xx, xy, offset; + uint32 flags; + + x = mapScaleX(Maps[CurRoom].x); + y = mapScaleY(Maps[CurRoom].y); + flags = Maps[CurRoom].MapFlags; + + switch (Maps[CurRoom].SpecialID) { + case NORMAL: + case UPARROWROOM: + case DOWNARROWROOM: + if (Maps[CurRoom].SpecialID == NORMAL) + drawImage(Room, x, y); + else if (Maps[CurRoom].SpecialID == DOWNARROWROOM) + drawImage(DownArrowRoom, x, y); + else + drawImage(UpArrowRoom, x, y); + + offset = (Room->Width - Path->Width) / 2; + + if ((NORTHDOOR & flags) && (y >= Path->Height)) + drawImage(Path, x + offset, y - Path->Height); + + if (SOUTHDOOR & flags) + drawImage(Path, x + offset, y + Room->Height); + + offset = (Room->Height - Path->Height) / 2; + + if (EASTDOOR & flags) + drawImage(Path, x + Room->Width, y + offset); + + if (WESTDOOR & flags) + drawImage(Path, x - Path->Width, y + offset); + + xx = x + (Room->Width - XMark->Width) / 2; + xy = y + (Room->Height - XMark->Height) / 2; + + break; + + case BRIDGEROOM: + drawImage(Bridge, x, y); + + xx = x + (Bridge->Width - XMark->Width) / 2; + xy = y + (Bridge->Height - XMark->Height) / 2; + + break; + + case VCORRIDOR: + drawImage(VRoom, x, y); + + offset = (VRoom->Width - Path->Width) / 2; + + if (NORTHDOOR & flags) + drawImage(Path, x + offset, y - Path->Height); + + if (SOUTHDOOR & flags) + drawImage(Path, x + offset, y + VRoom->Height); + + offset = (Room->Height - Path->Height) / 2; + + if (EASTDOOR & flags) + drawImage(Path, x + VRoom->Width, y + offset); + + if (WESTDOOR & flags) + drawImage(Path, x - Path->Width, y + offset); + + if (EASTBDOOR & flags) + drawImage(Path, x + VRoom->Width, y - offset - Path->Height + VRoom->Height); + + if (WESTBDOOR & flags) + drawImage(Path, x - Path->Width, y - offset - Path->Height + VRoom->Height); + + offset = (VRoom->Height - Path->Height) / 2; + + if (EASTMDOOR & flags) + drawImage(Path, x + VRoom->Width, y - offset - Path->Height + VRoom->Height); + + if (WESTMDOOR & flags) + drawImage(Path, x - Path->Width, y - offset - Path->Height + VRoom->Height); + + xx = x + (VRoom->Width - XMark->Width) / 2; + xy = y + (VRoom->Height - XMark->Height) / 2; + + break; + + case HCORRIDOR: + drawImage(HRoom, x, y); + + offset = (Room->Width - Path->Width) / 2; + + if (NORTHDOOR & flags) + drawImage(Path, x + offset, y - Path->Height); + + if (SOUTHDOOR & flags) + drawImage(Path, x + offset, y + Room->Height); + + if (NORTHRDOOR & flags) + drawImage(Path, x - offset - Path->Width + HRoom->Width, y - Path->Height); + + if (SOUTHRDOOR & flags) + drawImage(Path, x - offset - Path->Width + HRoom->Width, y + Room->Height); + + offset = (HRoom->Width - Path->Width) / 2; + + if (NORTHMDOOR & flags) + drawImage(Path, x - offset - Path->Width + HRoom->Width, y - Path->Height); + + if (SOUTHMDOOR & flags) + drawImage(Path, x - offset - Path->Width + HRoom->Width, y + Room->Height); + + offset = (Room->Height - Path->Height) / 2; + + if (EASTDOOR & flags) + drawImage(Path, x + HRoom->Width, y + offset); + + if (WESTDOOR & flags) + drawImage(Path, x - Path->Width, y + offset); + + xx = x + (HRoom->Width - XMark->Width) / 2; + xy = y + (HRoom->Height - XMark->Height) / 2; + + break; + + default: + return; + } + + if (drawx) + drawImage(XMark, xx, xy); +} + + + +/*****************************************************************************/ +/* Checks if a floor has been visitted. */ +/*****************************************************************************/ +static bool onFloor(LargeSet RoomsFound, uint16 Floor) { + uint16 drawroom; + + for (drawroom = 1; drawroom <= MaxRooms; drawroom++) { + if ((Maps[drawroom].PageNumber == Floor) + && In(RoomsFound, drawroom) + && Maps[drawroom].x) { + return true; + } + } + + return false; +} + + + + +/*****************************************************************************/ +/* Figures out which floor, if any, should be gone to if the up arrow is hit */ +/*****************************************************************************/ +static void getUpFloor(LargeSet RoomsFound, uint16 *Floor, bool *isfloor) { + do { + *isfloor = true; + + if (*Floor < UPPERFLOOR) + (*Floor)++; + else { + *Floor = CARNIVAL + 1; + *isfloor = false; + return; + } + } while ((!onFloor(RoomsFound, *Floor)) && (*Floor <= CARNIVAL)); +} + + + + +/*****************************************************************************/ +/* Figures out which floor, if any, should be gone to if the down arrow is */ +/* hit. */ +/*****************************************************************************/ +static void getDownFloor(LargeSet RoomsFound, uint16 *Floor, bool *isfloor) { + do { + *isfloor = true; + + if ((*Floor == LOWERFLOOR) || (*Floor == 0)) { + *Floor = 0; + *isfloor = false; + return; + } else if (*Floor > UPPERFLOOR) { + /* LAB: Labyrinth specific code */ + if (*Floor == HEDGEMAZEFLOOR) + *Floor = UPPERFLOOR; + else if ((*Floor == CARNIVAL) || (*Floor == MEDMAZEFLOOR)) + *Floor = MIDDLEFLOOR; + else if (*Floor == SURMAZEFLOOR) + *Floor = LOWERFLOOR; + else { + *Floor = 0; + *isfloor = false; + return; + } + } else + (*Floor)--; + + } while ((!onFloor(RoomsFound, *Floor)) && *Floor); +} + + + + + +/*****************************************************************************/ +/* Draws the map */ +/*****************************************************************************/ +static void drawMap(LargeSet RoomsFound, uint16 CurRoom, uint16 CurMsg, uint16 Floor, bool fadeout, bool fadein) { + uint16 drawroom; + char *sptr; + + uint16 tempfloor; + bool noghoast; + + mouseHide(); + + if (fadeout) + fade(false, 0); + + setAPen(0); + rectFill(0, 0, VGAScreenWidth - 1, VGAScreenHeight - 1); + + drawImage(Map, 0, 0); + drawGadgetList(MapGadgetList); + + for (drawroom = 1; drawroom <= MaxRooms; drawroom++) { + if ((Maps[drawroom].PageNumber == Floor) + && In(RoomsFound, drawroom) + && Maps[drawroom].x) { + drawRoom(drawroom, (bool)(drawroom == CurRoom)); + g_music->checkMusic(); + } + } + + if ((Maps[CurRoom].PageNumber == Floor) /* Makes sure the X is drawn in corridors */ + && In(RoomsFound, CurRoom) /* NOTE: this here on purpose just in case there's some wierd condition, like the surreal maze where there are no rooms */ + && Maps[CurRoom].x) + drawRoom(CurRoom, true); + + tempfloor = Floor; + getUpFloor(RoomsFound, &tempfloor, &noghoast); + + if (noghoast) + unGhoastGadget(&upgadget); + else + ghoastGadget(&upgadget, 12); + + tempfloor = Floor; + getDownFloor(RoomsFound, &tempfloor, &noghoast); + + if (noghoast) + unGhoastGadget(&downgadget); + else + ghoastGadget(&downgadget, 12); + + /* LAB: Labyrinth specific code */ + if (Floor == LOWERFLOOR) { + if (onFloor(RoomsFound, SURMAZEFLOOR)) + drawImage(Maze, mapScaleX(538), mapScaleY(277)); + } + + else if (Floor == MIDDLEFLOOR) { + if (onFloor(RoomsFound, CARNIVAL)) + drawImage(Maze, mapScaleX(358), mapScaleY(72)); + + if (onFloor(RoomsFound, MEDMAZEFLOOR)) + drawImage(Maze, mapScaleX(557), mapScaleY(325)); + } + + else if (Floor == UPPERFLOOR) { + if (onFloor(RoomsFound, HEDGEMAZEFLOOR)) + drawImage(HugeMaze, mapScaleX(524), mapScaleY(97)); + } + + else if (Floor == SURMAZEFLOOR) { + flowText(MsgFont, 0, 7, 0, true, true, true, true, mapScaleX(360), 0, mapScaleX(660), mapScaleY(450), SURMAZEMSG); + } + + + /* LAB: Labyrinth specific code */ + sptr = NULL; + + switch (Floor) { + case LOWERFLOOR: + sptr = LOWERFLOORS; + break; + + case MIDDLEFLOOR: + sptr = MIDDLEFLOORS; + break; + + case UPPERFLOOR: + sptr = UPPERFLOORS; + break; + + case MEDMAZEFLOOR: + sptr = MEDMAZEFLOORS; + break; + + case HEDGEMAZEFLOOR: + sptr = HEDGEMAZEFLOORS; + break; + + case SURMAZEFLOOR: + sptr = SURMAZEFLOORS; + break; + + case CARNIVAL: + sptr = CARNIVALFLOOR; + break; + + default: + sptr = NULL; + break; + } + + if (sptr) + flowText(MsgFont, 0, 5, 3, true, true, true, true, VGAScaleX(14), VGAScaleY(75), VGAScaleX(134), VGAScaleY(97), sptr); + + if ((sptr = Rooms[CurMsg].RoomMsg)) + flowText(MsgFont, 0, 5, 3, true, true, true, true, VGAScaleX(14), VGAScaleY(148), VGAScaleX(134), VGAScaleY(186), sptr); + + if (fadein) + fade(true, 0); + + mouseShow(); +} + + + +/*****************************************************************************/ +/* Processes the map. */ +/*****************************************************************************/ +void processMap(uint16 CurRoom, LargeSet RoomsFound) { + uint32 Class, place = 1; + uint16 Code, Qualifier, MouseX, MouseY, GadgetID, CurFloor, OldFloor, OldMsg, CurMsg, drawroom, x1, y1, x2, y2; + char *sptr, newcolor[3]; + bool drawmap; + struct IntuiMessage *Msg; + + CurMsg = CurRoom; + CurFloor = Maps[CurRoom].PageNumber; + + while (1) { + g_music->checkMusic(); /* Make sure we check the music at least after every message */ + Msg = getMsg(); + + if (Msg == NULL) { + g_music->newCheckMusic(); + + if (place <= 14) { + newcolor[0] = 14 << 2; + newcolor[1] = place << 2; + newcolor[2] = newcolor[1]; + } else { + newcolor[0] = 14 << 2; + newcolor[1] = (28 - place) << 2; + newcolor[2] = newcolor[1]; + } + + waitTOF(); + writeColorReg(newcolor, 1); + updateMouse(); + waitTOF(); + updateMouse(); + waitTOF(); + updateMouse(); + waitTOF(); + updateMouse(); + + place++; + + if (place >= 28) + place = 1; + + } else { + Class = Msg->Class; + Code = Msg->Code; + GadgetID = Msg->GadgetID; + Qualifier = Msg->Qualifier; + MouseX = Msg->MouseX; + MouseY = Msg->MouseY; + + if (((Class == MOUSEBUTTONS) && (IEQUALIFIER_RBUTTON & Qualifier)) || + ((Class == RAWKEY) && (Code == 27))) + return; + + if (Class == GADGETUP) { + if (GadgetID == 0) { /* Quit menu button */ + return; + } else if (GadgetID == 1) { /* Up arrow */ + OldFloor = CurFloor; + getUpFloor(RoomsFound, &CurFloor, &drawmap); + + if (drawmap) { + fade(false, 0); + drawMap(RoomsFound, CurRoom, CurMsg, CurFloor, false, false); + fade(true, 0); + } else + CurFloor = OldFloor; + } else if (GadgetID == 2) { /* Down arrow */ + OldFloor = CurFloor; + getDownFloor(RoomsFound, &CurFloor, &drawmap); + + if (drawmap) { + fade(false, 0); + drawMap(RoomsFound, CurRoom, CurMsg, CurFloor, false, false); + fade(true, 0); + } else + CurFloor = OldFloor; + } + } + + else if ((Class == MOUSEBUTTONS) && (IEQUALIFIER_LEFTBUTTON & Qualifier)) { + if ((CurFloor == LOWERFLOOR) && (MouseX >= mapScaleX(538)) && (MouseY >= mapScaleY(277)) + && (MouseX <= mapScaleX(633)) && (MouseY <= mapScaleY(352)) + && onFloor(RoomsFound, SURMAZEFLOOR)) { + CurFloor = SURMAZEFLOOR; + + fade(false, 0); + drawMap(RoomsFound, CurRoom, CurMsg, CurFloor, false, false); + fade(true, 0); + } + + else if ((CurFloor == MIDDLEFLOOR) && (MouseX >= mapScaleX(358)) && (MouseY >= mapScaleY(71)) + && (MouseX <= mapScaleX(452)) && (MouseY <= mapScaleY(147)) + && onFloor(RoomsFound, CARNIVAL)) { + CurFloor = CARNIVAL; + + fade(false, 0); + drawMap(RoomsFound, CurRoom, CurMsg, CurFloor, false, false); + fade(true, 0); + } + + else if ((CurFloor == MIDDLEFLOOR) && (MouseX >= mapScaleX(557)) && (MouseY >= mapScaleY(325)) + && (MouseX <= mapScaleX(653)) && (MouseY <= mapScaleY(401)) + && onFloor(RoomsFound, MEDMAZEFLOOR)) { + CurFloor = MEDMAZEFLOOR; + + fade(false, 0); + drawMap(RoomsFound, CurRoom, CurMsg, CurFloor, false, false); + fade(true, 0); + } + + else if ((CurFloor == UPPERFLOOR) && (MouseX >= mapScaleX(524)) && (MouseY >= mapScaleY(97)) + && (MouseX <= mapScaleX(645)) && (MouseY <= mapScaleY(207)) + && onFloor(RoomsFound, HEDGEMAZEFLOOR)) { + CurFloor = HEDGEMAZEFLOOR; + + fade(false, 0); + drawMap(RoomsFound, CurRoom, CurMsg, CurFloor, false, false); + fade(true, 0); + } + + else if (MouseX > mapScaleX(314)) { + OldMsg = CurMsg; + + for (drawroom = 1; drawroom <= MaxRooms; drawroom++) { + roomCords(drawroom, &x1, &y1, &x2, &y2); + + if ((Maps[drawroom].PageNumber == CurFloor) + && In(RoomsFound, drawroom) + && (MouseX >= x1) && (MouseX <= x2) + && (MouseY >= y1) && (MouseY <= y2)) { + CurMsg = drawroom; + } + } + + if (OldMsg != CurMsg) { + if (Rooms[CurMsg].RoomMsg == NULL) + readViews(CurMsg, ViewPath); + + if ((sptr = Rooms[CurMsg].RoomMsg)) { + mouseHide(); + setAPen(3); + rectFill(VGAScaleX(13), VGAScaleY(148), VGAScaleX(135), VGAScaleY(186)); + flowText(MsgFont, 0, 5, 3, true, true, true, true, VGAScaleX(14), VGAScaleY(148), VGAScaleX(134), VGAScaleY(186), sptr); + + if (Maps[OldMsg].PageNumber == CurFloor) + drawRoom(OldMsg, (bool)(OldMsg == CurRoom)); + + roomCords(CurMsg, &x1, &y1, &x2, &y2); + x1 = (x1 + x2) / 2; + y1 = (y1 + y2) / 2; + + if ((CurMsg != CurRoom) && (Maps[CurMsg].PageNumber == CurFloor)) { + setAPen(1); + rectFill(x1 - 1, y1, x1, y1); + } + + mouseShow(); + } + } + } + } + +#if !defined(DOSCODE) + g_system->updateScreen(); +#endif + } + } +} + + + +/*****************************************************************************/ +/* Cleans up behind itself. */ +/*****************************************************************************/ +void mapCleanUp(void) { + freeAllStolenMem(); +} + + + + +/*****************************************************************************/ +/* Does the map processing. */ +/*****************************************************************************/ +void doMap(LargeSet RoomsFound, uint16 CurRoom) { + FadePalette = AmigaMapPalette; + + g_music->checkMusic(); + loadMapData(); + blackAllScreen(); + + if (Direction == NORTH) + XMark = MapNorth; + else if (Direction == SOUTH) + XMark = MapSouth; + else if (Direction == EAST) + XMark = MapEast; + else if (Direction == WEST) + XMark = MapWest; + + drawMap(RoomsFound, CurRoom, CurRoom, Maps[CurRoom].PageNumber, false, true); + mouseShow(); + attachGadgetList(MapGadgetList); +#if !defined(DOSCODE) + g_system->updateScreen(); +#endif + processMap(CurRoom, RoomsFound); + attachGadgetList(NULL); + fade(false, 0); + blackAllScreen(); + mouseHide(); + setAPen(0); + rectFill(0, 0, VGAScreenWidth - 1, VGAScreenHeight - 1); + mapCleanUp(); + blackAllScreen(); + mouseShow(); +#if !defined(DOSCODE) + g_system->updateScreen(); +#endif +} + +} // End of namespace Lab diff --git a/engines/lab/modernsavegame.cpp b/engines/lab/modernsavegame.cpp new file mode 100644 index 0000000000..2ea5c22911 --- /dev/null +++ b/engines/lab/modernsavegame.cpp @@ -0,0 +1,127 @@ +/* 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. + * + */ + +/* + * This code is based on Labyrinth of Time code with assistance of + * + * Copyright (c) 1993 Terra Nova Development + * Copyright (c) 2004 The Wyrmkeep Entertainment Co. + * + */ + +#include "lab/stddefines.h" +#include "lab/labfun.h" +#include "lab/modernsavegame.h" + +namespace Lab { + +byte g_SaveGameImage[SAVED_IMAGE_SIZE]; // 640 x 358 + +char g_SaveGamePath[512]; +char g_PathSeperator[4]; + +extern LargeSet Conditions, + RoomsFound; + +#define SAVEVERSION "LBS3" + +int getSaveGameList(struct SaveGameInfo *info, int maxNum) { + warning("STUB: getSaveGameList"); + + return 0; + +#if 0 + char path[512]; + struct stat statb; + int total = 0; + int i; + + for (i = 0; i < maxNum; i++) { + checkMusic(); + + sprintf(path, "%s%s%d", g_SaveGamePath, g_PathSeperator, i); + statb.st_size = 0; + stat(path, &statb); + + if (statb.st_size > 0) { + struct tm *create_date; + FILE *fh; + + create_date = localtime(&statb.st_ctime); + strcpy(info->SaveGameDate, asctime(create_date)); + + fh = fopen(path, "rb"); + + if (fh != NULL) { + char temp[5]; + unsigned short t; + int toSeek; + + info->Index = i; + + fread(temp, 1, 4, fh); + temp[4] = 0; + + fread(&t, 1, 2, fh); + info->RoomNumber = swapUShort(t); + fread(&t, 1, 2, fh); + info->Direction = swapUShort(t); + + toSeek = 2 + Conditions->lastElement / 8 + RoomsFound->lastElement / 8 + 6 + 2 * 16; + fseek(fh, toSeek, SEEK_CUR); + + info->SaveGameImage = NULL; + + if (strcmp(temp, SAVEVERSION) == 0) { + info->SaveGameImage = malloc(SAVED_IMAGE_SIZE); + + if (info->SaveGameImage != NULL) + fread(info->SaveGameImage, 1, SAVED_IMAGE_SIZE, fh); + } else { + info->SaveGameImage = malloc(SAVED_IMAGE_SIZE); + + if (info->SaveGameImage != NULL) + memset(info->SaveGameImage, 0, SAVED_IMAGE_SIZE); + } + + fclose(fh); + + info++; + total++; + } + } + } + + return total; +#endif +} + +void freeSaveGameList(struct SaveGameInfo *info, int count) { + int i; + + for (i = 0; i < count; i++) { + free(info->SaveGameImage); + ++info; + } +} + +} // End of namespace Lab diff --git a/engines/lab/modernsavegame.h b/engines/lab/modernsavegame.h new file mode 100644 index 0000000000..160f3f9619 --- /dev/null +++ b/engines/lab/modernsavegame.h @@ -0,0 +1,55 @@ +/* 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. + * + */ + +/* + * This code is based on Labyrinth of Time code with assistance of + * + * Copyright (c) 1993 Terra Nova Development + * Copyright (c) 2004 The Wyrmkeep Entertainment Co. + * + */ + +#ifndef LAB_MODERNGAMESAVE_H +#define LAB_MODERNGAMESAVE_H + +namespace Lab { + +#define MAX_SAVED_GAMES 15 +#define SAVED_IMAGE_SIZE (128 * 72) + +extern byte g_SaveGameImage[SAVED_IMAGE_SIZE]; // 640 x 358 + +struct SaveGameInfo { + unsigned short Index; + unsigned short RoomNumber; + unsigned short Direction; + byte *SaveGameImage; + char SaveGameDate[128]; +}; + +int getSaveGameList(struct SaveGameInfo *info, int maxNum); +void freeSaveGameList(struct SaveGameInfo *info, int count); + +} // End of namespace Lab + +#endif /* LAB_MODERNGAMESAVE_H */ + diff --git a/engines/lab/module.mk b/engines/lab/module.mk new file mode 100644 index 0000000000..5edaa78fd9 --- /dev/null +++ b/engines/lab/module.mk @@ -0,0 +1,40 @@ +MODULE := engines/lab + +MODULE_OBJS := \ + allocroom.o \ + audioi.o \ + detection.o \ + engine.o \ + graphics.o \ + interface.o \ + intro.o \ + lab.o \ + labfile.o \ + labmusic.o \ + labsets.o \ + labtext.o \ + machine.o \ + map.o \ + modernsavegame.o \ + mouse.o \ + processroom.o \ + readdiff.o \ + readparse.o \ + savegame.o \ + savegamepalmap.o \ + special.o \ + storage.o \ + text.o \ + timing.o \ + undiff.o \ + vga.o + + +# This module can be built as a plugin +ifeq ($(ENABLE_LAB), DYNAMIC_PLUGIN) +PLUGIN := 1 +endif + +# Include common rules +include $(srcdir)/rules.mk + diff --git a/engines/lab/mouse.cpp b/engines/lab/mouse.cpp new file mode 100644 index 0000000000..857a39726e --- /dev/null +++ b/engines/lab/mouse.cpp @@ -0,0 +1,569 @@ +/* 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. + * + */ + +/* + * This code is based on Labyrinth of Time code with assistance of + * + * Copyright (c) 1993 Terra Nova Development + * Copyright (c) 2004 The Wyrmkeep Entertainment Co. + * + */ + +#include "lab/mouse.h" +#include "lab/vga.h" +#include "lab/stddefines.h" +#include "lab/timing.h" +#include "lab/interface.h" + +namespace Lab { + +extern bool IsHiRes; +extern uint32 VGAScreenWidth, VGAScreenHeight; + +void mouseHideXY(void); + +#if defined(DOSCODE) +/*****************************************************************************/ +/* Standard mouse calling template. */ +/*****************************************************************************/ +static void mouse(int16 *m1, int16 *m2, int16 *m3, int16 *m4) { + union REGS reg; + + reg.w.ax = *m1; + reg.w.bx = *m2; + reg.w.cx = *m3; + reg.w.dx = *m4; + + int386(0x33, ®, ®); + + *m1 = reg.w.ax; + *m2 = reg.w.bx; + *m3 = reg.w.cx; + *m4 = reg.w.dx; +} +#endif + + +static bool LeftClick = false; +static uint16 leftx = 0, lefty = 0; +static bool RightClick = false; +static uint16 rightx = 0, righty = 0; + +static bool MouseHidden = true, QuitMouseHandler = false; +static int32 NumHidden = 1; +static uint16 CurMouseX, CurMouseY; +static uint16 MouseImageWidth = 10, MouseImageHeight = 15; +static struct Gadget *LastGadgetHit = NULL; +struct Gadget *ScreenGadgetList = NULL; +static byte MouseData[] = {1, 1, 0, 0, 0, 0, 0, 0, 0, 0, + 1, 7, 1, 0, 0, 0, 0, 0, 0, 0, + 1, 7, 7, 1, 0, 0, 0, 0, 0, 0, + 1, 7, 7, 7, 1, 0, 0, 0, 0, 0, + 1, 7, 7, 7, 7, 1, 0, 0, 0, 0, + 1, 7, 7, 7, 7, 7, 1, 0, 0, 0, + 1, 7, 7, 7, 7, 7, 7, 1, 0, 0, + 1, 7, 7, 7, 7, 7, 7, 7, 1, 0, + 1, 7, 7, 7, 7, 7, 1, 1, 1, 1, + 1, 7, 7, 1, 7, 7, 1, 0, 0, 0, + 1, 7, 1, 0, 1, 7, 7, 1, 0, 0, + 1, 1, 0, 0, 1, 7, 7, 1, 0, 0, + 0, 0, 0, 0, 0, 1, 7, 7, 1, 0, + 0, 0, 0, 0, 0, 1, 7, 7, 1, 0, + 0, 0, 0, 0, 0, 0, 1, 1, 0, 0}; + + +static struct Image MouseImage, BackImage; +static byte BackImageBuffer[256]; +static uint16 backx, backy; + +static bool drawmouse = false, gadhit = false; +static struct Gadget *hitgad = NULL; + +void mouseShowXY(uint16 CurMouseX, uint16 CurMouseY); + +/*****************************************************************************/ +/* Checks whether or not the cords fall within one of the gadgets in a list */ +/* of gadgets. */ +/*****************************************************************************/ +static Gadget *checkGadgetHit(struct Gadget *gadlist, uint16 x, uint16 y) { + uint16 counter; + + while (gadlist != NULL) { + if ((x >= gadlist->x) && (y >= gadlist->y) && + (x <= (gadlist->x + gadlist->Im->Width)) && + (y <= (gadlist->y + gadlist->Im->Height)) && + !(GADGETOFF & gadlist->GadgetFlags)) { + if (IsHiRes) { + gadhit = true; + hitgad = gadlist; + } else { + QuitMouseHandler = true; + VGAStorePage(); + mouseHideXY(); + drawImage(gadlist->ImAlt, gadlist->x, gadlist->y); + mouseShowXY(x, y); + + for (counter = 0; counter < 3; counter++) + waitTOF(); + + mouseHideXY(); + drawImage(gadlist->Im, gadlist->x, gadlist->y); + mouseShowXY(x, y); + VGARestorePage(); + QuitMouseHandler = false; + } + + return gadlist; + } else { + gadlist = gadlist->NextGadget; + } + } + + return NULL; +} + + + +void attachGadgetList(struct Gadget *GadList) { + if (ScreenGadgetList != GadList) + LastGadgetHit = NULL; + + ScreenGadgetList = GadList; +} + + + + +static void drawMouse(void) { + if (BackImage.ImageData) { +#if !defined(DOSCODE) + + if (backx <= 640 - BackImage.Width && backy <= 480 - BackImage.Height) +#endif + drawMaskImage(&MouseImage, backx, backy); + } else { +#if !defined(DOSCODE) + + if (CurMouseX <= 640 - MouseImage.Width && CurMouseY <= 480 - MouseImage.Height) +#endif + drawMaskImage(&MouseImage, CurMouseX, CurMouseY); + } +} + + + +static void getBackMouse(void) { + BackImage.Width = MouseImage.Width; + BackImage.Height = MouseImage.Height; + BackImage.ImageData = BackImageBuffer; + + backx = CurMouseX; + backy = CurMouseY; + +#if !defined(DOSCODE) + + if (/* backx >= 0 && backy >= 0 && */ backx <= 640 - BackImage.Width && backy <= 480 - BackImage.Height) +#endif + readScreenImage(&BackImage, backx, backy); +} + +static void restoreBackMouse(void) { + if (BackImage.ImageData) { +#if !defined(DOSCODE) + + if (/* backx >= 0 && backy >= 0 && */ backx <= 640 - BackImage.Width && backy <= 480 - BackImage.Height) +#endif + drawImage(&BackImage, backx, backy); + + BackImage.ImageData = NULL; + } +} + + +static struct Gadget *TempGad; + + +#if defined(DOSCODE) +#pragma off (check_stack) +void _loadds far mouse_handler(int32 max, int32 mcx, int32 mdx) { +#pragma aux mouse_handler parm [EAX] [ECX] [EDX] +#else +void mouse_handler(int32 max, int32 mcx, int32 mdx) { +#endif + + if (!IsHiRes) + mcx /= 2; + + if (max & 0x01) { /* mouse Move */ + if ((CurMouseX != mcx) || (CurMouseY != mdx)) { + CurMouseX = mcx; + CurMouseY = mdx; + + if (IsHiRes && !QuitMouseHandler) { + drawmouse = true; + } else if (!MouseHidden && !QuitMouseHandler) { + VGAStorePage(); + restoreBackMouse(); + getBackMouse(); + drawMouse(); + VGARestorePage(); + } + } + } + + if ((max & 0x02) && (NumHidden < 2)) { /* Left mouse button click */ + if (ScreenGadgetList) + TempGad = checkGadgetHit(ScreenGadgetList, mcx, mdx); + else + TempGad = NULL; + + if (TempGad) { + LastGadgetHit = TempGad; + } else { + LeftClick = true; + leftx = mcx; + lefty = mdx; + } + } + + if ((max & 0x08) && (NumHidden < 2)) { /* Right mouse button click */ + RightClick = true; + rightx = mcx; + righty = mdx; + } +} + + + + +void updateMouse(void) { + uint16 counter; +#if !defined(DOSCODE) + bool doUpdateDisplay = false; +#endif + + if (drawmouse && !MouseHidden) { + QuitMouseHandler = true; + drawmouse = false; + restoreBackMouse(); + getBackMouse(); + drawMouse(); + QuitMouseHandler = false; +#if !defined(DOSCODE) + doUpdateDisplay = true; +#endif + } + + if (gadhit) { + gadhit = false; + QuitMouseHandler = true; + mouseHide(); + drawImage(hitgad->ImAlt, hitgad->x, hitgad->y); + mouseShow(); + + for (counter = 0; counter < 3; counter++) + waitTOF(); + + mouseHide(); + drawImage(hitgad->Im, hitgad->x, hitgad->y); + mouseShow(); +#if !defined(DOSCODE) + doUpdateDisplay = true; +#endif + QuitMouseHandler = false; + } + +#if !defined(DOSCODE) + + if (doUpdateDisplay) + g_system->updateScreen(); + +#endif +} + + + + +/*****************************************************************************/ +/* Initializes the mouse. */ +/*****************************************************************************/ +bool initMouse(void) { +#if defined(DOSCODE) + void (interrupt far * int_handler)(); + int32 vector; + byte firstbyte; + struct SREGS sregs; + union REGS inregs, outregs; + int (far * function_ptr)(); + int16 m1, m2, m3, m4; + + segread(&sregs); + + /* Determine mouse-driver interrupt address */ + int_handler = _dos_getvect(0x33); /* Get interrupt vector */ + firstbyte = *(byte far *) int_handler; /* Get first instruction of interrupt */ + vector = (int32) int_handler; + + if ((vector == 0L) || (firstbyte == 0xcf)) { /* Vector should not be zero */ + /* First instruction should not be iret */ + return false; + } + + m1 = 0; + mouse(&m1, &m2, &m3, &m4); + + if (m1 != -1) + return false; + + m1 = 0x0f; + m3 = 3; + m4 = 10; + mouse(&m1, &m2, &m3, &m4); + + m1 = 0x07; + m3 = 0; + m4 = VGAScreenWidth - MouseImageWidth; + + if (!IsHiRes) m4 *= 2; + + mouse(&m1, &m2, &m3, &m4); + + m1 = 0x08; + m3 = 0; + m4 = VGAScreenHeight - MouseImageHeight; + mouse(&m1, &m2, &m3, &m4); +#endif + + BackImage.ImageData = NULL; + MouseImage.ImageData = MouseData; + MouseImage.Width = MouseImageWidth; + MouseImage.Height = MouseImageHeight; + + mouseMove(0, 0); + +#if defined(DOSCODE) + + if (IsHiRes) { + m1 = 0x0f; + m3 = 0x03; + m4 = 0x04; + mouse(&m1, &m2, &m3, &m4); + } + + inregs.w.ax = 0xc; + inregs.w.cx = 0x01 + 0x02 + 0x08; /* mouse move, left and right mouse clicks */ + function_ptr = mouse_handler; + inregs.x.edx = FP_OFF(function_ptr); + sregs.es = FP_SEG(function_ptr); + int386x(0x33, &inregs, &outregs, &sregs); + + /* mouse reset and status */ + return mouseReset(); +#endif + + return true; +} + + + +/*****************************************************************************/ +/* Resets the mouse. */ +/*****************************************************************************/ +bool mouseReset(void) { +#if defined(DOSCODE) + int16 m1 = 0, dum; + + mouse(&m1, &dum, &dum, &dum); + return (m1 == -1); +#else + return true; +#endif +} + + + +/*****************************************************************************/ +/* Shows the mouse. */ +/*****************************************************************************/ +void mouseShow(void) { + QuitMouseHandler = true; + VGAStorePage(); + mouseShowXY(CurMouseX, CurMouseY); + VGARestorePage(); + QuitMouseHandler = false; +} + + + + + +/*****************************************************************************/ +/* Shows the mouse. */ +/*****************************************************************************/ +void mouseShowXY(uint16 MouseX, uint16 MouseY) { + QuitMouseHandler = true; + + if (NumHidden) + NumHidden--; + + if ((NumHidden == 0) && MouseHidden) { + CurMouseX = MouseX; + CurMouseY = MouseY; + getBackMouse(); + drawMouse(); +#if !defined(DOSCODE) + g_system->updateScreen(); +#endif + MouseHidden = false; + } + + QuitMouseHandler = false; +} + + + +/*****************************************************************************/ +/* Hides the mouse. */ +/*****************************************************************************/ +void mouseHide(void) { + QuitMouseHandler = true; + + NumHidden++; + + if (NumHidden && !MouseHidden) { + MouseHidden = true; + VGAStorePage(); + restoreBackMouse(); + VGARestorePage(); + } + + QuitMouseHandler = false; +} + + + + +/*****************************************************************************/ +/* Hides the mouse. */ +/*****************************************************************************/ +void mouseHideXY(void) { + QuitMouseHandler = true; + + NumHidden++; + + if (NumHidden && !MouseHidden) { + MouseHidden = true; + restoreBackMouse(); + } + + QuitMouseHandler = false; +} + + + + + +/*****************************************************************************/ +/* Gets the current mouse co-ordinates. NOTE: On IBM version, will scale */ +/* from virtual to screen co-ordinates automatically. */ +/*****************************************************************************/ +void mouseXY(uint16 *x, uint16 *y) { + int xx = 0, yy = 0; + //SDL_GetMousePos(&xx, &yy); + warning("STUB: mouseXY"); + *x = (uint16)xx; + *y = (uint16)yy; + + if (!IsHiRes) + (*x) /= 2; +} + + + + +/*****************************************************************************/ +/* Moves the mouse to new co-ordinates. */ +/*****************************************************************************/ +void mouseMove(uint16 x, uint16 y) { +#if defined(DOSCODE) + int16 m1 = 4, dum; +#endif + + if (!IsHiRes) + x *= 2; + + g_system->warpMouse(x, y); + + if (!MouseHidden) { + QuitMouseHandler = true; + mouseXY(&CurMouseX, &CurMouseY); + VGAStorePage(); + restoreBackMouse(); + getBackMouse(); + drawMouse(); + VGARestorePage(); +#if !defined(DOSCODE) + g_system->updateScreen(); +#endif + QuitMouseHandler = false; + } +} + + + + +/*****************************************************************************/ +/* Checks whether or not the mouse buttons have been pressed, and the last */ +/* co-ordinates of the button press. leftbutton tells whether to check the */ +/* left or right button. */ +/*****************************************************************************/ +bool mouseButton(uint16 *x, uint16 *y, bool leftbutton) { + if (leftbutton) { + if (LeftClick) { + *x = leftx; + *y = lefty; + LeftClick = false; + return true; + } + } else { + if (RightClick) { + *x = rightx; + *y = righty; + RightClick = false; + return true; + } + } + + return false; +} + + + + +Gadget *mouseGadget(void) { + Gadget *Temp = LastGadgetHit; + + LastGadgetHit = NULL; + return Temp; +} + +} // End of namespace Lab diff --git a/engines/lab/mouse.h b/engines/lab/mouse.h new file mode 100644 index 0000000000..e8bc7bfb7c --- /dev/null +++ b/engines/lab/mouse.h @@ -0,0 +1,62 @@ +/* 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. + * + */ + +/* + * This code is based on Labyrinth of Time code with assistance of + * + * Copyright (c) 1993 Terra Nova Development + * Copyright (c) 2004 The Wyrmkeep Entertainment Co. + * + */ + +#include "lab/stddefines.h" + +#ifndef LAB_MOUSE_H +#define LAB_MOUSE_H + +namespace Lab { + +struct Gadget; + +bool initMouse(void); + +bool mouseReset(void); + +void updateMouse(void); + +void mouseShow(void); + +void mouseHide(void); + +void mouseXY(uint16 *x, uint16 *y); + +void mouseMove(uint16 x, uint16 y); + +bool mouseButton(uint16 *x, uint16 *y, bool leftbutton); + +Gadget *mouseGadget(void); + +void attachGadgetList(struct Gadget *GadList); + +} // End of namespace Lab + +#endif /* LAB_MOUSE_H */ diff --git a/engines/lab/parsefun.h b/engines/lab/parsefun.h new file mode 100644 index 0000000000..4e1dc5de7e --- /dev/null +++ b/engines/lab/parsefun.h @@ -0,0 +1,101 @@ +/* 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. + * + */ + +/* + * This code is based on Labyrinth of Time code with assistance of + * + * Copyright (c) 1993 Terra Nova Development + * Copyright (c) 2004 The Wyrmkeep Entertainment Co. + * + */ + +#ifndef LAB_PARSEFUN_H +#define LAB_PARSEFUN_H + +#include "lab/stddefines.h" +#include "lab/labfun.h" +#include "lab/parsetypes.h" + +namespace Lab { + +/* From Parser.c */ + +bool parse(const char *InputFile); + + +/* From allocRoom.c */ + +bool initRoomBuffer(void); + +void freeRoomBuffer(void); + +void allocRoom(void **Ptr, uint16 Size, uint16 RoomNum); + +/* From ReadParse.c */ + +bool readRoomData(const char *fileName); + +bool readInventory(const char *fileName); + +char *numtostr(char *text, uint16 Num); + +bool readViews(uint16 RoomNum, const char *Path); + +bool readInitialConditions(LargeSet Conditions, const char *fileName); + + + +/* From ProcessRoom.c */ + +ViewDataPtr getViewData(uint16 RoomNum, uint16 Direction); + +char *getPictName(CloseDataPtr *LCPtr); + +void drawDirection(CloseDataPtr LCPtr); + +bool processArrow(uint16 *Direction, uint16 Arrow); + +void setCurCloseAbs(uint16 x, uint16 y, CloseDataPtr *cptr); + +void setCurClose(uint16 x, uint16 y, CloseDataPtr *cptr); + +bool takeItem(uint16 x, uint16 y, CloseDataPtr *cptr); + +bool doActionRule(int16 x, int16 y, int16 Action, int16 RoomNum, CloseDataPtr *LCPtr); + +bool doOperateRule(int16 x, int16 y, int16 ItemNum, CloseDataPtr *LCPtr); + +bool doGoForward(CloseDataPtr *LCPtr); + +bool doTurn(uint16 from, uint16 to, CloseDataPtr *LCPtr); + +bool doMainView(CloseDataPtr *LCPtr); + +/* + bool doConditions(int16 x, + int16 y, + CloseDataPtr *LCPtr); + */ + +} // End of namespace Lab + +#endif /* LAB_PARSEFUN_H */ diff --git a/engines/lab/parsetypes.h b/engines/lab/parsetypes.h new file mode 100644 index 0000000000..defe9afddf --- /dev/null +++ b/engines/lab/parsetypes.h @@ -0,0 +1,237 @@ +/* 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. + * + */ + +/* + * This code is based on Labyrinth of Time code with assistance of + * + * Copyright (c) 1993 Terra Nova Development + * Copyright (c) 2004 The Wyrmkeep Entertainment Co. + * + */ + +#ifndef LAB_PARSETYPES_H +#define LAB_PARSETYPES_H + +namespace Lab { + +#define MAXFILELEN 31 + + + +/*------------------------------- Action types ------------------------------*/ +#define PLAYSOUND 1 +#define PLAYSOUNDCONT 2 +#define SHOWDIFF 3 +#define SHOWDIFFCONT 4 +#define LOADDIFF 5 +#define LOADBM 6 +#define SHOWBM 7 +#define WIPECMD 8 +#define NOUPDATE 9 +#define FORCEUPDATE 10 +#define SHOWCURPICT 11 +#define SETELEMENT 12 +#define UNSETELEMENT 13 +#define SHOWMESSAGE 14 +#define SHOWMESSAGES 15 +#define SETPOSITION 16 +#define SETCLOSEUP 17 +#define MAINVIEW 18 +#define SUBINV 19 +#define ADDINV 20 +#define SHOWDIR 21 +#define WAITSECS 22 +#define STOPMUSIC 23 +#define STARTMUSIC 24 +#define CHANGEMUSIC 25 +#define RESETMUSIC 26 +#define FILLMUSIC 27 +#define WAITSOUND 28 +#define CLEARSOUND 29 +#define WINMUSIC 30 +#define WINGAME 31 +#define LOSTGAME 32 +#define RESETBUFFER 33 +#define SPECIALCMD 34 +#define CSHOWMESSAGE 35 +#define PLAYSOUNDB 36 + + + +/* Rule Types */ +#define ACTION 1 +#define OPERATE 2 +#define GOFORWARD 3 +#define CONDITIONS 4 +#define TURN 5 +#define GOMAINVIEW 6 +#define TURNFROMTO 7 + + + +/*----------------------------- Rule Type Action ----------------------------*/ +#define TAKE 1 +#define MOVE 2 +#define OPENDOOR 3 +#define CLOSEDOOR 4 +#define TAKEDEF 5 + +#if defined(WIN32) +#pragma pack(push, 1) +#endif + +typedef struct closeData { + uint16 x1, y1, x2, y2; + int16 CloseUpType; /* if > 0, an object. If < 0, + an item */ + uint16 depth; /* Level of the closeup. */ + char *GraphicName, *Message; + struct closeData *NextCloseUp, *SubCloseUps; +} CloseData; + +typedef CloseData *CloseDataPtr; + + + +typedef struct viewData { + int16 *Condition; + char *GraphicName; + struct viewData *NextCondition; + CloseDataPtr closeUps; + +} viewData; + +typedef viewData *ViewDataPtr; + + +struct Action { + int16 ActionType, Param1, Param2, Param3; + byte *Data; /* Message, or a pointer to array + of messages. */ + Action *NextAction; + +}; + +typedef Action *ActionPtr; + + + +typedef struct rule { + int16 RuleType, Param1, Param2, *Condition; + + ActionPtr ActionList; + struct rule *NextRule; + +} Rule; + +typedef Rule *RulePtr; + + + +typedef struct { + uint16 NorthDoor, SouthDoor, EastDoor, WestDoor; + + byte WipeType; + + ViewDataPtr NorthView, SouthView, EastView, WestView; + RulePtr RuleList; + char *RoomMsg; + +} RoomData; + + + +typedef struct inventoryData { + /* New inventory stuff */ + /* + int16 *Condition; + char *GraphicName, + * InvName; + struct inventoryData *NextInventory; + CloseDataPtr closeUps; + RulePtr RuleList; + */ + + /* Old inventory stuff */ + uint16 Many; + char *name, *BInvName; +} InventoryData; + + + +/* Map Flags */ + +/* Where the doors are; in a corridor, assumed to be left doors */ +#define NORTHDOOR 1L +#define EASTDOOR 2L +#define SOUTHDOOR 4L +#define WESTDOOR 8L + +/* Where the doors are in corridors; M means middle, R means right, B means bottom */ +#define NORTHMDOOR 16L +#define NORTHRDOOR 32L +#define SOUTHMDOOR 64L +#define SOUTHRDOOR 128L + +#define EASTMDOOR 16L +#define EASTBDOOR 32L +#define WESTMDOOR 64L +#define WESTBDOOR 128L + +/* Special Map ID's */ +#define NORMAL 0 +#define UPARROWROOM 1 +#define DOWNARROWROOM 2 +#define BRIDGEROOM 3 +#define VCORRIDOR 4 +#define HCORRIDOR 5 +#define MEDMAZE 6 +#define HEDGEMAZE 7 +#define SURMAZE 8 +#define MULTIMAZEF1 9 +#define MULTIMAZEF2 10 +#define MULTIMAZEF3 11 + + + +typedef struct { + uint16 x, y, PageNumber, SpecialID; + uint32 MapFlags; + +} MapData; + +#if defined(WIN32) +#pragma pack(pop) +#endif + +#if !defined(DOSCODE) +typedef struct { + uint16 RoomNum; + uint16 Direction; +} CrumbData; + +#define MAX_CRUMBS 128 +#endif + +} // End of namespace Lab + +#endif /* LAB_PARSETYPES_H */ diff --git a/engines/lab/processroom.cpp b/engines/lab/processroom.cpp new file mode 100644 index 0000000000..2af9fa05d9 --- /dev/null +++ b/engines/lab/processroom.cpp @@ -0,0 +1,1056 @@ +/* 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. + * + */ + +/* + * This code is based on Labyrinth of Time code with assistance of + * + * Copyright (c) 1993 Terra Nova Development + * Copyright (c) 2004 The Wyrmkeep Entertainment Co. + * + */ + +#include "lab/stddefines.h" +#include "lab/labfun.h" +#include "lab/parsetypes.h" +#include "lab/parsefun.h" +#include "lab/timing.h" +#include "lab/diff.h" +#include "lab/vga.h" +#if !defined(DOSCODE) +#include "lab/interface.h" +#endif + +namespace Lab { + +#ifdef GAME_TRIAL +extern int g_IsRegistered; +#endif + + +/* Global parser data */ + +RoomData *Rooms; +InventoryData *Inventory; +uint16 NumInv, RoomNum, ManyRooms, HighestCondition, Direction; +LargeSet Conditions, RoomsFound; + + +extern char *FACINGNORTH, *FACINGEAST, *FACINGSOUTH, *FACINGWEST; +extern bool LongWinInFront; + + +#define NOFILE "no file" + + + +extern const char *CurFileName; + +const char *ViewPath = "LAB:Rooms/"; + + +const char *NewFileName; + + +extern bool DoNotDrawMessage; +extern bool NoFlip, IsBM, noupdatediff, waiteffect, mwaiteffect, QuitLab, EffectPlaying, soundplaying, MusicOn, DoBlack, ContMusic, DoNotReset; +extern char diffcmap[256 * 3]; + +extern CloseDataPtr CPtr; + + + +/*****************************************************************************/ +/* Generates a random number. */ +/*****************************************************************************/ +uint16 getRandom(uint16 max) { + uint32 secs, micros; + + getTime(&secs, µs); + return ((micros + secs) % max); +} + + + + +/*****************************************************************************/ +/* Checks whether all the conditions in a condition list are met. */ +/*****************************************************************************/ +static bool checkConditions(int16 *Condition) { + int16 Counter; + bool res; + + if (Condition == NULL) + return true; + + if (Condition[0] == 0) + return true; + + Counter = 1; + res = In(Conditions, Condition[0]); + + while (Condition[Counter] && res) { + res = In(Conditions, Condition[Counter]); + Counter++; + } + + return res; +} + + + + +/*****************************************************************************/ +/* Gets the current ViewDataPointer. */ +/*****************************************************************************/ +ViewDataPtr getViewData(uint16 roomNum, uint16 direction) { + ViewDataPtr *VPtr = NULL, ViewPtr; + bool doit = true; + + if (direction == NORTH) + VPtr = &Rooms[roomNum].NorthView; + else if (direction == SOUTH) + VPtr = &Rooms[roomNum].SouthView; + else if (direction == EAST) + VPtr = &Rooms[roomNum].EastView; + else if (direction == WEST) + VPtr = &Rooms[roomNum].WestView; + + if (*VPtr == NULL) + readViews(roomNum, ViewPath); + + ViewPtr = *VPtr; + + do { + if (checkConditions(ViewPtr->Condition)) + doit = false; + else + ViewPtr = ViewPtr->NextCondition; + + } while (doit); + + return ViewPtr; +} + + + +/*****************************************************************************/ +/* Gets an object, if any, from the user's click on the screen. */ +/*****************************************************************************/ +static CloseData *getObject(uint16 x, uint16 y, CloseDataPtr LCPtr) { + ViewDataPtr VPtr; + + if (LCPtr == NULL) { + VPtr = getViewData(RoomNum, Direction); + LCPtr = VPtr->closeUps; + } + + else + LCPtr = LCPtr->SubCloseUps; + + + while (LCPtr != NULL) { + if ((x >= scaleX(LCPtr->x1)) && (y >= scaleY(LCPtr->y1)) && + (x <= scaleX(LCPtr->x2)) && (y <= scaleY(LCPtr->y2))) + return LCPtr; + + LCPtr = LCPtr->NextCloseUp; + } + + return NULL; +} + + + + +/*****************************************************************************/ +/* Goes through the list of closeups to find a match. */ +/* NYI: Known bug here. If there are two objects that have closeups, and */ +/* some of the closeups have the same hit boxes, then this returns the */ +/* first occurence of the object with the same hit box. */ +/*****************************************************************************/ +static CloseDataPtr findCPtrMatch(CloseDataPtr Main, CloseDataPtr List) { + CloseDataPtr cptr; + + while (List) { + if ((Main->x1 == List->x1) && (Main->x2 == List->x2) && + (Main->y1 == List->y1) && (Main->y2 == List->y2) && + (Main->depth == List->depth)) + return List; + + cptr = findCPtrMatch(Main, List->SubCloseUps); + + if (cptr) + return cptr; + else + List = List->NextCloseUp; + } + + return NULL; +} + + + + + + +/*****************************************************************************/ +/* Returns the current picture name. */ +/*****************************************************************************/ +char *getPictName(CloseDataPtr *LCPtr) { + ViewDataPtr ViewPtr; + + ViewPtr = getViewData(RoomNum, Direction); + + if (*LCPtr != NULL) { + *LCPtr = findCPtrMatch(*LCPtr, ViewPtr->closeUps); + + if (*LCPtr) + return (*LCPtr)->GraphicName; + } + + return ViewPtr->GraphicName; +} + + +/*****************************************************************************/ +/* Draws the current direction to the screen. */ +/*****************************************************************************/ +void drawDirection(CloseDataPtr LCPtr) { + char Message[250]; + /* + char test[15]; + */ + + if (LCPtr != NULL) { + if (LCPtr->Message) { + drawMessage(LCPtr->Message); + return; + } + } + + + Message[0] = '\0'; + + if (Rooms[RoomNum].RoomMsg) { + strcpy(Message, Rooms[RoomNum].RoomMsg); + strcat(Message, ", "); + } + + if (Direction == NORTH) + strcat(Message, FACINGNORTH); + else if (Direction == EAST) + strcat(Message, FACINGEAST); + else if (Direction == SOUTH) + strcat(Message, FACINGSOUTH); + else if (Direction == WEST) + strcat(Message, FACINGWEST); + + /* + numtostr(test, RoomNum); + strcat(Message, ", "); + strcat(Message, test); + */ + + drawMessage(Message); +} + +#if !defined(DOSCODE) +void getRoomMessage(int MyRoomNum, int MyDirection, char *msg) { + getViewData(MyRoomNum, MyDirection); + + msg[0] = '\0'; + + if (Rooms[MyRoomNum].RoomMsg) { + strcpy(msg, Rooms[MyRoomNum].RoomMsg); + strcat(msg, ", "); + } + + if (MyDirection == NORTH) + strcat(msg, FACINGNORTH); + else if (MyDirection == EAST) + strcat(msg, FACINGEAST); + else if (MyDirection == SOUTH) + strcat(msg, FACINGSOUTH); + else if (MyDirection == WEST) + strcat(msg, FACINGWEST); +} +#endif + + + + + +/*****************************************************************************/ +/* process a arrow gadget movement. */ +/*****************************************************************************/ +bool processArrow(uint16 *direction, uint16 Arrow) { + uint16 room = 1; + + if (Arrow == 1) { /* Forward */ + if (*direction == NORTH) + room = Rooms[RoomNum].NorthDoor; + else if (*direction == SOUTH) + room = Rooms[RoomNum].SouthDoor; + else if (*direction == EAST) + room = Rooms[RoomNum].EastDoor; + else if (*direction == WEST) + room = Rooms[RoomNum].WestDoor; + + if (room == 0) + return false; + else + RoomNum = room; + } else if (Arrow == 0) { /* Left */ + if (*direction == NORTH) + *direction = WEST; + else if (*direction == WEST) + *direction = SOUTH; + else if (*direction == SOUTH) + *direction = EAST; + else + *direction = NORTH; + } else if (Arrow == 2) { /* Right */ + if (*direction == NORTH) + *direction = EAST; + else if (*direction == EAST) + *direction = SOUTH; + else if (*direction == SOUTH) + *direction = WEST; + else + *direction = NORTH; + } + + return true; +} + + + + + +/*****************************************************************************/ +/* Sets the current close up data, but uses absolute cords. */ +/*****************************************************************************/ +void setCurCloseAbs(uint16 x, uint16 y, CloseDataPtr *cptr) { + ViewDataPtr VPtr; + CloseDataPtr LCPtr; + + if (*cptr == NULL) { + VPtr = getViewData(RoomNum, Direction); + LCPtr = VPtr->closeUps; + } else + LCPtr = (*cptr)->SubCloseUps; + + + while (LCPtr != NULL) { + if ((x >= LCPtr->x1) && (y >= LCPtr->y1) && + (x <= LCPtr->x2) && (y <= LCPtr->y2) && + (LCPtr->GraphicName)) { + *cptr = LCPtr; + return; + } + + LCPtr = LCPtr->NextCloseUp; + } +} + + + + + +/*****************************************************************************/ +/* Sets the current close up data. */ +/*****************************************************************************/ +void setCurClose(uint16 x, uint16 y, CloseDataPtr *cptr) { + ViewDataPtr VPtr; + CloseDataPtr LCPtr; + + if (*cptr == NULL) { + VPtr = getViewData(RoomNum, Direction); + LCPtr = VPtr->closeUps; + } else + LCPtr = (*cptr)->SubCloseUps; + + + while (LCPtr != NULL) { + if ((x >= scaleX(LCPtr->x1)) && (y >= scaleY(LCPtr->y1)) && + (x <= scaleX(LCPtr->x2)) && (y <= scaleY(LCPtr->y2)) && + (LCPtr->GraphicName)) { + *cptr = LCPtr; + return; + } + + LCPtr = LCPtr->NextCloseUp; + } +} + + + +/*****************************************************************************/ +/* Takes the currently selected item. */ +/*****************************************************************************/ +bool takeItem(uint16 x, uint16 y, CloseDataPtr *cptr) { + ViewDataPtr VPtr; + CloseDataPtr LCPtr; + + if (*cptr == NULL) { + VPtr = getViewData(RoomNum, Direction); + LCPtr = VPtr->closeUps; + } else if ((*cptr)->CloseUpType < 0) { + inclElement(Conditions, abs((*cptr)->CloseUpType)); + return true; + } else + LCPtr = (*cptr)->SubCloseUps; + + + while (LCPtr != NULL) { + if ((x >= scaleX(LCPtr->x1)) && (y >= scaleY(LCPtr->y1)) && + (x <= scaleX(LCPtr->x2)) && (y <= scaleY(LCPtr->y2)) && + (LCPtr->CloseUpType < 0)) { + inclElement(Conditions, abs(LCPtr->CloseUpType)); + return true; + } + + LCPtr = LCPtr->NextCloseUp; + } + + return false; +} + + + +/*****************************************************************************/ +/* Processes the action list. */ +/*****************************************************************************/ +static void doActions(ActionPtr APtr, CloseDataPtr *LCPtr) { + CloseDataPtr TLCPtr; + bool FirstLoaded = true; + char **str, *Test; + uint16 counter; + uint32 StartSecs, StartMicros, CurSecs, CurMicros; + + while (APtr) { + g_music->newCheckMusic(); + + switch (APtr->ActionType) { + case PLAYSOUND: + mwaiteffect = true; /* Plays a sound, but waits for it to be done before continuing */ + ContMusic = false; + readMusic((char *)APtr->Data); + mwaiteffect = false; + break; + + case PLAYSOUNDB: + mwaiteffect = false; /* Plays a sound in the background. */ + ContMusic = false; + readMusic((char *)APtr->Data); + break; + + case PLAYSOUNDCONT: + g_music->_doNotFileFlushAudio = true; + ContMusic = true; + readMusic((char *)APtr->Data); + break; + + case SHOWDIFF: + readPict((char *)APtr->Data, true); + break; + + case SHOWDIFFCONT: + readPict((char *)APtr->Data, false); + break; + + case LOADDIFF: + if (FirstLoaded) { + resetBuffer(); + FirstLoaded = false; + } + + if (APtr->Data) + g_music->newOpen((char *)APtr->Data); /* Puts a file into memory */ + + break; + + case WIPECMD: + doWipe(APtr->Param1, LCPtr, (char *)APtr->Data); + break; + + case NOUPDATE: + noupdatediff = true; + DoBlack = false; + break; + + case FORCEUPDATE: + CurFileName = " "; + break; + + case SHOWCURPICT: + Test = getPictName(LCPtr); + + if (strcmp(Test, CurFileName) != 0) { + CurFileName = Test; + readPict(CurFileName, true); + } + + break; + + case SETELEMENT: + inclElement(Conditions, APtr->Param1); + break; + + case UNSETELEMENT: + exclElement(Conditions, APtr->Param1); + break; + + case SHOWMESSAGE: + DoNotDrawMessage = false; + + if (LongWinInFront) + longDrawMessage((char *)APtr->Data); + else + drawMessage((char *)APtr->Data); + + DoNotDrawMessage = true; + break; + + case CSHOWMESSAGE: + if (*LCPtr == NULL) { + DoNotDrawMessage = false; + drawMessage((char *)APtr->Data); + DoNotDrawMessage = true; + } + + break; + + case SHOWMESSAGES: + str = (char **)APtr->Data; + DoNotDrawMessage = false; + drawMessage(str[getRandom(APtr->Param1)]); + DoNotDrawMessage = true; + break; + + case SETPOSITION: +#if defined(LABDEMO) + + // if teleporting to room 45 or 49 + if (APtr->Param1 == 45 || APtr->Param1 == 49) { + extern void doTrialBlock(); + + // Time to pay up! + doTrialBlock(); + + CurFileName = getPictName(LCPtr); + readPict(CurFileName, true); + + APtr = NULL; + continue; + } + +#endif +#if defined(GAME_TRIAL) + + if (APtr->Param1 & 0x8000) { // check registration if high-bit set + if (!g_IsRegistered) { + extern int trialCheckInGame(); + int result; + + // Time to pay up! + result = trialCheckInGame(); + + CurFileName = getPictName(LCPtr); + readPict(CurFileName, true); + + if (!g_IsRegistered) { + APtr = NULL; + continue; + } + } + + // fix-up data + APtr->Param1 &= 0x7fff; // clear high-bit + } + +#endif + RoomNum = APtr->Param1; + Direction = APtr->Param2 - 1; + *LCPtr = NULL; + DoBlack = true; + break; + + case SETCLOSEUP: + TLCPtr = getObject(scaleX(APtr->Param1), scaleY(APtr->Param2), *LCPtr); + + if (TLCPtr) + *LCPtr = TLCPtr; + + break; + + case MAINVIEW: + *LCPtr = NULL; + break; + + case SUBINV: + if (Inventory[APtr->Param1].Many) + (Inventory[APtr->Param1].Many)--; + + if (Inventory[APtr->Param1].Many == 0) + exclElement(Conditions, APtr->Param1); + + break; + + case ADDINV: + (Inventory[APtr->Param1].Many) += APtr->Param2; + inclElement(Conditions, APtr->Param1); + break; + + case SHOWDIR: + DoNotDrawMessage = false; + break; + + case WAITSECS: + addCurTime(APtr->Param1, 0, &StartSecs, &StartMicros); + +#if !defined(DOSCODE) + g_system->updateScreen(); +#endif + + while (1) { + g_music->newCheckMusic(); + diffNextFrame(); + getTime(&CurSecs, &CurMicros); + + if ((CurSecs > StartSecs) || ((CurSecs == StartSecs) && + (CurMicros >= StartMicros))) + break; + } + + break; + + case STOPMUSIC: + g_music->setMusic(false); + break; + + case STARTMUSIC: + g_music->setMusic(true); + break; + + case CHANGEMUSIC: + if (g_music->_turnMusicOn) { + g_music->changeMusic((const char *)APtr->Data); + DoNotReset = true; + } + + break; + + case RESETMUSIC: + if (g_music->_turnMusicOn) { + g_music->resetMusic(); + DoNotReset = false; + } + + break; + + case FILLMUSIC: + g_music->fillUpMusic(true); + break; + + case WAITSOUND: + while (EffectPlaying) { + g_music->updateMusic(); + diffNextFrame(); + waitTOF(); + } + + break; + + case CLEARSOUND: + if (ContMusic) { + ContMusic = false; + flushAudio(); + } else if (EffectPlaying) + flushAudio(); + + break; + + case WINMUSIC: + if (g_music->_turnMusicOn) { + g_music->_winmusic = true; + g_music->freeMusic(); + g_music->initMusic(); + } + + break; + + case WINGAME: + QuitLab = true; + break; + + case LOSTGAME: + QuitLab = true; + break; + + case RESETBUFFER: + resetBuffer(); + break; + + case SPECIALCMD: + if (APtr->Param1 == 0) + DoBlack = true; + else if (APtr->Param1 == 1) + DoBlack = (CPtr == NULL); + else if (APtr->Param1 == 2) + DoBlack = (CPtr != NULL); + else if (APtr->Param1 == 5) { /* inverse the palette */ + for (counter = (8 * 3); counter < (255 * 3); counter++) + diffcmap[counter] = 255 - diffcmap[counter]; + + waitTOF(); + VGASetPal(diffcmap, 256); + waitTOF(); + waitTOF(); + } else if (APtr->Param1 == 4) { /* white the palette */ + whiteScreen(); + waitTOF(); + waitTOF(); + } else if (APtr->Param1 == 6) { /* Restore the palette */ + waitTOF(); + VGASetPal(diffcmap, 256); + waitTOF(); + waitTOF(); + } else if (APtr->Param1 == 7) { /* Quick pause */ + waitTOF(); + waitTOF(); + waitTOF(); + } + + break; + } + + APtr = APtr->NextAction; + } + + if (ContMusic) { + ContMusic = false; + flushAudio(); + } else { + while (EffectPlaying) { + g_music->updateMusic(); + diffNextFrame(); + waitTOF(); + } + } + + g_music->_doNotFileFlushAudio = false; +} + + + + + +/*****************************************************************************/ +/* Does the work for doActionRule. */ +/*****************************************************************************/ +static bool doActionRuleSub(int16 Action, int16 roomNum, CloseDataPtr LCPtr, CloseDataPtr *Set, bool AllowDefaults) { + RulePtr RPtr; + + Action++; + + if (LCPtr) { + RPtr = Rooms[roomNum].RuleList; + + if ((RPtr == NULL) && (roomNum == 0)) { + readViews(roomNum, ViewPath); + RPtr = Rooms[roomNum].RuleList; + } + + + while (RPtr) { + if ((RPtr->RuleType == ACTION) && + ((RPtr->Param1 == Action) || ((RPtr->Param1 == 0) && AllowDefaults))) { + if (((RPtr->Param2 == LCPtr->CloseUpType) || + ((RPtr->Param2 == 0) && AllowDefaults)) + || + ((Action == 1) && (RPtr->Param2 == (-LCPtr->CloseUpType)))) { + if (checkConditions(RPtr->Condition)) { + doActions(RPtr->ActionList, Set); + return true; + } + } + } + + RPtr = RPtr->NextRule; + } + } + + return false; +} + + + + +/*****************************************************************************/ +/* Goes through the rules if an action is taken. */ +/*****************************************************************************/ +bool doActionRule(int16 x, int16 y, int16 Action, int16 roomNum, CloseDataPtr *LCPtr) { + CloseDataPtr TLCPtr; + + if (roomNum) + NewFileName = NOFILE; + else + NewFileName = CurFileName; + + TLCPtr = getObject(x, y, *LCPtr); + + if (doActionRuleSub(Action, roomNum, TLCPtr, LCPtr, false)) + return true; + else if (doActionRuleSub(Action, roomNum, *LCPtr, LCPtr, false)) + return true; + else if (doActionRuleSub(Action, roomNum, TLCPtr, LCPtr, true)) + return true; + else if (doActionRuleSub(Action, roomNum, *LCPtr, LCPtr, true)) + return true; + + return false; +} + + + +/*****************************************************************************/ +/* Does the work for doActionRule. */ +/*****************************************************************************/ +static bool doOperateRuleSub(int16 ItemNum, int16 roomNum, CloseDataPtr LCPtr, CloseDataPtr *Set, bool AllowDefaults) { + RulePtr RPtr; + + if (LCPtr) + if (LCPtr->CloseUpType > 0) { + RPtr = Rooms[roomNum].RuleList; + + if ((RPtr == NULL) && (roomNum == 0)) { + readViews(roomNum, ViewPath); + RPtr = Rooms[roomNum].RuleList; + } + + while (RPtr) { + if ((RPtr->RuleType == OPERATE) && + ((RPtr->Param1 == ItemNum) || ((RPtr->Param1 == 0) && AllowDefaults)) && + ((RPtr->Param2 == LCPtr->CloseUpType) || ((RPtr->Param2 == 0) && AllowDefaults))) { + if (checkConditions(RPtr->Condition)) { + doActions(RPtr->ActionList, Set); + return true; + } + } + + RPtr = RPtr->NextRule; + } + } + + return false; +} + + + + +/*****************************************************************************/ +/* Goes thru the rules if the user tries to operate an item on an object. */ +/*****************************************************************************/ +bool doOperateRule(int16 x, int16 y, int16 ItemNum, CloseDataPtr *LCPtr) { + CloseDataPtr TLCPtr; + + NewFileName = NOFILE; + + TLCPtr = getObject(x, y, *LCPtr); + + if (doOperateRuleSub(ItemNum, RoomNum, TLCPtr, LCPtr, false)) + return true; + else if (doOperateRuleSub(ItemNum, RoomNum, *LCPtr, LCPtr, false)) + return true; + else if (doOperateRuleSub(ItemNum, RoomNum, TLCPtr, LCPtr, true)) + return true; + else if (doOperateRuleSub(ItemNum, RoomNum, *LCPtr, LCPtr, true)) + return true; + + else { + NewFileName = CurFileName; + + if (doOperateRuleSub(ItemNum, 0, TLCPtr, LCPtr, false)) + return true; + else if (doOperateRuleSub(ItemNum, 0, *LCPtr, LCPtr, false)) + return true; + else if (doOperateRuleSub(ItemNum, 0, TLCPtr, LCPtr, true)) + return true; + else if (doOperateRuleSub(ItemNum, 0, *LCPtr, LCPtr, true)) + return true; + } + + return false; +} + + + + +/*****************************************************************************/ +/* Goes thru the rules if the user tries to go forward. */ +/*****************************************************************************/ +bool doGoForward(CloseDataPtr *LCPtr) { + RulePtr RPtr; + + RPtr = Rooms[RoomNum].RuleList; + + while (RPtr) { + if ((RPtr->RuleType == GOFORWARD) && (RPtr->Param1 == (Direction + 1))) { + if (checkConditions(RPtr->Condition)) { + doActions(RPtr->ActionList, LCPtr); + return true; + } + } + + RPtr = RPtr->NextRule; + } + + return false; +} + + + +/*****************************************************************************/ +/* Goes thru the rules if the user tries to turn. */ +/*****************************************************************************/ +bool doTurn(uint16 from, uint16 to, CloseDataPtr *LCPtr) { + RulePtr RPtr; + + from++; + to++; + + RPtr = Rooms[RoomNum].RuleList; + + while (RPtr) { + if ((RPtr->RuleType == TURN) || + + ((RPtr->RuleType == TURNFROMTO) && + (RPtr->Param1 == from) && (RPtr->Param2 == to))) { + if (checkConditions(RPtr->Condition)) { + doActions(RPtr->ActionList, LCPtr); + return true; + } + } + + RPtr = RPtr->NextRule; + } + + return false; +} + + + + +/*****************************************************************************/ +/* Goes thru the rules if the user tries to go to the main view */ +/*****************************************************************************/ +bool doMainView(CloseDataPtr *LCPtr) { + RulePtr RPtr; + + RPtr = Rooms[RoomNum].RuleList; + + while (RPtr) { + if (RPtr->RuleType == GOMAINVIEW) { + if (checkConditions(RPtr->Condition)) { + doActions(RPtr->ActionList, LCPtr); + return true; + } + } + + RPtr = RPtr->NextRule; + } + + return false; +} + + + + +/*****************************************************************************/ +/* Goes thru the rules whenever (probably after an action or something), and */ +/* sets the conditions. */ +/*****************************************************************************/ +/* + bool doConditions(int16 x, + int16 y, + CloseDataPtr *LCPtr) + { + RulePtr RPtr; + + NewFileName = NOFILE; + + RPtr = Rooms[RoomNum].RuleList; + + while (RPtr) + { + if (RPtr->RuleType == CONDITIONS) + { + if (checkConditions(RPtr->Condition)) + { + doActions(RPtr->ActionList, LCPtr); + return true; + } + } + + RPtr = RPtr->NextRule; + } + return false; + } + */ + +#if defined(DEMODATA) +#include + +static void WriteDemoData_CloseUps(FILE *fh, CloseDataPtr cd) { + while (cd != NULL) { + if (*cd->GraphicName) + fprintf(fh, "%s\n", cd->GraphicName); + + WriteDemoData_CloseUps(fh, cd->SubCloseUps); + cd = cd->NextCloseUp; + } +} + +static void WriteDemoData_ViewData(FILE *fh, ViewDataPtr vd) { + if (vd == NULL) + return; + + if (*vd->GraphicName != 0) + fprintf(fh, "%s\n", vd->GraphicName); + + WriteDemoData_CloseUps(fh, vd->closeUps); +} + +void writeDemoData() { + FILE *fh = fopen("c:\\depot\\labyrinth\\demodata.log", "a+w"); + + WriteDemoData_ViewData(fh, getViewData(RoomNum, NORTH)); + WriteDemoData_ViewData(fh, getViewData(RoomNum, SOUTH)); + WriteDemoData_ViewData(fh, getViewData(RoomNum, EAST)); + WriteDemoData_ViewData(fh, getViewData(RoomNum, WEST)); + + fclose(fh); +} +#endif + +} // End of namespace Lab diff --git a/engines/lab/readdiff.cpp b/engines/lab/readdiff.cpp new file mode 100644 index 0000000000..2af49e9f43 --- /dev/null +++ b/engines/lab/readdiff.cpp @@ -0,0 +1,673 @@ +/* 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. + * + */ + +/* + * This code is based on Labyrinth of Time code with assistance of + * + * Copyright (c) 1993 Terra Nova Development + * Copyright (c) 2004 The Wyrmkeep Entertainment Co. + * + */ + +#include "lab/stddefines.h" +#include "lab/timing.h" +#include "lab/diff.h" +#include "lab/labfun.h" +#include "lab/vga.h" +#include "lab/mouse.h" + +namespace Lab { + +extern struct BitMap *DispBitMap, *DrawBitMap; +extern uint32 VGABytesPerPage; + +/* + extern int32 ReadSoFar; + extern bool ReadIsDone, + ReadIsError; + */ +extern byte **startoffile; + +static bool PlayOnce = false, changedscreen; + +bool NoFlip = false, /* Don't flip the new picture to front */ + DoBlack = false, /* Black the screen before new picture */ + nopalchange = false, /* Don't change the palette. */ + noscreenchange = false, /* Don't change the screen type. */ + IsBM = false, /* Just fill in the RawDIFFBM structure */ + hidemouse = false, /* Don't set the mouse colors */ + stopsound = false, + soundplaying = false, + screenbuffer = false, + waiteffect = false, /* Wait for each sound effect to finish + before coninuing. */ + mwaiteffect = false; + +uint16 DataBytesPerRow; + +extern bool EffectPlaying; + + +#define CONTINUOUS 0xFFFF + +DIFFHeader headerdata; + + + +/*------ Stuff for the animation task. -----*/ + +static byte *start; + +static uint32 diffwidth, diffheight; + +static bool continuous, + IsPlaying = false, + StopPlaying = false, + StopPlayingEnd = false, + IsAnim = false, + IsPal = false; + +char diffcmap[256 * 3], lastcmap[256 * 3]; + +struct BitMap RawDiffBM; + + + + +/*****************************************************************************/ +/* Does the undiffing between the bitmaps. */ +/*****************************************************************************/ +void unDiff(byte *NewBuf, byte *OldBuf, byte *DiffData, uint16 bytesperrow, bool IsV) { + byte buftype; + + DiffData++; + buftype = *DiffData; + DiffData++; + + if (IsV) + VUnDIFFMemory(NewBuf, DiffData, 1, buftype + 1, bytesperrow); + else + unDIFFMemory(NewBuf, DiffData, 1, buftype + 1); +} + + +static char blackbuffer[256 * 3]; + +/*****************************************************************************/ +/* Changes the front screen to black. */ +/*****************************************************************************/ +void blackScreen() { + memset(blackbuffer, 0, 248 * 3); + writeColorRegs(blackbuffer, 8, 248); + + g_system->delayMillis(32); +} + +/*****************************************************************************/ +/* Changes the front screen to white. */ +/*****************************************************************************/ +void whiteScreen(void) { + memset(blackbuffer, 255, 248 * 3); + writeColorRegs(blackbuffer, 8, 248); +} + +/*****************************************************************************/ +/* Changes the entire screen to black. */ +/*****************************************************************************/ +void blackAllScreen() { + memset(blackbuffer, 0, 256 * 3); + writeColorRegs(blackbuffer, 0, 256); + + g_system->delayMillis(32); +} + + + +/* For Play Diff */ +static uint32 header, size, processed = 0L, WaitSec = 0L, WaitMicros = 0L, DelayMicros = 0L; +static uint16 CurBit = 0, framenumber = 0, samplespeed, numchunks = 1; +static byte *Buffer, temp[5]; +static bool FirstThru = true, donepal = false; +static byte *storagefordifffile, * *difffile = &storagefordifffile; + +void diffNextFrame(void) { + if (header == 65535) /* Already done. */ + return; + +#if !defined(DOSCODE) + + if (DispBitMap->Flags & BITMAPF_VIDEO) { + DispBitMap->Planes[0] = getVGABaseAddr(); + DispBitMap->Planes[1] = DispBitMap->Planes[0] + 0x10000; + DispBitMap->Planes[2] = DispBitMap->Planes[1] + 0x10000; + DispBitMap->Planes[3] = DispBitMap->Planes[2] + 0x10000; + DispBitMap->Planes[4] = DispBitMap->Planes[3] + 0x10000; + } + +#endif + + mouseHide(); + + while (1) { + /* NYI: Don't need. + if (ReadIsError) + { + IsPlaying = false; + mouseShow(); + return; + } + */ + + if (CurBit >= numchunks) { + mouseShow(); + +#ifdef undef /* NYI: Don't need. */ + + while (!ReadIsDone && !ReadIsError) /* Wait for the file to load */ + waitTOF(); + +#endif + + if (!NoFlip && !IsBM) { + if (headerdata.fps) { + waitForTime(WaitSec, WaitMicros); + addCurTime(0L, DelayMicros, &WaitSec, &WaitMicros); + } + + if (IsPal && !nopalchange) { + VGASetPal(diffcmap, 256); + IsPal = false; + } + + donepal = true; + FirstThru = false; + } + + if (IsPal && !nopalchange && !IsBM && !donepal) { + VGASetPal(diffcmap, 256); + IsPal = false; + } + + donepal = false; + + framenumber++; + + if ((framenumber == 1) && (continuous || (!PlayOnce))) + Buffer = *difffile; + + IsAnim = (framenumber >= 3) && (!PlayOnce); + CurBit = 0; + +#if !defined(DOSCODE) + + if (DispBitMap->Flags & BITMAPF_VIDEO) + g_system->updateScreen(); + +#endif + + return; /* done with the next frame. */ + } + + g_music->updateMusic(); + readBlock(&header, 4L, difffile); +#if !defined(DOSCODE) + swapULongPtr(&header, 1); +#endif + readBlock(&size, 4L, difffile); +#if !defined(DOSCODE) + swapULongPtr(&size, 1); +#endif + + processed += 8L; + + processed += size; + + switch (header) { + case 8L: + memcpy(lastcmap, diffcmap, 256 * 3); + + readBlock(diffcmap, size, difffile); + IsPal = true; + break; + + case 10L: + RawDiffBM.Planes[CurBit] = *difffile; + + if (IsBM) + skip(difffile, size); + else { +#if defined(DOSCODE) + setPage(CurBit); +#endif + readBlock(DrawBitMap->Planes[CurBit], size, difffile); + } + + CurBit++; + break; + + case 11L: +#if defined(DOSCODE) + setPage(CurBit); +#endif + skip(difffile, 4L); + runLengthDecode(DrawBitMap->Planes[CurBit], *difffile); + CurBit++; + skip(difffile, size - 4); + break; + + case 12L: +#if defined(DOSCODE) + setPage(CurBit); +#endif + skip(difffile, 4L); + VRunLengthDecode(DrawBitMap->Planes[CurBit], *difffile, DrawBitMap->BytesPerRow); + CurBit++; + skip(difffile, size - 4); + break; + + case 20L: +#if defined(DOSCODE) + setPage(CurBit); +#endif + unDiff(DrawBitMap->Planes[CurBit], DispBitMap->Planes[CurBit], *difffile, DrawBitMap->BytesPerRow, false); + CurBit++; + skip(difffile, size); + break; + + case 21L: +#if defined(DOSCODE) + setPage(CurBit); +#endif + unDiff(DrawBitMap->Planes[CurBit], DispBitMap->Planes[CurBit], *difffile, DrawBitMap->BytesPerRow, true); + CurBit++; + skip(difffile, size); + break; + + case 25L: + CurBit++; + break; + + case 26L: + /* NYI: This don't work no more + memcpy((void *) DrawBitMap->Planes[CurBit], + (void *) DispBitMap->Planes[CurBit], (uint16) (diffheight*diffwidth)); + */ + CurBit++; + break; + + case 30L: + case 31L: { + if (waiteffect) { + while (EffectPlaying) { + g_music->updateMusic(); + waitTOF(); + } + } + + size -= 8L; + + skip(difffile, 4L); + readBlock(&samplespeed, 2L, difffile); +#if !defined(DOSCODE) + swapUShortPtr(&samplespeed, 1); +#endif + skip(difffile, 2L); + + byte *music = *difffile; + uint32 musicsize = size; + skip(difffile, size); + + playMusic(samplespeed, 64, musicsize, true, music); + break; + } + case 65535L: + if ((framenumber == 1) || PlayOnce || StopPlayingEnd) { +#if !defined(DOSCODE) + int didTOF = 0; +#endif + + if (waiteffect) { + while (EffectPlaying) { + g_music->updateMusic(); + waitTOF(); +#if !defined(DOSCODE) + + if (DispBitMap->Flags & BITMAPF_VIDEO) + didTOF = 1; + +#endif + } + } + + IsPlaying = false; + mouseShow(); +#if !defined(DOSCODE) + + if (DispBitMap->Flags & BITMAPF_VIDEO) + ungetVGABaseAddr(); + + if (!didTOF) + g_system->updateScreen(); + +#endif + return; + } + + framenumber = 4; /* Random frame number so it never gets back to 2 */ + *difffile = Buffer; + break; + + default: + skip(difffile, size); + break; + } + } + +#if !defined(DOSCODE) + + if (DispBitMap->Flags & BITMAPF_VIDEO) + ungetVGABaseAddr(); + +#endif +} + + + +/*****************************************************************************/ +/* A separate task launched by readDiff. Plays the DIFF. */ +/*****************************************************************************/ +void playDiff(void) { + processed = 0L; + WaitSec = 0L; + WaitMicros = 0L; + DelayMicros = 0L; + header = 0; + CurBit = 0; + framenumber = 0; + numchunks = 1; + FirstThru = true; + donepal = false; + difffile = &storagefordifffile; + + IsPlaying = true; + StopPlaying = false; + StopPlayingEnd = false; + + changedscreen = false; + + if (DoBlack) { + DoBlack = false; + blackScreen(); + } + + + start = *startoffile; /* Make a copy of the pointer to the start of the file */ + *difffile = start; /* Now can modify the file without modifying the original */ + + + if (start == NULL) { + IsPlaying = false; + return; + } + + continuous = false; + readBlock(temp, 4L, difffile); + temp[4] = '\0'; + readBlock(&header, 4L, difffile); +#if !defined(DOSCODE) + swapULongPtr(&header, 1); +#endif + processed += 8L; + + if (!((strcmp((char *)temp, "DIFF") == 0) && (header == 1219009121L))) { + IsPlaying = false; + return; + } + + readBlock(&header, 4L, difffile); +#if !defined(DOSCODE) + swapULongPtr(&header, 1); +#endif + readBlock(&size, 4L, difffile); +#if !defined(DOSCODE) + swapULongPtr(&size, 1); +#endif + + if (header == 0) { +#if defined(IS_MACOSX) + // sizeof(headerdata) != 18, but the padding might be at the end + readBlock(&headerdata.Version, 2, difffile); + readBlock(&headerdata.x, 2, difffile); + readBlock(&headerdata.y, 2, difffile); + readBlock(&headerdata.depth, 1, difffile); + readBlock(&headerdata.fps, 1, difffile); + readBlock(&headerdata.BufferSize, 4, difffile); + readBlock(&headerdata.Machine, 2, difffile); + readBlock(&headerdata.Flags, 4, difffile); +#else + readBlock(&headerdata, 18, difffile); +#endif + skip(difffile, size - 18); + +#if !defined(DOSCODE) + swapUShortPtr(&headerdata.Version, 3); + swapULongPtr(&headerdata.BufferSize, 1); + swapUShortPtr(&headerdata.Machine, 1); + swapULongPtr(&headerdata.Flags, 1); +#endif + + continuous = CONTINUOUS & headerdata.Flags; + diffwidth = headerdata.x; + diffheight = headerdata.y; + DataBytesPerRow = diffwidth; + +#if defined(DOSCODE) + numchunks = (((int32) diffwidth) * diffheight) / VGABytesPerPage; + + if ((numchunks * VGABytesPerPage) < (((int32) diffwidth) * diffheight)) + numchunks++; + +#else + numchunks = (((int32) diffwidth) * diffheight) / 0x10000; + + if ((uint32)(numchunks * 0x10000) < (uint32)(((int32) diffwidth) * diffheight)) + numchunks++; + +#endif + } else { + return; + } + + processed += 8L + size; + + for (header = 0; header < 8; header++) + RawDiffBM.Planes[header] = NULL; + + if (headerdata.fps) + DelayMicros = ONESECOND / headerdata.fps; + + if (PlayOnce) { + while (header != 65535) + diffNextFrame(); + } else + diffNextFrame(); +} + + + +/*****************************************************************************/ +/* Stops an animation from running. */ +/*****************************************************************************/ +void stopDiff(void) { + if (IsPlaying) { + StopPlaying = true; + + /* NYI: + while (IsPlaying) + waitTOF(); + */ + + if (IsAnim) + blackScreen(); + } +} + + + +/*****************************************************************************/ +/* Stops an animation from running. */ +/*****************************************************************************/ +void stopDiffEnd(void) { + if (IsPlaying) { + StopPlayingEnd = true; + + while (IsPlaying) { + g_music->newCheckMusic(); + diffNextFrame(); + } + } +} + + + +/*****************************************************************************/ +/* Stops the continuous sound from playing. */ +/*****************************************************************************/ +void stopSound(void) { + stopsound = true; +} + + + +/*****************************************************************************/ +/* Checks the music while a diff is playing. */ +/*****************************************************************************/ +void diffSetMusic(void) { + return; + + while (IsPlaying) { + waitTOF(); + g_music->newCheckMusic(); + } +} + + + +/*****************************************************************************/ +/* Reads in a DIFF file. */ +/*****************************************************************************/ +bool readDiff(bool playonce) { + PlayOnce = playonce; + playDiff(); + return true; +} + + + +static byte *mstart; + + +void readSound(void) { + uint32 header_ = 0, size_; + uint16 samplespeed_; +// uint16 numchunks = 1; + char temp_[5]; +// bool FirstThru = true; + byte *storagefordifffile_, **difffile_ = &storagefordifffile_; + + mstart = *startoffile; /* Make a copy of the pointer to the start of the file */ + *difffile_ = mstart; /* Now can modify the file without modifying the original */ + + if (mstart == NULL) + return; + + readBlock(temp_, 4L, difffile_); + temp_[4] = '\0'; + readBlock(&header_, 4L, difffile_); +#if !defined(DOSCODE) + swapULongPtr(&header_, 1); +#endif + processed += 8L; + + if (!((strcmp(temp_, "DIFF") == 0) && (header_ == 1219009121L))) + return; + + readBlock(&header_, 4L, difffile_); +#if !defined(DOSCODE) + swapULongPtr(&header_, 1); +#endif + readBlock(&size_, 4L, difffile_); +#if !defined(DOSCODE) + swapULongPtr(&size_, 1); +#endif + + if (header_ == 0) + skip(difffile_, size_); + else + return; + + while (header_ != 65535) { + g_music->updateMusic(); + readBlock(&header_, 4L, difffile_); +#if !defined(DOSCODE) + swapULongPtr(&header_, 1); +#endif + readBlock(&size_, 4L, difffile_); +#if !defined(DOSCODE) + swapULongPtr(&size_, 1); +#endif + + if ((header_ == 30) || (header_ == 31)) { + if (mwaiteffect) { + while (EffectPlaying) { + g_music->updateMusic(); + waitTOF(); + } + } + + size_ -= 8L; + + skip(difffile_, 4L); + readBlock(&samplespeed_, 2L, difffile_); +#if !defined(DOSCODE) + swapUShortPtr(&samplespeed_, 1); +#endif + skip(difffile_, 2L); + + byte *music = *difffile_; + uint32 musicsize = size_; + skip(difffile_, size_); + + playMusic(samplespeed_, 64, musicsize, true, music); + } else if (header_ == 65535L) { + if (mwaiteffect) { + while (EffectPlaying) { + g_music->updateMusic(); + waitTOF(); + } + } + } else + skip(difffile_, size_); + } +} + +} // End of namespace Lab diff --git a/engines/lab/readparse.cpp b/engines/lab/readparse.cpp new file mode 100644 index 0000000000..e970942a41 --- /dev/null +++ b/engines/lab/readparse.cpp @@ -0,0 +1,514 @@ +/* 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. + * + */ + +/* + * This code is based on Labyrinth of Time code with assistance of + * + * Copyright (c) 1993 Terra Nova Development + * Copyright (c) 2004 The Wyrmkeep Entertainment Co. + * + */ + +#include "lab/labfun.h" +#include "lab/parsetypes.h" +#include "lab/parsefun.h" +#include "lab/storage.h" +#include "lab/stddefines.h" + +namespace Lab { + +#define MAXSTRINGLENGTH 250 + +static bool UseMemory = false; + + + +/* Global parser data */ + +extern RoomData *Rooms; +extern InventoryData *Inventory; +extern uint16 NumInv, ManyRooms, HighestCondition, Direction; +extern LargeSet Conditions, RoomsFound; + + + +static uint16 allocroom; + + +static bool rallocate(void **Ptr, uint32 Size) { + if (UseMemory) + return allocate(Ptr, Size); + else { + allocRoom(Ptr, (uint16) Size, allocroom); + return true; + } +} + + + +/*****************************************************************************/ +/* Reads in the RoomData. */ +/*****************************************************************************/ +bool readRoomData(const char *fileName) { + byte **file; + uint16 Counter; + char Temp[5]; + + if ((file = g_music->newOpen(fileName)) != NULL) { + readBlock(Temp, 4L, file); + Temp[4] = '\0'; + + if (strcmp(Temp, "DOR1") != 0) + return false; + + readBlock(&ManyRooms, 2L, file); +#if !defined(DOSCODE) + swapUShortPtr(&ManyRooms, 1); +#endif + readBlock(&HighestCondition, 2L, file); +#if !defined(DOSCODE) + swapUShortPtr(&HighestCondition, 1); +#endif + + if (allocate((void **) &Rooms, (ManyRooms + 1) * sizeof(RoomData))) { + for (Counter = 1; Counter <= ManyRooms; Counter++) { + readBlock(&(Rooms[Counter].NorthDoor), 2L, file); + readBlock(&(Rooms[Counter].SouthDoor), 2L, file); + readBlock(&(Rooms[Counter].EastDoor), 2L, file); + readBlock(&(Rooms[Counter].WestDoor), 2L, file); +#if !defined(DOSCODE) + swapUShortPtr(&(Rooms[Counter].NorthDoor), 1); + swapUShortPtr(&(Rooms[Counter].SouthDoor), 1); + swapUShortPtr(&(Rooms[Counter].EastDoor), 1); + swapUShortPtr(&(Rooms[Counter].WestDoor), 1); +#endif + + readBlock(&(Rooms[Counter].WipeType), 1L, file); + } + } else + return false; + } else + return false; + + return true; +} + + + + +/*****************************************************************************/ +/* Reads in a NULL terminated string, and allocates memory for it. */ +/*****************************************************************************/ +static bool readString(char **string, byte **file) { + char len; + uint32 counter = 0L; + + + readBlock(&len, 1L, file); + + if (len) { + counter = len; + + if (rallocate((void **) string, counter)) { + readBlock(*string, counter, file); + (*string)[counter - 1] = 0; /* Sanity modification */ + decrypt((byte *)*string); + return true; + } + } else { + *string = NULL; + return true; + } + + return false; +} + + + +/*****************************************************************************/ +/* Reads in the Inventory data. */ +/*****************************************************************************/ +bool readInventory(const char *fileName) { + byte **file; + uint16 Counter; + char Temp[5]; + + if ((file = g_music->newOpen(fileName)) != NULL) { + readBlock(Temp, 4L, file); + Temp[4] = '\0'; + + if (strcmp(Temp, "INV1") != 0) + return false; + + readBlock(&NumInv, 2L, file); +#if !defined(DOSCODE) + swapUShortPtr(&NumInv, 1); +#endif + UseMemory = true; + + if (rallocate((void **) &Inventory, (NumInv + 1) * sizeof(InventoryData))) { + for (Counter = 1; Counter <= NumInv; Counter++) { + readBlock(&(Inventory[Counter].Many), 2L, file); +#if !defined(DOSCODE) + swapUShortPtr(&(Inventory[Counter].Many), 1); +#endif + + if (!readString(&(Inventory[Counter].name), file)) { + UseMemory = false; + return false; + } + + if (!readString(&(Inventory[Counter].BInvName), file)) { + UseMemory = false; + return false; + } + } + } else { + UseMemory = false; + return false; + } + } else + return false; + + UseMemory = false; + return true; +} + + + + + + +/*****************************************************************************/ +/* Converts a number to a string. */ +/*****************************************************************************/ +char *numtostr(char *text, uint16 Num) { + uint16 Counter = 0; + + if (Num == 0) { + text[0] = '0'; + text[1] = 0; + return text; + } + + strcpy(text, "00000"); + + if (Num >= 10000) { + text[0] = (Num / 10000) + '0'; + Num -= (Num / 10000) * 10000; + } + + if (Num >= 1000) { + text[1] = (Num / 1000) + '0'; + Num -= (Num / 1000) * 1000; + } + + if (Num >= 100) { + text[2] = (Num / 100) + '0'; + Num -= (Num / 100) * 100; + } + + if (Num >= 10) { + text[3] = (Num / 10) + '0'; + Num -= (Num / 10) * 10; + } + + text[4] = Num + '0'; + text[5] = 0; + + while (text[Counter] == '0') + Counter++; + + return (&text[Counter]); +} + + + + + +/*****************************************************************************/ +/* Reads in a list of conditions. */ +/*****************************************************************************/ +static int16 *readConditions(byte **file) { + int16 Counter = 0, last, list[25], *ptr; + + do { + readBlock(&last, 2L, file); +#if !defined(DOSCODE) + swapUShortPtr((uint16 *)&last, 1); +#endif + + if (Counter < 25) { + list[Counter] = last; + Counter++; + } else + list[Counter] = 0; + } while (last); + + if (!rallocate((void **) & (ptr), Counter * 2L)) + return NULL; + + memcpy(ptr, list, (size_t)(Counter * 2L)); + + return ptr; +} + + + + +/*****************************************************************************/ +/* Reads in some CloseUp data. */ +/*****************************************************************************/ +static bool readCloseUps(CloseDataPtr *CPtr, uint16 depth, byte **file) { + char c; + + while (1) { + *CPtr = NULL; + + readBlock(&c, 1L, file); + + if (c != '\0') { + if (rallocate((void **) CPtr, sizeof(CloseData))) { + (*CPtr)->SubCloseUps = NULL; + (*CPtr)->NextCloseUp = NULL; + (*CPtr)->depth = depth; + + readBlock(*CPtr, 10L, file); +#if !defined(DOSCODE) + swapUShortPtr((uint16 *)*CPtr, 5); +#endif + + if (!readString(&((*CPtr)->GraphicName), file)) + return false; + + if (!readString(&((*CPtr)->Message), file)) + return false; + + if (!readCloseUps(&((*CPtr)->SubCloseUps), depth + 1, file)) + return false; + + CPtr = &((*CPtr)->NextCloseUp); + } else + return false; + } else + return true; + } +} + + + + +/*****************************************************************************/ +/* Reads in a View. */ +/*****************************************************************************/ +static bool readView(ViewDataPtr *VPtr, byte **file) { + char c; + + while (1) { + *VPtr = NULL; + + readBlock(&c, 1L, file); + + if (c == 1) { + if (rallocate((void **) VPtr, sizeof(viewData))) { + (*VPtr)->closeUps = NULL; + (*VPtr)->NextCondition = NULL; + + (*VPtr)->Condition = readConditions(file); + + if (!(*VPtr)->Condition) + return false; + + if (!readString(&((*VPtr)->GraphicName), file)) + return false; + + readCloseUps(&((*VPtr)->closeUps), 0, file); + + VPtr = &((*VPtr)->NextCondition); + } else + return false; + } else + return true; + } +} + + + + +/*****************************************************************************/ +/* Reads in an Action. */ +/*****************************************************************************/ +static bool readAction(ActionPtr *APtr, byte **file) { + char c; + byte **ptrarray; + uint16 counter; + + while (1) { + *APtr = NULL; + + readBlock(&c, 1L, file); + + if (c == 1) { + if (rallocate((void **) APtr, sizeof(Action))) { + readBlock(*APtr, 8L, file); +#if !defined(DOSCODE) + swapShortPtr((int16 *)*APtr, 4); +#endif + + if ((*APtr)->ActionType == SHOWMESSAGES) { + if (!rallocate((void **) &ptrarray, 4L * (*APtr)->Param1)) + return false; + + for (counter = 0; counter < (*APtr)->Param1; counter++) + readString((char **) & (ptrarray[counter]), file); + + (*APtr)->Data = (byte *)ptrarray; + } else + readString((char **) & ((*APtr)->Data), file); + + APtr = &((*APtr)->NextAction); + } else + return false; + } else + return true; + } +} + + + + + +/*****************************************************************************/ +/* Reads in a rule. */ +/*****************************************************************************/ +static bool readRule(RulePtr *RPtr, byte **file) { + char c; + + while (1) { + *RPtr = NULL; + readBlock(&c, 1L, file); + + if (c == 1) { + if (rallocate((void **) RPtr, sizeof(Rule))) { + readBlock(*RPtr, 6L, file); +#if !defined(DOSCODE) + swapShortPtr((int16 *)*RPtr, 3); +#endif + (*RPtr)->Condition = readConditions(file); + + if (!(*RPtr)->Condition) + return false; + + readAction(&((*RPtr)->ActionList), file); + } else + return false; + + RPtr = &((*RPtr)->NextRule); + } else + return true; + } +} + + + + + +/*****************************************************************************/ +/* Reads in the views of a room. */ +/*****************************************************************************/ +bool readViews(uint16 RoomNum, const char *Path) { + char Temp[10], *RoomString, fileName[250]; + byte **file; + + allocroom = RoomNum; + + RoomString = numtostr(Temp, RoomNum); + strcpy(fileName, Path); + strcat(fileName, RoomString); + + if ((file = g_music->newOpen(fileName)) != NULL) { + readBlock(Temp, 4L, file); + Temp[4] = '\0'; + + if (strcmp(Temp, "ROM4") != 0) + return false; + + readString(&(Rooms[RoomNum].RoomMsg), file); + + readView(&Rooms[RoomNum].NorthView, file); + g_music->checkMusic(); + + readView(&Rooms[RoomNum].SouthView, file); + g_music->checkMusic(); + + readView(&Rooms[RoomNum].EastView, file); + g_music->checkMusic(); + + readView(&Rooms[RoomNum].WestView, file); + g_music->checkMusic(); + + readRule(&Rooms[RoomNum].RuleList, file); + + return true; + } else + return false; + + return false; +} + + + + +/*****************************************************************************/ +/* Reads the initial conditions and sets the LargeSet accordingly. */ +/*****************************************************************************/ +bool readInitialConditions(LargeSet conditions, const char *fileName) { + byte **file; + uint16 many, set; + char temp[5]; + + if ((file = g_music->newOpen(fileName)) != NULL) { + readBlock(temp, 4L, file); + temp[4] = '\0'; + + if (strcmp(temp, "CON0") != 0) + return false; + + readBlock(&many, 2L, file); +#if !defined(DOSCODE) + swapUShortPtr(&many, 1); +#endif + + for (int counter = 0; counter < many; counter++) { + readBlock(&set, 2L, file); +#if !defined(DOSCODE) + swapUShortPtr(&set, 1); +#endif + inclElement(conditions, set); + } + } else + return false; + + return true; +} + +} // End of namespace Lab diff --git a/engines/lab/savegame.cpp b/engines/lab/savegame.cpp new file mode 100644 index 0000000000..ed25c38ef2 --- /dev/null +++ b/engines/lab/savegame.cpp @@ -0,0 +1,323 @@ +/* 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. + * + */ + +/* + * This code is based on Labyrinth of Time code with assistance of + * + * Copyright (c) 1993 Terra Nova Development + * Copyright (c) 2004 The Wyrmkeep Entertainment Co. + * + */ + +#include "lab/stddefines.h" +#include "lab/labfun.h" +#include "lab/modernsavegame.h" + +namespace Lab { + +/* The version string */ +#if defined(DOSCODE) +#define SAVEVERSION "LBS2" +#else +#define SAVEVERSION "LBS3" +#define SAVEVERSION_COMPAT "LBS2" +#endif + +#define BOOKMARK 0 +#define CARDMARK 1 +#define FLOPPY 2 + +typedef void *LABFH; +#define INVALID_LABFH NULL + +uint16 FileType, FileNum; + + + +/*----- The Amiga specific area of saveGame.c -----*/ + + +/*****************************************************************************/ +/* Opens a file to write to from disk. */ +/*****************************************************************************/ +static LABFH saveGameOpen(char *filename, bool iswrite) { + warning("STUB: saveGameOpen"); + return 0; + +#if 0 + if (iswrite) { + unlink(filename); + return fopen(filename, "wb"); + } else + return fopen(filename, "rb"); +#endif +} + + + + +/*****************************************************************************/ +/* Closes a file. */ +/*****************************************************************************/ +static void saveGameClose(LABFH file, bool iswrite) { + warning("STUB: saveGameClose"); + return; + +#if 0 + if (file != INVALID_LABFH) + fclose(file); +#endif +} + + + + +/*****************************************************************************/ +/* Writes a block of memory to whatever it is that we're writing to. */ +/*****************************************************************************/ +static void saveGameWriteBlock(LABFH file, void *data, uint32 size) { + warning("STUB: saveGameWriteBlock"); + return; + + //fwrite(data, 1, size, file); +} + + + +/*****************************************************************************/ +/* Writes a block of memory to whatever it is that we're writing to. */ +/*****************************************************************************/ +static void saveGameReadBlock(LABFH file, void *data, uint32 size) { + warning("STUB: saveGameReadBlock"); + return; + + //fread(data, 1, size, file); +} + + + + +/*----- The machine independent section of saveGame.c -----*/ + + +/* Lab: Labyrinth specific */ +extern uint16 combination[6]; +extern uint16 CurTile[4] [4]; + +#if !defined(DOSCODE) +extern CrumbData BreadCrumbs[MAX_CRUMBS]; +extern uint16 NumCrumbs; +extern bool DroppingCrumbs; +extern bool FollowingCrumbs; +#endif + +/*****************************************************************************/ +/* Writes the game out to disk. */ +/* Assumes that the file has already been openned and is there. */ +/*****************************************************************************/ +static bool saveGame(uint16 RoomNum, uint16 Direction, uint16 Quarters, LargeSet set1, LargeSet set2, LABFH file) { +#if !defined(DOSCODE) + uint16 temp; + CrumbData crumbs[sizeof(BreadCrumbs) / sizeof(CrumbData)]; +#endif + uint16 last, counter, counter1; + char c; + + saveGameWriteBlock(file, (void *)SAVEVERSION, 4L); +#if defined(DOSCODE) + saveGameWriteBlock(file, &RoomNum, 2L); + saveGameWriteBlock(file, &Direction, 2L); + saveGameWriteBlock(file, &Quarters, 2L); +#else + temp = swapUShort(RoomNum); + saveGameWriteBlock(file, &temp, 2L); + temp = swapUShort(Direction); + saveGameWriteBlock(file, &temp, 2L); + temp = swapUShort(Quarters); + saveGameWriteBlock(file, &temp, 2L); +#endif + + last = set1->lastElement / 8; + saveGameWriteBlock(file, &(set1->array[0]), (uint32) last); + + last = set2->lastElement / 8; + saveGameWriteBlock(file, &(set2->array[0]), (uint32) last); + + /* LAB: the combination lock and tile stuff */ + for (counter = 0; counter < 6; counter++) { + c = (char)combination[counter]; + saveGameWriteBlock(file, &c, 1L); + } + + for (counter = 0; counter < 4; counter++) + for (counter1 = 0; counter1 < 4; counter1++) +#if defined(DOSCODE) + saveGameWriteBlock(file, &(CurTile[counter] [counter1]), 2L); + +#else + { + temp = swapUShort(CurTile[counter] [counter1]); + saveGameWriteBlock(file, &temp, 2L); + } +#endif + +#if !defined(DOSCODE) + saveGameWriteBlock(file, g_SaveGameImage, SAVED_IMAGE_SIZE); + memcpy(crumbs, BreadCrumbs, sizeof BreadCrumbs); + swapUShortPtr(&crumbs[0].RoomNum, sizeof(BreadCrumbs) / sizeof(uint16)); + saveGameWriteBlock(file, crumbs, sizeof BreadCrumbs); +#endif + + saveGameClose(file, true); + + return true; +} + + + +/*****************************************************************************/ +/* Reads the game from disk. */ +/* Assumes that the file has already been openned and is there. */ +/*****************************************************************************/ +static bool loadGame(uint16 *RoomNum, uint16 *Direction, uint16 *Quarters, LargeSet set1, LargeSet set2, LABFH file) { +#if !defined(DOSCODE) + uint16 t; + CrumbData crumbs[sizeof(BreadCrumbs) / sizeof(CrumbData)]; +#endif + char temp[5], c; + uint16 last, counter, counter1; + + saveGameReadBlock(file, temp, 4L); + temp[4] = 0; + + /* + if (strcmp(temp, SAVEVERSION) != 0) + { + saveGameClose(file, false); + return false; + } + */ + +#if defined(DOSCODE) + saveGameReadBlock(file, RoomNum, 2L); + saveGameReadBlock(file, Direction, 2L); + saveGameReadBlock(file, Quarters, 2L); +#else + saveGameReadBlock(file, &t, 2L); + *RoomNum = swapUShort(t); + saveGameReadBlock(file, &t, 2L); + *Direction = swapUShort(t); + saveGameReadBlock(file, &t, 2L); + *Quarters = swapUShort(t); +#endif + + last = set1->lastElement / 8; + saveGameReadBlock(file, &(set1->array[0]), (uint32) last); + + last = set2->lastElement / 8; + saveGameReadBlock(file, &(set2->array[0]), (uint32) last); + + /* LAB: the combination lock and tile stuff */ + for (counter = 0; counter < 6; counter++) { + saveGameReadBlock(file, &c, 1L); + combination[counter] = c; + } + + for (counter = 0; counter < 4; counter++) + for (counter1 = 0; counter1 < 4; counter1++) +#if defined(DOSCODE) + saveGameReadBlock(file, &(CurTile[counter] [counter1]), 2L); + +#else + { + saveGameReadBlock(file, &t, 2L); + CurTile[counter] [counter1] = swapUShort(t); + } +#endif + + if (strcmp(temp, SAVEVERSION) == 0) { + saveGameReadBlock(file, g_SaveGameImage, SAVED_IMAGE_SIZE); + + memset(crumbs, 0, sizeof BreadCrumbs); + saveGameReadBlock(file, crumbs, sizeof BreadCrumbs); + swapUShortPtr(&crumbs[0].RoomNum, sizeof(BreadCrumbs) / sizeof(uint16)); + memcpy(BreadCrumbs, crumbs, sizeof BreadCrumbs); + DroppingCrumbs = (BreadCrumbs[0].RoomNum != 0); + FollowingCrumbs = false; + + for (counter = 0; counter < MAX_CRUMBS; counter++) + if (BreadCrumbs[counter].RoomNum == 0) break; + + NumCrumbs = counter; + } + + saveGameClose(file, false); + + return true; +} + + + + +/*****************************************************************************/ +/* Saves the game to the floppy disk. */ +/*****************************************************************************/ +bool saveFloppy(char *path, uint16 RoomNum, uint16 Direction, uint16 NumQuarters, LargeSet Conditions, LargeSet Rooms, uint16 filenum, uint16 type) { + LABFH FPtr; + + g_music->checkMusic(); + + FileType = type; + FileNum = filenum; + + if ((FPtr = saveGameOpen(path, true)) != INVALID_LABFH) + saveGame(RoomNum, Direction, NumQuarters, Conditions, Rooms, FPtr); + else + return false; + + return true; +} + + + + +/*****************************************************************************/ +/* Reads the game from the floppy disk. */ +/*****************************************************************************/ +bool readFloppy(char *path, uint16 *RoomNum, uint16 *Direction, uint16 *NumQuarters, LargeSet Conditions, LargeSet Rooms, uint16 filenum, uint16 type) { + LABFH FPtr; + + g_music->checkMusic(); + + FileType = type; + FileNum = filenum; + + if ((FPtr = saveGameOpen(path, false)) != INVALID_LABFH) { + if (!loadGame(RoomNum, Direction, NumQuarters, Conditions, Rooms, FPtr)) + return false; + } else + return false; + + return true; +} + +} // End of namespace Lab diff --git a/engines/lab/savegamepalmap.cpp b/engines/lab/savegamepalmap.cpp new file mode 100644 index 0000000000..786a5571e6 --- /dev/null +++ b/engines/lab/savegamepalmap.cpp @@ -0,0 +1,3316 @@ +/* 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. + * + */ + + /* + * This code is based on Labyrinth of Time code with assistance of + * + * Copyright (c) 1993 Terra Nova Development + * Copyright (c) 2004 The Wyrmkeep Entertainment Co. + * + */ + +#include "lab/lab.h" + + namespace Lab { + + const byte ThePalMap[] = { + 0x73, 0x73, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, + 0x20, 0x20, 0x20, 0x23, 0x23, 0x23, 0x1E, 0xE3, 0xE3, 0xE3, + 0xE3, 0xE3, 0xE3, 0xE2, 0xE2, 0xE2, 0xE2, 0xE2, 0xE2, 0xE1, + 0xE1, 0xE1, 0x73, 0x2F, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, + 0x68, 0x20, 0x20, 0x20, 0x23, 0x23, 0x23, 0x1E, 0x1E, 0x1E, + 0xE3, 0xE3, 0xE3, 0xE3, 0xE3, 0xE2, 0xE2, 0xE2, 0xE2, 0xE2, + 0xE2, 0xE1, 0xE1, 0xE1, 0x67, 0x67, 0x2F, 0x68, 0x68, 0x68, + 0x37, 0x37, 0x37, 0x20, 0x23, 0x23, 0x23, 0x23, 0x1E, 0x1E, + 0x1E, 0x1E, 0x1E, 0xE3, 0xE3, 0xE3, 0xE3, 0xE2, 0xE2, 0xE2, + 0xE2, 0xE2, 0xF7, 0xF7, 0xF7, 0xF7, 0x67, 0x67, 0x67, 0x72, + 0x72, 0x37, 0x37, 0x37, 0x37, 0x23, 0x23, 0x23, 0x23, 0x23, + 0x1E, 0x1E, 0x1E, 0x1E, 0x1E, 0xE3, 0xE3, 0xE3, 0xE3, 0xE2, + 0xE2, 0xE2, 0xF7, 0xF7, 0xF7, 0xF7, 0xF7, 0xF7, 0x67, 0x67, + 0x67, 0x72, 0x37, 0x37, 0x37, 0x37, 0x71, 0x23, 0x23, 0x23, + 0x23, 0x1E, 0x1E, 0x1E, 0x1E, 0x1E, 0x1E, 0xDF, 0xDF, 0xDF, + 0xDF, 0xDE, 0xDE, 0xF7, 0xF7, 0xF7, 0xF7, 0xF7, 0xF7, 0xF7, + 0x67, 0x67, 0x67, 0x37, 0x37, 0x37,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52, 0X52, 0XBE, 0XBE, 0XBE, 0XBE, 0XBE, 0XBE, 0XBE, 0XBD, + 0XBD, 0XBD, 0XBD, 0XBD, 0XBD, 0XBC, 0XBC, 0XBC, 0X54, 0X54, + 0X54, 0X0C, 0X0C, 0X53, 0X53, 0X53, 0X53, 0X53, 0X52, 0X52, + 0X52, 0X52, 0X52, 0X52, 0XBE, 0XBE, 0XBE, 0XBE, 0XBE, 0XBE, + 0XBE, 0XBD, 0XBD, 0XBD, 0XBD, 0XBD, 0XBD, 0XBC, 0XBC, 0XBC, + 0X54, 0X54, 0X54, 0X0C, 0X0C, 0X53, 0X53, 0X53, 0X53, 0X53, + 0X52, 0X52, 0X52, 0X52, 0X52, 0X52, 0XBE, 0XBE, 0XBE, 0XBE, + 0XBE, 0XBE, 0XBE, 0XBD, 0XBD, 0XBD, 0XBD, 0XBD, 0XBD, 0XBC, + 0XBC, 0XBC, 0X54, 0X54, 0X54, 0X26, 0X26, 0X26, 0X53, 0X53, + 0X53, 0X53, 0X52, 0X52, 0X52, 0X52, 0X52, 0X52, 0X34, 0XBE, + 0XBE, 0XBE, 0XBE, 0XBE, 0XBE, 0XBD, 0XBD, 0XBD, 0XBD, 0XBD, + 0XBD, 0XBC, 0XBC, 0XBC, 0X54, 0X54, 0X26, 0X26, 0X26, 0X26, + 0X26, 0X26, 0X26, 0X53, 0X52, 0X52, 0X52, 0X52, 0X34, 0X34, + 0X34, 0X34, 0XBE, 0XBE, 0XBE, 0XBE, 0XBE, 0XBD, 0XBD, 0XBD, + 0XBD, 0XBD, 0XBD, 0XBC, 0XBC, 0XBC, 0XBB, 0XBB, 0X26, 0X26, + 0X26, 0X26, 0X26, 0X26, 0X26, 0X19, 0X19, 0XBA, 0XBA, 0XBA, + 0X34, 0X34, 0X34, 0X34, 0X34, 0X50, 0X50, 0X50, 0X50, 0XB9, + 0XB9, 0XB9, 0XB9, 0XB9, 0XB9, 0XB8, 0XB8, 0XB8, 0XBB, 0XBB, + 0X26, 0X26, 0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 0X52, 0X52, 0X52, 0X52, 0X52, 0XBE, 0XBE, + 0XBE, 0XBE, 0XBE, 0XBE, 0XBE, 0XBD, 0XBD, 0XBD, 0XBD, 0XBD, + 0XBD, 0XBC, 0XBC, 0XBC, 0X54, 0X54, 0X54, 0X0C, 0X26, 0X26, + 0X53, 0X53, 0X53, 0X53, 0X52, 0X52, 0X52, 0X52, 0X52, 0X52, + 0XBE, 0XBE, 0XBE, 0XBE, 0XBE, 0XBE, 0XBE, 0XBD, 0XBD, 0XBD, + 0XBD, 0XBD, 0XBD, 0XBC, 0XBC, 0XBC, 0X54, 0X54, 0X26, 0X26, + 0X26, 0X26, 0X26, 0X26, 0X53, 0X53, 0X52, 0X52, 0X52, 0X52, + 0X52, 0X52, 0X34, 0XBE, 0XBE, 0XBE, 0XBE, 0XBE, 0XBE, 0XBD, + 0XBD, 0XBD, 0XBD, 0XBD, 0XBD, 0XBC, 0XBC, 0XBC, 0X54, 0X54, + 0X26, 0X26, 0X26, 0X26, 0X26, 0X26, 0X26, 0X19, 0X19, 0X52, + 0X52, 0X52, 0X52, 0X34, 0X34, 0X34, 0XBE, 0XBE, 0XBE, 0XBE, + 0XBE, 0XBD, 0XBD, 0XBD, 0XBD, 0XBD, 0XBD, 0XBC, 0XBC, 0XBC, + 0XBB, 0X26, 0X26, 0X26, 0X26, 0X26, 0X26, 0X26, 0X19, 0X19, + 0X19, 0X03, 0X03, 0X03, 0X34, 0X34, 0X34, 0X34, 0X34, 0X50, + 0X50, 0X50, 0X50, 0XB9, 0XB9, 0XB9, 0XB9, 0XB9, 0XB9, 0XB8, + 0XB8, 0XB8, 0XBB, 0XBB, 0X26, 0X26, 0X26, 0X26, 0X26, 0X26, + 0X19, 0X19, 0X19, 0X03, 0X03, 0X03, 0X03, 0X34, 0X34, 0X34, + 0X50, 0X50, 0X50, 0X50, 0X6C, 0XB9, 0XB9, 0XB9, 0XB9, 0XB9, + 0XB9, 0XB8, 0XB8, 0XB8, 0XBB, 0XBB, 0X26,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XF9, 0XF9, 0XF9, 0X99, 0XFA, 0XFA, 0XFA, 0XFA, + 0XFA, 0X48, 0XFB, 0XFB, 0XFB, 0XFB, 0XFB, 0X47, 0X6B, 0X6B, + 0X6B, 0XFC, 0X18, 0X18, 0X18, 0X06, 0XFD, 0XFD, 0XF8, 0XF8, + 0XF8, 0XF8, 0XF9, 0XF9, 0XF9, 0XF9, 0X99, 0X99, 0XFA, 0XFA, + 0XFA, 0XFA, 0X48, 0X48, 0XFB, 0XFB, 0XFB, 0XFB, 0X47, 0X47, + 0X6B, 0X6B, 0XFC, 0X18, 0X18, 0X18, 0X06, 0X38, 0XFD, 0XFD, + 0X9A, 0X9A, 0X9A, 0X9A, 0XF9, 0XF9, 0XF9, 0X99, 0X99, 0X99, + 0XFA, 0XFA, 0XFA, 0X48, 0X48, 0X48, 0XFB, 0XFB, 0XFB, 0X47, + 0X47, 0X47, 0X47, 0XFC, 0XFC, 0X18, 0X18, 0X06, 0X38, 0X38, + 0X38, 0XFD, 0X9A, 0X9A, 0X9A, 0X9A, 0XF9, 0XF9, 0X99, 0X99, + 0X99, 0X99, 0XFA, 0XFA, 0X48, 0X48, 0X48, 0X48, 0XFB, 0XFB, + 0X47, 0X47, 0X47, 0X47, 0X47, 0XFC, 0XFC, 0X18, 0X38, 0X38, + 0X38, 0X38, 0X38, 0X38, 0XFE, 0XFE, 0XFE, 0XFE, 0XFF, 0XFF, + 0XFF, 0XFF, 0XFF, 0XFF, 0X95, 0X95, 0X95, 0X95, 0X95, 0X95, + 0X94, 0X94, 0X94, 0X94, 0X94, 0X94, 0X94, 0X93, 0X93, 0X93, + 0X38, 0X38, 0X38, 0X38, 0X38, 0X38, 0XFE, 0XFE, 0XFE, 0XFE, + 0XFF, 0XFF, 0XFF, 0XFF, 0XFF, 0XFF, 0X95, 0X95, 0X95, 0X95, + 0X95, 0X95, 0X94, 0X94, 0X94, 0X94, 0X94, 0X94, 0X94, 0X93, + 0X93, 0X93, 0X93, 0X38, 0X38, 0X38,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06, + 0XFD, 0XFD, 0X9A, 0X9A, 0X9A, 0X9A, 0XF9, 0XF9, 0XF9, 0X99, + 0X99, 0X99, 0XFA, 0XFA, 0XFA, 0X48, 0X48, 0X48, 0XFB, 0XFB, + 0XFB, 0X47, 0X47, 0X47, 0X47, 0XFC, 0XFC, 0XFC, 0X46, 0X06, + 0X06, 0X06, 0XFD, 0XFD, 0X9A, 0X9A, 0X9A, 0X9A, 0XF9, 0XF9, + 0X99, 0X99, 0X99, 0X99, 0XFA, 0XFA, 0X48, 0X48, 0X48, 0X48, + 0XFB, 0XFB, 0X47, 0X47, 0X47, 0X47, 0X47, 0XFC, 0XFC, 0X46, + 0X06, 0X06, 0X38, 0X38, 0X25, 0X98, 0X9A, 0X9A, 0X9A, 0X9A, + 0XF9, 0X99, 0X99, 0X99, 0X99, 0X99, 0XFA, 0X48, 0X48, 0X48, + 0X48, 0X48, 0XFB, 0X47, 0X47, 0X47, 0X47, 0X47, 0X47, 0XFC, + 0X46, 0X46, 0X06, 0X38, 0X38, 0X38, 0X38, 0X98, 0XFE, 0XFE, + 0XFE, 0XFE, 0XFF, 0XFF, 0XFF, 0XFF, 0XFF, 0XFF, 0X95, 0X95, + 0X95, 0X95, 0X95, 0X95, 0X94, 0X94, 0X94, 0X94, 0X94, 0X94, + 0X94, 0X93, 0X93, 0X93, 0X38, 0X38, 0X38, 0X38, 0X38, 0X1D, + 0XFE, 0XFE, 0XFE, 0XFE, 0XFF, 0XFF, 0XFF, 0XFF, 0XFF, 0X96, + 0X95, 0X95, 0X95, 0X95, 0X95, 0X95, 0X94, 0X94, 0X94, 0X94, + 0X94, 0X94, 0X94, 0X93, 0X93, 0X93, 0X93, 0X38, 0X38, 0X38, + 0X1D, 0X92, 0XFE, 0XFE, 0XFE, 0XFE, 0XFF, 0XFF, 0XFF, 0XFF, + 0X96, 0X96, 0X95, 0X95, 0X95, 0X95, 0X95, 0X95, 0X94, 0X94, + 0X94, 0X94, 0X94, 0X94, 0X94, 0X93, 0X93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0X06, 0X06, 0X25, 0XFD, 0X98, 0X9A, 0X9A, + 0X9A, 0X9A, 0XF9, 0X99, 0X99, 0X99, 0X99, 0X99, 0XFA, 0X48, + 0X48, 0X48, 0X48, 0X48, 0XFB, 0X47, 0X47, 0X47, 0X47, 0X47, + 0X47, 0XFC, 0X46, 0X46, 0X06, 0X06, 0X25, 0X25, 0X25, 0X98, + 0X9A, 0X9A, 0X9A, 0X9A, 0X99, 0X99, 0X99, 0X99, 0X99, 0X99, + 0X48, 0X48, 0X48, 0X48, 0X48, 0X48, 0X47, 0X47, 0X47, 0X47, + 0X47, 0X47, 0X47, 0X46, 0X46, 0X06, 0X06, 0X38, 0X25, 0X25, + 0X25, 0X1D, 0XFE, 0XFE, 0XFE, 0XFE, 0XFF, 0XFF, 0XFF, 0XFF, + 0XFF, 0X96, 0X95, 0X95, 0X95, 0X95, 0X95, 0X95, 0X94, 0X94, + 0X94, 0X94, 0X94, 0X94, 0X94, 0X93, 0X93, 0X93, 0X38, 0X38, + 0X38, 0X25, 0X1D, 0X1D, 0XFE, 0XFE, 0XFE, 0XFE, 0XFF, 0XFF, + 0XFF, 0XFF, 0X96, 0X96, 0X95, 0X95, 0X95, 0X95, 0X95, 0X95, + 0X94, 0X94, 0X94, 0X94, 0X94, 0X94, 0X94, 0X93, 0X93, 0X93, + 0X93, 0X38, 0X38, 0X1D, 0X1D, 0X1D, 0XFE, 0XFE, 0XFE, 0XFE, + 0XFF, 0XFF, 0XFF, 0X96, 0X96, 0X96, 0X95, 0X95, 0X95, 0X95, + 0X95, 0X95, 0X94, 0X94, 0X94, 0X94, 0X94, 0X94, 0X94, 0X93, + 0X93, 0X93, 0X93, 0X93, 0X93, 0X1D, 0X1D, 0X92, 0XAC, 0XAC, + 0XAC, 0XAC, 0XAB, 0XAB, 0XAB, 0XAB, 0XAB, 0XAB, 0XAA, 0XAA, + 0XAA, 0XAA, 0XAA, 0XAA, 0XA9, 0XA9, 0XA9, 0XA9, 0XA9, 0XA9, + 0XA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B, 0X4B, 0X4B, + 0X4B, 0X4B, 0X4A, 0X4A, 0X04, 0X04, 0X04, 0X05, 0X05, 0X05, + 0X05, 0X05, 0X49, 0X30, 0X30, 0X30, 0X30, 0X30, 0X30, 0X9C, + 0X9C, 0X9B, 0X9B, 0X9B, 0XF8, 0XF8, 0XF8, 0XF8, 0XF9, 0XF9, + 0XF9, 0XF9, 0X99, 0X99, 0XFA, 0XFA, 0XFA, 0XFA, 0X05, 0X05, + 0X05, 0X05, 0X05, 0X0E, 0X0E, 0X30, 0X30, 0X30, 0X30, 0X30, + 0X30, 0X46, 0X06, 0XFD, 0XFD, 0XFD, 0X9A, 0X9A, 0X9A, 0X9A, + 0XF9, 0XF9, 0XF9, 0X99, 0X99, 0X99, 0XFA, 0XFA, 0XFA, 0X48, + 0X48, 0X05, 0X05, 0X05, 0X0E, 0X0E, 0X47, 0X30, 0X30, 0X30, + 0X30, 0X30, 0X46, 0X46, 0X06, 0X06, 0XFD, 0XFD, 0X9A, 0X9A, + 0X9A, 0X9A, 0XF9, 0XF9, 0X99, 0X99, 0X99, 0X99, 0XFA, 0XFA, + 0X48, 0X48, 0X48, 0X48, 0X05, 0XFB, 0X47, 0X47, 0X47, 0X47, + 0X30, 0X30, 0X30, 0X46, 0X46, 0X06, 0X06, 0X25, 0XFD, 0X98, + 0X9A, 0X9A, 0X9A, 0X9A, 0XF9, 0X99, 0X99, 0X99, 0X99, 0X99, + 0XFA, 0X48, 0X48, 0X48, 0X48, 0X48, 0XFB, 0X47, 0X47, 0X47, + 0X47, 0X47, 0X30, 0X30, 0X46, 0X46, 0X06, 0X06, 0X25, 0X25, + 0X25, 0X98, 0X9A, 0X9A, 0X9A, 0X9A, 0X99, 0X99, 0X99, 0X99, + 0X99, 0X99, 0X48, 0X48, 0X48, 0X48, 0X48, 0X48, 0X47, 0X47, + 0X47, 0X47, 0X47, 0X47, 0X47, 0X46, 0X46, 0X46, 0X06, 0X6A, + 0X25, 0X25, 0X25, 0X98, 0X9A, 0X9A, 0X9A, 0X9A, 0X99, 0X99, + 0X99, 0X99, 0X99, 0X99, 0X48, 0X48, 0X48, 0X48, 0X48, 0X48, + 0X47, 0X47, 0X47, 0X47, 0X47, 0X47, 0X47, 0X46, 0X46, 0X6A, + 0X6A, 0X6A, 0X25, 0X25, 0X25, 0X1D, 0XFE, 0XFE, 0XFE, 0XFE, + 0XFF, 0XFF, 0XFF, 0XFF, 0X96, 0X96, 0X95, 0X95, 0X95, 0X95, + 0X95, 0X95, 0X94, 0X94, 0X94, 0X94, 0X94, 0X94, 0X94, 0X93, + 0X93, 0X6A, 0X6A, 0X6A, 0X25, 0X1D, 0X1D, 0X1D, 0XFE, 0XFE, + 0XFE, 0XFE, 0XFF, 0XFF, 0XFF, 0X96, 0X96, 0X96, 0X95, 0X95, + 0X95, 0X95, 0X95, 0X95, 0X94, 0X94, 0X94, 0X94, 0X94, 0X94, + 0X94, 0X93, 0X93, 0X93, 0X93, 0X6A, 0X1D, 0X1D, 0X1D, 0X1D, + 0X97, 0X97, 0X97, 0X97, 0XFF, 0XFF, 0X96, 0X96, 0X96, 0X96, + 0X95, 0X95, 0X95, 0X95, 0X95, 0X95, 0X94, 0X94, 0X94, 0X94, + 0X94, 0X94, 0X94, 0X93, 0X93, 0X93, 0X93, 0X93, 0X1D, 0X1D, + 0X1D, 0X1D, 0XAC, 0XAC, 0XAC, 0XAC, 0XAB, 0XAB, 0XAB, 0XAB, + 0XAB, 0XAB, 0XAA, 0XAA, 0XAA, 0XAA, 0XAA, 0XAA, 0XA9, 0XA9, + 0XA9, 0XA9, 0XA9, 0XA9, 0XA9, 0XA8, 0XA8, 0XA8, 0XA8, 0XA8, + 0XA8, 0XA7, 0XA7, 0XA7, 0XAC, 0XAC, 0XAC, 0XAC, 0XAB, 0XAB, + 0XAB, 0XAB, 0XAB, 0XAB, 0XAA, 0XAA, 0XAA, 0XAA, 0XAA, 0XAA, + 0XA9, 0XA9, 0XA9, 0XA9, 0XA9, 0XA9, 0XA9, 0XA8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XFA, + 0XFA, 0X48, 0X05, 0X05, 0X05, 0X05, 0X0E, 0X0E, 0X0E, 0X30, + 0X30, 0X30, 0X30, 0X30, 0X30, 0X30, 0X06, 0XFD, 0XFD, 0XFD, + 0X9A, 0X9A, 0X9A, 0X9A, 0XF9, 0XF9, 0X99, 0X99, 0X99, 0X99, + 0XFA, 0XFA, 0X48, 0X48, 0X48, 0X05, 0X05, 0X0E, 0X0E, 0X0E, + 0X0E, 0X0E, 0X30, 0X30, 0X30, 0X30, 0X30, 0X06, 0X06, 0X25, + 0XFD, 0X98, 0X9A, 0X9A, 0X9A, 0X9A, 0XF9, 0X99, 0X99, 0X99, + 0X99, 0X99, 0XFA, 0X48, 0X48, 0X48, 0X48, 0X48, 0X0E, 0X0E, + 0X0E, 0X0E, 0X0E, 0X0E, 0X30, 0X30, 0X30, 0X30, 0X46, 0X06, + 0X6A, 0X25, 0X98, 0X98, 0X9A, 0X9A, 0X9A, 0X9A, 0X99, 0X99, + 0X99, 0X99, 0X99, 0X99, 0X48, 0X48, 0X48, 0X48, 0X48, 0X48, + 0X0E, 0X0E, 0X0E, 0X0E, 0X0E, 0X0E, 0X30, 0X30, 0X28, 0X46, + 0X6A, 0X6A, 0X6A, 0X25, 0X25, 0X98, 0X9A, 0X9A, 0X9A, 0X9A, + 0X99, 0X99, 0X99, 0X99, 0X99, 0X99, 0X48, 0X48, 0X48, 0X48, + 0X48, 0X48, 0X0E, 0X0E, 0X0E, 0X0E, 0X0E, 0X0E, 0X28, 0X28, + 0X28, 0X28, 0X6A, 0X6A, 0X6A, 0X25, 0X33, 0X33, 0X9A, 0X9A, + 0X9A, 0X9A, 0X99, 0X99, 0X99, 0X99, 0X99, 0X99, 0X48, 0X48, + 0X48, 0X48, 0X48, 0X48, 0X0E, 0X0E, 0X0E, 0X0E, 0X0E, 0X0E, + 0X28, 0X28, 0X28, 0X6A, 0X6A, 0X6A, 0X6A, 0X33, 0X33, 0X1D, + 0XFE, 0XFE, 0XFE, 0XFE, 0XFF, 0XFF, 0XFF, 0X96, 0X96, 0X96, + 0X95, 0X95, 0X95, 0X95, 0X95, 0X95, 0X94, 0X94, 0X94, 0X94, + 0X94, 0X94, 0X28, 0X28, 0X28, 0X6A, 0X6A, 0X6A, 0X6A, 0X33, + 0X1D, 0X1D, 0X97, 0X97, 0X97, 0X97, 0XFF, 0XFF, 0X96, 0X96, + 0X96, 0X96, 0X95, 0X95, 0X95, 0X95, 0X95, 0X95, 0X94, 0X94, + 0X94, 0X94, 0X94, 0X94, 0X94, 0X93, 0X93, 0X93, 0X6A, 0X6A, + 0X33, 0X1D, 0X1D, 0X1D, 0X97, 0X97, 0X97, 0X97, 0XFF, 0X96, + 0X96, 0X96, 0X96, 0X96, 0X95, 0X95, 0X95, 0X95, 0X95, 0X95, + 0X94, 0X94, 0X94, 0X94, 0X94, 0X94, 0X94, 0X93, 0X93, 0X93, + 0X93, 0X93, 0X1D, 0X1D, 0X1D, 0X1D, 0X91, 0X91, 0X91, 0X91, + 0X90, 0X90, 0X90, 0X90, 0X90, 0X90, 0X8F, 0X8F, 0X8F, 0X8F, + 0X8F, 0X8F, 0X8E, 0X8E, 0X8E, 0X8E, 0X8E, 0X8E, 0X8E, 0X8D, + 0X8D, 0X8D, 0X8D, 0X8D, 0X8D, 0X8C, 0X8C, 0X8C, 0X91, 0X91, + 0X91, 0X91, 0X90, 0X90, 0X90, 0X90, 0X90, 0X90, 0X8F, 0X8F, + 0X8F, 0X8F, 0X8F, 0X8F, 0X8E, 0X8E, 0X8E, 0X8E, 0X8E, 0X8E, + 0X8E, 0X8D, 0X8D, 0X8D, 0X8D, 0X8D, 0X8D, 0X8C, 0X8C, 0X8C, + 0X91, 0X91, 0X91, 0X91, 0X90, 0X90, 0X90, 0X90, 0X90, 0X90, + 0X8F, 0X8F, 0X8F, 0X8F, 0X8F, 0X8F, 0X8E, 0X8E, 0X8E, 0X8E, + 0X8E, 0X8E, 0X8E, 0X8D, 0X8D, 0X8D, 0X8D, 0X8D, 0X8D, 0X8C, + 0X8C, 0X8C, 0X91, 0X91, 0X91, 0X91, 0X90, 0X90, 0X90, 0X90, + 0X90, 0X90, 0X8F, 0X8F, 0X8F, 0X8F, 0X8F, 0X8F, 0X8E, 0X8E, + 0X8E, 0X8E, 0X8E, 0X8E, 0X8E, 0X8D, 0X8D, 0X8D, 0X8D, 0X8D, + 0X8D, 0X8C, 0X8C, 0X8C, 0X8B, 0X8B, 0X8B, 0X8B, 0X8A, 0X8A, + 0X8A, 0X8A, 0X8A, 0X8A, 0X89, 0X89, 0X89, 0X89, 0X89, 0X89, + 0X88, 0X88, 0X88, 0X88, 0X88, 0X88, 0X88, 0X87, 0X87, 0X87, + 0X87, 0X87, 0X87, 0X86, 0X86, 0X86, 0X8B, 0X8B, 0X8B, 0X8B, + 0X8A, 0X8A, 0X8A, 0X8A, 0X8A, 0X8A, 0X89, 0X89, 0X89, 0X89, + 0X89, 0X89, 0X88, 0X88, 0X88, 0X88, 0X88, 0X88, 0X88, 0X87, + 0X87, 0X87, 0X87, 0X87, 0X87, 0X86, 0X86, 0X86, 0X8B, 0X8B, + 0X8B, 0X8B, 0X8A, 0X8A, 0X8A, 0X8A, 0X8A, 0X8A, 0X89, 0X89, + 0X89, 0X89, 0X89, 0X89, 0X88, 0X88, 0X88, 0X88, 0X88, 0X88, + 0X88, 0X87, 0X87, 0X87, 0X87, 0X87, 0X87, 0X86, 0X86, 0X86, + 0X8B, 0X8B, 0X8B, 0X8B, 0X8A, 0X8A, 0X8A, 0X8A, 0X8A, 0X8A, + 0X89, 0X89, 0X89, 0X89, 0X89, 0X89, 0X88, 0X88, 0X88, 0X88, + 0X88, 0X88, 0X88, 0X87, 0X87, 0X87, 0X87, 0X87, 0X87, 0X86, + 0X86, 0X86, 0X8B, 0X8B, 0X8B, 0X8B, 0X8A, 0X8A, 0X8A, 0X8A, + 0X8A, 0X8A, 0X89, 0X89, 0X89, 0X89, 0X89, 0X89, 0X88, 0X88, + 0X88, 0X88, 0X88, 0X88, 0X88, 0X87, 0X87, 0X87, 0X87, 0X87, + 0X87, 0X86, 0X86, 0X86, 0X8B, 0X8B, 0X8B, 0X8B, 0X8A, 0X8A, + 0X8A, 0X8A, 0X8A, 0X8A, 0X89, 0X89, 0X89, 0X89, 0X89, 0X89, + 0X88, 0X88, 0X88, 0X88, 0X88, 0X88, 0X88, 0X87, 0X87, 0X87, + 0X87, 0X87, 0X87, 0X86, 0X86, 0X86, 0X85, 0X85, 0X85, 0X85, + 0X84, 0X84, 0X84, 0X84, 0X84, 0X84, 0X13, 0X13, 0X13, 0X83, + 0X83, 0X83, 0X82, 0X82, 0X82, 0X82, 0X82, 0X82, 0X82, 0X81, + 0X81, 0X81, 0X81, 0X81, 0X81, 0X80, 0X80, 0X80, 0X85, 0X85, + 0X85, 0X85, 0X84, 0X84, 0X84, 0X84, 0X84, 0X13, 0X13, 0X13, + 0X13, 0X13, 0X83, 0X83, 0X82, 0X82, 0X82, 0X82, 0X82, 0X82, + 0X82, 0X81, 0X81, 0X81, 0X81, 0X81, 0X81, 0X80, 0X80, 0X80, + 0X85, 0X85, 0X85, 0X85, 0X84, 0X84, 0X84, 0X84, 0X84, 0X13, + 0X13, 0X13, 0X13, 0X13, 0X13, 0X83, 0X82, 0X82, 0X82, 0X82, + 0X82, 0X82, 0X82, 0X81, 0X81, 0X81, 0X81, 0X81, 0X81, 0X80, + 0X80, 0X80, 0X85, 0X85, 0X85, 0X85, 0X84, 0X84, 0X84, 0X84, + 0X84, 0X13, 0X13, 0X13, 0X13, 0X13, 0X13, 0X13, 0X82, 0X82, + 0X82, 0X82, 0X82, 0X82, 0X82, 0X81, 0X81, 0X81, 0X81, 0X81, + 0X81, 0X80, 0X80, 0X80, 0X85, 0X85, 0X85, 0X85, 0X84, 0X84, + 0X84, 0X84, 0X84, 0X13, 0X13, 0X13, 0X13, 0X13, 0X13, 0X13, + 0X13, 0X82, 0X82, 0X82, 0X82, 0X82, 0X82, 0X81, 0X81, 0X81, + 0X81, 0X81, 0X81, 0X80, 0X80, 0X80, 0X85, 0X85, 0X85, 0X85, + 0X84, 0X84, 0X84, 0X84, 0X84, 0X13, 0X13, 0X13, 0X13, 0X13, + 0X13, 0X13, 0X13, 0X82, 0X82, 0X82, 0X82, 0X82, 0X82, 0X81, + 0X81, 0X81, 0X81, 0X81, 0X81, 0X80, 0X80, 0X80, 0X7F, 0X7F, + 0X7F, 0X7F, 0X7E, 0X7E, 0X7E, 0X7E, 0X7E, 0X13, 0X13, 0X13, + 0X13, 0X13, 0X13, 0X13, 0X13, 0X44, 0X44, 0X44, 0X44, 0X44, + 0X44, 0X7D, 0X7D, 0X7D, 0X7D, 0X7D, 0X7D, 0X7C, 0X7C, 0X7C, + 0X7F, 0X7F, 0X7F, 0X7F, 0X7E, 0X7E, 0X7E, 0X7E, 0X7E, 0X13, + 0X13, 0X13, 0X13, 0X13, 0X45, 0X45, 0X44, 0X44, 0X44, 0X44, + 0X44, 0X44, 0X44, 0X7D, 0X7D, 0X7D, 0X7D, 0X7D, 0X7D, 0X7C, + 0X7C, 0X7C, 0X7F, 0X7F, 0X7F, 0X7F, 0X7E, 0X7E, 0X7E, 0X7E, + 0X7E, 0X7E, 0X45, 0X45, 0X45, 0X45, 0X45, 0X45, 0X44, 0X44, + 0X44, 0X44, 0X44, 0X44, 0X44, 0X7D, 0X7D, 0X7D, 0X7D, 0X7D, + 0X7D, 0X7C, 0X7C, 0X7C, 0X7F, 0X7F, 0X7F, 0X7F, 0X7E, 0X7E, + 0X7E, 0X7E, 0X7E, 0X7E, 0X45, 0X45, 0X45, 0X45, 0X45, 0X45, + 0X05, 0X44, 0X44, 0X44, 0X44, 0X44, 0X44, 0X7D, 0X7D, 0X7D, + 0X7D, 0X7D, 0X7D, 0X7C, 0X7C, 0X7C, 0X7F, 0X7F, 0X7F, 0X7F, + 0X7E, 0X7E, 0X7E, 0X7E, 0X7E, 0X7E, 0X45, 0X45, 0X45, 0X45, + 0X45, 0X05, 0X05, 0X05, 0X44, 0X44, 0X44, 0X44,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0X79, + 0X79, 0X79, 0X79, 0X79, 0X0E, 0X0E, 0X0E, 0X0E, 0X0E, 0X0E, + 0X28, 0X28, 0X28, 0X28, 0X28, 0X6A, 0X6A, 0X33, 0X33, 0X78, + 0X7B, 0X7B, 0X7B, 0X7B, 0X7A, 0X7A, 0X7A, 0X7A, 0X7A, 0X7A, + 0X79, 0X79, 0X79, 0X79, 0X79, 0X79, 0X0E, 0X0E, 0X0E, 0X0E, + 0X0E, 0X0E, 0X28, 0X28, 0X28, 0X28, 0X6A, 0X6A, 0X6A, 0X33, + 0X33, 0X33, 0X7B, 0X7B, 0X7B, 0X7B, 0X7A, 0X7A, 0X7A, 0X7A, + 0X7A, 0X7A, 0X79, 0X79, 0X79, 0X79, 0X79, 0X79, 0X0E, 0X0E, + 0X0E, 0X0E, 0X0E, 0X0E, 0X28, 0X28, 0X28, 0X28, 0X6A, 0X6A, + 0X33, 0X33, 0X33, 0X33, 0X77, 0X77, 0X77, 0X77, 0X76, 0X76, + 0X76, 0X76, 0X76, 0X76, 0X75, 0X75, 0X75, 0X75, 0X75, 0X75, + 0X0E, 0X0E, 0X74, 0X74, 0X74, 0X28, 0X28, 0X28, 0X28, 0X28, + 0X2D, 0X6A, 0X33, 0X33, 0X33, 0X69, 0X77, 0X77, 0X77, 0X77, + 0X76, 0X76, 0X76, 0X76, 0X76, 0X76, 0X75, 0X75, 0X75, 0X75, + 0X75, 0X75, 0X74, 0X74, 0X74, 0X74, 0X74, 0X74, 0X28, 0X28, + 0X28, 0X2D, 0X2D, 0X2D, 0X69, 0X69, 0X69, 0X69, 0X77, 0X77, + 0X77, 0X77, 0X76, 0X76, 0X76, 0X76, 0X76, 0X76, 0X75, 0X75, + 0X75, 0X75, 0X75, 0X75, 0X74, 0X74, 0X74, 0X74, 0X74, 0X74, + 0X74, 0X41, 0X41, 0X41, 0X41, 0X2D, 0X69, 0X69, 0X69, 0X69, + 0X91, 0X91, 0X91, 0X91, 0X90, 0X90, 0X90, 0X90, 0X90, 0X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0X86, + 0X86, 0X86, 0X8B, 0X8B, 0X8B, 0X8B, 0X8A, 0X8A, 0X8A, 0X8A, + 0X8A, 0X8A, 0X89, 0X89, 0X89, 0X89, 0X89, 0X89, 0X88, 0X88, + 0X88, 0X88, 0X88, 0X88, 0X88, 0X87, 0X87, 0X87, 0X87, 0X87, + 0X87, 0X86, 0X86, 0X86, 0X8B, 0X8B, 0X8B, 0X8B, 0X8A, 0X8A, + 0X8A, 0X8A, 0X8A, 0X8A, 0X89, 0X89, 0X89, 0X89, 0X89, 0X89, + 0X88, 0X88, 0X88, 0X88, 0X88, 0X88, 0X88, 0X87, 0X87, 0X87, + 0X87, 0X87, 0X87, 0X86, 0X86, 0X86, 0X8B, 0X8B, 0X8B, 0X8B, + 0X8A, 0X8A, 0X8A, 0X8A, 0X8A, 0X8A, 0X89, 0X89, 0X89, 0X89, + 0X89, 0X89, 0X88, 0X88, 0X88, 0X88, 0X88, 0X88, 0X88, 0X87, + 0X87, 0X87, 0X87, 0X87, 0X87, 0X86, 0X86, 0X86, 0X8B, 0X8B, + 0X8B, 0X8B, 0X8A, 0X8A, 0X8A, 0X8A, 0X8A, 0X8A, 0X89, 0X89, + 0X89, 0X89, 0X89, 0X89, 0X88, 0X88, 0X88, 0X88, 0X88, 0X88, + 0X88, 0X87, 0X87, 0X87, 0X87, 0X87, 0X87, 0X86, 0X86, 0X86, + 0X85, 0X85, 0X85, 0X85, 0X84, 0X84, 0X84, 0X84, 0X84, 0X84, + 0X83, 0X83, 0X83, 0X83, 0X83, 0X83, 0X82, 0X82, 0X82, 0X82, + 0X82, 0X82, 0X82, 0X81, 0X81, 0X81, 0X81, 0X81, 0X81, 0X80, + 0X80, 0X80, 0X85, 0X85, 0X85, 0X85, 0X84, 0X84, 0X84, 0X84, + 0X84, 0X84, 0X83, 0X83, 0X83, 0X83, 0X83, 0X83, 0X82, 0X82, + 0X82, 0X82, 0X82, 0X82, 0X82, 0X81, 0X81, 0X81, 0X81, 0X81, + 0X81, 0X80, 0X80, 0X80, 0X85, 0X85, 0X85, 0X85, 0X84, 0X84, + 0X84, 0X84, 0X84, 0X84, 0X13, 0X83, 0X83, 0X83, 0X83, 0X83, + 0X82, 0X82, 0X82, 0X82, 0X82, 0X82, 0X82, 0X81, 0X81, 0X81, + 0X81, 0X81, 0X81, 0X80, 0X80, 0X80, 0X85, 0X85, 0X85, 0X85, + 0X84, 0X84, 0X84, 0X84, 0X84, 0X84, 0X13, 0X13, 0X83, 0X83, + 0X83, 0X83, 0X82, 0X82, 0X82, 0X82, 0X82, 0X82, 0X82, 0X81, + 0X81, 0X81, 0X81, 0X81, 0X81, 0X80, 0X80, 0X80, 0X85, 0X85, + 0X85, 0X85, 0X84, 0X84, 0X84, 0X84, 0X84, 0X84, 0X13, 0X13, + 0X13, 0X83, 0X83, 0X83, 0X82, 0X82, 0X82, 0X82, 0X82, 0X82, + 0X82, 0X81, 0X81, 0X81, 0X81, 0X81, 0X81, 0X80, 0X80, 0X80, + 0X85, 0X85, 0X85, 0X85, 0X84, 0X84, 0X84, 0X84, 0X84, 0X13, + 0X13, 0X13, 0X13, 0X13, 0X83, 0X83, 0X82, 0X82, 0X82, 0X82, + 0X82, 0X82, 0X82, 0X81, 0X81, 0X81, 0X81, 0X81, 0X81, 0X80, + 0X80, 0X80, 0X7F, 0X7F, 0X7F, 0X7F, 0X7E, 0X7E, 0X7E, 0X7E, + 0X7E, 0X13, 0X13, 0X13, 0X13, 0X13, 0X13, 0X45, 0X44, 0X44, + 0X44, 0X44, 0X44, 0X44, 0X44, 0X7D, 0X7D, 0X7D, 0X7D, 0X7D, + 0X7D, 0X7C, 0X7C, 0X7C, 0X7F, 0X7F, 0X7F, 0X7F, 0X7E, 0X7E, + 0X7E, 0X7E, 0X7E, 0X7E, 0X45, 0X45, 0X45, 0X45, 0X45, 0X45, + 0X44, 0X44, 0X44, 0X44, 0X44, 0X44, 0X44, 0X7D, 0X7D, 0X7D, + 0X7D, 0X7D, 0X7D, 0X7C, 0X7C, 0X7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X0E, 0X0E, 0X0E, 0X30, 0X30, + 0X30, 0X30, 0X42, 0X42, 0X42, 0X78, 0X78, 0X78, 0X7B, 0X7B, + 0X7B, 0X7B, 0X7A, 0X7A, 0X7A, 0X7A, 0X7A, 0X7A, 0X79, 0X79, + 0X79, 0X79, 0X79, 0X79, 0X0E, 0X0E, 0X0E, 0X0E, 0X0E, 0X0E, + 0X30, 0X30, 0X30, 0X42, 0X42, 0X42, 0X42, 0X78, 0X78, 0X78, + 0X7B, 0X7B, 0X7B, 0X7B, 0X7A, 0X7A, 0X7A, 0X7A, 0X7A, 0X7A, + 0X79, 0X79, 0X79, 0X79, 0X79, 0X79, 0X0E, 0X0E, 0X0E, 0X0E, + 0X0E, 0X0E, 0X28, 0X28, 0X28, 0X28, 0X42, 0X42, 0X42, 0X78, + 0X78, 0X78, 0X7B, 0X7B, 0X7B, 0X7B, 0X7A, 0X7A, 0X7A, 0X7A, + 0X7A, 0X7A, 0X79, 0X79, 0X79, 0X79, 0X79, 0X79, 0X0E, 0X0E, + 0X0E, 0X0E, 0X0E, 0X0E, 0X28, 0X28, 0X28, 0X28, 0X28, 0X42, + 0X6A, 0X33, 0X78, 0X78, 0X7B, 0X7B, 0X7B, 0X7B, 0X7A, 0X7A, + 0X7A, 0X7A, 0X7A, 0X7A, 0X79, 0X79, 0X79, 0X79, 0X79, 0X79, + 0X0E, 0X0E, 0X0E, 0X0E, 0X43, 0X43, 0X28, 0X28, 0X28, 0X28, + 0X28, 0X6A, 0X33, 0X33, 0X33, 0X33, 0X7B, 0X7B, 0X7B, 0X7B, + 0X7A, 0X7A, 0X7A, 0X7A, 0X7A, 0X7A, 0X79, 0X79, 0X79, 0X79, + 0X79, 0X79, 0X43, 0X43, 0X43, 0X43, 0X43, 0X28, 0X28, 0X28, + 0X28, 0X28, 0X2D, 0X2D, 0X33, 0X33, 0X33, 0X33, 0X77, 0X77, + 0X77, 0X77, 0X76, 0X76, 0X76, 0X76, 0X76, 0X76, 0X75, 0X75, + 0X75, 0X75, 0X75, 0X75, 0X74, 0X74, 0X74, 0X74, 0X74, 0X74, + 0X28, 0X28, 0X28, 0X28, 0X2D, 0X2D, 0X2D, 0X33, 0X69, 0X69, + 0X77, 0X77, 0X77, 0X77, 0X76, 0X76, 0X76, 0X76, 0X76, 0X76, + 0X75, 0X75, 0X75, 0X75, 0X75, 0X75, 0X74, 0X74, 0X74, 0X74, + 0X74, 0X74, 0X74, 0X28, 0X41, 0X2D, 0X2D, 0X2D, 0X2D, 0X69, + 0X69, 0X69, 0X77, 0X77, 0X77, 0X77, 0X76, 0X76, 0X76, 0X76, + 0X76, 0X76, 0X75, 0X75, 0X75, 0X75, 0X75, 0X75, 0X74, 0X74, + 0X74, 0X74, 0X74, 0X74, 0X74, 0X41, 0X41, 0X41, 0X41, 0X2D, + 0X69, 0X69, 0X69, 0X0D, 0X91, 0X91, 0X91, 0X91, 0X90, 0X90, + 0X90, 0X90, 0X90, 0X90, 0X8F, 0X8F, 0X8F, 0X8F, 0X8F, 0X8F, + 0X8E, 0X8E, 0X8E, 0X8E, 0X8E, 0X8E, 0X8E, 0X8D, 0X8D, 0X8D, + 0X8D, 0X8D, 0X8D, 0X8C, 0X8C, 0X8C, 0X91, 0X91, 0X91, 0X91, + 0X90, 0X90, 0X90, 0X90, 0X90, 0X90, 0X8F, 0X8F, 0X8F, 0X8F, + 0X8F, 0X8F, 0X8E, 0X8E, 0X8E, 0X8E, 0X8E, 0X8E, 0X8E, 0X8D, + 0X8D, 0X8D, 0X8D, 0X8D, 0X8D, 0X8C, 0X8C, 0X8C, 0X91, 0X91, + 0X91, 0X91, 0X90, 0X90, 0X90, 0X90, 0X90, 0X90, 0X8F, 0X8F, + 0X8F, 0X8F, 0X8F, 0X8F, 0X8E, 0X8E, 0X8E, 0X8E, 0X8E, 0X8E, + 0X8E, 0X8D, 0X8D, 0X8D, 0X8D, 0X8D, 0X8D, 0X8C, 0X8C, 0X8C, + 0X91, 0X91, 0X91, 0X91, 0X90, 0X90, 0X90, 0X90, 0X90, 0X90, + 0X8F, 0X8F, 0X8F, 0X8F, 0X8F, 0X8F, 0X8E, 0X8E, 0X8E, 0X8E, + 0X8E, 0X8E, 0X8E, 0X8D, 0X8D, 0X8D, 0X8D, 0X8D, 0X8D, 0X8C, + 0X8C, 0X8C, 0X8B, 0X8B, 0X8B, 0X8B, 0X8A, 0X8A, 0X8A, 0X8A, + 0X8A, 0X8A, 0X89, 0X89, 0X89, 0X89, 0X89, 0X89, 0X88, 0X88, + 0X88, 0X88, 0X88, 0X88, 0X88, 0X87, 0X87, 0X87, 0X87, 0X87, + 0X87, 0X86, 0X86, 0X86, 0X8B, 0X8B, 0X8B, 0X8B, 0X8A, 0X8A, + 0X8A, 0X8A, 0X8A, 0X8A, 0X89, 0X89, 0X89, 0X89, 0X89, 0X89, + 0X88, 0X88, 0X88, 0X88, 0X88, 0X88, 0X88, 0X87, 0X87, 0X87, + 0X87, 0X87, 0X87, 0X86, 0X86, 0X86, 0X8B, 0X8B, 0X8B, 0X8B, + 0X8A, 0X8A, 0X8A, 0X8A, 0X8A, 0X8A, 0X89, 0X89, 0X89, 0X89, + 0X89, 0X89, 0X88, 0X88, 0X88, 0X88, 0X88, 0X88, 0X88, 0X87, + 0X87, 0X87, 0X87, 0X87, 0X87, 0X86, 0X86, 0X86, 0X8B, 0X8B, + 0X8B, 0X8B, 0X8A, 0X8A, 0X8A, 0X8A, 0X8A, 0X8A, 0X89, 0X89, + 0X89, 0X89, 0X89, 0X89, 0X88, 0X88, 0X88, 0X88, 0X88, 0X88, + 0X88, 0X87, 0X87, 0X87, 0X87, 0X87, 0X87, 0X86, 0X86, 0X86, + 0X8B, 0X8B, 0X8B, 0X8B, 0X8A, 0X8A, 0X8A, 0X8A, 0X8A, 0X8A, + 0X89, 0X89, 0X89, 0X89, 0X89, 0X89, 0X88, 0X88, 0X88, 0X88, + 0X88, 0X88, 0X88, 0X87, 0X87, 0X87, 0X87, 0X87, 0X87, 0X86, + 0X86, 0X86, 0X8B, 0X8B, 0X8B, 0X8B, 0X8A, 0X8A, 0X8A, 0X8A, + 0X8A, 0X8A, 0X89, 0X89, 0X89, 0X89, 0X89, 0X89, 0X88, 0X88, + 0X88, 0X88, 0X88, 0X88, 0X88, 0X87, 0X87, 0X87, 0X87, 0X87, + 0X87, 0X86, 0X86, 0X86, 0X85, 0X85, 0X85, 0X85, 0X84, 0X84, + 0X84, 0X84, 0X84, 0X84, 0X83, 0X83, 0X83, 0X83, 0X83, 0X83, + 0X82, 0X82, 0X82, 0X82, 0X82, 0X82, 0X82, 0X81, 0X81, 0X81, + 0X81, 0X81, 0X81, 0X80, 0X80, 0X80, 0X85, 0X85, 0X85, 0X85, + 0X84, 0X84, 0X84, 0X84, 0X84, 0X84, 0X83, 0X83, 0X83, 0X83, + 0X83, 0X83, 0X82, 0X82, 0X82, 0X82, 0X82, 0X82, 0X82, 0X81, + 0X81, 0X81, 0X81, 0X81, 0X81, 0X80, 0X80, 0X80, 0X85, 0X85, + 0X85, 0X85, 0X84, 0X84, 0X84, 0X84, 0X84, 0X84, 0X83, 0X83, + 0X83, 0X83, 0X83, 0X83, 0X82, 0X82, 0X82, 0X82, 0X82, 0X82, + 0X82, 0X81, 0X81, 0X81, 0X81, 0X81, 0X81, 0X80, 0X80, 0X80, + 0X85, 0X85, 0X85, 0X85, 0X84, 0X84, 0X84, 0X84, 0X84, 0X84, + 0X83, 0X83, 0X83, 0X83, 0X83, 0X83, 0X82, 0X82, 0X82, 0X82, + 0X82, 0X82, 0X82, 0X81, 0X81, 0X81, 0X81, 0X81, 0X81, 0X80, + 0X80, 0X80, 0X85, 0X85, 0X85, 0X85, 0X84, 0X84, 0X84, 0X84, + 0X84, 0X84, 0X83, 0X83, 0X83, 0X83, 0X83, 0X83, 0X82, 0X82, + 0X82, 0X82, 0X82, 0X82, 0X82, 0X81, 0X81, 0X81, 0X81, 0X81, + 0X81, 0X80, 0X80, 0X80, 0X85, 0X85, 0X85, 0X85, 0X84, 0X84, + 0X84, 0X84, 0X84, 0X84, 0X83, 0X83, 0X83, 0X83, 0X83, 0X83, + 0X82, 0X82, 0X82, 0X82, 0X82, 0X82, 0X82, 0X81, 0X81, 0X81, + 0X81, 0X81, 0X81, 0X80, 0X80, 0X80, 0X7F, 0X7F, 0X7F, 0X7F, + 0X7E, 0X7E, 0X7E, 0X7E, 0X7E, 0X7E, 0X13, 0X45, 0X45, 0X45, + 0X45, 0X45, 0X44, 0X44, 0X44, 0X44, 0X44, 0X44, 0X44, 0X7D, + 0X7D, 0X7D, 0X7D, 0X7D, 0X7D, 0X7C, 0X7C, 0X7C, 0X7F, 0X7F, + 0X7F, 0X7F, 0X7E, 0X7E, 0X7E, 0X7E, 0X7E, 0X7E, 0X45, 0X45, + 0X45, 0X45, 0X45, 0X45, 0X44, 0X44, 0X44, 0X44, 0X44, 0X44, + 0X44, 0X7D, 0X7D, 0X7D, 0X7D, 0X7D, 0X7D, 0X7C, 0X7C, 0X7C, + 0X7F, 0X7F, 0X7F, 0X7F, 0X7E, 0X7E, 0X7E, 0X7E, 0X7E, 0X7E, + 0X45, 0X45, 0X45, 0X45, 0X45, 0X45, 0X44, 0X44, 0X44, 0X44, + 0X44, 0X44, 0X44, 0X7D, 0X7D, 0X7D, 0X7D, 0X7D, 0X7D, 0X7C, + 0X7C, 0X7C, 0X7F, 0X7F, 0X7F, 0X7F, 0X7E, 0X7E, 0X7E, 0X7E, + 0X7E, 0X7E, 0X45, 0X45, 0X45, 0X45, 0X45, 0X45, 0X44, 0X44, + 0X44, 0X44, 0X44, 0X44, 0X44, 0X7D, 0X7D, 0X7D, 0X7D, 0X7D, + 0X7D, 0X7C, 0X7C, 0X7C, 0X7F, 0X7F, 0X7F, 0X7F, 0X7E, 0X7E, + 0X7E, 0X7E, 0X7E, 0X7E, 0X45, 0X45, 0X45, 0X45, 0X45, 0X45, + 0X44, 0X44, 0X44, 0X44, 0X44, 0X44, 0X44, 0X7D, 0X7D, 0X7D, + 0X7D, 0X7D, 0X7D, 0X7C, 0X7C, 0X7C, 0X7F, 0X7F, 0X7F, 0X7F, + 0X7E, 0X7E, 0X7E, 0X7E, 0X7E, 0X7E, 0X45, 0X45, 0X45, 0X45, + 0X45, 0X45, 0X44, 0X44, 0X44, 0X44, 0X44, 0X44, 0X44, 0X7D, + 0X7D, 0X7D, 0X7D, 0X7D, 0X7D, 0X7C, 0X7C, 0X7C, 0X7F, 0X7F, + 0X7F, 0X7F, 0X7E, 0X7E, 0X7E, 0X7E, 0X7E, 0X7E, 0X45, 0X45, + 0X45, 0X45, 0X45, 0X45, 0X05, 0X44, 0X44, 0X44, 0X44, 0X44, + 0X30, 0X30, 0X7D, 0X7D, 0X7D, 0X7D, 0X7D, 0X7C, 0X7C, 0X7C, + 0X7B, 0X7B, 0X7B, 0X7B, 0X7A, 0X7A, 0X7A, 0X7A, 0X7A, 0X7A, + 0X79, 0X79, 0X79, 0X79, 0X79, 0X79, 0X43, 0X43, 0X43, 0X43, + 0X43, 0X43, 0X30, 0X30, 0X42, 0X42, 0X42, 0X42, 0X42, 0X78, + 0X78, 0X78, 0X7B, 0X7B, 0X7B, 0X7B, 0X7A, 0X7A, 0X7A, 0X7A, + 0X7A, 0X7A, 0X79, 0X79, 0X79, 0X79, 0X79, 0X79, 0X43, 0X43, + 0X43, 0X43, 0X43, 0X43, 0X43, 0X42, 0X42, 0X42, 0X42, 0X42, + 0X42, 0X78, 0X78, 0X78, 0X7B, 0X7B, 0X7B, 0X7B, 0X7A, 0X7A, + 0X7A, 0X7A, 0X7A, 0X7A, 0X79, 0X79, 0X79, 0X79, 0X79, 0X79, + 0X43, 0X43, 0X43, 0X43, 0X43, 0X43, 0X28, 0X28, 0X42, 0X42, + 0X42, 0X42, 0X42, 0X78, 0X78, 0X78, 0X7B, 0X7B, 0X7B, 0X7B, + 0X7A, 0X7A, 0X7A, 0X7A, 0X7A, 0X7A, 0X79, 0X79, 0X79, 0X79, + 0X79, 0X79, 0X43, 0X43, 0X43, 0X43, 0X43, 0X43, 0X28, 0X28, + 0X28, 0X28, 0X42, 0X42, 0X42, 0X78, 0X78, 0X78, 0X7B, 0X7B, + 0X7B, 0X7B, 0X7A, 0X7A, 0X7A, 0X7A, 0X7A, 0X7A, 0X79, 0X79, + 0X79, 0X79, 0X79, 0X79, 0X43, 0X43, 0X43, 0X43, 0X43, 0X43, + 0X28, 0X28, 0X28, 0X28, 0X28, 0X2D, 0X2D, 0X33, 0X33, 0X78, + 0X7B, 0X7B, 0X7B, 0X7B, 0X7A, 0X7A, 0X7A, 0X7A, 0X7A, 0X7A, + 0X79, 0X79, 0X79, 0X79, 0X79, 0X79, 0X43, 0X43, 0X43, 0X43, + 0X43, 0X43, 0X28, 0X28, 0X28, 0X28, 0X2D, 0X2D, 0X2D, 0X33, + 0X33, 0X69, 0X77, 0X77, 0X77, 0X77, 0X76, 0X76, 0X76, 0X76, + 0X76, 0X76, 0X75, 0X75, 0X75, 0X75, 0X75, 0X75, 0X74, 0X74, + 0X74, 0X74, 0X74, 0X74, 0X28, 0X28, 0X28, 0X2D, 0X2D, 0X2D, + 0X2D, 0X69, 0X69, 0X69, 0X77, 0X77, 0X77, 0X77, 0X76, 0X76, + 0X76, 0X76, 0X76, 0X76, 0X75, 0X75, 0X75, 0X75, 0X75, 0X75, + 0X74, 0X74, 0X74, 0X74, 0X74, 0X74, 0X74, 0X41, 0X41, 0X41, + 0X2D, 0X2D, 0X2D, 0X69, 0X69, 0X0D, 0X77, 0X77, 0X77, 0X77, + 0X76, 0X76, 0X76, 0X76, 0X76, 0X76, 0X75, 0X75, 0X75, 0X75, + 0X75, 0X75, 0X74, 0X74, 0X74, 0X74, 0X74, 0X74, 0X74, 0X41, + 0X41, 0X41, 0X41, 0X2D, 0X2D, 0X69, 0X0D, 0X0D +}; + + +} // End of namespace Lab diff --git a/engines/lab/special.cpp b/engines/lab/special.cpp new file mode 100644 index 0000000000..5542b05716 --- /dev/null +++ b/engines/lab/special.cpp @@ -0,0 +1,2219 @@ +/* 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. + * + */ + +/* + * This code is based on Labyrinth of Time code with assistance of + * + * Copyright (c) 1993 Terra Nova Development + * Copyright (c) 2004 The Wyrmkeep Entertainment Co. + * + */ + +#include "lab/labfun.h" +#include "lab/parsefun.h" +#include "lab/interface.h" +#include "lab/diff.h" +#include "lab/vga.h" +#include "lab/text.h" +#include "lab/mouse.h" +#include "lab/timing.h" +#include "lab/stddefines.h" +#include "lab/parsetypes.h" + +#define MODERNGAMESAVE 1 + +#if defined(MODERNGAMESAVE) +#include "lab/modernsavegame.h" +#endif + +namespace Lab { + +#ifdef GAME_TRIAL +int g_IsRegistered; +#endif + +extern bool nopalchange, DoBlack, IsHiRes; + +extern struct BitMap *DispBitMap, *DrawBitMap; +extern char diffcmap[3 * 256]; + +extern uint32 VGAScreenWidth, VGAScreenHeight; + + +#define COMBINATIONUNLOCKED 130 +#define BRICKOPEN 115 + + +static uint16 hipal[20]; +extern uint16 *FadePalette; + + +static byte *loadBackPict(const char *fileName, bool tomem) { + uint16 counter; + byte *res = NULL; + + FadePalette = hipal; + nopalchange = true; + + if (tomem) + res = readPictToMem(fileName, VGAScreenWidth, VGAScreenHeight); + else + readPict(fileName, true); + + for (counter = 0; counter < 16; counter++) { + hipal[counter] = ((diffcmap[counter * 3] >> 2) << 8) + + ((diffcmap[counter * 3 + 1] >> 2) << 4) + + ((diffcmap[counter * 3 + 2] >> 2)); + } + + nopalchange = false; + + return res; +} + + + +/*----------------------------------------------------------------------------*/ +/*-------------------------- Combination Lock Rules --------------------------*/ +/*----------------------------------------------------------------------------*/ + + + + +static struct Image *Images[10]; + + +uint16 combination[6] = {0, 0, 0, 0, 0, 0}, solution[] = {0, 4, 0, 8, 7, 2}; + +static uint16 combx[] = {45, 83, 129, 166, 211, 248}; + + + +/*****************************************************************************/ +/* Draws the images of the combination lock to the display bitmap. */ +/*****************************************************************************/ +static void doCombination(void) { + uint16 counter; + + for (counter = 0; counter <= 5; counter++) + drawImage(Images[combination[counter]], VGAScaleX(combx[counter]), VGAScaleY(65)); +} + + +extern char *TempScrollData; + +/*****************************************************************************/ +/* Reads in a backdrop picture. */ +/*****************************************************************************/ +void showCombination(const char *filename) { + uint16 CurBit; + byte **buffer; + + resetBuffer(); + DoBlack = true; + nopalchange = true; + readPict(filename, true); + nopalchange = false; + + blackScreen(); + + buffer = g_music->newOpen("P:Numbers"); + + for (CurBit = 0; CurBit < 10; CurBit++) + readImage(buffer, &(Images[CurBit])); + + allocFile((void **)&TempScrollData, Images[0]->Width * Images[0]->Height * 2L, "tempdata"); + + doCombination(); + + VGASetPal(diffcmap, 256); +} + + + +/*****************************************************************************/ +/* Changes the combination number of one of the slots */ +/*****************************************************************************/ +static void changeCombination(LargeSet Conditions, uint16 number) { + struct Image display; + uint16 counter, combnum; + bool unlocked = true; + + if (combination[number] < 9) + (combination[number])++; + else + combination[number] = 0; + + combnum = combination[number]; + + display.ImageData = getVGABaseAddr(); + display.Width = VGAScreenWidth; + display.Height = VGAScreenHeight; + + /* NYI: + readPict("Music:Thunk", true); + */ + + for (counter = 1; counter <= (Images[combnum]->Height / 2); counter++) { + if (IsHiRes) { + if (counter & 1) + waitTOF(); + } else + waitTOF(); + +#if !defined(DOSCODE) + display.ImageData = getVGABaseAddr(); +#endif + + scrollDisplayY(2, VGAScaleX(combx[number]), VGAScaleY(65), VGAScaleX(combx[number]) + (Images[combnum])->Width - 1, VGAScaleY(65) + (Images[combnum])->Height); + + bltBitMap(Images[combnum], 0, (Images[combnum])->Height - (2 * counter), &(display), VGAScaleX(combx[number]), VGAScaleY(65), (Images[combnum])->Width, 2); + } + + /* + if (memcmp(combination, solution, (size_t) 12) == 0) + inclElement(Conditions, COMBINATIONUNLOCKED); + else + exclElement(Conditions, COMBINATIONUNLOCKED); + */ + + for (counter = 0; counter < 6; counter++) + unlocked = (combination[counter] == solution[counter]) && unlocked; + + if (unlocked) + inclElement(Conditions, COMBINATIONUNLOCKED); + else + exclElement(Conditions, COMBINATIONUNLOCKED); + +#if !defined(DOSCODE) + ungetVGABaseAddr(); +#endif +} + + + + + +/*****************************************************************************/ +/* Processes mouse clicks and changes the combination. */ +/*****************************************************************************/ +void mouseCombination(LargeSet Conditions, uint16 x, uint16 y) { + uint16 number; + + x = VGAUnScaleX(x); + y = VGAUnScaleY(y); + + if ((y >= 63) && (y <= 99)) { + if ((x >= 44) && (x < 83)) + number = 0; + else if (x < 127) + number = 1; + else if (x < 165) + number = 2; + else if (x < 210) + number = 3; + else if (x < 245) + number = 4; + else if (x < 286) + number = 5; + else + return; + + changeCombination(Conditions, number); + } +} + + + +/*----------------------------------------------------------------------------*/ +/*----------------------------- Tile Puzzle Rules ----------------------------*/ +/*----------------------------------------------------------------------------*/ + + + + +struct Image *Tiles[16]; +int16 CurTile[4] [4] = { + { 1, 5, 9, 13 }, + { 2, 6, 10, 14 }, + { 3, 7, 11, 15 }, + { 4, 8, 12, 0 } +}, TileSolution[4] [4] = { + { 7, 1, 8, 3 }, + { 2, 11, 15, 4 }, + { 9, 5, 14, 6 }, + { 10, 13, 12, 0} +}; + + +/*****************************************************************************/ +/* Draws the images of the combination lock to the display bitmap. */ +/*****************************************************************************/ +static void doTile(bool showsolution) { + uint16 row = 0, col = 0, rowm, colm, num; + int16 rows, cols; + + if (showsolution) { + rowm = VGAScaleY(23); + colm = VGAScaleX(27); + + rows = VGAScaleY(31); + cols = VGAScaleX(105); + } else { + setAPen(0); + rectFill(VGAScaleX(97), VGAScaleY(22), VGAScaleX(220), VGAScaleY(126)); + + rowm = VGAScaleY(25); + colm = VGAScaleX(30); + + rows = VGAScaleY(25); + cols = VGAScaleX(100); + } + + while (row < 4) { + while (col < 4) { + if (showsolution) + num = TileSolution[col] [row]; + else + num = CurTile[col] [row]; + + if (showsolution || num) + drawImage(Tiles[num], cols + (col * colm), rows + (row * rowm)); + + col++; + } + + row++; + col = 0; + } +} + + + + +/*****************************************************************************/ +/* Reads in a backdrop picture. */ +/*****************************************************************************/ +void showTile(const char *filename, bool showsolution) { + uint16 CurBit, start; + byte **buffer; + + resetBuffer(); + DoBlack = true; + nopalchange = true; + readPict(filename, true); + nopalchange = false; + blackScreen(); + + if (showsolution) { + start = 0; + buffer = g_music->newOpen("P:TileSolution"); + } else { + start = 1; + buffer = g_music->newOpen("P:Tile"); + } + + if (!buffer) + return; + + for (CurBit = start; CurBit < 16; CurBit++) + readImage(buffer, &(Tiles[CurBit])); + + allocFile((void **)&TempScrollData, Tiles[1]->Width * Tiles[1]->Height * 2L, "tempdata"); + + doTile(showsolution); + + VGASetPal(diffcmap, 256); +} + + + +#define LEFTSCROLL 1 +#define RIGHTSCROLL 2 +#define UPSCROLL 3 +#define DOWNSCROLL 4 + + + + +static void scrollRaster(int16 dx, int16 dy, uint16 x1, uint16 y1, uint16 x2, uint16 y2) { + if (dx) + scrollDisplayX(dx, x1, y1, x2, y2); + + if (dy) + scrollDisplayY(dy, x1, y1, x2, y2); +} + + + + +/*****************************************************************************/ +/* Does the scrolling for the tiles on the tile puzzle. */ +/*****************************************************************************/ +static void doTileScroll(uint16 col, uint16 row, uint16 scrolltype) { + int16 dX = 0, dY = 0, dx = 0, dy = 0, sx = 0, sy = 0; + uint16 last = 0, x1, y1; + uint16 counter; + + if (scrolltype == LEFTSCROLL) { + dX = VGAScaleXs(5); + sx = VGAScaleXs(5); + last = 6; + } else if (scrolltype == RIGHTSCROLL) { + dX = VGAScaleXs(-5); + dx = VGAScaleXs(-5); + sx = VGAScaleX(5); + last = 6; + } else if (scrolltype == UPSCROLL) { + dY = VGAScaleYs(5); + sy = VGAScaleYs(5); + last = 5; + } else if (scrolltype == DOWNSCROLL) { + dY = VGAScaleYs(-5); + dy = VGAScaleYs(-5); + sy = VGAScaleYs(5); + last = 5; + } + + sx += SVGACord(2); + + x1 = VGAScaleX(100) + (col * VGAScaleX(30)) + dx; + y1 = VGAScaleY(25) + (row * VGAScaleY(25)) + dy; + + for (counter = 0; counter < last; counter++) { + waitTOF(); + scrollRaster(dX, dY, x1, y1, x1 + VGAScaleX(28) + sx, y1 + VGAScaleY(23) + sy); + x1 += dX; + y1 += dY; + } +} + + + +/*****************************************************************************/ +/* Changes the combination number of one of the slots */ +/*****************************************************************************/ +static void changeTile(LargeSet Conditions, uint16 col, uint16 row) { + bool check; + int16 scrolltype = -1; + + if (row > 0) { + if (CurTile[col] [row - 1] == 0) { + CurTile[col] [row - 1] = CurTile[col] [row]; + CurTile[col] [row] = 0; + scrolltype = DOWNSCROLL; + } + } + + if (col > 0) { + if (CurTile[col - 1] [row] == 0) { + CurTile[col - 1] [row] = CurTile[col] [row]; + CurTile[col] [row] = 0; + scrolltype = RIGHTSCROLL; + } + } + + if (row < 3) { + if (CurTile[col] [row + 1] == 0) { + CurTile[col] [row + 1] = CurTile[col] [row]; + CurTile[col] [row] = 0; + scrolltype = UPSCROLL; + } + } + + if (col < 3) { + if (CurTile[col + 1] [row] == 0) { + CurTile[col + 1] [row] = CurTile[col] [row]; + CurTile[col] [row] = 0; + scrolltype = LEFTSCROLL; + } + } + + if (scrolltype != -1) { + /* NYI: + readPict("Music:Click", true); + */ + doTileScroll(col, row, scrolltype); + +#if defined(LABDEMO) + return; +#endif + +#if defined(GAME_TRIAL) + + if (!g_IsRegistered) + return; + +#endif + + check = true; + row = 0; + col = 0; + + while (row < 4) { + while (col < 4) { + check = check && (CurTile[row] [col] == TileSolution[row] [col]); + col++; + } + + row++; + col = 0; + } + + if (check) { + inclElement(Conditions, BRICKOPEN); /* unlocked combination */ + DoBlack = true; + check = readPict("p:Up/BDOpen", true); + } + } +} + + + + + +/*****************************************************************************/ +/* Processes mouse clicks and changes the combination. */ +/*****************************************************************************/ +void mouseTile(LargeSet Conditions, uint16 x, uint16 y) { + x = VGAUnScaleX(x); + y = VGAUnScaleY(y); + + if ((x < 101) || (y < 26)) + return; + + x = (x - 101) / 30; + y = (y - 26) / 25; + + if ((x < 4) && (y < 4)) + changeTile(Conditions, x, y); +} + + +/*---------------------------------------------------------------------------*/ +/*------------------------ Does the detective notes. ------------------------*/ +/*---------------------------------------------------------------------------*/ + +extern struct TextFont *MsgFont; +static struct TextFont *BigMsgFont; +static struct TextFont bmfont; + + +/*****************************************************************************/ +/* Does the things to properly set up the detective notes. */ +/*****************************************************************************/ +void doNotes(void) { + char *ntext; + + /* Load in the data */ + BigMsgFont = &bmfont; + + if (!getFont("P:Note.fon", BigMsgFont)) { + BigMsgFont = NULL; + return; + } + + if ((ntext = getText("Lab:Rooms/Notes")) == NULL) + return; + + flowText(BigMsgFont, -2 + SVGACord(1), 0, 0, false, false, true, true, VGAScaleX(25) + SVGACord(15), VGAScaleY(50), VGAScaleX(295) - SVGACord(15), VGAScaleY(148), ntext); + + VGASetPal(diffcmap, 256); + freeAllStolenMem(); +} + + + + +/*---------------------------------------------------------------------------*/ +/*---------------------- Does the Old West newspaper. ----------------------*/ +/*---------------------------------------------------------------------------*/ + + + +/*****************************************************************************/ +/* Does the things to properly set up the old west newspaper. Assumes that */ +/* OpenHiRes already called. */ +/*****************************************************************************/ +void doWestPaper(void) { + char *ntext; + int32 FileLen, CharsPrinted; + uint16 y = 268; + + BigMsgFont = &bmfont; + + if (!getFont("P:News22.fon", BigMsgFont)) { + BigMsgFont = NULL; + return; + } + + if ((ntext = getText("Lab:Rooms/Date")) == NULL) + return; + + flowText(BigMsgFont, 0, 0, 0, false, true, false, true, VGAScaleX(57), VGAScaleY(77) + SVGACord(2), VGAScaleX(262), VGAScaleY(91), ntext); + + BigMsgFont = &bmfont; + + if (!getFont("P:News32.fon", BigMsgFont)) { + BigMsgFont = NULL; + return; + } + + if ((ntext = getText("Lab:Rooms/Headline")) == NULL) + return; + + FileLen = strlen(ntext) - 1; + CharsPrinted = flowText(BigMsgFont, -8, 0, 0, false, true, false, true, VGAScaleX(57), VGAScaleY(86) - SVGACord(2), VGAScaleX(262), VGAScaleY(118), ntext); + + if (CharsPrinted < FileLen) { + y = 130 - SVGACord(5); + flowText(BigMsgFont, -8 - SVGACord(1), 0, 0, false, true, false, true, VGAScaleX(57), VGAScaleY(86) - SVGACord(2), VGAScaleX(262), VGAScaleY(132), ntext); + } else + y = 115 - SVGACord(5); + + BigMsgFont = &bmfont; + + if (!getFont("P:Note.fon", BigMsgFont)) { + BigMsgFont = NULL; + return; + } + + if ((ntext = getText("Lab:Rooms/Col1")) == NULL) + return; + + CharsPrinted = flowText(BigMsgFont, -4, 0, 0, false, false, false, true, VGAScaleX(45), VGAScaleY(y), VGAScaleX(158), VGAScaleY(148), ntext); + + if ((ntext = getText("Lab:Rooms/Col2")) == NULL) + return; + + CharsPrinted = flowText(BigMsgFont, -4, 0, 0, false, false, false, true, VGAScaleX(162), VGAScaleY(y), VGAScaleX(275), VGAScaleY(148), ntext); + + VGASetPal(diffcmap, 256); + freeAllStolenMem(); +} + + + + +/*---------------------------------------------------------------------------*/ +/*---------------------------- The Journal stuff ----------------------------*/ +/*---------------------------------------------------------------------------*/ + + +#define BRIDGE0 148 +#define BRIDGE1 104 +#define DIRTY 175 +#define NONEWS 135 +#define NOCLEAN 152 + + +static char *journaltext, *journaltexttitle; +static uint16 JPage = 0; + +static bool lastpage = false; + +static struct Image *JCancel, *JCancelAlt, *JLeft, *JLeftAlt, *JRight, *JRightAlt, JBackImage, ScreenImage; + +static uint16 JGadX[3] = {80, 144, 194}, JGadY[3] = {162, 164, 162}; +static struct Gadget ForwardG, CancelG, BackG; + + + + +/*****************************************************************************/ +/* Loads in the data for the journal. */ +/*****************************************************************************/ +static bool loadJournalData(LargeSet Conditions) { + byte **buffer; + char filename[20]; + struct Gadget *TopGadget = &BackG; + uint16 counter; + bool bridge, dirty, news, clean; + + BigMsgFont = &bmfont; + + if (!getFont("P:Journal.fon", BigMsgFont)) { + BigMsgFont = NULL; + return false; + } + + g_music->checkMusic(); + + strcpy(filename, "Lab:Rooms/j0"); + bridge = In(Conditions, BRIDGE0) || In(Conditions, BRIDGE1); + dirty = In(Conditions, DIRTY); + news = !In(Conditions, NONEWS); + clean = !In(Conditions, NOCLEAN); + + if (bridge && clean && news) + filename[11] = '8'; + else if (clean && news) + filename[11] = '9'; + else if (bridge && clean) + filename[11] = '6'; + else if (clean) + filename[11] = '7'; + else if (bridge && dirty && news) + filename[11] = '4'; + else if (dirty && news) + filename[11] = '5'; + else if (bridge && dirty) + filename[11] = '2'; + else if (dirty) + filename[11] = '3'; + else if (bridge) + filename[11] = '1'; + + if ((journaltext = getText(filename)) == NULL) + return false; + + if ((journaltexttitle = getText("Lab:Rooms/jt")) == NULL) + return false; + + buffer = g_music->newOpen("P:JImage"); + + if (!buffer) + return false; + + readImage(buffer, &JLeft); + readImage(buffer, &JLeftAlt); + readImage(buffer, &JRight); + readImage(buffer, &JRightAlt); + readImage(buffer, &JCancel); + readImage(buffer, &JCancelAlt); + + BackG.Im = JLeft; + BackG.ImAlt = JLeftAlt; +#if !defined(DOSCODE) + BackG.KeyEquiv = VKEY_LTARROW; +#endif + ForwardG.Im = JRight; + ForwardG.ImAlt = JRightAlt; +#if !defined(DOSCODE) + ForwardG.KeyEquiv = VKEY_RTARROW; +#endif + CancelG.Im = JCancel; + CancelG.ImAlt = JCancelAlt; + + counter = 0; + + while (TopGadget) { + TopGadget->x = VGAScaleX(JGadX[counter]); + + if (counter == 1) + TopGadget->y = VGAScaleY(JGadY[counter]) + SVGACord(1); + else + TopGadget->y = VGAScaleY(JGadY[counter]) - SVGACord(1); + + TopGadget->GadgetID = counter; + TopGadget = TopGadget->NextGadget; + counter++; + } + + return true; +} + + + +/*****************************************************************************/ +/* Draws the text to the back journal screen to the appropriate Page number */ +/*****************************************************************************/ +static void drawJournalText(void) { + uint16 DrawingToPage = 1; + int32 CharsDrawn = 0L; + char *CurText = journaltext; + + while (DrawingToPage < JPage) { + g_music->newCheckMusic(); + CurText = (char *)(journaltext + CharsDrawn); + CharsDrawn += flowText(BigMsgFont, -2, 2, 0, false, false, false, false, VGAScaleX(52), VGAScaleY(32), VGAScaleX(152), VGAScaleY(148), CurText); + + lastpage = (*CurText == 0); + + if (lastpage) + JPage = (DrawingToPage / 2) * 2; + else + DrawingToPage++; + } + + if (JPage <= 1) { + CurText = journaltexttitle; + flowTextToMem(&JBackImage, BigMsgFont, -2, 2, 0, false, true, true, true, VGAScaleX(52), VGAScaleY(32), VGAScaleX(152), VGAScaleY(148), CurText); + } else { + CurText = (char *)(journaltext + CharsDrawn); + CharsDrawn += flowTextToMem(&JBackImage, BigMsgFont, -2, 2, 0, false, false, false, true, VGAScaleX(52), VGAScaleY(32), VGAScaleX(152), VGAScaleY(148), CurText); + } + + g_music->checkMusic(); + CurText = (char *)(journaltext + CharsDrawn); + lastpage = (*CurText == 0); + flowTextToMem(&JBackImage, BigMsgFont, -2, 2, 0, false, false, false, true, VGAScaleX(171), VGAScaleY(32), VGAScaleX(271), VGAScaleY(148), CurText); + + CurText = (char *)(journaltext + CharsDrawn); + lastpage = lastpage || (*CurText == 0); +} + + + + +/*****************************************************************************/ +/* Does the turn page wipe. */ +/*****************************************************************************/ +static void turnPage(bool FromLeft) { + uint16 counter; + + if (FromLeft) { + for (counter = 0; counter < VGAScreenWidth; counter += 8) { + g_music->updateMusic(); + waitTOF(); +#if !defined(DOSCODE) + ScreenImage.ImageData = getVGABaseAddr(); +#endif + bltBitMap(&JBackImage, counter, 0, &ScreenImage, counter, 0, 8, VGAScreenHeight); + } + } else { + for (counter = (VGAScreenWidth - 8); counter > 0; counter -= 8) { + g_music->updateMusic(); + waitTOF(); +#if !defined(DOSCODE) + ScreenImage.ImageData = getVGABaseAddr(); +#endif + bltBitMap(&JBackImage, counter, 0, &ScreenImage, counter, 0, 8, VGAScreenHeight); + } + } +} + + + +static bool GotBackImage = false; + +/*****************************************************************************/ +/* Draws the journal from page x. */ +/*****************************************************************************/ +static void drawJournal(uint16 wipenum, bool needFade) { + mouseHide(); + + g_music->checkMusic(); + + if (!GotBackImage) + JBackImage.ImageData = loadBackPict("P:Journal.pic", true); + + drawJournalText(); + +#if !defined(DOSCODE) + ScreenImage.ImageData = getVGABaseAddr(); +#endif + + if (wipenum == 0) + bltBitMap(&JBackImage, 0, 0, &ScreenImage, 0, 0, VGAScreenWidth, VGAScreenHeight); + else + turnPage((bool)(wipenum == 1)); + + if (JPage == 0) + ghoastGadget(&BackG, 15); + else + unGhoastGadget(&BackG); + + if (lastpage) + ghoastGadget(&ForwardG, 15); + else + unGhoastGadget(&ForwardG); + +#if !defined(DOSCODE) + ungetVGABaseAddr(); +#endif + + + if (needFade) + fade(true, 0); + + nopalchange = true; + JBackImage.ImageData = readPictToMem("P:Journal.pic", VGAScreenWidth, VGAScreenHeight); + GotBackImage = true; + + eatMessages(); + mouseShow(); + + nopalchange = false; +} + + + + +/*****************************************************************************/ +/* Processes user input. */ +/*****************************************************************************/ +static void processJournal() { + struct IntuiMessage *Msg; + uint32 Class; + uint16 Qualifier, GadID; + + while (1) { + g_music->checkMusic(); /* Make sure we check the music at least after every message */ + Msg = (struct IntuiMessage *) getMsg(); + + if (Msg == NULL) { + g_music->newCheckMusic(); + } else { + Class = Msg->Class; + Qualifier = Msg->Qualifier; + GadID = Msg->Code; + + replyMsg((void *) Msg); + + if (((Class == MOUSEBUTTONS) && (IEQUALIFIER_RBUTTON & Qualifier)) || + ((Class == RAWKEY) && (GadID == 27))) + return; + + else if (Class == GADGETUP) { + if (GadID == 0) { + if (JPage >= 2) { + JPage -= 2; + drawJournal(1, false); + } + } else if (GadID == 1) { + return; + } else if (GadID == 2) { + if (!lastpage) { + JPage += 2; + drawJournal(2, false); + } + } + } + } + } +} + + + +/*****************************************************************************/ +/* Cleans up behind all memory allocations. */ +/*****************************************************************************/ +static void journalCleanUp(void) { + freeAllStolenMem(); +} + + + + + +/*****************************************************************************/ +/* Does the journal processing. */ +/*****************************************************************************/ +void doJournal(LargeSet Conditions) { + resetBuffer(); + blackAllScreen(); + + lastpage = false; + GotBackImage = false; + + JBackImage.Width = VGAScreenWidth; + JBackImage.Height = VGAScreenHeight; + JBackImage.ImageData = NULL; + + BackG.NextGadget = &CancelG; + CancelG.NextGadget = &ForwardG; + + ScreenImage = JBackImage; + ScreenImage.ImageData = getVGABaseAddr(); + + g_music->checkMusic(); + loadJournalData(Conditions); + + drawJournal(0, true); + + attachGadgetList(&BackG); + mouseShow(); + processJournal(); + attachGadgetList(NULL); + fade(false, 0); + mouseHide(); + +#if !defined(DOSCODE) + ScreenImage.ImageData = getVGABaseAddr(); +#endif + + setAPen(0); + rectFill(0, 0, VGAScreenWidth - 1, VGAScreenHeight - 1); + blackScreen(); + + journalCleanUp(); + +#if !defined(DOSCODE) + ungetVGABaseAddr(); +#endif +} + + + +/*---------------------------------------------------------------------------*/ +/*------------------------- The Save/Restore stuff --------------------------*/ +/*---------------------------------------------------------------------------*/ + + +struct Image *Arrow1, *NoArrow1, *DriveButton; + + +extern InventoryData *Inventory; +extern uint16 RoomNum, Direction; +extern LargeSet Conditions, RoomsFound; + + + +extern char *SAVETEXT, *LOADTEXT, *BOOKMARKTEXT, *PERSONALTEXT, *DISKTEXT, *SAVEBOOK, *RESTOREBOOK, *SAVEFLASH, *RESTOREFLASH, *SAVEDISK, *RESTOREDISK, *SELECTDISK, *NODISKINDRIVE, *WRITEPROTECTED, *FORMATFLOPPY, *FORMATTING; + +static uint16 device; + +#define MAXDEVNAMES 5 + +static char DriveName[5] [MAXDEVNAMES]; + + + + + + +/*----- Gets the devices -----*/ + +/*****************************************************************************/ +/* Finds all the disk drives, puts them in an array of strings, sorts them, */ +/* and returned the number of drives that it found. */ +/*****************************************************************************/ +uint16 doDisks(void) { +#if defined(DOSCODE) + uint16 many = 0, counter = 2; + union REGS regs; + char str[5]; + + if (manydisks) + return manydisks; + + while ((counter < 7) && (many < MAXDEVNAMES)) { + memset(®s, 0, sizeof(regs)); + /* + regs.h.ah = 0x32; + regs.h.dl = counter+1; + int386(0x21, ®s, ®s); + if (regs.h.al == 0) + { + */ + regs.h.ah = 0x36; + regs.h.dl = counter + 1; + int386(0x21, ®s, ®s); + + if (regs.w.ax != 0xFFFF) { + str[0] = counter + 'A'; + str[1] = ':'; + str[2] = '\\'; + str[3] = 0; + strcpy(DriveName[many], str); + many++; + } + + counter++; + } + + return many; +#elif defined(WIN32) + extern void winGetDriveLetters(char cdLetters[], int size); + char letters[28]; + char str[5]; + uint16 many = 0, counter = 2; + + if (manydisks) + return manydisks; + + winGetDriveLetters(letters, 28); + + while ((counter < 7) && (many < MAXDEVNAMES) && letters[many] != 0) { + str[0] = letters[many]; + str[1] = ':'; + str[2] = '\\'; + str[3] = 0; + strcpy(DriveName[many], str); + many++; + counter++; + } + + return many; +#else + // !!!!goofy test code + char str[5]; + str[0] = 'C'; + str[1] = ':'; + str[2] = '\\'; + str[3] = 0; + strcpy(DriveName[0], str); + return 1; +#endif +} + + + + + +/*****************************************************************************/ +/* Does the user interface to save or restore a game position */ +/*****************************************************************************/ +#if defined(MODERNGAMESAVE) + +extern const byte ThePalMap[]; + +void getRoomMessage(int MyRoomNum, int MyDirection, char *msg); + +#define QUARTERNUM 30 + +#define NEXTEMPTYSLOTTEXT "Next Empty Slot" + +extern char g_SaveGamePath[512]; +extern char g_PathSeperator[4]; + +struct SaveGameInfo g_SaveGameInfo[MAX_SAVED_GAMES]; +int g_TotalSavedGames; +char g_CommonPalette[3 * 256]; +int g_LastSaveGameNumber = 0; +int g_CurSaveGameNumber = 0; +int g_CurSaveSet = 0; +int g_PendingNewSave = 0; + +enum UI_Ident { + ID_SAVE, ID_LOAD, ID_NEWSLOT, ID_1_TO_5, ID_6_TO_10, ID_11_TO_15, ID_SLOT_A, ID_SLOT_B, ID_SLOT_C, ID_SLOT_D, ID_SLOT_E, ID_CANCEL, ID_LAST +}; + +struct ModernUI { + int id; + int x, y, w, h; +}; + +struct ModernUI theUI[ID_LAST] = { + { ID_LOAD, 491, 182, 128, 54 }, { ID_SAVE, 491, 255, 128, 54 }, { ID_NEWSLOT, 491, 328, 128, 54 }, { ID_1_TO_5, 27, 40, 146, 25 }, { ID_6_TO_10, 175, 40, 146, 25 }, { ID_11_TO_15, 323, 40, 146, 25 }, { ID_SLOT_A, 27, 67, 442, 72 }, { ID_SLOT_B, 27, 142, 442, 72 }, { ID_SLOT_C, 27, 217, 442, 72 }, { ID_SLOT_D, 27, 292, 442, 72 }, { ID_SLOT_E, 27, 367, 442, 72 }, { ID_CANCEL, 531, 405, 52, 52 } +}; + +enum { + SG_BLACK = 1, SG_TAN = 14, SG_DKTAN = 38, SG_WHITE = 105, SG_YELLOW = 118 +}; + +/*****************************************************************************/ +/* Draw display */ +/*****************************************************************************/ +static void flowTextBold(void *font, /* the TextAttr pointer */ + uint16 spacing, /* How much vertical spacing between the lines */ + uint16 pencolor, /* pen number to use for text */ + uint16 backpen, /* the background color */ + bool outline, /* Whether to outline in background color */ + bool centerh, /* Whether to center the text horizontally */ + bool centerv, /* Whether to center the text vertically */ + bool output, /* Whether to output any text */ + uint16 x1, /* Cords */ + uint16 y1, uint16 x2, uint16 y2, const char *text) { /* The text itself */ + + if (outline) { + flowText(font, spacing, backpen, 0, false, centerh, centerv, output, x1 - 1, y1, x2 - 1, y2, text); + flowText(font, spacing, backpen, 0, false, centerh, centerv, output, x1 - 1, y1 - 1, x2 - 1, y2 - 1, text); + flowText(font, spacing, backpen, 0, false, centerh, centerv, output, x1, y1 + 2, x2, y2 + 2, text); + flowText(font, spacing, backpen, 0, false, centerh, centerv, output, x1 - 1, y1 + 2, x2 - 1, y2 + 2, text); + flowText(font, spacing, backpen, 0, false, centerh, centerv, output, x1 + 2, y1, x2 + 2, y2, text); + flowText(font, spacing, backpen, 0, false, centerh, centerv, output, x1 + 2, y1 + 2, x2 + 2, y2 + 2, text); + flowText(font, spacing, backpen, 0, false, centerh, centerv, output, x1, y1 - 1, x2, y2 - 1, text); + flowText(font, spacing, backpen, 0, false, centerh, centerv, output, x1 + 2, y1 - 1, x2 + 2, y2 - 1, text); + } + + flowText(font, spacing, pencolor, 0, false, centerh, centerv, output, x1, y1, x2, y2, text); + flowText(font, spacing, pencolor, 0, false, centerh, centerv, output, x1 + 1, y1, x2 + 1, y2, text); + flowText(font, spacing, pencolor, 0, false, centerh, centerv, output, x1, y1 + 1, x2, y2 + 1, text); + flowText(font, spacing, pencolor, 0, false, centerh, centerv, output, x1 + 1, y1 + 1, x2 + 1, y2 + 1, text); +} + +/*****************************************************************************/ +/* Draw display */ +/*****************************************************************************/ +static void flowTextShadow(void *font, /* the TextAttr pointer */ + uint16 spacing, /* How much vertical spacing between the lines */ + uint16 pencolor, /* pen number to use for text */ + uint16 backpen, /* the background color */ + bool outline, /* Whether to outline in background color */ + bool centerh, /* Whether to center the text horizontally */ + bool centerv, /* Whether to center the text vertically */ + bool output, /* Whether to output any text */ + uint16 x1, /* Cords */ + uint16 y1, uint16 x2, uint16 y2, char *text) { /* The text itself */ + + if (outline) { + flowText(font, spacing, backpen, 0, false, centerh, centerv, output, x1 - 1, y1 - 1, x2 - 1, y2 - 1, text); + flowText(font, spacing, backpen, 0, false, centerh, centerv, output, x1 - 1, y1 + 1, x2 - 1, y2 + 1, text); + flowText(font, spacing, backpen, 0, false, centerh, centerv, output, x1 + 1, y1 + 1, x2 + 1, y2 + 1, text); + flowText(font, spacing, backpen, 0, false, centerh, centerv, output, x1 + 1, y1 - 1, x2 + 1, y2 - 1, text); + } + + flowText(font, spacing, pencolor, 0, false, centerh, centerv, output, x1, y1, x2, y2, text); +} + +static void drawSaveLoad() { + int i, j; + + flowTextBold(MsgFont, 0, g_CurSaveGameNumber < g_TotalSavedGames ? SG_YELLOW : SG_DKTAN, SG_BLACK, true, true, true, true, 491 + 3, 182, 619 + 3, 236, LOADTEXT); + flowTextBold(MsgFont, 0, g_TotalSavedGames + g_PendingNewSave > 0 ? SG_YELLOW : SG_DKTAN, SG_BLACK, true, true, true, true, 491 + 3, 255, 619 + 3, 309, SAVETEXT); + flowTextBold(MsgFont, 0, g_PendingNewSave ? SG_DKTAN : SG_YELLOW, SG_BLACK, true, true, true, true, 491 + 3, 328, 619 + 3, 382, NEXTEMPTYSLOTTEXT); + + flowTextBold(MsgFont, 0, (g_CurSaveSet == 0 ? SG_YELLOW : SG_WHITE), SG_BLACK, true, true, true, true, 27 + 3, 40, 175 + 3, 65, "Saves 1-5"); + flowTextBold(MsgFont, 0, (g_CurSaveSet == 1 ? SG_YELLOW : SG_WHITE), SG_BLACK, true, true, true, true, 175 + 3, 40, 321 + 3, 65, "Saves 6-10"); + flowTextBold(MsgFont, 0, (g_CurSaveSet == 2 ? SG_YELLOW : SG_WHITE), SG_BLACK, true, true, true, true, 323 + 3, 40, 469 + 3, 65, "Saves 11-15"); + + for (i = 0, j = 5 * g_CurSaveSet; i < 5; i++, j++) { + uint16 hue, y; + char num_text[4]; + struct Image thumbnail, screen; + + if (j < g_TotalSavedGames + g_PendingNewSave) { + char msg[256]; + + getRoomMessage(g_SaveGameInfo[j].RoomNumber, g_SaveGameInfo[j].Direction, msg); + + hue = (j == g_CurSaveGameNumber ? SG_YELLOW : SG_WHITE); + y = 67 + 2 + i * 75; + flowText(MsgFont, 0, hue, 0, false, false, false, true, 202 + 2, y, 469 - 2, y + 48, msg); + y += 46; + flowText(MsgFont, 0, hue, 0, false, false, false, true, 202 + 2, y, 469 - 2, y + 24, g_SaveGameInfo[j].SaveGameDate); + + // blast image + thumbnail.Width = 128; + thumbnail.Height = 72; + thumbnail.ImageData = g_SaveGameInfo[j].SaveGameImage; + screen.Width = 640; + screen.Height = 480; + screen.ImageData = getVGABaseAddr(); + bltBitMap(&thumbnail, 0, 0, &screen, 72, 67 + i * 75, 128, 72); + ungetVGABaseAddr(); + + hue = (j == g_CurSaveGameNumber ? SG_YELLOW : SG_WHITE); + } else { + y = 67 + 2 + i * 75; + flowText(MsgFont, 0, SG_TAN, 0, false, true, true, true, 202 + 2, y, 469 - 2, y + 70, "[Empty Slot]"); + + hue = SG_DKTAN; + } + + y = 67 + i * 75; + sprintf(num_text, "%d", j + 1); + flowTextShadow(BigMsgFont, 0, hue, SG_BLACK, true, true, true, true, 27 + 4, y, 72 + 4, y + 72, num_text); + } + + // Add ".1" to version number + setAPen(SG_WHITE); + rectFill(271, 454, 271, 454); + rectFill(275, 449, 275, 454); + rectFill(274, 450, 274, 450); + rectFill(274, 454, 276, 454); + + g_system->updateScreen(); +} + +static void makeThumbnail(struct SaveGameInfo *info) { + char *pictName; + CloseDataPtr CPtr = NULL; + byte *BitMapMem; + int x, y, u, v; + + // load pict + pictName = getPictName(&CPtr); + nopalchange = true; + BitMapMem = readPictToMem(pictName, VGAScreenWidth, VGAScreenHeight); + nopalchange = false; + + for (y = 0; y < 72; y++) { + for (x = 0; x < 128; x++) { + unsigned int r = 0, g = 0, b = 0; + + for (v = 5 * y; v < 5 * y + 5; v++) { + for (u = 5 * x; u < 5 * x + 5; u++) { + byte n = (byte)BitMapMem[u + v * VGAScreenWidth]; + // 6-bit color (VGA) + r += (unsigned int)diffcmap[3 * n + 0]; + g += (unsigned int)diffcmap[3 * n + 1]; + b += (unsigned int)diffcmap[3 * n + 2]; + } + } + + r = (r / 25) >> 1; + g = (g / 25) >> 1; + b = (b / 25) >> 1; + warning("STUB: makeThumbnail"); + info->SaveGameImage[x + 128 * y] = ThePalMap[(r << 10) | (g << 5) | b]; + } + } +} + +static void addSaveSlot() { + struct SaveGameInfo *info; + + if (g_PendingNewSave || g_TotalSavedGames == MAX_SAVED_GAMES) + return; + + g_PendingNewSave = 1; + g_CurSaveGameNumber = g_TotalSavedGames; + g_CurSaveSet = g_CurSaveGameNumber / 5; + + // set-up saved game + info = &g_SaveGameInfo[g_CurSaveGameNumber]; + info->RoomNumber = RoomNum; + info->Direction = Direction; + + // not really a date yet + strcpy(info->SaveGameDate, "Click SAVE GAME to Confirm"); + + info->SaveGameImage = (byte *)malloc(SAVED_IMAGE_SIZE); + makeThumbnail(info); + + mouseHide(); + warning("STUB: addSaveSlot()"); + //SDL_IgnoreUpdateDisplay(1); + loadBackPict("P:ModSave", false); + //SDL_IgnoreUpdateDisplay(0); + drawSaveLoad(); + mouseShow(); +} + +static void selectSave(int n) { + if (g_CurSaveGameNumber == n || n >= g_TotalSavedGames + g_PendingNewSave) + return; + + g_CurSaveGameNumber = n; + + mouseHide(); + warning("STUB: selectSave()"); + //SDL_IgnoreUpdateDisplay(1); + loadBackPict("P:ModSave", false); + //SDL_IgnoreUpdateDisplay(0); + drawSaveLoad(); + mouseShow(); +} + +static void selectSaveSet(int n) { + if (g_CurSaveSet != n) { + g_CurSaveSet = n; + + mouseHide(); + warning("STUB: selectSaveSet"); + //SDL_IgnoreUpdateDisplay(1); + loadBackPict("P:ModSave", false); + //SDL_IgnoreUpdateDisplay(0); + drawSaveLoad(); + mouseShow(); + } +} + +/*****************************************************************************/ +/* Do modern save. */ +/*****************************************************************************/ +static bool doSaveGame() { + bool isok; + char DrivePath[260]; + + if (g_CurSaveGameNumber != g_TotalSavedGames) { + makeThumbnail(&g_SaveGameInfo[g_CurSaveGameNumber]); + } else { + // set time of save for new saved game + //struct tm *create_date; + //time_t ticks; + + warning("STUB: doSaveGame"); + //ticks = time(NULL); + //create_date = localtime(&ticks); + //strcpy(g_SaveGameInfo[g_CurSaveGameNumber].SaveGameDate, asctime(create_date)); + } + + memcpy(g_SaveGameImage, g_SaveGameInfo[g_CurSaveGameNumber].SaveGameImage, SAVED_IMAGE_SIZE); + + sprintf(DrivePath, "%s%s%d", g_SaveGamePath, g_PathSeperator, g_CurSaveGameNumber); + + isok = saveFloppy(DrivePath, RoomNum, Direction, Inventory[QUARTERNUM].Many, Conditions, RoomsFound, g_CurSaveGameNumber, device); + g_music->resetMusic(); + + if (isok) + g_LastSaveGameNumber = g_CurSaveGameNumber; + + return isok; +} + +/*****************************************************************************/ +/* Do modern load. */ +/*****************************************************************************/ +static bool doLoadGame() { + bool isok; + char drivePath[260]; + + snprintf(drivePath, 260, "%s%s%d", g_SaveGamePath, g_PathSeperator, g_CurSaveGameNumber); + + isok = readFloppy(drivePath, &RoomNum, &Direction, &(Inventory[QUARTERNUM].Many), Conditions, RoomsFound, g_CurSaveGameNumber, device); + g_music->resetMusic(); + + if (isok) + g_LastSaveGameNumber = g_CurSaveGameNumber; + + return isok; +} + +/*****************************************************************************/ +/* Processes user input. */ +/*****************************************************************************/ +static bool processSaveLoad() { + struct IntuiMessage *Msg; + + uint32 Class; + uint16 Qualifier, MouseX, MouseY, Code; + int i; + + drawSaveLoad(); + + while (1) { + g_music->checkMusic(); /* Make sure we check the music at least after every message */ + Msg = getMsg(); + + if (Msg == NULL) { + g_music->newCheckMusic(); + } else { + Class = Msg->Class; + Qualifier = Msg->Qualifier; + MouseX = Msg->MouseX; + MouseY = Msg->MouseY; + Code = Msg->Code; + + replyMsg(Msg); + + if (((Class == MOUSEBUTTONS) && (IEQUALIFIER_RBUTTON & Qualifier)) || + ((Class == RAWKEY) && (Code == 27))) + return -1; + + if (Class == RAWKEY) { + if (Code == 'l' || Code == 'L') { + if (g_CurSaveGameNumber < g_TotalSavedGames) + return doLoadGame(); + } else if (Code == 's' || Code == 'S') { + if (g_TotalSavedGames + g_PendingNewSave > 0) + return doSaveGame(); + } else if (Code == 'n' || Code == 'N') { + addSaveSlot(); + } else if (Code == VKEY_LTARROW) { + i = g_CurSaveSet - 1; + + if (i < 0) i = 2; + + selectSaveSet(i); + } else if (Code == VKEY_RTARROW) { + i = g_CurSaveSet + 1; + + if (i > 2) i = 0; + + selectSaveSet(i); + } else if (Code == VKEY_UPARROW) { + if (g_TotalSavedGames + g_PendingNewSave > 0) { + i = g_CurSaveGameNumber - 1; + + if (i < 0) + i = g_TotalSavedGames + g_PendingNewSave - 1; + + if (i / 5 != g_CurSaveSet) + selectSaveSet(i / 5); + + selectSave(i); + } + } else if (Code == VKEY_DNARROW) { + if (g_TotalSavedGames + g_PendingNewSave > 0) { + i = g_CurSaveGameNumber + 1; + + if (i >= g_TotalSavedGames + g_PendingNewSave) + i = 0; + + if (i / 5 != g_CurSaveSet) + selectSaveSet(i / 5); + + selectSave(i); + } + } + } else if ((Class == MOUSEBUTTONS) && (IEQUALIFIER_LEFTBUTTON & Qualifier)) { + for (i = 0; i < ID_LAST; i++) { + if (MouseX >= theUI[i].x && MouseY >= theUI[i].y && + MouseX < theUI[i].x + theUI[i].w && MouseY < theUI[i].y + theUI[i].h) { + switch (theUI[i].id) { + case ID_SAVE: + if (g_TotalSavedGames + g_PendingNewSave > 0) + return doSaveGame(); + + break; + + case ID_LOAD: + if (g_CurSaveGameNumber < g_TotalSavedGames) + return doLoadGame(); + + break; + + case ID_NEWSLOT: + addSaveSlot(); + break; + + case ID_1_TO_5: + case ID_6_TO_10: + case ID_11_TO_15: + selectSaveSet(theUI[i].id - ID_1_TO_5); + break; + + case ID_SLOT_A: + case ID_SLOT_B: + case ID_SLOT_C: + case ID_SLOT_D: + case ID_SLOT_E: + selectSave(5 * g_CurSaveSet + theUI[i].id - ID_SLOT_A); + break; + + case ID_CANCEL: + return -1; + } + } + } + } + } + } +} + +bool saveRestoreGame(void) { + byte **buffer; + bool isok = true; + + blackAllScreen(); + + BigMsgFont = &bmfont; + + if (!getFont("P:Map.fon", BigMsgFont)) { + BigMsgFont = NULL; + return false; + } + + buffer = g_music->newOpen("P:ModSave"); + + if (!buffer) { + freeAllStolenMem(); + return false; + } + + g_TotalSavedGames = getSaveGameList(g_SaveGameInfo, MAX_SAVED_GAMES); + g_CurSaveGameNumber = g_LastSaveGameNumber; + g_CurSaveSet = g_CurSaveGameNumber / 5; + g_PendingNewSave = 0; + + loadBackPict("P:ModSave", false); + + mouseShow(); + + VGASetPal(diffcmap, 256); + memcpy(g_CommonPalette, diffcmap, 3 * 256); + + isok = processSaveLoad(); + eatMessages(); + + mouseHide(); + memset(diffcmap, 0, 3 * 256); + VGASetPal(diffcmap, 256); + setAPen(0); + rectFill(0, 0, VGAScreenWidth - 1, VGAScreenHeight - 1); + blackScreen(); + g_system->updateScreen(); + + journalCleanUp(); + + freeAllStolenMem(); + + freeSaveGameList(g_SaveGameInfo, g_TotalSavedGames); + + return isok; +} +#else + +static uint16 manydisks = 0; + +static uint16 issave, ghoast, arrow, ManyDrives, DriveInitX, DriveNum = -1, FileNum = -1; + +/*****************************************************************************/ +/* Draws the number arrows. */ +/*****************************************************************************/ +static void doNumArrows(void) { + uint16 counterx, countery, curnum, cordx[3], cordy[3]; + + cordx[0] = VGAScaleX(53) + SVGACord(3); + cordx[1] = VGAScaleX(126) + SVGACord(1); + cordx[2] = VGAScaleX(197) + SVGACord(3); + + cordy[0] = VGAScaleY(58) + SVGACord(2); + cordy[1] = VGAScaleY(86) + SVGACord(3); + cordy[2] = VGAScaleY(114) + SVGACord(3); + + mouseHide(); + + for (countery = 0; countery < 3; countery++) { + for (counterx = 0; counterx < 3; counterx++) { + curnum = countery + counterx * 3; + + if INBIT(arrow, curnum) + drawImage(Arrow1, cordx[counterx], cordy[countery]); + else + drawImage(NoArrow1, cordx[counterx], (int32) cordy[countery]); + + if INBIT(ghoast, curnum) + ghoastRect(0, cordx[counterx], cordy[countery], cordx[counterx] + VGAScaleX(69), cordy[countery] + NoArrow1->Height); + } + } + + mouseShow(); +} + +/*****************************************************************************/ +/* Does the drive buttons for the final save/restore screen. */ +/*****************************************************************************/ +static void doDriveButtons(void) { + uint16 curx, counter; + + if (ManyDrives > 5) + ManyDrives = 5; + + DriveInitX = (VGAScreenWidth / 2) - ((ManyDrives * DriveButton->Width) / 2); + curx = DriveInitX; + + mouseHide(); + + for (counter = 0; counter < ManyDrives; counter++) { + drawImage(DriveButton, curx, VGAScaleY(153)); + + flowText(BigMsgFont, 0, 1, 0, false, true, true, true, curx + VGAScaleX(5), VGAScaleY(158), curx + DriveButton->Width - VGAScaleX(5), VGAScaleY(148) + DriveButton->Height, DriveName[counter]); + + curx += DriveButton->Width; + } + + mouseShow(); +} + + +static void drawSRMessage(char *rtext) { + mouseHide(); + flowText(BigMsgFont, 0, 1, 10, true, true, true, true, VGAScaleX(22), VGAScaleY(21), VGAScaleX(289), VGAScaleY(48), rtext); + mouseShow(); +} + +/*****************************************************************************/ +/* Draws the correct message to the message box. */ +/*****************************************************************************/ +static void doSaveRestoreText(void) { + char *rtext, text[100]; + + if (DriveNum >= ManyDrives) { + rtext = SELECTDISK; + } else if (issave) { + strcpy(text, SAVEDISK); + strcat(text, " "); + strcat(text, DriveName[DriveNum]); + rtext = text; + } else { + strcpy(text, RESTOREDISK); + strcat(text, " "); + strcat(text, DriveName[DriveNum]); + rtext = text; + } + + drawSRMessage(rtext); +} + +static uint16 processSaveRestore(uint16 type); + +static char DrivePath[50]; + +/*****************************************************************************/ +/* Checks for the existence of previous saved game positions on disk. */ +/*****************************************************************************/ +static void floppyCheckFiles(void) { + char temp[7], *name, len; + int fl; + uint16 counter; + + doSaveRestoreText(); + + arrow = 0; + ghoast = 0; + + strcpy(DrivePath, DriveName[DriveNum]); + strcat(DrivePath, "LabSaves"); + + warning("STUB: floppyCheckFiles"); + +#if 0 +#if defined(WIN32) + mkdir(DrivePath); +#else + mkdir(DrivePath, 0x644); +#endif + strcat(DrivePath, "\\"); + + len = strlen(DrivePath); + + for (counter = 0; counter < 9; counter++) { + name = numtostr(temp, counter); + strcat(DrivePath, name); + + if ((fl = open(DrivePath, O_RDONLY)) != -1) { + close(fl); + SETBIT(arrow, counter); + } else + SETBIT(ghoast, counter); + + DrivePath[len] = 0; + } +#endif +} + +/*****************************************************************************/ +/* Checks for the existence of previously saved game positions. */ +/*****************************************************************************/ +static void checkFiles(void) { + ghoast = -1; + arrow = 0; + + g_music->fillUpMusic(true); + + /* NYI: check for empty drive */ + floppyCheckFiles(); + + if (issave) + ghoast = 0; +} + +/*****************************************************************************/ +/* Processes user input. */ +/*****************************************************************************/ +static uint16 processSaveRestore(uint16 type) { + struct IntuiMessage *Msg; + + uint32 Class; + uint16 Qualifier, MouseX, MouseY, Code, Temp; + + while (1) { + g_music->checkMusic(); /* Make sure we check the music at least after every message */ + Msg = getMsg(); + + if (Msg == NULL) { + g_music->newCheckMusic(); + } else { + Class = Msg->Class; + Qualifier = Msg->Qualifier; + MouseX = Msg->MouseX; + MouseY = Msg->MouseY; + Code = Msg->Code; + + replyMsg(Msg); + + if (((Class == MOUSEBUTTONS) && (IEQUALIFIER_RBUTTON & Qualifier)) || + ((Class == RAWKEY) && (Code == 27))) + return -1; + + else if ((Class == MOUSEBUTTONS) && (IEQUALIFIER_LEFTBUTTON & Qualifier)) { + if (type == 0) { /* The save or restore screen */ + if ((MouseX >= VGAScaleX(64)) && (MouseX <= VGAScaleX(257))) { + if ((MouseY >= VGAScaleY(57)) && (MouseY <= VGAScaleY(92))) + return true; + else if ((MouseY >= VGAScaleY(108)) && (MouseY <= VGAScaleY(142))) + return false; + } + } + + else if (type == 2) { /* The files screen */ + if ((MouseY >= VGAScaleY(153)) && (MouseY <= VGAScaleY(180))) { /* the drive buttons */ + Temp = ((MouseX - DriveInitX) / DriveButton->Width); + + if (Temp < ManyDrives) { + DriveNum = Temp; + + fade(false, 0); + checkFiles(); + + loadBackPict("P:Disk/Nums.pic", false); + doNumArrows(); + doDriveButtons(); + doSaveRestoreText(); + + fade(true, 0); + } + } + + else if ((MouseX >= VGAScaleX(53)) && (MouseY >= VGAScaleY(58)) && + (MouseX <= VGAScaleX(266)) && (MouseY <= VGAScaleY(142))) { + MouseX = (MouseX - VGAScaleX(53)) / VGAScaleX(71); + MouseY = (MouseY - VGAScaleY(58)) / VGAScaleY(28); + + Temp = MouseY + (MouseX * 3); + + if (!(INBIT(ghoast, Temp))) { + + SETBIT(arrow, Temp); + doNumArrows(); + + FileNum = Temp; + return FileNum; + } + } + } + } + } + } +} + + + + +/*****************************************************************************/ +/* Sets up the Save or Restore screen. */ +/*****************************************************************************/ +static uint16 saveOrRestore(void) { + uint16 res; + + mouseHide(); + loadBackPict("P:Disk/Choose.pic", false); + + flowText(BigMsgFont, 0, 1, 4, false, true, true, true, VGAScaleX(74), VGAScaleY(65), VGAScaleX(247), VGAScaleY(84), SAVETEXT); + flowText(BigMsgFont, 0, 1, 4, false, true, true, true, VGAScaleX(74), VGAScaleY(116), VGAScaleX(247), VGAScaleY(135), LOADTEXT); + mouseShow(); + + fade(true, 0); + res = processSaveRestore(0); + fade(false, 0); + eatMessages(); + + return res; +} + + + + + +/*****************************************************************************/ +/* Sets up the final save/restore screen. */ +/*****************************************************************************/ +static uint16 saveRestore(void) { + uint16 res; + + loadBackPict("P:Disk/Nums.pic", false); + + if ((DriveNum < ManyDrives)) { + checkFiles(); + } else { + ghoast = -1; + arrow = 0; + } + + doNumArrows(); + doDriveButtons(); + doSaveRestoreText(); + g_music->newCheckMusic(); + + eatMessages(); + fade(true, 0); + res = processSaveRestore(2); + fade(false, 0); + + return res; +} + + +#define QUARTERNUM 30 + + +bool saveRestoreGame(void) { + uint16 filenum; + byte **buffer; + char temp[10], *name; + bool isok = true; + + blackAllScreen(); + + ManyDrives = doDisks(); + + FadePalette = hipal; + memset(&(hipal[0]), 0, 32L); + + BigMsgFont = &bmfont; + + if (!getFont("P:Map.fon", BigMsgFont)) { + BigMsgFont = NULL; + return false; + } + + buffer = g_music->newOpen("P:SaveImage"); + + if (!buffer) { + freeAllStolenMem(); + return false; + } + + readImage(buffer, &Arrow1); + readImage(buffer, &NoArrow1); + readImage(buffer, &DriveButton); + + mouseShow(); + + if ((issave = saveOrRestore()) != (uint16) - 1) { + eatMessages(); + + if ((filenum = saveRestore()) != (uint16) - 1) { + name = numtostr(temp, filenum); + strcat(DrivePath, name); + + eatMessages(); + + if (issave) + isok = saveFloppy(DrivePath, RoomNum, Direction, Inventory[QUARTERNUM].Many, Conditions, RoomsFound, filenum, device); + else { + isok = readFloppy(DrivePath, &RoomNum, &Direction, &(Inventory[QUARTERNUM].Many), Conditions, RoomsFound, filenum, device); + g_music->resetMusic(); + } + } + } + + mouseHide(); + setAPen(0); + rectFill(0, 0, VGAScreenWidth - 1, VGAScreenHeight - 1); + blackScreen(); + + journalCleanUp(); + + freeAllStolenMem(); + + return isok; +} + +#endif + + + +/*---------------------------------------------------------------------------*/ +/*--------------------------- The Monitors stuff ----------------------------*/ +/*---------------------------------------------------------------------------*/ + + +extern CloseDataPtr CPtr; + +static uint16 monpage; +static const char *TextFileName; + + +struct Image *MonButton, *AltMonButton, *MonQuit, *AltMonQuit, *MonBack, *AltMonBack, *MonDown, *AltMonDown, *MonUp, *AltMonUp; + + + + +/*****************************************************************************/ +/* Makes sure that the buttons are in memory. */ +/*****************************************************************************/ +static void getMonImages(void) { + byte **buffer; + + resetBuffer(); + + buffer = g_music->newOpen("P:MonImage"); + + if (!buffer) + return; + + readImage(buffer, &MonButton); + + stealBufMem(sizeOfFile("P:MonImage")); /* Trick: protects the memory where the buttons are so they won't be over-written */ +} + + +static uint16 MonGadHeight = 1; + + +/*****************************************************************************/ +/* Draws the text for the monitor. */ +/*****************************************************************************/ +static void drawMonText(char *text, uint16 x1, uint16 y1, uint16 x2, uint16 y2, bool isinteractive) { + uint16 DrawingToPage = 0, yspacing = 0, numlines, fheight, counter; + int32 CharsDrawn = 0L; + char *CurText = text; + + mouseHide(); + + if (*text == '%') { + text++; + numlines = (*text - '0') * 10; + text++; + numlines += (*text - '0'); + text += 2; + + fheight = textHeight(BigMsgFont); + x1 = MonButton->Width + VGAScaleX(3); + MonGadHeight = MonButton->Height + VGAScaleY(3); + + if (MonGadHeight > fheight) + yspacing = MonGadHeight - fheight; + else + MonGadHeight = fheight; + + setAPen(0); + rectFill(0, 0, VGAScreenWidth - 1, y2); + + for (counter = 0; counter < numlines; counter++) + drawImage(MonButton, 0, counter * MonGadHeight); + } else if (isinteractive) { + setAPen(0); + rectFill(0, 0, VGAScreenWidth - 1, y2); + } else { + setAPen(0); + rectFill(x1, y1, x2, y2); + } + + while (DrawingToPage < monpage) { + g_music->newCheckMusic(); + CurText = (char *)(text + CharsDrawn); + CharsDrawn += flowText(BigMsgFont, yspacing, 0, 0, false, false, false, false, x1, y1, x2, y2, CurText); + lastpage = (*CurText == 0); + + if (lastpage) + monpage = DrawingToPage; + else + DrawingToPage++; + } + + CurText = (char *)(text + CharsDrawn); + lastpage = (*CurText == 0); + CharsDrawn = flowText(BigMsgFont, yspacing, 2, 0, false, false, false, true, x1, y1, x2, y2, CurText); + CurText += CharsDrawn; + lastpage = lastpage || (*CurText == 0); + + mouseShow(); +} + +/*****************************************************************************/ +/* Processes user input. */ +/*****************************************************************************/ +static void processMonitor(char *ntext, bool isinteractive, uint16 x1, uint16 y1, uint16 x2, uint16 y2) { + struct IntuiMessage *Msg; + uint32 Class; + uint16 Qualifier, Code, MouseX, MouseY; + const char *Test = " ", *StartFileName = TextFileName; + CloseDataPtr StartCPtr = CPtr, TestCPtr, LastCPtr[10]; + uint16 depth = 0; + + LastCPtr[0] = CPtr; + + while (1) { + if (isinteractive) { + if (CPtr == NULL) + CPtr = StartCPtr; + + if (CPtr == StartCPtr) + Test = StartFileName; + else + Test = CPtr->GraphicName; + + if (strcmp(Test, TextFileName)) { + monpage = 0; + TextFileName = Test; + + ntext = getText(TextFileName); + fade(false, 0); + drawMonText(ntext, x1, y1, x2, y2, isinteractive); + fade(true, 0); + } + } + + g_music->checkMusic(); /* Make sure we check the music at least after every message */ + Msg = getMsg(); + + if (Msg == NULL) { + g_music->newCheckMusic(); + } else { + Class = Msg->Class; + Qualifier = Msg->Qualifier; + MouseX = Msg->MouseX; + MouseY = Msg->MouseY; + Code = Msg->Code; + + replyMsg(Msg); + + if (((Class == MOUSEBUTTONS) && (IEQUALIFIER_RBUTTON & Qualifier)) || + ((Class == RAWKEY) && (Code == 27))) + return; + + else if ((Class == MOUSEBUTTONS) && (IEQUALIFIER_LEFTBUTTON & Qualifier)) { + if ((MouseY >= VGAScaleY(171)) && (MouseY <= VGAScaleY(200))) { + if ((MouseX >= VGAScaleX(259)) && (MouseX <= VGAScaleX(289))) { + if (!lastpage) { + monpage += 1; + drawMonText(ntext, x1, y1, x2, y2, isinteractive); + } + } else if ((MouseX >= VGAScaleX(0)) && (MouseX <= VGAScaleX(31))) { + return; + } else if ((MouseX >= VGAScaleX(290)) && (MouseX <= VGAScaleX(320))) { + if (monpage >= 1) { + monpage -= 1; + drawMonText(ntext, x1, y1, x2, y2, isinteractive); + } + } else if ((MouseX >= VGAScaleX(31)) && (MouseX <= VGAScaleX(59))) { + if (isinteractive) { + monpage = 0; + + if (depth) { + depth--; + CPtr = LastCPtr[depth]; + } + } else if (monpage > 0) { + monpage = 0; + drawMonText(ntext, x1, y1, x2, y2, isinteractive); + } + } + } else if (isinteractive) { + TestCPtr = CPtr; + MouseY = 64 + (MouseY / MonGadHeight) * 42; + MouseX = 101; + setCurCloseAbs(MouseX, MouseY, &CPtr); + + if (TestCPtr != CPtr) { + LastCPtr[depth] = TestCPtr; + depth++; + } + } + } + } + } +} + + + + +/*****************************************************************************/ +/* Does what's necessary for the monitor. */ +/*****************************************************************************/ +void doMonitor(char *background, char *textfile, bool isinteractive, uint16 x1, uint16 y1, uint16 x2, uint16 y2) { + char *ntext; + + x1 = VGAScaleX(x1); + x2 = VGAScaleX(x2); + y1 = VGAScaleY(y1); + y2 = VGAScaleY(y2); + + TextFileName = textfile; + + blackAllScreen(); + + readPict("P:Mon/Monitor.1", true); + readPict("P:Mon/NWD1", true); + readPict("P:Mon/NWD2", true); + readPict("P:Mon/NWD3", true); + blackAllScreen(); + + resetBuffer(); + monpage = 0; + lastpage = false; + FadePalette = hipal; + + BigMsgFont = &bmfont; + + if (!getFont("P:Map.font", BigMsgFont)) { + freeAllStolenMem(); + BigMsgFont = NULL; + return; + } + + getMonImages(); + + if ((ntext = getText(textfile)) == NULL) { + freeAllStolenMem(); + return; + } + + loadBackPict(background, false); + + drawMonText(ntext, x1, y1, x2, y2, isinteractive); + + mouseShow(); + fade(true, 0); + processMonitor(ntext, isinteractive, x1, y1, x2, y2); + fade(false, 0); + mouseHide(); + + freeAllStolenMem(); + + setAPen(0); + rectFill(0, 0, VGAScreenWidth - 1, VGAScreenHeight - 1); + blackAllScreen(); +} + +#if defined(LABDEMO) +void doTrialBlock() { + struct IntuiMessage *Msg; + + uint32 Class; + uint16 Qualifier, MouseX, MouseY, Code, Temp; + int i; + + loadBackPict("P:Warning", false); + mouseShow(); + + VGASetPal(diffcmap, 256); + memcpy(g_CommonPalette, diffcmap, 3 * 256); + + while (1) { + g_music->checkMusic(); /* Make sure we check the music at least after every message */ + Msg = getMsg(); + + if (Msg == NULL) { + g_music->newCheckMusic(); + } else { + Class = Msg->Class; + Qualifier = Msg->Qualifier; + MouseX = Msg->MouseX; + MouseY = Msg->MouseY; + Code = Msg->Code; + + replyMsg(Msg); + + if (((Class == MOUSEBUTTONS) && (IEQUALIFIER_RBUTTON & Qualifier)) || + ((Class == RAWKEY) && (Code == 27))) + return; + + if ((Class == MOUSEBUTTONS) && (IEQUALIFIER_LEFTBUTTON & Qualifier)) { + if (MouseY > 399) { + // click on control panel, exit + break; + } + + if (MouseX >= 0 && MouseX <= 319 && MouseY >= 0 && MouseY <= 399) { + extern void getItNow(); + getItNow(); + } else if (MouseX >= 320 && MouseX <= 639 && MouseY >= 0 && MouseY <= 399) { + break; + } + } + } + } + + eatMessages(); + mouseHide(); +} +#endif + +} // End of namespace Lab diff --git a/engines/lab/stddefines.h b/engines/lab/stddefines.h new file mode 100644 index 0000000000..b7e5fa6dda --- /dev/null +++ b/engines/lab/stddefines.h @@ -0,0 +1,105 @@ +/* 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. + * + */ + +/* + * This code is based on Labyrinth of Time code with assistance of + * + * Copyright (c) 1993 Terra Nova Development + * Copyright (c) 2004 The Wyrmkeep Entertainment Co. + * + */ + +#include "common/system.h" +#include "common/debug.h" +#include "common/textconsole.h" + +#ifndef LAB_STDDEFINES_H +#define LAB_STDDEFINES_H + +namespace Lab { + +#define IS_MACOSX 1 +#define USE_SWAP 1 + + +#define INCL(BITSET,BIT) ((BITSET) |= (BIT)) + +#define EXCL(BITSET,BIT) ((BITSET) &= (~(BIT))) + + + +#define SETBIT(BITSET,BITNUM) INCL(BITSET, (1 << (BITNUM))) + +#define UNSETBIT(BITSET,BITNUM) EXCL(BITSET, (1 << (BITNUM))) + +#define INBIT(BITSET,BITNUM) ( ((1 << (BITNUM)) & (BITSET)) > 0 ) + +#if !defined(WIN32) +#ifndef min +#define min(a,b) ((a)<(b) ? (a) : (b)) +#endif +#ifndef max +#define max(a,b) ((a)>(b) ? (a) : (b)) +#endif +#endif + +#if defined(IS_MACOSX) +#define getTime Lab_GetTime +#define delay Lab_Delay +#endif + +#if !defined(DOSCODE) +#if defined(USE_NOSWAP) +#define swapUShort(value) (value) +#define swapUShortPtr(ptr,count) (ptr) +#define swapShort(value) (value) +#define swapShortPtr(ptr,count) (ptr) +#define swapUInt(value) (value) +#define swapUIntPtr(ptr,count) (ptr) +#define swapInt(value) (value) +#define swapIntPtr(ptr,count) (ptr) +#define swapULong(value) (value) +#define swapULongPtr(ptr,count) (ptr) +#define swapLong(value) (value) +#define swapLongPtr(ptr,count) (ptr) +#elif defined(USE_SWAP) +uint16 swapUShort(uint16 value); +uint16 *swapUShortPtr(uint16 *ptr, int count); +int16 swapShort(int16 value); +int16 *swapShortPtr(int16 *ptr, int count); +unsigned int swapUInt(unsigned int value); +unsigned int *swapUIntPtr(unsigned int *ptr, int count); +int swapInt(int value); +int *swapIntPtr(int *ptr, int count); +uint32 swapULong(uint32 value); +uint32 *swapULongPtr(uint32 *ptr, int count); +int32 swapLong(int32 value); +int32 *swapLongPtr(int32 *ptr, int count); +#else +#error Please tell me about swapping bytes! +#endif + +#endif + +} // End of namespace Lab + +#endif /* LAB_STDDEFINES_H */ diff --git a/engines/lab/storage.cpp b/engines/lab/storage.cpp new file mode 100644 index 0000000000..0d21b937c9 --- /dev/null +++ b/engines/lab/storage.cpp @@ -0,0 +1,89 @@ +/* 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. + * + */ + +/* + * This code is based on Labyrinth of Time code with assistance of + * + * Copyright (c) 1993 Terra Nova Development + * Copyright (c) 2004 The Wyrmkeep Entertainment Co. + * + */ + +#include "lab/stddefines.h" + +namespace Lab { + +/*****************************************************************************/ +/* Allocates a chunk of memory. */ +/*****************************************************************************/ +bool allocate(void **Ptr, uint32 Size) { + (*Ptr) = malloc(Size); + + if (*Ptr) + memset(*Ptr, 0, (size_t) Size); + + return (*Ptr != NULL); +} + + + + +/*****************************************************************************/ +/* Allocates a piece of chip memory. */ +/*****************************************************************************/ +bool allocatechip(void **Ptr, uint32 Size) { + return allocate(Ptr, Size); +} + +/*****************************************************************************/ +/* Allocates a chunk of dos memory. */ +/*****************************************************************************/ +bool allocatedos(void **Ptr, uint32 Size) { +#if defined(DOSCODE) + static union REGS regs; + + regs.x.eax = 0x100; + regs.x.ebx = (Size >> 4); + int386(0x31, ®s, ®s); + + if (regs.x.cflag) { + *Ptr = NULL; + return false; + } + + *Ptr = (char *)((regs.x.eax & 0xFFFF) << 4); + return (*Ptr != NULL); +#else + *Ptr = malloc(Size); + return (*Ptr != NULL); +#endif +} + +/*****************************************************************************/ +/* Deallocates a piece of memory. */ +/*****************************************************************************/ +void deallocate(void *Ptr, uint32 Size) { + if (Ptr) + free(Ptr); +} + +} // End of namespace Lab diff --git a/engines/lab/storage.h b/engines/lab/storage.h new file mode 100644 index 0000000000..bb14bef23c --- /dev/null +++ b/engines/lab/storage.h @@ -0,0 +1,48 @@ +/* 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. + * + */ + +/* + * This code is based on Labyrinth of Time code with assistance of + * + * Copyright (c) 1993 Terra Nova Development + * Copyright (c) 2004 The Wyrmkeep Entertainment Co. + * + */ + +#include "lab/stddefines.h" + +#ifndef LAB_STORAGE_H +#define LAB_STORAGE_H + +namespace Lab { + +bool allocate(void **Ptr, uint32 Size); + +bool allocatechip(void **Ptr, uint32 Size); + +bool allocatedos(void **Ptr, uint32 Size); + +void deallocate(void *Ptr, uint32 Size); + +} // End of namespace Lab + +#endif /* LAB_STORAGE_H */ diff --git a/engines/lab/text.cpp b/engines/lab/text.cpp new file mode 100644 index 0000000000..4376dba182 --- /dev/null +++ b/engines/lab/text.cpp @@ -0,0 +1,293 @@ +/* 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. + * + */ + +/* + * This code is based on Labyrinth of Time code with assistance of + * + * Copyright (c) 1993 Terra Nova Development + * Copyright (c) 2004 The Wyrmkeep Entertainment Co. + * + */ + +#include "lab/stddefines.h" +#include "lab/labfun.h" +#include "lab/storage.h" +#include "lab/text.h" +#include "lab/vga.h" + +namespace Lab { + +/*****************************************************************************/ +/* Opens up a font from disk, but uses buffer memory to store it in. */ +/*****************************************************************************/ +bool openFontMem(const char *TextFontPath, struct TextFont *tf, byte *fontbuffer) { + byte **file = NULL; + char header[5]; + int32 filesize, headersize = 4L + 2L + 256 * 3 + 4L; + + filesize = sizeOfFile(TextFontPath); + file = g_music->newOpen(TextFontPath); + + if ((file != NULL) && (filesize > headersize)) { + header[4] = 0; + readBlock(&header, 4L, file); + + if (strcmp(header, "VGAF") == 0) { + tf->DataLength = filesize - headersize; + readBlock(&(tf->Height), 2L, file); +#if !defined(DOSCODE) + swapUShortPtr(&(tf->Height), 1); +#endif + readBlock(tf->Widths, 256L, file); + readBlock(tf->Offsets, 256L * 2L, file); +#if !defined(DOSCODE) + swapUShortPtr(tf->Offsets, 256); +#endif + skip(file, 4L); + tf->data = fontbuffer; + readBlock(tf->data, tf->DataLength, file); + return true; + } + } + + return false; +} + + +/*****************************************************************************/ +/* Opens up a font from disk. */ +/*****************************************************************************/ +bool openFont(const char *TextFontPath, struct TextFont **tf) { + byte **file = NULL; + char header[5]; + int32 filesize, headersize = 4L + 2L + 256 * 3 + 4L; + + if (allocate((void **)tf, sizeof(struct TextFont))) { + filesize = sizeOfFile(TextFontPath); + file = g_music->newOpen(TextFontPath); + + if ((file != NULL) && (filesize > headersize)) { + header[4] = 0; + readBlock(&header, 4L, file); + + if (strcmp(header, "VGAF") == 0) { + (*tf)->DataLength = filesize - headersize; + readBlock(&((*tf)->Height), 2L, file); +#if !defined(DOSCODE) + swapUShortPtr(&((*tf)->Height), 1); +#endif + readBlock((*tf)->Widths, 256L, file); + readBlock((*tf)->Offsets, 256L * 2L, file); +#if !defined(DOSCODE) + swapUShortPtr((*tf)->Offsets, 256); +#endif + skip(file, 4L); + + if (allocate((void **) & ((*tf)->data), (*tf)->DataLength)) { + readBlock((*tf)->data, (*tf)->DataLength, file); + return true; + } + } + } + + deallocate(*tf, sizeof(struct TextFont)); + } + + *tf = NULL; + return false; +} + + +/*****************************************************************************/ +/* Closes a font and frees all memory associated with it. */ +/*****************************************************************************/ +void closeFont(struct TextFont *tf) { + if (tf) { + if (tf->data && tf->DataLength) + deallocate(tf->data, tf->DataLength); + + deallocate(tf, sizeof(struct TextFont)); + } +} + + + +/*****************************************************************************/ +/* Returns the length of a text in the specified font. */ +/*****************************************************************************/ +uint16 textLength(struct TextFont *tf, const char *text, uint16 numchars) { + uint16 counter, length = 0; + + if (tf) + for (counter = 0; counter < numchars; counter++) { + length += tf->Widths[(uint)*text]; + text++; + } + + return length; +} + + + +/*****************************************************************************/ +/* Returns the height of a specified font. */ +/*****************************************************************************/ +uint16 textHeight(struct TextFont *tf) { + if (tf) + return tf->Height; + else + return 0; +} + + + +extern uint32 VGAScreenWidth, VGABytesPerPage; + + +/*****************************************************************************/ +/* Draws the text to the screen. */ +/*****************************************************************************/ +void text(struct TextFont *tf, uint16 x, uint16 y, uint16 color, const char *text, uint16 numchars) { + byte *VGATop, *VGACur, *VGATemp, *VGATempLine, *cdata; + uint32 RealOffset, SegmentOffset; + int32 templeft, LeftInSegment; + uint16 counter, counterb, bwidth, mask, curpage, rows, cols, data; + + VGATop = getVGABaseAddr(); + + for (counter = 0; counter < numchars; counter++) { + RealOffset = (VGAScreenWidth * y) + x; + curpage = RealOffset / VGABytesPerPage; + SegmentOffset = RealOffset - (curpage * VGABytesPerPage); + LeftInSegment = VGABytesPerPage - SegmentOffset; + VGACur = VGATop + SegmentOffset; + setPage(curpage); + + if (tf->Widths[(uint)*text]) { + cdata = tf->data + tf->Offsets[(uint)*text]; + bwidth = *cdata; + cdata++; + VGATemp = VGACur; + VGATempLine = VGACur; + + for (rows = 0; rows < tf->Height; rows++) { + VGATemp = VGATempLine; + templeft = LeftInSegment; + + for (cols = 0; cols < bwidth; cols++) { + data = *cdata; + cdata++; + + if (data && (templeft >= 8)) { + if (0x80 & data) + *VGATemp = color; + + VGATemp++; + + if (0x40 & data) + *VGATemp = color; + + VGATemp++; + + if (0x20 & data) + *VGATemp = color; + + VGATemp++; + + if (0x10 & data) + *VGATemp = color; + + VGATemp++; + + if (0x08 & data) + *VGATemp = color; + + VGATemp++; + + if (0x04 & data) + *VGATemp = color; + + VGATemp++; + + if (0x02 & data) + *VGATemp = color; + + VGATemp++; + + if (0x01 & data) + *VGATemp = color; + + VGATemp++; + + templeft -= 8; + } else if (data) { + mask = 0x80; + templeft = LeftInSegment; + + for (counterb = 0; counterb < 8; counterb++) { + if (templeft <= 0) { + curpage++; + setPage(curpage); + VGATemp = (byte *)(VGATop - templeft); + /* Set up VGATempLine for next line */ + VGATempLine -= VGABytesPerPage; + /* Set up LeftInSegment for next line */ + LeftInSegment += VGABytesPerPage + templeft; + templeft += VGABytesPerPage; + } + + if (mask & data) + *VGATemp = color; + + VGATemp++; + + mask = mask >> 1; + templeft--; + } + } else { + templeft -= 8; + VGATemp += 8; + } + } + + VGATempLine += VGAScreenWidth; + LeftInSegment -= VGAScreenWidth; + + if (LeftInSegment <= 0) { + curpage++; + setPage(curpage); + VGATempLine -= VGABytesPerPage; + LeftInSegment += VGABytesPerPage; + } + } + } + + x += tf->Widths[(int)*text]; + text++; + } + +#if !defined(DOSCODE) + ungetVGABaseAddr(); +#endif +} + +} // End of namespace Lab diff --git a/engines/lab/text.h b/engines/lab/text.h new file mode 100644 index 0000000000..4947fda7fe --- /dev/null +++ b/engines/lab/text.h @@ -0,0 +1,69 @@ +/* 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. + * + */ + +/* + * This code is based on Labyrinth of Time code with assistance of + * + * Copyright (c) 1993 Terra Nova Development + * Copyright (c) 2004 The Wyrmkeep Entertainment Co. + * + */ + +#ifndef LAB_TEXT_H +#define LAB_TEXT_H + + +#include "lab/stddefines.h" + +namespace Lab { + +#if defined(WIN32) +#pragma pack(push, 1) +#endif + +struct TextFont { + uint32 DataLength; + uint16 Height; + byte Widths[256]; + uint16 Offsets[256]; + byte *data; +}; + +#if defined(WIN32) +#pragma pack(pop) +#endif + +bool openFontMem(const char *TextFontPath, struct TextFont *tf, byte *fontbuffer); + +bool openFont(const char *TextFontPath, struct TextFont **tf); + +void closeFont(struct TextFont *tf); + +uint16 textLength(struct TextFont *tf, const char *text, uint16 numchars); + +uint16 textHeight(struct TextFont *tf); + +void text(struct TextFont *tf, uint16 x, uint16 y, uint16 color, const char *text, uint16 numchars); + +} // End of namespace Lab + +#endif /* LAB_TEXT_H */ diff --git a/engines/lab/timing.cpp b/engines/lab/timing.cpp new file mode 100644 index 0000000000..acba16d98e --- /dev/null +++ b/engines/lab/timing.cpp @@ -0,0 +1,147 @@ +/* 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. + * + */ + +/* + * This code is based on Labyrinth of Time code with assistance of + * + * Copyright (c) 1993 Terra Nova Development + * Copyright (c) 2004 The Wyrmkeep Entertainment Co. + * + */ + +#include "lab/stddefines.h" +#include "lab/timing.h" +#include "lab/vga.h" + +namespace Lab { + +/*****************************************************************************/ +/* Waits for for Secs seconds and Micros microseconds to pass. */ +/*****************************************************************************/ +void microDelay(uint32 secs, uint32 micros) { + uint32 waitSecs, waitMicros; + + addCurTime(secs, micros, &waitSecs, &waitMicros); + + while (1) { + getTime(&secs, µs); + + if ((secs > waitSecs) || ((secs == waitSecs) && (micros >= waitMicros))) + return; + + g_system->delayMillis(10); + } +} + +/*****************************************************************************/ +/* Gets the current system time. */ +/*****************************************************************************/ +void getTime(uint32 *secs, uint32 *micros) { + uint32 t = g_system->getMillis(); + + *secs = t / 1000; + *micros = t % 1000; +} + +/*****************************************************************************/ +/* Adds seconds and microseconds to current time to get a new time. */ +/*****************************************************************************/ +void addCurTime(uint32 sec, uint32 micros, uint32 *timeSec, uint32 *timeMicros) { + getTime(timeSec, timeMicros); + + (*timeSec) += sec; + (*timeMicros) += micros; + + if (*timeMicros >= ONESECOND) { + (*timeSec)++; + (*timeMicros) -= ONESECOND; + } +} + +/*****************************************************************************/ +/* Finds the difference between time1 and time2. If time1 is later than */ +/* time2, returns 0. */ +/*****************************************************************************/ +void anyTimeDiff(uint32 sec1, uint32 micros1, uint32 sec2, uint32 micros2, uint32 *diffSecs, uint32 *diffMicros) { + *diffSecs = 0; + *diffMicros = 0; + + if (sec1 > sec2) + return; + else if ((sec1 == sec2) && (micros1 >= micros2)) + return; + + if (micros1 > micros2) { + *diffSecs = sec2 - sec1 - 1; + *diffMicros = (ONESECOND - micros1) + micros2; + } else { + *diffSecs = sec2 - sec1; + *diffMicros = micros2 - micros1; + } +} + +/*****************************************************************************/ +/* Finds the difference between the current time, and a future time. Returns */ +/* 0 if the future time is actually before the current time. */ +/*****************************************************************************/ +void timeDiff(uint32 sec, uint32 micros, uint32 *diffSec, uint32 *diffMicros) { + uint32 curSec, curMicros; + + *diffSec = 0; + *diffMicros = 0; + + getTime(&curSec, &curMicros); + + if (curSec > sec) /* Already passed the time */ + return; + else if ((curSec == sec) && (curMicros >= micros)) /* Already passed the time */ + return; + + if (curMicros > micros) { + *diffSec = sec - curSec - 1; + *diffMicros = (ONESECOND - curMicros) + micros; + } else { + *diffSec = sec - curSec; + *diffMicros = micros - curMicros; + } +} + +/*****************************************************************************/ +/* Waits for a specified time to occur. */ +/*****************************************************************************/ +void waitForTime(uint32 sec, uint32 micros) { + uint32 curSec, curMicros; + + getTime(&curSec, &curMicros); + + if (curSec > sec) + return; + else if ((curSec == sec) && (curMicros >= micros)) + return; + + if (curMicros > micros) + microDelay(sec - curSec - 1, (ONESECOND - curMicros) + micros - 1); + else + microDelay(sec - curSec, micros - curMicros - 1); +} + +} // End of namespace Lab diff --git a/engines/lab/timing.h b/engines/lab/timing.h new file mode 100644 index 0000000000..adbaf950d8 --- /dev/null +++ b/engines/lab/timing.h @@ -0,0 +1,47 @@ +/* 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. + * + */ + +/* + * This code is based on Labyrinth of Time code with assistance of + * + * Copyright (c) 1993 Terra Nova Development + * Copyright (c) 2004 The Wyrmkeep Entertainment Co. + * + */ + +#ifndef LAB_TIMING_H +#define LAB_TIMING_H + +namespace Lab { + +#define ONESECOND 1000 + +void microDelay(uint32 secs, uint32 micros); +void getTime(uint32 *secs, uint32 *micros); +void addCurTime(uint32 sec, uint32 micros, uint32 *timeSec, uint32 *timeMicros); +void anyTimeDiff(uint32 sec1, uint32 micros1, uint32 sec2, uint32 micros2, uint32 *diffSecs, uint32 *diffMicros); +void timeDiff(uint32 sec, uint32 micros, uint32 *diffSec, uint32 *diffMicros); +void waitForTime(uint32 sec, uint32 micros); + +} // End of namespace Lab + +#endif /* LAB_TIMING_H */ diff --git a/engines/lab/undiff.cpp b/engines/lab/undiff.cpp new file mode 100644 index 0000000000..2218db485a --- /dev/null +++ b/engines/lab/undiff.cpp @@ -0,0 +1,498 @@ +/* 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. + * + */ + +/* + * This code is based on Labyrinth of Time code with assistance of + * + * Copyright (c) 1993 Terra Nova Development + * Copyright (c) 2004 The Wyrmkeep Entertainment Co. + * + */ + +#include "lab/stddefines.h" + +namespace Lab { + +extern uint16 DataBytesPerRow; + + + +/*****************************************************************************/ +/* Copies memory. */ +/*****************************************************************************/ +#define turbocopymem(Dest, Source, Len) (memcpy(Dest, Source, Len)) + + +static void copytwo(byte *Dest, byte *Source) { +#if defined(USE_SWAP) + Dest[1] = Source[0]; + Dest[0] = Source[1]; +#else + *Dest = *Source; + Dest++; + Source++; + *Dest = *Source; +#endif +} + + + + +/*------------------------ unDiff Horizontal Memory -------------------------*/ + + + + +/*****************************************************************************/ +/* Undiffs a piece of memory when header size is a byte, and copy/skip size */ +/* is also a byte. */ +/*****************************************************************************/ +static void unDIFFByteByte(byte *Dest, byte *diff) { + uint16 skip, copy; + + while (1) { + skip = *diff; + diff++; + copy = *diff; + diff++; + + if (skip == 255) { + if (copy == 0) { + copytwo((byte *) &skip, diff); + diff += 2; + copytwo((byte *) ©, diff); + diff += 2; + } else if (copy == 255) + return; + } + + Dest += skip; + turbocopymem(Dest, diff, copy); + Dest += copy; + diff += copy; + } +} + + + +/*****************************************************************************/ +/* Undiffs a piece of memory when header size is a byte, and copy/skip size */ +/* is a word. */ +/*****************************************************************************/ +static void unDIFFByteWord(uint16 *Dest, uint16 *diff) { + uint16 skip, copy; + + while (1) { + skip = ((byte *)diff)[0]; + copy = ((byte *)diff)[1]; + + diff++; + + if (skip == 255) { + if (copy == 0) { + skip = swapUShort(*diff); + diff++; + copy = swapUShort(*diff); + diff++; + } else if (copy == 255) + return; + } + + Dest += skip; + + while (copy > 3) { + *Dest = *diff; //swapUShort(*diff); + Dest++; + diff++; + + *Dest = *diff; //swapUShort(*diff); + Dest++; + diff++; + + *Dest = *diff; //swapUShort(*diff); + Dest++; + diff++; + + *Dest = *diff; //swapUShort(*diff); + Dest++; + diff++; + + copy -= 4; + } + + while (copy) { + *Dest = *diff; //swapUShort(*diff); + Dest++; + diff++; + copy--; + } + } +} + + + +#ifdef undef + +/*****************************************************************************/ +/* Undiffs a piece of memory when header size is a byte, and copy/skip size */ +/* is a long word. */ +/*****************************************************************************/ +static void unDIFFByteLong(byte *Dest, byte *diff) { + uint16 skip, copy; + + while (1) { + skip = *diff << 2; + diff++; + copy = *diff << 2; + diff++; + + if (skip == (255 << 2)) { + if (copy == 0) { + skip = swapUShort(*((uint16 *) diff)) << 2; + diff += 2; + copy = swapUShort(*((uint16 *) diff) << 2; + diff += 2; + } else if (copy == (255 << 2)) + return; + } + + Dest += skip; + turbocopymem(Dest, diff, copy); + Dest += copy; + diff += copy; + } +} + +#endif + + + +/*****************************************************************************/ +/* UnDiffs a coded DIFF string onto an already initialized piece of memory. */ +/*****************************************************************************/ +bool unDIFFMemory(byte *Dest, byte *diff, uint16 HeaderSize, uint16 CopySize) { + if (HeaderSize == 1) { + if (CopySize == 1) + unDIFFByteByte(Dest, diff); + + else if (CopySize == 2) + unDIFFByteWord((uint16 *)Dest, (uint16 *)diff); + +#ifdef undef + else if (CopySize == 4) + unDIFFByteLong((uint32 *)Dest, (uint32 *)diff); + +#endif + + else + return false; + } + /* + else if (HeaderSize == 2) + { + if (CopySize == 1) + unDIFFWordByte(Dest, diff); + + else if (CopySize == 2) + unDIFFWordWord(Dest, diff); + + else if (CopySize == 4) + unDIFFWordLong(Dest, diff); + + else + return false; + } + */ + else + return (false); + + return true; +} + + + + +/*------------------------- unDiff Vertical Memory --------------------------*/ + + + + +/*****************************************************************************/ +/* Undiffs a piece of memory when header size is a byte, and copy/skip size */ +/* is a byte. */ +/*****************************************************************************/ +static void VUnDIFFByteByte(byte *Dest, byte *diff, uint16 bytesperrow) { + byte *CurPtr; + uint16 skip, copy; + uint16 counter = 0; + + + while (counter < DataBytesPerRow) { + CurPtr = Dest + counter; + + for (;;) { + skip = *diff; + diff++; + copy = *diff; + diff++; + + if (skip == 255) { + counter += copy; + break; + } + + else { + CurPtr += (skip * bytesperrow); + + while (copy) { + copy--; + *CurPtr = *diff; + CurPtr += bytesperrow; + diff++; + } + } + } + } +} + + + + +/*****************************************************************************/ +/* Undiffs a piece of memory when header size is a byte, and copy/skip size */ +/* is a word. */ +/*****************************************************************************/ +static void VUnDIFFByteWord(uint16 *Dest, uint16 *diff, uint16 bytesperrow) { + uint16 *CurPtr; + uint16 skip, copy; + uint16 counter = 0, wordsperrow; + + + wordsperrow = bytesperrow / 2; + + while (counter < (DataBytesPerRow >> 1)) { + CurPtr = Dest + counter; + + for (;;) { + skip = ((byte *)diff)[0]; + copy = ((byte *)diff)[1]; + + diff++; + + + if (skip == 255) { + counter += copy; + break; + } + + else { + CurPtr += (skip * wordsperrow); + + while (copy) { + *CurPtr = *diff; //swapUShort(*diff); + CurPtr += wordsperrow; + diff++; + copy--; + } + } + } + } +} + + + + +/*****************************************************************************/ +/* Undiffs a piece of memory when header size is a byte, and copy/skip size */ +/* is a long. */ +/*****************************************************************************/ +static void VUnDIFFByteLong(uint32 *Dest, uint32 *diff, uint16 bytesperrow) { + uint32 *CurPtr; + uint16 skip, copy; + uint16 counter = 0, longsperrow; + byte *diff1 = (byte *)diff; + + + longsperrow = bytesperrow / 4; + + while (counter < (DataBytesPerRow >> 2)) { + CurPtr = Dest + counter; + + for (;;) { + skip = *diff1; + diff1++; + + copy = *diff1; + diff1++; + + + if (skip == 255) { + counter += copy; + break; + } + + else { + CurPtr += (skip * longsperrow); + + while (copy) { + *CurPtr = *(uint32 *)diff1; //swapULong(*diff); + CurPtr += longsperrow; + diff1 += 4; + copy--; + } + } + } + } +} + + + + +/*****************************************************************************/ +/* UnDiffs a coded DIFF string onto an already initialized piece of memory. */ +/*****************************************************************************/ +bool VUnDIFFMemory(byte *Dest, byte *diff, uint16 HeaderSize, uint16 CopySize, uint16 bytesperrow) { + if (HeaderSize == 1) { + if (CopySize == 1) + VUnDIFFByteByte(Dest, diff, bytesperrow); + + else if (CopySize == 2) + VUnDIFFByteWord((uint16 *)Dest, (uint16 *)diff, bytesperrow); + + else if (CopySize == 4) + VUnDIFFByteLong((uint32 *)Dest, (uint32 *)diff, bytesperrow); + + else + return false; + } + /* + else if (HeaderSize == 2) + { + if (CopySize == 1) + VUnDIFFWordByte(Dest, diff, bytesperrow); + + else if (CopySize == 2) + VUnDIFFWordWord(Dest, diff, bytesperrow); + + else if (CopySize == 4) + VUnDIFFWordLong(Dest, diff, bytesperrow); + + else + return false; + } + */ + else + return (false); + + return true; +} + + + + + +/*---------------------------- Runlength Decodes ----------------------------*/ + + + + + +/*****************************************************************************/ +/* Runlength decodes a chunk of memory. */ +/*****************************************************************************/ +void runLengthDecode(byte *Dest, byte *Source) { + int8 num; + int16 count; + + + while (1) { + num = (int8)*Source; + Source++; + + if (num == 127) { + return; + } else if (num > '\0') { + turbocopymem(Dest, Source, num); + Source += num; + Dest += num; + } else { + count = (int16)(-num); + num = *Source; + Source++; + + while (count) { + *Dest = num; + Dest++; + count--; + } + } + } +} + + + + +/*****************************************************************************/ +/* Does a vertical run length decode. */ +/*****************************************************************************/ +void VRunLengthDecode(byte *Dest, byte *Source, uint16 bytesperrow) { + int8 num; + int16 count; + uint16 Counter; + byte *Top; + + Top = Dest; + + for (Counter = 0; Counter < DataBytesPerRow; Counter++) { + Dest = Top; + Dest += Counter; + + num = (int8)*Source; + Source++; + + while (num != 127) { + if (num > '\0') { + while (num) { + *Dest = *Source; + Source++; + Dest += bytesperrow; + num--; + } + } else { + count = (int16)(-num); + num = (int8)*Source; + Source++; + + while (count) { + *Dest = num; + Dest += bytesperrow; + count--; + } + } + + num = *Source; + Source++; + } + } +} + +} // End of namespace Lab diff --git a/engines/lab/vga.cpp b/engines/lab/vga.cpp new file mode 100644 index 0000000000..235d247145 --- /dev/null +++ b/engines/lab/vga.cpp @@ -0,0 +1,1082 @@ +/* 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. + * + */ + +/* + * This code is based on Labyrinth of Time code with assistance of + * + * Copyright (c) 1993 Terra Nova Development + * Copyright (c) 2004 The Wyrmkeep Entertainment Co. + * + */ + +#include "lab/vga.h" +#include "lab/stddefines.h" +#include "lab/storage.h" + +namespace Lab { + +//static uint16 NotInRefresh = 0; + +uint32 VGAScreenWidth = 320UL, + VGAScreenHeight = 200UL, + VGAPages = 1UL, + VGABytesPerPage = 65536UL; + +uint32 VGABASEADDRESS = 0xA0000L; + + +/*****************************************************************************/ +/* Sets the display mode. */ +/*****************************************************************************/ +void setMode(char mode) { + // There are no modes for SDL. +} + +/*****************************************************************************/ +/* Sets up either a low-res or a high-res 256 color screen. */ +/*****************************************************************************/ +bool createScreen(bool HiRes) { +// VGABASEADDRESS = (unsigned long)malloc(640 * 480); + VGABASEADDRESS = 1; + VGAScreenWidth = 640; + VGAScreenHeight = 480; + VGAPages = 1; + VGABytesPerPage = 640 * 480; + return true; +} + + + +/*****************************************************************************/ +/* Sets the current page on the VGA card. */ +/*****************************************************************************/ +void setPage(uint16 PageNum) { + // PageNum should always calculated out to zero for SDL. + assert(PageNum == 0); +} + + + +void VGAStorePage(void) { + // does nothing in SDL +} + +void VGARestorePage(void) { + // does nothing in SDL +} + + +void waitTOF(void) { + warning("STUB: waitTOF"); + //WSDL_WaitTOF(1); +} + + +// NOTE: I don't think this function is called anywhere in the code. +void waitTOFQuick(void) { + warning("STUB: waitTOFQuick"); + //WSDL_WaitTOF(0); +} + + +static char curvgapal[256 * 3]; + +/*****************************************************************************/ +/* Writes any number of the 256 color registers. */ +/* first: the number of the first color register to write. */ +/* numreg: the number of registers to write */ +/* buf: a char pointer which contains the selected color registers. */ +/* Each value representing a color register occupies 3 bytes in */ +/* the array. The order is red, green then blue. The first byte */ +/* in the array is the red component of the first element selected.*/ +/* The length of the buffer is 3 times the number of registers */ +/* selected. */ +/*****************************************************************************/ +void writeColorRegs(char *buf, + uint16 first, + uint16 numreg) { + warning("STUB: writeColorRegs"); + //WSDL_SetColors(buf, first, numreg, 0); + memcpy(&(curvgapal[first * 3]), buf, numreg * 3); +} + + + + +void writeColorRegsSmooth(char *buf, + uint16 first, + uint16 numreg) { + warning("STUB: writeColorRegsSmooth"); + //WSDL_SetColors(buf, first, numreg, 1); + memcpy(&(curvgapal[first * 3]), buf, numreg * 3); +} + + + + +/*****************************************************************************/ +/* Sets one of the 256 (0..255) color registers. buf is a char pointer, */ +/* the first character in the string is the red value, then green, then */ +/* blue. Each color value is a 6 bit value. */ +/*****************************************************************************/ +void writeColorReg(char *buf, + uint16 regnum) { + writeColorRegs(buf, regnum, 1); +} + + + + + +void VGASetPal(void *cmap, + uint16 numcolors) { + if (memcmp(cmap, curvgapal, numcolors * 3) != 0) + writeColorRegs((char *) cmap, 0, numcolors); +} + + + +/*****************************************************************************/ +/* Returns the base address of the current VGA display. */ +/*****************************************************************************/ +byte *getVGABaseAddr(void) { + if (VGABASEADDRESS != 1) + return (byte *)VGABASEADDRESS; + + warning("STUB: getVGABaseAddr"); + return 0; // WSDL_LockVideo(); +} + +#if !defined(DOSCODE) +void ungetVGABaseAddr() { + warning("STUB: ungetVGABaseAddr"); + if (VGABASEADDRESS == 1) + ; //WSDL_UnlockVideo(); +} +#endif + + +/*****************************************************************************/ +/* Gets information about the current display. */ +/*****************************************************************************/ +void getMode(uint16 *Mode) { + // Only one mode in SDL. +} + + + + +/*****************************************************************************/ +/* Draws an image to the screen. */ +/*****************************************************************************/ +void drawImage(struct Image *Im, + uint16 x, + uint16 y) { +#if !defined(DOSCODE) + int sx, sy, dx, dy, w, h; + + sx = 0; + sy = 0; + dx = x; + dy = y; + w = Im->Width; + h = Im->Height; + + if (dx < 0) { + sx -= dx; + w += dx; + dx = 0; + } + + if (dy < 0) { + sy -= dy; + w += dy; + dy = 0; + } + + if ((uint)(dx + w) > VGAScreenWidth) + w = VGAScreenWidth - dx; + + if ((uint)(dy + h) > VGAScreenHeight) + h = VGAScreenHeight - dy; + + if (w > 0 && h > 0) { + byte *s = Im->ImageData + sy * Im->Width + sx; + byte *d = getVGABaseAddr() + dy * VGAScreenWidth + dx; + + while (h-- > 0) { + memcpy(d, s, w); + s += Im->Width; + d += VGAScreenWidth; + } + + ungetVGABaseAddr(); + } + +#else + uint32 RealOffset, + SegmentOffset, + LeftInSegment; + char *video, + *curline, + *imdata = Im->ImageData; + uint16 counterx, + countery = 0, + numwholelines, + numpartiallines, + curpage; + + while (countery < Im->Height) { + RealOffset = (VGAScreenWidth * (y + countery)) + x; + curpage = RealOffset / VGABytesPerPage; + SegmentOffset = RealOffset - (curpage * VGABytesPerPage); + LeftInSegment = VGABytesPerPage - SegmentOffset; + setPage(curpage); + video = (char *)(((int32)(VGABASEADDRESS)) + SegmentOffset); + + numwholelines = LeftInSegment / VGAScreenWidth; + numpartiallines = 0; + counterx = LeftInSegment - (numwholelines * VGAScreenWidth); + + if (counterx >= Im->Width) + numwholelines++; + else + numpartiallines = 1; + + while (numwholelines && (countery < Im->Height)) { + curline = video; + + for (counterx = 0; counterx < Im->Width; counterx++) { + *video = *imdata; + video++; + imdata++; + } + + video = curline; + video += VGAScreenWidth; + countery ++; + numwholelines --; + LeftInSegment -= VGAScreenWidth; + } + + if (numpartiallines && (countery < Im->Height)) { + countery ++; + curline = video; + + for (counterx = 0; counterx < Im->Width; counterx++) { + if (LeftInSegment == 0L) { + setPage(curpage + 1); + LeftInSegment = VGABytesPerPage; + video = (char *)(VGABASEADDRESS); + } + + *video = *imdata; + video++; + imdata++; + LeftInSegment--; + } + } + } + +#endif +} + + + + +/*****************************************************************************/ +/* Draws an image to the screen. */ +/*****************************************************************************/ +void drawMaskImage(struct Image *Im, + uint16 x, + uint16 y) { +#if !defined(DOSCODE) + int sx, sy, dx, dy, w, h; + + sx = 0; + sy = 0; + dx = x; + dy = y; + w = Im->Width; + h = Im->Height; + + if (dx < 0) { + sx -= dx; + w += dx; + dx = 0; + } + + if (dy < 0) { + sy -= dy; + w += dy; + dy = 0; + } + + if ((uint)(dx + w) > VGAScreenWidth) + w = VGAScreenWidth - dx; + + if ((uint)(dy + h) > VGAScreenHeight) + h = VGAScreenHeight - dy; + + if (w > 0 && h > 0) { + byte *s = Im->ImageData + sy * Im->Width + sx; + byte *d = getVGABaseAddr() + dy * VGAScreenWidth + dx; + + while (h-- > 0) { + byte *ss = s; + byte *dd = d; + int ww = w; + + while (ww-- > 0) { + byte c = *ss++; + + if (c) *dd++ = c - 1; + else dd++; + } + + s += Im->Width; + d += VGAScreenWidth; + } + + ungetVGABaseAddr(); + } + +#else + uint32 RealOffset, + SegmentOffset, + LeftInSegment; + char *video, + *curline, + *imdata = Im->ImageData; + uint16 counterx, + countery = 0, + numwholelines, + numpartiallines, + curpage; + + while (countery < Im->Height) { + RealOffset = (VGAScreenWidth * (y + countery)) + x; + curpage = RealOffset / VGABytesPerPage; + SegmentOffset = RealOffset - (curpage * VGABytesPerPage); + LeftInSegment = VGABytesPerPage - SegmentOffset; + setPage(curpage); + video = (char *)(((int32)(VGABASEADDRESS)) + SegmentOffset); + + numwholelines = LeftInSegment / VGAScreenWidth; + numpartiallines = 0; + counterx = LeftInSegment - (numwholelines * VGAScreenWidth); + + if (counterx >= Im->Width) + numwholelines++; + else + numpartiallines = 1; + + while (numwholelines && (countery < Im->Height)) { + curline = video; + + for (counterx = 0; counterx < Im->Width; counterx++) { + if (*imdata) + *video = *imdata - 1; + + video++; + imdata++; + } + + video = curline; + video += VGAScreenWidth; + countery ++; + numwholelines --; + LeftInSegment -= VGAScreenWidth; + } + + if (numpartiallines && (countery < Im->Height)) { + countery ++; + curline = video; + + for (counterx = 0; counterx < Im->Width; counterx++) { + if (LeftInSegment == 0L) { + setPage(curpage + 1); + LeftInSegment = VGABytesPerPage; + video = (char *)(VGABASEADDRESS); + } + + if (*imdata) + *video = *imdata - 1; + + video++; + imdata++; + LeftInSegment--; + } + } + } + +#endif +} + + + + +/*****************************************************************************/ +/* Reads an image from the screen. */ +/*****************************************************************************/ +void readScreenImage(struct Image *Im, + uint16 x, + uint16 y) { +#if !defined(DOSCODE) + int sx, sy, dx, dy, w, h; + + sx = 0; + sy = 0; + dx = x; + dy = y; + w = Im->Width; + h = Im->Height; + + if (dx < 0) { + sx -= dx; + w += dx; + dx = 0; + } + + if (dy < 0) { + sy -= dy; + w += dy; + dy = 0; + } + + if ((uint)(dx + w) > VGAScreenWidth) + w = VGAScreenWidth - dx; + + if ((uint)(dy + h) > VGAScreenHeight) + h = VGAScreenHeight - dy; + + if (w > 0 && h > 0) { + byte *s = Im->ImageData + sy * Im->Width + sx; + byte *d = getVGABaseAddr() + dy * VGAScreenWidth + dx; + + while (h-- > 0) { + memcpy(s, d, w); + s += Im->Width; + d += VGAScreenWidth; + } + + ungetVGABaseAddr(); + } + +#else + uint32 RealOffset, + SegmentOffset, + LeftInSegment; + char *video, + *curline, + *imdata = Im->ImageData; + uint16 counterx, + countery = 0, + numwholelines, + numpartiallines, + curpage; + + while (countery < Im->Height) { + RealOffset = (VGAScreenWidth * (y + countery)) + x; + curpage = RealOffset / VGABytesPerPage; + SegmentOffset = RealOffset - (curpage * VGABytesPerPage); + LeftInSegment = VGABytesPerPage - SegmentOffset; + setPage(curpage); + video = (char *)(((int32)(VGABASEADDRESS)) + SegmentOffset); + + numwholelines = LeftInSegment / VGAScreenWidth; + numpartiallines = 0; + counterx = LeftInSegment - (numwholelines * VGAScreenWidth); + + if (counterx >= Im->Width) + numwholelines++; + else + numpartiallines = 1; + + while (numwholelines && (countery < Im->Height)) { + curline = video; + + for (counterx = 0; counterx < Im->Width; counterx++) { + *imdata = *video; + video++; + imdata++; + } + + video = curline; + video += VGAScreenWidth; + countery ++; + numwholelines --; + LeftInSegment -= VGAScreenWidth; + } + + if (numpartiallines && (countery < Im->Height)) { + countery ++; + curline = video; + + for (counterx = 0; counterx < Im->Width; counterx++) { + if (LeftInSegment == 0L) { + setPage(curpage + 1); + LeftInSegment = VGABytesPerPage; + video = (char *)(VGABASEADDRESS); + } + + *imdata = *video; + video++; + imdata++; + LeftInSegment--; + } + } + } + +#endif +} + + + + +/*****************************************************************************/ +/* Blits a piece of one image to another. */ +/* NOTE: for our purposes, assumes that ImDest is to be in VGA memory. */ +/*****************************************************************************/ +void bltBitMap(struct Image *ImSource, + uint16 xs, + uint16 ys, + struct Image *ImDest, + uint16 xd, + uint16 yd, + uint16 width, + uint16 height) { +#if !defined(DOSCODE) + // I think the old code assumed that the source image data was valid for the given box. + // I will proceed on that assumption. + int sx, sy, dx, dy, w, h; + + sx = xs; + sy = ys; + dx = xd; + dy = yd; + w = width; + h = height; + + if (dx < 0) { + sx -= dx; + w += dx; + dx = 0; + } + + if (dy < 0) { + sy -= dy; + w += dy; + dy = 0; + } + + if (dx + w > ImDest->Width) w = ImDest->Width - dx; + + if (dy + h > ImDest->Height) h = ImDest->Height - dy; + + if (w > 0 && h > 0) { + byte *s = ImSource->ImageData + sy * ImSource->Width + sx; + byte *d = ImDest->ImageData + dy * ImDest->Width + dx; + + while (h-- > 0) { + memcpy(d, s, w); + s += ImSource->Width; + d += ImDest->Width; + } + } + +#else + uint32 RealOffset, + SegmentOffset, + LeftInSegment; + char *video, + *curdestline, + *cursourceline = ImSource->ImageData, + *imdata; + uint16 counterx, + countery = 0, + numwholelines, + numpartiallines, + curpage; + + cursourceline += (((int32) ys) * ImSource->Width) + xs; + imdata = cursourceline; + + while (countery < height) { + RealOffset = (ImDest->Width * (yd + countery)) + xd; + curpage = RealOffset / VGABytesPerPage; + SegmentOffset = RealOffset - (curpage * VGABytesPerPage); + LeftInSegment = VGABytesPerPage - SegmentOffset; + setPage(curpage); + + video = (char *)(((int32)(ImDest->ImageData)) + SegmentOffset); + + numwholelines = LeftInSegment / ImDest->Width; + numpartiallines = 0; + counterx = LeftInSegment - (numwholelines * ImDest->Width); + + if (counterx >= width) + numwholelines++; + else + numpartiallines = 1; + + while (numwholelines && (countery < height)) { + curdestline = video; + cursourceline = imdata; + + for (counterx = 0; counterx < width; counterx++) { + *video = *imdata; + video++; + imdata++; + } + + video = curdestline; + video += ImDest->Width; + imdata = cursourceline; + imdata += ImSource->Width; + + countery ++; + numwholelines --; + LeftInSegment -= ImDest->Width; + } + + if (numpartiallines && (countery < height)) { + countery ++; + curdestline = video; + cursourceline = imdata; + + for (counterx = 0; counterx < width; counterx++) { + if (LeftInSegment == 0L) { + setPage(curpage + 1); + LeftInSegment = VGABytesPerPage; + video = ImDest->ImageData; + } + + *video = *imdata; + video++; + imdata++; + LeftInSegment--; + } + + video = curdestline; + video += ImDest->Width; + imdata = cursourceline; + imdata += ImSource->Width; + } + } + +#endif +} + + +byte *TempScrollData; + + +/*****************************************************************************/ +/* Scrolls the display in the x direction by blitting. */ +/* The TempScrollData variable must be initialized to some memory, or this */ +/* function will fail. */ +/*****************************************************************************/ +void scrollDisplayX(int16 dx, + uint16 x1, + uint16 y1, + uint16 x2, + uint16 y2) { + struct Image Im; + uint16 temp; + + Im.ImageData = TempScrollData; + + if (x1 > x2) { + temp = x2; + x2 = x1; + x1 = temp; + } + + if (y1 > y2) { + temp = y2; + y2 = y1; + y1 = temp; + } + + if (dx > 0) { + Im.Width = x2 - x1 + 1 - dx; + Im.Height = y2 - y1 + 1; + + readScreenImage(&Im, x1, y1); + drawImage(&Im, x1 + dx, y1); + + setAPen(0); + rectFill(x1, y1, x1 + dx - 1, y2); + } else if (dx < 0) { + Im.Width = x2 - x1 + 1 + dx; + Im.Height = y2 - y1 + 1; + + readScreenImage(&Im, x1 - dx, y1); + drawImage(&Im, x1, y1); + + setAPen(0); + rectFill(x2 + dx + 1, y1, x2, y2); + } +} + + + + + +/*****************************************************************************/ +/* Scrolls the display in the y direction by blitting. */ +/*****************************************************************************/ +void scrollDisplayY(int16 dy, + uint16 x1, + uint16 y1, + uint16 x2, + uint16 y2) { + struct Image Im; + uint16 temp; + + Im.ImageData = TempScrollData; + + if (x1 > x2) { + temp = x2; + x2 = x1; + x1 = temp; + } + + if (y1 > y2) { + temp = y2; + y2 = y1; + y1 = temp; + } + + if (dy > 0) { + Im.Width = x2 - x1 + 1; + Im.Height = y2 - y1 + 1 - dy; + + readScreenImage(&Im, x1, y1); + drawImage(&Im, x1, y1 + dy); + + setAPen(0); + rectFill(x1, y1, x2, y1 + dy - 1); + } else if (dy < 0) { + Im.Width = x2 - x1 + 1; + Im.Height = y2 - y1 + 1 + dy; + + readScreenImage(&Im, x1, y1 - dy); + drawImage(&Im, x1, y1); + + setAPen(0); + rectFill(x1, y2 + dy + 1, x2, y2); + } +} + + + +static unsigned char curapen = 0; + +/*****************************************************************************/ +/* Sets the pen number to use on all the drawing operations. */ +/*****************************************************************************/ +void setAPen(uint16 pennum) { + curapen = (unsigned char)pennum; +} + + + + +/*****************************************************************************/ +/* Fills in a rectangle. */ +/*****************************************************************************/ +void rectFill(uint16 x1, + uint16 y1, + uint16 x2, + uint16 y2) { +#if !defined(DOSCODE) + int dx, dy, w, h; + + dx = x1; + dy = y1; + w = x2 - x1 + 1; + h = y2 - y1 + 1; + + if (dx < 0) { + w += dx; + dx = 0; + } + + if (dy < 0) { + w += dy; + dy = 0; + } + + if ((uint)(dx + w) > VGAScreenWidth) + w = VGAScreenWidth - dx; + + if ((uint)(dy + h) > VGAScreenHeight) + h = VGAScreenHeight - dy; + + if (w > 0 && h > 0) { + char *d = (char *)getVGABaseAddr() + dy * VGAScreenWidth + dx; + + while (h-- > 0) { + char *dd = d; + int ww = w; + + while (ww-- > 0) { + *dd++ = curapen; + } + + d += VGAScreenWidth; + } + + ungetVGABaseAddr(); + } + +#else + uint32 RealOffset, + SegmentOffset, + LeftInSegment; + char *video, + *curline; + uint16 counterx, + countery = y1, + numwholelines, + numpartiallines, + curpage; + + while (countery <= y2) { + RealOffset = (VGAScreenWidth * countery) + x1; + curpage = RealOffset / VGABytesPerPage; + SegmentOffset = RealOffset - (curpage * VGABytesPerPage); + LeftInSegment = VGABytesPerPage - SegmentOffset; + setPage(curpage); + video = (char *)(((int32)(VGABASEADDRESS)) + SegmentOffset); + + numwholelines = LeftInSegment / VGAScreenWidth; + numpartiallines = 0; + counterx = LeftInSegment - (numwholelines * VGAScreenWidth); + + if (counterx >= (x2 - x1 + 1)) + numwholelines++; + else + numpartiallines = 1; + + while (numwholelines && (countery <= y2)) { + curline = video; + + for (counterx = x1; counterx <= x2; counterx++) { + *video = curapen; + video++; + } + + video = curline; + video += VGAScreenWidth; + countery ++; + numwholelines --; + LeftInSegment -= VGAScreenWidth; + } + + if (numpartiallines && (countery <= y2)) { + countery ++; + curline = video; + + for (counterx = x1; counterx <= x2; counterx++) { + if (LeftInSegment == 0L) { + setPage(curpage + 1); + LeftInSegment = VGABytesPerPage; + video = (char *)(VGABASEADDRESS); + } + + *video = curapen; + video++; + LeftInSegment--; + } + } + } + +#endif +} + + + +/*****************************************************************************/ +/* Draws a horizontal line. */ +/*****************************************************************************/ +void drawVLine(uint16 x, + uint16 y1, + uint16 y2) { + rectFill(x, y1, x, y2); +} + + + + +/*****************************************************************************/ +/* Draws a vertical line. */ +/*****************************************************************************/ +void drawHLine(uint16 x1, + uint16 y, + uint16 x2) { + rectFill(x1, y, x2, y); +} + + + + +/*****************************************************************************/ +/* Ghoasts a region on the screen using the desired pen color. */ +/*****************************************************************************/ +void ghoastRect(uint16 pencolor, + uint16 x1, + uint16 y1, + uint16 x2, + uint16 y2) { +#if !defined(DOSCODE) + int dx, dy, w, h; + + dx = x1; + dy = y1; + w = x2 - x1 + 1; + h = y2 - y1 + 1; + + if (dx < 0) { + w += dx; + dx = 0; + } + + if (dy < 0) { + w += dy; + dy = 0; + } + + if ((uint)(dx + w) > VGAScreenWidth) + w = VGAScreenWidth - dx; + + if ((uint)(dy + h) > VGAScreenHeight) + h = VGAScreenHeight - dy; + + if (w > 0 && h > 0) { + char *d = (char *)getVGABaseAddr() + dy * VGAScreenWidth + dx; + + while (h-- > 0) { + char *dd = d; + int ww = w; + + if (dy & 1) { + dd++; + ww--; + } + + while (ww > 0) { + *dd = pencolor; + dd += 2; + ww -= 2; + } + + d += VGAScreenWidth; + dy++; + } + + ungetVGABaseAddr(); + } + +#else + uint32 RealOffset, + SegmentOffset; + int32 LeftInSegment; + char *video, + *curline; + uint16 counterx, + countery = y1, + numwholelines, + numpartiallines, + curpage; + + while (countery <= y2) { + RealOffset = (VGAScreenWidth * countery) + x1; + curpage = RealOffset / VGABytesPerPage; + SegmentOffset = RealOffset - (curpage * VGABytesPerPage); + LeftInSegment = VGABytesPerPage - SegmentOffset; + setPage(curpage); + video = (char *)(((int32)(VGABASEADDRESS)) + SegmentOffset); + + numwholelines = LeftInSegment / VGAScreenWidth; + numpartiallines = 0; + counterx = LeftInSegment - (numwholelines * VGAScreenWidth); + + if (counterx >= (x2 - x1 + 1)) + numwholelines++; + else + numpartiallines = 1; + + while (numwholelines && (countery <= y2)) { + curline = video; + counterx = x1; + + if (1 & countery) { + video++; + counterx ++; + } + + while (counterx <= x2) { + *video = pencolor; + video += 2; + counterx += 2; + } + + video = curline; + video += VGAScreenWidth; + countery ++; + numwholelines --; + LeftInSegment -= VGAScreenWidth; + } + + if (numpartiallines && (countery <= y2)) { + countery ++; + curline = video; + counterx = x1; + + if (1 & countery) { + video++; + counterx ++; + LeftInSegment --; + } + + while (counterx < x2) { + if (LeftInSegment <= 0L) { + setPage(curpage + 1); + video = (char *)(((int32)(VGABASEADDRESS)) - LeftInSegment); + LeftInSegment = VGABytesPerPage + LeftInSegment; + } + + *video = pencolor; + video += 2; + counterx += 2; + LeftInSegment -= 2; + } + } + } + +#endif +} + +} // End of namespace Lab diff --git a/engines/lab/vga.h b/engines/lab/vga.h new file mode 100644 index 0000000000..7080f4ae03 --- /dev/null +++ b/engines/lab/vga.h @@ -0,0 +1,100 @@ +/* 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. + * + */ + +/* + * This code is based on Labyrinth of Time code with assistance of + * + * Copyright (c) 1993 Terra Nova Development + * Copyright (c) 2004 The Wyrmkeep Entertainment Co. + * + */ + +#include "lab/stddefines.h" + +#ifndef LAB_VGA_H +#define LAB_VGA_H + +namespace Lab { + +struct Image { + uint16 Width; + uint16 Height; + byte *ImageData; +}; + +void setMode(char mode); + +void getMode(uint16 *Mode); + +void setPage(uint16 PageNum); + +void VGAStorePage(void); + +void VGARestorePage(void); + +bool createScreen(bool HiRes); + +void waitTOF(void); + +void quickWaitTOF(void); + +byte *getVGABaseAddr(void); + +#if !defined(DOSCODE) +void ungetVGABaseAddr(); +#endif + +void writeColorReg(char *buf, uint16 regnum); + +void writeColorRegs(char *buf, uint16 first, uint16 numreg); + +void writeColorRegsSmooth(char *buf, uint16 first, uint16 numreg); + +void VGASetPal(void *cmap, uint16 numcolors); + +/*---------- Drawing Routines ----------*/ + +void drawImage(struct Image *Im, uint16 x, uint16 y); + +void drawMaskImage(struct Image *Im, uint16 x, uint16 y); + +void readScreenImage(struct Image *Im, uint16 x, uint16 y); + +void bltBitMap(struct Image *ImSource, uint16 xs, uint16 ys, struct Image *ImDest, uint16 xd, uint16 yd, uint16 width, uint16 height); + +void scrollDisplayX(int16 dx, uint16 x1, uint16 y1, uint16 x2, uint16 y2); + +void scrollDisplayY(int16 dy, uint16 x1, uint16 y1, uint16 x2, uint16 y2); + +void setAPen(uint16 pennum); + +void drawHLine(uint16 x, uint16 y1, uint16 y2); + +void drawVLine(uint16 x1, uint16 y, uint16 x2); + +void rectFill(uint16 x1, uint16 y1, uint16 x2, uint16 y2); + +void ghoastRect(uint16 pencolor, uint16 x1, uint16 y1, uint16 x2, uint16 y2); + +} // End of namespace Lab + +#endif /* LAB_VGA_H */ -- cgit v1.2.3 From b396135a4db8ba9796803b98d648dea77269d8d3 Mon Sep 17 00:00:00 2001 From: Eugene Sandulenko Date: Tue, 9 Dec 2014 13:34:47 +0100 Subject: LAB: Fix compilation --- engines/lab/savegamepalmap.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/engines/lab/savegamepalmap.cpp b/engines/lab/savegamepalmap.cpp index 786a5571e6..a93b1c3506 100644 --- a/engines/lab/savegamepalmap.cpp +++ b/engines/lab/savegamepalmap.cpp @@ -32,7 +32,7 @@ namespace Lab { - const byte ThePalMap[] = { + extern const byte ThePalMap[] = { 0x73, 0x73, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x20, 0x20, 0x20, 0x23, 0x23, 0x23, 0x1E, 0xE3, 0xE3, 0xE3, 0xE3, 0xE3, 0xE3, 0xE2, 0xE2, 0xE2, 0xE2, 0xE2, 0xE2, 0xE1, -- cgit v1.2.3 From 11a7ffaabe89920b6481e0efeb744b5efc222996 Mon Sep 17 00:00:00 2001 From: Eugene Sandulenko Date: Sun, 14 Dec 2014 16:42:44 +0100 Subject: LAB: Started rendering pipeline --- engines/lab/savegamepalmap.cpp | 2 +- engines/lab/special.cpp | 4 +-- engines/lab/vga.cpp | 63 +++++++++++++++++++++++++++++++----------- engines/lab/vga.h | 2 ++ 4 files changed, 52 insertions(+), 19 deletions(-) diff --git a/engines/lab/savegamepalmap.cpp b/engines/lab/savegamepalmap.cpp index a93b1c3506..0678b7881c 100644 --- a/engines/lab/savegamepalmap.cpp +++ b/engines/lab/savegamepalmap.cpp @@ -19,7 +19,7 @@ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. * */ - + /* * This code is based on Labyrinth of Time code with assistance of * diff --git a/engines/lab/special.cpp b/engines/lab/special.cpp index 5542b05716..8275517f47 100644 --- a/engines/lab/special.cpp +++ b/engines/lab/special.cpp @@ -1224,7 +1224,7 @@ static void drawSaveLoad() { rectFill(274, 450, 274, 450); rectFill(274, 454, 276, 454); - g_system->updateScreen(); + WSDL_UpdateScreen(); } static void makeThumbnail(struct SaveGameInfo *info) { @@ -1535,7 +1535,7 @@ bool saveRestoreGame(void) { setAPen(0); rectFill(0, 0, VGAScreenWidth - 1, VGAScreenHeight - 1); blackScreen(); - g_system->updateScreen(); + WSDL_UpdateScreen(); journalCleanUp(); diff --git a/engines/lab/vga.cpp b/engines/lab/vga.cpp index 235d247145..728b15271e 100644 --- a/engines/lab/vga.cpp +++ b/engines/lab/vga.cpp @@ -43,6 +43,9 @@ uint32 VGAScreenWidth = 320UL, uint32 VGABASEADDRESS = 0xA0000L; +byte *g_DisplayBuffer = 0; +byte *g_Pixels = 0; + /*****************************************************************************/ /* Sets the display mode. */ @@ -61,6 +64,10 @@ bool createScreen(bool HiRes) { VGAScreenHeight = 480; VGAPages = 1; VGABytesPerPage = 640 * 480; + + g_DisplayBuffer = (byte *)malloc(VGABytesPerPage); + g_Pixels = (byte *)calloc(VGABytesPerPage, 4); + return true; } @@ -84,19 +91,27 @@ void VGARestorePage(void) { // does nothing in SDL } - -void waitTOF(void) { - warning("STUB: waitTOF"); - //WSDL_WaitTOF(1); +void WSDL_ProcessInput() { } +void waitTOF() { + int untilOutOfRefresh = 1; -// NOTE: I don't think this function is called anywhere in the code. -void waitTOFQuick(void) { - warning("STUB: waitTOFQuick"); - //WSDL_WaitTOF(0); -} + g_ScreenIsLocked = 0; + if (g_ScreenWasLocked || untilOutOfRefresh) { + g_system->copyRectToScreen(g_DisplayBuffer, VGAScreenWidth, 0, 0, VGAScreenWidth, VGAScreenHeight); + g_system->updateScreen(); + } + + g_ScreenWasLocked = 0; + WSDL_ProcessInput(); + + for (uint32 now = g_system->getMillis(); now - g_LastWaitTOFTicks <= 0xF; now = g_system->getMillis() ) + g_system->delayMillis(g_LastWaitTOFTicks - now + 17); + + g_LastWaitTOFTicks = now; +} static char curvgapal[256 * 3]; @@ -153,7 +168,28 @@ void VGASetPal(void *cmap, writeColorRegs((char *) cmap, 0, numcolors); } +byte *WSDL_LockVideo() { + g_ScreenWasLocked = 1; + g_ScreenIsLocked = 1; + return g_DisplayBuffer; +} + +void WSDL_UnlockVideo() { + g_ScreenIsLocked = 0; +} + +void WSDL_UpdateScreen() { + WSDL_UnlockVideo(); + + if (g_ScreenWasLocked && !g_IgnoreUpdateDisplay) { + g_system->copyRectToScreen(g_DisplayBuffer, VGAScreenWidth, 0, 0, VGAScreenWidth, VGAScreenHeight); + g_system->updateScreen(); + } + + g_ScreenWasLocked = 0; + WSDL_ProcessInput(0); +} /*****************************************************************************/ /* Returns the base address of the current VGA display. */ @@ -162,18 +198,13 @@ byte *getVGABaseAddr(void) { if (VGABASEADDRESS != 1) return (byte *)VGABASEADDRESS; - warning("STUB: getVGABaseAddr"); - return 0; // WSDL_LockVideo(); + return WSDL_LockVideo(); } -#if !defined(DOSCODE) void ungetVGABaseAddr() { - warning("STUB: ungetVGABaseAddr"); if (VGABASEADDRESS == 1) - ; //WSDL_UnlockVideo(); + WSDL_UnlockVideo(); } -#endif - /*****************************************************************************/ /* Gets information about the current display. */ diff --git a/engines/lab/vga.h b/engines/lab/vga.h index 7080f4ae03..6ed7347dcf 100644 --- a/engines/lab/vga.h +++ b/engines/lab/vga.h @@ -95,6 +95,8 @@ void rectFill(uint16 x1, uint16 y1, uint16 x2, uint16 y2); void ghoastRect(uint16 pencolor, uint16 x1, uint16 y1, uint16 x2, uint16 y2); +void WSDL_UpdateScreen(); + } // End of namespace Lab #endif /* LAB_VGA_H */ -- cgit v1.2.3 From bbddd32d38a03544ddab6e36e6853ddc128d0254 Mon Sep 17 00:00:00 2001 From: Eugene Sandulenko Date: Sun, 14 Dec 2014 17:46:40 +0100 Subject: LAB: Further rendering pipeline fixes --- engines/lab/engine.cpp | 54 +++++++++--------- engines/lab/graphics.cpp | 15 +++-- engines/lab/lab.cpp | 2 +- engines/lab/labmusic.cpp | 3 + engines/lab/map.cpp | 17 +++--- engines/lab/mouse.cpp | 6 +- engines/lab/processroom.cpp | 2 +- engines/lab/readdiff.cpp | 6 +- engines/lab/special.cpp | 15 ++--- engines/lab/stddefines.h | 2 +- engines/lab/vga.cpp | 132 ++++++++++++++++---------------------------- engines/lab/vga.h | 8 ++- 12 files changed, 116 insertions(+), 146 deletions(-) diff --git a/engines/lab/engine.cpp b/engines/lab/engine.cpp index b0b8614d74..3edf89631e 100644 --- a/engines/lab/engine.cpp +++ b/engines/lab/engine.cpp @@ -786,7 +786,7 @@ static void process(void) { CPtr = NULL; #if !defined(DOSCODE) mayShowCrumbIndicator(); - g_system->updateScreen(); + WSDL_UpdateScreen(); #endif } @@ -824,7 +824,7 @@ static void process(void) { #if !defined(DOSCODE) mayShowCrumbIndicator(); - g_system->updateScreen(); + WSDL_UpdateScreen(); if (!FollowingCrumbs) eatMessages(); @@ -838,7 +838,7 @@ static void process(void) { drawRoomMessage(CurInv, CPtr); ForceDraw = false; #if !defined(DOSCODE) - g_system->updateScreen(); + WSDL_UpdateScreen(); #endif } } @@ -878,13 +878,13 @@ static void process(void) { GotMessage = true; mayShowCrumbIndicator(); - g_system->updateScreen(); + WSDL_UpdateScreen(); goto from_crumbs; } } mayShowCrumbIndicator(); - g_system->updateScreen(); + WSDL_UpdateScreen(); #endif } else { GotMessage = true; @@ -918,7 +918,7 @@ from_crumbs: NumCrumbs = 0; DroppingCrumbs = true; mayShowCrumbIndicator(); - g_system->updateScreen(); + WSDL_UpdateScreen(); } else if (Code == 'f' || Code == 'F' || @@ -941,7 +941,7 @@ from_crumbs: interfaceOn(); /* Sets the correct gadget list */ drawPanel(); drawRoomMessage(CurInv, CPtr); - g_system->updateScreen(); + WSDL_UpdateScreen(); } } else { BreadCrumbs[0].RoomNum = 0; @@ -949,7 +949,7 @@ from_crumbs: // Need to hide indicator!!!! mayShowCrumbIndicatorOff(); - g_system->updateScreen(); + WSDL_UpdateScreen(); } } } @@ -1068,7 +1068,7 @@ from_crumbs: drawPanel(); drawRoomMessage(CurInv, CPtr); #if !defined(DOSCODE) - g_system->updateScreen(); + WSDL_UpdateScreen(); #endif } } @@ -1083,7 +1083,7 @@ from_crumbs: CPtr = NULL; #if !defined(DOSCODE) mayShowCrumbIndicator(); - g_system->updateScreen(); + WSDL_UpdateScreen(); #endif } @@ -1107,7 +1107,7 @@ from_crumbs: drawRoomMessage(CurInv, CPtr); #if !defined(DOSCODE) mayShowCrumbIndicator(); - g_system->updateScreen(); + WSDL_UpdateScreen(); #endif } else { Old = ActionMode; @@ -1130,7 +1130,7 @@ from_crumbs: drawMessage(LOOKWHAT); #if !defined(DOSCODE) - g_system->updateScreen(); + WSDL_UpdateScreen(); #endif } } @@ -1139,7 +1139,7 @@ from_crumbs: doUse(MAPNUM); #if !defined(DOSCODE) mayShowCrumbIndicator(); - g_system->updateScreen(); + WSDL_UpdateScreen(); #endif } @@ -1165,7 +1165,7 @@ from_crumbs: ForceDraw = true; #if !defined(DOSCODE) mayShowCrumbIndicator(); - g_system->updateScreen(); + WSDL_UpdateScreen(); #endif } else if (GadID == 7) { OldRoomNum = RoomNum; @@ -1241,7 +1241,7 @@ from_crumbs: } mayShowCrumbIndicator(); - g_system->updateScreen(); + WSDL_UpdateScreen(); #endif } } @@ -1261,7 +1261,7 @@ from_crumbs: drawPanel(); drawRoomMessage(CurInv, CPtr); #if !defined(DOSCODE) - g_system->updateScreen(); + WSDL_UpdateScreen(); #endif } @@ -1288,14 +1288,14 @@ from_crumbs: drawMessage("Disk operation failed."); VGASetPal(initcolors, 8); #if !defined(DOSCODE) - g_system->updateScreen(); + WSDL_UpdateScreen(); #endif g_system->delayMillis(1000); } #if !defined(DOSCODE) else { - g_system->updateScreen(); + WSDL_UpdateScreen(); } #endif @@ -1312,7 +1312,7 @@ from_crumbs: drawMessage(USEONWHAT); MainDisplay = true; #if !defined(DOSCODE) - g_system->updateScreen(); + WSDL_UpdateScreen(); #endif } } @@ -1332,7 +1332,7 @@ from_crumbs: Test = getInvName(CurInv); #if !defined(DOSCODE) - g_system->updateScreen(); + WSDL_UpdateScreen(); #endif } @@ -1342,7 +1342,7 @@ from_crumbs: DoNotDrawMessage = false; drawRoomMessage(CurInv, CPtr); #if !defined(DOSCODE) - g_system->updateScreen(); + WSDL_UpdateScreen(); #endif } @@ -1352,7 +1352,7 @@ from_crumbs: DoNotDrawMessage = false; drawRoomMessage(CurInv, CPtr); #if !defined(DOSCODE) - g_system->updateScreen(); + WSDL_UpdateScreen(); #endif } @@ -1362,7 +1362,7 @@ from_crumbs: NumCrumbs = 0; DroppingCrumbs = true; mayShowCrumbIndicator(); - g_system->updateScreen(); + WSDL_UpdateScreen(); } else if (GadID == 6) { /* follow crumbs */ @@ -1383,14 +1383,14 @@ from_crumbs: interfaceOn(); /* Sets the correct gadget list */ drawPanel(); drawRoomMessage(CurInv, CPtr); - g_system->updateScreen(); + WSDL_UpdateScreen(); } else { BreadCrumbs[0].RoomNum = 0; DroppingCrumbs = false; // Need to hide indicator!!!! mayShowCrumbIndicatorOff(); - g_system->updateScreen(); + WSDL_UpdateScreen(); } } } @@ -1474,7 +1474,7 @@ from_crumbs: #if !defined(DOSCODE) mayShowCrumbIndicator(); - g_system->updateScreen(); + WSDL_UpdateScreen(); #endif } @@ -1527,7 +1527,7 @@ from_crumbs: drawRoomMessage(CurInv, CPtr); #if !defined(DOSCODE) mayShowCrumbIndicator(); - g_system->updateScreen(); + WSDL_UpdateScreen(); #endif } } diff --git a/engines/lab/graphics.cpp b/engines/lab/graphics.cpp index bcaed9ceab..dba28113af 100644 --- a/engines/lab/graphics.cpp +++ b/engines/lab/graphics.cpp @@ -336,7 +336,8 @@ uint32 flowText(void *font, /* the TextAttr pointer */ } -extern uint32 VGABASEADDRESS, VGABytesPerPage; +extern uint32 VGABytesPerPage; +extern byte *VGABASEADDRESS; /******************************************************************************/ @@ -353,13 +354,15 @@ uint32 flowTextToMem(struct Image *DestIm, void *font, /* the TextAttr point uint16 x1, /* Cords */ uint16 y1, uint16 x2, uint16 y2, const char *str) { /* The text itself */ uint32 res, vgabyte = VGABytesPerPage; + byte *tmp = VGABASEADDRESS; - //VGABASEADDRESS = (uint32)(DestIm->ImageData); + VGABASEADDRESS = DestIm->ImageData; VGABytesPerPage = (uint32) DestIm->Width * (int32) DestIm->Height; res = flowText(font, spacing, pencolor, backpen, fillback, centerh, centerv, output, x1, y1, x2, y2, str); VGABytesPerPage = vgabyte; + VGABASEADDRESS = tmp; return res; } @@ -593,7 +596,7 @@ static void doScrollBlack(void) { setAPen(0); rectFill(0, nheight, width - 1, nheight + by - 1); - g_system->updateScreen(); + WSDL_UpdateScreen(); if (!IsHiRes) { if (nheight <= (height / 8)) @@ -695,7 +698,7 @@ static void doScrollWipe(char *filename) { copyPage(width, height, nheight, startline, mem); - g_system->updateScreen(); + WSDL_UpdateScreen(); if (!nheight) startline += by; @@ -741,7 +744,7 @@ static void doScrollBounce(void) { startline -= newby[counter]; copyPage(width, height, 0, startline, mem); - g_system->updateScreen(); + WSDL_UpdateScreen(); waitTOF(); } @@ -750,7 +753,7 @@ static void doScrollBounce(void) { startline += newby1[counter - 1]; copyPage(width, height, 0, startline, mem); - g_system->updateScreen(); + WSDL_UpdateScreen(); waitTOF(); } diff --git a/engines/lab/lab.cpp b/engines/lab/lab.cpp index edde50bb5d..7054072210 100644 --- a/engines/lab/lab.cpp +++ b/engines/lab/lab.cpp @@ -56,7 +56,7 @@ LabEngine::~LabEngine() { Common::Error LabEngine::run() { // Initialize graphics using following: - initGraphics(320, 200, false); + initGraphics(640, 480, true); g_music = new Music(); diff --git a/engines/lab/labmusic.cpp b/engines/lab/labmusic.cpp index e15dfa70f4..d7edc2b746 100644 --- a/engines/lab/labmusic.cpp +++ b/engines/lab/labmusic.cpp @@ -102,6 +102,9 @@ void Music::updateMusic(void) { void Music::fillbuffer(uint16 unit) { + return; + + warning("STUB: Music::fillbuffer"); uint32 Size = MUSICBUFSIZE; void *ptr = _musicBuffer[unit]; #if defined(DOSCODE) diff --git a/engines/lab/map.cpp b/engines/lab/map.cpp index f6e94990b5..d32154e700 100644 --- a/engines/lab/map.cpp +++ b/engines/lab/map.cpp @@ -60,7 +60,7 @@ extern uint16 RoomNum; /* the VGA palette. */ /*****************************************************************************/ void setAmigaPal(uint16 *pal, uint16 numcolors) { - char vgapal[16 * 3]; + byte vgapal[16 * 3]; uint16 counter, vgacount; if (numcolors > 16) @@ -69,11 +69,11 @@ void setAmigaPal(uint16 *pal, uint16 numcolors) { vgacount = 0; for (counter = 0; counter < numcolors; counter++) { - vgapal[vgacount] = (char)(((pal[counter] & 0xf00) >> 8) << 2); + vgapal[vgacount] = (byte)(((pal[counter] & 0xf00) >> 8) << 2); vgacount++; - vgapal[vgacount] = (char)(((pal[counter] & 0x0f0) >> 4) << 2); + vgapal[vgacount] = (byte)(((pal[counter] & 0x0f0) >> 4) << 2); vgacount++; - vgapal[vgacount] = (char)(((pal[counter] & 0x00f)) << 2); + vgapal[vgacount] = (byte)(((pal[counter] & 0x00f)) << 2); vgacount++; } @@ -733,7 +733,8 @@ static void drawMap(LargeSet RoomsFound, uint16 CurRoom, uint16 CurMsg, uint16 F void processMap(uint16 CurRoom, LargeSet RoomsFound) { uint32 Class, place = 1; uint16 Code, Qualifier, MouseX, MouseY, GadgetID, CurFloor, OldFloor, OldMsg, CurMsg, drawroom, x1, y1, x2, y2; - char *sptr, newcolor[3]; + char *sptr; + byte newcolor[3]; bool drawmap; struct IntuiMessage *Msg; @@ -894,7 +895,7 @@ void processMap(uint16 CurRoom, LargeSet RoomsFound) { } #if !defined(DOSCODE) - g_system->updateScreen(); + WSDL_UpdateScreen(); #endif } } @@ -935,7 +936,7 @@ void doMap(LargeSet RoomsFound, uint16 CurRoom) { mouseShow(); attachGadgetList(MapGadgetList); #if !defined(DOSCODE) - g_system->updateScreen(); + WSDL_UpdateScreen(); #endif processMap(CurRoom, RoomsFound); attachGadgetList(NULL); @@ -948,7 +949,7 @@ void doMap(LargeSet RoomsFound, uint16 CurRoom) { blackAllScreen(); mouseShow(); #if !defined(DOSCODE) - g_system->updateScreen(); + WSDL_UpdateScreen(); #endif } diff --git a/engines/lab/mouse.cpp b/engines/lab/mouse.cpp index 857a39726e..ff2474ed38 100644 --- a/engines/lab/mouse.cpp +++ b/engines/lab/mouse.cpp @@ -295,7 +295,7 @@ void updateMouse(void) { #if !defined(DOSCODE) if (doUpdateDisplay) - g_system->updateScreen(); + WSDL_UpdateScreen(); #endif } @@ -431,7 +431,7 @@ void mouseShowXY(uint16 MouseX, uint16 MouseY) { getBackMouse(); drawMouse(); #if !defined(DOSCODE) - g_system->updateScreen(); + WSDL_UpdateScreen(); #endif MouseHidden = false; } @@ -522,7 +522,7 @@ void mouseMove(uint16 x, uint16 y) { drawMouse(); VGARestorePage(); #if !defined(DOSCODE) - g_system->updateScreen(); + WSDL_UpdateScreen(); #endif QuitMouseHandler = false; } diff --git a/engines/lab/processroom.cpp b/engines/lab/processroom.cpp index 2af9fa05d9..d9f40b4e1d 100644 --- a/engines/lab/processroom.cpp +++ b/engines/lab/processroom.cpp @@ -629,7 +629,7 @@ static void doActions(ActionPtr APtr, CloseDataPtr *LCPtr) { addCurTime(APtr->Param1, 0, &StartSecs, &StartMicros); #if !defined(DOSCODE) - g_system->updateScreen(); + WSDL_UpdateScreen(); #endif while (1) { diff --git a/engines/lab/readdiff.cpp b/engines/lab/readdiff.cpp index 2af49e9f43..1ceeb44769 100644 --- a/engines/lab/readdiff.cpp +++ b/engines/lab/readdiff.cpp @@ -110,7 +110,7 @@ void unDiff(byte *NewBuf, byte *OldBuf, byte *DiffData, uint16 bytesperrow, bool } -static char blackbuffer[256 * 3]; +static byte blackbuffer[256 * 3]; /*****************************************************************************/ /* Changes the front screen to black. */ @@ -220,7 +220,7 @@ void diffNextFrame(void) { #if !defined(DOSCODE) if (DispBitMap->Flags & BITMAPF_VIDEO) - g_system->updateScreen(); + WSDL_UpdateScreen(); #endif @@ -366,7 +366,7 @@ void diffNextFrame(void) { ungetVGABaseAddr(); if (!didTOF) - g_system->updateScreen(); + WSDL_UpdateScreen(); #endif return; diff --git a/engines/lab/special.cpp b/engines/lab/special.cpp index 8275517f47..4e842a1de0 100644 --- a/engines/lab/special.cpp +++ b/engines/lab/special.cpp @@ -1284,10 +1284,9 @@ static void addSaveSlot() { makeThumbnail(info); mouseHide(); - warning("STUB: addSaveSlot()"); - //SDL_IgnoreUpdateDisplay(1); + WSDL_IgnoreUpdateDisplay(1); loadBackPict("P:ModSave", false); - //SDL_IgnoreUpdateDisplay(0); + WSDL_IgnoreUpdateDisplay(0); drawSaveLoad(); mouseShow(); } @@ -1299,10 +1298,9 @@ static void selectSave(int n) { g_CurSaveGameNumber = n; mouseHide(); - warning("STUB: selectSave()"); - //SDL_IgnoreUpdateDisplay(1); + WSDL_IgnoreUpdateDisplay(1); loadBackPict("P:ModSave", false); - //SDL_IgnoreUpdateDisplay(0); + WSDL_IgnoreUpdateDisplay(0); drawSaveLoad(); mouseShow(); } @@ -1312,10 +1310,9 @@ static void selectSaveSet(int n) { g_CurSaveSet = n; mouseHide(); - warning("STUB: selectSaveSet"); - //SDL_IgnoreUpdateDisplay(1); + WSDL_IgnoreUpdateDisplay(1); loadBackPict("P:ModSave", false); - //SDL_IgnoreUpdateDisplay(0); + WSDL_IgnoreUpdateDisplay(0); drawSaveLoad(); mouseShow(); } diff --git a/engines/lab/stddefines.h b/engines/lab/stddefines.h index b7e5fa6dda..cd3156fabd 100644 --- a/engines/lab/stddefines.h +++ b/engines/lab/stddefines.h @@ -38,7 +38,7 @@ namespace Lab { #define IS_MACOSX 1 -#define USE_SWAP 1 +#define USE_NOSWAP 1 #define INCL(BITSET,BIT) ((BITSET) |= (BIT)) diff --git a/engines/lab/vga.cpp b/engines/lab/vga.cpp index 728b15271e..8badc7072f 100644 --- a/engines/lab/vga.cpp +++ b/engines/lab/vga.cpp @@ -32,6 +32,8 @@ #include "lab/stddefines.h" #include "lab/storage.h" +#include "graphics/palette.h" + namespace Lab { //static uint16 NotInRefresh = 0; @@ -41,11 +43,15 @@ uint32 VGAScreenWidth = 320UL, VGAPages = 1UL, VGABytesPerPage = 65536UL; -uint32 VGABASEADDRESS = 0xA0000L; +byte *VGABASEADDRESS = 0; byte *g_DisplayBuffer = 0; byte *g_Pixels = 0; +int g_ScreenWasLocked = 0; +int g_IgnoreUpdateDisplay = 0; +int g_LastWaitTOFTicks = 0; + /*****************************************************************************/ /* Sets the display mode. */ @@ -58,8 +64,8 @@ void setMode(char mode) { /* Sets up either a low-res or a high-res 256 color screen. */ /*****************************************************************************/ bool createScreen(bool HiRes) { -// VGABASEADDRESS = (unsigned long)malloc(640 * 480); - VGABASEADDRESS = 1; + //VGABASEADDRESS = (unsigned long)malloc(640 * 480); + VGABASEADDRESS = 0; VGAScreenWidth = 640; VGAScreenHeight = 480; VGAPages = 1; @@ -91,29 +97,37 @@ void VGARestorePage(void) { // does nothing in SDL } -void WSDL_ProcessInput() { +void WSDL_ProcessInput(int state) { } void waitTOF() { int untilOutOfRefresh = 1; - g_ScreenIsLocked = 0; - if (g_ScreenWasLocked || untilOutOfRefresh) { g_system->copyRectToScreen(g_DisplayBuffer, VGAScreenWidth, 0, 0, VGAScreenWidth, VGAScreenHeight); g_system->updateScreen(); } g_ScreenWasLocked = 0; - WSDL_ProcessInput(); + WSDL_ProcessInput(0); - for (uint32 now = g_system->getMillis(); now - g_LastWaitTOFTicks <= 0xF; now = g_system->getMillis() ) + uint32 now; + + for (now = g_system->getMillis(); now - g_LastWaitTOFTicks <= 0xF; now = g_system->getMillis() ) g_system->delayMillis(g_LastWaitTOFTicks - now + 17); g_LastWaitTOFTicks = now; } -static char curvgapal[256 * 3]; +void WSDL_SetColors(byte *buf, uint16 first, uint16 numreg, uint16 slow) { + + g_system->getPaletteManager()->setPalette(buf, first, numreg); + + if (slow) + waitTOF(); +} + +static byte curvgapal[256 * 3]; /*****************************************************************************/ /* Writes any number of the 256 color registers. */ @@ -126,57 +140,41 @@ static char curvgapal[256 * 3]; /* The length of the buffer is 3 times the number of registers */ /* selected. */ /*****************************************************************************/ -void writeColorRegs(char *buf, - uint16 first, - uint16 numreg) { - warning("STUB: writeColorRegs"); - //WSDL_SetColors(buf, first, numreg, 0); +void writeColorRegs(byte *buf, uint16 first, uint16 numreg) { + WSDL_SetColors(buf, first, numreg, 0); memcpy(&(curvgapal[first * 3]), buf, numreg * 3); } - - - -void writeColorRegsSmooth(char *buf, - uint16 first, - uint16 numreg) { - warning("STUB: writeColorRegsSmooth"); - //WSDL_SetColors(buf, first, numreg, 1); +void writeColorRegsSmooth(byte *buf, uint16 first, uint16 numreg) { + WSDL_SetColors(buf, first, numreg, 1); memcpy(&(curvgapal[first * 3]), buf, numreg * 3); } - - - /*****************************************************************************/ /* Sets one of the 256 (0..255) color registers. buf is a char pointer, */ /* the first character in the string is the red value, then green, then */ /* blue. Each color value is a 6 bit value. */ /*****************************************************************************/ -void writeColorReg(char *buf, - uint16 regnum) { +void writeColorReg(byte *buf, uint16 regnum) { writeColorRegs(buf, regnum, 1); } - - - - -void VGASetPal(void *cmap, - uint16 numcolors) { +void VGASetPal(void *cmap, uint16 numcolors) { if (memcmp(cmap, curvgapal, numcolors * 3) != 0) - writeColorRegs((char *) cmap, 0, numcolors); + writeColorRegs((byte *)cmap, 0, numcolors); } byte *WSDL_LockVideo() { g_ScreenWasLocked = 1; - g_ScreenIsLocked = 1; return g_DisplayBuffer; } void WSDL_UnlockVideo() { - g_ScreenIsLocked = 0; +} + +void WSDL_IgnoreUpdateDisplay(int state) { + g_IgnoreUpdateDisplay = state; } void WSDL_UpdateScreen() { @@ -195,14 +193,14 @@ void WSDL_UpdateScreen() { /* Returns the base address of the current VGA display. */ /*****************************************************************************/ byte *getVGABaseAddr(void) { - if (VGABASEADDRESS != 1) - return (byte *)VGABASEADDRESS; + if (VGABASEADDRESS) + return VGABASEADDRESS; return WSDL_LockVideo(); } void ungetVGABaseAddr() { - if (VGABASEADDRESS == 1) + if (!VGABASEADDRESS) WSDL_UnlockVideo(); } @@ -213,15 +211,10 @@ void getMode(uint16 *Mode) { // Only one mode in SDL. } - - - /*****************************************************************************/ /* Draws an image to the screen. */ /*****************************************************************************/ -void drawImage(struct Image *Im, - uint16 x, - uint16 y) { +void drawImage(struct Image *Im, uint16 x, uint16 y) { #if !defined(DOSCODE) int sx, sy, dx, dy, w, h; @@ -337,9 +330,7 @@ void drawImage(struct Image *Im, /*****************************************************************************/ /* Draws an image to the screen. */ /*****************************************************************************/ -void drawMaskImage(struct Image *Im, - uint16 x, - uint16 y) { +void drawMaskImage(struct Image *Im, uint16 x, uint16 y) { #if !defined(DOSCODE) int sx, sy, dx, dy, w, h; @@ -469,9 +460,7 @@ void drawMaskImage(struct Image *Im, /*****************************************************************************/ /* Reads an image from the screen. */ /*****************************************************************************/ -void readScreenImage(struct Image *Im, - uint16 x, - uint16 y) { +void readScreenImage(struct Image *Im, uint16 x, uint16 y) { #if !defined(DOSCODE) int sx, sy, dx, dy, w, h; @@ -588,14 +577,8 @@ void readScreenImage(struct Image *Im, /* Blits a piece of one image to another. */ /* NOTE: for our purposes, assumes that ImDest is to be in VGA memory. */ /*****************************************************************************/ -void bltBitMap(struct Image *ImSource, - uint16 xs, - uint16 ys, - struct Image *ImDest, - uint16 xd, - uint16 yd, - uint16 width, - uint16 height) { +void bltBitMap(Image *ImSource, uint16 xs, uint16 ys, Image *ImDest, + uint16 xd, uint16 yd, uint16 width, uint16 height) { #if !defined(DOSCODE) // I think the old code assumed that the source image data was valid for the given box. // I will proceed on that assumption. @@ -727,11 +710,7 @@ byte *TempScrollData; /* The TempScrollData variable must be initialized to some memory, or this */ /* function will fail. */ /*****************************************************************************/ -void scrollDisplayX(int16 dx, - uint16 x1, - uint16 y1, - uint16 x2, - uint16 y2) { +void scrollDisplayX(int16 dx, uint16 x1, uint16 y1, uint16 x2, uint16 y2) { struct Image Im; uint16 temp; @@ -777,11 +756,7 @@ void scrollDisplayX(int16 dx, /*****************************************************************************/ /* Scrolls the display in the y direction by blitting. */ /*****************************************************************************/ -void scrollDisplayY(int16 dy, - uint16 x1, - uint16 y1, - uint16 x2, - uint16 y2) { +void scrollDisplayY(int16 dy, uint16 x1, uint16 y1, uint16 x2, uint16 y2) { struct Image Im; uint16 temp; @@ -837,10 +812,7 @@ void setAPen(uint16 pennum) { /*****************************************************************************/ /* Fills in a rectangle. */ /*****************************************************************************/ -void rectFill(uint16 x1, - uint16 y1, - uint16 x2, - uint16 y2) { +void rectFill(uint16 x1, uint16 y1, uint16 x2, uint16 y2) { #if !defined(DOSCODE) int dx, dy, w, h; @@ -952,9 +924,7 @@ void rectFill(uint16 x1, /*****************************************************************************/ /* Draws a horizontal line. */ /*****************************************************************************/ -void drawVLine(uint16 x, - uint16 y1, - uint16 y2) { +void drawVLine(uint16 x, uint16 y1, uint16 y2) { rectFill(x, y1, x, y2); } @@ -964,9 +934,7 @@ void drawVLine(uint16 x, /*****************************************************************************/ /* Draws a vertical line. */ /*****************************************************************************/ -void drawHLine(uint16 x1, - uint16 y, - uint16 x2) { +void drawHLine(uint16 x1, uint16 y, uint16 x2) { rectFill(x1, y, x2, y); } @@ -976,11 +944,7 @@ void drawHLine(uint16 x1, /*****************************************************************************/ /* Ghoasts a region on the screen using the desired pen color. */ /*****************************************************************************/ -void ghoastRect(uint16 pencolor, - uint16 x1, - uint16 y1, - uint16 x2, - uint16 y2) { +void ghoastRect(uint16 pencolor, uint16 x1, uint16 y1, uint16 x2, uint16 y2) { #if !defined(DOSCODE) int dx, dy, w, h; diff --git a/engines/lab/vga.h b/engines/lab/vga.h index 6ed7347dcf..fc5f981531 100644 --- a/engines/lab/vga.h +++ b/engines/lab/vga.h @@ -63,11 +63,11 @@ byte *getVGABaseAddr(void); void ungetVGABaseAddr(); #endif -void writeColorReg(char *buf, uint16 regnum); +void writeColorReg(byte *buf, uint16 regnum); -void writeColorRegs(char *buf, uint16 first, uint16 numreg); +void writeColorRegs(byte *buf, uint16 first, uint16 numreg); -void writeColorRegsSmooth(char *buf, uint16 first, uint16 numreg); +void writeColorRegsSmooth(byte *buf, uint16 first, uint16 numreg); void VGASetPal(void *cmap, uint16 numcolors); @@ -97,6 +97,8 @@ void ghoastRect(uint16 pencolor, uint16 x1, uint16 y1, uint16 x2, uint16 y2); void WSDL_UpdateScreen(); +void WSDL_IgnoreUpdateDisplay(int state); + } // End of namespace Lab #endif /* LAB_VGA_H */ -- cgit v1.2.3 From dfa0a1ef0b23e0343ddf98c545cdae2a51d85c77 Mon Sep 17 00:00:00 2001 From: Eugene Sandulenko Date: Sun, 14 Dec 2014 22:23:02 +0100 Subject: LAB: Implement openFile(), first gfx output! --- engines/lab/labfile.cpp | 89 +++++++------------------------------------------ 1 file changed, 12 insertions(+), 77 deletions(-) diff --git a/engines/lab/labfile.cpp b/engines/lab/labfile.cpp index 90db66fcbb..adef2f07d4 100644 --- a/engines/lab/labfile.cpp +++ b/engines/lab/labfile.cpp @@ -222,97 +222,32 @@ bool allocFile(void **Ptr, uint32 Size, const char *fileName) { /* Reads a file into memory. */ /*****************************************************************************/ byte **openFile(const char *name) { - warning("STUB: openFile"); + byte *buf; - return NULL; -#if 0 - char *tempbuffer, *Buffer; - int32 Size, Left; - int FPtr, ReadSize, myread; - - ReadSoFar = 0L; - ReadIsError = false; - ReadIsDone = false; - - if ((buffer == NULL) || (name == NULL)) { - ReadIsError = true; - ReadIsDone = true; - return NULL; - } + Common::File file; - Size = sizeOfFile(name); + file.open(translateFileName(name)); + if (!file.isOpen()) { + warning("Cannot open file %s", translateFileName(name)); - if (!Size || (Size > ((int32) buffersize))) { ReadIsError = true; ReadIsDone = true; return NULL; } - if (allocFile((void **) &Buffer, Size, name)) { /* Get place in Buffer */ - *startoffile = Buffer; /* If the file is buffered */ + uint32 size = file.size(); - ReadSoFar = Size; - ReadIsError = false; - ReadIsDone = true; + buf = (byte *)malloc(size); - return startoffile; + if (!buf) { + error("Unable to allocate %d bytes file file %s", size, name); } -#if defined(WIN32) -#if defined(DEMODATA) - { - FILE *fh = fopen("c:\\depot\\labyrinth\\demodata.log", "a+w"); - fprintf(fh, "%s\n", name); - fclose(fh); - } -#endif - - FPtr = open(translateFileName(name), O_RDONLY | O_BINARY); -#else - FPtr = open(translateFileName(name), O_RDONLY); -#endif - - if (FPtr != -1) { - Left = Size; - tempbuffer = Buffer; - *startoffile = Buffer; - - while (Left) { - fileCheckMusic(Left); - - if (Left > MAXREADSIZE) - ReadSize = MAXREADSIZE; - else - ReadSize = (int) Left; - - if (!(myread = read(FPtr, tempbuffer, ReadSize + DMABUGSIZE))) { - ReadIsError = false; - ReadIsDone = true; - - close(FPtr); - return NULL; - } + *startoffile = buf; - /* Not necessary for IBM version - if ((ReadSize == MAXREADSIZE) && DMABUGSIZE) - Seek(FPtr, -DMABUGSIZE, (int32) OFFSET_CURRENT); - */ + file.read(buf, size); - ReadSoFar += ReadSize; - tempbuffer += ReadSize; - Left -= ReadSize; - } - - ReadIsDone = true; - close(FPtr); - return startoffile; - } else { - ReadIsError = false; - ReadIsDone = true; - - return NULL; - } -#endif + return startoffile; } -- cgit v1.2.3 From 0dbcb7160c78ed8697afbdd87182f1a52b497824 Mon Sep 17 00:00:00 2001 From: Eugene Sandulenko Date: Fri, 19 Dec 2014 22:41:08 +0100 Subject: LAB: Added input --- engines/lab/engine.cpp | 3 +- engines/lab/interface.cpp | 4 +- engines/lab/machine.cpp | 2 +- engines/lab/mouse.h | 2 + engines/lab/vga.cpp | 126 +++++++++++++++++++++++++++++++++++++++++++++- engines/lab/vga.h | 8 +++ 6 files changed, 139 insertions(+), 6 deletions(-) diff --git a/engines/lab/engine.cpp b/engines/lab/engine.cpp index 3edf89631e..184b7e0669 100644 --- a/engines/lab/engine.cpp +++ b/engines/lab/engine.cpp @@ -860,8 +860,7 @@ static void process(void) { if (result != 0) { int x = 0, y = 0; - warning("STUB: getMousePos()"); - //SDL_GetMousePos(&x, &y); + WSDL_GetMousePos(&x, &y); Class = GADGETUP; Qualifier = 0; diff --git a/engines/lab/interface.cpp b/engines/lab/interface.cpp index 91111ae949..acf7c8b13d 100644 --- a/engines/lab/interface.cpp +++ b/engines/lab/interface.cpp @@ -169,8 +169,8 @@ static struct Gadget *checkNumGadgetHit(struct Gadget *gadlist, uint16 key) { /* Checks whether or not a key has been pressed. */ /*****************************************************************************/ static bool keyPress(uint16 *KeyCode) { - if (_keyPressed.keycode) { - *KeyCode = _keyPressed.keycode; + if (WSDL_HasNextChar()) { + *KeyCode = WSDL_GetNextChar(); return true; } diff --git a/engines/lab/machine.cpp b/engines/lab/machine.cpp index ab46ce600e..da8744a9f5 100644 --- a/engines/lab/machine.cpp +++ b/engines/lab/machine.cpp @@ -248,7 +248,7 @@ uint16 swapUShort(uint16 value) { b[1] = t; return value; } -uint16 *swapUShortPtr(uint16 *ptr, int count) { +uint16 *wapUShortPtsr(uint16 *ptr, int count) { while (count-- > 0) { char *b = (char *)ptr++; char t = b[0]; diff --git a/engines/lab/mouse.h b/engines/lab/mouse.h index e8bc7bfb7c..108afc219d 100644 --- a/engines/lab/mouse.h +++ b/engines/lab/mouse.h @@ -57,6 +57,8 @@ Gadget *mouseGadget(void); void attachGadgetList(struct Gadget *GadList); +void mouse_handler(int32 max, int32 mcx, int32 mdx); + } // End of namespace Lab #endif /* LAB_MOUSE_H */ diff --git a/engines/lab/vga.cpp b/engines/lab/vga.cpp index 8badc7072f..c8960a49fe 100644 --- a/engines/lab/vga.cpp +++ b/engines/lab/vga.cpp @@ -31,9 +31,12 @@ #include "lab/vga.h" #include "lab/stddefines.h" #include "lab/storage.h" +#include "lab/mouse.h" #include "graphics/palette.h" +#include "common/events.h" + namespace Lab { //static uint16 NotInRefresh = 0; @@ -52,6 +55,13 @@ int g_ScreenWasLocked = 0; int g_IgnoreUpdateDisplay = 0; int g_LastWaitTOFTicks = 0; +int g_MouseX = 0; +int g_MouseY = 0; + +uint16 g_NextKeyIn = 0; +uint16 g_KeyBuf[64]; +uint16 g_NextKeyOut = 0; +bool g_MouseAtEdge = false; /*****************************************************************************/ /* Sets the display mode. */ @@ -97,9 +107,123 @@ void VGARestorePage(void) { // does nothing in SDL } -void WSDL_ProcessInput(int state) { +void changeVolume(int delta) { + warning("STUB: changeVolume()"); +} + +uint16 WSDL_GetNextChar() { + uint16 c = 0; + + WSDL_ProcessInput(0); + if (g_NextKeyIn != g_NextKeyOut) { + c = g_KeyBuf[g_NextKeyOut]; + g_NextKeyOut = ((((unsigned int)((g_NextKeyOut + 1) >> 31) >> 26) + (byte)g_NextKeyOut + 1) & 0x3F) + - ((unsigned int)((g_NextKeyOut + 1) >> 31) >> 26); + } + + return c; +} + +bool WSDL_HasNextChar() { + WSDL_ProcessInput(0); + return g_NextKeyIn != g_NextKeyOut; +} + +void WSDL_ProcessInput(bool can_delay) { + int n; + int lastMouseAtEdge; + int flags = 0; + + Common::Event event; + + if (1 /*!g_IgnoreProcessInput*/) { + while (g_system->getEventManager()->pollEvent(event)) { + switch (event.type) { + case Common::EVENT_RBUTTONDOWN: + flags |= 8; + mouse_handler(flags, g_MouseX, g_MouseY); + break; + + case Common::EVENT_LBUTTONDOWN: + flags |= 2; + mouse_handler(flags, g_MouseX, g_MouseY); + break; + + case Common::EVENT_MOUSEMOVE: + lastMouseAtEdge = g_MouseAtEdge; + g_MouseAtEdge = false; + g_MouseX = event.mouse.x; + if (event.mouse.x <= 0) { + g_MouseX = 0; + g_MouseAtEdge = true; + } + if (g_MouseX > 639) { + g_MouseX = 640; + g_MouseAtEdge = true; + } + + g_MouseY = event.mouse.y; + if (event.mouse.y <= 0) { + g_MouseY = 0; + g_MouseAtEdge = true; + } + if (g_MouseY > 479) { + g_MouseY = 480; + g_MouseAtEdge = true; + } + + if (!lastMouseAtEdge || !g_MouseAtEdge) + mouse_handler(1, g_MouseX, g_MouseY); + + break; + + case Common::EVENT_KEYDOWN: + switch (event.kbd.keycode) { + case Common::KEYCODE_LEFTBRACKET: + changeVolume(-1); + break; + + case Common::KEYCODE_RIGHTBRACKET: + changeVolume(1); + break; + + case Common::KEYCODE_z: + //saveSettings(); + break; + + default: + n = ((((unsigned int)((g_NextKeyIn + 1) >> 31) >> 26) + (byte)g_NextKeyIn + 1) & 0x3F) + - ((unsigned int)((g_NextKeyIn + 1) >> 31) >> 26); + if (n != g_NextKeyOut) { + g_KeyBuf[g_NextKeyIn] = event.kbd.keycode; + g_NextKeyIn = n; + } + } + break; + + case Common::EVENT_QUIT: + case Common::EVENT_RTL: + default: + break; + } + + g_system->copyRectToScreen(g_DisplayBuffer, VGAScreenWidth, 0, 0, VGAScreenWidth, VGAScreenHeight); + g_system->updateScreen(); + } + } + + if (can_delay) + g_system->delayMillis(10); +} + +void WSDL_GetMousePos(int *x, int *y) { + WSDL_ProcessInput(0); + + *x = g_MouseX; + *y = g_MouseY; } + void waitTOF() { int untilOutOfRefresh = 1; diff --git a/engines/lab/vga.h b/engines/lab/vga.h index fc5f981531..a0b2f6314d 100644 --- a/engines/lab/vga.h +++ b/engines/lab/vga.h @@ -99,6 +99,14 @@ void WSDL_UpdateScreen(); void WSDL_IgnoreUpdateDisplay(int state); +void WSDL_GetMousePos(int *x, int *y); + +uint16 WSDL_GetNextChar(); + +bool WSDL_HasNextChar(); + +void WSDL_ProcessInput(bool can_delay); + } // End of namespace Lab #endif /* LAB_VGA_H */ -- cgit v1.2.3 From 78b46fb026d0a504212d6600a12fabc2ad3231cb Mon Sep 17 00:00:00 2001 From: Eugene Sandulenko Date: Fri, 19 Dec 2014 22:43:16 +0100 Subject: LAB: fix input processing --- engines/lab/engine.cpp | 7 +------ 1 file changed, 1 insertion(+), 6 deletions(-) diff --git a/engines/lab/engine.cpp b/engines/lab/engine.cpp index 184b7e0669..91132e6d01 100644 --- a/engines/lab/engine.cpp +++ b/engines/lab/engine.cpp @@ -719,11 +719,6 @@ int didintro = false; // change to int do labw.c can access #endif static bool novesa = false, noaudio = false; - -void processEvents() { - warning("STUB: processEvents()"); -} - /******************************************************************************/ /* Processes user input events. */ /******************************************************************************/ @@ -771,7 +766,7 @@ static void process(void) { /* Set up initial picture. */ while (1) { - processEvents(); + WSDL_ProcessInput(1); if (GotMessage) { if (QuitLab) { -- cgit v1.2.3 From bff3cc390f56defe9b2e7debc046e0a1673fe413 Mon Sep 17 00:00:00 2001 From: Eugene Sandulenko Date: Fri, 19 Dec 2014 22:46:40 +0100 Subject: LAB: Fix game palette --- engines/lab/vga.cpp | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/engines/lab/vga.cpp b/engines/lab/vga.cpp index c8960a49fe..9fb9f99d95 100644 --- a/engines/lab/vga.cpp +++ b/engines/lab/vga.cpp @@ -244,8 +244,13 @@ void waitTOF() { } void WSDL_SetColors(byte *buf, uint16 first, uint16 numreg, uint16 slow) { + byte tmp[256 * 3]; - g_system->getPaletteManager()->setPalette(buf, first, numreg); + for (int i = 0; i < 256 * 3; i++) { + tmp[i] = buf[i] * 4; + } + + g_system->getPaletteManager()->setPalette(tmp, first, numreg); if (slow) waitTOF(); -- cgit v1.2.3 From 62ceb496a926d4b906f3c276797bb3ab4c47829c Mon Sep 17 00:00:00 2001 From: Eugene Sandulenko Date: Sat, 20 Dec 2014 21:39:27 +0100 Subject: LAB: Cleanup --- engines/lab/labmusic.cpp | 16 ++++++---------- engines/lab/storage.cpp | 33 --------------------------------- engines/lab/storage.h | 4 ---- 3 files changed, 6 insertions(+), 47 deletions(-) diff --git a/engines/lab/labmusic.cpp b/engines/lab/labmusic.cpp index d7edc2b746..9fcee09c20 100644 --- a/engines/lab/labmusic.cpp +++ b/engines/lab/labmusic.cpp @@ -270,21 +270,17 @@ bool Music::initMusic(void) { else filename = "Music:BackGrou"; - mem = true; - if (_musicBuffer[0] == NULL) { for (counter = 0; counter < _manyBuffers; counter++) - mem = mem && allocatedos((void **) & (_musicBuffer[counter]), MUSICBUFSIZE); + _musicBuffer[counter] = malloc(MUSICBUFSIZE); } - if (mem) { - _filelength = sizeOfFile(filename); - _file = openPartial(filename); + _filelength = sizeOfFile(filename); + _file = openPartial(filename); - if (_file) { - startMusic(true); - return true; - } + if (_file) { + startMusic(true); + return true; } _musicOn = false; diff --git a/engines/lab/storage.cpp b/engines/lab/storage.cpp index 0d21b937c9..a94d21c7ea 100644 --- a/engines/lab/storage.cpp +++ b/engines/lab/storage.cpp @@ -45,39 +45,6 @@ bool allocate(void **Ptr, uint32 Size) { } - - -/*****************************************************************************/ -/* Allocates a piece of chip memory. */ -/*****************************************************************************/ -bool allocatechip(void **Ptr, uint32 Size) { - return allocate(Ptr, Size); -} - -/*****************************************************************************/ -/* Allocates a chunk of dos memory. */ -/*****************************************************************************/ -bool allocatedos(void **Ptr, uint32 Size) { -#if defined(DOSCODE) - static union REGS regs; - - regs.x.eax = 0x100; - regs.x.ebx = (Size >> 4); - int386(0x31, ®s, ®s); - - if (regs.x.cflag) { - *Ptr = NULL; - return false; - } - - *Ptr = (char *)((regs.x.eax & 0xFFFF) << 4); - return (*Ptr != NULL); -#else - *Ptr = malloc(Size); - return (*Ptr != NULL); -#endif -} - /*****************************************************************************/ /* Deallocates a piece of memory. */ /*****************************************************************************/ diff --git a/engines/lab/storage.h b/engines/lab/storage.h index bb14bef23c..c93c58c79a 100644 --- a/engines/lab/storage.h +++ b/engines/lab/storage.h @@ -37,10 +37,6 @@ namespace Lab { bool allocate(void **Ptr, uint32 Size); -bool allocatechip(void **Ptr, uint32 Size); - -bool allocatedos(void **Ptr, uint32 Size); - void deallocate(void *Ptr, uint32 Size); } // End of namespace Lab -- cgit v1.2.3 From 3a8cafa41ec8a91fa7e5cc34d0307af52f141fcb Mon Sep 17 00:00:00 2001 From: Eugene Sandulenko Date: Sun, 21 Dec 2014 09:11:59 +0100 Subject: LAB: Kill storage.h --- engines/lab/allocroom.cpp | 7 +++--- engines/lab/engine.cpp | 17 +++++++------- engines/lab/interface.cpp | 5 ++--- engines/lab/labfile.cpp | 6 ++--- engines/lab/labmusic.cpp | 1 - engines/lab/labsets.cpp | 7 +++--- engines/lab/labtext.cpp | 5 ++--- engines/lab/map.cpp | 3 +-- engines/lab/module.mk | 1 - engines/lab/readparse.cpp | 5 ++--- engines/lab/storage.cpp | 56 ----------------------------------------------- engines/lab/storage.h | 44 ------------------------------------- engines/lab/text.cpp | 11 +++++----- engines/lab/vga.cpp | 1 - 14 files changed, 28 insertions(+), 141 deletions(-) delete mode 100644 engines/lab/storage.cpp delete mode 100644 engines/lab/storage.h diff --git a/engines/lab/allocroom.cpp b/engines/lab/allocroom.cpp index 208d7ce8c3..8ca69effbc 100644 --- a/engines/lab/allocroom.cpp +++ b/engines/lab/allocroom.cpp @@ -28,9 +28,8 @@ * */ -#include "lab/storage.h" -#include "lab/parsetypes.h" #include "lab/stddefines.h" +#include "lab/parsetypes.h" namespace Lab { @@ -65,7 +64,7 @@ bool initRoomBuffer(void) { CurMarker = 0; - if (allocate((void **)&RoomBuffer, ROOMBUFFERSIZE)) { + if ((RoomBuffer = calloc(ROOMBUFFERSIZE, 1))) { MemPlace = RoomBuffer; MemLeftInBuffer = ROOMBUFFERSIZE; @@ -85,7 +84,7 @@ bool initRoomBuffer(void) { /*****************************************************************************/ void freeRoomBuffer(void) { if (RoomBuffer) - deallocate(RoomBuffer, ROOMBUFFERSIZE); + free(RoomBuffer); } diff --git a/engines/lab/engine.cpp b/engines/lab/engine.cpp index 91132e6d01..83bf3964a3 100644 --- a/engines/lab/engine.cpp +++ b/engines/lab/engine.cpp @@ -34,7 +34,6 @@ #include "lab/vga.h" #include "lab/timing.h" #include "lab/text.h" -#include "lab/storage.h" #include "lab/parsefun.h" #include "lab/interface.h" #include "lab/mouse.h" @@ -264,7 +263,7 @@ bool setUpScreens(void) { if (MovePanelBufferSize == 0L) return false; - if (!allocate((void **) &MovePanelBuffer, MovePanelBufferSize)) + if (!(MovePanelBuffer = (byte *)calloc(MovePanelBufferSize, 1))) return false; Common::File *file = openPartial("P:Control"); @@ -329,7 +328,7 @@ bool setUpScreens(void) { if (InvPanelBufferSize == 0L) return false; - if (!allocate((void **) &InvPanelBuffer, InvPanelBufferSize)) + if (!(InvPanelBuffer = (byte *)calloc(InvPanelBufferSize, 1))) return false; file = openPartial("P:Inv"); @@ -1010,8 +1009,8 @@ from_crumbs: IsHiRes = !IsHiRes; - deallocate(MovePanelBuffer, MovePanelBufferSize); - deallocate(InvPanelBuffer, InvPanelBufferSize); + free(MovePanelBuffer); + free(InvPanelBuffer); freeButtonList(MoveGadgetList); freeButtonList(InvGadgetList); MoveGadgetList = NULL; @@ -1534,18 +1533,18 @@ from_crumbs: deleteSet(RoomsFound); if (Rooms) - deallocate(Rooms, (ManyRooms + 1) * sizeof(RoomData)); + free(Rooms); if (Inventory) { for (Code = 1; Code <= NumInv; Code++) { if (Inventory[Code].name) - deallocate(Inventory[Code].name, strlen(Inventory[Code].name) + 1); + free(Inventory[Code].name); if (Inventory[Code].BInvName) - deallocate(Inventory[Code].BInvName, strlen(Inventory[Code].BInvName) + 1); + free(Inventory[Code].BInvName); } - deallocate(Inventory, (NumInv + 1) * sizeof(InventoryData)); + free(Inventory); } } diff --git a/engines/lab/interface.cpp b/engines/lab/interface.cpp index acf7c8b13d..859277c9c7 100644 --- a/engines/lab/interface.cpp +++ b/engines/lab/interface.cpp @@ -30,7 +30,6 @@ #include "lab/stddefines.h" #include "lab/interface.h" -#include "lab/storage.h" #include "lab/timing.h" #include "lab/mouse.h" #include "lab/vga.h" @@ -45,7 +44,7 @@ Common::KeyState _keyPressed; struct Gadget *createButton(uint16 x, uint16 y, uint16 id, uint16 key, Image *im, Image *imalt) { Gadget *gptr; - if (allocate((void **)&gptr, sizeof(struct Gadget))) { + if ((gptr = (Gadget *)calloc(sizeof(struct Gadget), 1))) { gptr->x = x; gptr->y = y; gptr->GadgetID = id; @@ -71,7 +70,7 @@ void freeButtonList(Gadget *gptrlist) { gptr = next; next = next->NextGadget; - deallocate(gptr, sizeof(struct Gadget)); + free(gptr); } } diff --git a/engines/lab/labfile.cpp b/engines/lab/labfile.cpp index adef2f07d4..e4045b5801 100644 --- a/engines/lab/labfile.cpp +++ b/engines/lab/labfile.cpp @@ -30,7 +30,6 @@ #include "lab/labfun.h" #include "lab/mouse.h" -#include "lab/storage.h" #include "common/file.h" namespace Lab { @@ -306,8 +305,7 @@ void resetBuffer(void) { /* Initializes the buffer. */ /*****************************************************************************/ bool initBuffer(uint32 BufSize, bool IsGraphicsMem) { - if (!allocate((void **) &buffer, BufSize)) - buffer = NULL; + buffer = (byte *)calloc(BufSize, 1); buffersize = BufSize; realbuffersize = buffersize; @@ -328,7 +326,7 @@ void freeBuffer(void) { freeAllStolenMem(); if (buffer) - deallocate(buffer, buffersize); + free(buffer); } diff --git a/engines/lab/labmusic.cpp b/engines/lab/labmusic.cpp index 9fcee09c20..ac7ba70d13 100644 --- a/engines/lab/labmusic.cpp +++ b/engines/lab/labmusic.cpp @@ -29,7 +29,6 @@ */ #include "lab/stddefines.h" -#include "lab/storage.h" #include "lab/labfun.h" #include "lab/timing.h" #include "lab/mouse.h" diff --git a/engines/lab/labsets.cpp b/engines/lab/labsets.cpp index 5faf1cce8a..c6f3d330b4 100644 --- a/engines/lab/labsets.cpp +++ b/engines/lab/labsets.cpp @@ -30,7 +30,6 @@ #include "lab/stddefines.h" #include "lab/labfun.h" -#include "lab/storage.h" namespace Lab { @@ -44,7 +43,7 @@ const uint32 LargeSetSIZE = sizeof(LargeSetRecord) - 2; bool createSet(LargeSet *set, uint16 last) { last = (((last + 15) >> 4) << 4); - if (allocate((void **) set, (last >> 3) + LargeSetSIZE)) { + if ((*set = (LargeSet)calloc((last >> 3) + LargeSetSIZE, 1))) { (*set)->lastElement = last; return true; } else /* Not Enough Memory! */ @@ -59,8 +58,8 @@ bool createSet(LargeSet *set, uint16 last) { /* Deletes a large set. */ /*****************************************************************************/ void deleteSet(LargeSet set) { - if (set != NULL) - deallocate(set, (set->lastElement >> 3) + LargeSetSIZE); + if (set) + free(set); } diff --git a/engines/lab/labtext.cpp b/engines/lab/labtext.cpp index d90929fc8e..7acb014389 100644 --- a/engines/lab/labtext.cpp +++ b/engines/lab/labtext.cpp @@ -29,7 +29,6 @@ */ #include "lab/stddefines.h" -#include "lab/storage.h" #include "lab/labfun.h" namespace Lab { @@ -67,7 +66,7 @@ static void setString(char **string) { /*****************************************************************************/ bool initLabText(void) { if ((SizeOfMemChunk = sizeOfFile(LABTEXTFILE))) - if (allocate((void **) &BeginOfMemChunk, SizeOfMemChunk)) { + if ((BeginOfMemChunk = (char *)calloc(SizeOfMemChunk, 1))) { Common::File *file = openPartial(LABTEXTFILE); if (file) { @@ -146,7 +145,7 @@ bool initLabText(void) { /*****************************************************************************/ void freeLabText(void) { if (SizeOfMemChunk && BeginOfMemChunk) - deallocate(BeginOfMemChunk, SizeOfMemChunk); + free(BeginOfMemChunk); } diff --git a/engines/lab/map.cpp b/engines/lab/map.cpp index d32154e700..c56f699778 100644 --- a/engines/lab/map.cpp +++ b/engines/lab/map.cpp @@ -28,7 +28,7 @@ * */ -#include "lab/storage.h" +#include "lab/stddefines.h" #include "lab/labfun.h" #include "lab/diff.h" #include "lab/vga.h" @@ -38,7 +38,6 @@ #include "lab/parsetypes.h" #include "lab/interface.h" #include "lab/text.h" -#include "lab/stddefines.h" namespace Lab { diff --git a/engines/lab/module.mk b/engines/lab/module.mk index 5edaa78fd9..09156a7abd 100644 --- a/engines/lab/module.mk +++ b/engines/lab/module.mk @@ -23,7 +23,6 @@ MODULE_OBJS := \ savegame.o \ savegamepalmap.o \ special.o \ - storage.o \ text.o \ timing.o \ undiff.o \ diff --git a/engines/lab/readparse.cpp b/engines/lab/readparse.cpp index e970942a41..7734a232bb 100644 --- a/engines/lab/readparse.cpp +++ b/engines/lab/readparse.cpp @@ -31,7 +31,6 @@ #include "lab/labfun.h" #include "lab/parsetypes.h" #include "lab/parsefun.h" -#include "lab/storage.h" #include "lab/stddefines.h" namespace Lab { @@ -56,7 +55,7 @@ static uint16 allocroom; static bool rallocate(void **Ptr, uint32 Size) { if (UseMemory) - return allocate(Ptr, Size); + return ((*Ptr = calloc(Size, 1)) != 0); else { allocRoom(Ptr, (uint16) Size, allocroom); return true; @@ -89,7 +88,7 @@ bool readRoomData(const char *fileName) { swapUShortPtr(&HighestCondition, 1); #endif - if (allocate((void **) &Rooms, (ManyRooms + 1) * sizeof(RoomData))) { + if ((Rooms = (RoomData *)calloc(ManyRooms + 1, sizeof(RoomData)))) { for (Counter = 1; Counter <= ManyRooms; Counter++) { readBlock(&(Rooms[Counter].NorthDoor), 2L, file); readBlock(&(Rooms[Counter].SouthDoor), 2L, file); diff --git a/engines/lab/storage.cpp b/engines/lab/storage.cpp deleted file mode 100644 index a94d21c7ea..0000000000 --- a/engines/lab/storage.cpp +++ /dev/null @@ -1,56 +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. - * - */ - -/* - * This code is based on Labyrinth of Time code with assistance of - * - * Copyright (c) 1993 Terra Nova Development - * Copyright (c) 2004 The Wyrmkeep Entertainment Co. - * - */ - -#include "lab/stddefines.h" - -namespace Lab { - -/*****************************************************************************/ -/* Allocates a chunk of memory. */ -/*****************************************************************************/ -bool allocate(void **Ptr, uint32 Size) { - (*Ptr) = malloc(Size); - - if (*Ptr) - memset(*Ptr, 0, (size_t) Size); - - return (*Ptr != NULL); -} - - -/*****************************************************************************/ -/* Deallocates a piece of memory. */ -/*****************************************************************************/ -void deallocate(void *Ptr, uint32 Size) { - if (Ptr) - free(Ptr); -} - -} // End of namespace Lab diff --git a/engines/lab/storage.h b/engines/lab/storage.h deleted file mode 100644 index c93c58c79a..0000000000 --- a/engines/lab/storage.h +++ /dev/null @@ -1,44 +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. - * - */ - -/* - * This code is based on Labyrinth of Time code with assistance of - * - * Copyright (c) 1993 Terra Nova Development - * Copyright (c) 2004 The Wyrmkeep Entertainment Co. - * - */ - -#include "lab/stddefines.h" - -#ifndef LAB_STORAGE_H -#define LAB_STORAGE_H - -namespace Lab { - -bool allocate(void **Ptr, uint32 Size); - -void deallocate(void *Ptr, uint32 Size); - -} // End of namespace Lab - -#endif /* LAB_STORAGE_H */ diff --git a/engines/lab/text.cpp b/engines/lab/text.cpp index 4376dba182..5795a08960 100644 --- a/engines/lab/text.cpp +++ b/engines/lab/text.cpp @@ -30,7 +30,6 @@ #include "lab/stddefines.h" #include "lab/labfun.h" -#include "lab/storage.h" #include "lab/text.h" #include "lab/vga.h" @@ -81,7 +80,7 @@ bool openFont(const char *TextFontPath, struct TextFont **tf) { char header[5]; int32 filesize, headersize = 4L + 2L + 256 * 3 + 4L; - if (allocate((void **)tf, sizeof(struct TextFont))) { + if ((*tf = (TextFont *)calloc(sizeof(struct TextFont), 1))) { filesize = sizeOfFile(TextFontPath); file = g_music->newOpen(TextFontPath); @@ -102,14 +101,14 @@ bool openFont(const char *TextFontPath, struct TextFont **tf) { #endif skip(file, 4L); - if (allocate((void **) & ((*tf)->data), (*tf)->DataLength)) { + if (((*tf)->data = (byte *)calloc((*tf)->DataLength, 1))) { readBlock((*tf)->data, (*tf)->DataLength, file); return true; } } } - deallocate(*tf, sizeof(struct TextFont)); + free(*tf); } *tf = NULL; @@ -123,9 +122,9 @@ bool openFont(const char *TextFontPath, struct TextFont **tf) { void closeFont(struct TextFont *tf) { if (tf) { if (tf->data && tf->DataLength) - deallocate(tf->data, tf->DataLength); + free(tf->data); - deallocate(tf, sizeof(struct TextFont)); + free(tf); } } diff --git a/engines/lab/vga.cpp b/engines/lab/vga.cpp index 9fb9f99d95..2e5bd9b8c3 100644 --- a/engines/lab/vga.cpp +++ b/engines/lab/vga.cpp @@ -30,7 +30,6 @@ #include "lab/vga.h" #include "lab/stddefines.h" -#include "lab/storage.h" #include "lab/mouse.h" #include "graphics/palette.h" -- cgit v1.2.3 From abded17657503419a12a4831094bc8d9d8005c95 Mon Sep 17 00:00:00 2001 From: Eugene Sandulenko Date: Mon, 22 Dec 2014 10:03:05 +0100 Subject: LAB: Simplify stddefines.h --- engines/lab/audioi.cpp | 4 ++-- engines/lab/labsets.cpp | 4 ++++ engines/lab/special.cpp | 6 ++++++ engines/lab/stddefines.h | 22 ---------------------- 4 files changed, 12 insertions(+), 24 deletions(-) diff --git a/engines/lab/audioi.cpp b/engines/lab/audioi.cpp index 44ba56e6c5..37aecd58a4 100644 --- a/engines/lab/audioi.cpp +++ b/engines/lab/audioi.cpp @@ -328,7 +328,7 @@ void updateSoundBuffers(void) { for (int i = 0; i < 2; i++) { if ((AIL_sound_buffer_status(hdriver, i) == DAC_DONE) && firstblock.len) { - tempblock.len = min(16384L, firstblock.len); + tempblock.len = MIN(16384L, firstblock.len); firstblock.len -= tempblock.len; if (!(bufnum ^= 1)) { @@ -373,7 +373,7 @@ void updateSoundBuffers(void) { for (int i = 0; i < 2; i++) { if ((SDLSoundBufferStatus(i) == DAC_DONE) && firstblock.len) { // use extra memory for 16-bit samples - tempblock.len = min(PLAYBUFSIZE, firstblock.len); + tempblock.len = MIN(PLAYBUFSIZE, firstblock.len); firstblock.len -= tempblock.len; if (!(bufnum ^= 1)) { diff --git a/engines/lab/labsets.cpp b/engines/lab/labsets.cpp index c6f3d330b4..86fd6fd60b 100644 --- a/engines/lab/labsets.cpp +++ b/engines/lab/labsets.cpp @@ -63,6 +63,10 @@ void deleteSet(LargeSet set) { } +#define INCL(BITSET,BIT) ((BITSET) |= (BIT)) + +#define EXCL(BITSET,BIT) ((BITSET) &= (~(BIT))) + /*****************************************************************************/ diff --git a/engines/lab/special.cpp b/engines/lab/special.cpp index 4e842a1de0..50589ed941 100644 --- a/engines/lab/special.cpp +++ b/engines/lab/special.cpp @@ -66,6 +66,12 @@ extern uint32 VGAScreenWidth, VGAScreenHeight; static uint16 hipal[20]; extern uint16 *FadePalette; +#define INCL(BITSET,BIT) ((BITSET) |= (BIT)) + +#define SETBIT(BITSET,BITNUM) INCL(BITSET, (1 << (BITNUM))) + +#define INBIT(BITSET,BITNUM) ( ((1 << (BITNUM)) & (BITSET)) > 0 ) + static byte *loadBackPict(const char *fileName, bool tomem) { uint16 counter; diff --git a/engines/lab/stddefines.h b/engines/lab/stddefines.h index cd3156fabd..a9d685bbdb 100644 --- a/engines/lab/stddefines.h +++ b/engines/lab/stddefines.h @@ -40,28 +40,6 @@ namespace Lab { #define IS_MACOSX 1 #define USE_NOSWAP 1 - -#define INCL(BITSET,BIT) ((BITSET) |= (BIT)) - -#define EXCL(BITSET,BIT) ((BITSET) &= (~(BIT))) - - - -#define SETBIT(BITSET,BITNUM) INCL(BITSET, (1 << (BITNUM))) - -#define UNSETBIT(BITSET,BITNUM) EXCL(BITSET, (1 << (BITNUM))) - -#define INBIT(BITSET,BITNUM) ( ((1 << (BITNUM)) & (BITSET)) > 0 ) - -#if !defined(WIN32) -#ifndef min -#define min(a,b) ((a)<(b) ? (a) : (b)) -#endif -#ifndef max -#define max(a,b) ((a)>(b) ? (a) : (b)) -#endif -#endif - #if defined(IS_MACOSX) #define getTime Lab_GetTime #define delay Lab_Delay -- cgit v1.2.3 From 6ab5edf7629ae2166b0fdc9773005d240ade5d3e Mon Sep 17 00:00:00 2001 From: Eugene Sandulenko Date: Mon, 22 Dec 2014 10:36:39 +0100 Subject: LAB: Further cleanup --- engines/lab/labfile.cpp | 78 ------------------------------------------------- engines/lab/labfun.h | 12 -------- 2 files changed, 90 deletions(-) diff --git a/engines/lab/labfile.cpp b/engines/lab/labfile.cpp index e4045b5801..7c7875afe0 100644 --- a/engines/lab/labfile.cpp +++ b/engines/lab/labfile.cpp @@ -401,82 +401,4 @@ void freeAllStolenMem(void) { MemPlace = buffer; } - - - -/*--------------- Routines that read partial chunks of a file ---------------*/ - - - -/*****************************************************************************/ -/* Reads Size amount of bytes into buffer. */ -/*****************************************************************************/ -uint32 readPartial(int32 File, void *buf, uint32 Size) { - uint32 haveread = 0; - - warning("STUB: readPartial"); - -#if 0 - uint32 nsize; - - while (Size) { - if (Size > MAXREADSIZE) - nsize = MAXREADSIZE; - else - nsize = Size; - - haveread += (uint32)(read((int) File, buf, (int) nsize)); - Size -= nsize; - ((char *) buf) += nsize; - updateMouse(); - } -#endif - return haveread; -} - - - -/*****************************************************************************/ -/* Reads Size amount of bytes into buffer. Use this one if the data must */ -/* absolutely be correct (compressed data for example). Otherwise, because */ -/* of the DMA bug, last two bytes may be screwed. */ -/*****************************************************************************/ -uint32 newReadPartial(int32 File, void *buf, uint32 Size) { - return readPartial((int) File, buf, Size); -} - - - -/*****************************************************************************/ -/* Reads Size amount of bytes into buffer. Use this one if the data must */ -/* absolutely be correct (compressed data for example). Otherwise, because */ -/* of the DMA bug, last two bytes may be screwed. This one will work if the */ -/* data is not padded the extra two bytes. */ -/*****************************************************************************/ -uint32 bufferedReadPartial(int32 File, void *buf, uint32 Size) { - return readPartial(File, buf, Size); -} - - - -/*****************************************************************************/ -/* Sets the current position in the file relative to the beginning of the */ -/* file. */ -/*****************************************************************************/ -void setPos(int32 File, uint32 Place) { - warning("STUB: setPos"); - //lseek((int) File, (int32) Place, SEEK_SET); -} - - - -/*****************************************************************************/ -/* Skips a certain number of bytes either forward or backwards. */ -/*****************************************************************************/ -void skipPartial(int32 File, int32 Skip) { - warning("STUB: skipPartial"); - - //lseek((int) File, Skip, SEEK_CUR); -} - } // End of namespace Lab diff --git a/engines/lab/labfun.h b/engines/lab/labfun.h index 08130f3e0b..995177b654 100644 --- a/engines/lab/labfun.h +++ b/engines/lab/labfun.h @@ -203,18 +203,6 @@ Common::File *openPartial(const char *name); void closePartial(int32 File); -uint32 readPartial(int32 File, void *buffer, uint32 Size); - -uint32 newReadPartial(int32 File, void *buffer, uint32 Size); - -uint32 bufferedReadPartial(int32 File, void *buffer, uint32 Size); - - -void setPos(int32 File, uint32 Place); - -void skipPartial(int32 File, int32 Skip); - - /*---------------------------*/ /*------ From LabText.c -----*/ -- cgit v1.2.3 From 471dbaa758f0ebea9f3d76caa7fd769c6809d395 Mon Sep 17 00:00:00 2001 From: Eugene Sandulenko Date: Thu, 25 Dec 2014 12:36:47 +0100 Subject: LAB: Started objectifying LargeSets --- engines/lab/engine.cpp | 60 ++++++++++++++--------------- engines/lab/lab.h | 3 ++ engines/lab/labfun.h | 25 ++++++------ engines/lab/labsets.cpp | 86 +++++++++++++++++++----------------------- engines/lab/labtext.cpp | 2 +- engines/lab/machine.cpp | 21 ----------- engines/lab/map.cpp | 10 ++--- engines/lab/modernsavegame.cpp | 3 -- engines/lab/parsefun.h | 3 -- engines/lab/processroom.cpp | 18 ++++----- engines/lab/readparse.cpp | 39 ------------------- engines/lab/special.cpp | 24 ++++-------- 12 files changed, 102 insertions(+), 192 deletions(-) diff --git a/engines/lab/engine.cpp b/engines/lab/engine.cpp index 83bf3964a3..dec1806db5 100644 --- a/engines/lab/engine.cpp +++ b/engines/lab/engine.cpp @@ -53,7 +53,6 @@ extern bool DoBlack, waiteffect, EffectPlaying, stopsound, DoNotDrawMessage, IsH extern RoomData *Rooms; extern InventoryData *Inventory; extern uint16 NumInv, RoomNum, ManyRooms, HighestCondition, Direction; -extern LargeSet Conditions, RoomsFound; CloseDataPtr CPtr; #if !defined(DOSCODE) @@ -223,8 +222,8 @@ static void drawRoomMessage(uint16 CurInv, CloseDataPtr cptr) { } if (Alternate) { - if ((CurInv <= NumInv) && In(Conditions, CurInv) && Inventory[CurInv].BInvName) { - if ((CurInv == LAMPNUM) && In(Conditions, LAMPON)) /* LAB: Labyrith specific */ + if ((CurInv <= NumInv) && g_engine->_conditions->in(CurInv) && Inventory[CurInv].BInvName) { + if ((CurInv == LAMPNUM) && g_engine->_conditions->in(LAMPON)) /* LAB: Labyrith specific */ drawMessage(LAMPONMSG); else if (Inventory[CurInv].Many > 1) { ManyPtr = numtostr(ManyText, Inventory[CurInv].Many); @@ -518,10 +517,10 @@ static const char *getInvName(uint16 CurInv) { if (MainDisplay) return Inventory[CurInv].BInvName; - if ((CurInv == LAMPNUM) && In(Conditions, LAMPON)) + if ((CurInv == LAMPNUM) && g_engine->_conditions->in(LAMPON)) return "P:Mines/120"; - else if ((CurInv == BELTNUM) && In(Conditions, BELTGLOW)) + else if ((CurInv == BELTNUM) && g_engine->_conditions->in(BELTGLOW)) return "P:Future/BeltGlow"; else if (CurInv == WESTPAPERNUM) { @@ -617,12 +616,12 @@ static bool doUse(uint16 CurInv) { else if (CurInv == LAMPNUM) { /* LAB: Labyrinth specific */ interfaceOff(); - if (In(Conditions, LAMPON)) { + if (g_engine->_conditions->in(LAMPON)) { drawMessage(TURNLAMPOFF); - exclElement(Conditions, LAMPON); + g_engine->_conditions->exclElement(LAMPON); } else { drawMessage(TURNLAMPON); - inclElement(Conditions, LAMPON); + g_engine->_conditions->inclElement(LAMPON); } DoBlack = false; @@ -635,25 +634,25 @@ static bool doUse(uint16 CurInv) { } else if (CurInv == BELTNUM) { /* LAB: Labyrinth specific */ - if (!In(Conditions, BELTGLOW)) - inclElement(Conditions, BELTGLOW); + if (!g_engine->_conditions->in(BELTGLOW)) + g_engine->_conditions->inclElement(BELTGLOW); DoBlack = false; Test = getInvName(CurInv); } else if (CurInv == WHISKEYNUM) { /* LAB: Labyrinth specific */ - inclElement(Conditions, USEDHELMET); + g_engine->_conditions->inclElement(USEDHELMET); drawMessage(USEWHISKEY); } else if (CurInv == PITHHELMETNUM) { /* LAB: Labyrinth specific */ - inclElement(Conditions, USEDHELMET); + g_engine->_conditions->inclElement(USEDHELMET); drawMessage(USEPITH); } else if (CurInv == HELMETNUM) { /* LAB: Labyrinth specific */ - inclElement(Conditions, USEDHELMET); + g_engine->_conditions->inclElement(USEDHELMET); drawMessage(USEHELMET); } @@ -678,7 +677,7 @@ static void decIncInv(uint16 *CurInv, bool dec) { (*CurInv)++; while (*CurInv && (*CurInv <= NumInv)) { - if (In(Conditions, *CurInv) && Inventory[*CurInv].BInvName) { + if (g_engine->_conditions->in(*CurInv) && Inventory[*CurInv].BInvName) { Test = getInvName(*CurInv); break; } @@ -696,7 +695,7 @@ static void decIncInv(uint16 *CurInv, bool dec) { *CurInv = 1; while (*CurInv && (*CurInv <= NumInv)) { - if (In(Conditions, *CurInv) && Inventory[*CurInv].BInvName) { + if (g_engine->_conditions->in(*CurInv) && Inventory[*CurInv].BInvName) { Test = getInvName(*CurInv); break; } @@ -749,13 +748,13 @@ static void process(void) { readRoomData("LAB:Doors"); readInventory("LAB:Inventor"); - if (!createSet(&Conditions, HighestCondition + 1)) + if (!(g_engine->_conditions = new LargeSet(HighestCondition + 1))) return; - if (!createSet(&RoomsFound, ManyRooms + 1)) + if (!(g_engine->_roomsFound = new LargeSet(ManyRooms + 1))) return; - readInitialConditions(Conditions, "LAB:Conditio"); + g_engine->_conditions->readInitialConditions("LAB:Conditio"); LongWinInFront = false; drawPanel(); @@ -789,7 +788,7 @@ static void process(void) { Test = getPictName(&CPtr); if (noupdatediff) { - inclElement(RoomsFound, RoomNum); /* Potentially entered another room */ + g_engine->_roomsFound->inclElement(RoomNum); /* Potentially entered another room */ ForceDraw = (strcmp(Test, CurFileName) != 0) || ForceDraw; noupdatediff = false; @@ -798,7 +797,7 @@ static void process(void) { else if (strcmp(Test, CurFileName) != 0) { interfaceOff(); - inclElement(RoomsFound, RoomNum); /* Potentially entered another room */ + g_engine->_roomsFound->inclElement(RoomNum); /* Potentially entered another room */ CurFileName = Test; if (CPtr) { @@ -1090,7 +1089,7 @@ from_crumbs: MainDisplay = false; - if (LastInv && In(Conditions, LastInv)) { + if (LastInv && g_engine->_conditions->in(LastInv)) { CurInv = LastInv; Test = getInvName(CurInv); } else @@ -1172,7 +1171,7 @@ from_crumbs: if (OldRoomNum != RoomNum) { drawMessage(GOFORWARDDIR); - inclElement(RoomsFound, RoomNum); /* Potentially entered a new room */ + g_engine->_roomsFound->inclElement(RoomNum); /* Potentially entered a new room */ CurFileName = " "; ForceDraw = true; } else { @@ -1316,11 +1315,11 @@ from_crumbs: if ((CurInv == 0) || (CurInv > NumInv)) { CurInv = 1; - while ((CurInv <= NumInv) && (!In(Conditions, CurInv))) + while ((CurInv <= NumInv) && (!g_engine->_conditions->in(CurInv))) CurInv++; } - if ((CurInv <= NumInv) && In(Conditions, CurInv) && + if ((CurInv <= NumInv) && g_engine->_conditions->in(CurInv) && Inventory[CurInv].BInvName) Test = getInvName(CurInv); @@ -1454,11 +1453,11 @@ from_crumbs: } else if ((ActionMode == 5) && - In(Conditions, CurInv)) { /* Use an item on something else */ + g_engine->_conditions->in(CurInv)) { /* Use an item on something else */ if (doOperateRule(MouseX, MouseY, CurInv, &CPtr)) { CurFileName = NewFileName; - if (!In(Conditions, CurInv)) + if (!g_engine->_conditions->in(CurInv)) decIncInv(&CurInv, false); } else if (MouseY < (VGAScaleY(149) + SVGACord(2))) drawMessage(NOTHING); @@ -1510,7 +1509,7 @@ from_crumbs: interfaceOn(); /* Sets the correct gadget list */ if (Alternate) { - if (LastInv && In(Conditions, LastInv)) + if (LastInv && g_engine->_conditions->in(LastInv)) CurInv = LastInv; else decIncInv(&CurInv, false); @@ -1526,11 +1525,8 @@ from_crumbs: } } - if (Conditions) - deleteSet(Conditions); - - if (RoomsFound) - deleteSet(RoomsFound); + delete g_engine->_conditions; + delete g_engine->_roomsFound; if (Rooms) free(Rooms); diff --git a/engines/lab/lab.h b/engines/lab/lab.h index 3b1e411e7c..42429553f8 100644 --- a/engines/lab/lab.h +++ b/engines/lab/lab.h @@ -34,6 +34,7 @@ #include "common/array.h" #include "engines/engine.h" +#include "lab/labfun.h" namespace Lab { @@ -45,6 +46,8 @@ public: virtual Common::Error run(); bool hasFeature(EngineFeature f) const; + + LargeSet *_conditions, *_roomsFound; }; } // End of namespace Lab diff --git a/engines/lab/labfun.h b/engines/lab/labfun.h index 995177b654..93d5166480 100644 --- a/engines/lab/labfun.h +++ b/engines/lab/labfun.h @@ -275,26 +275,23 @@ extern Music *g_music; /*----- From LabSets.c ------*/ /*---------------------------*/ -typedef struct { - uint16 lastElement, array[1]; -} LargeSetRecord; - -typedef LargeSetRecord *LargeSet; - - - -bool createSet(LargeSet *set, uint16 last); - -void deleteSet(LargeSet set); +class LargeSet { +public: + LargeSet(uint16 last); -bool In(LargeSet set, uint16 element); + ~LargeSet(); -void inclElement(LargeSet set, uint16 element); + bool in(set, uint16 element); -void exclElement(LargeSet set, uint16 element); + void inclElement(uint16 element); + void exclElement(uint16 element); + bool readInitialConditions(const char *fileName); +private: + uint16 *_array; +}; /*---------------------------*/ /*----- From Machine.c ------*/ diff --git a/engines/lab/labsets.cpp b/engines/lab/labsets.cpp index 86fd6fd60b..cee9cda56b 100644 --- a/engines/lab/labsets.cpp +++ b/engines/lab/labsets.cpp @@ -33,65 +33,57 @@ namespace Lab { -const uint32 LargeSetSIZE = sizeof(LargeSetRecord) - 2; - - - -/*****************************************************************************/ -/* Creates a large set. */ -/*****************************************************************************/ -bool createSet(LargeSet *set, uint16 last) { +LabSet::LabSet(uint16 last) { last = (((last + 15) >> 4) << 4); - if ((*set = (LargeSet)calloc((last >> 3) + LargeSetSIZE, 1))) { - (*set)->lastElement = last; - return true; - } else /* Not Enough Memory! */ - return false; - + _array = (uint16 *)calloc(last >> 3); } - - - -/*****************************************************************************/ -/* Deletes a large set. */ -/*****************************************************************************/ -void deleteSet(LargeSet set) { - if (set) - free(set); +LargeSet::~LargeSet() { + free(_array); } - -#define INCL(BITSET,BIT) ((BITSET) |= (BIT)) - -#define EXCL(BITSET,BIT) ((BITSET) &= (~(BIT))) - - - -/*****************************************************************************/ -/* Tests if an element is in the set. */ -/*****************************************************************************/ -bool In(LargeSet set, uint16 element) { - return ((1 << ((element - 1) % 16)) & (set->array[(element - 1) >> 4])) > 0; +bool LargeSet::in(uint16 element) { + return ((1 << ((element - 1) % 16)) & (_array[(element - 1) >> 4])) > 0; } - - -/*****************************************************************************/ -/* Sets an element in the Large set. */ -/*****************************************************************************/ -void inclElement(LargeSet set, uint16 element) { - INCL((set->array[(element - 1) >> 4]), (1 << ((element - 1) % 16))); +void LargeSet::inclElement(uint16 element) { + _array[(element - 1) >> 4]) |= 1 << ((element - 1) % 16); } +void LargeSet::exclElement(uint16 element) { + _array[(element - 1) >> 4] &= ~(1 << ((element - 1) % 16)); +} +bool LargeSet::readInitialConditions(const char *fileName) { + byte **file; + uint16 many, set; + char temp[5]; + + if ((file = g_music->newOpen(fileName)) != NULL) { + readBlock(temp, 4L, file); + temp[4] = '\0'; + + if (strcmp(temp, "CON0") != 0) + return false; + + readBlock(&many, 2L, file); +#if !defined(DOSCODE) + swapUShortPtr(&many, 1); +#endif + + for (int counter = 0; counter < many; counter++) { + readBlock(&set, 2L, file); +#if !defined(DOSCODE) + swapUShortPtr(&set, 1); +#endif + inclElement(set); + } + } else + return false; -/*****************************************************************************/ -/* Removes an element in the Large set. */ -/*****************************************************************************/ -void exclElement(LargeSet set, uint16 element) { - EXCL((set->array[(element - 1) >> 4]), (1 << ((element - 1) % 16))); + return true; } + } // End of namespace Lab diff --git a/engines/lab/labtext.cpp b/engines/lab/labtext.cpp index 7acb014389..673f8d06ac 100644 --- a/engines/lab/labtext.cpp +++ b/engines/lab/labtext.cpp @@ -159,7 +159,7 @@ void decrypt(byte *text) { return; while (*text != '\0') { - (*text) -= (byte) 95; + (*text) -= (byte)95; text++; } } diff --git a/engines/lab/machine.cpp b/engines/lab/machine.cpp index da8744a9f5..c1bdd003b8 100644 --- a/engines/lab/machine.cpp +++ b/engines/lab/machine.cpp @@ -147,27 +147,6 @@ uint16 VGAUnScaleY(uint16 y) { } - - -#if defined(WIN32) -/*****************************************************************************/ -/* Replaces all occurences of a character in a string with a new one. */ -/*****************************************************************************/ -static void strrplc(char *text, char orig, char replace) { - uint16 counter; - - counter = 0; - - while (text[counter]) { - if (text[counter] == orig) - text[counter] = replace; - - counter++; - } -} -#endif - - /*****************************************************************************/ /* Checks to see if all the characters in the second string are at the start */ /* of the first. */ diff --git a/engines/lab/map.cpp b/engines/lab/map.cpp index c56f699778..d3380b7ecb 100644 --- a/engines/lab/map.cpp +++ b/engines/lab/map.cpp @@ -528,12 +528,12 @@ static void drawRoom(uint16 CurRoom, bool drawx) { /*****************************************************************************/ /* Checks if a floor has been visitted. */ /*****************************************************************************/ -static bool onFloor(LargeSet RoomsFound, uint16 Floor) { +static bool onFloor(uint16 Floor) { uint16 drawroom; for (drawroom = 1; drawroom <= MaxRooms; drawroom++) { if ((Maps[drawroom].PageNumber == Floor) - && In(RoomsFound, drawroom) + && g_engine->_roomsFound->in(drawroom) && Maps[drawroom].x) { return true; } @@ -623,7 +623,7 @@ static void drawMap(LargeSet RoomsFound, uint16 CurRoom, uint16 CurMsg, uint16 F for (drawroom = 1; drawroom <= MaxRooms; drawroom++) { if ((Maps[drawroom].PageNumber == Floor) - && In(RoomsFound, drawroom) + && g_engine->_roomsFound->in(drawroom) && Maps[drawroom].x) { drawRoom(drawroom, (bool)(drawroom == CurRoom)); g_music->checkMusic(); @@ -631,7 +631,7 @@ static void drawMap(LargeSet RoomsFound, uint16 CurRoom, uint16 CurMsg, uint16 F } if ((Maps[CurRoom].PageNumber == Floor) /* Makes sure the X is drawn in corridors */ - && In(RoomsFound, CurRoom) /* NOTE: this here on purpose just in case there's some wierd condition, like the surreal maze where there are no rooms */ + && g_engine->_roomsFound->in(CurRoom) /* NOTE: this here on purpose just in case there's some wierd condition, like the surreal maze where there are no rooms */ && Maps[CurRoom].x) drawRoom(CurRoom, true); @@ -858,7 +858,7 @@ void processMap(uint16 CurRoom, LargeSet RoomsFound) { roomCords(drawroom, &x1, &y1, &x2, &y2); if ((Maps[drawroom].PageNumber == CurFloor) - && In(RoomsFound, drawroom) + && g_engine->_roomsFound->in(drawroom) && (MouseX >= x1) && (MouseX <= x2) && (MouseY >= y1) && (MouseY <= y2)) { CurMsg = drawroom; diff --git a/engines/lab/modernsavegame.cpp b/engines/lab/modernsavegame.cpp index 2ea5c22911..2be33b8aa5 100644 --- a/engines/lab/modernsavegame.cpp +++ b/engines/lab/modernsavegame.cpp @@ -39,9 +39,6 @@ byte g_SaveGameImage[SAVED_IMAGE_SIZE]; // 640 x 358 char g_SaveGamePath[512]; char g_PathSeperator[4]; -extern LargeSet Conditions, - RoomsFound; - #define SAVEVERSION "LBS3" int getSaveGameList(struct SaveGameInfo *info, int maxNum) { diff --git a/engines/lab/parsefun.h b/engines/lab/parsefun.h index 4e1dc5de7e..e6794ee8eb 100644 --- a/engines/lab/parsefun.h +++ b/engines/lab/parsefun.h @@ -60,9 +60,6 @@ char *numtostr(char *text, uint16 Num); bool readViews(uint16 RoomNum, const char *Path); -bool readInitialConditions(LargeSet Conditions, const char *fileName); - - /* From ProcessRoom.c */ diff --git a/engines/lab/processroom.cpp b/engines/lab/processroom.cpp index d9f40b4e1d..19e113391c 100644 --- a/engines/lab/processroom.cpp +++ b/engines/lab/processroom.cpp @@ -51,8 +51,6 @@ extern int g_IsRegistered; RoomData *Rooms; InventoryData *Inventory; uint16 NumInv, RoomNum, ManyRooms, HighestCondition, Direction; -LargeSet Conditions, RoomsFound; - extern char *FACINGNORTH, *FACINGEAST, *FACINGSOUTH, *FACINGWEST; extern bool LongWinInFront; @@ -105,10 +103,10 @@ static bool checkConditions(int16 *Condition) { return true; Counter = 1; - res = In(Conditions, Condition[0]); + res = g_engine->_conditions->in(Condition[0]); while (Condition[Counter] && res) { - res = In(Conditions, Condition[Counter]); + res = g_engine->_conditions->in(Condition[Counter]); Counter++; } @@ -415,7 +413,7 @@ bool takeItem(uint16 x, uint16 y, CloseDataPtr *cptr) { VPtr = getViewData(RoomNum, Direction); LCPtr = VPtr->closeUps; } else if ((*cptr)->CloseUpType < 0) { - inclElement(Conditions, abs((*cptr)->CloseUpType)); + g_engine->_conditions->inclElement(abs((*cptr)->CloseUpType)); return true; } else LCPtr = (*cptr)->SubCloseUps; @@ -425,7 +423,7 @@ bool takeItem(uint16 x, uint16 y, CloseDataPtr *cptr) { if ((x >= scaleX(LCPtr->x1)) && (y >= scaleY(LCPtr->y1)) && (x <= scaleX(LCPtr->x2)) && (y <= scaleY(LCPtr->y2)) && (LCPtr->CloseUpType < 0)) { - inclElement(Conditions, abs(LCPtr->CloseUpType)); + g_engine->_conditions->inclElement(abs(LCPtr->CloseUpType)); return true; } @@ -513,11 +511,11 @@ static void doActions(ActionPtr APtr, CloseDataPtr *LCPtr) { break; case SETELEMENT: - inclElement(Conditions, APtr->Param1); + g_engine->_conditions->inclElement(APtr->Param1); break; case UNSETELEMENT: - exclElement(Conditions, APtr->Param1); + g_engine->_conditions->exclElement(APtr->Param1); break; case SHOWMESSAGE: @@ -612,13 +610,13 @@ static void doActions(ActionPtr APtr, CloseDataPtr *LCPtr) { (Inventory[APtr->Param1].Many)--; if (Inventory[APtr->Param1].Many == 0) - exclElement(Conditions, APtr->Param1); + g_engine->_conditions->exclElement(APtr->Param1); break; case ADDINV: (Inventory[APtr->Param1].Many) += APtr->Param2; - inclElement(Conditions, APtr->Param1); + g_engine->_conditions->inclElement(APtr->Param1); break; case SHOWDIR: diff --git a/engines/lab/readparse.cpp b/engines/lab/readparse.cpp index 7734a232bb..075c1fdb99 100644 --- a/engines/lab/readparse.cpp +++ b/engines/lab/readparse.cpp @@ -46,9 +46,6 @@ static bool UseMemory = false; extern RoomData *Rooms; extern InventoryData *Inventory; extern uint16 NumInv, ManyRooms, HighestCondition, Direction; -extern LargeSet Conditions, RoomsFound; - - static uint16 allocroom; @@ -474,40 +471,4 @@ bool readViews(uint16 RoomNum, const char *Path) { return false; } - - - -/*****************************************************************************/ -/* Reads the initial conditions and sets the LargeSet accordingly. */ -/*****************************************************************************/ -bool readInitialConditions(LargeSet conditions, const char *fileName) { - byte **file; - uint16 many, set; - char temp[5]; - - if ((file = g_music->newOpen(fileName)) != NULL) { - readBlock(temp, 4L, file); - temp[4] = '\0'; - - if (strcmp(temp, "CON0") != 0) - return false; - - readBlock(&many, 2L, file); -#if !defined(DOSCODE) - swapUShortPtr(&many, 1); -#endif - - for (int counter = 0; counter < many; counter++) { - readBlock(&set, 2L, file); -#if !defined(DOSCODE) - swapUShortPtr(&set, 1); -#endif - inclElement(conditions, set); - } - } else - return false; - - return true; -} - } // End of namespace Lab diff --git a/engines/lab/special.cpp b/engines/lab/special.cpp index 50589ed941..022f203f52 100644 --- a/engines/lab/special.cpp +++ b/engines/lab/special.cpp @@ -195,20 +195,13 @@ static void changeCombination(LargeSet Conditions, uint16 number) { bltBitMap(Images[combnum], 0, (Images[combnum])->Height - (2 * counter), &(display), VGAScaleX(combx[number]), VGAScaleY(65), (Images[combnum])->Width, 2); } - /* - if (memcmp(combination, solution, (size_t) 12) == 0) - inclElement(Conditions, COMBINATIONUNLOCKED); - else - exclElement(Conditions, COMBINATIONUNLOCKED); - */ - for (counter = 0; counter < 6; counter++) unlocked = (combination[counter] == solution[counter]) && unlocked; if (unlocked) - inclElement(Conditions, COMBINATIONUNLOCKED); + g_engine->_conditions->inclElement(COMBINATIONUNLOCKED); else - exclElement(Conditions, COMBINATIONUNLOCKED); + g_engine->_conditions->exclElement(COMBINATIONUNLOCKED); #if !defined(DOSCODE) ungetVGABaseAddr(); @@ -486,7 +479,7 @@ static void changeTile(LargeSet Conditions, uint16 col, uint16 row) { } if (check) { - inclElement(Conditions, BRICKOPEN); /* unlocked combination */ + g_engine->_conditions->inclElement(BRICKOPEN); /* unlocked combination */ DoBlack = true; check = readPict("p:Up/BDOpen", true); } @@ -665,10 +658,10 @@ static bool loadJournalData(LargeSet Conditions) { g_music->checkMusic(); strcpy(filename, "Lab:Rooms/j0"); - bridge = In(Conditions, BRIDGE0) || In(Conditions, BRIDGE1); - dirty = In(Conditions, DIRTY); - news = !In(Conditions, NONEWS); - clean = !In(Conditions, NOCLEAN); + bridge = g_engine->_conditions->in(BRIDGE0) || g_engine->_conditions->in(BRIDGE1); + dirty = g_engine->_conditions->in(DIRTY); + news = !g_engine->_conditions->in(NONEWS); + clean = !g_engine->_conditions->in(NOCLEAN); if (bridge && clean && news) filename[11] = '8'; @@ -981,9 +974,6 @@ struct Image *Arrow1, *NoArrow1, *DriveButton; extern InventoryData *Inventory; extern uint16 RoomNum, Direction; -extern LargeSet Conditions, RoomsFound; - - extern char *SAVETEXT, *LOADTEXT, *BOOKMARKTEXT, *PERSONALTEXT, *DISKTEXT, *SAVEBOOK, *RESTOREBOOK, *SAVEFLASH, *RESTOREFLASH, *SAVEDISK, *RESTOREDISK, *SELECTDISK, *NODISKINDRIVE, *WRITEPROTECTED, *FORMATFLOPPY, *FORMATTING; -- cgit v1.2.3 From cb8f8432966ccee632bf4e79e367d6d941dfdedb Mon Sep 17 00:00:00 2001 From: Eugene Sandulenko Date: Thu, 25 Dec 2014 19:13:52 +0100 Subject: LAB: Objectify LabSets --- engines/lab/engine.cpp | 65 +++++++++++++++++++++--------------------- engines/lab/lab.cpp | 3 ++ engines/lab/lab.h | 2 ++ engines/lab/labfun.h | 17 +++++------ engines/lab/labsets.cpp | 7 +++-- engines/lab/map.cpp | 63 ++++++++++++++++++++-------------------- engines/lab/modernsavegame.cpp | 2 +- engines/lab/processroom.cpp | 17 +++++------ engines/lab/savegame.cpp | 29 ++++++++++--------- engines/lab/special.cpp | 41 +++++++++++++------------- 10 files changed, 129 insertions(+), 117 deletions(-) diff --git a/engines/lab/engine.cpp b/engines/lab/engine.cpp index dec1806db5..4db1451921 100644 --- a/engines/lab/engine.cpp +++ b/engines/lab/engine.cpp @@ -28,6 +28,7 @@ * */ +#include "lab/lab.h" #include "lab/stddefines.h" #include "lab/labfun.h" #include "lab/diff.h" @@ -222,8 +223,8 @@ static void drawRoomMessage(uint16 CurInv, CloseDataPtr cptr) { } if (Alternate) { - if ((CurInv <= NumInv) && g_engine->_conditions->in(CurInv) && Inventory[CurInv].BInvName) { - if ((CurInv == LAMPNUM) && g_engine->_conditions->in(LAMPON)) /* LAB: Labyrith specific */ + if ((CurInv <= NumInv) && g_lab->_conditions->in(CurInv) && Inventory[CurInv].BInvName) { + if ((CurInv == LAMPNUM) && g_lab->_conditions->in(LAMPON)) /* LAB: Labyrith specific */ drawMessage(LAMPONMSG); else if (Inventory[CurInv].Many > 1) { ManyPtr = numtostr(ManyText, Inventory[CurInv].Many); @@ -517,10 +518,10 @@ static const char *getInvName(uint16 CurInv) { if (MainDisplay) return Inventory[CurInv].BInvName; - if ((CurInv == LAMPNUM) && g_engine->_conditions->in(LAMPON)) + if ((CurInv == LAMPNUM) && g_lab->_conditions->in(LAMPON)) return "P:Mines/120"; - else if ((CurInv == BELTNUM) && g_engine->_conditions->in(BELTGLOW)) + else if ((CurInv == BELTNUM) && g_lab->_conditions->in(BELTGLOW)) return "P:Future/BeltGlow"; else if (CurInv == WESTPAPERNUM) { @@ -596,7 +597,7 @@ static bool doUse(uint16 CurInv) { stopDiff(); CurFileName = " "; CPtr = NULL; - doMap(RoomsFound, RoomNum); + doMap(RoomNum); VGASetPal(initcolors, 8); drawMessage(NULL); drawPanel(); @@ -608,7 +609,7 @@ static bool doUse(uint16 CurInv) { stopDiff(); CurFileName = " "; CPtr = NULL; - doJournal(Conditions); + doJournal(); drawPanel(); drawMessage(NULL); } @@ -616,12 +617,12 @@ static bool doUse(uint16 CurInv) { else if (CurInv == LAMPNUM) { /* LAB: Labyrinth specific */ interfaceOff(); - if (g_engine->_conditions->in(LAMPON)) { + if (g_lab->_conditions->in(LAMPON)) { drawMessage(TURNLAMPOFF); - g_engine->_conditions->exclElement(LAMPON); + g_lab->_conditions->exclElement(LAMPON); } else { drawMessage(TURNLAMPON); - g_engine->_conditions->inclElement(LAMPON); + g_lab->_conditions->inclElement(LAMPON); } DoBlack = false; @@ -634,25 +635,25 @@ static bool doUse(uint16 CurInv) { } else if (CurInv == BELTNUM) { /* LAB: Labyrinth specific */ - if (!g_engine->_conditions->in(BELTGLOW)) - g_engine->_conditions->inclElement(BELTGLOW); + if (!g_lab->_conditions->in(BELTGLOW)) + g_lab->_conditions->inclElement(BELTGLOW); DoBlack = false; Test = getInvName(CurInv); } else if (CurInv == WHISKEYNUM) { /* LAB: Labyrinth specific */ - g_engine->_conditions->inclElement(USEDHELMET); + g_lab->_conditions->inclElement(USEDHELMET); drawMessage(USEWHISKEY); } else if (CurInv == PITHHELMETNUM) { /* LAB: Labyrinth specific */ - g_engine->_conditions->inclElement(USEDHELMET); + g_lab->_conditions->inclElement(USEDHELMET); drawMessage(USEPITH); } else if (CurInv == HELMETNUM) { /* LAB: Labyrinth specific */ - g_engine->_conditions->inclElement(USEDHELMET); + g_lab->_conditions->inclElement(USEDHELMET); drawMessage(USEHELMET); } @@ -677,7 +678,7 @@ static void decIncInv(uint16 *CurInv, bool dec) { (*CurInv)++; while (*CurInv && (*CurInv <= NumInv)) { - if (g_engine->_conditions->in(*CurInv) && Inventory[*CurInv].BInvName) { + if (g_lab->_conditions->in(*CurInv) && Inventory[*CurInv].BInvName) { Test = getInvName(*CurInv); break; } @@ -695,7 +696,7 @@ static void decIncInv(uint16 *CurInv, bool dec) { *CurInv = 1; while (*CurInv && (*CurInv <= NumInv)) { - if (g_engine->_conditions->in(*CurInv) && Inventory[*CurInv].BInvName) { + if (g_lab->_conditions->in(*CurInv) && Inventory[*CurInv].BInvName) { Test = getInvName(*CurInv); break; } @@ -748,13 +749,13 @@ static void process(void) { readRoomData("LAB:Doors"); readInventory("LAB:Inventor"); - if (!(g_engine->_conditions = new LargeSet(HighestCondition + 1))) + if (!(g_lab->_conditions = new LargeSet(HighestCondition + 1))) return; - if (!(g_engine->_roomsFound = new LargeSet(ManyRooms + 1))) + if (!(g_lab->_roomsFound = new LargeSet(ManyRooms + 1))) return; - g_engine->_conditions->readInitialConditions("LAB:Conditio"); + g_lab->_conditions->readInitialConditions("LAB:Conditio"); LongWinInFront = false; drawPanel(); @@ -788,7 +789,7 @@ static void process(void) { Test = getPictName(&CPtr); if (noupdatediff) { - g_engine->_roomsFound->inclElement(RoomNum); /* Potentially entered another room */ + g_lab->_roomsFound->inclElement(RoomNum); /* Potentially entered another room */ ForceDraw = (strcmp(Test, CurFileName) != 0) || ForceDraw; noupdatediff = false; @@ -797,7 +798,7 @@ static void process(void) { else if (strcmp(Test, CurFileName) != 0) { interfaceOff(); - g_engine->_roomsFound->inclElement(RoomNum); /* Potentially entered another room */ + g_lab->_roomsFound->inclElement(RoomNum); /* Potentially entered another room */ CurFileName = Test; if (CPtr) { @@ -1089,7 +1090,7 @@ from_crumbs: MainDisplay = false; - if (LastInv && g_engine->_conditions->in(LastInv)) { + if (LastInv && g_lab->_conditions->in(LastInv)) { CurInv = LastInv; Test = getInvName(CurInv); } else @@ -1171,7 +1172,7 @@ from_crumbs: if (OldRoomNum != RoomNum) { drawMessage(GOFORWARDDIR); - g_engine->_roomsFound->inclElement(RoomNum); /* Potentially entered a new room */ + g_lab->_roomsFound->inclElement(RoomNum); /* Potentially entered a new room */ CurFileName = " "; ForceDraw = true; } else { @@ -1315,11 +1316,11 @@ from_crumbs: if ((CurInv == 0) || (CurInv > NumInv)) { CurInv = 1; - while ((CurInv <= NumInv) && (!g_engine->_conditions->in(CurInv))) + while ((CurInv <= NumInv) && (!g_lab->_conditions->in(CurInv))) CurInv++; } - if ((CurInv <= NumInv) && g_engine->_conditions->in(CurInv) && + if ((CurInv <= NumInv) && g_lab->_conditions->in(CurInv) && Inventory[CurInv].BInvName) Test = getInvName(CurInv); @@ -1398,9 +1399,9 @@ from_crumbs: if (CPtr) { if ((CPtr->CloseUpType == SPECIALLOCK) && MainDisplay) /* LAB: Labrinth specific code */ - mouseCombination(Conditions, MouseX, MouseY); + mouseCombination(MouseX, MouseY); else if ((CPtr->CloseUpType == SPECIALBRICK) && MainDisplay) - mouseTile(Conditions, MouseX, MouseY); + mouseTile(MouseX, MouseY); else doit = true; } else @@ -1453,11 +1454,11 @@ from_crumbs: } else if ((ActionMode == 5) && - g_engine->_conditions->in(CurInv)) { /* Use an item on something else */ + g_lab->_conditions->in(CurInv)) { /* Use an item on something else */ if (doOperateRule(MouseX, MouseY, CurInv, &CPtr)) { CurFileName = NewFileName; - if (!g_engine->_conditions->in(CurInv)) + if (!g_lab->_conditions->in(CurInv)) decIncInv(&CurInv, false); } else if (MouseY < (VGAScaleY(149) + SVGACord(2))) drawMessage(NOTHING); @@ -1509,7 +1510,7 @@ from_crumbs: interfaceOn(); /* Sets the correct gadget list */ if (Alternate) { - if (LastInv && g_engine->_conditions->in(LastInv)) + if (LastInv && g_lab->_conditions->in(LastInv)) CurInv = LastInv; else decIncInv(&CurInv, false); @@ -1525,8 +1526,8 @@ from_crumbs: } } - delete g_engine->_conditions; - delete g_engine->_roomsFound; + delete g_lab->_conditions; + delete g_lab->_roomsFound; if (Rooms) free(Rooms); diff --git a/engines/lab/lab.cpp b/engines/lab/lab.cpp index 7054072210..971543a3f2 100644 --- a/engines/lab/lab.cpp +++ b/engines/lab/lab.cpp @@ -45,8 +45,11 @@ bool LabEngine::hasFeature(EngineFeature f) const { return (f == kSupportsRTL) ? true : false; } +LabEngine *g_lab; + LabEngine::LabEngine(OSystem *syst) : Engine(syst) { + g_lab = this; } LabEngine::~LabEngine() { diff --git a/engines/lab/lab.h b/engines/lab/lab.h index 42429553f8..bdb0b4d89b 100644 --- a/engines/lab/lab.h +++ b/engines/lab/lab.h @@ -50,6 +50,8 @@ public: LargeSet *_conditions, *_roomsFound; }; +extern LabEngine *g_lab; + } // End of namespace Lab #endif // LAB_H diff --git a/engines/lab/labfun.h b/engines/lab/labfun.h index 93d5166480..abb0871669 100644 --- a/engines/lab/labfun.h +++ b/engines/lab/labfun.h @@ -281,7 +281,7 @@ public: ~LargeSet(); - bool in(set, uint16 element); + bool in(uint16 element); void inclElement(uint16 element); @@ -289,7 +289,8 @@ public: bool readInitialConditions(const char *fileName); -private: +public: + uint16 _lastElement; uint16 *_array; }; @@ -333,9 +334,9 @@ bool getFont(const char *filename, TextFont *textfont); void readImage(byte **buffer, Image **im); -void doMap(LargeSet RoomsFound, uint16 CurRoom); +void doMap(uint16 CurRoom); -void doJournal(LargeSet Conditions); +void doJournal(); void doNotes(void); @@ -353,9 +354,9 @@ bool saveRestoreGame(void); /*----- From saveGame.c ----*/ /*--------------------------*/ -bool saveFloppy(char *path, uint16 RoomNum, uint16 Direction, uint16 NumQuarters, LargeSet Conditions, LargeSet Rooms, uint16 filenum, uint16 type); +bool saveFloppy(char *path, uint16 RoomNum, uint16 Direction, uint16 NumQuarters, uint16 filenum, uint16 type); -bool readFloppy(char *path, uint16 *RoomNum, uint16 *Direction, uint16 *NumQuarters, LargeSet Conditions, LargeSet Rooms, uint16 filenum, uint16 type); +bool readFloppy(char *path, uint16 *RoomNum, uint16 *Direction, uint16 *NumQuarters, uint16 filenum, uint16 type); @@ -365,11 +366,11 @@ bool readFloppy(char *path, uint16 *RoomNum, uint16 *Direction, uint16 *NumQuart void showCombination(const char *filename); -void mouseCombination(LargeSet Conditions, uint16 x, uint16 y); +void mouseCombination(uint16 x, uint16 y); void showTile(const char *filename, bool showsolution); -void mouseTile(LargeSet Conditions, uint16 x, uint16 y); +void mouseTile(uint16 x, uint16 y); void inner_main(); diff --git a/engines/lab/labsets.cpp b/engines/lab/labsets.cpp index cee9cda56b..eefbc79cb4 100644 --- a/engines/lab/labsets.cpp +++ b/engines/lab/labsets.cpp @@ -33,10 +33,11 @@ namespace Lab { -LabSet::LabSet(uint16 last) { +LargeSet::LargeSet(uint16 last) { last = (((last + 15) >> 4) << 4); - _array = (uint16 *)calloc(last >> 3); + _array = (uint16 *)calloc(last >> 3, 2); + _lastElement = last; } LargeSet::~LargeSet() { @@ -48,7 +49,7 @@ bool LargeSet::in(uint16 element) { } void LargeSet::inclElement(uint16 element) { - _array[(element - 1) >> 4]) |= 1 << ((element - 1) % 16); + _array[(element - 1) >> 4] |= 1 << ((element - 1) % 16); } void LargeSet::exclElement(uint16 element) { diff --git a/engines/lab/map.cpp b/engines/lab/map.cpp index d3380b7ecb..eac13648eb 100644 --- a/engines/lab/map.cpp +++ b/engines/lab/map.cpp @@ -28,6 +28,7 @@ * */ +#include "lab/lab.h" #include "lab/stddefines.h" #include "lab/labfun.h" #include "lab/diff.h" @@ -533,7 +534,7 @@ static bool onFloor(uint16 Floor) { for (drawroom = 1; drawroom <= MaxRooms; drawroom++) { if ((Maps[drawroom].PageNumber == Floor) - && g_engine->_roomsFound->in(drawroom) + && g_lab->_roomsFound->in(drawroom) && Maps[drawroom].x) { return true; } @@ -548,7 +549,7 @@ static bool onFloor(uint16 Floor) { /*****************************************************************************/ /* Figures out which floor, if any, should be gone to if the up arrow is hit */ /*****************************************************************************/ -static void getUpFloor(LargeSet RoomsFound, uint16 *Floor, bool *isfloor) { +static void getUpFloor(uint16 *Floor, bool *isfloor) { do { *isfloor = true; @@ -559,7 +560,7 @@ static void getUpFloor(LargeSet RoomsFound, uint16 *Floor, bool *isfloor) { *isfloor = false; return; } - } while ((!onFloor(RoomsFound, *Floor)) && (*Floor <= CARNIVAL)); + } while ((!onFloor(*Floor)) && (*Floor <= CARNIVAL)); } @@ -569,7 +570,7 @@ static void getUpFloor(LargeSet RoomsFound, uint16 *Floor, bool *isfloor) { /* Figures out which floor, if any, should be gone to if the down arrow is */ /* hit. */ /*****************************************************************************/ -static void getDownFloor(LargeSet RoomsFound, uint16 *Floor, bool *isfloor) { +static void getDownFloor(uint16 *Floor, bool *isfloor) { do { *isfloor = true; @@ -593,7 +594,7 @@ static void getDownFloor(LargeSet RoomsFound, uint16 *Floor, bool *isfloor) { } else (*Floor)--; - } while ((!onFloor(RoomsFound, *Floor)) && *Floor); + } while ((!onFloor(*Floor)) && *Floor); } @@ -603,7 +604,7 @@ static void getDownFloor(LargeSet RoomsFound, uint16 *Floor, bool *isfloor) { /*****************************************************************************/ /* Draws the map */ /*****************************************************************************/ -static void drawMap(LargeSet RoomsFound, uint16 CurRoom, uint16 CurMsg, uint16 Floor, bool fadeout, bool fadein) { +static void drawMap(uint16 CurRoom, uint16 CurMsg, uint16 Floor, bool fadeout, bool fadein) { uint16 drawroom; char *sptr; @@ -623,7 +624,7 @@ static void drawMap(LargeSet RoomsFound, uint16 CurRoom, uint16 CurMsg, uint16 F for (drawroom = 1; drawroom <= MaxRooms; drawroom++) { if ((Maps[drawroom].PageNumber == Floor) - && g_engine->_roomsFound->in(drawroom) + && g_lab->_roomsFound->in(drawroom) && Maps[drawroom].x) { drawRoom(drawroom, (bool)(drawroom == CurRoom)); g_music->checkMusic(); @@ -631,12 +632,12 @@ static void drawMap(LargeSet RoomsFound, uint16 CurRoom, uint16 CurMsg, uint16 F } if ((Maps[CurRoom].PageNumber == Floor) /* Makes sure the X is drawn in corridors */ - && g_engine->_roomsFound->in(CurRoom) /* NOTE: this here on purpose just in case there's some wierd condition, like the surreal maze where there are no rooms */ + && g_lab->_roomsFound->in(CurRoom) /* NOTE: this here on purpose just in case there's some wierd condition, like the surreal maze where there are no rooms */ && Maps[CurRoom].x) drawRoom(CurRoom, true); tempfloor = Floor; - getUpFloor(RoomsFound, &tempfloor, &noghoast); + getUpFloor(&tempfloor, &noghoast); if (noghoast) unGhoastGadget(&upgadget); @@ -644,7 +645,7 @@ static void drawMap(LargeSet RoomsFound, uint16 CurRoom, uint16 CurMsg, uint16 F ghoastGadget(&upgadget, 12); tempfloor = Floor; - getDownFloor(RoomsFound, &tempfloor, &noghoast); + getDownFloor(&tempfloor, &noghoast); if (noghoast) unGhoastGadget(&downgadget); @@ -653,20 +654,20 @@ static void drawMap(LargeSet RoomsFound, uint16 CurRoom, uint16 CurMsg, uint16 F /* LAB: Labyrinth specific code */ if (Floor == LOWERFLOOR) { - if (onFloor(RoomsFound, SURMAZEFLOOR)) + if (onFloor(SURMAZEFLOOR)) drawImage(Maze, mapScaleX(538), mapScaleY(277)); } else if (Floor == MIDDLEFLOOR) { - if (onFloor(RoomsFound, CARNIVAL)) + if (onFloor(CARNIVAL)) drawImage(Maze, mapScaleX(358), mapScaleY(72)); - if (onFloor(RoomsFound, MEDMAZEFLOOR)) + if (onFloor(MEDMAZEFLOOR)) drawImage(Maze, mapScaleX(557), mapScaleY(325)); } else if (Floor == UPPERFLOOR) { - if (onFloor(RoomsFound, HEDGEMAZEFLOOR)) + if (onFloor(HEDGEMAZEFLOOR)) drawImage(HugeMaze, mapScaleX(524), mapScaleY(97)); } @@ -729,7 +730,7 @@ static void drawMap(LargeSet RoomsFound, uint16 CurRoom, uint16 CurMsg, uint16 F /*****************************************************************************/ /* Processes the map. */ /*****************************************************************************/ -void processMap(uint16 CurRoom, LargeSet RoomsFound) { +void processMap(uint16 CurRoom) { uint32 Class, place = 1; uint16 Code, Qualifier, MouseX, MouseY, GadgetID, CurFloor, OldFloor, OldMsg, CurMsg, drawroom, x1, y1, x2, y2; char *sptr; @@ -789,21 +790,21 @@ void processMap(uint16 CurRoom, LargeSet RoomsFound) { return; } else if (GadgetID == 1) { /* Up arrow */ OldFloor = CurFloor; - getUpFloor(RoomsFound, &CurFloor, &drawmap); + getUpFloor(&CurFloor, &drawmap); if (drawmap) { fade(false, 0); - drawMap(RoomsFound, CurRoom, CurMsg, CurFloor, false, false); + drawMap(CurRoom, CurMsg, CurFloor, false, false); fade(true, 0); } else CurFloor = OldFloor; } else if (GadgetID == 2) { /* Down arrow */ OldFloor = CurFloor; - getDownFloor(RoomsFound, &CurFloor, &drawmap); + getDownFloor(&CurFloor, &drawmap); if (drawmap) { fade(false, 0); - drawMap(RoomsFound, CurRoom, CurMsg, CurFloor, false, false); + drawMap(CurRoom, CurMsg, CurFloor, false, false); fade(true, 0); } else CurFloor = OldFloor; @@ -813,41 +814,41 @@ void processMap(uint16 CurRoom, LargeSet RoomsFound) { else if ((Class == MOUSEBUTTONS) && (IEQUALIFIER_LEFTBUTTON & Qualifier)) { if ((CurFloor == LOWERFLOOR) && (MouseX >= mapScaleX(538)) && (MouseY >= mapScaleY(277)) && (MouseX <= mapScaleX(633)) && (MouseY <= mapScaleY(352)) - && onFloor(RoomsFound, SURMAZEFLOOR)) { + && onFloor(SURMAZEFLOOR)) { CurFloor = SURMAZEFLOOR; fade(false, 0); - drawMap(RoomsFound, CurRoom, CurMsg, CurFloor, false, false); + drawMap(CurRoom, CurMsg, CurFloor, false, false); fade(true, 0); } else if ((CurFloor == MIDDLEFLOOR) && (MouseX >= mapScaleX(358)) && (MouseY >= mapScaleY(71)) && (MouseX <= mapScaleX(452)) && (MouseY <= mapScaleY(147)) - && onFloor(RoomsFound, CARNIVAL)) { + && onFloor(CARNIVAL)) { CurFloor = CARNIVAL; fade(false, 0); - drawMap(RoomsFound, CurRoom, CurMsg, CurFloor, false, false); + drawMap(CurRoom, CurMsg, CurFloor, false, false); fade(true, 0); } else if ((CurFloor == MIDDLEFLOOR) && (MouseX >= mapScaleX(557)) && (MouseY >= mapScaleY(325)) && (MouseX <= mapScaleX(653)) && (MouseY <= mapScaleY(401)) - && onFloor(RoomsFound, MEDMAZEFLOOR)) { + && onFloor(MEDMAZEFLOOR)) { CurFloor = MEDMAZEFLOOR; fade(false, 0); - drawMap(RoomsFound, CurRoom, CurMsg, CurFloor, false, false); + drawMap(CurRoom, CurMsg, CurFloor, false, false); fade(true, 0); } else if ((CurFloor == UPPERFLOOR) && (MouseX >= mapScaleX(524)) && (MouseY >= mapScaleY(97)) && (MouseX <= mapScaleX(645)) && (MouseY <= mapScaleY(207)) - && onFloor(RoomsFound, HEDGEMAZEFLOOR)) { + && onFloor(HEDGEMAZEFLOOR)) { CurFloor = HEDGEMAZEFLOOR; fade(false, 0); - drawMap(RoomsFound, CurRoom, CurMsg, CurFloor, false, false); + drawMap(CurRoom, CurMsg, CurFloor, false, false); fade(true, 0); } @@ -858,7 +859,7 @@ void processMap(uint16 CurRoom, LargeSet RoomsFound) { roomCords(drawroom, &x1, &y1, &x2, &y2); if ((Maps[drawroom].PageNumber == CurFloor) - && g_engine->_roomsFound->in(drawroom) + && g_lab->_roomsFound->in(drawroom) && (MouseX >= x1) && (MouseX <= x2) && (MouseY >= y1) && (MouseY <= y2)) { CurMsg = drawroom; @@ -915,7 +916,7 @@ void mapCleanUp(void) { /*****************************************************************************/ /* Does the map processing. */ /*****************************************************************************/ -void doMap(LargeSet RoomsFound, uint16 CurRoom) { +void doMap(uint16 CurRoom) { FadePalette = AmigaMapPalette; g_music->checkMusic(); @@ -931,13 +932,13 @@ void doMap(LargeSet RoomsFound, uint16 CurRoom) { else if (Direction == WEST) XMark = MapWest; - drawMap(RoomsFound, CurRoom, CurRoom, Maps[CurRoom].PageNumber, false, true); + drawMap(CurRoom, CurRoom, Maps[CurRoom].PageNumber, false, true); mouseShow(); attachGadgetList(MapGadgetList); #if !defined(DOSCODE) WSDL_UpdateScreen(); #endif - processMap(CurRoom, RoomsFound); + processMap(CurRoom); attachGadgetList(NULL); fade(false, 0); blackAllScreen(); diff --git a/engines/lab/modernsavegame.cpp b/engines/lab/modernsavegame.cpp index 2be33b8aa5..71eedb9d38 100644 --- a/engines/lab/modernsavegame.cpp +++ b/engines/lab/modernsavegame.cpp @@ -83,7 +83,7 @@ int getSaveGameList(struct SaveGameInfo *info, int maxNum) { fread(&t, 1, 2, fh); info->Direction = swapUShort(t); - toSeek = 2 + Conditions->lastElement / 8 + RoomsFound->lastElement / 8 + 6 + 2 * 16; + toSeek = 2 + Conditions->lastElement / 8 + g_lab->_roomsFound->_lastElement / 8 + 6 + 2 * 16; fseek(fh, toSeek, SEEK_CUR); info->SaveGameImage = NULL; diff --git a/engines/lab/processroom.cpp b/engines/lab/processroom.cpp index 19e113391c..10d5dfbc2b 100644 --- a/engines/lab/processroom.cpp +++ b/engines/lab/processroom.cpp @@ -28,6 +28,7 @@ * */ +#include "lab/lab.h" #include "lab/stddefines.h" #include "lab/labfun.h" #include "lab/parsetypes.h" @@ -103,10 +104,10 @@ static bool checkConditions(int16 *Condition) { return true; Counter = 1; - res = g_engine->_conditions->in(Condition[0]); + res = g_lab->_conditions->in(Condition[0]); while (Condition[Counter] && res) { - res = g_engine->_conditions->in(Condition[Counter]); + res = g_lab->_conditions->in(Condition[Counter]); Counter++; } @@ -413,7 +414,7 @@ bool takeItem(uint16 x, uint16 y, CloseDataPtr *cptr) { VPtr = getViewData(RoomNum, Direction); LCPtr = VPtr->closeUps; } else if ((*cptr)->CloseUpType < 0) { - g_engine->_conditions->inclElement(abs((*cptr)->CloseUpType)); + g_lab->_conditions->inclElement(abs((*cptr)->CloseUpType)); return true; } else LCPtr = (*cptr)->SubCloseUps; @@ -423,7 +424,7 @@ bool takeItem(uint16 x, uint16 y, CloseDataPtr *cptr) { if ((x >= scaleX(LCPtr->x1)) && (y >= scaleY(LCPtr->y1)) && (x <= scaleX(LCPtr->x2)) && (y <= scaleY(LCPtr->y2)) && (LCPtr->CloseUpType < 0)) { - g_engine->_conditions->inclElement(abs(LCPtr->CloseUpType)); + g_lab->_conditions->inclElement(abs(LCPtr->CloseUpType)); return true; } @@ -511,11 +512,11 @@ static void doActions(ActionPtr APtr, CloseDataPtr *LCPtr) { break; case SETELEMENT: - g_engine->_conditions->inclElement(APtr->Param1); + g_lab->_conditions->inclElement(APtr->Param1); break; case UNSETELEMENT: - g_engine->_conditions->exclElement(APtr->Param1); + g_lab->_conditions->exclElement(APtr->Param1); break; case SHOWMESSAGE: @@ -610,13 +611,13 @@ static void doActions(ActionPtr APtr, CloseDataPtr *LCPtr) { (Inventory[APtr->Param1].Many)--; if (Inventory[APtr->Param1].Many == 0) - g_engine->_conditions->exclElement(APtr->Param1); + g_lab->_conditions->exclElement(APtr->Param1); break; case ADDINV: (Inventory[APtr->Param1].Many) += APtr->Param2; - g_engine->_conditions->inclElement(APtr->Param1); + g_lab->_conditions->inclElement(APtr->Param1); break; case SHOWDIR: diff --git a/engines/lab/savegame.cpp b/engines/lab/savegame.cpp index ed25c38ef2..c5d3499071 100644 --- a/engines/lab/savegame.cpp +++ b/engines/lab/savegame.cpp @@ -28,6 +28,7 @@ * */ +#include "lab/lab.h" #include "lab/stddefines.h" #include "lab/labfun.h" #include "lab/modernsavegame.h" @@ -134,7 +135,7 @@ extern bool FollowingCrumbs; /* Writes the game out to disk. */ /* Assumes that the file has already been openned and is there. */ /*****************************************************************************/ -static bool saveGame(uint16 RoomNum, uint16 Direction, uint16 Quarters, LargeSet set1, LargeSet set2, LABFH file) { +static bool saveGame(uint16 RoomNum, uint16 Direction, uint16 Quarters, LABFH file) { #if !defined(DOSCODE) uint16 temp; CrumbData crumbs[sizeof(BreadCrumbs) / sizeof(CrumbData)]; @@ -156,11 +157,11 @@ static bool saveGame(uint16 RoomNum, uint16 Direction, uint16 Quarters, LargeSet saveGameWriteBlock(file, &temp, 2L); #endif - last = set1->lastElement / 8; - saveGameWriteBlock(file, &(set1->array[0]), (uint32) last); + last = g_lab->_conditions->_lastElement / 8; + saveGameWriteBlock(file, g_lab->_conditions->_array, (uint32) last); - last = set2->lastElement / 8; - saveGameWriteBlock(file, &(set2->array[0]), (uint32) last); + last = g_lab->_roomsFound->_lastElement / 8; + saveGameWriteBlock(file, g_lab->_roomsFound->_array, (uint32) last); /* LAB: the combination lock and tile stuff */ for (counter = 0; counter < 6; counter++) { @@ -198,7 +199,7 @@ static bool saveGame(uint16 RoomNum, uint16 Direction, uint16 Quarters, LargeSet /* Reads the game from disk. */ /* Assumes that the file has already been openned and is there. */ /*****************************************************************************/ -static bool loadGame(uint16 *RoomNum, uint16 *Direction, uint16 *Quarters, LargeSet set1, LargeSet set2, LABFH file) { +static bool loadGame(uint16 *RoomNum, uint16 *Direction, uint16 *Quarters, LABFH file) { #if !defined(DOSCODE) uint16 t; CrumbData crumbs[sizeof(BreadCrumbs) / sizeof(CrumbData)]; @@ -230,11 +231,11 @@ static bool loadGame(uint16 *RoomNum, uint16 *Direction, uint16 *Quarters, Large *Quarters = swapUShort(t); #endif - last = set1->lastElement / 8; - saveGameReadBlock(file, &(set1->array[0]), (uint32) last); + last = g_lab->_conditions->_lastElement / 8; + saveGameReadBlock(file, g_lab->_conditions->_array, (uint32) last); - last = set2->lastElement / 8; - saveGameReadBlock(file, &(set2->array[0]), (uint32) last); + last = g_lab->_roomsFound->_lastElement / 8; + saveGameReadBlock(file, g_lab->_roomsFound->_array, (uint32) last); /* LAB: the combination lock and tile stuff */ for (counter = 0; counter < 6; counter++) { @@ -281,7 +282,7 @@ static bool loadGame(uint16 *RoomNum, uint16 *Direction, uint16 *Quarters, Large /*****************************************************************************/ /* Saves the game to the floppy disk. */ /*****************************************************************************/ -bool saveFloppy(char *path, uint16 RoomNum, uint16 Direction, uint16 NumQuarters, LargeSet Conditions, LargeSet Rooms, uint16 filenum, uint16 type) { +bool saveFloppy(char *path, uint16 RoomNum, uint16 Direction, uint16 NumQuarters, uint16 filenum, uint16 type) { LABFH FPtr; g_music->checkMusic(); @@ -290,7 +291,7 @@ bool saveFloppy(char *path, uint16 RoomNum, uint16 Direction, uint16 NumQuarters FileNum = filenum; if ((FPtr = saveGameOpen(path, true)) != INVALID_LABFH) - saveGame(RoomNum, Direction, NumQuarters, Conditions, Rooms, FPtr); + saveGame(RoomNum, Direction, NumQuarters, FPtr); else return false; @@ -303,7 +304,7 @@ bool saveFloppy(char *path, uint16 RoomNum, uint16 Direction, uint16 NumQuarters /*****************************************************************************/ /* Reads the game from the floppy disk. */ /*****************************************************************************/ -bool readFloppy(char *path, uint16 *RoomNum, uint16 *Direction, uint16 *NumQuarters, LargeSet Conditions, LargeSet Rooms, uint16 filenum, uint16 type) { +bool readFloppy(char *path, uint16 *RoomNum, uint16 *Direction, uint16 *NumQuarters, uint16 filenum, uint16 type) { LABFH FPtr; g_music->checkMusic(); @@ -312,7 +313,7 @@ bool readFloppy(char *path, uint16 *RoomNum, uint16 *Direction, uint16 *NumQuart FileNum = filenum; if ((FPtr = saveGameOpen(path, false)) != INVALID_LABFH) { - if (!loadGame(RoomNum, Direction, NumQuarters, Conditions, Rooms, FPtr)) + if (!loadGame(RoomNum, Direction, NumQuarters, FPtr)) return false; } else return false; diff --git a/engines/lab/special.cpp b/engines/lab/special.cpp index 022f203f52..b033386f38 100644 --- a/engines/lab/special.cpp +++ b/engines/lab/special.cpp @@ -28,6 +28,7 @@ * */ +#include "lab/lab.h" #include "lab/labfun.h" #include "lab/parsefun.h" #include "lab/interface.h" @@ -159,7 +160,7 @@ void showCombination(const char *filename) { /*****************************************************************************/ /* Changes the combination number of one of the slots */ /*****************************************************************************/ -static void changeCombination(LargeSet Conditions, uint16 number) { +static void changeCombination(uint16 number) { struct Image display; uint16 counter, combnum; bool unlocked = true; @@ -199,9 +200,9 @@ static void changeCombination(LargeSet Conditions, uint16 number) { unlocked = (combination[counter] == solution[counter]) && unlocked; if (unlocked) - g_engine->_conditions->inclElement(COMBINATIONUNLOCKED); + g_lab->_conditions->inclElement(COMBINATIONUNLOCKED); else - g_engine->_conditions->exclElement(COMBINATIONUNLOCKED); + g_lab->_conditions->exclElement(COMBINATIONUNLOCKED); #if !defined(DOSCODE) ungetVGABaseAddr(); @@ -215,7 +216,7 @@ static void changeCombination(LargeSet Conditions, uint16 number) { /*****************************************************************************/ /* Processes mouse clicks and changes the combination. */ /*****************************************************************************/ -void mouseCombination(LargeSet Conditions, uint16 x, uint16 y) { +void mouseCombination(uint16 x, uint16 y) { uint16 number; x = VGAUnScaleX(x); @@ -237,7 +238,7 @@ void mouseCombination(LargeSet Conditions, uint16 x, uint16 y) { else return; - changeCombination(Conditions, number); + changeCombination(number); } } @@ -411,7 +412,7 @@ static void doTileScroll(uint16 col, uint16 row, uint16 scrolltype) { /*****************************************************************************/ /* Changes the combination number of one of the slots */ /*****************************************************************************/ -static void changeTile(LargeSet Conditions, uint16 col, uint16 row) { +static void changeTile(uint16 col, uint16 row) { bool check; int16 scrolltype = -1; @@ -479,7 +480,7 @@ static void changeTile(LargeSet Conditions, uint16 col, uint16 row) { } if (check) { - g_engine->_conditions->inclElement(BRICKOPEN); /* unlocked combination */ + g_lab->_conditions->inclElement(BRICKOPEN); /* unlocked combination */ DoBlack = true; check = readPict("p:Up/BDOpen", true); } @@ -493,7 +494,7 @@ static void changeTile(LargeSet Conditions, uint16 col, uint16 row) { /*****************************************************************************/ /* Processes mouse clicks and changes the combination. */ /*****************************************************************************/ -void mouseTile(LargeSet Conditions, uint16 x, uint16 y) { +void mouseTile(uint16 x, uint16 y) { x = VGAUnScaleX(x); y = VGAUnScaleY(y); @@ -504,7 +505,7 @@ void mouseTile(LargeSet Conditions, uint16 x, uint16 y) { y = (y - 26) / 25; if ((x < 4) && (y < 4)) - changeTile(Conditions, x, y); + changeTile(x, y); } @@ -641,7 +642,7 @@ static struct Gadget ForwardG, CancelG, BackG; /*****************************************************************************/ /* Loads in the data for the journal. */ /*****************************************************************************/ -static bool loadJournalData(LargeSet Conditions) { +static bool loadJournalData() { byte **buffer; char filename[20]; struct Gadget *TopGadget = &BackG; @@ -658,10 +659,10 @@ static bool loadJournalData(LargeSet Conditions) { g_music->checkMusic(); strcpy(filename, "Lab:Rooms/j0"); - bridge = g_engine->_conditions->in(BRIDGE0) || g_engine->_conditions->in(BRIDGE1); - dirty = g_engine->_conditions->in(DIRTY); - news = !g_engine->_conditions->in(NONEWS); - clean = !g_engine->_conditions->in(NOCLEAN); + bridge = g_lab->_conditions->in(BRIDGE0) || g_lab->_conditions->in(BRIDGE1); + dirty = g_lab->_conditions->in(DIRTY); + news = !g_lab->_conditions->in(NONEWS); + clean = !g_lab->_conditions->in(NOCLEAN); if (bridge && clean && news) filename[11] = '8'; @@ -918,7 +919,7 @@ static void journalCleanUp(void) { /*****************************************************************************/ /* Does the journal processing. */ /*****************************************************************************/ -void doJournal(LargeSet Conditions) { +void doJournal() { resetBuffer(); blackAllScreen(); @@ -936,7 +937,7 @@ void doJournal(LargeSet Conditions) { ScreenImage.ImageData = getVGABaseAddr(); g_music->checkMusic(); - loadJournalData(Conditions); + loadJournalData(); drawJournal(0, true); @@ -1338,7 +1339,7 @@ static bool doSaveGame() { sprintf(DrivePath, "%s%s%d", g_SaveGamePath, g_PathSeperator, g_CurSaveGameNumber); - isok = saveFloppy(DrivePath, RoomNum, Direction, Inventory[QUARTERNUM].Many, Conditions, RoomsFound, g_CurSaveGameNumber, device); + isok = saveFloppy(DrivePath, RoomNum, Direction, Inventory[QUARTERNUM].Many, g_CurSaveGameNumber, device); g_music->resetMusic(); if (isok) @@ -1356,7 +1357,7 @@ static bool doLoadGame() { snprintf(drivePath, 260, "%s%s%d", g_SaveGamePath, g_PathSeperator, g_CurSaveGameNumber); - isok = readFloppy(drivePath, &RoomNum, &Direction, &(Inventory[QUARTERNUM].Many), Conditions, RoomsFound, g_CurSaveGameNumber, device); + isok = readFloppy(drivePath, &RoomNum, &Direction, &(Inventory[QUARTERNUM].Many), g_CurSaveGameNumber, device); g_music->resetMusic(); if (isok) @@ -1877,9 +1878,9 @@ bool saveRestoreGame(void) { eatMessages(); if (issave) - isok = saveFloppy(DrivePath, RoomNum, Direction, Inventory[QUARTERNUM].Many, Conditions, RoomsFound, filenum, device); + isok = saveFloppy(DrivePath, RoomNum, Direction, Inventory[QUARTERNUM].Many, filenum, device); else { - isok = readFloppy(DrivePath, &RoomNum, &Direction, &(Inventory[QUARTERNUM].Many), Conditions, RoomsFound, filenum, device); + isok = readFloppy(DrivePath, &RoomNum, &Direction, &(Inventory[QUARTERNUM].Many), filenum, device); g_music->resetMusic(); } } -- cgit v1.2.3 From 90f0a8650f3b01fe250b4ceb8dbd66614f8c2699 Mon Sep 17 00:00:00 2001 From: Eugene Sandulenko Date: Thu, 25 Dec 2014 19:14:10 +0100 Subject: LAB: Fix line endings --- engines/lab/modernsavegame.cpp | 248 ++--- engines/lab/modernsavegame.h | 110 +- engines/lab/vga.cpp | 2410 ++++++++++++++++++++-------------------- 3 files changed, 1384 insertions(+), 1384 deletions(-) diff --git a/engines/lab/modernsavegame.cpp b/engines/lab/modernsavegame.cpp index 71eedb9d38..334e4c5f80 100644 --- a/engines/lab/modernsavegame.cpp +++ b/engines/lab/modernsavegame.cpp @@ -1,124 +1,124 @@ -/* 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. - * - */ - -/* - * This code is based on Labyrinth of Time code with assistance of - * - * Copyright (c) 1993 Terra Nova Development - * Copyright (c) 2004 The Wyrmkeep Entertainment Co. - * - */ - -#include "lab/stddefines.h" -#include "lab/labfun.h" -#include "lab/modernsavegame.h" - -namespace Lab { - -byte g_SaveGameImage[SAVED_IMAGE_SIZE]; // 640 x 358 - -char g_SaveGamePath[512]; -char g_PathSeperator[4]; - -#define SAVEVERSION "LBS3" - -int getSaveGameList(struct SaveGameInfo *info, int maxNum) { - warning("STUB: getSaveGameList"); - - return 0; - -#if 0 - char path[512]; - struct stat statb; - int total = 0; - int i; - - for (i = 0; i < maxNum; i++) { - checkMusic(); - - sprintf(path, "%s%s%d", g_SaveGamePath, g_PathSeperator, i); - statb.st_size = 0; - stat(path, &statb); - - if (statb.st_size > 0) { - struct tm *create_date; - FILE *fh; - - create_date = localtime(&statb.st_ctime); - strcpy(info->SaveGameDate, asctime(create_date)); - - fh = fopen(path, "rb"); - - if (fh != NULL) { - char temp[5]; - unsigned short t; - int toSeek; - - info->Index = i; - - fread(temp, 1, 4, fh); - temp[4] = 0; - - fread(&t, 1, 2, fh); - info->RoomNumber = swapUShort(t); - fread(&t, 1, 2, fh); - info->Direction = swapUShort(t); - - toSeek = 2 + Conditions->lastElement / 8 + g_lab->_roomsFound->_lastElement / 8 + 6 + 2 * 16; - fseek(fh, toSeek, SEEK_CUR); - - info->SaveGameImage = NULL; - - if (strcmp(temp, SAVEVERSION) == 0) { - info->SaveGameImage = malloc(SAVED_IMAGE_SIZE); - - if (info->SaveGameImage != NULL) - fread(info->SaveGameImage, 1, SAVED_IMAGE_SIZE, fh); - } else { - info->SaveGameImage = malloc(SAVED_IMAGE_SIZE); - - if (info->SaveGameImage != NULL) - memset(info->SaveGameImage, 0, SAVED_IMAGE_SIZE); - } - - fclose(fh); - - info++; - total++; - } - } - } - - return total; -#endif -} - -void freeSaveGameList(struct SaveGameInfo *info, int count) { - int i; - - for (i = 0; i < count; i++) { - free(info->SaveGameImage); - ++info; - } -} - -} // End of namespace Lab +/* 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. + * + */ + +/* + * This code is based on Labyrinth of Time code with assistance of + * + * Copyright (c) 1993 Terra Nova Development + * Copyright (c) 2004 The Wyrmkeep Entertainment Co. + * + */ + +#include "lab/stddefines.h" +#include "lab/labfun.h" +#include "lab/modernsavegame.h" + +namespace Lab { + +byte g_SaveGameImage[SAVED_IMAGE_SIZE]; // 640 x 358 + +char g_SaveGamePath[512]; +char g_PathSeperator[4]; + +#define SAVEVERSION "LBS3" + +int getSaveGameList(struct SaveGameInfo *info, int maxNum) { + warning("STUB: getSaveGameList"); + + return 0; + +#if 0 + char path[512]; + struct stat statb; + int total = 0; + int i; + + for (i = 0; i < maxNum; i++) { + checkMusic(); + + sprintf(path, "%s%s%d", g_SaveGamePath, g_PathSeperator, i); + statb.st_size = 0; + stat(path, &statb); + + if (statb.st_size > 0) { + struct tm *create_date; + FILE *fh; + + create_date = localtime(&statb.st_ctime); + strcpy(info->SaveGameDate, asctime(create_date)); + + fh = fopen(path, "rb"); + + if (fh != NULL) { + char temp[5]; + unsigned short t; + int toSeek; + + info->Index = i; + + fread(temp, 1, 4, fh); + temp[4] = 0; + + fread(&t, 1, 2, fh); + info->RoomNumber = swapUShort(t); + fread(&t, 1, 2, fh); + info->Direction = swapUShort(t); + + toSeek = 2 + Conditions->lastElement / 8 + g_lab->_roomsFound->_lastElement / 8 + 6 + 2 * 16; + fseek(fh, toSeek, SEEK_CUR); + + info->SaveGameImage = NULL; + + if (strcmp(temp, SAVEVERSION) == 0) { + info->SaveGameImage = malloc(SAVED_IMAGE_SIZE); + + if (info->SaveGameImage != NULL) + fread(info->SaveGameImage, 1, SAVED_IMAGE_SIZE, fh); + } else { + info->SaveGameImage = malloc(SAVED_IMAGE_SIZE); + + if (info->SaveGameImage != NULL) + memset(info->SaveGameImage, 0, SAVED_IMAGE_SIZE); + } + + fclose(fh); + + info++; + total++; + } + } + } + + return total; +#endif +} + +void freeSaveGameList(struct SaveGameInfo *info, int count) { + int i; + + for (i = 0; i < count; i++) { + free(info->SaveGameImage); + ++info; + } +} + +} // End of namespace Lab diff --git a/engines/lab/modernsavegame.h b/engines/lab/modernsavegame.h index 160f3f9619..bbee42069f 100644 --- a/engines/lab/modernsavegame.h +++ b/engines/lab/modernsavegame.h @@ -1,55 +1,55 @@ -/* 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. - * - */ - -/* - * This code is based on Labyrinth of Time code with assistance of - * - * Copyright (c) 1993 Terra Nova Development - * Copyright (c) 2004 The Wyrmkeep Entertainment Co. - * - */ - -#ifndef LAB_MODERNGAMESAVE_H -#define LAB_MODERNGAMESAVE_H - -namespace Lab { - -#define MAX_SAVED_GAMES 15 -#define SAVED_IMAGE_SIZE (128 * 72) - -extern byte g_SaveGameImage[SAVED_IMAGE_SIZE]; // 640 x 358 - -struct SaveGameInfo { - unsigned short Index; - unsigned short RoomNumber; - unsigned short Direction; - byte *SaveGameImage; - char SaveGameDate[128]; -}; - -int getSaveGameList(struct SaveGameInfo *info, int maxNum); -void freeSaveGameList(struct SaveGameInfo *info, int count); - -} // End of namespace Lab - -#endif /* LAB_MODERNGAMESAVE_H */ - +/* 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. + * + */ + +/* + * This code is based on Labyrinth of Time code with assistance of + * + * Copyright (c) 1993 Terra Nova Development + * Copyright (c) 2004 The Wyrmkeep Entertainment Co. + * + */ + +#ifndef LAB_MODERNGAMESAVE_H +#define LAB_MODERNGAMESAVE_H + +namespace Lab { + +#define MAX_SAVED_GAMES 15 +#define SAVED_IMAGE_SIZE (128 * 72) + +extern byte g_SaveGameImage[SAVED_IMAGE_SIZE]; // 640 x 358 + +struct SaveGameInfo { + unsigned short Index; + unsigned short RoomNumber; + unsigned short Direction; + byte *SaveGameImage; + char SaveGameDate[128]; +}; + +int getSaveGameList(struct SaveGameInfo *info, int maxNum); +void freeSaveGameList(struct SaveGameInfo *info, int count); + +} // End of namespace Lab + +#endif /* LAB_MODERNGAMESAVE_H */ + diff --git a/engines/lab/vga.cpp b/engines/lab/vga.cpp index 2e5bd9b8c3..403fe605a5 100644 --- a/engines/lab/vga.cpp +++ b/engines/lab/vga.cpp @@ -1,1205 +1,1205 @@ -/* 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. - * - */ - -/* - * This code is based on Labyrinth of Time code with assistance of - * - * Copyright (c) 1993 Terra Nova Development - * Copyright (c) 2004 The Wyrmkeep Entertainment Co. - * - */ - -#include "lab/vga.h" -#include "lab/stddefines.h" -#include "lab/mouse.h" - -#include "graphics/palette.h" - -#include "common/events.h" - -namespace Lab { - -//static uint16 NotInRefresh = 0; - -uint32 VGAScreenWidth = 320UL, - VGAScreenHeight = 200UL, - VGAPages = 1UL, - VGABytesPerPage = 65536UL; - -byte *VGABASEADDRESS = 0; - -byte *g_DisplayBuffer = 0; -byte *g_Pixels = 0; - -int g_ScreenWasLocked = 0; -int g_IgnoreUpdateDisplay = 0; -int g_LastWaitTOFTicks = 0; - -int g_MouseX = 0; -int g_MouseY = 0; - -uint16 g_NextKeyIn = 0; -uint16 g_KeyBuf[64]; -uint16 g_NextKeyOut = 0; -bool g_MouseAtEdge = false; - -/*****************************************************************************/ -/* Sets the display mode. */ -/*****************************************************************************/ -void setMode(char mode) { - // There are no modes for SDL. -} - -/*****************************************************************************/ -/* Sets up either a low-res or a high-res 256 color screen. */ -/*****************************************************************************/ -bool createScreen(bool HiRes) { - //VGABASEADDRESS = (unsigned long)malloc(640 * 480); - VGABASEADDRESS = 0; - VGAScreenWidth = 640; - VGAScreenHeight = 480; - VGAPages = 1; - VGABytesPerPage = 640 * 480; - - g_DisplayBuffer = (byte *)malloc(VGABytesPerPage); - g_Pixels = (byte *)calloc(VGABytesPerPage, 4); - - return true; -} - - - -/*****************************************************************************/ -/* Sets the current page on the VGA card. */ -/*****************************************************************************/ -void setPage(uint16 PageNum) { - // PageNum should always calculated out to zero for SDL. - assert(PageNum == 0); -} - - - -void VGAStorePage(void) { - // does nothing in SDL -} - -void VGARestorePage(void) { - // does nothing in SDL -} - -void changeVolume(int delta) { - warning("STUB: changeVolume()"); -} - -uint16 WSDL_GetNextChar() { - uint16 c = 0; - - WSDL_ProcessInput(0); - if (g_NextKeyIn != g_NextKeyOut) { - c = g_KeyBuf[g_NextKeyOut]; - g_NextKeyOut = ((((unsigned int)((g_NextKeyOut + 1) >> 31) >> 26) + (byte)g_NextKeyOut + 1) & 0x3F) - - ((unsigned int)((g_NextKeyOut + 1) >> 31) >> 26); - } - - return c; -} - -bool WSDL_HasNextChar() { - WSDL_ProcessInput(0); - return g_NextKeyIn != g_NextKeyOut; -} - -void WSDL_ProcessInput(bool can_delay) { - int n; - int lastMouseAtEdge; - int flags = 0; - - Common::Event event; - - if (1 /*!g_IgnoreProcessInput*/) { - while (g_system->getEventManager()->pollEvent(event)) { - switch (event.type) { - case Common::EVENT_RBUTTONDOWN: - flags |= 8; - mouse_handler(flags, g_MouseX, g_MouseY); - break; - - case Common::EVENT_LBUTTONDOWN: - flags |= 2; - mouse_handler(flags, g_MouseX, g_MouseY); - break; - - case Common::EVENT_MOUSEMOVE: - lastMouseAtEdge = g_MouseAtEdge; - g_MouseAtEdge = false; - g_MouseX = event.mouse.x; - if (event.mouse.x <= 0) { - g_MouseX = 0; - g_MouseAtEdge = true; - } - if (g_MouseX > 639) { - g_MouseX = 640; - g_MouseAtEdge = true; - } - - g_MouseY = event.mouse.y; - if (event.mouse.y <= 0) { - g_MouseY = 0; - g_MouseAtEdge = true; - } - if (g_MouseY > 479) { - g_MouseY = 480; - g_MouseAtEdge = true; - } - - if (!lastMouseAtEdge || !g_MouseAtEdge) - mouse_handler(1, g_MouseX, g_MouseY); - - break; - - case Common::EVENT_KEYDOWN: - switch (event.kbd.keycode) { - case Common::KEYCODE_LEFTBRACKET: - changeVolume(-1); - break; - - case Common::KEYCODE_RIGHTBRACKET: - changeVolume(1); - break; - - case Common::KEYCODE_z: - //saveSettings(); - break; - - default: - n = ((((unsigned int)((g_NextKeyIn + 1) >> 31) >> 26) + (byte)g_NextKeyIn + 1) & 0x3F) - - ((unsigned int)((g_NextKeyIn + 1) >> 31) >> 26); - if (n != g_NextKeyOut) { - g_KeyBuf[g_NextKeyIn] = event.kbd.keycode; - g_NextKeyIn = n; - } - } - break; - - case Common::EVENT_QUIT: - case Common::EVENT_RTL: - default: - break; - } - - g_system->copyRectToScreen(g_DisplayBuffer, VGAScreenWidth, 0, 0, VGAScreenWidth, VGAScreenHeight); - g_system->updateScreen(); - } - } - - if (can_delay) - g_system->delayMillis(10); -} - -void WSDL_GetMousePos(int *x, int *y) { - WSDL_ProcessInput(0); - - *x = g_MouseX; - *y = g_MouseY; -} - - -void waitTOF() { - int untilOutOfRefresh = 1; - - if (g_ScreenWasLocked || untilOutOfRefresh) { - g_system->copyRectToScreen(g_DisplayBuffer, VGAScreenWidth, 0, 0, VGAScreenWidth, VGAScreenHeight); - g_system->updateScreen(); - } - - g_ScreenWasLocked = 0; - WSDL_ProcessInput(0); - - uint32 now; - - for (now = g_system->getMillis(); now - g_LastWaitTOFTicks <= 0xF; now = g_system->getMillis() ) - g_system->delayMillis(g_LastWaitTOFTicks - now + 17); - - g_LastWaitTOFTicks = now; -} - -void WSDL_SetColors(byte *buf, uint16 first, uint16 numreg, uint16 slow) { - byte tmp[256 * 3]; - - for (int i = 0; i < 256 * 3; i++) { - tmp[i] = buf[i] * 4; - } - - g_system->getPaletteManager()->setPalette(tmp, first, numreg); - - if (slow) - waitTOF(); -} - -static byte curvgapal[256 * 3]; - -/*****************************************************************************/ -/* Writes any number of the 256 color registers. */ -/* first: the number of the first color register to write. */ -/* numreg: the number of registers to write */ -/* buf: a char pointer which contains the selected color registers. */ -/* Each value representing a color register occupies 3 bytes in */ -/* the array. The order is red, green then blue. The first byte */ -/* in the array is the red component of the first element selected.*/ -/* The length of the buffer is 3 times the number of registers */ -/* selected. */ -/*****************************************************************************/ -void writeColorRegs(byte *buf, uint16 first, uint16 numreg) { - WSDL_SetColors(buf, first, numreg, 0); - memcpy(&(curvgapal[first * 3]), buf, numreg * 3); -} - -void writeColorRegsSmooth(byte *buf, uint16 first, uint16 numreg) { - WSDL_SetColors(buf, first, numreg, 1); - memcpy(&(curvgapal[first * 3]), buf, numreg * 3); -} - -/*****************************************************************************/ -/* Sets one of the 256 (0..255) color registers. buf is a char pointer, */ -/* the first character in the string is the red value, then green, then */ -/* blue. Each color value is a 6 bit value. */ -/*****************************************************************************/ -void writeColorReg(byte *buf, uint16 regnum) { - writeColorRegs(buf, regnum, 1); -} - -void VGASetPal(void *cmap, uint16 numcolors) { - if (memcmp(cmap, curvgapal, numcolors * 3) != 0) - writeColorRegs((byte *)cmap, 0, numcolors); -} - -byte *WSDL_LockVideo() { - g_ScreenWasLocked = 1; - - return g_DisplayBuffer; -} - -void WSDL_UnlockVideo() { -} - -void WSDL_IgnoreUpdateDisplay(int state) { - g_IgnoreUpdateDisplay = state; -} - -void WSDL_UpdateScreen() { - WSDL_UnlockVideo(); - - if (g_ScreenWasLocked && !g_IgnoreUpdateDisplay) { - g_system->copyRectToScreen(g_DisplayBuffer, VGAScreenWidth, 0, 0, VGAScreenWidth, VGAScreenHeight); - g_system->updateScreen(); - } - - g_ScreenWasLocked = 0; - WSDL_ProcessInput(0); -} - -/*****************************************************************************/ -/* Returns the base address of the current VGA display. */ -/*****************************************************************************/ -byte *getVGABaseAddr(void) { - if (VGABASEADDRESS) - return VGABASEADDRESS; - - return WSDL_LockVideo(); -} - -void ungetVGABaseAddr() { - if (!VGABASEADDRESS) - WSDL_UnlockVideo(); -} - -/*****************************************************************************/ -/* Gets information about the current display. */ -/*****************************************************************************/ -void getMode(uint16 *Mode) { - // Only one mode in SDL. -} - -/*****************************************************************************/ -/* Draws an image to the screen. */ -/*****************************************************************************/ -void drawImage(struct Image *Im, uint16 x, uint16 y) { -#if !defined(DOSCODE) - int sx, sy, dx, dy, w, h; - - sx = 0; - sy = 0; - dx = x; - dy = y; - w = Im->Width; - h = Im->Height; - - if (dx < 0) { - sx -= dx; - w += dx; - dx = 0; - } - - if (dy < 0) { - sy -= dy; - w += dy; - dy = 0; - } - - if ((uint)(dx + w) > VGAScreenWidth) - w = VGAScreenWidth - dx; - - if ((uint)(dy + h) > VGAScreenHeight) - h = VGAScreenHeight - dy; - - if (w > 0 && h > 0) { - byte *s = Im->ImageData + sy * Im->Width + sx; - byte *d = getVGABaseAddr() + dy * VGAScreenWidth + dx; - - while (h-- > 0) { - memcpy(d, s, w); - s += Im->Width; - d += VGAScreenWidth; - } - - ungetVGABaseAddr(); - } - -#else - uint32 RealOffset, - SegmentOffset, - LeftInSegment; - char *video, - *curline, - *imdata = Im->ImageData; - uint16 counterx, - countery = 0, - numwholelines, - numpartiallines, - curpage; - - while (countery < Im->Height) { - RealOffset = (VGAScreenWidth * (y + countery)) + x; - curpage = RealOffset / VGABytesPerPage; - SegmentOffset = RealOffset - (curpage * VGABytesPerPage); - LeftInSegment = VGABytesPerPage - SegmentOffset; - setPage(curpage); - video = (char *)(((int32)(VGABASEADDRESS)) + SegmentOffset); - - numwholelines = LeftInSegment / VGAScreenWidth; - numpartiallines = 0; - counterx = LeftInSegment - (numwholelines * VGAScreenWidth); - - if (counterx >= Im->Width) - numwholelines++; - else - numpartiallines = 1; - - while (numwholelines && (countery < Im->Height)) { - curline = video; - - for (counterx = 0; counterx < Im->Width; counterx++) { - *video = *imdata; - video++; - imdata++; - } - - video = curline; - video += VGAScreenWidth; - countery ++; - numwholelines --; - LeftInSegment -= VGAScreenWidth; - } - - if (numpartiallines && (countery < Im->Height)) { - countery ++; - curline = video; - - for (counterx = 0; counterx < Im->Width; counterx++) { - if (LeftInSegment == 0L) { - setPage(curpage + 1); - LeftInSegment = VGABytesPerPage; - video = (char *)(VGABASEADDRESS); - } - - *video = *imdata; - video++; - imdata++; - LeftInSegment--; - } - } - } - -#endif -} - - - - -/*****************************************************************************/ -/* Draws an image to the screen. */ -/*****************************************************************************/ -void drawMaskImage(struct Image *Im, uint16 x, uint16 y) { -#if !defined(DOSCODE) - int sx, sy, dx, dy, w, h; - - sx = 0; - sy = 0; - dx = x; - dy = y; - w = Im->Width; - h = Im->Height; - - if (dx < 0) { - sx -= dx; - w += dx; - dx = 0; - } - - if (dy < 0) { - sy -= dy; - w += dy; - dy = 0; - } - - if ((uint)(dx + w) > VGAScreenWidth) - w = VGAScreenWidth - dx; - - if ((uint)(dy + h) > VGAScreenHeight) - h = VGAScreenHeight - dy; - - if (w > 0 && h > 0) { - byte *s = Im->ImageData + sy * Im->Width + sx; - byte *d = getVGABaseAddr() + dy * VGAScreenWidth + dx; - - while (h-- > 0) { - byte *ss = s; - byte *dd = d; - int ww = w; - - while (ww-- > 0) { - byte c = *ss++; - - if (c) *dd++ = c - 1; - else dd++; - } - - s += Im->Width; - d += VGAScreenWidth; - } - - ungetVGABaseAddr(); - } - -#else - uint32 RealOffset, - SegmentOffset, - LeftInSegment; - char *video, - *curline, - *imdata = Im->ImageData; - uint16 counterx, - countery = 0, - numwholelines, - numpartiallines, - curpage; - - while (countery < Im->Height) { - RealOffset = (VGAScreenWidth * (y + countery)) + x; - curpage = RealOffset / VGABytesPerPage; - SegmentOffset = RealOffset - (curpage * VGABytesPerPage); - LeftInSegment = VGABytesPerPage - SegmentOffset; - setPage(curpage); - video = (char *)(((int32)(VGABASEADDRESS)) + SegmentOffset); - - numwholelines = LeftInSegment / VGAScreenWidth; - numpartiallines = 0; - counterx = LeftInSegment - (numwholelines * VGAScreenWidth); - - if (counterx >= Im->Width) - numwholelines++; - else - numpartiallines = 1; - - while (numwholelines && (countery < Im->Height)) { - curline = video; - - for (counterx = 0; counterx < Im->Width; counterx++) { - if (*imdata) - *video = *imdata - 1; - - video++; - imdata++; - } - - video = curline; - video += VGAScreenWidth; - countery ++; - numwholelines --; - LeftInSegment -= VGAScreenWidth; - } - - if (numpartiallines && (countery < Im->Height)) { - countery ++; - curline = video; - - for (counterx = 0; counterx < Im->Width; counterx++) { - if (LeftInSegment == 0L) { - setPage(curpage + 1); - LeftInSegment = VGABytesPerPage; - video = (char *)(VGABASEADDRESS); - } - - if (*imdata) - *video = *imdata - 1; - - video++; - imdata++; - LeftInSegment--; - } - } - } - -#endif -} - - - - -/*****************************************************************************/ -/* Reads an image from the screen. */ -/*****************************************************************************/ -void readScreenImage(struct Image *Im, uint16 x, uint16 y) { -#if !defined(DOSCODE) - int sx, sy, dx, dy, w, h; - - sx = 0; - sy = 0; - dx = x; - dy = y; - w = Im->Width; - h = Im->Height; - - if (dx < 0) { - sx -= dx; - w += dx; - dx = 0; - } - - if (dy < 0) { - sy -= dy; - w += dy; - dy = 0; - } - - if ((uint)(dx + w) > VGAScreenWidth) - w = VGAScreenWidth - dx; - - if ((uint)(dy + h) > VGAScreenHeight) - h = VGAScreenHeight - dy; - - if (w > 0 && h > 0) { - byte *s = Im->ImageData + sy * Im->Width + sx; - byte *d = getVGABaseAddr() + dy * VGAScreenWidth + dx; - - while (h-- > 0) { - memcpy(s, d, w); - s += Im->Width; - d += VGAScreenWidth; - } - - ungetVGABaseAddr(); - } - -#else - uint32 RealOffset, - SegmentOffset, - LeftInSegment; - char *video, - *curline, - *imdata = Im->ImageData; - uint16 counterx, - countery = 0, - numwholelines, - numpartiallines, - curpage; - - while (countery < Im->Height) { - RealOffset = (VGAScreenWidth * (y + countery)) + x; - curpage = RealOffset / VGABytesPerPage; - SegmentOffset = RealOffset - (curpage * VGABytesPerPage); - LeftInSegment = VGABytesPerPage - SegmentOffset; - setPage(curpage); - video = (char *)(((int32)(VGABASEADDRESS)) + SegmentOffset); - - numwholelines = LeftInSegment / VGAScreenWidth; - numpartiallines = 0; - counterx = LeftInSegment - (numwholelines * VGAScreenWidth); - - if (counterx >= Im->Width) - numwholelines++; - else - numpartiallines = 1; - - while (numwholelines && (countery < Im->Height)) { - curline = video; - - for (counterx = 0; counterx < Im->Width; counterx++) { - *imdata = *video; - video++; - imdata++; - } - - video = curline; - video += VGAScreenWidth; - countery ++; - numwholelines --; - LeftInSegment -= VGAScreenWidth; - } - - if (numpartiallines && (countery < Im->Height)) { - countery ++; - curline = video; - - for (counterx = 0; counterx < Im->Width; counterx++) { - if (LeftInSegment == 0L) { - setPage(curpage + 1); - LeftInSegment = VGABytesPerPage; - video = (char *)(VGABASEADDRESS); - } - - *imdata = *video; - video++; - imdata++; - LeftInSegment--; - } - } - } - -#endif -} - - - - -/*****************************************************************************/ -/* Blits a piece of one image to another. */ -/* NOTE: for our purposes, assumes that ImDest is to be in VGA memory. */ -/*****************************************************************************/ -void bltBitMap(Image *ImSource, uint16 xs, uint16 ys, Image *ImDest, - uint16 xd, uint16 yd, uint16 width, uint16 height) { -#if !defined(DOSCODE) - // I think the old code assumed that the source image data was valid for the given box. - // I will proceed on that assumption. - int sx, sy, dx, dy, w, h; - - sx = xs; - sy = ys; - dx = xd; - dy = yd; - w = width; - h = height; - - if (dx < 0) { - sx -= dx; - w += dx; - dx = 0; - } - - if (dy < 0) { - sy -= dy; - w += dy; - dy = 0; - } - - if (dx + w > ImDest->Width) w = ImDest->Width - dx; - - if (dy + h > ImDest->Height) h = ImDest->Height - dy; - - if (w > 0 && h > 0) { - byte *s = ImSource->ImageData + sy * ImSource->Width + sx; - byte *d = ImDest->ImageData + dy * ImDest->Width + dx; - - while (h-- > 0) { - memcpy(d, s, w); - s += ImSource->Width; - d += ImDest->Width; - } - } - -#else - uint32 RealOffset, - SegmentOffset, - LeftInSegment; - char *video, - *curdestline, - *cursourceline = ImSource->ImageData, - *imdata; - uint16 counterx, - countery = 0, - numwholelines, - numpartiallines, - curpage; - - cursourceline += (((int32) ys) * ImSource->Width) + xs; - imdata = cursourceline; - - while (countery < height) { - RealOffset = (ImDest->Width * (yd + countery)) + xd; - curpage = RealOffset / VGABytesPerPage; - SegmentOffset = RealOffset - (curpage * VGABytesPerPage); - LeftInSegment = VGABytesPerPage - SegmentOffset; - setPage(curpage); - - video = (char *)(((int32)(ImDest->ImageData)) + SegmentOffset); - - numwholelines = LeftInSegment / ImDest->Width; - numpartiallines = 0; - counterx = LeftInSegment - (numwholelines * ImDest->Width); - - if (counterx >= width) - numwholelines++; - else - numpartiallines = 1; - - while (numwholelines && (countery < height)) { - curdestline = video; - cursourceline = imdata; - - for (counterx = 0; counterx < width; counterx++) { - *video = *imdata; - video++; - imdata++; - } - - video = curdestline; - video += ImDest->Width; - imdata = cursourceline; - imdata += ImSource->Width; - - countery ++; - numwholelines --; - LeftInSegment -= ImDest->Width; - } - - if (numpartiallines && (countery < height)) { - countery ++; - curdestline = video; - cursourceline = imdata; - - for (counterx = 0; counterx < width; counterx++) { - if (LeftInSegment == 0L) { - setPage(curpage + 1); - LeftInSegment = VGABytesPerPage; - video = ImDest->ImageData; - } - - *video = *imdata; - video++; - imdata++; - LeftInSegment--; - } - - video = curdestline; - video += ImDest->Width; - imdata = cursourceline; - imdata += ImSource->Width; - } - } - -#endif -} - - -byte *TempScrollData; - - -/*****************************************************************************/ -/* Scrolls the display in the x direction by blitting. */ -/* The TempScrollData variable must be initialized to some memory, or this */ -/* function will fail. */ -/*****************************************************************************/ -void scrollDisplayX(int16 dx, uint16 x1, uint16 y1, uint16 x2, uint16 y2) { - struct Image Im; - uint16 temp; - - Im.ImageData = TempScrollData; - - if (x1 > x2) { - temp = x2; - x2 = x1; - x1 = temp; - } - - if (y1 > y2) { - temp = y2; - y2 = y1; - y1 = temp; - } - - if (dx > 0) { - Im.Width = x2 - x1 + 1 - dx; - Im.Height = y2 - y1 + 1; - - readScreenImage(&Im, x1, y1); - drawImage(&Im, x1 + dx, y1); - - setAPen(0); - rectFill(x1, y1, x1 + dx - 1, y2); - } else if (dx < 0) { - Im.Width = x2 - x1 + 1 + dx; - Im.Height = y2 - y1 + 1; - - readScreenImage(&Im, x1 - dx, y1); - drawImage(&Im, x1, y1); - - setAPen(0); - rectFill(x2 + dx + 1, y1, x2, y2); - } -} - - - - - -/*****************************************************************************/ -/* Scrolls the display in the y direction by blitting. */ -/*****************************************************************************/ -void scrollDisplayY(int16 dy, uint16 x1, uint16 y1, uint16 x2, uint16 y2) { - struct Image Im; - uint16 temp; - - Im.ImageData = TempScrollData; - - if (x1 > x2) { - temp = x2; - x2 = x1; - x1 = temp; - } - - if (y1 > y2) { - temp = y2; - y2 = y1; - y1 = temp; - } - - if (dy > 0) { - Im.Width = x2 - x1 + 1; - Im.Height = y2 - y1 + 1 - dy; - - readScreenImage(&Im, x1, y1); - drawImage(&Im, x1, y1 + dy); - - setAPen(0); - rectFill(x1, y1, x2, y1 + dy - 1); - } else if (dy < 0) { - Im.Width = x2 - x1 + 1; - Im.Height = y2 - y1 + 1 + dy; - - readScreenImage(&Im, x1, y1 - dy); - drawImage(&Im, x1, y1); - - setAPen(0); - rectFill(x1, y2 + dy + 1, x2, y2); - } -} - - - -static unsigned char curapen = 0; - -/*****************************************************************************/ -/* Sets the pen number to use on all the drawing operations. */ -/*****************************************************************************/ -void setAPen(uint16 pennum) { - curapen = (unsigned char)pennum; -} - - - - -/*****************************************************************************/ -/* Fills in a rectangle. */ -/*****************************************************************************/ -void rectFill(uint16 x1, uint16 y1, uint16 x2, uint16 y2) { -#if !defined(DOSCODE) - int dx, dy, w, h; - - dx = x1; - dy = y1; - w = x2 - x1 + 1; - h = y2 - y1 + 1; - - if (dx < 0) { - w += dx; - dx = 0; - } - - if (dy < 0) { - w += dy; - dy = 0; - } - - if ((uint)(dx + w) > VGAScreenWidth) - w = VGAScreenWidth - dx; - - if ((uint)(dy + h) > VGAScreenHeight) - h = VGAScreenHeight - dy; - - if (w > 0 && h > 0) { - char *d = (char *)getVGABaseAddr() + dy * VGAScreenWidth + dx; - - while (h-- > 0) { - char *dd = d; - int ww = w; - - while (ww-- > 0) { - *dd++ = curapen; - } - - d += VGAScreenWidth; - } - - ungetVGABaseAddr(); - } - -#else - uint32 RealOffset, - SegmentOffset, - LeftInSegment; - char *video, - *curline; - uint16 counterx, - countery = y1, - numwholelines, - numpartiallines, - curpage; - - while (countery <= y2) { - RealOffset = (VGAScreenWidth * countery) + x1; - curpage = RealOffset / VGABytesPerPage; - SegmentOffset = RealOffset - (curpage * VGABytesPerPage); - LeftInSegment = VGABytesPerPage - SegmentOffset; - setPage(curpage); - video = (char *)(((int32)(VGABASEADDRESS)) + SegmentOffset); - - numwholelines = LeftInSegment / VGAScreenWidth; - numpartiallines = 0; - counterx = LeftInSegment - (numwholelines * VGAScreenWidth); - - if (counterx >= (x2 - x1 + 1)) - numwholelines++; - else - numpartiallines = 1; - - while (numwholelines && (countery <= y2)) { - curline = video; - - for (counterx = x1; counterx <= x2; counterx++) { - *video = curapen; - video++; - } - - video = curline; - video += VGAScreenWidth; - countery ++; - numwholelines --; - LeftInSegment -= VGAScreenWidth; - } - - if (numpartiallines && (countery <= y2)) { - countery ++; - curline = video; - - for (counterx = x1; counterx <= x2; counterx++) { - if (LeftInSegment == 0L) { - setPage(curpage + 1); - LeftInSegment = VGABytesPerPage; - video = (char *)(VGABASEADDRESS); - } - - *video = curapen; - video++; - LeftInSegment--; - } - } - } - -#endif -} - - - -/*****************************************************************************/ -/* Draws a horizontal line. */ -/*****************************************************************************/ -void drawVLine(uint16 x, uint16 y1, uint16 y2) { - rectFill(x, y1, x, y2); -} - - - - -/*****************************************************************************/ -/* Draws a vertical line. */ -/*****************************************************************************/ -void drawHLine(uint16 x1, uint16 y, uint16 x2) { - rectFill(x1, y, x2, y); -} - - - - -/*****************************************************************************/ -/* Ghoasts a region on the screen using the desired pen color. */ -/*****************************************************************************/ -void ghoastRect(uint16 pencolor, uint16 x1, uint16 y1, uint16 x2, uint16 y2) { -#if !defined(DOSCODE) - int dx, dy, w, h; - - dx = x1; - dy = y1; - w = x2 - x1 + 1; - h = y2 - y1 + 1; - - if (dx < 0) { - w += dx; - dx = 0; - } - - if (dy < 0) { - w += dy; - dy = 0; - } - - if ((uint)(dx + w) > VGAScreenWidth) - w = VGAScreenWidth - dx; - - if ((uint)(dy + h) > VGAScreenHeight) - h = VGAScreenHeight - dy; - - if (w > 0 && h > 0) { - char *d = (char *)getVGABaseAddr() + dy * VGAScreenWidth + dx; - - while (h-- > 0) { - char *dd = d; - int ww = w; - - if (dy & 1) { - dd++; - ww--; - } - - while (ww > 0) { - *dd = pencolor; - dd += 2; - ww -= 2; - } - - d += VGAScreenWidth; - dy++; - } - - ungetVGABaseAddr(); - } - -#else - uint32 RealOffset, - SegmentOffset; - int32 LeftInSegment; - char *video, - *curline; - uint16 counterx, - countery = y1, - numwholelines, - numpartiallines, - curpage; - - while (countery <= y2) { - RealOffset = (VGAScreenWidth * countery) + x1; - curpage = RealOffset / VGABytesPerPage; - SegmentOffset = RealOffset - (curpage * VGABytesPerPage); - LeftInSegment = VGABytesPerPage - SegmentOffset; - setPage(curpage); - video = (char *)(((int32)(VGABASEADDRESS)) + SegmentOffset); - - numwholelines = LeftInSegment / VGAScreenWidth; - numpartiallines = 0; - counterx = LeftInSegment - (numwholelines * VGAScreenWidth); - - if (counterx >= (x2 - x1 + 1)) - numwholelines++; - else - numpartiallines = 1; - - while (numwholelines && (countery <= y2)) { - curline = video; - counterx = x1; - - if (1 & countery) { - video++; - counterx ++; - } - - while (counterx <= x2) { - *video = pencolor; - video += 2; - counterx += 2; - } - - video = curline; - video += VGAScreenWidth; - countery ++; - numwholelines --; - LeftInSegment -= VGAScreenWidth; - } - - if (numpartiallines && (countery <= y2)) { - countery ++; - curline = video; - counterx = x1; - - if (1 & countery) { - video++; - counterx ++; - LeftInSegment --; - } - - while (counterx < x2) { - if (LeftInSegment <= 0L) { - setPage(curpage + 1); - video = (char *)(((int32)(VGABASEADDRESS)) - LeftInSegment); - LeftInSegment = VGABytesPerPage + LeftInSegment; - } - - *video = pencolor; - video += 2; - counterx += 2; - LeftInSegment -= 2; - } - } - } - -#endif -} - -} // End of namespace Lab +/* 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. + * + */ + +/* + * This code is based on Labyrinth of Time code with assistance of + * + * Copyright (c) 1993 Terra Nova Development + * Copyright (c) 2004 The Wyrmkeep Entertainment Co. + * + */ + +#include "lab/vga.h" +#include "lab/stddefines.h" +#include "lab/mouse.h" + +#include "graphics/palette.h" + +#include "common/events.h" + +namespace Lab { + +//static uint16 NotInRefresh = 0; + +uint32 VGAScreenWidth = 320UL, + VGAScreenHeight = 200UL, + VGAPages = 1UL, + VGABytesPerPage = 65536UL; + +byte *VGABASEADDRESS = 0; + +byte *g_DisplayBuffer = 0; +byte *g_Pixels = 0; + +int g_ScreenWasLocked = 0; +int g_IgnoreUpdateDisplay = 0; +int g_LastWaitTOFTicks = 0; + +int g_MouseX = 0; +int g_MouseY = 0; + +uint16 g_NextKeyIn = 0; +uint16 g_KeyBuf[64]; +uint16 g_NextKeyOut = 0; +bool g_MouseAtEdge = false; + +/*****************************************************************************/ +/* Sets the display mode. */ +/*****************************************************************************/ +void setMode(char mode) { + // There are no modes for SDL. +} + +/*****************************************************************************/ +/* Sets up either a low-res or a high-res 256 color screen. */ +/*****************************************************************************/ +bool createScreen(bool HiRes) { + //VGABASEADDRESS = (unsigned long)malloc(640 * 480); + VGABASEADDRESS = 0; + VGAScreenWidth = 640; + VGAScreenHeight = 480; + VGAPages = 1; + VGABytesPerPage = 640 * 480; + + g_DisplayBuffer = (byte *)malloc(VGABytesPerPage); + g_Pixels = (byte *)calloc(VGABytesPerPage, 4); + + return true; +} + + + +/*****************************************************************************/ +/* Sets the current page on the VGA card. */ +/*****************************************************************************/ +void setPage(uint16 PageNum) { + // PageNum should always calculated out to zero for SDL. + assert(PageNum == 0); +} + + + +void VGAStorePage(void) { + // does nothing in SDL +} + +void VGARestorePage(void) { + // does nothing in SDL +} + +void changeVolume(int delta) { + warning("STUB: changeVolume()"); +} + +uint16 WSDL_GetNextChar() { + uint16 c = 0; + + WSDL_ProcessInput(0); + if (g_NextKeyIn != g_NextKeyOut) { + c = g_KeyBuf[g_NextKeyOut]; + g_NextKeyOut = ((((unsigned int)((g_NextKeyOut + 1) >> 31) >> 26) + (byte)g_NextKeyOut + 1) & 0x3F) + - ((unsigned int)((g_NextKeyOut + 1) >> 31) >> 26); + } + + return c; +} + +bool WSDL_HasNextChar() { + WSDL_ProcessInput(0); + return g_NextKeyIn != g_NextKeyOut; +} + +void WSDL_ProcessInput(bool can_delay) { + int n; + int lastMouseAtEdge; + int flags = 0; + + Common::Event event; + + if (1 /*!g_IgnoreProcessInput*/) { + while (g_system->getEventManager()->pollEvent(event)) { + switch (event.type) { + case Common::EVENT_RBUTTONDOWN: + flags |= 8; + mouse_handler(flags, g_MouseX, g_MouseY); + break; + + case Common::EVENT_LBUTTONDOWN: + flags |= 2; + mouse_handler(flags, g_MouseX, g_MouseY); + break; + + case Common::EVENT_MOUSEMOVE: + lastMouseAtEdge = g_MouseAtEdge; + g_MouseAtEdge = false; + g_MouseX = event.mouse.x; + if (event.mouse.x <= 0) { + g_MouseX = 0; + g_MouseAtEdge = true; + } + if (g_MouseX > 639) { + g_MouseX = 640; + g_MouseAtEdge = true; + } + + g_MouseY = event.mouse.y; + if (event.mouse.y <= 0) { + g_MouseY = 0; + g_MouseAtEdge = true; + } + if (g_MouseY > 479) { + g_MouseY = 480; + g_MouseAtEdge = true; + } + + if (!lastMouseAtEdge || !g_MouseAtEdge) + mouse_handler(1, g_MouseX, g_MouseY); + + break; + + case Common::EVENT_KEYDOWN: + switch (event.kbd.keycode) { + case Common::KEYCODE_LEFTBRACKET: + changeVolume(-1); + break; + + case Common::KEYCODE_RIGHTBRACKET: + changeVolume(1); + break; + + case Common::KEYCODE_z: + //saveSettings(); + break; + + default: + n = ((((unsigned int)((g_NextKeyIn + 1) >> 31) >> 26) + (byte)g_NextKeyIn + 1) & 0x3F) + - ((unsigned int)((g_NextKeyIn + 1) >> 31) >> 26); + if (n != g_NextKeyOut) { + g_KeyBuf[g_NextKeyIn] = event.kbd.keycode; + g_NextKeyIn = n; + } + } + break; + + case Common::EVENT_QUIT: + case Common::EVENT_RTL: + default: + break; + } + + g_system->copyRectToScreen(g_DisplayBuffer, VGAScreenWidth, 0, 0, VGAScreenWidth, VGAScreenHeight); + g_system->updateScreen(); + } + } + + if (can_delay) + g_system->delayMillis(10); +} + +void WSDL_GetMousePos(int *x, int *y) { + WSDL_ProcessInput(0); + + *x = g_MouseX; + *y = g_MouseY; +} + + +void waitTOF() { + int untilOutOfRefresh = 1; + + if (g_ScreenWasLocked || untilOutOfRefresh) { + g_system->copyRectToScreen(g_DisplayBuffer, VGAScreenWidth, 0, 0, VGAScreenWidth, VGAScreenHeight); + g_system->updateScreen(); + } + + g_ScreenWasLocked = 0; + WSDL_ProcessInput(0); + + uint32 now; + + for (now = g_system->getMillis(); now - g_LastWaitTOFTicks <= 0xF; now = g_system->getMillis() ) + g_system->delayMillis(g_LastWaitTOFTicks - now + 17); + + g_LastWaitTOFTicks = now; +} + +void WSDL_SetColors(byte *buf, uint16 first, uint16 numreg, uint16 slow) { + byte tmp[256 * 3]; + + for (int i = 0; i < 256 * 3; i++) { + tmp[i] = buf[i] * 4; + } + + g_system->getPaletteManager()->setPalette(tmp, first, numreg); + + if (slow) + waitTOF(); +} + +static byte curvgapal[256 * 3]; + +/*****************************************************************************/ +/* Writes any number of the 256 color registers. */ +/* first: the number of the first color register to write. */ +/* numreg: the number of registers to write */ +/* buf: a char pointer which contains the selected color registers. */ +/* Each value representing a color register occupies 3 bytes in */ +/* the array. The order is red, green then blue. The first byte */ +/* in the array is the red component of the first element selected.*/ +/* The length of the buffer is 3 times the number of registers */ +/* selected. */ +/*****************************************************************************/ +void writeColorRegs(byte *buf, uint16 first, uint16 numreg) { + WSDL_SetColors(buf, first, numreg, 0); + memcpy(&(curvgapal[first * 3]), buf, numreg * 3); +} + +void writeColorRegsSmooth(byte *buf, uint16 first, uint16 numreg) { + WSDL_SetColors(buf, first, numreg, 1); + memcpy(&(curvgapal[first * 3]), buf, numreg * 3); +} + +/*****************************************************************************/ +/* Sets one of the 256 (0..255) color registers. buf is a char pointer, */ +/* the first character in the string is the red value, then green, then */ +/* blue. Each color value is a 6 bit value. */ +/*****************************************************************************/ +void writeColorReg(byte *buf, uint16 regnum) { + writeColorRegs(buf, regnum, 1); +} + +void VGASetPal(void *cmap, uint16 numcolors) { + if (memcmp(cmap, curvgapal, numcolors * 3) != 0) + writeColorRegs((byte *)cmap, 0, numcolors); +} + +byte *WSDL_LockVideo() { + g_ScreenWasLocked = 1; + + return g_DisplayBuffer; +} + +void WSDL_UnlockVideo() { +} + +void WSDL_IgnoreUpdateDisplay(int state) { + g_IgnoreUpdateDisplay = state; +} + +void WSDL_UpdateScreen() { + WSDL_UnlockVideo(); + + if (g_ScreenWasLocked && !g_IgnoreUpdateDisplay) { + g_system->copyRectToScreen(g_DisplayBuffer, VGAScreenWidth, 0, 0, VGAScreenWidth, VGAScreenHeight); + g_system->updateScreen(); + } + + g_ScreenWasLocked = 0; + WSDL_ProcessInput(0); +} + +/*****************************************************************************/ +/* Returns the base address of the current VGA display. */ +/*****************************************************************************/ +byte *getVGABaseAddr(void) { + if (VGABASEADDRESS) + return VGABASEADDRESS; + + return WSDL_LockVideo(); +} + +void ungetVGABaseAddr() { + if (!VGABASEADDRESS) + WSDL_UnlockVideo(); +} + +/*****************************************************************************/ +/* Gets information about the current display. */ +/*****************************************************************************/ +void getMode(uint16 *Mode) { + // Only one mode in SDL. +} + +/*****************************************************************************/ +/* Draws an image to the screen. */ +/*****************************************************************************/ +void drawImage(struct Image *Im, uint16 x, uint16 y) { +#if !defined(DOSCODE) + int sx, sy, dx, dy, w, h; + + sx = 0; + sy = 0; + dx = x; + dy = y; + w = Im->Width; + h = Im->Height; + + if (dx < 0) { + sx -= dx; + w += dx; + dx = 0; + } + + if (dy < 0) { + sy -= dy; + w += dy; + dy = 0; + } + + if ((uint)(dx + w) > VGAScreenWidth) + w = VGAScreenWidth - dx; + + if ((uint)(dy + h) > VGAScreenHeight) + h = VGAScreenHeight - dy; + + if (w > 0 && h > 0) { + byte *s = Im->ImageData + sy * Im->Width + sx; + byte *d = getVGABaseAddr() + dy * VGAScreenWidth + dx; + + while (h-- > 0) { + memcpy(d, s, w); + s += Im->Width; + d += VGAScreenWidth; + } + + ungetVGABaseAddr(); + } + +#else + uint32 RealOffset, + SegmentOffset, + LeftInSegment; + char *video, + *curline, + *imdata = Im->ImageData; + uint16 counterx, + countery = 0, + numwholelines, + numpartiallines, + curpage; + + while (countery < Im->Height) { + RealOffset = (VGAScreenWidth * (y + countery)) + x; + curpage = RealOffset / VGABytesPerPage; + SegmentOffset = RealOffset - (curpage * VGABytesPerPage); + LeftInSegment = VGABytesPerPage - SegmentOffset; + setPage(curpage); + video = (char *)(((int32)(VGABASEADDRESS)) + SegmentOffset); + + numwholelines = LeftInSegment / VGAScreenWidth; + numpartiallines = 0; + counterx = LeftInSegment - (numwholelines * VGAScreenWidth); + + if (counterx >= Im->Width) + numwholelines++; + else + numpartiallines = 1; + + while (numwholelines && (countery < Im->Height)) { + curline = video; + + for (counterx = 0; counterx < Im->Width; counterx++) { + *video = *imdata; + video++; + imdata++; + } + + video = curline; + video += VGAScreenWidth; + countery ++; + numwholelines --; + LeftInSegment -= VGAScreenWidth; + } + + if (numpartiallines && (countery < Im->Height)) { + countery ++; + curline = video; + + for (counterx = 0; counterx < Im->Width; counterx++) { + if (LeftInSegment == 0L) { + setPage(curpage + 1); + LeftInSegment = VGABytesPerPage; + video = (char *)(VGABASEADDRESS); + } + + *video = *imdata; + video++; + imdata++; + LeftInSegment--; + } + } + } + +#endif +} + + + + +/*****************************************************************************/ +/* Draws an image to the screen. */ +/*****************************************************************************/ +void drawMaskImage(struct Image *Im, uint16 x, uint16 y) { +#if !defined(DOSCODE) + int sx, sy, dx, dy, w, h; + + sx = 0; + sy = 0; + dx = x; + dy = y; + w = Im->Width; + h = Im->Height; + + if (dx < 0) { + sx -= dx; + w += dx; + dx = 0; + } + + if (dy < 0) { + sy -= dy; + w += dy; + dy = 0; + } + + if ((uint)(dx + w) > VGAScreenWidth) + w = VGAScreenWidth - dx; + + if ((uint)(dy + h) > VGAScreenHeight) + h = VGAScreenHeight - dy; + + if (w > 0 && h > 0) { + byte *s = Im->ImageData + sy * Im->Width + sx; + byte *d = getVGABaseAddr() + dy * VGAScreenWidth + dx; + + while (h-- > 0) { + byte *ss = s; + byte *dd = d; + int ww = w; + + while (ww-- > 0) { + byte c = *ss++; + + if (c) *dd++ = c - 1; + else dd++; + } + + s += Im->Width; + d += VGAScreenWidth; + } + + ungetVGABaseAddr(); + } + +#else + uint32 RealOffset, + SegmentOffset, + LeftInSegment; + char *video, + *curline, + *imdata = Im->ImageData; + uint16 counterx, + countery = 0, + numwholelines, + numpartiallines, + curpage; + + while (countery < Im->Height) { + RealOffset = (VGAScreenWidth * (y + countery)) + x; + curpage = RealOffset / VGABytesPerPage; + SegmentOffset = RealOffset - (curpage * VGABytesPerPage); + LeftInSegment = VGABytesPerPage - SegmentOffset; + setPage(curpage); + video = (char *)(((int32)(VGABASEADDRESS)) + SegmentOffset); + + numwholelines = LeftInSegment / VGAScreenWidth; + numpartiallines = 0; + counterx = LeftInSegment - (numwholelines * VGAScreenWidth); + + if (counterx >= Im->Width) + numwholelines++; + else + numpartiallines = 1; + + while (numwholelines && (countery < Im->Height)) { + curline = video; + + for (counterx = 0; counterx < Im->Width; counterx++) { + if (*imdata) + *video = *imdata - 1; + + video++; + imdata++; + } + + video = curline; + video += VGAScreenWidth; + countery ++; + numwholelines --; + LeftInSegment -= VGAScreenWidth; + } + + if (numpartiallines && (countery < Im->Height)) { + countery ++; + curline = video; + + for (counterx = 0; counterx < Im->Width; counterx++) { + if (LeftInSegment == 0L) { + setPage(curpage + 1); + LeftInSegment = VGABytesPerPage; + video = (char *)(VGABASEADDRESS); + } + + if (*imdata) + *video = *imdata - 1; + + video++; + imdata++; + LeftInSegment--; + } + } + } + +#endif +} + + + + +/*****************************************************************************/ +/* Reads an image from the screen. */ +/*****************************************************************************/ +void readScreenImage(struct Image *Im, uint16 x, uint16 y) { +#if !defined(DOSCODE) + int sx, sy, dx, dy, w, h; + + sx = 0; + sy = 0; + dx = x; + dy = y; + w = Im->Width; + h = Im->Height; + + if (dx < 0) { + sx -= dx; + w += dx; + dx = 0; + } + + if (dy < 0) { + sy -= dy; + w += dy; + dy = 0; + } + + if ((uint)(dx + w) > VGAScreenWidth) + w = VGAScreenWidth - dx; + + if ((uint)(dy + h) > VGAScreenHeight) + h = VGAScreenHeight - dy; + + if (w > 0 && h > 0) { + byte *s = Im->ImageData + sy * Im->Width + sx; + byte *d = getVGABaseAddr() + dy * VGAScreenWidth + dx; + + while (h-- > 0) { + memcpy(s, d, w); + s += Im->Width; + d += VGAScreenWidth; + } + + ungetVGABaseAddr(); + } + +#else + uint32 RealOffset, + SegmentOffset, + LeftInSegment; + char *video, + *curline, + *imdata = Im->ImageData; + uint16 counterx, + countery = 0, + numwholelines, + numpartiallines, + curpage; + + while (countery < Im->Height) { + RealOffset = (VGAScreenWidth * (y + countery)) + x; + curpage = RealOffset / VGABytesPerPage; + SegmentOffset = RealOffset - (curpage * VGABytesPerPage); + LeftInSegment = VGABytesPerPage - SegmentOffset; + setPage(curpage); + video = (char *)(((int32)(VGABASEADDRESS)) + SegmentOffset); + + numwholelines = LeftInSegment / VGAScreenWidth; + numpartiallines = 0; + counterx = LeftInSegment - (numwholelines * VGAScreenWidth); + + if (counterx >= Im->Width) + numwholelines++; + else + numpartiallines = 1; + + while (numwholelines && (countery < Im->Height)) { + curline = video; + + for (counterx = 0; counterx < Im->Width; counterx++) { + *imdata = *video; + video++; + imdata++; + } + + video = curline; + video += VGAScreenWidth; + countery ++; + numwholelines --; + LeftInSegment -= VGAScreenWidth; + } + + if (numpartiallines && (countery < Im->Height)) { + countery ++; + curline = video; + + for (counterx = 0; counterx < Im->Width; counterx++) { + if (LeftInSegment == 0L) { + setPage(curpage + 1); + LeftInSegment = VGABytesPerPage; + video = (char *)(VGABASEADDRESS); + } + + *imdata = *video; + video++; + imdata++; + LeftInSegment--; + } + } + } + +#endif +} + + + + +/*****************************************************************************/ +/* Blits a piece of one image to another. */ +/* NOTE: for our purposes, assumes that ImDest is to be in VGA memory. */ +/*****************************************************************************/ +void bltBitMap(Image *ImSource, uint16 xs, uint16 ys, Image *ImDest, + uint16 xd, uint16 yd, uint16 width, uint16 height) { +#if !defined(DOSCODE) + // I think the old code assumed that the source image data was valid for the given box. + // I will proceed on that assumption. + int sx, sy, dx, dy, w, h; + + sx = xs; + sy = ys; + dx = xd; + dy = yd; + w = width; + h = height; + + if (dx < 0) { + sx -= dx; + w += dx; + dx = 0; + } + + if (dy < 0) { + sy -= dy; + w += dy; + dy = 0; + } + + if (dx + w > ImDest->Width) w = ImDest->Width - dx; + + if (dy + h > ImDest->Height) h = ImDest->Height - dy; + + if (w > 0 && h > 0) { + byte *s = ImSource->ImageData + sy * ImSource->Width + sx; + byte *d = ImDest->ImageData + dy * ImDest->Width + dx; + + while (h-- > 0) { + memcpy(d, s, w); + s += ImSource->Width; + d += ImDest->Width; + } + } + +#else + uint32 RealOffset, + SegmentOffset, + LeftInSegment; + char *video, + *curdestline, + *cursourceline = ImSource->ImageData, + *imdata; + uint16 counterx, + countery = 0, + numwholelines, + numpartiallines, + curpage; + + cursourceline += (((int32) ys) * ImSource->Width) + xs; + imdata = cursourceline; + + while (countery < height) { + RealOffset = (ImDest->Width * (yd + countery)) + xd; + curpage = RealOffset / VGABytesPerPage; + SegmentOffset = RealOffset - (curpage * VGABytesPerPage); + LeftInSegment = VGABytesPerPage - SegmentOffset; + setPage(curpage); + + video = (char *)(((int32)(ImDest->ImageData)) + SegmentOffset); + + numwholelines = LeftInSegment / ImDest->Width; + numpartiallines = 0; + counterx = LeftInSegment - (numwholelines * ImDest->Width); + + if (counterx >= width) + numwholelines++; + else + numpartiallines = 1; + + while (numwholelines && (countery < height)) { + curdestline = video; + cursourceline = imdata; + + for (counterx = 0; counterx < width; counterx++) { + *video = *imdata; + video++; + imdata++; + } + + video = curdestline; + video += ImDest->Width; + imdata = cursourceline; + imdata += ImSource->Width; + + countery ++; + numwholelines --; + LeftInSegment -= ImDest->Width; + } + + if (numpartiallines && (countery < height)) { + countery ++; + curdestline = video; + cursourceline = imdata; + + for (counterx = 0; counterx < width; counterx++) { + if (LeftInSegment == 0L) { + setPage(curpage + 1); + LeftInSegment = VGABytesPerPage; + video = ImDest->ImageData; + } + + *video = *imdata; + video++; + imdata++; + LeftInSegment--; + } + + video = curdestline; + video += ImDest->Width; + imdata = cursourceline; + imdata += ImSource->Width; + } + } + +#endif +} + + +byte *TempScrollData; + + +/*****************************************************************************/ +/* Scrolls the display in the x direction by blitting. */ +/* The TempScrollData variable must be initialized to some memory, or this */ +/* function will fail. */ +/*****************************************************************************/ +void scrollDisplayX(int16 dx, uint16 x1, uint16 y1, uint16 x2, uint16 y2) { + struct Image Im; + uint16 temp; + + Im.ImageData = TempScrollData; + + if (x1 > x2) { + temp = x2; + x2 = x1; + x1 = temp; + } + + if (y1 > y2) { + temp = y2; + y2 = y1; + y1 = temp; + } + + if (dx > 0) { + Im.Width = x2 - x1 + 1 - dx; + Im.Height = y2 - y1 + 1; + + readScreenImage(&Im, x1, y1); + drawImage(&Im, x1 + dx, y1); + + setAPen(0); + rectFill(x1, y1, x1 + dx - 1, y2); + } else if (dx < 0) { + Im.Width = x2 - x1 + 1 + dx; + Im.Height = y2 - y1 + 1; + + readScreenImage(&Im, x1 - dx, y1); + drawImage(&Im, x1, y1); + + setAPen(0); + rectFill(x2 + dx + 1, y1, x2, y2); + } +} + + + + + +/*****************************************************************************/ +/* Scrolls the display in the y direction by blitting. */ +/*****************************************************************************/ +void scrollDisplayY(int16 dy, uint16 x1, uint16 y1, uint16 x2, uint16 y2) { + struct Image Im; + uint16 temp; + + Im.ImageData = TempScrollData; + + if (x1 > x2) { + temp = x2; + x2 = x1; + x1 = temp; + } + + if (y1 > y2) { + temp = y2; + y2 = y1; + y1 = temp; + } + + if (dy > 0) { + Im.Width = x2 - x1 + 1; + Im.Height = y2 - y1 + 1 - dy; + + readScreenImage(&Im, x1, y1); + drawImage(&Im, x1, y1 + dy); + + setAPen(0); + rectFill(x1, y1, x2, y1 + dy - 1); + } else if (dy < 0) { + Im.Width = x2 - x1 + 1; + Im.Height = y2 - y1 + 1 + dy; + + readScreenImage(&Im, x1, y1 - dy); + drawImage(&Im, x1, y1); + + setAPen(0); + rectFill(x1, y2 + dy + 1, x2, y2); + } +} + + + +static unsigned char curapen = 0; + +/*****************************************************************************/ +/* Sets the pen number to use on all the drawing operations. */ +/*****************************************************************************/ +void setAPen(uint16 pennum) { + curapen = (unsigned char)pennum; +} + + + + +/*****************************************************************************/ +/* Fills in a rectangle. */ +/*****************************************************************************/ +void rectFill(uint16 x1, uint16 y1, uint16 x2, uint16 y2) { +#if !defined(DOSCODE) + int dx, dy, w, h; + + dx = x1; + dy = y1; + w = x2 - x1 + 1; + h = y2 - y1 + 1; + + if (dx < 0) { + w += dx; + dx = 0; + } + + if (dy < 0) { + w += dy; + dy = 0; + } + + if ((uint)(dx + w) > VGAScreenWidth) + w = VGAScreenWidth - dx; + + if ((uint)(dy + h) > VGAScreenHeight) + h = VGAScreenHeight - dy; + + if (w > 0 && h > 0) { + char *d = (char *)getVGABaseAddr() + dy * VGAScreenWidth + dx; + + while (h-- > 0) { + char *dd = d; + int ww = w; + + while (ww-- > 0) { + *dd++ = curapen; + } + + d += VGAScreenWidth; + } + + ungetVGABaseAddr(); + } + +#else + uint32 RealOffset, + SegmentOffset, + LeftInSegment; + char *video, + *curline; + uint16 counterx, + countery = y1, + numwholelines, + numpartiallines, + curpage; + + while (countery <= y2) { + RealOffset = (VGAScreenWidth * countery) + x1; + curpage = RealOffset / VGABytesPerPage; + SegmentOffset = RealOffset - (curpage * VGABytesPerPage); + LeftInSegment = VGABytesPerPage - SegmentOffset; + setPage(curpage); + video = (char *)(((int32)(VGABASEADDRESS)) + SegmentOffset); + + numwholelines = LeftInSegment / VGAScreenWidth; + numpartiallines = 0; + counterx = LeftInSegment - (numwholelines * VGAScreenWidth); + + if (counterx >= (x2 - x1 + 1)) + numwholelines++; + else + numpartiallines = 1; + + while (numwholelines && (countery <= y2)) { + curline = video; + + for (counterx = x1; counterx <= x2; counterx++) { + *video = curapen; + video++; + } + + video = curline; + video += VGAScreenWidth; + countery ++; + numwholelines --; + LeftInSegment -= VGAScreenWidth; + } + + if (numpartiallines && (countery <= y2)) { + countery ++; + curline = video; + + for (counterx = x1; counterx <= x2; counterx++) { + if (LeftInSegment == 0L) { + setPage(curpage + 1); + LeftInSegment = VGABytesPerPage; + video = (char *)(VGABASEADDRESS); + } + + *video = curapen; + video++; + LeftInSegment--; + } + } + } + +#endif +} + + + +/*****************************************************************************/ +/* Draws a horizontal line. */ +/*****************************************************************************/ +void drawVLine(uint16 x, uint16 y1, uint16 y2) { + rectFill(x, y1, x, y2); +} + + + + +/*****************************************************************************/ +/* Draws a vertical line. */ +/*****************************************************************************/ +void drawHLine(uint16 x1, uint16 y, uint16 x2) { + rectFill(x1, y, x2, y); +} + + + + +/*****************************************************************************/ +/* Ghoasts a region on the screen using the desired pen color. */ +/*****************************************************************************/ +void ghoastRect(uint16 pencolor, uint16 x1, uint16 y1, uint16 x2, uint16 y2) { +#if !defined(DOSCODE) + int dx, dy, w, h; + + dx = x1; + dy = y1; + w = x2 - x1 + 1; + h = y2 - y1 + 1; + + if (dx < 0) { + w += dx; + dx = 0; + } + + if (dy < 0) { + w += dy; + dy = 0; + } + + if ((uint)(dx + w) > VGAScreenWidth) + w = VGAScreenWidth - dx; + + if ((uint)(dy + h) > VGAScreenHeight) + h = VGAScreenHeight - dy; + + if (w > 0 && h > 0) { + char *d = (char *)getVGABaseAddr() + dy * VGAScreenWidth + dx; + + while (h-- > 0) { + char *dd = d; + int ww = w; + + if (dy & 1) { + dd++; + ww--; + } + + while (ww > 0) { + *dd = pencolor; + dd += 2; + ww -= 2; + } + + d += VGAScreenWidth; + dy++; + } + + ungetVGABaseAddr(); + } + +#else + uint32 RealOffset, + SegmentOffset; + int32 LeftInSegment; + char *video, + *curline; + uint16 counterx, + countery = y1, + numwholelines, + numpartiallines, + curpage; + + while (countery <= y2) { + RealOffset = (VGAScreenWidth * countery) + x1; + curpage = RealOffset / VGABytesPerPage; + SegmentOffset = RealOffset - (curpage * VGABytesPerPage); + LeftInSegment = VGABytesPerPage - SegmentOffset; + setPage(curpage); + video = (char *)(((int32)(VGABASEADDRESS)) + SegmentOffset); + + numwholelines = LeftInSegment / VGAScreenWidth; + numpartiallines = 0; + counterx = LeftInSegment - (numwholelines * VGAScreenWidth); + + if (counterx >= (x2 - x1 + 1)) + numwholelines++; + else + numpartiallines = 1; + + while (numwholelines && (countery <= y2)) { + curline = video; + counterx = x1; + + if (1 & countery) { + video++; + counterx ++; + } + + while (counterx <= x2) { + *video = pencolor; + video += 2; + counterx += 2; + } + + video = curline; + video += VGAScreenWidth; + countery ++; + numwholelines --; + LeftInSegment -= VGAScreenWidth; + } + + if (numpartiallines && (countery <= y2)) { + countery ++; + curline = video; + counterx = x1; + + if (1 & countery) { + video++; + counterx ++; + LeftInSegment --; + } + + while (counterx < x2) { + if (LeftInSegment <= 0L) { + setPage(curpage + 1); + video = (char *)(((int32)(VGABASEADDRESS)) - LeftInSegment); + LeftInSegment = VGABytesPerPage + LeftInSegment; + } + + *video = pencolor; + video += 2; + counterx += 2; + LeftInSegment -= 2; + } + } + } + +#endif +} + +} // End of namespace Lab -- cgit v1.2.3 From 7baabb22c1e787af780a8ec3df87788223b5cd00 Mon Sep 17 00:00:00 2001 From: Eugene Sandulenko Date: Thu, 25 Dec 2014 19:33:01 +0100 Subject: LAB: Cleanup --- engines/lab/allocroom.cpp | 42 +++++++------- engines/lab/mouse.cpp | 136 +--------------------------------------------- 2 files changed, 23 insertions(+), 155 deletions(-) diff --git a/engines/lab/allocroom.cpp b/engines/lab/allocroom.cpp index 8ca69effbc..339ae0b401 100644 --- a/engines/lab/allocroom.cpp +++ b/engines/lab/allocroom.cpp @@ -176,45 +176,45 @@ static void *getCurMem(uint16 Size) { /* Grabs a chunk of memory from the room buffer, and manages it for a */ /* particular room. */ /*****************************************************************************/ -void allocRoom(void **Ptr, uint16 Size, uint16 RoomNum) { - uint16 RMarker; +void allocRoom(void **Ptr, uint16 size, uint16 roomNum) { + uint16 rMarker; bool doit = true; - if (1 & Size) /* Memory is required to be even aligned */ - Size++; + if (1 & size) /* Memory is required to be even aligned */ + size++; - RMarker = 0; + rMarker = 0; - while ((RMarker < MAXMARKERS) && doit) { - if (RoomMarkers[RMarker].RoomNum == RoomNum) + while ((rMarker < MAXMARKERS) && doit) { + if (RoomMarkers[rMarker].RoomNum == roomNum) doit = false; else - RMarker++; + rMarker++; } - if (RMarker >= MAXMARKERS) { - RMarker = CurMarker; + if (rMarker >= MAXMARKERS) { + rMarker = CurMarker; CurMarker++; if (CurMarker >= MAXMARKERS) CurMarker = 0; - freeRoom(RMarker); - RoomMarkers[RMarker].RoomNum = RoomNum; + freeRoom(rMarker); + RoomMarkers[rMarker].RoomNum = roomNum; } - *Ptr = getCurMem(Size); + *Ptr = getCurMem(size); - if (RoomMarkers[RMarker].Start0 == NULL) { - RoomMarkers[RMarker].Start0 = *Ptr; - RoomMarkers[RMarker].End0 = (void *)(((char *)(*Ptr)) + Size - 1); - } else if (*Ptr < RoomMarkers[RMarker].Start0) { - if (RoomMarkers[RMarker].Start1 == NULL) - RoomMarkers[RMarker].Start1 = *Ptr; + if (RoomMarkers[rMarker].Start0 == NULL) { + RoomMarkers[rMarker].Start0 = *Ptr; + RoomMarkers[rMarker].End0 = (void *)(((char *)(*Ptr)) + size - 1); + } else if (*Ptr < RoomMarkers[rMarker].Start0) { + if (RoomMarkers[rMarker].Start1 == NULL) + RoomMarkers[rMarker].Start1 = *Ptr; - RoomMarkers[RMarker].End1 = (void *)(((char *)(*Ptr)) + Size - 1); + RoomMarkers[rMarker].End1 = (void *)(((char *)(*Ptr)) + size - 1); } else - RoomMarkers[RMarker].End0 = (void *)(((char *)(*Ptr)) + Size - 1); + RoomMarkers[rMarker].End0 = (void *)(((char *)(*Ptr)) + size - 1); } } // End of namespace Lab diff --git a/engines/lab/mouse.cpp b/engines/lab/mouse.cpp index ff2474ed38..3d83a0d6ae 100644 --- a/engines/lab/mouse.cpp +++ b/engines/lab/mouse.cpp @@ -41,28 +41,6 @@ extern uint32 VGAScreenWidth, VGAScreenHeight; void mouseHideXY(void); -#if defined(DOSCODE) -/*****************************************************************************/ -/* Standard mouse calling template. */ -/*****************************************************************************/ -static void mouse(int16 *m1, int16 *m2, int16 *m3, int16 *m4) { - union REGS reg; - - reg.w.ax = *m1; - reg.w.bx = *m2; - reg.w.cx = *m3; - reg.w.dx = *m4; - - int386(0x33, ®, ®); - - *m1 = reg.w.ax; - *m2 = reg.w.bx; - *m3 = reg.w.cx; - *m4 = reg.w.dx; -} -#endif - - static bool LeftClick = false; static uint16 leftx = 0, lefty = 0; static bool RightClick = false; @@ -155,16 +133,10 @@ void attachGadgetList(struct Gadget *GadList) { static void drawMouse(void) { if (BackImage.ImageData) { -#if !defined(DOSCODE) - if (backx <= 640 - BackImage.Width && backy <= 480 - BackImage.Height) -#endif drawMaskImage(&MouseImage, backx, backy); } else { -#if !defined(DOSCODE) - if (CurMouseX <= 640 - MouseImage.Width && CurMouseY <= 480 - MouseImage.Height) -#endif drawMaskImage(&MouseImage, CurMouseX, CurMouseY); } } @@ -179,19 +151,13 @@ static void getBackMouse(void) { backx = CurMouseX; backy = CurMouseY; -#if !defined(DOSCODE) - - if (/* backx >= 0 && backy >= 0 && */ backx <= 640 - BackImage.Width && backy <= 480 - BackImage.Height) -#endif + if (backx <= 640 - BackImage.Width && backy <= 480 - BackImage.Height) readScreenImage(&BackImage, backx, backy); } static void restoreBackMouse(void) { if (BackImage.ImageData) { -#if !defined(DOSCODE) - - if (/* backx >= 0 && backy >= 0 && */ backx <= 640 - BackImage.Width && backy <= 480 - BackImage.Height) -#endif + if (backx <= 640 - BackImage.Width && backy <= 480 - BackImage.Height) drawImage(&BackImage, backx, backy); BackImage.ImageData = NULL; @@ -202,14 +168,7 @@ static void restoreBackMouse(void) { static struct Gadget *TempGad; -#if defined(DOSCODE) -#pragma off (check_stack) -void _loadds far mouse_handler(int32 max, int32 mcx, int32 mdx) { -#pragma aux mouse_handler parm [EAX] [ECX] [EDX] -#else void mouse_handler(int32 max, int32 mcx, int32 mdx) { -#endif - if (!IsHiRes) mcx /= 2; @@ -257,9 +216,7 @@ void mouse_handler(int32 max, int32 mcx, int32 mdx) { void updateMouse(void) { uint16 counter; -#if !defined(DOSCODE) bool doUpdateDisplay = false; -#endif if (drawmouse && !MouseHidden) { QuitMouseHandler = true; @@ -268,9 +225,7 @@ void updateMouse(void) { getBackMouse(); drawMouse(); QuitMouseHandler = false; -#if !defined(DOSCODE) doUpdateDisplay = true; -#endif } if (gadhit) { @@ -286,18 +241,12 @@ void updateMouse(void) { mouseHide(); drawImage(hitgad->Im, hitgad->x, hitgad->y); mouseShow(); -#if !defined(DOSCODE) doUpdateDisplay = true; -#endif QuitMouseHandler = false; } -#if !defined(DOSCODE) - if (doUpdateDisplay) WSDL_UpdateScreen(); - -#endif } @@ -307,52 +256,6 @@ void updateMouse(void) { /* Initializes the mouse. */ /*****************************************************************************/ bool initMouse(void) { -#if defined(DOSCODE) - void (interrupt far * int_handler)(); - int32 vector; - byte firstbyte; - struct SREGS sregs; - union REGS inregs, outregs; - int (far * function_ptr)(); - int16 m1, m2, m3, m4; - - segread(&sregs); - - /* Determine mouse-driver interrupt address */ - int_handler = _dos_getvect(0x33); /* Get interrupt vector */ - firstbyte = *(byte far *) int_handler; /* Get first instruction of interrupt */ - vector = (int32) int_handler; - - if ((vector == 0L) || (firstbyte == 0xcf)) { /* Vector should not be zero */ - /* First instruction should not be iret */ - return false; - } - - m1 = 0; - mouse(&m1, &m2, &m3, &m4); - - if (m1 != -1) - return false; - - m1 = 0x0f; - m3 = 3; - m4 = 10; - mouse(&m1, &m2, &m3, &m4); - - m1 = 0x07; - m3 = 0; - m4 = VGAScreenWidth - MouseImageWidth; - - if (!IsHiRes) m4 *= 2; - - mouse(&m1, &m2, &m3, &m4); - - m1 = 0x08; - m3 = 0; - m4 = VGAScreenHeight - MouseImageHeight; - mouse(&m1, &m2, &m3, &m4); -#endif - BackImage.ImageData = NULL; MouseImage.ImageData = MouseData; MouseImage.Width = MouseImageWidth; @@ -360,26 +263,6 @@ bool initMouse(void) { mouseMove(0, 0); -#if defined(DOSCODE) - - if (IsHiRes) { - m1 = 0x0f; - m3 = 0x03; - m4 = 0x04; - mouse(&m1, &m2, &m3, &m4); - } - - inregs.w.ax = 0xc; - inregs.w.cx = 0x01 + 0x02 + 0x08; /* mouse move, left and right mouse clicks */ - function_ptr = mouse_handler; - inregs.x.edx = FP_OFF(function_ptr); - sregs.es = FP_SEG(function_ptr); - int386x(0x33, &inregs, &outregs, &sregs); - - /* mouse reset and status */ - return mouseReset(); -#endif - return true; } @@ -389,14 +272,7 @@ bool initMouse(void) { /* Resets the mouse. */ /*****************************************************************************/ bool mouseReset(void) { -#if defined(DOSCODE) - int16 m1 = 0, dum; - - mouse(&m1, &dum, &dum, &dum); - return (m1 == -1); -#else return true; -#endif } @@ -430,9 +306,7 @@ void mouseShowXY(uint16 MouseX, uint16 MouseY) { CurMouseY = MouseY; getBackMouse(); drawMouse(); -#if !defined(DOSCODE) WSDL_UpdateScreen(); -#endif MouseHidden = false; } @@ -504,10 +378,6 @@ void mouseXY(uint16 *x, uint16 *y) { /* Moves the mouse to new co-ordinates. */ /*****************************************************************************/ void mouseMove(uint16 x, uint16 y) { -#if defined(DOSCODE) - int16 m1 = 4, dum; -#endif - if (!IsHiRes) x *= 2; @@ -521,9 +391,7 @@ void mouseMove(uint16 x, uint16 y) { getBackMouse(); drawMouse(); VGARestorePage(); -#if !defined(DOSCODE) WSDL_UpdateScreen(); -#endif QuitMouseHandler = false; } } -- cgit v1.2.3 From fefb78457e8828c64aedb0d6aa9e595d342c0416 Mon Sep 17 00:00:00 2001 From: Eugene Sandulenko Date: Fri, 26 Dec 2014 00:07:54 +0100 Subject: LAB: Cleanup --- engines/lab/parsetypes.h | 46 ++++----------- engines/lab/processroom.cpp | 138 -------------------------------------------- engines/lab/readdiff.cpp | 59 +------------------ engines/lab/text.cpp | 2 - 4 files changed, 13 insertions(+), 232 deletions(-) diff --git a/engines/lab/parsetypes.h b/engines/lab/parsetypes.h index defe9afddf..5120c413f8 100644 --- a/engines/lab/parsetypes.h +++ b/engines/lab/parsetypes.h @@ -105,20 +105,17 @@ typedef struct closeData { an item */ uint16 depth; /* Level of the closeup. */ char *GraphicName, *Message; - struct closeData *NextCloseUp, *SubCloseUps; + closeData *NextCloseUp, *SubCloseUps; } CloseData; typedef CloseData *CloseDataPtr; - - -typedef struct viewData { +struct viewData { int16 *Condition; char *GraphicName; struct viewData *NextCondition; CloseDataPtr closeUps; - -} viewData; +}; typedef viewData *ViewDataPtr; @@ -128,26 +125,22 @@ struct Action { byte *Data; /* Message, or a pointer to array of messages. */ Action *NextAction; - }; typedef Action *ActionPtr; -typedef struct rule { +struct Rule { int16 RuleType, Param1, Param2, *Condition; ActionPtr ActionList; - struct rule *NextRule; - -} Rule; + Rule *NextRule; +}; typedef Rule *RulePtr; - - -typedef struct { +struct RoomData { uint16 NorthDoor, SouthDoor, EastDoor, WestDoor; byte WipeType; @@ -155,26 +148,12 @@ typedef struct { ViewDataPtr NorthView, SouthView, EastView, WestView; RulePtr RuleList; char *RoomMsg; +}; -} RoomData; - - - -typedef struct inventoryData { - /* New inventory stuff */ - /* - int16 *Condition; - char *GraphicName, - * InvName; - struct inventoryData *NextInventory; - CloseDataPtr closeUps; - RulePtr RuleList; - */ - - /* Old inventory stuff */ +struct InventoryData { uint16 Many; char *name, *BInvName; -} InventoryData; +}; @@ -213,11 +192,10 @@ typedef struct inventoryData { -typedef struct { +struct MapData { uint16 x, y, PageNumber, SpecialID; uint32 MapFlags; - -} MapData; +}; #if defined(WIN32) #pragma pack(pop) diff --git a/engines/lab/processroom.cpp b/engines/lab/processroom.cpp index 10d5dfbc2b..5699c63880 100644 --- a/engines/lab/processroom.cpp +++ b/engines/lab/processroom.cpp @@ -36,9 +36,7 @@ #include "lab/timing.h" #include "lab/diff.h" #include "lab/vga.h" -#if !defined(DOSCODE) #include "lab/interface.h" -#endif namespace Lab { @@ -46,7 +44,6 @@ namespace Lab { extern int g_IsRegistered; #endif - /* Global parser data */ RoomData *Rooms; @@ -56,27 +53,20 @@ uint16 NumInv, RoomNum, ManyRooms, HighestCondition, Direction; extern char *FACINGNORTH, *FACINGEAST, *FACINGSOUTH, *FACINGWEST; extern bool LongWinInFront; - #define NOFILE "no file" - - extern const char *CurFileName; const char *ViewPath = "LAB:Rooms/"; - const char *NewFileName; - extern bool DoNotDrawMessage; extern bool NoFlip, IsBM, noupdatediff, waiteffect, mwaiteffect, QuitLab, EffectPlaying, soundplaying, MusicOn, DoBlack, ContMusic, DoNotReset; extern char diffcmap[256 * 3]; extern CloseDataPtr CPtr; - - /*****************************************************************************/ /* Generates a random number. */ /*****************************************************************************/ @@ -87,9 +77,6 @@ uint16 getRandom(uint16 max) { return ((micros + secs) % max); } - - - /*****************************************************************************/ /* Checks whether all the conditions in a condition list are met. */ /*****************************************************************************/ @@ -114,9 +101,6 @@ static bool checkConditions(int16 *Condition) { return res; } - - - /*****************************************************************************/ /* Gets the current ViewDataPointer. */ /*****************************************************************************/ @@ -149,8 +133,6 @@ ViewDataPtr getViewData(uint16 roomNum, uint16 direction) { return ViewPtr; } - - /*****************************************************************************/ /* Gets an object, if any, from the user's click on the screen. */ /*****************************************************************************/ @@ -177,9 +159,6 @@ static CloseData *getObject(uint16 x, uint16 y, CloseDataPtr LCPtr) { return NULL; } - - - /*****************************************************************************/ /* Goes through the list of closeups to find a match. */ /* NYI: Known bug here. If there are two objects that have closeups, and */ @@ -206,11 +185,6 @@ static CloseDataPtr findCPtrMatch(CloseDataPtr Main, CloseDataPtr List) { return NULL; } - - - - - /*****************************************************************************/ /* Returns the current picture name. */ /*****************************************************************************/ @@ -229,7 +203,6 @@ char *getPictName(CloseDataPtr *LCPtr) { return ViewPtr->GraphicName; } - /*****************************************************************************/ /* Draws the current direction to the screen. */ /*****************************************************************************/ @@ -272,7 +245,6 @@ void drawDirection(CloseDataPtr LCPtr) { drawMessage(Message); } -#if !defined(DOSCODE) void getRoomMessage(int MyRoomNum, int MyDirection, char *msg) { getViewData(MyRoomNum, MyDirection); @@ -292,11 +264,6 @@ void getRoomMessage(int MyRoomNum, int MyDirection, char *msg) { else if (MyDirection == WEST) strcat(msg, FACINGWEST); } -#endif - - - - /*****************************************************************************/ /* process a arrow gadget movement. */ @@ -341,10 +308,6 @@ bool processArrow(uint16 *direction, uint16 Arrow) { return true; } - - - - /*****************************************************************************/ /* Sets the current close up data, but uses absolute cords. */ /*****************************************************************************/ @@ -371,10 +334,6 @@ void setCurCloseAbs(uint16 x, uint16 y, CloseDataPtr *cptr) { } } - - - - /*****************************************************************************/ /* Sets the current close up data. */ /*****************************************************************************/ @@ -401,8 +360,6 @@ void setCurClose(uint16 x, uint16 y, CloseDataPtr *cptr) { } } - - /*****************************************************************************/ /* Takes the currently selected item. */ /*****************************************************************************/ @@ -434,8 +391,6 @@ bool takeItem(uint16 x, uint16 y, CloseDataPtr *cptr) { return false; } - - /*****************************************************************************/ /* Processes the action list. */ /*****************************************************************************/ @@ -627,9 +582,7 @@ static void doActions(ActionPtr APtr, CloseDataPtr *LCPtr) { case WAITSECS: addCurTime(APtr->Param1, 0, &StartSecs, &StartMicros); -#if !defined(DOSCODE) WSDL_UpdateScreen(); -#endif while (1) { g_music->newCheckMusic(); @@ -760,10 +713,6 @@ static void doActions(ActionPtr APtr, CloseDataPtr *LCPtr) { g_music->_doNotFileFlushAudio = false; } - - - - /*****************************************************************************/ /* Does the work for doActionRule. */ /*****************************************************************************/ @@ -802,9 +751,6 @@ static bool doActionRuleSub(int16 Action, int16 roomNum, CloseDataPtr LCPtr, Clo return false; } - - - /*****************************************************************************/ /* Goes through the rules if an action is taken. */ /*****************************************************************************/ @@ -830,8 +776,6 @@ bool doActionRule(int16 x, int16 y, int16 Action, int16 roomNum, CloseDataPtr *L return false; } - - /*****************************************************************************/ /* Does the work for doActionRule. */ /*****************************************************************************/ @@ -864,9 +808,6 @@ static bool doOperateRuleSub(int16 ItemNum, int16 roomNum, CloseDataPtr LCPtr, C return false; } - - - /*****************************************************************************/ /* Goes thru the rules if the user tries to operate an item on an object. */ /*****************************************************************************/ @@ -885,7 +826,6 @@ bool doOperateRule(int16 x, int16 y, int16 ItemNum, CloseDataPtr *LCPtr) { return true; else if (doOperateRuleSub(ItemNum, RoomNum, *LCPtr, LCPtr, true)) return true; - else { NewFileName = CurFileName; @@ -902,9 +842,6 @@ bool doOperateRule(int16 x, int16 y, int16 ItemNum, CloseDataPtr *LCPtr) { return false; } - - - /*****************************************************************************/ /* Goes thru the rules if the user tries to go forward. */ /*****************************************************************************/ @@ -927,8 +864,6 @@ bool doGoForward(CloseDataPtr *LCPtr) { return false; } - - /*****************************************************************************/ /* Goes thru the rules if the user tries to turn. */ /*****************************************************************************/ @@ -957,9 +892,6 @@ bool doTurn(uint16 from, uint16 to, CloseDataPtr *LCPtr) { return false; } - - - /*****************************************************************************/ /* Goes thru the rules if the user tries to go to the main view */ /*****************************************************************************/ @@ -982,74 +914,4 @@ bool doMainView(CloseDataPtr *LCPtr) { return false; } - - - -/*****************************************************************************/ -/* Goes thru the rules whenever (probably after an action or something), and */ -/* sets the conditions. */ -/*****************************************************************************/ -/* - bool doConditions(int16 x, - int16 y, - CloseDataPtr *LCPtr) - { - RulePtr RPtr; - - NewFileName = NOFILE; - - RPtr = Rooms[RoomNum].RuleList; - - while (RPtr) - { - if (RPtr->RuleType == CONDITIONS) - { - if (checkConditions(RPtr->Condition)) - { - doActions(RPtr->ActionList, LCPtr); - return true; - } - } - - RPtr = RPtr->NextRule; - } - return false; - } - */ - -#if defined(DEMODATA) -#include - -static void WriteDemoData_CloseUps(FILE *fh, CloseDataPtr cd) { - while (cd != NULL) { - if (*cd->GraphicName) - fprintf(fh, "%s\n", cd->GraphicName); - - WriteDemoData_CloseUps(fh, cd->SubCloseUps); - cd = cd->NextCloseUp; - } -} - -static void WriteDemoData_ViewData(FILE *fh, ViewDataPtr vd) { - if (vd == NULL) - return; - - if (*vd->GraphicName != 0) - fprintf(fh, "%s\n", vd->GraphicName); - - WriteDemoData_CloseUps(fh, vd->closeUps); -} - -void writeDemoData() { - FILE *fh = fopen("c:\\depot\\labyrinth\\demodata.log", "a+w"); - - WriteDemoData_ViewData(fh, getViewData(RoomNum, NORTH)); - WriteDemoData_ViewData(fh, getViewData(RoomNum, SOUTH)); - WriteDemoData_ViewData(fh, getViewData(RoomNum, EAST)); - WriteDemoData_ViewData(fh, getViewData(RoomNum, WEST)); - - fclose(fh); -} -#endif - } // End of namespace Lab diff --git a/engines/lab/readdiff.cpp b/engines/lab/readdiff.cpp index 1ceeb44769..2d6c7d8211 100644 --- a/engines/lab/readdiff.cpp +++ b/engines/lab/readdiff.cpp @@ -153,8 +153,6 @@ void diffNextFrame(void) { if (header == 65535) /* Already done. */ return; -#if !defined(DOSCODE) - if (DispBitMap->Flags & BITMAPF_VIDEO) { DispBitMap->Planes[0] = getVGABaseAddr(); DispBitMap->Planes[1] = DispBitMap->Planes[0] + 0x10000; @@ -163,30 +161,12 @@ void diffNextFrame(void) { DispBitMap->Planes[4] = DispBitMap->Planes[3] + 0x10000; } -#endif - mouseHide(); while (1) { - /* NYI: Don't need. - if (ReadIsError) - { - IsPlaying = false; - mouseShow(); - return; - } - */ - if (CurBit >= numchunks) { mouseShow(); -#ifdef undef /* NYI: Don't need. */ - - while (!ReadIsDone && !ReadIsError) /* Wait for the file to load */ - waitTOF(); - -#endif - if (!NoFlip && !IsBM) { if (headerdata.fps) { waitForTime(WaitSec, WaitMicros); @@ -255,9 +235,6 @@ void diffNextFrame(void) { if (IsBM) skip(difffile, size); else { -#if defined(DOSCODE) - setPage(CurBit); -#endif readBlock(DrawBitMap->Planes[CurBit], size, difffile); } @@ -265,9 +242,6 @@ void diffNextFrame(void) { break; case 11L: -#if defined(DOSCODE) - setPage(CurBit); -#endif skip(difffile, 4L); runLengthDecode(DrawBitMap->Planes[CurBit], *difffile); CurBit++; @@ -275,9 +249,6 @@ void diffNextFrame(void) { break; case 12L: -#if defined(DOSCODE) - setPage(CurBit); -#endif skip(difffile, 4L); VRunLengthDecode(DrawBitMap->Planes[CurBit], *difffile, DrawBitMap->BytesPerRow); CurBit++; @@ -285,18 +256,12 @@ void diffNextFrame(void) { break; case 20L: -#if defined(DOSCODE) - setPage(CurBit); -#endif unDiff(DrawBitMap->Planes[CurBit], DispBitMap->Planes[CurBit], *difffile, DrawBitMap->BytesPerRow, false); CurBit++; skip(difffile, size); break; case 21L: -#if defined(DOSCODE) - setPage(CurBit); -#endif unDiff(DrawBitMap->Planes[CurBit], DispBitMap->Planes[CurBit], *difffile, DrawBitMap->BytesPerRow, true); CurBit++; skip(difffile, size); @@ -341,26 +306,20 @@ void diffNextFrame(void) { } case 65535L: if ((framenumber == 1) || PlayOnce || StopPlayingEnd) { -#if !defined(DOSCODE) int didTOF = 0; -#endif if (waiteffect) { while (EffectPlaying) { g_music->updateMusic(); waitTOF(); -#if !defined(DOSCODE) if (DispBitMap->Flags & BITMAPF_VIDEO) didTOF = 1; - -#endif } } IsPlaying = false; mouseShow(); -#if !defined(DOSCODE) if (DispBitMap->Flags & BITMAPF_VIDEO) ungetVGABaseAddr(); @@ -368,7 +327,6 @@ void diffNextFrame(void) { if (!didTOF) WSDL_UpdateScreen(); -#endif return; } @@ -382,12 +340,9 @@ void diffNextFrame(void) { } } -#if !defined(DOSCODE) - if (DispBitMap->Flags & BITMAPF_VIDEO) ungetVGABaseAddr(); -#endif } @@ -453,7 +408,6 @@ void playDiff(void) { #endif if (header == 0) { -#if defined(IS_MACOSX) // sizeof(headerdata) != 18, but the padding might be at the end readBlock(&headerdata.Version, 2, difffile); readBlock(&headerdata.x, 2, difffile); @@ -463,9 +417,7 @@ void playDiff(void) { readBlock(&headerdata.BufferSize, 4, difffile); readBlock(&headerdata.Machine, 2, difffile); readBlock(&headerdata.Flags, 4, difffile); -#else - readBlock(&headerdata, 18, difffile); -#endif + skip(difffile, size - 18); #if !defined(DOSCODE) @@ -480,19 +432,10 @@ void playDiff(void) { diffheight = headerdata.y; DataBytesPerRow = diffwidth; -#if defined(DOSCODE) - numchunks = (((int32) diffwidth) * diffheight) / VGABytesPerPage; - - if ((numchunks * VGABytesPerPage) < (((int32) diffwidth) * diffheight)) - numchunks++; - -#else numchunks = (((int32) diffwidth) * diffheight) / 0x10000; if ((uint32)(numchunks * 0x10000) < (uint32)(((int32) diffwidth) * diffheight)) numchunks++; - -#endif } else { return; } diff --git a/engines/lab/text.cpp b/engines/lab/text.cpp index 5795a08960..92711acf5d 100644 --- a/engines/lab/text.cpp +++ b/engines/lab/text.cpp @@ -284,9 +284,7 @@ void text(struct TextFont *tf, uint16 x, uint16 y, uint16 color, const char *tex text++; } -#if !defined(DOSCODE) ungetVGABaseAddr(); -#endif } } // End of namespace Lab -- cgit v1.2.3 From 58182bd77af8433e00b7b7475633bd1d6ddf13b0 Mon Sep 17 00:00:00 2001 From: Eugene Sandulenko Date: Fri, 26 Dec 2014 00:32:42 +0100 Subject: LAB: Cleanup --- engines/lab/engine.cpp | 20 +++++------ engines/lab/graphics.cpp | 20 +++++------ engines/lab/interface.cpp | 41 ++++++++-------------- engines/lab/interface.h | 18 ++++------ engines/lab/intro.cpp | 6 ++-- engines/lab/labfile.cpp | 4 +-- engines/lab/labfun.h | 5 +-- engines/lab/map.cpp | 11 +++--- engines/lab/modernsavegame.cpp | 4 +-- engines/lab/modernsavegame.h | 4 +-- engines/lab/mouse.cpp | 14 ++++---- engines/lab/mouse.h | 2 +- engines/lab/readdiff.cpp | 4 +-- engines/lab/special.cpp | 80 ++++++++++++++++++++++++++++-------------- engines/lab/text.h | 12 +++---- engines/lab/vga.cpp | 10 +++--- engines/lab/vga.h | 8 ++--- 17 files changed, 137 insertions(+), 126 deletions(-) diff --git a/engines/lab/engine.cpp b/engines/lab/engine.cpp index 4db1451921..61042708eb 100644 --- a/engines/lab/engine.cpp +++ b/engines/lab/engine.cpp @@ -45,7 +45,7 @@ const char *CurFileName = " "; bool LongWinInFront = false; -struct TextFont *MsgFont; +TextFont *MsgFont; extern bool DoBlack, waiteffect, EffectPlaying, stopsound, DoNotDrawMessage, IsHiRes, nopalchange, DoMusic; @@ -131,13 +131,13 @@ static uint32 BUFFERSIZE = BIGBUFFERSIZE; static byte *MovePanelBuffer, *InvPanelBuffer; static uint32 MovePanelBufferSize, InvPanelBufferSize; -static struct Image *MoveImages[20], +static Image *MoveImages[20], #if defined(DOSCODE) *InvImages[6]; #else *InvImages[10]; #endif -static struct Gadget *MoveGadgetList, *InvGadgetList; +static Gadget *MoveGadgetList, *InvGadgetList; static char initcolors[] = { '\x00', '\x00', '\x00', '\x30', @@ -251,7 +251,7 @@ static uint16 OldMode; bool setUpScreens(void) { uint16 counter; byte *bufferstorage, **buffer = &bufferstorage; - struct Gadget *curgad; + Gadget *curgad; uint16 y; if (!createScreen(IsHiRes)) @@ -395,8 +395,8 @@ uint16 curmousex = 0, curmousey = 0; /* Permanently flips the imagry of a gadget. */ /******************************************************************************/ static void perFlipGadget(uint16 GadID) { - struct Image *Temp; - struct Gadget *TopGad; + Image *Temp; + Gadget *TopGad; TopGad = MoveGadgetList; @@ -424,7 +424,7 @@ static void perFlipGadget(uint16 GadID) { /* Eats all the available messages. */ /******************************************************************************/ void eatMessages(void) { - struct IntuiMessage *Msg; + IntuiMessage *Msg; do { Msg = getMsg(); @@ -722,7 +722,7 @@ static bool novesa = false, noaudio = false; /* Processes user input events. */ /******************************************************************************/ static void process(void) { - struct IntuiMessage *Msg; + IntuiMessage *Msg; uint32 Class; uint16 Code, Qualifier, MouseX, MouseY, ActionMode = 4, CurInv = MAPNUM, /* Lab: Labyrinth specific initialization */ @@ -1801,8 +1801,8 @@ int followCrumbs() { byte dropCrumbs[] = { 0x00 }; byte dropCrumbsOff[] = { 0x00 }; -struct Image DropCrumbsImage = { 24, 24, dropCrumbs }; -struct Image DropCrumbsOffImage = { 24, 24, dropCrumbsOff }; +Image DropCrumbsImage = { 24, 24, dropCrumbs }; +Image DropCrumbsOffImage = { 24, 24, dropCrumbsOff }; void mayShowCrumbIndicator() { if (DroppingCrumbs && MainDisplay) { diff --git a/engines/lab/graphics.cpp b/engines/lab/graphics.cpp index dba28113af..ba7c2324e3 100644 --- a/engines/lab/graphics.cpp +++ b/engines/lab/graphics.cpp @@ -39,10 +39,10 @@ namespace Lab { -struct BitMap bit1, bit2, *DispBitMap = &bit1, *DrawBitMap = &bit1; +BitMap bit1, bit2, *DispBitMap = &bit1, *DrawBitMap = &bit1; -extern struct BitMap RawDiffBM; +extern BitMap RawDiffBM; extern char diffcmap[256 * 3], lastcmap[256 * 3]; extern bool IsBM, NoFlip, nopalchange, ContMusic; @@ -50,7 +50,7 @@ extern int32 ReadSoFar; extern bool ReadIsDone, ReadIsError; extern bool DoBlack, EffectPlaying, stopsound; extern bool IsHiRes; -extern struct TextFont *MsgFont; +extern TextFont *MsgFont; extern const char *CurFileName; @@ -229,7 +229,7 @@ static void getWord(char *WordBuffer, const char *MainBuffer, uint16 *WordWidth) /* Gets a line of text for flowText; makes sure that its length is less than */ /* or equal to the maximum width. */ /******************************************************************************/ -static void getLine(struct TextFont *tf, char *LineBuffer, const char **MainBuffer, uint16 LineWidth) { +static void getLine(TextFont *tf, char *LineBuffer, const char **MainBuffer, uint16 LineWidth) { uint16 CurWidth = 0, WordWidth; char WordBuffer[100]; bool doit = true; @@ -256,8 +256,6 @@ static void getLine(struct TextFont *tf, char *LineBuffer, const char **MainBuff } else doit = false; } - - /* NYI: Would add code here to break up words in case they were longer than a line */ } @@ -281,7 +279,7 @@ uint32 flowText(void *font, /* the TextAttr pointer */ bool output, /* Whether to output any text */ uint16 x1, /* Cords */ uint16 y1, uint16 x2, uint16 y2, const char *str) { /* The text itself */ - struct TextFont *msgfont = (TextFont *)font; + TextFont *msgfont = (TextFont *)font; char linebuffer[256]; const char *temp; uint16 numlines, actlines, fontheight, width; @@ -343,7 +341,7 @@ extern byte *VGABASEADDRESS; /******************************************************************************/ /* Calls flowText, but flows it to memory. Same restrictions as flowText. */ /******************************************************************************/ -uint32 flowTextToMem(struct Image *DestIm, void *font, /* the TextAttr pointer */ +uint32 flowTextToMem(Image *DestIm, void *font, /* the TextAttr pointer */ uint16 spacing, /* How much vertical spacing between the lines */ uint16 pencolor, /* pen number to use for text */ uint16 backpen, /* the background color */ @@ -527,7 +525,7 @@ void copyLong64(uint32 *Dest, uint32 *Source, uint32 Many64) { /*****************************************************************************/ static void doScrollBlack(void) { byte *mem, *tempmem; - struct Image Im; + Image Im; uint16 width, height, by, nheight, CurPage; uint32 size, copysize; uint32 *BaseAddr; @@ -619,7 +617,7 @@ static void doScrollBlack(void) { -extern struct BitMap RawDiffBM; +extern BitMap RawDiffBM; extern DIFFHeader headerdata; @@ -768,7 +766,7 @@ static void doScrollBounce(void) { /*****************************************************************************/ static void doTransWipe(CloseDataPtr *CPtr, char *filename) { uint16 LastY, CurY, counter, linesdone = 0, lineslast; - struct Image ImSource, ImDest; + Image ImSource, ImDest; if (IsHiRes) { lineslast = 3; diff --git a/engines/lab/interface.cpp b/engines/lab/interface.cpp index 859277c9c7..e843d9b4cf 100644 --- a/engines/lab/interface.cpp +++ b/engines/lab/interface.cpp @@ -41,16 +41,14 @@ extern bool IsHiRes; Common::KeyState _keyPressed; -struct Gadget *createButton(uint16 x, uint16 y, uint16 id, uint16 key, Image *im, Image *imalt) { +Gadget *createButton(uint16 x, uint16 y, uint16 id, uint16 key, Image *im, Image *imalt) { Gadget *gptr; - if ((gptr = (Gadget *)calloc(sizeof(struct Gadget), 1))) { + if ((gptr = new Gadget())) { gptr->x = x; gptr->y = y; gptr->GadgetID = id; -#if !defined(DOSCODE) gptr->KeyEquiv = key; -#endif gptr->Im = im; gptr->ImAlt = imalt; gptr->NextGadget = NULL; @@ -64,7 +62,7 @@ struct Gadget *createButton(uint16 x, uint16 y, uint16 id, uint16 key, Image *im void freeButtonList(Gadget *gptrlist) { - struct Gadget *gptr, *next = gptrlist; + Gadget *gptr, *next = gptrlist; while (next) { gptr = next; @@ -80,7 +78,7 @@ void freeButtonList(Gadget *gptrlist) { /*****************************************************************************/ /* Draws a gadget list to the screen. */ /*****************************************************************************/ -void drawGadgetList(struct Gadget *gadlist) { +void drawGadgetList(Gadget *gadlist) { while (gadlist) { drawImage(gadlist->Im, gadlist->x, gadlist->y); @@ -95,7 +93,7 @@ void drawGadgetList(struct Gadget *gadlist) { /*****************************************************************************/ /* Ghoasts a gadget, and makes it unavailable for using. */ /*****************************************************************************/ -void ghoastGadget(struct Gadget *curgad, uint16 pencolor) { +void ghoastGadget(Gadget *curgad, uint16 pencolor) { ghoastRect(pencolor, curgad->x, curgad->y, curgad->x + curgad->Im->Width - 1, curgad->y + curgad->Im->Height - 1); curgad->GadgetFlags |= GADGETOFF; } @@ -105,7 +103,7 @@ void ghoastGadget(struct Gadget *curgad, uint16 pencolor) { /*****************************************************************************/ /* Unghoasts a gadget, and makes it available again. */ /*****************************************************************************/ -void unGhoastGadget(struct Gadget *curgad) { +void unGhoastGadget(Gadget *curgad) { drawImage(curgad->Im, curgad->x, curgad->y); curgad->GadgetFlags &= !(GADGETOFF); } @@ -114,20 +112,18 @@ void unGhoastGadget(struct Gadget *curgad) { /*****************************************************************************/ /* Make a key press have the right case for a gadget KeyEquiv value. */ /*****************************************************************************/ -#if !defined(DOSCODE) uint16 makeGadgetKeyEquiv(uint16 key) { if (Common::isAlnum(key)) key = tolower(key); return key; } -#endif /*****************************************************************************/ /* Checks whether or not the cords fall within one of the gadgets in a list */ /* of gadgets. */ /*****************************************************************************/ -static struct Gadget *checkNumGadgetHit(struct Gadget *gadlist, uint16 key) { +static Gadget *checkNumGadgetHit(Gadget *gadlist, uint16 key) { #if !defined(DOSCODE) uint16 gkey = key - '0'; #else @@ -177,17 +173,16 @@ static bool keyPress(uint16 *KeyCode) { } -struct IntuiMessage IMessage; -extern struct Gadget *ScreenGadgetList; +IntuiMessage IMessage; +extern Gadget *ScreenGadgetList; -struct IntuiMessage *getMsg(void) { - struct Gadget *curgad; +IntuiMessage *getMsg(void) { + Gadget *curgad; int Qualifiers; updateMouse(); -#if !defined(DOSCODE) + Qualifiers = _keyPressed.flags; -#endif if ((curgad = mouseGadget()) != NULL) { updateMouse(); @@ -196,21 +191,15 @@ struct IntuiMessage *getMsg(void) { IMessage.GadgetID = curgad->GadgetID; IMessage.Qualifier = Qualifiers; return &IMessage; - } - - else if (mouseButton(&IMessage.MouseX, &IMessage.MouseY, true)) { /* Left Button */ + } else if (mouseButton(&IMessage.MouseX, &IMessage.MouseY, true)) { /* Left Button */ IMessage.Qualifier = IEQUALIFIER_LEFTBUTTON | Qualifiers; IMessage.Class = MOUSEBUTTONS; return &IMessage; - } - - else if (mouseButton(&IMessage.MouseX, &IMessage.MouseY, false)) { /* Right Button */ + } else if (mouseButton(&IMessage.MouseX, &IMessage.MouseY, false)) { /* Right Button */ IMessage.Qualifier = IEQUALIFIER_RBUTTON | Qualifiers; IMessage.Class = MOUSEBUTTONS; return &IMessage; - } - - else if (keyPress(&IMessage.Code)) { /* Keyboard key */ + } else if (keyPress(&IMessage.Code)) { /* Keyboard key */ curgad = checkNumGadgetHit(ScreenGadgetList, IMessage.Code); if (curgad) { diff --git a/engines/lab/interface.h b/engines/lab/interface.h index cb0115daf9..b077f3b59e 100644 --- a/engines/lab/interface.h +++ b/engines/lab/interface.h @@ -49,8 +49,8 @@ struct Gadget { uint16 KeyEquiv; // if not zero, a key that activates gadget #endif uint32 GadgetFlags; - struct Image *Im, *ImAlt; - struct Gadget *NextGadget; + Image *Im, *ImAlt; + Gadget *NextGadget; }; extern Common::KeyState _keyPressed; @@ -119,21 +119,17 @@ extern Common::KeyState _keyPressed; -struct Gadget *createButton(uint16 x, uint16 y, uint16 id, -#if !defined(DOSCODE) - uint16 key, -#endif - struct Image *im, struct Image *imalt); +Gadget *createButton(uint16 x, uint16 y, uint16 id, uint16 key, Image *im, Image *imalt); void freeButtonList(void *gptrlist); -void drawGadgetList(struct Gadget *gadlist); +void drawGadgetList(Gadget *gadlist); -void ghoastGadget(struct Gadget *curgad, uint16 pencolor); +void ghoastGadget(Gadget *curgad, uint16 pencolor); -void unGhoastGadget(struct Gadget *curgad); +void unGhoastGadget(Gadget *curgad); -struct IntuiMessage *getMsg(void); +IntuiMessage *getMsg(void); void replyMsg(void *Msg); diff --git a/engines/lab/intro.cpp b/engines/lab/intro.cpp index ae822cb72c..bac197eeb4 100644 --- a/engines/lab/intro.cpp +++ b/engines/lab/intro.cpp @@ -37,7 +37,7 @@ namespace Lab { -static struct TextFont filler, *msgfont = &filler; +static TextFont filler, *msgfont = &filler; extern bool nopalchange, noscreenchange, hidemouse, DoBlack, NoFlip, IsHiRes; @@ -63,7 +63,7 @@ extern int32 longcharsdrawn; /* the message port. */ /******************************************************************************/ void introEatMessages(void) { - struct IntuiMessage *Msg; + IntuiMessage *Msg; while (1) { Msg = getMsg(); @@ -88,7 +88,7 @@ void introEatMessages(void) { /*****************************************************************************/ static void doPictText(const char *Filename, bool isscreen) { uint32 lastsecs = 0L, lastmicros = 0L, secs = 0L, micros = 0L; - struct IntuiMessage *Msg; + IntuiMessage *Msg; char filename[50] = "Lab:rooms/Intro/"; byte *curplace, **tfile; bool DrawNextText = true, End = false, Begin = true; diff --git a/engines/lab/labfile.cpp b/engines/lab/labfile.cpp index 7c7875afe0..01f1ffabc0 100644 --- a/engines/lab/labfile.cpp +++ b/engines/lab/labfile.cpp @@ -86,10 +86,10 @@ uint32 sizeOfFile(const char *name) { -typedef struct { +struct FileMarker { char name[32]; void *Start, *End; -} FileMarker; +}; diff --git a/engines/lab/labfun.h b/engines/lab/labfun.h index abb0871669..6f304d0f9b 100644 --- a/engines/lab/labfun.h +++ b/engines/lab/labfun.h @@ -52,6 +52,7 @@ typedef struct { struct Image; struct TextFont; +struct Gadget; /*----------------------------*/ /*------ From Audioi.c -------*/ @@ -101,7 +102,7 @@ uint32 flowText(void *font, /* the TextAttr pointer */ uint16 x1, /* Cords */ uint16 y1, uint16 x2, uint16 y2, const char *text); /* The text itself */ -uint32 flowTextToMem(struct Image *DestIm, void *font, /* the TextAttr pointer */ +uint32 flowTextToMem(Image *DestIm, void *font, /* the TextAttr pointer */ uint16 spacing, /* How much vertical spacing between the lines */ uint16 pencolor, /* pen number to use for text */ uint16 backpen, /* the background color */ @@ -136,7 +137,7 @@ void flipViews(void *scrPtr); /*----- From Interface.c -----*/ /*----------------------------*/ -struct Gadget *addGadButton(uint16 x, uint16 y, void *UpImage, void *DownImage, uint16 id); +Gadget *addGadButton(uint16 x, uint16 y, void *UpImage, void *DownImage, uint16 id); void gadgetsOnOff(void *gptr, void *win, int32 num, bool on); diff --git a/engines/lab/map.cpp b/engines/lab/map.cpp index eac13648eb..5f2274651b 100644 --- a/engines/lab/map.cpp +++ b/engines/lab/map.cpp @@ -42,8 +42,8 @@ namespace Lab { -static struct TextFont *BigMsgFont; -static struct TextFont bmf; +static TextFont *BigMsgFont; +static TextFont bmf; extern uint16 Direction; @@ -87,8 +87,7 @@ void setAmigaPal(uint16 *pal, uint16 numcolors) { bool getFont(const char *filename, TextFont *textfont) { byte *fontbuffer; - fontbuffer = (byte *)stealBufMem(sizeOfFile(filename) - - (sizeof(struct TextFont) + 4)); + fontbuffer = (byte *)stealBufMem(sizeOfFile(filename) - (sizeof(TextFont) + 4)); g_music->checkMusic(); if (fontbuffer == NULL) @@ -227,7 +226,7 @@ static uint16 mapScaleY(uint16 y) { static bool loadMapData(void) { byte **buffer, Temp[5]; int32 Size; - struct Gadget *gptr; + Gadget *gptr; uint16 counter; BigMsgFont = &bmf; @@ -736,7 +735,7 @@ void processMap(uint16 CurRoom) { char *sptr; byte newcolor[3]; bool drawmap; - struct IntuiMessage *Msg; + IntuiMessage *Msg; CurMsg = CurRoom; CurFloor = Maps[CurRoom].PageNumber; diff --git a/engines/lab/modernsavegame.cpp b/engines/lab/modernsavegame.cpp index 334e4c5f80..f9f558b985 100644 --- a/engines/lab/modernsavegame.cpp +++ b/engines/lab/modernsavegame.cpp @@ -41,7 +41,7 @@ char g_PathSeperator[4]; #define SAVEVERSION "LBS3" -int getSaveGameList(struct SaveGameInfo *info, int maxNum) { +int getSaveGameList(SaveGameInfo *info, int maxNum) { warning("STUB: getSaveGameList"); return 0; @@ -112,7 +112,7 @@ int getSaveGameList(struct SaveGameInfo *info, int maxNum) { #endif } -void freeSaveGameList(struct SaveGameInfo *info, int count) { +void freeSaveGameList(SaveGameInfo *info, int count) { int i; for (i = 0; i < count; i++) { diff --git a/engines/lab/modernsavegame.h b/engines/lab/modernsavegame.h index bbee42069f..ee53cd0390 100644 --- a/engines/lab/modernsavegame.h +++ b/engines/lab/modernsavegame.h @@ -46,8 +46,8 @@ struct SaveGameInfo { char SaveGameDate[128]; }; -int getSaveGameList(struct SaveGameInfo *info, int maxNum); -void freeSaveGameList(struct SaveGameInfo *info, int count); +int getSaveGameList(SaveGameInfo *info, int maxNum); +void freeSaveGameList(SaveGameInfo *info, int count); } // End of namespace Lab diff --git a/engines/lab/mouse.cpp b/engines/lab/mouse.cpp index 3d83a0d6ae..753e8ff302 100644 --- a/engines/lab/mouse.cpp +++ b/engines/lab/mouse.cpp @@ -50,8 +50,8 @@ static bool MouseHidden = true, QuitMouseHandler = false; static int32 NumHidden = 1; static uint16 CurMouseX, CurMouseY; static uint16 MouseImageWidth = 10, MouseImageHeight = 15; -static struct Gadget *LastGadgetHit = NULL; -struct Gadget *ScreenGadgetList = NULL; +static Gadget *LastGadgetHit = NULL; +Gadget *ScreenGadgetList = NULL; static byte MouseData[] = {1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 1, 7, 1, 0, 0, 0, 0, 0, 0, 0, 1, 7, 7, 1, 0, 0, 0, 0, 0, 0, @@ -69,12 +69,12 @@ static byte MouseData[] = {1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 0, 0}; -static struct Image MouseImage, BackImage; +static Image MouseImage, BackImage; static byte BackImageBuffer[256]; static uint16 backx, backy; static bool drawmouse = false, gadhit = false; -static struct Gadget *hitgad = NULL; +static Gadget *hitgad = NULL; void mouseShowXY(uint16 CurMouseX, uint16 CurMouseY); @@ -82,7 +82,7 @@ void mouseShowXY(uint16 CurMouseX, uint16 CurMouseY); /* Checks whether or not the cords fall within one of the gadgets in a list */ /* of gadgets. */ /*****************************************************************************/ -static Gadget *checkGadgetHit(struct Gadget *gadlist, uint16 x, uint16 y) { +static Gadget *checkGadgetHit(Gadget *gadlist, uint16 x, uint16 y) { uint16 counter; while (gadlist != NULL) { @@ -121,7 +121,7 @@ static Gadget *checkGadgetHit(struct Gadget *gadlist, uint16 x, uint16 y) { -void attachGadgetList(struct Gadget *GadList) { +void attachGadgetList(Gadget *GadList) { if (ScreenGadgetList != GadList) LastGadgetHit = NULL; @@ -165,7 +165,7 @@ static void restoreBackMouse(void) { } -static struct Gadget *TempGad; +static Gadget *TempGad; void mouse_handler(int32 max, int32 mcx, int32 mdx) { diff --git a/engines/lab/mouse.h b/engines/lab/mouse.h index 108afc219d..8a9a3b75ae 100644 --- a/engines/lab/mouse.h +++ b/engines/lab/mouse.h @@ -55,7 +55,7 @@ bool mouseButton(uint16 *x, uint16 *y, bool leftbutton); Gadget *mouseGadget(void); -void attachGadgetList(struct Gadget *GadList); +void attachGadgetList(Gadget *GadList); void mouse_handler(int32 max, int32 mcx, int32 mdx); diff --git a/engines/lab/readdiff.cpp b/engines/lab/readdiff.cpp index 2d6c7d8211..8da94d696a 100644 --- a/engines/lab/readdiff.cpp +++ b/engines/lab/readdiff.cpp @@ -37,7 +37,7 @@ namespace Lab { -extern struct BitMap *DispBitMap, *DrawBitMap; +extern BitMap *DispBitMap, *DrawBitMap; extern uint32 VGABytesPerPage; /* @@ -88,7 +88,7 @@ static bool continuous, char diffcmap[256 * 3], lastcmap[256 * 3]; -struct BitMap RawDiffBM; +BitMap RawDiffBM; diff --git a/engines/lab/special.cpp b/engines/lab/special.cpp index b033386f38..3ab548a82e 100644 --- a/engines/lab/special.cpp +++ b/engines/lab/special.cpp @@ -54,7 +54,7 @@ int g_IsRegistered; extern bool nopalchange, DoBlack, IsHiRes; -extern struct BitMap *DispBitMap, *DrawBitMap; +extern BitMap *DispBitMap, *DrawBitMap; extern char diffcmap[3 * 256]; extern uint32 VGAScreenWidth, VGAScreenHeight; @@ -106,7 +106,7 @@ static byte *loadBackPict(const char *fileName, bool tomem) { -static struct Image *Images[10]; +static Image *Images[10]; uint16 combination[6] = {0, 0, 0, 0, 0, 0}, solution[] = {0, 4, 0, 8, 7, 2}; @@ -161,7 +161,7 @@ void showCombination(const char *filename) { /* Changes the combination number of one of the slots */ /*****************************************************************************/ static void changeCombination(uint16 number) { - struct Image display; + Image display; uint16 counter, combnum; bool unlocked = true; @@ -251,7 +251,7 @@ void mouseCombination(uint16 x, uint16 y) { -struct Image *Tiles[16]; +Image *Tiles[16]; int16 CurTile[4] [4] = { { 1, 5, 9, 13 }, { 2, 6, 10, 14 }, @@ -513,9 +513,9 @@ void mouseTile(uint16 x, uint16 y) { /*------------------------ Does the detective notes. ------------------------*/ /*---------------------------------------------------------------------------*/ -extern struct TextFont *MsgFont; -static struct TextFont *BigMsgFont; -static struct TextFont bmfont; +extern TextFont *MsgFont; +static TextFont *BigMsgFont; +static TextFont bmfont; /*****************************************************************************/ @@ -631,10 +631,10 @@ static uint16 JPage = 0; static bool lastpage = false; -static struct Image *JCancel, *JCancelAlt, *JLeft, *JLeftAlt, *JRight, *JRightAlt, JBackImage, ScreenImage; +static Image *JCancel, *JCancelAlt, *JLeft, *JLeftAlt, *JRight, *JRightAlt, JBackImage, ScreenImage; static uint16 JGadX[3] = {80, 144, 194}, JGadY[3] = {162, 164, 162}; -static struct Gadget ForwardG, CancelG, BackG; +static Gadget ForwardG, CancelG, BackG; @@ -645,7 +645,7 @@ static struct Gadget ForwardG, CancelG, BackG; static bool loadJournalData() { byte **buffer; char filename[20]; - struct Gadget *TopGadget = &BackG; + Gadget *TopGadget = &BackG; uint16 counter; bool bridge, dirty, news, clean; @@ -863,13 +863,13 @@ static void drawJournal(uint16 wipenum, bool needFade) { /* Processes user input. */ /*****************************************************************************/ static void processJournal() { - struct IntuiMessage *Msg; + IntuiMessage *Msg; uint32 Class; uint16 Qualifier, GadID; while (1) { g_music->checkMusic(); /* Make sure we check the music at least after every message */ - Msg = (struct IntuiMessage *) getMsg(); + Msg = (IntuiMessage *) getMsg(); if (Msg == NULL) { g_music->newCheckMusic(); @@ -970,7 +970,7 @@ void doJournal() { /*---------------------------------------------------------------------------*/ -struct Image *Arrow1, *NoArrow1, *DriveButton; +Image *Arrow1, *NoArrow1, *DriveButton; extern InventoryData *Inventory; @@ -1084,7 +1084,7 @@ void getRoomMessage(int MyRoomNum, int MyDirection, char *msg); extern char g_SaveGamePath[512]; extern char g_PathSeperator[4]; -struct SaveGameInfo g_SaveGameInfo[MAX_SAVED_GAMES]; +SaveGameInfo g_SaveGameInfo[MAX_SAVED_GAMES]; int g_TotalSavedGames; char g_CommonPalette[3 * 256]; int g_LastSaveGameNumber = 0; @@ -1093,7 +1093,19 @@ int g_CurSaveSet = 0; int g_PendingNewSave = 0; enum UI_Ident { - ID_SAVE, ID_LOAD, ID_NEWSLOT, ID_1_TO_5, ID_6_TO_10, ID_11_TO_15, ID_SLOT_A, ID_SLOT_B, ID_SLOT_C, ID_SLOT_D, ID_SLOT_E, ID_CANCEL, ID_LAST + ID_SAVE, + ID_LOAD, + ID_NEWSLOT, + ID_1_TO_5, + ID_6_TO_10, + ID_11_TO_15, + ID_SLOT_A, + ID_SLOT_B, + ID_SLOT_C, + ID_SLOT_D, + ID_SLOT_E, + ID_CANCEL, + ID_LAST }; struct ModernUI { @@ -1101,12 +1113,27 @@ struct ModernUI { int x, y, w, h; }; -struct ModernUI theUI[ID_LAST] = { - { ID_LOAD, 491, 182, 128, 54 }, { ID_SAVE, 491, 255, 128, 54 }, { ID_NEWSLOT, 491, 328, 128, 54 }, { ID_1_TO_5, 27, 40, 146, 25 }, { ID_6_TO_10, 175, 40, 146, 25 }, { ID_11_TO_15, 323, 40, 146, 25 }, { ID_SLOT_A, 27, 67, 442, 72 }, { ID_SLOT_B, 27, 142, 442, 72 }, { ID_SLOT_C, 27, 217, 442, 72 }, { ID_SLOT_D, 27, 292, 442, 72 }, { ID_SLOT_E, 27, 367, 442, 72 }, { ID_CANCEL, 531, 405, 52, 52 } +ModernUI theUI[ID_LAST] = { + { ID_LOAD, 491, 182, 128, 54 }, + { ID_SAVE, 491, 255, 128, 54 }, + { ID_NEWSLOT, 491, 328, 128, 54 }, + { ID_1_TO_5, 27, 40, 146, 25 }, + { ID_6_TO_10, 175, 40, 146, 25 }, + { ID_11_TO_15, 323, 40, 146, 25 }, + { ID_SLOT_A, 27, 67, 442, 72 }, + { ID_SLOT_B, 27, 142, 442, 72 }, + { ID_SLOT_C, 27, 217, 442, 72 }, + { ID_SLOT_D, 27, 292, 442, 72 }, + { ID_SLOT_E, 27, 367, 442, 72 }, + { ID_CANCEL, 531, 405, 52, 52 } }; enum { - SG_BLACK = 1, SG_TAN = 14, SG_DKTAN = 38, SG_WHITE = 105, SG_YELLOW = 118 + SG_BLACK = 1, + SG_TAN = 14, + SG_DKTAN = 38, + SG_WHITE = 105, + SG_YELLOW = 118 }; /*****************************************************************************/ @@ -1178,7 +1205,7 @@ static void drawSaveLoad() { for (i = 0, j = 5 * g_CurSaveSet; i < 5; i++, j++) { uint16 hue, y; char num_text[4]; - struct Image thumbnail, screen; + Image thumbnail, screen; if (j < g_TotalSavedGames + g_PendingNewSave) { char msg[256]; @@ -1224,7 +1251,7 @@ static void drawSaveLoad() { WSDL_UpdateScreen(); } -static void makeThumbnail(struct SaveGameInfo *info) { +static void makeThumbnail(SaveGameInfo *info) { char *pictName; CloseDataPtr CPtr = NULL; byte *BitMapMem; @@ -1260,7 +1287,7 @@ static void makeThumbnail(struct SaveGameInfo *info) { } static void addSaveSlot() { - struct SaveGameInfo *info; + SaveGameInfo *info; if (g_PendingNewSave || g_TotalSavedGames == MAX_SAVED_GAMES) return; @@ -1370,7 +1397,7 @@ static bool doLoadGame() { /* Processes user input. */ /*****************************************************************************/ static bool processSaveLoad() { - struct IntuiMessage *Msg; + IntuiMessage *Msg; uint32 Class; uint16 Qualifier, MouseX, MouseY, Code; @@ -1700,7 +1727,7 @@ static void checkFiles(void) { /* Processes user input. */ /*****************************************************************************/ static uint16 processSaveRestore(uint16 type) { - struct IntuiMessage *Msg; + IntuiMessage *Msg; uint32 Class; uint16 Qualifier, MouseX, MouseY, Code, Temp; @@ -1913,7 +1940,8 @@ static uint16 monpage; static const char *TextFileName; -struct Image *MonButton, *AltMonButton, *MonQuit, *AltMonQuit, *MonBack, *AltMonBack, *MonDown, *AltMonDown, *MonUp, *AltMonUp; +Image *MonButton, *AltMonButton, *MonQuit, *AltMonQuit, *MonBack, *AltMonBack, + *MonDown, *AltMonDown, *MonUp, *AltMonUp; @@ -2004,7 +2032,7 @@ static void drawMonText(char *text, uint16 x1, uint16 y1, uint16 x2, uint16 y2, /* Processes user input. */ /*****************************************************************************/ static void processMonitor(char *ntext, bool isinteractive, uint16 x1, uint16 y1, uint16 x2, uint16 y2) { - struct IntuiMessage *Msg; + IntuiMessage *Msg; uint32 Class; uint16 Qualifier, Code, MouseX, MouseY; const char *Test = " ", *StartFileName = TextFileName; @@ -2158,7 +2186,7 @@ void doMonitor(char *background, char *textfile, bool isinteractive, uint16 x1, #if defined(LABDEMO) void doTrialBlock() { - struct IntuiMessage *Msg; + IntuiMessage *Msg; uint32 Class; uint16 Qualifier, MouseX, MouseY, Code, Temp; diff --git a/engines/lab/text.h b/engines/lab/text.h index 4947fda7fe..254a137f0d 100644 --- a/engines/lab/text.h +++ b/engines/lab/text.h @@ -52,17 +52,17 @@ struct TextFont { #pragma pack(pop) #endif -bool openFontMem(const char *TextFontPath, struct TextFont *tf, byte *fontbuffer); +bool openFontMem(const char *TextFontPath, TextFont *tf, byte *fontbuffer); -bool openFont(const char *TextFontPath, struct TextFont **tf); +bool openFont(const char *TextFontPath, TextFont **tf); -void closeFont(struct TextFont *tf); +void closeFont(TextFont *tf); -uint16 textLength(struct TextFont *tf, const char *text, uint16 numchars); +uint16 textLength(TextFont *tf, const char *text, uint16 numchars); -uint16 textHeight(struct TextFont *tf); +uint16 textHeight(TextFont *tf); -void text(struct TextFont *tf, uint16 x, uint16 y, uint16 color, const char *text, uint16 numchars); +void text(TextFont *tf, uint16 x, uint16 y, uint16 color, const char *text, uint16 numchars); } // End of namespace Lab diff --git a/engines/lab/vga.cpp b/engines/lab/vga.cpp index 403fe605a5..10e52e1dd5 100644 --- a/engines/lab/vga.cpp +++ b/engines/lab/vga.cpp @@ -342,7 +342,7 @@ void getMode(uint16 *Mode) { /*****************************************************************************/ /* Draws an image to the screen. */ /*****************************************************************************/ -void drawImage(struct Image *Im, uint16 x, uint16 y) { +void drawImage(Image *Im, uint16 x, uint16 y) { #if !defined(DOSCODE) int sx, sy, dx, dy, w, h; @@ -458,7 +458,7 @@ void drawImage(struct Image *Im, uint16 x, uint16 y) { /*****************************************************************************/ /* Draws an image to the screen. */ /*****************************************************************************/ -void drawMaskImage(struct Image *Im, uint16 x, uint16 y) { +void drawMaskImage(Image *Im, uint16 x, uint16 y) { #if !defined(DOSCODE) int sx, sy, dx, dy, w, h; @@ -588,7 +588,7 @@ void drawMaskImage(struct Image *Im, uint16 x, uint16 y) { /*****************************************************************************/ /* Reads an image from the screen. */ /*****************************************************************************/ -void readScreenImage(struct Image *Im, uint16 x, uint16 y) { +void readScreenImage(Image *Im, uint16 x, uint16 y) { #if !defined(DOSCODE) int sx, sy, dx, dy, w, h; @@ -839,7 +839,7 @@ byte *TempScrollData; /* function will fail. */ /*****************************************************************************/ void scrollDisplayX(int16 dx, uint16 x1, uint16 y1, uint16 x2, uint16 y2) { - struct Image Im; + Image Im; uint16 temp; Im.ImageData = TempScrollData; @@ -885,7 +885,7 @@ void scrollDisplayX(int16 dx, uint16 x1, uint16 y1, uint16 x2, uint16 y2) { /* Scrolls the display in the y direction by blitting. */ /*****************************************************************************/ void scrollDisplayY(int16 dy, uint16 x1, uint16 y1, uint16 x2, uint16 y2) { - struct Image Im; + Image Im; uint16 temp; Im.ImageData = TempScrollData; diff --git a/engines/lab/vga.h b/engines/lab/vga.h index a0b2f6314d..8c1d3729a2 100644 --- a/engines/lab/vga.h +++ b/engines/lab/vga.h @@ -73,13 +73,13 @@ void VGASetPal(void *cmap, uint16 numcolors); /*---------- Drawing Routines ----------*/ -void drawImage(struct Image *Im, uint16 x, uint16 y); +void drawImage(Image *Im, uint16 x, uint16 y); -void drawMaskImage(struct Image *Im, uint16 x, uint16 y); +void drawMaskImage(Image *Im, uint16 x, uint16 y); -void readScreenImage(struct Image *Im, uint16 x, uint16 y); +void readScreenImage(Image *Im, uint16 x, uint16 y); -void bltBitMap(struct Image *ImSource, uint16 xs, uint16 ys, struct Image *ImDest, uint16 xd, uint16 yd, uint16 width, uint16 height); +void bltBitMap(Image *ImSource, uint16 xs, uint16 ys, Image *ImDest, uint16 xd, uint16 yd, uint16 width, uint16 height); void scrollDisplayX(int16 dx, uint16 x1, uint16 y1, uint16 x2, uint16 y2); -- cgit v1.2.3 From 85ea7da24e2f10c0e2a5834a468c34ca5a4602b4 Mon Sep 17 00:00:00 2001 From: Eugene Sandulenko Date: Sat, 27 Dec 2014 01:28:40 +0100 Subject: LAB: Improved detection --- engines/lab/detection.cpp | 52 +++++++++++++++++++++++++++++++++++++++++++++-- 1 file changed, 50 insertions(+), 2 deletions(-) diff --git a/engines/lab/detection.cpp b/engines/lab/detection.cpp index f7632c76be..a7d70eb551 100644 --- a/engines/lab/detection.cpp +++ b/engines/lab/detection.cpp @@ -36,7 +36,7 @@ #include "lab/lab.h" static const PlainGameDescriptor lab_setting[] = { - { "lab", "Labyrith of Time Engine game" }, + { "lab", "Labyrith of Time" }, { 0, 0 } }; @@ -47,6 +47,7 @@ static const ADGameDescription labDescriptions[] = { { { "doors", 0, "d77536010e7e5ae17ee066323ceb9585", 2537 }, { "notes11", 0, "63e873f659f8f46f9809d16a2bf653c7", 3562 }, + { "inv", 0, "8c3677dba0113067619f88d301795b39", 23472 }, { NULL, 0, NULL, 0 } }, Common::EN_ANY, @@ -54,6 +55,50 @@ static const ADGameDescription labDescriptions[] = { ADGF_NO_FLAGS, GUIO0() }, + { + "lab", + "lowres", + { + { "doors", 0, "d77536010e7e5ae17ee066323ceb9585", 2537 }, + { "notes11", 0, "63e873f659f8f46f9809d16a2bf653c7", 3562 }, + { "inv", 0, "1633476827f614554be53d358ac2f8c0", 5076 }, + { NULL, 0, NULL, 0 } + }, + Common::EN_ANY, + Common::kPlatformDOS, + ADGF_NO_FLAGS, + GUIO0() + }, + { + "lab", + "Rerelease", + { + { "doors", 0, "d77536010e7e5ae17ee066323ceb9585", 2537 }, + { "notes11", 0, "63e873f659f8f46f9809d16a2bf653c7", 3562 }, + { "inv", 0, "0a5377f0673454b1743322471892ad43", 39120 }, + { "48", 0, "fb2d990c5fb5dd36a618e5ca8136b740", 892 }, + { NULL, 0, NULL, 0 } + }, + Common::EN_ANY, + Common::kPlatformWindows, + ADGF_NO_FLAGS, + GUIO0() + }, + { + "lab", + "Trial", + { + { "doors", 0, "d77536010e7e5ae17ee066323ceb9585", 2537 }, + { "notes11", 0, "63e873f659f8f46f9809d16a2bf653c7", 3562 }, + { "inv", 0, "0a5377f0673454b1743322471892ad43", 39120 }, + { "48", 0, "a319ba9bab20b24200257e826b5494e1", 892 }, + { NULL, 0, NULL, 0 } + }, + Common::EN_ANY, + Common::kPlatformWindows, + ADGF_DEMO, + GUIO0() + }, { "lab", "", @@ -69,6 +114,9 @@ static const ADGameDescription labDescriptions[] = { static const char *const directoryGlobs[] = { "fonts", "game", + "pict", + "spict", + "rooms", 0 }; @@ -77,7 +125,7 @@ public: LabMetaEngine() : AdvancedMetaEngine(labDescriptions, sizeof(ADGameDescription), lab_setting) { _singleid = "lab"; - _maxScanDepth = 2; + _maxScanDepth = 3; _directoryGlobs = directoryGlobs; } -- cgit v1.2.3 From 7ee90c693f962e54041f0bb30ab9d98521bba545 Mon Sep 17 00:00:00 2001 From: Eugene Sandulenko Date: Sat, 27 Dec 2014 01:28:50 +0100 Subject: LAB: Cleanup --- engines/lab/graphics.cpp | 56 ++---------------------------------------------- 1 file changed, 2 insertions(+), 54 deletions(-) diff --git a/engines/lab/graphics.cpp b/engines/lab/graphics.cpp index ba7c2324e3..41f4a7960a 100644 --- a/engines/lab/graphics.cpp +++ b/engines/lab/graphics.cpp @@ -69,9 +69,6 @@ extern uint32 VGAScreenWidth, VGAScreenHeight, VGAPages, VGABytesPerPage; /*****************************************************************************/ bool readPict(const char *filename, bool PlayOnce) { byte **file = NULL; -#if defined(DOSCODE) - uint16 counter; -#endif stopDiff(); @@ -90,26 +87,12 @@ bool readPict(const char *filename, bool PlayOnce) { DispBitMap->BytesPerRow = VGAScreenWidth; DispBitMap->Rows = VGAScreenHeight; -#if defined(DOSCODE) - DispBitMap->Flags = 0; -#else DispBitMap->Flags = BITMAPF_VIDEO; -#endif DispBitMap->Depth = VGAPages; -#if defined(DOSCODE) - - for (counter = 0; counter < VGAPages; counter++) - DispBitMap->Planes[counter] = getVGABaseAddr(); - -#else - // playDiff deals with resetting planes for the "video" display. -#endif readDiff(PlayOnce); -#if !defined(DOSCODE) ungetVGABaseAddr(); -#endif return true; } @@ -144,9 +127,6 @@ bool readMusic(const char *filename) { byte *readPictToMem(const char *filename, uint16 x, uint16 y) { byte **file = NULL; byte *Mem, *CurMem; -#if defined(DOSCODE) - uint16 counter; -#endif stopDiff(); @@ -166,20 +146,11 @@ byte *readPictToMem(const char *filename, uint16 x, uint16 y) { DispBitMap->Rows = y; DispBitMap->Flags = 0; DispBitMap->Depth = VGAPages; -#if defined(DOSCODE) - - for (counter = 0; counter < VGAPages; counter++) { - DispBitMap->Planes[counter] = CurMem; - CurMem += VGABytesPerPage; - } - -#else DispBitMap->Planes[0] = CurMem; DispBitMap->Planes[1] = DispBitMap->Planes[0] + 0x10000; DispBitMap->Planes[2] = DispBitMap->Planes[1] + 0x10000; DispBitMap->Planes[3] = DispBitMap->Planes[2] + 0x10000; DispBitMap->Planes[4] = DispBitMap->Planes[3] + 0x10000; -#endif readDiff(true); @@ -534,18 +505,8 @@ static void doScrollBlack(void) { width = VGAScaleX(320); height = VGAScaleY(149) + SVGACord(2); - /* - while (EffectPlaying) - { - g_music->updateMusic(); - waitTOF(); - } - */ - allocFile((void **) &mem, (int32) width * (int32) height, "Temp Mem"); - /* - mem = stealBufMem((int32) width * (int32) height); - */ + Im.Width = width; Im.Height = height; Im.ImageData = mem; @@ -564,9 +525,7 @@ static void doScrollBlack(void) { if (!IsHiRes) waitTOF(); -#if !defined(DOSCODE) BaseAddr = (uint32 *) getVGABaseAddr(); -#endif if (by > nheight) by = nheight; @@ -608,10 +567,7 @@ static void doScrollBlack(void) { freeAllStolenMem(); mouseShow(); - -#if !defined(DOSCODE) ungetVGABaseAddr(); -#endif } @@ -628,7 +584,7 @@ static void copyPage(uint16 width, uint16 height, uint16 nheight, uint16 startli uint16 CurPage; uint32 *BaseAddr; - BaseAddr = (uint32 *) getVGABaseAddr(); + BaseAddr = (uint32 *)getVGABaseAddr(); size = (int32)(height - nheight) * (int32) width; mem += startline * width; @@ -650,9 +606,7 @@ static void copyPage(uint16 width, uint16 height, uint16 nheight, uint16 startli OffSet = 0; } -#if !defined(DOSCODE) ungetVGABaseAddr(); -#endif } @@ -839,9 +793,7 @@ static void doTransWipe(CloseDataPtr *CPtr, char *filename) { linesdone = 0; } -#if !defined(DOSCODE) ImDest.ImageData = getVGABaseAddr(); -#endif bltBitMap(&ImSource, 0, CurY, &ImDest, 0, CurY, VGAScreenWidth, 2); ghoastRect(0, 0, CurY, VGAScreenWidth - 1, CurY + 1); @@ -860,9 +812,7 @@ static void doTransWipe(CloseDataPtr *CPtr, char *filename) { linesdone = 0; } -#if !defined(DOSCODE) ImDest.ImageData = getVGABaseAddr(); -#endif if (CurY == LastY) bltBitMap(&ImSource, 0, CurY, &ImDest, 0, CurY, VGAScreenWidth, 1); @@ -875,9 +825,7 @@ static void doTransWipe(CloseDataPtr *CPtr, char *filename) { } } -#if !defined(DOSCODE) ungetVGABaseAddr(); -#endif } -- cgit v1.2.3 From 01e290e4c3cbea59690b1e0283627bd4d3242eb1 Mon Sep 17 00:00:00 2001 From: Eugene Sandulenko Date: Sat, 27 Dec 2014 01:49:31 +0100 Subject: LAB: Added detection for lowres DOS version --- engines/lab/detection.cpp | 19 ++++++++++++------- 1 file changed, 12 insertions(+), 7 deletions(-) diff --git a/engines/lab/detection.cpp b/engines/lab/detection.cpp index a7d70eb551..5c69a1a253 100644 --- a/engines/lab/detection.cpp +++ b/engines/lab/detection.cpp @@ -40,14 +40,18 @@ static const PlainGameDescriptor lab_setting[] = { { 0, 0 } }; +enum GameFeatures { + GF_LOWRES = 1 << 0 +}; + static const ADGameDescription labDescriptions[] = { { "lab", "", { - { "doors", 0, "d77536010e7e5ae17ee066323ceb9585", 2537 }, - { "notes11", 0, "63e873f659f8f46f9809d16a2bf653c7", 3562 }, - { "inv", 0, "8c3677dba0113067619f88d301795b39", 23472 }, + { "doors", 0, "d77536010e7e5ae17ee066323ceb9585", 2537 }, + { "notes11", 0, "63e873f659f8f46f9809d16a2bf653c7", 3562 }, + { "noteold.fon", 0, "6c1d90ad55149556e79d3f7bfddb4bd7", 9252 }, { NULL, 0, NULL, 0 } }, Common::EN_ANY, @@ -57,16 +61,16 @@ static const ADGameDescription labDescriptions[] = { }, { "lab", - "lowres", + "Lowres", { { "doors", 0, "d77536010e7e5ae17ee066323ceb9585", 2537 }, { "notes11", 0, "63e873f659f8f46f9809d16a2bf653c7", 3562 }, - { "inv", 0, "1633476827f614554be53d358ac2f8c0", 5076 }, + { "64b", 0, "3a84d41bcc6a782f22e8e954bce09721", 39916 }, { NULL, 0, NULL, 0 } }, Common::EN_ANY, Common::kPlatformDOS, - ADGF_NO_FLAGS, + GF_LOWRES, GUIO0() }, { @@ -117,6 +121,7 @@ static const char *const directoryGlobs[] = { "pict", "spict", "rooms", + "h2", 0 }; @@ -125,7 +130,7 @@ public: LabMetaEngine() : AdvancedMetaEngine(labDescriptions, sizeof(ADGameDescription), lab_setting) { _singleid = "lab"; - _maxScanDepth = 3; + _maxScanDepth = 4; _directoryGlobs = directoryGlobs; } -- cgit v1.2.3 From 60388893a95e8ef3044dd00dd10087967be04fdf Mon Sep 17 00:00:00 2001 From: Eugene Sandulenko Date: Sat, 27 Dec 2014 12:23:20 +0100 Subject: LAB: propagate gamePlatform() --- engines/lab/detection.cpp | 18 +++++++++++------- engines/lab/lab.cpp | 6 ++++-- engines/lab/lab.h | 11 ++++++++++- 3 files changed, 25 insertions(+), 10 deletions(-) diff --git a/engines/lab/detection.cpp b/engines/lab/detection.cpp index 5c69a1a253..3c9174aa8c 100644 --- a/engines/lab/detection.cpp +++ b/engines/lab/detection.cpp @@ -40,10 +40,6 @@ static const PlainGameDescriptor lab_setting[] = { { 0, 0 } }; -enum GameFeatures { - GF_LOWRES = 1 << 0 -}; - static const ADGameDescription labDescriptions[] = { { "lab", @@ -70,7 +66,7 @@ static const ADGameDescription labDescriptions[] = { }, Common::EN_ANY, Common::kPlatformDOS, - GF_LOWRES, + Lab::GF_LOWRES, GUIO0() }, { @@ -125,6 +121,14 @@ static const char *const directoryGlobs[] = { 0 }; +namespace Lab { + +Common::Platform LabEngine::getPlatform() const { + return _gameDescription->platform; +} + +} // End of namespace Lab + class LabMetaEngine : public AdvancedMetaEngine { public: LabMetaEngine() : AdvancedMetaEngine(labDescriptions, sizeof(ADGameDescription), lab_setting) { @@ -142,9 +146,9 @@ public: return "Labytinth of Time (c) 2004 The Wyrmkeep Entertainment Co."; } - virtual bool createInstance(OSystem *syst, Engine **engine, const ADGameDescription * /* desc */) const { + virtual bool createInstance(OSystem *syst, Engine **engine, const ADGameDescription *desc) const { // Instantiate Engine even if the game data is not found. - *engine = new Lab::LabEngine(syst); + *engine = new Lab::LabEngine(syst, desc); return true; } diff --git a/engines/lab/lab.cpp b/engines/lab/lab.cpp index 971543a3f2..911ad6d255 100644 --- a/engines/lab/lab.cpp +++ b/engines/lab/lab.cpp @@ -39,6 +39,8 @@ #include "lab/lab.h" #include "lab/labfun.h" +#include "engines/advancedDetector.h" + namespace Lab { bool LabEngine::hasFeature(EngineFeature f) const { @@ -47,8 +49,8 @@ bool LabEngine::hasFeature(EngineFeature f) const { LabEngine *g_lab; -LabEngine::LabEngine(OSystem *syst) - : Engine(syst) { +LabEngine::LabEngine(OSystem *syst, const ADGameDescription *gameDesc) + : Engine(syst), _gameDescription(gameDesc) { g_lab = this; } diff --git a/engines/lab/lab.h b/engines/lab/lab.h index bdb0b4d89b..72e359c291 100644 --- a/engines/lab/lab.h +++ b/engines/lab/lab.h @@ -36,17 +36,26 @@ #include "engines/engine.h" #include "lab/labfun.h" +struct ADGameDescription; + namespace Lab { +enum GameFeatures { + GF_LOWRES = 1 << 0 +}; + class LabEngine : public Engine { public: - LabEngine(OSystem *syst); + LabEngine(OSystem *syst, const ADGameDescription *gameDesc); ~LabEngine(); virtual Common::Error run(); bool hasFeature(EngineFeature f) const; + const ADGameDescription *_gameDescription; + Common::Platform getPlatform() const; + LargeSet *_conditions, *_roomsFound; }; -- cgit v1.2.3 From 60d4f0a0695f8eaf5aced2df7dfe3c191e37ae25 Mon Sep 17 00:00:00 2001 From: Eugene Sandulenko Date: Sat, 27 Dec 2014 14:18:40 +0100 Subject: LAB: Initial support for lowres mode --- engines/lab/detection.cpp | 5 + engines/lab/engine.cpp | 569 +++++++++++++++------------------------------- engines/lab/graphics.cpp | 33 +-- engines/lab/interface.cpp | 13 +- engines/lab/intro.cpp | 41 ++-- engines/lab/lab.cpp | 8 +- engines/lab/lab.h | 2 + engines/lab/mouse.cpp | 8 +- engines/lab/special.cpp | 92 +------- engines/lab/vga.cpp | 20 +- 10 files changed, 258 insertions(+), 533 deletions(-) diff --git a/engines/lab/detection.cpp b/engines/lab/detection.cpp index 3c9174aa8c..1cd78a16db 100644 --- a/engines/lab/detection.cpp +++ b/engines/lab/detection.cpp @@ -127,6 +127,10 @@ Common::Platform LabEngine::getPlatform() const { return _gameDescription->platform; } +uint32 LabEngine::getFeatures() const { + return _gameDescription->flags; +} + } // End of namespace Lab class LabMetaEngine : public AdvancedMetaEngine { @@ -136,6 +140,7 @@ public: _maxScanDepth = 4; _directoryGlobs = directoryGlobs; + _flags = kADFlagUseExtraAsHint; } virtual const char *getName() const { diff --git a/engines/lab/engine.cpp b/engines/lab/engine.cpp index 61042708eb..447a8fec55 100644 --- a/engines/lab/engine.cpp +++ b/engines/lab/engine.cpp @@ -56,7 +56,6 @@ extern InventoryData *Inventory; extern uint16 NumInv, RoomNum, ManyRooms, HighestCondition, Direction; CloseDataPtr CPtr; -#if !defined(DOSCODE) CrumbData BreadCrumbs[MAX_CRUMBS]; uint16 NumCrumbs; bool DroppingCrumbs; @@ -69,7 +68,6 @@ bool IsCrumbWaiting; int followCrumbs(); void mayShowCrumbIndicator(); void mayShowCrumbIndicatorOff(); -#endif bool Alternate = false, ispal = false, noupdatediff = false, MainDisplay = true, QuitLab = false, DoNotReset = false; @@ -131,12 +129,7 @@ static uint32 BUFFERSIZE = BIGBUFFERSIZE; static byte *MovePanelBuffer, *InvPanelBuffer; static uint32 MovePanelBufferSize, InvPanelBufferSize; -static Image *MoveImages[20], -#if defined(DOSCODE) - *InvImages[6]; -#else - *InvImages[10]; -#endif +static Image *MoveImages[20], *InvImages[10]; static Gadget *MoveGadgetList, *InvGadgetList; @@ -173,14 +166,14 @@ void drawPanel(void) { drawHLine(0, VGAScaleY(170) + 1, VGAScaleX(319)); /* The horizontal lines under the black one */ drawGadgetList(MoveGadgetList); } else { -#if defined(DOSCODE) - drawVLine(VGAScaleX(124), VGAScaleY(170) + 1, VGAScaleY(199)); /* Vertical Black lines */ - drawVLine(VGAScaleX(194), VGAScaleY(170) + 1, VGAScaleY(199)); -#else - drawVLine(VGAScaleX(90), VGAScaleY(170) + 1, VGAScaleY(199)); /* Vertical Black lines */ - drawVLine(VGAScaleX(160), VGAScaleY(170) + 1, VGAScaleY(199)); - drawVLine(VGAScaleX(230), VGAScaleY(170) + 1, VGAScaleY(199)); -#endif + if (g_lab->getPlatform() != Common::kPlatformWindows) { + drawVLine(VGAScaleX(124), VGAScaleY(170) + 1, VGAScaleY(199)); /* Vertical Black lines */ + drawVLine(VGAScaleX(194), VGAScaleY(170) + 1, VGAScaleY(199)); + } else { + drawVLine(VGAScaleX(90), VGAScaleY(170) + 1, VGAScaleY(199)); /* Vertical Black lines */ + drawVLine(VGAScaleX(160), VGAScaleY(170) + 1, VGAScaleY(199)); + drawVLine(VGAScaleX(230), VGAScaleY(170) + 1, VGAScaleY(199)); + } setAPen(4); drawHLine(0, VGAScaleY(170) + 1, VGAScaleX(122)); /* The horizontal lines under the black one */ @@ -188,14 +181,14 @@ void drawPanel(void) { drawHLine(VGAScaleX(196), VGAScaleY(170) + 1, VGAScaleX(319)); drawVLine(VGAScaleX(1), VGAScaleY(170) + 2, VGAScaleY(198)); /* The vertical high light lines */ -#if defined(DOSCODE) - drawVLine(VGAScaleX(126), VGAScaleY(170) + 2, VGAScaleY(198)); - drawVLine(VGAScaleX(196), VGAScaleY(170) + 2, VGAScaleY(198)); -#else - drawVLine(VGAScaleX(92), VGAScaleY(170) + 2, VGAScaleY(198)); - drawVLine(VGAScaleX(162), VGAScaleY(170) + 2, VGAScaleY(198)); - drawVLine(VGAScaleX(232), VGAScaleY(170) + 2, VGAScaleY(198)); -#endif + if (g_lab->getPlatform() != Common::kPlatformWindows) { + drawVLine(VGAScaleX(126), VGAScaleY(170) + 2, VGAScaleY(198)); + drawVLine(VGAScaleX(196), VGAScaleY(170) + 2, VGAScaleY(198)); + } else { + drawVLine(VGAScaleX(92), VGAScaleY(170) + 2, VGAScaleY(198)); + drawVLine(VGAScaleX(162), VGAScaleY(170) + 2, VGAScaleY(198)); + drawVLine(VGAScaleX(232), VGAScaleY(170) + 2, VGAScaleY(198)); + } drawGadgetList(InvGadgetList); } @@ -281,47 +274,48 @@ bool setUpScreens(void) { /* Creates the gadgets for the movement control panel */ y = VGAScaleY(173) - SVGACord(2); -#if !defined(DOSCODE) - MoveGadgetList = createButton(VGAScaleX(1), y, 0, 't', MoveImages[0], MoveImages[1]); - curgad = MoveGadgetList; - curgad->NextGadget = createButton(VGAScaleX(33), y, 1, 'm', MoveImages[2], MoveImages[3]); - curgad = curgad->NextGadget; - curgad->NextGadget = createButton(VGAScaleX(65), y, 2, 'o', MoveImages[4], MoveImages[5]); - curgad = curgad->NextGadget; - curgad->NextGadget = createButton(VGAScaleX(97), y, 3, 'c', MoveImages[6], MoveImages[7]); - curgad = curgad->NextGadget; - curgad->NextGadget = createButton(VGAScaleX(129), y, 4, 'l', MoveImages[8], MoveImages[9]); - curgad = curgad->NextGadget; - curgad->NextGadget = createButton(VGAScaleX(161), y, 5, 'i', MoveImages[12], MoveImages[13]); - curgad = curgad->NextGadget; - curgad->NextGadget = createButton(VGAScaleX(193), y, 6, VKEY_LTARROW, MoveImages[14], MoveImages[15]); - curgad = curgad->NextGadget; - curgad->NextGadget = createButton(VGAScaleX(225), y, 7, VKEY_UPARROW, MoveImages[16], MoveImages[17]); - curgad = curgad->NextGadget; - curgad->NextGadget = createButton(VGAScaleX(257), y, 8, VKEY_RTARROW, MoveImages[18], MoveImages[19]); - curgad = curgad->NextGadget; - curgad->NextGadget = createButton(VGAScaleX(289), y, 9, 'p', MoveImages[10], MoveImages[11]); -#else - MoveGadgetList = createButton(VGAScaleX(1), y, 0, MoveImages[0], MoveImages[1]); - curgad = MoveGadgetList; - curgad->NextGadget = createButton(VGAScaleX(33), y, 1, MoveImages[2], MoveImages[3]); - curgad = curgad->NextGadget; - curgad->NextGadget = createButton(VGAScaleX(65), y, 2, MoveImages[4], MoveImages[5]); - curgad = curgad->NextGadget; - curgad->NextGadget = createButton(VGAScaleX(97), y, 3, MoveImages[6], MoveImages[7]); - curgad = curgad->NextGadget; - curgad->NextGadget = createButton(VGAScaleX(129), y, 4, MoveImages[8], MoveImages[9]); - curgad = curgad->NextGadget; - curgad->NextGadget = createButton(VGAScaleX(161), y, 5, MoveImages[12], MoveImages[13]); - curgad = curgad->NextGadget; - curgad->NextGadget = createButton(VGAScaleX(193), y, 6, MoveImages[14], MoveImages[15]); - curgad = curgad->NextGadget; - curgad->NextGadget = createButton(VGAScaleX(225), y, 7, MoveImages[16], MoveImages[17]); - curgad = curgad->NextGadget; - curgad->NextGadget = createButton(VGAScaleX(257), y, 8, MoveImages[18], MoveImages[19]); - curgad = curgad->NextGadget; - curgad->NextGadget = createButton(VGAScaleX(289), y, 9, MoveImages[10], MoveImages[11]); -#endif + + if (g_lab->getPlatform() != Common::kPlatformWindows) { + MoveGadgetList = createButton(VGAScaleX(1), y, 0, 't', MoveImages[0], MoveImages[1]); + curgad = MoveGadgetList; + curgad->NextGadget = createButton(VGAScaleX(33), y, 1, 'm', MoveImages[2], MoveImages[3]); + curgad = curgad->NextGadget; + curgad->NextGadget = createButton(VGAScaleX(65), y, 2, 'o', MoveImages[4], MoveImages[5]); + curgad = curgad->NextGadget; + curgad->NextGadget = createButton(VGAScaleX(97), y, 3, 'c', MoveImages[6], MoveImages[7]); + curgad = curgad->NextGadget; + curgad->NextGadget = createButton(VGAScaleX(129), y, 4, 'l', MoveImages[8], MoveImages[9]); + curgad = curgad->NextGadget; + curgad->NextGadget = createButton(VGAScaleX(161), y, 5, 'i', MoveImages[12], MoveImages[13]); + curgad = curgad->NextGadget; + curgad->NextGadget = createButton(VGAScaleX(193), y, 6, VKEY_LTARROW, MoveImages[14], MoveImages[15]); + curgad = curgad->NextGadget; + curgad->NextGadget = createButton(VGAScaleX(225), y, 7, VKEY_UPARROW, MoveImages[16], MoveImages[17]); + curgad = curgad->NextGadget; + curgad->NextGadget = createButton(VGAScaleX(257), y, 8, VKEY_RTARROW, MoveImages[18], MoveImages[19]); + curgad = curgad->NextGadget; + curgad->NextGadget = createButton(VGAScaleX(289), y, 9, 'p', MoveImages[10], MoveImages[11]); + } else { + MoveGadgetList = createButton(VGAScaleX(1), y, 0, 0, MoveImages[0], MoveImages[1]); + curgad = MoveGadgetList; + curgad->NextGadget = createButton(VGAScaleX(33), y, 1, 0, MoveImages[2], MoveImages[3]); + curgad = curgad->NextGadget; + curgad->NextGadget = createButton(VGAScaleX(65), y, 2, 0, MoveImages[4], MoveImages[5]); + curgad = curgad->NextGadget; + curgad->NextGadget = createButton(VGAScaleX(97), y, 3, 0, MoveImages[6], MoveImages[7]); + curgad = curgad->NextGadget; + curgad->NextGadget = createButton(VGAScaleX(129), y, 4, 0, MoveImages[8], MoveImages[9]); + curgad = curgad->NextGadget; + curgad->NextGadget = createButton(VGAScaleX(161), y, 5, 0, MoveImages[12], MoveImages[13]); + curgad = curgad->NextGadget; + curgad->NextGadget = createButton(VGAScaleX(193), y, 6, 0, MoveImages[14], MoveImages[15]); + curgad = curgad->NextGadget; + curgad->NextGadget = createButton(VGAScaleX(225), y, 7, 0, MoveImages[16], MoveImages[17]); + curgad = curgad->NextGadget; + curgad->NextGadget = createButton(VGAScaleX(257), y, 8, 0, MoveImages[18], MoveImages[19]); + curgad = curgad->NextGadget; + curgad->NextGadget = createButton(VGAScaleX(289), y, 9, 0, MoveImages[10], MoveImages[11]); + } InvPanelBufferSize = sizeOfFile("P:Inv"); @@ -340,45 +334,44 @@ bool setUpScreens(void) { file->close(); *buffer = InvPanelBuffer; -#if !defined(DOSCODE) - - for (counter = 0; counter < 10; counter++) - readImage(buffer, &(InvImages[counter])); - - InvGadgetList = createButton(VGAScaleX(24), y, 0, 'm', InvImages[0], InvImages[1]); - curgad = InvGadgetList; - curgad->NextGadget = createButton(VGAScaleX(56), y, 1, 'g', InvImages[2], InvImages[3]); - curgad = curgad->NextGadget; - curgad->NextGadget = createButton(VGAScaleX(94), y, 2, 'u', InvImages[4], InvImages[5]); - curgad = curgad->NextGadget; - curgad->NextGadget = createButton(VGAScaleX(126), y, 3, 'l', MoveImages[8], MoveImages[9]); - curgad = curgad->NextGadget; - curgad->NextGadget = createButton(VGAScaleX(164), y, 4, VKEY_LTARROW, MoveImages[14], MoveImages[15]); - curgad = curgad->NextGadget; - curgad->NextGadget = createButton(VGAScaleX(196), y, 5, VKEY_RTARROW, MoveImages[18], MoveImages[19]); - curgad = curgad->NextGadget; - curgad->NextGadget = createButton(VGAScaleX(234), y, 6, 'b', InvImages[6], InvImages[7]); - curgad = curgad->NextGadget; - curgad->NextGadget = createButton(VGAScaleX(266), y, 7, 'f', InvImages[8], InvImages[9]); - curgad = curgad->NextGadget; -#else - - for (counter = 0; counter < 6; counter++) - readImage(buffer, &(InvImages[counter])); - - InvGadgetList = createButton(VGAScaleX(58), y, 0, InvImages[0], InvImages[1]); - curgad = InvGadgetList; - curgad->NextGadget = createButton(VGAScaleX(90), y, 1, InvImages[2], InvImages[3]); - curgad = curgad->NextGadget; - curgad->NextGadget = createButton(VGAScaleX(128), y, 2, InvImages[4], InvImages[5]); - curgad = curgad->NextGadget; - curgad->NextGadget = createButton(VGAScaleX(160), y, 3, MoveImages[8], MoveImages[9]); - curgad = curgad->NextGadget; - curgad->NextGadget = createButton(VGAScaleX(198), y, 4, MoveImages[14], MoveImages[15]); - curgad = curgad->NextGadget; - curgad->NextGadget = createButton(VGAScaleX(230), y, 5, MoveImages[18], MoveImages[19]); - curgad = curgad->NextGadget; -#endif + + if (g_lab->getPlatform() == Common::kPlatformWindows) { + for (counter = 0; counter < 10; counter++) + readImage(buffer, &(InvImages[counter])); + + InvGadgetList = createButton(VGAScaleX(24), y, 0, 'm', InvImages[0], InvImages[1]); + curgad = InvGadgetList; + curgad->NextGadget = createButton(VGAScaleX(56), y, 1, 'g', InvImages[2], InvImages[3]); + curgad = curgad->NextGadget; + curgad->NextGadget = createButton(VGAScaleX(94), y, 2, 'u', InvImages[4], InvImages[5]); + curgad = curgad->NextGadget; + curgad->NextGadget = createButton(VGAScaleX(126), y, 3, 'l', MoveImages[8], MoveImages[9]); + curgad = curgad->NextGadget; + curgad->NextGadget = createButton(VGAScaleX(164), y, 4, VKEY_LTARROW, MoveImages[14], MoveImages[15]); + curgad = curgad->NextGadget; + curgad->NextGadget = createButton(VGAScaleX(196), y, 5, VKEY_RTARROW, MoveImages[18], MoveImages[19]); + curgad = curgad->NextGadget; + curgad->NextGadget = createButton(VGAScaleX(234), y, 6, 'b', InvImages[6], InvImages[7]); + curgad = curgad->NextGadget; + curgad->NextGadget = createButton(VGAScaleX(266), y, 7, 'f', InvImages[8], InvImages[9]); + curgad = curgad->NextGadget; + } else { + for (counter = 0; counter < 6; counter++) + readImage(buffer, &(InvImages[counter])); + + InvGadgetList = createButton(VGAScaleX(58), y, 0, 0, InvImages[0], InvImages[1]); + curgad = InvGadgetList; + curgad->NextGadget = createButton(VGAScaleX(90), y, 1, 0, InvImages[2], InvImages[3]); + curgad = curgad->NextGadget; + curgad->NextGadget = createButton(VGAScaleX(128), y, 2, 0, InvImages[4], InvImages[5]); + curgad = curgad->NextGadget; + curgad->NextGadget = createButton(VGAScaleX(160), y, 3, 0, MoveImages[8], MoveImages[9]); + curgad = curgad->NextGadget; + curgad->NextGadget = createButton(VGAScaleX(198), y, 4, 0, MoveImages[14], MoveImages[15]); + curgad = curgad->NextGadget; + curgad->NextGadget = createButton(VGAScaleX(230), y, 5, 0, MoveImages[18], MoveImages[19]); + curgad = curgad->NextGadget; + } return true; } @@ -462,19 +455,6 @@ static void checkRoomMusic(void) { } - -#if defined(DOSCODE) -#define MONLTMARGIN 0 -#define MONRTMARGIN 319 -#define MONTOPMARGIN 0 -#define LUTERTMARGIN 124 -#else -#define MONLTMARGIN 2 -#define MONRTMARGIN 317 -#define MONTOPMARGIN 2 -#define LUTERTMARGIN 128 -#endif - /******************************************************************************/ /* Checks whether the close up is one of the special case closeups. */ /******************************************************************************/ @@ -482,23 +462,37 @@ static bool doCloseUp(CloseDataPtr cptr) { if (cptr == NULL) return false; + int monltmargin, monrtmargin, montopmargin, lutertmargin; + + if (g_lab->getPlatform() != Common::kPlatformWindows) { + monltmargin = 0; + monrtmargin = 319; + montopmargin = 0; + lutertmargin = 124; + } else { + monltmargin = 2; + monrtmargin = 317; + montopmargin = 2; + lutertmargin = 128; + } + if ((cptr->CloseUpType == MUSEUMMONITOR) || (cptr->CloseUpType == LIBRARYMONITOR) || (cptr->CloseUpType == WINDOWMONITOR)) - doMonitor(cptr->GraphicName, cptr->Message, false, MONLTMARGIN, MONTOPMARGIN, MONRTMARGIN, 165); + doMonitor(cptr->GraphicName, cptr->Message, false, monltmargin, montopmargin, monrtmargin, 165); else if (cptr->CloseUpType == GRAMAPHONEMONITOR) - doMonitor(cptr->GraphicName, cptr->Message, false, MONLTMARGIN, MONTOPMARGIN, 171, 165); + doMonitor(cptr->GraphicName, cptr->Message, false, monltmargin, montopmargin, 171, 165); else if (cptr->CloseUpType == UNICYCLEMONITOR) - doMonitor(cptr->GraphicName, cptr->Message, false, 100, MONTOPMARGIN, MONRTMARGIN, 165); + doMonitor(cptr->GraphicName, cptr->Message, false, 100, montopmargin, monrtmargin, 165); else if (cptr->CloseUpType == STATUEMONITOR) - doMonitor(cptr->GraphicName, cptr->Message, false, 117, MONTOPMARGIN, MONRTMARGIN, 165); + doMonitor(cptr->GraphicName, cptr->Message, false, 117, montopmargin, monrtmargin, 165); else if (cptr->CloseUpType == TALISMANMONITOR) - doMonitor(cptr->GraphicName, cptr->Message, false, MONLTMARGIN, MONTOPMARGIN, 184, 165); + doMonitor(cptr->GraphicName, cptr->Message, false, monltmargin, montopmargin, 184, 165); else if (cptr->CloseUpType == LUTEMONITOR) - doMonitor(cptr->GraphicName, cptr->Message, false, MONLTMARGIN, MONTOPMARGIN, LUTERTMARGIN, 165); + doMonitor(cptr->GraphicName, cptr->Message, false, monltmargin, montopmargin, lutertmargin, 165); else if (cptr->CloseUpType == CLOCKMONITOR) - doMonitor(cptr->GraphicName, cptr->Message, false, MONLTMARGIN, MONTOPMARGIN, 206, 165); + doMonitor(cptr->GraphicName, cptr->Message, false, monltmargin, montopmargin, 206, 165); else if (cptr->CloseUpType == TERMINALMONITOR) - doMonitor(cptr->GraphicName, cptr->Message, true, MONLTMARGIN, MONTOPMARGIN, MONRTMARGIN, 165); + doMonitor(cptr->GraphicName, cptr->Message, true, monltmargin, montopmargin, monrtmargin, 165); else return false; @@ -710,12 +704,8 @@ static void decIncInv(uint16 *CurInv, bool dec) { } -#if defined(DOSCODE) static bool nosvgamem = false; static bool didintro = false; -#else -int didintro = false; // change to int do labw.c can access -#endif static bool novesa = false, noaudio = false; /******************************************************************************/ @@ -725,19 +715,14 @@ static void process(void) { IntuiMessage *Msg; uint32 Class; - uint16 Code, Qualifier, MouseX, MouseY, ActionMode = 4, CurInv = MAPNUM, /* Lab: Labyrinth specific initialization */ - LastInv = MAPNUM, /* Lab: Labyrinth specific initialization */ - Old; + uint16 Code, Qualifier, MouseX, MouseY, ActionMode = 4; + uint16 CurInv = MAPNUM, LastInv = MAPNUM, Old; - bool ForceDraw = false, doit, GotMessage = true; + bool ForceDraw = false, doit, GotMessage = true; - uint16 OldRoomNum, -#if !defined(DOSCODE) - OldDirection, -#endif - GadID, NewDir; + uint16 OldRoomNum, OldDirection, GadID, NewDir; - CloseDataPtr OldCPtr, TempCPtr, HCPtr = NULL; + CloseDataPtr OldCPtr, TempCPtr, HCPtr = NULL; ViewDataPtr VPtr; VGASetPal(initcolors, 8); @@ -778,10 +763,9 @@ static void process(void) { /* Sees what kind of close up we're in and does the appropriate stuff, if any. */ if (doCloseUp(CPtr)) { CPtr = NULL; -#if !defined(DOSCODE) + mayShowCrumbIndicator(); WSDL_UpdateScreen(); -#endif } /* Sets the current picture properly on the screen */ @@ -816,24 +800,17 @@ static void process(void) { drawRoomMessage(CurInv, CPtr); ForceDraw = false; -#if !defined(DOSCODE) mayShowCrumbIndicator(); WSDL_UpdateScreen(); if (!FollowingCrumbs) eatMessages(); - -#else - eatMessages(); -#endif } if (ForceDraw) { drawRoomMessage(CurInv, CPtr); ForceDraw = false; -#if !defined(DOSCODE) WSDL_UpdateScreen(); -#endif } } @@ -846,7 +823,6 @@ static void process(void) { checkRoomMusic(); g_music->newCheckMusic(); diffNextFrame(); -#if !defined(DOSCODE) if (FollowingCrumbs) { int result = followCrumbs(); @@ -878,7 +854,6 @@ static void process(void) { mayShowCrumbIndicator(); WSDL_UpdateScreen(); -#endif } else { GotMessage = true; @@ -891,11 +866,9 @@ static void process(void) { replyMsg((void *) Msg); -#if !defined(DOSCODE) FollowingCrumbs = false; from_crumbs: -#endif DoBlack = false; if ((Class == RAWKEY) && (!LongWinInFront)) { @@ -903,18 +876,14 @@ from_crumbs: Class = MOUSEBUTTONS; Qualifier = IEQUALIFIER_LEFTBUTTON; mouseXY(&MouseX, &MouseY); - } - -#if !defined(DOSCODE) - else if (Code == 'b' || Code == 'B') { /* Start bread crumbs */ + } else if (g_lab->getPlatform() == Common::kPlatformWindows && + (Code == 'b' || Code == 'B')) { /* Start bread crumbs */ BreadCrumbs[0].RoomNum = 0; NumCrumbs = 0; DroppingCrumbs = true; mayShowCrumbIndicator(); WSDL_UpdateScreen(); - } - - else if (Code == 'f' || Code == 'F' || + } else if (Code == 'f' || Code == 'F' || Code == 'r' || Code == 'R') { /* Follow bread crumbs */ if (DroppingCrumbs) { if (NumCrumbs > 0) { @@ -945,11 +914,7 @@ from_crumbs: WSDL_UpdateScreen(); } } - } - -#endif - - else if ((Code == 315) || (Code == 'x') || (Code == 'X') + } else if ((Code == 315) || (Code == 'x') || (Code == 'X') || (Code == 'q') || (Code == 'Q')) { /* Quit? */ DoNotDrawMessage = false; drawMessage("Do you want to quit? (Y/N)"); @@ -968,13 +933,7 @@ from_crumbs: replyMsg((void *) Msg); /* Can't do this in non-IBM versions */ if (Msg->Class == RAWKEY) { -#if defined(DOSCODE) - - if ((Msg->Code == 'Y') || (Msg->Code == 'y')) -#else - if ((Msg->Code == 'Y') || (Msg->Code == 'y') || (Msg->Code == 'Q') || (Msg->Code == 'q')) -#endif - { + if ((Msg->Code == 'Y') || (Msg->Code == 'y') || (Msg->Code == 'Q') || (Msg->Code == 'q')) { doit = true; break; } else if (Msg->Code < 128) { @@ -993,58 +952,9 @@ from_crumbs: ForceDraw = true; interfaceOn(); } - } - -#ifdef undef - else if (Code == 324) { - if (BUFFERSIZE >= BIGBUFFERSIZE) { /* F10 key to switch resolutions */ - blackAllScreen(); - setMode((char) OldMode); - - Alternate = false; - MainDisplay = true; - attachGadgetList(NULL); - fillUpMusic(true); - g_system->delayMillis(750); - - IsHiRes = !IsHiRes; - - free(MovePanelBuffer); - free(InvPanelBuffer); - freeButtonList(MoveGadgetList); - freeButtonList(InvGadgetList); - MoveGadgetList = NULL; - InvGadgetList = NULL; - - if (!setUpScreens()) { - IsHiRes = false; - setUpScreens(); - } - - blackAllScreen(); - resetBuffer(); - CPtr = NULL; - DoBlack = true; - CurFileName = " "; - closeFont(MsgFont); - openFont("P:AvanteG.12", &MsgFont); - /* - mouseReset(); - */ - initMouse(); - drawPanel(); - perFlipGadget(ActionMode); - } else - drawMessage("Not enough memory to change resolutions."); - } - -#endif - - else if (Code == 9) { /* TAB key */ + } else if (Code == 9) { /* TAB key */ Class = DELTAMOVE; - } - - else if (Code == 27) { /* ESC key */ + } else if (Code == 27) { /* ESC key */ CPtr = NULL; } @@ -1060,13 +970,9 @@ from_crumbs: DoNotDrawMessage = false; drawPanel(); drawRoomMessage(CurInv, CPtr); -#if !defined(DOSCODE) WSDL_UpdateScreen(); -#endif } - } - - else if ((Class == GADGETUP) && !Alternate) { + } else if ((Class == GADGETUP) && !Alternate) { if (GadID <= 5) { if ((ActionMode == 4) && (GadID == 4) && (CPtr != NULL)) { doMainView(&CPtr); @@ -1074,13 +980,9 @@ from_crumbs: DoBlack = true; HCPtr = NULL; CPtr = NULL; -#if !defined(DOSCODE) mayShowCrumbIndicator(); WSDL_UpdateScreen(); -#endif - } - - else if (GadID == 5) { + } else if (GadID == 5) { eatMessages(); Alternate = true; @@ -1098,10 +1000,9 @@ from_crumbs: drawPanel(); drawRoomMessage(CurInv, CPtr); -#if !defined(DOSCODE) + mayShowCrumbIndicator(); WSDL_UpdateScreen(); -#endif } else { Old = ActionMode; ActionMode = GadID; @@ -1122,21 +1023,14 @@ from_crumbs: else if (GadID == 4) drawMessage(LOOKWHAT); -#if !defined(DOSCODE) WSDL_UpdateScreen(); -#endif } - } - - else if (GadID == 9) { + } else if (GadID == 9) { doUse(MAPNUM); -#if !defined(DOSCODE) + mayShowCrumbIndicator(); WSDL_UpdateScreen(); -#endif - } - - else if (GadID >= 6) { /* Arrow Gadgets */ + } else if (GadID >= 6) { /* Arrow Gadgets */ CPtr = NULL; HCPtr = NULL; @@ -1147,19 +1041,18 @@ from_crumbs: drawMessage(TURNRIGHT); CurFileName = " "; -#if !defined(DOSCODE) + OldDirection = Direction; -#endif + NewDir = Direction; processArrow(&NewDir, GadID - 6); doTurn(Direction, NewDir, &CPtr); DoBlack = true; Direction = NewDir; ForceDraw = true; -#if !defined(DOSCODE) + mayShowCrumbIndicator(); WSDL_UpdateScreen(); -#endif } else if (GadID == 7) { OldRoomNum = RoomNum; @@ -1181,15 +1074,6 @@ from_crumbs: } } -#if defined(DEMODATA) - { - void writeDemoData(); - writeDemoData(); - } -#endif - -#if !defined(DOSCODE) - if (FollowingCrumbs) { if (IsCrumbTurning) { if (Direction == OldDirection) { @@ -1235,12 +1119,9 @@ from_crumbs: mayShowCrumbIndicator(); WSDL_UpdateScreen(); -#endif } } - } - - else if ((Class == GADGETUP) && Alternate) { + } else if ((Class == GADGETUP) && Alternate) { DoBlack = true; if (GadID == 0) { @@ -1253,9 +1134,8 @@ from_crumbs: interfaceOn(); /* Sets the correct gadget list */ drawPanel(); drawRoomMessage(CurInv, CPtr); -#if !defined(DOSCODE) + WSDL_UpdateScreen(); -#endif } GadID--; @@ -1280,21 +1160,14 @@ from_crumbs: if (doit) { drawMessage("Disk operation failed."); VGASetPal(initcolors, 8); -#if !defined(DOSCODE) + WSDL_UpdateScreen(); -#endif - g_system->delayMillis(1000); - } -#if !defined(DOSCODE) - else { + g_system->delayMillis(1000); + } else { WSDL_UpdateScreen(); } - -#endif - } - - else if (GadID == 1) { + } else if (GadID == 1) { if (!doUse(CurInv)) { Old = ActionMode; ActionMode = 5; /* Use button */ @@ -1304,13 +1177,10 @@ from_crumbs: drawMessage(USEONWHAT); MainDisplay = true; -#if !defined(DOSCODE) + WSDL_UpdateScreen(); -#endif } - } - - else if (GadID == 2) { + } else if (GadID == 2) { MainDisplay = !MainDisplay; if ((CurInv == 0) || (CurInv > NumInv)) { @@ -1324,41 +1194,28 @@ from_crumbs: Inventory[CurInv].BInvName) Test = getInvName(CurInv); -#if !defined(DOSCODE) WSDL_UpdateScreen(); -#endif - } - - else if (GadID == 3) { /* Left gadget */ + } else if (GadID == 3) { /* Left gadget */ decIncInv(&CurInv, true); LastInv = CurInv; DoNotDrawMessage = false; drawRoomMessage(CurInv, CPtr); -#if !defined(DOSCODE) - WSDL_UpdateScreen(); -#endif - } - else if (GadID == 4) { /* Right gadget */ + WSDL_UpdateScreen(); + } else if (GadID == 4) { /* Right gadget */ decIncInv(&CurInv, false); LastInv = CurInv; DoNotDrawMessage = false; drawRoomMessage(CurInv, CPtr); -#if !defined(DOSCODE) - WSDL_UpdateScreen(); -#endif - } -#if !defined(DOSCODE) - else if (GadID == 5) { /* bread crumbs */ + WSDL_UpdateScreen(); + } else if (GadID == 5) { /* bread crumbs */ BreadCrumbs[0].RoomNum = 0; NumCrumbs = 0; DroppingCrumbs = true; mayShowCrumbIndicator(); WSDL_UpdateScreen(); - } - - else if (GadID == 6) { /* follow crumbs */ + } else if (GadID == 6) { /* follow crumbs */ if (DroppingCrumbs) { if (NumCrumbs > 0) { FollowingCrumbs = true; @@ -1387,11 +1244,7 @@ from_crumbs: } } } - } - -#endif - - else if ((Class == MOUSEBUTTONS) && (IEQUALIFIER_LEFTBUTTON & Qualifier) && MainDisplay) { + } else if ((Class == MOUSEBUTTONS) && (IEQUALIFIER_LEFTBUTTON & Qualifier) && MainDisplay) { interfaceOff(); MainDisplay = true; @@ -1423,9 +1276,7 @@ from_crumbs: CurFileName = NewFileName; else if (MouseY < (VGAScaleY(149) + SVGACord(2))) drawMessage(NOTHING); - } - - else if ((ActionMode == 1) /* Manipulate an object */ || + } else if ((ActionMode == 1) /* Manipulate an object */ || (ActionMode == 2) /* Open up a "door" */ || (ActionMode == 3)) { /* Close a "door" */ if (doActionRule(MouseX, MouseY, ActionMode, RoomNum, &CPtr)) @@ -1434,9 +1285,7 @@ from_crumbs: if (MouseY < (VGAScaleY(149) + SVGACord(2))) drawMessage(NOTHING); } - } - - else if (ActionMode == 4) { /* Look at closeups */ + } else if (ActionMode == 4) { /* Look at closeups */ TempCPtr = CPtr; setCurClose(MouseX, MouseY, &TempCPtr); @@ -1451,9 +1300,7 @@ from_crumbs: drawMessage(NOTHING); } else if (MouseY < (VGAScaleY(149) + SVGACord(2))) drawMessage(NOTHING); - } - - else if ((ActionMode == 5) && + } else if ((ActionMode == 5) && g_lab->_conditions->in(CurInv)) { /* Use an item on something else */ if (doOperateRule(MouseX, MouseY, CurInv, &CPtr)) { CurFileName = NewFileName; @@ -1465,13 +1312,9 @@ from_crumbs: } } -#if !defined(DOSCODE) mayShowCrumbIndicator(); WSDL_UpdateScreen(); -#endif - } - - else if (Class == DELTAMOVE) { + } else if (Class == DELTAMOVE) { VPtr = getViewData(RoomNum, Direction); OldCPtr = VPtr->closeUps; @@ -1499,9 +1342,7 @@ from_crumbs: if (HCPtr) mouseMove(scaleX((HCPtr->x1 + HCPtr->x2) / 2), scaleY((HCPtr->y1 + HCPtr->y2) / 2)); - } - - else if ((Class == MOUSEBUTTONS) && (IEQUALIFIER_RBUTTON & Qualifier)) { + } else if ((Class == MOUSEBUTTONS) && (IEQUALIFIER_RBUTTON & Qualifier)) { eatMessages(); Alternate = !Alternate; DoBlack = true; @@ -1518,10 +1359,9 @@ from_crumbs: drawPanel(); drawRoomMessage(CurInv, CPtr); -#if !defined(DOSCODE) + mayShowCrumbIndicator(); WSDL_UpdateScreen(); -#endif } } } @@ -1546,36 +1386,23 @@ from_crumbs: } -/* - void mySignalHandler(int sig) - { - signal(sig, mySignalHandler); - } - */ - - - -#if defined(DOSCODE) -void (__interrupt __far *oldctrlc)(), (__interrupt __far *oldctrlcb)(); - -uint16 iretdummy; -void __interrupt __far myiret() { - iretdummy++; -} -#endif - - -void inner_main() { +void LabEngine::go() { bool mem, dointro = false; uint16 counter; getMode(&OldMode); - IsHiRes = true; DoMusic = true; g_music->_turnMusicOn = true; dointro = true; + IsHiRes = ((getFeatures() & GF_LOWRES) == 0); + + if (IsHiRes) + warning("Running in HiRes mode"); + else + warning("Running in LowRes mode"); + #if 0 for (counter = 1; counter < argc; counter++) { #if defined(DOSCODE) @@ -1613,16 +1440,8 @@ void inner_main() { if (initBuffer(BUFFERSIZE, true)) { mem = true; } else { -#if defined(DOSCODE) - BUFFERSIZE = SMALLBUFFERSIZE; - mem = initBuffer(BUFFERSIZE, true); - IsHiRes = false; - nosvgamem = true; -#else - // unacceptable !!!! warning("initBuffer() failed"); return; -#endif } if (!initAudio()) { @@ -1641,11 +1460,7 @@ void inner_main() { if (!initMouse()) { setMode((char) OldMode); -#if defined(DOSCODE) - _dos_setvect(0x23, oldctrlc); - _dos_setvect(0x1B, oldctrlcb); -#endif - debug("\n\nMouse or mouse driver not installed!\n\n"); + return; } @@ -1660,13 +1475,9 @@ void inner_main() { openFont("P:AvanteG.12", &MsgFont); if (dointro && mem) { -#if defined(DOSCODE) didintro = true; -#endif introSequence(); -#if !defined(DOSCODE) didintro = true; -#endif } else DoBlack = true; @@ -1688,27 +1499,12 @@ void inner_main() { readPict("P:End/L2In.9", true); readPict("P:End/Lost", true); -#if defined(DOSCODE) - counter = 600; - - while (counter) { - newCheckMusic(); - diffNextFrame(); - waitTOF(); - counter--; - } - -#else - warning("STUB: waitForPress"); while (!1) { // 1 means ignore SDL_ProcessInput calls g_music->newCheckMusic(); diffNextFrame(); waitTOF(); } - - // If we weren't exiting, a call to a mythical SDL_StopWaitForPress() would be in order. -#endif } closeFont(MsgFont); @@ -1721,25 +1517,19 @@ void inner_main() { freeAudio(); mouseReset(); - setMode((char) OldMode); - -#if defined(DOSCODE) - _dos_setvect(0x23, oldctrlc); - _dos_setvect(0x1B, oldctrlcb); -#endif + setMode((char)OldMode); } -#if !defined(DOSCODE) /*****************************************************************************/ /* New code to allow quick(er) return navigation in game. */ /*****************************************************************************/ int followCrumbs() { // NORTH, SOUTH, EAST, WEST static int movement[4][4] = { - { VKEY_UPARROW, VKEY_RTARROW, VKEY_RTARROW, VKEY_LTARROW }, { VKEY_RTARROW, VKEY_UPARROW, VKEY_LTARROW, VKEY_RTARROW }, { VKEY_LTARROW, VKEY_RTARROW, VKEY_UPARROW, VKEY_RTARROW }, { VKEY_RTARROW, VKEY_LTARROW, VKEY_RTARROW, VKEY_UPARROW } -#if 0 - { -1, EAST, EAST, WEST }, { WEST, -1, EAST, WEST }, { NORTH, SOUTH, -1, SOUTH }, { NORTH, SOUTH, NORTH, -1 } -#endif + { VKEY_UPARROW, VKEY_RTARROW, VKEY_RTARROW, VKEY_LTARROW }, + { VKEY_RTARROW, VKEY_UPARROW, VKEY_LTARROW, VKEY_RTARROW }, + { VKEY_LTARROW, VKEY_RTARROW, VKEY_UPARROW, VKEY_RTARROW }, + { VKEY_RTARROW, VKEY_LTARROW, VKEY_RTARROW, VKEY_UPARROW } }; int ExitDir; @@ -1805,6 +1595,9 @@ Image DropCrumbsImage = { 24, 24, dropCrumbs }; Image DropCrumbsOffImage = { 24, 24, dropCrumbsOff }; void mayShowCrumbIndicator() { + if (g_lab->getPlatform() != Common::kPlatformWindows) + return; + if (DroppingCrumbs && MainDisplay) { mouseHide(); drawMaskImage(&DropCrumbsImage, 612, 4); @@ -1813,12 +1606,14 @@ void mayShowCrumbIndicator() { } void mayShowCrumbIndicatorOff() { + if (g_lab->getPlatform() != Common::kPlatformWindows) + return; + if (MainDisplay) { mouseHide(); drawMaskImage(&DropCrumbsOffImage, 612, 4); mouseShow(); } } -#endif } // End of namespace Lab diff --git a/engines/lab/graphics.cpp b/engines/lab/graphics.cpp index 41f4a7960a..3d91fd4197 100644 --- a/engines/lab/graphics.cpp +++ b/engines/lab/graphics.cpp @@ -28,6 +28,7 @@ * */ +#include "lab/lab.h" #include "lab/stddefines.h" #include "lab/diff.h" #include "lab/parsetypes.h" @@ -675,23 +676,29 @@ static void doScrollWipe(char *filename) { /* Does the scroll bounce. Assumes bitmap already in memory. */ /*****************************************************************************/ static void doScrollBounce(void) { - byte *mem; - uint16 width, height, startline, counter, -#if defined(DOSCODE) - newby[5] = {5, 4, 3, 2, 1}, newby1[8] = {3, 3, 2, 2, 2, 1, 1, 1}; -#else - newby[5] = {10, 8, 6, 4, 2}, newby1[8] = {6, 6, 4, 4, 4, 2, 2, 2}; -#endif + const uint16 *newby, *newby1; + + const uint16 newbyd[5] = {5, 4, 3, 2, 1}, newby1d[8] = {3, 3, 2, 2, 2, 1, 1, 1}; + const uint16 newbyw[5] = {10, 8, 6, 4, 2}, newby1w[8] = {6, 6, 4, 4, 4, 2, 2, 2}; + + if (g_lab->getPlatform() != Common::kPlatformWindows) { + newby = newbyd; + newby1 = newby1d; + } else { + newby = newbyw; + newby1 = newby1w; + } + mouseHide(); - width = VGAScaleX(320); - height = VGAScaleY(149) + SVGACord(2); - mem = RawDiffBM.Planes[0]; + int width = VGAScaleX(320); + int height = VGAScaleY(149) + SVGACord(2); + byte *mem = RawDiffBM.Planes[0]; g_music->fillUpMusic(true); - startline = headerdata.y - height - 1; + int startline = headerdata.y - height - 1; - for (counter = 0; counter < 5; counter++) { + for (int counter = 0; counter < 5; counter++) { g_music->newCheckMusic(); startline -= newby[counter]; copyPage(width, height, 0, startline, mem); @@ -700,7 +707,7 @@ static void doScrollBounce(void) { waitTOF(); } - for (counter = 8; counter > 0; counter--) { + for (int counter = 8; counter > 0; counter--) { g_music->newCheckMusic(); startline += newby1[counter - 1]; copyPage(width, height, 0, startline, mem); diff --git a/engines/lab/interface.cpp b/engines/lab/interface.cpp index e843d9b4cf..c70d19b2bb 100644 --- a/engines/lab/interface.cpp +++ b/engines/lab/interface.cpp @@ -124,23 +124,12 @@ uint16 makeGadgetKeyEquiv(uint16 key) { /* of gadgets. */ /*****************************************************************************/ static Gadget *checkNumGadgetHit(Gadget *gadlist, uint16 key) { -#if !defined(DOSCODE) uint16 gkey = key - '0'; -#else - key = key - '0'; -#endif while (gadlist != NULL) { -#if !defined(DOSCODE) - if ((gkey - 1 == gadlist->GadgetID || (gkey == 0 && gadlist->GadgetID == 9) || (gadlist->KeyEquiv != 0 && makeGadgetKeyEquiv(key) == gadlist->KeyEquiv)) - && !(GADGETOFF & gadlist->GadgetFlags)) -#else - if ((((key - 1) == gadlist->GadgetID) || ((key == 0) && (gadlist->GadgetID == 9))) && - !(GADGETOFF & gadlist->GadgetFlags)) -#endif - { + && !(GADGETOFF & gadlist->GadgetFlags)) { mouseHide(); drawImage(gadlist->ImAlt, gadlist->x, gadlist->y); mouseShow(); diff --git a/engines/lab/intro.cpp b/engines/lab/intro.cpp index bac197eeb4..09f92c0698 100644 --- a/engines/lab/intro.cpp +++ b/engines/lab/intro.cpp @@ -28,6 +28,7 @@ * */ +#include "lab/lab.h" #include "lab/stddefines.h" #include "lab/labfun.h" #include "lab/timing.h" @@ -272,15 +273,16 @@ void introSequence(void) { DoBlack = true; -#if defined(DOSCODE) - readPict("p:Intro/EA0", true); - readPict("p:Intro/EA1", true); - readPict("p:Intro/EA2", true); - readPict("p:Intro/EA3", true); -#elif defined(ALL_LOGOS) || defined(NDEBUG) - readPict("p:Intro/WYRMKEEP", true); - microDelay(4, 0, NULL); -#endif + if (g_lab->getPlatform() != Common::kPlatformWindows) { + readPict("p:Intro/EA0", true); + readPict("p:Intro/EA1", true); + readPict("p:Intro/EA2", true); + readPict("p:Intro/EA3", true); + } else { + readPict("p:Intro/WYRMKEEP", true); + microDelay(4, 0); + } + blackAllScreen(); g_music->initMusic(); @@ -292,7 +294,6 @@ void introSequence(void) { noscreenchange = false; FadePalette = Palette; -#if defined(ALL_LOGOS) || defined(NDEBUG) for (counter = 0; counter < 16; counter++) { Palette[counter] = ((diffcmap[counter * 3] >> 2) << 8) + @@ -300,11 +301,11 @@ void introSequence(void) { (diffcmap[counter * 3 + 2] >> 2); } - newCheckMusic(); + g_music->newCheckMusic(); fade(true, 0); for (int times = 0; times < 150; times++) { - newCheckMusic(); + g_music->newCheckMusic(); uint16 temp = Palette[2]; for (counter = 2; counter < 15; counter++) @@ -318,7 +319,7 @@ void introSequence(void) { fade(false, 0); blackAllScreen(); -#endif + g_music->newCheckMusic(); readPict("p:Intro/Title.A", true); @@ -327,15 +328,17 @@ void introSequence(void) { readPict("p:Intro/BA", true); readPict("p:Intro/AC", true); musicDelay(); -#if !defined(DOSCODE) - musicDelay(); // more credits on this page now -#endif + + if (g_lab->getPlatform() == Common::kPlatformWindows) + musicDelay(); // more credits on this page now + readPict("p:Intro/CA", true); readPict("p:Intro/AD", true); musicDelay(); -#if !defined(DOSCODE) - musicDelay(); // more credits on this page now -#endif + + if (g_lab->getPlatform() == Common::kPlatformWindows) + musicDelay(); // more credits on this page now + readPict("p:Intro/DA", true); musicDelay(); diff --git a/engines/lab/lab.cpp b/engines/lab/lab.cpp index 911ad6d255..16839dad29 100644 --- a/engines/lab/lab.cpp +++ b/engines/lab/lab.cpp @@ -60,12 +60,14 @@ LabEngine::~LabEngine() { } Common::Error LabEngine::run() { - // Initialize graphics using following: - initGraphics(640, 480, true); + if (getFeatures() & GF_LOWRES) + initGraphics(320, 200, false); + else + initGraphics(640, 480, true); g_music = new Music(); - inner_main(); + go(); return Common::kNoError; } diff --git a/engines/lab/lab.h b/engines/lab/lab.h index 72e359c291..882541780e 100644 --- a/engines/lab/lab.h +++ b/engines/lab/lab.h @@ -50,11 +50,13 @@ public: ~LabEngine(); virtual Common::Error run(); + void go(); bool hasFeature(EngineFeature f) const; const ADGameDescription *_gameDescription; Common::Platform getPlatform() const; + uint32 getFeatures() const; LargeSet *_conditions, *_roomsFound; }; diff --git a/engines/lab/mouse.cpp b/engines/lab/mouse.cpp index 753e8ff302..e68ce6ffa5 100644 --- a/engines/lab/mouse.cpp +++ b/engines/lab/mouse.cpp @@ -133,10 +133,10 @@ void attachGadgetList(Gadget *GadList) { static void drawMouse(void) { if (BackImage.ImageData) { - if (backx <= 640 - BackImage.Width && backy <= 480 - BackImage.Height) + if (backx <= VGAScreenWidth - BackImage.Width && backy <= VGAScreenHeight - BackImage.Height) drawMaskImage(&MouseImage, backx, backy); } else { - if (CurMouseX <= 640 - MouseImage.Width && CurMouseY <= 480 - MouseImage.Height) + if (CurMouseX <= VGAScreenWidth - MouseImage.Width && CurMouseY <= VGAScreenHeight - MouseImage.Height) drawMaskImage(&MouseImage, CurMouseX, CurMouseY); } } @@ -151,13 +151,13 @@ static void getBackMouse(void) { backx = CurMouseX; backy = CurMouseY; - if (backx <= 640 - BackImage.Width && backy <= 480 - BackImage.Height) + if (backx <= VGAScreenWidth - BackImage.Width && backy <= VGAScreenHeight - BackImage.Height) readScreenImage(&BackImage, backx, backy); } static void restoreBackMouse(void) { if (BackImage.ImageData) { - if (backx <= 640 - BackImage.Width && backy <= 480 - BackImage.Height) + if (backx <= VGAScreenWidth - BackImage.Width && backy <= VGAScreenHeight - BackImage.Height) drawImage(&BackImage, backx, backy); BackImage.ImageData = NULL; diff --git a/engines/lab/special.cpp b/engines/lab/special.cpp index 3ab548a82e..038f8b88b6 100644 --- a/engines/lab/special.cpp +++ b/engines/lab/special.cpp @@ -187,9 +187,7 @@ static void changeCombination(uint16 number) { } else waitTOF(); -#if !defined(DOSCODE) display.ImageData = getVGABaseAddr(); -#endif scrollDisplayY(2, VGAScaleX(combx[number]), VGAScaleY(65), VGAScaleX(combx[number]) + (Images[combnum])->Width - 1, VGAScaleY(65) + (Images[combnum])->Height); @@ -204,9 +202,7 @@ static void changeCombination(uint16 number) { else g_lab->_conditions->exclElement(COMBINATIONUNLOCKED); -#if !defined(DOSCODE) ungetVGABaseAddr(); -#endif } @@ -248,9 +244,6 @@ void mouseCombination(uint16 x, uint16 y) { /*----------------------------- Tile Puzzle Rules ----------------------------*/ /*----------------------------------------------------------------------------*/ - - - Image *Tiles[16]; int16 CurTile[4] [4] = { { 1, 5, 9, 13 }, @@ -703,14 +696,12 @@ static bool loadJournalData() { BackG.Im = JLeft; BackG.ImAlt = JLeftAlt; -#if !defined(DOSCODE) BackG.KeyEquiv = VKEY_LTARROW; -#endif + ForwardG.Im = JRight; ForwardG.ImAlt = JRightAlt; -#if !defined(DOSCODE) ForwardG.KeyEquiv = VKEY_RTARROW; -#endif + CancelG.Im = JCancel; CancelG.ImAlt = JCancelAlt; @@ -785,18 +776,14 @@ static void turnPage(bool FromLeft) { for (counter = 0; counter < VGAScreenWidth; counter += 8) { g_music->updateMusic(); waitTOF(); -#if !defined(DOSCODE) ScreenImage.ImageData = getVGABaseAddr(); -#endif bltBitMap(&JBackImage, counter, 0, &ScreenImage, counter, 0, 8, VGAScreenHeight); } } else { for (counter = (VGAScreenWidth - 8); counter > 0; counter -= 8) { g_music->updateMusic(); waitTOF(); -#if !defined(DOSCODE) ScreenImage.ImageData = getVGABaseAddr(); -#endif bltBitMap(&JBackImage, counter, 0, &ScreenImage, counter, 0, 8, VGAScreenHeight); } } @@ -819,9 +806,7 @@ static void drawJournal(uint16 wipenum, bool needFade) { drawJournalText(); -#if !defined(DOSCODE) ScreenImage.ImageData = getVGABaseAddr(); -#endif if (wipenum == 0) bltBitMap(&JBackImage, 0, 0, &ScreenImage, 0, 0, VGAScreenWidth, VGAScreenHeight); @@ -838,9 +823,7 @@ static void drawJournal(uint16 wipenum, bool needFade) { else unGhoastGadget(&ForwardG); -#if !defined(DOSCODE) ungetVGABaseAddr(); -#endif if (needFade) @@ -948,9 +931,7 @@ void doJournal() { fade(false, 0); mouseHide(); -#if !defined(DOSCODE) ScreenImage.ImageData = getVGABaseAddr(); -#endif setAPen(0); rectFill(0, 0, VGAScreenWidth - 1, VGAScreenHeight - 1); @@ -958,9 +939,7 @@ void doJournal() { journalCleanUp(); -#if !defined(DOSCODE) ungetVGABaseAddr(); -#endif } @@ -996,64 +975,6 @@ static char DriveName[5] [MAXDEVNAMES]; /* and returned the number of drives that it found. */ /*****************************************************************************/ uint16 doDisks(void) { -#if defined(DOSCODE) - uint16 many = 0, counter = 2; - union REGS regs; - char str[5]; - - if (manydisks) - return manydisks; - - while ((counter < 7) && (many < MAXDEVNAMES)) { - memset(®s, 0, sizeof(regs)); - /* - regs.h.ah = 0x32; - regs.h.dl = counter+1; - int386(0x21, ®s, ®s); - if (regs.h.al == 0) - { - */ - regs.h.ah = 0x36; - regs.h.dl = counter + 1; - int386(0x21, ®s, ®s); - - if (regs.w.ax != 0xFFFF) { - str[0] = counter + 'A'; - str[1] = ':'; - str[2] = '\\'; - str[3] = 0; - strcpy(DriveName[many], str); - many++; - } - - counter++; - } - - return many; -#elif defined(WIN32) - extern void winGetDriveLetters(char cdLetters[], int size); - char letters[28]; - char str[5]; - uint16 many = 0, counter = 2; - - if (manydisks) - return manydisks; - - winGetDriveLetters(letters, 28); - - while ((counter < 7) && (many < MAXDEVNAMES) && letters[many] != 0) { - str[0] = letters[many]; - str[1] = ':'; - str[2] = '\\'; - str[3] = 0; - strcpy(DriveName[many], str); - many++; - counter++; - } - - return many; -#else - // !!!!goofy test code char str[5]; str[0] = 'C'; str[1] = ':'; @@ -1061,13 +982,8 @@ uint16 doDisks(void) { str[3] = 0; strcpy(DriveName[0], str); return 1; -#endif } - - - - /*****************************************************************************/ /* Does the user interface to save or restore a game position */ /*****************************************************************************/ @@ -1222,8 +1138,8 @@ static void drawSaveLoad() { thumbnail.Width = 128; thumbnail.Height = 72; thumbnail.ImageData = g_SaveGameInfo[j].SaveGameImage; - screen.Width = 640; - screen.Height = 480; + screen.Width = VGAScreenWidth; + screen.Height = VGAScreenHeight; screen.ImageData = getVGABaseAddr(); bltBitMap(&thumbnail, 0, 0, &screen, 72, 67 + i * 75, 128, 72); ungetVGABaseAddr(); diff --git a/engines/lab/vga.cpp b/engines/lab/vga.cpp index 10e52e1dd5..c850f5268d 100644 --- a/engines/lab/vga.cpp +++ b/engines/lab/vga.cpp @@ -75,10 +75,16 @@ void setMode(char mode) { bool createScreen(bool HiRes) { //VGABASEADDRESS = (unsigned long)malloc(640 * 480); VGABASEADDRESS = 0; - VGAScreenWidth = 640; - VGAScreenHeight = 480; + + if (HiRes) { + VGAScreenWidth = 640; + VGAScreenHeight = 480; + } else { + VGAScreenWidth = 320; + VGAScreenHeight = 200; + } VGAPages = 1; - VGABytesPerPage = 640 * 480; + VGABytesPerPage = VGAScreenWidth * VGAScreenHeight; g_DisplayBuffer = (byte *)malloc(VGABytesPerPage); g_Pixels = (byte *)calloc(VGABytesPerPage, 4); @@ -156,8 +162,8 @@ void WSDL_ProcessInput(bool can_delay) { g_MouseX = 0; g_MouseAtEdge = true; } - if (g_MouseX > 639) { - g_MouseX = 640; + if (g_MouseX > VGAScreenWidth - 1) { + g_MouseX = VGAScreenWidth; g_MouseAtEdge = true; } @@ -166,8 +172,8 @@ void WSDL_ProcessInput(bool can_delay) { g_MouseY = 0; g_MouseAtEdge = true; } - if (g_MouseY > 479) { - g_MouseY = 480; + if (g_MouseY > VGAScreenHeight - 1) { + g_MouseY = VGAScreenHeight; g_MouseAtEdge = true; } -- cgit v1.2.3 From c62479949805780d4545876a0785d68ea4c747ba Mon Sep 17 00:00:00 2001 From: Eugene Sandulenko Date: Sat, 27 Dec 2014 14:38:53 +0100 Subject: LAB: Cleanup --- engines/lab/diff.h | 2 -- engines/lab/engine.cpp | 18 ------------------ engines/lab/readdiff.cpp | 37 +++++++------------------------------ 3 files changed, 7 insertions(+), 50 deletions(-) diff --git a/engines/lab/diff.h b/engines/lab/diff.h index e46e320a13..e1644d49ab 100644 --- a/engines/lab/diff.h +++ b/engines/lab/diff.h @@ -50,9 +50,7 @@ struct BitMap { byte *Planes[16]; }; -#if !defined(DOSCODE) #define BITMAPF_VIDEO (1<<7) -#endif /* unDiff.c */ diff --git a/engines/lab/engine.cpp b/engines/lab/engine.cpp index 447a8fec55..6f4f4e54b8 100644 --- a/engines/lab/engine.cpp +++ b/engines/lab/engine.cpp @@ -1405,32 +1405,14 @@ void LabEngine::go() { #if 0 for (counter = 1; counter < argc; counter++) { -#if defined(DOSCODE) - - if (((argv[counter])[0] == 'v') || ((argv[counter])[0] == 'V')) { - IsHiRes = false; - } else -#endif if (((argv[counter])[0] == 'q') || ((argv[counter])[0] == 'Q')) { DoMusic = false; g_music->_turnMusicOn = false; } -#ifdef _DEBUG - else if (((argv[counter])[0] == 'i') || ((argv[counter])[0] == 'I')) { - dointro = false; - } - -#endif else if (((argv[counter])[0] == '/') && ((argv[counter])[1] == '?')) { debug("\n\nPlayer Version 1.0. Copyright (c) 1993 Terra Nova Development\n"); debug("Player v q\n"); -#ifdef _DEBUG - debug(" i : Skip intro (debug only).\n"); -#endif -#if defined(DOSCODE) - debug(" v : Open up on a low res VGA display.\n"); -#endif debug(" q : Start in quiet mode; no sound output.\n\n"); return; } diff --git a/engines/lab/readdiff.cpp b/engines/lab/readdiff.cpp index 8da94d696a..b270f3b8d5 100644 --- a/engines/lab/readdiff.cpp +++ b/engines/lab/readdiff.cpp @@ -197,25 +197,17 @@ void diffNextFrame(void) { IsAnim = (framenumber >= 3) && (!PlayOnce); CurBit = 0; -#if !defined(DOSCODE) - if (DispBitMap->Flags & BITMAPF_VIDEO) WSDL_UpdateScreen(); -#endif - return; /* done with the next frame. */ } g_music->updateMusic(); readBlock(&header, 4L, difffile); -#if !defined(DOSCODE) swapULongPtr(&header, 1); -#endif readBlock(&size, 4L, difffile); -#if !defined(DOSCODE) swapULongPtr(&size, 1); -#endif processed += 8L; @@ -292,9 +284,7 @@ void diffNextFrame(void) { skip(difffile, 4L); readBlock(&samplespeed, 2L, difffile); -#if !defined(DOSCODE) swapUShortPtr(&samplespeed, 1); -#endif skip(difffile, 2L); byte *music = *difffile; @@ -387,10 +377,10 @@ void playDiff(void) { continuous = false; readBlock(temp, 4L, difffile); temp[4] = '\0'; + readBlock(&header, 4L, difffile); -#if !defined(DOSCODE) swapULongPtr(&header, 1); -#endif + processed += 8L; if (!((strcmp((char *)temp, "DIFF") == 0) && (header == 1219009121L))) { @@ -399,13 +389,10 @@ void playDiff(void) { } readBlock(&header, 4L, difffile); -#if !defined(DOSCODE) swapULongPtr(&header, 1); -#endif + readBlock(&size, 4L, difffile); -#if !defined(DOSCODE) swapULongPtr(&size, 1); -#endif if (header == 0) { // sizeof(headerdata) != 18, but the padding might be at the end @@ -420,12 +407,10 @@ void playDiff(void) { skip(difffile, size - 18); -#if !defined(DOSCODE) swapUShortPtr(&headerdata.Version, 3); swapULongPtr(&headerdata.BufferSize, 1); swapUShortPtr(&headerdata.Machine, 1); swapULongPtr(&headerdata.Flags, 1); -#endif continuous = CONTINUOUS & headerdata.Flags; diffwidth = headerdata.x; @@ -546,22 +531,18 @@ void readSound(void) { readBlock(temp_, 4L, difffile_); temp_[4] = '\0'; readBlock(&header_, 4L, difffile_); -#if !defined(DOSCODE) swapULongPtr(&header_, 1); -#endif + processed += 8L; if (!((strcmp(temp_, "DIFF") == 0) && (header_ == 1219009121L))) return; readBlock(&header_, 4L, difffile_); -#if !defined(DOSCODE) swapULongPtr(&header_, 1); -#endif + readBlock(&size_, 4L, difffile_); -#if !defined(DOSCODE) swapULongPtr(&size_, 1); -#endif if (header_ == 0) skip(difffile_, size_); @@ -571,13 +552,10 @@ void readSound(void) { while (header_ != 65535) { g_music->updateMusic(); readBlock(&header_, 4L, difffile_); -#if !defined(DOSCODE) swapULongPtr(&header_, 1); -#endif + readBlock(&size_, 4L, difffile_); -#if !defined(DOSCODE) swapULongPtr(&size_, 1); -#endif if ((header_ == 30) || (header_ == 31)) { if (mwaiteffect) { @@ -591,9 +569,8 @@ void readSound(void) { skip(difffile_, 4L); readBlock(&samplespeed_, 2L, difffile_); -#if !defined(DOSCODE) swapUShortPtr(&samplespeed_, 1); -#endif + skip(difffile_, 2L); byte *music = *difffile_; -- cgit v1.2.3 From fdb4f3edf8882f8c9907aae990c3d376e68cea18 Mon Sep 17 00:00:00 2001 From: Eugene Sandulenko Date: Sun, 28 Dec 2014 00:09:24 +0100 Subject: LAB: Cleanup --- engines/lab/interface.h | 5 - engines/lab/labmusic.cpp | 16 +- engines/lab/labsets.cpp | 4 - engines/lab/map.cpp | 25 +-- engines/lab/parsetypes.h | 2 - engines/lab/readparse.cpp | 21 +-- engines/lab/stddefines.h | 7 +- engines/lab/text.cpp | 12 +- engines/lab/vga.cpp | 466 ---------------------------------------------- engines/lab/vga.h | 2 - 10 files changed, 15 insertions(+), 545 deletions(-) diff --git a/engines/lab/interface.h b/engines/lab/interface.h index b077f3b59e..9b8c3fb8bf 100644 --- a/engines/lab/interface.h +++ b/engines/lab/interface.h @@ -45,9 +45,7 @@ struct IntuiMessage { struct Gadget { uint16 x, y, GadgetID; -#if !defined(DOSCODE) uint16 KeyEquiv; // if not zero, a key that activates gadget -#endif uint32 GadgetFlags; Image *Im, *ImAlt; Gadget *NextGadget; @@ -103,13 +101,10 @@ extern Common::KeyState _keyPressed; #define IEQUALIFIER_RBUTTON 0x2000 #define IEQUALIFIER_LEFTBUTTON 0x4000 -#if !defined(DOSCODE) -// these values come from the SDL virtual key table #define VKEY_UPARROW 273 #define VKEY_DNARROW 274 #define VKEY_RTARROW 275 #define VKEY_LTARROW 276 -#endif /*---------------------------------------------------------------------------*/ diff --git a/engines/lab/labmusic.cpp b/engines/lab/labmusic.cpp index ac7ba70d13..7e91521fd4 100644 --- a/engines/lab/labmusic.cpp +++ b/engines/lab/labmusic.cpp @@ -32,6 +32,7 @@ #include "lab/labfun.h" #include "lab/timing.h" #include "lab/mouse.h" +#include "lab/vga.h" namespace Lab { @@ -73,9 +74,8 @@ Music::Music() { void Music::updateMusic(void) { uint16 i; -#if !defined(DOSCODE) - //SDL_ProcessInput(0); -#endif + WSDL_ProcessInput(0); + updateMouse(); if (EffectPlaying) @@ -106,9 +106,6 @@ void Music::fillbuffer(uint16 unit) { warning("STUB: Music::fillbuffer"); uint32 Size = MUSICBUFSIZE; void *ptr = _musicBuffer[unit]; -#if defined(DOSCODE) - char *endptr; -#endif if (Size < _leftinfile) { _file->read(ptr, Size); @@ -116,14 +113,7 @@ void Music::fillbuffer(uint16 unit) { } else { _file->read(ptr, _leftinfile); -#if defined(DOSCODE) - endptr = ptr; - endptr += _leftinfile - 2; - - memset((void *)(((uint32) ptr) + _leftinfile), *endptr, Size - _leftinfile); -#else memset((char *)ptr + _leftinfile, 0, Size - _leftinfile); -#endif _file->seek(0); _leftinfile = _filelength; diff --git a/engines/lab/labsets.cpp b/engines/lab/labsets.cpp index eefbc79cb4..d68370bf88 100644 --- a/engines/lab/labsets.cpp +++ b/engines/lab/labsets.cpp @@ -69,15 +69,11 @@ bool LargeSet::readInitialConditions(const char *fileName) { return false; readBlock(&many, 2L, file); -#if !defined(DOSCODE) swapUShortPtr(&many, 1); -#endif for (int counter = 0; counter < many; counter++) { readBlock(&set, 2L, file); -#if !defined(DOSCODE) swapUShortPtr(&set, 1); -#endif inclElement(set); } } else diff --git a/engines/lab/map.cpp b/engines/lab/map.cpp index 5f2274651b..95c12bd5d7 100644 --- a/engines/lab/map.cpp +++ b/engines/lab/map.cpp @@ -50,10 +50,8 @@ extern uint16 Direction; extern bool IsHiRes; extern uint32 VGAScreenWidth, VGAScreenHeight; -#if !defined(DOSCODE) extern CloseDataPtr CPtr; extern uint16 RoomNum; -#endif /*****************************************************************************/ /* Converts an Amiga palette (up to 16 colors) to a VGA palette, then sets */ @@ -172,16 +170,12 @@ extern TextFont *MsgFont; uint16 *FadePalette; static uint16 MapGadX[3] = {101, 55, 8}, MapGadY[3] = {105, 105, 105}; -#if !defined(DOSCODE) + static Gadget downgadget = { 101, 105, 2, VKEY_DNARROW, 0L, NULL, NULL, NULL }, upgadget = { 55, 105, 1, VKEY_UPARROW, 0L, NULL, NULL, &downgadget }, - backgadget = { 8, 105, 0, 0, 0L, NULL, NULL, &upgadget }, -#else -static Gadget downgadget = { 101, 105, 2, 0L, NULL, NULL, NULL }, - upgadget = { 55, 105, 1, 0L, NULL, NULL, &downgadget }, - backgadget = { 8, 105, 0, 0L, NULL, NULL, &upgadget }, -#endif -*MapGadgetList = &backgadget; + backgadget = { 8, 105, 0, 0, 0L, NULL, NULL, &upgadget }; + +static Gadget *MapGadgetList = &backgadget; static uint16 AmigaMapPalette[] = { 0x0BA8, 0x0C11, 0x0A74, 0x0076, @@ -292,18 +286,13 @@ static bool loadMapData(void) { if (strcmp((char *)Temp, "MAP0") == 0) { readBlock(&MaxRooms, 2L, buffer); -#if !defined(DOSCODE) swapUShortPtr(&MaxRooms, 1); -#endif Maps = (MapData *)(*buffer); -#if !defined(DOSCODE) for (counter = 1; counter <= MaxRooms; counter++) { swapUShortPtr(&Maps[counter].x, 4); swapULongPtr(&Maps[counter].MapFlags, 1); } - -#endif } else return false; @@ -893,9 +882,7 @@ void processMap(uint16 CurRoom) { } } -#if !defined(DOSCODE) WSDL_UpdateScreen(); -#endif } } } @@ -934,9 +921,7 @@ void doMap(uint16 CurRoom) { drawMap(CurRoom, CurRoom, Maps[CurRoom].PageNumber, false, true); mouseShow(); attachGadgetList(MapGadgetList); -#if !defined(DOSCODE) WSDL_UpdateScreen(); -#endif processMap(CurRoom); attachGadgetList(NULL); fade(false, 0); @@ -947,9 +932,7 @@ void doMap(uint16 CurRoom) { mapCleanUp(); blackAllScreen(); mouseShow(); -#if !defined(DOSCODE) WSDL_UpdateScreen(); -#endif } } // End of namespace Lab diff --git a/engines/lab/parsetypes.h b/engines/lab/parsetypes.h index 5120c413f8..c40975007a 100644 --- a/engines/lab/parsetypes.h +++ b/engines/lab/parsetypes.h @@ -201,14 +201,12 @@ struct MapData { #pragma pack(pop) #endif -#if !defined(DOSCODE) typedef struct { uint16 RoomNum; uint16 Direction; } CrumbData; #define MAX_CRUMBS 128 -#endif } // End of namespace Lab diff --git a/engines/lab/readparse.cpp b/engines/lab/readparse.cpp index 075c1fdb99..5e4bf6208e 100644 --- a/engines/lab/readparse.cpp +++ b/engines/lab/readparse.cpp @@ -77,13 +77,9 @@ bool readRoomData(const char *fileName) { return false; readBlock(&ManyRooms, 2L, file); -#if !defined(DOSCODE) swapUShortPtr(&ManyRooms, 1); -#endif readBlock(&HighestCondition, 2L, file); -#if !defined(DOSCODE) swapUShortPtr(&HighestCondition, 1); -#endif if ((Rooms = (RoomData *)calloc(ManyRooms + 1, sizeof(RoomData)))) { for (Counter = 1; Counter <= ManyRooms; Counter++) { @@ -91,12 +87,11 @@ bool readRoomData(const char *fileName) { readBlock(&(Rooms[Counter].SouthDoor), 2L, file); readBlock(&(Rooms[Counter].EastDoor), 2L, file); readBlock(&(Rooms[Counter].WestDoor), 2L, file); -#if !defined(DOSCODE) + swapUShortPtr(&(Rooms[Counter].NorthDoor), 1); swapUShortPtr(&(Rooms[Counter].SouthDoor), 1); swapUShortPtr(&(Rooms[Counter].EastDoor), 1); swapUShortPtr(&(Rooms[Counter].WestDoor), 1); -#endif readBlock(&(Rooms[Counter].WipeType), 1L, file); } @@ -156,17 +151,14 @@ bool readInventory(const char *fileName) { return false; readBlock(&NumInv, 2L, file); -#if !defined(DOSCODE) swapUShortPtr(&NumInv, 1); -#endif + UseMemory = true; if (rallocate((void **) &Inventory, (NumInv + 1) * sizeof(InventoryData))) { for (Counter = 1; Counter <= NumInv; Counter++) { readBlock(&(Inventory[Counter].Many), 2L, file); -#if !defined(DOSCODE) swapUShortPtr(&(Inventory[Counter].Many), 1); -#endif if (!readString(&(Inventory[Counter].name), file)) { UseMemory = false; @@ -249,9 +241,7 @@ static int16 *readConditions(byte **file) { do { readBlock(&last, 2L, file); -#if !defined(DOSCODE) swapUShortPtr((uint16 *)&last, 1); -#endif if (Counter < 25) { list[Counter] = last; @@ -289,9 +279,7 @@ static bool readCloseUps(CloseDataPtr *CPtr, uint16 depth, byte **file) { (*CPtr)->depth = depth; readBlock(*CPtr, 10L, file); -#if !defined(DOSCODE) swapUShortPtr((uint16 *)*CPtr, 5); -#endif if (!readString(&((*CPtr)->GraphicName), file)) return false; @@ -366,9 +354,7 @@ static bool readAction(ActionPtr *APtr, byte **file) { if (c == 1) { if (rallocate((void **) APtr, sizeof(Action))) { readBlock(*APtr, 8L, file); -#if !defined(DOSCODE) swapShortPtr((int16 *)*APtr, 4); -#endif if ((*APtr)->ActionType == SHOWMESSAGES) { if (!rallocate((void **) &ptrarray, 4L * (*APtr)->Param1)) @@ -406,9 +392,8 @@ static bool readRule(RulePtr *RPtr, byte **file) { if (c == 1) { if (rallocate((void **) RPtr, sizeof(Rule))) { readBlock(*RPtr, 6L, file); -#if !defined(DOSCODE) swapShortPtr((int16 *)*RPtr, 3); -#endif + (*RPtr)->Condition = readConditions(file); if (!(*RPtr)->Condition) diff --git a/engines/lab/stddefines.h b/engines/lab/stddefines.h index a9d685bbdb..3729084618 100644 --- a/engines/lab/stddefines.h +++ b/engines/lab/stddefines.h @@ -45,7 +45,6 @@ namespace Lab { #define delay Lab_Delay #endif -#if !defined(DOSCODE) #if defined(USE_NOSWAP) #define swapUShort(value) (value) #define swapUShortPtr(ptr,count) (ptr) @@ -59,7 +58,7 @@ namespace Lab { #define swapULongPtr(ptr,count) (ptr) #define swapLong(value) (value) #define swapLongPtr(ptr,count) (ptr) -#elif defined(USE_SWAP) +#else uint16 swapUShort(uint16 value); uint16 *swapUShortPtr(uint16 *ptr, int count); int16 swapShort(int16 value); @@ -72,10 +71,6 @@ uint32 swapULong(uint32 value); uint32 *swapULongPtr(uint32 *ptr, int count); int32 swapLong(int32 value); int32 *swapLongPtr(int32 *ptr, int count); -#else -#error Please tell me about swapping bytes! -#endif - #endif } // End of namespace Lab diff --git a/engines/lab/text.cpp b/engines/lab/text.cpp index 92711acf5d..5c456c4523 100644 --- a/engines/lab/text.cpp +++ b/engines/lab/text.cpp @@ -53,14 +53,12 @@ bool openFontMem(const char *TextFontPath, struct TextFont *tf, byte *fontbuffer if (strcmp(header, "VGAF") == 0) { tf->DataLength = filesize - headersize; readBlock(&(tf->Height), 2L, file); -#if !defined(DOSCODE) swapUShortPtr(&(tf->Height), 1); -#endif + readBlock(tf->Widths, 256L, file); readBlock(tf->Offsets, 256L * 2L, file); -#if !defined(DOSCODE) swapUShortPtr(tf->Offsets, 256); -#endif + skip(file, 4L); tf->data = fontbuffer; readBlock(tf->data, tf->DataLength, file); @@ -91,14 +89,12 @@ bool openFont(const char *TextFontPath, struct TextFont **tf) { if (strcmp(header, "VGAF") == 0) { (*tf)->DataLength = filesize - headersize; readBlock(&((*tf)->Height), 2L, file); -#if !defined(DOSCODE) swapUShortPtr(&((*tf)->Height), 1); -#endif + readBlock((*tf)->Widths, 256L, file); readBlock((*tf)->Offsets, 256L * 2L, file); -#if !defined(DOSCODE) swapUShortPtr((*tf)->Offsets, 256); -#endif + skip(file, 4L); if (((*tf)->data = (byte *)calloc((*tf)->DataLength, 1))) { diff --git a/engines/lab/vga.cpp b/engines/lab/vga.cpp index c850f5268d..d2fa002e16 100644 --- a/engines/lab/vga.cpp +++ b/engines/lab/vga.cpp @@ -92,8 +92,6 @@ bool createScreen(bool HiRes) { return true; } - - /*****************************************************************************/ /* Sets the current page on the VGA card. */ /*****************************************************************************/ @@ -102,8 +100,6 @@ void setPage(uint16 PageNum) { assert(PageNum == 0); } - - void VGAStorePage(void) { // does nothing in SDL } @@ -228,7 +224,6 @@ void WSDL_GetMousePos(int *x, int *y) { *y = g_MouseY; } - void waitTOF() { int untilOutOfRefresh = 1; @@ -349,7 +344,6 @@ void getMode(uint16 *Mode) { /* Draws an image to the screen. */ /*****************************************************************************/ void drawImage(Image *Im, uint16 x, uint16 y) { -#if !defined(DOSCODE) int sx, sy, dx, dy, w, h; sx = 0; @@ -389,83 +383,12 @@ void drawImage(Image *Im, uint16 x, uint16 y) { ungetVGABaseAddr(); } - -#else - uint32 RealOffset, - SegmentOffset, - LeftInSegment; - char *video, - *curline, - *imdata = Im->ImageData; - uint16 counterx, - countery = 0, - numwholelines, - numpartiallines, - curpage; - - while (countery < Im->Height) { - RealOffset = (VGAScreenWidth * (y + countery)) + x; - curpage = RealOffset / VGABytesPerPage; - SegmentOffset = RealOffset - (curpage * VGABytesPerPage); - LeftInSegment = VGABytesPerPage - SegmentOffset; - setPage(curpage); - video = (char *)(((int32)(VGABASEADDRESS)) + SegmentOffset); - - numwholelines = LeftInSegment / VGAScreenWidth; - numpartiallines = 0; - counterx = LeftInSegment - (numwholelines * VGAScreenWidth); - - if (counterx >= Im->Width) - numwholelines++; - else - numpartiallines = 1; - - while (numwholelines && (countery < Im->Height)) { - curline = video; - - for (counterx = 0; counterx < Im->Width; counterx++) { - *video = *imdata; - video++; - imdata++; - } - - video = curline; - video += VGAScreenWidth; - countery ++; - numwholelines --; - LeftInSegment -= VGAScreenWidth; - } - - if (numpartiallines && (countery < Im->Height)) { - countery ++; - curline = video; - - for (counterx = 0; counterx < Im->Width; counterx++) { - if (LeftInSegment == 0L) { - setPage(curpage + 1); - LeftInSegment = VGABytesPerPage; - video = (char *)(VGABASEADDRESS); - } - - *video = *imdata; - video++; - imdata++; - LeftInSegment--; - } - } - } - -#endif } - - - /*****************************************************************************/ /* Draws an image to the screen. */ /*****************************************************************************/ void drawMaskImage(Image *Im, uint16 x, uint16 y) { -#if !defined(DOSCODE) int sx, sy, dx, dy, w, h; sx = 0; @@ -515,87 +438,12 @@ void drawMaskImage(Image *Im, uint16 x, uint16 y) { ungetVGABaseAddr(); } - -#else - uint32 RealOffset, - SegmentOffset, - LeftInSegment; - char *video, - *curline, - *imdata = Im->ImageData; - uint16 counterx, - countery = 0, - numwholelines, - numpartiallines, - curpage; - - while (countery < Im->Height) { - RealOffset = (VGAScreenWidth * (y + countery)) + x; - curpage = RealOffset / VGABytesPerPage; - SegmentOffset = RealOffset - (curpage * VGABytesPerPage); - LeftInSegment = VGABytesPerPage - SegmentOffset; - setPage(curpage); - video = (char *)(((int32)(VGABASEADDRESS)) + SegmentOffset); - - numwholelines = LeftInSegment / VGAScreenWidth; - numpartiallines = 0; - counterx = LeftInSegment - (numwholelines * VGAScreenWidth); - - if (counterx >= Im->Width) - numwholelines++; - else - numpartiallines = 1; - - while (numwholelines && (countery < Im->Height)) { - curline = video; - - for (counterx = 0; counterx < Im->Width; counterx++) { - if (*imdata) - *video = *imdata - 1; - - video++; - imdata++; - } - - video = curline; - video += VGAScreenWidth; - countery ++; - numwholelines --; - LeftInSegment -= VGAScreenWidth; - } - - if (numpartiallines && (countery < Im->Height)) { - countery ++; - curline = video; - - for (counterx = 0; counterx < Im->Width; counterx++) { - if (LeftInSegment == 0L) { - setPage(curpage + 1); - LeftInSegment = VGABytesPerPage; - video = (char *)(VGABASEADDRESS); - } - - if (*imdata) - *video = *imdata - 1; - - video++; - imdata++; - LeftInSegment--; - } - } - } - -#endif } - - - /*****************************************************************************/ /* Reads an image from the screen. */ /*****************************************************************************/ void readScreenImage(Image *Im, uint16 x, uint16 y) { -#if !defined(DOSCODE) int sx, sy, dx, dy, w, h; sx = 0; @@ -635,73 +483,6 @@ void readScreenImage(Image *Im, uint16 x, uint16 y) { ungetVGABaseAddr(); } - -#else - uint32 RealOffset, - SegmentOffset, - LeftInSegment; - char *video, - *curline, - *imdata = Im->ImageData; - uint16 counterx, - countery = 0, - numwholelines, - numpartiallines, - curpage; - - while (countery < Im->Height) { - RealOffset = (VGAScreenWidth * (y + countery)) + x; - curpage = RealOffset / VGABytesPerPage; - SegmentOffset = RealOffset - (curpage * VGABytesPerPage); - LeftInSegment = VGABytesPerPage - SegmentOffset; - setPage(curpage); - video = (char *)(((int32)(VGABASEADDRESS)) + SegmentOffset); - - numwholelines = LeftInSegment / VGAScreenWidth; - numpartiallines = 0; - counterx = LeftInSegment - (numwholelines * VGAScreenWidth); - - if (counterx >= Im->Width) - numwholelines++; - else - numpartiallines = 1; - - while (numwholelines && (countery < Im->Height)) { - curline = video; - - for (counterx = 0; counterx < Im->Width; counterx++) { - *imdata = *video; - video++; - imdata++; - } - - video = curline; - video += VGAScreenWidth; - countery ++; - numwholelines --; - LeftInSegment -= VGAScreenWidth; - } - - if (numpartiallines && (countery < Im->Height)) { - countery ++; - curline = video; - - for (counterx = 0; counterx < Im->Width; counterx++) { - if (LeftInSegment == 0L) { - setPage(curpage + 1); - LeftInSegment = VGABytesPerPage; - video = (char *)(VGABASEADDRESS); - } - - *imdata = *video; - video++; - imdata++; - LeftInSegment--; - } - } - } - -#endif } @@ -713,7 +494,6 @@ void readScreenImage(Image *Im, uint16 x, uint16 y) { /*****************************************************************************/ void bltBitMap(Image *ImSource, uint16 xs, uint16 ys, Image *ImDest, uint16 xd, uint16 yd, uint16 width, uint16 height) { -#if !defined(DOSCODE) // I think the old code assumed that the source image data was valid for the given box. // I will proceed on that assumption. int sx, sy, dx, dy, w, h; @@ -751,94 +531,10 @@ void bltBitMap(Image *ImSource, uint16 xs, uint16 ys, Image *ImDest, d += ImDest->Width; } } - -#else - uint32 RealOffset, - SegmentOffset, - LeftInSegment; - char *video, - *curdestline, - *cursourceline = ImSource->ImageData, - *imdata; - uint16 counterx, - countery = 0, - numwholelines, - numpartiallines, - curpage; - - cursourceline += (((int32) ys) * ImSource->Width) + xs; - imdata = cursourceline; - - while (countery < height) { - RealOffset = (ImDest->Width * (yd + countery)) + xd; - curpage = RealOffset / VGABytesPerPage; - SegmentOffset = RealOffset - (curpage * VGABytesPerPage); - LeftInSegment = VGABytesPerPage - SegmentOffset; - setPage(curpage); - - video = (char *)(((int32)(ImDest->ImageData)) + SegmentOffset); - - numwholelines = LeftInSegment / ImDest->Width; - numpartiallines = 0; - counterx = LeftInSegment - (numwholelines * ImDest->Width); - - if (counterx >= width) - numwholelines++; - else - numpartiallines = 1; - - while (numwholelines && (countery < height)) { - curdestline = video; - cursourceline = imdata; - - for (counterx = 0; counterx < width; counterx++) { - *video = *imdata; - video++; - imdata++; - } - - video = curdestline; - video += ImDest->Width; - imdata = cursourceline; - imdata += ImSource->Width; - - countery ++; - numwholelines --; - LeftInSegment -= ImDest->Width; - } - - if (numpartiallines && (countery < height)) { - countery ++; - curdestline = video; - cursourceline = imdata; - - for (counterx = 0; counterx < width; counterx++) { - if (LeftInSegment == 0L) { - setPage(curpage + 1); - LeftInSegment = VGABytesPerPage; - video = ImDest->ImageData; - } - - *video = *imdata; - video++; - imdata++; - LeftInSegment--; - } - - video = curdestline; - video += ImDest->Width; - imdata = cursourceline; - imdata += ImSource->Width; - } - } - -#endif } - byte *TempScrollData; - /*****************************************************************************/ /* Scrolls the display in the x direction by blitting. */ /* The TempScrollData variable must be initialized to some memory, or this */ @@ -883,10 +579,6 @@ void scrollDisplayX(int16 dx, uint16 x1, uint16 y1, uint16 x2, uint16 y2) { } } - - - - /*****************************************************************************/ /* Scrolls the display in the y direction by blitting. */ /*****************************************************************************/ @@ -929,8 +621,6 @@ void scrollDisplayY(int16 dy, uint16 x1, uint16 y1, uint16 x2, uint16 y2) { } } - - static unsigned char curapen = 0; /*****************************************************************************/ @@ -940,14 +630,10 @@ void setAPen(uint16 pennum) { curapen = (unsigned char)pennum; } - - - /*****************************************************************************/ /* Fills in a rectangle. */ /*****************************************************************************/ void rectFill(uint16 x1, uint16 y1, uint16 x2, uint16 y2) { -#if !defined(DOSCODE) int dx, dy, w, h; dx = x1; @@ -987,74 +673,8 @@ void rectFill(uint16 x1, uint16 y1, uint16 x2, uint16 y2) { ungetVGABaseAddr(); } - -#else - uint32 RealOffset, - SegmentOffset, - LeftInSegment; - char *video, - *curline; - uint16 counterx, - countery = y1, - numwholelines, - numpartiallines, - curpage; - - while (countery <= y2) { - RealOffset = (VGAScreenWidth * countery) + x1; - curpage = RealOffset / VGABytesPerPage; - SegmentOffset = RealOffset - (curpage * VGABytesPerPage); - LeftInSegment = VGABytesPerPage - SegmentOffset; - setPage(curpage); - video = (char *)(((int32)(VGABASEADDRESS)) + SegmentOffset); - - numwholelines = LeftInSegment / VGAScreenWidth; - numpartiallines = 0; - counterx = LeftInSegment - (numwholelines * VGAScreenWidth); - - if (counterx >= (x2 - x1 + 1)) - numwholelines++; - else - numpartiallines = 1; - - while (numwholelines && (countery <= y2)) { - curline = video; - - for (counterx = x1; counterx <= x2; counterx++) { - *video = curapen; - video++; - } - - video = curline; - video += VGAScreenWidth; - countery ++; - numwholelines --; - LeftInSegment -= VGAScreenWidth; - } - - if (numpartiallines && (countery <= y2)) { - countery ++; - curline = video; - - for (counterx = x1; counterx <= x2; counterx++) { - if (LeftInSegment == 0L) { - setPage(curpage + 1); - LeftInSegment = VGABytesPerPage; - video = (char *)(VGABASEADDRESS); - } - - *video = curapen; - video++; - LeftInSegment--; - } - } - } - -#endif } - - /*****************************************************************************/ /* Draws a horizontal line. */ /*****************************************************************************/ @@ -1062,9 +682,6 @@ void drawVLine(uint16 x, uint16 y1, uint16 y2) { rectFill(x, y1, x, y2); } - - - /*****************************************************************************/ /* Draws a vertical line. */ /*****************************************************************************/ @@ -1072,14 +689,10 @@ void drawHLine(uint16 x1, uint16 y, uint16 x2) { rectFill(x1, y, x2, y); } - - - /*****************************************************************************/ /* Ghoasts a region on the screen using the desired pen color. */ /*****************************************************************************/ void ghoastRect(uint16 pencolor, uint16 x1, uint16 y1, uint16 x2, uint16 y2) { -#if !defined(DOSCODE) int dx, dy, w, h; dx = x1; @@ -1127,85 +740,6 @@ void ghoastRect(uint16 pencolor, uint16 x1, uint16 y1, uint16 x2, uint16 y2) { ungetVGABaseAddr(); } - -#else - uint32 RealOffset, - SegmentOffset; - int32 LeftInSegment; - char *video, - *curline; - uint16 counterx, - countery = y1, - numwholelines, - numpartiallines, - curpage; - - while (countery <= y2) { - RealOffset = (VGAScreenWidth * countery) + x1; - curpage = RealOffset / VGABytesPerPage; - SegmentOffset = RealOffset - (curpage * VGABytesPerPage); - LeftInSegment = VGABytesPerPage - SegmentOffset; - setPage(curpage); - video = (char *)(((int32)(VGABASEADDRESS)) + SegmentOffset); - - numwholelines = LeftInSegment / VGAScreenWidth; - numpartiallines = 0; - counterx = LeftInSegment - (numwholelines * VGAScreenWidth); - - if (counterx >= (x2 - x1 + 1)) - numwholelines++; - else - numpartiallines = 1; - - while (numwholelines && (countery <= y2)) { - curline = video; - counterx = x1; - - if (1 & countery) { - video++; - counterx ++; - } - - while (counterx <= x2) { - *video = pencolor; - video += 2; - counterx += 2; - } - - video = curline; - video += VGAScreenWidth; - countery ++; - numwholelines --; - LeftInSegment -= VGAScreenWidth; - } - - if (numpartiallines && (countery <= y2)) { - countery ++; - curline = video; - counterx = x1; - - if (1 & countery) { - video++; - counterx ++; - LeftInSegment --; - } - - while (counterx < x2) { - if (LeftInSegment <= 0L) { - setPage(curpage + 1); - video = (char *)(((int32)(VGABASEADDRESS)) - LeftInSegment); - LeftInSegment = VGABytesPerPage + LeftInSegment; - } - - *video = pencolor; - video += 2; - counterx += 2; - LeftInSegment -= 2; - } - } - } - -#endif } } // End of namespace Lab diff --git a/engines/lab/vga.h b/engines/lab/vga.h index 8c1d3729a2..fe6b9f07a7 100644 --- a/engines/lab/vga.h +++ b/engines/lab/vga.h @@ -59,9 +59,7 @@ void quickWaitTOF(void); byte *getVGABaseAddr(void); -#if !defined(DOSCODE) void ungetVGABaseAddr(); -#endif void writeColorReg(byte *buf, uint16 regnum); -- cgit v1.2.3 From b8da3f2bc2fe63357a6d73a78e82dafebecc140e Mon Sep 17 00:00:00 2001 From: Eugene Sandulenko Date: Sun, 28 Dec 2014 12:03:12 +0100 Subject: LAB: Final fix for game variant detection --- engines/lab/detection.cpp | 38 ++++++++++++-------------------------- 1 file changed, 12 insertions(+), 26 deletions(-) diff --git a/engines/lab/detection.cpp b/engines/lab/detection.cpp index 1cd78a16db..c6a0d74493 100644 --- a/engines/lab/detection.cpp +++ b/engines/lab/detection.cpp @@ -45,9 +45,9 @@ static const ADGameDescription labDescriptions[] = { "lab", "", { - { "doors", 0, "d77536010e7e5ae17ee066323ceb9585", 2537 }, - { "notes11", 0, "63e873f659f8f46f9809d16a2bf653c7", 3562 }, - { "noteold.fon", 0, "6c1d90ad55149556e79d3f7bfddb4bd7", 9252 }, + { "doors", 0, "d77536010e7e5ae17ee066323ceb9585", 2537 }, // game/doors + { "notes11", 0, "63e873f659f8f46f9809d16a2bf653c7", 3562 }, // fonts/notes11 + { "noteold.fon", 0, "6c1d90ad55149556e79d3f7bfddb4bd7", 9252 }, // game/spict/noteold.fon { NULL, 0, NULL, 0 } }, Common::EN_ANY, @@ -59,9 +59,9 @@ static const ADGameDescription labDescriptions[] = { "lab", "Lowres", { - { "doors", 0, "d77536010e7e5ae17ee066323ceb9585", 2537 }, - { "notes11", 0, "63e873f659f8f46f9809d16a2bf653c7", 3562 }, - { "64b", 0, "3a84d41bcc6a782f22e8e954bce09721", 39916 }, + { "doors", 0, "d77536010e7e5ae17ee066323ceb9585", 2537 }, // game/doors + { "notes11", 0, "63e873f659f8f46f9809d16a2bf653c7", 3562 }, // fonts/notes11 + { "64b", 0, "3a84d41bcc6a782f22e8e954bce09721", 39916 }, // game/pict/h2/64b { NULL, 0, NULL, 0 } }, Common::EN_ANY, @@ -73,10 +73,10 @@ static const ADGameDescription labDescriptions[] = { "lab", "Rerelease", { - { "doors", 0, "d77536010e7e5ae17ee066323ceb9585", 2537 }, - { "notes11", 0, "63e873f659f8f46f9809d16a2bf653c7", 3562 }, - { "inv", 0, "0a5377f0673454b1743322471892ad43", 39120 }, - { "48", 0, "fb2d990c5fb5dd36a618e5ca8136b740", 892 }, + { "doors", 0, "d77536010e7e5ae17ee066323ceb9585", 2537 }, // game/doors + { "notes11", 0, "63e873f659f8f46f9809d16a2bf653c7", 3562 }, // fonts/notes11 + { "noteold.fon", 0, "6c1d90ad55149556e79d3f7bfddb4bd7", 9252 }, // game/spict/noteold.fon + { "wyrmkeep",0, "97c7064c54c28b952d37c4ebff6efa50", 52286 }, // game/spict/intro { NULL, 0, NULL, 0 } }, Common::EN_ANY, @@ -84,25 +84,10 @@ static const ADGameDescription labDescriptions[] = { ADGF_NO_FLAGS, GUIO0() }, - { - "lab", - "Trial", - { - { "doors", 0, "d77536010e7e5ae17ee066323ceb9585", 2537 }, - { "notes11", 0, "63e873f659f8f46f9809d16a2bf653c7", 3562 }, - { "inv", 0, "0a5377f0673454b1743322471892ad43", 39120 }, - { "48", 0, "a319ba9bab20b24200257e826b5494e1", 892 }, - { NULL, 0, NULL, 0 } - }, - Common::EN_ANY, - Common::kPlatformWindows, - ADGF_DEMO, - GUIO0() - }, { "lab", "", - AD_ENTRY1s("doors", "7bf458df6ec30cc8ef4665e4d7c77f59", 2537), + AD_ENTRY1s("doors", "7bf458df6ec30cc8ef4665e4d7c77f59", 2537), // game/doors Common::EN_ANY, Common::kPlatformAmiga, ADGF_NO_FLAGS, @@ -118,6 +103,7 @@ static const char *const directoryGlobs[] = { "spict", "rooms", "h2", + "intro", 0 }; -- cgit v1.2.3 From 500bb493f6011ef2a5ee26711600c952d1f46583 Mon Sep 17 00:00:00 2001 From: Eugene Sandulenko Date: Sun, 28 Dec 2014 16:53:41 +0100 Subject: LAB: Fix regression --- engines/lab/engine.cpp | 2 +- engines/lab/labfile.cpp | 5 ----- 2 files changed, 1 insertion(+), 6 deletions(-) diff --git a/engines/lab/engine.cpp b/engines/lab/engine.cpp index 6f4f4e54b8..01fd7b9ef0 100644 --- a/engines/lab/engine.cpp +++ b/engines/lab/engine.cpp @@ -275,7 +275,7 @@ bool setUpScreens(void) { /* Creates the gadgets for the movement control panel */ y = VGAScaleY(173) - SVGACord(2); - if (g_lab->getPlatform() != Common::kPlatformWindows) { + if (g_lab->getPlatform() == Common::kPlatformWindows) { MoveGadgetList = createButton(VGAScaleX(1), y, 0, 't', MoveImages[0], MoveImages[1]); curgad = MoveGadgetList; curgad->NextGadget = createButton(VGAScaleX(33), y, 1, 'm', MoveImages[2], MoveImages[3]); diff --git a/engines/lab/labfile.cpp b/engines/lab/labfile.cpp index 01f1ffabc0..63cc62652f 100644 --- a/engines/lab/labfile.cpp +++ b/engines/lab/labfile.cpp @@ -48,11 +48,6 @@ static uint32 buffersize, realbuffersize; uint32 ReadSoFar; bool ReadIsError, ReadIsDone; - -#if defined(WIN32) -#define stat _stat -#endif - /*****************************************************************************/ /* Returns the size of a file. */ /*****************************************************************************/ -- cgit v1.2.3 From 9a116c57e1b7a04d2f48c685847c4e8629ffc3c6 Mon Sep 17 00:00:00 2001 From: Eugene Sandulenko Date: Mon, 29 Dec 2014 00:03:58 +0100 Subject: LAB: Use OSystem for mouse drawing --- engines/lab/mouse.cpp | 89 +++++++-------------------------------------------- 1 file changed, 11 insertions(+), 78 deletions(-) diff --git a/engines/lab/mouse.cpp b/engines/lab/mouse.cpp index e68ce6ffa5..fcb8882071 100644 --- a/engines/lab/mouse.cpp +++ b/engines/lab/mouse.cpp @@ -69,10 +69,6 @@ static byte MouseData[] = {1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 0, 0}; -static Image MouseImage, BackImage; -static byte BackImageBuffer[256]; -static uint16 backx, backy; - static bool drawmouse = false, gadhit = false; static Gadget *hitgad = NULL; @@ -128,43 +124,6 @@ void attachGadgetList(Gadget *GadList) { ScreenGadgetList = GadList; } - - - -static void drawMouse(void) { - if (BackImage.ImageData) { - if (backx <= VGAScreenWidth - BackImage.Width && backy <= VGAScreenHeight - BackImage.Height) - drawMaskImage(&MouseImage, backx, backy); - } else { - if (CurMouseX <= VGAScreenWidth - MouseImage.Width && CurMouseY <= VGAScreenHeight - MouseImage.Height) - drawMaskImage(&MouseImage, CurMouseX, CurMouseY); - } -} - - - -static void getBackMouse(void) { - BackImage.Width = MouseImage.Width; - BackImage.Height = MouseImage.Height; - BackImage.ImageData = BackImageBuffer; - - backx = CurMouseX; - backy = CurMouseY; - - if (backx <= VGAScreenWidth - BackImage.Width && backy <= VGAScreenHeight - BackImage.Height) - readScreenImage(&BackImage, backx, backy); -} - -static void restoreBackMouse(void) { - if (BackImage.ImageData) { - if (backx <= VGAScreenWidth - BackImage.Width && backy <= VGAScreenHeight - BackImage.Height) - drawImage(&BackImage, backx, backy); - - BackImage.ImageData = NULL; - } -} - - static Gadget *TempGad; @@ -179,12 +138,6 @@ void mouse_handler(int32 max, int32 mcx, int32 mdx) { if (IsHiRes && !QuitMouseHandler) { drawmouse = true; - } else if (!MouseHidden && !QuitMouseHandler) { - VGAStorePage(); - restoreBackMouse(); - getBackMouse(); - drawMouse(); - VGARestorePage(); } } } @@ -221,9 +174,6 @@ void updateMouse(void) { if (drawmouse && !MouseHidden) { QuitMouseHandler = true; drawmouse = false; - restoreBackMouse(); - getBackMouse(); - drawMouse(); QuitMouseHandler = false; doUpdateDisplay = true; } @@ -256,10 +206,8 @@ void updateMouse(void) { /* Initializes the mouse. */ /*****************************************************************************/ bool initMouse(void) { - BackImage.ImageData = NULL; - MouseImage.ImageData = MouseData; - MouseImage.Width = MouseImageWidth; - MouseImage.Height = MouseImageHeight; + g_system->setMouseCursor(MouseData, MouseImageWidth, MouseImageHeight, 0, 0, 0); + g_system->showMouse(false); mouseMove(0, 0); @@ -281,11 +229,7 @@ bool mouseReset(void) { /* Shows the mouse. */ /*****************************************************************************/ void mouseShow(void) { - QuitMouseHandler = true; - VGAStorePage(); - mouseShowXY(CurMouseX, CurMouseY); - VGARestorePage(); - QuitMouseHandler = false; + g_system->showMouse(true); } @@ -304,9 +248,6 @@ void mouseShowXY(uint16 MouseX, uint16 MouseY) { if ((NumHidden == 0) && MouseHidden) { CurMouseX = MouseX; CurMouseY = MouseY; - getBackMouse(); - drawMouse(); - WSDL_UpdateScreen(); MouseHidden = false; } @@ -325,9 +266,8 @@ void mouseHide(void) { if (NumHidden && !MouseHidden) { MouseHidden = true; - VGAStorePage(); - restoreBackMouse(); - VGARestorePage(); + + g_system->showMouse(false); } QuitMouseHandler = false; @@ -346,7 +286,8 @@ void mouseHideXY(void) { if (NumHidden && !MouseHidden) { MouseHidden = true; - restoreBackMouse(); + + g_system->showMouse(false); } QuitMouseHandler = false; @@ -354,18 +295,16 @@ void mouseHideXY(void) { - +extern int g_MouseX; +extern int g_MouseY; /*****************************************************************************/ /* Gets the current mouse co-ordinates. NOTE: On IBM version, will scale */ /* from virtual to screen co-ordinates automatically. */ /*****************************************************************************/ void mouseXY(uint16 *x, uint16 *y) { - int xx = 0, yy = 0; - //SDL_GetMousePos(&xx, &yy); - warning("STUB: mouseXY"); - *x = (uint16)xx; - *y = (uint16)yy; + *x = (uint16)g_MouseX; + *y = (uint16)g_MouseY; if (!IsHiRes) (*x) /= 2; @@ -386,12 +325,6 @@ void mouseMove(uint16 x, uint16 y) { if (!MouseHidden) { QuitMouseHandler = true; mouseXY(&CurMouseX, &CurMouseY); - VGAStorePage(); - restoreBackMouse(); - getBackMouse(); - drawMouse(); - VGARestorePage(); - WSDL_UpdateScreen(); QuitMouseHandler = false; } } -- cgit v1.2.3 From 80e00c1f54a0d5747156ada22b6daafbf252e833 Mon Sep 17 00:00:00 2001 From: Eugene Sandulenko Date: Mon, 29 Dec 2014 00:19:56 +0100 Subject: LAB: Fix regression --- engines/lab/mouse.cpp | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/engines/lab/mouse.cpp b/engines/lab/mouse.cpp index fcb8882071..21f0f3d641 100644 --- a/engines/lab/mouse.cpp +++ b/engines/lab/mouse.cpp @@ -229,6 +229,8 @@ bool mouseReset(void) { /* Shows the mouse. */ /*****************************************************************************/ void mouseShow(void) { + mouseShowXY(CurMouseX, CurMouseY); + g_system->showMouse(true); } @@ -248,6 +250,7 @@ void mouseShowXY(uint16 MouseX, uint16 MouseY) { if ((NumHidden == 0) && MouseHidden) { CurMouseX = MouseX; CurMouseY = MouseY; + WSDL_ProcessInput(0); MouseHidden = false; } @@ -325,6 +328,7 @@ void mouseMove(uint16 x, uint16 y) { if (!MouseHidden) { QuitMouseHandler = true; mouseXY(&CurMouseX, &CurMouseY); + WSDL_ProcessInput(0); QuitMouseHandler = false; } } -- cgit v1.2.3 From f9d90934f6e281f40b52ad561d339f26d7d9c0e9 Mon Sep 17 00:00:00 2001 From: Filippos Karapetis Date: Tue, 17 Feb 2015 11:17:59 +0200 Subject: LAB: Fix signed/unsigned comparison warnings --- engines/lab/graphics.cpp | 4 ++-- engines/lab/labfile.cpp | 2 +- engines/lab/labfun.h | 4 ++-- engines/lab/mouse.cpp | 4 ++-- engines/lab/vga.cpp | 4 ++-- 5 files changed, 9 insertions(+), 9 deletions(-) diff --git a/engines/lab/graphics.cpp b/engines/lab/graphics.cpp index 3d91fd4197..2a43dfe064 100644 --- a/engines/lab/graphics.cpp +++ b/engines/lab/graphics.cpp @@ -242,7 +242,7 @@ static void getLine(TextFont *tf, char *LineBuffer, const char **MainBuffer, uin /* each line less than 255 characters. */ /******************************************************************************/ uint32 flowText(void *font, /* the TextAttr pointer */ - uint16 spacing, /* How much vertical spacing between the lines */ + int16 spacing, /* How much vertical spacing between the lines */ uint16 pencolor, /* pen number to use for text */ uint16 backpen, /* the background color */ bool fillback, /* Whether to fill the background */ @@ -314,7 +314,7 @@ extern byte *VGABASEADDRESS; /* Calls flowText, but flows it to memory. Same restrictions as flowText. */ /******************************************************************************/ uint32 flowTextToMem(Image *DestIm, void *font, /* the TextAttr pointer */ - uint16 spacing, /* How much vertical spacing between the lines */ + int16 spacing, /* How much vertical spacing between the lines */ uint16 pencolor, /* pen number to use for text */ uint16 backpen, /* the background color */ bool fillback, /* Whether to fill the background */ diff --git a/engines/lab/labfile.cpp b/engines/lab/labfile.cpp index 63cc62652f..2f9355444f 100644 --- a/engines/lab/labfile.cpp +++ b/engines/lab/labfile.cpp @@ -45,7 +45,7 @@ static byte *buffer = NULL, *realbufferstart = NULL, *startoffilestorage = NULL; byte **startoffile = &startoffilestorage; static uint32 buffersize, realbuffersize; -uint32 ReadSoFar; +int32 ReadSoFar; bool ReadIsError, ReadIsDone; /*****************************************************************************/ diff --git a/engines/lab/labfun.h b/engines/lab/labfun.h index 6f304d0f9b..bb2ddf81e6 100644 --- a/engines/lab/labfun.h +++ b/engines/lab/labfun.h @@ -92,7 +92,7 @@ byte *readPictToMem(const char *filename, uint16 x, uint16 y); /* Window text stuff */ uint32 flowText(void *font, /* the TextAttr pointer */ - uint16 spacing, /* How much vertical spacing between the lines */ + int16 spacing, /* How much vertical spacing between the lines */ uint16 pencolor, /* pen number to use for text */ uint16 backpen, /* the background color */ bool fillback, /* Whether to fill the background */ @@ -103,7 +103,7 @@ uint32 flowText(void *font, /* the TextAttr pointer */ uint16 y1, uint16 x2, uint16 y2, const char *text); /* The text itself */ uint32 flowTextToMem(Image *DestIm, void *font, /* the TextAttr pointer */ - uint16 spacing, /* How much vertical spacing between the lines */ + int16 spacing, /* How much vertical spacing between the lines */ uint16 pencolor, /* pen number to use for text */ uint16 backpen, /* the background color */ bool fillback, /* Whether to fill the background */ diff --git a/engines/lab/mouse.cpp b/engines/lab/mouse.cpp index 21f0f3d641..1b00c15146 100644 --- a/engines/lab/mouse.cpp +++ b/engines/lab/mouse.cpp @@ -298,8 +298,8 @@ void mouseHideXY(void) { -extern int g_MouseX; -extern int g_MouseY; +extern uint32 g_MouseX; +extern uint32 g_MouseY; /*****************************************************************************/ /* Gets the current mouse co-ordinates. NOTE: On IBM version, will scale */ diff --git a/engines/lab/vga.cpp b/engines/lab/vga.cpp index d2fa002e16..11713da130 100644 --- a/engines/lab/vga.cpp +++ b/engines/lab/vga.cpp @@ -54,8 +54,8 @@ int g_ScreenWasLocked = 0; int g_IgnoreUpdateDisplay = 0; int g_LastWaitTOFTicks = 0; -int g_MouseX = 0; -int g_MouseY = 0; +uint32 g_MouseX = 0; +uint32 g_MouseY = 0; uint16 g_NextKeyIn = 0; uint16 g_KeyBuf[64]; -- cgit v1.2.3 From 28bbcf5641d8d505b07bcc121c8b129f9fb1de43 Mon Sep 17 00:00:00 2001 From: Filippos Karapetis Date: Tue, 17 Feb 2015 11:19:32 +0200 Subject: LAB: Add missing const qualifiers --- engines/lab/engine.cpp | 4 ++-- engines/lab/map.cpp | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/engines/lab/engine.cpp b/engines/lab/engine.cpp index 01fd7b9ef0..06ac2194f5 100644 --- a/engines/lab/engine.cpp +++ b/engines/lab/engine.cpp @@ -71,8 +71,8 @@ void mayShowCrumbIndicatorOff(); bool Alternate = false, ispal = false, noupdatediff = false, MainDisplay = true, QuitLab = false, DoNotReset = false; -extern char *NewFileName; /* When ProcessRoom.c decides to change the filename - of the current picture. */ +extern const char *NewFileName; /* When ProcessRoom.c decides to change the filename + of the current picture. */ extern char *LAMPONMSG, *TURNLEFT, *TURNRIGHT; extern char *GOFORWARDDIR, *NOPATH, *TAKEITEM, *USEONWHAT, *TAKEWHAT, *MOVEWHAT, *OPENWHAT, *CLOSEWHAT, *LOOKWHAT, *NOTHING, *USEMAP, *USEJOURNAL, *TURNLAMPON, *TURNLAMPOFF, *USEWHISKEY, *USEPITH, *USEHELMET; diff --git a/engines/lab/map.cpp b/engines/lab/map.cpp index 95c12bd5d7..77d520de16 100644 --- a/engines/lab/map.cpp +++ b/engines/lab/map.cpp @@ -153,7 +153,7 @@ void readImage(byte **buffer, Image **im) { extern RoomData *Rooms; -extern char *ViewPath; +extern const char *ViewPath; static Image *Map, *Room, *UpArrowRoom, *DownArrowRoom, *Bridge, *HRoom, *VRoom, *Maze, *HugeMaze, *Path, *MapNorth, -- cgit v1.2.3 From d70819fa6751ad37170b4cbc13cc6106ad1bb8d4 Mon Sep 17 00:00:00 2001 From: Filippos Karapetis Date: Tue, 17 Feb 2015 11:20:14 +0200 Subject: LAB: Silence false positives about uninitialized variables --- engines/lab/engine.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/engines/lab/engine.cpp b/engines/lab/engine.cpp index 06ac2194f5..ec9ae2882d 100644 --- a/engines/lab/engine.cpp +++ b/engines/lab/engine.cpp @@ -715,12 +715,12 @@ static void process(void) { IntuiMessage *Msg; uint32 Class; - uint16 Code, Qualifier, MouseX, MouseY, ActionMode = 4; + uint16 Code = 0, Qualifier, MouseX, MouseY, ActionMode = 4; uint16 CurInv = MAPNUM, LastInv = MAPNUM, Old; bool ForceDraw = false, doit, GotMessage = true; - uint16 OldRoomNum, OldDirection, GadID, NewDir; + uint16 OldRoomNum, OldDirection = 0, GadID = 0, NewDir; CloseDataPtr OldCPtr, TempCPtr, HCPtr = NULL; ViewDataPtr VPtr; -- cgit v1.2.3 From 7f80a4ff63f5314d3f9b13d124c279e18ca06d73 Mon Sep 17 00:00:00 2001 From: Filippos Karapetis Date: Tue, 17 Feb 2015 11:22:12 +0200 Subject: LAB: Change the "action" parameter of doActionRule to lowercase This avoids a name clash with the Action struct --- engines/lab/parsefun.h | 2 +- engines/lab/processroom.cpp | 18 +++++++++--------- 2 files changed, 10 insertions(+), 10 deletions(-) diff --git a/engines/lab/parsefun.h b/engines/lab/parsefun.h index e6794ee8eb..2c48311090 100644 --- a/engines/lab/parsefun.h +++ b/engines/lab/parsefun.h @@ -77,7 +77,7 @@ void setCurClose(uint16 x, uint16 y, CloseDataPtr *cptr); bool takeItem(uint16 x, uint16 y, CloseDataPtr *cptr); -bool doActionRule(int16 x, int16 y, int16 Action, int16 RoomNum, CloseDataPtr *LCPtr); +bool doActionRule(int16 x, int16 y, int16 action, int16 RoomNum, CloseDataPtr *LCPtr); bool doOperateRule(int16 x, int16 y, int16 ItemNum, CloseDataPtr *LCPtr); diff --git a/engines/lab/processroom.cpp b/engines/lab/processroom.cpp index 5699c63880..70eac05cc7 100644 --- a/engines/lab/processroom.cpp +++ b/engines/lab/processroom.cpp @@ -716,10 +716,10 @@ static void doActions(ActionPtr APtr, CloseDataPtr *LCPtr) { /*****************************************************************************/ /* Does the work for doActionRule. */ /*****************************************************************************/ -static bool doActionRuleSub(int16 Action, int16 roomNum, CloseDataPtr LCPtr, CloseDataPtr *Set, bool AllowDefaults) { +static bool doActionRuleSub(int16 action, int16 roomNum, CloseDataPtr LCPtr, CloseDataPtr *Set, bool AllowDefaults) { RulePtr RPtr; - Action++; + action++; if (LCPtr) { RPtr = Rooms[roomNum].RuleList; @@ -732,11 +732,11 @@ static bool doActionRuleSub(int16 Action, int16 roomNum, CloseDataPtr LCPtr, Clo while (RPtr) { if ((RPtr->RuleType == ACTION) && - ((RPtr->Param1 == Action) || ((RPtr->Param1 == 0) && AllowDefaults))) { + ((RPtr->Param1 == action) || ((RPtr->Param1 == 0) && AllowDefaults))) { if (((RPtr->Param2 == LCPtr->CloseUpType) || ((RPtr->Param2 == 0) && AllowDefaults)) || - ((Action == 1) && (RPtr->Param2 == (-LCPtr->CloseUpType)))) { + ((action == 1) && (RPtr->Param2 == (-LCPtr->CloseUpType)))) { if (checkConditions(RPtr->Condition)) { doActions(RPtr->ActionList, Set); return true; @@ -754,7 +754,7 @@ static bool doActionRuleSub(int16 Action, int16 roomNum, CloseDataPtr LCPtr, Clo /*****************************************************************************/ /* Goes through the rules if an action is taken. */ /*****************************************************************************/ -bool doActionRule(int16 x, int16 y, int16 Action, int16 roomNum, CloseDataPtr *LCPtr) { +bool doActionRule(int16 x, int16 y, int16 action, int16 roomNum, CloseDataPtr *LCPtr) { CloseDataPtr TLCPtr; if (roomNum) @@ -764,13 +764,13 @@ bool doActionRule(int16 x, int16 y, int16 Action, int16 roomNum, CloseDataPtr *L TLCPtr = getObject(x, y, *LCPtr); - if (doActionRuleSub(Action, roomNum, TLCPtr, LCPtr, false)) + if (doActionRuleSub(action, roomNum, TLCPtr, LCPtr, false)) return true; - else if (doActionRuleSub(Action, roomNum, *LCPtr, LCPtr, false)) + else if (doActionRuleSub(action, roomNum, *LCPtr, LCPtr, false)) return true; - else if (doActionRuleSub(Action, roomNum, TLCPtr, LCPtr, true)) + else if (doActionRuleSub(action, roomNum, TLCPtr, LCPtr, true)) return true; - else if (doActionRuleSub(Action, roomNum, *LCPtr, LCPtr, true)) + else if (doActionRuleSub(action, roomNum, *LCPtr, LCPtr, true)) return true; return false; -- cgit v1.2.3 From 4f185f7dd6f82c86ab9b66fc10209fa966654806 Mon Sep 17 00:00:00 2001 From: Filippos Karapetis Date: Tue, 17 Feb 2015 11:23:22 +0200 Subject: LAB: Further fixes to signed/unsigned comparisons and bool assignments --- engines/lab/special.cpp | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/engines/lab/special.cpp b/engines/lab/special.cpp index 038f8b88b6..abdbc735d3 100644 --- a/engines/lab/special.cpp +++ b/engines/lab/special.cpp @@ -126,7 +126,7 @@ static void doCombination(void) { } -extern char *TempScrollData; +extern byte *TempScrollData; /*****************************************************************************/ /* Reads in a backdrop picture. */ @@ -245,7 +245,7 @@ void mouseCombination(uint16 x, uint16 y) { /*----------------------------------------------------------------------------*/ Image *Tiles[16]; -int16 CurTile[4] [4] = { +uint16 CurTile[4] [4] = { { 1, 5, 9, 13 }, { 2, 6, 10, 14 }, { 3, 7, 11, 15 }, @@ -1338,7 +1338,7 @@ static bool processSaveLoad() { if (((Class == MOUSEBUTTONS) && (IEQUALIFIER_RBUTTON & Qualifier)) || ((Class == RAWKEY) && (Code == 27))) - return -1; + return true; if (Class == RAWKEY) { if (Code == 'l' || Code == 'L') { @@ -1422,7 +1422,7 @@ static bool processSaveLoad() { break; case ID_CANCEL: - return -1; + return true; } } } -- cgit v1.2.3 From f9b4b43e9087e485d51c4be0972b911792fcd2ee Mon Sep 17 00:00:00 2001 From: Filippos Karapetis Date: Tue, 17 Feb 2015 11:48:53 +0200 Subject: LAB: Remove multiple mouse coordinate variables There is no real point in holding multiple location variables for the mouse cursor. One set of coordinates should be enough --- engines/lab/mouse.cpp | 41 ++++++++++++++++++++--------------------- engines/lab/mouse.h | 2 +- 2 files changed, 21 insertions(+), 22 deletions(-) diff --git a/engines/lab/mouse.cpp b/engines/lab/mouse.cpp index 1b00c15146..30c0658b24 100644 --- a/engines/lab/mouse.cpp +++ b/engines/lab/mouse.cpp @@ -42,14 +42,11 @@ extern uint32 VGAScreenWidth, VGAScreenHeight; void mouseHideXY(void); static bool LeftClick = false; -static uint16 leftx = 0, lefty = 0; static bool RightClick = false; -static uint16 rightx = 0, righty = 0; static bool MouseHidden = true, QuitMouseHandler = false; static int32 NumHidden = 1; static uint16 CurMouseX, CurMouseY; -static uint16 MouseImageWidth = 10, MouseImageHeight = 15; static Gadget *LastGadgetHit = NULL; Gadget *ScreenGadgetList = NULL; static byte MouseData[] = {1, 1, 0, 0, 0, 0, 0, 0, 0, 0, @@ -68,6 +65,8 @@ static byte MouseData[] = {1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 7, 7, 1, 0, 0, 0, 0, 0, 0, 0, 1, 1, 0, 0}; +#define MOUSE_WIDTH 10 +#define MOUSE_HEIGHT 15 static bool drawmouse = false, gadhit = false; static Gadget *hitgad = NULL; @@ -127,14 +126,14 @@ void attachGadgetList(Gadget *GadList) { static Gadget *TempGad; -void mouse_handler(int32 max, int32 mcx, int32 mdx) { +void mouse_handler(int32 flag, int32 mouseX, int32 mouseY) { if (!IsHiRes) - mcx /= 2; + mouseX /= 2; - if (max & 0x01) { /* mouse Move */ - if ((CurMouseX != mcx) || (CurMouseY != mdx)) { - CurMouseX = mcx; - CurMouseY = mdx; + if (flag & 0x01) { /* mouse Move */ + if ((CurMouseX != mouseX) || (CurMouseY != mouseY)) { + CurMouseX = mouseX; + CurMouseY = mouseY; if (IsHiRes && !QuitMouseHandler) { drawmouse = true; @@ -142,9 +141,9 @@ void mouse_handler(int32 max, int32 mcx, int32 mdx) { } } - if ((max & 0x02) && (NumHidden < 2)) { /* Left mouse button click */ + if ((flag & 0x02) && (NumHidden < 2)) { /* Left mouse button click */ if (ScreenGadgetList) - TempGad = checkGadgetHit(ScreenGadgetList, mcx, mdx); + TempGad = checkGadgetHit(ScreenGadgetList, mouseX, mouseY); else TempGad = NULL; @@ -152,15 +151,15 @@ void mouse_handler(int32 max, int32 mcx, int32 mdx) { LastGadgetHit = TempGad; } else { LeftClick = true; - leftx = mcx; - lefty = mdx; + CurMouseX = mouseX; + CurMouseY = mouseY; } } - if ((max & 0x08) && (NumHidden < 2)) { /* Right mouse button click */ + if ((flag & 0x08) && (NumHidden < 2)) { /* Right mouse button click */ RightClick = true; - rightx = mcx; - righty = mdx; + CurMouseX = mouseX; + CurMouseY = mouseY; } } @@ -206,7 +205,7 @@ void updateMouse(void) { /* Initializes the mouse. */ /*****************************************************************************/ bool initMouse(void) { - g_system->setMouseCursor(MouseData, MouseImageWidth, MouseImageHeight, 0, 0, 0); + g_system->setMouseCursor(MouseData, MOUSE_WIDTH, MOUSE_HEIGHT, 0, 0, 0); g_system->showMouse(false); mouseMove(0, 0); @@ -344,15 +343,15 @@ void mouseMove(uint16 x, uint16 y) { bool mouseButton(uint16 *x, uint16 *y, bool leftbutton) { if (leftbutton) { if (LeftClick) { - *x = leftx; - *y = lefty; + *x = CurMouseX; + *y = CurMouseY; LeftClick = false; return true; } } else { if (RightClick) { - *x = rightx; - *y = righty; + *x = CurMouseX; + *y = CurMouseY; RightClick = false; return true; } diff --git a/engines/lab/mouse.h b/engines/lab/mouse.h index 8a9a3b75ae..8ea9056f81 100644 --- a/engines/lab/mouse.h +++ b/engines/lab/mouse.h @@ -57,7 +57,7 @@ Gadget *mouseGadget(void); void attachGadgetList(Gadget *GadList); -void mouse_handler(int32 max, int32 mcx, int32 mdx); +void mouse_handler(int32 flag, int32 mouseX, int32 mouseY); } // End of namespace Lab -- cgit v1.2.3 From 7ddbc55251380cee95d25ce7a25788af069d4cab Mon Sep 17 00:00:00 2001 From: Filippos Karapetis Date: Tue, 17 Feb 2015 11:50:34 +0200 Subject: LAB: Remove unused mouse reset call --- engines/lab/engine.cpp | 1 - engines/lab/mouse.cpp | 8 -------- engines/lab/mouse.h | 2 -- 3 files changed, 11 deletions(-) diff --git a/engines/lab/engine.cpp b/engines/lab/engine.cpp index ec9ae2882d..d242fbec48 100644 --- a/engines/lab/engine.cpp +++ b/engines/lab/engine.cpp @@ -1498,7 +1498,6 @@ void LabEngine::go() { g_music->freeMusic(); freeAudio(); - mouseReset(); setMode((char)OldMode); } diff --git a/engines/lab/mouse.cpp b/engines/lab/mouse.cpp index 30c0658b24..a75a92cfba 100644 --- a/engines/lab/mouse.cpp +++ b/engines/lab/mouse.cpp @@ -215,14 +215,6 @@ bool initMouse(void) { -/*****************************************************************************/ -/* Resets the mouse. */ -/*****************************************************************************/ -bool mouseReset(void) { - return true; -} - - /*****************************************************************************/ /* Shows the mouse. */ diff --git a/engines/lab/mouse.h b/engines/lab/mouse.h index 8ea9056f81..5af582164f 100644 --- a/engines/lab/mouse.h +++ b/engines/lab/mouse.h @@ -39,8 +39,6 @@ struct Gadget; bool initMouse(void); -bool mouseReset(void); - void updateMouse(void); void mouseShow(void); -- cgit v1.2.3 From 35751e0f123338927ea4bfdf6f6311229a25f054 Mon Sep 17 00:00:00 2001 From: Filippos Karapetis Date: Thu, 19 Feb 2015 15:18:57 +0200 Subject: LAB: Implement getCurMemLabFile() --- engines/lab/labfile.cpp | 11 ++++------- 1 file changed, 4 insertions(+), 7 deletions(-) diff --git a/engines/lab/labfile.cpp b/engines/lab/labfile.cpp index 2f9355444f..4cbbd5403e 100644 --- a/engines/lab/labfile.cpp +++ b/engines/lab/labfile.cpp @@ -112,18 +112,15 @@ static void freeFile(uint16 RMarker) { /*****************************************************************************/ /* Gets a chunk of memory from the buffer. */ /*****************************************************************************/ -static void *getCurMem(uint32 size) { +static void *getCurMemLabFile(uint32 size) { void *ptr = 0; - warning ("STUB: getCurMem(%d)", size); - -#if 0 if ((((char *) MemPlace) + size - 1) >= (((char *) buffer) + buffersize)) MemPlace = buffer; ptr = MemPlace; - ((char *)MemPlace) += size; + MemPlace = (char *)MemPlace + size; for (int counter = 0; counter < MAXMARKERS; counter++) { if (FileMarkers[counter].name[0]) { @@ -137,7 +134,7 @@ static void *getCurMem(uint32 size) { freeFile(counter); } } -#endif + return ptr; } @@ -198,7 +195,7 @@ bool allocFile(void **Ptr, uint32 Size, const char *fileName) { freeFile(RMarker); strcpy(FileMarkers[RMarker].name, fileName); - *Ptr = getCurMem(Size); + *Ptr = getCurMemLabFile(Size); FileMarkers[RMarker].Start = *Ptr; FileMarkers[RMarker].End = (void *)(((char *)(*Ptr)) + Size - 1); -- cgit v1.2.3 From 31ef4866a70857d107338e8c462d8456b2dcb643 Mon Sep 17 00:00:00 2001 From: Filippos Karapetis Date: Thu, 19 Feb 2015 15:20:05 +0200 Subject: LAB: Implement generateSaveFileName() --- engines/lab/lab.cpp | 4 ++++ engines/lab/lab.h | 5 +++-- 2 files changed, 7 insertions(+), 2 deletions(-) diff --git a/engines/lab/lab.cpp b/engines/lab/lab.cpp index 16839dad29..1d7c82743e 100644 --- a/engines/lab/lab.cpp +++ b/engines/lab/lab.cpp @@ -72,4 +72,8 @@ Common::Error LabEngine::run() { return Common::kNoError; } +Common::String LabEngine::generateSaveFileName(uint slot) { + return Common::String::format("%s.%03u", _targetName.c_str(), slot); +} + } // End of namespace Lab diff --git a/engines/lab/lab.h b/engines/lab/lab.h index 882541780e..fa5edd6c24 100644 --- a/engines/lab/lab.h +++ b/engines/lab/lab.h @@ -52,12 +52,13 @@ public: virtual Common::Error run(); void go(); - bool hasFeature(EngineFeature f) const; - const ADGameDescription *_gameDescription; Common::Platform getPlatform() const; uint32 getFeatures() const; + bool hasFeature(EngineFeature f) const; + Common::String generateSaveFileName(uint slot); + LargeSet *_conditions, *_roomsFound; }; -- cgit v1.2.3 From ccb3390f09268cf1ee360c74bcaac7dbebe1ae42 Mon Sep 17 00:00:00 2001 From: Filippos Karapetis Date: Thu, 19 Feb 2015 15:21:43 +0200 Subject: LAB: Disable startup warning about hi/low res mode --- engines/lab/engine.cpp | 2 ++ 1 file changed, 2 insertions(+) diff --git a/engines/lab/engine.cpp b/engines/lab/engine.cpp index d242fbec48..9d6e7554a0 100644 --- a/engines/lab/engine.cpp +++ b/engines/lab/engine.cpp @@ -1398,10 +1398,12 @@ void LabEngine::go() { IsHiRes = ((getFeatures() & GF_LOWRES) == 0); +#if 0 if (IsHiRes) warning("Running in HiRes mode"); else warning("Running in LowRes mode"); +#endif #if 0 for (counter = 1; counter < argc; counter++) { -- cgit v1.2.3 From 6af7abeab242b9446a1aeb6725643b40fe078611 Mon Sep 17 00:00:00 2001 From: Filippos Karapetis Date: Thu, 19 Feb 2015 15:22:20 +0200 Subject: LAB: Remove unused variable --- engines/lab/labmusic.cpp | 1 - 1 file changed, 1 deletion(-) diff --git a/engines/lab/labmusic.cpp b/engines/lab/labmusic.cpp index 7e91521fd4..4efbd07722 100644 --- a/engines/lab/labmusic.cpp +++ b/engines/lab/labmusic.cpp @@ -244,7 +244,6 @@ void Music::startMusic(bool startatbegin) { /*****************************************************************************/ bool Music::initMusic(void) { uint16 counter; - bool mem; if (!_turnMusicOn) return true; -- cgit v1.2.3 From 0a71969018bf773cde8092df47f58ecea99f3f79 Mon Sep 17 00:00:00 2001 From: Filippos Karapetis Date: Thu, 19 Feb 2015 15:41:15 +0200 Subject: LAB: Rewrite the save/load system The two different save/load dialogs from the original have been dropped and replaced with the ScummVM save/load dialogs. The whole save/load code has been rewritten to be endian safe and use our common code. The original save format has not been preserved. The current implementation crashes when loading, but it's a good start --- engines/lab/detection.cpp | 110 ++ engines/lab/engine.cpp | 2 - engines/lab/lab.cpp | 4 - engines/lab/labfun.h | 19 +- engines/lab/modernsavegame.cpp | 124 -- engines/lab/modernsavegame.h | 55 - engines/lab/module.mk | 2 - engines/lab/savegame.cpp | 376 ++--- engines/lab/savegamepalmap.cpp | 3316 ---------------------------------------- engines/lab/special.cpp | 922 +---------- 10 files changed, 313 insertions(+), 4617 deletions(-) delete mode 100644 engines/lab/modernsavegame.cpp delete mode 100644 engines/lab/modernsavegame.h delete mode 100644 engines/lab/savegamepalmap.cpp diff --git a/engines/lab/detection.cpp b/engines/lab/detection.cpp index c6a0d74493..2b1bb21205 100644 --- a/engines/lab/detection.cpp +++ b/engines/lab/detection.cpp @@ -29,11 +29,17 @@ */ #include "engines/advancedDetector.h" + #include "common/system.h" +#include "common/str-array.h" +#include "common/savefile.h" #include "base/plugins.h" +#include "graphics/surface.h" + #include "lab/lab.h" +#include "lab/labfun.h" static const PlainGameDescriptor lab_setting[] = { { "lab", "Labyrith of Time" }, @@ -143,8 +149,112 @@ public: return true; } + virtual bool hasFeature(MetaEngineFeature f) const; + SaveStateList listSaves(const char *target) const; + virtual int getMaximumSaveSlot() const; + void removeSaveState(const char *target, int slot) const; + SaveStateDescriptor querySaveMetaInfos(const char *target, int slot) const; }; +bool LabMetaEngine::hasFeature(MetaEngineFeature f) const { + return + (f == kSupportsListSaves) || + //(f == kSupportsLoadingDuringStartup) || + (f == kSupportsDeleteSave) || + (f == kSavesSupportMetaInfo) || + (f == kSavesSupportThumbnail) || + (f == kSavesSupportCreationDate) || + (f == kSavesSupportPlayTime); +} + +bool Lab::LabEngine::hasFeature(EngineFeature f) const { + return + (f == kSupportsRTL); + //(f == kSupportsLoadingDuringRuntime) || + //(f == kSupportsSavingDuringRuntime); +} + +SaveStateList LabMetaEngine::listSaves(const char *target) const { + Common::SaveFileManager *saveFileMan = g_system->getSavefileManager(); + Lab::SaveGameHeader header; + Common::String pattern = target; + pattern += ".???"; + + Common::StringArray filenames; + filenames = saveFileMan->listSavefiles(pattern.c_str()); + Common::sort(filenames.begin(), filenames.end()); // Sort (hopefully ensuring we are sorted numerically..)*/ + + SaveStateList saveList; + + for (Common::StringArray::const_iterator file = filenames.begin(); file != filenames.end(); file++) { + // Obtain the last 3 digits of the filename, since they correspond to the save slot + int slotNum = atoi(file->c_str() + file->size() - 3); + + if (slotNum >= 0 && slotNum <= 999) { + Common::InSaveFile *in = saveFileMan->openForLoading(file->c_str()); + if (in) { + if (Lab::readSaveGameHeader(in, header)) + saveList.push_back(SaveStateDescriptor(slotNum, header.desc.getDescription())); + delete in; + } + } + } + + return saveList; +} + +int LabMetaEngine::getMaximumSaveSlot() const { + return 999; +} + +void LabMetaEngine::removeSaveState(const char *target, int slot) const { + Common::SaveFileManager *saveFileMan = g_system->getSavefileManager(); + Common::String filename = Common::String::format("%s.%03u", target, slot); + + saveFileMan->removeSavefile(filename.c_str()); + + Common::StringArray filenames; + Common::String pattern = target; + pattern += ".???"; + filenames = saveFileMan->listSavefiles(pattern.c_str()); + Common::sort(filenames.begin(), filenames.end()); // Sort (hopefully ensuring we are sorted numerically..) + + for (Common::StringArray::const_iterator file = filenames.begin(); file != filenames.end(); ++file) { + // Obtain the last 3 digits of the filename, since they correspond to the save slot + int slotNum = atoi(file->c_str() + file->size() - 3); + + // Rename every slot greater than the deleted slot, + if (slotNum > slot) { + saveFileMan->renameSavefile(file->c_str(), filename.c_str()); + filename = Common::String::format("%s.%03u", target, ++slot); + } + } +} + +SaveStateDescriptor LabMetaEngine::querySaveMetaInfos(const char *target, int slot) const { + Common::String filename = Common::String::format("%s.%03u", target, slot); + Common::InSaveFile *in = g_system->getSavefileManager()->openForLoading(filename.c_str()); + + if (in) { + Lab::SaveGameHeader header; + + bool successfulRead = Lab::readSaveGameHeader(in, header); + delete in; + + if (successfulRead) { + SaveStateDescriptor desc(slot, header.desc.getDescription()); + // Do not allow save slot 0 (used for auto-saving) to be deleted or + // overwritten. + //desc.setDeletableFlag(slot != 0); + //desc.setWriteProtectedFlag(slot == 0); + + return header.desc; + } + } + + return SaveStateDescriptor(); +} + #if PLUGIN_ENABLED_DYNAMIC(LAB) REGISTER_PLUGIN_DYNAMIC(LAB, PLUGIN_TYPE_ENGINE, LabMetaEngine); #else diff --git a/engines/lab/engine.cpp b/engines/lab/engine.cpp index 9d6e7554a0..ef3850b649 100644 --- a/engines/lab/engine.cpp +++ b/engines/lab/engine.cpp @@ -1451,8 +1451,6 @@ void LabEngine::go() { mem = mem && initRoomBuffer() && initLabText(); - doDisks(); - if (!dointro) g_music->initMusic(); diff --git a/engines/lab/lab.cpp b/engines/lab/lab.cpp index 1d7c82743e..563ccefa84 100644 --- a/engines/lab/lab.cpp +++ b/engines/lab/lab.cpp @@ -43,10 +43,6 @@ namespace Lab { -bool LabEngine::hasFeature(EngineFeature f) const { - return (f == kSupportsRTL) ? true : false; -} - LabEngine *g_lab; LabEngine::LabEngine(OSystem *syst, const ADGameDescription *gameDesc) diff --git a/engines/lab/labfun.h b/engines/lab/labfun.h index bb2ddf81e6..69dc39dca1 100644 --- a/engines/lab/labfun.h +++ b/engines/lab/labfun.h @@ -34,6 +34,9 @@ #include "lab/stddefines.h" #include "lab/parsetypes.h" #include "common/file.h" +#include "common/savefile.h" + +#include "engines/savestate.h" namespace Lab { @@ -54,6 +57,13 @@ struct Image; struct TextFont; struct Gadget; +struct SaveGameHeader { + byte version; + SaveStateDescriptor desc; + uint16 roomNumber; + uint16 direction; +}; + /*----------------------------*/ /*------ From Audioi.c -------*/ /*----------------------------*/ @@ -345,8 +355,6 @@ void doWestPaper(void); void doMonitor(char *background, char *textfile, bool isinteractive, uint16 x1, uint16 y1, uint16 x2, uint16 y2); -uint16 doDisks(void); - bool saveRestoreGame(void); @@ -355,11 +363,10 @@ bool saveRestoreGame(void); /*----- From saveGame.c ----*/ /*--------------------------*/ -bool saveFloppy(char *path, uint16 RoomNum, uint16 Direction, uint16 NumQuarters, uint16 filenum, uint16 type); - -bool readFloppy(char *path, uint16 *RoomNum, uint16 *Direction, uint16 *NumQuarters, uint16 filenum, uint16 type); - +bool saveGame(uint16 RoomNum, uint16 Direction, uint16 Quarters, int slot, Common::String desc); +bool loadGame(uint16 *RoomNum, uint16 *Direction, uint16 *Quarters, int slot); +bool readSaveGameHeader(Common::InSaveFile *in, SaveGameHeader &header); /*--------------------------*/ /*----- From Special.c -----*/ diff --git a/engines/lab/modernsavegame.cpp b/engines/lab/modernsavegame.cpp deleted file mode 100644 index f9f558b985..0000000000 --- a/engines/lab/modernsavegame.cpp +++ /dev/null @@ -1,124 +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. - * - */ - -/* - * This code is based on Labyrinth of Time code with assistance of - * - * Copyright (c) 1993 Terra Nova Development - * Copyright (c) 2004 The Wyrmkeep Entertainment Co. - * - */ - -#include "lab/stddefines.h" -#include "lab/labfun.h" -#include "lab/modernsavegame.h" - -namespace Lab { - -byte g_SaveGameImage[SAVED_IMAGE_SIZE]; // 640 x 358 - -char g_SaveGamePath[512]; -char g_PathSeperator[4]; - -#define SAVEVERSION "LBS3" - -int getSaveGameList(SaveGameInfo *info, int maxNum) { - warning("STUB: getSaveGameList"); - - return 0; - -#if 0 - char path[512]; - struct stat statb; - int total = 0; - int i; - - for (i = 0; i < maxNum; i++) { - checkMusic(); - - sprintf(path, "%s%s%d", g_SaveGamePath, g_PathSeperator, i); - statb.st_size = 0; - stat(path, &statb); - - if (statb.st_size > 0) { - struct tm *create_date; - FILE *fh; - - create_date = localtime(&statb.st_ctime); - strcpy(info->SaveGameDate, asctime(create_date)); - - fh = fopen(path, "rb"); - - if (fh != NULL) { - char temp[5]; - unsigned short t; - int toSeek; - - info->Index = i; - - fread(temp, 1, 4, fh); - temp[4] = 0; - - fread(&t, 1, 2, fh); - info->RoomNumber = swapUShort(t); - fread(&t, 1, 2, fh); - info->Direction = swapUShort(t); - - toSeek = 2 + Conditions->lastElement / 8 + g_lab->_roomsFound->_lastElement / 8 + 6 + 2 * 16; - fseek(fh, toSeek, SEEK_CUR); - - info->SaveGameImage = NULL; - - if (strcmp(temp, SAVEVERSION) == 0) { - info->SaveGameImage = malloc(SAVED_IMAGE_SIZE); - - if (info->SaveGameImage != NULL) - fread(info->SaveGameImage, 1, SAVED_IMAGE_SIZE, fh); - } else { - info->SaveGameImage = malloc(SAVED_IMAGE_SIZE); - - if (info->SaveGameImage != NULL) - memset(info->SaveGameImage, 0, SAVED_IMAGE_SIZE); - } - - fclose(fh); - - info++; - total++; - } - } - } - - return total; -#endif -} - -void freeSaveGameList(SaveGameInfo *info, int count) { - int i; - - for (i = 0; i < count; i++) { - free(info->SaveGameImage); - ++info; - } -} - -} // End of namespace Lab diff --git a/engines/lab/modernsavegame.h b/engines/lab/modernsavegame.h deleted file mode 100644 index ee53cd0390..0000000000 --- a/engines/lab/modernsavegame.h +++ /dev/null @@ -1,55 +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. - * - */ - -/* - * This code is based on Labyrinth of Time code with assistance of - * - * Copyright (c) 1993 Terra Nova Development - * Copyright (c) 2004 The Wyrmkeep Entertainment Co. - * - */ - -#ifndef LAB_MODERNGAMESAVE_H -#define LAB_MODERNGAMESAVE_H - -namespace Lab { - -#define MAX_SAVED_GAMES 15 -#define SAVED_IMAGE_SIZE (128 * 72) - -extern byte g_SaveGameImage[SAVED_IMAGE_SIZE]; // 640 x 358 - -struct SaveGameInfo { - unsigned short Index; - unsigned short RoomNumber; - unsigned short Direction; - byte *SaveGameImage; - char SaveGameDate[128]; -}; - -int getSaveGameList(SaveGameInfo *info, int maxNum); -void freeSaveGameList(SaveGameInfo *info, int count); - -} // End of namespace Lab - -#endif /* LAB_MODERNGAMESAVE_H */ - diff --git a/engines/lab/module.mk b/engines/lab/module.mk index 09156a7abd..8057fad951 100644 --- a/engines/lab/module.mk +++ b/engines/lab/module.mk @@ -15,13 +15,11 @@ MODULE_OBJS := \ labtext.o \ machine.o \ map.o \ - modernsavegame.o \ mouse.o \ processroom.o \ readdiff.o \ readparse.o \ savegame.o \ - savegamepalmap.o \ special.o \ text.o \ timing.o \ diff --git a/engines/lab/savegame.cpp b/engines/lab/savegame.cpp index c5d3499071..5cf0674852 100644 --- a/engines/lab/savegame.cpp +++ b/engines/lab/savegame.cpp @@ -28,297 +28,215 @@ * */ +#include "common/savefile.h" + +#include "graphics/surface.h" +#include "graphics/thumbnail.h" + #include "lab/lab.h" #include "lab/stddefines.h" #include "lab/labfun.h" -#include "lab/modernsavegame.h" namespace Lab { -/* The version string */ -#if defined(DOSCODE) -#define SAVEVERSION "LBS2" -#else -#define SAVEVERSION "LBS3" -#define SAVEVERSION_COMPAT "LBS2" -#endif +// Labyrinth of Time ScummVM +#define SAVEGAME_ID MKTAG('L', 'O', 'T', 'S') +#define SAVEGAME_VERSION 1 #define BOOKMARK 0 #define CARDMARK 1 #define FLOPPY 2 -typedef void *LABFH; -#define INVALID_LABFH NULL -uint16 FileType, FileNum; +/*----- The machine independent section of saveGame.c -----*/ +/* Lab: Labyrinth specific */ +extern byte combination[6]; +extern uint16 CurTile[4] [4]; +extern CrumbData BreadCrumbs[MAX_CRUMBS]; +extern uint16 NumCrumbs; +extern bool DroppingCrumbs; +extern bool FollowingCrumbs; -/*----- The Amiga specific area of saveGame.c -----*/ +void writeSaveGameHeader(Common::OutSaveFile *out, const Common::String &saveName) { + out->writeUint32BE(SAVEGAME_ID); + // Write version + out->writeByte(SAVEGAME_VERSION); -/*****************************************************************************/ -/* Opens a file to write to from disk. */ -/*****************************************************************************/ -static LABFH saveGameOpen(char *filename, bool iswrite) { - warning("STUB: saveGameOpen"); - return 0; - -#if 0 - if (iswrite) { - unlink(filename); - return fopen(filename, "wb"); - } else - return fopen(filename, "rb"); -#endif -} + // Write savegame name + out->writeString(saveName); + out->writeByte(0); + // Save the game thumbnail + Graphics::saveThumbnail(*out); + // Creation date/time + TimeDate curTime; + g_system->getTimeAndDate(curTime); + uint32 saveDate = ((curTime.tm_mday & 0xFF) << 24) | (((curTime.tm_mon + 1) & 0xFF) << 16) | ((curTime.tm_year + 1900) & 0xFFFF); + uint16 saveTime = ((curTime.tm_hour & 0xFF) << 8) | ((curTime.tm_min) & 0xFF); + uint32 playTime = g_engine->getTotalPlayTime() / 1000; -/*****************************************************************************/ -/* Closes a file. */ -/*****************************************************************************/ -static void saveGameClose(LABFH file, bool iswrite) { - warning("STUB: saveGameClose"); - return; - -#if 0 - if (file != INVALID_LABFH) - fclose(file); -#endif + out->writeUint32BE(saveDate); + out->writeUint16BE(saveTime); + out->writeUint32BE(playTime); } +bool readSaveGameHeader(Common::InSaveFile *in, SaveGameHeader &header) { + uint32 id = in->readUint32BE(); + + // Check if it's a valid ScummVM savegame + if (id != SAVEGAME_ID) + return false; + // Read in the version + header.version = in->readByte(); + // Check that the save version isn't newer than this binary + if (header.version > SAVEGAME_VERSION) + return false; -/*****************************************************************************/ -/* Writes a block of memory to whatever it is that we're writing to. */ -/*****************************************************************************/ -static void saveGameWriteBlock(LABFH file, void *data, uint32 size) { - warning("STUB: saveGameWriteBlock"); - return; - - //fwrite(data, 1, size, file); -} - - + // Read in the save name + Common::String saveName; + char ch; + while ((ch = (char)in->readByte()) != '\0') + saveName += ch; + header.desc.setDescription(saveName); -/*****************************************************************************/ -/* Writes a block of memory to whatever it is that we're writing to. */ -/*****************************************************************************/ -static void saveGameReadBlock(LABFH file, void *data, uint32 size) { - warning("STUB: saveGameReadBlock"); - return; + // Get the thumbnail + header.desc.setThumbnail(Graphics::loadThumbnail(*in)); - //fread(data, 1, size, file); -} + uint32 saveDate = in->readUint32BE(); + uint16 saveTime = in->readUint16BE(); + uint32 playTime = in->readUint32BE(); + int day = (saveDate >> 24) & 0xFF; + int month = (saveDate >> 16) & 0xFF; + int year = saveDate & 0xFFFF; + header.desc.setSaveDate(year, month, day); + int hour = (saveTime >> 8) & 0xFF; + int minutes = saveTime & 0xFF; + header.desc.setSaveTime(hour, minutes); + header.desc.setPlayTime(playTime * 1000); + g_engine->setTotalPlayTime(playTime * 1000); -/*----- The machine independent section of saveGame.c -----*/ - + return true; +} -/* Lab: Labyrinth specific */ -extern uint16 combination[6]; -extern uint16 CurTile[4] [4]; - -#if !defined(DOSCODE) -extern CrumbData BreadCrumbs[MAX_CRUMBS]; -extern uint16 NumCrumbs; -extern bool DroppingCrumbs; -extern bool FollowingCrumbs; -#endif +extern char *getPictName(CloseDataPtr *LCPtr); /*****************************************************************************/ /* Writes the game out to disk. */ -/* Assumes that the file has already been openned and is there. */ /*****************************************************************************/ -static bool saveGame(uint16 RoomNum, uint16 Direction, uint16 Quarters, LABFH file) { -#if !defined(DOSCODE) - uint16 temp; - CrumbData crumbs[sizeof(BreadCrumbs) / sizeof(CrumbData)]; -#endif - uint16 last, counter, counter1; - char c; - - saveGameWriteBlock(file, (void *)SAVEVERSION, 4L); -#if defined(DOSCODE) - saveGameWriteBlock(file, &RoomNum, 2L); - saveGameWriteBlock(file, &Direction, 2L); - saveGameWriteBlock(file, &Quarters, 2L); -#else - temp = swapUShort(RoomNum); - saveGameWriteBlock(file, &temp, 2L); - temp = swapUShort(Direction); - saveGameWriteBlock(file, &temp, 2L); - temp = swapUShort(Quarters); - saveGameWriteBlock(file, &temp, 2L); -#endif - - last = g_lab->_conditions->_lastElement / 8; - saveGameWriteBlock(file, g_lab->_conditions->_array, (uint32) last); - - last = g_lab->_roomsFound->_lastElement / 8; - saveGameWriteBlock(file, g_lab->_roomsFound->_array, (uint32) last); - - /* LAB: the combination lock and tile stuff */ - for (counter = 0; counter < 6; counter++) { - c = (char)combination[counter]; - saveGameWriteBlock(file, &c, 1L); - } - - for (counter = 0; counter < 4; counter++) - for (counter1 = 0; counter1 < 4; counter1++) -#if defined(DOSCODE) - saveGameWriteBlock(file, &(CurTile[counter] [counter1]), 2L); - -#else - { - temp = swapUShort(CurTile[counter] [counter1]); - saveGameWriteBlock(file, &temp, 2L); - } -#endif - -#if !defined(DOSCODE) - saveGameWriteBlock(file, g_SaveGameImage, SAVED_IMAGE_SIZE); - memcpy(crumbs, BreadCrumbs, sizeof BreadCrumbs); - swapUShortPtr(&crumbs[0].RoomNum, sizeof(BreadCrumbs) / sizeof(uint16)); - saveGameWriteBlock(file, crumbs, sizeof BreadCrumbs); -#endif - - saveGameClose(file, true); - - return true; -} - +bool saveGame(uint16 RoomNum, uint16 Direction, uint16 Quarters, int slot, Common::String desc) { + uint16 i, j; + Common::String fileName = g_lab->generateSaveFileName(slot); + Common::SaveFileManager *saveFileManager = g_system->getSavefileManager(); + Common::OutSaveFile *file = saveFileManager->openForSaving(fileName); + if (!file) + return false; -/*****************************************************************************/ -/* Reads the game from disk. */ -/* Assumes that the file has already been openned and is there. */ -/*****************************************************************************/ -static bool loadGame(uint16 *RoomNum, uint16 *Direction, uint16 *Quarters, LABFH file) { -#if !defined(DOSCODE) - uint16 t; - CrumbData crumbs[sizeof(BreadCrumbs) / sizeof(CrumbData)]; -#endif - char temp[5], c; - uint16 last, counter, counter1; - - saveGameReadBlock(file, temp, 4L); - temp[4] = 0; - - /* - if (strcmp(temp, SAVEVERSION) != 0) - { - saveGameClose(file, false); - return false; - } - */ - -#if defined(DOSCODE) - saveGameReadBlock(file, RoomNum, 2L); - saveGameReadBlock(file, Direction, 2L); - saveGameReadBlock(file, Quarters, 2L); -#else - saveGameReadBlock(file, &t, 2L); - *RoomNum = swapUShort(t); - saveGameReadBlock(file, &t, 2L); - *Direction = swapUShort(t); - saveGameReadBlock(file, &t, 2L); - *Quarters = swapUShort(t); -#endif - - last = g_lab->_conditions->_lastElement / 8; - saveGameReadBlock(file, g_lab->_conditions->_array, (uint32) last); - - last = g_lab->_roomsFound->_lastElement / 8; - saveGameReadBlock(file, g_lab->_roomsFound->_array, (uint32) last); - - /* LAB: the combination lock and tile stuff */ - for (counter = 0; counter < 6; counter++) { - saveGameReadBlock(file, &c, 1L); - combination[counter] = c; - } + // Load scene pic + CloseDataPtr CPtr = NULL; + readPict(getPictName(&CPtr), true); - for (counter = 0; counter < 4; counter++) - for (counter1 = 0; counter1 < 4; counter1++) -#if defined(DOSCODE) - saveGameReadBlock(file, &(CurTile[counter] [counter1]), 2L); + writeSaveGameHeader(file, desc); + file->writeUint16LE(RoomNum); + file->writeUint16LE(Direction); + file->writeUint16LE(Quarters); -#else - { - saveGameReadBlock(file, &t, 2L); - CurTile[counter] [counter1] = swapUShort(t); - } -#endif + // Conditions + for (i = 0; i < g_lab->_conditions->_lastElement / (8 * 2); i++) + file->writeUint16LE(g_lab->_conditions->_array[i]); - if (strcmp(temp, SAVEVERSION) == 0) { - saveGameReadBlock(file, g_SaveGameImage, SAVED_IMAGE_SIZE); + // Rooms found + for (i = 0; i < g_lab->_roomsFound->_lastElement / (8 * 2); i++) + file->writeUint16LE(g_lab->_roomsFound->_array[i]); - memset(crumbs, 0, sizeof BreadCrumbs); - saveGameReadBlock(file, crumbs, sizeof BreadCrumbs); - swapUShortPtr(&crumbs[0].RoomNum, sizeof(BreadCrumbs) / sizeof(uint16)); - memcpy(BreadCrumbs, crumbs, sizeof BreadCrumbs); - DroppingCrumbs = (BreadCrumbs[0].RoomNum != 0); - FollowingCrumbs = false; + // Combination lock and tile stuff + for (i = 0; i < 6; i++) + file->writeByte(combination[i]); - for (counter = 0; counter < MAX_CRUMBS; counter++) - if (BreadCrumbs[counter].RoomNum == 0) break; + // Tiles + for (i = 0; i < 4; i++) + for (j = 0; j < 4; j++) + file->writeUint16LE(CurTile[i][j]); - NumCrumbs = counter; + // Breadcrumbs + for (i = 0; i < sizeof(BreadCrumbs); i++) { + file->writeUint16LE(BreadCrumbs[i].RoomNum); + file->writeUint16LE(BreadCrumbs[i].Direction); } - saveGameClose(file, false); + file->flush(); + file->finalize(); + delete file; return true; } - /*****************************************************************************/ -/* Saves the game to the floppy disk. */ +/* Reads the game from disk. */ /*****************************************************************************/ -bool saveFloppy(char *path, uint16 RoomNum, uint16 Direction, uint16 NumQuarters, uint16 filenum, uint16 type) { - LABFH FPtr; - - g_music->checkMusic(); - - FileType = type; - FileNum = filenum; - - if ((FPtr = saveGameOpen(path, true)) != INVALID_LABFH) - saveGame(RoomNum, Direction, NumQuarters, FPtr); - else +bool loadGame(uint16 *RoomNum, uint16 *Direction, uint16 *Quarters, int slot) { + uint16 i, j; + Common::String fileName = g_lab->generateSaveFileName(slot); + Common::SaveFileManager *saveFileManager = g_system->getSavefileManager(); + Common::InSaveFile *file = saveFileManager->openForLoading(fileName); + + if (!file) return false; - return true; -} - - - - -/*****************************************************************************/ -/* Reads the game from the floppy disk. */ -/*****************************************************************************/ -bool readFloppy(char *path, uint16 *RoomNum, uint16 *Direction, uint16 *NumQuarters, uint16 filenum, uint16 type) { - LABFH FPtr; + SaveGameHeader header; + readSaveGameHeader(file, header); + *RoomNum = file->readUint16LE(); + *Direction = file->readUint16LE(); + *Quarters = file->readUint16LE(); + + // Conditions + for (i = 0; i < g_lab->_conditions->_lastElement / (8 * 2); i++) + g_lab->_conditions->_array[i] = file->readUint16LE(); + + // Rooms found + for (i = 0; i < g_lab->_roomsFound->_lastElement / (8 * 2); i++) + g_lab->_roomsFound->_array[i] = file->readUint16LE(); + + // Combination lock and tile stuff + for (i = 0; i < 6; i++) + combination[i] = file->readByte(); + + // Tiles + for (i = 0; i < 4; i++) + for (j = 0; j < 4; j++) + CurTile[i][j] = file->readUint16LE(); + + // Breadcrumbs + for (i = 0; i < sizeof(BreadCrumbs); i++) { + BreadCrumbs[i].RoomNum = file->readUint16LE(); + BreadCrumbs[i].Direction = file->readUint16LE(); + } - g_music->checkMusic(); + DroppingCrumbs = (BreadCrumbs[0].RoomNum != 0); + FollowingCrumbs = false; - FileType = type; - FileNum = filenum; + for (i = 0; i < sizeof(BreadCrumbs); i++) { + if (BreadCrumbs[i].RoomNum == 0) + break; + NumCrumbs++; + } - if ((FPtr = saveGameOpen(path, false)) != INVALID_LABFH) { - if (!loadGame(RoomNum, Direction, NumQuarters, FPtr)) - return false; - } else - return false; + delete file; return true; } + } // End of namespace Lab diff --git a/engines/lab/savegamepalmap.cpp b/engines/lab/savegamepalmap.cpp deleted file mode 100644 index 0678b7881c..0000000000 --- a/engines/lab/savegamepalmap.cpp +++ /dev/null @@ -1,3316 +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. - * - */ - - /* - * This code is based on Labyrinth of Time code with assistance of - * - * Copyright (c) 1993 Terra Nova Development - * Copyright (c) 2004 The Wyrmkeep Entertainment Co. - * - */ - -#include "lab/lab.h" - - namespace Lab { - - extern const byte ThePalMap[] = { - 0x73, 0x73, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, - 0x20, 0x20, 0x20, 0x23, 0x23, 0x23, 0x1E, 0xE3, 0xE3, 0xE3, - 0xE3, 0xE3, 0xE3, 0xE2, 0xE2, 0xE2, 0xE2, 0xE2, 0xE2, 0xE1, - 0xE1, 0xE1, 0x73, 0x2F, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, - 0x68, 0x20, 0x20, 0x20, 0x23, 0x23, 0x23, 0x1E, 0x1E, 0x1E, - 0xE3, 0xE3, 0xE3, 0xE3, 0xE3, 0xE2, 0xE2, 0xE2, 0xE2, 0xE2, - 0xE2, 0xE1, 0xE1, 0xE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 0X0C, 0X53, 0X53, 0X53, 0X53, 0X53, 0X52, 0X52, 0X52, 0X52, - 0X52, 0X52, 0XBE, 0XBE, 0XBE, 0XBE, 0XBE, 0XBE, 0XBE, 0XBD, - 0XBD, 0XBD, 0XBD, 0XBD, 0XBD, 0XBC, 0XBC, 0XBC, 0X54, 0X54, - 0X54, 0X0C, 0X0C, 0X53, 0X53, 0X53, 0X53, 0X53, 0X52, 0X52, - 0X52, 0X52, 0X52, 0X34, 0X34, 0XBE, 0XBE, 0XBE, 0XBE, 0XBE, - 0XBE, 0XBD, 0XBD, 0XBD, 0XBD, 0XBD, 0XBD, 0XBC, 0XBC, 0XBC, - 0X54, 0X54, 0X54, 0X26, 0X26, 0X26, 0X26, 0X53, 0X53, 0X53, - 0X52, 0X52, 0X52, 0X52, 0X34, 0X34, 0X34, 0X34, 0X34, 0XBE, - 0XBE, 0XBE, 0XBE, 0XBD, 0XBD, 0XBD, 0XBD, 0XBD, 0XBD, 0XBC, - 0XBC, 0XBC, 0XBB, 0XBB, 0X26, 0X26, 0X26, 0X26, 0X26, 0X26, - 0X26, 0X51, 0XBA, 0XBA, 0XBA, 0X34, 0X34, 0X34, 0X34, 0X34, - 0X34, 0X34, 0X50, 0X50, 0X50, 0XB9, 0XB9, 0XB9, 0XB9, 0XB9, - 0XB9, 0XB8, 0XB8, 0XB8, 0XBB, 0XBB, 0XBB, 0X26, 0X26, 0X26, - 0X26, 0X51, 0X51, 0X51, 0XBA, 0XBA, 0XBA, 0XBA, 0X34, 0X34, - 0X34, 0X34, 0X34, 0X50, 0X50, 0X50, 0X02, 0XB9, 0XB9, 0XB9, - 0XB9, 0XB9, 0XB9, 0XB8, 0XB8, 0XB8, 0XBB, 0XBB, 0XBB, 0X26, - 0X26, 0X51, 0X51, 0X51, 0X51, 0X51, 0XBA, 0XBA, 0XBA, 0XBA, - 0XBA, 0X34, 0X34, 0X34, 0X50, 0X50, 0X50, 0X02, 0X02, 0XB9, - 0XB9, 0XB9, 0XB9, 0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D, 0XBC, - 0XBC, 0XBC, 0X54, 0X54, 0X54, 0X26, 0X26, 0X26, 0X53, 0X53, - 0X53, 0X53, 0X52, 0X52, 0X52, 0X52, 0X52, 0X52, 0X34, 0XBE, - 0XBE, 0XBE, 0XBE, 0XBE, 0XBE, 0XBD, 0XBD, 0XBD, 0XBD, 0XBD, - 0XBD, 0XBC, 0XBC, 0XBC, 0X54, 0X54, 0X26, 0X26, 0X26, 0X26, - 0X26, 0X26, 0X26, 0X53, 0X52, 0X52, 0X52, 0X52, 0X34, 0X34, - 0X34, 0X34, 0XBE, 0XBE, 0XBE, 0XBE, 0XBE, 0XBD, 0XBD, 0XBD, - 0XBD, 0XBD, 0XBD, 0XBC, 0XBC, 0XBC, 0XBB, 0XBB, 0X26, 0X26, - 0X26, 0X26, 0X26, 0X26, 0X26, 0X19, 0X19, 0XBA, 0XBA, 0XBA, - 0X34, 0X34, 0X34, 0X34, 0X34, 0X50, 0X50, 0X50, 0X50, 0XB9, - 0XB9, 0XB9, 0XB9, 0XB9, 0XB9, 0XB8, 0XB8, 0XB8, 0XBB, 0XBB, - 0X26, 0X26, 0X26, 0X26, 0X26, 0X26, 0X26, 0X19, 0X19, 0XBA, - 0XBA, 0XBA, 0X34, 0X34, 0X34, 0X34, 0X34, 0X50, 0X50, 0X50, - 0X02, 0XB9, 0XB9, 0XB9, 0XB9, 0XB9, 0XB9, 0XB8, 0XB8, 0XB8, - 0XBB, 0XBB, 0XBB, 0X26, 0X26, 0X26, 0X26, 0X51, 0X51, 0X19, - 0XBA, 0XBA, 0XBA, 0XBA, 0XBA, 0X34, 0X34, 0X34, 0X50, 0X50, - 0X50, 0X02, 0X02, 0XB9, 0XB9, 0XB9, 0XB9, 0XB9, 0XB9, 0XB8, - 0XB8, 0XB8, 0XBB, 0XBB, 0XBB, 0XBB, 0X51, 0X51, 0X51, 0X51, - 0X51, 0X51, 0XBA, 0XBA, 0XBA, 0XBA, 0XBA, 0XBA, 0X34, 0X50, - 0X50, 0X50, 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0XBD, 0XBD, 0XBD, 0XBC, 0XBC, 0XBC, 0X54, 0X54, - 0X26, 0X26, 0X26, 0X26, 0X26, 0X26, 0X26, 0X19, 0X19, 0X52, - 0X52, 0X52, 0X52, 0X34, 0X34, 0X34, 0XBE, 0XBE, 0XBE, 0XBE, - 0XBE, 0XBD, 0XBD, 0XBD, 0XBD, 0XBD, 0XBD, 0XBC, 0XBC, 0XBC, - 0XBB, 0X26, 0X26, 0X26, 0X26, 0X26, 0X26, 0X26, 0X19, 0X19, - 0X19, 0X03, 0X03, 0X03, 0X34, 0X34, 0X34, 0X34, 0X34, 0X50, - 0X50, 0X50, 0X50, 0XB9, 0XB9, 0XB9, 0XB9, 0XB9, 0XB9, 0XB8, - 0XB8, 0XB8, 0XBB, 0XBB, 0X26, 0X26, 0X26, 0X26, 0X26, 0X26, - 0X19, 0X19, 0X19, 0X03, 0X03, 0X03, 0X03, 0X34, 0X34, 0X34, - 0X50, 0X50, 0X50, 0X50, 0X6C, 0XB9, 0XB9, 0XB9, 0XB9, 0XB9, - 0XB9, 0XB8, 0XB8, 0XB8, 0XBB, 0XBB, 0X26, 0X26, 0X26, 0X26, - 0X26, 0X19, 0X19, 0X19, 0X19, 0X03, 0X03, 0X03, 0X03, 0X03, - 0X34, 0X34, 0X50, 0X50, 0X50, 0X6C, 0X6C, 0X6C, 0XB9, 0XB9, - 0XB9, 0XB9, 0XB9, 0XB8, 0XB8, 0XB8, 0XBB, 0XBB, 0XBB, 0X26, - 0X26, 0X26, 0X51, 0X19, 0X19, 0X19, 0X03, 0X03, 0X03, 0X03, - 0X03, 0X03, 0X03, 0X50, 0X50, 0X50, 0X6C, 0X6C, 0X6C, 0X6C, - 0XB9, 0XB9, 0XB9, 0XB9, 0XB9, 0XB8, 0XB8, 0XB8, 0XBB, 0XBB, - 0XBB, 0XBB, 0X51, 0X51, 0X51, 0X51, 0X19, 0X19, 0X03, 0X03, - 0X03, 0X03, 0X03, 0X03, 0X03, 0X50, 0X50, 0X6C, 0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0XA0, - 0XA0, 0XA0, 0XA0, 0XA0, 0XA0, 0X9F, 0X9F, 0X9F, 0X9F, 0X9F, - 0X9F, 0X9E, 0X9E, 0X9E, 0X9D, 0X9D, 0X26, 0X26, 0X26, 0X26, - 0X26, 0X19, 0X19, 0X19, 0X19, 0X03, 0X03, 0X03, 0X03, 0X34, - 0X34, 0X34, 0X49, 0X49, 0X49, 0X49, 0X49, 0X9C, 0X9C, 0X9C, - 0X9C, 0X9C, 0X9C, 0X9B, 0X9B, 0X9B, 0X9D, 0X9D, 0X26, 0X26, - 0X26, 0X26, 0X26, 0X19, 0X19, 0X19, 0X19, 0X03, 0X03, 0X03, - 0X03, 0X03, 0X34, 0X49, 0X49, 0X49, 0X49, 0X49, 0X49, 0X9C, - 0X9C, 0X9C, 0X9C, 0X9C, 0X9C, 0X9B, 0X9B, 0X9B, 0X9D, 0X9D, - 0X9D, 0X26, 0X26, 0X26, 0X19, 0X19, 0X19, 0X19, 0X19, 0X03, - 0X03, 0X03, 0X03, 0X03, 0X03, 0X49, 0X49, 0X49, 0X49, 0X49, - 0X6C, 0X9C, 0X9C, 0X9C, 0X9C, 0X9C, 0X9C, 0X9B, 0X9B, 0X9B, - 0X9D, 0X9D, 0X9D, 0X26, 0X26, 0X4B, 0X19, 0X19, 0X19, 0X19, - 0X03, 0X03, 0X03, 0X03, 0X03, 0X03, 0X04, 0X49, 0X49, 0X49, - 0X49, 0X6C, 0X6C, 0X6C, 0X9C, 0X9C, 0X9C, 0X9C, 0X9C, 0X9B, - 0X9B, 0X9B, 0X9D, 0X9D, 0X9D, 0X9D, 0X4B, 0X4B, 0X4B, 0X19, - 0X19, 0X19, 0X03, 0X03, 0X03, 0X03, 0X03, 0X03, 0X04, 0X49, - 0X49, 0X49, 0X6C, 0X6C, 0X6C, 0X6C, 0X9C, 0X9C, 0X9C, 0X9C, - 0X9C, 0X9B, 0X9B, 0X9B, 0X9D, 0X9D, 0X9D, 0X9D, 0X4B, 0X4B, - 0X4B, 0X4B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 0X36, 0X36, 0X18, - 0X18, 0X18, 0X18, 0X18, 0XFD, 0XFD, 0XF8, 0XF8, 0XF8, 0XF8, - 0XF9, 0XF9, 0XF9, 0XF9, 0X99, 0X99, 0XFA, 0XFA, 0XFA, 0XFA, - 0X48, 0X48, 0XFB, 0XFB, 0XFB, 0XFB, 0X47, 0X47, 0X36, 0X36, - 0X18, 0X18, 0X18, 0X18, 0X38, 0X38, 0X38, 0XFD, 0X9A, 0X9A, - 0X9A, 0X9A, 0XF9, 0XF9, 0XF9, 0X99, 0X99, 0X99, 0XFA, 0XFA, - 0XFA, 0X48, 0X48, 0X48, 0XFB, 0XFB, 0XFB, 0X47, 0X47, 0X47, - 0X36, 0X36, 0X18, 0X18, 0X18, 0X38, 0X38, 0X38, 0X38, 0X38, - 0XFE, 0XFE, 0XFE, 0XFE, 0XFF, 0XFF, 0XFF, 0XFF, 0XFF, 0XFF, - 0X95, 0X95, 0X95, 0X95, 0X95, 0X95, 0X94, 0X94, 0X94, 0X94, - 0X94, 0X94, 0X94, 0X93, 0X93, 0X18, 0X38, 0X38, 0X38, 0X38, - 0X38, 0X38, 0XFE, 0XFE, 0XFE, 0XFE, 0XFF, 0XFF, 0XFF, 0XFF, - 0XFF, 0XFF, 0X95, 0X95, 0X95, 0X95, 0X95, 0X95, 0X94, 0X94, - 0X94, 0X94, 0X94, 0X94, 0X94, 0X93, 0X93, 0X93, 0X93, 0X38, - 0X38, 0X38, 0X38, 0X92, 0XFE, 0XFE, 0XFE, 0XFE, 0XFF, 0XFF, - 0XFF, 0XFF, 0XFF, 0XFF, 0X95, 0X95, 0X95, 0X95, 0X95, 0X95, - 0X94, 0X94, 0X94, 0X94, 0X94, 0X94, 0X94, 0X93, 0X93, 0X93, - 0X93, 0X93, 0X38, 0X38, 0X92, 0X92, 0XAC, 0XAC, 0XAC, 0XAC, - 0XAB, 0XAB, 0XAB, 0XAB, 0XAB, 0XAB, 0XAA, 0XAA, 0XAA, 0XAA, - 0XAA, 0XAA, 0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47, - 0X47, 0X47, 0X47, 0XFC, 0XFC, 0X18, 0X18, 0X06, 0X38, 0X38, - 0X38, 0XFD, 0X9A, 0X9A, 0X9A, 0X9A, 0XF9, 0XF9, 0X99, 0X99, - 0X99, 0X99, 0XFA, 0XFA, 0X48, 0X48, 0X48, 0X48, 0XFB, 0XFB, - 0X47, 0X47, 0X47, 0X47, 0X47, 0XFC, 0XFC, 0X18, 0X38, 0X38, - 0X38, 0X38, 0X38, 0X38, 0XFE, 0XFE, 0XFE, 0XFE, 0XFF, 0XFF, - 0XFF, 0XFF, 0XFF, 0XFF, 0X95, 0X95, 0X95, 0X95, 0X95, 0X95, - 0X94, 0X94, 0X94, 0X94, 0X94, 0X94, 0X94, 0X93, 0X93, 0X93, - 0X38, 0X38, 0X38, 0X38, 0X38, 0X38, 0XFE, 0XFE, 0XFE, 0XFE, - 0XFF, 0XFF, 0XFF, 0XFF, 0XFF, 0XFF, 0X95, 0X95, 0X95, 0X95, - 0X95, 0X95, 0X94, 0X94, 0X94, 0X94, 0X94, 0X94, 0X94, 0X93, - 0X93, 0X93, 0X93, 0X38, 0X38, 0X38, 0X38, 0X92, 0XFE, 0XFE, - 0XFE, 0XFE, 0XFF, 0XFF, 0XFF, 0XFF, 0XFF, 0X96, 0X95, 0X95, - 0X95, 0X95, 0X95, 0X95, 0X94, 0X94, 0X94, 0X94, 0X94, 0X94, - 0X94, 0X93, 0X93, 0X93, 0X93, 0X93, 0X38, 0X38, 0X92, 0X92, - 0XAC, 0XAC, 0XAC, 0XAC, 0XAB, 0XAB, 0XAB, 0XAB, 0XAB, 0XAB, - 0XAA, 0XAA, 0XAA, 0XAA, 0XAA, 0XAA, 0XA9, 0XA9, 0XA9, 0XA9, - 0XA9, 0XA9, 0XA9, 0XA8, 0XA8, 0XA8, 0XA8, 0XA8, 0XA8, 0XA7, - 0XA7, 0XA7, 0XAC, 0XAC, 0XAC, 0XAC, 0XAB, 0XAB, 0XAB, 0XAB, - 0XAB, 0XAB, 0XAA, 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48, - 0X48, 0X48, 0XFB, 0X47, 0X47, 0X47, 0X47, 0X47, 0X47, 0XFC, - 0X46, 0X46, 0X06, 0X38, 0X38, 0X38, 0X38, 0X98, 0XFE, 0XFE, - 0XFE, 0XFE, 0XFF, 0XFF, 0XFF, 0XFF, 0XFF, 0XFF, 0X95, 0X95, - 0X95, 0X95, 0X95, 0X95, 0X94, 0X94, 0X94, 0X94, 0X94, 0X94, - 0X94, 0X93, 0X93, 0X93, 0X38, 0X38, 0X38, 0X38, 0X38, 0X1D, - 0XFE, 0XFE, 0XFE, 0XFE, 0XFF, 0XFF, 0XFF, 0XFF, 0XFF, 0X96, - 0X95, 0X95, 0X95, 0X95, 0X95, 0X95, 0X94, 0X94, 0X94, 0X94, - 0X94, 0X94, 0X94, 0X93, 0X93, 0X93, 0X93, 0X38, 0X38, 0X38, - 0X1D, 0X92, 0XFE, 0XFE, 0XFE, 0XFE, 0XFF, 0XFF, 0XFF, 0XFF, - 0X96, 0X96, 0X95, 0X95, 0X95, 0X95, 0X95, 0X95, 0X94, 0X94, - 0X94, 0X94, 0X94, 0X94, 0X94, 0X93, 0X93, 0X93, 0X93, 0X93, - 0X38, 0X38, 0X92, 0X92, 0XAC, 0XAC, 0XAC, 0XAC, 0XAB, 0XAB, - 0XAB, 0XAB, 0XAB, 0XAB, 0XAA, 0XAA, 0XAA, 0XAA, 0XAA, 0XAA, - 0XA9, 0XA9, 0XA9, 0XA9, 0XA9, 0XA9, 0XA9, 0XA8, 0XA8, 0XA8, - 0XA8, 0XA8, 0XA8, 0XA7, 0XA7, 0XA7, 0XAC, 0XAC, 0XAC, 0XAC, - 0XAB, 0XAB, 0XAB, 0XAB, 0XAB, 0XAB, 0XAA, 0XAA, 0XAA, 0XAA, - 0XAA, 0XAA, 0XA9, 0XA9, 0XA9, 0XA9, 0XA9, 0XA9, 0XA9, 0XA8, - 0XA8, 0XA8, 0XA8, 0XA8, 0XA8, 0XA7, 0XA7, 0XA7, 0XAC, 0XAC, - 0XAC,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0XFB, 0X30, 0X30, 0X30, 0X30, 0X30, 0XFC, 0XFC, 0X06, 0XFD, - 0XFD, 0XFD, 0XF8, 0XF8, 0XF8, 0XF8, 0XF9, 0XF9, 0XF9, 0XF9, - 0X99, 0X99, 0XFA, 0XFA, 0XFA, 0XFA, 0X48, 0X05, 0X05, 0X05, - 0XFB, 0XFB, 0X47, 0X47, 0X30, 0X30, 0X30, 0XFC, 0XFC, 0X46, - 0X06, 0X06, 0XFD, 0XFD, 0X9A, 0X9A, 0X9A, 0X9A, 0XF9, 0XF9, - 0XF9, 0X99, 0X99, 0X99, 0XFA, 0XFA, 0XFA, 0X48, 0X48, 0X48, - 0XFB, 0XFB, 0XFB, 0X47, 0X47, 0X47, 0X30, 0X30, 0XFC, 0XFC, - 0X46, 0X06, 0X06, 0X06, 0XFD, 0XFD, 0X9A, 0X9A, 0X9A, 0X9A, - 0XF9, 0XF9, 0X99, 0X99, 0X99, 0X99, 0XFA, 0XFA, 0X48, 0X48, - 0X48, 0X48, 0XFB, 0XFB, 0X47, 0X47, 0X47, 0X47, 0X47, 0XFC, - 0XFC, 0X46, 0X46, 0X06, 0X06, 0X25, 0XFD, 0X98, 0X9A, 0X9A, - 0X9A, 0X9A, 0XF9, 0X99, 0X99, 0X99, 0X99, 0X99, 0XFA, 0X48, - 0X48, 0X48, 0X48, 0X48, 0XFB, 0X47, 0X47, 0X47, 0X47, 0X47, - 0X47, 0XFC, 0X46, 0X46, 0X06, 0X06, 0X25, 0X25, 0X25, 0X98, - 0X9A, 0X9A, 0X9A, 0X9A, 0X99, 0X99, 0X99, 0X99, 0X99, 0X99, - 0X48, 0X48, 0X48, 0X48, 0X48, 0X48, 0X47, 0X47, 0X47, 0X47, - 0X47, 0X47, 0X47, 0X46, 0X46, 0X06, 0X06, 0X38, 0X25, 0X25, - 0X25, 0X1D, 0XFE, 0XFE, 0XFE, 0XFE, 0XFF, 0XFF, 0XFF, 0XFF, - 0XFF, 0X96, 0X95, 0X95, 0X95, 0X95, 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0X30, 0X30, 0X30, - 0X30, 0X30, 0X46, 0X46, 0X06, 0X06, 0XFD, 0XFD, 0X9A, 0X9A, - 0X9A, 0X9A, 0XF9, 0XF9, 0X99, 0X99, 0X99, 0X99, 0XFA, 0XFA, - 0X48, 0X48, 0X48, 0X48, 0X05, 0XFB, 0X47, 0X47, 0X47, 0X47, - 0X30, 0X30, 0X30, 0X46, 0X46, 0X06, 0X06, 0X25, 0XFD, 0X98, - 0X9A, 0X9A, 0X9A, 0X9A, 0XF9, 0X99, 0X99, 0X99, 0X99, 0X99, - 0XFA, 0X48, 0X48, 0X48, 0X48, 0X48, 0XFB, 0X47, 0X47, 0X47, - 0X47, 0X47, 0X30, 0X30, 0X46, 0X46, 0X06, 0X06, 0X25, 0X25, - 0X25, 0X98, 0X9A, 0X9A, 0X9A, 0X9A, 0X99, 0X99, 0X99, 0X99, - 0X99, 0X99, 0X48, 0X48, 0X48, 0X48, 0X48, 0X48, 0X47, 0X47, - 0X47, 0X47, 0X47, 0X47, 0X47, 0X46, 0X46, 0X46, 0X06, 0X6A, - 0X25, 0X25, 0X25, 0X98, 0X9A, 0X9A, 0X9A, 0X9A, 0X99, 0X99, - 0X99, 0X99, 0X99, 0X99, 0X48, 0X48, 0X48, 0X48, 0X48, 0X48, - 0X47, 0X47, 0X47, 0X47, 0X47, 0X47, 0X47, 0X46, 0X46, 0X6A, - 0X6A, 0X6A, 0X25, 0X25, 0X25, 0X1D, 0XFE, 0XFE, 0XFE, 0XFE, - 0XFF, 0XFF, 0XFF, 0XFF, 0X96, 0X96, 0X95, 0X95, 0X95, 0X95, - 0X95, 0X95, 0X94, 0X94, 0X94, 0X94, 0X94, 0X94, 0X94, 0X93, - 0X93, 0X6A, 0X6A, 0X6A, 0X25, 0X1D, 0X1D, 0X1D, 0XFE, 0XFE, - 0XFE, 0XFE, 0XFF, 0XFF, 0XFF, 0X96, 0X96, 0X96, 0X95, 0X95, - 0X95, 0X95, 0X95, 0X95, 0X94, 0X94, 0X94, 0X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, 0X4B, 0X4B, - 0X4B, 0X4B, 0X4A, 0X4A, 0X4A, 0X4A, 0X04, 0X05, 0X05, 0X05, - 0X05, 0X49, 0X49, 0X49, 0X30, 0X30, 0X9C, 0X9C, 0X9C, 0X9C, - 0X9C, 0X9B, 0X9B, 0X9B, 0X9D, 0X9D, 0X9D, 0X9D, 0X4B, 0X4B, - 0X4B, 0X4B, 0X4B, 0X4B, 0X4A, 0X4A, 0X4A, 0X04, 0X04, 0X05, - 0X05, 0X05, 0X05, 0X05, 0X49, 0X30, 0X30, 0X30, 0X30, 0X30, - 0X9C, 0X9C, 0X9C, 0X9B, 0X9B, 0X9B, 0X9D, 0X9D, 0X9D, 0X9D, - 0X4B, 0X4B, 0X4B, 0X4B, 0X4B, 0X4B, 0X4A, 0X4A, 0X04, 0X04, - 0X05, 0X05, 0X05, 0X05, 0X05, 0X05, 0X0E, 0X30, 0X30, 0X30, - 0X30, 0X30, 0X30, 0X30, 0X9C, 0X9B, 0X9B, 0X9B, 0X9A, 0X9A, - 0X9A, 0X9A, 0XF9, 0XF9, 0XF9, 0X99, 0X99, 0X99, 0XFA, 0XFA, - 0XFA, 0X48, 0X05, 0X05, 0X05, 0X05, 0X0E, 0X0E, 0X0E, 0X30, - 0X30, 0X30, 0X30, 0X30, 0X30, 0X30, 0X06, 0XFD, 0XFD, 0XFD, - 0X9A, 0X9A, 0X9A, 0X9A, 0XF9, 0XF9, 0X99, 0X99, 0X99, 0X99, - 0XFA, 0XFA, 0X48, 0X48, 0X48, 0X05, 0X05, 0X0E, 0X0E, 0X0E, - 0X0E, 0X0E, 0X30, 0X30, 0X30, 0X30, 0X30, 0X06, 0X06, 0X25, - 0XFD, 0X98, 0X9A, 0X9A, 0X9A, 0X9A, 0XF9, 0X99, 0X99, 0X99, - 0X99, 0X99, 0XFA, 0X48, 0X48, 0X48, 0X48, 0X48, 0X0E, 0X0E, - 0X0E, 0X0E, 0X0E, 0X0E, 0X30, 0X30, 0X30, 0X30, 0X46, 0X06, - 0X6A, 0X25, 0X98, 0X98, 0X9A, 0X9A, 0X9A, 0X9A, 0X99, 0X99, - 0X99, 0X99, 0X99, 0X99, 0X48, 0X48, 0X48, 0X48, 0X48, 0X48, - 0X0E, 0X0E, 0X0E, 0X0E, 0X0E, 0X0E, 0X30, 0X30, 0X28, 0X46, - 0X6A, 0X6A, 0X6A, 0X25, 0X25, 0X98, 0X9A, 0X9A, 0X9A, 0X9A, - 0X99, 0X99, 0X99, 0X99, 0X99, 0X99, 0X48, 0X48, 0X48, 0X48, - 0X48, 0X48, 0X0E, 0X0E, 0X0E, 0X0E, 0X0E, 0X0E, 0X28, 0X28, - 0X28, 0X28, 0X6A, 0X6A, 0X6A, 0X25, 0X33, 0X33, 0X9A, 0X9A, - 0X9A, 0X9A, 0X99, 0X99, 0X99, 0X99, 0X99, 0X99, 0X48, 0X48, - 0X48, 0X48, 0X48, 0X48, 0X0E, 0X0E, 0X0E, 0X0E, 0X0E, 0X0E, - 0X28, 0X28, 0X28, 0X6A, 0X6A, 0X6A, 0X6A, 0X33, 0X33, 0X1D, - 0XFE, 0XFE, 0XFE, 0XFE, 0XFF, 0XFF, 0XFF, 0X96, 0X96, 0X96, - 0X95, 0X95, 0X95, 0X95, 0X95, 0X95, 0X94, 0X94, 0X94, 0X94, - 0X94, 0X94, 0X28, 0X28, 0X28, 0X6A, 0X6A, 0X6A, 0X6A, 0X33, - 0X1D, 0X1D, 0X97, 0X97, 0X97, 0X97, 0XFF, 0XFF, 0X96, 0X96, - 0X96, 0X96, 0X95, 0X95, 0X95, 0X95, 0X95, 0X95, 0X94, 0X94, - 0X94, 0X94, 0X94, 0X94, 0X94, 0X93, 0X93, 0X93, 0X6A, 0X6A, - 0X33, 0X1D, 0X1D, 0X1D, 0X97, 0X97, 0X97, 0X97, 0XFF, 0X96, - 0X96, 0X96, 0X96, 0X96, 0X95, 0X95, 0X95, 0X95, 0X95, 0X95, - 0X94, 0X94, 0X94, 0X94, 0X94, 0X94, 0X94, 0X93, 0X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X89, 0X89, 0X89, - 0X89, 0X89, 0X88, 0X88, 0X88, 0X88, 0X88, 0X88, 0X88, 0X87, - 0X87, 0X87, 0X87, 0X87, 0X87, 0X86, 0X86, 0X86, 0X8B, 0X8B, - 0X8B, 0X8B, 0X8A, 0X8A, 0X8A, 0X8A, 0X8A, 0X8A, 0X89, 0X89, - 0X89, 0X89, 0X89, 0X89, 0X88, 0X88, 0X88, 0X88, 0X88, 0X88, - 0X88, 0X87, 0X87, 0X87, 0X87, 0X87, 0X87, 0X86, 0X86, 0X86, - 0X8B, 0X8B, 0X8B, 0X8B, 0X8A, 0X8A, 0X8A, 0X8A, 0X8A, 0X8A, - 0X89, 0X89, 0X89, 0X89, 0X89, 0X89, 0X88, 0X88, 0X88, 0X88, - 0X88, 0X88, 0X88, 0X87, 0X87, 0X87, 0X87, 0X87, 0X87, 0X86, - 0X86, 0X86, 0X8B, 0X8B, 0X8B, 0X8B, 0X8A, 0X8A, 0X8A, 0X8A, - 0X8A, 0X8A, 0X89, 0X89, 0X89, 0X89, 0X89, 0X89, 0X88, 0X88, - 0X88, 0X88, 0X88, 0X88, 0X88, 0X87, 0X87, 0X87, 0X87, 0X87, - 0X87, 0X86, 0X86, 0X86, 0X8B, 0X8B, 0X8B, 0X8B, 0X8A, 0X8A, - 0X8A, 0X8A, 0X8A, 0X8A, 0X89, 0X89, 0X89, 0X89, 0X89, 0X89, - 0X88, 0X88, 0X88, 0X88, 0X88, 0X88, 0X88, 0X87, 0X87, 0X87, - 0X87, 0X87, 0X87, 0X86, 0X86, 0X86, 0X85, 0X85, 0X85, 0X85, - 0X84, 0X84, 0X84, 0X84, 0X84, 0X84, 0X13, 0X13, 0X13, 0X83, - 0X83, 0X83, 0X82, 0X82, 0X82, 0X82, 0X82, 0X82, 0X82, 0X81, - 0X81, 0X81, 0X81, 0X81, 0X81, 0X80, 0X80, 0X80, 0X85, 0X85, - 0X85, 0X85, 0X84, 0X84, 0X84, 0X84, 0X84, 0X13, 0X13, 0X13, - 0X13, 0X13, 0X83, 0X83, 0X82, 0X82, 0X82, 0X82, 0X82, 0X82, - 0X82, 0X81, 0X81, 0X81, 0X81, 0X81, 0X81, 0X80, 0X80, 0X80, - 0X85, 0X85, 0X85, 0X85, 0X84, 0X84, 0X84, 0X84, 0X84, 0X13, - 0X13, 0X13, 0X13, 0X13, 0X13, 0X83, 0X82, 0X82, 0X82, 0X82, - 0X82, 0X82, 0X82, 0X81, 0X81, 0X81, 0X81, 0X81, 0X81, 0X80, - 0X80, 0X80, 0X85, 0X85, 0X85, 0X85, 0X84, 0X84, 0X84, 0X84, - 0X84, 0X13, 0X13, 0X13, 0X13, 0X13, 0X13, 0X13, 0X82, 0X82, - 0X82, 0X82, 0X82, 0X82, 0X82, 0X81, 0X81, 0X81, 0X81, 0X81, - 0X81, 0X80, 0X80, 0X80, 0X85, 0X85, 0X85, 0X85, 0X84, 0X84, - 0X84, 0X84, 0X84, 0X13, 0X13, 0X13, 0X13, 0X13, 0X13, 0X13, - 0X13, 0X82, 0X82, 0X82, 0X82, 0X82, 0X82, 0X81, 0X81, 0X81, - 0X81, 0X81, 0X81, 0X80, 0X80, 0X80, 0X85, 0X85, 0X85, 0X85, - 0X84, 0X84, 0X84, 0X84, 0X84, 0X13, 0X13, 0X13, 0X13, 0X13, - 0X13, 0X13, 0X13, 0X82, 0X82, 0X82, 0X82, 0X82, 0X82, 0X81, - 0X81, 0X81, 0X81, 0X81, 0X81, 0X80, 0X80, 0X80, 0X7F, 0X7F, - 0X7F, 0X7F, 0X7E, 0X7E, 0X7E, 0X7E, 0X7E, 0X13, 0X13, 0X13, - 0X13, 0X13, 0X13, 0X13, 0X13, 0X44, 0X44, 0X44, 0X44, 0X44, - 0X44, 0X7D, 0X7D, 0X7D, 0X7D, 0X7D, 0X7D, 0X7C, 0X7C, 0X7C, - 0X7F, 0X7F, 0X7F, 0X7F, 0X7E, 0X7E, 0X7E, 0X7E, 0X7E, 0X13, - 0X13, 0X13, 0X13, 0X13, 0X45, 0X45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0X6A, 0X6A, - 0X33, 0X33, 0X33, 0X33, 0X77, 0X77, 0X77, 0X77, 0X76, 0X76, - 0X76, 0X76, 0X76, 0X76, 0X75, 0X75, 0X75, 0X75, 0X75, 0X75, - 0X0E, 0X0E, 0X74, 0X74, 0X74, 0X28, 0X28, 0X28, 0X28, 0X28, - 0X2D, 0X6A, 0X33, 0X33, 0X33, 0X69, 0X77, 0X77, 0X77, 0X77, - 0X76, 0X76, 0X76, 0X76, 0X76, 0X76, 0X75, 0X75, 0X75, 0X75, - 0X75, 0X75, 0X74, 0X74, 0X74, 0X74, 0X74, 0X74, 0X28, 0X28, - 0X28, 0X2D, 0X2D, 0X2D, 0X69, 0X69, 0X69, 0X69, 0X77, 0X77, - 0X77, 0X77, 0X76, 0X76, 0X76, 0X76, 0X76, 0X76, 0X75, 0X75, - 0X75, 0X75, 0X75, 0X75, 0X74, 0X74, 0X74, 0X74, 0X74, 0X74, - 0X74, 0X41, 0X41, 0X41, 0X41, 0X2D, 0X69, 0X69, 0X69, 0X69, - 0X91, 0X91, 0X91, 0X91, 0X90, 0X90, 0X90, 0X90, 0X90, 0X90, - 0X8F, 0X8F, 0X8F, 0X8F, 0X8F, 0X8F, 0X8E, 0X8E, 0X8E, 0X8E, - 0X8E, 0X8E, 0X8E, 0X8D, 0X8D, 0X8D, 0X8D, 0X8D, 0X8D, 0X8C, - 0X8C, 0X8C, 0X91, 0X91, 0X91, 0X91, 0X90, 0X90, 0X90, 0X90, - 0X90, 0X90, 0X8F, 0X8F, 0X8F, 0X8F, 0X8F, 0X8F, 0X8E, 0X8E, - 0X8E, 0X8E, 0X8E, 0X8E, 0X8E, 0X8D, 0X8D, 0X8D, 0X8D, 0X8D, - 0X8D, 0X8C, 0X8C, 0X8C, 0X91, 0X91, 0X91, 0X91, 0X90, 0X90, - 0X90, 0X90, 0X90, 0X90, 0X8F, 0X8F, 0X8F, 0X8F, 0X8F, 0X8F, - 0X8E, 0X8E, 0X8E, 0X8E, 0X8E, 0X8E, 0X8E, 0X8D, 0X8D, 0X8D, - 0X8D, 0X8D, 0X8D, 0X8C, 0X8C, 0X8C, 0X91, 0X91, 0X91, 0X91, - 0X90, 0X90, 0X90, 0X90, 0X90, 0X90, 0X8F, 0X8F, 0X8F, 0X8F, - 0X8F, 0X8F, 0X8E, 0X8E, 0X8E, 0X8E, 0X8E, 0X8E, 0X8E, 0X8D, - 0X8D, 0X8D, 0X8D, 0X8D, 0X8D, 0X8C, 0X8C, 0X8C, 0X8B, 0X8B, - 0X8B, 0X8B, 0X8A, 0X8A, 0X8A, 0X8A, 0X8A, 0X8A, 0X89, 0X89, - 0X89, 0X89, 0X89, 0X89, 0X88, 0X88, 0X88, 0X88, 0X88, 0X88, - 0X88, 0X87, 0X87, 0X87, 0X87, 0X87, 0X87, 0X86, 0X86, 0X86, - 0X8B, 0X8B, 0X8B, 0X8B, 0X8A, 0X8A, 0X8A, 0X8A, 0X8A, 0X8A, - 0X89, 0X89, 0X89, 0X89, 0X89, 0X89, 0X88, 0X88, 0X88, 0X88, - 0X88, 0X88, 0X88, 0X87, 0X87, 0X87, 0X87, 0X87, 0X87, 0X86, - 0X86, 0X86, 0X8B, 0X8B, 0X8B, 0X8B, 0X8A, 0X8A, 0X8A, 0X8A, - 0X8A, 0X8A, 0X89, 0X89, 0X89, 0X89, 0X89, 0X89, 0X88, 0X88, - 0X88, 0X88, 0X88, 0X88, 0X88, 0X87, 0X87, 0X87, 0X87, 0X87, - 0X87, 0X86, 0X86, 0X86, 0X8B, 0X8B, 0X8B, 0X8B, 0X8A, 0X8A, - 0X8A, 0X8A, 0X8A, 0X8A, 0X89, 0X89, 0X89, 0X89, 0X89, 0X89, - 0X88, 0X88, 0X88, 0X88, 0X88, 0X88, 0X88, 0X87, 0X87, 0X87, - 0X87, 0X87, 0X87, 0X86, 0X86, 0X86, 0X8B, 0X8B, 0X8B, 0X8B, - 0X8A, 0X8A, 0X8A, 0X8A, 0X8A, 0X8A, 0X89, 0X89, 0X89, 0X89, - 0X89, 0X89, 0X88, 0X88, 0X88, 0X88, 0X88, 0X88, 0X88, 0X87, - 0X87, 0X87, 0X87, 0X87, 0X87, 0X86, 0X86, 0X86, 0X8B, 0X8B, - 0X8B, 0X8B, 0X8A, 0X8A, 0X8A, 0X8A, 0X8A, 0X8A, 0X89, 0X89, - 0X89, 0X89, 0X89, 0X89, 0X88, 0X88, 0X88, 0X88, 0X88, 0X88, - 0X88, 0X87, 0X87, 0X87, 0X87, 0X87, 0X87, 0X86, 0X86, 0X86, - 0X85, 0X85, 0X85, 0X85, 0X84, 0X84, 0X84, 0X84, 0X84, 0X84, - 0X83, 0X83, 0X83, 0X83, 0X83, 0X83, 0X82, 0X82, 0X82, 0X82, - 0X82, 0X82, 0X82, 0X81, 0X81, 0X81, 0X81, 0X81, 0X81, 0X80, - 0X80, 0X80, 0X85, 0X85, 0X85, 0X85, 0X84, 0X84, 0X84, 0X84, - 0X84, 0X84, 0X83, 0X83, 0X83, 0X83, 0X83, 0X83, 0X82, 0X82, - 0X82, 0X82, 0X82, 0X82, 0X82, 0X81, 0X81, 0X81, 0X81, 0X81, - 0X81, 0X80, 0X80, 0X80, 0X85, 0X85, 0X85, 0X85, 0X84, 0X84, - 0X84, 0X84, 0X84, 0X84, 0X13, 0X83, 0X83, 0X83, 0X83, 0X83, - 0X82, 0X82, 0X82, 0X82, 0X82, 0X82, 0X82, 0X81, 0X81, 0X81, - 0X81, 0X81, 0X81, 0X80, 0X80, 0X80, 0X85, 0X85, 0X85, 0X85, - 0X84, 0X84, 0X84, 0X84, 0X84, 0X84, 0X13, 0X13, 0X83, 0X83, - 0X83, 0X83, 0X82, 0X82, 0X82, 0X82, 0X82, 0X82, 0X82, 0X81, - 0X81, 0X81, 0X81, 0X81, 0X81, 0X80, 0X80, 0X80, 0X85, 0X85, - 0X85, 0X85, 0X84, 0X84, 0X84, 0X84, 0X84, 0X84, 0X13, 0X13, - 0X13, 0X83, 0X83, 0X83, 0X82, 0X82, 0X82, 0X82, 0X82, 0X82, - 0X82, 0X81, 0X81, 0X81, 0X81, 0X81, 0X81, 0X80, 0X80, 0X80, - 0X85, 0X85, 0X85, 0X85, 0X84, 0X84, 0X84, 0X84, 0X84, 0X13, - 0X13, 0X13, 0X13, 0X13, 0X83, 0X83, 0X82, 0X82, 0X82, 0X82, - 0X82, 0X82, 0X82, 0X81, 0X81, 0X81, 0X81, 0X81, 0X81, 0X80, - 0X80, 0X80, 0X7F, 0X7F, 0X7F, 0X7F, 0X7E, 0X7E, 0X7E, 0X7E, - 0X7E, 0X13, 0X13, 0X13, 0X13, 0X13, 0X13, 0X45, 0X44, 0X44, - 0X44, 0X44, 0X44, 0X44, 0X44, 0X7D, 0X7D, 0X7D, 0X7D, 0X7D, - 0X7D, 0X7C, 0X7C, 0X7C, 0X7F, 0X7F, 0X7F, 0X7F, 0X7E, 0X7E, - 0X7E, 0X7E, 0X7E, 0X7E, 0X45, 0X45, 0X45, 0X45, 0X45, 0X45, - 0X44, 0X44, 0X44, 0X44, 0X44, 0X44, 0X44, 0X7D, 0X7D, 0X7D, - 0X7D, 0X7D, 0X7D, 0X7C, 0X7C, 0X7C, 0X7F, 0X7F, 0X7F, 0X7F, - 0X7E, 0X7E, 0X7E, 0X7E, 0X7E, 0X7E, 0X45, 0X45, 0X45, 0X45, - 0X45, 0X45, 0X44, 0X44, 0X44, 0X44, 0X44, 0X44, 0X44, 0X7D, - 0X7D, 0X7D, 0X7D, 0X7D, 0X7D, 0X7C, 0X7C, 0X7C, 0X7F, 0X7F, - 0X7F, 0X7F, 0X7E, 0X7E, 0X7E, 0X7E, 0X7E, 0X7E, 0X45, 0X45, - 0X45, 0X45, 0X45, 0X45, 0X44, 0X44, 0X44, 0X44, 0X44, 0X44, - 0X44, 0X7D, 0X7D, 0X7D, 0X7D, 0X7D, 0X7D, 0X7C, 0X7C, 0X7C, - 0X7F, 0X7F, 0X7F, 0X7F, 0X7E, 0X7E, 0X7E, 0X7E, 0X7E, 0X7E, - 0X45, 0X45, 0X45, 0X45, 0X45, 0X45, 0X44, 0X44, 0X44, 0X44, - 0X44, 0X44, 0X44, 0X7D, 0X7D, 0X7D, 0X7D, 0X7D, 0X7D, 0X7C, - 0X7C, 0X7C, 0X7F, 0X7F, 0X7F, 0X7F, 0X7E, 0X7E, 0X7E, 0X7E, - 0X7E, 0X7E, 0X45, 0X45, 0X45, 0X45, 0X45, 0X45, 0X05, 0X44, - 0X44, 0X44, 0X44, 0X44, 0X30, 0X30, 0X7D, 0X7D, 0X7D, 0X7D, - 0X7D, 0X7C, 0X7C, 0X7C, 0X7F, 0X7F, 0X7F, 0X7F, 0X7E, 0X7E, - 0X7E, 0X7E, 0X7E, 0X7E, 0X45, 0X45, 0X45, 0X45, 0X45, 0X05, - 0X05, 0X05, 0X0E, 0X0E, 0X0E, 0X0E, 0X30, 0X30, 0X30, 0X30, - 0X7D, 0X7D, 0X7D, 0X7C, 0X7C, 0X7C, 0X7B, 0X7B, 0X7B, 0X7B, - 0X7A, 0X7A, 0X7A, 0X7A, 0X7A, 0X7A, 0X79, 0X79, 0X79, 0X79, - 0X79, 0X05, 0X05, 0X0E, 0X0E, 0X0E, 0X0E, 0X0E, 0X30, 0X30, - 0X30, 0X30, 0X42, 0X42, 0X42, 0X78, 0X78, 0X78, 0X7B, 0X7B, - 0X7B, 0X7B, 0X7A, 0X7A, 0X7A, 0X7A, 0X7A, 0X7A, 0X79, 0X79, - 0X79, 0X79, 0X79, 0X79, 0X0E, 0X0E, 0X0E, 0X0E, 0X0E, 0X0E, - 0X30, 0X30, 0X30, 0X42, 0X42, 0X42, 0X42, 0X78, 0X78, 0X78, - 0X7B, 0X7B, 0X7B, 0X7B, 0X7A, 0X7A, 0X7A, 0X7A, 0X7A, 0X7A, - 0X79, 0X79, 0X79, 0X79, 0X79, 0X79, 0X0E, 0X0E, 0X0E, 0X0E, - 0X0E, 0X0E, 0X28, 0X28, 0X28, 0X28, 0X42, 0X42, 0X42, 0X78, - 0X78, 0X78, 0X7B, 0X7B, 0X7B, 0X7B, 0X7A, 0X7A, 0X7A, 0X7A, - 0X7A, 0X7A, 0X79, 0X79, 0X79, 0X79, 0X79, 0X79, 0X0E, 0X0E, - 0X0E, 0X0E, 0X0E, 0X0E, 0X28, 0X28, 0X28, 0X28, 0X28, 0X42, - 0X6A, 0X33, 0X78, 0X78, 0X7B, 0X7B, 0X7B, 0X7B, 0X7A, 0X7A, - 0X7A, 0X7A, 0X7A, 0X7A, 0X79, 0X79, 0X79, 0X79, 0X79, 0X79, - 0X0E, 0X0E, 0X0E, 0X0E, 0X43, 0X43, 0X28, 0X28, 0X28, 0X28, - 0X28, 0X6A, 0X33, 0X33, 0X33, 0X33, 0X7B, 0X7B, 0X7B, 0X7B, - 0X7A, 0X7A, 0X7A, 0X7A, 0X7A, 0X7A, 0X79, 0X79, 0X79, 0X79, - 0X79, 0X79, 0X43, 0X43, 0X43, 0X43, 0X43, 0X28, 0X28, 0X28, - 0X28, 0X28, 0X2D, 0X2D, 0X33, 0X33, 0X33, 0X33, 0X77, 0X77, - 0X77, 0X77, 0X76, 0X76, 0X76, 0X76, 0X76, 0X76, 0X75, 0X75, - 0X75, 0X75, 0X75, 0X75, 0X74, 0X74, 0X74, 0X74, 0X74, 0X74, - 0X28, 0X28, 0X28, 0X28, 0X2D, 0X2D, 0X2D, 0X33, 0X69, 0X69, - 0X77, 0X77, 0X77, 0X77, 0X76, 0X76, 0X76, 0X76, 0X76, 0X76, - 0X75, 0X75, 0X75, 0X75, 0X75, 0X75, 0X74, 0X74, 0X74, 0X74, - 0X74, 0X74, 0X74, 0X28, 0X41, 0X2D, 0X2D, 0X2D, 0X2D, 0X69, - 0X69, 0X69, 0X77, 0X77, 0X77, 0X77, 0X76, 0X76, 0X76, 0X76, - 0X76, 0X76, 0X75, 0X75, 0X75, 0X75, 0X75, 0X75, 0X74, 0X74, - 0X74, 0X74, 0X74, 0X74, 0X74, 0X41, 0X41, 0X41, 0X41, 0X2D, - 0X69, 0X69, 0X69, 0X0D, 0X91, 0X91, 0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 0X88, 0X87, 0X87, 0X87, - 0X87, 0X87, 0X87, 0X86, 0X86, 0X86, 0X8B, 0X8B, 0X8B, 0X8B, - 0X8A, 0X8A, 0X8A, 0X8A, 0X8A, 0X8A, 0X89, 0X89, 0X89, 0X89, - 0X89, 0X89, 0X88, 0X88, 0X88, 0X88, 0X88, 0X88, 0X88, 0X87, - 0X87, 0X87, 0X87, 0X87, 0X87, 0X86, 0X86, 0X86, 0X8B, 0X8B, - 0X8B, 0X8B, 0X8A, 0X8A, 0X8A, 0X8A, 0X8A, 0X8A, 0X89, 0X89, - 0X89, 0X89, 0X89, 0X89, 0X88, 0X88, 0X88, 0X88, 0X88, 0X88, - 0X88, 0X87, 0X87, 0X87, 0X87, 0X87, 0X87, 0X86, 0X86, 0X86, - 0X8B, 0X8B, 0X8B, 0X8B, 0X8A, 0X8A, 0X8A, 0X8A, 0X8A, 0X8A, - 0X89, 0X89, 0X89, 0X89, 0X89, 0X89, 0X88, 0X88, 0X88, 0X88, - 0X88, 0X88, 0X88, 0X87, 0X87, 0X87, 0X87, 0X87, 0X87, 0X86, - 0X86, 0X86, 0X8B, 0X8B, 0X8B, 0X8B, 0X8A, 0X8A, 0X8A, 0X8A, - 0X8A, 0X8A, 0X89, 0X89, 0X89, 0X89, 0X89, 0X89, 0X88, 0X88, - 0X88, 0X88, 0X88, 0X88, 0X88, 0X87, 0X87, 0X87, 0X87, 0X87, - 0X87, 0X86, 0X86, 0X86, 0X85, 0X85, 0X85, 0X85, 0X84, 0X84, - 0X84, 0X84, 0X84, 0X84, 0X83, 0X83, 0X83, 0X83, 0X83, 0X83, - 0X82, 0X82, 0X82, 0X82, 0X82, 0X82, 0X82, 0X81, 0X81, 0X81, - 0X81, 0X81, 0X81, 0X80, 0X80, 0X80, 0X85, 0X85, 0X85, 0X85, - 0X84, 0X84, 0X84, 0X84, 0X84, 0X84, 0X83, 0X83, 0X83, 0X83, - 0X83, 0X83, 0X82, 0X82, 0X82, 0X82, 0X82, 0X82, 0X82, 0X81, - 0X81, 0X81, 0X81, 0X81, 0X81, 0X80, 0X80, 0X80, 0X85, 0X85, - 0X85, 0X85, 0X84, 0X84, 0X84, 0X84, 0X84, 0X84, 0X83, 0X83, - 0X83, 0X83, 0X83, 0X83, 0X82, 0X82, 0X82, 0X82, 0X82, 0X82, - 0X82, 0X81, 0X81, 0X81, 0X81, 0X81, 0X81, 0X80, 0X80, 0X80, - 0X85, 0X85, 0X85, 0X85, 0X84, 0X84, 0X84, 0X84, 0X84, 0X84, - 0X83, 0X83, 0X83, 0X83, 0X83, 0X83, 0X82, 0X82, 0X82, 0X82, - 0X82, 0X82, 0X82, 0X81, 0X81, 0X81, 0X81, 0X81, 0X81, 0X80, - 0X80, 0X80, 0X85, 0X85, 0X85, 0X85, 0X84, 0X84, 0X84, 0X84, - 0X84, 0X84, 0X83, 0X83, 0X83, 0X83, 0X83, 0X83, 0X82, 0X82, - 0X82, 0X82, 0X82, 0X82, 0X82, 0X81, 0X81, 0X81, 0X81, 0X81, - 0X81, 0X80, 0X80, 0X80, 0X85, 0X85, 0X85, 0X85, 0X84, 0X84, - 0X84, 0X84, 0X84, 0X84, 0X83, 0X83, 0X83, 0X83, 0X83, 0X83, - 0X82, 0X82, 0X82, 0X82, 0X82, 0X82, 0X82, 0X81, 0X81, 0X81, - 0X81, 0X81, 0X81, 0X80, 0X80, 0X80, 0X7F, 0X7F, 0X7F, 0X7F, - 0X7E, 0X7E, 0X7E, 0X7E, 0X7E, 0X7E, 0X13, 0X45, 0X45, 0X45, - 0X45, 0X45, 0X44, 0X44, 0X44, 0X44, 0X44, 0X44, 0X44, 0X7D, - 0X7D, 0X7D, 0X7D, 0X7D, 0X7D, 0X7C, 0X7C, 0X7C, 0X7F, 0X7F, - 0X7F, 0X7F, 0X7E, 0X7E, 0X7E, 0X7E, 0X7E, 0X7E, 0X45, 0X45, - 0X45, 0X45, 0X45, 0X45, 0X44, 0X44, 0X44, 0X44, 0X44, 0X44, - 0X44, 0X7D, 0X7D, 0X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79, 0X79, 0X79, 0X79, 0X43, 0X43, 0X43, 0X43, - 0X43, 0X43, 0X30, 0X30, 0X42, 0X42, 0X42, 0X42, 0X42, 0X78, - 0X78, 0X78, 0X7B, 0X7B, 0X7B, 0X7B, 0X7A, 0X7A, 0X7A, 0X7A, - 0X7A, 0X7A, 0X79, 0X79, 0X79, 0X79, 0X79, 0X79, 0X43, 0X43, - 0X43, 0X43, 0X43, 0X43, 0X43, 0X42, 0X42, 0X42, 0X42, 0X42, - 0X42, 0X78, 0X78, 0X78, 0X7B, 0X7B, 0X7B, 0X7B, 0X7A, 0X7A, - 0X7A, 0X7A, 0X7A, 0X7A, 0X79, 0X79, 0X79, 0X79, 0X79, 0X79, - 0X43, 0X43, 0X43, 0X43, 0X43, 0X43, 0X28, 0X28, 0X42, 0X42, - 0X42, 0X42, 0X42, 0X78, 0X78, 0X78, 0X7B, 0X7B, 0X7B, 0X7B, - 0X7A, 0X7A, 0X7A, 0X7A, 0X7A, 0X7A, 0X79, 0X79, 0X79, 0X79, - 0X79, 0X79, 0X43, 0X43, 0X43, 0X43, 0X43, 0X43, 0X28, 0X28, - 0X28, 0X28, 0X42, 0X42, 0X42, 0X78, 0X78, 0X78, 0X7B, 0X7B, - 0X7B, 0X7B, 0X7A, 0X7A, 0X7A, 0X7A, 0X7A, 0X7A, 0X79, 0X79, - 0X79, 0X79, 0X79, 0X79, 0X43, 0X43, 0X43, 0X43, 0X43, 0X43, - 0X28, 0X28, 0X28, 0X28, 0X28, 0X2D, 0X2D, 0X33, 0X33, 0X78, - 0X7B, 0X7B, 0X7B, 0X7B, 0X7A, 0X7A, 0X7A, 0X7A, 0X7A, 0X7A, - 0X79, 0X79, 0X79, 0X79, 0X79, 0X79, 0X43, 0X43, 0X43, 0X43, - 0X43, 0X43, 0X28, 0X28, 0X28, 0X28, 0X2D, 0X2D, 0X2D, 0X33, - 0X33, 0X69, 0X77, 0X77, 0X77, 0X77, 0X76, 0X76, 0X76, 0X76, - 0X76, 0X76, 0X75, 0X75, 0X75, 0X75, 0X75, 0X75, 0X74, 0X74, - 0X74, 0X74, 0X74, 0X74, 0X28, 0X28, 0X28, 0X2D, 0X2D, 0X2D, - 0X2D, 0X69, 0X69, 0X69, 0X77, 0X77, 0X77, 0X77, 0X76, 0X76, - 0X76, 0X76, 0X76, 0X76, 0X75, 0X75, 0X75, 0X75, 0X75, 0X75, - 0X74, 0X74, 0X74, 0X74, 0X74, 0X74, 0X74, 0X41, 0X41, 0X41, - 0X2D, 0X2D, 0X2D, 0X69, 0X69, 0X0D, 0X77, 0X77, 0X77, 0X77, - 0X76, 0X76, 0X76, 0X76, 0X76, 0X76, 0X75, 0X75, 0X75, 0X75, - 0X75, 0X75, 0X74, 0X74, 0X74, 0X74, 0X74, 0X74, 0X74, 0X41, - 0X41, 0X41, 0X41, 0X2D, 0X2D, 0X69, 0X0D, 0X0D -}; - - -} // End of namespace Lab diff --git a/engines/lab/special.cpp b/engines/lab/special.cpp index abdbc735d3..495fe455c4 100644 --- a/engines/lab/special.cpp +++ b/engines/lab/special.cpp @@ -28,6 +28,11 @@ * */ +#include "common/translation.h" + +#include "gui/message.h" +#include "gui/saveload.h" + #include "lab/lab.h" #include "lab/labfun.h" #include "lab/parsefun.h" @@ -40,12 +45,6 @@ #include "lab/stddefines.h" #include "lab/parsetypes.h" -#define MODERNGAMESAVE 1 - -#if defined(MODERNGAMESAVE) -#include "lab/modernsavegame.h" -#endif - namespace Lab { #ifdef GAME_TRIAL @@ -109,7 +108,7 @@ static byte *loadBackPict(const char *fileName, bool tomem) { static Image *Images[10]; -uint16 combination[6] = {0, 0, 0, 0, 0, 0}, solution[] = {0, 4, 0, 8, 7, 2}; +byte combination[6] = {0, 0, 0, 0, 0, 0}, solution[] = {0, 4, 0, 8, 7, 2}; static uint16 combx[] = {45, 83, 129, 166, 211, 248}; @@ -942,528 +941,57 @@ void doJournal() { ungetVGABaseAddr(); } +/* +struct SaveGameInfo { + unsigned short RoomNumber; + unsigned short Direction; + byte *SaveGameImage; + char SaveGameDate[128]; +}; +int getSaveGameList(SaveGameInfo *info, int maxNum); +*/ -/*---------------------------------------------------------------------------*/ -/*------------------------- The Save/Restore stuff --------------------------*/ -/*---------------------------------------------------------------------------*/ - - -Image *Arrow1, *NoArrow1, *DriveButton; - +#define QUARTERNUM 30 extern InventoryData *Inventory; extern uint16 RoomNum, Direction; -extern char *SAVETEXT, *LOADTEXT, *BOOKMARKTEXT, *PERSONALTEXT, *DISKTEXT, *SAVEBOOK, *RESTOREBOOK, *SAVEFLASH, *RESTOREFLASH, *SAVEDISK, *RESTOREDISK, *SELECTDISK, *NODISKINDRIVE, *WRITEPROTECTED, *FORMATFLOPPY, *FORMATTING; - -static uint16 device; - -#define MAXDEVNAMES 5 - -static char DriveName[5] [MAXDEVNAMES]; - - - - - - -/*----- Gets the devices -----*/ - -/*****************************************************************************/ -/* Finds all the disk drives, puts them in an array of strings, sorts them, */ -/* and returned the number of drives that it found. */ -/*****************************************************************************/ -uint16 doDisks(void) { - char str[5]; - str[0] = 'C'; - str[1] = ':'; - str[2] = '\\'; - str[3] = 0; - strcpy(DriveName[0], str); - return 1; -} - -/*****************************************************************************/ -/* Does the user interface to save or restore a game position */ -/*****************************************************************************/ -#if defined(MODERNGAMESAVE) - -extern const byte ThePalMap[]; - -void getRoomMessage(int MyRoomNum, int MyDirection, char *msg); - -#define QUARTERNUM 30 - -#define NEXTEMPTYSLOTTEXT "Next Empty Slot" - -extern char g_SaveGamePath[512]; -extern char g_PathSeperator[4]; - -SaveGameInfo g_SaveGameInfo[MAX_SAVED_GAMES]; -int g_TotalSavedGames; -char g_CommonPalette[3 * 256]; -int g_LastSaveGameNumber = 0; -int g_CurSaveGameNumber = 0; -int g_CurSaveSet = 0; -int g_PendingNewSave = 0; - -enum UI_Ident { - ID_SAVE, - ID_LOAD, - ID_NEWSLOT, - ID_1_TO_5, - ID_6_TO_10, - ID_11_TO_15, - ID_SLOT_A, - ID_SLOT_B, - ID_SLOT_C, - ID_SLOT_D, - ID_SLOT_E, - ID_CANCEL, - ID_LAST -}; - -struct ModernUI { - int id; - int x, y, w, h; -}; - -ModernUI theUI[ID_LAST] = { - { ID_LOAD, 491, 182, 128, 54 }, - { ID_SAVE, 491, 255, 128, 54 }, - { ID_NEWSLOT, 491, 328, 128, 54 }, - { ID_1_TO_5, 27, 40, 146, 25 }, - { ID_6_TO_10, 175, 40, 146, 25 }, - { ID_11_TO_15, 323, 40, 146, 25 }, - { ID_SLOT_A, 27, 67, 442, 72 }, - { ID_SLOT_B, 27, 142, 442, 72 }, - { ID_SLOT_C, 27, 217, 442, 72 }, - { ID_SLOT_D, 27, 292, 442, 72 }, - { ID_SLOT_E, 27, 367, 442, 72 }, - { ID_CANCEL, 531, 405, 52, 52 } -}; - -enum { - SG_BLACK = 1, - SG_TAN = 14, - SG_DKTAN = 38, - SG_WHITE = 105, - SG_YELLOW = 118 -}; - -/*****************************************************************************/ -/* Draw display */ -/*****************************************************************************/ -static void flowTextBold(void *font, /* the TextAttr pointer */ - uint16 spacing, /* How much vertical spacing between the lines */ - uint16 pencolor, /* pen number to use for text */ - uint16 backpen, /* the background color */ - bool outline, /* Whether to outline in background color */ - bool centerh, /* Whether to center the text horizontally */ - bool centerv, /* Whether to center the text vertically */ - bool output, /* Whether to output any text */ - uint16 x1, /* Cords */ - uint16 y1, uint16 x2, uint16 y2, const char *text) { /* The text itself */ - - if (outline) { - flowText(font, spacing, backpen, 0, false, centerh, centerv, output, x1 - 1, y1, x2 - 1, y2, text); - flowText(font, spacing, backpen, 0, false, centerh, centerv, output, x1 - 1, y1 - 1, x2 - 1, y2 - 1, text); - flowText(font, spacing, backpen, 0, false, centerh, centerv, output, x1, y1 + 2, x2, y2 + 2, text); - flowText(font, spacing, backpen, 0, false, centerh, centerv, output, x1 - 1, y1 + 2, x2 - 1, y2 + 2, text); - flowText(font, spacing, backpen, 0, false, centerh, centerv, output, x1 + 2, y1, x2 + 2, y2, text); - flowText(font, spacing, backpen, 0, false, centerh, centerv, output, x1 + 2, y1 + 2, x2 + 2, y2 + 2, text); - flowText(font, spacing, backpen, 0, false, centerh, centerv, output, x1, y1 - 1, x2, y2 - 1, text); - flowText(font, spacing, backpen, 0, false, centerh, centerv, output, x1 + 2, y1 - 1, x2 + 2, y2 - 1, text); - } - - flowText(font, spacing, pencolor, 0, false, centerh, centerv, output, x1, y1, x2, y2, text); - flowText(font, spacing, pencolor, 0, false, centerh, centerv, output, x1 + 1, y1, x2 + 1, y2, text); - flowText(font, spacing, pencolor, 0, false, centerh, centerv, output, x1, y1 + 1, x2, y2 + 1, text); - flowText(font, spacing, pencolor, 0, false, centerh, centerv, output, x1 + 1, y1 + 1, x2 + 1, y2 + 1, text); -} - -/*****************************************************************************/ -/* Draw display */ -/*****************************************************************************/ -static void flowTextShadow(void *font, /* the TextAttr pointer */ - uint16 spacing, /* How much vertical spacing between the lines */ - uint16 pencolor, /* pen number to use for text */ - uint16 backpen, /* the background color */ - bool outline, /* Whether to outline in background color */ - bool centerh, /* Whether to center the text horizontally */ - bool centerv, /* Whether to center the text vertically */ - bool output, /* Whether to output any text */ - uint16 x1, /* Cords */ - uint16 y1, uint16 x2, uint16 y2, char *text) { /* The text itself */ - - if (outline) { - flowText(font, spacing, backpen, 0, false, centerh, centerv, output, x1 - 1, y1 - 1, x2 - 1, y2 - 1, text); - flowText(font, spacing, backpen, 0, false, centerh, centerv, output, x1 - 1, y1 + 1, x2 - 1, y2 + 1, text); - flowText(font, spacing, backpen, 0, false, centerh, centerv, output, x1 + 1, y1 + 1, x2 + 1, y2 + 1, text); - flowText(font, spacing, backpen, 0, false, centerh, centerv, output, x1 + 1, y1 - 1, x2 + 1, y2 - 1, text); - } - - flowText(font, spacing, pencolor, 0, false, centerh, centerv, output, x1, y1, x2, y2, text); -} - -static void drawSaveLoad() { - int i, j; - - flowTextBold(MsgFont, 0, g_CurSaveGameNumber < g_TotalSavedGames ? SG_YELLOW : SG_DKTAN, SG_BLACK, true, true, true, true, 491 + 3, 182, 619 + 3, 236, LOADTEXT); - flowTextBold(MsgFont, 0, g_TotalSavedGames + g_PendingNewSave > 0 ? SG_YELLOW : SG_DKTAN, SG_BLACK, true, true, true, true, 491 + 3, 255, 619 + 3, 309, SAVETEXT); - flowTextBold(MsgFont, 0, g_PendingNewSave ? SG_DKTAN : SG_YELLOW, SG_BLACK, true, true, true, true, 491 + 3, 328, 619 + 3, 382, NEXTEMPTYSLOTTEXT); - - flowTextBold(MsgFont, 0, (g_CurSaveSet == 0 ? SG_YELLOW : SG_WHITE), SG_BLACK, true, true, true, true, 27 + 3, 40, 175 + 3, 65, "Saves 1-5"); - flowTextBold(MsgFont, 0, (g_CurSaveSet == 1 ? SG_YELLOW : SG_WHITE), SG_BLACK, true, true, true, true, 175 + 3, 40, 321 + 3, 65, "Saves 6-10"); - flowTextBold(MsgFont, 0, (g_CurSaveSet == 2 ? SG_YELLOW : SG_WHITE), SG_BLACK, true, true, true, true, 323 + 3, 40, 469 + 3, 65, "Saves 11-15"); - - for (i = 0, j = 5 * g_CurSaveSet; i < 5; i++, j++) { - uint16 hue, y; - char num_text[4]; - Image thumbnail, screen; - - if (j < g_TotalSavedGames + g_PendingNewSave) { - char msg[256]; - - getRoomMessage(g_SaveGameInfo[j].RoomNumber, g_SaveGameInfo[j].Direction, msg); - - hue = (j == g_CurSaveGameNumber ? SG_YELLOW : SG_WHITE); - y = 67 + 2 + i * 75; - flowText(MsgFont, 0, hue, 0, false, false, false, true, 202 + 2, y, 469 - 2, y + 48, msg); - y += 46; - flowText(MsgFont, 0, hue, 0, false, false, false, true, 202 + 2, y, 469 - 2, y + 24, g_SaveGameInfo[j].SaveGameDate); - - // blast image - thumbnail.Width = 128; - thumbnail.Height = 72; - thumbnail.ImageData = g_SaveGameInfo[j].SaveGameImage; - screen.Width = VGAScreenWidth; - screen.Height = VGAScreenHeight; - screen.ImageData = getVGABaseAddr(); - bltBitMap(&thumbnail, 0, 0, &screen, 72, 67 + i * 75, 128, 72); - ungetVGABaseAddr(); - - hue = (j == g_CurSaveGameNumber ? SG_YELLOW : SG_WHITE); - } else { - y = 67 + 2 + i * 75; - flowText(MsgFont, 0, SG_TAN, 0, false, true, true, true, 202 + 2, y, 469 - 2, y + 70, "[Empty Slot]"); - - hue = SG_DKTAN; - } - - y = 67 + i * 75; - sprintf(num_text, "%d", j + 1); - flowTextShadow(BigMsgFont, 0, hue, SG_BLACK, true, true, true, true, 27 + 4, y, 72 + 4, y + 72, num_text); - } - - // Add ".1" to version number - setAPen(SG_WHITE); - rectFill(271, 454, 271, 454); - rectFill(275, 449, 275, 454); - rectFill(274, 450, 274, 450); - rectFill(274, 454, 276, 454); - - WSDL_UpdateScreen(); -} - -static void makeThumbnail(SaveGameInfo *info) { - char *pictName; - CloseDataPtr CPtr = NULL; - byte *BitMapMem; - int x, y, u, v; - - // load pict - pictName = getPictName(&CPtr); - nopalchange = true; - BitMapMem = readPictToMem(pictName, VGAScreenWidth, VGAScreenHeight); - nopalchange = false; - - for (y = 0; y < 72; y++) { - for (x = 0; x < 128; x++) { - unsigned int r = 0, g = 0, b = 0; - - for (v = 5 * y; v < 5 * y + 5; v++) { - for (u = 5 * x; u < 5 * x + 5; u++) { - byte n = (byte)BitMapMem[u + v * VGAScreenWidth]; - // 6-bit color (VGA) - r += (unsigned int)diffcmap[3 * n + 0]; - g += (unsigned int)diffcmap[3 * n + 1]; - b += (unsigned int)diffcmap[3 * n + 2]; - } +bool saveRestoreGame(void) { + bool isOK = false; + + // The original had one screen for saving/loading. We have two. + // Ask the user which screen to use. + GUI::MessageDialog saveOrLoad(_("Would you like to save or restore a game?"), _("Save"), _("Restore")); + + int choice = saveOrLoad.runModal(); + if (choice == GUI::kMessageOK) { + // Save + GUI::SaveLoadChooser *dialog = new GUI::SaveLoadChooser(_("Save game:"), _("Save"), true); + int slot = dialog->runModalWithCurrentTarget(); + if (slot >= 0) { + Common::String desc = dialog->getResultString(); + + if (desc.empty()) { + // create our own description for the saved game, the user didn't enter it + desc = dialog->createDefaultSaveDescription(slot); } - r = (r / 25) >> 1; - g = (g / 25) >> 1; - b = (b / 25) >> 1; - warning("STUB: makeThumbnail"); - info->SaveGameImage[x + 128 * y] = ThePalMap[(r << 10) | (g << 5) | b]; + isOK = saveGame(RoomNum, Direction, Inventory[QUARTERNUM].Many, slot, desc); } - } -} - -static void addSaveSlot() { - SaveGameInfo *info; - - if (g_PendingNewSave || g_TotalSavedGames == MAX_SAVED_GAMES) - return; - - g_PendingNewSave = 1; - g_CurSaveGameNumber = g_TotalSavedGames; - g_CurSaveSet = g_CurSaveGameNumber / 5; - - // set-up saved game - info = &g_SaveGameInfo[g_CurSaveGameNumber]; - info->RoomNumber = RoomNum; - info->Direction = Direction; - - // not really a date yet - strcpy(info->SaveGameDate, "Click SAVE GAME to Confirm"); - - info->SaveGameImage = (byte *)malloc(SAVED_IMAGE_SIZE); - makeThumbnail(info); - - mouseHide(); - WSDL_IgnoreUpdateDisplay(1); - loadBackPict("P:ModSave", false); - WSDL_IgnoreUpdateDisplay(0); - drawSaveLoad(); - mouseShow(); -} - -static void selectSave(int n) { - if (g_CurSaveGameNumber == n || n >= g_TotalSavedGames + g_PendingNewSave) - return; - - g_CurSaveGameNumber = n; - - mouseHide(); - WSDL_IgnoreUpdateDisplay(1); - loadBackPict("P:ModSave", false); - WSDL_IgnoreUpdateDisplay(0); - drawSaveLoad(); - mouseShow(); -} - -static void selectSaveSet(int n) { - if (g_CurSaveSet != n) { - g_CurSaveSet = n; - - mouseHide(); - WSDL_IgnoreUpdateDisplay(1); - loadBackPict("P:ModSave", false); - WSDL_IgnoreUpdateDisplay(0); - drawSaveLoad(); - mouseShow(); - } -} - -/*****************************************************************************/ -/* Do modern save. */ -/*****************************************************************************/ -static bool doSaveGame() { - bool isok; - char DrivePath[260]; - - if (g_CurSaveGameNumber != g_TotalSavedGames) { - makeThumbnail(&g_SaveGameInfo[g_CurSaveGameNumber]); } else { - // set time of save for new saved game - //struct tm *create_date; - //time_t ticks; - - warning("STUB: doSaveGame"); - //ticks = time(NULL); - //create_date = localtime(&ticks); - //strcpy(g_SaveGameInfo[g_CurSaveGameNumber].SaveGameDate, asctime(create_date)); + // Restore + GUI::SaveLoadChooser *dialog = new GUI::SaveLoadChooser(_("Restore game:"), _("Restore"), false); + int slot = dialog->runModalWithCurrentTarget(); + if (slot >= 0) + isOK = loadGame(&RoomNum, &Direction, &(Inventory[QUARTERNUM].Many), slot); } - memcpy(g_SaveGameImage, g_SaveGameInfo[g_CurSaveGameNumber].SaveGameImage, SAVED_IMAGE_SIZE); - - sprintf(DrivePath, "%s%s%d", g_SaveGamePath, g_PathSeperator, g_CurSaveGameNumber); - - isok = saveFloppy(DrivePath, RoomNum, Direction, Inventory[QUARTERNUM].Many, g_CurSaveGameNumber, device); - g_music->resetMusic(); - - if (isok) - g_LastSaveGameNumber = g_CurSaveGameNumber; - - return isok; -} - -/*****************************************************************************/ -/* Do modern load. */ -/*****************************************************************************/ -static bool doLoadGame() { - bool isok; - char drivePath[260]; - - snprintf(drivePath, 260, "%s%s%d", g_SaveGamePath, g_PathSeperator, g_CurSaveGameNumber); - - isok = readFloppy(drivePath, &RoomNum, &Direction, &(Inventory[QUARTERNUM].Many), g_CurSaveGameNumber, device); - g_music->resetMusic(); - - if (isok) - g_LastSaveGameNumber = g_CurSaveGameNumber; - - return isok; -} - -/*****************************************************************************/ -/* Processes user input. */ -/*****************************************************************************/ -static bool processSaveLoad() { - IntuiMessage *Msg; - - uint32 Class; - uint16 Qualifier, MouseX, MouseY, Code; - int i; - - drawSaveLoad(); - - while (1) { - g_music->checkMusic(); /* Make sure we check the music at least after every message */ - Msg = getMsg(); - - if (Msg == NULL) { - g_music->newCheckMusic(); - } else { - Class = Msg->Class; - Qualifier = Msg->Qualifier; - MouseX = Msg->MouseX; - MouseY = Msg->MouseY; - Code = Msg->Code; - - replyMsg(Msg); - - if (((Class == MOUSEBUTTONS) && (IEQUALIFIER_RBUTTON & Qualifier)) || - ((Class == RAWKEY) && (Code == 27))) - return true; - - if (Class == RAWKEY) { - if (Code == 'l' || Code == 'L') { - if (g_CurSaveGameNumber < g_TotalSavedGames) - return doLoadGame(); - } else if (Code == 's' || Code == 'S') { - if (g_TotalSavedGames + g_PendingNewSave > 0) - return doSaveGame(); - } else if (Code == 'n' || Code == 'N') { - addSaveSlot(); - } else if (Code == VKEY_LTARROW) { - i = g_CurSaveSet - 1; - - if (i < 0) i = 2; - - selectSaveSet(i); - } else if (Code == VKEY_RTARROW) { - i = g_CurSaveSet + 1; - - if (i > 2) i = 0; - - selectSaveSet(i); - } else if (Code == VKEY_UPARROW) { - if (g_TotalSavedGames + g_PendingNewSave > 0) { - i = g_CurSaveGameNumber - 1; - - if (i < 0) - i = g_TotalSavedGames + g_PendingNewSave - 1; - - if (i / 5 != g_CurSaveSet) - selectSaveSet(i / 5); - - selectSave(i); - } - } else if (Code == VKEY_DNARROW) { - if (g_TotalSavedGames + g_PendingNewSave > 0) { - i = g_CurSaveGameNumber + 1; - - if (i >= g_TotalSavedGames + g_PendingNewSave) - i = 0; - - if (i / 5 != g_CurSaveSet) - selectSaveSet(i / 5); - - selectSave(i); - } - } - } else if ((Class == MOUSEBUTTONS) && (IEQUALIFIER_LEFTBUTTON & Qualifier)) { - for (i = 0; i < ID_LAST; i++) { - if (MouseX >= theUI[i].x && MouseY >= theUI[i].y && - MouseX < theUI[i].x + theUI[i].w && MouseY < theUI[i].y + theUI[i].h) { - switch (theUI[i].id) { - case ID_SAVE: - if (g_TotalSavedGames + g_PendingNewSave > 0) - return doSaveGame(); - - break; - - case ID_LOAD: - if (g_CurSaveGameNumber < g_TotalSavedGames) - return doLoadGame(); - - break; - - case ID_NEWSLOT: - addSaveSlot(); - break; - - case ID_1_TO_5: - case ID_6_TO_10: - case ID_11_TO_15: - selectSaveSet(theUI[i].id - ID_1_TO_5); - break; - - case ID_SLOT_A: - case ID_SLOT_B: - case ID_SLOT_C: - case ID_SLOT_D: - case ID_SLOT_E: - selectSave(5 * g_CurSaveSet + theUI[i].id - ID_SLOT_A); - break; - - case ID_CANCEL: - return true; - } - } - } - } - } - } -} - -bool saveRestoreGame(void) { - byte **buffer; - bool isok = true; - - blackAllScreen(); - - BigMsgFont = &bmfont; - - if (!getFont("P:Map.fon", BigMsgFont)) { - BigMsgFont = NULL; - return false; - } - - buffer = g_music->newOpen("P:ModSave"); - - if (!buffer) { - freeAllStolenMem(); + if (!isOK) return false; - } - - g_TotalSavedGames = getSaveGameList(g_SaveGameInfo, MAX_SAVED_GAMES); - g_CurSaveGameNumber = g_LastSaveGameNumber; - g_CurSaveSet = g_CurSaveGameNumber / 5; - g_PendingNewSave = 0; - - loadBackPict("P:ModSave", false); - - mouseShow(); - VGASetPal(diffcmap, 256); - memcpy(g_CommonPalette, diffcmap, 3 * 256); + g_music->resetMusic(); - isok = processSaveLoad(); eatMessages(); mouseHide(); @@ -1478,373 +1006,9 @@ bool saveRestoreGame(void) { freeAllStolenMem(); - freeSaveGameList(g_SaveGameInfo, g_TotalSavedGames); - - return isok; -} -#else - -static uint16 manydisks = 0; - -static uint16 issave, ghoast, arrow, ManyDrives, DriveInitX, DriveNum = -1, FileNum = -1; - -/*****************************************************************************/ -/* Draws the number arrows. */ -/*****************************************************************************/ -static void doNumArrows(void) { - uint16 counterx, countery, curnum, cordx[3], cordy[3]; - - cordx[0] = VGAScaleX(53) + SVGACord(3); - cordx[1] = VGAScaleX(126) + SVGACord(1); - cordx[2] = VGAScaleX(197) + SVGACord(3); - - cordy[0] = VGAScaleY(58) + SVGACord(2); - cordy[1] = VGAScaleY(86) + SVGACord(3); - cordy[2] = VGAScaleY(114) + SVGACord(3); - - mouseHide(); - - for (countery = 0; countery < 3; countery++) { - for (counterx = 0; counterx < 3; counterx++) { - curnum = countery + counterx * 3; - - if INBIT(arrow, curnum) - drawImage(Arrow1, cordx[counterx], cordy[countery]); - else - drawImage(NoArrow1, cordx[counterx], (int32) cordy[countery]); - - if INBIT(ghoast, curnum) - ghoastRect(0, cordx[counterx], cordy[countery], cordx[counterx] + VGAScaleX(69), cordy[countery] + NoArrow1->Height); - } - } - - mouseShow(); -} - -/*****************************************************************************/ -/* Does the drive buttons for the final save/restore screen. */ -/*****************************************************************************/ -static void doDriveButtons(void) { - uint16 curx, counter; - - if (ManyDrives > 5) - ManyDrives = 5; - - DriveInitX = (VGAScreenWidth / 2) - ((ManyDrives * DriveButton->Width) / 2); - curx = DriveInitX; - - mouseHide(); - - for (counter = 0; counter < ManyDrives; counter++) { - drawImage(DriveButton, curx, VGAScaleY(153)); - - flowText(BigMsgFont, 0, 1, 0, false, true, true, true, curx + VGAScaleX(5), VGAScaleY(158), curx + DriveButton->Width - VGAScaleX(5), VGAScaleY(148) + DriveButton->Height, DriveName[counter]); - - curx += DriveButton->Width; - } - - mouseShow(); -} - - -static void drawSRMessage(char *rtext) { - mouseHide(); - flowText(BigMsgFont, 0, 1, 10, true, true, true, true, VGAScaleX(22), VGAScaleY(21), VGAScaleX(289), VGAScaleY(48), rtext); - mouseShow(); -} - -/*****************************************************************************/ -/* Draws the correct message to the message box. */ -/*****************************************************************************/ -static void doSaveRestoreText(void) { - char *rtext, text[100]; - - if (DriveNum >= ManyDrives) { - rtext = SELECTDISK; - } else if (issave) { - strcpy(text, SAVEDISK); - strcat(text, " "); - strcat(text, DriveName[DriveNum]); - rtext = text; - } else { - strcpy(text, RESTOREDISK); - strcat(text, " "); - strcat(text, DriveName[DriveNum]); - rtext = text; - } - - drawSRMessage(rtext); -} - -static uint16 processSaveRestore(uint16 type); - -static char DrivePath[50]; - -/*****************************************************************************/ -/* Checks for the existence of previous saved game positions on disk. */ -/*****************************************************************************/ -static void floppyCheckFiles(void) { - char temp[7], *name, len; - int fl; - uint16 counter; - - doSaveRestoreText(); - - arrow = 0; - ghoast = 0; - - strcpy(DrivePath, DriveName[DriveNum]); - strcat(DrivePath, "LabSaves"); - - warning("STUB: floppyCheckFiles"); - -#if 0 -#if defined(WIN32) - mkdir(DrivePath); -#else - mkdir(DrivePath, 0x644); -#endif - strcat(DrivePath, "\\"); - - len = strlen(DrivePath); - - for (counter = 0; counter < 9; counter++) { - name = numtostr(temp, counter); - strcat(DrivePath, name); - - if ((fl = open(DrivePath, O_RDONLY)) != -1) { - close(fl); - SETBIT(arrow, counter); - } else - SETBIT(ghoast, counter); - - DrivePath[len] = 0; - } -#endif -} - -/*****************************************************************************/ -/* Checks for the existence of previously saved game positions. */ -/*****************************************************************************/ -static void checkFiles(void) { - ghoast = -1; - arrow = 0; - - g_music->fillUpMusic(true); - - /* NYI: check for empty drive */ - floppyCheckFiles(); - - if (issave) - ghoast = 0; -} - -/*****************************************************************************/ -/* Processes user input. */ -/*****************************************************************************/ -static uint16 processSaveRestore(uint16 type) { - IntuiMessage *Msg; - - uint32 Class; - uint16 Qualifier, MouseX, MouseY, Code, Temp; - - while (1) { - g_music->checkMusic(); /* Make sure we check the music at least after every message */ - Msg = getMsg(); - - if (Msg == NULL) { - g_music->newCheckMusic(); - } else { - Class = Msg->Class; - Qualifier = Msg->Qualifier; - MouseX = Msg->MouseX; - MouseY = Msg->MouseY; - Code = Msg->Code; - - replyMsg(Msg); - - if (((Class == MOUSEBUTTONS) && (IEQUALIFIER_RBUTTON & Qualifier)) || - ((Class == RAWKEY) && (Code == 27))) - return -1; - - else if ((Class == MOUSEBUTTONS) && (IEQUALIFIER_LEFTBUTTON & Qualifier)) { - if (type == 0) { /* The save or restore screen */ - if ((MouseX >= VGAScaleX(64)) && (MouseX <= VGAScaleX(257))) { - if ((MouseY >= VGAScaleY(57)) && (MouseY <= VGAScaleY(92))) - return true; - else if ((MouseY >= VGAScaleY(108)) && (MouseY <= VGAScaleY(142))) - return false; - } - } - - else if (type == 2) { /* The files screen */ - if ((MouseY >= VGAScaleY(153)) && (MouseY <= VGAScaleY(180))) { /* the drive buttons */ - Temp = ((MouseX - DriveInitX) / DriveButton->Width); - - if (Temp < ManyDrives) { - DriveNum = Temp; - - fade(false, 0); - checkFiles(); - - loadBackPict("P:Disk/Nums.pic", false); - doNumArrows(); - doDriveButtons(); - doSaveRestoreText(); - - fade(true, 0); - } - } - - else if ((MouseX >= VGAScaleX(53)) && (MouseY >= VGAScaleY(58)) && - (MouseX <= VGAScaleX(266)) && (MouseY <= VGAScaleY(142))) { - MouseX = (MouseX - VGAScaleX(53)) / VGAScaleX(71); - MouseY = (MouseY - VGAScaleY(58)) / VGAScaleY(28); - - Temp = MouseY + (MouseX * 3); - - if (!(INBIT(ghoast, Temp))) { - - SETBIT(arrow, Temp); - doNumArrows(); - - FileNum = Temp; - return FileNum; - } - } - } - } - } - } -} - - - - -/*****************************************************************************/ -/* Sets up the Save or Restore screen. */ -/*****************************************************************************/ -static uint16 saveOrRestore(void) { - uint16 res; - - mouseHide(); - loadBackPict("P:Disk/Choose.pic", false); - - flowText(BigMsgFont, 0, 1, 4, false, true, true, true, VGAScaleX(74), VGAScaleY(65), VGAScaleX(247), VGAScaleY(84), SAVETEXT); - flowText(BigMsgFont, 0, 1, 4, false, true, true, true, VGAScaleX(74), VGAScaleY(116), VGAScaleX(247), VGAScaleY(135), LOADTEXT); - mouseShow(); - - fade(true, 0); - res = processSaveRestore(0); - fade(false, 0); - eatMessages(); - - return res; -} - - - - - -/*****************************************************************************/ -/* Sets up the final save/restore screen. */ -/*****************************************************************************/ -static uint16 saveRestore(void) { - uint16 res; - - loadBackPict("P:Disk/Nums.pic", false); - - if ((DriveNum < ManyDrives)) { - checkFiles(); - } else { - ghoast = -1; - arrow = 0; - } - - doNumArrows(); - doDriveButtons(); - doSaveRestoreText(); - g_music->newCheckMusic(); - - eatMessages(); - fade(true, 0); - res = processSaveRestore(2); - fade(false, 0); - - return res; -} - - -#define QUARTERNUM 30 - - -bool saveRestoreGame(void) { - uint16 filenum; - byte **buffer; - char temp[10], *name; - bool isok = true; - - blackAllScreen(); - - ManyDrives = doDisks(); - - FadePalette = hipal; - memset(&(hipal[0]), 0, 32L); - - BigMsgFont = &bmfont; - - if (!getFont("P:Map.fon", BigMsgFont)) { - BigMsgFont = NULL; - return false; - } - - buffer = g_music->newOpen("P:SaveImage"); - - if (!buffer) { - freeAllStolenMem(); - return false; - } - - readImage(buffer, &Arrow1); - readImage(buffer, &NoArrow1); - readImage(buffer, &DriveButton); - - mouseShow(); - - if ((issave = saveOrRestore()) != (uint16) - 1) { - eatMessages(); - - if ((filenum = saveRestore()) != (uint16) - 1) { - name = numtostr(temp, filenum); - strcat(DrivePath, name); - - eatMessages(); - - if (issave) - isok = saveFloppy(DrivePath, RoomNum, Direction, Inventory[QUARTERNUM].Many, filenum, device); - else { - isok = readFloppy(DrivePath, &RoomNum, &Direction, &(Inventory[QUARTERNUM].Many), filenum, device); - g_music->resetMusic(); - } - } - } - - mouseHide(); - setAPen(0); - rectFill(0, 0, VGAScreenWidth - 1, VGAScreenHeight - 1); - blackScreen(); - - journalCleanUp(); - - freeAllStolenMem(); - - return isok; + return true; } -#endif - - - /*---------------------------------------------------------------------------*/ /*--------------------------- The Monitors stuff ----------------------------*/ /*---------------------------------------------------------------------------*/ -- cgit v1.2.3 From 66486895906b18ef4c299496c7fd7e5963f7155b Mon Sep 17 00:00:00 2001 From: Filippos Karapetis Date: Thu, 19 Feb 2015 15:43:04 +0200 Subject: LAB: Remove the unused Cords struct --- engines/lab/labfun.h | 7 ------- 1 file changed, 7 deletions(-) diff --git a/engines/lab/labfun.h b/engines/lab/labfun.h index 69dc39dca1..4d1854f057 100644 --- a/engines/lab/labfun.h +++ b/engines/lab/labfun.h @@ -46,13 +46,6 @@ namespace Lab { #define EAST 2 #define WEST 3 - - -/* Generic co-ordinate define. */ -typedef struct { - uint16 x1, y1; -} Cords; - struct Image; struct TextFont; struct Gadget; -- cgit v1.2.3 From 95461c91616eda80b33cfec3597f8c3243748a89 Mon Sep 17 00:00:00 2001 From: Filippos Karapetis Date: Thu, 19 Feb 2015 15:46:34 +0200 Subject: LAB: Remove the journalCleanUp() wrapper --- engines/lab/special.cpp | 15 +-------------- 1 file changed, 1 insertion(+), 14 deletions(-) diff --git a/engines/lab/special.cpp b/engines/lab/special.cpp index 495fe455c4..3909d974b0 100644 --- a/engines/lab/special.cpp +++ b/engines/lab/special.cpp @@ -887,17 +887,6 @@ static void processJournal() { -/*****************************************************************************/ -/* Cleans up behind all memory allocations. */ -/*****************************************************************************/ -static void journalCleanUp(void) { - freeAllStolenMem(); -} - - - - - /*****************************************************************************/ /* Does the journal processing. */ /*****************************************************************************/ @@ -936,7 +925,7 @@ void doJournal() { rectFill(0, 0, VGAScreenWidth - 1, VGAScreenHeight - 1); blackScreen(); - journalCleanUp(); + freeAllStolenMem(); ungetVGABaseAddr(); } @@ -1002,8 +991,6 @@ bool saveRestoreGame(void) { blackScreen(); WSDL_UpdateScreen(); - journalCleanUp(); - freeAllStolenMem(); return true; -- cgit v1.2.3 From 5bc37fd878e89dbcf3312dedcb0b4cfcd89cda7f Mon Sep 17 00:00:00 2001 From: Filippos Karapetis Date: Thu, 19 Feb 2015 19:03:45 +0200 Subject: LAB: Fix loading of saved games --- engines/lab/savegame.cpp | 6 +++--- engines/lab/special.cpp | 24 ++++++------------------ 2 files changed, 9 insertions(+), 21 deletions(-) diff --git a/engines/lab/savegame.cpp b/engines/lab/savegame.cpp index 5cf0674852..4d40540ce4 100644 --- a/engines/lab/savegame.cpp +++ b/engines/lab/savegame.cpp @@ -219,7 +219,7 @@ bool loadGame(uint16 *RoomNum, uint16 *Direction, uint16 *Quarters, int slot) { CurTile[i][j] = file->readUint16LE(); // Breadcrumbs - for (i = 0; i < sizeof(BreadCrumbs); i++) { + for (i = 0; i < 128; i++) { BreadCrumbs[i].RoomNum = file->readUint16LE(); BreadCrumbs[i].Direction = file->readUint16LE(); } @@ -227,10 +227,10 @@ bool loadGame(uint16 *RoomNum, uint16 *Direction, uint16 *Quarters, int slot) { DroppingCrumbs = (BreadCrumbs[0].RoomNum != 0); FollowingCrumbs = false; - for (i = 0; i < sizeof(BreadCrumbs); i++) { + for (i = 0; i < 128; i++) { if (BreadCrumbs[i].RoomNum == 0) break; - NumCrumbs++; + NumCrumbs = i; } delete file; diff --git a/engines/lab/special.cpp b/engines/lab/special.cpp index 3909d974b0..ae9eb02a37 100644 --- a/engines/lab/special.cpp +++ b/engines/lab/special.cpp @@ -972,28 +972,16 @@ bool saveRestoreGame(void) { // Restore GUI::SaveLoadChooser *dialog = new GUI::SaveLoadChooser(_("Restore game:"), _("Restore"), false); int slot = dialog->runModalWithCurrentTarget(); - if (slot >= 0) + if (slot >= 0) { isOK = loadGame(&RoomNum, &Direction, &(Inventory[QUARTERNUM].Many), slot); + if (isOK) + g_music->resetMusic(); + } } - if (!isOK) - return false; - - g_music->resetMusic(); - - eatMessages(); - - mouseHide(); - memset(diffcmap, 0, 3 * 256); - VGASetPal(diffcmap, 256); - setAPen(0); - rectFill(0, 0, VGAScreenWidth - 1, VGAScreenHeight - 1); - blackScreen(); WSDL_UpdateScreen(); - - freeAllStolenMem(); - - return true; + + return isOK; } /*---------------------------------------------------------------------------*/ -- cgit v1.2.3 From d25d74ef2033835514242584562f7433deeb52c8 Mon Sep 17 00:00:00 2001 From: Filippos Karapetis Date: Thu, 19 Feb 2015 19:06:35 +0200 Subject: LAB: Remove leftover debug code --- engines/lab/special.cpp | 11 ----------- 1 file changed, 11 deletions(-) diff --git a/engines/lab/special.cpp b/engines/lab/special.cpp index ae9eb02a37..f9c793c8e3 100644 --- a/engines/lab/special.cpp +++ b/engines/lab/special.cpp @@ -930,17 +930,6 @@ void doJournal() { ungetVGABaseAddr(); } -/* -struct SaveGameInfo { - unsigned short RoomNumber; - unsigned short Direction; - byte *SaveGameImage; - char SaveGameDate[128]; -}; - -int getSaveGameList(SaveGameInfo *info, int maxNum); -*/ - #define QUARTERNUM 30 extern InventoryData *Inventory; -- cgit v1.2.3 From 7e0545cf6d3f4dd3628119cf61910be5ca0fb340 Mon Sep 17 00:00:00 2001 From: Filippos Karapetis Date: Fri, 20 Feb 2015 21:23:21 +0200 Subject: LAB: Remove unused byte swap code The relevant defines will be replaced with the ones from our common code --- engines/lab/machine.cpp | 130 ----------------------------------------------- engines/lab/stddefines.h | 16 ------ engines/lab/undiff.cpp | 69 ++----------------------- 3 files changed, 4 insertions(+), 211 deletions(-) diff --git a/engines/lab/machine.cpp b/engines/lab/machine.cpp index c1bdd003b8..3806b5f6e1 100644 --- a/engines/lab/machine.cpp +++ b/engines/lab/machine.cpp @@ -218,134 +218,4 @@ char *translateFileName(const char *filename) { return NewFileName; } -#if defined(USE_SWAP) - -uint16 swapUShort(uint16 value) { - char *b = (char *)&value; - char t = b[0]; - b[0] = b[1]; - b[1] = t; - return value; -} -uint16 *wapUShortPtsr(uint16 *ptr, int count) { - while (count-- > 0) { - char *b = (char *)ptr++; - char t = b[0]; - b[0] = b[1]; - b[1] = t; - } - - return ptr; -} -int16 swapShort(int16 value) { - char *b = (char *)&value; - char t = b[0]; - b[0] = b[1]; - b[1] = t; - return value; -} -int16 *swapShortPtr(int16 *ptr, int count) { - while (count-- > 0) { - char *b = (char *)ptr++; - char t = b[0]; - b[0] = b[1]; - b[1] = t; - } - - return ptr; -} -unsigned int swapUInt(unsigned int value) { - char *b = (char *)&value; - char t = b[0]; - b[0] = b[3]; - b[3] = t; - t = b[1]; - b[1] = b[2]; - b[2] = t; - return value; -} -unsigned int *swapUIntPtr(unsigned int *ptr, int count) { - while (count-- > 0) { - char *b = (char *)ptr++; - char t = b[0]; - b[0] = b[3]; - b[3] = t; - t = b[1]; - b[1] = b[2]; - b[2] = t; - } - - return ptr; -} -int swapInt(int value) { - char *b = (char *)&value; - char t = b[0]; - b[0] = b[3]; - b[3] = t; - t = b[1]; - b[1] = b[2]; - b[2] = t; - return value; -} -int *swapIntPtr(int *ptr, int count) { - while (count-- > 0) { - char *b = (char *)ptr++; - char t = b[0]; - b[0] = b[3]; - b[3] = t; - t = b[1]; - b[1] = b[2]; - b[2] = t; - } - - return ptr; -} -uint32 swapULong(uint32 value) { - char *b = (char *)&value; - char t = b[0]; - b[0] = b[3]; - b[3] = t; - t = b[1]; - b[1] = b[2]; - b[2] = t; - return value; -} -uint32 *swapULongPtr(uint32 *ptr, int count) { - while (count-- > 0) { - char *b = (char *)ptr++; - char t = b[0]; - b[0] = b[3]; - b[3] = t; - t = b[1]; - b[1] = b[2]; - b[2] = t; - } - - return ptr; -} -int32 swapLong(int32 value) { - char *b = (char *)&value; - char t = b[0]; - b[0] = b[3]; - b[3] = t; - t = b[1]; - b[1] = b[2]; - b[2] = t; - return value; -} -int32 *swapLongPtr(int32 *ptr, int count) { - while (count-- > 0) { - char *b = (char *)ptr++; - char t = b[0]; - b[0] = b[3]; - b[3] = t; - t = b[1]; - b[1] = b[2]; - b[2] = t; - } - - return ptr; -} -#endif - } // End of namespace Lab diff --git a/engines/lab/stddefines.h b/engines/lab/stddefines.h index 3729084618..67bd39a47d 100644 --- a/engines/lab/stddefines.h +++ b/engines/lab/stddefines.h @@ -38,14 +38,12 @@ namespace Lab { #define IS_MACOSX 1 -#define USE_NOSWAP 1 #if defined(IS_MACOSX) #define getTime Lab_GetTime #define delay Lab_Delay #endif -#if defined(USE_NOSWAP) #define swapUShort(value) (value) #define swapUShortPtr(ptr,count) (ptr) #define swapShort(value) (value) @@ -58,20 +56,6 @@ namespace Lab { #define swapULongPtr(ptr,count) (ptr) #define swapLong(value) (value) #define swapLongPtr(ptr,count) (ptr) -#else -uint16 swapUShort(uint16 value); -uint16 *swapUShortPtr(uint16 *ptr, int count); -int16 swapShort(int16 value); -int16 *swapShortPtr(int16 *ptr, int count); -unsigned int swapUInt(unsigned int value); -unsigned int *swapUIntPtr(unsigned int *ptr, int count); -int swapInt(int value); -int *swapIntPtr(int *ptr, int count); -uint32 swapULong(uint32 value); -uint32 *swapULongPtr(uint32 *ptr, int count); -int32 swapLong(int32 value); -int32 *swapLongPtr(int32 *ptr, int count); -#endif } // End of namespace Lab diff --git a/engines/lab/undiff.cpp b/engines/lab/undiff.cpp index 2218db485a..bc4eacc603 100644 --- a/engines/lab/undiff.cpp +++ b/engines/lab/undiff.cpp @@ -39,8 +39,6 @@ extern uint16 DataBytesPerRow; /*****************************************************************************/ /* Copies memory. */ /*****************************************************************************/ -#define turbocopymem(Dest, Source, Len) (memcpy(Dest, Source, Len)) - static void copytwo(byte *Dest, byte *Source) { #if defined(USE_SWAP) @@ -86,7 +84,7 @@ static void unDIFFByteByte(byte *Dest, byte *diff) { } Dest += skip; - turbocopymem(Dest, diff, copy); + memcpy(Dest, diff, copy); Dest += copy; diff += copy; } @@ -150,42 +148,6 @@ static void unDIFFByteWord(uint16 *Dest, uint16 *diff) { -#ifdef undef - -/*****************************************************************************/ -/* Undiffs a piece of memory when header size is a byte, and copy/skip size */ -/* is a long word. */ -/*****************************************************************************/ -static void unDIFFByteLong(byte *Dest, byte *diff) { - uint16 skip, copy; - - while (1) { - skip = *diff << 2; - diff++; - copy = *diff << 2; - diff++; - - if (skip == (255 << 2)) { - if (copy == 0) { - skip = swapUShort(*((uint16 *) diff)) << 2; - diff += 2; - copy = swapUShort(*((uint16 *) diff) << 2; - diff += 2; - } else if (copy == (255 << 2)) - return; - } - - Dest += skip; - turbocopymem(Dest, diff, copy); - Dest += copy; - diff += copy; - } -} - -#endif - - - /*****************************************************************************/ /* UnDiffs a coded DIFF string onto an already initialized piece of memory. */ /*****************************************************************************/ @@ -197,33 +159,10 @@ bool unDIFFMemory(byte *Dest, byte *diff, uint16 HeaderSize, uint16 CopySize) { else if (CopySize == 2) unDIFFByteWord((uint16 *)Dest, (uint16 *)diff); -#ifdef undef - else if (CopySize == 4) - unDIFFByteLong((uint32 *)Dest, (uint32 *)diff); - -#endif - else return false; - } - /* - else if (HeaderSize == 2) - { - if (CopySize == 1) - unDIFFWordByte(Dest, diff); - - else if (CopySize == 2) - unDIFFWordWord(Dest, diff); - - else if (CopySize == 4) - unDIFFWordLong(Dest, diff); - - else - return false; - } - */ - else - return (false); + } else + error("unDIFFMemory: HeaderSize is %d", HeaderSize); return true; } @@ -431,7 +370,7 @@ void runLengthDecode(byte *Dest, byte *Source) { if (num == 127) { return; } else if (num > '\0') { - turbocopymem(Dest, Source, num); + memcpy(Dest, Source, num); Source += num; Dest += num; } else { -- cgit v1.2.3 From 2cd1c0d3fff098f84aca5cee912ac163b200dbad Mon Sep 17 00:00:00 2001 From: Filippos Karapetis Date: Fri, 20 Feb 2015 21:31:03 +0200 Subject: LAB: Clean up some DOS-specific code --- engines/lab/labmusic.cpp | 15 +++++---------- 1 file changed, 5 insertions(+), 10 deletions(-) diff --git a/engines/lab/labmusic.cpp b/engines/lab/labmusic.cpp index 4efbd07722..2998b6230d 100644 --- a/engines/lab/labmusic.cpp +++ b/engines/lab/labmusic.cpp @@ -472,11 +472,8 @@ byte **Music::newOpen(const char *name) { if (_musicOn) { updateMusic(); -#if defined(DOSCODE) - LeftSecs = (getManyBuffersLeft() * MUSICBUFSIZE * 10) / SAMPLESPEED; -#else - LeftSecs = (getManyBuffersLeft() * MUSICBUFSIZE * 10) / (2 * SAMPLESPEED); -#endif + LeftSecs = (getManyBuffersLeft() * MUSICBUFSIZE * 10) / (2 * SAMPLESPEED); // Windows (16-bit) + //LeftSecs = (getManyBuffersLeft() * MUSICBUFSIZE * 10) / SAMPLESPEED; // DOS (8-bit) - TODO filelength = sizeOfFile(name) * 10; Time = 10 + /* Seek time for the music and the file */ @@ -511,11 +508,9 @@ void Music::fileCheckMusic(uint32 filelength) { if (_musicOn) { updateMusic(); -#if defined(DOSCODE) - LeftSecs = (getManyBuffersLeft() * MUSICBUFSIZE * 10) / SAMPLESPEED; -#else - LeftSecs = (getManyBuffersLeft() * MUSICBUFSIZE * 10) / (2 * SAMPLESPEED); -#endif + + LeftSecs = (getManyBuffersLeft() * MUSICBUFSIZE * 10) / (2 * SAMPLESPEED); // Windows (16-bit) + //LeftSecs = (getManyBuffersLeft() * MUSICBUFSIZE * 10) / SAMPLESPEED; // DOS (8-bit) - TODO filelength *= 10; Time = 5 + /* Seek time for the music */ -- cgit v1.2.3 From af35398ad0a9eef858a4ac062b2c2bd78f02452c Mon Sep 17 00:00:00 2001 From: Filippos Karapetis Date: Fri, 20 Feb 2015 21:32:09 +0200 Subject: LAB: Initial sound implementation Sound effects are now played, and the engine no longer waits forever when playing a sound. A lot of unused sound code has been removed. --- engines/lab/audioi.cpp | 285 +++++-------------------------------------------- 1 file changed, 28 insertions(+), 257 deletions(-) diff --git a/engines/lab/audioi.cpp b/engines/lab/audioi.cpp index 37aecd58a4..e2c5af819d 100644 --- a/engines/lab/audioi.cpp +++ b/engines/lab/audioi.cpp @@ -28,84 +28,35 @@ * */ -#include "lab/stddefines.h" +#include "audio/mixer.h" +#include "audio/audiostream.h" +#include "audio/decoders/raw.h" +#include "lab/lab.h" +#include "lab/stddefines.h" #include "lab/labfun.h" namespace Lab { #define PLAYBUFSIZE 65536L -#if defined(DOSCODE) -const char VERSION[] = "1.01"; - -char *AudioI_DriverName = "a32sbdg.dll"; -#endif - extern bool MusicOn; -#if defined(DOSCODE) -static HTIMER server; -static HDRIVER hdriver; -static char *drvr; -static char *dll; -static drvr_desc *desc; -#endif //static sound_buff firstblock, tempblock; static int bufnum; -#if defined(DOSCODE) -static unsigned seg1; -static unsigned seg2; -static union REGS inregs, outregs; -#endif bool EffectPlaying = false, ContMusic = false, DoMusic = false; static char *CurMusic, *startMusic; static uint32 StartMusicLen; - - -#if defined(DOSCODE) -static uint16 *mem, *head, *tail, counter; - -#pragma off (check_stack) -void cdecl timer_callback(void) { - - head = (uint16 *)(0x41A); - tail = (uint16 *)(0x41C); - mem = (uint16 *)(0x400 + *head); - - if (*tail > *head) - counter = (*tail - *head) >> 1; - else - counter = (*head - *tail) >> 1; - - if (counter > 16) - counter = 16; - - while (counter) { - if ((*mem == 0x2e03) || (*mem == 0x300) || (*mem == 0x0003)) { - *tail = *head; - return; - } - - mem++; - counter--; - } -} -#endif +static Audio::SoundHandle g_musicHandle; void freeAudio(void) { if (!DoMusic) return; -#if defined(DOSCODE) - AIL_release_timer_handle(server); - - AIL_shutdown(NULL); -#else + // TODO //SDLWrapAudio(); -#endif } @@ -114,114 +65,10 @@ bool initAudio(void) { if (!DoMusic) return true; +// TODO #if 0 -#if defined(DOSCODE) - - AudioI_DriverName = "a32sbdg.dll"; - - // - // Allocate two 16K buffers from real-mode (lower 1MB) memory - // - // *buf1, *buf2 -> protected-mode pointers to buffers (sel:0000) - // *seg1, *seg2 -> real-mode (physical) pointers to buffers (seg:0000) - // - // Note: DPMI calculations assume flat model near pointer offset 0 = - // segment 0, offset 0 (Rational DOS4GW). The reason -- our simple - // file loader function can't use the far pointer formed by the selector - // returned by the DPMI call. - - // Note that these examples do not implement out-of-memory error - // checking - // - - inregs.x.eax = 0x100; - inregs.x.ebx = (16384 / 16); - int386(0x31, &inregs, &outregs); - - seg1 = outregs.x.eax << 16; - buf1 = (char *)(outregs.x.eax * 16); - - if (buf1 == NULL) - return false; - - inregs.x.eax = 0x100; - inregs.x.ebx = (16384 / 16); - int386(0x31, &inregs, &outregs); - - seg2 = outregs.x.eax << 16; - buf2 = (char *)(outregs.x.eax * 16); - - if (buf2 == NULL) - return false; - - // - // Load driver file - // - - dll = FILE_read(AudioI_DriverName, NULL); - - if (dll == NULL) { - return false; - } - - drvr = DLL_load(dll, DLLMEM_ALLOC | DLLSRC_MEM, NULL); - - if (drvr == NULL) { - return false; - } - - free(dll); - - // - // Initialize API before calling any Library functions - // - - AIL_startup(); - - hdriver = AIL_register_driver(drvr); - - if (hdriver == -1) { - AIL_shutdown(NULL); - return false; - } - - // - // Get driver type and factory default I/O parameters; exit if - // driver is not capable of interpreting PCM sound data - // - - desc = AIL_describe_driver(hdriver); - - if (desc->drvr_type != DSP_DRVR) { - AIL_shutdown(NULL); - return false; - } - - if (!AIL_detect_device(hdriver, desc->default_IO, desc->default_IRQ, desc->default_DMA, desc->default_DRQ)) { - desc->default_IRQ = 5; - - if (!AIL_detect_device(hdriver, desc->default_IO, desc->default_IRQ, desc->default_DMA, desc->default_DRQ)) { - AIL_shutdown(NULL); - return false; - } - } - - AIL_init_driver(hdriver, desc->default_IO, desc->default_IRQ, desc->default_DMA, desc->default_DRQ); - - // - // Register a timer function; set up for 10-millisecond (100 Hz.) - // callback intervals - // - - server = AIL_register_timer(timer_callback); - - if (server != -1) { - AIL_set_timer_period(server, 20000L); - AIL_start_timer(server); - } - -#else // we allocate extra mempory for 16-bit samples + // TODO: 8-bit mono sample for DOS buf1 = malloc(PLAYBUFSIZE); if (buf1 == NULL) @@ -234,8 +81,6 @@ bool initAudio(void) { if (!SDLInitAudio()) return false; - -#endif #endif return true; @@ -248,57 +93,23 @@ void initSampleRate(uint16 SampleSpeed) { if (SampleSpeed < 4000) SampleSpeed = 4000; -#if defined(DOSCODE) - firstblock.sample_rate = 256 - (1000000L / SampleSpeed); - firstblock.pack_type = 0 | 0x80; // 8-bit mono sample -#else //firstblock.sample_rate = SampleSpeed; //firstblock.pack_type = AUDIO_S16; // SOUND_MONO | SOUND_16BIT; // 16-bit mono sample -#endif + // TODO: 8-bit mono sample for DOS } bool musicBufferEmpty(uint16 i) { -#if defined(NEWCODE) - return (AIL_sound_buffer_status(hdriver, i) == DAC_DONE); -#else - //return (SDLSoundBufferStatus(i) == DAC_DONE); - return true; -#endif + // TODO: Multiple streams + return !g_lab->_mixer->isSoundHandleActive(g_musicHandle); } void playMusicBlock(void *Ptr, uint32 Size, uint16 BufferNum, uint16 SampleSpeed) { -#if defined(DOSCODE) - uint32 TempPtr; - uint32 seg; - char *buf; - - TempPtr = ((uint32) Ptr) / 16L; - - seg = TempPtr << 16; - buf = (char *)(TempPtr * 16); - - if (SampleSpeed < 4000) - SampleSpeed = 4000; - - firstblock.sample_rate = 256 - (1000000L / SampleSpeed); - firstblock.pack_type = 0 | 0x80; // 8-bit mono sample - - tempblock = firstblock; - tempblock.sel_data = buf; - tempblock.seg_data = seg; - tempblock.len = Size; - - AIL_register_sound_buffer(hdriver, BufferNum, &tempblock); - AIL_format_sound_buffer(hdriver, &tempblock); - - AIL_start_digital_playback(hdriver); - AIL_set_digital_playback_volume(hdriver, 127); -#else + // TODO #if 0 if (SampleSpeed < 4000) @@ -306,6 +117,7 @@ void playMusicBlock(void *Ptr, uint32 Size, uint16 BufferNum, uint16 SampleSpeed firstblock.sample_rate = SampleSpeed; firstblock.pack_type = SOUND_MONO | SOUND_16BIT; // 16-bit mono sample + // TODO: 8-bit mono sample for DOS tempblock = firstblock; tempblock.sel_data = Ptr; @@ -313,7 +125,6 @@ void playMusicBlock(void *Ptr, uint32 Size, uint16 BufferNum, uint16 SampleSpeed SDLPlayBuffer(BufferNum, &tempblock); #endif -#endif } @@ -324,52 +135,14 @@ void updateSoundBuffers(void) { if (!EffectPlaying) return; -#if defined(DOSCODE) - - for (int i = 0; i < 2; i++) { - if ((AIL_sound_buffer_status(hdriver, i) == DAC_DONE) && firstblock.len) { - tempblock.len = MIN(16384L, firstblock.len); - firstblock.len -= tempblock.len; - - if (!(bufnum ^= 1)) { - memcpy(buf1, CurMusic, (unsigned) tempblock.len); - tempblock.sel_data = buf1; - tempblock.seg_data = seg1; - } else { - memcpy(buf2, CurMusic, (unsigned) tempblock.len); - tempblock.sel_data = buf2; - tempblock.seg_data = seg2; - } - - CurMusic += tempblock.len; - - AIL_register_sound_buffer(hdriver, i, &tempblock); - AIL_format_sound_buffer(hdriver, &tempblock); - - AIL_start_digital_playback(hdriver); - AIL_set_digital_playback_volume(hdriver, 127); - } - } - - // - // Playback ends when no bytes are left in the source data and - // the status of both buffers equals DAC_DONE - // - - if (!firstblock.len) { - if (ContMusic) { - CurMusic = startMusic; - firstblock.len = StartMusicLen; - } else if ((AIL_sound_buffer_status(hdriver, 0) == DAC_DONE) && - (AIL_sound_buffer_status(hdriver, 1) == DAC_DONE)) { - flushAudio(); - EffectPlaying = false; - } + // TODO + // FIXME: Very crude implementation + if (musicBufferEmpty(0)) { + flushAudio(); + EffectPlaying = false; } -#else #if 0 - for (int i = 0; i < 2; i++) { if ((SDLSoundBufferStatus(i) == DAC_DONE) && firstblock.len) { // use extra memory for 16-bit samples @@ -406,7 +179,6 @@ void updateSoundBuffers(void) { } } -#endif #endif } @@ -416,11 +188,7 @@ void flushAudio(void) { if (!DoMusic) return; -#if defined(DOSCODE) - AIL_stop_digital_playback(hdriver); -#else - //SDLStopPlayback(); -#endif + g_lab->_mixer->stopHandle(g_musicHandle); EffectPlaying = false; } @@ -439,13 +207,9 @@ void playMusic(uint16 SampleSpeed, uint16 Volume, uint32 Length, bool flush, voi if (SampleSpeed < 4000) SampleSpeed = 4000; -#if defined(DOSCODE) - firstblock.sample_rate = 256 - (1000000L / SampleSpeed); - firstblock.pack_type = 0 | 0x80; // 8-bit mono sample -#else //firstblock.sample_rate = SampleSpeed; //firstblock.pack_type = SOUND_MONO | SOUND_16BIT; // 16-bit mono sample -#endif + // TODO: 8-bit mono sample for DOS //firstblock.len = Length; bufnum = 0; @@ -455,6 +219,13 @@ void playMusic(uint16 SampleSpeed, uint16 Volume, uint32 Length, bool flush, voi startMusic = CurMusic; StartMusicLen = Length; + byte soundFlags = Audio::FLAG_LITTLE_ENDIAN; + if (g_lab->getPlatform() == Common::kPlatformWindows) + soundFlags |= Audio::FLAG_16BITS; + + Audio::SeekableAudioStream *audStream = Audio::makeRawStream((const byte *)Data, Length, SampleSpeed, soundFlags, DisposeAfterUse::NO); + g_lab->_mixer->playStream(Audio::Mixer::kMusicSoundType, &g_musicHandle, audStream); + updateSoundBuffers(); } -- cgit v1.2.3 From 530aa5926b8ebcca6533079950730f42e6954a09 Mon Sep 17 00:00:00 2001 From: Filippos Karapetis Date: Tue, 24 Feb 2015 00:28:13 +0200 Subject: LAB: Remove dead code --- engines/lab/audioi.cpp | 20 -------------------- engines/lab/diff.h | 4 ---- engines/lab/labfun.h | 2 -- engines/lab/labmusic.cpp | 2 -- engines/lab/readdiff.cpp | 14 -------------- 5 files changed, 42 deletions(-) diff --git a/engines/lab/audioi.cpp b/engines/lab/audioi.cpp index e2c5af819d..ed1e32cd70 100644 --- a/engines/lab/audioi.cpp +++ b/engines/lab/audioi.cpp @@ -87,20 +87,6 @@ bool initAudio(void) { } -void initSampleRate(uint16 SampleSpeed) { - flushAudio(); - - if (SampleSpeed < 4000) - SampleSpeed = 4000; - - //firstblock.sample_rate = SampleSpeed; - //firstblock.pack_type = AUDIO_S16; // SOUND_MONO | SOUND_16BIT; // 16-bit mono sample - // TODO: 8-bit mono sample for DOS -} - - - - bool musicBufferEmpty(uint16 i) { // TODO: Multiple streams return !g_lab->_mixer->isSoundHandleActive(g_musicHandle); @@ -115,10 +101,6 @@ void playMusicBlock(void *Ptr, uint32 Size, uint16 BufferNum, uint16 SampleSpeed if (SampleSpeed < 4000) SampleSpeed = 4000; - firstblock.sample_rate = SampleSpeed; - firstblock.pack_type = SOUND_MONO | SOUND_16BIT; // 16-bit mono sample - // TODO: 8-bit mono sample for DOS - tempblock = firstblock; tempblock.sel_data = Ptr; tempblock.len = Size; @@ -207,8 +189,6 @@ void playMusic(uint16 SampleSpeed, uint16 Volume, uint32 Length, bool flush, voi if (SampleSpeed < 4000) SampleSpeed = 4000; - //firstblock.sample_rate = SampleSpeed; - //firstblock.pack_type = SOUND_MONO | SOUND_16BIT; // 16-bit mono sample // TODO: 8-bit mono sample for DOS //firstblock.len = Length; bufnum = 0; diff --git a/engines/lab/diff.h b/engines/lab/diff.h index e1644d49ab..b0725e5625 100644 --- a/engines/lab/diff.h +++ b/engines/lab/diff.h @@ -81,8 +81,6 @@ bool readDiff(bool playonce); void diffNextFrame(void); -void playCntMusic(void); - void readSound(void); void stopDiff(void); @@ -91,8 +89,6 @@ void stopDiffEnd(void); void stopSound(void); -void diffSetMusic(void); - } // End of namespace Lab #endif /* LAB_DIFF_H */ diff --git a/engines/lab/labfun.h b/engines/lab/labfun.h index 4d1854f057..ea454971fc 100644 --- a/engines/lab/labfun.h +++ b/engines/lab/labfun.h @@ -65,8 +65,6 @@ bool initAudio(void); void freeAudio(void); -void initSampleRate(uint16 SampleSpeed); - bool musicBufferEmpty(uint16 i); void playMusicBlock(void *Ptr, uint32 Size, uint16 BufferNum, uint16 SampleSpeed); diff --git a/engines/lab/labmusic.cpp b/engines/lab/labmusic.cpp index 2998b6230d..8e61c63c5e 100644 --- a/engines/lab/labmusic.cpp +++ b/engines/lab/labmusic.cpp @@ -219,8 +219,6 @@ void Music::startMusic(bool startatbegin) { _leftinfile = _filelength; } - initSampleRate(SAMPLESPEED); - _musicPlaying = 0; _musicOnBuffer = 0; _musicFilledTo = _manyBuffers - 1; diff --git a/engines/lab/readdiff.cpp b/engines/lab/readdiff.cpp index b270f3b8d5..71707dc55a 100644 --- a/engines/lab/readdiff.cpp +++ b/engines/lab/readdiff.cpp @@ -486,20 +486,6 @@ void stopSound(void) { -/*****************************************************************************/ -/* Checks the music while a diff is playing. */ -/*****************************************************************************/ -void diffSetMusic(void) { - return; - - while (IsPlaying) { - waitTOF(); - g_music->newCheckMusic(); - } -} - - - /*****************************************************************************/ /* Reads in a DIFF file. */ /*****************************************************************************/ -- cgit v1.2.3 From 6ff7c480af11939feb9546985577c092c4f7074d Mon Sep 17 00:00:00 2001 From: Filippos Karapetis Date: Tue, 24 Feb 2015 00:31:26 +0200 Subject: LAB: Remove superfluous void function parameters --- engines/lab/allocroom.cpp | 4 ++-- engines/lab/audioi.cpp | 8 +++---- engines/lab/diff.h | 12 +++++------ engines/lab/engine.cpp | 14 ++++++------ engines/lab/graphics.cpp | 4 ++-- engines/lab/interface.cpp | 2 +- engines/lab/interface.h | 2 +- engines/lab/intro.cpp | 6 +++--- engines/lab/labfile.cpp | 8 +++---- engines/lab/labfun.h | 54 +++++++++++++++++++++++------------------------ engines/lab/labmusic.cpp | 18 ++++++++-------- engines/lab/labtext.cpp | 4 ++-- engines/lab/map.cpp | 4 ++-- engines/lab/mouse.cpp | 14 ++++++------ engines/lab/mouse.h | 10 ++++----- engines/lab/parsefun.h | 4 ++-- engines/lab/readdiff.cpp | 14 ++++++------ engines/lab/special.cpp | 12 +++++------ engines/lab/vga.cpp | 6 +++--- engines/lab/vga.h | 10 ++++----- 20 files changed, 105 insertions(+), 105 deletions(-) diff --git a/engines/lab/allocroom.cpp b/engines/lab/allocroom.cpp index 339ae0b401..3a5c7b9cf0 100644 --- a/engines/lab/allocroom.cpp +++ b/engines/lab/allocroom.cpp @@ -59,7 +59,7 @@ static int32 MemLeftInBuffer = 0L; /*****************************************************************************/ /* Allocates the memory for the room buffers. */ /*****************************************************************************/ -bool initRoomBuffer(void) { +bool initRoomBuffer() { uint16 counter; CurMarker = 0; @@ -82,7 +82,7 @@ bool initRoomBuffer(void) { /*****************************************************************************/ /* Frees the memory for the room buffers. */ /*****************************************************************************/ -void freeRoomBuffer(void) { +void freeRoomBuffer() { if (RoomBuffer) free(RoomBuffer); } diff --git a/engines/lab/audioi.cpp b/engines/lab/audioi.cpp index ed1e32cd70..5b2d183155 100644 --- a/engines/lab/audioi.cpp +++ b/engines/lab/audioi.cpp @@ -51,7 +51,7 @@ static char *CurMusic, *startMusic; static uint32 StartMusicLen; static Audio::SoundHandle g_musicHandle; -void freeAudio(void) { +void freeAudio() { if (!DoMusic) return; @@ -61,7 +61,7 @@ void freeAudio(void) { -bool initAudio(void) { +bool initAudio() { if (!DoMusic) return true; @@ -110,7 +110,7 @@ void playMusicBlock(void *Ptr, uint32 Size, uint16 BufferNum, uint16 SampleSpeed } -void updateSoundBuffers(void) { +void updateSoundBuffers() { if (!DoMusic) return; @@ -166,7 +166,7 @@ void updateSoundBuffers(void) { -void flushAudio(void) { +void flushAudio() { if (!DoMusic) return; diff --git a/engines/lab/diff.h b/engines/lab/diff.h index b0725e5625..6889bcc258 100644 --- a/engines/lab/diff.h +++ b/engines/lab/diff.h @@ -75,19 +75,19 @@ void blackScreen(); void blackAllScreen(); -void whiteScreen(void); +void whiteScreen(); bool readDiff(bool playonce); -void diffNextFrame(void); +void diffNextFrame(); -void readSound(void); +void readSound(); -void stopDiff(void); +void stopDiff(); -void stopDiffEnd(void); +void stopDiffEnd(); -void stopSound(void); +void stopSound(); } // End of namespace Lab diff --git a/engines/lab/engine.cpp b/engines/lab/engine.cpp index ef3850b649..ed90443a1d 100644 --- a/engines/lab/engine.cpp +++ b/engines/lab/engine.cpp @@ -146,7 +146,7 @@ static char initcolors[] = { '\x00', '\x00', '\x00', '\x30', /******************************************************************************/ /* Draws the control panel display. */ /******************************************************************************/ -void drawPanel(void) { +void drawPanel() { mouseHide(); setAPen(3); /* Clear Area */ @@ -241,7 +241,7 @@ static uint16 OldMode; /******************************************************************************/ /* Sets up the Labyrinth screens, and opens up the initial windows. */ /******************************************************************************/ -bool setUpScreens(void) { +bool setUpScreens() { uint16 counter; byte *bufferstorage, **buffer = &bufferstorage; Gadget *curgad; @@ -416,7 +416,7 @@ static void perFlipGadget(uint16 GadID) { /******************************************************************************/ /* Eats all the available messages. */ /******************************************************************************/ -void eatMessages(void) { +void eatMessages() { IntuiMessage *Msg; do { @@ -440,7 +440,7 @@ static uint16 lastmusicroom = 1; /******************************************************************************/ /* Checks the music that should be playing in a particular room. */ /******************************************************************************/ -static void checkRoomMusic(void) { +static void checkRoomMusic() { if ((lastmusicroom == RoomNum) || !g_music->_musicOn) return; @@ -546,7 +546,7 @@ static bool interfaceisoff = false; /******************************************************************************/ /* Turns the interface off. */ /******************************************************************************/ -static void interfaceOff(void) { +static void interfaceOff() { if (!interfaceisoff) { attachGadgetList(NULL); mouseHide(); @@ -560,7 +560,7 @@ static void interfaceOff(void) { /******************************************************************************/ /* Turns the interface on. */ /******************************************************************************/ -static void interfaceOn(void) { +static void interfaceOn() { if (interfaceisoff) { interfaceisoff = false; @@ -711,7 +711,7 @@ static bool novesa = false, noaudio = false; /******************************************************************************/ /* Processes user input events. */ /******************************************************************************/ -static void process(void) { +static void process() { IntuiMessage *Msg; uint32 Class; diff --git a/engines/lab/graphics.cpp b/engines/lab/graphics.cpp index 2a43dfe064..4ef132a492 100644 --- a/engines/lab/graphics.cpp +++ b/engines/lab/graphics.cpp @@ -495,7 +495,7 @@ void copyLong64(uint32 *Dest, uint32 *Source, uint32 Many64) { /*****************************************************************************/ /* Scrolls the display to black. */ /*****************************************************************************/ -static void doScrollBlack(void) { +static void doScrollBlack() { byte *mem, *tempmem; Image Im; uint16 width, height, by, nheight, CurPage; @@ -675,7 +675,7 @@ static void doScrollWipe(char *filename) { /*****************************************************************************/ /* Does the scroll bounce. Assumes bitmap already in memory. */ /*****************************************************************************/ -static void doScrollBounce(void) { +static void doScrollBounce() { const uint16 *newby, *newby1; const uint16 newbyd[5] = {5, 4, 3, 2, 1}, newby1d[8] = {3, 3, 2, 2, 2, 1, 1, 1}; diff --git a/engines/lab/interface.cpp b/engines/lab/interface.cpp index c70d19b2bb..62d35c1e03 100644 --- a/engines/lab/interface.cpp +++ b/engines/lab/interface.cpp @@ -165,7 +165,7 @@ static bool keyPress(uint16 *KeyCode) { IntuiMessage IMessage; extern Gadget *ScreenGadgetList; -IntuiMessage *getMsg(void) { +IntuiMessage *getMsg() { Gadget *curgad; int Qualifiers; diff --git a/engines/lab/interface.h b/engines/lab/interface.h index 9b8c3fb8bf..1c0439b5ff 100644 --- a/engines/lab/interface.h +++ b/engines/lab/interface.h @@ -124,7 +124,7 @@ void ghoastGadget(Gadget *curgad, uint16 pencolor); void unGhoastGadget(Gadget *curgad); -IntuiMessage *getMsg(void); +IntuiMessage *getMsg(); void replyMsg(void *Msg); diff --git a/engines/lab/intro.cpp b/engines/lab/intro.cpp index 09f92c0698..8d508aebba 100644 --- a/engines/lab/intro.cpp +++ b/engines/lab/intro.cpp @@ -63,7 +63,7 @@ extern int32 longcharsdrawn; /* Goes thru, and responds to all the intuition messages currently in the */ /* the message port. */ /******************************************************************************/ -void introEatMessages(void) { +void introEatMessages() { IntuiMessage *Msg; while (1) { @@ -229,7 +229,7 @@ static void doPictText(const char *Filename, bool isscreen) { /*****************************************************************************/ /* Does a one second delay, but checks the music while doing it. */ /*****************************************************************************/ -void musicDelay(void) { +void musicDelay() { int16 counter; g_music->newCheckMusic(); @@ -268,7 +268,7 @@ static void NReadPict(const char *Filename, bool PlayOnce) { /*****************************************************************************/ /* Does the introduction sequence for Labyrinth. */ /*****************************************************************************/ -void introSequence(void) { +void introSequence() { uint16 counter, counter1; DoBlack = true; diff --git a/engines/lab/labfile.cpp b/engines/lab/labfile.cpp index 4cbbd5403e..e5ff4916df 100644 --- a/engines/lab/labfile.cpp +++ b/engines/lab/labfile.cpp @@ -278,7 +278,7 @@ void skip(byte **File, uint32 skip) { /*****************************************************************************/ /* Resets the internal buffers to empty. */ /*****************************************************************************/ -void resetBuffer(void) { +void resetBuffer() { uint16 RMarker; CurMarker = 0; @@ -314,7 +314,7 @@ bool initBuffer(uint32 BufSize, bool IsGraphicsMem) { /*****************************************************************************/ /* Frees the buffer. */ /*****************************************************************************/ -void freeBuffer(void) { +void freeBuffer() { freeAllStolenMem(); if (buffer) @@ -335,7 +335,7 @@ void freeBuffer(void) { /*****************************************************************************/ /* Clears all the buffers. */ /*****************************************************************************/ -static void flushBuffers(void) { +static void flushBuffers() { uint16 RMarker; RMarker = 0; @@ -385,7 +385,7 @@ Common::File *openPartial(const char *name) { /*****************************************************************************/ /* Frees all the memory stolen from the buffer. */ /*****************************************************************************/ -void freeAllStolenMem(void) { +void freeAllStolenMem() { flushBuffers(); buffer = realbufferstart; diff --git a/engines/lab/labfun.h b/engines/lab/labfun.h index ea454971fc..a527b12cb3 100644 --- a/engines/lab/labfun.h +++ b/engines/lab/labfun.h @@ -61,17 +61,17 @@ struct SaveGameHeader { /*------ From Audioi.c -------*/ /*----------------------------*/ -bool initAudio(void); +bool initAudio(); -void freeAudio(void); +void freeAudio(); bool musicBufferEmpty(uint16 i); void playMusicBlock(void *Ptr, uint32 Size, uint16 BufferNum, uint16 SampleSpeed); -void updateSoundBuffers(void); +void updateSoundBuffers(); -void flushAudio(void); +void flushAudio(); void playMusic(uint16 SampleSpeed, uint16 Volume, uint32 Length, bool flush, void *Data); @@ -146,7 +146,7 @@ void gadgetsOnOff(void *gptr, void *win, int32 num, bool on); /*---- From Intro.c ----*/ /*----------------------*/ -void introSequence(void); +void introSequence(); @@ -154,13 +154,13 @@ void introSequence(void); /*----- From Lab.c -----*/ /*----------------------*/ -void eatMessages(void); +void eatMessages(); -bool setUpScreens(void); +bool setUpScreens(); -void drawPanel(void); +void drawPanel(); -bool quitPlaying(void); +bool quitPlaying(); @@ -182,11 +182,11 @@ char readChar(char **File); void skip(byte **File, uint32 skip); -void resetBuffer(void); +void resetBuffer(); bool initBuffer(uint32 BufSize, bool IsGraphicsMem); -void freeBuffer(void); +void freeBuffer(); /* Functions that borrow memory from the buffer */ @@ -195,7 +195,7 @@ bool allocFile(void **Ptr, uint32 Size, const char *fileName); void *stealBufMem(int32 Size); -void freeAllStolenMem(void); +void freeAllStolenMem(); /* Read chunks of a file */ @@ -210,9 +210,9 @@ void closePartial(int32 File); /*------ From LabText.c -----*/ /*---------------------------*/ -bool initLabText(void); +bool initLabText(); -void freeLabText(void); +void freeLabText(); void decrypt(byte *text); @@ -231,18 +231,18 @@ public: Music(); byte **newOpen(const char *name); - bool initMusic(void); - void freeMusic(void); + bool initMusic(); + void freeMusic(); void fillUpMusic(bool doit); - void updateMusic(void); - void checkMusic(void); - void newCheckMusic(void); - void closeMusic(void); + void updateMusic(); + void checkMusic(); + void newCheckMusic(); + void closeMusic(); void setMusic(bool on); - void restartBackMusic(void); - void pauseBackMusic(void); + void restartBackMusic(); + void pauseBackMusic(); void changeMusic(const char *newmusic); - void resetMusic(void); + void resetMusic(); void fileCheckMusic(uint32 filelength); bool _winmusic, _doNotFileFlushAudio; @@ -251,7 +251,7 @@ public: private: void fillbuffer(uint16 unit); - uint16 getManyBuffersLeft(void); + uint16 getManyBuffersLeft(); void startMusic(bool startatbegin); Common::File *_file; @@ -340,13 +340,13 @@ void doMap(uint16 CurRoom); void doJournal(); -void doNotes(void); +void doNotes(); -void doWestPaper(void); +void doWestPaper(); void doMonitor(char *background, char *textfile, bool isinteractive, uint16 x1, uint16 y1, uint16 x2, uint16 y2); -bool saveRestoreGame(void); +bool saveRestoreGame(); diff --git a/engines/lab/labmusic.cpp b/engines/lab/labmusic.cpp index 8e61c63c5e..cd082700ca 100644 --- a/engines/lab/labmusic.cpp +++ b/engines/lab/labmusic.cpp @@ -71,7 +71,7 @@ Music::Music() { /* Figures out which buffer is currently playing based on messages sent to */ /* it from the Audio device. */ /*****************************************************************************/ -void Music::updateMusic(void) { +void Music::updateMusic() { uint16 i; WSDL_ProcessInput(0); @@ -125,7 +125,7 @@ void Music::fillbuffer(uint16 unit) { /*****************************************************************************/ /* Figures out how many *complete* buffers of music left to play. */ /*****************************************************************************/ -uint16 Music::getManyBuffersLeft(void) { +uint16 Music::getManyBuffersLeft() { uint16 mp = _musicOnBuffer; if (mp == _musicFilledTo) /* Already filled */ @@ -240,7 +240,7 @@ void Music::startMusic(bool startatbegin) { /*****************************************************************************/ /* Initializes the music buffers. */ /*****************************************************************************/ -bool Music::initMusic(void) { +bool Music::initMusic() { uint16 counter; if (!_turnMusicOn) @@ -278,7 +278,7 @@ bool Music::initMusic(void) { /*****************************************************************************/ /* Frees up the music buffers and closes the file. */ /*****************************************************************************/ -void Music::freeMusic(void) { +void Music::freeMusic() { _musicOn = false; if (_file->isOpen()) @@ -291,7 +291,7 @@ void Music::freeMusic(void) { /*****************************************************************************/ /* Pauses the background music. */ /*****************************************************************************/ -void Music::pauseBackMusic(void) { +void Music::pauseBackMusic() { if (!_musicPaused && _musicOn) { updateMusic(); _musicOn = false; @@ -311,7 +311,7 @@ void Music::pauseBackMusic(void) { /*****************************************************************************/ /* Restarts the paused background music. */ /*****************************************************************************/ -void Music::restartBackMusic(void) { +void Music::restartBackMusic() { if (_musicPaused) { flushAudio(); _musicOn = true; @@ -327,7 +327,7 @@ void Music::restartBackMusic(void) { /*****************************************************************************/ /* Checks to see if need to fill buffers fill of music. */ /*****************************************************************************/ -void Music::checkMusic(void) { +void Music::checkMusic() { updateMusic(); if (!_musicOn) @@ -341,7 +341,7 @@ void Music::checkMusic(void) { /*****************************************************************************/ /* Checks to see if need to fill buffers fill of music. */ /*****************************************************************************/ -void Music::newCheckMusic(void) { +void Music::newCheckMusic() { checkMusic(); } @@ -405,7 +405,7 @@ void Music::changeMusic(const char *newmusic) { /*****************************************************************************/ /* Changes the background music to the original piece playing. */ /*****************************************************************************/ -void Music::resetMusic(void) { +void Music::resetMusic() { if (!_tFile) return; diff --git a/engines/lab/labtext.cpp b/engines/lab/labtext.cpp index 673f8d06ac..3c26ea7839 100644 --- a/engines/lab/labtext.cpp +++ b/engines/lab/labtext.cpp @@ -64,7 +64,7 @@ static void setString(char **string) { /*****************************************************************************/ /* Initializes everything for the Labyrinth text stuff */ /*****************************************************************************/ -bool initLabText(void) { +bool initLabText() { if ((SizeOfMemChunk = sizeOfFile(LABTEXTFILE))) if ((BeginOfMemChunk = (char *)calloc(SizeOfMemChunk, 1))) { Common::File *file = openPartial(LABTEXTFILE); @@ -143,7 +143,7 @@ bool initLabText(void) { /*****************************************************************************/ /* Frees the memory from the Labyrinth text stuff. */ /*****************************************************************************/ -void freeLabText(void) { +void freeLabText() { if (SizeOfMemChunk && BeginOfMemChunk) free(BeginOfMemChunk); } diff --git a/engines/lab/map.cpp b/engines/lab/map.cpp index 77d520de16..f51bf86716 100644 --- a/engines/lab/map.cpp +++ b/engines/lab/map.cpp @@ -217,7 +217,7 @@ static uint16 mapScaleY(uint16 y) { /*****************************************************************************/ /* Loads in the map data. */ /*****************************************************************************/ -static bool loadMapData(void) { +static bool loadMapData() { byte **buffer, Temp[5]; int32 Size; Gadget *gptr; @@ -892,7 +892,7 @@ void processMap(uint16 CurRoom) { /*****************************************************************************/ /* Cleans up behind itself. */ /*****************************************************************************/ -void mapCleanUp(void) { +void mapCleanUp() { freeAllStolenMem(); } diff --git a/engines/lab/mouse.cpp b/engines/lab/mouse.cpp index a75a92cfba..6e6c97dc33 100644 --- a/engines/lab/mouse.cpp +++ b/engines/lab/mouse.cpp @@ -39,7 +39,7 @@ namespace Lab { extern bool IsHiRes; extern uint32 VGAScreenWidth, VGAScreenHeight; -void mouseHideXY(void); +void mouseHideXY(); static bool LeftClick = false; static bool RightClick = false; @@ -166,7 +166,7 @@ void mouse_handler(int32 flag, int32 mouseX, int32 mouseY) { -void updateMouse(void) { +void updateMouse() { uint16 counter; bool doUpdateDisplay = false; @@ -204,7 +204,7 @@ void updateMouse(void) { /*****************************************************************************/ /* Initializes the mouse. */ /*****************************************************************************/ -bool initMouse(void) { +bool initMouse() { g_system->setMouseCursor(MouseData, MOUSE_WIDTH, MOUSE_HEIGHT, 0, 0, 0); g_system->showMouse(false); @@ -219,7 +219,7 @@ bool initMouse(void) { /*****************************************************************************/ /* Shows the mouse. */ /*****************************************************************************/ -void mouseShow(void) { +void mouseShow() { mouseShowXY(CurMouseX, CurMouseY); g_system->showMouse(true); @@ -253,7 +253,7 @@ void mouseShowXY(uint16 MouseX, uint16 MouseY) { /*****************************************************************************/ /* Hides the mouse. */ /*****************************************************************************/ -void mouseHide(void) { +void mouseHide() { QuitMouseHandler = true; NumHidden++; @@ -273,7 +273,7 @@ void mouseHide(void) { /*****************************************************************************/ /* Hides the mouse. */ /*****************************************************************************/ -void mouseHideXY(void) { +void mouseHideXY() { QuitMouseHandler = true; NumHidden++; @@ -355,7 +355,7 @@ bool mouseButton(uint16 *x, uint16 *y, bool leftbutton) { -Gadget *mouseGadget(void) { +Gadget *mouseGadget() { Gadget *Temp = LastGadgetHit; LastGadgetHit = NULL; diff --git a/engines/lab/mouse.h b/engines/lab/mouse.h index 5af582164f..18e5c2caca 100644 --- a/engines/lab/mouse.h +++ b/engines/lab/mouse.h @@ -37,13 +37,13 @@ namespace Lab { struct Gadget; -bool initMouse(void); +bool initMouse(); -void updateMouse(void); +void updateMouse(); -void mouseShow(void); +void mouseShow(); -void mouseHide(void); +void mouseHide(); void mouseXY(uint16 *x, uint16 *y); @@ -51,7 +51,7 @@ void mouseMove(uint16 x, uint16 y); bool mouseButton(uint16 *x, uint16 *y, bool leftbutton); -Gadget *mouseGadget(void); +Gadget *mouseGadget(); void attachGadgetList(Gadget *GadList); diff --git a/engines/lab/parsefun.h b/engines/lab/parsefun.h index 2c48311090..6766dd27f0 100644 --- a/engines/lab/parsefun.h +++ b/engines/lab/parsefun.h @@ -44,9 +44,9 @@ bool parse(const char *InputFile); /* From allocRoom.c */ -bool initRoomBuffer(void); +bool initRoomBuffer(); -void freeRoomBuffer(void); +void freeRoomBuffer(); void allocRoom(void **Ptr, uint16 Size, uint16 RoomNum); diff --git a/engines/lab/readdiff.cpp b/engines/lab/readdiff.cpp index 71707dc55a..b75ed6d7e9 100644 --- a/engines/lab/readdiff.cpp +++ b/engines/lab/readdiff.cpp @@ -125,7 +125,7 @@ void blackScreen() { /*****************************************************************************/ /* Changes the front screen to white. */ /*****************************************************************************/ -void whiteScreen(void) { +void whiteScreen() { memset(blackbuffer, 255, 248 * 3); writeColorRegs(blackbuffer, 8, 248); } @@ -149,7 +149,7 @@ static byte *Buffer, temp[5]; static bool FirstThru = true, donepal = false; static byte *storagefordifffile, * *difffile = &storagefordifffile; -void diffNextFrame(void) { +void diffNextFrame() { if (header == 65535) /* Already done. */ return; @@ -340,7 +340,7 @@ void diffNextFrame(void) { /*****************************************************************************/ /* A separate task launched by readDiff. Plays the DIFF. */ /*****************************************************************************/ -void playDiff(void) { +void playDiff() { processed = 0L; WaitSec = 0L; WaitMicros = 0L; @@ -445,7 +445,7 @@ void playDiff(void) { /*****************************************************************************/ /* Stops an animation from running. */ /*****************************************************************************/ -void stopDiff(void) { +void stopDiff() { if (IsPlaying) { StopPlaying = true; @@ -464,7 +464,7 @@ void stopDiff(void) { /*****************************************************************************/ /* Stops an animation from running. */ /*****************************************************************************/ -void stopDiffEnd(void) { +void stopDiffEnd() { if (IsPlaying) { StopPlayingEnd = true; @@ -480,7 +480,7 @@ void stopDiffEnd(void) { /*****************************************************************************/ /* Stops the continuous sound from playing. */ /*****************************************************************************/ -void stopSound(void) { +void stopSound() { stopsound = true; } @@ -500,7 +500,7 @@ bool readDiff(bool playonce) { static byte *mstart; -void readSound(void) { +void readSound() { uint32 header_ = 0, size_; uint16 samplespeed_; // uint16 numchunks = 1; diff --git a/engines/lab/special.cpp b/engines/lab/special.cpp index f9c793c8e3..7d2212138b 100644 --- a/engines/lab/special.cpp +++ b/engines/lab/special.cpp @@ -117,7 +117,7 @@ static uint16 combx[] = {45, 83, 129, 166, 211, 248}; /*****************************************************************************/ /* Draws the images of the combination lock to the display bitmap. */ /*****************************************************************************/ -static void doCombination(void) { +static void doCombination() { uint16 counter; for (counter = 0; counter <= 5; counter++) @@ -513,7 +513,7 @@ static TextFont bmfont; /*****************************************************************************/ /* Does the things to properly set up the detective notes. */ /*****************************************************************************/ -void doNotes(void) { +void doNotes() { char *ntext; /* Load in the data */ @@ -546,7 +546,7 @@ void doNotes(void) { /* Does the things to properly set up the old west newspaper. Assumes that */ /* OpenHiRes already called. */ /*****************************************************************************/ -void doWestPaper(void) { +void doWestPaper() { char *ntext; int32 FileLen, CharsPrinted; uint16 y = 268; @@ -727,7 +727,7 @@ static bool loadJournalData() { /*****************************************************************************/ /* Draws the text to the back journal screen to the appropriate Page number */ /*****************************************************************************/ -static void drawJournalText(void) { +static void drawJournalText() { uint16 DrawingToPage = 1; int32 CharsDrawn = 0L; char *CurText = journaltext; @@ -935,7 +935,7 @@ void doJournal() { extern InventoryData *Inventory; extern uint16 RoomNum, Direction; -bool saveRestoreGame(void) { +bool saveRestoreGame() { bool isOK = false; // The original had one screen for saving/loading. We have two. @@ -993,7 +993,7 @@ Image *MonButton, *AltMonButton, *MonQuit, *AltMonQuit, *MonBack, *AltMonBack, /*****************************************************************************/ /* Makes sure that the buttons are in memory. */ /*****************************************************************************/ -static void getMonImages(void) { +static void getMonImages() { byte **buffer; resetBuffer(); diff --git a/engines/lab/vga.cpp b/engines/lab/vga.cpp index 11713da130..4c2584c480 100644 --- a/engines/lab/vga.cpp +++ b/engines/lab/vga.cpp @@ -100,11 +100,11 @@ void setPage(uint16 PageNum) { assert(PageNum == 0); } -void VGAStorePage(void) { +void VGAStorePage() { // does nothing in SDL } -void VGARestorePage(void) { +void VGARestorePage() { // does nothing in SDL } @@ -321,7 +321,7 @@ void WSDL_UpdateScreen() { /*****************************************************************************/ /* Returns the base address of the current VGA display. */ /*****************************************************************************/ -byte *getVGABaseAddr(void) { +byte *getVGABaseAddr() { if (VGABASEADDRESS) return VGABASEADDRESS; diff --git a/engines/lab/vga.h b/engines/lab/vga.h index fe6b9f07a7..9e45b80e83 100644 --- a/engines/lab/vga.h +++ b/engines/lab/vga.h @@ -47,17 +47,17 @@ void getMode(uint16 *Mode); void setPage(uint16 PageNum); -void VGAStorePage(void); +void VGAStorePage(); -void VGARestorePage(void); +void VGARestorePage(); bool createScreen(bool HiRes); -void waitTOF(void); +void waitTOF(); -void quickWaitTOF(void); +void quickWaitTOF(); -byte *getVGABaseAddr(void); +byte *getVGABaseAddr(); void ungetVGABaseAddr(); -- cgit v1.2.3 From ca819e0b863cf56e1f03dde302f075472ec11e79 Mon Sep 17 00:00:00 2001 From: Filippos Karapetis Date: Tue, 24 Feb 2015 00:46:16 +0200 Subject: LAB: Rename playMusic() to playSoundEffect() This function actually starts sound effects. Music is started from playMusicBlock() --- engines/lab/audioi.cpp | 4 ++-- engines/lab/labfun.h | 2 +- engines/lab/readdiff.cpp | 4 ++-- 3 files changed, 5 insertions(+), 5 deletions(-) diff --git a/engines/lab/audioi.cpp b/engines/lab/audioi.cpp index 5b2d183155..735f9b67f1 100644 --- a/engines/lab/audioi.cpp +++ b/engines/lab/audioi.cpp @@ -177,7 +177,7 @@ void flushAudio() { -void playMusic(uint16 SampleSpeed, uint16 Volume, uint32 Length, bool flush, void *Data) { +void playSoundEffect(uint16 SampleSpeed, uint16 Volume, uint32 Length, bool flush, void *Data) { if (!DoMusic) return; @@ -204,7 +204,7 @@ void playMusic(uint16 SampleSpeed, uint16 Volume, uint32 Length, bool flush, voi soundFlags |= Audio::FLAG_16BITS; Audio::SeekableAudioStream *audStream = Audio::makeRawStream((const byte *)Data, Length, SampleSpeed, soundFlags, DisposeAfterUse::NO); - g_lab->_mixer->playStream(Audio::Mixer::kMusicSoundType, &g_musicHandle, audStream); + g_lab->_mixer->playStream(Audio::Mixer::kSFXSoundType, &g_musicHandle, audStream); updateSoundBuffers(); } diff --git a/engines/lab/labfun.h b/engines/lab/labfun.h index a527b12cb3..cc77a4c3f2 100644 --- a/engines/lab/labfun.h +++ b/engines/lab/labfun.h @@ -73,7 +73,7 @@ void updateSoundBuffers(); void flushAudio(); -void playMusic(uint16 SampleSpeed, uint16 Volume, uint32 Length, bool flush, void *Data); +void playSoundEffect(uint16 SampleSpeed, uint16 Volume, uint32 Length, bool flush, void *Data); diff --git a/engines/lab/readdiff.cpp b/engines/lab/readdiff.cpp index b75ed6d7e9..66bfa80274 100644 --- a/engines/lab/readdiff.cpp +++ b/engines/lab/readdiff.cpp @@ -291,7 +291,7 @@ void diffNextFrame() { uint32 musicsize = size; skip(difffile, size); - playMusic(samplespeed, 64, musicsize, true, music); + playSoundEffect(samplespeed, 64, musicsize, true, music); break; } case 65535L: @@ -563,7 +563,7 @@ void readSound() { uint32 musicsize = size_; skip(difffile_, size_); - playMusic(samplespeed_, 64, musicsize, true, music); + playSoundEffect(samplespeed_, 64, musicsize, true, music); } else if (header_ == 65535L) { if (mwaiteffect) { while (EffectPlaying) { -- cgit v1.2.3 From 1c77b2daf88c465c8f8cffddff65f8a7bca1af89 Mon Sep 17 00:00:00 2001 From: Filippos Karapetis Date: Tue, 24 Feb 2015 00:47:21 +0200 Subject: LAB: Implement correct duration calculation for the DOS version music --- engines/lab/labmusic.cpp | 13 +++++++++---- 1 file changed, 9 insertions(+), 4 deletions(-) diff --git a/engines/lab/labmusic.cpp b/engines/lab/labmusic.cpp index cd082700ca..4a427eded0 100644 --- a/engines/lab/labmusic.cpp +++ b/engines/lab/labmusic.cpp @@ -33,6 +33,7 @@ #include "lab/timing.h" #include "lab/mouse.h" #include "lab/vga.h" +#include "lab/lab.h" namespace Lab { @@ -470,8 +471,10 @@ byte **Music::newOpen(const char *name) { if (_musicOn) { updateMusic(); - LeftSecs = (getManyBuffersLeft() * MUSICBUFSIZE * 10) / (2 * SAMPLESPEED); // Windows (16-bit) - //LeftSecs = (getManyBuffersLeft() * MUSICBUFSIZE * 10) / SAMPLESPEED; // DOS (8-bit) - TODO + if (g_lab->getPlatform() == Common::kPlatformWindows) + LeftSecs = (getManyBuffersLeft() * MUSICBUFSIZE * 10) / (2 * SAMPLESPEED); // Windows (16-bit) + else + LeftSecs = (getManyBuffersLeft() * MUSICBUFSIZE * 10) / SAMPLESPEED; // DOS (8-bit) filelength = sizeOfFile(name) * 10; Time = 10 + /* Seek time for the music and the file */ @@ -507,8 +510,10 @@ void Music::fileCheckMusic(uint32 filelength) { updateMusic(); - LeftSecs = (getManyBuffersLeft() * MUSICBUFSIZE * 10) / (2 * SAMPLESPEED); // Windows (16-bit) - //LeftSecs = (getManyBuffersLeft() * MUSICBUFSIZE * 10) / SAMPLESPEED; // DOS (8-bit) - TODO + if (g_lab->getPlatform() == Common::kPlatformWindows) + LeftSecs = (getManyBuffersLeft() * MUSICBUFSIZE * 10) / (2 * SAMPLESPEED); // Windows (16-bit) + else + LeftSecs = (getManyBuffersLeft() * MUSICBUFSIZE * 10) / SAMPLESPEED; // DOS (8-bit) filelength *= 10; Time = 5 + /* Seek time for the music */ -- cgit v1.2.3 From 6006a0083627d9b43f110fe496a96d159f50b586 Mon Sep 17 00:00:00 2001 From: Filippos Karapetis Date: Tue, 24 Feb 2015 00:57:18 +0200 Subject: LAB: The audio data in the DOS version is unsigned --- engines/lab/audioi.cpp | 2 ++ 1 file changed, 2 insertions(+) diff --git a/engines/lab/audioi.cpp b/engines/lab/audioi.cpp index 735f9b67f1..c841e53680 100644 --- a/engines/lab/audioi.cpp +++ b/engines/lab/audioi.cpp @@ -202,6 +202,8 @@ void playSoundEffect(uint16 SampleSpeed, uint16 Volume, uint32 Length, bool flus byte soundFlags = Audio::FLAG_LITTLE_ENDIAN; if (g_lab->getPlatform() == Common::kPlatformWindows) soundFlags |= Audio::FLAG_16BITS; + else + soundFlags |= Audio::FLAG_UNSIGNED; Audio::SeekableAudioStream *audStream = Audio::makeRawStream((const byte *)Data, Length, SampleSpeed, soundFlags, DisposeAfterUse::NO); g_lab->_mixer->playStream(Audio::Mixer::kSFXSoundType, &g_musicHandle, audStream); -- cgit v1.2.3 From 9264f4964ece0d01db4e1bc22b24078c977d5fce Mon Sep 17 00:00:00 2001 From: Filippos Karapetis Date: Tue, 24 Feb 2015 11:27:27 +0200 Subject: LAB: Remove the unused setMode()/getMode() functions --- engines/lab/engine.cpp | 8 -------- engines/lab/vga.cpp | 14 -------------- engines/lab/vga.h | 4 ---- 3 files changed, 26 deletions(-) diff --git a/engines/lab/engine.cpp b/engines/lab/engine.cpp index ed90443a1d..1c89a749c8 100644 --- a/engines/lab/engine.cpp +++ b/engines/lab/engine.cpp @@ -236,8 +236,6 @@ static void drawRoomMessage(uint16 CurInv, CloseDataPtr cptr) { } -static uint16 OldMode; - /******************************************************************************/ /* Sets up the Labyrinth screens, and opens up the initial windows. */ /******************************************************************************/ @@ -1390,8 +1388,6 @@ void LabEngine::go() { bool mem, dointro = false; uint16 counter; - getMode(&OldMode); - DoMusic = true; g_music->_turnMusicOn = true; dointro = true; @@ -1443,8 +1439,6 @@ void LabEngine::go() { } if (!initMouse()) { - setMode((char) OldMode); - return; } @@ -1497,8 +1491,6 @@ void LabEngine::go() { g_music->freeMusic(); freeAudio(); - - setMode((char)OldMode); } /*****************************************************************************/ diff --git a/engines/lab/vga.cpp b/engines/lab/vga.cpp index 4c2584c480..d9633e97b5 100644 --- a/engines/lab/vga.cpp +++ b/engines/lab/vga.cpp @@ -62,13 +62,6 @@ uint16 g_KeyBuf[64]; uint16 g_NextKeyOut = 0; bool g_MouseAtEdge = false; -/*****************************************************************************/ -/* Sets the display mode. */ -/*****************************************************************************/ -void setMode(char mode) { - // There are no modes for SDL. -} - /*****************************************************************************/ /* Sets up either a low-res or a high-res 256 color screen. */ /*****************************************************************************/ @@ -333,13 +326,6 @@ void ungetVGABaseAddr() { WSDL_UnlockVideo(); } -/*****************************************************************************/ -/* Gets information about the current display. */ -/*****************************************************************************/ -void getMode(uint16 *Mode) { - // Only one mode in SDL. -} - /*****************************************************************************/ /* Draws an image to the screen. */ /*****************************************************************************/ diff --git a/engines/lab/vga.h b/engines/lab/vga.h index 9e45b80e83..d9110007df 100644 --- a/engines/lab/vga.h +++ b/engines/lab/vga.h @@ -41,10 +41,6 @@ struct Image { byte *ImageData; }; -void setMode(char mode); - -void getMode(uint16 *Mode); - void setPage(uint16 PageNum); void VGAStorePage(); -- cgit v1.2.3 From d949375e70a5df6a9816ee83417faa5d63664596 Mon Sep 17 00:00:00 2001 From: Filippos Karapetis Date: Tue, 24 Feb 2015 12:14:31 +0200 Subject: LAB: Remove unused variables --- engines/lab/engine.cpp | 6 ------ 1 file changed, 6 deletions(-) diff --git a/engines/lab/engine.cpp b/engines/lab/engine.cpp index 1c89a749c8..5a51c636b0 100644 --- a/engines/lab/engine.cpp +++ b/engines/lab/engine.cpp @@ -376,12 +376,6 @@ bool setUpScreens() { - - -uint16 curmousex = 0, curmousey = 0; - - - /******************************************************************************/ /* Permanently flips the imagry of a gadget. */ /******************************************************************************/ -- cgit v1.2.3 From 465f5f0c09bbdafa98bf5e0d1743bb1944a53621 Mon Sep 17 00:00:00 2001 From: Filippos Karapetis Date: Tue, 24 Feb 2015 12:16:33 +0200 Subject: LAB: Simplify mouse handling code --- engines/lab/mouse.cpp | 95 +++++++-------------------------------------------- 1 file changed, 12 insertions(+), 83 deletions(-) diff --git a/engines/lab/mouse.cpp b/engines/lab/mouse.cpp index 6e6c97dc33..591014c595 100644 --- a/engines/lab/mouse.cpp +++ b/engines/lab/mouse.cpp @@ -39,14 +39,11 @@ namespace Lab { extern bool IsHiRes; extern uint32 VGAScreenWidth, VGAScreenHeight; -void mouseHideXY(); - static bool LeftClick = false; static bool RightClick = false; -static bool MouseHidden = true, QuitMouseHandler = false; +static bool MouseHidden = true; static int32 NumHidden = 1; -static uint16 CurMouseX, CurMouseY; static Gadget *LastGadgetHit = NULL; Gadget *ScreenGadgetList = NULL; static byte MouseData[] = {1, 1, 0, 0, 0, 0, 0, 0, 0, 0, @@ -68,11 +65,9 @@ static byte MouseData[] = {1, 1, 0, 0, 0, 0, 0, 0, 0, 0, #define MOUSE_WIDTH 10 #define MOUSE_HEIGHT 15 -static bool drawmouse = false, gadhit = false; +static bool gadhit = false; static Gadget *hitgad = NULL; -void mouseShowXY(uint16 CurMouseX, uint16 CurMouseY); - /*****************************************************************************/ /* Checks whether or not the cords fall within one of the gadgets in a list */ /* of gadgets. */ @@ -89,20 +84,18 @@ static Gadget *checkGadgetHit(Gadget *gadlist, uint16 x, uint16 y) { gadhit = true; hitgad = gadlist; } else { - QuitMouseHandler = true; VGAStorePage(); - mouseHideXY(); + mouseHide(); drawImage(gadlist->ImAlt, gadlist->x, gadlist->y); - mouseShowXY(x, y); + mouseShow(); for (counter = 0; counter < 3; counter++) waitTOF(); - mouseHideXY(); + mouseHide(); drawImage(gadlist->Im, gadlist->x, gadlist->y); - mouseShowXY(x, y); + mouseShow(); VGARestorePage(); - QuitMouseHandler = false; } return gadlist; @@ -131,14 +124,6 @@ void mouse_handler(int32 flag, int32 mouseX, int32 mouseY) { mouseX /= 2; if (flag & 0x01) { /* mouse Move */ - if ((CurMouseX != mouseX) || (CurMouseY != mouseY)) { - CurMouseX = mouseX; - CurMouseY = mouseY; - - if (IsHiRes && !QuitMouseHandler) { - drawmouse = true; - } - } } if ((flag & 0x02) && (NumHidden < 2)) { /* Left mouse button click */ @@ -151,15 +136,11 @@ void mouse_handler(int32 flag, int32 mouseX, int32 mouseY) { LastGadgetHit = TempGad; } else { LeftClick = true; - CurMouseX = mouseX; - CurMouseY = mouseY; } } if ((flag & 0x08) && (NumHidden < 2)) { /* Right mouse button click */ RightClick = true; - CurMouseX = mouseX; - CurMouseY = mouseY; } } @@ -170,16 +151,12 @@ void updateMouse() { uint16 counter; bool doUpdateDisplay = false; - if (drawmouse && !MouseHidden) { - QuitMouseHandler = true; - drawmouse = false; - QuitMouseHandler = false; + if (!MouseHidden) { doUpdateDisplay = true; } if (gadhit) { gadhit = false; - QuitMouseHandler = true; mouseHide(); drawImage(hitgad->ImAlt, hitgad->x, hitgad->y); mouseShow(); @@ -191,7 +168,6 @@ void updateMouse() { drawImage(hitgad->Im, hitgad->x, hitgad->y); mouseShow(); doUpdateDisplay = true; - QuitMouseHandler = false; } if (doUpdateDisplay) @@ -220,62 +196,21 @@ bool initMouse() { /* Shows the mouse. */ /*****************************************************************************/ void mouseShow() { - mouseShowXY(CurMouseX, CurMouseY); - - g_system->showMouse(true); -} - - - - - -/*****************************************************************************/ -/* Shows the mouse. */ -/*****************************************************************************/ -void mouseShowXY(uint16 MouseX, uint16 MouseY) { - QuitMouseHandler = true; - if (NumHidden) NumHidden--; if ((NumHidden == 0) && MouseHidden) { - CurMouseX = MouseX; - CurMouseY = MouseY; WSDL_ProcessInput(0); MouseHidden = false; } - QuitMouseHandler = false; + g_system->showMouse(true); } - - /*****************************************************************************/ /* Hides the mouse. */ /*****************************************************************************/ void mouseHide() { - QuitMouseHandler = true; - - NumHidden++; - - if (NumHidden && !MouseHidden) { - MouseHidden = true; - - g_system->showMouse(false); - } - - QuitMouseHandler = false; -} - - - - -/*****************************************************************************/ -/* Hides the mouse. */ -/*****************************************************************************/ -void mouseHideXY() { - QuitMouseHandler = true; - NumHidden++; if (NumHidden && !MouseHidden) { @@ -283,12 +218,9 @@ void mouseHideXY() { g_system->showMouse(false); } - - QuitMouseHandler = false; } - extern uint32 g_MouseX; extern uint32 g_MouseY; @@ -317,10 +249,7 @@ void mouseMove(uint16 x, uint16 y) { g_system->warpMouse(x, y); if (!MouseHidden) { - QuitMouseHandler = true; - mouseXY(&CurMouseX, &CurMouseY); WSDL_ProcessInput(0); - QuitMouseHandler = false; } } @@ -335,15 +264,15 @@ void mouseMove(uint16 x, uint16 y) { bool mouseButton(uint16 *x, uint16 *y, bool leftbutton) { if (leftbutton) { if (LeftClick) { - *x = CurMouseX; - *y = CurMouseY; + *x = (!IsHiRes) ? (uint16)g_MouseX / 2 : (uint16)g_MouseX; + *y = (uint16)g_MouseY; LeftClick = false; return true; } } else { if (RightClick) { - *x = CurMouseX; - *y = CurMouseY; + *x = (!IsHiRes) ? (uint16)g_MouseX / 2 : (uint16)g_MouseX; + *y = (uint16)g_MouseY; RightClick = false; return true; } -- cgit v1.2.3 From a83c50cf66e72d105ef64b29a10e3f9603e0141b Mon Sep 17 00:00:00 2001 From: Filippos Karapetis Date: Tue, 24 Feb 2015 13:09:52 +0200 Subject: LAB: Remove duplicate swap code and some unused defines --- engines/lab/map.cpp | 2 +- engines/lab/readdiff.cpp | 24 ++++++++++++------------ engines/lab/stddefines.h | 11 ----------- 3 files changed, 13 insertions(+), 24 deletions(-) diff --git a/engines/lab/map.cpp b/engines/lab/map.cpp index f51bf86716..b6b4415b11 100644 --- a/engines/lab/map.cpp +++ b/engines/lab/map.cpp @@ -291,7 +291,7 @@ static bool loadMapData() { for (counter = 1; counter <= MaxRooms; counter++) { swapUShortPtr(&Maps[counter].x, 4); - swapULongPtr(&Maps[counter].MapFlags, 1); + swapULong(&Maps[counter].MapFlags); } } else return false; diff --git a/engines/lab/readdiff.cpp b/engines/lab/readdiff.cpp index 66bfa80274..5eb62878a9 100644 --- a/engines/lab/readdiff.cpp +++ b/engines/lab/readdiff.cpp @@ -205,9 +205,9 @@ void diffNextFrame() { g_music->updateMusic(); readBlock(&header, 4L, difffile); - swapULongPtr(&header, 1); + swapULong(&header); readBlock(&size, 4L, difffile); - swapULongPtr(&size, 1); + swapULong(&size); processed += 8L; @@ -379,7 +379,7 @@ void playDiff() { temp[4] = '\0'; readBlock(&header, 4L, difffile); - swapULongPtr(&header, 1); + swapULong(&header); processed += 8L; @@ -389,10 +389,10 @@ void playDiff() { } readBlock(&header, 4L, difffile); - swapULongPtr(&header, 1); + swapULong(&header); readBlock(&size, 4L, difffile); - swapULongPtr(&size, 1); + swapULong(&size); if (header == 0) { // sizeof(headerdata) != 18, but the padding might be at the end @@ -408,9 +408,9 @@ void playDiff() { skip(difffile, size - 18); swapUShortPtr(&headerdata.Version, 3); - swapULongPtr(&headerdata.BufferSize, 1); + swapULong(&headerdata.BufferSize); swapUShortPtr(&headerdata.Machine, 1); - swapULongPtr(&headerdata.Flags, 1); + swapULong(&headerdata.Flags); continuous = CONTINUOUS & headerdata.Flags; diffwidth = headerdata.x; @@ -517,7 +517,7 @@ void readSound() { readBlock(temp_, 4L, difffile_); temp_[4] = '\0'; readBlock(&header_, 4L, difffile_); - swapULongPtr(&header_, 1); + swapULong(&header_); processed += 8L; @@ -525,10 +525,10 @@ void readSound() { return; readBlock(&header_, 4L, difffile_); - swapULongPtr(&header_, 1); + swapULong(&header_); readBlock(&size_, 4L, difffile_); - swapULongPtr(&size_, 1); + swapULong(&size_); if (header_ == 0) skip(difffile_, size_); @@ -538,10 +538,10 @@ void readSound() { while (header_ != 65535) { g_music->updateMusic(); readBlock(&header_, 4L, difffile_); - swapULongPtr(&header_, 1); + swapULong(&header_); readBlock(&size_, 4L, difffile_); - swapULongPtr(&size_, 1); + swapULong(&size_); if ((header_ == 30) || (header_ == 31)) { if (mwaiteffect) { diff --git a/engines/lab/stddefines.h b/engines/lab/stddefines.h index 67bd39a47d..8c74d10a99 100644 --- a/engines/lab/stddefines.h +++ b/engines/lab/stddefines.h @@ -37,25 +37,14 @@ namespace Lab { -#define IS_MACOSX 1 - -#if defined(IS_MACOSX) -#define getTime Lab_GetTime -#define delay Lab_Delay -#endif - #define swapUShort(value) (value) #define swapUShortPtr(ptr,count) (ptr) #define swapShort(value) (value) #define swapShortPtr(ptr,count) (ptr) #define swapUInt(value) (value) -#define swapUIntPtr(ptr,count) (ptr) #define swapInt(value) (value) -#define swapIntPtr(ptr,count) (ptr) #define swapULong(value) (value) -#define swapULongPtr(ptr,count) (ptr) #define swapLong(value) (value) -#define swapLongPtr(ptr,count) (ptr) } // End of namespace Lab -- cgit v1.2.3 From 83e58fe452828f29d59aa1b324d2040b1d6c539b Mon Sep 17 00:00:00 2001 From: Filippos Karapetis Date: Tue, 24 Feb 2015 18:51:44 +0200 Subject: LAB: Rename waiteffect -> waitForEffect --- engines/lab/engine.cpp | 6 +++--- engines/lab/processroom.cpp | 8 ++++---- engines/lab/readdiff.cpp | 12 ++++++------ 3 files changed, 13 insertions(+), 13 deletions(-) diff --git a/engines/lab/engine.cpp b/engines/lab/engine.cpp index 5a51c636b0..f8391d3f0d 100644 --- a/engines/lab/engine.cpp +++ b/engines/lab/engine.cpp @@ -47,7 +47,7 @@ bool LongWinInFront = false; TextFont *MsgFont; -extern bool DoBlack, waiteffect, EffectPlaying, stopsound, DoNotDrawMessage, IsHiRes, nopalchange, DoMusic; +extern bool DoBlack, waitForEffect, EffectPlaying, stopsound, DoNotDrawMessage, IsHiRes, nopalchange, DoMusic; /* Global parser data */ @@ -612,9 +612,9 @@ static bool doUse(uint16 CurInv) { } DoBlack = false; - waiteffect = true; + waitForEffect = true; readPict("Music:Click", true); - waiteffect = false; + waitForEffect = false; DoBlack = false; Test = getInvName(CurInv); diff --git a/engines/lab/processroom.cpp b/engines/lab/processroom.cpp index 70eac05cc7..9c5055f01e 100644 --- a/engines/lab/processroom.cpp +++ b/engines/lab/processroom.cpp @@ -62,7 +62,7 @@ const char *ViewPath = "LAB:Rooms/"; const char *NewFileName; extern bool DoNotDrawMessage; -extern bool NoFlip, IsBM, noupdatediff, waiteffect, mwaiteffect, QuitLab, EffectPlaying, soundplaying, MusicOn, DoBlack, ContMusic, DoNotReset; +extern bool NoFlip, IsBM, noupdatediff, waitForEffect, mwaitForEffect, QuitLab, EffectPlaying, soundplaying, MusicOn, DoBlack, ContMusic, DoNotReset; extern char diffcmap[256 * 3]; extern CloseDataPtr CPtr; @@ -406,14 +406,14 @@ static void doActions(ActionPtr APtr, CloseDataPtr *LCPtr) { switch (APtr->ActionType) { case PLAYSOUND: - mwaiteffect = true; /* Plays a sound, but waits for it to be done before continuing */ + mwaitForEffect = true; /* Plays a sound, but waits for it to be done before continuing */ ContMusic = false; readMusic((char *)APtr->Data); - mwaiteffect = false; + mwaitForEffect = false; break; case PLAYSOUNDB: - mwaiteffect = false; /* Plays a sound in the background. */ + mwaitForEffect = false; /* Plays a sound in the background. */ ContMusic = false; readMusic((char *)APtr->Data); break; diff --git a/engines/lab/readdiff.cpp b/engines/lab/readdiff.cpp index 5eb62878a9..3f7cdc7409 100644 --- a/engines/lab/readdiff.cpp +++ b/engines/lab/readdiff.cpp @@ -58,9 +58,9 @@ bool NoFlip = false, /* Don't flip the new picture to front */ stopsound = false, soundplaying = false, screenbuffer = false, - waiteffect = false, /* Wait for each sound effect to finish + waitForEffect = false, /* Wait for each sound effect to finish before coninuing. */ - mwaiteffect = false; + mwaitForEffect = false; uint16 DataBytesPerRow; @@ -273,7 +273,7 @@ void diffNextFrame() { case 30L: case 31L: { - if (waiteffect) { + if (waitForEffect) { while (EffectPlaying) { g_music->updateMusic(); waitTOF(); @@ -298,7 +298,7 @@ void diffNextFrame() { if ((framenumber == 1) || PlayOnce || StopPlayingEnd) { int didTOF = 0; - if (waiteffect) { + if (waitForEffect) { while (EffectPlaying) { g_music->updateMusic(); waitTOF(); @@ -544,7 +544,7 @@ void readSound() { swapULong(&size_); if ((header_ == 30) || (header_ == 31)) { - if (mwaiteffect) { + if (mwaitForEffect) { while (EffectPlaying) { g_music->updateMusic(); waitTOF(); @@ -565,7 +565,7 @@ void readSound() { playSoundEffect(samplespeed_, 64, musicsize, true, music); } else if (header_ == 65535L) { - if (mwaiteffect) { + if (mwaitForEffect) { while (EffectPlaying) { g_music->updateMusic(); waitTOF(); -- cgit v1.2.3 From 22b82d7729a2bd40b981a8faba16eff5c708df21 Mon Sep 17 00:00:00 2001 From: Filippos Karapetis Date: Tue, 24 Feb 2015 19:22:03 +0200 Subject: LAB: Initial music implementation The whole music code is greatly simplified --- engines/lab/audioi.cpp | 70 ++++++++------- engines/lab/labfun.h | 24 +----- engines/lab/labmusic.cpp | 219 ++++------------------------------------------- 3 files changed, 57 insertions(+), 256 deletions(-) diff --git a/engines/lab/audioi.cpp b/engines/lab/audioi.cpp index c841e53680..10b570e835 100644 --- a/engines/lab/audioi.cpp +++ b/engines/lab/audioi.cpp @@ -50,63 +50,61 @@ bool EffectPlaying = false, ContMusic = false, DoMusic = false; static char *CurMusic, *startMusic; static uint32 StartMusicLen; static Audio::SoundHandle g_musicHandle; +static Audio::SoundHandle g_sfxHandle; +static Audio::QueuingAudioStream *queuingAudioStream = NULL; + +static byte *playBuffer; void freeAudio() { if (!DoMusic) return; - // TODO - //SDLWrapAudio(); + g_lab->_mixer->stopHandle(g_musicHandle); + g_lab->_mixer->stopHandle(g_sfxHandle); + + delete queuingAudioStream; + queuingAudioStream = NULL; + delete[] playBuffer; } bool initAudio() { - if (!DoMusic) - return true; - -// TODO -#if 0 - // we allocate extra mempory for 16-bit samples - // TODO: 8-bit mono sample for DOS - buf1 = malloc(PLAYBUFSIZE); - - if (buf1 == NULL) - return false; - - buf2 = malloc(PLAYBUFSIZE); - - if (buf2 == NULL) - return false; - - if (!SDLInitAudio()) - return false; -#endif - + playBuffer = new byte[PLAYBUFSIZE]; return true; } -bool musicBufferEmpty(uint16 i) { - // TODO: Multiple streams - return !g_lab->_mixer->isSoundHandleActive(g_musicHandle); +bool musicBufferEmpty() { + return !g_lab->_mixer->isSoundHandleActive(g_sfxHandle); } +uint16 getPlayingBufferCount() { + return (queuingAudioStream) ? queuingAudioStream->numQueuedStreams() : 0; +} void playMusicBlock(void *Ptr, uint32 Size, uint16 BufferNum, uint16 SampleSpeed) { - // TODO -#if 0 + bool startMusic = false; if (SampleSpeed < 4000) SampleSpeed = 4000; - tempblock = firstblock; - tempblock.sel_data = Ptr; - tempblock.len = Size; + if (!queuingAudioStream) { + queuingAudioStream = Audio::makeQueuingAudioStream(SampleSpeed, false); + startMusic = true; + } - SDLPlayBuffer(BufferNum, &tempblock); -#endif + byte soundFlags = Audio::FLAG_LITTLE_ENDIAN; + if (g_lab->getPlatform() == Common::kPlatformWindows) + soundFlags |= Audio::FLAG_16BITS; + else + soundFlags |= Audio::FLAG_UNSIGNED; + + queuingAudioStream->queueBuffer((byte *)Ptr, Size, DisposeAfterUse::YES, soundFlags); + + if (startMusic) + g_lab->_mixer->playStream(Audio::Mixer::kMusicSoundType, &g_musicHandle, queuingAudioStream); } @@ -119,7 +117,7 @@ void updateSoundBuffers() { // TODO // FIXME: Very crude implementation - if (musicBufferEmpty(0)) { + if (musicBufferEmpty()) { flushAudio(); EffectPlaying = false; } @@ -170,7 +168,7 @@ void flushAudio() { if (!DoMusic) return; - g_lab->_mixer->stopHandle(g_musicHandle); + g_lab->_mixer->stopHandle(g_sfxHandle); EffectPlaying = false; } @@ -206,7 +204,7 @@ void playSoundEffect(uint16 SampleSpeed, uint16 Volume, uint32 Length, bool flus soundFlags |= Audio::FLAG_UNSIGNED; Audio::SeekableAudioStream *audStream = Audio::makeRawStream((const byte *)Data, Length, SampleSpeed, soundFlags, DisposeAfterUse::NO); - g_lab->_mixer->playStream(Audio::Mixer::kSFXSoundType, &g_musicHandle, audStream); + g_lab->_mixer->playStream(Audio::Mixer::kSFXSoundType, &g_sfxHandle, audStream); updateSoundBuffers(); } diff --git a/engines/lab/labfun.h b/engines/lab/labfun.h index cc77a4c3f2..d976feea38 100644 --- a/engines/lab/labfun.h +++ b/engines/lab/labfun.h @@ -62,17 +62,12 @@ struct SaveGameHeader { /*----------------------------*/ bool initAudio(); - void freeAudio(); - -bool musicBufferEmpty(uint16 i); - +bool musicBufferEmpty(); void playMusicBlock(void *Ptr, uint32 Size, uint16 BufferNum, uint16 SampleSpeed); - +uint16 getPlayingBufferCount(); void updateSoundBuffers(); - void flushAudio(); - void playSoundEffect(uint16 SampleSpeed, uint16 Volume, uint32 Length, bool flush, void *Data); @@ -222,9 +217,7 @@ void decrypt(byte *text); /*----- From LabMusic.c -----*/ /*---------------------------*/ -#define MANYBUFFERS 5L #define MAXBUFFERS 5L -#define MINBUFFERS 2L class Music { public: @@ -243,15 +236,13 @@ public: void pauseBackMusic(); void changeMusic(const char *newmusic); void resetMusic(); - void fileCheckMusic(uint32 filelength); bool _winmusic, _doNotFileFlushAudio; bool _turnMusicOn; bool _musicOn; private: - void fillbuffer(uint16 unit); - uint16 getManyBuffersLeft(); + void fillbuffer(byte *musicBuffer); void startMusic(bool startatbegin); Common::File *_file; @@ -259,15 +250,8 @@ private: bool _musicPaused; bool _tMusicOn; - uint32 _tFileLength; uint32 _tLeftInFile; - - uint16 _manyBuffers; - - void *_musicBuffer[MAXBUFFERS]; - uint16 _musicFilledTo, _musicPlaying, _musicOnBuffer; - - uint32 _filelength, _leftinfile; + uint32 _leftinfile; }; diff --git a/engines/lab/labmusic.cpp b/engines/lab/labmusic.cpp index 4a427eded0..1f5794b995 100644 --- a/engines/lab/labmusic.cpp +++ b/engines/lab/labmusic.cpp @@ -50,16 +50,8 @@ Music::Music() { _musicPaused = false; _tMusicOn = false; - _tFileLength = 0; _tLeftInFile = 0; - _manyBuffers = MANYBUFFERS; - - _musicFilledTo = 0; - _musicPlaying = 0; - _musicOnBuffer = 0; - - _filelength = 0; _leftinfile = 0; _musicOn = false; @@ -73,143 +65,52 @@ Music::Music() { /* it from the Audio device. */ /*****************************************************************************/ void Music::updateMusic() { - uint16 i; - WSDL_ProcessInput(0); updateMouse(); if (EffectPlaying) updateSoundBuffers(); - else if (_musicOn) { - for (i = 0; i < 2; i++) { - if (musicBufferEmpty(i)) { - playMusicBlock(_musicBuffer[_musicPlaying], MUSICBUFSIZE, i, SAMPLESPEED); - - if (_musicPlaying) - _musicOnBuffer = _musicPlaying - 1; - else - _musicOnBuffer = _manyBuffers - 1; - - _musicPlaying++; - - if (_musicPlaying >= _manyBuffers) - _musicPlaying = 0; - } - } + + if (_musicOn && getPlayingBufferCount() < MAXBUFFERS) { + // NOTE: We need to use malloc(), cause this will be freed with free() + // by the music code + byte *musicBuffer = (byte *)malloc(MUSICBUFSIZE); + fillbuffer(musicBuffer); + playMusicBlock(musicBuffer, MUSICBUFSIZE, 0, SAMPLESPEED); } } -void Music::fillbuffer(uint16 unit) { - return; - - warning("STUB: Music::fillbuffer"); - uint32 Size = MUSICBUFSIZE; - void *ptr = _musicBuffer[unit]; - - if (Size < _leftinfile) { - _file->read(ptr, Size); - _leftinfile -= Size; +void Music::fillbuffer(byte *musicBuffer) { + if (MUSICBUFSIZE < _leftinfile) { + _file->read(musicBuffer, MUSICBUFSIZE); + _leftinfile -= MUSICBUFSIZE; } else { - _file->read(ptr, _leftinfile); + _file->read(musicBuffer, _leftinfile); - memset((char *)ptr + _leftinfile, 0, Size - _leftinfile); + memset((char *)musicBuffer + _leftinfile, 0, MUSICBUFSIZE - _leftinfile); _file->seek(0); - _leftinfile = _filelength; + _leftinfile = _file->size(); } } - -/*****************************************************************************/ -/* Figures out how many *complete* buffers of music left to play. */ -/*****************************************************************************/ -uint16 Music::getManyBuffersLeft() { - uint16 mp = _musicOnBuffer; - - if (mp == _musicFilledTo) /* Already filled */ - return _manyBuffers; - else if (mp > _musicFilledTo) - return _manyBuffers - (mp - _musicFilledTo); - else - return _musicFilledTo - mp; -} - - - /*****************************************************************************/ /* Fills up the buffers that have already been played if necessary; if doit */ /* is set to TRUE then it will fill up all empty buffers. Otherwise, it */ /* Check if there are MINBUFFERS or less buffers that are playing. */ /*****************************************************************************/ void Music::fillUpMusic(bool doit) { - int16 ManyLeft, ManyFill; - updateMusic(); - - if (!_musicOn) - return; - - ManyLeft = getManyBuffersLeft(); - - if (ManyLeft < MINBUFFERS) - doit = true; - else if (ManyLeft == _manyBuffers) /* All the buffers are already full */ - doit = false; - - if (doit && (ManyLeft < _manyBuffers) && ManyLeft) { - ManyFill = _manyBuffers - ManyLeft - 1; - - while (ManyFill > 0) { - _musicFilledTo++; - - if (_musicFilledTo >= _manyBuffers) - _musicFilledTo = 0; - - fillbuffer(_musicFilledTo); - updateMusic(); - - ManyFill--; - } - - updateMusic(); - - ManyLeft = getManyBuffersLeft(); - - if (ManyLeft < _manyBuffers) { - ManyFill = _manyBuffers - ManyLeft - 1; - - while (ManyFill > 0) { - _musicFilledTo++; - - if (_musicFilledTo >= _manyBuffers) - _musicFilledTo = 0; - - fillbuffer(_musicFilledTo); - updateMusic(); - - ManyFill--; - } - } - } - - updateMusic(); - - /* NYI: A check for dirty cds; for instance, if lots of buffers already - played */ } - - /*****************************************************************************/ /* Starts up the music initially. */ /*****************************************************************************/ void Music::startMusic(bool startatbegin) { - uint16 counter; - if (!_musicOn) return; @@ -217,32 +118,18 @@ void Music::startMusic(bool startatbegin) { if (startatbegin) { _file->seek(0); - _leftinfile = _filelength; + _leftinfile = _file->size(); } - _musicPlaying = 0; - _musicOnBuffer = 0; - _musicFilledTo = _manyBuffers - 1; - - _musicOn = false; - - for (counter = 0; counter < _manyBuffers; counter++) - fillbuffer(counter); - _musicOn = true; updateMusic(); } - - - - /*****************************************************************************/ /* Initializes the music buffers. */ /*****************************************************************************/ bool Music::initMusic() { - uint16 counter; if (!_turnMusicOn) return true; @@ -257,12 +144,6 @@ bool Music::initMusic() { else filename = "Music:BackGrou"; - if (_musicBuffer[0] == NULL) { - for (counter = 0; counter < _manyBuffers; counter++) - _musicBuffer[counter] = malloc(MUSICBUFSIZE); - } - - _filelength = sizeOfFile(filename); _file = openPartial(filename); if (_file) { @@ -298,10 +179,7 @@ void Music::pauseBackMusic() { _musicOn = false; flushAudio(); - if (_musicPlaying) - _musicPlaying--; - else - _musicPlaying = _manyBuffers - 1; + // TODO: Pause _musicPaused = true; } @@ -373,13 +251,12 @@ void Music::changeMusic(const char *newmusic) { if (!_tFile) { _tFile = _file; _tMusicOn = _musicOn; - _tFileLength = _filelength; #if defined(DOSCODE) _tLeftInFile = _leftinfile; #else _tLeftInFile = _leftinfile + 65536L; - if (_tLeftInFile > _tFileLength) + if (_tLeftInFile > (uint32)_tFile->size()) _tLeftInFile = _leftinfile; #endif @@ -390,9 +267,6 @@ void Music::changeMusic(const char *newmusic) { if (_file) { _musicOn = true; /* turn it off */ setMusic(false); - - _filelength = sizeOfFile(newmusic); - _musicOn = false; /* turn it back on */ setMusic(true); } else { @@ -414,10 +288,9 @@ void Music::resetMusic() { _file->close(); _file = _tFile; - _filelength = _tFileLength; _leftinfile = _tLeftInFile; - _file->seek(_filelength - _leftinfile); + _file->seek(_file->size() - _leftinfile); _musicOn = true; setMusic(false); @@ -435,14 +308,6 @@ void Music::resetMusic() { } - - - -#define FUDGEFACTOR 5L -#define READSPEED (2 * 130000L) - - - /*****************************************************************************/ /* Checks whether or note enough memory in music buffer before loading any */ /* files. Fills it if not. Does not take into account the current buffer */ @@ -452,8 +317,6 @@ void Music::resetMusic() { /* Here, the seconds are multipled by 10. */ /*****************************************************************************/ byte **Music::newOpen(const char *name) { - uint32 filelength, LeftSecs, Time; - byte **file; if (name == NULL) { @@ -470,19 +333,7 @@ byte **Music::newOpen(const char *name) { if (_musicOn) { updateMusic(); - - if (g_lab->getPlatform() == Common::kPlatformWindows) - LeftSecs = (getManyBuffersLeft() * MUSICBUFSIZE * 10) / (2 * SAMPLESPEED); // Windows (16-bit) - else - LeftSecs = (getManyBuffersLeft() * MUSICBUFSIZE * 10) / SAMPLESPEED; // DOS (8-bit) - - filelength = sizeOfFile(name) * 10; - Time = 10 + /* Seek time for the music and the file */ - (filelength / READSPEED) + /* Read time for the file */ - FUDGEFACTOR; - - if (Time >= LeftSecs) - fillUpMusic(true); + fillUpMusic(true); } if (!_doNotFileFlushAudio && EffectPlaying) @@ -493,36 +344,4 @@ byte **Music::newOpen(const char *name) { return file; } - - -/*****************************************************************************/ -/* Checks whether or note enough memory in music buffer to continue loading */ -/* in a file. Fills the music buffer if not. Does not take into account */ -/* the current buffer playing; a built in fudge factor. We've also got */ -/* another FUDGEFACTOR defined above in case things go wrong. */ -/* */ -/* Here, the seconds are multipled by 10. */ -/*****************************************************************************/ -void Music::fileCheckMusic(uint32 filelength) { - uint32 LeftSecs, Time; - - if (_musicOn) { - updateMusic(); - - - if (g_lab->getPlatform() == Common::kPlatformWindows) - LeftSecs = (getManyBuffersLeft() * MUSICBUFSIZE * 10) / (2 * SAMPLESPEED); // Windows (16-bit) - else - LeftSecs = (getManyBuffersLeft() * MUSICBUFSIZE * 10) / SAMPLESPEED; // DOS (8-bit) - - filelength *= 10; - Time = 5 + /* Seek time for the music */ - (filelength / READSPEED) + /* Read time for the file */ - FUDGEFACTOR; - - if (Time >= LeftSecs) - fillUpMusic(true); - } -} - } // End of namespace Lab -- cgit v1.2.3 From 6842ffbe90867deb214f4f9e7f0f75476fbefdf9 Mon Sep 17 00:00:00 2001 From: Filippos Karapetis Date: Tue, 24 Feb 2015 23:41:41 +0200 Subject: LAB: Further clean up of the music and sound effect code --- engines/lab/audioi.cpp | 212 -------------------------------------------- engines/lab/engine.cpp | 34 +------ engines/lab/graphics.cpp | 6 +- engines/lab/labfun.h | 38 ++++---- engines/lab/labmusic.cpp | 100 +++++++++++++++------ engines/lab/module.mk | 1 - engines/lab/processroom.cpp | 55 +++++------- engines/lab/readdiff.cpp | 15 ++-- 8 files changed, 125 insertions(+), 336 deletions(-) delete mode 100644 engines/lab/audioi.cpp diff --git a/engines/lab/audioi.cpp b/engines/lab/audioi.cpp deleted file mode 100644 index 10b570e835..0000000000 --- a/engines/lab/audioi.cpp +++ /dev/null @@ -1,212 +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. - * - */ - -/* - * This code is based on Labyrinth of Time code with assistance of - * - * Copyright (c) 1993 Terra Nova Development - * Copyright (c) 2004 The Wyrmkeep Entertainment Co. - * - */ - -#include "audio/mixer.h" -#include "audio/audiostream.h" -#include "audio/decoders/raw.h" - -#include "lab/lab.h" -#include "lab/stddefines.h" -#include "lab/labfun.h" - -namespace Lab { - -#define PLAYBUFSIZE 65536L - -extern bool MusicOn; - -//static sound_buff firstblock, tempblock; -static int bufnum; - - -bool EffectPlaying = false, ContMusic = false, DoMusic = false; -static char *CurMusic, *startMusic; -static uint32 StartMusicLen; -static Audio::SoundHandle g_musicHandle; -static Audio::SoundHandle g_sfxHandle; -static Audio::QueuingAudioStream *queuingAudioStream = NULL; - -static byte *playBuffer; - -void freeAudio() { - if (!DoMusic) - return; - - g_lab->_mixer->stopHandle(g_musicHandle); - g_lab->_mixer->stopHandle(g_sfxHandle); - - delete queuingAudioStream; - queuingAudioStream = NULL; - delete[] playBuffer; -} - - - -bool initAudio() { - playBuffer = new byte[PLAYBUFSIZE]; - return true; -} - - -bool musicBufferEmpty() { - return !g_lab->_mixer->isSoundHandleActive(g_sfxHandle); -} - - -uint16 getPlayingBufferCount() { - return (queuingAudioStream) ? queuingAudioStream->numQueuedStreams() : 0; -} - -void playMusicBlock(void *Ptr, uint32 Size, uint16 BufferNum, uint16 SampleSpeed) { - bool startMusic = false; - - if (SampleSpeed < 4000) - SampleSpeed = 4000; - - if (!queuingAudioStream) { - queuingAudioStream = Audio::makeQueuingAudioStream(SampleSpeed, false); - startMusic = true; - } - - byte soundFlags = Audio::FLAG_LITTLE_ENDIAN; - if (g_lab->getPlatform() == Common::kPlatformWindows) - soundFlags |= Audio::FLAG_16BITS; - else - soundFlags |= Audio::FLAG_UNSIGNED; - - queuingAudioStream->queueBuffer((byte *)Ptr, Size, DisposeAfterUse::YES, soundFlags); - - if (startMusic) - g_lab->_mixer->playStream(Audio::Mixer::kMusicSoundType, &g_musicHandle, queuingAudioStream); -} - - -void updateSoundBuffers() { - if (!DoMusic) - return; - - if (!EffectPlaying) - return; - - // TODO - // FIXME: Very crude implementation - if (musicBufferEmpty()) { - flushAudio(); - EffectPlaying = false; - } - -#if 0 - for (int i = 0; i < 2; i++) { - if ((SDLSoundBufferStatus(i) == DAC_DONE) && firstblock.len) { - // use extra memory for 16-bit samples - tempblock.len = MIN(PLAYBUFSIZE, firstblock.len); - firstblock.len -= tempblock.len; - - if (!(bufnum ^= 1)) { - memcpy(buf1, CurMusic, (unsigned) tempblock.len); - tempblock.sel_data = buf1; - } else { - memcpy(buf2, CurMusic, (unsigned) tempblock.len); - tempblock.sel_data = buf2; - } - - CurMusic += tempblock.len; - - SDLPlayBuffer(i, &tempblock); - } - } - - // - // Playback ends when no bytes are left in the source data and - // the status of both buffers equals DAC_DONE - // - - if (!firstblock.len) { - if (ContMusic) { - CurMusic = startMusic; - firstblock.len = StartMusicLen; - } else if ((SDLSoundBufferStatus(0) == DAC_DONE) && - (SDLSoundBufferStatus(1) == DAC_DONE)) { - flushAudio(); - EffectPlaying = false; - } - } - -#endif -} - - - -void flushAudio() { - if (!DoMusic) - return; - - g_lab->_mixer->stopHandle(g_sfxHandle); - EffectPlaying = false; -} - - - - -void playSoundEffect(uint16 SampleSpeed, uint16 Volume, uint32 Length, bool flush, void *Data) { - if (!DoMusic) - return; - - g_music->pauseBackMusic(); - - if (flush) - flushAudio(); - - if (SampleSpeed < 4000) - SampleSpeed = 4000; - - // TODO: 8-bit mono sample for DOS - //firstblock.len = Length; - bufnum = 0; - - //tempblock = firstblock; - EffectPlaying = true; - CurMusic = (char *)Data; - startMusic = CurMusic; - StartMusicLen = Length; - - byte soundFlags = Audio::FLAG_LITTLE_ENDIAN; - if (g_lab->getPlatform() == Common::kPlatformWindows) - soundFlags |= Audio::FLAG_16BITS; - else - soundFlags |= Audio::FLAG_UNSIGNED; - - Audio::SeekableAudioStream *audStream = Audio::makeRawStream((const byte *)Data, Length, SampleSpeed, soundFlags, DisposeAfterUse::NO); - g_lab->_mixer->playStream(Audio::Mixer::kSFXSoundType, &g_sfxHandle, audStream); - - updateSoundBuffers(); -} - -} // End of namespace Lab diff --git a/engines/lab/engine.cpp b/engines/lab/engine.cpp index f8391d3f0d..b4b64093ab 100644 --- a/engines/lab/engine.cpp +++ b/engines/lab/engine.cpp @@ -47,7 +47,7 @@ bool LongWinInFront = false; TextFont *MsgFont; -extern bool DoBlack, waitForEffect, EffectPlaying, stopsound, DoNotDrawMessage, IsHiRes, nopalchange, DoMusic; +extern bool DoBlack, waitForEffect, stopsound, DoNotDrawMessage, IsHiRes, nopalchange; /* Global parser data */ @@ -698,7 +698,6 @@ static void decIncInv(uint16 *CurInv, bool dec) { static bool nosvgamem = false; static bool didintro = false; -static bool novesa = false, noaudio = false; /******************************************************************************/ /* Processes user input events. */ @@ -750,7 +749,7 @@ static void process() { break; } - g_music->restartBackMusic(); + g_music->resumeBackMusic(); /* Sees what kind of close up we're in and does the appropriate stuff, if any. */ if (doCloseUp(CPtr)) { @@ -1382,8 +1381,6 @@ void LabEngine::go() { bool mem, dointro = false; uint16 counter; - DoMusic = true; - g_music->_turnMusicOn = true; dointro = true; IsHiRes = ((getFeatures() & GF_LOWRES) == 0); @@ -1394,23 +1391,6 @@ void LabEngine::go() { else warning("Running in LowRes mode"); #endif - -#if 0 - for (counter = 1; counter < argc; counter++) { - if (((argv[counter])[0] == 'q') || ((argv[counter])[0] == 'Q')) { - DoMusic = false; - g_music->_turnMusicOn = false; - } - - else if (((argv[counter])[0] == '/') && ((argv[counter])[1] == '?')) { - debug("\n\nPlayer Version 1.0. Copyright (c) 1993 Terra Nova Development\n"); - debug("Player v q\n"); - debug(" q : Start in quiet mode; no sound output.\n\n"); - return; - } - } -#endif - if (initBuffer(BUFFERSIZE, true)) { mem = true; } else { @@ -1418,17 +1398,8 @@ void LabEngine::go() { return; } - if (!initAudio()) { - noaudio = true; - DoMusic = false; - g_music->_turnMusicOn = false; - debug("Could not open Audio."); - g_system->delayMillis(500); - } - if (!setUpScreens()) { IsHiRes = false; - novesa = true; mem = mem && setUpScreens(); } @@ -1484,7 +1455,6 @@ void LabEngine::go() { freeBuffer(); g_music->freeMusic(); - freeAudio(); } /*****************************************************************************/ diff --git a/engines/lab/graphics.cpp b/engines/lab/graphics.cpp index 4ef132a492..5fb12370a3 100644 --- a/engines/lab/graphics.cpp +++ b/engines/lab/graphics.cpp @@ -45,11 +45,11 @@ BitMap bit1, bit2, *DispBitMap = &bit1, *DrawBitMap = &bit1; extern BitMap RawDiffBM; extern char diffcmap[256 * 3], lastcmap[256 * 3]; -extern bool IsBM, NoFlip, nopalchange, ContMusic; +extern bool IsBM, NoFlip, nopalchange; extern int32 ReadSoFar; extern bool ReadIsDone, ReadIsError; -extern bool DoBlack, EffectPlaying, stopsound; +extern bool DoBlack, stopsound; extern bool IsHiRes; extern TextFont *MsgFont; extern const char *CurFileName; @@ -622,7 +622,7 @@ static void doScrollWipe(char *filename) { width = VGAScaleX(320); height = VGAScaleY(149) + SVGACord(2); - while (EffectPlaying) { + while (g_music->isSoundEffectActive()) { g_music->newCheckMusic(); waitTOF(); } diff --git a/engines/lab/labfun.h b/engines/lab/labfun.h index d976feea38..60b313e190 100644 --- a/engines/lab/labfun.h +++ b/engines/lab/labfun.h @@ -33,6 +33,12 @@ #include "lab/stddefines.h" #include "lab/parsetypes.h" + +// For the Music class - TODO: Move to another header file +#include "audio/mixer.h" +#include "audio/audiostream.h" +#include "audio/decoders/raw.h" + #include "common/file.h" #include "common/savefile.h" @@ -57,22 +63,6 @@ struct SaveGameHeader { uint16 direction; }; -/*----------------------------*/ -/*------ From Audioi.c -------*/ -/*----------------------------*/ - -bool initAudio(); -void freeAudio(); -bool musicBufferEmpty(); -void playMusicBlock(void *Ptr, uint32 Size, uint16 BufferNum, uint16 SampleSpeed); -uint16 getPlayingBufferCount(); -void updateSoundBuffers(); -void flushAudio(); -void playSoundEffect(uint16 SampleSpeed, uint16 Volume, uint32 Length, bool flush, void *Data); - - - - /*----------------------------*/ /*----- From graphics.c ------*/ /*----------------------------*/ @@ -228,18 +218,23 @@ public: void freeMusic(); void fillUpMusic(bool doit); void updateMusic(); + uint16 getPlayingBufferCount(); void checkMusic(); void newCheckMusic(); void closeMusic(); void setMusic(bool on); - void restartBackMusic(); + void resumeBackMusic(); void pauseBackMusic(); void changeMusic(const char *newmusic); void resetMusic(); + + void playSoundEffect(uint16 SampleSpeed, uint32 Length, void *Data); + void stopSoundEffect(); + bool isSoundEffectActive() const; - bool _winmusic, _doNotFileFlushAudio; - bool _turnMusicOn; + bool _winmusic, _doNotFilestopSoundEffect; bool _musicOn; + bool _loopSoundEffect; private: void fillbuffer(byte *musicBuffer); @@ -252,6 +247,11 @@ private: bool _tMusicOn; uint32 _tLeftInFile; uint32 _leftinfile; + + Audio::SoundHandle _musicHandle; + Audio::SoundHandle _sfxHandle; + + Audio::QueuingAudioStream *_queuingAudioStream; }; diff --git a/engines/lab/labmusic.cpp b/engines/lab/labmusic.cpp index 1f5794b995..9bc0ee0dee 100644 --- a/engines/lab/labmusic.cpp +++ b/engines/lab/labmusic.cpp @@ -28,6 +28,8 @@ * */ +#include "audio/mixer.h" + #include "lab/stddefines.h" #include "lab/labfun.h" #include "lab/timing.h" @@ -41,7 +43,6 @@ namespace Lab { #define SAMPLESPEED 15000L -extern bool EffectPlaying; Music *g_music; Music::Music() { @@ -55,9 +56,10 @@ Music::Music() { _leftinfile = 0; _musicOn = false; - _turnMusicOn = false; _winmusic = false; - _doNotFileFlushAudio = false; + _loopSoundEffect = false; + _queuingAudioStream = NULL; + _doNotFilestopSoundEffect = false; } /*****************************************************************************/ @@ -69,18 +71,63 @@ void Music::updateMusic() { updateMouse(); - if (EffectPlaying) - updateSoundBuffers(); - if (_musicOn && getPlayingBufferCount() < MAXBUFFERS) { // NOTE: We need to use malloc(), cause this will be freed with free() // by the music code byte *musicBuffer = (byte *)malloc(MUSICBUFSIZE); fillbuffer(musicBuffer); - playMusicBlock(musicBuffer, MUSICBUFSIZE, 0, SAMPLESPEED); + + // Queue a music block, and start the music, if needed + bool startMusic = false; + + if (!_queuingAudioStream) { + _queuingAudioStream = Audio::makeQueuingAudioStream(SAMPLESPEED, false); + startMusic = true; + } + + byte soundFlags = Audio::FLAG_LITTLE_ENDIAN; + if (g_lab->getPlatform() == Common::kPlatformWindows) + soundFlags |= Audio::FLAG_16BITS; + else + soundFlags |= Audio::FLAG_UNSIGNED; + + _queuingAudioStream->queueBuffer(musicBuffer, MUSICBUFSIZE, DisposeAfterUse::YES, soundFlags); + + if (startMusic) + g_lab->_mixer->playStream(Audio::Mixer::kMusicSoundType, &_musicHandle, _queuingAudioStream); } } +uint16 Music::getPlayingBufferCount() { + return (_queuingAudioStream) ? _queuingAudioStream->numQueuedStreams() : 0; +} + +void Music::playSoundEffect(uint16 SampleSpeed, uint32 Length, void *Data) { + pauseBackMusic(); + stopSoundEffect(); + + if (SampleSpeed < 4000) + SampleSpeed = 4000; + + byte soundFlags = Audio::FLAG_LITTLE_ENDIAN; + if (g_lab->getPlatform() == Common::kPlatformWindows) + soundFlags |= Audio::FLAG_16BITS; + else + soundFlags |= Audio::FLAG_UNSIGNED; + + Audio::SeekableAudioStream *audioStream = Audio::makeRawStream((const byte *)Data, Length, SampleSpeed, soundFlags, DisposeAfterUse::NO); + uint loops = (_loopSoundEffect) ? 0 : 1; + Audio::LoopingAudioStream *loopingAudioStream = new Audio::LoopingAudioStream(audioStream, loops, DisposeAfterUse::YES); + g_lab->_mixer->playStream(Audio::Mixer::kSFXSoundType, &_sfxHandle, loopingAudioStream); +} + +void Music::stopSoundEffect() { + g_lab->_mixer->stopHandle(_sfxHandle); +} + +bool Music::isSoundEffectActive() const { + return g_lab->_mixer->isSoundHandleActive(_sfxHandle); +} void Music::fillbuffer(byte *musicBuffer) { if (MUSICBUFSIZE < _leftinfile) { @@ -114,7 +161,7 @@ void Music::startMusic(bool startatbegin) { if (!_musicOn) return; - flushAudio(); + stopSoundEffect(); if (startatbegin) { _file->seek(0); @@ -130,10 +177,6 @@ void Music::startMusic(bool startatbegin) { /* Initializes the music buffers. */ /*****************************************************************************/ bool Music::initMusic() { - - if (!_turnMusicOn) - return true; - _musicOn = true; _musicPaused = false; @@ -167,6 +210,12 @@ void Music::freeMusic() { _file->close(); _file = 0; + + g_lab->_mixer->stopHandle(_musicHandle); + g_lab->_mixer->stopHandle(_sfxHandle); + + delete _queuingAudioStream; + _queuingAudioStream = NULL; } @@ -177,9 +226,9 @@ void Music::pauseBackMusic() { if (!_musicPaused && _musicOn) { updateMusic(); _musicOn = false; - flushAudio(); + stopSoundEffect(); - // TODO: Pause + g_lab->_mixer->pauseHandle(_musicHandle, true); _musicPaused = true; } @@ -188,21 +237,21 @@ void Music::pauseBackMusic() { /*****************************************************************************/ -/* Restarts the paused background music. */ +/* Resumes the paused background music. */ /*****************************************************************************/ -void Music::restartBackMusic() { +void Music::resumeBackMusic() { if (_musicPaused) { - flushAudio(); + stopSoundEffect(); _musicOn = true; + + g_lab->_mixer->pauseHandle(_musicHandle, false); + updateMusic(); _musicPaused = false; } } - - - /*****************************************************************************/ /* Checks to see if need to fill buffers fill of music. */ /*****************************************************************************/ @@ -232,7 +281,7 @@ void Music::newCheckMusic() { /* Turns the music on and off. */ /*****************************************************************************/ void Music::setMusic(bool on) { - flushAudio(); + stopSoundEffect(); if (on && !_musicOn) { _musicOn = true; @@ -251,15 +300,10 @@ void Music::changeMusic(const char *newmusic) { if (!_tFile) { _tFile = _file; _tMusicOn = _musicOn; -#if defined(DOSCODE) - _tLeftInFile = _leftinfile; -#else _tLeftInFile = _leftinfile + 65536L; if (_tLeftInFile > (uint32)_tFile->size()) _tLeftInFile = _leftinfile; - -#endif } _file = openPartial(newmusic); @@ -336,8 +380,8 @@ byte **Music::newOpen(const char *name) { fillUpMusic(true); } - if (!_doNotFileFlushAudio && EffectPlaying) - flushAudio(); + if (!_doNotFilestopSoundEffect && isSoundEffectActive()) + stopSoundEffect(); file = openFile(name); checkMusic(); diff --git a/engines/lab/module.mk b/engines/lab/module.mk index 8057fad951..7389c18a1d 100644 --- a/engines/lab/module.mk +++ b/engines/lab/module.mk @@ -2,7 +2,6 @@ MODULE := engines/lab MODULE_OBJS := \ allocroom.o \ - audioi.o \ detection.o \ engine.o \ graphics.o \ diff --git a/engines/lab/processroom.cpp b/engines/lab/processroom.cpp index 9c5055f01e..54d7605d15 100644 --- a/engines/lab/processroom.cpp +++ b/engines/lab/processroom.cpp @@ -62,7 +62,7 @@ const char *ViewPath = "LAB:Rooms/"; const char *NewFileName; extern bool DoNotDrawMessage; -extern bool NoFlip, IsBM, noupdatediff, waitForEffect, mwaitForEffect, QuitLab, EffectPlaying, soundplaying, MusicOn, DoBlack, ContMusic, DoNotReset; +extern bool NoFlip, IsBM, noupdatediff, waitForEffect, mwaitForEffect, QuitLab, soundplaying, MusicOn, DoBlack, DoNotReset; extern char diffcmap[256 * 3]; extern CloseDataPtr CPtr; @@ -407,20 +407,20 @@ static void doActions(ActionPtr APtr, CloseDataPtr *LCPtr) { switch (APtr->ActionType) { case PLAYSOUND: mwaitForEffect = true; /* Plays a sound, but waits for it to be done before continuing */ - ContMusic = false; + g_music->_loopSoundEffect = false; readMusic((char *)APtr->Data); mwaitForEffect = false; break; case PLAYSOUNDB: mwaitForEffect = false; /* Plays a sound in the background. */ - ContMusic = false; + g_music->_loopSoundEffect = false; readMusic((char *)APtr->Data); break; case PLAYSOUNDCONT: - g_music->_doNotFileFlushAudio = true; - ContMusic = true; + g_music->_doNotFilestopSoundEffect = true; + g_music->_loopSoundEffect = true; readMusic((char *)APtr->Data); break; @@ -605,19 +605,13 @@ static void doActions(ActionPtr APtr, CloseDataPtr *LCPtr) { break; case CHANGEMUSIC: - if (g_music->_turnMusicOn) { - g_music->changeMusic((const char *)APtr->Data); - DoNotReset = true; - } - + g_music->changeMusic((const char *)APtr->Data); + DoNotReset = true; break; case RESETMUSIC: - if (g_music->_turnMusicOn) { - g_music->resetMusic(); - DoNotReset = false; - } - + g_music->resetMusic(); + DoNotReset = false; break; case FILLMUSIC: @@ -625,7 +619,7 @@ static void doActions(ActionPtr APtr, CloseDataPtr *LCPtr) { break; case WAITSOUND: - while (EffectPlaying) { + while (g_music->isSoundEffectActive()) { g_music->updateMusic(); diffNextFrame(); waitTOF(); @@ -634,21 +628,18 @@ static void doActions(ActionPtr APtr, CloseDataPtr *LCPtr) { break; case CLEARSOUND: - if (ContMusic) { - ContMusic = false; - flushAudio(); - } else if (EffectPlaying) - flushAudio(); + if (g_music->_loopSoundEffect) { + g_music->_loopSoundEffect = false; + g_music->stopSoundEffect(); + } else if (g_music->isSoundEffectActive()) + g_music->stopSoundEffect(); break; case WINMUSIC: - if (g_music->_turnMusicOn) { - g_music->_winmusic = true; - g_music->freeMusic(); - g_music->initMusic(); - } - + g_music->_winmusic = true; + g_music->freeMusic(); + g_music->initMusic(); break; case WINGAME: @@ -699,18 +690,18 @@ static void doActions(ActionPtr APtr, CloseDataPtr *LCPtr) { APtr = APtr->NextAction; } - if (ContMusic) { - ContMusic = false; - flushAudio(); + if (g_music->_loopSoundEffect) { + g_music->_loopSoundEffect = false; + g_music->stopSoundEffect(); } else { - while (EffectPlaying) { + while (g_music->isSoundEffectActive()) { g_music->updateMusic(); diffNextFrame(); waitTOF(); } } - g_music->_doNotFileFlushAudio = false; + g_music->_doNotFilestopSoundEffect = false; } /*****************************************************************************/ diff --git a/engines/lab/readdiff.cpp b/engines/lab/readdiff.cpp index 3f7cdc7409..d5e29fabf1 100644 --- a/engines/lab/readdiff.cpp +++ b/engines/lab/readdiff.cpp @@ -64,9 +64,6 @@ bool NoFlip = false, /* Don't flip the new picture to front */ uint16 DataBytesPerRow; -extern bool EffectPlaying; - - #define CONTINUOUS 0xFFFF DIFFHeader headerdata; @@ -274,7 +271,7 @@ void diffNextFrame() { case 30L: case 31L: { if (waitForEffect) { - while (EffectPlaying) { + while (g_music->isSoundEffectActive()) { g_music->updateMusic(); waitTOF(); } @@ -291,7 +288,7 @@ void diffNextFrame() { uint32 musicsize = size; skip(difffile, size); - playSoundEffect(samplespeed, 64, musicsize, true, music); + g_music->playSoundEffect(samplespeed, musicsize, music); break; } case 65535L: @@ -299,7 +296,7 @@ void diffNextFrame() { int didTOF = 0; if (waitForEffect) { - while (EffectPlaying) { + while (g_music->isSoundEffectActive()) { g_music->updateMusic(); waitTOF(); @@ -545,7 +542,7 @@ void readSound() { if ((header_ == 30) || (header_ == 31)) { if (mwaitForEffect) { - while (EffectPlaying) { + while (g_music->isSoundEffectActive()) { g_music->updateMusic(); waitTOF(); } @@ -563,10 +560,10 @@ void readSound() { uint32 musicsize = size_; skip(difffile_, size_); - playSoundEffect(samplespeed_, 64, musicsize, true, music); + g_music->playSoundEffect(samplespeed_, musicsize, music); } else if (header_ == 65535L) { if (mwaitForEffect) { - while (EffectPlaying) { + while (g_music->isSoundEffectActive()) { g_music->updateMusic(); waitTOF(); } -- cgit v1.2.3 From 16df4305f4334845b52b0bbc999e4d6d04cdbbbb Mon Sep 17 00:00:00 2001 From: Filippos Karapetis Date: Wed, 25 Feb 2015 00:37:07 +0200 Subject: LAB: Allow skipping the credits in the intro sequence Also, remove some unused variables and perform some minor renaming --- engines/lab/engine.cpp | 13 +++++------- engines/lab/intro.cpp | 53 +++++++++++++++++++++++++++--------------------- engines/lab/readdiff.cpp | 1 - 3 files changed, 35 insertions(+), 32 deletions(-) diff --git a/engines/lab/engine.cpp b/engines/lab/engine.cpp index b4b64093ab..2916186541 100644 --- a/engines/lab/engine.cpp +++ b/engines/lab/engine.cpp @@ -696,13 +696,10 @@ static void decIncInv(uint16 *CurInv, bool dec) { } -static bool nosvgamem = false; -static bool didintro = false; - /******************************************************************************/ -/* Processes user input events. */ +/* The main game loop */ /******************************************************************************/ -static void process() { +static void mainGameLoop() { IntuiMessage *Msg; uint32 Class; @@ -1415,16 +1412,16 @@ void LabEngine::go() { openFont("P:AvanteG.12", &MsgFont); + mouseHide(); + if (dointro && mem) { - didintro = true; introSequence(); - didintro = true; } else DoBlack = true; if (mem) { mouseShow(); - process(); + mainGameLoop(); } else debug("\n\nNot enough memory to start game.\n\n"); diff --git a/engines/lab/intro.cpp b/engines/lab/intro.cpp index 8d508aebba..e37b347d68 100644 --- a/engines/lab/intro.cpp +++ b/engines/lab/intro.cpp @@ -40,7 +40,7 @@ namespace Lab { static TextFont filler, *msgfont = &filler; -extern bool nopalchange, noscreenchange, hidemouse, DoBlack, NoFlip, IsHiRes; +extern bool nopalchange, hidemouse, DoBlack, NoFlip, IsHiRes; extern char diffcmap[256 * 3]; @@ -248,18 +248,19 @@ void musicDelay() { static void NReadPict(const char *Filename, bool PlayOnce) { - char filename[20] = "P:Intro/"; + Common::String finalFileName = "P:Intro/"; g_music->newCheckMusic(); + introEatMessages(); if (QuitIntro) return; - strcat(filename, Filename); + finalFileName += Filename; DoBlack = IntroDoBlack; stopDiffEnd(); - readPict(filename, PlayOnce); + readPict(finalFileName.c_str(), PlayOnce); } @@ -274,13 +275,17 @@ void introSequence() { DoBlack = true; if (g_lab->getPlatform() != Common::kPlatformWindows) { - readPict("p:Intro/EA0", true); - readPict("p:Intro/EA1", true); - readPict("p:Intro/EA2", true); - readPict("p:Intro/EA3", true); + NReadPict("EA0", true); + NReadPict("EA1", true); + NReadPict("EA2", true); + NReadPict("EA3", true); } else { - readPict("p:Intro/WYRMKEEP", true); - microDelay(4, 0); + NReadPict("WYRMKEEP", true); + for (counter = 0; counter < 4; counter++) { + if (QuitIntro) + break; + microDelay(1, 0); + } } blackAllScreen(); @@ -288,14 +293,15 @@ void introSequence() { g_music->initMusic(); nopalchange = true; - noscreenchange = true; - readPict("p:Intro/TNDcycle2.pic", true); + NReadPict("TNDcycle2.pic", true); nopalchange = false; - noscreenchange = false; FadePalette = Palette; for (counter = 0; counter < 16; counter++) { + if (QuitIntro) + break; + Palette[counter] = ((diffcmap[counter * 3] >> 2) << 8) + ((diffcmap[counter * 3 + 1] >> 2) << 4) + (diffcmap[counter * 3 + 2] >> 2); @@ -305,6 +311,9 @@ void introSequence() { fade(true, 0); for (int times = 0; times < 150; times++) { + if (QuitIntro) + break; + g_music->newCheckMusic(); uint16 temp = Palette[2]; @@ -322,24 +331,24 @@ void introSequence() { g_music->newCheckMusic(); - readPict("p:Intro/Title.A", true); - readPict("p:Intro/AB", true); + NReadPict("Title.A", true); + NReadPict("AB", true); musicDelay(); - readPict("p:Intro/BA", true); - readPict("p:Intro/AC", true); + NReadPict("BA", true); + NReadPict("AC", true); musicDelay(); if (g_lab->getPlatform() == Common::kPlatformWindows) musicDelay(); // more credits on this page now - readPict("p:Intro/CA", true); - readPict("p:Intro/AD", true); + NReadPict("CA", true); + NReadPict("AD", true); musicDelay(); if (g_lab->getPlatform() == Common::kPlatformWindows) musicDelay(); // more credits on this page now - readPict("p:Intro/DA", true); + NReadPict("DA", true); musicDelay(); g_music->newOpen("p:Intro/Intro.1"); /* load the picture into the buffer */ @@ -351,9 +360,7 @@ void introSequence() { getFont("P:Map.font", msgfont); nopalchange = true; - noscreenchange = true; - readPict("p:Intro/Intro.1", true); - noscreenchange = false; + NReadPict("Intro.1", true); nopalchange = false; for (counter = 0; counter < 16; counter++) { diff --git a/engines/lab/readdiff.cpp b/engines/lab/readdiff.cpp index d5e29fabf1..fa1a009780 100644 --- a/engines/lab/readdiff.cpp +++ b/engines/lab/readdiff.cpp @@ -52,7 +52,6 @@ static bool PlayOnce = false, changedscreen; bool NoFlip = false, /* Don't flip the new picture to front */ DoBlack = false, /* Black the screen before new picture */ nopalchange = false, /* Don't change the palette. */ - noscreenchange = false, /* Don't change the screen type. */ IsBM = false, /* Just fill in the RawDIFFBM structure */ hidemouse = false, /* Don't set the mouse colors */ stopsound = false, -- cgit v1.2.3 From 219811feaa9fcf23266d97423d013244280cf9f3 Mon Sep 17 00:00:00 2001 From: Filippos Karapetis Date: Wed, 25 Feb 2015 03:13:26 +0200 Subject: LAB: Add support for the Wyrmkeep Windows trial version Only the trial part of this version can be played in ScummVM, since we can't check for game payment status --- engines/lab/detection.cpp | 2 +- engines/lab/lab.cpp | 38 +++++++++++++++++++++++++++++++++++++- engines/lab/lab.h | 6 +++++- engines/lab/processroom.cpp | 36 ++++++++++-------------------------- engines/lab/special.cpp | 13 ++++--------- 5 files changed, 57 insertions(+), 38 deletions(-) diff --git a/engines/lab/detection.cpp b/engines/lab/detection.cpp index 2b1bb21205..1da269ecad 100644 --- a/engines/lab/detection.cpp +++ b/engines/lab/detection.cpp @@ -120,7 +120,7 @@ Common::Platform LabEngine::getPlatform() const { } uint32 LabEngine::getFeatures() const { - return _gameDescription->flags; + return _gameDescription->flags | _extraGameFeatures; } } // End of namespace Lab diff --git a/engines/lab/lab.cpp b/engines/lab/lab.cpp index 563ccefa84..f1d0fe96c4 100644 --- a/engines/lab/lab.cpp +++ b/engines/lab/lab.cpp @@ -36,6 +36,8 @@ #include "engines/util.h" +#include "gui/message.h" + #include "lab/lab.h" #include "lab/labfun.h" @@ -46,7 +48,7 @@ namespace Lab { LabEngine *g_lab; LabEngine::LabEngine(OSystem *syst, const ADGameDescription *gameDesc) - : Engine(syst), _gameDescription(gameDesc) { + : Engine(syst), _gameDescription(gameDesc), _extraGameFeatures(0) { g_lab = this; } @@ -63,6 +65,40 @@ Common::Error LabEngine::run() { g_music = new Music(); + if (getPlatform() == Common::kPlatformWindows) { + // Check if this is the Wyrmkeep trial + Common::File roomFile; + bool knownVersion = true; + bool roomFileOpened = roomFile.open("game/rooms/48"); + + if (!roomFileOpened) + knownVersion = false; + else if (roomFile.size() != 892) + knownVersion = false; + else { + roomFile.seek(352); + byte checkByte = roomFile.readByte(); + if (checkByte == 0x00) { + // Full Windows version + } else if (checkByte == 0x80) { + // Wyrmkeep trial version + _extraGameFeatures = GF_WINDOWS_TRIAL; + + GUI::MessageDialog trialMessage("This is a trial Windows version of the game. To play the full version, you will need to use the original interpreter and purchase a key from Wyrmkeep"); + trialMessage.runModal(); + } else { + knownVersion = false; + } + + roomFile.close(); + + if (!knownVersion) { + warning("Unknown Windows version found, please report this version to the ScummVM team"); + return Common::kNoGameDataFoundError; + } + } + } + go(); return Common::kNoError; diff --git a/engines/lab/lab.h b/engines/lab/lab.h index fa5edd6c24..b16b5981b3 100644 --- a/engines/lab/lab.h +++ b/engines/lab/lab.h @@ -41,7 +41,8 @@ struct ADGameDescription; namespace Lab { enum GameFeatures { - GF_LOWRES = 1 << 0 + GF_LOWRES = 1 << 0, + GF_WINDOWS_TRIAL = 1 << 1 }; class LabEngine : public Engine { @@ -60,6 +61,9 @@ public: Common::String generateSaveFileName(uint slot); LargeSet *_conditions, *_roomsFound; + +private: + uint32 _extraGameFeatures; }; extern LabEngine *g_lab; diff --git a/engines/lab/processroom.cpp b/engines/lab/processroom.cpp index 54d7605d15..27d480bf69 100644 --- a/engines/lab/processroom.cpp +++ b/engines/lab/processroom.cpp @@ -28,6 +28,8 @@ * */ +#include "gui/message.h" + #include "lab/lab.h" #include "lab/stddefines.h" #include "lab/labfun.h" @@ -40,10 +42,6 @@ namespace Lab { -#ifdef GAME_TRIAL -extern int g_IsRegistered; -#endif - /* Global parser data */ RoomData *Rooms; @@ -519,30 +517,16 @@ static void doActions(ActionPtr APtr, CloseDataPtr *LCPtr) { } #endif -#if defined(GAME_TRIAL) - - if (APtr->Param1 & 0x8000) { // check registration if high-bit set - if (!g_IsRegistered) { - extern int trialCheckInGame(); - int result; - - // Time to pay up! - result = trialCheckInGame(); - - CurFileName = getPictName(LCPtr); - readPict(CurFileName, true); - - if (!g_IsRegistered) { - APtr = NULL; - continue; - } - } - - // fix-up data - APtr->Param1 &= 0x7fff; // clear high-bit + if (APtr->Param1 & 0x8000) { + // This is a Wyrmkeep Windows trial version, thus stop at this + // point, since we can't check for game payment status + readPict(getPictName(LCPtr), true); + APtr = NULL; + GUI::MessageDialog trialMessage("This is the end of the trial version. You can play the full game using the original interpreter from Wyrmkeep"); + trialMessage.runModal(); + continue; } -#endif RoomNum = APtr->Param1; Direction = APtr->Param2 - 1; *LCPtr = NULL; diff --git a/engines/lab/special.cpp b/engines/lab/special.cpp index 7d2212138b..74625a63f4 100644 --- a/engines/lab/special.cpp +++ b/engines/lab/special.cpp @@ -47,10 +47,6 @@ namespace Lab { -#ifdef GAME_TRIAL -int g_IsRegistered; -#endif - extern bool nopalchange, DoBlack, IsHiRes; extern BitMap *DispBitMap, *DrawBitMap; @@ -450,12 +446,11 @@ static void changeTile(uint16 col, uint16 row) { return; #endif -#if defined(GAME_TRIAL) - - if (!g_IsRegistered) + if (g_lab->getFeatures() & GF_WINDOWS_TRIAL) { + GUI::MessageDialog trialMessage("This puzzle is not available in the trial version of the game"); + trialMessage.runModal(); return; - -#endif + } check = true; row = 0; -- cgit v1.2.3 From 4cf271054ab215d78f746c0596f86ef7c72f81c0 Mon Sep 17 00:00:00 2001 From: Filippos Karapetis Date: Thu, 26 Feb 2015 01:14:47 +0200 Subject: LAB: Bugfix for freeMusic() --- engines/lab/labmusic.cpp | 31 +++++-------------------------- 1 file changed, 5 insertions(+), 26 deletions(-) diff --git a/engines/lab/labmusic.cpp b/engines/lab/labmusic.cpp index 9bc0ee0dee..5222cd9af6 100644 --- a/engines/lab/labmusic.cpp +++ b/engines/lab/labmusic.cpp @@ -117,7 +117,7 @@ void Music::playSoundEffect(uint16 SampleSpeed, uint32 Length, void *Data) { Audio::SeekableAudioStream *audioStream = Audio::makeRawStream((const byte *)Data, Length, SampleSpeed, soundFlags, DisposeAfterUse::NO); uint loops = (_loopSoundEffect) ? 0 : 1; - Audio::LoopingAudioStream *loopingAudioStream = new Audio::LoopingAudioStream(audioStream, loops, DisposeAfterUse::YES); + Audio::LoopingAudioStream *loopingAudioStream = new Audio::LoopingAudioStream(audioStream, loops); g_lab->_mixer->playStream(Audio::Mixer::kSFXSoundType, &_sfxHandle, loopingAudioStream); } @@ -143,7 +143,6 @@ void Music::fillbuffer(byte *musicBuffer) { } } - /*****************************************************************************/ /* Fills up the buffers that have already been played if necessary; if doit */ /* is set to TRUE then it will fill up all empty buffers. Otherwise, it */ @@ -153,7 +152,6 @@ void Music::fillUpMusic(bool doit) { updateMusic(); } - /*****************************************************************************/ /* Starts up the music initially. */ /*****************************************************************************/ @@ -172,7 +170,6 @@ void Music::startMusic(bool startatbegin) { updateMusic(); } - /*****************************************************************************/ /* Initializes the music buffers. */ /*****************************************************************************/ @@ -198,27 +195,21 @@ bool Music::initMusic() { return false; } - - /*****************************************************************************/ /* Frees up the music buffers and closes the file. */ /*****************************************************************************/ void Music::freeMusic() { _musicOn = false; - if (_file->isOpen()) - _file->close(); - - _file = 0; - g_lab->_mixer->stopHandle(_musicHandle); + _queuingAudioStream = NULL; + g_lab->_mixer->stopHandle(_sfxHandle); - delete _queuingAudioStream; - _queuingAudioStream = NULL; + delete _file; + _file = NULL; } - /*****************************************************************************/ /* Pauses the background music. */ /*****************************************************************************/ @@ -234,8 +225,6 @@ void Music::pauseBackMusic() { } } - - /*****************************************************************************/ /* Resumes the paused background music. */ /*****************************************************************************/ @@ -251,7 +240,6 @@ void Music::resumeBackMusic() { } } - /*****************************************************************************/ /* Checks to see if need to fill buffers fill of music. */ /*****************************************************************************/ @@ -264,8 +252,6 @@ void Music::checkMusic() { fillUpMusic(false); } - - /*****************************************************************************/ /* Checks to see if need to fill buffers fill of music. */ /*****************************************************************************/ @@ -273,10 +259,6 @@ void Music::newCheckMusic() { checkMusic(); } - - - - /*****************************************************************************/ /* Turns the music on and off. */ /*****************************************************************************/ @@ -319,8 +301,6 @@ void Music::changeMusic(const char *newmusic) { } } - - /*****************************************************************************/ /* Changes the background music to the original piece playing. */ /*****************************************************************************/ @@ -351,7 +331,6 @@ void Music::resetMusic() { _tFile = 0; } - /*****************************************************************************/ /* Checks whether or note enough memory in music buffer before loading any */ /* files. Fills it if not. Does not take into account the current buffer */ -- cgit v1.2.3 From cc0baf48ed9a545a04d4d8f84213bdda3223ccc4 Mon Sep 17 00:00:00 2001 From: Filippos Karapetis Date: Thu, 26 Feb 2015 01:15:54 +0200 Subject: LAB: Check for engine quit events --- engines/lab/engine.cpp | 2 +- engines/lab/intro.cpp | 8 +++++++- 2 files changed, 8 insertions(+), 2 deletions(-) diff --git a/engines/lab/engine.cpp b/engines/lab/engine.cpp index 2916186541..69ebae6548 100644 --- a/engines/lab/engine.cpp +++ b/engines/lab/engine.cpp @@ -741,7 +741,7 @@ static void mainGameLoop() { WSDL_ProcessInput(1); if (GotMessage) { - if (QuitLab) { + if (QuitLab || g_engine->shouldQuit()) { stopDiff(); break; } diff --git a/engines/lab/intro.cpp b/engines/lab/intro.cpp index e37b347d68..7f0b53f98d 100644 --- a/engines/lab/intro.cpp +++ b/engines/lab/intro.cpp @@ -69,11 +69,17 @@ void introEatMessages() { while (1) { Msg = getMsg(); + if (g_engine->shouldQuit()) { + QuitIntro = true; + return; + } + if (Msg == NULL) return; else { if (((Msg->Class == MOUSEBUTTONS) && (IEQUALIFIER_RBUTTON & Msg->Qualifier)) || - ((Msg->Class == RAWKEY) && (Msg->Code == 27))) + ((Msg->Class == RAWKEY) && (Msg->Code == 27)) + ) QuitIntro = true; replyMsg(Msg); -- cgit v1.2.3 From 650819cfecf1877e07202fa0ec898dbb5609855b Mon Sep 17 00:00:00 2001 From: Filippos Karapetis Date: Fri, 17 Jul 2015 10:15:20 +0300 Subject: LAB: Simplify allocRoom() --- engines/lab/allocroom.cpp | 9 ++------- 1 file changed, 2 insertions(+), 7 deletions(-) diff --git a/engines/lab/allocroom.cpp b/engines/lab/allocroom.cpp index 3a5c7b9cf0..e6dad3bc23 100644 --- a/engines/lab/allocroom.cpp +++ b/engines/lab/allocroom.cpp @@ -168,26 +168,21 @@ static void *getCurMem(uint16 Size) { return Ptr; } - - - - /*****************************************************************************/ /* Grabs a chunk of memory from the room buffer, and manages it for a */ /* particular room. */ /*****************************************************************************/ void allocRoom(void **Ptr, uint16 size, uint16 roomNum) { uint16 rMarker; - bool doit = true; if (1 & size) /* Memory is required to be even aligned */ size++; rMarker = 0; - while ((rMarker < MAXMARKERS) && doit) { + while ((rMarker < MAXMARKERS)) { if (RoomMarkers[rMarker].RoomNum == roomNum) - doit = false; + break; else rMarker++; } -- cgit v1.2.3 From 8ebb53948d006f816510a311ae95dc963171d77c Mon Sep 17 00:00:00 2001 From: Filippos Karapetis Date: Fri, 17 Jul 2015 10:16:47 +0300 Subject: LAB: Remove superfluous white space --- engines/lab/diff.h | 10 ---------- engines/lab/interface.h | 6 ------ engines/lab/text.h | 5 ----- engines/lab/vga.h | 27 --------------------------- 4 files changed, 48 deletions(-) diff --git a/engines/lab/diff.h b/engines/lab/diff.h index 6889bcc258..4c906f7597 100644 --- a/engines/lab/diff.h +++ b/engines/lab/diff.h @@ -64,29 +64,19 @@ bool unDIFFMemory(byte *Dest, /* Where to Un-DIFF */ (1, 2 or 4 bytes) */ bool VUnDIFFMemory(byte *Dest, byte *diff, uint16 HeaderSize, uint16 CopySize, uint16 bytesperrow); - void runLengthDecode(byte *Dest, byte *Source); - void VRunLengthDecode(byte *Dest, byte *Source, uint16 bytesperrow); /* readDiff.c */ void blackScreen(); - void blackAllScreen(); - void whiteScreen(); - bool readDiff(bool playonce); - void diffNextFrame(); - void readSound(); - void stopDiff(); - void stopDiffEnd(); - void stopSound(); } // End of namespace Lab diff --git a/engines/lab/interface.h b/engines/lab/interface.h index 1c0439b5ff..170006f64a 100644 --- a/engines/lab/interface.h +++ b/engines/lab/interface.h @@ -115,17 +115,11 @@ extern Common::KeyState _keyPressed; Gadget *createButton(uint16 x, uint16 y, uint16 id, uint16 key, Image *im, Image *imalt); - void freeButtonList(void *gptrlist); - void drawGadgetList(Gadget *gadlist); - void ghoastGadget(Gadget *curgad, uint16 pencolor); - void unGhoastGadget(Gadget *curgad); - IntuiMessage *getMsg(); - void replyMsg(void *Msg); } // End of namespace Lab diff --git a/engines/lab/text.h b/engines/lab/text.h index 254a137f0d..944b363357 100644 --- a/engines/lab/text.h +++ b/engines/lab/text.h @@ -53,15 +53,10 @@ struct TextFont { #endif bool openFontMem(const char *TextFontPath, TextFont *tf, byte *fontbuffer); - bool openFont(const char *TextFontPath, TextFont **tf); - void closeFont(TextFont *tf); - uint16 textLength(TextFont *tf, const char *text, uint16 numchars); - uint16 textHeight(TextFont *tf); - void text(TextFont *tf, uint16 x, uint16 y, uint16 color, const char *text, uint16 numchars); } // End of namespace Lab diff --git a/engines/lab/vga.h b/engines/lab/vga.h index d9110007df..5821a0cd82 100644 --- a/engines/lab/vga.h +++ b/engines/lab/vga.h @@ -42,63 +42,36 @@ struct Image { }; void setPage(uint16 PageNum); - void VGAStorePage(); - void VGARestorePage(); - bool createScreen(bool HiRes); - void waitTOF(); - void quickWaitTOF(); - byte *getVGABaseAddr(); - void ungetVGABaseAddr(); - void writeColorReg(byte *buf, uint16 regnum); - void writeColorRegs(byte *buf, uint16 first, uint16 numreg); - void writeColorRegsSmooth(byte *buf, uint16 first, uint16 numreg); - void VGASetPal(void *cmap, uint16 numcolors); /*---------- Drawing Routines ----------*/ void drawImage(Image *Im, uint16 x, uint16 y); - void drawMaskImage(Image *Im, uint16 x, uint16 y); - void readScreenImage(Image *Im, uint16 x, uint16 y); - void bltBitMap(Image *ImSource, uint16 xs, uint16 ys, Image *ImDest, uint16 xd, uint16 yd, uint16 width, uint16 height); - void scrollDisplayX(int16 dx, uint16 x1, uint16 y1, uint16 x2, uint16 y2); - void scrollDisplayY(int16 dy, uint16 x1, uint16 y1, uint16 x2, uint16 y2); - void setAPen(uint16 pennum); - void drawHLine(uint16 x, uint16 y1, uint16 y2); - void drawVLine(uint16 x1, uint16 y, uint16 x2); - void rectFill(uint16 x1, uint16 y1, uint16 x2, uint16 y2); - void ghoastRect(uint16 pencolor, uint16 x1, uint16 y1, uint16 x2, uint16 y2); - void WSDL_UpdateScreen(); - void WSDL_IgnoreUpdateDisplay(int state); - void WSDL_GetMousePos(int *x, int *y); - uint16 WSDL_GetNextChar(); - bool WSDL_HasNextChar(); - void WSDL_ProcessInput(bool can_delay); } // End of namespace Lab -- cgit v1.2.3 From f017cb624e219aa7ace135b4c2d6a3b262202f12 Mon Sep 17 00:00:00 2001 From: Filippos Karapetis Date: Fri, 17 Jul 2015 10:24:34 +0300 Subject: LAB: Use CamelCase, and simplify mouseHandler() --- engines/lab/engine.cpp | 4 +--- engines/lab/mouse.cpp | 54 ++++++++++++++------------------------------------ engines/lab/mouse.h | 4 ++-- engines/lab/vga.cpp | 6 +++--- 4 files changed, 21 insertions(+), 47 deletions(-) diff --git a/engines/lab/engine.cpp b/engines/lab/engine.cpp index 69ebae6548..37e86fba81 100644 --- a/engines/lab/engine.cpp +++ b/engines/lab/engine.cpp @@ -1400,9 +1400,7 @@ void LabEngine::go() { mem = mem && setUpScreens(); } - if (!initMouse()) { - return; - } + initMouse(); mem = mem && initRoomBuffer() && initLabText(); diff --git a/engines/lab/mouse.cpp b/engines/lab/mouse.cpp index 591014c595..8636ad7733 100644 --- a/engines/lab/mouse.cpp +++ b/engines/lab/mouse.cpp @@ -37,7 +37,6 @@ namespace Lab { extern bool IsHiRes; -extern uint32 VGAScreenWidth, VGAScreenHeight; static bool LeftClick = false; static bool RightClick = false; @@ -65,7 +64,6 @@ static byte MouseData[] = {1, 1, 0, 0, 0, 0, 0, 0, 0, 0, #define MOUSE_WIDTH 10 #define MOUSE_HEIGHT 15 -static bool gadhit = false; static Gadget *hitgad = NULL; /*****************************************************************************/ @@ -81,7 +79,6 @@ static Gadget *checkGadgetHit(Gadget *gadlist, uint16 x, uint16 y) { (y <= (gadlist->y + gadlist->Im->Height)) && !(GADGETOFF & gadlist->GadgetFlags)) { if (IsHiRes) { - gadhit = true; hitgad = gadlist; } else { VGAStorePage(); @@ -116,47 +113,36 @@ void attachGadgetList(Gadget *GadList) { ScreenGadgetList = GadList; } -static Gadget *TempGad; +void mouseHandler(int32 flag, int32 mouseX, int32 mouseY) { + if (NumHidden >= 2) + return; - -void mouse_handler(int32 flag, int32 mouseX, int32 mouseY) { if (!IsHiRes) mouseX /= 2; - if (flag & 0x01) { /* mouse Move */ - } - - if ((flag & 0x02) && (NumHidden < 2)) { /* Left mouse button click */ + if (flag & 0x02) { /* Left mouse button click */ + Gadget *tmp = NULL; if (ScreenGadgetList) - TempGad = checkGadgetHit(ScreenGadgetList, mouseX, mouseY); - else - TempGad = NULL; + tmp = checkGadgetHit(ScreenGadgetList, mouseX, mouseY); - if (TempGad) { - LastGadgetHit = TempGad; - } else { + if (tmp) + LastGadgetHit = tmp; + else LeftClick = true; - } } - if ((flag & 0x08) && (NumHidden < 2)) { /* Right mouse button click */ + if (flag & 0x08) /* Right mouse button click */ RightClick = true; - } } - - - void updateMouse() { uint16 counter; bool doUpdateDisplay = false; - if (!MouseHidden) { + if (!MouseHidden) doUpdateDisplay = true; - } - if (gadhit) { - gadhit = false; + if (hitgad) { mouseHide(); drawImage(hitgad->ImAlt, hitgad->x, hitgad->y); mouseShow(); @@ -168,6 +154,7 @@ void updateMouse() { drawImage(hitgad->Im, hitgad->x, hitgad->y); mouseShow(); doUpdateDisplay = true; + hitgad = NULL; } if (doUpdateDisplay) @@ -175,23 +162,17 @@ void updateMouse() { } - - /*****************************************************************************/ /* Initializes the mouse. */ /*****************************************************************************/ -bool initMouse() { +void initMouse() { g_system->setMouseCursor(MouseData, MOUSE_WIDTH, MOUSE_HEIGHT, 0, 0, 0); g_system->showMouse(false); mouseMove(0, 0); - - return true; } - - /*****************************************************************************/ /* Shows the mouse. */ /*****************************************************************************/ @@ -237,8 +218,6 @@ void mouseXY(uint16 *x, uint16 *y) { } - - /*****************************************************************************/ /* Moves the mouse to new co-ordinates. */ /*****************************************************************************/ @@ -248,14 +227,11 @@ void mouseMove(uint16 x, uint16 y) { g_system->warpMouse(x, y); - if (!MouseHidden) { + if (!MouseHidden) WSDL_ProcessInput(0); - } } - - /*****************************************************************************/ /* Checks whether or not the mouse buttons have been pressed, and the last */ /* co-ordinates of the button press. leftbutton tells whether to check the */ diff --git a/engines/lab/mouse.h b/engines/lab/mouse.h index 18e5c2caca..5dd77fb964 100644 --- a/engines/lab/mouse.h +++ b/engines/lab/mouse.h @@ -37,7 +37,7 @@ namespace Lab { struct Gadget; -bool initMouse(); +void initMouse(); void updateMouse(); @@ -55,7 +55,7 @@ Gadget *mouseGadget(); void attachGadgetList(Gadget *GadList); -void mouse_handler(int32 flag, int32 mouseX, int32 mouseY); +void mouseHandler(int32 flag, int32 mouseX, int32 mouseY); } // End of namespace Lab diff --git a/engines/lab/vga.cpp b/engines/lab/vga.cpp index d9633e97b5..388af2d4c7 100644 --- a/engines/lab/vga.cpp +++ b/engines/lab/vga.cpp @@ -135,12 +135,12 @@ void WSDL_ProcessInput(bool can_delay) { switch (event.type) { case Common::EVENT_RBUTTONDOWN: flags |= 8; - mouse_handler(flags, g_MouseX, g_MouseY); + mouseHandler(flags, g_MouseX, g_MouseY); break; case Common::EVENT_LBUTTONDOWN: flags |= 2; - mouse_handler(flags, g_MouseX, g_MouseY); + mouseHandler(flags, g_MouseX, g_MouseY); break; case Common::EVENT_MOUSEMOVE: @@ -167,7 +167,7 @@ void WSDL_ProcessInput(bool can_delay) { } if (!lastMouseAtEdge || !g_MouseAtEdge) - mouse_handler(1, g_MouseX, g_MouseY); + mouseHandler(1, g_MouseX, g_MouseY); break; -- cgit v1.2.3 From 884b80f2150c4509912988b19e0106aa15e1008f Mon Sep 17 00:00:00 2001 From: Filippos Karapetis Date: Fri, 17 Jul 2015 10:26:38 +0300 Subject: LAB: Remove unused variables, some cleanup --- engines/lab/graphics.cpp | 5 ----- engines/lab/labfile.cpp | 31 ++++++------------------------- 2 files changed, 6 insertions(+), 30 deletions(-) diff --git a/engines/lab/graphics.cpp b/engines/lab/graphics.cpp index 5fb12370a3..360ffa873a 100644 --- a/engines/lab/graphics.cpp +++ b/engines/lab/graphics.cpp @@ -48,7 +48,6 @@ extern char diffcmap[256 * 3], lastcmap[256 * 3]; extern bool IsBM, NoFlip, nopalchange; extern int32 ReadSoFar; -extern bool ReadIsDone, ReadIsError; extern bool DoBlack, stopsound; extern bool IsHiRes; extern TextFont *MsgFont; @@ -74,8 +73,6 @@ bool readPict(const char *filename, bool PlayOnce) { stopDiff(); ReadSoFar = 0L; - ReadIsDone = false; - ReadIsError = false; file = g_music->newOpen(filename); @@ -132,8 +129,6 @@ byte *readPictToMem(const char *filename, uint16 x, uint16 y) { stopDiff(); ReadSoFar = 0L; - ReadIsDone = false; - ReadIsError = false; allocFile((void **)&Mem, (int32) x * (int32) y, "Bitmap"); CurMem = Mem; diff --git a/engines/lab/labfile.cpp b/engines/lab/labfile.cpp index e5ff4916df..c2acb203a5 100644 --- a/engines/lab/labfile.cpp +++ b/engines/lab/labfile.cpp @@ -35,7 +35,6 @@ namespace Lab { #define MAXREADSIZE 30720L -#define DMABUGSIZE 0 /* The number of bytes the DMA driver might screw */ /* NOTE: set to 0 for non-CDTV machines. */ @@ -46,7 +45,6 @@ byte **startoffile = &startoffilestorage; static uint32 buffersize, realbuffersize; int32 ReadSoFar; -bool ReadIsError, ReadIsDone; /*****************************************************************************/ /* Returns the size of a file. */ @@ -145,19 +143,14 @@ static void *getCurMemLabFile(uint32 size) { /* Checks if a file is already buffered. */ /*****************************************************************************/ byte **isBuffered(const char *fileName) { - uint16 RMarker; - if (fileName == NULL) return NULL; - RMarker = 0; - - while (RMarker < MAXMARKERS) { - if (strcmp(FileMarkers[RMarker].name, fileName) == 0) { - *startoffile = (byte *) FileMarkers[RMarker].Start; + for (int i = 0; i < MAXMARKERS; i++) { + if (strcmp(FileMarkers[i].name, fileName) == 0) { + *startoffile = (byte *)FileMarkers[i].Start; return startoffile; - } else - RMarker++; + } } return NULL; @@ -174,8 +167,6 @@ bool allocFile(void **Ptr, uint32 Size, const char *fileName) { uint16 RMarker; byte **temp; - Size += DMABUGSIZE; - if (1 & Size) /* Memory is required to be even aligned */ Size++; @@ -221,8 +212,6 @@ byte **openFile(const char *name) { if (!file.isOpen()) { warning("Cannot open file %s", translateFileName(name)); - ReadIsError = true; - ReadIsDone = true; return NULL; } @@ -336,14 +325,8 @@ void freeBuffer() { /* Clears all the buffers. */ /*****************************************************************************/ static void flushBuffers() { - uint16 RMarker; - - RMarker = 0; - - while (RMarker < MAXMARKERS) { - freeFile(RMarker); - RMarker++; - } + for (int i = 0; i < MAXMARKERS; i++) + freeFile(i); } @@ -354,8 +337,6 @@ static void flushBuffers() { void *stealBufMem(int32 Size) { void *Mem; - Size += DMABUGSIZE; - flushBuffers(); Mem = buffer; -- cgit v1.2.3 From 79ed1e1f05dc1537f666018bc7240a5d96835b5b Mon Sep 17 00:00:00 2001 From: Filippos Karapetis Date: Fri, 17 Jul 2015 10:36:20 +0300 Subject: LAB: Get rid of numtostr(), and simplify most uses of sizeOfFile() --- engines/lab/engine.cpp | 44 +++++++--------------------- engines/lab/labfile.cpp | 4 +-- engines/lab/labfun.h | 74 ++--------------------------------------------- engines/lab/labmusic.cpp | 19 ++++++------ engines/lab/map.cpp | 10 +++---- engines/lab/readparse.cpp | 64 ++-------------------------------------- engines/lab/text.cpp | 10 +++---- 7 files changed, 36 insertions(+), 189 deletions(-) diff --git a/engines/lab/engine.cpp b/engines/lab/engine.cpp index 37e86fba81..9af2a22fb6 100644 --- a/engines/lab/engine.cpp +++ b/engines/lab/engine.cpp @@ -208,8 +208,6 @@ static bool LastTooLong = false; /* Draws the message for the room. */ /******************************************************************************/ static void drawRoomMessage(uint16 CurInv, CloseDataPtr cptr) { - char text[250], ManyText[8], *ManyPtr; - if (LastTooLong) { LastTooLong = false; return; @@ -220,12 +218,8 @@ static void drawRoomMessage(uint16 CurInv, CloseDataPtr cptr) { if ((CurInv == LAMPNUM) && g_lab->_conditions->in(LAMPON)) /* LAB: Labyrith specific */ drawMessage(LAMPONMSG); else if (Inventory[CurInv].Many > 1) { - ManyPtr = numtostr(ManyText, Inventory[CurInv].Many); - strcpy(text, Inventory[CurInv].name); - strcat(text, " ("); - strcat(text, ManyPtr); - strcat(text, ")"); - drawMessage(text); + Common::String roomMessage = Common::String(Inventory[CurInv].name) + " (" + Common::String::format("%d", Inventory[CurInv].Many) + ")"; + drawMessage(roomMessage.c_str()); } else drawMessage(Inventory[CurInv].name); } @@ -249,19 +243,14 @@ bool setUpScreens() { return false; /* Loads in the graphics for the movement control panel */ - MovePanelBufferSize = sizeOfFile("P:Control"); - - if (MovePanelBufferSize == 0L) - return false; - - if (!(MovePanelBuffer = (byte *)calloc(MovePanelBufferSize, 1))) - return false; - Common::File *file = openPartial("P:Control"); - if (!file) return false; + MovePanelBufferSize = file->size(); + if (!MovePanelBufferSize || !(MovePanelBuffer = (byte *)calloc(MovePanelBufferSize, 1))) + return false; + file->read(MovePanelBuffer, MovePanelBufferSize); file->close(); @@ -315,19 +304,14 @@ bool setUpScreens() { curgad->NextGadget = createButton(VGAScaleX(289), y, 9, 0, MoveImages[10], MoveImages[11]); } - InvPanelBufferSize = sizeOfFile("P:Inv"); - - if (InvPanelBufferSize == 0L) - return false; - - if (!(InvPanelBuffer = (byte *)calloc(InvPanelBufferSize, 1))) - return false; - file = openPartial("P:Inv"); - if (!file) return false; + InvPanelBufferSize = file->size(); + if (!InvPanelBufferSize || !(InvPanelBuffer = (byte *)calloc(InvPanelBufferSize, 1))) + return false; + file->read(InvPanelBuffer, InvPanelBufferSize); file->close(); @@ -413,19 +397,13 @@ void eatMessages() { do { Msg = getMsg(); - - if (Msg) { + if (Msg) replyMsg((void *) Msg); - } } while (Msg); return; } - - - - static uint16 lastmusicroom = 1; diff --git a/engines/lab/labfile.cpp b/engines/lab/labfile.cpp index c2acb203a5..43825f018d 100644 --- a/engines/lab/labfile.cpp +++ b/engines/lab/labfile.cpp @@ -203,7 +203,7 @@ bool allocFile(void **Ptr, uint32 Size, const char *fileName) { /*****************************************************************************/ /* Reads a file into memory. */ /*****************************************************************************/ -byte **openFile(const char *name) { +byte **openFile(const char *name, uint32 &size) { byte *buf; Common::File file; @@ -215,7 +215,7 @@ byte **openFile(const char *name) { return NULL; } - uint32 size = file.size(); + size = file.size(); buf = (byte *)malloc(size); diff --git a/engines/lab/labfun.h b/engines/lab/labfun.h index 60b313e190..61f27fcc81 100644 --- a/engines/lab/labfun.h +++ b/engines/lab/labfun.h @@ -70,9 +70,7 @@ struct SaveGameHeader { /* Reads in pictures */ bool readPict(const char *filename, bool PlayOnce); - bool readMusic(const char *filename); - byte *readPictToMem(const char *filename, uint16 x, uint16 y); /* Window text stuff */ @@ -100,31 +98,23 @@ uint32 flowTextToMem(Image *DestIm, void *font, /* the TextAttr pointer */ uint16 y1, uint16 x2, uint16 y2, const char *text); /* The text itself */ void drawMessage(const char *text); - void longDrawMessage(const char *text); - bool readFont(char *filename, void *font, void *data); /* The Wipes */ void doWipe(uint16 WipeType, CloseDataPtr *CPtr, char *filename); - /* Double Buffer stuff */ void newFlipViews(void *scrPtr, uint16 *newpal, uint16 numcolors); - void flipViews(void *scrPtr); - - - /*----------------------------*/ /*----- From Interface.c -----*/ /*----------------------------*/ Gadget *addGadButton(uint16 x, uint16 y, void *UpImage, void *DownImage, uint16 id); - void gadgetsOnOff(void *gptr, void *win, int32 num, bool on); /*----------------------*/ @@ -133,22 +123,15 @@ void gadgetsOnOff(void *gptr, void *win, int32 num, bool on); void introSequence(); - - /*----------------------*/ /*----- From Lab.c -----*/ /*----------------------*/ void eatMessages(); - bool setUpScreens(); - void drawPanel(); - bool quitPlaying(); - - /*---------------------------*/ /*------ From LabFile.c -----*/ /*---------------------------*/ @@ -156,53 +139,33 @@ bool quitPlaying(); uint32 sizeOfFile(const char *name); /* Buffer a whole file */ - byte **isBuffered(const char *fileName); - -byte **openFile(const char *name); - +byte **openFile(const char *name, uint32 &size); void readBlock(void *Buffer, uint32 Size, byte **File); - char readChar(char **File); - void skip(byte **File, uint32 skip); - void resetBuffer(); - bool initBuffer(uint32 BufSize, bool IsGraphicsMem); - void freeBuffer(); - /* Functions that borrow memory from the buffer */ - bool allocFile(void **Ptr, uint32 Size, const char *fileName); - void *stealBufMem(int32 Size); - void freeAllStolenMem(); /* Read chunks of a file */ - - Common::File *openPartial(const char *name); - void closePartial(int32 File); - /*---------------------------*/ /*------ From LabText.c -----*/ /*---------------------------*/ bool initLabText(); - void freeLabText(); - void decrypt(byte *text); - - /*---------------------------*/ /*----- From LabMusic.c -----*/ /*---------------------------*/ @@ -214,6 +177,7 @@ public: Music(); byte **newOpen(const char *name); + byte **newOpen(const char *name, uint32 &size); bool initMusic(); void freeMusic(); void fillUpMusic(bool doit); @@ -264,17 +228,11 @@ extern Music *g_music; class LargeSet { public: LargeSet(uint16 last); - ~LargeSet(); - bool in(uint16 element); - void inclElement(uint16 element); - void exclElement(uint16 element); - bool readInitialConditions(const char *fileName); - public: uint16 _lastElement; uint16 *_array; @@ -285,62 +243,38 @@ public: /*---------------------------*/ uint16 scaleX(uint16 x); - uint16 scaleY(uint16 y); - uint16 VGAScaleX(uint16 x); - uint16 VGAScaleY(uint16 y); - int16 VGAScaleXs(int16 x); - int16 VGAScaleYs(int16 y); - uint16 SVGACord(uint16 cord); - uint16 VGAUnScaleX(uint16 x); - uint16 VGAUnScaleY(uint16 y); - char *translateFileName(const char *filename); - - /*---------------------------*/ /*-------- From Map.c -------*/ /*---------------------------*/ void fade(bool fadein, uint16 res); - void setAmigaPal(uint16 *pal, uint16 numcolors); - char *getText(const char *filename); - bool getFont(const char *filename, TextFont *textfont); - void readImage(byte **buffer, Image **im); - void doMap(uint16 CurRoom); - void doJournal(); - void doNotes(); - void doWestPaper(); - void doMonitor(char *background, char *textfile, bool isinteractive, uint16 x1, uint16 y1, uint16 x2, uint16 y2); - bool saveRestoreGame(); - - /*--------------------------*/ /*----- From saveGame.c ----*/ /*--------------------------*/ bool saveGame(uint16 RoomNum, uint16 Direction, uint16 Quarters, int slot, Common::String desc); bool loadGame(uint16 *RoomNum, uint16 *Direction, uint16 *Quarters, int slot); - bool readSaveGameHeader(Common::InSaveFile *in, SaveGameHeader &header); /*--------------------------*/ @@ -348,13 +282,9 @@ bool readSaveGameHeader(Common::InSaveFile *in, SaveGameHeader &header); /*--------------------------*/ void showCombination(const char *filename); - void mouseCombination(uint16 x, uint16 y); - void showTile(const char *filename, bool showsolution); - void mouseTile(uint16 x, uint16 y); - void inner_main(); } // End of namespace Lab diff --git a/engines/lab/labmusic.cpp b/engines/lab/labmusic.cpp index 5222cd9af6..a435710078 100644 --- a/engines/lab/labmusic.cpp +++ b/engines/lab/labmusic.cpp @@ -331,6 +331,11 @@ void Music::resetMusic() { _tFile = 0; } +byte **Music::newOpen(const char *name) { + uint32 unused; + return newOpen(name, unused); +} + /*****************************************************************************/ /* Checks whether or note enough memory in music buffer before loading any */ /* files. Fills it if not. Does not take into account the current buffer */ @@ -339,20 +344,14 @@ void Music::resetMusic() { /* */ /* Here, the seconds are multipled by 10. */ /*****************************************************************************/ -byte **Music::newOpen(const char *name) { +byte **Music::newOpen(const char *name, uint32 &size) { byte **file; - if (name == NULL) { + if (!name || !strcmp(name, "") || !strcmp(name, " ")) return NULL; - } - if ((strcmp(name, "") == 0) || (strcmp(name, " ") == 0)) { - return NULL; - } - - if ((file = isBuffered(name))) { + if (file = isBuffered(name)) return file; - } if (_musicOn) { updateMusic(); @@ -362,7 +361,7 @@ byte **Music::newOpen(const char *name) { if (!_doNotFilestopSoundEffect && isSoundEffectActive()) stopSoundEffect(); - file = openFile(name); + file = openFile(name, size); checkMusic(); return file; } diff --git a/engines/lab/map.cpp b/engines/lab/map.cpp index b6b4415b11..a0dffe04e9 100644 --- a/engines/lab/map.cpp +++ b/engines/lab/map.cpp @@ -219,7 +219,7 @@ static uint16 mapScaleY(uint16 y) { /*****************************************************************************/ static bool loadMapData() { byte **buffer, Temp[5]; - int32 Size; + uint32 Size; Gadget *gptr; uint16 counter; @@ -228,9 +228,8 @@ static bool loadMapData() { if (!getFont("P:Map.fon", BigMsgFont)) BigMsgFont = MsgFont; - Size = sizeOfFile("P:MapImage"); resetBuffer(); /* Make images load into start of buffer */ - buffer = g_music->newOpen("P:MapImage"); + buffer = g_music->newOpen("P:MapImage", Size); if (!buffer) return false; @@ -279,8 +278,9 @@ static bool loadMapData() { counter++; } - buffer = g_music->newOpen("Lab:Maps"); - stealBufMem(sizeOfFile("Lab:Maps")); /* Freeze the memory for the maps */ + uint32 bufferSize; + buffer = g_music->newOpen("Lab:Maps", bufferSize); + stealBufMem(bufferSize); /* Freeze the memory for the maps */ readBlock(Temp, 4L, buffer); Temp[4] = 0; diff --git a/engines/lab/readparse.cpp b/engines/lab/readparse.cpp index 5e4bf6208e..672688cac3 100644 --- a/engines/lab/readparse.cpp +++ b/engines/lab/readparse.cpp @@ -181,58 +181,6 @@ bool readInventory(const char *fileName) { return true; } - - - - - -/*****************************************************************************/ -/* Converts a number to a string. */ -/*****************************************************************************/ -char *numtostr(char *text, uint16 Num) { - uint16 Counter = 0; - - if (Num == 0) { - text[0] = '0'; - text[1] = 0; - return text; - } - - strcpy(text, "00000"); - - if (Num >= 10000) { - text[0] = (Num / 10000) + '0'; - Num -= (Num / 10000) * 10000; - } - - if (Num >= 1000) { - text[1] = (Num / 1000) + '0'; - Num -= (Num / 1000) * 1000; - } - - if (Num >= 100) { - text[2] = (Num / 100) + '0'; - Num -= (Num / 100) * 100; - } - - if (Num >= 10) { - text[3] = (Num / 10) + '0'; - Num -= (Num / 10) * 10; - } - - text[4] = Num + '0'; - text[5] = 0; - - while (text[Counter] == '0') - Counter++; - - return (&text[Counter]); -} - - - - - /*****************************************************************************/ /* Reads in a list of conditions. */ /*****************************************************************************/ @@ -258,9 +206,6 @@ static int16 *readConditions(byte **file) { return ptr; } - - - /*****************************************************************************/ /* Reads in some CloseUp data. */ /*****************************************************************************/ @@ -417,16 +362,13 @@ static bool readRule(RulePtr *RPtr, byte **file) { /* Reads in the views of a room. */ /*****************************************************************************/ bool readViews(uint16 RoomNum, const char *Path) { - char Temp[10], *RoomString, fileName[250]; + Common::String fileName = Common::String(Path) + Common::String::format("%d", RoomNum); + char Temp[10]; byte **file; allocroom = RoomNum; - RoomString = numtostr(Temp, RoomNum); - strcpy(fileName, Path); - strcat(fileName, RoomString); - - if ((file = g_music->newOpen(fileName)) != NULL) { + if ((file = g_music->newOpen(fileName.c_str())) != NULL) { readBlock(Temp, 4L, file); Temp[4] = '\0'; diff --git a/engines/lab/text.cpp b/engines/lab/text.cpp index 5c456c4523..5056d24e63 100644 --- a/engines/lab/text.cpp +++ b/engines/lab/text.cpp @@ -41,10 +41,9 @@ namespace Lab { bool openFontMem(const char *TextFontPath, struct TextFont *tf, byte *fontbuffer) { byte **file = NULL; char header[5]; - int32 filesize, headersize = 4L + 2L + 256 * 3 + 4L; + uint32 filesize, headersize = 4L + 2L + 256 * 3 + 4L; - filesize = sizeOfFile(TextFontPath); - file = g_music->newOpen(TextFontPath); + file = g_music->newOpen(TextFontPath, filesize); if ((file != NULL) && (filesize > headersize)) { header[4] = 0; @@ -76,11 +75,10 @@ bool openFontMem(const char *TextFontPath, struct TextFont *tf, byte *fontbuffer bool openFont(const char *TextFontPath, struct TextFont **tf) { byte **file = NULL; char header[5]; - int32 filesize, headersize = 4L + 2L + 256 * 3 + 4L; + uint32 filesize, headersize = 4L + 2L + 256 * 3 + 4L; if ((*tf = (TextFont *)calloc(sizeof(struct TextFont), 1))) { - filesize = sizeOfFile(TextFontPath); - file = g_music->newOpen(TextFontPath); + file = g_music->newOpen(TextFontPath, filesize); if ((file != NULL) && (filesize > headersize)) { header[4] = 0; -- cgit v1.2.3 From 047df0b0e8d85593dd8200a169f0a68a66c138c2 Mon Sep 17 00:00:00 2001 From: Filippos Karapetis Date: Fri, 17 Jul 2015 10:38:06 +0300 Subject: LAB: Simplify usage of createButton() --- engines/lab/engine.cpp | 68 +++++++++++++++++++++++------------------------ engines/lab/interface.cpp | 3 +++ 2 files changed, 37 insertions(+), 34 deletions(-) diff --git a/engines/lab/engine.cpp b/engines/lab/engine.cpp index 9af2a22fb6..661cbdfb84 100644 --- a/engines/lab/engine.cpp +++ b/engines/lab/engine.cpp @@ -263,45 +263,45 @@ bool setUpScreens() { y = VGAScaleY(173) - SVGACord(2); if (g_lab->getPlatform() == Common::kPlatformWindows) { - MoveGadgetList = createButton(VGAScaleX(1), y, 0, 't', MoveImages[0], MoveImages[1]); + MoveGadgetList = createButton(1, y, 0, 't', MoveImages[0], MoveImages[1]); curgad = MoveGadgetList; - curgad->NextGadget = createButton(VGAScaleX(33), y, 1, 'm', MoveImages[2], MoveImages[3]); + curgad->NextGadget = createButton(33, y, 1, 'm', MoveImages[2], MoveImages[3]); curgad = curgad->NextGadget; - curgad->NextGadget = createButton(VGAScaleX(65), y, 2, 'o', MoveImages[4], MoveImages[5]); + curgad->NextGadget = createButton(65, y, 2, 'o', MoveImages[4], MoveImages[5]); curgad = curgad->NextGadget; - curgad->NextGadget = createButton(VGAScaleX(97), y, 3, 'c', MoveImages[6], MoveImages[7]); + curgad->NextGadget = createButton(97, y, 3, 'c', MoveImages[6], MoveImages[7]); curgad = curgad->NextGadget; - curgad->NextGadget = createButton(VGAScaleX(129), y, 4, 'l', MoveImages[8], MoveImages[9]); + curgad->NextGadget = createButton(129, y, 4, 'l', MoveImages[8], MoveImages[9]); curgad = curgad->NextGadget; - curgad->NextGadget = createButton(VGAScaleX(161), y, 5, 'i', MoveImages[12], MoveImages[13]); + curgad->NextGadget = createButton(161, y, 5, 'i', MoveImages[12], MoveImages[13]); curgad = curgad->NextGadget; - curgad->NextGadget = createButton(VGAScaleX(193), y, 6, VKEY_LTARROW, MoveImages[14], MoveImages[15]); + curgad->NextGadget = createButton(193, y, 6, VKEY_LTARROW, MoveImages[14], MoveImages[15]); curgad = curgad->NextGadget; - curgad->NextGadget = createButton(VGAScaleX(225), y, 7, VKEY_UPARROW, MoveImages[16], MoveImages[17]); + curgad->NextGadget = createButton(225, y, 7, VKEY_UPARROW, MoveImages[16], MoveImages[17]); curgad = curgad->NextGadget; - curgad->NextGadget = createButton(VGAScaleX(257), y, 8, VKEY_RTARROW, MoveImages[18], MoveImages[19]); + curgad->NextGadget = createButton(257, y, 8, VKEY_RTARROW, MoveImages[18], MoveImages[19]); curgad = curgad->NextGadget; - curgad->NextGadget = createButton(VGAScaleX(289), y, 9, 'p', MoveImages[10], MoveImages[11]); + curgad->NextGadget = createButton(289, y, 9, 'p', MoveImages[10], MoveImages[11]); } else { - MoveGadgetList = createButton(VGAScaleX(1), y, 0, 0, MoveImages[0], MoveImages[1]); + MoveGadgetList = createButton(1, y, 0, 0, MoveImages[0], MoveImages[1]); curgad = MoveGadgetList; - curgad->NextGadget = createButton(VGAScaleX(33), y, 1, 0, MoveImages[2], MoveImages[3]); + curgad->NextGadget = createButton(33, y, 1, 0, MoveImages[2], MoveImages[3]); curgad = curgad->NextGadget; - curgad->NextGadget = createButton(VGAScaleX(65), y, 2, 0, MoveImages[4], MoveImages[5]); + curgad->NextGadget = createButton(65, y, 2, 0, MoveImages[4], MoveImages[5]); curgad = curgad->NextGadget; - curgad->NextGadget = createButton(VGAScaleX(97), y, 3, 0, MoveImages[6], MoveImages[7]); + curgad->NextGadget = createButton(97, y, 3, 0, MoveImages[6], MoveImages[7]); curgad = curgad->NextGadget; - curgad->NextGadget = createButton(VGAScaleX(129), y, 4, 0, MoveImages[8], MoveImages[9]); + curgad->NextGadget = createButton(129, y, 4, 0, MoveImages[8], MoveImages[9]); curgad = curgad->NextGadget; - curgad->NextGadget = createButton(VGAScaleX(161), y, 5, 0, MoveImages[12], MoveImages[13]); + curgad->NextGadget = createButton(161, y, 5, 0, MoveImages[12], MoveImages[13]); curgad = curgad->NextGadget; - curgad->NextGadget = createButton(VGAScaleX(193), y, 6, 0, MoveImages[14], MoveImages[15]); + curgad->NextGadget = createButton(193, y, 6, 0, MoveImages[14], MoveImages[15]); curgad = curgad->NextGadget; - curgad->NextGadget = createButton(VGAScaleX(225), y, 7, 0, MoveImages[16], MoveImages[17]); + curgad->NextGadget = createButton(225, y, 7, 0, MoveImages[16], MoveImages[17]); curgad = curgad->NextGadget; - curgad->NextGadget = createButton(VGAScaleX(257), y, 8, 0, MoveImages[18], MoveImages[19]); + curgad->NextGadget = createButton(257, y, 8, 0, MoveImages[18], MoveImages[19]); curgad = curgad->NextGadget; - curgad->NextGadget = createButton(VGAScaleX(289), y, 9, 0, MoveImages[10], MoveImages[11]); + curgad->NextGadget = createButton(289, y, 9, 0, MoveImages[10], MoveImages[11]); } file = openPartial("P:Inv"); @@ -321,37 +321,37 @@ bool setUpScreens() { for (counter = 0; counter < 10; counter++) readImage(buffer, &(InvImages[counter])); - InvGadgetList = createButton(VGAScaleX(24), y, 0, 'm', InvImages[0], InvImages[1]); + InvGadgetList = createButton(24, y, 0, 'm', InvImages[0], InvImages[1]); curgad = InvGadgetList; - curgad->NextGadget = createButton(VGAScaleX(56), y, 1, 'g', InvImages[2], InvImages[3]); + curgad->NextGadget = createButton(56, y, 1, 'g', InvImages[2], InvImages[3]); curgad = curgad->NextGadget; - curgad->NextGadget = createButton(VGAScaleX(94), y, 2, 'u', InvImages[4], InvImages[5]); + curgad->NextGadget = createButton(94, y, 2, 'u', InvImages[4], InvImages[5]); curgad = curgad->NextGadget; - curgad->NextGadget = createButton(VGAScaleX(126), y, 3, 'l', MoveImages[8], MoveImages[9]); + curgad->NextGadget = createButton(126, y, 3, 'l', MoveImages[8], MoveImages[9]); curgad = curgad->NextGadget; - curgad->NextGadget = createButton(VGAScaleX(164), y, 4, VKEY_LTARROW, MoveImages[14], MoveImages[15]); + curgad->NextGadget = createButton(164, y, 4, VKEY_LTARROW, MoveImages[14], MoveImages[15]); curgad = curgad->NextGadget; - curgad->NextGadget = createButton(VGAScaleX(196), y, 5, VKEY_RTARROW, MoveImages[18], MoveImages[19]); + curgad->NextGadget = createButton(196, y, 5, VKEY_RTARROW, MoveImages[18], MoveImages[19]); curgad = curgad->NextGadget; - curgad->NextGadget = createButton(VGAScaleX(234), y, 6, 'b', InvImages[6], InvImages[7]); + curgad->NextGadget = createButton(234, y, 6, 'b', InvImages[6], InvImages[7]); curgad = curgad->NextGadget; - curgad->NextGadget = createButton(VGAScaleX(266), y, 7, 'f', InvImages[8], InvImages[9]); + curgad->NextGadget = createButton(266, y, 7, 'f', InvImages[8], InvImages[9]); curgad = curgad->NextGadget; } else { for (counter = 0; counter < 6; counter++) readImage(buffer, &(InvImages[counter])); - InvGadgetList = createButton(VGAScaleX(58), y, 0, 0, InvImages[0], InvImages[1]); + InvGadgetList = createButton(58, y, 0, 0, InvImages[0], InvImages[1]); curgad = InvGadgetList; - curgad->NextGadget = createButton(VGAScaleX(90), y, 1, 0, InvImages[2], InvImages[3]); + curgad->NextGadget = createButton(90, y, 1, 0, InvImages[2], InvImages[3]); curgad = curgad->NextGadget; - curgad->NextGadget = createButton(VGAScaleX(128), y, 2, 0, InvImages[4], InvImages[5]); + curgad->NextGadget = createButton(128, y, 2, 0, InvImages[4], InvImages[5]); curgad = curgad->NextGadget; - curgad->NextGadget = createButton(VGAScaleX(160), y, 3, 0, MoveImages[8], MoveImages[9]); + curgad->NextGadget = createButton(160, y, 3, 0, MoveImages[8], MoveImages[9]); curgad = curgad->NextGadget; - curgad->NextGadget = createButton(VGAScaleX(198), y, 4, 0, MoveImages[14], MoveImages[15]); + curgad->NextGadget = createButton(198, y, 4, 0, MoveImages[14], MoveImages[15]); curgad = curgad->NextGadget; - curgad->NextGadget = createButton(VGAScaleX(230), y, 5, 0, MoveImages[18], MoveImages[19]); + curgad->NextGadget = createButton(230, y, 5, 0, MoveImages[18], MoveImages[19]); curgad = curgad->NextGadget; } diff --git a/engines/lab/interface.cpp b/engines/lab/interface.cpp index 62d35c1e03..cffa054a8e 100644 --- a/engines/lab/interface.cpp +++ b/engines/lab/interface.cpp @@ -28,6 +28,7 @@ * */ +#include "lab/labfun.h" #include "lab/stddefines.h" #include "lab/interface.h" #include "lab/timing.h" @@ -44,6 +45,8 @@ Common::KeyState _keyPressed; Gadget *createButton(uint16 x, uint16 y, uint16 id, uint16 key, Image *im, Image *imalt) { Gadget *gptr; + x = VGAScaleX(x); + if ((gptr = new Gadget())) { gptr->x = x; gptr->y = y; -- cgit v1.2.3 From e35307ccba5b62979e3ee58d9606cb519c54ace3 Mon Sep 17 00:00:00 2001 From: Filippos Karapetis Date: Fri, 17 Jul 2015 10:38:47 +0300 Subject: LAB: Simplify initLabText() --- engines/lab/labtext.cpp | 143 ++++++++++++++++++++++++------------------------ 1 file changed, 71 insertions(+), 72 deletions(-) diff --git a/engines/lab/labtext.cpp b/engines/lab/labtext.cpp index 3c26ea7839..4284865847 100644 --- a/engines/lab/labtext.cpp +++ b/engines/lab/labtext.cpp @@ -65,78 +65,77 @@ static void setString(char **string) { /* Initializes everything for the Labyrinth text stuff */ /*****************************************************************************/ bool initLabText() { - if ((SizeOfMemChunk = sizeOfFile(LABTEXTFILE))) - if ((BeginOfMemChunk = (char *)calloc(SizeOfMemChunk, 1))) { - Common::File *file = openPartial(LABTEXTFILE); - - if (file) { - file->read(BeginOfMemChunk, SizeOfMemChunk); - file->close(); - - CurPlace = BeginOfMemChunk; - - setString(&LOWERFLOORS); - setString(&MIDDLEFLOORS); - setString(&UPPERFLOORS); - setString(&MEDMAZEFLOORS); - setString(&HEDGEMAZEFLOORS); - setString(&SURMAZEFLOORS); - setString(&CARNIVALFLOOR); - setString(&SURMAZEMSG); - - setString(&FACINGNORTH); - setString(&FACINGEAST); - setString(&FACINGSOUTH); - setString(&FACINGWEST); - - setString(&LAMPONMSG); - - setString(&TURNLEFT); - setString(&TURNRIGHT); - setString(&GOFORWARDDIR); - setString(&NOPATH); - setString(&TAKEITEM); - - setString(&SAVETEXT); - setString(&LOADTEXT); - setString(&BOOKMARKTEXT); - setString(&PERSONALTEXT); - setString(&DISKTEXT); - - setString(&SAVEBOOK); - setString(&RESTOREBOOK); - setString(&SAVEFLASH); - setString(&RESTOREFLASH); - setString(&SAVEDISK); - setString(&RESTOREDISK); - setString(&NODISKINDRIVE); - setString(&WRITEPROTECTED); - setString(&SELECTDISK); - - setString(&FORMATFLOPPY); - setString(&FORMATTING); - - setString(&NOTHING); - setString(&USEONWHAT); - setString(&TAKEWHAT); - setString(&MOVEWHAT); - setString(&OPENWHAT); - setString(&CLOSEWHAT); - setString(&LOOKWHAT); - - setString(&USEMAP); - setString(&USEJOURNAL); - setString(&TURNLAMPON); - setString(&TURNLAMPOFF); - setString(&USEWHISKEY); - setString(&USEPITH); - setString(&USEHELMET); - - return true; - } - } - - return false; + Common::File *file = openPartial(LABTEXTFILE); + if (!file) + return false; + + SizeOfMemChunk = file->size(); + if (!SizeOfMemChunk || !(BeginOfMemChunk = (char *)calloc(SizeOfMemChunk, 1))) + return false; + + file->read(BeginOfMemChunk, SizeOfMemChunk); + file->close(); + + CurPlace = BeginOfMemChunk; + + setString(&LOWERFLOORS); + setString(&MIDDLEFLOORS); + setString(&UPPERFLOORS); + setString(&MEDMAZEFLOORS); + setString(&HEDGEMAZEFLOORS); + setString(&SURMAZEFLOORS); + setString(&CARNIVALFLOOR); + setString(&SURMAZEMSG); + + setString(&FACINGNORTH); + setString(&FACINGEAST); + setString(&FACINGSOUTH); + setString(&FACINGWEST); + + setString(&LAMPONMSG); + + setString(&TURNLEFT); + setString(&TURNRIGHT); + setString(&GOFORWARDDIR); + setString(&NOPATH); + setString(&TAKEITEM); + + setString(&SAVETEXT); + setString(&LOADTEXT); + setString(&BOOKMARKTEXT); + setString(&PERSONALTEXT); + setString(&DISKTEXT); + + setString(&SAVEBOOK); + setString(&RESTOREBOOK); + setString(&SAVEFLASH); + setString(&RESTOREFLASH); + setString(&SAVEDISK); + setString(&RESTOREDISK); + setString(&NODISKINDRIVE); + setString(&WRITEPROTECTED); + setString(&SELECTDISK); + + setString(&FORMATFLOPPY); + setString(&FORMATTING); + + setString(&NOTHING); + setString(&USEONWHAT); + setString(&TAKEWHAT); + setString(&MOVEWHAT); + setString(&OPENWHAT); + setString(&CLOSEWHAT); + setString(&LOOKWHAT); + + setString(&USEMAP); + setString(&USEJOURNAL); + setString(&TURNLAMPON); + setString(&TURNLAMPOFF); + setString(&USEWHISKEY); + setString(&USEPITH); + setString(&USEHELMET); + + return true; } -- cgit v1.2.3 From e031359d9933cc9c7ce88e1b99876b4ec257437d Mon Sep 17 00:00:00 2001 From: Filippos Karapetis Date: Fri, 17 Jul 2015 10:39:44 +0300 Subject: LAB: Use the correct splash screen file for the DOS version --- engines/lab/intro.cpp | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/engines/lab/intro.cpp b/engines/lab/intro.cpp index 7f0b53f98d..c14546e4df 100644 --- a/engines/lab/intro.cpp +++ b/engines/lab/intro.cpp @@ -270,8 +270,6 @@ static void NReadPict(const char *Filename, bool PlayOnce) { } -//#define ALL_LOGOS - /*****************************************************************************/ /* Does the introduction sequence for Labyrinth. */ /*****************************************************************************/ @@ -299,7 +297,10 @@ void introSequence() { g_music->initMusic(); nopalchange = true; - NReadPict("TNDcycle2.pic", true); + if (g_lab->getPlatform() != Common::kPlatformWindows) + NReadPict("TNDcycle.pic", true); + else + NReadPict("TNDcycle2.pic", true); nopalchange = false; FadePalette = Palette; -- cgit v1.2.3 From 9a12f6be3fc48f4fa4cc3dc45fce7a0b406bff9b Mon Sep 17 00:00:00 2001 From: Filippos Karapetis Date: Fri, 17 Jul 2015 10:45:26 +0300 Subject: LAB: Simplify translateFileName() --- engines/lab/intro.cpp | 2 +- engines/lab/machine.cpp | 85 +++++++++++++------------------------------------ engines/lab/special.cpp | 2 +- 3 files changed, 24 insertions(+), 65 deletions(-) diff --git a/engines/lab/intro.cpp b/engines/lab/intro.cpp index c14546e4df..1f05afe231 100644 --- a/engines/lab/intro.cpp +++ b/engines/lab/intro.cpp @@ -364,7 +364,7 @@ void introSequence() { blackAllScreen(); g_music->fillUpMusic(true); - getFont("P:Map.font", msgfont); + getFont("P:Map.fon", msgfont); nopalchange = true; NReadPict("Intro.1", true); diff --git a/engines/lab/machine.cpp b/engines/lab/machine.cpp index 3806b5f6e1..61375d6867 100644 --- a/engines/lab/machine.cpp +++ b/engines/lab/machine.cpp @@ -28,6 +28,8 @@ * */ +#include "common/str.h" + #include "lab/stddefines.h" namespace Lab { @@ -45,9 +47,6 @@ uint16 scaleX(uint16 x) { return (uint16)((x * 8) / 9); } - - - /*****************************************************************************/ /* Scales the y co-ordinates to that of the new display. In the room parser */ /* file, co-ordinates are set up on a 368x336 display. */ @@ -59,9 +58,6 @@ uint16 scaleY(uint16 y) { return ((y * 10) / 24); } - - - /*****************************************************************************/ /* Scales the VGA cords to SVGA if necessary; otherwise, returns VGA cords. */ /*****************************************************************************/ @@ -120,9 +116,6 @@ uint16 SVGACord(uint16 cord) { return 0; } - - - /*****************************************************************************/ /* Converts SVGA cords to VGA if necessary, otherwise returns VGA cords. */ /*****************************************************************************/ @@ -133,9 +126,6 @@ uint16 VGAUnScaleX(uint16 x) { return x; } - - - /*****************************************************************************/ /* Converts SVGA cords to VGA if necessary, otherwise returns VGA cords. */ /*****************************************************************************/ @@ -146,29 +136,6 @@ uint16 VGAUnScaleY(uint16 y) { return y; } - -/*****************************************************************************/ -/* Checks to see if all the characters in the second string are at the start */ -/* of the first. */ -/*****************************************************************************/ -static bool strstart(const char **Source, const char *Start) { - uint16 len1, len2, counter; - - len1 = strlen(*Source); - len2 = strlen(Start); - - if (len1 < len2) - return false; - - for (counter = 0; counter < len2; counter++) - if ((*Source)[counter] != Start[counter]) - return false; - - (*Source) += len2; - return true; -} - - static char NewFileName[255]; /*****************************************************************************/ @@ -180,40 +147,32 @@ static char NewFileName[255]; /* attention to one file at a time, it would be fine to have one variable */ /* not on the stack which is used to store the new filename. */ /*****************************************************************************/ -static void mystrupr(char *s) { - char c; - - while ((c = *s) != 0) - *s++ = toupper(c); -} - char *translateFileName(const char *filename) { - char tempfilename[255]; - char *dot; - - strcpy(tempfilename, filename); - mystrupr(tempfilename); - - *NewFileName = 0; - filename = tempfilename; + Common::String fileNameStr = filename; + fileNameStr.toUppercase(); + Common::String fileNameStrFinal; - if (strstart(&filename, "P:")) { + if (fileNameStr.hasPrefix("P:")) { if (IsHiRes) - strcat(NewFileName, "GAME/SPICT/"); + fileNameStrFinal = "GAME/SPICT/"; else - strcat(NewFileName, "GAME/PICT/"); - } else if (strstart(&filename, "LAB:")) - strcat(NewFileName, "GAME/"); - else if (strstart(&filename, "MUSIC:")) - strcat(NewFileName, "GAME/MUSIC/"); - - strcat(NewFileName, filename); + fileNameStrFinal = "GAME/PICT/"; + } else if (fileNameStr.hasPrefix("LAB:")) + fileNameStrFinal = "GAME/"; + else if (fileNameStr.hasPrefix("MUSIC:")) + fileNameStrFinal = "GAME/MUSIC/"; + + if (fileNameStr.contains(':')) { + while (fileNameStr[0] != ':') { + fileNameStr.deleteChar(0); + } + + fileNameStr.deleteChar(0); + } - dot = strrchr(NewFileName, '.'); + fileNameStrFinal += fileNameStr; - if (dot != NewFileName && dot != NULL && dot[4] != '/') { // Linux may start with '.' - dot[4] = 0; // Back to the days of 8.3, even if your OS was never DOSish!! - } + strcpy(NewFileName, fileNameStrFinal.c_str()); return NewFileName; } diff --git a/engines/lab/special.cpp b/engines/lab/special.cpp index 74625a63f4..603dfbe348 100644 --- a/engines/lab/special.cpp +++ b/engines/lab/special.cpp @@ -1193,7 +1193,7 @@ void doMonitor(char *background, char *textfile, bool isinteractive, uint16 x1, BigMsgFont = &bmfont; - if (!getFont("P:Map.font", BigMsgFont)) { + if (!getFont("P:Map.fon", BigMsgFont)) { freeAllStolenMem(); BigMsgFont = NULL; return; -- cgit v1.2.3 From 4f0c63c0f89aedad21ab41f4b440d0a8b7ae8b6b Mon Sep 17 00:00:00 2001 From: Filippos Karapetis Date: Fri, 17 Jul 2015 10:50:04 +0300 Subject: LAB: Merge the VGAScale and setCurClose functions --- engines/lab/labfun.h | 6 ++---- engines/lab/machine.cpp | 35 ++----------------------------- engines/lab/parsefun.h | 26 +---------------------- engines/lab/processroom.cpp | 50 +++++++++++++-------------------------------- engines/lab/readdiff.cpp | 2 -- engines/lab/special.cpp | 30 +++++++++++++-------------- 6 files changed, 34 insertions(+), 115 deletions(-) diff --git a/engines/lab/labfun.h b/engines/lab/labfun.h index 61f27fcc81..e2f7844596 100644 --- a/engines/lab/labfun.h +++ b/engines/lab/labfun.h @@ -244,10 +244,8 @@ public: uint16 scaleX(uint16 x); uint16 scaleY(uint16 y); -uint16 VGAScaleX(uint16 x); -uint16 VGAScaleY(uint16 y); -int16 VGAScaleXs(int16 x); -int16 VGAScaleYs(int16 y); +int16 VGAScaleX(int16 x); +int16 VGAScaleY(int16 y); uint16 SVGACord(uint16 cord); uint16 VGAUnScaleX(uint16 x); uint16 VGAUnScaleY(uint16 y); diff --git a/engines/lab/machine.cpp b/engines/lab/machine.cpp index 61375d6867..ede75e0aec 100644 --- a/engines/lab/machine.cpp +++ b/engines/lab/machine.cpp @@ -61,54 +61,23 @@ uint16 scaleY(uint16 y) { /*****************************************************************************/ /* Scales the VGA cords to SVGA if necessary; otherwise, returns VGA cords. */ /*****************************************************************************/ -uint16 VGAScaleX(uint16 x) { +int16 VGAScaleX(int16 x) { if (IsHiRes) return (x * 2); else return x; } - - - /*****************************************************************************/ /* Scales the VGA cords to SVGA if necessary; otherwise, returns VGA cords. */ /*****************************************************************************/ -uint16 VGAScaleY(uint16 y) { +int16 VGAScaleY(int16 y) { if (IsHiRes) return ((y * 12) / 5); else return y; } - - -/*****************************************************************************/ -/* Scales the VGA cords to SVGA if necessary; otherwise, returns VGA cords. */ -/*****************************************************************************/ -int16 VGAScaleXs(int16 x) { - if (IsHiRes) - return (x * 2); - else - return x; -} - - - - -/*****************************************************************************/ -/* Scales the VGA cords to SVGA if necessary; otherwise, returns VGA cords. */ -/*****************************************************************************/ -int16 VGAScaleYs(int16 y) { - if (IsHiRes) - return ((y * 12) / 5); - else - return y; -} - - - - uint16 SVGACord(uint16 cord) { if (IsHiRes) return cord; diff --git a/engines/lab/parsefun.h b/engines/lab/parsefun.h index 6766dd27f0..f5929ae306 100644 --- a/engines/lab/parsefun.h +++ b/engines/lab/parsefun.h @@ -45,54 +45,30 @@ bool parse(const char *InputFile); /* From allocRoom.c */ bool initRoomBuffer(); - void freeRoomBuffer(); - void allocRoom(void **Ptr, uint16 Size, uint16 RoomNum); /* From ReadParse.c */ bool readRoomData(const char *fileName); - bool readInventory(const char *fileName); - -char *numtostr(char *text, uint16 Num); - bool readViews(uint16 RoomNum, const char *Path); /* From ProcessRoom.c */ ViewDataPtr getViewData(uint16 RoomNum, uint16 Direction); - char *getPictName(CloseDataPtr *LCPtr); - void drawDirection(CloseDataPtr LCPtr); - bool processArrow(uint16 *Direction, uint16 Arrow); - -void setCurCloseAbs(uint16 x, uint16 y, CloseDataPtr *cptr); - -void setCurClose(uint16 x, uint16 y, CloseDataPtr *cptr); - +void setCurClose(uint16 x, uint16 y, CloseDataPtr *cptr, bool useAbsoluteCoords = false); bool takeItem(uint16 x, uint16 y, CloseDataPtr *cptr); - bool doActionRule(int16 x, int16 y, int16 action, int16 RoomNum, CloseDataPtr *LCPtr); - bool doOperateRule(int16 x, int16 y, int16 ItemNum, CloseDataPtr *LCPtr); - bool doGoForward(CloseDataPtr *LCPtr); - bool doTurn(uint16 from, uint16 to, CloseDataPtr *LCPtr); - bool doMainView(CloseDataPtr *LCPtr); -/* - bool doConditions(int16 x, - int16 y, - CloseDataPtr *LCPtr); - */ - } // End of namespace Lab #endif /* LAB_PARSEFUN_H */ diff --git a/engines/lab/processroom.cpp b/engines/lab/processroom.cpp index 27d480bf69..7293b908ea 100644 --- a/engines/lab/processroom.cpp +++ b/engines/lab/processroom.cpp @@ -234,12 +234,6 @@ void drawDirection(CloseDataPtr LCPtr) { else if (Direction == WEST) strcat(Message, FACINGWEST); - /* - numtostr(test, RoomNum); - strcat(Message, ", "); - strcat(Message, test); - */ - drawMessage(Message); } @@ -307,11 +301,12 @@ bool processArrow(uint16 *direction, uint16 Arrow) { } /*****************************************************************************/ -/* Sets the current close up data, but uses absolute cords. */ +/* Sets the current close up data. */ /*****************************************************************************/ -void setCurCloseAbs(uint16 x, uint16 y, CloseDataPtr *cptr) { +void setCurClose(uint16 x, uint16 y, CloseDataPtr *cptr, bool useAbsoluteCoords) { ViewDataPtr VPtr; CloseDataPtr LCPtr; + uint16 x1, y1, x2, y2; if (*cptr == NULL) { VPtr = getViewData(RoomNum, Direction); @@ -319,37 +314,20 @@ void setCurCloseAbs(uint16 x, uint16 y, CloseDataPtr *cptr) { } else LCPtr = (*cptr)->SubCloseUps; - while (LCPtr != NULL) { - if ((x >= LCPtr->x1) && (y >= LCPtr->y1) && - (x <= LCPtr->x2) && (y <= LCPtr->y2) && - (LCPtr->GraphicName)) { - *cptr = LCPtr; - return; + if (!useAbsoluteCoords) { + x1 = LCPtr->x1; + y1 = LCPtr->y1; + x2 = LCPtr->x2; + y2 = LCPtr->y2; + } else { + x1 = scaleX(LCPtr->x1); + y1 = scaleY(LCPtr->y1); + x2 = scaleX(LCPtr->x2); + y2 = scaleY(LCPtr->y2); } - LCPtr = LCPtr->NextCloseUp; - } -} - -/*****************************************************************************/ -/* Sets the current close up data. */ -/*****************************************************************************/ -void setCurClose(uint16 x, uint16 y, CloseDataPtr *cptr) { - ViewDataPtr VPtr; - CloseDataPtr LCPtr; - - if (*cptr == NULL) { - VPtr = getViewData(RoomNum, Direction); - LCPtr = VPtr->closeUps; - } else - LCPtr = (*cptr)->SubCloseUps; - - - while (LCPtr != NULL) { - if ((x >= scaleX(LCPtr->x1)) && (y >= scaleY(LCPtr->y1)) && - (x <= scaleX(LCPtr->x2)) && (y <= scaleY(LCPtr->y2)) && - (LCPtr->GraphicName)) { + if (x >= x1 && y >= y1 && x <= x2 && y <= y2 && LCPtr->GraphicName) { *cptr = LCPtr; return; } diff --git a/engines/lab/readdiff.cpp b/engines/lab/readdiff.cpp index fa1a009780..e1ecb3b6d0 100644 --- a/engines/lab/readdiff.cpp +++ b/engines/lab/readdiff.cpp @@ -42,8 +42,6 @@ extern uint32 VGABytesPerPage; /* extern int32 ReadSoFar; - extern bool ReadIsDone, - ReadIsError; */ extern byte **startoffile; diff --git a/engines/lab/special.cpp b/engines/lab/special.cpp index 603dfbe348..b8e66626d2 100644 --- a/engines/lab/special.cpp +++ b/engines/lab/special.cpp @@ -363,22 +363,22 @@ static void doTileScroll(uint16 col, uint16 row, uint16 scrolltype) { uint16 counter; if (scrolltype == LEFTSCROLL) { - dX = VGAScaleXs(5); - sx = VGAScaleXs(5); + dX = VGAScaleX(5); + sx = VGAScaleX(5); last = 6; } else if (scrolltype == RIGHTSCROLL) { - dX = VGAScaleXs(-5); - dx = VGAScaleXs(-5); + dX = VGAScaleX(-5); + dx = VGAScaleX(-5); sx = VGAScaleX(5); last = 6; } else if (scrolltype == UPSCROLL) { - dY = VGAScaleYs(5); - sy = VGAScaleYs(5); + dY = VGAScaleY(5); + sy = VGAScaleY(5); last = 5; } else if (scrolltype == DOWNSCROLL) { - dY = VGAScaleYs(-5); - dy = VGAScaleYs(-5); - sy = VGAScaleYs(5); + dY = VGAScaleY(-5); + dy = VGAScaleY(-5); + sy = VGAScaleY(5); last = 5; } @@ -437,9 +437,6 @@ static void changeTile(uint16 col, uint16 row) { } if (scrolltype != -1) { - /* NYI: - readPict("Music:Click", true); - */ doTileScroll(col, row, scrolltype); #if defined(LABDEMO) @@ -933,6 +930,8 @@ extern uint16 RoomNum, Direction; bool saveRestoreGame() { bool isOK = false; + //g_lab->showMainMenu(); + // The original had one screen for saving/loading. We have two. // Ask the user which screen to use. GUI::MessageDialog saveOrLoad(_("Would you like to save or restore a game?"), _("Save"), _("Restore")); @@ -990,17 +989,18 @@ Image *MonButton, *AltMonButton, *MonQuit, *AltMonQuit, *MonBack, *AltMonBack, /*****************************************************************************/ static void getMonImages() { byte **buffer; + uint32 bufferSize; resetBuffer(); - buffer = g_music->newOpen("P:MonImage"); + buffer = g_music->newOpen("P:MonImage", bufferSize); if (!buffer) return; readImage(buffer, &MonButton); - stealBufMem(sizeOfFile("P:MonImage")); /* Trick: protects the memory where the buttons are so they won't be over-written */ + stealBufMem(bufferSize); /* Trick: protects the memory where the buttons are so they won't be over-written */ } @@ -1150,7 +1150,7 @@ static void processMonitor(char *ntext, bool isinteractive, uint16 x1, uint16 y1 TestCPtr = CPtr; MouseY = 64 + (MouseY / MonGadHeight) * 42; MouseX = 101; - setCurCloseAbs(MouseX, MouseY, &CPtr); + setCurClose(MouseX, MouseY, &CPtr, true); if (TestCPtr != CPtr) { LastCPtr[depth] = TestCPtr; -- cgit v1.2.3 From 5ae4d3bf9eac72cc554d6ecbcd89528dda9cea5c Mon Sep 17 00:00:00 2001 From: Filippos Karapetis Date: Fri, 17 Jul 2015 10:52:30 +0300 Subject: LAB: Initial code to simplify translateFileName() and the save menu --- engines/lab/lab.cpp | 13 +++++++++++++ engines/lab/lab.h | 2 ++ 2 files changed, 15 insertions(+) diff --git a/engines/lab/lab.cpp b/engines/lab/lab.cpp index f1d0fe96c4..3f92de1116 100644 --- a/engines/lab/lab.cpp +++ b/engines/lab/lab.cpp @@ -28,12 +28,15 @@ * */ +#include "common/config-manager.h" #include "common/debug-channels.h" #include "common/scummsys.h" #include "common/error.h" #include "common/fs.h" #include "common/rect.h" +#include "engines/dialogs.h" +#include "engines/engine.h" #include "engines/util.h" #include "gui/message.h" @@ -50,6 +53,12 @@ LabEngine *g_lab; LabEngine::LabEngine(OSystem *syst, const ADGameDescription *gameDesc) : Engine(syst), _gameDescription(gameDesc), _extraGameFeatures(0) { g_lab = this; + + //const Common::FSNode gameDataDir(ConfMan.get("path")); + //SearchMan.addSubDirectoryMatching(gameDataDir, "game"); + //SearchMan.addSubDirectoryMatching(gameDataDir, "game/pict"); + //SearchMan.addSubDirectoryMatching(gameDataDir, "game/spict"); + //SearchMan.addSubDirectoryMatching(gameDataDir, "music"); } LabEngine::~LabEngine() { @@ -108,4 +117,8 @@ Common::String LabEngine::generateSaveFileName(uint slot) { return Common::String::format("%s.%03u", _targetName.c_str(), slot); } +/*void LabEngine::showMainMenu() { + +}*/ + } // End of namespace Lab diff --git a/engines/lab/lab.h b/engines/lab/lab.h index b16b5981b3..c1bf4337b9 100644 --- a/engines/lab/lab.h +++ b/engines/lab/lab.h @@ -60,6 +60,8 @@ public: bool hasFeature(EngineFeature f) const; Common::String generateSaveFileName(uint slot); + //void showMainMenu(); + LargeSet *_conditions, *_roomsFound; private: -- cgit v1.2.3 From 27683945e609d50947cecaf1b947fd85e40e9159 Mon Sep 17 00:00:00 2001 From: Filippos Karapetis Date: Sat, 18 Jul 2015 15:22:58 +0300 Subject: LAB: Simplify timeDiff() --- engines/lab/timing.cpp | 18 +----------------- 1 file changed, 1 insertion(+), 17 deletions(-) diff --git a/engines/lab/timing.cpp b/engines/lab/timing.cpp index acba16d98e..a9f593e668 100644 --- a/engines/lab/timing.cpp +++ b/engines/lab/timing.cpp @@ -105,24 +105,8 @@ void anyTimeDiff(uint32 sec1, uint32 micros1, uint32 sec2, uint32 micros2, uint3 /*****************************************************************************/ void timeDiff(uint32 sec, uint32 micros, uint32 *diffSec, uint32 *diffMicros) { uint32 curSec, curMicros; - - *diffSec = 0; - *diffMicros = 0; - getTime(&curSec, &curMicros); - - if (curSec > sec) /* Already passed the time */ - return; - else if ((curSec == sec) && (curMicros >= micros)) /* Already passed the time */ - return; - - if (curMicros > micros) { - *diffSec = sec - curSec - 1; - *diffMicros = (ONESECOND - curMicros) + micros; - } else { - *diffSec = sec - curSec; - *diffMicros = micros - curMicros; - } + anyTimeDiff(curSec, curMicros, sec, micros, diffSec, diffMicros); } /*****************************************************************************/ -- cgit v1.2.3 From 21e360b9b18e887bb35efaf21a16bf7f97338a35 Mon Sep 17 00:00:00 2001 From: Filippos Karapetis Date: Sat, 18 Jul 2015 15:28:10 +0300 Subject: LAB: Remove dead/superfluous code, and remove the newCheckMusic() wrapper --- engines/lab/diff.h | 2 +- engines/lab/engine.cpp | 14 +++----- engines/lab/graphics.cpp | 87 +++++---------------------------------------- engines/lab/interface.cpp | 4 --- engines/lab/interface.h | 4 --- engines/lab/intro.cpp | 29 ++++++++------- engines/lab/labfun.h | 1 - engines/lab/labmusic.cpp | 7 ---- engines/lab/map.cpp | 33 ++--------------- engines/lab/processroom.cpp | 7 ++-- engines/lab/readdiff.cpp | 14 +------- engines/lab/special.cpp | 20 +++-------- engines/lab/vga.cpp | 4 --- 13 files changed, 38 insertions(+), 188 deletions(-) diff --git a/engines/lab/diff.h b/engines/lab/diff.h index 4c906f7597..b5c84d3a93 100644 --- a/engines/lab/diff.h +++ b/engines/lab/diff.h @@ -46,7 +46,7 @@ struct DIFFHeader { struct BitMap { uint16 BytesPerRow, Rows; - byte Flags, Depth; + byte Flags; byte *Planes[16]; }; diff --git a/engines/lab/engine.cpp b/engines/lab/engine.cpp index 661cbdfb84..8960464aeb 100644 --- a/engines/lab/engine.cpp +++ b/engines/lab/engine.cpp @@ -397,8 +397,6 @@ void eatMessages() { do { Msg = getMsg(); - if (Msg) - replyMsg((void *) Msg); } while (Msg); return; @@ -787,7 +785,7 @@ static void mainGameLoop() { if (Msg == NULL) { /* Does music load and next animation frame when you've run out of messages */ GotMessage = false; checkRoomMusic(); - g_music->newCheckMusic(); + g_music->checkMusic(); diffNextFrame(); if (FollowingCrumbs) { @@ -830,8 +828,6 @@ static void mainGameLoop() { MouseY = Msg->MouseY; GadID = Msg->GadgetID; - replyMsg((void *) Msg); - FollowingCrumbs = false; from_crumbs: @@ -893,11 +889,9 @@ from_crumbs: Msg = getMsg(); if (Msg == NULL) { /* Does music load and next animation frame when you've run out of messages */ - g_music->newCheckMusic(); + g_music->checkMusic(); diffNextFrame(); } else { - replyMsg((void *) Msg); /* Can't do this in non-IBM versions */ - if (Msg->Class == RAWKEY) { if ((Msg->Code == 'Y') || (Msg->Code == 'y') || (Msg->Code == 'Q') || (Msg->Code == 'q')) { doit = true; @@ -1406,7 +1400,7 @@ void LabEngine::go() { readPict("P:End/L2In.1", true); for (counter = 0; counter < 120; counter++) { - g_music->newCheckMusic(); + g_music->checkMusic(); waitTOF(); } @@ -1415,7 +1409,7 @@ void LabEngine::go() { warning("STUB: waitForPress"); while (!1) { // 1 means ignore SDL_ProcessInput calls - g_music->newCheckMusic(); + g_music->checkMusic(); diffNextFrame(); waitTOF(); } diff --git a/engines/lab/graphics.cpp b/engines/lab/graphics.cpp index 360ffa873a..7f949d6bdf 100644 --- a/engines/lab/graphics.cpp +++ b/engines/lab/graphics.cpp @@ -47,7 +47,6 @@ extern BitMap RawDiffBM; extern char diffcmap[256 * 3], lastcmap[256 * 3]; extern bool IsBM, NoFlip, nopalchange; -extern int32 ReadSoFar; extern bool DoBlack, stopsound; extern bool IsHiRes; extern TextFont *MsgFont; @@ -62,7 +61,7 @@ extern const char *CurFileName; /*---------------------------------------------------------------------------*/ -extern uint32 VGAScreenWidth, VGAScreenHeight, VGAPages, VGABytesPerPage; +extern uint32 VGAScreenWidth, VGAScreenHeight, VGABytesPerPage; /*****************************************************************************/ /* Reads in a picture into the dest bitmap. */ @@ -72,8 +71,6 @@ bool readPict(const char *filename, bool PlayOnce) { stopDiff(); - ReadSoFar = 0L; - file = g_music->newOpen(filename); if (file == NULL) { @@ -86,7 +83,6 @@ bool readPict(const char *filename, bool PlayOnce) { DispBitMap->BytesPerRow = VGAScreenWidth; DispBitMap->Rows = VGAScreenHeight; DispBitMap->Flags = BITMAPF_VIDEO; - DispBitMap->Depth = VGAPages; readDiff(PlayOnce); @@ -128,8 +124,6 @@ byte *readPictToMem(const char *filename, uint16 x, uint16 y) { stopDiff(); - ReadSoFar = 0L; - allocFile((void **)&Mem, (int32) x * (int32) y, "Bitmap"); CurMem = Mem; @@ -141,7 +135,6 @@ byte *readPictToMem(const char *filename, uint16 x, uint16 y) { DispBitMap->BytesPerRow = x; DispBitMap->Rows = y; DispBitMap->Flags = 0; - DispBitMap->Depth = VGAPages; DispBitMap->Planes[0] = CurMem; DispBitMap->Planes[1] = DispBitMap->Planes[0] + 0x10000; DispBitMap->Planes[2] = DispBitMap->Planes[1] + 0x10000; @@ -423,70 +416,6 @@ void drawMessage(const char *str) { #define READFIRSTFRAME 6 #define READNEXTFRAME 7 - - - -/*****************************************************************************/ -/* Copies memory from one location to another 64 bytes at a time. */ -/*****************************************************************************/ -void copyLong64(uint32 *Dest, uint32 *Source, uint32 Many64) { - while (Many64) { - *Dest = *Source; - Dest++; - Source++; - *Dest = *Source; - Dest++; - Source++; - *Dest = *Source; - Dest++; - Source++; - *Dest = *Source; - Dest++; - Source++; - *Dest = *Source; - Dest++; - Source++; - *Dest = *Source; - Dest++; - Source++; - *Dest = *Source; - Dest++; - Source++; - *Dest = *Source; - Dest++; - Source++; - *Dest = *Source; - Dest++; - Source++; - *Dest = *Source; - Dest++; - Source++; - *Dest = *Source; - Dest++; - Source++; - *Dest = *Source; - Dest++; - Source++; - *Dest = *Source; - Dest++; - Source++; - *Dest = *Source; - Dest++; - Source++; - *Dest = *Source; - Dest++; - Source++; - *Dest = *Source; - Dest++; - Source++; - - Many64--; - } -} - - - - /*****************************************************************************/ /* Scrolls the display to black. */ /*****************************************************************************/ @@ -516,7 +445,7 @@ static void doScrollBlack() { nheight = height; while (nheight) { - g_music->newCheckMusic(); + g_music->checkMusic(); if (!IsHiRes) waitTOF(); @@ -541,7 +470,7 @@ static void doScrollBlack() { size -= copysize; setPage(CurPage); - copyLong64(BaseAddr, (uint32 *) tempmem, copysize >> 6); + memcpy(BaseAddr, tempmem, copysize); tempmem += copysize; CurPage++; } @@ -596,7 +525,7 @@ static void copyPage(uint16 width, uint16 height, uint16 nheight, uint16 startli size -= copysize; setPage(CurPage); - copyLong64(BaseAddr + (OffSet >> 2), (uint32 *) mem, copysize >> 6); + memcpy(BaseAddr + (OffSet >> 2), mem, copysize); mem += copysize; CurPage++; OffSet = 0; @@ -618,7 +547,7 @@ static void doScrollWipe(char *filename) { height = VGAScaleY(149) + SVGACord(2); while (g_music->isSoundEffectActive()) { - g_music->newCheckMusic(); + g_music->checkMusic(); waitTOF(); } @@ -633,7 +562,7 @@ static void doScrollWipe(char *filename) { nheight = height; while (onrow < headerdata.y) { - g_music->newCheckMusic(); + g_music->checkMusic(); if ((by > nheight) && nheight) by = nheight; @@ -694,7 +623,7 @@ static void doScrollBounce() { int startline = headerdata.y - height - 1; for (int counter = 0; counter < 5; counter++) { - g_music->newCheckMusic(); + g_music->checkMusic(); startline -= newby[counter]; copyPage(width, height, 0, startline, mem); @@ -703,7 +632,7 @@ static void doScrollBounce() { } for (int counter = 8; counter > 0; counter--) { - g_music->newCheckMusic(); + g_music->checkMusic(); startline += newby1[counter - 1]; copyPage(width, height, 0, startline, mem); diff --git a/engines/lab/interface.cpp b/engines/lab/interface.cpp index cffa054a8e..e2f7401114 100644 --- a/engines/lab/interface.cpp +++ b/engines/lab/interface.cpp @@ -207,8 +207,4 @@ IntuiMessage *getMsg() { return NULL; } -void replyMsg(void *Msg) { - return; -} - } // End of namespace Lab diff --git a/engines/lab/interface.h b/engines/lab/interface.h index 170006f64a..ea110f4015 100644 --- a/engines/lab/interface.h +++ b/engines/lab/interface.h @@ -111,16 +111,12 @@ extern Common::KeyState _keyPressed; /*--------------------------- Function Prototypes ---------------------------*/ /*---------------------------------------------------------------------------*/ - - - Gadget *createButton(uint16 x, uint16 y, uint16 id, uint16 key, Image *im, Image *imalt); void freeButtonList(void *gptrlist); void drawGadgetList(Gadget *gadlist); void ghoastGadget(Gadget *curgad, uint16 pencolor); void unGhoastGadget(Gadget *curgad); IntuiMessage *getMsg(); -void replyMsg(void *Msg); } // End of namespace Lab diff --git a/engines/lab/intro.cpp b/engines/lab/intro.cpp index 1f05afe231..c430b61058 100644 --- a/engines/lab/intro.cpp +++ b/engines/lab/intro.cpp @@ -81,8 +81,6 @@ void introEatMessages() { ((Msg->Class == RAWKEY) && (Msg->Code == 27)) ) QuitIntro = true; - - replyMsg(Msg); } } } @@ -110,7 +108,7 @@ static void doPictText(const char *Filename, bool isscreen) { g_music->fillUpMusic(true); timedelay = 35; } else { - g_music->newCheckMusic(); + g_music->checkMusic(); timedelay = 7; } @@ -162,7 +160,7 @@ static void doPictText(const char *Filename, bool isscreen) { Msg = getMsg(); if (Msg == NULL) { - g_music->newCheckMusic(); + g_music->checkMusic(); diffNextFrame(); getTime(&secs, µs); @@ -184,7 +182,6 @@ static void doPictText(const char *Filename, bool isscreen) { Class = Msg->Class; Qualifier = Msg->Qualifier; Code = Msg->Code; - replyMsg(Msg); if (((Class == MOUSEBUTTONS) && (IEQUALIFIER_RBUTTON & Qualifier)) || ((Class == RAWKEY) && (Code == 27))) { @@ -238,13 +235,13 @@ static void doPictText(const char *Filename, bool isscreen) { void musicDelay() { int16 counter; - g_music->newCheckMusic(); + g_music->checkMusic(); if (QuitIntro) return; for (counter = 0; counter < 20; counter++) { - g_music->newCheckMusic(); + g_music->checkMusic(); waitTOF(); waitTOF(); waitTOF(); @@ -256,7 +253,7 @@ void musicDelay() { static void NReadPict(const char *Filename, bool PlayOnce) { Common::String finalFileName = "P:Intro/"; - g_music->newCheckMusic(); + g_music->checkMusic(); introEatMessages(); if (QuitIntro) @@ -285,10 +282,12 @@ void introSequence() { NReadPict("EA3", true); } else { NReadPict("WYRMKEEP", true); - for (counter = 0; counter < 4; counter++) { + // Wait 4 seconds + for (counter = 0; counter < 4 * 1000 / 10; counter++) { + introEatMessages(); if (QuitIntro) break; - microDelay(1, 0); + g_system->delayMillis(10); } } @@ -314,14 +313,14 @@ void introSequence() { (diffcmap[counter * 3 + 2] >> 2); } - g_music->newCheckMusic(); + g_music->checkMusic(); fade(true, 0); for (int times = 0; times < 150; times++) { if (QuitIntro) break; - g_music->newCheckMusic(); + g_music->checkMusic(); uint16 temp = Palette[2]; for (counter = 2; counter < 15; counter++) @@ -336,7 +335,7 @@ void introSequence() { fade(false, 0); blackAllScreen(); - g_music->newCheckMusic(); + g_music->checkMusic(); NReadPict("Title.A", true); NReadPict("AB", true); @@ -360,7 +359,7 @@ void introSequence() { g_music->newOpen("p:Intro/Intro.1"); /* load the picture into the buffer */ - g_music->newCheckMusic(); + g_music->checkMusic(); blackAllScreen(); g_music->fillUpMusic(true); @@ -415,7 +414,7 @@ void introSequence() { for (counter1 = (8 * 3); counter1 < (255 * 3); counter1++) diffcmap[counter1] = 255 - diffcmap[counter1]; - g_music->newCheckMusic(); + g_music->checkMusic(); waitTOF(); VGASetPal(diffcmap, 256); waitTOF(); diff --git a/engines/lab/labfun.h b/engines/lab/labfun.h index e2f7844596..cd1e2df690 100644 --- a/engines/lab/labfun.h +++ b/engines/lab/labfun.h @@ -184,7 +184,6 @@ public: void updateMusic(); uint16 getPlayingBufferCount(); void checkMusic(); - void newCheckMusic(); void closeMusic(); void setMusic(bool on); void resumeBackMusic(); diff --git a/engines/lab/labmusic.cpp b/engines/lab/labmusic.cpp index a435710078..ecb5fd174b 100644 --- a/engines/lab/labmusic.cpp +++ b/engines/lab/labmusic.cpp @@ -252,13 +252,6 @@ void Music::checkMusic() { fillUpMusic(false); } -/*****************************************************************************/ -/* Checks to see if need to fill buffers fill of music. */ -/*****************************************************************************/ -void Music::newCheckMusic() { - checkMusic(); -} - /*****************************************************************************/ /* Turns the music on and off. */ /*****************************************************************************/ diff --git a/engines/lab/map.cpp b/engines/lab/map.cpp index a0dffe04e9..458ff215df 100644 --- a/engines/lab/map.cpp +++ b/engines/lab/map.cpp @@ -142,16 +142,10 @@ void readImage(byte **buffer, Image **im) { } - - - - /*---------------------------------------------------------------------------*/ /*------------------------------ The Map stuff ------------------------------*/ /*---------------------------------------------------------------------------*/ - - extern RoomData *Rooms; extern const char *ViewPath; @@ -620,7 +614,7 @@ static void drawMap(uint16 CurRoom, uint16 CurMsg, uint16 Floor, bool fadeout, b } if ((Maps[CurRoom].PageNumber == Floor) /* Makes sure the X is drawn in corridors */ - && g_lab->_roomsFound->in(CurRoom) /* NOTE: this here on purpose just in case there's some wierd condition, like the surreal maze where there are no rooms */ + && g_lab->_roomsFound->in(CurRoom) /* NOTE: this here on purpose just in case there's some weird condition, like the surreal maze where there are no rooms */ && Maps[CurRoom].x) drawRoom(CurRoom, true); @@ -664,38 +658,28 @@ static void drawMap(uint16 CurRoom, uint16 CurMsg, uint16 Floor, bool fadeout, b } - /* LAB: Labyrinth specific code */ - sptr = NULL; - switch (Floor) { case LOWERFLOOR: sptr = LOWERFLOORS; break; - case MIDDLEFLOOR: sptr = MIDDLEFLOORS; break; - case UPPERFLOOR: sptr = UPPERFLOORS; break; - case MEDMAZEFLOOR: sptr = MEDMAZEFLOORS; break; - case HEDGEMAZEFLOOR: sptr = HEDGEMAZEFLOORS; break; - case SURMAZEFLOOR: sptr = SURMAZEFLOORS; break; - case CARNIVAL: sptr = CARNIVALFLOOR; break; - default: sptr = NULL; break; @@ -734,7 +718,7 @@ void processMap(uint16 CurRoom) { Msg = getMsg(); if (Msg == NULL) { - g_music->newCheckMusic(); + g_music->checkMusic(); if (place <= 14) { newcolor[0] = 14 << 2; @@ -888,17 +872,6 @@ void processMap(uint16 CurRoom) { } - -/*****************************************************************************/ -/* Cleans up behind itself. */ -/*****************************************************************************/ -void mapCleanUp() { - freeAllStolenMem(); -} - - - - /*****************************************************************************/ /* Does the map processing. */ /*****************************************************************************/ @@ -929,7 +902,7 @@ void doMap(uint16 CurRoom) { mouseHide(); setAPen(0); rectFill(0, 0, VGAScreenWidth - 1, VGAScreenHeight - 1); - mapCleanUp(); + freeAllStolenMem(); blackAllScreen(); mouseShow(); WSDL_UpdateScreen(); diff --git a/engines/lab/processroom.cpp b/engines/lab/processroom.cpp index 7293b908ea..9d501e6b57 100644 --- a/engines/lab/processroom.cpp +++ b/engines/lab/processroom.cpp @@ -206,9 +206,6 @@ char *getPictName(CloseDataPtr *LCPtr) { /*****************************************************************************/ void drawDirection(CloseDataPtr LCPtr) { char Message[250]; - /* - char test[15]; - */ if (LCPtr != NULL) { if (LCPtr->Message) { @@ -378,7 +375,7 @@ static void doActions(ActionPtr APtr, CloseDataPtr *LCPtr) { uint32 StartSecs, StartMicros, CurSecs, CurMicros; while (APtr) { - g_music->newCheckMusic(); + g_music->checkMusic(); switch (APtr->ActionType) { case PLAYSOUND: @@ -547,7 +544,7 @@ static void doActions(ActionPtr APtr, CloseDataPtr *LCPtr) { WSDL_UpdateScreen(); while (1) { - g_music->newCheckMusic(); + g_music->checkMusic(); diffNextFrame(); getTime(&CurSecs, &CurMicros); diff --git a/engines/lab/readdiff.cpp b/engines/lab/readdiff.cpp index e1ecb3b6d0..f2a39b41aa 100644 --- a/engines/lab/readdiff.cpp +++ b/engines/lab/readdiff.cpp @@ -40,9 +40,6 @@ namespace Lab { extern BitMap *DispBitMap, *DrawBitMap; extern uint32 VGABytesPerPage; -/* - extern int32 ReadSoFar; - */ extern byte **startoffile; static bool PlayOnce = false, changedscreen; @@ -258,10 +255,6 @@ void diffNextFrame() { break; case 26L: - /* NYI: This don't work no more - memcpy((void *) DrawBitMap->Planes[CurBit], - (void *) DispBitMap->Planes[CurBit], (uint16) (diffheight*diffwidth)); - */ CurBit++; break; @@ -443,11 +436,6 @@ void stopDiff() { if (IsPlaying) { StopPlaying = true; - /* NYI: - while (IsPlaying) - waitTOF(); - */ - if (IsAnim) blackScreen(); } @@ -463,7 +451,7 @@ void stopDiffEnd() { StopPlayingEnd = true; while (IsPlaying) { - g_music->newCheckMusic(); + g_music->checkMusic(); diffNextFrame(); } } diff --git a/engines/lab/special.cpp b/engines/lab/special.cpp index b8e66626d2..57f328451d 100644 --- a/engines/lab/special.cpp +++ b/engines/lab/special.cpp @@ -171,10 +171,6 @@ static void changeCombination(uint16 number) { display.Width = VGAScreenWidth; display.Height = VGAScreenHeight; - /* NYI: - readPict("Music:Thunk", true); - */ - for (counter = 1; counter <= (Images[combnum]->Height / 2); counter++) { if (IsHiRes) { if (counter & 1) @@ -725,7 +721,7 @@ static void drawJournalText() { char *CurText = journaltext; while (DrawingToPage < JPage) { - g_music->newCheckMusic(); + g_music->checkMusic(); CurText = (char *)(journaltext + CharsDrawn); CharsDrawn += flowText(BigMsgFont, -2, 2, 0, false, false, false, false, VGAScaleX(52), VGAScaleY(32), VGAScaleX(152), VGAScaleY(148), CurText); @@ -846,14 +842,12 @@ static void processJournal() { Msg = (IntuiMessage *) getMsg(); if (Msg == NULL) { - g_music->newCheckMusic(); + g_music->checkMusic(); } else { Class = Msg->Class; Qualifier = Msg->Qualifier; GadID = Msg->Code; - replyMsg((void *) Msg); - if (((Class == MOUSEBUTTONS) && (IEQUALIFIER_RBUTTON & Qualifier)) || ((Class == RAWKEY) && (GadID == 27))) return; @@ -1047,7 +1041,7 @@ static void drawMonText(char *text, uint16 x1, uint16 y1, uint16 x2, uint16 y2, } while (DrawingToPage < monpage) { - g_music->newCheckMusic(); + g_music->checkMusic(); CurText = (char *)(text + CharsDrawn); CharsDrawn += flowText(BigMsgFont, yspacing, 0, 0, false, false, false, false, x1, y1, x2, y2, CurText); lastpage = (*CurText == 0); @@ -1105,7 +1099,7 @@ static void processMonitor(char *ntext, bool isinteractive, uint16 x1, uint16 y1 Msg = getMsg(); if (Msg == NULL) { - g_music->newCheckMusic(); + g_music->checkMusic(); } else { Class = Msg->Class; Qualifier = Msg->Qualifier; @@ -1113,8 +1107,6 @@ static void processMonitor(char *ntext, bool isinteractive, uint16 x1, uint16 y1 MouseY = Msg->MouseY; Code = Msg->Code; - replyMsg(Msg); - if (((Class == MOUSEBUTTONS) && (IEQUALIFIER_RBUTTON & Qualifier)) || ((Class == RAWKEY) && (Code == 27))) return; @@ -1242,7 +1234,7 @@ void doTrialBlock() { Msg = getMsg(); if (Msg == NULL) { - g_music->newCheckMusic(); + g_music->checkMusic(); } else { Class = Msg->Class; Qualifier = Msg->Qualifier; @@ -1250,8 +1242,6 @@ void doTrialBlock() { MouseY = Msg->MouseY; Code = Msg->Code; - replyMsg(Msg); - if (((Class == MOUSEBUTTONS) && (IEQUALIFIER_RBUTTON & Qualifier)) || ((Class == RAWKEY) && (Code == 27))) return; diff --git a/engines/lab/vga.cpp b/engines/lab/vga.cpp index 388af2d4c7..31477a78e9 100644 --- a/engines/lab/vga.cpp +++ b/engines/lab/vga.cpp @@ -38,11 +38,8 @@ namespace Lab { -//static uint16 NotInRefresh = 0; - uint32 VGAScreenWidth = 320UL, VGAScreenHeight = 200UL, - VGAPages = 1UL, VGABytesPerPage = 65536UL; byte *VGABASEADDRESS = 0; @@ -76,7 +73,6 @@ bool createScreen(bool HiRes) { VGAScreenWidth = 320; VGAScreenHeight = 200; } - VGAPages = 1; VGABytesPerPage = VGAScreenWidth * VGAScreenHeight; g_DisplayBuffer = (byte *)malloc(VGABytesPerPage); -- cgit v1.2.3 From a4bad804f61eb933532f9936e185c54ceaf2b285 Mon Sep 17 00:00:00 2001 From: Filippos Karapetis Date: Sat, 18 Jul 2015 15:30:00 +0300 Subject: LAB: Get rid of sizeOfFile(), some cleanup --- engines/lab/labfile.cpp | 23 ------------- engines/lab/labfun.h | 2 -- engines/lab/map.cpp | 48 +++++++++++++++++--------- engines/lab/text.cpp | 89 +++++-------------------------------------------- engines/lab/text.h | 1 - 5 files changed, 40 insertions(+), 123 deletions(-) diff --git a/engines/lab/labfile.cpp b/engines/lab/labfile.cpp index 43825f018d..dfb72571b2 100644 --- a/engines/lab/labfile.cpp +++ b/engines/lab/labfile.cpp @@ -44,29 +44,6 @@ static byte *buffer = NULL, *realbufferstart = NULL, *startoffilestorage = NULL; byte **startoffile = &startoffilestorage; static uint32 buffersize, realbuffersize; -int32 ReadSoFar; - -/*****************************************************************************/ -/* Returns the size of a file. */ -/*****************************************************************************/ -uint32 sizeOfFile(const char *name) { - Common::File file; - - file.open(translateFileName(name)); - if (!file.isOpen()) { - warning("Cannot open file %s", translateFileName(name)); - - return 0; - } - uint32 size = file.size(); - file.close(); - - return size; -} - - - - /*-------------------- Routines that buffer a whole file --------------------*/ diff --git a/engines/lab/labfun.h b/engines/lab/labfun.h index cd1e2df690..ea0d3c8c48 100644 --- a/engines/lab/labfun.h +++ b/engines/lab/labfun.h @@ -136,8 +136,6 @@ bool quitPlaying(); /*------ From LabFile.c -----*/ /*---------------------------*/ -uint32 sizeOfFile(const char *name); - /* Buffer a whole file */ byte **isBuffered(const char *fileName); byte **openFile(const char *name, uint32 &size); diff --git a/engines/lab/map.cpp b/engines/lab/map.cpp index 458ff215df..cb51a51fff 100644 --- a/engines/lab/map.cpp +++ b/engines/lab/map.cpp @@ -59,20 +59,15 @@ extern uint16 RoomNum; /*****************************************************************************/ void setAmigaPal(uint16 *pal, uint16 numcolors) { byte vgapal[16 * 3]; - uint16 counter, vgacount; + uint16 vgacount = 0; if (numcolors > 16) numcolors = 16; - vgacount = 0; - - for (counter = 0; counter < numcolors; counter++) { - vgapal[vgacount] = (byte)(((pal[counter] & 0xf00) >> 8) << 2); - vgacount++; - vgapal[vgacount] = (byte)(((pal[counter] & 0x0f0) >> 4) << 2); - vgacount++; - vgapal[vgacount] = (byte)(((pal[counter] & 0x00f)) << 2); - vgacount++; + for (uint16 counter = 0; counter < numcolors; counter++) { + vgapal[vgacount++] = (byte)(((pal[counter] & 0xf00) >> 8) << 2); + vgapal[vgacount++] = (byte)(((pal[counter] & 0x0f0) >> 4) << 2); + vgapal[vgacount++] = (byte)(((pal[counter] & 0x00f)) << 2); } writeColorRegsSmooth(vgapal, 0, 16); @@ -83,18 +78,39 @@ void setAmigaPal(uint16 *pal, uint16 numcolors) { /* Gets a font from disk and puts it into temporary memory. */ /*****************************************************************************/ bool getFont(const char *filename, TextFont *textfont) { - byte *fontbuffer; + byte **file = NULL; + char header[5]; + uint32 filesize, headersize = 4L + 2L + 256 * 3 + 4L; - fontbuffer = (byte *)stealBufMem(sizeOfFile(filename) - (sizeof(TextFont) + 4)); + file = g_music->newOpen(filename, filesize); g_music->checkMusic(); - if (fontbuffer == NULL) - return false; + if ((file != NULL) && (filesize > headersize)) { + byte *fontbuffer = (byte *)stealBufMem(filesize - (sizeof(TextFont) + 4)); + if (!fontbuffer) + return false; - return openFontMem(filename, textfont, fontbuffer); -} + header[4] = 0; + readBlock(&header, 4L, file); + + if (strcmp(header, "VGAF") == 0) { + textfont->DataLength = filesize - headersize; + readBlock(&(textfont->Height), 2L, file); + swapUShortPtr(&(textfont->Height), 1); + + readBlock(textfont->Widths, 256L, file); + readBlock(textfont->Offsets, 256L * 2L, file); + swapUShortPtr(textfont->Offsets, 256); + skip(file, 4L); + textfont->data = fontbuffer; + readBlock(textfont->data, textfont->DataLength, file); + return true; + } + } + return false; +} /*****************************************************************************/ diff --git a/engines/lab/text.cpp b/engines/lab/text.cpp index 5056d24e63..5120a19a5c 100644 --- a/engines/lab/text.cpp +++ b/engines/lab/text.cpp @@ -35,40 +35,6 @@ namespace Lab { -/*****************************************************************************/ -/* Opens up a font from disk, but uses buffer memory to store it in. */ -/*****************************************************************************/ -bool openFontMem(const char *TextFontPath, struct TextFont *tf, byte *fontbuffer) { - byte **file = NULL; - char header[5]; - uint32 filesize, headersize = 4L + 2L + 256 * 3 + 4L; - - file = g_music->newOpen(TextFontPath, filesize); - - if ((file != NULL) && (filesize > headersize)) { - header[4] = 0; - readBlock(&header, 4L, file); - - if (strcmp(header, "VGAF") == 0) { - tf->DataLength = filesize - headersize; - readBlock(&(tf->Height), 2L, file); - swapUShortPtr(&(tf->Height), 1); - - readBlock(tf->Widths, 256L, file); - readBlock(tf->Offsets, 256L * 2L, file); - swapUShortPtr(tf->Offsets, 256); - - skip(file, 4L); - tf->data = fontbuffer; - readBlock(tf->data, tf->DataLength, file); - return true; - } - } - - return false; -} - - /*****************************************************************************/ /* Opens up a font from disk. */ /*****************************************************************************/ @@ -145,10 +111,7 @@ uint16 textLength(struct TextFont *tf, const char *text, uint16 numchars) { /* Returns the height of a specified font. */ /*****************************************************************************/ uint16 textHeight(struct TextFont *tf) { - if (tf) - return tf->Height; - else - return 0; + return (tf) ? tf->Height : 0; } @@ -177,8 +140,7 @@ void text(struct TextFont *tf, uint16 x, uint16 y, uint16 color, const char *tex if (tf->Widths[(uint)*text]) { cdata = tf->data + tf->Offsets[(uint)*text]; - bwidth = *cdata; - cdata++; + bwidth = *cdata++; VGATemp = VGACur; VGATempLine = VGACur; @@ -187,49 +149,14 @@ void text(struct TextFont *tf, uint16 x, uint16 y, uint16 color, const char *tex templeft = LeftInSegment; for (cols = 0; cols < bwidth; cols++) { - data = *cdata; - cdata++; + data = *cdata++; if (data && (templeft >= 8)) { - if (0x80 & data) - *VGATemp = color; - - VGATemp++; - - if (0x40 & data) - *VGATemp = color; - - VGATemp++; - - if (0x20 & data) - *VGATemp = color; - - VGATemp++; - - if (0x10 & data) - *VGATemp = color; - - VGATemp++; - - if (0x08 & data) - *VGATemp = color; - - VGATemp++; - - if (0x04 & data) - *VGATemp = color; - - VGATemp++; - - if (0x02 & data) - *VGATemp = color; - - VGATemp++; - - if (0x01 & data) - *VGATemp = color; - - VGATemp++; + for (int i = 7; i >= 0; i--) { + if ((1 << i) & data) + *VGATemp = color; + VGATemp++; + } templeft -= 8; } else if (data) { diff --git a/engines/lab/text.h b/engines/lab/text.h index 944b363357..333f449203 100644 --- a/engines/lab/text.h +++ b/engines/lab/text.h @@ -52,7 +52,6 @@ struct TextFont { #pragma pack(pop) #endif -bool openFontMem(const char *TextFontPath, TextFont *tf, byte *fontbuffer); bool openFont(const char *TextFontPath, TextFont **tf); void closeFont(TextFont *tf); uint16 textLength(TextFont *tf, const char *text, uint16 numchars); -- cgit v1.2.3 From 77f4a10901d749b3e0f01c9ecde4948e8ceb65a5 Mon Sep 17 00:00:00 2001 From: Filippos Karapetis Date: Tue, 21 Jul 2015 21:55:15 +0300 Subject: LAB: Remove dead code --- engines/lab/allocroom.cpp | 4 ---- engines/lab/labfile.cpp | 41 +---------------------------------------- engines/lab/labfun.h | 3 --- engines/lab/map.cpp | 1 - engines/lab/undiff.cpp | 28 +--------------------------- 5 files changed, 2 insertions(+), 75 deletions(-) diff --git a/engines/lab/allocroom.cpp b/engines/lab/allocroom.cpp index e6dad3bc23..434a147d48 100644 --- a/engines/lab/allocroom.cpp +++ b/engines/lab/allocroom.cpp @@ -40,16 +40,12 @@ namespace Lab { #define MAXMARKERS 10 extern RoomData *Rooms; -extern uint16 ManyRooms; - typedef struct { uint16 RoomNum; void *Start0, *End0, *Start1, *End1; } RoomMarker; - - static RoomMarker RoomMarkers[MAXMARKERS]; static void *RoomBuffer = NULL; static uint16 CurMarker = 0; diff --git a/engines/lab/labfile.cpp b/engines/lab/labfile.cpp index dfb72571b2..231c63ab67 100644 --- a/engines/lab/labfile.cpp +++ b/engines/lab/labfile.cpp @@ -34,10 +34,6 @@ namespace Lab { -#define MAXREADSIZE 30720L -/* NOTE: set to 0 for non-CDTV machines. */ - - static byte *buffer = NULL, *realbufferstart = NULL, *startoffilestorage = NULL; @@ -46,16 +42,9 @@ static uint32 buffersize, realbuffersize; /*-------------------- Routines that buffer a whole file --------------------*/ - - -/*----- divides up and manages the buffer -----*/ - - - #define MAXMARKERS 15 - struct FileMarker { char name[32]; void *Start, *End; @@ -182,7 +171,6 @@ bool allocFile(void **Ptr, uint32 Size, const char *fileName) { /*****************************************************************************/ byte **openFile(const char *name, uint32 &size) { byte *buf; - Common::File file; file.open(translateFileName(name)); @@ -195,10 +183,8 @@ byte **openFile(const char *name, uint32 &size) { size = file.size(); buf = (byte *)malloc(size); - - if (!buf) { + if (!buf) error("Unable to allocate %d bytes file file %s", size, name); - } *startoffile = buf; @@ -208,7 +194,6 @@ byte **openFile(const char *name, uint32 &size) { } - /*****************************************************************************/ /* Reads a block of memory. */ /*****************************************************************************/ @@ -217,30 +202,6 @@ void readBlock(void *Buffer, uint32 Size, byte **File) { (*File) += Size; } - - -/*****************************************************************************/ -/* Reads on character. */ -/*****************************************************************************/ -char readChar(char **File) { - char c = **File; - - (*File)++; - return c; -} - - - - -/*****************************************************************************/ -/* Skips a chunk of memory. */ -/*****************************************************************************/ -void skip(byte **File, uint32 skip) { - (*File) += skip; -} - - - /*****************************************************************************/ /* Resets the internal buffers to empty. */ /*****************************************************************************/ diff --git a/engines/lab/labfun.h b/engines/lab/labfun.h index ea0d3c8c48..9655c24691 100644 --- a/engines/lab/labfun.h +++ b/engines/lab/labfun.h @@ -140,8 +140,6 @@ bool quitPlaying(); byte **isBuffered(const char *fileName); byte **openFile(const char *name, uint32 &size); void readBlock(void *Buffer, uint32 Size, byte **File); -char readChar(char **File); -void skip(byte **File, uint32 skip); void resetBuffer(); bool initBuffer(uint32 BufSize, bool IsGraphicsMem); void freeBuffer(); @@ -280,7 +278,6 @@ void showCombination(const char *filename); void mouseCombination(uint16 x, uint16 y); void showTile(const char *filename, bool showsolution); void mouseTile(uint16 x, uint16 y); -void inner_main(); } // End of namespace Lab diff --git a/engines/lab/map.cpp b/engines/lab/map.cpp index cb51a51fff..a3cae9b841 100644 --- a/engines/lab/map.cpp +++ b/engines/lab/map.cpp @@ -163,7 +163,6 @@ void readImage(byte **buffer, Image **im) { /*---------------------------------------------------------------------------*/ extern RoomData *Rooms; -extern const char *ViewPath; static Image *Map, *Room, *UpArrowRoom, *DownArrowRoom, *Bridge, *HRoom, *VRoom, *Maze, *HugeMaze, *Path, *MapNorth, diff --git a/engines/lab/undiff.cpp b/engines/lab/undiff.cpp index bc4eacc603..d9d53a3031 100644 --- a/engines/lab/undiff.cpp +++ b/engines/lab/undiff.cpp @@ -322,39 +322,13 @@ bool VUnDIFFMemory(byte *Dest, byte *diff, uint16 HeaderSize, uint16 CopySize, u else return false; - } - /* - else if (HeaderSize == 2) - { - if (CopySize == 1) - VUnDIFFWordByte(Dest, diff, bytesperrow); - - else if (CopySize == 2) - VUnDIFFWordWord(Dest, diff, bytesperrow); - - else if (CopySize == 4) - VUnDIFFWordLong(Dest, diff, bytesperrow); - - else - return false; - } - */ - else + } else return (false); return true; } - - - -/*---------------------------- Runlength Decodes ----------------------------*/ - - - - - /*****************************************************************************/ /* Runlength decodes a chunk of memory. */ /*****************************************************************************/ -- cgit v1.2.3 From b1eb345f8076806ce73cd41ecae51b14be121a34 Mon Sep 17 00:00:00 2001 From: Filippos Karapetis Date: Tue, 21 Jul 2015 21:57:55 +0300 Subject: LAB: Move some static variables to the top. Some cleanup --- engines/lab/savegame.cpp | 3 +-- engines/lab/text.cpp | 12 +++--------- engines/lab/vga.cpp | 13 ++++--------- 3 files changed, 8 insertions(+), 20 deletions(-) diff --git a/engines/lab/savegame.cpp b/engines/lab/savegame.cpp index 4d40540ce4..a32971ba5f 100644 --- a/engines/lab/savegame.cpp +++ b/engines/lab/savegame.cpp @@ -58,6 +58,7 @@ extern CrumbData BreadCrumbs[MAX_CRUMBS]; extern uint16 NumCrumbs; extern bool DroppingCrumbs; extern bool FollowingCrumbs; +extern char *getPictName(CloseDataPtr *LCPtr); void writeSaveGameHeader(Common::OutSaveFile *out, const Common::String &saveName) { out->writeUint32BE(SAVEGAME_ID); @@ -128,8 +129,6 @@ bool readSaveGameHeader(Common::InSaveFile *in, SaveGameHeader &header) { return true; } -extern char *getPictName(CloseDataPtr *LCPtr); - /*****************************************************************************/ /* Writes the game out to disk. */ /*****************************************************************************/ diff --git a/engines/lab/text.cpp b/engines/lab/text.cpp index 5120a19a5c..e99114ecda 100644 --- a/engines/lab/text.cpp +++ b/engines/lab/text.cpp @@ -35,6 +35,8 @@ namespace Lab { +extern uint32 VGAScreenWidth, VGABytesPerPage; + /*****************************************************************************/ /* Opens up a font from disk. */ /*****************************************************************************/ @@ -59,7 +61,7 @@ bool openFont(const char *TextFontPath, struct TextFont **tf) { readBlock((*tf)->Offsets, 256L * 2L, file); swapUShortPtr((*tf)->Offsets, 256); - skip(file, 4L); + (*file) += 4; if (((*tf)->data = (byte *)calloc((*tf)->DataLength, 1))) { readBlock((*tf)->data, (*tf)->DataLength, file); @@ -75,7 +77,6 @@ bool openFont(const char *TextFontPath, struct TextFont **tf) { return false; } - /*****************************************************************************/ /* Closes a font and frees all memory associated with it. */ /*****************************************************************************/ @@ -88,8 +89,6 @@ void closeFont(struct TextFont *tf) { } } - - /*****************************************************************************/ /* Returns the length of a text in the specified font. */ /*****************************************************************************/ @@ -114,11 +113,6 @@ uint16 textHeight(struct TextFont *tf) { return (tf) ? tf->Height : 0; } - - -extern uint32 VGAScreenWidth, VGABytesPerPage; - - /*****************************************************************************/ /* Draws the text to the screen. */ /*****************************************************************************/ diff --git a/engines/lab/vga.cpp b/engines/lab/vga.cpp index 31477a78e9..7b745760c4 100644 --- a/engines/lab/vga.cpp +++ b/engines/lab/vga.cpp @@ -38,6 +38,9 @@ namespace Lab { +static byte curvgapal[256 * 3]; +static unsigned char curapen = 0; + uint32 VGAScreenWidth = 320UL, VGAScreenHeight = 200UL, VGABytesPerPage = 65536UL; @@ -58,6 +61,7 @@ uint16 g_NextKeyIn = 0; uint16 g_KeyBuf[64]; uint16 g_NextKeyOut = 0; bool g_MouseAtEdge = false; +byte *TempScrollData; /*****************************************************************************/ /* Sets up either a low-res or a high-res 256 color screen. */ @@ -245,8 +249,6 @@ void WSDL_SetColors(byte *buf, uint16 first, uint16 numreg, uint16 slow) { waitTOF(); } -static byte curvgapal[256 * 3]; - /*****************************************************************************/ /* Writes any number of the 256 color registers. */ /* first: the number of the first color register to write. */ @@ -467,9 +469,6 @@ void readScreenImage(Image *Im, uint16 x, uint16 y) { } } - - - /*****************************************************************************/ /* Blits a piece of one image to another. */ /* NOTE: for our purposes, assumes that ImDest is to be in VGA memory. */ @@ -515,8 +514,6 @@ void bltBitMap(Image *ImSource, uint16 xs, uint16 ys, Image *ImDest, } } -byte *TempScrollData; - /*****************************************************************************/ /* Scrolls the display in the x direction by blitting. */ /* The TempScrollData variable must be initialized to some memory, or this */ @@ -603,8 +600,6 @@ void scrollDisplayY(int16 dy, uint16 x1, uint16 y1, uint16 x2, uint16 y2) { } } -static unsigned char curapen = 0; - /*****************************************************************************/ /* Sets the pen number to use on all the drawing operations. */ /*****************************************************************************/ -- cgit v1.2.3 From da0ee48ab941185749f639e884b79e9892dfca82 Mon Sep 17 00:00:00 2001 From: Filippos Karapetis Date: Tue, 21 Jul 2015 22:01:50 +0300 Subject: LAB: Remove the fillUpMusic() and checkMusic() wrappers. Some cleanup --- engines/lab/intro.cpp | 48 +++++++++++++++++++----------------------------- engines/lab/map.cpp | 14 +++++++------- 2 files changed, 26 insertions(+), 36 deletions(-) diff --git a/engines/lab/intro.cpp b/engines/lab/intro.cpp index c430b61058..16a54ff53f 100644 --- a/engines/lab/intro.cpp +++ b/engines/lab/intro.cpp @@ -39,25 +39,13 @@ namespace Lab { static TextFont filler, *msgfont = &filler; +static bool QuitIntro = false, IntroDoBlack; -extern bool nopalchange, hidemouse, DoBlack, NoFlip, IsHiRes; - +extern bool nopalchange, DoBlack, IsHiRes; extern char diffcmap[256 * 3]; - extern uint32 VGAScreenWidth, VGAScreenHeight; - - extern uint16 *FadePalette; -static uint16 Palette[16] = { - 0x0000, 0x0855, 0x0FF9, 0x0EE7, 0x0ED5, 0x0DB4, 0x0CA2, 0x0C91, 0x0B80, 0x0B80, 0x0B91, 0x0CA2, 0x0CB3, 0x0DC4, 0x0DD6, 0x0EE7 -}; - - -static bool QuitIntro = false, IntroDoBlack; -extern int32 longcharsdrawn; - - /******************************************************************************/ /* Goes thru, and responds to all the intuition messages currently in the */ @@ -105,10 +93,10 @@ static void doPictText(const char *Filename, bool isscreen) { strcat(filename, Filename); if (isscreen) { - g_music->fillUpMusic(true); + g_music->updateMusic(); timedelay = 35; } else { - g_music->checkMusic(); + g_music->updateMusic(); timedelay = 7; } @@ -160,7 +148,7 @@ static void doPictText(const char *Filename, bool isscreen) { Msg = getMsg(); if (Msg == NULL) { - g_music->checkMusic(); + g_music->updateMusic(); diffNextFrame(); getTime(&secs, µs); @@ -235,13 +223,13 @@ static void doPictText(const char *Filename, bool isscreen) { void musicDelay() { int16 counter; - g_music->checkMusic(); + g_music->updateMusic(); if (QuitIntro) return; for (counter = 0; counter < 20; counter++) { - g_music->checkMusic(); + g_music->updateMusic(); waitTOF(); waitTOF(); waitTOF(); @@ -253,7 +241,7 @@ void musicDelay() { static void NReadPict(const char *Filename, bool PlayOnce) { Common::String finalFileName = "P:Intro/"; - g_music->checkMusic(); + g_music->updateMusic(); introEatMessages(); if (QuitIntro) @@ -272,6 +260,10 @@ static void NReadPict(const char *Filename, bool PlayOnce) { /*****************************************************************************/ void introSequence() { uint16 counter, counter1; + + uint16 Palette[16] = { + 0x0000, 0x0855, 0x0FF9, 0x0EE7, 0x0ED5, 0x0DB4, 0x0CA2, 0x0C91, 0x0B80, 0x0B80, 0x0B91, 0x0CA2, 0x0CB3, 0x0DC4, 0x0DD6, 0x0EE7 + }; DoBlack = true; @@ -313,14 +305,14 @@ void introSequence() { (diffcmap[counter * 3 + 2] >> 2); } - g_music->checkMusic(); + g_music->updateMusic(); fade(true, 0); for (int times = 0; times < 150; times++) { if (QuitIntro) break; - g_music->checkMusic(); + g_music->updateMusic(); uint16 temp = Palette[2]; for (counter = 2; counter < 15; counter++) @@ -335,7 +327,7 @@ void introSequence() { fade(false, 0); blackAllScreen(); - g_music->checkMusic(); + g_music->updateMusic(); NReadPict("Title.A", true); NReadPict("AB", true); @@ -359,9 +351,9 @@ void introSequence() { g_music->newOpen("p:Intro/Intro.1"); /* load the picture into the buffer */ - g_music->checkMusic(); + g_music->updateMusic(); blackAllScreen(); - g_music->fillUpMusic(true); + g_music->updateMusic(); getFont("P:Map.fon", msgfont); @@ -382,7 +374,7 @@ void introSequence() { freeAllStolenMem(); blackAllScreen(); - g_music->fillUpMusic(true); + g_music->updateMusic(); IntroDoBlack = true; NReadPict("Station1", true); @@ -414,7 +406,7 @@ void introSequence() { for (counter1 = (8 * 3); counter1 < (255 * 3); counter1++) diffcmap[counter1] = 255 - diffcmap[counter1]; - g_music->checkMusic(); + g_music->updateMusic(); waitTOF(); VGASetPal(diffcmap, 256); waitTOF(); @@ -479,8 +471,6 @@ void introSequence() { rectFill(0, 0, VGAScreenWidth - 1, VGAScreenHeight - 1); DoBlack = true; } - - hidemouse = false; } } // End of namespace Lab diff --git a/engines/lab/map.cpp b/engines/lab/map.cpp index a3cae9b841..3b2eaf67f5 100644 --- a/engines/lab/map.cpp +++ b/engines/lab/map.cpp @@ -83,7 +83,7 @@ bool getFont(const char *filename, TextFont *textfont) { uint32 filesize, headersize = 4L + 2L + 256 * 3 + 4L; file = g_music->newOpen(filename, filesize); - g_music->checkMusic(); + g_music->updateMusic(); if ((file != NULL) && (filesize > headersize)) { byte *fontbuffer = (byte *)stealBufMem(filesize - (sizeof(TextFont) + 4)); @@ -102,7 +102,7 @@ bool getFont(const char *filename, TextFont *textfont) { readBlock(textfont->Offsets, 256L * 2L, file); swapUShortPtr(textfont->Offsets, 256); - skip(file, 4L); + (*file) += 4; textfont->data = fontbuffer; readBlock(textfont->data, textfont->DataLength, file); return true; @@ -120,7 +120,7 @@ char *getText(const char *filename) { bool dodecrypt; byte **tfile; - g_music->checkMusic(); + g_music->updateMusic(); dodecrypt = (isBuffered(filename) == NULL); tfile = g_music->newOpen(filename); @@ -624,7 +624,7 @@ static void drawMap(uint16 CurRoom, uint16 CurMsg, uint16 Floor, bool fadeout, b && g_lab->_roomsFound->in(drawroom) && Maps[drawroom].x) { drawRoom(drawroom, (bool)(drawroom == CurRoom)); - g_music->checkMusic(); + g_music->updateMusic(); } } @@ -729,11 +729,11 @@ void processMap(uint16 CurRoom) { CurFloor = Maps[CurRoom].PageNumber; while (1) { - g_music->checkMusic(); /* Make sure we check the music at least after every message */ + g_music->updateMusic(); /* Make sure we check the music at least after every message */ Msg = getMsg(); if (Msg == NULL) { - g_music->checkMusic(); + g_music->updateMusic(); if (place <= 14) { newcolor[0] = 14 << 2; @@ -893,7 +893,7 @@ void processMap(uint16 CurRoom) { void doMap(uint16 CurRoom) { FadePalette = AmigaMapPalette; - g_music->checkMusic(); + g_music->updateMusic(); loadMapData(); blackAllScreen(); -- cgit v1.2.3 From 75882daa498618bba82fe9494f6d7b803e5e8c46 Mon Sep 17 00:00:00 2001 From: Filippos Karapetis Date: Tue, 21 Jul 2015 22:02:52 +0300 Subject: LAB: Simplify decrypt() --- engines/lab/labtext.cpp | 8 ++------ 1 file changed, 2 insertions(+), 6 deletions(-) diff --git a/engines/lab/labtext.cpp b/engines/lab/labtext.cpp index 4284865847..568ad828bf 100644 --- a/engines/lab/labtext.cpp +++ b/engines/lab/labtext.cpp @@ -154,12 +154,8 @@ void freeLabText() { /* Decrypts a chunk of text. */ /*****************************************************************************/ void decrypt(byte *text) { - if (text == NULL) - return; - - while (*text != '\0') { - (*text) -= (byte)95; - text++; + while (text && *text != '\0') { + *text++ -= (byte)95; } } -- cgit v1.2.3 From df3200ef0c0bc590f03888a26e49e52da51d53ce Mon Sep 17 00:00:00 2001 From: Filippos Karapetis Date: Tue, 21 Jul 2015 22:06:23 +0300 Subject: LAB: Simplify readViews() --- engines/lab/map.cpp | 2 +- engines/lab/parsefun.h | 2 +- engines/lab/processroom.cpp | 10 ++++------ 3 files changed, 6 insertions(+), 8 deletions(-) diff --git a/engines/lab/map.cpp b/engines/lab/map.cpp index 3b2eaf67f5..2e3dffc943 100644 --- a/engines/lab/map.cpp +++ b/engines/lab/map.cpp @@ -855,7 +855,7 @@ void processMap(uint16 CurRoom) { if (OldMsg != CurMsg) { if (Rooms[CurMsg].RoomMsg == NULL) - readViews(CurMsg, ViewPath); + readViews(CurMsg); if ((sptr = Rooms[CurMsg].RoomMsg)) { mouseHide(); diff --git a/engines/lab/parsefun.h b/engines/lab/parsefun.h index f5929ae306..b75368d25d 100644 --- a/engines/lab/parsefun.h +++ b/engines/lab/parsefun.h @@ -52,7 +52,7 @@ void allocRoom(void **Ptr, uint16 Size, uint16 RoomNum); bool readRoomData(const char *fileName); bool readInventory(const char *fileName); -bool readViews(uint16 RoomNum, const char *Path); +bool readViews(uint16 RoomNum); /* From ProcessRoom.c */ diff --git a/engines/lab/processroom.cpp b/engines/lab/processroom.cpp index 9d501e6b57..c6acf36a32 100644 --- a/engines/lab/processroom.cpp +++ b/engines/lab/processroom.cpp @@ -116,7 +116,7 @@ ViewDataPtr getViewData(uint16 roomNum, uint16 direction) { VPtr = &Rooms[roomNum].WestView; if (*VPtr == NULL) - readViews(roomNum, ViewPath); + readViews(roomNum); ViewPtr = *VPtr; @@ -187,9 +187,7 @@ static CloseDataPtr findCPtrMatch(CloseDataPtr Main, CloseDataPtr List) { /* Returns the current picture name. */ /*****************************************************************************/ char *getPictName(CloseDataPtr *LCPtr) { - ViewDataPtr ViewPtr; - - ViewPtr = getViewData(RoomNum, Direction); + ViewDataPtr ViewPtr = getViewData(RoomNum, Direction); if (*LCPtr != NULL) { *LCPtr = findCPtrMatch(*LCPtr, ViewPtr->closeUps); @@ -675,7 +673,7 @@ static bool doActionRuleSub(int16 action, int16 roomNum, CloseDataPtr LCPtr, Clo RPtr = Rooms[roomNum].RuleList; if ((RPtr == NULL) && (roomNum == 0)) { - readViews(roomNum, ViewPath); + readViews(roomNum); RPtr = Rooms[roomNum].RuleList; } @@ -737,7 +735,7 @@ static bool doOperateRuleSub(int16 ItemNum, int16 roomNum, CloseDataPtr LCPtr, C RPtr = Rooms[roomNum].RuleList; if ((RPtr == NULL) && (roomNum == 0)) { - readViews(roomNum, ViewPath); + readViews(roomNum); RPtr = Rooms[roomNum].RuleList; } -- cgit v1.2.3 From 524d30ee169046440696fe5861a3bcee9b7dabea Mon Sep 17 00:00:00 2001 From: Filippos Karapetis Date: Tue, 21 Jul 2015 22:07:03 +0300 Subject: LAB: Cleanup --- engines/lab/parsetypes.h | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/engines/lab/parsetypes.h b/engines/lab/parsetypes.h index c40975007a..0f9ec50315 100644 --- a/engines/lab/parsetypes.h +++ b/engines/lab/parsetypes.h @@ -201,10 +201,10 @@ struct MapData { #pragma pack(pop) #endif -typedef struct { +struct CrumbData { uint16 RoomNum; uint16 Direction; -} CrumbData; +}; #define MAX_CRUMBS 128 -- cgit v1.2.3 From eae0773b41143bd0bca7280d62e98c4baf78ab0d Mon Sep 17 00:00:00 2001 From: Filippos Karapetis Date: Tue, 21 Jul 2015 22:09:00 +0300 Subject: LAB: Move more static variables to the top --- engines/lab/special.cpp | 214 ++++++++++++------------------------------------ 1 file changed, 53 insertions(+), 161 deletions(-) diff --git a/engines/lab/special.cpp b/engines/lab/special.cpp index 57f328451d..2cd383d03d 100644 --- a/engines/lab/special.cpp +++ b/engines/lab/special.cpp @@ -47,26 +47,69 @@ namespace Lab { -extern bool nopalchange, DoBlack, IsHiRes; - -extern BitMap *DispBitMap, *DrawBitMap; -extern char diffcmap[3 * 256]; +static uint16 MonGadHeight = 1; +static uint16 hipal[20]; -extern uint32 VGAScreenWidth, VGAScreenHeight; +// Combination lock rules +static Image *Images[10]; +byte combination[6] = { 0, 0, 0, 0, 0, 0 }, solution[] = { 0, 4, 0, 8, 7, 2 }; +static uint16 combx[] = { 45, 83, 129, 166, 211, 248 }; +static TextFont *BigMsgFont; +static TextFont bmfont; +static char *journaltext, *journaltexttitle; +static uint16 JPage = 0; +static bool lastpage = false; +static Image *JCancel, *JCancelAlt, *JLeft, *JLeftAlt, *JRight, *JRightAlt, JBackImage, ScreenImage; +static uint16 JGadX[3] = { 80, 144, 194 }, JGadY[3] = { 162, 164, 162 }; +static Gadget ForwardG, CancelG, BackG; +static bool GotBackImage = false; +static uint16 monpage; +static const char *TextFileName; -#define COMBINATIONUNLOCKED 130 -#define BRICKOPEN 115 +Image *MonButton, *AltMonButton, *MonQuit, *AltMonQuit, *MonBack, *AltMonBack, +*MonDown, *AltMonDown, *MonUp, *AltMonUp; +// Tile puzzle rules +Image *Tiles[16]; +uint16 CurTile[4][4] = { + { 1, 5, 9, 13 }, + { 2, 6, 10, 14 }, + { 3, 7, 11, 15 }, + { 4, 8, 12, 0 } +}, TileSolution[4][4] = { + { 7, 1, 8, 3 }, + { 2, 11, 15, 4 }, + { 9, 5, 14, 6 }, + { 10, 13, 12, 0 } +}; -static uint16 hipal[20]; +extern TextFont *MsgFont; extern uint16 *FadePalette; +extern bool nopalchange, DoBlack, IsHiRes; +extern BitMap *DispBitMap, *DrawBitMap; +extern char diffcmap[3 * 256]; +extern uint32 VGAScreenWidth, VGAScreenHeight; +extern byte *TempScrollData; +extern CloseDataPtr CPtr; +extern InventoryData *Inventory; +extern uint16 RoomNum, Direction; +#define COMBINATIONUNLOCKED 130 +#define BRICKOPEN 115 #define INCL(BITSET,BIT) ((BITSET) |= (BIT)) - #define SETBIT(BITSET,BITNUM) INCL(BITSET, (1 << (BITNUM))) - #define INBIT(BITSET,BITNUM) ( ((1 << (BITNUM)) & (BITSET)) > 0 ) +#define LEFTSCROLL 1 +#define RIGHTSCROLL 2 +#define UPSCROLL 3 +#define DOWNSCROLL 4 +#define BRIDGE0 148 +#define BRIDGE1 104 +#define DIRTY 175 +#define NONEWS 135 +#define NOCLEAN 152 +#define QUARTERNUM 30 static byte *loadBackPict(const char *fileName, bool tomem) { @@ -92,24 +135,6 @@ static byte *loadBackPict(const char *fileName, bool tomem) { return res; } - - -/*----------------------------------------------------------------------------*/ -/*-------------------------- Combination Lock Rules --------------------------*/ -/*----------------------------------------------------------------------------*/ - - - - -static Image *Images[10]; - - -byte combination[6] = {0, 0, 0, 0, 0, 0}, solution[] = {0, 4, 0, 8, 7, 2}; - -static uint16 combx[] = {45, 83, 129, 166, 211, 248}; - - - /*****************************************************************************/ /* Draws the images of the combination lock to the display bitmap. */ /*****************************************************************************/ @@ -120,9 +145,6 @@ static void doCombination() { drawImage(Images[combination[counter]], VGAScaleX(combx[counter]), VGAScaleY(65)); } - -extern byte *TempScrollData; - /*****************************************************************************/ /* Reads in a backdrop picture. */ /*****************************************************************************/ @@ -197,9 +219,6 @@ static void changeCombination(uint16 number) { } - - - /*****************************************************************************/ /* Processes mouse clicks and changes the combination. */ /*****************************************************************************/ @@ -229,26 +248,6 @@ void mouseCombination(uint16 x, uint16 y) { } } - - -/*----------------------------------------------------------------------------*/ -/*----------------------------- Tile Puzzle Rules ----------------------------*/ -/*----------------------------------------------------------------------------*/ - -Image *Tiles[16]; -uint16 CurTile[4] [4] = { - { 1, 5, 9, 13 }, - { 2, 6, 10, 14 }, - { 3, 7, 11, 15 }, - { 4, 8, 12, 0 } -}, TileSolution[4] [4] = { - { 7, 1, 8, 3 }, - { 2, 11, 15, 4 }, - { 9, 5, 14, 6 }, - { 10, 13, 12, 0} -}; - - /*****************************************************************************/ /* Draws the images of the combination lock to the display bitmap. */ /*****************************************************************************/ @@ -291,9 +290,6 @@ static void doTile(bool showsolution) { } } - - - /*****************************************************************************/ /* Reads in a backdrop picture. */ /*****************************************************************************/ @@ -329,16 +325,6 @@ void showTile(const char *filename, bool showsolution) { VGASetPal(diffcmap, 256); } - - -#define LEFTSCROLL 1 -#define RIGHTSCROLL 2 -#define UPSCROLL 3 -#define DOWNSCROLL 4 - - - - static void scrollRaster(int16 dx, int16 dy, uint16 x1, uint16 y1, uint16 x2, uint16 y2) { if (dx) scrollDisplayX(dx, x1, y1, x2, y2); @@ -347,9 +333,6 @@ static void scrollRaster(int16 dx, int16 dy, uint16 x1, uint16 y1, uint16 x2, ui scrollDisplayY(dy, x1, y1, x2, y2); } - - - /*****************************************************************************/ /* Does the scrolling for the tiles on the tile puzzle. */ /*****************************************************************************/ @@ -391,8 +374,6 @@ static void doTileScroll(uint16 col, uint16 row, uint16 scrolltype) { } } - - /*****************************************************************************/ /* Changes the combination number of one of the slots */ /*****************************************************************************/ @@ -468,9 +449,6 @@ static void changeTile(uint16 col, uint16 row) { } - - - /*****************************************************************************/ /* Processes mouse clicks and changes the combination. */ /*****************************************************************************/ @@ -489,15 +467,6 @@ void mouseTile(uint16 x, uint16 y) { } -/*---------------------------------------------------------------------------*/ -/*------------------------ Does the detective notes. ------------------------*/ -/*---------------------------------------------------------------------------*/ - -extern TextFont *MsgFont; -static TextFont *BigMsgFont; -static TextFont bmfont; - - /*****************************************************************************/ /* Does the things to properly set up the detective notes. */ /*****************************************************************************/ @@ -522,14 +491,6 @@ void doNotes() { } - - -/*---------------------------------------------------------------------------*/ -/*---------------------- Does the Old West newspaper. ----------------------*/ -/*---------------------------------------------------------------------------*/ - - - /*****************************************************************************/ /* Does the things to properly set up the old west newspaper. Assumes that */ /* OpenHiRes already called. */ @@ -591,34 +552,6 @@ void doWestPaper() { freeAllStolenMem(); } - - - -/*---------------------------------------------------------------------------*/ -/*---------------------------- The Journal stuff ----------------------------*/ -/*---------------------------------------------------------------------------*/ - - -#define BRIDGE0 148 -#define BRIDGE1 104 -#define DIRTY 175 -#define NONEWS 135 -#define NOCLEAN 152 - - -static char *journaltext, *journaltexttitle; -static uint16 JPage = 0; - -static bool lastpage = false; - -static Image *JCancel, *JCancelAlt, *JLeft, *JLeftAlt, *JRight, *JRightAlt, JBackImage, ScreenImage; - -static uint16 JGadX[3] = {80, 144, 194}, JGadY[3] = {162, 164, 162}; -static Gadget ForwardG, CancelG, BackG; - - - - /*****************************************************************************/ /* Loads in the data for the journal. */ /*****************************************************************************/ @@ -710,8 +643,6 @@ static bool loadJournalData() { return true; } - - /*****************************************************************************/ /* Draws the text to the back journal screen to the appropriate Page number */ /*****************************************************************************/ @@ -750,9 +681,6 @@ static void drawJournalText() { lastpage = lastpage || (*CurText == 0); } - - - /*****************************************************************************/ /* Does the turn page wipe. */ /*****************************************************************************/ @@ -777,9 +705,6 @@ static void turnPage(bool FromLeft) { } - -static bool GotBackImage = false; - /*****************************************************************************/ /* Draws the journal from page x. */ /*****************************************************************************/ @@ -826,9 +751,6 @@ static void drawJournal(uint16 wipenum, bool needFade) { nopalchange = false; } - - - /*****************************************************************************/ /* Processes user input. */ /*****************************************************************************/ @@ -871,8 +793,6 @@ static void processJournal() { } } - - /*****************************************************************************/ /* Does the journal processing. */ /*****************************************************************************/ @@ -916,11 +836,6 @@ void doJournal() { ungetVGABaseAddr(); } -#define QUARTERNUM 30 - -extern InventoryData *Inventory; -extern uint16 RoomNum, Direction; - bool saveRestoreGame() { bool isOK = false; @@ -961,23 +876,6 @@ bool saveRestoreGame() { return isOK; } -/*---------------------------------------------------------------------------*/ -/*--------------------------- The Monitors stuff ----------------------------*/ -/*---------------------------------------------------------------------------*/ - - -extern CloseDataPtr CPtr; - -static uint16 monpage; -static const char *TextFileName; - - -Image *MonButton, *AltMonButton, *MonQuit, *AltMonQuit, *MonBack, *AltMonBack, - *MonDown, *AltMonDown, *MonUp, *AltMonUp; - - - - /*****************************************************************************/ /* Makes sure that the buttons are in memory. */ /*****************************************************************************/ @@ -998,9 +896,6 @@ static void getMonImages() { } -static uint16 MonGadHeight = 1; - - /*****************************************************************************/ /* Draws the text for the monitor. */ /*****************************************************************************/ @@ -1154,9 +1049,6 @@ static void processMonitor(char *ntext, bool isinteractive, uint16 x1, uint16 y1 } } - - - /*****************************************************************************/ /* Does what's necessary for the monitor. */ /*****************************************************************************/ -- cgit v1.2.3 From 8bf15cbe4bfda68dd38dbb4ed44a269f57f93b5a Mon Sep 17 00:00:00 2001 From: Filippos Karapetis Date: Tue, 21 Jul 2015 22:09:43 +0300 Subject: LAB: Replace more calls to checkMusic() --- engines/lab/special.cpp | 24 ++++++++++++------------ 1 file changed, 12 insertions(+), 12 deletions(-) diff --git a/engines/lab/special.cpp b/engines/lab/special.cpp index 2cd383d03d..4d64dd3914 100644 --- a/engines/lab/special.cpp +++ b/engines/lab/special.cpp @@ -569,7 +569,7 @@ static bool loadJournalData() { return false; } - g_music->checkMusic(); + g_music->updateMusic(); strcpy(filename, "Lab:Rooms/j0"); bridge = g_lab->_conditions->in(BRIDGE0) || g_lab->_conditions->in(BRIDGE1); @@ -652,7 +652,7 @@ static void drawJournalText() { char *CurText = journaltext; while (DrawingToPage < JPage) { - g_music->checkMusic(); + g_music->updateMusic(); CurText = (char *)(journaltext + CharsDrawn); CharsDrawn += flowText(BigMsgFont, -2, 2, 0, false, false, false, false, VGAScaleX(52), VGAScaleY(32), VGAScaleX(152), VGAScaleY(148), CurText); @@ -672,7 +672,7 @@ static void drawJournalText() { CharsDrawn += flowTextToMem(&JBackImage, BigMsgFont, -2, 2, 0, false, false, false, true, VGAScaleX(52), VGAScaleY(32), VGAScaleX(152), VGAScaleY(148), CurText); } - g_music->checkMusic(); + g_music->updateMusic(); CurText = (char *)(journaltext + CharsDrawn); lastpage = (*CurText == 0); flowTextToMem(&JBackImage, BigMsgFont, -2, 2, 0, false, false, false, true, VGAScaleX(171), VGAScaleY(32), VGAScaleX(271), VGAScaleY(148), CurText); @@ -711,7 +711,7 @@ static void turnPage(bool FromLeft) { static void drawJournal(uint16 wipenum, bool needFade) { mouseHide(); - g_music->checkMusic(); + g_music->updateMusic(); if (!GotBackImage) JBackImage.ImageData = loadBackPict("P:Journal.pic", true); @@ -760,11 +760,11 @@ static void processJournal() { uint16 Qualifier, GadID; while (1) { - g_music->checkMusic(); /* Make sure we check the music at least after every message */ + g_music->updateMusic(); /* Make sure we check the music at least after every message */ Msg = (IntuiMessage *) getMsg(); if (Msg == NULL) { - g_music->checkMusic(); + g_music->updateMusic(); } else { Class = Msg->Class; Qualifier = Msg->Qualifier; @@ -813,7 +813,7 @@ void doJournal() { ScreenImage = JBackImage; ScreenImage.ImageData = getVGABaseAddr(); - g_music->checkMusic(); + g_music->updateMusic(); loadJournalData(); drawJournal(0, true); @@ -936,7 +936,7 @@ static void drawMonText(char *text, uint16 x1, uint16 y1, uint16 x2, uint16 y2, } while (DrawingToPage < monpage) { - g_music->checkMusic(); + g_music->updateMusic(); CurText = (char *)(text + CharsDrawn); CharsDrawn += flowText(BigMsgFont, yspacing, 0, 0, false, false, false, false, x1, y1, x2, y2, CurText); lastpage = (*CurText == 0); @@ -990,11 +990,11 @@ static void processMonitor(char *ntext, bool isinteractive, uint16 x1, uint16 y1 } } - g_music->checkMusic(); /* Make sure we check the music at least after every message */ + g_music->updateMusic(); /* Make sure we check the music at least after every message */ Msg = getMsg(); if (Msg == NULL) { - g_music->checkMusic(); + g_music->updateMusic(); } else { Class = Msg->Class; Qualifier = Msg->Qualifier; @@ -1122,11 +1122,11 @@ void doTrialBlock() { memcpy(g_CommonPalette, diffcmap, 3 * 256); while (1) { - g_music->checkMusic(); /* Make sure we check the music at least after every message */ + g_music->updateMusic(); /* Make sure we check the music at least after every message */ Msg = getMsg(); if (Msg == NULL) { - g_music->checkMusic(); + g_music->updateMusic(); } else { Class = Msg->Class; Qualifier = Msg->Qualifier; -- cgit v1.2.3 From c3bb54989c21faccf77ee151fd0c4b530bc12a97 Mon Sep 17 00:00:00 2001 From: Filippos Karapetis Date: Tue, 21 Jul 2015 22:10:30 +0300 Subject: LAB: Cleanup --- engines/lab/readparse.cpp | 44 ++++++++++++-------------------------------- 1 file changed, 12 insertions(+), 32 deletions(-) diff --git a/engines/lab/readparse.cpp b/engines/lab/readparse.cpp index 672688cac3..3d3c270c31 100644 --- a/engines/lab/readparse.cpp +++ b/engines/lab/readparse.cpp @@ -35,21 +35,17 @@ namespace Lab { +/* Global parser data */ + #define MAXSTRINGLENGTH 250 static bool UseMemory = false; - - - -/* Global parser data */ +static uint16 allocroom; extern RoomData *Rooms; extern InventoryData *Inventory; extern uint16 NumInv, ManyRooms, HighestCondition, Direction; -static uint16 allocroom; - - static bool rallocate(void **Ptr, uint32 Size) { if (UseMemory) return ((*Ptr = calloc(Size, 1)) != 0); @@ -104,8 +100,6 @@ bool readRoomData(const char *fileName) { } - - /*****************************************************************************/ /* Reads in a NULL terminated string, and allocates memory for it. */ /*****************************************************************************/ @@ -134,7 +128,6 @@ static bool readString(char **string, byte **file) { } - /*****************************************************************************/ /* Reads in the Inventory data. */ /*****************************************************************************/ @@ -244,8 +237,6 @@ static bool readCloseUps(CloseDataPtr *CPtr, uint16 depth, byte **file) { } - - /*****************************************************************************/ /* Reads in a View. */ /*****************************************************************************/ @@ -258,7 +249,7 @@ static bool readView(ViewDataPtr *VPtr, byte **file) { readBlock(&c, 1L, file); if (c == 1) { - if (rallocate((void **) VPtr, sizeof(viewData))) { + if (rallocate((void **)VPtr, sizeof(viewData))) { (*VPtr)->closeUps = NULL; (*VPtr)->NextCondition = NULL; @@ -273,16 +264,16 @@ static bool readView(ViewDataPtr *VPtr, byte **file) { readCloseUps(&((*VPtr)->closeUps), 0, file); VPtr = &((*VPtr)->NextCondition); - } else + } + else return false; - } else + } + else return true; } } - - /*****************************************************************************/ /* Reads in an Action. */ /*****************************************************************************/ @@ -321,9 +312,6 @@ static bool readAction(ActionPtr *APtr, byte **file) { } - - - /*****************************************************************************/ /* Reads in a rule. */ /*****************************************************************************/ @@ -355,14 +343,11 @@ static bool readRule(RulePtr *RPtr, byte **file) { } - - - /*****************************************************************************/ /* Reads in the views of a room. */ /*****************************************************************************/ -bool readViews(uint16 RoomNum, const char *Path) { - Common::String fileName = Common::String(Path) + Common::String::format("%d", RoomNum); +bool readViews(uint16 RoomNum) { + Common::String fileName = "LAB:Rooms/" + Common::String::format("%d", RoomNum); char Temp[10]; byte **file; @@ -378,19 +363,14 @@ bool readViews(uint16 RoomNum, const char *Path) { readString(&(Rooms[RoomNum].RoomMsg), file); readView(&Rooms[RoomNum].NorthView, file); - g_music->checkMusic(); - readView(&Rooms[RoomNum].SouthView, file); - g_music->checkMusic(); - readView(&Rooms[RoomNum].EastView, file); - g_music->checkMusic(); - readView(&Rooms[RoomNum].WestView, file); - g_music->checkMusic(); readRule(&Rooms[RoomNum].RuleList, file); + g_music->updateMusic(); + return true; } else return false; -- cgit v1.2.3 From c8b2745f7a960e1afc421782ac81fcddf81f6e60 Mon Sep 17 00:00:00 2001 From: Filippos Karapetis Date: Tue, 21 Jul 2015 22:13:28 +0300 Subject: LAB: Replace some more calls to checkMusic(). Some cleanup --- engines/lab/engine.cpp | 49 ++++++++++++++++++++++++++++--------------------- 1 file changed, 28 insertions(+), 21 deletions(-) diff --git a/engines/lab/engine.cpp b/engines/lab/engine.cpp index 8960464aeb..54050f2ffd 100644 --- a/engines/lab/engine.cpp +++ b/engines/lab/engine.cpp @@ -78,11 +78,7 @@ extern char *LAMPONMSG, *TURNLEFT, *TURNRIGHT; extern char *GOFORWARDDIR, *NOPATH, *TAKEITEM, *USEONWHAT, *TAKEWHAT, *MOVEWHAT, *OPENWHAT, *CLOSEWHAT, *LOOKWHAT, *NOTHING, *USEMAP, *USEJOURNAL, *TURNLAMPON, *TURNLAMPOFF, *USEWHISKEY, *USEPITH, *USEHELMET; -#define BIGBUFFERSIZE 850000L -#define SMALLBUFFERSIZE 250000L - -static uint32 BUFFERSIZE = BIGBUFFERSIZE; - +#define BUFFERSIZE 850000L /* LAB: Labyrinth specific code for the special puzzles */ #define SPECIALLOCK 100 @@ -444,25 +440,36 @@ static bool doCloseUp(CloseDataPtr cptr) { lutertmargin = 128; } - if ((cptr->CloseUpType == MUSEUMMONITOR) || (cptr->CloseUpType == LIBRARYMONITOR) || - (cptr->CloseUpType == WINDOWMONITOR)) + switch (cptr->CloseUpType) { + case MUSEUMMONITOR: + case LIBRARYMONITOR: + case WINDOWMONITOR: doMonitor(cptr->GraphicName, cptr->Message, false, monltmargin, montopmargin, monrtmargin, 165); - else if (cptr->CloseUpType == GRAMAPHONEMONITOR) + break; + case GRAMAPHONEMONITOR: doMonitor(cptr->GraphicName, cptr->Message, false, monltmargin, montopmargin, 171, 165); - else if (cptr->CloseUpType == UNICYCLEMONITOR) + break; + case UNICYCLEMONITOR: doMonitor(cptr->GraphicName, cptr->Message, false, 100, montopmargin, monrtmargin, 165); - else if (cptr->CloseUpType == STATUEMONITOR) + break; + case STATUEMONITOR: doMonitor(cptr->GraphicName, cptr->Message, false, 117, montopmargin, monrtmargin, 165); - else if (cptr->CloseUpType == TALISMANMONITOR) + break; + case TALISMANMONITOR: doMonitor(cptr->GraphicName, cptr->Message, false, monltmargin, montopmargin, 184, 165); - else if (cptr->CloseUpType == LUTEMONITOR) + break; + case LUTEMONITOR: doMonitor(cptr->GraphicName, cptr->Message, false, monltmargin, montopmargin, lutertmargin, 165); - else if (cptr->CloseUpType == CLOCKMONITOR) + break; + case CLOCKMONITOR: doMonitor(cptr->GraphicName, cptr->Message, false, monltmargin, montopmargin, 206, 165); - else if (cptr->CloseUpType == TERMINALMONITOR) + break; + case TERMINALMONITOR: doMonitor(cptr->GraphicName, cptr->Message, true, monltmargin, montopmargin, monrtmargin, 165); - else + break; + default: return false; + } CurFileName = " "; drawPanel(); @@ -778,14 +785,14 @@ static void mainGameLoop() { } } - g_music->checkMusic(); /* Make sure we check the music at least after every message */ + g_music->updateMusic(); /* Make sure we check the music at least after every message */ interfaceOn(); Msg = getMsg(); if (Msg == NULL) { /* Does music load and next animation frame when you've run out of messages */ GotMessage = false; checkRoomMusic(); - g_music->checkMusic(); + g_music->updateMusic(); diffNextFrame(); if (FollowingCrumbs) { @@ -885,11 +892,11 @@ from_crumbs: interfaceOff(); while (1) { - g_music->checkMusic(); /* Make sure we check the music at least after every message */ + g_music->updateMusic(); /* Make sure we check the music at least after every message */ Msg = getMsg(); if (Msg == NULL) { /* Does music load and next animation frame when you've run out of messages */ - g_music->checkMusic(); + g_music->updateMusic(); diffNextFrame(); } else { if (Msg->Class == RAWKEY) { @@ -1400,7 +1407,7 @@ void LabEngine::go() { readPict("P:End/L2In.1", true); for (counter = 0; counter < 120; counter++) { - g_music->checkMusic(); + g_music->updateMusic(); waitTOF(); } @@ -1409,7 +1416,7 @@ void LabEngine::go() { warning("STUB: waitForPress"); while (!1) { // 1 means ignore SDL_ProcessInput calls - g_music->checkMusic(); + g_music->updateMusic(); diffNextFrame(); waitTOF(); } -- cgit v1.2.3 From cb4b86cdb8e1a4f42ec87a09863d8e2f9b3a1f1a Mon Sep 17 00:00:00 2001 From: Filippos Karapetis Date: Tue, 21 Jul 2015 22:16:55 +0300 Subject: LAB: Replace more uses of checkMusic(). Some cleanup --- engines/lab/graphics.cpp | 22 +++++++++++----------- 1 file changed, 11 insertions(+), 11 deletions(-) diff --git a/engines/lab/graphics.cpp b/engines/lab/graphics.cpp index 7f949d6bdf..e2a221f7f4 100644 --- a/engines/lab/graphics.cpp +++ b/engines/lab/graphics.cpp @@ -44,8 +44,8 @@ BitMap bit1, bit2, *DispBitMap = &bit1, *DrawBitMap = &bit1; extern BitMap RawDiffBM; -extern char diffcmap[256 * 3], lastcmap[256 * 3]; -extern bool IsBM, NoFlip, nopalchange; +extern char diffcmap[256 * 3]; +extern bool IsBM, nopalchange; extern bool DoBlack, stopsound; extern bool IsHiRes; @@ -435,9 +435,9 @@ static void doScrollBlack() { Im.Width = width; Im.Height = height; Im.ImageData = mem; - g_music->fillUpMusic(true); + g_music->updateMusic(); readScreenImage(&Im, 0, 0); - g_music->fillUpMusic(true); + g_music->updateMusic(); BaseAddr = (uint32 *) getVGABaseAddr(); @@ -445,7 +445,7 @@ static void doScrollBlack() { nheight = height; while (nheight) { - g_music->checkMusic(); + g_music->updateMusic(); if (!IsHiRes) waitTOF(); @@ -547,7 +547,7 @@ static void doScrollWipe(char *filename) { height = VGAScaleY(149) + SVGACord(2); while (g_music->isSoundEffectActive()) { - g_music->checkMusic(); + g_music->updateMusic(); waitTOF(); } @@ -557,12 +557,12 @@ static void doScrollWipe(char *filename) { IsBM = false; mem = RawDiffBM.Planes[0]; - g_music->fillUpMusic(true); + g_music->updateMusic(); by = VGAScaleX(3); nheight = height; while (onrow < headerdata.y) { - g_music->checkMusic(); + g_music->updateMusic(); if ((by > nheight) && nheight) by = nheight; @@ -619,11 +619,11 @@ static void doScrollBounce() { int height = VGAScaleY(149) + SVGACord(2); byte *mem = RawDiffBM.Planes[0]; - g_music->fillUpMusic(true); + g_music->updateMusic(); int startline = headerdata.y - height - 1; for (int counter = 0; counter < 5; counter++) { - g_music->checkMusic(); + g_music->updateMusic(); startline -= newby[counter]; copyPage(width, height, 0, startline, mem); @@ -632,7 +632,7 @@ static void doScrollBounce() { } for (int counter = 8; counter > 0; counter--) { - g_music->checkMusic(); + g_music->updateMusic(); startline += newby1[counter - 1]; copyPage(width, height, 0, startline, mem); -- cgit v1.2.3 From e9f161b3aafb971f3682aa8d6a5647283d8239cf Mon Sep 17 00:00:00 2001 From: Filippos Karapetis Date: Tue, 21 Jul 2015 22:21:38 +0300 Subject: LAB: Clean up readSound(), readMusic() and longDrawMessage() --- engines/lab/diff.h | 2 +- engines/lab/graphics.cpp | 20 ++++++++------------ engines/lab/intro.cpp | 3 +-- engines/lab/labfun.h | 12 +++++++----- engines/lab/readdiff.cpp | 16 +++++----------- 5 files changed, 22 insertions(+), 31 deletions(-) diff --git a/engines/lab/diff.h b/engines/lab/diff.h index b5c84d3a93..614148e0de 100644 --- a/engines/lab/diff.h +++ b/engines/lab/diff.h @@ -74,7 +74,7 @@ void blackAllScreen(); void whiteScreen(); bool readDiff(bool playonce); void diffNextFrame(); -void readSound(); +void readSound(bool waitTillFinished); void stopDiff(); void stopDiffEnd(); void stopSound(); diff --git a/engines/lab/graphics.cpp b/engines/lab/graphics.cpp index e2a221f7f4..049053f470 100644 --- a/engines/lab/graphics.cpp +++ b/engines/lab/graphics.cpp @@ -97,17 +97,13 @@ bool readPict(const char *filename, bool PlayOnce) { /*****************************************************************************/ /* Reads in a music file. Ignores any graphics. */ /*****************************************************************************/ -bool readMusic(const char *filename) { - byte **file = NULL; - - file = g_music->newOpen(filename); - - if (file == NULL) { +bool readMusic(const char *filename, bool waitTillFinished) { + byte **file = g_music->newOpen(filename); + if (!file) return false; - } DoBlack = false; - readSound(); + readSound(waitTillFinished); return true; } @@ -346,14 +342,13 @@ void createBox(uint16 y2) { -int32 longcharsdrawn = 0L; bool LastMessageLong = false; -void longDrawMessage(const char *str) { +int32 longDrawMessage(const char *str) { char NewText[512]; if (str == NULL) - return; + return 0; attachGadgetList(NULL); mouseHide(); @@ -366,8 +361,9 @@ void longDrawMessage(const char *str) { } createBox(198); - longcharsdrawn = flowText(MsgFont, 0, 1, 7, false, true, true, true, VGAScaleX(6), VGAScaleY(155), VGAScaleX(313), VGAScaleY(195), str); mouseShow(); + + return flowText(MsgFont, 0, 1, 7, false, true, true, true, VGAScaleX(6), VGAScaleY(155), VGAScaleX(313), VGAScaleY(195), str); } diff --git a/engines/lab/intro.cpp b/engines/lab/intro.cpp index 16a54ff53f..5d5f6048ec 100644 --- a/engines/lab/intro.cpp +++ b/engines/lab/intro.cpp @@ -124,8 +124,7 @@ static void doPictText(const char *Filename, bool isscreen) { Drawn = flowText(msgfont, (!IsHiRes) * -1, 5, 7, false, false, true, true, VGAScaleX(14), VGAScaleY(11), VGAScaleX(306), VGAScaleY(189), (char *)curplace); fade(true, 0); } else { - longDrawMessage((char *)curplace); - Drawn = longcharsdrawn; + Drawn = longDrawMessage((char *)curplace); } curplace += Drawn; diff --git a/engines/lab/labfun.h b/engines/lab/labfun.h index 9655c24691..1db04a8c09 100644 --- a/engines/lab/labfun.h +++ b/engines/lab/labfun.h @@ -70,7 +70,7 @@ struct SaveGameHeader { /* Reads in pictures */ bool readPict(const char *filename, bool PlayOnce); -bool readMusic(const char *filename); +bool readMusic(const char *filename, bool waitTillFinished); byte *readPictToMem(const char *filename, uint16 x, uint16 y); /* Window text stuff */ @@ -98,7 +98,7 @@ uint32 flowTextToMem(Image *DestIm, void *font, /* the TextAttr pointer */ uint16 y1, uint16 x2, uint16 y2, const char *text); /* The text itself */ void drawMessage(const char *text); -void longDrawMessage(const char *text); +int32 longDrawMessage(const char *text); bool readFont(char *filename, void *font, void *data); /* The Wipes */ @@ -176,17 +176,16 @@ public: byte **newOpen(const char *name, uint32 &size); bool initMusic(); void freeMusic(); - void fillUpMusic(bool doit); void updateMusic(); uint16 getPlayingBufferCount(); - void checkMusic(); void closeMusic(); void setMusic(bool on); void resumeBackMusic(); void pauseBackMusic(); void changeMusic(const char *newmusic); + void checkRoomMusic(); void resetMusic(); - + void setMusicReset(bool reset) { _doReset = reset; } void playSoundEffect(uint16 SampleSpeed, uint32 Length, void *Data); void stopSoundEffect(); bool isSoundEffectActive() const; @@ -194,6 +193,9 @@ public: bool _winmusic, _doNotFilestopSoundEffect; bool _musicOn; bool _loopSoundEffect; + bool _waitTillFinished; + uint16 _lastMusicRoom ; + bool _doReset; private: void fillbuffer(byte *musicBuffer); diff --git a/engines/lab/readdiff.cpp b/engines/lab/readdiff.cpp index f2a39b41aa..ebf3d0793f 100644 --- a/engines/lab/readdiff.cpp +++ b/engines/lab/readdiff.cpp @@ -158,7 +158,7 @@ void diffNextFrame() { if (CurBit >= numchunks) { mouseShow(); - if (!NoFlip && !IsBM) { + if (!IsBM) { if (headerdata.fps) { waitForTime(WaitSec, WaitMicros); addCurTime(0L, DelayMicros, &WaitSec, &WaitMicros); @@ -451,14 +451,13 @@ void stopDiffEnd() { StopPlayingEnd = true; while (IsPlaying) { - g_music->checkMusic(); + g_music->updateMusic(); diffNextFrame(); } } } - /*****************************************************************************/ /* Stops the continuous sound from playing. */ /*****************************************************************************/ @@ -466,8 +465,6 @@ void stopSound() { stopsound = true; } - - /*****************************************************************************/ /* Reads in a DIFF file. */ /*****************************************************************************/ @@ -478,16 +475,13 @@ bool readDiff(bool playonce) { } - static byte *mstart; -void readSound() { +void readSound(bool waitTillFinished) { uint32 header_ = 0, size_; uint16 samplespeed_; -// uint16 numchunks = 1; char temp_[5]; -// bool FirstThru = true; byte *storagefordifffile_, **difffile_ = &storagefordifffile_; mstart = *startoffile; /* Make a copy of the pointer to the start of the file */ @@ -526,7 +520,7 @@ void readSound() { swapULong(&size_); if ((header_ == 30) || (header_ == 31)) { - if (mwaitForEffect) { + if (waitTillFinished) { while (g_music->isSoundEffectActive()) { g_music->updateMusic(); waitTOF(); @@ -547,7 +541,7 @@ void readSound() { g_music->playSoundEffect(samplespeed_, musicsize, music); } else if (header_ == 65535L) { - if (mwaitForEffect) { + if (waitTillFinished) { while (g_music->isSoundEffectActive()) { g_music->updateMusic(); waitTOF(); -- cgit v1.2.3 From db969dc9388855f2c80ab9cc5fd6e870c5979395 Mon Sep 17 00:00:00 2001 From: Filippos Karapetis Date: Tue, 21 Jul 2015 22:23:20 +0300 Subject: LAB: Move more static variables to the top --- engines/lab/readdiff.cpp | 62 +++++++++++++++--------------------------------- 1 file changed, 19 insertions(+), 43 deletions(-) diff --git a/engines/lab/readdiff.cpp b/engines/lab/readdiff.cpp index ebf3d0793f..d220b3edc8 100644 --- a/engines/lab/readdiff.cpp +++ b/engines/lab/readdiff.cpp @@ -37,38 +37,23 @@ namespace Lab { -extern BitMap *DispBitMap, *DrawBitMap; -extern uint32 VGABytesPerPage; - -extern byte **startoffile; - static bool PlayOnce = false, changedscreen; +static uint32 header, size, processed = 0L, WaitSec = 0L, WaitMicros = 0L, DelayMicros = 0L; +static uint16 CurBit = 0, framenumber = 0, samplespeed, numchunks = 1; +static byte *Buffer, temp[5]; +static bool FirstThru = true, donepal = false; +static byte *storagefordifffile, **difffile = &storagefordifffile; +static byte *start; +static uint32 diffwidth, diffheight; +static byte blackbuffer[256 * 3]; +static byte *mstart; -bool NoFlip = false, /* Don't flip the new picture to front */ - DoBlack = false, /* Black the screen before new picture */ +bool DoBlack = false, /* Black the screen before new picture */ nopalchange = false, /* Don't change the palette. */ IsBM = false, /* Just fill in the RawDIFFBM structure */ - hidemouse = false, /* Don't set the mouse colors */ stopsound = false, - soundplaying = false, - screenbuffer = false, - waitForEffect = false, /* Wait for each sound effect to finish - before coninuing. */ - mwaitForEffect = false; - -uint16 DataBytesPerRow; - -#define CONTINUOUS 0xFFFF - -DIFFHeader headerdata; - - - -/*------ Stuff for the animation task. -----*/ - -static byte *start; - -static uint32 diffwidth, diffheight; + waitForEffect = false; /* Wait for each sound effect to finish + before coninuing. */ static bool continuous, IsPlaying = false, @@ -77,11 +62,16 @@ static bool continuous, IsAnim = false, IsPal = false; -char diffcmap[256 * 3], lastcmap[256 * 3]; - +uint16 DataBytesPerRow; +DIFFHeader headerdata; +char diffcmap[256 * 3]; BitMap RawDiffBM; +extern BitMap *DispBitMap, *DrawBitMap; +extern uint32 VGABytesPerPage; +extern byte **startoffile; +#define CONTINUOUS 0xFFFF /*****************************************************************************/ @@ -101,8 +91,6 @@ void unDiff(byte *NewBuf, byte *OldBuf, byte *DiffData, uint16 bytesperrow, bool } -static byte blackbuffer[256 * 3]; - /*****************************************************************************/ /* Changes the front screen to black. */ /*****************************************************************************/ @@ -132,14 +120,6 @@ void blackAllScreen() { } - -/* For Play Diff */ -static uint32 header, size, processed = 0L, WaitSec = 0L, WaitMicros = 0L, DelayMicros = 0L; -static uint16 CurBit = 0, framenumber = 0, samplespeed, numchunks = 1; -static byte *Buffer, temp[5]; -static bool FirstThru = true, donepal = false; -static byte *storagefordifffile, * *difffile = &storagefordifffile; - void diffNextFrame() { if (header == 65535) /* Already done. */ return; @@ -474,10 +454,6 @@ bool readDiff(bool playonce) { return true; } - -static byte *mstart; - - void readSound(bool waitTillFinished) { uint32 header_ = 0, size_; uint16 samplespeed_; -- cgit v1.2.3 From f085a3187edb2ac6077c00a995309b25869db336 Mon Sep 17 00:00:00 2001 From: Filippos Karapetis Date: Tue, 21 Jul 2015 22:24:32 +0300 Subject: LAB: Remove several usages of skip(). Remove dead code --- engines/lab/readdiff.cpp | 38 +++++++++++++++++++------------------- 1 file changed, 19 insertions(+), 19 deletions(-) diff --git a/engines/lab/readdiff.cpp b/engines/lab/readdiff.cpp index d220b3edc8..6820e4ea8a 100644 --- a/engines/lab/readdiff.cpp +++ b/engines/lab/readdiff.cpp @@ -186,8 +186,6 @@ void diffNextFrame() { switch (header) { case 8L: - memcpy(lastcmap, diffcmap, 256 * 3); - readBlock(diffcmap, size, difffile); IsPal = true; break; @@ -196,7 +194,7 @@ void diffNextFrame() { RawDiffBM.Planes[CurBit] = *difffile; if (IsBM) - skip(difffile, size); + (*difffile) += size; else { readBlock(DrawBitMap->Planes[CurBit], size, difffile); } @@ -205,29 +203,29 @@ void diffNextFrame() { break; case 11L: - skip(difffile, 4L); + (*difffile) += 4; runLengthDecode(DrawBitMap->Planes[CurBit], *difffile); CurBit++; - skip(difffile, size - 4); + (*difffile) += size - 4; break; case 12L: - skip(difffile, 4L); + (*difffile) += 4; VRunLengthDecode(DrawBitMap->Planes[CurBit], *difffile, DrawBitMap->BytesPerRow); CurBit++; - skip(difffile, size - 4); + (*difffile) += size - 4; break; case 20L: unDiff(DrawBitMap->Planes[CurBit], DispBitMap->Planes[CurBit], *difffile, DrawBitMap->BytesPerRow, false); CurBit++; - skip(difffile, size); + (*difffile) += size; break; case 21L: unDiff(DrawBitMap->Planes[CurBit], DispBitMap->Planes[CurBit], *difffile, DrawBitMap->BytesPerRow, true); CurBit++; - skip(difffile, size); + (*difffile) += size; break; case 25L: @@ -249,14 +247,15 @@ void diffNextFrame() { size -= 8L; - skip(difffile, 4L); + + (*difffile) += 4; readBlock(&samplespeed, 2L, difffile); swapUShortPtr(&samplespeed, 1); - skip(difffile, 2L); + (*difffile) += 2; byte *music = *difffile; uint32 musicsize = size; - skip(difffile, size); + (*difffile) += size; g_music->playSoundEffect(samplespeed, musicsize, music); break; @@ -292,7 +291,7 @@ void diffNextFrame() { break; default: - skip(difffile, size); + (*difffile) += size; break; } } @@ -372,7 +371,7 @@ void playDiff() { readBlock(&headerdata.Machine, 2, difffile); readBlock(&headerdata.Flags, 4, difffile); - skip(difffile, size - 18); + (*difffile) += size - 18; swapUShortPtr(&headerdata.Version, 3); swapULong(&headerdata.BufferSize); @@ -454,6 +453,7 @@ bool readDiff(bool playonce) { return true; } + void readSound(bool waitTillFinished) { uint32 header_ = 0, size_; uint16 samplespeed_; @@ -483,7 +483,7 @@ void readSound(bool waitTillFinished) { swapULong(&size_); if (header_ == 0) - skip(difffile_, size_); + (*difffile_) += size_; else return; @@ -505,15 +505,15 @@ void readSound(bool waitTillFinished) { size_ -= 8L; - skip(difffile_, 4L); + (*difffile_) += 4; readBlock(&samplespeed_, 2L, difffile_); swapUShortPtr(&samplespeed_, 1); - skip(difffile_, 2L); + (*difffile_) += 2; byte *music = *difffile_; uint32 musicsize = size_; - skip(difffile_, size_); + (*difffile_) += size_; g_music->playSoundEffect(samplespeed_, musicsize, music); } else if (header_ == 65535L) { @@ -524,7 +524,7 @@ void readSound(bool waitTillFinished) { } } } else - skip(difffile_, size_); + (*difffile_) += size_; } } -- cgit v1.2.3 From d0171440df2d7b372563f342eac6cdd11488311f Mon Sep 17 00:00:00 2001 From: Filippos Karapetis Date: Tue, 21 Jul 2015 22:26:06 +0300 Subject: LAB: Move checkRoomMusic to the Music class. Some cleanup --- engines/lab/engine.cpp | 30 ++------------------------- engines/lab/labmusic.cpp | 50 +++++++++++++++++++++++---------------------- engines/lab/processroom.cpp | 40 +++++++++++++++--------------------- 3 files changed, 44 insertions(+), 76 deletions(-) diff --git a/engines/lab/engine.cpp b/engines/lab/engine.cpp index 54050f2ffd..34ca89c192 100644 --- a/engines/lab/engine.cpp +++ b/engines/lab/engine.cpp @@ -69,7 +69,7 @@ int followCrumbs(); void mayShowCrumbIndicator(); void mayShowCrumbIndicatorOff(); -bool Alternate = false, ispal = false, noupdatediff = false, MainDisplay = true, QuitLab = false, DoNotReset = false; +bool Alternate = false, ispal = false, noupdatediff = false, MainDisplay = true, QuitLab = false; extern const char *NewFileName; /* When ProcessRoom.c decides to change the filename of the current picture. */ @@ -118,11 +118,6 @@ extern char *GOFORWARDDIR, *NOPATH, *TAKEITEM, *USEONWHAT, *TAKEWHAT, *MOVEWHAT, #define LEVERSMONITOR 82 -#define CLOWNROOM 123 -#define DIMROOM 80 - - - static byte *MovePanelBuffer, *InvPanelBuffer; static uint32 MovePanelBufferSize, InvPanelBufferSize; static Image *MoveImages[20], *InvImages[10]; @@ -398,27 +393,6 @@ void eatMessages() { return; } -static uint16 lastmusicroom = 1; - - -/******************************************************************************/ -/* Checks the music that should be playing in a particular room. */ -/******************************************************************************/ -static void checkRoomMusic() { - if ((lastmusicroom == RoomNum) || !g_music->_musicOn) - return; - - if (RoomNum == CLOWNROOM) - g_music->changeMusic("Music:Laugh"); - else if (RoomNum == DIMROOM) - g_music->changeMusic("Music:Rm81"); - else if (!DoNotReset) - g_music->resetMusic(); - - lastmusicroom = RoomNum; -} - - /******************************************************************************/ /* Checks whether the close up is one of the special case closeups. */ /******************************************************************************/ @@ -791,7 +765,7 @@ static void mainGameLoop() { if (Msg == NULL) { /* Does music load and next animation frame when you've run out of messages */ GotMessage = false; - checkRoomMusic(); + g_music->checkRoomMusic(); g_music->updateMusic(); diffNextFrame(); diff --git a/engines/lab/labmusic.cpp b/engines/lab/labmusic.cpp index ecb5fd174b..3f35579e2c 100644 --- a/engines/lab/labmusic.cpp +++ b/engines/lab/labmusic.cpp @@ -40,10 +40,13 @@ namespace Lab { #define MUSICBUFSIZE (2 * 65536L) - #define SAMPLESPEED 15000L +#define CLOWNROOM 123 +#define DIMROOM 80 + Music *g_music; +extern uint16 RoomNum; // TODO: Move into a class Music::Music() { _file = 0; @@ -60,6 +63,9 @@ Music::Music() { _loopSoundEffect = false; _queuingAudioStream = NULL; _doNotFilestopSoundEffect = false; + _lastMusicRoom = 1; + _doReset = true; + _waitTillFinished = false; } /*****************************************************************************/ @@ -143,15 +149,6 @@ void Music::fillbuffer(byte *musicBuffer) { } } -/*****************************************************************************/ -/* Fills up the buffers that have already been played if necessary; if doit */ -/* is set to TRUE then it will fill up all empty buffers. Otherwise, it */ -/* Check if there are MINBUFFERS or less buffers that are playing. */ -/*****************************************************************************/ -void Music::fillUpMusic(bool doit) { - updateMusic(); -} - /*****************************************************************************/ /* Starts up the music initially. */ /*****************************************************************************/ @@ -240,18 +237,6 @@ void Music::resumeBackMusic() { } } -/*****************************************************************************/ -/* Checks to see if need to fill buffers fill of music. */ -/*****************************************************************************/ -void Music::checkMusic() { - updateMusic(); - - if (!_musicOn) - return; - - fillUpMusic(false); -} - /*****************************************************************************/ /* Turns the music on and off. */ /*****************************************************************************/ @@ -268,6 +253,23 @@ void Music::setMusic(bool on) { _musicOn = on; } +/******************************************************************************/ +/* Checks the music that should be playing in a particular room. */ +/******************************************************************************/ +void Music::checkRoomMusic() { + if ((_lastMusicRoom == RoomNum) || !_musicOn) + return; + + if (RoomNum == CLOWNROOM) + g_music->changeMusic("Music:Laugh"); + else if (RoomNum == DIMROOM) + g_music->changeMusic("Music:Rm81"); + else if (_doReset) + g_music->resetMusic(); + + _lastMusicRoom = RoomNum; +} + /*****************************************************************************/ /* Changes the background music to something else. */ /*****************************************************************************/ @@ -348,14 +350,14 @@ byte **Music::newOpen(const char *name, uint32 &size) { if (_musicOn) { updateMusic(); - fillUpMusic(true); + updateMusic(); } if (!_doNotFilestopSoundEffect && isSoundEffectActive()) stopSoundEffect(); file = openFile(name, size); - checkMusic(); + updateMusic(); return file; } diff --git a/engines/lab/processroom.cpp b/engines/lab/processroom.cpp index c6acf36a32..3c5d1f62dd 100644 --- a/engines/lab/processroom.cpp +++ b/engines/lab/processroom.cpp @@ -44,26 +44,18 @@ namespace Lab { /* Global parser data */ +#define NOFILE "no file" + RoomData *Rooms; InventoryData *Inventory; uint16 NumInv, RoomNum, ManyRooms, HighestCondition, Direction; - -extern char *FACINGNORTH, *FACINGEAST, *FACINGSOUTH, *FACINGWEST; -extern bool LongWinInFront; - -#define NOFILE "no file" - -extern const char *CurFileName; - -const char *ViewPath = "LAB:Rooms/"; - const char *NewFileName; -extern bool DoNotDrawMessage; -extern bool NoFlip, IsBM, noupdatediff, waitForEffect, mwaitForEffect, QuitLab, soundplaying, MusicOn, DoBlack, DoNotReset; +extern bool DoNotDrawMessage, IsBM, noupdatediff, QuitLab, MusicOn, DoBlack, LongWinInFront; extern char diffcmap[256 * 3]; - +extern const char *CurFileName; extern CloseDataPtr CPtr; +extern char *FACINGNORTH, *FACINGEAST, *FACINGSOUTH, *FACINGWEST; /*****************************************************************************/ /* Generates a random number. */ @@ -373,26 +365,26 @@ static void doActions(ActionPtr APtr, CloseDataPtr *LCPtr) { uint32 StartSecs, StartMicros, CurSecs, CurMicros; while (APtr) { - g_music->checkMusic(); + g_music->updateMusic(); switch (APtr->ActionType) { case PLAYSOUND: - mwaitForEffect = true; /* Plays a sound, but waits for it to be done before continuing */ g_music->_loopSoundEffect = false; - readMusic((char *)APtr->Data); - mwaitForEffect = false; + g_music->_waitTillFinished = true; + readMusic((char *)APtr->Data, true); + g_music->_waitTillFinished = false; break; case PLAYSOUNDB: - mwaitForEffect = false; /* Plays a sound in the background. */ g_music->_loopSoundEffect = false; - readMusic((char *)APtr->Data); + g_music->_waitTillFinished = false; + readMusic((char *)APtr->Data, false); break; case PLAYSOUNDCONT: g_music->_doNotFilestopSoundEffect = true; g_music->_loopSoundEffect = true; - readMusic((char *)APtr->Data); + readMusic((char *)APtr->Data, g_music->_waitTillFinished); break; case SHOWDIFF: @@ -542,7 +534,7 @@ static void doActions(ActionPtr APtr, CloseDataPtr *LCPtr) { WSDL_UpdateScreen(); while (1) { - g_music->checkMusic(); + g_music->updateMusic(); diffNextFrame(); getTime(&CurSecs, &CurMicros); @@ -563,16 +555,16 @@ static void doActions(ActionPtr APtr, CloseDataPtr *LCPtr) { case CHANGEMUSIC: g_music->changeMusic((const char *)APtr->Data); - DoNotReset = true; + g_music->setMusicReset(false); break; case RESETMUSIC: g_music->resetMusic(); - DoNotReset = false; + g_music->setMusicReset(true); break; case FILLMUSIC: - g_music->fillUpMusic(true); + g_music->updateMusic(); break; case WAITSOUND: -- cgit v1.2.3 From 76b66de8b673b878efe4ef5159a0dec20bd94890 Mon Sep 17 00:00:00 2001 From: Filippos Karapetis Date: Thu, 8 Oct 2015 04:36:15 +0300 Subject: LAB: Remove dead code --- engines/lab/graphics.cpp | 7 ------- engines/lab/readdiff.cpp | 7 ------- engines/lab/special.cpp | 6 ------ engines/lab/text.cpp | 2 -- engines/lab/vga.cpp | 20 -------------------- engines/lab/vga.h | 1 - 6 files changed, 43 deletions(-) diff --git a/engines/lab/graphics.cpp b/engines/lab/graphics.cpp index 049053f470..23e587c047 100644 --- a/engines/lab/graphics.cpp +++ b/engines/lab/graphics.cpp @@ -86,8 +86,6 @@ bool readPict(const char *filename, bool PlayOnce) { readDiff(PlayOnce); - ungetVGABaseAddr(); - return true; } @@ -488,7 +486,6 @@ static void doScrollBlack() { freeAllStolenMem(); mouseShow(); - ungetVGABaseAddr(); } @@ -526,8 +523,6 @@ static void copyPage(uint16 width, uint16 height, uint16 nheight, uint16 startli CurPage++; OffSet = 0; } - - ungetVGABaseAddr(); } @@ -751,8 +746,6 @@ static void doTransWipe(CloseDataPtr *CPtr, char *filename) { } } } - - ungetVGABaseAddr(); } diff --git a/engines/lab/readdiff.cpp b/engines/lab/readdiff.cpp index 6820e4ea8a..ab93d32c1d 100644 --- a/engines/lab/readdiff.cpp +++ b/engines/lab/readdiff.cpp @@ -277,9 +277,6 @@ void diffNextFrame() { IsPlaying = false; mouseShow(); - if (DispBitMap->Flags & BITMAPF_VIDEO) - ungetVGABaseAddr(); - if (!didTOF) WSDL_UpdateScreen(); @@ -295,10 +292,6 @@ void diffNextFrame() { break; } } - - if (DispBitMap->Flags & BITMAPF_VIDEO) - ungetVGABaseAddr(); - } diff --git a/engines/lab/special.cpp b/engines/lab/special.cpp index 4d64dd3914..bedf7215d0 100644 --- a/engines/lab/special.cpp +++ b/engines/lab/special.cpp @@ -214,8 +214,6 @@ static void changeCombination(uint16 number) { g_lab->_conditions->inclElement(COMBINATIONUNLOCKED); else g_lab->_conditions->exclElement(COMBINATIONUNLOCKED); - - ungetVGABaseAddr(); } @@ -735,8 +733,6 @@ static void drawJournal(uint16 wipenum, bool needFade) { else unGhoastGadget(&ForwardG); - ungetVGABaseAddr(); - if (needFade) fade(true, 0); @@ -832,8 +828,6 @@ void doJournal() { blackScreen(); freeAllStolenMem(); - - ungetVGABaseAddr(); } bool saveRestoreGame() { diff --git a/engines/lab/text.cpp b/engines/lab/text.cpp index e99114ecda..f31515fa5f 100644 --- a/engines/lab/text.cpp +++ b/engines/lab/text.cpp @@ -198,8 +198,6 @@ void text(struct TextFont *tf, uint16 x, uint16 y, uint16 color, const char *tex x += tf->Widths[(int)*text]; text++; } - - ungetVGABaseAddr(); } } // End of namespace Lab diff --git a/engines/lab/vga.cpp b/engines/lab/vga.cpp index 7b745760c4..aa31d19771 100644 --- a/engines/lab/vga.cpp +++ b/engines/lab/vga.cpp @@ -290,16 +290,11 @@ byte *WSDL_LockVideo() { return g_DisplayBuffer; } -void WSDL_UnlockVideo() { -} - void WSDL_IgnoreUpdateDisplay(int state) { g_IgnoreUpdateDisplay = state; } void WSDL_UpdateScreen() { - WSDL_UnlockVideo(); - if (g_ScreenWasLocked && !g_IgnoreUpdateDisplay) { g_system->copyRectToScreen(g_DisplayBuffer, VGAScreenWidth, 0, 0, VGAScreenWidth, VGAScreenHeight); g_system->updateScreen(); @@ -319,11 +314,6 @@ byte *getVGABaseAddr() { return WSDL_LockVideo(); } -void ungetVGABaseAddr() { - if (!VGABASEADDRESS) - WSDL_UnlockVideo(); -} - /*****************************************************************************/ /* Draws an image to the screen. */ /*****************************************************************************/ @@ -364,8 +354,6 @@ void drawImage(Image *Im, uint16 x, uint16 y) { s += Im->Width; d += VGAScreenWidth; } - - ungetVGABaseAddr(); } } @@ -419,8 +407,6 @@ void drawMaskImage(Image *Im, uint16 x, uint16 y) { s += Im->Width; d += VGAScreenWidth; } - - ungetVGABaseAddr(); } } @@ -464,8 +450,6 @@ void readScreenImage(Image *Im, uint16 x, uint16 y) { s += Im->Width; d += VGAScreenWidth; } - - ungetVGABaseAddr(); } } @@ -647,8 +631,6 @@ void rectFill(uint16 x1, uint16 y1, uint16 x2, uint16 y2) { d += VGAScreenWidth; } - - ungetVGABaseAddr(); } } @@ -714,8 +696,6 @@ void ghoastRect(uint16 pencolor, uint16 x1, uint16 y1, uint16 x2, uint16 y2) { d += VGAScreenWidth; dy++; } - - ungetVGABaseAddr(); } } diff --git a/engines/lab/vga.h b/engines/lab/vga.h index 5821a0cd82..376411aede 100644 --- a/engines/lab/vga.h +++ b/engines/lab/vga.h @@ -48,7 +48,6 @@ bool createScreen(bool HiRes); void waitTOF(); void quickWaitTOF(); byte *getVGABaseAddr(); -void ungetVGABaseAddr(); void writeColorReg(byte *buf, uint16 regnum); void writeColorRegs(byte *buf, uint16 first, uint16 numreg); void writeColorRegsSmooth(byte *buf, uint16 first, uint16 numreg); -- cgit v1.2.3 From 454c02f321660585aa693329c7aa67eaf1f112fe Mon Sep 17 00:00:00 2001 From: Filippos Karapetis Date: Thu, 8 Oct 2015 04:37:58 +0300 Subject: LAB: Get rid of some uses of readBlock() --- engines/lab/labsets.cpp | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/engines/lab/labsets.cpp b/engines/lab/labsets.cpp index d68370bf88..02107543c1 100644 --- a/engines/lab/labsets.cpp +++ b/engines/lab/labsets.cpp @@ -57,22 +57,22 @@ void LargeSet::exclElement(uint16 element) { } bool LargeSet::readInitialConditions(const char *fileName) { - byte **file; + byte *file; uint16 many, set; char temp[5]; if ((file = g_music->newOpen(fileName)) != NULL) { - readBlock(temp, 4L, file); + memcpy(&temp, file, 4); file += 4; temp[4] = '\0'; if (strcmp(temp, "CON0") != 0) return false; - readBlock(&many, 2L, file); + memcpy(&many, file, 2); file += 2; swapUShortPtr(&many, 1); for (int counter = 0; counter < many; counter++) { - readBlock(&set, 2L, file); + memcpy(&set, file, 2); file += 2; swapUShortPtr(&set, 1); inclElement(set); } -- cgit v1.2.3 From afa9475d2ad18486203a73869930caff29a40dff Mon Sep 17 00:00:00 2001 From: Filippos Karapetis Date: Thu, 8 Oct 2015 05:08:15 +0300 Subject: LAB: Some cleanup --- engines/lab/intro.cpp | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/engines/lab/intro.cpp b/engines/lab/intro.cpp index 5d5f6048ec..4f1720fe23 100644 --- a/engines/lab/intro.cpp +++ b/engines/lab/intro.cpp @@ -238,7 +238,7 @@ void musicDelay() { static void NReadPict(const char *Filename, bool PlayOnce) { - Common::String finalFileName = "P:Intro/"; + Common::String finalFileName = Common::String("P:Intro/") + Filename; g_music->updateMusic(); introEatMessages(); @@ -246,8 +246,6 @@ static void NReadPict(const char *Filename, bool PlayOnce) { if (QuitIntro) return; - finalFileName += Filename; - DoBlack = IntroDoBlack; stopDiffEnd(); readPict(finalFileName.c_str(), PlayOnce); -- cgit v1.2.3 From 69694b6b459791a71aac39ba7a4ffaa0d643bc52 Mon Sep 17 00:00:00 2001 From: Filippos Karapetis Date: Thu, 8 Oct 2015 05:24:33 +0300 Subject: LAB: Check if a sound effect is active before attempting to stop it --- engines/lab/labmusic.cpp | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/engines/lab/labmusic.cpp b/engines/lab/labmusic.cpp index 3f35579e2c..fe2d6e973c 100644 --- a/engines/lab/labmusic.cpp +++ b/engines/lab/labmusic.cpp @@ -128,7 +128,8 @@ void Music::playSoundEffect(uint16 SampleSpeed, uint32 Length, void *Data) { } void Music::stopSoundEffect() { - g_lab->_mixer->stopHandle(_sfxHandle); + if (isSoundEffectActive()) + g_lab->_mixer->stopHandle(_sfxHandle); } bool Music::isSoundEffectActive() const { -- cgit v1.2.3 From 98e9eff2d1576328c58e0bb64cae0e01c4df2084 Mon Sep 17 00:00:00 2001 From: Filippos Karapetis Date: Thu, 8 Oct 2015 05:27:55 +0300 Subject: LAB: Remove superfluous references to g_music, some cleanup --- engines/lab/labmusic.cpp | 13 +++++-------- 1 file changed, 5 insertions(+), 8 deletions(-) diff --git a/engines/lab/labmusic.cpp b/engines/lab/labmusic.cpp index fe2d6e973c..d4752c60da 100644 --- a/engines/lab/labmusic.cpp +++ b/engines/lab/labmusic.cpp @@ -262,11 +262,11 @@ void Music::checkRoomMusic() { return; if (RoomNum == CLOWNROOM) - g_music->changeMusic("Music:Laugh"); + changeMusic("Music:Laugh"); else if (RoomNum == DIMROOM) - g_music->changeMusic("Music:Rm81"); + changeMusic("Music:Rm81"); else if (_doReset) - g_music->resetMusic(); + resetMusic(); _lastMusicRoom = RoomNum; } @@ -349,12 +349,9 @@ byte **Music::newOpen(const char *name, uint32 &size) { if (file = isBuffered(name)) return file; - if (_musicOn) { - updateMusic(); - updateMusic(); - } + updateMusic(); - if (!_doNotFilestopSoundEffect && isSoundEffectActive()) + if (!_doNotFilestopSoundEffect) stopSoundEffect(); file = openFile(name, size); -- cgit v1.2.3 From f1351dcd9e80acc305365f8726fd05600283a6e4 Mon Sep 17 00:00:00 2001 From: Filippos Karapetis Date: Thu, 8 Oct 2015 05:36:32 +0300 Subject: LAB: Remove dead code --- engines/lab/readdiff.cpp | 14 ++------------ 1 file changed, 2 insertions(+), 12 deletions(-) diff --git a/engines/lab/readdiff.cpp b/engines/lab/readdiff.cpp index ab93d32c1d..b2720ea202 100644 --- a/engines/lab/readdiff.cpp +++ b/engines/lab/readdiff.cpp @@ -37,11 +37,11 @@ namespace Lab { -static bool PlayOnce = false, changedscreen; +static bool PlayOnce = false; static uint32 header, size, processed = 0L, WaitSec = 0L, WaitMicros = 0L, DelayMicros = 0L; static uint16 CurBit = 0, framenumber = 0, samplespeed, numchunks = 1; static byte *Buffer, temp[5]; -static bool FirstThru = true, donepal = false; +static bool donepal = false; static byte *storagefordifffile, **difffile = &storagefordifffile; static byte *start; static uint32 diffwidth, diffheight; @@ -57,7 +57,6 @@ bool DoBlack = false, /* Black the screen before new picture */ static bool continuous, IsPlaying = false, - StopPlaying = false, StopPlayingEnd = false, IsAnim = false, IsPal = false; @@ -150,7 +149,6 @@ void diffNextFrame() { } donepal = true; - FirstThru = false; } if (IsPal && !nopalchange && !IsBM && !donepal) { @@ -308,16 +306,12 @@ void playDiff() { CurBit = 0; framenumber = 0; numchunks = 1; - FirstThru = true; donepal = false; difffile = &storagefordifffile; IsPlaying = true; - StopPlaying = false; StopPlayingEnd = false; - changedscreen = false; - if (DoBlack) { DoBlack = false; blackScreen(); @@ -406,8 +400,6 @@ void playDiff() { /*****************************************************************************/ void stopDiff() { if (IsPlaying) { - StopPlaying = true; - if (IsAnim) blackScreen(); } @@ -420,8 +412,6 @@ void stopDiff() { /*****************************************************************************/ void stopDiffEnd() { if (IsPlaying) { - StopPlayingEnd = true; - while (IsPlaying) { g_music->updateMusic(); diffNextFrame(); -- cgit v1.2.3 From edf92fc6809830d819a1471ccf295aa110340cb0 Mon Sep 17 00:00:00 2001 From: Filippos Karapetis Date: Thu, 8 Oct 2015 05:37:21 +0300 Subject: LAB: Revert accidental change --- engines/lab/labsets.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/engines/lab/labsets.cpp b/engines/lab/labsets.cpp index 02107543c1..ae70d817d5 100644 --- a/engines/lab/labsets.cpp +++ b/engines/lab/labsets.cpp @@ -57,7 +57,7 @@ void LargeSet::exclElement(uint16 element) { } bool LargeSet::readInitialConditions(const char *fileName) { - byte *file; + byte **file; uint16 many, set; char temp[5]; -- cgit v1.2.3 From c67852d940c31ecaf330a7f3b0cdb82f1f57819c Mon Sep 17 00:00:00 2001 From: Filippos Karapetis Date: Thu, 8 Oct 2015 06:02:34 +0300 Subject: LAB: Initial implementation of the Resource class This will eventually replace all the other resource loading routines --- engines/lab/lab.cpp | 2 + engines/lab/module.mk | 1 + engines/lab/resource.cpp | 324 +++++++++++++++++++++++++++++++++++++++++++++++ engines/lab/resource.h | 124 ++++++++++++++++++ 4 files changed, 451 insertions(+) create mode 100644 engines/lab/resource.cpp create mode 100644 engines/lab/resource.h diff --git a/engines/lab/lab.cpp b/engines/lab/lab.cpp index 3f92de1116..c13f5cde9e 100644 --- a/engines/lab/lab.cpp +++ b/engines/lab/lab.cpp @@ -43,6 +43,7 @@ #include "lab/lab.h" #include "lab/labfun.h" +#include "lab/resource.h" #include "engines/advancedDetector.h" @@ -73,6 +74,7 @@ Common::Error LabEngine::run() { initGraphics(640, 480, true); g_music = new Music(); + g_resource = new Resource(); if (getPlatform() == Common::kPlatformWindows) { // Check if this is the Wyrmkeep trial diff --git a/engines/lab/module.mk b/engines/lab/module.mk index 7389c18a1d..1520672573 100644 --- a/engines/lab/module.mk +++ b/engines/lab/module.mk @@ -18,6 +18,7 @@ MODULE_OBJS := \ processroom.o \ readdiff.o \ readparse.o \ + resource.o \ savegame.o \ special.o \ text.o \ diff --git a/engines/lab/resource.cpp b/engines/lab/resource.cpp new file mode 100644 index 0000000000..9babc5c080 --- /dev/null +++ b/engines/lab/resource.cpp @@ -0,0 +1,324 @@ +/* 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. + * + */ + +/* + * This code is based on Labyrinth of Time code with assistance of + * + * Copyright (c) 1993 Terra Nova Development + * Copyright (c) 2004 The Wyrmkeep Entertainment Co. + * + */ + +//#include "lab/labfun.h" +//#include "lab/parsetypes.h" +//#include "lab/parsefun.h" +//#include "lab/stddefines.h" +#include "lab/text.h" +#include "lab/resource.h" + +namespace Lab { + +static uint16 allocroom; + +extern RoomData *Rooms; +extern InventoryData *Inventory; +extern uint16 NumInv, ManyRooms, HighestCondition; + +Resource *g_resource; + +Resource::Resource() { + readStaticText(); +} + +void Resource::readStaticText() { + Common::File labTextFile; + labTextFile.open(translateFileName("Lab:Rooms/LabText")); + + for (int i = 0; i < 48; i++) + _staticText[i] = labTextFile.readLine(); + + labTextFile.close(); +} + +TextFont *Resource::getFont(const char *fileName) { + Common::File *dataFile; + if (!(dataFile = openDataFile(fileName, MKTAG('V', 'G', 'A', 'F')))) + return NULL; + + uint32 headerSize = 4L + 2L + 256 * 3 + 4L; + uint32 fileSize = dataFile->size(); + if (fileSize <= headerSize) + return NULL; + + g_music->updateMusic(); + + TextFont *textfont = (TextFont *)malloc(sizeof(TextFont)); + textfont->DataLength = fileSize - headerSize; + textfont->Height = dataFile->readUint16LE(); + dataFile->read(textfont->Widths, 256); + for (int i = 0; i < 256; i++) + textfont->Offsets[i] = dataFile->readUint16LE(); + dataFile->skip(4); + // TODO: Fix memory leak!! + textfont->data = new byte[textfont->DataLength + 4]; + dataFile->read(textfont->data, textfont->DataLength); + return textfont; +} + +bool Resource::readRoomData(const char *fileName) { + Common::File *dataFile; + if (!(dataFile = openDataFile(fileName, MKTAG('D', 'O', 'R', '1')))) + return false; + + ManyRooms = dataFile->readUint16LE(); + HighestCondition = dataFile->readUint16LE(); + Rooms = (RoomData *)malloc((ManyRooms + 1) * sizeof(RoomData)); + memset(Rooms, 0, (ManyRooms + 1) * sizeof(RoomData)); + + for (uint16 i = 1; i <= ManyRooms; i++) { + Rooms[i].NorthDoor = dataFile->readUint16LE(); + Rooms[i].SouthDoor = dataFile->readUint16LE(); + Rooms[i].EastDoor = dataFile->readUint16LE(); + Rooms[i].WestDoor = dataFile->readUint16LE(); + Rooms[i].WipeType = dataFile->readByte(); + + Rooms[i].NorthView = NULL; + Rooms[i].SouthView = NULL; + Rooms[i].EastView = NULL; + Rooms[i].WestView = NULL; + Rooms[i].RuleList = NULL; + Rooms[i].RoomMsg = NULL; + } + + delete dataFile; + return true; +} + +bool Resource::readInventory(const char *fileName) { + Common::File *dataFile; + if (!(dataFile = openDataFile(fileName, MKTAG('I', 'N', 'V', '1')))) + return false; + + NumInv = dataFile->readUint16LE(); + Inventory = (InventoryData *)malloc((NumInv + 1) * sizeof(InventoryData)); + + for (uint16 i = 1; i <= NumInv; i++) { + Inventory[i].Many = dataFile->readUint16LE(); + Inventory[i].name = readString(dataFile); + Inventory[i].BInvName = readString(dataFile); + } + + delete dataFile; + return true; +} + +bool Resource::readViews(uint16 roomNum) { + Common::String fileName = "LAB:Rooms/" + Common::String::format("%d", roomNum); + Common::File *dataFile; + if (!(dataFile = openDataFile(fileName.c_str(), MKTAG('R', 'O', 'M', '4')))) + return false; + + allocroom = roomNum; + + Rooms[roomNum].RoomMsg = readString(dataFile); + Rooms[roomNum].NorthView = readView(dataFile); + Rooms[roomNum].SouthView = readView(dataFile); + Rooms[roomNum].EastView = readView(dataFile); + Rooms[roomNum].WestView = readView(dataFile); + Rooms[roomNum].RuleList = readRule(dataFile); + /*warning("Room %d, msg %s, north %s, south %s, east %s, west %s", + Rooms[roomNum].RoomMsg, + Rooms[roomNum].NorthView->GraphicName, + Rooms[roomNum].SouthView->GraphicName, + Rooms[roomNum].EastView->GraphicName, + Rooms[roomNum].WestView->GraphicName + );*/ + + g_music->updateMusic(); + + delete dataFile; + return true; +} + +Common::File *Resource::openDataFile(const char * fileName, uint32 fileHeader) { + Common::File *dataFile = new Common::File(); + dataFile->open(translateFileName(fileName)); + if (dataFile->readUint32BE() != fileHeader) { + dataFile->close(); + return NULL; + } + + return dataFile; +} + +char *Resource::readString(Common::File *file) { + byte size = file->readByte(); + if (!size) + return NULL; + char *str = (char *)malloc(size); + char *c = str; + for (int i = 0; i < size; i++) { + *c = file->readByte(); + if (*c != '\0') + *c -= 95; // decrypt char + c++; + } + *c = 0; + + return str; +} + +int16 *Resource::readConditions(Common::File *file) { + int16 i = 0, cond; + //int16 *list = new int16[25]; + int16 *list = (int16 *)malloc(25 * 2); + memset(list, 0, 25 * 2); + + do { + cond = file->readUint16LE(); + if (i < 25) + list[i++] = cond; + } while (cond); + + return list; +} + +Rule *Resource::readRule(Common::File *file) { + char c; + Rule *rule = NULL; + Rule *head = NULL; + + do { + c = file->readByte(); + + if (c == 1) { + rule = (Rule *)malloc(sizeof(Rule)); + rule->RuleType = file->readSint16LE(); + rule->Param1 = file->readSint16LE(); + rule->Param2 = file->readSint16LE(); + rule->Condition = readConditions(file); + if (!rule->Condition) + return NULL; + rule->ActionList = readAction(file); + rule->NextRule = NULL; + if (!head) + head = rule; + rule = rule->NextRule; + } + } while (c == 1); + + return head; +} + +Action *Resource::readAction(Common::File *file) { + char c; + Action *action = NULL; + Action *head = NULL; + char **messages; + + do { + c = file->readByte(); + + if (c == 1) { + action = (Action *)malloc(sizeof(Action)); + action->ActionType = file->readSint16LE(); + action->Param1 = file->readSint16LE(); + action->Param2 = file->readSint16LE(); + action->Param3 = file->readSint16LE(); + + if (action->ActionType == SHOWMESSAGES) { + messages = (char **)malloc(action->Param1 * 4); + + for (int i = 0; i < action->Param1; i++) + messages[i] = readString(file); + + action->Data = (byte *)messages; + } else { + action->Data = (byte *)readString(file); + } + + action->NextAction = NULL; + if (!head) + head = action; + action = action->NextAction; + } + } while (c == 1); + + return head; +} + +CloseData *Resource::readCloseUps(uint16 depth, Common::File *file) { + char c; + CloseData *closeups = NULL; + CloseData *head = NULL; + + do { + c = file->readByte(); + + if (c != '\0') { + closeups = (CloseData *)malloc(sizeof(CloseData)); + closeups->x1 = file->readUint16LE(); + closeups->y1 = file->readUint16LE(); + closeups->x2 = file->readUint16LE(); + closeups->y2 = file->readUint16LE(); + closeups->CloseUpType = file->readSint16LE(); + closeups->depth = depth; + closeups->GraphicName = readString(file); + closeups->Message = readString(file); + if (!(closeups->SubCloseUps = readCloseUps(depth + 1, file))) + return NULL; + closeups->NextCloseUp = NULL; + if (!head) + head = closeups; + closeups = closeups->NextCloseUp; + } + } while (c != '\0'); + + return head; +} + +viewData *Resource::readView(Common::File *file) { + char c; + viewData *view = NULL; + viewData *head = NULL; + + do { + c = file->readByte(); + + if (c == 1) { + view = (viewData *)malloc(sizeof(viewData)); + view->Condition = readConditions(file); + if (!view->Condition) + return NULL; + view->GraphicName = readString(file); + view->closeUps = readCloseUps(0, file); + view->NextCondition = NULL; + if (!head) + head = view; + view = view->NextCondition; + } + } while (c == 1); + + return head; +} + +} // End of namespace Lab diff --git a/engines/lab/resource.h b/engines/lab/resource.h new file mode 100644 index 0000000000..9bcd638c7f --- /dev/null +++ b/engines/lab/resource.h @@ -0,0 +1,124 @@ +/* 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. + * + */ + +/* + * This code is based on Labyrinth of Time code with assistance of + * + * Copyright (c) 1993 Terra Nova Development + * Copyright (c) 2004 The Wyrmkeep Entertainment Co. + * + */ + +#ifndef LAB_RESOURCE_H +#define LAB_RESOURCE_H + +#include "lab/labfun.h" +#include "lab/text.h" + +namespace Lab { + +enum StaticText { + kTextLowerFloor, + kTextMiddleFloor, + kTextUpperFloor, + kTextMedMazeFloor, + kTextHedgeMazeFloor, + kTextSurMazeFloor, + kTextCarnivalFloor, + + kTextSurmazeMessage, + + kTextFacingNorth, + kTextFacingEast, + kTextFacingSouth, + kTextFacingWest, + + kTextLampOn, + + kTextTurnLeft, + kTextTurnRight, + kTextGoForward, + kTextNoPath, + kTextTakeItem, + kTextSave, + kTextLoad, + kTextBookmark, + kTextPersonal, + kTextDisk, + kTextSaveBook, + kTextRestoreBook, + kTextSaveFlash, + kTextRestoreFlash, + kTextSaveDisk, + kTextRestoreDisk, + kTextNoDiskInDrive, + kTextWriteProtected, + kTextSelectDisk, + kTextFormatFloppy, + kTextFormatting, + + kTextNothing, + kTextUseOnWhat, + kTextTakeWhat, + kTextMoveWhat, + kTextOpenWhat, + kTextCloseWhat, + kTextLookWhat, + + kTextUseMap, + kTextUseJournal, + kTextTurnLampOn, + kTextTurnLampOff, + kTextUseWhiskey, + kTextUsePith, + kTextUseHelmet +}; + +class Resource { +public: + Resource(); + ~Resource() {} + + bool readRoomData(const char *fileName); + bool readInventory(const char *fileName); + bool readViews(uint16 roomNum); + TextFont *getFont(const char *filename); + Common::String getStaticText(byte index) const { return _staticText[index + 1]; } + +private: + Common::File *openDataFile(const char * fileName, uint32 fileHeader); + char *readString(Common::File *file); + int16 *readConditions(Common::File *file); + Rule *readRule(Common::File *file); + Action *readAction(Common::File *file); + CloseData *readCloseUps(uint16 depth, Common::File *file); + viewData *readView(Common::File *file); + void readStaticText(); + + Common::String _staticText[48]; +}; + +extern Resource *g_resource; + +} // End of namespace Lab + +#endif /* LAB_RESOURCE_H */ -- cgit v1.2.3 From d565b10384dd771fdae7f8fedb793e87c05c022d Mon Sep 17 00:00:00 2001 From: Filippos Karapetis Date: Thu, 8 Oct 2015 06:15:36 +0300 Subject: LAB: Move the font loading code into the Resource class --- engines/lab/engine.cpp | 3 ++- engines/lab/intro.cpp | 3 ++- engines/lab/labfun.h | 2 -- engines/lab/map.cpp | 41 ++--------------------------------------- engines/lab/special.cpp | 13 +++++++------ engines/lab/text.cpp | 42 +----------------------------------------- engines/lab/text.h | 1 - 7 files changed, 14 insertions(+), 91 deletions(-) diff --git a/engines/lab/engine.cpp b/engines/lab/engine.cpp index 34ca89c192..571b72d88d 100644 --- a/engines/lab/engine.cpp +++ b/engines/lab/engine.cpp @@ -38,6 +38,7 @@ #include "lab/parsefun.h" #include "lab/interface.h" #include "lab/mouse.h" +#include "lab/resource.h" namespace Lab { @@ -1361,7 +1362,7 @@ void LabEngine::go() { if (!dointro) g_music->initMusic(); - openFont("P:AvanteG.12", &MsgFont); + MsgFont = g_resource->getFont("P:AvanteG.12"); mouseHide(); diff --git a/engines/lab/intro.cpp b/engines/lab/intro.cpp index 4f1720fe23..2ffddf7dc5 100644 --- a/engines/lab/intro.cpp +++ b/engines/lab/intro.cpp @@ -31,6 +31,7 @@ #include "lab/lab.h" #include "lab/stddefines.h" #include "lab/labfun.h" +#include "lab/resource.h" #include "lab/timing.h" #include "lab/diff.h" #include "lab/text.h" @@ -352,7 +353,7 @@ void introSequence() { blackAllScreen(); g_music->updateMusic(); - getFont("P:Map.fon", msgfont); + msgfont = g_resource->getFont("P:Map.fon"); nopalchange = true; NReadPict("Intro.1", true); diff --git a/engines/lab/labfun.h b/engines/lab/labfun.h index 1db04a8c09..9ed334f431 100644 --- a/engines/lab/labfun.h +++ b/engines/lab/labfun.h @@ -99,7 +99,6 @@ uint32 flowTextToMem(Image *DestIm, void *font, /* the TextAttr pointer */ void drawMessage(const char *text); int32 longDrawMessage(const char *text); -bool readFont(char *filename, void *font, void *data); /* The Wipes */ @@ -255,7 +254,6 @@ char *translateFileName(const char *filename); void fade(bool fadein, uint16 res); void setAmigaPal(uint16 *pal, uint16 numcolors); char *getText(const char *filename); -bool getFont(const char *filename, TextFont *textfont); void readImage(byte **buffer, Image **im); void doMap(uint16 CurRoom); void doJournal(); diff --git a/engines/lab/map.cpp b/engines/lab/map.cpp index 2e3dffc943..34eb018f94 100644 --- a/engines/lab/map.cpp +++ b/engines/lab/map.cpp @@ -37,6 +37,7 @@ #include "lab/mouse.h" #include "lab/parsefun.h" #include "lab/parsetypes.h" +#include "lab/resource.h" #include "lab/interface.h" #include "lab/text.h" @@ -74,44 +75,6 @@ void setAmigaPal(uint16 *pal, uint16 numcolors) { } -/*****************************************************************************/ -/* Gets a font from disk and puts it into temporary memory. */ -/*****************************************************************************/ -bool getFont(const char *filename, TextFont *textfont) { - byte **file = NULL; - char header[5]; - uint32 filesize, headersize = 4L + 2L + 256 * 3 + 4L; - - file = g_music->newOpen(filename, filesize); - g_music->updateMusic(); - - if ((file != NULL) && (filesize > headersize)) { - byte *fontbuffer = (byte *)stealBufMem(filesize - (sizeof(TextFont) + 4)); - if (!fontbuffer) - return false; - - header[4] = 0; - readBlock(&header, 4L, file); - - if (strcmp(header, "VGAF") == 0) { - textfont->DataLength = filesize - headersize; - readBlock(&(textfont->Height), 2L, file); - swapUShortPtr(&(textfont->Height), 1); - - readBlock(textfont->Widths, 256L, file); - readBlock(textfont->Offsets, 256L * 2L, file); - swapUShortPtr(textfont->Offsets, 256); - - (*file) += 4; - textfont->data = fontbuffer; - readBlock(textfont->data, textfont->DataLength, file); - return true; - } - } - - return false; -} - /*****************************************************************************/ /* Gets a chunk of text and puts it into the graphics memory. */ @@ -234,7 +197,7 @@ static bool loadMapData() { BigMsgFont = &bmf; - if (!getFont("P:Map.fon", BigMsgFont)) + if (!(BigMsgFont = g_resource->getFont("P:Map.fon"))) BigMsgFont = MsgFont; resetBuffer(); /* Make images load into start of buffer */ diff --git a/engines/lab/special.cpp b/engines/lab/special.cpp index bedf7215d0..b7f14729a9 100644 --- a/engines/lab/special.cpp +++ b/engines/lab/special.cpp @@ -44,6 +44,7 @@ #include "lab/timing.h" #include "lab/stddefines.h" #include "lab/parsetypes.h" +#include "lab/resource.h" namespace Lab { @@ -474,7 +475,7 @@ void doNotes() { /* Load in the data */ BigMsgFont = &bmfont; - if (!getFont("P:Note.fon", BigMsgFont)) { + if (!(BigMsgFont = g_resource->getFont("P:Note.fon"))) { BigMsgFont = NULL; return; } @@ -500,7 +501,7 @@ void doWestPaper() { BigMsgFont = &bmfont; - if (!getFont("P:News22.fon", BigMsgFont)) { + if (!(BigMsgFont = g_resource->getFont("P:News22.fon"))) { BigMsgFont = NULL; return; } @@ -512,7 +513,7 @@ void doWestPaper() { BigMsgFont = &bmfont; - if (!getFont("P:News32.fon", BigMsgFont)) { + if (!(BigMsgFont = g_resource->getFont("P:News32.fon"))) { BigMsgFont = NULL; return; } @@ -531,7 +532,7 @@ void doWestPaper() { BigMsgFont = &bmfont; - if (!getFont("P:Note.fon", BigMsgFont)) { + if (!(BigMsgFont = g_resource->getFont("P:Note.fon"))) { BigMsgFont = NULL; return; } @@ -562,7 +563,7 @@ static bool loadJournalData() { BigMsgFont = &bmfont; - if (!getFont("P:Journal.fon", BigMsgFont)) { + if (!(BigMsgFont = g_resource->getFont("P:Journal.fon"))) { BigMsgFont = NULL; return false; } @@ -1071,7 +1072,7 @@ void doMonitor(char *background, char *textfile, bool isinteractive, uint16 x1, BigMsgFont = &bmfont; - if (!getFont("P:Map.fon", BigMsgFont)) { + if (!(BigMsgFont = g_resource->getFont("P:Map.fon"))) { freeAllStolenMem(); BigMsgFont = NULL; return; diff --git a/engines/lab/text.cpp b/engines/lab/text.cpp index f31515fa5f..807df45a04 100644 --- a/engines/lab/text.cpp +++ b/engines/lab/text.cpp @@ -37,53 +37,13 @@ namespace Lab { extern uint32 VGAScreenWidth, VGABytesPerPage; -/*****************************************************************************/ -/* Opens up a font from disk. */ -/*****************************************************************************/ -bool openFont(const char *TextFontPath, struct TextFont **tf) { - byte **file = NULL; - char header[5]; - uint32 filesize, headersize = 4L + 2L + 256 * 3 + 4L; - - if ((*tf = (TextFont *)calloc(sizeof(struct TextFont), 1))) { - file = g_music->newOpen(TextFontPath, filesize); - - if ((file != NULL) && (filesize > headersize)) { - header[4] = 0; - readBlock(&header, 4L, file); - - if (strcmp(header, "VGAF") == 0) { - (*tf)->DataLength = filesize - headersize; - readBlock(&((*tf)->Height), 2L, file); - swapUShortPtr(&((*tf)->Height), 1); - - readBlock((*tf)->Widths, 256L, file); - readBlock((*tf)->Offsets, 256L * 2L, file); - swapUShortPtr((*tf)->Offsets, 256); - - (*file) += 4; - - if (((*tf)->data = (byte *)calloc((*tf)->DataLength, 1))) { - readBlock((*tf)->data, (*tf)->DataLength, file); - return true; - } - } - } - - free(*tf); - } - - *tf = NULL; - return false; -} - /*****************************************************************************/ /* Closes a font and frees all memory associated with it. */ /*****************************************************************************/ void closeFont(struct TextFont *tf) { if (tf) { if (tf->data && tf->DataLength) - free(tf->data); + delete[] tf->data; free(tf); } diff --git a/engines/lab/text.h b/engines/lab/text.h index 333f449203..8d171b2094 100644 --- a/engines/lab/text.h +++ b/engines/lab/text.h @@ -52,7 +52,6 @@ struct TextFont { #pragma pack(pop) #endif -bool openFont(const char *TextFontPath, TextFont **tf); void closeFont(TextFont *tf); uint16 textLength(TextFont *tf, const char *text, uint16 numchars); uint16 textHeight(TextFont *tf); -- cgit v1.2.3 From 01dffc75a1fec635879f176f9a62a539269d9adf Mon Sep 17 00:00:00 2001 From: Filippos Karapetis Date: Thu, 8 Oct 2015 06:39:59 +0300 Subject: LAB: Move static text loading to the Resource class --- engines/lab/engine.cpp | 58 ++++++++++------------- engines/lab/graphics.cpp | 4 ++ engines/lab/labfun.h | 1 + engines/lab/labtext.cpp | 113 -------------------------------------------- engines/lab/map.cpp | 29 +++++------- engines/lab/processroom.cpp | 49 +++++-------------- engines/lab/resource.h | 2 +- 7 files changed, 56 insertions(+), 200 deletions(-) diff --git a/engines/lab/engine.cpp b/engines/lab/engine.cpp index 571b72d88d..c1883a0fda 100644 --- a/engines/lab/engine.cpp +++ b/engines/lab/engine.cpp @@ -75,10 +75,6 @@ bool Alternate = false, ispal = false, noupdatediff = false, MainDisplay = true, extern const char *NewFileName; /* When ProcessRoom.c decides to change the filename of the current picture. */ -extern char *LAMPONMSG, *TURNLEFT, *TURNRIGHT; -extern char *GOFORWARDDIR, *NOPATH, *TAKEITEM, *USEONWHAT, *TAKEWHAT, *MOVEWHAT, *OPENWHAT, *CLOSEWHAT, *LOOKWHAT, *NOTHING, *USEMAP, *USEJOURNAL, *TURNLAMPON, *TURNLAMPOFF, *USEWHISKEY, *USEPITH, *USEHELMET; - - #define BUFFERSIZE 850000L /* LAB: Labyrinth specific code for the special puzzles */ @@ -208,7 +204,7 @@ static void drawRoomMessage(uint16 CurInv, CloseDataPtr cptr) { if (Alternate) { if ((CurInv <= NumInv) && g_lab->_conditions->in(CurInv) && Inventory[CurInv].BInvName) { if ((CurInv == LAMPNUM) && g_lab->_conditions->in(LAMPON)) /* LAB: Labyrith specific */ - drawMessage(LAMPONMSG); + drawStaticMessage(kTextLampOn); else if (Inventory[CurInv].Many > 1) { Common::String roomMessage = Common::String(Inventory[CurInv].name) + " (" + Common::String::format("%d", Inventory[CurInv].Many) + ")"; drawMessage(roomMessage.c_str()); @@ -536,7 +532,7 @@ static const char *Test; static bool doUse(uint16 CurInv) { if (CurInv == MAPNUM) { /* LAB: Labyrinth specific */ - drawMessage(USEMAP); + drawStaticMessage(kTextUseMap); interfaceOff(); stopDiff(); CurFileName = " "; @@ -548,7 +544,7 @@ static bool doUse(uint16 CurInv) { } else if (CurInv == JOURNALNUM) { /* LAB: Labyrinth specific */ - drawMessage(USEJOURNAL); + drawStaticMessage(kTextUseJournal); interfaceOff(); stopDiff(); CurFileName = " "; @@ -562,10 +558,10 @@ static bool doUse(uint16 CurInv) { interfaceOff(); if (g_lab->_conditions->in(LAMPON)) { - drawMessage(TURNLAMPOFF); + drawStaticMessage(kTextTurnLampOff); g_lab->_conditions->exclElement(LAMPON); } else { - drawMessage(TURNLAMPON); + drawStaticMessage(kTextTurnLampOn); g_lab->_conditions->inclElement(LAMPON); } @@ -588,17 +584,17 @@ static bool doUse(uint16 CurInv) { else if (CurInv == WHISKEYNUM) { /* LAB: Labyrinth specific */ g_lab->_conditions->inclElement(USEDHELMET); - drawMessage(USEWHISKEY); + drawStaticMessage(kTextUseWhiskey); } else if (CurInv == PITHHELMETNUM) { /* LAB: Labyrinth specific */ g_lab->_conditions->inclElement(USEDHELMET); - drawMessage(USEPITH); + drawStaticMessage(kTextUsePith); } else if (CurInv == HELMETNUM) { /* LAB: Labyrinth specific */ g_lab->_conditions->inclElement(USEDHELMET); - drawMessage(USEHELMET); + drawStaticMessage(kTextUseHelmet); } else @@ -955,15 +951,15 @@ from_crumbs: perFlipGadget(ActionMode); if (GadID == 0) - drawMessage(TAKEWHAT); + drawStaticMessage(kTextTakeWhat); else if (GadID == 1) - drawMessage(MOVEWHAT); + drawStaticMessage(kTextMoveWhat); else if (GadID == 2) - drawMessage(OPENWHAT); + drawStaticMessage(kTextOpenWhat); else if (GadID == 3) - drawMessage(CLOSEWHAT); + drawStaticMessage(kTextCloseWhat); else if (GadID == 4) - drawMessage(LOOKWHAT); + drawStaticMessage(kTextLookWhat); WSDL_UpdateScreen(); } @@ -978,9 +974,9 @@ from_crumbs: if ((GadID == 6) || (GadID == 8)) { if (GadID == 6) - drawMessage(TURNLEFT); + drawStaticMessage(kTextTurnLeft); else - drawMessage(TURNRIGHT); + drawStaticMessage(kTextTurnRight); CurFileName = " "; @@ -1006,13 +1002,13 @@ from_crumbs: processArrow(&Direction, GadID - 6); if (OldRoomNum != RoomNum) { - drawMessage(GOFORWARDDIR); + drawStaticMessage(kTextGoForward); g_lab->_roomsFound->inclElement(RoomNum); /* Potentially entered a new room */ CurFileName = " "; ForceDraw = true; } else { DoBlack = true; - drawMessage(NOPATH); + drawStaticMessage(kTextNoPath); } } @@ -1117,7 +1113,7 @@ from_crumbs: if (Old < 5) perFlipGadget(Old); - drawMessage(USEONWHAT); + drawStaticMessage(kTextUseOnWhat); MainDisplay = true; WSDL_UpdateScreen(); @@ -1211,13 +1207,13 @@ from_crumbs: if (doActionRule(MouseX, MouseY, ActionMode, RoomNum, &CPtr)) CurFileName = NewFileName; else if (takeItem(MouseX, MouseY, &CPtr)) - drawMessage(TAKEITEM); + drawStaticMessage(kTextTakeItem); else if (doActionRule(MouseX, MouseY, TAKEDEF - 1, RoomNum, &CPtr)) CurFileName = NewFileName; else if (doActionRule(MouseX, MouseY, TAKE - 1, 0, &CPtr)) CurFileName = NewFileName; else if (MouseY < (VGAScaleY(149) + SVGACord(2))) - drawMessage(NOTHING); + drawStaticMessage(kTextNothing); } else if ((ActionMode == 1) /* Manipulate an object */ || (ActionMode == 2) /* Open up a "door" */ || (ActionMode == 3)) { /* Close a "door" */ @@ -1225,7 +1221,7 @@ from_crumbs: CurFileName = NewFileName; else if (!doActionRule(MouseX, MouseY, ActionMode, 0, &CPtr)) { if (MouseY < (VGAScaleY(149) + SVGACord(2))) - drawMessage(NOTHING); + drawStaticMessage(kTextNothing); } } else if (ActionMode == 4) { /* Look at closeups */ TempCPtr = CPtr; @@ -1233,15 +1229,15 @@ from_crumbs: if (CPtr == TempCPtr) { if (MouseY < (VGAScaleY(149) + SVGACord(2))) - drawMessage(NOTHING); + drawStaticMessage(kTextNothing); } else if (TempCPtr->GraphicName) { if (*(TempCPtr->GraphicName)) { DoBlack = true; CPtr = TempCPtr; } else if (MouseY < (VGAScaleY(149) + SVGACord(2))) - drawMessage(NOTHING); + drawStaticMessage(kTextNothing); } else if (MouseY < (VGAScaleY(149) + SVGACord(2))) - drawMessage(NOTHING); + drawStaticMessage(kTextNothing); } else if ((ActionMode == 5) && g_lab->_conditions->in(CurInv)) { /* Use an item on something else */ if (doOperateRule(MouseX, MouseY, CurInv, &CPtr)) { @@ -1250,7 +1246,7 @@ from_crumbs: if (!g_lab->_conditions->in(CurInv)) decIncInv(&CurInv, false); } else if (MouseY < (VGAScaleY(149) + SVGACord(2))) - drawMessage(NOTHING); + drawStaticMessage(kTextNothing); } } @@ -1356,8 +1352,7 @@ void LabEngine::go() { initMouse(); - mem = mem && initRoomBuffer() && - initLabText(); + mem = mem && initRoomBuffer(); if (!dointro) g_music->initMusic(); @@ -1399,7 +1394,6 @@ void LabEngine::go() { closeFont(MsgFont); - freeLabText(); freeRoomBuffer(); freeBuffer(); diff --git a/engines/lab/graphics.cpp b/engines/lab/graphics.cpp index 23e587c047..c8d23e97ce 100644 --- a/engines/lab/graphics.cpp +++ b/engines/lab/graphics.cpp @@ -37,6 +37,7 @@ #include "lab/mouse.h" #include "lab/vga.h" #include "lab/text.h" +#include "lab/resource.h" namespace Lab { @@ -366,6 +367,9 @@ int32 longDrawMessage(const char *str) { +void drawStaticMessage(byte index) { + drawMessage(g_resource->getStaticText((StaticText)index).c_str()); +} /******************************************************************************/ /* Draws a message to the message box. */ diff --git a/engines/lab/labfun.h b/engines/lab/labfun.h index 9ed334f431..3a77855f17 100644 --- a/engines/lab/labfun.h +++ b/engines/lab/labfun.h @@ -98,6 +98,7 @@ uint32 flowTextToMem(Image *DestIm, void *font, /* the TextAttr pointer */ uint16 y1, uint16 x2, uint16 y2, const char *text); /* The text itself */ void drawMessage(const char *text); +void drawStaticMessage(byte index); int32 longDrawMessage(const char *text); /* The Wipes */ diff --git a/engines/lab/labtext.cpp b/engines/lab/labtext.cpp index 568ad828bf..9955c43b70 100644 --- a/engines/lab/labtext.cpp +++ b/engines/lab/labtext.cpp @@ -37,119 +37,6 @@ static uint32 SizeOfMemChunk; static char *BeginOfMemChunk, *CurPlace; -char *LOWERFLOORS, *MIDDLEFLOORS, *UPPERFLOORS, *MEDMAZEFLOORS, *HEDGEMAZEFLOORS, *SURMAZEFLOORS, *CARNIVALFLOOR, *SURMAZEMSG, *FACINGNORTH, *FACINGEAST, *FACINGSOUTH, *FACINGWEST, *LAMPONMSG, *TURNLEFT, *TURNRIGHT, *GOFORWARDDIR, *NOPATH, *TAKEITEM, *SAVETEXT, *LOADTEXT, *BOOKMARKTEXT, *PERSONALTEXT, *DISKTEXT, *SAVEBOOK, *RESTOREBOOK, *SAVEFLASH, *RESTOREFLASH, *SAVEDISK, *RESTOREDISK, *NODISKINDRIVE, *WRITEPROTECTED, *SELECTDISK, *FORMATFLOPPY, *FORMATTING, *NOTHING, *USEONWHAT, *TAKEWHAT, *MOVEWHAT, *OPENWHAT, *CLOSEWHAT, *LOOKWHAT, *USEMAP, *USEJOURNAL, *TURNLAMPON, *TURNLAMPOFF, *USEWHISKEY, *USEPITH, *USEHELMET; - - -#define LABTEXTFILE "Lab:Rooms/LabText" - - - - -/*****************************************************************************/ -/* Gets the next string from the list, and changes the end of string marker */ -/* from an end of line to a null character. */ -/*****************************************************************************/ -static void setString(char **string) { - *string = CurPlace; - - while (*CurPlace != '\n') - CurPlace++; - - *CurPlace = 0; - CurPlace++; -} - - - -/*****************************************************************************/ -/* Initializes everything for the Labyrinth text stuff */ -/*****************************************************************************/ -bool initLabText() { - Common::File *file = openPartial(LABTEXTFILE); - if (!file) - return false; - - SizeOfMemChunk = file->size(); - if (!SizeOfMemChunk || !(BeginOfMemChunk = (char *)calloc(SizeOfMemChunk, 1))) - return false; - - file->read(BeginOfMemChunk, SizeOfMemChunk); - file->close(); - - CurPlace = BeginOfMemChunk; - - setString(&LOWERFLOORS); - setString(&MIDDLEFLOORS); - setString(&UPPERFLOORS); - setString(&MEDMAZEFLOORS); - setString(&HEDGEMAZEFLOORS); - setString(&SURMAZEFLOORS); - setString(&CARNIVALFLOOR); - setString(&SURMAZEMSG); - - setString(&FACINGNORTH); - setString(&FACINGEAST); - setString(&FACINGSOUTH); - setString(&FACINGWEST); - - setString(&LAMPONMSG); - - setString(&TURNLEFT); - setString(&TURNRIGHT); - setString(&GOFORWARDDIR); - setString(&NOPATH); - setString(&TAKEITEM); - - setString(&SAVETEXT); - setString(&LOADTEXT); - setString(&BOOKMARKTEXT); - setString(&PERSONALTEXT); - setString(&DISKTEXT); - - setString(&SAVEBOOK); - setString(&RESTOREBOOK); - setString(&SAVEFLASH); - setString(&RESTOREFLASH); - setString(&SAVEDISK); - setString(&RESTOREDISK); - setString(&NODISKINDRIVE); - setString(&WRITEPROTECTED); - setString(&SELECTDISK); - - setString(&FORMATFLOPPY); - setString(&FORMATTING); - - setString(&NOTHING); - setString(&USEONWHAT); - setString(&TAKEWHAT); - setString(&MOVEWHAT); - setString(&OPENWHAT); - setString(&CLOSEWHAT); - setString(&LOOKWHAT); - - setString(&USEMAP); - setString(&USEJOURNAL); - setString(&TURNLAMPON); - setString(&TURNLAMPOFF); - setString(&USEWHISKEY); - setString(&USEPITH); - setString(&USEHELMET); - - return true; -} - - -/*****************************************************************************/ -/* Frees the memory from the Labyrinth text stuff. */ -/*****************************************************************************/ -void freeLabText() { - if (SizeOfMemChunk && BeginOfMemChunk) - free(BeginOfMemChunk); -} - - - - /*****************************************************************************/ /* Decrypts a chunk of text. */ /*****************************************************************************/ diff --git a/engines/lab/map.cpp b/engines/lab/map.cpp index 34eb018f94..06a0ac18d7 100644 --- a/engines/lab/map.cpp +++ b/engines/lab/map.cpp @@ -616,47 +616,42 @@ static void drawMap(uint16 CurRoom, uint16 CurMsg, uint16 Floor, bool fadeout, b if (Floor == LOWERFLOOR) { if (onFloor(SURMAZEFLOOR)) drawImage(Maze, mapScaleX(538), mapScaleY(277)); - } - - else if (Floor == MIDDLEFLOOR) { + } else if (Floor == MIDDLEFLOOR) { if (onFloor(CARNIVAL)) drawImage(Maze, mapScaleX(358), mapScaleY(72)); if (onFloor(MEDMAZEFLOOR)) drawImage(Maze, mapScaleX(557), mapScaleY(325)); - } - - else if (Floor == UPPERFLOOR) { + } else if (Floor == UPPERFLOOR) { if (onFloor(HEDGEMAZEFLOOR)) drawImage(HugeMaze, mapScaleX(524), mapScaleY(97)); - } - - else if (Floor == SURMAZEFLOOR) { - flowText(MsgFont, 0, 7, 0, true, true, true, true, mapScaleX(360), 0, mapScaleX(660), mapScaleY(450), SURMAZEMSG); + } else if (Floor == SURMAZEFLOOR) { + sptr = (char *)g_resource->getStaticText(kTextSurmazeMessage).c_str(); + flowText(MsgFont, 0, 7, 0, true, true, true, true, mapScaleX(360), 0, mapScaleX(660), mapScaleY(450), sptr); } switch (Floor) { case LOWERFLOOR: - sptr = LOWERFLOORS; + sptr = (char *)g_resource->getStaticText(kTextLowerFloor).c_str(); break; case MIDDLEFLOOR: - sptr = MIDDLEFLOORS; + sptr = (char *)g_resource->getStaticText(kTextMiddleFloor).c_str(); break; case UPPERFLOOR: - sptr = UPPERFLOORS; + sptr = (char *)g_resource->getStaticText(kTextUpperFloor).c_str(); break; case MEDMAZEFLOOR: - sptr = MEDMAZEFLOORS; + sptr = (char *)g_resource->getStaticText(kTextMedMazeFloor).c_str(); break; case HEDGEMAZEFLOOR: - sptr = HEDGEMAZEFLOORS; + sptr = (char *)g_resource->getStaticText(kTextHedgeMazeFloor).c_str(); break; case SURMAZEFLOOR: - sptr = SURMAZEFLOORS; + sptr = (char *)g_resource->getStaticText(kTextSurMazeFloor).c_str(); break; case CARNIVAL: - sptr = CARNIVALFLOOR; + sptr = (char *)g_resource->getStaticText(kTextCarnivalFloor).c_str(); break; default: sptr = NULL; diff --git a/engines/lab/processroom.cpp b/engines/lab/processroom.cpp index 3c5d1f62dd..87f3e58549 100644 --- a/engines/lab/processroom.cpp +++ b/engines/lab/processroom.cpp @@ -35,6 +35,7 @@ #include "lab/labfun.h" #include "lab/parsetypes.h" #include "lab/parsefun.h" +#include "lab/resource.h" #include "lab/timing.h" #include "lab/diff.h" #include "lab/vga.h" @@ -55,7 +56,6 @@ extern bool DoNotDrawMessage, IsBM, noupdatediff, QuitLab, MusicOn, DoBlack, Lon extern char diffcmap[256 * 3]; extern const char *CurFileName; extern CloseDataPtr CPtr; -extern char *FACINGNORTH, *FACINGEAST, *FACINGSOUTH, *FACINGWEST; /*****************************************************************************/ /* Generates a random number. */ @@ -195,53 +195,28 @@ char *getPictName(CloseDataPtr *LCPtr) { /* Draws the current direction to the screen. */ /*****************************************************************************/ void drawDirection(CloseDataPtr LCPtr) { - char Message[250]; - - if (LCPtr != NULL) { - if (LCPtr->Message) { - drawMessage(LCPtr->Message); - return; - } + if (LCPtr != NULL && LCPtr->Message) { + drawMessage(LCPtr->Message); + return; } - - Message[0] = '\0'; + Common::String message; if (Rooms[RoomNum].RoomMsg) { - strcpy(Message, Rooms[RoomNum].RoomMsg); - strcat(Message, ", "); + message += Rooms[RoomNum].RoomMsg; + message += ", "; } if (Direction == NORTH) - strcat(Message, FACINGNORTH); + message += g_resource->getStaticText(kTextFacingNorth); else if (Direction == EAST) - strcat(Message, FACINGEAST); + message += g_resource->getStaticText(kTextFacingEast); else if (Direction == SOUTH) - strcat(Message, FACINGSOUTH); + message += g_resource->getStaticText(kTextFacingSouth); else if (Direction == WEST) - strcat(Message, FACINGWEST); - - drawMessage(Message); -} - -void getRoomMessage(int MyRoomNum, int MyDirection, char *msg) { - getViewData(MyRoomNum, MyDirection); - - msg[0] = '\0'; - - if (Rooms[MyRoomNum].RoomMsg) { - strcpy(msg, Rooms[MyRoomNum].RoomMsg); - strcat(msg, ", "); - } + message += g_resource->getStaticText(kTextFacingWest); - if (MyDirection == NORTH) - strcat(msg, FACINGNORTH); - else if (MyDirection == EAST) - strcat(msg, FACINGEAST); - else if (MyDirection == SOUTH) - strcat(msg, FACINGSOUTH); - else if (MyDirection == WEST) - strcat(msg, FACINGWEST); + drawMessage(message.c_str()); } /*****************************************************************************/ diff --git a/engines/lab/resource.h b/engines/lab/resource.h index 9bcd638c7f..59240a3505 100644 --- a/engines/lab/resource.h +++ b/engines/lab/resource.h @@ -102,7 +102,7 @@ public: bool readInventory(const char *fileName); bool readViews(uint16 roomNum); TextFont *getFont(const char *filename); - Common::String getStaticText(byte index) const { return _staticText[index + 1]; } + Common::String getStaticText(byte index) const { return _staticText[index]; } private: Common::File *openDataFile(const char * fileName, uint32 fileHeader); -- cgit v1.2.3 From 92bb4a522abb2f707fd94a529e7e384203ca2b88 Mon Sep 17 00:00:00 2001 From: Filippos Karapetis Date: Thu, 8 Oct 2015 06:46:33 +0300 Subject: LAB: Replace readRoomData() and readInventory() --- engines/lab/engine.cpp | 4 +-- engines/lab/readparse.cpp | 89 ----------------------------------------------- 2 files changed, 2 insertions(+), 91 deletions(-) diff --git a/engines/lab/engine.cpp b/engines/lab/engine.cpp index c1883a0fda..f7f65e24b1 100644 --- a/engines/lab/engine.cpp +++ b/engines/lab/engine.cpp @@ -673,8 +673,8 @@ static void mainGameLoop() { RoomNum = 1; Direction = NORTH; - readRoomData("LAB:Doors"); - readInventory("LAB:Inventor"); + g_resource->readRoomData("LAB:Doors"); + g_resource->readInventory("LAB:Inventor"); if (!(g_lab->_conditions = new LargeSet(HighestCondition + 1))) return; diff --git a/engines/lab/readparse.cpp b/engines/lab/readparse.cpp index 3d3c270c31..624f7a3b89 100644 --- a/engines/lab/readparse.cpp +++ b/engines/lab/readparse.cpp @@ -57,49 +57,6 @@ static bool rallocate(void **Ptr, uint32 Size) { -/*****************************************************************************/ -/* Reads in the RoomData. */ -/*****************************************************************************/ -bool readRoomData(const char *fileName) { - byte **file; - uint16 Counter; - char Temp[5]; - - if ((file = g_music->newOpen(fileName)) != NULL) { - readBlock(Temp, 4L, file); - Temp[4] = '\0'; - - if (strcmp(Temp, "DOR1") != 0) - return false; - - readBlock(&ManyRooms, 2L, file); - swapUShortPtr(&ManyRooms, 1); - readBlock(&HighestCondition, 2L, file); - swapUShortPtr(&HighestCondition, 1); - - if ((Rooms = (RoomData *)calloc(ManyRooms + 1, sizeof(RoomData)))) { - for (Counter = 1; Counter <= ManyRooms; Counter++) { - readBlock(&(Rooms[Counter].NorthDoor), 2L, file); - readBlock(&(Rooms[Counter].SouthDoor), 2L, file); - readBlock(&(Rooms[Counter].EastDoor), 2L, file); - readBlock(&(Rooms[Counter].WestDoor), 2L, file); - - swapUShortPtr(&(Rooms[Counter].NorthDoor), 1); - swapUShortPtr(&(Rooms[Counter].SouthDoor), 1); - swapUShortPtr(&(Rooms[Counter].EastDoor), 1); - swapUShortPtr(&(Rooms[Counter].WestDoor), 1); - - readBlock(&(Rooms[Counter].WipeType), 1L, file); - } - } else - return false; - } else - return false; - - return true; -} - - /*****************************************************************************/ /* Reads in a NULL terminated string, and allocates memory for it. */ /*****************************************************************************/ @@ -128,52 +85,6 @@ static bool readString(char **string, byte **file) { } -/*****************************************************************************/ -/* Reads in the Inventory data. */ -/*****************************************************************************/ -bool readInventory(const char *fileName) { - byte **file; - uint16 Counter; - char Temp[5]; - - if ((file = g_music->newOpen(fileName)) != NULL) { - readBlock(Temp, 4L, file); - Temp[4] = '\0'; - - if (strcmp(Temp, "INV1") != 0) - return false; - - readBlock(&NumInv, 2L, file); - swapUShortPtr(&NumInv, 1); - - UseMemory = true; - - if (rallocate((void **) &Inventory, (NumInv + 1) * sizeof(InventoryData))) { - for (Counter = 1; Counter <= NumInv; Counter++) { - readBlock(&(Inventory[Counter].Many), 2L, file); - swapUShortPtr(&(Inventory[Counter].Many), 1); - - if (!readString(&(Inventory[Counter].name), file)) { - UseMemory = false; - return false; - } - - if (!readString(&(Inventory[Counter].BInvName), file)) { - UseMemory = false; - return false; - } - } - } else { - UseMemory = false; - return false; - } - } else - return false; - - UseMemory = false; - return true; -} - /*****************************************************************************/ /* Reads in a list of conditions. */ /*****************************************************************************/ -- cgit v1.2.3 From ef62422e59d691c944838f9da3ac868821d4797c Mon Sep 17 00:00:00 2001 From: Thierry Crozat Date: Wed, 16 Dec 2015 20:41:52 +0000 Subject: OSX: Fix menus when using SDL2 We remove the menus added by SDL before inserting our own menus, but the code assumed that there were two SDL generated menus. SDL2 actually adds three menus. So the new code makes no assumptions on the number of menus so that it works with both SDL1.2 and SDL2. Also fix an issue on OS X 10.4 and earlier that caused the app menu to be nameless. --- backends/platform/sdl/macosx/appmenu_osx.mm | 25 ++++++++++++++++++------- 1 file changed, 18 insertions(+), 7 deletions(-) diff --git a/backends/platform/sdl/macosx/appmenu_osx.mm b/backends/platform/sdl/macosx/appmenu_osx.mm index d083fb8483..feea40bc06 100644 --- a/backends/platform/sdl/macosx/appmenu_osx.mm +++ b/backends/platform/sdl/macosx/appmenu_osx.mm @@ -28,12 +28,22 @@ #include -// Apple removed setAppleMenu from the header files in 10.4, -// but as the method still exists we declare it ourselves here. +// Apple added setAppleMenu in 10.5 and removed it in 10.6. +// But as the method still exists we declare it ourselves here. // Yes, this works :) @interface NSApplication(MissingFunction) - (void)setAppleMenu:(NSMenu *)menu; @end +// However maybe we should conditionally use it depending on the system on which we run ScummVM (and not +// the one on which we compile) to only do it on OS X 10.5. +// Here is the relevant bit from the release notes for 10.6: +// In Leopard and earlier, apps that tried to construct a menu bar without a nib would get an undesirable +// stubby application menu that could not be removed. To work around this problem on Leopard, you can call +// the undocumented setAppleMenu: method and pass it the application menu, like so: +// [NSApp setAppleMenu:[[[NSApp mainMenu] itemAtIndex:0] submenu]]; +// In SnowLeopard, this workaround is unnecessary and should not be used. Under SnowLeopard, the first menu +// is always identified as the application menu. + NSString *constructNSStringFromCString(const char *rawCString, CFStringEncoding stringEncoding) { return (NSString *)CFStringCreateWithCString(NULL, rawCString, stringEncoding); @@ -46,13 +56,14 @@ void replaceApplicationMenuItems() { NSMenu *windowMenu; NSMenuItem *menuItem; - // For some reason [[NSApp mainMenu] removeAllItems] doesn't work and crashes, so we need - // to remove the SDL generated menus one by one - [[NSApp mainMenu] removeItemAtIndex:0]; // Remove application menu - [[NSApp mainMenu] removeItemAtIndex:0]; // Remove "Windows" menu + // We cannot use [[NSApp mainMenu] removeAllItems] as removeAllItems was added in OS X 10.6 + // So remove the SDL generated menus one by one instead. + while ([[NSApp mainMenu] numberOfItems] > 0) { + [[NSApp mainMenu] removeItemAtIndex:0]; + } // Create new application menu - appleMenu = [[NSMenu alloc] initWithTitle:@""]; + appleMenu = [[NSMenu alloc] initWithTitle:@"ScummVM"]; NSString *nsString = NULL; -- cgit v1.2.3 From 366e164705a920ccd5de9dc606399f9c5b54913c Mon Sep 17 00:00:00 2001 From: Johannes Schickel Date: Fri, 18 Dec 2015 19:08:26 +0100 Subject: SDL: Implement initial support for resizable window with SDL2. The code is disabled for now. --- .../graphics/surfacesdl/surfacesdl-graphics.cpp | 59 +++++++++++++++------- backends/graphics/surfacesdl/surfacesdl-graphics.h | 13 +++++ 2 files changed, 55 insertions(+), 17 deletions(-) diff --git a/backends/graphics/surfacesdl/surfacesdl-graphics.cpp b/backends/graphics/surfacesdl/surfacesdl-graphics.cpp index b2da47110b..2b9d3aa100 100644 --- a/backends/graphics/surfacesdl/surfacesdl-graphics.cpp +++ b/backends/graphics/surfacesdl/surfacesdl-graphics.cpp @@ -2367,6 +2367,14 @@ void SurfaceSdlGraphicsManager::notifyVideoExpose() { _forceFull = true; } +#ifdef USE_SDL_RESIZABLE_WINDOW +void SurfaceSdlGraphicsManager::notifyResize(const uint width, const uint height) { +#if SDL_VERSION_ATLEAST(2, 0, 0) + setWindowResolution(width, height); +#endif +} +#endif + void SurfaceSdlGraphicsManager::transformMouseCoordinates(Common::Point &point) { #if SDL_VERSION_ATLEAST(2, 0, 0) // In SDL2 the actual output resolution might be different from what we @@ -2402,21 +2410,10 @@ void SurfaceSdlGraphicsManager::deinitializeRenderer() { _window->destroyWindow(); } -SDL_Surface *SurfaceSdlGraphicsManager::SDL_SetVideoMode(int width, int height, int bpp, Uint32 flags) { - deinitializeRenderer(); - - const bool isFullscreen = (flags & SDL_FULLSCREEN) != 0; - if (!_window->createWindow(width, height, isFullscreen ? SDL_WINDOW_FULLSCREEN_DESKTOP : 0)) { - return nullptr; - } +void SurfaceSdlGraphicsManager::setWindowResolution(int width, int height) { + _windowWidth = width; + _windowHeight = height; - _renderer = SDL_CreateRenderer(_window->getSDLWindow(), -1, 0); - if (!_renderer) { - deinitializeRenderer(); - return nullptr; - } - - SDL_GetWindowSize(_window->getSDLWindow(), &_windowWidth, &_windowHeight); // We expect full screen resolution as inputs coming from the event system. _eventSource->resetKeyboadEmulation(_windowWidth - 1, _windowHeight - 1); @@ -2425,7 +2422,7 @@ SDL_Surface *SurfaceSdlGraphicsManager::SDL_SetVideoMode(int width, int height, // this case, we add black bars if necessary to assure the aspect ratio // is preserved. const frac_t outputAspect = intToFrac(_windowWidth) / _windowHeight; - const frac_t desiredAspect = intToFrac(width) / height; + const frac_t desiredAspect = intToFrac(_videoMode.hardwareWidth) / _videoMode.hardwareHeight; _viewport.w = _windowWidth; _viewport.h = _windowHeight; @@ -2433,15 +2430,43 @@ SDL_Surface *SurfaceSdlGraphicsManager::SDL_SetVideoMode(int width, int height, // Adjust one dimension for mantaining the aspect ratio. if (abs(outputAspect - desiredAspect) >= (int)(FRAC_ONE / 1000)) { if (outputAspect < desiredAspect) { - _viewport.h = height * _windowWidth / width; + _viewport.h = _videoMode.hardwareHeight * _windowWidth / _videoMode.hardwareWidth; } else if (outputAspect > desiredAspect) { - _viewport.w = width * _windowHeight / height; + _viewport.w = _videoMode.hardwareWidth * _windowHeight / _videoMode.hardwareHeight; } } _viewport.x = (_windowWidth - _viewport.w) / 2; _viewport.y = (_windowHeight - _viewport.h) / 2; + // Force a full redraw because we changed the viewport. + _forceFull = true; +} + +SDL_Surface *SurfaceSdlGraphicsManager::SDL_SetVideoMode(int width, int height, int bpp, Uint32 flags) { + deinitializeRenderer(); + + uint32 createWindowFlags = 0; +#ifdef USE_SDL_RESIZABLE_WINDOW + createWindowFlags |= SDL_WINDOW_RESIZABLE; +#endif + if ((flags & SDL_FULLSCREEN) != 0) { + createWindowFlags |= SDL_WINDOW_FULLSCREEN_DESKTOP; + } + + if (!_window->createWindow(width, height, createWindowFlags)) { + return nullptr; + } + + _renderer = SDL_CreateRenderer(_window->getSDLWindow(), -1, 0); + if (!_renderer) { + deinitializeRenderer(); + return nullptr; + } + + SDL_GetWindowSize(_window->getSDLWindow(), &_windowWidth, &_windowHeight); + setWindowResolution(_windowWidth, _windowHeight); + _screenTexture = SDL_CreateTexture(_renderer, SDL_PIXELFORMAT_RGB565, SDL_TEXTUREACCESS_STREAMING, width, height); if (!_screenTexture) { deinitializeRenderer(); diff --git a/backends/graphics/surfacesdl/surfacesdl-graphics.h b/backends/graphics/surfacesdl/surfacesdl-graphics.h index ac9844c849..c4f7346525 100644 --- a/backends/graphics/surfacesdl/surfacesdl-graphics.h +++ b/backends/graphics/surfacesdl/surfacesdl-graphics.h @@ -39,6 +39,15 @@ #define USE_SDL_DEBUG_FOCUSRECT #endif +// We have (some) support for resizable windows when SDL2 is used. However +// the overlay still uses the resolution setup with SDL_SetVideoMode. This +// makes the GUI look subpar when the user resizes the window. In addition +// we do not adapt the scale factor right now. Thus, we disable this code +// path for now. +#if SDL_VERSION_ATLEAST(2, 0, 0) && 0 +#define USE_SDL_RESIZABLE_WINDOW +#endif + #if !defined(_WIN32_WCE) && !defined(__SYMBIAN32__) // Uncomment this to enable the 'on screen display' code. #define USE_OSD 1 @@ -143,6 +152,9 @@ public: // SdlGraphicsManager interface virtual void notifyVideoExpose(); +#ifdef USE_SDL_RESIZABLE_WINDOW + virtual void notifyResize(const uint width, const uint height); +#endif virtual void transformMouseCoordinates(Common::Point &point); virtual void notifyMousePos(Common::Point mouse); @@ -174,6 +186,7 @@ protected: SDL_Rect _viewport; int _windowWidth, _windowHeight; void deinitializeRenderer(); + void setWindowResolution(int width, int height); SDL_Surface *SDL_SetVideoMode(int width, int height, int bpp, Uint32 flags); void SDL_UpdateRects(SDL_Surface *screen, int numrects, SDL_Rect *rects); -- cgit v1.2.3 From 582c726f4cc13edbf8bd3e0d4663a9819975e954 Mon Sep 17 00:00:00 2001 From: Willem Jan Palenstijn Date: Sun, 20 Dec 2015 18:23:18 +0100 Subject: CONFIGURE: Always disable have_gcc when using Intel compiler This fixes configure if icc is set to gcc-compatibility mode, which is the default. --- configure | 26 ++++++++++++++++---------- 1 file changed, 16 insertions(+), 10 deletions(-) diff --git a/configure b/configure index d28b41163f..e0d412daad 100755 --- a/configure +++ b/configure @@ -1686,23 +1686,33 @@ LD=$CXX # echocheck "compiler version" -# We first check whether we have an Intel compiler here, since the Intel compiler -# can also fake itself as an gcc (to ease compatibility with common Linux etc. -# programs). +# Some compilers pretend to be gcc to ease compatibility with +# common Linux etc. programs. We first check for some of these here. +have_gcc=no +cc_check_define __GNUC__ && have_gcc=yes have_icc=no cc_check_define __INTEL_COMPILER && have_icc=yes +have_clang=no +cc_check_define __clang__ && have_clang=yes if test "$have_icc" = yes; then add_line_to_config_mk 'HAVE_ICC = 1' - # Make ICC error our on unknown command line options instead of printing + # Make ICC error out on unknown command line options instead of printing # a warning. This is for example required to make the -Wglobal-destructors # detection work correctly. append_var CXXFLAGS "-diag-error 10006,10148" + + # ICC doesn't accept all gcc options, so we disable have_gcc, even if + # ICC does have the gcc-compatibility defines. + have_gcc=no fi -have_gcc=no -cc_check_define __GNUC__ && have_gcc=yes +if test "$have_clang" = yes; then + add_line_to_config_mk 'HAVE_CLANG = 1' + + # clang does accept all gcc options we use, so we keep have_gcc +fi if test "$have_gcc" = yes; then add_line_to_config_mk 'HAVE_GCC = 1' @@ -1710,10 +1720,6 @@ if test "$have_gcc" = yes; then _cxx_minor=`gcc_get_define __GNUC_MINOR__` cxx_version="`( $CXX -dumpversion ) 2>&1`" - if test -n "`gcc_get_define __clang__`"; then - add_line_to_config_mk 'HAVE_CLANG = 1' - fi - if test "$_cxx_major" -eq 2 && test "$_cxx_minor" -ge 95 || \ test "$_cxx_major" -gt 2 ; then cxx_version="$cxx_version, ok" -- cgit v1.2.3 From d28ec8a4a480246ff6a4f18e5fd9659ed8bb1747 Mon Sep 17 00:00:00 2001 From: Willem Jan Palenstijn Date: Sun, 20 Dec 2015 18:35:41 +0100 Subject: CONFIGURE: Report clang compiler version Our previous code printed the gcc version clang is pretending to be. --- configure | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/configure b/configure index e0d412daad..e1ee583b9c 100755 --- a/configure +++ b/configure @@ -1720,7 +1720,17 @@ if test "$have_gcc" = yes; then _cxx_minor=`gcc_get_define __GNUC_MINOR__` cxx_version="`( $CXX -dumpversion ) 2>&1`" - if test "$_cxx_major" -eq 2 && test "$_cxx_minor" -ge 95 || \ + if test "$have_clang" = yes; then + # Clang sets a gcc version number for compatibility. + # We keep that as _cxx_minor/_cxx_major for later + # compiler version checks. + + # For the version reported in the configure log (cxx_version), + # we get the actual clang version. + cxx_version=`gcc_get_define __clang_version__` + cxx_version="`echo "${cxx_version}" | sed -e 's/"\([^ ]\+\) .*/\1/'`" + cxx_version="clang $cxx_version, ok" + elif test "$_cxx_major" -eq 2 && test "$_cxx_minor" -ge 95 || \ test "$_cxx_major" -gt 2 ; then cxx_version="$cxx_version, ok" cxx_verc_fail=no -- cgit v1.2.3 From d090057f1fd0d117ff8b2799190c207132a3bde5 Mon Sep 17 00:00:00 2001 From: jammm Date: Sat, 12 Dec 2015 03:43:34 +0530 Subject: WINTERMUTE: Add more keyboard mappings, fix console warnings. Add mappings for numpad keys, tab, pause and backspace. Suppressed unnecessary warnings for keys that are text-input. --- engines/wintermute/base/base_keyboard_state.cpp | 46 +++++++++++++++++++++++-- 1 file changed, 44 insertions(+), 2 deletions(-) diff --git a/engines/wintermute/base/base_keyboard_state.cpp b/engines/wintermute/base/base_keyboard_state.cpp index f672c83d39..d26685a256 100644 --- a/engines/wintermute/base/base_keyboard_state.cpp +++ b/engines/wintermute/base/base_keyboard_state.cpp @@ -200,6 +200,12 @@ const char *BaseKeyboardState::scToString() { bool BaseKeyboardState::readKey(Common::Event *event) { //_currentPrintable = (event->type == SDL_TEXTINPUT); // TODO _currentCharCode = keyCodeToVKey(event); + // convert all lowercase keys to uppercase to make it easier for handling later on for consistency + if (Common::isLower(_currentCharCode) && (event->kbd.hasFlags(Common::KBD_SHIFT) || event->kbd.flags & Common::KBD_CAPS)) { + if (!(event->kbd.keycode >= Common::KEYCODE_F1 && event->kbd.keycode <= Common::KEYCODE_F12)) { + _currentCharCode = toupper(_currentCharCode); + } + } // Verify that this is a printable ISO-8859-character (including the upper charset) if ((_currentCharCode <= 0x7E && _currentCharCode >= 0x20) || (_currentCharCode <= 0xFF && _currentCharCode >= 0xA0)) { _currentPrintable = true; @@ -263,7 +269,11 @@ bool BaseKeyboardState::isCurrentPrintable() const { ////////////////////////////////////////////////////////////////////////// enum VKeyCodes { + kVkBack = 8, + kVkTab = 9, + kVkReturn = 13, + kVkPause = 19, kVkEscape = 27, @@ -274,6 +284,7 @@ enum VKeyCodes { kVkUp = 38, kVkRight = 39, kVkDown = 40, + kVkInsert = 45, kVkF1 = 112, kVkF2 = 113, @@ -297,26 +308,53 @@ uint32 BaseKeyboardState::keyCodeToVKey(Common::Event *event) { return 0; } + // return ASCII value if key pressed is an alphanumeric key + // number keys pressed on numpad are handled in next block + if (Common::isAlnum(event->kbd.keycode)) { + return event->kbd.ascii; + } + + // if NumLock is active, return ASCII for numpad keys + // keys pressed on numpad without NumLock are considered as normal keycodes, handled in the next block + if (Common::isDigit(event->kbd.ascii) && ((event->kbd.flags & Common::KBD_NUM) != 0)) { + return event->kbd.ascii; + } + switch (event->kbd.keycode) { + case Common::KEYCODE_BACKSPACE: + return kVkBack; + case Common::KEYCODE_TAB: + return kVkTab; case Common::KEYCODE_RETURN: case Common::KEYCODE_KP_ENTER: return kVkReturn; + case Common::KEYCODE_PAUSE: + return kVkPause; case Common::KEYCODE_ESCAPE: return kVkEscape; case Common::KEYCODE_SPACE: return kVkSpace; case Common::KEYCODE_END: + case Common::KEYCODE_KP1: return kVkEnd; case Common::KEYCODE_HOME: + case Common::KEYCODE_KP7: return kVkHome; case Common::KEYCODE_LEFT: + case Common::KEYCODE_KP4: return kVkLeft; case Common::KEYCODE_RIGHT: + case Common::KEYCODE_KP6: return kVkRight; case Common::KEYCODE_UP: + case Common::KEYCODE_KP8: return kVkUp; case Common::KEYCODE_DOWN: + case Common::KEYCODE_KP2: return kVkDown; + case Common::KEYCODE_INSERT: + case Common::KEYCODE_KP0: + return kVkInsert; case Common::KEYCODE_F1: return kVkF1; case Common::KEYCODE_F2: @@ -342,8 +380,12 @@ uint32 BaseKeyboardState::keyCodeToVKey(Common::Event *event) { case Common::KEYCODE_F12: return kVkF12; default: - warning("Key not handled: %d '%c'", event->kbd.keycode, event->kbd.keycode); - return event->kbd.keycode; + // check if any non-sticky keys were used, otherwise key is unknown to us + if ((event->kbd.flags & Common::KBD_NON_STICKY) == 0) { + warning("Key pressed is not recognized, ASCII returned (%d '%c').", event->kbd.keycode, event->kbd.keycode); + } + // return ASCII if no match, since it could be used for typing + return event->kbd.ascii; break; } -- cgit v1.2.3 From 2d86f6da9c0ee2ffa80a2b570c148ea337b09cec Mon Sep 17 00:00:00 2001 From: Bastien Bouclet Date: Sun, 22 Nov 2015 14:18:14 +0100 Subject: GRAPHICS: Introduce a size mode for TrueType fonts Allows to match Windows font size selection by converting font heights to point sizes using the TrueType tables. --- .../wintermute/base/font/base_font_truetype.cpp | 4 +- engines/zvision/text/truetype_font.cpp | 2 +- graphics/fonts/ttf.cpp | 144 ++++++++++++++++++++- graphics/fonts/ttf.h | 24 +++- gui/ThemeEngine.cpp | 2 +- 5 files changed, 166 insertions(+), 10 deletions(-) diff --git a/engines/wintermute/base/font/base_font_truetype.cpp b/engines/wintermute/base/font/base_font_truetype.cpp index f27b565a7f..fa6973c58f 100644 --- a/engines/wintermute/base/font/base_font_truetype.cpp +++ b/engines/wintermute/base/font/base_font_truetype.cpp @@ -581,7 +581,7 @@ bool BaseFontTT::initFont() { } if (file) { - _deletableFont = Graphics::loadTTFFont(*file, _fontHeight, 96); // Use the same dpi as WME (96 vs 72). + _deletableFont = Graphics::loadTTFFont(*file, _fontHeight, Graphics::kTTFSizeModeCharacter, 96); // Use the same dpi as WME (96 vs 72). _font = _deletableFont; BaseFileManager::getEngineInstance()->closeFile(file); file = nullptr; @@ -607,7 +607,7 @@ bool BaseFontTT::initFont() { if (themeArchive->hasFile(fallbackFilename)) { file = nullptr; file = themeArchive->createReadStreamForMember(fallbackFilename); - _deletableFont = Graphics::loadTTFFont(*file, _fontHeight, 96); // Use the same dpi as WME (96 vs 72). + _deletableFont = Graphics::loadTTFFont(*file, _fontHeight, Graphics::kTTFSizeModeCharacter, 96); // Use the same dpi as WME (96 vs 72). _font = _deletableFont; } // We're not using BaseFileManager, so clean up after ourselves: diff --git a/engines/zvision/text/truetype_font.cpp b/engines/zvision/text/truetype_font.cpp index acb053ea8d..ed4a81a297 100644 --- a/engines/zvision/text/truetype_font.cpp +++ b/engines/zvision/text/truetype_font.cpp @@ -123,7 +123,7 @@ bool StyledTTFont::loadFont(const Common::String &fontName, int32 point, uint st !file.open(freeFontName) && !_engine->getSearchManager()->openFile(file, freeFontName)) error("Unable to open font file %s (Liberation Font alternative: %s, FreeFont alternative: %s)", newFontName.c_str(), liberationFontName.c_str(), freeFontName.c_str()); - Graphics::Font *newFont = Graphics::loadTTFFont(file, point, 60, (sharp ? Graphics::kTTFRenderModeMonochrome : Graphics::kTTFRenderModeNormal)); // 66 dpi for 640 x 480 on 14" display + Graphics::Font *newFont = Graphics::loadTTFFont(file, point, Graphics::kTTFSizeModeCharacter, 60, (sharp ? Graphics::kTTFRenderModeMonochrome : Graphics::kTTFRenderModeNormal)); // 66 dpi for 640 x 480 on 14" display if (newFont == nullptr) { return false; } diff --git a/graphics/fonts/ttf.cpp b/graphics/fonts/ttf.cpp index dc7335f1c2..98420f6dfb 100644 --- a/graphics/fonts/ttf.cpp +++ b/graphics/fonts/ttf.cpp @@ -33,11 +33,15 @@ #include "common/singleton.h" #include "common/stream.h" +#include "common/memstream.h" #include "common/hashmap.h" +#include "common/ptr.h" #include #include FT_FREETYPE_H #include FT_GLYPH_H +#include FT_TRUETYPE_TABLES_H +#include FT_TRUETYPE_TAGS_H namespace Graphics { @@ -47,6 +51,10 @@ inline int ftCeil26_6(FT_Pos x) { return (x + 63) / 64; } +inline int divRoundToNearest(int dividend, int divisor) { + return (dividend + (divisor / 2)) / divisor; +} + } // End of anonymous namespace class TTFLibrary : public Common::Singleton { @@ -101,7 +109,7 @@ public: TTFFont(); virtual ~TTFFont(); - bool load(Common::SeekableReadStream &stream, int size, uint dpi, TTFRenderMode renderMode, const uint32 *mapping); + bool load(Common::SeekableReadStream &stream, int size, TTFSizeMode sizeMode, uint dpi, TTFRenderMode renderMode, const uint32 *mapping); virtual int getFontHeight() const; @@ -137,6 +145,12 @@ private: bool _allowLateCaching; void assureCached(uint32 chr) const; + Common::SeekableReadStream *readTTFTable(FT_ULong tag) const; + + int computePointSize(int size, TTFSizeMode sizeMode) const; + int readPointSizeFromVDMXTable(int height) const; + int computePointSizeFromHeaders(int height) const; + FT_Int32 _loadFlags; FT_Render_Mode _renderMode; bool _hasKerning; @@ -162,7 +176,7 @@ TTFFont::~TTFFont() { } } -bool TTFFont::load(Common::SeekableReadStream &stream, int size, uint dpi, TTFRenderMode renderMode, const uint32 *mapping) { +bool TTFFont::load(Common::SeekableReadStream &stream, int size, TTFSizeMode sizeMode, uint dpi, TTFRenderMode renderMode, const uint32 *mapping) { if (!g_ttf.isInitialized()) return false; @@ -200,7 +214,7 @@ bool TTFFont::load(Common::SeekableReadStream &stream, int size, uint dpi, TTFRe // Check whether we have kerning support _hasKerning = (FT_HAS_KERNING(_face) != 0); - if (FT_Set_Char_Size(_face, 0, size * 64, dpi, dpi)) { + if (FT_Set_Char_Size(_face, 0, computePointSize(size, sizeMode) * 64, dpi, dpi)) { delete[] _ttfFile; _ttfFile = 0; @@ -262,6 +276,126 @@ bool TTFFont::load(Common::SeekableReadStream &stream, int size, uint dpi, TTFRe return _initialized; } +int TTFFont::computePointSize(int size, TTFSizeMode sizeMode) const { + int ptSize; + switch (sizeMode) { + case kTTFSizeModeCell: { + ptSize = readPointSizeFromVDMXTable(size); + + if (ptSize == 0) { + ptSize = computePointSizeFromHeaders(size); + } + + if (ptSize == 0) { + warning("Unable to compute point size for font '%s'", _face->family_name); + ptSize = 1; + } + break; + } + case kTTFSizeModeCharacter: + ptSize = size; + break; + } + + return ptSize; +} + +Common::SeekableReadStream *TTFFont::readTTFTable(FT_ULong tag) const { + // Find the required buffer size by calling the load function with nullptr + FT_ULong size = 0; + FT_Error err = FT_Load_Sfnt_Table(_face, tag, 0, nullptr, &size); + if (err) { + return nullptr; + } + + byte *buf = (byte *)malloc(size); + if (!buf) { + return nullptr; + } + + err = FT_Load_Sfnt_Table(_face, tag, 0, buf, &size); + if (err) { + free(buf); + return nullptr; + } + + return new Common::MemoryReadStream(buf, size, DisposeAfterUse::YES); +} + +int TTFFont::readPointSizeFromVDMXTable(int height) const { + // The Vertical Device Metrics table matches font heights with point sizes. + // FreeType does not expose it, we have to parse it ourselves. + // See https://www.microsoft.com/typography/otspec/vdmx.htm + + Common::ScopedPtr vdmxBuf(readTTFTable(TTAG_VDMX)); + if (!vdmxBuf) { + return 0; + } + + // Read the main header + vdmxBuf->skip(4); // Skip the version + uint16 numRatios = vdmxBuf->readUint16BE(); + + // Compute the starting position for the group table positions table + int32 offsetTableStart = vdmxBuf->pos() + 4 * numRatios; + + // Search the ratio table for the 1:1 ratio, or the default record (0, 0, 0) + int32 selectedRatio = -1; + for (uint16 i = 0; i < numRatios; i++) { + vdmxBuf->skip(1); // Skip the charset subset + uint8 xRatio = vdmxBuf->readByte(); + uint8 yRatio1 = vdmxBuf->readByte(); + uint8 yRatio2 = vdmxBuf->readByte(); + + if ((xRatio == 1 && yRatio1 <= 1 && yRatio2 >= 1) + || (xRatio == 0 && yRatio1 == 0 && yRatio2 == 0)) { + selectedRatio = i; + break; + } + } + if (selectedRatio < 0) { + return 0; + } + + // Read from group table positions table to get the group table offset + vdmxBuf->seek(offsetTableStart + sizeof(uint16) * selectedRatio); + uint16 groupOffset = vdmxBuf->readUint16BE(); + + // Read the group table header + vdmxBuf->seek(groupOffset); + uint16 numRecords = vdmxBuf->readUint16BE(); + vdmxBuf->skip(2); // Skip the table bounds + + // Search a record matching the required height + for (uint16 i = 0; i < numRecords; i++) { + uint16 pointSize = vdmxBuf->readUint16BE(); + int16 yMax = vdmxBuf->readSint16BE(); + int16 yMin = vdmxBuf->readSint16BE(); + + if (yMax + -yMin > height) { + return 0; + } + if (yMax + -yMin == height) { + return pointSize; + } + } + + return 0; +} + +int TTFFont::computePointSizeFromHeaders(int height) const { + TT_OS2 *os2Header = (TT_OS2 *)FT_Get_Sfnt_Table(_face, ft_sfnt_os2); + TT_HoriHeader *horiHeader = (TT_HoriHeader *)FT_Get_Sfnt_Table(_face, ft_sfnt_hhea); + + if (os2Header && (os2Header->usWinAscent + os2Header->usWinDescent != 0)) { + return divRoundToNearest(_face->units_per_EM * height, os2Header->usWinAscent + os2Header->usWinDescent); + } else if (horiHeader && (horiHeader->Ascender + horiHeader->Descender != 0)) { + return divRoundToNearest(_face->units_per_EM * height, horiHeader->Ascender + horiHeader->Descender); + } + + return 0; +} + int TTFFont::getFontHeight() const { return _height; } @@ -521,10 +655,10 @@ void TTFFont::assureCached(uint32 chr) const { } } -Font *loadTTFFont(Common::SeekableReadStream &stream, int size, uint dpi, TTFRenderMode renderMode, const uint32 *mapping) { +Font *loadTTFFont(Common::SeekableReadStream &stream, int size, TTFSizeMode sizeMode, uint dpi, TTFRenderMode renderMode, const uint32 *mapping) { TTFFont *font = new TTFFont(); - if (!font->load(stream, size, dpi, renderMode, mapping)) { + if (!font->load(stream, size, sizeMode, dpi, renderMode, mapping)) { delete font; return 0; } diff --git a/graphics/fonts/ttf.h b/graphics/fonts/ttf.h index bd25b69f21..4110486357 100644 --- a/graphics/fonts/ttf.h +++ b/graphics/fonts/ttf.h @@ -55,11 +55,33 @@ enum TTFRenderMode { kTTFRenderModeMonochrome }; +/** + * This specifies how the font size is defined. + */ +enum TTFSizeMode { + /** + * Character height only. + * + * This matches rendering obtained when calling + * CreateFont in Windows with negative height values. + */ + kTTFSizeModeCharacter, + + /** + * Full cell height. + * + * This matches rendering obtained when calling + * CreateFont in Windows with positive height values. + */ + kTTFSizeModeCell +}; + /** * Loads a TTF font file from a given data stream object. * * @param stream Stream object to load font data from. * @param size The point size to load. + * @param sizeMode The point size definition used for the size parameter. * @param dpi The dpi to use for size calculations, by default 72dpi * are used. * @param renderMode FreeType2 mode used to render glyphs. @see TTFRenderMode @@ -71,7 +93,7 @@ enum TTFRenderMode { * supported. * @return 0 in case loading fails, otherwise a pointer to the Font object. */ -Font *loadTTFFont(Common::SeekableReadStream &stream, int size, uint dpi = 0, TTFRenderMode renderMode = kTTFRenderModeLight, const uint32 *mapping = 0); +Font *loadTTFFont(Common::SeekableReadStream &stream, int size, TTFSizeMode sizeMode = kTTFSizeModeCharacter, uint dpi = 0, TTFRenderMode renderMode = kTTFRenderModeLight, const uint32 *mapping = 0); void shutdownTTF(); diff --git a/gui/ThemeEngine.cpp b/gui/ThemeEngine.cpp index 6562a1d922..536e5192e0 100644 --- a/gui/ThemeEngine.cpp +++ b/gui/ThemeEngine.cpp @@ -1459,7 +1459,7 @@ const Graphics::Font *ThemeEngine::loadScalableFont(const Common::String &filena for (Common::ArchiveMemberList::const_iterator i = members.begin(), end = members.end(); i != end; ++i) { Common::SeekableReadStream *stream = (*i)->createReadStream(); if (stream) { - font = Graphics::loadTTFFont(*stream, pointsize, 0, Graphics::kTTFRenderModeLight, + font = Graphics::loadTTFFont(*stream, pointsize, Graphics::kTTFSizeModeCharacter, 0, Graphics::kTTFRenderModeLight, #ifdef USE_TRANSLATION TransMan.getCharsetMapping() #else -- cgit v1.2.3 From 68be74e0a319bb31b9a934b7fd976c8c250b0260 Mon Sep 17 00:00:00 2001 From: Bastien Bouclet Date: Sun, 22 Nov 2015 14:23:23 +0100 Subject: ZVISION: Use the cell size mode when loading TrueType fonts --- engines/zvision/text/truetype_font.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/engines/zvision/text/truetype_font.cpp b/engines/zvision/text/truetype_font.cpp index ed4a81a297..ccb86d9440 100644 --- a/engines/zvision/text/truetype_font.cpp +++ b/engines/zvision/text/truetype_font.cpp @@ -123,7 +123,7 @@ bool StyledTTFont::loadFont(const Common::String &fontName, int32 point, uint st !file.open(freeFontName) && !_engine->getSearchManager()->openFile(file, freeFontName)) error("Unable to open font file %s (Liberation Font alternative: %s, FreeFont alternative: %s)", newFontName.c_str(), liberationFontName.c_str(), freeFontName.c_str()); - Graphics::Font *newFont = Graphics::loadTTFFont(file, point, Graphics::kTTFSizeModeCharacter, 60, (sharp ? Graphics::kTTFRenderModeMonochrome : Graphics::kTTFRenderModeNormal)); // 66 dpi for 640 x 480 on 14" display + Graphics::Font *newFont = Graphics::loadTTFFont(file, point, Graphics::kTTFSizeModeCell, 0, (sharp ? Graphics::kTTFRenderModeMonochrome : Graphics::kTTFRenderModeNormal)); if (newFont == nullptr) { return false; } -- cgit v1.2.3 From d0d1d6e921ac656243d2b46b4f6512a19f18125d Mon Sep 17 00:00:00 2001 From: Martin Kiewitz Date: Mon, 21 Dec 2015 23:25:58 +0100 Subject: SCI32: add code for kq7 audio+subtitles mode also enables it for gk1 and qfg4 (CD versions) --- engines/sci/detection_tables.h | 14 +++++----- engines/sci/sci.cpp | 60 +++++++++++++++++++++++++++--------------- 2 files changed, 46 insertions(+), 28 deletions(-) diff --git a/engines/sci/detection_tables.h b/engines/sci/detection_tables.h index f6283bf77b..6a08fdc2fe 100644 --- a/engines/sci/detection_tables.h +++ b/engines/sci/detection_tables.h @@ -1651,7 +1651,7 @@ static const struct ADGameDescription SciGameDescriptions[] = { {"resource.000", 0, "4948e4e1506f1e1c4e1d47abfa06b7f8", 204385195}, {"resource.map", 0, "40ccafb2195301504eba2e4f4f2c7f3d", 18925}, AD_LISTEND}, - Common::EN_ANY, Common::kPlatformWindows, ADGF_UNSTABLE, GUIO5(GUIO_NOSPEECH, GUIO_NOASPECT, GAMEOPTION_PREFER_DIGITAL_SFX, GAMEOPTION_ORIGINAL_SAVELOAD, GAMEOPTION_FB01_MIDI) }, + Common::EN_ANY, Common::kPlatformWindows, ADGF_UNSTABLE | ADGF_CD, GUIO4(GUIO_NOASPECT, GAMEOPTION_PREFER_DIGITAL_SFX, GAMEOPTION_ORIGINAL_SAVELOAD, GAMEOPTION_FB01_MIDI) }, // King's Quest 7 - English Windows (from the King's Quest Collection) // Executable scanning reports "2.100.002", VERSION file reports "1.4" @@ -1659,7 +1659,7 @@ static const struct ADGameDescription SciGameDescriptions[] = { {"resource.map", 0, "2be9ab94429c721af8e05c507e048a15", 18697}, {"resource.000", 0, "eb63ea3a2c2469dc2d777d351c626404", 203882535}, AD_LISTEND}, - Common::EN_ANY, Common::kPlatformWindows, ADGF_UNSTABLE, GUIO5(GUIO_NOSPEECH, GUIO_NOASPECT, GAMEOPTION_PREFER_DIGITAL_SFX, GAMEOPTION_ORIGINAL_SAVELOAD, GAMEOPTION_FB01_MIDI) }, + Common::EN_ANY, Common::kPlatformWindows, ADGF_UNSTABLE | ADGF_CD, GUIO4(GUIO_NOASPECT, GAMEOPTION_PREFER_DIGITAL_SFX, GAMEOPTION_ORIGINAL_SAVELOAD, GAMEOPTION_FB01_MIDI) }, // King's Quest 7 - English DOS (from FRG) // SCI interpreter version 2.100.002, VERSION file reports "2.00b" @@ -1667,7 +1667,7 @@ static const struct ADGameDescription SciGameDescriptions[] = { {"resource.map", 0, "8676b0fbbd7362989a029fe72fea14c6", 18709}, {"resource.000", 0, "51c1ead1163e19a2de8f121c39df7a76", 200764100}, AD_LISTEND}, - Common::EN_ANY, Common::kPlatformDOS, ADGF_UNSTABLE, GUIO5(GUIO_NOSPEECH, GUIO_NOASPECT, GAMEOPTION_PREFER_DIGITAL_SFX, GAMEOPTION_ORIGINAL_SAVELOAD, GAMEOPTION_FB01_MIDI) }, + Common::EN_ANY, Common::kPlatformDOS, ADGF_UNSTABLE | ADGF_CD, GUIO4(GUIO_NOASPECT, GAMEOPTION_PREFER_DIGITAL_SFX, GAMEOPTION_ORIGINAL_SAVELOAD, GAMEOPTION_FB01_MIDI) }, // King's Quest 7 - English Windows (from FRG) // SCI interpreter version 2.100.002, VERSION file reports "2.00b" @@ -1675,7 +1675,7 @@ static const struct ADGameDescription SciGameDescriptions[] = { {"resource.map", 0, "8676b0fbbd7362989a029fe72fea14c6", 18709}, {"resource.000", 0, "51c1ead1163e19a2de8f121c39df7a76", 200764100}, AD_LISTEND}, - Common::EN_ANY, Common::kPlatformWindows, ADGF_UNSTABLE, GUIO5(GUIO_NOSPEECH, GUIO_NOASPECT, GAMEOPTION_PREFER_DIGITAL_SFX, GAMEOPTION_ORIGINAL_SAVELOAD, GAMEOPTION_FB01_MIDI) }, + Common::EN_ANY, Common::kPlatformWindows, ADGF_UNSTABLE | ADGF_CD, GUIO4(GUIO_NOASPECT, GAMEOPTION_PREFER_DIGITAL_SFX, GAMEOPTION_ORIGINAL_SAVELOAD, GAMEOPTION_FB01_MIDI) }, // King's Quest 7 - German Windows (supplied by markcoolio in bug report #2727402) // SCI interpreter version 2.100.002 @@ -1683,7 +1683,7 @@ static const struct ADGameDescription SciGameDescriptions[] = { {"resource.map", 0, "838b9ff132bd6962026fee832e8a7ddb", 18697}, {"resource.000", 0, "eb63ea3a2c2469dc2d777d351c626404", 206626576}, AD_LISTEND}, - Common::DE_DEU, Common::kPlatformDOS, ADGF_UNSTABLE, GUIO5(GUIO_NOSPEECH, GUIO_NOASPECT, GAMEOPTION_PREFER_DIGITAL_SFX, GAMEOPTION_ORIGINAL_SAVELOAD, GAMEOPTION_FB01_MIDI) }, + Common::DE_DEU, Common::kPlatformDOS, ADGF_UNSTABLE | ADGF_CD, GUIO4(GUIO_NOASPECT, GAMEOPTION_PREFER_DIGITAL_SFX, GAMEOPTION_ORIGINAL_SAVELOAD, GAMEOPTION_FB01_MIDI) }, // King's Quest 7 - Spanish DOS (from jvprat) // Executable scanning reports "2.100.002", VERSION file reports "2.00" @@ -1691,7 +1691,7 @@ static const struct ADGameDescription SciGameDescriptions[] = { {"resource.map", 0, "0b62693cbe87e3aaca3e8655a437f27f", 18709}, {"resource.000", 0, "51c1ead1163e19a2de8f121c39df7a76", 200764100}, AD_LISTEND}, - Common::ES_ESP, Common::kPlatformDOS, ADGF_UNSTABLE, GUIO5(GUIO_NOSPEECH, GUIO_NOASPECT, GAMEOPTION_PREFER_DIGITAL_SFX, GAMEOPTION_ORIGINAL_SAVELOAD, GAMEOPTION_FB01_MIDI) }, + Common::ES_ESP, Common::kPlatformDOS, ADGF_UNSTABLE | ADGF_CD, GUIO4(GUIO_NOASPECT, GAMEOPTION_PREFER_DIGITAL_SFX, GAMEOPTION_ORIGINAL_SAVELOAD, GAMEOPTION_FB01_MIDI) }, // King's Quest 7 - English DOS Non-Interactive Demo // SCI interpreter version 2.100.002 @@ -1707,7 +1707,7 @@ static const struct ADGameDescription SciGameDescriptions[] = { {"resource.map", 0, "38e627a37a975aea40cc72b0518b0709", 18412}, {"resource.000", 0, "bad61d50aaa64298fa57a7c6ccd3bccf", 84020382}, AD_LISTEND}, - Common::EN_ANY, Common::kPlatformWindows, ADGF_DEMO | ADGF_UNSTABLE, GUIO5(GUIO_NOSPEECH, GUIO_NOASPECT, GAMEOPTION_PREFER_DIGITAL_SFX, GAMEOPTION_ORIGINAL_SAVELOAD, GAMEOPTION_FB01_MIDI) }, + Common::EN_ANY, Common::kPlatformWindows, ADGF_DEMO | ADGF_UNSTABLE | ADGF_CD, GUIO4(GUIO_NOASPECT, GAMEOPTION_PREFER_DIGITAL_SFX, GAMEOPTION_ORIGINAL_SAVELOAD, GAMEOPTION_FB01_MIDI) }, // King's Questions mini-game from the King's Quest Collection // SCI interpreter version 2.000.000 diff --git a/engines/sci/sci.cpp b/engines/sci/sci.cpp index 668ad053cc..542e818f89 100644 --- a/engines/sci/sci.cpp +++ b/engines/sci/sci.cpp @@ -892,30 +892,48 @@ bool SciEngine::speechAndSubtitlesEnabled() { } void SciEngine::syncIngameAudioOptions() { + bool subtitlesOn = false; + bool speechOn = false; + // Sync the in-game speech/subtitles settings for SCI1.1 CD games - if (isCD() && getSciVersion() == SCI_VERSION_1_1) { - bool subtitlesOn = ConfMan.getBool("subtitles"); - bool speechOn = !ConfMan.getBool("speech_mute"); - - if (subtitlesOn && !speechOn) { - _gamestate->variables[VAR_GLOBAL][90] = make_reg(0, 1); // subtitles - } else if (!subtitlesOn && speechOn) { - _gamestate->variables[VAR_GLOBAL][90] = make_reg(0, 2); // speech - } else if (subtitlesOn && speechOn) { - // Is it a game that supports simultaneous speech and subtitles? - switch (_gameId) { - case GID_SQ4: - case GID_FREDDYPHARKAS: - case GID_ECOQUEST: - case GID_LSL6: - case GID_LAURABOW2: - case GID_KQ6: - _gamestate->variables[VAR_GLOBAL][90] = make_reg(0, 3); // speech + subtitles - break; - default: - // Game does not support speech and subtitles, set it to speech + if (isCD()) { + switch (getSciVersion()) { + case SCI_VERSION_1_1: +#ifdef ENABLE_SCI32 + case SCI_VERSION_2: + case SCI_VERSION_2_1: +#endif // ENABLE_SCI32 + subtitlesOn = ConfMan.getBool("subtitles"); + speechOn = !ConfMan.getBool("speech_mute"); + + if (subtitlesOn && !speechOn) { + _gamestate->variables[VAR_GLOBAL][90] = make_reg(0, 1); // subtitles + } else if (!subtitlesOn && speechOn) { _gamestate->variables[VAR_GLOBAL][90] = make_reg(0, 2); // speech + } else if (subtitlesOn && speechOn) { + // Is it a game that supports simultaneous speech and subtitles? + switch (_gameId) { + case GID_SQ4: + case GID_FREDDYPHARKAS: + case GID_ECOQUEST: + case GID_LSL6: + case GID_LAURABOW2: + case GID_KQ6: +#ifdef ENABLE_SCI32 + case GID_KQ7: // SCI2.1 + case GID_GK1: // SCI2 + case GID_QFG4: // SCI2.1 +#endif // ENABLE_SCI32 + _gamestate->variables[VAR_GLOBAL][90] = make_reg(0, 3); // speech + subtitles + break; + default: + // Game does not support speech and subtitles, set it to speech + _gamestate->variables[VAR_GLOBAL][90] = make_reg(0, 2); // speech + } } + break; + default: + break; } } } -- cgit v1.2.3 From bb12f77cbfbcdf51538d68db91dd9e0f7ad4509e Mon Sep 17 00:00:00 2001 From: Matthew Hoops Date: Mon, 21 Dec 2015 17:58:09 -0500 Subject: BBVS: Fix compilation without translation enabled A regression from 2a6cbd0 --- engines/bbvs/bbvs.cpp | 4 ++++ engines/bbvs/bbvs.h | 3 +++ 2 files changed, 7 insertions(+) diff --git a/engines/bbvs/bbvs.cpp b/engines/bbvs/bbvs.cpp index 816b713b1f..d40d5e482f 100644 --- a/engines/bbvs/bbvs.cpp +++ b/engines/bbvs/bbvs.cpp @@ -118,15 +118,19 @@ BbvsEngine::BbvsEngine(OSystem *syst, const ADGameDescription *gd) : Engine::syncSoundSettings(); +#ifdef USE_TRANSLATION _oldGUILanguage = TransMan.getCurrentLanguage(); if (gd->flags & GF_GUILANGSWITCH) TransMan.setLanguage(getLanguageLocale(gd->language)); +#endif } BbvsEngine::~BbvsEngine() { +#ifdef USE_TRANSLATION if (TransMan.getCurrentLanguage() != _oldGUILanguage) TransMan.setLanguage(_oldGUILanguage); +#endif delete _random; diff --git a/engines/bbvs/bbvs.h b/engines/bbvs/bbvs.h index d098aaf90b..ff4afe9526 100644 --- a/engines/bbvs/bbvs.h +++ b/engines/bbvs/bbvs.h @@ -234,7 +234,10 @@ public: private: Graphics::PixelFormat _pixelFormat; + +#ifdef USE_TRANSLATION Common::String _oldGUILanguage; +#endif public: Common::RandomSource *_random; -- cgit v1.2.3 From b0587f6af8a754b15c8ecb7eb01592fb1406b76b Mon Sep 17 00:00:00 2001 From: Martin Kiewitz Date: Tue, 22 Dec 2015 01:53:19 +0100 Subject: SCI32: add code for torin+sq6 audio+subtitles mode also add comments about other SCI32 games set global 90 only for lsl6 sci1.1 --- engines/sci/detection_tables.h | 18 ++++++++--------- engines/sci/sci.cpp | 44 +++++++++++++++++++++++++++++++++++------- 2 files changed, 46 insertions(+), 16 deletions(-) diff --git a/engines/sci/detection_tables.h b/engines/sci/detection_tables.h index 6a08fdc2fe..d37dd18df9 100644 --- a/engines/sci/detection_tables.h +++ b/engines/sci/detection_tables.h @@ -4110,7 +4110,7 @@ static const struct ADGameDescription SciGameDescriptions[] = { {"resmap.000", 0, "9a3e172cde9963d0a969f26469318cec", 3403}, {"ressci.000", 0, "db3e290481c35c3224e9602e71e4a1f1", 5073868}, AD_LISTEND}, - Common::EN_ANY, Common::kPlatformWindows, ADGF_DEMO | ADGF_UNSTABLE, GUIO4(GUIO_NOASPECT, GAMEOPTION_PREFER_DIGITAL_SFX, GAMEOPTION_ORIGINAL_SAVELOAD, GAMEOPTION_FB01_MIDI) }, + Common::EN_ANY, Common::kPlatformWindows, ADGF_DEMO | ADGF_UNSTABLE | ADGF_CD, GUIO4(GUIO_NOASPECT, GAMEOPTION_PREFER_DIGITAL_SFX, GAMEOPTION_ORIGINAL_SAVELOAD, GAMEOPTION_FB01_MIDI) }, // Torin's Passage (Multilingual) - English Windows CD // SCI interpreter version 2.100.002 @@ -4118,7 +4118,7 @@ static const struct ADGameDescription SciGameDescriptions[] = { {"resmap.000", 0, "bb3b0b22ff08df54fbe2d06263409be6", 9799}, {"ressci.000", 0, "693a259d346c9360f4a0c11fdaae430a", 55973887}, AD_LISTEND}, - Common::EN_ANY, Common::kPlatformWindows, ADGF_UNSTABLE, GUIO4(GUIO_NOASPECT, GAMEOPTION_PREFER_DIGITAL_SFX, GAMEOPTION_ORIGINAL_SAVELOAD, GAMEOPTION_FB01_MIDI) }, + Common::EN_ANY, Common::kPlatformWindows, ADGF_UNSTABLE | ADGF_CD, GUIO4(GUIO_NOASPECT, GAMEOPTION_PREFER_DIGITAL_SFX, GAMEOPTION_ORIGINAL_SAVELOAD, GAMEOPTION_FB01_MIDI) }, // Torin's Passage (Multilingual) - Spanish Windows CD (from jvprat) // Executable scanning reports "2.100.002", VERSION file reports "1.0" @@ -4127,7 +4127,7 @@ static const struct ADGameDescription SciGameDescriptions[] = { {"ressci.000", 0, "693a259d346c9360f4a0c11fdaae430a", 55973887}, // TODO: depend on one of the patches? AD_LISTEND}, - Common::ES_ESP, Common::kPlatformWindows, ADGF_UNSTABLE, GUIO4(GUIO_NOASPECT, GAMEOPTION_PREFER_DIGITAL_SFX, GAMEOPTION_ORIGINAL_SAVELOAD, GAMEOPTION_FB01_MIDI) }, + Common::ES_ESP, Common::kPlatformWindows, ADGF_UNSTABLE | ADGF_CD, GUIO4(GUIO_NOASPECT, GAMEOPTION_PREFER_DIGITAL_SFX, GAMEOPTION_ORIGINAL_SAVELOAD, GAMEOPTION_FB01_MIDI) }, // Torin's Passage (Multilingual) - French Windows CD // SCI interpreter version 2.100.002 @@ -4135,7 +4135,7 @@ static const struct ADGameDescription SciGameDescriptions[] = { {"resmap.000", 0, "bb3b0b22ff08df54fbe2d06263409be6", 9799}, {"ressci.000", 0, "693a259d346c9360f4a0c11fdaae430a", 55973887}, AD_LISTEND}, - Common::FR_FRA, Common::kPlatformWindows, ADGF_UNSTABLE, GUIO4(GUIO_NOASPECT, GAMEOPTION_PREFER_DIGITAL_SFX, GAMEOPTION_ORIGINAL_SAVELOAD, GAMEOPTION_FB01_MIDI) }, + Common::FR_FRA, Common::kPlatformWindows, ADGF_UNSTABLE | ADGF_CD, GUIO4(GUIO_NOASPECT, GAMEOPTION_PREFER_DIGITAL_SFX, GAMEOPTION_ORIGINAL_SAVELOAD, GAMEOPTION_FB01_MIDI) }, // Torin's Passage - German Windows CD (from m_kiewitz) // SCI interpreter version 2.100.002 @@ -4144,7 +4144,7 @@ static const struct ADGameDescription SciGameDescriptions[] = { {"resmap.000", 0, "e55c3097329b3c53752301e01c6af2fb", 9787}, {"ressci.000", 0, "118f9bec04bfe17c4f87bbb5ddb43c18", 56127540}, AD_LISTEND}, - Common::DE_DEU, Common::kPlatformWindows, ADGF_UNSTABLE, GUIO4(GUIO_NOASPECT, GAMEOPTION_PREFER_DIGITAL_SFX, GAMEOPTION_ORIGINAL_SAVELOAD, GAMEOPTION_FB01_MIDI) }, + Common::DE_DEU, Common::kPlatformWindows, ADGF_UNSTABLE | ADGF_CD, GUIO4(GUIO_NOASPECT, GAMEOPTION_PREFER_DIGITAL_SFX, GAMEOPTION_ORIGINAL_SAVELOAD, GAMEOPTION_FB01_MIDI) }, // Torin's Passage (Multilingual) - German Windows CD // SCI interpreter version 2.100.002 @@ -4152,7 +4152,7 @@ static const struct ADGameDescription SciGameDescriptions[] = { {"resmap.000", 0, "bb3b0b22ff08df54fbe2d06263409be6", 9799}, {"ressci.000", 0, "693a259d346c9360f4a0c11fdaae430a", 55973887}, AD_LISTEND}, - Common::DE_DEU, Common::kPlatformWindows, ADGF_UNSTABLE, GUIO4(GUIO_NOASPECT, GAMEOPTION_PREFER_DIGITAL_SFX, GAMEOPTION_ORIGINAL_SAVELOAD, GAMEOPTION_FB01_MIDI) }, + Common::DE_DEU, Common::kPlatformWindows, ADGF_UNSTABLE | ADGF_CD, GUIO4(GUIO_NOASPECT, GAMEOPTION_PREFER_DIGITAL_SFX, GAMEOPTION_ORIGINAL_SAVELOAD, GAMEOPTION_FB01_MIDI) }, // Torin's Passage (Multilingual) - Italian Windows CD (from glorifindel) // SCI interpreter version 2.100.002 @@ -4160,7 +4160,7 @@ static const struct ADGameDescription SciGameDescriptions[] = { {"resmap.000", 0, "bb3b0b22ff08df54fbe2d06263409be6", 9799}, {"ressci.000", 0, "693a259d346c9360f4a0c11fdaae430a", 55973887}, AD_LISTEND}, - Common::IT_ITA, Common::kPlatformWindows, ADGF_UNSTABLE, GUIO4(GUIO_NOASPECT, GAMEOPTION_PREFER_DIGITAL_SFX, GAMEOPTION_ORIGINAL_SAVELOAD, GAMEOPTION_FB01_MIDI) }, + Common::IT_ITA, Common::kPlatformWindows, ADGF_UNSTABLE | ADGF_CD, GUIO4(GUIO_NOASPECT, GAMEOPTION_PREFER_DIGITAL_SFX, GAMEOPTION_ORIGINAL_SAVELOAD, GAMEOPTION_FB01_MIDI) }, // Torin's Passage - French Windows (from LePhilousophe) // SCI interpreter version 2.100.002 @@ -4168,7 +4168,7 @@ static const struct ADGameDescription SciGameDescriptions[] = { {"resmap.000", 0, "66ed46e3e56f487e688d52f05b33d0ba", 9787}, {"ressci.000", 0, "118f9bec04bfe17c4f87bbb5ddb43c18", 56126981}, AD_LISTEND}, - Common::FR_FRA, Common::kPlatformWindows, ADGF_UNSTABLE, GUIO4(GUIO_NOASPECT, GAMEOPTION_PREFER_DIGITAL_SFX, GAMEOPTION_ORIGINAL_SAVELOAD, GAMEOPTION_FB01_MIDI) }, + Common::FR_FRA, Common::kPlatformWindows, ADGF_UNSTABLE | ADGF_CD, GUIO4(GUIO_NOASPECT, GAMEOPTION_PREFER_DIGITAL_SFX, GAMEOPTION_ORIGINAL_SAVELOAD, GAMEOPTION_FB01_MIDI) }, // Torin's Passage - English Macintosh {"torin", "", { @@ -4180,7 +4180,7 @@ static const struct ADGameDescription SciGameDescriptions[] = { {"Data6", 0, "b639487c83d1dae0e001e700f3631566", 7594881}, {"Data7", 0, "2afd9b5434102b89610916b904c3f73a", 7627374}, AD_LISTEND}, - Common::EN_ANY, Common::kPlatformMacintosh, ADGF_MACRESFORK | ADGF_UNSTABLE, GUIO4(GUIO_NOASPECT, GAMEOPTION_PREFER_DIGITAL_SFX, GAMEOPTION_ORIGINAL_SAVELOAD, GAMEOPTION_FB01_MIDI) }, + Common::EN_ANY, Common::kPlatformMacintosh, ADGF_MACRESFORK | ADGF_UNSTABLE | ADGF_CD, GUIO4(GUIO_NOASPECT, GAMEOPTION_PREFER_DIGITAL_SFX, GAMEOPTION_ORIGINAL_SAVELOAD, GAMEOPTION_FB01_MIDI) }, #endif // ENABLE_SCI32 // SCI Fanmade Games diff --git a/engines/sci/sci.cpp b/engines/sci/sci.cpp index 542e818f89..eeea998b51 100644 --- a/engines/sci/sci.cpp +++ b/engines/sci/sci.cpp @@ -892,20 +892,50 @@ bool SciEngine::speechAndSubtitlesEnabled() { } void SciEngine::syncIngameAudioOptions() { - bool subtitlesOn = false; - bool speechOn = false; + bool useGlobal90 = false; // Sync the in-game speech/subtitles settings for SCI1.1 CD games if (isCD()) { switch (getSciVersion()) { case SCI_VERSION_1_1: + // All SCI1.1 CD games use global 90 + useGlobal90 = true; + break; #ifdef ENABLE_SCI32 case SCI_VERSION_2: case SCI_VERSION_2_1: + // Only use global 90 for some specific games, not all SCI32 games used this method + switch (_gameId) { + case GID_KQ7: // SCI2.1 + case GID_GK1: // SCI2 + case GID_GK2: // SCI2.1 + case GID_SQ6: // SCI2.1 + case GID_TORIN: // SCI2.1 + case GID_QFG4: // SCI2.1 + useGlobal90 = true; + break; + case GID_LSL6: // SCI2.1 + // TODO: Uses gameFlags array + break; + // TODO: Unknown at the moment: + // Shivers - seems not to use global 90 + // Police Quest: SWAT - unable to check + // Police Quest 4 - unable to check + // Mixed Up Mother Goose - unable to check + // Phantasmagoria - seems to use global 90, unable to check for subtitles atm + default: + return; + } + break; #endif // ENABLE_SCI32 - subtitlesOn = ConfMan.getBool("subtitles"); - speechOn = !ConfMan.getBool("speech_mute"); + default: + return; + } + + bool subtitlesOn = ConfMan.getBool("subtitles"); + bool speechOn = !ConfMan.getBool("speech_mute"); + if (useGlobal90) { if (subtitlesOn && !speechOn) { _gamestate->variables[VAR_GLOBAL][90] = make_reg(0, 1); // subtitles } else if (!subtitlesOn && speechOn) { @@ -920,8 +950,11 @@ void SciEngine::syncIngameAudioOptions() { case GID_LAURABOW2: case GID_KQ6: #ifdef ENABLE_SCI32 + // Unsure about Gabriel Knight 2 case GID_KQ7: // SCI2.1 case GID_GK1: // SCI2 + case GID_SQ6: // SCI2.1, SQ6 seems to always use subtitles anyway + case GID_TORIN: // SCI2.1 case GID_QFG4: // SCI2.1 #endif // ENABLE_SCI32 _gamestate->variables[VAR_GLOBAL][90] = make_reg(0, 3); // speech + subtitles @@ -931,9 +964,6 @@ void SciEngine::syncIngameAudioOptions() { _gamestate->variables[VAR_GLOBAL][90] = make_reg(0, 2); // speech } } - break; - default: - break; } } } -- cgit v1.2.3 From 9c50ffda33d7abf88f9a7e2dc78c549755d0c4f7 Mon Sep 17 00:00:00 2001 From: Eugene Sandulenko Date: Tue, 22 Dec 2015 19:09:13 +0100 Subject: ENGINES: Replaced logo background with orange --- dists/scummvm_logo.bmp | Bin 13556 -> 16052 bytes engines/engine.cpp | 4 +- engines/logo_data.h | 1977 ++++++++++++++++++++++++++---------------------- 3 files changed, 1074 insertions(+), 907 deletions(-) diff --git a/dists/scummvm_logo.bmp b/dists/scummvm_logo.bmp index d924222588..8217019be4 100644 Binary files a/dists/scummvm_logo.bmp and b/dists/scummvm_logo.bmp differ diff --git a/engines/engine.cpp b/engines/engine.cpp index aedcb11b28..5bf1416e5a 100644 --- a/engines/engine.cpp +++ b/engines/engine.cpp @@ -261,10 +261,10 @@ void splashScreen() { g_system->showOverlay(); - // Fill with white + // Fill with orange Graphics::Surface screen; screen.create(g_system->getOverlayWidth(), g_system->getOverlayHeight(), g_system->getOverlayFormat()); - screen.fillRect(Common::Rect(screen.w, screen.h), screen.format.ARGBToColor(0xff, 0xff, 0xff, 0xff)); + screen.fillRect(Common::Rect(screen.w, screen.h), screen.format.ARGBToColor(0xff, 0xd4, 0x75, 0x0b)); g_system->copyRectToOverlay(screen.getPixels(), screen.pitch, 0, 0, screen.w, screen.h); // Draw logo diff --git a/engines/logo_data.h b/engines/logo_data.h index ac757e453f..2eaff6930f 100644 --- a/engines/logo_data.h +++ b/engines/logo_data.h @@ -25,908 +25,1075 @@ // The tool is from https://github.com/pinard/Recode byte logo_data[] = { - 66, 77, 244, 52, 0, 0, 0, 0, 0, 0, 54, 4, 0, 0, 40, - 0, 0, 0, 44, 1, 0, 0, 82, 0, 0, 0, 1, 0, 8, 0, - 1, 0, 0, 0, 190, 48, 0, 0, 193, 3, 0, 0, 193, 3, 0, - 0, 0, 1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 0, 2, 6, - 3, 0, 6, 10, 7, 0, 0, 11, 12, 0, 4, 17, 10, 0, 12, - 16, 14, 0, 5, 16, 17, 0, 2, 20, 17, 0, 17, 19, 18, 0, - 20, 23, 21, 0, 2, 26, 21, 0, 9, 25, 22, 0, 24, 27, 25, - 0, 3, 31, 25, 0, 27, 29, 28, 0, 0, 34, 26, 0, 14, 33, - 28, 0, 30, 32, 31, 0, 9, 39, 32, 0, 33, 36, 34, 0, 20, - 37, 36, 0, 6, 43, 35, 0, 37, 40, 38, 0, 4, 48, 37, 0, - 41, 43, 42, 0, 44, 46, 45, 0, 32, 51, 44, 0, 4, 55, 42, - 0, 25, 53, 47, 0, 49, 51, 50, 0, 16, 56, 46, 0, 3, 60, - 50, 0, 3, 63, 46, 0, 55, 57, 56, 0, 40, 60, 52, 0, 4, - 70, 53, 0, 60, 63, 61, 0, 14, 70, 56, 0, 6, 70, 60, 0, - 21, 70, 58, 0, 29, 69, 59, 0, 64, 67, 65, 0, 7, 79, 61, - 0, 68, 71, 69, 0, 72, 75, 73, 0, 13, 85, 64, 0, 4, 87, - 66, 0, 14, 85, 71, 0, 76, 79, 77, 0, 80, 83, 81, 0, 36, - 89, 78, 0, 1, 95, 70, 0, 83, 86, 84, 0, 86, 89, 87, 0, - 8, 102, 79, 0, 29, 101, 82, 0, 3, 107, 72, 0, 2, 109, 66, - 0, 90, 93, 91, 0, 6, 108, 78, 0, 0, 113, 72, 0, 95, 97, - 96, 0, 0, 113, 80, 0, 0, 117, 69, 0, 0, 117, 76, 0, 98, -101, 99, 0, 4, 121, 73, 0, 56, 109, 96, 0, 4, 120, 79, 0, - 41, 112, 94, 0, 3, 119, 86, 0, 102, 105, 103, 0, 0, 124, 77, - 0, 0, 123, 83, 0, 105, 107, 106, 0, 107, 110, 108, 0, 31, 120, -101, 0, 1, 129, 82, 0, 62, 118, 102, 0, 3, 132, 77, 0, 2, -129, 89, 0, 109, 112, 110, 0, 0, 133, 80, 0, 7, 128, 97, 0, -113, 116, 114, 0, 0, 137, 83, 0, 0, 137, 92, 0, 0, 136, 98, - 0, 117, 119, 118, 0, 2, 141, 88, 0, 3, 136, 105, 0, 18, 135, -105, 0, 31, 134, 107, 0, 6, 144, 84, 0, 6, 143, 90, 0, 120, -123, 121, 0, 0, 144, 100, 0, 0, 146, 94, 0, 0, 148, 89, 0, - 0, 144, 106, 0, 125, 128, 126, 0, 3, 153, 94, 0, 5, 152, 101, - 0, 54, 142, 119, 0, 2, 151, 109, 0, 129, 132, 130, 0, 0, 157, -100, 0, 4, 151, 122, 0, 0, 156, 107, 0, 133, 136, 134, 0, 73, -145, 128, 0, 0, 162, 97, 0, 0, 161, 104, 0, 47, 152, 123, 0, - 0, 163, 107, 0, 138, 141, 140, 0, 7, 166, 101, 0, 7, 165, 108, - 0, 0, 168, 105, 0, 36, 159, 128, 0, 0, 166, 118, 0, 142, 145, -143, 0, 0, 169, 113, 0, 0, 172, 108, 0, 25, 167, 131, 0, 147, -150, 148, 0, 6, 176, 112, 0, 10, 175, 119, 0, 10, 172, 131, 0, - 0, 178, 116, 0, 0, 176, 124, 0, 14, 179, 116, 0, 153, 156, 154, - 0, 0, 182, 120, 0, 72, 169, 141, 0, 0, 181, 129, 0, 1, 186, -116, 0, 22, 183, 120, 0, 87, 170, 147, 0, 24, 183, 127, 0, 6, -186, 124, 0, 159, 162, 160, 0, 44, 180, 144, 0, 0, 191, 123, 0, - 0, 193, 117, 0, 0, 190, 130, 0, 42, 186, 131, 0, 16, 190, 128, - 0, 66, 179, 149, 0, 32, 189, 127, 0, 30, 189, 135, 0, 44, 186, -144, 0, 165, 168, 166, 0, 0, 196, 128, 0, 2, 198, 122, 0, 36, -188, 147, 0, 6, 196, 136, 0, 25, 194, 141, 0, 41, 195, 140, 0, -170, 174, 172, 0, 51, 195, 142, 0, 0, 204, 130, 0, 31, 199, 138, - 0, 43, 194, 151, 0, 0, 203, 136, 0, 0, 207, 125, 0, 0, 202, -143, 0, 33, 195, 156, 0, 62, 196, 146, 0, 100, 187, 164, 0, 20, -202, 142, 0, 0, 202, 151, 0, 176, 179, 177, 0, 4, 211, 129, 0, - 72, 198, 150, 0, 33, 202, 150, 0, 5, 210, 135, 0, 74, 195, 165, - 0, 0, 214, 133, 0, 12, 210, 144, 0, 14, 209, 150, 0, 69, 200, -164, 0, 0, 214, 141, 0, 180, 184, 182, 0, 84, 199, 167, 0, 33, -210, 150, 0, 87, 202, 160, 0, 98, 198, 170, 0, 0, 214, 150, 0, - 68, 205, 159, 0, 0, 219, 138, 0, 37, 210, 159, 0, 0, 218, 145, - 0, 57, 208, 160, 0, 48, 210, 158, 0, 25, 212, 161, 0, 26, 216, -150, 0, 186, 189, 187, 0, 7, 224, 135, 0, 27, 216, 157, 0, 10, -223, 143, 0, 0, 228, 141, 0, 191, 194, 192, 0, 0, 227, 148, 0, - 35, 220, 162, 0, 95, 211, 175, 0, 36, 223, 157, 0, 20, 226, 153, - 0, 18, 224, 161, 0, 22, 228, 148, 0, 90, 213, 178, 0, 195, 198, -196, 0, 0, 231, 152, 0, 56, 220, 172, 0, 107, 214, 178, 0, 29, -231, 151, 0, 42, 223, 175, 0, 94, 218, 181, 0, 199, 202, 200, 0, - 32, 232, 160, 0, 122, 215, 188, 0, 47, 233, 159, 0, 202, 206, 204, - 0, 36, 234, 171, 0, 85, 225, 186, 0, 50, 234, 168, 0, 113, 221, -192, 0, 62, 233, 174, 0, 62, 235, 168, 0, 206, 209, 207, 0, 55, -236, 178, 0, 74, 236, 174, 0, 210, 213, 211, 0, 84, 238, 175, 0, - 85, 235, 188, 0, 85, 237, 182, 0, 75, 237, 186, 0, 213, 216, 214, - 0, 95, 239, 187, 0, 104, 239, 188, 0, 216, 220, 218, 0, 113, 240, -193, 0, 104, 240, 198, 0, 220, 223, 221, 0, 122, 242, 195, 0, 126, -240, 209, 0, 223, 226, 224, 0, 126, 243, 203, 0, 118, 244, 207, 0, -226, 229, 227, 0, 230, 233, 231, 0, 233, 236, 234, 0, 235, 238, 236, - 0, 241, 245, 242, 0, 248, 252, 250, 0, 252, 255, 254, 0, 255, 255, - 24, 255, 0, 13, 250, 229, 172, 132, 100, 65, 44, 25, 9, 0, 9, - 52, 218, 0, 8, 255, 0, 0, 255, 255, 20, 255, 0, 4, 240, 75, - 24, 1, 12, 0, 1, 1, 1, 105, 7, 255, 0, 0, 255, 255, 19, -255, 1, 141, 1, 2, 17, 0, 1, 141, 6, 255, 0, 0, 250, 255, - 0, 12, 253, 197, 125, 100, 61, 43, 24, 8, 14, 33, 115, 252, 11, -255, 1, 183, 1, 1, 18, 0, 1, 8, 1, 254, 5, 255, 0, 0, -204, 255, 0, 3, 246, 240, 253, 0, 41, 255, 0, 3, 253, 88, 2, - 0, 10, 0, 1, 12, 1, 197, 9, 255, 1, 254, 1, 19, 10, 0, - 0, 6, 1, 5, 9, 12, 14, 5, 4, 0, 1, 183, 5, 255, 0, - 0, 202, 255, 0, 10, 172, 22, 0, 0, 1, 22, 53, 109, 183, 250, - 17, 255, 0, 5, 254, 249, 229, 222, 252, 0, 13, 255, 1, 250, 1, - 22, 13, 0, 1, 1, 1, 211, 8, 255, 1, 211, 4, 0, 0, 7, - 2, 14, 14, 19, 22, 19, 9, 0, 5, 33, 1, 25, 4, 0, 1, -109, 5, 255, 0, 0, 201, 255, 1, 152, 1, 1, 9, 0, 0, 4, - 12, 44, 109, 246, 5, 255, 0, 8, 253, 159, 105, 75, 52, 36, 22, - 8, 5, 0, 1, 36, 1, 211, 10, 255, 1, 254, 1, 29, 15, 0, - 1, 12, 1, 253, 7, 255, 1, 132, 4, 0, 1, 25, 4, 36, 1, - 29, 1, 8, 5, 36, 1, 33, 1, 1, 3, 0, 1, 81, 5, 255, - 0, 0, 78, 255, 0, 8, 240, 172, 121, 95, 109, 109, 172, 251, 3, -255, 0, 12, 254, 211, 152, 125, 115, 109, 100, 115, 132, 159, 197, 243, - 22, 255, 0, 7, 253, 246, 240, 222, 222, 240, 250, 0, 70, 255, 1, -250, 1, 5, 13, 0, 1, 2, 1, 132, 3, 255, 1, 109, 1, 5, - 13, 0, 1, 1, 1, 132, 9, 255, 1, 141, 7, 0, 0, 6, 1, - 5, 12, 14, 14, 1, 4, 0, 1, 84, 7, 255, 1, 125, 4, 0, - 1, 29, 4, 36, 1, 33, 1, 5, 6, 36, 1, 2, 3, 0, 1, - 53, 5, 255, 0, 0, 13, 255, 0, 14, 250, 152, 88, 43, 24, 9, - 0, 5, 5, 17, 43, 71, 115, 229, 21, 255, 0, 4, 252, 211, 141, - 95, 3, 65, 0, 4, 81, 121, 172, 243, 16, 255, 0, 3, 222, 71, - 17, 0, 7, 0, 0, 5, 1, 22, 44, 29, 1, 0, 11, 0, 0, - 6, 24, 115, 218, 211, 152, 121, 4, 109, 0, 12, 125, 141, 152, 211, -253, 255, 255, 240, 109, 41, 19, 1, 7, 0, 0, 3, 8, 53, 211, - 0, 6, 255, 0, 29, 253, 211, 125, 95, 65, 84, 159, 253, 255, 255, -237, 141, 115, 109, 100, 88, 95, 109, 125, 152, 183, 251, 255, 255, 246, -105, 43, 24, 9, 0, 3, 5, 4, 0, 0, 4, 5, 33, 121, 253, - 5, 255, 0, 8, 246, 197, 132, 95, 71, 71, 109, 232, 8, 255, 1, - 58, 15, 0, 0, 4, 1, 197, 255, 71, 16, 0, 1, 1, 1, 218, - 8, 255, 1, 33, 4, 0, 0, 3, 17, 29, 33, 0, 5, 36, 1, - 29, 1, 1, 3, 0, 1, 1, 1, 240, 6, 255, 1, 152, 4, 0, - 1, 29, 5, 36, 1, 5, 6, 36, 1, 9, 3, 0, 1, 41, 5, -255, 0, 0, 10, 255, 0, 4, 253, 121, 36, 1, 13, 0, 0, 3, - 14, 71, 218, 0, 15, 255, 0, 4, 222, 100, 33, 1, 10, 0, 0, - 3, 24, 88, 222, 0, 11, 255, 1, 202, 1, 33, 40, 0, 0, 3, - 1, 19, 17, 0, 15, 0, 0, 6, 29, 84, 109, 84, 48, 17, 7, - 0, 0, 3, 2, 25, 5, 0, 11, 0, 0, 4, 1, 14, 24, 1, - 14, 0, 0, 6, 14, 75, 109, 74, 41, 8, 7, 0, 0, 3, 1, -100, 254, 0, 5, 255, 1, 211, 1, 1, 4, 0, 0, 4, 9, 12, - 9, 1, 8, 0, 1, 44, 1, 172, 18, 0, 1, 43, 7, 255, 1, -250, 1, 1, 3, 0, 1, 14, 9, 41, 1, 19, 4, 0, 1, 48, - 6, 255, 1, 197, 4, 0, 1, 25, 5, 41, 1, 5, 6, 41, 1, - 14, 3, 0, 1, 24, 5, 255, 0, 0, 8, 255, 0, 3, 250, 81, - 5, 0, 19, 0, 1, 41, 1, 183, 10, 255, 0, 3, 254, 159, 36, - 0, 17, 0, 1, 43, 1, 229, 7, 255, 1, 251, 1, 52, 120, 0, - 1, 105, 4, 255, 1, 254, 1, 29, 4, 0, 1, 17, 4, 33, 0, - 4, 25, 19, 14, 8, 4, 0, 1, 1, 1, 41, 6, 0, 0, 9, - 2, 9, 12, 17, 17, 19, 24, 22, 5, 0, 3, 0, 1, 1, 1, -253, 6, 255, 1, 132, 4, 0, 1, 25, 9, 43, 1, 41, 1, 2, - 4, 0, 1, 197, 5, 255, 1, 232, 4, 0, 1, 24, 5, 43, 1, - 5, 6, 43, 1, 17, 3, 0, 1, 9, 5, 255, 0, 0, 6, 255, - 0, 3, 254, 115, 5, 0, 23, 0, 1, 48, 1, 249, 7, 255, 1, -222, 1, 29, 20, 0, 1, 1, 1, 125, 5, 255, 1, 202, 1, 12, -121, 0, 1, 1, 1, 243, 3, 255, 1, 125, 4, 0, 1, 5, 1, - 33, 7, 36, 1, 33, 1, 12, 4, 0, 1, 1, 3, 0, 1, 9, - 1, 36, 9, 43, 1, 24, 4, 0, 1, 218, 6, 255, 1, 49, 3, - 0, 1, 1, 1, 41, 10, 43, 1, 24, 4, 0, 1, 24, 1, 254, - 4, 255, 1, 251, 4, 0, 1, 22, 5, 43, 1, 5, 6, 43, 1, - 19, 3, 0, 1, 1, 1, 254, 4, 255, 0, 0, 5, 255, 1, 243, - 1, 33, 26, 0, 1, 5, 1, 159, 5, 255, 1, 105, 1, 1, 23, - 0, 0, 6, 74, 254, 255, 255, 141, 1, 8, 0, 0, 7, 1, 4, - 10, 13, 13, 4, 1, 0, 4, 0, 1, 1, 3, 7, 0, 7, 4, - 4, 3, 3, 2, 1, 1, 0, 28, 0, 1, 1, 44, 0, 1, 1, - 19, 0, 0, 5, 95, 255, 255, 252, 8, 0, 4, 0, 1, 25, 9, - 36, 1, 25, 8, 0, 1, 19, 10, 44, 1, 33, 4, 0, 1, 152, - 5, 255, 1, 254, 1, 5, 3, 0, 1, 12, 12, 44, 1, 9, 4, - 0, 1, 125, 5, 255, 1, 1, 3, 0, 1, 19, 5, 44, 0, 4, - 12, 5, 12, 22, 3, 44, 1, 22, 4, 0, 1, 250, 4, 255, 0, - 0, 4, 255, 1, 202, 1, 8, 8, 0, 0, 13, 1, 13, 27, 42, - 51, 59, 62, 59, 46, 35, 21, 4, 1, 0, 7, 0, 1, 1, 1, -152, 3, 255, 1, 115, 8, 0, 0, 11, 1, 7, 23, 35, 46, 46, - 42, 32, 21, 4, 1, 0, 7, 0, 0, 4, 43, 249, 132, 1, 6, - 0, 0, 5, 4, 31, 59, 64, 60, 0, 3, 56, 0, 7, 62, 70, - 35, 3, 0, 0, 31, 0, 4, 62, 0, 6, 60, 64, 64, 62, 62, - 35, 3, 0, 0, 11, 1, 10, 13, 10, 11, 7, 7, 4, 4, 3, - 1, 0, 5, 0, 0, 5, 27, 51, 54, 59, 59, 0, 4, 62, 1, - 70, 1, 35, 8, 0, 0, 6, 1, 1, 7, 15, 27, 15, 5, 0, - 0, 4, 11, 13, 10, 10, 3, 7, 0, 3, 4, 4, 1, 0, 5, - 0, 0, 5, 15, 51, 51, 59, 59, 0, 5, 62, 1, 54, 8, 0, - 0, 6, 1, 1, 4, 13, 23, 23, 4, 0, 0, 4, 22, 255, 255, - 71, 4, 0, 1, 12, 10, 41, 1, 33, 4, 0, 1, 1, 3, 0, - 1, 19, 10, 44, 1, 41, 4, 0, 1, 105, 5, 255, 1, 197, 4, - 0, 1, 22, 12, 44, 1, 33, 4, 0, 1, 8, 1, 252, 4, 255, - 1, 9, 3, 0, 1, 19, 7, 44, 0, 6, 36, 12, 29, 44, 44, - 25, 4, 0, 1, 229, 4, 255, 0, 0, 3, 255, 1, 172, 1, 1, - 6, 0, 0, 5, 1, 15, 51, 68, 60, 0, 9, 57, 0, 4, 62, - 62, 32, 3, 6, 0, 0, 5, 1, 125, 254, 115, 1, 0, 6, 0, - 0, 8, 7, 45, 70, 62, 60, 57, 63, 63, 3, 57, 0, 4, 60, - 59, 23, 1, 6, 0, 1, 5, 1, 1, 5, 0, 0, 7, 1, 45, - 64, 57, 63, 63, 66, 0, 4, 63, 0, 6, 57, 57, 64, 32, 1, - 35, 5, 63, 1, 60, 3, 57, 1, 35, 3, 0, 1, 13, 1, 70, - 8, 60, 1, 70, 1, 1, 4, 0, 0, 6, 73, 63, 63, 64, 64, - 60, 3, 57, 1, 56, 1, 35, 3, 0, 0, 11, 7, 27, 42, 51, - 62, 70, 70, 60, 57, 57, 59, 0, 4, 0, 1, 3, 1, 70, 5, - 60, 3, 62, 1, 83, 1, 1, 4, 0, 0, 3, 51, 64, 63, 0, - 3, 60, 4, 57, 1, 51, 3, 0, 0, 12, 3, 23, 35, 51, 62, - 70, 62, 59, 57, 57, 70, 1, 3, 0, 0, 4, 1, 250, 232, 1, - 3, 0, 1, 1, 1, 33, 11, 41, 1, 2, 3, 0, 1, 5, 3, - 0, 1, 12, 11, 48, 1, 1, 3, 0, 1, 61, 5, 255, 1, 88, - 4, 0, 1, 36, 13, 48, 1, 17, 4, 0, 1, 75, 4, 255, 1, - 25, 3, 0, 1, 14, 8, 48, 1, 41, 3, 5, 1, 2, 4, 0, - 1, 197, 4, 255, 0, 0, 0, 4, 255, 255, 183, 1, 6, 0, 0, - 21, 13, 62, 62, 60, 66, 77, 82, 85, 82, 77, 72, 77, 77, 68, - 64, 57, 56, 57, 64, 35, 1, 0, 6, 0, 1, 2, 6, 0, 0, - 18, 3, 51, 64, 57, 60, 64, 68, 72, 85, 82, 72, 64, 60, 60, - 57, 57, 59, 13, 11, 0, 0, 28, 11, 70, 57, 66, 77, 85, 89, - 89, 94, 98, 94, 85, 77, 72, 66, 72, 70, 87, 97, 106, 101, 98, - 89, 79, 72, 60, 56, 32, 3, 0, 1, 21, 1, 86, 3, 72, 0, - 7, 68, 72, 64, 57, 56, 62, 1, 0, 4, 0, 1, 87, 4, 89, - 0, 6, 85, 77, 63, 57, 56, 27, 3, 0, 1, 70, 4, 66, 0, - 7, 79, 85, 66, 57, 57, 68, 1, 0, 3, 0, 0, 12, 4, 86, - 66, 72, 72, 68, 64, 60, 57, 57, 64, 3, 4, 0, 0, 11, 54, - 94, 86, 82, 85, 82, 77, 66, 57, 57, 42, 0, 3, 0, 0, 12, - 51, 66, 64, 63, 66, 72, 66, 63, 63, 57, 64, 3, 4, 0, 1, -197, 1, 36, 4, 0, 1, 22, 12, 43, 1, 12, 3, 0, 1, 5, - 3, 0, 1, 2, 11, 49, 1, 9, 3, 0, 1, 36, 5, 255, 1, - 24, 3, 0, 1, 5, 14, 49, 1, 43, 1, 1, 3, 0, 1, 1, - 1, 232, 3, 255, 1, 41, 3, 0, 1, 9, 12, 49, 1, 41, 4, - 0, 1, 141, 4, 255, 0, 0, 0, 3, 255, 232, 2, 0, 5, 0, - 0, 9, 1, 46, 70, 64, 72, 82, 98, 111, 116, 0, 3, 111, 0, - 12, 98, 98, 97, 97, 89, 72, 63, 63, 60, 57, 62, 10, 11, 0, - 0, 9, 15, 73, 68, 66, 66, 79, 94, 101, 98, 0, 3, 97, 0, - 8, 89, 85, 82, 72, 60, 57, 59, 32, 9, 0, 0, 29, 7, 70, - 63, 79, 94, 101, 101, 97, 97, 101, 106, 106, 101, 98, 97, 94, 97, - 97, 101, 111, 123, 118, 106, 93, 89, 97, 77, 57, 27, 0, 3, 0, - 1, 23, 1, 108, 5, 97, 0, 5, 101, 82, 63, 70, 1, 0, 4, - 0, 1, 96, 4, 106, 0, 6, 101, 98, 72, 60, 56, 23, 3, 0, - 1, 59, 4, 97, 0, 7, 101, 106, 94, 63, 56, 62, 1, 0, 3, - 0, 0, 12, 7, 112, 98, 98, 101, 97, 89, 77, 63, 57, 64, 3, - 4, 0, 0, 4, 54, 111, 106, 98, 3, 97, 0, 4, 89, 72, 57, - 35, 3, 0, 0, 4, 35, 98, 97, 94, 3, 97, 0, 5, 89, 82, - 64, 60, 10, 0, 4, 0, 1, 61, 4, 0, 1, 5, 13, 43, 1, - 19, 3, 0, 1, 1, 4, 0, 1, 44, 10, 49, 1, 19, 3, 0, - 1, 12, 4, 255, 1, 246, 4, 0, 1, 22, 15, 49, 1, 24, 4, - 0, 1, 44, 3, 255, 1, 53, 3, 0, 1, 5, 12, 49, 1, 44, - 4, 0, 1, 115, 4, 255, 0, 0, 1, 254, 1, 29, 5, 0, 0, - 26, 1, 59, 68, 79, 94, 98, 101, 98, 111, 131, 137, 131, 123, 111, -106, 111, 111, 112, 101, 89, 77, 66, 63, 57, 62, 15, 9, 0, 0, - 9, 21, 83, 77, 89, 98, 98, 93, 98, 111, 0, 3, 106, 1, 116, - 1, 111, 3, 101, 0, 5, 89, 72, 57, 57, 32, 0, 7, 0, 0, - 21, 1, 83, 79, 85, 98, 106, 111, 118, 112, 106, 111, 111, 118, 118, -111, 111, 106, 106, 111, 111, 116, 0, 3, 118, 0, 6, 101, 98, 98, - 89, 60, 27, 3, 0, 0, 12, 27, 127, 118, 118, 116, 101, 98, 106, -106, 79, 68, 1, 4, 0, 0, 11, 99, 123, 116, 111, 111, 116, 111, - 93, 72, 57, 21, 0, 3, 0, 0, 4, 37, 129, 118, 118, 3, 111, - 0, 5, 106, 89, 60, 57, 7, 0, 3, 0, 1, 7, 1, 140, 3, -118, 0, 7, 111, 111, 98, 77, 57, 60, 4, 0, 4, 0, 0, 11, - 54, 131, 126, 116, 106, 98, 98, 97, 89, 72, 35, 0, 3, 0, 0, - 12, 15, 135, 118, 116, 111, 111, 106, 101, 93, 72, 60, 23, 4, 0, - 1, 2, 4, 0, 1, 5, 1, 33, 12, 44, 1, 24, 8, 0, 1, - 41, 10, 52, 1, 22, 3, 0, 1, 1, 1, 253, 3, 255, 1, 125, - 4, 0, 1, 33, 15, 52, 1, 49, 1, 5, 4, 0, 0, 4, 183, -255, 255, 75, 3, 0, 1, 1, 12, 52, 1, 49, 4, 0, 1, 88, - 4, 255, 0, 0, 1, 152, 5, 0, 0, 11, 1, 83, 82, 89, 106, -111, 118, 118, 111, 111, 118, 0, 3, 131, 1, 118, 1, 116, 3, 118, - 0, 9, 116, 101, 89, 82, 72, 63, 57, 62, 7, 0, 7, 0, 0, - 24, 10, 86, 85, 98, 106, 118, 116, 106, 106, 111, 116, 118, 118, 131, -131, 123, 118, 118, 112, 98, 79, 57, 56, 15, 6, 0, 1, 42, 1, - 97, 3, 98, 0, 4, 101, 106, 131, 131, 3, 123, 0, 5, 126, 131, -131, 123, 123, 0, 5, 118, 0, 8, 123, 126, 118, 106, 98, 89, 63, - 23, 3, 0, 1, 27, 1, 140, 3, 131, 0, 7, 116, 101, 98, 101, - 82, 68, 1, 0, 4, 0, 0, 11, 99, 127, 123, 111, 106, 111, 126, -118, 94, 64, 15, 0, 3, 0, 0, 5, 11, 157, 131, 131, 123, 0, - 3, 118, 0, 4, 111, 77, 57, 18, 3, 0, 0, 12, 7, 158, 146, -131, 123, 123, 118, 111, 98, 66, 60, 4, 4, 0, 0, 11, 46, 139, -131, 131, 116, 106, 98, 93, 94, 82, 32, 0, 3, 0, 0, 12, 1, -167, 139, 131, 123, 118, 118, 111, 101, 82, 64, 35, 8, 0, 0, 6, - 12, 36, 17, 5, 19, 41, 9, 48, 1, 33, 8, 0, 1, 33, 10, - 53, 1, 29, 4, 0, 1, 232, 3, 255, 1, 48, 3, 0, 1, 1, - 1, 49, 16, 53, 1, 33, 4, 0, 0, 4, 22, 254, 255, 105, 4, - 0, 1, 49, 12, 53, 1, 2, 3, 0, 1, 61, 4, 255, 0, 0, - 1, 43, 4, 0, 0, 30, 1, 87, 97, 101, 106, 116, 118, 123, 131, -123, 118, 123, 131, 131, 137, 131, 123, 118, 111, 111, 118, 111, 101, 98, - 85, 77, 64, 57, 59, 1, 5, 0, 0, 6, 1, 87, 89, 101, 111, -111, 4, 118, 0, 7, 123, 131, 126, 123, 131, 137, 131, 0, 3, 123, - 0, 6, 111, 98, 72, 57, 62, 1, 4, 0, 0, 3, 1, 104, 98, - 0, 3, 106, 0, 13, 101, 101, 111, 126, 123, 123, 126, 131, 137, 146, -146, 139, 131, 0, 3, 123, 0, 9, 118, 118, 123, 118, 111, 101, 93, - 66, 21, 0, 3, 0, 0, 12, 30, 150, 146, 137, 131, 123, 106, 101, - 98, 72, 64, 1, 4, 0, 0, 11, 91, 139, 131, 118, 106, 101, 112, -111, 94, 64, 13, 0, 3, 0, 0, 12, 1, 189, 146, 137, 131, 123, -118, 118, 111, 89, 63, 32, 3, 0, 0, 12, 7, 158, 146, 131, 126, -126, 123, 118, 101, 79, 64, 7, 4, 0, 0, 11, 46, 131, 123, 123, -118, 111, 101, 93, 79, 63, 32, 0, 4, 0, 0, 11, 181, 151, 146, -131, 123, 118, 116, 106, 89, 64, 51, 0, 7, 0, 1, 1, 1, 41, - 3, 48, 0, 5, 33, 12, 8, 25, 44, 0, 6, 48, 1, 44, 8, - 0, 1, 24, 10, 53, 1, 33, 4, 0, 0, 5, 159, 255, 255, 253, - 2, 0, 3, 0, 1, 17, 18, 53, 1, 12, 4, 0, 0, 3, 121, -255, 132, 0, 4, 0, 1, 44, 12, 53, 1, 9, 3, 0, 1, 44, - 4, 255, 0, 0, 1, 5, 3, 0, 0, 9, 1, 90, 118, 116, 118, -118, 123, 123, 126, 0, 3, 131, 0, 10, 139, 146, 168, 174, 174, 151, -131, 118, 116, 118, 3, 111, 0, 6, 97, 79, 72, 60, 56, 23, 5, - 0, 0, 13, 46, 97, 106, 111, 116, 118, 123, 131, 126, 123, 123, 131, -139, 0, 5, 146, 0, 8, 127, 123, 118, 106, 94, 63, 56, 35, 4, - 0, 1, 23, 1, 102, 5, 111, 0, 14, 101, 101, 111, 118, 123, 131, -146, 168, 174, 168, 168, 146, 127, 131, 3, 123, 0, 7, 126, 123, 118, -106, 89, 66, 18, 0, 3, 0, 0, 12, 23, 163, 137, 131, 126, 123, -111, 106, 98, 79, 64, 1, 4, 0, 0, 11, 91, 127, 131, 123, 116, -101, 98, 98, 89, 64, 13, 0, 4, 0, 0, 11, 148, 168, 139, 131, -123, 118, 118, 116, 101, 66, 46, 0, 3, 0, 0, 12, 7, 157, 139, -131, 131, 123, 118, 111, 106, 79, 64, 7, 4, 0, 0, 11, 45, 131, -123, 118, 118, 111, 112, 98, 72, 57, 27, 0, 4, 0, 0, 11, 103, -168, 146, 137, 126, 118, 116, 106, 97, 72, 62, 0, 7, 0, 1, 22, - 6, 49, 0, 4, 44, 25, 5, 19, 6, 49, 1, 2, 3, 0, 1, - 1, 3, 0, 0, 12, 19, 58, 53, 44, 41, 29, 24, 17, 9, 8, - 8, 12, 4, 0, 0, 4, 115, 255, 255, 183, 4, 0, 1, 29, 18, - 58, 1, 43, 1, 1, 3, 0, 0, 3, 5, 251, 172, 0, 4, 0, - 1, 43, 12, 58, 1, 17, 3, 0, 1, 29, 4, 255, 0, 0, 1, - 2, 3, 0, 0, 3, 1, 167, 146, 0, 3, 139, 4, 131, 0, 22, -139, 151, 168, 174, 210, 205, 214, 210, 168, 146, 131, 123, 118, 118, 123, -112, 94, 82, 72, 60, 62, 1, 3, 0, 0, 28, 1, 108, 112, 123, -123, 118, 123, 123, 131, 137, 131, 137, 139, 151, 174, 186, 186, 174, 168, -146, 131, 123, 118, 112, 94, 66, 70, 1, 3, 0, 1, 70, 1, 116, - 4, 118, 0, 25, 123, 111, 101, 111, 123, 123, 149, 193, 210, 205, 214, -186, 186, 146, 139, 131, 123, 126, 131, 131, 123, 112, 94, 64, 15, 0, - 3, 0, 0, 12, 21, 163, 149, 131, 123, 123, 118, 116, 112, 89, 73, - 3, 4, 0, 0, 11, 91, 139, 131, 131, 123, 111, 98, 97, 85, 64, - 13, 0, 4, 0, 0, 11, 76, 168, 146, 139, 126, 123, 118, 118, 106, - 77, 59, 0, 3, 0, 0, 12, 7, 157, 139, 137, 131, 123, 118, 111, -101, 85, 64, 11, 4, 0, 0, 11, 45, 139, 131, 123, 123, 118, 118, -106, 77, 57, 27, 0, 4, 0, 0, 12, 37, 168, 146, 137, 131, 126, -123, 111, 102, 77, 70, 1, 5, 0, 1, 5, 1, 48, 8, 52, 1, - 49, 1, 8, 6, 52, 1, 14, 3, 0, 1, 2, 3, 0, 0, 13, - 1, 8, 9, 19, 25, 33, 43, 48, 58, 61, 61, 58, 1, 0, 3, - 0, 0, 4, 71, 255, 255, 75, 4, 0, 1, 48, 19, 61, 1, 19, - 4, 0, 1, 74, 1, 211, 4, 0, 1, 36, 12, 61, 1, 22, 3, - 0, 1, 14, 4, 255, 0, 0, 1, 25, 4, 0, 0, 13, 30, 189, -174, 174, 160, 146, 150, 139, 139, 158, 193, 76, 18, 0, 3, 1, 0, - 15, 2, 103, 168, 149, 137, 133, 126, 131, 123, 106, 98, 94, 72, 62, - 4, 0, 3, 0, 0, 5, 27, 117, 123, 131, 137, 0, 4, 123, 0, - 19, 131, 131, 149, 158, 113, 50, 67, 169, 220, 186, 174, 160, 149, 131, -126, 116, 98, 73, 23, 0, 3, 0, 1, 130, 3, 131, 0, 27, 126, -123, 131, 123, 111, 111, 126, 140, 37, 1, 0, 1, 4, 110, 214, 174, -160, 150, 131, 126, 123, 123, 118, 111, 97, 73, 13, 0, 3, 0, 0, - 12, 21, 163, 149, 137, 131, 126, 123, 123, 118, 97, 73, 3, 4, 0, - 0, 11, 92, 150, 149, 137, 131, 118, 101, 98, 94, 72, 10, 0, 4, - 0, 0, 11, 39, 189, 160, 146, 137, 123, 123, 111, 101, 77, 83, 0, - 3, 0, 0, 12, 7, 162, 139, 149, 137, 131, 123, 118, 106, 94, 68, - 10, 4, 0, 0, 11, 47, 158, 139, 127, 131, 126, 123, 112, 89, 64, - 27, 0, 4, 0, 0, 4, 18, 168, 139, 137, 3, 131, 0, 5, 123, -101, 77, 73, 1, 0, 5, 0, 1, 33, 9, 53, 1, 52, 1, 8, - 6, 53, 1, 22, 3, 0, 1, 1, 3, 0, 1, 1, 11, 61, 1, - 8, 3, 0, 0, 4, 43, 255, 255, 19, 3, 0, 1, 5, 20, 61, - 1, 52, 1, 1, 3, 0, 1, 1, 1, 159, 4, 0, 1, 33, 12, - 61, 1, 24, 3, 0, 1, 1, 4, 255, 0, 0, 1, 95, 5, 0, - 0, 10, 78, 214, 214, 205, 174, 168, 160, 167, 47, 1, 6, 0, 0, - 5, 6, 193, 150, 149, 140, 0, 3, 133, 0, 6, 123, 106, 97, 77, - 62, 21, 3, 0, 0, 8, 87, 118, 131, 133, 149, 140, 131, 131, 3, -133, 1, 128, 1, 7, 3, 0, 0, 19, 1, 34, 220, 214, 205, 168, -160, 150, 137, 118, 102, 83, 0, 0, 1, 175, 137, 149, 140, 0, 3, -133, 0, 5, 129, 118, 112, 122, 23, 0, 6, 0, 0, 13, 67, 205, -168, 160, 149, 133, 131, 131, 123, 111, 97, 73, 10, 0, 3, 0, 0, - 12, 21, 158, 149, 149, 140, 133, 133, 129, 118, 97, 80, 3, 4, 0, - 0, 11, 92, 160, 158, 149, 133, 131, 111, 101, 97, 72, 13, 0, 4, - 0, 0, 26, 13, 193, 160, 150, 150, 149, 131, 118, 106, 86, 83, 1, - 0, 0, 7, 157, 150, 149, 149, 133, 131, 123, 116, 97, 73, 13, 4, - 0, 0, 11, 47, 158, 150, 149, 140, 133, 131, 123, 97, 68, 27, 0, - 4, 0, 0, 12, 3, 193, 140, 133, 133, 131, 131, 133, 117, 89, 73, - 3, 4, 0, 1, 9, 11, 53, 1, 8, 6, 53, 1, 29, 8, 0, - 1, 53, 10, 65, 1, 19, 3, 0, 0, 3, 19, 255, 240, 0, 4, - 0, 0, 4, 14, 44, 44, 61, 18, 65, 1, 29, 4, 0, 1, 33, - 4, 0, 1, 29, 12, 65, 1, 29, 4, 0, 1, 252, 3, 255, 0, - 0, 1, 251, 1, 5, 4, 0, 0, 8, 1, 138, 220, 220, 214, 193, - 92, 1, 8, 0, 0, 29, 1, 191, 140, 140, 133, 133, 129, 133, 126, -112, 106, 89, 64, 31, 0, 0, 1, 135, 123, 133, 133, 140, 150, 158, -140, 140, 133, 135, 1, 0, 6, 0, 0, 24, 7, 220, 214, 205, 174, -168, 158, 156, 157, 46, 0, 0, 6, 191, 150, 135, 133, 133, 129, 129, -133, 118, 106, 87, 7, 0, 0, 13, 1, 184, 189, 160, 158, 158, 140, -140, 133, 126, 102, 73, 7, 0, 3, 0, 0, 3, 21, 175, 158, 0, - 4, 140, 0, 5, 133, 123, 97, 73, 3, 0, 4, 0, 0, 3, 92, -158, 147, 0, 3, 133, 0, 5, 118, 106, 97, 72, 13, 0, 4, 0, - 1, 3, 1, 193, 4, 158, 0, 20, 140, 133, 118, 97, 87, 1, 0, - 0, 7, 175, 158, 158, 150, 133, 129, 123, 118, 101, 80, 13, 4, 0, - 0, 11, 47, 158, 158, 140, 133, 133, 123, 118, 102, 73, 27, 0, 4, - 0, 0, 5, 1, 193, 149, 133, 126, 0, 4, 133, 0, 3, 106, 80, - 6, 0, 4, 0, 1, 36, 10, 58, 0, 3, 53, 2, 48, 0, 5, - 58, 1, 43, 8, 0, 1, 44, 10, 71, 1, 25, 3, 0, 0, 3, - 1, 254, 121, 0, 4, 0, 0, 4, 22, 25, 2, 61, 18, 71, 1, - 61, 1, 5, 8, 0, 1, 25, 12, 71, 1, 36, 4, 0, 1, 237, - 3, 255, 0, 0, 1, 255, 1, 141, 5, 0, 0, 5, 2, 220, 220, -217, 40, 0, 10, 0, 0, 3, 31, 156, 136, 0, 5, 133, 0, 12, -129, 122, 122, 102, 73, 35, 0, 0, 7, 157, 123, 133, 3, 140, 0, - 5, 147, 162, 140, 127, 27, 0, 8, 0, 0, 8, 26, 226, 214, 217, -184, 55, 13, 1, 3, 0, 0, 4, 11, 191, 147, 140, 3, 133, 0, - 5, 129, 129, 118, 102, 42, 0, 8, 0, 0, 3, 69, 189, 158, 0, - 3, 157, 0, 6, 140, 133, 129, 102, 80, 4, 3, 0, 0, 12, 21, -175, 157, 140, 133, 140, 140, 133, 129, 106, 80, 4, 4, 0, 0, 11, - 91, 157, 147, 140, 133, 133, 123, 117, 101, 77, 15, 0, 4, 0, 0, - 20, 1, 193, 158, 157, 147, 150, 147, 147, 131, 102, 87, 1, 0, 0, - 7, 175, 157, 150, 140, 140, 3, 123, 0, 3, 106, 80, 13, 0, 4, - 0, 0, 11, 47, 157, 147, 140, 133, 133, 126, 118, 102, 73, 31, 0, - 5, 0, 0, 11, 167, 147, 129, 123, 133, 136, 133, 133, 112, 87, 7, - 0, 4, 0, 1, 44, 11, 58, 0, 8, 44, 8, 36, 52, 49, 52, - 58, 52, 8, 0, 1, 36, 10, 71, 1, 33, 4, 0, 1, 240, 1, - 43, 3, 0, 0, 5, 1, 65, 71, 12, 65, 0, 8, 71, 1, 29, - 1, 65, 9, 71, 1, 41, 8, 0, 1, 22, 12, 71, 1, 43, 4, - 0, 1, 202, 3, 255, 0, 0, 0, 3, 255, 255, 65, 0, 5, 0, - 0, 3, 11, 226, 18, 0, 10, 0, 0, 29, 15, 157, 143, 143, 136, -136, 143, 143, 145, 140, 129, 122, 112, 94, 35, 0, 0, 21, 170, 133, -129, 140, 145, 143, 143, 140, 122, 108, 1, 0, 8, 0, 0, 4, 1, - 67, 40, 5, 7, 0, 0, 4, 13, 191, 162, 156, 4, 143, 0, 4, -133, 122, 97, 31, 8, 0, 0, 12, 39, 193, 158, 157, 156, 140, 140, -133, 131, 102, 80, 3, 3, 0, 0, 12, 21, 191, 162, 145, 136, 136, -143, 136, 133, 122, 86, 7, 4, 0, 0, 11, 91, 162, 156, 156, 145, -145, 133, 122, 101, 77, 18, 0, 5, 0, 0, 16, 155, 175, 162, 162, -145, 145, 133, 122, 102, 87, 3, 0, 0, 7, 175, 156, 3, 145, 0, - 6, 129, 122, 122, 108, 80, 18, 4, 0, 0, 11, 47, 175, 162, 145, -136, 136, 133, 133, 112, 80, 32, 0, 5, 0, 0, 11, 119, 175, 147, -127, 133, 143, 140, 131, 108, 87, 10, 0, 4, 0, 1, 48, 12, 61, - 0, 8, 53, 19, 12, 17, 9, 25, 61, 5, 3, 0, 1, 1, 3, - 0, 1, 29, 3, 74, 1, 71, 1, 33, 5, 9, 1, 5, 4, 0, - 1, 159, 1, 1, 3, 0, 0, 5, 19, 74, 74, 12, 65, 0, 7, - 74, 0, 3, 58, 0, 33, 0, 10, 74, 1, 14, 7, 0, 1, 19, - 12, 74, 1, 49, 4, 0, 1, 152, 3, 255, 0, 0, 0, 4, 255, -255, 254, 43, 15, 0, 0, 4, 1, 31, 120, 133, 5, 143, 0, 21, -153, 156, 156, 145, 133, 117, 102, 27, 0, 0, 27, 194, 170, 145, 143, -153, 153, 143, 129, 106, 59, 0, 20, 0, 0, 12, 16, 191, 162, 170, -153, 143, 143, 153, 156, 129, 97, 31, 8, 0, 0, 12, 39, 194, 175, -170, 156, 140, 126, 122, 122, 106, 86, 3, 3, 0, 0, 12, 21, 191, -170, 145, 133, 136, 136, 133, 123, 106, 86, 7, 4, 0, 0, 3, 91, -170, 170, 0, 3, 156, 0, 5, 145, 129, 112, 86, 23, 0, 5, 0, - 0, 25, 142, 162, 170, 156, 156, 145, 129, 112, 97, 87, 3, 0, 0, - 11, 191, 162, 156, 156, 145, 129, 122, 122, 108, 80, 21, 0, 4, 0, - 0, 11, 45, 175, 162, 156, 153, 143, 143, 145, 127, 86, 35, 0, 5, - 0, 0, 11, 92, 194, 170, 145, 136, 143, 145, 133, 108, 87, 10, 0, - 4, 0, 1, 48, 17, 65, 0, 3, 29, 14, 9, 0, 3, 0, 1, - 1, 3, 0, 1, 2, 3, 14, 0, 3, 8, 36, 74, 0, 4, 75, - 1, 58, 4, 0, 1, 43, 4, 0, 0, 5, 36, 75, 75, 14, 71, - 0, 7, 75, 0, 4, 41, 0, 2, 65, 9, 75, 1, 52, 1, 1, - 6, 0, 1, 9, 12, 75, 1, 61, 4, 0, 1, 121, 3, 255, 0, - 0, 3, 255, 1, 253, 1, 25, 13, 0, 0, 4, 4, 70, 104, 131, - 5, 156, 0, 22, 145, 145, 156, 170, 156, 145, 122, 108, 15, 0, 0, - 39, 191, 170, 166, 164, 156, 156, 145, 133, 102, 42, 20, 0, 0, 12, - 11, 213, 194, 191, 170, 156, 140, 140, 145, 133, 102, 32, 8, 0, 0, - 12, 39, 191, 170, 170, 166, 156, 140, 129, 122, 122, 99, 1, 3, 0, - 0, 4, 21, 213, 194, 156, 3, 133, 0, 5, 122, 112, 97, 80, 7, - 0, 4, 0, 0, 11, 90, 175, 170, 156, 156, 170, 156, 145, 122, 86, - 31, 0, 5, 0, 0, 25, 124, 185, 170, 170, 156, 156, 145, 122, 97, - 87, 1, 0, 0, 11, 224, 193, 194, 194, 170, 133, 122, 117, 102, 80, - 21, 0, 4, 0, 0, 11, 46, 191, 175, 170, 156, 145, 133, 133, 130, - 96, 46, 0, 5, 0, 0, 11, 76, 175, 170, 156, 153, 153, 145, 133, -108, 86, 7, 0, 4, 0, 1, 49, 18, 65, 1, 44, 1, 2, 3, - 0, 1, 1, 3, 0, 1, 8, 3, 71, 1, 75, 6, 81, 1, 74, - 1, 1, 3, 0, 1, 1, 4, 0, 0, 5, 61, 81, 81, 14, 71, - 0, 7, 81, 0, 4, 24, 0, 0, 29, 10, 81, 1, 24, 6, 0, - 1, 1, 5, 9, 1, 22, 6, 81, 1, 74, 4, 0, 1, 95, 3, -255, 0, 0, 4, 255, 1, 243, 1, 12, 10, 0, 0, 8, 1, 35, - 87, 104, 133, 170, 185, 180, 3, 166, 0, 14, 156, 140, 145, 156, 164, -156, 130, 135, 1, 0, 0, 39, 213, 180, 5, 164, 0, 3, 145, 108, - 42, 0, 20, 0, 0, 12, 6, 213, 194, 191, 185, 166, 145, 133, 129, -122, 97, 35, 8, 0, 0, 12, 37, 191, 185, 180, 180, 166, 166, 145, -133, 122, 99, 1, 3, 0, 0, 12, 21, 213, 194, 185, 145, 133, 140, -140, 122, 102, 80, 10, 4, 0, 0, 11, 107, 191, 166, 156, 145, 145, -156, 143, 122, 86, 42, 0, 5, 0, 1, 124, 1, 185, 5, 166, 0, - 18, 140, 112, 104, 1, 0, 0, 11, 213, 194, 194, 191, 185, 156, 122, -108, 108, 87, 23, 4, 0, 0, 11, 54, 191, 191, 185, 166, 156, 133, -127, 122, 96, 54, 0, 5, 0, 0, 11, 54, 185, 166, 166, 164, 164, -153, 145, 130, 96, 7, 0, 4, 0, 1, 52, 19, 71, 1, 36, 7, - 0, 1, 1, 1, 75, 10, 84, 1, 8, 7, 0, 1, 12, 3, 84, - 1, 14, 1, 74, 7, 84, 0, 5, 5, 0, 0, 1, 61, 0, 9, - 84, 1, 65, 1, 2, 6, 0, 1, 81, 4, 84, 1, 9, 7, 84, - 1, 1, 3, 0, 1, 71, 3, 255, 0, 0, 5, 255, 1, 222, 1, - 1, 8, 0, 0, 6, 15, 83, 87, 96, 131, 166, 6, 180, 0, 3, -179, 164, 156, 0, 3, 145, 1, 127, 1, 90, 3, 0, 0, 11, 30, -213, 213, 180, 179, 179, 164, 164, 166, 120, 54, 0, 20, 0, 0, 12, - 2, 216, 213, 191, 185, 180, 164, 156, 135, 122, 86, 46, 8, 0, 1, - 42, 1, 195, 4, 180, 0, 6, 179, 145, 133, 112, 99, 1, 3, 0, - 0, 5, 30, 213, 213, 191, 166, 0, 3, 156, 0, 4, 133, 108, 87, - 10, 4, 0, 0, 5, 155, 185, 180, 179, 164, 0, 3, 145, 0, 3, -131, 96, 54, 0, 5, 0, 1, 128, 3, 180, 0, 21, 179, 180, 180, -145, 108, 99, 1, 0, 0, 11, 204, 180, 180, 191, 185, 180, 145, 130, -120, 87, 27, 0, 4, 0, 0, 3, 107, 185, 199, 0, 3, 180, 0, - 5, 156, 135, 120, 86, 83, 0, 5, 0, 0, 3, 83, 199, 180, 0, - 4, 164, 0, 4, 156, 133, 104, 3, 4, 0, 1, 61, 19, 74, 1, - 49, 8, 0, 1, 61, 10, 84, 1, 19, 7, 0, 1, 33, 3, 84, - 1, 14, 1, 75, 6, 84, 1, 58, 4, 0, 1, 25, 10, 84, 1, - 33, 6, 0, 1, 71, 4, 84, 1, 9, 7, 84, 1, 9, 3, 0, - 1, 48, 3, 255, 0, 0, 5, 255, 1, 253, 1, 1, 6, 0, 0, - 16, 1, 51, 87, 102, 108, 122, 133, 156, 179, 196, 196, 188, 188, 179, -182, 176, 3, 164, 0, 3, 140, 127, 13, 0, 3, 0, 0, 12, 16, -224, 213, 199, 196, 179, 188, 179, 161, 130, 99, 1, 9, 0, 0, 3, - 7, 3, 1, 0, 7, 0, 0, 12, 1, 216, 213, 204, 196, 188, 182, -161, 145, 129, 97, 54, 8, 0, 0, 3, 47, 204, 204, 0, 3, 199, - 0, 6, 196, 156, 129, 112, 99, 1, 3, 0, 0, 12, 31, 216, 213, -213, 204, 188, 179, 164, 140, 108, 87, 15, 3, 0, 0, 13, 1, 171, -179, 196, 182, 176, 164, 164, 145, 127, 102, 87, 1, 0, 3, 0, 1, - 1, 1, 171, 3, 179, 0, 6, 196, 196, 188, 164, 112, 99, 3, 0, - 0, 12, 10, 204, 196, 179, 188, 196, 196, 179, 164, 130, 96, 31, 4, - 0, 0, 3, 167, 196, 196, 0, 3, 188, 0, 6, 164, 153, 129, 108, - 87, 1, 4, 0, 0, 11, 128, 196, 204, 179, 182, 182, 176, 161, 133, -104, 1, 0, 3, 0, 1, 1, 20, 75, 1, 65, 8, 0, 1, 49, - 10, 88, 1, 29, 7, 0, 1, 52, 3, 88, 1, 14, 1, 81, 6, - 88, 1, 41, 4, 0, 1, 1, 1, 61, 9, 88, 1, 84, 1, 8, - 5, 0, 1, 61, 4, 88, 1, 9, 7, 88, 1, 17, 3, 0, 1, - 33, 3, 255, 0, 0, 5, 255, 1, 109, 6, 0, 0, 10, 13, 87, -102, 122, 133, 133, 126, 129, 145, 182, 3, 192, 6, 182, 0, 3, 176, -145, 83, 0, 4, 0, 0, 12, 2, 234, 235, 206, 196, 188, 188, 182, -161, 143, 102, 13, 8, 0, 0, 8, 10, 87, 90, 83, 46, 21, 3, - 1, 3, 0, 0, 12, 1, 216, 227, 206, 192, 182, 182, 179, 153, 133, -106, 70, 8, 0, 1, 47, 3, 204, 0, 7, 196, 196, 188, 179, 145, -117, 99, 0, 4, 0, 0, 12, 27, 208, 204, 204, 196, 188, 182, 176, -153, 117, 86, 38, 3, 0, 0, 3, 18, 164, 176, 0, 3, 182, 0, - 7, 179, 164, 164, 136, 122, 96, 7, 0, 3, 0, 0, 3, 10, 180, -182, 0, 3, 188, 3, 182, 1, 129, 1, 83, 3, 0, 0, 5, 10, -204, 188, 176, 182, 0, 3, 188, 0, 4, 164, 136, 112, 54, 3, 0, - 0, 4, 6, 166, 182, 188, 3, 182, 0, 6, 179, 164, 145, 122, 96, - 21, 3, 0, 1, 3, 1, 180, 3, 188, 3, 182, 0, 4, 161, 129, -104, 1, 3, 0, 1, 5, 9, 81, 1, 65, 1, 52, 10, 81, 1, - 5, 7, 0, 1, 41, 10, 95, 1, 36, 6, 0, 1, 2, 1, 88, - 3, 95, 1, 17, 1, 84, 6, 95, 1, 22, 5, 0, 1, 19, 10, - 95, 1, 48, 5, 0, 1, 53, 4, 95, 1, 9, 7, 95, 1, 24, - 3, 0, 1, 19, 3, 255, 0, 0, 4, 255, 1, 218, 1, 1, 5, - 0, 0, 11, 27, 104, 112, 140, 164, 176, 161, 154, 143, 153, 182, 0, - 4, 192, 0, 8, 182, 182, 192, 192, 182, 176, 157, 3, 4, 0, 0, - 13, 1, 224, 231, 206, 206, 192, 192, 182, 161, 143, 112, 83, 1, 0, - 6, 0, 1, 1, 1, 70, 3, 89, 0, 19, 94, 86, 87, 90, 46, - 1, 0, 1, 213, 228, 206, 192, 182, 182, 178, 161, 143, 111, 87, 0, - 8, 0, 0, 4, 55, 208, 206, 207, 3, 192, 0, 4, 182, 153, 118, - 99, 4, 0, 0, 4, 31, 208, 207, 207, 4, 192, 0, 26, 182, 136, -106, 96, 10, 1, 2, 108, 164, 176, 182, 182, 192, 190, 182, 182, 161, -143, 122, 83, 3, 1, 3, 99, 153, 182, 3, 190, 0, 5, 182, 182, -164, 133, 54, 0, 3, 0, 0, 17, 13, 208, 182, 161, 161, 182, 192, -182, 182, 176, 133, 117, 21, 1, 1, 83, 161, 0, 3, 192, 4, 182, - 0, 9, 164, 143, 117, 86, 10, 1, 2, 83, 164, 0, 6, 182, 0, - 3, 161, 123, 83, 0, 4, 0, 1, 14, 9, 84, 1, 24, 1, 29, - 10, 84, 1, 19, 3, 0, 1, 1, 3, 0, 1, 33, 10, 100, 1, - 49, 6, 0, 1, 25, 4, 100, 1, 17, 1, 95, 5, 100, 1, 95, - 1, 1, 6, 0, 1, 58, 10, 100, 1, 19, 4, 0, 1, 49, 4, -100, 1, 12, 7, 100, 1, 33, 3, 0, 1, 2, 3, 255, 0, 0, - 3, 255, 1, 251, 1, 17, 5, 0, 0, 17, 35, 96, 118, 133, 153, -182, 200, 200, 190, 182, 182, 192, 200, 207, 207, 192, 192, 0, 3, 207, - 0, 3, 192, 179, 15, 0, 6, 0, 0, 13, 113, 231, 228, 206, 207, -200, 190, 182, 153, 123, 97, 62, 3, 0, 4, 0, 0, 11, 3, 59, - 86, 98, 112, 106, 102, 97, 86, 85, 90, 0, 3, 0, 1, 163, 1, -227, 3, 207, 0, 7, 200, 200, 178, 144, 112, 96, 1, 0, 7, 0, - 1, 54, 3, 207, 0, 7, 200, 200, 190, 178, 154, 123, 90, 0, 4, - 0, 0, 18, 38, 207, 190, 192, 200, 178, 182, 207, 200, 182, 143, 126, -120, 120, 135, 164, 161, 190, 4, 200, 0, 12, 190, 190, 176, 153, 136, -112, 108, 104, 120, 133, 154, 178, 4, 200, 0, 4, 178, 154, 123, 27, - 3, 0, 0, 17, 13, 208, 207, 176, 154, 161, 178, 178, 161, 176, 161, -143, 130, 120, 130, 145, 176, 0, 6, 200, 0, 12, 190, 178, 161, 133, -112, 104, 104, 122, 131, 154, 176, 178, 3, 190, 0, 4, 178, 161, 123, - 46, 4, 0, 1, 29, 8, 88, 0, 3, 58, 1, 22, 0, 10, 88, - 1, 29, 7, 0, 1, 22, 10, 109, 1, 75, 6, 0, 1, 49, 4, -109, 1, 19, 1, 100, 5, 109, 1, 65, 7, 0, 1, 14, 10, 109, - 1, 74, 1, 1, 3, 0, 1, 44, 4, 109, 1, 12, 7, 109, 1, - 41, 4, 0, 0, 3, 253, 255, 255, 0, 0, 0, 3, 255, 1, 84, - 5, 0, 0, 11, 31, 108, 116, 133, 143, 144, 154, 178, 200, 200, 190, - 0, 3, 200, 1, 207, 3, 221, 0, 5, 219, 219, 209, 208, 23, 0, - 7, 0, 0, 5, 28, 235, 231, 206, 209, 0, 3, 200, 0, 20, 178, -154, 118, 101, 96, 54, 32, 35, 70, 108, 112, 116, 123, 136, 133, 118, -106, 97, 89, 42, 3, 0, 0, 12, 142, 227, 225, 221, 207, 207, 209, -200, 161, 118, 97, 1, 7, 0, 0, 11, 92, 219, 207, 200, 209, 200, -200, 173, 154, 118, 83, 0, 4, 0, 0, 5, 38, 207, 200, 178, 182, - 0, 3, 161, 0, 11, 190, 190, 161, 154, 153, 143, 161, 200, 200, 209, -209, 0, 3, 207, 0, 4, 200, 182, 161, 143, 3, 136, 0, 13, 129, -136, 154, 173, 190, 200, 200, 203, 200, 200, 154, 123, 7, 0, 3, 0, - 0, 5, 18, 223, 219, 207, 176, 0, 4, 161, 0, 9, 144, 154, 161, -153, 143, 165, 173, 190, 200, 0, 5, 207, 0, 19, 209, 200, 161, 144, -133, 123, 123, 136, 154, 161, 176, 178, 190, 200, 200, 190, 154, 123, 18, - 0, 4, 0, 1, 49, 8, 88, 0, 3, 17, 0, 9, 0, 10, 88, - 1, 43, 7, 0, 1, 8, 10, 115, 1, 105, 6, 0, 1, 95, 4, -115, 1, 19, 1, 105, 5, 115, 1, 41, 8, 0, 1, 53, 10, 115, - 1, 33, 3, 0, 1, 41, 4, 115, 1, 14, 7, 115, 1, 49, 4, - 0, 0, 3, 243, 255, 255, 0, 0, 0, 0, 4, 255, 255, 252, 2, - 4, 0, 0, 23, 10, 135, 144, 161, 165, 178, 190, 173, 173, 178, 165, -165, 200, 203, 203, 209, 219, 225, 225, 221, 219, 204, 13, 0, 8, 0, - 0, 6, 1, 217, 233, 228, 219, 209, 3, 203, 0, 19, 173, 144, 133, -123, 111, 112, 118, 131, 144, 161, 173, 165, 173, 173, 161, 136, 111, 102, - 4, 0, 3, 0, 0, 12, 92, 228, 225, 221, 219, 209, 212, 209, 190, -136, 102, 7, 7, 0, 0, 4, 90, 219, 209, 209, 3, 203, 0, 4, -178, 153, 118, 70, 4, 0, 0, 7, 42, 221, 207, 200, 200, 190, 190, - 0, 3, 173, 0, 25, 154, 165, 173, 178, 178, 200, 203, 212, 215, 207, -219, 221, 219, 209, 209, 182, 161, 144, 143, 143, 154, 165, 178, 190, 200, - 0, 3, 203, 0, 3, 200, 154, 108, 0, 4, 0, 0, 6, 21, 223, -219, 219, 209, 200, 3, 190, 0, 11, 173, 161, 161, 154, 147, 161, 190, -200, 203, 209, 215, 0, 5, 219, 0, 17, 209, 200, 173, 161, 144, 144, -161, 165, 173, 178, 190, 200, 200, 190, 154, 130, 1, 0, 4, 0, 1, - 49, 7, 95, 0, 4, 48, 0, 0, 1, 10, 95, 1, 58, 7, 0, - 1, 1, 1, 115, 10, 125, 1, 5, 4, 0, 1, 17, 5, 125, 1, - 22, 1, 115, 5, 125, 1, 19, 3, 0, 1, 2, 4, 0, 1, 9, - 1, 121, 9, 125, 0, 5, 105, 2, 0, 0, 36, 0, 4, 125, 1, - 14, 7, 125, 1, 65, 4, 0, 0, 3, 211, 255, 255, 0, 0, 0, - 0, 3, 255, 255, 141, 0, 4, 0, 0, 23, 1, 124, 161, 200, 203, -203, 200, 203, 200, 190, 178, 165, 178, 203, 203, 212, 219, 219, 221, 221, -219, 124, 3, 0, 10, 0, 0, 11, 50, 238, 233, 225, 215, 201, 203, -190, 161, 154, 144, 0, 5, 161, 0, 10, 165, 200, 203, 203, 201, 203, -198, 173, 136, 62, 4, 0, 0, 5, 55, 225, 225, 219, 219, 0, 3, -203, 0, 4, 200, 161, 112, 13, 7, 0, 0, 11, 124, 212, 203, 203, -200, 200, 190, 165, 136, 111, 59, 0, 4, 0, 0, 13, 46, 225, 219, -215, 203, 201, 201, 200, 190, 178, 165, 178, 200, 0, 4, 203, 0, 4, -212, 215, 207, 219, 4, 221, 0, 3, 219, 203, 178, 0, 3, 161, 0, - 10, 165, 178, 190, 200, 190, 190, 200, 178, 143, 27, 4, 0, 0, 7, - 30, 219, 215, 212, 215, 212, 203, 0, 3, 201, 0, 5, 190, 178, 165, -165, 190, 0, 4, 203, 1, 209, 1, 215, 3, 219, 1, 221, 3, 219, - 0, 4, 203, 200, 173, 165, 3, 173, 0, 6, 190, 200, 190, 178, 143, - 51, 4, 0, 0, 3, 9, 17, 48, 0, 5, 105, 1, 100, 1, 8, - 3, 0, 1, 81, 6, 105, 3, 71, 1, 61, 8, 0, 1, 100, 10, -132, 1, 22, 4, 0, 1, 44, 5, 132, 1, 22, 1, 121, 4, 132, - 1, 115, 1, 1, 3, 0, 1, 58, 1, 43, 4, 0, 1, 52, 10, -132, 0, 4, 48, 0, 0, 29, 4, 132, 1, 14, 7, 132, 1, 84, - 4, 0, 0, 3, 172, 255, 255, 0, 0, 0, 0, 3, 255, 255, 48, - 0, 4, 0, 0, 7, 35, 153, 165, 200, 203, 203, 201, 0, 3, 203, - 0, 11, 200, 178, 190, 203, 209, 215, 219, 221, 219, 204, 31, 0, 12, - 0, 0, 26, 1, 184, 238, 231, 219, 201, 190, 173, 161, 154, 144, 165, -198, 178, 165, 173, 165, 178, 203, 212, 203, 203, 201, 190, 145, 3, 4, - 0, 0, 5, 40, 228, 225, 215, 215, 0, 3, 203, 0, 4, 173, 144, -111, 27, 7, 0, 0, 11, 155, 212, 201, 190, 173, 165, 165, 144, 123, -101, 54, 0, 4, 0, 0, 5, 54, 223, 225, 219, 215, 0, 4, 203, - 0, 4, 200, 200, 201, 212, 4, 215, 0, 24, 203, 203, 212, 212, 219, -221, 221, 227, 221, 219, 201, 198, 200, 190, 165, 178, 200, 203, 200, 190, -178, 165, 120, 1, 4, 0, 0, 7, 27, 219, 215, 203, 209, 215, 212, - 0, 3, 203, 1, 209, 1, 212, 3, 201, 0, 4, 203, 203, 212, 212, - 3, 215, 0, 19, 219, 221, 219, 215, 215, 219, 215, 209, 201, 198, 198, -190, 178, 200, 203, 200, 173, 135, 2, 0, 4, 0, 0, 5, 44, 109, - 29, 36, 109, 0, 3, 115, 1, 44, 4, 0, 1, 65, 6, 115, 1, - 5, 3, 33, 1, 2, 7, 0, 1, 74, 10, 141, 1, 36, 4, 0, - 1, 95, 5, 141, 1, 22, 1, 95, 4, 105, 1, 53, 4, 0, 0, - 3, 141, 229, 1, 0, 3, 0, 1, 5, 1, 125, 9, 141, 0, 4, -132, 9, 0, 22, 4, 141, 1, 17, 7, 141, 1, 109, 4, 0, 0, - 3, 125, 255, 255, 0, 0, 0, 0, 3, 255, 255, 9, 0, 3, 0, - 0, 8, 1, 135, 165, 178, 190, 203, 203, 201, 3, 203, 0, 4, 190, -165, 190, 203, 3, 219, 0, 3, 230, 54, 1, 0, 14, 0, 0, 6, - 4, 245, 241, 231, 221, 219, 3, 200, 0, 15, 178, 178, 203, 200, 200, -190, 178, 178, 203, 212, 215, 212, 201, 190, 32, 0, 5, 0, 0, 12, - 18, 231, 231, 221, 212, 203, 200, 200, 178, 144, 111, 46, 7, 0, 0, - 11, 167, 215, 212, 203, 200, 200, 178, 161, 144, 106, 51, 0, 4, 0, - 0, 23, 76, 227, 228, 225, 219, 219, 212, 212, 209, 201, 212, 219, 228, -225, 225, 221, 219, 215, 212, 207, 219, 225, 230, 0, 3, 228, 0, 14, -225, 219, 215, 212, 203, 190, 200, 201, 203, 209, 203, 198, 179, 13, 5, - 0, 0, 5, 39, 227, 225, 212, 203, 0, 5, 219, 0, 6, 223, 223, -215, 215, 219, 221, 3, 219, 0, 6, 221, 221, 230, 230, 228, 228, 4, -219, 0, 6, 212, 212, 209, 212, 203, 190, 3, 203, 1, 190, 1, 32, - 4, 0, 0, 10, 1, 105, 121, 121, 49, 22, 109, 121, 105, 2, 4, - 0, 1, 52, 6, 121, 1, 14, 3, 121, 1, 25, 7, 0, 1, 52, - 10, 152, 1, 49, 3, 0, 1, 5, 6, 152, 1, 52, 5, 33, 1, - 8, 3, 0, 0, 4, 1, 249, 255, 58, 4, 0, 1, 48, 10, 152, - 0, 3, 75, 0, 12, 0, 4, 152, 1, 17, 7, 152, 1, 132, 4, - 0, 0, 3, 105, 255, 255, 0, 0, 0, 1, 255, 1, 249, 4, 0, - 0, 5, 7, 207, 198, 200, 200, 0, 3, 203, 0, 11, 201, 203, 200, -178, 165, 190, 203, 215, 223, 91, 3, 0, 17, 0, 0, 10, 20, 245, -241, 235, 231, 221, 219, 219, 203, 203, 4, 215, 0, 3, 209, 201, 203, - 0, 3, 215, 1, 203, 1, 51, 6, 0, 0, 12, 4, 234, 238, 231, -219, 209, 209, 215, 209, 173, 133, 83, 7, 0, 0, 11, 216, 225, 219, -215, 203, 201, 201, 198, 173, 123, 46, 0, 4, 0, 0, 39, 76, 235, -231, 228, 225, 221, 219, 215, 215, 219, 21, 181, 235, 235, 233, 231, 228, -225, 221, 219, 225, 40, 2, 184, 239, 239, 233, 228, 225, 225, 221, 209, -203, 215, 219, 219, 212, 207, 27, 0, 6, 0, 0, 16, 50, 235, 235, -228, 221, 221, 219, 221, 221, 230, 30, 103, 225, 228, 231, 231, 4, 228, - 0, 14, 236, 69, 1, 134, 241, 238, 231, 228, 225, 221, 221, 219, 221, -219, 3, 212, 1, 219, 1, 46, 5, 0, 1, 36, 4, 125, 0, 4, - 71, 14, 100, 36, 5, 0, 1, 43, 6, 125, 1, 14, 3, 125, 1, - 43, 7, 0, 1, 41, 10, 159, 1, 75, 3, 0, 1, 36, 12, 159, - 1, 12, 3, 0, 0, 5, 24, 255, 255, 246, 2, 0, 3, 0, 1, - 1, 1, 125, 10, 159, 1, 25, 1, 2, 4, 159, 1, 19, 8, 159, - 1, 1, 3, 0, 0, 3, 75, 255, 255, 0, 0, 0, 1, 255, 1, -211, 4, 0, 0, 3, 27, 212, 212, 0, 5, 203, 0, 9, 201, 201, -203, 190, 161, 190, 212, 157, 10, 0, 20, 0, 0, 20, 11, 220, 247, -241, 238, 231, 227, 221, 219, 219, 225, 228, 225, 221, 221, 219, 219, 215, -219, 46, 7, 0, 0, 12, 1, 242, 241, 241, 238, 228, 225, 228, 225, -200, 154, 120, 6, 0, 0, 12, 1, 234, 233, 231, 228, 221, 219, 215, -201, 200, 136, 46, 4, 0, 0, 33, 110, 241, 244, 239, 235, 231, 228, -231, 228, 230, 0, 1, 103, 247, 241, 242, 238, 233, 227, 230, 37, 0, - 0, 1, 110, 247, 241, 239, 238, 235, 231, 228, 228, 0, 3, 225, 1, -155, 1, 10, 7, 0, 0, 38, 50, 241, 244, 239, 235, 231, 227, 228, -228, 236, 2, 0, 69, 242, 241, 239, 238, 233, 231, 236, 69, 0, 0, - 1, 67, 245, 244, 241, 239, 238, 233, 231, 233, 231, 228, 219, 195, 21, - 5, 0, 1, 2, 1, 121, 5, 141, 0, 3, 100, 14, 1, 0, 5, - 0, 1, 29, 6, 141, 1, 17, 3, 141, 1, 61, 7, 0, 1, 24, - 10, 172, 1, 115, 3, 0, 1, 81, 11, 172, 1, 132, 4, 0, 1, - 81, 3, 255, 1, 88, 4, 0, 1, 41, 10, 172, 0, 3, 115, 1, -152, 0, 3, 172, 1, 17, 8, 172, 1, 9, 3, 0, 0, 3, 52, -255, 255, 0, 0, 0, 1, 255, 1, 159, 4, 0, 0, 5, 47, 219, -215, 215, 203, 0, 6, 201, 0, 5, 200, 154, 164, 45, 1, 0, 8, - 0, 1, 18, 1, 46, 12, 0, 0, 11, 1, 67, 245, 244, 241, 239, -235, 231, 227, 231, 235, 0, 3, 231, 0, 4, 228, 225, 155, 10, 9, - 0, 0, 12, 226, 245, 247, 244, 238, 238, 235, 236, 219, 192, 156, 1, - 5, 0, 0, 12, 1, 242, 239, 239, 238, 233, 231, 228, 221, 209, 154, - 46, 4, 0, 0, 10, 110, 245, 247, 247, 248, 238, 235, 227, 227, 142, - 3, 0, 0, 7, 11, 78, 187, 210, 148, 55, 3, 0, 5, 0, 0, - 11, 11, 110, 247, 248, 242, 242, 238, 236, 213, 92, 18, 0, 9, 0, - 0, 20, 50, 248, 245, 247, 242, 242, 234, 236, 236, 213, 1, 0, 0, - 5, 67, 187, 226, 148, 69, 11, 5, 0, 0, 12, 6, 78, 226, 247, -241, 242, 239, 234, 234, 113, 30, 1, 6, 0, 1, 75, 7, 152, 1, - 29, 6, 0, 1, 17, 6, 152, 1, 17, 3, 152, 1, 100, 7, 0, - 1, 5, 10, 183, 0, 5, 152, 0, 0, 1, 152, 0, 11, 183, 1, - 75, 4, 0, 1, 172, 3, 255, 1, 252, 1, 5, 3, 0, 1, 1, - 1, 125, 10, 183, 1, 43, 1, 141, 3, 183, 1, 33, 1, 132, 7, -183, 1, 22, 3, 0, 0, 3, 36, 255, 255, 0, 0, 0, 1, 255, - 1, 152, 4, 0, 0, 5, 47, 219, 225, 221, 215, 0, 3, 201, 0, - 6, 203, 200, 190, 178, 153, 35, 8, 0, 0, 5, 1, 42, 96, 94, - 27, 0, 13, 0, 0, 14, 1, 40, 169, 247, 248, 242, 239, 238, 239, -238, 234, 234, 92, 13, 11, 0, 1, 1, 4, 6, 3, 11, 0, 3, - 10, 10, 4, 0, 6, 0, 1, 1, 1, 248, 3, 244, 0, 7, 241, -238, 235, 228, 219, 190, 46, 0, 4, 0, 3, 1, 0, 7, 2, 2, - 5, 6, 4, 11, 1, 0, 17, 0, 0, 6, 1, 5, 11, 11, 6, - 1, 12, 0, 3, 1, 3, 2, 0, 4, 6, 6, 11, 1, 17, 0, - 0, 7, 1, 2, 11, 11, 6, 2, 1, 0, 8, 0, 1, 49, 7, -159, 1, 100, 7, 0, 1, 2, 1, 152, 5, 159, 1, 19, 3, 159, - 1, 141, 1, 1, 7, 0, 1, 159, 10, 197, 0, 3, 2, 0, 24, - 0, 12, 197, 1, 36, 3, 0, 1, 1, 1, 253, 4, 255, 1, 115, - 4, 0, 1, 33, 10, 197, 1, 183, 1, 183, 3, 197, 1, 81, 1, - 74, 7, 197, 1, 33, 3, 0, 0, 3, 22, 255, 255, 0, 0, 0, - 1, 255, 1, 159, 4, 0, 0, 14, 38, 225, 225, 221, 219, 219, 212, -212, 203, 200, 190, 161, 140, 1, 7, 0, 0, 7, 13, 80, 97, 89, - 89, 86, 3, 0, 5, 0, 1, 2, 9, 0, 0, 3, 1, 6, 20, - 0, 3, 28, 1, 16, 1, 5, 32, 0, 0, 11, 20, 20, 28, 28, - 30, 40, 40, 39, 45, 45, 3, 0, 90, 0, 1, 49, 8, 172, 1, - 22, 8, 0, 1, 141, 5, 172, 1, 19, 4, 172, 1, 9, 7, 0, - 1, 125, 10, 202, 0, 3, 22, 0, 61, 0, 12, 202, 1, 5, 3, - 0, 1, 36, 5, 255, 1, 253, 1, 17, 4, 0, 1, 115, 14, 202, - 1, 152, 1, 33, 7, 202, 1, 44, 3, 0, 0, 3, 8, 255, 255, - 0, 0, 0, 1, 255, 1, 211, 4, 0, 0, 14, 18, 230, 221, 221, -219, 219, 215, 209, 212, 203, 190, 143, 122, 3, 4, 0, 0, 10, 1, - 10, 62, 96, 101, 118, 111, 98, 89, 59, 5, 0, 0, 3, 65, 222, - 43, 0, 22, 0, 0, 4, 8, 159, 246, 44, 74, 0, 0, 5, 1, - 65, 218, 121, 2, 0, 41, 0, 1, 5, 1, 95, 8, 183, 1, 81, - 4, 0, 1, 1, 4, 0, 1, 115, 5, 183, 1, 19, 4, 183, 1, - 33, 7, 0, 1, 95, 10, 211, 0, 3, 41, 0, 132, 0, 11, 211, - 1, 132, 4, 0, 1, 105, 6, 255, 1, 141, 4, 0, 1, 22, 1, -202, 14, 211, 1, 19, 1, 202, 6, 211, 1, 53, 3, 0, 0, 3, - 1, 254, 255, 0, 0, 0, 1, 255, 1, 246, 4, 0, 0, 29, 2, -234, 231, 219, 219, 215, 209, 203, 203, 190, 178, 143, 106, 62, 10, 3, - 10, 35, 83, 97, 101, 123, 129, 154, 154, 123, 98, 86, 21, 0, 4, - 0, 0, 5, 43, 255, 255, 141, 8, 0, 19, 0, 0, 6, 48, 243, -255, 255, 254, 52, 55, 0, 0, 5, 9, 84, 152, 100, 22, 0, 11, - 0, 0, 3, 1, 36, 218, 0, 3, 255, 1, 211, 1, 9, 21, 0, - 0, 5, 12, 71, 152, 100, 12, 0, 12, 0, 0, 3, 14, 65, 172, - 0, 8, 197, 1, 183, 1, 9, 4, 0, 1, 105, 4, 0, 1, 88, - 5, 197, 1, 14, 1, 159, 3, 197, 1, 52, 7, 0, 1, 61, 10, -218, 0, 3, 58, 8, 211, 0, 11, 218, 1, 71, 4, 0, 1, 211, - 7, 255, 1, 29, 4, 0, 1, 105, 14, 218, 1, 52, 1, 125, 6, -218, 1, 75, 4, 0, 1, 249, 1, 255, 0, 0, 0, 3, 255, 255, - 12, 0, 4, 0, 0, 14, 148, 235, 225, 215, 215, 201, 203, 200, 190, -178, 161, 123, 112, 108, 3, 106, 0, 12, 112, 123, 136, 154, 165, 190, -190, 154, 116, 98, 87, 1, 3, 0, 1, 36, 3, 255, 0, 3, 252, -105, 19, 0, 14, 0, 0, 3, 2, 52, 218, 0, 6, 255, 0, 3, -125, 36, 5, 0, 10, 0, 0, 5, 19, 95, 197, 125, 14, 0, 15, - 0, 0, 5, 9, 58, 53, 29, 2, 0, 6, 0, 0, 12, 1, 43, -121, 202, 183, 121, 71, 48, 58, 105, 197, 254, 4, 255, 0, 12, 197, - 84, 43, 12, 1, 0, 0, 9, 33, 58, 132, 250, 6, 255, 0, 4, -250, 109, 41, 5, 7, 0, 0, 12, 1, 36, 109, 197, 197, 125, 71, - 44, 58, 105, 202, 254, 3, 255, 0, 5, 254, 152, 84, 36, 1, 0, - 4, 0, 0, 4, 5, 36, 71, 141, 11, 202, 1, 61, 4, 0, 1, - 44, 1, 251, 4, 0, 1, 61, 5, 202, 0, 6, 115, 24, 197, 202, -202, 95, 7, 0, 1, 43, 10, 222, 1, 95, 1, 44, 12, 222, 1, - 33, 3, 0, 1, 5, 1, 254, 7, 255, 1, 183, 4, 0, 1, 12, - 1, 211, 13, 222, 1, 115, 1, 61, 6, 222, 1, 105, 4, 0, 1, -222, 1, 255, 0, 0, 0, 3, 255, 255, 53, 0, 4, 0, 0, 6, - 28, 242, 235, 219, 215, 212, 3, 203, 0, 3, 201, 190, 161, 0, 5, -144, 1, 154, 1, 165, 3, 190, 0, 7, 201, 201, 190, 144, 112, 54, - 1, 0, 3, 0, 1, 53, 6, 255, 0, 5, 218, 115, 48, 22, 2, - 0, 5, 0, 0, 5, 9, 36, 81, 152, 253, 0, 11, 255, 0, 3, -253, 243, 222, 0, 4, 197, 0, 3, 211, 232, 250, 0, 4, 255, 0, - 4, 253, 100, 19, 1, 10, 0, 0, 3, 1, 74, 253, 0, 4, 255, - 0, 7, 254, 252, 243, 240, 240, 243, 254, 0, 37, 255, 1, 253, 5, -240, 1, 243, 1, 254, 17, 255, 1, 202, 1, 1, 3, 0, 1, 2, - 1, 172, 13, 211, 1, 172, 1, 2, 3, 0, 0, 4, 1, 232, 255, - 5, 3, 0, 1, 43, 6, 211, 0, 5, 29, 183, 211, 211, 132, 0, - 7, 0, 1, 22, 10, 229, 1, 141, 1, 115, 11, 229, 1, 211, 1, - 1, 3, 0, 1, 48, 9, 255, 1, 41, 4, 0, 1, 84, 13, 229, - 1, 211, 1, 25, 6, 229, 1, 125, 4, 0, 1, 183, 1, 255, 0, - 0, 0, 3, 255, 255, 172, 0, 5, 0, 0, 4, 138, 239, 231, 221, - 3, 215, 0, 6, 219, 219, 209, 190, 173, 178, 4, 200, 0, 4, 203, -203, 200, 203, 3, 201, 0, 3, 182, 59, 1, 0, 4, 0, 1, 115, - 11, 255, 0, 5, 252, 243, 240, 249, 254, 0, 33, 255, 0, 5, 253, -211, 172, 141, 115, 0, 3, 109, 0, 4, 115, 152, 222, 253, 74, 255, - 1, 254, 1, 25, 4, 0, 1, 81, 14, 218, 1, 48, 4, 0, 0, - 4, 71, 255, 255, 29, 3, 0, 1, 25, 6, 218, 0, 5, 29, 115, -125, 125, 109, 0, 7, 0, 1, 2, 1, 229, 9, 232, 1, 229, 12, -232, 1, 125, 4, 0, 1, 125, 9, 255, 1, 222, 1, 1, 3, 0, - 1, 5, 1, 211, 13, 232, 1, 29, 1, 125, 5, 132, 1, 100, 4, - 0, 1, 141, 1, 255, 0, 0, 0, 4, 255, 255, 254, 19, 4, 0, - 0, 14, 2, 226, 241, 233, 228, 219, 212, 215, 221, 215, 212, 200, 203, -203, 3, 215, 0, 8, 219, 219, 225, 221, 221, 215, 219, 42, 5, 0, - 1, 1, 1, 250, 135, 255, 1, 121, 4, 0, 1, 19, 1, 218, 13, -222, 1, 152, 1, 1, 3, 0, 0, 5, 5, 250, 255, 255, 52, 0, - 3, 0, 1, 8, 6, 222, 1, 95, 4, 61, 1, 8, 7, 0, 1, -197, 22, 237, 1, 61, 4, 0, 1, 240, 10, 255, 1, 58, 4, 0, - 1, 65, 13, 237, 1, 125, 6, 65, 1, 58, 4, 0, 1, 109, 1, -255, 0, 0, 3, 255, 1, 152, 5, 0, 0, 12, 5, 220, 247, 239, -231, 221, 219, 221, 219, 219, 215, 215, 4, 219, 0, 7, 221, 225, 225, -228, 225, 167, 10, 0, 6, 0, 1, 105, 135, 255, 1, 252, 1, 8, - 4, 0, 1, 125, 14, 229, 1, 33, 4, 0, 1, 109, 3, 255, 1, - 95, 4, 0, 1, 211, 10, 229, 1, 36, 7, 0, 1, 141, 22, 240, - 1, 22, 3, 0, 1, 14, 11, 255, 1, 243, 1, 1, 3, 0, 1, - 2, 1, 202, 19, 240, 1, 232, 1, 1, 3, 0, 1, 84, 1, 255, - 0, 0, 4, 255, 1, 43, 5, 0, 0, 9, 1, 110, 245, 244, 238, -231, 227, 228, 228, 0, 3, 221, 3, 228, 0, 6, 225, 221, 223, 216, - 38, 1, 6, 0, 1, 49, 1, 254, 135, 255, 1, 65, 4, 0, 1, - 43, 14, 232, 1, 125, 4, 0, 1, 14, 1, 253, 3, 255, 1, 132, - 4, 0, 1, 159, 10, 232, 1, 61, 7, 0, 1, 100, 21, 240, 1, -211, 1, 1, 3, 0, 1, 65, 12, 255, 1, 81, 4, 0, 1, 52, - 20, 240, 1, 8, 3, 0, 1, 58, 1, 255, 0, 0, 4, 255, 1, -251, 1, 17, 6, 0, 0, 9, 20, 138, 247, 241, 239, 238, 235, 235, -233, 0, 3, 231, 0, 5, 235, 236, 151, 31, 1, 0, 7, 0, 1, - 65, 1, 254, 135, 255, 1, 222, 1, 1, 3, 0, 1, 2, 1, 197, - 13, 237, 1, 232, 1, 22, 4, 0, 1, 141, 4, 255, 1, 197, 4, - 0, 1, 121, 10, 237, 1, 109, 7, 0, 1, 61, 21, 240, 1, 115, - 4, 0, 1, 152, 12, 255, 1, 252, 1, 8, 3, 0, 1, 1, 1, -172, 19, 240, 1, 22, 3, 0, 1, 43, 1, 255, 0, 0, 5, 255, - 1, 232, 1, 14, 7, 0, 0, 12, 2, 28, 78, 134, 184, 217, 210, -177, 113, 55, 30, 2, 8, 0, 1, 8, 1, 152, 137, 255, 1, 33, - 4, 0, 1, 81, 14, 240, 1, 100, 4, 0, 1, 29, 5, 255, 1, -246, 4, 0, 1, 84, 10, 240, 1, 159, 7, 0, 1, 41, 21, 243, - 1, 49, 3, 0, 1, 1, 1, 250, 13, 255, 1, 109, 4, 0, 1, - 41, 19, 243, 1, 33, 3, 0, 1, 25, 1, 255, 0, 0, 6, 255, - 1, 246, 1, 24, 24, 0, 0, 3, 1, 71, 252, 0, 137, 255, 1, -141, 4, 0, 1, 12, 1, 232, 13, 240, 1, 229, 1, 9, 4, 0, - 1, 202, 6, 255, 1, 2, 3, 0, 1, 53, 10, 240, 1, 232, 1, - 1, 6, 0, 1, 17, 21, 246, 1, 12, 3, 0, 1, 29, 14, 255, - 1, 253, 1, 14, 4, 0, 1, 152, 18, 246, 1, 48, 3, 0, 1, - 12, 1, 255, 0, 0, 7, 255, 0, 3, 253, 84, 1, 0, 21, 0, - 1, 41, 1, 222, 138, 255, 1, 253, 1, 12, 4, 0, 1, 132, 14, -243, 1, 71, 4, 0, 1, 49, 7, 255, 1, 22, 3, 0, 1, 33, - 11, 243, 1, 14, 6, 0, 1, 1, 5, 25, 1, 44, 14, 249, 1, -202, 4, 0, 1, 88, 15, 255, 1, 141, 4, 0, 1, 25, 1, 246, - 17, 249, 1, 65, 3, 0, 1, 1, 1, 255, 0, 0, 9, 255, 0, - 3, 222, 49, 1, 0, 16, 0, 0, 3, 1, 43, 202, 0, 140, 255, - 1, 84, 4, 0, 1, 1, 4, 25, 1, 218, 9, 246, 1, 211, 1, - 2, 3, 0, 1, 1, 1, 240, 7, 255, 1, 44, 3, 0, 1, 14, - 11, 246, 1, 43, 7, 0, 1, 202, 4, 249, 1, 41, 1, 211, 13, -249, 1, 105, 4, 0, 1, 197, 16, 255, 1, 25, 4, 0, 1, 125, - 17, 249, 1, 88, 4, 0, 1, 251, 0, 0, 11, 255, 0, 4, 240, - 88, 25, 1, 10, 0, 0, 4, 1, 33, 109, 246, 141, 255, 1, 232, - 1, 1, 3, 0, 1, 1, 1, 202, 3, 246, 1, 44, 1, 211, 9, -246, 1, 49, 4, 0, 1, 81, 8, 255, 1, 75, 3, 0, 1, 1, - 1, 240, 10, 246, 1, 74, 7, 0, 1, 141, 4, 250, 1, 115, 1, -100, 13, 250, 1, 43, 3, 0, 1, 2, 1, 253, 16, 255, 1, 183, - 4, 0, 1, 17, 1, 243, 16, 250, 1, 115, 4, 0, 1, 232, 0, - 0, 14, 255, 0, 4, 250, 159, 115, 75, 3, 52, 0, 5, 53, 88, -125, 197, 253, 0, 144, 255, 1, 43, 4, 0, 1, 71, 4, 249, 1, - 44, 1, 211, 8, 249, 1, 183, 1, 1, 3, 0, 1, 5, 1, 251, - 8, 255, 1, 121, 4, 0, 1, 202, 10, 249, 1, 121, 7, 0, 1, -100, 4, 250, 1, 229, 1, 33, 12, 250, 1, 246, 1, 2, 3, 0, - 1, 41, 18, 255, 1, 41, 4, 0, 1, 44, 7, 74, 1, 211, 8, -250, 1, 141, 4, 0, 1, 197, 0, 0, 169, 255, 1, 159, 4, 0, - 1, 9, 1, 237, 4, 249, 1, 44, 1, 218, 8, 249, 1, 33, 4, - 0, 1, 115, 9, 255, 1, 172, 4, 0, 1, 43, 3, 58, 1, 132, - 6, 249, 1, 183, 7, 0, 1, 58, 5, 250, 1, 33, 1, 232, 11, -250, 1, 172, 4, 0, 1, 109, 18, 255, 1, 218, 1, 1, 3, 0, - 1, 1, 1, 132, 5, 152, 1, 95, 1, 75, 8, 250, 1, 183, 4, - 0, 1, 152, 0, 0, 168, 255, 1, 253, 1, 17, 4, 0, 1, 121, - 5, 250, 1, 44, 1, 218, 7, 250, 1, 132, 4, 0, 1, 19, 1, -254, 9, 255, 1, 237, 4, 0, 1, 71, 3, 183, 1, 41, 1, 88, - 5, 250, 1, 243, 1, 1, 6, 0, 1, 33, 5, 250, 1, 100, 1, - 44, 11, 75, 1, 36, 4, 0, 1, 222, 19, 255, 1, 53, 4, 0, - 1, 75, 5, 250, 1, 246, 1, 24, 8, 250, 1, 222, 4, 0, 1, -115, 0, 0, 168, 255, 1, 100, 4, 0, 1, 33, 6, 250, 0, 10, - 44, 74, 95, 95, 100, 243, 250, 250, 246, 17, 4, 0, 1, 159, 10, -255, 1, 254, 1, 1, 3, 0, 1, 71, 3, 250, 1, 249, 1, 22, - 6, 250, 1, 19, 6, 0, 1, 9, 5, 251, 1, 240, 12, 159, 1, - 19, 3, 0, 1, 8, 20, 255, 1, 240, 1, 1, 3, 0, 1, 2, - 1, 229, 5, 251, 1, 49, 1, 197, 7, 251, 1, 246, 4, 0, 1, - 95, 0, 0, 167, 255, 1, 243, 1, 2, 3, 0, 1, 1, 1, 197, - 6, 250, 1, 152, 3, 115, 0, 5, 71, 52, 159, 159, 74, 0, 4, - 0, 1, 36, 12, 255, 1, 14, 3, 0, 1, 43, 4, 250, 1, 25, - 6, 250, 1, 44, 6, 0, 1, 1, 1, 243, 16, 251, 1, 243, 1, - 1, 3, 0, 1, 52, 21, 255, 1, 75, 4, 0, 1, 58, 5, 251, - 1, 141, 1, 81, 8, 251, 1, 2, 3, 0, 1, 65, 0, 0, 167, -255, 1, 49, 4, 0, 1, 61, 12, 250, 0, 3, 100, 75, 58, 0, - 4, 0, 1, 1, 1, 218, 12, 255, 1, 41, 3, 0, 1, 22, 4, -250, 1, 25, 6, 250, 1, 81, 7, 0, 1, 197, 16, 251, 1, 141, - 4, 0, 1, 132, 21, 255, 1, 251, 1, 5, 3, 0, 1, 1, 1, -211, 4, 251, 1, 249, 1, 24, 8, 251, 1, 19, 3, 0, 1, 44, - 0, 0, 166, 255, 1, 240, 1, 1, 3, 0, 1, 5, 1, 240, 14, -251, 1, 71, 4, 0, 1, 53, 13, 255, 1, 65, 3, 0, 1, 1, - 1, 250, 3, 251, 1, 25, 6, 251, 1, 125, 7, 0, 1, 132, 16, -251, 1, 65, 4, 0, 1, 243, 22, 255, 1, 105, 4, 0, 1, 43, - 5, 251, 1, 48, 1, 202, 7, 251, 1, 33, 3, 0, 1, 33, 0, - 0, 166, 255, 1, 141, 4, 0, 1, 43, 14, 251, 1, 218, 1, 1, - 3, 0, 1, 2, 1, 243, 13, 255, 1, 109, 4, 0, 1, 229, 3, -251, 1, 25, 6, 251, 1, 202, 7, 0, 1, 95, 16, 251, 1, 19, - 3, 0, 1, 19, 23, 255, 1, 253, 1, 14, 4, 0, 1, 159, 4, -251, 1, 141, 1, 81, 7, 251, 1, 44, 3, 0, 1, 17, 0, 0, -166, 255, 1, 132, 4, 0, 0, 5, 1, 43, 95, 152, 240, 0, 10, -251, 1, 44, 4, 0, 1, 95, 14, 255, 1, 152, 4, 0, 1, 172, - 3, 251, 1, 25, 6, 251, 1, 249, 1, 1, 6, 0, 1, 52, 15, -251, 1, 229, 4, 0, 1, 71, 24, 255, 1, 132, 4, 0, 1, 29, - 4, 251, 1, 249, 1, 25, 7, 251, 1, 61, 3, 0, 1, 2, 0, - 0, 166, 255, 1, 237, 9, 0, 0, 5, 19, 49, 105, 172, 246, 0, - 4, 251, 1, 172, 4, 0, 1, 9, 1, 253, 14, 255, 1, 222, 4, - 0, 1, 121, 3, 251, 1, 25, 1, 222, 6, 251, 1, 19, 6, 0, - 1, 29, 15, 251, 1, 121, 4, 0, 1, 159, 24, 255, 1, 254, 1, - 24, 4, 0, 1, 132, 4, 251, 1, 49, 1, 202, 6, 251, 1, 49, - 3, 0, 1, 2, 0, 0, 167, 255, 1, 52, 12, 0, 0, 6, 1, - 24, 58, 109, 105, 8, 4, 0, 1, 125, 15, 255, 1, 252, 4, 0, - 1, 81, 3, 251, 1, 197, 1, 25, 6, 251, 1, 44, 6, 0, 1, - 5, 15, 251, 1, 49, 3, 0, 1, 1, 1, 252, 25, 255, 1, 172, - 4, 0, 1, 14, 1, 232, 3, 251, 0, 9, 141, 74, 211, 172, 141, -109, 84, 48, 1, 0, 3, 0, 1, 29, 0, 0, 167, 255, 1, 253, - 1, 43, 20, 0, 1, 24, 1, 254, 16, 255, 1, 8, 3, 0, 1, - 49, 4, 251, 1, 29, 1, 250, 5, 251, 1, 84, 7, 0, 1, 240, - 13, 252, 1, 251, 1, 9, 3, 0, 1, 33, 27, 255, 1, 36, 4, - 0, 0, 5, 2, 36, 25, 12, 1, 0, 11, 0, 1, 115, 0, 0, -169, 255, 0, 4, 197, 84, 36, 2, 16, 0, 1, 172, 17, 255, 1, - 33, 3, 0, 1, 29, 4, 251, 1, 29, 1, 246, 5, 251, 1, 132, - 7, 0, 1, 183, 13, 252, 1, 202, 4, 0, 1, 95, 27, 255, 1, -222, 1, 1, 18, 0, 1, 22, 1, 253, 0, 0, 172, 255, 0, 6, -254, 229, 132, 71, 29, 1, 10, 0, 1, 53, 18, 255, 1, 53, 3, - 0, 1, 5, 4, 252, 0, 3, 121, 36, 250, 0, 4, 252, 1, 211, - 7, 0, 1, 121, 13, 252, 1, 100, 4, 0, 1, 197, 28, 255, 1, -121, 17, 0, 0, 3, 19, 243, 255, 0, 0, 0, 177, 255, 0, 6, -254, 218, 121, 58, 22, 1, 4, 0, 1, 58, 1, 253, 18, 255, 1, - 95, 4, 0, 1, 240, 4, 252, 1, 41, 1, 240, 4, 252, 1, 250, - 1, 1, 6, 0, 1, 81, 12, 252, 1, 250, 1, 25, 3, 0, 1, - 2, 1, 254, 29, 255, 1, 141, 1, 5, 12, 0, 0, 6, 1, 25, -109, 253, 255, 255, 0, 0, 182, 255, 0, 5, 253, 197, 132, 132, 237, - 0, 20, 255, 1, 141, 4, 0, 1, 74, 4, 252, 1, 41, 1, 240, - 5, 252, 1, 22, 6, 0, 1, 43, 7, 252, 0, 6, 246, 218, 172, -132, 100, 29, 4, 0, 1, 48, 31, 255, 0, 13, 250, 121, 44, 33, - 33, 48, 65, 95, 121, 152, 197, 232, 250, 0, 6, 255, 0, 0, 207, -255, 1, 211, 5, 0, 0, 6, 19, 53, 109, 183, 36, 240, 5, 252, - 1, 48, 6, 0, 0, 8, 1, 65, 105, 74, 52, 33, 22, 2, 10, - 0, 1, 183, 50, 255, 0, 0, 207, 255, 1, 254, 1, 5, 9, 0, - 0, 7, 24, 58, 115, 197, 250, 252, 53, 0, 23, 0, 1, 71, 51, -255, 0, 0, 208, 255, 1, 121, 13, 0, 0, 3, 1, 22, 1, 0, - 22, 0, 1, 61, 1, 254, 51, 255, 0, 0, 209, 255, 1, 105, 1, - 1, 17, 0, 1, 1, 1, 14, 14, 0, 0, 3, 1, 36, 183, 0, - 53, 255, 0, 0, 210, 255, 0, 5, 250, 125, 61, 24, 1, 0, 13, - 0, 0, 4, 52, 252, 75, 5, 3, 0, 0, 10, 5, 22, 41, 58, - 88, 121, 152, 202, 240, 254, 55, 255, 0, 0, 214, 255, 0, 6, 253, -202, 115, 58, 22, 1, 7, 0, 1, 17, 1, 250, 3, 255, 0, 3, -246, 243, 253, 0, 65, 255, 0, 0, 219, 255, 0, 9, 253, 197, 115, - 53, 19, 2, 14, 75, 251, 0, 72, 255, 0, 1 - }; + 66, 77, 180, 62, 0, 0, 0, 0, 0, 0, 54, 4, 0, 0, 40, + 0, 0, 0, 44, 1, 0, 0, 83, 0, 0, 0, 1, 0, 8, 0, + 1, 0, 0, 0, 126, 58, 0, 0, 19, 11, 0, 0, 19, 11, 0, + 0, 0, 1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 0, 0, 2, + 0, 0, 0, 1, 9, 0, 0, 4, 1, 0, 1, 5, 3, 0, 2, + 4, 11, 0, 5, 7, 14, 0, 6, 10, 7, 0, 0, 10, 11, 0, + 0, 8, 18, 0, 3, 15, 14, 0, 5, 14, 21, 0, 13, 16, 14, + 0, 1, 16, 28, 0, 1, 20, 16, 0, 0, 22, 18, 0, 7, 19, + 31, 0, 3, 21, 35, 0, 2, 26, 21, 0, 22, 24, 23, 0, 12, + 26, 23, 0, 0, 29, 25, 0, 4, 24, 43, 0, 0, 33, 28, 0, + 2, 27, 48, 0, 29, 31, 29, 0, 8, 31, 52, 0, 4, 32, 57, + 0, 13, 39, 33, 0, 0, 41, 34, 0, 36, 38, 36, 0, 4, 36, + 64, 0, 8, 48, 40, 0, 42, 45, 43, 0, 5, 41, 73, 0, 2, + 52, 42, 0, 25, 53, 49, 0, 5, 46, 83, 0, 49, 52, 50, 0, + 0, 58, 47, 0, 54, 57, 55, 0, 6, 52, 92, 0, 4, 68, 56, + 0, 59, 62, 60, 0, 31, 67, 59, 0, 5, 57, 102, 0, 23, 70, + 61, 0, 63, 66, 64, 0, 0, 75, 62, 0, 3, 62, 110, 0, 7, + 63, 116, 0, 69, 71, 70, 0, 2, 67, 121, 0, 43, 79, 71, 0, + 6, 85, 70, 0, 75, 77, 76, 0, 7, 71, 126, 0, 38, 85, 77, + 0, 78, 81, 79, 0, 0, 91, 73, 0, 4, 74, 136, 0, 81, 84, + 82, 0, 9, 97, 77, 0, 10, 78, 141, 0, 85, 87, 86, 0, 1, + 80, 144, 0, 88, 91, 89, 0, 0, 103, 80, 0, 1, 106, 71, 0, + 0, 102, 85, 0, 5, 83, 148, 0, 41, 98, 86, 0, 3, 110, 67, + 0, 10, 85, 154, 0, 92, 95, 93, 0, 0, 112, 72, 0, 96, 99, + 97, 0, 6, 89, 162, 0, 0, 112, 87, 0, 0, 117, 76, 0, 2, +117, 82, 0, 28, 111, 94, 0, 100, 102, 101, 0, 0, 95, 169, 0, + 0, 122, 80, 0, 0, 121, 87, 0, 103, 106, 104, 0, 3, 96, 172, + 0, 10, 97, 179, 0, 0, 126, 86, 0, 0, 128, 81, 0, 0, 123, + 98, 0, 107, 110, 108, 0, 1, 127, 94, 0, 19, 124, 101, 0, 110, +113, 111, 0, 61, 120, 105, 0, 0, 132, 87, 0, 4, 103, 186, 0, +114, 117, 115, 0, 0, 136, 91, 0, 0, 135, 96, 0, 0, 132, 107, + 0, 12, 107, 192, 0, 0, 135, 103, 0, 1, 140, 87, 0, 118, 121, +119, 0, 2, 109, 199, 0, 5, 142, 89, 0, 0, 145, 94, 0, 122, +125, 123, 0, 0, 143, 105, 0, 12, 140, 112, 0, 0, 145, 101, 0, + 11, 113, 206, 0, 0, 144, 115, 0, 1, 150, 99, 0, 127, 130, 128, + 0, 53, 140, 120, 0, 2, 118, 212, 0, 6, 152, 101, 0, 131, 134, +132, 0, 41, 146, 123, 0, 0, 154, 111, 0, 0, 156, 106, 0, 0, +153, 117, 0, 0, 158, 101, 0, 135, 138, 136, 0, 78, 147, 130, 0, + 4, 163, 106, 0, 139, 142, 140, 0, 0, 167, 111, 0, 0, 164, 122, + 0, 0, 169, 106, 0, 0, 166, 117, 0, 144, 147, 145, 0, 0, 171, +115, 0, 21, 165, 136, 0, 6, 172, 124, 0, 44, 165, 137, 0, 7, +176, 113, 0, 9, 175, 120, 0, 2, 171, 137, 0, 151, 154, 152, 0, + 0, 178, 124, 0, 0, 180, 118, 0, 82, 164, 146, 0, 30, 178, 122, + 0, 155, 158, 156, 0, 3, 186, 117, 0, 5, 186, 124, 0, 4, 185, +131, 0, 0, 183, 145, 0, 0, 191, 123, 0, 29, 186, 131, 0, 40, +185, 132, 0, 161, 164, 162, 0, 0, 190, 130, 0, 51, 185, 134, 0, + 32, 182, 155, 0, 46, 183, 151, 0, 0, 195, 127, 0, 4, 199, 123, + 0, 80, 181, 158, 0, 63, 184, 154, 0, 10, 196, 136, 0, 47, 189, +147, 0, 169, 172, 170, 0, 21, 192, 153, 0, 0, 202, 128, 0, 26, +195, 143, 0, 66, 191, 143, 0, 0, 201, 134, 0, 0, 199, 141, 0, + 57, 194, 145, 0, 42, 196, 144, 0, 0, 199, 154, 0, 0, 206, 132, + 0, 98, 188, 166, 0, 4, 211, 129, 0, 4, 206, 147, 0, 177, 180, +178, 0, 6, 208, 142, 0, 84, 197, 153, 0, 28, 206, 146, 0, 0, +212, 139, 0, 37, 205, 152, 0, 0, 215, 134, 0, 61, 202, 161, 0, + 58, 206, 156, 0, 43, 205, 166, 0, 0, 211, 163, 0, 183, 187, 185, + 0, 0, 215, 155, 0, 0, 218, 145, 0, 0, 220, 140, 0, 25, 216, +151, 0, 5, 223, 135, 0, 25, 213, 162, 0, 0, 224, 137, 0, 43, +215, 154, 0, 67, 207, 175, 0, 46, 213, 162, 0, 188, 191, 189, 0, + 0, 226, 139, 0, 101, 209, 171, 0, 192, 195, 193, 0, 67, 216, 165, + 0, 19, 227, 146, 0, 0, 228, 150, 0, 24, 227, 155, 0, 25, 230, +149, 0, 109, 211, 187, 0, 196, 200, 198, 0, 120, 214, 179, 0, 44, +230, 157, 0, 45, 225, 180, 0, 34, 227, 181, 0, 201, 204, 202, 0, + 7, 235, 164, 0, 59, 232, 164, 0, 65, 229, 179, 0, 61, 232, 173, + 0, 71, 234, 167, 0, 205, 209, 207, 0, 53, 234, 176, 0, 81, 235, +174, 0, 210, 213, 211, 0, 92, 237, 178, 0, 93, 232, 195, 0, 213, +216, 214, 0, 100, 236, 186, 0, 120, 229, 203, 0, 101, 238, 180, 0, +108, 236, 186, 0, 28, 244, 188, 0, 34, 243, 199, 0, 121, 234, 202, + 0, 120, 239, 191, 0, 218, 221, 219, 0, 56, 247, 189, 0, 223, 226, +224, 0, 83, 249, 202, 0, 98, 250, 200, 0, 130, 246, 204, 0, 110, +250, 200, 0, 227, 230, 228, 0, 231, 234, 232, 0, 125, 252, 212, 0, +117, 253, 214, 0, 105, 255, 215, 0, 234, 237, 235, 0, 134, 253, 222, + 0, 137, 255, 234, 0, 240, 243, 241, 0, 244, 247, 245, 0, 255, 119, + 24, 119, 0, 13, 114, 107, 103, 98, 88, 87, 77, 73, 70, 63, 70, + 77, 107, 0, 8, 119, 0, 0, 255, 119, 20, 119, 0, 5, 114, 87, + 65, 60, 60, 0, 11, 63, 1, 60, 1, 88, 7, 119, 0, 0, 255, +119, 19, 119, 0, 3, 98, 63, 63, 0, 4, 65, 0, 9, 70, 63, + 60, 52, 50, 45, 45, 50, 65, 0, 3, 63, 1, 98, 6, 119, 0, + 0, 251, 119, 0, 6, 107, 98, 88, 77, 73, 63, 3, 60, 1, 77, + 1, 114, 11, 119, 0, 13, 114, 65, 52, 49, 41, 31, 22, 11, 4, + 1, 1, 4, 1, 0, 3, 4, 0, 5, 2, 49, 65, 63, 65, 0, + 6, 119, 0, 0, 204, 119, 4, 114, 41, 119, 1, 88, 1, 60, 5, + 63, 1, 65, 1, 65, 4, 63, 1, 88, 10, 119, 1, 52, 3, 4, + 1, 1, 3, 4, 1, 1, 4, 4, 1, 1, 4, 4, 0, 4, 45, + 65, 63, 103, 5, 119, 0, 0, 203, 119, 1, 77, 5, 63, 0, 4, + 77, 98, 114, 114, 16, 119, 5, 114, 14, 119, 0, 11, 70, 65, 65, + 63, 60, 60, 56, 52, 45, 45, 56, 0, 4, 63, 1, 88, 8, 119, + 1, 77, 4, 4, 0, 5, 1, 4, 1, 4, 1, 0, 3, 4, 1, + 1, 1, 1, 3, 4, 0, 5, 1, 1, 60, 63, 88, 0, 5, 119, + 0, 0, 202, 119, 4, 65, 8, 63, 1, 70, 1, 88, 6, 119, 0, + 4, 107, 87, 77, 70, 9, 63, 1, 77, 11, 119, 0, 4, 77, 56, + 24, 1, 3, 4, 0, 7, 1, 4, 1, 4, 1, 1, 52, 0, 3, + 63, 1, 107, 6, 119, 0, 7, 114, 1, 1, 4, 1, 4, 1, 0, + 3, 4, 0, 14, 1, 1, 4, 4, 1, 4, 4, 1, 4, 1, 4, + 31, 65, 87, 5, 119, 0, 0, 80, 119, 1, 114, 1, 88, 3, 77, + 1, 87, 1, 107, 4, 119, 0, 4, 103, 87, 83, 87, 3, 88, 0, + 4, 98, 98, 103, 114, 99, 119, 0, 6, 88, 45, 16, 9, 27, 49, + 10, 63, 0, 4, 114, 119, 119, 107, 15, 63, 1, 65, 10, 119, 1, + 16, 6, 4, 1, 1, 1, 1, 5, 4, 0, 4, 37, 65, 63, 73, + 6, 119, 1, 37, 4, 4, 1, 1, 5, 4, 0, 3, 19, 30, 33, + 0, 3, 43, 0, 7, 4, 4, 1, 4, 11, 70, 77, 0, 5, 119, + 0, 0, 15, 119, 0, 3, 107, 77, 65, 0, 8, 63, 1, 73, 1, + 98, 21, 119, 0, 3, 114, 88, 70, 0, 6, 63, 1, 77, 1, 98, + 16, 119, 1, 114, 1, 77, 25, 63, 0, 3, 65, 98, 98, 0, 7, + 77, 0, 8, 87, 88, 98, 114, 119, 119, 103, 70, 12, 63, 1, 77, + 6, 119, 0, 11, 114, 98, 77, 70, 63, 65, 77, 114, 119, 119, 98, + 0, 7, 77, 0, 8, 87, 88, 98, 114, 119, 119, 98, 70, 12, 63, + 1, 77, 6, 119, 0, 8, 107, 98, 77, 70, 63, 65, 83, 114, 7, +119, 0, 3, 114, 4, 1, 0, 3, 4, 0, 8, 1, 4, 2, 4, + 17, 41, 60, 65, 4, 63, 0, 16, 119, 107, 63, 63, 65, 65, 63, + 56, 45, 34, 27, 17, 4, 4, 22, 56, 3, 63, 1, 77, 8, 119, + 0, 20, 13, 4, 1, 4, 1, 1, 4, 4, 1, 4, 1, 4, 1, + 1, 4, 4, 50, 63, 63, 98, 5, 119, 1, 4, 1, 4, 3, 1, + 1, 40, 3, 43, 0, 4, 47, 12, 47, 43, 4, 47, 0, 7, 7, + 4, 1, 4, 4, 70, 77, 0, 5, 119, 0, 0, 12, 119, 0, 3, + 88, 65, 65, 0, 14, 63, 0, 3, 65, 77, 114, 0, 14, 119, 0, + 3, 98, 65, 65, 0, 12, 63, 1, 65, 1, 83, 11, 119, 1, 98, + 1, 65, 3, 63, 6, 65, 5, 63, 10, 65, 17, 63, 1, 65, 1, + 65, 15, 63, 5, 65, 9, 63, 1, 65, 13, 63, 1, 65, 1, 65, + 15, 63, 5, 65, 9, 63, 1, 77, 6, 119, 1, 22, 5, 4, 0, + 4, 1, 4, 4, 1, 3, 4, 0, 18, 1, 11, 65, 63, 63, 107, + 70, 17, 4, 4, 2, 4, 1, 1, 4, 4, 1, 4, 3, 1, 0, + 5, 13, 65, 63, 63, 107, 0, 6, 119, 0, 4, 45, 4, 1, 1, + 3, 4, 0, 14, 1, 1, 4, 1, 4, 1, 1, 4, 4, 1, 1, + 65, 63, 65, 5, 119, 1, 1, 3, 4, 1, 19, 5, 47, 1, 19, + 1, 43, 5, 47, 0, 7, 19, 4, 4, 1, 1, 70, 73, 0, 5, +119, 0, 0, 10, 119, 0, 14, 77, 65, 63, 63, 65, 70, 52, 37, + 31, 26, 26, 27, 34, 45, 3, 65, 5, 63, 1, 70, 1, 107, 10, +119, 0, 12, 88, 65, 63, 63, 65, 70, 60, 45, 41, 37, 41, 50, + 3, 65, 4, 63, 1, 65, 1, 83, 8, 119, 0, 8, 70, 63, 65, + 63, 37, 13, 4, 4, 3, 1, 0, 11, 4, 11, 37, 56, 34, 9, + 4, 2, 4, 5, 2, 0, 4, 4, 0, 6, 5, 17, 45, 70, 65, + 65, 6, 70, 4, 65, 3, 63, 0, 15, 70, 56, 37, 31, 27, 27, + 26, 22, 17, 16, 13, 16, 34, 60, 65, 0, 6, 63, 0, 11, 65, + 65, 70, 65, 60, 70, 65, 63, 63, 65, 65, 0, 6, 70, 4, 65, + 3, 63, 0, 15, 70, 56, 37, 31, 27, 27, 26, 22, 17, 13, 13, + 16, 34, 63, 65, 0, 5, 63, 3, 65, 0, 5, 70, 65, 60, 70, + 65, 0, 3, 63, 1, 87, 4, 119, 1, 88, 4, 4, 0, 4, 1, + 1, 4, 1, 4, 4, 0, 7, 1, 4, 1, 4, 65, 63, 52, 0, + 3, 1, 4, 4, 1, 1, 1, 1, 6, 4, 0, 5, 1, 13, 70, + 63, 88, 0, 6, 119, 0, 15, 7, 4, 4, 1, 4, 4, 19, 30, + 38, 43, 43, 47, 43, 2, 1, 0, 3, 4, 0, 4, 37, 65, 63, + 87, 4, 119, 0, 6, 1, 4, 4, 1, 12, 51, 3, 47, 0, 3, + 51, 25, 40, 0, 4, 47, 0, 8, 51, 30, 1, 1, 4, 1, 60, + 70, 5, 119, 0, 0, 8, 119, 0, 8, 103, 65, 65, 70, 41, 16, + 5, 2, 9, 1, 0, 5, 4, 11, 31, 60, 65, 0, 4, 63, 1, + 77, 7, 119, 0, 8, 114, 70, 63, 70, 45, 22, 9, 4, 7, 1, + 0, 5, 4, 11, 37, 65, 65, 0, 3, 63, 1, 65, 1, 114, 4, +119, 0, 5, 107, 65, 63, 22, 5, 0, 26, 1, 1, 4, 1, 9, + 3, 4, 0, 12, 2, 2, 4, 2, 4, 4, 5, 9, 22, 41, 17, + 4, 13, 1, 0, 17, 9, 52, 63, 49, 37, 24, 11, 9, 4, 4, + 1, 1, 2, 6, 27, 27, 9, 0, 3, 4, 0, 12, 2, 2, 4, + 2, 4, 4, 5, 9, 24, 41, 16, 2, 13, 1, 0, 9, 11, 52, + 60, 49, 37, 24, 11, 9, 4, 0, 4, 1, 0, 6, 5, 45, 65, + 63, 63, 114, 3, 119, 5, 4, 5, 1, 6, 4, 0, 3, 1, 22, + 63, 0, 3, 1, 0, 5, 4, 1, 1, 4, 1, 0, 3, 4, 1, + 1, 1, 1, 3, 4, 0, 5, 1, 1, 41, 63, 77, 0, 5, 119, + 0, 6, 114, 4, 4, 1, 4, 25, 3, 51, 1, 47, 5, 51, 5, + 4, 0, 4, 60, 63, 63, 114, 3, 119, 0, 5, 5, 1, 1, 4, + 7, 0, 5, 51, 1, 30, 1, 38, 5, 51, 0, 7, 33, 1, 4, + 4, 1, 52, 65, 0, 5, 119, 0, 0, 7, 119, 0, 4, 77, 65, + 50, 13, 18, 1, 0, 3, 9, 34, 70, 0, 3, 63, 1, 70, 1, +114, 4, 119, 0, 5, 98, 65, 60, 17, 4, 0, 15, 1, 0, 3, + 13, 56, 65, 0, 3, 63, 0, 6, 103, 119, 119, 107, 65, 26, 119, + 1, 0, 7, 31, 65, 63, 98, 119, 119, 56, 0, 3, 1, 0, 22, + 4, 5, 40, 40, 38, 33, 19, 7, 1, 1, 4, 1, 4, 1, 4, + 11, 4, 4, 1, 1, 4, 4, 6, 1, 1, 7, 1, 5, 3, 1, + 0, 4, 4, 16, 70, 77, 5, 119, 1, 41, 3, 4, 1, 1, 1, + 43, 9, 51, 0, 9, 19, 1, 4, 1, 1, 24, 65, 63, 77, 0, + 3, 119, 0, 5, 22, 4, 4, 1, 1, 0, 5, 51, 1, 38, 1, + 33, 5, 51, 1, 43, 1, 1, 3, 4, 1, 49, 1, 63, 5, 119, + 0, 0, 6, 119, 0, 3, 70, 60, 13, 0, 22, 1, 0, 3, 4, + 41, 65, 0, 3, 63, 0, 6, 114, 119, 119, 98, 65, 24, 20, 1, + 1, 22, 1, 65, 3, 63, 0, 4, 98, 107, 56, 9, 121, 1, 0, + 5, 49, 63, 77, 119, 103, 0, 4, 4, 0, 3, 1, 40, 43, 0, + 5, 47, 0, 4, 43, 38, 4, 4, 4, 1, 3, 4, 0, 7, 2, + 33, 40, 43, 43, 47, 51, 0, 3, 55, 0, 8, 58, 12, 1, 1, + 4, 4, 70, 70, 5, 119, 0, 8, 5, 1, 4, 1, 1, 55, 55, + 51, 3, 55, 1, 51, 3, 55, 0, 24, 58, 4, 4, 1, 4, 4, + 50, 63, 63, 103, 119, 119, 37, 4, 4, 1, 1, 51, 55, 51, 55, + 55, 40, 30, 3, 55, 3, 51, 0, 6, 1, 1, 4, 4, 41, 63, + 5, 119, 0, 0, 5, 119, 1, 70, 1, 34, 26, 1, 1, 22, 1, + 70, 3, 63, 0, 4, 107, 98, 50, 5, 22, 1, 0, 6, 6, 56, + 65, 63, 63, 45, 10, 1, 0, 4, 8, 21, 23, 21, 6, 1, 0, + 6, 4, 10, 8, 4, 4, 0, 97, 1, 0, 5, 22, 65, 73, 119, + 31, 0, 4, 4, 1, 19, 9, 47, 1, 38, 3, 1, 0, 6, 4, + 1, 4, 1, 1, 38, 3, 55, 1, 58, 3, 55, 0, 10, 58, 55, + 58, 33, 1, 4, 1, 4, 56, 63, 5, 119, 1, 2, 3, 4, 1, + 25, 1, 58, 3, 55, 0, 20, 58, 55, 58, 58, 55, 58, 55, 33, + 1, 1, 4, 1, 11, 70, 63, 70, 119, 119, 50, 4, 3, 1, 0, + 20, 51, 58, 55, 58, 55, 43, 12, 38, 43, 58, 55, 58, 61, 1, + 1, 4, 1, 37, 63, 107, 4, 119, 0, 0, 4, 119, 1, 73, 1, + 22, 9, 1, 0, 4, 29, 48, 59, 62, 3, 67, 0, 4, 59, 48, + 35, 8, 8, 1, 1, 5, 1, 60, 3, 63, 1, 41, 9, 1, 0, + 9, 21, 39, 48, 54, 59, 59, 48, 32, 4, 0, 8, 1, 0, 3, + 50, 65, 50, 0, 7, 1, 0, 11, 18, 54, 78, 93, 89, 80, 79, + 89, 93, 78, 42, 0, 3, 1, 0, 4, 112, 89, 85, 85, 5, 93, + 1, 104, 1, 21, 3, 1, 0, 7, 8, 23, 21, 21, 18, 15, 14, + 0, 3, 8, 6, 1, 0, 3, 59, 62, 62, 0, 5, 67, 0, 3, + 78, 78, 8, 0, 9, 1, 0, 4, 4, 21, 35, 42, 5, 1, 0, + 10, 8, 23, 21, 21, 18, 14, 14, 8, 8, 4, 5, 1, 0, 4, + 10, 59, 62, 62, 5, 67, 0, 3, 78, 78, 4, 0, 9, 1, 0, + 4, 8, 21, 35, 48, 5, 1, 0, 3, 65, 63, 77, 0, 3, 4, + 0, 7, 1, 4, 51, 47, 47, 51, 51, 0, 5, 47, 0, 5, 43, + 4, 4, 1, 1, 0, 4, 4, 1, 33, 10, 58, 0, 8, 47, 2, + 1, 4, 4, 45, 63, 114, 3, 119, 1, 70, 1, 4, 3, 1, 1, + 47, 10, 58, 0, 3, 55, 61, 7, 0, 4, 4, 0, 11, 37, 63, + 63, 88, 119, 65, 4, 1, 4, 1, 51, 0, 4, 58, 0, 15, 55, + 40, 33, 25, 19, 61, 58, 61, 4, 4, 1, 1, 31, 63, 98, 0, + 4, 119, 0, 0, 3, 119, 1, 77, 1, 11, 7, 1, 0, 17, 35, + 67, 93, 79, 75, 72, 72, 68, 72, 75, 72, 72, 80, 93, 78, 42, + 4, 0, 7, 1, 0, 3, 60, 65, 41, 0, 7, 1, 0, 5, 29, + 59, 93, 85, 79, 0, 3, 75, 0, 6, 72, 72, 80, 93, 67, 35, + 7, 1, 1, 27, 1, 4, 5, 1, 0, 5, 14, 67, 89, 75, 75, + 0, 5, 79, 0, 7, 75, 68, 80, 93, 29, 1, 104, 0, 5, 79, + 0, 5, 72, 68, 68, 79, 32, 0, 3, 1, 0, 5, 115, 89, 89, + 85, 85, 0, 3, 89, 0, 3, 93, 93, 67, 0, 4, 1, 0, 12, + 18, 89, 75, 75, 79, 75, 75, 72, 68, 68, 80, 8, 3, 1, 0, + 11, 35, 42, 54, 67, 78, 93, 93, 85, 80, 80, 35, 0, 4, 1, + 1, 102, 1, 89, 6, 85, 0, 3, 89, 93, 59, 0, 4, 1, 0, + 4, 39, 89, 79, 79, 3, 75, 0, 19, 72, 68, 68, 80, 4, 1, + 1, 4, 35, 42, 54, 67, 78, 93, 93, 89, 80, 80, 14, 0, 4, + 1, 0, 8, 52, 65, 11, 4, 1, 1, 4, 33, 10, 51, 1, 47, + 1, 1, 5, 4, 0, 3, 1, 4, 19, 0, 4, 61, 1, 58, 1, + 58, 3, 61, 0, 9, 58, 61, 1, 4, 4, 1, 37, 63, 98, 0, + 3, 119, 0, 7, 16, 1, 4, 1, 1, 55, 58, 0, 4, 61, 0, + 3, 58, 61, 58, 0, 4, 61, 0, 17, 47, 2, 4, 4, 1, 5, + 65, 63, 65, 119, 88, 4, 4, 1, 1, 47, 58, 0, 7, 61, 1, + 2, 3, 19, 0, 7, 4, 1, 4, 1, 26, 65, 88, 0, 4, 119, + 0, 0, 0, 4, 119, 119, 98, 9, 6, 1, 0, 5, 32, 91, 79, + 75, 79, 0, 8, 90, 0, 7, 89, 79, 72, 68, 72, 93, 48, 0, + 6, 1, 1, 2, 1, 31, 6, 1, 0, 18, 18, 78, 85, 72, 79, + 79, 89, 90, 100, 100, 90, 79, 79, 75, 72, 79, 78, 18, 11, 1, + 0, 28, 39, 101, 79, 90, 90, 100, 100, 105, 105, 108, 105, 97, 90, + 89, 79, 101, 67, 100, 109, 120, 109, 108, 100, 90, 79, 72, 80, 29, + 3, 1, 0, 11, 125, 90, 89, 79, 89, 89, 79, 75, 68, 68, 67, + 0, 4, 1, 1, 8, 1, 113, 4, 100, 0, 5, 90, 90, 75, 68, + 80, 0, 3, 1, 1, 35, 1, 89, 3, 79, 0, 7, 89, 90, 90, + 75, 68, 72, 62, 0, 4, 1, 0, 11, 112, 79, 79, 90, 89, 79, + 79, 72, 68, 68, 78, 0, 4, 1, 0, 16, 39, 120, 100, 97, 100, +100, 90, 90, 79, 72, 80, 4, 1, 1, 54, 89, 7, 79, 0, 3, + 75, 68, 42, 0, 4, 1, 0, 7, 45, 37, 1, 4, 4, 1, 7, + 0, 3, 51, 1, 55, 4, 51, 0, 4, 55, 51, 51, 55, 3, 1, + 5, 4, 1, 7, 1, 64, 5, 61, 0, 15, 64, 61, 64, 61, 64, + 4, 1, 4, 4, 31, 63, 88, 119, 119, 114, 0, 3, 4, 1, 1, + 1, 12, 4, 64, 4, 61, 1, 64, 4, 61, 0, 29, 64, 19, 1, + 1, 4, 4, 27, 65, 63, 77, 114, 1, 1, 4, 2, 47, 61, 61, + 64, 61, 61, 64, 61, 61, 58, 51, 55, 55, 7, 0, 3, 4, 0, + 3, 22, 65, 87, 0, 4, 119, 0, 0, 0, 3, 119, 119, 13, 0, + 6, 1, 0, 8, 67, 89, 79, 90, 97, 109, 129, 129, 3, 126, 3, +109, 0, 9, 105, 100, 90, 79, 75, 72, 80, 93, 18, 0, 11, 1, + 0, 20, 39, 101, 79, 79, 90, 90, 109, 116, 109, 108, 109, 109, 100, + 97, 97, 89, 75, 68, 93, 32, 9, 1, 0, 29, 39, 89, 89, 100, +109, 116, 109, 105, 109, 116, 126, 126, 116, 109, 108, 105, 109, 109, 120, +131, 136, 129, 116, 108, 109, 108, 84, 79, 23, 0, 3, 1, 0, 11, +168, 116, 109, 109, 108, 109, 116, 108, 84, 72, 67, 0, 5, 1, 0, + 10, 124, 120, 124, 126, 120, 116, 97, 79, 72, 80, 4, 1, 1, 124, + 4, 109, 0, 6, 126, 116, 90, 75, 68, 91, 4, 1, 1, 132, 4, +109, 0, 6, 100, 97, 89, 75, 72, 78, 4, 1, 0, 4, 35, 136, +126, 116, 3, 109, 0, 9, 108, 90, 79, 85, 4, 1, 1, 23, 124, + 0, 3, 108, 0, 7, 109, 109, 100, 100, 89, 72, 78, 0, 4, 1, + 0, 7, 34, 4, 1, 1, 4, 1, 47, 0, 12, 55, 0, 4, 19, + 4, 1, 1, 4, 4, 1, 1, 4, 64, 1, 66, 1, 61, 4, 64, + 0, 11, 66, 7, 1, 1, 4, 22, 65, 77, 119, 119, 98, 0, 4, + 4, 0, 4, 43, 64, 64, 61, 5, 64, 1, 66, 4, 64, 0, 3, + 61, 61, 4, 0, 4, 1, 0, 9, 60, 63, 63, 114, 5, 1, 4, + 4, 47, 0, 5, 64, 1, 61, 5, 64, 0, 8, 66, 12, 1, 1, + 4, 13, 70, 77, 4, 119, 0, 0, 1, 119, 1, 41, 5, 1, 0, + 13, 10, 104, 79, 90, 108, 116, 116, 109, 126, 147, 147, 141, 136, 0, + 5, 126, 0, 8, 109, 97, 90, 89, 75, 72, 93, 21, 9, 1, 0, + 22, 54, 89, 90, 105, 109, 105, 105, 116, 126, 116, 120, 126, 129, 126, +116, 116, 109, 100, 79, 72, 80, 32, 7, 1, 0, 14, 21, 113, 90, +100, 109, 124, 129, 129, 120, 120, 126, 129, 131, 129, 6, 126, 0, 10, +129, 133, 131, 126, 109, 109, 116, 97, 89, 21, 3, 1, 0, 11, 191, +133, 131, 129, 126, 109, 109, 129, 116, 79, 78, 0, 5, 1, 0, 3, +145, 129, 126, 0, 3, 129, 0, 4, 116, 97, 79, 80, 4, 1, 1, +151, 3, 129, 3, 126, 0, 4, 109, 90, 72, 91, 4, 1, 1, 152, + 1, 131, 3, 129, 0, 6, 126, 120, 100, 79, 72, 91, 4, 1, 0, + 12, 32, 150, 136, 136, 126, 109, 116, 116, 109, 90, 93, 4, 3, 1, + 0, 3, 170, 129, 129, 0, 3, 126, 0, 5, 120, 109, 90, 79, 104, + 0, 4, 1, 5, 4, 0, 7, 7, 51, 58, 58, 55, 58, 55, 0, + 7, 58, 0, 5, 33, 4, 4, 1, 1, 0, 3, 4, 1, 1, 1, + 58, 3, 66, 0, 25, 64, 66, 66, 64, 66, 64, 66, 12, 4, 4, + 1, 11, 70, 73, 119, 119, 37, 1, 4, 4, 1, 55, 66, 66, 64, + 0, 6, 66, 0, 20, 64, 64, 66, 64, 66, 66, 30, 1, 1, 4, + 4, 13, 65, 63, 65, 5, 1, 4, 1, 38, 5, 66, 1, 64, 4, + 66, 0, 9, 64, 66, 12, 4, 1, 4, 6, 70, 77, 0, 4, 119, + 0, 0, 1, 83, 5, 1, 0, 28, 8, 125, 90, 108, 120, 129, 131, +131, 126, 126, 136, 147, 147, 136, 133, 129, 129, 133, 133, 129, 116, 100, + 90, 90, 79, 75, 85, 8, 7, 1, 0, 24, 42, 101, 100, 109, 126, +133, 129, 126, 120, 126, 129, 129, 136, 147, 141, 133, 131, 129, 126, 108, + 90, 72, 85, 14, 6, 1, 0, 30, 115, 108, 116, 109, 109, 116, 129, +147, 141, 133, 133, 136, 141, 141, 136, 136, 133, 129, 133, 133, 131, 133, +136, 136, 129, 116, 109, 97, 89, 14, 3, 1, 0, 11, 217, 147, 147, +141, 136, 126, 109, 116, 109, 84, 78, 0, 5, 1, 0, 10, 154, 141, +129, 126, 126, 131, 136, 120, 90, 85, 4, 1, 0, 5, 190, 147, 147, +136, 131, 0, 3, 129, 0, 3, 109, 79, 80, 0, 4, 1, 0, 11, +168, 158, 147, 136, 136, 133, 131, 120, 90, 75, 91, 0, 4, 1, 0, + 12, 23, 170, 147, 147, 133, 126, 116, 109, 109, 105, 101, 4, 3, 1, + 0, 12, 160, 155, 147, 136, 131, 129, 129, 120, 105, 89, 104, 4, 4, + 1, 0, 12, 4, 4, 1, 4, 33, 7, 19, 47, 58, 61, 58, 61, + 5, 58, 0, 11, 61, 51, 4, 1, 4, 4, 1, 4, 4, 1, 47, + 0, 10, 66, 1, 19, 3, 1, 0, 10, 2, 70, 70, 119, 119, 4, + 1, 4, 1, 2, 16, 66, 0, 14, 74, 7, 1, 4, 4, 1, 50, + 63, 63, 5, 4, 1, 1, 33, 12, 66, 1, 25, 1, 1, 3, 4, + 1, 70, 1, 73, 4, 119, 0, 0, 1, 37, 4, 1, 0, 17, 8, +132, 109, 116, 126, 129, 133, 136, 136, 131, 129, 136, 136, 147, 147, 136, +133, 0, 4, 129, 0, 8, 126, 116, 108, 100, 90, 79, 72, 102, 6, + 1, 0, 16, 14, 123, 105, 120, 126, 129, 133, 133, 129, 131, 136, 141, +136, 136, 147, 147, 3, 136, 0, 6, 133, 126, 109, 79, 68, 112, 5, + 1, 0, 10, 32, 113, 116, 126, 126, 120, 116, 120, 131, 141, 3, 136, + 0, 7, 147, 147, 155, 147, 147, 136, 136, 0, 4, 133, 0, 7, 136, +131, 126, 116, 100, 89, 8, 0, 3, 1, 0, 11, 217, 155, 147, 147, +141, 131, 116, 116, 105, 79, 78, 0, 5, 1, 0, 10, 154, 147, 131, +126, 116, 126, 131, 126, 90, 80, 4, 1, 0, 11, 122, 171, 147, 141, +136, 133, 129, 129, 116, 90, 80, 0, 4, 1, 0, 3, 166, 158, 147, + 0, 4, 136, 0, 4, 129, 105, 79, 91, 4, 1, 0, 11, 18, 170, +136, 133, 131, 129, 120, 109, 100, 90, 104, 0, 4, 1, 0, 12, 122, +171, 158, 147, 136, 133, 129, 126, 109, 90, 85, 8, 4, 1, 0, 4, + 4, 4, 1, 33, 3, 61, 0, 12, 25, 1, 25, 51, 61, 64, 61, + 58, 61, 61, 64, 55, 4, 1, 1, 4, 3, 1, 0, 35, 40, 74, + 66, 74, 74, 66, 74, 74, 66, 74, 74, 33, 1, 4, 4, 1, 60, + 65, 119, 103, 4, 1, 1, 4, 33, 74, 66, 74, 74, 66, 74, 74, + 66, 74, 66, 0, 4, 74, 0, 16, 66, 66, 74, 43, 1, 4, 1, + 4, 4, 65, 63, 4, 1, 4, 1, 25, 4, 74, 0, 5, 66, 66, + 74, 74, 66, 0, 3, 74, 1, 33, 3, 1, 0, 3, 4, 65, 70, + 0, 4, 119, 0, 0, 1, 17, 4, 1, 0, 5, 168, 126, 129, 131, +133, 0, 3, 136, 0, 5, 141, 141, 136, 147, 158, 0, 3, 171, 0, + 14, 155, 136, 131, 129, 129, 126, 129, 126, 108, 90, 89, 75, 80, 32, + 5, 1, 0, 6, 104, 109, 126, 129, 129, 133, 3, 136, 0, 3, 131, +140, 147, 0, 3, 155, 0, 11, 158, 147, 147, 141, 136, 129, 124, 100, + 79, 72, 39, 0, 4, 1, 1, 91, 1, 109, 3, 126, 0, 14, 129, +126, 116, 120, 129, 133, 136, 147, 158, 171, 183, 171, 171, 155, 3, 136, + 0, 9, 133, 136, 136, 133, 126, 116, 100, 101, 4, 0, 3, 1, 0, + 11, 217, 155, 147, 136, 136, 133, 126, 120, 108, 79, 78, 0, 5, 1, + 0, 5, 154, 147, 136, 133, 126, 0, 3, 109, 1, 90, 1, 80, 4, + 1, 0, 12, 32, 171, 158, 147, 136, 133, 131, 131, 126, 100, 79, 14, + 3, 1, 0, 11, 170, 155, 147, 136, 136, 133, 131, 126, 109, 79, 102, + 0, 4, 1, 0, 11, 14, 165, 136, 133, 129, 126, 126, 120, 100, 79, + 93, 0, 4, 1, 0, 12, 71, 171, 171, 155, 141, 131, 131, 126, 116, + 90, 79, 8, 4, 1, 0, 4, 4, 1, 12, 66, 3, 64, 0, 31, + 61, 64, 51, 12, 1, 38, 64, 64, 61, 64, 64, 61, 1, 1, 4, + 4, 1, 4, 1, 1, 33, 76, 76, 66, 64, 66, 55, 40, 30, 12, + 1, 0, 4, 4, 0, 10, 1, 50, 63, 119, 63, 1, 1, 4, 4, + 64, 6, 74, 3, 76, 4, 74, 0, 6, 76, 66, 74, 74, 76, 12, + 4, 1, 1, 34, 1, 63, 4, 4, 0, 8, 19, 76, 74, 76, 76, + 74, 76, 76, 3, 74, 0, 9, 76, 66, 43, 1, 4, 1, 4, 56, + 65, 0, 4, 119, 0, 0, 1, 9, 3, 1, 0, 6, 14, 186, 147, +155, 147, 147, 4, 141, 0, 12, 147, 158, 183, 183, 205, 214, 205, 205, +171, 147, 136, 136, 3, 131, 0, 6, 126, 100, 97, 89, 75, 104, 4, + 1, 0, 14, 21, 134, 129, 136, 131, 131, 136, 136, 141, 147, 147, 141, +147, 158, 4, 183, 0, 10, 158, 155, 141, 136, 129, 124, 100, 79, 112, + 4, 3, 1, 0, 21, 168, 129, 131, 131, 129, 131, 131, 124, 116, 129, +136, 136, 155, 188, 205, 214, 214, 183, 171, 158, 147, 0, 4, 136, 0, + 5, 141, 136, 124, 97, 89, 0, 4, 1, 0, 4, 216, 155, 147, 136, + 3, 131, 0, 4, 129, 116, 90, 78, 5, 1, 0, 10, 166, 147, 141, +141, 131, 116, 109, 109, 89, 80, 5, 1, 0, 11, 188, 171, 155, 141, +136, 136, 131, 129, 109, 89, 35, 0, 3, 1, 0, 11, 170, 155, 147, +141, 136, 131, 129, 124, 109, 89, 102, 0, 4, 1, 0, 11, 8, 186, +147, 136, 136, 131, 129, 129, 108, 79, 93, 0, 4, 1, 0, 12, 18, +207, 171, 155, 141, 141, 136, 129, 120, 100, 79, 15, 4, 1, 0, 3, + 4, 1, 51, 0, 3, 66, 0, 16, 61, 64, 64, 66, 66, 74, 12, + 66, 64, 64, 66, 64, 66, 2, 4, 4, 3, 1, 1, 4, 1, 1, + 4, 4, 0, 9, 7, 25, 40, 55, 74, 82, 82, 66, 1, 0, 3, + 4, 0, 4, 37, 63, 107, 13, 4, 1, 0, 4, 74, 76, 76, 74, + 6, 76, 1, 74, 8, 76, 1, 61, 1, 1, 3, 4, 0, 9, 1, + 65, 5, 4, 4, 1, 7, 82, 74, 0, 10, 76, 0, 7, 51, 1, + 1, 4, 4, 49, 65, 0, 4, 119, 0, 0, 1, 27, 4, 1, 0, + 5, 71, 171, 183, 171, 158, 0, 5, 155, 0, 3, 189, 201, 44, 0, + 3, 1, 0, 15, 7, 205, 158, 155, 141, 141, 136, 140, 131, 120, 109, +100, 79, 80, 4, 0, 3, 1, 0, 5, 102, 129, 136, 141, 141, 0, + 4, 136, 0, 23, 141, 141, 155, 175, 229, 163, 212, 232, 214, 205, 171, +155, 154, 141, 136, 126, 100, 89, 23, 1, 1, 23, 165, 0, 3, 141, + 0, 9, 136, 140, 136, 131, 124, 129, 141, 176, 62, 0, 3, 1, 0, + 8, 57, 237, 205, 171, 158, 141, 136, 136, 3, 131, 0, 3, 126, 100, + 93, 0, 4, 1, 0, 11, 216, 158, 147, 141, 141, 136, 131, 131, 126, +100, 78, 0, 5, 1, 0, 10, 175, 155, 141, 141, 136, 126, 116, 116, +100, 80, 5, 1, 0, 11, 188, 171, 158, 155, 141, 136, 131, 124, 100, + 79, 54, 0, 3, 1, 0, 11, 170, 147, 155, 141, 141, 136, 131, 129, +116, 89, 104, 0, 4, 1, 0, 11, 8, 186, 155, 154, 141, 136, 136, +131, 116, 89, 104, 0, 5, 1, 1, 207, 1, 155, 4, 141, 0, 5, +136, 124, 100, 79, 32, 0, 5, 1, 1, 25, 7, 66, 0, 5, 64, + 66, 74, 12, 74, 0, 4, 66, 0, 11, 74, 25, 1, 4, 1, 4, + 1, 4, 1, 7, 86, 0, 3, 82, 4, 76, 0, 16, 82, 76, 86, + 4, 4, 1, 4, 27, 63, 77, 1, 1, 4, 4, 19, 82, 4, 76, + 1, 82, 8, 76, 1, 82, 3, 76, 0, 22, 82, 82, 33, 1, 4, + 1, 1, 17, 17, 1, 4, 4, 1, 86, 82, 76, 76, 82, 82, 76, + 76, 82, 3, 76, 0, 7, 66, 1, 4, 1, 4, 41, 63, 0, 4, +119, 0, 0, 1, 50, 5, 1, 0, 10, 163, 214, 214, 205, 171, 174, +155, 198, 94, 0, 6, 1, 1, 32, 1, 174, 3, 154, 0, 9, 141, +141, 140, 131, 116, 116, 89, 80, 18, 0, 3, 1, 0, 6, 132, 131, +140, 141, 154, 154, 5, 140, 1, 217, 1, 14, 4, 1, 0, 15, 128, +214, 214, 183, 171, 166, 155, 140, 129, 100, 104, 1, 1, 48, 157, 0, + 3, 154, 1, 141, 3, 140, 0, 4, 129, 126, 151, 29, 5, 1, 0, + 6, 7, 237, 183, 174, 158, 154, 3, 140, 0, 4, 131, 124, 100, 93, + 4, 1, 0, 11, 216, 166, 155, 154, 141, 140, 140, 136, 124, 100, 78, + 0, 5, 1, 0, 10, 189, 174, 155, 154, 141, 136, 120, 116, 97, 85, + 5, 1, 0, 11, 188, 174, 155, 155, 154, 140, 136, 129, 109, 89, 69, + 0, 3, 1, 0, 11, 170, 155, 155, 154, 141, 141, 140, 131, 124, 97, +104, 0, 4, 1, 0, 11, 8, 186, 155, 154, 154, 141, 140, 136, 126, + 90, 104, 0, 5, 1, 0, 3, 166, 155, 141, 0, 3, 140, 0, 5, +141, 136, 116, 79, 48, 0, 4, 1, 1, 4, 4, 74, 1, 66, 1, + 74, 3, 66, 0, 10, 74, 74, 6, 76, 74, 66, 74, 66, 66, 40, + 3, 1, 0, 11, 4, 1, 4, 4, 1, 82, 82, 86, 86, 82, 86, + 0, 4, 82, 1, 86, 1, 7, 3, 4, 0, 3, 22, 65, 52, 0, + 4, 1, 0, 4, 58, 82, 86, 76, 5, 82, 0, 6, 86, 82, 86, + 82, 86, 76, 5, 82, 0, 9, 86, 74, 1, 1, 4, 1, 1, 24, + 4, 0, 3, 1, 0, 3, 76, 82, 86, 0, 4, 82, 0, 13, 86, + 82, 86, 82, 82, 86, 1, 4, 1, 4, 37, 63, 114, 0, 3, 119, + 0, 0, 1, 119, 6, 1, 0, 7, 232, 214, 214, 205, 188, 142, 4, + 0, 8, 1, 0, 21, 10, 170, 154, 145, 145, 141, 145, 145, 136, 124, +120, 100, 79, 39, 1, 1, 14, 151, 136, 145, 145, 0, 4, 154, 0, + 4, 145, 145, 191, 8, 6, 1, 0, 24, 53, 214, 214, 205, 183, 174, +155, 150, 180, 112, 1, 1, 81, 154, 154, 144, 145, 145, 136, 145, 140, +124, 116, 91, 7, 1, 1, 28, 1, 205, 3, 174, 0, 7, 154, 154, +144, 145, 131, 100, 93, 0, 4, 1, 0, 11, 216, 174, 154, 154, 144, +145, 144, 145, 124, 100, 94, 0, 5, 1, 0, 10, 189, 154, 151, 145, +144, 136, 124, 116, 90, 85, 5, 1, 0, 11, 160, 174, 166, 154, 155, +154, 151, 140, 124, 100, 91, 0, 3, 1, 1, 190, 1, 166, 3, 154, + 0, 6, 144, 136, 136, 124, 100, 104, 4, 1, 0, 11, 8, 202, 154, +154, 145, 145, 136, 131, 129, 97, 104, 0, 5, 1, 0, 4, 139, 166, +144, 136, 3, 145, 0, 4, 144, 131, 90, 59, 4, 1, 1, 33, 1, + 76, 4, 74, 1, 66, 3, 74, 0, 4, 76, 82, 4, 76, 5, 74, + 1, 64, 1, 1, 6, 4, 0, 5, 1, 66, 86, 86, 82, 0, 3, + 86, 1, 82, 3, 86, 0, 7, 12, 4, 4, 1, 16, 70, 27, 0, + 3, 4, 0, 4, 1, 19, 19, 7, 4, 86, 1, 82, 5, 86, 1, + 82, 8, 86, 1, 47, 4, 1, 1, 4, 1, 4, 3, 1, 0, 4, + 74, 86, 86, 82, 8, 86, 0, 8, 95, 4, 4, 1, 1, 31, 63, +103, 3, 119, 0, 0, 1, 119, 1, 87, 5, 1, 0, 5, 4, 232, +214, 229, 57, 0, 10, 1, 0, 20, 142, 150, 145, 145, 144, 145, 144, +145, 136, 131, 131, 116, 89, 42, 1, 1, 59, 144, 131, 145, 3, 150, + 0, 5, 151, 154, 145, 134, 29, 0, 8, 1, 0, 8, 128, 214, 205, +237, 229, 122, 21, 8, 3, 1, 0, 12, 94, 175, 151, 145, 144, 145, +144, 136, 136, 124, 113, 32, 7, 1, 0, 12, 4, 229, 174, 175, 154, +175, 175, 150, 145, 136, 100, 85, 4, 1, 0, 11, 217, 175, 154, 145, +145, 150, 145, 144, 136, 100, 91, 0, 5, 1, 0, 10, 170, 151, 150, +145, 145, 141, 131, 124, 100, 85, 5, 1, 0, 11, 102, 189, 175, 154, +151, 151, 154, 145, 129, 100, 102, 0, 3, 1, 0, 11, 168, 175, 151, +150, 150, 144, 131, 136, 131, 100, 104, 0, 4, 1, 0, 11, 8, 202, +175, 150, 144, 144, 141, 131, 124, 100, 104, 0, 5, 1, 0, 11, 122, +175, 145, 131, 145, 150, 145, 144, 136, 100, 69, 0, 4, 1, 1, 38, + 7, 76, 0, 7, 74, 76, 76, 82, 61, 1, 55, 0, 3, 82, 0, + 6, 76, 74, 1, 4, 4, 1, 3, 4, 1, 1, 1, 51, 7, 86, + 0, 21, 92, 86, 92, 25, 4, 4, 1, 4, 70, 1, 1, 4, 4, + 1, 86, 95, 7, 92, 86, 86, 92, 0, 5, 86, 1, 40, 9, 86, + 0, 3, 92, 4, 4, 0, 3, 1, 0, 5, 4, 1, 4, 1, 66, + 0, 6, 86, 1, 92, 4, 86, 1, 95, 1, 7, 3, 1, 0, 3, + 24, 63, 98, 0, 3, 119, 0, 0, 0, 3, 119, 119, 56, 0, 5, + 1, 0, 3, 36, 249, 36, 0, 10, 1, 0, 6, 69, 151, 150, 150, +145, 145, 3, 150, 0, 12, 145, 136, 136, 124, 100, 48, 1, 1, 115, +170, 144, 144, 4, 150, 0, 3, 144, 129, 137, 0, 9, 1, 0, 4, + 7, 146, 46, 14, 7, 1, 0, 3, 94, 175, 170, 0, 5, 150, 0, + 4, 144, 124, 100, 21, 8, 1, 0, 11, 242, 188, 175, 170, 150, 150, +145, 144, 131, 100, 91, 0, 4, 1, 0, 11, 217, 175, 170, 150, 145, +150, 150, 145, 141, 116, 93, 0, 5, 1, 0, 10, 186, 170, 170, 157, +150, 145, 136, 124, 100, 93, 5, 1, 0, 11, 54, 186, 175, 170, 170, +150, 150, 136, 124, 100, 115, 0, 3, 1, 0, 11, 190, 157, 157, 150, +150, 145, 136, 136, 124, 100, 104, 0, 4, 1, 0, 4, 8, 198, 175, +157, 3, 150, 0, 5, 144, 136, 100, 104, 4, 0, 4, 1, 0, 11, + 81, 189, 170, 141, 136, 150, 150, 144, 124, 101, 67, 0, 4, 1, 0, + 7, 40, 82, 76, 76, 82, 82, 76, 0, 3, 82, 0, 13, 76, 82, + 76, 76, 19, 6, 7, 7, 33, 76, 1, 4, 1, 0, 4, 4, 1, + 1, 1, 40, 3, 92, 1, 95, 1, 38, 5, 12, 0, 14, 4, 1, + 1, 4, 1, 52, 4, 1, 1, 4, 40, 92, 95, 7, 4, 92, 1, + 86, 3, 92, 0, 3, 47, 4, 95, 0, 8, 92, 0, 3, 95, 64, + 1, 0, 4, 4, 0, 4, 1, 4, 1, 64, 9, 92, 0, 10, 86, + 92, 92, 12, 1, 4, 1, 17, 65, 88, 3, 119, 0, 0, 3, 119, + 1, 34, 5, 1, 1, 7, 10, 1, 0, 3, 91, 134, 145, 0, 5, +157, 0, 13, 165, 170, 165, 157, 144, 124, 113, 29, 1, 1, 137, 170, +170, 0, 4, 157, 0, 4, 150, 136, 113, 102, 20, 1, 0, 4, 94, +175, 170, 170, 5, 157, 0, 3, 131, 101, 21, 0, 8, 1, 0, 11, +216, 189, 170, 170, 157, 144, 136, 134, 134, 113, 91, 0, 4, 1, 0, + 11, 217, 175, 165, 145, 144, 145, 145, 136, 124, 113, 93, 0, 5, 1, + 1, 186, 4, 170, 0, 5, 165, 150, 136, 113, 93, 0, 5, 1, 1, + 35, 1, 202, 3, 170, 0, 6, 157, 145, 134, 113, 101, 115, 3, 1, + 0, 11, 190, 175, 170, 170, 157, 144, 131, 136, 134, 100, 104, 0, 4, + 1, 0, 4, 8, 198, 170, 170, 4, 157, 0, 4, 145, 113, 104, 4, + 4, 1, 0, 11, 54, 202, 175, 157, 145, 150, 157, 145, 134, 101, 67, + 0, 4, 1, 0, 13, 38, 82, 82, 86, 82, 86, 82, 86, 86, 82, + 82, 86, 82, 0, 5, 86, 1, 33, 1, 19, 3, 4, 1, 1, 1, + 1, 3, 4, 1, 7, 3, 19, 1, 5, 1, 51, 5, 82, 1, 47, + 1, 1, 3, 4, 1, 27, 1, 1, 3, 4, 0, 8, 86, 95, 99, + 7, 95, 92, 95, 95, 3, 92, 0, 8, 95, 12, 4, 19, 92, 95, + 92, 95, 4, 92, 0, 11, 95, 95, 19, 4, 4, 1, 4, 1, 4, + 1, 61, 0, 5, 95, 0, 8, 92, 95, 92, 95, 95, 92, 95, 19, + 3, 4, 0, 3, 13, 65, 77, 0, 3, 119, 0, 0, 4, 119, 1, + 11, 13, 1, 0, 4, 39, 115, 124, 144, 4, 165, 0, 3, 157, 151, +150, 0, 3, 165, 0, 8, 157, 134, 123, 4, 1, 1, 159, 186, 4, +165, 0, 5, 157, 157, 141, 113, 62, 0, 20, 1, 0, 12, 94, 189, +189, 186, 165, 157, 144, 144, 157, 136, 101, 23, 8, 1, 0, 11, 217, +189, 186, 165, 165, 157, 144, 136, 134, 124, 91, 0, 4, 1, 0, 4, +216, 189, 186, 150, 3, 144, 0, 4, 124, 113, 101, 93, 5, 1, 0, + 4, 202, 184, 165, 157, 3, 165, 0, 3, 144, 113, 104, 0, 5, 1, + 0, 3, 18, 202, 186, 0, 3, 165, 0, 5, 157, 144, 124, 100, 115, + 0, 3, 1, 0, 11, 201, 189, 188, 189, 186, 157, 134, 134, 124, 101, +104, 0, 4, 1, 0, 6, 14, 216, 186, 186, 165, 157, 3, 144, 0, + 3, 124, 104, 4, 0, 4, 1, 0, 11, 42, 198, 184, 165, 165, 157, +157, 150, 136, 100, 69, 0, 4, 1, 1, 40, 3, 86, 1, 82, 8, + 86, 1, 82, 5, 86, 0, 4, 51, 1, 4, 1, 3, 4, 0, 7, + 1, 1, 19, 82, 76, 76, 92, 0, 6, 95, 0, 3, 76, 1, 1, + 0, 4, 4, 0, 8, 1, 4, 4, 95, 95, 99, 7, 99, 6, 95, + 1, 92, 3, 1, 1, 86, 9, 95, 1, 86, 1, 1, 6, 4, 6, + 12, 1, 76, 4, 95, 0, 9, 99, 95, 25, 4, 4, 1, 11, 70, + 73, 0, 3, 119, 0, 0, 4, 119, 1, 114, 11, 1, 0, 6, 14, + 91, 111, 123, 151, 165, 4, 184, 0, 9, 165, 157, 144, 151, 165, 165, +157, 138, 152, 0, 3, 1, 0, 3, 160, 186, 184, 0, 3, 173, 0, + 5, 165, 173, 151, 113, 59, 0, 20, 1, 0, 12, 81, 207, 189, 186, +184, 165, 151, 141, 136, 124, 101, 29, 8, 1, 1, 236, 1, 186, 3, +184, 0, 6, 165, 157, 157, 144, 123, 91, 4, 1, 0, 11, 217, 207, +186, 165, 144, 144, 151, 144, 124, 101, 93, 0, 5, 1, 0, 11, 198, +186, 173, 157, 151, 157, 157, 151, 124, 101, 4, 0, 4, 1, 0, 11, + 14, 198, 186, 184, 173, 184, 165, 157, 134, 113, 115, 0, 3, 1, 1, +190, 1, 207, 3, 186, 0, 6, 184, 144, 124, 123, 113, 104, 4, 1, + 0, 12, 29, 216, 186, 186, 184, 173, 157, 138, 134, 113, 104, 4, 4, + 1, 0, 11, 48, 198, 184, 165, 165, 172, 165, 157, 151, 113, 69, 0, + 4, 1, 1, 40, 3, 86, 1, 92, 11, 86, 0, 5, 92, 86, 86, + 92, 47, 0, 3, 1, 4, 4, 1, 0, 1, 110, 4, 99, 1, 95, + 4, 99, 0, 3, 106, 1, 1, 0, 6, 4, 0, 6, 25, 99, 99, +106, 7, 106, 6, 99, 0, 5, 82, 1, 1, 4, 12, 0, 10, 99, + 0, 14, 38, 1, 1, 4, 1, 4, 4, 40, 92, 92, 86, 95, 40, + 76, 3, 99, 0, 4, 95, 99, 99, 30, 4, 4, 1, 70, 1, 73, + 3, 119, 0, 0, 5, 119, 1, 98, 9, 1, 0, 9, 59, 115, 101, +113, 144, 173, 180, 184, 184, 0, 4, 180, 1, 173, 3, 157, 0, 3, +151, 134, 115, 0, 3, 1, 0, 3, 139, 207, 202, 0, 3, 180, 0, + 5, 172, 172, 165, 123, 91, 0, 20, 1, 0, 12, 62, 207, 202, 202, +200, 180, 173, 151, 138, 123, 101, 35, 8, 1, 0, 11, 236, 200, 184, +180, 200, 184, 173, 144, 138, 113, 78, 0, 4, 1, 0, 11, 236, 207, +207, 200, 173, 157, 173, 157, 134, 101, 104, 0, 4, 1, 0, 12, 21, +180, 200, 180, 173, 157, 157, 151, 144, 124, 101, 32, 4, 1, 1, 35, + 1, 193, 5, 180, 0, 4, 173, 138, 113, 91, 3, 1, 0, 11, 190, +184, 180, 180, 202, 202, 173, 151, 134, 113, 112, 0, 4, 1, 0, 3, + 54, 193, 200, 0, 3, 184, 0, 6, 172, 151, 138, 113, 101, 8, 4, + 1, 0, 11, 54, 198, 200, 180, 172, 172, 173, 165, 157, 123, 54, 0, + 4, 1, 1, 47, 8, 92, 1, 86, 6, 92, 0, 5, 86, 86, 92, + 92, 82, 0, 3, 4, 1, 1, 1, 4, 3, 1, 3, 99, 1, 106, + 6, 99, 0, 15, 110, 7, 1, 4, 4, 1, 1, 4, 1, 74, 99, + 99, 110, 7, 106, 0, 3, 99, 0, 9, 106, 99, 106, 43, 1, 4, + 1, 4, 76, 0, 6, 99, 1, 106, 3, 99, 4, 1, 0, 9, 4, + 1, 38, 106, 99, 106, 99, 43, 74, 0, 3, 99, 0, 10, 106, 99, + 99, 38, 1, 4, 1, 4, 70, 70, 3, 119, 0, 0, 5, 119, 1, +114, 7, 1, 0, 11, 29, 104, 113, 124, 124, 134, 144, 157, 182, 182, +180, 0, 5, 182, 0, 6, 172, 172, 165, 144, 134, 8, 3, 1, 0, + 4, 118, 231, 207, 198, 4, 182, 0, 3, 161, 134, 115, 0, 9, 1, + 0, 3, 4, 48, 29, 0, 8, 1, 0, 4, 48, 221, 202, 200, 3, +182, 0, 5, 165, 144, 134, 100, 48, 0, 8, 1, 0, 11, 236, 200, +200, 196, 196, 198, 182, 144, 136, 113, 78, 0, 4, 1, 1, 236, 3, +200, 0, 7, 198, 182, 172, 165, 136, 113, 104, 0, 4, 1, 1, 69, + 4, 182, 0, 7, 172, 172, 161, 144, 124, 100, 69, 0, 4, 1, 1, + 78, 1, 193, 6, 182, 0, 3, 144, 113, 69, 0, 3, 1, 0, 11, +202, 200, 182, 182, 196, 200, 196, 182, 150, 124, 115, 0, 4, 1, 0, + 3, 102, 182, 198, 0, 4, 182, 0, 5, 165, 145, 134, 100, 48, 0, + 4, 1, 0, 4, 91, 196, 200, 180, 3, 182, 0, 4, 172, 157, 124, + 39, 4, 1, 0, 5, 58, 95, 92, 95, 92, 0, 4, 95, 0, 7, + 92, 92, 95, 95, 92, 95, 92, 0, 3, 95, 0, 11, 92, 92, 1, + 4, 1, 4, 1, 4, 4, 1, 74, 0, 7, 106, 0, 4, 99, 106, +110, 19, 5, 4, 0, 8, 1, 4, 106, 99, 106, 110, 7, 110, 6, +106, 1, 4, 1, 4, 3, 1, 1, 7, 10, 106, 0, 8, 58, 4, + 4, 1, 1, 4, 30, 110, 3, 106, 1, 43, 1, 66, 6, 106, 0, + 7, 51, 1, 1, 4, 4, 60, 70, 0, 3, 119, 0, 0, 5, 119, + 1, 34, 6, 1, 0, 13, 54, 125, 124, 136, 150, 145, 136, 144, 150, +177, 194, 196, 196, 0, 5, 185, 0, 4, 177, 172, 150, 115, 4, 1, + 0, 4, 46, 229, 207, 200, 3, 196, 0, 5, 185, 172, 144, 113, 18, + 0, 8, 1, 0, 8, 59, 101, 101, 111, 91, 48, 29, 4, 3, 1, + 0, 12, 35, 225, 200, 196, 194, 185, 185, 182, 157, 136, 113, 59, 8, + 1, 1, 236, 1, 200, 5, 196, 0, 4, 172, 144, 120, 78, 4, 1, + 1, 236, 4, 196, 0, 7, 194, 182, 172, 145, 113, 101, 18, 0, 3, + 1, 0, 3, 168, 172, 177, 0, 3, 185, 0, 6, 172, 172, 161, 144, +124, 115, 4, 1, 0, 11, 152, 177, 194, 194, 196, 196, 194, 194, 161, +124, 42, 0, 3, 1, 0, 12, 202, 196, 185, 172, 185, 196, 196, 185, +161, 136, 113, 4, 3, 1, 0, 4, 142, 177, 196, 196, 3, 185, 0, + 5, 177, 161, 144, 124, 125, 0, 4, 1, 0, 11, 151, 185, 196, 196, +194, 185, 185, 177, 157, 124, 21, 0, 4, 1, 1, 74, 4, 95, 1, + 99, 3, 95, 0, 3, 92, 61, 99, 0, 5, 95, 1, 99, 3, 95, + 3, 4, 0, 11, 1, 4, 4, 1, 1, 51, 106, 106, 110, 106, 106, + 0, 3, 110, 0, 6, 106, 110, 30, 1, 4, 1, 3, 4, 1, 7, + 3, 106, 0, 16, 117, 7, 110, 106, 110, 110, 106, 106, 95, 1, 4, + 4, 1, 4, 1, 64, 3, 110, 3, 106, 0, 16, 110, 106, 110, 110, + 7, 4, 1, 4, 1, 19, 117, 110, 106, 110, 47, 74, 3, 106, 3, +110, 1, 64, 3, 1, 0, 3, 4, 50, 65, 0, 3, 119, 0, 0, + 4, 119, 1, 77, 6, 1, 0, 11, 91, 124, 131, 161, 177, 185, 177, +161, 153, 161, 185, 0, 9, 194, 1, 177, 1, 168, 6, 1, 0, 12, +221, 221, 200, 196, 194, 194, 185, 161, 145, 124, 115, 4, 6, 1, 0, + 4, 29, 111, 100, 113, 4, 100, 0, 16, 125, 91, 1, 1, 23, 225, +222, 196, 194, 187, 194, 185, 172, 145, 116, 78, 7, 1, 0, 4, 4, +235, 196, 196, 4, 194, 0, 4, 177, 150, 124, 67, 4, 1, 0, 18, +235, 194, 196, 196, 194, 194, 196, 194, 177, 140, 116, 115, 23, 14, 59, +157, 177, 177, 5, 194, 0, 10, 177, 172, 145, 124, 91, 18, 14, 78, +145, 172, 4, 194, 0, 5, 185, 177, 153, 134, 10, 0, 3, 1, 0, + 17, 198, 194, 177, 161, 177, 194, 194, 185, 194, 172, 136, 125, 23, 14, + 69, 157, 185, 0, 3, 194, 0, 22, 185, 194, 185, 177, 161, 145, 120, + 67, 15, 15, 91, 150, 177, 185, 185, 194, 194, 185, 177, 145, 113, 8, + 4, 1, 8, 99, 0, 3, 106, 19, 30, 0, 10, 99, 0, 3, 4, + 4, 1, 0, 3, 4, 0, 3, 1, 1, 38, 0, 10, 117, 0, 8, + 38, 1, 4, 4, 1, 4, 4, 47, 3, 117, 1, 121, 1, 12, 6, +117, 0, 3, 76, 4, 4, 0, 5, 1, 10, 117, 0, 7, 99, 1, + 1, 4, 4, 7, 121, 0, 3, 117, 1, 47, 1, 76, 6, 117, 0, + 7, 92, 1, 4, 1, 1, 45, 63, 0, 3, 119, 0, 0, 3, 119, + 1, 114, 6, 1, 0, 8, 104, 109, 136, 145, 161, 187, 194, 194, 4, +195, 0, 4, 194, 210, 194, 194, 3, 210, 0, 4, 194, 187, 180, 8, + 6, 1, 0, 13, 201, 226, 220, 215, 194, 195, 195, 177, 153, 131, 100, +115, 21, 0, 3, 1, 0, 26, 8, 42, 111, 109, 124, 131, 124, 120, +113, 100, 100, 112, 1, 1, 4, 240, 220, 215, 210, 194, 195, 195, 177, +145, 120, 115, 7, 1, 0, 12, 4, 235, 215, 210, 210, 194, 195, 185, +177, 149, 124, 69, 4, 1, 1, 235, 1, 195, 3, 187, 0, 29, 177, +194, 194, 195, 177, 150, 140, 136, 151, 161, 177, 185, 195, 195, 194, 195, +187, 187, 185, 161, 150, 140, 124, 123, 134, 136, 153, 177, 187, 0, 3, +195, 0, 4, 187, 177, 145, 123, 4, 1, 0, 42, 198, 215, 195, 161, +161, 169, 185, 169, 161, 177, 162, 145, 144, 151, 150, 169, 195, 194, 195, +195, 194, 195, 195, 187, 172, 153, 136, 116, 124, 134, 136, 153, 177, 177, +185, 187, 195, 187, 177, 145, 132, 4, 3, 1, 1, 12, 1, 110, 7, +106, 0, 4, 92, 0, 4, 106, 3, 99, 4, 106, 0, 12, 99, 99, + 33, 1, 4, 1, 1, 4, 1, 4, 30, 127, 5, 121, 0, 6, 127, +127, 121, 127, 61, 1, 3, 4, 0, 10, 1, 1, 127, 127, 121, 127, +130, 12, 127, 127, 3, 121, 0, 11, 127, 38, 1, 4, 1, 4, 1, + 1, 4, 58, 127, 0, 3, 121, 0, 12, 127, 127, 121, 127, 121, 127, + 25, 1, 4, 4, 1, 130, 3, 121, 0, 3, 51, 86, 127, 0, 6, +121, 1, 1, 3, 4, 1, 37, 1, 63, 3, 119, 0, 0, 3, 119, + 1, 41, 5, 1, 0, 4, 115, 126, 136, 145, 3, 161, 0, 4, 177, +195, 195, 187, 3, 195, 1, 210, 1, 220, 4, 215, 0, 3, 210, 210, + 14, 0, 7, 1, 0, 5, 118, 228, 226, 215, 210, 0, 3, 195, 0, + 20, 187, 153, 131, 116, 113, 115, 91, 115, 123, 126, 131, 140, 145, 149, +145, 131, 124, 109, 100, 39, 3, 1, 0, 11, 240, 226, 220, 220, 215, +210, 208, 195, 153, 124, 125, 0, 7, 1, 0, 4, 4, 235, 215, 210, + 3, 208, 0, 5, 195, 177, 149, 124, 59, 0, 4, 1, 1, 235, 1, +208, 3, 187, 0, 11, 169, 161, 177, 187, 179, 162, 161, 161, 162, 179, +208, 0, 4, 210, 0, 13, 215, 208, 187, 177, 169, 153, 145, 149, 145, +145, 153, 177, 187, 0, 5, 195, 0, 3, 179, 145, 125, 0, 4, 1, + 0, 18, 216, 215, 215, 195, 177, 169, 177, 177, 153, 149, 161, 169, 153, +161, 177, 187, 195, 210, 3, 215, 3, 210, 0, 17, 187, 162, 149, 140, +133, 145, 161, 162, 177, 187, 187, 195, 195, 187, 177, 145, 115, 0, 4, + 1, 1, 38, 8, 106, 0, 3, 7, 4, 1, 0, 10, 106, 0, 10, + 55, 1, 1, 4, 4, 1, 4, 4, 19, 135, 9, 130, 0, 7, 95, + 1, 4, 4, 1, 4, 12, 0, 4, 130, 1, 135, 1, 12, 3, 130, + 0, 7, 127, 130, 130, 1, 4, 1, 4, 0, 5, 1, 1, 121, 1, +127, 5, 130, 0, 9, 127, 130, 130, 135, 4, 1, 4, 1, 127, 0, + 3, 130, 1, 51, 1, 92, 6, 130, 0, 10, 135, 1, 1, 4, 1, + 27, 63, 107, 119, 119, 0, 0, 0, 3, 119, 119, 107, 0, 5, 1, + 0, 13, 78, 145, 162, 177, 179, 187, 195, 179, 177, 179, 162, 177, 195, + 0, 3, 208, 4, 215, 1, 211, 1, 191, 10, 1, 0, 4, 245, 228, +220, 210, 3, 208, 0, 20, 199, 177, 153, 145, 140, 131, 131, 140, 149, +162, 187, 187, 179, 187, 187, 177, 145, 126, 123, 8, 3, 1, 0, 5, +221, 220, 220, 215, 211, 0, 3, 208, 0, 4, 187, 140, 123, 8, 6, + 1, 0, 3, 8, 219, 211, 0, 4, 208, 0, 5, 195, 177, 149, 126, + 54, 0, 4, 1, 0, 12, 240, 215, 208, 204, 197, 197, 187, 177, 179, +162, 161, 177, 3, 187, 3, 208, 1, 211, 1, 211, 3, 215, 0, 18, +211, 208, 187, 162, 153, 161, 162, 161, 177, 187, 195, 197, 197, 208, 209, +187, 145, 54, 4, 1, 0, 5, 216, 220, 215, 211, 208, 0, 4, 195, + 0, 9, 177, 162, 162, 149, 161, 179, 195, 197, 204, 0, 5, 211, 0, + 8, 215, 210, 208, 195, 187, 169, 153, 161, 3, 177, 0, 7, 187, 197, +199, 187, 177, 145, 32, 0, 4, 1, 1, 40, 5, 110, 0, 3, 106, +110, 76, 0, 3, 1, 0, 4, 99, 110, 110, 106, 6, 110, 0, 10, +106, 1, 4, 4, 1, 4, 1, 4, 4, 148, 10, 135, 1, 1, 1, + 1, 3, 4, 1, 33, 4, 135, 0, 3, 143, 12, 143, 0, 4, 135, + 1, 117, 1, 1, 3, 4, 0, 6, 5, 4, 4, 1, 1, 47, 10, +135, 1, 43, 3, 1, 1, 117, 3, 135, 1, 55, 1, 99, 6, 135, + 0, 10, 143, 7, 1, 1, 4, 22, 63, 98, 119, 119, 0, 0, 0, + 3, 119, 119, 65, 0, 4, 1, 0, 16, 4, 151, 177, 199, 209, 204, +199, 197, 197, 187, 187, 177, 187, 199, 208, 211, 4, 215, 1, 219, 1, +115, 11, 1, 0, 26, 146, 231, 226, 215, 208, 197, 197, 187, 169, 153, +153, 179, 179, 169, 177, 169, 177, 195, 208, 208, 204, 199, 197, 177, 145, + 59, 4, 1, 0, 12, 188, 220, 215, 215, 211, 208, 204, 204, 195, 149, +124, 14, 6, 1, 0, 12, 10, 219, 208, 204, 195, 187, 187, 177, 161, +133, 116, 54, 3, 1, 0, 14, 4, 240, 220, 215, 211, 208, 199, 199, +197, 187, 177, 179, 197, 204, 4, 208, 0, 5, 211, 208, 208, 211, 215, + 0, 3, 220, 0, 10, 215, 209, 179, 177, 177, 162, 177, 187, 187, 195, + 3, 187, 1, 162, 1, 138, 5, 1, 1, 225, 1, 215, 3, 211, 0, + 11, 208, 208, 204, 197, 197, 195, 187, 177, 187, 197, 204, 0, 3, 208, + 0, 4, 211, 215, 211, 211, 4, 215, 0, 14, 211, 208, 187, 177, 179, +179, 177, 187, 195, 195, 187, 161, 144, 4, 4, 1, 0, 4, 33, 30, +121, 121, 4, 117, 0, 11, 1, 4, 1, 1, 86, 121, 117, 117, 121, +117, 117, 0, 4, 86, 1, 4, 3, 1, 0, 8, 4, 1, 4, 1, +135, 143, 148, 148, 6, 143, 0, 19, 156, 7, 1, 4, 4, 1, 110, +143, 143, 148, 143, 148, 12, 148, 143, 148, 148, 143, 82, 0, 3, 1, + 1, 4, 1, 60, 3, 4, 0, 6, 1, 1, 121, 148, 143, 148, 3, +143, 0, 13, 148, 143, 143, 156, 12, 4, 1, 110, 143, 143, 148, 64, +106, 0, 6, 143, 0, 10, 156, 19, 4, 1, 4, 17, 65, 88, 119, +119, 0, 0, 0, 3, 119, 119, 27, 0, 4, 1, 0, 21, 142, 161, +177, 197, 208, 208, 204, 199, 197, 199, 195, 179, 195, 208, 208, 211, 215, +215, 210, 217, 10, 0, 13, 1, 0, 13, 229, 234, 226, 211, 195, 187, +179, 169, 161, 153, 187, 199, 187, 0, 3, 177, 1, 187, 4, 208, 0, + 4, 199, 179, 176, 4, 4, 1, 0, 12, 139, 223, 220, 211, 208, 199, +197, 187, 169, 145, 124, 23, 6, 1, 0, 12, 14, 219, 208, 197, 187, +177, 169, 162, 149, 129, 109, 48, 3, 1, 0, 12, 4, 240, 220, 215, +215, 208, 208, 209, 208, 209, 197, 209, 5, 211, 4, 208, 0, 20, 211, +215, 215, 220, 220, 215, 211, 204, 197, 197, 187, 177, 195, 197, 204, 197, +187, 179, 161, 69, 5, 1, 0, 4, 225, 215, 208, 208, 3, 211, 3, +208, 0, 3, 211, 208, 199, 0, 4, 208, 3, 211, 1, 210, 3, 215, + 0, 6, 211, 211, 215, 210, 208, 208, 3, 197, 0, 7, 179, 187, 197, +197, 187, 161, 39, 0, 4, 1, 0, 4, 25, 135, 64, 12, 4, 127, + 1, 58, 3, 4, 0, 4, 1, 86, 127, 130, 3, 127, 0, 7, 121, + 4, 64, 61, 61, 4, 1, 0, 3, 4, 0, 6, 1, 4, 1, 106, +156, 148, 5, 156, 0, 15, 148, 156, 156, 25, 1, 1, 4, 7, 156, +156, 148, 156, 148, 156, 12, 0, 5, 127, 0, 26, 30, 1, 1, 4, + 4, 63, 45, 1, 1, 4, 4, 38, 156, 156, 148, 156, 148, 156, 156, +148, 156, 148, 95, 1, 1, 99, 3, 156, 1, 66, 1, 110, 4, 156, + 0, 12, 148, 148, 156, 25, 1, 1, 4, 16, 65, 77, 119, 119, 0, + 0, 1, 119, 1, 119, 5, 1, 0, 14, 182, 179, 187, 195, 199, 204, +199, 199, 197, 197, 187, 177, 195, 208, 3, 215, 1, 240, 1, 32, 15, + 1, 0, 6, 28, 248, 234, 226, 220, 215, 3, 208, 0, 15, 187, 197, +209, 208, 197, 197, 187, 187, 204, 208, 211, 208, 197, 193, 14, 0, 5, + 1, 0, 5, 118, 228, 226, 215, 208, 0, 3, 197, 0, 4, 179, 149, +120, 39, 6, 1, 0, 12, 14, 215, 211, 208, 204, 199, 195, 187, 177, +149, 116, 42, 3, 1, 0, 6, 4, 225, 223, 220, 215, 215, 3, 211, + 0, 19, 208, 209, 225, 220, 223, 223, 220, 215, 215, 211, 208, 211, 220, +242, 221, 226, 223, 220, 215, 0, 3, 211, 0, 9, 204, 187, 197, 208, +211, 211, 208, 195, 142, 0, 6, 1, 0, 3, 222, 223, 215, 0, 6, +211, 0, 4, 215, 225, 215, 211, 6, 215, 0, 8, 220, 220, 242, 226, +226, 220, 215, 215, 3, 211, 0, 9, 208, 211, 211, 197, 197, 208, 204, +195, 142, 0, 5, 1, 0, 9, 86, 130, 135, 110, 1, 121, 135, 127, + 1, 0, 3, 4, 0, 4, 1, 61, 135, 130, 3, 135, 0, 16, 130, + 4, 135, 130, 135, 7, 4, 4, 1, 4, 1, 4, 1, 64, 156, 167, + 7, 156, 0, 7, 167, 38, 1, 4, 1, 25, 167, 0, 4, 156, 0, + 22, 167, 76, 74, 76, 76, 74, 66, 1, 4, 1, 1, 6, 77, 119, + 6, 4, 4, 1, 1, 117, 156, 167, 7, 156, 0, 4, 167, 25, 1, + 86, 3, 156, 1, 74, 1, 117, 6, 156, 0, 10, 167, 33, 4, 1, + 1, 11, 70, 73, 119, 119, 0, 0, 1, 119, 1, 88, 4, 1, 0, + 18, 23, 209, 209, 199, 195, 197, 195, 197, 197, 199, 197, 179, 169, 195, +208, 211, 235, 42, 18, 1, 0, 16, 36, 252, 238, 233, 226, 220, 215, +215, 208, 211, 211, 215, 215, 211, 208, 208, 3, 211, 0, 3, 208, 219, + 29, 0, 6, 1, 0, 12, 71, 231, 233, 226, 215, 211, 211, 215, 208, +179, 133, 59, 6, 1, 0, 12, 20, 220, 220, 215, 211, 208, 208, 204, +197, 162, 129, 39, 3, 1, 0, 6, 4, 243, 233, 228, 223, 220, 4, +215, 0, 24, 168, 14, 250, 233, 233, 228, 226, 223, 220, 215, 220, 221, + 1, 36, 248, 238, 234, 228, 223, 220, 220, 215, 208, 211, 3, 215, 1, +209, 1, 168, 7, 1, 0, 16, 243, 233, 228, 223, 220, 215, 215, 220, +220, 201, 10, 243, 226, 228, 228, 226, 3, 223, 0, 19, 226, 201, 1, + 36, 248, 238, 233, 228, 226, 223, 220, 215, 215, 220, 215, 211, 211, 209, +168, 0, 5, 1, 0, 10, 12, 148, 143, 143, 135, 135, 4, 82, 40, + 4, 3, 1, 0, 3, 4, 38, 148, 0, 5, 143, 0, 6, 4, 148, +143, 143, 38, 1, 3, 4, 0, 4, 1, 4, 4, 40, 10, 167, 0, + 5, 55, 4, 1, 1, 76, 0, 11, 167, 0, 15, 121, 1, 1, 4, + 4, 37, 114, 119, 63, 4, 1, 4, 1, 25, 181, 0, 9, 167, 0, + 3, 148, 1, 74, 0, 3, 167, 1, 76, 1, 117, 7, 167, 0, 9, + 40, 4, 1, 4, 4, 70, 70, 119, 119, 0, 0, 0, 1, 119, 1, + 73, 4, 1, 0, 17, 78, 211, 211, 208, 199, 199, 197, 199, 199, 208, +208, 195, 162, 179, 219, 91, 4, 0, 20, 1, 0, 20, 10, 252, 244, +238, 233, 226, 223, 220, 215, 215, 223, 223, 220, 220, 215, 220, 215, 210, +235, 18, 7, 1, 0, 12, 46, 234, 238, 238, 233, 226, 223, 223, 220, +195, 153, 115, 6, 1, 0, 12, 28, 228, 228, 226, 223, 220, 215, 211, +209, 179, 136, 39, 3, 1, 0, 6, 4, 248, 244, 238, 234, 233, 3, +226, 0, 29, 223, 139, 1, 12, 232, 244, 238, 234, 233, 226, 222, 188, + 4, 1, 1, 12, 212, 244, 238, 234, 233, 233, 228, 226, 223, 223, 220, +235, 54, 0, 8, 1, 0, 5, 249, 244, 244, 234, 228, 0, 3, 226, + 0, 12, 223, 122, 1, 7, 229, 248, 238, 234, 233, 226, 226, 164, 3, + 1, 0, 7, 10, 232, 244, 238, 238, 234, 233, 0, 3, 228, 0, 4, +226, 215, 235, 42, 6, 1, 1, 127, 6, 148, 0, 9, 30, 4, 4, + 1, 1, 4, 1, 19, 156, 0, 5, 148, 0, 7, 4, 156, 148, 148, + 82, 1, 1, 0, 4, 4, 1, 1, 1, 30, 8, 181, 0, 8, 167, +181, 86, 1, 4, 1, 181, 167, 4, 181, 1, 167, 3, 181, 0, 4, +167, 181, 66, 4, 3, 1, 1, 65, 3, 119, 1, 11, 3, 4, 0, + 6, 1, 95, 167, 181, 181, 167, 3, 181, 0, 5, 167, 181, 181, 43, + 61, 0, 3, 181, 1, 95, 1, 86, 7, 181, 0, 9, 55, 1, 4, + 1, 4, 70, 70, 119, 119, 0, 0, 0, 1, 119, 1, 63, 4, 1, + 0, 15, 137, 215, 215, 211, 208, 204, 199, 199, 204, 199, 197, 195, 153, +170, 18, 0, 8, 1, 0, 3, 4, 104, 104, 0, 13, 1, 0, 17, + 57, 252, 244, 238, 234, 233, 228, 226, 226, 233, 228, 226, 226, 223, 240, + 94, 4, 0, 8, 1, 0, 12, 10, 253, 252, 252, 248, 249, 250, 250, +242, 235, 219, 191, 6, 1, 0, 12, 44, 234, 238, 234, 233, 233, 226, +223, 215, 195, 161, 35, 3, 1, 0, 7, 4, 237, 252, 253, 252, 249, +250, 0, 3, 242, 1, 81, 3, 1, 0, 6, 20, 96, 163, 163, 81, + 18, 6, 1, 0, 11, 20, 128, 248, 248, 249, 249, 250, 242, 139, 28, + 4, 0, 9, 1, 0, 10, 232, 252, 253, 252, 249, 250, 250, 242, 242, + 46, 3, 1, 0, 6, 20, 96, 163, 163, 81, 14, 6, 1, 0, 11, + 20, 146, 248, 248, 249, 245, 250, 229, 122, 28, 4, 0, 6, 1, 1, + 95, 6, 156, 0, 10, 167, 19, 4, 1, 4, 4, 1, 4, 1, 167, + 5, 156, 0, 17, 4, 167, 156, 156, 148, 1, 4, 1, 4, 4, 1, + 4, 19, 203, 181, 181, 192, 0, 3, 181, 0, 8, 192, 181, 192, 127, + 1, 1, 25, 192, 10, 181, 0, 7, 192, 25, 1, 4, 4, 5, 65, + 0, 3, 119, 1, 87, 1, 1, 3, 4, 1, 12, 1, 206, 6, 181, + 0, 10, 192, 181, 181, 192, 47, 192, 181, 181, 148, 25, 7, 181, 0, + 9, 76, 1, 1, 4, 4, 65, 65, 119, 119, 0, 0, 0, 1, 119, + 1, 63, 4, 1, 1, 137, 3, 220, 0, 10, 210, 211, 208, 208, 209, +195, 187, 179, 157, 23, 8, 1, 0, 5, 39, 111, 100, 100, 78, 0, + 13, 1, 0, 6, 4, 28, 128, 252, 248, 248, 3, 245, 0, 5, 250, +250, 164, 46, 8, 0, 12, 1, 3, 4, 3, 7, 0, 4, 8, 8, + 10, 4, 6, 1, 0, 12, 44, 248, 252, 252, 248, 245, 245, 226, 223, +219, 210, 35, 9, 1, 0, 4, 4, 4, 8, 8, 19, 1, 0, 4, + 7, 8, 12, 4, 18, 1, 0, 4, 4, 4, 8, 8, 19, 1, 0, + 4, 7, 8, 8, 4, 9, 1, 1, 66, 7, 167, 0, 10, 121, 1, + 1, 4, 4, 1, 4, 4, 1, 148, 4, 167, 1, 156, 1, 7, 4, +167, 0, 5, 4, 1, 1, 4, 1, 0, 3, 4, 1, 213, 9, 192, + 0, 4, 167, 1, 1, 51, 11, 192, 1, 181, 1, 1, 3, 4, 1, + 16, 1, 88, 4, 119, 1, 22, 3, 4, 1, 1, 1, 66, 10, 192, + 1, 181, 4, 192, 1, 1, 7, 192, 1, 117, 1, 1, 3, 4, 0, + 4, 56, 65, 119, 119, 0, 0, 1, 119, 1, 70, 4, 1, 0, 13, + 94, 220, 220, 215, 215, 210, 211, 208, 208, 197, 187, 153, 134, 0, 7, + 1, 0, 8, 15, 91, 113, 109, 108, 100, 113, 18, 5, 1, 1, 24, + 1, 4, 9, 1, 0, 6, 7, 20, 28, 28, 18, 10, 33, 1, 1, + 10, 3, 20, 4, 28, 1, 32, 1, 32, 90, 1, 0, 12, 106, 181, +181, 167, 181, 167, 181, 167, 181, 4, 4, 1, 4, 4, 0, 9, 1, + 1, 135, 167, 167, 181, 167, 167, 7, 0, 4, 181, 1, 12, 6, 4, + 1, 1, 1, 181, 5, 203, 3, 206, 0, 8, 203, 213, 1, 1, 148, +203, 206, 206, 3, 203, 1, 206, 4, 203, 0, 6, 117, 1, 1, 4, + 1, 45, 5, 119, 0, 9, 103, 1, 1, 4, 1, 7, 213, 203, 206, + 0, 3, 203, 1, 206, 7, 203, 0, 3, 206, 47, 181, 0, 6, 203, + 0, 9, 143, 1, 1, 4, 1, 45, 65, 119, 119, 0, 0, 0, 1, +119, 1, 87, 4, 1, 0, 14, 32, 223, 220, 215, 215, 211, 211, 208, +208, 209, 187, 145, 124, 29, 4, 1, 0, 10, 35, 78, 113, 109, 126, +140, 133, 109, 105, 115, 5, 1, 0, 3, 41, 63, 34, 0, 22, 1, + 0, 4, 31, 114, 119, 13, 74, 1, 0, 4, 11, 88, 114, 17, 41, + 1, 1, 25, 1, 156, 8, 181, 1, 95, 1, 1, 3, 4, 0, 6, + 9, 4, 4, 1, 1, 117, 5, 181, 1, 4, 4, 181, 1, 19, 1, + 4, 3, 1, 0, 8, 4, 1, 1, 121, 206, 213, 206, 213, 5, 206, + 0, 4, 218, 25, 12, 218, 4, 206, 1, 213, 5, 206, 0, 7, 213, + 58, 4, 1, 4, 4, 70, 0, 6, 119, 0, 6, 34, 1, 4, 4, + 1, 51, 14, 206, 1, 148, 1, 61, 6, 206, 1, 181, 1, 1, 3, + 4, 0, 4, 37, 63, 119, 119, 0, 0, 1, 119, 1, 119, 5, 1, + 0, 28, 228, 226, 215, 215, 211, 208, 197, 195, 187, 179, 149, 116, 123, + 67, 69, 78, 111, 113, 116, 131, 145, 153, 177, 177, 140, 109, 105, 59, + 4, 1, 0, 5, 27, 63, 119, 77, 11, 0, 19, 1, 1, 63, 3, +119, 1, 114, 1, 24, 54, 1, 0, 5, 9, 45, 87, 88, 41, 0, + 12, 1, 1, 31, 1, 73, 4, 119, 1, 34, 21, 1, 0, 5, 11, + 45, 88, 87, 37, 0, 12, 1, 0, 3, 47, 130, 206, 0, 8, 192, + 1, 181, 3, 1, 0, 8, 4, 4, 98, 4, 1, 4, 4, 95, 5, +192, 1, 7, 1, 135, 3, 192, 0, 3, 47, 1, 1, 0, 3, 4, + 0, 4, 1, 1, 66, 218, 6, 213, 0, 6, 206, 213, 218, 40, 43, +218, 10, 213, 1, 224, 1, 12, 3, 4, 1, 9, 1, 73, 6, 119, + 1, 114, 1, 1, 4, 4, 1, 206, 13, 213, 1, 192, 1, 7, 6, +213, 1, 218, 1, 1, 3, 4, 0, 4, 31, 63, 114, 119, 0, 0, + 0, 3, 119, 119, 22, 0, 4, 1, 0, 28, 229, 228, 220, 211, 211, +208, 197, 199, 195, 187, 169, 145, 133, 131, 129, 129, 133, 133, 149, 162, +169, 187, 195, 197, 169, 133, 109, 125, 4, 1, 1, 13, 1, 77, 3, +119, 1, 73, 1, 31, 14, 1, 1, 24, 1, 60, 7, 119, 0, 7, + 77, 45, 31, 22, 17, 17, 16, 0, 3, 13, 0, 7, 11, 11, 17, + 37, 73, 119, 56, 0, 16, 1, 0, 21, 41, 56, 41, 34, 31, 27, + 27, 24, 17, 16, 17, 34, 56, 107, 119, 103, 70, 52, 52, 70, 107, + 0, 6, 119, 0, 10, 87, 52, 34, 17, 13, 16, 24, 37, 52, 87, + 8, 119, 0, 21, 98, 56, 41, 31, 31, 27, 27, 22, 17, 16, 17, + 34, 56, 114, 119, 103, 65, 50, 52, 70, 107, 0, 6, 119, 0, 3, + 87, 52, 4, 0, 3, 1, 0, 9, 4, 30, 99, 156, 213, 206, 203, +203, 206, 0, 6, 203, 0, 14, 206, 64, 4, 4, 1, 4, 22, 119, + 5, 1, 4, 1, 55, 206, 4, 203, 0, 10, 192, 4, 206, 203, 203, +110, 1, 4, 4, 1, 3, 4, 1, 33, 5, 218, 1, 213, 1, 213, + 3, 218, 0, 20, 64, 117, 218, 218, 213, 218, 218, 213, 218, 218, 213, +218, 218, 181, 1, 1, 4, 1, 24, 98, 7, 119, 0, 6, 45, 1, + 4, 1, 1, 33, 7, 218, 1, 213, 4, 218, 0, 4, 213, 218, 12, +224, 5, 218, 0, 9, 227, 4, 4, 1, 4, 22, 63, 98, 119, 0, + 0, 0, 0, 3, 119, 119, 56, 0, 4, 1, 0, 5, 28, 231, 226, +215, 211, 0, 5, 208, 0, 18, 195, 177, 162, 177, 177, 162, 177, 179, +195, 197, 187, 195, 199, 204, 195, 161, 138, 35, 4, 1, 1, 27, 7, +119, 0, 5, 87, 50, 31, 17, 5, 0, 3, 1, 0, 4, 11, 27, + 41, 73, 27, 119, 0, 5, 114, 45, 24, 11, 4, 0, 4, 1, 1, + 4, 3, 1, 0, 3, 11, 34, 88, 0, 73, 119, 0, 10, 107, 4, + 1, 1, 4, 1, 181, 206, 206, 213, 10, 206, 0, 14, 167, 1, 1, + 4, 1, 4, 119, 119, 5, 1, 4, 4, 33, 218, 4, 206, 0, 7, +213, 19, 218, 213, 213, 192, 1, 0, 3, 4, 0, 5, 1, 4, 4, + 25, 227, 0, 4, 218, 3, 224, 0, 4, 218, 218, 121, 218, 4, 224, + 1, 218, 5, 224, 0, 3, 218, 99, 1, 0, 3, 4, 1, 52, 9, +119, 0, 9, 5, 4, 4, 1, 1, 203, 224, 218, 224, 0, 3, 218, + 0, 3, 224, 224, 218, 0, 4, 224, 1, 86, 1, 156, 5, 227, 0, + 9, 239, 19, 4, 4, 1, 13, 63, 88, 119, 0, 0, 0, 0, 3, +119, 119, 98, 0, 5, 1, 0, 19, 163, 234, 228, 220, 215, 211, 211, +215, 215, 211, 197, 179, 187, 204, 208, 209, 208, 211, 208, 0, 3, 211, + 0, 4, 208, 199, 193, 29, 5, 1, 1, 77, 135, 119, 0, 6, 11, + 4, 4, 1, 1, 82, 13, 213, 1, 224, 1, 40, 3, 1, 0, 10, + 4, 37, 119, 119, 13, 4, 1, 4, 1, 224, 4, 213, 0, 6, 218, + 7, 43, 43, 40, 43, 4, 1, 3, 4, 0, 4, 12, 239, 227, 227, + 7, 224, 0, 7, 227, 224, 227, 224, 224, 227, 227, 0, 4, 224, 0, + 4, 227, 230, 43, 1, 3, 4, 1, 73, 9, 119, 1, 56, 3, 4, + 1, 1, 1, 19, 3, 227, 4, 224, 4, 227, 0, 18, 224, 224, 206, + 19, 51, 51, 47, 43, 43, 47, 7, 1, 1, 4, 11, 65, 77, 119, + 0, 0, 3, 119, 1, 27, 5, 1, 0, 13, 212, 238, 231, 226, 215, +208, 211, 215, 215, 210, 208, 208, 211, 0, 3, 215, 5, 220, 1, 219, + 1, 176, 6, 1, 1, 4, 135, 119, 1, 73, 3, 4, 1, 1, 1, + 7, 14, 218, 0, 6, 148, 1, 4, 1, 1, 4, 3, 119, 0, 6, + 37, 4, 4, 1, 1, 213, 5, 218, 0, 6, 203, 203, 192, 203, 206, + 19, 3, 1, 4, 4, 1, 241, 16, 227, 1, 230, 4, 227, 0, 7, +241, 4, 4, 1, 4, 11, 77, 0, 10, 119, 0, 6, 9, 4, 1, + 4, 1, 167, 10, 227, 0, 3, 230, 227, 227, 0, 5, 213, 0, 10, +206, 218, 40, 4, 4, 1, 9, 65, 73, 119, 0, 0, 3, 119, 1, +107, 6, 1, 0, 7, 178, 244, 238, 233, 220, 215, 220, 0, 3, 215, + 0, 4, 210, 215, 215, 220, 3, 215, 0, 4, 220, 220, 225, 94, 6, + 1, 1, 2, 1, 103, 135, 119, 1, 4, 4, 1, 1, 148, 4, 224, + 1, 218, 5, 224, 0, 5, 218, 224, 224, 230, 25, 0, 3, 4, 1, + 1, 1, 52, 3, 119, 0, 6, 60, 1, 1, 4, 1, 181, 4, 224, + 1, 218, 5, 224, 0, 9, 30, 4, 1, 1, 4, 1, 4, 1, 206, + 0, 4, 230, 0, 3, 227, 230, 227, 0, 5, 230, 3, 227, 0, 8, +230, 230, 227, 227, 230, 230, 167, 1, 3, 4, 1, 31, 1, 103, 10, +119, 0, 9, 77, 4, 1, 4, 1, 4, 230, 227, 227, 0, 7, 230, + 3, 227, 3, 230, 3, 227, 0, 9, 239, 58, 4, 4, 1, 6, 70, + 65, 119, 0, 0, 0, 4, 119, 1, 73, 6, 1, 0, 6, 57, 237, +244, 234, 228, 226, 3, 223, 0, 9, 220, 220, 223, 226, 226, 220, 215, +225, 139, 0, 7, 1, 1, 4, 1, 107, 135, 119, 1, 41, 1, 1, + 3, 4, 0, 7, 33, 230, 224, 227, 224, 227, 224, 0, 4, 227, 0, + 10, 224, 227, 224, 227, 110, 1, 4, 1, 1, 13, 4, 119, 0, 10, +103, 4, 1, 4, 1, 143, 227, 227, 224, 227, 5, 224, 0, 3, 227, + 55, 1, 0, 5, 4, 1, 1, 1, 127, 4, 230, 1, 239, 3, 230, + 0, 19, 239, 230, 230, 239, 230, 239, 230, 227, 230, 239, 230, 230, 239, + 74, 1, 4, 4, 1, 60, 0, 12, 119, 1, 17, 4, 1, 0, 3, +135, 230, 239, 0, 10, 230, 1, 227, 6, 230, 0, 8, 82, 1, 1, + 4, 4, 70, 65, 119, 0, 0, 5, 119, 1, 37, 7, 1, 0, 7, + 53, 212, 237, 238, 234, 233, 231, 0, 4, 228, 0, 3, 231, 201, 42, + 0, 8, 1, 1, 11, 136, 119, 0, 7, 107, 1, 4, 4, 1, 1, +203, 0, 3, 227, 0, 17, 230, 230, 227, 227, 230, 227, 230, 230, 227, +227, 241, 12, 1, 4, 1, 1, 77, 0, 5, 119, 0, 5, 2, 1, + 4, 1, 110, 0, 3, 227, 1, 224, 1, 230, 5, 227, 0, 4, 130, + 1, 4, 1, 3, 4, 0, 3, 1, 58, 230, 0, 6, 239, 0, 5, +230, 230, 239, 239, 230, 0, 7, 239, 0, 8, 230, 246, 33, 1, 4, + 4, 9, 77, 12, 119, 1, 88, 3, 4, 0, 3, 1, 1, 230, 0, + 7, 239, 1, 230, 3, 239, 0, 9, 230, 230, 239, 239, 230, 239, 239, +110, 1, 0, 3, 4, 0, 3, 70, 65, 119, 0, 0, 0, 6, 119, + 1, 31, 9, 1, 1, 2, 1, 36, 3, 71, 1, 57, 1, 18, 11, + 1, 1, 41, 137, 119, 0, 10, 11, 4, 1, 4, 4, 95, 239, 230, +227, 227, 3, 230, 0, 3, 227, 230, 227, 0, 4, 230, 0, 6, 61, + 1, 1, 4, 1, 24, 6, 119, 0, 5, 4, 1, 4, 4, 74, 0, + 10, 230, 0, 11, 218, 1, 4, 4, 1, 4, 4, 1, 25, 241, 241, + 0, 3, 239, 0, 3, 241, 239, 241, 0, 9, 239, 3, 241, 1, 247, + 4, 1, 1, 17, 1, 87, 13, 119, 0, 14, 31, 1, 1, 4, 4, + 99, 239, 241, 239, 241, 239, 241, 239, 241, 6, 239, 0, 12, 241, 239, +241, 239, 135, 1, 1, 4, 4, 60, 65, 119, 0, 0, 7, 119, 1, + 60, 1, 2, 23, 1, 1, 5, 1, 107, 137, 119, 1, 77, 4, 4, + 0, 4, 1, 227, 239, 230, 5, 239, 1, 230, 1, 230, 3, 239, 0, + 8, 230, 241, 4, 1, 1, 4, 1, 107, 6, 119, 0, 30, 11, 1, + 4, 4, 40, 241, 230, 239, 230, 239, 239, 230, 239, 230, 239, 247, 7, + 4, 4, 1, 4, 4, 1, 19, 206, 203, 203, 206, 203, 224, 8, 241, + 1, 239, 3, 241, 0, 4, 239, 241, 148, 1, 3, 4, 1, 37, 1, +114, 13, 119, 0, 9, 103, 4, 4, 1, 4, 1, 227, 241, 239, 0, + 15, 241, 0, 8, 167, 1, 4, 1, 4, 50, 65, 119, 0, 0, 8, +119, 1, 114, 1, 11, 21, 1, 1, 63, 138, 119, 0, 7, 114, 4, + 4, 1, 4, 1, 135, 0, 3, 192, 1, 224, 10, 239, 1, 33, 1, + 1, 3, 4, 1, 37, 7, 119, 0, 7, 11, 4, 4, 1, 12, 247, +241, 0, 3, 239, 0, 8, 230, 239, 241, 241, 239, 241, 25, 1, 6, + 4, 1, 117, 3, 110, 0, 3, 121, 7, 246, 0, 9, 241, 0, 10, +246, 246, 241, 241, 47, 4, 1, 4, 1, 70, 15, 119, 0, 8, 45, + 1, 1, 4, 4, 61, 241, 246, 9, 241, 0, 3, 239, 241, 246, 0, + 3, 241, 1, 206, 1, 1, 3, 4, 0, 3, 41, 63, 119, 0, 0, + 0, 10, 119, 1, 88, 1, 11, 16, 1, 1, 16, 1, 87, 140, 119, + 1, 45, 4, 4, 1, 25, 3, 117, 1, 51, 1, 130, 9, 241, 0, + 6, 218, 1, 4, 1, 4, 4, 8, 119, 0, 9, 31, 1, 4, 4, + 1, 247, 241, 241, 239, 0, 3, 241, 0, 19, 246, 241, 239, 241, 38, + 4, 1, 4, 4, 1, 4, 1, 251, 241, 241, 246, 241, 25, 206, 0, + 6, 241, 1, 246, 4, 241, 0, 8, 246, 251, 25, 1, 4, 4, 11, + 77, 15, 119, 1, 114, 3, 4, 0, 3, 1, 1, 218, 0, 3, 241, + 1, 246, 8, 241, 1, 246, 3, 241, 0, 8, 239, 1, 1, 4, 1, + 31, 63, 114, 0, 0, 12, 119, 0, 3, 114, 88, 37, 0, 9, 1, + 0, 4, 11, 49, 98, 114, 141, 119, 0, 7, 98, 1, 1, 4, 4, + 1, 230, 0, 3, 241, 1, 117, 1, 130, 4, 241, 1, 246, 4, 241, + 0, 6, 19, 1, 4, 1, 1, 50, 8, 119, 0, 6, 50, 1, 1, + 4, 1, 213, 10, 241, 1, 66, 1, 1, 3, 4, 0, 4, 1, 4, + 1, 206, 4, 246, 0, 7, 127, 121, 247, 241, 241, 246, 241, 0, 4, +246, 0, 10, 241, 246, 241, 246, 1, 4, 1, 4, 27, 88, 16, 119, + 0, 9, 60, 1, 4, 4, 1, 33, 255, 251, 254, 0, 3, 251, 1, +254, 1, 251, 3, 246, 1, 241, 4, 246, 0, 8, 254, 1, 4, 1, + 1, 22, 63, 107, 0, 0, 16, 119, 1, 114, 1, 103, 4, 98, 1, +107, 1, 114, 145, 119, 0, 6, 22, 1, 4, 4, 1, 82, 3, 241, + 0, 3, 246, 110, 130, 0, 3, 241, 0, 11, 246, 241, 246, 246, 241, +148, 1, 1, 4, 4, 11, 0, 9, 119, 1, 87, 3, 4, 0, 21, + 1, 156, 241, 246, 246, 247, 241, 241, 246, 247, 241, 246, 143, 1, 4, + 1, 4, 1, 4, 1, 117, 0, 4, 247, 0, 5, 251, 19, 254, 246, +247, 0, 7, 246, 0, 8, 247, 246, 121, 1, 1, 4, 1, 45, 18, +119, 1, 1, 1, 4, 3, 1, 1, 33, 4, 40, 0, 4, 38, 38, + 12, 247, 6, 246, 0, 9, 247, 254, 12, 4, 1, 1, 11, 63, 98, + 0, 0, 0, 168, 119, 0, 27, 70, 4, 1, 4, 4, 1, 246, 246, +241, 246, 241, 117, 130, 241, 241, 246, 241, 246, 241, 246, 246, 7, 4, + 1, 4, 1, 70, 0, 10, 119, 0, 24, 1, 1, 4, 4, 33, 58, + 55, 55, 4, 239, 246, 246, 241, 246, 241, 230, 1, 4, 1, 1, 4, + 1, 1, 47, 3, 247, 0, 12, 246, 251, 25, 213, 241, 239, 241, 241, +239, 241, 241, 239, 3, 241, 1, 33, 4, 4, 1, 73, 18, 119, 1, + 77, 4, 4, 0, 3, 19, 254, 251, 0, 3, 247, 0, 18, 254, 38, +241, 246, 247, 246, 246, 247, 247, 246, 251, 33, 1, 4, 4, 9, 65, + 87, 0, 0, 168, 119, 0, 6, 5, 4, 4, 1, 1, 167, 4, 246, + 0, 3, 241, 117, 143, 0, 3, 255, 0, 10, 251, 241, 241, 246, 99, + 1, 4, 4, 1, 24, 11, 119, 0, 5, 4, 1, 4, 4, 82, 0, + 3, 247, 1, 213, 1, 4, 5, 246, 0, 15, 254, 4, 4, 1, 4, + 1, 4, 4, 19, 247, 246, 246, 247, 247, 143, 0, 3, 58, 3, 61, + 0, 12, 58, 58, 61, 58, 55, 61, 4, 1, 4, 4, 17, 87, 19, +119, 1, 6, 4, 1, 0, 3, 148, 247, 246, 0, 3, 247, 0, 17, +192, 66, 246, 247, 247, 246, 246, 247, 247, 251, 47, 4, 4, 1, 9, + 65, 77, 0, 0, 0, 167, 119, 0, 7, 45, 4, 1, 4, 4, 25, +247, 0, 5, 246, 1, 143, 3, 30, 0, 5, 19, 61, 255, 254, 251, + 0, 4, 1, 1, 4, 1, 88, 11, 119, 0, 10, 11, 1, 1, 4, + 47, 251, 247, 246, 247, 0, 3, 247, 0, 5, 246, 247, 251, 30, 1, + 0, 3, 4, 0, 8, 1, 4, 12, 251, 251, 246, 247, 247, 11, 251, + 0, 3, 254, 239, 1, 0, 3, 4, 1, 34, 1, 98, 19, 119, 0, + 7, 98, 4, 1, 4, 4, 7, 251, 0, 4, 247, 0, 6, 241, 4, +251, 247, 251, 251, 3, 247, 0, 8, 251, 66, 4, 1, 1, 4, 65, + 65, 0, 0, 166, 119, 0, 11, 98, 4, 4, 1, 4, 4, 239, 247, +246, 247, 246, 0, 3, 247, 0, 7, 254, 251, 251, 254, 47, 25, 25, + 0, 5, 4, 1, 37, 12, 119, 0, 6, 16, 1, 4, 4, 30, 254, + 3, 247, 1, 1, 4, 247, 0, 3, 246, 247, 47, 0, 6, 4, 1, + 7, 1, 251, 14, 247, 0, 8, 251, 247, 82, 1, 1, 4, 4, 50, + 21, 119, 0, 7, 17, 1, 1, 4, 1, 117, 251, 0, 3, 247, 0, + 5, 251, 38, 246, 247, 246, 0, 4, 247, 0, 8, 251, 95, 1, 1, + 4, 4, 65, 65, 0, 0, 166, 119, 0, 6, 27, 4, 1, 4, 1, + 61, 12, 247, 0, 9, 251, 255, 241, 1, 4, 1, 1, 4, 107, 0, + 12, 119, 1, 26, 3, 4, 1, 1, 1, 255, 3, 247, 1, 1, 1, +251, 5, 247, 1, 86, 1, 1, 3, 4, 3, 1, 1, 251, 1, 251, + 6, 247, 1, 251, 7, 247, 0, 7, 251, 19, 1, 4, 4, 2, 77, + 0, 21, 119, 1, 114, 1, 2, 4, 1, 1, 246, 4, 247, 0, 3, +203, 74, 251, 0, 6, 247, 0, 7, 127, 1, 1, 4, 2, 70, 65, + 0, 0, 0, 166, 119, 0, 6, 1, 4, 1, 1, 7, 255, 8, 247, + 1, 251, 4, 247, 0, 3, 251, 30, 4, 0, 3, 1, 1, 52, 13, +119, 0, 11, 45, 4, 4, 1, 1, 241, 247, 251, 251, 1, 251, 0, + 5, 247, 0, 5, 156, 1, 4, 4, 1, 0, 3, 4, 1, 192, 1, +251, 8, 247, 0, 13, 251, 247, 251, 251, 247, 247, 254, 7, 4, 1, + 1, 24, 88, 0, 22, 119, 1, 27, 3, 4, 0, 8, 1, 74, 251, +251, 247, 247, 246, 1, 6, 247, 0, 8, 251, 148, 1, 4, 1, 4, + 65, 65, 0, 0, 166, 119, 1, 1, 3, 4, 0, 9, 1, 95, 181, +227, 254, 254, 251, 247, 251, 0, 6, 247, 0, 7, 192, 1, 1, 4, + 1, 1, 114, 0, 13, 119, 1, 70, 4, 1, 0, 5, 181, 247, 251, +251, 1, 0, 4, 247, 0, 6, 251, 247, 230, 1, 1, 4, 4, 1, + 0, 3, 99, 251, 251, 0, 8, 247, 3, 251, 0, 4, 247, 247, 206, + 1, 3, 4, 1, 41, 1, 107, 23, 119, 0, 15, 5, 4, 1, 4, + 1, 230, 247, 251, 247, 251, 33, 241, 251, 247, 247, 0, 3, 251, 0, + 7, 181, 1, 4, 1, 4, 52, 77, 0, 0, 0, 166, 119, 0, 5, + 11, 1, 4, 1, 4, 0, 4, 1, 0, 6, 55, 135, 206, 230, 254, +251, 4, 247, 4, 4, 1, 1, 1, 77, 14, 119, 0, 6, 114, 1, + 4, 1, 1, 130, 3, 247, 1, 1, 1, 251, 4, 247, 1, 251, 1, +255, 5, 4, 0, 3, 1, 1, 38, 0, 3, 251, 0, 3, 247, 251, +247, 0, 3, 251, 0, 3, 247, 247, 251, 0, 3, 247, 1, 51, 3, + 1, 1, 4, 1, 56, 24, 119, 0, 25, 41, 4, 4, 1, 4, 43, +251, 251, 247, 247, 192, 82, 247, 251, 247, 251, 247, 247, 203, 1, 4, + 4, 1, 45, 114, 0, 0, 0, 166, 119, 0, 4, 45, 4, 1, 1, + 4, 4, 5, 1, 0, 6, 4, 61, 156, 213, 224, 76, 3, 4, 1, + 1, 1, 9, 16, 119, 4, 4, 0, 13, 76, 247, 247, 251, 135, 33, +247, 251, 247, 247, 251, 254, 33, 0, 4, 1, 0, 3, 4, 1, 7, + 0, 3, 251, 3, 247, 0, 15, 251, 247, 251, 247, 247, 251, 247, 247, +251, 7, 4, 4, 1, 5, 83, 0, 25, 119, 1, 6, 1, 4, 3, + 1, 1, 203, 3, 251, 0, 15, 247, 1, 247, 241, 239, 224, 213, 206, + 33, 1, 4, 4, 1, 77, 119, 0, 0, 0, 167, 119, 0, 3, 26, + 4, 1, 0, 5, 4, 0, 7, 1, 4, 1, 4, 1, 4, 4, 0, + 3, 1, 0, 5, 4, 4, 1, 4, 107, 0, 16, 119, 0, 5, 11, + 4, 4, 1, 51, 0, 3, 251, 0, 16, 247, 1, 247, 247, 251, 251, +247, 251, 58, 1, 4, 4, 1, 1, 4, 7, 4, 247, 4, 251, 7, +247, 3, 4, 0, 3, 1, 31, 98, 0, 25, 119, 0, 11, 52, 4, + 4, 1, 4, 1, 74, 95, 58, 33, 4, 0, 5, 1, 0, 8, 4, + 4, 1, 4, 1, 6, 119, 119, 0, 0, 168, 119, 0, 3, 73, 11, + 6, 0, 4, 4, 0, 4, 1, 4, 4, 1, 3, 4, 1, 1, 1, + 4, 4, 1, 1, 26, 17, 119, 1, 17, 3, 4, 0, 8, 33, 255, +247, 251, 247, 1, 251, 247, 3, 251, 0, 5, 247, 106, 1, 4, 1, + 0, 4, 4, 0, 4, 251, 247, 247, 251, 4, 247, 3, 251, 0, 4, +247, 247, 251, 156, 3, 1, 0, 3, 4, 45, 114, 0, 26, 119, 0, + 3, 16, 4, 1, 0, 4, 4, 0, 7, 1, 1, 4, 4, 1, 4, + 1, 0, 4, 4, 0, 5, 1, 4, 50, 119, 119, 0, 0, 0, 172, +119, 0, 5, 87, 41, 6, 7, 2, 0, 3, 4, 3, 1, 1, 4, + 1, 1, 3, 4, 18, 119, 1, 26, 3, 1, 0, 17, 12, 255, 251, +251, 247, 47, 58, 247, 251, 247, 251, 251, 167, 1, 4, 1, 1, 0, + 3, 4, 0, 3, 247, 251, 251, 0, 3, 247, 1, 251, 4, 247, 0, + 5, 251, 247, 247, 33, 4, 0, 3, 1, 1, 63, 27, 119, 1, 88, + 4, 4, 4, 1, 0, 4, 4, 4, 1, 1, 3, 4, 0, 4, 1, + 4, 4, 31, 3, 119, 0, 0, 177, 119, 0, 11, 77, 37, 7, 2, + 1, 1, 4, 4, 1, 1, 98, 0, 18, 119, 1, 41, 3, 4, 0, + 40, 1, 254, 251, 247, 251, 251, 4, 246, 247, 251, 251, 247, 230, 1, + 1, 4, 4, 1, 4, 4, 167, 247, 251, 251, 247, 247, 251, 251, 247, +251, 247, 254, 247, 247, 4, 1, 1, 4, 11, 107, 28, 119, 0, 8, + 88, 4, 4, 1, 1, 4, 1, 4, 3, 1, 0, 7, 4, 1, 4, + 4, 2, 4, 73, 0, 4, 119, 0, 0, 182, 119, 0, 4, 77, 37, + 31, 60, 20, 119, 0, 7, 60, 1, 1, 4, 1, 110, 251, 0, 3, +247, 0, 16, 1, 246, 251, 251, 247, 247, 255, 1, 4, 4, 1, 1, + 4, 1, 86, 247, 3, 251, 1, 247, 4, 251, 0, 4, 254, 241, 181, + 12, 4, 1, 1, 50, 31, 119, 0, 13, 52, 4, 4, 1, 1, 4, + 13, 27, 41, 56, 77, 107, 114, 0, 7, 119, 0, 0, 206, 119, 0, + 43, 88, 4, 1, 4, 1, 4, 19, 82, 192, 254, 1, 247, 251, 247, +251, 247, 255, 33, 4, 4, 1, 1, 4, 1, 4, 156, 167, 117, 64, + 33, 12, 12, 7, 4, 4, 1, 1, 4, 4, 1, 4, 4, 98, 0, + 33, 119, 1, 114, 1, 114, 16, 119, 0, 0, 207, 119, 0, 24, 4, + 4, 1, 1, 4, 4, 1, 1, 4, 4, 19, 76, 192, 255, 254, 255, + 58, 1, 1, 4, 4, 1, 4, 4, 7, 1, 1, 4, 1, 1, 6, + 4, 1, 1, 1, 52, 52, 119, 0, 0, 207, 119, 1, 41, 3, 4, + 0, 3, 1, 4, 4, 0, 3, 1, 1, 4, 3, 1, 0, 7, 19, + 30, 4, 1, 4, 1, 4, 0, 3, 1, 1, 4, 3, 1, 0, 7, + 4, 4, 1, 1, 4, 1, 1, 0, 4, 4, 1, 45, 53, 119, 0, + 0, 208, 119, 1, 37, 4, 4, 0, 5, 1, 4, 1, 4, 1, 0, + 4, 4, 1, 1, 4, 4, 0, 10, 5, 4, 4, 1, 1, 4, 1, + 4, 1, 1, 3, 4, 0, 6, 1, 1, 4, 1, 17, 83, 54, 119, + 0, 0, 209, 119, 0, 5, 88, 56, 31, 4, 4, 0, 3, 1, 1, + 4, 1, 1, 4, 4, 0, 8, 1, 4, 1, 1, 27, 98, 27, 1, + 4, 4, 0, 9, 5, 17, 31, 41, 56, 73, 77, 88, 107, 0, 56, +119, 0, 0, 213, 119, 0, 4, 107, 77, 52, 31, 6, 4, 0, 4, + 1, 1, 4, 5, 3, 119, 0, 4, 114, 88, 88, 107, 66, 119, 0, + 0, 218, 119, 0, 8, 107, 77, 50, 34, 13, 1, 11, 41, 74, 119, + 0, 1 +}; -- cgit v1.2.3 From 67a224581b7158eb0264019fc4357769a282f16f Mon Sep 17 00:00:00 2001 From: Thierry Crozat Date: Wed, 23 Dec 2015 00:36:51 +0000 Subject: OSX: Add missing translations in Info.plist --- dists/macosx/Info.plist | 5 +++++ dists/macosx/Info.plist.in | 5 +++++ 2 files changed, 10 insertions(+) diff --git a/dists/macosx/Info.plist b/dists/macosx/Info.plist index fffb18056e..b619fa6843 100644 --- a/dists/macosx/Info.plist +++ b/dists/macosx/Info.plist @@ -7,15 +7,20 @@ CFBundleLocalizations en + be ca cs da de es + eu + fi fr + gl hu it nb + nl nn pl pt diff --git a/dists/macosx/Info.plist.in b/dists/macosx/Info.plist.in index 7e91984f39..39bb82ca69 100644 --- a/dists/macosx/Info.plist.in +++ b/dists/macosx/Info.plist.in @@ -7,15 +7,20 @@ CFBundleLocalizations en + be ca cs da de es + eu + fi fr + gl hu it nb + nl nn pl pt -- cgit v1.2.3 From 7680a1365e91a7c2ef0e4fca40a372765c17ba78 Mon Sep 17 00:00:00 2001 From: Thierry Crozat Date: Wed, 23 Dec 2015 00:38:56 +0000 Subject: I18N: Update translation template --- po/be_BY.po | 129 +++++++++++++++++++++++++++---------------------- po/ca_ES.po | 129 +++++++++++++++++++++++++++---------------------- po/cs_CZ.po | 129 +++++++++++++++++++++++++++---------------------- po/da_DA.po | 129 +++++++++++++++++++++++++++---------------------- po/de_DE.po | 134 ++++++++++++++++++++++++++++----------------------- po/es_ES.po | 129 +++++++++++++++++++++++++++---------------------- po/eu.po | 129 +++++++++++++++++++++++++++---------------------- po/fi_FI.po | 129 +++++++++++++++++++++++++++---------------------- po/fr_FR.po | 129 +++++++++++++++++++++++++++---------------------- po/gl_ES.po | 129 +++++++++++++++++++++++++++---------------------- po/hu_HU.po | 129 +++++++++++++++++++++++++++---------------------- po/it_IT.po | 129 +++++++++++++++++++++++++++---------------------- po/nb_NO.po | 129 +++++++++++++++++++++++++++---------------------- po/nl_NL.po | 129 +++++++++++++++++++++++++++---------------------- po/nn_NO.po | 129 +++++++++++++++++++++++++++---------------------- po/pl_PL.po | 129 +++++++++++++++++++++++++++---------------------- po/pt_BR.po | 129 +++++++++++++++++++++++++++---------------------- po/ru_RU.po | 148 ++++++++++++++++++++++++++++++++------------------------- po/scummvm.pot | 128 +++++++++++++++++++++++++++---------------------- po/se_SE.po | 129 +++++++++++++++++++++++++++---------------------- po/uk_UA.po | 144 +++++++++++++++++++++++++++++++------------------------ 21 files changed, 1516 insertions(+), 1231 deletions(-) diff --git a/po/be_BY.po b/po/be_BY.po index 5b22098c1c..97e0c0956d 100644 --- a/po/be_BY.po +++ b/po/be_BY.po @@ -7,7 +7,7 @@ msgid "" msgstr "" "Project-Id-Version: ScummVM 1.7.0git\n" "Report-Msgid-Bugs-To: scummvm-devel@lists.sf.net\n" -"POT-Creation-Date: 2015-10-11 18:59+0100\n" +"POT-Creation-Date: 2015-12-23 00:28+0000\n" "PO-Revision-Date: 2014-07-02 17:22+0300\n" "Last-Translator: Ivan Lukyanov \n" "Language-Team: Ivan Lukyanov \n" @@ -54,13 +54,13 @@ msgid "Go up" msgstr "" #: gui/browser.cpp:75 gui/chooser.cpp:46 gui/editrecorddialog.cpp:67 -#: gui/KeysDialog.cpp:43 gui/launcher.cpp:351 gui/massadd.cpp:95 -#: gui/options.cpp:1237 gui/predictivedialog.cpp:74 gui/recorderdialog.cpp:70 -#: gui/recorderdialog.cpp:156 gui/saveload-dialog.cpp:216 -#: gui/saveload-dialog.cpp:276 gui/saveload-dialog.cpp:547 -#: gui/saveload-dialog.cpp:931 gui/themebrowser.cpp:55 -#: gui/fluidsynth-dialog.cpp:152 engines/engine.cpp:483 -#: backends/platform/wii/options.cpp:48 +#: gui/filebrowser-dialog.cpp:64 gui/KeysDialog.cpp:43 gui/launcher.cpp:351 +#: gui/massadd.cpp:95 gui/options.cpp:1237 gui/predictivedialog.cpp:74 +#: gui/recorderdialog.cpp:70 gui/recorderdialog.cpp:156 +#: gui/saveload-dialog.cpp:216 gui/saveload-dialog.cpp:276 +#: gui/saveload-dialog.cpp:547 gui/saveload-dialog.cpp:931 +#: gui/themebrowser.cpp:55 gui/fluidsynth-dialog.cpp:152 +#: engines/engine.cpp:483 backends/platform/wii/options.cpp:48 #: backends/events/default/default-events.cpp:196 #: backends/events/default/default-events.cpp:218 #: engines/drascula/saveload.cpp:49 engines/parallaction/saveload.cpp:274 @@ -69,7 +69,7 @@ msgid "Cancel" msgstr "" #: gui/browser.cpp:76 gui/browser_osx.mm:103 gui/chooser.cpp:47 -#: gui/themebrowser.cpp:56 +#: gui/filebrowser-dialog.cpp:65 gui/themebrowser.cpp:56 msgid "Choose" msgstr "" @@ -89,6 +89,39 @@ msgstr "" msgid "Ok" msgstr "" +#: gui/filebrowser-dialog.cpp:49 +msgid "Choose file for loading" +msgstr "" + +#: gui/filebrowser-dialog.cpp:49 +msgid "Enter filename for saving" +msgstr "" + +#: gui/filebrowser-dialog.cpp:132 +#, fuzzy +msgid "Do you really want to overwrite the file?" +msgstr " ?" + +#: gui/filebrowser-dialog.cpp:132 gui/launcher.cpp:793 gui/launcher.cpp:941 +#: gui/launcher.cpp:1000 gui/fluidsynth-dialog.cpp:217 +#: backends/events/symbiansdl/symbiansdl-events.cpp:186 +#: backends/platform/wince/CEActionsPocket.cpp:326 +#: backends/platform/wince/CEActionsSmartphone.cpp:287 +#: backends/platform/wince/CELauncherDialog.cpp:83 +#: engines/kyra/saveload_eob.cpp:557 engines/kyra/saveload_eob.cpp:590 +msgid "Yes" +msgstr "" + +#: gui/filebrowser-dialog.cpp:132 gui/launcher.cpp:793 gui/launcher.cpp:941 +#: gui/launcher.cpp:1000 gui/fluidsynth-dialog.cpp:217 +#: backends/events/symbiansdl/symbiansdl-events.cpp:186 +#: backends/platform/wince/CEActionsPocket.cpp:326 +#: backends/platform/wince/CEActionsSmartphone.cpp:287 +#: backends/platform/wince/CELauncherDialog.cpp:83 +#: engines/kyra/saveload_eob.cpp:557 engines/kyra/saveload_eob.cpp:590 +msgid "No" +msgstr "" + #: gui/gui-manager.cpp:117 backends/keymapper/remap-dialog.cpp:53 #: engines/scumm/help.cpp:126 engines/scumm/help.cpp:141 #: engines/scumm/help.cpp:166 engines/scumm/help.cpp:192 @@ -386,7 +419,7 @@ msgstr " msgid "~Q~uit" msgstr "~~" -#: gui/launcher.cpp:626 backends/platform/sdl/macosx/appmenu_osx.mm:95 +#: gui/launcher.cpp:626 backends/platform/sdl/macosx/appmenu_osx.mm:106 msgid "Quit ScummVM" msgstr " ScummVM" @@ -394,7 +427,7 @@ msgstr " msgid "A~b~out..." msgstr " ~~..." -#: gui/launcher.cpp:627 backends/platform/sdl/macosx/appmenu_osx.mm:69 +#: gui/launcher.cpp:627 backends/platform/sdl/macosx/appmenu_osx.mm:80 msgid "About ScummVM" msgstr " ScummVM" @@ -492,26 +525,6 @@ msgstr "" " ? " " ." -#: gui/launcher.cpp:793 gui/launcher.cpp:941 gui/launcher.cpp:1000 -#: gui/fluidsynth-dialog.cpp:217 -#: backends/events/symbiansdl/symbiansdl-events.cpp:186 -#: backends/platform/wince/CEActionsPocket.cpp:326 -#: backends/platform/wince/CEActionsSmartphone.cpp:287 -#: backends/platform/wince/CELauncherDialog.cpp:83 -#: engines/kyra/saveload_eob.cpp:557 engines/kyra/saveload_eob.cpp:590 -msgid "Yes" -msgstr "" - -#: gui/launcher.cpp:793 gui/launcher.cpp:941 gui/launcher.cpp:1000 -#: gui/fluidsynth-dialog.cpp:217 -#: backends/events/symbiansdl/symbiansdl-events.cpp:186 -#: backends/platform/wince/CEActionsPocket.cpp:326 -#: backends/platform/wince/CEActionsSmartphone.cpp:287 -#: backends/platform/wince/CELauncherDialog.cpp:83 -#: engines/kyra/saveload_eob.cpp:557 engines/kyra/saveload_eob.cpp:590 -msgid "No" -msgstr "" - #: gui/launcher.cpp:841 msgid "ScummVM couldn't open the specified directory!" msgstr "ScummVM !" @@ -664,7 +677,7 @@ msgid "Special dithering modes supported by some games" msgstr " , " #: gui/options.cpp:758 -#: backends/graphics/surfacesdl/surfacesdl-graphics.cpp:2298 +#: backends/graphics/surfacesdl/surfacesdl-graphics.cpp:2313 msgid "Fullscreen mode" msgstr " " @@ -1131,7 +1144,7 @@ msgstr " msgid "Standard Renderer" msgstr " " -#: gui/ThemeEngine.cpp:348 engines/scumm/dialogs.cpp:661 +#: gui/ThemeEngine.cpp:348 engines/scumm/dialogs.cpp:663 msgid "Standard" msgstr "" @@ -1377,7 +1390,7 @@ msgstr " #: engines/dialogs.cpp:116 engines/agi/saveload.cpp:803 #: engines/cruise/menu.cpp:212 engines/drascula/saveload.cpp:336 -#: engines/dreamweb/saveload.cpp:261 engines/neverhood/menumodule.cpp:873 +#: engines/dreamweb/saveload.cpp:261 engines/neverhood/menumodule.cpp:877 #: engines/pegasus/pegasus.cpp:377 engines/sci/engine/kfile.cpp:759 #: engines/toltecs/menu.cpp:281 engines/tsage/scenes.cpp:598 msgid "Save game:" @@ -1390,7 +1403,7 @@ msgstr " #: backends/platform/wince/CEActionsSmartphone.cpp:231 #: engines/agi/saveload.cpp:803 engines/cruise/menu.cpp:212 #: engines/drascula/saveload.cpp:336 engines/dreamweb/saveload.cpp:261 -#: engines/neverhood/menumodule.cpp:873 engines/pegasus/pegasus.cpp:377 +#: engines/neverhood/menumodule.cpp:877 engines/pegasus/pegasus.cpp:377 #: engines/sci/engine/kfile.cpp:759 engines/scumm/dialogs.cpp:188 #: engines/toltecs/menu.cpp:281 engines/tsage/scenes.cpp:598 msgid "Save" @@ -1732,57 +1745,57 @@ msgstr " msgid "Right Click" msgstr " " -#: backends/platform/sdl/macosx/appmenu_osx.mm:77 +#: backends/platform/sdl/macosx/appmenu_osx.mm:88 msgid "Hide ScummVM" msgstr " ScummVM" -#: backends/platform/sdl/macosx/appmenu_osx.mm:82 +#: backends/platform/sdl/macosx/appmenu_osx.mm:93 msgid "Hide Others" msgstr " " -#: backends/platform/sdl/macosx/appmenu_osx.mm:87 +#: backends/platform/sdl/macosx/appmenu_osx.mm:98 msgid "Show All" msgstr " " -#: backends/platform/sdl/macosx/appmenu_osx.mm:109 #: backends/platform/sdl/macosx/appmenu_osx.mm:120 +#: backends/platform/sdl/macosx/appmenu_osx.mm:131 msgid "Window" msgstr "" -#: backends/platform/sdl/macosx/appmenu_osx.mm:114 +#: backends/platform/sdl/macosx/appmenu_osx.mm:125 msgid "Minimize" msgstr "" -#: backends/graphics/surfacesdl/surfacesdl-graphics.cpp:46 +#: backends/graphics/surfacesdl/surfacesdl-graphics.cpp:47 msgid "Normal (no scaling)" msgstr " " -#: backends/graphics/surfacesdl/surfacesdl-graphics.cpp:65 +#: backends/graphics/surfacesdl/surfacesdl-graphics.cpp:66 msgctxt "lowres" msgid "Normal (no scaling)" msgstr " " -#: backends/graphics/surfacesdl/surfacesdl-graphics.cpp:2197 +#: backends/graphics/surfacesdl/surfacesdl-graphics.cpp:2212 msgid "Enabled aspect ratio correction" msgstr " " -#: backends/graphics/surfacesdl/surfacesdl-graphics.cpp:2203 +#: backends/graphics/surfacesdl/surfacesdl-graphics.cpp:2218 msgid "Disabled aspect ratio correction" msgstr " " -#: backends/graphics/surfacesdl/surfacesdl-graphics.cpp:2258 +#: backends/graphics/surfacesdl/surfacesdl-graphics.cpp:2273 msgid "Active graphics filter:" msgstr " :" -#: backends/graphics/surfacesdl/surfacesdl-graphics.cpp:2300 +#: backends/graphics/surfacesdl/surfacesdl-graphics.cpp:2315 msgid "Windowed mode" msgstr " " -#: backends/graphics/opengl/opengl-graphics.cpp:118 +#: backends/graphics/opengl/opengl-graphics.cpp:119 msgid "OpenGL" msgstr "OpenGL" -#: backends/graphics/opengl/opengl-graphics.cpp:119 +#: backends/graphics/opengl/opengl-graphics.cpp:120 msgid "OpenGL (No filtering)" msgstr "OpenGL ( )" @@ -2226,13 +2239,13 @@ msgid "" msgstr "" #: engines/agi/saveload.cpp:816 engines/drascula/saveload.cpp:349 -#: engines/dreamweb/saveload.cpp:169 engines/neverhood/menumodule.cpp:886 +#: engines/dreamweb/saveload.cpp:169 engines/neverhood/menumodule.cpp:890 #: engines/sci/engine/kfile.cpp:858 engines/toltecs/menu.cpp:256 msgid "Restore game:" msgstr " :" #: engines/agi/saveload.cpp:816 engines/drascula/saveload.cpp:349 -#: engines/dreamweb/saveload.cpp:169 engines/neverhood/menumodule.cpp:886 +#: engines/dreamweb/saveload.cpp:169 engines/neverhood/menumodule.cpp:890 #: engines/sci/engine/kfile.cpp:858 engines/toltecs/menu.cpp:256 msgid "Restore" msgstr "" @@ -2772,36 +2785,36 @@ msgstr "~ msgid "~N~ext" msgstr "~~" -#: engines/scumm/dialogs.cpp:600 +#: engines/scumm/dialogs.cpp:602 msgid "Speech Only" msgstr " " -#: engines/scumm/dialogs.cpp:601 +#: engines/scumm/dialogs.cpp:603 msgid "Speech and Subtitles" msgstr " " -#: engines/scumm/dialogs.cpp:602 +#: engines/scumm/dialogs.cpp:604 msgid "Subtitles Only" msgstr " " -#: engines/scumm/dialogs.cpp:610 +#: engines/scumm/dialogs.cpp:612 msgctxt "lowres" msgid "Speech & Subs" msgstr " " -#: engines/scumm/dialogs.cpp:656 +#: engines/scumm/dialogs.cpp:658 msgid "Select a Proficiency Level." msgstr " ." -#: engines/scumm/dialogs.cpp:658 +#: engines/scumm/dialogs.cpp:660 msgid "Refer to your Loom(TM) manual for help." msgstr " Loom(TM)." -#: engines/scumm/dialogs.cpp:662 +#: engines/scumm/dialogs.cpp:664 msgid "Practice" msgstr "" -#: engines/scumm/dialogs.cpp:663 +#: engines/scumm/dialogs.cpp:665 msgid "Expert" msgstr "" diff --git a/po/ca_ES.po b/po/ca_ES.po index 096990848c..a36274c660 100644 --- a/po/ca_ES.po +++ b/po/ca_ES.po @@ -7,7 +7,7 @@ msgid "" msgstr "" "Project-Id-Version: ScummVM 1.6.0git\n" "Report-Msgid-Bugs-To: scummvm-devel@lists.sf.net\n" -"POT-Creation-Date: 2015-10-11 18:59+0100\n" +"POT-Creation-Date: 2015-12-23 00:28+0000\n" "PO-Revision-Date: 2013-05-05 14:16+0100\n" "Last-Translator: Jordi Vilalta Prat \n" "Language-Team: Catalan \n" @@ -51,13 +51,13 @@ msgid "Go up" msgstr "Amunt" #: gui/browser.cpp:75 gui/chooser.cpp:46 gui/editrecorddialog.cpp:67 -#: gui/KeysDialog.cpp:43 gui/launcher.cpp:351 gui/massadd.cpp:95 -#: gui/options.cpp:1237 gui/predictivedialog.cpp:74 gui/recorderdialog.cpp:70 -#: gui/recorderdialog.cpp:156 gui/saveload-dialog.cpp:216 -#: gui/saveload-dialog.cpp:276 gui/saveload-dialog.cpp:547 -#: gui/saveload-dialog.cpp:931 gui/themebrowser.cpp:55 -#: gui/fluidsynth-dialog.cpp:152 engines/engine.cpp:483 -#: backends/platform/wii/options.cpp:48 +#: gui/filebrowser-dialog.cpp:64 gui/KeysDialog.cpp:43 gui/launcher.cpp:351 +#: gui/massadd.cpp:95 gui/options.cpp:1237 gui/predictivedialog.cpp:74 +#: gui/recorderdialog.cpp:70 gui/recorderdialog.cpp:156 +#: gui/saveload-dialog.cpp:216 gui/saveload-dialog.cpp:276 +#: gui/saveload-dialog.cpp:547 gui/saveload-dialog.cpp:931 +#: gui/themebrowser.cpp:55 gui/fluidsynth-dialog.cpp:152 +#: engines/engine.cpp:483 backends/platform/wii/options.cpp:48 #: backends/events/default/default-events.cpp:196 #: backends/events/default/default-events.cpp:218 #: engines/drascula/saveload.cpp:49 engines/parallaction/saveload.cpp:274 @@ -66,7 +66,7 @@ msgid "Cancel" msgstr "Cancella" #: gui/browser.cpp:76 gui/browser_osx.mm:103 gui/chooser.cpp:47 -#: gui/themebrowser.cpp:56 +#: gui/filebrowser-dialog.cpp:65 gui/themebrowser.cpp:56 msgid "Choose" msgstr "Escull" @@ -86,6 +86,39 @@ msgstr "" msgid "Ok" msgstr "" +#: gui/filebrowser-dialog.cpp:49 +msgid "Choose file for loading" +msgstr "" + +#: gui/filebrowser-dialog.cpp:49 +msgid "Enter filename for saving" +msgstr "" + +#: gui/filebrowser-dialog.cpp:132 +#, fuzzy +msgid "Do you really want to overwrite the file?" +msgstr "Realment voleu suprimir aquesta partida?" + +#: gui/filebrowser-dialog.cpp:132 gui/launcher.cpp:793 gui/launcher.cpp:941 +#: gui/launcher.cpp:1000 gui/fluidsynth-dialog.cpp:217 +#: backends/events/symbiansdl/symbiansdl-events.cpp:186 +#: backends/platform/wince/CEActionsPocket.cpp:326 +#: backends/platform/wince/CEActionsSmartphone.cpp:287 +#: backends/platform/wince/CELauncherDialog.cpp:83 +#: engines/kyra/saveload_eob.cpp:557 engines/kyra/saveload_eob.cpp:590 +msgid "Yes" +msgstr "S" + +#: gui/filebrowser-dialog.cpp:132 gui/launcher.cpp:793 gui/launcher.cpp:941 +#: gui/launcher.cpp:1000 gui/fluidsynth-dialog.cpp:217 +#: backends/events/symbiansdl/symbiansdl-events.cpp:186 +#: backends/platform/wince/CEActionsPocket.cpp:326 +#: backends/platform/wince/CEActionsSmartphone.cpp:287 +#: backends/platform/wince/CELauncherDialog.cpp:83 +#: engines/kyra/saveload_eob.cpp:557 engines/kyra/saveload_eob.cpp:590 +msgid "No" +msgstr "No" + #: gui/gui-manager.cpp:117 backends/keymapper/remap-dialog.cpp:53 #: engines/scumm/help.cpp:126 engines/scumm/help.cpp:141 #: engines/scumm/help.cpp:166 engines/scumm/help.cpp:192 @@ -384,7 +417,7 @@ msgstr "" msgid "~Q~uit" msgstr "~T~anca" -#: gui/launcher.cpp:626 backends/platform/sdl/macosx/appmenu_osx.mm:95 +#: gui/launcher.cpp:626 backends/platform/sdl/macosx/appmenu_osx.mm:106 msgid "Quit ScummVM" msgstr "Surt de ScummVM" @@ -392,7 +425,7 @@ msgstr "Surt de ScummVM" msgid "A~b~out..." msgstr "~Q~uant a..." -#: gui/launcher.cpp:627 backends/platform/sdl/macosx/appmenu_osx.mm:69 +#: gui/launcher.cpp:627 backends/platform/sdl/macosx/appmenu_osx.mm:80 msgid "About ScummVM" msgstr "Quant a ScummVM" @@ -492,26 +525,6 @@ msgstr "" "Esteu segur que voleu executar el detector massiu de jocs? Aix pot afegir " "una gran quantitat de jocs." -#: gui/launcher.cpp:793 gui/launcher.cpp:941 gui/launcher.cpp:1000 -#: gui/fluidsynth-dialog.cpp:217 -#: backends/events/symbiansdl/symbiansdl-events.cpp:186 -#: backends/platform/wince/CEActionsPocket.cpp:326 -#: backends/platform/wince/CEActionsSmartphone.cpp:287 -#: backends/platform/wince/CELauncherDialog.cpp:83 -#: engines/kyra/saveload_eob.cpp:557 engines/kyra/saveload_eob.cpp:590 -msgid "Yes" -msgstr "S" - -#: gui/launcher.cpp:793 gui/launcher.cpp:941 gui/launcher.cpp:1000 -#: gui/fluidsynth-dialog.cpp:217 -#: backends/events/symbiansdl/symbiansdl-events.cpp:186 -#: backends/platform/wince/CEActionsPocket.cpp:326 -#: backends/platform/wince/CEActionsSmartphone.cpp:287 -#: backends/platform/wince/CELauncherDialog.cpp:83 -#: engines/kyra/saveload_eob.cpp:557 engines/kyra/saveload_eob.cpp:590 -msgid "No" -msgstr "No" - #: gui/launcher.cpp:841 msgid "ScummVM couldn't open the specified directory!" msgstr "ScummVM no ha pogut obrir el directori especificat!" @@ -667,7 +680,7 @@ msgid "Special dithering modes supported by some games" msgstr "Modes de tramat especials suportats per alguns jocs" #: gui/options.cpp:758 -#: backends/graphics/surfacesdl/surfacesdl-graphics.cpp:2298 +#: backends/graphics/surfacesdl/surfacesdl-graphics.cpp:2313 msgid "Fullscreen mode" msgstr "Mode pantalla completa" @@ -1135,7 +1148,7 @@ msgstr "GFX desactivats" msgid "Standard Renderer" msgstr "Pintat estndard (16bpp)" -#: gui/ThemeEngine.cpp:348 engines/scumm/dialogs.cpp:661 +#: gui/ThemeEngine.cpp:348 engines/scumm/dialogs.cpp:663 msgid "Standard" msgstr "Estndard" @@ -1385,7 +1398,7 @@ msgstr "~R~etorna al Llan #: engines/dialogs.cpp:116 engines/agi/saveload.cpp:803 #: engines/cruise/menu.cpp:212 engines/drascula/saveload.cpp:336 -#: engines/dreamweb/saveload.cpp:261 engines/neverhood/menumodule.cpp:873 +#: engines/dreamweb/saveload.cpp:261 engines/neverhood/menumodule.cpp:877 #: engines/pegasus/pegasus.cpp:377 engines/sci/engine/kfile.cpp:759 #: engines/toltecs/menu.cpp:281 engines/tsage/scenes.cpp:598 msgid "Save game:" @@ -1398,7 +1411,7 @@ msgstr "Desa la partida:" #: backends/platform/wince/CEActionsSmartphone.cpp:231 #: engines/agi/saveload.cpp:803 engines/cruise/menu.cpp:212 #: engines/drascula/saveload.cpp:336 engines/dreamweb/saveload.cpp:261 -#: engines/neverhood/menumodule.cpp:873 engines/pegasus/pegasus.cpp:377 +#: engines/neverhood/menumodule.cpp:877 engines/pegasus/pegasus.cpp:377 #: engines/sci/engine/kfile.cpp:759 engines/scumm/dialogs.cpp:188 #: engines/toltecs/menu.cpp:281 engines/tsage/scenes.cpp:598 msgid "Save" @@ -1736,58 +1749,58 @@ msgstr "Clic central" msgid "Right Click" msgstr "Clic dret" -#: backends/platform/sdl/macosx/appmenu_osx.mm:77 +#: backends/platform/sdl/macosx/appmenu_osx.mm:88 msgid "Hide ScummVM" msgstr "Amaga ScummVM" -#: backends/platform/sdl/macosx/appmenu_osx.mm:82 +#: backends/platform/sdl/macosx/appmenu_osx.mm:93 msgid "Hide Others" msgstr "Oculta els altres" -#: backends/platform/sdl/macosx/appmenu_osx.mm:87 +#: backends/platform/sdl/macosx/appmenu_osx.mm:98 msgid "Show All" msgstr "Mostra-ho tot" -#: backends/platform/sdl/macosx/appmenu_osx.mm:109 #: backends/platform/sdl/macosx/appmenu_osx.mm:120 +#: backends/platform/sdl/macosx/appmenu_osx.mm:131 msgid "Window" msgstr "Finestra" -#: backends/platform/sdl/macosx/appmenu_osx.mm:114 +#: backends/platform/sdl/macosx/appmenu_osx.mm:125 msgid "Minimize" msgstr "Minimitza" -#: backends/graphics/surfacesdl/surfacesdl-graphics.cpp:46 +#: backends/graphics/surfacesdl/surfacesdl-graphics.cpp:47 msgid "Normal (no scaling)" msgstr "Normal (sense escalar)" -#: backends/graphics/surfacesdl/surfacesdl-graphics.cpp:65 +#: backends/graphics/surfacesdl/surfacesdl-graphics.cpp:66 msgctxt "lowres" msgid "Normal (no scaling)" msgstr "Normal (no escalat)" -#: backends/graphics/surfacesdl/surfacesdl-graphics.cpp:2197 +#: backends/graphics/surfacesdl/surfacesdl-graphics.cpp:2212 msgid "Enabled aspect ratio correction" msgstr "S'ha activat la correcci de la relaci d'aspecte" -#: backends/graphics/surfacesdl/surfacesdl-graphics.cpp:2203 +#: backends/graphics/surfacesdl/surfacesdl-graphics.cpp:2218 msgid "Disabled aspect ratio correction" msgstr "S'ha desactivat la correcci de la relaci d'aspecte" -#: backends/graphics/surfacesdl/surfacesdl-graphics.cpp:2258 +#: backends/graphics/surfacesdl/surfacesdl-graphics.cpp:2273 msgid "Active graphics filter:" msgstr "Filtre de grfics actiu:" -#: backends/graphics/surfacesdl/surfacesdl-graphics.cpp:2300 +#: backends/graphics/surfacesdl/surfacesdl-graphics.cpp:2315 msgid "Windowed mode" msgstr "Mode de finestra" -#: backends/graphics/opengl/opengl-graphics.cpp:118 +#: backends/graphics/opengl/opengl-graphics.cpp:119 #, fuzzy msgid "OpenGL" msgstr "Obre" -#: backends/graphics/opengl/opengl-graphics.cpp:119 +#: backends/graphics/opengl/opengl-graphics.cpp:120 msgid "OpenGL (No filtering)" msgstr "" @@ -2230,13 +2243,13 @@ msgid "" msgstr "" #: engines/agi/saveload.cpp:816 engines/drascula/saveload.cpp:349 -#: engines/dreamweb/saveload.cpp:169 engines/neverhood/menumodule.cpp:886 +#: engines/dreamweb/saveload.cpp:169 engines/neverhood/menumodule.cpp:890 #: engines/sci/engine/kfile.cpp:858 engines/toltecs/menu.cpp:256 msgid "Restore game:" msgstr "Recupera la partida:" #: engines/agi/saveload.cpp:816 engines/drascula/saveload.cpp:349 -#: engines/dreamweb/saveload.cpp:169 engines/neverhood/menumodule.cpp:886 +#: engines/dreamweb/saveload.cpp:169 engines/neverhood/menumodule.cpp:890 #: engines/sci/engine/kfile.cpp:858 engines/toltecs/menu.cpp:256 msgid "Restore" msgstr "Restaura" @@ -2777,36 +2790,36 @@ msgstr "~A~nterior" msgid "~N~ext" msgstr "~S~egent" -#: engines/scumm/dialogs.cpp:600 +#: engines/scumm/dialogs.cpp:602 msgid "Speech Only" msgstr "Noms veus" -#: engines/scumm/dialogs.cpp:601 +#: engines/scumm/dialogs.cpp:603 msgid "Speech and Subtitles" msgstr "Veu i subttols" -#: engines/scumm/dialogs.cpp:602 +#: engines/scumm/dialogs.cpp:604 msgid "Subtitles Only" msgstr "Noms subttols" -#: engines/scumm/dialogs.cpp:610 +#: engines/scumm/dialogs.cpp:612 msgctxt "lowres" msgid "Speech & Subs" msgstr "Veus i sub." -#: engines/scumm/dialogs.cpp:656 +#: engines/scumm/dialogs.cpp:658 msgid "Select a Proficiency Level." msgstr "Seleccioneu el nivell de competncia." -#: engines/scumm/dialogs.cpp:658 +#: engines/scumm/dialogs.cpp:660 msgid "Refer to your Loom(TM) manual for help." msgstr "Consulteu el manual de Loom(TM) per ajuda." -#: engines/scumm/dialogs.cpp:662 +#: engines/scumm/dialogs.cpp:664 msgid "Practice" msgstr "Prctica" -#: engines/scumm/dialogs.cpp:663 +#: engines/scumm/dialogs.cpp:665 msgid "Expert" msgstr "Expert" diff --git a/po/cs_CZ.po b/po/cs_CZ.po index aa3fc856b8..56d37e7f8d 100644 --- a/po/cs_CZ.po +++ b/po/cs_CZ.po @@ -7,7 +7,7 @@ msgid "" msgstr "" "Project-Id-Version: ScummVM 1.7.0git\n" "Report-Msgid-Bugs-To: scummvm-devel@lists.sf.net\n" -"POT-Creation-Date: 2015-10-11 18:59+0100\n" +"POT-Creation-Date: 2015-12-23 00:28+0000\n" "PO-Revision-Date: 2015-07-26 18:51+0200\n" "Last-Translator: Zbynk Schwarz \n" "Language-Team: \n" @@ -55,13 +55,13 @@ msgid "Go up" msgstr "Jt nahoru" #: gui/browser.cpp:75 gui/chooser.cpp:46 gui/editrecorddialog.cpp:67 -#: gui/KeysDialog.cpp:43 gui/launcher.cpp:351 gui/massadd.cpp:95 -#: gui/options.cpp:1237 gui/predictivedialog.cpp:74 gui/recorderdialog.cpp:70 -#: gui/recorderdialog.cpp:156 gui/saveload-dialog.cpp:216 -#: gui/saveload-dialog.cpp:276 gui/saveload-dialog.cpp:547 -#: gui/saveload-dialog.cpp:931 gui/themebrowser.cpp:55 -#: gui/fluidsynth-dialog.cpp:152 engines/engine.cpp:483 -#: backends/platform/wii/options.cpp:48 +#: gui/filebrowser-dialog.cpp:64 gui/KeysDialog.cpp:43 gui/launcher.cpp:351 +#: gui/massadd.cpp:95 gui/options.cpp:1237 gui/predictivedialog.cpp:74 +#: gui/recorderdialog.cpp:70 gui/recorderdialog.cpp:156 +#: gui/saveload-dialog.cpp:216 gui/saveload-dialog.cpp:276 +#: gui/saveload-dialog.cpp:547 gui/saveload-dialog.cpp:931 +#: gui/themebrowser.cpp:55 gui/fluidsynth-dialog.cpp:152 +#: engines/engine.cpp:483 backends/platform/wii/options.cpp:48 #: backends/events/default/default-events.cpp:196 #: backends/events/default/default-events.cpp:218 #: engines/drascula/saveload.cpp:49 engines/parallaction/saveload.cpp:274 @@ -70,7 +70,7 @@ msgid "Cancel" msgstr "Zruit" #: gui/browser.cpp:76 gui/browser_osx.mm:103 gui/chooser.cpp:47 -#: gui/themebrowser.cpp:56 +#: gui/filebrowser-dialog.cpp:65 gui/themebrowser.cpp:56 msgid "Choose" msgstr "Zvolit" @@ -92,6 +92,39 @@ msgstr "Pozn msgid "Ok" msgstr "" +#: gui/filebrowser-dialog.cpp:49 +msgid "Choose file for loading" +msgstr "" + +#: gui/filebrowser-dialog.cpp:49 +msgid "Enter filename for saving" +msgstr "" + +#: gui/filebrowser-dialog.cpp:132 +#, fuzzy +msgid "Do you really want to overwrite the file?" +msgstr "Opravdu chcete tento zznam smazat?" + +#: gui/filebrowser-dialog.cpp:132 gui/launcher.cpp:793 gui/launcher.cpp:941 +#: gui/launcher.cpp:1000 gui/fluidsynth-dialog.cpp:217 +#: backends/events/symbiansdl/symbiansdl-events.cpp:186 +#: backends/platform/wince/CEActionsPocket.cpp:326 +#: backends/platform/wince/CEActionsSmartphone.cpp:287 +#: backends/platform/wince/CELauncherDialog.cpp:83 +#: engines/kyra/saveload_eob.cpp:557 engines/kyra/saveload_eob.cpp:590 +msgid "Yes" +msgstr "Ano" + +#: gui/filebrowser-dialog.cpp:132 gui/launcher.cpp:793 gui/launcher.cpp:941 +#: gui/launcher.cpp:1000 gui/fluidsynth-dialog.cpp:217 +#: backends/events/symbiansdl/symbiansdl-events.cpp:186 +#: backends/platform/wince/CEActionsPocket.cpp:326 +#: backends/platform/wince/CEActionsSmartphone.cpp:287 +#: backends/platform/wince/CELauncherDialog.cpp:83 +#: engines/kyra/saveload_eob.cpp:557 engines/kyra/saveload_eob.cpp:590 +msgid "No" +msgstr "Ne" + #: gui/gui-manager.cpp:117 backends/keymapper/remap-dialog.cpp:53 #: engines/scumm/help.cpp:126 engines/scumm/help.cpp:141 #: engines/scumm/help.cpp:166 engines/scumm/help.cpp:192 @@ -387,7 +420,7 @@ msgstr "Toto ID hry je u msgid "~Q~uit" msgstr "~U~konit" -#: gui/launcher.cpp:626 backends/platform/sdl/macosx/appmenu_osx.mm:95 +#: gui/launcher.cpp:626 backends/platform/sdl/macosx/appmenu_osx.mm:106 msgid "Quit ScummVM" msgstr "Ukonit ScummVM" @@ -395,7 +428,7 @@ msgstr "Ukon msgid "A~b~out..." msgstr "~O~ Programu..." -#: gui/launcher.cpp:627 backends/platform/sdl/macosx/appmenu_osx.mm:69 +#: gui/launcher.cpp:627 backends/platform/sdl/macosx/appmenu_osx.mm:80 msgid "About ScummVM" msgstr "O ScummVM" @@ -493,26 +526,6 @@ msgstr "" "Opravdu chcete spustit hromadnou detekci her? Toto by mohlo potenciln " "pidat velkou spoustu her. " -#: gui/launcher.cpp:793 gui/launcher.cpp:941 gui/launcher.cpp:1000 -#: gui/fluidsynth-dialog.cpp:217 -#: backends/events/symbiansdl/symbiansdl-events.cpp:186 -#: backends/platform/wince/CEActionsPocket.cpp:326 -#: backends/platform/wince/CEActionsSmartphone.cpp:287 -#: backends/platform/wince/CELauncherDialog.cpp:83 -#: engines/kyra/saveload_eob.cpp:557 engines/kyra/saveload_eob.cpp:590 -msgid "Yes" -msgstr "Ano" - -#: gui/launcher.cpp:793 gui/launcher.cpp:941 gui/launcher.cpp:1000 -#: gui/fluidsynth-dialog.cpp:217 -#: backends/events/symbiansdl/symbiansdl-events.cpp:186 -#: backends/platform/wince/CEActionsPocket.cpp:326 -#: backends/platform/wince/CEActionsSmartphone.cpp:287 -#: backends/platform/wince/CELauncherDialog.cpp:83 -#: engines/kyra/saveload_eob.cpp:557 engines/kyra/saveload_eob.cpp:590 -msgid "No" -msgstr "Ne" - #: gui/launcher.cpp:841 msgid "ScummVM couldn't open the specified directory!" msgstr "ScummVM nemohl tento adres otevt!" @@ -665,7 +678,7 @@ msgid "Special dithering modes supported by some games" msgstr "Speciln reimy chvn podporovan nktermi hrami" #: gui/options.cpp:758 -#: backends/graphics/surfacesdl/surfacesdl-graphics.cpp:2298 +#: backends/graphics/surfacesdl/surfacesdl-graphics.cpp:2313 msgid "Fullscreen mode" msgstr "Reim cel obrazovky" @@ -1126,7 +1139,7 @@ msgstr "GFX zak msgid "Standard Renderer" msgstr "Standardn Vykreslova" -#: gui/ThemeEngine.cpp:348 engines/scumm/dialogs.cpp:661 +#: gui/ThemeEngine.cpp:348 engines/scumm/dialogs.cpp:663 msgid "Standard" msgstr "Standardn" @@ -1373,7 +1386,7 @@ msgstr "~N~ #: engines/dialogs.cpp:116 engines/agi/saveload.cpp:803 #: engines/cruise/menu.cpp:212 engines/drascula/saveload.cpp:336 -#: engines/dreamweb/saveload.cpp:261 engines/neverhood/menumodule.cpp:873 +#: engines/dreamweb/saveload.cpp:261 engines/neverhood/menumodule.cpp:877 #: engines/pegasus/pegasus.cpp:377 engines/sci/engine/kfile.cpp:759 #: engines/toltecs/menu.cpp:281 engines/tsage/scenes.cpp:598 msgid "Save game:" @@ -1386,7 +1399,7 @@ msgstr "Ulo #: backends/platform/wince/CEActionsSmartphone.cpp:231 #: engines/agi/saveload.cpp:803 engines/cruise/menu.cpp:212 #: engines/drascula/saveload.cpp:336 engines/dreamweb/saveload.cpp:261 -#: engines/neverhood/menumodule.cpp:873 engines/pegasus/pegasus.cpp:377 +#: engines/neverhood/menumodule.cpp:877 engines/pegasus/pegasus.cpp:377 #: engines/sci/engine/kfile.cpp:759 engines/scumm/dialogs.cpp:188 #: engines/toltecs/menu.cpp:281 engines/tsage/scenes.cpp:598 msgid "Save" @@ -1725,57 +1738,57 @@ msgstr "Kliknut msgid "Right Click" msgstr "Prav kliknut" -#: backends/platform/sdl/macosx/appmenu_osx.mm:77 +#: backends/platform/sdl/macosx/appmenu_osx.mm:88 msgid "Hide ScummVM" msgstr "Skrt ScummVM" -#: backends/platform/sdl/macosx/appmenu_osx.mm:82 +#: backends/platform/sdl/macosx/appmenu_osx.mm:93 msgid "Hide Others" msgstr "Skrt Ostatn" -#: backends/platform/sdl/macosx/appmenu_osx.mm:87 +#: backends/platform/sdl/macosx/appmenu_osx.mm:98 msgid "Show All" msgstr "Zobrazit Ve" -#: backends/platform/sdl/macosx/appmenu_osx.mm:109 #: backends/platform/sdl/macosx/appmenu_osx.mm:120 +#: backends/platform/sdl/macosx/appmenu_osx.mm:131 msgid "Window" msgstr "Okno" -#: backends/platform/sdl/macosx/appmenu_osx.mm:114 +#: backends/platform/sdl/macosx/appmenu_osx.mm:125 msgid "Minimize" msgstr "Minimalizovat" -#: backends/graphics/surfacesdl/surfacesdl-graphics.cpp:46 +#: backends/graphics/surfacesdl/surfacesdl-graphics.cpp:47 msgid "Normal (no scaling)" msgstr "Normln (bez zmny velikosti)" -#: backends/graphics/surfacesdl/surfacesdl-graphics.cpp:65 +#: backends/graphics/surfacesdl/surfacesdl-graphics.cpp:66 msgctxt "lowres" msgid "Normal (no scaling)" msgstr "Normln (bez zmny velikosti)" -#: backends/graphics/surfacesdl/surfacesdl-graphics.cpp:2197 +#: backends/graphics/surfacesdl/surfacesdl-graphics.cpp:2212 msgid "Enabled aspect ratio correction" msgstr "Povolena korekce pomru stran" -#: backends/graphics/surfacesdl/surfacesdl-graphics.cpp:2203 +#: backends/graphics/surfacesdl/surfacesdl-graphics.cpp:2218 msgid "Disabled aspect ratio correction" msgstr "Zakzna korekce pomru stran" -#: backends/graphics/surfacesdl/surfacesdl-graphics.cpp:2258 +#: backends/graphics/surfacesdl/surfacesdl-graphics.cpp:2273 msgid "Active graphics filter:" msgstr "Aktivn grafick filtr:" -#: backends/graphics/surfacesdl/surfacesdl-graphics.cpp:2300 +#: backends/graphics/surfacesdl/surfacesdl-graphics.cpp:2315 msgid "Windowed mode" msgstr "Reim do okna" -#: backends/graphics/opengl/opengl-graphics.cpp:118 +#: backends/graphics/opengl/opengl-graphics.cpp:119 msgid "OpenGL" msgstr "OpenGL" -#: backends/graphics/opengl/opengl-graphics.cpp:119 +#: backends/graphics/opengl/opengl-graphics.cpp:120 msgid "OpenGL (No filtering)" msgstr "OpenGL (bez filtrovn)" @@ -2221,13 +2234,13 @@ msgstr "" "nabdek." #: engines/agi/saveload.cpp:816 engines/drascula/saveload.cpp:349 -#: engines/dreamweb/saveload.cpp:169 engines/neverhood/menumodule.cpp:886 +#: engines/dreamweb/saveload.cpp:169 engines/neverhood/menumodule.cpp:890 #: engines/sci/engine/kfile.cpp:858 engines/toltecs/menu.cpp:256 msgid "Restore game:" msgstr "Obnovit hru" #: engines/agi/saveload.cpp:816 engines/drascula/saveload.cpp:349 -#: engines/dreamweb/saveload.cpp:169 engines/neverhood/menumodule.cpp:886 +#: engines/dreamweb/saveload.cpp:169 engines/neverhood/menumodule.cpp:890 #: engines/sci/engine/kfile.cpp:858 engines/toltecs/menu.cpp:256 msgid "Restore" msgstr "Obnovit" @@ -2772,36 +2785,36 @@ msgstr "~P~ msgid "~N~ext" msgstr "~D~al" -#: engines/scumm/dialogs.cpp:600 +#: engines/scumm/dialogs.cpp:602 msgid "Speech Only" msgstr "Pouze e" -#: engines/scumm/dialogs.cpp:601 +#: engines/scumm/dialogs.cpp:603 msgid "Speech and Subtitles" msgstr "e a Titulky" -#: engines/scumm/dialogs.cpp:602 +#: engines/scumm/dialogs.cpp:604 msgid "Subtitles Only" msgstr "Pouze Titulky" -#: engines/scumm/dialogs.cpp:610 +#: engines/scumm/dialogs.cpp:612 msgctxt "lowres" msgid "Speech & Subs" msgstr "e a Titulky" -#: engines/scumm/dialogs.cpp:656 +#: engines/scumm/dialogs.cpp:658 msgid "Select a Proficiency Level." msgstr "Vyberte rove odbornosti." -#: engines/scumm/dialogs.cpp:658 +#: engines/scumm/dialogs.cpp:660 msgid "Refer to your Loom(TM) manual for help." msgstr "Pro npovdu si pette manul Loom(TM)." -#: engines/scumm/dialogs.cpp:662 +#: engines/scumm/dialogs.cpp:664 msgid "Practice" msgstr "Cvien" -#: engines/scumm/dialogs.cpp:663 +#: engines/scumm/dialogs.cpp:665 msgid "Expert" msgstr "Pokroil" diff --git a/po/da_DA.po b/po/da_DA.po index 0da2db01f3..a78552ea8f 100644 --- a/po/da_DA.po +++ b/po/da_DA.po @@ -7,7 +7,7 @@ msgid "" msgstr "" "Project-Id-Version: ScummVM 1.3.0svn\n" "Report-Msgid-Bugs-To: scummvm-devel@lists.sf.net\n" -"POT-Creation-Date: 2015-10-11 18:59+0100\n" +"POT-Creation-Date: 2015-12-23 00:28+0000\n" "PO-Revision-Date: 2014-07-09 17:34+0100\n" "Last-Translator: Steffen Nyeland \n" "Language-Team: Steffen Nyeland \n" @@ -53,13 +53,13 @@ msgid "Go up" msgstr "G op" #: gui/browser.cpp:75 gui/chooser.cpp:46 gui/editrecorddialog.cpp:67 -#: gui/KeysDialog.cpp:43 gui/launcher.cpp:351 gui/massadd.cpp:95 -#: gui/options.cpp:1237 gui/predictivedialog.cpp:74 gui/recorderdialog.cpp:70 -#: gui/recorderdialog.cpp:156 gui/saveload-dialog.cpp:216 -#: gui/saveload-dialog.cpp:276 gui/saveload-dialog.cpp:547 -#: gui/saveload-dialog.cpp:931 gui/themebrowser.cpp:55 -#: gui/fluidsynth-dialog.cpp:152 engines/engine.cpp:483 -#: backends/platform/wii/options.cpp:48 +#: gui/filebrowser-dialog.cpp:64 gui/KeysDialog.cpp:43 gui/launcher.cpp:351 +#: gui/massadd.cpp:95 gui/options.cpp:1237 gui/predictivedialog.cpp:74 +#: gui/recorderdialog.cpp:70 gui/recorderdialog.cpp:156 +#: gui/saveload-dialog.cpp:216 gui/saveload-dialog.cpp:276 +#: gui/saveload-dialog.cpp:547 gui/saveload-dialog.cpp:931 +#: gui/themebrowser.cpp:55 gui/fluidsynth-dialog.cpp:152 +#: engines/engine.cpp:483 backends/platform/wii/options.cpp:48 #: backends/events/default/default-events.cpp:196 #: backends/events/default/default-events.cpp:218 #: engines/drascula/saveload.cpp:49 engines/parallaction/saveload.cpp:274 @@ -68,7 +68,7 @@ msgid "Cancel" msgstr "Fortryd" #: gui/browser.cpp:76 gui/browser_osx.mm:103 gui/chooser.cpp:47 -#: gui/themebrowser.cpp:56 +#: gui/filebrowser-dialog.cpp:65 gui/themebrowser.cpp:56 msgid "Choose" msgstr "Vlg" @@ -88,6 +88,39 @@ msgstr "" msgid "Ok" msgstr "" +#: gui/filebrowser-dialog.cpp:49 +msgid "Choose file for loading" +msgstr "" + +#: gui/filebrowser-dialog.cpp:49 +msgid "Enter filename for saving" +msgstr "" + +#: gui/filebrowser-dialog.cpp:132 +#, fuzzy +msgid "Do you really want to overwrite the file?" +msgstr "Vil du virkelig slette denne gemmer?" + +#: gui/filebrowser-dialog.cpp:132 gui/launcher.cpp:793 gui/launcher.cpp:941 +#: gui/launcher.cpp:1000 gui/fluidsynth-dialog.cpp:217 +#: backends/events/symbiansdl/symbiansdl-events.cpp:186 +#: backends/platform/wince/CEActionsPocket.cpp:326 +#: backends/platform/wince/CEActionsSmartphone.cpp:287 +#: backends/platform/wince/CELauncherDialog.cpp:83 +#: engines/kyra/saveload_eob.cpp:557 engines/kyra/saveload_eob.cpp:590 +msgid "Yes" +msgstr "Ja" + +#: gui/filebrowser-dialog.cpp:132 gui/launcher.cpp:793 gui/launcher.cpp:941 +#: gui/launcher.cpp:1000 gui/fluidsynth-dialog.cpp:217 +#: backends/events/symbiansdl/symbiansdl-events.cpp:186 +#: backends/platform/wince/CEActionsPocket.cpp:326 +#: backends/platform/wince/CEActionsSmartphone.cpp:287 +#: backends/platform/wince/CELauncherDialog.cpp:83 +#: engines/kyra/saveload_eob.cpp:557 engines/kyra/saveload_eob.cpp:590 +msgid "No" +msgstr "Nej" + #: gui/gui-manager.cpp:117 backends/keymapper/remap-dialog.cpp:53 #: engines/scumm/help.cpp:126 engines/scumm/help.cpp:141 #: engines/scumm/help.cpp:166 engines/scumm/help.cpp:192 @@ -385,7 +418,7 @@ msgstr "Dette spil ID er allerede i brug. V msgid "~Q~uit" msgstr "~A~fslut" -#: gui/launcher.cpp:626 backends/platform/sdl/macosx/appmenu_osx.mm:95 +#: gui/launcher.cpp:626 backends/platform/sdl/macosx/appmenu_osx.mm:106 msgid "Quit ScummVM" msgstr "Slut ScummVM" @@ -393,7 +426,7 @@ msgstr "Slut ScummVM" msgid "A~b~out..." msgstr "~O~m..." -#: gui/launcher.cpp:627 backends/platform/sdl/macosx/appmenu_osx.mm:69 +#: gui/launcher.cpp:627 backends/platform/sdl/macosx/appmenu_osx.mm:80 msgid "About ScummVM" msgstr "Om ScummVM" @@ -491,26 +524,6 @@ msgstr "" "Vil du virkelig kre fler spils detektoren? Dette kunne potentielt tilfje " "et stort antal spil." -#: gui/launcher.cpp:793 gui/launcher.cpp:941 gui/launcher.cpp:1000 -#: gui/fluidsynth-dialog.cpp:217 -#: backends/events/symbiansdl/symbiansdl-events.cpp:186 -#: backends/platform/wince/CEActionsPocket.cpp:326 -#: backends/platform/wince/CEActionsSmartphone.cpp:287 -#: backends/platform/wince/CELauncherDialog.cpp:83 -#: engines/kyra/saveload_eob.cpp:557 engines/kyra/saveload_eob.cpp:590 -msgid "Yes" -msgstr "Ja" - -#: gui/launcher.cpp:793 gui/launcher.cpp:941 gui/launcher.cpp:1000 -#: gui/fluidsynth-dialog.cpp:217 -#: backends/events/symbiansdl/symbiansdl-events.cpp:186 -#: backends/platform/wince/CEActionsPocket.cpp:326 -#: backends/platform/wince/CEActionsSmartphone.cpp:287 -#: backends/platform/wince/CELauncherDialog.cpp:83 -#: engines/kyra/saveload_eob.cpp:557 engines/kyra/saveload_eob.cpp:590 -msgid "No" -msgstr "Nej" - #: gui/launcher.cpp:841 msgid "ScummVM couldn't open the specified directory!" msgstr "ScummVM kunne ikke bne det angivne bibliotek!" @@ -664,7 +677,7 @@ msgid "Special dithering modes supported by some games" msgstr "Speciel farvereduceringstilstand understttet a nogle spil" #: gui/options.cpp:758 -#: backends/graphics/surfacesdl/surfacesdl-graphics.cpp:2298 +#: backends/graphics/surfacesdl/surfacesdl-graphics.cpp:2313 msgid "Fullscreen mode" msgstr "Fuldskrms tilstand" @@ -1125,7 +1138,7 @@ msgstr "Deaktiveret GFX" msgid "Standard Renderer" msgstr "Standard renderer" -#: gui/ThemeEngine.cpp:348 engines/scumm/dialogs.cpp:661 +#: gui/ThemeEngine.cpp:348 engines/scumm/dialogs.cpp:663 msgid "Standard" msgstr "Standard" @@ -1373,7 +1386,7 @@ msgstr "~R~etur til oversigt" #: engines/dialogs.cpp:116 engines/agi/saveload.cpp:803 #: engines/cruise/menu.cpp:212 engines/drascula/saveload.cpp:336 -#: engines/dreamweb/saveload.cpp:261 engines/neverhood/menumodule.cpp:873 +#: engines/dreamweb/saveload.cpp:261 engines/neverhood/menumodule.cpp:877 #: engines/pegasus/pegasus.cpp:377 engines/sci/engine/kfile.cpp:759 #: engines/toltecs/menu.cpp:281 engines/tsage/scenes.cpp:598 msgid "Save game:" @@ -1386,7 +1399,7 @@ msgstr "Gemmer:" #: backends/platform/wince/CEActionsSmartphone.cpp:231 #: engines/agi/saveload.cpp:803 engines/cruise/menu.cpp:212 #: engines/drascula/saveload.cpp:336 engines/dreamweb/saveload.cpp:261 -#: engines/neverhood/menumodule.cpp:873 engines/pegasus/pegasus.cpp:377 +#: engines/neverhood/menumodule.cpp:877 engines/pegasus/pegasus.cpp:377 #: engines/sci/engine/kfile.cpp:759 engines/scumm/dialogs.cpp:188 #: engines/toltecs/menu.cpp:281 engines/tsage/scenes.cpp:598 msgid "Save" @@ -1725,57 +1738,57 @@ msgstr "Miderste klik" msgid "Right Click" msgstr "Hjre klik" -#: backends/platform/sdl/macosx/appmenu_osx.mm:77 +#: backends/platform/sdl/macosx/appmenu_osx.mm:88 msgid "Hide ScummVM" msgstr "Skjul ScummVM" -#: backends/platform/sdl/macosx/appmenu_osx.mm:82 +#: backends/platform/sdl/macosx/appmenu_osx.mm:93 msgid "Hide Others" msgstr "Skjul andre" -#: backends/platform/sdl/macosx/appmenu_osx.mm:87 +#: backends/platform/sdl/macosx/appmenu_osx.mm:98 msgid "Show All" msgstr "Vis alle" -#: backends/platform/sdl/macosx/appmenu_osx.mm:109 #: backends/platform/sdl/macosx/appmenu_osx.mm:120 +#: backends/platform/sdl/macosx/appmenu_osx.mm:131 msgid "Window" msgstr "Vindue" -#: backends/platform/sdl/macosx/appmenu_osx.mm:114 +#: backends/platform/sdl/macosx/appmenu_osx.mm:125 msgid "Minimize" msgstr "Minimer" -#: backends/graphics/surfacesdl/surfacesdl-graphics.cpp:46 +#: backends/graphics/surfacesdl/surfacesdl-graphics.cpp:47 msgid "Normal (no scaling)" msgstr "Normal (ingen skalering)" -#: backends/graphics/surfacesdl/surfacesdl-graphics.cpp:65 +#: backends/graphics/surfacesdl/surfacesdl-graphics.cpp:66 msgctxt "lowres" msgid "Normal (no scaling)" msgstr "Normal (ingen skalering)" -#: backends/graphics/surfacesdl/surfacesdl-graphics.cpp:2197 +#: backends/graphics/surfacesdl/surfacesdl-graphics.cpp:2212 msgid "Enabled aspect ratio correction" msgstr "Aktivr billedformat korrektion" -#: backends/graphics/surfacesdl/surfacesdl-graphics.cpp:2203 +#: backends/graphics/surfacesdl/surfacesdl-graphics.cpp:2218 msgid "Disabled aspect ratio correction" msgstr "Deaktivr billedformat korrektion" -#: backends/graphics/surfacesdl/surfacesdl-graphics.cpp:2258 +#: backends/graphics/surfacesdl/surfacesdl-graphics.cpp:2273 msgid "Active graphics filter:" msgstr "Aktive grafik filtre:" -#: backends/graphics/surfacesdl/surfacesdl-graphics.cpp:2300 +#: backends/graphics/surfacesdl/surfacesdl-graphics.cpp:2315 msgid "Windowed mode" msgstr "Vindue tilstand" -#: backends/graphics/opengl/opengl-graphics.cpp:118 +#: backends/graphics/opengl/opengl-graphics.cpp:119 msgid "OpenGL" msgstr "OpenGL" -#: backends/graphics/opengl/opengl-graphics.cpp:119 +#: backends/graphics/opengl/opengl-graphics.cpp:120 msgid "OpenGL (No filtering)" msgstr "OpenGL (Ingen filtrering)" @@ -2218,13 +2231,13 @@ msgid "" msgstr "" #: engines/agi/saveload.cpp:816 engines/drascula/saveload.cpp:349 -#: engines/dreamweb/saveload.cpp:169 engines/neverhood/menumodule.cpp:886 +#: engines/dreamweb/saveload.cpp:169 engines/neverhood/menumodule.cpp:890 #: engines/sci/engine/kfile.cpp:858 engines/toltecs/menu.cpp:256 msgid "Restore game:" msgstr "Gendan spil:" #: engines/agi/saveload.cpp:816 engines/drascula/saveload.cpp:349 -#: engines/dreamweb/saveload.cpp:169 engines/neverhood/menumodule.cpp:886 +#: engines/dreamweb/saveload.cpp:169 engines/neverhood/menumodule.cpp:890 #: engines/sci/engine/kfile.cpp:858 engines/toltecs/menu.cpp:256 msgid "Restore" msgstr "Gendan" @@ -2762,36 +2775,36 @@ msgstr "Fo~r~rige" msgid "~N~ext" msgstr "~N~ste" -#: engines/scumm/dialogs.cpp:600 +#: engines/scumm/dialogs.cpp:602 msgid "Speech Only" msgstr "Kun tale" -#: engines/scumm/dialogs.cpp:601 +#: engines/scumm/dialogs.cpp:603 msgid "Speech and Subtitles" msgstr "Tale og Undertekster" -#: engines/scumm/dialogs.cpp:602 +#: engines/scumm/dialogs.cpp:604 msgid "Subtitles Only" msgstr "Kun undertekster" -#: engines/scumm/dialogs.cpp:610 +#: engines/scumm/dialogs.cpp:612 msgctxt "lowres" msgid "Speech & Subs" msgstr "Tale & Tekst" -#: engines/scumm/dialogs.cpp:656 +#: engines/scumm/dialogs.cpp:658 msgid "Select a Proficiency Level." msgstr "Vlg et Frdighedsniveau." -#: engines/scumm/dialogs.cpp:658 +#: engines/scumm/dialogs.cpp:660 msgid "Refer to your Loom(TM) manual for help." msgstr "Se din Loom(TM) manual for hjlp." -#: engines/scumm/dialogs.cpp:662 +#: engines/scumm/dialogs.cpp:664 msgid "Practice" msgstr "Trning" -#: engines/scumm/dialogs.cpp:663 +#: engines/scumm/dialogs.cpp:665 msgid "Expert" msgstr "Ekspert" diff --git a/po/de_DE.po b/po/de_DE.po index 60fd903be9..53a46373b3 100644 --- a/po/de_DE.po +++ b/po/de_DE.po @@ -7,7 +7,7 @@ msgid "" msgstr "" "Project-Id-Version: ScummVM 1.8.0git\n" "Report-Msgid-Bugs-To: scummvm-devel@lists.sf.net\n" -"POT-Creation-Date: 2015-10-11 18:59+0100\n" +"POT-Creation-Date: 2015-12-23 00:28+0000\n" "PO-Revision-Date: 2015-10-16 11:00+0200\n" "Last-Translator: Lothar Serra Mari \n" "Language-Team: Simon Sawatzki , Lothar Serra Mari " @@ -55,13 +55,13 @@ msgid "Go up" msgstr "Pfad hoch" #: gui/browser.cpp:75 gui/chooser.cpp:46 gui/editrecorddialog.cpp:67 -#: gui/KeysDialog.cpp:43 gui/launcher.cpp:351 gui/massadd.cpp:95 -#: gui/options.cpp:1237 gui/predictivedialog.cpp:74 gui/recorderdialog.cpp:70 -#: gui/recorderdialog.cpp:156 gui/saveload-dialog.cpp:216 -#: gui/saveload-dialog.cpp:276 gui/saveload-dialog.cpp:547 -#: gui/saveload-dialog.cpp:931 gui/themebrowser.cpp:55 -#: gui/fluidsynth-dialog.cpp:152 engines/engine.cpp:483 -#: backends/platform/wii/options.cpp:48 +#: gui/filebrowser-dialog.cpp:64 gui/KeysDialog.cpp:43 gui/launcher.cpp:351 +#: gui/massadd.cpp:95 gui/options.cpp:1237 gui/predictivedialog.cpp:74 +#: gui/recorderdialog.cpp:70 gui/recorderdialog.cpp:156 +#: gui/saveload-dialog.cpp:216 gui/saveload-dialog.cpp:276 +#: gui/saveload-dialog.cpp:547 gui/saveload-dialog.cpp:931 +#: gui/themebrowser.cpp:55 gui/fluidsynth-dialog.cpp:152 +#: engines/engine.cpp:483 backends/platform/wii/options.cpp:48 #: backends/events/default/default-events.cpp:196 #: backends/events/default/default-events.cpp:218 #: engines/drascula/saveload.cpp:49 engines/parallaction/saveload.cpp:274 @@ -70,7 +70,7 @@ msgid "Cancel" msgstr "Abbrechen" #: gui/browser.cpp:76 gui/browser_osx.mm:103 gui/chooser.cpp:47 -#: gui/themebrowser.cpp:56 +#: gui/filebrowser-dialog.cpp:65 gui/themebrowser.cpp:56 msgid "Choose" msgstr "Auswhlen" @@ -90,6 +90,39 @@ msgstr "Notizen:" msgid "Ok" msgstr "OK" +#: gui/filebrowser-dialog.cpp:49 +msgid "Choose file for loading" +msgstr "" + +#: gui/filebrowser-dialog.cpp:49 +msgid "Enter filename for saving" +msgstr "" + +#: gui/filebrowser-dialog.cpp:132 +#, fuzzy +msgid "Do you really want to overwrite the file?" +msgstr "Mchten Sie diese Aufnahme wirklich lschen?" + +#: gui/filebrowser-dialog.cpp:132 gui/launcher.cpp:793 gui/launcher.cpp:941 +#: gui/launcher.cpp:1000 gui/fluidsynth-dialog.cpp:217 +#: backends/events/symbiansdl/symbiansdl-events.cpp:186 +#: backends/platform/wince/CEActionsPocket.cpp:326 +#: backends/platform/wince/CEActionsSmartphone.cpp:287 +#: backends/platform/wince/CELauncherDialog.cpp:83 +#: engines/kyra/saveload_eob.cpp:557 engines/kyra/saveload_eob.cpp:590 +msgid "Yes" +msgstr "Ja" + +#: gui/filebrowser-dialog.cpp:132 gui/launcher.cpp:793 gui/launcher.cpp:941 +#: gui/launcher.cpp:1000 gui/fluidsynth-dialog.cpp:217 +#: backends/events/symbiansdl/symbiansdl-events.cpp:186 +#: backends/platform/wince/CEActionsPocket.cpp:326 +#: backends/platform/wince/CEActionsSmartphone.cpp:287 +#: backends/platform/wince/CELauncherDialog.cpp:83 +#: engines/kyra/saveload_eob.cpp:557 engines/kyra/saveload_eob.cpp:590 +msgid "No" +msgstr "Nein" + #: gui/gui-manager.cpp:117 backends/keymapper/remap-dialog.cpp:53 #: engines/scumm/help.cpp:126 engines/scumm/help.cpp:141 #: engines/scumm/help.cpp:166 engines/scumm/help.cpp:192 @@ -387,7 +420,7 @@ msgstr "Diese Spielkennung ist schon vergeben. Bitte eine andere w msgid "~Q~uit" msgstr "~B~eenden" -#: gui/launcher.cpp:626 backends/platform/sdl/macosx/appmenu_osx.mm:95 +#: gui/launcher.cpp:626 backends/platform/sdl/macosx/appmenu_osx.mm:106 msgid "Quit ScummVM" msgstr "ScummVM beenden" @@ -395,7 +428,7 @@ msgstr "ScummVM beenden" msgid "A~b~out..." msgstr "be~r~" -#: gui/launcher.cpp:627 backends/platform/sdl/macosx/appmenu_osx.mm:69 +#: gui/launcher.cpp:627 backends/platform/sdl/macosx/appmenu_osx.mm:80 msgid "About ScummVM" msgstr "ber ScummVM" @@ -495,26 +528,6 @@ msgstr "" "Mchten Sie wirklich den PC nach Spielen durchsuchen? Mglicherweise wird " "dabei eine grere Menge an Spielen hinzugefgt." -#: gui/launcher.cpp:793 gui/launcher.cpp:941 gui/launcher.cpp:1000 -#: gui/fluidsynth-dialog.cpp:217 -#: backends/events/symbiansdl/symbiansdl-events.cpp:186 -#: backends/platform/wince/CEActionsPocket.cpp:326 -#: backends/platform/wince/CEActionsSmartphone.cpp:287 -#: backends/platform/wince/CELauncherDialog.cpp:83 -#: engines/kyra/saveload_eob.cpp:557 engines/kyra/saveload_eob.cpp:590 -msgid "Yes" -msgstr "Ja" - -#: gui/launcher.cpp:793 gui/launcher.cpp:941 gui/launcher.cpp:1000 -#: gui/fluidsynth-dialog.cpp:217 -#: backends/events/symbiansdl/symbiansdl-events.cpp:186 -#: backends/platform/wince/CEActionsPocket.cpp:326 -#: backends/platform/wince/CEActionsSmartphone.cpp:287 -#: backends/platform/wince/CELauncherDialog.cpp:83 -#: engines/kyra/saveload_eob.cpp:557 engines/kyra/saveload_eob.cpp:590 -msgid "No" -msgstr "Nein" - #: gui/launcher.cpp:841 msgid "ScummVM couldn't open the specified directory!" msgstr "ScummVM konnte das gewhlte Verzeichnis nicht ffnen!" @@ -668,7 +681,7 @@ msgstr "" "Spezielle Farbmischungsmethoden werden von manchen Spielen untersttzt." #: gui/options.cpp:758 -#: backends/graphics/surfacesdl/surfacesdl-graphics.cpp:2298 +#: backends/graphics/surfacesdl/surfacesdl-graphics.cpp:2313 msgid "Fullscreen mode" msgstr "Vollbildmodus" @@ -1136,7 +1149,7 @@ msgstr "GFX ausgeschaltet" msgid "Standard Renderer" msgstr "Standard-Renderer" -#: gui/ThemeEngine.cpp:348 engines/scumm/dialogs.cpp:661 +#: gui/ThemeEngine.cpp:348 engines/scumm/dialogs.cpp:663 msgid "Standard" msgstr "Standard" @@ -1387,7 +1400,7 @@ msgstr "Zur Spiele~l~iste" #: engines/dialogs.cpp:116 engines/agi/saveload.cpp:803 #: engines/cruise/menu.cpp:212 engines/drascula/saveload.cpp:336 -#: engines/dreamweb/saveload.cpp:261 engines/neverhood/menumodule.cpp:873 +#: engines/dreamweb/saveload.cpp:261 engines/neverhood/menumodule.cpp:877 #: engines/pegasus/pegasus.cpp:377 engines/sci/engine/kfile.cpp:759 #: engines/toltecs/menu.cpp:281 engines/tsage/scenes.cpp:598 msgid "Save game:" @@ -1400,7 +1413,7 @@ msgstr "Speichern:" #: backends/platform/wince/CEActionsSmartphone.cpp:231 #: engines/agi/saveload.cpp:803 engines/cruise/menu.cpp:212 #: engines/drascula/saveload.cpp:336 engines/dreamweb/saveload.cpp:261 -#: engines/neverhood/menumodule.cpp:873 engines/pegasus/pegasus.cpp:377 +#: engines/neverhood/menumodule.cpp:877 engines/pegasus/pegasus.cpp:377 #: engines/sci/engine/kfile.cpp:759 engines/scumm/dialogs.cpp:188 #: engines/toltecs/menu.cpp:281 engines/tsage/scenes.cpp:598 msgid "Save" @@ -1742,57 +1755,57 @@ msgstr "Mittelklick" msgid "Right Click" msgstr "Rechtsklick" -#: backends/platform/sdl/macosx/appmenu_osx.mm:77 +#: backends/platform/sdl/macosx/appmenu_osx.mm:88 msgid "Hide ScummVM" msgstr "ScummVM ausblenden" -#: backends/platform/sdl/macosx/appmenu_osx.mm:82 +#: backends/platform/sdl/macosx/appmenu_osx.mm:93 msgid "Hide Others" msgstr "Andere ausblenden" -#: backends/platform/sdl/macosx/appmenu_osx.mm:87 +#: backends/platform/sdl/macosx/appmenu_osx.mm:98 msgid "Show All" msgstr "Alle einblenden" -#: backends/platform/sdl/macosx/appmenu_osx.mm:109 #: backends/platform/sdl/macosx/appmenu_osx.mm:120 +#: backends/platform/sdl/macosx/appmenu_osx.mm:131 msgid "Window" msgstr "Fenster" -#: backends/platform/sdl/macosx/appmenu_osx.mm:114 +#: backends/platform/sdl/macosx/appmenu_osx.mm:125 msgid "Minimize" msgstr "Minimieren" -#: backends/graphics/surfacesdl/surfacesdl-graphics.cpp:46 +#: backends/graphics/surfacesdl/surfacesdl-graphics.cpp:47 msgid "Normal (no scaling)" msgstr "Normal (keine Skalierung)" -#: backends/graphics/surfacesdl/surfacesdl-graphics.cpp:65 +#: backends/graphics/surfacesdl/surfacesdl-graphics.cpp:66 msgctxt "lowres" msgid "Normal (no scaling)" msgstr "Normal ohn.Skalieren" -#: backends/graphics/surfacesdl/surfacesdl-graphics.cpp:2197 +#: backends/graphics/surfacesdl/surfacesdl-graphics.cpp:2212 msgid "Enabled aspect ratio correction" msgstr "Seitenverhltniskorrektur an" -#: backends/graphics/surfacesdl/surfacesdl-graphics.cpp:2203 +#: backends/graphics/surfacesdl/surfacesdl-graphics.cpp:2218 msgid "Disabled aspect ratio correction" msgstr "Seitenverhltniskorrektur aus" -#: backends/graphics/surfacesdl/surfacesdl-graphics.cpp:2258 +#: backends/graphics/surfacesdl/surfacesdl-graphics.cpp:2273 msgid "Active graphics filter:" msgstr "Aktiver Grafikfilter:" -#: backends/graphics/surfacesdl/surfacesdl-graphics.cpp:2300 +#: backends/graphics/surfacesdl/surfacesdl-graphics.cpp:2315 msgid "Windowed mode" msgstr "Fenstermodus" -#: backends/graphics/opengl/opengl-graphics.cpp:118 +#: backends/graphics/opengl/opengl-graphics.cpp:119 msgid "OpenGL" msgstr "OpenGL" -#: backends/graphics/opengl/opengl-graphics.cpp:119 +#: backends/graphics/opengl/opengl-graphics.cpp:120 msgid "OpenGL (No filtering)" msgstr "OpenGL (ohne Filter)" @@ -1842,8 +1855,9 @@ msgstr "Schneller Modus" #: backends/platform/symbian/src/SymbianActions.cpp:52 #: backends/platform/wince/CEActionsPocket.cpp:44 #: backends/platform/wince/CEActionsSmartphone.cpp:52 -#: backends/events/default/default-events.cpp:218 engines/scumm/dialogs.cpp:192 -#: engines/scumm/help.cpp:83 engines/scumm/help.cpp:85 +#: backends/events/default/default-events.cpp:218 +#: engines/scumm/dialogs.cpp:192 engines/scumm/help.cpp:83 +#: engines/scumm/help.cpp:85 msgid "Quit" msgstr "Beenden" @@ -2238,13 +2252,13 @@ msgstr "" "und in Mens innerhalb des Spiels." #: engines/agi/saveload.cpp:816 engines/drascula/saveload.cpp:349 -#: engines/dreamweb/saveload.cpp:169 engines/neverhood/menumodule.cpp:886 +#: engines/dreamweb/saveload.cpp:169 engines/neverhood/menumodule.cpp:890 #: engines/sci/engine/kfile.cpp:858 engines/toltecs/menu.cpp:256 msgid "Restore game:" msgstr "Spiel laden:" #: engines/agi/saveload.cpp:816 engines/drascula/saveload.cpp:349 -#: engines/dreamweb/saveload.cpp:169 engines/neverhood/menumodule.cpp:886 +#: engines/dreamweb/saveload.cpp:169 engines/neverhood/menumodule.cpp:890 #: engines/sci/engine/kfile.cpp:858 engines/toltecs/menu.cpp:256 msgid "Restore" msgstr "Laden" @@ -2804,36 +2818,36 @@ msgstr "~Z~ur msgid "~N~ext" msgstr "~W~eiter" -#: engines/scumm/dialogs.cpp:600 +#: engines/scumm/dialogs.cpp:602 msgid "Speech Only" msgstr "Nur Sprache" -#: engines/scumm/dialogs.cpp:601 +#: engines/scumm/dialogs.cpp:603 msgid "Speech and Subtitles" msgstr "Sprachausgabe und Untertitel" -#: engines/scumm/dialogs.cpp:602 +#: engines/scumm/dialogs.cpp:604 msgid "Subtitles Only" msgstr "Nur Untertitel" -#: engines/scumm/dialogs.cpp:610 +#: engines/scumm/dialogs.cpp:612 msgctxt "lowres" msgid "Speech & Subs" msgstr "Sprache & Text" -#: engines/scumm/dialogs.cpp:656 +#: engines/scumm/dialogs.cpp:658 msgid "Select a Proficiency Level." msgstr "Whle einen Schwierigkeitsgrad." -#: engines/scumm/dialogs.cpp:658 +#: engines/scumm/dialogs.cpp:660 msgid "Refer to your Loom(TM) manual for help." msgstr "Fr Hilfe schauen Sie ins Loom-Handbuch." -#: engines/scumm/dialogs.cpp:662 +#: engines/scumm/dialogs.cpp:664 msgid "Practice" msgstr "Anfnger" -#: engines/scumm/dialogs.cpp:663 +#: engines/scumm/dialogs.cpp:665 msgid "Expert" msgstr "Experte" diff --git a/po/es_ES.po b/po/es_ES.po index 9d2e236d46..87f165d03f 100644 --- a/po/es_ES.po +++ b/po/es_ES.po @@ -7,7 +7,7 @@ msgid "" msgstr "" "Project-Id-Version: ScummVM 1.4.0svn\n" "Report-Msgid-Bugs-To: scummvm-devel@lists.sf.net\n" -"POT-Creation-Date: 2015-10-11 18:59+0100\n" +"POT-Creation-Date: 2015-12-23 00:28+0000\n" "PO-Revision-Date: 2014-07-06 20:39+0100\n" "Last-Translator: \n" "Language-Team: \n" @@ -52,13 +52,13 @@ msgid "Go up" msgstr "Arriba" #: gui/browser.cpp:75 gui/chooser.cpp:46 gui/editrecorddialog.cpp:67 -#: gui/KeysDialog.cpp:43 gui/launcher.cpp:351 gui/massadd.cpp:95 -#: gui/options.cpp:1237 gui/predictivedialog.cpp:74 gui/recorderdialog.cpp:70 -#: gui/recorderdialog.cpp:156 gui/saveload-dialog.cpp:216 -#: gui/saveload-dialog.cpp:276 gui/saveload-dialog.cpp:547 -#: gui/saveload-dialog.cpp:931 gui/themebrowser.cpp:55 -#: gui/fluidsynth-dialog.cpp:152 engines/engine.cpp:483 -#: backends/platform/wii/options.cpp:48 +#: gui/filebrowser-dialog.cpp:64 gui/KeysDialog.cpp:43 gui/launcher.cpp:351 +#: gui/massadd.cpp:95 gui/options.cpp:1237 gui/predictivedialog.cpp:74 +#: gui/recorderdialog.cpp:70 gui/recorderdialog.cpp:156 +#: gui/saveload-dialog.cpp:216 gui/saveload-dialog.cpp:276 +#: gui/saveload-dialog.cpp:547 gui/saveload-dialog.cpp:931 +#: gui/themebrowser.cpp:55 gui/fluidsynth-dialog.cpp:152 +#: engines/engine.cpp:483 backends/platform/wii/options.cpp:48 #: backends/events/default/default-events.cpp:196 #: backends/events/default/default-events.cpp:218 #: engines/drascula/saveload.cpp:49 engines/parallaction/saveload.cpp:274 @@ -67,7 +67,7 @@ msgid "Cancel" msgstr "Cancelar" #: gui/browser.cpp:76 gui/browser_osx.mm:103 gui/chooser.cpp:47 -#: gui/themebrowser.cpp:56 +#: gui/filebrowser-dialog.cpp:65 gui/themebrowser.cpp:56 msgid "Choose" msgstr "Aceptar" @@ -87,6 +87,39 @@ msgstr "" msgid "Ok" msgstr "" +#: gui/filebrowser-dialog.cpp:49 +msgid "Choose file for loading" +msgstr "" + +#: gui/filebrowser-dialog.cpp:49 +msgid "Enter filename for saving" +msgstr "" + +#: gui/filebrowser-dialog.cpp:132 +#, fuzzy +msgid "Do you really want to overwrite the file?" +msgstr "Seguro que quieres borrar esta partida?" + +#: gui/filebrowser-dialog.cpp:132 gui/launcher.cpp:793 gui/launcher.cpp:941 +#: gui/launcher.cpp:1000 gui/fluidsynth-dialog.cpp:217 +#: backends/events/symbiansdl/symbiansdl-events.cpp:186 +#: backends/platform/wince/CEActionsPocket.cpp:326 +#: backends/platform/wince/CEActionsSmartphone.cpp:287 +#: backends/platform/wince/CELauncherDialog.cpp:83 +#: engines/kyra/saveload_eob.cpp:557 engines/kyra/saveload_eob.cpp:590 +msgid "Yes" +msgstr "S" + +#: gui/filebrowser-dialog.cpp:132 gui/launcher.cpp:793 gui/launcher.cpp:941 +#: gui/launcher.cpp:1000 gui/fluidsynth-dialog.cpp:217 +#: backends/events/symbiansdl/symbiansdl-events.cpp:186 +#: backends/platform/wince/CEActionsPocket.cpp:326 +#: backends/platform/wince/CEActionsSmartphone.cpp:287 +#: backends/platform/wince/CELauncherDialog.cpp:83 +#: engines/kyra/saveload_eob.cpp:557 engines/kyra/saveload_eob.cpp:590 +msgid "No" +msgstr "No" + #: gui/gui-manager.cpp:117 backends/keymapper/remap-dialog.cpp:53 #: engines/scumm/help.cpp:126 engines/scumm/help.cpp:141 #: engines/scumm/help.cpp:166 engines/scumm/help.cpp:192 @@ -384,7 +417,7 @@ msgstr "Esta ID ya est msgid "~Q~uit" msgstr "~S~alir" -#: gui/launcher.cpp:626 backends/platform/sdl/macosx/appmenu_osx.mm:95 +#: gui/launcher.cpp:626 backends/platform/sdl/macosx/appmenu_osx.mm:106 msgid "Quit ScummVM" msgstr "Salir de ScummVM" @@ -392,7 +425,7 @@ msgstr "Salir de ScummVM" msgid "A~b~out..." msgstr "Acerca ~d~e" -#: gui/launcher.cpp:627 backends/platform/sdl/macosx/appmenu_osx.mm:69 +#: gui/launcher.cpp:627 backends/platform/sdl/macosx/appmenu_osx.mm:80 msgid "About ScummVM" msgstr "Acerca de ScummVM" @@ -490,26 +523,6 @@ msgstr "" "Seguro que quieres ejecutar la deteccin masiva? Puede que se aada un gran " "nmero de juegos." -#: gui/launcher.cpp:793 gui/launcher.cpp:941 gui/launcher.cpp:1000 -#: gui/fluidsynth-dialog.cpp:217 -#: backends/events/symbiansdl/symbiansdl-events.cpp:186 -#: backends/platform/wince/CEActionsPocket.cpp:326 -#: backends/platform/wince/CEActionsSmartphone.cpp:287 -#: backends/platform/wince/CELauncherDialog.cpp:83 -#: engines/kyra/saveload_eob.cpp:557 engines/kyra/saveload_eob.cpp:590 -msgid "Yes" -msgstr "S" - -#: gui/launcher.cpp:793 gui/launcher.cpp:941 gui/launcher.cpp:1000 -#: gui/fluidsynth-dialog.cpp:217 -#: backends/events/symbiansdl/symbiansdl-events.cpp:186 -#: backends/platform/wince/CEActionsPocket.cpp:326 -#: backends/platform/wince/CEActionsSmartphone.cpp:287 -#: backends/platform/wince/CELauncherDialog.cpp:83 -#: engines/kyra/saveload_eob.cpp:557 engines/kyra/saveload_eob.cpp:590 -msgid "No" -msgstr "No" - #: gui/launcher.cpp:841 msgid "ScummVM couldn't open the specified directory!" msgstr "ScummVM no ha podido abrir el directorio!" @@ -663,7 +676,7 @@ msgid "Special dithering modes supported by some games" msgstr "Modos especiales de expansin compatibles con algunos juegos" #: gui/options.cpp:758 -#: backends/graphics/surfacesdl/surfacesdl-graphics.cpp:2298 +#: backends/graphics/surfacesdl/surfacesdl-graphics.cpp:2313 msgid "Fullscreen mode" msgstr "Pantalla completa" @@ -1132,7 +1145,7 @@ msgstr "Gr msgid "Standard Renderer" msgstr "Estndar" -#: gui/ThemeEngine.cpp:348 engines/scumm/dialogs.cpp:661 +#: gui/ThemeEngine.cpp:348 engines/scumm/dialogs.cpp:663 msgid "Standard" msgstr "Estndar" @@ -1379,7 +1392,7 @@ msgstr "~V~olver al lanzador" #: engines/dialogs.cpp:116 engines/agi/saveload.cpp:803 #: engines/cruise/menu.cpp:212 engines/drascula/saveload.cpp:336 -#: engines/dreamweb/saveload.cpp:261 engines/neverhood/menumodule.cpp:873 +#: engines/dreamweb/saveload.cpp:261 engines/neverhood/menumodule.cpp:877 #: engines/pegasus/pegasus.cpp:377 engines/sci/engine/kfile.cpp:759 #: engines/toltecs/menu.cpp:281 engines/tsage/scenes.cpp:598 msgid "Save game:" @@ -1392,7 +1405,7 @@ msgstr "Guardar partida" #: backends/platform/wince/CEActionsSmartphone.cpp:231 #: engines/agi/saveload.cpp:803 engines/cruise/menu.cpp:212 #: engines/drascula/saveload.cpp:336 engines/dreamweb/saveload.cpp:261 -#: engines/neverhood/menumodule.cpp:873 engines/pegasus/pegasus.cpp:377 +#: engines/neverhood/menumodule.cpp:877 engines/pegasus/pegasus.cpp:377 #: engines/sci/engine/kfile.cpp:759 engines/scumm/dialogs.cpp:188 #: engines/toltecs/menu.cpp:281 engines/tsage/scenes.cpp:598 msgid "Save" @@ -1733,57 +1746,57 @@ msgstr "Clic central" msgid "Right Click" msgstr "Clic derecho" -#: backends/platform/sdl/macosx/appmenu_osx.mm:77 +#: backends/platform/sdl/macosx/appmenu_osx.mm:88 msgid "Hide ScummVM" msgstr "Ocultar ScummVM" -#: backends/platform/sdl/macosx/appmenu_osx.mm:82 +#: backends/platform/sdl/macosx/appmenu_osx.mm:93 msgid "Hide Others" msgstr "Ocultar otros" -#: backends/platform/sdl/macosx/appmenu_osx.mm:87 +#: backends/platform/sdl/macosx/appmenu_osx.mm:98 msgid "Show All" msgstr "Mostrar todo" -#: backends/platform/sdl/macosx/appmenu_osx.mm:109 #: backends/platform/sdl/macosx/appmenu_osx.mm:120 +#: backends/platform/sdl/macosx/appmenu_osx.mm:131 msgid "Window" msgstr "Ventana" -#: backends/platform/sdl/macosx/appmenu_osx.mm:114 +#: backends/platform/sdl/macosx/appmenu_osx.mm:125 msgid "Minimize" msgstr "Minimizar" -#: backends/graphics/surfacesdl/surfacesdl-graphics.cpp:46 +#: backends/graphics/surfacesdl/surfacesdl-graphics.cpp:47 msgid "Normal (no scaling)" msgstr "Normal (sin reescalado)" -#: backends/graphics/surfacesdl/surfacesdl-graphics.cpp:65 +#: backends/graphics/surfacesdl/surfacesdl-graphics.cpp:66 msgctxt "lowres" msgid "Normal (no scaling)" msgstr "Normal" -#: backends/graphics/surfacesdl/surfacesdl-graphics.cpp:2197 +#: backends/graphics/surfacesdl/surfacesdl-graphics.cpp:2212 msgid "Enabled aspect ratio correction" msgstr "Activar la correccin de aspecto" -#: backends/graphics/surfacesdl/surfacesdl-graphics.cpp:2203 +#: backends/graphics/surfacesdl/surfacesdl-graphics.cpp:2218 msgid "Disabled aspect ratio correction" msgstr "Desactivar la correccin de aspecto" -#: backends/graphics/surfacesdl/surfacesdl-graphics.cpp:2258 +#: backends/graphics/surfacesdl/surfacesdl-graphics.cpp:2273 msgid "Active graphics filter:" msgstr "Filtro de grficos activo:" -#: backends/graphics/surfacesdl/surfacesdl-graphics.cpp:2300 +#: backends/graphics/surfacesdl/surfacesdl-graphics.cpp:2315 msgid "Windowed mode" msgstr "Modo ventana" -#: backends/graphics/opengl/opengl-graphics.cpp:118 +#: backends/graphics/opengl/opengl-graphics.cpp:119 msgid "OpenGL" msgstr "OpenGL" -#: backends/graphics/opengl/opengl-graphics.cpp:119 +#: backends/graphics/opengl/opengl-graphics.cpp:120 msgid "OpenGL (No filtering)" msgstr "OpenGL (sin filtros)" @@ -2228,13 +2241,13 @@ msgid "" msgstr "" #: engines/agi/saveload.cpp:816 engines/drascula/saveload.cpp:349 -#: engines/dreamweb/saveload.cpp:169 engines/neverhood/menumodule.cpp:886 +#: engines/dreamweb/saveload.cpp:169 engines/neverhood/menumodule.cpp:890 #: engines/sci/engine/kfile.cpp:858 engines/toltecs/menu.cpp:256 msgid "Restore game:" msgstr "Cargar partida:" #: engines/agi/saveload.cpp:816 engines/drascula/saveload.cpp:349 -#: engines/dreamweb/saveload.cpp:169 engines/neverhood/menumodule.cpp:886 +#: engines/dreamweb/saveload.cpp:169 engines/neverhood/menumodule.cpp:890 #: engines/sci/engine/kfile.cpp:858 engines/toltecs/menu.cpp:256 msgid "Restore" msgstr "Cargar" @@ -2774,36 +2787,36 @@ msgstr "~A~nterior" msgid "~N~ext" msgstr "Si~g~uiente" -#: engines/scumm/dialogs.cpp:600 +#: engines/scumm/dialogs.cpp:602 msgid "Speech Only" msgstr "Solo voces" -#: engines/scumm/dialogs.cpp:601 +#: engines/scumm/dialogs.cpp:603 msgid "Speech and Subtitles" msgstr "Voces y subttulos" -#: engines/scumm/dialogs.cpp:602 +#: engines/scumm/dialogs.cpp:604 msgid "Subtitles Only" msgstr "Solo subttulos" -#: engines/scumm/dialogs.cpp:610 +#: engines/scumm/dialogs.cpp:612 msgctxt "lowres" msgid "Speech & Subs" msgstr "Voces y sub." -#: engines/scumm/dialogs.cpp:656 +#: engines/scumm/dialogs.cpp:658 msgid "Select a Proficiency Level." msgstr "Selecciona un nivel de dificultad." -#: engines/scumm/dialogs.cpp:658 +#: engines/scumm/dialogs.cpp:660 msgid "Refer to your Loom(TM) manual for help." msgstr "Consulta el manual para obtener ms informacin." -#: engines/scumm/dialogs.cpp:662 +#: engines/scumm/dialogs.cpp:664 msgid "Practice" msgstr "Prctica" -#: engines/scumm/dialogs.cpp:663 +#: engines/scumm/dialogs.cpp:665 msgid "Expert" msgstr "Experto" diff --git a/po/eu.po b/po/eu.po index 97e13810e5..dcaa1f296d 100644 --- a/po/eu.po +++ b/po/eu.po @@ -7,7 +7,7 @@ msgid "" msgstr "" "Project-Id-Version: ScummVM 1.5.0git\n" "Report-Msgid-Bugs-To: scummvm-devel@lists.sf.net\n" -"POT-Creation-Date: 2015-10-11 18:59+0100\n" +"POT-Creation-Date: 2015-12-23 00:28+0000\n" "PO-Revision-Date: 2011-12-15 14:53+0100\n" "Last-Translator: Mikel Iturbe Urretxa \n" "Language-Team: Librezale \n" @@ -52,13 +52,13 @@ msgid "Go up" msgstr "Joan gora" #: gui/browser.cpp:75 gui/chooser.cpp:46 gui/editrecorddialog.cpp:67 -#: gui/KeysDialog.cpp:43 gui/launcher.cpp:351 gui/massadd.cpp:95 -#: gui/options.cpp:1237 gui/predictivedialog.cpp:74 gui/recorderdialog.cpp:70 -#: gui/recorderdialog.cpp:156 gui/saveload-dialog.cpp:216 -#: gui/saveload-dialog.cpp:276 gui/saveload-dialog.cpp:547 -#: gui/saveload-dialog.cpp:931 gui/themebrowser.cpp:55 -#: gui/fluidsynth-dialog.cpp:152 engines/engine.cpp:483 -#: backends/platform/wii/options.cpp:48 +#: gui/filebrowser-dialog.cpp:64 gui/KeysDialog.cpp:43 gui/launcher.cpp:351 +#: gui/massadd.cpp:95 gui/options.cpp:1237 gui/predictivedialog.cpp:74 +#: gui/recorderdialog.cpp:70 gui/recorderdialog.cpp:156 +#: gui/saveload-dialog.cpp:216 gui/saveload-dialog.cpp:276 +#: gui/saveload-dialog.cpp:547 gui/saveload-dialog.cpp:931 +#: gui/themebrowser.cpp:55 gui/fluidsynth-dialog.cpp:152 +#: engines/engine.cpp:483 backends/platform/wii/options.cpp:48 #: backends/events/default/default-events.cpp:196 #: backends/events/default/default-events.cpp:218 #: engines/drascula/saveload.cpp:49 engines/parallaction/saveload.cpp:274 @@ -67,7 +67,7 @@ msgid "Cancel" msgstr "Utzi" #: gui/browser.cpp:76 gui/browser_osx.mm:103 gui/chooser.cpp:47 -#: gui/themebrowser.cpp:56 +#: gui/filebrowser-dialog.cpp:65 gui/themebrowser.cpp:56 msgid "Choose" msgstr "Aukeratu" @@ -87,6 +87,39 @@ msgstr "" msgid "Ok" msgstr "" +#: gui/filebrowser-dialog.cpp:49 +msgid "Choose file for loading" +msgstr "" + +#: gui/filebrowser-dialog.cpp:49 +msgid "Enter filename for saving" +msgstr "" + +#: gui/filebrowser-dialog.cpp:132 +#, fuzzy +msgid "Do you really want to overwrite the file?" +msgstr "Ezabatu partida gorde hau?" + +#: gui/filebrowser-dialog.cpp:132 gui/launcher.cpp:793 gui/launcher.cpp:941 +#: gui/launcher.cpp:1000 gui/fluidsynth-dialog.cpp:217 +#: backends/events/symbiansdl/symbiansdl-events.cpp:186 +#: backends/platform/wince/CEActionsPocket.cpp:326 +#: backends/platform/wince/CEActionsSmartphone.cpp:287 +#: backends/platform/wince/CELauncherDialog.cpp:83 +#: engines/kyra/saveload_eob.cpp:557 engines/kyra/saveload_eob.cpp:590 +msgid "Yes" +msgstr "Bai" + +#: gui/filebrowser-dialog.cpp:132 gui/launcher.cpp:793 gui/launcher.cpp:941 +#: gui/launcher.cpp:1000 gui/fluidsynth-dialog.cpp:217 +#: backends/events/symbiansdl/symbiansdl-events.cpp:186 +#: backends/platform/wince/CEActionsPocket.cpp:326 +#: backends/platform/wince/CEActionsSmartphone.cpp:287 +#: backends/platform/wince/CELauncherDialog.cpp:83 +#: engines/kyra/saveload_eob.cpp:557 engines/kyra/saveload_eob.cpp:590 +msgid "No" +msgstr "Ez" + #: gui/gui-manager.cpp:117 backends/keymapper/remap-dialog.cpp:53 #: engines/scumm/help.cpp:126 engines/scumm/help.cpp:141 #: engines/scumm/help.cpp:166 engines/scumm/help.cpp:192 @@ -384,7 +417,7 @@ msgstr "ID hau jada erabilia izaten ari da. Mesedez, aukeratu beste bat." msgid "~Q~uit" msgstr "~I~rten" -#: gui/launcher.cpp:626 backends/platform/sdl/macosx/appmenu_osx.mm:95 +#: gui/launcher.cpp:626 backends/platform/sdl/macosx/appmenu_osx.mm:106 msgid "Quit ScummVM" msgstr "Irten ScummVM-tik" @@ -392,7 +425,7 @@ msgstr "Irten ScummVM-tik" msgid "A~b~out..." msgstr "Ho~n~i buruz..." -#: gui/launcher.cpp:627 backends/platform/sdl/macosx/appmenu_osx.mm:69 +#: gui/launcher.cpp:627 backends/platform/sdl/macosx/appmenu_osx.mm:80 msgid "About ScummVM" msgstr "ScummVM-i buruz" @@ -490,26 +523,6 @@ msgstr "" "Joko detektatzaile masiboa exekutatu nahi al duzu? Honek joko kantitate " "handia gehitu dezake." -#: gui/launcher.cpp:793 gui/launcher.cpp:941 gui/launcher.cpp:1000 -#: gui/fluidsynth-dialog.cpp:217 -#: backends/events/symbiansdl/symbiansdl-events.cpp:186 -#: backends/platform/wince/CEActionsPocket.cpp:326 -#: backends/platform/wince/CEActionsSmartphone.cpp:287 -#: backends/platform/wince/CELauncherDialog.cpp:83 -#: engines/kyra/saveload_eob.cpp:557 engines/kyra/saveload_eob.cpp:590 -msgid "Yes" -msgstr "Bai" - -#: gui/launcher.cpp:793 gui/launcher.cpp:941 gui/launcher.cpp:1000 -#: gui/fluidsynth-dialog.cpp:217 -#: backends/events/symbiansdl/symbiansdl-events.cpp:186 -#: backends/platform/wince/CEActionsPocket.cpp:326 -#: backends/platform/wince/CEActionsSmartphone.cpp:287 -#: backends/platform/wince/CELauncherDialog.cpp:83 -#: engines/kyra/saveload_eob.cpp:557 engines/kyra/saveload_eob.cpp:590 -msgid "No" -msgstr "Ez" - #: gui/launcher.cpp:841 msgid "ScummVM couldn't open the specified directory!" msgstr "ScummVM-k ezin izan du zehazturiko direktorioa ireki!" @@ -667,7 +680,7 @@ msgid "Special dithering modes supported by some games" msgstr "Joko batzuk onarturiko lausotze-modu bereziak" #: gui/options.cpp:758 -#: backends/graphics/surfacesdl/surfacesdl-graphics.cpp:2298 +#: backends/graphics/surfacesdl/surfacesdl-graphics.cpp:2313 msgid "Fullscreen mode" msgstr "Pantaila osoa" @@ -1136,7 +1149,7 @@ msgstr "GFX desgaituta" msgid "Standard Renderer" msgstr "Estandarra (16bpp)" -#: gui/ThemeEngine.cpp:348 engines/scumm/dialogs.cpp:661 +#: gui/ThemeEngine.cpp:348 engines/scumm/dialogs.cpp:663 msgid "Standard" msgstr "Estandarra" @@ -1387,7 +1400,7 @@ msgstr "It~z~uli abiarazlera" #: engines/dialogs.cpp:116 engines/agi/saveload.cpp:803 #: engines/cruise/menu.cpp:212 engines/drascula/saveload.cpp:336 -#: engines/dreamweb/saveload.cpp:261 engines/neverhood/menumodule.cpp:873 +#: engines/dreamweb/saveload.cpp:261 engines/neverhood/menumodule.cpp:877 #: engines/pegasus/pegasus.cpp:377 engines/sci/engine/kfile.cpp:759 #: engines/toltecs/menu.cpp:281 engines/tsage/scenes.cpp:598 msgid "Save game:" @@ -1400,7 +1413,7 @@ msgstr "Gorde jokoa:" #: backends/platform/wince/CEActionsSmartphone.cpp:231 #: engines/agi/saveload.cpp:803 engines/cruise/menu.cpp:212 #: engines/drascula/saveload.cpp:336 engines/dreamweb/saveload.cpp:261 -#: engines/neverhood/menumodule.cpp:873 engines/pegasus/pegasus.cpp:377 +#: engines/neverhood/menumodule.cpp:877 engines/pegasus/pegasus.cpp:377 #: engines/sci/engine/kfile.cpp:759 engines/scumm/dialogs.cpp:188 #: engines/toltecs/menu.cpp:281 engines/tsage/scenes.cpp:598 msgid "Save" @@ -1738,58 +1751,58 @@ msgstr "Erdiko klika" msgid "Right Click" msgstr "Eskuin-klika" -#: backends/platform/sdl/macosx/appmenu_osx.mm:77 +#: backends/platform/sdl/macosx/appmenu_osx.mm:88 msgid "Hide ScummVM" msgstr "ScummVM ezkutatu" -#: backends/platform/sdl/macosx/appmenu_osx.mm:82 +#: backends/platform/sdl/macosx/appmenu_osx.mm:93 msgid "Hide Others" msgstr "Besteak ezkutatu" -#: backends/platform/sdl/macosx/appmenu_osx.mm:87 +#: backends/platform/sdl/macosx/appmenu_osx.mm:98 msgid "Show All" msgstr "Denak erakutsi" -#: backends/platform/sdl/macosx/appmenu_osx.mm:109 #: backends/platform/sdl/macosx/appmenu_osx.mm:120 +#: backends/platform/sdl/macosx/appmenu_osx.mm:131 msgid "Window" msgstr "Leihoa" -#: backends/platform/sdl/macosx/appmenu_osx.mm:114 +#: backends/platform/sdl/macosx/appmenu_osx.mm:125 msgid "Minimize" msgstr "Minimizatu" -#: backends/graphics/surfacesdl/surfacesdl-graphics.cpp:46 +#: backends/graphics/surfacesdl/surfacesdl-graphics.cpp:47 msgid "Normal (no scaling)" msgstr "Normala (eskalatu gabe)" -#: backends/graphics/surfacesdl/surfacesdl-graphics.cpp:65 +#: backends/graphics/surfacesdl/surfacesdl-graphics.cpp:66 msgctxt "lowres" msgid "Normal (no scaling)" msgstr "Normala" -#: backends/graphics/surfacesdl/surfacesdl-graphics.cpp:2197 +#: backends/graphics/surfacesdl/surfacesdl-graphics.cpp:2212 msgid "Enabled aspect ratio correction" msgstr "Formatu-ratio zuzenketa gaituta" -#: backends/graphics/surfacesdl/surfacesdl-graphics.cpp:2203 +#: backends/graphics/surfacesdl/surfacesdl-graphics.cpp:2218 msgid "Disabled aspect ratio correction" msgstr "Formatu-ratio zuzenketa desgaituta" -#: backends/graphics/surfacesdl/surfacesdl-graphics.cpp:2258 +#: backends/graphics/surfacesdl/surfacesdl-graphics.cpp:2273 msgid "Active graphics filter:" msgstr "Filtro grafiko aktiboa:" -#: backends/graphics/surfacesdl/surfacesdl-graphics.cpp:2300 +#: backends/graphics/surfacesdl/surfacesdl-graphics.cpp:2315 msgid "Windowed mode" msgstr "Leiho modua" -#: backends/graphics/opengl/opengl-graphics.cpp:118 +#: backends/graphics/opengl/opengl-graphics.cpp:119 #, fuzzy msgid "OpenGL" msgstr "Ireki" -#: backends/graphics/opengl/opengl-graphics.cpp:119 +#: backends/graphics/opengl/opengl-graphics.cpp:120 msgid "OpenGL (No filtering)" msgstr "" @@ -2231,13 +2244,13 @@ msgid "" msgstr "" #: engines/agi/saveload.cpp:816 engines/drascula/saveload.cpp:349 -#: engines/dreamweb/saveload.cpp:169 engines/neverhood/menumodule.cpp:886 +#: engines/dreamweb/saveload.cpp:169 engines/neverhood/menumodule.cpp:890 #: engines/sci/engine/kfile.cpp:858 engines/toltecs/menu.cpp:256 msgid "Restore game:" msgstr "Jokoa kargatu:" #: engines/agi/saveload.cpp:816 engines/drascula/saveload.cpp:349 -#: engines/dreamweb/saveload.cpp:169 engines/neverhood/menumodule.cpp:886 +#: engines/dreamweb/saveload.cpp:169 engines/neverhood/menumodule.cpp:890 #: engines/sci/engine/kfile.cpp:858 engines/toltecs/menu.cpp:256 msgid "Restore" msgstr "Kargatu" @@ -2780,36 +2793,36 @@ msgstr "~A~urrekoa" msgid "~N~ext" msgstr "~H~urrengoa" -#: engines/scumm/dialogs.cpp:600 +#: engines/scumm/dialogs.cpp:602 msgid "Speech Only" msgstr "Ahotsak bakarrik" -#: engines/scumm/dialogs.cpp:601 +#: engines/scumm/dialogs.cpp:603 msgid "Speech and Subtitles" msgstr "Ahotsak eta azpitituluak" -#: engines/scumm/dialogs.cpp:602 +#: engines/scumm/dialogs.cpp:604 msgid "Subtitles Only" msgstr "Azpitituluak bakarrik" -#: engines/scumm/dialogs.cpp:610 +#: engines/scumm/dialogs.cpp:612 msgctxt "lowres" msgid "Speech & Subs" msgstr "Ahotsak & azpit." -#: engines/scumm/dialogs.cpp:656 +#: engines/scumm/dialogs.cpp:658 msgid "Select a Proficiency Level." msgstr "Zailtasuna aukeratu." -#: engines/scumm/dialogs.cpp:658 +#: engines/scumm/dialogs.cpp:660 msgid "Refer to your Loom(TM) manual for help." msgstr "Loom(TM)-ko eskuliburura jo ezazu laguntza lortzeko." -#: engines/scumm/dialogs.cpp:662 +#: engines/scumm/dialogs.cpp:664 msgid "Practice" msgstr "Entrenamendua" -#: engines/scumm/dialogs.cpp:663 +#: engines/scumm/dialogs.cpp:665 msgid "Expert" msgstr "Aditua" diff --git a/po/fi_FI.po b/po/fi_FI.po index aeed76304e..1f9b99ff7f 100644 --- a/po/fi_FI.po +++ b/po/fi_FI.po @@ -7,7 +7,7 @@ msgid "" msgstr "" "Project-Id-Version: ScummVM 1.6.0git\n" "Report-Msgid-Bugs-To: scummvm-devel@lists.sf.net\n" -"POT-Creation-Date: 2015-10-11 18:59+0100\n" +"POT-Creation-Date: 2015-12-23 00:28+0000\n" "PO-Revision-Date: 2012-12-01 19:37+0200\n" "Last-Translator: Toni Saarela \n" "Language-Team: Finnish\n" @@ -53,13 +53,13 @@ msgid "Go up" msgstr "Siirry yls" #: gui/browser.cpp:75 gui/chooser.cpp:46 gui/editrecorddialog.cpp:67 -#: gui/KeysDialog.cpp:43 gui/launcher.cpp:351 gui/massadd.cpp:95 -#: gui/options.cpp:1237 gui/predictivedialog.cpp:74 gui/recorderdialog.cpp:70 -#: gui/recorderdialog.cpp:156 gui/saveload-dialog.cpp:216 -#: gui/saveload-dialog.cpp:276 gui/saveload-dialog.cpp:547 -#: gui/saveload-dialog.cpp:931 gui/themebrowser.cpp:55 -#: gui/fluidsynth-dialog.cpp:152 engines/engine.cpp:483 -#: backends/platform/wii/options.cpp:48 +#: gui/filebrowser-dialog.cpp:64 gui/KeysDialog.cpp:43 gui/launcher.cpp:351 +#: gui/massadd.cpp:95 gui/options.cpp:1237 gui/predictivedialog.cpp:74 +#: gui/recorderdialog.cpp:70 gui/recorderdialog.cpp:156 +#: gui/saveload-dialog.cpp:216 gui/saveload-dialog.cpp:276 +#: gui/saveload-dialog.cpp:547 gui/saveload-dialog.cpp:931 +#: gui/themebrowser.cpp:55 gui/fluidsynth-dialog.cpp:152 +#: engines/engine.cpp:483 backends/platform/wii/options.cpp:48 #: backends/events/default/default-events.cpp:196 #: backends/events/default/default-events.cpp:218 #: engines/drascula/saveload.cpp:49 engines/parallaction/saveload.cpp:274 @@ -68,7 +68,7 @@ msgid "Cancel" msgstr "Peruuta" #: gui/browser.cpp:76 gui/browser_osx.mm:103 gui/chooser.cpp:47 -#: gui/themebrowser.cpp:56 +#: gui/filebrowser-dialog.cpp:65 gui/themebrowser.cpp:56 msgid "Choose" msgstr "Valitse" @@ -88,6 +88,39 @@ msgstr "" msgid "Ok" msgstr "" +#: gui/filebrowser-dialog.cpp:49 +msgid "Choose file for loading" +msgstr "" + +#: gui/filebrowser-dialog.cpp:49 +msgid "Enter filename for saving" +msgstr "" + +#: gui/filebrowser-dialog.cpp:132 +#, fuzzy +msgid "Do you really want to overwrite the file?" +msgstr "Haluatko varmasti poistaa tmn pelitallennuksen?" + +#: gui/filebrowser-dialog.cpp:132 gui/launcher.cpp:793 gui/launcher.cpp:941 +#: gui/launcher.cpp:1000 gui/fluidsynth-dialog.cpp:217 +#: backends/events/symbiansdl/symbiansdl-events.cpp:186 +#: backends/platform/wince/CEActionsPocket.cpp:326 +#: backends/platform/wince/CEActionsSmartphone.cpp:287 +#: backends/platform/wince/CELauncherDialog.cpp:83 +#: engines/kyra/saveload_eob.cpp:557 engines/kyra/saveload_eob.cpp:590 +msgid "Yes" +msgstr "Kyll" + +#: gui/filebrowser-dialog.cpp:132 gui/launcher.cpp:793 gui/launcher.cpp:941 +#: gui/launcher.cpp:1000 gui/fluidsynth-dialog.cpp:217 +#: backends/events/symbiansdl/symbiansdl-events.cpp:186 +#: backends/platform/wince/CEActionsPocket.cpp:326 +#: backends/platform/wince/CEActionsSmartphone.cpp:287 +#: backends/platform/wince/CELauncherDialog.cpp:83 +#: engines/kyra/saveload_eob.cpp:557 engines/kyra/saveload_eob.cpp:590 +msgid "No" +msgstr "Ei" + #: gui/gui-manager.cpp:117 backends/keymapper/remap-dialog.cpp:53 #: engines/scumm/help.cpp:126 engines/scumm/help.cpp:141 #: engines/scumm/help.cpp:166 engines/scumm/help.cpp:192 @@ -385,7 +418,7 @@ msgstr "Pelin tunnus on jo k msgid "~Q~uit" msgstr "~L~opeta" -#: gui/launcher.cpp:626 backends/platform/sdl/macosx/appmenu_osx.mm:95 +#: gui/launcher.cpp:626 backends/platform/sdl/macosx/appmenu_osx.mm:106 msgid "Quit ScummVM" msgstr "Lopeta ScummVM" @@ -393,7 +426,7 @@ msgstr "Lopeta ScummVM" msgid "A~b~out..." msgstr "Tietoa..." -#: gui/launcher.cpp:627 backends/platform/sdl/macosx/appmenu_osx.mm:69 +#: gui/launcher.cpp:627 backends/platform/sdl/macosx/appmenu_osx.mm:80 msgid "About ScummVM" msgstr "Tietoa ScummVM:st" @@ -491,26 +524,6 @@ msgstr "" "Haluatko varmasti list pelej alihakemistoineen? Tm voi list suuren " "mrn pelej." -#: gui/launcher.cpp:793 gui/launcher.cpp:941 gui/launcher.cpp:1000 -#: gui/fluidsynth-dialog.cpp:217 -#: backends/events/symbiansdl/symbiansdl-events.cpp:186 -#: backends/platform/wince/CEActionsPocket.cpp:326 -#: backends/platform/wince/CEActionsSmartphone.cpp:287 -#: backends/platform/wince/CELauncherDialog.cpp:83 -#: engines/kyra/saveload_eob.cpp:557 engines/kyra/saveload_eob.cpp:590 -msgid "Yes" -msgstr "Kyll" - -#: gui/launcher.cpp:793 gui/launcher.cpp:941 gui/launcher.cpp:1000 -#: gui/fluidsynth-dialog.cpp:217 -#: backends/events/symbiansdl/symbiansdl-events.cpp:186 -#: backends/platform/wince/CEActionsPocket.cpp:326 -#: backends/platform/wince/CEActionsSmartphone.cpp:287 -#: backends/platform/wince/CELauncherDialog.cpp:83 -#: engines/kyra/saveload_eob.cpp:557 engines/kyra/saveload_eob.cpp:590 -msgid "No" -msgstr "Ei" - #: gui/launcher.cpp:841 msgid "ScummVM couldn't open the specified directory!" msgstr "ScummVM ei voi avata kyseist hakemistoa!" @@ -668,7 +681,7 @@ msgid "Special dithering modes supported by some games" msgstr "Erityiset dithering asetukset joita jotkut pelit tukevat" #: gui/options.cpp:758 -#: backends/graphics/surfacesdl/surfacesdl-graphics.cpp:2298 +#: backends/graphics/surfacesdl/surfacesdl-graphics.cpp:2313 msgid "Fullscreen mode" msgstr "Kokoruututila" @@ -1134,7 +1147,7 @@ msgstr "Disabloitu GFX" msgid "Standard Renderer" msgstr "Standardirenderij (16 bpp)" -#: gui/ThemeEngine.cpp:348 engines/scumm/dialogs.cpp:661 +#: gui/ThemeEngine.cpp:348 engines/scumm/dialogs.cpp:663 msgid "Standard" msgstr "Standardi" @@ -1387,7 +1400,7 @@ msgstr "Palaa p~e~livalitsimeen" #: engines/dialogs.cpp:116 engines/agi/saveload.cpp:803 #: engines/cruise/menu.cpp:212 engines/drascula/saveload.cpp:336 -#: engines/dreamweb/saveload.cpp:261 engines/neverhood/menumodule.cpp:873 +#: engines/dreamweb/saveload.cpp:261 engines/neverhood/menumodule.cpp:877 #: engines/pegasus/pegasus.cpp:377 engines/sci/engine/kfile.cpp:759 #: engines/toltecs/menu.cpp:281 engines/tsage/scenes.cpp:598 msgid "Save game:" @@ -1400,7 +1413,7 @@ msgstr "Tallenna peli:" #: backends/platform/wince/CEActionsSmartphone.cpp:231 #: engines/agi/saveload.cpp:803 engines/cruise/menu.cpp:212 #: engines/drascula/saveload.cpp:336 engines/dreamweb/saveload.cpp:261 -#: engines/neverhood/menumodule.cpp:873 engines/pegasus/pegasus.cpp:377 +#: engines/neverhood/menumodule.cpp:877 engines/pegasus/pegasus.cpp:377 #: engines/sci/engine/kfile.cpp:759 engines/scumm/dialogs.cpp:188 #: engines/toltecs/menu.cpp:281 engines/tsage/scenes.cpp:598 msgid "Save" @@ -1738,58 +1751,58 @@ msgstr "Keskiklikkaus" msgid "Right Click" msgstr "Oikea klikkaus" -#: backends/platform/sdl/macosx/appmenu_osx.mm:77 +#: backends/platform/sdl/macosx/appmenu_osx.mm:88 msgid "Hide ScummVM" msgstr "Piilota ScummVM" -#: backends/platform/sdl/macosx/appmenu_osx.mm:82 +#: backends/platform/sdl/macosx/appmenu_osx.mm:93 msgid "Hide Others" msgstr "Piilota muut" -#: backends/platform/sdl/macosx/appmenu_osx.mm:87 +#: backends/platform/sdl/macosx/appmenu_osx.mm:98 msgid "Show All" msgstr "Nyt kaikki" -#: backends/platform/sdl/macosx/appmenu_osx.mm:109 #: backends/platform/sdl/macosx/appmenu_osx.mm:120 +#: backends/platform/sdl/macosx/appmenu_osx.mm:131 msgid "Window" msgstr "Ikkuna" -#: backends/platform/sdl/macosx/appmenu_osx.mm:114 +#: backends/platform/sdl/macosx/appmenu_osx.mm:125 msgid "Minimize" msgstr "Minimoi" -#: backends/graphics/surfacesdl/surfacesdl-graphics.cpp:46 +#: backends/graphics/surfacesdl/surfacesdl-graphics.cpp:47 msgid "Normal (no scaling)" msgstr "Normaali (ei skaalausta)" -#: backends/graphics/surfacesdl/surfacesdl-graphics.cpp:65 +#: backends/graphics/surfacesdl/surfacesdl-graphics.cpp:66 msgctxt "lowres" msgid "Normal (no scaling)" msgstr "Normaali (ei skaalausta)" -#: backends/graphics/surfacesdl/surfacesdl-graphics.cpp:2197 +#: backends/graphics/surfacesdl/surfacesdl-graphics.cpp:2212 msgid "Enabled aspect ratio correction" msgstr "Kuvasuhteen korjaus pll" -#: backends/graphics/surfacesdl/surfacesdl-graphics.cpp:2203 +#: backends/graphics/surfacesdl/surfacesdl-graphics.cpp:2218 msgid "Disabled aspect ratio correction" msgstr "Kuvasuhteen korjaus pois plt" -#: backends/graphics/surfacesdl/surfacesdl-graphics.cpp:2258 +#: backends/graphics/surfacesdl/surfacesdl-graphics.cpp:2273 msgid "Active graphics filter:" msgstr "Valittu grafiikkafiltteri:" -#: backends/graphics/surfacesdl/surfacesdl-graphics.cpp:2300 +#: backends/graphics/surfacesdl/surfacesdl-graphics.cpp:2315 msgid "Windowed mode" msgstr "Ikkunoitu tila" -#: backends/graphics/opengl/opengl-graphics.cpp:118 +#: backends/graphics/opengl/opengl-graphics.cpp:119 #, fuzzy msgid "OpenGL" msgstr "Avaa" -#: backends/graphics/opengl/opengl-graphics.cpp:119 +#: backends/graphics/opengl/opengl-graphics.cpp:120 msgid "OpenGL (No filtering)" msgstr "" @@ -2234,13 +2247,13 @@ msgid "" msgstr "" #: engines/agi/saveload.cpp:816 engines/drascula/saveload.cpp:349 -#: engines/dreamweb/saveload.cpp:169 engines/neverhood/menumodule.cpp:886 +#: engines/dreamweb/saveload.cpp:169 engines/neverhood/menumodule.cpp:890 #: engines/sci/engine/kfile.cpp:858 engines/toltecs/menu.cpp:256 msgid "Restore game:" msgstr "Lataa pelitallenne:" #: engines/agi/saveload.cpp:816 engines/drascula/saveload.cpp:349 -#: engines/dreamweb/saveload.cpp:169 engines/neverhood/menumodule.cpp:886 +#: engines/dreamweb/saveload.cpp:169 engines/neverhood/menumodule.cpp:890 #: engines/sci/engine/kfile.cpp:858 engines/toltecs/menu.cpp:256 msgid "Restore" msgstr "Lataa tallenne" @@ -2774,36 +2787,36 @@ msgstr "E~d~ellinen" msgid "~N~ext" msgstr "Se~u~raava" -#: engines/scumm/dialogs.cpp:600 +#: engines/scumm/dialogs.cpp:602 msgid "Speech Only" msgstr "Vain puhe" -#: engines/scumm/dialogs.cpp:601 +#: engines/scumm/dialogs.cpp:603 msgid "Speech and Subtitles" msgstr "Puhe ja Tekstitys" -#: engines/scumm/dialogs.cpp:602 +#: engines/scumm/dialogs.cpp:604 msgid "Subtitles Only" msgstr "Vain tekstitys" -#: engines/scumm/dialogs.cpp:610 +#: engines/scumm/dialogs.cpp:612 msgctxt "lowres" msgid "Speech & Subs" msgstr "Puhe & teksti" -#: engines/scumm/dialogs.cpp:656 +#: engines/scumm/dialogs.cpp:658 msgid "Select a Proficiency Level." msgstr "Valitse taitotasosi." -#: engines/scumm/dialogs.cpp:658 +#: engines/scumm/dialogs.cpp:660 msgid "Refer to your Loom(TM) manual for help." msgstr "Lue Loom(TM) ohjekirjaa saadaksesi ohjeita." -#: engines/scumm/dialogs.cpp:662 +#: engines/scumm/dialogs.cpp:664 msgid "Practice" msgstr "Harjoitus" -#: engines/scumm/dialogs.cpp:663 +#: engines/scumm/dialogs.cpp:665 msgid "Expert" msgstr "Ekspertti" diff --git a/po/fr_FR.po b/po/fr_FR.po index c6b785c794..c34836e324 100644 --- a/po/fr_FR.po +++ b/po/fr_FR.po @@ -7,7 +7,7 @@ msgid "" msgstr "" "Project-Id-Version: ScummVM 1.3.0svn\n" "Report-Msgid-Bugs-To: scummvm-devel@lists.sf.net\n" -"POT-Creation-Date: 2015-10-11 18:59+0100\n" +"POT-Creation-Date: 2015-12-23 00:28+0000\n" "PO-Revision-Date: 2014-07-05 13:49-0000\n" "Last-Translator: Thierry Crozat \n" "Language-Team: French \n" @@ -53,13 +53,13 @@ msgid "Go up" msgstr "Remonter" #: gui/browser.cpp:75 gui/chooser.cpp:46 gui/editrecorddialog.cpp:67 -#: gui/KeysDialog.cpp:43 gui/launcher.cpp:351 gui/massadd.cpp:95 -#: gui/options.cpp:1237 gui/predictivedialog.cpp:74 gui/recorderdialog.cpp:70 -#: gui/recorderdialog.cpp:156 gui/saveload-dialog.cpp:216 -#: gui/saveload-dialog.cpp:276 gui/saveload-dialog.cpp:547 -#: gui/saveload-dialog.cpp:931 gui/themebrowser.cpp:55 -#: gui/fluidsynth-dialog.cpp:152 engines/engine.cpp:483 -#: backends/platform/wii/options.cpp:48 +#: gui/filebrowser-dialog.cpp:64 gui/KeysDialog.cpp:43 gui/launcher.cpp:351 +#: gui/massadd.cpp:95 gui/options.cpp:1237 gui/predictivedialog.cpp:74 +#: gui/recorderdialog.cpp:70 gui/recorderdialog.cpp:156 +#: gui/saveload-dialog.cpp:216 gui/saveload-dialog.cpp:276 +#: gui/saveload-dialog.cpp:547 gui/saveload-dialog.cpp:931 +#: gui/themebrowser.cpp:55 gui/fluidsynth-dialog.cpp:152 +#: engines/engine.cpp:483 backends/platform/wii/options.cpp:48 #: backends/events/default/default-events.cpp:196 #: backends/events/default/default-events.cpp:218 #: engines/drascula/saveload.cpp:49 engines/parallaction/saveload.cpp:274 @@ -68,7 +68,7 @@ msgid "Cancel" msgstr "Annuler" #: gui/browser.cpp:76 gui/browser_osx.mm:103 gui/chooser.cpp:47 -#: gui/themebrowser.cpp:56 +#: gui/filebrowser-dialog.cpp:65 gui/themebrowser.cpp:56 msgid "Choose" msgstr "Choisir" @@ -88,6 +88,39 @@ msgstr "" msgid "Ok" msgstr "" +#: gui/filebrowser-dialog.cpp:49 +msgid "Choose file for loading" +msgstr "" + +#: gui/filebrowser-dialog.cpp:49 +msgid "Enter filename for saving" +msgstr "" + +#: gui/filebrowser-dialog.cpp:132 +#, fuzzy +msgid "Do you really want to overwrite the file?" +msgstr "Voulez-vous vraiment supprimer cette sauvegarde ?" + +#: gui/filebrowser-dialog.cpp:132 gui/launcher.cpp:793 gui/launcher.cpp:941 +#: gui/launcher.cpp:1000 gui/fluidsynth-dialog.cpp:217 +#: backends/events/symbiansdl/symbiansdl-events.cpp:186 +#: backends/platform/wince/CEActionsPocket.cpp:326 +#: backends/platform/wince/CEActionsSmartphone.cpp:287 +#: backends/platform/wince/CELauncherDialog.cpp:83 +#: engines/kyra/saveload_eob.cpp:557 engines/kyra/saveload_eob.cpp:590 +msgid "Yes" +msgstr "Oui" + +#: gui/filebrowser-dialog.cpp:132 gui/launcher.cpp:793 gui/launcher.cpp:941 +#: gui/launcher.cpp:1000 gui/fluidsynth-dialog.cpp:217 +#: backends/events/symbiansdl/symbiansdl-events.cpp:186 +#: backends/platform/wince/CEActionsPocket.cpp:326 +#: backends/platform/wince/CEActionsSmartphone.cpp:287 +#: backends/platform/wince/CELauncherDialog.cpp:83 +#: engines/kyra/saveload_eob.cpp:557 engines/kyra/saveload_eob.cpp:590 +msgid "No" +msgstr "Non" + #: gui/gui-manager.cpp:117 backends/keymapper/remap-dialog.cpp:53 #: engines/scumm/help.cpp:126 engines/scumm/help.cpp:141 #: engines/scumm/help.cpp:166 engines/scumm/help.cpp:192 @@ -385,7 +418,7 @@ msgstr "Cet ID est d msgid "~Q~uit" msgstr "~Q~uitter" -#: gui/launcher.cpp:626 backends/platform/sdl/macosx/appmenu_osx.mm:95 +#: gui/launcher.cpp:626 backends/platform/sdl/macosx/appmenu_osx.mm:106 msgid "Quit ScummVM" msgstr "Quitter ScummVM" @@ -393,7 +426,7 @@ msgstr "Quitter ScummVM" msgid "A~b~out..." msgstr " ~P~ropos..." -#: gui/launcher.cpp:627 backends/platform/sdl/macosx/appmenu_osx.mm:69 +#: gui/launcher.cpp:627 backends/platform/sdl/macosx/appmenu_osx.mm:80 msgid "About ScummVM" msgstr " propos de ScummVM" @@ -492,26 +525,6 @@ msgstr "" "Voulez-vous vraiment lancer la dtection automatique des jeux ? Cela peut " "potentiellement ajouter un grand nombre de jeux." -#: gui/launcher.cpp:793 gui/launcher.cpp:941 gui/launcher.cpp:1000 -#: gui/fluidsynth-dialog.cpp:217 -#: backends/events/symbiansdl/symbiansdl-events.cpp:186 -#: backends/platform/wince/CEActionsPocket.cpp:326 -#: backends/platform/wince/CEActionsSmartphone.cpp:287 -#: backends/platform/wince/CELauncherDialog.cpp:83 -#: engines/kyra/saveload_eob.cpp:557 engines/kyra/saveload_eob.cpp:590 -msgid "Yes" -msgstr "Oui" - -#: gui/launcher.cpp:793 gui/launcher.cpp:941 gui/launcher.cpp:1000 -#: gui/fluidsynth-dialog.cpp:217 -#: backends/events/symbiansdl/symbiansdl-events.cpp:186 -#: backends/platform/wince/CEActionsPocket.cpp:326 -#: backends/platform/wince/CEActionsSmartphone.cpp:287 -#: backends/platform/wince/CELauncherDialog.cpp:83 -#: engines/kyra/saveload_eob.cpp:557 engines/kyra/saveload_eob.cpp:590 -msgid "No" -msgstr "Non" - #: gui/launcher.cpp:841 msgid "ScummVM couldn't open the specified directory!" msgstr "ScummVM n'a pas pu ouvrir le rpertoire slectionn." @@ -666,7 +679,7 @@ msgid "Special dithering modes supported by some games" msgstr "Mode spcial de tramage support par certains jeux" #: gui/options.cpp:758 -#: backends/graphics/surfacesdl/surfacesdl-graphics.cpp:2298 +#: backends/graphics/surfacesdl/surfacesdl-graphics.cpp:2313 msgid "Fullscreen mode" msgstr "Plein cran" @@ -1138,7 +1151,7 @@ msgstr "GFX d msgid "Standard Renderer" msgstr "Rendu Standard" -#: gui/ThemeEngine.cpp:348 engines/scumm/dialogs.cpp:661 +#: gui/ThemeEngine.cpp:348 engines/scumm/dialogs.cpp:663 msgid "Standard" msgstr "Normal" @@ -1386,7 +1399,7 @@ msgstr "Retour au ~L~anceur" #: engines/dialogs.cpp:116 engines/agi/saveload.cpp:803 #: engines/cruise/menu.cpp:212 engines/drascula/saveload.cpp:336 -#: engines/dreamweb/saveload.cpp:261 engines/neverhood/menumodule.cpp:873 +#: engines/dreamweb/saveload.cpp:261 engines/neverhood/menumodule.cpp:877 #: engines/pegasus/pegasus.cpp:377 engines/sci/engine/kfile.cpp:759 #: engines/toltecs/menu.cpp:281 engines/tsage/scenes.cpp:598 msgid "Save game:" @@ -1399,7 +1412,7 @@ msgstr "Sauvegarde:" #: backends/platform/wince/CEActionsSmartphone.cpp:231 #: engines/agi/saveload.cpp:803 engines/cruise/menu.cpp:212 #: engines/drascula/saveload.cpp:336 engines/dreamweb/saveload.cpp:261 -#: engines/neverhood/menumodule.cpp:873 engines/pegasus/pegasus.cpp:377 +#: engines/neverhood/menumodule.cpp:877 engines/pegasus/pegasus.cpp:377 #: engines/sci/engine/kfile.cpp:759 engines/scumm/dialogs.cpp:188 #: engines/toltecs/menu.cpp:281 engines/tsage/scenes.cpp:598 msgid "Save" @@ -1738,57 +1751,57 @@ msgstr "Clic Milieu" msgid "Right Click" msgstr "Clic Droit" -#: backends/platform/sdl/macosx/appmenu_osx.mm:77 +#: backends/platform/sdl/macosx/appmenu_osx.mm:88 msgid "Hide ScummVM" msgstr "Masquer ScummVM" -#: backends/platform/sdl/macosx/appmenu_osx.mm:82 +#: backends/platform/sdl/macosx/appmenu_osx.mm:93 msgid "Hide Others" msgstr "Masquer les autres" -#: backends/platform/sdl/macosx/appmenu_osx.mm:87 +#: backends/platform/sdl/macosx/appmenu_osx.mm:98 msgid "Show All" msgstr "Tout afficher" -#: backends/platform/sdl/macosx/appmenu_osx.mm:109 #: backends/platform/sdl/macosx/appmenu_osx.mm:120 +#: backends/platform/sdl/macosx/appmenu_osx.mm:131 msgid "Window" msgstr "Fentre" -#: backends/platform/sdl/macosx/appmenu_osx.mm:114 +#: backends/platform/sdl/macosx/appmenu_osx.mm:125 msgid "Minimize" msgstr "Placer dans le Dock" -#: backends/graphics/surfacesdl/surfacesdl-graphics.cpp:46 +#: backends/graphics/surfacesdl/surfacesdl-graphics.cpp:47 msgid "Normal (no scaling)" msgstr "Normal (chelle d'origine)" -#: backends/graphics/surfacesdl/surfacesdl-graphics.cpp:65 +#: backends/graphics/surfacesdl/surfacesdl-graphics.cpp:66 msgctxt "lowres" msgid "Normal (no scaling)" msgstr "Normal" -#: backends/graphics/surfacesdl/surfacesdl-graphics.cpp:2197 +#: backends/graphics/surfacesdl/surfacesdl-graphics.cpp:2212 msgid "Enabled aspect ratio correction" msgstr "Activer la correction du rapport d'aspect" -#: backends/graphics/surfacesdl/surfacesdl-graphics.cpp:2203 +#: backends/graphics/surfacesdl/surfacesdl-graphics.cpp:2218 msgid "Disabled aspect ratio correction" msgstr "Dsactiver la correction du rapport d'aspect" -#: backends/graphics/surfacesdl/surfacesdl-graphics.cpp:2258 +#: backends/graphics/surfacesdl/surfacesdl-graphics.cpp:2273 msgid "Active graphics filter:" msgstr "Mode graphique actif:" -#: backends/graphics/surfacesdl/surfacesdl-graphics.cpp:2300 +#: backends/graphics/surfacesdl/surfacesdl-graphics.cpp:2315 msgid "Windowed mode" msgstr "Mode Fentre" -#: backends/graphics/opengl/opengl-graphics.cpp:118 +#: backends/graphics/opengl/opengl-graphics.cpp:119 msgid "OpenGL" msgstr "OpenGL" -#: backends/graphics/opengl/opengl-graphics.cpp:119 +#: backends/graphics/opengl/opengl-graphics.cpp:120 msgid "OpenGL (No filtering)" msgstr "OpenGL (sans filtre)" @@ -2234,13 +2247,13 @@ msgid "" msgstr "" #: engines/agi/saveload.cpp:816 engines/drascula/saveload.cpp:349 -#: engines/dreamweb/saveload.cpp:169 engines/neverhood/menumodule.cpp:886 +#: engines/dreamweb/saveload.cpp:169 engines/neverhood/menumodule.cpp:890 #: engines/sci/engine/kfile.cpp:858 engines/toltecs/menu.cpp:256 msgid "Restore game:" msgstr "Charger le jeu:" #: engines/agi/saveload.cpp:816 engines/drascula/saveload.cpp:349 -#: engines/dreamweb/saveload.cpp:169 engines/neverhood/menumodule.cpp:886 +#: engines/dreamweb/saveload.cpp:169 engines/neverhood/menumodule.cpp:890 #: engines/sci/engine/kfile.cpp:858 engines/toltecs/menu.cpp:256 msgid "Restore" msgstr "Charger" @@ -2781,36 +2794,36 @@ msgstr "~P~r msgid "~N~ext" msgstr "~S~uivant" -#: engines/scumm/dialogs.cpp:600 +#: engines/scumm/dialogs.cpp:602 msgid "Speech Only" msgstr "Voix" -#: engines/scumm/dialogs.cpp:601 +#: engines/scumm/dialogs.cpp:603 msgid "Speech and Subtitles" msgstr "Voix et Sous-titres" -#: engines/scumm/dialogs.cpp:602 +#: engines/scumm/dialogs.cpp:604 msgid "Subtitles Only" msgstr "Sous-titres" -#: engines/scumm/dialogs.cpp:610 +#: engines/scumm/dialogs.cpp:612 msgctxt "lowres" msgid "Speech & Subs" msgstr "Voix & ST" -#: engines/scumm/dialogs.cpp:656 +#: engines/scumm/dialogs.cpp:658 msgid "Select a Proficiency Level." msgstr "Slectionnez un niveau de comptence." -#: engines/scumm/dialogs.cpp:658 +#: engines/scumm/dialogs.cpp:660 msgid "Refer to your Loom(TM) manual for help." msgstr "Reportez-vous votre manuel d'instruction." -#: engines/scumm/dialogs.cpp:662 +#: engines/scumm/dialogs.cpp:664 msgid "Practice" msgstr "Essai" -#: engines/scumm/dialogs.cpp:663 +#: engines/scumm/dialogs.cpp:665 msgid "Expert" msgstr "Expert" diff --git a/po/gl_ES.po b/po/gl_ES.po index 905c87d316..ca9a698b84 100644 --- a/po/gl_ES.po +++ b/po/gl_ES.po @@ -7,7 +7,7 @@ msgid "" msgstr "" "Project-Id-Version: ScummVM 1.6.0git\n" "Report-Msgid-Bugs-To: scummvm-devel@lists.sf.net\n" -"POT-Creation-Date: 2015-10-11 18:59+0100\n" +"POT-Creation-Date: 2015-12-23 00:28+0000\n" "PO-Revision-Date: 2014-07-02 09:51+0100\n" "Last-Translator: Santiago G. Sanz \n" "Language-Team: Santiago G. Sanz \n" @@ -52,13 +52,13 @@ msgid "Go up" msgstr "Arriba" #: gui/browser.cpp:75 gui/chooser.cpp:46 gui/editrecorddialog.cpp:67 -#: gui/KeysDialog.cpp:43 gui/launcher.cpp:351 gui/massadd.cpp:95 -#: gui/options.cpp:1237 gui/predictivedialog.cpp:74 gui/recorderdialog.cpp:70 -#: gui/recorderdialog.cpp:156 gui/saveload-dialog.cpp:216 -#: gui/saveload-dialog.cpp:276 gui/saveload-dialog.cpp:547 -#: gui/saveload-dialog.cpp:931 gui/themebrowser.cpp:55 -#: gui/fluidsynth-dialog.cpp:152 engines/engine.cpp:483 -#: backends/platform/wii/options.cpp:48 +#: gui/filebrowser-dialog.cpp:64 gui/KeysDialog.cpp:43 gui/launcher.cpp:351 +#: gui/massadd.cpp:95 gui/options.cpp:1237 gui/predictivedialog.cpp:74 +#: gui/recorderdialog.cpp:70 gui/recorderdialog.cpp:156 +#: gui/saveload-dialog.cpp:216 gui/saveload-dialog.cpp:276 +#: gui/saveload-dialog.cpp:547 gui/saveload-dialog.cpp:931 +#: gui/themebrowser.cpp:55 gui/fluidsynth-dialog.cpp:152 +#: engines/engine.cpp:483 backends/platform/wii/options.cpp:48 #: backends/events/default/default-events.cpp:196 #: backends/events/default/default-events.cpp:218 #: engines/drascula/saveload.cpp:49 engines/parallaction/saveload.cpp:274 @@ -67,7 +67,7 @@ msgid "Cancel" msgstr "Cancelar" #: gui/browser.cpp:76 gui/browser_osx.mm:103 gui/chooser.cpp:47 -#: gui/themebrowser.cpp:56 +#: gui/filebrowser-dialog.cpp:65 gui/themebrowser.cpp:56 msgid "Choose" msgstr "Elixir" @@ -87,6 +87,39 @@ msgstr "" msgid "Ok" msgstr "" +#: gui/filebrowser-dialog.cpp:49 +msgid "Choose file for loading" +msgstr "" + +#: gui/filebrowser-dialog.cpp:49 +msgid "Enter filename for saving" +msgstr "" + +#: gui/filebrowser-dialog.cpp:132 +#, fuzzy +msgid "Do you really want to overwrite the file?" +msgstr "Seguro que queres eliminar esta partida?" + +#: gui/filebrowser-dialog.cpp:132 gui/launcher.cpp:793 gui/launcher.cpp:941 +#: gui/launcher.cpp:1000 gui/fluidsynth-dialog.cpp:217 +#: backends/events/symbiansdl/symbiansdl-events.cpp:186 +#: backends/platform/wince/CEActionsPocket.cpp:326 +#: backends/platform/wince/CEActionsSmartphone.cpp:287 +#: backends/platform/wince/CELauncherDialog.cpp:83 +#: engines/kyra/saveload_eob.cpp:557 engines/kyra/saveload_eob.cpp:590 +msgid "Yes" +msgstr "Si" + +#: gui/filebrowser-dialog.cpp:132 gui/launcher.cpp:793 gui/launcher.cpp:941 +#: gui/launcher.cpp:1000 gui/fluidsynth-dialog.cpp:217 +#: backends/events/symbiansdl/symbiansdl-events.cpp:186 +#: backends/platform/wince/CEActionsPocket.cpp:326 +#: backends/platform/wince/CEActionsSmartphone.cpp:287 +#: backends/platform/wince/CELauncherDialog.cpp:83 +#: engines/kyra/saveload_eob.cpp:557 engines/kyra/saveload_eob.cpp:590 +msgid "No" +msgstr "Non" + #: gui/gui-manager.cpp:117 backends/keymapper/remap-dialog.cpp:53 #: engines/scumm/help.cpp:126 engines/scumm/help.cpp:141 #: engines/scumm/help.cpp:166 engines/scumm/help.cpp:192 @@ -382,7 +415,7 @@ msgstr "Este ID de xogo xa est msgid "~Q~uit" msgstr "~S~ar" -#: gui/launcher.cpp:626 backends/platform/sdl/macosx/appmenu_osx.mm:95 +#: gui/launcher.cpp:626 backends/platform/sdl/macosx/appmenu_osx.mm:106 msgid "Quit ScummVM" msgstr "Sar de ScummVM" @@ -390,7 +423,7 @@ msgstr "Sa msgid "A~b~out..." msgstr "Ace~r~ca de..." -#: gui/launcher.cpp:627 backends/platform/sdl/macosx/appmenu_osx.mm:69 +#: gui/launcher.cpp:627 backends/platform/sdl/macosx/appmenu_osx.mm:80 msgid "About ScummVM" msgstr "Acerca de ScummVM" @@ -488,26 +521,6 @@ msgstr "" "Queres executar o detector de xogos en masa? posible que se engada un gran " "nmero de xogos." -#: gui/launcher.cpp:793 gui/launcher.cpp:941 gui/launcher.cpp:1000 -#: gui/fluidsynth-dialog.cpp:217 -#: backends/events/symbiansdl/symbiansdl-events.cpp:186 -#: backends/platform/wince/CEActionsPocket.cpp:326 -#: backends/platform/wince/CEActionsSmartphone.cpp:287 -#: backends/platform/wince/CELauncherDialog.cpp:83 -#: engines/kyra/saveload_eob.cpp:557 engines/kyra/saveload_eob.cpp:590 -msgid "Yes" -msgstr "Si" - -#: gui/launcher.cpp:793 gui/launcher.cpp:941 gui/launcher.cpp:1000 -#: gui/fluidsynth-dialog.cpp:217 -#: backends/events/symbiansdl/symbiansdl-events.cpp:186 -#: backends/platform/wince/CEActionsPocket.cpp:326 -#: backends/platform/wince/CEActionsSmartphone.cpp:287 -#: backends/platform/wince/CELauncherDialog.cpp:83 -#: engines/kyra/saveload_eob.cpp:557 engines/kyra/saveload_eob.cpp:590 -msgid "No" -msgstr "Non" - #: gui/launcher.cpp:841 msgid "ScummVM couldn't open the specified directory!" msgstr "ScummVM non foi quen de abrir o directorio!" @@ -660,7 +673,7 @@ msgid "Special dithering modes supported by some games" msgstr "Modos de interpolacin de cores compatibles con algns xogos" #: gui/options.cpp:758 -#: backends/graphics/surfacesdl/surfacesdl-graphics.cpp:2298 +#: backends/graphics/surfacesdl/surfacesdl-graphics.cpp:2313 msgid "Fullscreen mode" msgstr "Pantalla completa" @@ -1125,7 +1138,7 @@ msgstr "Efectos desactivados" msgid "Standard Renderer" msgstr "Procesamento estndar" -#: gui/ThemeEngine.cpp:348 engines/scumm/dialogs.cpp:661 +#: gui/ThemeEngine.cpp:348 engines/scumm/dialogs.cpp:663 msgid "Standard" msgstr "Estndar" @@ -1373,7 +1386,7 @@ msgstr "~V~olver ao Iniciador" #: engines/dialogs.cpp:116 engines/agi/saveload.cpp:803 #: engines/cruise/menu.cpp:212 engines/drascula/saveload.cpp:336 -#: engines/dreamweb/saveload.cpp:261 engines/neverhood/menumodule.cpp:873 +#: engines/dreamweb/saveload.cpp:261 engines/neverhood/menumodule.cpp:877 #: engines/pegasus/pegasus.cpp:377 engines/sci/engine/kfile.cpp:759 #: engines/toltecs/menu.cpp:281 engines/tsage/scenes.cpp:598 msgid "Save game:" @@ -1386,7 +1399,7 @@ msgstr "Gardar partida:" #: backends/platform/wince/CEActionsSmartphone.cpp:231 #: engines/agi/saveload.cpp:803 engines/cruise/menu.cpp:212 #: engines/drascula/saveload.cpp:336 engines/dreamweb/saveload.cpp:261 -#: engines/neverhood/menumodule.cpp:873 engines/pegasus/pegasus.cpp:377 +#: engines/neverhood/menumodule.cpp:877 engines/pegasus/pegasus.cpp:377 #: engines/sci/engine/kfile.cpp:759 engines/scumm/dialogs.cpp:188 #: engines/toltecs/menu.cpp:281 engines/tsage/scenes.cpp:598 msgid "Save" @@ -1725,57 +1738,57 @@ msgstr "Bot msgid "Right Click" msgstr "Botn secundario" -#: backends/platform/sdl/macosx/appmenu_osx.mm:77 +#: backends/platform/sdl/macosx/appmenu_osx.mm:88 msgid "Hide ScummVM" msgstr "Ocultar ScummVM" -#: backends/platform/sdl/macosx/appmenu_osx.mm:82 +#: backends/platform/sdl/macosx/appmenu_osx.mm:93 msgid "Hide Others" msgstr "Ocultar outros" -#: backends/platform/sdl/macosx/appmenu_osx.mm:87 +#: backends/platform/sdl/macosx/appmenu_osx.mm:98 msgid "Show All" msgstr "Mostrar todo" -#: backends/platform/sdl/macosx/appmenu_osx.mm:109 #: backends/platform/sdl/macosx/appmenu_osx.mm:120 +#: backends/platform/sdl/macosx/appmenu_osx.mm:131 msgid "Window" msgstr "Vent" -#: backends/platform/sdl/macosx/appmenu_osx.mm:114 +#: backends/platform/sdl/macosx/appmenu_osx.mm:125 msgid "Minimize" msgstr "Minimizar" -#: backends/graphics/surfacesdl/surfacesdl-graphics.cpp:46 +#: backends/graphics/surfacesdl/surfacesdl-graphics.cpp:47 msgid "Normal (no scaling)" msgstr "Normal (sen escala)" -#: backends/graphics/surfacesdl/surfacesdl-graphics.cpp:65 +#: backends/graphics/surfacesdl/surfacesdl-graphics.cpp:66 msgctxt "lowres" msgid "Normal (no scaling)" msgstr "Normal (sen escala)" -#: backends/graphics/surfacesdl/surfacesdl-graphics.cpp:2197 +#: backends/graphics/surfacesdl/surfacesdl-graphics.cpp:2212 msgid "Enabled aspect ratio correction" msgstr "Correccin de proporcin activada" -#: backends/graphics/surfacesdl/surfacesdl-graphics.cpp:2203 +#: backends/graphics/surfacesdl/surfacesdl-graphics.cpp:2218 msgid "Disabled aspect ratio correction" msgstr "Correccin de proporcin desactivada" -#: backends/graphics/surfacesdl/surfacesdl-graphics.cpp:2258 +#: backends/graphics/surfacesdl/surfacesdl-graphics.cpp:2273 msgid "Active graphics filter:" msgstr "Filtro de grficos activo:" -#: backends/graphics/surfacesdl/surfacesdl-graphics.cpp:2300 +#: backends/graphics/surfacesdl/surfacesdl-graphics.cpp:2315 msgid "Windowed mode" msgstr "Modo en vent" -#: backends/graphics/opengl/opengl-graphics.cpp:118 +#: backends/graphics/opengl/opengl-graphics.cpp:119 msgid "OpenGL" msgstr "OpenGL" -#: backends/graphics/opengl/opengl-graphics.cpp:119 +#: backends/graphics/opengl/opengl-graphics.cpp:120 msgid "OpenGL (No filtering)" msgstr "OpenGL (Sen filtraxe)" @@ -2218,13 +2231,13 @@ msgid "" msgstr "" #: engines/agi/saveload.cpp:816 engines/drascula/saveload.cpp:349 -#: engines/dreamweb/saveload.cpp:169 engines/neverhood/menumodule.cpp:886 +#: engines/dreamweb/saveload.cpp:169 engines/neverhood/menumodule.cpp:890 #: engines/sci/engine/kfile.cpp:858 engines/toltecs/menu.cpp:256 msgid "Restore game:" msgstr "Restaurar xogo:" #: engines/agi/saveload.cpp:816 engines/drascula/saveload.cpp:349 -#: engines/dreamweb/saveload.cpp:169 engines/neverhood/menumodule.cpp:886 +#: engines/dreamweb/saveload.cpp:169 engines/neverhood/menumodule.cpp:890 #: engines/sci/engine/kfile.cpp:858 engines/toltecs/menu.cpp:256 msgid "Restore" msgstr "Restaurar" @@ -2764,36 +2777,36 @@ msgstr "~A~nterior" msgid "~N~ext" msgstr "~S~eguinte" -#: engines/scumm/dialogs.cpp:600 +#: engines/scumm/dialogs.cpp:602 msgid "Speech Only" msgstr "S voz" -#: engines/scumm/dialogs.cpp:601 +#: engines/scumm/dialogs.cpp:603 msgid "Speech and Subtitles" msgstr "Voz e subttulos" -#: engines/scumm/dialogs.cpp:602 +#: engines/scumm/dialogs.cpp:604 msgid "Subtitles Only" msgstr "S subttulos" -#: engines/scumm/dialogs.cpp:610 +#: engines/scumm/dialogs.cpp:612 msgctxt "lowres" msgid "Speech & Subs" msgstr "Voz e subs" -#: engines/scumm/dialogs.cpp:656 +#: engines/scumm/dialogs.cpp:658 msgid "Select a Proficiency Level." msgstr "Selecciona un nivel de habilidade." -#: engines/scumm/dialogs.cpp:658 +#: engines/scumm/dialogs.cpp:660 msgid "Refer to your Loom(TM) manual for help." msgstr "Consulta o manual de Loom(TM) para obter axuda." -#: engines/scumm/dialogs.cpp:662 +#: engines/scumm/dialogs.cpp:664 msgid "Practice" msgstr "Prctica" -#: engines/scumm/dialogs.cpp:663 +#: engines/scumm/dialogs.cpp:665 msgid "Expert" msgstr "Experto" diff --git a/po/hu_HU.po b/po/hu_HU.po index 89538e9f61..972d726065 100644 --- a/po/hu_HU.po +++ b/po/hu_HU.po @@ -7,7 +7,7 @@ msgid "" msgstr "" "Project-Id-Version: ScummVM 1.3.0svn\n" "Report-Msgid-Bugs-To: scummvm-devel@lists.sf.net\n" -"POT-Creation-Date: 2015-10-11 18:59+0100\n" +"POT-Creation-Date: 2015-12-23 00:28+0000\n" "PO-Revision-Date: 2015-10-12 11:10+0200\n" "Last-Translator: George Kormendi \n" "Language-Team: Hungarian\n" @@ -54,13 +54,13 @@ msgid "Go up" msgstr "Feljebb" #: gui/browser.cpp:75 gui/chooser.cpp:46 gui/editrecorddialog.cpp:67 -#: gui/KeysDialog.cpp:43 gui/launcher.cpp:351 gui/massadd.cpp:95 -#: gui/options.cpp:1237 gui/predictivedialog.cpp:74 gui/recorderdialog.cpp:70 -#: gui/recorderdialog.cpp:156 gui/saveload-dialog.cpp:216 -#: gui/saveload-dialog.cpp:276 gui/saveload-dialog.cpp:547 -#: gui/saveload-dialog.cpp:931 gui/themebrowser.cpp:55 -#: gui/fluidsynth-dialog.cpp:152 engines/engine.cpp:483 -#: backends/platform/wii/options.cpp:48 +#: gui/filebrowser-dialog.cpp:64 gui/KeysDialog.cpp:43 gui/launcher.cpp:351 +#: gui/massadd.cpp:95 gui/options.cpp:1237 gui/predictivedialog.cpp:74 +#: gui/recorderdialog.cpp:70 gui/recorderdialog.cpp:156 +#: gui/saveload-dialog.cpp:216 gui/saveload-dialog.cpp:276 +#: gui/saveload-dialog.cpp:547 gui/saveload-dialog.cpp:931 +#: gui/themebrowser.cpp:55 gui/fluidsynth-dialog.cpp:152 +#: engines/engine.cpp:483 backends/platform/wii/options.cpp:48 #: backends/events/default/default-events.cpp:196 #: backends/events/default/default-events.cpp:218 #: engines/drascula/saveload.cpp:49 engines/parallaction/saveload.cpp:274 @@ -69,7 +69,7 @@ msgid "Cancel" msgstr "Mgse" #: gui/browser.cpp:76 gui/browser_osx.mm:103 gui/chooser.cpp:47 -#: gui/themebrowser.cpp:56 +#: gui/filebrowser-dialog.cpp:65 gui/themebrowser.cpp:56 msgid "Choose" msgstr "Vlaszt" @@ -89,6 +89,39 @@ msgstr "Megjegyz msgid "Ok" msgstr "Ok" +#: gui/filebrowser-dialog.cpp:49 +msgid "Choose file for loading" +msgstr "" + +#: gui/filebrowser-dialog.cpp:49 +msgid "Enter filename for saving" +msgstr "" + +#: gui/filebrowser-dialog.cpp:132 +#, fuzzy +msgid "Do you really want to overwrite the file?" +msgstr "Biztos hogy trlni akarod ezt a felvtelt?" + +#: gui/filebrowser-dialog.cpp:132 gui/launcher.cpp:793 gui/launcher.cpp:941 +#: gui/launcher.cpp:1000 gui/fluidsynth-dialog.cpp:217 +#: backends/events/symbiansdl/symbiansdl-events.cpp:186 +#: backends/platform/wince/CEActionsPocket.cpp:326 +#: backends/platform/wince/CEActionsSmartphone.cpp:287 +#: backends/platform/wince/CELauncherDialog.cpp:83 +#: engines/kyra/saveload_eob.cpp:557 engines/kyra/saveload_eob.cpp:590 +msgid "Yes" +msgstr "Igen" + +#: gui/filebrowser-dialog.cpp:132 gui/launcher.cpp:793 gui/launcher.cpp:941 +#: gui/launcher.cpp:1000 gui/fluidsynth-dialog.cpp:217 +#: backends/events/symbiansdl/symbiansdl-events.cpp:186 +#: backends/platform/wince/CEActionsPocket.cpp:326 +#: backends/platform/wince/CEActionsSmartphone.cpp:287 +#: backends/platform/wince/CELauncherDialog.cpp:83 +#: engines/kyra/saveload_eob.cpp:557 engines/kyra/saveload_eob.cpp:590 +msgid "No" +msgstr "Nem" + #: gui/gui-manager.cpp:117 backends/keymapper/remap-dialog.cpp:53 #: engines/scumm/help.cpp:126 engines/scumm/help.cpp:141 #: engines/scumm/help.cpp:166 engines/scumm/help.cpp:192 @@ -384,7 +417,7 @@ msgstr "Ez a j msgid "~Q~uit" msgstr "Kilps" -#: gui/launcher.cpp:626 backends/platform/sdl/macosx/appmenu_osx.mm:95 +#: gui/launcher.cpp:626 backends/platform/sdl/macosx/appmenu_osx.mm:106 msgid "Quit ScummVM" msgstr "ScummVM bezrsa" @@ -392,7 +425,7 @@ msgstr "ScummVM bez msgid "A~b~out..." msgstr "Nvjegy" -#: gui/launcher.cpp:627 backends/platform/sdl/macosx/appmenu_osx.mm:69 +#: gui/launcher.cpp:627 backends/platform/sdl/macosx/appmenu_osx.mm:80 msgid "About ScummVM" msgstr "ScummVM nvjegy" @@ -490,26 +523,6 @@ msgstr "" "Biztos hogy futtatod a Masszv jtkdetektort? Ez potencilisan sok jtkot " "hozzad a listhoz." -#: gui/launcher.cpp:793 gui/launcher.cpp:941 gui/launcher.cpp:1000 -#: gui/fluidsynth-dialog.cpp:217 -#: backends/events/symbiansdl/symbiansdl-events.cpp:186 -#: backends/platform/wince/CEActionsPocket.cpp:326 -#: backends/platform/wince/CEActionsSmartphone.cpp:287 -#: backends/platform/wince/CELauncherDialog.cpp:83 -#: engines/kyra/saveload_eob.cpp:557 engines/kyra/saveload_eob.cpp:590 -msgid "Yes" -msgstr "Igen" - -#: gui/launcher.cpp:793 gui/launcher.cpp:941 gui/launcher.cpp:1000 -#: gui/fluidsynth-dialog.cpp:217 -#: backends/events/symbiansdl/symbiansdl-events.cpp:186 -#: backends/platform/wince/CEActionsPocket.cpp:326 -#: backends/platform/wince/CEActionsSmartphone.cpp:287 -#: backends/platform/wince/CELauncherDialog.cpp:83 -#: engines/kyra/saveload_eob.cpp:557 engines/kyra/saveload_eob.cpp:590 -msgid "No" -msgstr "Nem" - #: gui/launcher.cpp:841 msgid "ScummVM couldn't open the specified directory!" msgstr "ScummVM nem tudja megnyitni a vlasztott mappt!" @@ -661,7 +674,7 @@ msgid "Special dithering modes supported by some games" msgstr "Nhny jtk tmogatja a specilis rnyalsi mdokat" #: gui/options.cpp:758 -#: backends/graphics/surfacesdl/surfacesdl-graphics.cpp:2298 +#: backends/graphics/surfacesdl/surfacesdl-graphics.cpp:2313 msgid "Fullscreen mode" msgstr "Teljeskpernys md:" @@ -1118,7 +1131,7 @@ msgstr "GFX letiltva" msgid "Standard Renderer" msgstr "Standard lekpez" -#: gui/ThemeEngine.cpp:348 engines/scumm/dialogs.cpp:661 +#: gui/ThemeEngine.cpp:348 engines/scumm/dialogs.cpp:663 msgid "Standard" msgstr "tlagos" @@ -1364,7 +1377,7 @@ msgstr "Visszat #: engines/dialogs.cpp:116 engines/agi/saveload.cpp:803 #: engines/cruise/menu.cpp:212 engines/drascula/saveload.cpp:336 -#: engines/dreamweb/saveload.cpp:261 engines/neverhood/menumodule.cpp:873 +#: engines/dreamweb/saveload.cpp:261 engines/neverhood/menumodule.cpp:877 #: engines/pegasus/pegasus.cpp:377 engines/sci/engine/kfile.cpp:759 #: engines/toltecs/menu.cpp:281 engines/tsage/scenes.cpp:598 msgid "Save game:" @@ -1377,7 +1390,7 @@ msgstr "J #: backends/platform/wince/CEActionsSmartphone.cpp:231 #: engines/agi/saveload.cpp:803 engines/cruise/menu.cpp:212 #: engines/drascula/saveload.cpp:336 engines/dreamweb/saveload.cpp:261 -#: engines/neverhood/menumodule.cpp:873 engines/pegasus/pegasus.cpp:377 +#: engines/neverhood/menumodule.cpp:877 engines/pegasus/pegasus.cpp:377 #: engines/sci/engine/kfile.cpp:759 engines/scumm/dialogs.cpp:188 #: engines/toltecs/menu.cpp:281 engines/tsage/scenes.cpp:598 msgid "Save" @@ -1713,57 +1726,57 @@ msgstr "K msgid "Right Click" msgstr "Jobb katt" -#: backends/platform/sdl/macosx/appmenu_osx.mm:77 +#: backends/platform/sdl/macosx/appmenu_osx.mm:88 msgid "Hide ScummVM" msgstr "ScummVM elrejtse" -#: backends/platform/sdl/macosx/appmenu_osx.mm:82 +#: backends/platform/sdl/macosx/appmenu_osx.mm:93 msgid "Hide Others" msgstr "Tbbi elrejtse" -#: backends/platform/sdl/macosx/appmenu_osx.mm:87 +#: backends/platform/sdl/macosx/appmenu_osx.mm:98 msgid "Show All" msgstr "Mutasd mind" -#: backends/platform/sdl/macosx/appmenu_osx.mm:109 #: backends/platform/sdl/macosx/appmenu_osx.mm:120 +#: backends/platform/sdl/macosx/appmenu_osx.mm:131 msgid "Window" msgstr "Ablak" -#: backends/platform/sdl/macosx/appmenu_osx.mm:114 +#: backends/platform/sdl/macosx/appmenu_osx.mm:125 msgid "Minimize" msgstr "Kis mret" -#: backends/graphics/surfacesdl/surfacesdl-graphics.cpp:46 +#: backends/graphics/surfacesdl/surfacesdl-graphics.cpp:47 msgid "Normal (no scaling)" msgstr "Norml (nincs tmretezs)" -#: backends/graphics/surfacesdl/surfacesdl-graphics.cpp:65 +#: backends/graphics/surfacesdl/surfacesdl-graphics.cpp:66 msgctxt "lowres" msgid "Normal (no scaling)" msgstr "Norml (nincs tmretezs)" -#: backends/graphics/surfacesdl/surfacesdl-graphics.cpp:2197 +#: backends/graphics/surfacesdl/surfacesdl-graphics.cpp:2212 msgid "Enabled aspect ratio correction" msgstr "Mretarny korrekci engedlyezve" -#: backends/graphics/surfacesdl/surfacesdl-graphics.cpp:2203 +#: backends/graphics/surfacesdl/surfacesdl-graphics.cpp:2218 msgid "Disabled aspect ratio correction" msgstr "Mretarny korrekci letiltva" -#: backends/graphics/surfacesdl/surfacesdl-graphics.cpp:2258 +#: backends/graphics/surfacesdl/surfacesdl-graphics.cpp:2273 msgid "Active graphics filter:" msgstr "Aktv grafikus szrk:" -#: backends/graphics/surfacesdl/surfacesdl-graphics.cpp:2300 +#: backends/graphics/surfacesdl/surfacesdl-graphics.cpp:2315 msgid "Windowed mode" msgstr "Ablakos md" -#: backends/graphics/opengl/opengl-graphics.cpp:118 +#: backends/graphics/opengl/opengl-graphics.cpp:119 msgid "OpenGL" msgstr "OpenGL" -#: backends/graphics/opengl/opengl-graphics.cpp:119 +#: backends/graphics/opengl/opengl-graphics.cpp:120 msgid "OpenGL (No filtering)" msgstr "OpenGL (Nincs szrs)" @@ -2205,13 +2218,13 @@ msgstr "" "jtkmenkben." #: engines/agi/saveload.cpp:816 engines/drascula/saveload.cpp:349 -#: engines/dreamweb/saveload.cpp:169 engines/neverhood/menumodule.cpp:886 +#: engines/dreamweb/saveload.cpp:169 engines/neverhood/menumodule.cpp:890 #: engines/sci/engine/kfile.cpp:858 engines/toltecs/menu.cpp:256 msgid "Restore game:" msgstr "Jtkmenet visszalltsa:" #: engines/agi/saveload.cpp:816 engines/drascula/saveload.cpp:349 -#: engines/dreamweb/saveload.cpp:169 engines/neverhood/menumodule.cpp:886 +#: engines/dreamweb/saveload.cpp:169 engines/neverhood/menumodule.cpp:890 #: engines/sci/engine/kfile.cpp:858 engines/toltecs/menu.cpp:256 msgid "Restore" msgstr "Visszallts" @@ -2757,36 +2770,36 @@ msgstr "~E~l msgid "~N~ext" msgstr "Kvetkez" -#: engines/scumm/dialogs.cpp:600 +#: engines/scumm/dialogs.cpp:602 msgid "Speech Only" msgstr "Csak beszd" -#: engines/scumm/dialogs.cpp:601 +#: engines/scumm/dialogs.cpp:603 msgid "Speech and Subtitles" msgstr "Beszd s felirat" -#: engines/scumm/dialogs.cpp:602 +#: engines/scumm/dialogs.cpp:604 msgid "Subtitles Only" msgstr "Csak felirat" -#: engines/scumm/dialogs.cpp:610 +#: engines/scumm/dialogs.cpp:612 msgctxt "lowres" msgid "Speech & Subs" msgstr "Beszd & Felir" -#: engines/scumm/dialogs.cpp:656 +#: engines/scumm/dialogs.cpp:658 msgid "Select a Proficiency Level." msgstr "Vlassz hozzrts szintet." -#: engines/scumm/dialogs.cpp:658 +#: engines/scumm/dialogs.cpp:660 msgid "Refer to your Loom(TM) manual for help." msgstr "Segtsgrt nzd meg a Loom(TM) kziknyvedet." -#: engines/scumm/dialogs.cpp:662 +#: engines/scumm/dialogs.cpp:664 msgid "Practice" msgstr "Gyakorls" -#: engines/scumm/dialogs.cpp:663 +#: engines/scumm/dialogs.cpp:665 msgid "Expert" msgstr "Szakrt" diff --git a/po/it_IT.po b/po/it_IT.po index 21c4341570..c52eef8f2f 100644 --- a/po/it_IT.po +++ b/po/it_IT.po @@ -7,7 +7,7 @@ msgid "" msgstr "" "Project-Id-Version: ScummVM 1.3.0svn\n" "Report-Msgid-Bugs-To: scummvm-devel@lists.sf.net\n" -"POT-Creation-Date: 2015-10-11 18:59+0100\n" +"POT-Creation-Date: 2015-12-23 00:28+0000\n" "PO-Revision-Date: 2014-07-03 17:59-0600\n" "Last-Translator: Matteo 'Maff' Angelino \n" "Language-Team: Italian\n" @@ -51,13 +51,13 @@ msgid "Go up" msgstr "Su" #: gui/browser.cpp:75 gui/chooser.cpp:46 gui/editrecorddialog.cpp:67 -#: gui/KeysDialog.cpp:43 gui/launcher.cpp:351 gui/massadd.cpp:95 -#: gui/options.cpp:1237 gui/predictivedialog.cpp:74 gui/recorderdialog.cpp:70 -#: gui/recorderdialog.cpp:156 gui/saveload-dialog.cpp:216 -#: gui/saveload-dialog.cpp:276 gui/saveload-dialog.cpp:547 -#: gui/saveload-dialog.cpp:931 gui/themebrowser.cpp:55 -#: gui/fluidsynth-dialog.cpp:152 engines/engine.cpp:483 -#: backends/platform/wii/options.cpp:48 +#: gui/filebrowser-dialog.cpp:64 gui/KeysDialog.cpp:43 gui/launcher.cpp:351 +#: gui/massadd.cpp:95 gui/options.cpp:1237 gui/predictivedialog.cpp:74 +#: gui/recorderdialog.cpp:70 gui/recorderdialog.cpp:156 +#: gui/saveload-dialog.cpp:216 gui/saveload-dialog.cpp:276 +#: gui/saveload-dialog.cpp:547 gui/saveload-dialog.cpp:931 +#: gui/themebrowser.cpp:55 gui/fluidsynth-dialog.cpp:152 +#: engines/engine.cpp:483 backends/platform/wii/options.cpp:48 #: backends/events/default/default-events.cpp:196 #: backends/events/default/default-events.cpp:218 #: engines/drascula/saveload.cpp:49 engines/parallaction/saveload.cpp:274 @@ -66,7 +66,7 @@ msgid "Cancel" msgstr "Annulla" #: gui/browser.cpp:76 gui/browser_osx.mm:103 gui/chooser.cpp:47 -#: gui/themebrowser.cpp:56 +#: gui/filebrowser-dialog.cpp:65 gui/themebrowser.cpp:56 msgid "Choose" msgstr "Scegli" @@ -86,6 +86,39 @@ msgstr "" msgid "Ok" msgstr "" +#: gui/filebrowser-dialog.cpp:49 +msgid "Choose file for loading" +msgstr "" + +#: gui/filebrowser-dialog.cpp:49 +msgid "Enter filename for saving" +msgstr "" + +#: gui/filebrowser-dialog.cpp:132 +#, fuzzy +msgid "Do you really want to overwrite the file?" +msgstr "Sei sicuro di voler eliminare questo salvataggio?" + +#: gui/filebrowser-dialog.cpp:132 gui/launcher.cpp:793 gui/launcher.cpp:941 +#: gui/launcher.cpp:1000 gui/fluidsynth-dialog.cpp:217 +#: backends/events/symbiansdl/symbiansdl-events.cpp:186 +#: backends/platform/wince/CEActionsPocket.cpp:326 +#: backends/platform/wince/CEActionsSmartphone.cpp:287 +#: backends/platform/wince/CELauncherDialog.cpp:83 +#: engines/kyra/saveload_eob.cpp:557 engines/kyra/saveload_eob.cpp:590 +msgid "Yes" +msgstr "S" + +#: gui/filebrowser-dialog.cpp:132 gui/launcher.cpp:793 gui/launcher.cpp:941 +#: gui/launcher.cpp:1000 gui/fluidsynth-dialog.cpp:217 +#: backends/events/symbiansdl/symbiansdl-events.cpp:186 +#: backends/platform/wince/CEActionsPocket.cpp:326 +#: backends/platform/wince/CEActionsSmartphone.cpp:287 +#: backends/platform/wince/CELauncherDialog.cpp:83 +#: engines/kyra/saveload_eob.cpp:557 engines/kyra/saveload_eob.cpp:590 +msgid "No" +msgstr "No" + #: gui/gui-manager.cpp:117 backends/keymapper/remap-dialog.cpp:53 #: engines/scumm/help.cpp:126 engines/scumm/help.cpp:141 #: engines/scumm/help.cpp:166 engines/scumm/help.cpp:192 @@ -382,7 +415,7 @@ msgstr "Questo ID di gioco msgid "~Q~uit" msgstr "C~h~iudi" -#: gui/launcher.cpp:626 backends/platform/sdl/macosx/appmenu_osx.mm:95 +#: gui/launcher.cpp:626 backends/platform/sdl/macosx/appmenu_osx.mm:106 msgid "Quit ScummVM" msgstr "Esci da ScummVM" @@ -390,7 +423,7 @@ msgstr "Esci da ScummVM" msgid "A~b~out..." msgstr "~I~nfo..." -#: gui/launcher.cpp:627 backends/platform/sdl/macosx/appmenu_osx.mm:69 +#: gui/launcher.cpp:627 backends/platform/sdl/macosx/appmenu_osx.mm:80 msgid "About ScummVM" msgstr "Informazioni su ScummVM" @@ -488,26 +521,6 @@ msgstr "" "Vuoi davvero eseguire il rilevatore di giochi in massa? Potrebbe aggiungere " "un numero enorme di giochi." -#: gui/launcher.cpp:793 gui/launcher.cpp:941 gui/launcher.cpp:1000 -#: gui/fluidsynth-dialog.cpp:217 -#: backends/events/symbiansdl/symbiansdl-events.cpp:186 -#: backends/platform/wince/CEActionsPocket.cpp:326 -#: backends/platform/wince/CEActionsSmartphone.cpp:287 -#: backends/platform/wince/CELauncherDialog.cpp:83 -#: engines/kyra/saveload_eob.cpp:557 engines/kyra/saveload_eob.cpp:590 -msgid "Yes" -msgstr "S" - -#: gui/launcher.cpp:793 gui/launcher.cpp:941 gui/launcher.cpp:1000 -#: gui/fluidsynth-dialog.cpp:217 -#: backends/events/symbiansdl/symbiansdl-events.cpp:186 -#: backends/platform/wince/CEActionsPocket.cpp:326 -#: backends/platform/wince/CEActionsSmartphone.cpp:287 -#: backends/platform/wince/CELauncherDialog.cpp:83 -#: engines/kyra/saveload_eob.cpp:557 engines/kyra/saveload_eob.cpp:590 -msgid "No" -msgstr "No" - #: gui/launcher.cpp:841 msgid "ScummVM couldn't open the specified directory!" msgstr "ScummVM non ha potuto aprire la cartella specificata!" @@ -664,7 +677,7 @@ msgid "Special dithering modes supported by some games" msgstr "Modalit di resa grafica speciali supportate da alcuni giochi" #: gui/options.cpp:758 -#: backends/graphics/surfacesdl/surfacesdl-graphics.cpp:2298 +#: backends/graphics/surfacesdl/surfacesdl-graphics.cpp:2313 msgid "Fullscreen mode" msgstr "Modalit a schermo intero" @@ -1129,7 +1142,7 @@ msgstr "Grafica disattivata" msgid "Standard Renderer" msgstr "Renderer standard" -#: gui/ThemeEngine.cpp:348 engines/scumm/dialogs.cpp:661 +#: gui/ThemeEngine.cpp:348 engines/scumm/dialogs.cpp:663 msgid "Standard" msgstr "Medio" @@ -1378,7 +1391,7 @@ msgstr "~V~ai a elenco giochi" #: engines/dialogs.cpp:116 engines/agi/saveload.cpp:803 #: engines/cruise/menu.cpp:212 engines/drascula/saveload.cpp:336 -#: engines/dreamweb/saveload.cpp:261 engines/neverhood/menumodule.cpp:873 +#: engines/dreamweb/saveload.cpp:261 engines/neverhood/menumodule.cpp:877 #: engines/pegasus/pegasus.cpp:377 engines/sci/engine/kfile.cpp:759 #: engines/toltecs/menu.cpp:281 engines/tsage/scenes.cpp:598 msgid "Save game:" @@ -1391,7 +1404,7 @@ msgstr "Salva gioco:" #: backends/platform/wince/CEActionsSmartphone.cpp:231 #: engines/agi/saveload.cpp:803 engines/cruise/menu.cpp:212 #: engines/drascula/saveload.cpp:336 engines/dreamweb/saveload.cpp:261 -#: engines/neverhood/menumodule.cpp:873 engines/pegasus/pegasus.cpp:377 +#: engines/neverhood/menumodule.cpp:877 engines/pegasus/pegasus.cpp:377 #: engines/sci/engine/kfile.cpp:759 engines/scumm/dialogs.cpp:188 #: engines/toltecs/menu.cpp:281 engines/tsage/scenes.cpp:598 msgid "Save" @@ -1732,57 +1745,57 @@ msgstr "Clic centrale" msgid "Right Click" msgstr "Clic destro" -#: backends/platform/sdl/macosx/appmenu_osx.mm:77 +#: backends/platform/sdl/macosx/appmenu_osx.mm:88 msgid "Hide ScummVM" msgstr "Nascondi ScummVM" -#: backends/platform/sdl/macosx/appmenu_osx.mm:82 +#: backends/platform/sdl/macosx/appmenu_osx.mm:93 msgid "Hide Others" msgstr "Nascondi altre" -#: backends/platform/sdl/macosx/appmenu_osx.mm:87 +#: backends/platform/sdl/macosx/appmenu_osx.mm:98 msgid "Show All" msgstr "Mostra tutte" -#: backends/platform/sdl/macosx/appmenu_osx.mm:109 #: backends/platform/sdl/macosx/appmenu_osx.mm:120 +#: backends/platform/sdl/macosx/appmenu_osx.mm:131 msgid "Window" msgstr "Finestra" -#: backends/platform/sdl/macosx/appmenu_osx.mm:114 +#: backends/platform/sdl/macosx/appmenu_osx.mm:125 msgid "Minimize" msgstr "Contrai" -#: backends/graphics/surfacesdl/surfacesdl-graphics.cpp:46 +#: backends/graphics/surfacesdl/surfacesdl-graphics.cpp:47 msgid "Normal (no scaling)" msgstr "Normale (nessun ridimensionamento)" -#: backends/graphics/surfacesdl/surfacesdl-graphics.cpp:65 +#: backends/graphics/surfacesdl/surfacesdl-graphics.cpp:66 msgctxt "lowres" msgid "Normal (no scaling)" msgstr "Normale (no ridim.)" -#: backends/graphics/surfacesdl/surfacesdl-graphics.cpp:2197 +#: backends/graphics/surfacesdl/surfacesdl-graphics.cpp:2212 msgid "Enabled aspect ratio correction" msgstr "Correzione proporzioni attivata" -#: backends/graphics/surfacesdl/surfacesdl-graphics.cpp:2203 +#: backends/graphics/surfacesdl/surfacesdl-graphics.cpp:2218 msgid "Disabled aspect ratio correction" msgstr "Correzione proporzioni disattivata" -#: backends/graphics/surfacesdl/surfacesdl-graphics.cpp:2258 +#: backends/graphics/surfacesdl/surfacesdl-graphics.cpp:2273 msgid "Active graphics filter:" msgstr "Filtro grafico attivo:" -#: backends/graphics/surfacesdl/surfacesdl-graphics.cpp:2300 +#: backends/graphics/surfacesdl/surfacesdl-graphics.cpp:2315 msgid "Windowed mode" msgstr "Modalit finestra" -#: backends/graphics/opengl/opengl-graphics.cpp:118 +#: backends/graphics/opengl/opengl-graphics.cpp:119 msgid "OpenGL" msgstr "OpenGL" -#: backends/graphics/opengl/opengl-graphics.cpp:119 +#: backends/graphics/opengl/opengl-graphics.cpp:120 msgid "OpenGL (No filtering)" msgstr "OpenGL (senza filtri)" @@ -2226,13 +2239,13 @@ msgid "" msgstr "" #: engines/agi/saveload.cpp:816 engines/drascula/saveload.cpp:349 -#: engines/dreamweb/saveload.cpp:169 engines/neverhood/menumodule.cpp:886 +#: engines/dreamweb/saveload.cpp:169 engines/neverhood/menumodule.cpp:890 #: engines/sci/engine/kfile.cpp:858 engines/toltecs/menu.cpp:256 msgid "Restore game:" msgstr "Ripristina gioco:" #: engines/agi/saveload.cpp:816 engines/drascula/saveload.cpp:349 -#: engines/dreamweb/saveload.cpp:169 engines/neverhood/menumodule.cpp:886 +#: engines/dreamweb/saveload.cpp:169 engines/neverhood/menumodule.cpp:890 #: engines/sci/engine/kfile.cpp:858 engines/toltecs/menu.cpp:256 msgid "Restore" msgstr "Ripristina" @@ -2771,36 +2784,36 @@ msgstr "~P~recedenti" msgid "~N~ext" msgstr "~S~uccessivi" -#: engines/scumm/dialogs.cpp:600 +#: engines/scumm/dialogs.cpp:602 msgid "Speech Only" msgstr "Solo voci" -#: engines/scumm/dialogs.cpp:601 +#: engines/scumm/dialogs.cpp:603 msgid "Speech and Subtitles" msgstr "Voci e testo" -#: engines/scumm/dialogs.cpp:602 +#: engines/scumm/dialogs.cpp:604 msgid "Subtitles Only" msgstr "Solo testo" -#: engines/scumm/dialogs.cpp:610 +#: engines/scumm/dialogs.cpp:612 msgctxt "lowres" msgid "Speech & Subs" msgstr "Voci e testo" -#: engines/scumm/dialogs.cpp:656 +#: engines/scumm/dialogs.cpp:658 msgid "Select a Proficiency Level." msgstr "Selezionate un livello di difficolt." -#: engines/scumm/dialogs.cpp:658 +#: engines/scumm/dialogs.cpp:660 msgid "Refer to your Loom(TM) manual for help." msgstr "Consultate il manuale delle istruzioni." -#: engines/scumm/dialogs.cpp:662 +#: engines/scumm/dialogs.cpp:664 msgid "Practice" msgstr "Base" -#: engines/scumm/dialogs.cpp:663 +#: engines/scumm/dialogs.cpp:665 msgid "Expert" msgstr "Expert" diff --git a/po/nb_NO.po b/po/nb_NO.po index 086cb488a7..e75e34196c 100644 --- a/po/nb_NO.po +++ b/po/nb_NO.po @@ -7,7 +7,7 @@ msgid "" msgstr "" "Project-Id-Version: ScummVM 1.3.0svn\n" "Report-Msgid-Bugs-To: scummvm-devel@lists.sf.net\n" -"POT-Creation-Date: 2015-10-11 18:59+0100\n" +"POT-Creation-Date: 2015-12-23 00:28+0000\n" "PO-Revision-Date: 2014-07-11 00:02+0100\n" "Last-Translator: Einar Johan Tran Smen \n" "Language-Team: somaen \n" @@ -54,13 +54,13 @@ msgid "Go up" msgstr "Oppover" #: gui/browser.cpp:75 gui/chooser.cpp:46 gui/editrecorddialog.cpp:67 -#: gui/KeysDialog.cpp:43 gui/launcher.cpp:351 gui/massadd.cpp:95 -#: gui/options.cpp:1237 gui/predictivedialog.cpp:74 gui/recorderdialog.cpp:70 -#: gui/recorderdialog.cpp:156 gui/saveload-dialog.cpp:216 -#: gui/saveload-dialog.cpp:276 gui/saveload-dialog.cpp:547 -#: gui/saveload-dialog.cpp:931 gui/themebrowser.cpp:55 -#: gui/fluidsynth-dialog.cpp:152 engines/engine.cpp:483 -#: backends/platform/wii/options.cpp:48 +#: gui/filebrowser-dialog.cpp:64 gui/KeysDialog.cpp:43 gui/launcher.cpp:351 +#: gui/massadd.cpp:95 gui/options.cpp:1237 gui/predictivedialog.cpp:74 +#: gui/recorderdialog.cpp:70 gui/recorderdialog.cpp:156 +#: gui/saveload-dialog.cpp:216 gui/saveload-dialog.cpp:276 +#: gui/saveload-dialog.cpp:547 gui/saveload-dialog.cpp:931 +#: gui/themebrowser.cpp:55 gui/fluidsynth-dialog.cpp:152 +#: engines/engine.cpp:483 backends/platform/wii/options.cpp:48 #: backends/events/default/default-events.cpp:196 #: backends/events/default/default-events.cpp:218 #: engines/drascula/saveload.cpp:49 engines/parallaction/saveload.cpp:274 @@ -69,7 +69,7 @@ msgid "Cancel" msgstr "Avbryt" #: gui/browser.cpp:76 gui/browser_osx.mm:103 gui/chooser.cpp:47 -#: gui/themebrowser.cpp:56 +#: gui/filebrowser-dialog.cpp:65 gui/themebrowser.cpp:56 msgid "Choose" msgstr "Velg" @@ -89,6 +89,39 @@ msgstr "" msgid "Ok" msgstr "" +#: gui/filebrowser-dialog.cpp:49 +msgid "Choose file for loading" +msgstr "" + +#: gui/filebrowser-dialog.cpp:49 +msgid "Enter filename for saving" +msgstr "" + +#: gui/filebrowser-dialog.cpp:132 +#, fuzzy +msgid "Do you really want to overwrite the file?" +msgstr "Vil du virkelig slette dette lagrede spillet?" + +#: gui/filebrowser-dialog.cpp:132 gui/launcher.cpp:793 gui/launcher.cpp:941 +#: gui/launcher.cpp:1000 gui/fluidsynth-dialog.cpp:217 +#: backends/events/symbiansdl/symbiansdl-events.cpp:186 +#: backends/platform/wince/CEActionsPocket.cpp:326 +#: backends/platform/wince/CEActionsSmartphone.cpp:287 +#: backends/platform/wince/CELauncherDialog.cpp:83 +#: engines/kyra/saveload_eob.cpp:557 engines/kyra/saveload_eob.cpp:590 +msgid "Yes" +msgstr "Ja" + +#: gui/filebrowser-dialog.cpp:132 gui/launcher.cpp:793 gui/launcher.cpp:941 +#: gui/launcher.cpp:1000 gui/fluidsynth-dialog.cpp:217 +#: backends/events/symbiansdl/symbiansdl-events.cpp:186 +#: backends/platform/wince/CEActionsPocket.cpp:326 +#: backends/platform/wince/CEActionsSmartphone.cpp:287 +#: backends/platform/wince/CELauncherDialog.cpp:83 +#: engines/kyra/saveload_eob.cpp:557 engines/kyra/saveload_eob.cpp:590 +msgid "No" +msgstr "Nei" + #: gui/gui-manager.cpp:117 backends/keymapper/remap-dialog.cpp:53 #: engines/scumm/help.cpp:126 engines/scumm/help.cpp:141 #: engines/scumm/help.cpp:166 engines/scumm/help.cpp:192 @@ -386,7 +419,7 @@ msgstr "Denne spill-IDen er allerede i bruk. Vennligst velg en annen." msgid "~Q~uit" msgstr "~A~vslutt" -#: gui/launcher.cpp:626 backends/platform/sdl/macosx/appmenu_osx.mm:95 +#: gui/launcher.cpp:626 backends/platform/sdl/macosx/appmenu_osx.mm:106 msgid "Quit ScummVM" msgstr "Avslutt ScummVM" @@ -394,7 +427,7 @@ msgstr "Avslutt ScummVM" msgid "A~b~out..." msgstr "~O~m..." -#: gui/launcher.cpp:627 backends/platform/sdl/macosx/appmenu_osx.mm:69 +#: gui/launcher.cpp:627 backends/platform/sdl/macosx/appmenu_osx.mm:80 msgid "About ScummVM" msgstr "Om ScummVM" @@ -492,26 +525,6 @@ msgstr "" "Vil du virkelig kjre flerspill-finneren? Dette kan potensielt legge til et " "stort antall spill." -#: gui/launcher.cpp:793 gui/launcher.cpp:941 gui/launcher.cpp:1000 -#: gui/fluidsynth-dialog.cpp:217 -#: backends/events/symbiansdl/symbiansdl-events.cpp:186 -#: backends/platform/wince/CEActionsPocket.cpp:326 -#: backends/platform/wince/CEActionsSmartphone.cpp:287 -#: backends/platform/wince/CELauncherDialog.cpp:83 -#: engines/kyra/saveload_eob.cpp:557 engines/kyra/saveload_eob.cpp:590 -msgid "Yes" -msgstr "Ja" - -#: gui/launcher.cpp:793 gui/launcher.cpp:941 gui/launcher.cpp:1000 -#: gui/fluidsynth-dialog.cpp:217 -#: backends/events/symbiansdl/symbiansdl-events.cpp:186 -#: backends/platform/wince/CEActionsPocket.cpp:326 -#: backends/platform/wince/CEActionsSmartphone.cpp:287 -#: backends/platform/wince/CELauncherDialog.cpp:83 -#: engines/kyra/saveload_eob.cpp:557 engines/kyra/saveload_eob.cpp:590 -msgid "No" -msgstr "Nei" - #: gui/launcher.cpp:841 msgid "ScummVM couldn't open the specified directory!" msgstr "ScummVM kunne ikke pne den valgte mappen!" @@ -667,7 +680,7 @@ msgid "Special dithering modes supported by some games" msgstr "Spesiel dithering-modus stttet av enkelte spill" #: gui/options.cpp:758 -#: backends/graphics/surfacesdl/surfacesdl-graphics.cpp:2298 +#: backends/graphics/surfacesdl/surfacesdl-graphics.cpp:2313 msgid "Fullscreen mode" msgstr "Fullskjermsmodus" @@ -1126,7 +1139,7 @@ msgstr "Deaktivert GFX" msgid "Standard Renderer" msgstr "Standard tegner" -#: gui/ThemeEngine.cpp:348 engines/scumm/dialogs.cpp:661 +#: gui/ThemeEngine.cpp:348 engines/scumm/dialogs.cpp:663 msgid "Standard" msgstr "Standard" @@ -1373,7 +1386,7 @@ msgstr "~T~ilbake til oppstarter" #: engines/dialogs.cpp:116 engines/agi/saveload.cpp:803 #: engines/cruise/menu.cpp:212 engines/drascula/saveload.cpp:336 -#: engines/dreamweb/saveload.cpp:261 engines/neverhood/menumodule.cpp:873 +#: engines/dreamweb/saveload.cpp:261 engines/neverhood/menumodule.cpp:877 #: engines/pegasus/pegasus.cpp:377 engines/sci/engine/kfile.cpp:759 #: engines/toltecs/menu.cpp:281 engines/tsage/scenes.cpp:598 msgid "Save game:" @@ -1386,7 +1399,7 @@ msgstr "Lagret spill:" #: backends/platform/wince/CEActionsSmartphone.cpp:231 #: engines/agi/saveload.cpp:803 engines/cruise/menu.cpp:212 #: engines/drascula/saveload.cpp:336 engines/dreamweb/saveload.cpp:261 -#: engines/neverhood/menumodule.cpp:873 engines/pegasus/pegasus.cpp:377 +#: engines/neverhood/menumodule.cpp:877 engines/pegasus/pegasus.cpp:377 #: engines/sci/engine/kfile.cpp:759 engines/scumm/dialogs.cpp:188 #: engines/toltecs/menu.cpp:281 engines/tsage/scenes.cpp:598 msgid "Save" @@ -1725,57 +1738,57 @@ msgstr "Midtklikk" msgid "Right Click" msgstr "Hyreklikk" -#: backends/platform/sdl/macosx/appmenu_osx.mm:77 +#: backends/platform/sdl/macosx/appmenu_osx.mm:88 msgid "Hide ScummVM" msgstr "Skjul ScummVM" -#: backends/platform/sdl/macosx/appmenu_osx.mm:82 +#: backends/platform/sdl/macosx/appmenu_osx.mm:93 msgid "Hide Others" msgstr "Skjul andre" -#: backends/platform/sdl/macosx/appmenu_osx.mm:87 +#: backends/platform/sdl/macosx/appmenu_osx.mm:98 msgid "Show All" msgstr "Vis alle" -#: backends/platform/sdl/macosx/appmenu_osx.mm:109 #: backends/platform/sdl/macosx/appmenu_osx.mm:120 +#: backends/platform/sdl/macosx/appmenu_osx.mm:131 msgid "Window" msgstr "Vindu" -#: backends/platform/sdl/macosx/appmenu_osx.mm:114 +#: backends/platform/sdl/macosx/appmenu_osx.mm:125 msgid "Minimize" msgstr "Minimer" -#: backends/graphics/surfacesdl/surfacesdl-graphics.cpp:46 +#: backends/graphics/surfacesdl/surfacesdl-graphics.cpp:47 msgid "Normal (no scaling)" msgstr "Normal (ingen skalering)" -#: backends/graphics/surfacesdl/surfacesdl-graphics.cpp:65 +#: backends/graphics/surfacesdl/surfacesdl-graphics.cpp:66 msgctxt "lowres" msgid "Normal (no scaling)" msgstr "Normal (ingen skalering)" -#: backends/graphics/surfacesdl/surfacesdl-graphics.cpp:2197 +#: backends/graphics/surfacesdl/surfacesdl-graphics.cpp:2212 msgid "Enabled aspect ratio correction" msgstr "Aspekt-rate korrigering aktivert" -#: backends/graphics/surfacesdl/surfacesdl-graphics.cpp:2203 +#: backends/graphics/surfacesdl/surfacesdl-graphics.cpp:2218 msgid "Disabled aspect ratio correction" msgstr "Aspekt-rate korrigering deaktivert" -#: backends/graphics/surfacesdl/surfacesdl-graphics.cpp:2258 +#: backends/graphics/surfacesdl/surfacesdl-graphics.cpp:2273 msgid "Active graphics filter:" msgstr "Aktivt grafikkfilter:" -#: backends/graphics/surfacesdl/surfacesdl-graphics.cpp:2300 +#: backends/graphics/surfacesdl/surfacesdl-graphics.cpp:2315 msgid "Windowed mode" msgstr "Vindusmodus" -#: backends/graphics/opengl/opengl-graphics.cpp:118 +#: backends/graphics/opengl/opengl-graphics.cpp:119 msgid "OpenGL" msgstr "OpenGL" -#: backends/graphics/opengl/opengl-graphics.cpp:119 +#: backends/graphics/opengl/opengl-graphics.cpp:120 msgid "OpenGL (No filtering)" msgstr "OpenGL (Ingen filtrering)" @@ -2218,13 +2231,13 @@ msgid "" msgstr "" #: engines/agi/saveload.cpp:816 engines/drascula/saveload.cpp:349 -#: engines/dreamweb/saveload.cpp:169 engines/neverhood/menumodule.cpp:886 +#: engines/dreamweb/saveload.cpp:169 engines/neverhood/menumodule.cpp:890 #: engines/sci/engine/kfile.cpp:858 engines/toltecs/menu.cpp:256 msgid "Restore game:" msgstr "Gjennopprett spill:" #: engines/agi/saveload.cpp:816 engines/drascula/saveload.cpp:349 -#: engines/dreamweb/saveload.cpp:169 engines/neverhood/menumodule.cpp:886 +#: engines/dreamweb/saveload.cpp:169 engines/neverhood/menumodule.cpp:890 #: engines/sci/engine/kfile.cpp:858 engines/toltecs/menu.cpp:256 msgid "Restore" msgstr "Gjenopprett" @@ -2762,36 +2775,36 @@ msgstr "~F~orrige" msgid "~N~ext" msgstr "~N~este" -#: engines/scumm/dialogs.cpp:600 +#: engines/scumm/dialogs.cpp:602 msgid "Speech Only" msgstr "Kun tale" -#: engines/scumm/dialogs.cpp:601 +#: engines/scumm/dialogs.cpp:603 msgid "Speech and Subtitles" msgstr "Tale og undertekster" -#: engines/scumm/dialogs.cpp:602 +#: engines/scumm/dialogs.cpp:604 msgid "Subtitles Only" msgstr "Kun undertekster" -#: engines/scumm/dialogs.cpp:610 +#: engines/scumm/dialogs.cpp:612 msgctxt "lowres" msgid "Speech & Subs" msgstr "Tekst & Tale" -#: engines/scumm/dialogs.cpp:656 +#: engines/scumm/dialogs.cpp:658 msgid "Select a Proficiency Level." msgstr "Velg ferdighetsniv" -#: engines/scumm/dialogs.cpp:658 +#: engines/scumm/dialogs.cpp:660 msgid "Refer to your Loom(TM) manual for help." msgstr "Referer til Loom(TM)-hndboka di for hjelp." -#: engines/scumm/dialogs.cpp:662 +#: engines/scumm/dialogs.cpp:664 msgid "Practice" msgstr "Trening" -#: engines/scumm/dialogs.cpp:663 +#: engines/scumm/dialogs.cpp:665 msgid "Expert" msgstr "Ekspert" diff --git a/po/nl_NL.po b/po/nl_NL.po index 0f4548951d..4116ee9838 100644 --- a/po/nl_NL.po +++ b/po/nl_NL.po @@ -7,7 +7,7 @@ msgid "" msgstr "" "Project-Id-Version: ScummVM 1.8.0git\n" "Report-Msgid-Bugs-To: scummvm-devel@lists.sf.net\n" -"POT-Creation-Date: 2015-10-11 18:59+0100\n" +"POT-Creation-Date: 2015-12-23 00:28+0000\n" "PO-Revision-Date: 2014-11-25 20:46+0100\n" "Last-Translator: Ben Castricum \n" "Language-Team: Ben Castricum \n" @@ -54,13 +54,13 @@ msgid "Go up" msgstr "Ga omhoog" #: gui/browser.cpp:75 gui/chooser.cpp:46 gui/editrecorddialog.cpp:67 -#: gui/KeysDialog.cpp:43 gui/launcher.cpp:351 gui/massadd.cpp:95 -#: gui/options.cpp:1237 gui/predictivedialog.cpp:74 gui/recorderdialog.cpp:70 -#: gui/recorderdialog.cpp:156 gui/saveload-dialog.cpp:216 -#: gui/saveload-dialog.cpp:276 gui/saveload-dialog.cpp:547 -#: gui/saveload-dialog.cpp:931 gui/themebrowser.cpp:55 -#: gui/fluidsynth-dialog.cpp:152 engines/engine.cpp:483 -#: backends/platform/wii/options.cpp:48 +#: gui/filebrowser-dialog.cpp:64 gui/KeysDialog.cpp:43 gui/launcher.cpp:351 +#: gui/massadd.cpp:95 gui/options.cpp:1237 gui/predictivedialog.cpp:74 +#: gui/recorderdialog.cpp:70 gui/recorderdialog.cpp:156 +#: gui/saveload-dialog.cpp:216 gui/saveload-dialog.cpp:276 +#: gui/saveload-dialog.cpp:547 gui/saveload-dialog.cpp:931 +#: gui/themebrowser.cpp:55 gui/fluidsynth-dialog.cpp:152 +#: engines/engine.cpp:483 backends/platform/wii/options.cpp:48 #: backends/events/default/default-events.cpp:196 #: backends/events/default/default-events.cpp:218 #: engines/drascula/saveload.cpp:49 engines/parallaction/saveload.cpp:274 @@ -69,7 +69,7 @@ msgid "Cancel" msgstr "Annuleren" #: gui/browser.cpp:76 gui/browser_osx.mm:103 gui/chooser.cpp:47 -#: gui/themebrowser.cpp:56 +#: gui/filebrowser-dialog.cpp:65 gui/themebrowser.cpp:56 msgid "Choose" msgstr "Selecteer" @@ -89,6 +89,39 @@ msgstr "" msgid "Ok" msgstr "" +#: gui/filebrowser-dialog.cpp:49 +msgid "Choose file for loading" +msgstr "" + +#: gui/filebrowser-dialog.cpp:49 +msgid "Enter filename for saving" +msgstr "" + +#: gui/filebrowser-dialog.cpp:132 +#, fuzzy +msgid "Do you really want to overwrite the file?" +msgstr "Wilt u dit opgeslagen spel echt verwijderen?" + +#: gui/filebrowser-dialog.cpp:132 gui/launcher.cpp:793 gui/launcher.cpp:941 +#: gui/launcher.cpp:1000 gui/fluidsynth-dialog.cpp:217 +#: backends/events/symbiansdl/symbiansdl-events.cpp:186 +#: backends/platform/wince/CEActionsPocket.cpp:326 +#: backends/platform/wince/CEActionsSmartphone.cpp:287 +#: backends/platform/wince/CELauncherDialog.cpp:83 +#: engines/kyra/saveload_eob.cpp:557 engines/kyra/saveload_eob.cpp:590 +msgid "Yes" +msgstr "Ja" + +#: gui/filebrowser-dialog.cpp:132 gui/launcher.cpp:793 gui/launcher.cpp:941 +#: gui/launcher.cpp:1000 gui/fluidsynth-dialog.cpp:217 +#: backends/events/symbiansdl/symbiansdl-events.cpp:186 +#: backends/platform/wince/CEActionsPocket.cpp:326 +#: backends/platform/wince/CEActionsSmartphone.cpp:287 +#: backends/platform/wince/CELauncherDialog.cpp:83 +#: engines/kyra/saveload_eob.cpp:557 engines/kyra/saveload_eob.cpp:590 +msgid "No" +msgstr "Nee" + #: gui/gui-manager.cpp:117 backends/keymapper/remap-dialog.cpp:53 #: engines/scumm/help.cpp:126 engines/scumm/help.cpp:141 #: engines/scumm/help.cpp:166 engines/scumm/help.cpp:192 @@ -386,7 +419,7 @@ msgstr "Dit spel-ID is al in gebruik. Kies a.u.b. een andere." msgid "~Q~uit" msgstr "~S~toppen" -#: gui/launcher.cpp:626 backends/platform/sdl/macosx/appmenu_osx.mm:95 +#: gui/launcher.cpp:626 backends/platform/sdl/macosx/appmenu_osx.mm:106 msgid "Quit ScummVM" msgstr "Hiermee verlaat u ScummVM." @@ -394,7 +427,7 @@ msgstr "Hiermee verlaat u ScummVM." msgid "A~b~out..." msgstr "O~v~er..." -#: gui/launcher.cpp:627 backends/platform/sdl/macosx/appmenu_osx.mm:69 +#: gui/launcher.cpp:627 backends/platform/sdl/macosx/appmenu_osx.mm:80 msgid "About ScummVM" msgstr "Geeft informatie over ScummVM." @@ -494,26 +527,6 @@ msgstr "" "Wilt u echt de mass game detector draaien? Dit voegt potentieel een groot " "aantal spellen toe." -#: gui/launcher.cpp:793 gui/launcher.cpp:941 gui/launcher.cpp:1000 -#: gui/fluidsynth-dialog.cpp:217 -#: backends/events/symbiansdl/symbiansdl-events.cpp:186 -#: backends/platform/wince/CEActionsPocket.cpp:326 -#: backends/platform/wince/CEActionsSmartphone.cpp:287 -#: backends/platform/wince/CELauncherDialog.cpp:83 -#: engines/kyra/saveload_eob.cpp:557 engines/kyra/saveload_eob.cpp:590 -msgid "Yes" -msgstr "Ja" - -#: gui/launcher.cpp:793 gui/launcher.cpp:941 gui/launcher.cpp:1000 -#: gui/fluidsynth-dialog.cpp:217 -#: backends/events/symbiansdl/symbiansdl-events.cpp:186 -#: backends/platform/wince/CEActionsPocket.cpp:326 -#: backends/platform/wince/CEActionsSmartphone.cpp:287 -#: backends/platform/wince/CELauncherDialog.cpp:83 -#: engines/kyra/saveload_eob.cpp:557 engines/kyra/saveload_eob.cpp:590 -msgid "No" -msgstr "Nee" - #: gui/launcher.cpp:841 msgid "ScummVM couldn't open the specified directory!" msgstr "ScummVM kon de opgegeven map niet openen!" @@ -672,7 +685,7 @@ msgid "Special dithering modes supported by some games" msgstr "Speciale ditheringmodi die door sommige games ondersteund worden." #: gui/options.cpp:758 -#: backends/graphics/surfacesdl/surfacesdl-graphics.cpp:2298 +#: backends/graphics/surfacesdl/surfacesdl-graphics.cpp:2313 msgid "Fullscreen mode" msgstr "Volledig-scherm modus" @@ -1138,7 +1151,7 @@ msgstr "GFX uitgeschakeld" msgid "Standard Renderer" msgstr "Standaard Renderer" -#: gui/ThemeEngine.cpp:348 engines/scumm/dialogs.cpp:661 +#: gui/ThemeEngine.cpp:348 engines/scumm/dialogs.cpp:663 msgid "Standard" msgstr "Standaard" @@ -1387,7 +1400,7 @@ msgstr "S~t~artmenu" #: engines/dialogs.cpp:116 engines/agi/saveload.cpp:803 #: engines/cruise/menu.cpp:212 engines/drascula/saveload.cpp:336 -#: engines/dreamweb/saveload.cpp:261 engines/neverhood/menumodule.cpp:873 +#: engines/dreamweb/saveload.cpp:261 engines/neverhood/menumodule.cpp:877 #: engines/pegasus/pegasus.cpp:377 engines/sci/engine/kfile.cpp:759 #: engines/toltecs/menu.cpp:281 engines/tsage/scenes.cpp:598 msgid "Save game:" @@ -1400,7 +1413,7 @@ msgstr "Spel opslaan:" #: backends/platform/wince/CEActionsSmartphone.cpp:231 #: engines/agi/saveload.cpp:803 engines/cruise/menu.cpp:212 #: engines/drascula/saveload.cpp:336 engines/dreamweb/saveload.cpp:261 -#: engines/neverhood/menumodule.cpp:873 engines/pegasus/pegasus.cpp:377 +#: engines/neverhood/menumodule.cpp:877 engines/pegasus/pegasus.cpp:377 #: engines/sci/engine/kfile.cpp:759 engines/scumm/dialogs.cpp:188 #: engines/toltecs/menu.cpp:281 engines/tsage/scenes.cpp:598 msgid "Save" @@ -1742,57 +1755,57 @@ msgstr "Middelste Klik" msgid "Right Click" msgstr "Rechter klik" -#: backends/platform/sdl/macosx/appmenu_osx.mm:77 +#: backends/platform/sdl/macosx/appmenu_osx.mm:88 msgid "Hide ScummVM" msgstr "Verberg ScummVM" -#: backends/platform/sdl/macosx/appmenu_osx.mm:82 +#: backends/platform/sdl/macosx/appmenu_osx.mm:93 msgid "Hide Others" msgstr "Verberg Anderen" -#: backends/platform/sdl/macosx/appmenu_osx.mm:87 +#: backends/platform/sdl/macosx/appmenu_osx.mm:98 msgid "Show All" msgstr "Toon Alles" -#: backends/platform/sdl/macosx/appmenu_osx.mm:109 #: backends/platform/sdl/macosx/appmenu_osx.mm:120 +#: backends/platform/sdl/macosx/appmenu_osx.mm:131 msgid "Window" msgstr "Venster" -#: backends/platform/sdl/macosx/appmenu_osx.mm:114 +#: backends/platform/sdl/macosx/appmenu_osx.mm:125 msgid "Minimize" msgstr "Minimaliseer" -#: backends/graphics/surfacesdl/surfacesdl-graphics.cpp:46 +#: backends/graphics/surfacesdl/surfacesdl-graphics.cpp:47 msgid "Normal (no scaling)" msgstr "Normaal (niet schalen)" -#: backends/graphics/surfacesdl/surfacesdl-graphics.cpp:65 +#: backends/graphics/surfacesdl/surfacesdl-graphics.cpp:66 msgctxt "lowres" msgid "Normal (no scaling)" msgstr "Normaal (niet schalen)" -#: backends/graphics/surfacesdl/surfacesdl-graphics.cpp:2197 +#: backends/graphics/surfacesdl/surfacesdl-graphics.cpp:2212 msgid "Enabled aspect ratio correction" msgstr "Pixelverhoudingcorrectie ingeschakeld" -#: backends/graphics/surfacesdl/surfacesdl-graphics.cpp:2203 +#: backends/graphics/surfacesdl/surfacesdl-graphics.cpp:2218 msgid "Disabled aspect ratio correction" msgstr "Pixelverhoudingcorrectie uitgeschakeld" -#: backends/graphics/surfacesdl/surfacesdl-graphics.cpp:2258 +#: backends/graphics/surfacesdl/surfacesdl-graphics.cpp:2273 msgid "Active graphics filter:" msgstr "Actieve grafische filter:" -#: backends/graphics/surfacesdl/surfacesdl-graphics.cpp:2300 +#: backends/graphics/surfacesdl/surfacesdl-graphics.cpp:2315 msgid "Windowed mode" msgstr "Venstermodus" -#: backends/graphics/opengl/opengl-graphics.cpp:118 +#: backends/graphics/opengl/opengl-graphics.cpp:119 msgid "OpenGL" msgstr "OpenGL" -#: backends/graphics/opengl/opengl-graphics.cpp:119 +#: backends/graphics/opengl/opengl-graphics.cpp:120 msgid "OpenGL (No filtering)" msgstr "OpenGL (geen filters)" @@ -2238,13 +2251,13 @@ msgid "" msgstr "" #: engines/agi/saveload.cpp:816 engines/drascula/saveload.cpp:349 -#: engines/dreamweb/saveload.cpp:169 engines/neverhood/menumodule.cpp:886 +#: engines/dreamweb/saveload.cpp:169 engines/neverhood/menumodule.cpp:890 #: engines/sci/engine/kfile.cpp:858 engines/toltecs/menu.cpp:256 msgid "Restore game:" msgstr "Laad opgeslagen spel:" #: engines/agi/saveload.cpp:816 engines/drascula/saveload.cpp:349 -#: engines/dreamweb/saveload.cpp:169 engines/neverhood/menumodule.cpp:886 +#: engines/dreamweb/saveload.cpp:169 engines/neverhood/menumodule.cpp:890 #: engines/sci/engine/kfile.cpp:858 engines/toltecs/menu.cpp:256 msgid "Restore" msgstr "Laad" @@ -2797,36 +2810,36 @@ msgstr "~V~orige" msgid "~N~ext" msgstr "~V~olgende" -#: engines/scumm/dialogs.cpp:600 +#: engines/scumm/dialogs.cpp:602 msgid "Speech Only" msgstr "Alleen Spraak" -#: engines/scumm/dialogs.cpp:601 +#: engines/scumm/dialogs.cpp:603 msgid "Speech and Subtitles" msgstr "Spraak and Subtitels" -#: engines/scumm/dialogs.cpp:602 +#: engines/scumm/dialogs.cpp:604 msgid "Subtitles Only" msgstr "Alleen subtitels" -#: engines/scumm/dialogs.cpp:610 +#: engines/scumm/dialogs.cpp:612 msgctxt "lowres" msgid "Speech & Subs" msgstr "Tekst en Spraak" -#: engines/scumm/dialogs.cpp:656 +#: engines/scumm/dialogs.cpp:658 msgid "Select a Proficiency Level." msgstr "Selecteer een vakkundigheidsniveau." -#: engines/scumm/dialogs.cpp:658 +#: engines/scumm/dialogs.cpp:660 msgid "Refer to your Loom(TM) manual for help." msgstr "Raadpleeg uw Loom(TM) handleiding voor hulp." -#: engines/scumm/dialogs.cpp:662 +#: engines/scumm/dialogs.cpp:664 msgid "Practice" msgstr "Oefenen" -#: engines/scumm/dialogs.cpp:663 +#: engines/scumm/dialogs.cpp:665 msgid "Expert" msgstr "Expert" diff --git a/po/nn_NO.po b/po/nn_NO.po index a6af5e4b60..5aafe956ee 100644 --- a/po/nn_NO.po +++ b/po/nn_NO.po @@ -7,7 +7,7 @@ msgid "" msgstr "" "Project-Id-Version: ScummVM 1.3.0svn\n" "Report-Msgid-Bugs-To: scummvm-devel@lists.sf.net\n" -"POT-Creation-Date: 2015-10-11 18:59+0100\n" +"POT-Creation-Date: 2015-12-23 00:28+0000\n" "PO-Revision-Date: 2014-07-11 00:04+0100\n" "Last-Translator: Einar Johan Tran Smen \n" "Language-Team: somaen \n" @@ -54,13 +54,13 @@ msgid "Go up" msgstr "Oppover" #: gui/browser.cpp:75 gui/chooser.cpp:46 gui/editrecorddialog.cpp:67 -#: gui/KeysDialog.cpp:43 gui/launcher.cpp:351 gui/massadd.cpp:95 -#: gui/options.cpp:1237 gui/predictivedialog.cpp:74 gui/recorderdialog.cpp:70 -#: gui/recorderdialog.cpp:156 gui/saveload-dialog.cpp:216 -#: gui/saveload-dialog.cpp:276 gui/saveload-dialog.cpp:547 -#: gui/saveload-dialog.cpp:931 gui/themebrowser.cpp:55 -#: gui/fluidsynth-dialog.cpp:152 engines/engine.cpp:483 -#: backends/platform/wii/options.cpp:48 +#: gui/filebrowser-dialog.cpp:64 gui/KeysDialog.cpp:43 gui/launcher.cpp:351 +#: gui/massadd.cpp:95 gui/options.cpp:1237 gui/predictivedialog.cpp:74 +#: gui/recorderdialog.cpp:70 gui/recorderdialog.cpp:156 +#: gui/saveload-dialog.cpp:216 gui/saveload-dialog.cpp:276 +#: gui/saveload-dialog.cpp:547 gui/saveload-dialog.cpp:931 +#: gui/themebrowser.cpp:55 gui/fluidsynth-dialog.cpp:152 +#: engines/engine.cpp:483 backends/platform/wii/options.cpp:48 #: backends/events/default/default-events.cpp:196 #: backends/events/default/default-events.cpp:218 #: engines/drascula/saveload.cpp:49 engines/parallaction/saveload.cpp:274 @@ -69,7 +69,7 @@ msgid "Cancel" msgstr "Avbryt" #: gui/browser.cpp:76 gui/browser_osx.mm:103 gui/chooser.cpp:47 -#: gui/themebrowser.cpp:56 +#: gui/filebrowser-dialog.cpp:65 gui/themebrowser.cpp:56 msgid "Choose" msgstr "Vel" @@ -89,6 +89,39 @@ msgstr "" msgid "Ok" msgstr "" +#: gui/filebrowser-dialog.cpp:49 +msgid "Choose file for loading" +msgstr "" + +#: gui/filebrowser-dialog.cpp:49 +msgid "Enter filename for saving" +msgstr "" + +#: gui/filebrowser-dialog.cpp:132 +#, fuzzy +msgid "Do you really want to overwrite the file?" +msgstr "Vil du verkeleg slette det lagra spelet?" + +#: gui/filebrowser-dialog.cpp:132 gui/launcher.cpp:793 gui/launcher.cpp:941 +#: gui/launcher.cpp:1000 gui/fluidsynth-dialog.cpp:217 +#: backends/events/symbiansdl/symbiansdl-events.cpp:186 +#: backends/platform/wince/CEActionsPocket.cpp:326 +#: backends/platform/wince/CEActionsSmartphone.cpp:287 +#: backends/platform/wince/CELauncherDialog.cpp:83 +#: engines/kyra/saveload_eob.cpp:557 engines/kyra/saveload_eob.cpp:590 +msgid "Yes" +msgstr "Ja" + +#: gui/filebrowser-dialog.cpp:132 gui/launcher.cpp:793 gui/launcher.cpp:941 +#: gui/launcher.cpp:1000 gui/fluidsynth-dialog.cpp:217 +#: backends/events/symbiansdl/symbiansdl-events.cpp:186 +#: backends/platform/wince/CEActionsPocket.cpp:326 +#: backends/platform/wince/CEActionsSmartphone.cpp:287 +#: backends/platform/wince/CELauncherDialog.cpp:83 +#: engines/kyra/saveload_eob.cpp:557 engines/kyra/saveload_eob.cpp:590 +msgid "No" +msgstr "Nei" + #: gui/gui-manager.cpp:117 backends/keymapper/remap-dialog.cpp:53 #: engines/scumm/help.cpp:126 engines/scumm/help.cpp:141 #: engines/scumm/help.cpp:166 engines/scumm/help.cpp:192 @@ -387,7 +420,7 @@ msgstr "" msgid "~Q~uit" msgstr "~A~vslutt" -#: gui/launcher.cpp:626 backends/platform/sdl/macosx/appmenu_osx.mm:95 +#: gui/launcher.cpp:626 backends/platform/sdl/macosx/appmenu_osx.mm:106 msgid "Quit ScummVM" msgstr "Avslutt ScummVM" @@ -395,7 +428,7 @@ msgstr "Avslutt ScummVM" msgid "A~b~out..." msgstr "~O~m..." -#: gui/launcher.cpp:627 backends/platform/sdl/macosx/appmenu_osx.mm:69 +#: gui/launcher.cpp:627 backends/platform/sdl/macosx/appmenu_osx.mm:80 msgid "About ScummVM" msgstr "Om ScummVM" @@ -491,26 +524,6 @@ msgid "" "a huge number of games." msgstr "" -#: gui/launcher.cpp:793 gui/launcher.cpp:941 gui/launcher.cpp:1000 -#: gui/fluidsynth-dialog.cpp:217 -#: backends/events/symbiansdl/symbiansdl-events.cpp:186 -#: backends/platform/wince/CEActionsPocket.cpp:326 -#: backends/platform/wince/CEActionsSmartphone.cpp:287 -#: backends/platform/wince/CELauncherDialog.cpp:83 -#: engines/kyra/saveload_eob.cpp:557 engines/kyra/saveload_eob.cpp:590 -msgid "Yes" -msgstr "Ja" - -#: gui/launcher.cpp:793 gui/launcher.cpp:941 gui/launcher.cpp:1000 -#: gui/fluidsynth-dialog.cpp:217 -#: backends/events/symbiansdl/symbiansdl-events.cpp:186 -#: backends/platform/wince/CEActionsPocket.cpp:326 -#: backends/platform/wince/CEActionsSmartphone.cpp:287 -#: backends/platform/wince/CELauncherDialog.cpp:83 -#: engines/kyra/saveload_eob.cpp:557 engines/kyra/saveload_eob.cpp:590 -msgid "No" -msgstr "Nei" - #: gui/launcher.cpp:841 msgid "ScummVM couldn't open the specified directory!" msgstr "ScummVM kunne ikkje pne den velde mappa!" @@ -665,7 +678,7 @@ msgid "Special dithering modes supported by some games" msgstr "Spesielle dithering-modus som stttast av nokre spel" #: gui/options.cpp:758 -#: backends/graphics/surfacesdl/surfacesdl-graphics.cpp:2298 +#: backends/graphics/surfacesdl/surfacesdl-graphics.cpp:2313 msgid "Fullscreen mode" msgstr "Fullskjermsmodus" @@ -1125,7 +1138,7 @@ msgstr "Deaktivert GFX" msgid "Standard Renderer" msgstr "Standardteiknar" -#: gui/ThemeEngine.cpp:348 engines/scumm/dialogs.cpp:661 +#: gui/ThemeEngine.cpp:348 engines/scumm/dialogs.cpp:663 msgid "Standard" msgstr "Standard" @@ -1372,7 +1385,7 @@ msgstr "Tilbake til Oppsta~r~tar" #: engines/dialogs.cpp:116 engines/agi/saveload.cpp:803 #: engines/cruise/menu.cpp:212 engines/drascula/saveload.cpp:336 -#: engines/dreamweb/saveload.cpp:261 engines/neverhood/menumodule.cpp:873 +#: engines/dreamweb/saveload.cpp:261 engines/neverhood/menumodule.cpp:877 #: engines/pegasus/pegasus.cpp:377 engines/sci/engine/kfile.cpp:759 #: engines/toltecs/menu.cpp:281 engines/tsage/scenes.cpp:598 msgid "Save game:" @@ -1385,7 +1398,7 @@ msgstr "Lagra spel:" #: backends/platform/wince/CEActionsSmartphone.cpp:231 #: engines/agi/saveload.cpp:803 engines/cruise/menu.cpp:212 #: engines/drascula/saveload.cpp:336 engines/dreamweb/saveload.cpp:261 -#: engines/neverhood/menumodule.cpp:873 engines/pegasus/pegasus.cpp:377 +#: engines/neverhood/menumodule.cpp:877 engines/pegasus/pegasus.cpp:377 #: engines/sci/engine/kfile.cpp:759 engines/scumm/dialogs.cpp:188 #: engines/toltecs/menu.cpp:281 engines/tsage/scenes.cpp:598 msgid "Save" @@ -1704,59 +1717,59 @@ msgstr "Midtklikk" msgid "Right Click" msgstr "Hgreklikk" -#: backends/platform/sdl/macosx/appmenu_osx.mm:77 +#: backends/platform/sdl/macosx/appmenu_osx.mm:88 msgid "Hide ScummVM" msgstr "Skjul ScummVM" -#: backends/platform/sdl/macosx/appmenu_osx.mm:82 +#: backends/platform/sdl/macosx/appmenu_osx.mm:93 msgid "Hide Others" msgstr "Skjul Andre" -#: backends/platform/sdl/macosx/appmenu_osx.mm:87 +#: backends/platform/sdl/macosx/appmenu_osx.mm:98 msgid "Show All" msgstr "Syn alle" -#: backends/platform/sdl/macosx/appmenu_osx.mm:109 #: backends/platform/sdl/macosx/appmenu_osx.mm:120 +#: backends/platform/sdl/macosx/appmenu_osx.mm:131 msgid "Window" msgstr "Vindu" -#: backends/platform/sdl/macosx/appmenu_osx.mm:114 +#: backends/platform/sdl/macosx/appmenu_osx.mm:125 msgid "Minimize" msgstr "Minimer" -#: backends/graphics/surfacesdl/surfacesdl-graphics.cpp:46 +#: backends/graphics/surfacesdl/surfacesdl-graphics.cpp:47 msgid "Normal (no scaling)" msgstr "Normal (ikkje skaler)" -#: backends/graphics/surfacesdl/surfacesdl-graphics.cpp:65 +#: backends/graphics/surfacesdl/surfacesdl-graphics.cpp:66 msgctxt "lowres" msgid "Normal (no scaling)" msgstr "Normal (ikkje skaler)" -#: backends/graphics/surfacesdl/surfacesdl-graphics.cpp:2197 +#: backends/graphics/surfacesdl/surfacesdl-graphics.cpp:2212 #, fuzzy msgid "Enabled aspect ratio correction" msgstr "Aspekt-korrigering" -#: backends/graphics/surfacesdl/surfacesdl-graphics.cpp:2203 +#: backends/graphics/surfacesdl/surfacesdl-graphics.cpp:2218 #, fuzzy msgid "Disabled aspect ratio correction" msgstr "Aspekt-korrigering" -#: backends/graphics/surfacesdl/surfacesdl-graphics.cpp:2258 +#: backends/graphics/surfacesdl/surfacesdl-graphics.cpp:2273 msgid "Active graphics filter:" msgstr "Aktivt grafikkfilter:" -#: backends/graphics/surfacesdl/surfacesdl-graphics.cpp:2300 +#: backends/graphics/surfacesdl/surfacesdl-graphics.cpp:2315 msgid "Windowed mode" msgstr "Vindusmodus" -#: backends/graphics/opengl/opengl-graphics.cpp:118 +#: backends/graphics/opengl/opengl-graphics.cpp:119 msgid "OpenGL" msgstr "OpenGL" -#: backends/graphics/opengl/opengl-graphics.cpp:119 +#: backends/graphics/opengl/opengl-graphics.cpp:120 msgid "OpenGL (No filtering)" msgstr "OpenGL (Ingen filtrering)" @@ -2212,13 +2225,13 @@ msgid "" msgstr "" #: engines/agi/saveload.cpp:816 engines/drascula/saveload.cpp:349 -#: engines/dreamweb/saveload.cpp:169 engines/neverhood/menumodule.cpp:886 +#: engines/dreamweb/saveload.cpp:169 engines/neverhood/menumodule.cpp:890 #: engines/sci/engine/kfile.cpp:858 engines/toltecs/menu.cpp:256 msgid "Restore game:" msgstr "Gjenopprett spel:" #: engines/agi/saveload.cpp:816 engines/drascula/saveload.cpp:349 -#: engines/dreamweb/saveload.cpp:169 engines/neverhood/menumodule.cpp:886 +#: engines/dreamweb/saveload.cpp:169 engines/neverhood/menumodule.cpp:890 #: engines/sci/engine/kfile.cpp:858 engines/toltecs/menu.cpp:256 msgid "Restore" msgstr "Gjenopprett" @@ -2742,37 +2755,37 @@ msgstr "~F~orrige" msgid "~N~ext" msgstr "~N~este" -#: engines/scumm/dialogs.cpp:600 +#: engines/scumm/dialogs.cpp:602 msgid "Speech Only" msgstr "Berre Tale" -#: engines/scumm/dialogs.cpp:601 +#: engines/scumm/dialogs.cpp:603 msgid "Speech and Subtitles" msgstr "Tale og undertekstar" -#: engines/scumm/dialogs.cpp:602 +#: engines/scumm/dialogs.cpp:604 msgid "Subtitles Only" msgstr "Berre undertekstar" -#: engines/scumm/dialogs.cpp:610 +#: engines/scumm/dialogs.cpp:612 msgctxt "lowres" msgid "Speech & Subs" msgstr "Tekst & Tale" -#: engines/scumm/dialogs.cpp:656 +#: engines/scumm/dialogs.cpp:658 #, fuzzy msgid "Select a Proficiency Level." msgstr "G til forrige mappeniv" -#: engines/scumm/dialogs.cpp:658 +#: engines/scumm/dialogs.cpp:660 msgid "Refer to your Loom(TM) manual for help." msgstr "Sj i Loom(TM)-manualen for hjelp." -#: engines/scumm/dialogs.cpp:662 +#: engines/scumm/dialogs.cpp:664 msgid "Practice" msgstr "" -#: engines/scumm/dialogs.cpp:663 +#: engines/scumm/dialogs.cpp:665 msgid "Expert" msgstr "Ekspert" diff --git a/po/pl_PL.po b/po/pl_PL.po index 477ecb6e69..5763d3940e 100644 --- a/po/pl_PL.po +++ b/po/pl_PL.po @@ -7,7 +7,7 @@ msgid "" msgstr "" "Project-Id-Version: ScummVM 1.3.0\n" "Report-Msgid-Bugs-To: scummvm-devel@lists.sf.net\n" -"POT-Creation-Date: 2015-10-11 18:59+0100\n" +"POT-Creation-Date: 2015-12-23 00:28+0000\n" "PO-Revision-Date: 2014-07-02 12:28+0100\n" "Last-Translator: Micha Zibkowski \n" "Language-Team: Grajpopolsku.pl \n" @@ -55,13 +55,13 @@ msgid "Go up" msgstr "W gr" #: gui/browser.cpp:75 gui/chooser.cpp:46 gui/editrecorddialog.cpp:67 -#: gui/KeysDialog.cpp:43 gui/launcher.cpp:351 gui/massadd.cpp:95 -#: gui/options.cpp:1237 gui/predictivedialog.cpp:74 gui/recorderdialog.cpp:70 -#: gui/recorderdialog.cpp:156 gui/saveload-dialog.cpp:216 -#: gui/saveload-dialog.cpp:276 gui/saveload-dialog.cpp:547 -#: gui/saveload-dialog.cpp:931 gui/themebrowser.cpp:55 -#: gui/fluidsynth-dialog.cpp:152 engines/engine.cpp:483 -#: backends/platform/wii/options.cpp:48 +#: gui/filebrowser-dialog.cpp:64 gui/KeysDialog.cpp:43 gui/launcher.cpp:351 +#: gui/massadd.cpp:95 gui/options.cpp:1237 gui/predictivedialog.cpp:74 +#: gui/recorderdialog.cpp:70 gui/recorderdialog.cpp:156 +#: gui/saveload-dialog.cpp:216 gui/saveload-dialog.cpp:276 +#: gui/saveload-dialog.cpp:547 gui/saveload-dialog.cpp:931 +#: gui/themebrowser.cpp:55 gui/fluidsynth-dialog.cpp:152 +#: engines/engine.cpp:483 backends/platform/wii/options.cpp:48 #: backends/events/default/default-events.cpp:196 #: backends/events/default/default-events.cpp:218 #: engines/drascula/saveload.cpp:49 engines/parallaction/saveload.cpp:274 @@ -70,7 +70,7 @@ msgid "Cancel" msgstr "Anuluj" #: gui/browser.cpp:76 gui/browser_osx.mm:103 gui/chooser.cpp:47 -#: gui/themebrowser.cpp:56 +#: gui/filebrowser-dialog.cpp:65 gui/themebrowser.cpp:56 msgid "Choose" msgstr "Wybierz" @@ -90,6 +90,39 @@ msgstr "" msgid "Ok" msgstr "" +#: gui/filebrowser-dialog.cpp:49 +msgid "Choose file for loading" +msgstr "" + +#: gui/filebrowser-dialog.cpp:49 +msgid "Enter filename for saving" +msgstr "" + +#: gui/filebrowser-dialog.cpp:132 +#, fuzzy +msgid "Do you really want to overwrite the file?" +msgstr "Na pewno chcesz skasowa ten zapis?" + +#: gui/filebrowser-dialog.cpp:132 gui/launcher.cpp:793 gui/launcher.cpp:941 +#: gui/launcher.cpp:1000 gui/fluidsynth-dialog.cpp:217 +#: backends/events/symbiansdl/symbiansdl-events.cpp:186 +#: backends/platform/wince/CEActionsPocket.cpp:326 +#: backends/platform/wince/CEActionsSmartphone.cpp:287 +#: backends/platform/wince/CELauncherDialog.cpp:83 +#: engines/kyra/saveload_eob.cpp:557 engines/kyra/saveload_eob.cpp:590 +msgid "Yes" +msgstr "Tak" + +#: gui/filebrowser-dialog.cpp:132 gui/launcher.cpp:793 gui/launcher.cpp:941 +#: gui/launcher.cpp:1000 gui/fluidsynth-dialog.cpp:217 +#: backends/events/symbiansdl/symbiansdl-events.cpp:186 +#: backends/platform/wince/CEActionsPocket.cpp:326 +#: backends/platform/wince/CEActionsSmartphone.cpp:287 +#: backends/platform/wince/CELauncherDialog.cpp:83 +#: engines/kyra/saveload_eob.cpp:557 engines/kyra/saveload_eob.cpp:590 +msgid "No" +msgstr "Nie" + #: gui/gui-manager.cpp:117 backends/keymapper/remap-dialog.cpp:53 #: engines/scumm/help.cpp:126 engines/scumm/help.cpp:141 #: engines/scumm/help.cpp:166 engines/scumm/help.cpp:192 @@ -385,7 +418,7 @@ msgstr "Identyfikator jest ju msgid "~Q~uit" msgstr "~Z~akocz" -#: gui/launcher.cpp:626 backends/platform/sdl/macosx/appmenu_osx.mm:95 +#: gui/launcher.cpp:626 backends/platform/sdl/macosx/appmenu_osx.mm:106 msgid "Quit ScummVM" msgstr "Zakocz ScummVM" @@ -393,7 +426,7 @@ msgstr "Zako msgid "A~b~out..." msgstr "I~n~formacje..." -#: gui/launcher.cpp:627 backends/platform/sdl/macosx/appmenu_osx.mm:69 +#: gui/launcher.cpp:627 backends/platform/sdl/macosx/appmenu_osx.mm:80 msgid "About ScummVM" msgstr "Ksika ScummVM" @@ -490,26 +523,6 @@ msgid "" msgstr "" "Chcesz uruchomi masowy detektor gier? Moe doda wiele tytuw do listy" -#: gui/launcher.cpp:793 gui/launcher.cpp:941 gui/launcher.cpp:1000 -#: gui/fluidsynth-dialog.cpp:217 -#: backends/events/symbiansdl/symbiansdl-events.cpp:186 -#: backends/platform/wince/CEActionsPocket.cpp:326 -#: backends/platform/wince/CEActionsSmartphone.cpp:287 -#: backends/platform/wince/CELauncherDialog.cpp:83 -#: engines/kyra/saveload_eob.cpp:557 engines/kyra/saveload_eob.cpp:590 -msgid "Yes" -msgstr "Tak" - -#: gui/launcher.cpp:793 gui/launcher.cpp:941 gui/launcher.cpp:1000 -#: gui/fluidsynth-dialog.cpp:217 -#: backends/events/symbiansdl/symbiansdl-events.cpp:186 -#: backends/platform/wince/CEActionsPocket.cpp:326 -#: backends/platform/wince/CEActionsSmartphone.cpp:287 -#: backends/platform/wince/CELauncherDialog.cpp:83 -#: engines/kyra/saveload_eob.cpp:557 engines/kyra/saveload_eob.cpp:590 -msgid "No" -msgstr "Nie" - #: gui/launcher.cpp:841 msgid "ScummVM couldn't open the specified directory!" msgstr "ScummVM nie moe otworzy katalogu!" @@ -662,7 +675,7 @@ msgid "Special dithering modes supported by some games" msgstr "Specjalne tryby ditheringu wspierane przez niektre gry" #: gui/options.cpp:758 -#: backends/graphics/surfacesdl/surfacesdl-graphics.cpp:2298 +#: backends/graphics/surfacesdl/surfacesdl-graphics.cpp:2313 msgid "Fullscreen mode" msgstr "Peny ekran" @@ -1126,7 +1139,7 @@ msgstr "Wy msgid "Standard Renderer" msgstr "Standardowy renderer" -#: gui/ThemeEngine.cpp:348 engines/scumm/dialogs.cpp:661 +#: gui/ThemeEngine.cpp:348 engines/scumm/dialogs.cpp:663 msgid "Standard" msgstr "Standardowy" @@ -1372,7 +1385,7 @@ msgstr "~P~owr #: engines/dialogs.cpp:116 engines/agi/saveload.cpp:803 #: engines/cruise/menu.cpp:212 engines/drascula/saveload.cpp:336 -#: engines/dreamweb/saveload.cpp:261 engines/neverhood/menumodule.cpp:873 +#: engines/dreamweb/saveload.cpp:261 engines/neverhood/menumodule.cpp:877 #: engines/pegasus/pegasus.cpp:377 engines/sci/engine/kfile.cpp:759 #: engines/toltecs/menu.cpp:281 engines/tsage/scenes.cpp:598 msgid "Save game:" @@ -1385,7 +1398,7 @@ msgstr "Zapis:" #: backends/platform/wince/CEActionsSmartphone.cpp:231 #: engines/agi/saveload.cpp:803 engines/cruise/menu.cpp:212 #: engines/drascula/saveload.cpp:336 engines/dreamweb/saveload.cpp:261 -#: engines/neverhood/menumodule.cpp:873 engines/pegasus/pegasus.cpp:377 +#: engines/neverhood/menumodule.cpp:877 engines/pegasus/pegasus.cpp:377 #: engines/sci/engine/kfile.cpp:759 engines/scumm/dialogs.cpp:188 #: engines/toltecs/menu.cpp:281 engines/tsage/scenes.cpp:598 msgid "Save" @@ -1720,57 +1733,57 @@ msgstr " msgid "Right Click" msgstr "Kliknicie PPM" -#: backends/platform/sdl/macosx/appmenu_osx.mm:77 +#: backends/platform/sdl/macosx/appmenu_osx.mm:88 msgid "Hide ScummVM" msgstr "Ukryj ScummVM" -#: backends/platform/sdl/macosx/appmenu_osx.mm:82 +#: backends/platform/sdl/macosx/appmenu_osx.mm:93 msgid "Hide Others" msgstr "Ukryj pozostae" -#: backends/platform/sdl/macosx/appmenu_osx.mm:87 +#: backends/platform/sdl/macosx/appmenu_osx.mm:98 msgid "Show All" msgstr "Poka wszystkie" -#: backends/platform/sdl/macosx/appmenu_osx.mm:109 #: backends/platform/sdl/macosx/appmenu_osx.mm:120 +#: backends/platform/sdl/macosx/appmenu_osx.mm:131 msgid "Window" msgstr "Okno" -#: backends/platform/sdl/macosx/appmenu_osx.mm:114 +#: backends/platform/sdl/macosx/appmenu_osx.mm:125 msgid "Minimize" msgstr "Miniaturka" -#: backends/graphics/surfacesdl/surfacesdl-graphics.cpp:46 +#: backends/graphics/surfacesdl/surfacesdl-graphics.cpp:47 msgid "Normal (no scaling)" msgstr "Zwyky (bez skalowania)" -#: backends/graphics/surfacesdl/surfacesdl-graphics.cpp:65 +#: backends/graphics/surfacesdl/surfacesdl-graphics.cpp:66 msgctxt "lowres" msgid "Normal (no scaling)" msgstr "Zwyky (bez skalowania)" -#: backends/graphics/surfacesdl/surfacesdl-graphics.cpp:2197 +#: backends/graphics/surfacesdl/surfacesdl-graphics.cpp:2212 msgid "Enabled aspect ratio correction" msgstr "Wczono korekcj formatu obrazu" -#: backends/graphics/surfacesdl/surfacesdl-graphics.cpp:2203 +#: backends/graphics/surfacesdl/surfacesdl-graphics.cpp:2218 msgid "Disabled aspect ratio correction" msgstr "Wyczono korekcj formatu obrazu" -#: backends/graphics/surfacesdl/surfacesdl-graphics.cpp:2258 +#: backends/graphics/surfacesdl/surfacesdl-graphics.cpp:2273 msgid "Active graphics filter:" msgstr "Aktywny filtr graficzny:" -#: backends/graphics/surfacesdl/surfacesdl-graphics.cpp:2300 +#: backends/graphics/surfacesdl/surfacesdl-graphics.cpp:2315 msgid "Windowed mode" msgstr "Okno" -#: backends/graphics/opengl/opengl-graphics.cpp:118 +#: backends/graphics/opengl/opengl-graphics.cpp:119 msgid "OpenGL" msgstr "OpenGL" -#: backends/graphics/opengl/opengl-graphics.cpp:119 +#: backends/graphics/opengl/opengl-graphics.cpp:120 msgid "OpenGL (No filtering)" msgstr "OpenGL (bez filtrowania)" @@ -2210,13 +2223,13 @@ msgid "" msgstr "" #: engines/agi/saveload.cpp:816 engines/drascula/saveload.cpp:349 -#: engines/dreamweb/saveload.cpp:169 engines/neverhood/menumodule.cpp:886 +#: engines/dreamweb/saveload.cpp:169 engines/neverhood/menumodule.cpp:890 #: engines/sci/engine/kfile.cpp:858 engines/toltecs/menu.cpp:256 msgid "Restore game:" msgstr "Wznw gr:" #: engines/agi/saveload.cpp:816 engines/drascula/saveload.cpp:349 -#: engines/dreamweb/saveload.cpp:169 engines/neverhood/menumodule.cpp:886 +#: engines/dreamweb/saveload.cpp:169 engines/neverhood/menumodule.cpp:890 #: engines/sci/engine/kfile.cpp:858 engines/toltecs/menu.cpp:256 msgid "Restore" msgstr "Wznw" @@ -2751,36 +2764,36 @@ msgstr "~P~oprzednia" msgid "~N~ext" msgstr "~N~astpna" -#: engines/scumm/dialogs.cpp:600 +#: engines/scumm/dialogs.cpp:602 msgid "Speech Only" msgstr "Tylko mowa" -#: engines/scumm/dialogs.cpp:601 +#: engines/scumm/dialogs.cpp:603 msgid "Speech and Subtitles" msgstr "Mowa i napisy" -#: engines/scumm/dialogs.cpp:602 +#: engines/scumm/dialogs.cpp:604 msgid "Subtitles Only" msgstr "Tylko napisy" -#: engines/scumm/dialogs.cpp:610 +#: engines/scumm/dialogs.cpp:612 msgctxt "lowres" msgid "Speech & Subs" msgstr "Mowa i napisy" -#: engines/scumm/dialogs.cpp:656 +#: engines/scumm/dialogs.cpp:658 msgid "Select a Proficiency Level." msgstr "Wybierz poziom umiejtnoci." -#: engines/scumm/dialogs.cpp:658 +#: engines/scumm/dialogs.cpp:660 msgid "Refer to your Loom(TM) manual for help." msgstr "Pomocy szukaj w instrukcji doczonej do Loom(TM)." -#: engines/scumm/dialogs.cpp:662 +#: engines/scumm/dialogs.cpp:664 msgid "Practice" msgstr "Trening" -#: engines/scumm/dialogs.cpp:663 +#: engines/scumm/dialogs.cpp:665 msgid "Expert" msgstr "Ekspert" diff --git a/po/pt_BR.po b/po/pt_BR.po index a406d5e096..5ae1948a78 100644 --- a/po/pt_BR.po +++ b/po/pt_BR.po @@ -7,7 +7,7 @@ msgid "" msgstr "" "Project-Id-Version: ScummVM 1.3.0svn\n" "Report-Msgid-Bugs-To: scummvm-devel@lists.sf.net\n" -"POT-Creation-Date: 2015-10-11 18:59+0100\n" +"POT-Creation-Date: 2015-12-23 00:28+0000\n" "PO-Revision-Date: 2011-10-21 21:30-0300\n" "Last-Translator: Saulo Benigno \n" "Language-Team: ScummBR (www.scummbr.com) \n" @@ -56,13 +56,13 @@ msgid "Go up" msgstr "Acima" #: gui/browser.cpp:75 gui/chooser.cpp:46 gui/editrecorddialog.cpp:67 -#: gui/KeysDialog.cpp:43 gui/launcher.cpp:351 gui/massadd.cpp:95 -#: gui/options.cpp:1237 gui/predictivedialog.cpp:74 gui/recorderdialog.cpp:70 -#: gui/recorderdialog.cpp:156 gui/saveload-dialog.cpp:216 -#: gui/saveload-dialog.cpp:276 gui/saveload-dialog.cpp:547 -#: gui/saveload-dialog.cpp:931 gui/themebrowser.cpp:55 -#: gui/fluidsynth-dialog.cpp:152 engines/engine.cpp:483 -#: backends/platform/wii/options.cpp:48 +#: gui/filebrowser-dialog.cpp:64 gui/KeysDialog.cpp:43 gui/launcher.cpp:351 +#: gui/massadd.cpp:95 gui/options.cpp:1237 gui/predictivedialog.cpp:74 +#: gui/recorderdialog.cpp:70 gui/recorderdialog.cpp:156 +#: gui/saveload-dialog.cpp:216 gui/saveload-dialog.cpp:276 +#: gui/saveload-dialog.cpp:547 gui/saveload-dialog.cpp:931 +#: gui/themebrowser.cpp:55 gui/fluidsynth-dialog.cpp:152 +#: engines/engine.cpp:483 backends/platform/wii/options.cpp:48 #: backends/events/default/default-events.cpp:196 #: backends/events/default/default-events.cpp:218 #: engines/drascula/saveload.cpp:49 engines/parallaction/saveload.cpp:274 @@ -71,7 +71,7 @@ msgid "Cancel" msgstr "Cancelar" #: gui/browser.cpp:76 gui/browser_osx.mm:103 gui/chooser.cpp:47 -#: gui/themebrowser.cpp:56 +#: gui/filebrowser-dialog.cpp:65 gui/themebrowser.cpp:56 msgid "Choose" msgstr "Escolher" @@ -91,6 +91,39 @@ msgstr "" msgid "Ok" msgstr "" +#: gui/filebrowser-dialog.cpp:49 +msgid "Choose file for loading" +msgstr "" + +#: gui/filebrowser-dialog.cpp:49 +msgid "Enter filename for saving" +msgstr "" + +#: gui/filebrowser-dialog.cpp:132 +#, fuzzy +msgid "Do you really want to overwrite the file?" +msgstr "Voc realmente quer excluir este jogo salvo?" + +#: gui/filebrowser-dialog.cpp:132 gui/launcher.cpp:793 gui/launcher.cpp:941 +#: gui/launcher.cpp:1000 gui/fluidsynth-dialog.cpp:217 +#: backends/events/symbiansdl/symbiansdl-events.cpp:186 +#: backends/platform/wince/CEActionsPocket.cpp:326 +#: backends/platform/wince/CEActionsSmartphone.cpp:287 +#: backends/platform/wince/CELauncherDialog.cpp:83 +#: engines/kyra/saveload_eob.cpp:557 engines/kyra/saveload_eob.cpp:590 +msgid "Yes" +msgstr "Sim" + +#: gui/filebrowser-dialog.cpp:132 gui/launcher.cpp:793 gui/launcher.cpp:941 +#: gui/launcher.cpp:1000 gui/fluidsynth-dialog.cpp:217 +#: backends/events/symbiansdl/symbiansdl-events.cpp:186 +#: backends/platform/wince/CEActionsPocket.cpp:326 +#: backends/platform/wince/CEActionsSmartphone.cpp:287 +#: backends/platform/wince/CELauncherDialog.cpp:83 +#: engines/kyra/saveload_eob.cpp:557 engines/kyra/saveload_eob.cpp:590 +msgid "No" +msgstr "No" + #: gui/gui-manager.cpp:117 backends/keymapper/remap-dialog.cpp:53 #: engines/scumm/help.cpp:126 engines/scumm/help.cpp:141 #: engines/scumm/help.cpp:166 engines/scumm/help.cpp:192 @@ -388,7 +421,7 @@ msgstr "Este c msgid "~Q~uit" msgstr "~S~air" -#: gui/launcher.cpp:626 backends/platform/sdl/macosx/appmenu_osx.mm:95 +#: gui/launcher.cpp:626 backends/platform/sdl/macosx/appmenu_osx.mm:106 msgid "Quit ScummVM" msgstr "Sair do ScummVM" @@ -396,7 +429,7 @@ msgstr "Sair do ScummVM" msgid "A~b~out..." msgstr "So~b~re..." -#: gui/launcher.cpp:627 backends/platform/sdl/macosx/appmenu_osx.mm:69 +#: gui/launcher.cpp:627 backends/platform/sdl/macosx/appmenu_osx.mm:80 msgid "About ScummVM" msgstr "Sobre o ScumnmVM" @@ -495,26 +528,6 @@ msgstr "" "Voc realmente deseja adicionar vrios jogos ao mesmo tempo? Isso poder " "resultar em uma adio gigantesca de jogos." -#: gui/launcher.cpp:793 gui/launcher.cpp:941 gui/launcher.cpp:1000 -#: gui/fluidsynth-dialog.cpp:217 -#: backends/events/symbiansdl/symbiansdl-events.cpp:186 -#: backends/platform/wince/CEActionsPocket.cpp:326 -#: backends/platform/wince/CEActionsSmartphone.cpp:287 -#: backends/platform/wince/CELauncherDialog.cpp:83 -#: engines/kyra/saveload_eob.cpp:557 engines/kyra/saveload_eob.cpp:590 -msgid "Yes" -msgstr "Sim" - -#: gui/launcher.cpp:793 gui/launcher.cpp:941 gui/launcher.cpp:1000 -#: gui/fluidsynth-dialog.cpp:217 -#: backends/events/symbiansdl/symbiansdl-events.cpp:186 -#: backends/platform/wince/CEActionsPocket.cpp:326 -#: backends/platform/wince/CEActionsSmartphone.cpp:287 -#: backends/platform/wince/CELauncherDialog.cpp:83 -#: engines/kyra/saveload_eob.cpp:557 engines/kyra/saveload_eob.cpp:590 -msgid "No" -msgstr "No" - #: gui/launcher.cpp:841 msgid "ScummVM couldn't open the specified directory!" msgstr "ScummVM no conseguiu abrir a pasta especificada!" @@ -674,7 +687,7 @@ msgid "Special dithering modes supported by some games" msgstr "Modos especiais de dithering suportados por alguns jogos" #: gui/options.cpp:758 -#: backends/graphics/surfacesdl/surfacesdl-graphics.cpp:2298 +#: backends/graphics/surfacesdl/surfacesdl-graphics.cpp:2313 msgid "Fullscreen mode" msgstr "Modo Tela Cheia" @@ -1142,7 +1155,7 @@ msgstr "GFX desabilitado" msgid "Standard Renderer" msgstr "Renderizador padro (16bpp)" -#: gui/ThemeEngine.cpp:348 engines/scumm/dialogs.cpp:661 +#: gui/ThemeEngine.cpp:348 engines/scumm/dialogs.cpp:663 #, fuzzy msgid "Standard" msgstr "Padro (16bpp)" @@ -1397,7 +1410,7 @@ msgstr "~V~oltar ao menu" #: engines/dialogs.cpp:116 engines/agi/saveload.cpp:803 #: engines/cruise/menu.cpp:212 engines/drascula/saveload.cpp:336 -#: engines/dreamweb/saveload.cpp:261 engines/neverhood/menumodule.cpp:873 +#: engines/dreamweb/saveload.cpp:261 engines/neverhood/menumodule.cpp:877 #: engines/pegasus/pegasus.cpp:377 engines/sci/engine/kfile.cpp:759 #: engines/toltecs/menu.cpp:281 engines/tsage/scenes.cpp:598 msgid "Save game:" @@ -1410,7 +1423,7 @@ msgstr "Salvar jogo:" #: backends/platform/wince/CEActionsSmartphone.cpp:231 #: engines/agi/saveload.cpp:803 engines/cruise/menu.cpp:212 #: engines/drascula/saveload.cpp:336 engines/dreamweb/saveload.cpp:261 -#: engines/neverhood/menumodule.cpp:873 engines/pegasus/pegasus.cpp:377 +#: engines/neverhood/menumodule.cpp:877 engines/pegasus/pegasus.cpp:377 #: engines/sci/engine/kfile.cpp:759 engines/scumm/dialogs.cpp:188 #: engines/toltecs/menu.cpp:281 engines/tsage/scenes.cpp:598 msgid "Save" @@ -1753,58 +1766,58 @@ msgstr "Item do meio na esquerda" msgid "Right Click" msgstr "Clique com o boto direito" -#: backends/platform/sdl/macosx/appmenu_osx.mm:77 +#: backends/platform/sdl/macosx/appmenu_osx.mm:88 msgid "Hide ScummVM" msgstr "Ocultar ScummVM" -#: backends/platform/sdl/macosx/appmenu_osx.mm:82 +#: backends/platform/sdl/macosx/appmenu_osx.mm:93 msgid "Hide Others" msgstr "Ocultar Outros" -#: backends/platform/sdl/macosx/appmenu_osx.mm:87 +#: backends/platform/sdl/macosx/appmenu_osx.mm:98 msgid "Show All" msgstr "Mostrar Tudo" -#: backends/platform/sdl/macosx/appmenu_osx.mm:109 #: backends/platform/sdl/macosx/appmenu_osx.mm:120 +#: backends/platform/sdl/macosx/appmenu_osx.mm:131 msgid "Window" msgstr "Janela" -#: backends/platform/sdl/macosx/appmenu_osx.mm:114 +#: backends/platform/sdl/macosx/appmenu_osx.mm:125 msgid "Minimize" msgstr "Minimizar" -#: backends/graphics/surfacesdl/surfacesdl-graphics.cpp:46 +#: backends/graphics/surfacesdl/surfacesdl-graphics.cpp:47 msgid "Normal (no scaling)" msgstr "Normal (sem escala)" -#: backends/graphics/surfacesdl/surfacesdl-graphics.cpp:65 +#: backends/graphics/surfacesdl/surfacesdl-graphics.cpp:66 msgctxt "lowres" msgid "Normal (no scaling)" msgstr "Normal (sem escala)" -#: backends/graphics/surfacesdl/surfacesdl-graphics.cpp:2197 +#: backends/graphics/surfacesdl/surfacesdl-graphics.cpp:2212 msgid "Enabled aspect ratio correction" msgstr "Correo de proporo habilitada" -#: backends/graphics/surfacesdl/surfacesdl-graphics.cpp:2203 +#: backends/graphics/surfacesdl/surfacesdl-graphics.cpp:2218 msgid "Disabled aspect ratio correction" msgstr "Correo de proporo desabilitada" -#: backends/graphics/surfacesdl/surfacesdl-graphics.cpp:2258 +#: backends/graphics/surfacesdl/surfacesdl-graphics.cpp:2273 msgid "Active graphics filter:" msgstr "Ativa os filtros grficos" -#: backends/graphics/surfacesdl/surfacesdl-graphics.cpp:2300 +#: backends/graphics/surfacesdl/surfacesdl-graphics.cpp:2315 msgid "Windowed mode" msgstr "Modo janela" -#: backends/graphics/opengl/opengl-graphics.cpp:118 +#: backends/graphics/opengl/opengl-graphics.cpp:119 #, fuzzy msgid "OpenGL" msgstr "Abrir" -#: backends/graphics/opengl/opengl-graphics.cpp:119 +#: backends/graphics/opengl/opengl-graphics.cpp:120 msgid "OpenGL (No filtering)" msgstr "" @@ -2246,13 +2259,13 @@ msgid "" msgstr "" #: engines/agi/saveload.cpp:816 engines/drascula/saveload.cpp:349 -#: engines/dreamweb/saveload.cpp:169 engines/neverhood/menumodule.cpp:886 +#: engines/dreamweb/saveload.cpp:169 engines/neverhood/menumodule.cpp:890 #: engines/sci/engine/kfile.cpp:858 engines/toltecs/menu.cpp:256 msgid "Restore game:" msgstr "Restaurar jogo:" #: engines/agi/saveload.cpp:816 engines/drascula/saveload.cpp:349 -#: engines/dreamweb/saveload.cpp:169 engines/neverhood/menumodule.cpp:886 +#: engines/dreamweb/saveload.cpp:169 engines/neverhood/menumodule.cpp:890 #: engines/sci/engine/kfile.cpp:858 engines/toltecs/menu.cpp:256 msgid "Restore" msgstr "Restaurar" @@ -2806,36 +2819,36 @@ msgstr "~A~nterior" msgid "~N~ext" msgstr "~P~rximo" -#: engines/scumm/dialogs.cpp:600 +#: engines/scumm/dialogs.cpp:602 msgid "Speech Only" msgstr "Somente Voz" -#: engines/scumm/dialogs.cpp:601 +#: engines/scumm/dialogs.cpp:603 msgid "Speech and Subtitles" msgstr "Voz e Legendas" -#: engines/scumm/dialogs.cpp:602 +#: engines/scumm/dialogs.cpp:604 msgid "Subtitles Only" msgstr "Somente Legendas" -#: engines/scumm/dialogs.cpp:610 +#: engines/scumm/dialogs.cpp:612 msgctxt "lowres" msgid "Speech & Subs" msgstr "Voz e Legendas" -#: engines/scumm/dialogs.cpp:656 +#: engines/scumm/dialogs.cpp:658 msgid "Select a Proficiency Level." msgstr "" -#: engines/scumm/dialogs.cpp:658 +#: engines/scumm/dialogs.cpp:660 msgid "Refer to your Loom(TM) manual for help." msgstr "" -#: engines/scumm/dialogs.cpp:662 +#: engines/scumm/dialogs.cpp:664 msgid "Practice" msgstr "" -#: engines/scumm/dialogs.cpp:663 +#: engines/scumm/dialogs.cpp:665 msgid "Expert" msgstr "" diff --git a/po/ru_RU.po b/po/ru_RU.po index 5fbb8dcb24..276e34f3e0 100644 --- a/po/ru_RU.po +++ b/po/ru_RU.po @@ -7,7 +7,7 @@ msgid "" msgstr "" "Project-Id-Version: ScummVM 1.8.0svn\n" "Report-Msgid-Bugs-To: scummvm-devel@lists.sf.net\n" -"POT-Creation-Date: 2015-10-11 18:59+0100\n" +"POT-Creation-Date: 2015-12-23 00:28+0000\n" "PO-Revision-Date: 2015-11-06 09:23+0300\n" "Last-Translator: Eugene Sandulenko \n" "Language-Team: Russian\n" @@ -15,7 +15,8 @@ msgstr "" "MIME-Version: 1.0\n" "Content-Type: text/plain; charset=iso-8859-5\n" "Content-Transfer-Encoding: 8bit\n" -"Plural-Forms: nplurals=3; plural=n%10==1 && n%100!=11 ? 0 : n%10>=2 && n%10<=4 && (n%100<10 || n%100>=20) ? 1 : 2;\n" +"Plural-Forms: nplurals=3; plural=n%10==1 && n%100!=11 ? 0 : n%10>=2 && n" +"%10<=4 && (n%100<10 || n%100>=20) ? 1 : 2;\n" "X-Generator: Poedit 1.5.5\n" #: gui/about.cpp:94 @@ -53,13 +54,13 @@ msgid "Go up" msgstr "" #: gui/browser.cpp:75 gui/chooser.cpp:46 gui/editrecorddialog.cpp:67 -#: gui/KeysDialog.cpp:43 gui/launcher.cpp:351 gui/massadd.cpp:95 -#: gui/options.cpp:1237 gui/predictivedialog.cpp:74 gui/recorderdialog.cpp:70 -#: gui/recorderdialog.cpp:156 gui/saveload-dialog.cpp:216 -#: gui/saveload-dialog.cpp:276 gui/saveload-dialog.cpp:547 -#: gui/saveload-dialog.cpp:931 gui/themebrowser.cpp:55 -#: gui/fluidsynth-dialog.cpp:152 engines/engine.cpp:483 -#: backends/platform/wii/options.cpp:48 +#: gui/filebrowser-dialog.cpp:64 gui/KeysDialog.cpp:43 gui/launcher.cpp:351 +#: gui/massadd.cpp:95 gui/options.cpp:1237 gui/predictivedialog.cpp:74 +#: gui/recorderdialog.cpp:70 gui/recorderdialog.cpp:156 +#: gui/saveload-dialog.cpp:216 gui/saveload-dialog.cpp:276 +#: gui/saveload-dialog.cpp:547 gui/saveload-dialog.cpp:931 +#: gui/themebrowser.cpp:55 gui/fluidsynth-dialog.cpp:152 +#: engines/engine.cpp:483 backends/platform/wii/options.cpp:48 #: backends/events/default/default-events.cpp:196 #: backends/events/default/default-events.cpp:218 #: engines/drascula/saveload.cpp:49 engines/parallaction/saveload.cpp:274 @@ -68,7 +69,7 @@ msgid "Cancel" msgstr "" #: gui/browser.cpp:76 gui/browser_osx.mm:103 gui/chooser.cpp:47 -#: gui/themebrowser.cpp:56 +#: gui/filebrowser-dialog.cpp:65 gui/themebrowser.cpp:56 msgid "Choose" msgstr "" @@ -88,6 +89,39 @@ msgstr " msgid "Ok" msgstr "Ok" +#: gui/filebrowser-dialog.cpp:49 +msgid "Choose file for loading" +msgstr "" + +#: gui/filebrowser-dialog.cpp:49 +msgid "Enter filename for saving" +msgstr "" + +#: gui/filebrowser-dialog.cpp:132 +#, fuzzy +msgid "Do you really want to overwrite the file?" +msgstr " ?" + +#: gui/filebrowser-dialog.cpp:132 gui/launcher.cpp:793 gui/launcher.cpp:941 +#: gui/launcher.cpp:1000 gui/fluidsynth-dialog.cpp:217 +#: backends/events/symbiansdl/symbiansdl-events.cpp:186 +#: backends/platform/wince/CEActionsPocket.cpp:326 +#: backends/platform/wince/CEActionsSmartphone.cpp:287 +#: backends/platform/wince/CELauncherDialog.cpp:83 +#: engines/kyra/saveload_eob.cpp:557 engines/kyra/saveload_eob.cpp:590 +msgid "Yes" +msgstr "" + +#: gui/filebrowser-dialog.cpp:132 gui/launcher.cpp:793 gui/launcher.cpp:941 +#: gui/launcher.cpp:1000 gui/fluidsynth-dialog.cpp:217 +#: backends/events/symbiansdl/symbiansdl-events.cpp:186 +#: backends/platform/wince/CEActionsPocket.cpp:326 +#: backends/platform/wince/CEActionsSmartphone.cpp:287 +#: backends/platform/wince/CELauncherDialog.cpp:83 +#: engines/kyra/saveload_eob.cpp:557 engines/kyra/saveload_eob.cpp:590 +msgid "No" +msgstr "" + #: gui/gui-manager.cpp:117 backends/keymapper/remap-dialog.cpp:53 #: engines/scumm/help.cpp:126 engines/scumm/help.cpp:141 #: engines/scumm/help.cpp:166 engines/scumm/help.cpp:192 @@ -384,7 +418,7 @@ msgstr " msgid "~Q~uit" msgstr "~~" -#: gui/launcher.cpp:626 backends/platform/sdl/macosx/appmenu_osx.mm:95 +#: gui/launcher.cpp:626 backends/platform/sdl/macosx/appmenu_osx.mm:106 msgid "Quit ScummVM" msgstr " ScummVM" @@ -392,7 +426,7 @@ msgstr " msgid "A~b~out..." msgstr " ~~..." -#: gui/launcher.cpp:627 backends/platform/sdl/macosx/appmenu_osx.mm:69 +#: gui/launcher.cpp:627 backends/platform/sdl/macosx/appmenu_osx.mm:80 msgid "About ScummVM" msgstr " ScummVM" @@ -490,26 +524,6 @@ msgstr "" " ? " " ." -#: gui/launcher.cpp:793 gui/launcher.cpp:941 gui/launcher.cpp:1000 -#: gui/fluidsynth-dialog.cpp:217 -#: backends/events/symbiansdl/symbiansdl-events.cpp:186 -#: backends/platform/wince/CEActionsPocket.cpp:326 -#: backends/platform/wince/CEActionsSmartphone.cpp:287 -#: backends/platform/wince/CELauncherDialog.cpp:83 -#: engines/kyra/saveload_eob.cpp:557 engines/kyra/saveload_eob.cpp:590 -msgid "Yes" -msgstr "" - -#: gui/launcher.cpp:793 gui/launcher.cpp:941 gui/launcher.cpp:1000 -#: gui/fluidsynth-dialog.cpp:217 -#: backends/events/symbiansdl/symbiansdl-events.cpp:186 -#: backends/platform/wince/CEActionsPocket.cpp:326 -#: backends/platform/wince/CEActionsSmartphone.cpp:287 -#: backends/platform/wince/CELauncherDialog.cpp:83 -#: engines/kyra/saveload_eob.cpp:557 engines/kyra/saveload_eob.cpp:590 -msgid "No" -msgstr "" - #: gui/launcher.cpp:841 msgid "ScummVM couldn't open the specified directory!" msgstr "ScummVM !" @@ -660,7 +674,7 @@ msgid "Special dithering modes supported by some games" msgstr " , " #: gui/options.cpp:758 -#: backends/graphics/surfacesdl/surfacesdl-graphics.cpp:2298 +#: backends/graphics/surfacesdl/surfacesdl-graphics.cpp:2313 msgid "Fullscreen mode" msgstr " " @@ -1124,7 +1138,7 @@ msgstr " msgid "Standard Renderer" msgstr " " -#: gui/ThemeEngine.cpp:348 engines/scumm/dialogs.cpp:661 +#: gui/ThemeEngine.cpp:348 engines/scumm/dialogs.cpp:663 msgid "Standard" msgstr "" @@ -1372,7 +1386,7 @@ msgstr "~ #: engines/dialogs.cpp:116 engines/agi/saveload.cpp:803 #: engines/cruise/menu.cpp:212 engines/drascula/saveload.cpp:336 -#: engines/dreamweb/saveload.cpp:261 engines/neverhood/menumodule.cpp:873 +#: engines/dreamweb/saveload.cpp:261 engines/neverhood/menumodule.cpp:877 #: engines/pegasus/pegasus.cpp:377 engines/sci/engine/kfile.cpp:759 #: engines/toltecs/menu.cpp:281 engines/tsage/scenes.cpp:598 msgid "Save game:" @@ -1385,7 +1399,7 @@ msgstr " #: backends/platform/wince/CEActionsSmartphone.cpp:231 #: engines/agi/saveload.cpp:803 engines/cruise/menu.cpp:212 #: engines/drascula/saveload.cpp:336 engines/dreamweb/saveload.cpp:261 -#: engines/neverhood/menumodule.cpp:873 engines/pegasus/pegasus.cpp:377 +#: engines/neverhood/menumodule.cpp:877 engines/pegasus/pegasus.cpp:377 #: engines/sci/engine/kfile.cpp:759 engines/scumm/dialogs.cpp:188 #: engines/toltecs/menu.cpp:281 engines/tsage/scenes.cpp:598 msgid "Save" @@ -1727,57 +1741,57 @@ msgstr " msgid "Right Click" msgstr " " -#: backends/platform/sdl/macosx/appmenu_osx.mm:77 +#: backends/platform/sdl/macosx/appmenu_osx.mm:88 msgid "Hide ScummVM" msgstr " ScummVM" -#: backends/platform/sdl/macosx/appmenu_osx.mm:82 +#: backends/platform/sdl/macosx/appmenu_osx.mm:93 msgid "Hide Others" msgstr " " -#: backends/platform/sdl/macosx/appmenu_osx.mm:87 +#: backends/platform/sdl/macosx/appmenu_osx.mm:98 msgid "Show All" msgstr " " -#: backends/platform/sdl/macosx/appmenu_osx.mm:109 #: backends/platform/sdl/macosx/appmenu_osx.mm:120 +#: backends/platform/sdl/macosx/appmenu_osx.mm:131 msgid "Window" msgstr "" -#: backends/platform/sdl/macosx/appmenu_osx.mm:114 +#: backends/platform/sdl/macosx/appmenu_osx.mm:125 msgid "Minimize" msgstr " Dock" -#: backends/graphics/surfacesdl/surfacesdl-graphics.cpp:46 +#: backends/graphics/surfacesdl/surfacesdl-graphics.cpp:47 msgid "Normal (no scaling)" msgstr " " -#: backends/graphics/surfacesdl/surfacesdl-graphics.cpp:65 +#: backends/graphics/surfacesdl/surfacesdl-graphics.cpp:66 msgctxt "lowres" msgid "Normal (no scaling)" msgstr " " -#: backends/graphics/surfacesdl/surfacesdl-graphics.cpp:2197 +#: backends/graphics/surfacesdl/surfacesdl-graphics.cpp:2212 msgid "Enabled aspect ratio correction" msgstr " " -#: backends/graphics/surfacesdl/surfacesdl-graphics.cpp:2203 +#: backends/graphics/surfacesdl/surfacesdl-graphics.cpp:2218 msgid "Disabled aspect ratio correction" msgstr " " -#: backends/graphics/surfacesdl/surfacesdl-graphics.cpp:2258 +#: backends/graphics/surfacesdl/surfacesdl-graphics.cpp:2273 msgid "Active graphics filter:" msgstr " :" -#: backends/graphics/surfacesdl/surfacesdl-graphics.cpp:2300 +#: backends/graphics/surfacesdl/surfacesdl-graphics.cpp:2315 msgid "Windowed mode" msgstr " " -#: backends/graphics/opengl/opengl-graphics.cpp:118 +#: backends/graphics/opengl/opengl-graphics.cpp:119 msgid "OpenGL" msgstr "OpenGL" -#: backends/graphics/opengl/opengl-graphics.cpp:119 +#: backends/graphics/opengl/opengl-graphics.cpp:120 msgid "OpenGL (No filtering)" msgstr "OpenGL ( )" @@ -2206,7 +2220,8 @@ msgid "" "Use an alternative palette, common for all Amiga games. This was the old " "behavior" msgstr "" -" Amiga. " +" Amiga. " +"" #: engines/agi/detection.cpp:167 msgid "Mouse support" @@ -2216,16 +2231,17 @@ msgstr " msgid "" "Enables mouse support. Allows to use mouse for movement and in game menus." msgstr "" -" . ." +" . " +" ." #: engines/agi/saveload.cpp:816 engines/drascula/saveload.cpp:349 -#: engines/dreamweb/saveload.cpp:169 engines/neverhood/menumodule.cpp:886 +#: engines/dreamweb/saveload.cpp:169 engines/neverhood/menumodule.cpp:890 #: engines/sci/engine/kfile.cpp:858 engines/toltecs/menu.cpp:256 msgid "Restore game:" msgstr " :" #: engines/agi/saveload.cpp:816 engines/drascula/saveload.cpp:349 -#: engines/dreamweb/saveload.cpp:169 engines/neverhood/menumodule.cpp:886 +#: engines/dreamweb/saveload.cpp:169 engines/neverhood/menumodule.cpp:890 #: engines/sci/engine/kfile.cpp:858 engines/toltecs/menu.cpp:256 msgid "Restore" msgstr "" @@ -2467,7 +2483,8 @@ msgid "" "Do you wish to use this save game file with ScummVM?\n" "\n" msgstr "" -" :\n" +" " +" :\n" "\n" "%s %s\n" "\n" @@ -2639,7 +2656,9 @@ msgstr " #: engines/sci/detection.cpp:375 msgid "Skip dithering pass in EGA games, graphics are shown with full colors" -msgstr " EGA, " +msgstr "" +" EGA, " +"" #: engines/sci/detection.cpp:384 msgid "Prefer digital sound effects" @@ -2776,36 +2795,36 @@ msgstr "~ msgid "~N~ext" msgstr "~~" -#: engines/scumm/dialogs.cpp:600 +#: engines/scumm/dialogs.cpp:602 msgid "Speech Only" msgstr " " -#: engines/scumm/dialogs.cpp:601 +#: engines/scumm/dialogs.cpp:603 msgid "Speech and Subtitles" msgstr " " -#: engines/scumm/dialogs.cpp:602 +#: engines/scumm/dialogs.cpp:604 msgid "Subtitles Only" msgstr " " -#: engines/scumm/dialogs.cpp:610 +#: engines/scumm/dialogs.cpp:612 msgctxt "lowres" msgid "Speech & Subs" msgstr " " -#: engines/scumm/dialogs.cpp:656 +#: engines/scumm/dialogs.cpp:658 msgid "Select a Proficiency Level." msgstr " ." -#: engines/scumm/dialogs.cpp:658 +#: engines/scumm/dialogs.cpp:660 msgid "Refer to your Loom(TM) manual for help." msgstr " Loom(TM)" -#: engines/scumm/dialogs.cpp:662 +#: engines/scumm/dialogs.cpp:664 msgid "Practice" msgstr "" -#: engines/scumm/dialogs.cpp:663 +#: engines/scumm/dialogs.cpp:665 msgid "Expert" msgstr "" @@ -3550,7 +3569,8 @@ msgstr " #: engines/zvision/detection_tables.h:92 msgid "Use MPEG video from the DVD version, instead of lower resolution AVI" msgstr "" -" MPEG DVD , AVI" +" MPEG DVD , " +" AVI" #~ msgid "EGA undithering" #~ msgstr "EGA " diff --git a/po/scummvm.pot b/po/scummvm.pot index 1d6b4028bc..0445534008 100644 --- a/po/scummvm.pot +++ b/po/scummvm.pot @@ -8,7 +8,7 @@ msgid "" msgstr "" "Project-Id-Version: ScummVM 1.8.0git\n" "Report-Msgid-Bugs-To: scummvm-devel@lists.sf.net\n" -"POT-Creation-Date: 2015-10-11 18:59+0100\n" +"POT-Creation-Date: 2015-12-23 00:28+0000\n" "PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" "Last-Translator: FULL NAME \n" "Language-Team: LANGUAGE \n" @@ -52,13 +52,13 @@ msgid "Go up" msgstr "" #: gui/browser.cpp:75 gui/chooser.cpp:46 gui/editrecorddialog.cpp:67 -#: gui/KeysDialog.cpp:43 gui/launcher.cpp:351 gui/massadd.cpp:95 -#: gui/options.cpp:1237 gui/predictivedialog.cpp:74 gui/recorderdialog.cpp:70 -#: gui/recorderdialog.cpp:156 gui/saveload-dialog.cpp:216 -#: gui/saveload-dialog.cpp:276 gui/saveload-dialog.cpp:547 -#: gui/saveload-dialog.cpp:931 gui/themebrowser.cpp:55 -#: gui/fluidsynth-dialog.cpp:152 engines/engine.cpp:483 -#: backends/platform/wii/options.cpp:48 +#: gui/filebrowser-dialog.cpp:64 gui/KeysDialog.cpp:43 gui/launcher.cpp:351 +#: gui/massadd.cpp:95 gui/options.cpp:1237 gui/predictivedialog.cpp:74 +#: gui/recorderdialog.cpp:70 gui/recorderdialog.cpp:156 +#: gui/saveload-dialog.cpp:216 gui/saveload-dialog.cpp:276 +#: gui/saveload-dialog.cpp:547 gui/saveload-dialog.cpp:931 +#: gui/themebrowser.cpp:55 gui/fluidsynth-dialog.cpp:152 +#: engines/engine.cpp:483 backends/platform/wii/options.cpp:48 #: backends/events/default/default-events.cpp:196 #: backends/events/default/default-events.cpp:218 #: engines/drascula/saveload.cpp:49 engines/parallaction/saveload.cpp:274 @@ -67,7 +67,7 @@ msgid "Cancel" msgstr "" #: gui/browser.cpp:76 gui/browser_osx.mm:103 gui/chooser.cpp:47 -#: gui/themebrowser.cpp:56 +#: gui/filebrowser-dialog.cpp:65 gui/themebrowser.cpp:56 msgid "Choose" msgstr "" @@ -87,6 +87,38 @@ msgstr "" msgid "Ok" msgstr "" +#: gui/filebrowser-dialog.cpp:49 +msgid "Choose file for loading" +msgstr "" + +#: gui/filebrowser-dialog.cpp:49 +msgid "Enter filename for saving" +msgstr "" + +#: gui/filebrowser-dialog.cpp:132 +msgid "Do you really want to overwrite the file?" +msgstr "" + +#: gui/filebrowser-dialog.cpp:132 gui/launcher.cpp:793 gui/launcher.cpp:941 +#: gui/launcher.cpp:1000 gui/fluidsynth-dialog.cpp:217 +#: backends/events/symbiansdl/symbiansdl-events.cpp:186 +#: backends/platform/wince/CEActionsPocket.cpp:326 +#: backends/platform/wince/CEActionsSmartphone.cpp:287 +#: backends/platform/wince/CELauncherDialog.cpp:83 +#: engines/kyra/saveload_eob.cpp:557 engines/kyra/saveload_eob.cpp:590 +msgid "Yes" +msgstr "" + +#: gui/filebrowser-dialog.cpp:132 gui/launcher.cpp:793 gui/launcher.cpp:941 +#: gui/launcher.cpp:1000 gui/fluidsynth-dialog.cpp:217 +#: backends/events/symbiansdl/symbiansdl-events.cpp:186 +#: backends/platform/wince/CEActionsPocket.cpp:326 +#: backends/platform/wince/CEActionsSmartphone.cpp:287 +#: backends/platform/wince/CELauncherDialog.cpp:83 +#: engines/kyra/saveload_eob.cpp:557 engines/kyra/saveload_eob.cpp:590 +msgid "No" +msgstr "" + #: gui/gui-manager.cpp:117 backends/keymapper/remap-dialog.cpp:53 #: engines/scumm/help.cpp:126 engines/scumm/help.cpp:141 #: engines/scumm/help.cpp:166 engines/scumm/help.cpp:192 @@ -380,7 +412,7 @@ msgstr "" msgid "~Q~uit" msgstr "" -#: gui/launcher.cpp:626 backends/platform/sdl/macosx/appmenu_osx.mm:95 +#: gui/launcher.cpp:626 backends/platform/sdl/macosx/appmenu_osx.mm:106 msgid "Quit ScummVM" msgstr "" @@ -388,7 +420,7 @@ msgstr "" msgid "A~b~out..." msgstr "" -#: gui/launcher.cpp:627 backends/platform/sdl/macosx/appmenu_osx.mm:69 +#: gui/launcher.cpp:627 backends/platform/sdl/macosx/appmenu_osx.mm:80 msgid "About ScummVM" msgstr "" @@ -484,26 +516,6 @@ msgid "" "a huge number of games." msgstr "" -#: gui/launcher.cpp:793 gui/launcher.cpp:941 gui/launcher.cpp:1000 -#: gui/fluidsynth-dialog.cpp:217 -#: backends/events/symbiansdl/symbiansdl-events.cpp:186 -#: backends/platform/wince/CEActionsPocket.cpp:326 -#: backends/platform/wince/CEActionsSmartphone.cpp:287 -#: backends/platform/wince/CELauncherDialog.cpp:83 -#: engines/kyra/saveload_eob.cpp:557 engines/kyra/saveload_eob.cpp:590 -msgid "Yes" -msgstr "" - -#: gui/launcher.cpp:793 gui/launcher.cpp:941 gui/launcher.cpp:1000 -#: gui/fluidsynth-dialog.cpp:217 -#: backends/events/symbiansdl/symbiansdl-events.cpp:186 -#: backends/platform/wince/CEActionsPocket.cpp:326 -#: backends/platform/wince/CEActionsSmartphone.cpp:287 -#: backends/platform/wince/CELauncherDialog.cpp:83 -#: engines/kyra/saveload_eob.cpp:557 engines/kyra/saveload_eob.cpp:590 -msgid "No" -msgstr "" - #: gui/launcher.cpp:841 msgid "ScummVM couldn't open the specified directory!" msgstr "" @@ -654,7 +666,7 @@ msgid "Special dithering modes supported by some games" msgstr "" #: gui/options.cpp:758 -#: backends/graphics/surfacesdl/surfacesdl-graphics.cpp:2298 +#: backends/graphics/surfacesdl/surfacesdl-graphics.cpp:2313 msgid "Fullscreen mode" msgstr "" @@ -1103,7 +1115,7 @@ msgstr "" msgid "Standard Renderer" msgstr "" -#: gui/ThemeEngine.cpp:348 engines/scumm/dialogs.cpp:661 +#: gui/ThemeEngine.cpp:348 engines/scumm/dialogs.cpp:663 msgid "Standard" msgstr "" @@ -1348,7 +1360,7 @@ msgstr "" #: engines/dialogs.cpp:116 engines/agi/saveload.cpp:803 #: engines/cruise/menu.cpp:212 engines/drascula/saveload.cpp:336 -#: engines/dreamweb/saveload.cpp:261 engines/neverhood/menumodule.cpp:873 +#: engines/dreamweb/saveload.cpp:261 engines/neverhood/menumodule.cpp:877 #: engines/pegasus/pegasus.cpp:377 engines/sci/engine/kfile.cpp:759 #: engines/toltecs/menu.cpp:281 engines/tsage/scenes.cpp:598 msgid "Save game:" @@ -1361,7 +1373,7 @@ msgstr "" #: backends/platform/wince/CEActionsSmartphone.cpp:231 #: engines/agi/saveload.cpp:803 engines/cruise/menu.cpp:212 #: engines/drascula/saveload.cpp:336 engines/dreamweb/saveload.cpp:261 -#: engines/neverhood/menumodule.cpp:873 engines/pegasus/pegasus.cpp:377 +#: engines/neverhood/menumodule.cpp:877 engines/pegasus/pegasus.cpp:377 #: engines/sci/engine/kfile.cpp:759 engines/scumm/dialogs.cpp:188 #: engines/toltecs/menu.cpp:281 engines/tsage/scenes.cpp:598 msgid "Save" @@ -1672,57 +1684,57 @@ msgstr "" msgid "Right Click" msgstr "" -#: backends/platform/sdl/macosx/appmenu_osx.mm:77 +#: backends/platform/sdl/macosx/appmenu_osx.mm:88 msgid "Hide ScummVM" msgstr "" -#: backends/platform/sdl/macosx/appmenu_osx.mm:82 +#: backends/platform/sdl/macosx/appmenu_osx.mm:93 msgid "Hide Others" msgstr "" -#: backends/platform/sdl/macosx/appmenu_osx.mm:87 +#: backends/platform/sdl/macosx/appmenu_osx.mm:98 msgid "Show All" msgstr "" -#: backends/platform/sdl/macosx/appmenu_osx.mm:109 #: backends/platform/sdl/macosx/appmenu_osx.mm:120 +#: backends/platform/sdl/macosx/appmenu_osx.mm:131 msgid "Window" msgstr "" -#: backends/platform/sdl/macosx/appmenu_osx.mm:114 +#: backends/platform/sdl/macosx/appmenu_osx.mm:125 msgid "Minimize" msgstr "" -#: backends/graphics/surfacesdl/surfacesdl-graphics.cpp:46 +#: backends/graphics/surfacesdl/surfacesdl-graphics.cpp:47 msgid "Normal (no scaling)" msgstr "" -#: backends/graphics/surfacesdl/surfacesdl-graphics.cpp:65 +#: backends/graphics/surfacesdl/surfacesdl-graphics.cpp:66 msgctxt "lowres" msgid "Normal (no scaling)" msgstr "" -#: backends/graphics/surfacesdl/surfacesdl-graphics.cpp:2197 +#: backends/graphics/surfacesdl/surfacesdl-graphics.cpp:2212 msgid "Enabled aspect ratio correction" msgstr "" -#: backends/graphics/surfacesdl/surfacesdl-graphics.cpp:2203 +#: backends/graphics/surfacesdl/surfacesdl-graphics.cpp:2218 msgid "Disabled aspect ratio correction" msgstr "" -#: backends/graphics/surfacesdl/surfacesdl-graphics.cpp:2258 +#: backends/graphics/surfacesdl/surfacesdl-graphics.cpp:2273 msgid "Active graphics filter:" msgstr "" -#: backends/graphics/surfacesdl/surfacesdl-graphics.cpp:2300 +#: backends/graphics/surfacesdl/surfacesdl-graphics.cpp:2315 msgid "Windowed mode" msgstr "" -#: backends/graphics/opengl/opengl-graphics.cpp:118 +#: backends/graphics/opengl/opengl-graphics.cpp:119 msgid "OpenGL" msgstr "" -#: backends/graphics/opengl/opengl-graphics.cpp:119 +#: backends/graphics/opengl/opengl-graphics.cpp:120 msgid "OpenGL (No filtering)" msgstr "" @@ -2158,13 +2170,13 @@ msgid "" msgstr "" #: engines/agi/saveload.cpp:816 engines/drascula/saveload.cpp:349 -#: engines/dreamweb/saveload.cpp:169 engines/neverhood/menumodule.cpp:886 +#: engines/dreamweb/saveload.cpp:169 engines/neverhood/menumodule.cpp:890 #: engines/sci/engine/kfile.cpp:858 engines/toltecs/menu.cpp:256 msgid "Restore game:" msgstr "" #: engines/agi/saveload.cpp:816 engines/drascula/saveload.cpp:349 -#: engines/dreamweb/saveload.cpp:169 engines/neverhood/menumodule.cpp:886 +#: engines/dreamweb/saveload.cpp:169 engines/neverhood/menumodule.cpp:890 #: engines/sci/engine/kfile.cpp:858 engines/toltecs/menu.cpp:256 msgid "Restore" msgstr "" @@ -2661,36 +2673,36 @@ msgstr "" msgid "~N~ext" msgstr "" -#: engines/scumm/dialogs.cpp:600 +#: engines/scumm/dialogs.cpp:602 msgid "Speech Only" msgstr "" -#: engines/scumm/dialogs.cpp:601 +#: engines/scumm/dialogs.cpp:603 msgid "Speech and Subtitles" msgstr "" -#: engines/scumm/dialogs.cpp:602 +#: engines/scumm/dialogs.cpp:604 msgid "Subtitles Only" msgstr "" -#: engines/scumm/dialogs.cpp:610 +#: engines/scumm/dialogs.cpp:612 msgctxt "lowres" msgid "Speech & Subs" msgstr "" -#: engines/scumm/dialogs.cpp:656 +#: engines/scumm/dialogs.cpp:658 msgid "Select a Proficiency Level." msgstr "" -#: engines/scumm/dialogs.cpp:658 +#: engines/scumm/dialogs.cpp:660 msgid "Refer to your Loom(TM) manual for help." msgstr "" -#: engines/scumm/dialogs.cpp:662 +#: engines/scumm/dialogs.cpp:664 msgid "Practice" msgstr "" -#: engines/scumm/dialogs.cpp:663 +#: engines/scumm/dialogs.cpp:665 msgid "Expert" msgstr "" diff --git a/po/se_SE.po b/po/se_SE.po index 814a5b1e86..e6ab951cd5 100644 --- a/po/se_SE.po +++ b/po/se_SE.po @@ -7,7 +7,7 @@ msgid "" msgstr "" "Project-Id-Version: ScummVM 1.5.0svn\n" "Report-Msgid-Bugs-To: scummvm-devel@lists.sf.net\n" -"POT-Creation-Date: 2015-10-11 18:59+0100\n" +"POT-Creation-Date: 2015-12-23 00:28+0000\n" "PO-Revision-Date: 2014-07-02 16:30+0100\n" "Last-Translator: Hampus Flink \n" "Language-Team: \n" @@ -54,13 +54,13 @@ msgid "Go up" msgstr "Uppt" #: gui/browser.cpp:75 gui/chooser.cpp:46 gui/editrecorddialog.cpp:67 -#: gui/KeysDialog.cpp:43 gui/launcher.cpp:351 gui/massadd.cpp:95 -#: gui/options.cpp:1237 gui/predictivedialog.cpp:74 gui/recorderdialog.cpp:70 -#: gui/recorderdialog.cpp:156 gui/saveload-dialog.cpp:216 -#: gui/saveload-dialog.cpp:276 gui/saveload-dialog.cpp:547 -#: gui/saveload-dialog.cpp:931 gui/themebrowser.cpp:55 -#: gui/fluidsynth-dialog.cpp:152 engines/engine.cpp:483 -#: backends/platform/wii/options.cpp:48 +#: gui/filebrowser-dialog.cpp:64 gui/KeysDialog.cpp:43 gui/launcher.cpp:351 +#: gui/massadd.cpp:95 gui/options.cpp:1237 gui/predictivedialog.cpp:74 +#: gui/recorderdialog.cpp:70 gui/recorderdialog.cpp:156 +#: gui/saveload-dialog.cpp:216 gui/saveload-dialog.cpp:276 +#: gui/saveload-dialog.cpp:547 gui/saveload-dialog.cpp:931 +#: gui/themebrowser.cpp:55 gui/fluidsynth-dialog.cpp:152 +#: engines/engine.cpp:483 backends/platform/wii/options.cpp:48 #: backends/events/default/default-events.cpp:196 #: backends/events/default/default-events.cpp:218 #: engines/drascula/saveload.cpp:49 engines/parallaction/saveload.cpp:274 @@ -69,7 +69,7 @@ msgid "Cancel" msgstr "Avbryt" #: gui/browser.cpp:76 gui/browser_osx.mm:103 gui/chooser.cpp:47 -#: gui/themebrowser.cpp:56 +#: gui/filebrowser-dialog.cpp:65 gui/themebrowser.cpp:56 msgid "Choose" msgstr "Vlj" @@ -89,6 +89,39 @@ msgstr "" msgid "Ok" msgstr "" +#: gui/filebrowser-dialog.cpp:49 +msgid "Choose file for loading" +msgstr "" + +#: gui/filebrowser-dialog.cpp:49 +msgid "Enter filename for saving" +msgstr "" + +#: gui/filebrowser-dialog.cpp:132 +#, fuzzy +msgid "Do you really want to overwrite the file?" +msgstr "Vill du verkligen radera den hr spardatan?" + +#: gui/filebrowser-dialog.cpp:132 gui/launcher.cpp:793 gui/launcher.cpp:941 +#: gui/launcher.cpp:1000 gui/fluidsynth-dialog.cpp:217 +#: backends/events/symbiansdl/symbiansdl-events.cpp:186 +#: backends/platform/wince/CEActionsPocket.cpp:326 +#: backends/platform/wince/CEActionsSmartphone.cpp:287 +#: backends/platform/wince/CELauncherDialog.cpp:83 +#: engines/kyra/saveload_eob.cpp:557 engines/kyra/saveload_eob.cpp:590 +msgid "Yes" +msgstr "Ja" + +#: gui/filebrowser-dialog.cpp:132 gui/launcher.cpp:793 gui/launcher.cpp:941 +#: gui/launcher.cpp:1000 gui/fluidsynth-dialog.cpp:217 +#: backends/events/symbiansdl/symbiansdl-events.cpp:186 +#: backends/platform/wince/CEActionsPocket.cpp:326 +#: backends/platform/wince/CEActionsSmartphone.cpp:287 +#: backends/platform/wince/CELauncherDialog.cpp:83 +#: engines/kyra/saveload_eob.cpp:557 engines/kyra/saveload_eob.cpp:590 +msgid "No" +msgstr "Nej" + #: gui/gui-manager.cpp:117 backends/keymapper/remap-dialog.cpp:53 #: engines/scumm/help.cpp:126 engines/scumm/help.cpp:141 #: engines/scumm/help.cpp:166 engines/scumm/help.cpp:192 @@ -386,7 +419,7 @@ msgstr "Detta ID-namn msgid "~Q~uit" msgstr "~A~vsluta" -#: gui/launcher.cpp:626 backends/platform/sdl/macosx/appmenu_osx.mm:95 +#: gui/launcher.cpp:626 backends/platform/sdl/macosx/appmenu_osx.mm:106 msgid "Quit ScummVM" msgstr "Avsluta ScummVM" @@ -394,7 +427,7 @@ msgstr "Avsluta ScummVM" msgid "A~b~out..." msgstr "O~m~..." -#: gui/launcher.cpp:627 backends/platform/sdl/macosx/appmenu_osx.mm:69 +#: gui/launcher.cpp:627 backends/platform/sdl/macosx/appmenu_osx.mm:80 msgid "About ScummVM" msgstr "Om ScummVM" @@ -492,26 +525,6 @@ msgstr "" "Vill du verkligen anvnda mass-speldetektorn? Processen kan potentiellt " "lgga till ett enormt antal spel." -#: gui/launcher.cpp:793 gui/launcher.cpp:941 gui/launcher.cpp:1000 -#: gui/fluidsynth-dialog.cpp:217 -#: backends/events/symbiansdl/symbiansdl-events.cpp:186 -#: backends/platform/wince/CEActionsPocket.cpp:326 -#: backends/platform/wince/CEActionsSmartphone.cpp:287 -#: backends/platform/wince/CELauncherDialog.cpp:83 -#: engines/kyra/saveload_eob.cpp:557 engines/kyra/saveload_eob.cpp:590 -msgid "Yes" -msgstr "Ja" - -#: gui/launcher.cpp:793 gui/launcher.cpp:941 gui/launcher.cpp:1000 -#: gui/fluidsynth-dialog.cpp:217 -#: backends/events/symbiansdl/symbiansdl-events.cpp:186 -#: backends/platform/wince/CEActionsPocket.cpp:326 -#: backends/platform/wince/CEActionsSmartphone.cpp:287 -#: backends/platform/wince/CELauncherDialog.cpp:83 -#: engines/kyra/saveload_eob.cpp:557 engines/kyra/saveload_eob.cpp:590 -msgid "No" -msgstr "Nej" - #: gui/launcher.cpp:841 msgid "ScummVM couldn't open the specified directory!" msgstr "ScummVM kunde inte ppna den valda katalogen!" @@ -665,7 +678,7 @@ msgid "Special dithering modes supported by some games" msgstr "Speciella gitterlgen stdda av vissa spel" #: gui/options.cpp:758 -#: backends/graphics/surfacesdl/surfacesdl-graphics.cpp:2298 +#: backends/graphics/surfacesdl/surfacesdl-graphics.cpp:2313 msgid "Fullscreen mode" msgstr "Fullskrmslge" @@ -1129,7 +1142,7 @@ msgstr "Inaktiverad GFX" msgid "Standard Renderer" msgstr "Standard rendering" -#: gui/ThemeEngine.cpp:348 engines/scumm/dialogs.cpp:661 +#: gui/ThemeEngine.cpp:348 engines/scumm/dialogs.cpp:663 msgid "Standard" msgstr "Standard" @@ -1378,7 +1391,7 @@ msgstr " #: engines/dialogs.cpp:116 engines/agi/saveload.cpp:803 #: engines/cruise/menu.cpp:212 engines/drascula/saveload.cpp:336 -#: engines/dreamweb/saveload.cpp:261 engines/neverhood/menumodule.cpp:873 +#: engines/dreamweb/saveload.cpp:261 engines/neverhood/menumodule.cpp:877 #: engines/pegasus/pegasus.cpp:377 engines/sci/engine/kfile.cpp:759 #: engines/toltecs/menu.cpp:281 engines/tsage/scenes.cpp:598 msgid "Save game:" @@ -1391,7 +1404,7 @@ msgstr "Spara spelet:" #: backends/platform/wince/CEActionsSmartphone.cpp:231 #: engines/agi/saveload.cpp:803 engines/cruise/menu.cpp:212 #: engines/drascula/saveload.cpp:336 engines/dreamweb/saveload.cpp:261 -#: engines/neverhood/menumodule.cpp:873 engines/pegasus/pegasus.cpp:377 +#: engines/neverhood/menumodule.cpp:877 engines/pegasus/pegasus.cpp:377 #: engines/sci/engine/kfile.cpp:759 engines/scumm/dialogs.cpp:188 #: engines/toltecs/menu.cpp:281 engines/tsage/scenes.cpp:598 msgid "Save" @@ -1730,57 +1743,57 @@ msgstr "Mittenklick" msgid "Right Click" msgstr "Hgerklick" -#: backends/platform/sdl/macosx/appmenu_osx.mm:77 +#: backends/platform/sdl/macosx/appmenu_osx.mm:88 msgid "Hide ScummVM" msgstr "Gm ScummVM" -#: backends/platform/sdl/macosx/appmenu_osx.mm:82 +#: backends/platform/sdl/macosx/appmenu_osx.mm:93 msgid "Hide Others" msgstr "Gm vriga" -#: backends/platform/sdl/macosx/appmenu_osx.mm:87 +#: backends/platform/sdl/macosx/appmenu_osx.mm:98 msgid "Show All" msgstr "Visa alla" -#: backends/platform/sdl/macosx/appmenu_osx.mm:109 #: backends/platform/sdl/macosx/appmenu_osx.mm:120 +#: backends/platform/sdl/macosx/appmenu_osx.mm:131 msgid "Window" msgstr "Fnster" -#: backends/platform/sdl/macosx/appmenu_osx.mm:114 +#: backends/platform/sdl/macosx/appmenu_osx.mm:125 msgid "Minimize" msgstr "Minimera" -#: backends/graphics/surfacesdl/surfacesdl-graphics.cpp:46 +#: backends/graphics/surfacesdl/surfacesdl-graphics.cpp:47 msgid "Normal (no scaling)" msgstr "Normalt (ingen skalning)" -#: backends/graphics/surfacesdl/surfacesdl-graphics.cpp:65 +#: backends/graphics/surfacesdl/surfacesdl-graphics.cpp:66 msgctxt "lowres" msgid "Normal (no scaling)" msgstr "Normalt (ingen skalning)" -#: backends/graphics/surfacesdl/surfacesdl-graphics.cpp:2197 +#: backends/graphics/surfacesdl/surfacesdl-graphics.cpp:2212 msgid "Enabled aspect ratio correction" msgstr "Korrektion av bildfrhllande p" -#: backends/graphics/surfacesdl/surfacesdl-graphics.cpp:2203 +#: backends/graphics/surfacesdl/surfacesdl-graphics.cpp:2218 msgid "Disabled aspect ratio correction" msgstr "Korrektion av bildfrhllande av" -#: backends/graphics/surfacesdl/surfacesdl-graphics.cpp:2258 +#: backends/graphics/surfacesdl/surfacesdl-graphics.cpp:2273 msgid "Active graphics filter:" msgstr "Aktivt grafikfilter:" -#: backends/graphics/surfacesdl/surfacesdl-graphics.cpp:2300 +#: backends/graphics/surfacesdl/surfacesdl-graphics.cpp:2315 msgid "Windowed mode" msgstr "Fnsterlge" -#: backends/graphics/opengl/opengl-graphics.cpp:118 +#: backends/graphics/opengl/opengl-graphics.cpp:119 msgid "OpenGL" msgstr "OpenGL" -#: backends/graphics/opengl/opengl-graphics.cpp:119 +#: backends/graphics/opengl/opengl-graphics.cpp:120 msgid "OpenGL (No filtering)" msgstr "OpenGL (ingen filtrering)" @@ -2223,13 +2236,13 @@ msgid "" msgstr "" #: engines/agi/saveload.cpp:816 engines/drascula/saveload.cpp:349 -#: engines/dreamweb/saveload.cpp:169 engines/neverhood/menumodule.cpp:886 +#: engines/dreamweb/saveload.cpp:169 engines/neverhood/menumodule.cpp:890 #: engines/sci/engine/kfile.cpp:858 engines/toltecs/menu.cpp:256 msgid "Restore game:" msgstr "terstll spel:" #: engines/agi/saveload.cpp:816 engines/drascula/saveload.cpp:349 -#: engines/dreamweb/saveload.cpp:169 engines/neverhood/menumodule.cpp:886 +#: engines/dreamweb/saveload.cpp:169 engines/neverhood/menumodule.cpp:890 #: engines/sci/engine/kfile.cpp:858 engines/toltecs/menu.cpp:256 msgid "Restore" msgstr "terstll" @@ -2767,36 +2780,36 @@ msgstr "~F~ msgid "~N~ext" msgstr "~N~sta" -#: engines/scumm/dialogs.cpp:600 +#: engines/scumm/dialogs.cpp:602 msgid "Speech Only" msgstr "Endast tal" -#: engines/scumm/dialogs.cpp:601 +#: engines/scumm/dialogs.cpp:603 msgid "Speech and Subtitles" msgstr "Tal och undertexter" -#: engines/scumm/dialogs.cpp:602 +#: engines/scumm/dialogs.cpp:604 msgid "Subtitles Only" msgstr "Endast undertexter" -#: engines/scumm/dialogs.cpp:610 +#: engines/scumm/dialogs.cpp:612 msgctxt "lowres" msgid "Speech & Subs" msgstr "Tal & text" -#: engines/scumm/dialogs.cpp:656 +#: engines/scumm/dialogs.cpp:658 msgid "Select a Proficiency Level." msgstr "Vlj en skicklighetsniv." -#: engines/scumm/dialogs.cpp:658 +#: engines/scumm/dialogs.cpp:660 msgid "Refer to your Loom(TM) manual for help." msgstr "Hnvisa till din Loom(TM)-manual fr hjlp." -#: engines/scumm/dialogs.cpp:662 +#: engines/scumm/dialogs.cpp:664 msgid "Practice" msgstr "vning" -#: engines/scumm/dialogs.cpp:663 +#: engines/scumm/dialogs.cpp:665 msgid "Expert" msgstr "Expert" diff --git a/po/uk_UA.po b/po/uk_UA.po index c4264f84c2..11399efb7e 100644 --- a/po/uk_UA.po +++ b/po/uk_UA.po @@ -8,7 +8,7 @@ msgid "" msgstr "" "Project-Id-Version: ScummVM 1.3.0svn\n" "Report-Msgid-Bugs-To: scummvm-devel@lists.sf.net\n" -"POT-Creation-Date: 2015-10-11 18:59+0100\n" +"POT-Creation-Date: 2015-12-23 00:28+0000\n" "PO-Revision-Date: 2015-11-06 10:07+0300\n" "Last-Translator: Eugene Sandulenko \n" "Language-Team: Ukrainian\n" @@ -16,7 +16,8 @@ msgstr "" "MIME-Version: 1.0\n" "Content-Type: text/plain; charset=iso-8859-5\n" "Content-Transfer-Encoding: 8bit\n" -"Plural-Forms: nplurals=3; plural=n%10==1 && n%100!=11 ? 0 : n%10>=2 && n%10<=4 && (n%100<10 || n%100>=20) ? 1 : 2;\n" +"Plural-Forms: nplurals=3; plural=n%10==1 && n%100!=11 ? 0 : n%10>=2 && n" +"%10<=4 && (n%100<10 || n%100>=20) ? 1 : 2;\n" #: gui/about.cpp:94 #, c-format @@ -53,13 +54,13 @@ msgid "Go up" msgstr "" #: gui/browser.cpp:75 gui/chooser.cpp:46 gui/editrecorddialog.cpp:67 -#: gui/KeysDialog.cpp:43 gui/launcher.cpp:351 gui/massadd.cpp:95 -#: gui/options.cpp:1237 gui/predictivedialog.cpp:74 gui/recorderdialog.cpp:70 -#: gui/recorderdialog.cpp:156 gui/saveload-dialog.cpp:216 -#: gui/saveload-dialog.cpp:276 gui/saveload-dialog.cpp:547 -#: gui/saveload-dialog.cpp:931 gui/themebrowser.cpp:55 -#: gui/fluidsynth-dialog.cpp:152 engines/engine.cpp:483 -#: backends/platform/wii/options.cpp:48 +#: gui/filebrowser-dialog.cpp:64 gui/KeysDialog.cpp:43 gui/launcher.cpp:351 +#: gui/massadd.cpp:95 gui/options.cpp:1237 gui/predictivedialog.cpp:74 +#: gui/recorderdialog.cpp:70 gui/recorderdialog.cpp:156 +#: gui/saveload-dialog.cpp:216 gui/saveload-dialog.cpp:276 +#: gui/saveload-dialog.cpp:547 gui/saveload-dialog.cpp:931 +#: gui/themebrowser.cpp:55 gui/fluidsynth-dialog.cpp:152 +#: engines/engine.cpp:483 backends/platform/wii/options.cpp:48 #: backends/events/default/default-events.cpp:196 #: backends/events/default/default-events.cpp:218 #: engines/drascula/saveload.cpp:49 engines/parallaction/saveload.cpp:274 @@ -68,7 +69,7 @@ msgid "Cancel" msgstr "" #: gui/browser.cpp:76 gui/browser_osx.mm:103 gui/chooser.cpp:47 -#: gui/themebrowser.cpp:56 +#: gui/filebrowser-dialog.cpp:65 gui/themebrowser.cpp:56 msgid "Choose" msgstr "" @@ -88,6 +89,39 @@ msgstr " msgid "Ok" msgstr "" +#: gui/filebrowser-dialog.cpp:49 +msgid "Choose file for loading" +msgstr "" + +#: gui/filebrowser-dialog.cpp:49 +msgid "Enter filename for saving" +msgstr "" + +#: gui/filebrowser-dialog.cpp:132 +#, fuzzy +msgid "Do you really want to overwrite the file?" +msgstr " ?" + +#: gui/filebrowser-dialog.cpp:132 gui/launcher.cpp:793 gui/launcher.cpp:941 +#: gui/launcher.cpp:1000 gui/fluidsynth-dialog.cpp:217 +#: backends/events/symbiansdl/symbiansdl-events.cpp:186 +#: backends/platform/wince/CEActionsPocket.cpp:326 +#: backends/platform/wince/CEActionsSmartphone.cpp:287 +#: backends/platform/wince/CELauncherDialog.cpp:83 +#: engines/kyra/saveload_eob.cpp:557 engines/kyra/saveload_eob.cpp:590 +msgid "Yes" +msgstr "" + +#: gui/filebrowser-dialog.cpp:132 gui/launcher.cpp:793 gui/launcher.cpp:941 +#: gui/launcher.cpp:1000 gui/fluidsynth-dialog.cpp:217 +#: backends/events/symbiansdl/symbiansdl-events.cpp:186 +#: backends/platform/wince/CEActionsPocket.cpp:326 +#: backends/platform/wince/CEActionsSmartphone.cpp:287 +#: backends/platform/wince/CELauncherDialog.cpp:83 +#: engines/kyra/saveload_eob.cpp:557 engines/kyra/saveload_eob.cpp:590 +msgid "No" +msgstr "" + #: gui/gui-manager.cpp:117 backends/keymapper/remap-dialog.cpp:53 #: engines/scumm/help.cpp:126 engines/scumm/help.cpp:141 #: engines/scumm/help.cpp:166 engines/scumm/help.cpp:192 @@ -385,7 +419,7 @@ msgstr " msgid "~Q~uit" msgstr "~~" -#: gui/launcher.cpp:626 backends/platform/sdl/macosx/appmenu_osx.mm:95 +#: gui/launcher.cpp:626 backends/platform/sdl/macosx/appmenu_osx.mm:106 msgid "Quit ScummVM" msgstr " ScummVM" @@ -393,7 +427,7 @@ msgstr " msgid "A~b~out..." msgstr " ~~..." -#: gui/launcher.cpp:627 backends/platform/sdl/macosx/appmenu_osx.mm:69 +#: gui/launcher.cpp:627 backends/platform/sdl/macosx/appmenu_osx.mm:80 msgid "About ScummVM" msgstr " ScummVM" @@ -491,26 +525,6 @@ msgstr "" " ? " " ." -#: gui/launcher.cpp:793 gui/launcher.cpp:941 gui/launcher.cpp:1000 -#: gui/fluidsynth-dialog.cpp:217 -#: backends/events/symbiansdl/symbiansdl-events.cpp:186 -#: backends/platform/wince/CEActionsPocket.cpp:326 -#: backends/platform/wince/CEActionsSmartphone.cpp:287 -#: backends/platform/wince/CELauncherDialog.cpp:83 -#: engines/kyra/saveload_eob.cpp:557 engines/kyra/saveload_eob.cpp:590 -msgid "Yes" -msgstr "" - -#: gui/launcher.cpp:793 gui/launcher.cpp:941 gui/launcher.cpp:1000 -#: gui/fluidsynth-dialog.cpp:217 -#: backends/events/symbiansdl/symbiansdl-events.cpp:186 -#: backends/platform/wince/CEActionsPocket.cpp:326 -#: backends/platform/wince/CEActionsSmartphone.cpp:287 -#: backends/platform/wince/CELauncherDialog.cpp:83 -#: engines/kyra/saveload_eob.cpp:557 engines/kyra/saveload_eob.cpp:590 -msgid "No" -msgstr "" - #: gui/launcher.cpp:841 msgid "ScummVM couldn't open the specified directory!" msgstr "ScummVM !" @@ -661,7 +675,7 @@ msgid "Special dithering modes supported by some games" msgstr " , " #: gui/options.cpp:758 -#: backends/graphics/surfacesdl/surfacesdl-graphics.cpp:2298 +#: backends/graphics/surfacesdl/surfacesdl-graphics.cpp:2313 msgid "Fullscreen mode" msgstr " " @@ -1123,7 +1137,7 @@ msgstr " msgid "Standard Renderer" msgstr " " -#: gui/ThemeEngine.cpp:348 engines/scumm/dialogs.cpp:661 +#: gui/ThemeEngine.cpp:348 engines/scumm/dialogs.cpp:663 msgid "Standard" msgstr "" @@ -1370,7 +1384,7 @@ msgstr "~ #: engines/dialogs.cpp:116 engines/agi/saveload.cpp:803 #: engines/cruise/menu.cpp:212 engines/drascula/saveload.cpp:336 -#: engines/dreamweb/saveload.cpp:261 engines/neverhood/menumodule.cpp:873 +#: engines/dreamweb/saveload.cpp:261 engines/neverhood/menumodule.cpp:877 #: engines/pegasus/pegasus.cpp:377 engines/sci/engine/kfile.cpp:759 #: engines/toltecs/menu.cpp:281 engines/tsage/scenes.cpp:598 msgid "Save game:" @@ -1383,7 +1397,7 @@ msgstr " #: backends/platform/wince/CEActionsSmartphone.cpp:231 #: engines/agi/saveload.cpp:803 engines/cruise/menu.cpp:212 #: engines/drascula/saveload.cpp:336 engines/dreamweb/saveload.cpp:261 -#: engines/neverhood/menumodule.cpp:873 engines/pegasus/pegasus.cpp:377 +#: engines/neverhood/menumodule.cpp:877 engines/pegasus/pegasus.cpp:377 #: engines/sci/engine/kfile.cpp:759 engines/scumm/dialogs.cpp:188 #: engines/toltecs/menu.cpp:281 engines/tsage/scenes.cpp:598 msgid "Save" @@ -1722,57 +1736,57 @@ msgstr " msgid "Right Click" msgstr " " -#: backends/platform/sdl/macosx/appmenu_osx.mm:77 +#: backends/platform/sdl/macosx/appmenu_osx.mm:88 msgid "Hide ScummVM" msgstr " ScummVM" -#: backends/platform/sdl/macosx/appmenu_osx.mm:82 +#: backends/platform/sdl/macosx/appmenu_osx.mm:93 msgid "Hide Others" msgstr " " -#: backends/platform/sdl/macosx/appmenu_osx.mm:87 +#: backends/platform/sdl/macosx/appmenu_osx.mm:98 msgid "Show All" msgstr " " -#: backends/platform/sdl/macosx/appmenu_osx.mm:109 #: backends/platform/sdl/macosx/appmenu_osx.mm:120 +#: backends/platform/sdl/macosx/appmenu_osx.mm:131 msgid "Window" msgstr "" -#: backends/platform/sdl/macosx/appmenu_osx.mm:114 +#: backends/platform/sdl/macosx/appmenu_osx.mm:125 msgid "Minimize" msgstr "" -#: backends/graphics/surfacesdl/surfacesdl-graphics.cpp:46 +#: backends/graphics/surfacesdl/surfacesdl-graphics.cpp:47 msgid "Normal (no scaling)" msgstr " " -#: backends/graphics/surfacesdl/surfacesdl-graphics.cpp:65 +#: backends/graphics/surfacesdl/surfacesdl-graphics.cpp:66 msgctxt "lowres" msgid "Normal (no scaling)" msgstr " " -#: backends/graphics/surfacesdl/surfacesdl-graphics.cpp:2197 +#: backends/graphics/surfacesdl/surfacesdl-graphics.cpp:2212 msgid "Enabled aspect ratio correction" msgstr " " -#: backends/graphics/surfacesdl/surfacesdl-graphics.cpp:2203 +#: backends/graphics/surfacesdl/surfacesdl-graphics.cpp:2218 msgid "Disabled aspect ratio correction" msgstr " " -#: backends/graphics/surfacesdl/surfacesdl-graphics.cpp:2258 +#: backends/graphics/surfacesdl/surfacesdl-graphics.cpp:2273 msgid "Active graphics filter:" msgstr " :" -#: backends/graphics/surfacesdl/surfacesdl-graphics.cpp:2300 +#: backends/graphics/surfacesdl/surfacesdl-graphics.cpp:2315 msgid "Windowed mode" msgstr " " -#: backends/graphics/opengl/opengl-graphics.cpp:118 +#: backends/graphics/opengl/opengl-graphics.cpp:119 msgid "OpenGL" msgstr "OpenGL" -#: backends/graphics/opengl/opengl-graphics.cpp:119 +#: backends/graphics/opengl/opengl-graphics.cpp:120 msgid "OpenGL (No filtering)" msgstr "OpenGL ( )" @@ -2202,7 +2216,8 @@ msgid "" "Use an alternative palette, common for all Amiga games. This was the old " "behavior" msgstr "" -" , Amiga. ." +" , Amiga. " +" ." #: engines/agi/detection.cpp:167 msgid "Mouse support" @@ -2212,16 +2227,17 @@ msgstr " msgid "" "Enables mouse support. Allows to use mouse for movement and in game menus." msgstr "" -" . ." +" . " +" ." #: engines/agi/saveload.cpp:816 engines/drascula/saveload.cpp:349 -#: engines/dreamweb/saveload.cpp:169 engines/neverhood/menumodule.cpp:886 +#: engines/dreamweb/saveload.cpp:169 engines/neverhood/menumodule.cpp:890 #: engines/sci/engine/kfile.cpp:858 engines/toltecs/menu.cpp:256 msgid "Restore game:" msgstr " :" #: engines/agi/saveload.cpp:816 engines/drascula/saveload.cpp:349 -#: engines/dreamweb/saveload.cpp:169 engines/neverhood/menumodule.cpp:886 +#: engines/dreamweb/saveload.cpp:169 engines/neverhood/menumodule.cpp:890 #: engines/sci/engine/kfile.cpp:858 engines/toltecs/menu.cpp:256 msgid "Restore" msgstr "" @@ -2488,7 +2504,8 @@ msgid "" "\n" msgstr "" "%d \n" -"ScummVM. , \n" +"ScummVM. " +", \n" " 'import_savefile'.\n" "\n" @@ -2766,36 +2783,36 @@ msgstr "~ msgid "~N~ext" msgstr "~~" -#: engines/scumm/dialogs.cpp:600 +#: engines/scumm/dialogs.cpp:602 msgid "Speech Only" msgstr " " -#: engines/scumm/dialogs.cpp:601 +#: engines/scumm/dialogs.cpp:603 msgid "Speech and Subtitles" msgstr " " -#: engines/scumm/dialogs.cpp:602 +#: engines/scumm/dialogs.cpp:604 msgid "Subtitles Only" msgstr " " -#: engines/scumm/dialogs.cpp:610 +#: engines/scumm/dialogs.cpp:612 msgctxt "lowres" msgid "Speech & Subs" msgstr " " -#: engines/scumm/dialogs.cpp:656 +#: engines/scumm/dialogs.cpp:658 msgid "Select a Proficiency Level." msgstr " ." -#: engines/scumm/dialogs.cpp:658 +#: engines/scumm/dialogs.cpp:660 msgid "Refer to your Loom(TM) manual for help." msgstr " Loom(TM)." -#: engines/scumm/dialogs.cpp:662 +#: engines/scumm/dialogs.cpp:664 msgid "Practice" msgstr "" -#: engines/scumm/dialogs.cpp:663 +#: engines/scumm/dialogs.cpp:665 msgid "Expert" msgstr "" @@ -3537,4 +3554,5 @@ msgstr " #: engines/zvision/detection_tables.h:92 msgid "Use MPEG video from the DVD version, instead of lower resolution AVI" msgstr "" -" MPEG DVD-, AVI " +" MPEG DVD-, AVI " +" " -- cgit v1.2.3 From e6e68802017ae2c575513cc1f906dfac14107bc7 Mon Sep 17 00:00:00 2001 From: Thierry Crozat Date: Wed, 23 Dec 2015 16:09:22 +0000 Subject: I18N: Update Hungarian translation from patch #1618 --- po/hu_HU.po | 186 +++++++++++++++++++++++++++++++++++------------------------- 1 file changed, 109 insertions(+), 77 deletions(-) diff --git a/po/hu_HU.po b/po/hu_HU.po index 972d726065..4ed16eba2a 100644 --- a/po/hu_HU.po +++ b/po/hu_HU.po @@ -8,7 +8,7 @@ msgstr "" "Project-Id-Version: ScummVM 1.3.0svn\n" "Report-Msgid-Bugs-To: scummvm-devel@lists.sf.net\n" "POT-Creation-Date: 2015-12-23 00:28+0000\n" -"PO-Revision-Date: 2015-10-12 11:10+0200\n" +"PO-Revision-Date: 2015-12-23 05:02+0100\n" "Last-Translator: George Kormendi \n" "Language-Team: Hungarian\n" "Language: Magyar\n" @@ -17,7 +17,7 @@ msgstr "" "Content-Transfer-Encoding: 8bit\n" "Plural-Forms: nplurals=2; plural=(n != 1);\n" "X-Poedit-SourceCharset: iso-8859-1\n" -"X-Generator: Poedit 1.8.5\n" +"X-Generator: Poedit 1.8.6\n" #: gui/about.cpp:94 #, c-format @@ -91,16 +91,15 @@ msgstr "Ok" #: gui/filebrowser-dialog.cpp:49 msgid "Choose file for loading" -msgstr "" +msgstr "Vlassz betltend fjlt" #: gui/filebrowser-dialog.cpp:49 msgid "Enter filename for saving" -msgstr "" +msgstr "rd be a fjlnevet mentshez" #: gui/filebrowser-dialog.cpp:132 -#, fuzzy msgid "Do you really want to overwrite the file?" -msgstr "Biztos hogy trlni akarod ezt a felvtelt?" +msgstr "Biztos hogy fell akarod rni a fjlt?" #: gui/filebrowser-dialog.cpp:132 gui/launcher.cpp:793 gui/launcher.cpp:941 #: gui/launcher.cpp:1000 gui/fluidsynth-dialog.cpp:217 @@ -208,7 +207,8 @@ msgid "" "Short game identifier used for referring to saved games and running the game " "from the command line" msgstr "" -"Rvid jtkazonost a jtkmentsekhez s a jtk parancssori futtatshoz" +"Rvid jtkazonost a jtkmentsekhez s a jtk parancssori " +"futtatshoz" #: gui/launcher.cpp:199 msgctxt "lowres" @@ -233,7 +233,8 @@ msgid "" "Language of the game. This will not turn your Spanish game version into " "English" msgstr "" -"A jtk nyelve. Ne lltsd t a pl. Spanyol nyelv jtkodat Angol nyelvre" +"A jtk nyelve. Ne lltsd t a pl. Spanyol nyelv jtkodat Angol " +"nyelvre" #: gui/launcher.cpp:212 gui/launcher.cpp:226 gui/options.cpp:87 #: gui/options.cpp:735 gui/options.cpp:748 gui/options.cpp:1208 @@ -520,8 +521,8 @@ msgid "" "Do you really want to run the mass game detector? This could potentially add " "a huge number of games." msgstr "" -"Biztos hogy futtatod a Masszv jtkdetektort? Ez potencilisan sok jtkot " -"hozzad a listhoz." +"Biztos hogy futtatod a Masszv jtkdetektort? Ez potencilisan sok " +"jtkot hozzad a listhoz." #: gui/launcher.cpp:841 msgid "ScummVM couldn't open the specified directory!" @@ -545,12 +546,14 @@ msgstr "Akarod hogy bet #: gui/launcher.cpp:1048 msgid "This game does not support loading games from the launcher." -msgstr "Ez a jtk nem tmogatja a jtklls betltst az indtbl." +msgstr "" +"Ez a jtk nem tmogatja a jtklls betltst az indtbl." #: gui/launcher.cpp:1052 msgid "ScummVM could not find any engine capable of running the selected game!" msgstr "" -"ScummVM nem tallt olyan jtkmotort ami a vlasztott jtkot tmogatja!" +"ScummVM nem tallt olyan jtkmotort ami a vlasztott jtkot " +"tmogatja!" #: gui/launcher.cpp:1159 msgid "Mass Add..." @@ -571,7 +574,8 @@ msgstr "Vizsg #: gui/massadd.cpp:262 #, c-format msgid "Discovered %d new games, ignored %d previously added games." -msgstr "%d j jtkot talltam, %d elzleg hozzadott jtk kihagyva..." +msgstr "" +"%d j jtkot talltam, %d elzleg hozzadott jtk kihagyva..." #: gui/massadd.cpp:266 #, c-format @@ -581,7 +585,8 @@ msgstr "%d Mappa #: gui/massadd.cpp:269 #, c-format msgid "Discovered %d new games, ignored %d previously added games ..." -msgstr "%d j jtkot talltam, %d elzleg hozzadott jtk kihagyva..." +msgstr "" +"%d j jtkot talltam, %d elzleg hozzadott jtk kihagyva..." #: gui/onscreendialog.cpp:101 gui/onscreendialog.cpp:103 msgid "Stop" @@ -729,7 +734,8 @@ msgid "" "Higher value specifies better sound quality but may be not supported by your " "soundcard" msgstr "" -"Nagyobb rtkek jobb hangminsget adnak, de nem minden hangkrtya tmogatja" +"Nagyobb rtkek jobb hangminsget adnak, de nem minden hangkrtya " +"tmogatja" #: gui/options.cpp:820 msgid "GM Device:" @@ -754,7 +760,8 @@ msgstr "SoundFont:" #: gui/options.cpp:854 gui/options.cpp:856 gui/options.cpp:857 msgid "SoundFont is supported by some audio cards, FluidSynth and Timidity" msgstr "" -"Nhny hangkrya, FluidSynth s Timidyti tmogatja a SoundFont betltst" +"Nhny hangkrya, FluidSynth s Timidyti tmogatja a SoundFont " +"betltst" #: gui/options.cpp:856 msgctxt "lowres" @@ -783,7 +790,8 @@ msgstr "MT-32 Eszk #: gui/options.cpp:879 msgid "Specifies default sound device for Roland MT-32/LAPC1/CM32l/CM64 output" -msgstr "Roland MT-32/LAPC1/CM32l/CM64 alaprtelmezett hangeszkzk belltsa" +msgstr "" +"Roland MT-32/LAPC1/CM32l/CM64 alaprtelmezett hangeszkzk belltsa" #: gui/options.cpp:884 msgid "True Roland MT-32 (disable GM emulation)" @@ -794,8 +802,8 @@ msgid "" "Check if you want to use your real hardware Roland-compatible sound device " "connected to your computer" msgstr "" -"Jelld be, ha hardveres Roland-Kompatibilis hangeszkz van csatlakoztatva a " -"gpedhez s hasznlni akarod" +"Jelld be, ha hardveres Roland-Kompatibilis hangeszkz van csatlakoztatva " +"a gpedhez s hasznlni akarod" #: gui/options.cpp:886 msgctxt "lowres" @@ -811,8 +819,8 @@ msgid "" "Check if you want to enable patch mappings to emulate an MT-32 on a Roland " "GS device" msgstr "" -"Ellenrzs ha engedlyezni akarod az emullt MT-32 Folt lekpezst a Roland " -"GS eszkzn" +"Ellenrzs ha engedlyezni akarod az emullt MT-32 Folt lekpezst a " +"Roland GS eszkzn" #: gui/options.cpp:898 msgid "Don't use Roland MT-32 music" @@ -1231,7 +1239,8 @@ msgstr "Minden FluidSynth be msgid "" "Do you really want to reset all FluidSynth settings to their default values?" msgstr "" -"Biztos visszalltassz minden FluidSynth belltst alaprtelmezett rtkre?" +"Biztos visszalltassz minden FluidSynth belltst alaprtelmezett " +"rtkre?" #: base/main.cpp:228 #, c-format @@ -1263,7 +1272,8 @@ msgstr "Hiba a j #: base/main.cpp:554 msgid "Could not find any engine capable of running the selected game" -msgstr "Nem tallhat olyan jtkmotor ami a vlasztott jtkot tmogatja" +msgstr "" +"Nem tallhat olyan jtkmotor ami a vlasztott jtkot tmogatja" #: common/error.cpp:38 msgid "No error" @@ -1336,7 +1346,8 @@ msgstr "A '%s' j #: engines/advancedDetector.cpp:318 msgid "Please, report the following data to the ScummVM team along with name" -msgstr "Krlek jelezd a ScummVM csapatnak a kvetkez adatokat, egytt a jtk" +msgstr "" +"Krlek jelezd a ScummVM csapatnak a kvetkez adatokat, egytt a jtk" #: engines/advancedDetector.cpp:320 msgid "of the game you tried to add and its version/language/etc.:" @@ -1402,8 +1413,9 @@ msgid "" "the README for basic information, and for instructions on how to obtain " "further assistance." msgstr "" -"Sajnlom, a motor jelenleg nem tartalmaz jtk kzbeni sgt. Olvassd el a " -"README-t az alap informcikrl, s hogy hogyan segthetsz a ksbbiekben." +"Sajnlom, a motor jelenleg nem tartalmaz jtk kzbeni sgt. Olvassd " +"el a README-t az alap informcikrl, s hogy hogyan segthetsz a " +"ksbbiekben." #: engines/dialogs.cpp:234 engines/pegasus/pegasus.cpp:393 #, c-format @@ -1478,8 +1490,8 @@ msgid "" "Gamestate load failed (%s)! Please consult the README for basic information, " "and for instructions on how to obtain further assistance." msgstr "" -"(%s) jtklls betltse nem sikerlt!. Olvassd el a README-t az alap " -"informcikrl, s hogy hogyan segthetsz a ksbbiekben." +"(%s) jtklls betltse nem sikerlt!. Olvassd el a README-t az " +"alap informcikrl, s hogy hogyan segthetsz a ksbbiekben." #: engines/engine.cpp:480 msgid "" @@ -1488,8 +1500,8 @@ msgid "" "not work in future versions of ScummVM." msgstr "" "FIGYELEM: A jtkot amit indtani akarsz mg nem teljesen tmogatotja a " -"ScummVM. Szmts r hogy nem stabilan fut, s a mentsek nem mkdnek a " -"jvbeni ScummVM verzikkal." +"ScummVM. Szmts r hogy nem stabilan fut, s a mentsek nem mkdnek " +"a jvbeni ScummVM verzikkal." #: engines/engine.cpp:483 msgid "Start anyway" @@ -1513,7 +1525,8 @@ msgid "" "The selected audio device '%s' was not found (e.g. might be turned off or " "disconnected)." msgstr "" -"A kivlasztott '%s' hangeszkz nem tallhat (Lekapcsoltad, vagy kihztad)." +"A kivlasztott '%s' hangeszkz nem tallhat (Lekapcsoltad, vagy " +"kihztad)." #: audio/mididrv.cpp:209 audio/mididrv.cpp:221 audio/mididrv.cpp:257 #: audio/mididrv.cpp:272 @@ -1535,7 +1548,8 @@ msgid "" "The preferred audio device '%s' was not found (e.g. might be turned off or " "disconnected)." msgstr "" -"Az elsdleges '%s' hangeszkz nem tallhat (Lekapcsoltad, vagy kihztad)." +"Az elsdleges '%s' hangeszkz nem tallhat (Lekapcsoltad, vagy " +"kihztad)." #: audio/mididrv.cpp:272 #, c-format @@ -2092,8 +2106,8 @@ msgstr "Kicsiny msgid "" "Don't forget to map a key to 'Hide Toolbar' action to see the whole inventory" msgstr "" -"Ne felejts billentyt trstani az 'Eszkztr rejts' mvelethez, hogy lsd " -"a teljes listt" +"Ne felejts billentyt trstani az 'Eszkztr rejts' mvelethez, hogy " +"lsd a teljes listt" #: backends/events/default/default-events.cpp:196 msgid "Do you really want to return to the Launcher?" @@ -2192,7 +2206,8 @@ msgstr "Eredeti ment/t #: engines/dreamweb/detection.cpp:48 engines/neverhood/detection.cpp:161 #: engines/sci/detection.cpp:395 engines/toltecs/detection.cpp:201 msgid "Use the original save/load screens, instead of the ScummVM ones" -msgstr "Az eredeti ments/betlts kperny hasznlata a ScummVM kpek helyett" +msgstr "" +"Az eredeti ments/betlts kperny hasznlata a ScummVM kpek helyett" #: engines/agi/detection.cpp:157 msgid "Use an alternative palette" @@ -2203,8 +2218,8 @@ msgid "" "Use an alternative palette, common for all Amiga games. This was the old " "behavior" msgstr "" -"Alternatv paletta hasznlat, kzs minden Amiga jtknl. Ez egy rgi " -"megolds" +"Alternatv paletta hasznlat, kzs minden Amiga jtknl. Ez egy " +"rgi megolds" #: engines/agi/detection.cpp:167 msgid "Mouse support" @@ -2214,8 +2229,8 @@ msgstr "Eg msgid "" "Enables mouse support. Allows to use mouse for movement and in game menus." msgstr "" -"Egrmd englyezve. Lehetv teszi az egrrel mozgatst jtkban s " -"jtkmenkben." +"Egrmd englyezve. Lehetv teszi az egrrel mozgatst jtkban " +"s jtkmenkben." #: engines/agi/saveload.cpp:816 engines/drascula/saveload.cpp:349 #: engines/dreamweb/saveload.cpp:169 engines/neverhood/menumodule.cpp:890 @@ -2285,12 +2300,13 @@ msgid "" "Press OK to convert them now, otherwise you will be asked again the next " "time you start the game.\n" msgstr "" -"ScummVM rgi jtkmentst tallt a Drascula-hoz, ezt t kell alaktani.\n" -"A rgi jtkments forma tbb nem tmogatott, ezrt a jtk mentse nem " -"tltdik be ha nem aktod t azt.\n" +"ScummVM rgi jtkmentst tallt a Drascula-hoz, ezt t kell alak" +"tani.\n" +"A rgi jtkments forma tbb nem tmogatott, ezrt a jtk " +"mentse nem tltdik be ha nem aktod t azt.\n" "\n" -"Nyomj OK-t ha talaktod most, vagy rkrdezek jra ha legkzelebb elindtod " -"a jtkot.\n" +"Nyomj OK-t ha talaktod most, vagy rkrdezek jra ha legkzelebb " +"elindtod a jtkot.\n" #: engines/dreamweb/detection.cpp:57 msgid "Use bright palette mode" @@ -2464,7 +2480,8 @@ msgid "" "Do you wish to use this save game file with ScummVM?\n" "\n" msgstr "" -"A kvetkez eredeti jtkments fjlt talltam a jtkknyvtrban:\n" +"A kvetkez eredeti jtkments fjlt talltam a " +"jtkknyvtrban:\n" "\n" "%s %s\n" "\n" @@ -2491,7 +2508,8 @@ msgid "" "\n" msgstr "" "%d eredeti jtkments fjlt sikeresen importlta a\n" -"ScummVM. Ha ksbb manulisan akarod importlni az eredeti jtkmentseket\n" +"ScummVM. Ha ksbb manulisan akarod importlni az eredeti " +"jtkmentseket\n" "meg kell nyitnod a ScummVM debug konzolt s hasznld az 'import_savefile' " "utastst.\n" "\n" @@ -2529,7 +2547,8 @@ msgstr "Hall of Records storyboard #: engines/neverhood/detection.cpp:168 msgid "Allows the player to skip past the Hall of Records storyboard scenes" msgstr "" -"Lehetsg, hogy a jtkos tugorja a Hall of Records storyboard tvezetket" +"Lehetsg, hogy a jtkos tugorja a Hall of Records storyboard " +"tvezetket" #: engines/neverhood/detection.cpp:174 msgid "Scale the making of videos to full screen" @@ -2537,7 +2556,9 @@ msgstr "Hogyan k #: engines/neverhood/detection.cpp:175 msgid "Scale the making of videos, so that they use the whole screen" -msgstr "Hogyan kszlt videk tmretezse, hogy teljeskpernyt hasznljanak" +msgstr "" +"Hogyan kszlt videk tmretezse, hogy teljeskpernyt " +"hasznljanak" #: engines/parallaction/saveload.cpp:133 #, c-format @@ -2565,12 +2586,13 @@ msgid "" "\n" "Press OK to convert them now, otherwise you will be asked next time.\n" msgstr "" -"ScummVM rgi jtkmentst tallt a Nippon Safes hez ezt t kell nevezni.\n" -"A rgi jtkments nem tmogatott, ezrt a jtk nem tltdik be tnevezs " -"nlkl..\n" +"ScummVM rgi jtkmentst tallt a Nippon Safes hez ezt t kell " +"nevezni.\n" +"A rgi jtkments nem tmogatott, ezrt a jtk nem tltdik be " +"tnevezs nlkl..\n" "\n" -"Nyomj OK-t az talaktshoz, vagy rkrdezzek ha legkzelebb elindtod a " -"jtkot.\n" +"Nyomj OK-t az talaktshoz, vagy rkrdezzek ha legkzelebb elindtod " +"a jtkot.\n" #: engines/parallaction/saveload.cpp:319 msgid "ScummVM successfully converted all your savefiles." @@ -2583,8 +2605,8 @@ msgid "" "\n" "Please report to the team." msgstr "" -"ScummVM kirt nhny figyelmeztetst a konzolablakba s nem biztos hogy az " -"sszes fjlod t lett alaktva.\n" +"ScummVM kirt nhny figyelmeztetst a konzolablakba s nem biztos hogy " +"az sszes fjlod t lett alaktva.\n" "\n" "Lgyszves jelentsd a csapatnak." @@ -2639,7 +2661,8 @@ msgstr "EGA sz #: engines/sci/detection.cpp:375 msgid "Skip dithering pass in EGA games, graphics are shown with full colors" msgstr "" -"Sznmodulci tugrsa EGA jtkoknl, grafikk teljes sznben lthatk" +"Sznmodulci tugrsa EGA jtkoknl, grafikk teljes sznben " +"lthatk" #: engines/sci/detection.cpp:384 msgid "Prefer digital sound effects" @@ -2658,8 +2681,8 @@ msgid "" "Use an IBM Music Feature card or a Yamaha FB-01 FM synth module for MIDI " "output" msgstr "" -"IBM Music Feature krtya vagy Yamaha FB-01 FM szintetiztor modul hasznlata " -"MIDI kimenetre" +"IBM Music Feature krtya vagy Yamaha FB-01 FM szintetiztor modul " +"hasznlata MIDI kimenetre" #: engines/sci/detection.cpp:415 msgid "Use CD audio" @@ -2676,7 +2699,8 @@ msgstr "Windows kurzorok haszn #: engines/sci/detection.cpp:427 msgid "" "Use the Windows cursors (smaller and monochrome) instead of the DOS ones" -msgstr "Windows kurzorok hasznlata (kisebb s monokrm) a DOS-osok helyett " +msgstr "" +"Windows kurzorok hasznlata (kisebb s monokrm) a DOS-osok helyett " #: engines/sci/detection.cpp:437 msgid "Use silver cursors" @@ -3367,9 +3391,10 @@ msgid "" "files for Maniac Mansion have to be in the 'Maniac' directory inside the " "Tentacle game directory, and the game has to be added to ScummVM." msgstr "" -"ltalban a Maniac Mansion indulna most. De a mkdshez a Maniac Mansion " -"fjljainak, a 'Maniac' mappban kell lenni a Tentacle jtkmappjn bell, " -"s a jtkot gy adja hozz a ScummVM a listhoz." +"ltalban a Maniac Mansion indulna most. De a mkdshez a Maniac " +"Mansion fjljainak, a 'Maniac' mappban kell lenni a Tentacle " +"jtkmappjn bell, s a jtkot gy adja hozz a ScummVM a " +"listhoz." #: engines/scumm/players/player_v3m.cpp:129 msgid "" @@ -3418,14 +3443,15 @@ msgstr "'%s' PSX stream #: engines/sword1/animation.cpp:545 engines/sword2/animation.cpp:445 msgid "DXA cutscenes found but ScummVM has been built without zlib" -msgstr "DXA tvezet elrhet, de a ScummVM zlib tmogats nincs lefordtva" +msgstr "" +"DXA tvezet elrhet, de a ScummVM zlib tmogats nincs lefordtva" #: engines/sword1/animation.cpp:561 engines/sword2/animation.cpp:461 msgid "" "MPEG-2 cutscenes found but ScummVM has been built without MPEG-2 support" msgstr "" -"MPEG-2 tvezetfilmet talltam, de a ScummVM MPEG-2 tmogats nlkl van " -"lefordtva" +"MPEG-2 tvezetfilmet talltam, de a ScummVM MPEG-2 tmogats nlkl " +"van lefordtva" #: engines/sword1/animation.cpp:568 engines/sword2/animation.cpp:470 #, c-format @@ -3444,11 +3470,11 @@ msgid "" msgstr "" "ScummVM rgi jtkmentst tallt a Broken Sword 1 hez, ezt t kell " "alaktani.\n" -"A rgi jtkments nem tmogatott, ezrt a jtk nem tltdik be talakts " -"nlkl.\n" +"A rgi jtkments nem tmogatott, ezrt a jtk nem tltdik be " +"talakts nlkl.\n" "\n" -"Nyomj OK-t az talaktshoz, vagy rkrdezzek ha legkzelebb elindtod a " -"jtkot.\n" +"Nyomj OK-t az talaktshoz, vagy rkrdezzek ha legkzelebb elindtod " +"a jtkot.\n" #: engines/sword1/control.cpp:1232 #, c-format @@ -3475,8 +3501,8 @@ msgstr "Ez a Broken Sword 1 Demo v msgid "" "PSX cutscenes found but ScummVM has been built without RGB color support" msgstr "" -"PSX tvezetfilmet talltam, de ez a ScummVM RGB szntmogats nlkl van " -"lefordtva" +"PSX tvezetfilmet talltam, de ez a ScummVM RGB szntmogats nlkl " +"van lefordtva" #: engines/sword2/sword2.cpp:79 msgid "Show object labels" @@ -3506,11 +3532,13 @@ msgstr "FPS sz #: engines/wintermute/detection.cpp:59 msgid "Show the current number of frames per second in the upper left corner" msgstr "" -"A jelenlegi msodpercenknti kpkocka szm kijelzse a bal fels sarokban" +"A jelenlegi msodpercenknti kpkocka szm kijelzse a bal fels " +"sarokban" #: engines/zvision/detection_tables.h:52 msgid "Use the original save/load screens instead of the ScummVM interface" -msgstr "Hasznld az eredeti ments/tlts kpet a ScummVM fellet helyett" +msgstr "" +"Hasznld az eredeti ments/tlts kpet a ScummVM fellet helyett" #: engines/zvision/detection_tables.h:61 msgid "Double FPS" @@ -3542,7 +3570,8 @@ msgstr "Nagyfelbont #: engines/zvision/detection_tables.h:92 msgid "Use MPEG video from the DVD version, instead of lower resolution AVI" -msgstr "MPEG videt hasznl DVD verzinl, a kisebb felbonts AVI helyett" +msgstr "" +"MPEG videt hasznl DVD verzinl, a kisebb felbonts AVI helyett" #~ msgid "EGA undithering" #~ msgstr "EGA szinjavts" @@ -3552,7 +3581,8 @@ msgstr "MPEG vide #~ msgid "MPEG-2 cutscenes found but ScummVM has been built without MPEG-2" #~ msgstr "" -#~ "MPEG-2 tvezetfilmet talltam, de a ScummVM MPEG-2 nlkl van lefordtva" +#~ "MPEG-2 tvezetfilmet talltam, de a ScummVM MPEG-2 nlkl van " +#~ "lefordtva" #~ msgctxt "lowres" #~ msgid "Mass Add..." @@ -3560,7 +3590,8 @@ msgstr "MPEG vide #~ msgid "" #~ "Turns off General MIDI mapping for games with Roland MT-32 soundtrack" -#~ msgstr "General MIDI lekpezs Roland MT-32 zens jtkokhoz kikapcsolva" +#~ msgstr "" +#~ "General MIDI lekpezs Roland MT-32 zens jtkokhoz kikapcsolva" #~ msgid "Standard (16bpp)" #~ msgstr "Standard (16bpp)" @@ -3619,7 +3650,8 @@ msgstr "MPEG vide #~ msgid "" #~ "Your game version has been detected using filename matching as a variant " #~ "of %s." -#~ msgstr "A felismert jtkverzid a hasznlt fjlnvvel a %s egy vltozata." +#~ msgstr "" +#~ "A felismert jtkverzid a hasznlt fjlnvvel a %s egy vltozata." #~ msgid "If this is an original and unmodified version, please report any" #~ msgstr "Ha ez egy eredeti nem vltoztatott verzi, krlek jelezd minden" -- cgit v1.2.3 From 9b53626ce096931a86422dbe56ea3e53ba6e9502 Mon Sep 17 00:00:00 2001 From: Thierry Crozat Date: Wed, 23 Dec 2015 16:09:51 +0000 Subject: I18N: Regenerate translations data file --- gui/themes/translations.dat | Bin 477774 -> 477983 bytes 1 file changed, 0 insertions(+), 0 deletions(-) diff --git a/gui/themes/translations.dat b/gui/themes/translations.dat index f141524ba3..a882cf2c0b 100644 Binary files a/gui/themes/translations.dat and b/gui/themes/translations.dat differ -- cgit v1.2.3 From 9cd640a6ef6ea57edb516c98dd107b161e059e1f Mon Sep 17 00:00:00 2001 From: Filippos Karapetis Date: Thu, 8 Oct 2015 13:41:29 +0300 Subject: LAB: Bugfixes to the Resource class --- engines/lab/resource.cpp | 31 +++++++++++++++---------------- 1 file changed, 15 insertions(+), 16 deletions(-) diff --git a/engines/lab/resource.cpp b/engines/lab/resource.cpp index 9babc5c080..6675409ae7 100644 --- a/engines/lab/resource.cpp +++ b/engines/lab/resource.cpp @@ -178,11 +178,10 @@ char *Resource::readString(Common::File *file) { char *c = str; for (int i = 0; i < size; i++) { *c = file->readByte(); - if (*c != '\0') - *c -= 95; // decrypt char + // Decrypt char + *c = (i < size - 1) ? *c - 95 : '\0'; c++; } - *c = 0; return str; } @@ -212,16 +211,16 @@ Rule *Resource::readRule(Common::File *file) { if (c == 1) { rule = (Rule *)malloc(sizeof(Rule)); + if (!head) + head = rule; rule->RuleType = file->readSint16LE(); rule->Param1 = file->readSint16LE(); rule->Param2 = file->readSint16LE(); rule->Condition = readConditions(file); + rule->NextRule = NULL; if (!rule->Condition) - return NULL; + return head; rule->ActionList = readAction(file); - rule->NextRule = NULL; - if (!head) - head = rule; rule = rule->NextRule; } } while (c == 1); @@ -240,6 +239,8 @@ Action *Resource::readAction(Common::File *file) { if (c == 1) { action = (Action *)malloc(sizeof(Action)); + if (!head) + head = action; action->ActionType = file->readSint16LE(); action->Param1 = file->readSint16LE(); action->Param2 = file->readSint16LE(); @@ -257,8 +258,6 @@ Action *Resource::readAction(Common::File *file) { } action->NextAction = NULL; - if (!head) - head = action; action = action->NextAction; } } while (c == 1); @@ -276,6 +275,8 @@ CloseData *Resource::readCloseUps(uint16 depth, Common::File *file) { if (c != '\0') { closeups = (CloseData *)malloc(sizeof(CloseData)); + if (!head) + head = closeups; closeups->x1 = file->readUint16LE(); closeups->y1 = file->readUint16LE(); closeups->x2 = file->readUint16LE(); @@ -284,11 +285,9 @@ CloseData *Resource::readCloseUps(uint16 depth, Common::File *file) { closeups->depth = depth; closeups->GraphicName = readString(file); closeups->Message = readString(file); - if (!(closeups->SubCloseUps = readCloseUps(depth + 1, file))) - return NULL; closeups->NextCloseUp = NULL; - if (!head) - head = closeups; + if (!(closeups->SubCloseUps = readCloseUps(depth + 1, file))) + return head; closeups = closeups->NextCloseUp; } } while (c != '\0'); @@ -306,14 +305,14 @@ viewData *Resource::readView(Common::File *file) { if (c == 1) { view = (viewData *)malloc(sizeof(viewData)); + if (!head) + head = view; view->Condition = readConditions(file); if (!view->Condition) - return NULL; + return head; view->GraphicName = readString(file); view->closeUps = readCloseUps(0, file); view->NextCondition = NULL; - if (!head) - head = view; view = view->NextCondition; } } while (c == 1); -- cgit v1.2.3 From 72f7fbe82bd358f2a3c98ff18a0b81964aaf15d4 Mon Sep 17 00:00:00 2001 From: Filippos Karapetis Date: Sun, 11 Oct 2015 02:02:05 +0300 Subject: LAB: Bugfixes to the Resource class --- engines/lab/resource.cpp | 60 ++++++++++++++++++++++++------------------------ 1 file changed, 30 insertions(+), 30 deletions(-) diff --git a/engines/lab/resource.cpp b/engines/lab/resource.cpp index 6675409ae7..dcce41b922 100644 --- a/engines/lab/resource.cpp +++ b/engines/lab/resource.cpp @@ -145,13 +145,6 @@ bool Resource::readViews(uint16 roomNum) { Rooms[roomNum].EastView = readView(dataFile); Rooms[roomNum].WestView = readView(dataFile); Rooms[roomNum].RuleList = readRule(dataFile); - /*warning("Room %d, msg %s, north %s, south %s, east %s, west %s", - Rooms[roomNum].RoomMsg, - Rooms[roomNum].NorthView->GraphicName, - Rooms[roomNum].SouthView->GraphicName, - Rooms[roomNum].EastView->GraphicName, - Rooms[roomNum].WestView->GraphicName - );*/ g_music->updateMusic(); @@ -204,6 +197,7 @@ int16 *Resource::readConditions(Common::File *file) { Rule *Resource::readRule(Common::File *file) { char c; Rule *rule = NULL; + Rule *prev = NULL; Rule *head = NULL; do { @@ -213,15 +207,15 @@ Rule *Resource::readRule(Common::File *file) { rule = (Rule *)malloc(sizeof(Rule)); if (!head) head = rule; + if (prev) + prev->NextRule = rule; rule->RuleType = file->readSint16LE(); rule->Param1 = file->readSint16LE(); rule->Param2 = file->readSint16LE(); rule->Condition = readConditions(file); - rule->NextRule = NULL; - if (!rule->Condition) - return head; rule->ActionList = readAction(file); - rule = rule->NextRule; + rule->NextRule = NULL; + prev = rule; } } while (c == 1); @@ -231,6 +225,7 @@ Rule *Resource::readRule(Common::File *file) { Action *Resource::readAction(Common::File *file) { char c; Action *action = NULL; + Action *prev = NULL; Action *head = NULL; char **messages; @@ -241,6 +236,8 @@ Action *Resource::readAction(Common::File *file) { action = (Action *)malloc(sizeof(Action)); if (!head) head = action; + if (prev) + prev->NextAction = action; action->ActionType = file->readSint16LE(); action->Param1 = file->readSint16LE(); action->Param2 = file->readSint16LE(); @@ -258,7 +255,7 @@ Action *Resource::readAction(Common::File *file) { } action->NextAction = NULL; - action = action->NextAction; + prev = action; } } while (c == 1); @@ -267,28 +264,30 @@ Action *Resource::readAction(Common::File *file) { CloseData *Resource::readCloseUps(uint16 depth, Common::File *file) { char c; - CloseData *closeups = NULL; + CloseData *closeup = NULL; + CloseData *prev = NULL; CloseData *head = NULL; do { c = file->readByte(); if (c != '\0') { - closeups = (CloseData *)malloc(sizeof(CloseData)); + closeup = (CloseData *)malloc(sizeof(CloseData)); if (!head) - head = closeups; - closeups->x1 = file->readUint16LE(); - closeups->y1 = file->readUint16LE(); - closeups->x2 = file->readUint16LE(); - closeups->y2 = file->readUint16LE(); - closeups->CloseUpType = file->readSint16LE(); - closeups->depth = depth; - closeups->GraphicName = readString(file); - closeups->Message = readString(file); - closeups->NextCloseUp = NULL; - if (!(closeups->SubCloseUps = readCloseUps(depth + 1, file))) - return head; - closeups = closeups->NextCloseUp; + head = closeup; + if (prev) + prev->NextCloseUp = closeup; + closeup->x1 = file->readUint16LE(); + closeup->y1 = file->readUint16LE(); + closeup->x2 = file->readUint16LE(); + closeup->y2 = file->readUint16LE(); + closeup->CloseUpType = file->readSint16LE(); + closeup->depth = depth; + closeup->GraphicName = readString(file); + closeup->Message = readString(file); + closeup->SubCloseUps = readCloseUps(depth + 1, file); + closeup->NextCloseUp = NULL; + prev = closeup; } } while (c != '\0'); @@ -298,6 +297,7 @@ CloseData *Resource::readCloseUps(uint16 depth, Common::File *file) { viewData *Resource::readView(Common::File *file) { char c; viewData *view = NULL; + viewData *prev = NULL; viewData *head = NULL; do { @@ -307,13 +307,13 @@ viewData *Resource::readView(Common::File *file) { view = (viewData *)malloc(sizeof(viewData)); if (!head) head = view; + if (prev) + prev->NextCondition = view; view->Condition = readConditions(file); - if (!view->Condition) - return head; view->GraphicName = readString(file); view->closeUps = readCloseUps(0, file); view->NextCondition = NULL; - view = view->NextCondition; + prev = view; } } while (c == 1); -- cgit v1.2.3 From 77608bfc66d3b8b8d7414d005fbde39b2af67658 Mon Sep 17 00:00:00 2001 From: Filippos Karapetis Date: Sun, 11 Oct 2015 02:14:28 +0300 Subject: LAB: Move more room reading functions to the Resource class --- engines/lab/labfun.h | 8 -- engines/lab/labtext.cpp | 49 -------- engines/lab/map.cpp | 8 +- engines/lab/module.mk | 2 - engines/lab/parsefun.h | 6 - engines/lab/processroom.cpp | 6 +- engines/lab/readparse.cpp | 292 -------------------------------------------- 7 files changed, 9 insertions(+), 362 deletions(-) delete mode 100644 engines/lab/labtext.cpp delete mode 100644 engines/lab/readparse.cpp diff --git a/engines/lab/labfun.h b/engines/lab/labfun.h index 3a77855f17..c9fa307a84 100644 --- a/engines/lab/labfun.h +++ b/engines/lab/labfun.h @@ -154,14 +154,6 @@ void freeAllStolenMem(); Common::File *openPartial(const char *name); void closePartial(int32 File); -/*---------------------------*/ -/*------ From LabText.c -----*/ -/*---------------------------*/ - -bool initLabText(); -void freeLabText(); -void decrypt(byte *text); - /*---------------------------*/ /*----- From LabMusic.c -----*/ /*---------------------------*/ diff --git a/engines/lab/labtext.cpp b/engines/lab/labtext.cpp deleted file mode 100644 index 9955c43b70..0000000000 --- a/engines/lab/labtext.cpp +++ /dev/null @@ -1,49 +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. - * - */ - -/* - * This code is based on Labyrinth of Time code with assistance of - * - * Copyright (c) 1993 Terra Nova Development - * Copyright (c) 2004 The Wyrmkeep Entertainment Co. - * - */ - -#include "lab/stddefines.h" -#include "lab/labfun.h" - -namespace Lab { - -static uint32 SizeOfMemChunk; -static char *BeginOfMemChunk, *CurPlace; - - -/*****************************************************************************/ -/* Decrypts a chunk of text. */ -/*****************************************************************************/ -void decrypt(byte *text) { - while (text && *text != '\0') { - *text++ -= (byte)95; - } -} - -} // End of namespace Lab diff --git a/engines/lab/map.cpp b/engines/lab/map.cpp index 06a0ac18d7..ceddc4bdf4 100644 --- a/engines/lab/map.cpp +++ b/engines/lab/map.cpp @@ -74,7 +74,11 @@ void setAmigaPal(uint16 *pal, uint16 numcolors) { writeColorRegsSmooth(vgapal, 0, 16); } - +void decrypt(byte *text) { + while (text && *text != '\0') { + *text++ -= (byte)95; + } +} /*****************************************************************************/ /* Gets a chunk of text and puts it into the graphics memory. */ @@ -813,7 +817,7 @@ void processMap(uint16 CurRoom) { if (OldMsg != CurMsg) { if (Rooms[CurMsg].RoomMsg == NULL) - readViews(CurMsg); + g_resource->readViews(CurMsg); if ((sptr = Rooms[CurMsg].RoomMsg)) { mouseHide(); diff --git a/engines/lab/module.mk b/engines/lab/module.mk index 1520672573..f36871c8a5 100644 --- a/engines/lab/module.mk +++ b/engines/lab/module.mk @@ -11,13 +11,11 @@ MODULE_OBJS := \ labfile.o \ labmusic.o \ labsets.o \ - labtext.o \ machine.o \ map.o \ mouse.o \ processroom.o \ readdiff.o \ - readparse.o \ resource.o \ savegame.o \ special.o \ diff --git a/engines/lab/parsefun.h b/engines/lab/parsefun.h index b75368d25d..b634e9c120 100644 --- a/engines/lab/parsefun.h +++ b/engines/lab/parsefun.h @@ -48,12 +48,6 @@ bool initRoomBuffer(); void freeRoomBuffer(); void allocRoom(void **Ptr, uint16 Size, uint16 RoomNum); -/* From ReadParse.c */ - -bool readRoomData(const char *fileName); -bool readInventory(const char *fileName); -bool readViews(uint16 RoomNum); - /* From ProcessRoom.c */ diff --git a/engines/lab/processroom.cpp b/engines/lab/processroom.cpp index 87f3e58549..19e958825d 100644 --- a/engines/lab/processroom.cpp +++ b/engines/lab/processroom.cpp @@ -108,7 +108,7 @@ ViewDataPtr getViewData(uint16 roomNum, uint16 direction) { VPtr = &Rooms[roomNum].WestView; if (*VPtr == NULL) - readViews(roomNum); + g_resource->readViews(roomNum); ViewPtr = *VPtr; @@ -640,7 +640,7 @@ static bool doActionRuleSub(int16 action, int16 roomNum, CloseDataPtr LCPtr, Clo RPtr = Rooms[roomNum].RuleList; if ((RPtr == NULL) && (roomNum == 0)) { - readViews(roomNum); + g_resource->readViews(roomNum); RPtr = Rooms[roomNum].RuleList; } @@ -702,7 +702,7 @@ static bool doOperateRuleSub(int16 ItemNum, int16 roomNum, CloseDataPtr LCPtr, C RPtr = Rooms[roomNum].RuleList; if ((RPtr == NULL) && (roomNum == 0)) { - readViews(roomNum); + g_resource->readViews(roomNum); RPtr = Rooms[roomNum].RuleList; } diff --git a/engines/lab/readparse.cpp b/engines/lab/readparse.cpp deleted file mode 100644 index 624f7a3b89..0000000000 --- a/engines/lab/readparse.cpp +++ /dev/null @@ -1,292 +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. - * - */ - -/* - * This code is based on Labyrinth of Time code with assistance of - * - * Copyright (c) 1993 Terra Nova Development - * Copyright (c) 2004 The Wyrmkeep Entertainment Co. - * - */ - -#include "lab/labfun.h" -#include "lab/parsetypes.h" -#include "lab/parsefun.h" -#include "lab/stddefines.h" - -namespace Lab { - -/* Global parser data */ - -#define MAXSTRINGLENGTH 250 - -static bool UseMemory = false; -static uint16 allocroom; - -extern RoomData *Rooms; -extern InventoryData *Inventory; -extern uint16 NumInv, ManyRooms, HighestCondition, Direction; - -static bool rallocate(void **Ptr, uint32 Size) { - if (UseMemory) - return ((*Ptr = calloc(Size, 1)) != 0); - else { - allocRoom(Ptr, (uint16) Size, allocroom); - return true; - } -} - - - -/*****************************************************************************/ -/* Reads in a NULL terminated string, and allocates memory for it. */ -/*****************************************************************************/ -static bool readString(char **string, byte **file) { - char len; - uint32 counter = 0L; - - - readBlock(&len, 1L, file); - - if (len) { - counter = len; - - if (rallocate((void **) string, counter)) { - readBlock(*string, counter, file); - (*string)[counter - 1] = 0; /* Sanity modification */ - decrypt((byte *)*string); - return true; - } - } else { - *string = NULL; - return true; - } - - return false; -} - - -/*****************************************************************************/ -/* Reads in a list of conditions. */ -/*****************************************************************************/ -static int16 *readConditions(byte **file) { - int16 Counter = 0, last, list[25], *ptr; - - do { - readBlock(&last, 2L, file); - swapUShortPtr((uint16 *)&last, 1); - - if (Counter < 25) { - list[Counter] = last; - Counter++; - } else - list[Counter] = 0; - } while (last); - - if (!rallocate((void **) & (ptr), Counter * 2L)) - return NULL; - - memcpy(ptr, list, (size_t)(Counter * 2L)); - - return ptr; -} - -/*****************************************************************************/ -/* Reads in some CloseUp data. */ -/*****************************************************************************/ -static bool readCloseUps(CloseDataPtr *CPtr, uint16 depth, byte **file) { - char c; - - while (1) { - *CPtr = NULL; - - readBlock(&c, 1L, file); - - if (c != '\0') { - if (rallocate((void **) CPtr, sizeof(CloseData))) { - (*CPtr)->SubCloseUps = NULL; - (*CPtr)->NextCloseUp = NULL; - (*CPtr)->depth = depth; - - readBlock(*CPtr, 10L, file); - swapUShortPtr((uint16 *)*CPtr, 5); - - if (!readString(&((*CPtr)->GraphicName), file)) - return false; - - if (!readString(&((*CPtr)->Message), file)) - return false; - - if (!readCloseUps(&((*CPtr)->SubCloseUps), depth + 1, file)) - return false; - - CPtr = &((*CPtr)->NextCloseUp); - } else - return false; - } else - return true; - } -} - - -/*****************************************************************************/ -/* Reads in a View. */ -/*****************************************************************************/ -static bool readView(ViewDataPtr *VPtr, byte **file) { - char c; - - while (1) { - *VPtr = NULL; - - readBlock(&c, 1L, file); - - if (c == 1) { - if (rallocate((void **)VPtr, sizeof(viewData))) { - (*VPtr)->closeUps = NULL; - (*VPtr)->NextCondition = NULL; - - (*VPtr)->Condition = readConditions(file); - - if (!(*VPtr)->Condition) - return false; - - if (!readString(&((*VPtr)->GraphicName), file)) - return false; - - readCloseUps(&((*VPtr)->closeUps), 0, file); - - VPtr = &((*VPtr)->NextCondition); - } - else - return false; - } - else - return true; - } -} - - -/*****************************************************************************/ -/* Reads in an Action. */ -/*****************************************************************************/ -static bool readAction(ActionPtr *APtr, byte **file) { - char c; - byte **ptrarray; - uint16 counter; - - while (1) { - *APtr = NULL; - - readBlock(&c, 1L, file); - - if (c == 1) { - if (rallocate((void **) APtr, sizeof(Action))) { - readBlock(*APtr, 8L, file); - swapShortPtr((int16 *)*APtr, 4); - - if ((*APtr)->ActionType == SHOWMESSAGES) { - if (!rallocate((void **) &ptrarray, 4L * (*APtr)->Param1)) - return false; - - for (counter = 0; counter < (*APtr)->Param1; counter++) - readString((char **) & (ptrarray[counter]), file); - - (*APtr)->Data = (byte *)ptrarray; - } else - readString((char **) & ((*APtr)->Data), file); - - APtr = &((*APtr)->NextAction); - } else - return false; - } else - return true; - } -} - - -/*****************************************************************************/ -/* Reads in a rule. */ -/*****************************************************************************/ -static bool readRule(RulePtr *RPtr, byte **file) { - char c; - - while (1) { - *RPtr = NULL; - readBlock(&c, 1L, file); - - if (c == 1) { - if (rallocate((void **) RPtr, sizeof(Rule))) { - readBlock(*RPtr, 6L, file); - swapShortPtr((int16 *)*RPtr, 3); - - (*RPtr)->Condition = readConditions(file); - - if (!(*RPtr)->Condition) - return false; - - readAction(&((*RPtr)->ActionList), file); - } else - return false; - - RPtr = &((*RPtr)->NextRule); - } else - return true; - } -} - - -/*****************************************************************************/ -/* Reads in the views of a room. */ -/*****************************************************************************/ -bool readViews(uint16 RoomNum) { - Common::String fileName = "LAB:Rooms/" + Common::String::format("%d", RoomNum); - char Temp[10]; - byte **file; - - allocroom = RoomNum; - - if ((file = g_music->newOpen(fileName.c_str())) != NULL) { - readBlock(Temp, 4L, file); - Temp[4] = '\0'; - - if (strcmp(Temp, "ROM4") != 0) - return false; - - readString(&(Rooms[RoomNum].RoomMsg), file); - - readView(&Rooms[RoomNum].NorthView, file); - readView(&Rooms[RoomNum].SouthView, file); - readView(&Rooms[RoomNum].EastView, file); - readView(&Rooms[RoomNum].WestView, file); - - readRule(&Rooms[RoomNum].RuleList, file); - - g_music->updateMusic(); - - return true; - } else - return false; - - return false; -} - -} // End of namespace Lab -- cgit v1.2.3 From b033b7e539d356b5e94987dfa8d3be68c2acf4ab Mon Sep 17 00:00:00 2001 From: Filippos Karapetis Date: Sun, 11 Oct 2015 22:10:46 +0300 Subject: LAB: Simplify readInitialConditions() --- engines/lab/labsets.cpp | 31 +++++++++++-------------------- engines/lab/resource.cpp | 6 +----- engines/lab/resource.h | 2 +- 3 files changed, 13 insertions(+), 26 deletions(-) diff --git a/engines/lab/labsets.cpp b/engines/lab/labsets.cpp index ae70d817d5..4dcc0c8ebc 100644 --- a/engines/lab/labsets.cpp +++ b/engines/lab/labsets.cpp @@ -30,6 +30,7 @@ #include "lab/stddefines.h" #include "lab/labfun.h" +#include "lab/resource.h" namespace Lab { @@ -57,29 +58,19 @@ void LargeSet::exclElement(uint16 element) { } bool LargeSet::readInitialConditions(const char *fileName) { - byte **file; - uint16 many, set; - char temp[5]; + Common::File *file; - if ((file = g_music->newOpen(fileName)) != NULL) { - memcpy(&temp, file, 4); file += 4; - temp[4] = '\0'; - - if (strcmp(temp, "CON0") != 0) - return false; - - memcpy(&many, file, 2); file += 2; - swapUShortPtr(&many, 1); - - for (int counter = 0; counter < many; counter++) { - memcpy(&set, file, 2); file += 2; - swapUShortPtr(&set, 1); - inclElement(set); + if (file = g_resource->openDataFile(fileName, MKTAG('C', 'O', 'N', '0'))) { + uint16 conditions = file->readUint16LE(); + for (int i = 0; i < conditions; i++) { + inclElement(file->readUint16LE()); } - } else - return false; - return true; + delete file; + return true; + } + + return false; } diff --git a/engines/lab/resource.cpp b/engines/lab/resource.cpp index dcce41b922..268b4b6c1d 100644 --- a/engines/lab/resource.cpp +++ b/engines/lab/resource.cpp @@ -28,10 +28,6 @@ * */ -//#include "lab/labfun.h" -//#include "lab/parsetypes.h" -//#include "lab/parsefun.h" -//#include "lab/stddefines.h" #include "lab/text.h" #include "lab/resource.h" @@ -152,7 +148,7 @@ bool Resource::readViews(uint16 roomNum) { return true; } -Common::File *Resource::openDataFile(const char * fileName, uint32 fileHeader) { +Common::File *Resource::openDataFile(const char *fileName, uint32 fileHeader) { Common::File *dataFile = new Common::File(); dataFile->open(translateFileName(fileName)); if (dataFile->readUint32BE() != fileHeader) { diff --git a/engines/lab/resource.h b/engines/lab/resource.h index 59240a3505..f9ec4f633e 100644 --- a/engines/lab/resource.h +++ b/engines/lab/resource.h @@ -98,6 +98,7 @@ public: Resource(); ~Resource() {} + Common::File *openDataFile(const char * fileName, uint32 fileHeader); bool readRoomData(const char *fileName); bool readInventory(const char *fileName); bool readViews(uint16 roomNum); @@ -105,7 +106,6 @@ public: Common::String getStaticText(byte index) const { return _staticText[index]; } private: - Common::File *openDataFile(const char * fileName, uint32 fileHeader); char *readString(Common::File *file); int16 *readConditions(Common::File *file); Rule *readRule(Common::File *file); -- cgit v1.2.3 From 9676165436e1e3e7ee4db16c2cb905e0b2aeb1ff Mon Sep 17 00:00:00 2001 From: Filippos Karapetis Date: Mon, 12 Oct 2015 00:43:45 +0300 Subject: LAB: Remove unused code for the demo version The two places where the game stops in the demo versions should already be handled by the current code --- engines/lab/processroom.cpp | 17 -------------- engines/lab/special.cpp | 56 --------------------------------------------- 2 files changed, 73 deletions(-) diff --git a/engines/lab/processroom.cpp b/engines/lab/processroom.cpp index 19e958825d..03fedaa87e 100644 --- a/engines/lab/processroom.cpp +++ b/engines/lab/processroom.cpp @@ -440,23 +440,6 @@ static void doActions(ActionPtr APtr, CloseDataPtr *LCPtr) { break; case SETPOSITION: -#if defined(LABDEMO) - - // if teleporting to room 45 or 49 - if (APtr->Param1 == 45 || APtr->Param1 == 49) { - extern void doTrialBlock(); - - // Time to pay up! - doTrialBlock(); - - CurFileName = getPictName(LCPtr); - readPict(CurFileName, true); - - APtr = NULL; - continue; - } - -#endif if (APtr->Param1 & 0x8000) { // This is a Wyrmkeep Windows trial version, thus stop at this // point, since we can't check for game payment status diff --git a/engines/lab/special.cpp b/engines/lab/special.cpp index b7f14729a9..2c0a488003 100644 --- a/engines/lab/special.cpp +++ b/engines/lab/special.cpp @@ -415,10 +415,6 @@ static void changeTile(uint16 col, uint16 row) { if (scrolltype != -1) { doTileScroll(col, row, scrolltype); -#if defined(LABDEMO) - return; -#endif - if (g_lab->getFeatures() & GF_WINDOWS_TRIAL) { GUI::MessageDialog trialMessage("This puzzle is not available in the trial version of the game"); trialMessage.runModal(); @@ -1102,56 +1098,4 @@ void doMonitor(char *background, char *textfile, bool isinteractive, uint16 x1, blackAllScreen(); } -#if defined(LABDEMO) -void doTrialBlock() { - IntuiMessage *Msg; - - uint32 Class; - uint16 Qualifier, MouseX, MouseY, Code, Temp; - int i; - - loadBackPict("P:Warning", false); - mouseShow(); - - VGASetPal(diffcmap, 256); - memcpy(g_CommonPalette, diffcmap, 3 * 256); - - while (1) { - g_music->updateMusic(); /* Make sure we check the music at least after every message */ - Msg = getMsg(); - - if (Msg == NULL) { - g_music->updateMusic(); - } else { - Class = Msg->Class; - Qualifier = Msg->Qualifier; - MouseX = Msg->MouseX; - MouseY = Msg->MouseY; - Code = Msg->Code; - - if (((Class == MOUSEBUTTONS) && (IEQUALIFIER_RBUTTON & Qualifier)) || - ((Class == RAWKEY) && (Code == 27))) - return; - - if ((Class == MOUSEBUTTONS) && (IEQUALIFIER_LEFTBUTTON & Qualifier)) { - if (MouseY > 399) { - // click on control panel, exit - break; - } - - if (MouseX >= 0 && MouseX <= 319 && MouseY >= 0 && MouseY <= 399) { - extern void getItNow(); - getItNow(); - } else if (MouseX >= 320 && MouseX <= 639 && MouseY >= 0 && MouseY <= 399) { - break; - } - } - } - } - - eatMessages(); - mouseHide(); -} -#endif - } // End of namespace Lab -- cgit v1.2.3 From 93b2e413fd8085a1985519429c369282c99c941e Mon Sep 17 00:00:00 2001 From: Filippos Karapetis Date: Mon, 12 Oct 2015 13:53:00 +0300 Subject: LAB: Change the scene rule list to use a Common::List --- engines/lab/allocroom.cpp | 9 ++++- engines/lab/parsetypes.h | 4 +- engines/lab/processroom.cpp | 99 +++++++++++++++++---------------------------- engines/lab/resource.cpp | 21 ++++------ engines/lab/resource.h | 2 +- 5 files changed, 56 insertions(+), 79 deletions(-) diff --git a/engines/lab/allocroom.cpp b/engines/lab/allocroom.cpp index 434a147d48..2d7016d3ee 100644 --- a/engines/lab/allocroom.cpp +++ b/engines/lab/allocroom.cpp @@ -97,7 +97,14 @@ static void freeRoom(uint16 RMarker) { Rooms[RoomNum].SouthView = NULL; Rooms[RoomNum].EastView = NULL; Rooms[RoomNum].WestView = NULL; - Rooms[RoomNum].RuleList = NULL; + + RuleList *rules = Rooms[RoomNum].rules; + for (RuleList::iterator rule = rules->begin(); rule != rules->end(); rule++) + delete *rule; + Rooms[RoomNum].rules->clear(); + delete Rooms[RoomNum].rules; + Rooms[RoomNum].rules = NULL; + Rooms[RoomNum].RoomMsg = NULL; } diff --git a/engines/lab/parsetypes.h b/engines/lab/parsetypes.h index 0f9ec50315..f185c11b63 100644 --- a/engines/lab/parsetypes.h +++ b/engines/lab/parsetypes.h @@ -138,7 +138,7 @@ struct Rule { Rule *NextRule; }; -typedef Rule *RulePtr; +typedef Common::List RuleList; struct RoomData { uint16 NorthDoor, SouthDoor, EastDoor, WestDoor; @@ -146,7 +146,7 @@ struct RoomData { byte WipeType; ViewDataPtr NorthView, SouthView, EastView, WestView; - RulePtr RuleList; + RuleList *rules; char *RoomMsg; }; diff --git a/engines/lab/processroom.cpp b/engines/lab/processroom.cpp index 03fedaa87e..ea0309af22 100644 --- a/engines/lab/processroom.cpp +++ b/engines/lab/processroom.cpp @@ -615,34 +615,29 @@ static void doActions(ActionPtr APtr, CloseDataPtr *LCPtr) { /* Does the work for doActionRule. */ /*****************************************************************************/ static bool doActionRuleSub(int16 action, int16 roomNum, CloseDataPtr LCPtr, CloseDataPtr *Set, bool AllowDefaults) { - RulePtr RPtr; - action++; if (LCPtr) { - RPtr = Rooms[roomNum].RuleList; - - if ((RPtr == NULL) && (roomNum == 0)) { + RuleList *rules = Rooms[RoomNum].rules; + + if ((rules == NULL) && (roomNum == 0)) { g_resource->readViews(roomNum); - RPtr = Rooms[roomNum].RuleList; + rules = Rooms[roomNum].rules; } - - while (RPtr) { - if ((RPtr->RuleType == ACTION) && - ((RPtr->Param1 == action) || ((RPtr->Param1 == 0) && AllowDefaults))) { - if (((RPtr->Param2 == LCPtr->CloseUpType) || - ((RPtr->Param2 == 0) && AllowDefaults)) + for (RuleList::iterator rule = rules->begin(); rule != rules->end(); rule++) { + if (((*rule)->RuleType == ACTION) && + (((*rule)->Param1 == action) || (((*rule)->Param1 == 0) && AllowDefaults))) { + if ((((*rule)->Param2 == LCPtr->CloseUpType) || + (((*rule)->Param2 == 0) && AllowDefaults)) || - ((action == 1) && (RPtr->Param2 == (-LCPtr->CloseUpType)))) { - if (checkConditions(RPtr->Condition)) { - doActions(RPtr->ActionList, Set); + ((action == 1) && ((*rule)->Param2 == (-LCPtr->CloseUpType)))) { + if (checkConditions((*rule)->Condition)) { + doActions((*rule)->ActionList, Set); return true; } } } - - RPtr = RPtr->NextRule; } } @@ -678,28 +673,24 @@ bool doActionRule(int16 x, int16 y, int16 action, int16 roomNum, CloseDataPtr *L /* Does the work for doActionRule. */ /*****************************************************************************/ static bool doOperateRuleSub(int16 ItemNum, int16 roomNum, CloseDataPtr LCPtr, CloseDataPtr *Set, bool AllowDefaults) { - RulePtr RPtr; - if (LCPtr) if (LCPtr->CloseUpType > 0) { - RPtr = Rooms[roomNum].RuleList; + RuleList *rules = Rooms[roomNum].rules; - if ((RPtr == NULL) && (roomNum == 0)) { + if ((rules == NULL) && (roomNum == 0)) { g_resource->readViews(roomNum); - RPtr = Rooms[roomNum].RuleList; + rules = Rooms[roomNum].rules; } - while (RPtr) { - if ((RPtr->RuleType == OPERATE) && - ((RPtr->Param1 == ItemNum) || ((RPtr->Param1 == 0) && AllowDefaults)) && - ((RPtr->Param2 == LCPtr->CloseUpType) || ((RPtr->Param2 == 0) && AllowDefaults))) { - if (checkConditions(RPtr->Condition)) { - doActions(RPtr->ActionList, Set); + for (RuleList::iterator rule = rules->begin(); rule != rules->end(); rule++) { + if (((*rule)->RuleType == OPERATE) && + (((*rule)->Param1 == ItemNum) || (((*rule)->Param1 == 0) && AllowDefaults)) && + (((*rule)->Param2 == LCPtr->CloseUpType) || (((*rule)->Param2 == 0) && AllowDefaults))) { + if (checkConditions((*rule)->Condition)) { + doActions((*rule)->ActionList, Set); return true; } } - - RPtr = RPtr->NextRule; } } @@ -744,19 +735,15 @@ bool doOperateRule(int16 x, int16 y, int16 ItemNum, CloseDataPtr *LCPtr) { /* Goes thru the rules if the user tries to go forward. */ /*****************************************************************************/ bool doGoForward(CloseDataPtr *LCPtr) { - RulePtr RPtr; - - RPtr = Rooms[RoomNum].RuleList; + RuleList *rules = Rooms[RoomNum].rules; - while (RPtr) { - if ((RPtr->RuleType == GOFORWARD) && (RPtr->Param1 == (Direction + 1))) { - if (checkConditions(RPtr->Condition)) { - doActions(RPtr->ActionList, LCPtr); + for (RuleList::iterator rule = rules->begin(); rule != rules->end(); rule++) { + if (((*rule)->RuleType == GOFORWARD) && ((*rule)->Param1 == (Direction + 1))) { + if (checkConditions((*rule)->Condition)) { + doActions((*rule)->ActionList, LCPtr); return true; } } - - RPtr = RPtr->NextRule; } return false; @@ -766,25 +753,20 @@ bool doGoForward(CloseDataPtr *LCPtr) { /* Goes thru the rules if the user tries to turn. */ /*****************************************************************************/ bool doTurn(uint16 from, uint16 to, CloseDataPtr *LCPtr) { - RulePtr RPtr; - from++; to++; - RPtr = Rooms[RoomNum].RuleList; + RuleList *rules = Rooms[RoomNum].rules; - while (RPtr) { - if ((RPtr->RuleType == TURN) || - - ((RPtr->RuleType == TURNFROMTO) && - (RPtr->Param1 == from) && (RPtr->Param2 == to))) { - if (checkConditions(RPtr->Condition)) { - doActions(RPtr->ActionList, LCPtr); + for (RuleList::iterator rule = rules->begin(); rule != rules->end(); rule++) { + if (((*rule)->RuleType == TURN) || + (((*rule)->RuleType == TURNFROMTO) && + ((*rule)->Param1 == from) && ((*rule)->Param2 == to))) { + if (checkConditions((*rule)->Condition)) { + doActions((*rule)->ActionList, LCPtr); return true; } } - - RPtr = RPtr->NextRule; } return false; @@ -794,19 +776,14 @@ bool doTurn(uint16 from, uint16 to, CloseDataPtr *LCPtr) { /* Goes thru the rules if the user tries to go to the main view */ /*****************************************************************************/ bool doMainView(CloseDataPtr *LCPtr) { - RulePtr RPtr; - - RPtr = Rooms[RoomNum].RuleList; - - while (RPtr) { - if (RPtr->RuleType == GOMAINVIEW) { - if (checkConditions(RPtr->Condition)) { - doActions(RPtr->ActionList, LCPtr); + RuleList *rules = Rooms[RoomNum].rules; + for (RuleList::iterator rule = rules->begin(); rule != rules->end(); rule++) { + if ((*rule)->RuleType == GOMAINVIEW) { + if (checkConditions((*rule)->Condition)) { + doActions((*rule)->ActionList, LCPtr); return true; } } - - RPtr = RPtr->NextRule; } return false; diff --git a/engines/lab/resource.cpp b/engines/lab/resource.cpp index 268b4b6c1d..7ca59ba2fd 100644 --- a/engines/lab/resource.cpp +++ b/engines/lab/resource.cpp @@ -101,7 +101,7 @@ bool Resource::readRoomData(const char *fileName) { Rooms[i].SouthView = NULL; Rooms[i].EastView = NULL; Rooms[i].WestView = NULL; - Rooms[i].RuleList = NULL; + Rooms[i].rules = NULL; Rooms[i].RoomMsg = NULL; } @@ -140,7 +140,7 @@ bool Resource::readViews(uint16 roomNum) { Rooms[roomNum].SouthView = readView(dataFile); Rooms[roomNum].EastView = readView(dataFile); Rooms[roomNum].WestView = readView(dataFile); - Rooms[roomNum].RuleList = readRule(dataFile); + Rooms[roomNum].rules = readRule(dataFile); g_music->updateMusic(); @@ -190,32 +190,25 @@ int16 *Resource::readConditions(Common::File *file) { return list; } -Rule *Resource::readRule(Common::File *file) { +RuleList *Resource::readRule(Common::File *file) { char c; - Rule *rule = NULL; - Rule *prev = NULL; - Rule *head = NULL; + RuleList *rules = new Common::List(); do { c = file->readByte(); if (c == 1) { - rule = (Rule *)malloc(sizeof(Rule)); - if (!head) - head = rule; - if (prev) - prev->NextRule = rule; + Rule *rule = new Rule();; rule->RuleType = file->readSint16LE(); rule->Param1 = file->readSint16LE(); rule->Param2 = file->readSint16LE(); rule->Condition = readConditions(file); rule->ActionList = readAction(file); - rule->NextRule = NULL; - prev = rule; + rules->push_back(rule); } } while (c == 1); - return head; + return rules; } Action *Resource::readAction(Common::File *file) { diff --git a/engines/lab/resource.h b/engines/lab/resource.h index f9ec4f633e..d254cd068e 100644 --- a/engines/lab/resource.h +++ b/engines/lab/resource.h @@ -108,7 +108,7 @@ public: private: char *readString(Common::File *file); int16 *readConditions(Common::File *file); - Rule *readRule(Common::File *file); + RuleList *readRule(Common::File *file); Action *readAction(Common::File *file); CloseData *readCloseUps(uint16 depth, Common::File *file); viewData *readView(Common::File *file); -- cgit v1.2.3 From 5cc3d3b682a69fee4ed76e2892a946711ec23926 Mon Sep 17 00:00:00 2001 From: Filippos Karapetis Date: Mon, 12 Oct 2015 17:13:42 +0300 Subject: LAB: Remove superfluous image buffers --- engines/lab/special.cpp | 22 +++++++--------------- 1 file changed, 7 insertions(+), 15 deletions(-) diff --git a/engines/lab/special.cpp b/engines/lab/special.cpp index 2c0a488003..7e8bc96c88 100644 --- a/engines/lab/special.cpp +++ b/engines/lab/special.cpp @@ -61,7 +61,7 @@ static TextFont bmfont; static char *journaltext, *journaltexttitle; static uint16 JPage = 0; static bool lastpage = false; -static Image *JCancel, *JCancelAlt, *JLeft, *JLeftAlt, *JRight, *JRightAlt, JBackImage, ScreenImage; +static Image JBackImage, ScreenImage; static uint16 JGadX[3] = { 80, 144, 194 }, JGadY[3] = { 162, 164, 162 }; static Gadget ForwardG, CancelG, BackG; static bool GotBackImage = false; @@ -602,24 +602,16 @@ static bool loadJournalData() { if (!buffer) return false; - readImage(buffer, &JLeft); - readImage(buffer, &JLeftAlt); - readImage(buffer, &JRight); - readImage(buffer, &JRightAlt); - readImage(buffer, &JCancel); - readImage(buffer, &JCancelAlt); + readImage(buffer, &(BackG.Im)); + readImage(buffer, &(BackG.ImAlt)); + readImage(buffer, &(ForwardG.Im)); + readImage(buffer, &(ForwardG.ImAlt)); + readImage(buffer, &(CancelG.Im)); + readImage(buffer, &(CancelG.ImAlt)); - BackG.Im = JLeft; - BackG.ImAlt = JLeftAlt; BackG.KeyEquiv = VKEY_LTARROW; - - ForwardG.Im = JRight; - ForwardG.ImAlt = JRightAlt; ForwardG.KeyEquiv = VKEY_RTARROW; - CancelG.Im = JCancel; - CancelG.ImAlt = JCancelAlt; - counter = 0; while (TopGadget) { -- cgit v1.2.3 From 1bdf07c7acd209f3ca5ca792a6ddfe51e5e712b5 Mon Sep 17 00:00:00 2001 From: Filippos Karapetis Date: Tue, 13 Oct 2015 05:25:49 +0300 Subject: LAB: Remove unused code --- engines/lab/readdiff.cpp | 7 ++----- 1 file changed, 2 insertions(+), 5 deletions(-) diff --git a/engines/lab/readdiff.cpp b/engines/lab/readdiff.cpp index b2720ea202..dacd4fbe36 100644 --- a/engines/lab/readdiff.cpp +++ b/engines/lab/readdiff.cpp @@ -46,7 +46,6 @@ static byte *storagefordifffile, **difffile = &storagefordifffile; static byte *start; static uint32 diffwidth, diffheight; static byte blackbuffer[256 * 3]; -static byte *mstart; bool DoBlack = false, /* Black the screen before new picture */ nopalchange = false, /* Don't change the palette. */ @@ -57,7 +56,6 @@ bool DoBlack = false, /* Black the screen before new picture */ static bool continuous, IsPlaying = false, - StopPlayingEnd = false, IsAnim = false, IsPal = false; @@ -259,7 +257,7 @@ void diffNextFrame() { break; } case 65535L: - if ((framenumber == 1) || PlayOnce || StopPlayingEnd) { + if ((framenumber == 1) || PlayOnce) { int didTOF = 0; if (waitForEffect) { @@ -310,7 +308,6 @@ void playDiff() { difffile = &storagefordifffile; IsPlaying = true; - StopPlayingEnd = false; if (DoBlack) { DoBlack = false; @@ -443,7 +440,7 @@ void readSound(bool waitTillFinished) { char temp_[5]; byte *storagefordifffile_, **difffile_ = &storagefordifffile_; - mstart = *startoffile; /* Make a copy of the pointer to the start of the file */ + byte *mstart = *startoffile; /* Make a copy of the pointer to the start of the file */ *difffile_ = mstart; /* Now can modify the file without modifying the original */ if (mstart == NULL) -- cgit v1.2.3 From a6805e884d812e974832160311543ac1048a9f0e Mon Sep 17 00:00:00 2001 From: Filippos Karapetis Date: Tue, 13 Oct 2015 07:40:24 +0300 Subject: LAB: Rewrite readSound() to use Common::File --- engines/lab/diff.h | 3 ++- engines/lab/graphics.cpp | 7 +++-- engines/lab/readdiff.cpp | 67 ++++++++++++++---------------------------------- 3 files changed, 26 insertions(+), 51 deletions(-) diff --git a/engines/lab/diff.h b/engines/lab/diff.h index 614148e0de..b4436b8f3f 100644 --- a/engines/lab/diff.h +++ b/engines/lab/diff.h @@ -32,6 +32,7 @@ #define LAB_DIFF_H #include "lab/stddefines.h" +#include "common/file.h" namespace Lab { @@ -74,7 +75,7 @@ void blackAllScreen(); void whiteScreen(); bool readDiff(bool playonce); void diffNextFrame(); -void readSound(bool waitTillFinished); +void readSound(bool waitTillFinished, Common::File *file); void stopDiff(); void stopDiffEnd(); void stopSound(); diff --git a/engines/lab/graphics.cpp b/engines/lab/graphics.cpp index c8d23e97ce..bc10e8fcb9 100644 --- a/engines/lab/graphics.cpp +++ b/engines/lab/graphics.cpp @@ -97,12 +97,15 @@ bool readPict(const char *filename, bool PlayOnce) { /* Reads in a music file. Ignores any graphics. */ /*****************************************************************************/ bool readMusic(const char *filename, bool waitTillFinished) { - byte **file = g_music->newOpen(filename); + Common::File *file = g_resource->openDataFile(filename, MKTAG('D', 'I', 'F', 'F')); + g_music->updateMusic(); + if (!g_music->_doNotFilestopSoundEffect) + g_music->stopSoundEffect(); if (!file) return false; DoBlack = false; - readSound(waitTillFinished); + readSound(waitTillFinished, file); return true; } diff --git a/engines/lab/readdiff.cpp b/engines/lab/readdiff.cpp index dacd4fbe36..e75d08e3f3 100644 --- a/engines/lab/readdiff.cpp +++ b/engines/lab/readdiff.cpp @@ -434,48 +434,25 @@ bool readDiff(bool playonce) { } -void readSound(bool waitTillFinished) { - uint32 header_ = 0, size_; - uint16 samplespeed_; - char temp_[5]; - byte *storagefordifffile_, **difffile_ = &storagefordifffile_; - - byte *mstart = *startoffile; /* Make a copy of the pointer to the start of the file */ - *difffile_ = mstart; /* Now can modify the file without modifying the original */ - - if (mstart == NULL) - return; - - readBlock(temp_, 4L, difffile_); - temp_[4] = '\0'; - readBlock(&header_, 4L, difffile_); - swapULong(&header_); - - processed += 8L; - - if (!((strcmp(temp_, "DIFF") == 0) && (header_ == 1219009121L))) +void readSound(bool waitTillFinished, Common::File *file) { + uint32 magicBytes = file->readUint32LE(); + if (magicBytes != 1219009121L) return; - readBlock(&header_, 4L, difffile_); - swapULong(&header_); - - readBlock(&size_, 4L, difffile_); - swapULong(&size_); + uint32 soundTag = file->readUint32LE(); + uint32 soundSize = file->readUint32LE(); - if (header_ == 0) - (*difffile_) += size_; + if (soundTag == 0) + file->skip(soundSize); // skip the header else return; - while (header_ != 65535) { + while (soundTag != 65535) { g_music->updateMusic(); - readBlock(&header_, 4L, difffile_); - swapULong(&header_); - - readBlock(&size_, 4L, difffile_); - swapULong(&size_); + soundTag = file->readUint32LE(); + soundSize = file->readUint32LE() - 8; - if ((header_ == 30) || (header_ == 31)) { + if ((soundTag == 30) || (soundTag == 31)) { if (waitTillFinished) { while (g_music->isSoundEffectActive()) { g_music->updateMusic(); @@ -483,20 +460,14 @@ void readSound(bool waitTillFinished) { } } - size_ -= 8L; - - (*difffile_) += 4; - readBlock(&samplespeed_, 2L, difffile_); - swapUShortPtr(&samplespeed_, 1); - - (*difffile_) += 2; - - byte *music = *difffile_; - uint32 musicsize = size_; - (*difffile_) += size_; + file->skip(4); - g_music->playSoundEffect(samplespeed_, musicsize, music); - } else if (header_ == 65535L) { + uint16 sampleRate = file->readUint16LE(); + file->skip(2); + byte *soundData = (byte *)malloc(soundSize); + file->read(soundData, soundSize); + g_music->playSoundEffect(sampleRate, soundSize, soundData); + } else if (soundTag == 65535L) { if (waitTillFinished) { while (g_music->isSoundEffectActive()) { g_music->updateMusic(); @@ -504,7 +475,7 @@ void readSound(bool waitTillFinished) { } } } else - (*difffile_) += size_; + file->skip(soundSize); } } -- cgit v1.2.3 From f014218acad608ba7f589b580a89fe75e59c507e Mon Sep 17 00:00:00 2001 From: Filippos Karapetis Date: Tue, 13 Oct 2015 07:41:06 +0300 Subject: LAB: Remove dead code --- engines/lab/readdiff.cpp | 11 +---------- 1 file changed, 1 insertion(+), 10 deletions(-) diff --git a/engines/lab/readdiff.cpp b/engines/lab/readdiff.cpp index e75d08e3f3..15b55e52bb 100644 --- a/engines/lab/readdiff.cpp +++ b/engines/lab/readdiff.cpp @@ -38,7 +38,7 @@ namespace Lab { static bool PlayOnce = false; -static uint32 header, size, processed = 0L, WaitSec = 0L, WaitMicros = 0L, DelayMicros = 0L; +static uint32 header, size, WaitSec = 0L, WaitMicros = 0L, DelayMicros = 0L; static uint16 CurBit = 0, framenumber = 0, samplespeed, numchunks = 1; static byte *Buffer, temp[5]; static bool donepal = false; @@ -176,10 +176,6 @@ void diffNextFrame() { readBlock(&size, 4L, difffile); swapULong(&size); - processed += 8L; - - processed += size; - switch (header) { case 8L: readBlock(diffcmap, size, difffile); @@ -296,7 +292,6 @@ void diffNextFrame() { /* A separate task launched by readDiff. Plays the DIFF. */ /*****************************************************************************/ void playDiff() { - processed = 0L; WaitSec = 0L; WaitMicros = 0L; DelayMicros = 0L; @@ -331,8 +326,6 @@ void playDiff() { readBlock(&header, 4L, difffile); swapULong(&header); - processed += 8L; - if (!((strcmp((char *)temp, "DIFF") == 0) && (header == 1219009121L))) { IsPlaying = false; return; @@ -375,8 +368,6 @@ void playDiff() { return; } - processed += 8L + size; - for (header = 0; header < 8; header++) RawDiffBM.Planes[header] = NULL; -- cgit v1.2.3 From 12f4a71c7335b99988839a80ed85c2f59c8f2c48 Mon Sep 17 00:00:00 2001 From: Filippos Karapetis Date: Wed, 14 Oct 2015 01:10:42 +0300 Subject: LAB: Simplify getViewData, get rid of ViewDataPtr and ActionPtr --- engines/lab/engine.cpp | 2 +- engines/lab/parsefun.h | 2 +- engines/lab/parsetypes.h | 13 ++++--------- engines/lab/processroom.cpp | 42 +++++++++++++++++++----------------------- engines/lab/resource.cpp | 10 +++++----- engines/lab/resource.h | 2 +- 6 files changed, 31 insertions(+), 40 deletions(-) diff --git a/engines/lab/engine.cpp b/engines/lab/engine.cpp index f7f65e24b1..d45d9f128b 100644 --- a/engines/lab/engine.cpp +++ b/engines/lab/engine.cpp @@ -665,7 +665,7 @@ static void mainGameLoop() { uint16 OldRoomNum, OldDirection = 0, GadID = 0, NewDir; CloseDataPtr OldCPtr, TempCPtr, HCPtr = NULL; - ViewDataPtr VPtr; + ViewData *VPtr; VGASetPal(initcolors, 8); diff --git a/engines/lab/parsefun.h b/engines/lab/parsefun.h index b634e9c120..672d19a95c 100644 --- a/engines/lab/parsefun.h +++ b/engines/lab/parsefun.h @@ -51,7 +51,7 @@ void allocRoom(void **Ptr, uint16 Size, uint16 RoomNum); /* From ProcessRoom.c */ -ViewDataPtr getViewData(uint16 RoomNum, uint16 Direction); +ViewData *getViewData(uint16 RoomNum, uint16 Direction); char *getPictName(CloseDataPtr *LCPtr); void drawDirection(CloseDataPtr LCPtr); bool processArrow(uint16 *Direction, uint16 Arrow); diff --git a/engines/lab/parsetypes.h b/engines/lab/parsetypes.h index f185c11b63..a437df0534 100644 --- a/engines/lab/parsetypes.h +++ b/engines/lab/parsetypes.h @@ -110,15 +110,13 @@ typedef struct closeData { typedef CloseData *CloseDataPtr; -struct viewData { +struct ViewData { int16 *Condition; char *GraphicName; - struct viewData *NextCondition; + struct ViewData *NextCondition; CloseDataPtr closeUps; }; -typedef viewData *ViewDataPtr; - struct Action { int16 ActionType, Param1, Param2, Param3; @@ -127,14 +125,11 @@ struct Action { Action *NextAction; }; -typedef Action *ActionPtr; - - struct Rule { int16 RuleType, Param1, Param2, *Condition; - ActionPtr ActionList; + Action * ActionList; Rule *NextRule; }; @@ -145,7 +140,7 @@ struct RoomData { byte WipeType; - ViewDataPtr NorthView, SouthView, EastView, WestView; + ViewData *NorthView, *SouthView, *EastView, *WestView; RuleList *rules; char *RoomMsg; }; diff --git a/engines/lab/processroom.cpp b/engines/lab/processroom.cpp index ea0309af22..0ef844cfae 100644 --- a/engines/lab/processroom.cpp +++ b/engines/lab/processroom.cpp @@ -94,40 +94,36 @@ static bool checkConditions(int16 *Condition) { /*****************************************************************************/ /* Gets the current ViewDataPointer. */ /*****************************************************************************/ -ViewDataPtr getViewData(uint16 roomNum, uint16 direction) { - ViewDataPtr *VPtr = NULL, ViewPtr; - bool doit = true; +ViewData *getViewData(uint16 roomNum, uint16 direction) { + ViewData *view = NULL; + + if (!Rooms[roomNum].RoomMsg) + g_resource->readViews(roomNum); if (direction == NORTH) - VPtr = &Rooms[roomNum].NorthView; + view = Rooms[roomNum].NorthView; else if (direction == SOUTH) - VPtr = &Rooms[roomNum].SouthView; + view = Rooms[roomNum].SouthView; else if (direction == EAST) - VPtr = &Rooms[roomNum].EastView; + view = Rooms[roomNum].EastView; else if (direction == WEST) - VPtr = &Rooms[roomNum].WestView; - - if (*VPtr == NULL) - g_resource->readViews(roomNum); - - ViewPtr = *VPtr; + view = Rooms[roomNum].WestView; do { - if (checkConditions(ViewPtr->Condition)) - doit = false; - else - ViewPtr = ViewPtr->NextCondition; + if (checkConditions(view->Condition)) + break; - } while (doit); + view = view->NextCondition; + } while (true); - return ViewPtr; + return view; } /*****************************************************************************/ /* Gets an object, if any, from the user's click on the screen. */ /*****************************************************************************/ static CloseData *getObject(uint16 x, uint16 y, CloseDataPtr LCPtr) { - ViewDataPtr VPtr; + ViewData *VPtr; if (LCPtr == NULL) { VPtr = getViewData(RoomNum, Direction); @@ -179,7 +175,7 @@ static CloseDataPtr findCPtrMatch(CloseDataPtr Main, CloseDataPtr List) { /* Returns the current picture name. */ /*****************************************************************************/ char *getPictName(CloseDataPtr *LCPtr) { - ViewDataPtr ViewPtr = getViewData(RoomNum, Direction); + ViewData *ViewPtr = getViewData(RoomNum, Direction); if (*LCPtr != NULL) { *LCPtr = findCPtrMatch(*LCPtr, ViewPtr->closeUps); @@ -266,7 +262,7 @@ bool processArrow(uint16 *direction, uint16 Arrow) { /* Sets the current close up data. */ /*****************************************************************************/ void setCurClose(uint16 x, uint16 y, CloseDataPtr *cptr, bool useAbsoluteCoords) { - ViewDataPtr VPtr; + ViewData *VPtr; CloseDataPtr LCPtr; uint16 x1, y1, x2, y2; @@ -302,7 +298,7 @@ void setCurClose(uint16 x, uint16 y, CloseDataPtr *cptr, bool useAbsoluteCoords) /* Takes the currently selected item. */ /*****************************************************************************/ bool takeItem(uint16 x, uint16 y, CloseDataPtr *cptr) { - ViewDataPtr VPtr; + ViewData *VPtr; CloseDataPtr LCPtr; if (*cptr == NULL) { @@ -332,7 +328,7 @@ bool takeItem(uint16 x, uint16 y, CloseDataPtr *cptr) { /*****************************************************************************/ /* Processes the action list. */ /*****************************************************************************/ -static void doActions(ActionPtr APtr, CloseDataPtr *LCPtr) { +static void doActions(Action * APtr, CloseDataPtr *LCPtr) { CloseDataPtr TLCPtr; bool FirstLoaded = true; char **str, *Test; diff --git a/engines/lab/resource.cpp b/engines/lab/resource.cpp index 7ca59ba2fd..e2afcc6889 100644 --- a/engines/lab/resource.cpp +++ b/engines/lab/resource.cpp @@ -283,17 +283,17 @@ CloseData *Resource::readCloseUps(uint16 depth, Common::File *file) { return head; } -viewData *Resource::readView(Common::File *file) { +ViewData *Resource::readView(Common::File *file) { char c; - viewData *view = NULL; - viewData *prev = NULL; - viewData *head = NULL; + ViewData *view = NULL; + ViewData *prev = NULL; + ViewData *head = NULL; do { c = file->readByte(); if (c == 1) { - view = (viewData *)malloc(sizeof(viewData)); + view = (ViewData *)malloc(sizeof(ViewData)); if (!head) head = view; if (prev) diff --git a/engines/lab/resource.h b/engines/lab/resource.h index d254cd068e..d41859e9f5 100644 --- a/engines/lab/resource.h +++ b/engines/lab/resource.h @@ -111,7 +111,7 @@ private: RuleList *readRule(Common::File *file); Action *readAction(Common::File *file); CloseData *readCloseUps(uint16 depth, Common::File *file); - viewData *readView(Common::File *file); + ViewData *readView(Common::File *file); void readStaticText(); Common::String _staticText[48]; -- cgit v1.2.3 From 95d91d81e53955a47b7e0edd293be135331ca6f8 Mon Sep 17 00:00:00 2001 From: Filippos Karapetis Date: Wed, 14 Oct 2015 01:18:26 +0300 Subject: LAB: Fix whitespace --- engines/lab/parsetypes.h | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/engines/lab/parsetypes.h b/engines/lab/parsetypes.h index a437df0534..681bbe70ae 100644 --- a/engines/lab/parsetypes.h +++ b/engines/lab/parsetypes.h @@ -117,7 +117,6 @@ struct ViewData { CloseDataPtr closeUps; }; - struct Action { int16 ActionType, Param1, Param2, Param3; byte *Data; /* Message, or a pointer to array @@ -125,11 +124,10 @@ struct Action { Action *NextAction; }; - struct Rule { int16 RuleType, Param1, Param2, *Condition; - Action * ActionList; + Action *ActionList; Rule *NextRule; }; -- cgit v1.2.3 From 09a7232daa00b5bcb039a3e3a06b3ee4d541460d Mon Sep 17 00:00:00 2001 From: Filippos Karapetis Date: Wed, 14 Oct 2015 01:51:18 +0300 Subject: LAB: Use Common::File to load map data --- engines/lab/map.cpp | 48 +++++++++++++++++++++++++----------------------- 1 file changed, 25 insertions(+), 23 deletions(-) diff --git a/engines/lab/map.cpp b/engines/lab/map.cpp index ceddc4bdf4..a096d28326 100644 --- a/engines/lab/map.cpp +++ b/engines/lab/map.cpp @@ -188,13 +188,11 @@ static uint16 mapScaleY(uint16 y) { } - - /*****************************************************************************/ /* Loads in the map data. */ /*****************************************************************************/ static bool loadMapData() { - byte **buffer, Temp[5]; + byte **buffer; uint32 Size; Gadget *gptr; uint16 counter; @@ -254,28 +252,33 @@ static bool loadMapData() { counter++; } - uint32 bufferSize; - buffer = g_music->newOpen("Lab:Maps", bufferSize); - stealBufMem(bufferSize); /* Freeze the memory for the maps */ - readBlock(Temp, 4L, buffer); - Temp[4] = 0; + Common::File *mapFile = g_resource->openDataFile("Lab:Maps", MKTAG('M', 'A', 'P', '0')); + if (!mapFile) + error("Corrupt map file"); + g_music->updateMusic(); + if (!g_music->_doNotFilestopSoundEffect) + g_music->stopSoundEffect(); + + MaxRooms = mapFile->readUint16LE(); + Maps = new MapData[MaxRooms]; // will be freed when the user exits the map + for (int i = 0; i < MaxRooms; i++) { + Maps[i].x = mapFile->readUint16LE(); + Maps[i].y = mapFile->readUint16LE(); + Maps[i].PageNumber = mapFile->readUint16LE(); + Maps[i].SpecialID = mapFile->readUint16LE(); + Maps[i].MapFlags = mapFile->readUint32LE(); + } - if (strcmp((char *)Temp, "MAP0") == 0) { - readBlock(&MaxRooms, 2L, buffer); - swapUShortPtr(&MaxRooms, 1); - Maps = (MapData *)(*buffer); - - for (counter = 1; counter <= MaxRooms; counter++) { - swapUShortPtr(&Maps[counter].x, 4); - swapULong(&Maps[counter].MapFlags); - } - } else - return false; + delete mapFile; return true; } +static void freeMapData() { + delete[] Maps; + Maps = NULL; +} static uint16 fadeNumIn(uint16 num, uint16 res, uint16 counter) { @@ -543,7 +546,7 @@ static void getDownFloor(uint16 *Floor, bool *isfloor) { *isfloor = false; return; } else if (*Floor > UPPERFLOOR) { - /* LAB: Labyrinth specific code */ + // Labyrinth specific code if (*Floor == HEDGEMAZEFLOOR) *Floor = UPPERFLOOR; else if ((*Floor == CARNIVAL) || (*Floor == MEDMAZEFLOOR)) @@ -616,7 +619,7 @@ static void drawMap(uint16 CurRoom, uint16 CurMsg, uint16 Floor, bool fadeout, b else ghoastGadget(&downgadget, 12); - /* LAB: Labyrinth specific code */ + // Labyrinth specific code if (Floor == LOWERFLOOR) { if (onFloor(SURMAZEFLOOR)) drawImage(Maze, mapScaleX(538), mapScaleY(277)); @@ -634,7 +637,6 @@ static void drawMap(uint16 CurRoom, uint16 CurMsg, uint16 Floor, bool fadeout, b flowText(MsgFont, 0, 7, 0, true, true, true, true, mapScaleX(360), 0, mapScaleX(660), mapScaleY(450), sptr); } - switch (Floor) { case LOWERFLOOR: sptr = (char *)g_resource->getStaticText(kTextLowerFloor).c_str(); @@ -879,7 +881,7 @@ void doMap(uint16 CurRoom) { mouseHide(); setAPen(0); rectFill(0, 0, VGAScreenWidth - 1, VGAScreenHeight - 1); - freeAllStolenMem(); + freeMapData(); blackAllScreen(); mouseShow(); WSDL_UpdateScreen(); -- cgit v1.2.3 From 1feb0e4c2ce5d83701f4aff469d99b33ba1953dc Mon Sep 17 00:00:00 2001 From: Filippos Karapetis Date: Fri, 16 Oct 2015 01:52:53 +0300 Subject: LAB: Rename monpage -> monitorPage --- engines/lab/special.cpp | 22 +++++++++++----------- 1 file changed, 11 insertions(+), 11 deletions(-) diff --git a/engines/lab/special.cpp b/engines/lab/special.cpp index 7e8bc96c88..978ce11c98 100644 --- a/engines/lab/special.cpp +++ b/engines/lab/special.cpp @@ -65,7 +65,7 @@ static Image JBackImage, ScreenImage; static uint16 JGadX[3] = { 80, 144, 194 }, JGadY[3] = { 162, 164, 162 }; static Gadget ForwardG, CancelG, BackG; static bool GotBackImage = false; -static uint16 monpage; +static uint16 monitorPage; static const char *TextFileName; Image *MonButton, *AltMonButton, *MonQuit, *AltMonQuit, *MonBack, *AltMonBack, @@ -918,14 +918,14 @@ static void drawMonText(char *text, uint16 x1, uint16 y1, uint16 x2, uint16 y2, rectFill(x1, y1, x2, y2); } - while (DrawingToPage < monpage) { + while (DrawingToPage < monitorPage) { g_music->updateMusic(); CurText = (char *)(text + CharsDrawn); CharsDrawn += flowText(BigMsgFont, yspacing, 0, 0, false, false, false, false, x1, y1, x2, y2, CurText); lastpage = (*CurText == 0); if (lastpage) - monpage = DrawingToPage; + monitorPage = DrawingToPage; else DrawingToPage++; } @@ -963,7 +963,7 @@ static void processMonitor(char *ntext, bool isinteractive, uint16 x1, uint16 y1 Test = CPtr->GraphicName; if (strcmp(Test, TextFileName)) { - monpage = 0; + monitorPage = 0; TextFileName = Test; ntext = getText(TextFileName); @@ -993,26 +993,26 @@ static void processMonitor(char *ntext, bool isinteractive, uint16 x1, uint16 y1 if ((MouseY >= VGAScaleY(171)) && (MouseY <= VGAScaleY(200))) { if ((MouseX >= VGAScaleX(259)) && (MouseX <= VGAScaleX(289))) { if (!lastpage) { - monpage += 1; + monitorPage += 1; drawMonText(ntext, x1, y1, x2, y2, isinteractive); } } else if ((MouseX >= VGAScaleX(0)) && (MouseX <= VGAScaleX(31))) { return; } else if ((MouseX >= VGAScaleX(290)) && (MouseX <= VGAScaleX(320))) { - if (monpage >= 1) { - monpage -= 1; + if (monitorPage >= 1) { + monitorPage -= 1; drawMonText(ntext, x1, y1, x2, y2, isinteractive); } } else if ((MouseX >= VGAScaleX(31)) && (MouseX <= VGAScaleX(59))) { if (isinteractive) { - monpage = 0; + monitorPage = 0; if (depth) { depth--; CPtr = LastCPtr[depth]; } - } else if (monpage > 0) { - monpage = 0; + } else if (monitorPage > 0) { + monitorPage = 0; drawMonText(ntext, x1, y1, x2, y2, isinteractive); } } @@ -1054,7 +1054,7 @@ void doMonitor(char *background, char *textfile, bool isinteractive, uint16 x1, blackAllScreen(); resetBuffer(); - monpage = 0; + monitorPage = 0; lastpage = false; FadePalette = hipal; -- cgit v1.2.3 From ebff05e7e74cb10161c345c1b8532a5a2f417001 Mon Sep 17 00:00:00 2001 From: Filippos Karapetis Date: Fri, 16 Oct 2015 01:59:37 +0300 Subject: LAB: Simplify the file reading code for the movement control panel --- engines/lab/engine.cpp | 32 +++++++++++++++----------------- 1 file changed, 15 insertions(+), 17 deletions(-) diff --git a/engines/lab/engine.cpp b/engines/lab/engine.cpp index d45d9f128b..967bcf4e75 100644 --- a/engines/lab/engine.cpp +++ b/engines/lab/engine.cpp @@ -115,8 +115,6 @@ extern const char *NewFileName; /* When ProcessRoom.c decides to change the fil #define LEVERSMONITOR 82 -static byte *MovePanelBuffer, *InvPanelBuffer; -static uint32 MovePanelBufferSize, InvPanelBufferSize; static Image *MoveImages[20], *InvImages[10]; static Gadget *MoveGadgetList, *InvGadgetList; @@ -223,7 +221,8 @@ static void drawRoomMessage(uint16 CurInv, CloseDataPtr cptr) { /******************************************************************************/ bool setUpScreens() { uint16 counter; - byte *bufferstorage, **buffer = &bufferstorage; + byte *buffer; + byte *MovePanelBuffer, *InvPanelBuffer; Gadget *curgad; uint16 y; @@ -231,18 +230,18 @@ bool setUpScreens() { return false; /* Loads in the graphics for the movement control panel */ - Common::File *file = openPartial("P:Control"); - if (!file) + Common::File file; + file.open(translateFileName("P:Control")); + if (file.err() || file.size() == 0) return false; - MovePanelBufferSize = file->size(); - if (!MovePanelBufferSize || !(MovePanelBuffer = (byte *)calloc(MovePanelBufferSize, 1))) + if (!(MovePanelBuffer = (byte *)calloc(file.size(), 1))) return false; - file->read(MovePanelBuffer, MovePanelBufferSize); - file->close(); + file.read(MovePanelBuffer, file.size()); + file.close(); - *buffer = MovePanelBuffer; + buffer = MovePanelBuffer; for (counter = 0; counter < 20; counter++) readImage(buffer, &(MoveImages[counter])); @@ -292,18 +291,17 @@ bool setUpScreens() { curgad->NextGadget = createButton(289, y, 9, 0, MoveImages[10], MoveImages[11]); } - file = openPartial("P:Inv"); - if (!file) + file.open(translateFileName("P:Inv")); + if (file.err() || file.size() == 0) return false; - InvPanelBufferSize = file->size(); - if (!InvPanelBufferSize || !(InvPanelBuffer = (byte *)calloc(InvPanelBufferSize, 1))) + if (!(InvPanelBuffer = (byte *)calloc(file.size(), 1))) return false; - file->read(InvPanelBuffer, InvPanelBufferSize); - file->close(); + file.read(InvPanelBuffer, file.size()); + file.close(); - *buffer = InvPanelBuffer; + buffer = InvPanelBuffer; if (g_lab->getPlatform() == Common::kPlatformWindows) { for (counter = 0; counter < 10; counter++) -- cgit v1.2.3 From ad29493fa73cf40d3ba94fc5d58183ac355b4144 Mon Sep 17 00:00:00 2001 From: Eugene Sandulenko Date: Tue, 17 Nov 2015 18:50:48 +0100 Subject: LAB: Fix compilation --- engines/lab/engine.cpp | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/engines/lab/engine.cpp b/engines/lab/engine.cpp index 967bcf4e75..c93509a481 100644 --- a/engines/lab/engine.cpp +++ b/engines/lab/engine.cpp @@ -244,7 +244,7 @@ bool setUpScreens() { buffer = MovePanelBuffer; for (counter = 0; counter < 20; counter++) - readImage(buffer, &(MoveImages[counter])); + readImage(&buffer, &(MoveImages[counter])); /* Creates the gadgets for the movement control panel */ y = VGAScaleY(173) - SVGACord(2); @@ -305,7 +305,7 @@ bool setUpScreens() { if (g_lab->getPlatform() == Common::kPlatformWindows) { for (counter = 0; counter < 10; counter++) - readImage(buffer, &(InvImages[counter])); + readImage(&buffer, &(InvImages[counter])); InvGadgetList = createButton(24, y, 0, 'm', InvImages[0], InvImages[1]); curgad = InvGadgetList; @@ -325,7 +325,7 @@ bool setUpScreens() { curgad = curgad->NextGadget; } else { for (counter = 0; counter < 6; counter++) - readImage(buffer, &(InvImages[counter])); + readImage(&buffer, &(InvImages[counter])); InvGadgetList = createButton(58, y, 0, 0, InvImages[0], InvImages[1]); curgad = InvGadgetList; @@ -814,7 +814,7 @@ from_crumbs: Class = MOUSEBUTTONS; Qualifier = IEQUALIFIER_LEFTBUTTON; mouseXY(&MouseX, &MouseY); - } else if (g_lab->getPlatform() == Common::kPlatformWindows && + } else if (g_lab->getPlatform() == Common::kPlatformWindows && (Code == 'b' || Code == 'B')) { /* Start bread crumbs */ BreadCrumbs[0].RoomNum = 0; NumCrumbs = 0; -- cgit v1.2.3 From 647b0355c9a8ea4f7eef36b12dfdc148799116ba Mon Sep 17 00:00:00 2001 From: Eugene Sandulenko Date: Tue, 17 Nov 2015 18:56:47 +0100 Subject: LAB: Cleanup --- engines/lab/graphics.cpp | 6 +----- engines/lab/mouse.cpp | 2 -- engines/lab/text.cpp | 3 --- engines/lab/vga.cpp | 13 ------------- engines/lab/vga.h | 3 --- 5 files changed, 1 insertion(+), 26 deletions(-) diff --git a/engines/lab/graphics.cpp b/engines/lab/graphics.cpp index bc10e8fcb9..7bd2af41d7 100644 --- a/engines/lab/graphics.cpp +++ b/engines/lab/graphics.cpp @@ -423,7 +423,7 @@ void drawMessage(const char *str) { static void doScrollBlack() { byte *mem, *tempmem; Image Im; - uint16 width, height, by, nheight, CurPage; + uint16 width, height, by, nheight; uint32 size, copysize; uint32 *BaseAddr; @@ -459,7 +459,6 @@ static void doScrollBlack() { mem += by * width; nheight -= by; size = (int32) nheight * (int32) width; - CurPage = 0; tempmem = mem; while (size) { @@ -470,10 +469,8 @@ static void doScrollBlack() { size -= copysize; - setPage(CurPage); memcpy(BaseAddr, tempmem, copysize); tempmem += copysize; - CurPage++; } setAPen(0); @@ -524,7 +521,6 @@ static void copyPage(uint16 width, uint16 height, uint16 nheight, uint16 startli size -= copysize; - setPage(CurPage); memcpy(BaseAddr + (OffSet >> 2), mem, copysize); mem += copysize; CurPage++; diff --git a/engines/lab/mouse.cpp b/engines/lab/mouse.cpp index 8636ad7733..553b6654a2 100644 --- a/engines/lab/mouse.cpp +++ b/engines/lab/mouse.cpp @@ -81,7 +81,6 @@ static Gadget *checkGadgetHit(Gadget *gadlist, uint16 x, uint16 y) { if (IsHiRes) { hitgad = gadlist; } else { - VGAStorePage(); mouseHide(); drawImage(gadlist->ImAlt, gadlist->x, gadlist->y); mouseShow(); @@ -92,7 +91,6 @@ static Gadget *checkGadgetHit(Gadget *gadlist, uint16 x, uint16 y) { mouseHide(); drawImage(gadlist->Im, gadlist->x, gadlist->y); mouseShow(); - VGARestorePage(); } return gadlist; diff --git a/engines/lab/text.cpp b/engines/lab/text.cpp index 807df45a04..c89cec389a 100644 --- a/engines/lab/text.cpp +++ b/engines/lab/text.cpp @@ -90,7 +90,6 @@ void text(struct TextFont *tf, uint16 x, uint16 y, uint16 color, const char *tex SegmentOffset = RealOffset - (curpage * VGABytesPerPage); LeftInSegment = VGABytesPerPage - SegmentOffset; VGACur = VGATop + SegmentOffset; - setPage(curpage); if (tf->Widths[(uint)*text]) { cdata = tf->data + tf->Offsets[(uint)*text]; @@ -120,7 +119,6 @@ void text(struct TextFont *tf, uint16 x, uint16 y, uint16 color, const char *tex for (counterb = 0; counterb < 8; counterb++) { if (templeft <= 0) { curpage++; - setPage(curpage); VGATemp = (byte *)(VGATop - templeft); /* Set up VGATempLine for next line */ VGATempLine -= VGABytesPerPage; @@ -148,7 +146,6 @@ void text(struct TextFont *tf, uint16 x, uint16 y, uint16 color, const char *tex if (LeftInSegment <= 0) { curpage++; - setPage(curpage); VGATempLine -= VGABytesPerPage; LeftInSegment += VGABytesPerPage; } diff --git a/engines/lab/vga.cpp b/engines/lab/vga.cpp index aa31d19771..013b6ee9a6 100644 --- a/engines/lab/vga.cpp +++ b/engines/lab/vga.cpp @@ -88,19 +88,6 @@ bool createScreen(bool HiRes) { /*****************************************************************************/ /* Sets the current page on the VGA card. */ /*****************************************************************************/ -void setPage(uint16 PageNum) { - // PageNum should always calculated out to zero for SDL. - assert(PageNum == 0); -} - -void VGAStorePage() { - // does nothing in SDL -} - -void VGARestorePage() { - // does nothing in SDL -} - void changeVolume(int delta) { warning("STUB: changeVolume()"); } diff --git a/engines/lab/vga.h b/engines/lab/vga.h index 376411aede..aa5a26cda2 100644 --- a/engines/lab/vga.h +++ b/engines/lab/vga.h @@ -41,9 +41,6 @@ struct Image { byte *ImageData; }; -void setPage(uint16 PageNum); -void VGAStorePage(); -void VGARestorePage(); bool createScreen(bool HiRes); void waitTOF(); void quickWaitTOF(); -- cgit v1.2.3 From 3160bb0bc3fbb001a3f7c97ef865eb951c02209a Mon Sep 17 00:00:00 2001 From: Eugene Sandulenko Date: Tue, 17 Nov 2015 18:58:00 +0100 Subject: LAB: Fix warning --- engines/lab/labmusic.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/engines/lab/labmusic.cpp b/engines/lab/labmusic.cpp index d4752c60da..e169c968fe 100644 --- a/engines/lab/labmusic.cpp +++ b/engines/lab/labmusic.cpp @@ -346,7 +346,7 @@ byte **Music::newOpen(const char *name, uint32 &size) { if (!name || !strcmp(name, "") || !strcmp(name, " ")) return NULL; - if (file = isBuffered(name)) + if ((file = isBuffered(name))) return file; updateMusic(); -- cgit v1.2.3 From d4e0c23ed311b3fc9b5ddfd2806a3c273f57c6d6 Mon Sep 17 00:00:00 2001 From: Eugene Sandulenko Date: Tue, 17 Nov 2015 19:24:00 +0100 Subject: LAB: Simplify code --- engines/lab/undiff.cpp | 15 ++++++++------- 1 file changed, 8 insertions(+), 7 deletions(-) diff --git a/engines/lab/undiff.cpp b/engines/lab/undiff.cpp index d9d53a3031..f7610d99ce 100644 --- a/engines/lab/undiff.cpp +++ b/engines/lab/undiff.cpp @@ -29,6 +29,7 @@ */ #include "lab/stddefines.h" +#include "common/endian.h" namespace Lab { @@ -107,9 +108,9 @@ static void unDIFFByteWord(uint16 *Dest, uint16 *diff) { if (skip == 255) { if (copy == 0) { - skip = swapUShort(*diff); + skip = READ_LE_UINT16(diff); diff++; - copy = swapUShort(*diff); + copy = READ_LE_UINT16(diff); diff++; } else if (copy == 255) return; @@ -118,19 +119,19 @@ static void unDIFFByteWord(uint16 *Dest, uint16 *diff) { Dest += skip; while (copy > 3) { - *Dest = *diff; //swapUShort(*diff); + *Dest = READ_LE_UINT16(diff); Dest++; diff++; - *Dest = *diff; //swapUShort(*diff); + *Dest = READ_LE_UINT16(diff); Dest++; diff++; - *Dest = *diff; //swapUShort(*diff); + *Dest = READ_LE_UINT16(diff); Dest++; diff++; - *Dest = *diff; //swapUShort(*diff); + *Dest = READ_LE_UINT16(diff); Dest++; diff++; @@ -138,7 +139,7 @@ static void unDIFFByteWord(uint16 *Dest, uint16 *diff) { } while (copy) { - *Dest = *diff; //swapUShort(*diff); + *Dest = READ_LE_UINT16(diff); Dest++; diff++; copy--; -- cgit v1.2.3 From 36684eb1bab5b20c4052d89047b17c2f625666d1 Mon Sep 17 00:00:00 2001 From: Eugene Sandulenko Date: Fri, 20 Nov 2015 19:45:07 +0100 Subject: LAB: get rid of timing.h --- engines/lab/engine.cpp | 9 ++++----- engines/lab/interface.cpp | 1 - engines/lab/intro.cpp | 9 ++++----- engines/lab/lab.h | 12 ++++++++++++ engines/lab/labmusic.cpp | 1 - engines/lab/mouse.cpp | 1 - engines/lab/processroom.cpp | 9 ++++----- engines/lab/readdiff.cpp | 7 +++---- engines/lab/special.cpp | 3 +-- engines/lab/timing.cpp | 15 +++++++-------- engines/lab/timing.h | 47 --------------------------------------------- 11 files changed, 35 insertions(+), 79 deletions(-) delete mode 100644 engines/lab/timing.h diff --git a/engines/lab/engine.cpp b/engines/lab/engine.cpp index c93509a481..c2ab4673c8 100644 --- a/engines/lab/engine.cpp +++ b/engines/lab/engine.cpp @@ -33,7 +33,6 @@ #include "lab/labfun.h" #include "lab/diff.h" #include "lab/vga.h" -#include "lab/timing.h" #include "lab/text.h" #include "lab/parsefun.h" #include "lab/interface.h" @@ -829,7 +828,7 @@ from_crumbs: FollowCrumbsFast = (Code == 'r' || Code == 'R'); IsCrumbTurning = false; IsCrumbWaiting = false; - getTime(&CrumbSecs, &CrumbMicros); + g_lab->getTime(&CrumbSecs, &CrumbMicros); if (Alternate) { eatMessages(); @@ -1158,7 +1157,7 @@ from_crumbs: FollowCrumbsFast = false; IsCrumbTurning = false; IsCrumbWaiting = false; - getTime(&CrumbSecs, &CrumbMicros); + g_lab->getTime(&CrumbSecs, &CrumbMicros); eatMessages(); Alternate = false; @@ -1417,7 +1416,7 @@ int followCrumbs() { uint32 Secs; uint32 Micros; - timeDiff(CrumbSecs, CrumbMicros, &Secs, &Micros); + g_lab->timeDiff(CrumbSecs, CrumbMicros, &Secs, &Micros); if (Secs != 0 || Micros != 0) return 0; @@ -1460,7 +1459,7 @@ int followCrumbs() { IsCrumbTurning = (MoveDir != VKEY_UPARROW); IsCrumbWaiting = true; - addCurTime(theDelay / ONESECOND, theDelay % ONESECOND, &CrumbSecs, &CrumbMicros); + g_lab->addCurTime(theDelay / ONESECOND, theDelay % ONESECOND, &CrumbSecs, &CrumbMicros); } return MoveDir; diff --git a/engines/lab/interface.cpp b/engines/lab/interface.cpp index e2f7401114..8d05e4174d 100644 --- a/engines/lab/interface.cpp +++ b/engines/lab/interface.cpp @@ -31,7 +31,6 @@ #include "lab/labfun.h" #include "lab/stddefines.h" #include "lab/interface.h" -#include "lab/timing.h" #include "lab/mouse.h" #include "lab/vga.h" #include "common/util.h" diff --git a/engines/lab/intro.cpp b/engines/lab/intro.cpp index 2ffddf7dc5..16ed20b88a 100644 --- a/engines/lab/intro.cpp +++ b/engines/lab/intro.cpp @@ -32,7 +32,6 @@ #include "lab/stddefines.h" #include "lab/labfun.h" #include "lab/resource.h" -#include "lab/timing.h" #include "lab/diff.h" #include "lab/text.h" #include "lab/interface.h" @@ -142,7 +141,7 @@ static void doPictText(const char *Filename, bool isscreen) { return; } - getTime(&lastsecs, &lastmicros); + g_lab->getTime(&lastsecs, &lastmicros); } Msg = getMsg(); @@ -151,8 +150,8 @@ static void doPictText(const char *Filename, bool isscreen) { g_music->updateMusic(); diffNextFrame(); - getTime(&secs, µs); - anyTimeDiff(lastsecs, lastmicros, secs, micros, &secs, µs); + g_lab->getTime(&secs, µs); + g_lab->anyTimeDiff(lastsecs, lastmicros, secs, micros, &secs, µs); if (secs > timedelay) { if (End) { @@ -258,7 +257,7 @@ static void NReadPict(const char *Filename, bool PlayOnce) { /*****************************************************************************/ void introSequence() { uint16 counter, counter1; - + uint16 Palette[16] = { 0x0000, 0x0855, 0x0FF9, 0x0EE7, 0x0ED5, 0x0DB4, 0x0CA2, 0x0C91, 0x0B80, 0x0B80, 0x0B91, 0x0CA2, 0x0CB3, 0x0DC4, 0x0DD6, 0x0EE7 }; diff --git a/engines/lab/lab.h b/engines/lab/lab.h index c1bf4337b9..989def2e1c 100644 --- a/engines/lab/lab.h +++ b/engines/lab/lab.h @@ -45,6 +45,8 @@ enum GameFeatures { GF_WINDOWS_TRIAL = 1 << 1 }; +#define ONESECOND 1000 + class LabEngine : public Engine { public: LabEngine(OSystem *syst, const ADGameDescription *gameDesc); @@ -64,8 +66,18 @@ public: LargeSet *_conditions, *_roomsFound; + // timing.cpp + void getTime(uint32 *secs, uint32 *micros); + void addCurTime(uint32 sec, uint32 micros, uint32 *timeSec, uint32 *timeMicros); + void anyTimeDiff(uint32 sec1, uint32 micros1, uint32 sec2, uint32 micros2, uint32 *diffSecs, uint32 *diffMicros); + void timeDiff(uint32 sec, uint32 micros, uint32 *diffSec, uint32 *diffMicros); + void waitForTime(uint32 sec, uint32 micros); + private: uint32 _extraGameFeatures; + + // timing.cpp + void microDelay(uint32 secs, uint32 micros); }; extern LabEngine *g_lab; diff --git a/engines/lab/labmusic.cpp b/engines/lab/labmusic.cpp index e169c968fe..50ba48dbb8 100644 --- a/engines/lab/labmusic.cpp +++ b/engines/lab/labmusic.cpp @@ -32,7 +32,6 @@ #include "lab/stddefines.h" #include "lab/labfun.h" -#include "lab/timing.h" #include "lab/mouse.h" #include "lab/vga.h" #include "lab/lab.h" diff --git a/engines/lab/mouse.cpp b/engines/lab/mouse.cpp index 553b6654a2..c45ab5cd60 100644 --- a/engines/lab/mouse.cpp +++ b/engines/lab/mouse.cpp @@ -31,7 +31,6 @@ #include "lab/mouse.h" #include "lab/vga.h" #include "lab/stddefines.h" -#include "lab/timing.h" #include "lab/interface.h" namespace Lab { diff --git a/engines/lab/processroom.cpp b/engines/lab/processroom.cpp index 0ef844cfae..d48a4ca807 100644 --- a/engines/lab/processroom.cpp +++ b/engines/lab/processroom.cpp @@ -36,7 +36,6 @@ #include "lab/parsetypes.h" #include "lab/parsefun.h" #include "lab/resource.h" -#include "lab/timing.h" #include "lab/diff.h" #include "lab/vga.h" #include "lab/interface.h" @@ -63,7 +62,7 @@ extern CloseDataPtr CPtr; uint16 getRandom(uint16 max) { uint32 secs, micros; - getTime(&secs, µs); + g_lab->getTime(&secs, µs); return ((micros + secs) % max); } @@ -483,14 +482,14 @@ static void doActions(Action * APtr, CloseDataPtr *LCPtr) { break; case WAITSECS: - addCurTime(APtr->Param1, 0, &StartSecs, &StartMicros); + g_lab->addCurTime(APtr->Param1, 0, &StartSecs, &StartMicros); WSDL_UpdateScreen(); while (1) { g_music->updateMusic(); diffNextFrame(); - getTime(&CurSecs, &CurMicros); + g_lab->getTime(&CurSecs, &CurMicros); if ((CurSecs > StartSecs) || ((CurSecs == StartSecs) && (CurMicros >= StartMicros))) @@ -615,7 +614,7 @@ static bool doActionRuleSub(int16 action, int16 roomNum, CloseDataPtr LCPtr, Clo if (LCPtr) { RuleList *rules = Rooms[RoomNum].rules; - + if ((rules == NULL) && (roomNum == 0)) { g_resource->readViews(roomNum); rules = Rooms[roomNum].rules; diff --git a/engines/lab/readdiff.cpp b/engines/lab/readdiff.cpp index 15b55e52bb..727a3394a2 100644 --- a/engines/lab/readdiff.cpp +++ b/engines/lab/readdiff.cpp @@ -28,8 +28,7 @@ * */ -#include "lab/stddefines.h" -#include "lab/timing.h" +#include "lab/lab.h" #include "lab/diff.h" #include "lab/labfun.h" #include "lab/vga.h" @@ -137,8 +136,8 @@ void diffNextFrame() { if (!IsBM) { if (headerdata.fps) { - waitForTime(WaitSec, WaitMicros); - addCurTime(0L, DelayMicros, &WaitSec, &WaitMicros); + g_lab->waitForTime(WaitSec, WaitMicros); + g_lab->addCurTime(0L, DelayMicros, &WaitSec, &WaitMicros); } if (IsPal && !nopalchange) { diff --git a/engines/lab/special.cpp b/engines/lab/special.cpp index 978ce11c98..377f8dbece 100644 --- a/engines/lab/special.cpp +++ b/engines/lab/special.cpp @@ -41,7 +41,6 @@ #include "lab/vga.h" #include "lab/text.h" #include "lab/mouse.h" -#include "lab/timing.h" #include "lab/stddefines.h" #include "lab/parsetypes.h" #include "lab/resource.h" @@ -855,7 +854,7 @@ bool saveRestoreGame() { } WSDL_UpdateScreen(); - + return isOK; } diff --git a/engines/lab/timing.cpp b/engines/lab/timing.cpp index a9f593e668..ca767550dc 100644 --- a/engines/lab/timing.cpp +++ b/engines/lab/timing.cpp @@ -28,8 +28,7 @@ * */ -#include "lab/stddefines.h" -#include "lab/timing.h" +#include "lab/lab.h" #include "lab/vga.h" namespace Lab { @@ -37,7 +36,7 @@ namespace Lab { /*****************************************************************************/ /* Waits for for Secs seconds and Micros microseconds to pass. */ /*****************************************************************************/ -void microDelay(uint32 secs, uint32 micros) { +void LabEngine::microDelay(uint32 secs, uint32 micros) { uint32 waitSecs, waitMicros; addCurTime(secs, micros, &waitSecs, &waitMicros); @@ -55,7 +54,7 @@ void microDelay(uint32 secs, uint32 micros) { /*****************************************************************************/ /* Gets the current system time. */ /*****************************************************************************/ -void getTime(uint32 *secs, uint32 *micros) { +void LabEngine::getTime(uint32 *secs, uint32 *micros) { uint32 t = g_system->getMillis(); *secs = t / 1000; @@ -65,7 +64,7 @@ void getTime(uint32 *secs, uint32 *micros) { /*****************************************************************************/ /* Adds seconds and microseconds to current time to get a new time. */ /*****************************************************************************/ -void addCurTime(uint32 sec, uint32 micros, uint32 *timeSec, uint32 *timeMicros) { +void LabEngine::addCurTime(uint32 sec, uint32 micros, uint32 *timeSec, uint32 *timeMicros) { getTime(timeSec, timeMicros); (*timeSec) += sec; @@ -81,7 +80,7 @@ void addCurTime(uint32 sec, uint32 micros, uint32 *timeSec, uint32 *timeMicros) /* Finds the difference between time1 and time2. If time1 is later than */ /* time2, returns 0. */ /*****************************************************************************/ -void anyTimeDiff(uint32 sec1, uint32 micros1, uint32 sec2, uint32 micros2, uint32 *diffSecs, uint32 *diffMicros) { +void LabEngine::anyTimeDiff(uint32 sec1, uint32 micros1, uint32 sec2, uint32 micros2, uint32 *diffSecs, uint32 *diffMicros) { *diffSecs = 0; *diffMicros = 0; @@ -103,7 +102,7 @@ void anyTimeDiff(uint32 sec1, uint32 micros1, uint32 sec2, uint32 micros2, uint3 /* Finds the difference between the current time, and a future time. Returns */ /* 0 if the future time is actually before the current time. */ /*****************************************************************************/ -void timeDiff(uint32 sec, uint32 micros, uint32 *diffSec, uint32 *diffMicros) { +void LabEngine::timeDiff(uint32 sec, uint32 micros, uint32 *diffSec, uint32 *diffMicros) { uint32 curSec, curMicros; getTime(&curSec, &curMicros); anyTimeDiff(curSec, curMicros, sec, micros, diffSec, diffMicros); @@ -112,7 +111,7 @@ void timeDiff(uint32 sec, uint32 micros, uint32 *diffSec, uint32 *diffMicros) { /*****************************************************************************/ /* Waits for a specified time to occur. */ /*****************************************************************************/ -void waitForTime(uint32 sec, uint32 micros) { +void LabEngine::waitForTime(uint32 sec, uint32 micros) { uint32 curSec, curMicros; getTime(&curSec, &curMicros); diff --git a/engines/lab/timing.h b/engines/lab/timing.h deleted file mode 100644 index adbaf950d8..0000000000 --- a/engines/lab/timing.h +++ /dev/null @@ -1,47 +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. - * - */ - -/* - * This code is based on Labyrinth of Time code with assistance of - * - * Copyright (c) 1993 Terra Nova Development - * Copyright (c) 2004 The Wyrmkeep Entertainment Co. - * - */ - -#ifndef LAB_TIMING_H -#define LAB_TIMING_H - -namespace Lab { - -#define ONESECOND 1000 - -void microDelay(uint32 secs, uint32 micros); -void getTime(uint32 *secs, uint32 *micros); -void addCurTime(uint32 sec, uint32 micros, uint32 *timeSec, uint32 *timeMicros); -void anyTimeDiff(uint32 sec1, uint32 micros1, uint32 sec2, uint32 micros2, uint32 *diffSecs, uint32 *diffMicros); -void timeDiff(uint32 sec, uint32 micros, uint32 *diffSec, uint32 *diffMicros); -void waitForTime(uint32 sec, uint32 micros); - -} // End of namespace Lab - -#endif /* LAB_TIMING_H */ -- cgit v1.2.3 From fd8215454cdccfe7d03229fa5c6914444a002114 Mon Sep 17 00:00:00 2001 From: Eugene Sandulenko Date: Fri, 20 Nov 2015 20:17:30 +0100 Subject: LAB: Objectify intro code --- engines/lab/engine.cpp | 5 +- engines/lab/intro.cpp | 215 +++++++++++++++++++++++++------------------------ engines/lab/labfun.h | 6 -- 3 files changed, 112 insertions(+), 114 deletions(-) diff --git a/engines/lab/engine.cpp b/engines/lab/engine.cpp index c2ab4673c8..8dd48d1d8d 100644 --- a/engines/lab/engine.cpp +++ b/engines/lab/engine.cpp @@ -34,6 +34,7 @@ #include "lab/diff.h" #include "lab/vga.h" #include "lab/text.h" +#include "lab/intro.h" #include "lab/parsefun.h" #include "lab/interface.h" #include "lab/mouse.h" @@ -1359,7 +1360,9 @@ void LabEngine::go() { mouseHide(); if (dointro && mem) { - introSequence(); + Intro intro; + + intro.introSequence(); } else DoBlack = true; diff --git a/engines/lab/intro.cpp b/engines/lab/intro.cpp index 16ed20b88a..c3a8321f67 100644 --- a/engines/lab/intro.cpp +++ b/engines/lab/intro.cpp @@ -29,7 +29,7 @@ */ #include "lab/lab.h" -#include "lab/stddefines.h" +#include "lab/intro.h" #include "lab/labfun.h" #include "lab/resource.h" #include "lab/diff.h" @@ -37,38 +37,36 @@ #include "lab/interface.h" namespace Lab { - -static TextFont filler, *msgfont = &filler; -static bool QuitIntro = false, IntroDoBlack; - extern bool nopalchange, DoBlack, IsHiRes; extern char diffcmap[256 * 3]; extern uint32 VGAScreenWidth, VGAScreenHeight; extern uint16 *FadePalette; +Intro::Intro() { + _msgfont = &_filler; + _quitIntro = false; +} /******************************************************************************/ /* Goes thru, and responds to all the intuition messages currently in the */ /* the message port. */ /******************************************************************************/ -void introEatMessages() { - IntuiMessage *Msg; - +void Intro::introEatMessages() { while (1) { - Msg = getMsg(); + IntuiMessage *msg = getMsg(); if (g_engine->shouldQuit()) { - QuitIntro = true; + _quitIntro = true; return; } - if (Msg == NULL) + if (msg == NULL) return; else { - if (((Msg->Class == MOUSEBUTTONS) && (IEQUALIFIER_RBUTTON & Msg->Qualifier)) || - ((Msg->Class == RAWKEY) && (Msg->Code == 27)) + if (((msg->Class == MOUSEBUTTONS) && (IEQUALIFIER_RBUTTON & msg->Qualifier)) || + ((msg->Class == RAWKEY) && (msg->Code == 27)) ) - QuitIntro = true; + _quitIntro = true; } } } @@ -79,18 +77,18 @@ void introEatMessages() { /*****************************************************************************/ /* Reads in a picture. */ /*****************************************************************************/ -static void doPictText(const char *Filename, bool isscreen) { +void Intro::doPictText(const char *filename, bool isscreen) { uint32 lastsecs = 0L, lastmicros = 0L, secs = 0L, micros = 0L; - IntuiMessage *Msg; - char filename[50] = "Lab:rooms/Intro/"; + IntuiMessage *msg; + char path[50] = "Lab:rooms/Intro/"; byte *curplace, **tfile; - bool DrawNextText = true, End = false, Begin = true; + bool drawNextText = true, end = false, begin = true; - int32 Class, Code, Drawn; - int16 Qualifier; + int32 cls, code, Drawn; + int16 qualifier; uint timedelay; - strcat(filename, Filename); + strcat(path, filename); if (isscreen) { g_music->updateMusic(); @@ -100,15 +98,15 @@ static void doPictText(const char *Filename, bool isscreen) { timedelay = 7; } - if (QuitIntro) + if (_quitIntro) return; while (1) { - if (DrawNextText) { - if (Begin) { - Begin = false; + if (drawNextText) { + if (begin) { + begin = false; - tfile = g_music->newOpen(filename); + tfile = g_music->newOpen(path); if (!tfile) return; @@ -121,7 +119,7 @@ static void doPictText(const char *Filename, bool isscreen) { setAPen(7L); rectFill(VGAScaleX(10), VGAScaleY(10), VGAScaleX(310), VGAScaleY(190)); - Drawn = flowText(msgfont, (!IsHiRes) * -1, 5, 7, false, false, true, true, VGAScaleX(14), VGAScaleY(11), VGAScaleX(306), VGAScaleY(189), (char *)curplace); + Drawn = flowText(_msgfont, (!IsHiRes) * -1, 5, 7, false, false, true, true, VGAScaleX(14), VGAScaleY(11), VGAScaleX(306), VGAScaleY(189), (char *)curplace); fade(true, 0); } else { Drawn = longDrawMessage((char *)curplace); @@ -129,12 +127,12 @@ static void doPictText(const char *Filename, bool isscreen) { curplace += Drawn; - End = (*curplace == 0); + end = (*curplace == 0); - DrawNextText = false; + drawNextText = false; introEatMessages(); - if (QuitIntro) { + if (_quitIntro) { if (isscreen) fade(false, 0); @@ -144,9 +142,9 @@ static void doPictText(const char *Filename, bool isscreen) { g_lab->getTime(&lastsecs, &lastmicros); } - Msg = getMsg(); + msg = getMsg(); - if (Msg == NULL) { + if (msg == NULL) { g_music->updateMusic(); diffNextFrame(); @@ -154,25 +152,25 @@ static void doPictText(const char *Filename, bool isscreen) { g_lab->anyTimeDiff(lastsecs, lastmicros, secs, micros, &secs, µs); if (secs > timedelay) { - if (End) { + if (end) { if (isscreen) fade(false, 0); return; } else { - DrawNextText = true; + drawNextText = true; } } waitTOF(); } else { - Class = Msg->Class; - Qualifier = Msg->Qualifier; - Code = Msg->Code; + cls = msg->Class; + qualifier = msg->Qualifier; + code = msg->Code; - if (((Class == MOUSEBUTTONS) && (IEQUALIFIER_RBUTTON & Qualifier)) || - ((Class == RAWKEY) && (Code == 27))) { - QuitIntro = true; + if (((cls == MOUSEBUTTONS) && (IEQUALIFIER_RBUTTON & qualifier)) || + ((cls == RAWKEY) && (code == 27))) { + _quitIntro = true; if (isscreen) fade(false, 0); @@ -180,20 +178,20 @@ static void doPictText(const char *Filename, bool isscreen) { return; } - else if (Class == MOUSEBUTTONS) { - if (IEQUALIFIER_LEFTBUTTON & Qualifier) { - if (End) { + else if (cls == MOUSEBUTTONS) { + if (IEQUALIFIER_LEFTBUTTON & qualifier) { + if (end) { if (isscreen) fade(false, 0); return; } else - DrawNextText = true; + drawNextText = true; } introEatMessages(); - if (QuitIntro) { + if (_quitIntro) { if (isscreen) fade(false, 0); @@ -201,13 +199,13 @@ static void doPictText(const char *Filename, bool isscreen) { } } - if (End) { + if (end) { if (isscreen) fade(false, 0); return; } else - DrawNextText = true; + drawNextText = true; } } } @@ -219,12 +217,12 @@ static void doPictText(const char *Filename, bool isscreen) { /*****************************************************************************/ /* Does a one second delay, but checks the music while doing it. */ /*****************************************************************************/ -void musicDelay() { +void Intro::musicDelay() { int16 counter; g_music->updateMusic(); - if (QuitIntro) + if (_quitIntro) return; for (counter = 0; counter < 20; counter++) { @@ -237,44 +235,47 @@ void musicDelay() { -static void NReadPict(const char *Filename, bool PlayOnce) { - Common::String finalFileName = Common::String("P:Intro/") + Filename; +void Intro::nReadPict(const char *filename, bool playOnce) { + Common::String finalFileName = Common::String("P:Intro/") + filename; g_music->updateMusic(); introEatMessages(); - if (QuitIntro) + if (_quitIntro) return; - DoBlack = IntroDoBlack; + DoBlack = _introDoBlack; stopDiffEnd(); - readPict(finalFileName.c_str(), PlayOnce); + readPict(finalFileName.c_str(), playOnce); } /*****************************************************************************/ /* Does the introduction sequence for Labyrinth. */ /*****************************************************************************/ -void introSequence() { +void Intro::introSequence() { uint16 counter, counter1; - uint16 Palette[16] = { - 0x0000, 0x0855, 0x0FF9, 0x0EE7, 0x0ED5, 0x0DB4, 0x0CA2, 0x0C91, 0x0B80, 0x0B80, 0x0B91, 0x0CA2, 0x0CB3, 0x0DC4, 0x0DD6, 0x0EE7 + uint16 palette[16] = { + 0x0000, 0x0855, 0x0FF9, 0x0EE7, + 0x0ED5, 0x0DB4, 0x0CA2, 0x0C91, + 0x0B80, 0x0B80, 0x0B91, 0x0CA2, + 0x0CB3, 0x0DC4, 0x0DD6, 0x0EE7 }; DoBlack = true; if (g_lab->getPlatform() != Common::kPlatformWindows) { - NReadPict("EA0", true); - NReadPict("EA1", true); - NReadPict("EA2", true); - NReadPict("EA3", true); + nReadPict("EA0", true); + nReadPict("EA1", true); + nReadPict("EA2", true); + nReadPict("EA3", true); } else { - NReadPict("WYRMKEEP", true); + nReadPict("WYRMKEEP", true); // Wait 4 seconds for (counter = 0; counter < 4 * 1000 / 10; counter++) { introEatMessages(); - if (QuitIntro) + if (_quitIntro) break; g_system->delayMillis(10); } @@ -286,18 +287,18 @@ void introSequence() { nopalchange = true; if (g_lab->getPlatform() != Common::kPlatformWindows) - NReadPict("TNDcycle.pic", true); + nReadPict("TNDcycle.pic", true); else - NReadPict("TNDcycle2.pic", true); + nReadPict("TNDcycle2.pic", true); nopalchange = false; - FadePalette = Palette; + FadePalette = palette; for (counter = 0; counter < 16; counter++) { - if (QuitIntro) + if (_quitIntro) break; - Palette[counter] = ((diffcmap[counter * 3] >> 2) << 8) + + palette[counter] = ((diffcmap[counter * 3] >> 2) << 8) + ((diffcmap[counter * 3 + 1] >> 2) << 4) + (diffcmap[counter * 3 + 2] >> 2); } @@ -306,18 +307,18 @@ void introSequence() { fade(true, 0); for (int times = 0; times < 150; times++) { - if (QuitIntro) + if (_quitIntro) break; g_music->updateMusic(); - uint16 temp = Palette[2]; + uint16 temp = palette[2]; for (counter = 2; counter < 15; counter++) - Palette[counter] = Palette[counter + 1]; + palette[counter] = palette[counter + 1]; - Palette[15] = temp; + palette[15] = temp; - setAmigaPal(Palette, 16); + setAmigaPal(palette, 16); waitTOF(); } @@ -326,24 +327,24 @@ void introSequence() { g_music->updateMusic(); - NReadPict("Title.A", true); - NReadPict("AB", true); + nReadPict("Title.A", true); + nReadPict("AB", true); musicDelay(); - NReadPict("BA", true); - NReadPict("AC", true); + nReadPict("BA", true); + nReadPict("AC", true); musicDelay(); if (g_lab->getPlatform() == Common::kPlatformWindows) musicDelay(); // more credits on this page now - NReadPict("CA", true); - NReadPict("AD", true); + nReadPict("CA", true); + nReadPict("AD", true); musicDelay(); if (g_lab->getPlatform() == Common::kPlatformWindows) musicDelay(); // more credits on this page now - NReadPict("DA", true); + nReadPict("DA", true); musicDelay(); g_music->newOpen("p:Intro/Intro.1"); /* load the picture into the buffer */ @@ -352,14 +353,14 @@ void introSequence() { blackAllScreen(); g_music->updateMusic(); - msgfont = g_resource->getFont("P:Map.fon"); + _msgfont = g_resource->getFont("P:Map.fon"); nopalchange = true; - NReadPict("Intro.1", true); + nReadPict("Intro.1", true); nopalchange = false; for (counter = 0; counter < 16; counter++) { - Palette[counter] = ((diffcmap[counter * 3] >> 2) << 8) + + palette[counter] = ((diffcmap[counter * 3] >> 2) << 8) + ((diffcmap[counter * 3 + 1] >> 2) << 4) + (diffcmap[counter * 3 + 2] >> 2); } @@ -373,32 +374,32 @@ void introSequence() { blackAllScreen(); g_music->updateMusic(); - IntroDoBlack = true; - NReadPict("Station1", true); + _introDoBlack = true; + nReadPict("Station1", true); doPictText("i.3", false); - NReadPict("Station2", true); + nReadPict("Station2", true); doPictText("i.4", false); - NReadPict("Stiles4", true); + nReadPict("Stiles4", true); doPictText("i.5", false); - NReadPict("Stiles3", true); + nReadPict("Stiles3", true); doPictText("i.6", false); - NReadPict("Platform2", true); + nReadPict("Platform2", true); doPictText("i.7", false); - NReadPict("Subway.1", true); + nReadPict("Subway.1", true); doPictText("i.8", false); - NReadPict("Subway.2", true); + nReadPict("Subway.2", true); doPictText("i.9", false); doPictText("i.10", false); doPictText("i.11", false); - if (!QuitIntro) + if (!_quitIntro) for (counter = 0; counter < 50; counter++) { for (counter1 = (8 * 3); counter1 < (255 * 3); counter1++) diffcmap[counter1] = 255 - diffcmap[counter1]; @@ -413,57 +414,57 @@ void introSequence() { doPictText("i.12", false); doPictText("i.13", false); - IntroDoBlack = false; - NReadPict("Daed0", true); + _introDoBlack = false; + nReadPict("Daed0", true); doPictText("i.14", false); - NReadPict("Daed1", true); + nReadPict("Daed1", true); doPictText("i.15", false); - NReadPict("Daed2", true); + nReadPict("Daed2", true); doPictText("i.16", false); doPictText("i.17", false); doPictText("i.18", false); - NReadPict("Daed3", true); + nReadPict("Daed3", true); doPictText("i.19", false); doPictText("i.20", false); - NReadPict("Daed4", true); + nReadPict("Daed4", true); doPictText("i.21", false); - NReadPict("Daed5", true); + nReadPict("Daed5", true); doPictText("i.22", false); doPictText("i.23", false); doPictText("i.24", false); - NReadPict("Daed6", true); + nReadPict("Daed6", true); doPictText("i.25", false); doPictText("i.26", false); - NReadPict("Daed7", false); + nReadPict("Daed7", false); doPictText("i.27", false); doPictText("i.28", false); stopDiffEnd(); - NReadPict("Daed8", true); + nReadPict("Daed8", true); doPictText("i.29", false); doPictText("i.30", false); - NReadPict("Daed9", true); + nReadPict("Daed9", true); doPictText("i.31", false); doPictText("i.32", false); doPictText("i.33", false); - NReadPict("Daed9a", true); - NReadPict("Daed10", true); + nReadPict("Daed9a", true); + nReadPict("Daed10", true); doPictText("i.34", false); doPictText("i.35", false); doPictText("i.36", false); - NReadPict("SubX", true); + nReadPict("SubX", true); - if (QuitIntro) { + if (_quitIntro) { setAPen(0); rectFill(0, 0, VGAScreenWidth - 1, VGAScreenHeight - 1); DoBlack = true; diff --git a/engines/lab/labfun.h b/engines/lab/labfun.h index c9fa307a84..5fac2e1157 100644 --- a/engines/lab/labfun.h +++ b/engines/lab/labfun.h @@ -117,12 +117,6 @@ void flipViews(void *scrPtr); Gadget *addGadButton(uint16 x, uint16 y, void *UpImage, void *DownImage, uint16 id); void gadgetsOnOff(void *gptr, void *win, int32 num, bool on); -/*----------------------*/ -/*---- From Intro.c ----*/ -/*----------------------*/ - -void introSequence(); - /*----------------------*/ /*----- From Lab.c -----*/ /*----------------------*/ -- cgit v1.2.3 From 158f623db8778ae8511bd94b7f5c6989230d4da5 Mon Sep 17 00:00:00 2001 From: Eugene Sandulenko Date: Fri, 20 Nov 2015 20:26:00 +0100 Subject: LAB: Rename IntuiMessage struct members --- engines/lab/engine.cpp | 20 ++++++++++---------- engines/lab/interface.cpp | 34 +++++++++++++++++----------------- engines/lab/interface.h | 7 +++---- engines/lab/intro.cpp | 10 +++++----- engines/lab/map.cpp | 12 ++++++------ engines/lab/special.cpp | 18 +++++++++--------- 6 files changed, 50 insertions(+), 51 deletions(-) diff --git a/engines/lab/engine.cpp b/engines/lab/engine.cpp index 8dd48d1d8d..c706dca110 100644 --- a/engines/lab/engine.cpp +++ b/engines/lab/engine.cpp @@ -797,12 +797,12 @@ static void mainGameLoop() { } else { GotMessage = true; - Class = Msg->Class; - Code = Msg->Code; - Qualifier = Msg->Qualifier; - MouseX = Msg->MouseX; - MouseY = Msg->MouseY; - GadID = Msg->GadgetID; + Class = Msg->msgClass; + Code = Msg->code; + Qualifier = Msg->qualifier; + MouseX = Msg->mouseX; + MouseY = Msg->mouseY; + GadID = Msg->gadgetID; FollowingCrumbs = false; @@ -868,14 +868,14 @@ from_crumbs: g_music->updateMusic(); diffNextFrame(); } else { - if (Msg->Class == RAWKEY) { - if ((Msg->Code == 'Y') || (Msg->Code == 'y') || (Msg->Code == 'Q') || (Msg->Code == 'q')) { + if (Msg->msgClass == RAWKEY) { + if ((Msg->code == 'Y') || (Msg->code == 'y') || (Msg->code == 'Q') || (Msg->code == 'q')) { doit = true; break; - } else if (Msg->Code < 128) { + } else if (Msg->code < 128) { break; } - } else if (Msg->Class == MOUSEBUTTONS) { + } else if (Msg->msgClass == MOUSEBUTTONS) { break; } } diff --git a/engines/lab/interface.cpp b/engines/lab/interface.cpp index 8d05e4174d..1cd017d434 100644 --- a/engines/lab/interface.cpp +++ b/engines/lab/interface.cpp @@ -177,30 +177,30 @@ IntuiMessage *getMsg() { if ((curgad = mouseGadget()) != NULL) { updateMouse(); - IMessage.Class = GADGETUP; - IMessage.Code = curgad->GadgetID; - IMessage.GadgetID = curgad->GadgetID; - IMessage.Qualifier = Qualifiers; + IMessage.msgClass = GADGETUP; + IMessage.code = curgad->GadgetID; + IMessage.gadgetID = curgad->GadgetID; + IMessage.qualifier = Qualifiers; return &IMessage; - } else if (mouseButton(&IMessage.MouseX, &IMessage.MouseY, true)) { /* Left Button */ - IMessage.Qualifier = IEQUALIFIER_LEFTBUTTON | Qualifiers; - IMessage.Class = MOUSEBUTTONS; + } else if (mouseButton(&IMessage.mouseX, &IMessage.mouseY, true)) { /* Left Button */ + IMessage.qualifier = IEQUALIFIER_LEFTBUTTON | Qualifiers; + IMessage.msgClass = MOUSEBUTTONS; return &IMessage; - } else if (mouseButton(&IMessage.MouseX, &IMessage.MouseY, false)) { /* Right Button */ - IMessage.Qualifier = IEQUALIFIER_RBUTTON | Qualifiers; - IMessage.Class = MOUSEBUTTONS; + } else if (mouseButton(&IMessage.mouseX, &IMessage.mouseY, false)) { /* Right Button */ + IMessage.qualifier = IEQUALIFIER_RBUTTON | Qualifiers; + IMessage.msgClass = MOUSEBUTTONS; return &IMessage; - } else if (keyPress(&IMessage.Code)) { /* Keyboard key */ - curgad = checkNumGadgetHit(ScreenGadgetList, IMessage.Code); + } else if (keyPress(&IMessage.code)) { /* Keyboard key */ + curgad = checkNumGadgetHit(ScreenGadgetList, IMessage.code); if (curgad) { - IMessage.Class = GADGETUP; - IMessage.Code = curgad->GadgetID; - IMessage.GadgetID = curgad->GadgetID; + IMessage.msgClass = GADGETUP; + IMessage.code = curgad->GadgetID; + IMessage.gadgetID = curgad->GadgetID; } else - IMessage.Class = RAWKEY; + IMessage.msgClass = RAWKEY; - IMessage.Qualifier = Qualifiers; + IMessage.qualifier = Qualifiers; return &IMessage; } else return NULL; diff --git a/engines/lab/interface.h b/engines/lab/interface.h index ea110f4015..84df28c767 100644 --- a/engines/lab/interface.h +++ b/engines/lab/interface.h @@ -37,9 +37,9 @@ namespace Lab { struct IntuiMessage { - uint32 Class; - uint16 Code, Qualifier, MouseX, MouseY, GadgetID; - uint32 Seconds, Micros; + uint32 msgClass; + uint16 code, qualifier, mouseX, mouseY, gadgetID; + uint32 seconds, micros; }; @@ -121,4 +121,3 @@ IntuiMessage *getMsg(); } // End of namespace Lab #endif /* LAB_INTEFACE_H */ - diff --git a/engines/lab/intro.cpp b/engines/lab/intro.cpp index c3a8321f67..eacfd12843 100644 --- a/engines/lab/intro.cpp +++ b/engines/lab/intro.cpp @@ -63,8 +63,8 @@ void Intro::introEatMessages() { if (msg == NULL) return; else { - if (((msg->Class == MOUSEBUTTONS) && (IEQUALIFIER_RBUTTON & msg->Qualifier)) || - ((msg->Class == RAWKEY) && (msg->Code == 27)) + if (((msg->msgClass == MOUSEBUTTONS) && (IEQUALIFIER_RBUTTON & msg->qualifier)) || + ((msg->msgClass == RAWKEY) && (msg->code == 27)) ) _quitIntro = true; } @@ -164,9 +164,9 @@ void Intro::doPictText(const char *filename, bool isscreen) { waitTOF(); } else { - cls = msg->Class; - qualifier = msg->Qualifier; - code = msg->Code; + cls = msg->msgClass; + qualifier = msg->qualifier; + code = msg->code; if (((cls == MOUSEBUTTONS) && (IEQUALIFIER_RBUTTON & qualifier)) || ((cls == RAWKEY) && (code == 27))) { diff --git a/engines/lab/map.cpp b/engines/lab/map.cpp index a096d28326..f373fb8d9d 100644 --- a/engines/lab/map.cpp +++ b/engines/lab/map.cpp @@ -725,12 +725,12 @@ void processMap(uint16 CurRoom) { place = 1; } else { - Class = Msg->Class; - Code = Msg->Code; - GadgetID = Msg->GadgetID; - Qualifier = Msg->Qualifier; - MouseX = Msg->MouseX; - MouseY = Msg->MouseY; + Class = Msg->msgClass; + Code = Msg->code; + GadgetID = Msg->gadgetID; + Qualifier = Msg->qualifier; + MouseX = Msg->mouseX; + MouseY = Msg->mouseY; if (((Class == MOUSEBUTTONS) && (IEQUALIFIER_RBUTTON & Qualifier)) || ((Class == RAWKEY) && (Code == 27))) diff --git a/engines/lab/special.cpp b/engines/lab/special.cpp index 377f8dbece..9d9ccc7241 100644 --- a/engines/lab/special.cpp +++ b/engines/lab/special.cpp @@ -745,14 +745,14 @@ static void processJournal() { while (1) { g_music->updateMusic(); /* Make sure we check the music at least after every message */ - Msg = (IntuiMessage *) getMsg(); + Msg = (IntuiMessage *)getMsg(); if (Msg == NULL) { g_music->updateMusic(); } else { - Class = Msg->Class; - Qualifier = Msg->Qualifier; - GadID = Msg->Code; + Class = Msg->msgClass; + Qualifier = Msg->qualifier; + GadID = Msg->code; if (((Class == MOUSEBUTTONS) && (IEQUALIFIER_RBUTTON & Qualifier)) || ((Class == RAWKEY) && (GadID == 27))) @@ -978,11 +978,11 @@ static void processMonitor(char *ntext, bool isinteractive, uint16 x1, uint16 y1 if (Msg == NULL) { g_music->updateMusic(); } else { - Class = Msg->Class; - Qualifier = Msg->Qualifier; - MouseX = Msg->MouseX; - MouseY = Msg->MouseY; - Code = Msg->Code; + Class = Msg->msgClass; + Qualifier = Msg->qualifier; + MouseX = Msg->mouseX; + MouseY = Msg->mouseY; + Code = Msg->code; if (((Class == MOUSEBUTTONS) && (IEQUALIFIER_RBUTTON & Qualifier)) || ((Class == RAWKEY) && (Code == 27))) -- cgit v1.2.3 From c187a3bda9da38080ebd1bfc7401f84e62db0858 Mon Sep 17 00:00:00 2001 From: Eugene Sandulenko Date: Fri, 20 Nov 2015 20:29:55 +0100 Subject: LAB: Add intro.h --- engines/lab/intro.h | 56 +++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 56 insertions(+) create mode 100644 engines/lab/intro.h diff --git a/engines/lab/intro.h b/engines/lab/intro.h new file mode 100644 index 0000000000..724fedaa7e --- /dev/null +++ b/engines/lab/intro.h @@ -0,0 +1,56 @@ +/* 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. + * + */ + + /* + * This code is based on Labyrinth of Time code with assistance of + * + * Copyright (c) 1993 Terra Nova Development + * Copyright (c) 2004 The Wyrmkeep Entertainment Co. + * + */ + +#ifndef LAB_INTRO_H +#define LAB_INTRO_H + +#include "lab/intro.h" +#include "lab/text.h" + +namespace Lab { + +class Intro { +public: + Intro(); + void introSequence(); + +private: + void introEatMessages(); + void doPictText(const char *Filename, bool isscreen); + void musicDelay(); + void nReadPict(const char *Filename, bool PlayOnce); + + TextFont _filler, *_msgfont; + bool _quitIntro, _introDoBlack; +}; + +} // End of namespace Lab + +#endif // LAB_INTRO_H -- cgit v1.2.3 From f56f2effb419533b7652d7a2152b832e29ebea09 Mon Sep 17 00:00:00 2001 From: Eugene Sandulenko Date: Mon, 23 Nov 2015 17:34:02 +0100 Subject: LAB: Started vga code refactoring --- engines/lab/graphics.cpp | 45 ++++++++++---------- engines/lab/intro.cpp | 3 +- engines/lab/lab.cpp | 6 ++- engines/lab/lab.h | 5 +++ engines/lab/map.cpp | 5 +-- engines/lab/readdiff.cpp | 1 - engines/lab/special.cpp | 31 +++++++------- engines/lab/text.cpp | 25 ++++++----- engines/lab/vga.cpp | 107 +++++++++++++++++++++++------------------------ 9 files changed, 113 insertions(+), 115 deletions(-) diff --git a/engines/lab/graphics.cpp b/engines/lab/graphics.cpp index 7bd2af41d7..40b9aa1031 100644 --- a/engines/lab/graphics.cpp +++ b/engines/lab/graphics.cpp @@ -62,8 +62,6 @@ extern const char *CurFileName; /*---------------------------------------------------------------------------*/ -extern uint32 VGAScreenWidth, VGAScreenHeight, VGABytesPerPage; - /*****************************************************************************/ /* Reads in a picture into the dest bitmap. */ /*****************************************************************************/ @@ -81,8 +79,8 @@ bool readPict(const char *filename, bool PlayOnce) { return false; } - DispBitMap->BytesPerRow = VGAScreenWidth; - DispBitMap->Rows = VGAScreenHeight; + DispBitMap->BytesPerRow = g_lab->_screenWidth; + DispBitMap->Rows = g_lab->_screenHeight; DispBitMap->Flags = BITMAPF_VIDEO; readDiff(PlayOnce); @@ -292,7 +290,6 @@ uint32 flowText(void *font, /* the TextAttr pointer */ } -extern uint32 VGABytesPerPage; extern byte *VGABASEADDRESS; @@ -309,15 +306,15 @@ uint32 flowTextToMem(Image *DestIm, void *font, /* the TextAttr pointer */ bool output, /* Whether to output any text */ uint16 x1, /* Cords */ uint16 y1, uint16 x2, uint16 y2, const char *str) { /* The text itself */ - uint32 res, vgabyte = VGABytesPerPage; + uint32 res, vgabyte = g_lab->_screenBytesPerPage; byte *tmp = VGABASEADDRESS; VGABASEADDRESS = DestIm->ImageData; - VGABytesPerPage = (uint32) DestIm->Width * (int32) DestIm->Height; + g_lab->_screenBytesPerPage = (uint32) DestIm->Width * (int32) DestIm->Height; res = flowText(font, spacing, pencolor, backpen, fillback, centerh, centerv, output, x1, y1, x2, y2, str); - VGABytesPerPage = vgabyte; + g_lab->_screenBytesPerPage = vgabyte; VGABASEADDRESS = tmp; return res; @@ -462,8 +459,8 @@ static void doScrollBlack() { tempmem = mem; while (size) { - if (size > VGABytesPerPage) - copysize = VGABytesPerPage; + if (size > g_lab->_screenBytesPerPage) + copysize = g_lab->_screenBytesPerPage; else copysize = size; @@ -510,12 +507,12 @@ static void copyPage(uint16 width, uint16 height, uint16 nheight, uint16 startli size = (int32)(height - nheight) * (int32) width; mem += startline * width; - CurPage = ((int32) nheight * (int32) width) / VGABytesPerPage; - OffSet = ((int32) nheight * (int32) width) - (CurPage * VGABytesPerPage); + CurPage = ((int32) nheight * (int32) width) / g_lab->_screenBytesPerPage; + OffSet = ((int32) nheight * (int32) width) - (CurPage * g_lab->_screenBytesPerPage); while (size) { - if (size > (VGABytesPerPage - OffSet)) - copysize = VGABytesPerPage - OffSet; + if (size > (g_lab->_screenBytesPerPage - OffSet)) + copysize = g_lab->_screenBytesPerPage - OffSet; else copysize = size; @@ -665,7 +662,7 @@ static void doTransWipe(CloseDataPtr *CPtr, char *filename) { linesdone = 0; } - ghoastRect(0, 0, CurY, VGAScreenWidth - 1, CurY + 1); + ghoastRect(0, 0, CurY, g_lab->_screenWidth - 1, CurY + 1); CurY += 4; linesdone++; } @@ -683,7 +680,7 @@ static void doTransWipe(CloseDataPtr *CPtr, char *filename) { linesdone = 0; } - rectFill(0, CurY, VGAScreenWidth - 1, CurY + 1); + rectFill(0, CurY, g_lab->_screenWidth - 1, CurY + 1); CurY += 4; linesdone++; } @@ -696,16 +693,16 @@ static void doTransWipe(CloseDataPtr *CPtr, char *filename) { else CurFileName = getPictName(CPtr); - byte *BitMapMem = readPictToMem(CurFileName, VGAScreenWidth, LastY + 5); + byte *BitMapMem = readPictToMem(CurFileName, g_lab->_screenWidth, LastY + 5); VGASetPal(diffcmap, 256); if (BitMapMem) { - ImSource.Width = VGAScreenWidth; + ImSource.Width = g_lab->_screenWidth; ImSource.Height = LastY; ImSource.ImageData = BitMapMem; - ImDest.Width = VGAScreenWidth; - ImDest.Height = VGAScreenHeight; + ImDest.Width = g_lab->_screenWidth; + ImDest.Height = g_lab->_screenHeight; ImDest.ImageData = getVGABaseAddr(); for (counter = 0; counter < 2; counter++) { @@ -720,8 +717,8 @@ static void doTransWipe(CloseDataPtr *CPtr, char *filename) { ImDest.ImageData = getVGABaseAddr(); - bltBitMap(&ImSource, 0, CurY, &ImDest, 0, CurY, VGAScreenWidth, 2); - ghoastRect(0, 0, CurY, VGAScreenWidth - 1, CurY + 1); + bltBitMap(&ImSource, 0, CurY, &ImDest, 0, CurY, g_lab->_screenWidth, 2); + ghoastRect(0, 0, CurY, g_lab->_screenWidth - 1, CurY + 1); CurY += 4; linesdone++; } @@ -740,9 +737,9 @@ static void doTransWipe(CloseDataPtr *CPtr, char *filename) { ImDest.ImageData = getVGABaseAddr(); if (CurY == LastY) - bltBitMap(&ImSource, 0, CurY, &ImDest, 0, CurY, VGAScreenWidth, 1); + bltBitMap(&ImSource, 0, CurY, &ImDest, 0, CurY, g_lab->_screenWidth, 1); else - bltBitMap(&ImSource, 0, CurY, &ImDest, 0, CurY, VGAScreenWidth, 2); + bltBitMap(&ImSource, 0, CurY, &ImDest, 0, CurY, g_lab->_screenWidth, 2); CurY += 4; linesdone++; diff --git a/engines/lab/intro.cpp b/engines/lab/intro.cpp index eacfd12843..85c64c44b6 100644 --- a/engines/lab/intro.cpp +++ b/engines/lab/intro.cpp @@ -39,7 +39,6 @@ namespace Lab { extern bool nopalchange, DoBlack, IsHiRes; extern char diffcmap[256 * 3]; -extern uint32 VGAScreenWidth, VGAScreenHeight; extern uint16 *FadePalette; Intro::Intro() { @@ -466,7 +465,7 @@ void Intro::introSequence() { if (_quitIntro) { setAPen(0); - rectFill(0, 0, VGAScreenWidth - 1, VGAScreenHeight - 1); + rectFill(0, 0, g_lab->_screenWidth - 1, g_lab->_screenHeight - 1); DoBlack = true; } } diff --git a/engines/lab/lab.cpp b/engines/lab/lab.cpp index c13f5cde9e..c6f8006a55 100644 --- a/engines/lab/lab.cpp +++ b/engines/lab/lab.cpp @@ -55,6 +55,10 @@ LabEngine::LabEngine(OSystem *syst, const ADGameDescription *gameDesc) : Engine(syst), _gameDescription(gameDesc), _extraGameFeatures(0) { g_lab = this; + _screenWidth = 320; + _screenHeight = 200; + _screenBytesPerPage = 65536; + //const Common::FSNode gameDataDir(ConfMan.get("path")); //SearchMan.addSubDirectoryMatching(gameDataDir, "game"); //SearchMan.addSubDirectoryMatching(gameDataDir, "game/pict"); @@ -100,7 +104,7 @@ Common::Error LabEngine::run() { } else { knownVersion = false; } - + roomFile.close(); if (!knownVersion) { diff --git a/engines/lab/lab.h b/engines/lab/lab.h index 989def2e1c..e9d27aea39 100644 --- a/engines/lab/lab.h +++ b/engines/lab/lab.h @@ -66,6 +66,11 @@ public: LargeSet *_conditions, *_roomsFound; + int _screenWidth; + int _screenHeight; + int _screenBytesPerPage; + + // timing.cpp void getTime(uint32 *secs, uint32 *micros); void addCurTime(uint32 sec, uint32 micros, uint32 *timeSec, uint32 *timeMicros); diff --git a/engines/lab/map.cpp b/engines/lab/map.cpp index f373fb8d9d..4ad9ba2511 100644 --- a/engines/lab/map.cpp +++ b/engines/lab/map.cpp @@ -49,7 +49,6 @@ static TextFont bmf; extern uint16 Direction; extern bool IsHiRes; -extern uint32 VGAScreenWidth, VGAScreenHeight; extern CloseDataPtr CPtr; extern uint16 RoomNum; @@ -584,7 +583,7 @@ static void drawMap(uint16 CurRoom, uint16 CurMsg, uint16 Floor, bool fadeout, b fade(false, 0); setAPen(0); - rectFill(0, 0, VGAScreenWidth - 1, VGAScreenHeight - 1); + rectFill(0, 0, g_lab->_screenWidth - 1, g_lab->_screenHeight - 1); drawImage(Map, 0, 0); drawGadgetList(MapGadgetList); @@ -880,7 +879,7 @@ void doMap(uint16 CurRoom) { blackAllScreen(); mouseHide(); setAPen(0); - rectFill(0, 0, VGAScreenWidth - 1, VGAScreenHeight - 1); + rectFill(0, 0, g_lab->_screenWidth - 1, g_lab->_screenHeight - 1); freeMapData(); blackAllScreen(); mouseShow(); diff --git a/engines/lab/readdiff.cpp b/engines/lab/readdiff.cpp index 727a3394a2..421c2ce1ad 100644 --- a/engines/lab/readdiff.cpp +++ b/engines/lab/readdiff.cpp @@ -64,7 +64,6 @@ char diffcmap[256 * 3]; BitMap RawDiffBM; extern BitMap *DispBitMap, *DrawBitMap; -extern uint32 VGABytesPerPage; extern byte **startoffile; #define CONTINUOUS 0xFFFF diff --git a/engines/lab/special.cpp b/engines/lab/special.cpp index 9d9ccc7241..41d938bdb8 100644 --- a/engines/lab/special.cpp +++ b/engines/lab/special.cpp @@ -89,7 +89,6 @@ extern uint16 *FadePalette; extern bool nopalchange, DoBlack, IsHiRes; extern BitMap *DispBitMap, *DrawBitMap; extern char diffcmap[3 * 256]; -extern uint32 VGAScreenWidth, VGAScreenHeight; extern byte *TempScrollData; extern CloseDataPtr CPtr; extern InventoryData *Inventory; @@ -120,7 +119,7 @@ static byte *loadBackPict(const char *fileName, bool tomem) { nopalchange = true; if (tomem) - res = readPictToMem(fileName, VGAScreenWidth, VGAScreenHeight); + res = readPictToMem(fileName, g_lab->_screenWidth, g_lab->_screenHeight); else readPict(fileName, true); @@ -190,8 +189,8 @@ static void changeCombination(uint16 number) { combnum = combination[number]; display.ImageData = getVGABaseAddr(); - display.Width = VGAScreenWidth; - display.Height = VGAScreenHeight; + display.Width = g_lab->_screenWidth; + display.Height = g_lab->_screenHeight; for (counter = 1; counter <= (Images[combnum]->Height / 2); counter++) { if (IsHiRes) { @@ -674,18 +673,18 @@ static void turnPage(bool FromLeft) { uint16 counter; if (FromLeft) { - for (counter = 0; counter < VGAScreenWidth; counter += 8) { + for (counter = 0; counter < g_lab->_screenWidth; counter += 8) { g_music->updateMusic(); waitTOF(); ScreenImage.ImageData = getVGABaseAddr(); - bltBitMap(&JBackImage, counter, 0, &ScreenImage, counter, 0, 8, VGAScreenHeight); + bltBitMap(&JBackImage, counter, 0, &ScreenImage, counter, 0, 8, g_lab->_screenHeight); } } else { - for (counter = (VGAScreenWidth - 8); counter > 0; counter -= 8) { + for (counter = (g_lab->_screenWidth - 8); counter > 0; counter -= 8) { g_music->updateMusic(); waitTOF(); ScreenImage.ImageData = getVGABaseAddr(); - bltBitMap(&JBackImage, counter, 0, &ScreenImage, counter, 0, 8, VGAScreenHeight); + bltBitMap(&JBackImage, counter, 0, &ScreenImage, counter, 0, 8, g_lab->_screenHeight); } } } @@ -707,7 +706,7 @@ static void drawJournal(uint16 wipenum, bool needFade) { ScreenImage.ImageData = getVGABaseAddr(); if (wipenum == 0) - bltBitMap(&JBackImage, 0, 0, &ScreenImage, 0, 0, VGAScreenWidth, VGAScreenHeight); + bltBitMap(&JBackImage, 0, 0, &ScreenImage, 0, 0, g_lab->_screenWidth, g_lab->_screenHeight); else turnPage((bool)(wipenum == 1)); @@ -726,7 +725,7 @@ static void drawJournal(uint16 wipenum, bool needFade) { fade(true, 0); nopalchange = true; - JBackImage.ImageData = readPictToMem("P:Journal.pic", VGAScreenWidth, VGAScreenHeight); + JBackImage.ImageData = readPictToMem("P:Journal.pic", g_lab->_screenWidth, g_lab->_screenHeight); GotBackImage = true; eatMessages(); @@ -787,8 +786,8 @@ void doJournal() { lastpage = false; GotBackImage = false; - JBackImage.Width = VGAScreenWidth; - JBackImage.Height = VGAScreenHeight; + JBackImage.Width = g_lab->_screenWidth; + JBackImage.Height = g_lab->_screenHeight; JBackImage.ImageData = NULL; BackG.NextGadget = &CancelG; @@ -812,7 +811,7 @@ void doJournal() { ScreenImage.ImageData = getVGABaseAddr(); setAPen(0); - rectFill(0, 0, VGAScreenWidth - 1, VGAScreenHeight - 1); + rectFill(0, 0, g_lab->_screenWidth - 1, g_lab->_screenHeight - 1); blackScreen(); freeAllStolenMem(); @@ -905,13 +904,13 @@ static void drawMonText(char *text, uint16 x1, uint16 y1, uint16 x2, uint16 y2, MonGadHeight = fheight; setAPen(0); - rectFill(0, 0, VGAScreenWidth - 1, y2); + rectFill(0, 0, g_lab->_screenWidth - 1, y2); for (counter = 0; counter < numlines; counter++) drawImage(MonButton, 0, counter * MonGadHeight); } else if (isinteractive) { setAPen(0); - rectFill(0, 0, VGAScreenWidth - 1, y2); + rectFill(0, 0, g_lab->_screenWidth - 1, y2); } else { setAPen(0); rectFill(x1, y1, x2, y2); @@ -1085,7 +1084,7 @@ void doMonitor(char *background, char *textfile, bool isinteractive, uint16 x1, freeAllStolenMem(); setAPen(0); - rectFill(0, 0, VGAScreenWidth - 1, VGAScreenHeight - 1); + rectFill(0, 0, g_lab->_screenWidth - 1, g_lab->_screenHeight - 1); blackAllScreen(); } diff --git a/engines/lab/text.cpp b/engines/lab/text.cpp index c89cec389a..36b0116314 100644 --- a/engines/lab/text.cpp +++ b/engines/lab/text.cpp @@ -28,6 +28,7 @@ * */ +#include "lab/lab.h" #include "lab/stddefines.h" #include "lab/labfun.h" #include "lab/text.h" @@ -35,8 +36,6 @@ namespace Lab { -extern uint32 VGAScreenWidth, VGABytesPerPage; - /*****************************************************************************/ /* Closes a font and frees all memory associated with it. */ /*****************************************************************************/ @@ -85,10 +84,10 @@ void text(struct TextFont *tf, uint16 x, uint16 y, uint16 color, const char *tex VGATop = getVGABaseAddr(); for (counter = 0; counter < numchars; counter++) { - RealOffset = (VGAScreenWidth * y) + x; - curpage = RealOffset / VGABytesPerPage; - SegmentOffset = RealOffset - (curpage * VGABytesPerPage); - LeftInSegment = VGABytesPerPage - SegmentOffset; + RealOffset = (g_lab->_screenWidth * y) + x; + curpage = RealOffset / g_lab->_screenBytesPerPage; + SegmentOffset = RealOffset - (curpage * g_lab->_screenBytesPerPage); + LeftInSegment = g_lab->_screenBytesPerPage - SegmentOffset; VGACur = VGATop + SegmentOffset; if (tf->Widths[(uint)*text]) { @@ -121,10 +120,10 @@ void text(struct TextFont *tf, uint16 x, uint16 y, uint16 color, const char *tex curpage++; VGATemp = (byte *)(VGATop - templeft); /* Set up VGATempLine for next line */ - VGATempLine -= VGABytesPerPage; + VGATempLine -= g_lab->_screenBytesPerPage; /* Set up LeftInSegment for next line */ - LeftInSegment += VGABytesPerPage + templeft; - templeft += VGABytesPerPage; + LeftInSegment += g_lab->_screenBytesPerPage + templeft; + templeft += g_lab->_screenBytesPerPage; } if (mask & data) @@ -141,13 +140,13 @@ void text(struct TextFont *tf, uint16 x, uint16 y, uint16 color, const char *tex } } - VGATempLine += VGAScreenWidth; - LeftInSegment -= VGAScreenWidth; + VGATempLine += g_lab->_screenWidth; + LeftInSegment -= g_lab->_screenWidth; if (LeftInSegment <= 0) { curpage++; - VGATempLine -= VGABytesPerPage; - LeftInSegment += VGABytesPerPage; + VGATempLine -= g_lab->_screenBytesPerPage; + LeftInSegment += g_lab->_screenBytesPerPage; } } } diff --git a/engines/lab/vga.cpp b/engines/lab/vga.cpp index 013b6ee9a6..5e1a1e828a 100644 --- a/engines/lab/vga.cpp +++ b/engines/lab/vga.cpp @@ -28,6 +28,7 @@ * */ +#include "lab/lab.h" #include "lab/vga.h" #include "lab/stddefines.h" #include "lab/mouse.h" @@ -38,12 +39,8 @@ namespace Lab { -static byte curvgapal[256 * 3]; -static unsigned char curapen = 0; - -uint32 VGAScreenWidth = 320UL, - VGAScreenHeight = 200UL, - VGABytesPerPage = 65536UL; +static byte _curvgapal[256 * 3]; +static unsigned char _curapen = 0; byte *VGABASEADDRESS = 0; @@ -71,16 +68,16 @@ bool createScreen(bool HiRes) { VGABASEADDRESS = 0; if (HiRes) { - VGAScreenWidth = 640; - VGAScreenHeight = 480; + g_lab->_screenWidth = 640; + g_lab->_screenHeight = 480; } else { - VGAScreenWidth = 320; - VGAScreenHeight = 200; + g_lab->_screenWidth = 320; + g_lab->_screenHeight = 200; } - VGABytesPerPage = VGAScreenWidth * VGAScreenHeight; + g_lab->_screenBytesPerPage = g_lab->_screenWidth * g_lab->_screenHeight; - g_DisplayBuffer = (byte *)malloc(VGABytesPerPage); - g_Pixels = (byte *)calloc(VGABytesPerPage, 4); + g_DisplayBuffer = (byte *)malloc(g_lab->_screenBytesPerPage); + g_Pixels = (byte *)calloc(g_lab->_screenBytesPerPage, 4); return true; } @@ -138,8 +135,8 @@ void WSDL_ProcessInput(bool can_delay) { g_MouseX = 0; g_MouseAtEdge = true; } - if (g_MouseX > VGAScreenWidth - 1) { - g_MouseX = VGAScreenWidth; + if (g_MouseX > g_lab->_screenWidth - 1) { + g_MouseX = g_lab->_screenWidth; g_MouseAtEdge = true; } @@ -148,8 +145,8 @@ void WSDL_ProcessInput(bool can_delay) { g_MouseY = 0; g_MouseAtEdge = true; } - if (g_MouseY > VGAScreenHeight - 1) { - g_MouseY = VGAScreenHeight; + if (g_MouseY > g_lab->_screenHeight - 1) { + g_MouseY = g_lab->_screenHeight; g_MouseAtEdge = true; } @@ -188,7 +185,7 @@ void WSDL_ProcessInput(bool can_delay) { break; } - g_system->copyRectToScreen(g_DisplayBuffer, VGAScreenWidth, 0, 0, VGAScreenWidth, VGAScreenHeight); + g_system->copyRectToScreen(g_DisplayBuffer, g_lab->_screenWidth, 0, 0, g_lab->_screenWidth, g_lab->_screenHeight); g_system->updateScreen(); } } @@ -208,7 +205,7 @@ void waitTOF() { int untilOutOfRefresh = 1; if (g_ScreenWasLocked || untilOutOfRefresh) { - g_system->copyRectToScreen(g_DisplayBuffer, VGAScreenWidth, 0, 0, VGAScreenWidth, VGAScreenHeight); + g_system->copyRectToScreen(g_DisplayBuffer, g_lab->_screenWidth, 0, 0, g_lab->_screenWidth, g_lab->_screenHeight); g_system->updateScreen(); } @@ -249,12 +246,12 @@ void WSDL_SetColors(byte *buf, uint16 first, uint16 numreg, uint16 slow) { /*****************************************************************************/ void writeColorRegs(byte *buf, uint16 first, uint16 numreg) { WSDL_SetColors(buf, first, numreg, 0); - memcpy(&(curvgapal[first * 3]), buf, numreg * 3); + memcpy(&(_curvgapal[first * 3]), buf, numreg * 3); } void writeColorRegsSmooth(byte *buf, uint16 first, uint16 numreg) { WSDL_SetColors(buf, first, numreg, 1); - memcpy(&(curvgapal[first * 3]), buf, numreg * 3); + memcpy(&(_curvgapal[first * 3]), buf, numreg * 3); } /*****************************************************************************/ @@ -267,7 +264,7 @@ void writeColorReg(byte *buf, uint16 regnum) { } void VGASetPal(void *cmap, uint16 numcolors) { - if (memcmp(cmap, curvgapal, numcolors * 3) != 0) + if (memcmp(cmap, _curvgapal, numcolors * 3) != 0) writeColorRegs((byte *)cmap, 0, numcolors); } @@ -283,7 +280,7 @@ void WSDL_IgnoreUpdateDisplay(int state) { void WSDL_UpdateScreen() { if (g_ScreenWasLocked && !g_IgnoreUpdateDisplay) { - g_system->copyRectToScreen(g_DisplayBuffer, VGAScreenWidth, 0, 0, VGAScreenWidth, VGAScreenHeight); + g_system->copyRectToScreen(g_DisplayBuffer, g_lab->_screenWidth, 0, 0, g_lab->_screenWidth, g_lab->_screenHeight); g_system->updateScreen(); } @@ -326,20 +323,20 @@ void drawImage(Image *Im, uint16 x, uint16 y) { dy = 0; } - if ((uint)(dx + w) > VGAScreenWidth) - w = VGAScreenWidth - dx; + if ((uint)(dx + w) > g_lab->_screenWidth) + w = g_lab->_screenWidth - dx; - if ((uint)(dy + h) > VGAScreenHeight) - h = VGAScreenHeight - dy; + if ((uint)(dy + h) > g_lab->_screenHeight) + h = g_lab->_screenHeight - dy; if (w > 0 && h > 0) { byte *s = Im->ImageData + sy * Im->Width + sx; - byte *d = getVGABaseAddr() + dy * VGAScreenWidth + dx; + byte *d = getVGABaseAddr() + dy * g_lab->_screenWidth + dx; while (h-- > 0) { memcpy(d, s, w); s += Im->Width; - d += VGAScreenWidth; + d += g_lab->_screenWidth; } } } @@ -369,15 +366,15 @@ void drawMaskImage(Image *Im, uint16 x, uint16 y) { dy = 0; } - if ((uint)(dx + w) > VGAScreenWidth) - w = VGAScreenWidth - dx; + if ((uint)(dx + w) > g_lab->_screenWidth) + w = g_lab->_screenWidth - dx; - if ((uint)(dy + h) > VGAScreenHeight) - h = VGAScreenHeight - dy; + if ((uint)(dy + h) > g_lab->_screenHeight) + h = g_lab->_screenHeight - dy; if (w > 0 && h > 0) { byte *s = Im->ImageData + sy * Im->Width + sx; - byte *d = getVGABaseAddr() + dy * VGAScreenWidth + dx; + byte *d = getVGABaseAddr() + dy * g_lab->_screenWidth + dx; while (h-- > 0) { byte *ss = s; @@ -392,7 +389,7 @@ void drawMaskImage(Image *Im, uint16 x, uint16 y) { } s += Im->Width; - d += VGAScreenWidth; + d += g_lab->_screenWidth; } } } @@ -422,20 +419,20 @@ void readScreenImage(Image *Im, uint16 x, uint16 y) { dy = 0; } - if ((uint)(dx + w) > VGAScreenWidth) - w = VGAScreenWidth - dx; + if ((uint)(dx + w) > g_lab->_screenWidth) + w = g_lab->_screenWidth - dx; - if ((uint)(dy + h) > VGAScreenHeight) - h = VGAScreenHeight - dy; + if ((uint)(dy + h) > g_lab->_screenHeight) + h = g_lab->_screenHeight - dy; if (w > 0 && h > 0) { byte *s = Im->ImageData + sy * Im->Width + sx; - byte *d = getVGABaseAddr() + dy * VGAScreenWidth + dx; + byte *d = getVGABaseAddr() + dy * g_lab->_screenWidth + dx; while (h-- > 0) { memcpy(s, d, w); s += Im->Width; - d += VGAScreenWidth; + d += g_lab->_screenWidth; } } } @@ -575,7 +572,7 @@ void scrollDisplayY(int16 dy, uint16 x1, uint16 y1, uint16 x2, uint16 y2) { /* Sets the pen number to use on all the drawing operations. */ /*****************************************************************************/ void setAPen(uint16 pennum) { - curapen = (unsigned char)pennum; + _curapen = (unsigned char)pennum; } /*****************************************************************************/ @@ -599,24 +596,24 @@ void rectFill(uint16 x1, uint16 y1, uint16 x2, uint16 y2) { dy = 0; } - if ((uint)(dx + w) > VGAScreenWidth) - w = VGAScreenWidth - dx; + if ((uint)(dx + w) > g_lab->_screenWidth) + w = g_lab->_screenWidth - dx; - if ((uint)(dy + h) > VGAScreenHeight) - h = VGAScreenHeight - dy; + if ((uint)(dy + h) > g_lab->_screenHeight) + h = g_lab->_screenHeight - dy; if (w > 0 && h > 0) { - char *d = (char *)getVGABaseAddr() + dy * VGAScreenWidth + dx; + char *d = (char *)getVGABaseAddr() + dy * g_lab->_screenWidth + dx; while (h-- > 0) { char *dd = d; int ww = w; while (ww-- > 0) { - *dd++ = curapen; + *dd++ = _curapen; } - d += VGAScreenWidth; + d += g_lab->_screenWidth; } } } @@ -656,14 +653,14 @@ void ghoastRect(uint16 pencolor, uint16 x1, uint16 y1, uint16 x2, uint16 y2) { dy = 0; } - if ((uint)(dx + w) > VGAScreenWidth) - w = VGAScreenWidth - dx; + if ((uint)(dx + w) > g_lab->_screenWidth) + w = g_lab->_screenWidth - dx; - if ((uint)(dy + h) > VGAScreenHeight) - h = VGAScreenHeight - dy; + if ((uint)(dy + h) > g_lab->_screenHeight) + h = g_lab->_screenHeight - dy; if (w > 0 && h > 0) { - char *d = (char *)getVGABaseAddr() + dy * VGAScreenWidth + dx; + char *d = (char *)getVGABaseAddr() + dy * g_lab->_screenWidth + dx; while (h-- > 0) { char *dd = d; @@ -680,7 +677,7 @@ void ghoastRect(uint16 pencolor, uint16 x1, uint16 y1, uint16 x2, uint16 y2) { ww -= 2; } - d += VGAScreenWidth; + d += g_lab->_screenWidth; dy++; } } -- cgit v1.2.3 From 06c2e60cf050c8be47043c792c3a5b39fc3ac899 Mon Sep 17 00:00:00 2001 From: Eugene Sandulenko Date: Mon, 23 Nov 2015 20:06:53 +0100 Subject: LAB: Further renaming of vga code --- engines/lab/mouse.cpp | 16 +++++----- engines/lab/vga.cpp | 88 ++++++++++++++++++--------------------------------- engines/lab/vga.h | 1 - 3 files changed, 39 insertions(+), 66 deletions(-) diff --git a/engines/lab/mouse.cpp b/engines/lab/mouse.cpp index c45ab5cd60..292ac3cb17 100644 --- a/engines/lab/mouse.cpp +++ b/engines/lab/mouse.cpp @@ -199,16 +199,16 @@ void mouseHide() { } -extern uint32 g_MouseX; -extern uint32 g_MouseY; +extern uint32 _mouseX; +extern uint32 _mouseY; /*****************************************************************************/ /* Gets the current mouse co-ordinates. NOTE: On IBM version, will scale */ /* from virtual to screen co-ordinates automatically. */ /*****************************************************************************/ void mouseXY(uint16 *x, uint16 *y) { - *x = (uint16)g_MouseX; - *y = (uint16)g_MouseY; + *x = (uint16)_mouseX; + *y = (uint16)_mouseY; if (!IsHiRes) (*x) /= 2; @@ -237,15 +237,15 @@ void mouseMove(uint16 x, uint16 y) { bool mouseButton(uint16 *x, uint16 *y, bool leftbutton) { if (leftbutton) { if (LeftClick) { - *x = (!IsHiRes) ? (uint16)g_MouseX / 2 : (uint16)g_MouseX; - *y = (uint16)g_MouseY; + *x = (!IsHiRes) ? (uint16)_mouseX / 2 : (uint16)_mouseX; + *y = (uint16)_mouseY; LeftClick = false; return true; } } else { if (RightClick) { - *x = (!IsHiRes) ? (uint16)g_MouseX / 2 : (uint16)g_MouseX; - *y = (uint16)g_MouseY; + *x = (!IsHiRes) ? (uint16)_mouseX / 2 : (uint16)_mouseX; + *y = (uint16)_mouseY; RightClick = false; return true; } diff --git a/engines/lab/vga.cpp b/engines/lab/vga.cpp index 5e1a1e828a..cf4ccc77f7 100644 --- a/engines/lab/vga.cpp +++ b/engines/lab/vga.cpp @@ -43,30 +43,23 @@ static byte _curvgapal[256 * 3]; static unsigned char _curapen = 0; byte *VGABASEADDRESS = 0; +byte *_displayBuffer = 0; -byte *g_DisplayBuffer = 0; -byte *g_Pixels = 0; - -int g_ScreenWasLocked = 0; -int g_IgnoreUpdateDisplay = 0; int g_LastWaitTOFTicks = 0; -uint32 g_MouseX = 0; -uint32 g_MouseY = 0; +uint32 _mouseX = 0; +uint32 _mouseY = 0; uint16 g_NextKeyIn = 0; uint16 g_KeyBuf[64]; uint16 g_NextKeyOut = 0; -bool g_MouseAtEdge = false; +bool _mouseAtEdge = false; byte *TempScrollData; /*****************************************************************************/ /* Sets up either a low-res or a high-res 256 color screen. */ /*****************************************************************************/ bool createScreen(bool HiRes) { - //VGABASEADDRESS = (unsigned long)malloc(640 * 480); - VGABASEADDRESS = 0; - if (HiRes) { g_lab->_screenWidth = 640; g_lab->_screenHeight = 480; @@ -76,8 +69,7 @@ bool createScreen(bool HiRes) { } g_lab->_screenBytesPerPage = g_lab->_screenWidth * g_lab->_screenHeight; - g_DisplayBuffer = (byte *)malloc(g_lab->_screenBytesPerPage); - g_Pixels = (byte *)calloc(g_lab->_screenBytesPerPage, 4); + _displayBuffer = (byte *)malloc(g_lab->_screenBytesPerPage); return true; } @@ -119,39 +111,39 @@ void WSDL_ProcessInput(bool can_delay) { switch (event.type) { case Common::EVENT_RBUTTONDOWN: flags |= 8; - mouseHandler(flags, g_MouseX, g_MouseY); + mouseHandler(flags, _mouseX, _mouseY); break; case Common::EVENT_LBUTTONDOWN: flags |= 2; - mouseHandler(flags, g_MouseX, g_MouseY); + mouseHandler(flags, _mouseX, _mouseY); break; case Common::EVENT_MOUSEMOVE: - lastMouseAtEdge = g_MouseAtEdge; - g_MouseAtEdge = false; - g_MouseX = event.mouse.x; + lastMouseAtEdge = _mouseAtEdge; + _mouseAtEdge = false; + _mouseX = event.mouse.x; if (event.mouse.x <= 0) { - g_MouseX = 0; - g_MouseAtEdge = true; + _mouseX = 0; + _mouseAtEdge = true; } - if (g_MouseX > g_lab->_screenWidth - 1) { - g_MouseX = g_lab->_screenWidth; - g_MouseAtEdge = true; + if (_mouseX > g_lab->_screenWidth - 1) { + _mouseX = g_lab->_screenWidth; + _mouseAtEdge = true; } - g_MouseY = event.mouse.y; + _mouseY = event.mouse.y; if (event.mouse.y <= 0) { - g_MouseY = 0; - g_MouseAtEdge = true; + _mouseY = 0; + _mouseAtEdge = true; } - if (g_MouseY > g_lab->_screenHeight - 1) { - g_MouseY = g_lab->_screenHeight; - g_MouseAtEdge = true; + if (_mouseY > g_lab->_screenHeight - 1) { + _mouseY = g_lab->_screenHeight; + _mouseAtEdge = true; } - if (!lastMouseAtEdge || !g_MouseAtEdge) - mouseHandler(1, g_MouseX, g_MouseY); + if (!lastMouseAtEdge || !_mouseAtEdge) + mouseHandler(1, _mouseX, _mouseY); break; @@ -185,7 +177,7 @@ void WSDL_ProcessInput(bool can_delay) { break; } - g_system->copyRectToScreen(g_DisplayBuffer, g_lab->_screenWidth, 0, 0, g_lab->_screenWidth, g_lab->_screenHeight); + g_system->copyRectToScreen(_displayBuffer, g_lab->_screenWidth, 0, 0, g_lab->_screenWidth, g_lab->_screenHeight); g_system->updateScreen(); } } @@ -197,19 +189,14 @@ void WSDL_ProcessInput(bool can_delay) { void WSDL_GetMousePos(int *x, int *y) { WSDL_ProcessInput(0); - *x = g_MouseX; - *y = g_MouseY; + *x = _mouseX; + *y = _mouseY; } void waitTOF() { - int untilOutOfRefresh = 1; + g_system->copyRectToScreen(_displayBuffer, g_lab->_screenWidth, 0, 0, g_lab->_screenWidth, g_lab->_screenHeight); + g_system->updateScreen(); - if (g_ScreenWasLocked || untilOutOfRefresh) { - g_system->copyRectToScreen(g_DisplayBuffer, g_lab->_screenWidth, 0, 0, g_lab->_screenWidth, g_lab->_screenHeight); - g_system->updateScreen(); - } - - g_ScreenWasLocked = 0; WSDL_ProcessInput(0); uint32 now; @@ -268,23 +255,10 @@ void VGASetPal(void *cmap, uint16 numcolors) { writeColorRegs((byte *)cmap, 0, numcolors); } -byte *WSDL_LockVideo() { - g_ScreenWasLocked = 1; - - return g_DisplayBuffer; -} - -void WSDL_IgnoreUpdateDisplay(int state) { - g_IgnoreUpdateDisplay = state; -} - void WSDL_UpdateScreen() { - if (g_ScreenWasLocked && !g_IgnoreUpdateDisplay) { - g_system->copyRectToScreen(g_DisplayBuffer, g_lab->_screenWidth, 0, 0, g_lab->_screenWidth, g_lab->_screenHeight); - g_system->updateScreen(); - } + g_system->copyRectToScreen(_displayBuffer, g_lab->_screenWidth, 0, 0, g_lab->_screenWidth, g_lab->_screenHeight); + g_system->updateScreen(); - g_ScreenWasLocked = 0; WSDL_ProcessInput(0); } @@ -295,7 +269,7 @@ byte *getVGABaseAddr() { if (VGABASEADDRESS) return VGABASEADDRESS; - return WSDL_LockVideo(); + return _displayBuffer; } /*****************************************************************************/ diff --git a/engines/lab/vga.h b/engines/lab/vga.h index aa5a26cda2..ade6a2ac79 100644 --- a/engines/lab/vga.h +++ b/engines/lab/vga.h @@ -64,7 +64,6 @@ void drawVLine(uint16 x1, uint16 y, uint16 x2); void rectFill(uint16 x1, uint16 y1, uint16 x2, uint16 y2); void ghoastRect(uint16 pencolor, uint16 x1, uint16 y1, uint16 x2, uint16 y2); void WSDL_UpdateScreen(); -void WSDL_IgnoreUpdateDisplay(int state); void WSDL_GetMousePos(int *x, int *y); uint16 WSDL_GetNextChar(); bool WSDL_HasNextChar(); -- cgit v1.2.3 From 4b65faaa632d309f02f6c25d38d9b6afc0648cbd Mon Sep 17 00:00:00 2001 From: Eugene Sandulenko Date: Tue, 24 Nov 2015 10:40:35 +0100 Subject: LAB: More renames in vga.cpp --- engines/lab/graphics.cpp | 8 ++++---- engines/lab/special.cpp | 6 +++--- engines/lab/vga.cpp | 48 ++++++++++++++++++++++++------------------------ 3 files changed, 31 insertions(+), 31 deletions(-) diff --git a/engines/lab/graphics.cpp b/engines/lab/graphics.cpp index 40b9aa1031..62963137bb 100644 --- a/engines/lab/graphics.cpp +++ b/engines/lab/graphics.cpp @@ -290,7 +290,7 @@ uint32 flowText(void *font, /* the TextAttr pointer */ } -extern byte *VGABASEADDRESS; +extern byte *_currentDsplayBuffer; /******************************************************************************/ @@ -307,15 +307,15 @@ uint32 flowTextToMem(Image *DestIm, void *font, /* the TextAttr pointer */ uint16 x1, /* Cords */ uint16 y1, uint16 x2, uint16 y2, const char *str) { /* The text itself */ uint32 res, vgabyte = g_lab->_screenBytesPerPage; - byte *tmp = VGABASEADDRESS; + byte *tmp = _currentDsplayBuffer; - VGABASEADDRESS = DestIm->ImageData; + _currentDsplayBuffer = DestIm->ImageData; g_lab->_screenBytesPerPage = (uint32) DestIm->Width * (int32) DestIm->Height; res = flowText(font, spacing, pencolor, backpen, fillback, centerh, centerv, output, x1, y1, x2, y2, str); g_lab->_screenBytesPerPage = vgabyte; - VGABASEADDRESS = tmp; + _currentDsplayBuffer = tmp; return res; } diff --git a/engines/lab/special.cpp b/engines/lab/special.cpp index 41d938bdb8..0104e3ee3f 100644 --- a/engines/lab/special.cpp +++ b/engines/lab/special.cpp @@ -89,7 +89,7 @@ extern uint16 *FadePalette; extern bool nopalchange, DoBlack, IsHiRes; extern BitMap *DispBitMap, *DrawBitMap; extern char diffcmap[3 * 256]; -extern byte *TempScrollData; +extern byte *_tempScrollData; extern CloseDataPtr CPtr; extern InventoryData *Inventory; extern uint16 RoomNum, Direction; @@ -164,7 +164,7 @@ void showCombination(const char *filename) { for (CurBit = 0; CurBit < 10; CurBit++) readImage(buffer, &(Images[CurBit])); - allocFile((void **)&TempScrollData, Images[0]->Width * Images[0]->Height * 2L, "tempdata"); + allocFile((void **)&_tempScrollData, Images[0]->Width * Images[0]->Height * 2L, "tempdata"); doCombination(); @@ -315,7 +315,7 @@ void showTile(const char *filename, bool showsolution) { for (CurBit = start; CurBit < 16; CurBit++) readImage(buffer, &(Tiles[CurBit])); - allocFile((void **)&TempScrollData, Tiles[1]->Width * Tiles[1]->Height * 2L, "tempdata"); + allocFile((void **)&_tempScrollData, Tiles[1]->Width * Tiles[1]->Height * 2L, "tempdata"); doTile(showsolution); diff --git a/engines/lab/vga.cpp b/engines/lab/vga.cpp index cf4ccc77f7..54cb50756d 100644 --- a/engines/lab/vga.cpp +++ b/engines/lab/vga.cpp @@ -42,19 +42,19 @@ namespace Lab { static byte _curvgapal[256 * 3]; static unsigned char _curapen = 0; -byte *VGABASEADDRESS = 0; +byte *_currentDsplayBuffer = 0; byte *_displayBuffer = 0; -int g_LastWaitTOFTicks = 0; +int _lastWaitTOFTicks = 0; uint32 _mouseX = 0; uint32 _mouseY = 0; -uint16 g_NextKeyIn = 0; -uint16 g_KeyBuf[64]; -uint16 g_NextKeyOut = 0; +uint16 _nextKeyIn = 0; +uint16 _keyBuf[64]; +uint16 _nextKeyOut = 0; bool _mouseAtEdge = false; -byte *TempScrollData; +byte *_tempScrollData; /*****************************************************************************/ /* Sets up either a low-res or a high-res 256 color screen. */ @@ -85,10 +85,10 @@ uint16 WSDL_GetNextChar() { uint16 c = 0; WSDL_ProcessInput(0); - if (g_NextKeyIn != g_NextKeyOut) { - c = g_KeyBuf[g_NextKeyOut]; - g_NextKeyOut = ((((unsigned int)((g_NextKeyOut + 1) >> 31) >> 26) + (byte)g_NextKeyOut + 1) & 0x3F) - - ((unsigned int)((g_NextKeyOut + 1) >> 31) >> 26); + if (_nextKeyIn != _nextKeyOut) { + c = _keyBuf[_nextKeyOut]; + _nextKeyOut = ((((unsigned int)((_nextKeyOut + 1) >> 31) >> 26) + (byte)_nextKeyOut + 1) & 0x3F) + - ((unsigned int)((_nextKeyOut + 1) >> 31) >> 26); } return c; @@ -96,7 +96,7 @@ uint16 WSDL_GetNextChar() { bool WSDL_HasNextChar() { WSDL_ProcessInput(0); - return g_NextKeyIn != g_NextKeyOut; + return _nextKeyIn != _nextKeyOut; } void WSDL_ProcessInput(bool can_delay) { @@ -162,11 +162,11 @@ void WSDL_ProcessInput(bool can_delay) { break; default: - n = ((((unsigned int)((g_NextKeyIn + 1) >> 31) >> 26) + (byte)g_NextKeyIn + 1) & 0x3F) - - ((unsigned int)((g_NextKeyIn + 1) >> 31) >> 26); - if (n != g_NextKeyOut) { - g_KeyBuf[g_NextKeyIn] = event.kbd.keycode; - g_NextKeyIn = n; + n = ((((unsigned int)((_nextKeyIn + 1) >> 31) >> 26) + (byte)_nextKeyIn + 1) & 0x3F) + - ((unsigned int)((_nextKeyIn + 1) >> 31) >> 26); + if (n != _nextKeyOut) { + _keyBuf[_nextKeyIn] = event.kbd.keycode; + _nextKeyIn = n; } } break; @@ -201,10 +201,10 @@ void waitTOF() { uint32 now; - for (now = g_system->getMillis(); now - g_LastWaitTOFTicks <= 0xF; now = g_system->getMillis() ) - g_system->delayMillis(g_LastWaitTOFTicks - now + 17); + for (now = g_system->getMillis(); now - _lastWaitTOFTicks <= 0xF; now = g_system->getMillis() ) + g_system->delayMillis(_lastWaitTOFTicks - now + 17); - g_LastWaitTOFTicks = now; + _lastWaitTOFTicks = now; } void WSDL_SetColors(byte *buf, uint16 first, uint16 numreg, uint16 slow) { @@ -266,8 +266,8 @@ void WSDL_UpdateScreen() { /* Returns the base address of the current VGA display. */ /*****************************************************************************/ byte *getVGABaseAddr() { - if (VGABASEADDRESS) - return VGABASEADDRESS; + if (_currentDsplayBuffer) + return _currentDsplayBuffer; return _displayBuffer; } @@ -458,14 +458,14 @@ void bltBitMap(Image *ImSource, uint16 xs, uint16 ys, Image *ImDest, /*****************************************************************************/ /* Scrolls the display in the x direction by blitting. */ -/* The TempScrollData variable must be initialized to some memory, or this */ +/* The _tempScrollData variable must be initialized to some memory, or this */ /* function will fail. */ /*****************************************************************************/ void scrollDisplayX(int16 dx, uint16 x1, uint16 y1, uint16 x2, uint16 y2) { Image Im; uint16 temp; - Im.ImageData = TempScrollData; + Im.ImageData = _tempScrollData; if (x1 > x2) { temp = x2; @@ -507,7 +507,7 @@ void scrollDisplayY(int16 dy, uint16 x1, uint16 y1, uint16 x2, uint16 y2) { Image Im; uint16 temp; - Im.ImageData = TempScrollData; + Im.ImageData = _tempScrollData; if (x1 > x2) { temp = x2; -- cgit v1.2.3 From 93e3ba9eddc7c50db7f6475305a24cd30f2893fa Mon Sep 17 00:00:00 2001 From: Eugene Sandulenko Date: Tue, 24 Nov 2015 23:59:30 +0100 Subject: LAB: Put vga.cpp into LabEngine class --- engines/lab/engine.cpp | 66 +++++++++++------------------ engines/lab/graphics.cpp | 99 +++++++++++++++++++++---------------------- engines/lab/interface.cpp | 16 +++---- engines/lab/interface.h | 1 - engines/lab/intro.cpp | 26 ++++++------ engines/lab/lab.cpp | 14 ++++++ engines/lab/lab.h | 74 ++++++++++++++++++++++++++++++++ engines/lab/labfun.h | 2 - engines/lab/labmusic.cpp | 3 +- engines/lab/map.cpp | 101 ++++++++++++++++++++++---------------------- engines/lab/mouse.cpp | 36 +++++++--------- engines/lab/processroom.cpp | 33 +++++++-------- engines/lab/readdiff.cpp | 25 ++++++----- engines/lab/special.cpp | 84 ++++++++++++++++++------------------ engines/lab/text.cpp | 3 +- engines/lab/timing.cpp | 1 - engines/lab/vga.cpp | 68 +++++++++++------------------ engines/lab/vga.h | 74 -------------------------------- 18 files changed, 343 insertions(+), 383 deletions(-) delete mode 100644 engines/lab/vga.h diff --git a/engines/lab/engine.cpp b/engines/lab/engine.cpp index c706dca110..18178d3972 100644 --- a/engines/lab/engine.cpp +++ b/engines/lab/engine.cpp @@ -32,7 +32,6 @@ #include "lab/stddefines.h" #include "lab/labfun.h" #include "lab/diff.h" -#include "lab/vga.h" #include "lab/text.h" #include "lab/intro.h" #include "lab/parsefun.h" @@ -132,7 +131,7 @@ static char initcolors[] = { '\x00', '\x00', '\x00', '\x30', /******************************************************************************/ /* Draws the control panel display. */ /******************************************************************************/ -void drawPanel() { +void LabEngine::drawPanel() { mouseHide(); setAPen(3); /* Clear Area */ @@ -219,7 +218,7 @@ static void drawRoomMessage(uint16 CurInv, CloseDataPtr cptr) { /******************************************************************************/ /* Sets up the Labyrinth screens, and opens up the initial windows. */ /******************************************************************************/ -bool setUpScreens() { +bool LabEngine::setUpScreens() { uint16 counter; byte *buffer; byte *MovePanelBuffer, *InvPanelBuffer; @@ -349,7 +348,7 @@ bool setUpScreens() { /******************************************************************************/ /* Permanently flips the imagry of a gadget. */ /******************************************************************************/ -static void perFlipGadget(uint16 GadID) { +void LabEngine::perFlipGadget(uint16 GadID) { Image *Temp; Gadget *TopGad; @@ -391,7 +390,7 @@ void eatMessages() { /******************************************************************************/ /* Checks whether the close up is one of the special case closeups. */ /******************************************************************************/ -static bool doCloseUp(CloseDataPtr cptr) { +bool LabEngine::doCloseUp(CloseDataPtr cptr) { if (cptr == NULL) return false; @@ -527,8 +526,7 @@ static const char *Test; /******************************************************************************/ /* If the user hits the "Use" gadget; things that can get used on themselves. */ /******************************************************************************/ -static bool doUse(uint16 CurInv) { - +bool LabEngine::doUse(uint16 CurInv) { if (CurInv == MAPNUM) { /* LAB: Labyrinth specific */ drawStaticMessage(kTextUseMap); interfaceOff(); @@ -539,9 +537,7 @@ static bool doUse(uint16 CurInv) { VGASetPal(initcolors, 8); drawMessage(NULL); drawPanel(); - } - - else if (CurInv == JOURNALNUM) { /* LAB: Labyrinth specific */ + } else if (CurInv == JOURNALNUM) { /* LAB: Labyrinth specific */ drawStaticMessage(kTextUseJournal); interfaceOff(); stopDiff(); @@ -550,17 +546,15 @@ static bool doUse(uint16 CurInv) { doJournal(); drawPanel(); drawMessage(NULL); - } - - else if (CurInv == LAMPNUM) { /* LAB: Labyrinth specific */ + } else if (CurInv == LAMPNUM) { /* LAB: Labyrinth specific */ interfaceOff(); - if (g_lab->_conditions->in(LAMPON)) { + if (_conditions->in(LAMPON)) { drawStaticMessage(kTextTurnLampOff); - g_lab->_conditions->exclElement(LAMPON); + _conditions->exclElement(LAMPON); } else { drawStaticMessage(kTextTurnLampOn); - g_lab->_conditions->inclElement(LAMPON); + _conditions->inclElement(LAMPON); } DoBlack = false; @@ -570,32 +564,22 @@ static bool doUse(uint16 CurInv) { DoBlack = false; Test = getInvName(CurInv); - } - - else if (CurInv == BELTNUM) { /* LAB: Labyrinth specific */ - if (!g_lab->_conditions->in(BELTGLOW)) - g_lab->_conditions->inclElement(BELTGLOW); + } else if (CurInv == BELTNUM) { /* LAB: Labyrinth specific */ + if (!_conditions->in(BELTGLOW)) + _conditions->inclElement(BELTGLOW); DoBlack = false; Test = getInvName(CurInv); - } - - else if (CurInv == WHISKEYNUM) { /* LAB: Labyrinth specific */ - g_lab->_conditions->inclElement(USEDHELMET); + } else if (CurInv == WHISKEYNUM) { /* LAB: Labyrinth specific */ + _conditions->inclElement(USEDHELMET); drawStaticMessage(kTextUseWhiskey); - } - - else if (CurInv == PITHHELMETNUM) { /* LAB: Labyrinth specific */ - g_lab->_conditions->inclElement(USEDHELMET); + } else if (CurInv == PITHHELMETNUM) { /* LAB: Labyrinth specific */ + _conditions->inclElement(USEDHELMET); drawStaticMessage(kTextUsePith); - } - - else if (CurInv == HELMETNUM) { /* LAB: Labyrinth specific */ - g_lab->_conditions->inclElement(USEDHELMET); + } else if (CurInv == HELMETNUM) { /* LAB: Labyrinth specific */ + _conditions->inclElement(USEDHELMET); drawStaticMessage(kTextUseHelmet); - } - - else + } else return false; return true; @@ -651,7 +635,7 @@ static void decIncInv(uint16 *CurInv, bool dec) { /******************************************************************************/ /* The main game loop */ /******************************************************************************/ -static void mainGameLoop() { +void LabEngine::mainGameLoop() { IntuiMessage *Msg; uint32 Class; @@ -1474,8 +1458,8 @@ byte dropCrumbsOff[] = { 0x00 }; Image DropCrumbsImage = { 24, 24, dropCrumbs }; Image DropCrumbsOffImage = { 24, 24, dropCrumbsOff }; -void mayShowCrumbIndicator() { - if (g_lab->getPlatform() != Common::kPlatformWindows) +void LabEngine::mayShowCrumbIndicator() { + if (getPlatform() != Common::kPlatformWindows) return; if (DroppingCrumbs && MainDisplay) { @@ -1485,8 +1469,8 @@ void mayShowCrumbIndicator() { } } -void mayShowCrumbIndicatorOff() { - if (g_lab->getPlatform() != Common::kPlatformWindows) +void LabEngine::mayShowCrumbIndicatorOff() { + if (getPlatform() != Common::kPlatformWindows) return; if (MainDisplay) { diff --git a/engines/lab/graphics.cpp b/engines/lab/graphics.cpp index 62963137bb..b21c4f6e33 100644 --- a/engines/lab/graphics.cpp +++ b/engines/lab/graphics.cpp @@ -35,7 +35,6 @@ #include "lab/labfun.h" #include "lab/parsefun.h" #include "lab/mouse.h" -#include "lab/vga.h" #include "lab/text.h" #include "lab/resource.h" @@ -242,14 +241,14 @@ uint32 flowText(void *font, /* the TextAttr pointer */ uint16 x, y; if (fillback) { - setAPen(backpen); - rectFill(x1, y1, x2, y2); + g_lab->setAPen(backpen); + g_lab->rectFill(x1, y1, x2, y2); } if (str == NULL) return 0L; - setAPen(pencolor); + g_lab->setAPen(pencolor); fontheight = textHeight(msgfont) + spacing; numlines = (y2 - y1 + 1) / fontheight; @@ -289,10 +288,6 @@ uint32 flowText(void *font, /* the TextAttr pointer */ return (str - temp); } - -extern byte *_currentDsplayBuffer; - - /******************************************************************************/ /* Calls flowText, but flows it to memory. Same restrictions as flowText. */ /******************************************************************************/ @@ -307,15 +302,15 @@ uint32 flowTextToMem(Image *DestIm, void *font, /* the TextAttr pointer */ uint16 x1, /* Cords */ uint16 y1, uint16 x2, uint16 y2, const char *str) { /* The text itself */ uint32 res, vgabyte = g_lab->_screenBytesPerPage; - byte *tmp = _currentDsplayBuffer; + byte *tmp = g_lab->_currentDsplayBuffer; - _currentDsplayBuffer = DestIm->ImageData; + g_lab->_currentDsplayBuffer = DestIm->ImageData; g_lab->_screenBytesPerPage = (uint32) DestIm->Width * (int32) DestIm->Height; res = flowText(font, spacing, pencolor, backpen, fillback, centerh, centerv, output, x1, y1, x2, y2, str); g_lab->_screenBytesPerPage = vgabyte; - _currentDsplayBuffer = tmp; + g_lab->_currentDsplayBuffer = tmp; return res; } @@ -328,14 +323,14 @@ uint32 flowTextToMem(Image *DestIm, void *font, /* the TextAttr pointer */ void createBox(uint16 y2) { - setAPen(7); /* Message box area */ - rectFill(VGAScaleX(4), VGAScaleY(154), VGAScaleX(315), VGAScaleY(y2 - 2)); - - setAPen(0); /* Box around message area */ - drawHLine(VGAScaleX(2), VGAScaleY(152), VGAScaleX(317)); - drawVLine(VGAScaleX(317), VGAScaleY(152), VGAScaleY(y2)); - drawHLine(VGAScaleX(2), VGAScaleY(y2), VGAScaleX(317)); - drawVLine(VGAScaleX(2), VGAScaleY(152), VGAScaleY(y2)); + g_lab->setAPen(7); /* Message box area */ + g_lab->rectFill(VGAScaleX(4), VGAScaleY(154), VGAScaleX(315), VGAScaleY(y2 - 2)); + + g_lab->setAPen(0); /* Box around message area */ + g_lab->drawHLine(VGAScaleX(2), VGAScaleY(152), VGAScaleX(317)); + g_lab->drawVLine(VGAScaleX(317), VGAScaleY(152), VGAScaleY(y2)); + g_lab->drawHLine(VGAScaleX(2), VGAScaleY(y2), VGAScaleX(317)); + g_lab->drawVLine(VGAScaleX(2), VGAScaleY(152), VGAScaleY(y2)); } @@ -355,8 +350,8 @@ int32 longDrawMessage(const char *str) { if (!LongWinInFront) { LongWinInFront = true; - setAPen(3); /* Clear Area */ - rectFill(0, VGAScaleY(149) + SVGACord(2), VGAScaleX(319), VGAScaleY(199)); + g_lab->setAPen(3); /* Clear Area */ + g_lab->rectFill(0, VGAScaleY(149) + SVGACord(2), VGAScaleX(319), VGAScaleY(199)); } createBox(198); @@ -387,7 +382,7 @@ void drawMessage(const char *str) { } else { if (LongWinInFront) { LongWinInFront = false; - drawPanel(); + g_lab->drawPanel(); } mouseHide(); @@ -434,10 +429,10 @@ static void doScrollBlack() { Im.Height = height; Im.ImageData = mem; g_music->updateMusic(); - readScreenImage(&Im, 0, 0); + g_lab->readScreenImage(&Im, 0, 0); g_music->updateMusic(); - BaseAddr = (uint32 *) getVGABaseAddr(); + BaseAddr = (uint32 *)g_lab->getVGABaseAddr(); by = VGAScaleX(4); nheight = height; @@ -446,9 +441,9 @@ static void doScrollBlack() { g_music->updateMusic(); if (!IsHiRes) - waitTOF(); + g_lab->waitTOF(); - BaseAddr = (uint32 *) getVGABaseAddr(); + BaseAddr = (uint32 *)g_lab->getVGABaseAddr(); if (by > nheight) by = nheight; @@ -470,10 +465,10 @@ static void doScrollBlack() { tempmem += copysize; } - setAPen(0); - rectFill(0, nheight, width - 1, nheight + by - 1); + g_lab->setAPen(0); + g_lab->rectFill(0, nheight, width - 1, nheight + by - 1); - WSDL_UpdateScreen(); + g_lab->WSDL_UpdateScreen(); if (!IsHiRes) { if (nheight <= (height / 8)) @@ -503,7 +498,7 @@ static void copyPage(uint16 width, uint16 height, uint16 nheight, uint16 startli uint16 CurPage; uint32 *BaseAddr; - BaseAddr = (uint32 *)getVGABaseAddr(); + BaseAddr = (uint32 *)g_lab->getVGABaseAddr(); size = (int32)(height - nheight) * (int32) width; mem += startline * width; @@ -539,12 +534,12 @@ static void doScrollWipe(char *filename) { while (g_music->isSoundEffectActive()) { g_music->updateMusic(); - waitTOF(); + g_lab->waitTOF(); } IsBM = true; readPict(filename, true); - VGASetPal(diffcmap, 256); + g_lab->VGASetPal(diffcmap, 256); IsBM = false; mem = RawDiffBM.Planes[0]; @@ -566,7 +561,7 @@ static void doScrollWipe(char *filename) { copyPage(width, height, nheight, startline, mem); - WSDL_UpdateScreen(); + g_lab->WSDL_UpdateScreen(); if (!nheight) startline += by; @@ -618,8 +613,8 @@ static void doScrollBounce() { startline -= newby[counter]; copyPage(width, height, 0, startline, mem); - WSDL_UpdateScreen(); - waitTOF(); + g_lab->WSDL_UpdateScreen(); + g_lab->waitTOF(); } for (int counter = 8; counter > 0; counter--) { @@ -627,8 +622,8 @@ static void doScrollBounce() { startline += newby1[counter - 1]; copyPage(width, height, 0, startline, mem); - WSDL_UpdateScreen(); - waitTOF(); + g_lab->WSDL_UpdateScreen(); + g_lab->waitTOF(); } @@ -658,17 +653,17 @@ static void doTransWipe(CloseDataPtr *CPtr, char *filename) { while (CurY < LastY) { if (linesdone >= lineslast) { g_music->updateMusic(); - waitTOF(); + g_lab->waitTOF(); linesdone = 0; } - ghoastRect(0, 0, CurY, g_lab->_screenWidth - 1, CurY + 1); + g_lab->ghoastRect(0, 0, CurY, g_lab->_screenWidth - 1, CurY + 1); CurY += 4; linesdone++; } } - setAPen(0); + g_lab->setAPen(0); for (counter = 0; counter < 2; counter++) { CurY = counter * 2; @@ -676,11 +671,11 @@ static void doTransWipe(CloseDataPtr *CPtr, char *filename) { while (CurY <= LastY) { if (linesdone >= lineslast) { g_music->updateMusic(); - waitTOF(); + g_lab->waitTOF(); linesdone = 0; } - rectFill(0, CurY, g_lab->_screenWidth - 1, CurY + 1); + g_lab->rectFill(0, CurY, g_lab->_screenWidth - 1, CurY + 1); CurY += 4; linesdone++; } @@ -694,7 +689,7 @@ static void doTransWipe(CloseDataPtr *CPtr, char *filename) { CurFileName = getPictName(CPtr); byte *BitMapMem = readPictToMem(CurFileName, g_lab->_screenWidth, LastY + 5); - VGASetPal(diffcmap, 256); + g_lab->VGASetPal(diffcmap, 256); if (BitMapMem) { ImSource.Width = g_lab->_screenWidth; @@ -703,7 +698,7 @@ static void doTransWipe(CloseDataPtr *CPtr, char *filename) { ImDest.Width = g_lab->_screenWidth; ImDest.Height = g_lab->_screenHeight; - ImDest.ImageData = getVGABaseAddr(); + ImDest.ImageData = g_lab->getVGABaseAddr(); for (counter = 0; counter < 2; counter++) { CurY = counter * 2; @@ -711,14 +706,14 @@ static void doTransWipe(CloseDataPtr *CPtr, char *filename) { while (CurY < LastY) { if (linesdone >= lineslast) { g_music->updateMusic(); - waitTOF(); + g_lab->waitTOF(); linesdone = 0; } - ImDest.ImageData = getVGABaseAddr(); + ImDest.ImageData = g_lab->getVGABaseAddr(); - bltBitMap(&ImSource, 0, CurY, &ImDest, 0, CurY, g_lab->_screenWidth, 2); - ghoastRect(0, 0, CurY, g_lab->_screenWidth - 1, CurY + 1); + g_lab->bltBitMap(&ImSource, 0, CurY, &ImDest, 0, CurY, g_lab->_screenWidth, 2); + g_lab->ghoastRect(0, 0, CurY, g_lab->_screenWidth - 1, CurY + 1); CurY += 4; linesdone++; } @@ -730,16 +725,16 @@ static void doTransWipe(CloseDataPtr *CPtr, char *filename) { while (CurY <= LastY) { if (linesdone >= lineslast) { g_music->updateMusic(); - waitTOF(); + g_lab->waitTOF(); linesdone = 0; } - ImDest.ImageData = getVGABaseAddr(); + ImDest.ImageData = g_lab->getVGABaseAddr(); if (CurY == LastY) - bltBitMap(&ImSource, 0, CurY, &ImDest, 0, CurY, g_lab->_screenWidth, 1); + g_lab->bltBitMap(&ImSource, 0, CurY, &ImDest, 0, CurY, g_lab->_screenWidth, 1); else - bltBitMap(&ImSource, 0, CurY, &ImDest, 0, CurY, g_lab->_screenWidth, 2); + g_lab->bltBitMap(&ImSource, 0, CurY, &ImDest, 0, CurY, g_lab->_screenWidth, 2); CurY += 4; linesdone++; diff --git a/engines/lab/interface.cpp b/engines/lab/interface.cpp index 1cd017d434..54a7e13499 100644 --- a/engines/lab/interface.cpp +++ b/engines/lab/interface.cpp @@ -28,11 +28,11 @@ * */ +#include "lab/lab.h" #include "lab/labfun.h" #include "lab/stddefines.h" #include "lab/interface.h" #include "lab/mouse.h" -#include "lab/vga.h" #include "common/util.h" namespace Lab { @@ -82,7 +82,7 @@ void freeButtonList(Gadget *gptrlist) { /*****************************************************************************/ void drawGadgetList(Gadget *gadlist) { while (gadlist) { - drawImage(gadlist->Im, gadlist->x, gadlist->y); + g_lab->drawImage(gadlist->Im, gadlist->x, gadlist->y); if (GADGETOFF & gadlist->GadgetFlags) ghoastGadget(gadlist, 1); @@ -96,7 +96,7 @@ void drawGadgetList(Gadget *gadlist) { /* Ghoasts a gadget, and makes it unavailable for using. */ /*****************************************************************************/ void ghoastGadget(Gadget *curgad, uint16 pencolor) { - ghoastRect(pencolor, curgad->x, curgad->y, curgad->x + curgad->Im->Width - 1, curgad->y + curgad->Im->Height - 1); + g_lab->ghoastRect(pencolor, curgad->x, curgad->y, curgad->x + curgad->Im->Width - 1, curgad->y + curgad->Im->Height - 1); curgad->GadgetFlags |= GADGETOFF; } @@ -106,7 +106,7 @@ void ghoastGadget(Gadget *curgad, uint16 pencolor) { /* Unghoasts a gadget, and makes it available again. */ /*****************************************************************************/ void unGhoastGadget(Gadget *curgad) { - drawImage(curgad->Im, curgad->x, curgad->y); + g_lab->drawImage(curgad->Im, curgad->x, curgad->y); curgad->GadgetFlags &= !(GADGETOFF); } @@ -133,11 +133,11 @@ static Gadget *checkNumGadgetHit(Gadget *gadlist, uint16 key) { (gadlist->KeyEquiv != 0 && makeGadgetKeyEquiv(key) == gadlist->KeyEquiv)) && !(GADGETOFF & gadlist->GadgetFlags)) { mouseHide(); - drawImage(gadlist->ImAlt, gadlist->x, gadlist->y); + g_lab->drawImage(gadlist->ImAlt, gadlist->x, gadlist->y); mouseShow(); g_system->delayMillis(80); mouseHide(); - drawImage(gadlist->Im, gadlist->x, gadlist->y); + g_lab->drawImage(gadlist->Im, gadlist->x, gadlist->y); mouseShow(); return gadlist; @@ -155,8 +155,8 @@ static Gadget *checkNumGadgetHit(Gadget *gadlist, uint16 key) { /* Checks whether or not a key has been pressed. */ /*****************************************************************************/ static bool keyPress(uint16 *KeyCode) { - if (WSDL_HasNextChar()) { - *KeyCode = WSDL_GetNextChar(); + if (g_lab->WSDL_HasNextChar()) { + *KeyCode = g_lab->WSDL_GetNextChar(); return true; } diff --git a/engines/lab/interface.h b/engines/lab/interface.h index 84df28c767..524c4ff437 100644 --- a/engines/lab/interface.h +++ b/engines/lab/interface.h @@ -28,7 +28,6 @@ * */ -#include "lab/vga.h" #include "common/keyboard.h" #ifndef LAB_INTEFACE_H diff --git a/engines/lab/intro.cpp b/engines/lab/intro.cpp index 85c64c44b6..feb4905824 100644 --- a/engines/lab/intro.cpp +++ b/engines/lab/intro.cpp @@ -115,8 +115,8 @@ void Intro::doPictText(const char *filename, bool isscreen) { fade(false, 0); if (isscreen) { - setAPen(7L); - rectFill(VGAScaleX(10), VGAScaleY(10), VGAScaleX(310), VGAScaleY(190)); + g_lab->setAPen(7L); + g_lab->rectFill(VGAScaleX(10), VGAScaleY(10), VGAScaleX(310), VGAScaleY(190)); Drawn = flowText(_msgfont, (!IsHiRes) * -1, 5, 7, false, false, true, true, VGAScaleX(14), VGAScaleY(11), VGAScaleX(306), VGAScaleY(189), (char *)curplace); fade(true, 0); @@ -161,7 +161,7 @@ void Intro::doPictText(const char *filename, bool isscreen) { } } - waitTOF(); + g_lab->waitTOF(); } else { cls = msg->msgClass; qualifier = msg->qualifier; @@ -226,9 +226,9 @@ void Intro::musicDelay() { for (counter = 0; counter < 20; counter++) { g_music->updateMusic(); - waitTOF(); - waitTOF(); - waitTOF(); + g_lab->waitTOF(); + g_lab->waitTOF(); + g_lab->waitTOF(); } } @@ -318,7 +318,7 @@ void Intro::introSequence() { palette[15] = temp; setAmigaPal(palette, 16); - waitTOF(); + g_lab->waitTOF(); } fade(false, 0); @@ -404,10 +404,10 @@ void Intro::introSequence() { diffcmap[counter1] = 255 - diffcmap[counter1]; g_music->updateMusic(); - waitTOF(); - VGASetPal(diffcmap, 256); - waitTOF(); - waitTOF(); + g_lab->waitTOF(); + g_lab->VGASetPal(diffcmap, 256); + g_lab-> waitTOF(); + g_lab->waitTOF(); } doPictText("i.12", false); @@ -464,8 +464,8 @@ void Intro::introSequence() { nReadPict("SubX", true); if (_quitIntro) { - setAPen(0); - rectFill(0, 0, g_lab->_screenWidth - 1, g_lab->_screenHeight - 1); + g_lab->setAPen(0); + g_lab->rectFill(0, 0, g_lab->_screenWidth - 1, g_lab->_screenHeight - 1); DoBlack = true; } } diff --git a/engines/lab/lab.cpp b/engines/lab/lab.cpp index c6f8006a55..fcd826b366 100644 --- a/engines/lab/lab.cpp +++ b/engines/lab/lab.cpp @@ -59,6 +59,20 @@ LabEngine::LabEngine(OSystem *syst, const ADGameDescription *gameDesc) _screenHeight = 200; _screenBytesPerPage = 65536; + _curapen = 0; + + _currentDsplayBuffer = 0; + _displayBuffer = 0; + + _lastWaitTOFTicks = 0; + + _mouseX = 0; + _mouseY = 0; + + _nextKeyIn = 0; + _nextKeyOut = 0; + _mouseAtEdge = false; + //const Common::FSNode gameDataDir(ConfMan.get("path")); //SearchMan.addSubDirectoryMatching(gameDataDir, "game"); //SearchMan.addSubDirectoryMatching(gameDataDir, "game/pict"); diff --git a/engines/lab/lab.h b/engines/lab/lab.h index e9d27aea39..36e2a43455 100644 --- a/engines/lab/lab.h +++ b/engines/lab/lab.h @@ -45,6 +45,12 @@ enum GameFeatures { GF_WINDOWS_TRIAL = 1 << 1 }; +struct Image { + uint16 Width; + uint16 Height; + byte *ImageData; +}; + #define ONESECOND 1000 class LabEngine : public Engine { @@ -83,6 +89,74 @@ private: // timing.cpp void microDelay(uint32 secs, uint32 micros); + + // vga.cpp + byte _curvgapal[256 * 3]; + byte _curapen; + +public: + byte *_currentDsplayBuffer; + + uint32 _mouseX; + uint32 _mouseY; + +private: + byte *_displayBuffer; + + int _lastWaitTOFTicks; + + uint16 _nextKeyIn; + uint16 _keyBuf[64]; + uint16 _nextKeyOut; + bool _mouseAtEdge; +public: + byte *_tempScrollData; + +private: + bool createScreen(bool HiRes); + +public: + void waitTOF(); + void setAPen(uint16 pennum); + void writeColorRegs(byte *buf, uint16 first, uint16 numreg); + byte *getVGABaseAddr(); + void readScreenImage(Image *Im, uint16 x, uint16 y); + void WSDL_UpdateScreen(); + void rectFill(uint16 x1, uint16 y1, uint16 x2, uint16 y2); + void scrollDisplayX(int16 dx, uint16 x1, uint16 y1, uint16 x2, uint16 y2); + void scrollDisplayY(int16 dy, uint16 x1, uint16 y1, uint16 x2, uint16 y2); + void ghoastRect(uint16 pencolor, uint16 x1, uint16 y1, uint16 x2, uint16 y2); + void bltBitMap(Image *ImSource, uint16 xs, uint16 ys, Image *ImDest, uint16 xd, uint16 yd, uint16 width, uint16 height); + void VGASetPal(void *cmap, uint16 numcolors); + void drawHLine(uint16 x, uint16 y1, uint16 y2); + void drawVLine(uint16 x1, uint16 y, uint16 x2); + void drawImage(Image *Im, uint16 x, uint16 y); + bool WSDL_HasNextChar(); + uint16 WSDL_GetNextChar(); + void WSDL_ProcessInput(bool can_delay); + void writeColorReg(byte *buf, uint16 regnum); + void writeColorRegsSmooth(byte *buf, uint16 first, uint16 numreg); + + void drawPanel(); + +private: + void quickWaitTOF(); + + /*---------- Drawing Routines ----------*/ + + void drawMaskImage(Image *Im, uint16 x, uint16 y); + void WSDL_GetMousePos(int *x, int *y); + void changeVolume(int delta); + void WSDL_SetColors(byte *buf, uint16 first, uint16 numreg, uint16 slow); + + // engine.cpp + bool setUpScreens(); + void perFlipGadget(uint16 gadID); + bool doCloseUp(CloseDataPtr cptr); + void mainGameLoop(); + bool doUse(uint16 curInv); + void mayShowCrumbIndicator(); + void mayShowCrumbIndicatorOff(); }; extern LabEngine *g_lab; diff --git a/engines/lab/labfun.h b/engines/lab/labfun.h index 5fac2e1157..1d2b5c640d 100644 --- a/engines/lab/labfun.h +++ b/engines/lab/labfun.h @@ -122,8 +122,6 @@ void gadgetsOnOff(void *gptr, void *win, int32 num, bool on); /*----------------------*/ void eatMessages(); -bool setUpScreens(); -void drawPanel(); bool quitPlaying(); /*---------------------------*/ diff --git a/engines/lab/labmusic.cpp b/engines/lab/labmusic.cpp index 50ba48dbb8..ed45bfa759 100644 --- a/engines/lab/labmusic.cpp +++ b/engines/lab/labmusic.cpp @@ -33,7 +33,6 @@ #include "lab/stddefines.h" #include "lab/labfun.h" #include "lab/mouse.h" -#include "lab/vga.h" #include "lab/lab.h" namespace Lab { @@ -72,7 +71,7 @@ Music::Music() { /* it from the Audio device. */ /*****************************************************************************/ void Music::updateMusic() { - WSDL_ProcessInput(0); + g_lab->WSDL_ProcessInput(0); updateMouse(); diff --git a/engines/lab/map.cpp b/engines/lab/map.cpp index 4ad9ba2511..fdec095f1a 100644 --- a/engines/lab/map.cpp +++ b/engines/lab/map.cpp @@ -32,7 +32,6 @@ #include "lab/stddefines.h" #include "lab/labfun.h" #include "lab/diff.h" -#include "lab/vga.h" #include "lab/text.h" #include "lab/mouse.h" #include "lab/parsefun.h" @@ -70,7 +69,7 @@ void setAmigaPal(uint16 *pal, uint16 numcolors) { vgapal[vgacount++] = (byte)(((pal[counter] & 0x00f)) << 2); } - writeColorRegsSmooth(vgapal, 0, 16); + g_lab->writeColorRegsSmooth(vgapal, 0, 16); } void decrypt(byte *text) { @@ -310,7 +309,7 @@ void fade(bool fadein, uint16 res) { } setAmigaPal(newpal, 16); - waitTOF(); + g_lab->waitTOF(); g_music->updateMusic(); } } @@ -371,27 +370,27 @@ static void drawRoom(uint16 CurRoom, bool drawx) { case UPARROWROOM: case DOWNARROWROOM: if (Maps[CurRoom].SpecialID == NORMAL) - drawImage(Room, x, y); + g_lab->drawImage(Room, x, y); else if (Maps[CurRoom].SpecialID == DOWNARROWROOM) - drawImage(DownArrowRoom, x, y); + g_lab->drawImage(DownArrowRoom, x, y); else - drawImage(UpArrowRoom, x, y); + g_lab->drawImage(UpArrowRoom, x, y); offset = (Room->Width - Path->Width) / 2; if ((NORTHDOOR & flags) && (y >= Path->Height)) - drawImage(Path, x + offset, y - Path->Height); + g_lab->drawImage(Path, x + offset, y - Path->Height); if (SOUTHDOOR & flags) - drawImage(Path, x + offset, y + Room->Height); + g_lab->drawImage(Path, x + offset, y + Room->Height); offset = (Room->Height - Path->Height) / 2; if (EASTDOOR & flags) - drawImage(Path, x + Room->Width, y + offset); + g_lab->drawImage(Path, x + Room->Width, y + offset); if (WESTDOOR & flags) - drawImage(Path, x - Path->Width, y + offset); + g_lab->drawImage(Path, x - Path->Width, y + offset); xx = x + (Room->Width - XMark->Width) / 2; xy = y + (Room->Height - XMark->Height) / 2; @@ -399,7 +398,7 @@ static void drawRoom(uint16 CurRoom, bool drawx) { break; case BRIDGEROOM: - drawImage(Bridge, x, y); + g_lab->drawImage(Bridge, x, y); xx = x + (Bridge->Width - XMark->Width) / 2; xy = y + (Bridge->Height - XMark->Height) / 2; @@ -407,37 +406,37 @@ static void drawRoom(uint16 CurRoom, bool drawx) { break; case VCORRIDOR: - drawImage(VRoom, x, y); + g_lab->drawImage(VRoom, x, y); offset = (VRoom->Width - Path->Width) / 2; if (NORTHDOOR & flags) - drawImage(Path, x + offset, y - Path->Height); + g_lab->drawImage(Path, x + offset, y - Path->Height); if (SOUTHDOOR & flags) - drawImage(Path, x + offset, y + VRoom->Height); + g_lab->drawImage(Path, x + offset, y + VRoom->Height); offset = (Room->Height - Path->Height) / 2; if (EASTDOOR & flags) - drawImage(Path, x + VRoom->Width, y + offset); + g_lab->drawImage(Path, x + VRoom->Width, y + offset); if (WESTDOOR & flags) - drawImage(Path, x - Path->Width, y + offset); + g_lab->drawImage(Path, x - Path->Width, y + offset); if (EASTBDOOR & flags) - drawImage(Path, x + VRoom->Width, y - offset - Path->Height + VRoom->Height); + g_lab->drawImage(Path, x + VRoom->Width, y - offset - Path->Height + VRoom->Height); if (WESTBDOOR & flags) - drawImage(Path, x - Path->Width, y - offset - Path->Height + VRoom->Height); + g_lab->drawImage(Path, x - Path->Width, y - offset - Path->Height + VRoom->Height); offset = (VRoom->Height - Path->Height) / 2; if (EASTMDOOR & flags) - drawImage(Path, x + VRoom->Width, y - offset - Path->Height + VRoom->Height); + g_lab->drawImage(Path, x + VRoom->Width, y - offset - Path->Height + VRoom->Height); if (WESTMDOOR & flags) - drawImage(Path, x - Path->Width, y - offset - Path->Height + VRoom->Height); + g_lab->drawImage(Path, x - Path->Width, y - offset - Path->Height + VRoom->Height); xx = x + (VRoom->Width - XMark->Width) / 2; xy = y + (VRoom->Height - XMark->Height) / 2; @@ -445,37 +444,37 @@ static void drawRoom(uint16 CurRoom, bool drawx) { break; case HCORRIDOR: - drawImage(HRoom, x, y); + g_lab->drawImage(HRoom, x, y); offset = (Room->Width - Path->Width) / 2; if (NORTHDOOR & flags) - drawImage(Path, x + offset, y - Path->Height); + g_lab->drawImage(Path, x + offset, y - Path->Height); if (SOUTHDOOR & flags) - drawImage(Path, x + offset, y + Room->Height); + g_lab->drawImage(Path, x + offset, y + Room->Height); if (NORTHRDOOR & flags) - drawImage(Path, x - offset - Path->Width + HRoom->Width, y - Path->Height); + g_lab->drawImage(Path, x - offset - Path->Width + HRoom->Width, y - Path->Height); if (SOUTHRDOOR & flags) - drawImage(Path, x - offset - Path->Width + HRoom->Width, y + Room->Height); + g_lab->drawImage(Path, x - offset - Path->Width + HRoom->Width, y + Room->Height); offset = (HRoom->Width - Path->Width) / 2; if (NORTHMDOOR & flags) - drawImage(Path, x - offset - Path->Width + HRoom->Width, y - Path->Height); + g_lab->drawImage(Path, x - offset - Path->Width + HRoom->Width, y - Path->Height); if (SOUTHMDOOR & flags) - drawImage(Path, x - offset - Path->Width + HRoom->Width, y + Room->Height); + g_lab->drawImage(Path, x - offset - Path->Width + HRoom->Width, y + Room->Height); offset = (Room->Height - Path->Height) / 2; if (EASTDOOR & flags) - drawImage(Path, x + HRoom->Width, y + offset); + g_lab->drawImage(Path, x + HRoom->Width, y + offset); if (WESTDOOR & flags) - drawImage(Path, x - Path->Width, y + offset); + g_lab->drawImage(Path, x - Path->Width, y + offset); xx = x + (HRoom->Width - XMark->Width) / 2; xy = y + (HRoom->Height - XMark->Height) / 2; @@ -487,7 +486,7 @@ static void drawRoom(uint16 CurRoom, bool drawx) { } if (drawx) - drawImage(XMark, xx, xy); + g_lab->drawImage(XMark, xx, xy); } @@ -582,10 +581,10 @@ static void drawMap(uint16 CurRoom, uint16 CurMsg, uint16 Floor, bool fadeout, b if (fadeout) fade(false, 0); - setAPen(0); - rectFill(0, 0, g_lab->_screenWidth - 1, g_lab->_screenHeight - 1); + g_lab->setAPen(0); + g_lab->rectFill(0, 0, g_lab->_screenWidth - 1, g_lab->_screenHeight - 1); - drawImage(Map, 0, 0); + g_lab->drawImage(Map, 0, 0); drawGadgetList(MapGadgetList); for (drawroom = 1; drawroom <= MaxRooms; drawroom++) { @@ -621,16 +620,16 @@ static void drawMap(uint16 CurRoom, uint16 CurMsg, uint16 Floor, bool fadeout, b // Labyrinth specific code if (Floor == LOWERFLOOR) { if (onFloor(SURMAZEFLOOR)) - drawImage(Maze, mapScaleX(538), mapScaleY(277)); + g_lab->drawImage(Maze, mapScaleX(538), mapScaleY(277)); } else if (Floor == MIDDLEFLOOR) { if (onFloor(CARNIVAL)) - drawImage(Maze, mapScaleX(358), mapScaleY(72)); + g_lab->drawImage(Maze, mapScaleX(358), mapScaleY(72)); if (onFloor(MEDMAZEFLOOR)) - drawImage(Maze, mapScaleX(557), mapScaleY(325)); + g_lab->drawImage(Maze, mapScaleX(557), mapScaleY(325)); } else if (Floor == UPPERFLOOR) { if (onFloor(HEDGEMAZEFLOOR)) - drawImage(HugeMaze, mapScaleX(524), mapScaleY(97)); + g_lab->drawImage(HugeMaze, mapScaleX(524), mapScaleY(97)); } else if (Floor == SURMAZEFLOOR) { sptr = (char *)g_resource->getStaticText(kTextSurmazeMessage).c_str(); flowText(MsgFont, 0, 7, 0, true, true, true, true, mapScaleX(360), 0, mapScaleX(660), mapScaleY(450), sptr); @@ -708,14 +707,14 @@ void processMap(uint16 CurRoom) { newcolor[2] = newcolor[1]; } - waitTOF(); - writeColorReg(newcolor, 1); + g_lab->waitTOF(); + g_lab->writeColorReg(newcolor, 1); updateMouse(); - waitTOF(); + g_lab->waitTOF(); updateMouse(); - waitTOF(); + g_lab->waitTOF(); updateMouse(); - waitTOF(); + g_lab->waitTOF(); updateMouse(); place++; @@ -822,8 +821,8 @@ void processMap(uint16 CurRoom) { if ((sptr = Rooms[CurMsg].RoomMsg)) { mouseHide(); - setAPen(3); - rectFill(VGAScaleX(13), VGAScaleY(148), VGAScaleX(135), VGAScaleY(186)); + g_lab->setAPen(3); + g_lab->rectFill(VGAScaleX(13), VGAScaleY(148), VGAScaleX(135), VGAScaleY(186)); flowText(MsgFont, 0, 5, 3, true, true, true, true, VGAScaleX(14), VGAScaleY(148), VGAScaleX(134), VGAScaleY(186), sptr); if (Maps[OldMsg].PageNumber == CurFloor) @@ -834,8 +833,8 @@ void processMap(uint16 CurRoom) { y1 = (y1 + y2) / 2; if ((CurMsg != CurRoom) && (Maps[CurMsg].PageNumber == CurFloor)) { - setAPen(1); - rectFill(x1 - 1, y1, x1, y1); + g_lab->setAPen(1); + g_lab->rectFill(x1 - 1, y1, x1, y1); } mouseShow(); @@ -844,7 +843,7 @@ void processMap(uint16 CurRoom) { } } - WSDL_UpdateScreen(); + g_lab->WSDL_UpdateScreen(); } } } @@ -872,18 +871,18 @@ void doMap(uint16 CurRoom) { drawMap(CurRoom, CurRoom, Maps[CurRoom].PageNumber, false, true); mouseShow(); attachGadgetList(MapGadgetList); - WSDL_UpdateScreen(); + g_lab->WSDL_UpdateScreen(); processMap(CurRoom); attachGadgetList(NULL); fade(false, 0); blackAllScreen(); mouseHide(); - setAPen(0); - rectFill(0, 0, g_lab->_screenWidth - 1, g_lab->_screenHeight - 1); + g_lab->setAPen(0); + g_lab->rectFill(0, 0, g_lab->_screenWidth - 1, g_lab->_screenHeight - 1); freeMapData(); blackAllScreen(); mouseShow(); - WSDL_UpdateScreen(); + g_lab->WSDL_UpdateScreen(); } } // End of namespace Lab diff --git a/engines/lab/mouse.cpp b/engines/lab/mouse.cpp index 292ac3cb17..ef483f7e2d 100644 --- a/engines/lab/mouse.cpp +++ b/engines/lab/mouse.cpp @@ -28,8 +28,8 @@ * */ +#include "lab/lab.h" #include "lab/mouse.h" -#include "lab/vga.h" #include "lab/stddefines.h" #include "lab/interface.h" @@ -81,14 +81,14 @@ static Gadget *checkGadgetHit(Gadget *gadlist, uint16 x, uint16 y) { hitgad = gadlist; } else { mouseHide(); - drawImage(gadlist->ImAlt, gadlist->x, gadlist->y); + g_lab->drawImage(gadlist->ImAlt, gadlist->x, gadlist->y); mouseShow(); for (counter = 0; counter < 3; counter++) - waitTOF(); + g_lab->waitTOF(); mouseHide(); - drawImage(gadlist->Im, gadlist->x, gadlist->y); + g_lab->drawImage(gadlist->Im, gadlist->x, gadlist->y); mouseShow(); } @@ -141,21 +141,21 @@ void updateMouse() { if (hitgad) { mouseHide(); - drawImage(hitgad->ImAlt, hitgad->x, hitgad->y); + g_lab->drawImage(hitgad->ImAlt, hitgad->x, hitgad->y); mouseShow(); for (counter = 0; counter < 3; counter++) - waitTOF(); + g_lab->waitTOF(); mouseHide(); - drawImage(hitgad->Im, hitgad->x, hitgad->y); + g_lab->drawImage(hitgad->Im, hitgad->x, hitgad->y); mouseShow(); doUpdateDisplay = true; hitgad = NULL; } if (doUpdateDisplay) - WSDL_UpdateScreen(); + g_lab->WSDL_UpdateScreen(); } @@ -178,7 +178,7 @@ void mouseShow() { NumHidden--; if ((NumHidden == 0) && MouseHidden) { - WSDL_ProcessInput(0); + g_lab->WSDL_ProcessInput(0); MouseHidden = false; } @@ -198,17 +198,13 @@ void mouseHide() { } } - -extern uint32 _mouseX; -extern uint32 _mouseY; - /*****************************************************************************/ /* Gets the current mouse co-ordinates. NOTE: On IBM version, will scale */ /* from virtual to screen co-ordinates automatically. */ /*****************************************************************************/ void mouseXY(uint16 *x, uint16 *y) { - *x = (uint16)_mouseX; - *y = (uint16)_mouseY; + *x = (uint16)g_lab->_mouseX; + *y = (uint16)g_lab->_mouseY; if (!IsHiRes) (*x) /= 2; @@ -225,7 +221,7 @@ void mouseMove(uint16 x, uint16 y) { g_system->warpMouse(x, y); if (!MouseHidden) - WSDL_ProcessInput(0); + g_lab->WSDL_ProcessInput(0); } @@ -237,15 +233,15 @@ void mouseMove(uint16 x, uint16 y) { bool mouseButton(uint16 *x, uint16 *y, bool leftbutton) { if (leftbutton) { if (LeftClick) { - *x = (!IsHiRes) ? (uint16)_mouseX / 2 : (uint16)_mouseX; - *y = (uint16)_mouseY; + *x = (!IsHiRes) ? (uint16)g_lab->_mouseX / 2 : (uint16)g_lab->_mouseX; + *y = (uint16)g_lab->_mouseY; LeftClick = false; return true; } } else { if (RightClick) { - *x = (!IsHiRes) ? (uint16)_mouseX / 2 : (uint16)_mouseX; - *y = (uint16)_mouseY; + *x = (!IsHiRes) ? (uint16)g_lab->_mouseX / 2 : (uint16)g_lab->_mouseX; + *y = (uint16)g_lab->_mouseY; RightClick = false; return true; } diff --git a/engines/lab/processroom.cpp b/engines/lab/processroom.cpp index d48a4ca807..e6e9d9135d 100644 --- a/engines/lab/processroom.cpp +++ b/engines/lab/processroom.cpp @@ -37,7 +37,6 @@ #include "lab/parsefun.h" #include "lab/resource.h" #include "lab/diff.h" -#include "lab/vga.h" #include "lab/interface.h" namespace Lab { @@ -484,7 +483,7 @@ static void doActions(Action * APtr, CloseDataPtr *LCPtr) { case WAITSECS: g_lab->addCurTime(APtr->Param1, 0, &StartSecs, &StartMicros); - WSDL_UpdateScreen(); + g_lab->WSDL_UpdateScreen(); while (1) { g_music->updateMusic(); @@ -524,7 +523,7 @@ static void doActions(Action * APtr, CloseDataPtr *LCPtr) { while (g_music->isSoundEffectActive()) { g_music->updateMusic(); diffNextFrame(); - waitTOF(); + g_lab->waitTOF(); } break; @@ -567,23 +566,23 @@ static void doActions(Action * APtr, CloseDataPtr *LCPtr) { for (counter = (8 * 3); counter < (255 * 3); counter++) diffcmap[counter] = 255 - diffcmap[counter]; - waitTOF(); - VGASetPal(diffcmap, 256); - waitTOF(); - waitTOF(); + g_lab->waitTOF(); + g_lab->VGASetPal(diffcmap, 256); + g_lab->waitTOF(); + g_lab->waitTOF(); } else if (APtr->Param1 == 4) { /* white the palette */ whiteScreen(); - waitTOF(); - waitTOF(); + g_lab->waitTOF(); + g_lab->waitTOF(); } else if (APtr->Param1 == 6) { /* Restore the palette */ - waitTOF(); - VGASetPal(diffcmap, 256); - waitTOF(); - waitTOF(); + g_lab->waitTOF(); + g_lab->VGASetPal(diffcmap, 256); + g_lab->waitTOF(); + g_lab->waitTOF(); } else if (APtr->Param1 == 7) { /* Quick pause */ - waitTOF(); - waitTOF(); - waitTOF(); + g_lab->waitTOF(); + g_lab->waitTOF(); + g_lab->waitTOF(); } break; @@ -599,7 +598,7 @@ static void doActions(Action * APtr, CloseDataPtr *LCPtr) { while (g_music->isSoundEffectActive()) { g_music->updateMusic(); diffNextFrame(); - waitTOF(); + g_lab->waitTOF(); } } diff --git a/engines/lab/readdiff.cpp b/engines/lab/readdiff.cpp index 421c2ce1ad..852b9c66b8 100644 --- a/engines/lab/readdiff.cpp +++ b/engines/lab/readdiff.cpp @@ -31,7 +31,6 @@ #include "lab/lab.h" #include "lab/diff.h" #include "lab/labfun.h" -#include "lab/vga.h" #include "lab/mouse.h" namespace Lab { @@ -91,7 +90,7 @@ void unDiff(byte *NewBuf, byte *OldBuf, byte *DiffData, uint16 bytesperrow, bool /*****************************************************************************/ void blackScreen() { memset(blackbuffer, 0, 248 * 3); - writeColorRegs(blackbuffer, 8, 248); + g_lab->writeColorRegs(blackbuffer, 8, 248); g_system->delayMillis(32); } @@ -101,7 +100,7 @@ void blackScreen() { /*****************************************************************************/ void whiteScreen() { memset(blackbuffer, 255, 248 * 3); - writeColorRegs(blackbuffer, 8, 248); + g_lab->writeColorRegs(blackbuffer, 8, 248); } /*****************************************************************************/ @@ -109,7 +108,7 @@ void whiteScreen() { /*****************************************************************************/ void blackAllScreen() { memset(blackbuffer, 0, 256 * 3); - writeColorRegs(blackbuffer, 0, 256); + g_lab->writeColorRegs(blackbuffer, 0, 256); g_system->delayMillis(32); } @@ -120,7 +119,7 @@ void diffNextFrame() { return; if (DispBitMap->Flags & BITMAPF_VIDEO) { - DispBitMap->Planes[0] = getVGABaseAddr(); + DispBitMap->Planes[0] = g_lab->getVGABaseAddr(); DispBitMap->Planes[1] = DispBitMap->Planes[0] + 0x10000; DispBitMap->Planes[2] = DispBitMap->Planes[1] + 0x10000; DispBitMap->Planes[3] = DispBitMap->Planes[2] + 0x10000; @@ -140,7 +139,7 @@ void diffNextFrame() { } if (IsPal && !nopalchange) { - VGASetPal(diffcmap, 256); + g_lab->VGASetPal(diffcmap, 256); IsPal = false; } @@ -148,7 +147,7 @@ void diffNextFrame() { } if (IsPal && !nopalchange && !IsBM && !donepal) { - VGASetPal(diffcmap, 256); + g_lab->VGASetPal(diffcmap, 256); IsPal = false; } @@ -163,7 +162,7 @@ void diffNextFrame() { CurBit = 0; if (DispBitMap->Flags & BITMAPF_VIDEO) - WSDL_UpdateScreen(); + g_lab->WSDL_UpdateScreen(); return; /* done with the next frame. */ } @@ -231,7 +230,7 @@ void diffNextFrame() { if (waitForEffect) { while (g_music->isSoundEffectActive()) { g_music->updateMusic(); - waitTOF(); + g_lab->waitTOF(); } } @@ -257,7 +256,7 @@ void diffNextFrame() { if (waitForEffect) { while (g_music->isSoundEffectActive()) { g_music->updateMusic(); - waitTOF(); + g_lab->waitTOF(); if (DispBitMap->Flags & BITMAPF_VIDEO) didTOF = 1; @@ -268,7 +267,7 @@ void diffNextFrame() { mouseShow(); if (!didTOF) - WSDL_UpdateScreen(); + g_lab->WSDL_UpdateScreen(); return; } @@ -445,7 +444,7 @@ void readSound(bool waitTillFinished, Common::File *file) { if (waitTillFinished) { while (g_music->isSoundEffectActive()) { g_music->updateMusic(); - waitTOF(); + g_lab->waitTOF(); } } @@ -460,7 +459,7 @@ void readSound(bool waitTillFinished, Common::File *file) { if (waitTillFinished) { while (g_music->isSoundEffectActive()) { g_music->updateMusic(); - waitTOF(); + g_lab->waitTOF(); } } } else diff --git a/engines/lab/special.cpp b/engines/lab/special.cpp index 0104e3ee3f..16940e1cbc 100644 --- a/engines/lab/special.cpp +++ b/engines/lab/special.cpp @@ -38,7 +38,6 @@ #include "lab/parsefun.h" #include "lab/interface.h" #include "lab/diff.h" -#include "lab/vga.h" #include "lab/text.h" #include "lab/mouse.h" #include "lab/stddefines.h" @@ -89,7 +88,6 @@ extern uint16 *FadePalette; extern bool nopalchange, DoBlack, IsHiRes; extern BitMap *DispBitMap, *DrawBitMap; extern char diffcmap[3 * 256]; -extern byte *_tempScrollData; extern CloseDataPtr CPtr; extern InventoryData *Inventory; extern uint16 RoomNum, Direction; @@ -141,7 +139,7 @@ static void doCombination() { uint16 counter; for (counter = 0; counter <= 5; counter++) - drawImage(Images[combination[counter]], VGAScaleX(combx[counter]), VGAScaleY(65)); + g_lab->drawImage(Images[combination[counter]], VGAScaleX(combx[counter]), VGAScaleY(65)); } /*****************************************************************************/ @@ -164,11 +162,11 @@ void showCombination(const char *filename) { for (CurBit = 0; CurBit < 10; CurBit++) readImage(buffer, &(Images[CurBit])); - allocFile((void **)&_tempScrollData, Images[0]->Width * Images[0]->Height * 2L, "tempdata"); + allocFile((void **)&g_lab->_tempScrollData, Images[0]->Width * Images[0]->Height * 2L, "tempdata"); doCombination(); - VGASetPal(diffcmap, 256); + g_lab->VGASetPal(diffcmap, 256); } @@ -188,22 +186,22 @@ static void changeCombination(uint16 number) { combnum = combination[number]; - display.ImageData = getVGABaseAddr(); + display.ImageData = g_lab->getVGABaseAddr(); display.Width = g_lab->_screenWidth; display.Height = g_lab->_screenHeight; for (counter = 1; counter <= (Images[combnum]->Height / 2); counter++) { if (IsHiRes) { if (counter & 1) - waitTOF(); + g_lab->waitTOF(); } else - waitTOF(); + g_lab->waitTOF(); - display.ImageData = getVGABaseAddr(); + display.ImageData = g_lab->getVGABaseAddr(); - scrollDisplayY(2, VGAScaleX(combx[number]), VGAScaleY(65), VGAScaleX(combx[number]) + (Images[combnum])->Width - 1, VGAScaleY(65) + (Images[combnum])->Height); + g_lab->scrollDisplayY(2, VGAScaleX(combx[number]), VGAScaleY(65), VGAScaleX(combx[number]) + (Images[combnum])->Width - 1, VGAScaleY(65) + (Images[combnum])->Height); - bltBitMap(Images[combnum], 0, (Images[combnum])->Height - (2 * counter), &(display), VGAScaleX(combx[number]), VGAScaleY(65), (Images[combnum])->Width, 2); + g_lab->bltBitMap(Images[combnum], 0, (Images[combnum])->Height - (2 * counter), &(display), VGAScaleX(combx[number]), VGAScaleY(65), (Images[combnum])->Width, 2); } for (counter = 0; counter < 6; counter++) @@ -259,8 +257,8 @@ static void doTile(bool showsolution) { rows = VGAScaleY(31); cols = VGAScaleX(105); } else { - setAPen(0); - rectFill(VGAScaleX(97), VGAScaleY(22), VGAScaleX(220), VGAScaleY(126)); + g_lab->setAPen(0); + g_lab->rectFill(VGAScaleX(97), VGAScaleY(22), VGAScaleX(220), VGAScaleY(126)); rowm = VGAScaleY(25); colm = VGAScaleX(30); @@ -277,7 +275,7 @@ static void doTile(bool showsolution) { num = CurTile[col] [row]; if (showsolution || num) - drawImage(Tiles[num], cols + (col * colm), rows + (row * rowm)); + g_lab->drawImage(Tiles[num], cols + (col * colm), rows + (row * rowm)); col++; } @@ -315,19 +313,19 @@ void showTile(const char *filename, bool showsolution) { for (CurBit = start; CurBit < 16; CurBit++) readImage(buffer, &(Tiles[CurBit])); - allocFile((void **)&_tempScrollData, Tiles[1]->Width * Tiles[1]->Height * 2L, "tempdata"); + allocFile((void **)&g_lab->_tempScrollData, Tiles[1]->Width * Tiles[1]->Height * 2L, "tempdata"); doTile(showsolution); - VGASetPal(diffcmap, 256); + g_lab->VGASetPal(diffcmap, 256); } static void scrollRaster(int16 dx, int16 dy, uint16 x1, uint16 y1, uint16 x2, uint16 y2) { if (dx) - scrollDisplayX(dx, x1, y1, x2, y2); + g_lab->scrollDisplayX(dx, x1, y1, x2, y2); if (dy) - scrollDisplayY(dy, x1, y1, x2, y2); + g_lab->scrollDisplayY(dy, x1, y1, x2, y2); } /*****************************************************************************/ @@ -364,7 +362,7 @@ static void doTileScroll(uint16 col, uint16 row, uint16 scrolltype) { y1 = VGAScaleY(25) + (row * VGAScaleY(25)) + dy; for (counter = 0; counter < last; counter++) { - waitTOF(); + g_lab->waitTOF(); scrollRaster(dX, dY, x1, y1, x1 + VGAScaleX(28) + sx, y1 + VGAScaleY(23) + sy); x1 += dX; y1 += dY; @@ -479,7 +477,7 @@ void doNotes() { flowText(BigMsgFont, -2 + SVGACord(1), 0, 0, false, false, true, true, VGAScaleX(25) + SVGACord(15), VGAScaleY(50), VGAScaleX(295) - SVGACord(15), VGAScaleY(148), ntext); - VGASetPal(diffcmap, 256); + g_lab->VGASetPal(diffcmap, 256); freeAllStolenMem(); } @@ -541,7 +539,7 @@ void doWestPaper() { CharsPrinted = flowText(BigMsgFont, -4, 0, 0, false, false, false, true, VGAScaleX(162), VGAScaleY(y), VGAScaleX(275), VGAScaleY(148), ntext); - VGASetPal(diffcmap, 256); + g_lab->VGASetPal(diffcmap, 256); freeAllStolenMem(); } @@ -675,16 +673,16 @@ static void turnPage(bool FromLeft) { if (FromLeft) { for (counter = 0; counter < g_lab->_screenWidth; counter += 8) { g_music->updateMusic(); - waitTOF(); - ScreenImage.ImageData = getVGABaseAddr(); - bltBitMap(&JBackImage, counter, 0, &ScreenImage, counter, 0, 8, g_lab->_screenHeight); + g_lab->waitTOF(); + ScreenImage.ImageData = g_lab->getVGABaseAddr(); + g_lab->bltBitMap(&JBackImage, counter, 0, &ScreenImage, counter, 0, 8, g_lab->_screenHeight); } } else { for (counter = (g_lab->_screenWidth - 8); counter > 0; counter -= 8) { g_music->updateMusic(); - waitTOF(); - ScreenImage.ImageData = getVGABaseAddr(); - bltBitMap(&JBackImage, counter, 0, &ScreenImage, counter, 0, 8, g_lab->_screenHeight); + g_lab->waitTOF(); + ScreenImage.ImageData = g_lab->getVGABaseAddr(); + g_lab->bltBitMap(&JBackImage, counter, 0, &ScreenImage, counter, 0, 8, g_lab->_screenHeight); } } } @@ -703,10 +701,10 @@ static void drawJournal(uint16 wipenum, bool needFade) { drawJournalText(); - ScreenImage.ImageData = getVGABaseAddr(); + ScreenImage.ImageData = g_lab->getVGABaseAddr(); if (wipenum == 0) - bltBitMap(&JBackImage, 0, 0, &ScreenImage, 0, 0, g_lab->_screenWidth, g_lab->_screenHeight); + g_lab->bltBitMap(&JBackImage, 0, 0, &ScreenImage, 0, 0, g_lab->_screenWidth, g_lab->_screenHeight); else turnPage((bool)(wipenum == 1)); @@ -794,7 +792,7 @@ void doJournal() { CancelG.NextGadget = &ForwardG; ScreenImage = JBackImage; - ScreenImage.ImageData = getVGABaseAddr(); + ScreenImage.ImageData = g_lab->getVGABaseAddr(); g_music->updateMusic(); loadJournalData(); @@ -808,10 +806,10 @@ void doJournal() { fade(false, 0); mouseHide(); - ScreenImage.ImageData = getVGABaseAddr(); + ScreenImage.ImageData = g_lab->getVGABaseAddr(); - setAPen(0); - rectFill(0, 0, g_lab->_screenWidth - 1, g_lab->_screenHeight - 1); + g_lab->setAPen(0); + g_lab->rectFill(0, 0, g_lab->_screenWidth - 1, g_lab->_screenHeight - 1); blackScreen(); freeAllStolenMem(); @@ -852,7 +850,7 @@ bool saveRestoreGame() { } } - WSDL_UpdateScreen(); + g_lab->WSDL_UpdateScreen(); return isOK; } @@ -903,17 +901,17 @@ static void drawMonText(char *text, uint16 x1, uint16 y1, uint16 x2, uint16 y2, else MonGadHeight = fheight; - setAPen(0); - rectFill(0, 0, g_lab->_screenWidth - 1, y2); + g_lab->setAPen(0); + g_lab->rectFill(0, 0, g_lab->_screenWidth - 1, y2); for (counter = 0; counter < numlines; counter++) - drawImage(MonButton, 0, counter * MonGadHeight); + g_lab->drawImage(MonButton, 0, counter * MonGadHeight); } else if (isinteractive) { - setAPen(0); - rectFill(0, 0, g_lab->_screenWidth - 1, y2); + g_lab->setAPen(0); + g_lab->rectFill(0, 0, g_lab->_screenWidth - 1, y2); } else { - setAPen(0); - rectFill(x1, y1, x2, y2); + g_lab->setAPen(0); + g_lab->rectFill(x1, y1, x2, y2); } while (DrawingToPage < monitorPage) { @@ -1083,8 +1081,8 @@ void doMonitor(char *background, char *textfile, bool isinteractive, uint16 x1, freeAllStolenMem(); - setAPen(0); - rectFill(0, 0, g_lab->_screenWidth - 1, g_lab->_screenHeight - 1); + g_lab->setAPen(0); + g_lab->rectFill(0, 0, g_lab->_screenWidth - 1, g_lab->_screenHeight - 1); blackAllScreen(); } diff --git a/engines/lab/text.cpp b/engines/lab/text.cpp index 36b0116314..cf920d3f43 100644 --- a/engines/lab/text.cpp +++ b/engines/lab/text.cpp @@ -32,7 +32,6 @@ #include "lab/stddefines.h" #include "lab/labfun.h" #include "lab/text.h" -#include "lab/vga.h" namespace Lab { @@ -81,7 +80,7 @@ void text(struct TextFont *tf, uint16 x, uint16 y, uint16 color, const char *tex int32 templeft, LeftInSegment; uint16 counter, counterb, bwidth, mask, curpage, rows, cols, data; - VGATop = getVGABaseAddr(); + VGATop = g_lab->getVGABaseAddr(); for (counter = 0; counter < numchars; counter++) { RealOffset = (g_lab->_screenWidth * y) + x; diff --git a/engines/lab/timing.cpp b/engines/lab/timing.cpp index ca767550dc..ba3dd40846 100644 --- a/engines/lab/timing.cpp +++ b/engines/lab/timing.cpp @@ -29,7 +29,6 @@ */ #include "lab/lab.h" -#include "lab/vga.h" namespace Lab { diff --git a/engines/lab/vga.cpp b/engines/lab/vga.cpp index 54cb50756d..c1d526b53a 100644 --- a/engines/lab/vga.cpp +++ b/engines/lab/vga.cpp @@ -29,7 +29,6 @@ */ #include "lab/lab.h" -#include "lab/vga.h" #include "lab/stddefines.h" #include "lab/mouse.h" @@ -39,27 +38,10 @@ namespace Lab { -static byte _curvgapal[256 * 3]; -static unsigned char _curapen = 0; - -byte *_currentDsplayBuffer = 0; -byte *_displayBuffer = 0; - -int _lastWaitTOFTicks = 0; - -uint32 _mouseX = 0; -uint32 _mouseY = 0; - -uint16 _nextKeyIn = 0; -uint16 _keyBuf[64]; -uint16 _nextKeyOut = 0; -bool _mouseAtEdge = false; -byte *_tempScrollData; - /*****************************************************************************/ /* Sets up either a low-res or a high-res 256 color screen. */ /*****************************************************************************/ -bool createScreen(bool HiRes) { +bool LabEngine::createScreen(bool HiRes) { if (HiRes) { g_lab->_screenWidth = 640; g_lab->_screenHeight = 480; @@ -77,11 +59,11 @@ bool createScreen(bool HiRes) { /*****************************************************************************/ /* Sets the current page on the VGA card. */ /*****************************************************************************/ -void changeVolume(int delta) { +void LabEngine::changeVolume(int delta) { warning("STUB: changeVolume()"); } -uint16 WSDL_GetNextChar() { +uint16 LabEngine::WSDL_GetNextChar() { uint16 c = 0; WSDL_ProcessInput(0); @@ -94,12 +76,12 @@ uint16 WSDL_GetNextChar() { return c; } -bool WSDL_HasNextChar() { +bool LabEngine::WSDL_HasNextChar() { WSDL_ProcessInput(0); return _nextKeyIn != _nextKeyOut; } -void WSDL_ProcessInput(bool can_delay) { +void LabEngine::WSDL_ProcessInput(bool can_delay) { int n; int lastMouseAtEdge; int flags = 0; @@ -186,14 +168,14 @@ void WSDL_ProcessInput(bool can_delay) { g_system->delayMillis(10); } -void WSDL_GetMousePos(int *x, int *y) { +void LabEngine::WSDL_GetMousePos(int *x, int *y) { WSDL_ProcessInput(0); *x = _mouseX; *y = _mouseY; } -void waitTOF() { +void LabEngine::waitTOF() { g_system->copyRectToScreen(_displayBuffer, g_lab->_screenWidth, 0, 0, g_lab->_screenWidth, g_lab->_screenHeight); g_system->updateScreen(); @@ -207,7 +189,7 @@ void waitTOF() { _lastWaitTOFTicks = now; } -void WSDL_SetColors(byte *buf, uint16 first, uint16 numreg, uint16 slow) { +void LabEngine::WSDL_SetColors(byte *buf, uint16 first, uint16 numreg, uint16 slow) { byte tmp[256 * 3]; for (int i = 0; i < 256 * 3; i++) { @@ -231,12 +213,12 @@ void WSDL_SetColors(byte *buf, uint16 first, uint16 numreg, uint16 slow) { /* The length of the buffer is 3 times the number of registers */ /* selected. */ /*****************************************************************************/ -void writeColorRegs(byte *buf, uint16 first, uint16 numreg) { +void LabEngine::writeColorRegs(byte *buf, uint16 first, uint16 numreg) { WSDL_SetColors(buf, first, numreg, 0); memcpy(&(_curvgapal[first * 3]), buf, numreg * 3); } -void writeColorRegsSmooth(byte *buf, uint16 first, uint16 numreg) { +void LabEngine::writeColorRegsSmooth(byte *buf, uint16 first, uint16 numreg) { WSDL_SetColors(buf, first, numreg, 1); memcpy(&(_curvgapal[first * 3]), buf, numreg * 3); } @@ -246,16 +228,16 @@ void writeColorRegsSmooth(byte *buf, uint16 first, uint16 numreg) { /* the first character in the string is the red value, then green, then */ /* blue. Each color value is a 6 bit value. */ /*****************************************************************************/ -void writeColorReg(byte *buf, uint16 regnum) { +void LabEngine::writeColorReg(byte *buf, uint16 regnum) { writeColorRegs(buf, regnum, 1); } -void VGASetPal(void *cmap, uint16 numcolors) { +void LabEngine::VGASetPal(void *cmap, uint16 numcolors) { if (memcmp(cmap, _curvgapal, numcolors * 3) != 0) writeColorRegs((byte *)cmap, 0, numcolors); } -void WSDL_UpdateScreen() { +void LabEngine::WSDL_UpdateScreen() { g_system->copyRectToScreen(_displayBuffer, g_lab->_screenWidth, 0, 0, g_lab->_screenWidth, g_lab->_screenHeight); g_system->updateScreen(); @@ -265,7 +247,7 @@ void WSDL_UpdateScreen() { /*****************************************************************************/ /* Returns the base address of the current VGA display. */ /*****************************************************************************/ -byte *getVGABaseAddr() { +byte *LabEngine::getVGABaseAddr() { if (_currentDsplayBuffer) return _currentDsplayBuffer; @@ -275,7 +257,7 @@ byte *getVGABaseAddr() { /*****************************************************************************/ /* Draws an image to the screen. */ /*****************************************************************************/ -void drawImage(Image *Im, uint16 x, uint16 y) { +void LabEngine::drawImage(Image *Im, uint16 x, uint16 y) { int sx, sy, dx, dy, w, h; sx = 0; @@ -318,7 +300,7 @@ void drawImage(Image *Im, uint16 x, uint16 y) { /*****************************************************************************/ /* Draws an image to the screen. */ /*****************************************************************************/ -void drawMaskImage(Image *Im, uint16 x, uint16 y) { +void LabEngine::drawMaskImage(Image *Im, uint16 x, uint16 y) { int sx, sy, dx, dy, w, h; sx = 0; @@ -371,7 +353,7 @@ void drawMaskImage(Image *Im, uint16 x, uint16 y) { /*****************************************************************************/ /* Reads an image from the screen. */ /*****************************************************************************/ -void readScreenImage(Image *Im, uint16 x, uint16 y) { +void LabEngine::readScreenImage(Image *Im, uint16 x, uint16 y) { int sx, sy, dx, dy, w, h; sx = 0; @@ -415,7 +397,7 @@ void readScreenImage(Image *Im, uint16 x, uint16 y) { /* Blits a piece of one image to another. */ /* NOTE: for our purposes, assumes that ImDest is to be in VGA memory. */ /*****************************************************************************/ -void bltBitMap(Image *ImSource, uint16 xs, uint16 ys, Image *ImDest, +void LabEngine::bltBitMap(Image *ImSource, uint16 xs, uint16 ys, Image *ImDest, uint16 xd, uint16 yd, uint16 width, uint16 height) { // I think the old code assumed that the source image data was valid for the given box. // I will proceed on that assumption. @@ -461,7 +443,7 @@ void bltBitMap(Image *ImSource, uint16 xs, uint16 ys, Image *ImDest, /* The _tempScrollData variable must be initialized to some memory, or this */ /* function will fail. */ /*****************************************************************************/ -void scrollDisplayX(int16 dx, uint16 x1, uint16 y1, uint16 x2, uint16 y2) { +void LabEngine::scrollDisplayX(int16 dx, uint16 x1, uint16 y1, uint16 x2, uint16 y2) { Image Im; uint16 temp; @@ -503,7 +485,7 @@ void scrollDisplayX(int16 dx, uint16 x1, uint16 y1, uint16 x2, uint16 y2) { /*****************************************************************************/ /* Scrolls the display in the y direction by blitting. */ /*****************************************************************************/ -void scrollDisplayY(int16 dy, uint16 x1, uint16 y1, uint16 x2, uint16 y2) { +void LabEngine::scrollDisplayY(int16 dy, uint16 x1, uint16 y1, uint16 x2, uint16 y2) { Image Im; uint16 temp; @@ -545,14 +527,14 @@ void scrollDisplayY(int16 dy, uint16 x1, uint16 y1, uint16 x2, uint16 y2) { /*****************************************************************************/ /* Sets the pen number to use on all the drawing operations. */ /*****************************************************************************/ -void setAPen(uint16 pennum) { +void LabEngine::setAPen(uint16 pennum) { _curapen = (unsigned char)pennum; } /*****************************************************************************/ /* Fills in a rectangle. */ /*****************************************************************************/ -void rectFill(uint16 x1, uint16 y1, uint16 x2, uint16 y2) { +void LabEngine::rectFill(uint16 x1, uint16 y1, uint16 x2, uint16 y2) { int dx, dy, w, h; dx = x1; @@ -595,21 +577,21 @@ void rectFill(uint16 x1, uint16 y1, uint16 x2, uint16 y2) { /*****************************************************************************/ /* Draws a horizontal line. */ /*****************************************************************************/ -void drawVLine(uint16 x, uint16 y1, uint16 y2) { +void LabEngine::drawVLine(uint16 x, uint16 y1, uint16 y2) { rectFill(x, y1, x, y2); } /*****************************************************************************/ /* Draws a vertical line. */ /*****************************************************************************/ -void drawHLine(uint16 x1, uint16 y, uint16 x2) { +void LabEngine::drawHLine(uint16 x1, uint16 y, uint16 x2) { rectFill(x1, y, x2, y); } /*****************************************************************************/ /* Ghoasts a region on the screen using the desired pen color. */ /*****************************************************************************/ -void ghoastRect(uint16 pencolor, uint16 x1, uint16 y1, uint16 x2, uint16 y2) { +void LabEngine::ghoastRect(uint16 pencolor, uint16 x1, uint16 y1, uint16 x2, uint16 y2) { int dx, dy, w, h; dx = x1; diff --git a/engines/lab/vga.h b/engines/lab/vga.h deleted file mode 100644 index ade6a2ac79..0000000000 --- a/engines/lab/vga.h +++ /dev/null @@ -1,74 +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. - * - */ - -/* - * This code is based on Labyrinth of Time code with assistance of - * - * Copyright (c) 1993 Terra Nova Development - * Copyright (c) 2004 The Wyrmkeep Entertainment Co. - * - */ - -#include "lab/stddefines.h" - -#ifndef LAB_VGA_H -#define LAB_VGA_H - -namespace Lab { - -struct Image { - uint16 Width; - uint16 Height; - byte *ImageData; -}; - -bool createScreen(bool HiRes); -void waitTOF(); -void quickWaitTOF(); -byte *getVGABaseAddr(); -void writeColorReg(byte *buf, uint16 regnum); -void writeColorRegs(byte *buf, uint16 first, uint16 numreg); -void writeColorRegsSmooth(byte *buf, uint16 first, uint16 numreg); -void VGASetPal(void *cmap, uint16 numcolors); - -/*---------- Drawing Routines ----------*/ - -void drawImage(Image *Im, uint16 x, uint16 y); -void drawMaskImage(Image *Im, uint16 x, uint16 y); -void readScreenImage(Image *Im, uint16 x, uint16 y); -void bltBitMap(Image *ImSource, uint16 xs, uint16 ys, Image *ImDest, uint16 xd, uint16 yd, uint16 width, uint16 height); -void scrollDisplayX(int16 dx, uint16 x1, uint16 y1, uint16 x2, uint16 y2); -void scrollDisplayY(int16 dy, uint16 x1, uint16 y1, uint16 x2, uint16 y2); -void setAPen(uint16 pennum); -void drawHLine(uint16 x, uint16 y1, uint16 y2); -void drawVLine(uint16 x1, uint16 y, uint16 x2); -void rectFill(uint16 x1, uint16 y1, uint16 x2, uint16 y2); -void ghoastRect(uint16 pencolor, uint16 x1, uint16 y1, uint16 x2, uint16 y2); -void WSDL_UpdateScreen(); -void WSDL_GetMousePos(int *x, int *y); -uint16 WSDL_GetNextChar(); -bool WSDL_HasNextChar(); -void WSDL_ProcessInput(bool can_delay); - -} // End of namespace Lab - -#endif /* LAB_VGA_H */ -- cgit v1.2.3 From b76a624c9ae59aac7df11ad5df7d39879d3344c8 Mon Sep 17 00:00:00 2001 From: Strangerke Date: Fri, 27 Nov 2015 21:52:31 +0100 Subject: LAB: Fix several cppcheck errors --- engines/lab/allocroom.cpp | 17 +++++++---------- engines/lab/detection.cpp | 2 +- engines/lab/engine.cpp | 7 +++---- engines/lab/interface.cpp | 4 ++-- engines/lab/processroom.cpp | 10 +++++----- engines/lab/special.cpp | 3 +-- engines/lab/vga.cpp | 15 +++++++-------- 7 files changed, 26 insertions(+), 32 deletions(-) diff --git a/engines/lab/allocroom.cpp b/engines/lab/allocroom.cpp index 2d7016d3ee..22dfae6181 100644 --- a/engines/lab/allocroom.cpp +++ b/engines/lab/allocroom.cpp @@ -99,7 +99,7 @@ static void freeRoom(uint16 RMarker) { Rooms[RoomNum].WestView = NULL; RuleList *rules = Rooms[RoomNum].rules; - for (RuleList::iterator rule = rules->begin(); rule != rules->end(); rule++) + for (RuleList::iterator rule = rules->begin(); rule != rules->end(); ++rule) delete *rule; Rooms[RoomNum].rules->clear(); delete Rooms[RoomNum].rules; @@ -119,28 +119,25 @@ static void freeRoom(uint16 RMarker) { /* Gets a chunk of memory from the buffer. */ /*****************************************************************************/ static void *getCurMem(uint16 Size) { - uint16 counter; - void *Ptr, *Start0, *Start1, *End0, *End1; - if (((int32) Size) > MemLeftInBuffer) { MemPlace = RoomBuffer; MemLeftInBuffer = ROOMBUFFERSIZE; NextMemPlace = NULL; } - Ptr = MemPlace; + void *Ptr = MemPlace; MemPlace = (char *)MemPlace + Size; MemLeftInBuffer -= Size; if (MemPlace > NextMemPlace) { NextMemPlace = NULL; - for (counter = 0; counter < MAXMARKERS; counter++) { + for (uint16 counter = 0; counter < MAXMARKERS; counter++) { if (RoomMarkers[counter].RoomNum != EMPTYROOM) { - Start0 = RoomMarkers[counter].Start0; - Start1 = RoomMarkers[counter].Start1; - End0 = RoomMarkers[counter].End0; - End1 = RoomMarkers[counter].End1; + void *Start0 = RoomMarkers[counter].Start0; + void *Start1 = RoomMarkers[counter].Start1; + void *End0 = RoomMarkers[counter].End0; + void *End1 = RoomMarkers[counter].End1; if (((Start0 >= Ptr) && (Start0 < MemPlace)) || ((End0 >= Ptr) && (End0 < MemPlace)) || diff --git a/engines/lab/detection.cpp b/engines/lab/detection.cpp index 1da269ecad..ddb6aa32a8 100644 --- a/engines/lab/detection.cpp +++ b/engines/lab/detection.cpp @@ -186,7 +186,7 @@ SaveStateList LabMetaEngine::listSaves(const char *target) const { SaveStateList saveList; - for (Common::StringArray::const_iterator file = filenames.begin(); file != filenames.end(); file++) { + for (Common::StringArray::const_iterator file = filenames.begin(); file != filenames.end(); ++file) { // Obtain the last 3 digits of the filename, since they correspond to the save slot int slotNum = atoi(file->c_str() + file->size() - 3); diff --git a/engines/lab/engine.cpp b/engines/lab/engine.cpp index 18178d3972..2c56f5fa72 100644 --- a/engines/lab/engine.cpp +++ b/engines/lab/engine.cpp @@ -1307,10 +1307,8 @@ from_crumbs: void LabEngine::go() { - bool mem, dointro = false; uint16 counter; - - dointro = true; + bool dointro = true; IsHiRes = ((getFeatures() & GF_LOWRES) == 0); @@ -1320,6 +1318,8 @@ void LabEngine::go() { else warning("Running in LowRes mode"); #endif + + bool mem = false; if (initBuffer(BUFFERSIZE, true)) { mem = true; } else { @@ -1345,7 +1345,6 @@ void LabEngine::go() { if (dointro && mem) { Intro intro; - intro.introSequence(); } else DoBlack = true; diff --git a/engines/lab/interface.cpp b/engines/lab/interface.cpp index 54a7e13499..36891d7fe8 100644 --- a/engines/lab/interface.cpp +++ b/engines/lab/interface.cpp @@ -64,10 +64,10 @@ Gadget *createButton(uint16 x, uint16 y, uint16 id, uint16 key, Image *im, Image void freeButtonList(Gadget *gptrlist) { - Gadget *gptr, *next = gptrlist; + Gadget *next = gptrlist; while (next) { - gptr = next; + Gadget *gptr = next; next = next->NextGadget; free(gptr); diff --git a/engines/lab/processroom.cpp b/engines/lab/processroom.cpp index e6e9d9135d..fd5ec73670 100644 --- a/engines/lab/processroom.cpp +++ b/engines/lab/processroom.cpp @@ -619,7 +619,7 @@ static bool doActionRuleSub(int16 action, int16 roomNum, CloseDataPtr LCPtr, Clo rules = Rooms[roomNum].rules; } - for (RuleList::iterator rule = rules->begin(); rule != rules->end(); rule++) { + for (RuleList::iterator rule = rules->begin(); rule != rules->end(); ++rule) { if (((*rule)->RuleType == ACTION) && (((*rule)->Param1 == action) || (((*rule)->Param1 == 0) && AllowDefaults))) { if ((((*rule)->Param2 == LCPtr->CloseUpType) || @@ -676,7 +676,7 @@ static bool doOperateRuleSub(int16 ItemNum, int16 roomNum, CloseDataPtr LCPtr, C rules = Rooms[roomNum].rules; } - for (RuleList::iterator rule = rules->begin(); rule != rules->end(); rule++) { + for (RuleList::iterator rule = rules->begin(); rule != rules->end(); ++rule) { if (((*rule)->RuleType == OPERATE) && (((*rule)->Param1 == ItemNum) || (((*rule)->Param1 == 0) && AllowDefaults)) && (((*rule)->Param2 == LCPtr->CloseUpType) || (((*rule)->Param2 == 0) && AllowDefaults))) { @@ -731,7 +731,7 @@ bool doOperateRule(int16 x, int16 y, int16 ItemNum, CloseDataPtr *LCPtr) { bool doGoForward(CloseDataPtr *LCPtr) { RuleList *rules = Rooms[RoomNum].rules; - for (RuleList::iterator rule = rules->begin(); rule != rules->end(); rule++) { + for (RuleList::iterator rule = rules->begin(); rule != rules->end(); ++rule) { if (((*rule)->RuleType == GOFORWARD) && ((*rule)->Param1 == (Direction + 1))) { if (checkConditions((*rule)->Condition)) { doActions((*rule)->ActionList, LCPtr); @@ -752,7 +752,7 @@ bool doTurn(uint16 from, uint16 to, CloseDataPtr *LCPtr) { RuleList *rules = Rooms[RoomNum].rules; - for (RuleList::iterator rule = rules->begin(); rule != rules->end(); rule++) { + for (RuleList::iterator rule = rules->begin(); rule != rules->end(); ++rule) { if (((*rule)->RuleType == TURN) || (((*rule)->RuleType == TURNFROMTO) && ((*rule)->Param1 == from) && ((*rule)->Param2 == to))) { @@ -771,7 +771,7 @@ bool doTurn(uint16 from, uint16 to, CloseDataPtr *LCPtr) { /*****************************************************************************/ bool doMainView(CloseDataPtr *LCPtr) { RuleList *rules = Rooms[RoomNum].rules; - for (RuleList::iterator rule = rules->begin(); rule != rules->end(); rule++) { + for (RuleList::iterator rule = rules->begin(); rule != rules->end(); ++rule) { if ((*rule)->RuleType == GOMAINVIEW) { if (checkConditions((*rule)->Condition)) { doActions((*rule)->ActionList, LCPtr); diff --git a/engines/lab/special.cpp b/engines/lab/special.cpp index 16940e1cbc..1ee539f20b 100644 --- a/engines/lab/special.cpp +++ b/engines/lab/special.cpp @@ -373,7 +373,6 @@ static void doTileScroll(uint16 col, uint16 row, uint16 scrolltype) { /* Changes the combination number of one of the slots */ /*****************************************************************************/ static void changeTile(uint16 col, uint16 row) { - bool check; int16 scrolltype = -1; if (row > 0) { @@ -417,7 +416,7 @@ static void changeTile(uint16 col, uint16 row) { return; } - check = true; + bool check = true; row = 0; col = 0; diff --git a/engines/lab/vga.cpp b/engines/lab/vga.cpp index c1d526b53a..73d8cf3192 100644 --- a/engines/lab/vga.cpp +++ b/engines/lab/vga.cpp @@ -82,13 +82,10 @@ bool LabEngine::WSDL_HasNextChar() { } void LabEngine::WSDL_ProcessInput(bool can_delay) { - int n; - int lastMouseAtEdge; - int flags = 0; - Common::Event event; if (1 /*!g_IgnoreProcessInput*/) { + int flags = 0; while (g_system->getEventManager()->pollEvent(event)) { switch (event.type) { case Common::EVENT_RBUTTONDOWN: @@ -101,8 +98,8 @@ void LabEngine::WSDL_ProcessInput(bool can_delay) { mouseHandler(flags, _mouseX, _mouseY); break; - case Common::EVENT_MOUSEMOVE: - lastMouseAtEdge = _mouseAtEdge; + case Common::EVENT_MOUSEMOVE: { + int lastMouseAtEdge = _mouseAtEdge; _mouseAtEdge = false; _mouseX = event.mouse.x; if (event.mouse.x <= 0) { @@ -127,6 +124,7 @@ void LabEngine::WSDL_ProcessInput(bool can_delay) { if (!lastMouseAtEdge || !_mouseAtEdge) mouseHandler(1, _mouseX, _mouseY); + } break; case Common::EVENT_KEYDOWN: @@ -143,14 +141,15 @@ void LabEngine::WSDL_ProcessInput(bool can_delay) { //saveSettings(); break; - default: - n = ((((unsigned int)((_nextKeyIn + 1) >> 31) >> 26) + (byte)_nextKeyIn + 1) & 0x3F) + default: { + int n = ((((unsigned int)((_nextKeyIn + 1) >> 31) >> 26) + (byte)_nextKeyIn + 1) & 0x3F) - ((unsigned int)((_nextKeyIn + 1) >> 31) >> 26); if (n != _nextKeyOut) { _keyBuf[_nextKeyIn] = event.kbd.keycode; _nextKeyIn = n; } } + } break; case Common::EVENT_QUIT: -- cgit v1.2.3 From ff2def7da187c5160443fc6166728f1fc59ff66e Mon Sep 17 00:00:00 2001 From: Strangerke Date: Fri, 27 Nov 2015 23:18:15 +0100 Subject: LAB: Check all the 'for' loops, reduce the scope of variable accordingly --- engines/lab/allocroom.cpp | 24 ++++++--------- engines/lab/engine.cpp | 71 +++++++++++++++++++++------------------------ engines/lab/graphics.cpp | 26 ++++++++--------- engines/lab/intro.cpp | 34 ++++++++++------------ engines/lab/labfile.cpp | 16 ++++------ engines/lab/map.cpp | 69 +++++++++++++++---------------------------- engines/lab/mouse.cpp | 7 ++--- engines/lab/processroom.cpp | 5 ++-- engines/lab/special.cpp | 58 ++++++++++++++++-------------------- engines/lab/text.cpp | 23 +++++++-------- engines/lab/undiff.cpp | 9 ++---- 11 files changed, 143 insertions(+), 199 deletions(-) diff --git a/engines/lab/allocroom.cpp b/engines/lab/allocroom.cpp index 22dfae6181..2b80967032 100644 --- a/engines/lab/allocroom.cpp +++ b/engines/lab/allocroom.cpp @@ -56,25 +56,20 @@ static int32 MemLeftInBuffer = 0L; /* Allocates the memory for the room buffers. */ /*****************************************************************************/ bool initRoomBuffer() { - uint16 counter; - CurMarker = 0; if ((RoomBuffer = calloc(ROOMBUFFERSIZE, 1))) { MemPlace = RoomBuffer; MemLeftInBuffer = ROOMBUFFERSIZE; - for (counter = 0; counter < MAXMARKERS; counter++) - RoomMarkers[counter].RoomNum = EMPTYROOM; + for (uint16 i = 0; i < MAXMARKERS; i++) + RoomMarkers[i].RoomNum = EMPTYROOM; return true; } else return false; } - - - /*****************************************************************************/ /* Frees the memory for the room buffers. */ /*****************************************************************************/ @@ -83,7 +78,6 @@ void freeRoomBuffer() { free(RoomBuffer); } - /*****************************************************************************/ /* Frees a room's resources. */ /*****************************************************************************/ @@ -132,12 +126,12 @@ static void *getCurMem(uint16 Size) { if (MemPlace > NextMemPlace) { NextMemPlace = NULL; - for (uint16 counter = 0; counter < MAXMARKERS; counter++) { - if (RoomMarkers[counter].RoomNum != EMPTYROOM) { - void *Start0 = RoomMarkers[counter].Start0; - void *Start1 = RoomMarkers[counter].Start1; - void *End0 = RoomMarkers[counter].End0; - void *End1 = RoomMarkers[counter].End1; + for (uint16 i = 0; i < MAXMARKERS; i++) { + if (RoomMarkers[i].RoomNum != EMPTYROOM) { + void *Start0 = RoomMarkers[i].Start0; + void *Start1 = RoomMarkers[i].Start1; + void *End0 = RoomMarkers[i].End0; + void *End1 = RoomMarkers[i].End1; if (((Start0 >= Ptr) && (Start0 < MemPlace)) || ((End0 >= Ptr) && (End0 < MemPlace)) || @@ -146,7 +140,7 @@ static void *getCurMem(uint16 Size) { ((Start1 >= Ptr) && (Start1 < MemPlace)) || ((End1 >= Ptr) && (End1 < MemPlace)) || ((Ptr >= Start1) && (Ptr <= End1))) { - freeRoom(counter); + freeRoom(i); } else { if (Start0 >= MemPlace) if ((NextMemPlace == NULL) || (Start0 < NextMemPlace)) diff --git a/engines/lab/engine.cpp b/engines/lab/engine.cpp index 2c56f5fa72..2d85dda3db 100644 --- a/engines/lab/engine.cpp +++ b/engines/lab/engine.cpp @@ -219,7 +219,6 @@ static void drawRoomMessage(uint16 CurInv, CloseDataPtr cptr) { /* Sets up the Labyrinth screens, and opens up the initial windows. */ /******************************************************************************/ bool LabEngine::setUpScreens() { - uint16 counter; byte *buffer; byte *MovePanelBuffer, *InvPanelBuffer; Gadget *curgad; @@ -242,8 +241,8 @@ bool LabEngine::setUpScreens() { buffer = MovePanelBuffer; - for (counter = 0; counter < 20; counter++) - readImage(&buffer, &(MoveImages[counter])); + for (uint16 i = 0; i < 20; i++) + readImage(&buffer, &(MoveImages[i])); /* Creates the gadgets for the movement control panel */ y = VGAScaleY(173) - SVGACord(2); @@ -303,8 +302,8 @@ bool LabEngine::setUpScreens() { buffer = InvPanelBuffer; if (g_lab->getPlatform() == Common::kPlatformWindows) { - for (counter = 0; counter < 10; counter++) - readImage(&buffer, &(InvImages[counter])); + for (uint16 imgIdx = 0; imgIdx < 10; imgIdx++) + readImage(&buffer, &(InvImages[imgIdx])); InvGadgetList = createButton(24, y, 0, 'm', InvImages[0], InvImages[1]); curgad = InvGadgetList; @@ -323,8 +322,8 @@ bool LabEngine::setUpScreens() { curgad->NextGadget = createButton(266, y, 7, 'f', InvImages[8], InvImages[9]); curgad = curgad->NextGadget; } else { - for (counter = 0; counter < 6; counter++) - readImage(&buffer, &(InvImages[counter])); + for (uint16 imgIdx = 0; imgIdx < 6; imgIdx++) + readImage(&buffer, &(InvImages[imgIdx])); InvGadgetList = createButton(58, y, 0, 0, InvImages[0], InvImages[1]); curgad = InvGadgetList; @@ -639,7 +638,7 @@ void LabEngine::mainGameLoop() { IntuiMessage *Msg; uint32 Class; - uint16 Code = 0, Qualifier, MouseX, MouseY, ActionMode = 4; + uint16 Qualifier, MouseX, MouseY, ActionMode = 4; uint16 CurInv = MAPNUM, LastInv = MAPNUM, Old; bool ForceDraw = false, doit, GotMessage = true; @@ -673,6 +672,7 @@ void LabEngine::mainGameLoop() { /* Set up initial picture. */ + uint16 code = 0; while (1) { WSDL_ProcessInput(1); @@ -762,11 +762,11 @@ void LabEngine::mainGameLoop() { MouseY = y; if (result == VKEY_UPARROW) { - Code = GadID = 7; + code = GadID = 7; } else if (result == VKEY_LTARROW) { - Code = GadID = 6; + code = GadID = 6; } else if (result == VKEY_RTARROW) { - Code = GadID = 8; + code = GadID = 8; } GotMessage = true; @@ -782,7 +782,7 @@ void LabEngine::mainGameLoop() { GotMessage = true; Class = Msg->msgClass; - Code = Msg->code; + code = Msg->code; Qualifier = Msg->qualifier; MouseX = Msg->mouseX; MouseY = Msg->mouseY; @@ -794,23 +794,23 @@ from_crumbs: DoBlack = false; if ((Class == RAWKEY) && (!LongWinInFront)) { - if (Code == 13) { /* The return key */ + if (code == 13) { /* The return key */ Class = MOUSEBUTTONS; Qualifier = IEQUALIFIER_LEFTBUTTON; mouseXY(&MouseX, &MouseY); } else if (g_lab->getPlatform() == Common::kPlatformWindows && - (Code == 'b' || Code == 'B')) { /* Start bread crumbs */ + (code == 'b' || code == 'B')) { /* Start bread crumbs */ BreadCrumbs[0].RoomNum = 0; NumCrumbs = 0; DroppingCrumbs = true; mayShowCrumbIndicator(); WSDL_UpdateScreen(); - } else if (Code == 'f' || Code == 'F' || - Code == 'r' || Code == 'R') { /* Follow bread crumbs */ + } else if (code == 'f' || code == 'F' || + code == 'r' || code == 'R') { /* Follow bread crumbs */ if (DroppingCrumbs) { if (NumCrumbs > 0) { FollowingCrumbs = true; - FollowCrumbsFast = (Code == 'r' || Code == 'R'); + FollowCrumbsFast = (code == 'r' || code == 'R'); IsCrumbTurning = false; IsCrumbWaiting = false; g_lab->getTime(&CrumbSecs, &CrumbMicros); @@ -836,8 +836,8 @@ from_crumbs: WSDL_UpdateScreen(); } } - } else if ((Code == 315) || (Code == 'x') || (Code == 'X') - || (Code == 'q') || (Code == 'Q')) { /* Quit? */ + } else if ((code == 315) || (code == 'x') || (code == 'X') + || (code == 'q') || (code == 'Q')) { /* Quit? */ DoNotDrawMessage = false; drawMessage("Do you want to quit? (Y/N)"); doit = false; @@ -872,9 +872,9 @@ from_crumbs: ForceDraw = true; interfaceOn(); } - } else if (Code == 9) { /* TAB key */ + } else if (code == 9) { /* TAB key */ Class = DELTAMOVE; - } else if (Code == 27) { /* ESC key */ + } else if (code == 27) { /* ESC key */ CPtr = NULL; } @@ -1015,11 +1015,9 @@ from_crumbs: BreadCrumbs[0].RoomNum = 0; } else { bool intersect = false; - int i; - - for (i = 0; i < NumCrumbs; i++) { - if (BreadCrumbs[i].RoomNum == RoomNum) { - NumCrumbs = i + 1; + for (int idx = 0; idx < NumCrumbs; idx++) { + if (BreadCrumbs[idx].RoomNum == RoomNum) { + NumCrumbs = idx + 1; BreadCrumbs[NumCrumbs].RoomNum = 0; intersect = true; } @@ -1293,21 +1291,19 @@ from_crumbs: free(Rooms); if (Inventory) { - for (Code = 1; Code <= NumInv; Code++) { - if (Inventory[Code].name) - free(Inventory[Code].name); + for (code = 1; code <= NumInv; code++) { + if (Inventory[code].name) + free(Inventory[code].name); - if (Inventory[Code].BInvName) - free(Inventory[Code].BInvName); + if (Inventory[code].BInvName) + free(Inventory[code].BInvName); } free(Inventory); } } - void LabEngine::go() { - uint16 counter; bool dointro = true; IsHiRes = ((getFeatures() & GF_LOWRES) == 0); @@ -1359,7 +1355,7 @@ void LabEngine::go() { blackAllScreen(); readPict("P:End/L2In.1", true); - for (counter = 0; counter < 120; counter++) { + for (uint16 i = 0; i < 120; i++) { g_music->updateMusic(); waitTOF(); } @@ -1395,9 +1391,6 @@ int followCrumbs() { { VKEY_RTARROW, VKEY_LTARROW, VKEY_RTARROW, VKEY_UPARROW } }; - int ExitDir; - int MoveDir; - if (IsCrumbWaiting) { uint32 Secs; uint32 Micros; @@ -1422,6 +1415,8 @@ int followCrumbs() { return 0; } + int ExitDir; + // which direction is last crumb if (BreadCrumbs[NumCrumbs].Direction == EAST) ExitDir = WEST; @@ -1432,7 +1427,7 @@ int followCrumbs() { else ExitDir = NORTH; - MoveDir = movement[Direction][ExitDir]; + int MoveDir = movement[Direction][ExitDir]; if (NumCrumbs == 0) { IsCrumbTurning = false; diff --git a/engines/lab/graphics.cpp b/engines/lab/graphics.cpp index b21c4f6e33..fbf8c45809 100644 --- a/engines/lab/graphics.cpp +++ b/engines/lab/graphics.cpp @@ -608,18 +608,18 @@ static void doScrollBounce() { g_music->updateMusic(); int startline = headerdata.y - height - 1; - for (int counter = 0; counter < 5; counter++) { + for (int i = 0; i < 5; i++) { g_music->updateMusic(); - startline -= newby[counter]; + startline -= newby[i]; copyPage(width, height, 0, startline, mem); g_lab->WSDL_UpdateScreen(); g_lab->waitTOF(); } - for (int counter = 8; counter > 0; counter--) { + for (int i = 8; i > 0; i--) { g_music->updateMusic(); - startline += newby1[counter - 1]; + startline += newby1[i - 1]; copyPage(width, height, 0, startline, mem); g_lab->WSDL_UpdateScreen(); @@ -636,7 +636,7 @@ static void doScrollBounce() { /* Does the transporter wipe. */ /*****************************************************************************/ static void doTransWipe(CloseDataPtr *CPtr, char *filename) { - uint16 LastY, CurY, counter, linesdone = 0, lineslast; + uint16 LastY, CurY, linesdone = 0, lineslast; Image ImSource, ImDest; if (IsHiRes) { @@ -647,8 +647,8 @@ static void doTransWipe(CloseDataPtr *CPtr, char *filename) { LastY = 148; } - for (counter = 0; counter < 2; counter++) { - CurY = counter * 2; + for (uint16 i = 0; i < 2; i++) { + CurY = i * 2; while (CurY < LastY) { if (linesdone >= lineslast) { @@ -665,8 +665,8 @@ static void doTransWipe(CloseDataPtr *CPtr, char *filename) { g_lab->setAPen(0); - for (counter = 0; counter < 2; counter++) { - CurY = counter * 2; + for (uint16 i = 0; i < 2; i++) { + CurY = i * 2; while (CurY <= LastY) { if (linesdone >= lineslast) { @@ -700,8 +700,8 @@ static void doTransWipe(CloseDataPtr *CPtr, char *filename) { ImDest.Height = g_lab->_screenHeight; ImDest.ImageData = g_lab->getVGABaseAddr(); - for (counter = 0; counter < 2; counter++) { - CurY = counter * 2; + for (uint16 i = 0; i < 2; i++) { + CurY = i * 2; while (CurY < LastY) { if (linesdone >= lineslast) { @@ -719,8 +719,8 @@ static void doTransWipe(CloseDataPtr *CPtr, char *filename) { } } - for (counter = 0; counter < 2; counter++) { - CurY = counter * 2; + for (uint16 i = 0; i < 2; i++) { + CurY = i * 2; while (CurY <= LastY) { if (linesdone >= lineslast) { diff --git a/engines/lab/intro.cpp b/engines/lab/intro.cpp index feb4905824..b3a5ccd6da 100644 --- a/engines/lab/intro.cpp +++ b/engines/lab/intro.cpp @@ -217,14 +217,12 @@ void Intro::doPictText(const char *filename, bool isscreen) { /* Does a one second delay, but checks the music while doing it. */ /*****************************************************************************/ void Intro::musicDelay() { - int16 counter; - g_music->updateMusic(); if (_quitIntro) return; - for (counter = 0; counter < 20; counter++) { + for (uint16 i = 0; i < 20; i++) { g_music->updateMusic(); g_lab->waitTOF(); g_lab->waitTOF(); @@ -253,8 +251,6 @@ void Intro::nReadPict(const char *filename, bool playOnce) { /* Does the introduction sequence for Labyrinth. */ /*****************************************************************************/ void Intro::introSequence() { - uint16 counter, counter1; - uint16 palette[16] = { 0x0000, 0x0855, 0x0FF9, 0x0EE7, 0x0ED5, 0x0DB4, 0x0CA2, 0x0C91, @@ -272,7 +268,7 @@ void Intro::introSequence() { } else { nReadPict("WYRMKEEP", true); // Wait 4 seconds - for (counter = 0; counter < 4 * 1000 / 10; counter++) { + for (uint16 i = 0; i < 4 * 1000 / 10; i++) { introEatMessages(); if (_quitIntro) break; @@ -293,13 +289,13 @@ void Intro::introSequence() { FadePalette = palette; - for (counter = 0; counter < 16; counter++) { + for (uint16 i = 0; i < 16; i++) { if (_quitIntro) break; - palette[counter] = ((diffcmap[counter * 3] >> 2) << 8) + - ((diffcmap[counter * 3 + 1] >> 2) << 4) + - (diffcmap[counter * 3 + 2] >> 2); + palette[i] = ((diffcmap[i * 3] >> 2) << 8) + + ((diffcmap[i * 3 + 1] >> 2) << 4) + + (diffcmap[i * 3 + 2] >> 2); } g_music->updateMusic(); @@ -312,8 +308,8 @@ void Intro::introSequence() { g_music->updateMusic(); uint16 temp = palette[2]; - for (counter = 2; counter < 15; counter++) - palette[counter] = palette[counter + 1]; + for (uint16 i = 2; i < 15; i++) + palette[i] = palette[i + 1]; palette[15] = temp; @@ -358,10 +354,10 @@ void Intro::introSequence() { nReadPict("Intro.1", true); nopalchange = false; - for (counter = 0; counter < 16; counter++) { - palette[counter] = ((diffcmap[counter * 3] >> 2) << 8) + - ((diffcmap[counter * 3 + 1] >> 2) << 4) + - (diffcmap[counter * 3 + 2] >> 2); + for (uint16 i = 0; i < 16; i++) { + palette[i] = ((diffcmap[i * 3] >> 2) << 8) + + ((diffcmap[i * 3 + 1] >> 2) << 4) + + (diffcmap[i * 3 + 2] >> 2); } doPictText("i.1", true); @@ -399,9 +395,9 @@ void Intro::introSequence() { doPictText("i.11", false); if (!_quitIntro) - for (counter = 0; counter < 50; counter++) { - for (counter1 = (8 * 3); counter1 < (255 * 3); counter1++) - diffcmap[counter1] = 255 - diffcmap[counter1]; + for (uint16 i = 0; i < 50; i++) { + for (uint16 idx = (8 * 3); idx < (255 * 3); idx++) + diffcmap[idx] = 255 - diffcmap[idx]; g_music->updateMusic(); g_lab->waitTOF(); diff --git a/engines/lab/labfile.cpp b/engines/lab/labfile.cpp index 231c63ab67..fb6b17e759 100644 --- a/engines/lab/labfile.cpp +++ b/engines/lab/labfile.cpp @@ -86,16 +86,12 @@ static void *getCurMemLabFile(uint32 size) { ptr = MemPlace; MemPlace = (char *)MemPlace + size; - for (int counter = 0; counter < MAXMARKERS; counter++) { - if (FileMarkers[counter].name[0]) { - if (((FileMarkers[counter].Start >= ptr) && - (FileMarkers[counter].Start < MemPlace)) || - ((FileMarkers[counter].End >= ptr) && - (FileMarkers[counter].End < MemPlace)) || - ((ptr >= FileMarkers[counter].Start) && - (ptr <= FileMarkers[counter].End))) - - freeFile(counter); + for (int i = 0; i < MAXMARKERS; i++) { + if (FileMarkers[i].name[0]) { + if ( ((FileMarkers[i].Start >= ptr) && (FileMarkers[i].Start < MemPlace)) + || ((FileMarkers[i].End >= ptr) && (FileMarkers[i].End < MemPlace)) + || ((ptr >= FileMarkers[i].Start) && (ptr <= FileMarkers[i].End))) + freeFile(i); } } diff --git a/engines/lab/map.cpp b/engines/lab/map.cpp index fdec095f1a..50a551473f 100644 --- a/engines/lab/map.cpp +++ b/engines/lab/map.cpp @@ -63,10 +63,10 @@ void setAmigaPal(uint16 *pal, uint16 numcolors) { if (numcolors > 16) numcolors = 16; - for (uint16 counter = 0; counter < numcolors; counter++) { - vgapal[vgacount++] = (byte)(((pal[counter] & 0xf00) >> 8) << 2); - vgapal[vgacount++] = (byte)(((pal[counter] & 0x0f0) >> 4) << 2); - vgapal[vgacount++] = (byte)(((pal[counter] & 0x00f)) << 2); + for (uint16 i = 0; i < numcolors; i++) { + vgapal[vgacount++] = (byte)(((pal[i] & 0xf00) >> 8) << 2); + vgapal[vgacount++] = (byte)(((pal[i] & 0x0f0) >> 4) << 2); + vgapal[vgacount++] = (byte)(((pal[i] & 0x00f)) << 2); } g_lab->writeColorRegsSmooth(vgapal, 0, 16); @@ -294,18 +294,18 @@ static uint16 fadeNumOut(uint16 num, uint16 res, uint16 counter) { /* Does the fading of the Palette on the screen. */ /*****************************************************************************/ void fade(bool fadein, uint16 res) { - uint16 pennum, counter, newpal[16]; + uint16 newpal[16]; - for (counter = 0; counter < 16; counter++) { - for (pennum = 0; pennum < 16; pennum++) { + for (uint16 i = 0; i < 16; i++) { + for (uint16 palIdx = 0; palIdx < 16; palIdx++) { if (fadein) - newpal[pennum] = (0x00F & fadeNumIn(0x00F & FadePalette[pennum], 0x00F & res, counter)) + - (0x0F0 & fadeNumIn(0x0F0 & FadePalette[pennum], 0x0F0 & res, counter)) + - (0xF00 & fadeNumIn(0xF00 & FadePalette[pennum], 0xF00 & res, counter)); + newpal[palIdx] = (0x00F & fadeNumIn(0x00F & FadePalette[palIdx], 0x00F & res, i)) + + (0x0F0 & fadeNumIn(0x0F0 & FadePalette[palIdx], 0x0F0 & res, i)) + + (0xF00 & fadeNumIn(0xF00 & FadePalette[palIdx], 0xF00 & res, i)); else - newpal[pennum] = (0x00F & fadeNumOut(0x00F & FadePalette[pennum], 0x00F & res, counter)) + - (0x0F0 & fadeNumOut(0x0F0 & FadePalette[pennum], 0x0F0 & res, counter)) + - (0xF00 & fadeNumOut(0xF00 & FadePalette[pennum], 0xF00 & res, counter)); + newpal[palIdx] = (0x00F & fadeNumOut(0x00F & FadePalette[palIdx], 0x00F & res, i)) + + (0x0F0 & fadeNumOut(0x0F0 & FadePalette[palIdx], 0x0F0 & res, i)) + + (0xF00 & fadeNumOut(0xF00 & FadePalette[palIdx], 0xF00 & res, i)); } setAmigaPal(newpal, 16); @@ -314,8 +314,6 @@ void fade(bool fadein, uint16 res) { } } - - /*****************************************************************************/ /* Figures out what a room's coordinates should be. */ /*****************************************************************************/ @@ -350,10 +348,6 @@ static void roomCords(uint16 CurRoom, uint16 *x1, uint16 *y1, uint16 *x2, uint16 } } - - - - /*****************************************************************************/ /* Draws a room to the bitmap. */ /*****************************************************************************/ @@ -489,28 +483,18 @@ static void drawRoom(uint16 CurRoom, bool drawx) { g_lab->drawImage(XMark, xx, xy); } - - /*****************************************************************************/ /* Checks if a floor has been visitted. */ /*****************************************************************************/ static bool onFloor(uint16 Floor) { - uint16 drawroom; - - for (drawroom = 1; drawroom <= MaxRooms; drawroom++) { - if ((Maps[drawroom].PageNumber == Floor) - && g_lab->_roomsFound->in(drawroom) - && Maps[drawroom].x) { + for (uint16 i = 1; i <= MaxRooms; i++) { + if ((Maps[i].PageNumber == Floor) && g_lab->_roomsFound->in(i) && Maps[i].x) return true; - } } return false; } - - - /*****************************************************************************/ /* Figures out which floor, if any, should be gone to if the up arrow is hit */ /*****************************************************************************/ @@ -570,7 +554,6 @@ static void getDownFloor(uint16 *Floor, bool *isfloor) { /* Draws the map */ /*****************************************************************************/ static void drawMap(uint16 CurRoom, uint16 CurMsg, uint16 Floor, bool fadeout, bool fadein) { - uint16 drawroom; char *sptr; uint16 tempfloor; @@ -587,11 +570,9 @@ static void drawMap(uint16 CurRoom, uint16 CurMsg, uint16 Floor, bool fadeout, b g_lab->drawImage(Map, 0, 0); drawGadgetList(MapGadgetList); - for (drawroom = 1; drawroom <= MaxRooms; drawroom++) { - if ((Maps[drawroom].PageNumber == Floor) - && g_lab->_roomsFound->in(drawroom) - && Maps[drawroom].x) { - drawRoom(drawroom, (bool)(drawroom == CurRoom)); + for (uint16 i = 1; i <= MaxRooms; i++) { + if ((Maps[i].PageNumber == Floor) && g_lab->_roomsFound->in(i) && Maps[i].x) { + drawRoom(i, (bool)(i == CurRoom)); g_music->updateMusic(); } } @@ -674,14 +655,12 @@ static void drawMap(uint16 CurRoom, uint16 CurMsg, uint16 Floor, bool fadeout, b mouseShow(); } - - /*****************************************************************************/ /* Processes the map. */ /*****************************************************************************/ void processMap(uint16 CurRoom) { uint32 Class, place = 1; - uint16 Code, Qualifier, MouseX, MouseY, GadgetID, CurFloor, OldFloor, OldMsg, CurMsg, drawroom, x1, y1, x2, y2; + uint16 Code, Qualifier, MouseX, MouseY, GadgetID, CurFloor, OldFloor, OldMsg, CurMsg, x1, y1, x2, y2; char *sptr; byte newcolor[3]; bool drawmap; @@ -804,14 +783,14 @@ void processMap(uint16 CurRoom) { else if (MouseX > mapScaleX(314)) { OldMsg = CurMsg; - for (drawroom = 1; drawroom <= MaxRooms; drawroom++) { - roomCords(drawroom, &x1, &y1, &x2, &y2); + for (uint16 i = 1; i <= MaxRooms; i++) { + roomCords(i, &x1, &y1, &x2, &y2); - if ((Maps[drawroom].PageNumber == CurFloor) - && g_lab->_roomsFound->in(drawroom) + if ((Maps[i].PageNumber == CurFloor) + && g_lab->_roomsFound->in(i) && (MouseX >= x1) && (MouseX <= x2) && (MouseY >= y1) && (MouseY <= y2)) { - CurMsg = drawroom; + CurMsg = i; } } diff --git a/engines/lab/mouse.cpp b/engines/lab/mouse.cpp index ef483f7e2d..bdfb3fc235 100644 --- a/engines/lab/mouse.cpp +++ b/engines/lab/mouse.cpp @@ -70,8 +70,6 @@ static Gadget *hitgad = NULL; /* of gadgets. */ /*****************************************************************************/ static Gadget *checkGadgetHit(Gadget *gadlist, uint16 x, uint16 y) { - uint16 counter; - while (gadlist != NULL) { if ((x >= gadlist->x) && (y >= gadlist->y) && (x <= (gadlist->x + gadlist->Im->Width)) && @@ -84,7 +82,7 @@ static Gadget *checkGadgetHit(Gadget *gadlist, uint16 x, uint16 y) { g_lab->drawImage(gadlist->ImAlt, gadlist->x, gadlist->y); mouseShow(); - for (counter = 0; counter < 3; counter++) + for (uint16 i = 0; i < 3; i++) g_lab->waitTOF(); mouseHide(); @@ -133,7 +131,6 @@ void mouseHandler(int32 flag, int32 mouseX, int32 mouseY) { } void updateMouse() { - uint16 counter; bool doUpdateDisplay = false; if (!MouseHidden) @@ -144,7 +141,7 @@ void updateMouse() { g_lab->drawImage(hitgad->ImAlt, hitgad->x, hitgad->y); mouseShow(); - for (counter = 0; counter < 3; counter++) + for (uint16 i = 0; i < 3; i++) g_lab->waitTOF(); mouseHide(); diff --git a/engines/lab/processroom.cpp b/engines/lab/processroom.cpp index fd5ec73670..ccce27adf3 100644 --- a/engines/lab/processroom.cpp +++ b/engines/lab/processroom.cpp @@ -330,7 +330,6 @@ static void doActions(Action * APtr, CloseDataPtr *LCPtr) { CloseDataPtr TLCPtr; bool FirstLoaded = true; char **str, *Test; - uint16 counter; uint32 StartSecs, StartMicros, CurSecs, CurMicros; while (APtr) { @@ -563,8 +562,8 @@ static void doActions(Action * APtr, CloseDataPtr *LCPtr) { else if (APtr->Param1 == 2) DoBlack = (CPtr != NULL); else if (APtr->Param1 == 5) { /* inverse the palette */ - for (counter = (8 * 3); counter < (255 * 3); counter++) - diffcmap[counter] = 255 - diffcmap[counter]; + for (uint16 idx = (8 * 3); idx < (255 * 3); idx++) + diffcmap[idx] = 255 - diffcmap[idx]; g_lab->waitTOF(); g_lab->VGASetPal(diffcmap, 256); diff --git a/engines/lab/special.cpp b/engines/lab/special.cpp index 1ee539f20b..ea9df4fc13 100644 --- a/engines/lab/special.cpp +++ b/engines/lab/special.cpp @@ -110,7 +110,6 @@ extern uint16 RoomNum, Direction; static byte *loadBackPict(const char *fileName, bool tomem) { - uint16 counter; byte *res = NULL; FadePalette = hipal; @@ -121,10 +120,10 @@ static byte *loadBackPict(const char *fileName, bool tomem) { else readPict(fileName, true); - for (counter = 0; counter < 16; counter++) { - hipal[counter] = ((diffcmap[counter * 3] >> 2) << 8) + - ((diffcmap[counter * 3 + 1] >> 2) << 4) + - ((diffcmap[counter * 3 + 2] >> 2)); + for (uint16 i = 0; i < 16; i++) { + hipal[i] = ((diffcmap[i * 3] >> 2) << 8) + + ((diffcmap[i * 3 + 1] >> 2) << 4) + + ((diffcmap[i * 3 + 2] >> 2)); } nopalchange = false; @@ -136,17 +135,14 @@ static byte *loadBackPict(const char *fileName, bool tomem) { /* Draws the images of the combination lock to the display bitmap. */ /*****************************************************************************/ static void doCombination() { - uint16 counter; - - for (counter = 0; counter <= 5; counter++) - g_lab->drawImage(Images[combination[counter]], VGAScaleX(combx[counter]), VGAScaleY(65)); + for (uint16 i = 0; i <= 5; i++) + g_lab->drawImage(Images[combination[i]], VGAScaleX(combx[i]), VGAScaleY(65)); } /*****************************************************************************/ /* Reads in a backdrop picture. */ /*****************************************************************************/ void showCombination(const char *filename) { - uint16 CurBit; byte **buffer; resetBuffer(); @@ -159,7 +155,7 @@ void showCombination(const char *filename) { buffer = g_music->newOpen("P:Numbers"); - for (CurBit = 0; CurBit < 10; CurBit++) + for (uint16 CurBit = 0; CurBit < 10; CurBit++) readImage(buffer, &(Images[CurBit])); allocFile((void **)&g_lab->_tempScrollData, Images[0]->Width * Images[0]->Height * 2L, "tempdata"); @@ -176,7 +172,7 @@ void showCombination(const char *filename) { /*****************************************************************************/ static void changeCombination(uint16 number) { Image display; - uint16 counter, combnum; + uint16 combnum; bool unlocked = true; if (combination[number] < 9) @@ -190,9 +186,9 @@ static void changeCombination(uint16 number) { display.Width = g_lab->_screenWidth; display.Height = g_lab->_screenHeight; - for (counter = 1; counter <= (Images[combnum]->Height / 2); counter++) { + for (uint16 i = 1; i <= (Images[combnum]->Height / 2); i++) { if (IsHiRes) { - if (counter & 1) + if (i & 1) g_lab->waitTOF(); } else g_lab->waitTOF(); @@ -201,11 +197,11 @@ static void changeCombination(uint16 number) { g_lab->scrollDisplayY(2, VGAScaleX(combx[number]), VGAScaleY(65), VGAScaleX(combx[number]) + (Images[combnum])->Width - 1, VGAScaleY(65) + (Images[combnum])->Height); - g_lab->bltBitMap(Images[combnum], 0, (Images[combnum])->Height - (2 * counter), &(display), VGAScaleX(combx[number]), VGAScaleY(65), (Images[combnum])->Width, 2); + g_lab->bltBitMap(Images[combnum], 0, (Images[combnum])->Height - (2 * i), &(display), VGAScaleX(combx[number]), VGAScaleY(65), (Images[combnum])->Width, 2); } - for (counter = 0; counter < 6; counter++) - unlocked = (combination[counter] == solution[counter]) && unlocked; + for (uint16 i = 0; i < 6; i++) + unlocked = (combination[i] == solution[i]) && unlocked; if (unlocked) g_lab->_conditions->inclElement(COMBINATIONUNLOCKED); @@ -289,7 +285,7 @@ static void doTile(bool showsolution) { /* Reads in a backdrop picture. */ /*****************************************************************************/ void showTile(const char *filename, bool showsolution) { - uint16 CurBit, start; + uint16 start; byte **buffer; resetBuffer(); @@ -310,8 +306,8 @@ void showTile(const char *filename, bool showsolution) { if (!buffer) return; - for (CurBit = start; CurBit < 16; CurBit++) - readImage(buffer, &(Tiles[CurBit])); + for (uint16 curBit = start; curBit < 16; curBit++) + readImage(buffer, &(Tiles[curBit])); allocFile((void **)&g_lab->_tempScrollData, Tiles[1]->Width * Tiles[1]->Height * 2L, "tempdata"); @@ -334,7 +330,6 @@ static void scrollRaster(int16 dx, int16 dy, uint16 x1, uint16 y1, uint16 x2, ui static void doTileScroll(uint16 col, uint16 row, uint16 scrolltype) { int16 dX = 0, dY = 0, dx = 0, dy = 0, sx = 0, sy = 0; uint16 last = 0, x1, y1; - uint16 counter; if (scrolltype == LEFTSCROLL) { dX = VGAScaleX(5); @@ -361,7 +356,7 @@ static void doTileScroll(uint16 col, uint16 row, uint16 scrolltype) { x1 = VGAScaleX(100) + (col * VGAScaleX(30)) + dx; y1 = VGAScaleY(25) + (row * VGAScaleY(25)) + dy; - for (counter = 0; counter < last; counter++) { + for (uint16 i = 0; i < last; i++) { g_lab->waitTOF(); scrollRaster(dX, dY, x1, y1, x1 + VGAScaleX(28) + sx, y1 + VGAScaleY(23) + sy); x1 += dX; @@ -549,7 +544,6 @@ static bool loadJournalData() { byte **buffer; char filename[20]; Gadget *TopGadget = &BackG; - uint16 counter; bool bridge, dirty, news, clean; BigMsgFont = &bmfont; @@ -607,7 +601,7 @@ static bool loadJournalData() { BackG.KeyEquiv = VKEY_LTARROW; ForwardG.KeyEquiv = VKEY_RTARROW; - counter = 0; + uint16 counter = 0; while (TopGadget) { TopGadget->x = VGAScaleX(JGadX[counter]); @@ -667,21 +661,19 @@ static void drawJournalText() { /* Does the turn page wipe. */ /*****************************************************************************/ static void turnPage(bool FromLeft) { - uint16 counter; - if (FromLeft) { - for (counter = 0; counter < g_lab->_screenWidth; counter += 8) { + for (int i = 0; i < g_lab->_screenWidth; i += 8) { g_music->updateMusic(); g_lab->waitTOF(); ScreenImage.ImageData = g_lab->getVGABaseAddr(); - g_lab->bltBitMap(&JBackImage, counter, 0, &ScreenImage, counter, 0, 8, g_lab->_screenHeight); + g_lab->bltBitMap(&JBackImage, i, 0, &ScreenImage, i, 0, 8, g_lab->_screenHeight); } } else { - for (counter = (g_lab->_screenWidth - 8); counter > 0; counter -= 8) { + for (int i = (g_lab->_screenWidth - 8); i > 0; i -= 8) { g_music->updateMusic(); g_lab->waitTOF(); ScreenImage.ImageData = g_lab->getVGABaseAddr(); - g_lab->bltBitMap(&JBackImage, counter, 0, &ScreenImage, counter, 0, 8, g_lab->_screenHeight); + g_lab->bltBitMap(&JBackImage, i, 0, &ScreenImage, i, 0, 8, g_lab->_screenHeight); } } } @@ -878,7 +870,7 @@ static void getMonImages() { /* Draws the text for the monitor. */ /*****************************************************************************/ static void drawMonText(char *text, uint16 x1, uint16 y1, uint16 x2, uint16 y2, bool isinteractive) { - uint16 DrawingToPage = 0, yspacing = 0, numlines, fheight, counter; + uint16 DrawingToPage = 0, yspacing = 0, numlines, fheight; int32 CharsDrawn = 0L; char *CurText = text; @@ -903,8 +895,8 @@ static void drawMonText(char *text, uint16 x1, uint16 y1, uint16 x2, uint16 y2, g_lab->setAPen(0); g_lab->rectFill(0, 0, g_lab->_screenWidth - 1, y2); - for (counter = 0; counter < numlines; counter++) - g_lab->drawImage(MonButton, 0, counter * MonGadHeight); + for (uint16 i = 0; i < numlines; i++) + g_lab->drawImage(MonButton, 0, i * MonGadHeight); } else if (isinteractive) { g_lab->setAPen(0); g_lab->rectFill(0, 0, g_lab->_screenWidth - 1, y2); diff --git a/engines/lab/text.cpp b/engines/lab/text.cpp index cf920d3f43..10e4ac8326 100644 --- a/engines/lab/text.cpp +++ b/engines/lab/text.cpp @@ -51,19 +51,18 @@ void closeFont(struct TextFont *tf) { /* Returns the length of a text in the specified font. */ /*****************************************************************************/ uint16 textLength(struct TextFont *tf, const char *text, uint16 numchars) { - uint16 counter, length = 0; + uint16 length = 0; - if (tf) - for (counter = 0; counter < numchars; counter++) { + if (tf) { + for (uint16 i = 0; i < numchars; i++) { length += tf->Widths[(uint)*text]; text++; } + } return length; } - - /*****************************************************************************/ /* Returns the height of a specified font. */ /*****************************************************************************/ @@ -78,11 +77,11 @@ void text(struct TextFont *tf, uint16 x, uint16 y, uint16 color, const char *tex byte *VGATop, *VGACur, *VGATemp, *VGATempLine, *cdata; uint32 RealOffset, SegmentOffset; int32 templeft, LeftInSegment; - uint16 counter, counterb, bwidth, mask, curpage, rows, cols, data; + uint16 bwidth, mask, curpage, data; VGATop = g_lab->getVGABaseAddr(); - for (counter = 0; counter < numchars; counter++) { + for (uint16 i = 0; i < numchars; i++) { RealOffset = (g_lab->_screenWidth * y) + x; curpage = RealOffset / g_lab->_screenBytesPerPage; SegmentOffset = RealOffset - (curpage * g_lab->_screenBytesPerPage); @@ -95,16 +94,16 @@ void text(struct TextFont *tf, uint16 x, uint16 y, uint16 color, const char *tex VGATemp = VGACur; VGATempLine = VGACur; - for (rows = 0; rows < tf->Height; rows++) { + for (uint16 rows = 0; rows < tf->Height; rows++) { VGATemp = VGATempLine; templeft = LeftInSegment; - for (cols = 0; cols < bwidth; cols++) { + for (uint16 cols = 0; cols < bwidth; cols++) { data = *cdata++; if (data && (templeft >= 8)) { - for (int i = 7; i >= 0; i--) { - if ((1 << i) & data) + for (int j = 7; j >= 0; j--) { + if ((1 << j) & data) *VGATemp = color; VGATemp++; } @@ -114,7 +113,7 @@ void text(struct TextFont *tf, uint16 x, uint16 y, uint16 color, const char *tex mask = 0x80; templeft = LeftInSegment; - for (counterb = 0; counterb < 8; counterb++) { + for (uint16 counterb = 0; counterb < 8; counterb++) { if (templeft <= 0) { curpage++; VGATemp = (byte *)(VGATop - templeft); diff --git a/engines/lab/undiff.cpp b/engines/lab/undiff.cpp index f7610d99ce..2b22496011 100644 --- a/engines/lab/undiff.cpp +++ b/engines/lab/undiff.cpp @@ -371,14 +371,11 @@ void runLengthDecode(byte *Dest, byte *Source) { void VRunLengthDecode(byte *Dest, byte *Source, uint16 bytesperrow) { int8 num; int16 count; - uint16 Counter; - byte *Top; + byte *Top = Dest; - Top = Dest; - - for (Counter = 0; Counter < DataBytesPerRow; Counter++) { + for (uint16 i = 0; i < DataBytesPerRow; i++) { Dest = Top; - Dest += Counter; + Dest += i; num = (int8)*Source; Source++; -- cgit v1.2.3 From c485d9e8a616d475f9155de084012062fe9e5dc8 Mon Sep 17 00:00:00 2001 From: Strangerke Date: Sat, 28 Nov 2015 02:17:05 +0100 Subject: LAB: Some rework related to the mouse code --- engines/lab/engine.cpp | 61 +++++++++++++++++++++------------------------ engines/lab/lab.cpp | 7 +++--- engines/lab/lab.h | 7 +++--- engines/lab/labfun.h | 9 ++++--- engines/lab/machine.cpp | 4 +-- engines/lab/mouse.cpp | 48 ++++++++++++++++------------------- engines/lab/mouse.h | 7 +++--- engines/lab/parsefun.h | 4 +-- engines/lab/processroom.cpp | 8 +++--- engines/lab/special.cpp | 14 +++++------ engines/lab/vga.cpp | 58 +++++++++++++++++++++--------------------- 11 files changed, 108 insertions(+), 119 deletions(-) diff --git a/engines/lab/engine.cpp b/engines/lab/engine.cpp index 2d85dda3db..837529b846 100644 --- a/engines/lab/engine.cpp +++ b/engines/lab/engine.cpp @@ -638,7 +638,7 @@ void LabEngine::mainGameLoop() { IntuiMessage *Msg; uint32 Class; - uint16 Qualifier, MouseX, MouseY, ActionMode = 4; + uint16 Qualifier, ActionMode = 4; uint16 CurInv = MAPNUM, LastInv = MAPNUM, Old; bool ForceDraw = false, doit, GotMessage = true; @@ -742,6 +742,7 @@ void LabEngine::mainGameLoop() { interfaceOn(); Msg = getMsg(); + Common::Point curPos; if (Msg == NULL) { /* Does music load and next animation frame when you've run out of messages */ GotMessage = false; g_music->checkRoomMusic(); @@ -752,22 +753,16 @@ void LabEngine::mainGameLoop() { int result = followCrumbs(); if (result != 0) { - int x = 0, y = 0; - - WSDL_GetMousePos(&x, &y); - + curPos = WSDL_GetMousePos(); Class = GADGETUP; Qualifier = 0; - MouseX = x; - MouseY = y; - if (result == VKEY_UPARROW) { + if (result == VKEY_UPARROW) code = GadID = 7; - } else if (result == VKEY_LTARROW) { + else if (result == VKEY_LTARROW) code = GadID = 6; - } else if (result == VKEY_RTARROW) { + else if (result == VKEY_RTARROW) code = GadID = 8; - } GotMessage = true; mayShowCrumbIndicator(); @@ -784,8 +779,8 @@ void LabEngine::mainGameLoop() { Class = Msg->msgClass; code = Msg->code; Qualifier = Msg->qualifier; - MouseX = Msg->mouseX; - MouseY = Msg->mouseY; + curPos.x = Msg->mouseX; + curPos.y = Msg->mouseY; GadID = Msg->gadgetID; FollowingCrumbs = false; @@ -797,7 +792,7 @@ from_crumbs: if (code == 13) { /* The return key */ Class = MOUSEBUTTONS; Qualifier = IEQUALIFIER_LEFTBUTTON; - mouseXY(&MouseX, &MouseY); + curPos = getMousePos(); } else if (g_lab->getPlatform() == Common::kPlatformWindows && (code == 'b' || code == 'B')) { /* Start bread crumbs */ BreadCrumbs[0].RoomNum = 0; @@ -1169,10 +1164,10 @@ from_crumbs: doit = false; if (CPtr) { - if ((CPtr->CloseUpType == SPECIALLOCK) && MainDisplay) /* LAB: Labrinth specific code */ - mouseCombination(MouseX, MouseY); + if ((CPtr->CloseUpType == SPECIALLOCK) && MainDisplay) /* LAB: Labyrinth specific code */ + mouseCombination(curPos); else if ((CPtr->CloseUpType == SPECIALBRICK) && MainDisplay) - mouseTile(MouseX, MouseY); + mouseTile(curPos); else doit = true; } else @@ -1184,48 +1179,48 @@ from_crumbs: eatMessages(); if (ActionMode == 0) { /* Take something. */ - if (doActionRule(MouseX, MouseY, ActionMode, RoomNum, &CPtr)) + if (doActionRule(Common::Point(curPos.x, curPos.y), ActionMode, RoomNum, &CPtr)) CurFileName = NewFileName; - else if (takeItem(MouseX, MouseY, &CPtr)) + else if (takeItem(curPos.x, curPos.y, &CPtr)) drawStaticMessage(kTextTakeItem); - else if (doActionRule(MouseX, MouseY, TAKEDEF - 1, RoomNum, &CPtr)) + else if (doActionRule(curPos, TAKEDEF - 1, RoomNum, &CPtr)) CurFileName = NewFileName; - else if (doActionRule(MouseX, MouseY, TAKE - 1, 0, &CPtr)) + else if (doActionRule(curPos, TAKE - 1, 0, &CPtr)) CurFileName = NewFileName; - else if (MouseY < (VGAScaleY(149) + SVGACord(2))) + else if (curPos.y < (VGAScaleY(149) + SVGACord(2))) drawStaticMessage(kTextNothing); } else if ((ActionMode == 1) /* Manipulate an object */ || (ActionMode == 2) /* Open up a "door" */ || (ActionMode == 3)) { /* Close a "door" */ - if (doActionRule(MouseX, MouseY, ActionMode, RoomNum, &CPtr)) + if (doActionRule(curPos, ActionMode, RoomNum, &CPtr)) CurFileName = NewFileName; - else if (!doActionRule(MouseX, MouseY, ActionMode, 0, &CPtr)) { - if (MouseY < (VGAScaleY(149) + SVGACord(2))) + else if (!doActionRule(curPos, ActionMode, 0, &CPtr)) { + if (curPos.y < (VGAScaleY(149) + SVGACord(2))) drawStaticMessage(kTextNothing); } } else if (ActionMode == 4) { /* Look at closeups */ TempCPtr = CPtr; - setCurClose(MouseX, MouseY, &TempCPtr); + setCurClose(curPos, &TempCPtr); if (CPtr == TempCPtr) { - if (MouseY < (VGAScaleY(149) + SVGACord(2))) + if (curPos.y < (VGAScaleY(149) + SVGACord(2))) drawStaticMessage(kTextNothing); } else if (TempCPtr->GraphicName) { if (*(TempCPtr->GraphicName)) { DoBlack = true; CPtr = TempCPtr; - } else if (MouseY < (VGAScaleY(149) + SVGACord(2))) + } else if (curPos.y < (VGAScaleY(149) + SVGACord(2))) drawStaticMessage(kTextNothing); - } else if (MouseY < (VGAScaleY(149) + SVGACord(2))) + } else if (curPos.y < (VGAScaleY(149) + SVGACord(2))) drawStaticMessage(kTextNothing); } else if ((ActionMode == 5) && g_lab->_conditions->in(CurInv)) { /* Use an item on something else */ - if (doOperateRule(MouseX, MouseY, CurInv, &CPtr)) { + if (doOperateRule(curPos.x, curPos.y, CurInv, &CPtr)) { CurFileName = NewFileName; if (!g_lab->_conditions->in(CurInv)) decIncInv(&CurInv, false); - } else if (MouseY < (VGAScaleY(149) + SVGACord(2))) + } else if (curPos.y < (VGAScaleY(149) + SVGACord(2))) drawStaticMessage(kTextNothing); } } @@ -1238,7 +1233,7 @@ from_crumbs: if (HCPtr == NULL) { TempCPtr = CPtr; - setCurClose(MouseX, MouseY, &TempCPtr); + setCurClose(curPos, &TempCPtr); if ((TempCPtr == NULL) || (TempCPtr == CPtr)) { if (CPtr == NULL) @@ -1259,7 +1254,7 @@ from_crumbs: } if (HCPtr) - mouseMove(scaleX((HCPtr->x1 + HCPtr->x2) / 2), scaleY((HCPtr->y1 + HCPtr->y2) / 2)); + setMousePos(Common::Point(scaleX((HCPtr->x1 + HCPtr->x2) / 2), scaleY((HCPtr->y1 + HCPtr->y2) / 2))); } else if ((Class == MOUSEBUTTONS) && (IEQUALIFIER_RBUTTON & Qualifier)) { eatMessages(); Alternate = !Alternate; diff --git a/engines/lab/lab.cpp b/engines/lab/lab.cpp index fcd826b366..92607d492b 100644 --- a/engines/lab/lab.cpp +++ b/engines/lab/lab.cpp @@ -66,12 +66,11 @@ LabEngine::LabEngine(OSystem *syst, const ADGameDescription *gameDesc) _lastWaitTOFTicks = 0; - _mouseX = 0; - _mouseY = 0; + _mousePos = Common::Point(0, 0); + _mouseAtEdge = false; - _nextKeyIn = 0; + _nextKeyIn = 0; _nextKeyOut = 0; - _mouseAtEdge = false; //const Common::FSNode gameDataDir(ConfMan.get("path")); //SearchMan.addSubDirectoryMatching(gameDataDir, "game"); diff --git a/engines/lab/lab.h b/engines/lab/lab.h index 36e2a43455..659637d13a 100644 --- a/engines/lab/lab.h +++ b/engines/lab/lab.h @@ -32,6 +32,7 @@ #define LAB_H #include "common/array.h" +#include "common/events.h" #include "engines/engine.h" #include "lab/labfun.h" @@ -96,9 +97,7 @@ private: public: byte *_currentDsplayBuffer; - - uint32 _mouseX; - uint32 _mouseY; + Common::Point _mousePos; private: byte *_displayBuffer; @@ -145,7 +144,7 @@ private: /*---------- Drawing Routines ----------*/ void drawMaskImage(Image *Im, uint16 x, uint16 y); - void WSDL_GetMousePos(int *x, int *y); + Common::Point WSDL_GetMousePos(); void changeVolume(int delta); void WSDL_SetColors(byte *buf, uint16 first, uint16 numreg, uint16 slow); diff --git a/engines/lab/labfun.h b/engines/lab/labfun.h index 1d2b5c640d..f602d6007a 100644 --- a/engines/lab/labfun.h +++ b/engines/lab/labfun.h @@ -31,6 +31,7 @@ #ifndef LAB_LABFUN_H #define LAB_LABFUN_H +#include "common/events.h" #include "lab/stddefines.h" #include "lab/parsetypes.h" @@ -228,8 +229,8 @@ uint16 scaleY(uint16 y); int16 VGAScaleX(int16 x); int16 VGAScaleY(int16 y); uint16 SVGACord(uint16 cord); -uint16 VGAUnScaleX(uint16 x); -uint16 VGAUnScaleY(uint16 y); +int VGAUnScaleX(int x); +int VGAUnScaleY(int y); char *translateFileName(const char *filename); /*---------------------------*/ @@ -260,9 +261,9 @@ bool readSaveGameHeader(Common::InSaveFile *in, SaveGameHeader &header); /*--------------------------*/ void showCombination(const char *filename); -void mouseCombination(uint16 x, uint16 y); +void mouseCombination(Common::Point pos); void showTile(const char *filename, bool showsolution); -void mouseTile(uint16 x, uint16 y); +void mouseTile(Common::Point pos); } // End of namespace Lab diff --git a/engines/lab/machine.cpp b/engines/lab/machine.cpp index ede75e0aec..b2ce65e9db 100644 --- a/engines/lab/machine.cpp +++ b/engines/lab/machine.cpp @@ -88,7 +88,7 @@ uint16 SVGACord(uint16 cord) { /*****************************************************************************/ /* Converts SVGA cords to VGA if necessary, otherwise returns VGA cords. */ /*****************************************************************************/ -uint16 VGAUnScaleX(uint16 x) { +int VGAUnScaleX(int x) { if (IsHiRes) return (x / 2); else @@ -98,7 +98,7 @@ uint16 VGAUnScaleX(uint16 x) { /*****************************************************************************/ /* Converts SVGA cords to VGA if necessary, otherwise returns VGA cords. */ /*****************************************************************************/ -uint16 VGAUnScaleY(uint16 y) { +int VGAUnScaleY(int y) { if (IsHiRes) return ((y * 5) / 12); else diff --git a/engines/lab/mouse.cpp b/engines/lab/mouse.cpp index bdfb3fc235..4fc8644dd1 100644 --- a/engines/lab/mouse.cpp +++ b/engines/lab/mouse.cpp @@ -69,12 +69,12 @@ static Gadget *hitgad = NULL; /* Checks whether or not the cords fall within one of the gadgets in a list */ /* of gadgets. */ /*****************************************************************************/ -static Gadget *checkGadgetHit(Gadget *gadlist, uint16 x, uint16 y) { +static Gadget *checkGadgetHit(Gadget *gadlist, Common::Point pos) { while (gadlist != NULL) { - if ((x >= gadlist->x) && (y >= gadlist->y) && - (x <= (gadlist->x + gadlist->Im->Width)) && - (y <= (gadlist->y + gadlist->Im->Height)) && - !(GADGETOFF & gadlist->GadgetFlags)) { + if ((pos.x >= gadlist->x) && (pos.y >= gadlist->y) && + (pos.x <= (gadlist->x + gadlist->Im->Width)) && + (pos.y <= (gadlist->y + gadlist->Im->Height)) && + !(GADGETOFF & gadlist->GadgetFlags)) { if (IsHiRes) { hitgad = gadlist; } else { @@ -108,17 +108,14 @@ void attachGadgetList(Gadget *GadList) { ScreenGadgetList = GadList; } -void mouseHandler(int32 flag, int32 mouseX, int32 mouseY) { +void mouseHandler(int flag, Common::Point pos) { if (NumHidden >= 2) return; - if (!IsHiRes) - mouseX /= 2; - if (flag & 0x02) { /* Left mouse button click */ Gadget *tmp = NULL; if (ScreenGadgetList) - tmp = checkGadgetHit(ScreenGadgetList, mouseX, mouseY); + tmp = checkGadgetHit(ScreenGadgetList, IsHiRes ? pos : Common::Point(pos.x / 2, pos.y)); if (tmp) LastGadgetHit = tmp; @@ -163,7 +160,7 @@ void initMouse() { g_system->setMouseCursor(MouseData, MOUSE_WIDTH, MOUSE_HEIGHT, 0, 0, 0); g_system->showMouse(false); - mouseMove(0, 0); + setMousePos(Common::Point(0, 0)); } @@ -199,23 +196,22 @@ void mouseHide() { /* Gets the current mouse co-ordinates. NOTE: On IBM version, will scale */ /* from virtual to screen co-ordinates automatically. */ /*****************************************************************************/ -void mouseXY(uint16 *x, uint16 *y) { - *x = (uint16)g_lab->_mouseX; - *y = (uint16)g_lab->_mouseY; - - if (!IsHiRes) - (*x) /= 2; +Common::Point getMousePos() { + if (IsHiRes) + return g_lab->_mousePos; + else + return Common::Point(g_lab->_mousePos.x / 2, g_lab->_mousePos.y); } /*****************************************************************************/ /* Moves the mouse to new co-ordinates. */ /*****************************************************************************/ -void mouseMove(uint16 x, uint16 y) { - if (!IsHiRes) - x *= 2; - - g_system->warpMouse(x, y); +void setMousePos(Common::Point pos) { + if (IsHiRes) + g_system->warpMouse(pos.x, pos.y); + else + g_system->warpMouse(pos.x * 2, pos.y); if (!MouseHidden) g_lab->WSDL_ProcessInput(0); @@ -230,15 +226,15 @@ void mouseMove(uint16 x, uint16 y) { bool mouseButton(uint16 *x, uint16 *y, bool leftbutton) { if (leftbutton) { if (LeftClick) { - *x = (!IsHiRes) ? (uint16)g_lab->_mouseX / 2 : (uint16)g_lab->_mouseX; - *y = (uint16)g_lab->_mouseY; + *x = (!IsHiRes) ? (uint16)g_lab->_mousePos.x / 2 : (uint16)g_lab->_mousePos.x; + *y = (uint16)g_lab->_mousePos.y; LeftClick = false; return true; } } else { if (RightClick) { - *x = (!IsHiRes) ? (uint16)g_lab->_mouseX / 2 : (uint16)g_lab->_mouseX; - *y = (uint16)g_lab->_mouseY; + *x = (!IsHiRes) ? (uint16)g_lab->_mousePos.x / 2 : (uint16)g_lab->_mousePos.x; + *y = (uint16)g_lab->_mousePos.y; RightClick = false; return true; } diff --git a/engines/lab/mouse.h b/engines/lab/mouse.h index 5dd77fb964..489bb1e989 100644 --- a/engines/lab/mouse.h +++ b/engines/lab/mouse.h @@ -28,6 +28,7 @@ * */ +#include "common/events.h" #include "lab/stddefines.h" #ifndef LAB_MOUSE_H @@ -45,9 +46,9 @@ void mouseShow(); void mouseHide(); -void mouseXY(uint16 *x, uint16 *y); +Common::Point getMousePos(); -void mouseMove(uint16 x, uint16 y); +void setMousePos(Common::Point pos); bool mouseButton(uint16 *x, uint16 *y, bool leftbutton); @@ -55,7 +56,7 @@ Gadget *mouseGadget(); void attachGadgetList(Gadget *GadList); -void mouseHandler(int32 flag, int32 mouseX, int32 mouseY); +void mouseHandler(int flag, Common::Point pos); } // End of namespace Lab diff --git a/engines/lab/parsefun.h b/engines/lab/parsefun.h index 672d19a95c..f376a23754 100644 --- a/engines/lab/parsefun.h +++ b/engines/lab/parsefun.h @@ -55,9 +55,9 @@ ViewData *getViewData(uint16 RoomNum, uint16 Direction); char *getPictName(CloseDataPtr *LCPtr); void drawDirection(CloseDataPtr LCPtr); bool processArrow(uint16 *Direction, uint16 Arrow); -void setCurClose(uint16 x, uint16 y, CloseDataPtr *cptr, bool useAbsoluteCoords = false); +void setCurClose(Common::Point pos, CloseDataPtr *cptr, bool useAbsoluteCoords = false); bool takeItem(uint16 x, uint16 y, CloseDataPtr *cptr); -bool doActionRule(int16 x, int16 y, int16 action, int16 RoomNum, CloseDataPtr *LCPtr); +bool doActionRule(Common::Point pos, int16 action, int16 RoomNum, CloseDataPtr *LCPtr); bool doOperateRule(int16 x, int16 y, int16 ItemNum, CloseDataPtr *LCPtr); bool doGoForward(CloseDataPtr *LCPtr); bool doTurn(uint16 from, uint16 to, CloseDataPtr *LCPtr); diff --git a/engines/lab/processroom.cpp b/engines/lab/processroom.cpp index ccce27adf3..37c21d8399 100644 --- a/engines/lab/processroom.cpp +++ b/engines/lab/processroom.cpp @@ -259,7 +259,7 @@ bool processArrow(uint16 *direction, uint16 Arrow) { /*****************************************************************************/ /* Sets the current close up data. */ /*****************************************************************************/ -void setCurClose(uint16 x, uint16 y, CloseDataPtr *cptr, bool useAbsoluteCoords) { +void setCurClose(Common::Point pos, CloseDataPtr *cptr, bool useAbsoluteCoords) { ViewData *VPtr; CloseDataPtr LCPtr; uint16 x1, y1, x2, y2; @@ -283,7 +283,7 @@ void setCurClose(uint16 x, uint16 y, CloseDataPtr *cptr, bool useAbsoluteCoords) y2 = scaleY(LCPtr->y2); } - if (x >= x1 && y >= y1 && x <= x2 && y <= y2 && LCPtr->GraphicName) { + if (pos.x >= x1 && pos.y >= y1 && pos.x <= x2 && pos.y <= y2 && LCPtr->GraphicName) { *cptr = LCPtr; return; } @@ -640,7 +640,7 @@ static bool doActionRuleSub(int16 action, int16 roomNum, CloseDataPtr LCPtr, Clo /*****************************************************************************/ /* Goes through the rules if an action is taken. */ /*****************************************************************************/ -bool doActionRule(int16 x, int16 y, int16 action, int16 roomNum, CloseDataPtr *LCPtr) { +bool doActionRule(Common::Point pos, int16 action, int16 roomNum, CloseDataPtr *LCPtr) { CloseDataPtr TLCPtr; if (roomNum) @@ -648,7 +648,7 @@ bool doActionRule(int16 x, int16 y, int16 action, int16 roomNum, CloseDataPtr *L else NewFileName = CurFileName; - TLCPtr = getObject(x, y, *LCPtr); + TLCPtr = getObject(pos.x, pos.y, *LCPtr); if (doActionRuleSub(action, roomNum, TLCPtr, LCPtr, false)) return true; diff --git a/engines/lab/special.cpp b/engines/lab/special.cpp index ea9df4fc13..00ac19f279 100644 --- a/engines/lab/special.cpp +++ b/engines/lab/special.cpp @@ -213,11 +213,11 @@ static void changeCombination(uint16 number) { /*****************************************************************************/ /* Processes mouse clicks and changes the combination. */ /*****************************************************************************/ -void mouseCombination(uint16 x, uint16 y) { +void mouseCombination(Common::Point pos) { uint16 number; - x = VGAUnScaleX(x); - y = VGAUnScaleY(y); + int x = VGAUnScaleX(pos.x); + int y = VGAUnScaleY(pos.y); if ((y >= 63) && (y <= 99)) { if ((x >= 44) && (x < 83)) @@ -437,9 +437,9 @@ static void changeTile(uint16 col, uint16 row) { /*****************************************************************************/ /* Processes mouse clicks and changes the combination. */ /*****************************************************************************/ -void mouseTile(uint16 x, uint16 y) { - x = VGAUnScaleX(x); - y = VGAUnScaleY(y); +void mouseTile(Common::Point pos) { + int x = VGAUnScaleX(pos.x); + int y = VGAUnScaleY(pos.y); if ((x < 101) || (y < 26)) return; @@ -1007,7 +1007,7 @@ static void processMonitor(char *ntext, bool isinteractive, uint16 x1, uint16 y1 TestCPtr = CPtr; MouseY = 64 + (MouseY / MonGadHeight) * 42; MouseX = 101; - setCurClose(MouseX, MouseY, &CPtr, true); + setCurClose(Common::Point(MouseX, MouseY), &CPtr, true); if (TestCPtr != CPtr) { LastCPtr[depth] = TestCPtr; diff --git a/engines/lab/vga.cpp b/engines/lab/vga.cpp index 73d8cf3192..63443cac9c 100644 --- a/engines/lab/vga.cpp +++ b/engines/lab/vga.cpp @@ -90,40 +90,39 @@ void LabEngine::WSDL_ProcessInput(bool can_delay) { switch (event.type) { case Common::EVENT_RBUTTONDOWN: flags |= 8; - mouseHandler(flags, _mouseX, _mouseY); + mouseHandler(flags, _mousePos); break; case Common::EVENT_LBUTTONDOWN: flags |= 2; - mouseHandler(flags, _mouseX, _mouseY); + mouseHandler(flags, _mousePos); break; case Common::EVENT_MOUSEMOVE: { int lastMouseAtEdge = _mouseAtEdge; _mouseAtEdge = false; - _mouseX = event.mouse.x; + _mousePos.x = event.mouse.x; if (event.mouse.x <= 0) { - _mouseX = 0; + _mousePos.x = 0; _mouseAtEdge = true; } - if (_mouseX > g_lab->_screenWidth - 1) { - _mouseX = g_lab->_screenWidth; + if (_mousePos.x > g_lab->_screenWidth - 1) { + _mousePos.x = g_lab->_screenWidth; _mouseAtEdge = true; } - _mouseY = event.mouse.y; + _mousePos.y = event.mouse.y; if (event.mouse.y <= 0) { - _mouseY = 0; + _mousePos.y = 0; _mouseAtEdge = true; } - if (_mouseY > g_lab->_screenHeight - 1) { - _mouseY = g_lab->_screenHeight; + if (_mousePos.y > g_lab->_screenHeight - 1) { + _mousePos.y = g_lab->_screenHeight; _mouseAtEdge = true; } if (!lastMouseAtEdge || !_mouseAtEdge) - mouseHandler(1, _mouseX, _mouseY); - + mouseHandler(1, _mousePos); } break; @@ -167,11 +166,10 @@ void LabEngine::WSDL_ProcessInput(bool can_delay) { g_system->delayMillis(10); } -void LabEngine::WSDL_GetMousePos(int *x, int *y) { +Common::Point LabEngine::WSDL_GetMousePos() { WSDL_ProcessInput(0); - *x = _mouseX; - *y = _mouseY; + return _mousePos; } void LabEngine::waitTOF() { @@ -278,13 +276,13 @@ void LabEngine::drawImage(Image *Im, uint16 x, uint16 y) { dy = 0; } - if ((uint)(dx + w) > g_lab->_screenWidth) + if (dx + w > g_lab->_screenWidth) w = g_lab->_screenWidth - dx; - if ((uint)(dy + h) > g_lab->_screenHeight) + if (dy + h > g_lab->_screenHeight) h = g_lab->_screenHeight - dy; - if (w > 0 && h > 0) { + if ((w > 0) && (h > 0)) { byte *s = Im->ImageData + sy * Im->Width + sx; byte *d = getVGABaseAddr() + dy * g_lab->_screenWidth + dx; @@ -321,13 +319,13 @@ void LabEngine::drawMaskImage(Image *Im, uint16 x, uint16 y) { dy = 0; } - if ((uint)(dx + w) > g_lab->_screenWidth) + if (dx + w > g_lab->_screenWidth) w = g_lab->_screenWidth - dx; - if ((uint)(dy + h) > g_lab->_screenHeight) + if (dy + h > g_lab->_screenHeight) h = g_lab->_screenHeight - dy; - if (w > 0 && h > 0) { + if ((w > 0) && (h > 0)) { byte *s = Im->ImageData + sy * Im->Width + sx; byte *d = getVGABaseAddr() + dy * g_lab->_screenWidth + dx; @@ -374,13 +372,13 @@ void LabEngine::readScreenImage(Image *Im, uint16 x, uint16 y) { dy = 0; } - if ((uint)(dx + w) > g_lab->_screenWidth) + if (dx + w > g_lab->_screenWidth) w = g_lab->_screenWidth - dx; - if ((uint)(dy + h) > g_lab->_screenHeight) + if (dy + h > g_lab->_screenHeight) h = g_lab->_screenHeight - dy; - if (w > 0 && h > 0) { + if ((w > 0) && (h > 0)) { byte *s = Im->ImageData + sy * Im->Width + sx; byte *d = getVGABaseAddr() + dy * g_lab->_screenWidth + dx; @@ -551,13 +549,13 @@ void LabEngine::rectFill(uint16 x1, uint16 y1, uint16 x2, uint16 y2) { dy = 0; } - if ((uint)(dx + w) > g_lab->_screenWidth) + if (dx + w > g_lab->_screenWidth) w = g_lab->_screenWidth - dx; - if ((uint)(dy + h) > g_lab->_screenHeight) + if (dy + h > g_lab->_screenHeight) h = g_lab->_screenHeight - dy; - if (w > 0 && h > 0) { + if ((w > 0) && (h > 0)) { char *d = (char *)getVGABaseAddr() + dy * g_lab->_screenWidth + dx; while (h-- > 0) { @@ -608,13 +606,13 @@ void LabEngine::ghoastRect(uint16 pencolor, uint16 x1, uint16 y1, uint16 x2, uin dy = 0; } - if ((uint)(dx + w) > g_lab->_screenWidth) + if (dx + w > g_lab->_screenWidth) w = g_lab->_screenWidth - dx; - if ((uint)(dy + h) > g_lab->_screenHeight) + if (dy + h > g_lab->_screenHeight) h = g_lab->_screenHeight - dy; - if (w > 0 && h > 0) { + if ((w > 0) && (h > 0)) { char *d = (char *)getVGABaseAddr() + dy * g_lab->_screenWidth + dx; while (h-- > 0) { -- cgit v1.2.3 From 8d70f33efe09b01f6f3d48c83f7fbc5c6835d50e Mon Sep 17 00:00:00 2001 From: Strangerke Date: Sat, 28 Nov 2015 02:27:02 +0100 Subject: LAB: Rename RoomData members --- engines/lab/allocroom.cpp | 20 ++++++++++---------- engines/lab/engine.cpp | 8 +++++--- engines/lab/map.cpp | 8 ++++---- engines/lab/parsetypes.h | 10 +++++----- engines/lab/processroom.cpp | 38 +++++++++++++++++++------------------- engines/lab/resource.cpp | 42 +++++++++++++++++++++--------------------- 6 files changed, 64 insertions(+), 62 deletions(-) diff --git a/engines/lab/allocroom.cpp b/engines/lab/allocroom.cpp index 2b80967032..b98bd24acb 100644 --- a/engines/lab/allocroom.cpp +++ b/engines/lab/allocroom.cpp @@ -39,7 +39,7 @@ namespace Lab { #define EMPTYROOM ((uint16) -1) #define MAXMARKERS 10 -extern RoomData *Rooms; +extern RoomData *_rooms; typedef struct { uint16 RoomNum; @@ -87,19 +87,19 @@ static void freeRoom(uint16 RMarker) { RoomNum = RoomMarkers[RMarker].RoomNum; if (RoomNum != EMPTYROOM) { - Rooms[RoomNum].NorthView = NULL; - Rooms[RoomNum].SouthView = NULL; - Rooms[RoomNum].EastView = NULL; - Rooms[RoomNum].WestView = NULL; + _rooms[RoomNum]._northView = nullptr; + _rooms[RoomNum]._southView = nullptr; + _rooms[RoomNum]._eastView = nullptr; + _rooms[RoomNum]._westView = nullptr; - RuleList *rules = Rooms[RoomNum].rules; + RuleList *rules = _rooms[RoomNum]._rules; for (RuleList::iterator rule = rules->begin(); rule != rules->end(); ++rule) delete *rule; - Rooms[RoomNum].rules->clear(); - delete Rooms[RoomNum].rules; - Rooms[RoomNum].rules = NULL; + _rooms[RoomNum]._rules->clear(); + delete _rooms[RoomNum]._rules; + _rooms[RoomNum]._rules = nullptr; - Rooms[RoomNum].RoomMsg = NULL; + _rooms[RoomNum]._roomMsg = nullptr; } RoomMarkers[RMarker].RoomNum = EMPTYROOM; diff --git a/engines/lab/engine.cpp b/engines/lab/engine.cpp index 837529b846..417cffeac3 100644 --- a/engines/lab/engine.cpp +++ b/engines/lab/engine.cpp @@ -51,7 +51,7 @@ extern bool DoBlack, waitForEffect, stopsound, DoNotDrawMessage, IsHiRes, nopalc /* Global parser data */ -extern RoomData *Rooms; +extern RoomData *_rooms; extern InventoryData *Inventory; extern uint16 NumInv, RoomNum, ManyRooms, HighestCondition, Direction; CloseDataPtr CPtr; @@ -1282,8 +1282,10 @@ from_crumbs: delete g_lab->_conditions; delete g_lab->_roomsFound; - if (Rooms) - free(Rooms); + if (_rooms) { + free(_rooms); + _rooms = nullptr; + } if (Inventory) { for (code = 1; code <= NumInv; code++) { diff --git a/engines/lab/map.cpp b/engines/lab/map.cpp index 50a551473f..8cb1eaf189 100644 --- a/engines/lab/map.cpp +++ b/engines/lab/map.cpp @@ -127,7 +127,7 @@ void readImage(byte **buffer, Image **im) { /*------------------------------ The Map stuff ------------------------------*/ /*---------------------------------------------------------------------------*/ -extern RoomData *Rooms; +extern RoomData *_rooms; static Image *Map, *Room, *UpArrowRoom, *DownArrowRoom, *Bridge, *HRoom, *VRoom, *Maze, *HugeMaze, *Path, *MapNorth, @@ -646,7 +646,7 @@ static void drawMap(uint16 CurRoom, uint16 CurMsg, uint16 Floor, bool fadeout, b if (sptr) flowText(MsgFont, 0, 5, 3, true, true, true, true, VGAScaleX(14), VGAScaleY(75), VGAScaleX(134), VGAScaleY(97), sptr); - if ((sptr = Rooms[CurMsg].RoomMsg)) + if ((sptr = _rooms[CurMsg]._roomMsg)) flowText(MsgFont, 0, 5, 3, true, true, true, true, VGAScaleX(14), VGAScaleY(148), VGAScaleX(134), VGAScaleY(186), sptr); if (fadein) @@ -795,10 +795,10 @@ void processMap(uint16 CurRoom) { } if (OldMsg != CurMsg) { - if (Rooms[CurMsg].RoomMsg == NULL) + if (_rooms[CurMsg]._roomMsg == nullptr) g_resource->readViews(CurMsg); - if ((sptr = Rooms[CurMsg].RoomMsg)) { + if ((sptr = _rooms[CurMsg]._roomMsg)) { mouseHide(); g_lab->setAPen(3); g_lab->rectFill(VGAScaleX(13), VGAScaleY(148), VGAScaleX(135), VGAScaleY(186)); diff --git a/engines/lab/parsetypes.h b/engines/lab/parsetypes.h index 681bbe70ae..e482775f5d 100644 --- a/engines/lab/parsetypes.h +++ b/engines/lab/parsetypes.h @@ -134,13 +134,13 @@ struct Rule { typedef Common::List RuleList; struct RoomData { - uint16 NorthDoor, SouthDoor, EastDoor, WestDoor; + uint16 _northDoor, _southDoor, _eastDoor, _westDoor; - byte WipeType; + byte _wipeType; - ViewData *NorthView, *SouthView, *EastView, *WestView; - RuleList *rules; - char *RoomMsg; + ViewData *_northView, *_southView, *_eastView, *_westView; + RuleList *_rules; + char *_roomMsg; }; struct InventoryData { diff --git a/engines/lab/processroom.cpp b/engines/lab/processroom.cpp index 37c21d8399..645e202867 100644 --- a/engines/lab/processroom.cpp +++ b/engines/lab/processroom.cpp @@ -45,7 +45,7 @@ namespace Lab { #define NOFILE "no file" -RoomData *Rooms; +RoomData *_rooms; InventoryData *Inventory; uint16 NumInv, RoomNum, ManyRooms, HighestCondition, Direction; const char *NewFileName; @@ -95,17 +95,17 @@ static bool checkConditions(int16 *Condition) { ViewData *getViewData(uint16 roomNum, uint16 direction) { ViewData *view = NULL; - if (!Rooms[roomNum].RoomMsg) + if (!_rooms[roomNum]._roomMsg) g_resource->readViews(roomNum); if (direction == NORTH) - view = Rooms[roomNum].NorthView; + view = _rooms[roomNum]._northView; else if (direction == SOUTH) - view = Rooms[roomNum].SouthView; + view = _rooms[roomNum]._southView; else if (direction == EAST) - view = Rooms[roomNum].EastView; + view = _rooms[roomNum]._eastView; else if (direction == WEST) - view = Rooms[roomNum].WestView; + view = _rooms[roomNum]._westView; do { if (checkConditions(view->Condition)) @@ -196,8 +196,8 @@ void drawDirection(CloseDataPtr LCPtr) { Common::String message; - if (Rooms[RoomNum].RoomMsg) { - message += Rooms[RoomNum].RoomMsg; + if (_rooms[RoomNum]._roomMsg) { + message += _rooms[RoomNum]._roomMsg; message += ", "; } @@ -221,13 +221,13 @@ bool processArrow(uint16 *direction, uint16 Arrow) { if (Arrow == 1) { /* Forward */ if (*direction == NORTH) - room = Rooms[RoomNum].NorthDoor; + room = _rooms[RoomNum]._northDoor; else if (*direction == SOUTH) - room = Rooms[RoomNum].SouthDoor; + room = _rooms[RoomNum]._southDoor; else if (*direction == EAST) - room = Rooms[RoomNum].EastDoor; + room = _rooms[RoomNum]._eastDoor; else if (*direction == WEST) - room = Rooms[RoomNum].WestDoor; + room = _rooms[RoomNum]._westDoor; if (room == 0) return false; @@ -611,11 +611,11 @@ static bool doActionRuleSub(int16 action, int16 roomNum, CloseDataPtr LCPtr, Clo action++; if (LCPtr) { - RuleList *rules = Rooms[RoomNum].rules; + RuleList *rules = _rooms[RoomNum]._rules; if ((rules == NULL) && (roomNum == 0)) { g_resource->readViews(roomNum); - rules = Rooms[roomNum].rules; + rules = _rooms[roomNum]._rules; } for (RuleList::iterator rule = rules->begin(); rule != rules->end(); ++rule) { @@ -668,11 +668,11 @@ bool doActionRule(Common::Point pos, int16 action, int16 roomNum, CloseDataPtr * static bool doOperateRuleSub(int16 ItemNum, int16 roomNum, CloseDataPtr LCPtr, CloseDataPtr *Set, bool AllowDefaults) { if (LCPtr) if (LCPtr->CloseUpType > 0) { - RuleList *rules = Rooms[roomNum].rules; + RuleList *rules = _rooms[roomNum]._rules; if ((rules == NULL) && (roomNum == 0)) { g_resource->readViews(roomNum); - rules = Rooms[roomNum].rules; + rules = _rooms[roomNum]._rules; } for (RuleList::iterator rule = rules->begin(); rule != rules->end(); ++rule) { @@ -728,7 +728,7 @@ bool doOperateRule(int16 x, int16 y, int16 ItemNum, CloseDataPtr *LCPtr) { /* Goes thru the rules if the user tries to go forward. */ /*****************************************************************************/ bool doGoForward(CloseDataPtr *LCPtr) { - RuleList *rules = Rooms[RoomNum].rules; + RuleList *rules = _rooms[RoomNum]._rules; for (RuleList::iterator rule = rules->begin(); rule != rules->end(); ++rule) { if (((*rule)->RuleType == GOFORWARD) && ((*rule)->Param1 == (Direction + 1))) { @@ -749,7 +749,7 @@ bool doTurn(uint16 from, uint16 to, CloseDataPtr *LCPtr) { from++; to++; - RuleList *rules = Rooms[RoomNum].rules; + RuleList *rules = _rooms[RoomNum]._rules; for (RuleList::iterator rule = rules->begin(); rule != rules->end(); ++rule) { if (((*rule)->RuleType == TURN) || @@ -769,7 +769,7 @@ bool doTurn(uint16 from, uint16 to, CloseDataPtr *LCPtr) { /* Goes thru the rules if the user tries to go to the main view */ /*****************************************************************************/ bool doMainView(CloseDataPtr *LCPtr) { - RuleList *rules = Rooms[RoomNum].rules; + RuleList *rules = _rooms[RoomNum]._rules; for (RuleList::iterator rule = rules->begin(); rule != rules->end(); ++rule) { if ((*rule)->RuleType == GOMAINVIEW) { if (checkConditions((*rule)->Condition)) { diff --git a/engines/lab/resource.cpp b/engines/lab/resource.cpp index e2afcc6889..180152e218 100644 --- a/engines/lab/resource.cpp +++ b/engines/lab/resource.cpp @@ -35,7 +35,7 @@ namespace Lab { static uint16 allocroom; -extern RoomData *Rooms; +extern RoomData *_rooms; extern InventoryData *Inventory; extern uint16 NumInv, ManyRooms, HighestCondition; @@ -87,22 +87,22 @@ bool Resource::readRoomData(const char *fileName) { ManyRooms = dataFile->readUint16LE(); HighestCondition = dataFile->readUint16LE(); - Rooms = (RoomData *)malloc((ManyRooms + 1) * sizeof(RoomData)); - memset(Rooms, 0, (ManyRooms + 1) * sizeof(RoomData)); + _rooms = (RoomData *)malloc((ManyRooms + 1) * sizeof(RoomData)); + memset(_rooms, 0, (ManyRooms + 1) * sizeof(RoomData)); for (uint16 i = 1; i <= ManyRooms; i++) { - Rooms[i].NorthDoor = dataFile->readUint16LE(); - Rooms[i].SouthDoor = dataFile->readUint16LE(); - Rooms[i].EastDoor = dataFile->readUint16LE(); - Rooms[i].WestDoor = dataFile->readUint16LE(); - Rooms[i].WipeType = dataFile->readByte(); - - Rooms[i].NorthView = NULL; - Rooms[i].SouthView = NULL; - Rooms[i].EastView = NULL; - Rooms[i].WestView = NULL; - Rooms[i].rules = NULL; - Rooms[i].RoomMsg = NULL; + _rooms[i]._northDoor = dataFile->readUint16LE(); + _rooms[i]._southDoor = dataFile->readUint16LE(); + _rooms[i]._eastDoor = dataFile->readUint16LE(); + _rooms[i]._westDoor = dataFile->readUint16LE(); + _rooms[i]._wipeType = dataFile->readByte(); + + _rooms[i]._northView = nullptr; + _rooms[i]._southView = nullptr; + _rooms[i]._eastView = nullptr; + _rooms[i]._westView = nullptr; + _rooms[i]._rules = nullptr; + _rooms[i]._roomMsg = nullptr; } delete dataFile; @@ -135,12 +135,12 @@ bool Resource::readViews(uint16 roomNum) { allocroom = roomNum; - Rooms[roomNum].RoomMsg = readString(dataFile); - Rooms[roomNum].NorthView = readView(dataFile); - Rooms[roomNum].SouthView = readView(dataFile); - Rooms[roomNum].EastView = readView(dataFile); - Rooms[roomNum].WestView = readView(dataFile); - Rooms[roomNum].rules = readRule(dataFile); + _rooms[roomNum]._roomMsg = readString(dataFile); + _rooms[roomNum]._northView = readView(dataFile); + _rooms[roomNum]._southView = readView(dataFile); + _rooms[roomNum]._eastView = readView(dataFile); + _rooms[roomNum]._westView = readView(dataFile); + _rooms[roomNum]._rules = readRule(dataFile); g_music->updateMusic(); -- cgit v1.2.3 From d96484d81c2645b7b714845a9176ba264f52bbc0 Mon Sep 17 00:00:00 2001 From: Strangerke Date: Sun, 29 Nov 2015 18:10:06 +0100 Subject: LAB: Move mouse code in separate class, move some functions to LabEngine. (WIP) --- engines/lab/engine.cpp | 58 +++++++++++++++++++-------------------------- engines/lab/graphics.cpp | 53 +++++++++++++++-------------------------- engines/lab/interface.cpp | 23 +++++++++--------- engines/lab/intro.cpp | 9 ++++--- engines/lab/lab.cpp | 2 ++ engines/lab/lab.h | 29 +++++++++++++++++++++++ engines/lab/labmusic.cpp | 2 +- engines/lab/map.cpp | 32 ++++++++++++------------- engines/lab/mouse.cpp | 28 +++++++++++----------- engines/lab/mouse.h | 40 ++++++++++++++++--------------- engines/lab/processroom.cpp | 18 +++++++------- engines/lab/readdiff.cpp | 19 ++++++--------- engines/lab/special.cpp | 34 +++++++++++++------------- engines/lab/vga.cpp | 6 ++--- 14 files changed, 177 insertions(+), 176 deletions(-) diff --git a/engines/lab/engine.cpp b/engines/lab/engine.cpp index 417cffeac3..edf23f307a 100644 --- a/engines/lab/engine.cpp +++ b/engines/lab/engine.cpp @@ -132,7 +132,7 @@ static char initcolors[] = { '\x00', '\x00', '\x00', '\x30', /* Draws the control panel display. */ /******************************************************************************/ void LabEngine::drawPanel() { - mouseHide(); + _event->mouseHide(); setAPen(3); /* Clear Area */ rectFill(0, VGAScaleY(149) + SVGACord(2), VGAScaleX(319), VGAScaleY(199)); @@ -178,7 +178,7 @@ void LabEngine::drawPanel() { drawGadgetList(InvGadgetList); } - mouseShow(); + _event->mouseShow(); } @@ -192,7 +192,7 @@ static bool LastTooLong = false; /******************************************************************************/ /* Draws the message for the room. */ /******************************************************************************/ -static void drawRoomMessage(uint16 CurInv, CloseDataPtr cptr) { +void LabEngine::drawRoomMessage(uint16 CurInv, CloseDataPtr cptr) { if (LastTooLong) { LastTooLong = false; return; @@ -360,9 +360,9 @@ void LabEngine::perFlipGadget(uint16 GadID) { TopGad->ImAlt = Temp; if (!Alternate) { - mouseHide(); + _event->mouseHide(); drawImage(TopGad->Im, TopGad->x, TopGad->y); - mouseShow(); + _event->mouseShow(); } return; @@ -376,7 +376,7 @@ void LabEngine::perFlipGadget(uint16 GadID) { /******************************************************************************/ /* Eats all the available messages. */ /******************************************************************************/ -void eatMessages() { +void LabEngine::eatMessages() { IntuiMessage *Msg; do { @@ -479,49 +479,39 @@ static const char *getInvName(uint16 CurInv) { return Inventory[CurInv].BInvName; } - - - static bool interfaceisoff = false; - /******************************************************************************/ /* Turns the interface off. */ /******************************************************************************/ -static void interfaceOff() { +void LabEngine::interfaceOff() { if (!interfaceisoff) { - attachGadgetList(NULL); - mouseHide(); + _event->attachGadgetList(NULL); + _event->mouseHide(); interfaceisoff = true; } } - - - /******************************************************************************/ /* Turns the interface on. */ /******************************************************************************/ -static void interfaceOn() { +void LabEngine::interfaceOn() { if (interfaceisoff) { interfaceisoff = false; - mouseShow(); + _event->mouseShow(); } if (LongWinInFront) - attachGadgetList(NULL); + _event->attachGadgetList(NULL); else if (Alternate) - attachGadgetList(InvGadgetList); + _event->attachGadgetList(InvGadgetList); else - attachGadgetList(MoveGadgetList); + _event->attachGadgetList(MoveGadgetList); } - - static const char *Test; - /******************************************************************************/ /* If the user hits the "Use" gadget; things that can get used on themselves. */ /******************************************************************************/ @@ -590,7 +580,7 @@ bool LabEngine::doUse(uint16 CurInv) { /******************************************************************************/ /* Decrements the current inventory number. */ /******************************************************************************/ -static void decIncInv(uint16 *CurInv, bool dec) { +void LabEngine::decIncInv(uint16 *CurInv, bool dec) { interfaceOff(); if (dec) @@ -792,7 +782,7 @@ from_crumbs: if (code == 13) { /* The return key */ Class = MOUSEBUTTONS; Qualifier = IEQUALIFIER_LEFTBUTTON; - curPos = getMousePos(); + curPos = _event->getMousePos(); } else if (g_lab->getPlatform() == Common::kPlatformWindows && (code == 'b' || code == 'B')) { /* Start bread crumbs */ BreadCrumbs[0].RoomNum = 0; @@ -1254,7 +1244,7 @@ from_crumbs: } if (HCPtr) - setMousePos(Common::Point(scaleX((HCPtr->x1 + HCPtr->x2) / 2), scaleY((HCPtr->y1 + HCPtr->y2) / 2))); + _event->setMousePos(Common::Point(scaleX((HCPtr->x1 + HCPtr->x2) / 2), scaleY((HCPtr->y1 + HCPtr->y2) / 2))); } else if ((Class == MOUSEBUTTONS) && (IEQUALIFIER_RBUTTON & Qualifier)) { eatMessages(); Alternate = !Alternate; @@ -1325,7 +1315,7 @@ void LabEngine::go() { mem = mem && setUpScreens(); } - initMouse(); + _event->initMouse(); mem = mem && initRoomBuffer(); @@ -1334,7 +1324,7 @@ void LabEngine::go() { MsgFont = g_resource->getFont("P:AvanteG.12"); - mouseHide(); + _event->mouseHide(); if (dointro && mem) { Intro intro; @@ -1343,7 +1333,7 @@ void LabEngine::go() { DoBlack = true; if (mem) { - mouseShow(); + _event->mouseShow(); mainGameLoop(); } else debug("\n\nNot enough memory to start game.\n\n"); @@ -1454,9 +1444,9 @@ void LabEngine::mayShowCrumbIndicator() { return; if (DroppingCrumbs && MainDisplay) { - mouseHide(); + _event->mouseHide(); drawMaskImage(&DropCrumbsImage, 612, 4); - mouseShow(); + _event->mouseShow(); } } @@ -1465,9 +1455,9 @@ void LabEngine::mayShowCrumbIndicatorOff() { return; if (MainDisplay) { - mouseHide(); + _event->mouseHide(); drawMaskImage(&DropCrumbsOffImage, 612, 4); - mouseShow(); + _event->mouseShow(); } } diff --git a/engines/lab/graphics.cpp b/engines/lab/graphics.cpp index fbf8c45809..ab04c3e67a 100644 --- a/engines/lab/graphics.cpp +++ b/engines/lab/graphics.cpp @@ -338,14 +338,14 @@ void createBox(uint16 y2) { bool LastMessageLong = false; -int32 longDrawMessage(const char *str) { +int32 LabEngine::longDrawMessage(const char *str) { char NewText[512]; if (str == NULL) return 0; - attachGadgetList(NULL); - mouseHide(); + _event->attachGadgetList(NULL); + _event->mouseHide(); strcpy(NewText, str); if (!LongWinInFront) { @@ -355,21 +355,19 @@ int32 longDrawMessage(const char *str) { } createBox(198); - mouseShow(); + _event->mouseShow(); return flowText(MsgFont, 0, 1, 7, false, true, true, true, VGAScaleX(6), VGAScaleY(155), VGAScaleX(313), VGAScaleY(195), str); } - - -void drawStaticMessage(byte index) { +void LabEngine::drawStaticMessage(byte index) { drawMessage(g_resource->getStaticText((StaticText)index).c_str()); } /******************************************************************************/ /* Draws a message to the message box. */ /******************************************************************************/ -void drawMessage(const char *str) { +void LabEngine::drawMessage(const char *str) { if (DoNotDrawMessage) { DoNotDrawMessage = false; return; @@ -385,10 +383,10 @@ void drawMessage(const char *str) { g_lab->drawPanel(); } - mouseHide(); + _event->mouseHide(); createBox(168); text(MsgFont, VGAScaleX(7), VGAScaleY(155) + SVGACord(2), 1, str, strlen(str)); - mouseShow(); + _event->mouseShow(); LastMessageLong = false; } } @@ -412,14 +410,14 @@ void drawMessage(const char *str) { /*****************************************************************************/ /* Scrolls the display to black. */ /*****************************************************************************/ -static void doScrollBlack() { +void LabEngine::doScrollBlack() { byte *mem, *tempmem; Image Im; uint16 width, height, by, nheight; uint32 size, copysize; uint32 *BaseAddr; - mouseHide(); + _event->mouseHide(); width = VGAScaleX(320); height = VGAScaleY(149) + SVGACord(2); @@ -481,18 +479,12 @@ static void doScrollBlack() { } freeAllStolenMem(); - mouseShow(); + _event->mouseShow(); } - - - extern BitMap RawDiffBM; extern DIFFHeader headerdata; - - - static void copyPage(uint16 width, uint16 height, uint16 nheight, uint16 startline, byte *mem) { uint32 size, OffSet, copysize; uint16 CurPage; @@ -524,11 +516,11 @@ static void copyPage(uint16 width, uint16 height, uint16 nheight, uint16 startli /*****************************************************************************/ /* Scrolls the display to a new picture from a black screen. */ /*****************************************************************************/ -static void doScrollWipe(char *filename) { +void LabEngine::doScrollWipe(char *filename) { byte *mem; uint16 width, height, by, nheight, startline = 0, onrow = 0; - mouseHide(); + _event->mouseHide(); width = VGAScaleX(320); height = VGAScaleY(149) + SVGACord(2); @@ -576,16 +568,13 @@ static void doScrollWipe(char *filename) { by = VGAScaleX(3); } - mouseShow(); + _event->mouseShow(); } - - - /*****************************************************************************/ /* Does the scroll bounce. Assumes bitmap already in memory. */ /*****************************************************************************/ -static void doScrollBounce() { +void LabEngine::doScrollBounce() { const uint16 *newby, *newby1; const uint16 newbyd[5] = {5, 4, 3, 2, 1}, newby1d[8] = {3, 3, 2, 2, 2, 1, 1, 1}; @@ -600,7 +589,7 @@ static void doScrollBounce() { } - mouseHide(); + _event->mouseHide(); int width = VGAScaleX(320); int height = VGAScaleY(149) + SVGACord(2); byte *mem = RawDiffBM.Planes[0]; @@ -627,15 +616,13 @@ static void doScrollBounce() { } - mouseShow(); + _event->mouseShow(); } - - /*****************************************************************************/ /* Does the transporter wipe. */ /*****************************************************************************/ -static void doTransWipe(CloseDataPtr *CPtr, char *filename) { +void LabEngine::doTransWipe(CloseDataPtr *CPtr, char *filename) { uint16 LastY, CurY, linesdone = 0, lineslast; Image ImSource, ImDest; @@ -743,12 +730,10 @@ static void doTransWipe(CloseDataPtr *CPtr, char *filename) { } } - - /*****************************************************************************/ /* Does a certain number of pre-programmed wipes. */ /*****************************************************************************/ -void doWipe(uint16 WipeType, CloseDataPtr *CPtr, char *filename) { +void LabEngine::doWipe(uint16 WipeType, CloseDataPtr *CPtr, char *filename) { if ((WipeType == TRANSWIPE) || (WipeType == TRANSPORTER)) doTransWipe(CPtr, filename); else if (WipeType == SCROLLWIPE) diff --git a/engines/lab/interface.cpp b/engines/lab/interface.cpp index 36891d7fe8..d9ea4595e8 100644 --- a/engines/lab/interface.cpp +++ b/engines/lab/interface.cpp @@ -125,20 +125,20 @@ uint16 makeGadgetKeyEquiv(uint16 key) { /* Checks whether or not the cords fall within one of the gadgets in a list */ /* of gadgets. */ /*****************************************************************************/ -static Gadget *checkNumGadgetHit(Gadget *gadlist, uint16 key) { +Gadget *LabEngine::checkNumGadgetHit(Gadget *gadlist, uint16 key) { uint16 gkey = key - '0'; while (gadlist != NULL) { if ((gkey - 1 == gadlist->GadgetID || (gkey == 0 && gadlist->GadgetID == 9) || (gadlist->KeyEquiv != 0 && makeGadgetKeyEquiv(key) == gadlist->KeyEquiv)) && !(GADGETOFF & gadlist->GadgetFlags)) { - mouseHide(); + _event->mouseHide(); g_lab->drawImage(gadlist->ImAlt, gadlist->x, gadlist->y); - mouseShow(); + _event->mouseShow(); g_system->delayMillis(80); - mouseHide(); + _event->mouseHide(); g_lab->drawImage(gadlist->Im, gadlist->x, gadlist->y); - mouseShow(); + _event->mouseShow(); return gadlist; } else { @@ -163,30 +163,29 @@ static bool keyPress(uint16 *KeyCode) { return false; } - IntuiMessage IMessage; extern Gadget *ScreenGadgetList; -IntuiMessage *getMsg() { +IntuiMessage *LabEngine::getMsg() { Gadget *curgad; int Qualifiers; - updateMouse(); + _event->updateMouse(); Qualifiers = _keyPressed.flags; - if ((curgad = mouseGadget()) != NULL) { - updateMouse(); + if ((curgad = _event->mouseGadget()) != NULL) { + _event->updateMouse(); IMessage.msgClass = GADGETUP; IMessage.code = curgad->GadgetID; IMessage.gadgetID = curgad->GadgetID; IMessage.qualifier = Qualifiers; return &IMessage; - } else if (mouseButton(&IMessage.mouseX, &IMessage.mouseY, true)) { /* Left Button */ + } else if (_event->mouseButton(&IMessage.mouseX, &IMessage.mouseY, true)) { /* Left Button */ IMessage.qualifier = IEQUALIFIER_LEFTBUTTON | Qualifiers; IMessage.msgClass = MOUSEBUTTONS; return &IMessage; - } else if (mouseButton(&IMessage.mouseX, &IMessage.mouseY, false)) { /* Right Button */ + } else if (_event->mouseButton(&IMessage.mouseX, &IMessage.mouseY, false)) { /* Right Button */ IMessage.qualifier = IEQUALIFIER_RBUTTON | Qualifiers; IMessage.msgClass = MOUSEBUTTONS; return &IMessage; diff --git a/engines/lab/intro.cpp b/engines/lab/intro.cpp index b3a5ccd6da..43bb7c6cb9 100644 --- a/engines/lab/intro.cpp +++ b/engines/lab/intro.cpp @@ -52,7 +52,7 @@ Intro::Intro() { /******************************************************************************/ void Intro::introEatMessages() { while (1) { - IntuiMessage *msg = getMsg(); + IntuiMessage *msg = g_lab->getMsg(); if (g_engine->shouldQuit()) { _quitIntro = true; @@ -121,7 +121,7 @@ void Intro::doPictText(const char *filename, bool isscreen) { Drawn = flowText(_msgfont, (!IsHiRes) * -1, 5, 7, false, false, true, true, VGAScaleX(14), VGAScaleY(11), VGAScaleX(306), VGAScaleY(189), (char *)curplace); fade(true, 0); } else { - Drawn = longDrawMessage((char *)curplace); + Drawn = g_lab->longDrawMessage((char *)curplace); } curplace += Drawn; @@ -141,12 +141,11 @@ void Intro::doPictText(const char *filename, bool isscreen) { g_lab->getTime(&lastsecs, &lastmicros); } - msg = getMsg(); + msg = g_lab->getMsg(); if (msg == NULL) { g_music->updateMusic(); - diffNextFrame(); - + g_lab->diffNextFrame(); g_lab->getTime(&secs, µs); g_lab->anyTimeDiff(lastsecs, lastmicros, secs, micros, &secs, µs); diff --git a/engines/lab/lab.cpp b/engines/lab/lab.cpp index 92607d492b..5cc49b0462 100644 --- a/engines/lab/lab.cpp +++ b/engines/lab/lab.cpp @@ -90,6 +90,8 @@ Common::Error LabEngine::run() { else initGraphics(640, 480, true); + _event = new EventManager(this); + g_music = new Music(); g_resource = new Resource(); diff --git a/engines/lab/lab.h b/engines/lab/lab.h index 659637d13a..4b5f5d1d37 100644 --- a/engines/lab/lab.h +++ b/engines/lab/lab.h @@ -36,6 +36,8 @@ #include "engines/engine.h" #include "lab/labfun.h" +#include "lab/interface.h" +#include "lab/mouse.h" struct ADGameDescription; @@ -96,6 +98,7 @@ private: byte _curapen; public: + EventManager *_event; byte *_currentDsplayBuffer; Common::Point _mousePos; @@ -137,6 +140,32 @@ public: void writeColorRegsSmooth(byte *buf, uint16 first, uint16 numreg); void drawPanel(); + void drawRoomMessage(uint16 CurInv, CloseDataPtr cptr); + void interfaceOff(); + void interfaceOn(); + void decIncInv(uint16 *CurInv, bool dec); + int32 longDrawMessage(const char *str); + void drawMessage(const char *str); + void doScrollBlack(); + void doScrollWipe(char *filename); + void doScrollBounce(); + void doWipe(uint16 WipeType, CloseDataPtr *CPtr, char *filename); + void doTransWipe(CloseDataPtr *CPtr, char *filename); + Gadget *checkNumGadgetHit(Gadget *gadlist, uint16 key); + IntuiMessage *getMsg(); + void drawMap(uint16 CurRoom, uint16 CurMsg, uint16 Floor, bool fadeout, bool fadein); + void processMap(uint16 CurRoom); + void doMap(uint16 CurRoom); + void diffNextFrame(); + void drawJournal(uint16 wipenum, bool needFade); + void processJournal(); + void doJournal(); + void drawMonText(char *text, uint16 x1, uint16 y1, uint16 x2, uint16 y2, bool isinteractive); + void processMonitor(char *ntext, bool isinteractive, uint16 x1, uint16 y1, uint16 x2, uint16 y2); + void doMonitor(char *background, char *textfile, bool isinteractive, uint16 x1, uint16 y1, uint16 x2, uint16 y2); + void eatMessages(); + void drawStaticMessage(byte index); + void drawDirection(CloseDataPtr LCPtr); private: void quickWaitTOF(); diff --git a/engines/lab/labmusic.cpp b/engines/lab/labmusic.cpp index ed45bfa759..a7043dc424 100644 --- a/engines/lab/labmusic.cpp +++ b/engines/lab/labmusic.cpp @@ -73,7 +73,7 @@ Music::Music() { void Music::updateMusic() { g_lab->WSDL_ProcessInput(0); - updateMouse(); + g_lab->_event->updateMouse(); if (_musicOn && getPlayingBufferCount() < MAXBUFFERS) { // NOTE: We need to use malloc(), cause this will be freed with free() diff --git a/engines/lab/map.cpp b/engines/lab/map.cpp index 8cb1eaf189..98082b73f8 100644 --- a/engines/lab/map.cpp +++ b/engines/lab/map.cpp @@ -553,13 +553,13 @@ static void getDownFloor(uint16 *Floor, bool *isfloor) { /*****************************************************************************/ /* Draws the map */ /*****************************************************************************/ -static void drawMap(uint16 CurRoom, uint16 CurMsg, uint16 Floor, bool fadeout, bool fadein) { +void LabEngine::drawMap(uint16 CurRoom, uint16 CurMsg, uint16 Floor, bool fadeout, bool fadein) { char *sptr; uint16 tempfloor; bool noghoast; - mouseHide(); + _event->mouseHide(); if (fadeout) fade(false, 0); @@ -652,13 +652,13 @@ static void drawMap(uint16 CurRoom, uint16 CurMsg, uint16 Floor, bool fadeout, b if (fadein) fade(true, 0); - mouseShow(); + _event->mouseShow(); } /*****************************************************************************/ /* Processes the map. */ /*****************************************************************************/ -void processMap(uint16 CurRoom) { +void LabEngine::processMap(uint16 CurRoom) { uint32 Class, place = 1; uint16 Code, Qualifier, MouseX, MouseY, GadgetID, CurFloor, OldFloor, OldMsg, CurMsg, x1, y1, x2, y2; char *sptr; @@ -688,13 +688,13 @@ void processMap(uint16 CurRoom) { g_lab->waitTOF(); g_lab->writeColorReg(newcolor, 1); - updateMouse(); + _event->updateMouse(); g_lab->waitTOF(); - updateMouse(); + _event->updateMouse(); g_lab->waitTOF(); - updateMouse(); + _event->updateMouse(); g_lab->waitTOF(); - updateMouse(); + _event->updateMouse(); place++; @@ -799,7 +799,7 @@ void processMap(uint16 CurRoom) { g_resource->readViews(CurMsg); if ((sptr = _rooms[CurMsg]._roomMsg)) { - mouseHide(); + _event->mouseHide(); g_lab->setAPen(3); g_lab->rectFill(VGAScaleX(13), VGAScaleY(148), VGAScaleX(135), VGAScaleY(186)); flowText(MsgFont, 0, 5, 3, true, true, true, true, VGAScaleX(14), VGAScaleY(148), VGAScaleX(134), VGAScaleY(186), sptr); @@ -816,7 +816,7 @@ void processMap(uint16 CurRoom) { g_lab->rectFill(x1 - 1, y1, x1, y1); } - mouseShow(); + _event->mouseShow(); } } } @@ -831,7 +831,7 @@ void processMap(uint16 CurRoom) { /*****************************************************************************/ /* Does the map processing. */ /*****************************************************************************/ -void doMap(uint16 CurRoom) { +void LabEngine::doMap(uint16 CurRoom) { FadePalette = AmigaMapPalette; g_music->updateMusic(); @@ -848,19 +848,19 @@ void doMap(uint16 CurRoom) { XMark = MapWest; drawMap(CurRoom, CurRoom, Maps[CurRoom].PageNumber, false, true); - mouseShow(); - attachGadgetList(MapGadgetList); + _event->mouseShow(); + _event->attachGadgetList(MapGadgetList); g_lab->WSDL_UpdateScreen(); processMap(CurRoom); - attachGadgetList(NULL); + _event->attachGadgetList(NULL); fade(false, 0); blackAllScreen(); - mouseHide(); + _event->mouseHide(); g_lab->setAPen(0); g_lab->rectFill(0, 0, g_lab->_screenWidth - 1, g_lab->_screenHeight - 1); freeMapData(); blackAllScreen(); - mouseShow(); + _event->mouseShow(); g_lab->WSDL_UpdateScreen(); } diff --git a/engines/lab/mouse.cpp b/engines/lab/mouse.cpp index 4fc8644dd1..73fdd2eb07 100644 --- a/engines/lab/mouse.cpp +++ b/engines/lab/mouse.cpp @@ -69,7 +69,7 @@ static Gadget *hitgad = NULL; /* Checks whether or not the cords fall within one of the gadgets in a list */ /* of gadgets. */ /*****************************************************************************/ -static Gadget *checkGadgetHit(Gadget *gadlist, Common::Point pos) { +Gadget *EventManager::checkGadgetHit(Gadget *gadlist, Common::Point pos) { while (gadlist != NULL) { if ((pos.x >= gadlist->x) && (pos.y >= gadlist->y) && (pos.x <= (gadlist->x + gadlist->Im->Width)) && @@ -101,14 +101,17 @@ static Gadget *checkGadgetHit(Gadget *gadlist, Common::Point pos) { -void attachGadgetList(Gadget *GadList) { +void EventManager::attachGadgetList(Gadget *GadList) { if (ScreenGadgetList != GadList) LastGadgetHit = NULL; ScreenGadgetList = GadList; } -void mouseHandler(int flag, Common::Point pos) { +EventManager::EventManager(LabEngine *vm) : _vm(vm) { +} + +void EventManager::mouseHandler(int flag, Common::Point pos) { if (NumHidden >= 2) return; @@ -127,7 +130,7 @@ void mouseHandler(int flag, Common::Point pos) { RightClick = true; } -void updateMouse() { +void EventManager::updateMouse() { bool doUpdateDisplay = false; if (!MouseHidden) @@ -156,7 +159,7 @@ void updateMouse() { /*****************************************************************************/ /* Initializes the mouse. */ /*****************************************************************************/ -void initMouse() { +void EventManager::initMouse() { g_system->setMouseCursor(MouseData, MOUSE_WIDTH, MOUSE_HEIGHT, 0, 0, 0); g_system->showMouse(false); @@ -167,7 +170,7 @@ void initMouse() { /*****************************************************************************/ /* Shows the mouse. */ /*****************************************************************************/ -void mouseShow() { +void EventManager::mouseShow() { if (NumHidden) NumHidden--; @@ -182,7 +185,7 @@ void mouseShow() { /*****************************************************************************/ /* Hides the mouse. */ /*****************************************************************************/ -void mouseHide() { +void EventManager::mouseHide() { NumHidden++; if (NumHidden && !MouseHidden) { @@ -196,7 +199,7 @@ void mouseHide() { /* Gets the current mouse co-ordinates. NOTE: On IBM version, will scale */ /* from virtual to screen co-ordinates automatically. */ /*****************************************************************************/ -Common::Point getMousePos() { +Common::Point EventManager::getMousePos() { if (IsHiRes) return g_lab->_mousePos; else @@ -207,7 +210,7 @@ Common::Point getMousePos() { /*****************************************************************************/ /* Moves the mouse to new co-ordinates. */ /*****************************************************************************/ -void setMousePos(Common::Point pos) { +void EventManager::setMousePos(Common::Point pos) { if (IsHiRes) g_system->warpMouse(pos.x, pos.y); else @@ -223,7 +226,7 @@ void setMousePos(Common::Point pos) { /* co-ordinates of the button press. leftbutton tells whether to check the */ /* left or right button. */ /*****************************************************************************/ -bool mouseButton(uint16 *x, uint16 *y, bool leftbutton) { +bool EventManager::mouseButton(uint16 *x, uint16 *y, bool leftbutton) { if (leftbutton) { if (LeftClick) { *x = (!IsHiRes) ? (uint16)g_lab->_mousePos.x / 2 : (uint16)g_lab->_mousePos.x; @@ -243,10 +246,7 @@ bool mouseButton(uint16 *x, uint16 *y, bool leftbutton) { return false; } - - - -Gadget *mouseGadget() { +Gadget *EventManager::mouseGadget() { Gadget *Temp = LastGadgetHit; LastGadgetHit = NULL; diff --git a/engines/lab/mouse.h b/engines/lab/mouse.h index 489bb1e989..6468ba91c7 100644 --- a/engines/lab/mouse.h +++ b/engines/lab/mouse.h @@ -38,25 +38,27 @@ namespace Lab { struct Gadget; -void initMouse(); - -void updateMouse(); - -void mouseShow(); - -void mouseHide(); - -Common::Point getMousePos(); - -void setMousePos(Common::Point pos); - -bool mouseButton(uint16 *x, uint16 *y, bool leftbutton); - -Gadget *mouseGadget(); - -void attachGadgetList(Gadget *GadList); - -void mouseHandler(int flag, Common::Point pos); +class LabEngine; + +class EventManager { +private: + LabEngine *_vm; + +public: + EventManager (LabEngine *vm); + + Gadget *checkGadgetHit(Gadget *gadlist, Common::Point pos); + void initMouse(); + void updateMouse(); + void mouseShow(); + void mouseHide(); + Common::Point getMousePos(); + void setMousePos(Common::Point pos); + bool mouseButton(uint16 *x, uint16 *y, bool leftbutton); + Gadget *mouseGadget(); + void attachGadgetList(Gadget *GadList); + void mouseHandler(int flag, Common::Point pos); +}; } // End of namespace Lab diff --git a/engines/lab/processroom.cpp b/engines/lab/processroom.cpp index 645e202867..1932d486d4 100644 --- a/engines/lab/processroom.cpp +++ b/engines/lab/processroom.cpp @@ -188,7 +188,7 @@ char *getPictName(CloseDataPtr *LCPtr) { /*****************************************************************************/ /* Draws the current direction to the screen. */ /*****************************************************************************/ -void drawDirection(CloseDataPtr LCPtr) { +void LabEngine::drawDirection(CloseDataPtr LCPtr) { if (LCPtr != NULL && LCPtr->Message) { drawMessage(LCPtr->Message); return; @@ -375,7 +375,7 @@ static void doActions(Action * APtr, CloseDataPtr *LCPtr) { break; case WIPECMD: - doWipe(APtr->Param1, LCPtr, (char *)APtr->Data); + g_lab->doWipe(APtr->Param1, LCPtr, (char *)APtr->Data); break; case NOUPDATE: @@ -409,9 +409,9 @@ static void doActions(Action * APtr, CloseDataPtr *LCPtr) { DoNotDrawMessage = false; if (LongWinInFront) - longDrawMessage((char *)APtr->Data); + g_lab->longDrawMessage((char *)APtr->Data); else - drawMessage((char *)APtr->Data); + g_lab->drawMessage((char *)APtr->Data); DoNotDrawMessage = true; break; @@ -419,7 +419,7 @@ static void doActions(Action * APtr, CloseDataPtr *LCPtr) { case CSHOWMESSAGE: if (*LCPtr == NULL) { DoNotDrawMessage = false; - drawMessage((char *)APtr->Data); + g_lab->drawMessage((char *)APtr->Data); DoNotDrawMessage = true; } @@ -428,7 +428,7 @@ static void doActions(Action * APtr, CloseDataPtr *LCPtr) { case SHOWMESSAGES: str = (char **)APtr->Data; DoNotDrawMessage = false; - drawMessage(str[getRandom(APtr->Param1)]); + g_lab->drawMessage(str[getRandom(APtr->Param1)]); DoNotDrawMessage = true; break; @@ -486,7 +486,7 @@ static void doActions(Action * APtr, CloseDataPtr *LCPtr) { while (1) { g_music->updateMusic(); - diffNextFrame(); + g_lab->diffNextFrame(); g_lab->getTime(&CurSecs, &CurMicros); if ((CurSecs > StartSecs) || ((CurSecs == StartSecs) && @@ -521,7 +521,7 @@ static void doActions(Action * APtr, CloseDataPtr *LCPtr) { case WAITSOUND: while (g_music->isSoundEffectActive()) { g_music->updateMusic(); - diffNextFrame(); + g_lab->diffNextFrame(); g_lab->waitTOF(); } @@ -596,7 +596,7 @@ static void doActions(Action * APtr, CloseDataPtr *LCPtr) { } else { while (g_music->isSoundEffectActive()) { g_music->updateMusic(); - diffNextFrame(); + g_lab->diffNextFrame(); g_lab->waitTOF(); } } diff --git a/engines/lab/readdiff.cpp b/engines/lab/readdiff.cpp index 852b9c66b8..61edf32512 100644 --- a/engines/lab/readdiff.cpp +++ b/engines/lab/readdiff.cpp @@ -113,8 +113,7 @@ void blackAllScreen() { g_system->delayMillis(32); } - -void diffNextFrame() { +void LabEngine::diffNextFrame() { if (header == 65535) /* Already done. */ return; @@ -126,11 +125,11 @@ void diffNextFrame() { DispBitMap->Planes[4] = DispBitMap->Planes[3] + 0x10000; } - mouseHide(); + _event->mouseHide(); while (1) { if (CurBit >= numchunks) { - mouseShow(); + _event->mouseShow(); if (!IsBM) { if (headerdata.fps) { @@ -264,7 +263,7 @@ void diffNextFrame() { } IsPlaying = false; - mouseShow(); + _event->mouseShow(); if (!didTOF) g_lab->WSDL_UpdateScreen(); @@ -283,8 +282,6 @@ void diffNextFrame() { } } - - /*****************************************************************************/ /* A separate task launched by readDiff. Plays the DIFF. */ /*****************************************************************************/ @@ -306,11 +303,9 @@ void playDiff() { blackScreen(); } - start = *startoffile; /* Make a copy of the pointer to the start of the file */ *difffile = start; /* Now can modify the file without modifying the original */ - if (start == NULL) { IsPlaying = false; return; @@ -373,9 +368,9 @@ void playDiff() { if (PlayOnce) { while (header != 65535) - diffNextFrame(); + g_lab->diffNextFrame(); } else - diffNextFrame(); + g_lab->diffNextFrame(); } @@ -399,7 +394,7 @@ void stopDiffEnd() { if (IsPlaying) { while (IsPlaying) { g_music->updateMusic(); - diffNextFrame(); + g_lab->diffNextFrame(); } } } diff --git a/engines/lab/special.cpp b/engines/lab/special.cpp index 00ac19f279..4e61b3c8cd 100644 --- a/engines/lab/special.cpp +++ b/engines/lab/special.cpp @@ -682,8 +682,8 @@ static void turnPage(bool FromLeft) { /*****************************************************************************/ /* Draws the journal from page x. */ /*****************************************************************************/ -static void drawJournal(uint16 wipenum, bool needFade) { - mouseHide(); +void LabEngine::drawJournal(uint16 wipenum, bool needFade) { + _event->mouseHide(); g_music->updateMusic(); @@ -718,7 +718,7 @@ static void drawJournal(uint16 wipenum, bool needFade) { GotBackImage = true; eatMessages(); - mouseShow(); + _event->mouseShow(); nopalchange = false; } @@ -726,14 +726,14 @@ static void drawJournal(uint16 wipenum, bool needFade) { /*****************************************************************************/ /* Processes user input. */ /*****************************************************************************/ -static void processJournal() { +void LabEngine::processJournal() { IntuiMessage *Msg; uint32 Class; uint16 Qualifier, GadID; while (1) { g_music->updateMusic(); /* Make sure we check the music at least after every message */ - Msg = (IntuiMessage *)getMsg(); + Msg = getMsg(); if (Msg == NULL) { g_music->updateMusic(); @@ -768,7 +768,7 @@ static void processJournal() { /*****************************************************************************/ /* Does the journal processing. */ /*****************************************************************************/ -void doJournal() { +void LabEngine::doJournal() { resetBuffer(); blackAllScreen(); @@ -790,12 +790,12 @@ void doJournal() { drawJournal(0, true); - attachGadgetList(&BackG); - mouseShow(); + _event->attachGadgetList(&BackG); + _event->mouseShow(); processJournal(); - attachGadgetList(NULL); + _event->attachGadgetList(NULL); fade(false, 0); - mouseHide(); + _event->mouseHide(); ScreenImage.ImageData = g_lab->getVGABaseAddr(); @@ -869,12 +869,12 @@ static void getMonImages() { /*****************************************************************************/ /* Draws the text for the monitor. */ /*****************************************************************************/ -static void drawMonText(char *text, uint16 x1, uint16 y1, uint16 x2, uint16 y2, bool isinteractive) { +void LabEngine::drawMonText(char *text, uint16 x1, uint16 y1, uint16 x2, uint16 y2, bool isinteractive) { uint16 DrawingToPage = 0, yspacing = 0, numlines, fheight; int32 CharsDrawn = 0L; char *CurText = text; - mouseHide(); + _event->mouseHide(); if (*text == '%') { text++; @@ -923,13 +923,13 @@ static void drawMonText(char *text, uint16 x1, uint16 y1, uint16 x2, uint16 y2, CurText += CharsDrawn; lastpage = lastpage || (*CurText == 0); - mouseShow(); + _event->mouseShow(); } /*****************************************************************************/ /* Processes user input. */ /*****************************************************************************/ -static void processMonitor(char *ntext, bool isinteractive, uint16 x1, uint16 y1, uint16 x2, uint16 y2) { +void LabEngine::processMonitor(char *ntext, bool isinteractive, uint16 x1, uint16 y1, uint16 x2, uint16 y2) { IntuiMessage *Msg; uint32 Class; uint16 Qualifier, Code, MouseX, MouseY; @@ -1022,7 +1022,7 @@ static void processMonitor(char *ntext, bool isinteractive, uint16 x1, uint16 y1 /*****************************************************************************/ /* Does what's necessary for the monitor. */ /*****************************************************************************/ -void doMonitor(char *background, char *textfile, bool isinteractive, uint16 x1, uint16 y1, uint16 x2, uint16 y2) { +void LabEngine::doMonitor(char *background, char *textfile, bool isinteractive, uint16 x1, uint16 y1, uint16 x2, uint16 y2) { char *ntext; x1 = VGAScaleX(x1); @@ -1064,11 +1064,11 @@ void doMonitor(char *background, char *textfile, bool isinteractive, uint16 x1, drawMonText(ntext, x1, y1, x2, y2, isinteractive); - mouseShow(); + _event->mouseShow(); fade(true, 0); processMonitor(ntext, isinteractive, x1, y1, x2, y2); fade(false, 0); - mouseHide(); + _event->mouseHide(); freeAllStolenMem(); diff --git a/engines/lab/vga.cpp b/engines/lab/vga.cpp index 63443cac9c..3ed26e1bf6 100644 --- a/engines/lab/vga.cpp +++ b/engines/lab/vga.cpp @@ -90,12 +90,12 @@ void LabEngine::WSDL_ProcessInput(bool can_delay) { switch (event.type) { case Common::EVENT_RBUTTONDOWN: flags |= 8; - mouseHandler(flags, _mousePos); + _event->mouseHandler(flags, _mousePos); break; case Common::EVENT_LBUTTONDOWN: flags |= 2; - mouseHandler(flags, _mousePos); + _event->mouseHandler(flags, _mousePos); break; case Common::EVENT_MOUSEMOVE: { @@ -122,7 +122,7 @@ void LabEngine::WSDL_ProcessInput(bool can_delay) { } if (!lastMouseAtEdge || !_mouseAtEdge) - mouseHandler(1, _mousePos); + _event->mouseHandler(1, _mousePos); } break; -- cgit v1.2.3 From 18fc6fd10207ccf425f85e98da23c121ee75af98 Mon Sep 17 00:00:00 2001 From: Strangerke Date: Sun, 29 Nov 2015 21:54:19 +0100 Subject: LAB: Add some feedback when a file isn't found --- engines/lab/engine.cpp | 6 ++++++ engines/lab/labfile.cpp | 1 + engines/lab/resource.cpp | 7 ++++++- 3 files changed, 13 insertions(+), 1 deletion(-) diff --git a/engines/lab/engine.cpp b/engines/lab/engine.cpp index edf23f307a..7af3719ae7 100644 --- a/engines/lab/engine.cpp +++ b/engines/lab/engine.cpp @@ -230,6 +230,9 @@ bool LabEngine::setUpScreens() { /* Loads in the graphics for the movement control panel */ Common::File file; file.open(translateFileName("P:Control")); + if (!file.isOpen()) + warning("setUpScreens couldn't open %s", translateFileName("P:Control")); + if (file.err() || file.size() == 0) return false; @@ -290,6 +293,9 @@ bool LabEngine::setUpScreens() { } file.open(translateFileName("P:Inv")); + if (!file.isOpen()) + warning("setUpScreens couldn't open %s", translateFileName("P:Inv")); + if (file.err() || file.size() == 0) return false; diff --git a/engines/lab/labfile.cpp b/engines/lab/labfile.cpp index fb6b17e759..31d10905d1 100644 --- a/engines/lab/labfile.cpp +++ b/engines/lab/labfile.cpp @@ -289,6 +289,7 @@ Common::File *openPartial(const char *name) { f->open(translateFileName(name)); if (!f->isOpen()) { + warning("openPartial skipped %s", translateFileName(name)); delete f; return 0; } diff --git a/engines/lab/resource.cpp b/engines/lab/resource.cpp index 180152e218..2f11515db2 100644 --- a/engines/lab/resource.cpp +++ b/engines/lab/resource.cpp @@ -48,6 +48,8 @@ Resource::Resource() { void Resource::readStaticText() { Common::File labTextFile; labTextFile.open(translateFileName("Lab:Rooms/LabText")); + if (!labTextFile.isOpen()) + error("Unable to open file %s (Lab:Rooms/LabText)", translateFileName("Lab:Rooms/LabText")); for (int i = 0; i < 48; i++) _staticText[i] = labTextFile.readLine(); @@ -151,9 +153,12 @@ bool Resource::readViews(uint16 roomNum) { Common::File *Resource::openDataFile(const char *fileName, uint32 fileHeader) { Common::File *dataFile = new Common::File(); dataFile->open(translateFileName(fileName)); + if (!dataFile->isOpen()) + error("openDataFile couldn't open %s (%s)", translateFileName(fileName), fileName); + if (dataFile->readUint32BE() != fileHeader) { dataFile->close(); - return NULL; + return nullptr; } return dataFile; -- cgit v1.2.3 From db773d92b7f035244538316a02d109671cdf8944 Mon Sep 17 00:00:00 2001 From: Strangerke Date: Sun, 29 Nov 2015 23:34:35 +0100 Subject: LAB: Remove useless redirections --- engines/lab/engine.cpp | 52 ++++++++++++++--------------- engines/lab/map.cpp | 48 +++++++++++++-------------- engines/lab/mouse.cpp | 30 ++++++++--------- engines/lab/readdiff.cpp | 18 +++++----- engines/lab/special.cpp | 36 ++++++++++---------- engines/lab/vga.cpp | 86 ++++++++++++++++++++++++------------------------ 6 files changed, 135 insertions(+), 135 deletions(-) diff --git a/engines/lab/engine.cpp b/engines/lab/engine.cpp index 7af3719ae7..c3aa5f4ff6 100644 --- a/engines/lab/engine.cpp +++ b/engines/lab/engine.cpp @@ -151,7 +151,7 @@ void LabEngine::drawPanel() { drawHLine(0, VGAScaleY(170) + 1, VGAScaleX(319)); /* The horizontal lines under the black one */ drawGadgetList(MoveGadgetList); } else { - if (g_lab->getPlatform() != Common::kPlatformWindows) { + if (getPlatform() != Common::kPlatformWindows) { drawVLine(VGAScaleX(124), VGAScaleY(170) + 1, VGAScaleY(199)); /* Vertical Black lines */ drawVLine(VGAScaleX(194), VGAScaleY(170) + 1, VGAScaleY(199)); } else { @@ -166,7 +166,7 @@ void LabEngine::drawPanel() { drawHLine(VGAScaleX(196), VGAScaleY(170) + 1, VGAScaleX(319)); drawVLine(VGAScaleX(1), VGAScaleY(170) + 2, VGAScaleY(198)); /* The vertical high light lines */ - if (g_lab->getPlatform() != Common::kPlatformWindows) { + if (getPlatform() != Common::kPlatformWindows) { drawVLine(VGAScaleX(126), VGAScaleY(170) + 2, VGAScaleY(198)); drawVLine(VGAScaleX(196), VGAScaleY(170) + 2, VGAScaleY(198)); } else { @@ -199,8 +199,8 @@ void LabEngine::drawRoomMessage(uint16 CurInv, CloseDataPtr cptr) { } if (Alternate) { - if ((CurInv <= NumInv) && g_lab->_conditions->in(CurInv) && Inventory[CurInv].BInvName) { - if ((CurInv == LAMPNUM) && g_lab->_conditions->in(LAMPON)) /* LAB: Labyrith specific */ + if ((CurInv <= NumInv) && _conditions->in(CurInv) && Inventory[CurInv].BInvName) { + if ((CurInv == LAMPNUM) && _conditions->in(LAMPON)) /* LAB: Labyrith specific */ drawStaticMessage(kTextLampOn); else if (Inventory[CurInv].Many > 1) { Common::String roomMessage = Common::String(Inventory[CurInv].name) + " (" + Common::String::format("%d", Inventory[CurInv].Many) + ")"; @@ -250,7 +250,7 @@ bool LabEngine::setUpScreens() { /* Creates the gadgets for the movement control panel */ y = VGAScaleY(173) - SVGACord(2); - if (g_lab->getPlatform() == Common::kPlatformWindows) { + if (getPlatform() == Common::kPlatformWindows) { MoveGadgetList = createButton(1, y, 0, 't', MoveImages[0], MoveImages[1]); curgad = MoveGadgetList; curgad->NextGadget = createButton(33, y, 1, 'm', MoveImages[2], MoveImages[3]); @@ -307,7 +307,7 @@ bool LabEngine::setUpScreens() { buffer = InvPanelBuffer; - if (g_lab->getPlatform() == Common::kPlatformWindows) { + if (getPlatform() == Common::kPlatformWindows) { for (uint16 imgIdx = 0; imgIdx < 10; imgIdx++) readImage(&buffer, &(InvImages[imgIdx])); @@ -401,7 +401,7 @@ bool LabEngine::doCloseUp(CloseDataPtr cptr) { int monltmargin, monrtmargin, montopmargin, lutertmargin; - if (g_lab->getPlatform() != Common::kPlatformWindows) { + if (getPlatform() != Common::kPlatformWindows) { monltmargin = 0; monrtmargin = 319; montopmargin = 0; @@ -595,7 +595,7 @@ void LabEngine::decIncInv(uint16 *CurInv, bool dec) { (*CurInv)++; while (*CurInv && (*CurInv <= NumInv)) { - if (g_lab->_conditions->in(*CurInv) && Inventory[*CurInv].BInvName) { + if (_conditions->in(*CurInv) && Inventory[*CurInv].BInvName) { Test = getInvName(*CurInv); break; } @@ -613,7 +613,7 @@ void LabEngine::decIncInv(uint16 *CurInv, bool dec) { *CurInv = 1; while (*CurInv && (*CurInv <= NumInv)) { - if (g_lab->_conditions->in(*CurInv) && Inventory[*CurInv].BInvName) { + if (_conditions->in(*CurInv) && Inventory[*CurInv].BInvName) { Test = getInvName(*CurInv); break; } @@ -653,13 +653,13 @@ void LabEngine::mainGameLoop() { g_resource->readRoomData("LAB:Doors"); g_resource->readInventory("LAB:Inventor"); - if (!(g_lab->_conditions = new LargeSet(HighestCondition + 1))) + if (!(_conditions = new LargeSet(HighestCondition + 1))) return; - if (!(g_lab->_roomsFound = new LargeSet(ManyRooms + 1))) + if (!(_roomsFound = new LargeSet(ManyRooms + 1))) return; - g_lab->_conditions->readInitialConditions("LAB:Conditio"); + _conditions->readInitialConditions("LAB:Conditio"); LongWinInFront = false; drawPanel(); @@ -693,7 +693,7 @@ void LabEngine::mainGameLoop() { Test = getPictName(&CPtr); if (noupdatediff) { - g_lab->_roomsFound->inclElement(RoomNum); /* Potentially entered another room */ + _roomsFound->inclElement(RoomNum); /* Potentially entered another room */ ForceDraw = (strcmp(Test, CurFileName) != 0) || ForceDraw; noupdatediff = false; @@ -702,7 +702,7 @@ void LabEngine::mainGameLoop() { else if (strcmp(Test, CurFileName) != 0) { interfaceOff(); - g_lab->_roomsFound->inclElement(RoomNum); /* Potentially entered another room */ + _roomsFound->inclElement(RoomNum); /* Potentially entered another room */ CurFileName = Test; if (CPtr) { @@ -789,7 +789,7 @@ from_crumbs: Class = MOUSEBUTTONS; Qualifier = IEQUALIFIER_LEFTBUTTON; curPos = _event->getMousePos(); - } else if (g_lab->getPlatform() == Common::kPlatformWindows && + } else if (getPlatform() == Common::kPlatformWindows && (code == 'b' || code == 'B')) { /* Start bread crumbs */ BreadCrumbs[0].RoomNum = 0; NumCrumbs = 0; @@ -804,7 +804,7 @@ from_crumbs: FollowCrumbsFast = (code == 'r' || code == 'R'); IsCrumbTurning = false; IsCrumbWaiting = false; - g_lab->getTime(&CrumbSecs, &CrumbMicros); + getTime(&CrumbSecs, &CrumbMicros); if (Alternate) { eatMessages(); @@ -903,7 +903,7 @@ from_crumbs: MainDisplay = false; - if (LastInv && g_lab->_conditions->in(LastInv)) { + if (LastInv && _conditions->in(LastInv)) { CurInv = LastInv; Test = getInvName(CurInv); } else @@ -976,7 +976,7 @@ from_crumbs: if (OldRoomNum != RoomNum) { drawStaticMessage(kTextGoForward); - g_lab->_roomsFound->inclElement(RoomNum); /* Potentially entered a new room */ + _roomsFound->inclElement(RoomNum); /* Potentially entered a new room */ CurFileName = " "; ForceDraw = true; } else { @@ -1095,11 +1095,11 @@ from_crumbs: if ((CurInv == 0) || (CurInv > NumInv)) { CurInv = 1; - while ((CurInv <= NumInv) && (!g_lab->_conditions->in(CurInv))) + while ((CurInv <= NumInv) && (!_conditions->in(CurInv))) CurInv++; } - if ((CurInv <= NumInv) && g_lab->_conditions->in(CurInv) && + if ((CurInv <= NumInv) && _conditions->in(CurInv) && Inventory[CurInv].BInvName) Test = getInvName(CurInv); @@ -1131,7 +1131,7 @@ from_crumbs: FollowCrumbsFast = false; IsCrumbTurning = false; IsCrumbWaiting = false; - g_lab->getTime(&CrumbSecs, &CrumbMicros); + getTime(&CrumbSecs, &CrumbMicros); eatMessages(); Alternate = false; @@ -1210,11 +1210,11 @@ from_crumbs: } else if (curPos.y < (VGAScaleY(149) + SVGACord(2))) drawStaticMessage(kTextNothing); } else if ((ActionMode == 5) && - g_lab->_conditions->in(CurInv)) { /* Use an item on something else */ + _conditions->in(CurInv)) { /* Use an item on something else */ if (doOperateRule(curPos.x, curPos.y, CurInv, &CPtr)) { CurFileName = NewFileName; - if (!g_lab->_conditions->in(CurInv)) + if (!_conditions->in(CurInv)) decIncInv(&CurInv, false); } else if (curPos.y < (VGAScaleY(149) + SVGACord(2))) drawStaticMessage(kTextNothing); @@ -1260,7 +1260,7 @@ from_crumbs: interfaceOn(); /* Sets the correct gadget list */ if (Alternate) { - if (LastInv && g_lab->_conditions->in(LastInv)) + if (LastInv && _conditions->in(LastInv)) CurInv = LastInv; else decIncInv(&CurInv, false); @@ -1275,8 +1275,8 @@ from_crumbs: } } - delete g_lab->_conditions; - delete g_lab->_roomsFound; + delete _conditions; + delete _roomsFound; if (_rooms) { free(_rooms); diff --git a/engines/lab/map.cpp b/engines/lab/map.cpp index 98082b73f8..d41322f426 100644 --- a/engines/lab/map.cpp +++ b/engines/lab/map.cpp @@ -564,21 +564,21 @@ void LabEngine::drawMap(uint16 CurRoom, uint16 CurMsg, uint16 Floor, bool fadeou if (fadeout) fade(false, 0); - g_lab->setAPen(0); - g_lab->rectFill(0, 0, g_lab->_screenWidth - 1, g_lab->_screenHeight - 1); + setAPen(0); + rectFill(0, 0, _screenWidth - 1, _screenHeight - 1); - g_lab->drawImage(Map, 0, 0); + drawImage(Map, 0, 0); drawGadgetList(MapGadgetList); for (uint16 i = 1; i <= MaxRooms; i++) { - if ((Maps[i].PageNumber == Floor) && g_lab->_roomsFound->in(i) && Maps[i].x) { + if ((Maps[i].PageNumber == Floor) && _roomsFound->in(i) && Maps[i].x) { drawRoom(i, (bool)(i == CurRoom)); g_music->updateMusic(); } } if ((Maps[CurRoom].PageNumber == Floor) /* Makes sure the X is drawn in corridors */ - && g_lab->_roomsFound->in(CurRoom) /* NOTE: this here on purpose just in case there's some weird condition, like the surreal maze where there are no rooms */ + && _roomsFound->in(CurRoom) /* NOTE: this here on purpose just in case there's some weird condition, like the surreal maze where there are no rooms */ && Maps[CurRoom].x) drawRoom(CurRoom, true); @@ -601,16 +601,16 @@ void LabEngine::drawMap(uint16 CurRoom, uint16 CurMsg, uint16 Floor, bool fadeou // Labyrinth specific code if (Floor == LOWERFLOOR) { if (onFloor(SURMAZEFLOOR)) - g_lab->drawImage(Maze, mapScaleX(538), mapScaleY(277)); + drawImage(Maze, mapScaleX(538), mapScaleY(277)); } else if (Floor == MIDDLEFLOOR) { if (onFloor(CARNIVAL)) - g_lab->drawImage(Maze, mapScaleX(358), mapScaleY(72)); + drawImage(Maze, mapScaleX(358), mapScaleY(72)); if (onFloor(MEDMAZEFLOOR)) - g_lab->drawImage(Maze, mapScaleX(557), mapScaleY(325)); + drawImage(Maze, mapScaleX(557), mapScaleY(325)); } else if (Floor == UPPERFLOOR) { if (onFloor(HEDGEMAZEFLOOR)) - g_lab->drawImage(HugeMaze, mapScaleX(524), mapScaleY(97)); + drawImage(HugeMaze, mapScaleX(524), mapScaleY(97)); } else if (Floor == SURMAZEFLOOR) { sptr = (char *)g_resource->getStaticText(kTextSurmazeMessage).c_str(); flowText(MsgFont, 0, 7, 0, true, true, true, true, mapScaleX(360), 0, mapScaleX(660), mapScaleY(450), sptr); @@ -686,14 +686,14 @@ void LabEngine::processMap(uint16 CurRoom) { newcolor[2] = newcolor[1]; } - g_lab->waitTOF(); - g_lab->writeColorReg(newcolor, 1); + waitTOF(); + writeColorReg(newcolor, 1); _event->updateMouse(); - g_lab->waitTOF(); + waitTOF(); _event->updateMouse(); - g_lab->waitTOF(); + waitTOF(); _event->updateMouse(); - g_lab->waitTOF(); + waitTOF(); _event->updateMouse(); place++; @@ -787,7 +787,7 @@ void LabEngine::processMap(uint16 CurRoom) { roomCords(i, &x1, &y1, &x2, &y2); if ((Maps[i].PageNumber == CurFloor) - && g_lab->_roomsFound->in(i) + && _roomsFound->in(i) && (MouseX >= x1) && (MouseX <= x2) && (MouseY >= y1) && (MouseY <= y2)) { CurMsg = i; @@ -800,8 +800,8 @@ void LabEngine::processMap(uint16 CurRoom) { if ((sptr = _rooms[CurMsg]._roomMsg)) { _event->mouseHide(); - g_lab->setAPen(3); - g_lab->rectFill(VGAScaleX(13), VGAScaleY(148), VGAScaleX(135), VGAScaleY(186)); + setAPen(3); + rectFill(VGAScaleX(13), VGAScaleY(148), VGAScaleX(135), VGAScaleY(186)); flowText(MsgFont, 0, 5, 3, true, true, true, true, VGAScaleX(14), VGAScaleY(148), VGAScaleX(134), VGAScaleY(186), sptr); if (Maps[OldMsg].PageNumber == CurFloor) @@ -812,8 +812,8 @@ void LabEngine::processMap(uint16 CurRoom) { y1 = (y1 + y2) / 2; if ((CurMsg != CurRoom) && (Maps[CurMsg].PageNumber == CurFloor)) { - g_lab->setAPen(1); - g_lab->rectFill(x1 - 1, y1, x1, y1); + setAPen(1); + rectFill(x1 - 1, y1, x1, y1); } _event->mouseShow(); @@ -822,7 +822,7 @@ void LabEngine::processMap(uint16 CurRoom) { } } - g_lab->WSDL_UpdateScreen(); + WSDL_UpdateScreen(); } } } @@ -850,18 +850,18 @@ void LabEngine::doMap(uint16 CurRoom) { drawMap(CurRoom, CurRoom, Maps[CurRoom].PageNumber, false, true); _event->mouseShow(); _event->attachGadgetList(MapGadgetList); - g_lab->WSDL_UpdateScreen(); + WSDL_UpdateScreen(); processMap(CurRoom); _event->attachGadgetList(NULL); fade(false, 0); blackAllScreen(); _event->mouseHide(); - g_lab->setAPen(0); - g_lab->rectFill(0, 0, g_lab->_screenWidth - 1, g_lab->_screenHeight - 1); + setAPen(0); + rectFill(0, 0, _screenWidth - 1, _screenHeight - 1); freeMapData(); blackAllScreen(); _event->mouseShow(); - g_lab->WSDL_UpdateScreen(); + WSDL_UpdateScreen(); } } // End of namespace Lab diff --git a/engines/lab/mouse.cpp b/engines/lab/mouse.cpp index 73fdd2eb07..ace64593a3 100644 --- a/engines/lab/mouse.cpp +++ b/engines/lab/mouse.cpp @@ -79,14 +79,14 @@ Gadget *EventManager::checkGadgetHit(Gadget *gadlist, Common::Point pos) { hitgad = gadlist; } else { mouseHide(); - g_lab->drawImage(gadlist->ImAlt, gadlist->x, gadlist->y); + _vm->drawImage(gadlist->ImAlt, gadlist->x, gadlist->y); mouseShow(); for (uint16 i = 0; i < 3; i++) - g_lab->waitTOF(); + _vm->waitTOF(); mouseHide(); - g_lab->drawImage(gadlist->Im, gadlist->x, gadlist->y); + _vm->drawImage(gadlist->Im, gadlist->x, gadlist->y); mouseShow(); } @@ -138,21 +138,21 @@ void EventManager::updateMouse() { if (hitgad) { mouseHide(); - g_lab->drawImage(hitgad->ImAlt, hitgad->x, hitgad->y); + _vm->drawImage(hitgad->ImAlt, hitgad->x, hitgad->y); mouseShow(); for (uint16 i = 0; i < 3; i++) - g_lab->waitTOF(); + _vm->waitTOF(); mouseHide(); - g_lab->drawImage(hitgad->Im, hitgad->x, hitgad->y); + _vm->drawImage(hitgad->Im, hitgad->x, hitgad->y); mouseShow(); doUpdateDisplay = true; hitgad = NULL; } if (doUpdateDisplay) - g_lab->WSDL_UpdateScreen(); + _vm->WSDL_UpdateScreen(); } @@ -175,7 +175,7 @@ void EventManager::mouseShow() { NumHidden--; if ((NumHidden == 0) && MouseHidden) { - g_lab->WSDL_ProcessInput(0); + _vm->WSDL_ProcessInput(0); MouseHidden = false; } @@ -201,9 +201,9 @@ void EventManager::mouseHide() { /*****************************************************************************/ Common::Point EventManager::getMousePos() { if (IsHiRes) - return g_lab->_mousePos; + return _vm->_mousePos; else - return Common::Point(g_lab->_mousePos.x / 2, g_lab->_mousePos.y); + return Common::Point(_vm->_mousePos.x / 2, _vm->_mousePos.y); } @@ -217,7 +217,7 @@ void EventManager::setMousePos(Common::Point pos) { g_system->warpMouse(pos.x * 2, pos.y); if (!MouseHidden) - g_lab->WSDL_ProcessInput(0); + _vm->WSDL_ProcessInput(0); } @@ -229,15 +229,15 @@ void EventManager::setMousePos(Common::Point pos) { bool EventManager::mouseButton(uint16 *x, uint16 *y, bool leftbutton) { if (leftbutton) { if (LeftClick) { - *x = (!IsHiRes) ? (uint16)g_lab->_mousePos.x / 2 : (uint16)g_lab->_mousePos.x; - *y = (uint16)g_lab->_mousePos.y; + *x = (!IsHiRes) ? (uint16)_vm->_mousePos.x / 2 : (uint16)_vm->_mousePos.x; + *y = (uint16)_vm->_mousePos.y; LeftClick = false; return true; } } else { if (RightClick) { - *x = (!IsHiRes) ? (uint16)g_lab->_mousePos.x / 2 : (uint16)g_lab->_mousePos.x; - *y = (uint16)g_lab->_mousePos.y; + *x = (!IsHiRes) ? (uint16)_vm->_mousePos.x / 2 : (uint16)_vm->_mousePos.x; + *y = (uint16)_vm->_mousePos.y; RightClick = false; return true; } diff --git a/engines/lab/readdiff.cpp b/engines/lab/readdiff.cpp index 61edf32512..ca7d3905ce 100644 --- a/engines/lab/readdiff.cpp +++ b/engines/lab/readdiff.cpp @@ -118,7 +118,7 @@ void LabEngine::diffNextFrame() { return; if (DispBitMap->Flags & BITMAPF_VIDEO) { - DispBitMap->Planes[0] = g_lab->getVGABaseAddr(); + DispBitMap->Planes[0] = getVGABaseAddr(); DispBitMap->Planes[1] = DispBitMap->Planes[0] + 0x10000; DispBitMap->Planes[2] = DispBitMap->Planes[1] + 0x10000; DispBitMap->Planes[3] = DispBitMap->Planes[2] + 0x10000; @@ -133,12 +133,12 @@ void LabEngine::diffNextFrame() { if (!IsBM) { if (headerdata.fps) { - g_lab->waitForTime(WaitSec, WaitMicros); - g_lab->addCurTime(0L, DelayMicros, &WaitSec, &WaitMicros); + waitForTime(WaitSec, WaitMicros); + addCurTime(0L, DelayMicros, &WaitSec, &WaitMicros); } if (IsPal && !nopalchange) { - g_lab->VGASetPal(diffcmap, 256); + VGASetPal(diffcmap, 256); IsPal = false; } @@ -146,7 +146,7 @@ void LabEngine::diffNextFrame() { } if (IsPal && !nopalchange && !IsBM && !donepal) { - g_lab->VGASetPal(diffcmap, 256); + VGASetPal(diffcmap, 256); IsPal = false; } @@ -161,7 +161,7 @@ void LabEngine::diffNextFrame() { CurBit = 0; if (DispBitMap->Flags & BITMAPF_VIDEO) - g_lab->WSDL_UpdateScreen(); + WSDL_UpdateScreen(); return; /* done with the next frame. */ } @@ -229,7 +229,7 @@ void LabEngine::diffNextFrame() { if (waitForEffect) { while (g_music->isSoundEffectActive()) { g_music->updateMusic(); - g_lab->waitTOF(); + waitTOF(); } } @@ -255,7 +255,7 @@ void LabEngine::diffNextFrame() { if (waitForEffect) { while (g_music->isSoundEffectActive()) { g_music->updateMusic(); - g_lab->waitTOF(); + waitTOF(); if (DispBitMap->Flags & BITMAPF_VIDEO) didTOF = 1; @@ -266,7 +266,7 @@ void LabEngine::diffNextFrame() { _event->mouseShow(); if (!didTOF) - g_lab->WSDL_UpdateScreen(); + WSDL_UpdateScreen(); return; } diff --git a/engines/lab/special.cpp b/engines/lab/special.cpp index 4e61b3c8cd..9b0ed4217f 100644 --- a/engines/lab/special.cpp +++ b/engines/lab/special.cpp @@ -692,10 +692,10 @@ void LabEngine::drawJournal(uint16 wipenum, bool needFade) { drawJournalText(); - ScreenImage.ImageData = g_lab->getVGABaseAddr(); + ScreenImage.ImageData = getVGABaseAddr(); if (wipenum == 0) - g_lab->bltBitMap(&JBackImage, 0, 0, &ScreenImage, 0, 0, g_lab->_screenWidth, g_lab->_screenHeight); + bltBitMap(&JBackImage, 0, 0, &ScreenImage, 0, 0, _screenWidth, _screenHeight); else turnPage((bool)(wipenum == 1)); @@ -714,7 +714,7 @@ void LabEngine::drawJournal(uint16 wipenum, bool needFade) { fade(true, 0); nopalchange = true; - JBackImage.ImageData = readPictToMem("P:Journal.pic", g_lab->_screenWidth, g_lab->_screenHeight); + JBackImage.ImageData = readPictToMem("P:Journal.pic", _screenWidth, _screenHeight); GotBackImage = true; eatMessages(); @@ -775,15 +775,15 @@ void LabEngine::doJournal() { lastpage = false; GotBackImage = false; - JBackImage.Width = g_lab->_screenWidth; - JBackImage.Height = g_lab->_screenHeight; + JBackImage.Width = _screenWidth; + JBackImage.Height = _screenHeight; JBackImage.ImageData = NULL; BackG.NextGadget = &CancelG; CancelG.NextGadget = &ForwardG; ScreenImage = JBackImage; - ScreenImage.ImageData = g_lab->getVGABaseAddr(); + ScreenImage.ImageData = getVGABaseAddr(); g_music->updateMusic(); loadJournalData(); @@ -797,10 +797,10 @@ void LabEngine::doJournal() { fade(false, 0); _event->mouseHide(); - ScreenImage.ImageData = g_lab->getVGABaseAddr(); + ScreenImage.ImageData = getVGABaseAddr(); - g_lab->setAPen(0); - g_lab->rectFill(0, 0, g_lab->_screenWidth - 1, g_lab->_screenHeight - 1); + setAPen(0); + rectFill(0, 0, _screenWidth - 1, _screenHeight - 1); blackScreen(); freeAllStolenMem(); @@ -892,17 +892,17 @@ void LabEngine::drawMonText(char *text, uint16 x1, uint16 y1, uint16 x2, uint16 else MonGadHeight = fheight; - g_lab->setAPen(0); - g_lab->rectFill(0, 0, g_lab->_screenWidth - 1, y2); + setAPen(0); + rectFill(0, 0, _screenWidth - 1, y2); for (uint16 i = 0; i < numlines; i++) - g_lab->drawImage(MonButton, 0, i * MonGadHeight); + drawImage(MonButton, 0, i * MonGadHeight); } else if (isinteractive) { - g_lab->setAPen(0); - g_lab->rectFill(0, 0, g_lab->_screenWidth - 1, y2); + setAPen(0); + rectFill(0, 0, _screenWidth - 1, y2); } else { - g_lab->setAPen(0); - g_lab->rectFill(x1, y1, x2, y2); + setAPen(0); + rectFill(x1, y1, x2, y2); } while (DrawingToPage < monitorPage) { @@ -1072,8 +1072,8 @@ void LabEngine::doMonitor(char *background, char *textfile, bool isinteractive, freeAllStolenMem(); - g_lab->setAPen(0); - g_lab->rectFill(0, 0, g_lab->_screenWidth - 1, g_lab->_screenHeight - 1); + setAPen(0); + rectFill(0, 0, _screenWidth - 1, _screenHeight - 1); blackAllScreen(); } diff --git a/engines/lab/vga.cpp b/engines/lab/vga.cpp index 3ed26e1bf6..c7252d4ee5 100644 --- a/engines/lab/vga.cpp +++ b/engines/lab/vga.cpp @@ -43,15 +43,15 @@ namespace Lab { /*****************************************************************************/ bool LabEngine::createScreen(bool HiRes) { if (HiRes) { - g_lab->_screenWidth = 640; - g_lab->_screenHeight = 480; + _screenWidth = 640; + _screenHeight = 480; } else { - g_lab->_screenWidth = 320; - g_lab->_screenHeight = 200; + _screenWidth = 320; + _screenHeight = 200; } - g_lab->_screenBytesPerPage = g_lab->_screenWidth * g_lab->_screenHeight; + _screenBytesPerPage = _screenWidth * _screenHeight; - _displayBuffer = (byte *)malloc(g_lab->_screenBytesPerPage); + _displayBuffer = (byte *)malloc(_screenBytesPerPage); return true; } @@ -106,8 +106,8 @@ void LabEngine::WSDL_ProcessInput(bool can_delay) { _mousePos.x = 0; _mouseAtEdge = true; } - if (_mousePos.x > g_lab->_screenWidth - 1) { - _mousePos.x = g_lab->_screenWidth; + if (_mousePos.x > _screenWidth - 1) { + _mousePos.x = _screenWidth; _mouseAtEdge = true; } @@ -116,8 +116,8 @@ void LabEngine::WSDL_ProcessInput(bool can_delay) { _mousePos.y = 0; _mouseAtEdge = true; } - if (_mousePos.y > g_lab->_screenHeight - 1) { - _mousePos.y = g_lab->_screenHeight; + if (_mousePos.y > _screenHeight - 1) { + _mousePos.y = _screenHeight; _mouseAtEdge = true; } @@ -157,7 +157,7 @@ void LabEngine::WSDL_ProcessInput(bool can_delay) { break; } - g_system->copyRectToScreen(_displayBuffer, g_lab->_screenWidth, 0, 0, g_lab->_screenWidth, g_lab->_screenHeight); + g_system->copyRectToScreen(_displayBuffer, _screenWidth, 0, 0, _screenWidth, _screenHeight); g_system->updateScreen(); } } @@ -173,7 +173,7 @@ Common::Point LabEngine::WSDL_GetMousePos() { } void LabEngine::waitTOF() { - g_system->copyRectToScreen(_displayBuffer, g_lab->_screenWidth, 0, 0, g_lab->_screenWidth, g_lab->_screenHeight); + g_system->copyRectToScreen(_displayBuffer, _screenWidth, 0, 0, _screenWidth, _screenHeight); g_system->updateScreen(); WSDL_ProcessInput(0); @@ -235,7 +235,7 @@ void LabEngine::VGASetPal(void *cmap, uint16 numcolors) { } void LabEngine::WSDL_UpdateScreen() { - g_system->copyRectToScreen(_displayBuffer, g_lab->_screenWidth, 0, 0, g_lab->_screenWidth, g_lab->_screenHeight); + g_system->copyRectToScreen(_displayBuffer, _screenWidth, 0, 0, _screenWidth, _screenHeight); g_system->updateScreen(); WSDL_ProcessInput(0); @@ -276,20 +276,20 @@ void LabEngine::drawImage(Image *Im, uint16 x, uint16 y) { dy = 0; } - if (dx + w > g_lab->_screenWidth) - w = g_lab->_screenWidth - dx; + if (dx + w > _screenWidth) + w = _screenWidth - dx; - if (dy + h > g_lab->_screenHeight) - h = g_lab->_screenHeight - dy; + if (dy + h > _screenHeight) + h = _screenHeight - dy; if ((w > 0) && (h > 0)) { byte *s = Im->ImageData + sy * Im->Width + sx; - byte *d = getVGABaseAddr() + dy * g_lab->_screenWidth + dx; + byte *d = getVGABaseAddr() + dy * _screenWidth + dx; while (h-- > 0) { memcpy(d, s, w); s += Im->Width; - d += g_lab->_screenWidth; + d += _screenWidth; } } } @@ -319,15 +319,15 @@ void LabEngine::drawMaskImage(Image *Im, uint16 x, uint16 y) { dy = 0; } - if (dx + w > g_lab->_screenWidth) - w = g_lab->_screenWidth - dx; + if (dx + w > _screenWidth) + w = _screenWidth - dx; - if (dy + h > g_lab->_screenHeight) - h = g_lab->_screenHeight - dy; + if (dy + h > _screenHeight) + h = _screenHeight - dy; if ((w > 0) && (h > 0)) { byte *s = Im->ImageData + sy * Im->Width + sx; - byte *d = getVGABaseAddr() + dy * g_lab->_screenWidth + dx; + byte *d = getVGABaseAddr() + dy * _screenWidth + dx; while (h-- > 0) { byte *ss = s; @@ -342,7 +342,7 @@ void LabEngine::drawMaskImage(Image *Im, uint16 x, uint16 y) { } s += Im->Width; - d += g_lab->_screenWidth; + d += _screenWidth; } } } @@ -372,20 +372,20 @@ void LabEngine::readScreenImage(Image *Im, uint16 x, uint16 y) { dy = 0; } - if (dx + w > g_lab->_screenWidth) - w = g_lab->_screenWidth - dx; + if (dx + w > _screenWidth) + w = _screenWidth - dx; - if (dy + h > g_lab->_screenHeight) - h = g_lab->_screenHeight - dy; + if (dy + h > _screenHeight) + h = _screenHeight - dy; if ((w > 0) && (h > 0)) { byte *s = Im->ImageData + sy * Im->Width + sx; - byte *d = getVGABaseAddr() + dy * g_lab->_screenWidth + dx; + byte *d = getVGABaseAddr() + dy * _screenWidth + dx; while (h-- > 0) { memcpy(s, d, w); s += Im->Width; - d += g_lab->_screenWidth; + d += _screenWidth; } } } @@ -549,14 +549,14 @@ void LabEngine::rectFill(uint16 x1, uint16 y1, uint16 x2, uint16 y2) { dy = 0; } - if (dx + w > g_lab->_screenWidth) - w = g_lab->_screenWidth - dx; + if (dx + w > _screenWidth) + w = _screenWidth - dx; - if (dy + h > g_lab->_screenHeight) - h = g_lab->_screenHeight - dy; + if (dy + h > _screenHeight) + h = _screenHeight - dy; if ((w > 0) && (h > 0)) { - char *d = (char *)getVGABaseAddr() + dy * g_lab->_screenWidth + dx; + char *d = (char *)getVGABaseAddr() + dy * _screenWidth + dx; while (h-- > 0) { char *dd = d; @@ -566,7 +566,7 @@ void LabEngine::rectFill(uint16 x1, uint16 y1, uint16 x2, uint16 y2) { *dd++ = _curapen; } - d += g_lab->_screenWidth; + d += _screenWidth; } } } @@ -606,14 +606,14 @@ void LabEngine::ghoastRect(uint16 pencolor, uint16 x1, uint16 y1, uint16 x2, uin dy = 0; } - if (dx + w > g_lab->_screenWidth) - w = g_lab->_screenWidth - dx; + if (dx + w > _screenWidth) + w = _screenWidth - dx; - if (dy + h > g_lab->_screenHeight) - h = g_lab->_screenHeight - dy; + if (dy + h > _screenHeight) + h = _screenHeight - dy; if ((w > 0) && (h > 0)) { - char *d = (char *)getVGABaseAddr() + dy * g_lab->_screenWidth + dx; + char *d = (char *)getVGABaseAddr() + dy * _screenWidth + dx; while (h-- > 0) { char *dd = d; @@ -630,7 +630,7 @@ void LabEngine::ghoastRect(uint16 pencolor, uint16 x1, uint16 y1, uint16 x2, uin ww -= 2; } - d += g_lab->_screenWidth; + d += _screenWidth; dy++; } } -- cgit v1.2.3 From 0c84355f4ae5651e7667b9aa0d2d3c6c28f21496 Mon Sep 17 00:00:00 2001 From: Strangerke Date: Mon, 30 Nov 2015 00:12:01 +0100 Subject: LAB: Move IsHiRes to main engine class --- engines/lab/engine.cpp | 10 +++++----- engines/lab/graphics.cpp | 7 +++---- engines/lab/intro.cpp | 4 ++-- engines/lab/lab.cpp | 1 + engines/lab/lab.h | 1 + engines/lab/machine.cpp | 21 ++++++++++----------- engines/lab/map.cpp | 5 ++--- engines/lab/mouse.cpp | 16 +++++++--------- engines/lab/special.cpp | 4 ++-- 9 files changed, 33 insertions(+), 36 deletions(-) diff --git a/engines/lab/engine.cpp b/engines/lab/engine.cpp index c3aa5f4ff6..e246d6d9be 100644 --- a/engines/lab/engine.cpp +++ b/engines/lab/engine.cpp @@ -47,7 +47,7 @@ bool LongWinInFront = false; TextFont *MsgFont; -extern bool DoBlack, waitForEffect, stopsound, DoNotDrawMessage, IsHiRes, nopalchange; +extern bool DoBlack, waitForEffect, stopsound, DoNotDrawMessage, nopalchange; /* Global parser data */ @@ -224,7 +224,7 @@ bool LabEngine::setUpScreens() { Gadget *curgad; uint16 y; - if (!createScreen(IsHiRes)) + if (!createScreen(_isHiRes)) return false; /* Loads in the graphics for the movement control panel */ @@ -1299,10 +1299,10 @@ from_crumbs: void LabEngine::go() { bool dointro = true; - IsHiRes = ((getFeatures() & GF_LOWRES) == 0); + _isHiRes = ((getFeatures() & GF_LOWRES) == 0); #if 0 - if (IsHiRes) + if (_isHiRes) warning("Running in HiRes mode"); else warning("Running in LowRes mode"); @@ -1317,7 +1317,7 @@ void LabEngine::go() { } if (!setUpScreens()) { - IsHiRes = false; + _isHiRes = false; mem = mem && setUpScreens(); } diff --git a/engines/lab/graphics.cpp b/engines/lab/graphics.cpp index ab04c3e67a..218f3c66d4 100644 --- a/engines/lab/graphics.cpp +++ b/engines/lab/graphics.cpp @@ -48,7 +48,6 @@ extern char diffcmap[256 * 3]; extern bool IsBM, nopalchange; extern bool DoBlack, stopsound; -extern bool IsHiRes; extern TextFont *MsgFont; extern const char *CurFileName; @@ -438,7 +437,7 @@ void LabEngine::doScrollBlack() { while (nheight) { g_music->updateMusic(); - if (!IsHiRes) + if (!_isHiRes) g_lab->waitTOF(); BaseAddr = (uint32 *)g_lab->getVGABaseAddr(); @@ -468,7 +467,7 @@ void LabEngine::doScrollBlack() { g_lab->WSDL_UpdateScreen(); - if (!IsHiRes) { + if (!_isHiRes) { if (nheight <= (height / 8)) by = 1; else if (nheight <= (height / 4)) @@ -626,7 +625,7 @@ void LabEngine::doTransWipe(CloseDataPtr *CPtr, char *filename) { uint16 LastY, CurY, linesdone = 0, lineslast; Image ImSource, ImDest; - if (IsHiRes) { + if (_isHiRes) { lineslast = 3; LastY = 358; } else { diff --git a/engines/lab/intro.cpp b/engines/lab/intro.cpp index 43bb7c6cb9..269922bbb3 100644 --- a/engines/lab/intro.cpp +++ b/engines/lab/intro.cpp @@ -37,7 +37,7 @@ #include "lab/interface.h" namespace Lab { -extern bool nopalchange, DoBlack, IsHiRes; +extern bool nopalchange, DoBlack; extern char diffcmap[256 * 3]; extern uint16 *FadePalette; @@ -118,7 +118,7 @@ void Intro::doPictText(const char *filename, bool isscreen) { g_lab->setAPen(7L); g_lab->rectFill(VGAScaleX(10), VGAScaleY(10), VGAScaleX(310), VGAScaleY(190)); - Drawn = flowText(_msgfont, (!IsHiRes) * -1, 5, 7, false, false, true, true, VGAScaleX(14), VGAScaleY(11), VGAScaleX(306), VGAScaleY(189), (char *)curplace); + Drawn = flowText(_msgfont, (!g_lab->_isHiRes) * -1, 5, 7, false, false, true, true, VGAScaleX(14), VGAScaleY(11), VGAScaleX(306), VGAScaleY(189), (char *)curplace); fade(true, 0); } else { Drawn = g_lab->longDrawMessage((char *)curplace); diff --git a/engines/lab/lab.cpp b/engines/lab/lab.cpp index 5cc49b0462..b2e779f07e 100644 --- a/engines/lab/lab.cpp +++ b/engines/lab/lab.cpp @@ -72,6 +72,7 @@ LabEngine::LabEngine(OSystem *syst, const ADGameDescription *gameDesc) _nextKeyIn = 0; _nextKeyOut = 0; + _isHiRes = false; //const Common::FSNode gameDataDir(ConfMan.get("path")); //SearchMan.addSubDirectoryMatching(gameDataDir, "game"); //SearchMan.addSubDirectoryMatching(gameDataDir, "game/pict"); diff --git a/engines/lab/lab.h b/engines/lab/lab.h index 4b5f5d1d37..8ead009fd7 100644 --- a/engines/lab/lab.h +++ b/engines/lab/lab.h @@ -113,6 +113,7 @@ private: bool _mouseAtEdge; public: byte *_tempScrollData; + bool _isHiRes; private: bool createScreen(bool HiRes); diff --git a/engines/lab/machine.cpp b/engines/lab/machine.cpp index b2ce65e9db..2bef80da2d 100644 --- a/engines/lab/machine.cpp +++ b/engines/lab/machine.cpp @@ -30,18 +30,17 @@ #include "common/str.h" +#include "lab/lab.h" #include "lab/stddefines.h" namespace Lab { -bool IsHiRes = false; - /*****************************************************************************/ /* Scales the x co-ordinates to that of the new display. In the room parser */ /* file, co-ordinates are set up on a 360x336 display. */ /*****************************************************************************/ uint16 scaleX(uint16 x) { - if (IsHiRes) + if (g_lab->_isHiRes) return (uint16)((x * 16) / 9); else return (uint16)((x * 8) / 9); @@ -52,7 +51,7 @@ uint16 scaleX(uint16 x) { /* file, co-ordinates are set up on a 368x336 display. */ /*****************************************************************************/ uint16 scaleY(uint16 y) { - if (IsHiRes) + if (g_lab->_isHiRes) return (y + (y / 14)); else return ((y * 10) / 24); @@ -62,7 +61,7 @@ uint16 scaleY(uint16 y) { /* Scales the VGA cords to SVGA if necessary; otherwise, returns VGA cords. */ /*****************************************************************************/ int16 VGAScaleX(int16 x) { - if (IsHiRes) + if (g_lab->_isHiRes) return (x * 2); else return x; @@ -72,14 +71,14 @@ int16 VGAScaleX(int16 x) { /* Scales the VGA cords to SVGA if necessary; otherwise, returns VGA cords. */ /*****************************************************************************/ int16 VGAScaleY(int16 y) { - if (IsHiRes) + if (g_lab->_isHiRes) return ((y * 12) / 5); else return y; } uint16 SVGACord(uint16 cord) { - if (IsHiRes) + if (g_lab->_isHiRes) return cord; else return 0; @@ -89,7 +88,7 @@ uint16 SVGACord(uint16 cord) { /* Converts SVGA cords to VGA if necessary, otherwise returns VGA cords. */ /*****************************************************************************/ int VGAUnScaleX(int x) { - if (IsHiRes) + if (g_lab->_isHiRes) return (x / 2); else return x; @@ -99,7 +98,7 @@ int VGAUnScaleX(int x) { /* Converts SVGA cords to VGA if necessary, otherwise returns VGA cords. */ /*****************************************************************************/ int VGAUnScaleY(int y) { - if (IsHiRes) + if (g_lab->_isHiRes) return ((y * 5) / 12); else return y; @@ -108,7 +107,7 @@ int VGAUnScaleY(int y) { static char NewFileName[255]; /*****************************************************************************/ -/* Modifes the filename so that paths and stuff are correct. Should mostly */ +/* Modifies the filename so that paths and stuff are correct. Should mostly */ /* deal with assigns and the '/' instead of '\' on IBM systems. */ /* */ /* NOTE: Make a *copy* of the string, and modify that. It would be a real */ @@ -122,7 +121,7 @@ char *translateFileName(const char *filename) { Common::String fileNameStrFinal; if (fileNameStr.hasPrefix("P:")) { - if (IsHiRes) + if (g_lab->_isHiRes) fileNameStrFinal = "GAME/SPICT/"; else fileNameStrFinal = "GAME/PICT/"; diff --git a/engines/lab/map.cpp b/engines/lab/map.cpp index d41322f426..e4b8b3258a 100644 --- a/engines/lab/map.cpp +++ b/engines/lab/map.cpp @@ -47,7 +47,6 @@ static TextFont bmf; extern uint16 Direction; -extern bool IsHiRes; extern CloseDataPtr CPtr; extern uint16 RoomNum; @@ -170,7 +169,7 @@ static uint16 AmigaMapPalette[] = { static uint16 mapScaleX(uint16 x) { - if (IsHiRes) + if (g_lab->_isHiRes) return (x - 45); else return ((x - 45) >> 1); @@ -179,7 +178,7 @@ static uint16 mapScaleX(uint16 x) { static uint16 mapScaleY(uint16 y) { - if (IsHiRes) + if (g_lab->_isHiRes) return y; else return ((y - 35) >> 1) - (y >> 6); diff --git a/engines/lab/mouse.cpp b/engines/lab/mouse.cpp index ace64593a3..eeae317f22 100644 --- a/engines/lab/mouse.cpp +++ b/engines/lab/mouse.cpp @@ -35,8 +35,6 @@ namespace Lab { -extern bool IsHiRes; - static bool LeftClick = false; static bool RightClick = false; @@ -75,7 +73,7 @@ Gadget *EventManager::checkGadgetHit(Gadget *gadlist, Common::Point pos) { (pos.x <= (gadlist->x + gadlist->Im->Width)) && (pos.y <= (gadlist->y + gadlist->Im->Height)) && !(GADGETOFF & gadlist->GadgetFlags)) { - if (IsHiRes) { + if (_vm->_isHiRes) { hitgad = gadlist; } else { mouseHide(); @@ -118,7 +116,7 @@ void EventManager::mouseHandler(int flag, Common::Point pos) { if (flag & 0x02) { /* Left mouse button click */ Gadget *tmp = NULL; if (ScreenGadgetList) - tmp = checkGadgetHit(ScreenGadgetList, IsHiRes ? pos : Common::Point(pos.x / 2, pos.y)); + tmp = checkGadgetHit(ScreenGadgetList, _vm->_isHiRes ? pos : Common::Point(pos.x / 2, pos.y)); if (tmp) LastGadgetHit = tmp; @@ -200,7 +198,7 @@ void EventManager::mouseHide() { /* from virtual to screen co-ordinates automatically. */ /*****************************************************************************/ Common::Point EventManager::getMousePos() { - if (IsHiRes) + if (_vm->_isHiRes) return _vm->_mousePos; else return Common::Point(_vm->_mousePos.x / 2, _vm->_mousePos.y); @@ -211,7 +209,7 @@ Common::Point EventManager::getMousePos() { /* Moves the mouse to new co-ordinates. */ /*****************************************************************************/ void EventManager::setMousePos(Common::Point pos) { - if (IsHiRes) + if (_vm->_isHiRes) g_system->warpMouse(pos.x, pos.y); else g_system->warpMouse(pos.x * 2, pos.y); @@ -229,14 +227,14 @@ void EventManager::setMousePos(Common::Point pos) { bool EventManager::mouseButton(uint16 *x, uint16 *y, bool leftbutton) { if (leftbutton) { if (LeftClick) { - *x = (!IsHiRes) ? (uint16)_vm->_mousePos.x / 2 : (uint16)_vm->_mousePos.x; + *x = (!_vm->_isHiRes) ? (uint16)_vm->_mousePos.x / 2 : (uint16)_vm->_mousePos.x; *y = (uint16)_vm->_mousePos.y; LeftClick = false; return true; } } else { if (RightClick) { - *x = (!IsHiRes) ? (uint16)_vm->_mousePos.x / 2 : (uint16)_vm->_mousePos.x; + *x = (!_vm->_isHiRes) ? (uint16)_vm->_mousePos.x / 2 : (uint16)_vm->_mousePos.x; *y = (uint16)_vm->_mousePos.y; RightClick = false; return true; @@ -249,7 +247,7 @@ bool EventManager::mouseButton(uint16 *x, uint16 *y, bool leftbutton) { Gadget *EventManager::mouseGadget() { Gadget *Temp = LastGadgetHit; - LastGadgetHit = NULL; + LastGadgetHit = nullptr; return Temp; } diff --git a/engines/lab/special.cpp b/engines/lab/special.cpp index 9b0ed4217f..96f7bfd1ac 100644 --- a/engines/lab/special.cpp +++ b/engines/lab/special.cpp @@ -85,7 +85,7 @@ uint16 CurTile[4][4] = { extern TextFont *MsgFont; extern uint16 *FadePalette; -extern bool nopalchange, DoBlack, IsHiRes; +extern bool nopalchange, DoBlack; extern BitMap *DispBitMap, *DrawBitMap; extern char diffcmap[3 * 256]; extern CloseDataPtr CPtr; @@ -187,7 +187,7 @@ static void changeCombination(uint16 number) { display.Height = g_lab->_screenHeight; for (uint16 i = 1; i <= (Images[combnum]->Height / 2); i++) { - if (IsHiRes) { + if (g_lab->_isHiRes) { if (i & 1) g_lab->waitTOF(); } else -- cgit v1.2.3 From 771e558d905ee467280482d62697dc66d969ed2b Mon Sep 17 00:00:00 2001 From: Strangerke Date: Mon, 30 Nov 2015 00:34:43 +0100 Subject: LAB: Move the global variable g_resource to the main engine class --- engines/lab/engine.cpp | 10 +++++----- engines/lab/graphics.cpp | 4 ++-- engines/lab/intro.cpp | 2 +- engines/lab/lab.cpp | 9 ++++++++- engines/lab/lab.h | 3 +++ engines/lab/labfun.h | 8 +++++++- engines/lab/labsets.cpp | 5 +++-- engines/lab/map.cpp | 22 +++++++++++----------- engines/lab/processroom.cpp | 14 +++++++------- engines/lab/resource.cpp | 4 +--- engines/lab/resource.h | 5 ++--- engines/lab/special.cpp | 12 ++++++------ 12 files changed, 56 insertions(+), 42 deletions(-) diff --git a/engines/lab/engine.cpp b/engines/lab/engine.cpp index e246d6d9be..d7561d1e8f 100644 --- a/engines/lab/engine.cpp +++ b/engines/lab/engine.cpp @@ -650,13 +650,13 @@ void LabEngine::mainGameLoop() { RoomNum = 1; Direction = NORTH; - g_resource->readRoomData("LAB:Doors"); - g_resource->readInventory("LAB:Inventor"); + _resource->readRoomData("LAB:Doors"); + _resource->readInventory("LAB:Inventor"); - if (!(_conditions = new LargeSet(HighestCondition + 1))) + if (!(_conditions = new LargeSet(HighestCondition + 1, this))) return; - if (!(_roomsFound = new LargeSet(ManyRooms + 1))) + if (!(_roomsFound = new LargeSet(ManyRooms + 1, this))) return; _conditions->readInitialConditions("LAB:Conditio"); @@ -1328,7 +1328,7 @@ void LabEngine::go() { if (!dointro) g_music->initMusic(); - MsgFont = g_resource->getFont("P:AvanteG.12"); + MsgFont = _resource->getFont("P:AvanteG.12"); _event->mouseHide(); diff --git a/engines/lab/graphics.cpp b/engines/lab/graphics.cpp index 218f3c66d4..80d78edfbe 100644 --- a/engines/lab/graphics.cpp +++ b/engines/lab/graphics.cpp @@ -93,7 +93,7 @@ bool readPict(const char *filename, bool PlayOnce) { /* Reads in a music file. Ignores any graphics. */ /*****************************************************************************/ bool readMusic(const char *filename, bool waitTillFinished) { - Common::File *file = g_resource->openDataFile(filename, MKTAG('D', 'I', 'F', 'F')); + Common::File *file = g_lab->_resource->openDataFile(filename, MKTAG('D', 'I', 'F', 'F')); g_music->updateMusic(); if (!g_music->_doNotFilestopSoundEffect) g_music->stopSoundEffect(); @@ -360,7 +360,7 @@ int32 LabEngine::longDrawMessage(const char *str) { } void LabEngine::drawStaticMessage(byte index) { - drawMessage(g_resource->getStaticText((StaticText)index).c_str()); + drawMessage(_resource->getStaticText((StaticText)index).c_str()); } /******************************************************************************/ diff --git a/engines/lab/intro.cpp b/engines/lab/intro.cpp index 269922bbb3..7cbe48c044 100644 --- a/engines/lab/intro.cpp +++ b/engines/lab/intro.cpp @@ -347,7 +347,7 @@ void Intro::introSequence() { blackAllScreen(); g_music->updateMusic(); - _msgfont = g_resource->getFont("P:Map.fon"); + _msgfont = g_lab->_resource->getFont("P:Map.fon"); nopalchange = true; nReadPict("Intro.1", true); diff --git a/engines/lab/lab.cpp b/engines/lab/lab.cpp index b2e779f07e..3792f2b0d3 100644 --- a/engines/lab/lab.cpp +++ b/engines/lab/lab.cpp @@ -73,6 +73,10 @@ LabEngine::LabEngine(OSystem *syst, const ADGameDescription *gameDesc) _nextKeyOut = 0; _isHiRes = false; + + _event = nullptr; + _resource = nullptr; + //const Common::FSNode gameDataDir(ConfMan.get("path")); //SearchMan.addSubDirectoryMatching(gameDataDir, "game"); //SearchMan.addSubDirectoryMatching(gameDataDir, "game/pict"); @@ -83,6 +87,9 @@ LabEngine::LabEngine(OSystem *syst, const ADGameDescription *gameDesc) LabEngine::~LabEngine() { // Remove all of our debug levels here DebugMan.clearAllDebugChannels(); + + delete _event; + delete _resource; } Common::Error LabEngine::run() { @@ -92,9 +99,9 @@ Common::Error LabEngine::run() { initGraphics(640, 480, true); _event = new EventManager(this); + _resource = new Resource(this); g_music = new Music(); - g_resource = new Resource(); if (getPlatform() == Common::kPlatformWindows) { // Check if this is the Wyrmkeep trial diff --git a/engines/lab/lab.h b/engines/lab/lab.h index 8ead009fd7..7e7f645167 100644 --- a/engines/lab/lab.h +++ b/engines/lab/lab.h @@ -38,6 +38,7 @@ #include "lab/labfun.h" #include "lab/interface.h" #include "lab/mouse.h" +#include "lab/resource.h" struct ADGameDescription; @@ -99,6 +100,8 @@ private: public: EventManager *_event; + Resource *_resource; + byte *_currentDsplayBuffer; Common::Point _mousePos; diff --git a/engines/lab/labfun.h b/engines/lab/labfun.h index f602d6007a..dd4796a2d0 100644 --- a/engines/lab/labfun.h +++ b/engines/lab/labfun.h @@ -47,6 +47,8 @@ namespace Lab { +class LabEngine; + /* Direction defines */ #define NORTH 0 #define SOUTH 1 @@ -209,12 +211,16 @@ extern Music *g_music; class LargeSet { public: - LargeSet(uint16 last); + LargeSet(uint16 last, LabEngine *vm); ~LargeSet(); bool in(uint16 element); void inclElement(uint16 element); void exclElement(uint16 element); bool readInitialConditions(const char *fileName); + +private: + LabEngine *_vm; + public: uint16 _lastElement; uint16 *_array; diff --git a/engines/lab/labsets.cpp b/engines/lab/labsets.cpp index 4dcc0c8ebc..edd764668b 100644 --- a/engines/lab/labsets.cpp +++ b/engines/lab/labsets.cpp @@ -28,13 +28,14 @@ * */ +#include "lab/lab.h" #include "lab/stddefines.h" #include "lab/labfun.h" #include "lab/resource.h" namespace Lab { -LargeSet::LargeSet(uint16 last) { + LargeSet::LargeSet(uint16 last, LabEngine *vm) : _vm(vm) { last = (((last + 15) >> 4) << 4); _array = (uint16 *)calloc(last >> 3, 2); @@ -60,7 +61,7 @@ void LargeSet::exclElement(uint16 element) { bool LargeSet::readInitialConditions(const char *fileName) { Common::File *file; - if (file = g_resource->openDataFile(fileName, MKTAG('C', 'O', 'N', '0'))) { + if (file = _vm->_resource->openDataFile(fileName, MKTAG('C', 'O', 'N', '0'))) { uint16 conditions = file->readUint16LE(); for (int i = 0; i < conditions; i++) { inclElement(file->readUint16LE()); diff --git a/engines/lab/map.cpp b/engines/lab/map.cpp index e4b8b3258a..e4a6f04c74 100644 --- a/engines/lab/map.cpp +++ b/engines/lab/map.cpp @@ -196,7 +196,7 @@ static bool loadMapData() { BigMsgFont = &bmf; - if (!(BigMsgFont = g_resource->getFont("P:Map.fon"))) + if (!(BigMsgFont = g_lab->_resource->getFont("P:Map.fon"))) BigMsgFont = MsgFont; resetBuffer(); /* Make images load into start of buffer */ @@ -249,7 +249,7 @@ static bool loadMapData() { counter++; } - Common::File *mapFile = g_resource->openDataFile("Lab:Maps", MKTAG('M', 'A', 'P', '0')); + Common::File *mapFile = g_lab->_resource->openDataFile("Lab:Maps", MKTAG('M', 'A', 'P', '0')); if (!mapFile) error("Corrupt map file"); g_music->updateMusic(); @@ -611,31 +611,31 @@ void LabEngine::drawMap(uint16 CurRoom, uint16 CurMsg, uint16 Floor, bool fadeou if (onFloor(HEDGEMAZEFLOOR)) drawImage(HugeMaze, mapScaleX(524), mapScaleY(97)); } else if (Floor == SURMAZEFLOOR) { - sptr = (char *)g_resource->getStaticText(kTextSurmazeMessage).c_str(); + sptr = (char *)_resource->getStaticText(kTextSurmazeMessage).c_str(); flowText(MsgFont, 0, 7, 0, true, true, true, true, mapScaleX(360), 0, mapScaleX(660), mapScaleY(450), sptr); } switch (Floor) { case LOWERFLOOR: - sptr = (char *)g_resource->getStaticText(kTextLowerFloor).c_str(); + sptr = (char *)_resource->getStaticText(kTextLowerFloor).c_str(); break; case MIDDLEFLOOR: - sptr = (char *)g_resource->getStaticText(kTextMiddleFloor).c_str(); + sptr = (char *)_resource->getStaticText(kTextMiddleFloor).c_str(); break; case UPPERFLOOR: - sptr = (char *)g_resource->getStaticText(kTextUpperFloor).c_str(); + sptr = (char *)_resource->getStaticText(kTextUpperFloor).c_str(); break; case MEDMAZEFLOOR: - sptr = (char *)g_resource->getStaticText(kTextMedMazeFloor).c_str(); + sptr = (char *)_resource->getStaticText(kTextMedMazeFloor).c_str(); break; case HEDGEMAZEFLOOR: - sptr = (char *)g_resource->getStaticText(kTextHedgeMazeFloor).c_str(); + sptr = (char *)_resource->getStaticText(kTextHedgeMazeFloor).c_str(); break; case SURMAZEFLOOR: - sptr = (char *)g_resource->getStaticText(kTextSurMazeFloor).c_str(); + sptr = (char *)_resource->getStaticText(kTextSurMazeFloor).c_str(); break; case CARNIVAL: - sptr = (char *)g_resource->getStaticText(kTextCarnivalFloor).c_str(); + sptr = (char *)_resource->getStaticText(kTextCarnivalFloor).c_str(); break; default: sptr = NULL; @@ -795,7 +795,7 @@ void LabEngine::processMap(uint16 CurRoom) { if (OldMsg != CurMsg) { if (_rooms[CurMsg]._roomMsg == nullptr) - g_resource->readViews(CurMsg); + _resource->readViews(CurMsg); if ((sptr = _rooms[CurMsg]._roomMsg)) { _event->mouseHide(); diff --git a/engines/lab/processroom.cpp b/engines/lab/processroom.cpp index 1932d486d4..ef1a8011e1 100644 --- a/engines/lab/processroom.cpp +++ b/engines/lab/processroom.cpp @@ -96,7 +96,7 @@ ViewData *getViewData(uint16 roomNum, uint16 direction) { ViewData *view = NULL; if (!_rooms[roomNum]._roomMsg) - g_resource->readViews(roomNum); + g_lab->_resource->readViews(roomNum); if (direction == NORTH) view = _rooms[roomNum]._northView; @@ -202,13 +202,13 @@ void LabEngine::drawDirection(CloseDataPtr LCPtr) { } if (Direction == NORTH) - message += g_resource->getStaticText(kTextFacingNorth); + message += _resource->getStaticText(kTextFacingNorth); else if (Direction == EAST) - message += g_resource->getStaticText(kTextFacingEast); + message += _resource->getStaticText(kTextFacingEast); else if (Direction == SOUTH) - message += g_resource->getStaticText(kTextFacingSouth); + message += _resource->getStaticText(kTextFacingSouth); else if (Direction == WEST) - message += g_resource->getStaticText(kTextFacingWest); + message += _resource->getStaticText(kTextFacingWest); drawMessage(message.c_str()); } @@ -614,7 +614,7 @@ static bool doActionRuleSub(int16 action, int16 roomNum, CloseDataPtr LCPtr, Clo RuleList *rules = _rooms[RoomNum]._rules; if ((rules == NULL) && (roomNum == 0)) { - g_resource->readViews(roomNum); + g_lab->_resource->readViews(roomNum); rules = _rooms[roomNum]._rules; } @@ -671,7 +671,7 @@ static bool doOperateRuleSub(int16 ItemNum, int16 roomNum, CloseDataPtr LCPtr, C RuleList *rules = _rooms[roomNum]._rules; if ((rules == NULL) && (roomNum == 0)) { - g_resource->readViews(roomNum); + g_lab->_resource->readViews(roomNum); rules = _rooms[roomNum]._rules; } diff --git a/engines/lab/resource.cpp b/engines/lab/resource.cpp index 2f11515db2..5e6fe290df 100644 --- a/engines/lab/resource.cpp +++ b/engines/lab/resource.cpp @@ -39,9 +39,7 @@ extern RoomData *_rooms; extern InventoryData *Inventory; extern uint16 NumInv, ManyRooms, HighestCondition; -Resource *g_resource; - -Resource::Resource() { +Resource::Resource(LabEngine *vm) : _vm(vm) { readStaticText(); } diff --git a/engines/lab/resource.h b/engines/lab/resource.h index d41859e9f5..841aa09564 100644 --- a/engines/lab/resource.h +++ b/engines/lab/resource.h @@ -95,7 +95,7 @@ enum StaticText { class Resource { public: - Resource(); + Resource(LabEngine *vm); ~Resource() {} Common::File *openDataFile(const char * fileName, uint32 fileHeader); @@ -106,6 +106,7 @@ public: Common::String getStaticText(byte index) const { return _staticText[index]; } private: + LabEngine *_vm; char *readString(Common::File *file); int16 *readConditions(Common::File *file); RuleList *readRule(Common::File *file); @@ -117,8 +118,6 @@ private: Common::String _staticText[48]; }; -extern Resource *g_resource; - } // End of namespace Lab #endif /* LAB_RESOURCE_H */ diff --git a/engines/lab/special.cpp b/engines/lab/special.cpp index 96f7bfd1ac..eaa9ef2755 100644 --- a/engines/lab/special.cpp +++ b/engines/lab/special.cpp @@ -461,7 +461,7 @@ void doNotes() { /* Load in the data */ BigMsgFont = &bmfont; - if (!(BigMsgFont = g_resource->getFont("P:Note.fon"))) { + if (!(BigMsgFont = g_lab->_resource->getFont("P:Note.fon"))) { BigMsgFont = NULL; return; } @@ -487,7 +487,7 @@ void doWestPaper() { BigMsgFont = &bmfont; - if (!(BigMsgFont = g_resource->getFont("P:News22.fon"))) { + if (!(BigMsgFont = g_lab->_resource->getFont("P:News22.fon"))) { BigMsgFont = NULL; return; } @@ -499,7 +499,7 @@ void doWestPaper() { BigMsgFont = &bmfont; - if (!(BigMsgFont = g_resource->getFont("P:News32.fon"))) { + if (!(BigMsgFont = g_lab->_resource->getFont("P:News32.fon"))) { BigMsgFont = NULL; return; } @@ -518,7 +518,7 @@ void doWestPaper() { BigMsgFont = &bmfont; - if (!(BigMsgFont = g_resource->getFont("P:Note.fon"))) { + if (!(BigMsgFont = g_lab->_resource->getFont("P:Note.fon"))) { BigMsgFont = NULL; return; } @@ -548,7 +548,7 @@ static bool loadJournalData() { BigMsgFont = &bmfont; - if (!(BigMsgFont = g_resource->getFont("P:Journal.fon"))) { + if (!(BigMsgFont = g_lab->_resource->getFont("P:Journal.fon"))) { BigMsgFont = NULL; return false; } @@ -1047,7 +1047,7 @@ void LabEngine::doMonitor(char *background, char *textfile, bool isinteractive, BigMsgFont = &bmfont; - if (!(BigMsgFont = g_resource->getFont("P:Map.fon"))) { + if (!(BigMsgFont = _resource->getFont("P:Map.fon"))) { freeAllStolenMem(); BigMsgFont = NULL; return; -- cgit v1.2.3 From 05f54b7fe0a0fbdfc731404b77b149f10ad5679b Mon Sep 17 00:00:00 2001 From: Strangerke Date: Mon, 30 Nov 2015 01:03:14 +0100 Subject: LAB: Make _music a member of LabEngine instead of a global --- engines/lab/graphics.cpp | 10 +++---- engines/lab/intro.cpp | 32 ++++++++++----------- engines/lab/lab.cpp | 4 +-- engines/lab/lab.h | 1 + engines/lab/labfun.h | 6 ++-- engines/lab/labmusic.cpp | 3 +- engines/lab/map.cpp | 14 +++++----- engines/lab/processroom.cpp | 68 ++++++++++++++++++++++----------------------- engines/lab/readdiff.cpp | 14 +++++----- engines/lab/resource.cpp | 6 ++-- engines/lab/special.cpp | 22 +++++++-------- 11 files changed, 89 insertions(+), 91 deletions(-) diff --git a/engines/lab/graphics.cpp b/engines/lab/graphics.cpp index 80d78edfbe..4d19f61baa 100644 --- a/engines/lab/graphics.cpp +++ b/engines/lab/graphics.cpp @@ -68,7 +68,7 @@ bool readPict(const char *filename, bool PlayOnce) { stopDiff(); - file = g_music->newOpen(filename); + file = g_lab->g_music->newOpen(filename); if (file == NULL) { if ((filename[0] == 'p') || (filename[0] == 'P')) @@ -94,9 +94,9 @@ bool readPict(const char *filename, bool PlayOnce) { /*****************************************************************************/ bool readMusic(const char *filename, bool waitTillFinished) { Common::File *file = g_lab->_resource->openDataFile(filename, MKTAG('D', 'I', 'F', 'F')); - g_music->updateMusic(); - if (!g_music->_doNotFilestopSoundEffect) - g_music->stopSoundEffect(); + g_lab->g_music->updateMusic(); + if (!g_lab->g_music->_doNotFilestopSoundEffect) + g_lab->g_music->stopSoundEffect(); if (!file) return false; @@ -121,7 +121,7 @@ byte *readPictToMem(const char *filename, uint16 x, uint16 y) { allocFile((void **)&Mem, (int32) x * (int32) y, "Bitmap"); CurMem = Mem; - file = g_music->newOpen(filename); + file = g_lab->g_music->newOpen(filename); if (file == NULL) return NULL; diff --git a/engines/lab/intro.cpp b/engines/lab/intro.cpp index 7cbe48c044..eaf1aa928b 100644 --- a/engines/lab/intro.cpp +++ b/engines/lab/intro.cpp @@ -90,10 +90,10 @@ void Intro::doPictText(const char *filename, bool isscreen) { strcat(path, filename); if (isscreen) { - g_music->updateMusic(); + g_lab->g_music->updateMusic(); timedelay = 35; } else { - g_music->updateMusic(); + g_lab->g_music->updateMusic(); timedelay = 7; } @@ -105,7 +105,7 @@ void Intro::doPictText(const char *filename, bool isscreen) { if (begin) { begin = false; - tfile = g_music->newOpen(path); + tfile = g_lab->g_music->newOpen(path); if (!tfile) return; @@ -144,7 +144,7 @@ void Intro::doPictText(const char *filename, bool isscreen) { msg = g_lab->getMsg(); if (msg == NULL) { - g_music->updateMusic(); + g_lab->g_music->updateMusic(); g_lab->diffNextFrame(); g_lab->getTime(&secs, µs); g_lab->anyTimeDiff(lastsecs, lastmicros, secs, micros, &secs, µs); @@ -216,13 +216,13 @@ void Intro::doPictText(const char *filename, bool isscreen) { /* Does a one second delay, but checks the music while doing it. */ /*****************************************************************************/ void Intro::musicDelay() { - g_music->updateMusic(); + g_lab->g_music->updateMusic(); if (_quitIntro) return; for (uint16 i = 0; i < 20; i++) { - g_music->updateMusic(); + g_lab->g_music->updateMusic(); g_lab->waitTOF(); g_lab->waitTOF(); g_lab->waitTOF(); @@ -234,7 +234,7 @@ void Intro::musicDelay() { void Intro::nReadPict(const char *filename, bool playOnce) { Common::String finalFileName = Common::String("P:Intro/") + filename; - g_music->updateMusic(); + g_lab->g_music->updateMusic(); introEatMessages(); if (_quitIntro) @@ -277,7 +277,7 @@ void Intro::introSequence() { blackAllScreen(); - g_music->initMusic(); + g_lab->g_music->initMusic(); nopalchange = true; if (g_lab->getPlatform() != Common::kPlatformWindows) @@ -297,14 +297,14 @@ void Intro::introSequence() { (diffcmap[i * 3 + 2] >> 2); } - g_music->updateMusic(); + g_lab->g_music->updateMusic(); fade(true, 0); for (int times = 0; times < 150; times++) { if (_quitIntro) break; - g_music->updateMusic(); + g_lab->g_music->updateMusic(); uint16 temp = palette[2]; for (uint16 i = 2; i < 15; i++) @@ -319,7 +319,7 @@ void Intro::introSequence() { fade(false, 0); blackAllScreen(); - g_music->updateMusic(); + g_lab->g_music->updateMusic(); nReadPict("Title.A", true); nReadPict("AB", true); @@ -341,11 +341,11 @@ void Intro::introSequence() { nReadPict("DA", true); musicDelay(); - g_music->newOpen("p:Intro/Intro.1"); /* load the picture into the buffer */ + g_lab->g_music->newOpen("p:Intro/Intro.1"); /* load the picture into the buffer */ - g_music->updateMusic(); + g_lab->g_music->updateMusic(); blackAllScreen(); - g_music->updateMusic(); + g_lab->g_music->updateMusic(); _msgfont = g_lab->_resource->getFont("P:Map.fon"); @@ -366,7 +366,7 @@ void Intro::introSequence() { freeAllStolenMem(); blackAllScreen(); - g_music->updateMusic(); + g_lab->g_music->updateMusic(); _introDoBlack = true; nReadPict("Station1", true); @@ -398,7 +398,7 @@ void Intro::introSequence() { for (uint16 idx = (8 * 3); idx < (255 * 3); idx++) diffcmap[idx] = 255 - diffcmap[idx]; - g_music->updateMusic(); + g_lab->g_music->updateMusic(); g_lab->waitTOF(); g_lab->VGASetPal(diffcmap, 256); g_lab-> waitTOF(); diff --git a/engines/lab/lab.cpp b/engines/lab/lab.cpp index 3792f2b0d3..745bb74f94 100644 --- a/engines/lab/lab.cpp +++ b/engines/lab/lab.cpp @@ -76,6 +76,7 @@ LabEngine::LabEngine(OSystem *syst, const ADGameDescription *gameDesc) _event = nullptr; _resource = nullptr; + g_music = nullptr; //const Common::FSNode gameDataDir(ConfMan.get("path")); //SearchMan.addSubDirectoryMatching(gameDataDir, "game"); @@ -100,8 +101,7 @@ Common::Error LabEngine::run() { _event = new EventManager(this); _resource = new Resource(this); - - g_music = new Music(); + g_music = new Music(this); if (getPlatform() == Common::kPlatformWindows) { // Check if this is the Wyrmkeep trial diff --git a/engines/lab/lab.h b/engines/lab/lab.h index 7e7f645167..dd0c204dbc 100644 --- a/engines/lab/lab.h +++ b/engines/lab/lab.h @@ -101,6 +101,7 @@ private: public: EventManager *_event; Resource *_resource; + Music *g_music; byte *_currentDsplayBuffer; Common::Point _mousePos; diff --git a/engines/lab/labfun.h b/engines/lab/labfun.h index dd4796a2d0..57d5817c71 100644 --- a/engines/lab/labfun.h +++ b/engines/lab/labfun.h @@ -157,7 +157,7 @@ void closePartial(int32 File); class Music { public: - Music(); + Music(LabEngine *vm); byte **newOpen(const char *name); byte **newOpen(const char *name, uint32 &size); @@ -185,6 +185,7 @@ public: bool _doReset; private: + LabEngine *_vm; void fillbuffer(byte *musicBuffer); void startMusic(bool startatbegin); @@ -202,9 +203,6 @@ private: Audio::QueuingAudioStream *_queuingAudioStream; }; - -extern Music *g_music; - /*---------------------------*/ /*----- From LabSets.c ------*/ /*---------------------------*/ diff --git a/engines/lab/labmusic.cpp b/engines/lab/labmusic.cpp index a7043dc424..843a866e26 100644 --- a/engines/lab/labmusic.cpp +++ b/engines/lab/labmusic.cpp @@ -43,10 +43,9 @@ namespace Lab { #define CLOWNROOM 123 #define DIMROOM 80 -Music *g_music; extern uint16 RoomNum; // TODO: Move into a class -Music::Music() { +Music::Music(LabEngine *vm) : _vm(vm) { _file = 0; _tFile = 0; _musicPaused = false; diff --git a/engines/lab/map.cpp b/engines/lab/map.cpp index e4a6f04c74..6c2201608e 100644 --- a/engines/lab/map.cpp +++ b/engines/lab/map.cpp @@ -84,9 +84,9 @@ char *getText(const char *filename) { bool dodecrypt; byte **tfile; - g_music->updateMusic(); + g_lab->g_music->updateMusic(); dodecrypt = (isBuffered(filename) == NULL); - tfile = g_music->newOpen(filename); + tfile = g_lab->g_music->newOpen(filename); if (!tfile) return NULL; @@ -200,7 +200,7 @@ static bool loadMapData() { BigMsgFont = MsgFont; resetBuffer(); /* Make images load into start of buffer */ - buffer = g_music->newOpen("P:MapImage", Size); + buffer = g_lab->g_music->newOpen("P:MapImage", Size); if (!buffer) return false; @@ -252,9 +252,9 @@ static bool loadMapData() { Common::File *mapFile = g_lab->_resource->openDataFile("Lab:Maps", MKTAG('M', 'A', 'P', '0')); if (!mapFile) error("Corrupt map file"); - g_music->updateMusic(); - if (!g_music->_doNotFilestopSoundEffect) - g_music->stopSoundEffect(); + g_lab->g_music->updateMusic(); + if (!g_lab->g_music->_doNotFilestopSoundEffect) + g_lab->g_music->stopSoundEffect(); MaxRooms = mapFile->readUint16LE(); Maps = new MapData[MaxRooms]; // will be freed when the user exits the map @@ -309,7 +309,7 @@ void fade(bool fadein, uint16 res) { setAmigaPal(newpal, 16); g_lab->waitTOF(); - g_music->updateMusic(); + g_lab->g_music->updateMusic(); } } diff --git a/engines/lab/processroom.cpp b/engines/lab/processroom.cpp index ef1a8011e1..2939d8af5d 100644 --- a/engines/lab/processroom.cpp +++ b/engines/lab/processroom.cpp @@ -333,26 +333,26 @@ static void doActions(Action * APtr, CloseDataPtr *LCPtr) { uint32 StartSecs, StartMicros, CurSecs, CurMicros; while (APtr) { - g_music->updateMusic(); + g_lab->g_music->updateMusic(); switch (APtr->ActionType) { case PLAYSOUND: - g_music->_loopSoundEffect = false; - g_music->_waitTillFinished = true; + g_lab->g_music->_loopSoundEffect = false; + g_lab->g_music->_waitTillFinished = true; readMusic((char *)APtr->Data, true); - g_music->_waitTillFinished = false; + g_lab->g_music->_waitTillFinished = false; break; case PLAYSOUNDB: - g_music->_loopSoundEffect = false; - g_music->_waitTillFinished = false; + g_lab->g_music->_loopSoundEffect = false; + g_lab->g_music->_waitTillFinished = false; readMusic((char *)APtr->Data, false); break; case PLAYSOUNDCONT: - g_music->_doNotFilestopSoundEffect = true; - g_music->_loopSoundEffect = true; - readMusic((char *)APtr->Data, g_music->_waitTillFinished); + g_lab->g_music->_doNotFilestopSoundEffect = true; + g_lab->g_music->_loopSoundEffect = true; + readMusic((char *)APtr->Data, g_lab->g_music->_waitTillFinished); break; case SHOWDIFF: @@ -370,7 +370,7 @@ static void doActions(Action * APtr, CloseDataPtr *LCPtr) { } if (APtr->Data) - g_music->newOpen((char *)APtr->Data); /* Puts a file into memory */ + g_lab->g_music->newOpen((char *)APtr->Data); /* Puts a file into memory */ break; @@ -485,7 +485,7 @@ static void doActions(Action * APtr, CloseDataPtr *LCPtr) { g_lab->WSDL_UpdateScreen(); while (1) { - g_music->updateMusic(); + g_lab->g_music->updateMusic(); g_lab->diffNextFrame(); g_lab->getTime(&CurSecs, &CurMicros); @@ -497,30 +497,30 @@ static void doActions(Action * APtr, CloseDataPtr *LCPtr) { break; case STOPMUSIC: - g_music->setMusic(false); + g_lab->g_music->setMusic(false); break; case STARTMUSIC: - g_music->setMusic(true); + g_lab->g_music->setMusic(true); break; case CHANGEMUSIC: - g_music->changeMusic((const char *)APtr->Data); - g_music->setMusicReset(false); + g_lab->g_music->changeMusic((const char *)APtr->Data); + g_lab->g_music->setMusicReset(false); break; case RESETMUSIC: - g_music->resetMusic(); - g_music->setMusicReset(true); + g_lab->g_music->resetMusic(); + g_lab->g_music->setMusicReset(true); break; case FILLMUSIC: - g_music->updateMusic(); + g_lab->g_music->updateMusic(); break; case WAITSOUND: - while (g_music->isSoundEffectActive()) { - g_music->updateMusic(); + while (g_lab->g_music->isSoundEffectActive()) { + g_lab->g_music->updateMusic(); g_lab->diffNextFrame(); g_lab->waitTOF(); } @@ -528,18 +528,18 @@ static void doActions(Action * APtr, CloseDataPtr *LCPtr) { break; case CLEARSOUND: - if (g_music->_loopSoundEffect) { - g_music->_loopSoundEffect = false; - g_music->stopSoundEffect(); - } else if (g_music->isSoundEffectActive()) - g_music->stopSoundEffect(); + if (g_lab->g_music->_loopSoundEffect) { + g_lab->g_music->_loopSoundEffect = false; + g_lab->g_music->stopSoundEffect(); + } else if (g_lab->g_music->isSoundEffectActive()) + g_lab->g_music->stopSoundEffect(); break; case WINMUSIC: - g_music->_winmusic = true; - g_music->freeMusic(); - g_music->initMusic(); + g_lab->g_music->_winmusic = true; + g_lab->g_music->freeMusic(); + g_lab->g_music->initMusic(); break; case WINGAME: @@ -590,18 +590,18 @@ static void doActions(Action * APtr, CloseDataPtr *LCPtr) { APtr = APtr->NextAction; } - if (g_music->_loopSoundEffect) { - g_music->_loopSoundEffect = false; - g_music->stopSoundEffect(); + if (g_lab->g_music->_loopSoundEffect) { + g_lab->g_music->_loopSoundEffect = false; + g_lab->g_music->stopSoundEffect(); } else { - while (g_music->isSoundEffectActive()) { - g_music->updateMusic(); + while (g_lab->g_music->isSoundEffectActive()) { + g_lab->g_music->updateMusic(); g_lab->diffNextFrame(); g_lab->waitTOF(); } } - g_music->_doNotFilestopSoundEffect = false; + g_lab->g_music->_doNotFilestopSoundEffect = false; } /*****************************************************************************/ diff --git a/engines/lab/readdiff.cpp b/engines/lab/readdiff.cpp index ca7d3905ce..88b4c1805d 100644 --- a/engines/lab/readdiff.cpp +++ b/engines/lab/readdiff.cpp @@ -393,7 +393,7 @@ void stopDiff() { void stopDiffEnd() { if (IsPlaying) { while (IsPlaying) { - g_music->updateMusic(); + g_lab->g_music->updateMusic(); g_lab->diffNextFrame(); } } @@ -431,14 +431,14 @@ void readSound(bool waitTillFinished, Common::File *file) { return; while (soundTag != 65535) { - g_music->updateMusic(); + g_lab->g_music->updateMusic(); soundTag = file->readUint32LE(); soundSize = file->readUint32LE() - 8; if ((soundTag == 30) || (soundTag == 31)) { if (waitTillFinished) { - while (g_music->isSoundEffectActive()) { - g_music->updateMusic(); + while (g_lab->g_music->isSoundEffectActive()) { + g_lab->g_music->updateMusic(); g_lab->waitTOF(); } } @@ -449,11 +449,11 @@ void readSound(bool waitTillFinished, Common::File *file) { file->skip(2); byte *soundData = (byte *)malloc(soundSize); file->read(soundData, soundSize); - g_music->playSoundEffect(sampleRate, soundSize, soundData); + g_lab->g_music->playSoundEffect(sampleRate, soundSize, soundData); } else if (soundTag == 65535L) { if (waitTillFinished) { - while (g_music->isSoundEffectActive()) { - g_music->updateMusic(); + while (g_lab->g_music->isSoundEffectActive()) { + g_lab->g_music->updateMusic(); g_lab->waitTOF(); } } diff --git a/engines/lab/resource.cpp b/engines/lab/resource.cpp index 5e6fe290df..1e0ac6bbe9 100644 --- a/engines/lab/resource.cpp +++ b/engines/lab/resource.cpp @@ -28,13 +28,13 @@ * */ +#include "lab/lab.h" #include "lab/text.h" #include "lab/resource.h" namespace Lab { static uint16 allocroom; - extern RoomData *_rooms; extern InventoryData *Inventory; extern uint16 NumInv, ManyRooms, HighestCondition; @@ -65,7 +65,7 @@ TextFont *Resource::getFont(const char *fileName) { if (fileSize <= headerSize) return NULL; - g_music->updateMusic(); + _vm->g_music->updateMusic(); TextFont *textfont = (TextFont *)malloc(sizeof(TextFont)); textfont->DataLength = fileSize - headerSize; @@ -142,7 +142,7 @@ bool Resource::readViews(uint16 roomNum) { _rooms[roomNum]._westView = readView(dataFile); _rooms[roomNum]._rules = readRule(dataFile); - g_music->updateMusic(); + _vm->g_music->updateMusic(); delete dataFile; return true; diff --git a/engines/lab/special.cpp b/engines/lab/special.cpp index eaa9ef2755..417f854b84 100644 --- a/engines/lab/special.cpp +++ b/engines/lab/special.cpp @@ -153,7 +153,7 @@ void showCombination(const char *filename) { blackScreen(); - buffer = g_music->newOpen("P:Numbers"); + buffer = g_lab->g_music->newOpen("P:Numbers"); for (uint16 CurBit = 0; CurBit < 10; CurBit++) readImage(buffer, &(Images[CurBit])); @@ -297,10 +297,10 @@ void showTile(const char *filename, bool showsolution) { if (showsolution) { start = 0; - buffer = g_music->newOpen("P:TileSolution"); + buffer = g_lab->g_music->newOpen("P:TileSolution"); } else { start = 1; - buffer = g_music->newOpen("P:Tile"); + buffer = g_lab->g_music->newOpen("P:Tile"); } if (!buffer) @@ -553,7 +553,7 @@ static bool loadJournalData() { return false; } - g_music->updateMusic(); + g_lab->g_music->updateMusic(); strcpy(filename, "Lab:Rooms/j0"); bridge = g_lab->_conditions->in(BRIDGE0) || g_lab->_conditions->in(BRIDGE1); @@ -586,7 +586,7 @@ static bool loadJournalData() { if ((journaltexttitle = getText("Lab:Rooms/jt")) == NULL) return false; - buffer = g_music->newOpen("P:JImage"); + buffer = g_lab->g_music->newOpen("P:JImage"); if (!buffer) return false; @@ -628,7 +628,7 @@ static void drawJournalText() { char *CurText = journaltext; while (DrawingToPage < JPage) { - g_music->updateMusic(); + g_lab->g_music->updateMusic(); CurText = (char *)(journaltext + CharsDrawn); CharsDrawn += flowText(BigMsgFont, -2, 2, 0, false, false, false, false, VGAScaleX(52), VGAScaleY(32), VGAScaleX(152), VGAScaleY(148), CurText); @@ -648,7 +648,7 @@ static void drawJournalText() { CharsDrawn += flowTextToMem(&JBackImage, BigMsgFont, -2, 2, 0, false, false, false, true, VGAScaleX(52), VGAScaleY(32), VGAScaleX(152), VGAScaleY(148), CurText); } - g_music->updateMusic(); + g_lab->g_music->updateMusic(); CurText = (char *)(journaltext + CharsDrawn); lastpage = (*CurText == 0); flowTextToMem(&JBackImage, BigMsgFont, -2, 2, 0, false, false, false, true, VGAScaleX(171), VGAScaleY(32), VGAScaleX(271), VGAScaleY(148), CurText); @@ -663,14 +663,14 @@ static void drawJournalText() { static void turnPage(bool FromLeft) { if (FromLeft) { for (int i = 0; i < g_lab->_screenWidth; i += 8) { - g_music->updateMusic(); + g_lab->g_music->updateMusic(); g_lab->waitTOF(); ScreenImage.ImageData = g_lab->getVGABaseAddr(); g_lab->bltBitMap(&JBackImage, i, 0, &ScreenImage, i, 0, 8, g_lab->_screenHeight); } } else { for (int i = (g_lab->_screenWidth - 8); i > 0; i -= 8) { - g_music->updateMusic(); + g_lab->g_music->updateMusic(); g_lab->waitTOF(); ScreenImage.ImageData = g_lab->getVGABaseAddr(); g_lab->bltBitMap(&JBackImage, i, 0, &ScreenImage, i, 0, 8, g_lab->_screenHeight); @@ -837,7 +837,7 @@ bool saveRestoreGame() { if (slot >= 0) { isOK = loadGame(&RoomNum, &Direction, &(Inventory[QUARTERNUM].Many), slot); if (isOK) - g_music->resetMusic(); + g_lab->g_music->resetMusic(); } } @@ -855,7 +855,7 @@ static void getMonImages() { resetBuffer(); - buffer = g_music->newOpen("P:MonImage", bufferSize); + buffer = g_lab->g_music->newOpen("P:MonImage", bufferSize); if (!buffer) return; -- cgit v1.2.3 From d0c6c730365764668567f19e07b6971974c649fb Mon Sep 17 00:00:00 2001 From: Strangerke Date: Mon, 30 Nov 2015 01:17:05 +0100 Subject: LAB: Rename _music, delete it in engine destructor --- engines/lab/engine.cpp | 20 ++++++------- engines/lab/graphics.cpp | 38 ++++++++++++------------- engines/lab/intro.cpp | 32 ++++++++++----------- engines/lab/lab.cpp | 5 ++-- engines/lab/lab.h | 2 +- engines/lab/map.cpp | 22 +++++++-------- engines/lab/processroom.cpp | 68 ++++++++++++++++++++++----------------------- engines/lab/readdiff.cpp | 26 ++++++++--------- engines/lab/resource.cpp | 4 +-- engines/lab/special.cpp | 36 ++++++++++++------------ 10 files changed, 127 insertions(+), 126 deletions(-) diff --git a/engines/lab/engine.cpp b/engines/lab/engine.cpp index d7561d1e8f..5de7e8f4e0 100644 --- a/engines/lab/engine.cpp +++ b/engines/lab/engine.cpp @@ -678,7 +678,7 @@ void LabEngine::mainGameLoop() { break; } - g_music->resumeBackMusic(); + _music->resumeBackMusic(); /* Sees what kind of close up we're in and does the appropriate stuff, if any. */ if (doCloseUp(CPtr)) { @@ -734,15 +734,15 @@ void LabEngine::mainGameLoop() { } } - g_music->updateMusic(); /* Make sure we check the music at least after every message */ + _music->updateMusic(); /* Make sure we check the music at least after every message */ interfaceOn(); Msg = getMsg(); Common::Point curPos; if (Msg == NULL) { /* Does music load and next animation frame when you've run out of messages */ GotMessage = false; - g_music->checkRoomMusic(); - g_music->updateMusic(); + _music->checkRoomMusic(); + _music->updateMusic(); diffNextFrame(); if (FollowingCrumbs) { @@ -836,11 +836,11 @@ from_crumbs: interfaceOff(); while (1) { - g_music->updateMusic(); /* Make sure we check the music at least after every message */ + _music->updateMusic(); /* Make sure we check the music at least after every message */ Msg = getMsg(); if (Msg == NULL) { /* Does music load and next animation frame when you've run out of messages */ - g_music->updateMusic(); + _music->updateMusic(); diffNextFrame(); } else { if (Msg->msgClass == RAWKEY) { @@ -1326,7 +1326,7 @@ void LabEngine::go() { mem = mem && initRoomBuffer(); if (!dointro) - g_music->initMusic(); + _music->initMusic(); MsgFont = _resource->getFont("P:AvanteG.12"); @@ -1349,7 +1349,7 @@ void LabEngine::go() { readPict("P:End/L2In.1", true); for (uint16 i = 0; i < 120; i++) { - g_music->updateMusic(); + _music->updateMusic(); waitTOF(); } @@ -1358,7 +1358,7 @@ void LabEngine::go() { warning("STUB: waitForPress"); while (!1) { // 1 means ignore SDL_ProcessInput calls - g_music->updateMusic(); + _music->updateMusic(); diffNextFrame(); waitTOF(); } @@ -1369,7 +1369,7 @@ void LabEngine::go() { freeRoomBuffer(); freeBuffer(); - g_music->freeMusic(); + _music->freeMusic(); } /*****************************************************************************/ diff --git a/engines/lab/graphics.cpp b/engines/lab/graphics.cpp index 4d19f61baa..9f689bd57c 100644 --- a/engines/lab/graphics.cpp +++ b/engines/lab/graphics.cpp @@ -68,7 +68,7 @@ bool readPict(const char *filename, bool PlayOnce) { stopDiff(); - file = g_lab->g_music->newOpen(filename); + file = g_lab->_music->newOpen(filename); if (file == NULL) { if ((filename[0] == 'p') || (filename[0] == 'P')) @@ -94,9 +94,9 @@ bool readPict(const char *filename, bool PlayOnce) { /*****************************************************************************/ bool readMusic(const char *filename, bool waitTillFinished) { Common::File *file = g_lab->_resource->openDataFile(filename, MKTAG('D', 'I', 'F', 'F')); - g_lab->g_music->updateMusic(); - if (!g_lab->g_music->_doNotFilestopSoundEffect) - g_lab->g_music->stopSoundEffect(); + g_lab->_music->updateMusic(); + if (!g_lab->_music->_doNotFilestopSoundEffect) + g_lab->_music->stopSoundEffect(); if (!file) return false; @@ -121,7 +121,7 @@ byte *readPictToMem(const char *filename, uint16 x, uint16 y) { allocFile((void **)&Mem, (int32) x * (int32) y, "Bitmap"); CurMem = Mem; - file = g_lab->g_music->newOpen(filename); + file = g_lab->_music->newOpen(filename); if (file == NULL) return NULL; @@ -425,9 +425,9 @@ void LabEngine::doScrollBlack() { Im.Width = width; Im.Height = height; Im.ImageData = mem; - g_music->updateMusic(); + _music->updateMusic(); g_lab->readScreenImage(&Im, 0, 0); - g_music->updateMusic(); + _music->updateMusic(); BaseAddr = (uint32 *)g_lab->getVGABaseAddr(); @@ -435,7 +435,7 @@ void LabEngine::doScrollBlack() { nheight = height; while (nheight) { - g_music->updateMusic(); + _music->updateMusic(); if (!_isHiRes) g_lab->waitTOF(); @@ -523,8 +523,8 @@ void LabEngine::doScrollWipe(char *filename) { width = VGAScaleX(320); height = VGAScaleY(149) + SVGACord(2); - while (g_music->isSoundEffectActive()) { - g_music->updateMusic(); + while (_music->isSoundEffectActive()) { + _music->updateMusic(); g_lab->waitTOF(); } @@ -534,12 +534,12 @@ void LabEngine::doScrollWipe(char *filename) { IsBM = false; mem = RawDiffBM.Planes[0]; - g_music->updateMusic(); + _music->updateMusic(); by = VGAScaleX(3); nheight = height; while (onrow < headerdata.y) { - g_music->updateMusic(); + _music->updateMusic(); if ((by > nheight) && nheight) by = nheight; @@ -593,11 +593,11 @@ void LabEngine::doScrollBounce() { int height = VGAScaleY(149) + SVGACord(2); byte *mem = RawDiffBM.Planes[0]; - g_music->updateMusic(); + _music->updateMusic(); int startline = headerdata.y - height - 1; for (int i = 0; i < 5; i++) { - g_music->updateMusic(); + _music->updateMusic(); startline -= newby[i]; copyPage(width, height, 0, startline, mem); @@ -606,7 +606,7 @@ void LabEngine::doScrollBounce() { } for (int i = 8; i > 0; i--) { - g_music->updateMusic(); + _music->updateMusic(); startline += newby1[i - 1]; copyPage(width, height, 0, startline, mem); @@ -638,7 +638,7 @@ void LabEngine::doTransWipe(CloseDataPtr *CPtr, char *filename) { while (CurY < LastY) { if (linesdone >= lineslast) { - g_music->updateMusic(); + _music->updateMusic(); g_lab->waitTOF(); linesdone = 0; } @@ -656,7 +656,7 @@ void LabEngine::doTransWipe(CloseDataPtr *CPtr, char *filename) { while (CurY <= LastY) { if (linesdone >= lineslast) { - g_music->updateMusic(); + _music->updateMusic(); g_lab->waitTOF(); linesdone = 0; } @@ -691,7 +691,7 @@ void LabEngine::doTransWipe(CloseDataPtr *CPtr, char *filename) { while (CurY < LastY) { if (linesdone >= lineslast) { - g_music->updateMusic(); + _music->updateMusic(); g_lab->waitTOF(); linesdone = 0; } @@ -710,7 +710,7 @@ void LabEngine::doTransWipe(CloseDataPtr *CPtr, char *filename) { while (CurY <= LastY) { if (linesdone >= lineslast) { - g_music->updateMusic(); + _music->updateMusic(); g_lab->waitTOF(); linesdone = 0; } diff --git a/engines/lab/intro.cpp b/engines/lab/intro.cpp index eaf1aa928b..36137becf5 100644 --- a/engines/lab/intro.cpp +++ b/engines/lab/intro.cpp @@ -90,10 +90,10 @@ void Intro::doPictText(const char *filename, bool isscreen) { strcat(path, filename); if (isscreen) { - g_lab->g_music->updateMusic(); + g_lab->_music->updateMusic(); timedelay = 35; } else { - g_lab->g_music->updateMusic(); + g_lab->_music->updateMusic(); timedelay = 7; } @@ -105,7 +105,7 @@ void Intro::doPictText(const char *filename, bool isscreen) { if (begin) { begin = false; - tfile = g_lab->g_music->newOpen(path); + tfile = g_lab->_music->newOpen(path); if (!tfile) return; @@ -144,7 +144,7 @@ void Intro::doPictText(const char *filename, bool isscreen) { msg = g_lab->getMsg(); if (msg == NULL) { - g_lab->g_music->updateMusic(); + g_lab->_music->updateMusic(); g_lab->diffNextFrame(); g_lab->getTime(&secs, µs); g_lab->anyTimeDiff(lastsecs, lastmicros, secs, micros, &secs, µs); @@ -216,13 +216,13 @@ void Intro::doPictText(const char *filename, bool isscreen) { /* Does a one second delay, but checks the music while doing it. */ /*****************************************************************************/ void Intro::musicDelay() { - g_lab->g_music->updateMusic(); + g_lab->_music->updateMusic(); if (_quitIntro) return; for (uint16 i = 0; i < 20; i++) { - g_lab->g_music->updateMusic(); + g_lab->_music->updateMusic(); g_lab->waitTOF(); g_lab->waitTOF(); g_lab->waitTOF(); @@ -234,7 +234,7 @@ void Intro::musicDelay() { void Intro::nReadPict(const char *filename, bool playOnce) { Common::String finalFileName = Common::String("P:Intro/") + filename; - g_lab->g_music->updateMusic(); + g_lab->_music->updateMusic(); introEatMessages(); if (_quitIntro) @@ -277,7 +277,7 @@ void Intro::introSequence() { blackAllScreen(); - g_lab->g_music->initMusic(); + g_lab->_music->initMusic(); nopalchange = true; if (g_lab->getPlatform() != Common::kPlatformWindows) @@ -297,14 +297,14 @@ void Intro::introSequence() { (diffcmap[i * 3 + 2] >> 2); } - g_lab->g_music->updateMusic(); + g_lab->_music->updateMusic(); fade(true, 0); for (int times = 0; times < 150; times++) { if (_quitIntro) break; - g_lab->g_music->updateMusic(); + g_lab->_music->updateMusic(); uint16 temp = palette[2]; for (uint16 i = 2; i < 15; i++) @@ -319,7 +319,7 @@ void Intro::introSequence() { fade(false, 0); blackAllScreen(); - g_lab->g_music->updateMusic(); + g_lab->_music->updateMusic(); nReadPict("Title.A", true); nReadPict("AB", true); @@ -341,11 +341,11 @@ void Intro::introSequence() { nReadPict("DA", true); musicDelay(); - g_lab->g_music->newOpen("p:Intro/Intro.1"); /* load the picture into the buffer */ + g_lab->_music->newOpen("p:Intro/Intro.1"); /* load the picture into the buffer */ - g_lab->g_music->updateMusic(); + g_lab->_music->updateMusic(); blackAllScreen(); - g_lab->g_music->updateMusic(); + g_lab->_music->updateMusic(); _msgfont = g_lab->_resource->getFont("P:Map.fon"); @@ -366,7 +366,7 @@ void Intro::introSequence() { freeAllStolenMem(); blackAllScreen(); - g_lab->g_music->updateMusic(); + g_lab->_music->updateMusic(); _introDoBlack = true; nReadPict("Station1", true); @@ -398,7 +398,7 @@ void Intro::introSequence() { for (uint16 idx = (8 * 3); idx < (255 * 3); idx++) diffcmap[idx] = 255 - diffcmap[idx]; - g_lab->g_music->updateMusic(); + g_lab->_music->updateMusic(); g_lab->waitTOF(); g_lab->VGASetPal(diffcmap, 256); g_lab-> waitTOF(); diff --git a/engines/lab/lab.cpp b/engines/lab/lab.cpp index 745bb74f94..9ad51fd4a7 100644 --- a/engines/lab/lab.cpp +++ b/engines/lab/lab.cpp @@ -76,7 +76,7 @@ LabEngine::LabEngine(OSystem *syst, const ADGameDescription *gameDesc) _event = nullptr; _resource = nullptr; - g_music = nullptr; + _music = nullptr; //const Common::FSNode gameDataDir(ConfMan.get("path")); //SearchMan.addSubDirectoryMatching(gameDataDir, "game"); @@ -91,6 +91,7 @@ LabEngine::~LabEngine() { delete _event; delete _resource; + delete _music; } Common::Error LabEngine::run() { @@ -101,7 +102,7 @@ Common::Error LabEngine::run() { _event = new EventManager(this); _resource = new Resource(this); - g_music = new Music(this); + _music = new Music(this); if (getPlatform() == Common::kPlatformWindows) { // Check if this is the Wyrmkeep trial diff --git a/engines/lab/lab.h b/engines/lab/lab.h index dd0c204dbc..e7c230368f 100644 --- a/engines/lab/lab.h +++ b/engines/lab/lab.h @@ -101,7 +101,7 @@ private: public: EventManager *_event; Resource *_resource; - Music *g_music; + Music *_music; byte *_currentDsplayBuffer; Common::Point _mousePos; diff --git a/engines/lab/map.cpp b/engines/lab/map.cpp index 6c2201608e..ac612fb881 100644 --- a/engines/lab/map.cpp +++ b/engines/lab/map.cpp @@ -84,9 +84,9 @@ char *getText(const char *filename) { bool dodecrypt; byte **tfile; - g_lab->g_music->updateMusic(); + g_lab->_music->updateMusic(); dodecrypt = (isBuffered(filename) == NULL); - tfile = g_lab->g_music->newOpen(filename); + tfile = g_lab->_music->newOpen(filename); if (!tfile) return NULL; @@ -200,7 +200,7 @@ static bool loadMapData() { BigMsgFont = MsgFont; resetBuffer(); /* Make images load into start of buffer */ - buffer = g_lab->g_music->newOpen("P:MapImage", Size); + buffer = g_lab->_music->newOpen("P:MapImage", Size); if (!buffer) return false; @@ -252,9 +252,9 @@ static bool loadMapData() { Common::File *mapFile = g_lab->_resource->openDataFile("Lab:Maps", MKTAG('M', 'A', 'P', '0')); if (!mapFile) error("Corrupt map file"); - g_lab->g_music->updateMusic(); - if (!g_lab->g_music->_doNotFilestopSoundEffect) - g_lab->g_music->stopSoundEffect(); + g_lab->_music->updateMusic(); + if (!g_lab->_music->_doNotFilestopSoundEffect) + g_lab->_music->stopSoundEffect(); MaxRooms = mapFile->readUint16LE(); Maps = new MapData[MaxRooms]; // will be freed when the user exits the map @@ -309,7 +309,7 @@ void fade(bool fadein, uint16 res) { setAmigaPal(newpal, 16); g_lab->waitTOF(); - g_lab->g_music->updateMusic(); + g_lab->_music->updateMusic(); } } @@ -572,7 +572,7 @@ void LabEngine::drawMap(uint16 CurRoom, uint16 CurMsg, uint16 Floor, bool fadeou for (uint16 i = 1; i <= MaxRooms; i++) { if ((Maps[i].PageNumber == Floor) && _roomsFound->in(i) && Maps[i].x) { drawRoom(i, (bool)(i == CurRoom)); - g_music->updateMusic(); + _music->updateMusic(); } } @@ -669,11 +669,11 @@ void LabEngine::processMap(uint16 CurRoom) { CurFloor = Maps[CurRoom].PageNumber; while (1) { - g_music->updateMusic(); /* Make sure we check the music at least after every message */ + _music->updateMusic(); /* Make sure we check the music at least after every message */ Msg = getMsg(); if (Msg == NULL) { - g_music->updateMusic(); + _music->updateMusic(); if (place <= 14) { newcolor[0] = 14 << 2; @@ -833,7 +833,7 @@ void LabEngine::processMap(uint16 CurRoom) { void LabEngine::doMap(uint16 CurRoom) { FadePalette = AmigaMapPalette; - g_music->updateMusic(); + _music->updateMusic(); loadMapData(); blackAllScreen(); diff --git a/engines/lab/processroom.cpp b/engines/lab/processroom.cpp index 2939d8af5d..bc62aacaf9 100644 --- a/engines/lab/processroom.cpp +++ b/engines/lab/processroom.cpp @@ -333,26 +333,26 @@ static void doActions(Action * APtr, CloseDataPtr *LCPtr) { uint32 StartSecs, StartMicros, CurSecs, CurMicros; while (APtr) { - g_lab->g_music->updateMusic(); + g_lab->_music->updateMusic(); switch (APtr->ActionType) { case PLAYSOUND: - g_lab->g_music->_loopSoundEffect = false; - g_lab->g_music->_waitTillFinished = true; + g_lab->_music->_loopSoundEffect = false; + g_lab->_music->_waitTillFinished = true; readMusic((char *)APtr->Data, true); - g_lab->g_music->_waitTillFinished = false; + g_lab->_music->_waitTillFinished = false; break; case PLAYSOUNDB: - g_lab->g_music->_loopSoundEffect = false; - g_lab->g_music->_waitTillFinished = false; + g_lab->_music->_loopSoundEffect = false; + g_lab->_music->_waitTillFinished = false; readMusic((char *)APtr->Data, false); break; case PLAYSOUNDCONT: - g_lab->g_music->_doNotFilestopSoundEffect = true; - g_lab->g_music->_loopSoundEffect = true; - readMusic((char *)APtr->Data, g_lab->g_music->_waitTillFinished); + g_lab->_music->_doNotFilestopSoundEffect = true; + g_lab->_music->_loopSoundEffect = true; + readMusic((char *)APtr->Data, g_lab->_music->_waitTillFinished); break; case SHOWDIFF: @@ -370,7 +370,7 @@ static void doActions(Action * APtr, CloseDataPtr *LCPtr) { } if (APtr->Data) - g_lab->g_music->newOpen((char *)APtr->Data); /* Puts a file into memory */ + g_lab->_music->newOpen((char *)APtr->Data); /* Puts a file into memory */ break; @@ -485,7 +485,7 @@ static void doActions(Action * APtr, CloseDataPtr *LCPtr) { g_lab->WSDL_UpdateScreen(); while (1) { - g_lab->g_music->updateMusic(); + g_lab->_music->updateMusic(); g_lab->diffNextFrame(); g_lab->getTime(&CurSecs, &CurMicros); @@ -497,30 +497,30 @@ static void doActions(Action * APtr, CloseDataPtr *LCPtr) { break; case STOPMUSIC: - g_lab->g_music->setMusic(false); + g_lab->_music->setMusic(false); break; case STARTMUSIC: - g_lab->g_music->setMusic(true); + g_lab->_music->setMusic(true); break; case CHANGEMUSIC: - g_lab->g_music->changeMusic((const char *)APtr->Data); - g_lab->g_music->setMusicReset(false); + g_lab->_music->changeMusic((const char *)APtr->Data); + g_lab->_music->setMusicReset(false); break; case RESETMUSIC: - g_lab->g_music->resetMusic(); - g_lab->g_music->setMusicReset(true); + g_lab->_music->resetMusic(); + g_lab->_music->setMusicReset(true); break; case FILLMUSIC: - g_lab->g_music->updateMusic(); + g_lab->_music->updateMusic(); break; case WAITSOUND: - while (g_lab->g_music->isSoundEffectActive()) { - g_lab->g_music->updateMusic(); + while (g_lab->_music->isSoundEffectActive()) { + g_lab->_music->updateMusic(); g_lab->diffNextFrame(); g_lab->waitTOF(); } @@ -528,18 +528,18 @@ static void doActions(Action * APtr, CloseDataPtr *LCPtr) { break; case CLEARSOUND: - if (g_lab->g_music->_loopSoundEffect) { - g_lab->g_music->_loopSoundEffect = false; - g_lab->g_music->stopSoundEffect(); - } else if (g_lab->g_music->isSoundEffectActive()) - g_lab->g_music->stopSoundEffect(); + if (g_lab->_music->_loopSoundEffect) { + g_lab->_music->_loopSoundEffect = false; + g_lab->_music->stopSoundEffect(); + } else if (g_lab->_music->isSoundEffectActive()) + g_lab->_music->stopSoundEffect(); break; case WINMUSIC: - g_lab->g_music->_winmusic = true; - g_lab->g_music->freeMusic(); - g_lab->g_music->initMusic(); + g_lab->_music->_winmusic = true; + g_lab->_music->freeMusic(); + g_lab->_music->initMusic(); break; case WINGAME: @@ -590,18 +590,18 @@ static void doActions(Action * APtr, CloseDataPtr *LCPtr) { APtr = APtr->NextAction; } - if (g_lab->g_music->_loopSoundEffect) { - g_lab->g_music->_loopSoundEffect = false; - g_lab->g_music->stopSoundEffect(); + if (g_lab->_music->_loopSoundEffect) { + g_lab->_music->_loopSoundEffect = false; + g_lab->_music->stopSoundEffect(); } else { - while (g_lab->g_music->isSoundEffectActive()) { - g_lab->g_music->updateMusic(); + while (g_lab->_music->isSoundEffectActive()) { + g_lab->_music->updateMusic(); g_lab->diffNextFrame(); g_lab->waitTOF(); } } - g_lab->g_music->_doNotFilestopSoundEffect = false; + g_lab->_music->_doNotFilestopSoundEffect = false; } /*****************************************************************************/ diff --git a/engines/lab/readdiff.cpp b/engines/lab/readdiff.cpp index 88b4c1805d..926ef359f9 100644 --- a/engines/lab/readdiff.cpp +++ b/engines/lab/readdiff.cpp @@ -166,7 +166,7 @@ void LabEngine::diffNextFrame() { return; /* done with the next frame. */ } - g_music->updateMusic(); + _music->updateMusic(); readBlock(&header, 4L, difffile); swapULong(&header); readBlock(&size, 4L, difffile); @@ -227,8 +227,8 @@ void LabEngine::diffNextFrame() { case 30L: case 31L: { if (waitForEffect) { - while (g_music->isSoundEffectActive()) { - g_music->updateMusic(); + while (_music->isSoundEffectActive()) { + _music->updateMusic(); waitTOF(); } } @@ -245,7 +245,7 @@ void LabEngine::diffNextFrame() { uint32 musicsize = size; (*difffile) += size; - g_music->playSoundEffect(samplespeed, musicsize, music); + _music->playSoundEffect(samplespeed, musicsize, music); break; } case 65535L: @@ -253,8 +253,8 @@ void LabEngine::diffNextFrame() { int didTOF = 0; if (waitForEffect) { - while (g_music->isSoundEffectActive()) { - g_music->updateMusic(); + while (_music->isSoundEffectActive()) { + _music->updateMusic(); waitTOF(); if (DispBitMap->Flags & BITMAPF_VIDEO) @@ -393,7 +393,7 @@ void stopDiff() { void stopDiffEnd() { if (IsPlaying) { while (IsPlaying) { - g_lab->g_music->updateMusic(); + g_lab->_music->updateMusic(); g_lab->diffNextFrame(); } } @@ -431,14 +431,14 @@ void readSound(bool waitTillFinished, Common::File *file) { return; while (soundTag != 65535) { - g_lab->g_music->updateMusic(); + g_lab->_music->updateMusic(); soundTag = file->readUint32LE(); soundSize = file->readUint32LE() - 8; if ((soundTag == 30) || (soundTag == 31)) { if (waitTillFinished) { - while (g_lab->g_music->isSoundEffectActive()) { - g_lab->g_music->updateMusic(); + while (g_lab->_music->isSoundEffectActive()) { + g_lab->_music->updateMusic(); g_lab->waitTOF(); } } @@ -449,11 +449,11 @@ void readSound(bool waitTillFinished, Common::File *file) { file->skip(2); byte *soundData = (byte *)malloc(soundSize); file->read(soundData, soundSize); - g_lab->g_music->playSoundEffect(sampleRate, soundSize, soundData); + g_lab->_music->playSoundEffect(sampleRate, soundSize, soundData); } else if (soundTag == 65535L) { if (waitTillFinished) { - while (g_lab->g_music->isSoundEffectActive()) { - g_lab->g_music->updateMusic(); + while (g_lab->_music->isSoundEffectActive()) { + g_lab->_music->updateMusic(); g_lab->waitTOF(); } } diff --git a/engines/lab/resource.cpp b/engines/lab/resource.cpp index 1e0ac6bbe9..290216c5e8 100644 --- a/engines/lab/resource.cpp +++ b/engines/lab/resource.cpp @@ -65,7 +65,7 @@ TextFont *Resource::getFont(const char *fileName) { if (fileSize <= headerSize) return NULL; - _vm->g_music->updateMusic(); + _vm->_music->updateMusic(); TextFont *textfont = (TextFont *)malloc(sizeof(TextFont)); textfont->DataLength = fileSize - headerSize; @@ -142,7 +142,7 @@ bool Resource::readViews(uint16 roomNum) { _rooms[roomNum]._westView = readView(dataFile); _rooms[roomNum]._rules = readRule(dataFile); - _vm->g_music->updateMusic(); + _vm->_music->updateMusic(); delete dataFile; return true; diff --git a/engines/lab/special.cpp b/engines/lab/special.cpp index 417f854b84..7519ad1988 100644 --- a/engines/lab/special.cpp +++ b/engines/lab/special.cpp @@ -153,7 +153,7 @@ void showCombination(const char *filename) { blackScreen(); - buffer = g_lab->g_music->newOpen("P:Numbers"); + buffer = g_lab->_music->newOpen("P:Numbers"); for (uint16 CurBit = 0; CurBit < 10; CurBit++) readImage(buffer, &(Images[CurBit])); @@ -297,10 +297,10 @@ void showTile(const char *filename, bool showsolution) { if (showsolution) { start = 0; - buffer = g_lab->g_music->newOpen("P:TileSolution"); + buffer = g_lab->_music->newOpen("P:TileSolution"); } else { start = 1; - buffer = g_lab->g_music->newOpen("P:Tile"); + buffer = g_lab->_music->newOpen("P:Tile"); } if (!buffer) @@ -553,7 +553,7 @@ static bool loadJournalData() { return false; } - g_lab->g_music->updateMusic(); + g_lab->_music->updateMusic(); strcpy(filename, "Lab:Rooms/j0"); bridge = g_lab->_conditions->in(BRIDGE0) || g_lab->_conditions->in(BRIDGE1); @@ -586,7 +586,7 @@ static bool loadJournalData() { if ((journaltexttitle = getText("Lab:Rooms/jt")) == NULL) return false; - buffer = g_lab->g_music->newOpen("P:JImage"); + buffer = g_lab->_music->newOpen("P:JImage"); if (!buffer) return false; @@ -628,7 +628,7 @@ static void drawJournalText() { char *CurText = journaltext; while (DrawingToPage < JPage) { - g_lab->g_music->updateMusic(); + g_lab->_music->updateMusic(); CurText = (char *)(journaltext + CharsDrawn); CharsDrawn += flowText(BigMsgFont, -2, 2, 0, false, false, false, false, VGAScaleX(52), VGAScaleY(32), VGAScaleX(152), VGAScaleY(148), CurText); @@ -648,7 +648,7 @@ static void drawJournalText() { CharsDrawn += flowTextToMem(&JBackImage, BigMsgFont, -2, 2, 0, false, false, false, true, VGAScaleX(52), VGAScaleY(32), VGAScaleX(152), VGAScaleY(148), CurText); } - g_lab->g_music->updateMusic(); + g_lab->_music->updateMusic(); CurText = (char *)(journaltext + CharsDrawn); lastpage = (*CurText == 0); flowTextToMem(&JBackImage, BigMsgFont, -2, 2, 0, false, false, false, true, VGAScaleX(171), VGAScaleY(32), VGAScaleX(271), VGAScaleY(148), CurText); @@ -663,14 +663,14 @@ static void drawJournalText() { static void turnPage(bool FromLeft) { if (FromLeft) { for (int i = 0; i < g_lab->_screenWidth; i += 8) { - g_lab->g_music->updateMusic(); + g_lab->_music->updateMusic(); g_lab->waitTOF(); ScreenImage.ImageData = g_lab->getVGABaseAddr(); g_lab->bltBitMap(&JBackImage, i, 0, &ScreenImage, i, 0, 8, g_lab->_screenHeight); } } else { for (int i = (g_lab->_screenWidth - 8); i > 0; i -= 8) { - g_lab->g_music->updateMusic(); + g_lab->_music->updateMusic(); g_lab->waitTOF(); ScreenImage.ImageData = g_lab->getVGABaseAddr(); g_lab->bltBitMap(&JBackImage, i, 0, &ScreenImage, i, 0, 8, g_lab->_screenHeight); @@ -685,7 +685,7 @@ static void turnPage(bool FromLeft) { void LabEngine::drawJournal(uint16 wipenum, bool needFade) { _event->mouseHide(); - g_music->updateMusic(); + _music->updateMusic(); if (!GotBackImage) JBackImage.ImageData = loadBackPict("P:Journal.pic", true); @@ -732,11 +732,11 @@ void LabEngine::processJournal() { uint16 Qualifier, GadID; while (1) { - g_music->updateMusic(); /* Make sure we check the music at least after every message */ + _music->updateMusic(); /* Make sure we check the music at least after every message */ Msg = getMsg(); if (Msg == NULL) { - g_music->updateMusic(); + _music->updateMusic(); } else { Class = Msg->msgClass; Qualifier = Msg->qualifier; @@ -785,7 +785,7 @@ void LabEngine::doJournal() { ScreenImage = JBackImage; ScreenImage.ImageData = getVGABaseAddr(); - g_music->updateMusic(); + _music->updateMusic(); loadJournalData(); drawJournal(0, true); @@ -837,7 +837,7 @@ bool saveRestoreGame() { if (slot >= 0) { isOK = loadGame(&RoomNum, &Direction, &(Inventory[QUARTERNUM].Many), slot); if (isOK) - g_lab->g_music->resetMusic(); + g_lab->_music->resetMusic(); } } @@ -855,7 +855,7 @@ static void getMonImages() { resetBuffer(); - buffer = g_lab->g_music->newOpen("P:MonImage", bufferSize); + buffer = g_lab->_music->newOpen("P:MonImage", bufferSize); if (!buffer) return; @@ -906,7 +906,7 @@ void LabEngine::drawMonText(char *text, uint16 x1, uint16 y1, uint16 x2, uint16 } while (DrawingToPage < monitorPage) { - g_music->updateMusic(); + _music->updateMusic(); CurText = (char *)(text + CharsDrawn); CharsDrawn += flowText(BigMsgFont, yspacing, 0, 0, false, false, false, false, x1, y1, x2, y2, CurText); lastpage = (*CurText == 0); @@ -960,11 +960,11 @@ void LabEngine::processMonitor(char *ntext, bool isinteractive, uint16 x1, uint1 } } - g_music->updateMusic(); /* Make sure we check the music at least after every message */ + _music->updateMusic(); /* Make sure we check the music at least after every message */ Msg = getMsg(); if (Msg == NULL) { - g_music->updateMusic(); + _music->updateMusic(); } else { Class = Msg->msgClass; Qualifier = Msg->qualifier; -- cgit v1.2.3 From 6cee2eb2be4e6977d659a47809a91454532c0f11 Mon Sep 17 00:00:00 2001 From: Strangerke Date: Mon, 30 Nov 2015 01:42:12 +0100 Subject: LAB: Move RoomNum to main engine class --- engines/lab/engine.cpp | 38 +++++++++++++++++++------------------- engines/lab/lab.cpp | 2 ++ engines/lab/lab.h | 1 + engines/lab/labfun.h | 4 ++-- engines/lab/labmusic.cpp | 34 ++++++++++++++++------------------ engines/lab/map.cpp | 1 - engines/lab/processroom.cpp | 42 +++++++++++++++++++++--------------------- engines/lab/savegame.cpp | 8 ++++---- engines/lab/special.cpp | 6 +++--- engines/lab/text.cpp | 2 +- 10 files changed, 69 insertions(+), 69 deletions(-) diff --git a/engines/lab/engine.cpp b/engines/lab/engine.cpp index 5de7e8f4e0..50b404a62d 100644 --- a/engines/lab/engine.cpp +++ b/engines/lab/engine.cpp @@ -53,7 +53,7 @@ extern bool DoBlack, waitForEffect, stopsound, DoNotDrawMessage, nopalchange; extern RoomData *_rooms; extern InventoryData *Inventory; -extern uint16 NumInv, RoomNum, ManyRooms, HighestCondition, Direction; +extern uint16 NumInv, ManyRooms, HighestCondition, Direction; CloseDataPtr CPtr; CrumbData BreadCrumbs[MAX_CRUMBS]; @@ -528,7 +528,7 @@ bool LabEngine::doUse(uint16 CurInv) { stopDiff(); CurFileName = " "; CPtr = NULL; - doMap(RoomNum); + doMap(_roomNum); VGASetPal(initcolors, 8); drawMessage(NULL); drawPanel(); @@ -647,7 +647,7 @@ void LabEngine::mainGameLoop() { VGASetPal(initcolors, 8); CPtr = NULL; - RoomNum = 1; + _roomNum = 1; Direction = NORTH; _resource->readRoomData("LAB:Doors"); @@ -693,7 +693,7 @@ void LabEngine::mainGameLoop() { Test = getPictName(&CPtr); if (noupdatediff) { - _roomsFound->inclElement(RoomNum); /* Potentially entered another room */ + _roomsFound->inclElement(_roomNum); /* Potentially entered another room */ ForceDraw = (strcmp(Test, CurFileName) != 0) || ForceDraw; noupdatediff = false; @@ -702,7 +702,7 @@ void LabEngine::mainGameLoop() { else if (strcmp(Test, CurFileName) != 0) { interfaceOff(); - _roomsFound->inclElement(RoomNum); /* Potentially entered another room */ + _roomsFound->inclElement(_roomNum); /* Potentially entered another room */ CurFileName = Test; if (CPtr) { @@ -965,18 +965,18 @@ from_crumbs: mayShowCrumbIndicator(); WSDL_UpdateScreen(); } else if (GadID == 7) { - OldRoomNum = RoomNum; + OldRoomNum = _roomNum; if (doGoForward(&CPtr)) { - if (OldRoomNum == RoomNum) + if (OldRoomNum == _roomNum) DoBlack = true; } else { DoBlack = true; processArrow(&Direction, GadID - 6); - if (OldRoomNum != RoomNum) { + if (OldRoomNum != _roomNum) { drawStaticMessage(kTextGoForward); - _roomsFound->inclElement(RoomNum); /* Potentially entered a new room */ + _roomsFound->inclElement(_roomNum); /* Potentially entered a new room */ CurFileName = " "; ForceDraw = true; } else { @@ -991,15 +991,15 @@ from_crumbs: FollowingCrumbs = false; } } else { - if (RoomNum == OldRoomNum) { // didn't get there? + if (_roomNum == OldRoomNum) { // didn't get there? FollowingCrumbs = false; } } - } else if (DroppingCrumbs && OldRoomNum != RoomNum) { + } else if (DroppingCrumbs && OldRoomNum != _roomNum) { // If in surreal maze, turn off DroppingCrumbs. // Note: These numbers were generated by parsing the // "Maps" file, which is why they are hard-coded. Bleh! - if (RoomNum >= 245 && RoomNum <= 280) { + if (_roomNum >= 245 && _roomNum <= 280) { FollowingCrumbs = false; DroppingCrumbs = false; NumCrumbs = 0; @@ -1007,7 +1007,7 @@ from_crumbs: } else { bool intersect = false; for (int idx = 0; idx < NumCrumbs; idx++) { - if (BreadCrumbs[idx].RoomNum == RoomNum) { + if (BreadCrumbs[idx].RoomNum == _roomNum) { NumCrumbs = idx + 1; BreadCrumbs[NumCrumbs].RoomNum = 0; intersect = true; @@ -1020,7 +1020,7 @@ from_crumbs: memcpy(&BreadCrumbs[0], &BreadCrumbs[1], NumCrumbs * sizeof BreadCrumbs[0]); } - BreadCrumbs[NumCrumbs].RoomNum = RoomNum; + BreadCrumbs[NumCrumbs].RoomNum = _roomNum; BreadCrumbs[NumCrumbs++].Direction = Direction; } } @@ -1175,11 +1175,11 @@ from_crumbs: eatMessages(); if (ActionMode == 0) { /* Take something. */ - if (doActionRule(Common::Point(curPos.x, curPos.y), ActionMode, RoomNum, &CPtr)) + if (doActionRule(Common::Point(curPos.x, curPos.y), ActionMode, _roomNum, &CPtr)) CurFileName = NewFileName; else if (takeItem(curPos.x, curPos.y, &CPtr)) drawStaticMessage(kTextTakeItem); - else if (doActionRule(curPos, TAKEDEF - 1, RoomNum, &CPtr)) + else if (doActionRule(curPos, TAKEDEF - 1, _roomNum, &CPtr)) CurFileName = NewFileName; else if (doActionRule(curPos, TAKE - 1, 0, &CPtr)) CurFileName = NewFileName; @@ -1188,7 +1188,7 @@ from_crumbs: } else if ((ActionMode == 1) /* Manipulate an object */ || (ActionMode == 2) /* Open up a "door" */ || (ActionMode == 3)) { /* Close a "door" */ - if (doActionRule(curPos, ActionMode, RoomNum, &CPtr)) + if (doActionRule(curPos, ActionMode, _roomNum, &CPtr)) CurFileName = NewFileName; else if (!doActionRule(curPos, ActionMode, 0, &CPtr)) { if (curPos.y < (VGAScaleY(149) + SVGACord(2))) @@ -1224,7 +1224,7 @@ from_crumbs: mayShowCrumbIndicator(); WSDL_UpdateScreen(); } else if (Class == DELTAMOVE) { - VPtr = getViewData(RoomNum, Direction); + VPtr = getViewData(_roomNum, Direction); OldCPtr = VPtr->closeUps; if (HCPtr == NULL) { @@ -1400,7 +1400,7 @@ int followCrumbs() { BreadCrumbs[NumCrumbs--].RoomNum = 0; // Is the current crumb this room? If not, logic error. - if (RoomNum != BreadCrumbs[NumCrumbs].RoomNum) { + if (g_lab->_roomNum != BreadCrumbs[NumCrumbs].RoomNum) { NumCrumbs = 0; BreadCrumbs[0].RoomNum = 0; DroppingCrumbs = false; diff --git a/engines/lab/lab.cpp b/engines/lab/lab.cpp index 9ad51fd4a7..6d7ed00b4c 100644 --- a/engines/lab/lab.cpp +++ b/engines/lab/lab.cpp @@ -73,11 +73,13 @@ LabEngine::LabEngine(OSystem *syst, const ADGameDescription *gameDesc) _nextKeyOut = 0; _isHiRes = false; + _roomNum = -1; _event = nullptr; _resource = nullptr; _music = nullptr; + //const Common::FSNode gameDataDir(ConfMan.get("path")); //SearchMan.addSubDirectoryMatching(gameDataDir, "game"); //SearchMan.addSubDirectoryMatching(gameDataDir, "game/pict"); diff --git a/engines/lab/lab.h b/engines/lab/lab.h index e7c230368f..3c621137a9 100644 --- a/engines/lab/lab.h +++ b/engines/lab/lab.h @@ -103,6 +103,7 @@ public: Resource *_resource; Music *_music; + int _roomNum; byte *_currentDsplayBuffer; Common::Point _mousePos; diff --git a/engines/lab/labfun.h b/engines/lab/labfun.h index 57d5817c71..d20db110a0 100644 --- a/engines/lab/labfun.h +++ b/engines/lab/labfun.h @@ -256,8 +256,8 @@ bool saveRestoreGame(); /*----- From saveGame.c ----*/ /*--------------------------*/ -bool saveGame(uint16 RoomNum, uint16 Direction, uint16 Quarters, int slot, Common::String desc); -bool loadGame(uint16 *RoomNum, uint16 *Direction, uint16 *Quarters, int slot); +bool saveGame(uint16 Direction, uint16 Quarters, int slot, Common::String desc); +bool loadGame(uint16 *Direction, uint16 *Quarters, int slot); bool readSaveGameHeader(Common::InSaveFile *in, SaveGameHeader &header); /*--------------------------*/ diff --git a/engines/lab/labmusic.cpp b/engines/lab/labmusic.cpp index 843a866e26..3f8017d011 100644 --- a/engines/lab/labmusic.cpp +++ b/engines/lab/labmusic.cpp @@ -43,8 +43,6 @@ namespace Lab { #define CLOWNROOM 123 #define DIMROOM 80 -extern uint16 RoomNum; // TODO: Move into a class - Music::Music(LabEngine *vm) : _vm(vm) { _file = 0; _tFile = 0; @@ -70,9 +68,9 @@ Music::Music(LabEngine *vm) : _vm(vm) { /* it from the Audio device. */ /*****************************************************************************/ void Music::updateMusic() { - g_lab->WSDL_ProcessInput(0); + _vm->WSDL_ProcessInput(0); - g_lab->_event->updateMouse(); + _vm->_event->updateMouse(); if (_musicOn && getPlayingBufferCount() < MAXBUFFERS) { // NOTE: We need to use malloc(), cause this will be freed with free() @@ -89,7 +87,7 @@ void Music::updateMusic() { } byte soundFlags = Audio::FLAG_LITTLE_ENDIAN; - if (g_lab->getPlatform() == Common::kPlatformWindows) + if (_vm->getPlatform() == Common::kPlatformWindows) soundFlags |= Audio::FLAG_16BITS; else soundFlags |= Audio::FLAG_UNSIGNED; @@ -97,7 +95,7 @@ void Music::updateMusic() { _queuingAudioStream->queueBuffer(musicBuffer, MUSICBUFSIZE, DisposeAfterUse::YES, soundFlags); if (startMusic) - g_lab->_mixer->playStream(Audio::Mixer::kMusicSoundType, &_musicHandle, _queuingAudioStream); + _vm->_mixer->playStream(Audio::Mixer::kMusicSoundType, &_musicHandle, _queuingAudioStream); } } @@ -113,7 +111,7 @@ void Music::playSoundEffect(uint16 SampleSpeed, uint32 Length, void *Data) { SampleSpeed = 4000; byte soundFlags = Audio::FLAG_LITTLE_ENDIAN; - if (g_lab->getPlatform() == Common::kPlatformWindows) + if (_vm->getPlatform() == Common::kPlatformWindows) soundFlags |= Audio::FLAG_16BITS; else soundFlags |= Audio::FLAG_UNSIGNED; @@ -121,16 +119,16 @@ void Music::playSoundEffect(uint16 SampleSpeed, uint32 Length, void *Data) { Audio::SeekableAudioStream *audioStream = Audio::makeRawStream((const byte *)Data, Length, SampleSpeed, soundFlags, DisposeAfterUse::NO); uint loops = (_loopSoundEffect) ? 0 : 1; Audio::LoopingAudioStream *loopingAudioStream = new Audio::LoopingAudioStream(audioStream, loops); - g_lab->_mixer->playStream(Audio::Mixer::kSFXSoundType, &_sfxHandle, loopingAudioStream); + _vm->_mixer->playStream(Audio::Mixer::kSFXSoundType, &_sfxHandle, loopingAudioStream); } void Music::stopSoundEffect() { if (isSoundEffectActive()) - g_lab->_mixer->stopHandle(_sfxHandle); + _vm->_mixer->stopHandle(_sfxHandle); } bool Music::isSoundEffectActive() const { - return g_lab->_mixer->isSoundHandleActive(_sfxHandle); + return _vm->_mixer->isSoundHandleActive(_sfxHandle); } void Music::fillbuffer(byte *musicBuffer) { @@ -196,10 +194,10 @@ bool Music::initMusic() { void Music::freeMusic() { _musicOn = false; - g_lab->_mixer->stopHandle(_musicHandle); + _vm->_mixer->stopHandle(_musicHandle); _queuingAudioStream = NULL; - g_lab->_mixer->stopHandle(_sfxHandle); + _vm->_mixer->stopHandle(_sfxHandle); delete _file; _file = NULL; @@ -214,7 +212,7 @@ void Music::pauseBackMusic() { _musicOn = false; stopSoundEffect(); - g_lab->_mixer->pauseHandle(_musicHandle, true); + _vm->_mixer->pauseHandle(_musicHandle, true); _musicPaused = true; } @@ -228,7 +226,7 @@ void Music::resumeBackMusic() { stopSoundEffect(); _musicOn = true; - g_lab->_mixer->pauseHandle(_musicHandle, false); + _vm->_mixer->pauseHandle(_musicHandle, false); updateMusic(); _musicPaused = false; @@ -255,17 +253,17 @@ void Music::setMusic(bool on) { /* Checks the music that should be playing in a particular room. */ /******************************************************************************/ void Music::checkRoomMusic() { - if ((_lastMusicRoom == RoomNum) || !_musicOn) + if ((_lastMusicRoom == _vm->_roomNum) || !_musicOn) return; - if (RoomNum == CLOWNROOM) + if (_vm->_roomNum == CLOWNROOM) changeMusic("Music:Laugh"); - else if (RoomNum == DIMROOM) + else if (_vm->_roomNum == DIMROOM) changeMusic("Music:Rm81"); else if (_doReset) resetMusic(); - _lastMusicRoom = RoomNum; + _lastMusicRoom = _vm->_roomNum; } /*****************************************************************************/ diff --git a/engines/lab/map.cpp b/engines/lab/map.cpp index ac612fb881..859d1ffa2f 100644 --- a/engines/lab/map.cpp +++ b/engines/lab/map.cpp @@ -49,7 +49,6 @@ static TextFont bmf; extern uint16 Direction; extern CloseDataPtr CPtr; -extern uint16 RoomNum; /*****************************************************************************/ /* Converts an Amiga palette (up to 16 colors) to a VGA palette, then sets */ diff --git a/engines/lab/processroom.cpp b/engines/lab/processroom.cpp index bc62aacaf9..8453fe65bb 100644 --- a/engines/lab/processroom.cpp +++ b/engines/lab/processroom.cpp @@ -47,7 +47,7 @@ namespace Lab { RoomData *_rooms; InventoryData *Inventory; -uint16 NumInv, RoomNum, ManyRooms, HighestCondition, Direction; +uint16 NumInv, ManyRooms, HighestCondition, Direction; const char *NewFileName; extern bool DoNotDrawMessage, IsBM, noupdatediff, QuitLab, MusicOn, DoBlack, LongWinInFront; @@ -124,7 +124,7 @@ static CloseData *getObject(uint16 x, uint16 y, CloseDataPtr LCPtr) { ViewData *VPtr; if (LCPtr == NULL) { - VPtr = getViewData(RoomNum, Direction); + VPtr = getViewData(g_lab->_roomNum, Direction); LCPtr = VPtr->closeUps; } @@ -173,7 +173,7 @@ static CloseDataPtr findCPtrMatch(CloseDataPtr Main, CloseDataPtr List) { /* Returns the current picture name. */ /*****************************************************************************/ char *getPictName(CloseDataPtr *LCPtr) { - ViewData *ViewPtr = getViewData(RoomNum, Direction); + ViewData *ViewPtr = getViewData(g_lab->_roomNum, Direction); if (*LCPtr != NULL) { *LCPtr = findCPtrMatch(*LCPtr, ViewPtr->closeUps); @@ -196,8 +196,8 @@ void LabEngine::drawDirection(CloseDataPtr LCPtr) { Common::String message; - if (_rooms[RoomNum]._roomMsg) { - message += _rooms[RoomNum]._roomMsg; + if (_rooms[_roomNum]._roomMsg) { + message += _rooms[_roomNum]._roomMsg; message += ", "; } @@ -221,18 +221,18 @@ bool processArrow(uint16 *direction, uint16 Arrow) { if (Arrow == 1) { /* Forward */ if (*direction == NORTH) - room = _rooms[RoomNum]._northDoor; + room = _rooms[g_lab->_roomNum]._northDoor; else if (*direction == SOUTH) - room = _rooms[RoomNum]._southDoor; + room = _rooms[g_lab->_roomNum]._southDoor; else if (*direction == EAST) - room = _rooms[RoomNum]._eastDoor; + room = _rooms[g_lab->_roomNum]._eastDoor; else if (*direction == WEST) - room = _rooms[RoomNum]._westDoor; + room = _rooms[g_lab->_roomNum]._westDoor; if (room == 0) return false; else - RoomNum = room; + g_lab->_roomNum = room; } else if (Arrow == 0) { /* Left */ if (*direction == NORTH) *direction = WEST; @@ -265,7 +265,7 @@ void setCurClose(Common::Point pos, CloseDataPtr *cptr, bool useAbsoluteCoords) uint16 x1, y1, x2, y2; if (*cptr == NULL) { - VPtr = getViewData(RoomNum, Direction); + VPtr = getViewData(g_lab->_roomNum, Direction); LCPtr = VPtr->closeUps; } else LCPtr = (*cptr)->SubCloseUps; @@ -300,7 +300,7 @@ bool takeItem(uint16 x, uint16 y, CloseDataPtr *cptr) { CloseDataPtr LCPtr; if (*cptr == NULL) { - VPtr = getViewData(RoomNum, Direction); + VPtr = getViewData(g_lab->_roomNum, Direction); LCPtr = VPtr->closeUps; } else if ((*cptr)->CloseUpType < 0) { g_lab->_conditions->inclElement(abs((*cptr)->CloseUpType)); @@ -443,7 +443,7 @@ static void doActions(Action * APtr, CloseDataPtr *LCPtr) { continue; } - RoomNum = APtr->Param1; + g_lab->_roomNum = APtr->Param1; Direction = APtr->Param2 - 1; *LCPtr = NULL; DoBlack = true; @@ -611,7 +611,7 @@ static bool doActionRuleSub(int16 action, int16 roomNum, CloseDataPtr LCPtr, Clo action++; if (LCPtr) { - RuleList *rules = _rooms[RoomNum]._rules; + RuleList *rules = _rooms[g_lab->_roomNum]._rules; if ((rules == NULL) && (roomNum == 0)) { g_lab->_resource->readViews(roomNum); @@ -700,13 +700,13 @@ bool doOperateRule(int16 x, int16 y, int16 ItemNum, CloseDataPtr *LCPtr) { TLCPtr = getObject(x, y, *LCPtr); - if (doOperateRuleSub(ItemNum, RoomNum, TLCPtr, LCPtr, false)) + if (doOperateRuleSub(ItemNum, g_lab->_roomNum, TLCPtr, LCPtr, false)) return true; - else if (doOperateRuleSub(ItemNum, RoomNum, *LCPtr, LCPtr, false)) + else if (doOperateRuleSub(ItemNum, g_lab->_roomNum, *LCPtr, LCPtr, false)) return true; - else if (doOperateRuleSub(ItemNum, RoomNum, TLCPtr, LCPtr, true)) + else if (doOperateRuleSub(ItemNum, g_lab->_roomNum, TLCPtr, LCPtr, true)) return true; - else if (doOperateRuleSub(ItemNum, RoomNum, *LCPtr, LCPtr, true)) + else if (doOperateRuleSub(ItemNum, g_lab->_roomNum, *LCPtr, LCPtr, true)) return true; else { NewFileName = CurFileName; @@ -728,7 +728,7 @@ bool doOperateRule(int16 x, int16 y, int16 ItemNum, CloseDataPtr *LCPtr) { /* Goes thru the rules if the user tries to go forward. */ /*****************************************************************************/ bool doGoForward(CloseDataPtr *LCPtr) { - RuleList *rules = _rooms[RoomNum]._rules; + RuleList *rules = _rooms[g_lab->_roomNum]._rules; for (RuleList::iterator rule = rules->begin(); rule != rules->end(); ++rule) { if (((*rule)->RuleType == GOFORWARD) && ((*rule)->Param1 == (Direction + 1))) { @@ -749,7 +749,7 @@ bool doTurn(uint16 from, uint16 to, CloseDataPtr *LCPtr) { from++; to++; - RuleList *rules = _rooms[RoomNum]._rules; + RuleList *rules = _rooms[g_lab->_roomNum]._rules; for (RuleList::iterator rule = rules->begin(); rule != rules->end(); ++rule) { if (((*rule)->RuleType == TURN) || @@ -769,7 +769,7 @@ bool doTurn(uint16 from, uint16 to, CloseDataPtr *LCPtr) { /* Goes thru the rules if the user tries to go to the main view */ /*****************************************************************************/ bool doMainView(CloseDataPtr *LCPtr) { - RuleList *rules = _rooms[RoomNum]._rules; + RuleList *rules = _rooms[g_lab->_roomNum]._rules; for (RuleList::iterator rule = rules->begin(); rule != rules->end(); ++rule) { if ((*rule)->RuleType == GOMAINVIEW) { if (checkConditions((*rule)->Condition)) { diff --git a/engines/lab/savegame.cpp b/engines/lab/savegame.cpp index a32971ba5f..b8a59a5f65 100644 --- a/engines/lab/savegame.cpp +++ b/engines/lab/savegame.cpp @@ -132,7 +132,7 @@ bool readSaveGameHeader(Common::InSaveFile *in, SaveGameHeader &header) { /*****************************************************************************/ /* Writes the game out to disk. */ /*****************************************************************************/ -bool saveGame(uint16 RoomNum, uint16 Direction, uint16 Quarters, int slot, Common::String desc) { +bool saveGame(uint16 Direction, uint16 Quarters, int slot, Common::String desc) { uint16 i, j; Common::String fileName = g_lab->generateSaveFileName(slot); Common::SaveFileManager *saveFileManager = g_system->getSavefileManager(); @@ -146,7 +146,7 @@ bool saveGame(uint16 RoomNum, uint16 Direction, uint16 Quarters, int slot, Commo readPict(getPictName(&CPtr), true); writeSaveGameHeader(file, desc); - file->writeUint16LE(RoomNum); + file->writeUint16LE(g_lab->_roomNum); file->writeUint16LE(Direction); file->writeUint16LE(Quarters); @@ -185,7 +185,7 @@ bool saveGame(uint16 RoomNum, uint16 Direction, uint16 Quarters, int slot, Commo /*****************************************************************************/ /* Reads the game from disk. */ /*****************************************************************************/ -bool loadGame(uint16 *RoomNum, uint16 *Direction, uint16 *Quarters, int slot) { +bool loadGame(uint16 *Direction, uint16 *Quarters, int slot) { uint16 i, j; Common::String fileName = g_lab->generateSaveFileName(slot); Common::SaveFileManager *saveFileManager = g_system->getSavefileManager(); @@ -196,7 +196,7 @@ bool loadGame(uint16 *RoomNum, uint16 *Direction, uint16 *Quarters, int slot) { SaveGameHeader header; readSaveGameHeader(file, header); - *RoomNum = file->readUint16LE(); + g_lab->_roomNum = file->readUint16LE(); *Direction = file->readUint16LE(); *Quarters = file->readUint16LE(); diff --git a/engines/lab/special.cpp b/engines/lab/special.cpp index 7519ad1988..e3d1541814 100644 --- a/engines/lab/special.cpp +++ b/engines/lab/special.cpp @@ -90,7 +90,7 @@ extern BitMap *DispBitMap, *DrawBitMap; extern char diffcmap[3 * 256]; extern CloseDataPtr CPtr; extern InventoryData *Inventory; -extern uint16 RoomNum, Direction; +extern uint16 Direction; #define COMBINATIONUNLOCKED 130 #define BRICKOPEN 115 @@ -828,14 +828,14 @@ bool saveRestoreGame() { desc = dialog->createDefaultSaveDescription(slot); } - isOK = saveGame(RoomNum, Direction, Inventory[QUARTERNUM].Many, slot, desc); + isOK = saveGame(Direction, Inventory[QUARTERNUM].Many, slot, desc); } } else { // Restore GUI::SaveLoadChooser *dialog = new GUI::SaveLoadChooser(_("Restore game:"), _("Restore"), false); int slot = dialog->runModalWithCurrentTarget(); if (slot >= 0) { - isOK = loadGame(&RoomNum, &Direction, &(Inventory[QUARTERNUM].Many), slot); + isOK = loadGame(&Direction, &(Inventory[QUARTERNUM].Many), slot); if (isOK) g_lab->_music->resetMusic(); } diff --git a/engines/lab/text.cpp b/engines/lab/text.cpp index 10e4ac8326..3fc1b1a9c4 100644 --- a/engines/lab/text.cpp +++ b/engines/lab/text.cpp @@ -73,7 +73,7 @@ uint16 textHeight(struct TextFont *tf) { /*****************************************************************************/ /* Draws the text to the screen. */ /*****************************************************************************/ -void text(struct TextFont *tf, uint16 x, uint16 y, uint16 color, const char *text, uint16 numchars) { +void text(TextFont *tf, uint16 x, uint16 y, uint16 color, const char *text, uint16 numchars) { byte *VGATop, *VGACur, *VGATemp, *VGATempLine, *cdata; uint32 RealOffset, SegmentOffset; int32 templeft, LeftInSegment; -- cgit v1.2.3 From 11df8b5cf76bf9e3bbdbb5b264ec318d0e7e2911 Mon Sep 17 00:00:00 2001 From: Strangerke Date: Mon, 30 Nov 2015 02:09:54 +0100 Subject: LAB: Make consistent the type of pen number --- engines/lab/graphics.cpp | 8 ++++---- engines/lab/intro.cpp | 2 +- engines/lab/lab.h | 2 +- engines/lab/labfun.h | 8 ++++---- engines/lab/vga.cpp | 4 ++-- 5 files changed, 12 insertions(+), 12 deletions(-) diff --git a/engines/lab/graphics.cpp b/engines/lab/graphics.cpp index 9f689bd57c..54bf8809d1 100644 --- a/engines/lab/graphics.cpp +++ b/engines/lab/graphics.cpp @@ -225,8 +225,8 @@ static void getLine(TextFont *tf, char *LineBuffer, const char **MainBuffer, uin /******************************************************************************/ uint32 flowText(void *font, /* the TextAttr pointer */ int16 spacing, /* How much vertical spacing between the lines */ - uint16 pencolor, /* pen number to use for text */ - uint16 backpen, /* the background color */ + byte pencolor, /* pen number to use for text */ + byte backpen, /* the background color */ bool fillback, /* Whether to fill the background */ bool centerh, /* Whether to center the text horizontally */ bool centerv, /* Whether to center the text vertically */ @@ -292,8 +292,8 @@ uint32 flowText(void *font, /* the TextAttr pointer */ /******************************************************************************/ uint32 flowTextToMem(Image *DestIm, void *font, /* the TextAttr pointer */ int16 spacing, /* How much vertical spacing between the lines */ - uint16 pencolor, /* pen number to use for text */ - uint16 backpen, /* the background color */ + byte pencolor, /* pen number to use for text */ + byte backpen, /* the background color */ bool fillback, /* Whether to fill the background */ bool centerh, /* Whether to center the text horizontally */ bool centerv, /* Whether to center the text vertically */ diff --git a/engines/lab/intro.cpp b/engines/lab/intro.cpp index 36137becf5..7660b29a58 100644 --- a/engines/lab/intro.cpp +++ b/engines/lab/intro.cpp @@ -115,7 +115,7 @@ void Intro::doPictText(const char *filename, bool isscreen) { fade(false, 0); if (isscreen) { - g_lab->setAPen(7L); + g_lab->setAPen(7); g_lab->rectFill(VGAScaleX(10), VGAScaleY(10), VGAScaleX(310), VGAScaleY(190)); Drawn = flowText(_msgfont, (!g_lab->_isHiRes) * -1, 5, 7, false, false, true, true, VGAScaleX(14), VGAScaleY(11), VGAScaleX(306), VGAScaleY(189), (char *)curplace); diff --git a/engines/lab/lab.h b/engines/lab/lab.h index 3c621137a9..2e23ee3a71 100644 --- a/engines/lab/lab.h +++ b/engines/lab/lab.h @@ -125,7 +125,7 @@ private: public: void waitTOF(); - void setAPen(uint16 pennum); + void setAPen(byte pennum); void writeColorRegs(byte *buf, uint16 first, uint16 numreg); byte *getVGABaseAddr(); void readScreenImage(Image *Im, uint16 x, uint16 y); diff --git a/engines/lab/labfun.h b/engines/lab/labfun.h index d20db110a0..77a259a470 100644 --- a/engines/lab/labfun.h +++ b/engines/lab/labfun.h @@ -80,8 +80,8 @@ byte *readPictToMem(const char *filename, uint16 x, uint16 y); uint32 flowText(void *font, /* the TextAttr pointer */ int16 spacing, /* How much vertical spacing between the lines */ - uint16 pencolor, /* pen number to use for text */ - uint16 backpen, /* the background color */ + byte pencolor, /* pen number to use for text */ + byte backpen, /* the background color */ bool fillback, /* Whether to fill the background */ bool centerh, /* Whether to center the text horizontally */ bool centerv, /* Whether to center the text vertically */ @@ -91,8 +91,8 @@ uint32 flowText(void *font, /* the TextAttr pointer */ uint32 flowTextToMem(Image *DestIm, void *font, /* the TextAttr pointer */ int16 spacing, /* How much vertical spacing between the lines */ - uint16 pencolor, /* pen number to use for text */ - uint16 backpen, /* the background color */ + byte pencolor, /* pen number to use for text */ + byte backpen, /* the background color */ bool fillback, /* Whether to fill the background */ bool centerh, /* Whether to center the text horizontally */ bool centerv, /* Whether to center the text vertically */ diff --git a/engines/lab/vga.cpp b/engines/lab/vga.cpp index c7252d4ee5..d3071649c4 100644 --- a/engines/lab/vga.cpp +++ b/engines/lab/vga.cpp @@ -524,8 +524,8 @@ void LabEngine::scrollDisplayY(int16 dy, uint16 x1, uint16 y1, uint16 x2, uint16 /*****************************************************************************/ /* Sets the pen number to use on all the drawing operations. */ /*****************************************************************************/ -void LabEngine::setAPen(uint16 pennum) { - _curapen = (unsigned char)pennum; +void LabEngine::setAPen(byte pennum) { + _curapen = pennum; } /*****************************************************************************/ -- cgit v1.2.3 From 17678103db3fcfc6b49dfad44a46cb63bc1e4945 Mon Sep 17 00:00:00 2001 From: Strangerke Date: Mon, 30 Nov 2015 02:14:49 +0100 Subject: LAB: Move Music declaration to a separate header file --- engines/lab/lab.h | 1 + engines/lab/labfun.h | 54 ------------------------- engines/lab/labmusic.cpp | 1 + engines/lab/music.h | 101 +++++++++++++++++++++++++++++++++++++++++++++++ 4 files changed, 103 insertions(+), 54 deletions(-) create mode 100644 engines/lab/music.h diff --git a/engines/lab/lab.h b/engines/lab/lab.h index 2e23ee3a71..6749a747ab 100644 --- a/engines/lab/lab.h +++ b/engines/lab/lab.h @@ -38,6 +38,7 @@ #include "lab/labfun.h" #include "lab/interface.h" #include "lab/mouse.h" +#include "lab/music.h" #include "lab/resource.h" struct ADGameDescription; diff --git a/engines/lab/labfun.h b/engines/lab/labfun.h index 77a259a470..7fffb1b840 100644 --- a/engines/lab/labfun.h +++ b/engines/lab/labfun.h @@ -149,60 +149,6 @@ void freeAllStolenMem(); Common::File *openPartial(const char *name); void closePartial(int32 File); -/*---------------------------*/ -/*----- From LabMusic.c -----*/ -/*---------------------------*/ - -#define MAXBUFFERS 5L - -class Music { -public: - Music(LabEngine *vm); - - byte **newOpen(const char *name); - byte **newOpen(const char *name, uint32 &size); - bool initMusic(); - void freeMusic(); - void updateMusic(); - uint16 getPlayingBufferCount(); - void closeMusic(); - void setMusic(bool on); - void resumeBackMusic(); - void pauseBackMusic(); - void changeMusic(const char *newmusic); - void checkRoomMusic(); - void resetMusic(); - void setMusicReset(bool reset) { _doReset = reset; } - void playSoundEffect(uint16 SampleSpeed, uint32 Length, void *Data); - void stopSoundEffect(); - bool isSoundEffectActive() const; - - bool _winmusic, _doNotFilestopSoundEffect; - bool _musicOn; - bool _loopSoundEffect; - bool _waitTillFinished; - uint16 _lastMusicRoom ; - bool _doReset; - -private: - LabEngine *_vm; - void fillbuffer(byte *musicBuffer); - void startMusic(bool startatbegin); - - Common::File *_file; - Common::File *_tFile; - bool _musicPaused; - - bool _tMusicOn; - uint32 _tLeftInFile; - uint32 _leftinfile; - - Audio::SoundHandle _musicHandle; - Audio::SoundHandle _sfxHandle; - - Audio::QueuingAudioStream *_queuingAudioStream; -}; - /*---------------------------*/ /*----- From LabSets.c ------*/ /*---------------------------*/ diff --git a/engines/lab/labmusic.cpp b/engines/lab/labmusic.cpp index 3f8017d011..1f99a687be 100644 --- a/engines/lab/labmusic.cpp +++ b/engines/lab/labmusic.cpp @@ -33,6 +33,7 @@ #include "lab/stddefines.h" #include "lab/labfun.h" #include "lab/mouse.h" +#include "lab/music.h" #include "lab/lab.h" namespace Lab { diff --git a/engines/lab/music.h b/engines/lab/music.h new file mode 100644 index 0000000000..1e2bdc3166 --- /dev/null +++ b/engines/lab/music.h @@ -0,0 +1,101 @@ +/* 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. + * + */ + +/* + * This code is based on Labyrinth of Time code with assistance of + * + * Copyright (c) 1993 Terra Nova Development + * Copyright (c) 2004 The Wyrmkeep Entertainment Co. + * + */ + +#ifndef LAB_MUSIC_H +#define LAB_MUSIC_H + +#include "common/events.h" + +// For the Music class - TODO: Move to another header file +#include "audio/mixer.h" +#include "audio/audiostream.h" +#include "audio/decoders/raw.h" + +namespace Lab { + +class LabEngine; + +/*---------------------------*/ +/*----- From LabMusic.c -----*/ +/*---------------------------*/ + +#define MAXBUFFERS 5L + +class Music { +public: + Music(LabEngine *vm); + + byte **newOpen(const char *name); + byte **newOpen(const char *name, uint32 &size); + bool initMusic(); + void freeMusic(); + void updateMusic(); + uint16 getPlayingBufferCount(); + void closeMusic(); + void setMusic(bool on); + void resumeBackMusic(); + void pauseBackMusic(); + void changeMusic(const char *newmusic); + void checkRoomMusic(); + void resetMusic(); + void setMusicReset(bool reset) { _doReset = reset; } + void playSoundEffect(uint16 SampleSpeed, uint32 Length, void *Data); + void stopSoundEffect(); + bool isSoundEffectActive() const; + + bool _winmusic, _doNotFilestopSoundEffect; + bool _musicOn; + bool _loopSoundEffect; + bool _waitTillFinished; + uint16 _lastMusicRoom ; + bool _doReset; + +private: + LabEngine *_vm; + void fillbuffer(byte *musicBuffer); + void startMusic(bool startatbegin); + + Common::File *_file; + Common::File *_tFile; + bool _musicPaused; + + bool _tMusicOn; + uint32 _tLeftInFile; + uint32 _leftinfile; + + Audio::SoundHandle _musicHandle; + Audio::SoundHandle _sfxHandle; + + Audio::QueuingAudioStream *_queuingAudioStream; +}; + +} // End of namespace Lab + +#endif /* LAB_MUSIC_H */ -- cgit v1.2.3 From 6395095b831c1d1a29e315f948ad1d6667255c7b Mon Sep 17 00:00:00 2001 From: Strangerke Date: Mon, 30 Nov 2015 07:13:09 +0100 Subject: LAB: Move crumb variables to main class --- engines/lab/engine.cpp | 220 ++++++++++++++++++++++------------------------- engines/lab/lab.cpp | 14 ++- engines/lab/lab.h | 15 +++- engines/lab/parsetypes.h | 4 +- engines/lab/savegame.cpp | 22 ++--- 5 files changed, 139 insertions(+), 136 deletions(-) diff --git a/engines/lab/engine.cpp b/engines/lab/engine.cpp index 50b404a62d..37a897779b 100644 --- a/engines/lab/engine.cpp +++ b/engines/lab/engine.cpp @@ -56,19 +56,6 @@ extern InventoryData *Inventory; extern uint16 NumInv, ManyRooms, HighestCondition, Direction; CloseDataPtr CPtr; -CrumbData BreadCrumbs[MAX_CRUMBS]; -uint16 NumCrumbs; -bool DroppingCrumbs; -bool FollowingCrumbs; -bool FollowCrumbsFast; -bool IsCrumbTurning; -uint32 CrumbSecs, CrumbMicros; -bool IsCrumbWaiting; - -int followCrumbs(); -void mayShowCrumbIndicator(); -void mayShowCrumbIndicatorOff(); - bool Alternate = false, ispal = false, noupdatediff = false, MainDisplay = true, QuitLab = false; extern const char *NewFileName; /* When ProcessRoom.c decides to change the filename @@ -142,9 +129,9 @@ void LabEngine::drawPanel() { setAPen(5); /* Second Line */ drawHLine(0, VGAScaleY(149) + 1 + SVGACord(2), VGAScaleX(319)); - /* Gadget Seperators */ + /* Gadget Separators */ setAPen(0); - drawHLine(0, VGAScaleY(170), VGAScaleX(319)); /* First black line to seperate buttons */ + drawHLine(0, VGAScaleY(170), VGAScaleX(319)); /* First black line to separate buttons */ if (!Alternate) { setAPen(4); @@ -631,7 +618,6 @@ void LabEngine::decIncInv(uint16 *CurInv, bool dec) { /* The main game loop */ /******************************************************************************/ void LabEngine::mainGameLoop() { - IntuiMessage *Msg; uint32 Class; uint16 Qualifier, ActionMode = 4; @@ -723,7 +709,7 @@ void LabEngine::mainGameLoop() { mayShowCrumbIndicator(); WSDL_UpdateScreen(); - if (!FollowingCrumbs) + if (!_followingCrumbs) eatMessages(); } @@ -736,16 +722,16 @@ void LabEngine::mainGameLoop() { _music->updateMusic(); /* Make sure we check the music at least after every message */ interfaceOn(); - Msg = getMsg(); + IntuiMessage *curMsg = getMsg(); Common::Point curPos; - if (Msg == NULL) { /* Does music load and next animation frame when you've run out of messages */ + if (curMsg == NULL) { /* Does music load and next animation frame when you've run out of messages */ GotMessage = false; _music->checkRoomMusic(); _music->updateMusic(); diffNextFrame(); - if (FollowingCrumbs) { + if (_followingCrumbs) { int result = followCrumbs(); if (result != 0) { @@ -772,14 +758,14 @@ void LabEngine::mainGameLoop() { } else { GotMessage = true; - Class = Msg->msgClass; - code = Msg->code; - Qualifier = Msg->qualifier; - curPos.x = Msg->mouseX; - curPos.y = Msg->mouseY; - GadID = Msg->gadgetID; + Class = curMsg->msgClass; + code = curMsg->code; + Qualifier = curMsg->qualifier; + curPos.x = curMsg->mouseX; + curPos.y = curMsg->mouseY; + GadID = curMsg->gadgetID; - FollowingCrumbs = false; + _followingCrumbs = false; from_crumbs: DoBlack = false; @@ -791,20 +777,20 @@ from_crumbs: curPos = _event->getMousePos(); } else if (getPlatform() == Common::kPlatformWindows && (code == 'b' || code == 'B')) { /* Start bread crumbs */ - BreadCrumbs[0].RoomNum = 0; - NumCrumbs = 0; - DroppingCrumbs = true; + _breadCrumbs[0]._roomNum = 0; + _numCrumbs = 0; + _droppingCrumbs = true; mayShowCrumbIndicator(); WSDL_UpdateScreen(); } else if (code == 'f' || code == 'F' || code == 'r' || code == 'R') { /* Follow bread crumbs */ - if (DroppingCrumbs) { - if (NumCrumbs > 0) { - FollowingCrumbs = true; - FollowCrumbsFast = (code == 'r' || code == 'R'); - IsCrumbTurning = false; - IsCrumbWaiting = false; - getTime(&CrumbSecs, &CrumbMicros); + if (_droppingCrumbs) { + if (_numCrumbs > 0) { + _followingCrumbs = true; + _followCrumbsFast = (code == 'r' || code == 'R'); + _isCrumbTurning = false; + _isCrumbWaiting = false; + getTime(&_crumbSecs, &_crumbMicros); if (Alternate) { eatMessages(); @@ -819,8 +805,8 @@ from_crumbs: WSDL_UpdateScreen(); } } else { - BreadCrumbs[0].RoomNum = 0; - DroppingCrumbs = false; + _breadCrumbs[0]._roomNum = 0; + _droppingCrumbs = false; // Need to hide indicator!!!! mayShowCrumbIndicatorOff(); @@ -837,20 +823,20 @@ from_crumbs: while (1) { _music->updateMusic(); /* Make sure we check the music at least after every message */ - Msg = getMsg(); + curMsg = getMsg(); - if (Msg == NULL) { /* Does music load and next animation frame when you've run out of messages */ + if (curMsg == NULL) { /* Does music load and next animation frame when you've run out of messages */ _music->updateMusic(); diffNextFrame(); } else { - if (Msg->msgClass == RAWKEY) { - if ((Msg->code == 'Y') || (Msg->code == 'y') || (Msg->code == 'Q') || (Msg->code == 'q')) { + if (curMsg->msgClass == RAWKEY) { + if ((curMsg->code == 'Y') || (curMsg->code == 'y') || (curMsg->code == 'Q') || (curMsg->code == 'q')) { doit = true; break; - } else if (Msg->code < 128) { + } else if (curMsg->code < 128) { break; } - } else if (Msg->msgClass == MOUSEBUTTONS) { + } else if (curMsg->msgClass == MOUSEBUTTONS) { break; } } @@ -985,43 +971,43 @@ from_crumbs: } } - if (FollowingCrumbs) { - if (IsCrumbTurning) { + if (_followingCrumbs) { + if (_isCrumbTurning) { if (Direction == OldDirection) { - FollowingCrumbs = false; + _followingCrumbs = false; } } else { if (_roomNum == OldRoomNum) { // didn't get there? - FollowingCrumbs = false; + _followingCrumbs = false; } } - } else if (DroppingCrumbs && OldRoomNum != _roomNum) { + } else if (_droppingCrumbs && OldRoomNum != _roomNum) { // If in surreal maze, turn off DroppingCrumbs. // Note: These numbers were generated by parsing the // "Maps" file, which is why they are hard-coded. Bleh! if (_roomNum >= 245 && _roomNum <= 280) { - FollowingCrumbs = false; - DroppingCrumbs = false; - NumCrumbs = 0; - BreadCrumbs[0].RoomNum = 0; + _followingCrumbs = false; + _droppingCrumbs = false; + _numCrumbs = 0; + _breadCrumbs[0]._roomNum = 0; } else { bool intersect = false; - for (int idx = 0; idx < NumCrumbs; idx++) { - if (BreadCrumbs[idx].RoomNum == _roomNum) { - NumCrumbs = idx + 1; - BreadCrumbs[NumCrumbs].RoomNum = 0; + for (int idx = 0; idx < _numCrumbs; idx++) { + if (_breadCrumbs[idx]._roomNum == _roomNum) { + _numCrumbs = idx + 1; + _breadCrumbs[_numCrumbs]._roomNum = 0; intersect = true; } } if (!intersect) { - if (NumCrumbs == MAX_CRUMBS) { - NumCrumbs = MAX_CRUMBS - 1; - memcpy(&BreadCrumbs[0], &BreadCrumbs[1], NumCrumbs * sizeof BreadCrumbs[0]); + if (_numCrumbs == MAX_CRUMBS) { + _numCrumbs = MAX_CRUMBS - 1; + memcpy(&_breadCrumbs[0], &_breadCrumbs[1], _numCrumbs * sizeof _breadCrumbs[0]); } - BreadCrumbs[NumCrumbs].RoomNum = _roomNum; - BreadCrumbs[NumCrumbs++].Direction = Direction; + _breadCrumbs[_numCrumbs]._roomNum = _roomNum; + _breadCrumbs[_numCrumbs++]._direction = Direction; } } } @@ -1119,19 +1105,19 @@ from_crumbs: WSDL_UpdateScreen(); } else if (GadID == 5) { /* bread crumbs */ - BreadCrumbs[0].RoomNum = 0; - NumCrumbs = 0; - DroppingCrumbs = true; + _breadCrumbs[0]._roomNum = 0; + _numCrumbs = 0; + _droppingCrumbs = true; mayShowCrumbIndicator(); WSDL_UpdateScreen(); } else if (GadID == 6) { /* follow crumbs */ - if (DroppingCrumbs) { - if (NumCrumbs > 0) { - FollowingCrumbs = true; - FollowCrumbsFast = false; - IsCrumbTurning = false; - IsCrumbWaiting = false; - getTime(&CrumbSecs, &CrumbMicros); + if (_droppingCrumbs) { + if (_numCrumbs > 0) { + _followingCrumbs = true; + _followCrumbsFast = false; + _isCrumbTurning = false; + _isCrumbWaiting = false; + getTime(&_crumbSecs, &_crumbMicros); eatMessages(); Alternate = false; @@ -1144,8 +1130,8 @@ from_crumbs: drawRoomMessage(CurInv, CPtr); WSDL_UpdateScreen(); } else { - BreadCrumbs[0].RoomNum = 0; - DroppingCrumbs = false; + _breadCrumbs[0]._roomNum = 0; + _droppingCrumbs = false; // Need to hide indicator!!!! mayShowCrumbIndicatorOff(); @@ -1297,7 +1283,7 @@ from_crumbs: } void LabEngine::go() { - bool dointro = true; + bool doIntro = true; _isHiRes = ((getFeatures() & GF_LOWRES) == 0); @@ -1325,14 +1311,14 @@ void LabEngine::go() { mem = mem && initRoomBuffer(); - if (!dointro) + if (!doIntro) _music->initMusic(); MsgFont = _resource->getFont("P:AvanteG.12"); _event->mouseHide(); - if (dointro && mem) { + if (doIntro && mem) { Intro intro; intro.introSequence(); } else @@ -1375,7 +1361,7 @@ void LabEngine::go() { /*****************************************************************************/ /* New code to allow quick(er) return navigation in game. */ /*****************************************************************************/ -int followCrumbs() { +int LabEngine::followCrumbs() { // NORTH, SOUTH, EAST, WEST static int movement[4][4] = { { VKEY_UPARROW, VKEY_RTARROW, VKEY_RTARROW, VKEY_LTARROW }, @@ -1384,74 +1370,71 @@ int followCrumbs() { { VKEY_RTARROW, VKEY_LTARROW, VKEY_RTARROW, VKEY_UPARROW } }; - if (IsCrumbWaiting) { + if (_isCrumbWaiting) { uint32 Secs; uint32 Micros; - g_lab->timeDiff(CrumbSecs, CrumbMicros, &Secs, &Micros); + g_lab->timeDiff(_crumbSecs, _crumbMicros, &Secs, &Micros); if (Secs != 0 || Micros != 0) return 0; - IsCrumbWaiting = false; + _isCrumbWaiting = false; } - if (!IsCrumbTurning) - BreadCrumbs[NumCrumbs--].RoomNum = 0; + if (!_isCrumbTurning) + _breadCrumbs[_numCrumbs--]._roomNum = 0; // Is the current crumb this room? If not, logic error. - if (g_lab->_roomNum != BreadCrumbs[NumCrumbs].RoomNum) { - NumCrumbs = 0; - BreadCrumbs[0].RoomNum = 0; - DroppingCrumbs = false; - FollowingCrumbs = false; + if (g_lab->_roomNum != _breadCrumbs[_numCrumbs]._roomNum) { + _numCrumbs = 0; + _breadCrumbs[0]._roomNum = 0; + _droppingCrumbs = false; + _followingCrumbs = false; return 0; } - int ExitDir; + int exitDir; // which direction is last crumb - if (BreadCrumbs[NumCrumbs].Direction == EAST) - ExitDir = WEST; - else if (BreadCrumbs[NumCrumbs].Direction == WEST) - ExitDir = EAST; - else if (BreadCrumbs[NumCrumbs].Direction == NORTH) - ExitDir = SOUTH; + if (_breadCrumbs[_numCrumbs]._direction == EAST) + exitDir = WEST; + else if (_breadCrumbs[_numCrumbs]._direction == WEST) + exitDir = EAST; + else if (_breadCrumbs[_numCrumbs]._direction == NORTH) + exitDir = SOUTH; else - ExitDir = NORTH; + exitDir = NORTH; - int MoveDir = movement[Direction][ExitDir]; + int moveDir = movement[Direction][exitDir]; - if (NumCrumbs == 0) { - IsCrumbTurning = false; - BreadCrumbs[0].RoomNum = 0; - DroppingCrumbs = false; - FollowingCrumbs = false; + if (_numCrumbs == 0) { + _isCrumbTurning = false; + _breadCrumbs[0]._roomNum = 0; + _droppingCrumbs = false; + _followingCrumbs = false; } else { - int theDelay = (FollowCrumbsFast ? ONESECOND / 4 : ONESECOND); + int theDelay = (_followCrumbsFast ? ONESECOND / 4 : ONESECOND); - IsCrumbTurning = (MoveDir != VKEY_UPARROW); - IsCrumbWaiting = true; + _isCrumbTurning = (moveDir != VKEY_UPARROW); + _isCrumbWaiting = true; - g_lab->addCurTime(theDelay / ONESECOND, theDelay % ONESECOND, &CrumbSecs, &CrumbMicros); + g_lab->addCurTime(theDelay / ONESECOND, theDelay % ONESECOND, &_crumbSecs, &_crumbMicros); } - return MoveDir; + return moveDir; } -byte dropCrumbs[] = { 0x00 }; -byte dropCrumbsOff[] = { 0x00 }; - -Image DropCrumbsImage = { 24, 24, dropCrumbs }; -Image DropCrumbsOffImage = { 24, 24, dropCrumbsOff }; - void LabEngine::mayShowCrumbIndicator() { if (getPlatform() != Common::kPlatformWindows) return; - if (DroppingCrumbs && MainDisplay) { + if (_droppingCrumbs && MainDisplay) { + static byte dropCrumbs[] = { 0x00 }; + static Image dropCrumbsImage = { 24, 24, dropCrumbs }; + _event->mouseHide(); - drawMaskImage(&DropCrumbsImage, 612, 4); + drawMaskImage(&dropCrumbsImage, 612, 4); _event->mouseShow(); } } @@ -1461,8 +1444,11 @@ void LabEngine::mayShowCrumbIndicatorOff() { return; if (MainDisplay) { + static byte dropCrumbsOff[] = { 0x00 }; + static Image dropCrumbsOffImage = { 24, 24, dropCrumbsOff }; + _event->mouseHide(); - drawMaskImage(&DropCrumbsOffImage, 612, 4); + drawMaskImage(&dropCrumbsOffImage, 612, 4); _event->mouseShow(); } } diff --git a/engines/lab/lab.cpp b/engines/lab/lab.cpp index 6d7ed00b4c..b42e48643f 100644 --- a/engines/lab/lab.cpp +++ b/engines/lab/lab.cpp @@ -74,12 +74,24 @@ LabEngine::LabEngine(OSystem *syst, const ADGameDescription *gameDesc) _isHiRes = false; _roomNum = -1; + for (int i = 0; i < MAX_CRUMBS; i++) { + _breadCrumbs[i]._roomNum = 0; + _breadCrumbs[i]._direction = NORTH; + } + + _numCrumbs = 0; + _droppingCrumbs = false; + _followingCrumbs = false; + _followCrumbsFast = false; + _isCrumbTurning = false; + _isCrumbWaiting = false; + _crumbSecs = 0; + _crumbMicros = 0; _event = nullptr; _resource = nullptr; _music = nullptr; - //const Common::FSNode gameDataDir(ConfMan.get("path")); //SearchMan.addSubDirectoryMatching(gameDataDir, "game"); //SearchMan.addSubDirectoryMatching(gameDataDir, "game/pict"); diff --git a/engines/lab/lab.h b/engines/lab/lab.h index 6749a747ab..b2ec4b1c26 100644 --- a/engines/lab/lab.h +++ b/engines/lab/lab.h @@ -108,6 +108,17 @@ public: byte *_currentDsplayBuffer; Common::Point _mousePos; + CrumbData _breadCrumbs[MAX_CRUMBS]; + uint16 _numCrumbs; + bool _droppingCrumbs; + bool _followingCrumbs; + bool _followCrumbsFast; + bool _isCrumbTurning; + uint32 _crumbSecs, _crumbMicros; + bool _isCrumbWaiting; + byte *_tempScrollData; + bool _isHiRes; + private: byte *_displayBuffer; @@ -117,9 +128,6 @@ private: uint16 _keyBuf[64]; uint16 _nextKeyOut; bool _mouseAtEdge; -public: - byte *_tempScrollData; - bool _isHiRes; private: bool createScreen(bool HiRes); @@ -173,6 +181,7 @@ public: void eatMessages(); void drawStaticMessage(byte index); void drawDirection(CloseDataPtr LCPtr); + int followCrumbs(); private: void quickWaitTOF(); diff --git a/engines/lab/parsetypes.h b/engines/lab/parsetypes.h index e482775f5d..2585ae5dbd 100644 --- a/engines/lab/parsetypes.h +++ b/engines/lab/parsetypes.h @@ -195,8 +195,8 @@ struct MapData { #endif struct CrumbData { - uint16 RoomNum; - uint16 Direction; + uint16 _roomNum; + uint16 _direction; }; #define MAX_CRUMBS 128 diff --git a/engines/lab/savegame.cpp b/engines/lab/savegame.cpp index b8a59a5f65..b01ac276c8 100644 --- a/engines/lab/savegame.cpp +++ b/engines/lab/savegame.cpp @@ -54,10 +54,6 @@ namespace Lab { /* Lab: Labyrinth specific */ extern byte combination[6]; extern uint16 CurTile[4] [4]; -extern CrumbData BreadCrumbs[MAX_CRUMBS]; -extern uint16 NumCrumbs; -extern bool DroppingCrumbs; -extern bool FollowingCrumbs; extern char *getPictName(CloseDataPtr *LCPtr); void writeSaveGameHeader(Common::OutSaveFile *out, const Common::String &saveName) { @@ -168,9 +164,9 @@ bool saveGame(uint16 Direction, uint16 Quarters, int slot, Common::String desc) file->writeUint16LE(CurTile[i][j]); // Breadcrumbs - for (i = 0; i < sizeof(BreadCrumbs); i++) { - file->writeUint16LE(BreadCrumbs[i].RoomNum); - file->writeUint16LE(BreadCrumbs[i].Direction); + for (i = 0; i < sizeof(g_lab->_breadCrumbs); i++) { + file->writeUint16LE(g_lab->_breadCrumbs[i]._roomNum); + file->writeUint16LE(g_lab->_breadCrumbs[i]._direction); } file->flush(); @@ -219,17 +215,17 @@ bool loadGame(uint16 *Direction, uint16 *Quarters, int slot) { // Breadcrumbs for (i = 0; i < 128; i++) { - BreadCrumbs[i].RoomNum = file->readUint16LE(); - BreadCrumbs[i].Direction = file->readUint16LE(); + g_lab->_breadCrumbs[i]._roomNum = file->readUint16LE(); + g_lab->_breadCrumbs[i]._direction = file->readUint16LE(); } - DroppingCrumbs = (BreadCrumbs[0].RoomNum != 0); - FollowingCrumbs = false; + g_lab->_droppingCrumbs = (g_lab->_breadCrumbs[0]._roomNum != 0); + g_lab->_followingCrumbs = false; for (i = 0; i < 128; i++) { - if (BreadCrumbs[i].RoomNum == 0) + if (g_lab->_breadCrumbs[i]._roomNum == 0) break; - NumCrumbs = i; + g_lab->_numCrumbs = i; } delete file; -- cgit v1.2.3 From d45d46c2cb682937ae64373aeee9517ba2ca346d Mon Sep 17 00:00:00 2001 From: Strangerke Date: Mon, 30 Nov 2015 11:23:44 +0100 Subject: LAB: Rename music source file --- engines/lab/labmusic.cpp | 358 ----------------------------------------------- engines/lab/module.mk | 2 +- engines/lab/music.cpp | 358 +++++++++++++++++++++++++++++++++++++++++++++++ 3 files changed, 359 insertions(+), 359 deletions(-) delete mode 100644 engines/lab/labmusic.cpp create mode 100644 engines/lab/music.cpp diff --git a/engines/lab/labmusic.cpp b/engines/lab/labmusic.cpp deleted file mode 100644 index 1f99a687be..0000000000 --- a/engines/lab/labmusic.cpp +++ /dev/null @@ -1,358 +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. - * - */ - -/* - * This code is based on Labyrinth of Time code with assistance of - * - * Copyright (c) 1993 Terra Nova Development - * Copyright (c) 2004 The Wyrmkeep Entertainment Co. - * - */ - -#include "audio/mixer.h" - -#include "lab/stddefines.h" -#include "lab/labfun.h" -#include "lab/mouse.h" -#include "lab/music.h" -#include "lab/lab.h" - -namespace Lab { - -#define MUSICBUFSIZE (2 * 65536L) -#define SAMPLESPEED 15000L - -#define CLOWNROOM 123 -#define DIMROOM 80 - -Music::Music(LabEngine *vm) : _vm(vm) { - _file = 0; - _tFile = 0; - _musicPaused = false; - - _tMusicOn = false; - _tLeftInFile = 0; - - _leftinfile = 0; - - _musicOn = false; - _winmusic = false; - _loopSoundEffect = false; - _queuingAudioStream = NULL; - _doNotFilestopSoundEffect = false; - _lastMusicRoom = 1; - _doReset = true; - _waitTillFinished = false; -} - -/*****************************************************************************/ -/* Figures out which buffer is currently playing based on messages sent to */ -/* it from the Audio device. */ -/*****************************************************************************/ -void Music::updateMusic() { - _vm->WSDL_ProcessInput(0); - - _vm->_event->updateMouse(); - - if (_musicOn && getPlayingBufferCount() < MAXBUFFERS) { - // NOTE: We need to use malloc(), cause this will be freed with free() - // by the music code - byte *musicBuffer = (byte *)malloc(MUSICBUFSIZE); - fillbuffer(musicBuffer); - - // Queue a music block, and start the music, if needed - bool startMusic = false; - - if (!_queuingAudioStream) { - _queuingAudioStream = Audio::makeQueuingAudioStream(SAMPLESPEED, false); - startMusic = true; - } - - byte soundFlags = Audio::FLAG_LITTLE_ENDIAN; - if (_vm->getPlatform() == Common::kPlatformWindows) - soundFlags |= Audio::FLAG_16BITS; - else - soundFlags |= Audio::FLAG_UNSIGNED; - - _queuingAudioStream->queueBuffer(musicBuffer, MUSICBUFSIZE, DisposeAfterUse::YES, soundFlags); - - if (startMusic) - _vm->_mixer->playStream(Audio::Mixer::kMusicSoundType, &_musicHandle, _queuingAudioStream); - } -} - -uint16 Music::getPlayingBufferCount() { - return (_queuingAudioStream) ? _queuingAudioStream->numQueuedStreams() : 0; -} - -void Music::playSoundEffect(uint16 SampleSpeed, uint32 Length, void *Data) { - pauseBackMusic(); - stopSoundEffect(); - - if (SampleSpeed < 4000) - SampleSpeed = 4000; - - byte soundFlags = Audio::FLAG_LITTLE_ENDIAN; - if (_vm->getPlatform() == Common::kPlatformWindows) - soundFlags |= Audio::FLAG_16BITS; - else - soundFlags |= Audio::FLAG_UNSIGNED; - - Audio::SeekableAudioStream *audioStream = Audio::makeRawStream((const byte *)Data, Length, SampleSpeed, soundFlags, DisposeAfterUse::NO); - uint loops = (_loopSoundEffect) ? 0 : 1; - Audio::LoopingAudioStream *loopingAudioStream = new Audio::LoopingAudioStream(audioStream, loops); - _vm->_mixer->playStream(Audio::Mixer::kSFXSoundType, &_sfxHandle, loopingAudioStream); -} - -void Music::stopSoundEffect() { - if (isSoundEffectActive()) - _vm->_mixer->stopHandle(_sfxHandle); -} - -bool Music::isSoundEffectActive() const { - return _vm->_mixer->isSoundHandleActive(_sfxHandle); -} - -void Music::fillbuffer(byte *musicBuffer) { - if (MUSICBUFSIZE < _leftinfile) { - _file->read(musicBuffer, MUSICBUFSIZE); - _leftinfile -= MUSICBUFSIZE; - } else { - _file->read(musicBuffer, _leftinfile); - - memset((char *)musicBuffer + _leftinfile, 0, MUSICBUFSIZE - _leftinfile); - - _file->seek(0); - _leftinfile = _file->size(); - } -} - -/*****************************************************************************/ -/* Starts up the music initially. */ -/*****************************************************************************/ -void Music::startMusic(bool startatbegin) { - if (!_musicOn) - return; - - stopSoundEffect(); - - if (startatbegin) { - _file->seek(0); - _leftinfile = _file->size(); - } - - _musicOn = true; - updateMusic(); -} - -/*****************************************************************************/ -/* Initializes the music buffers. */ -/*****************************************************************************/ -bool Music::initMusic() { - _musicOn = true; - _musicPaused = false; - - const char *filename; - - if (_winmusic) - filename = "Music:WinGame"; - else - filename = "Music:BackGrou"; - - _file = openPartial(filename); - - if (_file) { - startMusic(true); - return true; - } - - _musicOn = false; - return false; -} - -/*****************************************************************************/ -/* Frees up the music buffers and closes the file. */ -/*****************************************************************************/ -void Music::freeMusic() { - _musicOn = false; - - _vm->_mixer->stopHandle(_musicHandle); - _queuingAudioStream = NULL; - - _vm->_mixer->stopHandle(_sfxHandle); - - delete _file; - _file = NULL; -} - -/*****************************************************************************/ -/* Pauses the background music. */ -/*****************************************************************************/ -void Music::pauseBackMusic() { - if (!_musicPaused && _musicOn) { - updateMusic(); - _musicOn = false; - stopSoundEffect(); - - _vm->_mixer->pauseHandle(_musicHandle, true); - - _musicPaused = true; - } -} - -/*****************************************************************************/ -/* Resumes the paused background music. */ -/*****************************************************************************/ -void Music::resumeBackMusic() { - if (_musicPaused) { - stopSoundEffect(); - _musicOn = true; - - _vm->_mixer->pauseHandle(_musicHandle, false); - - updateMusic(); - _musicPaused = false; - } -} - -/*****************************************************************************/ -/* Turns the music on and off. */ -/*****************************************************************************/ -void Music::setMusic(bool on) { - stopSoundEffect(); - - if (on && !_musicOn) { - _musicOn = true; - startMusic(true); - } else if (!on && _musicOn) { - _musicOn = false; - updateMusic(); - } else - _musicOn = on; -} - -/******************************************************************************/ -/* Checks the music that should be playing in a particular room. */ -/******************************************************************************/ -void Music::checkRoomMusic() { - if ((_lastMusicRoom == _vm->_roomNum) || !_musicOn) - return; - - if (_vm->_roomNum == CLOWNROOM) - changeMusic("Music:Laugh"); - else if (_vm->_roomNum == DIMROOM) - changeMusic("Music:Rm81"); - else if (_doReset) - resetMusic(); - - _lastMusicRoom = _vm->_roomNum; -} - -/*****************************************************************************/ -/* Changes the background music to something else. */ -/*****************************************************************************/ -void Music::changeMusic(const char *newmusic) { - if (!_tFile) { - _tFile = _file; - _tMusicOn = _musicOn; - _tLeftInFile = _leftinfile + 65536L; - - if (_tLeftInFile > (uint32)_tFile->size()) - _tLeftInFile = _leftinfile; - } - - _file = openPartial(newmusic); - - if (_file) { - _musicOn = true; /* turn it off */ - setMusic(false); - _musicOn = false; /* turn it back on */ - setMusic(true); - } else { - _file = _tFile; - _tFile = 0; - } -} - -/*****************************************************************************/ -/* Changes the background music to the original piece playing. */ -/*****************************************************************************/ -void Music::resetMusic() { - if (!_tFile) - return; - - if (_file->isOpen()) - _file->close(); - - _file = _tFile; - _leftinfile = _tLeftInFile; - - _file->seek(_file->size() - _leftinfile); - - _musicOn = true; - setMusic(false); - updateMusic(); - - if (!_tMusicOn) { - _tFile = 0; - return; - } - - _musicOn = _tMusicOn; - startMusic(false); - - _tFile = 0; -} - -byte **Music::newOpen(const char *name) { - uint32 unused; - return newOpen(name, unused); -} - -/*****************************************************************************/ -/* Checks whether or note enough memory in music buffer before loading any */ -/* files. Fills it if not. Does not take into account the current buffer */ -/* playing; a built in fudge factor. We've also got another FUDGEFACTOR */ -/* defined above in case things go wrong. */ -/* */ -/* Here, the seconds are multipled by 10. */ -/*****************************************************************************/ -byte **Music::newOpen(const char *name, uint32 &size) { - byte **file; - - if (!name || !strcmp(name, "") || !strcmp(name, " ")) - return NULL; - - if ((file = isBuffered(name))) - return file; - - updateMusic(); - - if (!_doNotFilestopSoundEffect) - stopSoundEffect(); - - file = openFile(name, size); - updateMusic(); - return file; -} - -} // End of namespace Lab diff --git a/engines/lab/module.mk b/engines/lab/module.mk index f36871c8a5..c9682f256a 100644 --- a/engines/lab/module.mk +++ b/engines/lab/module.mk @@ -9,11 +9,11 @@ MODULE_OBJS := \ intro.o \ lab.o \ labfile.o \ - labmusic.o \ labsets.o \ machine.o \ map.o \ mouse.o \ + music.o \ processroom.o \ readdiff.o \ resource.o \ diff --git a/engines/lab/music.cpp b/engines/lab/music.cpp new file mode 100644 index 0000000000..1f99a687be --- /dev/null +++ b/engines/lab/music.cpp @@ -0,0 +1,358 @@ +/* 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. + * + */ + +/* + * This code is based on Labyrinth of Time code with assistance of + * + * Copyright (c) 1993 Terra Nova Development + * Copyright (c) 2004 The Wyrmkeep Entertainment Co. + * + */ + +#include "audio/mixer.h" + +#include "lab/stddefines.h" +#include "lab/labfun.h" +#include "lab/mouse.h" +#include "lab/music.h" +#include "lab/lab.h" + +namespace Lab { + +#define MUSICBUFSIZE (2 * 65536L) +#define SAMPLESPEED 15000L + +#define CLOWNROOM 123 +#define DIMROOM 80 + +Music::Music(LabEngine *vm) : _vm(vm) { + _file = 0; + _tFile = 0; + _musicPaused = false; + + _tMusicOn = false; + _tLeftInFile = 0; + + _leftinfile = 0; + + _musicOn = false; + _winmusic = false; + _loopSoundEffect = false; + _queuingAudioStream = NULL; + _doNotFilestopSoundEffect = false; + _lastMusicRoom = 1; + _doReset = true; + _waitTillFinished = false; +} + +/*****************************************************************************/ +/* Figures out which buffer is currently playing based on messages sent to */ +/* it from the Audio device. */ +/*****************************************************************************/ +void Music::updateMusic() { + _vm->WSDL_ProcessInput(0); + + _vm->_event->updateMouse(); + + if (_musicOn && getPlayingBufferCount() < MAXBUFFERS) { + // NOTE: We need to use malloc(), cause this will be freed with free() + // by the music code + byte *musicBuffer = (byte *)malloc(MUSICBUFSIZE); + fillbuffer(musicBuffer); + + // Queue a music block, and start the music, if needed + bool startMusic = false; + + if (!_queuingAudioStream) { + _queuingAudioStream = Audio::makeQueuingAudioStream(SAMPLESPEED, false); + startMusic = true; + } + + byte soundFlags = Audio::FLAG_LITTLE_ENDIAN; + if (_vm->getPlatform() == Common::kPlatformWindows) + soundFlags |= Audio::FLAG_16BITS; + else + soundFlags |= Audio::FLAG_UNSIGNED; + + _queuingAudioStream->queueBuffer(musicBuffer, MUSICBUFSIZE, DisposeAfterUse::YES, soundFlags); + + if (startMusic) + _vm->_mixer->playStream(Audio::Mixer::kMusicSoundType, &_musicHandle, _queuingAudioStream); + } +} + +uint16 Music::getPlayingBufferCount() { + return (_queuingAudioStream) ? _queuingAudioStream->numQueuedStreams() : 0; +} + +void Music::playSoundEffect(uint16 SampleSpeed, uint32 Length, void *Data) { + pauseBackMusic(); + stopSoundEffect(); + + if (SampleSpeed < 4000) + SampleSpeed = 4000; + + byte soundFlags = Audio::FLAG_LITTLE_ENDIAN; + if (_vm->getPlatform() == Common::kPlatformWindows) + soundFlags |= Audio::FLAG_16BITS; + else + soundFlags |= Audio::FLAG_UNSIGNED; + + Audio::SeekableAudioStream *audioStream = Audio::makeRawStream((const byte *)Data, Length, SampleSpeed, soundFlags, DisposeAfterUse::NO); + uint loops = (_loopSoundEffect) ? 0 : 1; + Audio::LoopingAudioStream *loopingAudioStream = new Audio::LoopingAudioStream(audioStream, loops); + _vm->_mixer->playStream(Audio::Mixer::kSFXSoundType, &_sfxHandle, loopingAudioStream); +} + +void Music::stopSoundEffect() { + if (isSoundEffectActive()) + _vm->_mixer->stopHandle(_sfxHandle); +} + +bool Music::isSoundEffectActive() const { + return _vm->_mixer->isSoundHandleActive(_sfxHandle); +} + +void Music::fillbuffer(byte *musicBuffer) { + if (MUSICBUFSIZE < _leftinfile) { + _file->read(musicBuffer, MUSICBUFSIZE); + _leftinfile -= MUSICBUFSIZE; + } else { + _file->read(musicBuffer, _leftinfile); + + memset((char *)musicBuffer + _leftinfile, 0, MUSICBUFSIZE - _leftinfile); + + _file->seek(0); + _leftinfile = _file->size(); + } +} + +/*****************************************************************************/ +/* Starts up the music initially. */ +/*****************************************************************************/ +void Music::startMusic(bool startatbegin) { + if (!_musicOn) + return; + + stopSoundEffect(); + + if (startatbegin) { + _file->seek(0); + _leftinfile = _file->size(); + } + + _musicOn = true; + updateMusic(); +} + +/*****************************************************************************/ +/* Initializes the music buffers. */ +/*****************************************************************************/ +bool Music::initMusic() { + _musicOn = true; + _musicPaused = false; + + const char *filename; + + if (_winmusic) + filename = "Music:WinGame"; + else + filename = "Music:BackGrou"; + + _file = openPartial(filename); + + if (_file) { + startMusic(true); + return true; + } + + _musicOn = false; + return false; +} + +/*****************************************************************************/ +/* Frees up the music buffers and closes the file. */ +/*****************************************************************************/ +void Music::freeMusic() { + _musicOn = false; + + _vm->_mixer->stopHandle(_musicHandle); + _queuingAudioStream = NULL; + + _vm->_mixer->stopHandle(_sfxHandle); + + delete _file; + _file = NULL; +} + +/*****************************************************************************/ +/* Pauses the background music. */ +/*****************************************************************************/ +void Music::pauseBackMusic() { + if (!_musicPaused && _musicOn) { + updateMusic(); + _musicOn = false; + stopSoundEffect(); + + _vm->_mixer->pauseHandle(_musicHandle, true); + + _musicPaused = true; + } +} + +/*****************************************************************************/ +/* Resumes the paused background music. */ +/*****************************************************************************/ +void Music::resumeBackMusic() { + if (_musicPaused) { + stopSoundEffect(); + _musicOn = true; + + _vm->_mixer->pauseHandle(_musicHandle, false); + + updateMusic(); + _musicPaused = false; + } +} + +/*****************************************************************************/ +/* Turns the music on and off. */ +/*****************************************************************************/ +void Music::setMusic(bool on) { + stopSoundEffect(); + + if (on && !_musicOn) { + _musicOn = true; + startMusic(true); + } else if (!on && _musicOn) { + _musicOn = false; + updateMusic(); + } else + _musicOn = on; +} + +/******************************************************************************/ +/* Checks the music that should be playing in a particular room. */ +/******************************************************************************/ +void Music::checkRoomMusic() { + if ((_lastMusicRoom == _vm->_roomNum) || !_musicOn) + return; + + if (_vm->_roomNum == CLOWNROOM) + changeMusic("Music:Laugh"); + else if (_vm->_roomNum == DIMROOM) + changeMusic("Music:Rm81"); + else if (_doReset) + resetMusic(); + + _lastMusicRoom = _vm->_roomNum; +} + +/*****************************************************************************/ +/* Changes the background music to something else. */ +/*****************************************************************************/ +void Music::changeMusic(const char *newmusic) { + if (!_tFile) { + _tFile = _file; + _tMusicOn = _musicOn; + _tLeftInFile = _leftinfile + 65536L; + + if (_tLeftInFile > (uint32)_tFile->size()) + _tLeftInFile = _leftinfile; + } + + _file = openPartial(newmusic); + + if (_file) { + _musicOn = true; /* turn it off */ + setMusic(false); + _musicOn = false; /* turn it back on */ + setMusic(true); + } else { + _file = _tFile; + _tFile = 0; + } +} + +/*****************************************************************************/ +/* Changes the background music to the original piece playing. */ +/*****************************************************************************/ +void Music::resetMusic() { + if (!_tFile) + return; + + if (_file->isOpen()) + _file->close(); + + _file = _tFile; + _leftinfile = _tLeftInFile; + + _file->seek(_file->size() - _leftinfile); + + _musicOn = true; + setMusic(false); + updateMusic(); + + if (!_tMusicOn) { + _tFile = 0; + return; + } + + _musicOn = _tMusicOn; + startMusic(false); + + _tFile = 0; +} + +byte **Music::newOpen(const char *name) { + uint32 unused; + return newOpen(name, unused); +} + +/*****************************************************************************/ +/* Checks whether or note enough memory in music buffer before loading any */ +/* files. Fills it if not. Does not take into account the current buffer */ +/* playing; a built in fudge factor. We've also got another FUDGEFACTOR */ +/* defined above in case things go wrong. */ +/* */ +/* Here, the seconds are multipled by 10. */ +/*****************************************************************************/ +byte **Music::newOpen(const char *name, uint32 &size) { + byte **file; + + if (!name || !strcmp(name, "") || !strcmp(name, " ")) + return NULL; + + if ((file = isBuffered(name))) + return file; + + updateMusic(); + + if (!_doNotFilestopSoundEffect) + stopSoundEffect(); + + file = openFile(name, size); + updateMusic(); + return file; +} + +} // End of namespace Lab -- cgit v1.2.3 From 4a90aba77af7de91f03dc51a7180637eb843ca95 Mon Sep 17 00:00:00 2001 From: Strangerke Date: Mon, 30 Nov 2015 13:09:36 +0100 Subject: LAB: Get rid of a goto --- engines/lab/engine.cpp | 941 +++++++++++++++++++++++++------------------------ engines/lab/lab.h | 1 + 2 files changed, 472 insertions(+), 470 deletions(-) diff --git a/engines/lab/engine.cpp b/engines/lab/engine.cpp index 37a897779b..7d67241513 100644 --- a/engines/lab/engine.cpp +++ b/engines/lab/engine.cpp @@ -618,17 +618,10 @@ void LabEngine::decIncInv(uint16 *CurInv, bool dec) { /* The main game loop */ /******************************************************************************/ void LabEngine::mainGameLoop() { - uint32 Class; + uint16 actionMode = 4; + uint16 curInv = MAPNUM; - uint16 Qualifier, ActionMode = 4; - uint16 CurInv = MAPNUM, LastInv = MAPNUM, Old; - - bool ForceDraw = false, doit, GotMessage = true; - - uint16 OldRoomNum, OldDirection = 0, GadID = 0, NewDir; - - CloseDataPtr OldCPtr, TempCPtr, HCPtr = NULL; - ViewData *VPtr; + bool forceDraw = false, GotMessage = true; VGASetPal(initcolors, 8); @@ -650,11 +643,10 @@ void LabEngine::mainGameLoop() { LongWinInFront = false; drawPanel(); - perFlipGadget(ActionMode); + perFlipGadget(actionMode); /* Set up initial picture. */ - uint16 code = 0; while (1) { WSDL_ProcessInput(1); @@ -680,7 +672,7 @@ void LabEngine::mainGameLoop() { if (noupdatediff) { _roomsFound->inclElement(_roomNum); /* Potentially entered another room */ - ForceDraw = (strcmp(Test, CurFileName) != 0) || ForceDraw; + forceDraw = (strcmp(Test, CurFileName) != 0) || forceDraw; noupdatediff = false; CurFileName = Test; @@ -703,8 +695,8 @@ void LabEngine::mainGameLoop() { } else readPict(CurFileName, false); - drawRoomMessage(CurInv, CPtr); - ForceDraw = false; + drawRoomMessage(curInv, CPtr); + forceDraw = false; mayShowCrumbIndicator(); WSDL_UpdateScreen(); @@ -713,9 +705,9 @@ void LabEngine::mainGameLoop() { eatMessages(); } - if (ForceDraw) { - drawRoomMessage(CurInv, CPtr); - ForceDraw = false; + if (forceDraw) { + drawRoomMessage(curInv, CPtr); + forceDraw = false; WSDL_UpdateScreen(); } } @@ -724,7 +716,6 @@ void LabEngine::mainGameLoop() { interfaceOn(); IntuiMessage *curMsg = getMsg(); - Common::Point curPos; if (curMsg == NULL) { /* Does music load and next animation frame when you've run out of messages */ GotMessage = false; _music->checkRoomMusic(); @@ -735,21 +726,19 @@ void LabEngine::mainGameLoop() { int result = followCrumbs(); if (result != 0) { - curPos = WSDL_GetMousePos(); - Class = GADGETUP; - Qualifier = 0; - + uint16 code = 0; if (result == VKEY_UPARROW) - code = GadID = 7; + code = 7; else if (result == VKEY_LTARROW) - code = GadID = 6; + code = 6; else if (result == VKEY_RTARROW) - code = GadID = 8; + code = 8; GotMessage = true; mayShowCrumbIndicator(); WSDL_UpdateScreen(); - goto from_crumbs; + if (!from_crumbs(GADGETUP, code, 0, WSDL_GetMousePos(), curInv, curMsg, forceDraw, code, actionMode)) + break; } } @@ -758,528 +747,540 @@ void LabEngine::mainGameLoop() { } else { GotMessage = true; - Class = curMsg->msgClass; - code = curMsg->code; - Qualifier = curMsg->qualifier; + Common::Point curPos; curPos.x = curMsg->mouseX; curPos.y = curMsg->mouseY; - GadID = curMsg->gadgetID; _followingCrumbs = false; + if (!from_crumbs(curMsg->msgClass, curMsg->code, curMsg->qualifier, curPos, curInv, curMsg, forceDraw, curMsg->gadgetID, actionMode)) + break; + } + } -from_crumbs: - DoBlack = false; + delete _conditions; + delete _roomsFound; - if ((Class == RAWKEY) && (!LongWinInFront)) { - if (code == 13) { /* The return key */ - Class = MOUSEBUTTONS; - Qualifier = IEQUALIFIER_LEFTBUTTON; - curPos = _event->getMousePos(); - } else if (getPlatform() == Common::kPlatformWindows && - (code == 'b' || code == 'B')) { /* Start bread crumbs */ - _breadCrumbs[0]._roomNum = 0; - _numCrumbs = 0; - _droppingCrumbs = true; - mayShowCrumbIndicator(); - WSDL_UpdateScreen(); - } else if (code == 'f' || code == 'F' || - code == 'r' || code == 'R') { /* Follow bread crumbs */ - if (_droppingCrumbs) { - if (_numCrumbs > 0) { - _followingCrumbs = true; - _followCrumbsFast = (code == 'r' || code == 'R'); - _isCrumbTurning = false; - _isCrumbWaiting = false; - getTime(&_crumbSecs, &_crumbMicros); - - if (Alternate) { - eatMessages(); - Alternate = false; - DoBlack = true; - DoNotDrawMessage = false; - - MainDisplay = true; - interfaceOn(); /* Sets the correct gadget list */ - drawPanel(); - drawRoomMessage(CurInv, CPtr); - WSDL_UpdateScreen(); - } - } else { - _breadCrumbs[0]._roomNum = 0; - _droppingCrumbs = false; + if (_rooms) { + free(_rooms); + _rooms = nullptr; + } - // Need to hide indicator!!!! - mayShowCrumbIndicatorOff(); - WSDL_UpdateScreen(); - } - } - } else if ((code == 315) || (code == 'x') || (code == 'X') - || (code == 'q') || (code == 'Q')) { /* Quit? */ - DoNotDrawMessage = false; - drawMessage("Do you want to quit? (Y/N)"); - doit = false; - eatMessages(); - interfaceOff(); - - while (1) { - _music->updateMusic(); /* Make sure we check the music at least after every message */ - curMsg = getMsg(); - - if (curMsg == NULL) { /* Does music load and next animation frame when you've run out of messages */ - _music->updateMusic(); - diffNextFrame(); - } else { - if (curMsg->msgClass == RAWKEY) { - if ((curMsg->code == 'Y') || (curMsg->code == 'y') || (curMsg->code == 'Q') || (curMsg->code == 'q')) { - doit = true; - break; - } else if (curMsg->code < 128) { - break; - } - } else if (curMsg->msgClass == MOUSEBUTTONS) { - break; - } - } + if (Inventory) { + for (int i = 1; i <= NumInv; i++) { + if (Inventory[i].name) + free(Inventory[i].name); + + if (Inventory[i].BInvName) + free(Inventory[i].BInvName); + } + + free(Inventory); + } +} + +bool LabEngine::from_crumbs(uint32 tmpClass, uint16 code, uint16 Qualifier, Common::Point tmpPos, uint16 &curInv, IntuiMessage *curMsg, bool &forceDraw, uint16 gadgetId, uint16 &actionMode) { + uint32 msgClass = tmpClass; + Common::Point curPos = tmpPos; + + uint16 OldRoomNum, OldDirection = 0; + uint16 LastInv = MAPNUM, Old; + CloseDataPtr OldCPtr, TempCPtr, HCPtr = NULL; + ViewData *VPtr; + bool doit; + uint16 NewDir; + + + DoBlack = false; + + if ((msgClass == RAWKEY) && (!LongWinInFront)) { + if (code == 13) { /* The return key */ + msgClass = MOUSEBUTTONS; + Qualifier = IEQUALIFIER_LEFTBUTTON; + curPos = _event->getMousePos(); + } else if (getPlatform() == Common::kPlatformWindows && + (code == 'b' || code == 'B')) { /* Start bread crumbs */ + _breadCrumbs[0]._roomNum = 0; + _numCrumbs = 0; + _droppingCrumbs = true; + mayShowCrumbIndicator(); + WSDL_UpdateScreen(); + } else if (code == 'f' || code == 'F' || + code == 'r' || code == 'R') { /* Follow bread crumbs */ + if (_droppingCrumbs) { + if (_numCrumbs > 0) { + _followingCrumbs = true; + _followCrumbsFast = (code == 'r' || code == 'R'); + _isCrumbTurning = false; + _isCrumbWaiting = false; + getTime(&_crumbSecs, &_crumbMicros); + + if (Alternate) { + eatMessages(); + Alternate = false; + DoBlack = true; + DoNotDrawMessage = false; + + MainDisplay = true; + interfaceOn(); /* Sets the correct gadget list */ + drawPanel(); + drawRoomMessage(curInv, CPtr); + WSDL_UpdateScreen(); } + } else { + _breadCrumbs[0]._roomNum = 0; + _droppingCrumbs = false; - if (doit) { - stopDiff(); + // Need to hide indicator!!!! + mayShowCrumbIndicatorOff(); + WSDL_UpdateScreen(); + } + } + } else if ((code == 315) || (code == 'x') || (code == 'X') + || (code == 'q') || (code == 'Q')) { /* Quit? */ + DoNotDrawMessage = false; + drawMessage("Do you want to quit? (Y/N)"); + doit = false; + eatMessages(); + interfaceOff(); + + while (1) { + _music->updateMusic(); /* Make sure we check the music at least after every message */ + curMsg = getMsg(); + + if (curMsg == NULL) { /* Does music load and next animation frame when you've run out of messages */ + _music->updateMusic(); + diffNextFrame(); + } else { + if (curMsg->msgClass == RAWKEY) { + if ((curMsg->code == 'Y') || (curMsg->code == 'y') || (curMsg->code == 'Q') || (curMsg->code == 'q')) { + doit = true; + break; + } else if (curMsg->code < 128) { + break; + } + } else if (curMsg->msgClass == MOUSEBUTTONS) { break; - } else { - ForceDraw = true; - interfaceOn(); } - } else if (code == 9) { /* TAB key */ - Class = DELTAMOVE; - } else if (code == 27) { /* ESC key */ - CPtr = NULL; } + } - eatMessages(); + if (doit) { + stopDiff(); + return false; + } else { + forceDraw = true; + interfaceOn(); } + } else if (code == 9) { /* TAB key */ + msgClass = DELTAMOVE; + } else if (code == 27) { /* ESC key */ + CPtr = NULL; + } - if (LongWinInFront) { - if ((Class == RAWKEY) || - ((Class == MOUSEBUTTONS) && - ((IEQUALIFIER_LEFTBUTTON & Qualifier) || - (IEQUALIFIER_RBUTTON & Qualifier)))) { - LongWinInFront = false; - DoNotDrawMessage = false; - drawPanel(); - drawRoomMessage(CurInv, CPtr); - WSDL_UpdateScreen(); - } - } else if ((Class == GADGETUP) && !Alternate) { - if (GadID <= 5) { - if ((ActionMode == 4) && (GadID == 4) && (CPtr != NULL)) { - doMainView(&CPtr); + eatMessages(); + } - DoBlack = true; - HCPtr = NULL; - CPtr = NULL; - mayShowCrumbIndicator(); - WSDL_UpdateScreen(); - } else if (GadID == 5) { - eatMessages(); + if (LongWinInFront) { + if ((msgClass == RAWKEY) || + ((msgClass == MOUSEBUTTONS) && + ((IEQUALIFIER_LEFTBUTTON & Qualifier) || + (IEQUALIFIER_RBUTTON & Qualifier)))) { + LongWinInFront = false; + DoNotDrawMessage = false; + drawPanel(); + drawRoomMessage(curInv, CPtr); + WSDL_UpdateScreen(); + } + } else if ((msgClass == GADGETUP) && !Alternate) { + if (gadgetId <= 5) { + if ((actionMode == 4) && (gadgetId == 4) && (CPtr != NULL)) { + doMainView(&CPtr); - Alternate = true; - DoBlack = true; - DoNotDrawMessage = false; - interfaceOn(); /* Sets the correct gadget list */ + DoBlack = true; + HCPtr = NULL; + CPtr = NULL; + mayShowCrumbIndicator(); + WSDL_UpdateScreen(); + } else if (gadgetId == 5) { + eatMessages(); + + Alternate = true; + DoBlack = true; + DoNotDrawMessage = false; + interfaceOn(); /* Sets the correct gadget list */ - MainDisplay = false; + MainDisplay = false; - if (LastInv && _conditions->in(LastInv)) { - CurInv = LastInv; - Test = getInvName(CurInv); - } else - decIncInv(&CurInv, false); + if (LastInv && _conditions->in(LastInv)) { + curInv = LastInv; + Test = getInvName(curInv); + } else + decIncInv(&curInv, false); - drawPanel(); - drawRoomMessage(CurInv, CPtr); + drawPanel(); + drawRoomMessage(curInv, CPtr); - mayShowCrumbIndicator(); - WSDL_UpdateScreen(); - } else { - Old = ActionMode; - ActionMode = GadID; + mayShowCrumbIndicator(); + WSDL_UpdateScreen(); + } else { + Old = actionMode; + actionMode = gadgetId; + + if (Old < 5) + perFlipGadget(Old); + + perFlipGadget(actionMode); + + if (gadgetId == 0) + drawStaticMessage(kTextTakeWhat); + else if (gadgetId == 1) + drawStaticMessage(kTextMoveWhat); + else if (gadgetId == 2) + drawStaticMessage(kTextOpenWhat); + else if (gadgetId == 3) + drawStaticMessage(kTextCloseWhat); + else if (gadgetId == 4) + drawStaticMessage(kTextLookWhat); - if (Old < 5) - perFlipGadget(Old); + WSDL_UpdateScreen(); + } + } else if (gadgetId == 9) { + doUse(MAPNUM); - perFlipGadget(ActionMode); + mayShowCrumbIndicator(); + WSDL_UpdateScreen(); + } else if (gadgetId >= 6) { /* Arrow Gadgets */ + CPtr = NULL; + HCPtr = NULL; - if (GadID == 0) - drawStaticMessage(kTextTakeWhat); - else if (GadID == 1) - drawStaticMessage(kTextMoveWhat); - else if (GadID == 2) - drawStaticMessage(kTextOpenWhat); - else if (GadID == 3) - drawStaticMessage(kTextCloseWhat); - else if (GadID == 4) - drawStaticMessage(kTextLookWhat); + if ((gadgetId == 6) || (gadgetId == 8)) { + if (gadgetId == 6) + drawStaticMessage(kTextTurnLeft); + else + drawStaticMessage(kTextTurnRight); - WSDL_UpdateScreen(); - } - } else if (GadID == 9) { - doUse(MAPNUM); + CurFileName = " "; - mayShowCrumbIndicator(); - WSDL_UpdateScreen(); - } else if (GadID >= 6) { /* Arrow Gadgets */ - CPtr = NULL; - HCPtr = NULL; + OldDirection = Direction; - if ((GadID == 6) || (GadID == 8)) { - if (GadID == 6) - drawStaticMessage(kTextTurnLeft); - else - drawStaticMessage(kTextTurnRight); + NewDir = Direction; + processArrow(&NewDir, gadgetId - 6); + doTurn(Direction, NewDir, &CPtr); + DoBlack = true; + Direction = NewDir; + forceDraw = true; - CurFileName = " "; + mayShowCrumbIndicator(); + WSDL_UpdateScreen(); + } else if (gadgetId == 7) { + OldRoomNum = _roomNum; - OldDirection = Direction; + if (doGoForward(&CPtr)) { + if (OldRoomNum == _roomNum) + DoBlack = true; + } else { + DoBlack = true; + processArrow(&Direction, gadgetId - 6); - NewDir = Direction; - processArrow(&NewDir, GadID - 6); - doTurn(Direction, NewDir, &CPtr); + if (OldRoomNum != _roomNum) { + drawStaticMessage(kTextGoForward); + _roomsFound->inclElement(_roomNum); /* Potentially entered a new room */ + CurFileName = " "; + forceDraw = true; + } else { DoBlack = true; - Direction = NewDir; - ForceDraw = true; + drawStaticMessage(kTextNoPath); + } + } - mayShowCrumbIndicator(); - WSDL_UpdateScreen(); - } else if (GadID == 7) { - OldRoomNum = _roomNum; - - if (doGoForward(&CPtr)) { - if (OldRoomNum == _roomNum) - DoBlack = true; - } else { - DoBlack = true; - processArrow(&Direction, GadID - 6); - - if (OldRoomNum != _roomNum) { - drawStaticMessage(kTextGoForward); - _roomsFound->inclElement(_roomNum); /* Potentially entered a new room */ - CurFileName = " "; - ForceDraw = true; - } else { - DoBlack = true; - drawStaticMessage(kTextNoPath); + if (_followingCrumbs) { + if (_isCrumbTurning) { + if (Direction == OldDirection) { + _followingCrumbs = false; + } + } else { + if (_roomNum == OldRoomNum) { // didn't get there? + _followingCrumbs = false; + } + } + } else if (_droppingCrumbs && OldRoomNum != _roomNum) { + // If in surreal maze, turn off DroppingCrumbs. + // Note: These numbers were generated by parsing the + // "Maps" file, which is why they are hard-coded. Bleh! + if (_roomNum >= 245 && _roomNum <= 280) { + _followingCrumbs = false; + _droppingCrumbs = false; + _numCrumbs = 0; + _breadCrumbs[0]._roomNum = 0; + } else { + bool intersect = false; + for (int idx = 0; idx < _numCrumbs; idx++) { + if (_breadCrumbs[idx]._roomNum == _roomNum) { + _numCrumbs = idx + 1; + _breadCrumbs[_numCrumbs]._roomNum = 0; + intersect = true; } } - if (_followingCrumbs) { - if (_isCrumbTurning) { - if (Direction == OldDirection) { - _followingCrumbs = false; - } - } else { - if (_roomNum == OldRoomNum) { // didn't get there? - _followingCrumbs = false; - } + if (!intersect) { + if (_numCrumbs == MAX_CRUMBS) { + _numCrumbs = MAX_CRUMBS - 1; + memcpy(&_breadCrumbs[0], &_breadCrumbs[1], _numCrumbs * sizeof _breadCrumbs[0]); } - } else if (_droppingCrumbs && OldRoomNum != _roomNum) { - // If in surreal maze, turn off DroppingCrumbs. - // Note: These numbers were generated by parsing the - // "Maps" file, which is why they are hard-coded. Bleh! - if (_roomNum >= 245 && _roomNum <= 280) { - _followingCrumbs = false; - _droppingCrumbs = false; - _numCrumbs = 0; - _breadCrumbs[0]._roomNum = 0; - } else { - bool intersect = false; - for (int idx = 0; idx < _numCrumbs; idx++) { - if (_breadCrumbs[idx]._roomNum == _roomNum) { - _numCrumbs = idx + 1; - _breadCrumbs[_numCrumbs]._roomNum = 0; - intersect = true; - } - } - - if (!intersect) { - if (_numCrumbs == MAX_CRUMBS) { - _numCrumbs = MAX_CRUMBS - 1; - memcpy(&_breadCrumbs[0], &_breadCrumbs[1], _numCrumbs * sizeof _breadCrumbs[0]); - } - - _breadCrumbs[_numCrumbs]._roomNum = _roomNum; - _breadCrumbs[_numCrumbs++]._direction = Direction; - } - } - } - mayShowCrumbIndicator(); - WSDL_UpdateScreen(); + _breadCrumbs[_numCrumbs]._roomNum = _roomNum; + _breadCrumbs[_numCrumbs++]._direction = Direction; + } } } - } else if ((Class == GADGETUP) && Alternate) { - DoBlack = true; - - if (GadID == 0) { - eatMessages(); - Alternate = false; - DoBlack = true; - DoNotDrawMessage = false; - MainDisplay = true; - interfaceOn(); /* Sets the correct gadget list */ - drawPanel(); - drawRoomMessage(CurInv, CPtr); - - WSDL_UpdateScreen(); - } + mayShowCrumbIndicator(); + WSDL_UpdateScreen(); + } + } + } else if ((msgClass == GADGETUP) && Alternate) { + DoBlack = true; - GadID--; + if (gadgetId == 0) { + eatMessages(); + Alternate = false; + DoBlack = true; + DoNotDrawMessage = false; - if (GadID == 0) { - interfaceOff(); - stopDiff(); - CurFileName = " "; + MainDisplay = true; + interfaceOn(); /* Sets the correct gadget list */ + drawPanel(); + drawRoomMessage(curInv, CPtr); - doit = !saveRestoreGame(); - CPtr = NULL; + WSDL_UpdateScreen(); + } - MainDisplay = true; + gadgetId--; - CurInv = MAPNUM; - LastInv = MAPNUM; + if (gadgetId == 0) { + interfaceOff(); + stopDiff(); + CurFileName = " "; - Test = getInvName(CurInv); + doit = !saveRestoreGame(); + CPtr = NULL; - drawPanel(); + MainDisplay = true; - if (doit) { - drawMessage("Disk operation failed."); - VGASetPal(initcolors, 8); + curInv = MAPNUM; + LastInv = MAPNUM; - WSDL_UpdateScreen(); + Test = getInvName(curInv); - g_system->delayMillis(1000); - } else { - WSDL_UpdateScreen(); - } - } else if (GadID == 1) { - if (!doUse(CurInv)) { - Old = ActionMode; - ActionMode = 5; /* Use button */ + drawPanel(); - if (Old < 5) - perFlipGadget(Old); + if (doit) { + drawMessage("Disk operation failed."); + VGASetPal(initcolors, 8); - drawStaticMessage(kTextUseOnWhat); - MainDisplay = true; + WSDL_UpdateScreen(); - WSDL_UpdateScreen(); - } - } else if (GadID == 2) { - MainDisplay = !MainDisplay; + g_system->delayMillis(1000); + } else { + WSDL_UpdateScreen(); + } + } else if (gadgetId == 1) { + if (!doUse(curInv)) { + Old = actionMode; + actionMode = 5; /* Use button */ - if ((CurInv == 0) || (CurInv > NumInv)) { - CurInv = 1; + if (Old < 5) + perFlipGadget(Old); - while ((CurInv <= NumInv) && (!_conditions->in(CurInv))) - CurInv++; - } + drawStaticMessage(kTextUseOnWhat); + MainDisplay = true; - if ((CurInv <= NumInv) && _conditions->in(CurInv) && - Inventory[CurInv].BInvName) - Test = getInvName(CurInv); + WSDL_UpdateScreen(); + } + } else if (gadgetId == 2) { + MainDisplay = !MainDisplay; - WSDL_UpdateScreen(); - } else if (GadID == 3) { /* Left gadget */ - decIncInv(&CurInv, true); - LastInv = CurInv; - DoNotDrawMessage = false; - drawRoomMessage(CurInv, CPtr); + if ((curInv == 0) || (curInv > NumInv)) { + curInv = 1; - WSDL_UpdateScreen(); - } else if (GadID == 4) { /* Right gadget */ - decIncInv(&CurInv, false); - LastInv = CurInv; - DoNotDrawMessage = false; - drawRoomMessage(CurInv, CPtr); + while ((curInv <= NumInv) && (!_conditions->in(curInv))) + curInv++; + } - WSDL_UpdateScreen(); - } else if (GadID == 5) { /* bread crumbs */ - _breadCrumbs[0]._roomNum = 0; - _numCrumbs = 0; - _droppingCrumbs = true; - mayShowCrumbIndicator(); - WSDL_UpdateScreen(); - } else if (GadID == 6) { /* follow crumbs */ - if (_droppingCrumbs) { - if (_numCrumbs > 0) { - _followingCrumbs = true; - _followCrumbsFast = false; - _isCrumbTurning = false; - _isCrumbWaiting = false; - getTime(&_crumbSecs, &_crumbMicros); - - eatMessages(); - Alternate = false; - DoBlack = true; - DoNotDrawMessage = false; - - MainDisplay = true; - interfaceOn(); /* Sets the correct gadget list */ - drawPanel(); - drawRoomMessage(CurInv, CPtr); - WSDL_UpdateScreen(); - } else { - _breadCrumbs[0]._roomNum = 0; - _droppingCrumbs = false; - - // Need to hide indicator!!!! - mayShowCrumbIndicatorOff(); - WSDL_UpdateScreen(); - } - } - } - } else if ((Class == MOUSEBUTTONS) && (IEQUALIFIER_LEFTBUTTON & Qualifier) && MainDisplay) { - interfaceOff(); - MainDisplay = true; + if ((curInv <= NumInv) && _conditions->in(curInv) && + Inventory[curInv].BInvName) + Test = getInvName(curInv); - doit = false; + WSDL_UpdateScreen(); + } else if (gadgetId == 3) { /* Left gadget */ + decIncInv(&curInv, true); + LastInv = curInv; + DoNotDrawMessage = false; + drawRoomMessage(curInv, CPtr); - if (CPtr) { - if ((CPtr->CloseUpType == SPECIALLOCK) && MainDisplay) /* LAB: Labyrinth specific code */ - mouseCombination(curPos); - else if ((CPtr->CloseUpType == SPECIALBRICK) && MainDisplay) - mouseTile(curPos); - else - doit = true; - } else - doit = true; + WSDL_UpdateScreen(); + } else if (gadgetId == 4) { /* Right gadget */ + decIncInv(&curInv, false); + LastInv = curInv; + DoNotDrawMessage = false; + drawRoomMessage(curInv, CPtr); + WSDL_UpdateScreen(); + } else if (gadgetId == 5) { /* bread crumbs */ + _breadCrumbs[0]._roomNum = 0; + _numCrumbs = 0; + _droppingCrumbs = true; + mayShowCrumbIndicator(); + WSDL_UpdateScreen(); + } else if (gadgetId == 6) { /* follow crumbs */ + if (_droppingCrumbs) { + if (_numCrumbs > 0) { + _followingCrumbs = true; + _followCrumbsFast = false; + _isCrumbTurning = false; + _isCrumbWaiting = false; + getTime(&_crumbSecs, &_crumbMicros); - if (doit) { - HCPtr = NULL; eatMessages(); + Alternate = false; + DoBlack = true; + DoNotDrawMessage = false; - if (ActionMode == 0) { /* Take something. */ - if (doActionRule(Common::Point(curPos.x, curPos.y), ActionMode, _roomNum, &CPtr)) - CurFileName = NewFileName; - else if (takeItem(curPos.x, curPos.y, &CPtr)) - drawStaticMessage(kTextTakeItem); - else if (doActionRule(curPos, TAKEDEF - 1, _roomNum, &CPtr)) - CurFileName = NewFileName; - else if (doActionRule(curPos, TAKE - 1, 0, &CPtr)) - CurFileName = NewFileName; - else if (curPos.y < (VGAScaleY(149) + SVGACord(2))) - drawStaticMessage(kTextNothing); - } else if ((ActionMode == 1) /* Manipulate an object */ || - (ActionMode == 2) /* Open up a "door" */ || - (ActionMode == 3)) { /* Close a "door" */ - if (doActionRule(curPos, ActionMode, _roomNum, &CPtr)) - CurFileName = NewFileName; - else if (!doActionRule(curPos, ActionMode, 0, &CPtr)) { - if (curPos.y < (VGAScaleY(149) + SVGACord(2))) - drawStaticMessage(kTextNothing); - } - } else if (ActionMode == 4) { /* Look at closeups */ - TempCPtr = CPtr; - setCurClose(curPos, &TempCPtr); - - if (CPtr == TempCPtr) { - if (curPos.y < (VGAScaleY(149) + SVGACord(2))) - drawStaticMessage(kTextNothing); - } else if (TempCPtr->GraphicName) { - if (*(TempCPtr->GraphicName)) { - DoBlack = true; - CPtr = TempCPtr; - } else if (curPos.y < (VGAScaleY(149) + SVGACord(2))) - drawStaticMessage(kTextNothing); - } else if (curPos.y < (VGAScaleY(149) + SVGACord(2))) - drawStaticMessage(kTextNothing); - } else if ((ActionMode == 5) && - _conditions->in(CurInv)) { /* Use an item on something else */ - if (doOperateRule(curPos.x, curPos.y, CurInv, &CPtr)) { - CurFileName = NewFileName; - - if (!_conditions->in(CurInv)) - decIncInv(&CurInv, false); - } else if (curPos.y < (VGAScaleY(149) + SVGACord(2))) - drawStaticMessage(kTextNothing); - } - } - - mayShowCrumbIndicator(); - WSDL_UpdateScreen(); - } else if (Class == DELTAMOVE) { - VPtr = getViewData(_roomNum, Direction); - OldCPtr = VPtr->closeUps; - - if (HCPtr == NULL) { - TempCPtr = CPtr; - setCurClose(curPos, &TempCPtr); - - if ((TempCPtr == NULL) || (TempCPtr == CPtr)) { - if (CPtr == NULL) - HCPtr = OldCPtr; - else - HCPtr = CPtr->SubCloseUps; - } else - HCPtr = TempCPtr->NextCloseUp; - } else - HCPtr = HCPtr->NextCloseUp; - + MainDisplay = true; + interfaceOn(); /* Sets the correct gadget list */ + drawPanel(); + drawRoomMessage(curInv, CPtr); + WSDL_UpdateScreen(); + } else { + _breadCrumbs[0]._roomNum = 0; + _droppingCrumbs = false; - if (HCPtr == NULL) { - if (CPtr == NULL) - HCPtr = OldCPtr; - else - HCPtr = CPtr->SubCloseUps; + // Need to hide indicator!!!! + mayShowCrumbIndicatorOff(); + WSDL_UpdateScreen(); } + } + } + } else if ((msgClass == MOUSEBUTTONS) && (IEQUALIFIER_LEFTBUTTON & Qualifier) && MainDisplay) { + interfaceOff(); + MainDisplay = true; - if (HCPtr) - _event->setMousePos(Common::Point(scaleX((HCPtr->x1 + HCPtr->x2) / 2), scaleY((HCPtr->y1 + HCPtr->y2) / 2))); - } else if ((Class == MOUSEBUTTONS) && (IEQUALIFIER_RBUTTON & Qualifier)) { - eatMessages(); - Alternate = !Alternate; - DoBlack = true; - DoNotDrawMessage = false; - MainDisplay = true; - interfaceOn(); /* Sets the correct gadget list */ + doit = false; - if (Alternate) { - if (LastInv && _conditions->in(LastInv)) - CurInv = LastInv; - else - decIncInv(&CurInv, false); + if (CPtr) { + if ((CPtr->CloseUpType == SPECIALLOCK) && MainDisplay) /* LAB: Labyrinth specific code */ + mouseCombination(curPos); + else if ((CPtr->CloseUpType == SPECIALBRICK) && MainDisplay) + mouseTile(curPos); + else + doit = true; + } else + doit = true; + + + if (doit) { + HCPtr = NULL; + eatMessages(); + + if (actionMode == 0) { /* Take something. */ + if (doActionRule(Common::Point(curPos.x, curPos.y), actionMode, _roomNum, &CPtr)) + CurFileName = NewFileName; + else if (takeItem(curPos.x, curPos.y, &CPtr)) + drawStaticMessage(kTextTakeItem); + else if (doActionRule(curPos, TAKEDEF - 1, _roomNum, &CPtr)) + CurFileName = NewFileName; + else if (doActionRule(curPos, TAKE - 1, 0, &CPtr)) + CurFileName = NewFileName; + else if (curPos.y < (VGAScaleY(149) + SVGACord(2))) + drawStaticMessage(kTextNothing); + } else if ((actionMode == 1) /* Manipulate an object */ || + (actionMode == 2) /* Open up a "door" */ || + (actionMode == 3)) { /* Close a "door" */ + if (doActionRule(curPos, actionMode, _roomNum, &CPtr)) + CurFileName = NewFileName; + else if (!doActionRule(curPos, actionMode, 0, &CPtr)) { + if (curPos.y < (VGAScaleY(149) + SVGACord(2))) + drawStaticMessage(kTextNothing); } - - drawPanel(); - drawRoomMessage(CurInv, CPtr); - - mayShowCrumbIndicator(); - WSDL_UpdateScreen(); + } else if (actionMode == 4) { /* Look at closeups */ + TempCPtr = CPtr; + setCurClose(curPos, &TempCPtr); + + if (CPtr == TempCPtr) { + if (curPos.y < (VGAScaleY(149) + SVGACord(2))) + drawStaticMessage(kTextNothing); + } else if (TempCPtr->GraphicName) { + if (*(TempCPtr->GraphicName)) { + DoBlack = true; + CPtr = TempCPtr; + } else if (curPos.y < (VGAScaleY(149) + SVGACord(2))) + drawStaticMessage(kTextNothing); + } else if (curPos.y < (VGAScaleY(149) + SVGACord(2))) + drawStaticMessage(kTextNothing); + } else if ((actionMode == 5) && + _conditions->in(curInv)) { /* Use an item on something else */ + if (doOperateRule(curPos.x, curPos.y, curInv, &CPtr)) { + CurFileName = NewFileName; + + if (!_conditions->in(curInv)) + decIncInv(&curInv, false); + } else if (curPos.y < (VGAScaleY(149) + SVGACord(2))) + drawStaticMessage(kTextNothing); } } - } - delete _conditions; - delete _roomsFound; + mayShowCrumbIndicator(); + WSDL_UpdateScreen(); + } else if (msgClass == DELTAMOVE) { + VPtr = getViewData(_roomNum, Direction); + OldCPtr = VPtr->closeUps; + + if (HCPtr == NULL) { + TempCPtr = CPtr; + setCurClose(curPos, &TempCPtr); + + if ((TempCPtr == NULL) || (TempCPtr == CPtr)) { + if (CPtr == NULL) + HCPtr = OldCPtr; + else + HCPtr = CPtr->SubCloseUps; + } else + HCPtr = TempCPtr->NextCloseUp; + } else + HCPtr = HCPtr->NextCloseUp; - if (_rooms) { - free(_rooms); - _rooms = nullptr; - } - if (Inventory) { - for (code = 1; code <= NumInv; code++) { - if (Inventory[code].name) - free(Inventory[code].name); + if (HCPtr == NULL) { + if (CPtr == NULL) + HCPtr = OldCPtr; + else + HCPtr = CPtr->SubCloseUps; + } - if (Inventory[code].BInvName) - free(Inventory[code].BInvName); + if (HCPtr) + _event->setMousePos(Common::Point(scaleX((HCPtr->x1 + HCPtr->x2) / 2), scaleY((HCPtr->y1 + HCPtr->y2) / 2))); + } else if ((msgClass == MOUSEBUTTONS) && (IEQUALIFIER_RBUTTON & Qualifier)) { + eatMessages(); + Alternate = !Alternate; + DoBlack = true; + DoNotDrawMessage = false; + MainDisplay = true; + interfaceOn(); /* Sets the correct gadget list */ + + if (Alternate) { + if (LastInv && _conditions->in(LastInv)) + curInv = LastInv; + else + decIncInv(&curInv, false); } - free(Inventory); + drawPanel(); + drawRoomMessage(curInv, CPtr); + + mayShowCrumbIndicator(); + WSDL_UpdateScreen(); } + return true; } void LabEngine::go() { diff --git a/engines/lab/lab.h b/engines/lab/lab.h index b2ec4b1c26..f403e4596d 100644 --- a/engines/lab/lab.h +++ b/engines/lab/lab.h @@ -131,6 +131,7 @@ private: private: bool createScreen(bool HiRes); + bool from_crumbs(uint32 tmpClass, uint16 code, uint16 Qualifier, Common::Point tmpPos, uint16 &curInv, IntuiMessage * curMsg, bool &forceDraw, uint16 gadgetId, uint16 &actionMode); public: void waitTOF(); -- cgit v1.2.3 From 8dbdc70de4b7819186620079bbb6a175d058f5e8 Mon Sep 17 00:00:00 2001 From: Strangerke Date: Mon, 30 Nov 2015 14:12:06 +0100 Subject: LAB: Fix stopDiffEnd. This fixes the intro (between others) --- engines/lab/readdiff.cpp | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/engines/lab/readdiff.cpp b/engines/lab/readdiff.cpp index 926ef359f9..bfe574a378 100644 --- a/engines/lab/readdiff.cpp +++ b/engines/lab/readdiff.cpp @@ -36,6 +36,8 @@ namespace Lab { static bool PlayOnce = false; +static bool StopPlayingEnd = false; + static uint32 header, size, WaitSec = 0L, WaitMicros = 0L, DelayMicros = 0L; static uint16 CurBit = 0, framenumber = 0, samplespeed, numchunks = 1; static byte *Buffer, temp[5]; @@ -249,7 +251,7 @@ void LabEngine::diffNextFrame() { break; } case 65535L: - if ((framenumber == 1) || PlayOnce) { + if ((framenumber == 1) || PlayOnce || StopPlayingEnd) { int didTOF = 0; if (waitForEffect) { @@ -294,6 +296,7 @@ void playDiff() { framenumber = 0; numchunks = 1; donepal = false; + StopPlayingEnd = false; difffile = &storagefordifffile; IsPlaying = true; @@ -385,13 +388,12 @@ void stopDiff() { } } - - /*****************************************************************************/ /* Stops an animation from running. */ /*****************************************************************************/ void stopDiffEnd() { if (IsPlaying) { + StopPlayingEnd = true; while (IsPlaying) { g_lab->_music->updateMusic(); g_lab->diffNextFrame(); -- cgit v1.2.3 From 6d4b71e2ce21aa9843aa90522e972a95f3966bd6 Mon Sep 17 00:00:00 2001 From: Eugene Sandulenko Date: Mon, 30 Nov 2015 20:07:23 +0100 Subject: LAB: Renames in vga.cpp --- engines/lab/engine.cpp | 62 ++++++++++++++++++++++----------------------- engines/lab/graphics.cpp | 12 ++++----- engines/lab/interface.cpp | 4 +-- engines/lab/intro.cpp | 2 +- engines/lab/lab.h | 12 ++++----- engines/lab/map.cpp | 6 ++--- engines/lab/mouse.cpp | 6 ++--- engines/lab/music.cpp | 2 +- engines/lab/processroom.cpp | 6 ++--- engines/lab/readdiff.cpp | 8 +++--- engines/lab/special.cpp | 10 ++++---- engines/lab/vga.cpp | 26 +++++++++---------- 12 files changed, 78 insertions(+), 78 deletions(-) diff --git a/engines/lab/engine.cpp b/engines/lab/engine.cpp index 7d67241513..b7970ae171 100644 --- a/engines/lab/engine.cpp +++ b/engines/lab/engine.cpp @@ -516,7 +516,7 @@ bool LabEngine::doUse(uint16 CurInv) { CurFileName = " "; CPtr = NULL; doMap(_roomNum); - VGASetPal(initcolors, 8); + setPalette(initcolors, 8); drawMessage(NULL); drawPanel(); } else if (CurInv == JOURNALNUM) { /* LAB: Labyrinth specific */ @@ -623,7 +623,7 @@ void LabEngine::mainGameLoop() { bool forceDraw = false, GotMessage = true; - VGASetPal(initcolors, 8); + setPalette(initcolors, 8); CPtr = NULL; _roomNum = 1; @@ -648,7 +648,7 @@ void LabEngine::mainGameLoop() { /* Set up initial picture. */ while (1) { - WSDL_ProcessInput(1); + processInput(true); if (GotMessage) { if (QuitLab || g_engine->shouldQuit()) { @@ -663,7 +663,7 @@ void LabEngine::mainGameLoop() { CPtr = NULL; mayShowCrumbIndicator(); - WSDL_UpdateScreen(); + screenUpdate(); } /* Sets the current picture properly on the screen */ @@ -699,7 +699,7 @@ void LabEngine::mainGameLoop() { forceDraw = false; mayShowCrumbIndicator(); - WSDL_UpdateScreen(); + screenUpdate(); if (!_followingCrumbs) eatMessages(); @@ -708,7 +708,7 @@ void LabEngine::mainGameLoop() { if (forceDraw) { drawRoomMessage(curInv, CPtr); forceDraw = false; - WSDL_UpdateScreen(); + screenUpdate(); } } @@ -736,14 +736,14 @@ void LabEngine::mainGameLoop() { GotMessage = true; mayShowCrumbIndicator(); - WSDL_UpdateScreen(); + screenUpdate(); if (!from_crumbs(GADGETUP, code, 0, WSDL_GetMousePos(), curInv, curMsg, forceDraw, code, actionMode)) break; } } mayShowCrumbIndicator(); - WSDL_UpdateScreen(); + screenUpdate(); } else { GotMessage = true; @@ -803,7 +803,7 @@ bool LabEngine::from_crumbs(uint32 tmpClass, uint16 code, uint16 Qualifier, Comm _numCrumbs = 0; _droppingCrumbs = true; mayShowCrumbIndicator(); - WSDL_UpdateScreen(); + screenUpdate(); } else if (code == 'f' || code == 'F' || code == 'r' || code == 'R') { /* Follow bread crumbs */ if (_droppingCrumbs) { @@ -824,7 +824,7 @@ bool LabEngine::from_crumbs(uint32 tmpClass, uint16 code, uint16 Qualifier, Comm interfaceOn(); /* Sets the correct gadget list */ drawPanel(); drawRoomMessage(curInv, CPtr); - WSDL_UpdateScreen(); + screenUpdate(); } } else { _breadCrumbs[0]._roomNum = 0; @@ -832,7 +832,7 @@ bool LabEngine::from_crumbs(uint32 tmpClass, uint16 code, uint16 Qualifier, Comm // Need to hide indicator!!!! mayShowCrumbIndicatorOff(); - WSDL_UpdateScreen(); + screenUpdate(); } } } else if ((code == 315) || (code == 'x') || (code == 'X') @@ -889,7 +889,7 @@ bool LabEngine::from_crumbs(uint32 tmpClass, uint16 code, uint16 Qualifier, Comm DoNotDrawMessage = false; drawPanel(); drawRoomMessage(curInv, CPtr); - WSDL_UpdateScreen(); + screenUpdate(); } } else if ((msgClass == GADGETUP) && !Alternate) { if (gadgetId <= 5) { @@ -900,7 +900,7 @@ bool LabEngine::from_crumbs(uint32 tmpClass, uint16 code, uint16 Qualifier, Comm HCPtr = NULL; CPtr = NULL; mayShowCrumbIndicator(); - WSDL_UpdateScreen(); + screenUpdate(); } else if (gadgetId == 5) { eatMessages(); @@ -921,7 +921,7 @@ bool LabEngine::from_crumbs(uint32 tmpClass, uint16 code, uint16 Qualifier, Comm drawRoomMessage(curInv, CPtr); mayShowCrumbIndicator(); - WSDL_UpdateScreen(); + screenUpdate(); } else { Old = actionMode; actionMode = gadgetId; @@ -942,13 +942,13 @@ bool LabEngine::from_crumbs(uint32 tmpClass, uint16 code, uint16 Qualifier, Comm else if (gadgetId == 4) drawStaticMessage(kTextLookWhat); - WSDL_UpdateScreen(); + screenUpdate(); } } else if (gadgetId == 9) { doUse(MAPNUM); mayShowCrumbIndicator(); - WSDL_UpdateScreen(); + screenUpdate(); } else if (gadgetId >= 6) { /* Arrow Gadgets */ CPtr = NULL; HCPtr = NULL; @@ -971,7 +971,7 @@ bool LabEngine::from_crumbs(uint32 tmpClass, uint16 code, uint16 Qualifier, Comm forceDraw = true; mayShowCrumbIndicator(); - WSDL_UpdateScreen(); + screenUpdate(); } else if (gadgetId == 7) { OldRoomNum = _roomNum; @@ -1035,7 +1035,7 @@ bool LabEngine::from_crumbs(uint32 tmpClass, uint16 code, uint16 Qualifier, Comm } mayShowCrumbIndicator(); - WSDL_UpdateScreen(); + screenUpdate(); } } } else if ((msgClass == GADGETUP) && Alternate) { @@ -1052,7 +1052,7 @@ bool LabEngine::from_crumbs(uint32 tmpClass, uint16 code, uint16 Qualifier, Comm drawPanel(); drawRoomMessage(curInv, CPtr); - WSDL_UpdateScreen(); + screenUpdate(); } gadgetId--; @@ -1076,13 +1076,13 @@ bool LabEngine::from_crumbs(uint32 tmpClass, uint16 code, uint16 Qualifier, Comm if (doit) { drawMessage("Disk operation failed."); - VGASetPal(initcolors, 8); + setPalette(initcolors, 8); - WSDL_UpdateScreen(); + screenUpdate(); g_system->delayMillis(1000); } else { - WSDL_UpdateScreen(); + screenUpdate(); } } else if (gadgetId == 1) { if (!doUse(curInv)) { @@ -1095,7 +1095,7 @@ bool LabEngine::from_crumbs(uint32 tmpClass, uint16 code, uint16 Qualifier, Comm drawStaticMessage(kTextUseOnWhat); MainDisplay = true; - WSDL_UpdateScreen(); + screenUpdate(); } } else if (gadgetId == 2) { MainDisplay = !MainDisplay; @@ -1111,27 +1111,27 @@ bool LabEngine::from_crumbs(uint32 tmpClass, uint16 code, uint16 Qualifier, Comm Inventory[curInv].BInvName) Test = getInvName(curInv); - WSDL_UpdateScreen(); + screenUpdate(); } else if (gadgetId == 3) { /* Left gadget */ decIncInv(&curInv, true); LastInv = curInv; DoNotDrawMessage = false; drawRoomMessage(curInv, CPtr); - WSDL_UpdateScreen(); + screenUpdate(); } else if (gadgetId == 4) { /* Right gadget */ decIncInv(&curInv, false); LastInv = curInv; DoNotDrawMessage = false; drawRoomMessage(curInv, CPtr); - WSDL_UpdateScreen(); + screenUpdate(); } else if (gadgetId == 5) { /* bread crumbs */ _breadCrumbs[0]._roomNum = 0; _numCrumbs = 0; _droppingCrumbs = true; mayShowCrumbIndicator(); - WSDL_UpdateScreen(); + screenUpdate(); } else if (gadgetId == 6) { /* follow crumbs */ if (_droppingCrumbs) { if (_numCrumbs > 0) { @@ -1150,14 +1150,14 @@ bool LabEngine::from_crumbs(uint32 tmpClass, uint16 code, uint16 Qualifier, Comm interfaceOn(); /* Sets the correct gadget list */ drawPanel(); drawRoomMessage(curInv, CPtr); - WSDL_UpdateScreen(); + screenUpdate(); } else { _breadCrumbs[0]._roomNum = 0; _droppingCrumbs = false; // Need to hide indicator!!!! mayShowCrumbIndicatorOff(); - WSDL_UpdateScreen(); + screenUpdate(); } } } @@ -1230,7 +1230,7 @@ bool LabEngine::from_crumbs(uint32 tmpClass, uint16 code, uint16 Qualifier, Comm } mayShowCrumbIndicator(); - WSDL_UpdateScreen(); + screenUpdate(); } else if (msgClass == DELTAMOVE) { VPtr = getViewData(_roomNum, Direction); OldCPtr = VPtr->closeUps; @@ -1278,7 +1278,7 @@ bool LabEngine::from_crumbs(uint32 tmpClass, uint16 code, uint16 Qualifier, Comm drawRoomMessage(curInv, CPtr); mayShowCrumbIndicator(); - WSDL_UpdateScreen(); + screenUpdate(); } return true; } diff --git a/engines/lab/graphics.cpp b/engines/lab/graphics.cpp index 54bf8809d1..460d4d5864 100644 --- a/engines/lab/graphics.cpp +++ b/engines/lab/graphics.cpp @@ -465,7 +465,7 @@ void LabEngine::doScrollBlack() { g_lab->setAPen(0); g_lab->rectFill(0, nheight, width - 1, nheight + by - 1); - g_lab->WSDL_UpdateScreen(); + g_lab->screenUpdate(); if (!_isHiRes) { if (nheight <= (height / 8)) @@ -530,7 +530,7 @@ void LabEngine::doScrollWipe(char *filename) { IsBM = true; readPict(filename, true); - g_lab->VGASetPal(diffcmap, 256); + g_lab->setPalette(diffcmap, 256); IsBM = false; mem = RawDiffBM.Planes[0]; @@ -552,7 +552,7 @@ void LabEngine::doScrollWipe(char *filename) { copyPage(width, height, nheight, startline, mem); - g_lab->WSDL_UpdateScreen(); + g_lab->screenUpdate(); if (!nheight) startline += by; @@ -601,7 +601,7 @@ void LabEngine::doScrollBounce() { startline -= newby[i]; copyPage(width, height, 0, startline, mem); - g_lab->WSDL_UpdateScreen(); + g_lab->screenUpdate(); g_lab->waitTOF(); } @@ -610,7 +610,7 @@ void LabEngine::doScrollBounce() { startline += newby1[i - 1]; copyPage(width, height, 0, startline, mem); - g_lab->WSDL_UpdateScreen(); + g_lab->screenUpdate(); g_lab->waitTOF(); } @@ -675,7 +675,7 @@ void LabEngine::doTransWipe(CloseDataPtr *CPtr, char *filename) { CurFileName = getPictName(CPtr); byte *BitMapMem = readPictToMem(CurFileName, g_lab->_screenWidth, LastY + 5); - g_lab->VGASetPal(diffcmap, 256); + g_lab->setPalette(diffcmap, 256); if (BitMapMem) { ImSource.Width = g_lab->_screenWidth; diff --git a/engines/lab/interface.cpp b/engines/lab/interface.cpp index d9ea4595e8..a31e2894a8 100644 --- a/engines/lab/interface.cpp +++ b/engines/lab/interface.cpp @@ -155,8 +155,8 @@ Gadget *LabEngine::checkNumGadgetHit(Gadget *gadlist, uint16 key) { /* Checks whether or not a key has been pressed. */ /*****************************************************************************/ static bool keyPress(uint16 *KeyCode) { - if (g_lab->WSDL_HasNextChar()) { - *KeyCode = g_lab->WSDL_GetNextChar(); + if (g_lab->haveNextChar()) { + *KeyCode = g_lab->getNextChar(); return true; } diff --git a/engines/lab/intro.cpp b/engines/lab/intro.cpp index 7660b29a58..b556501b17 100644 --- a/engines/lab/intro.cpp +++ b/engines/lab/intro.cpp @@ -400,7 +400,7 @@ void Intro::introSequence() { g_lab->_music->updateMusic(); g_lab->waitTOF(); - g_lab->VGASetPal(diffcmap, 256); + g_lab->setPalette(diffcmap, 256); g_lab-> waitTOF(); g_lab->waitTOF(); } diff --git a/engines/lab/lab.h b/engines/lab/lab.h index f403e4596d..7cca82512f 100644 --- a/engines/lab/lab.h +++ b/engines/lab/lab.h @@ -139,19 +139,19 @@ public: void writeColorRegs(byte *buf, uint16 first, uint16 numreg); byte *getVGABaseAddr(); void readScreenImage(Image *Im, uint16 x, uint16 y); - void WSDL_UpdateScreen(); + void screenUpdate(); void rectFill(uint16 x1, uint16 y1, uint16 x2, uint16 y2); void scrollDisplayX(int16 dx, uint16 x1, uint16 y1, uint16 x2, uint16 y2); void scrollDisplayY(int16 dy, uint16 x1, uint16 y1, uint16 x2, uint16 y2); void ghoastRect(uint16 pencolor, uint16 x1, uint16 y1, uint16 x2, uint16 y2); void bltBitMap(Image *ImSource, uint16 xs, uint16 ys, Image *ImDest, uint16 xd, uint16 yd, uint16 width, uint16 height); - void VGASetPal(void *cmap, uint16 numcolors); + void setPalette(void *cmap, uint16 numcolors); void drawHLine(uint16 x, uint16 y1, uint16 y2); void drawVLine(uint16 x1, uint16 y, uint16 x2); void drawImage(Image *Im, uint16 x, uint16 y); - bool WSDL_HasNextChar(); - uint16 WSDL_GetNextChar(); - void WSDL_ProcessInput(bool can_delay); + bool haveNextChar(); + uint16 getNextChar(); + void processInput(bool can_delay = false); void writeColorReg(byte *buf, uint16 regnum); void writeColorRegsSmooth(byte *buf, uint16 first, uint16 numreg); @@ -192,7 +192,7 @@ private: void drawMaskImage(Image *Im, uint16 x, uint16 y); Common::Point WSDL_GetMousePos(); void changeVolume(int delta); - void WSDL_SetColors(byte *buf, uint16 first, uint16 numreg, uint16 slow); + void applyPalette(byte *buf, uint16 first, uint16 numreg, uint16 slow); // engine.cpp bool setUpScreens(); diff --git a/engines/lab/map.cpp b/engines/lab/map.cpp index 859d1ffa2f..2db36103b5 100644 --- a/engines/lab/map.cpp +++ b/engines/lab/map.cpp @@ -820,7 +820,7 @@ void LabEngine::processMap(uint16 CurRoom) { } } - WSDL_UpdateScreen(); + screenUpdate(); } } } @@ -848,7 +848,7 @@ void LabEngine::doMap(uint16 CurRoom) { drawMap(CurRoom, CurRoom, Maps[CurRoom].PageNumber, false, true); _event->mouseShow(); _event->attachGadgetList(MapGadgetList); - WSDL_UpdateScreen(); + screenUpdate(); processMap(CurRoom); _event->attachGadgetList(NULL); fade(false, 0); @@ -859,7 +859,7 @@ void LabEngine::doMap(uint16 CurRoom) { freeMapData(); blackAllScreen(); _event->mouseShow(); - WSDL_UpdateScreen(); + screenUpdate(); } } // End of namespace Lab diff --git a/engines/lab/mouse.cpp b/engines/lab/mouse.cpp index eeae317f22..a7e62968ec 100644 --- a/engines/lab/mouse.cpp +++ b/engines/lab/mouse.cpp @@ -150,7 +150,7 @@ void EventManager::updateMouse() { } if (doUpdateDisplay) - _vm->WSDL_UpdateScreen(); + _vm->screenUpdate(); } @@ -173,7 +173,7 @@ void EventManager::mouseShow() { NumHidden--; if ((NumHidden == 0) && MouseHidden) { - _vm->WSDL_ProcessInput(0); + _vm->processInput(); MouseHidden = false; } @@ -215,7 +215,7 @@ void EventManager::setMousePos(Common::Point pos) { g_system->warpMouse(pos.x * 2, pos.y); if (!MouseHidden) - _vm->WSDL_ProcessInput(0); + _vm->processInput(); } diff --git a/engines/lab/music.cpp b/engines/lab/music.cpp index 1f99a687be..b6587ebf1b 100644 --- a/engines/lab/music.cpp +++ b/engines/lab/music.cpp @@ -69,7 +69,7 @@ Music::Music(LabEngine *vm) : _vm(vm) { /* it from the Audio device. */ /*****************************************************************************/ void Music::updateMusic() { - _vm->WSDL_ProcessInput(0); + _vm->processInput(); _vm->_event->updateMouse(); diff --git a/engines/lab/processroom.cpp b/engines/lab/processroom.cpp index 8453fe65bb..87a56b0be3 100644 --- a/engines/lab/processroom.cpp +++ b/engines/lab/processroom.cpp @@ -482,7 +482,7 @@ static void doActions(Action * APtr, CloseDataPtr *LCPtr) { case WAITSECS: g_lab->addCurTime(APtr->Param1, 0, &StartSecs, &StartMicros); - g_lab->WSDL_UpdateScreen(); + g_lab->screenUpdate(); while (1) { g_lab->_music->updateMusic(); @@ -566,7 +566,7 @@ static void doActions(Action * APtr, CloseDataPtr *LCPtr) { diffcmap[idx] = 255 - diffcmap[idx]; g_lab->waitTOF(); - g_lab->VGASetPal(diffcmap, 256); + g_lab->setPalette(diffcmap, 256); g_lab->waitTOF(); g_lab->waitTOF(); } else if (APtr->Param1 == 4) { /* white the palette */ @@ -575,7 +575,7 @@ static void doActions(Action * APtr, CloseDataPtr *LCPtr) { g_lab->waitTOF(); } else if (APtr->Param1 == 6) { /* Restore the palette */ g_lab->waitTOF(); - g_lab->VGASetPal(diffcmap, 256); + g_lab->setPalette(diffcmap, 256); g_lab->waitTOF(); g_lab->waitTOF(); } else if (APtr->Param1 == 7) { /* Quick pause */ diff --git a/engines/lab/readdiff.cpp b/engines/lab/readdiff.cpp index bfe574a378..9e87ad9526 100644 --- a/engines/lab/readdiff.cpp +++ b/engines/lab/readdiff.cpp @@ -140,7 +140,7 @@ void LabEngine::diffNextFrame() { } if (IsPal && !nopalchange) { - VGASetPal(diffcmap, 256); + setPalette(diffcmap, 256); IsPal = false; } @@ -148,7 +148,7 @@ void LabEngine::diffNextFrame() { } if (IsPal && !nopalchange && !IsBM && !donepal) { - VGASetPal(diffcmap, 256); + setPalette(diffcmap, 256); IsPal = false; } @@ -163,7 +163,7 @@ void LabEngine::diffNextFrame() { CurBit = 0; if (DispBitMap->Flags & BITMAPF_VIDEO) - WSDL_UpdateScreen(); + screenUpdate(); return; /* done with the next frame. */ } @@ -268,7 +268,7 @@ void LabEngine::diffNextFrame() { _event->mouseShow(); if (!didTOF) - WSDL_UpdateScreen(); + screenUpdate(); return; } diff --git a/engines/lab/special.cpp b/engines/lab/special.cpp index e3d1541814..f350a5cea0 100644 --- a/engines/lab/special.cpp +++ b/engines/lab/special.cpp @@ -162,7 +162,7 @@ void showCombination(const char *filename) { doCombination(); - g_lab->VGASetPal(diffcmap, 256); + g_lab->setPalette(diffcmap, 256); } @@ -313,7 +313,7 @@ void showTile(const char *filename, bool showsolution) { doTile(showsolution); - g_lab->VGASetPal(diffcmap, 256); + g_lab->setPalette(diffcmap, 256); } static void scrollRaster(int16 dx, int16 dy, uint16 x1, uint16 y1, uint16 x2, uint16 y2) { @@ -471,7 +471,7 @@ void doNotes() { flowText(BigMsgFont, -2 + SVGACord(1), 0, 0, false, false, true, true, VGAScaleX(25) + SVGACord(15), VGAScaleY(50), VGAScaleX(295) - SVGACord(15), VGAScaleY(148), ntext); - g_lab->VGASetPal(diffcmap, 256); + g_lab->setPalette(diffcmap, 256); freeAllStolenMem(); } @@ -533,7 +533,7 @@ void doWestPaper() { CharsPrinted = flowText(BigMsgFont, -4, 0, 0, false, false, false, true, VGAScaleX(162), VGAScaleY(y), VGAScaleX(275), VGAScaleY(148), ntext); - g_lab->VGASetPal(diffcmap, 256); + g_lab->setPalette(diffcmap, 256); freeAllStolenMem(); } @@ -841,7 +841,7 @@ bool saveRestoreGame() { } } - g_lab->WSDL_UpdateScreen(); + g_lab->screenUpdate(); return isOK; } diff --git a/engines/lab/vga.cpp b/engines/lab/vga.cpp index d3071649c4..bb313e18b4 100644 --- a/engines/lab/vga.cpp +++ b/engines/lab/vga.cpp @@ -63,10 +63,10 @@ void LabEngine::changeVolume(int delta) { warning("STUB: changeVolume()"); } -uint16 LabEngine::WSDL_GetNextChar() { +uint16 LabEngine::getNextChar() { uint16 c = 0; - WSDL_ProcessInput(0); + processInput(); if (_nextKeyIn != _nextKeyOut) { c = _keyBuf[_nextKeyOut]; _nextKeyOut = ((((unsigned int)((_nextKeyOut + 1) >> 31) >> 26) + (byte)_nextKeyOut + 1) & 0x3F) @@ -76,12 +76,12 @@ uint16 LabEngine::WSDL_GetNextChar() { return c; } -bool LabEngine::WSDL_HasNextChar() { - WSDL_ProcessInput(0); +bool LabEngine::haveNextChar() { + processInput(); return _nextKeyIn != _nextKeyOut; } -void LabEngine::WSDL_ProcessInput(bool can_delay) { +void LabEngine::processInput(bool can_delay) { Common::Event event; if (1 /*!g_IgnoreProcessInput*/) { @@ -167,7 +167,7 @@ void LabEngine::WSDL_ProcessInput(bool can_delay) { } Common::Point LabEngine::WSDL_GetMousePos() { - WSDL_ProcessInput(0); + processInput(); return _mousePos; } @@ -176,7 +176,7 @@ void LabEngine::waitTOF() { g_system->copyRectToScreen(_displayBuffer, _screenWidth, 0, 0, _screenWidth, _screenHeight); g_system->updateScreen(); - WSDL_ProcessInput(0); + processInput(); uint32 now; @@ -186,7 +186,7 @@ void LabEngine::waitTOF() { _lastWaitTOFTicks = now; } -void LabEngine::WSDL_SetColors(byte *buf, uint16 first, uint16 numreg, uint16 slow) { +void LabEngine::applyPalette(byte *buf, uint16 first, uint16 numreg, uint16 slow) { byte tmp[256 * 3]; for (int i = 0; i < 256 * 3; i++) { @@ -211,12 +211,12 @@ void LabEngine::WSDL_SetColors(byte *buf, uint16 first, uint16 numreg, uint16 sl /* selected. */ /*****************************************************************************/ void LabEngine::writeColorRegs(byte *buf, uint16 first, uint16 numreg) { - WSDL_SetColors(buf, first, numreg, 0); + applyPalette(buf, first, numreg, 0); memcpy(&(_curvgapal[first * 3]), buf, numreg * 3); } void LabEngine::writeColorRegsSmooth(byte *buf, uint16 first, uint16 numreg) { - WSDL_SetColors(buf, first, numreg, 1); + applyPalette(buf, first, numreg, 1); memcpy(&(_curvgapal[first * 3]), buf, numreg * 3); } @@ -229,16 +229,16 @@ void LabEngine::writeColorReg(byte *buf, uint16 regnum) { writeColorRegs(buf, regnum, 1); } -void LabEngine::VGASetPal(void *cmap, uint16 numcolors) { +void LabEngine::setPalette(void *cmap, uint16 numcolors) { if (memcmp(cmap, _curvgapal, numcolors * 3) != 0) writeColorRegs((byte *)cmap, 0, numcolors); } -void LabEngine::WSDL_UpdateScreen() { +void LabEngine::screenUpdate() { g_system->copyRectToScreen(_displayBuffer, _screenWidth, 0, 0, _screenWidth, _screenHeight); g_system->updateScreen(); - WSDL_ProcessInput(0); + processInput(); } /*****************************************************************************/ -- cgit v1.2.3 From fa8d319e3106f1b8ee5c8ebfcb2e8a8df8ca5bf0 Mon Sep 17 00:00:00 2001 From: Eugene Sandulenko Date: Mon, 30 Nov 2015 20:08:55 +0100 Subject: LAB: More renames --- engines/lab/engine.cpp | 2 +- engines/lab/lab.h | 2 +- engines/lab/vga.cpp | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/engines/lab/engine.cpp b/engines/lab/engine.cpp index b7970ae171..05a219606e 100644 --- a/engines/lab/engine.cpp +++ b/engines/lab/engine.cpp @@ -737,7 +737,7 @@ void LabEngine::mainGameLoop() { GotMessage = true; mayShowCrumbIndicator(); screenUpdate(); - if (!from_crumbs(GADGETUP, code, 0, WSDL_GetMousePos(), curInv, curMsg, forceDraw, code, actionMode)) + if (!from_crumbs(GADGETUP, code, 0, getMousePos(), curInv, curMsg, forceDraw, code, actionMode)) break; } } diff --git a/engines/lab/lab.h b/engines/lab/lab.h index 7cca82512f..0b2e777021 100644 --- a/engines/lab/lab.h +++ b/engines/lab/lab.h @@ -190,7 +190,7 @@ private: /*---------- Drawing Routines ----------*/ void drawMaskImage(Image *Im, uint16 x, uint16 y); - Common::Point WSDL_GetMousePos(); + Common::Point getMousePos(); void changeVolume(int delta); void applyPalette(byte *buf, uint16 first, uint16 numreg, uint16 slow); diff --git a/engines/lab/vga.cpp b/engines/lab/vga.cpp index bb313e18b4..79261dff02 100644 --- a/engines/lab/vga.cpp +++ b/engines/lab/vga.cpp @@ -166,7 +166,7 @@ void LabEngine::processInput(bool can_delay) { g_system->delayMillis(10); } -Common::Point LabEngine::WSDL_GetMousePos() { +Common::Point LabEngine::getMousePos() { processInput(); return _mousePos; -- cgit v1.2.3 From 29fc7a56c1163d2931980e1bec1ab440183ab639 Mon Sep 17 00:00:00 2001 From: Eugene Sandulenko Date: Mon, 30 Nov 2015 20:09:47 +0100 Subject: LAB: Fix warning --- engines/lab/labsets.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/engines/lab/labsets.cpp b/engines/lab/labsets.cpp index edd764668b..ad721fa2db 100644 --- a/engines/lab/labsets.cpp +++ b/engines/lab/labsets.cpp @@ -61,7 +61,7 @@ void LargeSet::exclElement(uint16 element) { bool LargeSet::readInitialConditions(const char *fileName) { Common::File *file; - if (file = _vm->_resource->openDataFile(fileName, MKTAG('C', 'O', 'N', '0'))) { + if ((file = _vm->_resource->openDataFile(fileName, MKTAG('C', 'O', 'N', '0')))) { uint16 conditions = file->readUint16LE(); for (int i = 0; i < conditions; i++) { inclElement(file->readUint16LE()); -- cgit v1.2.3 From 06b8eb856e5150419e4fd2f54fa951829dc278cb Mon Sep 17 00:00:00 2001 From: Eugene Sandulenko Date: Mon, 30 Nov 2015 20:18:11 +0100 Subject: LAB: C++'ify vga.cpp --- engines/lab/vga.cpp | 148 +++++++++++++++++++++++----------------------------- 1 file changed, 66 insertions(+), 82 deletions(-) diff --git a/engines/lab/vga.cpp b/engines/lab/vga.cpp index 79261dff02..48c82b4526 100644 --- a/engines/lab/vga.cpp +++ b/engines/lab/vga.cpp @@ -41,8 +41,8 @@ namespace Lab { /*****************************************************************************/ /* Sets up either a low-res or a high-res 256 color screen. */ /*****************************************************************************/ -bool LabEngine::createScreen(bool HiRes) { - if (HiRes) { +bool LabEngine::createScreen(bool hiRes) { + if (hiRes) { _screenWidth = 640; _screenHeight = 480; } else { @@ -254,15 +254,11 @@ byte *LabEngine::getVGABaseAddr() { /*****************************************************************************/ /* Draws an image to the screen. */ /*****************************************************************************/ -void LabEngine::drawImage(Image *Im, uint16 x, uint16 y) { - int sx, sy, dx, dy, w, h; - - sx = 0; - sy = 0; - dx = x; - dy = y; - w = Im->Width; - h = Im->Height; +void LabEngine::drawImage(Image *im, uint16 x, uint16 y) { + int sx = 0, sy = 0; + int dx = x, dy = y; + int w = im->Width; + int h = im->Height; if (dx < 0) { sx -= dx; @@ -283,12 +279,12 @@ void LabEngine::drawImage(Image *Im, uint16 x, uint16 y) { h = _screenHeight - dy; if ((w > 0) && (h > 0)) { - byte *s = Im->ImageData + sy * Im->Width + sx; + byte *s = im->ImageData + sy * im->Width + sx; byte *d = getVGABaseAddr() + dy * _screenWidth + dx; while (h-- > 0) { memcpy(d, s, w); - s += Im->Width; + s += im->Width; d += _screenWidth; } } @@ -297,15 +293,11 @@ void LabEngine::drawImage(Image *Im, uint16 x, uint16 y) { /*****************************************************************************/ /* Draws an image to the screen. */ /*****************************************************************************/ -void LabEngine::drawMaskImage(Image *Im, uint16 x, uint16 y) { - int sx, sy, dx, dy, w, h; - - sx = 0; - sy = 0; - dx = x; - dy = y; - w = Im->Width; - h = Im->Height; +void LabEngine::drawMaskImage(Image *im, uint16 x, uint16 y) { + int sx = 0, sy = 0; + int dx = x, dy = y; + int w = im->Width; + int h = im->Height; if (dx < 0) { sx -= dx; @@ -326,7 +318,7 @@ void LabEngine::drawMaskImage(Image *Im, uint16 x, uint16 y) { h = _screenHeight - dy; if ((w > 0) && (h > 0)) { - byte *s = Im->ImageData + sy * Im->Width + sx; + byte *s = im->ImageData + sy * im->Width + sx; byte *d = getVGABaseAddr() + dy * _screenWidth + dx; while (h-- > 0) { @@ -341,7 +333,7 @@ void LabEngine::drawMaskImage(Image *Im, uint16 x, uint16 y) { else dd++; } - s += Im->Width; + s += im->Width; d += _screenWidth; } } @@ -350,15 +342,11 @@ void LabEngine::drawMaskImage(Image *Im, uint16 x, uint16 y) { /*****************************************************************************/ /* Reads an image from the screen. */ /*****************************************************************************/ -void LabEngine::readScreenImage(Image *Im, uint16 x, uint16 y) { - int sx, sy, dx, dy, w, h; - - sx = 0; - sy = 0; - dx = x; - dy = y; - w = Im->Width; - h = Im->Height; +void LabEngine::readScreenImage(Image *im, uint16 x, uint16 y) { + int sx = 0, sy = 0; + int dx = x, dy = y; + int w = im->Width; + int h = im->Height; if (dx < 0) { sx -= dx; @@ -379,12 +367,12 @@ void LabEngine::readScreenImage(Image *Im, uint16 x, uint16 y) { h = _screenHeight - dy; if ((w > 0) && (h > 0)) { - byte *s = Im->ImageData + sy * Im->Width + sx; + byte *s = im->ImageData + sy * im->Width + sx; byte *d = getVGABaseAddr() + dy * _screenWidth + dx; while (h-- > 0) { memcpy(s, d, w); - s += Im->Width; + s += im->Width; d += _screenWidth; } } @@ -394,18 +382,16 @@ void LabEngine::readScreenImage(Image *Im, uint16 x, uint16 y) { /* Blits a piece of one image to another. */ /* NOTE: for our purposes, assumes that ImDest is to be in VGA memory. */ /*****************************************************************************/ -void LabEngine::bltBitMap(Image *ImSource, uint16 xs, uint16 ys, Image *ImDest, +void LabEngine::bltBitMap(Image *imSource, uint16 xs, uint16 ys, Image *imDest, uint16 xd, uint16 yd, uint16 width, uint16 height) { // I think the old code assumed that the source image data was valid for the given box. // I will proceed on that assumption. - int sx, sy, dx, dy, w, h; - - sx = xs; - sy = ys; - dx = xd; - dy = yd; - w = width; - h = height; + int sx = xs; + int sy = ys; + int dx = xd; + int dy = yd; + int w = width; + int h = height; if (dx < 0) { sx -= dx; @@ -419,18 +405,20 @@ void LabEngine::bltBitMap(Image *ImSource, uint16 xs, uint16 ys, Image *ImDest, dy = 0; } - if (dx + w > ImDest->Width) w = ImDest->Width - dx; + if (dx + w > imDest->Width) + w = imDest->Width - dx; - if (dy + h > ImDest->Height) h = ImDest->Height - dy; + if (dy + h > imDest->Height) + h = imDest->Height - dy; if (w > 0 && h > 0) { - byte *s = ImSource->ImageData + sy * ImSource->Width + sx; - byte *d = ImDest->ImageData + dy * ImDest->Width + dx; + byte *s = imSource->ImageData + sy * imSource->Width + sx; + byte *d = imDest->ImageData + dy * imDest->Width + dx; while (h-- > 0) { memcpy(d, s, w); - s += ImSource->Width; - d += ImDest->Width; + s += imSource->Width; + d += imDest->Width; } } } @@ -441,10 +429,10 @@ void LabEngine::bltBitMap(Image *ImSource, uint16 xs, uint16 ys, Image *ImDest, /* function will fail. */ /*****************************************************************************/ void LabEngine::scrollDisplayX(int16 dx, uint16 x1, uint16 y1, uint16 x2, uint16 y2) { - Image Im; + Image im; uint16 temp; - Im.ImageData = _tempScrollData; + im.ImageData = _tempScrollData; if (x1 > x2) { temp = x2; @@ -459,20 +447,20 @@ void LabEngine::scrollDisplayX(int16 dx, uint16 x1, uint16 y1, uint16 x2, uint16 } if (dx > 0) { - Im.Width = x2 - x1 + 1 - dx; - Im.Height = y2 - y1 + 1; + im.Width = x2 - x1 + 1 - dx; + im.Height = y2 - y1 + 1; - readScreenImage(&Im, x1, y1); - drawImage(&Im, x1 + dx, y1); + readScreenImage(&im, x1, y1); + drawImage(&im, x1 + dx, y1); setAPen(0); rectFill(x1, y1, x1 + dx - 1, y2); } else if (dx < 0) { - Im.Width = x2 - x1 + 1 + dx; - Im.Height = y2 - y1 + 1; + im.Width = x2 - x1 + 1 + dx; + im.Height = y2 - y1 + 1; - readScreenImage(&Im, x1 - dx, y1); - drawImage(&Im, x1, y1); + readScreenImage(&im, x1 - dx, y1); + drawImage(&im, x1, y1); setAPen(0); rectFill(x2 + dx + 1, y1, x2, y2); @@ -483,10 +471,10 @@ void LabEngine::scrollDisplayX(int16 dx, uint16 x1, uint16 y1, uint16 x2, uint16 /* Scrolls the display in the y direction by blitting. */ /*****************************************************************************/ void LabEngine::scrollDisplayY(int16 dy, uint16 x1, uint16 y1, uint16 x2, uint16 y2) { - Image Im; + Image im; uint16 temp; - Im.ImageData = _tempScrollData; + im.ImageData = _tempScrollData; if (x1 > x2) { temp = x2; @@ -501,20 +489,20 @@ void LabEngine::scrollDisplayY(int16 dy, uint16 x1, uint16 y1, uint16 x2, uint16 } if (dy > 0) { - Im.Width = x2 - x1 + 1; - Im.Height = y2 - y1 + 1 - dy; + im.Width = x2 - x1 + 1; + im.Height = y2 - y1 + 1 - dy; - readScreenImage(&Im, x1, y1); - drawImage(&Im, x1, y1 + dy); + readScreenImage(&im, x1, y1); + drawImage(&im, x1, y1 + dy); setAPen(0); rectFill(x1, y1, x2, y1 + dy - 1); } else if (dy < 0) { - Im.Width = x2 - x1 + 1; - Im.Height = y2 - y1 + 1 + dy; + im.Width = x2 - x1 + 1; + im.Height = y2 - y1 + 1 + dy; - readScreenImage(&Im, x1, y1 - dy); - drawImage(&Im, x1, y1); + readScreenImage(&im, x1, y1 - dy); + drawImage(&im, x1, y1); setAPen(0); rectFill(x1, y2 + dy + 1, x2, y2); @@ -532,12 +520,10 @@ void LabEngine::setAPen(byte pennum) { /* Fills in a rectangle. */ /*****************************************************************************/ void LabEngine::rectFill(uint16 x1, uint16 y1, uint16 x2, uint16 y2) { - int dx, dy, w, h; - - dx = x1; - dy = y1; - w = x2 - x1 + 1; - h = y2 - y1 + 1; + int dx = x1; + int dy = y1; + int w = x2 - x1 + 1; + int h = y2 - y1 + 1; if (dx < 0) { w += dx; @@ -589,12 +575,10 @@ void LabEngine::drawHLine(uint16 x1, uint16 y, uint16 x2) { /* Ghoasts a region on the screen using the desired pen color. */ /*****************************************************************************/ void LabEngine::ghoastRect(uint16 pencolor, uint16 x1, uint16 y1, uint16 x2, uint16 y2) { - int dx, dy, w, h; - - dx = x1; - dy = y1; - w = x2 - x1 + 1; - h = y2 - y1 + 1; + int dx = x1; + int dy = y1; + int w = x2 - x1 + 1; + int h = y2 - y1 + 1; if (dx < 0) { w += dx; -- cgit v1.2.3 From 51d04a81875ba86ce3e882fc0e005e1142e05a8e Mon Sep 17 00:00:00 2001 From: Filippos Karapetis Date: Tue, 1 Dec 2015 02:02:48 +0200 Subject: LAB: Remove leftover debug code --- engines/lab/engine.cpp | 7 ------- 1 file changed, 7 deletions(-) diff --git a/engines/lab/engine.cpp b/engines/lab/engine.cpp index 05a219606e..d96111f2dd 100644 --- a/engines/lab/engine.cpp +++ b/engines/lab/engine.cpp @@ -1288,13 +1288,6 @@ void LabEngine::go() { _isHiRes = ((getFeatures() & GF_LOWRES) == 0); -#if 0 - if (_isHiRes) - warning("Running in HiRes mode"); - else - warning("Running in LowRes mode"); -#endif - bool mem = false; if (initBuffer(BUFFERSIZE, true)) { mem = true; -- cgit v1.2.3 From 24684fe321f337caf96af917a3b7e647e8fd113b Mon Sep 17 00:00:00 2001 From: Filippos Karapetis Date: Tue, 1 Dec 2015 02:05:29 +0200 Subject: LAB: Move getText to the Resource class Also, make getFont() error out when it can't find a font, and get rid of BigMsgFont --- engines/lab/lab.h | 4 +- engines/lab/labfun.h | 1 - engines/lab/map.cpp | 36 ----------- engines/lab/resource.cpp | 21 ++++++- engines/lab/resource.h | 3 +- engines/lab/special.cpp | 158 +++++++++++++++++------------------------------ 6 files changed, 81 insertions(+), 142 deletions(-) diff --git a/engines/lab/lab.h b/engines/lab/lab.h index 0b2e777021..36a3c6ccbc 100644 --- a/engines/lab/lab.h +++ b/engines/lab/lab.h @@ -176,8 +176,8 @@ public: void drawJournal(uint16 wipenum, bool needFade); void processJournal(); void doJournal(); - void drawMonText(char *text, uint16 x1, uint16 y1, uint16 x2, uint16 y2, bool isinteractive); - void processMonitor(char *ntext, bool isinteractive, uint16 x1, uint16 y1, uint16 x2, uint16 y2); + void drawMonText(char *text, TextFont *monitorFont, uint16 x1, uint16 y1, uint16 x2, uint16 y2, bool isinteractive); + void processMonitor(char *ntext, TextFont *monitorFont, bool isinteractive, uint16 x1, uint16 y1, uint16 x2, uint16 y2); void doMonitor(char *background, char *textfile, bool isinteractive, uint16 x1, uint16 y1, uint16 x2, uint16 y2); void eatMessages(); void drawStaticMessage(byte index); diff --git a/engines/lab/labfun.h b/engines/lab/labfun.h index 7fffb1b840..ea2c9852ef 100644 --- a/engines/lab/labfun.h +++ b/engines/lab/labfun.h @@ -189,7 +189,6 @@ char *translateFileName(const char *filename); void fade(bool fadein, uint16 res); void setAmigaPal(uint16 *pal, uint16 numcolors); -char *getText(const char *filename); void readImage(byte **buffer, Image **im); void doMap(uint16 CurRoom); void doJournal(); diff --git a/engines/lab/map.cpp b/engines/lab/map.cpp index 2db36103b5..02cdbfb1ac 100644 --- a/engines/lab/map.cpp +++ b/engines/lab/map.cpp @@ -42,10 +42,6 @@ namespace Lab { -static TextFont *BigMsgFont; -static TextFont bmf; - - extern uint16 Direction; extern CloseDataPtr CPtr; @@ -70,33 +66,6 @@ void setAmigaPal(uint16 *pal, uint16 numcolors) { g_lab->writeColorRegsSmooth(vgapal, 0, 16); } -void decrypt(byte *text) { - while (text && *text != '\0') { - *text++ -= (byte)95; - } -} - -/*****************************************************************************/ -/* Gets a chunk of text and puts it into the graphics memory. */ -/*****************************************************************************/ -char *getText(const char *filename) { - bool dodecrypt; - byte **tfile; - - g_lab->_music->updateMusic(); - dodecrypt = (isBuffered(filename) == NULL); - tfile = g_lab->_music->newOpen(filename); - - if (!tfile) - return NULL; - - if (dodecrypt) - decrypt(*tfile); - - return (char *)*tfile; -} - - /*****************************************************************************/ /* Reads in an image from disk. */ @@ -193,11 +162,6 @@ static bool loadMapData() { Gadget *gptr; uint16 counter; - BigMsgFont = &bmf; - - if (!(BigMsgFont = g_lab->_resource->getFont("P:Map.fon"))) - BigMsgFont = MsgFont; - resetBuffer(); /* Make images load into start of buffer */ buffer = g_lab->_music->newOpen("P:MapImage", Size); diff --git a/engines/lab/resource.cpp b/engines/lab/resource.cpp index 290216c5e8..0c60924cda 100644 --- a/engines/lab/resource.cpp +++ b/engines/lab/resource.cpp @@ -58,7 +58,7 @@ void Resource::readStaticText() { TextFont *Resource::getFont(const char *fileName) { Common::File *dataFile; if (!(dataFile = openDataFile(fileName, MKTAG('V', 'G', 'A', 'F')))) - return NULL; + error("getFont: couldn't open %s (%s)", translateFileName(fileName), fileName); uint32 headerSize = 4L + 2L + 256 * 3 + 4L; uint32 fileSize = dataFile->size(); @@ -80,6 +80,25 @@ TextFont *Resource::getFont(const char *fileName) { return textfont; } +char *Resource::getText(const char *fileName) { + Common::File *dataFile = new Common::File(); + dataFile->open(translateFileName(fileName)); + if (!dataFile->isOpen()) + error("getText: couldn't open %s (%s)", translateFileName(fileName), fileName); + + g_lab->_music->updateMusic(); + + byte count = dataFile->size(); + byte *buffer = new byte[count]; + byte *text = buffer; + dataFile->read(buffer, count); + + while (text && *text != '\0') + *text++ -= (byte)95; + + return (char *)buffer; +} + bool Resource::readRoomData(const char *fileName) { Common::File *dataFile; if (!(dataFile = openDataFile(fileName, MKTAG('D', 'O', 'R', '1')))) diff --git a/engines/lab/resource.h b/engines/lab/resource.h index 841aa09564..b9bdbbba8d 100644 --- a/engines/lab/resource.h +++ b/engines/lab/resource.h @@ -102,7 +102,8 @@ public: bool readRoomData(const char *fileName); bool readInventory(const char *fileName); bool readViews(uint16 roomNum); - TextFont *getFont(const char *filename); + TextFont *getFont(const char *fileName); + char *getText(const char *fileName); Common::String getStaticText(byte index) const { return _staticText[index]; } private: diff --git a/engines/lab/special.cpp b/engines/lab/special.cpp index f350a5cea0..6be525dd30 100644 --- a/engines/lab/special.cpp +++ b/engines/lab/special.cpp @@ -54,8 +54,7 @@ static Image *Images[10]; byte combination[6] = { 0, 0, 0, 0, 0, 0 }, solution[] = { 0, 4, 0, 8, 7, 2 }; static uint16 combx[] = { 45, 83, 129, 166, 211, 248 }; -static TextFont *BigMsgFont; -static TextFont bmfont; +static TextFont *journalFont; static char *journaltext, *journaltexttitle; static uint16 JPage = 0; static bool lastpage = false; @@ -456,23 +455,15 @@ void mouseTile(Common::Point pos) { /* Does the things to properly set up the detective notes. */ /*****************************************************************************/ void doNotes() { - char *ntext; - - /* Load in the data */ - BigMsgFont = &bmfont; - - if (!(BigMsgFont = g_lab->_resource->getFont("P:Note.fon"))) { - BigMsgFont = NULL; - return; - } - - if ((ntext = getText("Lab:Rooms/Notes")) == NULL) - return; - - flowText(BigMsgFont, -2 + SVGACord(1), 0, 0, false, false, true, true, VGAScaleX(25) + SVGACord(15), VGAScaleY(50), VGAScaleX(295) - SVGACord(15), VGAScaleY(148), ntext); + TextFont *noteFont = g_lab->_resource->getFont("P:Note.fon"); + char *ntext = g_lab->_resource->getText("Lab:Rooms/Notes"); + flowText(noteFont, -2 + SVGACord(1), 0, 0, false, false, true, true, VGAScaleX(25) + SVGACord(15), VGAScaleY(50), VGAScaleX(295) - SVGACord(15), VGAScaleY(148), ntext); g_lab->setPalette(diffcmap, 256); - freeAllStolenMem(); + + delete[] noteFont->data; + free(noteFont); + delete[] ntext; } @@ -482,56 +473,39 @@ void doNotes() { /*****************************************************************************/ void doWestPaper() { char *ntext; + TextFont *paperFont; int32 FileLen, CharsPrinted; uint16 y = 268; - BigMsgFont = &bmfont; - - if (!(BigMsgFont = g_lab->_resource->getFont("P:News22.fon"))) { - BigMsgFont = NULL; - return; - } - - if ((ntext = getText("Lab:Rooms/Date")) == NULL) - return; - - flowText(BigMsgFont, 0, 0, 0, false, true, false, true, VGAScaleX(57), VGAScaleY(77) + SVGACord(2), VGAScaleX(262), VGAScaleY(91), ntext); - - BigMsgFont = &bmfont; - - if (!(BigMsgFont = g_lab->_resource->getFont("P:News32.fon"))) { - BigMsgFont = NULL; - return; - } - - if ((ntext = getText("Lab:Rooms/Headline")) == NULL) - return; + paperFont = g_lab->_resource->getFont("P:News22.fon"); + ntext = g_lab->_resource->getText("Lab:Rooms/Date"); + flowText(paperFont, 0, 0, 0, false, true, false, true, VGAScaleX(57), VGAScaleY(77) + SVGACord(2), VGAScaleX(262), VGAScaleY(91), ntext); + delete[] paperFont->data; + free(paperFont); + delete[] ntext; + paperFont = g_lab->_resource->getFont("P:News32.fon"); + ntext = g_lab->_resource->getText("Lab:Rooms/Headline"); FileLen = strlen(ntext) - 1; - CharsPrinted = flowText(BigMsgFont, -8, 0, 0, false, true, false, true, VGAScaleX(57), VGAScaleY(86) - SVGACord(2), VGAScaleX(262), VGAScaleY(118), ntext); - + CharsPrinted = flowText(paperFont, -8, 0, 0, false, true, false, true, VGAScaleX(57), VGAScaleY(86) - SVGACord(2), VGAScaleX(262), VGAScaleY(118), ntext); if (CharsPrinted < FileLen) { y = 130 - SVGACord(5); - flowText(BigMsgFont, -8 - SVGACord(1), 0, 0, false, true, false, true, VGAScaleX(57), VGAScaleY(86) - SVGACord(2), VGAScaleX(262), VGAScaleY(132), ntext); + flowText(paperFont, -8 - SVGACord(1), 0, 0, false, true, false, true, VGAScaleX(57), VGAScaleY(86) - SVGACord(2), VGAScaleX(262), VGAScaleY(132), ntext); } else y = 115 - SVGACord(5); - - BigMsgFont = &bmfont; - - if (!(BigMsgFont = g_lab->_resource->getFont("P:Note.fon"))) { - BigMsgFont = NULL; - return; - } - - if ((ntext = getText("Lab:Rooms/Col1")) == NULL) - return; - - CharsPrinted = flowText(BigMsgFont, -4, 0, 0, false, false, false, true, VGAScaleX(45), VGAScaleY(y), VGAScaleX(158), VGAScaleY(148), ntext); - - if ((ntext = getText("Lab:Rooms/Col2")) == NULL) - return; - - CharsPrinted = flowText(BigMsgFont, -4, 0, 0, false, false, false, true, VGAScaleX(162), VGAScaleY(y), VGAScaleX(275), VGAScaleY(148), ntext); + delete[] paperFont->data; + free(paperFont); + delete[] ntext; + + paperFont = g_lab->_resource->getFont("P:Note.fon"); + ntext = g_lab->_resource->getText("Lab:Rooms/Col1"); + CharsPrinted = flowText(paperFont, -4, 0, 0, false, false, false, true, VGAScaleX(45), VGAScaleY(y), VGAScaleX(158), VGAScaleY(148), ntext); + delete[] ntext; + ntext = g_lab->_resource->getText("Lab:Rooms/Col2"); + CharsPrinted = flowText(paperFont, -4, 0, 0, false, false, false, true, VGAScaleX(162), VGAScaleY(y), VGAScaleX(275), VGAScaleY(148), ntext); + delete[] ntext; + delete[] paperFont->data; + free(paperFont); g_lab->setPalette(diffcmap, 256); freeAllStolenMem(); @@ -546,12 +520,7 @@ static bool loadJournalData() { Gadget *TopGadget = &BackG; bool bridge, dirty, news, clean; - BigMsgFont = &bmfont; - - if (!(BigMsgFont = g_lab->_resource->getFont("P:Journal.fon"))) { - BigMsgFont = NULL; - return false; - } + journalFont = g_lab->_resource->getFont("P:Journal.fon"); g_lab->_music->updateMusic(); @@ -580,11 +549,8 @@ static bool loadJournalData() { else if (bridge) filename[11] = '1'; - if ((journaltext = getText(filename)) == NULL) - return false; - - if ((journaltexttitle = getText("Lab:Rooms/jt")) == NULL) - return false; + journaltext = g_lab->_resource->getText(filename); + journaltexttitle = g_lab->_resource->getText("Lab:Rooms/jt"); buffer = g_lab->_music->newOpen("P:JImage"); @@ -630,7 +596,7 @@ static void drawJournalText() { while (DrawingToPage < JPage) { g_lab->_music->updateMusic(); CurText = (char *)(journaltext + CharsDrawn); - CharsDrawn += flowText(BigMsgFont, -2, 2, 0, false, false, false, false, VGAScaleX(52), VGAScaleY(32), VGAScaleX(152), VGAScaleY(148), CurText); + CharsDrawn += flowText(journalFont, -2, 2, 0, false, false, false, false, VGAScaleX(52), VGAScaleY(32), VGAScaleX(152), VGAScaleY(148), CurText); lastpage = (*CurText == 0); @@ -642,16 +608,16 @@ static void drawJournalText() { if (JPage <= 1) { CurText = journaltexttitle; - flowTextToMem(&JBackImage, BigMsgFont, -2, 2, 0, false, true, true, true, VGAScaleX(52), VGAScaleY(32), VGAScaleX(152), VGAScaleY(148), CurText); + flowTextToMem(&JBackImage, journalFont, -2, 2, 0, false, true, true, true, VGAScaleX(52), VGAScaleY(32), VGAScaleX(152), VGAScaleY(148), CurText); } else { CurText = (char *)(journaltext + CharsDrawn); - CharsDrawn += flowTextToMem(&JBackImage, BigMsgFont, -2, 2, 0, false, false, false, true, VGAScaleX(52), VGAScaleY(32), VGAScaleX(152), VGAScaleY(148), CurText); + CharsDrawn += flowTextToMem(&JBackImage, journalFont, -2, 2, 0, false, false, false, true, VGAScaleX(52), VGAScaleY(32), VGAScaleX(152), VGAScaleY(148), CurText); } g_lab->_music->updateMusic(); CurText = (char *)(journaltext + CharsDrawn); lastpage = (*CurText == 0); - flowTextToMem(&JBackImage, BigMsgFont, -2, 2, 0, false, false, false, true, VGAScaleX(171), VGAScaleY(32), VGAScaleX(271), VGAScaleY(148), CurText); + flowTextToMem(&JBackImage, journalFont, -2, 2, 0, false, false, false, true, VGAScaleX(171), VGAScaleY(32), VGAScaleX(271), VGAScaleY(148), CurText); CurText = (char *)(journaltext + CharsDrawn); lastpage = lastpage || (*CurText == 0); @@ -869,7 +835,7 @@ static void getMonImages() { /*****************************************************************************/ /* Draws the text for the monitor. */ /*****************************************************************************/ -void LabEngine::drawMonText(char *text, uint16 x1, uint16 y1, uint16 x2, uint16 y2, bool isinteractive) { +void LabEngine::drawMonText(char *text, TextFont *monitorFont, uint16 x1, uint16 y1, uint16 x2, uint16 y2, bool isinteractive) { uint16 DrawingToPage = 0, yspacing = 0, numlines, fheight; int32 CharsDrawn = 0L; char *CurText = text; @@ -883,7 +849,7 @@ void LabEngine::drawMonText(char *text, uint16 x1, uint16 y1, uint16 x2, uint16 numlines += (*text - '0'); text += 2; - fheight = textHeight(BigMsgFont); + fheight = textHeight(monitorFont); x1 = MonButton->Width + VGAScaleX(3); MonGadHeight = MonButton->Height + VGAScaleY(3); @@ -908,7 +874,7 @@ void LabEngine::drawMonText(char *text, uint16 x1, uint16 y1, uint16 x2, uint16 while (DrawingToPage < monitorPage) { _music->updateMusic(); CurText = (char *)(text + CharsDrawn); - CharsDrawn += flowText(BigMsgFont, yspacing, 0, 0, false, false, false, false, x1, y1, x2, y2, CurText); + CharsDrawn += flowText(monitorFont, yspacing, 0, 0, false, false, false, false, x1, y1, x2, y2, CurText); lastpage = (*CurText == 0); if (lastpage) @@ -919,7 +885,7 @@ void LabEngine::drawMonText(char *text, uint16 x1, uint16 y1, uint16 x2, uint16 CurText = (char *)(text + CharsDrawn); lastpage = (*CurText == 0); - CharsDrawn = flowText(BigMsgFont, yspacing, 2, 0, false, false, false, true, x1, y1, x2, y2, CurText); + CharsDrawn = flowText(monitorFont, yspacing, 2, 0, false, false, false, true, x1, y1, x2, y2, CurText); CurText += CharsDrawn; lastpage = lastpage || (*CurText == 0); @@ -929,7 +895,7 @@ void LabEngine::drawMonText(char *text, uint16 x1, uint16 y1, uint16 x2, uint16 /*****************************************************************************/ /* Processes user input. */ /*****************************************************************************/ -void LabEngine::processMonitor(char *ntext, bool isinteractive, uint16 x1, uint16 y1, uint16 x2, uint16 y2) { +void LabEngine::processMonitor(char *ntext, TextFont *monitorFont, bool isinteractive, uint16 x1, uint16 y1, uint16 x2, uint16 y2) { IntuiMessage *Msg; uint32 Class; uint16 Qualifier, Code, MouseX, MouseY; @@ -953,10 +919,11 @@ void LabEngine::processMonitor(char *ntext, bool isinteractive, uint16 x1, uint1 monitorPage = 0; TextFileName = Test; - ntext = getText(TextFileName); + ntext = g_lab->_resource->getText(TextFileName); fade(false, 0); - drawMonText(ntext, x1, y1, x2, y2, isinteractive); + drawMonText(ntext, monitorFont, x1, y1, x2, y2, isinteractive); fade(true, 0); + delete[] ntext; } } @@ -981,14 +948,14 @@ void LabEngine::processMonitor(char *ntext, bool isinteractive, uint16 x1, uint1 if ((MouseX >= VGAScaleX(259)) && (MouseX <= VGAScaleX(289))) { if (!lastpage) { monitorPage += 1; - drawMonText(ntext, x1, y1, x2, y2, isinteractive); + drawMonText(ntext, monitorFont, x1, y1, x2, y2, isinteractive); } } else if ((MouseX >= VGAScaleX(0)) && (MouseX <= VGAScaleX(31))) { return; } else if ((MouseX >= VGAScaleX(290)) && (MouseX <= VGAScaleX(320))) { if (monitorPage >= 1) { monitorPage -= 1; - drawMonText(ntext, x1, y1, x2, y2, isinteractive); + drawMonText(ntext, monitorFont, x1, y1, x2, y2, isinteractive); } } else if ((MouseX >= VGAScaleX(31)) && (MouseX <= VGAScaleX(59))) { if (isinteractive) { @@ -1000,7 +967,7 @@ void LabEngine::processMonitor(char *ntext, bool isinteractive, uint16 x1, uint1 } } else if (monitorPage > 0) { monitorPage = 0; - drawMonText(ntext, x1, y1, x2, y2, isinteractive); + drawMonText(ntext, monitorFont, x1, y1, x2, y2, isinteractive); } } } else if (isinteractive) { @@ -1045,31 +1012,20 @@ void LabEngine::doMonitor(char *background, char *textfile, bool isinteractive, lastpage = false; FadePalette = hipal; - BigMsgFont = &bmfont; - - if (!(BigMsgFont = _resource->getFont("P:Map.fon"))) { - freeAllStolenMem(); - BigMsgFont = NULL; - return; - } - + TextFont *monitorFont = _resource->getFont("P:Map.fon"); getMonImages(); - if ((ntext = getText(textfile)) == NULL) { - freeAllStolenMem(); - return; - } - + ntext = _resource->getText(textfile); loadBackPict(background, false); - - drawMonText(ntext, x1, y1, x2, y2, isinteractive); - + drawMonText(ntext, monitorFont, x1, y1, x2, y2, isinteractive); _event->mouseShow(); fade(true, 0); - processMonitor(ntext, isinteractive, x1, y1, x2, y2); + processMonitor(ntext, monitorFont, isinteractive, x1, y1, x2, y2); fade(false, 0); _event->mouseHide(); - + delete[] ntext; + delete[] monitorFont->data; + free(monitorFont); freeAllStolenMem(); setAPen(0); -- cgit v1.2.3 From 0fbf62f7f0115a0ad04b594f834e41cb7f719072 Mon Sep 17 00:00:00 2001 From: Filippos Karapetis Date: Tue, 1 Dec 2015 02:17:26 +0200 Subject: LAB: Plug several font-related memory leaks. Some cleanup --- engines/lab/intro.cpp | 85 ++++++++++++++++++++++++------------------------ engines/lab/intro.h | 3 +- engines/lab/resource.cpp | 3 +- engines/lab/special.cpp | 17 ++++------ engines/lab/text.cpp | 8 ++--- 5 files changed, 55 insertions(+), 61 deletions(-) diff --git a/engines/lab/intro.cpp b/engines/lab/intro.cpp index b556501b17..e7f0187a73 100644 --- a/engines/lab/intro.cpp +++ b/engines/lab/intro.cpp @@ -42,7 +42,6 @@ extern char diffcmap[256 * 3]; extern uint16 *FadePalette; Intro::Intro() { - _msgfont = &_filler; _quitIntro = false; } @@ -76,7 +75,7 @@ void Intro::introEatMessages() { /*****************************************************************************/ /* Reads in a picture. */ /*****************************************************************************/ -void Intro::doPictText(const char *filename, bool isscreen) { +void Intro::doPictText(const char *filename, TextFont *msgFont, bool isscreen) { uint32 lastsecs = 0L, lastmicros = 0L, secs = 0L, micros = 0L; IntuiMessage *msg; char path[50] = "Lab:rooms/Intro/"; @@ -118,7 +117,7 @@ void Intro::doPictText(const char *filename, bool isscreen) { g_lab->setAPen(7); g_lab->rectFill(VGAScaleX(10), VGAScaleY(10), VGAScaleX(310), VGAScaleY(190)); - Drawn = flowText(_msgfont, (!g_lab->_isHiRes) * -1, 5, 7, false, false, true, true, VGAScaleX(14), VGAScaleY(11), VGAScaleX(306), VGAScaleY(189), (char *)curplace); + Drawn = flowText(msgFont, (!g_lab->_isHiRes) * -1, 5, 7, false, false, true, true, VGAScaleX(14), VGAScaleY(11), VGAScaleX(306), VGAScaleY(189), (char *)curplace); fade(true, 0); } else { Drawn = g_lab->longDrawMessage((char *)curplace); @@ -347,7 +346,7 @@ void Intro::introSequence() { blackAllScreen(); g_lab->_music->updateMusic(); - _msgfont = g_lab->_resource->getFont("P:Map.fon"); + TextFont *msgFont = g_lab->_resource->getFont("P:Map.fon"); nopalchange = true; nReadPict("Intro.1", true); @@ -359,9 +358,9 @@ void Intro::introSequence() { (diffcmap[i * 3 + 2] >> 2); } - doPictText("i.1", true); - doPictText("i.2A", true); - doPictText("i.2B", true); + doPictText("i.1", msgFont, true); + doPictText("i.2A", msgFont, true); + doPictText("i.2B", msgFont, true); freeAllStolenMem(); @@ -370,28 +369,28 @@ void Intro::introSequence() { _introDoBlack = true; nReadPict("Station1", true); - doPictText("i.3", false); + doPictText("i.3", msgFont, false); nReadPict("Station2", true); - doPictText("i.4", false); + doPictText("i.4", msgFont, false); nReadPict("Stiles4", true); - doPictText("i.5", false); + doPictText("i.5", msgFont, false); nReadPict("Stiles3", true); - doPictText("i.6", false); + doPictText("i.6", msgFont, false); nReadPict("Platform2", true); - doPictText("i.7", false); + doPictText("i.7", msgFont, false); nReadPict("Subway.1", true); - doPictText("i.8", false); + doPictText("i.8", msgFont, false); nReadPict("Subway.2", true); - doPictText("i.9", false); - doPictText("i.10", false); - doPictText("i.11", false); + doPictText("i.9", msgFont, false); + doPictText("i.10", msgFont, false); + doPictText("i.11", msgFont, false); if (!_quitIntro) for (uint16 i = 0; i < 50; i++) { @@ -401,60 +400,60 @@ void Intro::introSequence() { g_lab->_music->updateMusic(); g_lab->waitTOF(); g_lab->setPalette(diffcmap, 256); - g_lab-> waitTOF(); + g_lab->waitTOF(); g_lab->waitTOF(); } - doPictText("i.12", false); - doPictText("i.13", false); + doPictText("i.12", msgFont, false); + doPictText("i.13", msgFont, false); _introDoBlack = false; nReadPict("Daed0", true); - doPictText("i.14", false); + doPictText("i.14", msgFont, false); nReadPict("Daed1", true); - doPictText("i.15", false); + doPictText("i.15", msgFont, false); nReadPict("Daed2", true); - doPictText("i.16", false); - doPictText("i.17", false); - doPictText("i.18", false); + doPictText("i.16", msgFont, false); + doPictText("i.17", msgFont, false); + doPictText("i.18", msgFont, false); nReadPict("Daed3", true); - doPictText("i.19", false); - doPictText("i.20", false); + doPictText("i.19", msgFont, false); + doPictText("i.20", msgFont, false); nReadPict("Daed4", true); - doPictText("i.21", false); + doPictText("i.21", msgFont, false); nReadPict("Daed5", true); - doPictText("i.22", false); - doPictText("i.23", false); - doPictText("i.24", false); + doPictText("i.22", msgFont, false); + doPictText("i.23", msgFont, false); + doPictText("i.24", msgFont, false); nReadPict("Daed6", true); - doPictText("i.25", false); - doPictText("i.26", false); + doPictText("i.25", msgFont, false); + doPictText("i.26", msgFont, false); nReadPict("Daed7", false); - doPictText("i.27", false); - doPictText("i.28", false); + doPictText("i.27", msgFont, false); + doPictText("i.28", msgFont, false); stopDiffEnd(); nReadPict("Daed8", true); - doPictText("i.29", false); - doPictText("i.30", false); + doPictText("i.29", msgFont, false); + doPictText("i.30", msgFont, false); nReadPict("Daed9", true); - doPictText("i.31", false); - doPictText("i.32", false); - doPictText("i.33", false); + doPictText("i.31", msgFont, false); + doPictText("i.32", msgFont, false); + doPictText("i.33", msgFont, false); nReadPict("Daed9a", true); nReadPict("Daed10", true); - doPictText("i.34", false); - doPictText("i.35", false); - doPictText("i.36", false); + doPictText("i.34", msgFont, false); + doPictText("i.35", msgFont, false); + doPictText("i.36", msgFont, false); nReadPict("SubX", true); @@ -463,6 +462,8 @@ void Intro::introSequence() { g_lab->rectFill(0, 0, g_lab->_screenWidth - 1, g_lab->_screenHeight - 1); DoBlack = true; } + + closeFont(msgFont); } } // End of namespace Lab diff --git a/engines/lab/intro.h b/engines/lab/intro.h index 724fedaa7e..2979bcd334 100644 --- a/engines/lab/intro.h +++ b/engines/lab/intro.h @@ -43,11 +43,10 @@ public: private: void introEatMessages(); - void doPictText(const char *Filename, bool isscreen); + void doPictText(const char *Filename, TextFont *msgFont, bool isscreen); void musicDelay(); void nReadPict(const char *Filename, bool PlayOnce); - TextFont _filler, *_msgfont; bool _quitIntro, _introDoBlack; }; diff --git a/engines/lab/resource.cpp b/engines/lab/resource.cpp index 0c60924cda..b1ad5284ba 100644 --- a/engines/lab/resource.cpp +++ b/engines/lab/resource.cpp @@ -67,14 +67,13 @@ TextFont *Resource::getFont(const char *fileName) { _vm->_music->updateMusic(); - TextFont *textfont = (TextFont *)malloc(sizeof(TextFont)); + TextFont *textfont = new TextFont(); textfont->DataLength = fileSize - headerSize; textfont->Height = dataFile->readUint16LE(); dataFile->read(textfont->Widths, 256); for (int i = 0; i < 256; i++) textfont->Offsets[i] = dataFile->readUint16LE(); dataFile->skip(4); - // TODO: Fix memory leak!! textfont->data = new byte[textfont->DataLength + 4]; dataFile->read(textfont->data, textfont->DataLength); return textfont; diff --git a/engines/lab/special.cpp b/engines/lab/special.cpp index 6be525dd30..70ec15af06 100644 --- a/engines/lab/special.cpp +++ b/engines/lab/special.cpp @@ -461,8 +461,7 @@ void doNotes() { flowText(noteFont, -2 + SVGACord(1), 0, 0, false, false, true, true, VGAScaleX(25) + SVGACord(15), VGAScaleY(50), VGAScaleX(295) - SVGACord(15), VGAScaleY(148), ntext); g_lab->setPalette(diffcmap, 256); - delete[] noteFont->data; - free(noteFont); + closeFont(noteFont); delete[] ntext; } @@ -480,8 +479,7 @@ void doWestPaper() { paperFont = g_lab->_resource->getFont("P:News22.fon"); ntext = g_lab->_resource->getText("Lab:Rooms/Date"); flowText(paperFont, 0, 0, 0, false, true, false, true, VGAScaleX(57), VGAScaleY(77) + SVGACord(2), VGAScaleX(262), VGAScaleY(91), ntext); - delete[] paperFont->data; - free(paperFont); + closeFont(paperFont); delete[] ntext; paperFont = g_lab->_resource->getFont("P:News32.fon"); @@ -493,8 +491,7 @@ void doWestPaper() { flowText(paperFont, -8 - SVGACord(1), 0, 0, false, true, false, true, VGAScaleX(57), VGAScaleY(86) - SVGACord(2), VGAScaleX(262), VGAScaleY(132), ntext); } else y = 115 - SVGACord(5); - delete[] paperFont->data; - free(paperFont); + closeFont(paperFont); delete[] ntext; paperFont = g_lab->_resource->getFont("P:Note.fon"); @@ -504,8 +501,7 @@ void doWestPaper() { ntext = g_lab->_resource->getText("Lab:Rooms/Col2"); CharsPrinted = flowText(paperFont, -4, 0, 0, false, false, false, true, VGAScaleX(162), VGAScaleY(y), VGAScaleX(275), VGAScaleY(148), ntext); delete[] ntext; - delete[] paperFont->data; - free(paperFont); + closeFont(paperFont); g_lab->setPalette(diffcmap, 256); freeAllStolenMem(); @@ -520,7 +516,7 @@ static bool loadJournalData() { Gadget *TopGadget = &BackG; bool bridge, dirty, news, clean; - journalFont = g_lab->_resource->getFont("P:Journal.fon"); + journalFont = g_lab->_resource->getFont("P:Journal.fon"); // FIXME: memory leak g_lab->_music->updateMusic(); @@ -1024,8 +1020,7 @@ void LabEngine::doMonitor(char *background, char *textfile, bool isinteractive, fade(false, 0); _event->mouseHide(); delete[] ntext; - delete[] monitorFont->data; - free(monitorFont); + closeFont(monitorFont); freeAllStolenMem(); setAPen(0); diff --git a/engines/lab/text.cpp b/engines/lab/text.cpp index 3fc1b1a9c4..a7b41f1752 100644 --- a/engines/lab/text.cpp +++ b/engines/lab/text.cpp @@ -38,19 +38,19 @@ namespace Lab { /*****************************************************************************/ /* Closes a font and frees all memory associated with it. */ /*****************************************************************************/ -void closeFont(struct TextFont *tf) { +void closeFont(TextFont *tf) { if (tf) { if (tf->data && tf->DataLength) delete[] tf->data; - free(tf); + delete tf; } } /*****************************************************************************/ /* Returns the length of a text in the specified font. */ /*****************************************************************************/ -uint16 textLength(struct TextFont *tf, const char *text, uint16 numchars) { +uint16 textLength(TextFont *tf, const char *text, uint16 numchars) { uint16 length = 0; if (tf) { @@ -66,7 +66,7 @@ uint16 textLength(struct TextFont *tf, const char *text, uint16 numchars) { /*****************************************************************************/ /* Returns the height of a specified font. */ /*****************************************************************************/ -uint16 textHeight(struct TextFont *tf) { +uint16 textHeight(TextFont *tf) { return (tf) ? tf->Height : 0; } -- cgit v1.2.3 From f817c1de2e96da59362ea4e5cbdffe40fffa4dbb Mon Sep 17 00:00:00 2001 From: Strangerke Date: Tue, 1 Dec 2015 01:16:15 +0100 Subject: LAB: Get rid of stddefines --- engines/lab/allocroom.cpp | 1 - engines/lab/diff.h | 11 ++++---- engines/lab/engine.cpp | 1 - engines/lab/graphics.cpp | 1 - engines/lab/interface.cpp | 1 - engines/lab/labfun.h | 1 - engines/lab/labsets.cpp | 1 - engines/lab/machine.cpp | 2 -- engines/lab/map.cpp | 1 - engines/lab/mouse.cpp | 1 - engines/lab/mouse.h | 1 - engines/lab/music.cpp | 1 - engines/lab/parsefun.h | 1 - engines/lab/parsetypes.h | 2 ++ engines/lab/processroom.cpp | 1 - engines/lab/readdiff.cpp | 61 ++++++++++++++++++++++++--------------------- engines/lab/savegame.cpp | 1 - engines/lab/special.cpp | 1 - engines/lab/stddefines.h | 51 ------------------------------------- engines/lab/text.cpp | 1 - engines/lab/text.h | 3 --- engines/lab/undiff.cpp | 2 +- engines/lab/vga.cpp | 8 +++--- 23 files changed, 44 insertions(+), 111 deletions(-) delete mode 100644 engines/lab/stddefines.h diff --git a/engines/lab/allocroom.cpp b/engines/lab/allocroom.cpp index b98bd24acb..e960dda3de 100644 --- a/engines/lab/allocroom.cpp +++ b/engines/lab/allocroom.cpp @@ -28,7 +28,6 @@ * */ -#include "lab/stddefines.h" #include "lab/parsetypes.h" namespace Lab { diff --git a/engines/lab/diff.h b/engines/lab/diff.h index b4436b8f3f..5ed627834b 100644 --- a/engines/lab/diff.h +++ b/engines/lab/diff.h @@ -31,17 +31,18 @@ #ifndef LAB_DIFF_H #define LAB_DIFF_H -#include "lab/stddefines.h" #include "common/file.h" namespace Lab { struct DIFFHeader { - uint16 Version, x, y; - char depth, fps; - uint32 BufferSize; - uint16 Machine; + uint16 Version; // unused + uint16 x, y; + char depth; // unused + char fps; + uint32 BufferSize; // unused + uint16 Machine; // unused uint32 Flags; }; diff --git a/engines/lab/engine.cpp b/engines/lab/engine.cpp index d96111f2dd..f845dfacca 100644 --- a/engines/lab/engine.cpp +++ b/engines/lab/engine.cpp @@ -29,7 +29,6 @@ */ #include "lab/lab.h" -#include "lab/stddefines.h" #include "lab/labfun.h" #include "lab/diff.h" #include "lab/text.h" diff --git a/engines/lab/graphics.cpp b/engines/lab/graphics.cpp index 460d4d5864..413796d916 100644 --- a/engines/lab/graphics.cpp +++ b/engines/lab/graphics.cpp @@ -29,7 +29,6 @@ */ #include "lab/lab.h" -#include "lab/stddefines.h" #include "lab/diff.h" #include "lab/parsetypes.h" #include "lab/labfun.h" diff --git a/engines/lab/interface.cpp b/engines/lab/interface.cpp index a31e2894a8..f786bb8703 100644 --- a/engines/lab/interface.cpp +++ b/engines/lab/interface.cpp @@ -30,7 +30,6 @@ #include "lab/lab.h" #include "lab/labfun.h" -#include "lab/stddefines.h" #include "lab/interface.h" #include "lab/mouse.h" #include "common/util.h" diff --git a/engines/lab/labfun.h b/engines/lab/labfun.h index ea2c9852ef..4f7573e0b1 100644 --- a/engines/lab/labfun.h +++ b/engines/lab/labfun.h @@ -32,7 +32,6 @@ #define LAB_LABFUN_H #include "common/events.h" -#include "lab/stddefines.h" #include "lab/parsetypes.h" // For the Music class - TODO: Move to another header file diff --git a/engines/lab/labsets.cpp b/engines/lab/labsets.cpp index ad721fa2db..2ab9abfe4a 100644 --- a/engines/lab/labsets.cpp +++ b/engines/lab/labsets.cpp @@ -29,7 +29,6 @@ */ #include "lab/lab.h" -#include "lab/stddefines.h" #include "lab/labfun.h" #include "lab/resource.h" diff --git a/engines/lab/machine.cpp b/engines/lab/machine.cpp index 2bef80da2d..0667772d89 100644 --- a/engines/lab/machine.cpp +++ b/engines/lab/machine.cpp @@ -29,9 +29,7 @@ */ #include "common/str.h" - #include "lab/lab.h" -#include "lab/stddefines.h" namespace Lab { diff --git a/engines/lab/map.cpp b/engines/lab/map.cpp index 02cdbfb1ac..36b01d10f7 100644 --- a/engines/lab/map.cpp +++ b/engines/lab/map.cpp @@ -29,7 +29,6 @@ */ #include "lab/lab.h" -#include "lab/stddefines.h" #include "lab/labfun.h" #include "lab/diff.h" #include "lab/text.h" diff --git a/engines/lab/mouse.cpp b/engines/lab/mouse.cpp index a7e62968ec..9ff5117ff6 100644 --- a/engines/lab/mouse.cpp +++ b/engines/lab/mouse.cpp @@ -30,7 +30,6 @@ #include "lab/lab.h" #include "lab/mouse.h" -#include "lab/stddefines.h" #include "lab/interface.h" namespace Lab { diff --git a/engines/lab/mouse.h b/engines/lab/mouse.h index 6468ba91c7..4bccb17805 100644 --- a/engines/lab/mouse.h +++ b/engines/lab/mouse.h @@ -29,7 +29,6 @@ */ #include "common/events.h" -#include "lab/stddefines.h" #ifndef LAB_MOUSE_H #define LAB_MOUSE_H diff --git a/engines/lab/music.cpp b/engines/lab/music.cpp index b6587ebf1b..8d51320057 100644 --- a/engines/lab/music.cpp +++ b/engines/lab/music.cpp @@ -30,7 +30,6 @@ #include "audio/mixer.h" -#include "lab/stddefines.h" #include "lab/labfun.h" #include "lab/mouse.h" #include "lab/music.h" diff --git a/engines/lab/parsefun.h b/engines/lab/parsefun.h index f376a23754..5fbc62cb3a 100644 --- a/engines/lab/parsefun.h +++ b/engines/lab/parsefun.h @@ -31,7 +31,6 @@ #ifndef LAB_PARSEFUN_H #define LAB_PARSEFUN_H -#include "lab/stddefines.h" #include "lab/labfun.h" #include "lab/parsetypes.h" diff --git a/engines/lab/parsetypes.h b/engines/lab/parsetypes.h index 2585ae5dbd..3ca441a286 100644 --- a/engines/lab/parsetypes.h +++ b/engines/lab/parsetypes.h @@ -31,6 +31,8 @@ #ifndef LAB_PARSETYPES_H #define LAB_PARSETYPES_H +#include "common/system.h" + namespace Lab { #define MAXFILELEN 31 diff --git a/engines/lab/processroom.cpp b/engines/lab/processroom.cpp index 87a56b0be3..04fe70d3fd 100644 --- a/engines/lab/processroom.cpp +++ b/engines/lab/processroom.cpp @@ -31,7 +31,6 @@ #include "gui/message.h" #include "lab/lab.h" -#include "lab/stddefines.h" #include "lab/labfun.h" #include "lab/parsetypes.h" #include "lab/parsefun.h" diff --git a/engines/lab/readdiff.cpp b/engines/lab/readdiff.cpp index 9e87ad9526..f7fb99592a 100644 --- a/engines/lab/readdiff.cpp +++ b/engines/lab/readdiff.cpp @@ -169,10 +169,11 @@ void LabEngine::diffNextFrame() { } _music->updateMusic(); - readBlock(&header, 4L, difffile); - swapULong(&header); - readBlock(&size, 4L, difffile); - swapULong(&size); + header = READ_LE_UINT32(*difffile); + *difffile += 4; + + size = READ_LE_UINT32(*difffile); + *difffile += 4; switch (header) { case 8L: @@ -239,9 +240,8 @@ void LabEngine::diffNextFrame() { (*difffile) += 4; - readBlock(&samplespeed, 2L, difffile); - swapUShortPtr(&samplespeed, 1); - (*difffile) += 2; + samplespeed = READ_LE_UINT16(*difffile); + (*difffile) += 4; byte *music = *difffile; uint32 musicsize = size; @@ -315,41 +315,44 @@ void playDiff() { } continuous = false; - readBlock(temp, 4L, difffile); - temp[4] = '\0'; + uint32 signature = READ_BE_UINT32(*difffile); + (*difffile) += 4; - readBlock(&header, 4L, difffile); - swapULong(&header); + header = READ_LE_UINT32(*difffile); + (*difffile) += 4; - if (!((strcmp((char *)temp, "DIFF") == 0) && (header == 1219009121L))) { + if ((signature != MKTAG('D', 'I', 'F', 'F')) || (header != 1219009121L)) { IsPlaying = false; return; } - readBlock(&header, 4L, difffile); - swapULong(&header); + header = READ_LE_UINT32(*difffile); + (*difffile) += 4; - readBlock(&size, 4L, difffile); - swapULong(&size); + size = READ_LE_UINT32(*difffile); + (*difffile) += 4; if (header == 0) { // sizeof(headerdata) != 18, but the padding might be at the end - readBlock(&headerdata.Version, 2, difffile); - readBlock(&headerdata.x, 2, difffile); - readBlock(&headerdata.y, 2, difffile); - readBlock(&headerdata.depth, 1, difffile); - readBlock(&headerdata.fps, 1, difffile); - readBlock(&headerdata.BufferSize, 4, difffile); - readBlock(&headerdata.Machine, 2, difffile); - readBlock(&headerdata.Flags, 4, difffile); + headerdata.Version = READ_LE_UINT16(*difffile); + (*difffile) += 2; + headerdata.x = READ_LE_UINT16(*difffile); + (*difffile) += 2; + headerdata.y = READ_LE_UINT16(*difffile); + (*difffile) += 2; + headerdata.depth = *difffile[0]; + (*difffile)++; + headerdata.fps = *difffile[0]; + (*difffile)++; + headerdata.BufferSize = READ_LE_UINT32(*difffile); + (*difffile) += 4; + headerdata.Machine = READ_LE_UINT16(*difffile); + (*difffile) += 2; + headerdata.Flags = READ_LE_UINT32(*difffile); + (*difffile) += 4; (*difffile) += size - 18; - swapUShortPtr(&headerdata.Version, 3); - swapULong(&headerdata.BufferSize); - swapUShortPtr(&headerdata.Machine, 1); - swapULong(&headerdata.Flags); - continuous = CONTINUOUS & headerdata.Flags; diffwidth = headerdata.x; diffheight = headerdata.y; diff --git a/engines/lab/savegame.cpp b/engines/lab/savegame.cpp index b01ac276c8..d54e6cb491 100644 --- a/engines/lab/savegame.cpp +++ b/engines/lab/savegame.cpp @@ -34,7 +34,6 @@ #include "graphics/thumbnail.h" #include "lab/lab.h" -#include "lab/stddefines.h" #include "lab/labfun.h" namespace Lab { diff --git a/engines/lab/special.cpp b/engines/lab/special.cpp index 70ec15af06..59cf2d166e 100644 --- a/engines/lab/special.cpp +++ b/engines/lab/special.cpp @@ -40,7 +40,6 @@ #include "lab/diff.h" #include "lab/text.h" #include "lab/mouse.h" -#include "lab/stddefines.h" #include "lab/parsetypes.h" #include "lab/resource.h" diff --git a/engines/lab/stddefines.h b/engines/lab/stddefines.h deleted file mode 100644 index 8c74d10a99..0000000000 --- a/engines/lab/stddefines.h +++ /dev/null @@ -1,51 +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. - * - */ - -/* - * This code is based on Labyrinth of Time code with assistance of - * - * Copyright (c) 1993 Terra Nova Development - * Copyright (c) 2004 The Wyrmkeep Entertainment Co. - * - */ - -#include "common/system.h" -#include "common/debug.h" -#include "common/textconsole.h" - -#ifndef LAB_STDDEFINES_H -#define LAB_STDDEFINES_H - -namespace Lab { - -#define swapUShort(value) (value) -#define swapUShortPtr(ptr,count) (ptr) -#define swapShort(value) (value) -#define swapShortPtr(ptr,count) (ptr) -#define swapUInt(value) (value) -#define swapInt(value) (value) -#define swapULong(value) (value) -#define swapLong(value) (value) - -} // End of namespace Lab - -#endif /* LAB_STDDEFINES_H */ diff --git a/engines/lab/text.cpp b/engines/lab/text.cpp index a7b41f1752..6c5ac8ca01 100644 --- a/engines/lab/text.cpp +++ b/engines/lab/text.cpp @@ -29,7 +29,6 @@ */ #include "lab/lab.h" -#include "lab/stddefines.h" #include "lab/labfun.h" #include "lab/text.h" diff --git a/engines/lab/text.h b/engines/lab/text.h index 8d171b2094..7401f02661 100644 --- a/engines/lab/text.h +++ b/engines/lab/text.h @@ -31,9 +31,6 @@ #ifndef LAB_TEXT_H #define LAB_TEXT_H - -#include "lab/stddefines.h" - namespace Lab { #if defined(WIN32) diff --git a/engines/lab/undiff.cpp b/engines/lab/undiff.cpp index 2b22496011..f7d89898a4 100644 --- a/engines/lab/undiff.cpp +++ b/engines/lab/undiff.cpp @@ -28,8 +28,8 @@ * */ -#include "lab/stddefines.h" #include "common/endian.h" +#include "lab/lab.h" namespace Lab { diff --git a/engines/lab/vga.cpp b/engines/lab/vga.cpp index 48c82b4526..6af1fda319 100644 --- a/engines/lab/vga.cpp +++ b/engines/lab/vga.cpp @@ -28,14 +28,12 @@ * */ -#include "lab/lab.h" -#include "lab/stddefines.h" -#include "lab/mouse.h" - #include "graphics/palette.h" - #include "common/events.h" +#include "lab/lab.h" +#include "lab/mouse.h" + namespace Lab { /*****************************************************************************/ -- cgit v1.2.3 From 377bed8db04075ce67c573b0646c3f714d205287 Mon Sep 17 00:00:00 2001 From: Strangerke Date: Tue, 1 Dec 2015 07:03:15 +0100 Subject: LAB: Some renaming in Room Markers --- engines/lab/allocroom.cpp | 89 ++++++++++++++++++++++------------------------- 1 file changed, 42 insertions(+), 47 deletions(-) diff --git a/engines/lab/allocroom.cpp b/engines/lab/allocroom.cpp index e960dda3de..e0051faf4c 100644 --- a/engines/lab/allocroom.cpp +++ b/engines/lab/allocroom.cpp @@ -41,11 +41,11 @@ namespace Lab { extern RoomData *_rooms; typedef struct { - uint16 RoomNum; - void *Start0, *End0, *Start1, *End1; + uint16 _roomNum; + void *_start0, *_end0, *_start1, *_end1; } RoomMarker; -static RoomMarker RoomMarkers[MAXMARKERS]; +static RoomMarker _roomMarkers[MAXMARKERS]; static void *RoomBuffer = NULL; static uint16 CurMarker = 0; static void *MemPlace = NULL, *NextMemPlace = NULL; @@ -62,7 +62,7 @@ bool initRoomBuffer() { MemLeftInBuffer = ROOMBUFFERSIZE; for (uint16 i = 0; i < MAXMARKERS; i++) - RoomMarkers[i].RoomNum = EMPTYROOM; + _roomMarkers[i]._roomNum = EMPTYROOM; return true; } else @@ -80,32 +80,29 @@ void freeRoomBuffer() { /*****************************************************************************/ /* Frees a room's resources. */ /*****************************************************************************/ -static void freeRoom(uint16 RMarker) { - uint16 RoomNum; +static void freeRoom(uint16 roomMarkerId) { + uint16 roomNum = _roomMarkers[roomMarkerId]._roomNum; - RoomNum = RoomMarkers[RMarker].RoomNum; + if (roomNum != EMPTYROOM) { + _rooms[roomNum]._northView = nullptr; + _rooms[roomNum]._southView = nullptr; + _rooms[roomNum]._eastView = nullptr; + _rooms[roomNum]._westView = nullptr; - if (RoomNum != EMPTYROOM) { - _rooms[RoomNum]._northView = nullptr; - _rooms[RoomNum]._southView = nullptr; - _rooms[RoomNum]._eastView = nullptr; - _rooms[RoomNum]._westView = nullptr; - - RuleList *rules = _rooms[RoomNum]._rules; + RuleList *rules = _rooms[roomNum]._rules; for (RuleList::iterator rule = rules->begin(); rule != rules->end(); ++rule) delete *rule; - _rooms[RoomNum]._rules->clear(); - delete _rooms[RoomNum]._rules; - _rooms[RoomNum]._rules = nullptr; - - _rooms[RoomNum]._roomMsg = nullptr; + _rooms[roomNum]._rules->clear(); + delete _rooms[roomNum]._rules; + _rooms[roomNum]._rules = nullptr; + _rooms[roomNum]._roomMsg = nullptr; } - RoomMarkers[RMarker].RoomNum = EMPTYROOM; - RoomMarkers[RMarker].Start0 = NULL; - RoomMarkers[RMarker].End0 = NULL; - RoomMarkers[RMarker].Start1 = NULL; - RoomMarkers[RMarker].End1 = NULL; + _roomMarkers[roomMarkerId]._roomNum = EMPTYROOM; + _roomMarkers[roomMarkerId]._start0 = nullptr; + _roomMarkers[roomMarkerId]._end0 = nullptr; + _roomMarkers[roomMarkerId]._start1 = nullptr; + _roomMarkers[roomMarkerId]._end1 = nullptr; } /*****************************************************************************/ @@ -126,11 +123,11 @@ static void *getCurMem(uint16 Size) { NextMemPlace = NULL; for (uint16 i = 0; i < MAXMARKERS; i++) { - if (RoomMarkers[i].RoomNum != EMPTYROOM) { - void *Start0 = RoomMarkers[i].Start0; - void *Start1 = RoomMarkers[i].Start1; - void *End0 = RoomMarkers[i].End0; - void *End1 = RoomMarkers[i].End1; + if (_roomMarkers[i]._roomNum != EMPTYROOM) { + void *Start0 = _roomMarkers[i]._start0; + void *Start1 = _roomMarkers[i]._start1; + void *End0 = _roomMarkers[i]._end0; + void *End1 = _roomMarkers[i]._end1; if (((Start0 >= Ptr) && (Start0 < MemPlace)) || ((End0 >= Ptr) && (End0 < MemPlace)) || @@ -166,43 +163,41 @@ static void *getCurMem(uint16 Size) { /* particular room. */ /*****************************************************************************/ void allocRoom(void **Ptr, uint16 size, uint16 roomNum) { - uint16 rMarker; - if (1 & size) /* Memory is required to be even aligned */ size++; - rMarker = 0; + uint16 roomMarkerId = 0; - while ((rMarker < MAXMARKERS)) { - if (RoomMarkers[rMarker].RoomNum == roomNum) + while ((roomMarkerId < MAXMARKERS)) { + if (_roomMarkers[roomMarkerId]._roomNum == roomNum) break; else - rMarker++; + roomMarkerId++; } - if (rMarker >= MAXMARKERS) { - rMarker = CurMarker; + if (roomMarkerId >= MAXMARKERS) { + roomMarkerId = CurMarker; CurMarker++; if (CurMarker >= MAXMARKERS) CurMarker = 0; - freeRoom(rMarker); - RoomMarkers[rMarker].RoomNum = roomNum; + freeRoom(roomMarkerId); + _roomMarkers[roomMarkerId]._roomNum = roomNum; } *Ptr = getCurMem(size); - if (RoomMarkers[rMarker].Start0 == NULL) { - RoomMarkers[rMarker].Start0 = *Ptr; - RoomMarkers[rMarker].End0 = (void *)(((char *)(*Ptr)) + size - 1); - } else if (*Ptr < RoomMarkers[rMarker].Start0) { - if (RoomMarkers[rMarker].Start1 == NULL) - RoomMarkers[rMarker].Start1 = *Ptr; + if (!_roomMarkers[roomMarkerId]._start0) { + _roomMarkers[roomMarkerId]._start0 = *Ptr; + _roomMarkers[roomMarkerId]._end0 = (void *)(((char *)(*Ptr)) + size - 1); + } else if (*Ptr < _roomMarkers[roomMarkerId]._start0) { + if (_roomMarkers[roomMarkerId]._start1 == nullptr) + _roomMarkers[roomMarkerId]._start1 = *Ptr; - RoomMarkers[rMarker].End1 = (void *)(((char *)(*Ptr)) + size - 1); + _roomMarkers[roomMarkerId]._end1 = (void *)(((char *)(*Ptr)) + size - 1); } else - RoomMarkers[rMarker].End0 = (void *)(((char *)(*Ptr)) + size - 1); + _roomMarkers[roomMarkerId]._end0 = (void *)(((char *)(*Ptr)) + size - 1); } } // End of namespace Lab -- cgit v1.2.3 From 609fd323d39035ea0ca02377ad8e0fdadd30e1a1 Mon Sep 17 00:00:00 2001 From: Strangerke Date: Tue, 1 Dec 2015 07:08:54 +0100 Subject: LAB: Remove some dead code --- engines/lab/allocroom.cpp | 123 ---------------------------------------------- engines/lab/parsefun.h | 2 - 2 files changed, 125 deletions(-) diff --git a/engines/lab/allocroom.cpp b/engines/lab/allocroom.cpp index e0051faf4c..a95aa8e68f 100644 --- a/engines/lab/allocroom.cpp +++ b/engines/lab/allocroom.cpp @@ -77,127 +77,4 @@ void freeRoomBuffer() { free(RoomBuffer); } -/*****************************************************************************/ -/* Frees a room's resources. */ -/*****************************************************************************/ -static void freeRoom(uint16 roomMarkerId) { - uint16 roomNum = _roomMarkers[roomMarkerId]._roomNum; - - if (roomNum != EMPTYROOM) { - _rooms[roomNum]._northView = nullptr; - _rooms[roomNum]._southView = nullptr; - _rooms[roomNum]._eastView = nullptr; - _rooms[roomNum]._westView = nullptr; - - RuleList *rules = _rooms[roomNum]._rules; - for (RuleList::iterator rule = rules->begin(); rule != rules->end(); ++rule) - delete *rule; - _rooms[roomNum]._rules->clear(); - delete _rooms[roomNum]._rules; - _rooms[roomNum]._rules = nullptr; - _rooms[roomNum]._roomMsg = nullptr; - } - - _roomMarkers[roomMarkerId]._roomNum = EMPTYROOM; - _roomMarkers[roomMarkerId]._start0 = nullptr; - _roomMarkers[roomMarkerId]._end0 = nullptr; - _roomMarkers[roomMarkerId]._start1 = nullptr; - _roomMarkers[roomMarkerId]._end1 = nullptr; -} - -/*****************************************************************************/ -/* Gets a chunk of memory from the buffer. */ -/*****************************************************************************/ -static void *getCurMem(uint16 Size) { - if (((int32) Size) > MemLeftInBuffer) { - MemPlace = RoomBuffer; - MemLeftInBuffer = ROOMBUFFERSIZE; - NextMemPlace = NULL; - } - - void *Ptr = MemPlace; - MemPlace = (char *)MemPlace + Size; - MemLeftInBuffer -= Size; - - if (MemPlace > NextMemPlace) { - NextMemPlace = NULL; - - for (uint16 i = 0; i < MAXMARKERS; i++) { - if (_roomMarkers[i]._roomNum != EMPTYROOM) { - void *Start0 = _roomMarkers[i]._start0; - void *Start1 = _roomMarkers[i]._start1; - void *End0 = _roomMarkers[i]._end0; - void *End1 = _roomMarkers[i]._end1; - - if (((Start0 >= Ptr) && (Start0 < MemPlace)) || - ((End0 >= Ptr) && (End0 < MemPlace)) || - ((Ptr >= Start0) && (Ptr <= End0)) || - - ((Start1 >= Ptr) && (Start1 < MemPlace)) || - ((End1 >= Ptr) && (End1 < MemPlace)) || - ((Ptr >= Start1) && (Ptr <= End1))) { - freeRoom(i); - } else { - if (Start0 >= MemPlace) - if ((NextMemPlace == NULL) || (Start0 < NextMemPlace)) - NextMemPlace = Start0; - - if (Start1 >= MemPlace) - if ((NextMemPlace == NULL) || (Start1 < NextMemPlace)) - NextMemPlace = Start1; - } - } - } - - if (NextMemPlace == NULL) { - NextMemPlace = RoomBuffer; - NextMemPlace = (char *)NextMemPlace + ROOMBUFFERSIZE; - } - } - - return Ptr; -} - -/*****************************************************************************/ -/* Grabs a chunk of memory from the room buffer, and manages it for a */ -/* particular room. */ -/*****************************************************************************/ -void allocRoom(void **Ptr, uint16 size, uint16 roomNum) { - if (1 & size) /* Memory is required to be even aligned */ - size++; - - uint16 roomMarkerId = 0; - - while ((roomMarkerId < MAXMARKERS)) { - if (_roomMarkers[roomMarkerId]._roomNum == roomNum) - break; - else - roomMarkerId++; - } - - if (roomMarkerId >= MAXMARKERS) { - roomMarkerId = CurMarker; - CurMarker++; - - if (CurMarker >= MAXMARKERS) - CurMarker = 0; - - freeRoom(roomMarkerId); - _roomMarkers[roomMarkerId]._roomNum = roomNum; - } - - *Ptr = getCurMem(size); - - if (!_roomMarkers[roomMarkerId]._start0) { - _roomMarkers[roomMarkerId]._start0 = *Ptr; - _roomMarkers[roomMarkerId]._end0 = (void *)(((char *)(*Ptr)) + size - 1); - } else if (*Ptr < _roomMarkers[roomMarkerId]._start0) { - if (_roomMarkers[roomMarkerId]._start1 == nullptr) - _roomMarkers[roomMarkerId]._start1 = *Ptr; - - _roomMarkers[roomMarkerId]._end1 = (void *)(((char *)(*Ptr)) + size - 1); - } else - _roomMarkers[roomMarkerId]._end0 = (void *)(((char *)(*Ptr)) + size - 1); -} - } // End of namespace Lab diff --git a/engines/lab/parsefun.h b/engines/lab/parsefun.h index 5fbc62cb3a..46c26b67d4 100644 --- a/engines/lab/parsefun.h +++ b/engines/lab/parsefun.h @@ -45,8 +45,6 @@ bool parse(const char *InputFile); bool initRoomBuffer(); void freeRoomBuffer(); -void allocRoom(void **Ptr, uint16 Size, uint16 RoomNum); - /* From ProcessRoom.c */ -- cgit v1.2.3 From 611df0c0dc7e98281fea354e20f74114fd94bee8 Mon Sep 17 00:00:00 2001 From: Strangerke Date: Tue, 1 Dec 2015 08:44:57 +0100 Subject: LAB: Some renaming in allocroom, remove useless code and variables --- engines/lab/allocroom.cpp | 31 ++++++++++--------------------- engines/lab/labfile.cpp | 32 ++++++++++++++++---------------- 2 files changed, 26 insertions(+), 37 deletions(-) diff --git a/engines/lab/allocroom.cpp b/engines/lab/allocroom.cpp index a95aa8e68f..22617cb774 100644 --- a/engines/lab/allocroom.cpp +++ b/engines/lab/allocroom.cpp @@ -35,34 +35,21 @@ namespace Lab { /* Have to make sure that ROOMBUFFERSIZE is bigger than the biggest piece of memory that we need */ #define ROOMBUFFERSIZE (2 * 20480L) -#define EMPTYROOM ((uint16) -1) -#define MAXMARKERS 10 extern RoomData *_rooms; -typedef struct { - uint16 _roomNum; - void *_start0, *_end0, *_start1, *_end1; -} RoomMarker; - -static RoomMarker _roomMarkers[MAXMARKERS]; -static void *RoomBuffer = NULL; -static uint16 CurMarker = 0; -static void *MemPlace = NULL, *NextMemPlace = NULL; -static int32 MemLeftInBuffer = 0L; +static void *_roomBuffer = nullptr; +static uint16 _curMarker = 0; +static void *_memPlace = nullptr; /*****************************************************************************/ /* Allocates the memory for the room buffers. */ /*****************************************************************************/ bool initRoomBuffer() { - CurMarker = 0; - - if ((RoomBuffer = calloc(ROOMBUFFERSIZE, 1))) { - MemPlace = RoomBuffer; - MemLeftInBuffer = ROOMBUFFERSIZE; + _curMarker = 0; - for (uint16 i = 0; i < MAXMARKERS; i++) - _roomMarkers[i]._roomNum = EMPTYROOM; + if ((_roomBuffer = calloc(ROOMBUFFERSIZE, 1))) { + _memPlace = _roomBuffer; return true; } else @@ -73,8 +60,10 @@ bool initRoomBuffer() { /* Frees the memory for the room buffers. */ /*****************************************************************************/ void freeRoomBuffer() { - if (RoomBuffer) - free(RoomBuffer); + if (_roomBuffer) { + free(_roomBuffer); + _roomBuffer = nullptr; + } } } // End of namespace Lab diff --git a/engines/lab/labfile.cpp b/engines/lab/labfile.cpp index 31d10905d1..83f3b0f2e9 100644 --- a/engines/lab/labfile.cpp +++ b/engines/lab/labfile.cpp @@ -53,8 +53,8 @@ struct FileMarker { static FileMarker FileMarkers[MAXMARKERS]; -static uint16 CurMarker = 0; -static void *MemPlace = NULL; +static uint16 _curMarker = 0; +static void *_memPlace = NULL; @@ -79,17 +79,17 @@ static void freeFile(uint16 RMarker) { static void *getCurMemLabFile(uint32 size) { void *ptr = 0; - if ((((char *) MemPlace) + size - 1) >= + if ((((char *) _memPlace) + size - 1) >= (((char *) buffer) + buffersize)) - MemPlace = buffer; + _memPlace = buffer; - ptr = MemPlace; - MemPlace = (char *)MemPlace + size; + ptr = _memPlace; + _memPlace = (char *)_memPlace + size; for (int i = 0; i < MAXMARKERS; i++) { if (FileMarkers[i].name[0]) { - if ( ((FileMarkers[i].Start >= ptr) && (FileMarkers[i].Start < MemPlace)) - || ((FileMarkers[i].End >= ptr) && (FileMarkers[i].End < MemPlace)) + if ( ((FileMarkers[i].Start >= ptr) && (FileMarkers[i].Start < _memPlace)) + || ((FileMarkers[i].End >= ptr) && (FileMarkers[i].End < _memPlace)) || ((ptr >= FileMarkers[i].Start) && (ptr <= FileMarkers[i].End))) freeFile(i); } @@ -139,11 +139,11 @@ bool allocFile(void **Ptr, uint32 Size, const char *fileName) { return true; } - RMarker = CurMarker; - CurMarker++; + RMarker = _curMarker; + _curMarker++; - if (CurMarker >= MAXMARKERS) - CurMarker = 0; + if (_curMarker >= MAXMARKERS) + _curMarker = 0; freeFile(RMarker); strcpy(FileMarkers[RMarker].name, fileName); @@ -204,9 +204,9 @@ void readBlock(void *Buffer, uint32 Size, byte **File) { void resetBuffer() { uint16 RMarker; - CurMarker = 0; + _curMarker = 0; RMarker = 0; - MemPlace = buffer; + _memPlace = buffer; while (RMarker < MAXMARKERS) { freeFile(RMarker); @@ -276,7 +276,7 @@ void *stealBufMem(int32 Size) { buffer += Size; buffersize -= Size; - MemPlace = buffer; + _memPlace = buffer; return Mem; } @@ -306,7 +306,7 @@ void freeAllStolenMem() { buffer = realbufferstart; buffersize = realbuffersize; - MemPlace = buffer; + _memPlace = buffer; } } // End of namespace Lab -- cgit v1.2.3 From 3f33ad277dc42526fb56845f522adad0064ee033 Mon Sep 17 00:00:00 2001 From: Eugene Sandulenko Date: Tue, 1 Dec 2015 10:35:31 +0100 Subject: LAB: More renames --- engines/lab/engine.cpp | 14 +-- engines/lab/graphics.cpp | 237 ++++++++++++++++++++--------------------------- engines/lab/lab.cpp | 5 +- engines/lab/lab.h | 7 +- engines/lab/readdiff.cpp | 2 +- engines/lab/special.cpp | 14 +-- engines/lab/text.cpp | 2 +- engines/lab/vga.cpp | 16 ++-- 8 files changed, 127 insertions(+), 170 deletions(-) diff --git a/engines/lab/engine.cpp b/engines/lab/engine.cpp index f845dfacca..4f44070c0d 100644 --- a/engines/lab/engine.cpp +++ b/engines/lab/engine.cpp @@ -167,20 +167,12 @@ void LabEngine::drawPanel() { _event->mouseShow(); } - -extern bool LastMessageLong; - -static bool LastTooLong = false; - - - - /******************************************************************************/ /* Draws the message for the room. */ /******************************************************************************/ void LabEngine::drawRoomMessage(uint16 CurInv, CloseDataPtr cptr) { - if (LastTooLong) { - LastTooLong = false; + if (_lastTooLong) { + _lastTooLong = false; return; } @@ -197,7 +189,7 @@ void LabEngine::drawRoomMessage(uint16 CurInv, CloseDataPtr cptr) { } else drawDirection(cptr); - LastTooLong = LastMessageLong; + _lastTooLong = _lastMessageLong; } diff --git a/engines/lab/graphics.cpp b/engines/lab/graphics.cpp index 413796d916..ea53292e3a 100644 --- a/engines/lab/graphics.cpp +++ b/engines/lab/graphics.cpp @@ -50,10 +50,6 @@ extern bool DoBlack, stopsound; extern TextFont *MsgFont; extern const char *CurFileName; - - - - /*---------------------------------------------------------------------------*/ /*------ From readPict.c. Reads in pictures and animations from disk. ------*/ /*---------------------------------------------------------------------------*/ @@ -62,7 +58,7 @@ extern const char *CurFileName; /*****************************************************************************/ /* Reads in a picture into the dest bitmap. */ /*****************************************************************************/ -bool readPict(const char *filename, bool PlayOnce) { +bool readPict(const char *filename, bool playOnce) { byte **file = NULL; stopDiff(); @@ -80,14 +76,11 @@ bool readPict(const char *filename, bool PlayOnce) { DispBitMap->Rows = g_lab->_screenHeight; DispBitMap->Flags = BITMAPF_VIDEO; - readDiff(PlayOnce); + readDiff(playOnce); return true; } - - - /*****************************************************************************/ /* Reads in a music file. Ignores any graphics. */ /*****************************************************************************/ @@ -105,9 +98,6 @@ bool readMusic(const char *filename, bool waitTillFinished) { return true; } - - - /*****************************************************************************/ /* Reads in a picture into buffer memory. */ /*****************************************************************************/ @@ -139,81 +129,65 @@ byte *readPictToMem(const char *filename, uint16 x, uint16 y) { return Mem; } - - - /*---------------------------------------------------------------------------*/ /*------------ Does all the text rendering to the message boxes. ------------*/ /*---------------------------------------------------------------------------*/ - - bool DoNotDrawMessage = false; extern bool LongWinInFront, Alternate; - /*----- The flowText routines -----*/ - - - /******************************************************************************/ /* Extracts the first word from a string. */ /******************************************************************************/ -static void getWord(char *WordBuffer, const char *MainBuffer, uint16 *WordWidth) { +static void getWord(char *wordBuffer, const char *mainBuffer, uint16 *wordWidth) { uint16 width = 0; - while ((MainBuffer[width] != ' ') && MainBuffer[width] && - (MainBuffer[width] != '\n')) { - WordBuffer[width] = MainBuffer[width]; + while ((mainBuffer[width] != ' ') && mainBuffer[width] && + (mainBuffer[width] != '\n')) { + wordBuffer[width] = mainBuffer[width]; width++; } - WordBuffer[width] = 0; + wordBuffer[width] = 0; - *WordWidth = width; + *wordWidth = width; } - - - - /******************************************************************************/ /* Gets a line of text for flowText; makes sure that its length is less than */ /* or equal to the maximum width. */ /******************************************************************************/ -static void getLine(TextFont *tf, char *LineBuffer, const char **MainBuffer, uint16 LineWidth) { - uint16 CurWidth = 0, WordWidth; - char WordBuffer[100]; +static void getLine(TextFont *tf, char *lineBuffer, const char **mainBuffer, uint16 lineWidth) { + uint16 curWidth = 0, wordWidth; + char wordBuffer[100]; bool doit = true; - LineWidth += textLength(tf, " ", 1); + lineWidth += textLength(tf, " ", 1); - LineBuffer[0] = 0; + lineBuffer[0] = 0; - while ((*MainBuffer)[0] && doit) { - getWord(WordBuffer, *MainBuffer, &WordWidth); - strcat(WordBuffer, " "); + while ((*mainBuffer)[0] && doit) { + getWord(wordBuffer, *mainBuffer, &wordWidth); + strcat(wordBuffer, " "); - if ((CurWidth + textLength(tf, WordBuffer, WordWidth + 1)) <= LineWidth) { - strcat(LineBuffer, WordBuffer); - (*MainBuffer) += WordWidth; + if ((curWidth + textLength(tf, wordBuffer, wordWidth + 1)) <= lineWidth) { + strcat(lineBuffer, wordBuffer); + (*mainBuffer) += wordWidth; - if ((*MainBuffer)[0] == '\n') + if ((*mainBuffer)[0] == '\n') doit = false; - if ((*MainBuffer)[0]) - (*MainBuffer)++; + if ((*mainBuffer)[0]) + (*mainBuffer)++; - CurWidth = textLength(tf, LineBuffer, strlen(LineBuffer)); + curWidth = textLength(tf, lineBuffer, strlen(lineBuffer)); } else doit = false; } } - - - /******************************************************************************/ /* Dumps a chunk of text to an arbitrary box; flows it within that box and */ /* optionally centers it. Returns the number of characters that were */ @@ -289,7 +263,7 @@ uint32 flowText(void *font, /* the TextAttr pointer */ /******************************************************************************/ /* Calls flowText, but flows it to memory. Same restrictions as flowText. */ /******************************************************************************/ -uint32 flowTextToMem(Image *DestIm, void *font, /* the TextAttr pointer */ +uint32 flowTextToMem(Image *destIm, void *font, /* the TextAttr pointer */ int16 spacing, /* How much vertical spacing between the lines */ byte pencolor, /* pen number to use for text */ byte backpen, /* the background color */ @@ -300,26 +274,21 @@ uint32 flowTextToMem(Image *DestIm, void *font, /* the TextAttr pointer */ uint16 x1, /* Cords */ uint16 y1, uint16 x2, uint16 y2, const char *str) { /* The text itself */ uint32 res, vgabyte = g_lab->_screenBytesPerPage; - byte *tmp = g_lab->_currentDsplayBuffer; + byte *tmp = g_lab->_currentDisplayBuffer; - g_lab->_currentDsplayBuffer = DestIm->ImageData; - g_lab->_screenBytesPerPage = (uint32) DestIm->Width * (int32) DestIm->Height; + g_lab->_currentDisplayBuffer = destIm->ImageData; + g_lab->_screenBytesPerPage = (uint32)destIm->Width * (int32)destIm->Height; res = flowText(font, spacing, pencolor, backpen, fillback, centerh, centerv, output, x1, y1, x2, y2, str); g_lab->_screenBytesPerPage = vgabyte; - g_lab->_currentDsplayBuffer = tmp; + g_lab->_currentDisplayBuffer = tmp; return res; } - - - /*----- The control panel stuff -----*/ - - void createBox(uint16 y2) { g_lab->setAPen(7); /* Message box area */ g_lab->rectFill(VGAScaleX(4), VGAScaleY(154), VGAScaleX(315), VGAScaleY(y2 - 2)); @@ -331,20 +300,15 @@ void createBox(uint16 y2) { g_lab->drawVLine(VGAScaleX(2), VGAScaleY(152), VGAScaleY(y2)); } - - - -bool LastMessageLong = false; - int32 LabEngine::longDrawMessage(const char *str) { - char NewText[512]; + char newText[512]; if (str == NULL) return 0; _event->attachGadgetList(NULL); _event->mouseHide(); - strcpy(NewText, str); + strcpy(newText, str); if (!LongWinInFront) { LongWinInFront = true; @@ -374,7 +338,7 @@ void LabEngine::drawMessage(const char *str) { if (str) { if ((textLength(MsgFont, str, strlen(str)) > VGAScaleX(306))) { longDrawMessage(str); - LastMessageLong = true; + _lastMessageLong = true; } else { if (LongWinInFront) { LongWinInFront = false; @@ -385,18 +349,15 @@ void LabEngine::drawMessage(const char *str) { createBox(168); text(MsgFont, VGAScaleX(7), VGAScaleY(155) + SVGACord(2), 1, str, strlen(str)); _event->mouseShow(); - LastMessageLong = false; + _lastMessageLong = false; } } } - /*---------------------------------------------------------------------------*/ /*--------------------------- All the wipe stuff. ---------------------------*/ /*---------------------------------------------------------------------------*/ - - #define TRANSWIPE 1 #define SCROLLWIPE 2 #define SCROLLBLACK 3 @@ -410,25 +371,25 @@ void LabEngine::drawMessage(const char *str) { /*****************************************************************************/ void LabEngine::doScrollBlack() { byte *mem, *tempmem; - Image Im; + Image im; uint16 width, height, by, nheight; uint32 size, copysize; - uint32 *BaseAddr; + uint32 *baseAddr; _event->mouseHide(); width = VGAScaleX(320); height = VGAScaleY(149) + SVGACord(2); - allocFile((void **) &mem, (int32) width * (int32) height, "Temp Mem"); + allocFile((void **)&mem, (int32)width * (int32)height, "Temp Mem"); - Im.Width = width; - Im.Height = height; - Im.ImageData = mem; + im.Width = width; + im.Height = height; + im.ImageData = mem; _music->updateMusic(); - g_lab->readScreenImage(&Im, 0, 0); + g_lab->readScreenImage(&im, 0, 0); _music->updateMusic(); - BaseAddr = (uint32 *)g_lab->getVGABaseAddr(); + baseAddr = (uint32 *)g_lab->getCurrentDrawingBuffer(); by = VGAScaleX(4); nheight = height; @@ -439,14 +400,14 @@ void LabEngine::doScrollBlack() { if (!_isHiRes) g_lab->waitTOF(); - BaseAddr = (uint32 *)g_lab->getVGABaseAddr(); + baseAddr = (uint32 *)g_lab->getCurrentDrawingBuffer(); if (by > nheight) by = nheight; mem += by * width; nheight -= by; - size = (int32) nheight * (int32) width; + size = (int32)nheight * (int32)width; tempmem = mem; while (size) { @@ -457,7 +418,7 @@ void LabEngine::doScrollBlack() { size -= copysize; - memcpy(BaseAddr, tempmem, copysize); + memcpy(baseAddr, tempmem, copysize); tempmem += copysize; } @@ -484,33 +445,32 @@ extern BitMap RawDiffBM; extern DIFFHeader headerdata; static void copyPage(uint16 width, uint16 height, uint16 nheight, uint16 startline, byte *mem) { - uint32 size, OffSet, copysize; - uint16 CurPage; - uint32 *BaseAddr; + uint32 size, offSet, copysize; + uint16 curPage; + uint32 *baseAddr; - BaseAddr = (uint32 *)g_lab->getVGABaseAddr(); + baseAddr = (uint32 *)g_lab->getCurrentDrawingBuffer(); - size = (int32)(height - nheight) * (int32) width; + size = (int32)(height - nheight) * (int32)width; mem += startline * width; - CurPage = ((int32) nheight * (int32) width) / g_lab->_screenBytesPerPage; - OffSet = ((int32) nheight * (int32) width) - (CurPage * g_lab->_screenBytesPerPage); + curPage = ((int32)nheight * (int32)width) / g_lab->_screenBytesPerPage; + offSet = ((int32)nheight * (int32)width) - (curPage * g_lab->_screenBytesPerPage); while (size) { - if (size > (g_lab->_screenBytesPerPage - OffSet)) - copysize = g_lab->_screenBytesPerPage - OffSet; + if (size > (g_lab->_screenBytesPerPage - offSet)) + copysize = g_lab->_screenBytesPerPage - offSet; else copysize = size; size -= copysize; - memcpy(BaseAddr + (OffSet >> 2), mem, copysize); + memcpy(baseAddr + (offSet >> 2), mem, copysize); mem += copysize; - CurPage++; - OffSet = 0; + curPage++; + offSet = 0; } } - /*****************************************************************************/ /* Scrolls the display to a new picture from a black screen. */ /*****************************************************************************/ @@ -586,7 +546,6 @@ void LabEngine::doScrollBounce() { newby1 = newby1w; } - _event->mouseHide(); int width = VGAScaleX(320); int height = VGAScaleY(149) + SVGACord(2); @@ -620,30 +579,30 @@ void LabEngine::doScrollBounce() { /*****************************************************************************/ /* Does the transporter wipe. */ /*****************************************************************************/ -void LabEngine::doTransWipe(CloseDataPtr *CPtr, char *filename) { - uint16 LastY, CurY, linesdone = 0, lineslast; - Image ImSource, ImDest; +void LabEngine::doTransWipe(CloseDataPtr *cPtr, char *filename) { + uint16 lastY, curY, linesdone = 0, lineslast; + Image imSource, imDest; if (_isHiRes) { lineslast = 3; - LastY = 358; + lastY = 358; } else { lineslast = 1; - LastY = 148; + lastY = 148; } for (uint16 i = 0; i < 2; i++) { - CurY = i * 2; + curY = i * 2; - while (CurY < LastY) { + while (curY < lastY) { if (linesdone >= lineslast) { _music->updateMusic(); g_lab->waitTOF(); linesdone = 0; } - g_lab->ghoastRect(0, 0, CurY, g_lab->_screenWidth - 1, CurY + 1); - CurY += 4; + g_lab->ghoastRect(0, 0, curY, g_lab->_screenWidth - 1, curY + 1); + curY += 4; linesdone++; } } @@ -651,77 +610,77 @@ void LabEngine::doTransWipe(CloseDataPtr *CPtr, char *filename) { g_lab->setAPen(0); for (uint16 i = 0; i < 2; i++) { - CurY = i * 2; + curY = i * 2; - while (CurY <= LastY) { + while (curY <= lastY) { if (linesdone >= lineslast) { _music->updateMusic(); g_lab->waitTOF(); linesdone = 0; } - g_lab->rectFill(0, CurY, g_lab->_screenWidth - 1, CurY + 1); - CurY += 4; + g_lab->rectFill(0, curY, g_lab->_screenWidth - 1, curY + 1); + curY += 4; linesdone++; } } if (filename == NULL) - CurFileName = getPictName(CPtr); + CurFileName = getPictName(cPtr); else if (filename[0] > ' ') CurFileName = filename; else - CurFileName = getPictName(CPtr); + CurFileName = getPictName(cPtr); - byte *BitMapMem = readPictToMem(CurFileName, g_lab->_screenWidth, LastY + 5); + byte *BitMapMem = readPictToMem(CurFileName, g_lab->_screenWidth, lastY + 5); g_lab->setPalette(diffcmap, 256); if (BitMapMem) { - ImSource.Width = g_lab->_screenWidth; - ImSource.Height = LastY; - ImSource.ImageData = BitMapMem; + imSource.Width = g_lab->_screenWidth; + imSource.Height = lastY; + imSource.ImageData = BitMapMem; - ImDest.Width = g_lab->_screenWidth; - ImDest.Height = g_lab->_screenHeight; - ImDest.ImageData = g_lab->getVGABaseAddr(); + imDest.Width = g_lab->_screenWidth; + imDest.Height = g_lab->_screenHeight; + imDest.ImageData = g_lab->getCurrentDrawingBuffer(); for (uint16 i = 0; i < 2; i++) { - CurY = i * 2; + curY = i * 2; - while (CurY < LastY) { + while (curY < lastY) { if (linesdone >= lineslast) { _music->updateMusic(); g_lab->waitTOF(); linesdone = 0; } - ImDest.ImageData = g_lab->getVGABaseAddr(); + imDest.ImageData = g_lab->getCurrentDrawingBuffer(); - g_lab->bltBitMap(&ImSource, 0, CurY, &ImDest, 0, CurY, g_lab->_screenWidth, 2); - g_lab->ghoastRect(0, 0, CurY, g_lab->_screenWidth - 1, CurY + 1); - CurY += 4; + g_lab->bltBitMap(&imSource, 0, curY, &imDest, 0, curY, g_lab->_screenWidth, 2); + g_lab->ghoastRect(0, 0, curY, g_lab->_screenWidth - 1, curY + 1); + curY += 4; linesdone++; } } for (uint16 i = 0; i < 2; i++) { - CurY = i * 2; + curY = i * 2; - while (CurY <= LastY) { + while (curY <= lastY) { if (linesdone >= lineslast) { _music->updateMusic(); g_lab->waitTOF(); linesdone = 0; } - ImDest.ImageData = g_lab->getVGABaseAddr(); + imDest.ImageData = g_lab->getCurrentDrawingBuffer(); - if (CurY == LastY) - g_lab->bltBitMap(&ImSource, 0, CurY, &ImDest, 0, CurY, g_lab->_screenWidth, 1); + if (curY == lastY) + g_lab->bltBitMap(&imSource, 0, curY, &imDest, 0, curY, g_lab->_screenWidth, 1); else - g_lab->bltBitMap(&ImSource, 0, CurY, &ImDest, 0, CurY, g_lab->_screenWidth, 2); + g_lab->bltBitMap(&imSource, 0, curY, &imDest, 0, curY, g_lab->_screenWidth, 2); - CurY += 4; + curY += 4; linesdone++; } } @@ -731,18 +690,18 @@ void LabEngine::doTransWipe(CloseDataPtr *CPtr, char *filename) { /*****************************************************************************/ /* Does a certain number of pre-programmed wipes. */ /*****************************************************************************/ -void LabEngine::doWipe(uint16 WipeType, CloseDataPtr *CPtr, char *filename) { - if ((WipeType == TRANSWIPE) || (WipeType == TRANSPORTER)) - doTransWipe(CPtr, filename); - else if (WipeType == SCROLLWIPE) +void LabEngine::doWipe(uint16 wipeType, CloseDataPtr *cPtr, char *filename) { + if ((wipeType == TRANSWIPE) || (wipeType == TRANSPORTER)) + doTransWipe(cPtr, filename); + else if (wipeType == SCROLLWIPE) doScrollWipe(filename); - else if (WipeType == SCROLLBLACK) + else if (wipeType == SCROLLBLACK) doScrollBlack(); - else if (WipeType == SCROLLBOUNCE) + else if (wipeType == SCROLLBOUNCE) doScrollBounce(); - else if (WipeType == READFIRSTFRAME) + else if (wipeType == READFIRSTFRAME) readPict(filename, false); - else if (WipeType == READNEXTFRAME) + else if (wipeType == READNEXTFRAME) diffNextFrame(); } diff --git a/engines/lab/lab.cpp b/engines/lab/lab.cpp index b42e48643f..7ebfa8c3d3 100644 --- a/engines/lab/lab.cpp +++ b/engines/lab/lab.cpp @@ -61,7 +61,7 @@ LabEngine::LabEngine(OSystem *syst, const ADGameDescription *gameDesc) _curapen = 0; - _currentDsplayBuffer = 0; + _currentDisplayBuffer = 0; _displayBuffer = 0; _lastWaitTOFTicks = 0; @@ -92,6 +92,9 @@ LabEngine::LabEngine(OSystem *syst, const ADGameDescription *gameDesc) _resource = nullptr; _music = nullptr; + _lastMessageLong = false; + _lastTooLong = false; + //const Common::FSNode gameDataDir(ConfMan.get("path")); //SearchMan.addSubDirectoryMatching(gameDataDir, "game"); //SearchMan.addSubDirectoryMatching(gameDataDir, "game/pict"); diff --git a/engines/lab/lab.h b/engines/lab/lab.h index 36a3c6ccbc..c427b08686 100644 --- a/engines/lab/lab.h +++ b/engines/lab/lab.h @@ -105,7 +105,7 @@ public: Music *_music; int _roomNum; - byte *_currentDsplayBuffer; + byte *_currentDisplayBuffer; Common::Point _mousePos; CrumbData _breadCrumbs[MAX_CRUMBS]; @@ -129,6 +129,9 @@ private: uint16 _nextKeyOut; bool _mouseAtEdge; + bool _lastMessageLong; + bool _lastTooLong; + private: bool createScreen(bool HiRes); bool from_crumbs(uint32 tmpClass, uint16 code, uint16 Qualifier, Common::Point tmpPos, uint16 &curInv, IntuiMessage * curMsg, bool &forceDraw, uint16 gadgetId, uint16 &actionMode); @@ -137,7 +140,7 @@ public: void waitTOF(); void setAPen(byte pennum); void writeColorRegs(byte *buf, uint16 first, uint16 numreg); - byte *getVGABaseAddr(); + byte *getCurrentDrawingBuffer(); void readScreenImage(Image *Im, uint16 x, uint16 y); void screenUpdate(); void rectFill(uint16 x1, uint16 y1, uint16 x2, uint16 y2); diff --git a/engines/lab/readdiff.cpp b/engines/lab/readdiff.cpp index f7fb99592a..042889cd38 100644 --- a/engines/lab/readdiff.cpp +++ b/engines/lab/readdiff.cpp @@ -120,7 +120,7 @@ void LabEngine::diffNextFrame() { return; if (DispBitMap->Flags & BITMAPF_VIDEO) { - DispBitMap->Planes[0] = getVGABaseAddr(); + DispBitMap->Planes[0] = getCurrentDrawingBuffer(); DispBitMap->Planes[1] = DispBitMap->Planes[0] + 0x10000; DispBitMap->Planes[2] = DispBitMap->Planes[1] + 0x10000; DispBitMap->Planes[3] = DispBitMap->Planes[2] + 0x10000; diff --git a/engines/lab/special.cpp b/engines/lab/special.cpp index 59cf2d166e..e23ea7035b 100644 --- a/engines/lab/special.cpp +++ b/engines/lab/special.cpp @@ -180,7 +180,7 @@ static void changeCombination(uint16 number) { combnum = combination[number]; - display.ImageData = g_lab->getVGABaseAddr(); + display.ImageData = g_lab->getCurrentDrawingBuffer(); display.Width = g_lab->_screenWidth; display.Height = g_lab->_screenHeight; @@ -191,7 +191,7 @@ static void changeCombination(uint16 number) { } else g_lab->waitTOF(); - display.ImageData = g_lab->getVGABaseAddr(); + display.ImageData = g_lab->getCurrentDrawingBuffer(); g_lab->scrollDisplayY(2, VGAScaleX(combx[number]), VGAScaleY(65), VGAScaleX(combx[number]) + (Images[combnum])->Width - 1, VGAScaleY(65) + (Images[combnum])->Height); @@ -626,14 +626,14 @@ static void turnPage(bool FromLeft) { for (int i = 0; i < g_lab->_screenWidth; i += 8) { g_lab->_music->updateMusic(); g_lab->waitTOF(); - ScreenImage.ImageData = g_lab->getVGABaseAddr(); + ScreenImage.ImageData = g_lab->getCurrentDrawingBuffer(); g_lab->bltBitMap(&JBackImage, i, 0, &ScreenImage, i, 0, 8, g_lab->_screenHeight); } } else { for (int i = (g_lab->_screenWidth - 8); i > 0; i -= 8) { g_lab->_music->updateMusic(); g_lab->waitTOF(); - ScreenImage.ImageData = g_lab->getVGABaseAddr(); + ScreenImage.ImageData = g_lab->getCurrentDrawingBuffer(); g_lab->bltBitMap(&JBackImage, i, 0, &ScreenImage, i, 0, 8, g_lab->_screenHeight); } } @@ -653,7 +653,7 @@ void LabEngine::drawJournal(uint16 wipenum, bool needFade) { drawJournalText(); - ScreenImage.ImageData = getVGABaseAddr(); + ScreenImage.ImageData = getCurrentDrawingBuffer(); if (wipenum == 0) bltBitMap(&JBackImage, 0, 0, &ScreenImage, 0, 0, _screenWidth, _screenHeight); @@ -744,7 +744,7 @@ void LabEngine::doJournal() { CancelG.NextGadget = &ForwardG; ScreenImage = JBackImage; - ScreenImage.ImageData = getVGABaseAddr(); + ScreenImage.ImageData = getCurrentDrawingBuffer(); _music->updateMusic(); loadJournalData(); @@ -758,7 +758,7 @@ void LabEngine::doJournal() { fade(false, 0); _event->mouseHide(); - ScreenImage.ImageData = getVGABaseAddr(); + ScreenImage.ImageData = getCurrentDrawingBuffer(); setAPen(0); rectFill(0, 0, _screenWidth - 1, _screenHeight - 1); diff --git a/engines/lab/text.cpp b/engines/lab/text.cpp index 6c5ac8ca01..63ec12bad0 100644 --- a/engines/lab/text.cpp +++ b/engines/lab/text.cpp @@ -78,7 +78,7 @@ void text(TextFont *tf, uint16 x, uint16 y, uint16 color, const char *text, uint int32 templeft, LeftInSegment; uint16 bwidth, mask, curpage, data; - VGATop = g_lab->getVGABaseAddr(); + VGATop = g_lab->getCurrentDrawingBuffer(); for (uint16 i = 0; i < numchars; i++) { RealOffset = (g_lab->_screenWidth * y) + x; diff --git a/engines/lab/vga.cpp b/engines/lab/vga.cpp index 6af1fda319..326b1f4117 100644 --- a/engines/lab/vga.cpp +++ b/engines/lab/vga.cpp @@ -242,9 +242,9 @@ void LabEngine::screenUpdate() { /*****************************************************************************/ /* Returns the base address of the current VGA display. */ /*****************************************************************************/ -byte *LabEngine::getVGABaseAddr() { - if (_currentDsplayBuffer) - return _currentDsplayBuffer; +byte *LabEngine::getCurrentDrawingBuffer() { + if (_currentDisplayBuffer) + return _currentDisplayBuffer; return _displayBuffer; } @@ -278,7 +278,7 @@ void LabEngine::drawImage(Image *im, uint16 x, uint16 y) { if ((w > 0) && (h > 0)) { byte *s = im->ImageData + sy * im->Width + sx; - byte *d = getVGABaseAddr() + dy * _screenWidth + dx; + byte *d = getCurrentDrawingBuffer() + dy * _screenWidth + dx; while (h-- > 0) { memcpy(d, s, w); @@ -317,7 +317,7 @@ void LabEngine::drawMaskImage(Image *im, uint16 x, uint16 y) { if ((w > 0) && (h > 0)) { byte *s = im->ImageData + sy * im->Width + sx; - byte *d = getVGABaseAddr() + dy * _screenWidth + dx; + byte *d = getCurrentDrawingBuffer() + dy * _screenWidth + dx; while (h-- > 0) { byte *ss = s; @@ -366,7 +366,7 @@ void LabEngine::readScreenImage(Image *im, uint16 x, uint16 y) { if ((w > 0) && (h > 0)) { byte *s = im->ImageData + sy * im->Width + sx; - byte *d = getVGABaseAddr() + dy * _screenWidth + dx; + byte *d = getCurrentDrawingBuffer() + dy * _screenWidth + dx; while (h-- > 0) { memcpy(s, d, w); @@ -540,7 +540,7 @@ void LabEngine::rectFill(uint16 x1, uint16 y1, uint16 x2, uint16 y2) { h = _screenHeight - dy; if ((w > 0) && (h > 0)) { - char *d = (char *)getVGABaseAddr() + dy * _screenWidth + dx; + char *d = (char *)getCurrentDrawingBuffer() + dy * _screenWidth + dx; while (h-- > 0) { char *dd = d; @@ -595,7 +595,7 @@ void LabEngine::ghoastRect(uint16 pencolor, uint16 x1, uint16 y1, uint16 x2, uin h = _screenHeight - dy; if ((w > 0) && (h > 0)) { - char *d = (char *)getVGABaseAddr() + dy * _screenWidth + dx; + char *d = (char *)getCurrentDrawingBuffer() + dy * _screenWidth + dx; while (h-- > 0) { char *dd = d; -- cgit v1.2.3 From 27c204976e15fa4759b540b972a81fa0762a8cc9 Mon Sep 17 00:00:00 2001 From: Eugene Sandulenko Date: Tue, 1 Dec 2015 11:18:11 +0100 Subject: LAB: Cleanup --- engines/lab/graphics.cpp | 117 +++++++++++++++++++++++------------------------ 1 file changed, 56 insertions(+), 61 deletions(-) diff --git a/engines/lab/graphics.cpp b/engines/lab/graphics.cpp index ea53292e3a..fa750a66ed 100644 --- a/engines/lab/graphics.cpp +++ b/engines/lab/graphics.cpp @@ -59,11 +59,9 @@ extern const char *CurFileName; /* Reads in a picture into the dest bitmap. */ /*****************************************************************************/ bool readPict(const char *filename, bool playOnce) { - byte **file = NULL; - stopDiff(); - file = g_lab->_music->newOpen(filename); + byte **file = g_lab->_music->newOpen(filename); if (file == NULL) { if ((filename[0] == 'p') || (filename[0] == 'P')) @@ -102,15 +100,14 @@ bool readMusic(const char *filename, bool waitTillFinished) { /* Reads in a picture into buffer memory. */ /*****************************************************************************/ byte *readPictToMem(const char *filename, uint16 x, uint16 y) { - byte **file = NULL; - byte *Mem, *CurMem; + byte *mem; stopDiff(); - allocFile((void **)&Mem, (int32) x * (int32) y, "Bitmap"); - CurMem = Mem; + allocFile((void **)&mem, (int32)x * (int32)y, "Bitmap"); + byte *curMem = mem; - file = g_lab->_music->newOpen(filename); + byte **file = g_lab->_music->newOpen(filename); if (file == NULL) return NULL; @@ -118,7 +115,7 @@ byte *readPictToMem(const char *filename, uint16 x, uint16 y) { DispBitMap->BytesPerRow = x; DispBitMap->Rows = y; DispBitMap->Flags = 0; - DispBitMap->Planes[0] = CurMem; + DispBitMap->Planes[0] = curMem; DispBitMap->Planes[1] = DispBitMap->Planes[0] + 0x10000; DispBitMap->Planes[2] = DispBitMap->Planes[1] + 0x10000; DispBitMap->Planes[3] = DispBitMap->Planes[2] + 0x10000; @@ -126,7 +123,7 @@ byte *readPictToMem(const char *filename, uint16 x, uint16 y) { readDiff(true); - return Mem; + return mem; } /*---------------------------------------------------------------------------*/ @@ -312,8 +309,8 @@ int32 LabEngine::longDrawMessage(const char *str) { if (!LongWinInFront) { LongWinInFront = true; - g_lab->setAPen(3); /* Clear Area */ - g_lab->rectFill(0, VGAScaleY(149) + SVGACord(2), VGAScaleX(319), VGAScaleY(199)); + setAPen(3); /* Clear Area */ + rectFill(0, VGAScaleY(149) + SVGACord(2), VGAScaleX(319), VGAScaleY(199)); } createBox(198); @@ -342,7 +339,7 @@ void LabEngine::drawMessage(const char *str) { } else { if (LongWinInFront) { LongWinInFront = false; - g_lab->drawPanel(); + drawPanel(); } _event->mouseHide(); @@ -372,13 +369,12 @@ void LabEngine::drawMessage(const char *str) { void LabEngine::doScrollBlack() { byte *mem, *tempmem; Image im; - uint16 width, height, by, nheight; uint32 size, copysize; uint32 *baseAddr; _event->mouseHide(); - width = VGAScaleX(320); - height = VGAScaleY(149) + SVGACord(2); + uint16 width = VGAScaleX(320); + uint16 height = VGAScaleY(149) + SVGACord(2); allocFile((void **)&mem, (int32)width * (int32)height, "Temp Mem"); @@ -386,21 +382,21 @@ void LabEngine::doScrollBlack() { im.Height = height; im.ImageData = mem; _music->updateMusic(); - g_lab->readScreenImage(&im, 0, 0); + readScreenImage(&im, 0, 0); _music->updateMusic(); - baseAddr = (uint32 *)g_lab->getCurrentDrawingBuffer(); + baseAddr = (uint32 *)getCurrentDrawingBuffer(); - by = VGAScaleX(4); - nheight = height; + uint16 by = VGAScaleX(4); + uint16 nheight = height; while (nheight) { _music->updateMusic(); if (!_isHiRes) - g_lab->waitTOF(); + waitTOF(); - baseAddr = (uint32 *)g_lab->getCurrentDrawingBuffer(); + baseAddr = (uint32 *)getCurrentDrawingBuffer(); if (by > nheight) by = nheight; @@ -411,8 +407,8 @@ void LabEngine::doScrollBlack() { tempmem = mem; while (size) { - if (size > g_lab->_screenBytesPerPage) - copysize = g_lab->_screenBytesPerPage; + if (size > _screenBytesPerPage) + copysize = _screenBytesPerPage; else copysize = size; @@ -422,10 +418,10 @@ void LabEngine::doScrollBlack() { tempmem += copysize; } - g_lab->setAPen(0); - g_lab->rectFill(0, nheight, width - 1, nheight + by - 1); + setAPen(0); + rectFill(0, nheight, width - 1, nheight + by - 1); - g_lab->screenUpdate(); + screenUpdate(); if (!_isHiRes) { if (nheight <= (height / 8)) @@ -475,27 +471,26 @@ static void copyPage(uint16 width, uint16 height, uint16 nheight, uint16 startli /* Scrolls the display to a new picture from a black screen. */ /*****************************************************************************/ void LabEngine::doScrollWipe(char *filename) { - byte *mem; - uint16 width, height, by, nheight, startline = 0, onrow = 0; + uint16 startline = 0, onrow = 0; _event->mouseHide(); - width = VGAScaleX(320); - height = VGAScaleY(149) + SVGACord(2); + uint16 width = VGAScaleX(320); + uint16 height = VGAScaleY(149) + SVGACord(2); while (_music->isSoundEffectActive()) { _music->updateMusic(); - g_lab->waitTOF(); + waitTOF(); } IsBM = true; readPict(filename, true); - g_lab->setPalette(diffcmap, 256); + setPalette(diffcmap, 256); IsBM = false; - mem = RawDiffBM.Planes[0]; + byte *mem = RawDiffBM.Planes[0]; _music->updateMusic(); - by = VGAScaleX(3); - nheight = height; + uint16 by = VGAScaleX(3); + uint16 nheight = height; while (onrow < headerdata.y) { _music->updateMusic(); @@ -511,7 +506,7 @@ void LabEngine::doScrollWipe(char *filename) { copyPage(width, height, nheight, startline, mem); - g_lab->screenUpdate(); + screenUpdate(); if (!nheight) startline += by; @@ -538,7 +533,7 @@ void LabEngine::doScrollBounce() { const uint16 newbyd[5] = {5, 4, 3, 2, 1}, newby1d[8] = {3, 3, 2, 2, 2, 1, 1, 1}; const uint16 newbyw[5] = {10, 8, 6, 4, 2}, newby1w[8] = {6, 6, 4, 4, 4, 2, 2, 2}; - if (g_lab->getPlatform() != Common::kPlatformWindows) { + if (getPlatform() != Common::kPlatformWindows) { newby = newbyd; newby1 = newby1d; } else { @@ -559,8 +554,8 @@ void LabEngine::doScrollBounce() { startline -= newby[i]; copyPage(width, height, 0, startline, mem); - g_lab->screenUpdate(); - g_lab->waitTOF(); + screenUpdate(); + waitTOF(); } for (int i = 8; i > 0; i--) { @@ -568,8 +563,8 @@ void LabEngine::doScrollBounce() { startline += newby1[i - 1]; copyPage(width, height, 0, startline, mem); - g_lab->screenUpdate(); - g_lab->waitTOF(); + screenUpdate(); + waitTOF(); } @@ -597,17 +592,17 @@ void LabEngine::doTransWipe(CloseDataPtr *cPtr, char *filename) { while (curY < lastY) { if (linesdone >= lineslast) { _music->updateMusic(); - g_lab->waitTOF(); + waitTOF(); linesdone = 0; } - g_lab->ghoastRect(0, 0, curY, g_lab->_screenWidth - 1, curY + 1); + ghoastRect(0, 0, curY, _screenWidth - 1, curY + 1); curY += 4; linesdone++; } } - g_lab->setAPen(0); + setAPen(0); for (uint16 i = 0; i < 2; i++) { curY = i * 2; @@ -615,11 +610,11 @@ void LabEngine::doTransWipe(CloseDataPtr *cPtr, char *filename) { while (curY <= lastY) { if (linesdone >= lineslast) { _music->updateMusic(); - g_lab->waitTOF(); + waitTOF(); linesdone = 0; } - g_lab->rectFill(0, curY, g_lab->_screenWidth - 1, curY + 1); + rectFill(0, curY, _screenWidth - 1, curY + 1); curY += 4; linesdone++; } @@ -632,17 +627,17 @@ void LabEngine::doTransWipe(CloseDataPtr *cPtr, char *filename) { else CurFileName = getPictName(cPtr); - byte *BitMapMem = readPictToMem(CurFileName, g_lab->_screenWidth, lastY + 5); - g_lab->setPalette(diffcmap, 256); + byte *BitMapMem = readPictToMem(CurFileName, _screenWidth, lastY + 5); + setPalette(diffcmap, 256); if (BitMapMem) { - imSource.Width = g_lab->_screenWidth; + imSource.Width = _screenWidth; imSource.Height = lastY; imSource.ImageData = BitMapMem; - imDest.Width = g_lab->_screenWidth; - imDest.Height = g_lab->_screenHeight; - imDest.ImageData = g_lab->getCurrentDrawingBuffer(); + imDest.Width = _screenWidth; + imDest.Height = _screenHeight; + imDest.ImageData = getCurrentDrawingBuffer(); for (uint16 i = 0; i < 2; i++) { curY = i * 2; @@ -650,14 +645,14 @@ void LabEngine::doTransWipe(CloseDataPtr *cPtr, char *filename) { while (curY < lastY) { if (linesdone >= lineslast) { _music->updateMusic(); - g_lab->waitTOF(); + waitTOF(); linesdone = 0; } - imDest.ImageData = g_lab->getCurrentDrawingBuffer(); + imDest.ImageData = getCurrentDrawingBuffer(); - g_lab->bltBitMap(&imSource, 0, curY, &imDest, 0, curY, g_lab->_screenWidth, 2); - g_lab->ghoastRect(0, 0, curY, g_lab->_screenWidth - 1, curY + 1); + bltBitMap(&imSource, 0, curY, &imDest, 0, curY, _screenWidth, 2); + ghoastRect(0, 0, curY, _screenWidth - 1, curY + 1); curY += 4; linesdone++; } @@ -669,16 +664,16 @@ void LabEngine::doTransWipe(CloseDataPtr *cPtr, char *filename) { while (curY <= lastY) { if (linesdone >= lineslast) { _music->updateMusic(); - g_lab->waitTOF(); + waitTOF(); linesdone = 0; } - imDest.ImageData = g_lab->getCurrentDrawingBuffer(); + imDest.ImageData = getCurrentDrawingBuffer(); if (curY == lastY) - g_lab->bltBitMap(&imSource, 0, curY, &imDest, 0, curY, g_lab->_screenWidth, 1); + bltBitMap(&imSource, 0, curY, &imDest, 0, curY, _screenWidth, 1); else - g_lab->bltBitMap(&imSource, 0, curY, &imDest, 0, curY, g_lab->_screenWidth, 2); + bltBitMap(&imSource, 0, curY, &imDest, 0, curY, _screenWidth, 2); curY += 4; linesdone++; -- cgit v1.2.3 From 83d88cab8065613c71f91ce2b941b00192694ae1 Mon Sep 17 00:00:00 2001 From: Strangerke Date: Tue, 1 Dec 2015 15:00:26 +0100 Subject: LAB: Some renaming, get rid of copytwo() --- engines/lab/diff.h | 35 ++++++++++--------- engines/lab/graphics.cpp | 32 ++++++++--------- engines/lab/readdiff.cpp | 62 ++++++++++++++++----------------- engines/lab/undiff.cpp | 90 ++++++++++++++++-------------------------------- 4 files changed, 95 insertions(+), 124 deletions(-) diff --git a/engines/lab/diff.h b/engines/lab/diff.h index 5ed627834b..4ff2059095 100644 --- a/engines/lab/diff.h +++ b/engines/lab/diff.h @@ -37,33 +37,34 @@ namespace Lab { struct DIFFHeader { - uint16 Version; // unused - uint16 x, y; - char depth; // unused - char fps; - uint32 BufferSize; // unused - uint16 Machine; // unused - uint32 Flags; + uint16 _version; // unused + uint16 _width; + uint16 _height; + char _depth; // unused + char _fps; + uint32 _bufferSize; // unused + uint16 _machine; // unused + uint32 _flags; }; struct BitMap { - uint16 BytesPerRow, Rows; - byte Flags; - byte *Planes[16]; + uint16 _bytesPerRow; + uint16 _rows; // unused + byte _flags; + byte *_planes[16]; }; +#define BITMAPF_NONE 0 #define BITMAPF_VIDEO (1<<7) /* unDiff.c */ -void initOffsets(uint16 bytesperrow); +void initOffsets(uint16 bytesPerRow); -bool unDIFFMemory(byte *Dest, /* Where to Un-DIFF */ - byte *diff, /* The DIFFed code. */ - uint16 HeaderSize, /* Size of header (1, 2 or 4 bytes) - (only supports 1 currently */ - uint16 CopySize); /* Size of minimum copy or skip. - (1, 2 or 4 bytes) */ +bool unDIFFMemory(byte *dest, /* Where to Un-DIFF */ + byte *diff, /* The DIFFed code. */ + uint16 headerSize, /* Size of header (1, 2 or 4 bytes) (only supports 1 currently */ + uint16 copySize); /* Size of minimum copy or skip. (1, 2 or 4 bytes) */ bool VUnDIFFMemory(byte *Dest, byte *diff, uint16 HeaderSize, uint16 CopySize, uint16 bytesperrow); void runLengthDecode(byte *Dest, byte *Source); diff --git a/engines/lab/graphics.cpp b/engines/lab/graphics.cpp index fa750a66ed..1adcb2dfe8 100644 --- a/engines/lab/graphics.cpp +++ b/engines/lab/graphics.cpp @@ -70,9 +70,9 @@ bool readPict(const char *filename, bool playOnce) { return false; } - DispBitMap->BytesPerRow = g_lab->_screenWidth; - DispBitMap->Rows = g_lab->_screenHeight; - DispBitMap->Flags = BITMAPF_VIDEO; + DispBitMap->_bytesPerRow = g_lab->_screenWidth; + DispBitMap->_rows = g_lab->_screenHeight; + DispBitMap->_flags = BITMAPF_VIDEO; readDiff(playOnce); @@ -112,14 +112,14 @@ byte *readPictToMem(const char *filename, uint16 x, uint16 y) { if (file == NULL) return NULL; - DispBitMap->BytesPerRow = x; - DispBitMap->Rows = y; - DispBitMap->Flags = 0; - DispBitMap->Planes[0] = curMem; - DispBitMap->Planes[1] = DispBitMap->Planes[0] + 0x10000; - DispBitMap->Planes[2] = DispBitMap->Planes[1] + 0x10000; - DispBitMap->Planes[3] = DispBitMap->Planes[2] + 0x10000; - DispBitMap->Planes[4] = DispBitMap->Planes[3] + 0x10000; + DispBitMap->_bytesPerRow = x; + DispBitMap->_rows = y; + DispBitMap->_flags = BITMAPF_NONE; + DispBitMap->_planes[0] = curMem; + DispBitMap->_planes[1] = DispBitMap->_planes[0] + 0x10000; + DispBitMap->_planes[2] = DispBitMap->_planes[1] + 0x10000; + DispBitMap->_planes[3] = DispBitMap->_planes[2] + 0x10000; + DispBitMap->_planes[4] = DispBitMap->_planes[3] + 0x10000; readDiff(true); @@ -486,19 +486,19 @@ void LabEngine::doScrollWipe(char *filename) { readPict(filename, true); setPalette(diffcmap, 256); IsBM = false; - byte *mem = RawDiffBM.Planes[0]; + byte *mem = RawDiffBM._planes[0]; _music->updateMusic(); uint16 by = VGAScaleX(3); uint16 nheight = height; - while (onrow < headerdata.y) { + while (onrow < headerdata._height) { _music->updateMusic(); if ((by > nheight) && nheight) by = nheight; - if ((startline + by) > (headerdata.y - height - 1)) + if ((startline + by) > (headerdata._height - height - 1)) break; if (nheight) @@ -544,10 +544,10 @@ void LabEngine::doScrollBounce() { _event->mouseHide(); int width = VGAScaleX(320); int height = VGAScaleY(149) + SVGACord(2); - byte *mem = RawDiffBM.Planes[0]; + byte *mem = RawDiffBM._planes[0]; _music->updateMusic(); - int startline = headerdata.y - height - 1; + int startline = headerdata._height - height - 1; for (int i = 0; i < 5; i++) { _music->updateMusic(); diff --git a/engines/lab/readdiff.cpp b/engines/lab/readdiff.cpp index 042889cd38..abaa4f54fe 100644 --- a/engines/lab/readdiff.cpp +++ b/engines/lab/readdiff.cpp @@ -59,7 +59,7 @@ static bool continuous, IsAnim = false, IsPal = false; -uint16 DataBytesPerRow; +uint16 _dataBytesPerRow; DIFFHeader headerdata; char diffcmap[256 * 3]; BitMap RawDiffBM; @@ -119,12 +119,12 @@ void LabEngine::diffNextFrame() { if (header == 65535) /* Already done. */ return; - if (DispBitMap->Flags & BITMAPF_VIDEO) { - DispBitMap->Planes[0] = getCurrentDrawingBuffer(); - DispBitMap->Planes[1] = DispBitMap->Planes[0] + 0x10000; - DispBitMap->Planes[2] = DispBitMap->Planes[1] + 0x10000; - DispBitMap->Planes[3] = DispBitMap->Planes[2] + 0x10000; - DispBitMap->Planes[4] = DispBitMap->Planes[3] + 0x10000; + if (DispBitMap->_flags & BITMAPF_VIDEO) { + DispBitMap->_planes[0] = getCurrentDrawingBuffer(); + DispBitMap->_planes[1] = DispBitMap->_planes[0] + 0x10000; + DispBitMap->_planes[2] = DispBitMap->_planes[1] + 0x10000; + DispBitMap->_planes[3] = DispBitMap->_planes[2] + 0x10000; + DispBitMap->_planes[4] = DispBitMap->_planes[3] + 0x10000; } _event->mouseHide(); @@ -134,7 +134,7 @@ void LabEngine::diffNextFrame() { _event->mouseShow(); if (!IsBM) { - if (headerdata.fps) { + if (headerdata._fps) { waitForTime(WaitSec, WaitMicros); addCurTime(0L, DelayMicros, &WaitSec, &WaitMicros); } @@ -162,7 +162,7 @@ void LabEngine::diffNextFrame() { IsAnim = (framenumber >= 3) && (!PlayOnce); CurBit = 0; - if (DispBitMap->Flags & BITMAPF_VIDEO) + if (DispBitMap->_flags & BITMAPF_VIDEO) screenUpdate(); return; /* done with the next frame. */ @@ -182,12 +182,12 @@ void LabEngine::diffNextFrame() { break; case 10L: - RawDiffBM.Planes[CurBit] = *difffile; + RawDiffBM._planes[CurBit] = *difffile; if (IsBM) (*difffile) += size; else { - readBlock(DrawBitMap->Planes[CurBit], size, difffile); + readBlock(DrawBitMap->_planes[CurBit], size, difffile); } CurBit++; @@ -195,26 +195,26 @@ void LabEngine::diffNextFrame() { case 11L: (*difffile) += 4; - runLengthDecode(DrawBitMap->Planes[CurBit], *difffile); + runLengthDecode(DrawBitMap->_planes[CurBit], *difffile); CurBit++; (*difffile) += size - 4; break; case 12L: (*difffile) += 4; - VRunLengthDecode(DrawBitMap->Planes[CurBit], *difffile, DrawBitMap->BytesPerRow); + VRunLengthDecode(DrawBitMap->_planes[CurBit], *difffile, DrawBitMap->_bytesPerRow); CurBit++; (*difffile) += size - 4; break; case 20L: - unDiff(DrawBitMap->Planes[CurBit], DispBitMap->Planes[CurBit], *difffile, DrawBitMap->BytesPerRow, false); + unDiff(DrawBitMap->_planes[CurBit], DispBitMap->_planes[CurBit], *difffile, DrawBitMap->_bytesPerRow, false); CurBit++; (*difffile) += size; break; case 21L: - unDiff(DrawBitMap->Planes[CurBit], DispBitMap->Planes[CurBit], *difffile, DrawBitMap->BytesPerRow, true); + unDiff(DrawBitMap->_planes[CurBit], DispBitMap->_planes[CurBit], *difffile, DrawBitMap->_bytesPerRow, true); CurBit++; (*difffile) += size; break; @@ -259,7 +259,7 @@ void LabEngine::diffNextFrame() { _music->updateMusic(); waitTOF(); - if (DispBitMap->Flags & BITMAPF_VIDEO) + if (DispBitMap->_flags & BITMAPF_VIDEO) didTOF = 1; } } @@ -334,29 +334,29 @@ void playDiff() { if (header == 0) { // sizeof(headerdata) != 18, but the padding might be at the end - headerdata.Version = READ_LE_UINT16(*difffile); + headerdata._version = READ_LE_UINT16(*difffile); (*difffile) += 2; - headerdata.x = READ_LE_UINT16(*difffile); + headerdata._width = READ_LE_UINT16(*difffile); (*difffile) += 2; - headerdata.y = READ_LE_UINT16(*difffile); + headerdata._height = READ_LE_UINT16(*difffile); (*difffile) += 2; - headerdata.depth = *difffile[0]; + headerdata._depth = *difffile[0]; (*difffile)++; - headerdata.fps = *difffile[0]; + headerdata._fps = *difffile[0]; (*difffile)++; - headerdata.BufferSize = READ_LE_UINT32(*difffile); + headerdata._bufferSize = READ_LE_UINT32(*difffile); (*difffile) += 4; - headerdata.Machine = READ_LE_UINT16(*difffile); + headerdata._machine = READ_LE_UINT16(*difffile); (*difffile) += 2; - headerdata.Flags = READ_LE_UINT32(*difffile); + headerdata._flags = READ_LE_UINT32(*difffile); (*difffile) += 4; (*difffile) += size - 18; - continuous = CONTINUOUS & headerdata.Flags; - diffwidth = headerdata.x; - diffheight = headerdata.y; - DataBytesPerRow = diffwidth; + continuous = CONTINUOUS & headerdata._flags; + diffwidth = headerdata._width; + diffheight = headerdata._height; + _dataBytesPerRow = diffwidth; numchunks = (((int32) diffwidth) * diffheight) / 0x10000; @@ -367,10 +367,10 @@ void playDiff() { } for (header = 0; header < 8; header++) - RawDiffBM.Planes[header] = NULL; + RawDiffBM._planes[header] = NULL; - if (headerdata.fps) - DelayMicros = ONESECOND / headerdata.fps; + if (headerdata._fps) + DelayMicros = ONESECOND / headerdata._fps; if (PlayOnce) { while (header != 65535) diff --git a/engines/lab/undiff.cpp b/engines/lab/undiff.cpp index f7d89898a4..e5f193c777 100644 --- a/engines/lab/undiff.cpp +++ b/engines/lab/undiff.cpp @@ -33,39 +33,15 @@ namespace Lab { -extern uint16 DataBytesPerRow; - - - -/*****************************************************************************/ -/* Copies memory. */ -/*****************************************************************************/ - -static void copytwo(byte *Dest, byte *Source) { -#if defined(USE_SWAP) - Dest[1] = Source[0]; - Dest[0] = Source[1]; -#else - *Dest = *Source; - Dest++; - Source++; - *Dest = *Source; -#endif -} - - - +extern uint16 _dataBytesPerRow; /*------------------------ unDiff Horizontal Memory -------------------------*/ - - - /*****************************************************************************/ /* Undiffs a piece of memory when header size is a byte, and copy/skip size */ /* is also a byte. */ /*****************************************************************************/ -static void unDIFFByteByte(byte *Dest, byte *diff) { +static void unDIFFByteByte(byte *dest, byte *diff) { uint16 skip, copy; while (1) { @@ -76,17 +52,17 @@ static void unDIFFByteByte(byte *Dest, byte *diff) { if (skip == 255) { if (copy == 0) { - copytwo((byte *) &skip, diff); + skip = READ_LE_UINT16(diff); diff += 2; - copytwo((byte *) ©, diff); + copy = READ_LE_UINT16(diff); diff += 2; } else if (copy == 255) return; } - Dest += skip; - memcpy(Dest, diff, copy); - Dest += copy; + dest += skip; + memcpy(dest, diff, copy); + dest += copy; diff += copy; } } @@ -97,7 +73,7 @@ static void unDIFFByteByte(byte *Dest, byte *diff) { /* Undiffs a piece of memory when header size is a byte, and copy/skip size */ /* is a word. */ /*****************************************************************************/ -static void unDIFFByteWord(uint16 *Dest, uint16 *diff) { +static void unDIFFByteWord(uint16 *dest, uint16 *diff) { uint16 skip, copy; while (1) { @@ -116,31 +92,31 @@ static void unDIFFByteWord(uint16 *Dest, uint16 *diff) { return; } - Dest += skip; + dest += skip; while (copy > 3) { - *Dest = READ_LE_UINT16(diff); - Dest++; + *dest = READ_LE_UINT16(diff); + dest++; diff++; - *Dest = READ_LE_UINT16(diff); - Dest++; + *dest = READ_LE_UINT16(diff); + dest++; diff++; - *Dest = READ_LE_UINT16(diff); - Dest++; + *dest = READ_LE_UINT16(diff); + dest++; diff++; - *Dest = READ_LE_UINT16(diff); - Dest++; + *dest = READ_LE_UINT16(diff); + dest++; diff++; copy -= 4; } while (copy) { - *Dest = READ_LE_UINT16(diff); - Dest++; + *dest = READ_LE_UINT16(diff); + dest++; diff++; copy--; } @@ -152,30 +128,24 @@ static void unDIFFByteWord(uint16 *Dest, uint16 *diff) { /*****************************************************************************/ /* UnDiffs a coded DIFF string onto an already initialized piece of memory. */ /*****************************************************************************/ -bool unDIFFMemory(byte *Dest, byte *diff, uint16 HeaderSize, uint16 CopySize) { - if (HeaderSize == 1) { - if (CopySize == 1) - unDIFFByteByte(Dest, diff); +bool unDIFFMemory(byte *dest, byte *diff, uint16 headerSize, uint16 copySize) { + if (headerSize == 1) { + if (copySize == 1) + unDIFFByteByte(dest, diff); - else if (CopySize == 2) - unDIFFByteWord((uint16 *)Dest, (uint16 *)diff); + else if (copySize == 2) + unDIFFByteWord((uint16 *)dest, (uint16 *)diff); else return false; } else - error("unDIFFMemory: HeaderSize is %d", HeaderSize); + error("unDIFFMemory: HeaderSize is %d", headerSize); return true; } - - - /*------------------------- unDiff Vertical Memory --------------------------*/ - - - /*****************************************************************************/ /* Undiffs a piece of memory when header size is a byte, and copy/skip size */ /* is a byte. */ @@ -186,7 +156,7 @@ static void VUnDIFFByteByte(byte *Dest, byte *diff, uint16 bytesperrow) { uint16 counter = 0; - while (counter < DataBytesPerRow) { + while (counter < _dataBytesPerRow) { CurPtr = Dest + counter; for (;;) { @@ -229,7 +199,7 @@ static void VUnDIFFByteWord(uint16 *Dest, uint16 *diff, uint16 bytesperrow) { wordsperrow = bytesperrow / 2; - while (counter < (DataBytesPerRow >> 1)) { + while (counter < (_dataBytesPerRow >> 1)) { CurPtr = Dest + counter; for (;;) { @@ -274,7 +244,7 @@ static void VUnDIFFByteLong(uint32 *Dest, uint32 *diff, uint16 bytesperrow) { longsperrow = bytesperrow / 4; - while (counter < (DataBytesPerRow >> 2)) { + while (counter < (_dataBytesPerRow >> 2)) { CurPtr = Dest + counter; for (;;) { @@ -373,7 +343,7 @@ void VRunLengthDecode(byte *Dest, byte *Source, uint16 bytesperrow) { int16 count; byte *Top = Dest; - for (uint16 i = 0; i < DataBytesPerRow; i++) { + for (uint16 i = 0; i < _dataBytesPerRow; i++) { Dest = Top; Dest += i; -- cgit v1.2.3 From d656aa4859352e3d08e15346a482c943c1868502 Mon Sep 17 00:00:00 2001 From: Strangerke Date: Tue, 1 Dec 2015 20:10:42 +0100 Subject: LAB: Introduce the Anim class (WIP) --- engines/lab/anim.cpp | 728 ++++++++++++++++++++++++++++++++++++++++++++ engines/lab/anim.h | 124 ++++++++ engines/lab/diff.h | 89 ------ engines/lab/engine.cpp | 66 ++-- engines/lab/graphics.cpp | 75 +++-- engines/lab/intro.cpp | 40 ++- engines/lab/lab.cpp | 7 +- engines/lab/lab.h | 3 +- engines/lab/labfun.h | 4 + engines/lab/map.cpp | 2 +- engines/lab/module.mk | 2 +- engines/lab/processroom.cpp | 27 +- engines/lab/readdiff.cpp | 390 +----------------------- engines/lab/special.cpp | 40 ++- engines/lab/undiff.cpp | 379 ----------------------- 15 files changed, 1000 insertions(+), 976 deletions(-) create mode 100644 engines/lab/anim.cpp create mode 100644 engines/lab/anim.h delete mode 100644 engines/lab/diff.h delete mode 100644 engines/lab/undiff.cpp diff --git a/engines/lab/anim.cpp b/engines/lab/anim.cpp new file mode 100644 index 0000000000..44d9eea5e8 --- /dev/null +++ b/engines/lab/anim.cpp @@ -0,0 +1,728 @@ +/* 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. + * + */ + +/* + * This code is based on Labyrinth of Time code with assistance of + * + * Copyright (c) 1993 Terra Nova Development + * Copyright (c) 2004 The Wyrmkeep Entertainment Co. + * + */ + +#include "common/endian.h" +#include "lab/lab.h" + +namespace Lab { + +extern uint16 _dataBytesPerRow; +extern BitMap *DrawBitMap; +extern byte **startoffile; +extern BitMap *DispBitMap; + +Anim::Anim(LabEngine *vm) : _vm(vm) { + header = 0; + CurBit = 0; + numchunks = 1; + IsBM = false; + headerdata._width = 0; + headerdata._height = 0; + headerdata._fps = 0; + headerdata._flags = 0; + WaitSec = 0; + WaitMicros = 0; + DelayMicros = 0; + continuous = false; + IsPlaying = false; + IsAnim = false; + IsPal = false; + nopalchange = false; + donepal = false; + framenumber = 0; + PlayOnce = false; + Buffer = nullptr; + storagefordifffile = nullptr; + difffile = &storagefordifffile; + size = 0; + RawDiffBM._bytesPerRow = 0; + RawDiffBM._flags = 0; + for (int i = 0; i < 16; i++) + RawDiffBM._planes[i] = nullptr; + RawDiffBM._rows = 0; + waitForEffect = false; + StopPlayingEnd = false; + samplespeed = 0; + DoBlack = false; + start = nullptr; + diffwidth = 0; + diffheight = 0; + stopsound = false; + + + for (int i = 0; i < 3 * 256; i++) + diffcmap[i] = 0; + +} + +/*------------------------ unDiff Horizontal Memory -------------------------*/ + +/*****************************************************************************/ +/* Undiffs a piece of memory when header size is a byte, and copy/skip size */ +/* is also a byte. */ +/*****************************************************************************/ +static void unDIFFByteByte(byte *dest, byte *diff) { + uint16 skip, copy; + + while (1) { + skip = *diff; + diff++; + copy = *diff; + diff++; + + if (skip == 255) { + if (copy == 0) { + skip = READ_LE_UINT16(diff); + diff += 2; + copy = READ_LE_UINT16(diff); + diff += 2; + } else if (copy == 255) + return; + } + + dest += skip; + memcpy(dest, diff, copy); + dest += copy; + diff += copy; + } +} + +/*****************************************************************************/ +/* Undiffs a piece of memory when header size is a byte, and copy/skip size */ +/* is a word. */ +/*****************************************************************************/ +static void unDIFFByteWord(uint16 *dest, uint16 *diff) { + uint16 skip, copy; + + while (1) { + skip = ((byte *)diff)[0]; + copy = ((byte *)diff)[1]; + + diff++; + + if (skip == 255) { + if (copy == 0) { + skip = READ_LE_UINT16(diff); + diff++; + copy = READ_LE_UINT16(diff); + diff++; + } else if (copy == 255) + return; + } + + dest += skip; + + while (copy > 3) { + *dest = READ_LE_UINT16(diff); + dest++; + diff++; + + *dest = READ_LE_UINT16(diff); + dest++; + diff++; + + *dest = READ_LE_UINT16(diff); + dest++; + diff++; + + *dest = READ_LE_UINT16(diff); + dest++; + diff++; + + copy -= 4; + } + + while (copy) { + *dest = READ_LE_UINT16(diff); + dest++; + diff++; + copy--; + } + } +} + +/*****************************************************************************/ +/* UnDiffs a coded DIFF string onto an already initialized piece of memory. */ +/*****************************************************************************/ +bool Anim::unDIFFMemory(byte *dest, byte *diff, uint16 headerSize, uint16 copySize) { + if (headerSize == 1) { + if (copySize == 1) + unDIFFByteByte(dest, diff); + + else if (copySize == 2) + unDIFFByteWord((uint16 *)dest, (uint16 *)diff); + + else + return false; + } else + error("unDIFFMemory: HeaderSize is %d", headerSize); + + return true; +} + +/*------------------------- unDiff Vertical Memory --------------------------*/ + +/*****************************************************************************/ +/* Undiffs a piece of memory when header size is a byte, and copy/skip size */ +/* is a byte. */ +/*****************************************************************************/ +static void VUnDIFFByteByte(byte *Dest, byte *diff, uint16 bytesperrow) { + byte *CurPtr; + uint16 skip, copy; + uint16 counter = 0; + + + while (counter < _dataBytesPerRow) { + CurPtr = Dest + counter; + + for (;;) { + skip = *diff; + diff++; + copy = *diff; + diff++; + + if (skip == 255) { + counter += copy; + break; + } + + else { + CurPtr += (skip * bytesperrow); + + while (copy) { + copy--; + *CurPtr = *diff; + CurPtr += bytesperrow; + diff++; + } + } + } + } +} + +/*****************************************************************************/ +/* Undiffs a piece of memory when header size is a byte, and copy/skip size */ +/* is a word. */ +/*****************************************************************************/ +static void VUnDIFFByteWord(uint16 *Dest, uint16 *diff, uint16 bytesperrow) { + uint16 *CurPtr; + uint16 skip, copy; + uint16 counter = 0, wordsperrow; + + + wordsperrow = bytesperrow / 2; + + while (counter < (_dataBytesPerRow >> 1)) { + CurPtr = Dest + counter; + + for (;;) { + skip = ((byte *)diff)[0]; + copy = ((byte *)diff)[1]; + + diff++; + + + if (skip == 255) { + counter += copy; + break; + } + + else { + CurPtr += (skip * wordsperrow); + + while (copy) { + *CurPtr = *diff; //swapUShort(*diff); + CurPtr += wordsperrow; + diff++; + copy--; + } + } + } + } +} + +/*****************************************************************************/ +/* Undiffs a piece of memory when header size is a byte, and copy/skip size */ +/* is a long. */ +/*****************************************************************************/ +static void VUnDIFFByteLong(uint32 *Dest, uint32 *diff, uint16 bytesperrow) { + uint32 *CurPtr; + uint16 skip, copy; + uint16 counter = 0, longsperrow; + byte *diff1 = (byte *)diff; + + + longsperrow = bytesperrow / 4; + + while (counter < (_dataBytesPerRow >> 2)) { + CurPtr = Dest + counter; + + for (;;) { + skip = *diff1; + diff1++; + + copy = *diff1; + diff1++; + + + if (skip == 255) { + counter += copy; + break; + } + + else { + CurPtr += (skip * longsperrow); + + while (copy) { + *CurPtr = *(uint32 *)diff1; //swapULong(*diff); + CurPtr += longsperrow; + diff1 += 4; + copy--; + } + } + } + } +} + +/*****************************************************************************/ +/* UnDiffs a coded DIFF string onto an already initialized piece of memory. */ +/*****************************************************************************/ +bool Anim::VUnDIFFMemory(byte *Dest, byte *diff, uint16 HeaderSize, uint16 CopySize, uint16 bytesperrow) { + if (HeaderSize == 1) { + if (CopySize == 1) + VUnDIFFByteByte(Dest, diff, bytesperrow); + + else if (CopySize == 2) + VUnDIFFByteWord((uint16 *)Dest, (uint16 *)diff, bytesperrow); + + else if (CopySize == 4) + VUnDIFFByteLong((uint32 *)Dest, (uint32 *)diff, bytesperrow); + + else + return false; + } else + return (false); + + return true; +} + +/*****************************************************************************/ +/* Runlength decodes a chunk of memory. */ +/*****************************************************************************/ +void Anim::runLengthDecode(byte *Dest, byte *Source) { + int8 num; + int16 count; + + + while (1) { + num = (int8)*Source; + Source++; + + if (num == 127) { + return; + } else if (num > '\0') { + memcpy(Dest, Source, num); + Source += num; + Dest += num; + } else { + count = (int16)(-num); + num = *Source; + Source++; + + while (count) { + *Dest = num; + Dest++; + count--; + } + } + } +} + +/*****************************************************************************/ +/* Does a vertical run length decode. */ +/*****************************************************************************/ +void Anim::VRunLengthDecode(byte *Dest, byte *Source, uint16 bytesperrow) { + int8 num; + int16 count; + byte *Top = Dest; + + for (uint16 i = 0; i < _dataBytesPerRow; i++) { + Dest = Top; + Dest += i; + + num = (int8)*Source; + Source++; + + while (num != 127) { + if (num > '\0') { + while (num) { + *Dest = *Source; + Source++; + Dest += bytesperrow; + num--; + } + } else { + count = (int16)(-num); + num = (int8)*Source; + Source++; + + while (count) { + *Dest = num; + Dest += bytesperrow; + count--; + } + } + + num = *Source; + Source++; + } + } +} + +/*****************************************************************************/ +/* Does the undiffing between the bitmaps. */ +/*****************************************************************************/ +void Anim::unDiff(byte *NewBuf, byte *OldBuf, byte *DiffData, uint16 bytesperrow, bool IsV) { + byte buftype; + + DiffData++; + buftype = *DiffData; + DiffData++; + + if (IsV) + VUnDIFFMemory(NewBuf, DiffData, 1, buftype + 1, bytesperrow); + else + unDIFFMemory(NewBuf, DiffData, 1, buftype + 1); +} + +void Anim::diffNextFrame() { + if (header == 65535) /* Already done. */ + return; + + if (DispBitMap->_flags & BITMAPF_VIDEO) { + DispBitMap->_planes[0] = g_lab->getCurrentDrawingBuffer(); + DispBitMap->_planes[1] = DispBitMap->_planes[0] + 0x10000; + DispBitMap->_planes[2] = DispBitMap->_planes[1] + 0x10000; + DispBitMap->_planes[3] = DispBitMap->_planes[2] + 0x10000; + DispBitMap->_planes[4] = DispBitMap->_planes[3] + 0x10000; + } + + _vm->_event->mouseHide(); + + while (1) { + if (CurBit >= numchunks) { + _vm->_event->mouseShow(); + + if (!IsBM) { + if (headerdata._fps) { + _vm->waitForTime(WaitSec, WaitMicros); + _vm->addCurTime(0L, DelayMicros, &WaitSec, &WaitMicros); + } + + if (IsPal && !nopalchange) { + _vm->setPalette(diffcmap, 256); + IsPal = false; + } + + donepal = true; + } + + if (IsPal && !nopalchange && !IsBM && !donepal) { + _vm->setPalette(diffcmap, 256); + IsPal = false; + } + + donepal = false; + + framenumber++; + + if ((framenumber == 1) && (continuous || (!PlayOnce))) + Buffer = *difffile; + + IsAnim = (framenumber >= 3) && (!PlayOnce); + CurBit = 0; + + if (DispBitMap->_flags & BITMAPF_VIDEO) + _vm->screenUpdate(); + + return; /* done with the next frame. */ + } + + _vm->_music->updateMusic(); + header = READ_LE_UINT32(*difffile); + *difffile += 4; + + size = READ_LE_UINT32(*difffile); + *difffile += 4; + + switch (header) { + case 8L: + readBlock(diffcmap, size, difffile); + IsPal = true; + break; + + case 10L: + RawDiffBM._planes[CurBit] = *difffile; + + if (IsBM) + (*difffile) += size; + else { + readBlock(DrawBitMap->_planes[CurBit], size, difffile); + } + + CurBit++; + break; + + case 11L: + (*difffile) += 4; + runLengthDecode(DrawBitMap->_planes[CurBit], *difffile); + CurBit++; + (*difffile) += size - 4; + break; + + case 12L: + (*difffile) += 4; + VRunLengthDecode(DrawBitMap->_planes[CurBit], *difffile, DrawBitMap->_bytesPerRow); + CurBit++; + (*difffile) += size - 4; + break; + + case 20L: + unDiff(DrawBitMap->_planes[CurBit], DispBitMap->_planes[CurBit], *difffile, DrawBitMap->_bytesPerRow, false); + CurBit++; + (*difffile) += size; + break; + + case 21L: + unDiff(DrawBitMap->_planes[CurBit], DispBitMap->_planes[CurBit], *difffile, DrawBitMap->_bytesPerRow, true); + CurBit++; + (*difffile) += size; + break; + + case 25L: + CurBit++; + break; + + case 26L: + CurBit++; + break; + + case 30L: + case 31L: { + if (waitForEffect) { + while (_vm->_music->isSoundEffectActive()) { + _vm->_music->updateMusic(); + _vm->waitTOF(); + } + } + + size -= 8L; + + + (*difffile) += 4; + samplespeed = READ_LE_UINT16(*difffile); + (*difffile) += 4; + + byte *music = *difffile; + uint32 musicsize = size; + (*difffile) += size; + + _vm->_music->playSoundEffect(samplespeed, musicsize, music); + break; + } + case 65535L: + if ((framenumber == 1) || PlayOnce || StopPlayingEnd) { + int didTOF = 0; + + if (waitForEffect) { + while (_vm->_music->isSoundEffectActive()) { + _vm->_music->updateMusic(); + _vm->waitTOF(); + + if (DispBitMap->_flags & BITMAPF_VIDEO) + didTOF = 1; + } + } + + IsPlaying = false; + _vm->_event->mouseShow(); + + if (!didTOF) + _vm->screenUpdate(); + + return; + } + + framenumber = 4; /* Random frame number so it never gets back to 2 */ + *difffile = Buffer; + break; + + default: + (*difffile) += size; + break; + } + } +} + +/*****************************************************************************/ +/* A separate task launched by readDiff. Plays the DIFF. */ +/*****************************************************************************/ +void Anim::playDiff() { + WaitSec = 0L; + WaitMicros = 0L; + DelayMicros = 0L; + header = 0; + CurBit = 0; + framenumber = 0; + numchunks = 1; + donepal = false; + StopPlayingEnd = false; + difffile = &storagefordifffile; + + IsPlaying = true; + + if (DoBlack) { + DoBlack = false; + blackScreen(); + } + + start = *startoffile; /* Make a copy of the pointer to the start of the file */ + *difffile = start; /* Now can modify the file without modifying the original */ + + if (start == NULL) { + IsPlaying = false; + return; + } + + continuous = false; + uint32 signature = READ_BE_UINT32(*difffile); + (*difffile) += 4; + + header = READ_LE_UINT32(*difffile); + (*difffile) += 4; + + if ((signature != MKTAG('D', 'I', 'F', 'F')) || (header != 1219009121L)) { + IsPlaying = false; + return; + } + + header = READ_LE_UINT32(*difffile); + (*difffile) += 4; + + size = READ_LE_UINT32(*difffile); + (*difffile) += 4; + + if (header == 0) { + // sizeof(headerdata) != 18, but the padding might be at the end + headerdata._version = READ_LE_UINT16(*difffile); + (*difffile) += 2; + headerdata._width = READ_LE_UINT16(*difffile); + (*difffile) += 2; + headerdata._height = READ_LE_UINT16(*difffile); + (*difffile) += 2; + headerdata._depth = *difffile[0]; + (*difffile)++; + headerdata._fps = *difffile[0]; + (*difffile)++; + headerdata._bufferSize = READ_LE_UINT32(*difffile); + (*difffile) += 4; + headerdata._machine = READ_LE_UINT16(*difffile); + (*difffile) += 2; + headerdata._flags = READ_LE_UINT32(*difffile); + (*difffile) += 4; + + (*difffile) += size - 18; + + continuous = CONTINUOUS & headerdata._flags; + diffwidth = headerdata._width; + diffheight = headerdata._height; + _dataBytesPerRow = diffwidth; + + numchunks = (((int32) diffwidth) * diffheight) / 0x10000; + + if ((uint32)(numchunks * 0x10000) < (uint32)(((int32) diffwidth) * diffheight)) + numchunks++; + } else { + return; + } + + for (header = 0; header < 8; header++) + RawDiffBM._planes[header] = NULL; + + if (headerdata._fps) + DelayMicros = ONESECOND / headerdata._fps; + + if (PlayOnce) { + while (header != 65535) + diffNextFrame(); + } else + diffNextFrame(); +} + +/*****************************************************************************/ +/* Stops an animation from running. */ +/*****************************************************************************/ +void Anim::stopDiff() { + if (IsPlaying) { + if (IsAnim) + blackScreen(); + } +} + +/*****************************************************************************/ +/* Stops an animation from running. */ +/*****************************************************************************/ +void Anim::stopDiffEnd() { + if (IsPlaying) { + StopPlayingEnd = true; + while (IsPlaying) { + g_lab->_music->updateMusic(); + diffNextFrame(); + } + } +} + +/*****************************************************************************/ +/* Stops the continuous sound from playing. */ +/*****************************************************************************/ +void Anim::stopSound() { + stopsound = true; +} + +/*****************************************************************************/ +/* Reads in a DIFF file. */ +/*****************************************************************************/ +bool Anim::readDiff(bool playonce) { + PlayOnce = playonce; + playDiff(); + return true; +} + +} // End of namespace Lab diff --git a/engines/lab/anim.h b/engines/lab/anim.h new file mode 100644 index 0000000000..0472a72d7f --- /dev/null +++ b/engines/lab/anim.h @@ -0,0 +1,124 @@ +/* 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. + * + */ + +/* + * This code is based on Labyrinth of Time code with assistance of + * + * Copyright (c) 1993 Terra Nova Development + * Copyright (c) 2004 The Wyrmkeep Entertainment Co. + * + */ + +#ifndef LAB_DIFF_H +#define LAB_DIFF_H + +#include "common/file.h" + +namespace Lab { + +class LabEngine; +#define CONTINUOUS 0xFFFF + +struct DIFFHeader { + uint16 _version; // unused + uint16 _width; + uint16 _height; + char _depth; // unused + char _fps; + uint32 _bufferSize; // unused + uint16 _machine; // unused + uint32 _flags; +}; + +struct BitMap { + uint16 _bytesPerRow; + uint16 _rows; // unused + byte _flags; + byte *_planes[16]; +}; + +#define BITMAPF_NONE 0 +#define BITMAPF_VIDEO (1<<7) + +class Anim { +private: + LabEngine *_vm; + + uint32 header; + uint16 CurBit; + uint16 numchunks; + uint32 WaitSec; + uint32 WaitMicros; + uint32 DelayMicros; + bool continuous; + bool IsPlaying; + bool IsAnim; + bool IsPal; + bool donepal; + uint16 framenumber; + bool PlayOnce; + byte *Buffer; + byte *storagefordifffile; + byte **difffile; + uint32 size; + bool StopPlayingEnd; + uint16 samplespeed; + byte *start; + uint32 diffwidth; + uint32 diffheight; + bool stopsound; + +public: + Anim(LabEngine *vm); + + DIFFHeader headerdata; + char diffcmap[256 * 3]; + bool IsBM; /* Just fill in the RawDIFFBM structure */ + bool waitForEffect; /* Wait for each sound effect to finish before continuing. */ + bool DoBlack; /* Black the screen before new picture */ + bool nopalchange; /* Don't change the palette. */ + BitMap RawDiffBM; + + void unDiff(byte *NewBuf, byte *OldBuf, byte *DiffData, uint16 bytesperrow, bool IsV); + bool unDIFFMemory(byte *dest, /* Where to Un-DIFF */ + byte *diff, /* The DIFFed code. */ + uint16 headerSize, /* Size of header (1, 2 or 4 bytes) (only supports 1 currently */ + uint16 copySize); /* Size of minimum copy or skip. (1, 2 or 4 bytes) */ + + bool VUnDIFFMemory(byte *dest, byte *diff, uint16 headerSize, uint16 copySize, uint16 bytesPerRow); + void runLengthDecode(byte *dest, byte *source); + void VRunLengthDecode(byte *dest, byte *source, uint16 bytesPerRow); + bool readDiff(bool playonce); + void diffNextFrame(); + void readSound(bool waitTillFinished, Common::File *file); + void stopDiff(); + void stopDiffEnd(); + void stopSound(); + void playDiff(); + +}; + +} // End of namespace Lab + +#endif /* LAB_DIFF_H */ + + diff --git a/engines/lab/diff.h b/engines/lab/diff.h deleted file mode 100644 index 4ff2059095..0000000000 --- a/engines/lab/diff.h +++ /dev/null @@ -1,89 +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. - * - */ - -/* - * This code is based on Labyrinth of Time code with assistance of - * - * Copyright (c) 1993 Terra Nova Development - * Copyright (c) 2004 The Wyrmkeep Entertainment Co. - * - */ - -#ifndef LAB_DIFF_H -#define LAB_DIFF_H - -#include "common/file.h" - -namespace Lab { - - -struct DIFFHeader { - uint16 _version; // unused - uint16 _width; - uint16 _height; - char _depth; // unused - char _fps; - uint32 _bufferSize; // unused - uint16 _machine; // unused - uint32 _flags; -}; - -struct BitMap { - uint16 _bytesPerRow; - uint16 _rows; // unused - byte _flags; - byte *_planes[16]; -}; - -#define BITMAPF_NONE 0 -#define BITMAPF_VIDEO (1<<7) - -/* unDiff.c */ - -void initOffsets(uint16 bytesPerRow); - -bool unDIFFMemory(byte *dest, /* Where to Un-DIFF */ - byte *diff, /* The DIFFed code. */ - uint16 headerSize, /* Size of header (1, 2 or 4 bytes) (only supports 1 currently */ - uint16 copySize); /* Size of minimum copy or skip. (1, 2 or 4 bytes) */ - -bool VUnDIFFMemory(byte *Dest, byte *diff, uint16 HeaderSize, uint16 CopySize, uint16 bytesperrow); -void runLengthDecode(byte *Dest, byte *Source); -void VRunLengthDecode(byte *Dest, byte *Source, uint16 bytesperrow); - -/* readDiff.c */ - -void blackScreen(); -void blackAllScreen(); -void whiteScreen(); -bool readDiff(bool playonce); -void diffNextFrame(); -void readSound(bool waitTillFinished, Common::File *file); -void stopDiff(); -void stopDiffEnd(); -void stopSound(); - -} // End of namespace Lab - -#endif /* LAB_DIFF_H */ - - diff --git a/engines/lab/engine.cpp b/engines/lab/engine.cpp index 4f44070c0d..3a7cd6f561 100644 --- a/engines/lab/engine.cpp +++ b/engines/lab/engine.cpp @@ -30,7 +30,7 @@ #include "lab/lab.h" #include "lab/labfun.h" -#include "lab/diff.h" +#include "lab/anim.h" #include "lab/text.h" #include "lab/intro.h" #include "lab/parsefun.h" @@ -46,7 +46,7 @@ bool LongWinInFront = false; TextFont *MsgFont; -extern bool DoBlack, waitForEffect, stopsound, DoNotDrawMessage, nopalchange; +extern bool stopsound, DoNotDrawMessage; /* Global parser data */ @@ -446,17 +446,17 @@ static const char *getInvName(uint16 CurInv) { else if (CurInv == WESTPAPERNUM) { CurFileName = Inventory[CurInv].BInvName; - nopalchange = true; + g_lab->_anim->nopalchange = true; readPict(CurFileName, false); - nopalchange = false; + g_lab->_anim->nopalchange = false; doWestPaper(); } else if (CurInv == NOTESNUM) { CurFileName = Inventory[CurInv].BInvName; - nopalchange = true; + g_lab->_anim->nopalchange = true; readPict(CurFileName, false); - nopalchange = false; + g_lab->_anim->nopalchange = false; doNotes(); } @@ -503,7 +503,7 @@ bool LabEngine::doUse(uint16 CurInv) { if (CurInv == MAPNUM) { /* LAB: Labyrinth specific */ drawStaticMessage(kTextUseMap); interfaceOff(); - stopDiff(); + _anim->stopDiff(); CurFileName = " "; CPtr = NULL; doMap(_roomNum); @@ -513,7 +513,7 @@ bool LabEngine::doUse(uint16 CurInv) { } else if (CurInv == JOURNALNUM) { /* LAB: Labyrinth specific */ drawStaticMessage(kTextUseJournal); interfaceOff(); - stopDiff(); + _anim->stopDiff(); CurFileName = " "; CPtr = NULL; doJournal(); @@ -530,18 +530,18 @@ bool LabEngine::doUse(uint16 CurInv) { _conditions->inclElement(LAMPON); } - DoBlack = false; - waitForEffect = true; + _anim->DoBlack = false; + _anim->waitForEffect = true; readPict("Music:Click", true); - waitForEffect = false; + _anim->waitForEffect = false; - DoBlack = false; + _anim->DoBlack = false; Test = getInvName(CurInv); } else if (CurInv == BELTNUM) { /* LAB: Labyrinth specific */ if (!_conditions->in(BELTGLOW)) _conditions->inclElement(BELTGLOW); - DoBlack = false; + _anim->DoBlack = false; Test = getInvName(CurInv); } else if (CurInv == WHISKEYNUM) { /* LAB: Labyrinth specific */ _conditions->inclElement(USEDHELMET); @@ -643,7 +643,7 @@ void LabEngine::mainGameLoop() { if (GotMessage) { if (QuitLab || g_engine->shouldQuit()) { - stopDiff(); + _anim->stopDiff(); break; } @@ -711,7 +711,7 @@ void LabEngine::mainGameLoop() { GotMessage = false; _music->checkRoomMusic(); _music->updateMusic(); - diffNextFrame(); + _anim->diffNextFrame(); if (_followingCrumbs) { int result = followCrumbs(); @@ -781,7 +781,7 @@ bool LabEngine::from_crumbs(uint32 tmpClass, uint16 code, uint16 Qualifier, Comm uint16 NewDir; - DoBlack = false; + _anim->DoBlack = false; if ((msgClass == RAWKEY) && (!LongWinInFront)) { if (code == 13) { /* The return key */ @@ -808,7 +808,7 @@ bool LabEngine::from_crumbs(uint32 tmpClass, uint16 code, uint16 Qualifier, Comm if (Alternate) { eatMessages(); Alternate = false; - DoBlack = true; + _anim->DoBlack = true; DoNotDrawMessage = false; MainDisplay = true; @@ -840,7 +840,7 @@ bool LabEngine::from_crumbs(uint32 tmpClass, uint16 code, uint16 Qualifier, Comm if (curMsg == NULL) { /* Does music load and next animation frame when you've run out of messages */ _music->updateMusic(); - diffNextFrame(); + _anim->diffNextFrame(); } else { if (curMsg->msgClass == RAWKEY) { if ((curMsg->code == 'Y') || (curMsg->code == 'y') || (curMsg->code == 'Q') || (curMsg->code == 'q')) { @@ -856,7 +856,7 @@ bool LabEngine::from_crumbs(uint32 tmpClass, uint16 code, uint16 Qualifier, Comm } if (doit) { - stopDiff(); + _anim->stopDiff(); return false; } else { forceDraw = true; @@ -887,7 +887,7 @@ bool LabEngine::from_crumbs(uint32 tmpClass, uint16 code, uint16 Qualifier, Comm if ((actionMode == 4) && (gadgetId == 4) && (CPtr != NULL)) { doMainView(&CPtr); - DoBlack = true; + _anim->DoBlack = true; HCPtr = NULL; CPtr = NULL; mayShowCrumbIndicator(); @@ -896,7 +896,7 @@ bool LabEngine::from_crumbs(uint32 tmpClass, uint16 code, uint16 Qualifier, Comm eatMessages(); Alternate = true; - DoBlack = true; + _anim->DoBlack = true; DoNotDrawMessage = false; interfaceOn(); /* Sets the correct gadget list */ @@ -957,7 +957,7 @@ bool LabEngine::from_crumbs(uint32 tmpClass, uint16 code, uint16 Qualifier, Comm NewDir = Direction; processArrow(&NewDir, gadgetId - 6); doTurn(Direction, NewDir, &CPtr); - DoBlack = true; + _anim->DoBlack = true; Direction = NewDir; forceDraw = true; @@ -968,9 +968,9 @@ bool LabEngine::from_crumbs(uint32 tmpClass, uint16 code, uint16 Qualifier, Comm if (doGoForward(&CPtr)) { if (OldRoomNum == _roomNum) - DoBlack = true; + _anim->DoBlack = true; } else { - DoBlack = true; + _anim->DoBlack = true; processArrow(&Direction, gadgetId - 6); if (OldRoomNum != _roomNum) { @@ -979,7 +979,7 @@ bool LabEngine::from_crumbs(uint32 tmpClass, uint16 code, uint16 Qualifier, Comm CurFileName = " "; forceDraw = true; } else { - DoBlack = true; + _anim->DoBlack = true; drawStaticMessage(kTextNoPath); } } @@ -1030,12 +1030,12 @@ bool LabEngine::from_crumbs(uint32 tmpClass, uint16 code, uint16 Qualifier, Comm } } } else if ((msgClass == GADGETUP) && Alternate) { - DoBlack = true; + _anim->DoBlack = true; if (gadgetId == 0) { eatMessages(); Alternate = false; - DoBlack = true; + _anim->DoBlack = true; DoNotDrawMessage = false; MainDisplay = true; @@ -1050,7 +1050,7 @@ bool LabEngine::from_crumbs(uint32 tmpClass, uint16 code, uint16 Qualifier, Comm if (gadgetId == 0) { interfaceOff(); - stopDiff(); + _anim->stopDiff(); CurFileName = " "; doit = !saveRestoreGame(); @@ -1134,7 +1134,7 @@ bool LabEngine::from_crumbs(uint32 tmpClass, uint16 code, uint16 Qualifier, Comm eatMessages(); Alternate = false; - DoBlack = true; + _anim->DoBlack = true; DoNotDrawMessage = false; MainDisplay = true; @@ -1202,7 +1202,7 @@ bool LabEngine::from_crumbs(uint32 tmpClass, uint16 code, uint16 Qualifier, Comm drawStaticMessage(kTextNothing); } else if (TempCPtr->GraphicName) { if (*(TempCPtr->GraphicName)) { - DoBlack = true; + _anim->DoBlack = true; CPtr = TempCPtr; } else if (curPos.y < (VGAScaleY(149) + SVGACord(2))) drawStaticMessage(kTextNothing); @@ -1253,7 +1253,7 @@ bool LabEngine::from_crumbs(uint32 tmpClass, uint16 code, uint16 Qualifier, Comm } else if ((msgClass == MOUSEBUTTONS) && (IEQUALIFIER_RBUTTON & Qualifier)) { eatMessages(); Alternate = !Alternate; - DoBlack = true; + _anim->DoBlack = true; DoNotDrawMessage = false; MainDisplay = true; interfaceOn(); /* Sets the correct gadget list */ @@ -1307,7 +1307,7 @@ void LabEngine::go() { Intro intro; intro.introSequence(); } else - DoBlack = true; + _anim->DoBlack = true; if (mem) { _event->mouseShow(); @@ -1330,7 +1330,7 @@ void LabEngine::go() { warning("STUB: waitForPress"); while (!1) { // 1 means ignore SDL_ProcessInput calls _music->updateMusic(); - diffNextFrame(); + _anim->diffNextFrame(); waitTOF(); } } diff --git a/engines/lab/graphics.cpp b/engines/lab/graphics.cpp index 1adcb2dfe8..145ccb6bba 100644 --- a/engines/lab/graphics.cpp +++ b/engines/lab/graphics.cpp @@ -29,7 +29,7 @@ */ #include "lab/lab.h" -#include "lab/diff.h" +#include "lab/anim.h" #include "lab/parsetypes.h" #include "lab/labfun.h" #include "lab/parsefun.h" @@ -41,12 +41,7 @@ namespace Lab { BitMap bit1, bit2, *DispBitMap = &bit1, *DrawBitMap = &bit1; - -extern BitMap RawDiffBM; -extern char diffcmap[256 * 3]; -extern bool IsBM, nopalchange; - -extern bool DoBlack, stopsound; +extern bool stopsound; extern TextFont *MsgFont; extern const char *CurFileName; @@ -54,12 +49,11 @@ extern const char *CurFileName; /*------ From readPict.c. Reads in pictures and animations from disk. ------*/ /*---------------------------------------------------------------------------*/ - /*****************************************************************************/ /* Reads in a picture into the dest bitmap. */ /*****************************************************************************/ bool readPict(const char *filename, bool playOnce) { - stopDiff(); + g_lab->_anim->stopDiff(); byte **file = g_lab->_music->newOpen(filename); @@ -74,7 +68,7 @@ bool readPict(const char *filename, bool playOnce) { DispBitMap->_rows = g_lab->_screenHeight; DispBitMap->_flags = BITMAPF_VIDEO; - readDiff(playOnce); + g_lab->_anim->readDiff(playOnce); return true; } @@ -90,8 +84,8 @@ bool readMusic(const char *filename, bool waitTillFinished) { if (!file) return false; - DoBlack = false; - readSound(waitTillFinished, file); + g_lab->_anim->DoBlack = false; + g_lab->_anim->readSound(waitTillFinished, file); return true; } @@ -102,7 +96,7 @@ bool readMusic(const char *filename, bool waitTillFinished) { byte *readPictToMem(const char *filename, uint16 x, uint16 y) { byte *mem; - stopDiff(); + g_lab->_anim->stopDiff(); allocFile((void **)&mem, (int32)x * (int32)y, "Bitmap"); byte *curMem = mem; @@ -121,7 +115,7 @@ byte *readPictToMem(const char *filename, uint16 x, uint16 y) { DispBitMap->_planes[3] = DispBitMap->_planes[2] + 0x10000; DispBitMap->_planes[4] = DispBitMap->_planes[3] + 0x10000; - readDiff(true); + g_lab->_anim->readDiff(true); return mem; } @@ -437,9 +431,6 @@ void LabEngine::doScrollBlack() { _event->mouseShow(); } -extern BitMap RawDiffBM; -extern DIFFHeader headerdata; - static void copyPage(uint16 width, uint16 height, uint16 nheight, uint16 startline, byte *mem) { uint32 size, offSet, copysize; uint16 curPage; @@ -482,23 +473,23 @@ void LabEngine::doScrollWipe(char *filename) { waitTOF(); } - IsBM = true; + _anim->IsBM = true; readPict(filename, true); - setPalette(diffcmap, 256); - IsBM = false; - byte *mem = RawDiffBM._planes[0]; + setPalette(_anim->diffcmap, 256); + _anim->IsBM = false; + byte *mem = _anim->RawDiffBM._planes[0]; _music->updateMusic(); uint16 by = VGAScaleX(3); uint16 nheight = height; - while (onrow < headerdata._height) { + while (onrow < _anim->headerdata._height) { _music->updateMusic(); if ((by > nheight) && nheight) by = nheight; - if ((startline + by) > (headerdata._height - height - 1)) + if ((startline + by) > (_anim->headerdata._height - height - 1)) break; if (nheight) @@ -544,10 +535,10 @@ void LabEngine::doScrollBounce() { _event->mouseHide(); int width = VGAScaleX(320); int height = VGAScaleY(149) + SVGACord(2); - byte *mem = RawDiffBM._planes[0]; + byte *mem = _anim->RawDiffBM._planes[0]; _music->updateMusic(); - int startline = headerdata._height - height - 1; + int startline = _anim->headerdata._height - height - 1; for (int i = 0; i < 5; i++) { _music->updateMusic(); @@ -628,7 +619,7 @@ void LabEngine::doTransWipe(CloseDataPtr *cPtr, char *filename) { CurFileName = getPictName(cPtr); byte *BitMapMem = readPictToMem(CurFileName, _screenWidth, lastY + 5); - setPalette(diffcmap, 256); + setPalette(_anim->diffcmap, 256); if (BitMapMem) { imSource.Width = _screenWidth; @@ -697,7 +688,37 @@ void LabEngine::doWipe(uint16 wipeType, CloseDataPtr *cPtr, char *filename) { else if (wipeType == READFIRSTFRAME) readPict(filename, false); else if (wipeType == READNEXTFRAME) - diffNextFrame(); + _anim->diffNextFrame(); +} + +static byte blackbuffer[256 * 3]; + +/*****************************************************************************/ +/* Changes the front screen to black. */ +/*****************************************************************************/ +void blackScreen() { + memset(blackbuffer, 0, 248 * 3); + g_lab->writeColorRegs(blackbuffer, 8, 248); + + g_system->delayMillis(32); +} + +/*****************************************************************************/ +/* Changes the front screen to white. */ +/*****************************************************************************/ +void whiteScreen() { + memset(blackbuffer, 255, 248 * 3); + g_lab->writeColorRegs(blackbuffer, 8, 248); +} + +/*****************************************************************************/ +/* Changes the entire screen to black. */ +/*****************************************************************************/ +void blackAllScreen() { + memset(blackbuffer, 0, 256 * 3); + g_lab->writeColorRegs(blackbuffer, 0, 256); + + g_system->delayMillis(32); } } // End of namespace Lab diff --git a/engines/lab/intro.cpp b/engines/lab/intro.cpp index e7f0187a73..a35984e623 100644 --- a/engines/lab/intro.cpp +++ b/engines/lab/intro.cpp @@ -32,13 +32,11 @@ #include "lab/intro.h" #include "lab/labfun.h" #include "lab/resource.h" -#include "lab/diff.h" +#include "lab/anim.h" #include "lab/text.h" #include "lab/interface.h" namespace Lab { -extern bool nopalchange, DoBlack; -extern char diffcmap[256 * 3]; extern uint16 *FadePalette; Intro::Intro() { @@ -144,7 +142,7 @@ void Intro::doPictText(const char *filename, TextFont *msgFont, bool isscreen) { if (msg == NULL) { g_lab->_music->updateMusic(); - g_lab->diffNextFrame(); + g_lab->_anim->diffNextFrame(); g_lab->getTime(&secs, µs); g_lab->anyTimeDiff(lastsecs, lastmicros, secs, micros, &secs, µs); @@ -239,8 +237,8 @@ void Intro::nReadPict(const char *filename, bool playOnce) { if (_quitIntro) return; - DoBlack = _introDoBlack; - stopDiffEnd(); + g_lab->_anim->DoBlack = _introDoBlack; + g_lab->_anim->stopDiffEnd(); readPict(finalFileName.c_str(), playOnce); } @@ -256,7 +254,7 @@ void Intro::introSequence() { 0x0CB3, 0x0DC4, 0x0DD6, 0x0EE7 }; - DoBlack = true; + g_lab->_anim->DoBlack = true; if (g_lab->getPlatform() != Common::kPlatformWindows) { nReadPict("EA0", true); @@ -278,12 +276,12 @@ void Intro::introSequence() { g_lab->_music->initMusic(); - nopalchange = true; + g_lab->_anim->nopalchange = true; if (g_lab->getPlatform() != Common::kPlatformWindows) nReadPict("TNDcycle.pic", true); else nReadPict("TNDcycle2.pic", true); - nopalchange = false; + g_lab->_anim->nopalchange = false; FadePalette = palette; @@ -291,9 +289,9 @@ void Intro::introSequence() { if (_quitIntro) break; - palette[i] = ((diffcmap[i * 3] >> 2) << 8) + - ((diffcmap[i * 3 + 1] >> 2) << 4) + - (diffcmap[i * 3 + 2] >> 2); + palette[i] = ((g_lab->_anim->diffcmap[i * 3] >> 2) << 8) + + ((g_lab->_anim->diffcmap[i * 3 + 1] >> 2) << 4) + + (g_lab->_anim->diffcmap[i * 3 + 2] >> 2); } g_lab->_music->updateMusic(); @@ -348,14 +346,14 @@ void Intro::introSequence() { TextFont *msgFont = g_lab->_resource->getFont("P:Map.fon"); - nopalchange = true; + g_lab->_anim->nopalchange = true; nReadPict("Intro.1", true); - nopalchange = false; + g_lab->_anim->nopalchange = false; for (uint16 i = 0; i < 16; i++) { - palette[i] = ((diffcmap[i * 3] >> 2) << 8) + - ((diffcmap[i * 3 + 1] >> 2) << 4) + - (diffcmap[i * 3 + 2] >> 2); + palette[i] = ((g_lab->_anim->diffcmap[i * 3] >> 2) << 8) + + ((g_lab->_anim->diffcmap[i * 3 + 1] >> 2) << 4) + + (g_lab->_anim->diffcmap[i * 3 + 2] >> 2); } doPictText("i.1", msgFont, true); @@ -395,11 +393,11 @@ void Intro::introSequence() { if (!_quitIntro) for (uint16 i = 0; i < 50; i++) { for (uint16 idx = (8 * 3); idx < (255 * 3); idx++) - diffcmap[idx] = 255 - diffcmap[idx]; + g_lab->_anim->diffcmap[idx] = 255 - g_lab->_anim->diffcmap[idx]; g_lab->_music->updateMusic(); g_lab->waitTOF(); - g_lab->setPalette(diffcmap, 256); + g_lab->setPalette(g_lab->_anim->diffcmap, 256); g_lab->waitTOF(); g_lab->waitTOF(); } @@ -438,7 +436,7 @@ void Intro::introSequence() { nReadPict("Daed7", false); doPictText("i.27", msgFont, false); doPictText("i.28", msgFont, false); - stopDiffEnd(); + g_lab->_anim->stopDiffEnd(); nReadPict("Daed8", true); doPictText("i.29", msgFont, false); @@ -460,7 +458,7 @@ void Intro::introSequence() { if (_quitIntro) { g_lab->setAPen(0); g_lab->rectFill(0, 0, g_lab->_screenWidth - 1, g_lab->_screenHeight - 1); - DoBlack = true; + g_lab->_anim->DoBlack = true; } closeFont(msgFont); diff --git a/engines/lab/lab.cpp b/engines/lab/lab.cpp index 7ebfa8c3d3..a6fe4cf32c 100644 --- a/engines/lab/lab.cpp +++ b/engines/lab/lab.cpp @@ -38,14 +38,14 @@ #include "engines/dialogs.h" #include "engines/engine.h" #include "engines/util.h" - #include "gui/message.h" +#include "engines/advancedDetector.h" #include "lab/lab.h" #include "lab/labfun.h" #include "lab/resource.h" +#include "lab/anim.h" -#include "engines/advancedDetector.h" namespace Lab { @@ -91,6 +91,7 @@ LabEngine::LabEngine(OSystem *syst, const ADGameDescription *gameDesc) _event = nullptr; _resource = nullptr; _music = nullptr; + _anim = nullptr; _lastMessageLong = false; _lastTooLong = false; @@ -109,6 +110,7 @@ LabEngine::~LabEngine() { delete _event; delete _resource; delete _music; + delete _anim; } Common::Error LabEngine::run() { @@ -120,6 +122,7 @@ Common::Error LabEngine::run() { _event = new EventManager(this); _resource = new Resource(this); _music = new Music(this); + _anim = new Anim(this); if (getPlatform() == Common::kPlatformWindows) { // Check if this is the Wyrmkeep trial diff --git a/engines/lab/lab.h b/engines/lab/lab.h index c427b08686..9327dbf562 100644 --- a/engines/lab/lab.h +++ b/engines/lab/lab.h @@ -40,6 +40,7 @@ #include "lab/mouse.h" #include "lab/music.h" #include "lab/resource.h" +#include "lab/anim.h" struct ADGameDescription; @@ -103,6 +104,7 @@ public: EventManager *_event; Resource *_resource; Music *_music; + Anim *_anim; int _roomNum; byte *_currentDisplayBuffer; @@ -175,7 +177,6 @@ public: void drawMap(uint16 CurRoom, uint16 CurMsg, uint16 Floor, bool fadeout, bool fadein); void processMap(uint16 CurRoom); void doMap(uint16 CurRoom); - void diffNextFrame(); void drawJournal(uint16 wipenum, bool needFade); void processJournal(); void doJournal(); diff --git a/engines/lab/labfun.h b/engines/lab/labfun.h index 4f7573e0b1..c1a6b35a09 100644 --- a/engines/lab/labfun.h +++ b/engines/lab/labfun.h @@ -213,6 +213,10 @@ void mouseCombination(Common::Point pos); void showTile(const char *filename, bool showsolution); void mouseTile(Common::Point pos); +void blackScreen(); +void blackAllScreen(); +void whiteScreen(); + } // End of namespace Lab #endif /* LAB_LABFUN_H */ diff --git a/engines/lab/map.cpp b/engines/lab/map.cpp index 36b01d10f7..1f4f0dbfe1 100644 --- a/engines/lab/map.cpp +++ b/engines/lab/map.cpp @@ -30,7 +30,7 @@ #include "lab/lab.h" #include "lab/labfun.h" -#include "lab/diff.h" +#include "lab/anim.h" #include "lab/text.h" #include "lab/mouse.h" #include "lab/parsefun.h" diff --git a/engines/lab/module.mk b/engines/lab/module.mk index c9682f256a..4f1ace8c9c 100644 --- a/engines/lab/module.mk +++ b/engines/lab/module.mk @@ -2,6 +2,7 @@ MODULE := engines/lab MODULE_OBJS := \ allocroom.o \ + anim.o \ detection.o \ engine.o \ graphics.o \ @@ -21,7 +22,6 @@ MODULE_OBJS := \ special.o \ text.o \ timing.o \ - undiff.o \ vga.o diff --git a/engines/lab/processroom.cpp b/engines/lab/processroom.cpp index 04fe70d3fd..5807227c51 100644 --- a/engines/lab/processroom.cpp +++ b/engines/lab/processroom.cpp @@ -35,7 +35,7 @@ #include "lab/parsetypes.h" #include "lab/parsefun.h" #include "lab/resource.h" -#include "lab/diff.h" +#include "lab/anim.h" #include "lab/interface.h" namespace Lab { @@ -49,8 +49,7 @@ InventoryData *Inventory; uint16 NumInv, ManyRooms, HighestCondition, Direction; const char *NewFileName; -extern bool DoNotDrawMessage, IsBM, noupdatediff, QuitLab, MusicOn, DoBlack, LongWinInFront; -extern char diffcmap[256 * 3]; +extern bool DoNotDrawMessage, noupdatediff, QuitLab, MusicOn, LongWinInFront; extern const char *CurFileName; extern CloseDataPtr CPtr; @@ -379,7 +378,7 @@ static void doActions(Action * APtr, CloseDataPtr *LCPtr) { case NOUPDATE: noupdatediff = true; - DoBlack = false; + g_lab->_anim->DoBlack = false; break; case FORCEUPDATE: @@ -445,7 +444,7 @@ static void doActions(Action * APtr, CloseDataPtr *LCPtr) { g_lab->_roomNum = APtr->Param1; Direction = APtr->Param2 - 1; *LCPtr = NULL; - DoBlack = true; + g_lab->_anim->DoBlack = true; break; case SETCLOSEUP: @@ -485,7 +484,7 @@ static void doActions(Action * APtr, CloseDataPtr *LCPtr) { while (1) { g_lab->_music->updateMusic(); - g_lab->diffNextFrame(); + g_lab->_anim->diffNextFrame(); g_lab->getTime(&CurSecs, &CurMicros); if ((CurSecs > StartSecs) || ((CurSecs == StartSecs) && @@ -520,7 +519,7 @@ static void doActions(Action * APtr, CloseDataPtr *LCPtr) { case WAITSOUND: while (g_lab->_music->isSoundEffectActive()) { g_lab->_music->updateMusic(); - g_lab->diffNextFrame(); + g_lab->_anim->diffNextFrame(); g_lab->waitTOF(); } @@ -555,17 +554,17 @@ static void doActions(Action * APtr, CloseDataPtr *LCPtr) { case SPECIALCMD: if (APtr->Param1 == 0) - DoBlack = true; + g_lab->_anim->DoBlack = true; else if (APtr->Param1 == 1) - DoBlack = (CPtr == NULL); + g_lab->_anim->DoBlack = (CPtr == NULL); else if (APtr->Param1 == 2) - DoBlack = (CPtr != NULL); + g_lab->_anim->DoBlack = (CPtr != NULL); else if (APtr->Param1 == 5) { /* inverse the palette */ for (uint16 idx = (8 * 3); idx < (255 * 3); idx++) - diffcmap[idx] = 255 - diffcmap[idx]; + g_lab->_anim->diffcmap[idx] = 255 - g_lab->_anim->diffcmap[idx]; g_lab->waitTOF(); - g_lab->setPalette(diffcmap, 256); + g_lab->setPalette(g_lab->_anim->diffcmap, 256); g_lab->waitTOF(); g_lab->waitTOF(); } else if (APtr->Param1 == 4) { /* white the palette */ @@ -574,7 +573,7 @@ static void doActions(Action * APtr, CloseDataPtr *LCPtr) { g_lab->waitTOF(); } else if (APtr->Param1 == 6) { /* Restore the palette */ g_lab->waitTOF(); - g_lab->setPalette(diffcmap, 256); + g_lab->setPalette(g_lab->_anim->diffcmap, 256); g_lab->waitTOF(); g_lab->waitTOF(); } else if (APtr->Param1 == 7) { /* Quick pause */ @@ -595,7 +594,7 @@ static void doActions(Action * APtr, CloseDataPtr *LCPtr) { } else { while (g_lab->_music->isSoundEffectActive()) { g_lab->_music->updateMusic(); - g_lab->diffNextFrame(); + g_lab->_anim->diffNextFrame(); g_lab->waitTOF(); } } diff --git a/engines/lab/readdiff.cpp b/engines/lab/readdiff.cpp index abaa4f54fe..43309ffd78 100644 --- a/engines/lab/readdiff.cpp +++ b/engines/lab/readdiff.cpp @@ -29,400 +29,16 @@ */ #include "lab/lab.h" -#include "lab/diff.h" +#include "lab/anim.h" #include "lab/labfun.h" #include "lab/mouse.h" namespace Lab { - -static bool PlayOnce = false; -static bool StopPlayingEnd = false; - -static uint32 header, size, WaitSec = 0L, WaitMicros = 0L, DelayMicros = 0L; -static uint16 CurBit = 0, framenumber = 0, samplespeed, numchunks = 1; -static byte *Buffer, temp[5]; -static bool donepal = false; -static byte *storagefordifffile, **difffile = &storagefordifffile; -static byte *start; -static uint32 diffwidth, diffheight; -static byte blackbuffer[256 * 3]; - -bool DoBlack = false, /* Black the screen before new picture */ - nopalchange = false, /* Don't change the palette. */ - IsBM = false, /* Just fill in the RawDIFFBM structure */ - stopsound = false, - waitForEffect = false; /* Wait for each sound effect to finish - before coninuing. */ - -static bool continuous, - IsPlaying = false, - IsAnim = false, - IsPal = false; +static byte temp[5]; uint16 _dataBytesPerRow; -DIFFHeader headerdata; -char diffcmap[256 * 3]; -BitMap RawDiffBM; - -extern BitMap *DispBitMap, *DrawBitMap; -extern byte **startoffile; - -#define CONTINUOUS 0xFFFF - - -/*****************************************************************************/ -/* Does the undiffing between the bitmaps. */ -/*****************************************************************************/ -void unDiff(byte *NewBuf, byte *OldBuf, byte *DiffData, uint16 bytesperrow, bool IsV) { - byte buftype; - - DiffData++; - buftype = *DiffData; - DiffData++; - - if (IsV) - VUnDIFFMemory(NewBuf, DiffData, 1, buftype + 1, bytesperrow); - else - unDIFFMemory(NewBuf, DiffData, 1, buftype + 1); -} - - -/*****************************************************************************/ -/* Changes the front screen to black. */ -/*****************************************************************************/ -void blackScreen() { - memset(blackbuffer, 0, 248 * 3); - g_lab->writeColorRegs(blackbuffer, 8, 248); - - g_system->delayMillis(32); -} - -/*****************************************************************************/ -/* Changes the front screen to white. */ -/*****************************************************************************/ -void whiteScreen() { - memset(blackbuffer, 255, 248 * 3); - g_lab->writeColorRegs(blackbuffer, 8, 248); -} - -/*****************************************************************************/ -/* Changes the entire screen to black. */ -/*****************************************************************************/ -void blackAllScreen() { - memset(blackbuffer, 0, 256 * 3); - g_lab->writeColorRegs(blackbuffer, 0, 256); - - g_system->delayMillis(32); -} - -void LabEngine::diffNextFrame() { - if (header == 65535) /* Already done. */ - return; - - if (DispBitMap->_flags & BITMAPF_VIDEO) { - DispBitMap->_planes[0] = getCurrentDrawingBuffer(); - DispBitMap->_planes[1] = DispBitMap->_planes[0] + 0x10000; - DispBitMap->_planes[2] = DispBitMap->_planes[1] + 0x10000; - DispBitMap->_planes[3] = DispBitMap->_planes[2] + 0x10000; - DispBitMap->_planes[4] = DispBitMap->_planes[3] + 0x10000; - } - - _event->mouseHide(); - - while (1) { - if (CurBit >= numchunks) { - _event->mouseShow(); - - if (!IsBM) { - if (headerdata._fps) { - waitForTime(WaitSec, WaitMicros); - addCurTime(0L, DelayMicros, &WaitSec, &WaitMicros); - } - - if (IsPal && !nopalchange) { - setPalette(diffcmap, 256); - IsPal = false; - } - - donepal = true; - } - - if (IsPal && !nopalchange && !IsBM && !donepal) { - setPalette(diffcmap, 256); - IsPal = false; - } - - donepal = false; - - framenumber++; - - if ((framenumber == 1) && (continuous || (!PlayOnce))) - Buffer = *difffile; - - IsAnim = (framenumber >= 3) && (!PlayOnce); - CurBit = 0; - - if (DispBitMap->_flags & BITMAPF_VIDEO) - screenUpdate(); - - return; /* done with the next frame. */ - } - - _music->updateMusic(); - header = READ_LE_UINT32(*difffile); - *difffile += 4; - - size = READ_LE_UINT32(*difffile); - *difffile += 4; - - switch (header) { - case 8L: - readBlock(diffcmap, size, difffile); - IsPal = true; - break; - - case 10L: - RawDiffBM._planes[CurBit] = *difffile; - - if (IsBM) - (*difffile) += size; - else { - readBlock(DrawBitMap->_planes[CurBit], size, difffile); - } - - CurBit++; - break; - - case 11L: - (*difffile) += 4; - runLengthDecode(DrawBitMap->_planes[CurBit], *difffile); - CurBit++; - (*difffile) += size - 4; - break; - - case 12L: - (*difffile) += 4; - VRunLengthDecode(DrawBitMap->_planes[CurBit], *difffile, DrawBitMap->_bytesPerRow); - CurBit++; - (*difffile) += size - 4; - break; - - case 20L: - unDiff(DrawBitMap->_planes[CurBit], DispBitMap->_planes[CurBit], *difffile, DrawBitMap->_bytesPerRow, false); - CurBit++; - (*difffile) += size; - break; - - case 21L: - unDiff(DrawBitMap->_planes[CurBit], DispBitMap->_planes[CurBit], *difffile, DrawBitMap->_bytesPerRow, true); - CurBit++; - (*difffile) += size; - break; - - case 25L: - CurBit++; - break; - - case 26L: - CurBit++; - break; - - case 30L: - case 31L: { - if (waitForEffect) { - while (_music->isSoundEffectActive()) { - _music->updateMusic(); - waitTOF(); - } - } - - size -= 8L; - - - (*difffile) += 4; - samplespeed = READ_LE_UINT16(*difffile); - (*difffile) += 4; - - byte *music = *difffile; - uint32 musicsize = size; - (*difffile) += size; - - _music->playSoundEffect(samplespeed, musicsize, music); - break; - } - case 65535L: - if ((framenumber == 1) || PlayOnce || StopPlayingEnd) { - int didTOF = 0; - - if (waitForEffect) { - while (_music->isSoundEffectActive()) { - _music->updateMusic(); - waitTOF(); - - if (DispBitMap->_flags & BITMAPF_VIDEO) - didTOF = 1; - } - } - - IsPlaying = false; - _event->mouseShow(); - - if (!didTOF) - screenUpdate(); - - return; - } - - framenumber = 4; /* Random frame number so it never gets back to 2 */ - *difffile = Buffer; - break; - - default: - (*difffile) += size; - break; - } - } -} - -/*****************************************************************************/ -/* A separate task launched by readDiff. Plays the DIFF. */ -/*****************************************************************************/ -void playDiff() { - WaitSec = 0L; - WaitMicros = 0L; - DelayMicros = 0L; - header = 0; - CurBit = 0; - framenumber = 0; - numchunks = 1; - donepal = false; - StopPlayingEnd = false; - difffile = &storagefordifffile; - - IsPlaying = true; - - if (DoBlack) { - DoBlack = false; - blackScreen(); - } - - start = *startoffile; /* Make a copy of the pointer to the start of the file */ - *difffile = start; /* Now can modify the file without modifying the original */ - - if (start == NULL) { - IsPlaying = false; - return; - } - - continuous = false; - uint32 signature = READ_BE_UINT32(*difffile); - (*difffile) += 4; - - header = READ_LE_UINT32(*difffile); - (*difffile) += 4; - - if ((signature != MKTAG('D', 'I', 'F', 'F')) || (header != 1219009121L)) { - IsPlaying = false; - return; - } - - header = READ_LE_UINT32(*difffile); - (*difffile) += 4; - - size = READ_LE_UINT32(*difffile); - (*difffile) += 4; - - if (header == 0) { - // sizeof(headerdata) != 18, but the padding might be at the end - headerdata._version = READ_LE_UINT16(*difffile); - (*difffile) += 2; - headerdata._width = READ_LE_UINT16(*difffile); - (*difffile) += 2; - headerdata._height = READ_LE_UINT16(*difffile); - (*difffile) += 2; - headerdata._depth = *difffile[0]; - (*difffile)++; - headerdata._fps = *difffile[0]; - (*difffile)++; - headerdata._bufferSize = READ_LE_UINT32(*difffile); - (*difffile) += 4; - headerdata._machine = READ_LE_UINT16(*difffile); - (*difffile) += 2; - headerdata._flags = READ_LE_UINT32(*difffile); - (*difffile) += 4; - - (*difffile) += size - 18; - - continuous = CONTINUOUS & headerdata._flags; - diffwidth = headerdata._width; - diffheight = headerdata._height; - _dataBytesPerRow = diffwidth; - - numchunks = (((int32) diffwidth) * diffheight) / 0x10000; - - if ((uint32)(numchunks * 0x10000) < (uint32)(((int32) diffwidth) * diffheight)) - numchunks++; - } else { - return; - } - - for (header = 0; header < 8; header++) - RawDiffBM._planes[header] = NULL; - - if (headerdata._fps) - DelayMicros = ONESECOND / headerdata._fps; - - if (PlayOnce) { - while (header != 65535) - g_lab->diffNextFrame(); - } else - g_lab->diffNextFrame(); -} - - - -/*****************************************************************************/ -/* Stops an animation from running. */ -/*****************************************************************************/ -void stopDiff() { - if (IsPlaying) { - if (IsAnim) - blackScreen(); - } -} - -/*****************************************************************************/ -/* Stops an animation from running. */ -/*****************************************************************************/ -void stopDiffEnd() { - if (IsPlaying) { - StopPlayingEnd = true; - while (IsPlaying) { - g_lab->_music->updateMusic(); - g_lab->diffNextFrame(); - } - } -} - - -/*****************************************************************************/ -/* Stops the continuous sound from playing. */ -/*****************************************************************************/ -void stopSound() { - stopsound = true; -} - -/*****************************************************************************/ -/* Reads in a DIFF file. */ -/*****************************************************************************/ -bool readDiff(bool playonce) { - PlayOnce = playonce; - playDiff(); - return true; -} - -void readSound(bool waitTillFinished, Common::File *file) { +void Anim::readSound(bool waitTillFinished, Common::File *file) { uint32 magicBytes = file->readUint32LE(); if (magicBytes != 1219009121L) return; diff --git a/engines/lab/special.cpp b/engines/lab/special.cpp index e23ea7035b..afe3efb64f 100644 --- a/engines/lab/special.cpp +++ b/engines/lab/special.cpp @@ -37,7 +37,7 @@ #include "lab/labfun.h" #include "lab/parsefun.h" #include "lab/interface.h" -#include "lab/diff.h" +#include "lab/anim.h" #include "lab/text.h" #include "lab/mouse.h" #include "lab/parsetypes.h" @@ -83,9 +83,7 @@ uint16 CurTile[4][4] = { extern TextFont *MsgFont; extern uint16 *FadePalette; -extern bool nopalchange, DoBlack; extern BitMap *DispBitMap, *DrawBitMap; -extern char diffcmap[3 * 256]; extern CloseDataPtr CPtr; extern InventoryData *Inventory; extern uint16 Direction; @@ -111,7 +109,7 @@ static byte *loadBackPict(const char *fileName, bool tomem) { byte *res = NULL; FadePalette = hipal; - nopalchange = true; + g_lab->_anim->nopalchange = true; if (tomem) res = readPictToMem(fileName, g_lab->_screenWidth, g_lab->_screenHeight); @@ -119,12 +117,12 @@ static byte *loadBackPict(const char *fileName, bool tomem) { readPict(fileName, true); for (uint16 i = 0; i < 16; i++) { - hipal[i] = ((diffcmap[i * 3] >> 2) << 8) + - ((diffcmap[i * 3 + 1] >> 2) << 4) + - ((diffcmap[i * 3 + 2] >> 2)); + hipal[i] = ((g_lab->_anim->diffcmap[i * 3] >> 2) << 8) + + ((g_lab->_anim->diffcmap[i * 3 + 1] >> 2) << 4) + + ((g_lab->_anim->diffcmap[i * 3 + 2] >> 2)); } - nopalchange = false; + g_lab->_anim->nopalchange = false; return res; } @@ -144,10 +142,10 @@ void showCombination(const char *filename) { byte **buffer; resetBuffer(); - DoBlack = true; - nopalchange = true; + g_lab->_anim->DoBlack = true; + g_lab->_anim->nopalchange = true; readPict(filename, true); - nopalchange = false; + g_lab->_anim->nopalchange = false; blackScreen(); @@ -160,7 +158,7 @@ void showCombination(const char *filename) { doCombination(); - g_lab->setPalette(diffcmap, 256); + g_lab->setPalette(g_lab->_anim->diffcmap, 256); } @@ -287,10 +285,10 @@ void showTile(const char *filename, bool showsolution) { byte **buffer; resetBuffer(); - DoBlack = true; - nopalchange = true; + g_lab->_anim->DoBlack = true; + g_lab->_anim->nopalchange = true; readPict(filename, true); - nopalchange = false; + g_lab->_anim->nopalchange = false; blackScreen(); if (showsolution) { @@ -311,7 +309,7 @@ void showTile(const char *filename, bool showsolution) { doTile(showsolution); - g_lab->setPalette(diffcmap, 256); + g_lab->setPalette(g_lab->_anim->diffcmap, 256); } static void scrollRaster(int16 dx, int16 dy, uint16 x1, uint16 y1, uint16 x2, uint16 y2) { @@ -425,7 +423,7 @@ static void changeTile(uint16 col, uint16 row) { if (check) { g_lab->_conditions->inclElement(BRICKOPEN); /* unlocked combination */ - DoBlack = true; + g_lab->_anim->DoBlack = true; check = readPict("p:Up/BDOpen", true); } } @@ -458,7 +456,7 @@ void doNotes() { char *ntext = g_lab->_resource->getText("Lab:Rooms/Notes"); flowText(noteFont, -2 + SVGACord(1), 0, 0, false, false, true, true, VGAScaleX(25) + SVGACord(15), VGAScaleY(50), VGAScaleX(295) - SVGACord(15), VGAScaleY(148), ntext); - g_lab->setPalette(diffcmap, 256); + g_lab->setPalette(g_lab->_anim->diffcmap, 256); closeFont(noteFont); delete[] ntext; @@ -502,7 +500,7 @@ void doWestPaper() { delete[] ntext; closeFont(paperFont); - g_lab->setPalette(diffcmap, 256); + g_lab->setPalette(g_lab->_anim->diffcmap, 256); freeAllStolenMem(); } @@ -674,14 +672,14 @@ void LabEngine::drawJournal(uint16 wipenum, bool needFade) { if (needFade) fade(true, 0); - nopalchange = true; + g_lab->_anim->nopalchange = true; JBackImage.ImageData = readPictToMem("P:Journal.pic", _screenWidth, _screenHeight); GotBackImage = true; eatMessages(); _event->mouseShow(); - nopalchange = false; + g_lab->_anim->nopalchange = false; } /*****************************************************************************/ diff --git a/engines/lab/undiff.cpp b/engines/lab/undiff.cpp deleted file mode 100644 index e5f193c777..0000000000 --- a/engines/lab/undiff.cpp +++ /dev/null @@ -1,379 +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. - * - */ - -/* - * This code is based on Labyrinth of Time code with assistance of - * - * Copyright (c) 1993 Terra Nova Development - * Copyright (c) 2004 The Wyrmkeep Entertainment Co. - * - */ - -#include "common/endian.h" -#include "lab/lab.h" - -namespace Lab { - -extern uint16 _dataBytesPerRow; - -/*------------------------ unDiff Horizontal Memory -------------------------*/ - -/*****************************************************************************/ -/* Undiffs a piece of memory when header size is a byte, and copy/skip size */ -/* is also a byte. */ -/*****************************************************************************/ -static void unDIFFByteByte(byte *dest, byte *diff) { - uint16 skip, copy; - - while (1) { - skip = *diff; - diff++; - copy = *diff; - diff++; - - if (skip == 255) { - if (copy == 0) { - skip = READ_LE_UINT16(diff); - diff += 2; - copy = READ_LE_UINT16(diff); - diff += 2; - } else if (copy == 255) - return; - } - - dest += skip; - memcpy(dest, diff, copy); - dest += copy; - diff += copy; - } -} - - - -/*****************************************************************************/ -/* Undiffs a piece of memory when header size is a byte, and copy/skip size */ -/* is a word. */ -/*****************************************************************************/ -static void unDIFFByteWord(uint16 *dest, uint16 *diff) { - uint16 skip, copy; - - while (1) { - skip = ((byte *)diff)[0]; - copy = ((byte *)diff)[1]; - - diff++; - - if (skip == 255) { - if (copy == 0) { - skip = READ_LE_UINT16(diff); - diff++; - copy = READ_LE_UINT16(diff); - diff++; - } else if (copy == 255) - return; - } - - dest += skip; - - while (copy > 3) { - *dest = READ_LE_UINT16(diff); - dest++; - diff++; - - *dest = READ_LE_UINT16(diff); - dest++; - diff++; - - *dest = READ_LE_UINT16(diff); - dest++; - diff++; - - *dest = READ_LE_UINT16(diff); - dest++; - diff++; - - copy -= 4; - } - - while (copy) { - *dest = READ_LE_UINT16(diff); - dest++; - diff++; - copy--; - } - } -} - - - -/*****************************************************************************/ -/* UnDiffs a coded DIFF string onto an already initialized piece of memory. */ -/*****************************************************************************/ -bool unDIFFMemory(byte *dest, byte *diff, uint16 headerSize, uint16 copySize) { - if (headerSize == 1) { - if (copySize == 1) - unDIFFByteByte(dest, diff); - - else if (copySize == 2) - unDIFFByteWord((uint16 *)dest, (uint16 *)diff); - - else - return false; - } else - error("unDIFFMemory: HeaderSize is %d", headerSize); - - return true; -} - -/*------------------------- unDiff Vertical Memory --------------------------*/ - -/*****************************************************************************/ -/* Undiffs a piece of memory when header size is a byte, and copy/skip size */ -/* is a byte. */ -/*****************************************************************************/ -static void VUnDIFFByteByte(byte *Dest, byte *diff, uint16 bytesperrow) { - byte *CurPtr; - uint16 skip, copy; - uint16 counter = 0; - - - while (counter < _dataBytesPerRow) { - CurPtr = Dest + counter; - - for (;;) { - skip = *diff; - diff++; - copy = *diff; - diff++; - - if (skip == 255) { - counter += copy; - break; - } - - else { - CurPtr += (skip * bytesperrow); - - while (copy) { - copy--; - *CurPtr = *diff; - CurPtr += bytesperrow; - diff++; - } - } - } - } -} - - - - -/*****************************************************************************/ -/* Undiffs a piece of memory when header size is a byte, and copy/skip size */ -/* is a word. */ -/*****************************************************************************/ -static void VUnDIFFByteWord(uint16 *Dest, uint16 *diff, uint16 bytesperrow) { - uint16 *CurPtr; - uint16 skip, copy; - uint16 counter = 0, wordsperrow; - - - wordsperrow = bytesperrow / 2; - - while (counter < (_dataBytesPerRow >> 1)) { - CurPtr = Dest + counter; - - for (;;) { - skip = ((byte *)diff)[0]; - copy = ((byte *)diff)[1]; - - diff++; - - - if (skip == 255) { - counter += copy; - break; - } - - else { - CurPtr += (skip * wordsperrow); - - while (copy) { - *CurPtr = *diff; //swapUShort(*diff); - CurPtr += wordsperrow; - diff++; - copy--; - } - } - } - } -} - - - - -/*****************************************************************************/ -/* Undiffs a piece of memory when header size is a byte, and copy/skip size */ -/* is a long. */ -/*****************************************************************************/ -static void VUnDIFFByteLong(uint32 *Dest, uint32 *diff, uint16 bytesperrow) { - uint32 *CurPtr; - uint16 skip, copy; - uint16 counter = 0, longsperrow; - byte *diff1 = (byte *)diff; - - - longsperrow = bytesperrow / 4; - - while (counter < (_dataBytesPerRow >> 2)) { - CurPtr = Dest + counter; - - for (;;) { - skip = *diff1; - diff1++; - - copy = *diff1; - diff1++; - - - if (skip == 255) { - counter += copy; - break; - } - - else { - CurPtr += (skip * longsperrow); - - while (copy) { - *CurPtr = *(uint32 *)diff1; //swapULong(*diff); - CurPtr += longsperrow; - diff1 += 4; - copy--; - } - } - } - } -} - - - - -/*****************************************************************************/ -/* UnDiffs a coded DIFF string onto an already initialized piece of memory. */ -/*****************************************************************************/ -bool VUnDIFFMemory(byte *Dest, byte *diff, uint16 HeaderSize, uint16 CopySize, uint16 bytesperrow) { - if (HeaderSize == 1) { - if (CopySize == 1) - VUnDIFFByteByte(Dest, diff, bytesperrow); - - else if (CopySize == 2) - VUnDIFFByteWord((uint16 *)Dest, (uint16 *)diff, bytesperrow); - - else if (CopySize == 4) - VUnDIFFByteLong((uint32 *)Dest, (uint32 *)diff, bytesperrow); - - else - return false; - } else - return (false); - - return true; -} - - -/*****************************************************************************/ -/* Runlength decodes a chunk of memory. */ -/*****************************************************************************/ -void runLengthDecode(byte *Dest, byte *Source) { - int8 num; - int16 count; - - - while (1) { - num = (int8)*Source; - Source++; - - if (num == 127) { - return; - } else if (num > '\0') { - memcpy(Dest, Source, num); - Source += num; - Dest += num; - } else { - count = (int16)(-num); - num = *Source; - Source++; - - while (count) { - *Dest = num; - Dest++; - count--; - } - } - } -} - - - - -/*****************************************************************************/ -/* Does a vertical run length decode. */ -/*****************************************************************************/ -void VRunLengthDecode(byte *Dest, byte *Source, uint16 bytesperrow) { - int8 num; - int16 count; - byte *Top = Dest; - - for (uint16 i = 0; i < _dataBytesPerRow; i++) { - Dest = Top; - Dest += i; - - num = (int8)*Source; - Source++; - - while (num != 127) { - if (num > '\0') { - while (num) { - *Dest = *Source; - Source++; - Dest += bytesperrow; - num--; - } - } else { - count = (int16)(-num); - num = (int8)*Source; - Source++; - - while (count) { - *Dest = num; - Dest += bytesperrow; - count--; - } - } - - num = *Source; - Source++; - } - } -} - -} // End of namespace Lab -- cgit v1.2.3 From 148d64eceb86e6756f0ff77b664bd6592a7dc016 Mon Sep 17 00:00:00 2001 From: Eugene Sandulenko Date: Tue, 1 Dec 2015 21:42:44 +0100 Subject: LAB: Put Image into a separate class. Leaks memory for now --- engines/lab/engine.cpp | 25 ++++--- engines/lab/graphics.cpp | 3 +- engines/lab/image.cpp | 183 ++++++++++++++++++++++++++++++++++++++++++++++ engines/lab/image.h | 54 ++++++++++++++ engines/lab/interface.cpp | 9 ++- engines/lab/lab.h | 9 --- engines/lab/labfun.h | 3 +- engines/lab/map.cpp | 129 ++++++++++++++------------------ engines/lab/module.mk | 2 +- engines/lab/mouse.cpp | 9 ++- engines/lab/special.cpp | 25 ++++--- engines/lab/vga.cpp | 144 +++--------------------------------- 12 files changed, 339 insertions(+), 256 deletions(-) create mode 100644 engines/lab/image.cpp create mode 100644 engines/lab/image.h diff --git a/engines/lab/engine.cpp b/engines/lab/engine.cpp index 3a7cd6f561..e401e062ed 100644 --- a/engines/lab/engine.cpp +++ b/engines/lab/engine.cpp @@ -31,6 +31,7 @@ #include "lab/lab.h" #include "lab/labfun.h" #include "lab/anim.h" +#include "lab/image.h" #include "lab/text.h" #include "lab/intro.h" #include "lab/parsefun.h" @@ -223,7 +224,7 @@ bool LabEngine::setUpScreens() { buffer = MovePanelBuffer; for (uint16 i = 0; i < 20; i++) - readImage(&buffer, &(MoveImages[i])); + MoveImages[i] = new Image(&buffer); /* Creates the gadgets for the movement control panel */ y = VGAScaleY(173) - SVGACord(2); @@ -287,7 +288,7 @@ bool LabEngine::setUpScreens() { if (getPlatform() == Common::kPlatformWindows) { for (uint16 imgIdx = 0; imgIdx < 10; imgIdx++) - readImage(&buffer, &(InvImages[imgIdx])); + InvImages[imgIdx] = new Image(&buffer); InvGadgetList = createButton(24, y, 0, 'm', InvImages[0], InvImages[1]); curgad = InvGadgetList; @@ -307,7 +308,7 @@ bool LabEngine::setUpScreens() { curgad = curgad->NextGadget; } else { for (uint16 imgIdx = 0; imgIdx < 6; imgIdx++) - readImage(&buffer, &(InvImages[imgIdx])); + InvImages[imgIdx] = new Image(&buffer); InvGadgetList = createButton(58, y, 0, 0, InvImages[0], InvImages[1]); curgad = InvGadgetList; @@ -345,7 +346,7 @@ void LabEngine::perFlipGadget(uint16 GadID) { if (!Alternate) { _event->mouseHide(); - drawImage(TopGad->Im, TopGad->x, TopGad->y); + TopGad->Im->drawImage(TopGad->x, TopGad->y); _event->mouseShow(); } @@ -1410,30 +1411,30 @@ int LabEngine::followCrumbs() { return moveDir; } +byte dropCrumbs[] = { 0x00 }; +Image dropCrumbsImage(24, 24, dropCrumbs); + void LabEngine::mayShowCrumbIndicator() { if (getPlatform() != Common::kPlatformWindows) return; if (_droppingCrumbs && MainDisplay) { - static byte dropCrumbs[] = { 0x00 }; - static Image dropCrumbsImage = { 24, 24, dropCrumbs }; - _event->mouseHide(); - drawMaskImage(&dropCrumbsImage, 612, 4); + dropCrumbsImage.drawMaskImage(612, 4); _event->mouseShow(); } } +byte dropCrumbsOff[] = { 0x00 }; +Image dropCrumbsOffImage(24, 24, dropCrumbsOff); + void LabEngine::mayShowCrumbIndicatorOff() { if (getPlatform() != Common::kPlatformWindows) return; if (MainDisplay) { - static byte dropCrumbsOff[] = { 0x00 }; - static Image dropCrumbsOffImage = { 24, 24, dropCrumbsOff }; - _event->mouseHide(); - drawMaskImage(&dropCrumbsOffImage, 612, 4); + dropCrumbsOffImage.drawMaskImage(612, 4); _event->mouseShow(); } } diff --git a/engines/lab/graphics.cpp b/engines/lab/graphics.cpp index 145ccb6bba..16283eab5e 100644 --- a/engines/lab/graphics.cpp +++ b/engines/lab/graphics.cpp @@ -31,6 +31,7 @@ #include "lab/lab.h" #include "lab/anim.h" #include "lab/parsetypes.h" +#include "lab/image.h" #include "lab/labfun.h" #include "lab/parsefun.h" #include "lab/mouse.h" @@ -376,7 +377,7 @@ void LabEngine::doScrollBlack() { im.Height = height; im.ImageData = mem; _music->updateMusic(); - readScreenImage(&im, 0, 0); + im.readScreenImage(0, 0); _music->updateMusic(); baseAddr = (uint32 *)getCurrentDrawingBuffer(); diff --git a/engines/lab/image.cpp b/engines/lab/image.cpp new file mode 100644 index 0000000000..636ac82d29 --- /dev/null +++ b/engines/lab/image.cpp @@ -0,0 +1,183 @@ +/* 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. + * + */ + +/* + * This code is based on Labyrinth of Time code with assistance of + * + * Copyright (c) 1993 Terra Nova Development + * Copyright (c) 2004 The Wyrmkeep Entertainment Co. + * + */ + +#include "lab/lab.h" +#include "lab/image.h" + +namespace Lab { + +/*****************************************************************************/ +/* Reads in an image from disk. */ +/*****************************************************************************/ +Image::Image(byte **buffer) { + uint32 size; + + Width = READ_LE_UINT16(*buffer); + Height = READ_LE_UINT16(*buffer + 2); + + *buffer += 8; /* sizeof(struct Image); */ + + size = Width * Height; + + if (1L & size) + size++; + + ImageData = (byte *)(*buffer); + (*buffer) += size; +} + +/*****************************************************************************/ +/* Draws an image to the screen. */ +/*****************************************************************************/ +void Image::drawImage(uint16 x, uint16 y) { + int sx = 0, sy = 0; + int dx = x, dy = y; + int w = Width; + int h = Height; + + if (dx < 0) { + sx -= dx; + w += dx; + dx = 0; + } + + if (dy < 0) { + sy -= dy; + w += dy; + dy = 0; + } + + if (dx + w > g_lab->_screenWidth) + w = g_lab->_screenWidth - dx; + + if (dy + h > g_lab->_screenHeight) + h = g_lab->_screenHeight - dy; + + if ((w > 0) && (h > 0)) { + byte *s = ImageData + sy * Width + sx; + byte *d = g_lab->getCurrentDrawingBuffer() + dy * g_lab->_screenWidth + dx; + + while (h-- > 0) { + memcpy(d, s, w); + s += Width; + d += g_lab->_screenWidth; + } + } +} + +/*****************************************************************************/ +/* Draws an image to the screen. */ +/*****************************************************************************/ +void Image::drawMaskImage(uint16 x, uint16 y) { + int sx = 0, sy = 0; + int dx = x, dy = y; + int w = Width; + int h = Height; + + if (dx < 0) { + sx -= dx; + w += dx; + dx = 0; + } + + if (dy < 0) { + sy -= dy; + w += dy; + dy = 0; + } + + if (dx + w > g_lab->_screenWidth) + w = g_lab->_screenWidth - dx; + + if (dy + h > g_lab->_screenHeight) + h = g_lab->_screenHeight - dy; + + if ((w > 0) && (h > 0)) { + byte *s = ImageData + sy * Width + sx; + byte *d = g_lab->getCurrentDrawingBuffer() + dy * g_lab->_screenWidth + dx; + + while (h-- > 0) { + byte *ss = s; + byte *dd = d; + int ww = w; + + while (ww-- > 0) { + byte c = *ss++; + + if (c) *dd++ = c - 1; + else dd++; + } + + s += Width; + d += g_lab->_screenWidth; + } + } +} + +/*****************************************************************************/ +/* Reads an image from the screen. */ +/*****************************************************************************/ +void Image::readScreenImage(uint16 x, uint16 y) { + int sx = 0, sy = 0; + int dx = x, dy = y; + int w = Width; + int h = Height; + + if (dx < 0) { + sx -= dx; + w += dx; + dx = 0; + } + + if (dy < 0) { + sy -= dy; + w += dy; + dy = 0; + } + + if (dx + w > g_lab->_screenWidth) + w = g_lab->_screenWidth - dx; + + if (dy + h > g_lab->_screenHeight) + h = g_lab->_screenHeight - dy; + + if ((w > 0) && (h > 0)) { + byte *s = ImageData + sy * Width + sx; + byte *d = g_lab->getCurrentDrawingBuffer() + dy * g_lab->_screenWidth + dx; + + while (h-- > 0) { + memcpy(s, d, w); + s += Width; + d += g_lab->_screenWidth; + } + } +} + +} // End of namespace Lab diff --git a/engines/lab/image.h b/engines/lab/image.h new file mode 100644 index 0000000000..c8a001af4d --- /dev/null +++ b/engines/lab/image.h @@ -0,0 +1,54 @@ +/* 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. + * + */ + +/* + * This code is based on Labyrinth of Time code with assistance of + * + * Copyright (c) 1993 Terra Nova Development + * Copyright (c) 2004 The Wyrmkeep Entertainment Co. + * + */ + +#ifndef LAB_IMAGE_H +#define LAB_IMAGE_H + +namespace Lab { + +class Image { +public: + uint16 Width; + uint16 Height; + byte *ImageData; + + Image() : Width(0), Height(0), ImageData(0) {} + Image(int w, int h, byte *d) : Width(w), Height(h), ImageData(d) {} + Image(byte **buffer); + + void drawImage(uint16 x, uint16 y); + void drawMaskImage(uint16 x, uint16 y); + void readScreenImage(uint16 x, uint16 y); +}; + + +} // End of namespace Lab + +#endif // LAB_H diff --git a/engines/lab/interface.cpp b/engines/lab/interface.cpp index f786bb8703..fc7ba1e633 100644 --- a/engines/lab/interface.cpp +++ b/engines/lab/interface.cpp @@ -30,6 +30,7 @@ #include "lab/lab.h" #include "lab/labfun.h" +#include "lab/image.h" #include "lab/interface.h" #include "lab/mouse.h" #include "common/util.h" @@ -81,7 +82,7 @@ void freeButtonList(Gadget *gptrlist) { /*****************************************************************************/ void drawGadgetList(Gadget *gadlist) { while (gadlist) { - g_lab->drawImage(gadlist->Im, gadlist->x, gadlist->y); + gadlist->Im->drawImage(gadlist->x, gadlist->y); if (GADGETOFF & gadlist->GadgetFlags) ghoastGadget(gadlist, 1); @@ -105,7 +106,7 @@ void ghoastGadget(Gadget *curgad, uint16 pencolor) { /* Unghoasts a gadget, and makes it available again. */ /*****************************************************************************/ void unGhoastGadget(Gadget *curgad) { - g_lab->drawImage(curgad->Im, curgad->x, curgad->y); + curgad->Im->drawImage(curgad->x, curgad->y); curgad->GadgetFlags &= !(GADGETOFF); } @@ -132,11 +133,11 @@ Gadget *LabEngine::checkNumGadgetHit(Gadget *gadlist, uint16 key) { (gadlist->KeyEquiv != 0 && makeGadgetKeyEquiv(key) == gadlist->KeyEquiv)) && !(GADGETOFF & gadlist->GadgetFlags)) { _event->mouseHide(); - g_lab->drawImage(gadlist->ImAlt, gadlist->x, gadlist->y); + gadlist->ImAlt->drawImage(gadlist->x, gadlist->y); _event->mouseShow(); g_system->delayMillis(80); _event->mouseHide(); - g_lab->drawImage(gadlist->Im, gadlist->x, gadlist->y); + gadlist->Im->drawImage(gadlist->x, gadlist->y); _event->mouseShow(); return gadlist; diff --git a/engines/lab/lab.h b/engines/lab/lab.h index 9327dbf562..b7cf6e1771 100644 --- a/engines/lab/lab.h +++ b/engines/lab/lab.h @@ -51,12 +51,6 @@ enum GameFeatures { GF_WINDOWS_TRIAL = 1 << 1 }; -struct Image { - uint16 Width; - uint16 Height; - byte *ImageData; -}; - #define ONESECOND 1000 class LabEngine : public Engine { @@ -143,7 +137,6 @@ public: void setAPen(byte pennum); void writeColorRegs(byte *buf, uint16 first, uint16 numreg); byte *getCurrentDrawingBuffer(); - void readScreenImage(Image *Im, uint16 x, uint16 y); void screenUpdate(); void rectFill(uint16 x1, uint16 y1, uint16 x2, uint16 y2); void scrollDisplayX(int16 dx, uint16 x1, uint16 y1, uint16 x2, uint16 y2); @@ -153,7 +146,6 @@ public: void setPalette(void *cmap, uint16 numcolors); void drawHLine(uint16 x, uint16 y1, uint16 y2); void drawVLine(uint16 x1, uint16 y, uint16 x2); - void drawImage(Image *Im, uint16 x, uint16 y); bool haveNextChar(); uint16 getNextChar(); void processInput(bool can_delay = false); @@ -193,7 +185,6 @@ private: /*---------- Drawing Routines ----------*/ - void drawMaskImage(Image *Im, uint16 x, uint16 y); Common::Point getMousePos(); void changeVolume(int delta); void applyPalette(byte *buf, uint16 first, uint16 numreg, uint16 slow); diff --git a/engines/lab/labfun.h b/engines/lab/labfun.h index c1a6b35a09..52f6034477 100644 --- a/engines/lab/labfun.h +++ b/engines/lab/labfun.h @@ -54,7 +54,7 @@ class LabEngine; #define EAST 2 #define WEST 3 -struct Image; +class Image; struct TextFont; struct Gadget; @@ -188,7 +188,6 @@ char *translateFileName(const char *filename); void fade(bool fadein, uint16 res); void setAmigaPal(uint16 *pal, uint16 numcolors); -void readImage(byte **buffer, Image **im); void doMap(uint16 CurRoom); void doJournal(); void doNotes(); diff --git a/engines/lab/map.cpp b/engines/lab/map.cpp index 1f4f0dbfe1..d7a3e124ca 100644 --- a/engines/lab/map.cpp +++ b/engines/lab/map.cpp @@ -31,6 +31,7 @@ #include "lab/lab.h" #include "lab/labfun.h" #include "lab/anim.h" +#include "lab/image.h" #include "lab/text.h" #include "lab/mouse.h" #include "lab/parsefun.h" @@ -65,30 +66,6 @@ void setAmigaPal(uint16 *pal, uint16 numcolors) { g_lab->writeColorRegsSmooth(vgapal, 0, 16); } - -/*****************************************************************************/ -/* Reads in an image from disk. */ -/*****************************************************************************/ -void readImage(byte **buffer, Image **im) { - uint32 size; - - (*im) = (Image *)(*buffer); - - (*im)->Width = READ_LE_UINT16(*buffer); - (*im)->Height = READ_LE_UINT16(*buffer + 2); - - *buffer += 8; /* sizeof(struct Image); */ - - size = (*im)->Width * (*im)->Height; - - if (1L & size) - size++; - - (*im)->ImageData = (byte *)(*buffer); - (*buffer) += size; -} - - /*---------------------------------------------------------------------------*/ /*------------------------------ The Map stuff ------------------------------*/ /*---------------------------------------------------------------------------*/ @@ -169,30 +146,30 @@ static bool loadMapData() { stealBufMem(Size); /* Now freeze that buffer from further use */ - readImage(buffer, &Map); + Map = new Image(buffer); - readImage(buffer, &Room); - readImage(buffer, &UpArrowRoom); - readImage(buffer, &DownArrowRoom); - readImage(buffer, &HRoom); - readImage(buffer, &VRoom); - readImage(buffer, &Maze); - readImage(buffer, &HugeMaze); + Room = new Image(buffer); + UpArrowRoom = new Image(buffer); + DownArrowRoom = new Image(buffer); + HRoom = new Image(buffer); + VRoom = new Image(buffer); + Maze = new Image(buffer); + HugeMaze = new Image(buffer); - readImage(buffer, &MapNorth); - readImage(buffer, &MapEast); - readImage(buffer, &MapSouth); - readImage(buffer, &MapWest); + MapNorth = new Image(buffer); + MapEast = new Image(buffer); + MapSouth = new Image(buffer); + MapWest = new Image(buffer); - readImage(buffer, &Path); - readImage(buffer, &Bridge); + Path = new Image(buffer); + Bridge = new Image(buffer); - readImage(buffer, &Back); - readImage(buffer, &BackAlt); - readImage(buffer, &Up); - readImage(buffer, &UpAlt); - readImage(buffer, &Down); - readImage(buffer, &DownAlt); + Back = new Image(buffer); + BackAlt = new Image(buffer); + Up = new Image(buffer); + UpAlt = new Image(buffer); + Down = new Image(buffer); + DownAlt = new Image(buffer); backgadget.Im = Back; backgadget.ImAlt = BackAlt; @@ -325,27 +302,27 @@ static void drawRoom(uint16 CurRoom, bool drawx) { case UPARROWROOM: case DOWNARROWROOM: if (Maps[CurRoom].SpecialID == NORMAL) - g_lab->drawImage(Room, x, y); + Room->drawImage(x, y); else if (Maps[CurRoom].SpecialID == DOWNARROWROOM) - g_lab->drawImage(DownArrowRoom, x, y); + DownArrowRoom->drawImage(x, y); else - g_lab->drawImage(UpArrowRoom, x, y); + UpArrowRoom->drawImage(x, y); offset = (Room->Width - Path->Width) / 2; if ((NORTHDOOR & flags) && (y >= Path->Height)) - g_lab->drawImage(Path, x + offset, y - Path->Height); + Path->drawImage(x + offset, y - Path->Height); if (SOUTHDOOR & flags) - g_lab->drawImage(Path, x + offset, y + Room->Height); + Path->drawImage(x + offset, y + Room->Height); offset = (Room->Height - Path->Height) / 2; if (EASTDOOR & flags) - g_lab->drawImage(Path, x + Room->Width, y + offset); + Path->drawImage(x + Room->Width, y + offset); if (WESTDOOR & flags) - g_lab->drawImage(Path, x - Path->Width, y + offset); + Path->drawImage(x - Path->Width, y + offset); xx = x + (Room->Width - XMark->Width) / 2; xy = y + (Room->Height - XMark->Height) / 2; @@ -353,7 +330,7 @@ static void drawRoom(uint16 CurRoom, bool drawx) { break; case BRIDGEROOM: - g_lab->drawImage(Bridge, x, y); + Bridge->drawImage(x, y); xx = x + (Bridge->Width - XMark->Width) / 2; xy = y + (Bridge->Height - XMark->Height) / 2; @@ -361,37 +338,37 @@ static void drawRoom(uint16 CurRoom, bool drawx) { break; case VCORRIDOR: - g_lab->drawImage(VRoom, x, y); + VRoom->drawImage(x, y); offset = (VRoom->Width - Path->Width) / 2; if (NORTHDOOR & flags) - g_lab->drawImage(Path, x + offset, y - Path->Height); + Path->drawImage(x + offset, y - Path->Height); if (SOUTHDOOR & flags) - g_lab->drawImage(Path, x + offset, y + VRoom->Height); + Path->drawImage(x + offset, y + VRoom->Height); offset = (Room->Height - Path->Height) / 2; if (EASTDOOR & flags) - g_lab->drawImage(Path, x + VRoom->Width, y + offset); + Path->drawImage(x + VRoom->Width, y + offset); if (WESTDOOR & flags) - g_lab->drawImage(Path, x - Path->Width, y + offset); + Path->drawImage(x - Path->Width, y + offset); if (EASTBDOOR & flags) - g_lab->drawImage(Path, x + VRoom->Width, y - offset - Path->Height + VRoom->Height); + Path->drawImage(x + VRoom->Width, y - offset - Path->Height + VRoom->Height); if (WESTBDOOR & flags) - g_lab->drawImage(Path, x - Path->Width, y - offset - Path->Height + VRoom->Height); + Path->drawImage(x - Path->Width, y - offset - Path->Height + VRoom->Height); offset = (VRoom->Height - Path->Height) / 2; if (EASTMDOOR & flags) - g_lab->drawImage(Path, x + VRoom->Width, y - offset - Path->Height + VRoom->Height); + Path->drawImage(x + VRoom->Width, y - offset - Path->Height + VRoom->Height); if (WESTMDOOR & flags) - g_lab->drawImage(Path, x - Path->Width, y - offset - Path->Height + VRoom->Height); + Path->drawImage(x - Path->Width, y - offset - Path->Height + VRoom->Height); xx = x + (VRoom->Width - XMark->Width) / 2; xy = y + (VRoom->Height - XMark->Height) / 2; @@ -399,37 +376,37 @@ static void drawRoom(uint16 CurRoom, bool drawx) { break; case HCORRIDOR: - g_lab->drawImage(HRoom, x, y); + HRoom->drawImage(x, y); offset = (Room->Width - Path->Width) / 2; if (NORTHDOOR & flags) - g_lab->drawImage(Path, x + offset, y - Path->Height); + Path->drawImage(x + offset, y - Path->Height); if (SOUTHDOOR & flags) - g_lab->drawImage(Path, x + offset, y + Room->Height); + Path->drawImage(x + offset, y + Room->Height); if (NORTHRDOOR & flags) - g_lab->drawImage(Path, x - offset - Path->Width + HRoom->Width, y - Path->Height); + Path->drawImage(x - offset - Path->Width + HRoom->Width, y - Path->Height); if (SOUTHRDOOR & flags) - g_lab->drawImage(Path, x - offset - Path->Width + HRoom->Width, y + Room->Height); + Path->drawImage(x - offset - Path->Width + HRoom->Width, y + Room->Height); offset = (HRoom->Width - Path->Width) / 2; if (NORTHMDOOR & flags) - g_lab->drawImage(Path, x - offset - Path->Width + HRoom->Width, y - Path->Height); + Path->drawImage(x - offset - Path->Width + HRoom->Width, y - Path->Height); if (SOUTHMDOOR & flags) - g_lab->drawImage(Path, x - offset - Path->Width + HRoom->Width, y + Room->Height); + Path->drawImage(x - offset - Path->Width + HRoom->Width, y + Room->Height); offset = (Room->Height - Path->Height) / 2; if (EASTDOOR & flags) - g_lab->drawImage(Path, x + HRoom->Width, y + offset); + Path->drawImage(x + HRoom->Width, y + offset); if (WESTDOOR & flags) - g_lab->drawImage(Path, x - Path->Width, y + offset); + Path->drawImage(x - Path->Width, y + offset); xx = x + (HRoom->Width - XMark->Width) / 2; xy = y + (HRoom->Height - XMark->Height) / 2; @@ -441,7 +418,7 @@ static void drawRoom(uint16 CurRoom, bool drawx) { } if (drawx) - g_lab->drawImage(XMark, xx, xy); + XMark->drawImage(xx, xy); } /*****************************************************************************/ @@ -528,7 +505,7 @@ void LabEngine::drawMap(uint16 CurRoom, uint16 CurMsg, uint16 Floor, bool fadeou setAPen(0); rectFill(0, 0, _screenWidth - 1, _screenHeight - 1); - drawImage(Map, 0, 0); + Map->drawImage(0, 0); drawGadgetList(MapGadgetList); for (uint16 i = 1; i <= MaxRooms; i++) { @@ -562,16 +539,16 @@ void LabEngine::drawMap(uint16 CurRoom, uint16 CurMsg, uint16 Floor, bool fadeou // Labyrinth specific code if (Floor == LOWERFLOOR) { if (onFloor(SURMAZEFLOOR)) - drawImage(Maze, mapScaleX(538), mapScaleY(277)); + Maze->drawImage(mapScaleX(538), mapScaleY(277)); } else if (Floor == MIDDLEFLOOR) { if (onFloor(CARNIVAL)) - drawImage(Maze, mapScaleX(358), mapScaleY(72)); + Maze->drawImage(mapScaleX(358), mapScaleY(72)); if (onFloor(MEDMAZEFLOOR)) - drawImage(Maze, mapScaleX(557), mapScaleY(325)); + Maze->drawImage(mapScaleX(557), mapScaleY(325)); } else if (Floor == UPPERFLOOR) { if (onFloor(HEDGEMAZEFLOOR)) - drawImage(HugeMaze, mapScaleX(524), mapScaleY(97)); + HugeMaze->drawImage(mapScaleX(524), mapScaleY(97)); } else if (Floor == SURMAZEFLOOR) { sptr = (char *)_resource->getStaticText(kTextSurmazeMessage).c_str(); flowText(MsgFont, 0, 7, 0, true, true, true, true, mapScaleX(360), 0, mapScaleX(660), mapScaleY(450), sptr); diff --git a/engines/lab/module.mk b/engines/lab/module.mk index 4f1ace8c9c..b21a3ea23b 100644 --- a/engines/lab/module.mk +++ b/engines/lab/module.mk @@ -6,6 +6,7 @@ MODULE_OBJS := \ detection.o \ engine.o \ graphics.o \ + image.o \ interface.o \ intro.o \ lab.o \ @@ -32,4 +33,3 @@ endif # Include common rules include $(srcdir)/rules.mk - diff --git a/engines/lab/mouse.cpp b/engines/lab/mouse.cpp index 9ff5117ff6..4bd6c7f8d8 100644 --- a/engines/lab/mouse.cpp +++ b/engines/lab/mouse.cpp @@ -29,6 +29,7 @@ */ #include "lab/lab.h" +#include "lab/image.h" #include "lab/mouse.h" #include "lab/interface.h" @@ -76,14 +77,14 @@ Gadget *EventManager::checkGadgetHit(Gadget *gadlist, Common::Point pos) { hitgad = gadlist; } else { mouseHide(); - _vm->drawImage(gadlist->ImAlt, gadlist->x, gadlist->y); + gadlist->ImAlt->drawImage(gadlist->x, gadlist->y); mouseShow(); for (uint16 i = 0; i < 3; i++) _vm->waitTOF(); mouseHide(); - _vm->drawImage(gadlist->Im, gadlist->x, gadlist->y); + gadlist->Im->drawImage(gadlist->x, gadlist->y); mouseShow(); } @@ -135,14 +136,14 @@ void EventManager::updateMouse() { if (hitgad) { mouseHide(); - _vm->drawImage(hitgad->ImAlt, hitgad->x, hitgad->y); + hitgad->ImAlt->drawImage(hitgad->x, hitgad->y); mouseShow(); for (uint16 i = 0; i < 3; i++) _vm->waitTOF(); mouseHide(); - _vm->drawImage(hitgad->Im, hitgad->x, hitgad->y); + hitgad->Im->drawImage(hitgad->x, hitgad->y); mouseShow(); doUpdateDisplay = true; hitgad = NULL; diff --git a/engines/lab/special.cpp b/engines/lab/special.cpp index afe3efb64f..6f70cb0f1a 100644 --- a/engines/lab/special.cpp +++ b/engines/lab/special.cpp @@ -35,6 +35,7 @@ #include "lab/lab.h" #include "lab/labfun.h" +#include "lab/image.h" #include "lab/parsefun.h" #include "lab/interface.h" #include "lab/anim.h" @@ -132,7 +133,7 @@ static byte *loadBackPict(const char *fileName, bool tomem) { /*****************************************************************************/ static void doCombination() { for (uint16 i = 0; i <= 5; i++) - g_lab->drawImage(Images[combination[i]], VGAScaleX(combx[i]), VGAScaleY(65)); + Images[combination[i]]->drawImage(VGAScaleX(combx[i]), VGAScaleY(65)); } /*****************************************************************************/ @@ -152,7 +153,7 @@ void showCombination(const char *filename) { buffer = g_lab->_music->newOpen("P:Numbers"); for (uint16 CurBit = 0; CurBit < 10; CurBit++) - readImage(buffer, &(Images[CurBit])); + Images[CurBit] = new Image(buffer); allocFile((void **)&g_lab->_tempScrollData, Images[0]->Width * Images[0]->Height * 2L, "tempdata"); @@ -267,7 +268,7 @@ static void doTile(bool showsolution) { num = CurTile[col] [row]; if (showsolution || num) - g_lab->drawImage(Tiles[num], cols + (col * colm), rows + (row * rowm)); + Tiles[num]->drawImage(cols + (col * colm), rows + (row * rowm)); col++; } @@ -303,7 +304,7 @@ void showTile(const char *filename, bool showsolution) { return; for (uint16 curBit = start; curBit < 16; curBit++) - readImage(buffer, &(Tiles[curBit])); + Tiles[curBit] = new Image(buffer); allocFile((void **)&g_lab->_tempScrollData, Tiles[1]->Width * Tiles[1]->Height * 2L, "tempdata"); @@ -550,12 +551,12 @@ static bool loadJournalData() { if (!buffer) return false; - readImage(buffer, &(BackG.Im)); - readImage(buffer, &(BackG.ImAlt)); - readImage(buffer, &(ForwardG.Im)); - readImage(buffer, &(ForwardG.ImAlt)); - readImage(buffer, &(CancelG.Im)); - readImage(buffer, &(CancelG.ImAlt)); + BackG.Im = new Image(buffer); + BackG.ImAlt = new Image(buffer); + ForwardG.Im = new Image(buffer); + ForwardG.ImAlt = new Image(buffer); + CancelG.Im = new Image(buffer); + CancelG.ImAlt = new Image(buffer); BackG.KeyEquiv = VKEY_LTARROW; ForwardG.KeyEquiv = VKEY_RTARROW; @@ -819,7 +820,7 @@ static void getMonImages() { if (!buffer) return; - readImage(buffer, &MonButton); + MonButton = new Image(buffer); stealBufMem(bufferSize); /* Trick: protects the memory where the buttons are so they won't be over-written */ } @@ -855,7 +856,7 @@ void LabEngine::drawMonText(char *text, TextFont *monitorFont, uint16 x1, uint16 rectFill(0, 0, _screenWidth - 1, y2); for (uint16 i = 0; i < numlines; i++) - drawImage(MonButton, 0, i * MonGadHeight); + MonButton->drawImage(0, i * MonGadHeight); } else if (isinteractive) { setAPen(0); rectFill(0, 0, _screenWidth - 1, y2); diff --git a/engines/lab/vga.cpp b/engines/lab/vga.cpp index 326b1f4117..4c8169eb6d 100644 --- a/engines/lab/vga.cpp +++ b/engines/lab/vga.cpp @@ -32,6 +32,7 @@ #include "common/events.h" #include "lab/lab.h" +#include "lab/image.h" #include "lab/mouse.h" namespace Lab { @@ -249,133 +250,6 @@ byte *LabEngine::getCurrentDrawingBuffer() { return _displayBuffer; } -/*****************************************************************************/ -/* Draws an image to the screen. */ -/*****************************************************************************/ -void LabEngine::drawImage(Image *im, uint16 x, uint16 y) { - int sx = 0, sy = 0; - int dx = x, dy = y; - int w = im->Width; - int h = im->Height; - - if (dx < 0) { - sx -= dx; - w += dx; - dx = 0; - } - - if (dy < 0) { - sy -= dy; - w += dy; - dy = 0; - } - - if (dx + w > _screenWidth) - w = _screenWidth - dx; - - if (dy + h > _screenHeight) - h = _screenHeight - dy; - - if ((w > 0) && (h > 0)) { - byte *s = im->ImageData + sy * im->Width + sx; - byte *d = getCurrentDrawingBuffer() + dy * _screenWidth + dx; - - while (h-- > 0) { - memcpy(d, s, w); - s += im->Width; - d += _screenWidth; - } - } -} - -/*****************************************************************************/ -/* Draws an image to the screen. */ -/*****************************************************************************/ -void LabEngine::drawMaskImage(Image *im, uint16 x, uint16 y) { - int sx = 0, sy = 0; - int dx = x, dy = y; - int w = im->Width; - int h = im->Height; - - if (dx < 0) { - sx -= dx; - w += dx; - dx = 0; - } - - if (dy < 0) { - sy -= dy; - w += dy; - dy = 0; - } - - if (dx + w > _screenWidth) - w = _screenWidth - dx; - - if (dy + h > _screenHeight) - h = _screenHeight - dy; - - if ((w > 0) && (h > 0)) { - byte *s = im->ImageData + sy * im->Width + sx; - byte *d = getCurrentDrawingBuffer() + dy * _screenWidth + dx; - - while (h-- > 0) { - byte *ss = s; - byte *dd = d; - int ww = w; - - while (ww-- > 0) { - byte c = *ss++; - - if (c) *dd++ = c - 1; - else dd++; - } - - s += im->Width; - d += _screenWidth; - } - } -} - -/*****************************************************************************/ -/* Reads an image from the screen. */ -/*****************************************************************************/ -void LabEngine::readScreenImage(Image *im, uint16 x, uint16 y) { - int sx = 0, sy = 0; - int dx = x, dy = y; - int w = im->Width; - int h = im->Height; - - if (dx < 0) { - sx -= dx; - w += dx; - dx = 0; - } - - if (dy < 0) { - sy -= dy; - w += dy; - dy = 0; - } - - if (dx + w > _screenWidth) - w = _screenWidth - dx; - - if (dy + h > _screenHeight) - h = _screenHeight - dy; - - if ((w > 0) && (h > 0)) { - byte *s = im->ImageData + sy * im->Width + sx; - byte *d = getCurrentDrawingBuffer() + dy * _screenWidth + dx; - - while (h-- > 0) { - memcpy(s, d, w); - s += im->Width; - d += _screenWidth; - } - } -} - /*****************************************************************************/ /* Blits a piece of one image to another. */ /* NOTE: for our purposes, assumes that ImDest is to be in VGA memory. */ @@ -448,8 +322,8 @@ void LabEngine::scrollDisplayX(int16 dx, uint16 x1, uint16 y1, uint16 x2, uint16 im.Width = x2 - x1 + 1 - dx; im.Height = y2 - y1 + 1; - readScreenImage(&im, x1, y1); - drawImage(&im, x1 + dx, y1); + im.readScreenImage(x1, y1); + im.drawImage(x1 + dx, y1); setAPen(0); rectFill(x1, y1, x1 + dx - 1, y2); @@ -457,8 +331,8 @@ void LabEngine::scrollDisplayX(int16 dx, uint16 x1, uint16 y1, uint16 x2, uint16 im.Width = x2 - x1 + 1 + dx; im.Height = y2 - y1 + 1; - readScreenImage(&im, x1 - dx, y1); - drawImage(&im, x1, y1); + im.readScreenImage(x1 - dx, y1); + im.drawImage(x1, y1); setAPen(0); rectFill(x2 + dx + 1, y1, x2, y2); @@ -490,8 +364,8 @@ void LabEngine::scrollDisplayY(int16 dy, uint16 x1, uint16 y1, uint16 x2, uint16 im.Width = x2 - x1 + 1; im.Height = y2 - y1 + 1 - dy; - readScreenImage(&im, x1, y1); - drawImage(&im, x1, y1 + dy); + im.readScreenImage(x1, y1); + im.drawImage(x1, y1 + dy); setAPen(0); rectFill(x1, y1, x2, y1 + dy - 1); @@ -499,8 +373,8 @@ void LabEngine::scrollDisplayY(int16 dy, uint16 x1, uint16 y1, uint16 x2, uint16 im.Width = x2 - x1 + 1; im.Height = y2 - y1 + 1 + dy; - readScreenImage(&im, x1, y1 - dy); - drawImage(&im, x1, y1); + im.readScreenImage(x1, y1 - dy); + im.drawImage(x1, y1); setAPen(0); rectFill(x1, y2 + dy + 1, x2, y2); -- cgit v1.2.3 From 7651ac738807425996e9542446eb91f4e90063a6 Mon Sep 17 00:00:00 2001 From: Strangerke Date: Wed, 2 Dec 2015 00:17:38 +0100 Subject: LAB: Get rid of readdiff.cpp --- engines/lab/anim.cpp | 57 ++++++++++++++++++++++++++++---- engines/lab/anim.h | 7 ++++ engines/lab/readdiff.cpp | 86 ------------------------------------------------ 3 files changed, 57 insertions(+), 93 deletions(-) delete mode 100644 engines/lab/readdiff.cpp diff --git a/engines/lab/anim.cpp b/engines/lab/anim.cpp index 44d9eea5e8..689f9038e3 100644 --- a/engines/lab/anim.cpp +++ b/engines/lab/anim.cpp @@ -33,7 +33,6 @@ namespace Lab { -extern uint16 _dataBytesPerRow; extern BitMap *DrawBitMap; extern byte **startoffile; extern BitMap *DispBitMap; @@ -75,7 +74,7 @@ Anim::Anim(LabEngine *vm) : _vm(vm) { diffwidth = 0; diffheight = 0; stopsound = false; - + _dataBytesPerRow = 0; for (int i = 0; i < 3 * 256; i++) diffcmap[i] = 0; @@ -88,7 +87,7 @@ Anim::Anim(LabEngine *vm) : _vm(vm) { /* Undiffs a piece of memory when header size is a byte, and copy/skip size */ /* is also a byte. */ /*****************************************************************************/ -static void unDIFFByteByte(byte *dest, byte *diff) { +void Anim::unDIFFByteByte(byte *dest, byte *diff) { uint16 skip, copy; while (1) { @@ -118,7 +117,7 @@ static void unDIFFByteByte(byte *dest, byte *diff) { /* Undiffs a piece of memory when header size is a byte, and copy/skip size */ /* is a word. */ /*****************************************************************************/ -static void unDIFFByteWord(uint16 *dest, uint16 *diff) { +void Anim::unDIFFByteWord(uint16 *dest, uint16 *diff) { uint16 skip, copy; while (1) { @@ -193,7 +192,7 @@ bool Anim::unDIFFMemory(byte *dest, byte *diff, uint16 headerSize, uint16 copySi /* Undiffs a piece of memory when header size is a byte, and copy/skip size */ /* is a byte. */ /*****************************************************************************/ -static void VUnDIFFByteByte(byte *Dest, byte *diff, uint16 bytesperrow) { +void Anim::VUnDIFFByteByte(byte *Dest, byte *diff, uint16 bytesperrow) { byte *CurPtr; uint16 skip, copy; uint16 counter = 0; @@ -231,7 +230,7 @@ static void VUnDIFFByteByte(byte *Dest, byte *diff, uint16 bytesperrow) { /* Undiffs a piece of memory when header size is a byte, and copy/skip size */ /* is a word. */ /*****************************************************************************/ -static void VUnDIFFByteWord(uint16 *Dest, uint16 *diff, uint16 bytesperrow) { +void Anim::VUnDIFFByteWord(uint16 *Dest, uint16 *diff, uint16 bytesperrow) { uint16 *CurPtr; uint16 skip, copy; uint16 counter = 0, wordsperrow; @@ -272,7 +271,7 @@ static void VUnDIFFByteWord(uint16 *Dest, uint16 *diff, uint16 bytesperrow) { /* Undiffs a piece of memory when header size is a byte, and copy/skip size */ /* is a long. */ /*****************************************************************************/ -static void VUnDIFFByteLong(uint32 *Dest, uint32 *diff, uint16 bytesperrow) { +void Anim::VUnDIFFByteLong(uint32 *Dest, uint32 *diff, uint16 bytesperrow) { uint32 *CurPtr; uint16 skip, copy; uint16 counter = 0, longsperrow; @@ -725,4 +724,48 @@ bool Anim::readDiff(bool playonce) { return true; } +void Anim::readSound(bool waitTillFinished, Common::File *file) { + uint32 magicBytes = file->readUint32LE(); + if (magicBytes != 1219009121L) + return; + + uint32 soundTag = file->readUint32LE(); + uint32 soundSize = file->readUint32LE(); + + if (soundTag == 0) + file->skip(soundSize); // skip the header + else + return; + + while (soundTag != 65535) { + g_lab->_music->updateMusic(); + soundTag = file->readUint32LE(); + soundSize = file->readUint32LE() - 8; + + if ((soundTag == 30) || (soundTag == 31)) { + if (waitTillFinished) { + while (g_lab->_music->isSoundEffectActive()) { + g_lab->_music->updateMusic(); + g_lab->waitTOF(); + } + } + + file->skip(4); + + uint16 sampleRate = file->readUint16LE(); + file->skip(2); + byte *soundData = (byte *)malloc(soundSize); + file->read(soundData, soundSize); + g_lab->_music->playSoundEffect(sampleRate, soundSize, soundData); + } else if (soundTag == 65535L) { + if (waitTillFinished) { + while (g_lab->_music->isSoundEffectActive()) { + g_lab->_music->updateMusic(); + g_lab->waitTOF(); + } + } + } else + file->skip(soundSize); + } +} } // End of namespace Lab diff --git a/engines/lab/anim.h b/engines/lab/anim.h index 0472a72d7f..62c7e39a83 100644 --- a/engines/lab/anim.h +++ b/engines/lab/anim.h @@ -86,6 +86,13 @@ private: uint32 diffwidth; uint32 diffheight; bool stopsound; + uint16 _dataBytesPerRow; + + void unDIFFByteByte(byte *dest, byte *diff); + void unDIFFByteWord(uint16 *dest, uint16 *diff); + void VUnDIFFByteByte(byte *Dest, byte *diff, uint16 bytesperrow); + void VUnDIFFByteWord(uint16 *Dest, uint16 *diff, uint16 bytesperrow); + void VUnDIFFByteLong(uint32 *Dest, uint32 *diff, uint16 bytesperrow); public: Anim(LabEngine *vm); diff --git a/engines/lab/readdiff.cpp b/engines/lab/readdiff.cpp deleted file mode 100644 index 43309ffd78..0000000000 --- a/engines/lab/readdiff.cpp +++ /dev/null @@ -1,86 +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. - * - */ - -/* - * This code is based on Labyrinth of Time code with assistance of - * - * Copyright (c) 1993 Terra Nova Development - * Copyright (c) 2004 The Wyrmkeep Entertainment Co. - * - */ - -#include "lab/lab.h" -#include "lab/anim.h" -#include "lab/labfun.h" -#include "lab/mouse.h" - -namespace Lab { -static byte temp[5]; - -uint16 _dataBytesPerRow; - -void Anim::readSound(bool waitTillFinished, Common::File *file) { - uint32 magicBytes = file->readUint32LE(); - if (magicBytes != 1219009121L) - return; - - uint32 soundTag = file->readUint32LE(); - uint32 soundSize = file->readUint32LE(); - - if (soundTag == 0) - file->skip(soundSize); // skip the header - else - return; - - while (soundTag != 65535) { - g_lab->_music->updateMusic(); - soundTag = file->readUint32LE(); - soundSize = file->readUint32LE() - 8; - - if ((soundTag == 30) || (soundTag == 31)) { - if (waitTillFinished) { - while (g_lab->_music->isSoundEffectActive()) { - g_lab->_music->updateMusic(); - g_lab->waitTOF(); - } - } - - file->skip(4); - - uint16 sampleRate = file->readUint16LE(); - file->skip(2); - byte *soundData = (byte *)malloc(soundSize); - file->read(soundData, soundSize); - g_lab->_music->playSoundEffect(sampleRate, soundSize, soundData); - } else if (soundTag == 65535L) { - if (waitTillFinished) { - while (g_lab->_music->isSoundEffectActive()) { - g_lab->_music->updateMusic(); - g_lab->waitTOF(); - } - } - } else - file->skip(soundSize); - } -} - -} // End of namespace Lab -- cgit v1.2.3 From 2fb0250e0c26ff7ee24a9b05b22c6d8b177131af Mon Sep 17 00:00:00 2001 From: Strangerke Date: Wed, 2 Dec 2015 00:34:51 +0100 Subject: LAB: Renaming of Anim --- engines/lab/anim.cpp | 477 ++++++++++++++++++++++---------------------- engines/lab/anim.h | 70 +++---- engines/lab/engine.cpp | 46 ++--- engines/lab/graphics.cpp | 20 +- engines/lab/intro.cpp | 30 +-- engines/lab/processroom.cpp | 16 +- engines/lab/special.cpp | 36 ++-- 7 files changed, 343 insertions(+), 352 deletions(-) diff --git a/engines/lab/anim.cpp b/engines/lab/anim.cpp index 689f9038e3..908c4e4b19 100644 --- a/engines/lab/anim.cpp +++ b/engines/lab/anim.cpp @@ -38,46 +38,46 @@ extern byte **startoffile; extern BitMap *DispBitMap; Anim::Anim(LabEngine *vm) : _vm(vm) { - header = 0; - CurBit = 0; - numchunks = 1; - IsBM = false; - headerdata._width = 0; - headerdata._height = 0; - headerdata._fps = 0; - headerdata._flags = 0; - WaitSec = 0; - WaitMicros = 0; - DelayMicros = 0; - continuous = false; - IsPlaying = false; - IsAnim = false; - IsPal = false; - nopalchange = false; - donepal = false; - framenumber = 0; - PlayOnce = false; - Buffer = nullptr; - storagefordifffile = nullptr; - difffile = &storagefordifffile; - size = 0; - RawDiffBM._bytesPerRow = 0; - RawDiffBM._flags = 0; + _header = 0; + _curBit = 0; + _numChunks = 1; + _isBM = false; + _headerdata._width = 0; + _headerdata._height = 0; + _headerdata._fps = 0; + _headerdata._flags = 0; + _waitSec = 0; + _waitMicros = 0; + _delayMicros = 0; + _continuous = false; + _isPlaying = false; + _isAnim = false; + _isPal = false; + _noPalChange = false; + _donePal = false; + _frameNum = 0; + _playOnce = false; + _buffer = nullptr; + _storeDiffFile = nullptr; + _diffFile = &_storeDiffFile; + _size = 0; + _rawDiffBM._bytesPerRow = 0; + _rawDiffBM._flags = 0; for (int i = 0; i < 16; i++) - RawDiffBM._planes[i] = nullptr; - RawDiffBM._rows = 0; - waitForEffect = false; - StopPlayingEnd = false; - samplespeed = 0; - DoBlack = false; - start = nullptr; - diffwidth = 0; - diffheight = 0; - stopsound = false; + _rawDiffBM._planes[i] = nullptr; + _rawDiffBM._rows = 0; + _waitForEffect = false; + _stopPlayingEnd = false; + _sampleSpeed = 0; + _doBlack = false; + _start = nullptr; + _diffWidth = 0; + _diffHeight = 0; + _stopSound = false; _dataBytesPerRow = 0; for (int i = 0; i < 3 * 256; i++) - diffcmap[i] = 0; + _diffPalette[i] = 0; } @@ -192,14 +192,14 @@ bool Anim::unDIFFMemory(byte *dest, byte *diff, uint16 headerSize, uint16 copySi /* Undiffs a piece of memory when header size is a byte, and copy/skip size */ /* is a byte. */ /*****************************************************************************/ -void Anim::VUnDIFFByteByte(byte *Dest, byte *diff, uint16 bytesperrow) { - byte *CurPtr; +void Anim::VUnDIFFByteByte(byte *dest, byte *diff, uint16 bytesPerRow) { + byte *curPtr; uint16 skip, copy; uint16 counter = 0; while (counter < _dataBytesPerRow) { - CurPtr = Dest + counter; + curPtr = dest + counter; for (;;) { skip = *diff; @@ -213,12 +213,12 @@ void Anim::VUnDIFFByteByte(byte *Dest, byte *diff, uint16 bytesperrow) { } else { - CurPtr += (skip * bytesperrow); + curPtr += (skip * bytesPerRow); while (copy) { copy--; - *CurPtr = *diff; - CurPtr += bytesperrow; + *curPtr = *diff; + curPtr += bytesPerRow; diff++; } } @@ -230,16 +230,15 @@ void Anim::VUnDIFFByteByte(byte *Dest, byte *diff, uint16 bytesperrow) { /* Undiffs a piece of memory when header size is a byte, and copy/skip size */ /* is a word. */ /*****************************************************************************/ -void Anim::VUnDIFFByteWord(uint16 *Dest, uint16 *diff, uint16 bytesperrow) { - uint16 *CurPtr; +void Anim::VUnDIFFByteWord(uint16 *dest, uint16 *diff, uint16 bytesPerRow) { + uint16 *curPtr; uint16 skip, copy; - uint16 counter = 0, wordsperrow; - + uint16 counter = 0; - wordsperrow = bytesperrow / 2; + uint16 wordsPerRow = bytesPerRow / 2; while (counter < (_dataBytesPerRow >> 1)) { - CurPtr = Dest + counter; + curPtr = dest + counter; for (;;) { skip = ((byte *)diff)[0]; @@ -254,11 +253,11 @@ void Anim::VUnDIFFByteWord(uint16 *Dest, uint16 *diff, uint16 bytesperrow) { } else { - CurPtr += (skip * wordsperrow); + curPtr += (skip * wordsPerRow); while (copy) { - *CurPtr = *diff; //swapUShort(*diff); - CurPtr += wordsperrow; + *curPtr = *diff; //swapUShort(*diff); + curPtr += wordsPerRow; diff++; copy--; } @@ -271,17 +270,17 @@ void Anim::VUnDIFFByteWord(uint16 *Dest, uint16 *diff, uint16 bytesperrow) { /* Undiffs a piece of memory when header size is a byte, and copy/skip size */ /* is a long. */ /*****************************************************************************/ -void Anim::VUnDIFFByteLong(uint32 *Dest, uint32 *diff, uint16 bytesperrow) { - uint32 *CurPtr; +void Anim::VUnDIFFByteLong(uint32 *dest, uint32 *diff, uint16 bytesPerRow) { + uint32 *_curPtr; uint16 skip, copy; - uint16 counter = 0, longsperrow; - byte *diff1 = (byte *)diff; + uint16 counter = 0; + byte *diff1 = (byte *)diff; - longsperrow = bytesperrow / 4; + uint16 longsperrow = bytesPerRow / 4; while (counter < (_dataBytesPerRow >> 2)) { - CurPtr = Dest + counter; + _curPtr = dest + counter; for (;;) { skip = *diff1; @@ -297,11 +296,11 @@ void Anim::VUnDIFFByteLong(uint32 *Dest, uint32 *diff, uint16 bytesperrow) { } else { - CurPtr += (skip * longsperrow); + _curPtr += (skip * longsperrow); while (copy) { - *CurPtr = *(uint32 *)diff1; //swapULong(*diff); - CurPtr += longsperrow; + *_curPtr = *(uint32 *)diff1; //swapULong(*diff); + _curPtr += longsperrow; diff1 += 4; copy--; } @@ -313,17 +312,14 @@ void Anim::VUnDIFFByteLong(uint32 *Dest, uint32 *diff, uint16 bytesperrow) { /*****************************************************************************/ /* UnDiffs a coded DIFF string onto an already initialized piece of memory. */ /*****************************************************************************/ -bool Anim::VUnDIFFMemory(byte *Dest, byte *diff, uint16 HeaderSize, uint16 CopySize, uint16 bytesperrow) { - if (HeaderSize == 1) { - if (CopySize == 1) - VUnDIFFByteByte(Dest, diff, bytesperrow); - - else if (CopySize == 2) - VUnDIFFByteWord((uint16 *)Dest, (uint16 *)diff, bytesperrow); - - else if (CopySize == 4) - VUnDIFFByteLong((uint32 *)Dest, (uint32 *)diff, bytesperrow); - +bool Anim::VUnDIFFMemory(byte *dest, byte *diff, uint16 headerSize, uint16 copySize, uint16 bytesPerRow) { + if (headerSize == 1) { + if (copySize == 1) + VUnDIFFByteByte(dest, diff, bytesPerRow); + else if (copySize == 2) + VUnDIFFByteWord((uint16 *)dest, (uint16 *)diff, bytesPerRow); + else if (copySize == 4) + VUnDIFFByteLong((uint32 *)dest, (uint32 *)diff, bytesPerRow); else return false; } else @@ -335,29 +331,28 @@ bool Anim::VUnDIFFMemory(byte *Dest, byte *diff, uint16 HeaderSize, uint16 CopyS /*****************************************************************************/ /* Runlength decodes a chunk of memory. */ /*****************************************************************************/ -void Anim::runLengthDecode(byte *Dest, byte *Source) { +void Anim::runLengthDecode(byte *dest, byte *source) { int8 num; int16 count; - while (1) { - num = (int8)*Source; - Source++; + num = (int8)*source; + source++; if (num == 127) { return; } else if (num > '\0') { - memcpy(Dest, Source, num); - Source += num; - Dest += num; + memcpy(dest, source, num); + source += num; + dest += num; } else { count = (int16)(-num); - num = *Source; - Source++; + num = *source; + source++; while (count) { - *Dest = num; - Dest++; + *dest = num; + dest++; count--; } } @@ -367,40 +362,40 @@ void Anim::runLengthDecode(byte *Dest, byte *Source) { /*****************************************************************************/ /* Does a vertical run length decode. */ /*****************************************************************************/ -void Anim::VRunLengthDecode(byte *Dest, byte *Source, uint16 bytesperrow) { +void Anim::VRunLengthDecode(byte *dest, byte *source, uint16 bytesPerRow) { int8 num; int16 count; - byte *Top = Dest; + byte *top = dest; for (uint16 i = 0; i < _dataBytesPerRow; i++) { - Dest = Top; - Dest += i; + dest = top; + dest += i; - num = (int8)*Source; - Source++; + num = (int8)*source; + source++; while (num != 127) { if (num > '\0') { while (num) { - *Dest = *Source; - Source++; - Dest += bytesperrow; + *dest = *source; + source++; + dest += bytesPerRow; num--; } } else { count = (int16)(-num); - num = (int8)*Source; - Source++; + num = (int8)*source; + source++; while (count) { - *Dest = num; - Dest += bytesperrow; + *dest = num; + dest += bytesPerRow; count--; } } - num = *Source; - Source++; + num = *source; + source++; } } } @@ -408,21 +403,19 @@ void Anim::VRunLengthDecode(byte *Dest, byte *Source, uint16 bytesperrow) { /*****************************************************************************/ /* Does the undiffing between the bitmaps. */ /*****************************************************************************/ -void Anim::unDiff(byte *NewBuf, byte *OldBuf, byte *DiffData, uint16 bytesperrow, bool IsV) { - byte buftype; +void Anim::unDiff(byte *newBuf, byte *oldBuf, byte *diffData, uint16 bytesPerRow, bool isV) { + diffData++; + byte bufType = *diffData; + diffData++; - DiffData++; - buftype = *DiffData; - DiffData++; - - if (IsV) - VUnDIFFMemory(NewBuf, DiffData, 1, buftype + 1, bytesperrow); + if (isV) + VUnDIFFMemory(newBuf, diffData, 1, bufType + 1, bytesPerRow); else - unDIFFMemory(NewBuf, DiffData, 1, buftype + 1); + unDIFFMemory(newBuf, diffData, 1, bufType + 1); } void Anim::diffNextFrame() { - if (header == 65535) /* Already done. */ + if (_header == 65535) /* Already done. */ return; if (DispBitMap->_flags & BITMAPF_VIDEO) { @@ -436,37 +429,37 @@ void Anim::diffNextFrame() { _vm->_event->mouseHide(); while (1) { - if (CurBit >= numchunks) { + if (_curBit >= _numChunks) { _vm->_event->mouseShow(); - if (!IsBM) { - if (headerdata._fps) { - _vm->waitForTime(WaitSec, WaitMicros); - _vm->addCurTime(0L, DelayMicros, &WaitSec, &WaitMicros); + if (!_isBM) { + if (_headerdata._fps) { + _vm->waitForTime(_waitSec, _waitMicros); + _vm->addCurTime(0L, _delayMicros, &_waitSec, &_waitMicros); } - if (IsPal && !nopalchange) { - _vm->setPalette(diffcmap, 256); - IsPal = false; + if (_isPal && !_noPalChange) { + _vm->setPalette(_diffPalette, 256); + _isPal = false; } - donepal = true; + _donePal = true; } - if (IsPal && !nopalchange && !IsBM && !donepal) { - _vm->setPalette(diffcmap, 256); - IsPal = false; + if (_isPal && !_noPalChange && !_isBM && !_donePal) { + _vm->setPalette(_diffPalette, 256); + _isPal = false; } - donepal = false; + _donePal = false; - framenumber++; + _frameNum++; - if ((framenumber == 1) && (continuous || (!PlayOnce))) - Buffer = *difffile; + if ((_frameNum == 1) && (_continuous || (!_playOnce))) + _buffer = *_diffFile; - IsAnim = (framenumber >= 3) && (!PlayOnce); - CurBit = 0; + _isAnim = (_frameNum >= 3) && (!_playOnce); + _curBit = 0; if (DispBitMap->_flags & BITMAPF_VIDEO) _vm->screenUpdate(); @@ -475,92 +468,92 @@ void Anim::diffNextFrame() { } _vm->_music->updateMusic(); - header = READ_LE_UINT32(*difffile); - *difffile += 4; + _header = READ_LE_UINT32(*_diffFile); + *_diffFile += 4; - size = READ_LE_UINT32(*difffile); - *difffile += 4; + _size = READ_LE_UINT32(*_diffFile); + *_diffFile += 4; - switch (header) { + switch (_header) { case 8L: - readBlock(diffcmap, size, difffile); - IsPal = true; + readBlock(_diffPalette, _size, _diffFile); + _isPal = true; break; case 10L: - RawDiffBM._planes[CurBit] = *difffile; + _rawDiffBM._planes[_curBit] = *_diffFile; - if (IsBM) - (*difffile) += size; + if (_isBM) + (*_diffFile) += _size; else { - readBlock(DrawBitMap->_planes[CurBit], size, difffile); + readBlock(DrawBitMap->_planes[_curBit], _size, _diffFile); } - CurBit++; + _curBit++; break; case 11L: - (*difffile) += 4; - runLengthDecode(DrawBitMap->_planes[CurBit], *difffile); - CurBit++; - (*difffile) += size - 4; + (*_diffFile) += 4; + runLengthDecode(DrawBitMap->_planes[_curBit], *_diffFile); + _curBit++; + (*_diffFile) += _size - 4; break; case 12L: - (*difffile) += 4; - VRunLengthDecode(DrawBitMap->_planes[CurBit], *difffile, DrawBitMap->_bytesPerRow); - CurBit++; - (*difffile) += size - 4; + (*_diffFile) += 4; + VRunLengthDecode(DrawBitMap->_planes[_curBit], *_diffFile, DrawBitMap->_bytesPerRow); + _curBit++; + (*_diffFile) += _size - 4; break; case 20L: - unDiff(DrawBitMap->_planes[CurBit], DispBitMap->_planes[CurBit], *difffile, DrawBitMap->_bytesPerRow, false); - CurBit++; - (*difffile) += size; + unDiff(DrawBitMap->_planes[_curBit], DispBitMap->_planes[_curBit], *_diffFile, DrawBitMap->_bytesPerRow, false); + _curBit++; + (*_diffFile) += _size; break; case 21L: - unDiff(DrawBitMap->_planes[CurBit], DispBitMap->_planes[CurBit], *difffile, DrawBitMap->_bytesPerRow, true); - CurBit++; - (*difffile) += size; + unDiff(DrawBitMap->_planes[_curBit], DispBitMap->_planes[_curBit], *_diffFile, DrawBitMap->_bytesPerRow, true); + _curBit++; + (*_diffFile) += _size; break; case 25L: - CurBit++; + _curBit++; break; case 26L: - CurBit++; + _curBit++; break; case 30L: case 31L: { - if (waitForEffect) { + if (_waitForEffect) { while (_vm->_music->isSoundEffectActive()) { _vm->_music->updateMusic(); _vm->waitTOF(); } } - size -= 8L; + _size -= 8L; - (*difffile) += 4; - samplespeed = READ_LE_UINT16(*difffile); - (*difffile) += 4; + (*_diffFile) += 4; + _sampleSpeed = READ_LE_UINT16(*_diffFile); + (*_diffFile) += 4; - byte *music = *difffile; - uint32 musicsize = size; - (*difffile) += size; + byte *music = *_diffFile; + uint32 musicsize = _size; + (*_diffFile) += _size; - _vm->_music->playSoundEffect(samplespeed, musicsize, music); + _vm->_music->playSoundEffect(_sampleSpeed, musicsize, music); break; } case 65535L: - if ((framenumber == 1) || PlayOnce || StopPlayingEnd) { + if ((_frameNum == 1) || _playOnce || _stopPlayingEnd) { int didTOF = 0; - if (waitForEffect) { + if (_waitForEffect) { while (_vm->_music->isSoundEffectActive()) { _vm->_music->updateMusic(); _vm->waitTOF(); @@ -570,7 +563,7 @@ void Anim::diffNextFrame() { } } - IsPlaying = false; + _isPlaying = false; _vm->_event->mouseShow(); if (!didTOF) @@ -579,12 +572,12 @@ void Anim::diffNextFrame() { return; } - framenumber = 4; /* Random frame number so it never gets back to 2 */ - *difffile = Buffer; + _frameNum = 4; /* Random frame number so it never gets back to 2 */ + *_diffFile = _buffer; break; default: - (*difffile) += size; + (*_diffFile) += _size; break; } } @@ -594,92 +587,92 @@ void Anim::diffNextFrame() { /* A separate task launched by readDiff. Plays the DIFF. */ /*****************************************************************************/ void Anim::playDiff() { - WaitSec = 0L; - WaitMicros = 0L; - DelayMicros = 0L; - header = 0; - CurBit = 0; - framenumber = 0; - numchunks = 1; - donepal = false; - StopPlayingEnd = false; - difffile = &storagefordifffile; - - IsPlaying = true; - - if (DoBlack) { - DoBlack = false; + _waitSec = 0L; + _waitMicros = 0L; + _delayMicros = 0L; + _header = 0; + _curBit = 0; + _frameNum = 0; + _numChunks = 1; + _donePal = false; + _stopPlayingEnd = false; + _diffFile = &_storeDiffFile; + + _isPlaying = true; + + if (_doBlack) { + _doBlack = false; blackScreen(); } - start = *startoffile; /* Make a copy of the pointer to the start of the file */ - *difffile = start; /* Now can modify the file without modifying the original */ + _start = *startoffile; /* Make a copy of the pointer to the start of the file */ + *_diffFile = _start; /* Now can modify the file without modifying the original */ - if (start == NULL) { - IsPlaying = false; + if (_start == NULL) { + _isPlaying = false; return; } - continuous = false; - uint32 signature = READ_BE_UINT32(*difffile); - (*difffile) += 4; + _continuous = false; + uint32 signature = READ_BE_UINT32(*_diffFile); + (*_diffFile) += 4; - header = READ_LE_UINT32(*difffile); - (*difffile) += 4; + _header = READ_LE_UINT32(*_diffFile); + (*_diffFile) += 4; - if ((signature != MKTAG('D', 'I', 'F', 'F')) || (header != 1219009121L)) { - IsPlaying = false; + if ((signature != MKTAG('D', 'I', 'F', 'F')) || (_header != 1219009121L)) { + _isPlaying = false; return; } - header = READ_LE_UINT32(*difffile); - (*difffile) += 4; + _header = READ_LE_UINT32(*_diffFile); + (*_diffFile) += 4; - size = READ_LE_UINT32(*difffile); - (*difffile) += 4; + _size = READ_LE_UINT32(*_diffFile); + (*_diffFile) += 4; - if (header == 0) { + if (_header == 0) { // sizeof(headerdata) != 18, but the padding might be at the end - headerdata._version = READ_LE_UINT16(*difffile); - (*difffile) += 2; - headerdata._width = READ_LE_UINT16(*difffile); - (*difffile) += 2; - headerdata._height = READ_LE_UINT16(*difffile); - (*difffile) += 2; - headerdata._depth = *difffile[0]; - (*difffile)++; - headerdata._fps = *difffile[0]; - (*difffile)++; - headerdata._bufferSize = READ_LE_UINT32(*difffile); - (*difffile) += 4; - headerdata._machine = READ_LE_UINT16(*difffile); - (*difffile) += 2; - headerdata._flags = READ_LE_UINT32(*difffile); - (*difffile) += 4; - - (*difffile) += size - 18; - - continuous = CONTINUOUS & headerdata._flags; - diffwidth = headerdata._width; - diffheight = headerdata._height; - _dataBytesPerRow = diffwidth; - - numchunks = (((int32) diffwidth) * diffheight) / 0x10000; - - if ((uint32)(numchunks * 0x10000) < (uint32)(((int32) diffwidth) * diffheight)) - numchunks++; + _headerdata._version = READ_LE_UINT16(*_diffFile); + (*_diffFile) += 2; + _headerdata._width = READ_LE_UINT16(*_diffFile); + (*_diffFile) += 2; + _headerdata._height = READ_LE_UINT16(*_diffFile); + (*_diffFile) += 2; + _headerdata._depth = *_diffFile[0]; + (*_diffFile)++; + _headerdata._fps = *_diffFile[0]; + (*_diffFile)++; + _headerdata._bufferSize = READ_LE_UINT32(*_diffFile); + (*_diffFile) += 4; + _headerdata._machine = READ_LE_UINT16(*_diffFile); + (*_diffFile) += 2; + _headerdata._flags = READ_LE_UINT32(*_diffFile); + (*_diffFile) += 4; + + (*_diffFile) += _size - 18; + + _continuous = CONTINUOUS & _headerdata._flags; + _diffWidth = _headerdata._width; + _diffHeight = _headerdata._height; + _dataBytesPerRow = _diffWidth; + + _numChunks = (((int32) _diffWidth) * _diffHeight) / 0x10000; + + if ((uint32)(_numChunks * 0x10000) < (uint32)(((int32) _diffWidth) * _diffHeight)) + _numChunks++; } else { return; } - for (header = 0; header < 8; header++) - RawDiffBM._planes[header] = NULL; + for (_header = 0; _header < 8; _header++) + _rawDiffBM._planes[_header] = NULL; - if (headerdata._fps) - DelayMicros = ONESECOND / headerdata._fps; + if (_headerdata._fps) + _delayMicros = ONESECOND / _headerdata._fps; - if (PlayOnce) { - while (header != 65535) + if (_playOnce) { + while (_header != 65535) diffNextFrame(); } else diffNextFrame(); @@ -689,19 +682,17 @@ void Anim::playDiff() { /* Stops an animation from running. */ /*****************************************************************************/ void Anim::stopDiff() { - if (IsPlaying) { - if (IsAnim) - blackScreen(); - } + if (_isPlaying && _isAnim) + blackScreen(); } /*****************************************************************************/ /* Stops an animation from running. */ /*****************************************************************************/ void Anim::stopDiffEnd() { - if (IsPlaying) { - StopPlayingEnd = true; - while (IsPlaying) { + if (_isPlaying) { + _stopPlayingEnd = true; + while (_isPlaying) { g_lab->_music->updateMusic(); diffNextFrame(); } @@ -712,14 +703,14 @@ void Anim::stopDiffEnd() { /* Stops the continuous sound from playing. */ /*****************************************************************************/ void Anim::stopSound() { - stopsound = true; + _stopSound = true; } /*****************************************************************************/ /* Reads in a DIFF file. */ /*****************************************************************************/ -bool Anim::readDiff(bool playonce) { - PlayOnce = playonce; +bool Anim::readDiff(bool playOnce) { + _playOnce = playOnce; playDiff(); return true; } diff --git a/engines/lab/anim.h b/engines/lab/anim.h index 62c7e39a83..3fed57d929 100644 --- a/engines/lab/anim.h +++ b/engines/lab/anim.h @@ -63,29 +63,29 @@ class Anim { private: LabEngine *_vm; - uint32 header; - uint16 CurBit; - uint16 numchunks; - uint32 WaitSec; - uint32 WaitMicros; - uint32 DelayMicros; - bool continuous; - bool IsPlaying; - bool IsAnim; - bool IsPal; - bool donepal; - uint16 framenumber; - bool PlayOnce; - byte *Buffer; - byte *storagefordifffile; - byte **difffile; - uint32 size; - bool StopPlayingEnd; - uint16 samplespeed; - byte *start; - uint32 diffwidth; - uint32 diffheight; - bool stopsound; + uint32 _header; + uint16 _curBit; + uint16 _numChunks; + uint32 _waitSec; + uint32 _waitMicros; + uint32 _delayMicros; + bool _continuous; + bool _isPlaying; + bool _isAnim; + bool _isPal; + bool _donePal; + uint16 _frameNum; + bool _playOnce; + byte *_buffer; + byte *_storeDiffFile; + byte **_diffFile; + uint32 _size; + bool _stopPlayingEnd; + uint16 _sampleSpeed; + byte *_start; + uint32 _diffWidth; + uint32 _diffHeight; + bool _stopSound; uint16 _dataBytesPerRow; void unDIFFByteByte(byte *dest, byte *diff); @@ -97,24 +97,24 @@ private: public: Anim(LabEngine *vm); - DIFFHeader headerdata; - char diffcmap[256 * 3]; - bool IsBM; /* Just fill in the RawDIFFBM structure */ - bool waitForEffect; /* Wait for each sound effect to finish before continuing. */ - bool DoBlack; /* Black the screen before new picture */ - bool nopalchange; /* Don't change the palette. */ - BitMap RawDiffBM; + DIFFHeader _headerdata; + char _diffPalette[256 * 3]; + bool _isBM; /* Just fill in the RawDIFFBM structure */ + bool _waitForEffect; /* Wait for each sound effect to finish before continuing. */ + bool _doBlack; /* Black the screen before new picture */ + bool _noPalChange; /* Don't change the palette. */ + BitMap _rawDiffBM; - void unDiff(byte *NewBuf, byte *OldBuf, byte *DiffData, uint16 bytesperrow, bool IsV); + void unDiff(byte *newBuf, byte *oldBuf, byte *diffData, uint16 bytesperrow, bool isV); bool unDIFFMemory(byte *dest, /* Where to Un-DIFF */ - byte *diff, /* The DIFFed code. */ - uint16 headerSize, /* Size of header (1, 2 or 4 bytes) (only supports 1 currently */ - uint16 copySize); /* Size of minimum copy or skip. (1, 2 or 4 bytes) */ + byte *diff, /* The DIFFed code. */ + uint16 headerSize, /* Size of header (1, 2 or 4 bytes) (only supports 1 currently */ + uint16 copySize); /* Size of minimum copy or skip. (1, 2 or 4 bytes) */ bool VUnDIFFMemory(byte *dest, byte *diff, uint16 headerSize, uint16 copySize, uint16 bytesPerRow); void runLengthDecode(byte *dest, byte *source); void VRunLengthDecode(byte *dest, byte *source, uint16 bytesPerRow); - bool readDiff(bool playonce); + bool readDiff(bool playOnce); void diffNextFrame(); void readSound(bool waitTillFinished, Common::File *file); void stopDiff(); diff --git a/engines/lab/engine.cpp b/engines/lab/engine.cpp index e401e062ed..b8845412aa 100644 --- a/engines/lab/engine.cpp +++ b/engines/lab/engine.cpp @@ -447,17 +447,17 @@ static const char *getInvName(uint16 CurInv) { else if (CurInv == WESTPAPERNUM) { CurFileName = Inventory[CurInv].BInvName; - g_lab->_anim->nopalchange = true; + g_lab->_anim->_noPalChange = true; readPict(CurFileName, false); - g_lab->_anim->nopalchange = false; + g_lab->_anim->_noPalChange = false; doWestPaper(); } else if (CurInv == NOTESNUM) { CurFileName = Inventory[CurInv].BInvName; - g_lab->_anim->nopalchange = true; + g_lab->_anim->_noPalChange = true; readPict(CurFileName, false); - g_lab->_anim->nopalchange = false; + g_lab->_anim->_noPalChange = false; doNotes(); } @@ -531,18 +531,18 @@ bool LabEngine::doUse(uint16 CurInv) { _conditions->inclElement(LAMPON); } - _anim->DoBlack = false; - _anim->waitForEffect = true; + _anim->_doBlack = false; + _anim->_waitForEffect = true; readPict("Music:Click", true); - _anim->waitForEffect = false; + _anim->_waitForEffect = false; - _anim->DoBlack = false; + _anim->_doBlack = false; Test = getInvName(CurInv); } else if (CurInv == BELTNUM) { /* LAB: Labyrinth specific */ if (!_conditions->in(BELTGLOW)) _conditions->inclElement(BELTGLOW); - _anim->DoBlack = false; + _anim->_doBlack = false; Test = getInvName(CurInv); } else if (CurInv == WHISKEYNUM) { /* LAB: Labyrinth specific */ _conditions->inclElement(USEDHELMET); @@ -782,7 +782,7 @@ bool LabEngine::from_crumbs(uint32 tmpClass, uint16 code, uint16 Qualifier, Comm uint16 NewDir; - _anim->DoBlack = false; + _anim->_doBlack = false; if ((msgClass == RAWKEY) && (!LongWinInFront)) { if (code == 13) { /* The return key */ @@ -809,7 +809,7 @@ bool LabEngine::from_crumbs(uint32 tmpClass, uint16 code, uint16 Qualifier, Comm if (Alternate) { eatMessages(); Alternate = false; - _anim->DoBlack = true; + _anim->_doBlack = true; DoNotDrawMessage = false; MainDisplay = true; @@ -888,7 +888,7 @@ bool LabEngine::from_crumbs(uint32 tmpClass, uint16 code, uint16 Qualifier, Comm if ((actionMode == 4) && (gadgetId == 4) && (CPtr != NULL)) { doMainView(&CPtr); - _anim->DoBlack = true; + _anim->_doBlack = true; HCPtr = NULL; CPtr = NULL; mayShowCrumbIndicator(); @@ -897,7 +897,7 @@ bool LabEngine::from_crumbs(uint32 tmpClass, uint16 code, uint16 Qualifier, Comm eatMessages(); Alternate = true; - _anim->DoBlack = true; + _anim->_doBlack = true; DoNotDrawMessage = false; interfaceOn(); /* Sets the correct gadget list */ @@ -958,7 +958,7 @@ bool LabEngine::from_crumbs(uint32 tmpClass, uint16 code, uint16 Qualifier, Comm NewDir = Direction; processArrow(&NewDir, gadgetId - 6); doTurn(Direction, NewDir, &CPtr); - _anim->DoBlack = true; + _anim->_doBlack = true; Direction = NewDir; forceDraw = true; @@ -969,9 +969,9 @@ bool LabEngine::from_crumbs(uint32 tmpClass, uint16 code, uint16 Qualifier, Comm if (doGoForward(&CPtr)) { if (OldRoomNum == _roomNum) - _anim->DoBlack = true; + _anim->_doBlack = true; } else { - _anim->DoBlack = true; + _anim->_doBlack = true; processArrow(&Direction, gadgetId - 6); if (OldRoomNum != _roomNum) { @@ -980,7 +980,7 @@ bool LabEngine::from_crumbs(uint32 tmpClass, uint16 code, uint16 Qualifier, Comm CurFileName = " "; forceDraw = true; } else { - _anim->DoBlack = true; + _anim->_doBlack = true; drawStaticMessage(kTextNoPath); } } @@ -1031,12 +1031,12 @@ bool LabEngine::from_crumbs(uint32 tmpClass, uint16 code, uint16 Qualifier, Comm } } } else if ((msgClass == GADGETUP) && Alternate) { - _anim->DoBlack = true; + _anim->_doBlack = true; if (gadgetId == 0) { eatMessages(); Alternate = false; - _anim->DoBlack = true; + _anim->_doBlack = true; DoNotDrawMessage = false; MainDisplay = true; @@ -1135,7 +1135,7 @@ bool LabEngine::from_crumbs(uint32 tmpClass, uint16 code, uint16 Qualifier, Comm eatMessages(); Alternate = false; - _anim->DoBlack = true; + _anim->_doBlack = true; DoNotDrawMessage = false; MainDisplay = true; @@ -1203,7 +1203,7 @@ bool LabEngine::from_crumbs(uint32 tmpClass, uint16 code, uint16 Qualifier, Comm drawStaticMessage(kTextNothing); } else if (TempCPtr->GraphicName) { if (*(TempCPtr->GraphicName)) { - _anim->DoBlack = true; + _anim->_doBlack = true; CPtr = TempCPtr; } else if (curPos.y < (VGAScaleY(149) + SVGACord(2))) drawStaticMessage(kTextNothing); @@ -1254,7 +1254,7 @@ bool LabEngine::from_crumbs(uint32 tmpClass, uint16 code, uint16 Qualifier, Comm } else if ((msgClass == MOUSEBUTTONS) && (IEQUALIFIER_RBUTTON & Qualifier)) { eatMessages(); Alternate = !Alternate; - _anim->DoBlack = true; + _anim->_doBlack = true; DoNotDrawMessage = false; MainDisplay = true; interfaceOn(); /* Sets the correct gadget list */ @@ -1308,7 +1308,7 @@ void LabEngine::go() { Intro intro; intro.introSequence(); } else - _anim->DoBlack = true; + _anim->_doBlack = true; if (mem) { _event->mouseShow(); diff --git a/engines/lab/graphics.cpp b/engines/lab/graphics.cpp index 16283eab5e..54a4f352c2 100644 --- a/engines/lab/graphics.cpp +++ b/engines/lab/graphics.cpp @@ -85,7 +85,7 @@ bool readMusic(const char *filename, bool waitTillFinished) { if (!file) return false; - g_lab->_anim->DoBlack = false; + g_lab->_anim->_doBlack = false; g_lab->_anim->readSound(waitTillFinished, file); return true; @@ -474,23 +474,23 @@ void LabEngine::doScrollWipe(char *filename) { waitTOF(); } - _anim->IsBM = true; + _anim->_isBM = true; readPict(filename, true); - setPalette(_anim->diffcmap, 256); - _anim->IsBM = false; - byte *mem = _anim->RawDiffBM._planes[0]; + setPalette(_anim->_diffPalette, 256); + _anim->_isBM = false; + byte *mem = _anim->_rawDiffBM._planes[0]; _music->updateMusic(); uint16 by = VGAScaleX(3); uint16 nheight = height; - while (onrow < _anim->headerdata._height) { + while (onrow < _anim->_headerdata._height) { _music->updateMusic(); if ((by > nheight) && nheight) by = nheight; - if ((startline + by) > (_anim->headerdata._height - height - 1)) + if ((startline + by) > (_anim->_headerdata._height - height - 1)) break; if (nheight) @@ -536,10 +536,10 @@ void LabEngine::doScrollBounce() { _event->mouseHide(); int width = VGAScaleX(320); int height = VGAScaleY(149) + SVGACord(2); - byte *mem = _anim->RawDiffBM._planes[0]; + byte *mem = _anim->_rawDiffBM._planes[0]; _music->updateMusic(); - int startline = _anim->headerdata._height - height - 1; + int startline = _anim->_headerdata._height - height - 1; for (int i = 0; i < 5; i++) { _music->updateMusic(); @@ -620,7 +620,7 @@ void LabEngine::doTransWipe(CloseDataPtr *cPtr, char *filename) { CurFileName = getPictName(cPtr); byte *BitMapMem = readPictToMem(CurFileName, _screenWidth, lastY + 5); - setPalette(_anim->diffcmap, 256); + setPalette(_anim->_diffPalette, 256); if (BitMapMem) { imSource.Width = _screenWidth; diff --git a/engines/lab/intro.cpp b/engines/lab/intro.cpp index a35984e623..adc4fd2efb 100644 --- a/engines/lab/intro.cpp +++ b/engines/lab/intro.cpp @@ -237,7 +237,7 @@ void Intro::nReadPict(const char *filename, bool playOnce) { if (_quitIntro) return; - g_lab->_anim->DoBlack = _introDoBlack; + g_lab->_anim->_doBlack = _introDoBlack; g_lab->_anim->stopDiffEnd(); readPict(finalFileName.c_str(), playOnce); } @@ -254,7 +254,7 @@ void Intro::introSequence() { 0x0CB3, 0x0DC4, 0x0DD6, 0x0EE7 }; - g_lab->_anim->DoBlack = true; + g_lab->_anim->_doBlack = true; if (g_lab->getPlatform() != Common::kPlatformWindows) { nReadPict("EA0", true); @@ -276,12 +276,12 @@ void Intro::introSequence() { g_lab->_music->initMusic(); - g_lab->_anim->nopalchange = true; + g_lab->_anim->_noPalChange = true; if (g_lab->getPlatform() != Common::kPlatformWindows) nReadPict("TNDcycle.pic", true); else nReadPict("TNDcycle2.pic", true); - g_lab->_anim->nopalchange = false; + g_lab->_anim->_noPalChange = false; FadePalette = palette; @@ -289,9 +289,9 @@ void Intro::introSequence() { if (_quitIntro) break; - palette[i] = ((g_lab->_anim->diffcmap[i * 3] >> 2) << 8) + - ((g_lab->_anim->diffcmap[i * 3 + 1] >> 2) << 4) + - (g_lab->_anim->diffcmap[i * 3 + 2] >> 2); + palette[i] = ((g_lab->_anim->_diffPalette[i * 3] >> 2) << 8) + + ((g_lab->_anim->_diffPalette[i * 3 + 1] >> 2) << 4) + + (g_lab->_anim->_diffPalette[i * 3 + 2] >> 2); } g_lab->_music->updateMusic(); @@ -346,14 +346,14 @@ void Intro::introSequence() { TextFont *msgFont = g_lab->_resource->getFont("P:Map.fon"); - g_lab->_anim->nopalchange = true; + g_lab->_anim->_noPalChange = true; nReadPict("Intro.1", true); - g_lab->_anim->nopalchange = false; + g_lab->_anim->_noPalChange = false; for (uint16 i = 0; i < 16; i++) { - palette[i] = ((g_lab->_anim->diffcmap[i * 3] >> 2) << 8) + - ((g_lab->_anim->diffcmap[i * 3 + 1] >> 2) << 4) + - (g_lab->_anim->diffcmap[i * 3 + 2] >> 2); + palette[i] = ((g_lab->_anim->_diffPalette[i * 3] >> 2) << 8) + + ((g_lab->_anim->_diffPalette[i * 3 + 1] >> 2) << 4) + + (g_lab->_anim->_diffPalette[i * 3 + 2] >> 2); } doPictText("i.1", msgFont, true); @@ -393,11 +393,11 @@ void Intro::introSequence() { if (!_quitIntro) for (uint16 i = 0; i < 50; i++) { for (uint16 idx = (8 * 3); idx < (255 * 3); idx++) - g_lab->_anim->diffcmap[idx] = 255 - g_lab->_anim->diffcmap[idx]; + g_lab->_anim->_diffPalette[idx] = 255 - g_lab->_anim->_diffPalette[idx]; g_lab->_music->updateMusic(); g_lab->waitTOF(); - g_lab->setPalette(g_lab->_anim->diffcmap, 256); + g_lab->setPalette(g_lab->_anim->_diffPalette, 256); g_lab->waitTOF(); g_lab->waitTOF(); } @@ -458,7 +458,7 @@ void Intro::introSequence() { if (_quitIntro) { g_lab->setAPen(0); g_lab->rectFill(0, 0, g_lab->_screenWidth - 1, g_lab->_screenHeight - 1); - g_lab->_anim->DoBlack = true; + g_lab->_anim->_doBlack = true; } closeFont(msgFont); diff --git a/engines/lab/processroom.cpp b/engines/lab/processroom.cpp index 5807227c51..0145c83cd4 100644 --- a/engines/lab/processroom.cpp +++ b/engines/lab/processroom.cpp @@ -378,7 +378,7 @@ static void doActions(Action * APtr, CloseDataPtr *LCPtr) { case NOUPDATE: noupdatediff = true; - g_lab->_anim->DoBlack = false; + g_lab->_anim->_doBlack = false; break; case FORCEUPDATE: @@ -444,7 +444,7 @@ static void doActions(Action * APtr, CloseDataPtr *LCPtr) { g_lab->_roomNum = APtr->Param1; Direction = APtr->Param2 - 1; *LCPtr = NULL; - g_lab->_anim->DoBlack = true; + g_lab->_anim->_doBlack = true; break; case SETCLOSEUP: @@ -554,17 +554,17 @@ static void doActions(Action * APtr, CloseDataPtr *LCPtr) { case SPECIALCMD: if (APtr->Param1 == 0) - g_lab->_anim->DoBlack = true; + g_lab->_anim->_doBlack = true; else if (APtr->Param1 == 1) - g_lab->_anim->DoBlack = (CPtr == NULL); + g_lab->_anim->_doBlack = (CPtr == NULL); else if (APtr->Param1 == 2) - g_lab->_anim->DoBlack = (CPtr != NULL); + g_lab->_anim->_doBlack = (CPtr != NULL); else if (APtr->Param1 == 5) { /* inverse the palette */ for (uint16 idx = (8 * 3); idx < (255 * 3); idx++) - g_lab->_anim->diffcmap[idx] = 255 - g_lab->_anim->diffcmap[idx]; + g_lab->_anim->_diffPalette[idx] = 255 - g_lab->_anim->_diffPalette[idx]; g_lab->waitTOF(); - g_lab->setPalette(g_lab->_anim->diffcmap, 256); + g_lab->setPalette(g_lab->_anim->_diffPalette, 256); g_lab->waitTOF(); g_lab->waitTOF(); } else if (APtr->Param1 == 4) { /* white the palette */ @@ -573,7 +573,7 @@ static void doActions(Action * APtr, CloseDataPtr *LCPtr) { g_lab->waitTOF(); } else if (APtr->Param1 == 6) { /* Restore the palette */ g_lab->waitTOF(); - g_lab->setPalette(g_lab->_anim->diffcmap, 256); + g_lab->setPalette(g_lab->_anim->_diffPalette, 256); g_lab->waitTOF(); g_lab->waitTOF(); } else if (APtr->Param1 == 7) { /* Quick pause */ diff --git a/engines/lab/special.cpp b/engines/lab/special.cpp index 6f70cb0f1a..2744d3de32 100644 --- a/engines/lab/special.cpp +++ b/engines/lab/special.cpp @@ -110,7 +110,7 @@ static byte *loadBackPict(const char *fileName, bool tomem) { byte *res = NULL; FadePalette = hipal; - g_lab->_anim->nopalchange = true; + g_lab->_anim->_noPalChange = true; if (tomem) res = readPictToMem(fileName, g_lab->_screenWidth, g_lab->_screenHeight); @@ -118,12 +118,12 @@ static byte *loadBackPict(const char *fileName, bool tomem) { readPict(fileName, true); for (uint16 i = 0; i < 16; i++) { - hipal[i] = ((g_lab->_anim->diffcmap[i * 3] >> 2) << 8) + - ((g_lab->_anim->diffcmap[i * 3 + 1] >> 2) << 4) + - ((g_lab->_anim->diffcmap[i * 3 + 2] >> 2)); + hipal[i] = ((g_lab->_anim->_diffPalette[i * 3] >> 2) << 8) + + ((g_lab->_anim->_diffPalette[i * 3 + 1] >> 2) << 4) + + ((g_lab->_anim->_diffPalette[i * 3 + 2] >> 2)); } - g_lab->_anim->nopalchange = false; + g_lab->_anim->_noPalChange = false; return res; } @@ -143,10 +143,10 @@ void showCombination(const char *filename) { byte **buffer; resetBuffer(); - g_lab->_anim->DoBlack = true; - g_lab->_anim->nopalchange = true; + g_lab->_anim->_doBlack = true; + g_lab->_anim->_noPalChange = true; readPict(filename, true); - g_lab->_anim->nopalchange = false; + g_lab->_anim->_noPalChange = false; blackScreen(); @@ -159,7 +159,7 @@ void showCombination(const char *filename) { doCombination(); - g_lab->setPalette(g_lab->_anim->diffcmap, 256); + g_lab->setPalette(g_lab->_anim->_diffPalette, 256); } @@ -286,10 +286,10 @@ void showTile(const char *filename, bool showsolution) { byte **buffer; resetBuffer(); - g_lab->_anim->DoBlack = true; - g_lab->_anim->nopalchange = true; + g_lab->_anim->_doBlack = true; + g_lab->_anim->_noPalChange = true; readPict(filename, true); - g_lab->_anim->nopalchange = false; + g_lab->_anim->_noPalChange = false; blackScreen(); if (showsolution) { @@ -310,7 +310,7 @@ void showTile(const char *filename, bool showsolution) { doTile(showsolution); - g_lab->setPalette(g_lab->_anim->diffcmap, 256); + g_lab->setPalette(g_lab->_anim->_diffPalette, 256); } static void scrollRaster(int16 dx, int16 dy, uint16 x1, uint16 y1, uint16 x2, uint16 y2) { @@ -424,7 +424,7 @@ static void changeTile(uint16 col, uint16 row) { if (check) { g_lab->_conditions->inclElement(BRICKOPEN); /* unlocked combination */ - g_lab->_anim->DoBlack = true; + g_lab->_anim->_doBlack = true; check = readPict("p:Up/BDOpen", true); } } @@ -457,7 +457,7 @@ void doNotes() { char *ntext = g_lab->_resource->getText("Lab:Rooms/Notes"); flowText(noteFont, -2 + SVGACord(1), 0, 0, false, false, true, true, VGAScaleX(25) + SVGACord(15), VGAScaleY(50), VGAScaleX(295) - SVGACord(15), VGAScaleY(148), ntext); - g_lab->setPalette(g_lab->_anim->diffcmap, 256); + g_lab->setPalette(g_lab->_anim->_diffPalette, 256); closeFont(noteFont); delete[] ntext; @@ -501,7 +501,7 @@ void doWestPaper() { delete[] ntext; closeFont(paperFont); - g_lab->setPalette(g_lab->_anim->diffcmap, 256); + g_lab->setPalette(g_lab->_anim->_diffPalette, 256); freeAllStolenMem(); } @@ -673,14 +673,14 @@ void LabEngine::drawJournal(uint16 wipenum, bool needFade) { if (needFade) fade(true, 0); - g_lab->_anim->nopalchange = true; + g_lab->_anim->_noPalChange = true; JBackImage.ImageData = readPictToMem("P:Journal.pic", _screenWidth, _screenHeight); GotBackImage = true; eatMessages(); _event->mouseShow(); - g_lab->_anim->nopalchange = false; + g_lab->_anim->_noPalChange = false; } /*****************************************************************************/ -- cgit v1.2.3 From 53d92be11f8ffb65f73d81874df9340f9f99a215 Mon Sep 17 00:00:00 2001 From: Strangerke Date: Wed, 2 Dec 2015 00:38:30 +0100 Subject: LAB: remove the use of g_lab in Anim --- engines/lab/anim.cpp | 20 ++++++++++---------- 1 file changed, 10 insertions(+), 10 deletions(-) diff --git a/engines/lab/anim.cpp b/engines/lab/anim.cpp index 908c4e4b19..f4cae849f7 100644 --- a/engines/lab/anim.cpp +++ b/engines/lab/anim.cpp @@ -419,7 +419,7 @@ void Anim::diffNextFrame() { return; if (DispBitMap->_flags & BITMAPF_VIDEO) { - DispBitMap->_planes[0] = g_lab->getCurrentDrawingBuffer(); + DispBitMap->_planes[0] = _vm->getCurrentDrawingBuffer(); DispBitMap->_planes[1] = DispBitMap->_planes[0] + 0x10000; DispBitMap->_planes[2] = DispBitMap->_planes[1] + 0x10000; DispBitMap->_planes[3] = DispBitMap->_planes[2] + 0x10000; @@ -693,7 +693,7 @@ void Anim::stopDiffEnd() { if (_isPlaying) { _stopPlayingEnd = true; while (_isPlaying) { - g_lab->_music->updateMusic(); + _vm->_music->updateMusic(); diffNextFrame(); } } @@ -729,15 +729,15 @@ void Anim::readSound(bool waitTillFinished, Common::File *file) { return; while (soundTag != 65535) { - g_lab->_music->updateMusic(); + _vm->_music->updateMusic(); soundTag = file->readUint32LE(); soundSize = file->readUint32LE() - 8; if ((soundTag == 30) || (soundTag == 31)) { if (waitTillFinished) { - while (g_lab->_music->isSoundEffectActive()) { - g_lab->_music->updateMusic(); - g_lab->waitTOF(); + while (_vm->_music->isSoundEffectActive()) { + _vm->_music->updateMusic(); + _vm->waitTOF(); } } @@ -747,12 +747,12 @@ void Anim::readSound(bool waitTillFinished, Common::File *file) { file->skip(2); byte *soundData = (byte *)malloc(soundSize); file->read(soundData, soundSize); - g_lab->_music->playSoundEffect(sampleRate, soundSize, soundData); + _vm->_music->playSoundEffect(sampleRate, soundSize, soundData); } else if (soundTag == 65535L) { if (waitTillFinished) { - while (g_lab->_music->isSoundEffectActive()) { - g_lab->_music->updateMusic(); - g_lab->waitTOF(); + while (_vm->_music->isSoundEffectActive()) { + _vm->_music->updateMusic(); + _vm->waitTOF(); } } } else -- cgit v1.2.3 From 66bf8885585975ae860c8c3d175b960b6a7e9590 Mon Sep 17 00:00:00 2001 From: Strangerke Date: Wed, 2 Dec 2015 00:55:29 +0100 Subject: LAB: Rework and renaming in the Event class --- engines/lab/interface.cpp | 3 +- engines/lab/mouse.cpp | 88 +++++++++++++++++++++++------------------------ engines/lab/mouse.h | 14 ++++++-- 3 files changed, 56 insertions(+), 49 deletions(-) diff --git a/engines/lab/interface.cpp b/engines/lab/interface.cpp index fc7ba1e633..21b5764cc2 100644 --- a/engines/lab/interface.cpp +++ b/engines/lab/interface.cpp @@ -164,7 +164,6 @@ static bool keyPress(uint16 *KeyCode) { } IntuiMessage IMessage; -extern Gadget *ScreenGadgetList; IntuiMessage *LabEngine::getMsg() { Gadget *curgad; @@ -190,7 +189,7 @@ IntuiMessage *LabEngine::getMsg() { IMessage.msgClass = MOUSEBUTTONS; return &IMessage; } else if (keyPress(&IMessage.code)) { /* Keyboard key */ - curgad = checkNumGadgetHit(ScreenGadgetList, IMessage.code); + curgad = checkNumGadgetHit(_event->_screenGadgetList, IMessage.code); if (curgad) { IMessage.msgClass = GADGETUP; diff --git a/engines/lab/mouse.cpp b/engines/lab/mouse.cpp index 4bd6c7f8d8..879bd08b68 100644 --- a/engines/lab/mouse.cpp +++ b/engines/lab/mouse.cpp @@ -35,13 +35,6 @@ namespace Lab { -static bool LeftClick = false; -static bool RightClick = false; - -static bool MouseHidden = true; -static int32 NumHidden = 1; -static Gadget *LastGadgetHit = NULL; -Gadget *ScreenGadgetList = NULL; static byte MouseData[] = {1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 1, 7, 1, 0, 0, 0, 0, 0, 0, 0, 1, 7, 7, 1, 0, 0, 0, 0, 0, 0, @@ -67,30 +60,30 @@ static Gadget *hitgad = NULL; /* Checks whether or not the cords fall within one of the gadgets in a list */ /* of gadgets. */ /*****************************************************************************/ -Gadget *EventManager::checkGadgetHit(Gadget *gadlist, Common::Point pos) { - while (gadlist != NULL) { - if ((pos.x >= gadlist->x) && (pos.y >= gadlist->y) && - (pos.x <= (gadlist->x + gadlist->Im->Width)) && - (pos.y <= (gadlist->y + gadlist->Im->Height)) && - !(GADGETOFF & gadlist->GadgetFlags)) { +Gadget *EventManager::checkGadgetHit(Gadget *gadgetList, Common::Point pos) { + while (gadgetList != NULL) { + if ((pos.x >= gadgetList->x) && (pos.y >= gadgetList->y) && + (pos.x <= (gadgetList->x + gadgetList->Im->Width)) && + (pos.y <= (gadgetList->y + gadgetList->Im->Height)) && + !(GADGETOFF & gadgetList->GadgetFlags)) { if (_vm->_isHiRes) { - hitgad = gadlist; + hitgad = gadgetList; } else { mouseHide(); - gadlist->ImAlt->drawImage(gadlist->x, gadlist->y); + gadgetList->ImAlt->drawImage(gadgetList->x, gadgetList->y); mouseShow(); for (uint16 i = 0; i < 3; i++) _vm->waitTOF(); mouseHide(); - gadlist->Im->drawImage(gadlist->x, gadlist->y); + gadgetList->Im->drawImage(gadgetList->x, gadgetList->y); mouseShow(); } - return gadlist; + return gadgetList; } else { - gadlist = gadlist->NextGadget; + gadgetList = gadgetList->NextGadget; } } @@ -99,39 +92,46 @@ Gadget *EventManager::checkGadgetHit(Gadget *gadlist, Common::Point pos) { -void EventManager::attachGadgetList(Gadget *GadList) { - if (ScreenGadgetList != GadList) - LastGadgetHit = NULL; +void EventManager::attachGadgetList(Gadget *gadgetList) { + if (_screenGadgetList != gadgetList) + _lastGadgetHit = nullptr; - ScreenGadgetList = GadList; + _screenGadgetList = gadgetList; } EventManager::EventManager(LabEngine *vm) : _vm(vm) { + _leftClick = false; + _rightClick = false; + + _mouseHidden = true; + _numHidden = 1; + _lastGadgetHit = nullptr; + _screenGadgetList = nullptr; } void EventManager::mouseHandler(int flag, Common::Point pos) { - if (NumHidden >= 2) + if (_numHidden >= 2) return; if (flag & 0x02) { /* Left mouse button click */ Gadget *tmp = NULL; - if (ScreenGadgetList) - tmp = checkGadgetHit(ScreenGadgetList, _vm->_isHiRes ? pos : Common::Point(pos.x / 2, pos.y)); + if (_screenGadgetList) + tmp = checkGadgetHit(_screenGadgetList, _vm->_isHiRes ? pos : Common::Point(pos.x / 2, pos.y)); if (tmp) - LastGadgetHit = tmp; + _lastGadgetHit = tmp; else - LeftClick = true; + _leftClick = true; } if (flag & 0x08) /* Right mouse button click */ - RightClick = true; + _rightClick = true; } void EventManager::updateMouse() { bool doUpdateDisplay = false; - if (!MouseHidden) + if (!_mouseHidden) doUpdateDisplay = true; if (hitgad) { @@ -169,12 +169,12 @@ void EventManager::initMouse() { /* Shows the mouse. */ /*****************************************************************************/ void EventManager::mouseShow() { - if (NumHidden) - NumHidden--; + if (_numHidden) + _numHidden--; - if ((NumHidden == 0) && MouseHidden) { + if ((_numHidden == 0) && _mouseHidden) { _vm->processInput(); - MouseHidden = false; + _mouseHidden = false; } g_system->showMouse(true); @@ -184,10 +184,10 @@ void EventManager::mouseShow() { /* Hides the mouse. */ /*****************************************************************************/ void EventManager::mouseHide() { - NumHidden++; + _numHidden++; - if (NumHidden && !MouseHidden) { - MouseHidden = true; + if (_numHidden && !_mouseHidden) { + _mouseHidden = true; g_system->showMouse(false); } @@ -214,7 +214,7 @@ void EventManager::setMousePos(Common::Point pos) { else g_system->warpMouse(pos.x * 2, pos.y); - if (!MouseHidden) + if (!_mouseHidden) _vm->processInput(); } @@ -226,17 +226,17 @@ void EventManager::setMousePos(Common::Point pos) { /*****************************************************************************/ bool EventManager::mouseButton(uint16 *x, uint16 *y, bool leftbutton) { if (leftbutton) { - if (LeftClick) { + if (_leftClick) { *x = (!_vm->_isHiRes) ? (uint16)_vm->_mousePos.x / 2 : (uint16)_vm->_mousePos.x; *y = (uint16)_vm->_mousePos.y; - LeftClick = false; + _leftClick = false; return true; } } else { - if (RightClick) { + if (_rightClick) { *x = (!_vm->_isHiRes) ? (uint16)_vm->_mousePos.x / 2 : (uint16)_vm->_mousePos.x; *y = (uint16)_vm->_mousePos.y; - RightClick = false; + _rightClick = false; return true; } } @@ -245,10 +245,10 @@ bool EventManager::mouseButton(uint16 *x, uint16 *y, bool leftbutton) { } Gadget *EventManager::mouseGadget() { - Gadget *Temp = LastGadgetHit; + Gadget *temp = _lastGadgetHit; - LastGadgetHit = nullptr; - return Temp; + _lastGadgetHit = nullptr; + return temp; } } // End of namespace Lab diff --git a/engines/lab/mouse.h b/engines/lab/mouse.h index 4bccb17805..0ff7d605f0 100644 --- a/engines/lab/mouse.h +++ b/engines/lab/mouse.h @@ -42,20 +42,28 @@ class LabEngine; class EventManager { private: LabEngine *_vm; + bool _leftClick; + bool _rightClick; + + bool _mouseHidden; + int32 _numHidden; + Gadget *_lastGadgetHit; public: EventManager (LabEngine *vm); - Gadget *checkGadgetHit(Gadget *gadlist, Common::Point pos); + Gadget *_screenGadgetList; + + Gadget *checkGadgetHit(Gadget *gadgetList, Common::Point pos); void initMouse(); void updateMouse(); void mouseShow(); void mouseHide(); Common::Point getMousePos(); void setMousePos(Common::Point pos); - bool mouseButton(uint16 *x, uint16 *y, bool leftbutton); + bool mouseButton(uint16 *x, uint16 *y, bool leftButton); Gadget *mouseGadget(); - void attachGadgetList(Gadget *GadList); + void attachGadgetList(Gadget *gadgetList); void mouseHandler(int flag, Common::Point pos); }; -- cgit v1.2.3 From 6b24481358464510b5310f8c32cd3bc617286b17 Mon Sep 17 00:00:00 2001 From: Strangerke Date: Wed, 2 Dec 2015 01:39:58 +0100 Subject: LAB: Move functions related to keyboard events to Event --- engines/lab/engine.cpp | 4 +- engines/lab/interface.cpp | 16 +---- engines/lab/lab.cpp | 6 -- engines/lab/lab.h | 17 +---- engines/lab/mouse.cpp | 157 +++++++++++++++++++++++++++++++++++++++++----- engines/lab/mouse.h | 11 ++++ engines/lab/music.cpp | 3 +- engines/lab/vga.cpp | 112 +-------------------------------- 8 files changed, 162 insertions(+), 164 deletions(-) diff --git a/engines/lab/engine.cpp b/engines/lab/engine.cpp index b8845412aa..70ab45dc3e 100644 --- a/engines/lab/engine.cpp +++ b/engines/lab/engine.cpp @@ -640,7 +640,7 @@ void LabEngine::mainGameLoop() { /* Set up initial picture. */ while (1) { - processInput(true); + _event->processInput(true); if (GotMessage) { if (QuitLab || g_engine->shouldQuit()) { @@ -729,7 +729,7 @@ void LabEngine::mainGameLoop() { GotMessage = true; mayShowCrumbIndicator(); screenUpdate(); - if (!from_crumbs(GADGETUP, code, 0, getMousePos(), curInv, curMsg, forceDraw, code, actionMode)) + if (!from_crumbs(GADGETUP, code, 0, _event->updateAndGetMousePos(), curInv, curMsg, forceDraw, code, actionMode)) break; } } diff --git a/engines/lab/interface.cpp b/engines/lab/interface.cpp index 21b5764cc2..dff74be5e0 100644 --- a/engines/lab/interface.cpp +++ b/engines/lab/interface.cpp @@ -149,20 +149,6 @@ Gadget *LabEngine::checkNumGadgetHit(Gadget *gadlist, uint16 key) { return NULL; } - - -/*****************************************************************************/ -/* Checks whether or not a key has been pressed. */ -/*****************************************************************************/ -static bool keyPress(uint16 *KeyCode) { - if (g_lab->haveNextChar()) { - *KeyCode = g_lab->getNextChar(); - return true; - } - - return false; -} - IntuiMessage IMessage; IntuiMessage *LabEngine::getMsg() { @@ -188,7 +174,7 @@ IntuiMessage *LabEngine::getMsg() { IMessage.qualifier = IEQUALIFIER_RBUTTON | Qualifiers; IMessage.msgClass = MOUSEBUTTONS; return &IMessage; - } else if (keyPress(&IMessage.code)) { /* Keyboard key */ + } else if (_event->keyPress(&IMessage.code)) { /* Keyboard key */ curgad = checkNumGadgetHit(_event->_screenGadgetList, IMessage.code); if (curgad) { diff --git a/engines/lab/lab.cpp b/engines/lab/lab.cpp index a6fe4cf32c..22ab50392d 100644 --- a/engines/lab/lab.cpp +++ b/engines/lab/lab.cpp @@ -66,12 +66,6 @@ LabEngine::LabEngine(OSystem *syst, const ADGameDescription *gameDesc) _lastWaitTOFTicks = 0; - _mousePos = Common::Point(0, 0); - _mouseAtEdge = false; - - _nextKeyIn = 0; - _nextKeyOut = 0; - _isHiRes = false; _roomNum = -1; for (int i = 0; i < MAX_CRUMBS; i++) { diff --git a/engines/lab/lab.h b/engines/lab/lab.h index b7cf6e1771..348ce11eca 100644 --- a/engines/lab/lab.h +++ b/engines/lab/lab.h @@ -102,7 +102,6 @@ public: int _roomNum; byte *_currentDisplayBuffer; - Common::Point _mousePos; CrumbData _breadCrumbs[MAX_CRUMBS]; uint16 _numCrumbs; @@ -114,17 +113,10 @@ public: bool _isCrumbWaiting; byte *_tempScrollData; bool _isHiRes; - -private: byte *_displayBuffer; +private: int _lastWaitTOFTicks; - - uint16 _nextKeyIn; - uint16 _keyBuf[64]; - uint16 _nextKeyOut; - bool _mouseAtEdge; - bool _lastMessageLong; bool _lastTooLong; @@ -146,9 +138,6 @@ public: void setPalette(void *cmap, uint16 numcolors); void drawHLine(uint16 x, uint16 y1, uint16 y2); void drawVLine(uint16 x1, uint16 y, uint16 x2); - bool haveNextChar(); - uint16 getNextChar(); - void processInput(bool can_delay = false); void writeColorReg(byte *buf, uint16 regnum); void writeColorRegsSmooth(byte *buf, uint16 first, uint16 numreg); @@ -180,13 +169,13 @@ public: void drawDirection(CloseDataPtr LCPtr); int followCrumbs(); + void changeVolume(int delta); + private: void quickWaitTOF(); /*---------- Drawing Routines ----------*/ - Common::Point getMousePos(); - void changeVolume(int delta); void applyPalette(byte *buf, uint16 first, uint16 numreg, uint16 slow); // engine.cpp diff --git a/engines/lab/mouse.cpp b/engines/lab/mouse.cpp index 879bd08b68..38b893511d 100644 --- a/engines/lab/mouse.cpp +++ b/engines/lab/mouse.cpp @@ -54,8 +54,6 @@ static byte MouseData[] = {1, 1, 0, 0, 0, 0, 0, 0, 0, 0, #define MOUSE_WIDTH 10 #define MOUSE_HEIGHT 15 -static Gadget *hitgad = NULL; - /*****************************************************************************/ /* Checks whether or not the cords fall within one of the gadgets in a list */ /* of gadgets. */ @@ -67,7 +65,7 @@ Gadget *EventManager::checkGadgetHit(Gadget *gadgetList, Common::Point pos) { (pos.y <= (gadgetList->y + gadgetList->Im->Height)) && !(GADGETOFF & gadgetList->GadgetFlags)) { if (_vm->_isHiRes) { - hitgad = gadgetList; + _hitGadget = gadgetList; } else { mouseHide(); gadgetList->ImAlt->drawImage(gadgetList->x, gadgetList->y); @@ -107,6 +105,15 @@ EventManager::EventManager(LabEngine *vm) : _vm(vm) { _numHidden = 1; _lastGadgetHit = nullptr; _screenGadgetList = nullptr; + _hitGadget = nullptr; + _nextKeyIn = 0; + _nextKeyOut = 0; + _mousePos = Common::Point(0, 0); + _mouseAtEdge = false; + + for (int i = 0; i < 64; i++) + _keyBuf[i] = 0; + } void EventManager::mouseHandler(int flag, Common::Point pos) { @@ -134,19 +141,19 @@ void EventManager::updateMouse() { if (!_mouseHidden) doUpdateDisplay = true; - if (hitgad) { + if (_hitGadget) { mouseHide(); - hitgad->ImAlt->drawImage(hitgad->x, hitgad->y); + _hitGadget->ImAlt->drawImage(_hitGadget->x, _hitGadget->y); mouseShow(); for (uint16 i = 0; i < 3; i++) _vm->waitTOF(); mouseHide(); - hitgad->Im->drawImage(hitgad->x, hitgad->y); + _hitGadget->Im->drawImage(_hitGadget->x, _hitGadget->y); mouseShow(); doUpdateDisplay = true; - hitgad = NULL; + _hitGadget = nullptr; } if (doUpdateDisplay) @@ -173,7 +180,7 @@ void EventManager::mouseShow() { _numHidden--; if ((_numHidden == 0) && _mouseHidden) { - _vm->processInput(); + processInput(); _mouseHidden = false; } @@ -199,9 +206,9 @@ void EventManager::mouseHide() { /*****************************************************************************/ Common::Point EventManager::getMousePos() { if (_vm->_isHiRes) - return _vm->_mousePos; + return _mousePos; else - return Common::Point(_vm->_mousePos.x / 2, _vm->_mousePos.y); + return Common::Point(_mousePos.x / 2, _mousePos.y); } @@ -215,7 +222,7 @@ void EventManager::setMousePos(Common::Point pos) { g_system->warpMouse(pos.x * 2, pos.y); if (!_mouseHidden) - _vm->processInput(); + processInput(); } @@ -227,15 +234,15 @@ void EventManager::setMousePos(Common::Point pos) { bool EventManager::mouseButton(uint16 *x, uint16 *y, bool leftbutton) { if (leftbutton) { if (_leftClick) { - *x = (!_vm->_isHiRes) ? (uint16)_vm->_mousePos.x / 2 : (uint16)_vm->_mousePos.x; - *y = (uint16)_vm->_mousePos.y; + *x = (!_vm->_isHiRes) ? (uint16)_mousePos.x / 2 : (uint16)_mousePos.x; + *y = (uint16)_mousePos.y; _leftClick = false; return true; } } else { if (_rightClick) { - *x = (!_vm->_isHiRes) ? (uint16)_vm->_mousePos.x / 2 : (uint16)_vm->_mousePos.x; - *y = (uint16)_vm->_mousePos.y; + *x = (!_vm->_isHiRes) ? (uint16)_mousePos.x / 2 : (uint16)_mousePos.x; + *y = (uint16)_mousePos.y; _rightClick = false; return true; } @@ -251,4 +258,124 @@ Gadget *EventManager::mouseGadget() { return temp; } +/*****************************************************************************/ +/* Checks whether or not a key has been pressed. */ +/*****************************************************************************/ +bool EventManager::keyPress(uint16 *keyCode) { + if (haveNextChar()) { + *keyCode = getNextChar(); + return true; + } + + return false; +} + +bool EventManager::haveNextChar() { + processInput(); + return _nextKeyIn != _nextKeyOut; +} + +void EventManager::processInput(bool can_delay) { + Common::Event event; + + if (1 /*!g_IgnoreProcessInput*/) { + int flags = 0; + while (g_system->getEventManager()->pollEvent(event)) { + switch (event.type) { + case Common::EVENT_RBUTTONDOWN: + flags |= 8; + mouseHandler(flags, _mousePos); + break; + + case Common::EVENT_LBUTTONDOWN: + flags |= 2; + mouseHandler(flags, _mousePos); + break; + + case Common::EVENT_MOUSEMOVE: { + int lastMouseAtEdge = _mouseAtEdge; + _mouseAtEdge = false; + _mousePos.x = event.mouse.x; + if (event.mouse.x <= 0) { + _mousePos.x = 0; + _mouseAtEdge = true; + } + if (_mousePos.x > _vm->_screenWidth - 1) { + _mousePos.x = _vm->_screenWidth; + _mouseAtEdge = true; + } + + _mousePos.y = event.mouse.y; + if (event.mouse.y <= 0) { + _mousePos.y = 0; + _mouseAtEdge = true; + } + if (_mousePos.y > _vm->_screenHeight - 1) { + _mousePos.y = _vm->_screenHeight; + _mouseAtEdge = true; + } + + if (!lastMouseAtEdge || !_mouseAtEdge) + mouseHandler(1, _mousePos); + } + break; + + case Common::EVENT_KEYDOWN: + switch (event.kbd.keycode) { + case Common::KEYCODE_LEFTBRACKET: + _vm->changeVolume(-1); + break; + + case Common::KEYCODE_RIGHTBRACKET: + _vm->changeVolume(1); + break; + + case Common::KEYCODE_z: + //saveSettings(); + break; + + default: { + int n = ((((unsigned int)((_nextKeyIn + 1) >> 31) >> 26) + (byte)_nextKeyIn + 1) & 0x3F) + - ((unsigned int)((_nextKeyIn + 1) >> 31) >> 26); + if (n != _nextKeyOut) { + _keyBuf[_nextKeyIn] = event.kbd.keycode; + _nextKeyIn = n; + } + } + } + break; + + case Common::EVENT_QUIT: + case Common::EVENT_RTL: + default: + break; + } + + g_system->copyRectToScreen(_vm->_displayBuffer, _vm->_screenWidth, 0, 0, _vm->_screenWidth, _vm->_screenHeight); + g_system->updateScreen(); + } + } + + if (can_delay) + g_system->delayMillis(10); +} + +uint16 EventManager::getNextChar() { + uint16 c = 0; + + processInput(); + if (_nextKeyIn != _nextKeyOut) { + c = _keyBuf[_nextKeyOut]; + _nextKeyOut = ((((unsigned int)((_nextKeyOut + 1) >> 31) >> 26) + (byte)_nextKeyOut + 1) & 0x3F) + - ((unsigned int)((_nextKeyOut + 1) >> 31) >> 26); + } + + return c; +} + +Common::Point EventManager::updateAndGetMousePos() { + processInput(); + + return _mousePos; +} } // End of namespace Lab diff --git a/engines/lab/mouse.h b/engines/lab/mouse.h index 0ff7d605f0..b3b3e30da3 100644 --- a/engines/lab/mouse.h +++ b/engines/lab/mouse.h @@ -48,11 +48,17 @@ private: bool _mouseHidden; int32 _numHidden; Gadget *_lastGadgetHit; + uint16 _nextKeyIn; + uint16 _nextKeyOut; + Common::Point _mousePos; + bool _mouseAtEdge; + uint16 _keyBuf[64]; public: EventManager (LabEngine *vm); Gadget *_screenGadgetList; + Gadget *_hitGadget; Gadget *checkGadgetHit(Gadget *gadgetList, Common::Point pos); void initMouse(); @@ -65,6 +71,11 @@ public: Gadget *mouseGadget(); void attachGadgetList(Gadget *gadgetList); void mouseHandler(int flag, Common::Point pos); + bool keyPress(uint16 *keyCode); + bool haveNextChar(); + void processInput(bool can_delay = false); + uint16 getNextChar(); + Common::Point updateAndGetMousePos(); }; } // End of namespace Lab diff --git a/engines/lab/music.cpp b/engines/lab/music.cpp index 8d51320057..7f8df15c35 100644 --- a/engines/lab/music.cpp +++ b/engines/lab/music.cpp @@ -68,8 +68,7 @@ Music::Music(LabEngine *vm) : _vm(vm) { /* it from the Audio device. */ /*****************************************************************************/ void Music::updateMusic() { - _vm->processInput(); - + _vm->_event->processInput(); _vm->_event->updateMouse(); if (_musicOn && getPlayingBufferCount() < MAXBUFFERS) { diff --git a/engines/lab/vga.cpp b/engines/lab/vga.cpp index 4c8169eb6d..3525e779b2 100644 --- a/engines/lab/vga.cpp +++ b/engines/lab/vga.cpp @@ -62,120 +62,12 @@ void LabEngine::changeVolume(int delta) { warning("STUB: changeVolume()"); } -uint16 LabEngine::getNextChar() { - uint16 c = 0; - - processInput(); - if (_nextKeyIn != _nextKeyOut) { - c = _keyBuf[_nextKeyOut]; - _nextKeyOut = ((((unsigned int)((_nextKeyOut + 1) >> 31) >> 26) + (byte)_nextKeyOut + 1) & 0x3F) - - ((unsigned int)((_nextKeyOut + 1) >> 31) >> 26); - } - - return c; -} - -bool LabEngine::haveNextChar() { - processInput(); - return _nextKeyIn != _nextKeyOut; -} - -void LabEngine::processInput(bool can_delay) { - Common::Event event; - - if (1 /*!g_IgnoreProcessInput*/) { - int flags = 0; - while (g_system->getEventManager()->pollEvent(event)) { - switch (event.type) { - case Common::EVENT_RBUTTONDOWN: - flags |= 8; - _event->mouseHandler(flags, _mousePos); - break; - - case Common::EVENT_LBUTTONDOWN: - flags |= 2; - _event->mouseHandler(flags, _mousePos); - break; - - case Common::EVENT_MOUSEMOVE: { - int lastMouseAtEdge = _mouseAtEdge; - _mouseAtEdge = false; - _mousePos.x = event.mouse.x; - if (event.mouse.x <= 0) { - _mousePos.x = 0; - _mouseAtEdge = true; - } - if (_mousePos.x > _screenWidth - 1) { - _mousePos.x = _screenWidth; - _mouseAtEdge = true; - } - - _mousePos.y = event.mouse.y; - if (event.mouse.y <= 0) { - _mousePos.y = 0; - _mouseAtEdge = true; - } - if (_mousePos.y > _screenHeight - 1) { - _mousePos.y = _screenHeight; - _mouseAtEdge = true; - } - - if (!lastMouseAtEdge || !_mouseAtEdge) - _event->mouseHandler(1, _mousePos); - } - break; - - case Common::EVENT_KEYDOWN: - switch (event.kbd.keycode) { - case Common::KEYCODE_LEFTBRACKET: - changeVolume(-1); - break; - - case Common::KEYCODE_RIGHTBRACKET: - changeVolume(1); - break; - - case Common::KEYCODE_z: - //saveSettings(); - break; - - default: { - int n = ((((unsigned int)((_nextKeyIn + 1) >> 31) >> 26) + (byte)_nextKeyIn + 1) & 0x3F) - - ((unsigned int)((_nextKeyIn + 1) >> 31) >> 26); - if (n != _nextKeyOut) { - _keyBuf[_nextKeyIn] = event.kbd.keycode; - _nextKeyIn = n; - } - } - } - break; - - case Common::EVENT_QUIT: - case Common::EVENT_RTL: - default: - break; - } - - g_system->copyRectToScreen(_displayBuffer, _screenWidth, 0, 0, _screenWidth, _screenHeight); - g_system->updateScreen(); - } - } - - if (can_delay) - g_system->delayMillis(10); -} - -Common::Point LabEngine::getMousePos() { - processInput(); - - return _mousePos; -} void LabEngine::waitTOF() { g_system->copyRectToScreen(_displayBuffer, _screenWidth, 0, 0, _screenWidth, _screenHeight); g_system->updateScreen(); - processInput(); + _event->processInput(); uint32 now; @@ -237,7 +129,7 @@ void LabEngine::screenUpdate() { g_system->copyRectToScreen(_displayBuffer, _screenWidth, 0, 0, _screenWidth, _screenHeight); g_system->updateScreen(); - processInput(); + _event->processInput(); } /*****************************************************************************/ -- cgit v1.2.3 From d2dbf1924442056a8bf1b7cd5c7eab56e0689b7c Mon Sep 17 00:00:00 2001 From: Eugene Sandulenko Date: Wed, 2 Dec 2015 08:28:05 +0100 Subject: LAB: Fix module.mk after readdiff.cpp removal --- engines/lab/module.mk | 1 - 1 file changed, 1 deletion(-) diff --git a/engines/lab/module.mk b/engines/lab/module.mk index b21a3ea23b..53b9f4e1e6 100644 --- a/engines/lab/module.mk +++ b/engines/lab/module.mk @@ -17,7 +17,6 @@ MODULE_OBJS := \ mouse.o \ music.o \ processroom.o \ - readdiff.o \ resource.o \ savegame.o \ special.o \ -- cgit v1.2.3 From 9ac98357bdf0cfeb51242d84450c865eb5cb61c8 Mon Sep 17 00:00:00 2001 From: Strangerke Date: Wed, 2 Dec 2015 23:10:41 +0100 Subject: LAB: Get rid of g_lab in Intro --- engines/lab/engine.cpp | 5 +- engines/lab/intro.cpp | 179 +++++++++++++++++++++++-------------------------- engines/lab/intro.h | 3 +- 3 files changed, 90 insertions(+), 97 deletions(-) diff --git a/engines/lab/engine.cpp b/engines/lab/engine.cpp index 70ab45dc3e..ba9e4921c9 100644 --- a/engines/lab/engine.cpp +++ b/engines/lab/engine.cpp @@ -1305,8 +1305,9 @@ void LabEngine::go() { _event->mouseHide(); if (doIntro && mem) { - Intro intro; - intro.introSequence(); + Intro *intro = new Intro(this); + intro->introSequence(); + delete intro; } else _anim->_doBlack = true; diff --git a/engines/lab/intro.cpp b/engines/lab/intro.cpp index adc4fd2efb..b2835857fe 100644 --- a/engines/lab/intro.cpp +++ b/engines/lab/intro.cpp @@ -39,7 +39,7 @@ namespace Lab { extern uint16 *FadePalette; -Intro::Intro() { +Intro::Intro(LabEngine *vm) : _vm(vm) { _quitIntro = false; } @@ -49,7 +49,7 @@ Intro::Intro() { /******************************************************************************/ void Intro::introEatMessages() { while (1) { - IntuiMessage *msg = g_lab->getMsg(); + IntuiMessage *msg = _vm->getMsg(); if (g_engine->shouldQuit()) { _quitIntro = true; @@ -68,87 +68,85 @@ void Intro::introEatMessages() { } - - /*****************************************************************************/ /* Reads in a picture. */ /*****************************************************************************/ -void Intro::doPictText(const char *filename, TextFont *msgFont, bool isscreen) { - uint32 lastsecs = 0L, lastmicros = 0L, secs = 0L, micros = 0L; - IntuiMessage *msg; +void Intro::doPictText(const char *filename, TextFont *msgFont, bool isScreen) { char path[50] = "Lab:rooms/Intro/"; - byte *curplace, **tfile; - bool drawNextText = true, end = false, begin = true; - - int32 cls, code, Drawn; - int16 qualifier; - uint timedelay; - strcat(path, filename); - if (isscreen) { - g_lab->_music->updateMusic(); - timedelay = 35; + uint timeDelay; + if (isScreen) { + _vm->_music->updateMusic(); + timeDelay = 35; } else { - g_lab->_music->updateMusic(); - timedelay = 7; + _vm->_music->updateMusic(); + timeDelay = 7; } if (_quitIntro) return; + uint32 lastSecs = 0L, lastMicros = 0L, secs = 0L, micros = 0L; + IntuiMessage *msg; + byte *curPlace, **tFile; + bool drawNextText = true, end = false, begin = true; + + int32 cls, code, Drawn; + int16 qualifier; + while (1) { if (drawNextText) { if (begin) { begin = false; - tfile = g_lab->_music->newOpen(path); + tFile = _vm->_music->newOpen(path); - if (!tfile) + if (!tFile) return; - curplace = *tfile; - } else if (isscreen) + curPlace = *tFile; + } else if (isScreen) fade(false, 0); - if (isscreen) { - g_lab->setAPen(7); - g_lab->rectFill(VGAScaleX(10), VGAScaleY(10), VGAScaleX(310), VGAScaleY(190)); + if (isScreen) { + _vm->setAPen(7); + _vm->rectFill(VGAScaleX(10), VGAScaleY(10), VGAScaleX(310), VGAScaleY(190)); - Drawn = flowText(msgFont, (!g_lab->_isHiRes) * -1, 5, 7, false, false, true, true, VGAScaleX(14), VGAScaleY(11), VGAScaleX(306), VGAScaleY(189), (char *)curplace); + Drawn = flowText(msgFont, (!_vm->_isHiRes) * -1, 5, 7, false, false, true, true, VGAScaleX(14), VGAScaleY(11), VGAScaleX(306), VGAScaleY(189), (char *)curPlace); fade(true, 0); } else { - Drawn = g_lab->longDrawMessage((char *)curplace); + Drawn = _vm->longDrawMessage((char *)curPlace); } - curplace += Drawn; + curPlace += Drawn; - end = (*curplace == 0); + end = (*curPlace == 0); drawNextText = false; introEatMessages(); if (_quitIntro) { - if (isscreen) + if (isScreen) fade(false, 0); return; } - g_lab->getTime(&lastsecs, &lastmicros); + _vm->getTime(&lastSecs, &lastMicros); } - msg = g_lab->getMsg(); + msg = _vm->getMsg(); if (msg == NULL) { - g_lab->_music->updateMusic(); - g_lab->_anim->diffNextFrame(); - g_lab->getTime(&secs, µs); - g_lab->anyTimeDiff(lastsecs, lastmicros, secs, micros, &secs, µs); + _vm->_music->updateMusic(); + _vm->_anim->diffNextFrame(); + _vm->getTime(&secs, µs); + _vm->anyTimeDiff(lastSecs, lastMicros, secs, micros, &secs, µs); - if (secs > timedelay) { + if (secs > timeDelay) { if (end) { - if (isscreen) + if (isScreen) fade(false, 0); return; @@ -157,7 +155,7 @@ void Intro::doPictText(const char *filename, TextFont *msgFont, bool isscreen) { } } - g_lab->waitTOF(); + _vm->waitTOF(); } else { cls = msg->msgClass; qualifier = msg->qualifier; @@ -167,7 +165,7 @@ void Intro::doPictText(const char *filename, TextFont *msgFont, bool isscreen) { ((cls == RAWKEY) && (code == 27))) { _quitIntro = true; - if (isscreen) + if (isScreen) fade(false, 0); return; @@ -176,7 +174,7 @@ void Intro::doPictText(const char *filename, TextFont *msgFont, bool isscreen) { else if (cls == MOUSEBUTTONS) { if (IEQUALIFIER_LEFTBUTTON & qualifier) { if (end) { - if (isscreen) + if (isScreen) fade(false, 0); return; @@ -187,7 +185,7 @@ void Intro::doPictText(const char *filename, TextFont *msgFont, bool isscreen) { introEatMessages(); if (_quitIntro) { - if (isscreen) + if (isScreen) fade(false, 0); return; @@ -195,7 +193,7 @@ void Intro::doPictText(const char *filename, TextFont *msgFont, bool isscreen) { } if (end) { - if (isscreen) + if (isScreen) fade(false, 0); return; @@ -205,44 +203,37 @@ void Intro::doPictText(const char *filename, TextFont *msgFont, bool isscreen) { } } - - - - /*****************************************************************************/ /* Does a one second delay, but checks the music while doing it. */ /*****************************************************************************/ void Intro::musicDelay() { - g_lab->_music->updateMusic(); + _vm->_music->updateMusic(); if (_quitIntro) return; for (uint16 i = 0; i < 20; i++) { - g_lab->_music->updateMusic(); - g_lab->waitTOF(); - g_lab->waitTOF(); - g_lab->waitTOF(); + _vm->_music->updateMusic(); + _vm->waitTOF(); + _vm->waitTOF(); + _vm->waitTOF(); } } - - void Intro::nReadPict(const char *filename, bool playOnce) { Common::String finalFileName = Common::String("P:Intro/") + filename; - g_lab->_music->updateMusic(); + _vm->_music->updateMusic(); introEatMessages(); if (_quitIntro) return; - g_lab->_anim->_doBlack = _introDoBlack; - g_lab->_anim->stopDiffEnd(); + _vm->_anim->_doBlack = _introDoBlack; + _vm->_anim->stopDiffEnd(); readPict(finalFileName.c_str(), playOnce); } - /*****************************************************************************/ /* Does the introduction sequence for Labyrinth. */ /*****************************************************************************/ @@ -254,9 +245,9 @@ void Intro::introSequence() { 0x0CB3, 0x0DC4, 0x0DD6, 0x0EE7 }; - g_lab->_anim->_doBlack = true; + _vm->_anim->_doBlack = true; - if (g_lab->getPlatform() != Common::kPlatformWindows) { + if (_vm->getPlatform() != Common::kPlatformWindows) { nReadPict("EA0", true); nReadPict("EA1", true); nReadPict("EA2", true); @@ -274,14 +265,14 @@ void Intro::introSequence() { blackAllScreen(); - g_lab->_music->initMusic(); + _vm->_music->initMusic(); - g_lab->_anim->_noPalChange = true; - if (g_lab->getPlatform() != Common::kPlatformWindows) + _vm->_anim->_noPalChange = true; + if (_vm->getPlatform() != Common::kPlatformWindows) nReadPict("TNDcycle.pic", true); else nReadPict("TNDcycle2.pic", true); - g_lab->_anim->_noPalChange = false; + _vm->_anim->_noPalChange = false; FadePalette = palette; @@ -289,19 +280,19 @@ void Intro::introSequence() { if (_quitIntro) break; - palette[i] = ((g_lab->_anim->_diffPalette[i * 3] >> 2) << 8) + - ((g_lab->_anim->_diffPalette[i * 3 + 1] >> 2) << 4) + - (g_lab->_anim->_diffPalette[i * 3 + 2] >> 2); + palette[i] = ((_vm->_anim->_diffPalette[i * 3] >> 2) << 8) + + ((_vm->_anim->_diffPalette[i * 3 + 1] >> 2) << 4) + + (_vm->_anim->_diffPalette[i * 3 + 2] >> 2); } - g_lab->_music->updateMusic(); + _vm->_music->updateMusic(); fade(true, 0); for (int times = 0; times < 150; times++) { if (_quitIntro) break; - g_lab->_music->updateMusic(); + _vm->_music->updateMusic(); uint16 temp = palette[2]; for (uint16 i = 2; i < 15; i++) @@ -310,13 +301,13 @@ void Intro::introSequence() { palette[15] = temp; setAmigaPal(palette, 16); - g_lab->waitTOF(); + _vm->waitTOF(); } fade(false, 0); blackAllScreen(); - g_lab->_music->updateMusic(); + _vm->_music->updateMusic(); nReadPict("Title.A", true); nReadPict("AB", true); @@ -325,35 +316,35 @@ void Intro::introSequence() { nReadPict("AC", true); musicDelay(); - if (g_lab->getPlatform() == Common::kPlatformWindows) + if (_vm->getPlatform() == Common::kPlatformWindows) musicDelay(); // more credits on this page now nReadPict("CA", true); nReadPict("AD", true); musicDelay(); - if (g_lab->getPlatform() == Common::kPlatformWindows) + if (_vm->getPlatform() == Common::kPlatformWindows) musicDelay(); // more credits on this page now nReadPict("DA", true); musicDelay(); - g_lab->_music->newOpen("p:Intro/Intro.1"); /* load the picture into the buffer */ + _vm->_music->newOpen("p:Intro/Intro.1"); /* load the picture into the buffer */ - g_lab->_music->updateMusic(); + _vm->_music->updateMusic(); blackAllScreen(); - g_lab->_music->updateMusic(); + _vm->_music->updateMusic(); - TextFont *msgFont = g_lab->_resource->getFont("P:Map.fon"); + TextFont *msgFont = _vm->_resource->getFont("P:Map.fon"); - g_lab->_anim->_noPalChange = true; + _vm->_anim->_noPalChange = true; nReadPict("Intro.1", true); - g_lab->_anim->_noPalChange = false; + _vm->_anim->_noPalChange = false; for (uint16 i = 0; i < 16; i++) { - palette[i] = ((g_lab->_anim->_diffPalette[i * 3] >> 2) << 8) + - ((g_lab->_anim->_diffPalette[i * 3 + 1] >> 2) << 4) + - (g_lab->_anim->_diffPalette[i * 3 + 2] >> 2); + palette[i] = ((_vm->_anim->_diffPalette[i * 3] >> 2) << 8) + + ((_vm->_anim->_diffPalette[i * 3 + 1] >> 2) << 4) + + (_vm->_anim->_diffPalette[i * 3 + 2] >> 2); } doPictText("i.1", msgFont, true); @@ -363,7 +354,7 @@ void Intro::introSequence() { freeAllStolenMem(); blackAllScreen(); - g_lab->_music->updateMusic(); + _vm->_music->updateMusic(); _introDoBlack = true; nReadPict("Station1", true); @@ -393,13 +384,13 @@ void Intro::introSequence() { if (!_quitIntro) for (uint16 i = 0; i < 50; i++) { for (uint16 idx = (8 * 3); idx < (255 * 3); idx++) - g_lab->_anim->_diffPalette[idx] = 255 - g_lab->_anim->_diffPalette[idx]; + _vm->_anim->_diffPalette[idx] = 255 - _vm->_anim->_diffPalette[idx]; - g_lab->_music->updateMusic(); - g_lab->waitTOF(); - g_lab->setPalette(g_lab->_anim->_diffPalette, 256); - g_lab->waitTOF(); - g_lab->waitTOF(); + _vm->_music->updateMusic(); + _vm->waitTOF(); + _vm->setPalette(_vm->_anim->_diffPalette, 256); + _vm->waitTOF(); + _vm->waitTOF(); } doPictText("i.12", msgFont, false); @@ -436,7 +427,7 @@ void Intro::introSequence() { nReadPict("Daed7", false); doPictText("i.27", msgFont, false); doPictText("i.28", msgFont, false); - g_lab->_anim->stopDiffEnd(); + _vm->_anim->stopDiffEnd(); nReadPict("Daed8", true); doPictText("i.29", msgFont, false); @@ -456,9 +447,9 @@ void Intro::introSequence() { nReadPict("SubX", true); if (_quitIntro) { - g_lab->setAPen(0); - g_lab->rectFill(0, 0, g_lab->_screenWidth - 1, g_lab->_screenHeight - 1); - g_lab->_anim->_doBlack = true; + _vm->setAPen(0); + _vm->rectFill(0, 0, _vm->_screenWidth - 1, _vm->_screenHeight - 1); + _vm->_anim->_doBlack = true; } closeFont(msgFont); diff --git a/engines/lab/intro.h b/engines/lab/intro.h index 2979bcd334..47b61daeca 100644 --- a/engines/lab/intro.h +++ b/engines/lab/intro.h @@ -38,7 +38,7 @@ namespace Lab { class Intro { public: - Intro(); + Intro(LabEngine *vm); void introSequence(); private: @@ -47,6 +47,7 @@ private: void musicDelay(); void nReadPict(const char *Filename, bool PlayOnce); + LabEngine *_vm; bool _quitIntro, _introDoBlack; }; -- cgit v1.2.3 From 1d13083b29c3b4bd3e1423a4cbdc6dc32a50de22 Mon Sep 17 00:00:00 2001 From: Strangerke Date: Wed, 2 Dec 2015 23:23:44 +0100 Subject: LAB: Clean up includes in Intro --- engines/lab/intro.cpp | 4 ---- 1 file changed, 4 deletions(-) diff --git a/engines/lab/intro.cpp b/engines/lab/intro.cpp index b2835857fe..43cbed669b 100644 --- a/engines/lab/intro.cpp +++ b/engines/lab/intro.cpp @@ -30,11 +30,7 @@ #include "lab/lab.h" #include "lab/intro.h" -#include "lab/labfun.h" -#include "lab/resource.h" #include "lab/anim.h" -#include "lab/text.h" -#include "lab/interface.h" namespace Lab { extern uint16 *FadePalette; -- cgit v1.2.3 From 8fa64824a2dc1b5b2470f2ae4830f5573f5d01df Mon Sep 17 00:00:00 2001 From: Strangerke Date: Thu, 3 Dec 2015 01:06:04 +0100 Subject: LAB: Some renaming, move a couple of variables to game engine --- engines/lab/detection.cpp | 6 +- engines/lab/engine.cpp | 373 ++++++++++++++++++++------------------------ engines/lab/graphics.cpp | 9 +- engines/lab/interface.cpp | 14 +- engines/lab/interface.h | 2 +- engines/lab/lab.cpp | 14 ++ engines/lab/lab.h | 11 ++ engines/lab/labfun.h | 8 +- engines/lab/map.cpp | 12 +- engines/lab/mouse.cpp | 12 +- engines/lab/parsetypes.h | 2 - engines/lab/processroom.cpp | 18 +-- engines/lab/savegame.cpp | 14 +- engines/lab/special.cpp | 12 +- 14 files changed, 244 insertions(+), 263 deletions(-) diff --git a/engines/lab/detection.cpp b/engines/lab/detection.cpp index ddb6aa32a8..3b01d77568 100644 --- a/engines/lab/detection.cpp +++ b/engines/lab/detection.cpp @@ -194,7 +194,7 @@ SaveStateList LabMetaEngine::listSaves(const char *target) const { Common::InSaveFile *in = saveFileMan->openForLoading(file->c_str()); if (in) { if (Lab::readSaveGameHeader(in, header)) - saveList.push_back(SaveStateDescriptor(slotNum, header.desc.getDescription())); + saveList.push_back(SaveStateDescriptor(slotNum, header._descr.getDescription())); delete in; } } @@ -242,13 +242,13 @@ SaveStateDescriptor LabMetaEngine::querySaveMetaInfos(const char *target, int sl delete in; if (successfulRead) { - SaveStateDescriptor desc(slot, header.desc.getDescription()); + SaveStateDescriptor desc(slot, header._descr.getDescription()); // Do not allow save slot 0 (used for auto-saving) to be deleted or // overwritten. //desc.setDeletableFlag(slot != 0); //desc.setWriteProtectedFlag(slot == 0); - return header.desc; + return header._descr; } } diff --git a/engines/lab/engine.cpp b/engines/lab/engine.cpp index ba9e4921c9..fe3c4284df 100644 --- a/engines/lab/engine.cpp +++ b/engines/lab/engine.cpp @@ -41,8 +41,6 @@ namespace Lab { -const char *CurFileName = " "; - bool LongWinInFront = false; TextFont *MsgFont; @@ -56,10 +54,7 @@ extern InventoryData *Inventory; extern uint16 NumInv, ManyRooms, HighestCondition, Direction; CloseDataPtr CPtr; -bool Alternate = false, ispal = false, noupdatediff = false, MainDisplay = true, QuitLab = false; - -extern const char *NewFileName; /* When ProcessRoom.c decides to change the filename - of the current picture. */ +bool ispal = false, noupdatediff = false, MainDisplay = true, QuitLab = false; #define BUFFERSIZE 850000L @@ -100,11 +95,6 @@ extern const char *NewFileName; /* When ProcessRoom.c decides to change the fil #define TERMINALMONITOR 81 #define LEVERSMONITOR 82 - -static Image *MoveImages[20], *InvImages[10]; -static Gadget *MoveGadgetList, *InvGadgetList; - - static char initcolors[] = { '\x00', '\x00', '\x00', '\x30', '\x30', '\x30', '\x10', '\x10', '\x10', '\x14', '\x14', '\x14', @@ -112,9 +102,6 @@ static char initcolors[] = { '\x00', '\x00', '\x00', '\x30', '\x24', '\x24', '\x2c', '\x2c', '\x2c', '\x08', '\x08', '\x08'}; - - - /******************************************************************************/ /* Draws the control panel display. */ /******************************************************************************/ @@ -133,10 +120,10 @@ void LabEngine::drawPanel() { setAPen(0); drawHLine(0, VGAScaleY(170), VGAScaleX(319)); /* First black line to separate buttons */ - if (!Alternate) { + if (!_alternate) { setAPen(4); drawHLine(0, VGAScaleY(170) + 1, VGAScaleX(319)); /* The horizontal lines under the black one */ - drawGadgetList(MoveGadgetList); + drawGadgetList(_moveGadgetList); } else { if (getPlatform() != Common::kPlatformWindows) { drawVLine(VGAScaleX(124), VGAScaleY(170) + 1, VGAScaleY(199)); /* Vertical Black lines */ @@ -162,7 +149,7 @@ void LabEngine::drawPanel() { drawVLine(VGAScaleX(232), VGAScaleY(170) + 2, VGAScaleY(198)); } - drawGadgetList(InvGadgetList); + drawGadgetList(_invGadgetList); } _event->mouseShow(); @@ -171,38 +158,32 @@ void LabEngine::drawPanel() { /******************************************************************************/ /* Draws the message for the room. */ /******************************************************************************/ -void LabEngine::drawRoomMessage(uint16 CurInv, CloseDataPtr cptr) { +void LabEngine::drawRoomMessage(uint16 curInv, CloseDataPtr closePtr) { if (_lastTooLong) { _lastTooLong = false; return; } - if (Alternate) { - if ((CurInv <= NumInv) && _conditions->in(CurInv) && Inventory[CurInv].BInvName) { - if ((CurInv == LAMPNUM) && _conditions->in(LAMPON)) /* LAB: Labyrith specific */ + if (_alternate) { + if ((curInv <= NumInv) && _conditions->in(curInv) && Inventory[curInv].BInvName) { + if ((curInv == LAMPNUM) && _conditions->in(LAMPON)) /* LAB: Labyrinth specific */ drawStaticMessage(kTextLampOn); - else if (Inventory[CurInv].Many > 1) { - Common::String roomMessage = Common::String(Inventory[CurInv].name) + " (" + Common::String::format("%d", Inventory[CurInv].Many) + ")"; + else if (Inventory[curInv].Many > 1) { + Common::String roomMessage = Common::String(Inventory[curInv].name) + " (" + Common::String::format("%d", Inventory[curInv].Many) + ")"; drawMessage(roomMessage.c_str()); } else - drawMessage(Inventory[CurInv].name); + drawMessage(Inventory[curInv].name); } } else - drawDirection(cptr); + drawDirection(closePtr); _lastTooLong = _lastMessageLong; } - /******************************************************************************/ /* Sets up the Labyrinth screens, and opens up the initial windows. */ /******************************************************************************/ bool LabEngine::setUpScreens() { - byte *buffer; - byte *MovePanelBuffer, *InvPanelBuffer; - Gadget *curgad; - uint16 y; - if (!createScreen(_isHiRes)) return false; @@ -215,60 +196,61 @@ bool LabEngine::setUpScreens() { if (file.err() || file.size() == 0) return false; - if (!(MovePanelBuffer = (byte *)calloc(file.size(), 1))) + byte *movePanelBuffer; + if (!(movePanelBuffer = (byte *)calloc(file.size(), 1))) return false; - file.read(MovePanelBuffer, file.size()); + file.read(movePanelBuffer, file.size()); file.close(); - buffer = MovePanelBuffer; + byte *buffer = movePanelBuffer; for (uint16 i = 0; i < 20; i++) - MoveImages[i] = new Image(&buffer); + _moveImages[i] = new Image(&buffer); /* Creates the gadgets for the movement control panel */ - y = VGAScaleY(173) - SVGACord(2); + uint16 y = VGAScaleY(173) - SVGACord(2); if (getPlatform() == Common::kPlatformWindows) { - MoveGadgetList = createButton(1, y, 0, 't', MoveImages[0], MoveImages[1]); - curgad = MoveGadgetList; - curgad->NextGadget = createButton(33, y, 1, 'm', MoveImages[2], MoveImages[3]); - curgad = curgad->NextGadget; - curgad->NextGadget = createButton(65, y, 2, 'o', MoveImages[4], MoveImages[5]); - curgad = curgad->NextGadget; - curgad->NextGadget = createButton(97, y, 3, 'c', MoveImages[6], MoveImages[7]); - curgad = curgad->NextGadget; - curgad->NextGadget = createButton(129, y, 4, 'l', MoveImages[8], MoveImages[9]); - curgad = curgad->NextGadget; - curgad->NextGadget = createButton(161, y, 5, 'i', MoveImages[12], MoveImages[13]); - curgad = curgad->NextGadget; - curgad->NextGadget = createButton(193, y, 6, VKEY_LTARROW, MoveImages[14], MoveImages[15]); - curgad = curgad->NextGadget; - curgad->NextGadget = createButton(225, y, 7, VKEY_UPARROW, MoveImages[16], MoveImages[17]); - curgad = curgad->NextGadget; - curgad->NextGadget = createButton(257, y, 8, VKEY_RTARROW, MoveImages[18], MoveImages[19]); - curgad = curgad->NextGadget; - curgad->NextGadget = createButton(289, y, 9, 'p', MoveImages[10], MoveImages[11]); + _moveGadgetList = createButton(1, y, 0, 't', _moveImages[0], _moveImages[1]); + Gadget *curGadget = _moveGadgetList; + curGadget->NextGadget = createButton(33, y, 1, 'm', _moveImages[2], _moveImages[3]); + curGadget = curGadget->NextGadget; + curGadget->NextGadget = createButton(65, y, 2, 'o', _moveImages[4], _moveImages[5]); + curGadget = curGadget->NextGadget; + curGadget->NextGadget = createButton(97, y, 3, 'c', _moveImages[6], _moveImages[7]); + curGadget = curGadget->NextGadget; + curGadget->NextGadget = createButton(129, y, 4, 'l', _moveImages[8], _moveImages[9]); + curGadget = curGadget->NextGadget; + curGadget->NextGadget = createButton(161, y, 5, 'i', _moveImages[12], _moveImages[13]); + curGadget = curGadget->NextGadget; + curGadget->NextGadget = createButton(193, y, 6, VKEY_LTARROW, _moveImages[14], _moveImages[15]); + curGadget = curGadget->NextGadget; + curGadget->NextGadget = createButton(225, y, 7, VKEY_UPARROW, _moveImages[16], _moveImages[17]); + curGadget = curGadget->NextGadget; + curGadget->NextGadget = createButton(257, y, 8, VKEY_RTARROW, _moveImages[18], _moveImages[19]); + curGadget = curGadget->NextGadget; + curGadget->NextGadget = createButton(289, y, 9, 'p', _moveImages[10], _moveImages[11]); } else { - MoveGadgetList = createButton(1, y, 0, 0, MoveImages[0], MoveImages[1]); - curgad = MoveGadgetList; - curgad->NextGadget = createButton(33, y, 1, 0, MoveImages[2], MoveImages[3]); - curgad = curgad->NextGadget; - curgad->NextGadget = createButton(65, y, 2, 0, MoveImages[4], MoveImages[5]); - curgad = curgad->NextGadget; - curgad->NextGadget = createButton(97, y, 3, 0, MoveImages[6], MoveImages[7]); - curgad = curgad->NextGadget; - curgad->NextGadget = createButton(129, y, 4, 0, MoveImages[8], MoveImages[9]); - curgad = curgad->NextGadget; - curgad->NextGadget = createButton(161, y, 5, 0, MoveImages[12], MoveImages[13]); - curgad = curgad->NextGadget; - curgad->NextGadget = createButton(193, y, 6, 0, MoveImages[14], MoveImages[15]); - curgad = curgad->NextGadget; - curgad->NextGadget = createButton(225, y, 7, 0, MoveImages[16], MoveImages[17]); - curgad = curgad->NextGadget; - curgad->NextGadget = createButton(257, y, 8, 0, MoveImages[18], MoveImages[19]); - curgad = curgad->NextGadget; - curgad->NextGadget = createButton(289, y, 9, 0, MoveImages[10], MoveImages[11]); + _moveGadgetList = createButton(1, y, 0, 0, _moveImages[0], _moveImages[1]); + Gadget *curGadget = _moveGadgetList; + curGadget->NextGadget = createButton(33, y, 1, 0, _moveImages[2], _moveImages[3]); + curGadget = curGadget->NextGadget; + curGadget->NextGadget = createButton(65, y, 2, 0, _moveImages[4], _moveImages[5]); + curGadget = curGadget->NextGadget; + curGadget->NextGadget = createButton(97, y, 3, 0, _moveImages[6], _moveImages[7]); + curGadget = curGadget->NextGadget; + curGadget->NextGadget = createButton(129, y, 4, 0, _moveImages[8], _moveImages[9]); + curGadget = curGadget->NextGadget; + curGadget->NextGadget = createButton(161, y, 5, 0, _moveImages[12], _moveImages[13]); + curGadget = curGadget->NextGadget; + curGadget->NextGadget = createButton(193, y, 6, 0, _moveImages[14], _moveImages[15]); + curGadget = curGadget->NextGadget; + curGadget->NextGadget = createButton(225, y, 7, 0, _moveImages[16], _moveImages[17]); + curGadget = curGadget->NextGadget; + curGadget->NextGadget = createButton(257, y, 8, 0, _moveImages[18], _moveImages[19]); + curGadget = curGadget->NextGadget; + curGadget->NextGadget = createButton(289, y, 9, 0, _moveImages[10], _moveImages[11]); } file.open(translateFileName("P:Inv")); @@ -278,95 +260,89 @@ bool LabEngine::setUpScreens() { if (file.err() || file.size() == 0) return false; - if (!(InvPanelBuffer = (byte *)calloc(file.size(), 1))) + byte *invPanelBuffer; + if (!(invPanelBuffer = (byte *)calloc(file.size(), 1))) return false; - file.read(InvPanelBuffer, file.size()); + file.read(invPanelBuffer, file.size()); file.close(); - buffer = InvPanelBuffer; + buffer = invPanelBuffer; if (getPlatform() == Common::kPlatformWindows) { for (uint16 imgIdx = 0; imgIdx < 10; imgIdx++) - InvImages[imgIdx] = new Image(&buffer); - - InvGadgetList = createButton(24, y, 0, 'm', InvImages[0], InvImages[1]); - curgad = InvGadgetList; - curgad->NextGadget = createButton(56, y, 1, 'g', InvImages[2], InvImages[3]); - curgad = curgad->NextGadget; - curgad->NextGadget = createButton(94, y, 2, 'u', InvImages[4], InvImages[5]); - curgad = curgad->NextGadget; - curgad->NextGadget = createButton(126, y, 3, 'l', MoveImages[8], MoveImages[9]); - curgad = curgad->NextGadget; - curgad->NextGadget = createButton(164, y, 4, VKEY_LTARROW, MoveImages[14], MoveImages[15]); - curgad = curgad->NextGadget; - curgad->NextGadget = createButton(196, y, 5, VKEY_RTARROW, MoveImages[18], MoveImages[19]); - curgad = curgad->NextGadget; - curgad->NextGadget = createButton(234, y, 6, 'b', InvImages[6], InvImages[7]); - curgad = curgad->NextGadget; - curgad->NextGadget = createButton(266, y, 7, 'f', InvImages[8], InvImages[9]); - curgad = curgad->NextGadget; + _invImages[imgIdx] = new Image(&buffer); + + _invGadgetList = createButton(24, y, 0, 'm', _invImages[0], _invImages[1]); + Gadget *curGadget = _invGadgetList; + curGadget->NextGadget = createButton(56, y, 1, 'g', _invImages[2], _invImages[3]); + curGadget = curGadget->NextGadget; + curGadget->NextGadget = createButton(94, y, 2, 'u', _invImages[4], _invImages[5]); + curGadget = curGadget->NextGadget; + curGadget->NextGadget = createButton(126, y, 3, 'l', _moveImages[8], _moveImages[9]); + curGadget = curGadget->NextGadget; + curGadget->NextGadget = createButton(164, y, 4, VKEY_LTARROW, _moveImages[14], _moveImages[15]); + curGadget = curGadget->NextGadget; + curGadget->NextGadget = createButton(196, y, 5, VKEY_RTARROW, _moveImages[18], _moveImages[19]); + curGadget = curGadget->NextGadget; + curGadget->NextGadget = createButton(234, y, 6, 'b', _invImages[6], _invImages[7]); + curGadget = curGadget->NextGadget; + curGadget->NextGadget = createButton(266, y, 7, 'f', _invImages[8], _invImages[9]); + curGadget = curGadget->NextGadget; } else { for (uint16 imgIdx = 0; imgIdx < 6; imgIdx++) - InvImages[imgIdx] = new Image(&buffer); - - InvGadgetList = createButton(58, y, 0, 0, InvImages[0], InvImages[1]); - curgad = InvGadgetList; - curgad->NextGadget = createButton(90, y, 1, 0, InvImages[2], InvImages[3]); - curgad = curgad->NextGadget; - curgad->NextGadget = createButton(128, y, 2, 0, InvImages[4], InvImages[5]); - curgad = curgad->NextGadget; - curgad->NextGadget = createButton(160, y, 3, 0, MoveImages[8], MoveImages[9]); - curgad = curgad->NextGadget; - curgad->NextGadget = createButton(198, y, 4, 0, MoveImages[14], MoveImages[15]); - curgad = curgad->NextGadget; - curgad->NextGadget = createButton(230, y, 5, 0, MoveImages[18], MoveImages[19]); - curgad = curgad->NextGadget; + _invImages[imgIdx] = new Image(&buffer); + + _invGadgetList = createButton(58, y, 0, 0, _invImages[0], _invImages[1]); + Gadget *curGadget = _invGadgetList; + curGadget->NextGadget = createButton(90, y, 1, 0, _invImages[2], _invImages[3]); + curGadget = curGadget->NextGadget; + curGadget->NextGadget = createButton(128, y, 2, 0, _invImages[4], _invImages[5]); + curGadget = curGadget->NextGadget; + curGadget->NextGadget = createButton(160, y, 3, 0, _moveImages[8], _moveImages[9]); + curGadget = curGadget->NextGadget; + curGadget->NextGadget = createButton(198, y, 4, 0, _moveImages[14], _moveImages[15]); + curGadget = curGadget->NextGadget; + curGadget->NextGadget = createButton(230, y, 5, 0, _moveImages[18], _moveImages[19]); + curGadget = curGadget->NextGadget; } return true; } - - /******************************************************************************/ -/* Permanently flips the imagry of a gadget. */ +/* Permanently flips the imagery of a gadget. */ /******************************************************************************/ -void LabEngine::perFlipGadget(uint16 GadID) { - Image *Temp; - Gadget *TopGad; - - TopGad = MoveGadgetList; +void LabEngine::perFlipGadget(uint16 gadgetId) { + Gadget *topGadget = _moveGadgetList; - while (TopGad) { - if (TopGad->GadgetID == GadID) { - Temp = TopGad->Im; - TopGad->Im = TopGad->ImAlt; - TopGad->ImAlt = Temp; + while (topGadget) { + if (topGadget->GadgetID == gadgetId) { + Image *tmpImage = topGadget->_image; + topGadget->_image = topGadget->_altImage; + topGadget->_altImage = tmpImage; - if (!Alternate) { + if (!_alternate) { _event->mouseHide(); - TopGad->Im->drawImage(TopGad->x, TopGad->y); + topGadget->_image->drawImage(topGadget->x, topGadget->y); _event->mouseShow(); } return; } else - TopGad = TopGad->NextGadget; + topGadget = topGadget->NextGadget; } } - - /******************************************************************************/ /* Eats all the available messages. */ /******************************************************************************/ void LabEngine::eatMessages() { - IntuiMessage *Msg; + IntuiMessage *msg; do { - Msg = getMsg(); - } while (Msg); + msg = getMsg(); + } while (msg); return; } @@ -374,8 +350,8 @@ void LabEngine::eatMessages() { /******************************************************************************/ /* Checks whether the close up is one of the special case closeups. */ /******************************************************************************/ -bool LabEngine::doCloseUp(CloseDataPtr cptr) { - if (cptr == NULL) +bool LabEngine::doCloseUp(CloseDataPtr closePtr) { + if (closePtr == NULL) return false; int monltmargin, monrtmargin, montopmargin, lutertmargin; @@ -392,46 +368,43 @@ bool LabEngine::doCloseUp(CloseDataPtr cptr) { lutertmargin = 128; } - switch (cptr->CloseUpType) { + switch (closePtr->CloseUpType) { case MUSEUMMONITOR: case LIBRARYMONITOR: case WINDOWMONITOR: - doMonitor(cptr->GraphicName, cptr->Message, false, monltmargin, montopmargin, monrtmargin, 165); + doMonitor(closePtr->GraphicName, closePtr->Message, false, monltmargin, montopmargin, monrtmargin, 165); break; case GRAMAPHONEMONITOR: - doMonitor(cptr->GraphicName, cptr->Message, false, monltmargin, montopmargin, 171, 165); + doMonitor(closePtr->GraphicName, closePtr->Message, false, monltmargin, montopmargin, 171, 165); break; case UNICYCLEMONITOR: - doMonitor(cptr->GraphicName, cptr->Message, false, 100, montopmargin, monrtmargin, 165); + doMonitor(closePtr->GraphicName, closePtr->Message, false, 100, montopmargin, monrtmargin, 165); break; case STATUEMONITOR: - doMonitor(cptr->GraphicName, cptr->Message, false, 117, montopmargin, monrtmargin, 165); + doMonitor(closePtr->GraphicName, closePtr->Message, false, 117, montopmargin, monrtmargin, 165); break; case TALISMANMONITOR: - doMonitor(cptr->GraphicName, cptr->Message, false, monltmargin, montopmargin, 184, 165); + doMonitor(closePtr->GraphicName, closePtr->Message, false, monltmargin, montopmargin, 184, 165); break; case LUTEMONITOR: - doMonitor(cptr->GraphicName, cptr->Message, false, monltmargin, montopmargin, lutertmargin, 165); + doMonitor(closePtr->GraphicName, closePtr->Message, false, monltmargin, montopmargin, lutertmargin, 165); break; case CLOCKMONITOR: - doMonitor(cptr->GraphicName, cptr->Message, false, monltmargin, montopmargin, 206, 165); + doMonitor(closePtr->GraphicName, closePtr->Message, false, monltmargin, montopmargin, 206, 165); break; case TERMINALMONITOR: - doMonitor(cptr->GraphicName, cptr->Message, true, monltmargin, montopmargin, monrtmargin, 165); + doMonitor(closePtr->GraphicName, closePtr->Message, true, monltmargin, montopmargin, monrtmargin, 165); break; default: return false; } - CurFileName = " "; + _curFileName = " "; drawPanel(); return true; } - - - /******************************************************************************/ /* Gets the current inventory name. */ /******************************************************************************/ @@ -442,21 +415,19 @@ static const char *getInvName(uint16 CurInv) { if ((CurInv == LAMPNUM) && g_lab->_conditions->in(LAMPON)) return "P:Mines/120"; - else if ((CurInv == BELTNUM) && g_lab->_conditions->in(BELTGLOW)) + if ((CurInv == BELTNUM) && g_lab->_conditions->in(BELTGLOW)) return "P:Future/BeltGlow"; - else if (CurInv == WESTPAPERNUM) { - CurFileName = Inventory[CurInv].BInvName; + if (CurInv == WESTPAPERNUM) { + g_lab->_curFileName = Inventory[CurInv].BInvName; g_lab->_anim->_noPalChange = true; - readPict(CurFileName, false); + readPict(g_lab->_curFileName, false); g_lab->_anim->_noPalChange = false; doWestPaper(); - } - - else if (CurInv == NOTESNUM) { - CurFileName = Inventory[CurInv].BInvName; + } else if (CurInv == NOTESNUM) { + g_lab->_curFileName = Inventory[CurInv].BInvName; g_lab->_anim->_noPalChange = true; - readPict(CurFileName, false); + readPict(g_lab->_curFileName, false); g_lab->_anim->_noPalChange = false; doNotes(); } @@ -464,16 +435,14 @@ static const char *getInvName(uint16 CurInv) { return Inventory[CurInv].BInvName; } -static bool interfaceisoff = false; - /******************************************************************************/ /* Turns the interface off. */ /******************************************************************************/ void LabEngine::interfaceOff() { - if (!interfaceisoff) { + if (!_interfaceOff) { _event->attachGadgetList(NULL); _event->mouseHide(); - interfaceisoff = true; + _interfaceOff = true; } } @@ -481,22 +450,19 @@ void LabEngine::interfaceOff() { /* Turns the interface on. */ /******************************************************************************/ void LabEngine::interfaceOn() { - if (interfaceisoff) { - interfaceisoff = false; - + if (_interfaceOff) { + _interfaceOff = false; _event->mouseShow(); } if (LongWinInFront) _event->attachGadgetList(NULL); - else if (Alternate) - _event->attachGadgetList(InvGadgetList); + else if (_alternate) + _event->attachGadgetList(_invGadgetList); else - _event->attachGadgetList(MoveGadgetList); + _event->attachGadgetList(_moveGadgetList); } -static const char *Test; - /******************************************************************************/ /* If the user hits the "Use" gadget; things that can get used on themselves. */ /******************************************************************************/ @@ -505,7 +471,7 @@ bool LabEngine::doUse(uint16 CurInv) { drawStaticMessage(kTextUseMap); interfaceOff(); _anim->stopDiff(); - CurFileName = " "; + _curFileName = " "; CPtr = NULL; doMap(_roomNum); setPalette(initcolors, 8); @@ -515,7 +481,7 @@ bool LabEngine::doUse(uint16 CurInv) { drawStaticMessage(kTextUseJournal); interfaceOff(); _anim->stopDiff(); - CurFileName = " "; + _curFileName = " "; CPtr = NULL; doJournal(); drawPanel(); @@ -537,13 +503,13 @@ bool LabEngine::doUse(uint16 CurInv) { _anim->_waitForEffect = false; _anim->_doBlack = false; - Test = getInvName(CurInv); + _nextFileName = getInvName(CurInv); } else if (CurInv == BELTNUM) { /* LAB: Labyrinth specific */ if (!_conditions->in(BELTGLOW)) _conditions->inclElement(BELTGLOW); _anim->_doBlack = false; - Test = getInvName(CurInv); + _nextFileName = getInvName(CurInv); } else if (CurInv == WHISKEYNUM) { /* LAB: Labyrinth specific */ _conditions->inclElement(USEDHELMET); drawStaticMessage(kTextUseWhiskey); @@ -559,9 +525,6 @@ bool LabEngine::doUse(uint16 CurInv) { return true; } - - - /******************************************************************************/ /* Decrements the current inventory number. */ /******************************************************************************/ @@ -575,7 +538,7 @@ void LabEngine::decIncInv(uint16 *CurInv, bool dec) { while (*CurInv && (*CurInv <= NumInv)) { if (_conditions->in(*CurInv) && Inventory[*CurInv].BInvName) { - Test = getInvName(*CurInv); + _nextFileName = getInvName(*CurInv); break; } @@ -593,7 +556,7 @@ void LabEngine::decIncInv(uint16 *CurInv, bool dec) { while (*CurInv && (*CurInv <= NumInv)) { if (_conditions->in(*CurInv) && Inventory[*CurInv].BInvName) { - Test = getInvName(*CurInv); + _nextFileName = getInvName(*CurInv); break; } @@ -660,32 +623,30 @@ void LabEngine::mainGameLoop() { /* Sets the current picture properly on the screen */ if (MainDisplay) - Test = getPictName(&CPtr); + _nextFileName = getPictName(&CPtr); if (noupdatediff) { _roomsFound->inclElement(_roomNum); /* Potentially entered another room */ - forceDraw = (strcmp(Test, CurFileName) != 0) || forceDraw; + forceDraw |= (strcmp(_nextFileName, _curFileName) != 0); noupdatediff = false; - CurFileName = Test; - } - - else if (strcmp(Test, CurFileName) != 0) { + _curFileName = _nextFileName; + } else if (strcmp(_nextFileName, _curFileName) != 0) { interfaceOff(); _roomsFound->inclElement(_roomNum); /* Potentially entered another room */ - CurFileName = Test; + _curFileName = _nextFileName; if (CPtr) { if ((CPtr->CloseUpType == SPECIALLOCK) && MainDisplay) /* LAB: Labyrinth specific code */ - showCombination(CurFileName); + showCombination(_curFileName); else if (((CPtr->CloseUpType == SPECIALBRICK) || (CPtr->CloseUpType == SPECIALBRICKNOMOUSE)) && MainDisplay) /* LAB: Labyrinth specific code */ - showTile(CurFileName, (bool)(CPtr->CloseUpType == SPECIALBRICKNOMOUSE)); + showTile(_curFileName, (bool)(CPtr->CloseUpType == SPECIALBRICKNOMOUSE)); else - readPict(CurFileName, false); + readPict(_curFileName, false); } else - readPict(CurFileName, false); + readPict(_curFileName, false); drawRoomMessage(curInv, CPtr); forceDraw = false; @@ -806,9 +767,9 @@ bool LabEngine::from_crumbs(uint32 tmpClass, uint16 code, uint16 Qualifier, Comm _isCrumbWaiting = false; getTime(&_crumbSecs, &_crumbMicros); - if (Alternate) { + if (_alternate) { eatMessages(); - Alternate = false; + _alternate = false; _anim->_doBlack = true; DoNotDrawMessage = false; @@ -883,7 +844,7 @@ bool LabEngine::from_crumbs(uint32 tmpClass, uint16 code, uint16 Qualifier, Comm drawRoomMessage(curInv, CPtr); screenUpdate(); } - } else if ((msgClass == GADGETUP) && !Alternate) { + } else if ((msgClass == GADGETUP) && !_alternate) { if (gadgetId <= 5) { if ((actionMode == 4) && (gadgetId == 4) && (CPtr != NULL)) { doMainView(&CPtr); @@ -896,7 +857,7 @@ bool LabEngine::from_crumbs(uint32 tmpClass, uint16 code, uint16 Qualifier, Comm } else if (gadgetId == 5) { eatMessages(); - Alternate = true; + _alternate = true; _anim->_doBlack = true; DoNotDrawMessage = false; interfaceOn(); /* Sets the correct gadget list */ @@ -905,7 +866,7 @@ bool LabEngine::from_crumbs(uint32 tmpClass, uint16 code, uint16 Qualifier, Comm if (LastInv && _conditions->in(LastInv)) { curInv = LastInv; - Test = getInvName(curInv); + _nextFileName = getInvName(curInv); } else decIncInv(&curInv, false); @@ -951,7 +912,7 @@ bool LabEngine::from_crumbs(uint32 tmpClass, uint16 code, uint16 Qualifier, Comm else drawStaticMessage(kTextTurnRight); - CurFileName = " "; + _curFileName = " "; OldDirection = Direction; @@ -977,7 +938,7 @@ bool LabEngine::from_crumbs(uint32 tmpClass, uint16 code, uint16 Qualifier, Comm if (OldRoomNum != _roomNum) { drawStaticMessage(kTextGoForward); _roomsFound->inclElement(_roomNum); /* Potentially entered a new room */ - CurFileName = " "; + _curFileName = " "; forceDraw = true; } else { _anim->_doBlack = true; @@ -1030,12 +991,12 @@ bool LabEngine::from_crumbs(uint32 tmpClass, uint16 code, uint16 Qualifier, Comm screenUpdate(); } } - } else if ((msgClass == GADGETUP) && Alternate) { + } else if ((msgClass == GADGETUP) && _alternate) { _anim->_doBlack = true; if (gadgetId == 0) { eatMessages(); - Alternate = false; + _alternate = false; _anim->_doBlack = true; DoNotDrawMessage = false; @@ -1052,7 +1013,7 @@ bool LabEngine::from_crumbs(uint32 tmpClass, uint16 code, uint16 Qualifier, Comm if (gadgetId == 0) { interfaceOff(); _anim->stopDiff(); - CurFileName = " "; + _curFileName = " "; doit = !saveRestoreGame(); CPtr = NULL; @@ -1062,7 +1023,7 @@ bool LabEngine::from_crumbs(uint32 tmpClass, uint16 code, uint16 Qualifier, Comm curInv = MAPNUM; LastInv = MAPNUM; - Test = getInvName(curInv); + _nextFileName = getInvName(curInv); drawPanel(); @@ -1101,7 +1062,7 @@ bool LabEngine::from_crumbs(uint32 tmpClass, uint16 code, uint16 Qualifier, Comm if ((curInv <= NumInv) && _conditions->in(curInv) && Inventory[curInv].BInvName) - Test = getInvName(curInv); + _nextFileName = getInvName(curInv); screenUpdate(); } else if (gadgetId == 3) { /* Left gadget */ @@ -1134,7 +1095,7 @@ bool LabEngine::from_crumbs(uint32 tmpClass, uint16 code, uint16 Qualifier, Comm getTime(&_crumbSecs, &_crumbMicros); eatMessages(); - Alternate = false; + _alternate = false; _anim->_doBlack = true; DoNotDrawMessage = false; @@ -1176,20 +1137,20 @@ bool LabEngine::from_crumbs(uint32 tmpClass, uint16 code, uint16 Qualifier, Comm if (actionMode == 0) { /* Take something. */ if (doActionRule(Common::Point(curPos.x, curPos.y), actionMode, _roomNum, &CPtr)) - CurFileName = NewFileName; + _curFileName = _newFileName; else if (takeItem(curPos.x, curPos.y, &CPtr)) drawStaticMessage(kTextTakeItem); else if (doActionRule(curPos, TAKEDEF - 1, _roomNum, &CPtr)) - CurFileName = NewFileName; + _curFileName = _newFileName; else if (doActionRule(curPos, TAKE - 1, 0, &CPtr)) - CurFileName = NewFileName; + _curFileName = _newFileName; else if (curPos.y < (VGAScaleY(149) + SVGACord(2))) drawStaticMessage(kTextNothing); } else if ((actionMode == 1) /* Manipulate an object */ || (actionMode == 2) /* Open up a "door" */ || (actionMode == 3)) { /* Close a "door" */ if (doActionRule(curPos, actionMode, _roomNum, &CPtr)) - CurFileName = NewFileName; + _curFileName = _newFileName; else if (!doActionRule(curPos, actionMode, 0, &CPtr)) { if (curPos.y < (VGAScaleY(149) + SVGACord(2))) drawStaticMessage(kTextNothing); @@ -1212,7 +1173,7 @@ bool LabEngine::from_crumbs(uint32 tmpClass, uint16 code, uint16 Qualifier, Comm } else if ((actionMode == 5) && _conditions->in(curInv)) { /* Use an item on something else */ if (doOperateRule(curPos.x, curPos.y, curInv, &CPtr)) { - CurFileName = NewFileName; + _curFileName = _newFileName; if (!_conditions->in(curInv)) decIncInv(&curInv, false); @@ -1253,13 +1214,13 @@ bool LabEngine::from_crumbs(uint32 tmpClass, uint16 code, uint16 Qualifier, Comm _event->setMousePos(Common::Point(scaleX((HCPtr->x1 + HCPtr->x2) / 2), scaleY((HCPtr->y1 + HCPtr->y2) / 2))); } else if ((msgClass == MOUSEBUTTONS) && (IEQUALIFIER_RBUTTON & Qualifier)) { eatMessages(); - Alternate = !Alternate; + _alternate = !_alternate; _anim->_doBlack = true; DoNotDrawMessage = false; MainDisplay = true; interfaceOn(); /* Sets the correct gadget list */ - if (Alternate) { + if (_alternate) { if (LastInv && _conditions->in(LastInv)) curInv = LastInv; else diff --git a/engines/lab/graphics.cpp b/engines/lab/graphics.cpp index 54a4f352c2..975f054fe1 100644 --- a/engines/lab/graphics.cpp +++ b/engines/lab/graphics.cpp @@ -44,7 +44,6 @@ BitMap bit1, bit2, *DispBitMap = &bit1, *DrawBitMap = &bit1; extern bool stopsound; extern TextFont *MsgFont; -extern const char *CurFileName; /*---------------------------------------------------------------------------*/ /*------ From readPict.c. Reads in pictures and animations from disk. ------*/ @@ -613,13 +612,13 @@ void LabEngine::doTransWipe(CloseDataPtr *cPtr, char *filename) { } if (filename == NULL) - CurFileName = getPictName(cPtr); + g_lab->_curFileName = getPictName(cPtr); else if (filename[0] > ' ') - CurFileName = filename; + g_lab->_curFileName = filename; else - CurFileName = getPictName(cPtr); + g_lab->_curFileName = getPictName(cPtr); - byte *BitMapMem = readPictToMem(CurFileName, _screenWidth, lastY + 5); + byte *BitMapMem = readPictToMem(g_lab->_curFileName, _screenWidth, lastY + 5); setPalette(_anim->_diffPalette, 256); if (BitMapMem) { diff --git a/engines/lab/interface.cpp b/engines/lab/interface.cpp index dff74be5e0..d9df22a9b1 100644 --- a/engines/lab/interface.cpp +++ b/engines/lab/interface.cpp @@ -51,8 +51,8 @@ Gadget *createButton(uint16 x, uint16 y, uint16 id, uint16 key, Image *im, Image gptr->y = y; gptr->GadgetID = id; gptr->KeyEquiv = key; - gptr->Im = im; - gptr->ImAlt = imalt; + gptr->_image = im; + gptr->_altImage = imalt; gptr->NextGadget = NULL; return gptr; @@ -82,7 +82,7 @@ void freeButtonList(Gadget *gptrlist) { /*****************************************************************************/ void drawGadgetList(Gadget *gadlist) { while (gadlist) { - gadlist->Im->drawImage(gadlist->x, gadlist->y); + gadlist->_image->drawImage(gadlist->x, gadlist->y); if (GADGETOFF & gadlist->GadgetFlags) ghoastGadget(gadlist, 1); @@ -96,7 +96,7 @@ void drawGadgetList(Gadget *gadlist) { /* Ghoasts a gadget, and makes it unavailable for using. */ /*****************************************************************************/ void ghoastGadget(Gadget *curgad, uint16 pencolor) { - g_lab->ghoastRect(pencolor, curgad->x, curgad->y, curgad->x + curgad->Im->Width - 1, curgad->y + curgad->Im->Height - 1); + g_lab->ghoastRect(pencolor, curgad->x, curgad->y, curgad->x + curgad->_image->Width - 1, curgad->y + curgad->_image->Height - 1); curgad->GadgetFlags |= GADGETOFF; } @@ -106,7 +106,7 @@ void ghoastGadget(Gadget *curgad, uint16 pencolor) { /* Unghoasts a gadget, and makes it available again. */ /*****************************************************************************/ void unGhoastGadget(Gadget *curgad) { - curgad->Im->drawImage(curgad->x, curgad->y); + curgad->_image->drawImage(curgad->x, curgad->y); curgad->GadgetFlags &= !(GADGETOFF); } @@ -133,11 +133,11 @@ Gadget *LabEngine::checkNumGadgetHit(Gadget *gadlist, uint16 key) { (gadlist->KeyEquiv != 0 && makeGadgetKeyEquiv(key) == gadlist->KeyEquiv)) && !(GADGETOFF & gadlist->GadgetFlags)) { _event->mouseHide(); - gadlist->ImAlt->drawImage(gadlist->x, gadlist->y); + gadlist->_altImage->drawImage(gadlist->x, gadlist->y); _event->mouseShow(); g_system->delayMillis(80); _event->mouseHide(); - gadlist->Im->drawImage(gadlist->x, gadlist->y); + gadlist->_image->drawImage(gadlist->x, gadlist->y); _event->mouseShow(); return gadlist; diff --git a/engines/lab/interface.h b/engines/lab/interface.h index 524c4ff437..ceeb4a8327 100644 --- a/engines/lab/interface.h +++ b/engines/lab/interface.h @@ -46,7 +46,7 @@ struct Gadget { uint16 x, y, GadgetID; uint16 KeyEquiv; // if not zero, a key that activates gadget uint32 GadgetFlags; - Image *Im, *ImAlt; + Image *_image, *_altImage; Gadget *NextGadget; }; diff --git a/engines/lab/lab.cpp b/engines/lab/lab.cpp index 22ab50392d..1c95746857 100644 --- a/engines/lab/lab.cpp +++ b/engines/lab/lab.cpp @@ -89,6 +89,20 @@ LabEngine::LabEngine(OSystem *syst, const ADGameDescription *gameDesc) _lastMessageLong = false; _lastTooLong = false; + _interfaceOff = false; + _alternate = false; + + for (int i = 0; i < 20; i++) + _moveImages[20] = nullptr; + + for (int i = 0; i < 10; i++) + _invImages[10] = nullptr; + + _moveGadgetList = nullptr; + _invGadgetList = nullptr; + _curFileName = nullptr; + _nextFileName = nullptr; + _newFileName = nullptr; //const Common::FSNode gameDataDir(ConfMan.get("path")); //SearchMan.addSubDirectoryMatching(gameDataDir, "game"); diff --git a/engines/lab/lab.h b/engines/lab/lab.h index 348ce11eca..a439a3a7eb 100644 --- a/engines/lab/lab.h +++ b/engines/lab/lab.h @@ -86,6 +86,12 @@ public: private: uint32 _extraGameFeatures; + bool _interfaceOff; + bool _alternate; + Image *_moveImages[20]; + Image *_invImages[10]; + Gadget *_moveGadgetList; + Gadget *_invGadgetList; // timing.cpp void microDelay(uint32 secs, uint32 micros); @@ -114,6 +120,11 @@ public: byte *_tempScrollData; bool _isHiRes; byte *_displayBuffer; + const char *_curFileName; + const char *_nextFileName; + const char *_newFileName; /* When ProcessRoom.c decides to change the filename + of the current picture. */ + private: int _lastWaitTOFTicks; diff --git a/engines/lab/labfun.h b/engines/lab/labfun.h index 52f6034477..b20667bc2a 100644 --- a/engines/lab/labfun.h +++ b/engines/lab/labfun.h @@ -59,10 +59,10 @@ struct TextFont; struct Gadget; struct SaveGameHeader { - byte version; - SaveStateDescriptor desc; - uint16 roomNumber; - uint16 direction; + byte _version; + SaveStateDescriptor _descr; + uint16 _roomNumber; + uint16 _direction; }; /*----------------------------*/ diff --git a/engines/lab/map.cpp b/engines/lab/map.cpp index d7a3e124ca..43f8fd3267 100644 --- a/engines/lab/map.cpp +++ b/engines/lab/map.cpp @@ -171,12 +171,12 @@ static bool loadMapData() { Down = new Image(buffer); DownAlt = new Image(buffer); - backgadget.Im = Back; - backgadget.ImAlt = BackAlt; - upgadget.Im = Up; - upgadget.ImAlt = UpAlt; - downgadget.Im = Down; - downgadget.ImAlt = DownAlt; + backgadget._image = Back; + backgadget._altImage = BackAlt; + upgadget._image = Up; + upgadget._altImage = UpAlt; + downgadget._image = Down; + downgadget._altImage = DownAlt; counter = 0; gptr = MapGadgetList; diff --git a/engines/lab/mouse.cpp b/engines/lab/mouse.cpp index 38b893511d..b676f2cd37 100644 --- a/engines/lab/mouse.cpp +++ b/engines/lab/mouse.cpp @@ -61,21 +61,21 @@ static byte MouseData[] = {1, 1, 0, 0, 0, 0, 0, 0, 0, 0, Gadget *EventManager::checkGadgetHit(Gadget *gadgetList, Common::Point pos) { while (gadgetList != NULL) { if ((pos.x >= gadgetList->x) && (pos.y >= gadgetList->y) && - (pos.x <= (gadgetList->x + gadgetList->Im->Width)) && - (pos.y <= (gadgetList->y + gadgetList->Im->Height)) && + (pos.x <= (gadgetList->x + gadgetList->_image->Width)) && + (pos.y <= (gadgetList->y + gadgetList->_image->Height)) && !(GADGETOFF & gadgetList->GadgetFlags)) { if (_vm->_isHiRes) { _hitGadget = gadgetList; } else { mouseHide(); - gadgetList->ImAlt->drawImage(gadgetList->x, gadgetList->y); + gadgetList->_altImage->drawImage(gadgetList->x, gadgetList->y); mouseShow(); for (uint16 i = 0; i < 3; i++) _vm->waitTOF(); mouseHide(); - gadgetList->Im->drawImage(gadgetList->x, gadgetList->y); + gadgetList->_image->drawImage(gadgetList->x, gadgetList->y); mouseShow(); } @@ -143,14 +143,14 @@ void EventManager::updateMouse() { if (_hitGadget) { mouseHide(); - _hitGadget->ImAlt->drawImage(_hitGadget->x, _hitGadget->y); + _hitGadget->_altImage->drawImage(_hitGadget->x, _hitGadget->y); mouseShow(); for (uint16 i = 0; i < 3; i++) _vm->waitTOF(); mouseHide(); - _hitGadget->Im->drawImage(_hitGadget->x, _hitGadget->y); + _hitGadget->_image->drawImage(_hitGadget->x, _hitGadget->y); mouseShow(); doUpdateDisplay = true; _hitGadget = nullptr; diff --git a/engines/lab/parsetypes.h b/engines/lab/parsetypes.h index 3ca441a286..82174b80f4 100644 --- a/engines/lab/parsetypes.h +++ b/engines/lab/parsetypes.h @@ -185,8 +185,6 @@ struct InventoryData { #define MULTIMAZEF2 10 #define MULTIMAZEF3 11 - - struct MapData { uint16 x, y, PageNumber, SpecialID; uint32 MapFlags; diff --git a/engines/lab/processroom.cpp b/engines/lab/processroom.cpp index 0145c83cd4..3eeb00da54 100644 --- a/engines/lab/processroom.cpp +++ b/engines/lab/processroom.cpp @@ -47,10 +47,8 @@ namespace Lab { RoomData *_rooms; InventoryData *Inventory; uint16 NumInv, ManyRooms, HighestCondition, Direction; -const char *NewFileName; extern bool DoNotDrawMessage, noupdatediff, QuitLab, MusicOn, LongWinInFront; -extern const char *CurFileName; extern CloseDataPtr CPtr; /*****************************************************************************/ @@ -382,15 +380,15 @@ static void doActions(Action * APtr, CloseDataPtr *LCPtr) { break; case FORCEUPDATE: - CurFileName = " "; + g_lab->_curFileName = " "; break; case SHOWCURPICT: Test = getPictName(LCPtr); - if (strcmp(Test, CurFileName) != 0) { - CurFileName = Test; - readPict(CurFileName, true); + if (strcmp(Test, g_lab->_curFileName) != 0) { + g_lab->_curFileName = Test; + readPict(g_lab->_curFileName, true); } break; @@ -642,9 +640,9 @@ bool doActionRule(Common::Point pos, int16 action, int16 roomNum, CloseDataPtr * CloseDataPtr TLCPtr; if (roomNum) - NewFileName = NOFILE; + g_lab->_newFileName = NOFILE; else - NewFileName = CurFileName; + g_lab->_newFileName = g_lab->_curFileName; TLCPtr = getObject(pos.x, pos.y, *LCPtr); @@ -694,7 +692,7 @@ static bool doOperateRuleSub(int16 ItemNum, int16 roomNum, CloseDataPtr LCPtr, C bool doOperateRule(int16 x, int16 y, int16 ItemNum, CloseDataPtr *LCPtr) { CloseDataPtr TLCPtr; - NewFileName = NOFILE; + g_lab->_newFileName = NOFILE; TLCPtr = getObject(x, y, *LCPtr); @@ -707,7 +705,7 @@ bool doOperateRule(int16 x, int16 y, int16 ItemNum, CloseDataPtr *LCPtr) { else if (doOperateRuleSub(ItemNum, g_lab->_roomNum, *LCPtr, LCPtr, true)) return true; else { - NewFileName = CurFileName; + g_lab->_newFileName = g_lab->_curFileName; if (doOperateRuleSub(ItemNum, 0, TLCPtr, LCPtr, false)) return true; diff --git a/engines/lab/savegame.cpp b/engines/lab/savegame.cpp index d54e6cb491..41f7b2787e 100644 --- a/engines/lab/savegame.cpp +++ b/engines/lab/savegame.cpp @@ -89,10 +89,10 @@ bool readSaveGameHeader(Common::InSaveFile *in, SaveGameHeader &header) { return false; // Read in the version - header.version = in->readByte(); + header._version = in->readByte(); // Check that the save version isn't newer than this binary - if (header.version > SAVEGAME_VERSION) + if (header._version > SAVEGAME_VERSION) return false; // Read in the save name @@ -100,10 +100,10 @@ bool readSaveGameHeader(Common::InSaveFile *in, SaveGameHeader &header) { char ch; while ((ch = (char)in->readByte()) != '\0') saveName += ch; - header.desc.setDescription(saveName); + header._descr.setDescription(saveName); // Get the thumbnail - header.desc.setThumbnail(Graphics::loadThumbnail(*in)); + header._descr.setThumbnail(Graphics::loadThumbnail(*in)); uint32 saveDate = in->readUint32BE(); uint16 saveTime = in->readUint16BE(); @@ -112,13 +112,13 @@ bool readSaveGameHeader(Common::InSaveFile *in, SaveGameHeader &header) { int day = (saveDate >> 24) & 0xFF; int month = (saveDate >> 16) & 0xFF; int year = saveDate & 0xFFFF; - header.desc.setSaveDate(year, month, day); + header._descr.setSaveDate(year, month, day); int hour = (saveTime >> 8) & 0xFF; int minutes = saveTime & 0xFF; - header.desc.setSaveTime(hour, minutes); + header._descr.setSaveTime(hour, minutes); - header.desc.setPlayTime(playTime * 1000); + header._descr.setPlayTime(playTime * 1000); g_engine->setTotalPlayTime(playTime * 1000); return true; diff --git a/engines/lab/special.cpp b/engines/lab/special.cpp index 2744d3de32..6c5ff021a8 100644 --- a/engines/lab/special.cpp +++ b/engines/lab/special.cpp @@ -551,12 +551,12 @@ static bool loadJournalData() { if (!buffer) return false; - BackG.Im = new Image(buffer); - BackG.ImAlt = new Image(buffer); - ForwardG.Im = new Image(buffer); - ForwardG.ImAlt = new Image(buffer); - CancelG.Im = new Image(buffer); - CancelG.ImAlt = new Image(buffer); + BackG._image = new Image(buffer); + BackG._altImage = new Image(buffer); + ForwardG._image = new Image(buffer); + ForwardG._altImage = new Image(buffer); + CancelG._image = new Image(buffer); + CancelG._altImage = new Image(buffer); BackG.KeyEquiv = VKEY_LTARROW; ForwardG.KeyEquiv = VKEY_RTARROW; -- cgit v1.2.3 From 88ede5d2d5865f88db1f77f127089574ec2a5e1c Mon Sep 17 00:00:00 2001 From: Eugene Sandulenko Date: Wed, 2 Dec 2015 11:49:01 +0100 Subject: LAB: Rename Image class members --- engines/lab/graphics.cpp | 26 +++++++------- engines/lab/image.cpp | 32 ++++++++--------- engines/lab/image.h | 10 +++--- engines/lab/interface.cpp | 2 +- engines/lab/map.cpp | 90 +++++++++++++++++++++++------------------------ engines/lab/mouse.cpp | 4 +-- engines/lab/resource.cpp | 2 +- engines/lab/special.cpp | 42 +++++++++++----------- engines/lab/vga.cpp | 36 +++++++++---------- 9 files changed, 122 insertions(+), 122 deletions(-) diff --git a/engines/lab/graphics.cpp b/engines/lab/graphics.cpp index 975f054fe1..ce0b49740b 100644 --- a/engines/lab/graphics.cpp +++ b/engines/lab/graphics.cpp @@ -267,8 +267,8 @@ uint32 flowTextToMem(Image *destIm, void *font, /* the TextAttr pointer */ uint32 res, vgabyte = g_lab->_screenBytesPerPage; byte *tmp = g_lab->_currentDisplayBuffer; - g_lab->_currentDisplayBuffer = destIm->ImageData; - g_lab->_screenBytesPerPage = (uint32)destIm->Width * (int32)destIm->Height; + g_lab->_currentDisplayBuffer = destIm->_imageData; + g_lab->_screenBytesPerPage = (uint32)destIm->_width * (int32)destIm->_height; res = flowText(font, spacing, pencolor, backpen, fillback, centerh, centerv, output, x1, y1, x2, y2, str); @@ -372,9 +372,9 @@ void LabEngine::doScrollBlack() { allocFile((void **)&mem, (int32)width * (int32)height, "Temp Mem"); - im.Width = width; - im.Height = height; - im.ImageData = mem; + im._width = width; + im._height = height; + im._imageData = mem; _music->updateMusic(); im.readScreenImage(0, 0); _music->updateMusic(); @@ -622,13 +622,13 @@ void LabEngine::doTransWipe(CloseDataPtr *cPtr, char *filename) { setPalette(_anim->_diffPalette, 256); if (BitMapMem) { - imSource.Width = _screenWidth; - imSource.Height = lastY; - imSource.ImageData = BitMapMem; + imSource._width = _screenWidth; + imSource._height = lastY; + imSource._imageData = BitMapMem; - imDest.Width = _screenWidth; - imDest.Height = _screenHeight; - imDest.ImageData = getCurrentDrawingBuffer(); + imDest._width = _screenWidth; + imDest._height = _screenHeight; + imDest._imageData = getCurrentDrawingBuffer(); for (uint16 i = 0; i < 2; i++) { curY = i * 2; @@ -640,7 +640,7 @@ void LabEngine::doTransWipe(CloseDataPtr *cPtr, char *filename) { linesdone = 0; } - imDest.ImageData = getCurrentDrawingBuffer(); + imDest._imageData = getCurrentDrawingBuffer(); bltBitMap(&imSource, 0, curY, &imDest, 0, curY, _screenWidth, 2); ghoastRect(0, 0, curY, _screenWidth - 1, curY + 1); @@ -659,7 +659,7 @@ void LabEngine::doTransWipe(CloseDataPtr *cPtr, char *filename) { linesdone = 0; } - imDest.ImageData = getCurrentDrawingBuffer(); + imDest._imageData = getCurrentDrawingBuffer(); if (curY == lastY) bltBitMap(&imSource, 0, curY, &imDest, 0, curY, _screenWidth, 1); diff --git a/engines/lab/image.cpp b/engines/lab/image.cpp index 636ac82d29..2107f7af35 100644 --- a/engines/lab/image.cpp +++ b/engines/lab/image.cpp @@ -39,17 +39,17 @@ namespace Lab { Image::Image(byte **buffer) { uint32 size; - Width = READ_LE_UINT16(*buffer); - Height = READ_LE_UINT16(*buffer + 2); + _width = READ_LE_UINT16(*buffer); + _height = READ_LE_UINT16(*buffer + 2); *buffer += 8; /* sizeof(struct Image); */ - size = Width * Height; + size = _width * _height; if (1L & size) size++; - ImageData = (byte *)(*buffer); + _imageData = (byte *)(*buffer); (*buffer) += size; } @@ -59,8 +59,8 @@ Image::Image(byte **buffer) { void Image::drawImage(uint16 x, uint16 y) { int sx = 0, sy = 0; int dx = x, dy = y; - int w = Width; - int h = Height; + int w = _width; + int h = _height; if (dx < 0) { sx -= dx; @@ -81,12 +81,12 @@ void Image::drawImage(uint16 x, uint16 y) { h = g_lab->_screenHeight - dy; if ((w > 0) && (h > 0)) { - byte *s = ImageData + sy * Width + sx; + byte *s = _imageData + sy * _width + sx; byte *d = g_lab->getCurrentDrawingBuffer() + dy * g_lab->_screenWidth + dx; while (h-- > 0) { memcpy(d, s, w); - s += Width; + s += _width; d += g_lab->_screenWidth; } } @@ -98,8 +98,8 @@ void Image::drawImage(uint16 x, uint16 y) { void Image::drawMaskImage(uint16 x, uint16 y) { int sx = 0, sy = 0; int dx = x, dy = y; - int w = Width; - int h = Height; + int w = _width; + int h = _height; if (dx < 0) { sx -= dx; @@ -120,7 +120,7 @@ void Image::drawMaskImage(uint16 x, uint16 y) { h = g_lab->_screenHeight - dy; if ((w > 0) && (h > 0)) { - byte *s = ImageData + sy * Width + sx; + byte *s = _imageData + sy * _width + sx; byte *d = g_lab->getCurrentDrawingBuffer() + dy * g_lab->_screenWidth + dx; while (h-- > 0) { @@ -135,7 +135,7 @@ void Image::drawMaskImage(uint16 x, uint16 y) { else dd++; } - s += Width; + s += _width; d += g_lab->_screenWidth; } } @@ -147,8 +147,8 @@ void Image::drawMaskImage(uint16 x, uint16 y) { void Image::readScreenImage(uint16 x, uint16 y) { int sx = 0, sy = 0; int dx = x, dy = y; - int w = Width; - int h = Height; + int w = _width; + int h = _height; if (dx < 0) { sx -= dx; @@ -169,12 +169,12 @@ void Image::readScreenImage(uint16 x, uint16 y) { h = g_lab->_screenHeight - dy; if ((w > 0) && (h > 0)) { - byte *s = ImageData + sy * Width + sx; + byte *s = _imageData + sy * _width + sx; byte *d = g_lab->getCurrentDrawingBuffer() + dy * g_lab->_screenWidth + dx; while (h-- > 0) { memcpy(s, d, w); - s += Width; + s += _width; d += g_lab->_screenWidth; } } diff --git a/engines/lab/image.h b/engines/lab/image.h index c8a001af4d..2befa93f00 100644 --- a/engines/lab/image.h +++ b/engines/lab/image.h @@ -35,12 +35,12 @@ namespace Lab { class Image { public: - uint16 Width; - uint16 Height; - byte *ImageData; + uint16 _width; + uint16 _height; + byte *_imageData; - Image() : Width(0), Height(0), ImageData(0) {} - Image(int w, int h, byte *d) : Width(w), Height(h), ImageData(d) {} + Image() : _width(0), _height(0), _imageData(0) {} + Image(int w, int h, byte *d) : _width(w), _height(h), _imageData(d) {} Image(byte **buffer); void drawImage(uint16 x, uint16 y); diff --git a/engines/lab/interface.cpp b/engines/lab/interface.cpp index d9df22a9b1..ada510bd6e 100644 --- a/engines/lab/interface.cpp +++ b/engines/lab/interface.cpp @@ -96,7 +96,7 @@ void drawGadgetList(Gadget *gadlist) { /* Ghoasts a gadget, and makes it unavailable for using. */ /*****************************************************************************/ void ghoastGadget(Gadget *curgad, uint16 pencolor) { - g_lab->ghoastRect(pencolor, curgad->x, curgad->y, curgad->x + curgad->_image->Width - 1, curgad->y + curgad->_image->Height - 1); + g_lab->ghoastRect(pencolor, curgad->x, curgad->y, curgad->x + curgad->_image->_width - 1, curgad->y + curgad->_image->_height - 1); curgad->GadgetFlags |= GADGETOFF; } diff --git a/engines/lab/map.cpp b/engines/lab/map.cpp index 43f8fd3267..0690ed0fb9 100644 --- a/engines/lab/map.cpp +++ b/engines/lab/map.cpp @@ -265,23 +265,23 @@ static void roomCords(uint16 CurRoom, uint16 *x1, uint16 *y1, uint16 *x2, uint16 case NORMAL: case UPARROWROOM: case DOWNARROWROOM: - (*x2) += Room->Width; - (*y2) += Room->Height; + (*x2) += Room->_width; + (*y2) += Room->_height; break; case BRIDGEROOM: - (*x2) += Bridge->Width; - (*y2) += Bridge->Height; + (*x2) += Bridge->_width; + (*y2) += Bridge->_height; break; case VCORRIDOR: - (*x2) += VRoom->Width; - (*y2) += VRoom->Height; + (*x2) += VRoom->_width; + (*y2) += VRoom->_height; break; case HCORRIDOR: - (*x2) += HRoom->Width; - (*y2) += HRoom->Height; + (*x2) += HRoom->_width; + (*y2) += HRoom->_height; break; } } @@ -308,108 +308,108 @@ static void drawRoom(uint16 CurRoom, bool drawx) { else UpArrowRoom->drawImage(x, y); - offset = (Room->Width - Path->Width) / 2; + offset = (Room->_width - Path->_width) / 2; - if ((NORTHDOOR & flags) && (y >= Path->Height)) - Path->drawImage(x + offset, y - Path->Height); + if ((NORTHDOOR & flags) && (y >= Path->_height)) + Path->drawImage(x + offset, y - Path->_height); if (SOUTHDOOR & flags) - Path->drawImage(x + offset, y + Room->Height); + Path->drawImage(x + offset, y + Room->_height); - offset = (Room->Height - Path->Height) / 2; + offset = (Room->_height - Path->_height) / 2; if (EASTDOOR & flags) - Path->drawImage(x + Room->Width, y + offset); + Path->drawImage(x + Room->_width, y + offset); if (WESTDOOR & flags) - Path->drawImage(x - Path->Width, y + offset); + Path->drawImage(x - Path->_width, y + offset); - xx = x + (Room->Width - XMark->Width) / 2; - xy = y + (Room->Height - XMark->Height) / 2; + xx = x + (Room->_width - XMark->_width) / 2; + xy = y + (Room->_height - XMark->_height) / 2; break; case BRIDGEROOM: Bridge->drawImage(x, y); - xx = x + (Bridge->Width - XMark->Width) / 2; - xy = y + (Bridge->Height - XMark->Height) / 2; + xx = x + (Bridge->_width - XMark->_width) / 2; + xy = y + (Bridge->_height - XMark->_height) / 2; break; case VCORRIDOR: VRoom->drawImage(x, y); - offset = (VRoom->Width - Path->Width) / 2; + offset = (VRoom->_width - Path->_width) / 2; if (NORTHDOOR & flags) - Path->drawImage(x + offset, y - Path->Height); + Path->drawImage(x + offset, y - Path->_height); if (SOUTHDOOR & flags) - Path->drawImage(x + offset, y + VRoom->Height); + Path->drawImage(x + offset, y + VRoom->_height); - offset = (Room->Height - Path->Height) / 2; + offset = (Room->_height - Path->_height) / 2; if (EASTDOOR & flags) - Path->drawImage(x + VRoom->Width, y + offset); + Path->drawImage(x + VRoom->_width, y + offset); if (WESTDOOR & flags) - Path->drawImage(x - Path->Width, y + offset); + Path->drawImage(x - Path->_width, y + offset); if (EASTBDOOR & flags) - Path->drawImage(x + VRoom->Width, y - offset - Path->Height + VRoom->Height); + Path->drawImage(x + VRoom->_width, y - offset - Path->_height + VRoom->_height); if (WESTBDOOR & flags) - Path->drawImage(x - Path->Width, y - offset - Path->Height + VRoom->Height); + Path->drawImage(x - Path->_width, y - offset - Path->_height + VRoom->_height); - offset = (VRoom->Height - Path->Height) / 2; + offset = (VRoom->_height - Path->_height) / 2; if (EASTMDOOR & flags) - Path->drawImage(x + VRoom->Width, y - offset - Path->Height + VRoom->Height); + Path->drawImage(x + VRoom->_width, y - offset - Path->_height + VRoom->_height); if (WESTMDOOR & flags) - Path->drawImage(x - Path->Width, y - offset - Path->Height + VRoom->Height); + Path->drawImage(x - Path->_width, y - offset - Path->_height + VRoom->_height); - xx = x + (VRoom->Width - XMark->Width) / 2; - xy = y + (VRoom->Height - XMark->Height) / 2; + xx = x + (VRoom->_width - XMark->_width) / 2; + xy = y + (VRoom->_height - XMark->_height) / 2; break; case HCORRIDOR: HRoom->drawImage(x, y); - offset = (Room->Width - Path->Width) / 2; + offset = (Room->_width - Path->_width) / 2; if (NORTHDOOR & flags) - Path->drawImage(x + offset, y - Path->Height); + Path->drawImage(x + offset, y - Path->_height); if (SOUTHDOOR & flags) - Path->drawImage(x + offset, y + Room->Height); + Path->drawImage(x + offset, y + Room->_height); if (NORTHRDOOR & flags) - Path->drawImage(x - offset - Path->Width + HRoom->Width, y - Path->Height); + Path->drawImage(x - offset - Path->_width + HRoom->_width, y - Path->_height); if (SOUTHRDOOR & flags) - Path->drawImage(x - offset - Path->Width + HRoom->Width, y + Room->Height); + Path->drawImage(x - offset - Path->_width + HRoom->_width, y + Room->_height); - offset = (HRoom->Width - Path->Width) / 2; + offset = (HRoom->_width - Path->_width) / 2; if (NORTHMDOOR & flags) - Path->drawImage(x - offset - Path->Width + HRoom->Width, y - Path->Height); + Path->drawImage(x - offset - Path->_width + HRoom->_width, y - Path->_height); if (SOUTHMDOOR & flags) - Path->drawImage(x - offset - Path->Width + HRoom->Width, y + Room->Height); + Path->drawImage(x - offset - Path->_width + HRoom->_width, y + Room->_height); - offset = (Room->Height - Path->Height) / 2; + offset = (Room->_height - Path->_height) / 2; if (EASTDOOR & flags) - Path->drawImage(x + HRoom->Width, y + offset); + Path->drawImage(x + HRoom->_width, y + offset); if (WESTDOOR & flags) - Path->drawImage(x - Path->Width, y + offset); + Path->drawImage(x - Path->_width, y + offset); - xx = x + (HRoom->Width - XMark->Width) / 2; - xy = y + (HRoom->Height - XMark->Height) / 2; + xx = x + (HRoom->_width - XMark->_width) / 2; + xy = y + (HRoom->_height - XMark->_height) / 2; break; diff --git a/engines/lab/mouse.cpp b/engines/lab/mouse.cpp index b676f2cd37..45dd53f5c3 100644 --- a/engines/lab/mouse.cpp +++ b/engines/lab/mouse.cpp @@ -61,8 +61,8 @@ static byte MouseData[] = {1, 1, 0, 0, 0, 0, 0, 0, 0, 0, Gadget *EventManager::checkGadgetHit(Gadget *gadgetList, Common::Point pos) { while (gadgetList != NULL) { if ((pos.x >= gadgetList->x) && (pos.y >= gadgetList->y) && - (pos.x <= (gadgetList->x + gadgetList->_image->Width)) && - (pos.y <= (gadgetList->y + gadgetList->_image->Height)) && + (pos.x <= (gadgetList->x + gadgetList->_image->_width)) && + (pos.y <= (gadgetList->y + gadgetList->_image->_height)) && !(GADGETOFF & gadgetList->GadgetFlags)) { if (_vm->_isHiRes) { _hitGadget = gadgetList; diff --git a/engines/lab/resource.cpp b/engines/lab/resource.cpp index b1ad5284ba..70233dedd4 100644 --- a/engines/lab/resource.cpp +++ b/engines/lab/resource.cpp @@ -300,7 +300,7 @@ CloseData *Resource::readCloseUps(uint16 depth, Common::File *file) { prev = closeup; } } while (c != '\0'); - + return head; } diff --git a/engines/lab/special.cpp b/engines/lab/special.cpp index 6c5ff021a8..4d71b443e1 100644 --- a/engines/lab/special.cpp +++ b/engines/lab/special.cpp @@ -155,7 +155,7 @@ void showCombination(const char *filename) { for (uint16 CurBit = 0; CurBit < 10; CurBit++) Images[CurBit] = new Image(buffer); - allocFile((void **)&g_lab->_tempScrollData, Images[0]->Width * Images[0]->Height * 2L, "tempdata"); + allocFile((void **)&g_lab->_tempScrollData, Images[0]->_width * Images[0]->_height * 2L, "tempdata"); doCombination(); @@ -179,22 +179,22 @@ static void changeCombination(uint16 number) { combnum = combination[number]; - display.ImageData = g_lab->getCurrentDrawingBuffer(); - display.Width = g_lab->_screenWidth; - display.Height = g_lab->_screenHeight; + display._imageData = g_lab->getCurrentDrawingBuffer(); + display._width = g_lab->_screenWidth; + display._height = g_lab->_screenHeight; - for (uint16 i = 1; i <= (Images[combnum]->Height / 2); i++) { + for (uint16 i = 1; i <= (Images[combnum]->_height / 2); i++) { if (g_lab->_isHiRes) { if (i & 1) g_lab->waitTOF(); } else g_lab->waitTOF(); - display.ImageData = g_lab->getCurrentDrawingBuffer(); + display._imageData = g_lab->getCurrentDrawingBuffer(); - g_lab->scrollDisplayY(2, VGAScaleX(combx[number]), VGAScaleY(65), VGAScaleX(combx[number]) + (Images[combnum])->Width - 1, VGAScaleY(65) + (Images[combnum])->Height); + g_lab->scrollDisplayY(2, VGAScaleX(combx[number]), VGAScaleY(65), VGAScaleX(combx[number]) + (Images[combnum])->_width - 1, VGAScaleY(65) + (Images[combnum])->_height); - g_lab->bltBitMap(Images[combnum], 0, (Images[combnum])->Height - (2 * i), &(display), VGAScaleX(combx[number]), VGAScaleY(65), (Images[combnum])->Width, 2); + g_lab->bltBitMap(Images[combnum], 0, (Images[combnum])->_height - (2 * i), &(display), VGAScaleX(combx[number]), VGAScaleY(65), (Images[combnum])->_width, 2); } for (uint16 i = 0; i < 6; i++) @@ -306,7 +306,7 @@ void showTile(const char *filename, bool showsolution) { for (uint16 curBit = start; curBit < 16; curBit++) Tiles[curBit] = new Image(buffer); - allocFile((void **)&g_lab->_tempScrollData, Tiles[1]->Width * Tiles[1]->Height * 2L, "tempdata"); + allocFile((void **)&g_lab->_tempScrollData, Tiles[1]->_width * Tiles[1]->_height * 2L, "tempdata"); doTile(showsolution); @@ -625,14 +625,14 @@ static void turnPage(bool FromLeft) { for (int i = 0; i < g_lab->_screenWidth; i += 8) { g_lab->_music->updateMusic(); g_lab->waitTOF(); - ScreenImage.ImageData = g_lab->getCurrentDrawingBuffer(); + ScreenImage._imageData = g_lab->getCurrentDrawingBuffer(); g_lab->bltBitMap(&JBackImage, i, 0, &ScreenImage, i, 0, 8, g_lab->_screenHeight); } } else { for (int i = (g_lab->_screenWidth - 8); i > 0; i -= 8) { g_lab->_music->updateMusic(); g_lab->waitTOF(); - ScreenImage.ImageData = g_lab->getCurrentDrawingBuffer(); + ScreenImage._imageData = g_lab->getCurrentDrawingBuffer(); g_lab->bltBitMap(&JBackImage, i, 0, &ScreenImage, i, 0, 8, g_lab->_screenHeight); } } @@ -648,11 +648,11 @@ void LabEngine::drawJournal(uint16 wipenum, bool needFade) { _music->updateMusic(); if (!GotBackImage) - JBackImage.ImageData = loadBackPict("P:Journal.pic", true); + JBackImage._imageData = loadBackPict("P:Journal.pic", true); drawJournalText(); - ScreenImage.ImageData = getCurrentDrawingBuffer(); + ScreenImage._imageData = getCurrentDrawingBuffer(); if (wipenum == 0) bltBitMap(&JBackImage, 0, 0, &ScreenImage, 0, 0, _screenWidth, _screenHeight); @@ -674,7 +674,7 @@ void LabEngine::drawJournal(uint16 wipenum, bool needFade) { fade(true, 0); g_lab->_anim->_noPalChange = true; - JBackImage.ImageData = readPictToMem("P:Journal.pic", _screenWidth, _screenHeight); + JBackImage._imageData = readPictToMem("P:Journal.pic", _screenWidth, _screenHeight); GotBackImage = true; eatMessages(); @@ -735,15 +735,15 @@ void LabEngine::doJournal() { lastpage = false; GotBackImage = false; - JBackImage.Width = _screenWidth; - JBackImage.Height = _screenHeight; - JBackImage.ImageData = NULL; + JBackImage._width = _screenWidth; + JBackImage._height = _screenHeight; + JBackImage._imageData = NULL; BackG.NextGadget = &CancelG; CancelG.NextGadget = &ForwardG; ScreenImage = JBackImage; - ScreenImage.ImageData = getCurrentDrawingBuffer(); + ScreenImage._imageData = getCurrentDrawingBuffer(); _music->updateMusic(); loadJournalData(); @@ -757,7 +757,7 @@ void LabEngine::doJournal() { fade(false, 0); _event->mouseHide(); - ScreenImage.ImageData = getCurrentDrawingBuffer(); + ScreenImage._imageData = getCurrentDrawingBuffer(); setAPen(0); rectFill(0, 0, _screenWidth - 1, _screenHeight - 1); @@ -844,8 +844,8 @@ void LabEngine::drawMonText(char *text, TextFont *monitorFont, uint16 x1, uint16 text += 2; fheight = textHeight(monitorFont); - x1 = MonButton->Width + VGAScaleX(3); - MonGadHeight = MonButton->Height + VGAScaleY(3); + x1 = MonButton->_width + VGAScaleX(3); + MonGadHeight = MonButton->_height + VGAScaleY(3); if (MonGadHeight > fheight) yspacing = MonGadHeight - fheight; diff --git a/engines/lab/vga.cpp b/engines/lab/vga.cpp index 3525e779b2..9ccb5f5c54 100644 --- a/engines/lab/vga.cpp +++ b/engines/lab/vga.cpp @@ -169,20 +169,20 @@ void LabEngine::bltBitMap(Image *imSource, uint16 xs, uint16 ys, Image *imDest, dy = 0; } - if (dx + w > imDest->Width) - w = imDest->Width - dx; + if (dx + w > imDest->_width) + w = imDest->_width - dx; - if (dy + h > imDest->Height) - h = imDest->Height - dy; + if (dy + h > imDest->_height) + h = imDest->_height - dy; if (w > 0 && h > 0) { - byte *s = imSource->ImageData + sy * imSource->Width + sx; - byte *d = imDest->ImageData + dy * imDest->Width + dx; + byte *s = imSource->_imageData + sy * imSource->_width + sx; + byte *d = imDest->_imageData + dy * imDest->_width + dx; while (h-- > 0) { memcpy(d, s, w); - s += imSource->Width; - d += imDest->Width; + s += imSource->_width; + d += imDest->_width; } } } @@ -196,7 +196,7 @@ void LabEngine::scrollDisplayX(int16 dx, uint16 x1, uint16 y1, uint16 x2, uint16 Image im; uint16 temp; - im.ImageData = _tempScrollData; + im._imageData = _tempScrollData; if (x1 > x2) { temp = x2; @@ -211,8 +211,8 @@ void LabEngine::scrollDisplayX(int16 dx, uint16 x1, uint16 y1, uint16 x2, uint16 } if (dx > 0) { - im.Width = x2 - x1 + 1 - dx; - im.Height = y2 - y1 + 1; + im._width = x2 - x1 + 1 - dx; + im._height = y2 - y1 + 1; im.readScreenImage(x1, y1); im.drawImage(x1 + dx, y1); @@ -220,8 +220,8 @@ void LabEngine::scrollDisplayX(int16 dx, uint16 x1, uint16 y1, uint16 x2, uint16 setAPen(0); rectFill(x1, y1, x1 + dx - 1, y2); } else if (dx < 0) { - im.Width = x2 - x1 + 1 + dx; - im.Height = y2 - y1 + 1; + im._width = x2 - x1 + 1 + dx; + im._height = y2 - y1 + 1; im.readScreenImage(x1 - dx, y1); im.drawImage(x1, y1); @@ -238,7 +238,7 @@ void LabEngine::scrollDisplayY(int16 dy, uint16 x1, uint16 y1, uint16 x2, uint16 Image im; uint16 temp; - im.ImageData = _tempScrollData; + im._imageData = _tempScrollData; if (x1 > x2) { temp = x2; @@ -253,8 +253,8 @@ void LabEngine::scrollDisplayY(int16 dy, uint16 x1, uint16 y1, uint16 x2, uint16 } if (dy > 0) { - im.Width = x2 - x1 + 1; - im.Height = y2 - y1 + 1 - dy; + im._width = x2 - x1 + 1; + im._height = y2 - y1 + 1 - dy; im.readScreenImage(x1, y1); im.drawImage(x1, y1 + dy); @@ -262,8 +262,8 @@ void LabEngine::scrollDisplayY(int16 dy, uint16 x1, uint16 y1, uint16 x2, uint16 setAPen(0); rectFill(x1, y1, x2, y1 + dy - 1); } else if (dy < 0) { - im.Width = x2 - x1 + 1; - im.Height = y2 - y1 + 1 + dy; + im._width = x2 - x1 + 1; + im._height = y2 - y1 + 1 + dy; im.readScreenImage(x1, y1 - dy); im.drawImage(x1, y1); -- cgit v1.2.3 From 17d6e5e8608dfbf70fb08507da1ac196e04c0654 Mon Sep 17 00:00:00 2001 From: Eugene Sandulenko Date: Wed, 2 Dec 2015 11:54:42 +0100 Subject: LAB: Moved bltBitMap to Image class --- engines/lab/graphics.cpp | 6 +++--- engines/lab/image.cpp | 45 +++++++++++++++++++++++++++++++++++++++++++++ engines/lab/image.h | 1 + engines/lab/lab.h | 1 - engines/lab/special.cpp | 8 ++++---- engines/lab/vga.cpp | 45 --------------------------------------------- 6 files changed, 53 insertions(+), 53 deletions(-) diff --git a/engines/lab/graphics.cpp b/engines/lab/graphics.cpp index ce0b49740b..2f2109af7b 100644 --- a/engines/lab/graphics.cpp +++ b/engines/lab/graphics.cpp @@ -642,7 +642,7 @@ void LabEngine::doTransWipe(CloseDataPtr *cPtr, char *filename) { imDest._imageData = getCurrentDrawingBuffer(); - bltBitMap(&imSource, 0, curY, &imDest, 0, curY, _screenWidth, 2); + imSource.bltBitMap(0, curY, &imDest, 0, curY, _screenWidth, 2); ghoastRect(0, 0, curY, _screenWidth - 1, curY + 1); curY += 4; linesdone++; @@ -662,9 +662,9 @@ void LabEngine::doTransWipe(CloseDataPtr *cPtr, char *filename) { imDest._imageData = getCurrentDrawingBuffer(); if (curY == lastY) - bltBitMap(&imSource, 0, curY, &imDest, 0, curY, _screenWidth, 1); + imSource.bltBitMap(0, curY, &imDest, 0, curY, _screenWidth, 1); else - bltBitMap(&imSource, 0, curY, &imDest, 0, curY, _screenWidth, 2); + imSource.bltBitMap(0, curY, &imDest, 0, curY, _screenWidth, 2); curY += 4; linesdone++; diff --git a/engines/lab/image.cpp b/engines/lab/image.cpp index 2107f7af35..0fd7425dc4 100644 --- a/engines/lab/image.cpp +++ b/engines/lab/image.cpp @@ -180,4 +180,49 @@ void Image::readScreenImage(uint16 x, uint16 y) { } } +/*****************************************************************************/ +/* Blits a piece of one image to another. */ +/* NOTE: for our purposes, assumes that ImDest is to be in VGA memory. */ +/*****************************************************************************/ +void Image::bltBitMap(uint16 xs, uint16 ys, Image *imDest, + uint16 xd, uint16 yd, uint16 width, uint16 height) { + // I think the old code assumed that the source image data was valid for the given box. + // I will proceed on that assumption. + int sx = xs; + int sy = ys; + int dx = xd; + int dy = yd; + int w = width; + int h = height; + + if (dx < 0) { + sx -= dx; + w += dx; + dx = 0; + } + + if (dy < 0) { + sy -= dy; + w += dy; + dy = 0; + } + + if (dx + w > imDest->_width) + w = imDest->_width - dx; + + if (dy + h > imDest->_height) + h = imDest->_height - dy; + + if (w > 0 && h > 0) { + byte *s = _imageData + sy * _width + sx; + byte *d = imDest->_imageData + dy * imDest->_width + dx; + + while (h-- > 0) { + memcpy(d, s, w); + s += _width; + d += imDest->_width; + } + } +} + } // End of namespace Lab diff --git a/engines/lab/image.h b/engines/lab/image.h index 2befa93f00..450c177373 100644 --- a/engines/lab/image.h +++ b/engines/lab/image.h @@ -46,6 +46,7 @@ public: void drawImage(uint16 x, uint16 y); void drawMaskImage(uint16 x, uint16 y); void readScreenImage(uint16 x, uint16 y); + void bltBitMap(uint16 xs, uint16 ys, Image *ImDest, uint16 xd, uint16 yd, uint16 width, uint16 height); }; diff --git a/engines/lab/lab.h b/engines/lab/lab.h index a439a3a7eb..f4b223a025 100644 --- a/engines/lab/lab.h +++ b/engines/lab/lab.h @@ -145,7 +145,6 @@ public: void scrollDisplayX(int16 dx, uint16 x1, uint16 y1, uint16 x2, uint16 y2); void scrollDisplayY(int16 dy, uint16 x1, uint16 y1, uint16 x2, uint16 y2); void ghoastRect(uint16 pencolor, uint16 x1, uint16 y1, uint16 x2, uint16 y2); - void bltBitMap(Image *ImSource, uint16 xs, uint16 ys, Image *ImDest, uint16 xd, uint16 yd, uint16 width, uint16 height); void setPalette(void *cmap, uint16 numcolors); void drawHLine(uint16 x, uint16 y1, uint16 y2); void drawVLine(uint16 x1, uint16 y, uint16 x2); diff --git a/engines/lab/special.cpp b/engines/lab/special.cpp index 4d71b443e1..419e0d3a05 100644 --- a/engines/lab/special.cpp +++ b/engines/lab/special.cpp @@ -194,7 +194,7 @@ static void changeCombination(uint16 number) { g_lab->scrollDisplayY(2, VGAScaleX(combx[number]), VGAScaleY(65), VGAScaleX(combx[number]) + (Images[combnum])->_width - 1, VGAScaleY(65) + (Images[combnum])->_height); - g_lab->bltBitMap(Images[combnum], 0, (Images[combnum])->_height - (2 * i), &(display), VGAScaleX(combx[number]), VGAScaleY(65), (Images[combnum])->_width, 2); + Images[combnum]->bltBitMap(0, (Images[combnum])->_height - (2 * i), &(display), VGAScaleX(combx[number]), VGAScaleY(65), (Images[combnum])->_width, 2); } for (uint16 i = 0; i < 6; i++) @@ -626,14 +626,14 @@ static void turnPage(bool FromLeft) { g_lab->_music->updateMusic(); g_lab->waitTOF(); ScreenImage._imageData = g_lab->getCurrentDrawingBuffer(); - g_lab->bltBitMap(&JBackImage, i, 0, &ScreenImage, i, 0, 8, g_lab->_screenHeight); + JBackImage.bltBitMap(i, 0, &ScreenImage, i, 0, 8, g_lab->_screenHeight); } } else { for (int i = (g_lab->_screenWidth - 8); i > 0; i -= 8) { g_lab->_music->updateMusic(); g_lab->waitTOF(); ScreenImage._imageData = g_lab->getCurrentDrawingBuffer(); - g_lab->bltBitMap(&JBackImage, i, 0, &ScreenImage, i, 0, 8, g_lab->_screenHeight); + JBackImage.bltBitMap(i, 0, &ScreenImage, i, 0, 8, g_lab->_screenHeight); } } } @@ -655,7 +655,7 @@ void LabEngine::drawJournal(uint16 wipenum, bool needFade) { ScreenImage._imageData = getCurrentDrawingBuffer(); if (wipenum == 0) - bltBitMap(&JBackImage, 0, 0, &ScreenImage, 0, 0, _screenWidth, _screenHeight); + JBackImage.bltBitMap(0, 0, &ScreenImage, 0, 0, _screenWidth, _screenHeight); else turnPage((bool)(wipenum == 1)); diff --git a/engines/lab/vga.cpp b/engines/lab/vga.cpp index 9ccb5f5c54..959218e98c 100644 --- a/engines/lab/vga.cpp +++ b/engines/lab/vga.cpp @@ -142,51 +142,6 @@ byte *LabEngine::getCurrentDrawingBuffer() { return _displayBuffer; } -/*****************************************************************************/ -/* Blits a piece of one image to another. */ -/* NOTE: for our purposes, assumes that ImDest is to be in VGA memory. */ -/*****************************************************************************/ -void LabEngine::bltBitMap(Image *imSource, uint16 xs, uint16 ys, Image *imDest, - uint16 xd, uint16 yd, uint16 width, uint16 height) { - // I think the old code assumed that the source image data was valid for the given box. - // I will proceed on that assumption. - int sx = xs; - int sy = ys; - int dx = xd; - int dy = yd; - int w = width; - int h = height; - - if (dx < 0) { - sx -= dx; - w += dx; - dx = 0; - } - - if (dy < 0) { - sy -= dy; - w += dy; - dy = 0; - } - - if (dx + w > imDest->_width) - w = imDest->_width - dx; - - if (dy + h > imDest->_height) - h = imDest->_height - dy; - - if (w > 0 && h > 0) { - byte *s = imSource->_imageData + sy * imSource->_width + sx; - byte *d = imDest->_imageData + dy * imDest->_width + dx; - - while (h-- > 0) { - memcpy(d, s, w); - s += imSource->_width; - d += imDest->_width; - } - } -} - /*****************************************************************************/ /* Scrolls the display in the x direction by blitting. */ /* The _tempScrollData variable must be initialized to some memory, or this */ -- cgit v1.2.3 From ab2519f57b50a8d92a7f6fa192f453e2cf0e6888 Mon Sep 17 00:00:00 2001 From: Eugene Sandulenko Date: Wed, 2 Dec 2015 11:58:53 +0100 Subject: LAB: Get rid of machine.cpp --- engines/lab/graphics.cpp | 70 +++++++++++++++++++++++ engines/lab/labfile.cpp | 43 ++++++++++++++ engines/lab/machine.cpp | 146 ----------------------------------------------- engines/lab/module.mk | 1 - 4 files changed, 113 insertions(+), 147 deletions(-) delete mode 100644 engines/lab/machine.cpp diff --git a/engines/lab/graphics.cpp b/engines/lab/graphics.cpp index 2f2109af7b..9de6400aa6 100644 --- a/engines/lab/graphics.cpp +++ b/engines/lab/graphics.cpp @@ -45,6 +45,76 @@ BitMap bit1, bit2, *DispBitMap = &bit1, *DrawBitMap = &bit1; extern bool stopsound; extern TextFont *MsgFont; + +/*****************************************************************************/ +/* Scales the x co-ordinates to that of the new display. In the room parser */ +/* file, co-ordinates are set up on a 360x336 display. */ +/*****************************************************************************/ +uint16 scaleX(uint16 x) { + if (g_lab->_isHiRes) + return (uint16)((x * 16) / 9); + else + return (uint16)((x * 8) / 9); +} + +/*****************************************************************************/ +/* Scales the y co-ordinates to that of the new display. In the room parser */ +/* file, co-ordinates are set up on a 368x336 display. */ +/*****************************************************************************/ +uint16 scaleY(uint16 y) { + if (g_lab->_isHiRes) + return (y + (y / 14)); + else + return ((y * 10) / 24); +} + +/*****************************************************************************/ +/* Scales the VGA cords to SVGA if necessary; otherwise, returns VGA cords. */ +/*****************************************************************************/ +int16 VGAScaleX(int16 x) { + if (g_lab->_isHiRes) + return (x * 2); + else + return x; +} + +/*****************************************************************************/ +/* Scales the VGA cords to SVGA if necessary; otherwise, returns VGA cords. */ +/*****************************************************************************/ +int16 VGAScaleY(int16 y) { + if (g_lab->_isHiRes) + return ((y * 12) / 5); + else + return y; +} + +uint16 SVGACord(uint16 cord) { + if (g_lab->_isHiRes) + return cord; + else + return 0; +} + +/*****************************************************************************/ +/* Converts SVGA cords to VGA if necessary, otherwise returns VGA cords. */ +/*****************************************************************************/ +int VGAUnScaleX(int x) { + if (g_lab->_isHiRes) + return (x / 2); + else + return x; +} + +/*****************************************************************************/ +/* Converts SVGA cords to VGA if necessary, otherwise returns VGA cords. */ +/*****************************************************************************/ +int VGAUnScaleY(int y) { + if (g_lab->_isHiRes) + return ((y * 5) / 12); + else + return y; +} + /*---------------------------------------------------------------------------*/ /*------ From readPict.c. Reads in pictures and animations from disk. ------*/ /*---------------------------------------------------------------------------*/ diff --git a/engines/lab/labfile.cpp b/engines/lab/labfile.cpp index 83f3b0f2e9..99a02c14ff 100644 --- a/engines/lab/labfile.cpp +++ b/engines/lab/labfile.cpp @@ -28,6 +28,7 @@ * */ +#include "lab/lab.h" #include "lab/labfun.h" #include "lab/mouse.h" #include "common/file.h" @@ -309,4 +310,46 @@ void freeAllStolenMem() { _memPlace = buffer; } +static char NewFileName[255]; + +/*****************************************************************************/ +/* Modifies the filename so that paths and stuff are correct. Should mostly */ +/* deal with assigns and the '/' instead of '\' on IBM systems. */ +/* */ +/* NOTE: Make a *copy* of the string, and modify that. It would be a real */ +/* *bad* idea to modify the original. Since Labyrinth only focuses its */ +/* attention to one file at a time, it would be fine to have one variable */ +/* not on the stack which is used to store the new filename. */ +/*****************************************************************************/ +char *translateFileName(const char *filename) { + Common::String fileNameStr = filename; + fileNameStr.toUppercase(); + Common::String fileNameStrFinal; + + if (fileNameStr.hasPrefix("P:")) { + if (g_lab->_isHiRes) + fileNameStrFinal = "GAME/SPICT/"; + else + fileNameStrFinal = "GAME/PICT/"; + } else if (fileNameStr.hasPrefix("LAB:")) + fileNameStrFinal = "GAME/"; + else if (fileNameStr.hasPrefix("MUSIC:")) + fileNameStrFinal = "GAME/MUSIC/"; + + if (fileNameStr.contains(':')) { + while (fileNameStr[0] != ':') { + fileNameStr.deleteChar(0); + } + + fileNameStr.deleteChar(0); + } + + fileNameStrFinal += fileNameStr; + + strcpy(NewFileName, fileNameStrFinal.c_str()); + + return NewFileName; +} + + } // End of namespace Lab diff --git a/engines/lab/machine.cpp b/engines/lab/machine.cpp deleted file mode 100644 index 0667772d89..0000000000 --- a/engines/lab/machine.cpp +++ /dev/null @@ -1,146 +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. - * - */ - -/* - * This code is based on Labyrinth of Time code with assistance of - * - * Copyright (c) 1993 Terra Nova Development - * Copyright (c) 2004 The Wyrmkeep Entertainment Co. - * - */ - -#include "common/str.h" -#include "lab/lab.h" - -namespace Lab { - -/*****************************************************************************/ -/* Scales the x co-ordinates to that of the new display. In the room parser */ -/* file, co-ordinates are set up on a 360x336 display. */ -/*****************************************************************************/ -uint16 scaleX(uint16 x) { - if (g_lab->_isHiRes) - return (uint16)((x * 16) / 9); - else - return (uint16)((x * 8) / 9); -} - -/*****************************************************************************/ -/* Scales the y co-ordinates to that of the new display. In the room parser */ -/* file, co-ordinates are set up on a 368x336 display. */ -/*****************************************************************************/ -uint16 scaleY(uint16 y) { - if (g_lab->_isHiRes) - return (y + (y / 14)); - else - return ((y * 10) / 24); -} - -/*****************************************************************************/ -/* Scales the VGA cords to SVGA if necessary; otherwise, returns VGA cords. */ -/*****************************************************************************/ -int16 VGAScaleX(int16 x) { - if (g_lab->_isHiRes) - return (x * 2); - else - return x; -} - -/*****************************************************************************/ -/* Scales the VGA cords to SVGA if necessary; otherwise, returns VGA cords. */ -/*****************************************************************************/ -int16 VGAScaleY(int16 y) { - if (g_lab->_isHiRes) - return ((y * 12) / 5); - else - return y; -} - -uint16 SVGACord(uint16 cord) { - if (g_lab->_isHiRes) - return cord; - else - return 0; -} - -/*****************************************************************************/ -/* Converts SVGA cords to VGA if necessary, otherwise returns VGA cords. */ -/*****************************************************************************/ -int VGAUnScaleX(int x) { - if (g_lab->_isHiRes) - return (x / 2); - else - return x; -} - -/*****************************************************************************/ -/* Converts SVGA cords to VGA if necessary, otherwise returns VGA cords. */ -/*****************************************************************************/ -int VGAUnScaleY(int y) { - if (g_lab->_isHiRes) - return ((y * 5) / 12); - else - return y; -} - -static char NewFileName[255]; - -/*****************************************************************************/ -/* Modifies the filename so that paths and stuff are correct. Should mostly */ -/* deal with assigns and the '/' instead of '\' on IBM systems. */ -/* */ -/* NOTE: Make a *copy* of the string, and modify that. It would be a real */ -/* *bad* idea to modify the original. Since Labyrinth only focuses its */ -/* attention to one file at a time, it would be fine to have one variable */ -/* not on the stack which is used to store the new filename. */ -/*****************************************************************************/ -char *translateFileName(const char *filename) { - Common::String fileNameStr = filename; - fileNameStr.toUppercase(); - Common::String fileNameStrFinal; - - if (fileNameStr.hasPrefix("P:")) { - if (g_lab->_isHiRes) - fileNameStrFinal = "GAME/SPICT/"; - else - fileNameStrFinal = "GAME/PICT/"; - } else if (fileNameStr.hasPrefix("LAB:")) - fileNameStrFinal = "GAME/"; - else if (fileNameStr.hasPrefix("MUSIC:")) - fileNameStrFinal = "GAME/MUSIC/"; - - if (fileNameStr.contains(':')) { - while (fileNameStr[0] != ':') { - fileNameStr.deleteChar(0); - } - - fileNameStr.deleteChar(0); - } - - fileNameStrFinal += fileNameStr; - - strcpy(NewFileName, fileNameStrFinal.c_str()); - - return NewFileName; -} - -} // End of namespace Lab diff --git a/engines/lab/module.mk b/engines/lab/module.mk index 53b9f4e1e6..cfe867a0a2 100644 --- a/engines/lab/module.mk +++ b/engines/lab/module.mk @@ -12,7 +12,6 @@ MODULE_OBJS := \ lab.o \ labfile.o \ labsets.o \ - machine.o \ map.o \ mouse.o \ music.o \ -- cgit v1.2.3 From adbb0ce0c52e2a9f0f6c52adf1d83bf351e8e1fb Mon Sep 17 00:00:00 2001 From: Eugene Sandulenko Date: Wed, 2 Dec 2015 12:04:31 +0100 Subject: LAB: Renamed mouse.* to eventman.* --- engines/lab/engine.cpp | 1 - engines/lab/eventman.cpp | 380 +++++++++++++++++++++++++++++++++++++++++++++ engines/lab/eventman.h | 81 ++++++++++ engines/lab/graphics.cpp | 1 - engines/lab/interface.cpp | 1 - engines/lab/lab.h | 2 +- engines/lab/labfile.cpp | 1 - engines/lab/map.cpp | 1 - engines/lab/module.mk | 2 +- engines/lab/mouse.cpp | 381 ---------------------------------------------- engines/lab/mouse.h | 83 ---------- engines/lab/music.cpp | 1 - engines/lab/special.cpp | 1 - engines/lab/vga.cpp | 1 - 14 files changed, 463 insertions(+), 474 deletions(-) create mode 100644 engines/lab/eventman.cpp create mode 100644 engines/lab/eventman.h delete mode 100644 engines/lab/mouse.cpp delete mode 100644 engines/lab/mouse.h diff --git a/engines/lab/engine.cpp b/engines/lab/engine.cpp index fe3c4284df..1823fe6fa5 100644 --- a/engines/lab/engine.cpp +++ b/engines/lab/engine.cpp @@ -36,7 +36,6 @@ #include "lab/intro.h" #include "lab/parsefun.h" #include "lab/interface.h" -#include "lab/mouse.h" #include "lab/resource.h" namespace Lab { diff --git a/engines/lab/eventman.cpp b/engines/lab/eventman.cpp new file mode 100644 index 0000000000..751f387e05 --- /dev/null +++ b/engines/lab/eventman.cpp @@ -0,0 +1,380 @@ +/* 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. + * + */ + +/* + * This code is based on Labyrinth of Time code with assistance of + * + * Copyright (c) 1993 Terra Nova Development + * Copyright (c) 2004 The Wyrmkeep Entertainment Co. + * + */ + +#include "lab/lab.h" +#include "lab/image.h" +#include "lab/interface.h" + +namespace Lab { + +static byte MouseData[] = {1, 1, 0, 0, 0, 0, 0, 0, 0, 0, + 1, 7, 1, 0, 0, 0, 0, 0, 0, 0, + 1, 7, 7, 1, 0, 0, 0, 0, 0, 0, + 1, 7, 7, 7, 1, 0, 0, 0, 0, 0, + 1, 7, 7, 7, 7, 1, 0, 0, 0, 0, + 1, 7, 7, 7, 7, 7, 1, 0, 0, 0, + 1, 7, 7, 7, 7, 7, 7, 1, 0, 0, + 1, 7, 7, 7, 7, 7, 7, 7, 1, 0, + 1, 7, 7, 7, 7, 7, 1, 1, 1, 1, + 1, 7, 7, 1, 7, 7, 1, 0, 0, 0, + 1, 7, 1, 0, 1, 7, 7, 1, 0, 0, + 1, 1, 0, 0, 1, 7, 7, 1, 0, 0, + 0, 0, 0, 0, 0, 1, 7, 7, 1, 0, + 0, 0, 0, 0, 0, 1, 7, 7, 1, 0, + 0, 0, 0, 0, 0, 0, 1, 1, 0, 0}; + +#define MOUSE_WIDTH 10 +#define MOUSE_HEIGHT 15 + +/*****************************************************************************/ +/* Checks whether or not the cords fall within one of the gadgets in a list */ +/* of gadgets. */ +/*****************************************************************************/ +Gadget *EventManager::checkGadgetHit(Gadget *gadgetList, Common::Point pos) { + while (gadgetList != NULL) { + if ((pos.x >= gadgetList->x) && (pos.y >= gadgetList->y) && + (pos.x <= (gadgetList->x + gadgetList->_image->_width)) && + (pos.y <= (gadgetList->y + gadgetList->_image->_height)) && + !(GADGETOFF & gadgetList->GadgetFlags)) { + if (_vm->_isHiRes) { + _hitGadget = gadgetList; + } else { + mouseHide(); + gadgetList->_altImage->drawImage(gadgetList->x, gadgetList->y); + mouseShow(); + + for (uint16 i = 0; i < 3; i++) + _vm->waitTOF(); + + mouseHide(); + gadgetList->_image->drawImage(gadgetList->x, gadgetList->y); + mouseShow(); + } + + return gadgetList; + } else { + gadgetList = gadgetList->NextGadget; + } + } + + return NULL; +} + + + +void EventManager::attachGadgetList(Gadget *gadgetList) { + if (_screenGadgetList != gadgetList) + _lastGadgetHit = nullptr; + + _screenGadgetList = gadgetList; +} + +EventManager::EventManager(LabEngine *vm) : _vm(vm) { + _leftClick = false; + _rightClick = false; + + _mouseHidden = true; + _numHidden = 1; + _lastGadgetHit = nullptr; + _screenGadgetList = nullptr; + _hitGadget = nullptr; + _nextKeyIn = 0; + _nextKeyOut = 0; + _mousePos = Common::Point(0, 0); + _mouseAtEdge = false; + + for (int i = 0; i < 64; i++) + _keyBuf[i] = 0; + +} + +void EventManager::mouseHandler(int flag, Common::Point pos) { + if (_numHidden >= 2) + return; + + if (flag & 0x02) { /* Left mouse button click */ + Gadget *tmp = NULL; + if (_screenGadgetList) + tmp = checkGadgetHit(_screenGadgetList, _vm->_isHiRes ? pos : Common::Point(pos.x / 2, pos.y)); + + if (tmp) + _lastGadgetHit = tmp; + else + _leftClick = true; + } + + if (flag & 0x08) /* Right mouse button click */ + _rightClick = true; +} + +void EventManager::updateMouse() { + bool doUpdateDisplay = false; + + if (!_mouseHidden) + doUpdateDisplay = true; + + if (_hitGadget) { + mouseHide(); + _hitGadget->_altImage->drawImage(_hitGadget->x, _hitGadget->y); + mouseShow(); + + for (uint16 i = 0; i < 3; i++) + _vm->waitTOF(); + + mouseHide(); + _hitGadget->_image->drawImage(_hitGadget->x, _hitGadget->y); + mouseShow(); + doUpdateDisplay = true; + _hitGadget = nullptr; + } + + if (doUpdateDisplay) + _vm->screenUpdate(); +} + + +/*****************************************************************************/ +/* Initializes the mouse. */ +/*****************************************************************************/ +void EventManager::initMouse() { + g_system->setMouseCursor(MouseData, MOUSE_WIDTH, MOUSE_HEIGHT, 0, 0, 0); + g_system->showMouse(false); + + setMousePos(Common::Point(0, 0)); +} + + +/*****************************************************************************/ +/* Shows the mouse. */ +/*****************************************************************************/ +void EventManager::mouseShow() { + if (_numHidden) + _numHidden--; + + if ((_numHidden == 0) && _mouseHidden) { + processInput(); + _mouseHidden = false; + } + + g_system->showMouse(true); +} + +/*****************************************************************************/ +/* Hides the mouse. */ +/*****************************************************************************/ +void EventManager::mouseHide() { + _numHidden++; + + if (_numHidden && !_mouseHidden) { + _mouseHidden = true; + + g_system->showMouse(false); + } +} + +/*****************************************************************************/ +/* Gets the current mouse co-ordinates. NOTE: On IBM version, will scale */ +/* from virtual to screen co-ordinates automatically. */ +/*****************************************************************************/ +Common::Point EventManager::getMousePos() { + if (_vm->_isHiRes) + return _mousePos; + else + return Common::Point(_mousePos.x / 2, _mousePos.y); +} + + +/*****************************************************************************/ +/* Moves the mouse to new co-ordinates. */ +/*****************************************************************************/ +void EventManager::setMousePos(Common::Point pos) { + if (_vm->_isHiRes) + g_system->warpMouse(pos.x, pos.y); + else + g_system->warpMouse(pos.x * 2, pos.y); + + if (!_mouseHidden) + processInput(); +} + + +/*****************************************************************************/ +/* Checks whether or not the mouse buttons have been pressed, and the last */ +/* co-ordinates of the button press. leftbutton tells whether to check the */ +/* left or right button. */ +/*****************************************************************************/ +bool EventManager::mouseButton(uint16 *x, uint16 *y, bool leftbutton) { + if (leftbutton) { + if (_leftClick) { + *x = (!_vm->_isHiRes) ? (uint16)_mousePos.x / 2 : (uint16)_mousePos.x; + *y = (uint16)_mousePos.y; + _leftClick = false; + return true; + } + } else { + if (_rightClick) { + *x = (!_vm->_isHiRes) ? (uint16)_mousePos.x / 2 : (uint16)_mousePos.x; + *y = (uint16)_mousePos.y; + _rightClick = false; + return true; + } + } + + return false; +} + +Gadget *EventManager::mouseGadget() { + Gadget *temp = _lastGadgetHit; + + _lastGadgetHit = nullptr; + return temp; +} + +/*****************************************************************************/ +/* Checks whether or not a key has been pressed. */ +/*****************************************************************************/ +bool EventManager::keyPress(uint16 *keyCode) { + if (haveNextChar()) { + *keyCode = getNextChar(); + return true; + } + + return false; +} + +bool EventManager::haveNextChar() { + processInput(); + return _nextKeyIn != _nextKeyOut; +} + +void EventManager::processInput(bool can_delay) { + Common::Event event; + + if (1 /*!g_IgnoreProcessInput*/) { + int flags = 0; + while (g_system->getEventManager()->pollEvent(event)) { + switch (event.type) { + case Common::EVENT_RBUTTONDOWN: + flags |= 8; + mouseHandler(flags, _mousePos); + break; + + case Common::EVENT_LBUTTONDOWN: + flags |= 2; + mouseHandler(flags, _mousePos); + break; + + case Common::EVENT_MOUSEMOVE: { + int lastMouseAtEdge = _mouseAtEdge; + _mouseAtEdge = false; + _mousePos.x = event.mouse.x; + if (event.mouse.x <= 0) { + _mousePos.x = 0; + _mouseAtEdge = true; + } + if (_mousePos.x > _vm->_screenWidth - 1) { + _mousePos.x = _vm->_screenWidth; + _mouseAtEdge = true; + } + + _mousePos.y = event.mouse.y; + if (event.mouse.y <= 0) { + _mousePos.y = 0; + _mouseAtEdge = true; + } + if (_mousePos.y > _vm->_screenHeight - 1) { + _mousePos.y = _vm->_screenHeight; + _mouseAtEdge = true; + } + + if (!lastMouseAtEdge || !_mouseAtEdge) + mouseHandler(1, _mousePos); + } + break; + + case Common::EVENT_KEYDOWN: + switch (event.kbd.keycode) { + case Common::KEYCODE_LEFTBRACKET: + _vm->changeVolume(-1); + break; + + case Common::KEYCODE_RIGHTBRACKET: + _vm->changeVolume(1); + break; + + case Common::KEYCODE_z: + //saveSettings(); + break; + + default: { + int n = ((((unsigned int)((_nextKeyIn + 1) >> 31) >> 26) + (byte)_nextKeyIn + 1) & 0x3F) + - ((unsigned int)((_nextKeyIn + 1) >> 31) >> 26); + if (n != _nextKeyOut) { + _keyBuf[_nextKeyIn] = event.kbd.keycode; + _nextKeyIn = n; + } + } + } + break; + + case Common::EVENT_QUIT: + case Common::EVENT_RTL: + default: + break; + } + + g_system->copyRectToScreen(_vm->_displayBuffer, _vm->_screenWidth, 0, 0, _vm->_screenWidth, _vm->_screenHeight); + g_system->updateScreen(); + } + } + + if (can_delay) + g_system->delayMillis(10); +} + +uint16 EventManager::getNextChar() { + uint16 c = 0; + + processInput(); + if (_nextKeyIn != _nextKeyOut) { + c = _keyBuf[_nextKeyOut]; + _nextKeyOut = ((((unsigned int)((_nextKeyOut + 1) >> 31) >> 26) + (byte)_nextKeyOut + 1) & 0x3F) + - ((unsigned int)((_nextKeyOut + 1) >> 31) >> 26); + } + + return c; +} + +Common::Point EventManager::updateAndGetMousePos() { + processInput(); + + return _mousePos; +} +} // End of namespace Lab diff --git a/engines/lab/eventman.h b/engines/lab/eventman.h new file mode 100644 index 0000000000..156fb96adc --- /dev/null +++ b/engines/lab/eventman.h @@ -0,0 +1,81 @@ +/* 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. + * + */ + +/* + * This code is based on Labyrinth of Time code with assistance of + * + * Copyright (c) 1993 Terra Nova Development + * Copyright (c) 2004 The Wyrmkeep Entertainment Co. + * + */ + +#ifndef LAB_EVENTMAN_H +#define LAB_EVENTMAN_H + +namespace Lab { + +struct Gadget; + +class LabEngine; + +class EventManager { +private: + LabEngine *_vm; + bool _leftClick; + bool _rightClick; + + bool _mouseHidden; + int32 _numHidden; + Gadget *_lastGadgetHit; + uint16 _nextKeyIn; + uint16 _nextKeyOut; + Common::Point _mousePos; + bool _mouseAtEdge; + uint16 _keyBuf[64]; + +public: + EventManager (LabEngine *vm); + + Gadget *_screenGadgetList; + Gadget *_hitGadget; + + Gadget *checkGadgetHit(Gadget *gadgetList, Common::Point pos); + void initMouse(); + void updateMouse(); + void mouseShow(); + void mouseHide(); + Common::Point getMousePos(); + void setMousePos(Common::Point pos); + bool mouseButton(uint16 *x, uint16 *y, bool leftButton); + Gadget *mouseGadget(); + void attachGadgetList(Gadget *gadgetList); + void mouseHandler(int flag, Common::Point pos); + bool keyPress(uint16 *keyCode); + bool haveNextChar(); + void processInput(bool can_delay = false); + uint16 getNextChar(); + Common::Point updateAndGetMousePos(); +}; + +} // End of namespace Lab + +#endif /* LAB_EVENTMAN_H */ diff --git a/engines/lab/graphics.cpp b/engines/lab/graphics.cpp index 9de6400aa6..4c2d3d7019 100644 --- a/engines/lab/graphics.cpp +++ b/engines/lab/graphics.cpp @@ -34,7 +34,6 @@ #include "lab/image.h" #include "lab/labfun.h" #include "lab/parsefun.h" -#include "lab/mouse.h" #include "lab/text.h" #include "lab/resource.h" diff --git a/engines/lab/interface.cpp b/engines/lab/interface.cpp index ada510bd6e..9a51978bdf 100644 --- a/engines/lab/interface.cpp +++ b/engines/lab/interface.cpp @@ -32,7 +32,6 @@ #include "lab/labfun.h" #include "lab/image.h" #include "lab/interface.h" -#include "lab/mouse.h" #include "common/util.h" namespace Lab { diff --git a/engines/lab/lab.h b/engines/lab/lab.h index f4b223a025..6135f5e9d7 100644 --- a/engines/lab/lab.h +++ b/engines/lab/lab.h @@ -37,7 +37,7 @@ #include "engines/engine.h" #include "lab/labfun.h" #include "lab/interface.h" -#include "lab/mouse.h" +#include "lab/eventman.h" #include "lab/music.h" #include "lab/resource.h" #include "lab/anim.h" diff --git a/engines/lab/labfile.cpp b/engines/lab/labfile.cpp index 99a02c14ff..3a34f80b43 100644 --- a/engines/lab/labfile.cpp +++ b/engines/lab/labfile.cpp @@ -30,7 +30,6 @@ #include "lab/lab.h" #include "lab/labfun.h" -#include "lab/mouse.h" #include "common/file.h" namespace Lab { diff --git a/engines/lab/map.cpp b/engines/lab/map.cpp index 0690ed0fb9..efc1825b4b 100644 --- a/engines/lab/map.cpp +++ b/engines/lab/map.cpp @@ -33,7 +33,6 @@ #include "lab/anim.h" #include "lab/image.h" #include "lab/text.h" -#include "lab/mouse.h" #include "lab/parsefun.h" #include "lab/parsetypes.h" #include "lab/resource.h" diff --git a/engines/lab/module.mk b/engines/lab/module.mk index cfe867a0a2..67d6b286d5 100644 --- a/engines/lab/module.mk +++ b/engines/lab/module.mk @@ -5,6 +5,7 @@ MODULE_OBJS := \ anim.o \ detection.o \ engine.o \ + eventman.o \ graphics.o \ image.o \ interface.o \ @@ -13,7 +14,6 @@ MODULE_OBJS := \ labfile.o \ labsets.o \ map.o \ - mouse.o \ music.o \ processroom.o \ resource.o \ diff --git a/engines/lab/mouse.cpp b/engines/lab/mouse.cpp deleted file mode 100644 index 45dd53f5c3..0000000000 --- a/engines/lab/mouse.cpp +++ /dev/null @@ -1,381 +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. - * - */ - -/* - * This code is based on Labyrinth of Time code with assistance of - * - * Copyright (c) 1993 Terra Nova Development - * Copyright (c) 2004 The Wyrmkeep Entertainment Co. - * - */ - -#include "lab/lab.h" -#include "lab/image.h" -#include "lab/mouse.h" -#include "lab/interface.h" - -namespace Lab { - -static byte MouseData[] = {1, 1, 0, 0, 0, 0, 0, 0, 0, 0, - 1, 7, 1, 0, 0, 0, 0, 0, 0, 0, - 1, 7, 7, 1, 0, 0, 0, 0, 0, 0, - 1, 7, 7, 7, 1, 0, 0, 0, 0, 0, - 1, 7, 7, 7, 7, 1, 0, 0, 0, 0, - 1, 7, 7, 7, 7, 7, 1, 0, 0, 0, - 1, 7, 7, 7, 7, 7, 7, 1, 0, 0, - 1, 7, 7, 7, 7, 7, 7, 7, 1, 0, - 1, 7, 7, 7, 7, 7, 1, 1, 1, 1, - 1, 7, 7, 1, 7, 7, 1, 0, 0, 0, - 1, 7, 1, 0, 1, 7, 7, 1, 0, 0, - 1, 1, 0, 0, 1, 7, 7, 1, 0, 0, - 0, 0, 0, 0, 0, 1, 7, 7, 1, 0, - 0, 0, 0, 0, 0, 1, 7, 7, 1, 0, - 0, 0, 0, 0, 0, 0, 1, 1, 0, 0}; - -#define MOUSE_WIDTH 10 -#define MOUSE_HEIGHT 15 - -/*****************************************************************************/ -/* Checks whether or not the cords fall within one of the gadgets in a list */ -/* of gadgets. */ -/*****************************************************************************/ -Gadget *EventManager::checkGadgetHit(Gadget *gadgetList, Common::Point pos) { - while (gadgetList != NULL) { - if ((pos.x >= gadgetList->x) && (pos.y >= gadgetList->y) && - (pos.x <= (gadgetList->x + gadgetList->_image->_width)) && - (pos.y <= (gadgetList->y + gadgetList->_image->_height)) && - !(GADGETOFF & gadgetList->GadgetFlags)) { - if (_vm->_isHiRes) { - _hitGadget = gadgetList; - } else { - mouseHide(); - gadgetList->_altImage->drawImage(gadgetList->x, gadgetList->y); - mouseShow(); - - for (uint16 i = 0; i < 3; i++) - _vm->waitTOF(); - - mouseHide(); - gadgetList->_image->drawImage(gadgetList->x, gadgetList->y); - mouseShow(); - } - - return gadgetList; - } else { - gadgetList = gadgetList->NextGadget; - } - } - - return NULL; -} - - - -void EventManager::attachGadgetList(Gadget *gadgetList) { - if (_screenGadgetList != gadgetList) - _lastGadgetHit = nullptr; - - _screenGadgetList = gadgetList; -} - -EventManager::EventManager(LabEngine *vm) : _vm(vm) { - _leftClick = false; - _rightClick = false; - - _mouseHidden = true; - _numHidden = 1; - _lastGadgetHit = nullptr; - _screenGadgetList = nullptr; - _hitGadget = nullptr; - _nextKeyIn = 0; - _nextKeyOut = 0; - _mousePos = Common::Point(0, 0); - _mouseAtEdge = false; - - for (int i = 0; i < 64; i++) - _keyBuf[i] = 0; - -} - -void EventManager::mouseHandler(int flag, Common::Point pos) { - if (_numHidden >= 2) - return; - - if (flag & 0x02) { /* Left mouse button click */ - Gadget *tmp = NULL; - if (_screenGadgetList) - tmp = checkGadgetHit(_screenGadgetList, _vm->_isHiRes ? pos : Common::Point(pos.x / 2, pos.y)); - - if (tmp) - _lastGadgetHit = tmp; - else - _leftClick = true; - } - - if (flag & 0x08) /* Right mouse button click */ - _rightClick = true; -} - -void EventManager::updateMouse() { - bool doUpdateDisplay = false; - - if (!_mouseHidden) - doUpdateDisplay = true; - - if (_hitGadget) { - mouseHide(); - _hitGadget->_altImage->drawImage(_hitGadget->x, _hitGadget->y); - mouseShow(); - - for (uint16 i = 0; i < 3; i++) - _vm->waitTOF(); - - mouseHide(); - _hitGadget->_image->drawImage(_hitGadget->x, _hitGadget->y); - mouseShow(); - doUpdateDisplay = true; - _hitGadget = nullptr; - } - - if (doUpdateDisplay) - _vm->screenUpdate(); -} - - -/*****************************************************************************/ -/* Initializes the mouse. */ -/*****************************************************************************/ -void EventManager::initMouse() { - g_system->setMouseCursor(MouseData, MOUSE_WIDTH, MOUSE_HEIGHT, 0, 0, 0); - g_system->showMouse(false); - - setMousePos(Common::Point(0, 0)); -} - - -/*****************************************************************************/ -/* Shows the mouse. */ -/*****************************************************************************/ -void EventManager::mouseShow() { - if (_numHidden) - _numHidden--; - - if ((_numHidden == 0) && _mouseHidden) { - processInput(); - _mouseHidden = false; - } - - g_system->showMouse(true); -} - -/*****************************************************************************/ -/* Hides the mouse. */ -/*****************************************************************************/ -void EventManager::mouseHide() { - _numHidden++; - - if (_numHidden && !_mouseHidden) { - _mouseHidden = true; - - g_system->showMouse(false); - } -} - -/*****************************************************************************/ -/* Gets the current mouse co-ordinates. NOTE: On IBM version, will scale */ -/* from virtual to screen co-ordinates automatically. */ -/*****************************************************************************/ -Common::Point EventManager::getMousePos() { - if (_vm->_isHiRes) - return _mousePos; - else - return Common::Point(_mousePos.x / 2, _mousePos.y); -} - - -/*****************************************************************************/ -/* Moves the mouse to new co-ordinates. */ -/*****************************************************************************/ -void EventManager::setMousePos(Common::Point pos) { - if (_vm->_isHiRes) - g_system->warpMouse(pos.x, pos.y); - else - g_system->warpMouse(pos.x * 2, pos.y); - - if (!_mouseHidden) - processInput(); -} - - -/*****************************************************************************/ -/* Checks whether or not the mouse buttons have been pressed, and the last */ -/* co-ordinates of the button press. leftbutton tells whether to check the */ -/* left or right button. */ -/*****************************************************************************/ -bool EventManager::mouseButton(uint16 *x, uint16 *y, bool leftbutton) { - if (leftbutton) { - if (_leftClick) { - *x = (!_vm->_isHiRes) ? (uint16)_mousePos.x / 2 : (uint16)_mousePos.x; - *y = (uint16)_mousePos.y; - _leftClick = false; - return true; - } - } else { - if (_rightClick) { - *x = (!_vm->_isHiRes) ? (uint16)_mousePos.x / 2 : (uint16)_mousePos.x; - *y = (uint16)_mousePos.y; - _rightClick = false; - return true; - } - } - - return false; -} - -Gadget *EventManager::mouseGadget() { - Gadget *temp = _lastGadgetHit; - - _lastGadgetHit = nullptr; - return temp; -} - -/*****************************************************************************/ -/* Checks whether or not a key has been pressed. */ -/*****************************************************************************/ -bool EventManager::keyPress(uint16 *keyCode) { - if (haveNextChar()) { - *keyCode = getNextChar(); - return true; - } - - return false; -} - -bool EventManager::haveNextChar() { - processInput(); - return _nextKeyIn != _nextKeyOut; -} - -void EventManager::processInput(bool can_delay) { - Common::Event event; - - if (1 /*!g_IgnoreProcessInput*/) { - int flags = 0; - while (g_system->getEventManager()->pollEvent(event)) { - switch (event.type) { - case Common::EVENT_RBUTTONDOWN: - flags |= 8; - mouseHandler(flags, _mousePos); - break; - - case Common::EVENT_LBUTTONDOWN: - flags |= 2; - mouseHandler(flags, _mousePos); - break; - - case Common::EVENT_MOUSEMOVE: { - int lastMouseAtEdge = _mouseAtEdge; - _mouseAtEdge = false; - _mousePos.x = event.mouse.x; - if (event.mouse.x <= 0) { - _mousePos.x = 0; - _mouseAtEdge = true; - } - if (_mousePos.x > _vm->_screenWidth - 1) { - _mousePos.x = _vm->_screenWidth; - _mouseAtEdge = true; - } - - _mousePos.y = event.mouse.y; - if (event.mouse.y <= 0) { - _mousePos.y = 0; - _mouseAtEdge = true; - } - if (_mousePos.y > _vm->_screenHeight - 1) { - _mousePos.y = _vm->_screenHeight; - _mouseAtEdge = true; - } - - if (!lastMouseAtEdge || !_mouseAtEdge) - mouseHandler(1, _mousePos); - } - break; - - case Common::EVENT_KEYDOWN: - switch (event.kbd.keycode) { - case Common::KEYCODE_LEFTBRACKET: - _vm->changeVolume(-1); - break; - - case Common::KEYCODE_RIGHTBRACKET: - _vm->changeVolume(1); - break; - - case Common::KEYCODE_z: - //saveSettings(); - break; - - default: { - int n = ((((unsigned int)((_nextKeyIn + 1) >> 31) >> 26) + (byte)_nextKeyIn + 1) & 0x3F) - - ((unsigned int)((_nextKeyIn + 1) >> 31) >> 26); - if (n != _nextKeyOut) { - _keyBuf[_nextKeyIn] = event.kbd.keycode; - _nextKeyIn = n; - } - } - } - break; - - case Common::EVENT_QUIT: - case Common::EVENT_RTL: - default: - break; - } - - g_system->copyRectToScreen(_vm->_displayBuffer, _vm->_screenWidth, 0, 0, _vm->_screenWidth, _vm->_screenHeight); - g_system->updateScreen(); - } - } - - if (can_delay) - g_system->delayMillis(10); -} - -uint16 EventManager::getNextChar() { - uint16 c = 0; - - processInput(); - if (_nextKeyIn != _nextKeyOut) { - c = _keyBuf[_nextKeyOut]; - _nextKeyOut = ((((unsigned int)((_nextKeyOut + 1) >> 31) >> 26) + (byte)_nextKeyOut + 1) & 0x3F) - - ((unsigned int)((_nextKeyOut + 1) >> 31) >> 26); - } - - return c; -} - -Common::Point EventManager::updateAndGetMousePos() { - processInput(); - - return _mousePos; -} -} // End of namespace Lab diff --git a/engines/lab/mouse.h b/engines/lab/mouse.h deleted file mode 100644 index b3b3e30da3..0000000000 --- a/engines/lab/mouse.h +++ /dev/null @@ -1,83 +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. - * - */ - -/* - * This code is based on Labyrinth of Time code with assistance of - * - * Copyright (c) 1993 Terra Nova Development - * Copyright (c) 2004 The Wyrmkeep Entertainment Co. - * - */ - -#include "common/events.h" - -#ifndef LAB_MOUSE_H -#define LAB_MOUSE_H - -namespace Lab { - -struct Gadget; - -class LabEngine; - -class EventManager { -private: - LabEngine *_vm; - bool _leftClick; - bool _rightClick; - - bool _mouseHidden; - int32 _numHidden; - Gadget *_lastGadgetHit; - uint16 _nextKeyIn; - uint16 _nextKeyOut; - Common::Point _mousePos; - bool _mouseAtEdge; - uint16 _keyBuf[64]; - -public: - EventManager (LabEngine *vm); - - Gadget *_screenGadgetList; - Gadget *_hitGadget; - - Gadget *checkGadgetHit(Gadget *gadgetList, Common::Point pos); - void initMouse(); - void updateMouse(); - void mouseShow(); - void mouseHide(); - Common::Point getMousePos(); - void setMousePos(Common::Point pos); - bool mouseButton(uint16 *x, uint16 *y, bool leftButton); - Gadget *mouseGadget(); - void attachGadgetList(Gadget *gadgetList); - void mouseHandler(int flag, Common::Point pos); - bool keyPress(uint16 *keyCode); - bool haveNextChar(); - void processInput(bool can_delay = false); - uint16 getNextChar(); - Common::Point updateAndGetMousePos(); -}; - -} // End of namespace Lab - -#endif /* LAB_MOUSE_H */ diff --git a/engines/lab/music.cpp b/engines/lab/music.cpp index 7f8df15c35..6a7bb4baea 100644 --- a/engines/lab/music.cpp +++ b/engines/lab/music.cpp @@ -31,7 +31,6 @@ #include "audio/mixer.h" #include "lab/labfun.h" -#include "lab/mouse.h" #include "lab/music.h" #include "lab/lab.h" diff --git a/engines/lab/special.cpp b/engines/lab/special.cpp index 419e0d3a05..401d89766c 100644 --- a/engines/lab/special.cpp +++ b/engines/lab/special.cpp @@ -40,7 +40,6 @@ #include "lab/interface.h" #include "lab/anim.h" #include "lab/text.h" -#include "lab/mouse.h" #include "lab/parsetypes.h" #include "lab/resource.h" diff --git a/engines/lab/vga.cpp b/engines/lab/vga.cpp index 959218e98c..d64953c6b9 100644 --- a/engines/lab/vga.cpp +++ b/engines/lab/vga.cpp @@ -33,7 +33,6 @@ #include "lab/lab.h" #include "lab/image.h" -#include "lab/mouse.h" namespace Lab { -- cgit v1.2.3 From 69bdfae23586a4a03197d0e7b6a722068538ff2f Mon Sep 17 00:00:00 2001 From: Eugene Sandulenko Date: Wed, 2 Dec 2015 20:32:06 +0100 Subject: LAB: Plug memory leak --- engines/lab/engine.cpp | 16 ++++++++++++++++ engines/lab/lab.cpp | 2 +- engines/lab/lab.h | 1 + engines/lab/labsets.cpp | 2 +- 4 files changed, 19 insertions(+), 2 deletions(-) diff --git a/engines/lab/engine.cpp b/engines/lab/engine.cpp index 1823fe6fa5..19948270fb 100644 --- a/engines/lab/engine.cpp +++ b/engines/lab/engine.cpp @@ -309,6 +309,20 @@ bool LabEngine::setUpScreens() { return true; } +void LabEngine::freeScreens() { + for (uint16 i = 0; i < 20; i++) + delete _moveImages[i]; + + if (getPlatform() == Common::kPlatformWindows) { + for (uint16 imgIdx = 0; imgIdx < 10; imgIdx++) + delete _invImages[imgIdx]; + } else { + for (uint16 imgIdx = 0; imgIdx < 6; imgIdx++) + delete _invImages[imgIdx]; + } +} + + /******************************************************************************/ /* Permanently flips the imagery of a gadget. */ /******************************************************************************/ @@ -1302,6 +1316,8 @@ void LabEngine::go() { freeRoomBuffer(); freeBuffer(); + freeScreens(); + _music->freeMusic(); } diff --git a/engines/lab/lab.cpp b/engines/lab/lab.cpp index 1c95746857..ba5efecd2c 100644 --- a/engines/lab/lab.cpp +++ b/engines/lab/lab.cpp @@ -94,7 +94,7 @@ LabEngine::LabEngine(OSystem *syst, const ADGameDescription *gameDesc) for (int i = 0; i < 20; i++) _moveImages[20] = nullptr; - + for (int i = 0; i < 10; i++) _invImages[10] = nullptr; diff --git a/engines/lab/lab.h b/engines/lab/lab.h index 6135f5e9d7..d49481548e 100644 --- a/engines/lab/lab.h +++ b/engines/lab/lab.h @@ -190,6 +190,7 @@ private: // engine.cpp bool setUpScreens(); + void freeScreens(); void perFlipGadget(uint16 gadID); bool doCloseUp(CloseDataPtr cptr); void mainGameLoop(); diff --git a/engines/lab/labsets.cpp b/engines/lab/labsets.cpp index 2ab9abfe4a..21c495d246 100644 --- a/engines/lab/labsets.cpp +++ b/engines/lab/labsets.cpp @@ -34,7 +34,7 @@ namespace Lab { - LargeSet::LargeSet(uint16 last, LabEngine *vm) : _vm(vm) { +LargeSet::LargeSet(uint16 last, LabEngine *vm) : _vm(vm) { last = (((last + 15) >> 4) << 4); _array = (uint16 *)calloc(last >> 3, 2); -- cgit v1.2.3 From 38ed7f930f3ce409a8f8927aa895ec684c748345 Mon Sep 17 00:00:00 2001 From: Eugene Sandulenko Date: Wed, 2 Dec 2015 20:36:43 +0100 Subject: LAB: Renames and moved static variables to class --- engines/lab/lab.cpp | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/engines/lab/lab.cpp b/engines/lab/lab.cpp index ba5efecd2c..6dc88004bd 100644 --- a/engines/lab/lab.cpp +++ b/engines/lab/lab.cpp @@ -104,6 +104,16 @@ LabEngine::LabEngine(OSystem *syst, const ADGameDescription *gameDesc) _nextFileName = nullptr; _newFileName = nullptr; + for (int i = 0; i < 20; i++) + _moveImages[i] = 0; + + for (int i = 0; i < 10; i++) + _invImages[10] = 0; + + _moveGadgetList = 0; + _invGadgetList = 0; + + //const Common::FSNode gameDataDir(ConfMan.get("path")); //SearchMan.addSubDirectoryMatching(gameDataDir, "game"); //SearchMan.addSubDirectoryMatching(gameDataDir, "game/pict"); -- cgit v1.2.3 From 44e098b06de2aa30fae873c4dcc1fc5fb39a8af1 Mon Sep 17 00:00:00 2001 From: Eugene Sandulenko Date: Wed, 2 Dec 2015 20:45:22 +0100 Subject: LAB: More renames --- engines/lab/engine.cpp | 4 ++-- engines/lab/lab.cpp | 1 + engines/lab/lab.h | 1 + engines/lab/processroom.cpp | 2 +- 4 files changed, 5 insertions(+), 3 deletions(-) diff --git a/engines/lab/engine.cpp b/engines/lab/engine.cpp index 19948270fb..da8197ec2f 100644 --- a/engines/lab/engine.cpp +++ b/engines/lab/engine.cpp @@ -421,11 +421,11 @@ bool LabEngine::doCloseUp(CloseDataPtr closePtr) { /******************************************************************************/ /* Gets the current inventory name. */ /******************************************************************************/ -static const char *getInvName(uint16 CurInv) { +const char *LabEngine::getInvName(uint16 CurInv) { if (MainDisplay) return Inventory[CurInv].BInvName; - if ((CurInv == LAMPNUM) && g_lab->_conditions->in(LAMPON)) + if ((CurInv == LAMPNUM) && _conditions->in(LAMPON)) return "P:Mines/120"; if ((CurInv == BELTNUM) && g_lab->_conditions->in(BELTGLOW)) diff --git a/engines/lab/lab.cpp b/engines/lab/lab.cpp index 6dc88004bd..f741476924 100644 --- a/engines/lab/lab.cpp +++ b/engines/lab/lab.cpp @@ -113,6 +113,7 @@ LabEngine::LabEngine(OSystem *syst, const ADGameDescription *gameDesc) _moveGadgetList = 0; _invGadgetList = 0; + _curFileName = " "; //const Common::FSNode gameDataDir(ConfMan.get("path")); //SearchMan.addSubDirectoryMatching(gameDataDir, "game"); diff --git a/engines/lab/lab.h b/engines/lab/lab.h index d49481548e..faedce94ec 100644 --- a/engines/lab/lab.h +++ b/engines/lab/lab.h @@ -197,6 +197,7 @@ private: bool doUse(uint16 curInv); void mayShowCrumbIndicator(); void mayShowCrumbIndicatorOff(); + const char *getInvName(uint16 curInv); }; extern LabEngine *g_lab; diff --git a/engines/lab/processroom.cpp b/engines/lab/processroom.cpp index 3eeb00da54..9f2948b265 100644 --- a/engines/lab/processroom.cpp +++ b/engines/lab/processroom.cpp @@ -322,7 +322,7 @@ bool takeItem(uint16 x, uint16 y, CloseDataPtr *cptr) { /*****************************************************************************/ /* Processes the action list. */ /*****************************************************************************/ -static void doActions(Action * APtr, CloseDataPtr *LCPtr) { +static void doActions(Action *APtr, CloseDataPtr *LCPtr) { CloseDataPtr TLCPtr; bool FirstLoaded = true; char **str, *Test; -- cgit v1.2.3 From a8b6003751087e922f11b6c750ddbf45b305a119 Mon Sep 17 00:00:00 2001 From: Eugene Sandulenko Date: Wed, 2 Dec 2015 20:50:12 +0100 Subject: LAB: Merged in allocroom.cpp --- engines/lab/allocroom.cpp | 69 ----------------------------------------------- engines/lab/engine.cpp | 32 ++++++++++++++++++++++ engines/lab/module.mk | 1 - 3 files changed, 32 insertions(+), 70 deletions(-) delete mode 100644 engines/lab/allocroom.cpp diff --git a/engines/lab/allocroom.cpp b/engines/lab/allocroom.cpp deleted file mode 100644 index 22617cb774..0000000000 --- a/engines/lab/allocroom.cpp +++ /dev/null @@ -1,69 +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. - * - */ - -/* - * This code is based on Labyrinth of Time code with assistance of - * - * Copyright (c) 1993 Terra Nova Development - * Copyright (c) 2004 The Wyrmkeep Entertainment Co. - * - */ - -#include "lab/parsetypes.h" - -namespace Lab { - -/* Have to make sure that ROOMBUFFERSIZE is bigger than the biggest piece of memory - that we need */ -#define ROOMBUFFERSIZE (2 * 20480L) - -extern RoomData *_rooms; - -static void *_roomBuffer = nullptr; -static uint16 _curMarker = 0; -static void *_memPlace = nullptr; - -/*****************************************************************************/ -/* Allocates the memory for the room buffers. */ -/*****************************************************************************/ -bool initRoomBuffer() { - _curMarker = 0; - - if ((_roomBuffer = calloc(ROOMBUFFERSIZE, 1))) { - _memPlace = _roomBuffer; - - return true; - } else - return false; -} - -/*****************************************************************************/ -/* Frees the memory for the room buffers. */ -/*****************************************************************************/ -void freeRoomBuffer() { - if (_roomBuffer) { - free(_roomBuffer); - _roomBuffer = nullptr; - } -} - -} // End of namespace Lab diff --git a/engines/lab/engine.cpp b/engines/lab/engine.cpp index da8197ec2f..1b9a45b0f7 100644 --- a/engines/lab/engine.cpp +++ b/engines/lab/engine.cpp @@ -1416,4 +1416,36 @@ void LabEngine::mayShowCrumbIndicatorOff() { } } +/* Have to make sure that ROOMBUFFERSIZE is bigger than the biggest piece of memory + that we need */ +#define ROOMBUFFERSIZE (2 * 20480L) + +static void *_roomBuffer = nullptr; +static uint16 _curMarker = 0; +static void *_memPlace = nullptr; + +/*****************************************************************************/ +/* Allocates the memory for the room buffers. */ +/*****************************************************************************/ +bool initRoomBuffer() { + _curMarker = 0; + + if ((_roomBuffer = calloc(ROOMBUFFERSIZE, 1))) { + _memPlace = _roomBuffer; + + return true; + } else + return false; +} + +/*****************************************************************************/ +/* Frees the memory for the room buffers. */ +/*****************************************************************************/ +void freeRoomBuffer() { + if (_roomBuffer) { + free(_roomBuffer); + _roomBuffer = nullptr; + } +} + } // End of namespace Lab diff --git a/engines/lab/module.mk b/engines/lab/module.mk index 67d6b286d5..18bb7e6916 100644 --- a/engines/lab/module.mk +++ b/engines/lab/module.mk @@ -1,7 +1,6 @@ MODULE := engines/lab MODULE_OBJS := \ - allocroom.o \ anim.o \ detection.o \ engine.o \ -- cgit v1.2.3 From d1e8e6dfbd5daf507fc837c10f0830adabb280ce Mon Sep 17 00:00:00 2001 From: Eugene Sandulenko Date: Thu, 3 Dec 2015 02:06:39 +0100 Subject: LAB: Fix bug during initialization --- engines/lab/lab.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/engines/lab/lab.cpp b/engines/lab/lab.cpp index f741476924..944689b33b 100644 --- a/engines/lab/lab.cpp +++ b/engines/lab/lab.cpp @@ -93,10 +93,10 @@ LabEngine::LabEngine(OSystem *syst, const ADGameDescription *gameDesc) _alternate = false; for (int i = 0; i < 20; i++) - _moveImages[20] = nullptr; + _moveImages[i] = nullptr; for (int i = 0; i < 10; i++) - _invImages[10] = nullptr; + _invImages[i] = nullptr; _moveGadgetList = nullptr; _invGadgetList = nullptr; -- cgit v1.2.3 From 5c246e4189317a8ffa9e5af306b56320e8295b2e Mon Sep 17 00:00:00 2001 From: Eugene Sandulenko Date: Thu, 3 Dec 2015 02:10:28 +0100 Subject: LAB: Remove leftover after rebase/merge --- engines/lab/lab.cpp | 6 ------ 1 file changed, 6 deletions(-) diff --git a/engines/lab/lab.cpp b/engines/lab/lab.cpp index 944689b33b..3e38b69ff0 100644 --- a/engines/lab/lab.cpp +++ b/engines/lab/lab.cpp @@ -104,12 +104,6 @@ LabEngine::LabEngine(OSystem *syst, const ADGameDescription *gameDesc) _nextFileName = nullptr; _newFileName = nullptr; - for (int i = 0; i < 20; i++) - _moveImages[i] = 0; - - for (int i = 0; i < 10; i++) - _invImages[10] = 0; - _moveGadgetList = 0; _invGadgetList = 0; -- cgit v1.2.3 From 646c29d5a34fa85c7dd6915de31c28465e7797a1 Mon Sep 17 00:00:00 2001 From: Eugene Sandulenko Date: Thu, 3 Dec 2015 11:01:50 +0100 Subject: LAB: Renames and moved vars to classes --- engines/lab/engine.cpp | 18 ++--- engines/lab/graphics.cpp | 30 ++++---- engines/lab/lab.cpp | 3 + engines/lab/lab.h | 10 ++- engines/lab/map.cpp | 10 ++- engines/lab/parsefun.h | 14 ++-- engines/lab/processroom.cpp | 172 ++++++++++++++++++++++---------------------- engines/lab/savegame.cpp | 10 +-- engines/lab/special.cpp | 1 - 9 files changed, 132 insertions(+), 136 deletions(-) diff --git a/engines/lab/engine.cpp b/engines/lab/engine.cpp index 1b9a45b0f7..33a642247d 100644 --- a/engines/lab/engine.cpp +++ b/engines/lab/engine.cpp @@ -40,10 +40,6 @@ namespace Lab { -bool LongWinInFront = false; - -TextFont *MsgFont; - extern bool stopsound, DoNotDrawMessage; /* Global parser data */ @@ -468,7 +464,7 @@ void LabEngine::interfaceOn() { _event->mouseShow(); } - if (LongWinInFront) + if (_longWinInFront) _event->attachGadgetList(NULL); else if (_alternate) _event->attachGadgetList(_invGadgetList); @@ -608,7 +604,7 @@ void LabEngine::mainGameLoop() { _conditions->readInitialConditions("LAB:Conditio"); - LongWinInFront = false; + _longWinInFront = false; drawPanel(); perFlipGadget(actionMode); @@ -758,7 +754,7 @@ bool LabEngine::from_crumbs(uint32 tmpClass, uint16 code, uint16 Qualifier, Comm _anim->_doBlack = false; - if ((msgClass == RAWKEY) && (!LongWinInFront)) { + if ((msgClass == RAWKEY) && (!_longWinInFront)) { if (code == 13) { /* The return key */ msgClass = MOUSEBUTTONS; Qualifier = IEQUALIFIER_LEFTBUTTON; @@ -846,12 +842,12 @@ bool LabEngine::from_crumbs(uint32 tmpClass, uint16 code, uint16 Qualifier, Comm eatMessages(); } - if (LongWinInFront) { + if (_longWinInFront) { if ((msgClass == RAWKEY) || ((msgClass == MOUSEBUTTONS) && ((IEQUALIFIER_LEFTBUTTON & Qualifier) || (IEQUALIFIER_RBUTTON & Qualifier)))) { - LongWinInFront = false; + _longWinInFront = false; DoNotDrawMessage = false; drawPanel(); drawRoomMessage(curInv, CPtr); @@ -1274,7 +1270,7 @@ void LabEngine::go() { if (!doIntro) _music->initMusic(); - MsgFont = _resource->getFont("P:AvanteG.12"); + _msgFont = _resource->getFont("P:AvanteG.12"); _event->mouseHide(); @@ -1311,7 +1307,7 @@ void LabEngine::go() { } } - closeFont(MsgFont); + closeFont(_msgFont); freeRoomBuffer(); freeBuffer(); diff --git a/engines/lab/graphics.cpp b/engines/lab/graphics.cpp index 4c2d3d7019..6fa29d8fdf 100644 --- a/engines/lab/graphics.cpp +++ b/engines/lab/graphics.cpp @@ -42,8 +42,6 @@ namespace Lab { BitMap bit1, bit2, *DispBitMap = &bit1, *DrawBitMap = &bit1; extern bool stopsound; -extern TextFont *MsgFont; - /*****************************************************************************/ /* Scales the x co-ordinates to that of the new display. In the room parser */ @@ -194,8 +192,6 @@ byte *readPictToMem(const char *filename, uint16 x, uint16 y) { /*---------------------------------------------------------------------------*/ bool DoNotDrawMessage = false; -extern bool LongWinInFront, Alternate; - /*----- The flowText routines -----*/ /******************************************************************************/ @@ -266,7 +262,7 @@ uint32 flowText(void *font, /* the TextAttr pointer */ bool output, /* Whether to output any text */ uint16 x1, /* Cords */ uint16 y1, uint16 x2, uint16 y2, const char *str) { /* The text itself */ - TextFont *msgfont = (TextFont *)font; + TextFont *_msgFont = (TextFont *)font; char linebuffer[256]; const char *temp; uint16 numlines, actlines, fontheight, width; @@ -282,7 +278,7 @@ uint32 flowText(void *font, /* the TextAttr pointer */ g_lab->setAPen(pencolor); - fontheight = textHeight(msgfont) + spacing; + fontheight = textHeight(_msgFont) + spacing; numlines = (y2 - y1 + 1) / fontheight; width = x2 - x1 + 1; y = y1; @@ -292,7 +288,7 @@ uint32 flowText(void *font, /* the TextAttr pointer */ actlines = 0; while (temp[0]) { - getLine(msgfont, linebuffer, &temp, width); + getLine(_msgFont, linebuffer, &temp, width); actlines++; } @@ -303,15 +299,15 @@ uint32 flowText(void *font, /* the TextAttr pointer */ temp = str; while (numlines && str[0]) { - getLine(msgfont, linebuffer, &str, width); + getLine(_msgFont, linebuffer, &str, width); x = x1; if (centerh) - x += (width - textLength(msgfont, linebuffer, strlen(linebuffer))) / 2; + x += (width - textLength(_msgFont, linebuffer, strlen(linebuffer))) / 2; if (output) - text(msgfont, x, y, pencolor, linebuffer, strlen(linebuffer)); + text(_msgFont, x, y, pencolor, linebuffer, strlen(linebuffer)); numlines--; y += fontheight; @@ -370,8 +366,8 @@ int32 LabEngine::longDrawMessage(const char *str) { _event->mouseHide(); strcpy(newText, str); - if (!LongWinInFront) { - LongWinInFront = true; + if (!_longWinInFront) { + _longWinInFront = true; setAPen(3); /* Clear Area */ rectFill(0, VGAScaleY(149) + SVGACord(2), VGAScaleX(319), VGAScaleY(199)); } @@ -379,7 +375,7 @@ int32 LabEngine::longDrawMessage(const char *str) { createBox(198); _event->mouseShow(); - return flowText(MsgFont, 0, 1, 7, false, true, true, true, VGAScaleX(6), VGAScaleY(155), VGAScaleX(313), VGAScaleY(195), str); + return flowText(_msgFont, 0, 1, 7, false, true, true, true, VGAScaleX(6), VGAScaleY(155), VGAScaleX(313), VGAScaleY(195), str); } void LabEngine::drawStaticMessage(byte index) { @@ -396,18 +392,18 @@ void LabEngine::drawMessage(const char *str) { } if (str) { - if ((textLength(MsgFont, str, strlen(str)) > VGAScaleX(306))) { + if ((textLength(_msgFont, str, strlen(str)) > VGAScaleX(306))) { longDrawMessage(str); _lastMessageLong = true; } else { - if (LongWinInFront) { - LongWinInFront = false; + if (_longWinInFront) { + _longWinInFront = false; drawPanel(); } _event->mouseHide(); createBox(168); - text(MsgFont, VGAScaleX(7), VGAScaleY(155) + SVGACord(2), 1, str, strlen(str)); + text(_msgFont, VGAScaleX(7), VGAScaleY(155) + SVGACord(2), 1, str, strlen(str)); _event->mouseShow(); _lastMessageLong = false; } diff --git a/engines/lab/lab.cpp b/engines/lab/lab.cpp index 3e38b69ff0..7bb05c8969 100644 --- a/engines/lab/lab.cpp +++ b/engines/lab/lab.cpp @@ -109,6 +109,9 @@ LabEngine::LabEngine(OSystem *syst, const ADGameDescription *gameDesc) _curFileName = " "; + _longWinInFront = false; + _msgFont = 0; + //const Common::FSNode gameDataDir(ConfMan.get("path")); //SearchMan.addSubDirectoryMatching(gameDataDir, "game"); //SearchMan.addSubDirectoryMatching(gameDataDir, "game/pict"); diff --git a/engines/lab/lab.h b/engines/lab/lab.h index faedce94ec..3e96d04241 100644 --- a/engines/lab/lab.h +++ b/engines/lab/lab.h @@ -130,6 +130,10 @@ private: int _lastWaitTOFTicks; bool _lastMessageLong; bool _lastTooLong; + TextFont *_msgFont; + +public: + bool _longWinInFront; private: bool createScreen(bool HiRes); @@ -161,8 +165,8 @@ public: void doScrollBlack(); void doScrollWipe(char *filename); void doScrollBounce(); - void doWipe(uint16 WipeType, CloseDataPtr *CPtr, char *filename); - void doTransWipe(CloseDataPtr *CPtr, char *filename); + void doWipe(uint16 WipeType, CloseDataPtr *cPtr, char *filename); + void doTransWipe(CloseDataPtr *cPtr, char *filename); Gadget *checkNumGadgetHit(Gadget *gadlist, uint16 key); IntuiMessage *getMsg(); void drawMap(uint16 CurRoom, uint16 CurMsg, uint16 Floor, bool fadeout, bool fadein); @@ -176,7 +180,7 @@ public: void doMonitor(char *background, char *textfile, bool isinteractive, uint16 x1, uint16 y1, uint16 x2, uint16 y2); void eatMessages(); void drawStaticMessage(byte index); - void drawDirection(CloseDataPtr LCPtr); + void drawDirection(CloseDataPtr lcPtr); int followCrumbs(); void changeVolume(int delta); diff --git a/engines/lab/map.cpp b/engines/lab/map.cpp index efc1825b4b..05c60b1094 100644 --- a/engines/lab/map.cpp +++ b/engines/lab/map.cpp @@ -81,8 +81,6 @@ static MapData *Maps; extern char *LOWERFLOORS, *MIDDLEFLOORS, *UPPERFLOORS, *MEDMAZEFLOORS, *HEDGEMAZEFLOORS, *SURMAZEFLOORS, *CARNIVALFLOOR, *SURMAZEMSG; -extern TextFont *MsgFont; - uint16 *FadePalette; static uint16 MapGadX[3] = {101, 55, 8}, MapGadY[3] = {105, 105, 105}; @@ -550,7 +548,7 @@ void LabEngine::drawMap(uint16 CurRoom, uint16 CurMsg, uint16 Floor, bool fadeou HugeMaze->drawImage(mapScaleX(524), mapScaleY(97)); } else if (Floor == SURMAZEFLOOR) { sptr = (char *)_resource->getStaticText(kTextSurmazeMessage).c_str(); - flowText(MsgFont, 0, 7, 0, true, true, true, true, mapScaleX(360), 0, mapScaleX(660), mapScaleY(450), sptr); + flowText(_msgFont, 0, 7, 0, true, true, true, true, mapScaleX(360), 0, mapScaleX(660), mapScaleY(450), sptr); } switch (Floor) { @@ -581,10 +579,10 @@ void LabEngine::drawMap(uint16 CurRoom, uint16 CurMsg, uint16 Floor, bool fadeou } if (sptr) - flowText(MsgFont, 0, 5, 3, true, true, true, true, VGAScaleX(14), VGAScaleY(75), VGAScaleX(134), VGAScaleY(97), sptr); + flowText(_msgFont, 0, 5, 3, true, true, true, true, VGAScaleX(14), VGAScaleY(75), VGAScaleX(134), VGAScaleY(97), sptr); if ((sptr = _rooms[CurMsg]._roomMsg)) - flowText(MsgFont, 0, 5, 3, true, true, true, true, VGAScaleX(14), VGAScaleY(148), VGAScaleX(134), VGAScaleY(186), sptr); + flowText(_msgFont, 0, 5, 3, true, true, true, true, VGAScaleX(14), VGAScaleY(148), VGAScaleX(134), VGAScaleY(186), sptr); if (fadein) fade(true, 0); @@ -739,7 +737,7 @@ void LabEngine::processMap(uint16 CurRoom) { _event->mouseHide(); setAPen(3); rectFill(VGAScaleX(13), VGAScaleY(148), VGAScaleX(135), VGAScaleY(186)); - flowText(MsgFont, 0, 5, 3, true, true, true, true, VGAScaleX(14), VGAScaleY(148), VGAScaleX(134), VGAScaleY(186), sptr); + flowText(_msgFont, 0, 5, 3, true, true, true, true, VGAScaleX(14), VGAScaleY(148), VGAScaleX(134), VGAScaleY(186), sptr); if (Maps[OldMsg].PageNumber == CurFloor) drawRoom(OldMsg, (bool)(OldMsg == CurRoom)); diff --git a/engines/lab/parsefun.h b/engines/lab/parsefun.h index 46c26b67d4..37ff977851 100644 --- a/engines/lab/parsefun.h +++ b/engines/lab/parsefun.h @@ -49,16 +49,16 @@ void freeRoomBuffer(); /* From ProcessRoom.c */ ViewData *getViewData(uint16 RoomNum, uint16 Direction); -char *getPictName(CloseDataPtr *LCPtr); -void drawDirection(CloseDataPtr LCPtr); +char *getPictName(CloseDataPtr *lcptr); +void drawDirection(CloseDataPtr lcptr); bool processArrow(uint16 *Direction, uint16 Arrow); void setCurClose(Common::Point pos, CloseDataPtr *cptr, bool useAbsoluteCoords = false); bool takeItem(uint16 x, uint16 y, CloseDataPtr *cptr); -bool doActionRule(Common::Point pos, int16 action, int16 RoomNum, CloseDataPtr *LCPtr); -bool doOperateRule(int16 x, int16 y, int16 ItemNum, CloseDataPtr *LCPtr); -bool doGoForward(CloseDataPtr *LCPtr); -bool doTurn(uint16 from, uint16 to, CloseDataPtr *LCPtr); -bool doMainView(CloseDataPtr *LCPtr); +bool doActionRule(Common::Point pos, int16 action, int16 RoomNum, CloseDataPtr *lcptr); +bool doOperateRule(int16 x, int16 y, int16 ItemNum, CloseDataPtr *lcptr); +bool doGoForward(CloseDataPtr *lcptr); +bool doTurn(uint16 from, uint16 to, CloseDataPtr *lcptr); +bool doMainView(CloseDataPtr *lcptr); } // End of namespace Lab diff --git a/engines/lab/processroom.cpp b/engines/lab/processroom.cpp index 9f2948b265..30f26d4605 100644 --- a/engines/lab/processroom.cpp +++ b/engines/lab/processroom.cpp @@ -48,7 +48,7 @@ RoomData *_rooms; InventoryData *Inventory; uint16 NumInv, ManyRooms, HighestCondition, Direction; -extern bool DoNotDrawMessage, noupdatediff, QuitLab, MusicOn, LongWinInFront; +extern bool DoNotDrawMessage, noupdatediff, QuitLab, MusicOn; extern CloseDataPtr CPtr; /*****************************************************************************/ @@ -116,24 +116,24 @@ ViewData *getViewData(uint16 roomNum, uint16 direction) { /*****************************************************************************/ /* Gets an object, if any, from the user's click on the screen. */ /*****************************************************************************/ -static CloseData *getObject(uint16 x, uint16 y, CloseDataPtr LCPtr) { +static CloseData *getObject(uint16 x, uint16 y, CloseDataPtr lcptr) { ViewData *VPtr; - if (LCPtr == NULL) { + if (lcptr == NULL) { VPtr = getViewData(g_lab->_roomNum, Direction); - LCPtr = VPtr->closeUps; + lcptr = VPtr->closeUps; } else - LCPtr = LCPtr->SubCloseUps; + lcptr = lcptr->SubCloseUps; - while (LCPtr != NULL) { - if ((x >= scaleX(LCPtr->x1)) && (y >= scaleY(LCPtr->y1)) && - (x <= scaleX(LCPtr->x2)) && (y <= scaleY(LCPtr->y2))) - return LCPtr; + while (lcptr != NULL) { + if ((x >= scaleX(lcptr->x1)) && (y >= scaleY(lcptr->y1)) && + (x <= scaleX(lcptr->x2)) && (y <= scaleY(lcptr->y2))) + return lcptr; - LCPtr = LCPtr->NextCloseUp; + lcptr = lcptr->NextCloseUp; } return NULL; @@ -168,14 +168,14 @@ static CloseDataPtr findCPtrMatch(CloseDataPtr Main, CloseDataPtr List) { /*****************************************************************************/ /* Returns the current picture name. */ /*****************************************************************************/ -char *getPictName(CloseDataPtr *LCPtr) { +char *getPictName(CloseDataPtr *lcptr) { ViewData *ViewPtr = getViewData(g_lab->_roomNum, Direction); - if (*LCPtr != NULL) { - *LCPtr = findCPtrMatch(*LCPtr, ViewPtr->closeUps); + if (*lcptr != NULL) { + *lcptr = findCPtrMatch(*lcptr, ViewPtr->closeUps); - if (*LCPtr) - return (*LCPtr)->GraphicName; + if (*lcptr) + return (*lcptr)->GraphicName; } return ViewPtr->GraphicName; @@ -184,9 +184,9 @@ char *getPictName(CloseDataPtr *LCPtr) { /*****************************************************************************/ /* Draws the current direction to the screen. */ /*****************************************************************************/ -void LabEngine::drawDirection(CloseDataPtr LCPtr) { - if (LCPtr != NULL && LCPtr->Message) { - drawMessage(LCPtr->Message); +void LabEngine::drawDirection(CloseDataPtr lcptr) { + if (lcptr != NULL && lcptr->Message) { + drawMessage(lcptr->Message); return; } @@ -257,34 +257,34 @@ bool processArrow(uint16 *direction, uint16 Arrow) { /*****************************************************************************/ void setCurClose(Common::Point pos, CloseDataPtr *cptr, bool useAbsoluteCoords) { ViewData *VPtr; - CloseDataPtr LCPtr; + CloseDataPtr lcptr; uint16 x1, y1, x2, y2; if (*cptr == NULL) { VPtr = getViewData(g_lab->_roomNum, Direction); - LCPtr = VPtr->closeUps; + lcptr = VPtr->closeUps; } else - LCPtr = (*cptr)->SubCloseUps; + lcptr = (*cptr)->SubCloseUps; - while (LCPtr != NULL) { + while (lcptr != NULL) { if (!useAbsoluteCoords) { - x1 = LCPtr->x1; - y1 = LCPtr->y1; - x2 = LCPtr->x2; - y2 = LCPtr->y2; + x1 = lcptr->x1; + y1 = lcptr->y1; + x2 = lcptr->x2; + y2 = lcptr->y2; } else { - x1 = scaleX(LCPtr->x1); - y1 = scaleY(LCPtr->y1); - x2 = scaleX(LCPtr->x2); - y2 = scaleY(LCPtr->y2); + x1 = scaleX(lcptr->x1); + y1 = scaleY(lcptr->y1); + x2 = scaleX(lcptr->x2); + y2 = scaleY(lcptr->y2); } - if (pos.x >= x1 && pos.y >= y1 && pos.x <= x2 && pos.y <= y2 && LCPtr->GraphicName) { - *cptr = LCPtr; + if (pos.x >= x1 && pos.y >= y1 && pos.x <= x2 && pos.y <= y2 && lcptr->GraphicName) { + *cptr = lcptr; return; } - LCPtr = LCPtr->NextCloseUp; + lcptr = lcptr->NextCloseUp; } } @@ -293,27 +293,27 @@ void setCurClose(Common::Point pos, CloseDataPtr *cptr, bool useAbsoluteCoords) /*****************************************************************************/ bool takeItem(uint16 x, uint16 y, CloseDataPtr *cptr) { ViewData *VPtr; - CloseDataPtr LCPtr; + CloseDataPtr lcptr; if (*cptr == NULL) { VPtr = getViewData(g_lab->_roomNum, Direction); - LCPtr = VPtr->closeUps; + lcptr = VPtr->closeUps; } else if ((*cptr)->CloseUpType < 0) { g_lab->_conditions->inclElement(abs((*cptr)->CloseUpType)); return true; } else - LCPtr = (*cptr)->SubCloseUps; + lcptr = (*cptr)->SubCloseUps; - while (LCPtr != NULL) { - if ((x >= scaleX(LCPtr->x1)) && (y >= scaleY(LCPtr->y1)) && - (x <= scaleX(LCPtr->x2)) && (y <= scaleY(LCPtr->y2)) && - (LCPtr->CloseUpType < 0)) { - g_lab->_conditions->inclElement(abs(LCPtr->CloseUpType)); + while (lcptr != NULL) { + if ((x >= scaleX(lcptr->x1)) && (y >= scaleY(lcptr->y1)) && + (x <= scaleX(lcptr->x2)) && (y <= scaleY(lcptr->y2)) && + (lcptr->CloseUpType < 0)) { + g_lab->_conditions->inclElement(abs(lcptr->CloseUpType)); return true; } - LCPtr = LCPtr->NextCloseUp; + lcptr = lcptr->NextCloseUp; } return false; @@ -322,8 +322,8 @@ bool takeItem(uint16 x, uint16 y, CloseDataPtr *cptr) { /*****************************************************************************/ /* Processes the action list. */ /*****************************************************************************/ -static void doActions(Action *APtr, CloseDataPtr *LCPtr) { - CloseDataPtr TLCPtr; +static void doActions(Action *APtr, CloseDataPtr *lcptr) { + CloseDataPtr tlcptr; bool FirstLoaded = true; char **str, *Test; uint32 StartSecs, StartMicros, CurSecs, CurMicros; @@ -371,7 +371,7 @@ static void doActions(Action *APtr, CloseDataPtr *LCPtr) { break; case WIPECMD: - g_lab->doWipe(APtr->Param1, LCPtr, (char *)APtr->Data); + g_lab->doWipe(APtr->Param1, lcptr, (char *)APtr->Data); break; case NOUPDATE: @@ -384,7 +384,7 @@ static void doActions(Action *APtr, CloseDataPtr *LCPtr) { break; case SHOWCURPICT: - Test = getPictName(LCPtr); + Test = getPictName(lcptr); if (strcmp(Test, g_lab->_curFileName) != 0) { g_lab->_curFileName = Test; @@ -404,7 +404,7 @@ static void doActions(Action *APtr, CloseDataPtr *LCPtr) { case SHOWMESSAGE: DoNotDrawMessage = false; - if (LongWinInFront) + if (g_lab->_longWinInFront) g_lab->longDrawMessage((char *)APtr->Data); else g_lab->drawMessage((char *)APtr->Data); @@ -413,7 +413,7 @@ static void doActions(Action *APtr, CloseDataPtr *LCPtr) { break; case CSHOWMESSAGE: - if (*LCPtr == NULL) { + if (*lcptr == NULL) { DoNotDrawMessage = false; g_lab->drawMessage((char *)APtr->Data); DoNotDrawMessage = true; @@ -432,7 +432,7 @@ static void doActions(Action *APtr, CloseDataPtr *LCPtr) { if (APtr->Param1 & 0x8000) { // This is a Wyrmkeep Windows trial version, thus stop at this // point, since we can't check for game payment status - readPict(getPictName(LCPtr), true); + readPict(getPictName(lcptr), true); APtr = NULL; GUI::MessageDialog trialMessage("This is the end of the trial version. You can play the full game using the original interpreter from Wyrmkeep"); trialMessage.runModal(); @@ -441,20 +441,20 @@ static void doActions(Action *APtr, CloseDataPtr *LCPtr) { g_lab->_roomNum = APtr->Param1; Direction = APtr->Param2 - 1; - *LCPtr = NULL; + *lcptr = NULL; g_lab->_anim->_doBlack = true; break; case SETCLOSEUP: - TLCPtr = getObject(scaleX(APtr->Param1), scaleY(APtr->Param2), *LCPtr); + tlcptr = getObject(scaleX(APtr->Param1), scaleY(APtr->Param2), *lcptr); - if (TLCPtr) - *LCPtr = TLCPtr; + if (tlcptr) + *lcptr = tlcptr; break; case MAINVIEW: - *LCPtr = NULL; + *lcptr = NULL; break; case SUBINV: @@ -603,10 +603,10 @@ static void doActions(Action *APtr, CloseDataPtr *LCPtr) { /*****************************************************************************/ /* Does the work for doActionRule. */ /*****************************************************************************/ -static bool doActionRuleSub(int16 action, int16 roomNum, CloseDataPtr LCPtr, CloseDataPtr *Set, bool AllowDefaults) { +static bool doActionRuleSub(int16 action, int16 roomNum, CloseDataPtr lcptr, CloseDataPtr *Set, bool AllowDefaults) { action++; - if (LCPtr) { + if (lcptr) { RuleList *rules = _rooms[g_lab->_roomNum]._rules; if ((rules == NULL) && (roomNum == 0)) { @@ -617,10 +617,10 @@ static bool doActionRuleSub(int16 action, int16 roomNum, CloseDataPtr LCPtr, Clo for (RuleList::iterator rule = rules->begin(); rule != rules->end(); ++rule) { if (((*rule)->RuleType == ACTION) && (((*rule)->Param1 == action) || (((*rule)->Param1 == 0) && AllowDefaults))) { - if ((((*rule)->Param2 == LCPtr->CloseUpType) || + if ((((*rule)->Param2 == lcptr->CloseUpType) || (((*rule)->Param2 == 0) && AllowDefaults)) || - ((action == 1) && ((*rule)->Param2 == (-LCPtr->CloseUpType)))) { + ((action == 1) && ((*rule)->Param2 == (-lcptr->CloseUpType)))) { if (checkConditions((*rule)->Condition)) { doActions((*rule)->ActionList, Set); return true; @@ -636,23 +636,23 @@ static bool doActionRuleSub(int16 action, int16 roomNum, CloseDataPtr LCPtr, Clo /*****************************************************************************/ /* Goes through the rules if an action is taken. */ /*****************************************************************************/ -bool doActionRule(Common::Point pos, int16 action, int16 roomNum, CloseDataPtr *LCPtr) { - CloseDataPtr TLCPtr; +bool doActionRule(Common::Point pos, int16 action, int16 roomNum, CloseDataPtr *lcptr) { + CloseDataPtr tlcptr; if (roomNum) g_lab->_newFileName = NOFILE; else g_lab->_newFileName = g_lab->_curFileName; - TLCPtr = getObject(pos.x, pos.y, *LCPtr); + tlcptr = getObject(pos.x, pos.y, *lcptr); - if (doActionRuleSub(action, roomNum, TLCPtr, LCPtr, false)) + if (doActionRuleSub(action, roomNum, tlcptr, lcptr, false)) return true; - else if (doActionRuleSub(action, roomNum, *LCPtr, LCPtr, false)) + else if (doActionRuleSub(action, roomNum, *lcptr, lcptr, false)) return true; - else if (doActionRuleSub(action, roomNum, TLCPtr, LCPtr, true)) + else if (doActionRuleSub(action, roomNum, tlcptr, lcptr, true)) return true; - else if (doActionRuleSub(action, roomNum, *LCPtr, LCPtr, true)) + else if (doActionRuleSub(action, roomNum, *lcptr, lcptr, true)) return true; return false; @@ -661,9 +661,9 @@ bool doActionRule(Common::Point pos, int16 action, int16 roomNum, CloseDataPtr * /*****************************************************************************/ /* Does the work for doActionRule. */ /*****************************************************************************/ -static bool doOperateRuleSub(int16 ItemNum, int16 roomNum, CloseDataPtr LCPtr, CloseDataPtr *Set, bool AllowDefaults) { - if (LCPtr) - if (LCPtr->CloseUpType > 0) { +static bool doOperateRuleSub(int16 ItemNum, int16 roomNum, CloseDataPtr lcptr, CloseDataPtr *Set, bool AllowDefaults) { + if (lcptr) + if (lcptr->CloseUpType > 0) { RuleList *rules = _rooms[roomNum]._rules; if ((rules == NULL) && (roomNum == 0)) { @@ -674,7 +674,7 @@ static bool doOperateRuleSub(int16 ItemNum, int16 roomNum, CloseDataPtr LCPtr, C for (RuleList::iterator rule = rules->begin(); rule != rules->end(); ++rule) { if (((*rule)->RuleType == OPERATE) && (((*rule)->Param1 == ItemNum) || (((*rule)->Param1 == 0) && AllowDefaults)) && - (((*rule)->Param2 == LCPtr->CloseUpType) || (((*rule)->Param2 == 0) && AllowDefaults))) { + (((*rule)->Param2 == lcptr->CloseUpType) || (((*rule)->Param2 == 0) && AllowDefaults))) { if (checkConditions((*rule)->Condition)) { doActions((*rule)->ActionList, Set); return true; @@ -689,31 +689,31 @@ static bool doOperateRuleSub(int16 ItemNum, int16 roomNum, CloseDataPtr LCPtr, C /*****************************************************************************/ /* Goes thru the rules if the user tries to operate an item on an object. */ /*****************************************************************************/ -bool doOperateRule(int16 x, int16 y, int16 ItemNum, CloseDataPtr *LCPtr) { - CloseDataPtr TLCPtr; +bool doOperateRule(int16 x, int16 y, int16 ItemNum, CloseDataPtr *lcptr) { + CloseDataPtr tlcptr; g_lab->_newFileName = NOFILE; - TLCPtr = getObject(x, y, *LCPtr); + tlcptr = getObject(x, y, *lcptr); - if (doOperateRuleSub(ItemNum, g_lab->_roomNum, TLCPtr, LCPtr, false)) + if (doOperateRuleSub(ItemNum, g_lab->_roomNum, tlcptr, lcptr, false)) return true; - else if (doOperateRuleSub(ItemNum, g_lab->_roomNum, *LCPtr, LCPtr, false)) + else if (doOperateRuleSub(ItemNum, g_lab->_roomNum, *lcptr, lcptr, false)) return true; - else if (doOperateRuleSub(ItemNum, g_lab->_roomNum, TLCPtr, LCPtr, true)) + else if (doOperateRuleSub(ItemNum, g_lab->_roomNum, tlcptr, lcptr, true)) return true; - else if (doOperateRuleSub(ItemNum, g_lab->_roomNum, *LCPtr, LCPtr, true)) + else if (doOperateRuleSub(ItemNum, g_lab->_roomNum, *lcptr, lcptr, true)) return true; else { g_lab->_newFileName = g_lab->_curFileName; - if (doOperateRuleSub(ItemNum, 0, TLCPtr, LCPtr, false)) + if (doOperateRuleSub(ItemNum, 0, tlcptr, lcptr, false)) return true; - else if (doOperateRuleSub(ItemNum, 0, *LCPtr, LCPtr, false)) + else if (doOperateRuleSub(ItemNum, 0, *lcptr, lcptr, false)) return true; - else if (doOperateRuleSub(ItemNum, 0, TLCPtr, LCPtr, true)) + else if (doOperateRuleSub(ItemNum, 0, tlcptr, lcptr, true)) return true; - else if (doOperateRuleSub(ItemNum, 0, *LCPtr, LCPtr, true)) + else if (doOperateRuleSub(ItemNum, 0, *lcptr, lcptr, true)) return true; } @@ -723,13 +723,13 @@ bool doOperateRule(int16 x, int16 y, int16 ItemNum, CloseDataPtr *LCPtr) { /*****************************************************************************/ /* Goes thru the rules if the user tries to go forward. */ /*****************************************************************************/ -bool doGoForward(CloseDataPtr *LCPtr) { +bool doGoForward(CloseDataPtr *lcptr) { RuleList *rules = _rooms[g_lab->_roomNum]._rules; for (RuleList::iterator rule = rules->begin(); rule != rules->end(); ++rule) { if (((*rule)->RuleType == GOFORWARD) && ((*rule)->Param1 == (Direction + 1))) { if (checkConditions((*rule)->Condition)) { - doActions((*rule)->ActionList, LCPtr); + doActions((*rule)->ActionList, lcptr); return true; } } @@ -741,7 +741,7 @@ bool doGoForward(CloseDataPtr *LCPtr) { /*****************************************************************************/ /* Goes thru the rules if the user tries to turn. */ /*****************************************************************************/ -bool doTurn(uint16 from, uint16 to, CloseDataPtr *LCPtr) { +bool doTurn(uint16 from, uint16 to, CloseDataPtr *lcptr) { from++; to++; @@ -752,7 +752,7 @@ bool doTurn(uint16 from, uint16 to, CloseDataPtr *LCPtr) { (((*rule)->RuleType == TURNFROMTO) && ((*rule)->Param1 == from) && ((*rule)->Param2 == to))) { if (checkConditions((*rule)->Condition)) { - doActions((*rule)->ActionList, LCPtr); + doActions((*rule)->ActionList, lcptr); return true; } } @@ -764,12 +764,12 @@ bool doTurn(uint16 from, uint16 to, CloseDataPtr *LCPtr) { /*****************************************************************************/ /* Goes thru the rules if the user tries to go to the main view */ /*****************************************************************************/ -bool doMainView(CloseDataPtr *LCPtr) { +bool doMainView(CloseDataPtr *lcptr) { RuleList *rules = _rooms[g_lab->_roomNum]._rules; for (RuleList::iterator rule = rules->begin(); rule != rules->end(); ++rule) { if ((*rule)->RuleType == GOMAINVIEW) { if (checkConditions((*rule)->Condition)) { - doActions((*rule)->ActionList, LCPtr); + doActions((*rule)->ActionList, lcptr); return true; } } diff --git a/engines/lab/savegame.cpp b/engines/lab/savegame.cpp index 41f7b2787e..bfe089c96b 100644 --- a/engines/lab/savegame.cpp +++ b/engines/lab/savegame.cpp @@ -53,7 +53,7 @@ namespace Lab { /* Lab: Labyrinth specific */ extern byte combination[6]; extern uint16 CurTile[4] [4]; -extern char *getPictName(CloseDataPtr *LCPtr); +extern char *getPictName(CloseDataPtr *lcptr); void writeSaveGameHeader(Common::OutSaveFile *out, const Common::String &saveName) { out->writeUint32BE(SAVEGAME_ID); @@ -83,7 +83,7 @@ void writeSaveGameHeader(Common::OutSaveFile *out, const Common::String &saveNam bool readSaveGameHeader(Common::InSaveFile *in, SaveGameHeader &header) { uint32 id = in->readUint32BE(); - + // Check if it's a valid ScummVM savegame if (id != SAVEGAME_ID) return false; @@ -137,8 +137,8 @@ bool saveGame(uint16 Direction, uint16 Quarters, int slot, Common::String desc) return false; // Load scene pic - CloseDataPtr CPtr = NULL; - readPict(getPictName(&CPtr), true); + CloseDataPtr cPtr = NULL; + readPict(getPictName(&cPtr), true); writeSaveGameHeader(file, desc); file->writeUint16LE(g_lab->_roomNum); @@ -185,7 +185,7 @@ bool loadGame(uint16 *Direction, uint16 *Quarters, int slot) { Common::String fileName = g_lab->generateSaveFileName(slot); Common::SaveFileManager *saveFileManager = g_system->getSavefileManager(); Common::InSaveFile *file = saveFileManager->openForLoading(fileName); - + if (!file) return false; diff --git a/engines/lab/special.cpp b/engines/lab/special.cpp index 401d89766c..8e63d36ee5 100644 --- a/engines/lab/special.cpp +++ b/engines/lab/special.cpp @@ -81,7 +81,6 @@ uint16 CurTile[4][4] = { { 10, 13, 12, 0 } }; -extern TextFont *MsgFont; extern uint16 *FadePalette; extern BitMap *DispBitMap, *DrawBitMap; extern CloseDataPtr CPtr; -- cgit v1.2.3 From c67a9e867c2f40edcdecbc5077dfc2a6edcb443e Mon Sep 17 00:00:00 2001 From: Eugene Sandulenko Date: Thu, 3 Dec 2015 11:02:58 +0100 Subject: LAB: More renames --- engines/lab/engine.cpp | 48 ++++++++++++++++++++++++------------------------ engines/lab/labfun.h | 2 +- engines/lab/special.cpp | 16 ++++++++-------- 3 files changed, 33 insertions(+), 33 deletions(-) diff --git a/engines/lab/engine.cpp b/engines/lab/engine.cpp index 33a642247d..de9b567a1a 100644 --- a/engines/lab/engine.cpp +++ b/engines/lab/engine.cpp @@ -746,7 +746,7 @@ bool LabEngine::from_crumbs(uint32 tmpClass, uint16 code, uint16 Qualifier, Comm uint16 OldRoomNum, OldDirection = 0; uint16 LastInv = MAPNUM, Old; - CloseDataPtr OldCPtr, TempCPtr, HCPtr = NULL; + CloseDataPtr oldcptr, tempcptr, hcptr = NULL; ViewData *VPtr; bool doit; uint16 NewDir; @@ -859,7 +859,7 @@ bool LabEngine::from_crumbs(uint32 tmpClass, uint16 code, uint16 Qualifier, Comm doMainView(&CPtr); _anim->_doBlack = true; - HCPtr = NULL; + hcptr = NULL; CPtr = NULL; mayShowCrumbIndicator(); screenUpdate(); @@ -913,7 +913,7 @@ bool LabEngine::from_crumbs(uint32 tmpClass, uint16 code, uint16 Qualifier, Comm screenUpdate(); } else if (gadgetId >= 6) { /* Arrow Gadgets */ CPtr = NULL; - HCPtr = NULL; + hcptr = NULL; if ((gadgetId == 6) || (gadgetId == 8)) { if (gadgetId == 6) @@ -1141,7 +1141,7 @@ bool LabEngine::from_crumbs(uint32 tmpClass, uint16 code, uint16 Qualifier, Comm if (doit) { - HCPtr = NULL; + hcptr = NULL; eatMessages(); if (actionMode == 0) { /* Take something. */ @@ -1165,16 +1165,16 @@ bool LabEngine::from_crumbs(uint32 tmpClass, uint16 code, uint16 Qualifier, Comm drawStaticMessage(kTextNothing); } } else if (actionMode == 4) { /* Look at closeups */ - TempCPtr = CPtr; - setCurClose(curPos, &TempCPtr); + tempcptr = CPtr; + setCurClose(curPos, &tempcptr); - if (CPtr == TempCPtr) { + if (CPtr == tempcptr) { if (curPos.y < (VGAScaleY(149) + SVGACord(2))) drawStaticMessage(kTextNothing); - } else if (TempCPtr->GraphicName) { - if (*(TempCPtr->GraphicName)) { + } else if (tempcptr->GraphicName) { + if (*(tempcptr->GraphicName)) { _anim->_doBlack = true; - CPtr = TempCPtr; + CPtr = tempcptr; } else if (curPos.y < (VGAScaleY(149) + SVGACord(2))) drawStaticMessage(kTextNothing); } else if (curPos.y < (VGAScaleY(149) + SVGACord(2))) @@ -1195,32 +1195,32 @@ bool LabEngine::from_crumbs(uint32 tmpClass, uint16 code, uint16 Qualifier, Comm screenUpdate(); } else if (msgClass == DELTAMOVE) { VPtr = getViewData(_roomNum, Direction); - OldCPtr = VPtr->closeUps; + oldcptr = VPtr->closeUps; - if (HCPtr == NULL) { - TempCPtr = CPtr; - setCurClose(curPos, &TempCPtr); + if (hcptr == NULL) { + tempcptr = CPtr; + setCurClose(curPos, &tempcptr); - if ((TempCPtr == NULL) || (TempCPtr == CPtr)) { + if ((tempcptr == NULL) || (tempcptr == CPtr)) { if (CPtr == NULL) - HCPtr = OldCPtr; + hcptr = oldcptr; else - HCPtr = CPtr->SubCloseUps; + hcptr = CPtr->SubCloseUps; } else - HCPtr = TempCPtr->NextCloseUp; + hcptr = tempcptr->NextCloseUp; } else - HCPtr = HCPtr->NextCloseUp; + hcptr = hcptr->NextCloseUp; - if (HCPtr == NULL) { + if (hcptr == NULL) { if (CPtr == NULL) - HCPtr = OldCPtr; + hcptr = oldcptr; else - HCPtr = CPtr->SubCloseUps; + hcptr = CPtr->SubCloseUps; } - if (HCPtr) - _event->setMousePos(Common::Point(scaleX((HCPtr->x1 + HCPtr->x2) / 2), scaleY((HCPtr->y1 + HCPtr->y2) / 2))); + if (hcptr) + _event->setMousePos(Common::Point(scaleX((hcptr->x1 + hcptr->x2) / 2), scaleY((hcptr->y1 + hcptr->y2) / 2))); } else if ((msgClass == MOUSEBUTTONS) && (IEQUALIFIER_RBUTTON & Qualifier)) { eatMessages(); _alternate = !_alternate; diff --git a/engines/lab/labfun.h b/engines/lab/labfun.h index b20667bc2a..ad84402933 100644 --- a/engines/lab/labfun.h +++ b/engines/lab/labfun.h @@ -105,7 +105,7 @@ int32 longDrawMessage(const char *text); /* The Wipes */ -void doWipe(uint16 WipeType, CloseDataPtr *CPtr, char *filename); +void doWipe(uint16 WipeType, CloseDataPtr *cptr, char *filename); /* Double Buffer stuff */ diff --git a/engines/lab/special.cpp b/engines/lab/special.cpp index 8e63d36ee5..946c8af9a8 100644 --- a/engines/lab/special.cpp +++ b/engines/lab/special.cpp @@ -892,17 +892,17 @@ void LabEngine::processMonitor(char *ntext, TextFont *monitorFont, bool isintera uint32 Class; uint16 Qualifier, Code, MouseX, MouseY; const char *Test = " ", *StartFileName = TextFileName; - CloseDataPtr StartCPtr = CPtr, TestCPtr, LastCPtr[10]; + CloseDataPtr startcptr = CPtr, testcptr, lastcptr[10]; uint16 depth = 0; - LastCPtr[0] = CPtr; + lastcptr[0] = CPtr; while (1) { if (isinteractive) { if (CPtr == NULL) - CPtr = StartCPtr; + CPtr = startcptr; - if (CPtr == StartCPtr) + if (CPtr == startcptr) Test = StartFileName; else Test = CPtr->GraphicName; @@ -955,7 +955,7 @@ void LabEngine::processMonitor(char *ntext, TextFont *monitorFont, bool isintera if (depth) { depth--; - CPtr = LastCPtr[depth]; + CPtr = lastcptr[depth]; } } else if (monitorPage > 0) { monitorPage = 0; @@ -963,13 +963,13 @@ void LabEngine::processMonitor(char *ntext, TextFont *monitorFont, bool isintera } } } else if (isinteractive) { - TestCPtr = CPtr; + testcptr = CPtr; MouseY = 64 + (MouseY / MonGadHeight) * 42; MouseX = 101; setCurClose(Common::Point(MouseX, MouseY), &CPtr, true); - if (TestCPtr != CPtr) { - LastCPtr[depth] = TestCPtr; + if (testcptr != CPtr) { + lastcptr[depth] = testcptr; depth++; } } -- cgit v1.2.3 From 4424463f0618b8ae4a8416cf76024644497a79ad Mon Sep 17 00:00:00 2001 From: Eugene Sandulenko Date: Thu, 3 Dec 2015 11:10:58 +0100 Subject: LAB: Moved CPtr to engine class --- engines/lab/engine.cpp | 97 ++++++++++++++++++++++----------------------- engines/lab/lab.h | 1 + engines/lab/map.cpp | 2 - engines/lab/processroom.cpp | 5 +-- engines/lab/special.cpp | 21 +++++----- 5 files changed, 61 insertions(+), 65 deletions(-) diff --git a/engines/lab/engine.cpp b/engines/lab/engine.cpp index de9b567a1a..35672fbdbc 100644 --- a/engines/lab/engine.cpp +++ b/engines/lab/engine.cpp @@ -47,7 +47,6 @@ extern bool stopsound, DoNotDrawMessage; extern RoomData *_rooms; extern InventoryData *Inventory; extern uint16 NumInv, ManyRooms, HighestCondition, Direction; -CloseDataPtr CPtr; bool ispal = false, noupdatediff = false, MainDisplay = true, QuitLab = false; @@ -481,7 +480,7 @@ bool LabEngine::doUse(uint16 CurInv) { interfaceOff(); _anim->stopDiff(); _curFileName = " "; - CPtr = NULL; + _cptr = NULL; doMap(_roomNum); setPalette(initcolors, 8); drawMessage(NULL); @@ -491,7 +490,7 @@ bool LabEngine::doUse(uint16 CurInv) { interfaceOff(); _anim->stopDiff(); _curFileName = " "; - CPtr = NULL; + _cptr = NULL; doJournal(); drawPanel(); drawMessage(NULL); @@ -589,7 +588,7 @@ void LabEngine::mainGameLoop() { setPalette(initcolors, 8); - CPtr = NULL; + _cptr = NULL; _roomNum = 1; Direction = NORTH; @@ -623,8 +622,8 @@ void LabEngine::mainGameLoop() { _music->resumeBackMusic(); /* Sees what kind of close up we're in and does the appropriate stuff, if any. */ - if (doCloseUp(CPtr)) { - CPtr = NULL; + if (doCloseUp(_cptr)) { + _cptr = NULL; mayShowCrumbIndicator(); screenUpdate(); @@ -632,7 +631,7 @@ void LabEngine::mainGameLoop() { /* Sets the current picture properly on the screen */ if (MainDisplay) - _nextFileName = getPictName(&CPtr); + _nextFileName = getPictName(&_cptr); if (noupdatediff) { _roomsFound->inclElement(_roomNum); /* Potentially entered another room */ @@ -645,19 +644,19 @@ void LabEngine::mainGameLoop() { _roomsFound->inclElement(_roomNum); /* Potentially entered another room */ _curFileName = _nextFileName; - if (CPtr) { - if ((CPtr->CloseUpType == SPECIALLOCK) && MainDisplay) /* LAB: Labyrinth specific code */ + if (_cptr) { + if ((_cptr->CloseUpType == SPECIALLOCK) && MainDisplay) /* LAB: Labyrinth specific code */ showCombination(_curFileName); - else if (((CPtr->CloseUpType == SPECIALBRICK) || - (CPtr->CloseUpType == SPECIALBRICKNOMOUSE)) && + else if (((_cptr->CloseUpType == SPECIALBRICK) || + (_cptr->CloseUpType == SPECIALBRICKNOMOUSE)) && MainDisplay) /* LAB: Labyrinth specific code */ - showTile(_curFileName, (bool)(CPtr->CloseUpType == SPECIALBRICKNOMOUSE)); + showTile(_curFileName, (bool)(_cptr->CloseUpType == SPECIALBRICKNOMOUSE)); else readPict(_curFileName, false); } else readPict(_curFileName, false); - drawRoomMessage(curInv, CPtr); + drawRoomMessage(curInv, _cptr); forceDraw = false; mayShowCrumbIndicator(); @@ -668,7 +667,7 @@ void LabEngine::mainGameLoop() { } if (forceDraw) { - drawRoomMessage(curInv, CPtr); + drawRoomMessage(curInv, _cptr); forceDraw = false; screenUpdate(); } @@ -785,7 +784,7 @@ bool LabEngine::from_crumbs(uint32 tmpClass, uint16 code, uint16 Qualifier, Comm MainDisplay = true; interfaceOn(); /* Sets the correct gadget list */ drawPanel(); - drawRoomMessage(curInv, CPtr); + drawRoomMessage(curInv, _cptr); screenUpdate(); } } else { @@ -836,7 +835,7 @@ bool LabEngine::from_crumbs(uint32 tmpClass, uint16 code, uint16 Qualifier, Comm } else if (code == 9) { /* TAB key */ msgClass = DELTAMOVE; } else if (code == 27) { /* ESC key */ - CPtr = NULL; + _cptr = NULL; } eatMessages(); @@ -850,17 +849,17 @@ bool LabEngine::from_crumbs(uint32 tmpClass, uint16 code, uint16 Qualifier, Comm _longWinInFront = false; DoNotDrawMessage = false; drawPanel(); - drawRoomMessage(curInv, CPtr); + drawRoomMessage(curInv, _cptr); screenUpdate(); } } else if ((msgClass == GADGETUP) && !_alternate) { if (gadgetId <= 5) { - if ((actionMode == 4) && (gadgetId == 4) && (CPtr != NULL)) { - doMainView(&CPtr); + if ((actionMode == 4) && (gadgetId == 4) && (_cptr != NULL)) { + doMainView(&_cptr); _anim->_doBlack = true; hcptr = NULL; - CPtr = NULL; + _cptr = NULL; mayShowCrumbIndicator(); screenUpdate(); } else if (gadgetId == 5) { @@ -880,7 +879,7 @@ bool LabEngine::from_crumbs(uint32 tmpClass, uint16 code, uint16 Qualifier, Comm decIncInv(&curInv, false); drawPanel(); - drawRoomMessage(curInv, CPtr); + drawRoomMessage(curInv, _cptr); mayShowCrumbIndicator(); screenUpdate(); @@ -912,7 +911,7 @@ bool LabEngine::from_crumbs(uint32 tmpClass, uint16 code, uint16 Qualifier, Comm mayShowCrumbIndicator(); screenUpdate(); } else if (gadgetId >= 6) { /* Arrow Gadgets */ - CPtr = NULL; + _cptr = NULL; hcptr = NULL; if ((gadgetId == 6) || (gadgetId == 8)) { @@ -927,7 +926,7 @@ bool LabEngine::from_crumbs(uint32 tmpClass, uint16 code, uint16 Qualifier, Comm NewDir = Direction; processArrow(&NewDir, gadgetId - 6); - doTurn(Direction, NewDir, &CPtr); + doTurn(Direction, NewDir, &_cptr); _anim->_doBlack = true; Direction = NewDir; forceDraw = true; @@ -937,7 +936,7 @@ bool LabEngine::from_crumbs(uint32 tmpClass, uint16 code, uint16 Qualifier, Comm } else if (gadgetId == 7) { OldRoomNum = _roomNum; - if (doGoForward(&CPtr)) { + if (doGoForward(&_cptr)) { if (OldRoomNum == _roomNum) _anim->_doBlack = true; } else { @@ -1012,7 +1011,7 @@ bool LabEngine::from_crumbs(uint32 tmpClass, uint16 code, uint16 Qualifier, Comm MainDisplay = true; interfaceOn(); /* Sets the correct gadget list */ drawPanel(); - drawRoomMessage(curInv, CPtr); + drawRoomMessage(curInv, _cptr); screenUpdate(); } @@ -1025,7 +1024,7 @@ bool LabEngine::from_crumbs(uint32 tmpClass, uint16 code, uint16 Qualifier, Comm _curFileName = " "; doit = !saveRestoreGame(); - CPtr = NULL; + _cptr = NULL; MainDisplay = true; @@ -1078,14 +1077,14 @@ bool LabEngine::from_crumbs(uint32 tmpClass, uint16 code, uint16 Qualifier, Comm decIncInv(&curInv, true); LastInv = curInv; DoNotDrawMessage = false; - drawRoomMessage(curInv, CPtr); + drawRoomMessage(curInv, _cptr); screenUpdate(); } else if (gadgetId == 4) { /* Right gadget */ decIncInv(&curInv, false); LastInv = curInv; DoNotDrawMessage = false; - drawRoomMessage(curInv, CPtr); + drawRoomMessage(curInv, _cptr); screenUpdate(); } else if (gadgetId == 5) { /* bread crumbs */ @@ -1111,7 +1110,7 @@ bool LabEngine::from_crumbs(uint32 tmpClass, uint16 code, uint16 Qualifier, Comm MainDisplay = true; interfaceOn(); /* Sets the correct gadget list */ drawPanel(); - drawRoomMessage(curInv, CPtr); + drawRoomMessage(curInv, _cptr); screenUpdate(); } else { _breadCrumbs[0]._roomNum = 0; @@ -1129,10 +1128,10 @@ bool LabEngine::from_crumbs(uint32 tmpClass, uint16 code, uint16 Qualifier, Comm doit = false; - if (CPtr) { - if ((CPtr->CloseUpType == SPECIALLOCK) && MainDisplay) /* LAB: Labyrinth specific code */ + if (_cptr) { + if ((_cptr->CloseUpType == SPECIALLOCK) && MainDisplay) /* LAB: Labyrinth specific code */ mouseCombination(curPos); - else if ((CPtr->CloseUpType == SPECIALBRICK) && MainDisplay) + else if ((_cptr->CloseUpType == SPECIALBRICK) && MainDisplay) mouseTile(curPos); else doit = true; @@ -1145,43 +1144,43 @@ bool LabEngine::from_crumbs(uint32 tmpClass, uint16 code, uint16 Qualifier, Comm eatMessages(); if (actionMode == 0) { /* Take something. */ - if (doActionRule(Common::Point(curPos.x, curPos.y), actionMode, _roomNum, &CPtr)) + if (doActionRule(Common::Point(curPos.x, curPos.y), actionMode, _roomNum, &_cptr)) _curFileName = _newFileName; - else if (takeItem(curPos.x, curPos.y, &CPtr)) + else if (takeItem(curPos.x, curPos.y, &_cptr)) drawStaticMessage(kTextTakeItem); - else if (doActionRule(curPos, TAKEDEF - 1, _roomNum, &CPtr)) + else if (doActionRule(curPos, TAKEDEF - 1, _roomNum, &_cptr)) _curFileName = _newFileName; - else if (doActionRule(curPos, TAKE - 1, 0, &CPtr)) + else if (doActionRule(curPos, TAKE - 1, 0, &_cptr)) _curFileName = _newFileName; else if (curPos.y < (VGAScaleY(149) + SVGACord(2))) drawStaticMessage(kTextNothing); } else if ((actionMode == 1) /* Manipulate an object */ || (actionMode == 2) /* Open up a "door" */ || (actionMode == 3)) { /* Close a "door" */ - if (doActionRule(curPos, actionMode, _roomNum, &CPtr)) + if (doActionRule(curPos, actionMode, _roomNum, &_cptr)) _curFileName = _newFileName; - else if (!doActionRule(curPos, actionMode, 0, &CPtr)) { + else if (!doActionRule(curPos, actionMode, 0, &_cptr)) { if (curPos.y < (VGAScaleY(149) + SVGACord(2))) drawStaticMessage(kTextNothing); } } else if (actionMode == 4) { /* Look at closeups */ - tempcptr = CPtr; + tempcptr = _cptr; setCurClose(curPos, &tempcptr); - if (CPtr == tempcptr) { + if (_cptr == tempcptr) { if (curPos.y < (VGAScaleY(149) + SVGACord(2))) drawStaticMessage(kTextNothing); } else if (tempcptr->GraphicName) { if (*(tempcptr->GraphicName)) { _anim->_doBlack = true; - CPtr = tempcptr; + _cptr = tempcptr; } else if (curPos.y < (VGAScaleY(149) + SVGACord(2))) drawStaticMessage(kTextNothing); } else if (curPos.y < (VGAScaleY(149) + SVGACord(2))) drawStaticMessage(kTextNothing); } else if ((actionMode == 5) && _conditions->in(curInv)) { /* Use an item on something else */ - if (doOperateRule(curPos.x, curPos.y, curInv, &CPtr)) { + if (doOperateRule(curPos.x, curPos.y, curInv, &_cptr)) { _curFileName = _newFileName; if (!_conditions->in(curInv)) @@ -1198,14 +1197,14 @@ bool LabEngine::from_crumbs(uint32 tmpClass, uint16 code, uint16 Qualifier, Comm oldcptr = VPtr->closeUps; if (hcptr == NULL) { - tempcptr = CPtr; + tempcptr = _cptr; setCurClose(curPos, &tempcptr); - if ((tempcptr == NULL) || (tempcptr == CPtr)) { - if (CPtr == NULL) + if ((tempcptr == NULL) || (tempcptr == _cptr)) { + if (_cptr == NULL) hcptr = oldcptr; else - hcptr = CPtr->SubCloseUps; + hcptr = _cptr->SubCloseUps; } else hcptr = tempcptr->NextCloseUp; } else @@ -1213,10 +1212,10 @@ bool LabEngine::from_crumbs(uint32 tmpClass, uint16 code, uint16 Qualifier, Comm if (hcptr == NULL) { - if (CPtr == NULL) + if (_cptr == NULL) hcptr = oldcptr; else - hcptr = CPtr->SubCloseUps; + hcptr = _cptr->SubCloseUps; } if (hcptr) @@ -1237,7 +1236,7 @@ bool LabEngine::from_crumbs(uint32 tmpClass, uint16 code, uint16 Qualifier, Comm } drawPanel(); - drawRoomMessage(curInv, CPtr); + drawRoomMessage(curInv, _cptr); mayShowCrumbIndicator(); screenUpdate(); diff --git a/engines/lab/lab.h b/engines/lab/lab.h index 3e96d04241..44f8045c20 100644 --- a/engines/lab/lab.h +++ b/engines/lab/lab.h @@ -134,6 +134,7 @@ private: public: bool _longWinInFront; + CloseDataPtr _cptr; private: bool createScreen(bool HiRes); diff --git a/engines/lab/map.cpp b/engines/lab/map.cpp index 05c60b1094..b5855eaf58 100644 --- a/engines/lab/map.cpp +++ b/engines/lab/map.cpp @@ -43,8 +43,6 @@ namespace Lab { extern uint16 Direction; -extern CloseDataPtr CPtr; - /*****************************************************************************/ /* Converts an Amiga palette (up to 16 colors) to a VGA palette, then sets */ /* the VGA palette. */ diff --git a/engines/lab/processroom.cpp b/engines/lab/processroom.cpp index 30f26d4605..0d6b5e3bd3 100644 --- a/engines/lab/processroom.cpp +++ b/engines/lab/processroom.cpp @@ -49,7 +49,6 @@ InventoryData *Inventory; uint16 NumInv, ManyRooms, HighestCondition, Direction; extern bool DoNotDrawMessage, noupdatediff, QuitLab, MusicOn; -extern CloseDataPtr CPtr; /*****************************************************************************/ /* Generates a random number. */ @@ -554,9 +553,9 @@ static void doActions(Action *APtr, CloseDataPtr *lcptr) { if (APtr->Param1 == 0) g_lab->_anim->_doBlack = true; else if (APtr->Param1 == 1) - g_lab->_anim->_doBlack = (CPtr == NULL); + g_lab->_anim->_doBlack = (g_lab->_cptr == NULL); else if (APtr->Param1 == 2) - g_lab->_anim->_doBlack = (CPtr != NULL); + g_lab->_anim->_doBlack = (g_lab->_cptr != NULL); else if (APtr->Param1 == 5) { /* inverse the palette */ for (uint16 idx = (8 * 3); idx < (255 * 3); idx++) g_lab->_anim->_diffPalette[idx] = 255 - g_lab->_anim->_diffPalette[idx]; diff --git a/engines/lab/special.cpp b/engines/lab/special.cpp index 946c8af9a8..18810566bf 100644 --- a/engines/lab/special.cpp +++ b/engines/lab/special.cpp @@ -83,7 +83,6 @@ uint16 CurTile[4][4] = { extern uint16 *FadePalette; extern BitMap *DispBitMap, *DrawBitMap; -extern CloseDataPtr CPtr; extern InventoryData *Inventory; extern uint16 Direction; @@ -892,20 +891,20 @@ void LabEngine::processMonitor(char *ntext, TextFont *monitorFont, bool isintera uint32 Class; uint16 Qualifier, Code, MouseX, MouseY; const char *Test = " ", *StartFileName = TextFileName; - CloseDataPtr startcptr = CPtr, testcptr, lastcptr[10]; + CloseDataPtr startcptr = _cptr, testcptr, lastcptr[10]; uint16 depth = 0; - lastcptr[0] = CPtr; + lastcptr[0] = _cptr; while (1) { if (isinteractive) { - if (CPtr == NULL) - CPtr = startcptr; + if (_cptr == NULL) + _cptr = startcptr; - if (CPtr == startcptr) + if (_cptr == startcptr) Test = StartFileName; else - Test = CPtr->GraphicName; + Test = _cptr->GraphicName; if (strcmp(Test, TextFileName)) { monitorPage = 0; @@ -955,7 +954,7 @@ void LabEngine::processMonitor(char *ntext, TextFont *monitorFont, bool isintera if (depth) { depth--; - CPtr = lastcptr[depth]; + _cptr = lastcptr[depth]; } } else if (monitorPage > 0) { monitorPage = 0; @@ -963,12 +962,12 @@ void LabEngine::processMonitor(char *ntext, TextFont *monitorFont, bool isintera } } } else if (isinteractive) { - testcptr = CPtr; + testcptr = _cptr; MouseY = 64 + (MouseY / MonGadHeight) * 42; MouseX = 101; - setCurClose(Common::Point(MouseX, MouseY), &CPtr, true); + setCurClose(Common::Point(MouseX, MouseY), &_cptr, true); - if (testcptr != CPtr) { + if (testcptr != _cptr) { lastcptr[depth] = testcptr; depth++; } -- cgit v1.2.3 From 3b40199ab64382f7422abeb5bf6def43588496a8 Mon Sep 17 00:00:00 2001 From: Eugene Sandulenko Date: Thu, 3 Dec 2015 11:33:22 +0100 Subject: LAB: Move doActions() to LabEngine class --- engines/lab/lab.h | 6 +- engines/lab/processroom.cpp | 232 ++++++++++++++++++++++---------------------- 2 files changed, 120 insertions(+), 118 deletions(-) diff --git a/engines/lab/lab.h b/engines/lab/lab.h index 44f8045c20..afe191b60b 100644 --- a/engines/lab/lab.h +++ b/engines/lab/lab.h @@ -131,8 +131,6 @@ private: bool _lastMessageLong; bool _lastTooLong; TextFont *_msgFont; - -public: bool _longWinInFront; CloseDataPtr _cptr; @@ -203,6 +201,10 @@ private: void mayShowCrumbIndicator(); void mayShowCrumbIndicatorOff(); const char *getInvName(uint16 curInv); + +public: + void doActions(Action *aPtr, CloseDataPtr *lcptr); + }; extern LabEngine *g_lab; diff --git a/engines/lab/processroom.cpp b/engines/lab/processroom.cpp index 0d6b5e3bd3..e6217959dc 100644 --- a/engines/lab/processroom.cpp +++ b/engines/lab/processroom.cpp @@ -321,92 +321,92 @@ bool takeItem(uint16 x, uint16 y, CloseDataPtr *cptr) { /*****************************************************************************/ /* Processes the action list. */ /*****************************************************************************/ -static void doActions(Action *APtr, CloseDataPtr *lcptr) { +void LabEngine::doActions(Action *aptr, CloseDataPtr *lcptr) { CloseDataPtr tlcptr; - bool FirstLoaded = true; - char **str, *Test; - uint32 StartSecs, StartMicros, CurSecs, CurMicros; + bool firstLoaded = true; + char **str; + uint32 startSecs, startMicros, curSecs, curMicros; - while (APtr) { - g_lab->_music->updateMusic(); + while (aptr) { + _music->updateMusic(); - switch (APtr->ActionType) { + switch (aptr->ActionType) { case PLAYSOUND: - g_lab->_music->_loopSoundEffect = false; - g_lab->_music->_waitTillFinished = true; - readMusic((char *)APtr->Data, true); - g_lab->_music->_waitTillFinished = false; + _music->_loopSoundEffect = false; + _music->_waitTillFinished = true; + readMusic((char *)aptr->Data, true); + _music->_waitTillFinished = false; break; case PLAYSOUNDB: - g_lab->_music->_loopSoundEffect = false; - g_lab->_music->_waitTillFinished = false; - readMusic((char *)APtr->Data, false); + _music->_loopSoundEffect = false; + _music->_waitTillFinished = false; + readMusic((char *)aptr->Data, false); break; case PLAYSOUNDCONT: - g_lab->_music->_doNotFilestopSoundEffect = true; - g_lab->_music->_loopSoundEffect = true; - readMusic((char *)APtr->Data, g_lab->_music->_waitTillFinished); + _music->_doNotFilestopSoundEffect = true; + _music->_loopSoundEffect = true; + readMusic((char *)aptr->Data, _music->_waitTillFinished); break; case SHOWDIFF: - readPict((char *)APtr->Data, true); + readPict((char *)aptr->Data, true); break; case SHOWDIFFCONT: - readPict((char *)APtr->Data, false); + readPict((char *)aptr->Data, false); break; case LOADDIFF: - if (FirstLoaded) { + if (firstLoaded) { resetBuffer(); - FirstLoaded = false; + firstLoaded = false; } - if (APtr->Data) - g_lab->_music->newOpen((char *)APtr->Data); /* Puts a file into memory */ + if (aptr->Data) + _music->newOpen((char *)aptr->Data); /* Puts a file into memory */ break; case WIPECMD: - g_lab->doWipe(APtr->Param1, lcptr, (char *)APtr->Data); + doWipe(aptr->Param1, lcptr, (char *)aptr->Data); break; case NOUPDATE: noupdatediff = true; - g_lab->_anim->_doBlack = false; + _anim->_doBlack = false; break; case FORCEUPDATE: - g_lab->_curFileName = " "; + _curFileName = " "; break; - case SHOWCURPICT: - Test = getPictName(lcptr); + case SHOWCURPICT: { + char *test = getPictName(lcptr); - if (strcmp(Test, g_lab->_curFileName) != 0) { - g_lab->_curFileName = Test; - readPict(g_lab->_curFileName, true); + if (strcmp(test, _curFileName) != 0) { + _curFileName = test; + readPict(_curFileName, true); + } } - break; case SETELEMENT: - g_lab->_conditions->inclElement(APtr->Param1); + _conditions->inclElement(aptr->Param1); break; case UNSETELEMENT: - g_lab->_conditions->exclElement(APtr->Param1); + _conditions->exclElement(aptr->Param1); break; case SHOWMESSAGE: DoNotDrawMessage = false; - if (g_lab->_longWinInFront) - g_lab->longDrawMessage((char *)APtr->Data); + if (_longWinInFront) + longDrawMessage((char *)aptr->Data); else - g_lab->drawMessage((char *)APtr->Data); + drawMessage((char *)aptr->Data); DoNotDrawMessage = true; break; @@ -414,38 +414,38 @@ static void doActions(Action *APtr, CloseDataPtr *lcptr) { case CSHOWMESSAGE: if (*lcptr == NULL) { DoNotDrawMessage = false; - g_lab->drawMessage((char *)APtr->Data); + drawMessage((char *)aptr->Data); DoNotDrawMessage = true; } break; case SHOWMESSAGES: - str = (char **)APtr->Data; + str = (char **)aptr->Data; DoNotDrawMessage = false; - g_lab->drawMessage(str[getRandom(APtr->Param1)]); + drawMessage(str[getRandom(aptr->Param1)]); DoNotDrawMessage = true; break; case SETPOSITION: - if (APtr->Param1 & 0x8000) { + if (aptr->Param1 & 0x8000) { // This is a Wyrmkeep Windows trial version, thus stop at this // point, since we can't check for game payment status readPict(getPictName(lcptr), true); - APtr = NULL; + aptr = NULL; GUI::MessageDialog trialMessage("This is the end of the trial version. You can play the full game using the original interpreter from Wyrmkeep"); trialMessage.runModal(); continue; } - g_lab->_roomNum = APtr->Param1; - Direction = APtr->Param2 - 1; + _roomNum = aptr->Param1; + Direction = aptr->Param2 - 1; *lcptr = NULL; - g_lab->_anim->_doBlack = true; + _anim->_doBlack = true; break; case SETCLOSEUP: - tlcptr = getObject(scaleX(APtr->Param1), scaleY(APtr->Param2), *lcptr); + tlcptr = getObject(scaleX(aptr->Param1), scaleY(aptr->Param2), *lcptr); if (tlcptr) *lcptr = tlcptr; @@ -457,17 +457,17 @@ static void doActions(Action *APtr, CloseDataPtr *lcptr) { break; case SUBINV: - if (Inventory[APtr->Param1].Many) - (Inventory[APtr->Param1].Many)--; + if (Inventory[aptr->Param1].Many) + (Inventory[aptr->Param1].Many)--; - if (Inventory[APtr->Param1].Many == 0) - g_lab->_conditions->exclElement(APtr->Param1); + if (Inventory[aptr->Param1].Many == 0) + _conditions->exclElement(aptr->Param1); break; case ADDINV: - (Inventory[APtr->Param1].Many) += APtr->Param2; - g_lab->_conditions->inclElement(APtr->Param1); + (Inventory[aptr->Param1].Many) += aptr->Param2; + _conditions->inclElement(aptr->Param1); break; case SHOWDIR: @@ -475,66 +475,66 @@ static void doActions(Action *APtr, CloseDataPtr *lcptr) { break; case WAITSECS: - g_lab->addCurTime(APtr->Param1, 0, &StartSecs, &StartMicros); + addCurTime(aptr->Param1, 0, &startSecs, &startMicros); - g_lab->screenUpdate(); + screenUpdate(); while (1) { - g_lab->_music->updateMusic(); - g_lab->_anim->diffNextFrame(); - g_lab->getTime(&CurSecs, &CurMicros); + _music->updateMusic(); + _anim->diffNextFrame(); + getTime(&curSecs, &curMicros); - if ((CurSecs > StartSecs) || ((CurSecs == StartSecs) && - (CurMicros >= StartMicros))) + if ((curSecs > startSecs) || ((curSecs == startSecs) && + (curMicros >= startMicros))) break; } break; case STOPMUSIC: - g_lab->_music->setMusic(false); + _music->setMusic(false); break; case STARTMUSIC: - g_lab->_music->setMusic(true); + _music->setMusic(true); break; case CHANGEMUSIC: - g_lab->_music->changeMusic((const char *)APtr->Data); - g_lab->_music->setMusicReset(false); + _music->changeMusic((const char *)aptr->Data); + _music->setMusicReset(false); break; case RESETMUSIC: - g_lab->_music->resetMusic(); - g_lab->_music->setMusicReset(true); + _music->resetMusic(); + _music->setMusicReset(true); break; case FILLMUSIC: - g_lab->_music->updateMusic(); + _music->updateMusic(); break; case WAITSOUND: - while (g_lab->_music->isSoundEffectActive()) { - g_lab->_music->updateMusic(); - g_lab->_anim->diffNextFrame(); - g_lab->waitTOF(); + while (_music->isSoundEffectActive()) { + _music->updateMusic(); + _anim->diffNextFrame(); + waitTOF(); } break; case CLEARSOUND: - if (g_lab->_music->_loopSoundEffect) { - g_lab->_music->_loopSoundEffect = false; - g_lab->_music->stopSoundEffect(); - } else if (g_lab->_music->isSoundEffectActive()) - g_lab->_music->stopSoundEffect(); + if (_music->_loopSoundEffect) { + _music->_loopSoundEffect = false; + _music->stopSoundEffect(); + } else if (_music->isSoundEffectActive()) + _music->stopSoundEffect(); break; case WINMUSIC: - g_lab->_music->_winmusic = true; - g_lab->_music->freeMusic(); - g_lab->_music->initMusic(); + _music->_winmusic = true; + _music->freeMusic(); + _music->initMusic(); break; case WINGAME: @@ -550,53 +550,53 @@ static void doActions(Action *APtr, CloseDataPtr *lcptr) { break; case SPECIALCMD: - if (APtr->Param1 == 0) - g_lab->_anim->_doBlack = true; - else if (APtr->Param1 == 1) - g_lab->_anim->_doBlack = (g_lab->_cptr == NULL); - else if (APtr->Param1 == 2) - g_lab->_anim->_doBlack = (g_lab->_cptr != NULL); - else if (APtr->Param1 == 5) { /* inverse the palette */ + if (aptr->Param1 == 0) + _anim->_doBlack = true; + else if (aptr->Param1 == 1) + _anim->_doBlack = (_cptr == NULL); + else if (aptr->Param1 == 2) + _anim->_doBlack = (_cptr != NULL); + else if (aptr->Param1 == 5) { /* inverse the palette */ for (uint16 idx = (8 * 3); idx < (255 * 3); idx++) - g_lab->_anim->_diffPalette[idx] = 255 - g_lab->_anim->_diffPalette[idx]; + _anim->_diffPalette[idx] = 255 - _anim->_diffPalette[idx]; - g_lab->waitTOF(); - g_lab->setPalette(g_lab->_anim->_diffPalette, 256); - g_lab->waitTOF(); - g_lab->waitTOF(); - } else if (APtr->Param1 == 4) { /* white the palette */ + waitTOF(); + setPalette(_anim->_diffPalette, 256); + waitTOF(); + waitTOF(); + } else if (aptr->Param1 == 4) { /* white the palette */ whiteScreen(); - g_lab->waitTOF(); - g_lab->waitTOF(); - } else if (APtr->Param1 == 6) { /* Restore the palette */ - g_lab->waitTOF(); - g_lab->setPalette(g_lab->_anim->_diffPalette, 256); - g_lab->waitTOF(); - g_lab->waitTOF(); - } else if (APtr->Param1 == 7) { /* Quick pause */ - g_lab->waitTOF(); - g_lab->waitTOF(); - g_lab->waitTOF(); + waitTOF(); + waitTOF(); + } else if (aptr->Param1 == 6) { /* Restore the palette */ + waitTOF(); + setPalette(_anim->_diffPalette, 256); + waitTOF(); + waitTOF(); + } else if (aptr->Param1 == 7) { /* Quick pause */ + waitTOF(); + waitTOF(); + waitTOF(); } break; } - APtr = APtr->NextAction; + aptr = aptr->NextAction; } - if (g_lab->_music->_loopSoundEffect) { - g_lab->_music->_loopSoundEffect = false; - g_lab->_music->stopSoundEffect(); + if (_music->_loopSoundEffect) { + _music->_loopSoundEffect = false; + _music->stopSoundEffect(); } else { - while (g_lab->_music->isSoundEffectActive()) { - g_lab->_music->updateMusic(); - g_lab->_anim->diffNextFrame(); - g_lab->waitTOF(); + while (_music->isSoundEffectActive()) { + _music->updateMusic(); + _anim->diffNextFrame(); + waitTOF(); } } - g_lab->_music->_doNotFilestopSoundEffect = false; + _music->_doNotFilestopSoundEffect = false; } /*****************************************************************************/ @@ -621,7 +621,7 @@ static bool doActionRuleSub(int16 action, int16 roomNum, CloseDataPtr lcptr, Clo || ((action == 1) && ((*rule)->Param2 == (-lcptr->CloseUpType)))) { if (checkConditions((*rule)->Condition)) { - doActions((*rule)->ActionList, Set); + g_lab->doActions((*rule)->ActionList, Set); return true; } } @@ -675,7 +675,7 @@ static bool doOperateRuleSub(int16 ItemNum, int16 roomNum, CloseDataPtr lcptr, C (((*rule)->Param1 == ItemNum) || (((*rule)->Param1 == 0) && AllowDefaults)) && (((*rule)->Param2 == lcptr->CloseUpType) || (((*rule)->Param2 == 0) && AllowDefaults))) { if (checkConditions((*rule)->Condition)) { - doActions((*rule)->ActionList, Set); + g_lab->doActions((*rule)->ActionList, Set); return true; } } @@ -728,7 +728,7 @@ bool doGoForward(CloseDataPtr *lcptr) { for (RuleList::iterator rule = rules->begin(); rule != rules->end(); ++rule) { if (((*rule)->RuleType == GOFORWARD) && ((*rule)->Param1 == (Direction + 1))) { if (checkConditions((*rule)->Condition)) { - doActions((*rule)->ActionList, lcptr); + g_lab->doActions((*rule)->ActionList, lcptr); return true; } } @@ -751,7 +751,7 @@ bool doTurn(uint16 from, uint16 to, CloseDataPtr *lcptr) { (((*rule)->RuleType == TURNFROMTO) && ((*rule)->Param1 == from) && ((*rule)->Param2 == to))) { if (checkConditions((*rule)->Condition)) { - doActions((*rule)->ActionList, lcptr); + g_lab->doActions((*rule)->ActionList, lcptr); return true; } } @@ -768,7 +768,7 @@ bool doMainView(CloseDataPtr *lcptr) { for (RuleList::iterator rule = rules->begin(); rule != rules->end(); ++rule) { if ((*rule)->RuleType == GOMAINVIEW) { if (checkConditions((*rule)->Condition)) { - doActions((*rule)->ActionList, lcptr); + g_lab->doActions((*rule)->ActionList, lcptr); return true; } } -- cgit v1.2.3 From f76f0d957a3945a6a503ab0c26da0f08ed4842a3 Mon Sep 17 00:00:00 2001 From: Filippos Karapetis Date: Thu, 3 Dec 2015 13:54:19 +0200 Subject: LAB: Merge room views into an array --- engines/lab/parsetypes.h | 2 +- engines/lab/processroom.cpp | 9 +-------- engines/lab/resource.cpp | 16 ++++++++-------- 3 files changed, 10 insertions(+), 17 deletions(-) diff --git a/engines/lab/parsetypes.h b/engines/lab/parsetypes.h index 82174b80f4..6be1ba2482 100644 --- a/engines/lab/parsetypes.h +++ b/engines/lab/parsetypes.h @@ -140,7 +140,7 @@ struct RoomData { byte _wipeType; - ViewData *_northView, *_southView, *_eastView, *_westView; + ViewData *_view[4]; RuleList *_rules; char *_roomMsg; }; diff --git a/engines/lab/processroom.cpp b/engines/lab/processroom.cpp index e6217959dc..1858aebbd1 100644 --- a/engines/lab/processroom.cpp +++ b/engines/lab/processroom.cpp @@ -93,14 +93,7 @@ ViewData *getViewData(uint16 roomNum, uint16 direction) { if (!_rooms[roomNum]._roomMsg) g_lab->_resource->readViews(roomNum); - if (direction == NORTH) - view = _rooms[roomNum]._northView; - else if (direction == SOUTH) - view = _rooms[roomNum]._southView; - else if (direction == EAST) - view = _rooms[roomNum]._eastView; - else if (direction == WEST) - view = _rooms[roomNum]._westView; + view = _rooms[roomNum]._view[direction]; do { if (checkConditions(view->Condition)) diff --git a/engines/lab/resource.cpp b/engines/lab/resource.cpp index 70233dedd4..b1507fedf3 100644 --- a/engines/lab/resource.cpp +++ b/engines/lab/resource.cpp @@ -115,10 +115,10 @@ bool Resource::readRoomData(const char *fileName) { _rooms[i]._westDoor = dataFile->readUint16LE(); _rooms[i]._wipeType = dataFile->readByte(); - _rooms[i]._northView = nullptr; - _rooms[i]._southView = nullptr; - _rooms[i]._eastView = nullptr; - _rooms[i]._westView = nullptr; + _rooms[i]._view[NORTH] = nullptr; + _rooms[i]._view[SOUTH] = nullptr; + _rooms[i]._view[EAST] = nullptr; + _rooms[i]._view[WEST] = nullptr; _rooms[i]._rules = nullptr; _rooms[i]._roomMsg = nullptr; } @@ -154,10 +154,10 @@ bool Resource::readViews(uint16 roomNum) { allocroom = roomNum; _rooms[roomNum]._roomMsg = readString(dataFile); - _rooms[roomNum]._northView = readView(dataFile); - _rooms[roomNum]._southView = readView(dataFile); - _rooms[roomNum]._eastView = readView(dataFile); - _rooms[roomNum]._westView = readView(dataFile); + _rooms[roomNum]._view[NORTH] = readView(dataFile); + _rooms[roomNum]._view[SOUTH] = readView(dataFile); + _rooms[roomNum]._view[EAST] = readView(dataFile); + _rooms[roomNum]._view[WEST] = readView(dataFile); _rooms[roomNum]._rules = readRule(dataFile); _vm->_music->updateMusic(); -- cgit v1.2.3 From 23b70db958604649f5a324a09da56c5dc86a57c0 Mon Sep 17 00:00:00 2001 From: Filippos Karapetis Date: Thu, 3 Dec 2015 14:12:31 +0200 Subject: LAB: Cleanup of palette code --- engines/lab/lab.h | 10 +--------- engines/lab/map.cpp | 5 +++-- engines/lab/vga.cpp | 36 ++++++++---------------------------- 3 files changed, 12 insertions(+), 39 deletions(-) diff --git a/engines/lab/lab.h b/engines/lab/lab.h index afe191b60b..9586a48a36 100644 --- a/engines/lab/lab.h +++ b/engines/lab/lab.h @@ -74,7 +74,7 @@ public: int _screenWidth; int _screenHeight; - int _screenBytesPerPage; + uint32 _screenBytesPerPage; // timing.cpp @@ -151,8 +151,6 @@ public: void setPalette(void *cmap, uint16 numcolors); void drawHLine(uint16 x, uint16 y1, uint16 y2); void drawVLine(uint16 x1, uint16 y, uint16 x2); - void writeColorReg(byte *buf, uint16 regnum); - void writeColorRegsSmooth(byte *buf, uint16 first, uint16 numreg); void drawPanel(); void drawRoomMessage(uint16 CurInv, CloseDataPtr cptr); @@ -185,12 +183,6 @@ public: void changeVolume(int delta); private: - void quickWaitTOF(); - - /*---------- Drawing Routines ----------*/ - - void applyPalette(byte *buf, uint16 first, uint16 numreg, uint16 slow); - // engine.cpp bool setUpScreens(); void freeScreens(); diff --git a/engines/lab/map.cpp b/engines/lab/map.cpp index b5855eaf58..9ce9f0889b 100644 --- a/engines/lab/map.cpp +++ b/engines/lab/map.cpp @@ -60,7 +60,8 @@ void setAmigaPal(uint16 *pal, uint16 numcolors) { vgapal[vgacount++] = (byte)(((pal[i] & 0x00f)) << 2); } - g_lab->writeColorRegsSmooth(vgapal, 0, 16); + g_lab->writeColorRegs(vgapal, 0, 16); + g_lab->waitTOF(); } /*---------------------------------------------------------------------------*/ @@ -620,7 +621,7 @@ void LabEngine::processMap(uint16 CurRoom) { } waitTOF(); - writeColorReg(newcolor, 1); + writeColorRegs(newcolor, 1, 1); _event->updateMouse(); waitTOF(); _event->updateMouse(); diff --git a/engines/lab/vga.cpp b/engines/lab/vga.cpp index d64953c6b9..73f80b29f8 100644 --- a/engines/lab/vga.cpp +++ b/engines/lab/vga.cpp @@ -49,7 +49,7 @@ bool LabEngine::createScreen(bool hiRes) { } _screenBytesPerPage = _screenWidth * _screenHeight; - _displayBuffer = (byte *)malloc(_screenBytesPerPage); + _displayBuffer = new byte[_screenBytesPerPage]; // FIXME: Memory leak! return true; } @@ -76,19 +76,6 @@ void LabEngine::waitTOF() { _lastWaitTOFTicks = now; } -void LabEngine::applyPalette(byte *buf, uint16 first, uint16 numreg, uint16 slow) { - byte tmp[256 * 3]; - - for (int i = 0; i < 256 * 3; i++) { - tmp[i] = buf[i] * 4; - } - - g_system->getPaletteManager()->setPalette(tmp, first, numreg); - - if (slow) - waitTOF(); -} - /*****************************************************************************/ /* Writes any number of the 256 color registers. */ /* first: the number of the first color register to write. */ @@ -101,22 +88,15 @@ void LabEngine::applyPalette(byte *buf, uint16 first, uint16 numreg, uint16 slow /* selected. */ /*****************************************************************************/ void LabEngine::writeColorRegs(byte *buf, uint16 first, uint16 numreg) { - applyPalette(buf, first, numreg, 0); - memcpy(&(_curvgapal[first * 3]), buf, numreg * 3); -} + byte tmp[256 * 3]; -void LabEngine::writeColorRegsSmooth(byte *buf, uint16 first, uint16 numreg) { - applyPalette(buf, first, numreg, 1); - memcpy(&(_curvgapal[first * 3]), buf, numreg * 3); -} + for (int i = 0; i < 256 * 3; i++) { + tmp[i] = buf[i] * 4; + } -/*****************************************************************************/ -/* Sets one of the 256 (0..255) color registers. buf is a char pointer, */ -/* the first character in the string is the red value, then green, then */ -/* blue. Each color value is a 6 bit value. */ -/*****************************************************************************/ -void LabEngine::writeColorReg(byte *buf, uint16 regnum) { - writeColorRegs(buf, regnum, 1); + g_system->getPaletteManager()->setPalette(tmp, first, numreg); + + memcpy(&(_curvgapal[first * 3]), buf, numreg * 3); } void LabEngine::setPalette(void *cmap, uint16 numcolors) { -- cgit v1.2.3 From 1913a61f30f4200c044f11268ab6fca40f0af510 Mon Sep 17 00:00:00 2001 From: Filippos Karapetis Date: Thu, 3 Dec 2015 14:22:04 +0200 Subject: LAB: Some renaming and cleanup --- engines/lab/graphics.cpp | 21 +++++++++++---------- engines/lab/interface.cpp | 12 ++++++------ engines/lab/interface.h | 4 ++-- engines/lab/lab.h | 2 +- engines/lab/map.cpp | 18 +++++++++--------- engines/lab/special.cpp | 8 ++++---- engines/lab/vga.cpp | 4 ++-- 7 files changed, 35 insertions(+), 34 deletions(-) diff --git a/engines/lab/graphics.cpp b/engines/lab/graphics.cpp index 6fa29d8fdf..9e65fa9424 100644 --- a/engines/lab/graphics.cpp +++ b/engines/lab/graphics.cpp @@ -652,7 +652,7 @@ void LabEngine::doTransWipe(CloseDataPtr *cPtr, char *filename) { linesdone = 0; } - ghoastRect(0, 0, curY, _screenWidth - 1, curY + 1); + overlayRect(0, 0, curY, _screenWidth - 1, curY + 1); curY += 4; linesdone++; } @@ -708,7 +708,7 @@ void LabEngine::doTransWipe(CloseDataPtr *cPtr, char *filename) { imDest._imageData = getCurrentDrawingBuffer(); imSource.bltBitMap(0, curY, &imDest, 0, curY, _screenWidth, 2); - ghoastRect(0, 0, curY, _screenWidth - 1, curY + 1); + overlayRect(0, 0, curY, _screenWidth - 1, curY + 1); curY += 4; linesdone++; } @@ -756,14 +756,13 @@ void LabEngine::doWipe(uint16 wipeType, CloseDataPtr *cPtr, char *filename) { _anim->diffNextFrame(); } -static byte blackbuffer[256 * 3]; - /*****************************************************************************/ /* Changes the front screen to black. */ /*****************************************************************************/ void blackScreen() { - memset(blackbuffer, 0, 248 * 3); - g_lab->writeColorRegs(blackbuffer, 8, 248); + byte pal[256 * 3]; + memset(pal, 0, 248 * 3); + g_lab->writeColorRegs(pal, 8, 248); g_system->delayMillis(32); } @@ -772,16 +771,18 @@ void blackScreen() { /* Changes the front screen to white. */ /*****************************************************************************/ void whiteScreen() { - memset(blackbuffer, 255, 248 * 3); - g_lab->writeColorRegs(blackbuffer, 8, 248); + byte pal[256 * 3]; + memset(pal, 255, 248 * 3); + g_lab->writeColorRegs(pal, 8, 248); } /*****************************************************************************/ /* Changes the entire screen to black. */ /*****************************************************************************/ void blackAllScreen() { - memset(blackbuffer, 0, 256 * 3); - g_lab->writeColorRegs(blackbuffer, 0, 256); + byte pal[256 * 3]; + memset(pal, 0, 256 * 3); + g_lab->writeColorRegs(pal, 0, 256); g_system->delayMillis(32); } diff --git a/engines/lab/interface.cpp b/engines/lab/interface.cpp index 9a51978bdf..7352b61017 100644 --- a/engines/lab/interface.cpp +++ b/engines/lab/interface.cpp @@ -84,7 +84,7 @@ void drawGadgetList(Gadget *gadlist) { gadlist->_image->drawImage(gadlist->x, gadlist->y); if (GADGETOFF & gadlist->GadgetFlags) - ghoastGadget(gadlist, 1); + disableGadget(gadlist, 1); gadlist = gadlist->NextGadget; } @@ -92,19 +92,19 @@ void drawGadgetList(Gadget *gadlist) { /*****************************************************************************/ -/* Ghoasts a gadget, and makes it unavailable for using. */ +/* Dims a gadget, and makes it unavailable for using. */ /*****************************************************************************/ -void ghoastGadget(Gadget *curgad, uint16 pencolor) { - g_lab->ghoastRect(pencolor, curgad->x, curgad->y, curgad->x + curgad->_image->_width - 1, curgad->y + curgad->_image->_height - 1); +void disableGadget(Gadget *curgad, uint16 pencolor) { + g_lab->overlayRect(pencolor, curgad->x, curgad->y, curgad->x + curgad->_image->_width - 1, curgad->y + curgad->_image->_height - 1); curgad->GadgetFlags |= GADGETOFF; } /*****************************************************************************/ -/* Unghoasts a gadget, and makes it available again. */ +/* Undims a gadget, and makes it available again. */ /*****************************************************************************/ -void unGhoastGadget(Gadget *curgad) { +void enableGadget(Gadget *curgad) { curgad->_image->drawImage(curgad->x, curgad->y); curgad->GadgetFlags &= !(GADGETOFF); } diff --git a/engines/lab/interface.h b/engines/lab/interface.h index ceeb4a8327..de770f0ae1 100644 --- a/engines/lab/interface.h +++ b/engines/lab/interface.h @@ -113,8 +113,8 @@ extern Common::KeyState _keyPressed; Gadget *createButton(uint16 x, uint16 y, uint16 id, uint16 key, Image *im, Image *imalt); void freeButtonList(void *gptrlist); void drawGadgetList(Gadget *gadlist); -void ghoastGadget(Gadget *curgad, uint16 pencolor); -void unGhoastGadget(Gadget *curgad); +void disableGadget(Gadget *curgad, uint16 pencolor); +void enableGadget(Gadget *curgad); IntuiMessage *getMsg(); } // End of namespace Lab diff --git a/engines/lab/lab.h b/engines/lab/lab.h index 9586a48a36..f19a1bacff 100644 --- a/engines/lab/lab.h +++ b/engines/lab/lab.h @@ -147,7 +147,7 @@ public: void rectFill(uint16 x1, uint16 y1, uint16 x2, uint16 y2); void scrollDisplayX(int16 dx, uint16 x1, uint16 y1, uint16 x2, uint16 y2); void scrollDisplayY(int16 dy, uint16 x1, uint16 y1, uint16 x2, uint16 y2); - void ghoastRect(uint16 pencolor, uint16 x1, uint16 y1, uint16 x2, uint16 y2); + void overlayRect(uint16 pencolor, uint16 x1, uint16 y1, uint16 x2, uint16 y2); void setPalette(void *cmap, uint16 numcolors); void drawHLine(uint16 x, uint16 y1, uint16 y2); void drawVLine(uint16 x1, uint16 y, uint16 x2); diff --git a/engines/lab/map.cpp b/engines/lab/map.cpp index 9ce9f0889b..7471b1f0ea 100644 --- a/engines/lab/map.cpp +++ b/engines/lab/map.cpp @@ -491,7 +491,7 @@ void LabEngine::drawMap(uint16 CurRoom, uint16 CurMsg, uint16 Floor, bool fadeou char *sptr; uint16 tempfloor; - bool noghoast; + bool noOverlay; _event->mouseHide(); @@ -517,20 +517,20 @@ void LabEngine::drawMap(uint16 CurRoom, uint16 CurMsg, uint16 Floor, bool fadeou drawRoom(CurRoom, true); tempfloor = Floor; - getUpFloor(&tempfloor, &noghoast); + getUpFloor(&tempfloor, &noOverlay); - if (noghoast) - unGhoastGadget(&upgadget); + if (noOverlay) + enableGadget(&upgadget); else - ghoastGadget(&upgadget, 12); + disableGadget(&upgadget, 12); tempfloor = Floor; - getDownFloor(&tempfloor, &noghoast); + getDownFloor(&tempfloor, &noOverlay); - if (noghoast) - unGhoastGadget(&downgadget); + if (noOverlay) + enableGadget(&downgadget); else - ghoastGadget(&downgadget, 12); + disableGadget(&downgadget, 12); // Labyrinth specific code if (Floor == LOWERFLOOR) { diff --git a/engines/lab/special.cpp b/engines/lab/special.cpp index 18810566bf..50cf0fe259 100644 --- a/engines/lab/special.cpp +++ b/engines/lab/special.cpp @@ -657,14 +657,14 @@ void LabEngine::drawJournal(uint16 wipenum, bool needFade) { turnPage((bool)(wipenum == 1)); if (JPage == 0) - ghoastGadget(&BackG, 15); + disableGadget(&BackG, 15); else - unGhoastGadget(&BackG); + enableGadget(&BackG); if (lastpage) - ghoastGadget(&ForwardG, 15); + disableGadget(&ForwardG, 15); else - unGhoastGadget(&ForwardG); + enableGadget(&ForwardG); if (needFade) diff --git a/engines/lab/vga.cpp b/engines/lab/vga.cpp index 73f80b29f8..0248bb823c 100644 --- a/engines/lab/vga.cpp +++ b/engines/lab/vga.cpp @@ -270,9 +270,9 @@ void LabEngine::drawHLine(uint16 x1, uint16 y, uint16 x2) { } /*****************************************************************************/ -/* Ghoasts a region on the screen using the desired pen color. */ +/* Overlays a region on the screen using the desired pen color. */ /*****************************************************************************/ -void LabEngine::ghoastRect(uint16 pencolor, uint16 x1, uint16 y1, uint16 x2, uint16 y2) { +void LabEngine::overlayRect(uint16 pencolor, uint16 x1, uint16 y1, uint16 x2, uint16 y2) { int dx = x1; int dy = y1; int w = x2 - x1 + 1; -- cgit v1.2.3 From f7fe91c8d23af3628f5df3c553ac4a0f0538d6c2 Mon Sep 17 00:00:00 2001 From: Filippos Karapetis Date: Thu, 3 Dec 2015 14:30:08 +0200 Subject: LAB: Function reordering --- engines/lab/graphics.cpp | 38 +++++++++++++++++++------------------- 1 file changed, 19 insertions(+), 19 deletions(-) diff --git a/engines/lab/graphics.cpp b/engines/lab/graphics.cpp index 9e65fa9424..520828a8f4 100644 --- a/engines/lab/graphics.cpp +++ b/engines/lab/graphics.cpp @@ -140,23 +140,6 @@ bool readPict(const char *filename, bool playOnce) { return true; } -/*****************************************************************************/ -/* Reads in a music file. Ignores any graphics. */ -/*****************************************************************************/ -bool readMusic(const char *filename, bool waitTillFinished) { - Common::File *file = g_lab->_resource->openDataFile(filename, MKTAG('D', 'I', 'F', 'F')); - g_lab->_music->updateMusic(); - if (!g_lab->_music->_doNotFilestopSoundEffect) - g_lab->_music->stopSoundEffect(); - if (!file) - return false; - - g_lab->_anim->_doBlack = false; - g_lab->_anim->readSound(waitTillFinished, file); - - return true; -} - /*****************************************************************************/ /* Reads in a picture into buffer memory. */ /*****************************************************************************/ @@ -174,8 +157,8 @@ byte *readPictToMem(const char *filename, uint16 x, uint16 y) { return NULL; DispBitMap->_bytesPerRow = x; - DispBitMap->_rows = y; - DispBitMap->_flags = BITMAPF_NONE; + DispBitMap->_rows = y; + DispBitMap->_flags = BITMAPF_NONE; DispBitMap->_planes[0] = curMem; DispBitMap->_planes[1] = DispBitMap->_planes[0] + 0x10000; DispBitMap->_planes[2] = DispBitMap->_planes[1] + 0x10000; @@ -187,6 +170,23 @@ byte *readPictToMem(const char *filename, uint16 x, uint16 y) { return mem; } +/*****************************************************************************/ +/* Reads in a music file. Ignores any graphics. */ +/*****************************************************************************/ +bool readMusic(const char *filename, bool waitTillFinished) { + Common::File *file = g_lab->_resource->openDataFile(filename, MKTAG('D', 'I', 'F', 'F')); + g_lab->_music->updateMusic(); + if (!g_lab->_music->_doNotFilestopSoundEffect) + g_lab->_music->stopSoundEffect(); + if (!file) + return false; + + g_lab->_anim->_doBlack = false; + g_lab->_anim->readSound(waitTillFinished, file); + + return true; +} + /*---------------------------------------------------------------------------*/ /*------------ Does all the text rendering to the message boxes. ------------*/ /*---------------------------------------------------------------------------*/ -- cgit v1.2.3 From 914bd262955c9da140d89dc6cf3fa03940a13c62 Mon Sep 17 00:00:00 2001 From: Filippos Karapetis Date: Thu, 3 Dec 2015 14:30:32 +0200 Subject: LAB: Cleanup of roomCords() --- engines/lab/map.cpp | 25 ++++++++++--------------- 1 file changed, 10 insertions(+), 15 deletions(-) diff --git a/engines/lab/map.cpp b/engines/lab/map.cpp index 7471b1f0ea..a2a4ed3af7 100644 --- a/engines/lab/map.cpp +++ b/engines/lab/map.cpp @@ -252,34 +252,29 @@ void fade(bool fadein, uint16 res) { /* Figures out what a room's coordinates should be. */ /*****************************************************************************/ static void roomCords(uint16 CurRoom, uint16 *x1, uint16 *y1, uint16 *x2, uint16 *y2) { - *x1 = mapScaleX(Maps[CurRoom].x); - *y1 = mapScaleY(Maps[CurRoom].y); - *x2 = *x1; - *y2 = *y1; + Image *curRoomImg = NULL; switch (Maps[CurRoom].SpecialID) { case NORMAL: case UPARROWROOM: case DOWNARROWROOM: - (*x2) += Room->_width; - (*y2) += Room->_height; + curRoomImg = Room; break; - case BRIDGEROOM: - (*x2) += Bridge->_width; - (*y2) += Bridge->_height; + curRoomImg = Bridge; break; - case VCORRIDOR: - (*x2) += VRoom->_width; - (*y2) += VRoom->_height; + curRoomImg = VRoom; break; - case HCORRIDOR: - (*x2) += HRoom->_width; - (*y2) += HRoom->_height; + curRoomImg = HRoom; break; } + + *x1 = mapScaleX(Maps[CurRoom].x); + *y1 = mapScaleY(Maps[CurRoom].y); + *x2 = *x1 + curRoomImg->_width; + *y2 = *y1 + curRoomImg->_height; } /*****************************************************************************/ -- cgit v1.2.3 From 359eda3b9728548b654e16b01df39b1c54b81fdd Mon Sep 17 00:00:00 2001 From: Filippos Karapetis Date: Thu, 3 Dec 2015 15:05:12 +0200 Subject: LAB: openDataFile can also be used without checking for a file header --- engines/lab/resource.cpp | 2 +- engines/lab/resource.h | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/engines/lab/resource.cpp b/engines/lab/resource.cpp index b1507fedf3..415839d986 100644 --- a/engines/lab/resource.cpp +++ b/engines/lab/resource.cpp @@ -172,7 +172,7 @@ Common::File *Resource::openDataFile(const char *fileName, uint32 fileHeader) { if (!dataFile->isOpen()) error("openDataFile couldn't open %s (%s)", translateFileName(fileName), fileName); - if (dataFile->readUint32BE() != fileHeader) { + if (fileHeader > 0 && dataFile->readUint32BE() != fileHeader) { dataFile->close(); return nullptr; } diff --git a/engines/lab/resource.h b/engines/lab/resource.h index b9bdbbba8d..35165693a0 100644 --- a/engines/lab/resource.h +++ b/engines/lab/resource.h @@ -98,7 +98,7 @@ public: Resource(LabEngine *vm); ~Resource() {} - Common::File *openDataFile(const char * fileName, uint32 fileHeader); + Common::File *openDataFile(const char * fileName, uint32 fileHeader = 0); bool readRoomData(const char *fileName); bool readInventory(const char *fileName); bool readViews(uint16 roomNum); -- cgit v1.2.3 From 8f4d9c9c05e71036e80b47db380eff7922087fd5 Mon Sep 17 00:00:00 2001 From: Filippos Karapetis Date: Thu, 3 Dec 2015 15:06:45 +0200 Subject: LAB: Image accepts a Common::File now --- engines/lab/engine.cpp | 44 +++++++----------------------------- engines/lab/image.cpp | 20 +++++++---------- engines/lab/image.h | 2 +- engines/lab/map.cpp | 50 ++++++++++++++++++----------------------- engines/lab/special.cpp | 60 +++++++++++++++++-------------------------------- 5 files changed, 59 insertions(+), 117 deletions(-) diff --git a/engines/lab/engine.cpp b/engines/lab/engine.cpp index 35672fbdbc..7b14afc0bf 100644 --- a/engines/lab/engine.cpp +++ b/engines/lab/engine.cpp @@ -181,26 +181,10 @@ bool LabEngine::setUpScreens() { if (!createScreen(_isHiRes)) return false; - /* Loads in the graphics for the movement control panel */ - Common::File file; - file.open(translateFileName("P:Control")); - if (!file.isOpen()) - warning("setUpScreens couldn't open %s", translateFileName("P:Control")); - - if (file.err() || file.size() == 0) - return false; - - byte *movePanelBuffer; - if (!(movePanelBuffer = (byte *)calloc(file.size(), 1))) - return false; - - file.read(movePanelBuffer, file.size()); - file.close(); - - byte *buffer = movePanelBuffer; - + Common::File *controlFile = g_lab->_resource->openDataFile("P:Control"); for (uint16 i = 0; i < 20; i++) - _moveImages[i] = new Image(&buffer); + _moveImages[i] = new Image(controlFile); + delete controlFile; /* Creates the gadgets for the movement control panel */ uint16 y = VGAScaleY(173) - SVGACord(2); @@ -247,25 +231,11 @@ bool LabEngine::setUpScreens() { curGadget->NextGadget = createButton(289, y, 9, 0, _moveImages[10], _moveImages[11]); } - file.open(translateFileName("P:Inv")); - if (!file.isOpen()) - warning("setUpScreens couldn't open %s", translateFileName("P:Inv")); - - if (file.err() || file.size() == 0) - return false; - - byte *invPanelBuffer; - if (!(invPanelBuffer = (byte *)calloc(file.size(), 1))) - return false; - - file.read(invPanelBuffer, file.size()); - file.close(); - - buffer = invPanelBuffer; + Common::File *invFile = g_lab->_resource->openDataFile("P:Inv"); if (getPlatform() == Common::kPlatformWindows) { for (uint16 imgIdx = 0; imgIdx < 10; imgIdx++) - _invImages[imgIdx] = new Image(&buffer); + _invImages[imgIdx] = new Image(invFile); _invGadgetList = createButton(24, y, 0, 'm', _invImages[0], _invImages[1]); Gadget *curGadget = _invGadgetList; @@ -285,7 +255,7 @@ bool LabEngine::setUpScreens() { curGadget = curGadget->NextGadget; } else { for (uint16 imgIdx = 0; imgIdx < 6; imgIdx++) - _invImages[imgIdx] = new Image(&buffer); + _invImages[imgIdx] = new Image(invFile); _invGadgetList = createButton(58, y, 0, 0, _invImages[0], _invImages[1]); Gadget *curGadget = _invGadgetList; @@ -301,6 +271,8 @@ bool LabEngine::setUpScreens() { curGadget = curGadget->NextGadget; } + delete invFile; + return true; } diff --git a/engines/lab/image.cpp b/engines/lab/image.cpp index 0fd7425dc4..3f5801fa1c 100644 --- a/engines/lab/image.cpp +++ b/engines/lab/image.cpp @@ -36,21 +36,17 @@ namespace Lab { /*****************************************************************************/ /* Reads in an image from disk. */ /*****************************************************************************/ -Image::Image(byte **buffer) { - uint32 size; +Image::Image(Common::File *s) { + _width = s->readUint16LE(); + _height = s->readUint16LE(); + s->skip(4); - _width = READ_LE_UINT16(*buffer); - _height = READ_LE_UINT16(*buffer + 2); - - *buffer += 8; /* sizeof(struct Image); */ - - size = _width * _height; - - if (1L & size) + uint32 size = _width * _height; + if (size & 1) size++; - _imageData = (byte *)(*buffer); - (*buffer) += size; + _imageData = new byte[size]; // FIXME: Memory leak! + s->read(_imageData, size); } /*****************************************************************************/ diff --git a/engines/lab/image.h b/engines/lab/image.h index 450c177373..8f4d0f844f 100644 --- a/engines/lab/image.h +++ b/engines/lab/image.h @@ -41,7 +41,7 @@ public: Image() : _width(0), _height(0), _imageData(0) {} Image(int w, int h, byte *d) : _width(w), _height(h), _imageData(d) {} - Image(byte **buffer); + Image(Common::File *s); void drawImage(uint16 x, uint16 y); void drawMaskImage(uint16 x, uint16 y); diff --git a/engines/lab/map.cpp b/engines/lab/map.cpp index a2a4ed3af7..b3312619c1 100644 --- a/engines/lab/map.cpp +++ b/engines/lab/map.cpp @@ -129,43 +129,37 @@ static uint16 mapScaleY(uint16 y) { /* Loads in the map data. */ /*****************************************************************************/ static bool loadMapData() { - byte **buffer; - uint32 Size; Gadget *gptr; uint16 counter; - resetBuffer(); /* Make images load into start of buffer */ - buffer = g_lab->_music->newOpen("P:MapImage", Size); + Common::File *mapImages = g_lab->_resource->openDataFile("P:MapImage"); - if (!buffer) - return false; + Map = new Image(mapImages); - stealBufMem(Size); /* Now freeze that buffer from further use */ + Room = new Image(mapImages); + UpArrowRoom = new Image(mapImages); + DownArrowRoom = new Image(mapImages); + HRoom = new Image(mapImages); + VRoom = new Image(mapImages); + Maze = new Image(mapImages); + HugeMaze = new Image(mapImages); - Map = new Image(buffer); + MapNorth = new Image(mapImages); + MapEast = new Image(mapImages); + MapSouth = new Image(mapImages); + MapWest = new Image(mapImages); - Room = new Image(buffer); - UpArrowRoom = new Image(buffer); - DownArrowRoom = new Image(buffer); - HRoom = new Image(buffer); - VRoom = new Image(buffer); - Maze = new Image(buffer); - HugeMaze = new Image(buffer); + Path = new Image(mapImages); + Bridge = new Image(mapImages); - MapNorth = new Image(buffer); - MapEast = new Image(buffer); - MapSouth = new Image(buffer); - MapWest = new Image(buffer); + Back = new Image(mapImages); + BackAlt = new Image(mapImages); + Up = new Image(mapImages); + UpAlt = new Image(mapImages); + Down = new Image(mapImages); + DownAlt = new Image(mapImages); - Path = new Image(buffer); - Bridge = new Image(buffer); - - Back = new Image(buffer); - BackAlt = new Image(buffer); - Up = new Image(buffer); - UpAlt = new Image(buffer); - Down = new Image(buffer); - DownAlt = new Image(buffer); + delete mapImages; backgadget._image = Back; backgadget._altImage = BackAlt; diff --git a/engines/lab/special.cpp b/engines/lab/special.cpp index 50cf0fe259..f8b0c2091e 100644 --- a/engines/lab/special.cpp +++ b/engines/lab/special.cpp @@ -137,8 +137,6 @@ static void doCombination() { /* Reads in a backdrop picture. */ /*****************************************************************************/ void showCombination(const char *filename) { - byte **buffer; - resetBuffer(); g_lab->_anim->_doBlack = true; g_lab->_anim->_noPalChange = true; @@ -147,10 +145,12 @@ void showCombination(const char *filename) { blackScreen(); - buffer = g_lab->_music->newOpen("P:Numbers"); + Common::File *numFile = g_lab->_resource->openDataFile("P:Numbers"); for (uint16 CurBit = 0; CurBit < 10; CurBit++) - Images[CurBit] = new Image(buffer); + Images[CurBit] = new Image(numFile); + + delete numFile; allocFile((void **)&g_lab->_tempScrollData, Images[0]->_width * Images[0]->_height * 2L, "tempdata"); @@ -279,8 +279,7 @@ static void doTile(bool showsolution) { /* Reads in a backdrop picture. */ /*****************************************************************************/ void showTile(const char *filename, bool showsolution) { - uint16 start; - byte **buffer; + uint16 start = showsolution ? 0 : 1; resetBuffer(); g_lab->_anim->_doBlack = true; @@ -289,19 +288,12 @@ void showTile(const char *filename, bool showsolution) { g_lab->_anim->_noPalChange = false; blackScreen(); - if (showsolution) { - start = 0; - buffer = g_lab->_music->newOpen("P:TileSolution"); - } else { - start = 1; - buffer = g_lab->_music->newOpen("P:Tile"); - } - - if (!buffer) - return; + Common::File *tileFile = tileFile = g_lab->_resource->openDataFile(showsolution ? "P:TileSolution" : "P:Tile"); for (uint16 curBit = start; curBit < 16; curBit++) - Tiles[curBit] = new Image(buffer); + Tiles[curBit] = new Image(tileFile); + + delete tileFile; allocFile((void **)&g_lab->_tempScrollData, Tiles[1]->_width * Tiles[1]->_height * 2L, "tempdata"); @@ -506,7 +498,6 @@ void doWestPaper() { /* Loads in the data for the journal. */ /*****************************************************************************/ static bool loadJournalData() { - byte **buffer; char filename[20]; Gadget *TopGadget = &BackG; bool bridge, dirty, news, clean; @@ -543,17 +534,16 @@ static bool loadJournalData() { journaltext = g_lab->_resource->getText(filename); journaltexttitle = g_lab->_resource->getText("Lab:Rooms/jt"); - buffer = g_lab->_music->newOpen("P:JImage"); + Common::File *journalFile = g_lab->_resource->openDataFile("P:JImage"); - if (!buffer) - return false; + BackG._image = new Image(journalFile); + BackG._altImage = new Image(journalFile); + ForwardG._image = new Image(journalFile); + ForwardG._altImage = new Image(journalFile); + CancelG._image = new Image(journalFile); + CancelG._altImage = new Image(journalFile); - BackG._image = new Image(buffer); - BackG._altImage = new Image(buffer); - ForwardG._image = new Image(buffer); - ForwardG._altImage = new Image(buffer); - CancelG._image = new Image(buffer); - CancelG._altImage = new Image(buffer); + delete journalFile; BackG.KeyEquiv = VKEY_LTARROW; ForwardG.KeyEquiv = VKEY_RTARROW; @@ -807,19 +797,9 @@ bool saveRestoreGame() { /* Makes sure that the buttons are in memory. */ /*****************************************************************************/ static void getMonImages() { - byte **buffer; - uint32 bufferSize; - - resetBuffer(); - - buffer = g_lab->_music->newOpen("P:MonImage", bufferSize); - - if (!buffer) - return; - - MonButton = new Image(buffer); - - stealBufMem(bufferSize); /* Trick: protects the memory where the buttons are so they won't be over-written */ + Common::File *buttonFile = g_lab->_resource->openDataFile("P:MonImage"); + MonButton = new Image(buttonFile); + delete buttonFile; } -- cgit v1.2.3 From 4d46c1e820f7c33f55fa08d92334c25e6bb123c1 Mon Sep 17 00:00:00 2001 From: Filippos Karapetis Date: Thu, 3 Dec 2015 15:07:17 +0200 Subject: LAB: Merge getCurMemLabFile() into allocFile() --- engines/lab/labfile.cpp | 65 ++++++++++++++----------------------------------- 1 file changed, 18 insertions(+), 47 deletions(-) diff --git a/engines/lab/labfile.cpp b/engines/lab/labfile.cpp index 3a34f80b43..4fee3ba93e 100644 --- a/engines/lab/labfile.cpp +++ b/engines/lab/labfile.cpp @@ -69,38 +69,6 @@ static void freeFile(uint16 RMarker) { FileMarkers[RMarker].End = NULL; } - - - - -/*****************************************************************************/ -/* Gets a chunk of memory from the buffer. */ -/*****************************************************************************/ -static void *getCurMemLabFile(uint32 size) { - void *ptr = 0; - - if ((((char *) _memPlace) + size - 1) >= - (((char *) buffer) + buffersize)) - _memPlace = buffer; - - ptr = _memPlace; - _memPlace = (char *)_memPlace + size; - - for (int i = 0; i < MAXMARKERS; i++) { - if (FileMarkers[i].name[0]) { - if ( ((FileMarkers[i].Start >= ptr) && (FileMarkers[i].Start < _memPlace)) - || ((FileMarkers[i].End >= ptr) && (FileMarkers[i].End < _memPlace)) - || ((ptr >= FileMarkers[i].Start) && (ptr <= FileMarkers[i].End))) - freeFile(i); - } - } - - return ptr; -} - - - - /*****************************************************************************/ /* Checks if a file is already buffered. */ /*****************************************************************************/ @@ -118,9 +86,6 @@ byte **isBuffered(const char *fileName) { return NULL; } - - - /*****************************************************************************/ /* Grabs a chunk of memory from the room buffer, and manages it for a */ /* particular room. If it returns true, then the file is already in memory. */ @@ -148,16 +113,29 @@ bool allocFile(void **Ptr, uint32 Size, const char *fileName) { freeFile(RMarker); strcpy(FileMarkers[RMarker].name, fileName); - *Ptr = getCurMemLabFile(Size); - FileMarkers[RMarker].Start = *Ptr; - FileMarkers[RMarker].End = (void *)(((char *)(*Ptr)) + Size - 1); + *Ptr = 0; - return false; -} + if ((((char *)_memPlace) + Size - 1) >= + (((char *)buffer) + buffersize)) + _memPlace = buffer; + *Ptr = _memPlace; + _memPlace = (char *)_memPlace + Size; + for (int i = 0; i < MAXMARKERS; i++) { + if (FileMarkers[i].name[0]) { + if (((FileMarkers[i].Start >= Ptr) && (FileMarkers[i].Start < _memPlace)) + || ((FileMarkers[i].End >= Ptr) && (FileMarkers[i].End < _memPlace)) + || ((Ptr >= FileMarkers[i].Start) && (Ptr <= FileMarkers[i].End))) + freeFile(i); + } + } + FileMarkers[RMarker].Start = *Ptr; + FileMarkers[RMarker].End = (void *)(((char *)(*Ptr)) + Size - 1); + return false; +} /*----- Main routines -----*/ @@ -215,7 +193,6 @@ void resetBuffer() { } - /*****************************************************************************/ /* Initializes the buffer. */ /*****************************************************************************/ @@ -231,9 +208,6 @@ bool initBuffer(uint32 BufSize, bool IsGraphicsMem) { return (buffer != NULL); } - - - /*****************************************************************************/ /* Frees the buffer. */ /*****************************************************************************/ @@ -244,9 +218,6 @@ void freeBuffer() { free(buffer); } - - - /*------------------------------------------------------------------------*/ /* The following routines allow stealing of memory from the buffer (which */ /* later may or may not be given back). */ -- cgit v1.2.3 From ca52b2624ee420b80a79bae2648e3fd5d7e79e76 Mon Sep 17 00:00:00 2001 From: Filippos Karapetis Date: Thu, 3 Dec 2015 15:11:29 +0200 Subject: LAB: The size parameter of newOpen() is no longer used --- engines/lab/music.cpp | 10 +++------- engines/lab/music.h | 1 - 2 files changed, 3 insertions(+), 8 deletions(-) diff --git a/engines/lab/music.cpp b/engines/lab/music.cpp index 6a7bb4baea..e9deb8ee1c 100644 --- a/engines/lab/music.cpp +++ b/engines/lab/music.cpp @@ -320,11 +320,6 @@ void Music::resetMusic() { _tFile = 0; } -byte **Music::newOpen(const char *name) { - uint32 unused; - return newOpen(name, unused); -} - /*****************************************************************************/ /* Checks whether or note enough memory in music buffer before loading any */ /* files. Fills it if not. Does not take into account the current buffer */ @@ -333,7 +328,7 @@ byte **Music::newOpen(const char *name) { /* */ /* Here, the seconds are multipled by 10. */ /*****************************************************************************/ -byte **Music::newOpen(const char *name, uint32 &size) { +byte **Music::newOpen(const char *name) { byte **file; if (!name || !strcmp(name, "") || !strcmp(name, " ")) @@ -347,7 +342,8 @@ byte **Music::newOpen(const char *name, uint32 &size) { if (!_doNotFilestopSoundEffect) stopSoundEffect(); - file = openFile(name, size); + uint32 unused; + file = openFile(name, unused); updateMusic(); return file; } diff --git a/engines/lab/music.h b/engines/lab/music.h index 1e2bdc3166..45528e5d82 100644 --- a/engines/lab/music.h +++ b/engines/lab/music.h @@ -53,7 +53,6 @@ public: Music(LabEngine *vm); byte **newOpen(const char *name); - byte **newOpen(const char *name, uint32 &size); bool initMusic(); void freeMusic(); void updateMusic(); -- cgit v1.2.3 From 58e6627f1989b69a70358ec91ab54a0f180b56c9 Mon Sep 17 00:00:00 2001 From: Filippos Karapetis Date: Thu, 3 Dec 2015 15:23:40 +0200 Subject: LAB: Remove superfluous image variables --- engines/lab/map.cpp | 22 +++++++--------------- 1 file changed, 7 insertions(+), 15 deletions(-) diff --git a/engines/lab/map.cpp b/engines/lab/map.cpp index b3312619c1..9b7f3f3e40 100644 --- a/engines/lab/map.cpp +++ b/engines/lab/map.cpp @@ -72,8 +72,7 @@ extern RoomData *_rooms; static Image *Map, *Room, *UpArrowRoom, *DownArrowRoom, *Bridge, *HRoom, *VRoom, *Maze, *HugeMaze, *Path, *MapNorth, - *MapEast, *MapSouth, *MapWest, *XMark, *Back, *BackAlt, - *Down, *DownAlt, *Up, *UpAlt; + *MapEast, *MapSouth, *MapWest, *XMark; static uint16 MaxRooms; static MapData *Maps; @@ -152,22 +151,15 @@ static bool loadMapData() { Path = new Image(mapImages); Bridge = new Image(mapImages); - Back = new Image(mapImages); - BackAlt = new Image(mapImages); - Up = new Image(mapImages); - UpAlt = new Image(mapImages); - Down = new Image(mapImages); - DownAlt = new Image(mapImages); + backgadget._image = new Image(mapImages); + backgadget._altImage = new Image(mapImages); + upgadget._image = new Image(mapImages); + upgadget._altImage = new Image(mapImages); + downgadget._image = new Image(mapImages); + downgadget._altImage = new Image(mapImages); delete mapImages; - backgadget._image = Back; - backgadget._altImage = BackAlt; - upgadget._image = Up; - upgadget._altImage = UpAlt; - downgadget._image = Down; - downgadget._altImage = DownAlt; - counter = 0; gptr = MapGadgetList; -- cgit v1.2.3 From 58e16e2cd745f170749afa1e3a5a358624556f7c Mon Sep 17 00:00:00 2001 From: Eugene Sandulenko Date: Thu, 3 Dec 2015 19:35:27 +0100 Subject: LAB: More renames and C++'ify --- engines/lab/processroom.cpp | 142 ++++++++++++++++++++------------------------ 1 file changed, 63 insertions(+), 79 deletions(-) diff --git a/engines/lab/processroom.cpp b/engines/lab/processroom.cpp index 1858aebbd1..2976c49ed6 100644 --- a/engines/lab/processroom.cpp +++ b/engines/lab/processroom.cpp @@ -63,22 +63,19 @@ uint16 getRandom(uint16 max) { /*****************************************************************************/ /* Checks whether all the conditions in a condition list are met. */ /*****************************************************************************/ -static bool checkConditions(int16 *Condition) { - int16 Counter; - bool res; - - if (Condition == NULL) +static bool checkConditions(int16 *condition) { + if (condition == NULL) return true; - if (Condition[0] == 0) + if (condition[0] == 0) return true; - Counter = 1; - res = g_lab->_conditions->in(Condition[0]); + int counter = 1; + bool res = g_lab->_conditions->in(condition[0]); - while (Condition[Counter] && res) { - res = g_lab->_conditions->in(Condition[Counter]); - Counter++; + while (condition[counter] && res) { + res = g_lab->_conditions->in(condition[counter]); + counter++; } return res; @@ -88,12 +85,10 @@ static bool checkConditions(int16 *Condition) { /* Gets the current ViewDataPointer. */ /*****************************************************************************/ ViewData *getViewData(uint16 roomNum, uint16 direction) { - ViewData *view = NULL; - if (!_rooms[roomNum]._roomMsg) g_lab->_resource->readViews(roomNum); - view = _rooms[roomNum]._view[direction]; + ViewData *view = _rooms[roomNum]._view[direction]; do { if (checkConditions(view->Condition)) @@ -109,16 +104,11 @@ ViewData *getViewData(uint16 roomNum, uint16 direction) { /* Gets an object, if any, from the user's click on the screen. */ /*****************************************************************************/ static CloseData *getObject(uint16 x, uint16 y, CloseDataPtr lcptr) { - ViewData *VPtr; - if (lcptr == NULL) { - VPtr = getViewData(g_lab->_roomNum, Direction); - lcptr = VPtr->closeUps; - } - - else + lcptr = getViewData(g_lab->_roomNum, Direction)->closeUps; + } else { lcptr = lcptr->SubCloseUps; - + } while (lcptr != NULL) { if ((x >= scaleX(lcptr->x1)) && (y >= scaleY(lcptr->y1)) && @@ -137,21 +127,21 @@ static CloseData *getObject(uint16 x, uint16 y, CloseDataPtr lcptr) { /* some of the closeups have the same hit boxes, then this returns the */ /* first occurence of the object with the same hit box. */ /*****************************************************************************/ -static CloseDataPtr findCPtrMatch(CloseDataPtr Main, CloseDataPtr List) { +static CloseDataPtr findCPtrMatch(CloseDataPtr cpmain, CloseDataPtr list) { CloseDataPtr cptr; - while (List) { - if ((Main->x1 == List->x1) && (Main->x2 == List->x2) && - (Main->y1 == List->y1) && (Main->y2 == List->y2) && - (Main->depth == List->depth)) - return List; + while (list) { + if ((cpmain->x1 == list->x1) && (cpmain->x2 == list->x2) && + (cpmain->y1 == list->y1) && (cpmain->y2 == list->y2) && + (cpmain->depth == list->depth)) + return list; - cptr = findCPtrMatch(Main, List->SubCloseUps); + cptr = findCPtrMatch(cpmain, list->SubCloseUps); if (cptr) return cptr; else - List = List->NextCloseUp; + list = list->NextCloseUp; } return NULL; @@ -161,16 +151,16 @@ static CloseDataPtr findCPtrMatch(CloseDataPtr Main, CloseDataPtr List) { /* Returns the current picture name. */ /*****************************************************************************/ char *getPictName(CloseDataPtr *lcptr) { - ViewData *ViewPtr = getViewData(g_lab->_roomNum, Direction); + ViewData *viewPtr = getViewData(g_lab->_roomNum, Direction); if (*lcptr != NULL) { - *lcptr = findCPtrMatch(*lcptr, ViewPtr->closeUps); + *lcptr = findCPtrMatch(*lcptr, viewPtr->closeUps); if (*lcptr) return (*lcptr)->GraphicName; } - return ViewPtr->GraphicName; + return viewPtr->GraphicName; } /*****************************************************************************/ @@ -204,10 +194,10 @@ void LabEngine::drawDirection(CloseDataPtr lcptr) { /*****************************************************************************/ /* process a arrow gadget movement. */ /*****************************************************************************/ -bool processArrow(uint16 *direction, uint16 Arrow) { - uint16 room = 1; +bool processArrow(uint16 *direction, uint16 arrow) { + if (arrow == 1) { /* Forward */ + uint16 room = 1; - if (Arrow == 1) { /* Forward */ if (*direction == NORTH) room = _rooms[g_lab->_roomNum]._northDoor; else if (*direction == SOUTH) @@ -221,7 +211,7 @@ bool processArrow(uint16 *direction, uint16 Arrow) { return false; else g_lab->_roomNum = room; - } else if (Arrow == 0) { /* Left */ + } else if (arrow == 0) { /* Left */ if (*direction == NORTH) *direction = WEST; else if (*direction == WEST) @@ -230,7 +220,7 @@ bool processArrow(uint16 *direction, uint16 Arrow) { *direction = EAST; else *direction = NORTH; - } else if (Arrow == 2) { /* Right */ + } else if (arrow == 2) { /* Right */ if (*direction == NORTH) *direction = EAST; else if (*direction == EAST) @@ -248,13 +238,11 @@ bool processArrow(uint16 *direction, uint16 Arrow) { /* Sets the current close up data. */ /*****************************************************************************/ void setCurClose(Common::Point pos, CloseDataPtr *cptr, bool useAbsoluteCoords) { - ViewData *VPtr; CloseDataPtr lcptr; uint16 x1, y1, x2, y2; if (*cptr == NULL) { - VPtr = getViewData(g_lab->_roomNum, Direction); - lcptr = VPtr->closeUps; + lcptr = getViewData(g_lab->_roomNum, Direction)->closeUps; } else lcptr = (*cptr)->SubCloseUps; @@ -284,12 +272,10 @@ void setCurClose(Common::Point pos, CloseDataPtr *cptr, bool useAbsoluteCoords) /* Takes the currently selected item. */ /*****************************************************************************/ bool takeItem(uint16 x, uint16 y, CloseDataPtr *cptr) { - ViewData *VPtr; CloseDataPtr lcptr; if (*cptr == NULL) { - VPtr = getViewData(g_lab->_roomNum, Direction); - lcptr = VPtr->closeUps; + lcptr = getViewData(g_lab->_roomNum, Direction)->closeUps; } else if ((*cptr)->CloseUpType < 0) { g_lab->_conditions->inclElement(abs((*cptr)->CloseUpType)); return true; @@ -315,10 +301,7 @@ bool takeItem(uint16 x, uint16 y, CloseDataPtr *cptr) { /* Processes the action list. */ /*****************************************************************************/ void LabEngine::doActions(Action *aptr, CloseDataPtr *lcptr) { - CloseDataPtr tlcptr; bool firstLoaded = true; - char **str; - uint32 startSecs, startMicros, curSecs, curMicros; while (aptr) { _music->updateMusic(); @@ -413,11 +396,12 @@ void LabEngine::doActions(Action *aptr, CloseDataPtr *lcptr) { break; - case SHOWMESSAGES: - str = (char **)aptr->Data; - DoNotDrawMessage = false; - drawMessage(str[getRandom(aptr->Param1)]); - DoNotDrawMessage = true; + case SHOWMESSAGES: { + char **str = (char **)aptr->Data; + DoNotDrawMessage = false; + drawMessage(str[getRandom(aptr->Param1)]); + DoNotDrawMessage = true; + } break; case SETPOSITION: @@ -437,12 +421,12 @@ void LabEngine::doActions(Action *aptr, CloseDataPtr *lcptr) { _anim->_doBlack = true; break; - case SETCLOSEUP: - tlcptr = getObject(scaleX(aptr->Param1), scaleY(aptr->Param2), *lcptr); - - if (tlcptr) - *lcptr = tlcptr; + case SETCLOSEUP: { + CloseDataPtr tlcptr = getObject(scaleX(aptr->Param1), scaleY(aptr->Param2), *lcptr); + if (tlcptr) + *lcptr = tlcptr; + } break; case MAINVIEW: @@ -467,21 +451,23 @@ void LabEngine::doActions(Action *aptr, CloseDataPtr *lcptr) { DoNotDrawMessage = false; break; - case WAITSECS: - addCurTime(aptr->Param1, 0, &startSecs, &startMicros); + case WAITSECS: { + uint32 startSecs, startMicros, curSecs, curMicros; - screenUpdate(); + addCurTime(aptr->Param1, 0, &startSecs, &startMicros); - while (1) { - _music->updateMusic(); - _anim->diffNextFrame(); - getTime(&curSecs, &curMicros); + screenUpdate(); - if ((curSecs > startSecs) || ((curSecs == startSecs) && - (curMicros >= startMicros))) - break; - } + while (1) { + _music->updateMusic(); + _anim->diffNextFrame(); + getTime(&curSecs, &curMicros); + if ((curSecs > startSecs) || ((curSecs == startSecs) && + (curMicros >= startMicros))) + break; + } + } break; case STOPMUSIC: @@ -595,7 +581,7 @@ void LabEngine::doActions(Action *aptr, CloseDataPtr *lcptr) { /*****************************************************************************/ /* Does the work for doActionRule. */ /*****************************************************************************/ -static bool doActionRuleSub(int16 action, int16 roomNum, CloseDataPtr lcptr, CloseDataPtr *Set, bool AllowDefaults) { +static bool doActionRuleSub(int16 action, int16 roomNum, CloseDataPtr lcptr, CloseDataPtr *set, bool allowDefaults) { action++; if (lcptr) { @@ -608,13 +594,13 @@ static bool doActionRuleSub(int16 action, int16 roomNum, CloseDataPtr lcptr, Clo for (RuleList::iterator rule = rules->begin(); rule != rules->end(); ++rule) { if (((*rule)->RuleType == ACTION) && - (((*rule)->Param1 == action) || (((*rule)->Param1 == 0) && AllowDefaults))) { + (((*rule)->Param1 == action) || (((*rule)->Param1 == 0) && allowDefaults))) { if ((((*rule)->Param2 == lcptr->CloseUpType) || - (((*rule)->Param2 == 0) && AllowDefaults)) + (((*rule)->Param2 == 0) && allowDefaults)) || ((action == 1) && ((*rule)->Param2 == (-lcptr->CloseUpType)))) { if (checkConditions((*rule)->Condition)) { - g_lab->doActions((*rule)->ActionList, Set); + g_lab->doActions((*rule)->ActionList, set); return true; } } @@ -629,14 +615,12 @@ static bool doActionRuleSub(int16 action, int16 roomNum, CloseDataPtr lcptr, Clo /* Goes through the rules if an action is taken. */ /*****************************************************************************/ bool doActionRule(Common::Point pos, int16 action, int16 roomNum, CloseDataPtr *lcptr) { - CloseDataPtr tlcptr; - if (roomNum) g_lab->_newFileName = NOFILE; else g_lab->_newFileName = g_lab->_curFileName; - tlcptr = getObject(pos.x, pos.y, *lcptr); + CloseDataPtr tlcptr = getObject(pos.x, pos.y, *lcptr); if (doActionRuleSub(action, roomNum, tlcptr, lcptr, false)) return true; @@ -653,7 +637,7 @@ bool doActionRule(Common::Point pos, int16 action, int16 roomNum, CloseDataPtr * /*****************************************************************************/ /* Does the work for doActionRule. */ /*****************************************************************************/ -static bool doOperateRuleSub(int16 ItemNum, int16 roomNum, CloseDataPtr lcptr, CloseDataPtr *Set, bool AllowDefaults) { +static bool doOperateRuleSub(int16 itemNum, int16 roomNum, CloseDataPtr lcptr, CloseDataPtr *set, bool allowDefaults) { if (lcptr) if (lcptr->CloseUpType > 0) { RuleList *rules = _rooms[roomNum]._rules; @@ -665,10 +649,10 @@ static bool doOperateRuleSub(int16 ItemNum, int16 roomNum, CloseDataPtr lcptr, C for (RuleList::iterator rule = rules->begin(); rule != rules->end(); ++rule) { if (((*rule)->RuleType == OPERATE) && - (((*rule)->Param1 == ItemNum) || (((*rule)->Param1 == 0) && AllowDefaults)) && - (((*rule)->Param2 == lcptr->CloseUpType) || (((*rule)->Param2 == 0) && AllowDefaults))) { + (((*rule)->Param1 == itemNum) || (((*rule)->Param1 == 0) && allowDefaults)) && + (((*rule)->Param2 == lcptr->CloseUpType) || (((*rule)->Param2 == 0) && allowDefaults))) { if (checkConditions((*rule)->Condition)) { - g_lab->doActions((*rule)->ActionList, Set); + g_lab->doActions((*rule)->ActionList, set); return true; } } -- cgit v1.2.3 From c320e6d0aea4a70f8fe1df691432f5900a4f6625 Mon Sep 17 00:00:00 2001 From: Eugene Sandulenko Date: Thu, 3 Dec 2015 19:49:55 +0100 Subject: LAB: Move inventory to LabEngine class --- engines/lab/engine.cpp | 38 +++++++++++++++++++------------------- engines/lab/lab.cpp | 2 ++ engines/lab/lab.h | 4 +++- engines/lab/labfun.h | 1 - engines/lab/processroom.cpp | 9 ++++----- engines/lab/resource.cpp | 16 ++++++++-------- engines/lab/resource.h | 2 +- engines/lab/special.cpp | 7 +++---- 8 files changed, 40 insertions(+), 39 deletions(-) diff --git a/engines/lab/engine.cpp b/engines/lab/engine.cpp index 7b14afc0bf..051ccacd78 100644 --- a/engines/lab/engine.cpp +++ b/engines/lab/engine.cpp @@ -45,7 +45,6 @@ extern bool stopsound, DoNotDrawMessage; /* Global parser data */ extern RoomData *_rooms; -extern InventoryData *Inventory; extern uint16 NumInv, ManyRooms, HighestCondition, Direction; bool ispal = false, noupdatediff = false, MainDisplay = true, QuitLab = false; @@ -159,14 +158,14 @@ void LabEngine::drawRoomMessage(uint16 curInv, CloseDataPtr closePtr) { } if (_alternate) { - if ((curInv <= NumInv) && _conditions->in(curInv) && Inventory[curInv].BInvName) { + if ((curInv <= NumInv) && _conditions->in(curInv) && _inventory[curInv].BInvName) { if ((curInv == LAMPNUM) && _conditions->in(LAMPON)) /* LAB: Labyrinth specific */ drawStaticMessage(kTextLampOn); - else if (Inventory[curInv].Many > 1) { - Common::String roomMessage = Common::String(Inventory[curInv].name) + " (" + Common::String::format("%d", Inventory[curInv].Many) + ")"; + else if (_inventory[curInv].Many > 1) { + Common::String roomMessage = Common::String(_inventory[curInv].name) + " (" + Common::String::format("%d", _inventory[curInv].Many) + ")"; drawMessage(roomMessage.c_str()); } else - drawMessage(Inventory[curInv].name); + drawMessage(_inventory[curInv].name); } } else drawDirection(closePtr); @@ -390,7 +389,7 @@ bool LabEngine::doCloseUp(CloseDataPtr closePtr) { /******************************************************************************/ const char *LabEngine::getInvName(uint16 CurInv) { if (MainDisplay) - return Inventory[CurInv].BInvName; + return _inventory[CurInv].BInvName; if ((CurInv == LAMPNUM) && _conditions->in(LAMPON)) return "P:Mines/120"; @@ -399,20 +398,20 @@ const char *LabEngine::getInvName(uint16 CurInv) { return "P:Future/BeltGlow"; if (CurInv == WESTPAPERNUM) { - g_lab->_curFileName = Inventory[CurInv].BInvName; + g_lab->_curFileName = _inventory[CurInv].BInvName; g_lab->_anim->_noPalChange = true; readPict(g_lab->_curFileName, false); g_lab->_anim->_noPalChange = false; doWestPaper(); } else if (CurInv == NOTESNUM) { - g_lab->_curFileName = Inventory[CurInv].BInvName; + g_lab->_curFileName = _inventory[CurInv].BInvName; g_lab->_anim->_noPalChange = true; readPict(g_lab->_curFileName, false); g_lab->_anim->_noPalChange = false; doNotes(); } - return Inventory[CurInv].BInvName; + return _inventory[CurInv].BInvName; } /******************************************************************************/ @@ -517,7 +516,7 @@ void LabEngine::decIncInv(uint16 *CurInv, bool dec) { (*CurInv)++; while (*CurInv && (*CurInv <= NumInv)) { - if (_conditions->in(*CurInv) && Inventory[*CurInv].BInvName) { + if (_conditions->in(*CurInv) && _inventory[*CurInv].BInvName) { _nextFileName = getInvName(*CurInv); break; } @@ -535,7 +534,7 @@ void LabEngine::decIncInv(uint16 *CurInv, bool dec) { *CurInv = 1; while (*CurInv && (*CurInv <= NumInv)) { - if (_conditions->in(*CurInv) && Inventory[*CurInv].BInvName) { + if (_conditions->in(*CurInv) && _inventory[*CurInv].BInvName) { _nextFileName = getInvName(*CurInv); break; } @@ -565,7 +564,8 @@ void LabEngine::mainGameLoop() { Direction = NORTH; _resource->readRoomData("LAB:Doors"); - _resource->readInventory("LAB:Inventor"); + if (!(_inventory = _resource->readInventory("LAB:Inventor"))) + return; if (!(_conditions = new LargeSet(HighestCondition + 1, this))) return; @@ -698,16 +698,16 @@ void LabEngine::mainGameLoop() { _rooms = nullptr; } - if (Inventory) { + if (_inventory) { for (int i = 1; i <= NumInv; i++) { - if (Inventory[i].name) - free(Inventory[i].name); + if (_inventory[i].name) + free(_inventory[i].name); - if (Inventory[i].BInvName) - free(Inventory[i].BInvName); + if (_inventory[i].BInvName) + free(_inventory[i].BInvName); } - free(Inventory); + free(_inventory); } } @@ -1041,7 +1041,7 @@ bool LabEngine::from_crumbs(uint32 tmpClass, uint16 code, uint16 Qualifier, Comm } if ((curInv <= NumInv) && _conditions->in(curInv) && - Inventory[curInv].BInvName) + _inventory[curInv].BInvName) _nextFileName = getInvName(curInv); screenUpdate(); diff --git a/engines/lab/lab.cpp b/engines/lab/lab.cpp index 7bb05c8969..90c713135b 100644 --- a/engines/lab/lab.cpp +++ b/engines/lab/lab.cpp @@ -112,6 +112,8 @@ LabEngine::LabEngine(OSystem *syst, const ADGameDescription *gameDesc) _longWinInFront = false; _msgFont = 0; + _inventory = 0; + //const Common::FSNode gameDataDir(ConfMan.get("path")); //SearchMan.addSubDirectoryMatching(gameDataDir, "game"); //SearchMan.addSubDirectoryMatching(gameDataDir, "game/pict"); diff --git a/engines/lab/lab.h b/engines/lab/lab.h index f19a1bacff..d8b75cbc62 100644 --- a/engines/lab/lab.h +++ b/engines/lab/lab.h @@ -125,7 +125,6 @@ public: const char *_newFileName; /* When ProcessRoom.c decides to change the filename of the current picture. */ - private: int _lastWaitTOFTicks; bool _lastMessageLong; @@ -133,6 +132,7 @@ private: TextFont *_msgFont; bool _longWinInFront; CloseDataPtr _cptr; + InventoryData *_inventory; private: bool createScreen(bool HiRes); @@ -194,6 +194,8 @@ private: void mayShowCrumbIndicatorOff(); const char *getInvName(uint16 curInv); + bool saveRestoreGame(); + public: void doActions(Action *aPtr, CloseDataPtr *lcptr); diff --git a/engines/lab/labfun.h b/engines/lab/labfun.h index ad84402933..987864b097 100644 --- a/engines/lab/labfun.h +++ b/engines/lab/labfun.h @@ -193,7 +193,6 @@ void doJournal(); void doNotes(); void doWestPaper(); void doMonitor(char *background, char *textfile, bool isinteractive, uint16 x1, uint16 y1, uint16 x2, uint16 y2); -bool saveRestoreGame(); /*--------------------------*/ /*----- From saveGame.c ----*/ diff --git a/engines/lab/processroom.cpp b/engines/lab/processroom.cpp index 2976c49ed6..954bf00f68 100644 --- a/engines/lab/processroom.cpp +++ b/engines/lab/processroom.cpp @@ -45,7 +45,6 @@ namespace Lab { #define NOFILE "no file" RoomData *_rooms; -InventoryData *Inventory; uint16 NumInv, ManyRooms, HighestCondition, Direction; extern bool DoNotDrawMessage, noupdatediff, QuitLab, MusicOn; @@ -434,16 +433,16 @@ void LabEngine::doActions(Action *aptr, CloseDataPtr *lcptr) { break; case SUBINV: - if (Inventory[aptr->Param1].Many) - (Inventory[aptr->Param1].Many)--; + if (_inventory[aptr->Param1].Many) + (_inventory[aptr->Param1].Many)--; - if (Inventory[aptr->Param1].Many == 0) + if (_inventory[aptr->Param1].Many == 0) _conditions->exclElement(aptr->Param1); break; case ADDINV: - (Inventory[aptr->Param1].Many) += aptr->Param2; + (_inventory[aptr->Param1].Many) += aptr->Param2; _conditions->inclElement(aptr->Param1); break; diff --git a/engines/lab/resource.cpp b/engines/lab/resource.cpp index 415839d986..303bae85ab 100644 --- a/engines/lab/resource.cpp +++ b/engines/lab/resource.cpp @@ -36,7 +36,6 @@ namespace Lab { static uint16 allocroom; extern RoomData *_rooms; -extern InventoryData *Inventory; extern uint16 NumInv, ManyRooms, HighestCondition; Resource::Resource(LabEngine *vm) : _vm(vm) { @@ -127,22 +126,23 @@ bool Resource::readRoomData(const char *fileName) { return true; } -bool Resource::readInventory(const char *fileName) { +InventoryData *Resource::readInventory(const char *fileName) { Common::File *dataFile; if (!(dataFile = openDataFile(fileName, MKTAG('I', 'N', 'V', '1')))) - return false; + return nullptr; NumInv = dataFile->readUint16LE(); - Inventory = (InventoryData *)malloc((NumInv + 1) * sizeof(InventoryData)); + InventoryData *inventory = (InventoryData *)malloc((NumInv + 1) * sizeof(InventoryData)); for (uint16 i = 1; i <= NumInv; i++) { - Inventory[i].Many = dataFile->readUint16LE(); - Inventory[i].name = readString(dataFile); - Inventory[i].BInvName = readString(dataFile); + inventory[i].Many = dataFile->readUint16LE(); + inventory[i].name = readString(dataFile); + inventory[i].BInvName = readString(dataFile); } delete dataFile; - return true; + + return inventory; } bool Resource::readViews(uint16 roomNum) { diff --git a/engines/lab/resource.h b/engines/lab/resource.h index 35165693a0..2c7f9b75eb 100644 --- a/engines/lab/resource.h +++ b/engines/lab/resource.h @@ -100,7 +100,7 @@ public: Common::File *openDataFile(const char * fileName, uint32 fileHeader = 0); bool readRoomData(const char *fileName); - bool readInventory(const char *fileName); + InventoryData *readInventory(const char *fileName); bool readViews(uint16 roomNum); TextFont *getFont(const char *fileName); char *getText(const char *fileName); diff --git a/engines/lab/special.cpp b/engines/lab/special.cpp index f8b0c2091e..9f36303a1d 100644 --- a/engines/lab/special.cpp +++ b/engines/lab/special.cpp @@ -83,7 +83,6 @@ uint16 CurTile[4][4] = { extern uint16 *FadePalette; extern BitMap *DispBitMap, *DrawBitMap; -extern InventoryData *Inventory; extern uint16 Direction; #define COMBINATIONUNLOCKED 130 @@ -753,7 +752,7 @@ void LabEngine::doJournal() { freeAllStolenMem(); } -bool saveRestoreGame() { +bool LabEngine::saveRestoreGame() { bool isOK = false; //g_lab->showMainMenu(); @@ -775,14 +774,14 @@ bool saveRestoreGame() { desc = dialog->createDefaultSaveDescription(slot); } - isOK = saveGame(Direction, Inventory[QUARTERNUM].Many, slot, desc); + isOK = saveGame(Direction, _inventory[QUARTERNUM].Many, slot, desc); } } else { // Restore GUI::SaveLoadChooser *dialog = new GUI::SaveLoadChooser(_("Restore game:"), _("Restore"), false); int slot = dialog->runModalWithCurrentTarget(); if (slot >= 0) { - isOK = loadGame(&Direction, &(Inventory[QUARTERNUM].Many), slot); + isOK = loadGame(&Direction, &(_inventory[QUARTERNUM].Many), slot); if (isOK) g_lab->_music->resetMusic(); } -- cgit v1.2.3 From c6041a41a3172c23f8c4170fc83a1949e9c832a1 Mon Sep 17 00:00:00 2001 From: Eugene Sandulenko Date: Thu, 3 Dec 2015 19:52:33 +0100 Subject: LAB: More renames --- engines/lab/parsefun.h | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/engines/lab/parsefun.h b/engines/lab/parsefun.h index 37ff977851..ad8f04b0e9 100644 --- a/engines/lab/parsefun.h +++ b/engines/lab/parsefun.h @@ -38,7 +38,7 @@ namespace Lab { /* From Parser.c */ -bool parse(const char *InputFile); +bool parse(const char *inputFile); /* From allocRoom.c */ @@ -48,14 +48,14 @@ void freeRoomBuffer(); /* From ProcessRoom.c */ -ViewData *getViewData(uint16 RoomNum, uint16 Direction); +ViewData *getViewData(uint16 roomNum, uint16 direction); char *getPictName(CloseDataPtr *lcptr); void drawDirection(CloseDataPtr lcptr); -bool processArrow(uint16 *Direction, uint16 Arrow); +bool processArrow(uint16 *direction, uint16 arrow); void setCurClose(Common::Point pos, CloseDataPtr *cptr, bool useAbsoluteCoords = false); bool takeItem(uint16 x, uint16 y, CloseDataPtr *cptr); -bool doActionRule(Common::Point pos, int16 action, int16 RoomNum, CloseDataPtr *lcptr); -bool doOperateRule(int16 x, int16 y, int16 ItemNum, CloseDataPtr *lcptr); +bool doActionRule(Common::Point pos, int16 action, int16 roomNum, CloseDataPtr *lcptr); +bool doOperateRule(int16 x, int16 y, int16 itemNum, CloseDataPtr *lcptr); bool doGoForward(CloseDataPtr *lcptr); bool doTurn(uint16 from, uint16 to, CloseDataPtr *lcptr); bool doMainView(CloseDataPtr *lcptr); -- cgit v1.2.3 From 021cb4c526b8dbe8b33b3ae03703be36893410da Mon Sep 17 00:00:00 2001 From: Filippos Karapetis Date: Fri, 4 Dec 2015 02:10:55 +0200 Subject: LAB: Rename roomCords to roomCoords --- engines/lab/map.cpp | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/engines/lab/map.cpp b/engines/lab/map.cpp index 9b7f3f3e40..9ca57b0001 100644 --- a/engines/lab/map.cpp +++ b/engines/lab/map.cpp @@ -237,7 +237,7 @@ void fade(bool fadein, uint16 res) { /*****************************************************************************/ /* Figures out what a room's coordinates should be. */ /*****************************************************************************/ -static void roomCords(uint16 CurRoom, uint16 *x1, uint16 *y1, uint16 *x2, uint16 *y2) { +static void roomCoords(uint16 CurRoom, uint16 *x1, uint16 *y1, uint16 *x2, uint16 *y2) { Image *curRoomImg = NULL; switch (Maps[CurRoom].SpecialID) { @@ -699,7 +699,7 @@ void LabEngine::processMap(uint16 CurRoom) { OldMsg = CurMsg; for (uint16 i = 1; i <= MaxRooms; i++) { - roomCords(i, &x1, &y1, &x2, &y2); + roomCoords(i, &x1, &y1, &x2, &y2); if ((Maps[i].PageNumber == CurFloor) && _roomsFound->in(i) @@ -722,7 +722,7 @@ void LabEngine::processMap(uint16 CurRoom) { if (Maps[OldMsg].PageNumber == CurFloor) drawRoom(OldMsg, (bool)(OldMsg == CurRoom)); - roomCords(CurMsg, &x1, &y1, &x2, &y2); + roomCoords(CurMsg, &x1, &y1, &x2, &y2); x1 = (x1 + x2) / 2; y1 = (y1 + y2) / 2; -- cgit v1.2.3 From d50e9f35415240c7f848a12e1a5b35a0bd314fe1 Mon Sep 17 00:00:00 2001 From: Filippos Karapetis Date: Fri, 4 Dec 2015 02:11:54 +0200 Subject: LAB: Remove dead code In all cases, dx and dy are always positive --- engines/lab/image.cpp | 106 ++++++++++++-------------------------------------- engines/lab/vga.cpp | 94 ++++++++++++-------------------------------- 2 files changed, 48 insertions(+), 152 deletions(-) diff --git a/engines/lab/image.cpp b/engines/lab/image.cpp index 3f5801fa1c..1d8b9d61f5 100644 --- a/engines/lab/image.cpp +++ b/engines/lab/image.cpp @@ -53,32 +53,18 @@ Image::Image(Common::File *s) { /* Draws an image to the screen. */ /*****************************************************************************/ void Image::drawImage(uint16 x, uint16 y) { - int sx = 0, sy = 0; - int dx = x, dy = y; int w = _width; int h = _height; - if (dx < 0) { - sx -= dx; - w += dx; - dx = 0; - } - - if (dy < 0) { - sy -= dy; - w += dy; - dy = 0; - } - - if (dx + w > g_lab->_screenWidth) - w = g_lab->_screenWidth - dx; + if (x + w > g_lab->_screenWidth) + w = g_lab->_screenWidth - x; - if (dy + h > g_lab->_screenHeight) - h = g_lab->_screenHeight - dy; + if (y + h > g_lab->_screenHeight) + h = g_lab->_screenHeight - y; if ((w > 0) && (h > 0)) { - byte *s = _imageData + sy * _width + sx; - byte *d = g_lab->getCurrentDrawingBuffer() + dy * g_lab->_screenWidth + dx; + byte *s = _imageData; + byte *d = g_lab->getCurrentDrawingBuffer() + y * g_lab->_screenWidth + x; while (h-- > 0) { memcpy(d, s, w); @@ -92,32 +78,18 @@ void Image::drawImage(uint16 x, uint16 y) { /* Draws an image to the screen. */ /*****************************************************************************/ void Image::drawMaskImage(uint16 x, uint16 y) { - int sx = 0, sy = 0; - int dx = x, dy = y; int w = _width; int h = _height; - if (dx < 0) { - sx -= dx; - w += dx; - dx = 0; - } - - if (dy < 0) { - sy -= dy; - w += dy; - dy = 0; - } - - if (dx + w > g_lab->_screenWidth) - w = g_lab->_screenWidth - dx; + if (x + w > g_lab->_screenWidth) + w = g_lab->_screenWidth - x; - if (dy + h > g_lab->_screenHeight) - h = g_lab->_screenHeight - dy; + if (y + h > g_lab->_screenHeight) + h = g_lab->_screenHeight - y; if ((w > 0) && (h > 0)) { - byte *s = _imageData + sy * _width + sx; - byte *d = g_lab->getCurrentDrawingBuffer() + dy * g_lab->_screenWidth + dx; + byte *s = _imageData; + byte *d = g_lab->getCurrentDrawingBuffer() + y * g_lab->_screenWidth + x; while (h-- > 0) { byte *ss = s; @@ -141,32 +113,18 @@ void Image::drawMaskImage(uint16 x, uint16 y) { /* Reads an image from the screen. */ /*****************************************************************************/ void Image::readScreenImage(uint16 x, uint16 y) { - int sx = 0, sy = 0; - int dx = x, dy = y; int w = _width; int h = _height; - if (dx < 0) { - sx -= dx; - w += dx; - dx = 0; - } - - if (dy < 0) { - sy -= dy; - w += dy; - dy = 0; - } - - if (dx + w > g_lab->_screenWidth) - w = g_lab->_screenWidth - dx; + if (x + w > g_lab->_screenWidth) + w = g_lab->_screenWidth - x; - if (dy + h > g_lab->_screenHeight) - h = g_lab->_screenHeight - dy; + if (y + h > g_lab->_screenHeight) + h = g_lab->_screenHeight - y; if ((w > 0) && (h > 0)) { - byte *s = _imageData + sy * _width + sx; - byte *d = g_lab->getCurrentDrawingBuffer() + dy * g_lab->_screenWidth + dx; + byte *s = _imageData; + byte *d = g_lab->getCurrentDrawingBuffer() + y * g_lab->_screenWidth + x; while (h-- > 0) { memcpy(s, d, w); @@ -184,34 +142,18 @@ void Image::bltBitMap(uint16 xs, uint16 ys, Image *imDest, uint16 xd, uint16 yd, uint16 width, uint16 height) { // I think the old code assumed that the source image data was valid for the given box. // I will proceed on that assumption. - int sx = xs; - int sy = ys; - int dx = xd; - int dy = yd; int w = width; int h = height; - if (dx < 0) { - sx -= dx; - w += dx; - dx = 0; - } - - if (dy < 0) { - sy -= dy; - w += dy; - dy = 0; - } - - if (dx + w > imDest->_width) - w = imDest->_width - dx; + if (xd + w > imDest->_width) + w = imDest->_width - xd; - if (dy + h > imDest->_height) - h = imDest->_height - dy; + if (yd + h > imDest->_height) + h = imDest->_height - yd; if (w > 0 && h > 0) { - byte *s = _imageData + sy * _width + sx; - byte *d = imDest->_imageData + dy * imDest->_width + dx; + byte *s = _imageData + ys * _width + xs; + byte *d = imDest->_imageData + yd * imDest->_width + xd; while (h-- > 0) { memcpy(d, s, w); diff --git a/engines/lab/vga.cpp b/engines/lab/vga.cpp index 0248bb823c..727914025a 100644 --- a/engines/lab/vga.cpp +++ b/engines/lab/vga.cpp @@ -144,25 +144,14 @@ void LabEngine::scrollDisplayX(int16 dx, uint16 x1, uint16 y1, uint16 x2, uint16 y1 = temp; } - if (dx > 0) { - im._width = x2 - x1 + 1 - dx; - im._height = y2 - y1 + 1; + im._width = x2 - x1 + 1 - dx; + im._height = y2 - y1 + 1; - im.readScreenImage(x1, y1); - im.drawImage(x1 + dx, y1); + im.readScreenImage(x1, y1); + im.drawImage(x1 + dx, y1); - setAPen(0); - rectFill(x1, y1, x1 + dx - 1, y2); - } else if (dx < 0) { - im._width = x2 - x1 + 1 + dx; - im._height = y2 - y1 + 1; - - im.readScreenImage(x1 - dx, y1); - im.drawImage(x1, y1); - - setAPen(0); - rectFill(x2 + dx + 1, y1, x2, y2); - } + setAPen(0); + rectFill(x1, y1, x1 + dx - 1, y2); } /*****************************************************************************/ @@ -186,25 +175,14 @@ void LabEngine::scrollDisplayY(int16 dy, uint16 x1, uint16 y1, uint16 x2, uint16 y1 = temp; } - if (dy > 0) { - im._width = x2 - x1 + 1; - im._height = y2 - y1 + 1 - dy; - - im.readScreenImage(x1, y1); - im.drawImage(x1, y1 + dy); + im._width = x2 - x1 + 1; + im._height = y2 - y1 + 1 - dy; - setAPen(0); - rectFill(x1, y1, x2, y1 + dy - 1); - } else if (dy < 0) { - im._width = x2 - x1 + 1; - im._height = y2 - y1 + 1 + dy; + im.readScreenImage(x1, y1); + im.drawImage(x1, y1 + dy); - im.readScreenImage(x1, y1 - dy); - im.drawImage(x1, y1); - - setAPen(0); - rectFill(x1, y2 + dy + 1, x2, y2); - } + setAPen(0); + rectFill(x1, y1, x2, y1 + dy - 1); } /*****************************************************************************/ @@ -218,29 +196,17 @@ void LabEngine::setAPen(byte pennum) { /* Fills in a rectangle. */ /*****************************************************************************/ void LabEngine::rectFill(uint16 x1, uint16 y1, uint16 x2, uint16 y2) { - int dx = x1; - int dy = y1; int w = x2 - x1 + 1; int h = y2 - y1 + 1; - if (dx < 0) { - w += dx; - dx = 0; - } - - if (dy < 0) { - w += dy; - dy = 0; - } - - if (dx + w > _screenWidth) - w = _screenWidth - dx; + if (x1 + w > _screenWidth) + w = _screenWidth - x1; - if (dy + h > _screenHeight) - h = _screenHeight - dy; + if (y1 + h > _screenHeight) + h = _screenHeight - y1; if ((w > 0) && (h > 0)) { - char *d = (char *)getCurrentDrawingBuffer() + dy * _screenWidth + dx; + char *d = (char *)getCurrentDrawingBuffer() + y1 * _screenWidth + x1; while (h-- > 0) { char *dd = d; @@ -273,35 +239,23 @@ void LabEngine::drawHLine(uint16 x1, uint16 y, uint16 x2) { /* Overlays a region on the screen using the desired pen color. */ /*****************************************************************************/ void LabEngine::overlayRect(uint16 pencolor, uint16 x1, uint16 y1, uint16 x2, uint16 y2) { - int dx = x1; - int dy = y1; int w = x2 - x1 + 1; int h = y2 - y1 + 1; - if (dx < 0) { - w += dx; - dx = 0; - } - - if (dy < 0) { - w += dy; - dy = 0; - } - - if (dx + w > _screenWidth) - w = _screenWidth - dx; + if (x1 + w > _screenWidth) + w = _screenWidth - x1; - if (dy + h > _screenHeight) - h = _screenHeight - dy; + if (y1 + h > _screenHeight) + h = _screenHeight - y1; if ((w > 0) && (h > 0)) { - char *d = (char *)getCurrentDrawingBuffer() + dy * _screenWidth + dx; + char *d = (char *)getCurrentDrawingBuffer() + y1 * _screenWidth + x1; while (h-- > 0) { char *dd = d; int ww = w; - if (dy & 1) { + if (y1 & 1) { dd++; ww--; } @@ -313,7 +267,7 @@ void LabEngine::overlayRect(uint16 pencolor, uint16 x1, uint16 y1, uint16 x2, ui } d += _screenWidth; - dy++; + y1++; } } } -- cgit v1.2.3 From b7faa0bccfcefa33e5bb3345b548aa504bd22982 Mon Sep 17 00:00:00 2001 From: Filippos Karapetis Date: Fri, 4 Dec 2015 02:44:29 +0200 Subject: LAB: Fix bug in getText() --- engines/lab/resource.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/engines/lab/resource.cpp b/engines/lab/resource.cpp index 303bae85ab..5be7aedea5 100644 --- a/engines/lab/resource.cpp +++ b/engines/lab/resource.cpp @@ -86,7 +86,7 @@ char *Resource::getText(const char *fileName) { g_lab->_music->updateMusic(); - byte count = dataFile->size(); + uint32 count = dataFile->size(); byte *buffer = new byte[count]; byte *text = buffer; dataFile->read(buffer, count); -- cgit v1.2.3 From c399536a07b6bf96ff311d4398f51e2d865a2027 Mon Sep 17 00:00:00 2001 From: Filippos Karapetis Date: Fri, 4 Dec 2015 02:52:29 +0200 Subject: LAB: Small cleanup in from_crumbs() --- engines/lab/engine.cpp | 13 ++----------- 1 file changed, 2 insertions(+), 11 deletions(-) diff --git a/engines/lab/engine.cpp b/engines/lab/engine.cpp index 051ccacd78..d7d9f3b577 100644 --- a/engines/lab/engine.cpp +++ b/engines/lab/engine.cpp @@ -864,17 +864,8 @@ bool LabEngine::from_crumbs(uint32 tmpClass, uint16 code, uint16 Qualifier, Comm perFlipGadget(actionMode); - if (gadgetId == 0) - drawStaticMessage(kTextTakeWhat); - else if (gadgetId == 1) - drawStaticMessage(kTextMoveWhat); - else if (gadgetId == 2) - drawStaticMessage(kTextOpenWhat); - else if (gadgetId == 3) - drawStaticMessage(kTextCloseWhat); - else if (gadgetId == 4) - drawStaticMessage(kTextLookWhat); - + if (gadgetId <= 4) + drawStaticMessage(kTextTakeWhat + gadgetId); screenUpdate(); } } else if (gadgetId == 9) { -- cgit v1.2.3 From 733fbe4c62911adc478400ba5d0dcf220e1b45ee Mon Sep 17 00:00:00 2001 From: Strangerke Date: Fri, 4 Dec 2015 13:32:08 +0100 Subject: LAB: Start working on a separate DisplayMan class --- engines/lab/anim.cpp | 8 +- engines/lab/engine.cpp | 307 +++++++--------------------- engines/lab/eventman.cpp | 2 +- engines/lab/graphics.cpp | 480 +++++++++++++++++++++++++++++++++----------- engines/lab/graphics.h | 110 ++++++++++ engines/lab/interface.cpp | 2 +- engines/lab/intro.cpp | 24 +-- engines/lab/lab.cpp | 29 ++- engines/lab/lab.h | 34 +--- engines/lab/labfun.h | 42 ---- engines/lab/map.cpp | 40 ++-- engines/lab/processroom.cpp | 46 ++--- engines/lab/savegame.cpp | 2 +- engines/lab/special.cpp | 169 ++++++++-------- engines/lab/text.cpp | 16 +- engines/lab/vga.cpp | 83 +------- 16 files changed, 722 insertions(+), 672 deletions(-) create mode 100644 engines/lab/graphics.h diff --git a/engines/lab/anim.cpp b/engines/lab/anim.cpp index f4cae849f7..9402f9cd2a 100644 --- a/engines/lab/anim.cpp +++ b/engines/lab/anim.cpp @@ -462,7 +462,7 @@ void Anim::diffNextFrame() { _curBit = 0; if (DispBitMap->_flags & BITMAPF_VIDEO) - _vm->screenUpdate(); + _vm->_graphics->screenUpdate(); return; /* done with the next frame. */ } @@ -567,7 +567,7 @@ void Anim::diffNextFrame() { _vm->_event->mouseShow(); if (!didTOF) - _vm->screenUpdate(); + _vm->_graphics->screenUpdate(); return; } @@ -602,7 +602,7 @@ void Anim::playDiff() { if (_doBlack) { _doBlack = false; - blackScreen(); + _vm->_graphics->blackScreen(); } _start = *startoffile; /* Make a copy of the pointer to the start of the file */ @@ -683,7 +683,7 @@ void Anim::playDiff() { /*****************************************************************************/ void Anim::stopDiff() { if (_isPlaying && _isAnim) - blackScreen(); + _vm->_graphics->blackScreen(); } /*****************************************************************************/ diff --git a/engines/lab/engine.cpp b/engines/lab/engine.cpp index d7d9f3b577..293c9452cd 100644 --- a/engines/lab/engine.cpp +++ b/engines/lab/engine.cpp @@ -40,7 +40,7 @@ namespace Lab { -extern bool stopsound, DoNotDrawMessage; +extern bool DoNotDrawMessage; /* Global parser data */ @@ -95,59 +95,6 @@ static char initcolors[] = { '\x00', '\x00', '\x00', '\x30', '\x24', '\x24', '\x2c', '\x2c', '\x2c', '\x08', '\x08', '\x08'}; -/******************************************************************************/ -/* Draws the control panel display. */ -/******************************************************************************/ -void LabEngine::drawPanel() { - _event->mouseHide(); - - setAPen(3); /* Clear Area */ - rectFill(0, VGAScaleY(149) + SVGACord(2), VGAScaleX(319), VGAScaleY(199)); - - setAPen(0); /* First Line */ - drawHLine(0, VGAScaleY(149) + SVGACord(2), VGAScaleX(319)); - setAPen(5); /* Second Line */ - drawHLine(0, VGAScaleY(149) + 1 + SVGACord(2), VGAScaleX(319)); - - /* Gadget Separators */ - setAPen(0); - drawHLine(0, VGAScaleY(170), VGAScaleX(319)); /* First black line to separate buttons */ - - if (!_alternate) { - setAPen(4); - drawHLine(0, VGAScaleY(170) + 1, VGAScaleX(319)); /* The horizontal lines under the black one */ - drawGadgetList(_moveGadgetList); - } else { - if (getPlatform() != Common::kPlatformWindows) { - drawVLine(VGAScaleX(124), VGAScaleY(170) + 1, VGAScaleY(199)); /* Vertical Black lines */ - drawVLine(VGAScaleX(194), VGAScaleY(170) + 1, VGAScaleY(199)); - } else { - drawVLine(VGAScaleX(90), VGAScaleY(170) + 1, VGAScaleY(199)); /* Vertical Black lines */ - drawVLine(VGAScaleX(160), VGAScaleY(170) + 1, VGAScaleY(199)); - drawVLine(VGAScaleX(230), VGAScaleY(170) + 1, VGAScaleY(199)); - } - - setAPen(4); - drawHLine(0, VGAScaleY(170) + 1, VGAScaleX(122)); /* The horizontal lines under the black one */ - drawHLine(VGAScaleX(126), VGAScaleY(170) + 1, VGAScaleX(192)); - drawHLine(VGAScaleX(196), VGAScaleY(170) + 1, VGAScaleX(319)); - - drawVLine(VGAScaleX(1), VGAScaleY(170) + 2, VGAScaleY(198)); /* The vertical high light lines */ - if (getPlatform() != Common::kPlatformWindows) { - drawVLine(VGAScaleX(126), VGAScaleY(170) + 2, VGAScaleY(198)); - drawVLine(VGAScaleX(196), VGAScaleY(170) + 2, VGAScaleY(198)); - } else { - drawVLine(VGAScaleX(92), VGAScaleY(170) + 2, VGAScaleY(198)); - drawVLine(VGAScaleX(162), VGAScaleY(170) + 2, VGAScaleY(198)); - drawVLine(VGAScaleX(232), VGAScaleY(170) + 2, VGAScaleY(198)); - } - - drawGadgetList(_invGadgetList); - } - - _event->mouseShow(); -} - /******************************************************************************/ /* Draws the message for the room. */ /******************************************************************************/ @@ -163,116 +110,14 @@ void LabEngine::drawRoomMessage(uint16 curInv, CloseDataPtr closePtr) { drawStaticMessage(kTextLampOn); else if (_inventory[curInv].Many > 1) { Common::String roomMessage = Common::String(_inventory[curInv].name) + " (" + Common::String::format("%d", _inventory[curInv].Many) + ")"; - drawMessage(roomMessage.c_str()); + _graphics->drawMessage(roomMessage.c_str()); } else - drawMessage(_inventory[curInv].name); + _graphics->drawMessage(_inventory[curInv].name); } } else drawDirection(closePtr); - _lastTooLong = _lastMessageLong; -} - -/******************************************************************************/ -/* Sets up the Labyrinth screens, and opens up the initial windows. */ -/******************************************************************************/ -bool LabEngine::setUpScreens() { - if (!createScreen(_isHiRes)) - return false; - - Common::File *controlFile = g_lab->_resource->openDataFile("P:Control"); - for (uint16 i = 0; i < 20; i++) - _moveImages[i] = new Image(controlFile); - delete controlFile; - - /* Creates the gadgets for the movement control panel */ - uint16 y = VGAScaleY(173) - SVGACord(2); - - if (getPlatform() == Common::kPlatformWindows) { - _moveGadgetList = createButton(1, y, 0, 't', _moveImages[0], _moveImages[1]); - Gadget *curGadget = _moveGadgetList; - curGadget->NextGadget = createButton(33, y, 1, 'm', _moveImages[2], _moveImages[3]); - curGadget = curGadget->NextGadget; - curGadget->NextGadget = createButton(65, y, 2, 'o', _moveImages[4], _moveImages[5]); - curGadget = curGadget->NextGadget; - curGadget->NextGadget = createButton(97, y, 3, 'c', _moveImages[6], _moveImages[7]); - curGadget = curGadget->NextGadget; - curGadget->NextGadget = createButton(129, y, 4, 'l', _moveImages[8], _moveImages[9]); - curGadget = curGadget->NextGadget; - curGadget->NextGadget = createButton(161, y, 5, 'i', _moveImages[12], _moveImages[13]); - curGadget = curGadget->NextGadget; - curGadget->NextGadget = createButton(193, y, 6, VKEY_LTARROW, _moveImages[14], _moveImages[15]); - curGadget = curGadget->NextGadget; - curGadget->NextGadget = createButton(225, y, 7, VKEY_UPARROW, _moveImages[16], _moveImages[17]); - curGadget = curGadget->NextGadget; - curGadget->NextGadget = createButton(257, y, 8, VKEY_RTARROW, _moveImages[18], _moveImages[19]); - curGadget = curGadget->NextGadget; - curGadget->NextGadget = createButton(289, y, 9, 'p', _moveImages[10], _moveImages[11]); - } else { - _moveGadgetList = createButton(1, y, 0, 0, _moveImages[0], _moveImages[1]); - Gadget *curGadget = _moveGadgetList; - curGadget->NextGadget = createButton(33, y, 1, 0, _moveImages[2], _moveImages[3]); - curGadget = curGadget->NextGadget; - curGadget->NextGadget = createButton(65, y, 2, 0, _moveImages[4], _moveImages[5]); - curGadget = curGadget->NextGadget; - curGadget->NextGadget = createButton(97, y, 3, 0, _moveImages[6], _moveImages[7]); - curGadget = curGadget->NextGadget; - curGadget->NextGadget = createButton(129, y, 4, 0, _moveImages[8], _moveImages[9]); - curGadget = curGadget->NextGadget; - curGadget->NextGadget = createButton(161, y, 5, 0, _moveImages[12], _moveImages[13]); - curGadget = curGadget->NextGadget; - curGadget->NextGadget = createButton(193, y, 6, 0, _moveImages[14], _moveImages[15]); - curGadget = curGadget->NextGadget; - curGadget->NextGadget = createButton(225, y, 7, 0, _moveImages[16], _moveImages[17]); - curGadget = curGadget->NextGadget; - curGadget->NextGadget = createButton(257, y, 8, 0, _moveImages[18], _moveImages[19]); - curGadget = curGadget->NextGadget; - curGadget->NextGadget = createButton(289, y, 9, 0, _moveImages[10], _moveImages[11]); - } - - Common::File *invFile = g_lab->_resource->openDataFile("P:Inv"); - - if (getPlatform() == Common::kPlatformWindows) { - for (uint16 imgIdx = 0; imgIdx < 10; imgIdx++) - _invImages[imgIdx] = new Image(invFile); - - _invGadgetList = createButton(24, y, 0, 'm', _invImages[0], _invImages[1]); - Gadget *curGadget = _invGadgetList; - curGadget->NextGadget = createButton(56, y, 1, 'g', _invImages[2], _invImages[3]); - curGadget = curGadget->NextGadget; - curGadget->NextGadget = createButton(94, y, 2, 'u', _invImages[4], _invImages[5]); - curGadget = curGadget->NextGadget; - curGadget->NextGadget = createButton(126, y, 3, 'l', _moveImages[8], _moveImages[9]); - curGadget = curGadget->NextGadget; - curGadget->NextGadget = createButton(164, y, 4, VKEY_LTARROW, _moveImages[14], _moveImages[15]); - curGadget = curGadget->NextGadget; - curGadget->NextGadget = createButton(196, y, 5, VKEY_RTARROW, _moveImages[18], _moveImages[19]); - curGadget = curGadget->NextGadget; - curGadget->NextGadget = createButton(234, y, 6, 'b', _invImages[6], _invImages[7]); - curGadget = curGadget->NextGadget; - curGadget->NextGadget = createButton(266, y, 7, 'f', _invImages[8], _invImages[9]); - curGadget = curGadget->NextGadget; - } else { - for (uint16 imgIdx = 0; imgIdx < 6; imgIdx++) - _invImages[imgIdx] = new Image(invFile); - - _invGadgetList = createButton(58, y, 0, 0, _invImages[0], _invImages[1]); - Gadget *curGadget = _invGadgetList; - curGadget->NextGadget = createButton(90, y, 1, 0, _invImages[2], _invImages[3]); - curGadget = curGadget->NextGadget; - curGadget->NextGadget = createButton(128, y, 2, 0, _invImages[4], _invImages[5]); - curGadget = curGadget->NextGadget; - curGadget->NextGadget = createButton(160, y, 3, 0, _moveImages[8], _moveImages[9]); - curGadget = curGadget->NextGadget; - curGadget->NextGadget = createButton(198, y, 4, 0, _moveImages[14], _moveImages[15]); - curGadget = curGadget->NextGadget; - curGadget->NextGadget = createButton(230, y, 5, 0, _moveImages[18], _moveImages[19]); - curGadget = curGadget->NextGadget; - } - - delete invFile; - - return true; + _lastTooLong = _graphics->_lastMessageLong; } void LabEngine::freeScreens() { @@ -379,7 +224,7 @@ bool LabEngine::doCloseUp(CloseDataPtr closePtr) { } _curFileName = " "; - drawPanel(); + _graphics->drawPanel(); return true; } @@ -394,20 +239,20 @@ const char *LabEngine::getInvName(uint16 CurInv) { if ((CurInv == LAMPNUM) && _conditions->in(LAMPON)) return "P:Mines/120"; - if ((CurInv == BELTNUM) && g_lab->_conditions->in(BELTGLOW)) + if ((CurInv == BELTNUM) && _conditions->in(BELTGLOW)) return "P:Future/BeltGlow"; if (CurInv == WESTPAPERNUM) { - g_lab->_curFileName = _inventory[CurInv].BInvName; - g_lab->_anim->_noPalChange = true; - readPict(g_lab->_curFileName, false); - g_lab->_anim->_noPalChange = false; + _curFileName = _inventory[CurInv].BInvName; + _anim->_noPalChange = true; + _graphics->readPict(_curFileName, false); + _anim->_noPalChange = false; doWestPaper(); } else if (CurInv == NOTESNUM) { - g_lab->_curFileName = _inventory[CurInv].BInvName; - g_lab->_anim->_noPalChange = true; - readPict(g_lab->_curFileName, false); - g_lab->_anim->_noPalChange = false; + _curFileName = _inventory[CurInv].BInvName; + _anim->_noPalChange = true; + _graphics->readPict(_curFileName, false); + _anim->_noPalChange = false; doNotes(); } @@ -434,7 +279,7 @@ void LabEngine::interfaceOn() { _event->mouseShow(); } - if (_longWinInFront) + if (_graphics->_longWinInFront) _event->attachGadgetList(NULL); else if (_alternate) _event->attachGadgetList(_invGadgetList); @@ -454,8 +299,8 @@ bool LabEngine::doUse(uint16 CurInv) { _cptr = NULL; doMap(_roomNum); setPalette(initcolors, 8); - drawMessage(NULL); - drawPanel(); + _graphics->drawMessage(NULL); + _graphics->drawPanel(); } else if (CurInv == JOURNALNUM) { /* LAB: Labyrinth specific */ drawStaticMessage(kTextUseJournal); interfaceOff(); @@ -463,8 +308,8 @@ bool LabEngine::doUse(uint16 CurInv) { _curFileName = " "; _cptr = NULL; doJournal(); - drawPanel(); - drawMessage(NULL); + _graphics->drawPanel(); + _graphics->drawMessage(NULL); } else if (CurInv == LAMPNUM) { /* LAB: Labyrinth specific */ interfaceOff(); @@ -478,7 +323,7 @@ bool LabEngine::doUse(uint16 CurInv) { _anim->_doBlack = false; _anim->_waitForEffect = true; - readPict("Music:Click", true); + _graphics->readPict("Music:Click", true); _anim->_waitForEffect = false; _anim->_doBlack = false; @@ -575,8 +420,8 @@ void LabEngine::mainGameLoop() { _conditions->readInitialConditions("LAB:Conditio"); - _longWinInFront = false; - drawPanel(); + _graphics->_longWinInFront = false; + _graphics->drawPanel(); perFlipGadget(actionMode); @@ -598,7 +443,7 @@ void LabEngine::mainGameLoop() { _cptr = NULL; mayShowCrumbIndicator(); - screenUpdate(); + _graphics->screenUpdate(); } /* Sets the current picture properly on the screen */ @@ -624,15 +469,15 @@ void LabEngine::mainGameLoop() { MainDisplay) /* LAB: Labyrinth specific code */ showTile(_curFileName, (bool)(_cptr->CloseUpType == SPECIALBRICKNOMOUSE)); else - readPict(_curFileName, false); + _graphics->readPict(_curFileName, false); } else - readPict(_curFileName, false); + _graphics->readPict(_curFileName, false); drawRoomMessage(curInv, _cptr); forceDraw = false; mayShowCrumbIndicator(); - screenUpdate(); + _graphics->screenUpdate(); if (!_followingCrumbs) eatMessages(); @@ -641,7 +486,7 @@ void LabEngine::mainGameLoop() { if (forceDraw) { drawRoomMessage(curInv, _cptr); forceDraw = false; - screenUpdate(); + _graphics->screenUpdate(); } } @@ -669,14 +514,14 @@ void LabEngine::mainGameLoop() { GotMessage = true; mayShowCrumbIndicator(); - screenUpdate(); + _graphics->screenUpdate(); if (!from_crumbs(GADGETUP, code, 0, _event->updateAndGetMousePos(), curInv, curMsg, forceDraw, code, actionMode)) break; } } mayShowCrumbIndicator(); - screenUpdate(); + _graphics->screenUpdate(); } else { GotMessage = true; @@ -725,7 +570,7 @@ bool LabEngine::from_crumbs(uint32 tmpClass, uint16 code, uint16 Qualifier, Comm _anim->_doBlack = false; - if ((msgClass == RAWKEY) && (!_longWinInFront)) { + if ((msgClass == RAWKEY) && (!_graphics->_longWinInFront)) { if (code == 13) { /* The return key */ msgClass = MOUSEBUTTONS; Qualifier = IEQUALIFIER_LEFTBUTTON; @@ -736,7 +581,7 @@ bool LabEngine::from_crumbs(uint32 tmpClass, uint16 code, uint16 Qualifier, Comm _numCrumbs = 0; _droppingCrumbs = true; mayShowCrumbIndicator(); - screenUpdate(); + _graphics->screenUpdate(); } else if (code == 'f' || code == 'F' || code == 'r' || code == 'R') { /* Follow bread crumbs */ if (_droppingCrumbs) { @@ -755,9 +600,9 @@ bool LabEngine::from_crumbs(uint32 tmpClass, uint16 code, uint16 Qualifier, Comm MainDisplay = true; interfaceOn(); /* Sets the correct gadget list */ - drawPanel(); + _graphics->drawPanel(); drawRoomMessage(curInv, _cptr); - screenUpdate(); + _graphics->screenUpdate(); } } else { _breadCrumbs[0]._roomNum = 0; @@ -765,13 +610,13 @@ bool LabEngine::from_crumbs(uint32 tmpClass, uint16 code, uint16 Qualifier, Comm // Need to hide indicator!!!! mayShowCrumbIndicatorOff(); - screenUpdate(); + _graphics->screenUpdate(); } } } else if ((code == 315) || (code == 'x') || (code == 'X') || (code == 'q') || (code == 'Q')) { /* Quit? */ DoNotDrawMessage = false; - drawMessage("Do you want to quit? (Y/N)"); + _graphics->drawMessage("Do you want to quit? (Y/N)"); doit = false; eatMessages(); interfaceOff(); @@ -813,16 +658,16 @@ bool LabEngine::from_crumbs(uint32 tmpClass, uint16 code, uint16 Qualifier, Comm eatMessages(); } - if (_longWinInFront) { + if (_graphics->_longWinInFront) { if ((msgClass == RAWKEY) || ((msgClass == MOUSEBUTTONS) && ((IEQUALIFIER_LEFTBUTTON & Qualifier) || (IEQUALIFIER_RBUTTON & Qualifier)))) { - _longWinInFront = false; + _graphics->_longWinInFront = false; DoNotDrawMessage = false; - drawPanel(); + _graphics->drawPanel(); drawRoomMessage(curInv, _cptr); - screenUpdate(); + _graphics->screenUpdate(); } } else if ((msgClass == GADGETUP) && !_alternate) { if (gadgetId <= 5) { @@ -833,7 +678,7 @@ bool LabEngine::from_crumbs(uint32 tmpClass, uint16 code, uint16 Qualifier, Comm hcptr = NULL; _cptr = NULL; mayShowCrumbIndicator(); - screenUpdate(); + _graphics->screenUpdate(); } else if (gadgetId == 5) { eatMessages(); @@ -850,11 +695,11 @@ bool LabEngine::from_crumbs(uint32 tmpClass, uint16 code, uint16 Qualifier, Comm } else decIncInv(&curInv, false); - drawPanel(); + _graphics->drawPanel(); drawRoomMessage(curInv, _cptr); mayShowCrumbIndicator(); - screenUpdate(); + _graphics->screenUpdate(); } else { Old = actionMode; actionMode = gadgetId; @@ -866,13 +711,13 @@ bool LabEngine::from_crumbs(uint32 tmpClass, uint16 code, uint16 Qualifier, Comm if (gadgetId <= 4) drawStaticMessage(kTextTakeWhat + gadgetId); - screenUpdate(); + _graphics->screenUpdate(); } } else if (gadgetId == 9) { doUse(MAPNUM); mayShowCrumbIndicator(); - screenUpdate(); + _graphics->screenUpdate(); } else if (gadgetId >= 6) { /* Arrow Gadgets */ _cptr = NULL; hcptr = NULL; @@ -895,7 +740,7 @@ bool LabEngine::from_crumbs(uint32 tmpClass, uint16 code, uint16 Qualifier, Comm forceDraw = true; mayShowCrumbIndicator(); - screenUpdate(); + _graphics->screenUpdate(); } else if (gadgetId == 7) { OldRoomNum = _roomNum; @@ -959,7 +804,7 @@ bool LabEngine::from_crumbs(uint32 tmpClass, uint16 code, uint16 Qualifier, Comm } mayShowCrumbIndicator(); - screenUpdate(); + _graphics->screenUpdate(); } } } else if ((msgClass == GADGETUP) && _alternate) { @@ -973,10 +818,10 @@ bool LabEngine::from_crumbs(uint32 tmpClass, uint16 code, uint16 Qualifier, Comm MainDisplay = true; interfaceOn(); /* Sets the correct gadget list */ - drawPanel(); + _graphics->drawPanel(); drawRoomMessage(curInv, _cptr); - screenUpdate(); + _graphics->screenUpdate(); } gadgetId--; @@ -996,17 +841,17 @@ bool LabEngine::from_crumbs(uint32 tmpClass, uint16 code, uint16 Qualifier, Comm _nextFileName = getInvName(curInv); - drawPanel(); + _graphics->drawPanel(); if (doit) { - drawMessage("Disk operation failed."); + _graphics->drawMessage("Disk operation failed."); setPalette(initcolors, 8); - screenUpdate(); + _graphics->screenUpdate(); g_system->delayMillis(1000); } else { - screenUpdate(); + _graphics->screenUpdate(); } } else if (gadgetId == 1) { if (!doUse(curInv)) { @@ -1019,7 +864,7 @@ bool LabEngine::from_crumbs(uint32 tmpClass, uint16 code, uint16 Qualifier, Comm drawStaticMessage(kTextUseOnWhat); MainDisplay = true; - screenUpdate(); + _graphics->screenUpdate(); } } else if (gadgetId == 2) { MainDisplay = !MainDisplay; @@ -1035,27 +880,27 @@ bool LabEngine::from_crumbs(uint32 tmpClass, uint16 code, uint16 Qualifier, Comm _inventory[curInv].BInvName) _nextFileName = getInvName(curInv); - screenUpdate(); + _graphics->screenUpdate(); } else if (gadgetId == 3) { /* Left gadget */ decIncInv(&curInv, true); LastInv = curInv; DoNotDrawMessage = false; drawRoomMessage(curInv, _cptr); - screenUpdate(); + _graphics->screenUpdate(); } else if (gadgetId == 4) { /* Right gadget */ decIncInv(&curInv, false); LastInv = curInv; DoNotDrawMessage = false; drawRoomMessage(curInv, _cptr); - screenUpdate(); + _graphics->screenUpdate(); } else if (gadgetId == 5) { /* bread crumbs */ _breadCrumbs[0]._roomNum = 0; _numCrumbs = 0; _droppingCrumbs = true; mayShowCrumbIndicator(); - screenUpdate(); + _graphics->screenUpdate(); } else if (gadgetId == 6) { /* follow crumbs */ if (_droppingCrumbs) { if (_numCrumbs > 0) { @@ -1072,16 +917,16 @@ bool LabEngine::from_crumbs(uint32 tmpClass, uint16 code, uint16 Qualifier, Comm MainDisplay = true; interfaceOn(); /* Sets the correct gadget list */ - drawPanel(); + _graphics->drawPanel(); drawRoomMessage(curInv, _cptr); - screenUpdate(); + _graphics->screenUpdate(); } else { _breadCrumbs[0]._roomNum = 0; _droppingCrumbs = false; // Need to hide indicator!!!! mayShowCrumbIndicatorOff(); - screenUpdate(); + _graphics->screenUpdate(); } } } @@ -1115,7 +960,7 @@ bool LabEngine::from_crumbs(uint32 tmpClass, uint16 code, uint16 Qualifier, Comm _curFileName = _newFileName; else if (doActionRule(curPos, TAKE - 1, 0, &_cptr)) _curFileName = _newFileName; - else if (curPos.y < (VGAScaleY(149) + SVGACord(2))) + else if (curPos.y < (_graphics->VGAScaleY(149) + _graphics->SVGACord(2))) drawStaticMessage(kTextNothing); } else if ((actionMode == 1) /* Manipulate an object */ || (actionMode == 2) /* Open up a "door" */ || @@ -1123,7 +968,7 @@ bool LabEngine::from_crumbs(uint32 tmpClass, uint16 code, uint16 Qualifier, Comm if (doActionRule(curPos, actionMode, _roomNum, &_cptr)) _curFileName = _newFileName; else if (!doActionRule(curPos, actionMode, 0, &_cptr)) { - if (curPos.y < (VGAScaleY(149) + SVGACord(2))) + if (curPos.y < (_graphics->VGAScaleY(149) + _graphics->SVGACord(2))) drawStaticMessage(kTextNothing); } } else if (actionMode == 4) { /* Look at closeups */ @@ -1131,15 +976,15 @@ bool LabEngine::from_crumbs(uint32 tmpClass, uint16 code, uint16 Qualifier, Comm setCurClose(curPos, &tempcptr); if (_cptr == tempcptr) { - if (curPos.y < (VGAScaleY(149) + SVGACord(2))) + if (curPos.y < (_graphics->VGAScaleY(149) + _graphics->SVGACord(2))) drawStaticMessage(kTextNothing); } else if (tempcptr->GraphicName) { if (*(tempcptr->GraphicName)) { _anim->_doBlack = true; _cptr = tempcptr; - } else if (curPos.y < (VGAScaleY(149) + SVGACord(2))) + } else if (curPos.y < (_graphics->VGAScaleY(149) + _graphics->SVGACord(2))) drawStaticMessage(kTextNothing); - } else if (curPos.y < (VGAScaleY(149) + SVGACord(2))) + } else if (curPos.y < (_graphics->VGAScaleY(149) + _graphics->SVGACord(2))) drawStaticMessage(kTextNothing); } else if ((actionMode == 5) && _conditions->in(curInv)) { /* Use an item on something else */ @@ -1148,13 +993,13 @@ bool LabEngine::from_crumbs(uint32 tmpClass, uint16 code, uint16 Qualifier, Comm if (!_conditions->in(curInv)) decIncInv(&curInv, false); - } else if (curPos.y < (VGAScaleY(149) + SVGACord(2))) + } else if (curPos.y < (_graphics->VGAScaleY(149) + _graphics->SVGACord(2))) drawStaticMessage(kTextNothing); } } mayShowCrumbIndicator(); - screenUpdate(); + _graphics->screenUpdate(); } else if (msgClass == DELTAMOVE) { VPtr = getViewData(_roomNum, Direction); oldcptr = VPtr->closeUps; @@ -1182,7 +1027,7 @@ bool LabEngine::from_crumbs(uint32 tmpClass, uint16 code, uint16 Qualifier, Comm } if (hcptr) - _event->setMousePos(Common::Point(scaleX((hcptr->x1 + hcptr->x2) / 2), scaleY((hcptr->y1 + hcptr->y2) / 2))); + _event->setMousePos(Common::Point(_graphics->scaleX((hcptr->x1 + hcptr->x2) / 2), _graphics->scaleY((hcptr->y1 + hcptr->y2) / 2))); } else if ((msgClass == MOUSEBUTTONS) && (IEQUALIFIER_RBUTTON & Qualifier)) { eatMessages(); _alternate = !_alternate; @@ -1198,11 +1043,11 @@ bool LabEngine::from_crumbs(uint32 tmpClass, uint16 code, uint16 Qualifier, Comm decIncInv(&curInv, false); } - drawPanel(); + _graphics->drawPanel(); drawRoomMessage(curInv, _cptr); mayShowCrumbIndicator(); - screenUpdate(); + _graphics->screenUpdate(); } return true; } @@ -1220,9 +1065,9 @@ void LabEngine::go() { return; } - if (!setUpScreens()) { + if (!_graphics->setUpScreens()) { _isHiRes = false; - mem = mem && setUpScreens(); + mem = mem && _graphics->setUpScreens(); } _event->initMouse(); @@ -1250,16 +1095,16 @@ void LabEngine::go() { debug("\n\nNot enough memory to start game.\n\n"); if (QuitLab) { /* Won the game */ - blackAllScreen(); - readPict("P:End/L2In.1", true); + _graphics->blackAllScreen(); + _graphics->readPict("P:End/L2In.1", true); for (uint16 i = 0; i < 120; i++) { _music->updateMusic(); waitTOF(); } - readPict("P:End/L2In.9", true); - readPict("P:End/Lost", true); + _graphics->readPict("P:End/L2In.9", true); + _graphics->readPict("P:End/Lost", true); warning("STUB: waitForPress"); while (!1) { // 1 means ignore SDL_ProcessInput calls diff --git a/engines/lab/eventman.cpp b/engines/lab/eventman.cpp index 751f387e05..6b73de79b5 100644 --- a/engines/lab/eventman.cpp +++ b/engines/lab/eventman.cpp @@ -156,7 +156,7 @@ void EventManager::updateMouse() { } if (doUpdateDisplay) - _vm->screenUpdate(); + _vm->_graphics->screenUpdate(); } diff --git a/engines/lab/graphics.cpp b/engines/lab/graphics.cpp index 520828a8f4..80888d21e7 100644 --- a/engines/lab/graphics.cpp +++ b/engines/lab/graphics.cpp @@ -36,19 +36,26 @@ #include "lab/parsefun.h" #include "lab/text.h" #include "lab/resource.h" +#include "lab/graphics.h" namespace Lab { BitMap bit1, bit2, *DispBitMap = &bit1, *DrawBitMap = &bit1; -extern bool stopsound; +DisplayMan::DisplayMan(LabEngine *vm) : _vm(vm) { + _longWinInFront = false; + _lastMessageLong = false; + + _screenBytesPerPage = 65536; + _curapen = 0; +} /*****************************************************************************/ /* Scales the x co-ordinates to that of the new display. In the room parser */ /* file, co-ordinates are set up on a 360x336 display. */ /*****************************************************************************/ -uint16 scaleX(uint16 x) { - if (g_lab->_isHiRes) +uint16 DisplayMan::scaleX(uint16 x) { + if (_vm->_isHiRes) return (uint16)((x * 16) / 9); else return (uint16)((x * 8) / 9); @@ -58,7 +65,7 @@ uint16 scaleX(uint16 x) { /* Scales the y co-ordinates to that of the new display. In the room parser */ /* file, co-ordinates are set up on a 368x336 display. */ /*****************************************************************************/ -uint16 scaleY(uint16 y) { +uint16 DisplayMan::scaleY(uint16 y) { if (g_lab->_isHiRes) return (y + (y / 14)); else @@ -68,7 +75,7 @@ uint16 scaleY(uint16 y) { /*****************************************************************************/ /* Scales the VGA cords to SVGA if necessary; otherwise, returns VGA cords. */ /*****************************************************************************/ -int16 VGAScaleX(int16 x) { +int16 DisplayMan::VGAScaleX(int16 x) { if (g_lab->_isHiRes) return (x * 2); else @@ -78,14 +85,14 @@ int16 VGAScaleX(int16 x) { /*****************************************************************************/ /* Scales the VGA cords to SVGA if necessary; otherwise, returns VGA cords. */ /*****************************************************************************/ -int16 VGAScaleY(int16 y) { +int16 DisplayMan::VGAScaleY(int16 y) { if (g_lab->_isHiRes) return ((y * 12) / 5); else return y; } -uint16 SVGACord(uint16 cord) { +uint16 DisplayMan::SVGACord(uint16 cord) { if (g_lab->_isHiRes) return cord; else @@ -119,10 +126,10 @@ int VGAUnScaleY(int y) { /*****************************************************************************/ /* Reads in a picture into the dest bitmap. */ /*****************************************************************************/ -bool readPict(const char *filename, bool playOnce) { - g_lab->_anim->stopDiff(); +bool DisplayMan::readPict(const char *filename, bool playOnce) { + _vm->_anim->stopDiff(); - byte **file = g_lab->_music->newOpen(filename); + byte **file = _vm->_music->newOpen(filename); if (file == NULL) { if ((filename[0] == 'p') || (filename[0] == 'P')) @@ -131,11 +138,11 @@ bool readPict(const char *filename, bool playOnce) { return false; } - DispBitMap->_bytesPerRow = g_lab->_screenWidth; - DispBitMap->_rows = g_lab->_screenHeight; + DispBitMap->_bytesPerRow = _vm->_screenWidth; + DispBitMap->_rows = _vm->_screenHeight; DispBitMap->_flags = BITMAPF_VIDEO; - g_lab->_anim->readDiff(playOnce); + _vm->_anim->readDiff(playOnce); return true; } @@ -143,7 +150,7 @@ bool readPict(const char *filename, bool playOnce) { /*****************************************************************************/ /* Reads in a picture into buffer memory. */ /*****************************************************************************/ -byte *readPictToMem(const char *filename, uint16 x, uint16 y) { +byte *DisplayMan::readPictToMem(const char *filename, uint16 x, uint16 y) { byte *mem; g_lab->_anim->stopDiff(); @@ -252,7 +259,7 @@ static void getLine(TextFont *tf, char *lineBuffer, const char **mainBuffer, uin /* Note: Every individual word MUST be int16 enough to fit on a line, and */ /* each line less than 255 characters. */ /******************************************************************************/ -uint32 flowText(void *font, /* the TextAttr pointer */ +uint32 DisplayMan::flowText(void *font, /* the TextAttr pointer */ int16 spacing, /* How much vertical spacing between the lines */ byte pencolor, /* pen number to use for text */ byte backpen, /* the background color */ @@ -269,14 +276,14 @@ uint32 flowText(void *font, /* the TextAttr pointer */ uint16 x, y; if (fillback) { - g_lab->setAPen(backpen); - g_lab->rectFill(x1, y1, x2, y2); + setAPen(backpen); + rectFill(x1, y1, x2, y2); } if (str == NULL) return 0L; - g_lab->setAPen(pencolor); + setAPen(pencolor); fontheight = textHeight(_msgFont) + spacing; numlines = (y2 - y1 + 1) / fontheight; @@ -319,7 +326,7 @@ uint32 flowText(void *font, /* the TextAttr pointer */ /******************************************************************************/ /* Calls flowText, but flows it to memory. Same restrictions as flowText. */ /******************************************************************************/ -uint32 flowTextToMem(Image *destIm, void *font, /* the TextAttr pointer */ +uint32 DisplayMan::flowTextToMem(Image *destIm, void *font, /* the TextAttr pointer */ int16 spacing, /* How much vertical spacing between the lines */ byte pencolor, /* pen number to use for text */ byte backpen, /* the background color */ @@ -329,41 +336,41 @@ uint32 flowTextToMem(Image *destIm, void *font, /* the TextAttr pointer */ bool output, /* Whether to output any text */ uint16 x1, /* Cords */ uint16 y1, uint16 x2, uint16 y2, const char *str) { /* The text itself */ - uint32 res, vgabyte = g_lab->_screenBytesPerPage; - byte *tmp = g_lab->_currentDisplayBuffer; + uint32 res, vgabyte = _screenBytesPerPage; + byte *tmp = _vm->_currentDisplayBuffer; - g_lab->_currentDisplayBuffer = destIm->_imageData; - g_lab->_screenBytesPerPage = (uint32)destIm->_width * (int32)destIm->_height; + _vm->_currentDisplayBuffer = destIm->_imageData; + _screenBytesPerPage = (uint32)destIm->_width * (int32)destIm->_height; - res = flowText(font, spacing, pencolor, backpen, fillback, centerh, centerv, output, x1, y1, x2, y2, str); + res = _vm->_graphics->flowText(font, spacing, pencolor, backpen, fillback, centerh, centerv, output, x1, y1, x2, y2, str); - g_lab->_screenBytesPerPage = vgabyte; - g_lab->_currentDisplayBuffer = tmp; + _screenBytesPerPage = vgabyte; + _vm->_currentDisplayBuffer = tmp; return res; } /*----- The control panel stuff -----*/ -void createBox(uint16 y2) { - g_lab->setAPen(7); /* Message box area */ - g_lab->rectFill(VGAScaleX(4), VGAScaleY(154), VGAScaleX(315), VGAScaleY(y2 - 2)); +void DisplayMan::createBox(uint16 y2) { + setAPen(7); /* Message box area */ + rectFill(VGAScaleX(4), VGAScaleY(154), VGAScaleX(315), VGAScaleY(y2 - 2)); - g_lab->setAPen(0); /* Box around message area */ - g_lab->drawHLine(VGAScaleX(2), VGAScaleY(152), VGAScaleX(317)); - g_lab->drawVLine(VGAScaleX(317), VGAScaleY(152), VGAScaleY(y2)); - g_lab->drawHLine(VGAScaleX(2), VGAScaleY(y2), VGAScaleX(317)); - g_lab->drawVLine(VGAScaleX(2), VGAScaleY(152), VGAScaleY(y2)); + setAPen(0); /* Box around message area */ + drawHLine(VGAScaleX(2), VGAScaleY(152), VGAScaleX(317)); + drawVLine(VGAScaleX(317), VGAScaleY(152), VGAScaleY(y2)); + drawHLine(VGAScaleX(2), VGAScaleY(y2), VGAScaleX(317)); + drawVLine(VGAScaleX(2), VGAScaleY(152), VGAScaleY(y2)); } -int32 LabEngine::longDrawMessage(const char *str) { +int32 DisplayMan::longDrawMessage(const char *str) { char newText[512]; if (str == NULL) return 0; - _event->attachGadgetList(NULL); - _event->mouseHide(); + _vm->_event->attachGadgetList(NULL); + _vm->_event->mouseHide(); strcpy(newText, str); if (!_longWinInFront) { @@ -373,26 +380,26 @@ int32 LabEngine::longDrawMessage(const char *str) { } createBox(198); - _event->mouseShow(); + _vm->_event->mouseShow(); - return flowText(_msgFont, 0, 1, 7, false, true, true, true, VGAScaleX(6), VGAScaleY(155), VGAScaleX(313), VGAScaleY(195), str); + return flowText(_vm->_msgFont, 0, 1, 7, false, true, true, true, VGAScaleX(6), VGAScaleY(155), VGAScaleX(313), VGAScaleY(195), str); } void LabEngine::drawStaticMessage(byte index) { - drawMessage(_resource->getStaticText((StaticText)index).c_str()); + _graphics->drawMessage(_resource->getStaticText((StaticText)index).c_str()); } /******************************************************************************/ /* Draws a message to the message box. */ /******************************************************************************/ -void LabEngine::drawMessage(const char *str) { +void DisplayMan::drawMessage(const char *str) { if (DoNotDrawMessage) { DoNotDrawMessage = false; return; } if (str) { - if ((textLength(_msgFont, str, strlen(str)) > VGAScaleX(306))) { + if ((textLength(_vm->_msgFont, str, strlen(str)) > VGAScaleX(306))) { longDrawMessage(str); _lastMessageLong = true; } else { @@ -401,10 +408,10 @@ void LabEngine::drawMessage(const char *str) { drawPanel(); } - _event->mouseHide(); + _vm->_event->mouseHide(); createBox(168); - text(_msgFont, VGAScaleX(7), VGAScaleY(155) + SVGACord(2), 1, str, strlen(str)); - _event->mouseShow(); + text(_vm->_msgFont, VGAScaleX(7), VGAScaleY(155) + SVGACord(2), 1, str, strlen(str)); + _vm->_event->mouseShow(); _lastMessageLong = false; } } @@ -425,13 +432,13 @@ void LabEngine::drawMessage(const char *str) { /*****************************************************************************/ /* Scrolls the display to black. */ /*****************************************************************************/ -void LabEngine::doScrollBlack() { +void DisplayMan::doScrollBlack() { byte *mem, *tempmem; Image im; uint32 size, copysize; uint32 *baseAddr; - _event->mouseHide(); + _vm->_event->mouseHide(); uint16 width = VGAScaleX(320); uint16 height = VGAScaleY(149) + SVGACord(2); @@ -440,22 +447,22 @@ void LabEngine::doScrollBlack() { im._width = width; im._height = height; im._imageData = mem; - _music->updateMusic(); + _vm->_music->updateMusic(); im.readScreenImage(0, 0); - _music->updateMusic(); + _vm->_music->updateMusic(); - baseAddr = (uint32 *)getCurrentDrawingBuffer(); + baseAddr = (uint32 *)_vm->getCurrentDrawingBuffer(); uint16 by = VGAScaleX(4); uint16 nheight = height; while (nheight) { - _music->updateMusic(); + _vm->_music->updateMusic(); - if (!_isHiRes) - waitTOF(); + if (!_vm->_isHiRes) + _vm->waitTOF(); - baseAddr = (uint32 *)getCurrentDrawingBuffer(); + baseAddr = (uint32 *)_vm->getCurrentDrawingBuffer(); if (by > nheight) by = nheight; @@ -482,7 +489,7 @@ void LabEngine::doScrollBlack() { screenUpdate(); - if (!_isHiRes) { + if (!_vm->_isHiRes) { if (nheight <= (height / 8)) by = 1; else if (nheight <= (height / 4)) @@ -493,10 +500,10 @@ void LabEngine::doScrollBlack() { } freeAllStolenMem(); - _event->mouseShow(); + _vm->_event->mouseShow(); } -static void copyPage(uint16 width, uint16 height, uint16 nheight, uint16 startline, byte *mem) { +void DisplayMan::copyPage(uint16 width, uint16 height, uint16 nheight, uint16 startline, byte *mem) { uint32 size, offSet, copysize; uint16 curPage; uint32 *baseAddr; @@ -505,12 +512,12 @@ static void copyPage(uint16 width, uint16 height, uint16 nheight, uint16 startli size = (int32)(height - nheight) * (int32)width; mem += startline * width; - curPage = ((int32)nheight * (int32)width) / g_lab->_screenBytesPerPage; - offSet = ((int32)nheight * (int32)width) - (curPage * g_lab->_screenBytesPerPage); + curPage = ((int32)nheight * (int32)width) / g_lab->_graphics->_screenBytesPerPage; + offSet = ((int32)nheight * (int32)width) - (curPage * g_lab->_graphics->_screenBytesPerPage); while (size) { - if (size > (g_lab->_screenBytesPerPage - offSet)) - copysize = g_lab->_screenBytesPerPage - offSet; + if (size > (g_lab->_graphics->_screenBytesPerPage - offSet)) + copysize = g_lab->_graphics->_screenBytesPerPage - offSet; else copysize = size; @@ -526,35 +533,35 @@ static void copyPage(uint16 width, uint16 height, uint16 nheight, uint16 startli /*****************************************************************************/ /* Scrolls the display to a new picture from a black screen. */ /*****************************************************************************/ -void LabEngine::doScrollWipe(char *filename) { +void DisplayMan::doScrollWipe(char *filename) { uint16 startline = 0, onrow = 0; - _event->mouseHide(); + _vm->_event->mouseHide(); uint16 width = VGAScaleX(320); uint16 height = VGAScaleY(149) + SVGACord(2); - while (_music->isSoundEffectActive()) { - _music->updateMusic(); - waitTOF(); + while (_vm->_music->isSoundEffectActive()) { + _vm->_music->updateMusic(); + _vm->waitTOF(); } - _anim->_isBM = true; + _vm->_anim->_isBM = true; readPict(filename, true); - setPalette(_anim->_diffPalette, 256); - _anim->_isBM = false; - byte *mem = _anim->_rawDiffBM._planes[0]; + _vm->setPalette(_vm->_anim->_diffPalette, 256); + _vm->_anim->_isBM = false; + byte *mem = _vm->_anim->_rawDiffBM._planes[0]; - _music->updateMusic(); + _vm->_music->updateMusic(); uint16 by = VGAScaleX(3); uint16 nheight = height; - while (onrow < _anim->_headerdata._height) { - _music->updateMusic(); + while (onrow < _vm->_anim->_headerdata._height) { + _vm->_music->updateMusic(); if ((by > nheight) && nheight) by = nheight; - if ((startline + by) > (_anim->_headerdata._height - height - 1)) + if ((startline + by) > (_vm->_anim->_headerdata._height - height - 1)) break; if (nheight) @@ -577,19 +584,19 @@ void LabEngine::doScrollWipe(char *filename) { by = VGAScaleX(3); } - _event->mouseShow(); + _vm->_event->mouseShow(); } /*****************************************************************************/ /* Does the scroll bounce. Assumes bitmap already in memory. */ /*****************************************************************************/ -void LabEngine::doScrollBounce() { +void DisplayMan::doScrollBounce() { const uint16 *newby, *newby1; const uint16 newbyd[5] = {5, 4, 3, 2, 1}, newby1d[8] = {3, 3, 2, 2, 2, 1, 1, 1}; const uint16 newbyw[5] = {10, 8, 6, 4, 2}, newby1w[8] = {6, 6, 4, 4, 4, 2, 2, 2}; - if (getPlatform() != Common::kPlatformWindows) { + if (_vm->getPlatform() != Common::kPlatformWindows) { newby = newbyd; newby1 = newby1d; } else { @@ -597,44 +604,43 @@ void LabEngine::doScrollBounce() { newby1 = newby1w; } - _event->mouseHide(); + _vm->_event->mouseHide(); int width = VGAScaleX(320); int height = VGAScaleY(149) + SVGACord(2); - byte *mem = _anim->_rawDiffBM._planes[0]; + byte *mem = _vm->_anim->_rawDiffBM._planes[0]; - _music->updateMusic(); - int startline = _anim->_headerdata._height - height - 1; + _vm->_music->updateMusic(); + int startline = _vm->_anim->_headerdata._height - height - 1; for (int i = 0; i < 5; i++) { - _music->updateMusic(); + _vm->_music->updateMusic(); startline -= newby[i]; copyPage(width, height, 0, startline, mem); screenUpdate(); - waitTOF(); + _vm->waitTOF(); } for (int i = 8; i > 0; i--) { - _music->updateMusic(); + _vm->_music->updateMusic(); startline += newby1[i - 1]; copyPage(width, height, 0, startline, mem); screenUpdate(); - waitTOF(); - + _vm->waitTOF(); } - _event->mouseShow(); + _vm->_event->mouseShow(); } /*****************************************************************************/ /* Does the transporter wipe. */ /*****************************************************************************/ -void LabEngine::doTransWipe(CloseDataPtr *cPtr, char *filename) { +void DisplayMan::doTransWipe(CloseDataPtr *cPtr, char *filename) { uint16 lastY, curY, linesdone = 0, lineslast; Image imSource, imDest; - if (_isHiRes) { + if (_vm->_isHiRes) { lineslast = 3; lastY = 358; } else { @@ -647,12 +653,12 @@ void LabEngine::doTransWipe(CloseDataPtr *cPtr, char *filename) { while (curY < lastY) { if (linesdone >= lineslast) { - _music->updateMusic(); - waitTOF(); + _vm->_music->updateMusic(); + _vm->waitTOF(); linesdone = 0; } - overlayRect(0, 0, curY, _screenWidth - 1, curY + 1); + _vm->overlayRect(0, 0, curY, _vm->_screenWidth - 1, curY + 1); curY += 4; linesdone++; } @@ -665,50 +671,50 @@ void LabEngine::doTransWipe(CloseDataPtr *cPtr, char *filename) { while (curY <= lastY) { if (linesdone >= lineslast) { - _music->updateMusic(); - waitTOF(); + _vm->_music->updateMusic(); + _vm->waitTOF(); linesdone = 0; } - rectFill(0, curY, _screenWidth - 1, curY + 1); + rectFill(0, curY, _vm->_screenWidth - 1, curY + 1); curY += 4; linesdone++; } } if (filename == NULL) - g_lab->_curFileName = getPictName(cPtr); + _vm->_curFileName = getPictName(cPtr); else if (filename[0] > ' ') - g_lab->_curFileName = filename; + _vm->_curFileName = filename; else - g_lab->_curFileName = getPictName(cPtr); + _vm->_curFileName = getPictName(cPtr); - byte *BitMapMem = readPictToMem(g_lab->_curFileName, _screenWidth, lastY + 5); - setPalette(_anim->_diffPalette, 256); + byte *BitMapMem = readPictToMem(g_lab->_curFileName, _vm->_screenWidth, lastY + 5); + _vm->setPalette(_vm->_anim->_diffPalette, 256); if (BitMapMem) { - imSource._width = _screenWidth; + imSource._width = _vm->_screenWidth; imSource._height = lastY; imSource._imageData = BitMapMem; - imDest._width = _screenWidth; - imDest._height = _screenHeight; - imDest._imageData = getCurrentDrawingBuffer(); + imDest._width = _vm->_screenWidth; + imDest._height = _vm->_screenHeight; + imDest._imageData = _vm->getCurrentDrawingBuffer(); for (uint16 i = 0; i < 2; i++) { curY = i * 2; while (curY < lastY) { if (linesdone >= lineslast) { - _music->updateMusic(); - waitTOF(); + _vm->_music->updateMusic(); + _vm->waitTOF(); linesdone = 0; } - imDest._imageData = getCurrentDrawingBuffer(); + imDest._imageData = _vm->getCurrentDrawingBuffer(); - imSource.bltBitMap(0, curY, &imDest, 0, curY, _screenWidth, 2); - overlayRect(0, 0, curY, _screenWidth - 1, curY + 1); + imSource.bltBitMap(0, curY, &imDest, 0, curY, _vm->_screenWidth, 2); + _vm->overlayRect(0, 0, curY, _vm->_screenWidth - 1, curY + 1); curY += 4; linesdone++; } @@ -719,17 +725,17 @@ void LabEngine::doTransWipe(CloseDataPtr *cPtr, char *filename) { while (curY <= lastY) { if (linesdone >= lineslast) { - _music->updateMusic(); - waitTOF(); + _vm->_music->updateMusic(); + _vm->waitTOF(); linesdone = 0; } - imDest._imageData = getCurrentDrawingBuffer(); + imDest._imageData = _vm->getCurrentDrawingBuffer(); if (curY == lastY) - imSource.bltBitMap(0, curY, &imDest, 0, curY, _screenWidth, 1); + imSource.bltBitMap(0, curY, &imDest, 0, curY, _vm->_screenWidth, 1); else - imSource.bltBitMap(0, curY, &imDest, 0, curY, _screenWidth, 2); + imSource.bltBitMap(0, curY, &imDest, 0, curY, _vm->_screenWidth, 2); curY += 4; linesdone++; @@ -741,7 +747,7 @@ void LabEngine::doTransWipe(CloseDataPtr *cPtr, char *filename) { /*****************************************************************************/ /* Does a certain number of pre-programmed wipes. */ /*****************************************************************************/ -void LabEngine::doWipe(uint16 wipeType, CloseDataPtr *cPtr, char *filename) { +void DisplayMan::doWipe(uint16 wipeType, CloseDataPtr *cPtr, char *filename) { if ((wipeType == TRANSWIPE) || (wipeType == TRANSPORTER)) doTransWipe(cPtr, filename); else if (wipeType == SCROLLWIPE) @@ -753,16 +759,16 @@ void LabEngine::doWipe(uint16 wipeType, CloseDataPtr *cPtr, char *filename) { else if (wipeType == READFIRSTFRAME) readPict(filename, false); else if (wipeType == READNEXTFRAME) - _anim->diffNextFrame(); + _vm->_anim->diffNextFrame(); } /*****************************************************************************/ /* Changes the front screen to black. */ /*****************************************************************************/ -void blackScreen() { +void DisplayMan::blackScreen() { byte pal[256 * 3]; memset(pal, 0, 248 * 3); - g_lab->writeColorRegs(pal, 8, 248); + _vm->writeColorRegs(pal, 8, 248); g_system->delayMillis(32); } @@ -770,21 +776,251 @@ void blackScreen() { /*****************************************************************************/ /* Changes the front screen to white. */ /*****************************************************************************/ -void whiteScreen() { +void DisplayMan::whiteScreen() { byte pal[256 * 3]; memset(pal, 255, 248 * 3); - g_lab->writeColorRegs(pal, 8, 248); + _vm->writeColorRegs(pal, 8, 248); } /*****************************************************************************/ /* Changes the entire screen to black. */ /*****************************************************************************/ -void blackAllScreen() { +void DisplayMan::blackAllScreen() { byte pal[256 * 3]; memset(pal, 0, 256 * 3); - g_lab->writeColorRegs(pal, 0, 256); + _vm->writeColorRegs(pal, 0, 256); g_system->delayMillis(32); } +/******************************************************************************/ +/* Draws the control panel display. */ +/******************************************************************************/ +void DisplayMan::drawPanel() { + _vm->_event->mouseHide(); + + setAPen(3); /* Clear Area */ + rectFill(0, VGAScaleY(149) + SVGACord(2), VGAScaleX(319), VGAScaleY(199)); + + setAPen(0); /* First Line */ + drawHLine(0, VGAScaleY(149) + SVGACord(2), VGAScaleX(319)); + setAPen(5); /* Second Line */ + drawHLine(0, VGAScaleY(149) + 1 + SVGACord(2), VGAScaleX(319)); + + /* Gadget Separators */ + setAPen(0); + drawHLine(0, VGAScaleY(170), VGAScaleX(319)); /* First black line to separate buttons */ + + if (!_vm->_alternate) { + setAPen(4); + drawHLine(0, VGAScaleY(170) + 1, VGAScaleX(319)); /* The horizontal lines under the black one */ + drawGadgetList(_vm->_moveGadgetList); + } else { + if (_vm->getPlatform() != Common::kPlatformWindows) { + drawVLine(VGAScaleX(124), VGAScaleY(170) + 1, VGAScaleY(199)); /* Vertical Black lines */ + drawVLine(VGAScaleX(194), VGAScaleY(170) + 1, VGAScaleY(199)); + } else { + drawVLine(VGAScaleX(90), VGAScaleY(170) + 1, VGAScaleY(199)); /* Vertical Black lines */ + drawVLine(VGAScaleX(160), VGAScaleY(170) + 1, VGAScaleY(199)); + drawVLine(VGAScaleX(230), VGAScaleY(170) + 1, VGAScaleY(199)); + } + + setAPen(4); + drawHLine(0, VGAScaleY(170) + 1, VGAScaleX(122)); /* The horizontal lines under the black one */ + drawHLine(VGAScaleX(126), VGAScaleY(170) + 1, VGAScaleX(192)); + drawHLine(VGAScaleX(196), VGAScaleY(170) + 1, VGAScaleX(319)); + + drawVLine(VGAScaleX(1), VGAScaleY(170) + 2, VGAScaleY(198)); /* The vertical high light lines */ + if (_vm->getPlatform() != Common::kPlatformWindows) { + drawVLine(VGAScaleX(126), VGAScaleY(170) + 2, VGAScaleY(198)); + drawVLine(VGAScaleX(196), VGAScaleY(170) + 2, VGAScaleY(198)); + } else { + drawVLine(VGAScaleX(92), VGAScaleY(170) + 2, VGAScaleY(198)); + drawVLine(VGAScaleX(162), VGAScaleY(170) + 2, VGAScaleY(198)); + drawVLine(VGAScaleX(232), VGAScaleY(170) + 2, VGAScaleY(198)); + } + + drawGadgetList(_vm->_invGadgetList); + } + + _vm->_event->mouseShow(); +} + +/******************************************************************************/ +/* Sets up the Labyrinth screens, and opens up the initial windows. */ +/******************************************************************************/ +bool DisplayMan::setUpScreens() { + if (!createScreen(_vm->_isHiRes)) + return false; + + Common::File *controlFile = g_lab->_resource->openDataFile("P:Control"); + for (uint16 i = 0; i < 20; i++) + _vm->_moveImages[i] = new Image(controlFile); + delete controlFile; + + /* Creates the gadgets for the movement control panel */ + uint16 y = VGAScaleY(173) - SVGACord(2); + + if (_vm->getPlatform() == Common::kPlatformWindows) { + _vm->_moveGadgetList = createButton(1, y, 0, 't', _vm->_moveImages[0], _vm->_moveImages[1]); + Gadget *curGadget = _vm->_moveGadgetList; + curGadget->NextGadget = createButton(33, y, 1, 'm', _vm->_moveImages[2], _vm->_moveImages[3]); + curGadget = curGadget->NextGadget; + curGadget->NextGadget = createButton(65, y, 2, 'o', _vm->_moveImages[4], _vm->_moveImages[5]); + curGadget = curGadget->NextGadget; + curGadget->NextGadget = createButton(97, y, 3, 'c', _vm->_moveImages[6], _vm->_moveImages[7]); + curGadget = curGadget->NextGadget; + curGadget->NextGadget = createButton(129, y, 4, 'l', _vm->_moveImages[8], _vm->_moveImages[9]); + curGadget = curGadget->NextGadget; + curGadget->NextGadget = createButton(161, y, 5, 'i', _vm->_moveImages[12], _vm->_moveImages[13]); + curGadget = curGadget->NextGadget; + curGadget->NextGadget = createButton(193, y, 6, VKEY_LTARROW, _vm->_moveImages[14], _vm->_moveImages[15]); + curGadget = curGadget->NextGadget; + curGadget->NextGadget = createButton(225, y, 7, VKEY_UPARROW, _vm->_moveImages[16], _vm->_moveImages[17]); + curGadget = curGadget->NextGadget; + curGadget->NextGadget = createButton(257, y, 8, VKEY_RTARROW, _vm->_moveImages[18], _vm->_moveImages[19]); + curGadget = curGadget->NextGadget; + curGadget->NextGadget = createButton(289, y, 9, 'p', _vm->_moveImages[10], _vm->_moveImages[11]); + } else { + _vm->_moveGadgetList = createButton(1, y, 0, 0, _vm->_moveImages[0], _vm->_moveImages[1]); + Gadget *curGadget = _vm->_moveGadgetList; + curGadget->NextGadget = createButton(33, y, 1, 0, _vm->_moveImages[2], _vm->_moveImages[3]); + curGadget = curGadget->NextGadget; + curGadget->NextGadget = createButton(65, y, 2, 0, _vm->_moveImages[4], _vm->_moveImages[5]); + curGadget = curGadget->NextGadget; + curGadget->NextGadget = createButton(97, y, 3, 0, _vm->_moveImages[6], _vm->_moveImages[7]); + curGadget = curGadget->NextGadget; + curGadget->NextGadget = createButton(129, y, 4, 0, _vm->_moveImages[8], _vm->_moveImages[9]); + curGadget = curGadget->NextGadget; + curGadget->NextGadget = createButton(161, y, 5, 0, _vm->_moveImages[12], _vm->_moveImages[13]); + curGadget = curGadget->NextGadget; + curGadget->NextGadget = createButton(193, y, 6, 0, _vm->_moveImages[14], _vm->_moveImages[15]); + curGadget = curGadget->NextGadget; + curGadget->NextGadget = createButton(225, y, 7, 0, _vm->_moveImages[16], _vm->_moveImages[17]); + curGadget = curGadget->NextGadget; + curGadget->NextGadget = createButton(257, y, 8, 0, _vm->_moveImages[18], _vm->_moveImages[19]); + curGadget = curGadget->NextGadget; + curGadget->NextGadget = createButton(289, y, 9, 0, _vm->_moveImages[10], _vm->_moveImages[11]); + } + + Common::File *invFile = g_lab->_resource->openDataFile("P:Inv"); + + if (_vm->getPlatform() == Common::kPlatformWindows) { + for (uint16 imgIdx = 0; imgIdx < 10; imgIdx++) + _vm->_invImages[imgIdx] = new Image(invFile); + + _vm->_invGadgetList = createButton(24, y, 0, 'm', _vm->_invImages[0], _vm->_invImages[1]); + Gadget *curGadget = _vm->_invGadgetList; + curGadget->NextGadget = createButton(56, y, 1, 'g', _vm->_invImages[2], _vm->_invImages[3]); + curGadget = curGadget->NextGadget; + curGadget->NextGadget = createButton(94, y, 2, 'u', _vm->_invImages[4], _vm->_invImages[5]); + curGadget = curGadget->NextGadget; + curGadget->NextGadget = createButton(126, y, 3, 'l', _vm->_moveImages[8], _vm->_moveImages[9]); + curGadget = curGadget->NextGadget; + curGadget->NextGadget = createButton(164, y, 4, VKEY_LTARROW, _vm->_moveImages[14], _vm->_moveImages[15]); + curGadget = curGadget->NextGadget; + curGadget->NextGadget = createButton(196, y, 5, VKEY_RTARROW, _vm->_moveImages[18], _vm->_moveImages[19]); + curGadget = curGadget->NextGadget; + curGadget->NextGadget = createButton(234, y, 6, 'b', _vm->_invImages[6], _vm->_invImages[7]); + curGadget = curGadget->NextGadget; + curGadget->NextGadget = createButton(266, y, 7, 'f', _vm->_invImages[8], _vm->_invImages[9]); + curGadget = curGadget->NextGadget; + } else { + for (uint16 imgIdx = 0; imgIdx < 6; imgIdx++) + _vm->_invImages[imgIdx] = new Image(invFile); + + _vm->_invGadgetList = createButton(58, y, 0, 0, _vm->_invImages[0], _vm->_invImages[1]); + Gadget *curGadget = _vm->_invGadgetList; + curGadget->NextGadget = createButton(90, y, 1, 0, _vm->_invImages[2], _vm->_invImages[3]); + curGadget = curGadget->NextGadget; + curGadget->NextGadget = createButton(128, y, 2, 0, _vm->_invImages[4], _vm->_invImages[5]); + curGadget = curGadget->NextGadget; + curGadget->NextGadget = createButton(160, y, 3, 0, _vm->_moveImages[8], _vm->_moveImages[9]); + curGadget = curGadget->NextGadget; + curGadget->NextGadget = createButton(198, y, 4, 0, _vm->_moveImages[14], _vm->_moveImages[15]); + curGadget = curGadget->NextGadget; + curGadget->NextGadget = createButton(230, y, 5, 0, _vm->_moveImages[18], _vm->_moveImages[19]); + curGadget = curGadget->NextGadget; + } + + delete invFile; + + return true; +} + +/*****************************************************************************/ +/* Sets the pen number to use on all the drawing operations. */ +/*****************************************************************************/ +void DisplayMan::setAPen(byte pennum) { + _curapen = pennum; +} + +/*****************************************************************************/ +/* Fills in a rectangle. */ +/*****************************************************************************/ +void DisplayMan::rectFill(uint16 x1, uint16 y1, uint16 x2, uint16 y2) { + int w = x2 - x1 + 1; + int h = y2 - y1 + 1; + + if (x1 + w > _vm->_screenWidth) + w = _vm->_screenWidth - x1; + + if (y1 + h > _vm->_screenHeight) + h = _vm->_screenHeight - y1; + + if ((w > 0) && (h > 0)) { + char *d = (char *)_vm->getCurrentDrawingBuffer() + y1 * _vm->_screenWidth + x1; + + while (h-- > 0) { + char *dd = d; + int ww = w; + + while (ww-- > 0) { + *dd++ = _curapen; + } + + d += _vm->_screenWidth; + } + } +} + +/*****************************************************************************/ +/* Draws a horizontal line. */ +/*****************************************************************************/ +void DisplayMan::drawVLine(uint16 x, uint16 y1, uint16 y2) { + rectFill(x, y1, x, y2); +} + +/*****************************************************************************/ +/* Draws a vertical line. */ +/*****************************************************************************/ +void DisplayMan::drawHLine(uint16 x1, uint16 y, uint16 x2) { + rectFill(x1, y, x2, y); +} + +void DisplayMan::screenUpdate() { + g_system->copyRectToScreen(_vm->_displayBuffer, _vm->_screenWidth, 0, 0, _vm->_screenWidth, _vm->_screenHeight); + g_system->updateScreen(); + + _vm->_event->processInput(); +} + +/*****************************************************************************/ +/* Sets up either a low-res or a high-res 256 color screen. */ +/*****************************************************************************/ +bool DisplayMan::createScreen(bool hiRes) { + if (hiRes) { + _vm->_screenWidth = 640; + _vm->_screenHeight = 480; + } else { + _vm->_screenWidth = 320; + _vm->_screenHeight = 200; + } + _screenBytesPerPage = _vm->_screenWidth * _vm->_screenHeight; + + _vm->_displayBuffer = new byte[_screenBytesPerPage]; // FIXME: Memory leak! + + return true; +} + } // End of namespace Lab diff --git a/engines/lab/graphics.h b/engines/lab/graphics.h new file mode 100644 index 0000000000..de2053a002 --- /dev/null +++ b/engines/lab/graphics.h @@ -0,0 +1,110 @@ +/* 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. + * + */ + +/* + * This code is based on Labyrinth of Time code with assistance of + * + * Copyright (c) 1993 Terra Nova Development + * Copyright (c) 2004 The Wyrmkeep Entertainment Co. + * + */ + +#ifndef LAB_GRAPHICS_H +#define LAB_GRAPHICS_H + +namespace Lab { + +class LabEngine; + +class DisplayMan { +private: + LabEngine *_vm; + + byte _curapen; + +public: + bool _longWinInFront; + bool _lastMessageLong; + uint32 _screenBytesPerPage; + + DisplayMan(LabEngine *lab); + + uint16 scaleX(uint16 x); + uint16 scaleY(uint16 y); + int16 VGAScaleX(int16 x); + int16 VGAScaleY(int16 y); + uint16 SVGACord(uint16 cord); + int VGAUnScaleX(int x); + int VGAUnScaleY(int y); + bool readPict(const char *filename, bool playOnce); + byte *readPictToMem(const char *filename, uint16 x, uint16 y); + void doScrollBlack(); + void copyPage(uint16 width, uint16 height, uint16 nheight, uint16 startline, byte *mem); + void doScrollWipe(char *filename); + void doScrollBounce(); + void doTransWipe(CloseDataPtr *cPtr, char *filename); + void doWipe(uint16 wipeType, CloseDataPtr *cPtr, char *filename); + void blackScreen(); + void whiteScreen(); + void blackAllScreen(); + void createBox(uint16 y2); + void drawPanel(); + bool setUpScreens(); + int32 longDrawMessage(const char *str); + void drawMessage(const char *str); + void setAPen(byte pennum); + void rectFill(uint16 x1, uint16 y1, uint16 x2, uint16 y2); + /* Window text stuff */ + uint32 flowText(void *font, /* the TextAttr pointer */ + int16 spacing, /* How much vertical spacing between the lines */ + byte pencolor, /* pen number to use for text */ + byte backpen, /* the background color */ + bool fillback, /* Whether to fill the background */ + bool centerh, /* Whether to center the text horizontally */ + bool centerv, /* Whether to center the text vertically */ + bool output, /* Whether to output any text */ + uint16 x1, uint16 y1, /* Cords */ + uint16 x2, uint16 y2, + const char *text); /* The text itself */ + + uint32 flowTextToMem(Image *destIm, + void *font, /* the TextAttr pointer */ + int16 spacing, /* How much vertical spacing between the lines */ + byte pencolor, /* pen number to use for text */ + byte backpen, /* the background color */ + bool fillback, /* Whether to fill the background */ + bool centerh, /* Whether to center the text horizontally */ + bool centerv, /* Whether to center the text vertically */ + bool output, /* Whether to output any text */ + uint16 x1, uint16 y1, /* Cords */ + uint16 x2, uint16 y2, + const char *str); /* The text itself */ + + void drawHLine(uint16 x, uint16 y1, uint16 y2); + void drawVLine(uint16 x1, uint16 y, uint16 x2); + void screenUpdate(); + bool createScreen(bool HiRes); +}; + +} // End of namespace Lab + +#endif // LAB_GRAPHICS_H diff --git a/engines/lab/interface.cpp b/engines/lab/interface.cpp index 7352b61017..30aa5472a1 100644 --- a/engines/lab/interface.cpp +++ b/engines/lab/interface.cpp @@ -43,7 +43,7 @@ Common::KeyState _keyPressed; Gadget *createButton(uint16 x, uint16 y, uint16 id, uint16 key, Image *im, Image *imalt) { Gadget *gptr; - x = VGAScaleX(x); + x = g_lab->_graphics->VGAScaleX(x); if ((gptr = new Gadget())) { gptr->x = x; diff --git a/engines/lab/intro.cpp b/engines/lab/intro.cpp index 43cbed669b..aab50f49c7 100644 --- a/engines/lab/intro.cpp +++ b/engines/lab/intro.cpp @@ -106,13 +106,13 @@ void Intro::doPictText(const char *filename, TextFont *msgFont, bool isScreen) { fade(false, 0); if (isScreen) { - _vm->setAPen(7); - _vm->rectFill(VGAScaleX(10), VGAScaleY(10), VGAScaleX(310), VGAScaleY(190)); + _vm->_graphics->setAPen(7); + _vm->_graphics->rectFill(_vm->_graphics->VGAScaleX(10), _vm->_graphics->VGAScaleY(10), _vm->_graphics->VGAScaleX(310), _vm->_graphics->VGAScaleY(190)); - Drawn = flowText(msgFont, (!_vm->_isHiRes) * -1, 5, 7, false, false, true, true, VGAScaleX(14), VGAScaleY(11), VGAScaleX(306), VGAScaleY(189), (char *)curPlace); + Drawn = _vm->_graphics->flowText(msgFont, (!_vm->_isHiRes) * -1, 5, 7, false, false, true, true, _vm->_graphics->VGAScaleX(14), _vm->_graphics->VGAScaleY(11), _vm->_graphics->VGAScaleX(306), _vm->_graphics->VGAScaleY(189), (char *)curPlace); fade(true, 0); } else { - Drawn = _vm->longDrawMessage((char *)curPlace); + Drawn = _vm->_graphics->longDrawMessage((char *)curPlace); } curPlace += Drawn; @@ -227,7 +227,7 @@ void Intro::nReadPict(const char *filename, bool playOnce) { _vm->_anim->_doBlack = _introDoBlack; _vm->_anim->stopDiffEnd(); - readPict(finalFileName.c_str(), playOnce); + _vm->_graphics->readPict(finalFileName.c_str(), playOnce); } /*****************************************************************************/ @@ -259,8 +259,7 @@ void Intro::introSequence() { } } - blackAllScreen(); - + _vm->_graphics->blackAllScreen(); _vm->_music->initMusic(); _vm->_anim->_noPalChange = true; @@ -301,8 +300,7 @@ void Intro::introSequence() { } fade(false, 0); - blackAllScreen(); - + _vm->_graphics->blackAllScreen(); _vm->_music->updateMusic(); nReadPict("Title.A", true); @@ -328,7 +326,7 @@ void Intro::introSequence() { _vm->_music->newOpen("p:Intro/Intro.1"); /* load the picture into the buffer */ _vm->_music->updateMusic(); - blackAllScreen(); + _vm->_graphics->blackAllScreen(); _vm->_music->updateMusic(); TextFont *msgFont = _vm->_resource->getFont("P:Map.fon"); @@ -349,7 +347,7 @@ void Intro::introSequence() { freeAllStolenMem(); - blackAllScreen(); + _vm->_graphics->blackAllScreen(); _vm->_music->updateMusic(); _introDoBlack = true; @@ -443,8 +441,8 @@ void Intro::introSequence() { nReadPict("SubX", true); if (_quitIntro) { - _vm->setAPen(0); - _vm->rectFill(0, 0, _vm->_screenWidth - 1, _vm->_screenHeight - 1); + _vm->_graphics->setAPen(0); + _vm->_graphics->rectFill(0, 0, _vm->_screenWidth - 1, _vm->_screenHeight - 1); _vm->_anim->_doBlack = true; } diff --git a/engines/lab/lab.cpp b/engines/lab/lab.cpp index 90c713135b..efa675299f 100644 --- a/engines/lab/lab.cpp +++ b/engines/lab/lab.cpp @@ -55,16 +55,13 @@ LabEngine::LabEngine(OSystem *syst, const ADGameDescription *gameDesc) : Engine(syst), _gameDescription(gameDesc), _extraGameFeatures(0) { g_lab = this; - _screenWidth = 320; + _screenWidth = 320; _screenHeight = 200; - _screenBytesPerPage = 65536; - _curapen = 0; + _currentDisplayBuffer = 0; + _displayBuffer = 0; - _currentDisplayBuffer = 0; - _displayBuffer = 0; - - _lastWaitTOFTicks = 0; + _lastWaitTOFTicks = 0; _isHiRes = false; _roomNum = -1; @@ -86,9 +83,9 @@ LabEngine::LabEngine(OSystem *syst, const ADGameDescription *gameDesc) _resource = nullptr; _music = nullptr; _anim = nullptr; + _graphics = nullptr; - _lastMessageLong = false; - _lastTooLong = false; + _lastTooLong = false; _interfaceOff = false; _alternate = false; @@ -104,15 +101,13 @@ LabEngine::LabEngine(OSystem *syst, const ADGameDescription *gameDesc) _nextFileName = nullptr; _newFileName = nullptr; - _moveGadgetList = 0; - _invGadgetList = 0; - - _curFileName = " "; + _moveGadgetList = 0; + _invGadgetList = 0; - _longWinInFront = false; - _msgFont = 0; + _curFileName = " "; + _msgFont = 0; - _inventory = 0; + _inventory = 0; //const Common::FSNode gameDataDir(ConfMan.get("path")); //SearchMan.addSubDirectoryMatching(gameDataDir, "game"); @@ -129,6 +124,7 @@ LabEngine::~LabEngine() { delete _resource; delete _music; delete _anim; + delete _graphics; } Common::Error LabEngine::run() { @@ -141,6 +137,7 @@ Common::Error LabEngine::run() { _resource = new Resource(this); _music = new Music(this); _anim = new Anim(this); + _graphics = new DisplayMan(this); if (getPlatform() == Common::kPlatformWindows) { // Check if this is the Wyrmkeep trial diff --git a/engines/lab/lab.h b/engines/lab/lab.h index d8b75cbc62..9cf28dfbc8 100644 --- a/engines/lab/lab.h +++ b/engines/lab/lab.h @@ -41,6 +41,7 @@ #include "lab/music.h" #include "lab/resource.h" #include "lab/anim.h" +#include "lab/graphics.h" struct ADGameDescription; @@ -74,8 +75,6 @@ public: int _screenWidth; int _screenHeight; - uint32 _screenBytesPerPage; - // timing.cpp void getTime(uint32 *secs, uint32 *micros); @@ -87,24 +86,19 @@ public: private: uint32 _extraGameFeatures; bool _interfaceOff; - bool _alternate; - Image *_moveImages[20]; - Image *_invImages[10]; - Gadget *_moveGadgetList; - Gadget *_invGadgetList; // timing.cpp void microDelay(uint32 secs, uint32 micros); // vga.cpp byte _curvgapal[256 * 3]; - byte _curapen; public: EventManager *_event; Resource *_resource; Music *_music; Anim *_anim; + DisplayMan *_graphics; int _roomNum; byte *_currentDisplayBuffer; @@ -117,6 +111,7 @@ public: bool _isCrumbTurning; uint32 _crumbSecs, _crumbMicros; bool _isCrumbWaiting; + bool _alternate; byte *_tempScrollData; bool _isHiRes; byte *_displayBuffer; @@ -124,46 +119,34 @@ public: const char *_nextFileName; const char *_newFileName; /* When ProcessRoom.c decides to change the filename of the current picture. */ + TextFont *_msgFont; + Gadget *_moveGadgetList; + Gadget *_invGadgetList; + Image *_moveImages[20]; + Image *_invImages[10]; private: int _lastWaitTOFTicks; - bool _lastMessageLong; bool _lastTooLong; - TextFont *_msgFont; - bool _longWinInFront; CloseDataPtr _cptr; InventoryData *_inventory; private: - bool createScreen(bool HiRes); bool from_crumbs(uint32 tmpClass, uint16 code, uint16 Qualifier, Common::Point tmpPos, uint16 &curInv, IntuiMessage * curMsg, bool &forceDraw, uint16 gadgetId, uint16 &actionMode); public: void waitTOF(); - void setAPen(byte pennum); void writeColorRegs(byte *buf, uint16 first, uint16 numreg); byte *getCurrentDrawingBuffer(); - void screenUpdate(); - void rectFill(uint16 x1, uint16 y1, uint16 x2, uint16 y2); void scrollDisplayX(int16 dx, uint16 x1, uint16 y1, uint16 x2, uint16 y2); void scrollDisplayY(int16 dy, uint16 x1, uint16 y1, uint16 x2, uint16 y2); void overlayRect(uint16 pencolor, uint16 x1, uint16 y1, uint16 x2, uint16 y2); void setPalette(void *cmap, uint16 numcolors); - void drawHLine(uint16 x, uint16 y1, uint16 y2); - void drawVLine(uint16 x1, uint16 y, uint16 x2); - void drawPanel(); void drawRoomMessage(uint16 CurInv, CloseDataPtr cptr); void interfaceOff(); void interfaceOn(); void decIncInv(uint16 *CurInv, bool dec); - int32 longDrawMessage(const char *str); - void drawMessage(const char *str); - void doScrollBlack(); - void doScrollWipe(char *filename); - void doScrollBounce(); - void doWipe(uint16 WipeType, CloseDataPtr *cPtr, char *filename); - void doTransWipe(CloseDataPtr *cPtr, char *filename); Gadget *checkNumGadgetHit(Gadget *gadlist, uint16 key); IntuiMessage *getMsg(); void drawMap(uint16 CurRoom, uint16 CurMsg, uint16 Floor, bool fadeout, bool fadein); @@ -184,7 +167,6 @@ public: private: // engine.cpp - bool setUpScreens(); void freeScreens(); void perFlipGadget(uint16 gadID); bool doCloseUp(CloseDataPtr cptr); diff --git a/engines/lab/labfun.h b/engines/lab/labfun.h index 987864b097..d81de5c4e5 100644 --- a/engines/lab/labfun.h +++ b/engines/lab/labfun.h @@ -71,41 +71,8 @@ struct SaveGameHeader { /* Reads in pictures */ -bool readPict(const char *filename, bool PlayOnce); bool readMusic(const char *filename, bool waitTillFinished); -byte *readPictToMem(const char *filename, uint16 x, uint16 y); - -/* Window text stuff */ - -uint32 flowText(void *font, /* the TextAttr pointer */ - int16 spacing, /* How much vertical spacing between the lines */ - byte pencolor, /* pen number to use for text */ - byte backpen, /* the background color */ - bool fillback, /* Whether to fill the background */ - bool centerh, /* Whether to center the text horizontally */ - bool centerv, /* Whether to center the text vertically */ - bool output, /* Whether to output any text */ - uint16 x1, /* Cords */ - uint16 y1, uint16 x2, uint16 y2, const char *text); /* The text itself */ - -uint32 flowTextToMem(Image *DestIm, void *font, /* the TextAttr pointer */ - int16 spacing, /* How much vertical spacing between the lines */ - byte pencolor, /* pen number to use for text */ - byte backpen, /* the background color */ - bool fillback, /* Whether to fill the background */ - bool centerh, /* Whether to center the text horizontally */ - bool centerv, /* Whether to center the text vertically */ - bool output, /* Whether to output any text */ - uint16 x1, /* Cords */ - uint16 y1, uint16 x2, uint16 y2, const char *text); /* The text itself */ - -void drawMessage(const char *text); void drawStaticMessage(byte index); -int32 longDrawMessage(const char *text); - -/* The Wipes */ - -void doWipe(uint16 WipeType, CloseDataPtr *cptr, char *filename); /* Double Buffer stuff */ @@ -173,11 +140,6 @@ public: /*----- From Machine.c ------*/ /*---------------------------*/ -uint16 scaleX(uint16 x); -uint16 scaleY(uint16 y); -int16 VGAScaleX(int16 x); -int16 VGAScaleY(int16 y); -uint16 SVGACord(uint16 cord); int VGAUnScaleX(int x); int VGAUnScaleY(int y); char *translateFileName(const char *filename); @@ -211,10 +173,6 @@ void mouseCombination(Common::Point pos); void showTile(const char *filename, bool showsolution); void mouseTile(Common::Point pos); -void blackScreen(); -void blackAllScreen(); -void whiteScreen(); - } // End of namespace Lab #endif /* LAB_LABFUN_H */ diff --git a/engines/lab/map.cpp b/engines/lab/map.cpp index 9ca57b0001..f5746baa42 100644 --- a/engines/lab/map.cpp +++ b/engines/lab/map.cpp @@ -164,8 +164,8 @@ static bool loadMapData() { gptr = MapGadgetList; while (gptr) { - gptr->x = VGAScaleX(MapGadX[counter]); - gptr->y = VGAScaleY(MapGadY[counter]); + gptr->x = g_lab->_graphics->VGAScaleX(MapGadX[counter]); + gptr->y = g_lab->_graphics->VGAScaleY(MapGadY[counter]); gptr = gptr->NextGadget; counter++; } @@ -479,8 +479,8 @@ void LabEngine::drawMap(uint16 CurRoom, uint16 CurMsg, uint16 Floor, bool fadeou if (fadeout) fade(false, 0); - setAPen(0); - rectFill(0, 0, _screenWidth - 1, _screenHeight - 1); + _graphics->setAPen(0); + _graphics->rectFill(0, 0, _screenWidth - 1, _screenHeight - 1); Map->drawImage(0, 0); drawGadgetList(MapGadgetList); @@ -528,7 +528,7 @@ void LabEngine::drawMap(uint16 CurRoom, uint16 CurMsg, uint16 Floor, bool fadeou HugeMaze->drawImage(mapScaleX(524), mapScaleY(97)); } else if (Floor == SURMAZEFLOOR) { sptr = (char *)_resource->getStaticText(kTextSurmazeMessage).c_str(); - flowText(_msgFont, 0, 7, 0, true, true, true, true, mapScaleX(360), 0, mapScaleX(660), mapScaleY(450), sptr); + _graphics->flowText(_msgFont, 0, 7, 0, true, true, true, true, mapScaleX(360), 0, mapScaleX(660), mapScaleY(450), sptr); } switch (Floor) { @@ -559,10 +559,10 @@ void LabEngine::drawMap(uint16 CurRoom, uint16 CurMsg, uint16 Floor, bool fadeou } if (sptr) - flowText(_msgFont, 0, 5, 3, true, true, true, true, VGAScaleX(14), VGAScaleY(75), VGAScaleX(134), VGAScaleY(97), sptr); + _graphics->flowText(_msgFont, 0, 5, 3, true, true, true, true, _graphics->VGAScaleX(14), _graphics->VGAScaleY(75), _graphics->VGAScaleX(134), _graphics->VGAScaleY(97), sptr); if ((sptr = _rooms[CurMsg]._roomMsg)) - flowText(_msgFont, 0, 5, 3, true, true, true, true, VGAScaleX(14), VGAScaleY(148), VGAScaleX(134), VGAScaleY(186), sptr); + _graphics->flowText(_msgFont, 0, 5, 3, true, true, true, true, _graphics->VGAScaleX(14), _graphics->VGAScaleY(148), _graphics->VGAScaleX(134), _graphics->VGAScaleY(186), sptr); if (fadein) fade(true, 0); @@ -715,9 +715,9 @@ void LabEngine::processMap(uint16 CurRoom) { if ((sptr = _rooms[CurMsg]._roomMsg)) { _event->mouseHide(); - setAPen(3); - rectFill(VGAScaleX(13), VGAScaleY(148), VGAScaleX(135), VGAScaleY(186)); - flowText(_msgFont, 0, 5, 3, true, true, true, true, VGAScaleX(14), VGAScaleY(148), VGAScaleX(134), VGAScaleY(186), sptr); + _graphics->setAPen(3); + _graphics->rectFill(_graphics->VGAScaleX(13), _graphics->VGAScaleY(148), _graphics->VGAScaleX(135), _graphics->VGAScaleY(186)); + _graphics->flowText(_msgFont, 0, 5, 3, true, true, true, true, _graphics->VGAScaleX(14), _graphics->VGAScaleY(148), _graphics->VGAScaleX(134), _graphics->VGAScaleY(186), sptr); if (Maps[OldMsg].PageNumber == CurFloor) drawRoom(OldMsg, (bool)(OldMsg == CurRoom)); @@ -727,8 +727,8 @@ void LabEngine::processMap(uint16 CurRoom) { y1 = (y1 + y2) / 2; if ((CurMsg != CurRoom) && (Maps[CurMsg].PageNumber == CurFloor)) { - setAPen(1); - rectFill(x1 - 1, y1, x1, y1); + _graphics->setAPen(1); + _graphics->rectFill(x1 - 1, y1, x1, y1); } _event->mouseShow(); @@ -737,7 +737,7 @@ void LabEngine::processMap(uint16 CurRoom) { } } - screenUpdate(); + _graphics->screenUpdate(); } } } @@ -751,7 +751,7 @@ void LabEngine::doMap(uint16 CurRoom) { _music->updateMusic(); loadMapData(); - blackAllScreen(); + _graphics->blackAllScreen(); if (Direction == NORTH) XMark = MapNorth; @@ -765,18 +765,18 @@ void LabEngine::doMap(uint16 CurRoom) { drawMap(CurRoom, CurRoom, Maps[CurRoom].PageNumber, false, true); _event->mouseShow(); _event->attachGadgetList(MapGadgetList); - screenUpdate(); + _graphics->screenUpdate(); processMap(CurRoom); _event->attachGadgetList(NULL); fade(false, 0); - blackAllScreen(); + _graphics->blackAllScreen(); _event->mouseHide(); - setAPen(0); - rectFill(0, 0, _screenWidth - 1, _screenHeight - 1); + _graphics->setAPen(0); + _graphics->rectFill(0, 0, _screenWidth - 1, _screenHeight - 1); freeMapData(); - blackAllScreen(); + _graphics->blackAllScreen(); _event->mouseShow(); - screenUpdate(); + _graphics->screenUpdate(); } } // End of namespace Lab diff --git a/engines/lab/processroom.cpp b/engines/lab/processroom.cpp index 954bf00f68..0b812556a8 100644 --- a/engines/lab/processroom.cpp +++ b/engines/lab/processroom.cpp @@ -110,8 +110,8 @@ static CloseData *getObject(uint16 x, uint16 y, CloseDataPtr lcptr) { } while (lcptr != NULL) { - if ((x >= scaleX(lcptr->x1)) && (y >= scaleY(lcptr->y1)) && - (x <= scaleX(lcptr->x2)) && (y <= scaleY(lcptr->y2))) + if ((x >= g_lab->_graphics->scaleX(lcptr->x1)) && (y >= g_lab->_graphics->scaleY(lcptr->y1)) && + (x <= g_lab->_graphics->scaleX(lcptr->x2)) && (y <= g_lab->_graphics->scaleY(lcptr->y2))) return lcptr; lcptr = lcptr->NextCloseUp; @@ -167,7 +167,7 @@ char *getPictName(CloseDataPtr *lcptr) { /*****************************************************************************/ void LabEngine::drawDirection(CloseDataPtr lcptr) { if (lcptr != NULL && lcptr->Message) { - drawMessage(lcptr->Message); + _graphics->drawMessage(lcptr->Message); return; } @@ -187,7 +187,7 @@ void LabEngine::drawDirection(CloseDataPtr lcptr) { else if (Direction == WEST) message += _resource->getStaticText(kTextFacingWest); - drawMessage(message.c_str()); + _graphics->drawMessage(message.c_str()); } /*****************************************************************************/ @@ -252,10 +252,10 @@ void setCurClose(Common::Point pos, CloseDataPtr *cptr, bool useAbsoluteCoords) x2 = lcptr->x2; y2 = lcptr->y2; } else { - x1 = scaleX(lcptr->x1); - y1 = scaleY(lcptr->y1); - x2 = scaleX(lcptr->x2); - y2 = scaleY(lcptr->y2); + x1 = g_lab->_graphics->scaleX(lcptr->x1); + y1 = g_lab->_graphics->scaleY(lcptr->y1); + x2 = g_lab->_graphics->scaleX(lcptr->x2); + y2 = g_lab->_graphics->scaleY(lcptr->y2); } if (pos.x >= x1 && pos.y >= y1 && pos.x <= x2 && pos.y <= y2 && lcptr->GraphicName) { @@ -283,8 +283,8 @@ bool takeItem(uint16 x, uint16 y, CloseDataPtr *cptr) { while (lcptr != NULL) { - if ((x >= scaleX(lcptr->x1)) && (y >= scaleY(lcptr->y1)) && - (x <= scaleX(lcptr->x2)) && (y <= scaleY(lcptr->y2)) && + if ((x >= g_lab->_graphics->scaleX(lcptr->x1)) && (y >= g_lab->_graphics->scaleY(lcptr->y1)) && + (x <= g_lab->_graphics->scaleX(lcptr->x2)) && (y <= g_lab->_graphics->scaleY(lcptr->y2)) && (lcptr->CloseUpType < 0)) { g_lab->_conditions->inclElement(abs(lcptr->CloseUpType)); return true; @@ -326,11 +326,11 @@ void LabEngine::doActions(Action *aptr, CloseDataPtr *lcptr) { break; case SHOWDIFF: - readPict((char *)aptr->Data, true); + _graphics->readPict((char *)aptr->Data, true); break; case SHOWDIFFCONT: - readPict((char *)aptr->Data, false); + _graphics->readPict((char *)aptr->Data, false); break; case LOADDIFF: @@ -345,7 +345,7 @@ void LabEngine::doActions(Action *aptr, CloseDataPtr *lcptr) { break; case WIPECMD: - doWipe(aptr->Param1, lcptr, (char *)aptr->Data); + _graphics->doWipe(aptr->Param1, lcptr, (char *)aptr->Data); break; case NOUPDATE: @@ -362,7 +362,7 @@ void LabEngine::doActions(Action *aptr, CloseDataPtr *lcptr) { if (strcmp(test, _curFileName) != 0) { _curFileName = test; - readPict(_curFileName, true); + _graphics->readPict(_curFileName, true); } } break; @@ -378,10 +378,10 @@ void LabEngine::doActions(Action *aptr, CloseDataPtr *lcptr) { case SHOWMESSAGE: DoNotDrawMessage = false; - if (_longWinInFront) - longDrawMessage((char *)aptr->Data); + if (_graphics->_longWinInFront) + _graphics->longDrawMessage((char *)aptr->Data); else - drawMessage((char *)aptr->Data); + _graphics->drawMessage((char *)aptr->Data); DoNotDrawMessage = true; break; @@ -389,7 +389,7 @@ void LabEngine::doActions(Action *aptr, CloseDataPtr *lcptr) { case CSHOWMESSAGE: if (*lcptr == NULL) { DoNotDrawMessage = false; - drawMessage((char *)aptr->Data); + _graphics->drawMessage((char *)aptr->Data); DoNotDrawMessage = true; } @@ -398,7 +398,7 @@ void LabEngine::doActions(Action *aptr, CloseDataPtr *lcptr) { case SHOWMESSAGES: { char **str = (char **)aptr->Data; DoNotDrawMessage = false; - drawMessage(str[getRandom(aptr->Param1)]); + _graphics->drawMessage(str[getRandom(aptr->Param1)]); DoNotDrawMessage = true; } break; @@ -407,7 +407,7 @@ void LabEngine::doActions(Action *aptr, CloseDataPtr *lcptr) { if (aptr->Param1 & 0x8000) { // This is a Wyrmkeep Windows trial version, thus stop at this // point, since we can't check for game payment status - readPict(getPictName(lcptr), true); + _graphics->readPict(getPictName(lcptr), true); aptr = NULL; GUI::MessageDialog trialMessage("This is the end of the trial version. You can play the full game using the original interpreter from Wyrmkeep"); trialMessage.runModal(); @@ -421,7 +421,7 @@ void LabEngine::doActions(Action *aptr, CloseDataPtr *lcptr) { break; case SETCLOSEUP: { - CloseDataPtr tlcptr = getObject(scaleX(aptr->Param1), scaleY(aptr->Param2), *lcptr); + CloseDataPtr tlcptr = getObject(g_lab->_graphics->scaleX(aptr->Param1), g_lab->_graphics->scaleY(aptr->Param2), *lcptr); if (tlcptr) *lcptr = tlcptr; @@ -455,7 +455,7 @@ void LabEngine::doActions(Action *aptr, CloseDataPtr *lcptr) { addCurTime(aptr->Param1, 0, &startSecs, &startMicros); - screenUpdate(); + _graphics->screenUpdate(); while (1) { _music->updateMusic(); @@ -543,7 +543,7 @@ void LabEngine::doActions(Action *aptr, CloseDataPtr *lcptr) { waitTOF(); waitTOF(); } else if (aptr->Param1 == 4) { /* white the palette */ - whiteScreen(); + _graphics->whiteScreen(); waitTOF(); waitTOF(); } else if (aptr->Param1 == 6) { /* Restore the palette */ diff --git a/engines/lab/savegame.cpp b/engines/lab/savegame.cpp index bfe089c96b..7f56c8e64e 100644 --- a/engines/lab/savegame.cpp +++ b/engines/lab/savegame.cpp @@ -138,7 +138,7 @@ bool saveGame(uint16 Direction, uint16 Quarters, int slot, Common::String desc) // Load scene pic CloseDataPtr cPtr = NULL; - readPict(getPictName(&cPtr), true); + g_lab->_graphics->readPict(getPictName(&cPtr), true); writeSaveGameHeader(file, desc); file->writeUint16LE(g_lab->_roomNum); diff --git a/engines/lab/special.cpp b/engines/lab/special.cpp index 9f36303a1d..3be558b8af 100644 --- a/engines/lab/special.cpp +++ b/engines/lab/special.cpp @@ -109,9 +109,9 @@ static byte *loadBackPict(const char *fileName, bool tomem) { g_lab->_anim->_noPalChange = true; if (tomem) - res = readPictToMem(fileName, g_lab->_screenWidth, g_lab->_screenHeight); + res = g_lab->_graphics->readPictToMem(fileName, g_lab->_screenWidth, g_lab->_screenHeight); else - readPict(fileName, true); + g_lab->_graphics->readPict(fileName, true); for (uint16 i = 0; i < 16; i++) { hipal[i] = ((g_lab->_anim->_diffPalette[i * 3] >> 2) << 8) + @@ -129,7 +129,7 @@ static byte *loadBackPict(const char *fileName, bool tomem) { /*****************************************************************************/ static void doCombination() { for (uint16 i = 0; i <= 5; i++) - Images[combination[i]]->drawImage(VGAScaleX(combx[i]), VGAScaleY(65)); + Images[combination[i]]->drawImage(g_lab->_graphics->VGAScaleX(combx[i]), g_lab->_graphics->VGAScaleY(65)); } /*****************************************************************************/ @@ -139,10 +139,10 @@ void showCombination(const char *filename) { resetBuffer(); g_lab->_anim->_doBlack = true; g_lab->_anim->_noPalChange = true; - readPict(filename, true); + g_lab->_graphics->readPict(filename, true); g_lab->_anim->_noPalChange = false; - blackScreen(); + g_lab->_graphics->blackScreen(); Common::File *numFile = g_lab->_resource->openDataFile("P:Numbers"); @@ -188,9 +188,9 @@ static void changeCombination(uint16 number) { display._imageData = g_lab->getCurrentDrawingBuffer(); - g_lab->scrollDisplayY(2, VGAScaleX(combx[number]), VGAScaleY(65), VGAScaleX(combx[number]) + (Images[combnum])->_width - 1, VGAScaleY(65) + (Images[combnum])->_height); + g_lab->scrollDisplayY(2, g_lab->_graphics->VGAScaleX(combx[number]), g_lab->_graphics->VGAScaleY(65), g_lab->_graphics->VGAScaleX(combx[number]) + (Images[combnum])->_width - 1, g_lab->_graphics->VGAScaleY(65) + (Images[combnum])->_height); - Images[combnum]->bltBitMap(0, (Images[combnum])->_height - (2 * i), &(display), VGAScaleX(combx[number]), VGAScaleY(65), (Images[combnum])->_width, 2); + Images[combnum]->bltBitMap(0, (Images[combnum])->_height - (2 * i), &(display), g_lab->_graphics->VGAScaleX(combx[number]), g_lab->_graphics->VGAScaleY(65), (Images[combnum])->_width, 2); } for (uint16 i = 0; i < 6; i++) @@ -240,20 +240,20 @@ static void doTile(bool showsolution) { int16 rows, cols; if (showsolution) { - rowm = VGAScaleY(23); - colm = VGAScaleX(27); + rowm = g_lab->_graphics->VGAScaleY(23); + colm = g_lab->_graphics->VGAScaleX(27); - rows = VGAScaleY(31); - cols = VGAScaleX(105); + rows = g_lab->_graphics->VGAScaleY(31); + cols = g_lab->_graphics->VGAScaleX(105); } else { - g_lab->setAPen(0); - g_lab->rectFill(VGAScaleX(97), VGAScaleY(22), VGAScaleX(220), VGAScaleY(126)); + g_lab->_graphics->setAPen(0); + g_lab->_graphics->rectFill(g_lab->_graphics->VGAScaleX(97), g_lab->_graphics->VGAScaleY(22), g_lab->_graphics->VGAScaleX(220), g_lab->_graphics->VGAScaleY(126)); - rowm = VGAScaleY(25); - colm = VGAScaleX(30); + rowm = g_lab->_graphics->VGAScaleY(25); + colm = g_lab->_graphics->VGAScaleX(30); - rows = VGAScaleY(25); - cols = VGAScaleX(100); + rows = g_lab->_graphics->VGAScaleY(25); + cols = g_lab->_graphics->VGAScaleX(100); } while (row < 4) { @@ -283,9 +283,9 @@ void showTile(const char *filename, bool showsolution) { resetBuffer(); g_lab->_anim->_doBlack = true; g_lab->_anim->_noPalChange = true; - readPict(filename, true); + g_lab->_graphics->readPict(filename, true); g_lab->_anim->_noPalChange = false; - blackScreen(); + g_lab->_graphics->blackScreen(); Common::File *tileFile = tileFile = g_lab->_resource->openDataFile(showsolution ? "P:TileSolution" : "P:Tile"); @@ -317,33 +317,33 @@ static void doTileScroll(uint16 col, uint16 row, uint16 scrolltype) { uint16 last = 0, x1, y1; if (scrolltype == LEFTSCROLL) { - dX = VGAScaleX(5); - sx = VGAScaleX(5); + dX = g_lab->_graphics->VGAScaleX(5); + sx = g_lab->_graphics->VGAScaleX(5); last = 6; } else if (scrolltype == RIGHTSCROLL) { - dX = VGAScaleX(-5); - dx = VGAScaleX(-5); - sx = VGAScaleX(5); + dX = g_lab->_graphics->VGAScaleX(-5); + dx = g_lab->_graphics->VGAScaleX(-5); + sx = g_lab->_graphics->VGAScaleX(5); last = 6; } else if (scrolltype == UPSCROLL) { - dY = VGAScaleY(5); - sy = VGAScaleY(5); + dY = g_lab->_graphics->VGAScaleY(5); + sy = g_lab->_graphics->VGAScaleY(5); last = 5; } else if (scrolltype == DOWNSCROLL) { - dY = VGAScaleY(-5); - dy = VGAScaleY(-5); - sy = VGAScaleY(5); + dY = g_lab->_graphics->VGAScaleY(-5); + dy = g_lab->_graphics->VGAScaleY(-5); + sy = g_lab->_graphics->VGAScaleY(5); last = 5; } - sx += SVGACord(2); + sx += g_lab->_graphics->SVGACord(2); - x1 = VGAScaleX(100) + (col * VGAScaleX(30)) + dx; - y1 = VGAScaleY(25) + (row * VGAScaleY(25)) + dy; + x1 = g_lab->_graphics->VGAScaleX(100) + (col * g_lab->_graphics->VGAScaleX(30)) + dx; + y1 = g_lab->_graphics->VGAScaleY(25) + (row * g_lab->_graphics->VGAScaleY(25)) + dy; for (uint16 i = 0; i < last; i++) { g_lab->waitTOF(); - scrollRaster(dX, dY, x1, y1, x1 + VGAScaleX(28) + sx, y1 + VGAScaleY(23) + sy); + scrollRaster(dX, dY, x1, y1, x1 + g_lab->_graphics->VGAScaleX(28) + sx, y1 + g_lab->_graphics->VGAScaleY(23) + sy); x1 += dX; y1 += dY; } @@ -413,7 +413,7 @@ static void changeTile(uint16 col, uint16 row) { if (check) { g_lab->_conditions->inclElement(BRICKOPEN); /* unlocked combination */ g_lab->_anim->_doBlack = true; - check = readPict("p:Up/BDOpen", true); + check = g_lab->_graphics->readPict("p:Up/BDOpen", true); } } } @@ -444,7 +444,7 @@ void doNotes() { TextFont *noteFont = g_lab->_resource->getFont("P:Note.fon"); char *ntext = g_lab->_resource->getText("Lab:Rooms/Notes"); - flowText(noteFont, -2 + SVGACord(1), 0, 0, false, false, true, true, VGAScaleX(25) + SVGACord(15), VGAScaleY(50), VGAScaleX(295) - SVGACord(15), VGAScaleY(148), ntext); + g_lab->_graphics->flowText(noteFont, -2 + g_lab->_graphics->SVGACord(1), 0, 0, false, false, true, true, g_lab->_graphics->VGAScaleX(25) + g_lab->_graphics->SVGACord(15), g_lab->_graphics->VGAScaleY(50), g_lab->_graphics->VGAScaleX(295) - g_lab->_graphics->SVGACord(15), g_lab->_graphics->VGAScaleY(148), ntext); g_lab->setPalette(g_lab->_anim->_diffPalette, 256); closeFont(noteFont); @@ -464,28 +464,28 @@ void doWestPaper() { paperFont = g_lab->_resource->getFont("P:News22.fon"); ntext = g_lab->_resource->getText("Lab:Rooms/Date"); - flowText(paperFont, 0, 0, 0, false, true, false, true, VGAScaleX(57), VGAScaleY(77) + SVGACord(2), VGAScaleX(262), VGAScaleY(91), ntext); + g_lab->_graphics->flowText(paperFont, 0, 0, 0, false, true, false, true, g_lab->_graphics->VGAScaleX(57), g_lab->_graphics->VGAScaleY(77) + g_lab->_graphics->SVGACord(2), g_lab->_graphics->VGAScaleX(262), g_lab->_graphics->VGAScaleY(91), ntext); closeFont(paperFont); delete[] ntext; paperFont = g_lab->_resource->getFont("P:News32.fon"); ntext = g_lab->_resource->getText("Lab:Rooms/Headline"); FileLen = strlen(ntext) - 1; - CharsPrinted = flowText(paperFont, -8, 0, 0, false, true, false, true, VGAScaleX(57), VGAScaleY(86) - SVGACord(2), VGAScaleX(262), VGAScaleY(118), ntext); + CharsPrinted = g_lab->_graphics->flowText(paperFont, -8, 0, 0, false, true, false, true, g_lab->_graphics->VGAScaleX(57), g_lab->_graphics->VGAScaleY(86) - g_lab->_graphics->SVGACord(2), g_lab->_graphics->VGAScaleX(262), g_lab->_graphics->VGAScaleY(118), ntext); if (CharsPrinted < FileLen) { - y = 130 - SVGACord(5); - flowText(paperFont, -8 - SVGACord(1), 0, 0, false, true, false, true, VGAScaleX(57), VGAScaleY(86) - SVGACord(2), VGAScaleX(262), VGAScaleY(132), ntext); + y = 130 - g_lab->_graphics->SVGACord(5); + g_lab->_graphics->flowText(paperFont, -8 - g_lab->_graphics->SVGACord(1), 0, 0, false, true, false, true, g_lab->_graphics->VGAScaleX(57), g_lab->_graphics->VGAScaleY(86) - g_lab->_graphics->SVGACord(2), g_lab->_graphics->VGAScaleX(262), g_lab->_graphics->VGAScaleY(132), ntext); } else - y = 115 - SVGACord(5); + y = 115 - g_lab->_graphics->SVGACord(5); closeFont(paperFont); delete[] ntext; paperFont = g_lab->_resource->getFont("P:Note.fon"); ntext = g_lab->_resource->getText("Lab:Rooms/Col1"); - CharsPrinted = flowText(paperFont, -4, 0, 0, false, false, false, true, VGAScaleX(45), VGAScaleY(y), VGAScaleX(158), VGAScaleY(148), ntext); + CharsPrinted = g_lab->_graphics->flowText(paperFont, -4, 0, 0, false, false, false, true, g_lab->_graphics->VGAScaleX(45), g_lab->_graphics->VGAScaleY(y), g_lab->_graphics->VGAScaleX(158), g_lab->_graphics->VGAScaleY(148), ntext); delete[] ntext; ntext = g_lab->_resource->getText("Lab:Rooms/Col2"); - CharsPrinted = flowText(paperFont, -4, 0, 0, false, false, false, true, VGAScaleX(162), VGAScaleY(y), VGAScaleX(275), VGAScaleY(148), ntext); + CharsPrinted = g_lab->_graphics->flowText(paperFont, -4, 0, 0, false, false, false, true, g_lab->_graphics->VGAScaleX(162), g_lab->_graphics->VGAScaleY(y), g_lab->_graphics->VGAScaleX(275), g_lab->_graphics->VGAScaleY(148), ntext); delete[] ntext; closeFont(paperFont); @@ -550,12 +550,12 @@ static bool loadJournalData() { uint16 counter = 0; while (TopGadget) { - TopGadget->x = VGAScaleX(JGadX[counter]); + TopGadget->x = g_lab->_graphics->VGAScaleX(JGadX[counter]); if (counter == 1) - TopGadget->y = VGAScaleY(JGadY[counter]) + SVGACord(1); + TopGadget->y = g_lab->_graphics->VGAScaleY(JGadY[counter]) + g_lab->_graphics->SVGACord(1); else - TopGadget->y = VGAScaleY(JGadY[counter]) - SVGACord(1); + TopGadget->y = g_lab->_graphics->VGAScaleY(JGadY[counter]) - g_lab->_graphics->SVGACord(1); TopGadget->GadgetID = counter; TopGadget = TopGadget->NextGadget; @@ -576,7 +576,7 @@ static void drawJournalText() { while (DrawingToPage < JPage) { g_lab->_music->updateMusic(); CurText = (char *)(journaltext + CharsDrawn); - CharsDrawn += flowText(journalFont, -2, 2, 0, false, false, false, false, VGAScaleX(52), VGAScaleY(32), VGAScaleX(152), VGAScaleY(148), CurText); + CharsDrawn += g_lab->_graphics->flowText(journalFont, -2, 2, 0, false, false, false, false, g_lab->_graphics->VGAScaleX(52), g_lab->_graphics->VGAScaleY(32), g_lab->_graphics->VGAScaleX(152), g_lab->_graphics->VGAScaleY(148), CurText); lastpage = (*CurText == 0); @@ -588,16 +588,16 @@ static void drawJournalText() { if (JPage <= 1) { CurText = journaltexttitle; - flowTextToMem(&JBackImage, journalFont, -2, 2, 0, false, true, true, true, VGAScaleX(52), VGAScaleY(32), VGAScaleX(152), VGAScaleY(148), CurText); + g_lab->_graphics->flowTextToMem(&JBackImage, journalFont, -2, 2, 0, false, true, true, true, g_lab->_graphics->VGAScaleX(52), g_lab->_graphics->VGAScaleY(32), g_lab->_graphics->VGAScaleX(152), g_lab->_graphics->VGAScaleY(148), CurText); } else { CurText = (char *)(journaltext + CharsDrawn); - CharsDrawn += flowTextToMem(&JBackImage, journalFont, -2, 2, 0, false, false, false, true, VGAScaleX(52), VGAScaleY(32), VGAScaleX(152), VGAScaleY(148), CurText); + CharsDrawn += g_lab->_graphics->flowTextToMem(&JBackImage, journalFont, -2, 2, 0, false, false, false, true, g_lab->_graphics->VGAScaleX(52), g_lab->_graphics->VGAScaleY(32), g_lab->_graphics->VGAScaleX(152), g_lab->_graphics->VGAScaleY(148), CurText); } g_lab->_music->updateMusic(); CurText = (char *)(journaltext + CharsDrawn); lastpage = (*CurText == 0); - flowTextToMem(&JBackImage, journalFont, -2, 2, 0, false, false, false, true, VGAScaleX(171), VGAScaleY(32), VGAScaleX(271), VGAScaleY(148), CurText); + g_lab->_graphics->flowTextToMem(&JBackImage, journalFont, -2, 2, 0, false, false, false, true, g_lab->_graphics->VGAScaleX(171), g_lab->_graphics->VGAScaleY(32), g_lab->_graphics->VGAScaleX(271), g_lab->_graphics->VGAScaleY(148), CurText); CurText = (char *)(journaltext + CharsDrawn); lastpage = lastpage || (*CurText == 0); @@ -660,7 +660,7 @@ void LabEngine::drawJournal(uint16 wipenum, bool needFade) { fade(true, 0); g_lab->_anim->_noPalChange = true; - JBackImage._imageData = readPictToMem("P:Journal.pic", _screenWidth, _screenHeight); + JBackImage._imageData = _graphics->readPictToMem("P:Journal.pic", _screenWidth, _screenHeight); GotBackImage = true; eatMessages(); @@ -716,7 +716,7 @@ void LabEngine::processJournal() { /*****************************************************************************/ void LabEngine::doJournal() { resetBuffer(); - blackAllScreen(); + _graphics->blackAllScreen(); lastpage = false; GotBackImage = false; @@ -745,9 +745,9 @@ void LabEngine::doJournal() { ScreenImage._imageData = getCurrentDrawingBuffer(); - setAPen(0); - rectFill(0, 0, _screenWidth - 1, _screenHeight - 1); - blackScreen(); + _graphics->setAPen(0); + _graphics->rectFill(0, 0, _screenWidth - 1, _screenHeight - 1); + _graphics->blackScreen(); freeAllStolenMem(); } @@ -783,11 +783,11 @@ bool LabEngine::saveRestoreGame() { if (slot >= 0) { isOK = loadGame(&Direction, &(_inventory[QUARTERNUM].Many), slot); if (isOK) - g_lab->_music->resetMusic(); + _music->resetMusic(); } } - g_lab->screenUpdate(); + _graphics->screenUpdate(); return isOK; } @@ -820,31 +820,31 @@ void LabEngine::drawMonText(char *text, TextFont *monitorFont, uint16 x1, uint16 text += 2; fheight = textHeight(monitorFont); - x1 = MonButton->_width + VGAScaleX(3); - MonGadHeight = MonButton->_height + VGAScaleY(3); + x1 = MonButton->_width + _graphics->VGAScaleX(3); + MonGadHeight = MonButton->_height + _graphics->VGAScaleY(3); if (MonGadHeight > fheight) yspacing = MonGadHeight - fheight; else MonGadHeight = fheight; - setAPen(0); - rectFill(0, 0, _screenWidth - 1, y2); + _graphics->setAPen(0); + _graphics->rectFill(0, 0, _screenWidth - 1, y2); for (uint16 i = 0; i < numlines; i++) MonButton->drawImage(0, i * MonGadHeight); } else if (isinteractive) { - setAPen(0); - rectFill(0, 0, _screenWidth - 1, y2); + _graphics->setAPen(0); + _graphics->rectFill(0, 0, _screenWidth - 1, y2); } else { - setAPen(0); - rectFill(x1, y1, x2, y2); + _graphics->setAPen(0); + _graphics->rectFill(x1, y1, x2, y2); } while (DrawingToPage < monitorPage) { _music->updateMusic(); CurText = (char *)(text + CharsDrawn); - CharsDrawn += flowText(monitorFont, yspacing, 0, 0, false, false, false, false, x1, y1, x2, y2, CurText); + CharsDrawn += _graphics->flowText(monitorFont, yspacing, 0, 0, false, false, false, false, x1, y1, x2, y2, CurText); lastpage = (*CurText == 0); if (lastpage) @@ -855,7 +855,7 @@ void LabEngine::drawMonText(char *text, TextFont *monitorFont, uint16 x1, uint16 CurText = (char *)(text + CharsDrawn); lastpage = (*CurText == 0); - CharsDrawn = flowText(monitorFont, yspacing, 2, 0, false, false, false, true, x1, y1, x2, y2, CurText); + CharsDrawn = _graphics->flowText(monitorFont, yspacing, 2, 0, false, false, false, true, x1, y1, x2, y2, CurText); CurText += CharsDrawn; lastpage = lastpage || (*CurText == 0); @@ -914,20 +914,20 @@ void LabEngine::processMonitor(char *ntext, TextFont *monitorFont, bool isintera return; else if ((Class == MOUSEBUTTONS) && (IEQUALIFIER_LEFTBUTTON & Qualifier)) { - if ((MouseY >= VGAScaleY(171)) && (MouseY <= VGAScaleY(200))) { - if ((MouseX >= VGAScaleX(259)) && (MouseX <= VGAScaleX(289))) { + if ((MouseY >= g_lab->_graphics->VGAScaleY(171)) && (MouseY <= g_lab->_graphics->VGAScaleY(200))) { + if ((MouseX >= g_lab->_graphics->VGAScaleX(259)) && (MouseX <= g_lab->_graphics->VGAScaleX(289))) { if (!lastpage) { monitorPage += 1; drawMonText(ntext, monitorFont, x1, y1, x2, y2, isinteractive); } - } else if ((MouseX >= VGAScaleX(0)) && (MouseX <= VGAScaleX(31))) { + } else if ((MouseX >= g_lab->_graphics->VGAScaleX(0)) && (MouseX <= g_lab->_graphics->VGAScaleX(31))) { return; - } else if ((MouseX >= VGAScaleX(290)) && (MouseX <= VGAScaleX(320))) { + } else if ((MouseX >= g_lab->_graphics->VGAScaleX(290)) && (MouseX <= g_lab->_graphics->VGAScaleX(320))) { if (monitorPage >= 1) { monitorPage -= 1; drawMonText(ntext, monitorFont, x1, y1, x2, y2, isinteractive); } - } else if ((MouseX >= VGAScaleX(31)) && (MouseX <= VGAScaleX(59))) { + } else if ((MouseX >= g_lab->_graphics->VGAScaleX(31)) && (MouseX <= g_lab->_graphics->VGAScaleX(59))) { if (isinteractive) { monitorPage = 0; @@ -962,20 +962,19 @@ void LabEngine::processMonitor(char *ntext, TextFont *monitorFont, bool isintera void LabEngine::doMonitor(char *background, char *textfile, bool isinteractive, uint16 x1, uint16 y1, uint16 x2, uint16 y2) { char *ntext; - x1 = VGAScaleX(x1); - x2 = VGAScaleX(x2); - y1 = VGAScaleY(y1); - y2 = VGAScaleY(y2); + x1 = _graphics->VGAScaleX(x1); + x2 = _graphics->VGAScaleX(x2); + y1 = _graphics->VGAScaleY(y1); + y2 = _graphics->VGAScaleY(y2); TextFileName = textfile; - blackAllScreen(); - - readPict("P:Mon/Monitor.1", true); - readPict("P:Mon/NWD1", true); - readPict("P:Mon/NWD2", true); - readPict("P:Mon/NWD3", true); - blackAllScreen(); + _graphics->blackAllScreen(); + _graphics->readPict("P:Mon/Monitor.1", true); + _graphics->readPict("P:Mon/NWD1", true); + _graphics->readPict("P:Mon/NWD2", true); + _graphics->readPict("P:Mon/NWD3", true); + _graphics->blackAllScreen(); resetBuffer(); monitorPage = 0; @@ -997,9 +996,9 @@ void LabEngine::doMonitor(char *background, char *textfile, bool isinteractive, closeFont(monitorFont); freeAllStolenMem(); - setAPen(0); - rectFill(0, 0, _screenWidth - 1, _screenHeight - 1); - blackAllScreen(); + _graphics->setAPen(0); + _graphics->rectFill(0, 0, _screenWidth - 1, _screenHeight - 1); + _graphics->blackAllScreen(); } } // End of namespace Lab diff --git a/engines/lab/text.cpp b/engines/lab/text.cpp index 63ec12bad0..1c1cacdac3 100644 --- a/engines/lab/text.cpp +++ b/engines/lab/text.cpp @@ -82,9 +82,9 @@ void text(TextFont *tf, uint16 x, uint16 y, uint16 color, const char *text, uint for (uint16 i = 0; i < numchars; i++) { RealOffset = (g_lab->_screenWidth * y) + x; - curpage = RealOffset / g_lab->_screenBytesPerPage; - SegmentOffset = RealOffset - (curpage * g_lab->_screenBytesPerPage); - LeftInSegment = g_lab->_screenBytesPerPage - SegmentOffset; + curpage = RealOffset / g_lab->_graphics->_screenBytesPerPage; + SegmentOffset = RealOffset - (curpage * g_lab->_graphics->_screenBytesPerPage); + LeftInSegment = g_lab->_graphics->_screenBytesPerPage - SegmentOffset; VGACur = VGATop + SegmentOffset; if (tf->Widths[(uint)*text]) { @@ -117,10 +117,10 @@ void text(TextFont *tf, uint16 x, uint16 y, uint16 color, const char *text, uint curpage++; VGATemp = (byte *)(VGATop - templeft); /* Set up VGATempLine for next line */ - VGATempLine -= g_lab->_screenBytesPerPage; + VGATempLine -= g_lab->_graphics->_screenBytesPerPage; /* Set up LeftInSegment for next line */ - LeftInSegment += g_lab->_screenBytesPerPage + templeft; - templeft += g_lab->_screenBytesPerPage; + LeftInSegment += g_lab->_graphics->_screenBytesPerPage + templeft; + templeft += g_lab->_graphics->_screenBytesPerPage; } if (mask & data) @@ -142,8 +142,8 @@ void text(TextFont *tf, uint16 x, uint16 y, uint16 color, const char *text, uint if (LeftInSegment <= 0) { curpage++; - VGATempLine -= g_lab->_screenBytesPerPage; - LeftInSegment += g_lab->_screenBytesPerPage; + VGATempLine -= g_lab->_graphics->_screenBytesPerPage; + LeftInSegment += g_lab->_graphics->_screenBytesPerPage; } } } diff --git a/engines/lab/vga.cpp b/engines/lab/vga.cpp index 727914025a..8ee0d3445e 100644 --- a/engines/lab/vga.cpp +++ b/engines/lab/vga.cpp @@ -36,24 +36,6 @@ namespace Lab { -/*****************************************************************************/ -/* Sets up either a low-res or a high-res 256 color screen. */ -/*****************************************************************************/ -bool LabEngine::createScreen(bool hiRes) { - if (hiRes) { - _screenWidth = 640; - _screenHeight = 480; - } else { - _screenWidth = 320; - _screenHeight = 200; - } - _screenBytesPerPage = _screenWidth * _screenHeight; - - _displayBuffer = new byte[_screenBytesPerPage]; // FIXME: Memory leak! - - return true; -} - /*****************************************************************************/ /* Sets the current page on the VGA card. */ /*****************************************************************************/ @@ -104,13 +86,6 @@ void LabEngine::setPalette(void *cmap, uint16 numcolors) { writeColorRegs((byte *)cmap, 0, numcolors); } -void LabEngine::screenUpdate() { - g_system->copyRectToScreen(_displayBuffer, _screenWidth, 0, 0, _screenWidth, _screenHeight); - g_system->updateScreen(); - - _event->processInput(); -} - /*****************************************************************************/ /* Returns the base address of the current VGA display. */ /*****************************************************************************/ @@ -150,8 +125,8 @@ void LabEngine::scrollDisplayX(int16 dx, uint16 x1, uint16 y1, uint16 x2, uint16 im.readScreenImage(x1, y1); im.drawImage(x1 + dx, y1); - setAPen(0); - rectFill(x1, y1, x1 + dx - 1, y2); + _graphics->setAPen(0); + _graphics->rectFill(x1, y1, x1 + dx - 1, y2); } /*****************************************************************************/ @@ -181,58 +156,8 @@ void LabEngine::scrollDisplayY(int16 dy, uint16 x1, uint16 y1, uint16 x2, uint16 im.readScreenImage(x1, y1); im.drawImage(x1, y1 + dy); - setAPen(0); - rectFill(x1, y1, x2, y1 + dy - 1); -} - -/*****************************************************************************/ -/* Sets the pen number to use on all the drawing operations. */ -/*****************************************************************************/ -void LabEngine::setAPen(byte pennum) { - _curapen = pennum; -} - -/*****************************************************************************/ -/* Fills in a rectangle. */ -/*****************************************************************************/ -void LabEngine::rectFill(uint16 x1, uint16 y1, uint16 x2, uint16 y2) { - int w = x2 - x1 + 1; - int h = y2 - y1 + 1; - - if (x1 + w > _screenWidth) - w = _screenWidth - x1; - - if (y1 + h > _screenHeight) - h = _screenHeight - y1; - - if ((w > 0) && (h > 0)) { - char *d = (char *)getCurrentDrawingBuffer() + y1 * _screenWidth + x1; - - while (h-- > 0) { - char *dd = d; - int ww = w; - - while (ww-- > 0) { - *dd++ = _curapen; - } - - d += _screenWidth; - } - } -} - -/*****************************************************************************/ -/* Draws a horizontal line. */ -/*****************************************************************************/ -void LabEngine::drawVLine(uint16 x, uint16 y1, uint16 y2) { - rectFill(x, y1, x, y2); -} - -/*****************************************************************************/ -/* Draws a vertical line. */ -/*****************************************************************************/ -void LabEngine::drawHLine(uint16 x1, uint16 y, uint16 x2) { - rectFill(x1, y, x2, y); + _graphics->setAPen(0); + _graphics->rectFill(x1, y1, x2, y1 + dy - 1); } /*****************************************************************************/ -- cgit v1.2.3 From f7321fa278efd93b0ed97fdaa0e902cd4105bb57 Mon Sep 17 00:00:00 2001 From: Strangerke Date: Fri, 4 Dec 2015 16:52:13 +0100 Subject: LAB: Make more functions member of LabEngine class --- engines/lab/engine.cpp | 14 +- engines/lab/graphics.cpp | 20 --- engines/lab/graphics.h | 2 - engines/lab/interface.h | 1 + engines/lab/lab.cpp | 365 ++++++++++++++++++++++++++++++++++++++++++++++- engines/lab/lab.h | 24 +++- engines/lab/labfun.h | 6 - engines/lab/savegame.cpp | 10 +- engines/lab/special.cpp | 338 ------------------------------------------- 9 files changed, 396 insertions(+), 384 deletions(-) diff --git a/engines/lab/engine.cpp b/engines/lab/engine.cpp index 293c9452cd..f3cda0e8bf 100644 --- a/engines/lab/engine.cpp +++ b/engines/lab/engine.cpp @@ -121,15 +121,15 @@ void LabEngine::drawRoomMessage(uint16 curInv, CloseDataPtr closePtr) { } void LabEngine::freeScreens() { - for (uint16 i = 0; i < 20; i++) + for (uint16 i = 0; i < 20; i++) { delete _moveImages[i]; + _moveImages[i] = nullptr; + } - if (getPlatform() == Common::kPlatformWindows) { - for (uint16 imgIdx = 0; imgIdx < 10; imgIdx++) - delete _invImages[imgIdx]; - } else { - for (uint16 imgIdx = 0; imgIdx < 6; imgIdx++) - delete _invImages[imgIdx]; + for (uint16 imgIdx = 0; imgIdx < 10; imgIdx++) { + delete _invImages[imgIdx]; + delete Images[imgIdx]; + _invImages[imgIdx] = Images[imgIdx] = nullptr; } } diff --git a/engines/lab/graphics.cpp b/engines/lab/graphics.cpp index 80888d21e7..be71769bed 100644 --- a/engines/lab/graphics.cpp +++ b/engines/lab/graphics.cpp @@ -99,26 +99,6 @@ uint16 DisplayMan::SVGACord(uint16 cord) { return 0; } -/*****************************************************************************/ -/* Converts SVGA cords to VGA if necessary, otherwise returns VGA cords. */ -/*****************************************************************************/ -int VGAUnScaleX(int x) { - if (g_lab->_isHiRes) - return (x / 2); - else - return x; -} - -/*****************************************************************************/ -/* Converts SVGA cords to VGA if necessary, otherwise returns VGA cords. */ -/*****************************************************************************/ -int VGAUnScaleY(int y) { - if (g_lab->_isHiRes) - return ((y * 5) / 12); - else - return y; -} - /*---------------------------------------------------------------------------*/ /*------ From readPict.c. Reads in pictures and animations from disk. ------*/ /*---------------------------------------------------------------------------*/ diff --git a/engines/lab/graphics.h b/engines/lab/graphics.h index de2053a002..aac7e58983 100644 --- a/engines/lab/graphics.h +++ b/engines/lab/graphics.h @@ -53,8 +53,6 @@ public: int16 VGAScaleX(int16 x); int16 VGAScaleY(int16 y); uint16 SVGACord(uint16 cord); - int VGAUnScaleX(int x); - int VGAUnScaleY(int y); bool readPict(const char *filename, bool playOnce); byte *readPictToMem(const char *filename, uint16 x, uint16 y); void doScrollBlack(); diff --git a/engines/lab/interface.h b/engines/lab/interface.h index de770f0ae1..42cfb2f0a9 100644 --- a/engines/lab/interface.h +++ b/engines/lab/interface.h @@ -29,6 +29,7 @@ */ #include "common/keyboard.h" +#include "lab/image.h" #ifndef LAB_INTEFACE_H #define LAB_INTEFACE_H diff --git a/engines/lab/lab.cpp b/engines/lab/lab.cpp index efa675299f..33c507873e 100644 --- a/engines/lab/lab.cpp +++ b/engines/lab/lab.cpp @@ -45,12 +45,28 @@ #include "lab/labfun.h" #include "lab/resource.h" #include "lab/anim.h" - +#include "lab/graphics.h" namespace Lab { LabEngine *g_lab; +const uint16 INIT_TILE[4][4] = { + { 1, 5, 9, 13 }, + { 2, 6, 10, 14 }, + { 3, 7, 11, 15 }, + { 4, 8, 12, 0 } +}; + +const uint16 SOLUTION[4][4] = { + { 7, 1, 8, 3 }, + { 2, 11, 15, 4 }, + { 9, 5, 14, 6 }, + { 10, 13, 12, 0 } +}; + +const int COMBINATION_X[6] = { 45, 83, 129, 166, 211, 248 }; + LabEngine::LabEngine(OSystem *syst, const ADGameDescription *gameDesc) : Engine(syst), _gameDescription(gameDesc), _extraGameFeatures(0) { g_lab = this; @@ -92,8 +108,10 @@ LabEngine::LabEngine(OSystem *syst, const ADGameDescription *gameDesc) for (int i = 0; i < 20; i++) _moveImages[i] = nullptr; - for (int i = 0; i < 10; i++) + for (int i = 0; i < 10; i++) { _invImages[i] = nullptr; + Images[i] = nullptr; + } _moveGadgetList = nullptr; _invGadgetList = nullptr; @@ -109,6 +127,17 @@ LabEngine::LabEngine(OSystem *syst, const ADGameDescription *gameDesc) _inventory = 0; + for (int i = 0; i < 16; i++) + Tiles[i] = nullptr; + + for (int i= 0; i < 4; i++) { + for (int j = 0; j < 4; j++) + CurTile[i][j] = INIT_TILE[i][j]; + } + + for (int i = 0; i < 6; i++) + combination[i] = 0; + //const Common::FSNode gameDataDir(ConfMan.get("path")); //SearchMan.addSubDirectoryMatching(gameDataDir, "game"); //SearchMan.addSubDirectoryMatching(gameDataDir, "game/pict"); @@ -125,6 +154,9 @@ LabEngine::~LabEngine() { delete _music; delete _anim; delete _graphics; + + for (int i = 0; i < 16; i++) + delete Tiles[i]; } Common::Error LabEngine::run() { @@ -182,8 +214,333 @@ Common::String LabEngine::generateSaveFileName(uint slot) { return Common::String::format("%s.%03u", _targetName.c_str(), slot); } -/*void LabEngine::showMainMenu() { +/*****************************************************************************/ +/* Converts SVGA cords to VGA if necessary, otherwise returns VGA cords. */ +/*****************************************************************************/ +int LabEngine::VGAUnScaleX(int x) { + if (_isHiRes) + return (x / 2); + else + return x; +} + +/*****************************************************************************/ +/* Converts SVGA cords to VGA if necessary, otherwise returns VGA cords. */ +/*****************************************************************************/ +int LabEngine::VGAUnScaleY(int y) { + if (_isHiRes) + return ((y * 5) / 12); + else + return y; +} + +/*****************************************************************************/ +/* Processes mouse clicks and changes the combination. */ +/*****************************************************************************/ +void LabEngine::mouseTile(Common::Point pos) { + int x = VGAUnScaleX(pos.x); + int y = VGAUnScaleY(pos.y); + + if ((x < 101) || (y < 26)) + return; + + x = (x - 101) / 30; + y = (y - 26) / 25; + + if ((x < 4) && (y < 4)) + changeTile(x, y); +} + +/*****************************************************************************/ +/* Changes the combination number of one of the slots */ +/*****************************************************************************/ +void LabEngine::changeTile(uint16 col, uint16 row) { + int16 scrolltype = -1; + + if (row > 0) { + if (CurTile[col] [row - 1] == 0) { + CurTile[col] [row - 1] = CurTile[col] [row]; + CurTile[col] [row] = 0; + scrolltype = DOWNSCROLL; + } + } + + if (col > 0) { + if (CurTile[col - 1] [row] == 0) { + CurTile[col - 1] [row] = CurTile[col] [row]; + CurTile[col] [row] = 0; + scrolltype = RIGHTSCROLL; + } + } + + if (row < 3) { + if (CurTile[col] [row + 1] == 0) { + CurTile[col] [row + 1] = CurTile[col] [row]; + CurTile[col] [row] = 0; + scrolltype = UPSCROLL; + } + } + + if (col < 3) { + if (CurTile[col + 1] [row] == 0) { + CurTile[col + 1] [row] = CurTile[col] [row]; + CurTile[col] [row] = 0; + scrolltype = LEFTSCROLL; + } + } + + if (scrolltype != -1) { + doTileScroll(col, row, scrolltype); + + if (getFeatures() & GF_WINDOWS_TRIAL) { + GUI::MessageDialog trialMessage("This puzzle is not available in the trial version of the game"); + trialMessage.runModal(); + return; + } + + bool check = true; + row = 0; + col = 0; + + while (row < 4) { + while (col < 4) { + check = check && (CurTile[row] [col] == SOLUTION[row] [col]); + col++; + } + + row++; + col = 0; + } + + if (check) { + _conditions->inclElement(BRICKOPEN); /* unlocked combination */ + _anim->_doBlack = true; + check = _graphics->readPict("p:Up/BDOpen", true); + } + } +} + +/*****************************************************************************/ +/* Processes mouse clicks and changes the combination. */ +/*****************************************************************************/ +void LabEngine::mouseCombination(Common::Point pos) { + uint16 number; + + int x = VGAUnScaleX(pos.x); + int y = VGAUnScaleY(pos.y); + + if ((y >= 63) && (y <= 99)) { + if ((x >= 44) && (x < 83)) + number = 0; + else if (x < 127) + number = 1; + else if (x < 165) + number = 2; + else if (x < 210) + number = 3; + else if (x < 245) + number = 4; + else if (x < 286) + number = 5; + else + return; + + changeCombination(number); + } +} + +/*****************************************************************************/ +/* Draws the images of the combination lock to the display bitmap. */ +/*****************************************************************************/ +void LabEngine::doTile(bool showsolution) { + uint16 row = 0, col = 0, rowm, colm, num; + int16 rows, cols; + + if (showsolution) { + rowm = _graphics->VGAScaleY(23); + colm = _graphics->VGAScaleX(27); -}*/ + rows = _graphics->VGAScaleY(31); + cols = _graphics->VGAScaleX(105); + } else { + _graphics->setAPen(0); + _graphics->rectFill(_graphics->VGAScaleX(97), _graphics->VGAScaleY(22), _graphics->VGAScaleX(220), _graphics->VGAScaleY(126)); + + rowm = _graphics->VGAScaleY(25); + colm = _graphics->VGAScaleX(30); + + rows = _graphics->VGAScaleY(25); + cols = _graphics->VGAScaleX(100); + } + + while (row < 4) { + while (col < 4) { + if (showsolution) + num = SOLUTION[col] [row]; + else + num = CurTile[col] [row]; + + if (showsolution || num) + Tiles[num]->drawImage(cols + (col * colm), rows + (row * rowm)); + + col++; + } + + row++; + col = 0; + } +} + +/*****************************************************************************/ +/* Reads in a backdrop picture. */ +/*****************************************************************************/ +void LabEngine::showTile(const char *filename, bool showsolution) { + uint16 start = showsolution ? 0 : 1; + + resetBuffer(); + g_lab->_anim->_doBlack = true; + g_lab->_anim->_noPalChange = true; + g_lab->_graphics->readPict(filename, true); + g_lab->_anim->_noPalChange = false; + g_lab->_graphics->blackScreen(); + + Common::File *tileFile = tileFile = g_lab->_resource->openDataFile(showsolution ? "P:TileSolution" : "P:Tile"); + + for (uint16 curBit = start; curBit < 16; curBit++) + Tiles[curBit] = new Image(tileFile); + + delete tileFile; + + allocFile((void **)&g_lab->_tempScrollData, Tiles[1]->_width * Tiles[1]->_height * 2L, "tempdata"); + + g_lab->doTile(showsolution); + g_lab->setPalette(g_lab->_anim->_diffPalette, 256); +} + +/*****************************************************************************/ +/* Does the scrolling for the tiles on the tile puzzle. */ +/*****************************************************************************/ +void LabEngine::doTileScroll(uint16 col, uint16 row, uint16 scrolltype) { + int16 dX = 0, dY = 0, dx = 0, dy = 0, sx = 0, sy = 0; + uint16 last = 0, x1, y1; + + if (scrolltype == LEFTSCROLL) { + dX = g_lab->_graphics->VGAScaleX(5); + sx = g_lab->_graphics->VGAScaleX(5); + last = 6; + } else if (scrolltype == RIGHTSCROLL) { + dX = g_lab->_graphics->VGAScaleX(-5); + dx = g_lab->_graphics->VGAScaleX(-5); + sx = g_lab->_graphics->VGAScaleX(5); + last = 6; + } else if (scrolltype == UPSCROLL) { + dY = g_lab->_graphics->VGAScaleY(5); + sy = g_lab->_graphics->VGAScaleY(5); + last = 5; + } else if (scrolltype == DOWNSCROLL) { + dY = g_lab->_graphics->VGAScaleY(-5); + dy = g_lab->_graphics->VGAScaleY(-5); + sy = g_lab->_graphics->VGAScaleY(5); + last = 5; + } + + sx += g_lab->_graphics->SVGACord(2); + + x1 = g_lab->_graphics->VGAScaleX(100) + (col * g_lab->_graphics->VGAScaleX(30)) + dx; + y1 = g_lab->_graphics->VGAScaleY(25) + (row * g_lab->_graphics->VGAScaleY(25)) + dy; + + for (uint16 i = 0; i < last; i++) { + g_lab->waitTOF(); + scrollRaster(dX, dY, x1, y1, x1 + g_lab->_graphics->VGAScaleX(28) + sx, y1 + g_lab->_graphics->VGAScaleY(23) + sy); + x1 += dX; + y1 += dY; + } +} + +/*****************************************************************************/ +/* Changes the combination number of one of the slots */ +/*****************************************************************************/ +void LabEngine::changeCombination(uint16 number) { + static const int solution[6] = { 0, 4, 0, 8, 7, 2 }; + + Image display; + uint16 combnum; + bool unlocked = true; + + if (combination[number] < 9) + (combination[number])++; + else + combination[number] = 0; + + combnum = combination[number]; + + display._imageData = g_lab->getCurrentDrawingBuffer(); + display._width = g_lab->_screenWidth; + display._height = g_lab->_screenHeight; + + for (uint16 i = 1; i <= (Images[combnum]->_height / 2); i++) { + if (g_lab->_isHiRes) { + if (i & 1) + g_lab->waitTOF(); + } else + g_lab->waitTOF(); + + display._imageData = g_lab->getCurrentDrawingBuffer(); + + g_lab->scrollDisplayY(2, g_lab->_graphics->VGAScaleX(COMBINATION_X[number]), g_lab->_graphics->VGAScaleY(65), g_lab->_graphics->VGAScaleX(COMBINATION_X[number]) + (Images[combnum])->_width - 1, g_lab->_graphics->VGAScaleY(65) + (Images[combnum])->_height); + + Images[combnum]->bltBitMap(0, (Images[combnum])->_height - (2 * i), &(display), g_lab->_graphics->VGAScaleX(COMBINATION_X[number]), g_lab->_graphics->VGAScaleY(65), (Images[combnum])->_width, 2); + } + + for (uint16 i = 0; i < 6; i++) + unlocked = (combination[i] == solution[i]) && unlocked; + + if (unlocked) + _conditions->inclElement(COMBINATIONUNLOCKED); + else + _conditions->exclElement(COMBINATIONUNLOCKED); +} + +void LabEngine::scrollRaster(int16 dx, int16 dy, uint16 x1, uint16 y1, uint16 x2, uint16 y2) { + if (dx) + scrollDisplayX(dx, x1, y1, x2, y2); + + if (dy) + scrollDisplayY(dy, x1, y1, x2, y2); +} + +/*****************************************************************************/ +/* Draws the images of the combination lock to the display bitmap. */ +/*****************************************************************************/ +void LabEngine::doCombination() { + for (uint16 i = 0; i <= 5; i++) + Images[combination[i]]->drawImage(_graphics->VGAScaleX(COMBINATION_X[i]), _graphics->VGAScaleY(65)); +} + +/*****************************************************************************/ +/* Reads in a backdrop picture. */ +/*****************************************************************************/ +void LabEngine::showCombination(const char *filename) { + resetBuffer(); + g_lab->_anim->_doBlack = true; + g_lab->_anim->_noPalChange = true; + g_lab->_graphics->readPict(filename, true); + g_lab->_anim->_noPalChange = false; + + g_lab->_graphics->blackScreen(); + + Common::File *numFile = g_lab->_resource->openDataFile("P:Numbers"); + + for (uint16 CurBit = 0; CurBit < 10; CurBit++) + Images[CurBit] = new Image(numFile); + + delete numFile; + + allocFile((void **)&g_lab->_tempScrollData, Images[0]->_width * Images[0]->_height * 2L, "tempdata"); + + doCombination(); + + g_lab->setPalette(g_lab->_anim->_diffPalette, 256); +} } // End of namespace Lab diff --git a/engines/lab/lab.h b/engines/lab/lab.h index 9cf28dfbc8..b109ac61c1 100644 --- a/engines/lab/lab.h +++ b/engines/lab/lab.h @@ -52,7 +52,13 @@ enum GameFeatures { GF_WINDOWS_TRIAL = 1 << 1 }; -#define ONESECOND 1000 +#define ONESECOND 1000 +#define BRICKOPEN 115 +#define COMBINATIONUNLOCKED 130 +#define LEFTSCROLL 1 +#define RIGHTSCROLL 2 +#define UPSCROLL 3 +#define DOWNSCROLL 4 class LabEngine : public Engine { public: @@ -124,12 +130,16 @@ public: Gadget *_invGadgetList; Image *_moveImages[20]; Image *_invImages[10]; + Image *Images[10]; + uint16 CurTile[4][4]; + byte combination[6]; private: int _lastWaitTOFTicks; bool _lastTooLong; CloseDataPtr _cptr; InventoryData *_inventory; + Image *Tiles[16]; private: bool from_crumbs(uint32 tmpClass, uint16 code, uint16 Qualifier, Common::Point tmpPos, uint16 &curInv, IntuiMessage * curMsg, bool &forceDraw, uint16 gadgetId, uint16 &actionMode); @@ -175,6 +185,18 @@ private: void mayShowCrumbIndicator(); void mayShowCrumbIndicatorOff(); const char *getInvName(uint16 curInv); + int VGAUnScaleX(int x); + int VGAUnScaleY(int y); + void mouseTile(Common::Point pos); + void changeTile(uint16 col, uint16 row); + void mouseCombination(Common::Point pos); + void doTile(bool showsolution); + void showTile(const char *filename, bool showsolution); + void doTileScroll(uint16 col, uint16 row, uint16 scrolltype); + void changeCombination(uint16 number); + void scrollRaster(int16 dx, int16 dy, uint16 x1, uint16 y1, uint16 x2, uint16 y2); + void doCombination(); + void showCombination(const char *filename); bool saveRestoreGame(); diff --git a/engines/lab/labfun.h b/engines/lab/labfun.h index d81de5c4e5..558abe1a80 100644 --- a/engines/lab/labfun.h +++ b/engines/lab/labfun.h @@ -54,7 +54,6 @@ class LabEngine; #define EAST 2 #define WEST 3 -class Image; struct TextFont; struct Gadget; @@ -140,8 +139,6 @@ public: /*----- From Machine.c ------*/ /*---------------------------*/ -int VGAUnScaleX(int x); -int VGAUnScaleY(int y); char *translateFileName(const char *filename); /*---------------------------*/ @@ -169,9 +166,6 @@ bool readSaveGameHeader(Common::InSaveFile *in, SaveGameHeader &header); /*--------------------------*/ void showCombination(const char *filename); -void mouseCombination(Common::Point pos); -void showTile(const char *filename, bool showsolution); -void mouseTile(Common::Point pos); } // End of namespace Lab diff --git a/engines/lab/savegame.cpp b/engines/lab/savegame.cpp index 7f56c8e64e..d97a03688f 100644 --- a/engines/lab/savegame.cpp +++ b/engines/lab/savegame.cpp @@ -51,8 +51,6 @@ namespace Lab { /* Lab: Labyrinth specific */ -extern byte combination[6]; -extern uint16 CurTile[4] [4]; extern char *getPictName(CloseDataPtr *lcptr); void writeSaveGameHeader(Common::OutSaveFile *out, const Common::String &saveName) { @@ -155,12 +153,12 @@ bool saveGame(uint16 Direction, uint16 Quarters, int slot, Common::String desc) // Combination lock and tile stuff for (i = 0; i < 6; i++) - file->writeByte(combination[i]); + file->writeByte(g_lab->combination[i]); // Tiles for (i = 0; i < 4; i++) for (j = 0; j < 4; j++) - file->writeUint16LE(CurTile[i][j]); + file->writeUint16LE(g_lab->CurTile[i][j]); // Breadcrumbs for (i = 0; i < sizeof(g_lab->_breadCrumbs); i++) { @@ -205,12 +203,12 @@ bool loadGame(uint16 *Direction, uint16 *Quarters, int slot) { // Combination lock and tile stuff for (i = 0; i < 6; i++) - combination[i] = file->readByte(); + g_lab->combination[i] = file->readByte(); // Tiles for (i = 0; i < 4; i++) for (j = 0; j < 4; j++) - CurTile[i][j] = file->readUint16LE(); + g_lab->CurTile[i][j] = file->readUint16LE(); // Breadcrumbs for (i = 0; i < 128; i++) { diff --git a/engines/lab/special.cpp b/engines/lab/special.cpp index 3be558b8af..3f26fbcbae 100644 --- a/engines/lab/special.cpp +++ b/engines/lab/special.cpp @@ -48,11 +48,6 @@ namespace Lab { static uint16 MonGadHeight = 1; static uint16 hipal[20]; -// Combination lock rules -static Image *Images[10]; -byte combination[6] = { 0, 0, 0, 0, 0, 0 }, solution[] = { 0, 4, 0, 8, 7, 2 }; -static uint16 combx[] = { 45, 83, 129, 166, 211, 248 }; - static TextFont *journalFont; static char *journaltext, *journaltexttitle; static uint16 JPage = 0; @@ -67,33 +62,13 @@ static const char *TextFileName; Image *MonButton, *AltMonButton, *MonQuit, *AltMonQuit, *MonBack, *AltMonBack, *MonDown, *AltMonDown, *MonUp, *AltMonUp; -// Tile puzzle rules -Image *Tiles[16]; -uint16 CurTile[4][4] = { - { 1, 5, 9, 13 }, - { 2, 6, 10, 14 }, - { 3, 7, 11, 15 }, - { 4, 8, 12, 0 } -}, TileSolution[4][4] = { - { 7, 1, 8, 3 }, - { 2, 11, 15, 4 }, - { 9, 5, 14, 6 }, - { 10, 13, 12, 0 } -}; - extern uint16 *FadePalette; extern BitMap *DispBitMap, *DrawBitMap; extern uint16 Direction; -#define COMBINATIONUNLOCKED 130 -#define BRICKOPEN 115 #define INCL(BITSET,BIT) ((BITSET) |= (BIT)) #define SETBIT(BITSET,BITNUM) INCL(BITSET, (1 << (BITNUM))) #define INBIT(BITSET,BITNUM) ( ((1 << (BITNUM)) & (BITSET)) > 0 ) -#define LEFTSCROLL 1 -#define RIGHTSCROLL 2 -#define UPSCROLL 3 -#define DOWNSCROLL 4 #define BRIDGE0 148 #define BRIDGE1 104 #define DIRTY 175 @@ -124,319 +99,6 @@ static byte *loadBackPict(const char *fileName, bool tomem) { return res; } -/*****************************************************************************/ -/* Draws the images of the combination lock to the display bitmap. */ -/*****************************************************************************/ -static void doCombination() { - for (uint16 i = 0; i <= 5; i++) - Images[combination[i]]->drawImage(g_lab->_graphics->VGAScaleX(combx[i]), g_lab->_graphics->VGAScaleY(65)); -} - -/*****************************************************************************/ -/* Reads in a backdrop picture. */ -/*****************************************************************************/ -void showCombination(const char *filename) { - resetBuffer(); - g_lab->_anim->_doBlack = true; - g_lab->_anim->_noPalChange = true; - g_lab->_graphics->readPict(filename, true); - g_lab->_anim->_noPalChange = false; - - g_lab->_graphics->blackScreen(); - - Common::File *numFile = g_lab->_resource->openDataFile("P:Numbers"); - - for (uint16 CurBit = 0; CurBit < 10; CurBit++) - Images[CurBit] = new Image(numFile); - - delete numFile; - - allocFile((void **)&g_lab->_tempScrollData, Images[0]->_width * Images[0]->_height * 2L, "tempdata"); - - doCombination(); - - g_lab->setPalette(g_lab->_anim->_diffPalette, 256); -} - - - -/*****************************************************************************/ -/* Changes the combination number of one of the slots */ -/*****************************************************************************/ -static void changeCombination(uint16 number) { - Image display; - uint16 combnum; - bool unlocked = true; - - if (combination[number] < 9) - (combination[number])++; - else - combination[number] = 0; - - combnum = combination[number]; - - display._imageData = g_lab->getCurrentDrawingBuffer(); - display._width = g_lab->_screenWidth; - display._height = g_lab->_screenHeight; - - for (uint16 i = 1; i <= (Images[combnum]->_height / 2); i++) { - if (g_lab->_isHiRes) { - if (i & 1) - g_lab->waitTOF(); - } else - g_lab->waitTOF(); - - display._imageData = g_lab->getCurrentDrawingBuffer(); - - g_lab->scrollDisplayY(2, g_lab->_graphics->VGAScaleX(combx[number]), g_lab->_graphics->VGAScaleY(65), g_lab->_graphics->VGAScaleX(combx[number]) + (Images[combnum])->_width - 1, g_lab->_graphics->VGAScaleY(65) + (Images[combnum])->_height); - - Images[combnum]->bltBitMap(0, (Images[combnum])->_height - (2 * i), &(display), g_lab->_graphics->VGAScaleX(combx[number]), g_lab->_graphics->VGAScaleY(65), (Images[combnum])->_width, 2); - } - - for (uint16 i = 0; i < 6; i++) - unlocked = (combination[i] == solution[i]) && unlocked; - - if (unlocked) - g_lab->_conditions->inclElement(COMBINATIONUNLOCKED); - else - g_lab->_conditions->exclElement(COMBINATIONUNLOCKED); -} - - -/*****************************************************************************/ -/* Processes mouse clicks and changes the combination. */ -/*****************************************************************************/ -void mouseCombination(Common::Point pos) { - uint16 number; - - int x = VGAUnScaleX(pos.x); - int y = VGAUnScaleY(pos.y); - - if ((y >= 63) && (y <= 99)) { - if ((x >= 44) && (x < 83)) - number = 0; - else if (x < 127) - number = 1; - else if (x < 165) - number = 2; - else if (x < 210) - number = 3; - else if (x < 245) - number = 4; - else if (x < 286) - number = 5; - else - return; - - changeCombination(number); - } -} - -/*****************************************************************************/ -/* Draws the images of the combination lock to the display bitmap. */ -/*****************************************************************************/ -static void doTile(bool showsolution) { - uint16 row = 0, col = 0, rowm, colm, num; - int16 rows, cols; - - if (showsolution) { - rowm = g_lab->_graphics->VGAScaleY(23); - colm = g_lab->_graphics->VGAScaleX(27); - - rows = g_lab->_graphics->VGAScaleY(31); - cols = g_lab->_graphics->VGAScaleX(105); - } else { - g_lab->_graphics->setAPen(0); - g_lab->_graphics->rectFill(g_lab->_graphics->VGAScaleX(97), g_lab->_graphics->VGAScaleY(22), g_lab->_graphics->VGAScaleX(220), g_lab->_graphics->VGAScaleY(126)); - - rowm = g_lab->_graphics->VGAScaleY(25); - colm = g_lab->_graphics->VGAScaleX(30); - - rows = g_lab->_graphics->VGAScaleY(25); - cols = g_lab->_graphics->VGAScaleX(100); - } - - while (row < 4) { - while (col < 4) { - if (showsolution) - num = TileSolution[col] [row]; - else - num = CurTile[col] [row]; - - if (showsolution || num) - Tiles[num]->drawImage(cols + (col * colm), rows + (row * rowm)); - - col++; - } - - row++; - col = 0; - } -} - -/*****************************************************************************/ -/* Reads in a backdrop picture. */ -/*****************************************************************************/ -void showTile(const char *filename, bool showsolution) { - uint16 start = showsolution ? 0 : 1; - - resetBuffer(); - g_lab->_anim->_doBlack = true; - g_lab->_anim->_noPalChange = true; - g_lab->_graphics->readPict(filename, true); - g_lab->_anim->_noPalChange = false; - g_lab->_graphics->blackScreen(); - - Common::File *tileFile = tileFile = g_lab->_resource->openDataFile(showsolution ? "P:TileSolution" : "P:Tile"); - - for (uint16 curBit = start; curBit < 16; curBit++) - Tiles[curBit] = new Image(tileFile); - - delete tileFile; - - allocFile((void **)&g_lab->_tempScrollData, Tiles[1]->_width * Tiles[1]->_height * 2L, "tempdata"); - - doTile(showsolution); - - g_lab->setPalette(g_lab->_anim->_diffPalette, 256); -} - -static void scrollRaster(int16 dx, int16 dy, uint16 x1, uint16 y1, uint16 x2, uint16 y2) { - if (dx) - g_lab->scrollDisplayX(dx, x1, y1, x2, y2); - - if (dy) - g_lab->scrollDisplayY(dy, x1, y1, x2, y2); -} - -/*****************************************************************************/ -/* Does the scrolling for the tiles on the tile puzzle. */ -/*****************************************************************************/ -static void doTileScroll(uint16 col, uint16 row, uint16 scrolltype) { - int16 dX = 0, dY = 0, dx = 0, dy = 0, sx = 0, sy = 0; - uint16 last = 0, x1, y1; - - if (scrolltype == LEFTSCROLL) { - dX = g_lab->_graphics->VGAScaleX(5); - sx = g_lab->_graphics->VGAScaleX(5); - last = 6; - } else if (scrolltype == RIGHTSCROLL) { - dX = g_lab->_graphics->VGAScaleX(-5); - dx = g_lab->_graphics->VGAScaleX(-5); - sx = g_lab->_graphics->VGAScaleX(5); - last = 6; - } else if (scrolltype == UPSCROLL) { - dY = g_lab->_graphics->VGAScaleY(5); - sy = g_lab->_graphics->VGAScaleY(5); - last = 5; - } else if (scrolltype == DOWNSCROLL) { - dY = g_lab->_graphics->VGAScaleY(-5); - dy = g_lab->_graphics->VGAScaleY(-5); - sy = g_lab->_graphics->VGAScaleY(5); - last = 5; - } - - sx += g_lab->_graphics->SVGACord(2); - - x1 = g_lab->_graphics->VGAScaleX(100) + (col * g_lab->_graphics->VGAScaleX(30)) + dx; - y1 = g_lab->_graphics->VGAScaleY(25) + (row * g_lab->_graphics->VGAScaleY(25)) + dy; - - for (uint16 i = 0; i < last; i++) { - g_lab->waitTOF(); - scrollRaster(dX, dY, x1, y1, x1 + g_lab->_graphics->VGAScaleX(28) + sx, y1 + g_lab->_graphics->VGAScaleY(23) + sy); - x1 += dX; - y1 += dY; - } -} - -/*****************************************************************************/ -/* Changes the combination number of one of the slots */ -/*****************************************************************************/ -static void changeTile(uint16 col, uint16 row) { - int16 scrolltype = -1; - - if (row > 0) { - if (CurTile[col] [row - 1] == 0) { - CurTile[col] [row - 1] = CurTile[col] [row]; - CurTile[col] [row] = 0; - scrolltype = DOWNSCROLL; - } - } - - if (col > 0) { - if (CurTile[col - 1] [row] == 0) { - CurTile[col - 1] [row] = CurTile[col] [row]; - CurTile[col] [row] = 0; - scrolltype = RIGHTSCROLL; - } - } - - if (row < 3) { - if (CurTile[col] [row + 1] == 0) { - CurTile[col] [row + 1] = CurTile[col] [row]; - CurTile[col] [row] = 0; - scrolltype = UPSCROLL; - } - } - - if (col < 3) { - if (CurTile[col + 1] [row] == 0) { - CurTile[col + 1] [row] = CurTile[col] [row]; - CurTile[col] [row] = 0; - scrolltype = LEFTSCROLL; - } - } - - if (scrolltype != -1) { - doTileScroll(col, row, scrolltype); - - if (g_lab->getFeatures() & GF_WINDOWS_TRIAL) { - GUI::MessageDialog trialMessage("This puzzle is not available in the trial version of the game"); - trialMessage.runModal(); - return; - } - - bool check = true; - row = 0; - col = 0; - - while (row < 4) { - while (col < 4) { - check = check && (CurTile[row] [col] == TileSolution[row] [col]); - col++; - } - - row++; - col = 0; - } - - if (check) { - g_lab->_conditions->inclElement(BRICKOPEN); /* unlocked combination */ - g_lab->_anim->_doBlack = true; - check = g_lab->_graphics->readPict("p:Up/BDOpen", true); - } - } -} - - -/*****************************************************************************/ -/* Processes mouse clicks and changes the combination. */ -/*****************************************************************************/ -void mouseTile(Common::Point pos) { - int x = VGAUnScaleX(pos.x); - int y = VGAUnScaleY(pos.y); - - if ((x < 101) || (y < 26)) - return; - - x = (x - 101) / 30; - y = (y - 26) / 25; - - if ((x < 4) && (y < 4)) - changeTile(x, y); -} - - /*****************************************************************************/ /* Does the things to properly set up the detective notes. */ /*****************************************************************************/ -- cgit v1.2.3 From d376fd8dd0b8676dbf1d27d400d78e5a292f05db Mon Sep 17 00:00:00 2001 From: Strangerke Date: Fri, 4 Dec 2015 16:59:09 +0100 Subject: LAB: Get rid of g_lab in several LabEngine and DisplayMan functions --- engines/lab/graphics.cpp | 30 ++++++++--------- engines/lab/lab.cpp | 86 ++++++++++++++++++++++++------------------------ 2 files changed, 58 insertions(+), 58 deletions(-) diff --git a/engines/lab/graphics.cpp b/engines/lab/graphics.cpp index be71769bed..73ec5cc7f8 100644 --- a/engines/lab/graphics.cpp +++ b/engines/lab/graphics.cpp @@ -66,7 +66,7 @@ uint16 DisplayMan::scaleX(uint16 x) { /* file, co-ordinates are set up on a 368x336 display. */ /*****************************************************************************/ uint16 DisplayMan::scaleY(uint16 y) { - if (g_lab->_isHiRes) + if (_vm->_isHiRes) return (y + (y / 14)); else return ((y * 10) / 24); @@ -76,7 +76,7 @@ uint16 DisplayMan::scaleY(uint16 y) { /* Scales the VGA cords to SVGA if necessary; otherwise, returns VGA cords. */ /*****************************************************************************/ int16 DisplayMan::VGAScaleX(int16 x) { - if (g_lab->_isHiRes) + if (_vm->_isHiRes) return (x * 2); else return x; @@ -86,14 +86,14 @@ int16 DisplayMan::VGAScaleX(int16 x) { /* Scales the VGA cords to SVGA if necessary; otherwise, returns VGA cords. */ /*****************************************************************************/ int16 DisplayMan::VGAScaleY(int16 y) { - if (g_lab->_isHiRes) + if (_vm->_isHiRes) return ((y * 12) / 5); else return y; } uint16 DisplayMan::SVGACord(uint16 cord) { - if (g_lab->_isHiRes) + if (_vm->_isHiRes) return cord; else return 0; @@ -133,12 +133,12 @@ bool DisplayMan::readPict(const char *filename, bool playOnce) { byte *DisplayMan::readPictToMem(const char *filename, uint16 x, uint16 y) { byte *mem; - g_lab->_anim->stopDiff(); + _vm->_anim->stopDiff(); allocFile((void **)&mem, (int32)x * (int32)y, "Bitmap"); byte *curMem = mem; - byte **file = g_lab->_music->newOpen(filename); + byte **file = _vm->_music->newOpen(filename); if (file == NULL) return NULL; @@ -152,7 +152,7 @@ byte *DisplayMan::readPictToMem(const char *filename, uint16 x, uint16 y) { DispBitMap->_planes[3] = DispBitMap->_planes[2] + 0x10000; DispBitMap->_planes[4] = DispBitMap->_planes[3] + 0x10000; - g_lab->_anim->readDiff(true); + _vm->_anim->readDiff(true); return mem; } @@ -488,16 +488,16 @@ void DisplayMan::copyPage(uint16 width, uint16 height, uint16 nheight, uint16 st uint16 curPage; uint32 *baseAddr; - baseAddr = (uint32 *)g_lab->getCurrentDrawingBuffer(); + baseAddr = (uint32 *)_vm->getCurrentDrawingBuffer(); size = (int32)(height - nheight) * (int32)width; mem += startline * width; - curPage = ((int32)nheight * (int32)width) / g_lab->_graphics->_screenBytesPerPage; - offSet = ((int32)nheight * (int32)width) - (curPage * g_lab->_graphics->_screenBytesPerPage); + curPage = ((int32)nheight * (int32)width) / _vm->_graphics->_screenBytesPerPage; + offSet = ((int32)nheight * (int32)width) - (curPage * _vm->_graphics->_screenBytesPerPage); while (size) { - if (size > (g_lab->_graphics->_screenBytesPerPage - offSet)) - copysize = g_lab->_graphics->_screenBytesPerPage - offSet; + if (size > (_vm->_graphics->_screenBytesPerPage - offSet)) + copysize = _vm->_graphics->_screenBytesPerPage - offSet; else copysize = size; @@ -669,7 +669,7 @@ void DisplayMan::doTransWipe(CloseDataPtr *cPtr, char *filename) { else _vm->_curFileName = getPictName(cPtr); - byte *BitMapMem = readPictToMem(g_lab->_curFileName, _vm->_screenWidth, lastY + 5); + byte *BitMapMem = readPictToMem(_vm->_curFileName, _vm->_screenWidth, lastY + 5); _vm->setPalette(_vm->_anim->_diffPalette, 256); if (BitMapMem) { @@ -833,7 +833,7 @@ bool DisplayMan::setUpScreens() { if (!createScreen(_vm->_isHiRes)) return false; - Common::File *controlFile = g_lab->_resource->openDataFile("P:Control"); + Common::File *controlFile = _vm->_resource->openDataFile("P:Control"); for (uint16 i = 0; i < 20; i++) _vm->_moveImages[i] = new Image(controlFile); delete controlFile; @@ -883,7 +883,7 @@ bool DisplayMan::setUpScreens() { curGadget->NextGadget = createButton(289, y, 9, 0, _vm->_moveImages[10], _vm->_moveImages[11]); } - Common::File *invFile = g_lab->_resource->openDataFile("P:Inv"); + Common::File *invFile = _vm->_resource->openDataFile("P:Inv"); if (_vm->getPlatform() == Common::kPlatformWindows) { for (uint16 imgIdx = 0; imgIdx < 10; imgIdx++) diff --git a/engines/lab/lab.cpp b/engines/lab/lab.cpp index 33c507873e..a8baec2bd1 100644 --- a/engines/lab/lab.cpp +++ b/engines/lab/lab.cpp @@ -299,8 +299,8 @@ void LabEngine::changeTile(uint16 col, uint16 row) { } bool check = true; - row = 0; - col = 0; + row = 0; + col = 0; while (row < 4) { while (col < 4) { @@ -398,23 +398,23 @@ void LabEngine::showTile(const char *filename, bool showsolution) { uint16 start = showsolution ? 0 : 1; resetBuffer(); - g_lab->_anim->_doBlack = true; - g_lab->_anim->_noPalChange = true; - g_lab->_graphics->readPict(filename, true); - g_lab->_anim->_noPalChange = false; - g_lab->_graphics->blackScreen(); + _anim->_doBlack = true; + _anim->_noPalChange = true; + _graphics->readPict(filename, true); + _anim->_noPalChange = false; + _graphics->blackScreen(); - Common::File *tileFile = tileFile = g_lab->_resource->openDataFile(showsolution ? "P:TileSolution" : "P:Tile"); + Common::File *tileFile = tileFile = _resource->openDataFile(showsolution ? "P:TileSolution" : "P:Tile"); for (uint16 curBit = start; curBit < 16; curBit++) Tiles[curBit] = new Image(tileFile); delete tileFile; - allocFile((void **)&g_lab->_tempScrollData, Tiles[1]->_width * Tiles[1]->_height * 2L, "tempdata"); + allocFile((void **)&_tempScrollData, Tiles[1]->_width * Tiles[1]->_height * 2L, "tempdata"); - g_lab->doTile(showsolution); - g_lab->setPalette(g_lab->_anim->_diffPalette, 256); + doTile(showsolution); + setPalette(_anim->_diffPalette, 256); } /*****************************************************************************/ @@ -425,33 +425,33 @@ void LabEngine::doTileScroll(uint16 col, uint16 row, uint16 scrolltype) { uint16 last = 0, x1, y1; if (scrolltype == LEFTSCROLL) { - dX = g_lab->_graphics->VGAScaleX(5); - sx = g_lab->_graphics->VGAScaleX(5); + dX = _graphics->VGAScaleX(5); + sx = _graphics->VGAScaleX(5); last = 6; } else if (scrolltype == RIGHTSCROLL) { - dX = g_lab->_graphics->VGAScaleX(-5); - dx = g_lab->_graphics->VGAScaleX(-5); - sx = g_lab->_graphics->VGAScaleX(5); + dX = _graphics->VGAScaleX(-5); + dx = _graphics->VGAScaleX(-5); + sx = _graphics->VGAScaleX(5); last = 6; } else if (scrolltype == UPSCROLL) { - dY = g_lab->_graphics->VGAScaleY(5); - sy = g_lab->_graphics->VGAScaleY(5); + dY = _graphics->VGAScaleY(5); + sy = _graphics->VGAScaleY(5); last = 5; } else if (scrolltype == DOWNSCROLL) { - dY = g_lab->_graphics->VGAScaleY(-5); - dy = g_lab->_graphics->VGAScaleY(-5); - sy = g_lab->_graphics->VGAScaleY(5); + dY = _graphics->VGAScaleY(-5); + dy = _graphics->VGAScaleY(-5); + sy = _graphics->VGAScaleY(5); last = 5; } - sx += g_lab->_graphics->SVGACord(2); + sx += _graphics->SVGACord(2); - x1 = g_lab->_graphics->VGAScaleX(100) + (col * g_lab->_graphics->VGAScaleX(30)) + dx; - y1 = g_lab->_graphics->VGAScaleY(25) + (row * g_lab->_graphics->VGAScaleY(25)) + dy; + x1 = _graphics->VGAScaleX(100) + (col * _graphics->VGAScaleX(30)) + dx; + y1 = _graphics->VGAScaleY(25) + (row * _graphics->VGAScaleY(25)) + dy; for (uint16 i = 0; i < last; i++) { - g_lab->waitTOF(); - scrollRaster(dX, dY, x1, y1, x1 + g_lab->_graphics->VGAScaleX(28) + sx, y1 + g_lab->_graphics->VGAScaleY(23) + sy); + waitTOF(); + scrollRaster(dX, dY, x1, y1, x1 + _graphics->VGAScaleX(28) + sx, y1 + _graphics->VGAScaleY(23) + sy); x1 += dX; y1 += dY; } @@ -474,22 +474,22 @@ void LabEngine::changeCombination(uint16 number) { combnum = combination[number]; - display._imageData = g_lab->getCurrentDrawingBuffer(); - display._width = g_lab->_screenWidth; - display._height = g_lab->_screenHeight; + display._imageData = getCurrentDrawingBuffer(); + display._width = _screenWidth; + display._height = _screenHeight; for (uint16 i = 1; i <= (Images[combnum]->_height / 2); i++) { - if (g_lab->_isHiRes) { + if (_isHiRes) { if (i & 1) - g_lab->waitTOF(); + waitTOF(); } else - g_lab->waitTOF(); + waitTOF(); - display._imageData = g_lab->getCurrentDrawingBuffer(); + display._imageData = getCurrentDrawingBuffer(); - g_lab->scrollDisplayY(2, g_lab->_graphics->VGAScaleX(COMBINATION_X[number]), g_lab->_graphics->VGAScaleY(65), g_lab->_graphics->VGAScaleX(COMBINATION_X[number]) + (Images[combnum])->_width - 1, g_lab->_graphics->VGAScaleY(65) + (Images[combnum])->_height); + scrollDisplayY(2, _graphics->VGAScaleX(COMBINATION_X[number]), _graphics->VGAScaleY(65), _graphics->VGAScaleX(COMBINATION_X[number]) + (Images[combnum])->_width - 1, _graphics->VGAScaleY(65) + (Images[combnum])->_height); - Images[combnum]->bltBitMap(0, (Images[combnum])->_height - (2 * i), &(display), g_lab->_graphics->VGAScaleX(COMBINATION_X[number]), g_lab->_graphics->VGAScaleY(65), (Images[combnum])->_width, 2); + Images[combnum]->bltBitMap(0, (Images[combnum])->_height - (2 * i), &(display), _graphics->VGAScaleX(COMBINATION_X[number]), _graphics->VGAScaleY(65), (Images[combnum])->_width, 2); } for (uint16 i = 0; i < 6; i++) @@ -522,25 +522,25 @@ void LabEngine::doCombination() { /*****************************************************************************/ void LabEngine::showCombination(const char *filename) { resetBuffer(); - g_lab->_anim->_doBlack = true; - g_lab->_anim->_noPalChange = true; - g_lab->_graphics->readPict(filename, true); - g_lab->_anim->_noPalChange = false; + _anim->_doBlack = true; + _anim->_noPalChange = true; + _graphics->readPict(filename, true); + _anim->_noPalChange = false; - g_lab->_graphics->blackScreen(); + _graphics->blackScreen(); - Common::File *numFile = g_lab->_resource->openDataFile("P:Numbers"); + Common::File *numFile = _resource->openDataFile("P:Numbers"); for (uint16 CurBit = 0; CurBit < 10; CurBit++) Images[CurBit] = new Image(numFile); delete numFile; - allocFile((void **)&g_lab->_tempScrollData, Images[0]->_width * Images[0]->_height * 2L, "tempdata"); + allocFile((void **)&_tempScrollData, Images[0]->_width * Images[0]->_height * 2L, "tempdata"); doCombination(); - g_lab->setPalette(g_lab->_anim->_diffPalette, 256); + setPalette(_anim->_diffPalette, 256); } } // End of namespace Lab -- cgit v1.2.3 From a182a6af1a71a3140c7cb40d2df3595ea3ad0a90 Mon Sep 17 00:00:00 2001 From: Filippos Karapetis Date: Fri, 4 Dec 2015 21:18:41 +0200 Subject: LAB: Rewrite picture handling and get rid of the memory manager --- engines/lab/anim.cpp | 8 +- engines/lab/anim.h | 5 +- engines/lab/engine.cpp | 23 ++--- engines/lab/graphics.cpp | 57 +++++++---- engines/lab/graphics.h | 12 ++- engines/lab/intro.cpp | 38 +++---- engines/lab/lab.cpp | 6 -- engines/lab/labfile.cpp | 237 -------------------------------------------- engines/lab/labfun.h | 20 ---- engines/lab/music.cpp | 32 +----- engines/lab/music.h | 1 - engines/lab/processroom.cpp | 11 +- engines/lab/special.cpp | 7 +- 13 files changed, 79 insertions(+), 378 deletions(-) diff --git a/engines/lab/anim.cpp b/engines/lab/anim.cpp index 9402f9cd2a..5ecfa72402 100644 --- a/engines/lab/anim.cpp +++ b/engines/lab/anim.cpp @@ -586,7 +586,7 @@ void Anim::diffNextFrame() { /*****************************************************************************/ /* A separate task launched by readDiff. Plays the DIFF. */ /*****************************************************************************/ -void Anim::playDiff() { +void Anim::playDiff(byte *buffer) { _waitSec = 0L; _waitMicros = 0L; _delayMicros = 0L; @@ -605,7 +605,7 @@ void Anim::playDiff() { _vm->_graphics->blackScreen(); } - _start = *startoffile; /* Make a copy of the pointer to the start of the file */ + _start = buffer; /* Make a copy of the pointer to the start of the file */ *_diffFile = _start; /* Now can modify the file without modifying the original */ if (_start == NULL) { @@ -709,9 +709,9 @@ void Anim::stopSound() { /*****************************************************************************/ /* Reads in a DIFF file. */ /*****************************************************************************/ -bool Anim::readDiff(bool playOnce) { +bool Anim::readDiff(byte *buffer, bool playOnce) { _playOnce = playOnce; - playDiff(); + playDiff(buffer); return true; } diff --git a/engines/lab/anim.h b/engines/lab/anim.h index 3fed57d929..170e84d14b 100644 --- a/engines/lab/anim.h +++ b/engines/lab/anim.h @@ -114,14 +114,13 @@ public: bool VUnDIFFMemory(byte *dest, byte *diff, uint16 headerSize, uint16 copySize, uint16 bytesPerRow); void runLengthDecode(byte *dest, byte *source); void VRunLengthDecode(byte *dest, byte *source, uint16 bytesPerRow); - bool readDiff(bool playOnce); + bool readDiff(byte *buffer, bool playOnce); + void playDiff(byte *buffer); void diffNextFrame(); void readSound(bool waitTillFinished, Common::File *file); void stopDiff(); void stopDiffEnd(); void stopSound(); - void playDiff(); - }; } // End of namespace Lab diff --git a/engines/lab/engine.cpp b/engines/lab/engine.cpp index f3cda0e8bf..fa12324264 100644 --- a/engines/lab/engine.cpp +++ b/engines/lab/engine.cpp @@ -1057,22 +1057,14 @@ void LabEngine::go() { _isHiRes = ((getFeatures() & GF_LOWRES) == 0); - bool mem = false; - if (initBuffer(BUFFERSIZE, true)) { - mem = true; - } else { - warning("initBuffer() failed"); - return; - } - if (!_graphics->setUpScreens()) { _isHiRes = false; - mem = mem && _graphics->setUpScreens(); + _graphics->setUpScreens(); } _event->initMouse(); - mem = mem && initRoomBuffer(); + initRoomBuffer(); if (!doIntro) _music->initMusic(); @@ -1081,18 +1073,15 @@ void LabEngine::go() { _event->mouseHide(); - if (doIntro && mem) { + if (doIntro) { Intro *intro = new Intro(this); intro->introSequence(); delete intro; } else _anim->_doBlack = true; - if (mem) { - _event->mouseShow(); - mainGameLoop(); - } else - debug("\n\nNot enough memory to start game.\n\n"); + _event->mouseShow(); + mainGameLoop(); if (QuitLab) { /* Won the game */ _graphics->blackAllScreen(); @@ -1117,7 +1106,7 @@ void LabEngine::go() { closeFont(_msgFont); freeRoomBuffer(); - freeBuffer(); + _graphics->freePict(); freeScreens(); diff --git a/engines/lab/graphics.cpp b/engines/lab/graphics.cpp index 73ec5cc7f8..614b74431b 100644 --- a/engines/lab/graphics.cpp +++ b/engines/lab/graphics.cpp @@ -48,6 +48,11 @@ DisplayMan::DisplayMan(LabEngine *vm) : _vm(vm) { _screenBytesPerPage = 65536; _curapen = 0; + _curBitmap = NULL; +} + +DisplayMan::~DisplayMan() { + freePict(); } /*****************************************************************************/ @@ -103,26 +108,32 @@ uint16 DisplayMan::SVGACord(uint16 cord) { /*------ From readPict.c. Reads in pictures and animations from disk. ------*/ /*---------------------------------------------------------------------------*/ +void DisplayMan::loadPict(const char *filename) { + Common::File *bitmapFile = _vm->_resource->openDataFile(filename); + freePict(); + _curBitmap = new byte[bitmapFile->size()]; + bitmapFile->read(_curBitmap, bitmapFile->size()); + delete bitmapFile; +} + /*****************************************************************************/ /* Reads in a picture into the dest bitmap. */ /*****************************************************************************/ bool DisplayMan::readPict(const char *filename, bool playOnce) { _vm->_anim->stopDiff(); - byte **file = _vm->_music->newOpen(filename); + loadPict(filename); - if (file == NULL) { - if ((filename[0] == 'p') || (filename[0] == 'P')) - blackScreen(); + _vm->_music->updateMusic(); - return false; - } + if (!_vm->_music->_doNotFilestopSoundEffect) + _vm->_music->stopSoundEffect(); DispBitMap->_bytesPerRow = _vm->_screenWidth; DispBitMap->_rows = _vm->_screenHeight; DispBitMap->_flags = BITMAPF_VIDEO; - _vm->_anim->readDiff(playOnce); + _vm->_anim->readDiff(_curBitmap, playOnce); return true; } @@ -131,30 +142,32 @@ bool DisplayMan::readPict(const char *filename, bool playOnce) { /* Reads in a picture into buffer memory. */ /*****************************************************************************/ byte *DisplayMan::readPictToMem(const char *filename, uint16 x, uint16 y) { - byte *mem; - _vm->_anim->stopDiff(); - allocFile((void **)&mem, (int32)x * (int32)y, "Bitmap"); - byte *curMem = mem; + loadPict(filename); - byte **file = _vm->_music->newOpen(filename); + _vm->_music->updateMusic(); - if (file == NULL) - return NULL; + if (!_vm->_music->_doNotFilestopSoundEffect) + _vm->_music->stopSoundEffect(); DispBitMap->_bytesPerRow = x; DispBitMap->_rows = y; DispBitMap->_flags = BITMAPF_NONE; - DispBitMap->_planes[0] = curMem; + DispBitMap->_planes[0] = _curBitmap; DispBitMap->_planes[1] = DispBitMap->_planes[0] + 0x10000; DispBitMap->_planes[2] = DispBitMap->_planes[1] + 0x10000; DispBitMap->_planes[3] = DispBitMap->_planes[2] + 0x10000; DispBitMap->_planes[4] = DispBitMap->_planes[3] + 0x10000; - _vm->_anim->readDiff(true); + _vm->_anim->readDiff(_curBitmap, true); + + return _curBitmap; +} - return mem; +void DisplayMan::freePict() { + delete _curBitmap; + _curBitmap = NULL; } /*****************************************************************************/ @@ -413,16 +426,15 @@ void DisplayMan::drawMessage(const char *str) { /* Scrolls the display to black. */ /*****************************************************************************/ void DisplayMan::doScrollBlack() { - byte *mem, *tempmem; + byte *tempmem; Image im; uint32 size, copysize; uint32 *baseAddr; - - _vm->_event->mouseHide(); uint16 width = VGAScaleX(320); uint16 height = VGAScaleY(149) + SVGACord(2); + byte *mem = new byte[width * height]; - allocFile((void **)&mem, (int32)width * (int32)height, "Temp Mem"); + _vm->_event->mouseHide(); im._width = width; im._height = height; @@ -479,7 +491,8 @@ void DisplayMan::doScrollBlack() { } } - freeAllStolenMem(); + delete[] mem; + freePict(); _vm->_event->mouseShow(); } diff --git a/engines/lab/graphics.h b/engines/lab/graphics.h index aac7e58983..63523cbf29 100644 --- a/engines/lab/graphics.h +++ b/engines/lab/graphics.h @@ -40,20 +40,20 @@ private: LabEngine *_vm; byte _curapen; + byte *_curBitmap; public: - bool _longWinInFront; - bool _lastMessageLong; - uint32 _screenBytesPerPage; - DisplayMan(LabEngine *lab); + virtual ~DisplayMan(); uint16 scaleX(uint16 x); uint16 scaleY(uint16 y); int16 VGAScaleX(int16 x); int16 VGAScaleY(int16 y); uint16 SVGACord(uint16 cord); + void loadPict(const char *filename); bool readPict(const char *filename, bool playOnce); + void freePict(); byte *readPictToMem(const char *filename, uint16 x, uint16 y); void doScrollBlack(); void copyPage(uint16 width, uint16 height, uint16 nheight, uint16 startline, byte *mem); @@ -101,6 +101,10 @@ public: void drawVLine(uint16 x1, uint16 y, uint16 x2); void screenUpdate(); bool createScreen(bool HiRes); + + bool _longWinInFront; + bool _lastMessageLong; + uint32 _screenBytesPerPage; }; } // End of namespace Lab diff --git a/engines/lab/intro.cpp b/engines/lab/intro.cpp index aab50f49c7..52a46ebef7 100644 --- a/engines/lab/intro.cpp +++ b/engines/lab/intro.cpp @@ -85,39 +85,37 @@ void Intro::doPictText(const char *filename, TextFont *msgFont, bool isScreen) { uint32 lastSecs = 0L, lastMicros = 0L, secs = 0L, micros = 0L; IntuiMessage *msg; - byte *curPlace, **tFile; bool drawNextText = true, end = false, begin = true; int32 cls, code, Drawn; int16 qualifier; + Common::File *textFile = g_lab->_resource->openDataFile(path); + byte *textBuffer = new byte[textFile->size()]; + textFile->read(textBuffer, textFile->size()); + delete textFile; + byte *curText = textBuffer; + while (1) { if (drawNextText) { - if (begin) { + if (begin) begin = false; - - tFile = _vm->_music->newOpen(path); - - if (!tFile) - return; - - curPlace = *tFile; - } else if (isScreen) + else if (isScreen) fade(false, 0); if (isScreen) { _vm->_graphics->setAPen(7); _vm->_graphics->rectFill(_vm->_graphics->VGAScaleX(10), _vm->_graphics->VGAScaleY(10), _vm->_graphics->VGAScaleX(310), _vm->_graphics->VGAScaleY(190)); - Drawn = _vm->_graphics->flowText(msgFont, (!_vm->_isHiRes) * -1, 5, 7, false, false, true, true, _vm->_graphics->VGAScaleX(14), _vm->_graphics->VGAScaleY(11), _vm->_graphics->VGAScaleX(306), _vm->_graphics->VGAScaleY(189), (char *)curPlace); + Drawn = _vm->_graphics->flowText(msgFont, (!_vm->_isHiRes) * -1, 5, 7, false, false, true, true, _vm->_graphics->VGAScaleX(14), _vm->_graphics->VGAScaleY(11), _vm->_graphics->VGAScaleX(306), _vm->_graphics->VGAScaleY(189), (char *)curText); fade(true, 0); } else { - Drawn = _vm->_graphics->longDrawMessage((char *)curPlace); + Drawn = _vm->_graphics->longDrawMessage((char *)curText); } - curPlace += Drawn; + curText += Drawn; - end = (*curPlace == 0); + end = (*curText == 0); drawNextText = false; introEatMessages(); @@ -126,6 +124,7 @@ void Intro::doPictText(const char *filename, TextFont *msgFont, bool isScreen) { if (isScreen) fade(false, 0); + delete[] textBuffer; return; } @@ -145,6 +144,7 @@ void Intro::doPictText(const char *filename, TextFont *msgFont, bool isScreen) { if (isScreen) fade(false, 0); + delete[] textBuffer; return; } else { drawNextText = true; @@ -164,6 +164,7 @@ void Intro::doPictText(const char *filename, TextFont *msgFont, bool isScreen) { if (isScreen) fade(false, 0); + delete[] textBuffer; return; } @@ -173,6 +174,7 @@ void Intro::doPictText(const char *filename, TextFont *msgFont, bool isScreen) { if (isScreen) fade(false, 0); + delete[] textBuffer; return; } else drawNextText = true; @@ -184,6 +186,7 @@ void Intro::doPictText(const char *filename, TextFont *msgFont, bool isScreen) { if (isScreen) fade(false, 0); + delete[] textBuffer; return; } } @@ -192,11 +195,12 @@ void Intro::doPictText(const char *filename, TextFont *msgFont, bool isScreen) { if (isScreen) fade(false, 0); + delete[] textBuffer; return; } else drawNextText = true; } - } + } // while(1) } /*****************************************************************************/ @@ -323,8 +327,6 @@ void Intro::introSequence() { nReadPict("DA", true); musicDelay(); - _vm->_music->newOpen("p:Intro/Intro.1"); /* load the picture into the buffer */ - _vm->_music->updateMusic(); _vm->_graphics->blackAllScreen(); _vm->_music->updateMusic(); @@ -345,8 +347,6 @@ void Intro::introSequence() { doPictText("i.2A", msgFont, true); doPictText("i.2B", msgFont, true); - freeAllStolenMem(); - _vm->_graphics->blackAllScreen(); _vm->_music->updateMusic(); diff --git a/engines/lab/lab.cpp b/engines/lab/lab.cpp index a8baec2bd1..ef7554456a 100644 --- a/engines/lab/lab.cpp +++ b/engines/lab/lab.cpp @@ -397,7 +397,6 @@ void LabEngine::doTile(bool showsolution) { void LabEngine::showTile(const char *filename, bool showsolution) { uint16 start = showsolution ? 0 : 1; - resetBuffer(); _anim->_doBlack = true; _anim->_noPalChange = true; _graphics->readPict(filename, true); @@ -411,8 +410,6 @@ void LabEngine::showTile(const char *filename, bool showsolution) { delete tileFile; - allocFile((void **)&_tempScrollData, Tiles[1]->_width * Tiles[1]->_height * 2L, "tempdata"); - doTile(showsolution); setPalette(_anim->_diffPalette, 256); } @@ -521,7 +518,6 @@ void LabEngine::doCombination() { /* Reads in a backdrop picture. */ /*****************************************************************************/ void LabEngine::showCombination(const char *filename) { - resetBuffer(); _anim->_doBlack = true; _anim->_noPalChange = true; _graphics->readPict(filename, true); @@ -536,8 +532,6 @@ void LabEngine::showCombination(const char *filename) { delete numFile; - allocFile((void **)&_tempScrollData, Images[0]->_width * Images[0]->_height * 2L, "tempdata"); - doCombination(); setPalette(_anim->_diffPalette, 256); diff --git a/engines/lab/labfile.cpp b/engines/lab/labfile.cpp index 4fee3ba93e..579316c07c 100644 --- a/engines/lab/labfile.cpp +++ b/engines/lab/labfile.cpp @@ -35,139 +35,6 @@ namespace Lab { -static byte *buffer = NULL, *realbufferstart = NULL, *startoffilestorage = NULL; - -byte **startoffile = &startoffilestorage; -static uint32 buffersize, realbuffersize; - -/*-------------------- Routines that buffer a whole file --------------------*/ - -#define MAXMARKERS 15 - - -struct FileMarker { - char name[32]; - void *Start, *End; -}; - - - -static FileMarker FileMarkers[MAXMARKERS]; -static uint16 _curMarker = 0; -static void *_memPlace = NULL; - - - - - -/*****************************************************************************/ -/* Frees a File's resources. */ -/*****************************************************************************/ -static void freeFile(uint16 RMarker) { - FileMarkers[RMarker].name[0] = 0; - FileMarkers[RMarker].Start = NULL; - FileMarkers[RMarker].End = NULL; -} - -/*****************************************************************************/ -/* Checks if a file is already buffered. */ -/*****************************************************************************/ -byte **isBuffered(const char *fileName) { - if (fileName == NULL) - return NULL; - - for (int i = 0; i < MAXMARKERS; i++) { - if (strcmp(FileMarkers[i].name, fileName) == 0) { - *startoffile = (byte *)FileMarkers[i].Start; - return startoffile; - } - } - - return NULL; -} - -/*****************************************************************************/ -/* Grabs a chunk of memory from the room buffer, and manages it for a */ -/* particular room. If it returns true, then the file is already in memory. */ -/*****************************************************************************/ -bool allocFile(void **Ptr, uint32 Size, const char *fileName) { - uint16 RMarker; - byte **temp; - - if (1 & Size) /* Memory is required to be even aligned */ - Size++; - - temp = isBuffered(fileName); - - if (temp) { - *Ptr = *temp; - return true; - } - - RMarker = _curMarker; - _curMarker++; - - if (_curMarker >= MAXMARKERS) - _curMarker = 0; - - freeFile(RMarker); - strcpy(FileMarkers[RMarker].name, fileName); - - *Ptr = 0; - - if ((((char *)_memPlace) + Size - 1) >= - (((char *)buffer) + buffersize)) - _memPlace = buffer; - - *Ptr = _memPlace; - _memPlace = (char *)_memPlace + Size; - - for (int i = 0; i < MAXMARKERS; i++) { - if (FileMarkers[i].name[0]) { - if (((FileMarkers[i].Start >= Ptr) && (FileMarkers[i].Start < _memPlace)) - || ((FileMarkers[i].End >= Ptr) && (FileMarkers[i].End < _memPlace)) - || ((Ptr >= FileMarkers[i].Start) && (Ptr <= FileMarkers[i].End))) - freeFile(i); - } - } - - FileMarkers[RMarker].Start = *Ptr; - FileMarkers[RMarker].End = (void *)(((char *)(*Ptr)) + Size - 1); - - return false; -} - -/*----- Main routines -----*/ - - -/*****************************************************************************/ -/* Reads a file into memory. */ -/*****************************************************************************/ -byte **openFile(const char *name, uint32 &size) { - byte *buf; - Common::File file; - - file.open(translateFileName(name)); - if (!file.isOpen()) { - warning("Cannot open file %s", translateFileName(name)); - - return NULL; - } - - size = file.size(); - - buf = (byte *)malloc(size); - if (!buf) - error("Unable to allocate %d bytes file file %s", size, name); - - *startoffile = buf; - - file.read(buf, size); - - return startoffile; -} - - /*****************************************************************************/ /* Reads a block of memory. */ /*****************************************************************************/ @@ -176,110 +43,6 @@ void readBlock(void *Buffer, uint32 Size, byte **File) { (*File) += Size; } -/*****************************************************************************/ -/* Resets the internal buffers to empty. */ -/*****************************************************************************/ -void resetBuffer() { - uint16 RMarker; - - _curMarker = 0; - RMarker = 0; - _memPlace = buffer; - - while (RMarker < MAXMARKERS) { - freeFile(RMarker); - RMarker++; - } -} - - -/*****************************************************************************/ -/* Initializes the buffer. */ -/*****************************************************************************/ -bool initBuffer(uint32 BufSize, bool IsGraphicsMem) { - buffer = (byte *)calloc(BufSize, 1); - - buffersize = BufSize; - realbuffersize = buffersize; - realbufferstart = buffer; - - resetBuffer(); - - return (buffer != NULL); -} - -/*****************************************************************************/ -/* Frees the buffer. */ -/*****************************************************************************/ -void freeBuffer() { - freeAllStolenMem(); - - if (buffer) - free(buffer); -} - -/*------------------------------------------------------------------------*/ -/* The following routines allow stealing of memory from the buffer (which */ -/* later may or may not be given back). */ -/*------------------------------------------------------------------------*/ - - - - -/*****************************************************************************/ -/* Clears all the buffers. */ -/*****************************************************************************/ -static void flushBuffers() { - for (int i = 0; i < MAXMARKERS; i++) - freeFile(i); -} - - - -/*****************************************************************************/ -/* Steal some memory from the buffer */ -/*****************************************************************************/ -void *stealBufMem(int32 Size) { - void *Mem; - - flushBuffers(); - Mem = buffer; - - buffer += Size; - buffersize -= Size; - _memPlace = buffer; - - return Mem; -} - - -Common::File *openPartial(const char *name) { - Common::File *f; - - f = new Common::File(); - f->open(translateFileName(name)); - - if (!f->isOpen()) { - warning("openPartial skipped %s", translateFileName(name)); - delete f; - return 0; - } - - return f; -} - - -/*****************************************************************************/ -/* Frees all the memory stolen from the buffer. */ -/*****************************************************************************/ -void freeAllStolenMem() { - flushBuffers(); - - buffer = realbufferstart; - buffersize = realbuffersize; - _memPlace = buffer; -} - static char NewFileName[255]; /*****************************************************************************/ diff --git a/engines/lab/labfun.h b/engines/lab/labfun.h index 558abe1a80..8d7c60930f 100644 --- a/engines/lab/labfun.h +++ b/engines/lab/labfun.h @@ -92,27 +92,7 @@ void gadgetsOnOff(void *gptr, void *win, int32 num, bool on); void eatMessages(); bool quitPlaying(); -/*---------------------------*/ -/*------ From LabFile.c -----*/ -/*---------------------------*/ - -/* Buffer a whole file */ -byte **isBuffered(const char *fileName); -byte **openFile(const char *name, uint32 &size); void readBlock(void *Buffer, uint32 Size, byte **File); -void resetBuffer(); -bool initBuffer(uint32 BufSize, bool IsGraphicsMem); -void freeBuffer(); - -/* Functions that borrow memory from the buffer */ -bool allocFile(void **Ptr, uint32 Size, const char *fileName); -void *stealBufMem(int32 Size); -void freeAllStolenMem(); - - -/* Read chunks of a file */ -Common::File *openPartial(const char *name); -void closePartial(int32 File); /*---------------------------*/ /*----- From LabSets.c ------*/ diff --git a/engines/lab/music.cpp b/engines/lab/music.cpp index e9deb8ee1c..b6b00cb23c 100644 --- a/engines/lab/music.cpp +++ b/engines/lab/music.cpp @@ -175,7 +175,7 @@ bool Music::initMusic() { else filename = "Music:BackGrou"; - _file = openPartial(filename); + _file = g_lab->_resource->openDataFile(filename); if (_file) { startMusic(true); @@ -277,7 +277,7 @@ void Music::changeMusic(const char *newmusic) { _tLeftInFile = _leftinfile; } - _file = openPartial(newmusic); + _file = g_lab->_resource->openDataFile(newmusic); if (_file) { _musicOn = true; /* turn it off */ @@ -320,32 +320,4 @@ void Music::resetMusic() { _tFile = 0; } -/*****************************************************************************/ -/* Checks whether or note enough memory in music buffer before loading any */ -/* files. Fills it if not. Does not take into account the current buffer */ -/* playing; a built in fudge factor. We've also got another FUDGEFACTOR */ -/* defined above in case things go wrong. */ -/* */ -/* Here, the seconds are multipled by 10. */ -/*****************************************************************************/ -byte **Music::newOpen(const char *name) { - byte **file; - - if (!name || !strcmp(name, "") || !strcmp(name, " ")) - return NULL; - - if ((file = isBuffered(name))) - return file; - - updateMusic(); - - if (!_doNotFilestopSoundEffect) - stopSoundEffect(); - - uint32 unused; - file = openFile(name, unused); - updateMusic(); - return file; -} - } // End of namespace Lab diff --git a/engines/lab/music.h b/engines/lab/music.h index 45528e5d82..a94fae589e 100644 --- a/engines/lab/music.h +++ b/engines/lab/music.h @@ -52,7 +52,6 @@ class Music { public: Music(LabEngine *vm); - byte **newOpen(const char *name); bool initMusic(); void freeMusic(); void updateMusic(); diff --git a/engines/lab/processroom.cpp b/engines/lab/processroom.cpp index 0b812556a8..bc7fa2e8b5 100644 --- a/engines/lab/processroom.cpp +++ b/engines/lab/processroom.cpp @@ -300,8 +300,6 @@ bool takeItem(uint16 x, uint16 y, CloseDataPtr *cptr) { /* Processes the action list. */ /*****************************************************************************/ void LabEngine::doActions(Action *aptr, CloseDataPtr *lcptr) { - bool firstLoaded = true; - while (aptr) { _music->updateMusic(); @@ -334,13 +332,8 @@ void LabEngine::doActions(Action *aptr, CloseDataPtr *lcptr) { break; case LOADDIFF: - if (firstLoaded) { - resetBuffer(); - firstLoaded = false; - } - if (aptr->Data) - _music->newOpen((char *)aptr->Data); /* Puts a file into memory */ + _graphics->loadPict((char *)aptr->Data); /* Puts a file into memory */ break; @@ -524,7 +517,7 @@ void LabEngine::doActions(Action *aptr, CloseDataPtr *lcptr) { break; case RESETBUFFER: - resetBuffer(); + g_lab->_graphics->freePict(); break; case SPECIALCMD: diff --git a/engines/lab/special.cpp b/engines/lab/special.cpp index 3f26fbcbae..855093edec 100644 --- a/engines/lab/special.cpp +++ b/engines/lab/special.cpp @@ -152,7 +152,6 @@ void doWestPaper() { closeFont(paperFont); g_lab->setPalette(g_lab->_anim->_diffPalette, 256); - freeAllStolenMem(); } /*****************************************************************************/ @@ -377,7 +376,6 @@ void LabEngine::processJournal() { /* Does the journal processing. */ /*****************************************************************************/ void LabEngine::doJournal() { - resetBuffer(); _graphics->blackAllScreen(); lastpage = false; @@ -410,8 +408,6 @@ void LabEngine::doJournal() { _graphics->setAPen(0); _graphics->rectFill(0, 0, _screenWidth - 1, _screenHeight - 1); _graphics->blackScreen(); - - freeAllStolenMem(); } bool LabEngine::saveRestoreGame() { @@ -638,7 +634,6 @@ void LabEngine::doMonitor(char *background, char *textfile, bool isinteractive, _graphics->readPict("P:Mon/NWD3", true); _graphics->blackAllScreen(); - resetBuffer(); monitorPage = 0; lastpage = false; FadePalette = hipal; @@ -656,11 +651,11 @@ void LabEngine::doMonitor(char *background, char *textfile, bool isinteractive, _event->mouseHide(); delete[] ntext; closeFont(monitorFont); - freeAllStolenMem(); _graphics->setAPen(0); _graphics->rectFill(0, 0, _screenWidth - 1, _screenHeight - 1); _graphics->blackAllScreen(); + _graphics->freePict(); } } // End of namespace Lab -- cgit v1.2.3 From eb0a52e7fb68fae75d5f8ab2ce435f0589537722 Mon Sep 17 00:00:00 2001 From: Filippos Karapetis Date: Fri, 4 Dec 2015 21:26:07 +0200 Subject: LAB: Remove some superfluous initialization code --- engines/lab/lab.cpp | 4 ---- 1 file changed, 4 deletions(-) diff --git a/engines/lab/lab.cpp b/engines/lab/lab.cpp index ef7554456a..4a14ba63d0 100644 --- a/engines/lab/lab.cpp +++ b/engines/lab/lab.cpp @@ -119,12 +119,8 @@ LabEngine::LabEngine(OSystem *syst, const ADGameDescription *gameDesc) _nextFileName = nullptr; _newFileName = nullptr; - _moveGadgetList = 0; - _invGadgetList = 0; - _curFileName = " "; _msgFont = 0; - _inventory = 0; for (int i = 0; i < 16; i++) -- cgit v1.2.3 From 9ba30835a290c0e6fb10472149477d19e94e00b3 Mon Sep 17 00:00:00 2001 From: Filippos Karapetis Date: Fri, 4 Dec 2015 21:47:47 +0200 Subject: LAB: Refactor the remaining functions in labfile.cpp --- engines/lab/anim.cpp | 5 +++ engines/lab/anim.h | 1 + engines/lab/labfile.cpp | 88 ------------------------------------------------ engines/lab/labfun.h | 6 ---- engines/lab/module.mk | 1 - engines/lab/resource.cpp | 47 +++++++++++++++++++------- engines/lab/resource.h | 1 + 7 files changed, 41 insertions(+), 108 deletions(-) delete mode 100644 engines/lab/labfile.cpp diff --git a/engines/lab/anim.cpp b/engines/lab/anim.cpp index 5ecfa72402..f7770ade7b 100644 --- a/engines/lab/anim.cpp +++ b/engines/lab/anim.cpp @@ -414,6 +414,11 @@ void Anim::unDiff(byte *newBuf, byte *oldBuf, byte *diffData, uint16 bytesPerRow unDIFFMemory(newBuf, diffData, 1, bufType + 1); } +void Anim::readBlock(void *Buffer, uint32 Size, byte **File) { + memcpy(Buffer, *File, (size_t)Size); + (*File) += Size; +} + void Anim::diffNextFrame() { if (_header == 65535) /* Already done. */ return; diff --git a/engines/lab/anim.h b/engines/lab/anim.h index 170e84d14b..6c4c8bed60 100644 --- a/engines/lab/anim.h +++ b/engines/lab/anim.h @@ -93,6 +93,7 @@ private: void VUnDIFFByteByte(byte *Dest, byte *diff, uint16 bytesperrow); void VUnDIFFByteWord(uint16 *Dest, uint16 *diff, uint16 bytesperrow); void VUnDIFFByteLong(uint32 *Dest, uint32 *diff, uint16 bytesperrow); + void readBlock(void *Buffer, uint32 Size, byte **File); public: Anim(LabEngine *vm); diff --git a/engines/lab/labfile.cpp b/engines/lab/labfile.cpp deleted file mode 100644 index 579316c07c..0000000000 --- a/engines/lab/labfile.cpp +++ /dev/null @@ -1,88 +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. - * - */ - -/* - * This code is based on Labyrinth of Time code with assistance of - * - * Copyright (c) 1993 Terra Nova Development - * Copyright (c) 2004 The Wyrmkeep Entertainment Co. - * - */ - -#include "lab/lab.h" -#include "lab/labfun.h" -#include "common/file.h" - -namespace Lab { - - -/*****************************************************************************/ -/* Reads a block of memory. */ -/*****************************************************************************/ -void readBlock(void *Buffer, uint32 Size, byte **File) { - memcpy(Buffer, *File, (size_t) Size); - (*File) += Size; -} - -static char NewFileName[255]; - -/*****************************************************************************/ -/* Modifies the filename so that paths and stuff are correct. Should mostly */ -/* deal with assigns and the '/' instead of '\' on IBM systems. */ -/* */ -/* NOTE: Make a *copy* of the string, and modify that. It would be a real */ -/* *bad* idea to modify the original. Since Labyrinth only focuses its */ -/* attention to one file at a time, it would be fine to have one variable */ -/* not on the stack which is used to store the new filename. */ -/*****************************************************************************/ -char *translateFileName(const char *filename) { - Common::String fileNameStr = filename; - fileNameStr.toUppercase(); - Common::String fileNameStrFinal; - - if (fileNameStr.hasPrefix("P:")) { - if (g_lab->_isHiRes) - fileNameStrFinal = "GAME/SPICT/"; - else - fileNameStrFinal = "GAME/PICT/"; - } else if (fileNameStr.hasPrefix("LAB:")) - fileNameStrFinal = "GAME/"; - else if (fileNameStr.hasPrefix("MUSIC:")) - fileNameStrFinal = "GAME/MUSIC/"; - - if (fileNameStr.contains(':')) { - while (fileNameStr[0] != ':') { - fileNameStr.deleteChar(0); - } - - fileNameStr.deleteChar(0); - } - - fileNameStrFinal += fileNameStr; - - strcpy(NewFileName, fileNameStrFinal.c_str()); - - return NewFileName; -} - - -} // End of namespace Lab diff --git a/engines/lab/labfun.h b/engines/lab/labfun.h index 8d7c60930f..67200a8498 100644 --- a/engines/lab/labfun.h +++ b/engines/lab/labfun.h @@ -115,12 +115,6 @@ public: uint16 *_array; }; -/*---------------------------*/ -/*----- From Machine.c ------*/ -/*---------------------------*/ - -char *translateFileName(const char *filename); - /*---------------------------*/ /*-------- From Map.c -------*/ /*---------------------------*/ diff --git a/engines/lab/module.mk b/engines/lab/module.mk index 18bb7e6916..5b8ac1aefd 100644 --- a/engines/lab/module.mk +++ b/engines/lab/module.mk @@ -10,7 +10,6 @@ MODULE_OBJS := \ interface.o \ intro.o \ lab.o \ - labfile.o \ labsets.o \ map.o \ music.o \ diff --git a/engines/lab/resource.cpp b/engines/lab/resource.cpp index 5be7aedea5..5b4c0c101e 100644 --- a/engines/lab/resource.cpp +++ b/engines/lab/resource.cpp @@ -43,21 +43,16 @@ Resource::Resource(LabEngine *vm) : _vm(vm) { } void Resource::readStaticText() { - Common::File labTextFile; - labTextFile.open(translateFileName("Lab:Rooms/LabText")); - if (!labTextFile.isOpen()) - error("Unable to open file %s (Lab:Rooms/LabText)", translateFileName("Lab:Rooms/LabText")); + Common::File *labTextFile = openDataFile("Lab:Rooms/LabText"); for (int i = 0; i < 48; i++) - _staticText[i] = labTextFile.readLine(); + _staticText[i] = labTextFile->readLine(); - labTextFile.close(); + delete labTextFile; } TextFont *Resource::getFont(const char *fileName) { - Common::File *dataFile; - if (!(dataFile = openDataFile(fileName, MKTAG('V', 'G', 'A', 'F')))) - error("getFont: couldn't open %s (%s)", translateFileName(fileName), fileName); + Common::File *dataFile = openDataFile(fileName, MKTAG('V', 'G', 'A', 'F')); uint32 headerSize = 4L + 2L + 256 * 3 + 4L; uint32 fileSize = dataFile->size(); @@ -79,10 +74,7 @@ TextFont *Resource::getFont(const char *fileName) { } char *Resource::getText(const char *fileName) { - Common::File *dataFile = new Common::File(); - dataFile->open(translateFileName(fileName)); - if (!dataFile->isOpen()) - error("getText: couldn't open %s (%s)", translateFileName(fileName), fileName); + Common::File *dataFile = openDataFile(fileName); g_lab->_music->updateMusic(); @@ -94,6 +86,7 @@ char *Resource::getText(const char *fileName) { while (text && *text != '\0') *text++ -= (byte)95; + delete dataFile; return (char *)buffer; } @@ -166,6 +159,34 @@ bool Resource::readViews(uint16 roomNum) { return true; } +Common::String Resource::translateFileName(Common::String filename) { + filename.toUppercase(); + Common::String fileNameStrFinal; + + if (filename.hasPrefix("P:")) { + if (g_lab->_isHiRes) + fileNameStrFinal = "GAME/SPICT/"; + else + fileNameStrFinal = "GAME/PICT/"; + } + else if (filename.hasPrefix("LAB:")) + fileNameStrFinal = "GAME/"; + else if (filename.hasPrefix("MUSIC:")) + fileNameStrFinal = "GAME/MUSIC/"; + + if (filename.contains(':')) { + while (filename[0] != ':') { + filename.deleteChar(0); + } + + filename.deleteChar(0); + } + + fileNameStrFinal += filename; + + return fileNameStrFinal; +} + Common::File *Resource::openDataFile(const char *fileName, uint32 fileHeader) { Common::File *dataFile = new Common::File(); dataFile->open(translateFileName(fileName)); diff --git a/engines/lab/resource.h b/engines/lab/resource.h index 2c7f9b75eb..99996a1475 100644 --- a/engines/lab/resource.h +++ b/engines/lab/resource.h @@ -115,6 +115,7 @@ private: CloseData *readCloseUps(uint16 depth, Common::File *file); ViewData *readView(Common::File *file); void readStaticText(); + Common::String translateFileName(Common::String filename); Common::String _staticText[48]; }; -- cgit v1.2.3 From 3ac02c1196875ff28e4aa9d2804bef811f8decb6 Mon Sep 17 00:00:00 2001 From: Filippos Karapetis Date: Fri, 4 Dec 2015 22:06:47 +0200 Subject: LAB: Simplify file handling code --- engines/lab/labsets.cpp | 16 ++++++---------- engines/lab/map.cpp | 2 -- engines/lab/music.cpp | 24 ++++++------------------ engines/lab/resource.cpp | 26 ++++++++++---------------- 4 files changed, 22 insertions(+), 46 deletions(-) diff --git a/engines/lab/labsets.cpp b/engines/lab/labsets.cpp index 21c495d246..259858763e 100644 --- a/engines/lab/labsets.cpp +++ b/engines/lab/labsets.cpp @@ -58,19 +58,15 @@ void LargeSet::exclElement(uint16 element) { } bool LargeSet::readInitialConditions(const char *fileName) { - Common::File *file; + Common::File *file = _vm->_resource->openDataFile(fileName, MKTAG('C', 'O', 'N', '0')); - if ((file = _vm->_resource->openDataFile(fileName, MKTAG('C', 'O', 'N', '0')))) { - uint16 conditions = file->readUint16LE(); - for (int i = 0; i < conditions; i++) { - inclElement(file->readUint16LE()); - } - - delete file; - return true; + uint16 conditions = file->readUint16LE(); + for (int i = 0; i < conditions; i++) { + inclElement(file->readUint16LE()); } - return false; + delete file; + return true; } diff --git a/engines/lab/map.cpp b/engines/lab/map.cpp index f5746baa42..36591d759b 100644 --- a/engines/lab/map.cpp +++ b/engines/lab/map.cpp @@ -171,8 +171,6 @@ static bool loadMapData() { } Common::File *mapFile = g_lab->_resource->openDataFile("Lab:Maps", MKTAG('M', 'A', 'P', '0')); - if (!mapFile) - error("Corrupt map file"); g_lab->_music->updateMusic(); if (!g_lab->_music->_doNotFilestopSoundEffect) g_lab->_music->stopSoundEffect(); diff --git a/engines/lab/music.cpp b/engines/lab/music.cpp index b6b00cb23c..0f42064a5c 100644 --- a/engines/lab/music.cpp +++ b/engines/lab/music.cpp @@ -176,14 +176,8 @@ bool Music::initMusic() { filename = "Music:BackGrou"; _file = g_lab->_resource->openDataFile(filename); - - if (_file) { - startMusic(true); - return true; - } - - _musicOn = false; - return false; + startMusic(true); + return true; } /*****************************************************************************/ @@ -278,16 +272,10 @@ void Music::changeMusic(const char *newmusic) { } _file = g_lab->_resource->openDataFile(newmusic); - - if (_file) { - _musicOn = true; /* turn it off */ - setMusic(false); - _musicOn = false; /* turn it back on */ - setMusic(true); - } else { - _file = _tFile; - _tFile = 0; - } + _musicOn = true; /* turn it off */ + setMusic(false); + _musicOn = false; /* turn it back on */ + setMusic(true); } /*****************************************************************************/ diff --git a/engines/lab/resource.cpp b/engines/lab/resource.cpp index 5b4c0c101e..aaac1cd261 100644 --- a/engines/lab/resource.cpp +++ b/engines/lab/resource.cpp @@ -34,7 +34,6 @@ namespace Lab { -static uint16 allocroom; extern RoomData *_rooms; extern uint16 NumInv, ManyRooms, HighestCondition; @@ -91,9 +90,7 @@ char *Resource::getText(const char *fileName) { } bool Resource::readRoomData(const char *fileName) { - Common::File *dataFile; - if (!(dataFile = openDataFile(fileName, MKTAG('D', 'O', 'R', '1')))) - return false; + Common::File *dataFile = openDataFile(fileName, MKTAG('D', 'O', 'R', '1')); ManyRooms = dataFile->readUint16LE(); HighestCondition = dataFile->readUint16LE(); @@ -120,9 +117,7 @@ bool Resource::readRoomData(const char *fileName) { } InventoryData *Resource::readInventory(const char *fileName) { - Common::File *dataFile; - if (!(dataFile = openDataFile(fileName, MKTAG('I', 'N', 'V', '1')))) - return nullptr; + Common::File *dataFile = openDataFile(fileName, MKTAG('I', 'N', 'V', '1')); NumInv = dataFile->readUint16LE(); InventoryData *inventory = (InventoryData *)malloc((NumInv + 1) * sizeof(InventoryData)); @@ -140,11 +135,7 @@ InventoryData *Resource::readInventory(const char *fileName) { bool Resource::readViews(uint16 roomNum) { Common::String fileName = "LAB:Rooms/" + Common::String::format("%d", roomNum); - Common::File *dataFile; - if (!(dataFile = openDataFile(fileName.c_str(), MKTAG('R', 'O', 'M', '4')))) - return false; - - allocroom = roomNum; + Common::File *dataFile = openDataFile(fileName.c_str(), MKTAG('R', 'O', 'M', '4')); _rooms[roomNum]._roomMsg = readString(dataFile); _rooms[roomNum]._view[NORTH] = readView(dataFile); @@ -191,11 +182,14 @@ Common::File *Resource::openDataFile(const char *fileName, uint32 fileHeader) { Common::File *dataFile = new Common::File(); dataFile->open(translateFileName(fileName)); if (!dataFile->isOpen()) - error("openDataFile couldn't open %s (%s)", translateFileName(fileName), fileName); + error("openDataFile: Couldn't open %s (%s)", translateFileName(fileName), fileName); - if (fileHeader > 0 && dataFile->readUint32BE() != fileHeader) { - dataFile->close(); - return nullptr; + if (fileHeader > 0) { + uint32 headerTag = dataFile->readUint32BE(); + if (headerTag != fileHeader) { + dataFile->close(); + error("openDataFile: Unexpected header in %s (%s) - expected: %d, got: %d", translateFileName(fileName), fileName, fileHeader, headerTag); + } } return dataFile; -- cgit v1.2.3 From 6eb9c084bed4108b729568d0cdbac66d2a5d9172 Mon Sep 17 00:00:00 2001 From: Filippos Karapetis Date: Fri, 4 Dec 2015 22:10:07 +0200 Subject: LAB: Remove dead code --- engines/lab/engine.cpp | 14 +++----------- 1 file changed, 3 insertions(+), 11 deletions(-) diff --git a/engines/lab/engine.cpp b/engines/lab/engine.cpp index fa12324264..b4b20e7e4d 100644 --- a/engines/lab/engine.cpp +++ b/engines/lab/engine.cpp @@ -1053,8 +1053,6 @@ bool LabEngine::from_crumbs(uint32 tmpClass, uint16 code, uint16 Qualifier, Comm } void LabEngine::go() { - bool doIntro = true; - _isHiRes = ((getFeatures() & GF_LOWRES) == 0); if (!_graphics->setUpScreens()) { @@ -1066,19 +1064,13 @@ void LabEngine::go() { initRoomBuffer(); - if (!doIntro) - _music->initMusic(); - _msgFont = _resource->getFont("P:AvanteG.12"); _event->mouseHide(); - if (doIntro) { - Intro *intro = new Intro(this); - intro->introSequence(); - delete intro; - } else - _anim->_doBlack = true; + Intro *intro = new Intro(this); + intro->introSequence(); + delete intro; _event->mouseShow(); mainGameLoop(); -- cgit v1.2.3 From dddd07cc8754117811c296d9b0c384306e70baa0 Mon Sep 17 00:00:00 2001 From: Filippos Karapetis Date: Fri, 4 Dec 2015 22:28:38 +0200 Subject: LAB: Remove unused code --- engines/lab/engine.cpp | 37 ------------------------------------- engines/lab/parsefun.h | 6 ------ 2 files changed, 43 deletions(-) diff --git a/engines/lab/engine.cpp b/engines/lab/engine.cpp index b4b20e7e4d..b6e6f7282b 100644 --- a/engines/lab/engine.cpp +++ b/engines/lab/engine.cpp @@ -49,8 +49,6 @@ extern uint16 NumInv, ManyRooms, HighestCondition, Direction; bool ispal = false, noupdatediff = false, MainDisplay = true, QuitLab = false; -#define BUFFERSIZE 850000L - /* LAB: Labyrinth specific code for the special puzzles */ #define SPECIALLOCK 100 #define SPECIALBRICK 101 @@ -1062,8 +1060,6 @@ void LabEngine::go() { _event->initMouse(); - initRoomBuffer(); - _msgFont = _resource->getFont("P:AvanteG.12"); _event->mouseHide(); @@ -1097,7 +1093,6 @@ void LabEngine::go() { closeFont(_msgFont); - freeRoomBuffer(); _graphics->freePict(); freeScreens(); @@ -1200,36 +1195,4 @@ void LabEngine::mayShowCrumbIndicatorOff() { } } -/* Have to make sure that ROOMBUFFERSIZE is bigger than the biggest piece of memory - that we need */ -#define ROOMBUFFERSIZE (2 * 20480L) - -static void *_roomBuffer = nullptr; -static uint16 _curMarker = 0; -static void *_memPlace = nullptr; - -/*****************************************************************************/ -/* Allocates the memory for the room buffers. */ -/*****************************************************************************/ -bool initRoomBuffer() { - _curMarker = 0; - - if ((_roomBuffer = calloc(ROOMBUFFERSIZE, 1))) { - _memPlace = _roomBuffer; - - return true; - } else - return false; -} - -/*****************************************************************************/ -/* Frees the memory for the room buffers. */ -/*****************************************************************************/ -void freeRoomBuffer() { - if (_roomBuffer) { - free(_roomBuffer); - _roomBuffer = nullptr; - } -} - } // End of namespace Lab diff --git a/engines/lab/parsefun.h b/engines/lab/parsefun.h index ad8f04b0e9..7f8895176b 100644 --- a/engines/lab/parsefun.h +++ b/engines/lab/parsefun.h @@ -40,12 +40,6 @@ namespace Lab { bool parse(const char *inputFile); - -/* From allocRoom.c */ - -bool initRoomBuffer(); -void freeRoomBuffer(); - /* From ProcessRoom.c */ ViewData *getViewData(uint16 roomNum, uint16 direction); -- cgit v1.2.3 From 6f3644f377cb298cb82d7a9235b9aec4cfa875ea Mon Sep 17 00:00:00 2001 From: Filippos Karapetis Date: Fri, 4 Dec 2015 22:52:55 +0200 Subject: LAB: Fix a regression in roomCoords() --- engines/lab/map.cpp | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/engines/lab/map.cpp b/engines/lab/map.cpp index 36591d759b..4df01eae36 100644 --- a/engines/lab/map.cpp +++ b/engines/lab/map.cpp @@ -253,12 +253,20 @@ static void roomCoords(uint16 CurRoom, uint16 *x1, uint16 *y1, uint16 *x2, uint1 case HCORRIDOR: curRoomImg = HRoom; break; + default: + // Some rooms (like the map) do not have an image + break; } *x1 = mapScaleX(Maps[CurRoom].x); *y1 = mapScaleY(Maps[CurRoom].y); - *x2 = *x1 + curRoomImg->_width; - *y2 = *y1 + curRoomImg->_height; + *x2 = *x1; + *y2 = *y1; + + if (curRoomImg) { + *x2 += curRoomImg->_width; + *y2 += curRoomImg->_height; + } } /*****************************************************************************/ -- cgit v1.2.3 From ea6d4579e284e10778c1703ff6a1638505697cea Mon Sep 17 00:00:00 2001 From: Filippos Karapetis Date: Fri, 4 Dec 2015 22:53:31 +0200 Subject: LAB: Merge all of the different image drawing functions --- engines/lab/graphics.cpp | 6 +-- engines/lab/image.cpp | 118 ++++++++++++++++++----------------------------- engines/lab/image.h | 2 +- engines/lab/lab.cpp | 2 +- engines/lab/special.cpp | 6 +-- 5 files changed, 53 insertions(+), 81 deletions(-) diff --git a/engines/lab/graphics.cpp b/engines/lab/graphics.cpp index 614b74431b..88b53ce3b5 100644 --- a/engines/lab/graphics.cpp +++ b/engines/lab/graphics.cpp @@ -706,7 +706,7 @@ void DisplayMan::doTransWipe(CloseDataPtr *cPtr, char *filename) { imDest._imageData = _vm->getCurrentDrawingBuffer(); - imSource.bltBitMap(0, curY, &imDest, 0, curY, _vm->_screenWidth, 2); + imSource.blitBitmap(0, curY, &imDest, 0, curY, _vm->_screenWidth, 2, false); _vm->overlayRect(0, 0, curY, _vm->_screenWidth - 1, curY + 1); curY += 4; linesdone++; @@ -726,9 +726,9 @@ void DisplayMan::doTransWipe(CloseDataPtr *cPtr, char *filename) { imDest._imageData = _vm->getCurrentDrawingBuffer(); if (curY == lastY) - imSource.bltBitMap(0, curY, &imDest, 0, curY, _vm->_screenWidth, 1); + imSource.blitBitmap(0, curY, &imDest, 0, curY, _vm->_screenWidth, 1, false); else - imSource.bltBitMap(0, curY, &imDest, 0, curY, _vm->_screenWidth, 2); + imSource.blitBitmap(0, curY, &imDest, 0, curY, _vm->_screenWidth, 2, false); curY += 4; linesdone++; diff --git a/engines/lab/image.cpp b/engines/lab/image.cpp index 1d8b9d61f5..45377aceda 100644 --- a/engines/lab/image.cpp +++ b/engines/lab/image.cpp @@ -50,26 +50,48 @@ Image::Image(Common::File *s) { } /*****************************************************************************/ -/* Draws an image to the screen. */ +/* Blits a piece of one image to another. */ /*****************************************************************************/ -void Image::drawImage(uint16 x, uint16 y) { - int w = _width; - int h = _height; +void Image::blitBitmap(uint16 xs, uint16 ys, Image *imDest, + uint16 xd, uint16 yd, uint16 width, uint16 height, byte masked) { + int w = width; + int h = height; + int destWidth = (imDest) ? imDest->_width : g_lab->_screenWidth; + int destHeight = (imDest) ? imDest->_height : g_lab->_screenHeight; + byte *destBuffer = (imDest) ? imDest->_imageData : g_lab->getCurrentDrawingBuffer(); - if (x + w > g_lab->_screenWidth) - w = g_lab->_screenWidth - x; + if (xd + w > destWidth) + w = destWidth - xd; - if (y + h > g_lab->_screenHeight) - h = g_lab->_screenHeight - y; + if (yd + h > destHeight) + h = destHeight - yd; - if ((w > 0) && (h > 0)) { - byte *s = _imageData; - byte *d = g_lab->getCurrentDrawingBuffer() + y * g_lab->_screenWidth + x; + if (w > 0 && h > 0) { + byte *s = _imageData + ys * _width + xs; + byte *d = destBuffer + yd * destWidth + xd; - while (h-- > 0) { - memcpy(d, s, w); - s += _width; - d += g_lab->_screenWidth; + if (!masked) { + while (h-- > 0) { + memcpy(d, s, w); + s += _width; + d += destWidth; + } + } else { + while (h-- > 0) { + byte *ss = s; + byte *dd = d; + int ww = w; + + while (ww-- > 0) { + byte c = *ss++; + + if (c) *dd++ = c - 1; + else dd++; + } + + s += _width; + d += destWidth; + } } } } @@ -77,36 +99,15 @@ void Image::drawImage(uint16 x, uint16 y) { /*****************************************************************************/ /* Draws an image to the screen. */ /*****************************************************************************/ -void Image::drawMaskImage(uint16 x, uint16 y) { - int w = _width; - int h = _height; - - if (x + w > g_lab->_screenWidth) - w = g_lab->_screenWidth - x; - - if (y + h > g_lab->_screenHeight) - h = g_lab->_screenHeight - y; - - if ((w > 0) && (h > 0)) { - byte *s = _imageData; - byte *d = g_lab->getCurrentDrawingBuffer() + y * g_lab->_screenWidth + x; - - while (h-- > 0) { - byte *ss = s; - byte *dd = d; - int ww = w; - - while (ww-- > 0) { - byte c = *ss++; - - if (c) *dd++ = c - 1; - else dd++; - } +void Image::drawImage(uint16 x, uint16 y) { + blitBitmap(0, 0, NULL, x, y, _width, _height, false); +} - s += _width; - d += g_lab->_screenWidth; - } - } +/*****************************************************************************/ +/* Draws an image to the screen with transparency. */ +/*****************************************************************************/ +void Image::drawMaskImage(uint16 x, uint16 y) { + blitBitmap(0, 0, NULL, x, y, _width, _height, true); } /*****************************************************************************/ @@ -134,33 +135,4 @@ void Image::readScreenImage(uint16 x, uint16 y) { } } -/*****************************************************************************/ -/* Blits a piece of one image to another. */ -/* NOTE: for our purposes, assumes that ImDest is to be in VGA memory. */ -/*****************************************************************************/ -void Image::bltBitMap(uint16 xs, uint16 ys, Image *imDest, - uint16 xd, uint16 yd, uint16 width, uint16 height) { - // I think the old code assumed that the source image data was valid for the given box. - // I will proceed on that assumption. - int w = width; - int h = height; - - if (xd + w > imDest->_width) - w = imDest->_width - xd; - - if (yd + h > imDest->_height) - h = imDest->_height - yd; - - if (w > 0 && h > 0) { - byte *s = _imageData + ys * _width + xs; - byte *d = imDest->_imageData + yd * imDest->_width + xd; - - while (h-- > 0) { - memcpy(d, s, w); - s += _width; - d += imDest->_width; - } - } -} - } // End of namespace Lab diff --git a/engines/lab/image.h b/engines/lab/image.h index 8f4d0f844f..f443f4c1c3 100644 --- a/engines/lab/image.h +++ b/engines/lab/image.h @@ -46,7 +46,7 @@ public: void drawImage(uint16 x, uint16 y); void drawMaskImage(uint16 x, uint16 y); void readScreenImage(uint16 x, uint16 y); - void bltBitMap(uint16 xs, uint16 ys, Image *ImDest, uint16 xd, uint16 yd, uint16 width, uint16 height); + void blitBitmap(uint16 xs, uint16 ys, Image *ImDest, uint16 xd, uint16 yd, uint16 width, uint16 height, byte masked); }; diff --git a/engines/lab/lab.cpp b/engines/lab/lab.cpp index 4a14ba63d0..2cd237c99d 100644 --- a/engines/lab/lab.cpp +++ b/engines/lab/lab.cpp @@ -482,7 +482,7 @@ void LabEngine::changeCombination(uint16 number) { scrollDisplayY(2, _graphics->VGAScaleX(COMBINATION_X[number]), _graphics->VGAScaleY(65), _graphics->VGAScaleX(COMBINATION_X[number]) + (Images[combnum])->_width - 1, _graphics->VGAScaleY(65) + (Images[combnum])->_height); - Images[combnum]->bltBitMap(0, (Images[combnum])->_height - (2 * i), &(display), _graphics->VGAScaleX(COMBINATION_X[number]), _graphics->VGAScaleY(65), (Images[combnum])->_width, 2); + Images[combnum]->blitBitmap(0, (Images[combnum])->_height - (2 * i), &(display), _graphics->VGAScaleX(COMBINATION_X[number]), _graphics->VGAScaleY(65), (Images[combnum])->_width, 2, false); } for (uint16 i = 0; i < 6; i++) diff --git a/engines/lab/special.cpp b/engines/lab/special.cpp index 855093edec..69a8aaedaf 100644 --- a/engines/lab/special.cpp +++ b/engines/lab/special.cpp @@ -273,14 +273,14 @@ static void turnPage(bool FromLeft) { g_lab->_music->updateMusic(); g_lab->waitTOF(); ScreenImage._imageData = g_lab->getCurrentDrawingBuffer(); - JBackImage.bltBitMap(i, 0, &ScreenImage, i, 0, 8, g_lab->_screenHeight); + JBackImage.blitBitmap(i, 0, &ScreenImage, i, 0, 8, g_lab->_screenHeight, false); } } else { for (int i = (g_lab->_screenWidth - 8); i > 0; i -= 8) { g_lab->_music->updateMusic(); g_lab->waitTOF(); ScreenImage._imageData = g_lab->getCurrentDrawingBuffer(); - JBackImage.bltBitMap(i, 0, &ScreenImage, i, 0, 8, g_lab->_screenHeight); + JBackImage.blitBitmap(i, 0, &ScreenImage, i, 0, 8, g_lab->_screenHeight, false); } } } @@ -302,7 +302,7 @@ void LabEngine::drawJournal(uint16 wipenum, bool needFade) { ScreenImage._imageData = getCurrentDrawingBuffer(); if (wipenum == 0) - JBackImage.bltBitMap(0, 0, &ScreenImage, 0, 0, _screenWidth, _screenHeight); + JBackImage.blitBitmap(0, 0, &ScreenImage, 0, 0, _screenWidth, _screenHeight, false); else turnPage((bool)(wipenum == 1)); -- cgit v1.2.3 From c42973604cbfa3a1c27c624a0b7caae8e70ec3c2 Mon Sep 17 00:00:00 2001 From: Filippos Karapetis Date: Fri, 4 Dec 2015 23:04:48 +0200 Subject: LAB: Split the tile puzzle related functions into a separate file --- engines/lab/lab.cpp | 350 +--------------------------------------- engines/lab/lab.h | 1 + engines/lab/module.mk | 1 + engines/lab/tilepuzzle.cpp | 388 +++++++++++++++++++++++++++++++++++++++++++++ 4 files changed, 391 insertions(+), 349 deletions(-) create mode 100644 engines/lab/tilepuzzle.cpp diff --git a/engines/lab/lab.cpp b/engines/lab/lab.cpp index 2cd237c99d..acd1ea963d 100644 --- a/engines/lab/lab.cpp +++ b/engines/lab/lab.cpp @@ -51,22 +51,6 @@ namespace Lab { LabEngine *g_lab; -const uint16 INIT_TILE[4][4] = { - { 1, 5, 9, 13 }, - { 2, 6, 10, 14 }, - { 3, 7, 11, 15 }, - { 4, 8, 12, 0 } -}; - -const uint16 SOLUTION[4][4] = { - { 7, 1, 8, 3 }, - { 2, 11, 15, 4 }, - { 9, 5, 14, 6 }, - { 10, 13, 12, 0 } -}; - -const int COMBINATION_X[6] = { 45, 83, 129, 166, 211, 248 }; - LabEngine::LabEngine(OSystem *syst, const ADGameDescription *gameDesc) : Engine(syst), _gameDescription(gameDesc), _extraGameFeatures(0) { g_lab = this; @@ -123,16 +107,7 @@ LabEngine::LabEngine(OSystem *syst, const ADGameDescription *gameDesc) _msgFont = 0; _inventory = 0; - for (int i = 0; i < 16; i++) - Tiles[i] = nullptr; - - for (int i= 0; i < 4; i++) { - for (int j = 0; j < 4; j++) - CurTile[i][j] = INIT_TILE[i][j]; - } - - for (int i = 0; i < 6; i++) - combination[i] = 0; + initTilePuzzle(); //const Common::FSNode gameDataDir(ConfMan.get("path")); //SearchMan.addSubDirectoryMatching(gameDataDir, "game"); @@ -210,327 +185,4 @@ Common::String LabEngine::generateSaveFileName(uint slot) { return Common::String::format("%s.%03u", _targetName.c_str(), slot); } -/*****************************************************************************/ -/* Converts SVGA cords to VGA if necessary, otherwise returns VGA cords. */ -/*****************************************************************************/ -int LabEngine::VGAUnScaleX(int x) { - if (_isHiRes) - return (x / 2); - else - return x; -} - -/*****************************************************************************/ -/* Converts SVGA cords to VGA if necessary, otherwise returns VGA cords. */ -/*****************************************************************************/ -int LabEngine::VGAUnScaleY(int y) { - if (_isHiRes) - return ((y * 5) / 12); - else - return y; -} - -/*****************************************************************************/ -/* Processes mouse clicks and changes the combination. */ -/*****************************************************************************/ -void LabEngine::mouseTile(Common::Point pos) { - int x = VGAUnScaleX(pos.x); - int y = VGAUnScaleY(pos.y); - - if ((x < 101) || (y < 26)) - return; - - x = (x - 101) / 30; - y = (y - 26) / 25; - - if ((x < 4) && (y < 4)) - changeTile(x, y); -} - -/*****************************************************************************/ -/* Changes the combination number of one of the slots */ -/*****************************************************************************/ -void LabEngine::changeTile(uint16 col, uint16 row) { - int16 scrolltype = -1; - - if (row > 0) { - if (CurTile[col] [row - 1] == 0) { - CurTile[col] [row - 1] = CurTile[col] [row]; - CurTile[col] [row] = 0; - scrolltype = DOWNSCROLL; - } - } - - if (col > 0) { - if (CurTile[col - 1] [row] == 0) { - CurTile[col - 1] [row] = CurTile[col] [row]; - CurTile[col] [row] = 0; - scrolltype = RIGHTSCROLL; - } - } - - if (row < 3) { - if (CurTile[col] [row + 1] == 0) { - CurTile[col] [row + 1] = CurTile[col] [row]; - CurTile[col] [row] = 0; - scrolltype = UPSCROLL; - } - } - - if (col < 3) { - if (CurTile[col + 1] [row] == 0) { - CurTile[col + 1] [row] = CurTile[col] [row]; - CurTile[col] [row] = 0; - scrolltype = LEFTSCROLL; - } - } - - if (scrolltype != -1) { - doTileScroll(col, row, scrolltype); - - if (getFeatures() & GF_WINDOWS_TRIAL) { - GUI::MessageDialog trialMessage("This puzzle is not available in the trial version of the game"); - trialMessage.runModal(); - return; - } - - bool check = true; - row = 0; - col = 0; - - while (row < 4) { - while (col < 4) { - check = check && (CurTile[row] [col] == SOLUTION[row] [col]); - col++; - } - - row++; - col = 0; - } - - if (check) { - _conditions->inclElement(BRICKOPEN); /* unlocked combination */ - _anim->_doBlack = true; - check = _graphics->readPict("p:Up/BDOpen", true); - } - } -} - -/*****************************************************************************/ -/* Processes mouse clicks and changes the combination. */ -/*****************************************************************************/ -void LabEngine::mouseCombination(Common::Point pos) { - uint16 number; - - int x = VGAUnScaleX(pos.x); - int y = VGAUnScaleY(pos.y); - - if ((y >= 63) && (y <= 99)) { - if ((x >= 44) && (x < 83)) - number = 0; - else if (x < 127) - number = 1; - else if (x < 165) - number = 2; - else if (x < 210) - number = 3; - else if (x < 245) - number = 4; - else if (x < 286) - number = 5; - else - return; - - changeCombination(number); - } -} - -/*****************************************************************************/ -/* Draws the images of the combination lock to the display bitmap. */ -/*****************************************************************************/ -void LabEngine::doTile(bool showsolution) { - uint16 row = 0, col = 0, rowm, colm, num; - int16 rows, cols; - - if (showsolution) { - rowm = _graphics->VGAScaleY(23); - colm = _graphics->VGAScaleX(27); - - rows = _graphics->VGAScaleY(31); - cols = _graphics->VGAScaleX(105); - } else { - _graphics->setAPen(0); - _graphics->rectFill(_graphics->VGAScaleX(97), _graphics->VGAScaleY(22), _graphics->VGAScaleX(220), _graphics->VGAScaleY(126)); - - rowm = _graphics->VGAScaleY(25); - colm = _graphics->VGAScaleX(30); - - rows = _graphics->VGAScaleY(25); - cols = _graphics->VGAScaleX(100); - } - - while (row < 4) { - while (col < 4) { - if (showsolution) - num = SOLUTION[col] [row]; - else - num = CurTile[col] [row]; - - if (showsolution || num) - Tiles[num]->drawImage(cols + (col * colm), rows + (row * rowm)); - - col++; - } - - row++; - col = 0; - } -} - -/*****************************************************************************/ -/* Reads in a backdrop picture. */ -/*****************************************************************************/ -void LabEngine::showTile(const char *filename, bool showsolution) { - uint16 start = showsolution ? 0 : 1; - - _anim->_doBlack = true; - _anim->_noPalChange = true; - _graphics->readPict(filename, true); - _anim->_noPalChange = false; - _graphics->blackScreen(); - - Common::File *tileFile = tileFile = _resource->openDataFile(showsolution ? "P:TileSolution" : "P:Tile"); - - for (uint16 curBit = start; curBit < 16; curBit++) - Tiles[curBit] = new Image(tileFile); - - delete tileFile; - - doTile(showsolution); - setPalette(_anim->_diffPalette, 256); -} - -/*****************************************************************************/ -/* Does the scrolling for the tiles on the tile puzzle. */ -/*****************************************************************************/ -void LabEngine::doTileScroll(uint16 col, uint16 row, uint16 scrolltype) { - int16 dX = 0, dY = 0, dx = 0, dy = 0, sx = 0, sy = 0; - uint16 last = 0, x1, y1; - - if (scrolltype == LEFTSCROLL) { - dX = _graphics->VGAScaleX(5); - sx = _graphics->VGAScaleX(5); - last = 6; - } else if (scrolltype == RIGHTSCROLL) { - dX = _graphics->VGAScaleX(-5); - dx = _graphics->VGAScaleX(-5); - sx = _graphics->VGAScaleX(5); - last = 6; - } else if (scrolltype == UPSCROLL) { - dY = _graphics->VGAScaleY(5); - sy = _graphics->VGAScaleY(5); - last = 5; - } else if (scrolltype == DOWNSCROLL) { - dY = _graphics->VGAScaleY(-5); - dy = _graphics->VGAScaleY(-5); - sy = _graphics->VGAScaleY(5); - last = 5; - } - - sx += _graphics->SVGACord(2); - - x1 = _graphics->VGAScaleX(100) + (col * _graphics->VGAScaleX(30)) + dx; - y1 = _graphics->VGAScaleY(25) + (row * _graphics->VGAScaleY(25)) + dy; - - for (uint16 i = 0; i < last; i++) { - waitTOF(); - scrollRaster(dX, dY, x1, y1, x1 + _graphics->VGAScaleX(28) + sx, y1 + _graphics->VGAScaleY(23) + sy); - x1 += dX; - y1 += dY; - } -} - -/*****************************************************************************/ -/* Changes the combination number of one of the slots */ -/*****************************************************************************/ -void LabEngine::changeCombination(uint16 number) { - static const int solution[6] = { 0, 4, 0, 8, 7, 2 }; - - Image display; - uint16 combnum; - bool unlocked = true; - - if (combination[number] < 9) - (combination[number])++; - else - combination[number] = 0; - - combnum = combination[number]; - - display._imageData = getCurrentDrawingBuffer(); - display._width = _screenWidth; - display._height = _screenHeight; - - for (uint16 i = 1; i <= (Images[combnum]->_height / 2); i++) { - if (_isHiRes) { - if (i & 1) - waitTOF(); - } else - waitTOF(); - - display._imageData = getCurrentDrawingBuffer(); - - scrollDisplayY(2, _graphics->VGAScaleX(COMBINATION_X[number]), _graphics->VGAScaleY(65), _graphics->VGAScaleX(COMBINATION_X[number]) + (Images[combnum])->_width - 1, _graphics->VGAScaleY(65) + (Images[combnum])->_height); - - Images[combnum]->blitBitmap(0, (Images[combnum])->_height - (2 * i), &(display), _graphics->VGAScaleX(COMBINATION_X[number]), _graphics->VGAScaleY(65), (Images[combnum])->_width, 2, false); - } - - for (uint16 i = 0; i < 6; i++) - unlocked = (combination[i] == solution[i]) && unlocked; - - if (unlocked) - _conditions->inclElement(COMBINATIONUNLOCKED); - else - _conditions->exclElement(COMBINATIONUNLOCKED); -} - -void LabEngine::scrollRaster(int16 dx, int16 dy, uint16 x1, uint16 y1, uint16 x2, uint16 y2) { - if (dx) - scrollDisplayX(dx, x1, y1, x2, y2); - - if (dy) - scrollDisplayY(dy, x1, y1, x2, y2); -} - -/*****************************************************************************/ -/* Draws the images of the combination lock to the display bitmap. */ -/*****************************************************************************/ -void LabEngine::doCombination() { - for (uint16 i = 0; i <= 5; i++) - Images[combination[i]]->drawImage(_graphics->VGAScaleX(COMBINATION_X[i]), _graphics->VGAScaleY(65)); -} - -/*****************************************************************************/ -/* Reads in a backdrop picture. */ -/*****************************************************************************/ -void LabEngine::showCombination(const char *filename) { - _anim->_doBlack = true; - _anim->_noPalChange = true; - _graphics->readPict(filename, true); - _anim->_noPalChange = false; - - _graphics->blackScreen(); - - Common::File *numFile = _resource->openDataFile("P:Numbers"); - - for (uint16 CurBit = 0; CurBit < 10; CurBit++) - Images[CurBit] = new Image(numFile); - - delete numFile; - - doCombination(); - - setPalette(_anim->_diffPalette, 256); -} - } // End of namespace Lab diff --git a/engines/lab/lab.h b/engines/lab/lab.h index b109ac61c1..01dcaa04b1 100644 --- a/engines/lab/lab.h +++ b/engines/lab/lab.h @@ -197,6 +197,7 @@ private: void scrollRaster(int16 dx, int16 dy, uint16 x1, uint16 y1, uint16 x2, uint16 y2); void doCombination(); void showCombination(const char *filename); + void initTilePuzzle(); bool saveRestoreGame(); diff --git a/engines/lab/module.mk b/engines/lab/module.mk index 5b8ac1aefd..434ba7d97a 100644 --- a/engines/lab/module.mk +++ b/engines/lab/module.mk @@ -18,6 +18,7 @@ MODULE_OBJS := \ savegame.o \ special.o \ text.o \ + tilepuzzle.o \ timing.o \ vga.o diff --git a/engines/lab/tilepuzzle.cpp b/engines/lab/tilepuzzle.cpp new file mode 100644 index 0000000000..a473b0eee8 --- /dev/null +++ b/engines/lab/tilepuzzle.cpp @@ -0,0 +1,388 @@ +/* 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. + * + */ + + /* + * This code is based on Labyrinth of Time code with assistance of + * + * Copyright (c) 1993 Terra Nova Development + * Copyright (c) 2004 The Wyrmkeep Entertainment Co. + * + */ + +#include "lab/lab.h" +#include "gui/message.h" + +namespace Lab { + +const uint16 INIT_TILE[4][4] = { + { 1, 5, 9, 13 }, + { 2, 6, 10, 14 }, + { 3, 7, 11, 15 }, + { 4, 8, 12, 0 } +}; + +const uint16 SOLUTION[4][4] = { + { 7, 1, 8, 3 }, + { 2, 11, 15, 4 }, + { 9, 5, 14, 6 }, + { 10, 13, 12, 0 } +}; + +const int COMBINATION_X[6] = { 45, 83, 129, 166, 211, 248 }; + +void LabEngine::initTilePuzzle() { + for (int i = 0; i < 16; i++) + Tiles[i] = nullptr; + + for (int i = 0; i < 4; i++) { + for (int j = 0; j < 4; j++) + CurTile[i][j] = INIT_TILE[i][j]; + } + + for (int i = 0; i < 6; i++) + combination[i] = 0; +} + +/*****************************************************************************/ +/* Converts SVGA cords to VGA if necessary, otherwise returns VGA cords. */ +/*****************************************************************************/ +int LabEngine::VGAUnScaleX(int x) { + if (_isHiRes) + return (x / 2); + else + return x; +} + +/*****************************************************************************/ +/* Converts SVGA cords to VGA if necessary, otherwise returns VGA cords. */ +/*****************************************************************************/ +int LabEngine::VGAUnScaleY(int y) { + if (_isHiRes) + return ((y * 5) / 12); + else + return y; +} + +/*****************************************************************************/ +/* Processes mouse clicks and changes the combination. */ +/*****************************************************************************/ +void LabEngine::mouseTile(Common::Point pos) { + int x = VGAUnScaleX(pos.x); + int y = VGAUnScaleY(pos.y); + + if ((x < 101) || (y < 26)) + return; + + x = (x - 101) / 30; + y = (y - 26) / 25; + + if ((x < 4) && (y < 4)) + changeTile(x, y); +} + +/*****************************************************************************/ +/* Changes the combination number of one of the slots */ +/*****************************************************************************/ +void LabEngine::changeTile(uint16 col, uint16 row) { + int16 scrolltype = -1; + + if (row > 0) { + if (CurTile[col] [row - 1] == 0) { + CurTile[col] [row - 1] = CurTile[col] [row]; + CurTile[col] [row] = 0; + scrolltype = DOWNSCROLL; + } + } + + if (col > 0) { + if (CurTile[col - 1] [row] == 0) { + CurTile[col - 1] [row] = CurTile[col] [row]; + CurTile[col] [row] = 0; + scrolltype = RIGHTSCROLL; + } + } + + if (row < 3) { + if (CurTile[col] [row + 1] == 0) { + CurTile[col] [row + 1] = CurTile[col] [row]; + CurTile[col] [row] = 0; + scrolltype = UPSCROLL; + } + } + + if (col < 3) { + if (CurTile[col + 1] [row] == 0) { + CurTile[col + 1] [row] = CurTile[col] [row]; + CurTile[col] [row] = 0; + scrolltype = LEFTSCROLL; + } + } + + if (scrolltype != -1) { + doTileScroll(col, row, scrolltype); + + if (getFeatures() & GF_WINDOWS_TRIAL) { + GUI::MessageDialog trialMessage("This puzzle is not available in the trial version of the game"); + trialMessage.runModal(); + return; + } + + bool check = true; + row = 0; + col = 0; + + while (row < 4) { + while (col < 4) { + check = check && (CurTile[row] [col] == SOLUTION[row] [col]); + col++; + } + + row++; + col = 0; + } + + if (check) { + _conditions->inclElement(BRICKOPEN); /* unlocked combination */ + _anim->_doBlack = true; + check = _graphics->readPict("p:Up/BDOpen", true); + } + } +} + +/*****************************************************************************/ +/* Processes mouse clicks and changes the combination. */ +/*****************************************************************************/ +void LabEngine::mouseCombination(Common::Point pos) { + uint16 number; + + int x = VGAUnScaleX(pos.x); + int y = VGAUnScaleY(pos.y); + + if ((y >= 63) && (y <= 99)) { + if ((x >= 44) && (x < 83)) + number = 0; + else if (x < 127) + number = 1; + else if (x < 165) + number = 2; + else if (x < 210) + number = 3; + else if (x < 245) + number = 4; + else if (x < 286) + number = 5; + else + return; + + changeCombination(number); + } +} + +/*****************************************************************************/ +/* Draws the images of the combination lock to the display bitmap. */ +/*****************************************************************************/ +void LabEngine::doTile(bool showsolution) { + uint16 row = 0, col = 0, rowm, colm, num; + int16 rows, cols; + + if (showsolution) { + rowm = _graphics->VGAScaleY(23); + colm = _graphics->VGAScaleX(27); + + rows = _graphics->VGAScaleY(31); + cols = _graphics->VGAScaleX(105); + } else { + _graphics->setAPen(0); + _graphics->rectFill(_graphics->VGAScaleX(97), _graphics->VGAScaleY(22), _graphics->VGAScaleX(220), _graphics->VGAScaleY(126)); + + rowm = _graphics->VGAScaleY(25); + colm = _graphics->VGAScaleX(30); + + rows = _graphics->VGAScaleY(25); + cols = _graphics->VGAScaleX(100); + } + + while (row < 4) { + while (col < 4) { + if (showsolution) + num = SOLUTION[col] [row]; + else + num = CurTile[col] [row]; + + if (showsolution || num) + Tiles[num]->drawImage(cols + (col * colm), rows + (row * rowm)); + + col++; + } + + row++; + col = 0; + } +} + +/*****************************************************************************/ +/* Reads in a backdrop picture. */ +/*****************************************************************************/ +void LabEngine::showTile(const char *filename, bool showsolution) { + uint16 start = showsolution ? 0 : 1; + + _anim->_doBlack = true; + _anim->_noPalChange = true; + _graphics->readPict(filename, true); + _anim->_noPalChange = false; + _graphics->blackScreen(); + + Common::File *tileFile = tileFile = _resource->openDataFile(showsolution ? "P:TileSolution" : "P:Tile"); + + for (uint16 curBit = start; curBit < 16; curBit++) + Tiles[curBit] = new Image(tileFile); + + delete tileFile; + + doTile(showsolution); + setPalette(_anim->_diffPalette, 256); +} + +/*****************************************************************************/ +/* Does the scrolling for the tiles on the tile puzzle. */ +/*****************************************************************************/ +void LabEngine::doTileScroll(uint16 col, uint16 row, uint16 scrolltype) { + int16 dX = 0, dY = 0, dx = 0, dy = 0, sx = 0, sy = 0; + uint16 last = 0, x1, y1; + + if (scrolltype == LEFTSCROLL) { + dX = _graphics->VGAScaleX(5); + sx = _graphics->VGAScaleX(5); + last = 6; + } else if (scrolltype == RIGHTSCROLL) { + dX = _graphics->VGAScaleX(-5); + dx = _graphics->VGAScaleX(-5); + sx = _graphics->VGAScaleX(5); + last = 6; + } else if (scrolltype == UPSCROLL) { + dY = _graphics->VGAScaleY(5); + sy = _graphics->VGAScaleY(5); + last = 5; + } else if (scrolltype == DOWNSCROLL) { + dY = _graphics->VGAScaleY(-5); + dy = _graphics->VGAScaleY(-5); + sy = _graphics->VGAScaleY(5); + last = 5; + } + + sx += _graphics->SVGACord(2); + + x1 = _graphics->VGAScaleX(100) + (col * _graphics->VGAScaleX(30)) + dx; + y1 = _graphics->VGAScaleY(25) + (row * _graphics->VGAScaleY(25)) + dy; + + for (uint16 i = 0; i < last; i++) { + waitTOF(); + scrollRaster(dX, dY, x1, y1, x1 + _graphics->VGAScaleX(28) + sx, y1 + _graphics->VGAScaleY(23) + sy); + x1 += dX; + y1 += dY; + } +} + +/*****************************************************************************/ +/* Changes the combination number of one of the slots */ +/*****************************************************************************/ +void LabEngine::changeCombination(uint16 number) { + static const int solution[6] = { 0, 4, 0, 8, 7, 2 }; + + Image display; + uint16 combnum; + bool unlocked = true; + + if (combination[number] < 9) + (combination[number])++; + else + combination[number] = 0; + + combnum = combination[number]; + + display._imageData = getCurrentDrawingBuffer(); + display._width = _screenWidth; + display._height = _screenHeight; + + for (uint16 i = 1; i <= (Images[combnum]->_height / 2); i++) { + if (_isHiRes) { + if (i & 1) + waitTOF(); + } else + waitTOF(); + + display._imageData = getCurrentDrawingBuffer(); + + scrollDisplayY(2, _graphics->VGAScaleX(COMBINATION_X[number]), _graphics->VGAScaleY(65), _graphics->VGAScaleX(COMBINATION_X[number]) + (Images[combnum])->_width - 1, _graphics->VGAScaleY(65) + (Images[combnum])->_height); + + Images[combnum]->blitBitmap(0, (Images[combnum])->_height - (2 * i), &(display), _graphics->VGAScaleX(COMBINATION_X[number]), _graphics->VGAScaleY(65), (Images[combnum])->_width, 2, false); + } + + for (uint16 i = 0; i < 6; i++) + unlocked = (combination[i] == solution[i]) && unlocked; + + if (unlocked) + _conditions->inclElement(COMBINATIONUNLOCKED); + else + _conditions->exclElement(COMBINATIONUNLOCKED); +} + +void LabEngine::scrollRaster(int16 dx, int16 dy, uint16 x1, uint16 y1, uint16 x2, uint16 y2) { + if (dx) + scrollDisplayX(dx, x1, y1, x2, y2); + + if (dy) + scrollDisplayY(dy, x1, y1, x2, y2); +} + +/*****************************************************************************/ +/* Draws the images of the combination lock to the display bitmap. */ +/*****************************************************************************/ +void LabEngine::doCombination() { + for (uint16 i = 0; i <= 5; i++) + Images[combination[i]]->drawImage(_graphics->VGAScaleX(COMBINATION_X[i]), _graphics->VGAScaleY(65)); +} + +/*****************************************************************************/ +/* Reads in a backdrop picture. */ +/*****************************************************************************/ +void LabEngine::showCombination(const char *filename) { + _anim->_doBlack = true; + _anim->_noPalChange = true; + _graphics->readPict(filename, true); + _anim->_noPalChange = false; + + _graphics->blackScreen(); + + Common::File *numFile = _resource->openDataFile("P:Numbers"); + + for (uint16 CurBit = 0; CurBit < 10; CurBit++) + Images[CurBit] = new Image(numFile); + + delete numFile; + + doCombination(); + + setPalette(_anim->_diffPalette, 256); +} + +} // End of namespace Lab -- cgit v1.2.3 From ab1d9771d28cd70659505b900a07574e70113735 Mon Sep 17 00:00:00 2001 From: Filippos Karapetis Date: Sat, 5 Dec 2015 18:14:50 +0200 Subject: LAB: Some cleanup of the monitor code --- engines/lab/special.cpp | 17 ++++------------- 1 file changed, 4 insertions(+), 13 deletions(-) diff --git a/engines/lab/special.cpp b/engines/lab/special.cpp index 69a8aaedaf..6c96d18213 100644 --- a/engines/lab/special.cpp +++ b/engines/lab/special.cpp @@ -59,8 +59,7 @@ static bool GotBackImage = false; static uint16 monitorPage; static const char *TextFileName; -Image *MonButton, *AltMonButton, *MonQuit, *AltMonQuit, *MonBack, *AltMonBack, -*MonDown, *AltMonDown, *MonUp, *AltMonUp; +Image *MonButton; extern uint16 *FadePalette; extern BitMap *DispBitMap, *DrawBitMap; @@ -450,16 +449,6 @@ bool LabEngine::saveRestoreGame() { return isOK; } -/*****************************************************************************/ -/* Makes sure that the buttons are in memory. */ -/*****************************************************************************/ -static void getMonImages() { - Common::File *buttonFile = g_lab->_resource->openDataFile("P:MonImage"); - MonButton = new Image(buttonFile); - delete buttonFile; -} - - /*****************************************************************************/ /* Draws the text for the monitor. */ /*****************************************************************************/ @@ -639,7 +628,9 @@ void LabEngine::doMonitor(char *background, char *textfile, bool isinteractive, FadePalette = hipal; TextFont *monitorFont = _resource->getFont("P:Map.fon"); - getMonImages(); + Common::File *buttonFile = g_lab->_resource->openDataFile("P:MonImage"); + MonButton = new Image(buttonFile); + delete buttonFile; ntext = _resource->getText(textfile); loadBackPict(background, false); -- cgit v1.2.3 From 525db01913605f899107bc115fcde418023e700f Mon Sep 17 00:00:00 2001 From: Filippos Karapetis Date: Sat, 5 Dec 2015 22:20:26 +0200 Subject: LAB: Simplify several calls to flowText() and rectFill() --- engines/lab/graphics.cpp | 21 +++++++++++++++++++-- engines/lab/graphics.h | 13 +++++++++++++ engines/lab/intro.cpp | 4 ++-- engines/lab/map.cpp | 8 ++++---- engines/lab/special.cpp | 6 +++--- engines/lab/tilepuzzle.cpp | 2 +- 6 files changed, 42 insertions(+), 12 deletions(-) diff --git a/engines/lab/graphics.cpp b/engines/lab/graphics.cpp index 88b53ce3b5..8aa5950f90 100644 --- a/engines/lab/graphics.cpp +++ b/engines/lab/graphics.cpp @@ -316,6 +316,19 @@ uint32 DisplayMan::flowText(void *font, /* the TextAttr pointer */ return (str - temp); } +uint32 DisplayMan::flowTextScaled(void *font, /* the TextAttr pointer */ + int16 spacing, /* How much vertical spacing between the lines */ + byte pencolor, /* pen number to use for text */ + byte backpen, /* the background color */ + bool fillback, /* Whether to fill the background */ + bool centerh, /* Whether to center the text horizontally */ + bool centerv, /* Whether to center the text vertically */ + bool output, /* Whether to output any text */ + uint16 x1, /* Cords */ + uint16 y1, uint16 x2, uint16 y2, const char *str) { + return flowText(font, spacing, pencolor, backpen, fillback, centerh, centerv, output, VGAScaleX(x1), VGAScaleY(y1), VGAScaleX(x2), VGAScaleY(y2), str); +} + /******************************************************************************/ /* Calls flowText, but flows it to memory. Same restrictions as flowText. */ /******************************************************************************/ @@ -347,7 +360,7 @@ uint32 DisplayMan::flowTextToMem(Image *destIm, void *font, /* the TextAttr void DisplayMan::createBox(uint16 y2) { setAPen(7); /* Message box area */ - rectFill(VGAScaleX(4), VGAScaleY(154), VGAScaleX(315), VGAScaleY(y2 - 2)); + rectFillScaled(4, 154, 315, y2 - 2); setAPen(0); /* Box around message area */ drawHLine(VGAScaleX(2), VGAScaleY(152), VGAScaleX(317)); @@ -375,7 +388,7 @@ int32 DisplayMan::longDrawMessage(const char *str) { createBox(198); _vm->_event->mouseShow(); - return flowText(_vm->_msgFont, 0, 1, 7, false, true, true, true, VGAScaleX(6), VGAScaleY(155), VGAScaleX(313), VGAScaleY(195), str); + return flowTextScaled(_vm->_msgFont, 0, 1, 7, false, true, true, true, 6, 155, 313, 195, str); } void LabEngine::drawStaticMessage(byte index) { @@ -977,6 +990,10 @@ void DisplayMan::rectFill(uint16 x1, uint16 y1, uint16 x2, uint16 y2) { } } +void DisplayMan::rectFillScaled(uint16 x1, uint16 y1, uint16 x2, uint16 y2) { + rectFill(VGAScaleX(x1), VGAScaleY(y1), VGAScaleX(x2), VGAScaleY(y2)); +} + /*****************************************************************************/ /* Draws a horizontal line. */ /*****************************************************************************/ diff --git a/engines/lab/graphics.h b/engines/lab/graphics.h index 63523cbf29..ba3e34c4e5 100644 --- a/engines/lab/graphics.h +++ b/engines/lab/graphics.h @@ -71,6 +71,7 @@ public: void drawMessage(const char *str); void setAPen(byte pennum); void rectFill(uint16 x1, uint16 y1, uint16 x2, uint16 y2); + void rectFillScaled(uint16 x1, uint16 y1, uint16 x2, uint16 y2); /* Window text stuff */ uint32 flowText(void *font, /* the TextAttr pointer */ int16 spacing, /* How much vertical spacing between the lines */ @@ -84,6 +85,18 @@ public: uint16 x2, uint16 y2, const char *text); /* The text itself */ + uint32 flowTextScaled(void *font, /* the TextAttr pointer */ + int16 spacing, /* How much vertical spacing between the lines */ + byte pencolor, /* pen number to use for text */ + byte backpen, /* the background color */ + bool fillback, /* Whether to fill the background */ + bool centerh, /* Whether to center the text horizontally */ + bool centerv, /* Whether to center the text vertically */ + bool output, /* Whether to output any text */ + uint16 x1, uint16 y1, /* Cords */ + uint16 x2, uint16 y2, + const char *text); /* The text itself */ + uint32 flowTextToMem(Image *destIm, void *font, /* the TextAttr pointer */ int16 spacing, /* How much vertical spacing between the lines */ diff --git a/engines/lab/intro.cpp b/engines/lab/intro.cpp index 52a46ebef7..47897a726f 100644 --- a/engines/lab/intro.cpp +++ b/engines/lab/intro.cpp @@ -105,9 +105,9 @@ void Intro::doPictText(const char *filename, TextFont *msgFont, bool isScreen) { if (isScreen) { _vm->_graphics->setAPen(7); - _vm->_graphics->rectFill(_vm->_graphics->VGAScaleX(10), _vm->_graphics->VGAScaleY(10), _vm->_graphics->VGAScaleX(310), _vm->_graphics->VGAScaleY(190)); + _vm->_graphics->rectFillScaled(10, 10, 310, 190); - Drawn = _vm->_graphics->flowText(msgFont, (!_vm->_isHiRes) * -1, 5, 7, false, false, true, true, _vm->_graphics->VGAScaleX(14), _vm->_graphics->VGAScaleY(11), _vm->_graphics->VGAScaleX(306), _vm->_graphics->VGAScaleY(189), (char *)curText); + Drawn = _vm->_graphics->flowTextScaled(msgFont, (!_vm->_isHiRes) * -1, 5, 7, false, false, true, true, 14, 11, 306, 189, (char *)curText); fade(true, 0); } else { Drawn = _vm->_graphics->longDrawMessage((char *)curText); diff --git a/engines/lab/map.cpp b/engines/lab/map.cpp index 4df01eae36..51295a874d 100644 --- a/engines/lab/map.cpp +++ b/engines/lab/map.cpp @@ -565,10 +565,10 @@ void LabEngine::drawMap(uint16 CurRoom, uint16 CurMsg, uint16 Floor, bool fadeou } if (sptr) - _graphics->flowText(_msgFont, 0, 5, 3, true, true, true, true, _graphics->VGAScaleX(14), _graphics->VGAScaleY(75), _graphics->VGAScaleX(134), _graphics->VGAScaleY(97), sptr); + _graphics->flowTextScaled(_msgFont, 0, 5, 3, true, true, true, true, 14, 75, 134, 97, sptr); if ((sptr = _rooms[CurMsg]._roomMsg)) - _graphics->flowText(_msgFont, 0, 5, 3, true, true, true, true, _graphics->VGAScaleX(14), _graphics->VGAScaleY(148), _graphics->VGAScaleX(134), _graphics->VGAScaleY(186), sptr); + _graphics->flowTextScaled(_msgFont, 0, 5, 3, true, true, true, true, 14, 148, 134, 186, sptr); if (fadein) fade(true, 0); @@ -722,8 +722,8 @@ void LabEngine::processMap(uint16 CurRoom) { if ((sptr = _rooms[CurMsg]._roomMsg)) { _event->mouseHide(); _graphics->setAPen(3); - _graphics->rectFill(_graphics->VGAScaleX(13), _graphics->VGAScaleY(148), _graphics->VGAScaleX(135), _graphics->VGAScaleY(186)); - _graphics->flowText(_msgFont, 0, 5, 3, true, true, true, true, _graphics->VGAScaleX(14), _graphics->VGAScaleY(148), _graphics->VGAScaleX(134), _graphics->VGAScaleY(186), sptr); + _graphics->rectFillScaled(13, 148, 135, 186); + _graphics->flowTextScaled(_msgFont, 0, 5, 3, true, true, true, true, 14, 148, 134, 186, sptr); if (Maps[OldMsg].PageNumber == CurFloor) drawRoom(OldMsg, (bool)(OldMsg == CurRoom)); diff --git a/engines/lab/special.cpp b/engines/lab/special.cpp index 6c96d18213..76f9c1576a 100644 --- a/engines/lab/special.cpp +++ b/engines/lab/special.cpp @@ -143,10 +143,10 @@ void doWestPaper() { paperFont = g_lab->_resource->getFont("P:Note.fon"); ntext = g_lab->_resource->getText("Lab:Rooms/Col1"); - CharsPrinted = g_lab->_graphics->flowText(paperFont, -4, 0, 0, false, false, false, true, g_lab->_graphics->VGAScaleX(45), g_lab->_graphics->VGAScaleY(y), g_lab->_graphics->VGAScaleX(158), g_lab->_graphics->VGAScaleY(148), ntext); + CharsPrinted = g_lab->_graphics->flowTextScaled(paperFont, -4, 0, 0, false, false, false, true, 45, y, 158, 148, ntext); delete[] ntext; ntext = g_lab->_resource->getText("Lab:Rooms/Col2"); - CharsPrinted = g_lab->_graphics->flowText(paperFont, -4, 0, 0, false, false, false, true, g_lab->_graphics->VGAScaleX(162), g_lab->_graphics->VGAScaleY(y), g_lab->_graphics->VGAScaleX(275), g_lab->_graphics->VGAScaleY(148), ntext); + CharsPrinted = g_lab->_graphics->flowTextScaled(paperFont, -4, 0, 0, false, false, false, true, 162, y, 275, 148, ntext); delete[] ntext; closeFont(paperFont); @@ -236,7 +236,7 @@ static void drawJournalText() { while (DrawingToPage < JPage) { g_lab->_music->updateMusic(); CurText = (char *)(journaltext + CharsDrawn); - CharsDrawn += g_lab->_graphics->flowText(journalFont, -2, 2, 0, false, false, false, false, g_lab->_graphics->VGAScaleX(52), g_lab->_graphics->VGAScaleY(32), g_lab->_graphics->VGAScaleX(152), g_lab->_graphics->VGAScaleY(148), CurText); + CharsDrawn += g_lab->_graphics->flowTextScaled(journalFont, -2, 2, 0, false, false, false, false, 52, 32, 152, 148, CurText); lastpage = (*CurText == 0); diff --git a/engines/lab/tilepuzzle.cpp b/engines/lab/tilepuzzle.cpp index a473b0eee8..137038fd75 100644 --- a/engines/lab/tilepuzzle.cpp +++ b/engines/lab/tilepuzzle.cpp @@ -212,7 +212,7 @@ void LabEngine::doTile(bool showsolution) { cols = _graphics->VGAScaleX(105); } else { _graphics->setAPen(0); - _graphics->rectFill(_graphics->VGAScaleX(97), _graphics->VGAScaleY(22), _graphics->VGAScaleX(220), _graphics->VGAScaleY(126)); + _graphics->rectFillScaled(97, 22, 220, 126); rowm = _graphics->VGAScaleY(25); colm = _graphics->VGAScaleX(30); -- cgit v1.2.3 From 61d89cb7448f747473cf6a0c474da1b322233fbe Mon Sep 17 00:00:00 2001 From: Filippos Karapetis Date: Sat, 5 Dec 2015 22:35:38 +0200 Subject: LAB: Small cleanup in drawMap() --- engines/lab/map.cpp | 31 +++---------------------------- 1 file changed, 3 insertions(+), 28 deletions(-) diff --git a/engines/lab/map.cpp b/engines/lab/map.cpp index 51295a874d..bef3dd1f4c 100644 --- a/engines/lab/map.cpp +++ b/engines/lab/map.cpp @@ -537,35 +537,10 @@ void LabEngine::drawMap(uint16 CurRoom, uint16 CurMsg, uint16 Floor, bool fadeou _graphics->flowText(_msgFont, 0, 7, 0, true, true, true, true, mapScaleX(360), 0, mapScaleX(660), mapScaleY(450), sptr); } - switch (Floor) { - case LOWERFLOOR: - sptr = (char *)_resource->getStaticText(kTextLowerFloor).c_str(); - break; - case MIDDLEFLOOR: - sptr = (char *)_resource->getStaticText(kTextMiddleFloor).c_str(); - break; - case UPPERFLOOR: - sptr = (char *)_resource->getStaticText(kTextUpperFloor).c_str(); - break; - case MEDMAZEFLOOR: - sptr = (char *)_resource->getStaticText(kTextMedMazeFloor).c_str(); - break; - case HEDGEMAZEFLOOR: - sptr = (char *)_resource->getStaticText(kTextHedgeMazeFloor).c_str(); - break; - case SURMAZEFLOOR: - sptr = (char *)_resource->getStaticText(kTextSurMazeFloor).c_str(); - break; - case CARNIVAL: - sptr = (char *)_resource->getStaticText(kTextCarnivalFloor).c_str(); - break; - default: - sptr = NULL; - break; - } - - if (sptr) + if (Floor >= LOWERFLOOR && Floor <= CARNIVAL) { + sptr = (char *)_resource->getStaticText(Floor - 1).c_str(); _graphics->flowTextScaled(_msgFont, 0, 5, 3, true, true, true, true, 14, 75, 134, 97, sptr); + } if ((sptr = _rooms[CurMsg]._roomMsg)) _graphics->flowTextScaled(_msgFont, 0, 5, 3, true, true, true, true, 14, 148, 134, 186, sptr); -- cgit v1.2.3 From d9d2383d93760da2267170e786987ba91da1fa08 Mon Sep 17 00:00:00 2001 From: Strangerke Date: Sun, 6 Dec 2015 00:18:24 +0100 Subject: LAB: Use the windows keyboard mapping for the other versions --- engines/lab/graphics.cpp | 110 +++++++++++++++++------------------------------ 1 file changed, 40 insertions(+), 70 deletions(-) diff --git a/engines/lab/graphics.cpp b/engines/lab/graphics.cpp index 8aa5950f90..3ed28d06f3 100644 --- a/engines/lab/graphics.cpp +++ b/engines/lab/graphics.cpp @@ -867,86 +867,56 @@ bool DisplayMan::setUpScreens() { /* Creates the gadgets for the movement control panel */ uint16 y = VGAScaleY(173) - SVGACord(2); - if (_vm->getPlatform() == Common::kPlatformWindows) { - _vm->_moveGadgetList = createButton(1, y, 0, 't', _vm->_moveImages[0], _vm->_moveImages[1]); - Gadget *curGadget = _vm->_moveGadgetList; - curGadget->NextGadget = createButton(33, y, 1, 'm', _vm->_moveImages[2], _vm->_moveImages[3]); - curGadget = curGadget->NextGadget; - curGadget->NextGadget = createButton(65, y, 2, 'o', _vm->_moveImages[4], _vm->_moveImages[5]); - curGadget = curGadget->NextGadget; - curGadget->NextGadget = createButton(97, y, 3, 'c', _vm->_moveImages[6], _vm->_moveImages[7]); - curGadget = curGadget->NextGadget; - curGadget->NextGadget = createButton(129, y, 4, 'l', _vm->_moveImages[8], _vm->_moveImages[9]); - curGadget = curGadget->NextGadget; - curGadget->NextGadget = createButton(161, y, 5, 'i', _vm->_moveImages[12], _vm->_moveImages[13]); - curGadget = curGadget->NextGadget; - curGadget->NextGadget = createButton(193, y, 6, VKEY_LTARROW, _vm->_moveImages[14], _vm->_moveImages[15]); - curGadget = curGadget->NextGadget; - curGadget->NextGadget = createButton(225, y, 7, VKEY_UPARROW, _vm->_moveImages[16], _vm->_moveImages[17]); - curGadget = curGadget->NextGadget; - curGadget->NextGadget = createButton(257, y, 8, VKEY_RTARROW, _vm->_moveImages[18], _vm->_moveImages[19]); - curGadget = curGadget->NextGadget; - curGadget->NextGadget = createButton(289, y, 9, 'p', _vm->_moveImages[10], _vm->_moveImages[11]); - } else { - _vm->_moveGadgetList = createButton(1, y, 0, 0, _vm->_moveImages[0], _vm->_moveImages[1]); - Gadget *curGadget = _vm->_moveGadgetList; - curGadget->NextGadget = createButton(33, y, 1, 0, _vm->_moveImages[2], _vm->_moveImages[3]); - curGadget = curGadget->NextGadget; - curGadget->NextGadget = createButton(65, y, 2, 0, _vm->_moveImages[4], _vm->_moveImages[5]); - curGadget = curGadget->NextGadget; - curGadget->NextGadget = createButton(97, y, 3, 0, _vm->_moveImages[6], _vm->_moveImages[7]); - curGadget = curGadget->NextGadget; - curGadget->NextGadget = createButton(129, y, 4, 0, _vm->_moveImages[8], _vm->_moveImages[9]); - curGadget = curGadget->NextGadget; - curGadget->NextGadget = createButton(161, y, 5, 0, _vm->_moveImages[12], _vm->_moveImages[13]); - curGadget = curGadget->NextGadget; - curGadget->NextGadget = createButton(193, y, 6, 0, _vm->_moveImages[14], _vm->_moveImages[15]); - curGadget = curGadget->NextGadget; - curGadget->NextGadget = createButton(225, y, 7, 0, _vm->_moveImages[16], _vm->_moveImages[17]); - curGadget = curGadget->NextGadget; - curGadget->NextGadget = createButton(257, y, 8, 0, _vm->_moveImages[18], _vm->_moveImages[19]); - curGadget = curGadget->NextGadget; - curGadget->NextGadget = createButton(289, y, 9, 0, _vm->_moveImages[10], _vm->_moveImages[11]); - } + // The key mapping was only set for the Windows version. + // It's very convenient to have those shortcut, so I added them + // for all versions. (Strangerke) + _vm->_moveGadgetList = createButton(1, y, 0, 't', _vm->_moveImages[0], _vm->_moveImages[1]); + Gadget *curGadget = _vm->_moveGadgetList; + curGadget->NextGadget = createButton(33, y, 1, 'm', _vm->_moveImages[2], _vm->_moveImages[3]); + curGadget = curGadget->NextGadget; + curGadget->NextGadget = createButton(65, y, 2, 'o', _vm->_moveImages[4], _vm->_moveImages[5]); + curGadget = curGadget->NextGadget; + curGadget->NextGadget = createButton(97, y, 3, 'c', _vm->_moveImages[6], _vm->_moveImages[7]); + curGadget = curGadget->NextGadget; + curGadget->NextGadget = createButton(129, y, 4, 'l', _vm->_moveImages[8], _vm->_moveImages[9]); + curGadget = curGadget->NextGadget; + curGadget->NextGadget = createButton(161, y, 5, 'i', _vm->_moveImages[12], _vm->_moveImages[13]); + curGadget = curGadget->NextGadget; + curGadget->NextGadget = createButton(193, y, 6, VKEY_LTARROW, _vm->_moveImages[14], _vm->_moveImages[15]); + curGadget = curGadget->NextGadget; + curGadget->NextGadget = createButton(225, y, 7, VKEY_UPARROW, _vm->_moveImages[16], _vm->_moveImages[17]); + curGadget = curGadget->NextGadget; + curGadget->NextGadget = createButton(257, y, 8, VKEY_RTARROW, _vm->_moveImages[18], _vm->_moveImages[19]); + curGadget = curGadget->NextGadget; + curGadget->NextGadget = createButton(289, y, 9, 'p', _vm->_moveImages[10], _vm->_moveImages[11]); Common::File *invFile = _vm->_resource->openDataFile("P:Inv"); - if (_vm->getPlatform() == Common::kPlatformWindows) { for (uint16 imgIdx = 0; imgIdx < 10; imgIdx++) _vm->_invImages[imgIdx] = new Image(invFile); - - _vm->_invGadgetList = createButton(24, y, 0, 'm', _vm->_invImages[0], _vm->_invImages[1]); - Gadget *curGadget = _vm->_invGadgetList; - curGadget->NextGadget = createButton(56, y, 1, 'g', _vm->_invImages[2], _vm->_invImages[3]); - curGadget = curGadget->NextGadget; - curGadget->NextGadget = createButton(94, y, 2, 'u', _vm->_invImages[4], _vm->_invImages[5]); - curGadget = curGadget->NextGadget; - curGadget->NextGadget = createButton(126, y, 3, 'l', _vm->_moveImages[8], _vm->_moveImages[9]); - curGadget = curGadget->NextGadget; - curGadget->NextGadget = createButton(164, y, 4, VKEY_LTARROW, _vm->_moveImages[14], _vm->_moveImages[15]); - curGadget = curGadget->NextGadget; - curGadget->NextGadget = createButton(196, y, 5, VKEY_RTARROW, _vm->_moveImages[18], _vm->_moveImages[19]); - curGadget = curGadget->NextGadget; - curGadget->NextGadget = createButton(234, y, 6, 'b', _vm->_invImages[6], _vm->_invImages[7]); - curGadget = curGadget->NextGadget; - curGadget->NextGadget = createButton(266, y, 7, 'f', _vm->_invImages[8], _vm->_invImages[9]); - curGadget = curGadget->NextGadget; } else { for (uint16 imgIdx = 0; imgIdx < 6; imgIdx++) _vm->_invImages[imgIdx] = new Image(invFile); - - _vm->_invGadgetList = createButton(58, y, 0, 0, _vm->_invImages[0], _vm->_invImages[1]); - Gadget *curGadget = _vm->_invGadgetList; - curGadget->NextGadget = createButton(90, y, 1, 0, _vm->_invImages[2], _vm->_invImages[3]); - curGadget = curGadget->NextGadget; - curGadget->NextGadget = createButton(128, y, 2, 0, _vm->_invImages[4], _vm->_invImages[5]); - curGadget = curGadget->NextGadget; - curGadget->NextGadget = createButton(160, y, 3, 0, _vm->_moveImages[8], _vm->_moveImages[9]); - curGadget = curGadget->NextGadget; - curGadget->NextGadget = createButton(198, y, 4, 0, _vm->_moveImages[14], _vm->_moveImages[15]); + } + _vm->_invGadgetList = createButton(24, y, 0, 'm', _vm->_invImages[0], _vm->_invImages[1]); + curGadget = _vm->_invGadgetList; + curGadget->NextGadget = createButton(56, y, 1, 'g', _vm->_invImages[2], _vm->_invImages[3]); + curGadget = curGadget->NextGadget; + curGadget->NextGadget = createButton(94, y, 2, 'u', _vm->_invImages[4], _vm->_invImages[5]); + curGadget = curGadget->NextGadget; + curGadget->NextGadget = createButton(126, y, 3, 'l', _vm->_moveImages[8], _vm->_moveImages[9]); + curGadget = curGadget->NextGadget; + curGadget->NextGadget = createButton(164, y, 4, VKEY_LTARROW, _vm->_moveImages[14], _vm->_moveImages[15]); + curGadget = curGadget->NextGadget; + curGadget->NextGadget = createButton(196, y, 5, VKEY_RTARROW, _vm->_moveImages[18], _vm->_moveImages[19]); + + // The windows version has 2 extra gadgets for breadcrumb trail + // TODO: the game is really hard to play without those, maybe we could add something to enable that. + if (_vm->getPlatform() == Common::kPlatformWindows) { curGadget = curGadget->NextGadget; - curGadget->NextGadget = createButton(230, y, 5, 0, _vm->_moveImages[18], _vm->_moveImages[19]); + curGadget->NextGadget = createButton(234, y, 6, 'b', _vm->_invImages[6], _vm->_invImages[7]); curGadget = curGadget->NextGadget; + curGadget->NextGadget = createButton(266, y, 7, 'f', _vm->_invImages[8], _vm->_invImages[9]); } delete invFile; -- cgit v1.2.3 From ef99d82d13fdbfcaedd8e5fdea243ba3740c5185 Mon Sep 17 00:00:00 2001 From: Strangerke Date: Sun, 6 Dec 2015 14:36:49 +0100 Subject: LAB: Move more functions to DisplayMan --- engines/lab/anim.cpp | 6 +- engines/lab/engine.cpp | 12 +- engines/lab/eventman.cpp | 12 +- engines/lab/graphics.cpp | 273 +++++++++++++++++++++++++++++++++++--------- engines/lab/graphics.h | 15 +++ engines/lab/image.cpp | 18 +-- engines/lab/interface.cpp | 2 +- engines/lab/intro.cpp | 6 +- engines/lab/lab.cpp | 10 +- engines/lab/lab.h | 19 --- engines/lab/labfun.h | 1 - engines/lab/map.cpp | 29 +---- engines/lab/processroom.cpp | 4 +- engines/lab/special.cpp | 42 +++---- engines/lab/text.cpp | 8 +- engines/lab/tilepuzzle.cpp | 20 ++-- engines/lab/vga.cpp | 141 +---------------------- 17 files changed, 304 insertions(+), 314 deletions(-) diff --git a/engines/lab/anim.cpp b/engines/lab/anim.cpp index f7770ade7b..edf677b670 100644 --- a/engines/lab/anim.cpp +++ b/engines/lab/anim.cpp @@ -424,7 +424,7 @@ void Anim::diffNextFrame() { return; if (DispBitMap->_flags & BITMAPF_VIDEO) { - DispBitMap->_planes[0] = _vm->getCurrentDrawingBuffer(); + DispBitMap->_planes[0] = _vm->_graphics->getCurrentDrawingBuffer(); DispBitMap->_planes[1] = DispBitMap->_planes[0] + 0x10000; DispBitMap->_planes[2] = DispBitMap->_planes[1] + 0x10000; DispBitMap->_planes[3] = DispBitMap->_planes[2] + 0x10000; @@ -444,7 +444,7 @@ void Anim::diffNextFrame() { } if (_isPal && !_noPalChange) { - _vm->setPalette(_diffPalette, 256); + _vm->_graphics->setPalette(_diffPalette, 256); _isPal = false; } @@ -452,7 +452,7 @@ void Anim::diffNextFrame() { } if (_isPal && !_noPalChange && !_isBM && !_donePal) { - _vm->setPalette(_diffPalette, 256); + _vm->_graphics->setPalette(_diffPalette, 256); _isPal = false; } diff --git a/engines/lab/engine.cpp b/engines/lab/engine.cpp index b6e6f7282b..a986807a1f 100644 --- a/engines/lab/engine.cpp +++ b/engines/lab/engine.cpp @@ -296,7 +296,7 @@ bool LabEngine::doUse(uint16 CurInv) { _curFileName = " "; _cptr = NULL; doMap(_roomNum); - setPalette(initcolors, 8); + _graphics->setPalette(initcolors, 8); _graphics->drawMessage(NULL); _graphics->drawPanel(); } else if (CurInv == JOURNALNUM) { /* LAB: Labyrinth specific */ @@ -400,7 +400,7 @@ void LabEngine::mainGameLoop() { bool forceDraw = false, GotMessage = true; - setPalette(initcolors, 8); + _graphics->setPalette(initcolors, 8); _cptr = NULL; _roomNum = 1; @@ -843,14 +843,10 @@ bool LabEngine::from_crumbs(uint32 tmpClass, uint16 code, uint16 Qualifier, Comm if (doit) { _graphics->drawMessage("Disk operation failed."); - setPalette(initcolors, 8); - - _graphics->screenUpdate(); - + _graphics->setPalette(initcolors, 8); g_system->delayMillis(1000); - } else { - _graphics->screenUpdate(); } + _graphics->screenUpdate(); } else if (gadgetId == 1) { if (!doUse(curInv)) { Old = actionMode; diff --git a/engines/lab/eventman.cpp b/engines/lab/eventman.cpp index 6b73de79b5..0b3f71eb63 100644 --- a/engines/lab/eventman.cpp +++ b/engines/lab/eventman.cpp @@ -299,8 +299,9 @@ void EventManager::processInput(bool can_delay) { _mousePos.x = 0; _mouseAtEdge = true; } - if (_mousePos.x > _vm->_screenWidth - 1) { - _mousePos.x = _vm->_screenWidth; + + if (_mousePos.x >= _vm->_graphics->_screenWidth) { + _mousePos.x = _vm->_graphics->_screenWidth; _mouseAtEdge = true; } @@ -309,8 +310,9 @@ void EventManager::processInput(bool can_delay) { _mousePos.y = 0; _mouseAtEdge = true; } - if (_mousePos.y > _vm->_screenHeight - 1) { - _mousePos.y = _vm->_screenHeight; + + if (_mousePos.y >= _vm->_graphics->_screenHeight) { + _mousePos.y = _vm->_graphics->_screenHeight; _mouseAtEdge = true; } @@ -350,7 +352,7 @@ void EventManager::processInput(bool can_delay) { break; } - g_system->copyRectToScreen(_vm->_displayBuffer, _vm->_screenWidth, 0, 0, _vm->_screenWidth, _vm->_screenHeight); + g_system->copyRectToScreen(_vm->_graphics->_displayBuffer, _vm->_graphics->_screenWidth, 0, 0, _vm->_graphics->_screenWidth, _vm->_graphics->_screenHeight); g_system->updateScreen(); } } diff --git a/engines/lab/graphics.cpp b/engines/lab/graphics.cpp index 3ed28d06f3..a10512df55 100644 --- a/engines/lab/graphics.cpp +++ b/engines/lab/graphics.cpp @@ -48,7 +48,16 @@ DisplayMan::DisplayMan(LabEngine *vm) : _vm(vm) { _screenBytesPerPage = 65536; _curapen = 0; - _curBitmap = NULL; + _curBitmap = nullptr; + _displayBuffer = nullptr; + _currentDisplayBuffer = nullptr; + _tempScrollData = nullptr; + + _screenWidth = 0; + _screenHeight = 0; + + for (int i = 0; i < 256 * 3; i++) + _curvgapal[i] = 0; } DisplayMan::~DisplayMan() { @@ -129,8 +138,8 @@ bool DisplayMan::readPict(const char *filename, bool playOnce) { if (!_vm->_music->_doNotFilestopSoundEffect) _vm->_music->stopSoundEffect(); - DispBitMap->_bytesPerRow = _vm->_screenWidth; - DispBitMap->_rows = _vm->_screenHeight; + DispBitMap->_bytesPerRow = _screenWidth; + DispBitMap->_rows = _screenHeight; DispBitMap->_flags = BITMAPF_VIDEO; _vm->_anim->readDiff(_curBitmap, playOnce); @@ -343,15 +352,15 @@ uint32 DisplayMan::flowTextToMem(Image *destIm, void *font, /* the TextAttr uint16 x1, /* Cords */ uint16 y1, uint16 x2, uint16 y2, const char *str) { /* The text itself */ uint32 res, vgabyte = _screenBytesPerPage; - byte *tmp = _vm->_currentDisplayBuffer; + byte *tmp = _currentDisplayBuffer; - _vm->_currentDisplayBuffer = destIm->_imageData; + _currentDisplayBuffer = destIm->_imageData; _screenBytesPerPage = (uint32)destIm->_width * (int32)destIm->_height; - res = _vm->_graphics->flowText(font, spacing, pencolor, backpen, fillback, centerh, centerv, output, x1, y1, x2, y2, str); + res = flowText(font, spacing, pencolor, backpen, fillback, centerh, centerv, output, x1, y1, x2, y2, str); _screenBytesPerPage = vgabyte; - _vm->_currentDisplayBuffer = tmp; + _currentDisplayBuffer = tmp; return res; } @@ -391,10 +400,6 @@ int32 DisplayMan::longDrawMessage(const char *str) { return flowTextScaled(_vm->_msgFont, 0, 1, 7, false, true, true, true, 6, 155, 313, 195, str); } -void LabEngine::drawStaticMessage(byte index) { - _graphics->drawMessage(_resource->getStaticText((StaticText)index).c_str()); -} - /******************************************************************************/ /* Draws a message to the message box. */ /******************************************************************************/ @@ -442,7 +447,7 @@ void DisplayMan::doScrollBlack() { byte *tempmem; Image im; uint32 size, copysize; - uint32 *baseAddr; + byte *baseAddr; uint16 width = VGAScaleX(320); uint16 height = VGAScaleY(149) + SVGACord(2); byte *mem = new byte[width * height]; @@ -456,7 +461,7 @@ void DisplayMan::doScrollBlack() { im.readScreenImage(0, 0); _vm->_music->updateMusic(); - baseAddr = (uint32 *)_vm->getCurrentDrawingBuffer(); + baseAddr = getCurrentDrawingBuffer(); uint16 by = VGAScaleX(4); uint16 nheight = height; @@ -467,7 +472,7 @@ void DisplayMan::doScrollBlack() { if (!_vm->_isHiRes) _vm->waitTOF(); - baseAddr = (uint32 *)_vm->getCurrentDrawingBuffer(); + baseAddr = getCurrentDrawingBuffer(); if (by > nheight) by = nheight; @@ -510,20 +515,17 @@ void DisplayMan::doScrollBlack() { } void DisplayMan::copyPage(uint16 width, uint16 height, uint16 nheight, uint16 startline, byte *mem) { - uint32 size, offSet, copysize; - uint16 curPage; - uint32 *baseAddr; + byte *baseAddr = getCurrentDrawingBuffer(); - baseAddr = (uint32 *)_vm->getCurrentDrawingBuffer(); - - size = (int32)(height - nheight) * (int32)width; + uint32 size = (int32)(height - nheight) * (int32)width; mem += startline * width; - curPage = ((int32)nheight * (int32)width) / _vm->_graphics->_screenBytesPerPage; - offSet = ((int32)nheight * (int32)width) - (curPage * _vm->_graphics->_screenBytesPerPage); + uint16 curPage = ((int32)nheight * (int32)width) / _screenBytesPerPage; + uint32 offSet = ((int32)nheight * (int32)width) - (curPage * _screenBytesPerPage); while (size) { - if (size > (_vm->_graphics->_screenBytesPerPage - offSet)) - copysize = _vm->_graphics->_screenBytesPerPage - offSet; + uint32 copysize; + if (size > (_screenBytesPerPage - offSet)) + copysize = _screenBytesPerPage - offSet; else copysize = size; @@ -553,7 +555,7 @@ void DisplayMan::doScrollWipe(char *filename) { _vm->_anim->_isBM = true; readPict(filename, true); - _vm->setPalette(_vm->_anim->_diffPalette, 256); + setPalette(_vm->_anim->_diffPalette, 256); _vm->_anim->_isBM = false; byte *mem = _vm->_anim->_rawDiffBM._planes[0]; @@ -664,7 +666,7 @@ void DisplayMan::doTransWipe(CloseDataPtr *cPtr, char *filename) { linesdone = 0; } - _vm->overlayRect(0, 0, curY, _vm->_screenWidth - 1, curY + 1); + overlayRect(0, 0, curY, _screenWidth - 1, curY + 1); curY += 4; linesdone++; } @@ -682,7 +684,7 @@ void DisplayMan::doTransWipe(CloseDataPtr *cPtr, char *filename) { linesdone = 0; } - rectFill(0, curY, _vm->_screenWidth - 1, curY + 1); + rectFill(0, curY, _screenWidth - 1, curY + 1); curY += 4; linesdone++; } @@ -695,17 +697,17 @@ void DisplayMan::doTransWipe(CloseDataPtr *cPtr, char *filename) { else _vm->_curFileName = getPictName(cPtr); - byte *BitMapMem = readPictToMem(_vm->_curFileName, _vm->_screenWidth, lastY + 5); - _vm->setPalette(_vm->_anim->_diffPalette, 256); + byte *BitMapMem = readPictToMem(_vm->_curFileName, _screenWidth, lastY + 5); + setPalette(_vm->_anim->_diffPalette, 256); if (BitMapMem) { - imSource._width = _vm->_screenWidth; + imSource._width = _screenWidth; imSource._height = lastY; imSource._imageData = BitMapMem; - imDest._width = _vm->_screenWidth; - imDest._height = _vm->_screenHeight; - imDest._imageData = _vm->getCurrentDrawingBuffer(); + imDest._width = _screenWidth; + imDest._height = _screenHeight; + imDest._imageData = getCurrentDrawingBuffer(); for (uint16 i = 0; i < 2; i++) { curY = i * 2; @@ -717,10 +719,10 @@ void DisplayMan::doTransWipe(CloseDataPtr *cPtr, char *filename) { linesdone = 0; } - imDest._imageData = _vm->getCurrentDrawingBuffer(); + imDest._imageData = getCurrentDrawingBuffer(); - imSource.blitBitmap(0, curY, &imDest, 0, curY, _vm->_screenWidth, 2, false); - _vm->overlayRect(0, 0, curY, _vm->_screenWidth - 1, curY + 1); + imSource.blitBitmap(0, curY, &imDest, 0, curY, _screenWidth, 2, false); + overlayRect(0, 0, curY, _screenWidth - 1, curY + 1); curY += 4; linesdone++; } @@ -736,12 +738,12 @@ void DisplayMan::doTransWipe(CloseDataPtr *cPtr, char *filename) { linesdone = 0; } - imDest._imageData = _vm->getCurrentDrawingBuffer(); + imDest._imageData = getCurrentDrawingBuffer(); if (curY == lastY) - imSource.blitBitmap(0, curY, &imDest, 0, curY, _vm->_screenWidth, 1, false); + imSource.blitBitmap(0, curY, &imDest, 0, curY, _screenWidth, 1, false); else - imSource.blitBitmap(0, curY, &imDest, 0, curY, _vm->_screenWidth, 2, false); + imSource.blitBitmap(0, curY, &imDest, 0, curY, _screenWidth, 2, false); curY += 4; linesdone++; @@ -774,7 +776,7 @@ void DisplayMan::doWipe(uint16 wipeType, CloseDataPtr *cPtr, char *filename) { void DisplayMan::blackScreen() { byte pal[256 * 3]; memset(pal, 0, 248 * 3); - _vm->writeColorRegs(pal, 8, 248); + writeColorRegs(pal, 8, 248); g_system->delayMillis(32); } @@ -785,7 +787,7 @@ void DisplayMan::blackScreen() { void DisplayMan::whiteScreen() { byte pal[256 * 3]; memset(pal, 255, 248 * 3); - _vm->writeColorRegs(pal, 8, 248); + writeColorRegs(pal, 8, 248); } /*****************************************************************************/ @@ -794,7 +796,7 @@ void DisplayMan::whiteScreen() { void DisplayMan::blackAllScreen() { byte pal[256 * 3]; memset(pal, 0, 256 * 3); - _vm->writeColorRegs(pal, 0, 256); + writeColorRegs(pal, 0, 256); g_system->delayMillis(32); } @@ -938,14 +940,14 @@ void DisplayMan::rectFill(uint16 x1, uint16 y1, uint16 x2, uint16 y2) { int w = x2 - x1 + 1; int h = y2 - y1 + 1; - if (x1 + w > _vm->_screenWidth) - w = _vm->_screenWidth - x1; + if (x1 + w > _screenWidth) + w = _screenWidth - x1; - if (y1 + h > _vm->_screenHeight) - h = _vm->_screenHeight - y1; + if (y1 + h > _screenHeight) + h = _screenHeight - y1; if ((w > 0) && (h > 0)) { - char *d = (char *)_vm->getCurrentDrawingBuffer() + y1 * _vm->_screenWidth + x1; + char *d = (char *)getCurrentDrawingBuffer() + y1 * _screenWidth + x1; while (h-- > 0) { char *dd = d; @@ -955,7 +957,7 @@ void DisplayMan::rectFill(uint16 x1, uint16 y1, uint16 x2, uint16 y2) { *dd++ = _curapen; } - d += _vm->_screenWidth; + d += _screenWidth; } } } @@ -979,7 +981,7 @@ void DisplayMan::drawHLine(uint16 x1, uint16 y, uint16 x2) { } void DisplayMan::screenUpdate() { - g_system->copyRectToScreen(_vm->_displayBuffer, _vm->_screenWidth, 0, 0, _vm->_screenWidth, _vm->_screenHeight); + g_system->copyRectToScreen(_displayBuffer, _screenWidth, 0, 0, _screenWidth, _screenHeight); g_system->updateScreen(); _vm->_event->processInput(); @@ -990,17 +992,176 @@ void DisplayMan::screenUpdate() { /*****************************************************************************/ bool DisplayMan::createScreen(bool hiRes) { if (hiRes) { - _vm->_screenWidth = 640; - _vm->_screenHeight = 480; + _screenWidth = 640; + _screenHeight = 480; } else { - _vm->_screenWidth = 320; - _vm->_screenHeight = 200; + _screenWidth = 320; + _screenHeight = 200; } - _screenBytesPerPage = _vm->_screenWidth * _vm->_screenHeight; - - _vm->_displayBuffer = new byte[_screenBytesPerPage]; // FIXME: Memory leak! + _screenBytesPerPage = _screenWidth * _screenHeight; + _displayBuffer = new byte[_screenBytesPerPage]; // FIXME: Memory leak! return true; } +/*****************************************************************************/ +/* Converts an Amiga palette (up to 16 colors) to a VGA palette, then sets */ +/* the VGA palette. */ +/*****************************************************************************/ +void DisplayMan::setAmigaPal(uint16 *pal, uint16 numColors) { + byte vgaPal[16 * 3]; + uint16 vgaIdx = 0; + + if (numColors > 16) + numColors = 16; + + for (uint16 i = 0; i < numColors; i++) { + vgaPal[vgaIdx++] = (byte)(((pal[i] & 0xf00) >> 8) << 2); + vgaPal[vgaIdx++] = (byte)(((pal[i] & 0x0f0) >> 4) << 2); + vgaPal[vgaIdx++] = (byte)(((pal[i] & 0x00f)) << 2); + } + + writeColorRegs(vgaPal, 0, 16); + _vm->waitTOF(); +} + +/*****************************************************************************/ +/* Writes any number of the 256 color registers. */ +/* first: the number of the first color register to write. */ +/* numreg: the number of registers to write */ +/* buf: a char pointer which contains the selected color registers. */ +/* Each value representing a color register occupies 3 bytes in */ +/* the array. The order is red, green then blue. The first byte */ +/* in the array is the red component of the first element selected.*/ +/* The length of the buffer is 3 times the number of registers */ +/* selected. */ +/*****************************************************************************/ +void DisplayMan::writeColorRegs(byte *buf, uint16 first, uint16 numreg) { + byte tmp[256 * 3]; + + for (int i = 0; i < 256 * 3; i++) { + tmp[i] = buf[i] * 4; + } + + g_system->getPaletteManager()->setPalette(tmp, first, numreg); + + memcpy(&(_curvgapal[first * 3]), buf, numreg * 3); +} + +void DisplayMan::setPalette(void *cmap, uint16 numcolors) { + if (memcmp(cmap, _curvgapal, numcolors * 3) != 0) + writeColorRegs((byte *)cmap, 0, numcolors); +} + +/*****************************************************************************/ +/* Returns the base address of the current VGA display. */ +/*****************************************************************************/ +byte *DisplayMan::getCurrentDrawingBuffer() { + if (_currentDisplayBuffer) + return _currentDisplayBuffer; + + return _displayBuffer; +} + +/*****************************************************************************/ +/* Overlays a region on the screen using the desired pen color. */ +/*****************************************************************************/ +void DisplayMan::overlayRect(uint16 pencolor, uint16 x1, uint16 y1, uint16 x2, uint16 y2) { + int w = x2 - x1 + 1; + int h = y2 - y1 + 1; + + if (x1 + w > _screenWidth) + w = _screenWidth - x1; + + if (y1 + h > _screenHeight) + h = _screenHeight - y1; + + if ((w > 0) && (h > 0)) { + char *d = (char *)getCurrentDrawingBuffer() + y1 * _screenWidth + x1; + + while (h-- > 0) { + char *dd = d; + int ww = w; + + if (y1 & 1) { + dd++; + ww--; + } + + while (ww > 0) { + *dd = pencolor; + dd += 2; + ww -= 2; + } + + d += _screenWidth; + y1++; + } + } +} + +/*****************************************************************************/ +/* Scrolls the display in the x direction by blitting. */ +/* The _tempScrollData variable must be initialized to some memory, or this */ +/* function will fail. */ +/*****************************************************************************/ +void DisplayMan::scrollDisplayX(int16 dx, uint16 x1, uint16 y1, uint16 x2, uint16 y2) { + Image im; + uint16 temp; + + im._imageData = _tempScrollData; + + if (x1 > x2) { + temp = x2; + x2 = x1; + x1 = temp; + } + + if (y1 > y2) { + temp = y2; + y2 = y1; + y1 = temp; + } + + im._width = x2 - x1 + 1 - dx; + im._height = y2 - y1 + 1; + + im.readScreenImage(x1, y1); + im.drawImage(x1 + dx, y1); + + setAPen(0); + rectFill(x1, y1, x1 + dx - 1, y2); +} + +/*****************************************************************************/ +/* Scrolls the display in the y direction by blitting. */ +/*****************************************************************************/ +void DisplayMan::scrollDisplayY(int16 dy, uint16 x1, uint16 y1, uint16 x2, uint16 y2) { + Image im; + uint16 temp; + + im._imageData = _tempScrollData; + + if (x1 > x2) { + temp = x2; + x2 = x1; + x1 = temp; + } + + if (y1 > y2) { + temp = y2; + y2 = y1; + y1 = temp; + } + + im._width = x2 - x1 + 1; + im._height = y2 - y1 + 1 - dy; + + im.readScreenImage(x1, y1); + im.drawImage(x1, y1 + dy); + + setAPen(0); + rectFill(x1, y1, x2, y1 + dy - 1); +} + } // End of namespace Lab diff --git a/engines/lab/graphics.h b/engines/lab/graphics.h index ba3e34c4e5..4a69a599dd 100644 --- a/engines/lab/graphics.h +++ b/engines/lab/graphics.h @@ -31,6 +31,8 @@ #ifndef LAB_GRAPHICS_H #define LAB_GRAPHICS_H +#include "graphics/palette.h" + namespace Lab { class LabEngine; @@ -41,6 +43,8 @@ private: byte _curapen; byte *_curBitmap; + byte _curvgapal[256 * 3]; + byte *_tempScrollData; public: DisplayMan(LabEngine *lab); @@ -114,10 +118,21 @@ public: void drawVLine(uint16 x1, uint16 y, uint16 x2); void screenUpdate(); bool createScreen(bool HiRes); + void setAmigaPal(uint16 *pal, uint16 numColors); + void writeColorRegs(byte *buf, uint16 first, uint16 numreg); + void setPalette(void *cmap, uint16 numcolors); + void overlayRect(uint16 pencolor, uint16 x1, uint16 y1, uint16 x2, uint16 y2); + byte *getCurrentDrawingBuffer(); + void scrollDisplayX(int16 dx, uint16 x1, uint16 y1, uint16 x2, uint16 y2); + void scrollDisplayY(int16 dy, uint16 x1, uint16 y1, uint16 x2, uint16 y2); bool _longWinInFront; bool _lastMessageLong; uint32 _screenBytesPerPage; + int _screenWidth; + int _screenHeight; + byte *_displayBuffer; + byte *_currentDisplayBuffer; }; } // End of namespace Lab diff --git a/engines/lab/image.cpp b/engines/lab/image.cpp index 45377aceda..ab63e96def 100644 --- a/engines/lab/image.cpp +++ b/engines/lab/image.cpp @@ -56,9 +56,9 @@ void Image::blitBitmap(uint16 xs, uint16 ys, Image *imDest, uint16 xd, uint16 yd, uint16 width, uint16 height, byte masked) { int w = width; int h = height; - int destWidth = (imDest) ? imDest->_width : g_lab->_screenWidth; - int destHeight = (imDest) ? imDest->_height : g_lab->_screenHeight; - byte *destBuffer = (imDest) ? imDest->_imageData : g_lab->getCurrentDrawingBuffer(); + int destWidth = (imDest) ? imDest->_width : g_lab->_graphics->_screenWidth; + int destHeight = (imDest) ? imDest->_height : g_lab->_graphics->_screenHeight; + byte *destBuffer = (imDest) ? imDest->_imageData : g_lab->_graphics->getCurrentDrawingBuffer(); if (xd + w > destWidth) w = destWidth - xd; @@ -117,20 +117,20 @@ void Image::readScreenImage(uint16 x, uint16 y) { int w = _width; int h = _height; - if (x + w > g_lab->_screenWidth) - w = g_lab->_screenWidth - x; + if (x + w > g_lab->_graphics->_screenWidth) + w = g_lab->_graphics->_screenWidth - x; - if (y + h > g_lab->_screenHeight) - h = g_lab->_screenHeight - y; + if (y + h > g_lab->_graphics->_screenHeight) + h = g_lab->_graphics->_screenHeight - y; if ((w > 0) && (h > 0)) { byte *s = _imageData; - byte *d = g_lab->getCurrentDrawingBuffer() + y * g_lab->_screenWidth + x; + byte *d = g_lab->_graphics->getCurrentDrawingBuffer() + y * g_lab->_graphics->_screenWidth + x; while (h-- > 0) { memcpy(s, d, w); s += _width; - d += g_lab->_screenWidth; + d += g_lab->_graphics->_screenWidth; } } } diff --git a/engines/lab/interface.cpp b/engines/lab/interface.cpp index 30aa5472a1..61cfc6c365 100644 --- a/engines/lab/interface.cpp +++ b/engines/lab/interface.cpp @@ -95,7 +95,7 @@ void drawGadgetList(Gadget *gadlist) { /* Dims a gadget, and makes it unavailable for using. */ /*****************************************************************************/ void disableGadget(Gadget *curgad, uint16 pencolor) { - g_lab->overlayRect(pencolor, curgad->x, curgad->y, curgad->x + curgad->_image->_width - 1, curgad->y + curgad->_image->_height - 1); + g_lab->_graphics->overlayRect(pencolor, curgad->x, curgad->y, curgad->x + curgad->_image->_width - 1, curgad->y + curgad->_image->_height - 1); curgad->GadgetFlags |= GADGETOFF; } diff --git a/engines/lab/intro.cpp b/engines/lab/intro.cpp index 47897a726f..0313733084 100644 --- a/engines/lab/intro.cpp +++ b/engines/lab/intro.cpp @@ -299,7 +299,7 @@ void Intro::introSequence() { palette[15] = temp; - setAmigaPal(palette, 16); + _vm->_graphics->setAmigaPal(palette, 16); _vm->waitTOF(); } @@ -382,7 +382,7 @@ void Intro::introSequence() { _vm->_music->updateMusic(); _vm->waitTOF(); - _vm->setPalette(_vm->_anim->_diffPalette, 256); + _vm->_graphics->setPalette(_vm->_anim->_diffPalette, 256); _vm->waitTOF(); _vm->waitTOF(); } @@ -442,7 +442,7 @@ void Intro::introSequence() { if (_quitIntro) { _vm->_graphics->setAPen(0); - _vm->_graphics->rectFill(0, 0, _vm->_screenWidth - 1, _vm->_screenHeight - 1); + _vm->_graphics->rectFill(0, 0, _vm->_graphics->_screenWidth - 1, _vm->_graphics->_screenHeight - 1); _vm->_anim->_doBlack = true; } diff --git a/engines/lab/lab.cpp b/engines/lab/lab.cpp index acd1ea963d..1e15845201 100644 --- a/engines/lab/lab.cpp +++ b/engines/lab/lab.cpp @@ -55,12 +55,6 @@ LabEngine::LabEngine(OSystem *syst, const ADGameDescription *gameDesc) : Engine(syst), _gameDescription(gameDesc), _extraGameFeatures(0) { g_lab = this; - _screenWidth = 320; - _screenHeight = 200; - - _currentDisplayBuffer = 0; - _displayBuffer = 0; - _lastWaitTOFTicks = 0; _isHiRes = false; @@ -185,4 +179,8 @@ Common::String LabEngine::generateSaveFileName(uint slot) { return Common::String::format("%s.%03u", _targetName.c_str(), slot); } +void LabEngine::drawStaticMessage(byte index) { + _graphics->drawMessage(_resource->getStaticText((StaticText)index).c_str()); +} + } // End of namespace Lab diff --git a/engines/lab/lab.h b/engines/lab/lab.h index 01dcaa04b1..b917da7bce 100644 --- a/engines/lab/lab.h +++ b/engines/lab/lab.h @@ -75,13 +75,8 @@ public: bool hasFeature(EngineFeature f) const; Common::String generateSaveFileName(uint slot); - //void showMainMenu(); - LargeSet *_conditions, *_roomsFound; - int _screenWidth; - int _screenHeight; - // timing.cpp void getTime(uint32 *secs, uint32 *micros); void addCurTime(uint32 sec, uint32 micros, uint32 *timeSec, uint32 *timeMicros); @@ -96,9 +91,6 @@ private: // timing.cpp void microDelay(uint32 secs, uint32 micros); - // vga.cpp - byte _curvgapal[256 * 3]; - public: EventManager *_event; Resource *_resource; @@ -107,8 +99,6 @@ public: DisplayMan *_graphics; int _roomNum; - byte *_currentDisplayBuffer; - CrumbData _breadCrumbs[MAX_CRUMBS]; uint16 _numCrumbs; bool _droppingCrumbs; @@ -118,9 +108,7 @@ public: uint32 _crumbSecs, _crumbMicros; bool _isCrumbWaiting; bool _alternate; - byte *_tempScrollData; bool _isHiRes; - byte *_displayBuffer; const char *_curFileName; const char *_nextFileName; const char *_newFileName; /* When ProcessRoom.c decides to change the filename @@ -146,13 +134,6 @@ private: public: void waitTOF(); - void writeColorRegs(byte *buf, uint16 first, uint16 numreg); - byte *getCurrentDrawingBuffer(); - void scrollDisplayX(int16 dx, uint16 x1, uint16 y1, uint16 x2, uint16 y2); - void scrollDisplayY(int16 dy, uint16 x1, uint16 y1, uint16 x2, uint16 y2); - void overlayRect(uint16 pencolor, uint16 x1, uint16 y1, uint16 x2, uint16 y2); - void setPalette(void *cmap, uint16 numcolors); - void drawRoomMessage(uint16 CurInv, CloseDataPtr cptr); void interfaceOff(); void interfaceOn(); diff --git a/engines/lab/labfun.h b/engines/lab/labfun.h index 67200a8498..20785f4f4d 100644 --- a/engines/lab/labfun.h +++ b/engines/lab/labfun.h @@ -120,7 +120,6 @@ public: /*---------------------------*/ void fade(bool fadein, uint16 res); -void setAmigaPal(uint16 *pal, uint16 numcolors); void doMap(uint16 CurRoom); void doJournal(); void doNotes(); diff --git a/engines/lab/map.cpp b/engines/lab/map.cpp index bef3dd1f4c..3f20feae8f 100644 --- a/engines/lab/map.cpp +++ b/engines/lab/map.cpp @@ -43,27 +43,6 @@ namespace Lab { extern uint16 Direction; -/*****************************************************************************/ -/* Converts an Amiga palette (up to 16 colors) to a VGA palette, then sets */ -/* the VGA palette. */ -/*****************************************************************************/ -void setAmigaPal(uint16 *pal, uint16 numcolors) { - byte vgapal[16 * 3]; - uint16 vgacount = 0; - - if (numcolors > 16) - numcolors = 16; - - for (uint16 i = 0; i < numcolors; i++) { - vgapal[vgacount++] = (byte)(((pal[i] & 0xf00) >> 8) << 2); - vgapal[vgacount++] = (byte)(((pal[i] & 0x0f0) >> 4) << 2); - vgapal[vgacount++] = (byte)(((pal[i] & 0x00f)) << 2); - } - - g_lab->writeColorRegs(vgapal, 0, 16); - g_lab->waitTOF(); -} - /*---------------------------------------------------------------------------*/ /*------------------------------ The Map stuff ------------------------------*/ /*---------------------------------------------------------------------------*/ @@ -226,7 +205,7 @@ void fade(bool fadein, uint16 res) { (0xF00 & fadeNumOut(0xF00 & FadePalette[palIdx], 0xF00 & res, i)); } - setAmigaPal(newpal, 16); + g_lab->_graphics->setAmigaPal(newpal, 16); g_lab->waitTOF(); g_lab->_music->updateMusic(); } @@ -486,7 +465,7 @@ void LabEngine::drawMap(uint16 CurRoom, uint16 CurMsg, uint16 Floor, bool fadeou fade(false, 0); _graphics->setAPen(0); - _graphics->rectFill(0, 0, _screenWidth - 1, _screenHeight - 1); + _graphics->rectFill(0, 0, _graphics->_screenWidth - 1, _graphics->_screenHeight - 1); Map->drawImage(0, 0); drawGadgetList(MapGadgetList); @@ -583,7 +562,7 @@ void LabEngine::processMap(uint16 CurRoom) { } waitTOF(); - writeColorRegs(newcolor, 1, 1); + _graphics->writeColorRegs(newcolor, 1, 1); _event->updateMouse(); waitTOF(); _event->updateMouse(); @@ -753,7 +732,7 @@ void LabEngine::doMap(uint16 CurRoom) { _graphics->blackAllScreen(); _event->mouseHide(); _graphics->setAPen(0); - _graphics->rectFill(0, 0, _screenWidth - 1, _screenHeight - 1); + _graphics->rectFill(0, 0, _graphics->_screenWidth - 1, _graphics->_screenHeight - 1); freeMapData(); _graphics->blackAllScreen(); _event->mouseShow(); diff --git a/engines/lab/processroom.cpp b/engines/lab/processroom.cpp index bc7fa2e8b5..45d5584f83 100644 --- a/engines/lab/processroom.cpp +++ b/engines/lab/processroom.cpp @@ -532,7 +532,7 @@ void LabEngine::doActions(Action *aptr, CloseDataPtr *lcptr) { _anim->_diffPalette[idx] = 255 - _anim->_diffPalette[idx]; waitTOF(); - setPalette(_anim->_diffPalette, 256); + _graphics->setPalette(_anim->_diffPalette, 256); waitTOF(); waitTOF(); } else if (aptr->Param1 == 4) { /* white the palette */ @@ -541,7 +541,7 @@ void LabEngine::doActions(Action *aptr, CloseDataPtr *lcptr) { waitTOF(); } else if (aptr->Param1 == 6) { /* Restore the palette */ waitTOF(); - setPalette(_anim->_diffPalette, 256); + _graphics->setPalette(_anim->_diffPalette, 256); waitTOF(); waitTOF(); } else if (aptr->Param1 == 7) { /* Quick pause */ diff --git a/engines/lab/special.cpp b/engines/lab/special.cpp index 76f9c1576a..4143ad6d73 100644 --- a/engines/lab/special.cpp +++ b/engines/lab/special.cpp @@ -77,13 +77,13 @@ extern uint16 Direction; static byte *loadBackPict(const char *fileName, bool tomem) { - byte *res = NULL; + byte *res = nullptr; FadePalette = hipal; g_lab->_anim->_noPalChange = true; if (tomem) - res = g_lab->_graphics->readPictToMem(fileName, g_lab->_screenWidth, g_lab->_screenHeight); + res = g_lab->_graphics->readPictToMem(fileName, g_lab->_graphics->_screenWidth, g_lab->_graphics->_screenHeight); else g_lab->_graphics->readPict(fileName, true); @@ -106,7 +106,7 @@ void doNotes() { char *ntext = g_lab->_resource->getText("Lab:Rooms/Notes"); g_lab->_graphics->flowText(noteFont, -2 + g_lab->_graphics->SVGACord(1), 0, 0, false, false, true, true, g_lab->_graphics->VGAScaleX(25) + g_lab->_graphics->SVGACord(15), g_lab->_graphics->VGAScaleY(50), g_lab->_graphics->VGAScaleX(295) - g_lab->_graphics->SVGACord(15), g_lab->_graphics->VGAScaleY(148), ntext); - g_lab->setPalette(g_lab->_anim->_diffPalette, 256); + g_lab->_graphics->setPalette(g_lab->_anim->_diffPalette, 256); closeFont(noteFont); delete[] ntext; @@ -150,7 +150,7 @@ void doWestPaper() { delete[] ntext; closeFont(paperFont); - g_lab->setPalette(g_lab->_anim->_diffPalette, 256); + g_lab->_graphics->setPalette(g_lab->_anim->_diffPalette, 256); } /*****************************************************************************/ @@ -268,18 +268,18 @@ static void drawJournalText() { /*****************************************************************************/ static void turnPage(bool FromLeft) { if (FromLeft) { - for (int i = 0; i < g_lab->_screenWidth; i += 8) { + for (int i = 0; i < g_lab->_graphics->_screenWidth; i += 8) { g_lab->_music->updateMusic(); g_lab->waitTOF(); - ScreenImage._imageData = g_lab->getCurrentDrawingBuffer(); - JBackImage.blitBitmap(i, 0, &ScreenImage, i, 0, 8, g_lab->_screenHeight, false); + ScreenImage._imageData = g_lab->_graphics->getCurrentDrawingBuffer(); + JBackImage.blitBitmap(i, 0, &ScreenImage, i, 0, 8, g_lab->_graphics->_screenHeight, false); } } else { - for (int i = (g_lab->_screenWidth - 8); i > 0; i -= 8) { + for (int i = (g_lab->_graphics->_screenWidth - 8); i > 0; i -= 8) { g_lab->_music->updateMusic(); g_lab->waitTOF(); - ScreenImage._imageData = g_lab->getCurrentDrawingBuffer(); - JBackImage.blitBitmap(i, 0, &ScreenImage, i, 0, 8, g_lab->_screenHeight, false); + ScreenImage._imageData = g_lab->_graphics->getCurrentDrawingBuffer(); + JBackImage.blitBitmap(i, 0, &ScreenImage, i, 0, 8, g_lab->_graphics->_screenHeight, false); } } } @@ -298,10 +298,10 @@ void LabEngine::drawJournal(uint16 wipenum, bool needFade) { drawJournalText(); - ScreenImage._imageData = getCurrentDrawingBuffer(); + ScreenImage._imageData = _graphics->getCurrentDrawingBuffer(); if (wipenum == 0) - JBackImage.blitBitmap(0, 0, &ScreenImage, 0, 0, _screenWidth, _screenHeight, false); + JBackImage.blitBitmap(0, 0, &ScreenImage, 0, 0, _graphics->_screenWidth, _graphics->_screenHeight, false); else turnPage((bool)(wipenum == 1)); @@ -320,7 +320,7 @@ void LabEngine::drawJournal(uint16 wipenum, bool needFade) { fade(true, 0); g_lab->_anim->_noPalChange = true; - JBackImage._imageData = _graphics->readPictToMem("P:Journal.pic", _screenWidth, _screenHeight); + JBackImage._imageData = _graphics->readPictToMem("P:Journal.pic", _graphics->_screenWidth, _graphics->_screenHeight); GotBackImage = true; eatMessages(); @@ -380,15 +380,15 @@ void LabEngine::doJournal() { lastpage = false; GotBackImage = false; - JBackImage._width = _screenWidth; - JBackImage._height = _screenHeight; + JBackImage._width = _graphics->_screenWidth; + JBackImage._height = _graphics->_screenHeight; JBackImage._imageData = NULL; BackG.NextGadget = &CancelG; CancelG.NextGadget = &ForwardG; ScreenImage = JBackImage; - ScreenImage._imageData = getCurrentDrawingBuffer(); + ScreenImage._imageData = _graphics->getCurrentDrawingBuffer(); _music->updateMusic(); loadJournalData(); @@ -402,10 +402,10 @@ void LabEngine::doJournal() { fade(false, 0); _event->mouseHide(); - ScreenImage._imageData = getCurrentDrawingBuffer(); + ScreenImage._imageData = _graphics->getCurrentDrawingBuffer(); _graphics->setAPen(0); - _graphics->rectFill(0, 0, _screenWidth - 1, _screenHeight - 1); + _graphics->rectFill(0, 0, _graphics->_screenWidth - 1, _graphics->_screenHeight - 1); _graphics->blackScreen(); } @@ -476,13 +476,13 @@ void LabEngine::drawMonText(char *text, TextFont *monitorFont, uint16 x1, uint16 MonGadHeight = fheight; _graphics->setAPen(0); - _graphics->rectFill(0, 0, _screenWidth - 1, y2); + _graphics->rectFill(0, 0, _graphics->_screenWidth - 1, y2); for (uint16 i = 0; i < numlines; i++) MonButton->drawImage(0, i * MonGadHeight); } else if (isinteractive) { _graphics->setAPen(0); - _graphics->rectFill(0, 0, _screenWidth - 1, y2); + _graphics->rectFill(0, 0, _graphics->_screenWidth - 1, y2); } else { _graphics->setAPen(0); _graphics->rectFill(x1, y1, x2, y2); @@ -644,7 +644,7 @@ void LabEngine::doMonitor(char *background, char *textfile, bool isinteractive, closeFont(monitorFont); _graphics->setAPen(0); - _graphics->rectFill(0, 0, _screenWidth - 1, _screenHeight - 1); + _graphics->rectFill(0, 0, _graphics->_screenWidth - 1, _graphics->_screenHeight - 1); _graphics->blackAllScreen(); _graphics->freePict(); } diff --git a/engines/lab/text.cpp b/engines/lab/text.cpp index 1c1cacdac3..f784c2126d 100644 --- a/engines/lab/text.cpp +++ b/engines/lab/text.cpp @@ -78,10 +78,10 @@ void text(TextFont *tf, uint16 x, uint16 y, uint16 color, const char *text, uint int32 templeft, LeftInSegment; uint16 bwidth, mask, curpage, data; - VGATop = g_lab->getCurrentDrawingBuffer(); + VGATop = g_lab->_graphics->getCurrentDrawingBuffer(); for (uint16 i = 0; i < numchars; i++) { - RealOffset = (g_lab->_screenWidth * y) + x; + RealOffset = (g_lab->_graphics->_screenWidth * y) + x; curpage = RealOffset / g_lab->_graphics->_screenBytesPerPage; SegmentOffset = RealOffset - (curpage * g_lab->_graphics->_screenBytesPerPage); LeftInSegment = g_lab->_graphics->_screenBytesPerPage - SegmentOffset; @@ -137,8 +137,8 @@ void text(TextFont *tf, uint16 x, uint16 y, uint16 color, const char *text, uint } } - VGATempLine += g_lab->_screenWidth; - LeftInSegment -= g_lab->_screenWidth; + VGATempLine += g_lab->_graphics->_screenWidth; + LeftInSegment -= g_lab->_graphics->_screenWidth; if (LeftInSegment <= 0) { curpage++; diff --git a/engines/lab/tilepuzzle.cpp b/engines/lab/tilepuzzle.cpp index 137038fd75..1cee9d3fde 100644 --- a/engines/lab/tilepuzzle.cpp +++ b/engines/lab/tilepuzzle.cpp @@ -259,7 +259,7 @@ void LabEngine::showTile(const char *filename, bool showsolution) { delete tileFile; doTile(showsolution); - setPalette(_anim->_diffPalette, 256); + _graphics->setPalette(_anim->_diffPalette, 256); } /*****************************************************************************/ @@ -319,9 +319,9 @@ void LabEngine::changeCombination(uint16 number) { combnum = combination[number]; - display._imageData = getCurrentDrawingBuffer(); - display._width = _screenWidth; - display._height = _screenHeight; + display._imageData = _graphics->getCurrentDrawingBuffer(); + display._width = _graphics->_screenWidth; + display._height = _graphics->_screenHeight; for (uint16 i = 1; i <= (Images[combnum]->_height / 2); i++) { if (_isHiRes) { @@ -330,10 +330,8 @@ void LabEngine::changeCombination(uint16 number) { } else waitTOF(); - display._imageData = getCurrentDrawingBuffer(); - - scrollDisplayY(2, _graphics->VGAScaleX(COMBINATION_X[number]), _graphics->VGAScaleY(65), _graphics->VGAScaleX(COMBINATION_X[number]) + (Images[combnum])->_width - 1, _graphics->VGAScaleY(65) + (Images[combnum])->_height); - + display._imageData = _graphics->getCurrentDrawingBuffer(); + _graphics->scrollDisplayY(2, _graphics->VGAScaleX(COMBINATION_X[number]), _graphics->VGAScaleY(65), _graphics->VGAScaleX(COMBINATION_X[number]) + (Images[combnum])->_width - 1, _graphics->VGAScaleY(65) + (Images[combnum])->_height); Images[combnum]->blitBitmap(0, (Images[combnum])->_height - (2 * i), &(display), _graphics->VGAScaleX(COMBINATION_X[number]), _graphics->VGAScaleY(65), (Images[combnum])->_width, 2, false); } @@ -348,10 +346,10 @@ void LabEngine::changeCombination(uint16 number) { void LabEngine::scrollRaster(int16 dx, int16 dy, uint16 x1, uint16 y1, uint16 x2, uint16 y2) { if (dx) - scrollDisplayX(dx, x1, y1, x2, y2); + _graphics->scrollDisplayX(dx, x1, y1, x2, y2); if (dy) - scrollDisplayY(dy, x1, y1, x2, y2); + _graphics->scrollDisplayY(dy, x1, y1, x2, y2); } /*****************************************************************************/ @@ -382,7 +380,7 @@ void LabEngine::showCombination(const char *filename) { doCombination(); - setPalette(_anim->_diffPalette, 256); + _graphics->setPalette(_anim->_diffPalette, 256); } } // End of namespace Lab diff --git a/engines/lab/vga.cpp b/engines/lab/vga.cpp index 8ee0d3445e..95099dc0b7 100644 --- a/engines/lab/vga.cpp +++ b/engines/lab/vga.cpp @@ -45,7 +45,7 @@ void LabEngine::changeVolume(int delta) { void LabEngine::waitTOF() { - g_system->copyRectToScreen(_displayBuffer, _screenWidth, 0, 0, _screenWidth, _screenHeight); + g_system->copyRectToScreen(_graphics->_displayBuffer, _graphics->_screenWidth, 0, 0, _graphics->_screenWidth, _graphics->_screenHeight); g_system->updateScreen(); _event->processInput(); @@ -58,143 +58,4 @@ void LabEngine::waitTOF() { _lastWaitTOFTicks = now; } -/*****************************************************************************/ -/* Writes any number of the 256 color registers. */ -/* first: the number of the first color register to write. */ -/* numreg: the number of registers to write */ -/* buf: a char pointer which contains the selected color registers. */ -/* Each value representing a color register occupies 3 bytes in */ -/* the array. The order is red, green then blue. The first byte */ -/* in the array is the red component of the first element selected.*/ -/* The length of the buffer is 3 times the number of registers */ -/* selected. */ -/*****************************************************************************/ -void LabEngine::writeColorRegs(byte *buf, uint16 first, uint16 numreg) { - byte tmp[256 * 3]; - - for (int i = 0; i < 256 * 3; i++) { - tmp[i] = buf[i] * 4; - } - - g_system->getPaletteManager()->setPalette(tmp, first, numreg); - - memcpy(&(_curvgapal[first * 3]), buf, numreg * 3); -} - -void LabEngine::setPalette(void *cmap, uint16 numcolors) { - if (memcmp(cmap, _curvgapal, numcolors * 3) != 0) - writeColorRegs((byte *)cmap, 0, numcolors); -} - -/*****************************************************************************/ -/* Returns the base address of the current VGA display. */ -/*****************************************************************************/ -byte *LabEngine::getCurrentDrawingBuffer() { - if (_currentDisplayBuffer) - return _currentDisplayBuffer; - - return _displayBuffer; -} - -/*****************************************************************************/ -/* Scrolls the display in the x direction by blitting. */ -/* The _tempScrollData variable must be initialized to some memory, or this */ -/* function will fail. */ -/*****************************************************************************/ -void LabEngine::scrollDisplayX(int16 dx, uint16 x1, uint16 y1, uint16 x2, uint16 y2) { - Image im; - uint16 temp; - - im._imageData = _tempScrollData; - - if (x1 > x2) { - temp = x2; - x2 = x1; - x1 = temp; - } - - if (y1 > y2) { - temp = y2; - y2 = y1; - y1 = temp; - } - - im._width = x2 - x1 + 1 - dx; - im._height = y2 - y1 + 1; - - im.readScreenImage(x1, y1); - im.drawImage(x1 + dx, y1); - - _graphics->setAPen(0); - _graphics->rectFill(x1, y1, x1 + dx - 1, y2); -} - -/*****************************************************************************/ -/* Scrolls the display in the y direction by blitting. */ -/*****************************************************************************/ -void LabEngine::scrollDisplayY(int16 dy, uint16 x1, uint16 y1, uint16 x2, uint16 y2) { - Image im; - uint16 temp; - - im._imageData = _tempScrollData; - - if (x1 > x2) { - temp = x2; - x2 = x1; - x1 = temp; - } - - if (y1 > y2) { - temp = y2; - y2 = y1; - y1 = temp; - } - - im._width = x2 - x1 + 1; - im._height = y2 - y1 + 1 - dy; - - im.readScreenImage(x1, y1); - im.drawImage(x1, y1 + dy); - - _graphics->setAPen(0); - _graphics->rectFill(x1, y1, x2, y1 + dy - 1); -} - -/*****************************************************************************/ -/* Overlays a region on the screen using the desired pen color. */ -/*****************************************************************************/ -void LabEngine::overlayRect(uint16 pencolor, uint16 x1, uint16 y1, uint16 x2, uint16 y2) { - int w = x2 - x1 + 1; - int h = y2 - y1 + 1; - - if (x1 + w > _screenWidth) - w = _screenWidth - x1; - - if (y1 + h > _screenHeight) - h = _screenHeight - y1; - - if ((w > 0) && (h > 0)) { - char *d = (char *)getCurrentDrawingBuffer() + y1 * _screenWidth + x1; - - while (h-- > 0) { - char *dd = d; - int ww = w; - - if (y1 & 1) { - dd++; - ww--; - } - - while (ww > 0) { - *dd = pencolor; - dd += 2; - ww -= 2; - } - - d += _screenWidth; - y1++; - } - } -} - } // End of namespace Lab -- cgit v1.2.3 From fa966938c8bf7fc5c933050fb74332d8ac0506a1 Mon Sep 17 00:00:00 2001 From: Strangerke Date: Sun, 6 Dec 2015 14:49:50 +0100 Subject: LAB: Remove vga.cpp --- engines/lab/lab.cpp | 17 +++++++++++++++++ engines/lab/module.mk | 4 +--- engines/lab/vga.cpp | 28 ---------------------------- 3 files changed, 18 insertions(+), 31 deletions(-) diff --git a/engines/lab/lab.cpp b/engines/lab/lab.cpp index 1e15845201..6781a8acc0 100644 --- a/engines/lab/lab.cpp +++ b/engines/lab/lab.cpp @@ -183,4 +183,21 @@ void LabEngine::drawStaticMessage(byte index) { _graphics->drawMessage(_resource->getStaticText((StaticText)index).c_str()); } +void LabEngine::changeVolume(int delta) { + warning("STUB: changeVolume()"); +} + +void LabEngine::waitTOF() { + g_system->copyRectToScreen(_graphics->_displayBuffer, _graphics->_screenWidth, 0, 0, _graphics->_screenWidth, _graphics->_screenHeight); + g_system->updateScreen(); + + _event->processInput(); + + uint32 now; + + for (now = g_system->getMillis(); now - _lastWaitTOFTicks <= 0xF; now = g_system->getMillis() ) + g_system->delayMillis(_lastWaitTOFTicks - now + 17); + + _lastWaitTOFTicks = now; +} } // End of namespace Lab diff --git a/engines/lab/module.mk b/engines/lab/module.mk index 434ba7d97a..3985b1415f 100644 --- a/engines/lab/module.mk +++ b/engines/lab/module.mk @@ -19,9 +19,7 @@ MODULE_OBJS := \ special.o \ text.o \ tilepuzzle.o \ - timing.o \ - vga.o - + timing.o # This module can be built as a plugin ifeq ($(ENABLE_LAB), DYNAMIC_PLUGIN) diff --git a/engines/lab/vga.cpp b/engines/lab/vga.cpp index 95099dc0b7..b80f338c1e 100644 --- a/engines/lab/vga.cpp +++ b/engines/lab/vga.cpp @@ -28,34 +28,6 @@ * */ -#include "graphics/palette.h" -#include "common/events.h" - -#include "lab/lab.h" -#include "lab/image.h" - namespace Lab { -/*****************************************************************************/ -/* Sets the current page on the VGA card. */ -/*****************************************************************************/ -void LabEngine::changeVolume(int delta) { - warning("STUB: changeVolume()"); -} - - -void LabEngine::waitTOF() { - g_system->copyRectToScreen(_graphics->_displayBuffer, _graphics->_screenWidth, 0, 0, _graphics->_screenWidth, _graphics->_screenHeight); - g_system->updateScreen(); - - _event->processInput(); - - uint32 now; - - for (now = g_system->getMillis(); now - _lastWaitTOFTicks <= 0xF; now = g_system->getMillis() ) - g_system->delayMillis(_lastWaitTOFTicks - now + 17); - - _lastWaitTOFTicks = now; -} - } // End of namespace Lab -- cgit v1.2.3 From f48cf343c2761b7918924cc4af923f9503de102c Mon Sep 17 00:00:00 2001 From: Strangerke Date: Sun, 6 Dec 2015 16:03:34 +0100 Subject: LAB: Move doNotes and doWestPaper to LabEngine, remove some useless defines --- engines/lab/engine.cpp | 3 --- engines/lab/lab.h | 3 +++ engines/lab/labfun.h | 56 -------------------------------------------- engines/lab/labsets.h | 61 ++++++++++++++++++++++++++++++++++++++++++++++++ engines/lab/savegame.cpp | 7 ------ engines/lab/special.cpp | 4 ++-- 6 files changed, 66 insertions(+), 68 deletions(-) create mode 100644 engines/lab/labsets.h diff --git a/engines/lab/engine.cpp b/engines/lab/engine.cpp index a986807a1f..ed4908bb25 100644 --- a/engines/lab/engine.cpp +++ b/engines/lab/engine.cpp @@ -565,7 +565,6 @@ bool LabEngine::from_crumbs(uint32 tmpClass, uint16 code, uint16 Qualifier, Comm bool doit; uint16 NewDir; - _anim->_doBlack = false; if ((msgClass == RAWKEY) && (!_graphics->_longWinInFront)) { @@ -1055,9 +1054,7 @@ void LabEngine::go() { } _event->initMouse(); - _msgFont = _resource->getFont("P:AvanteG.12"); - _event->mouseHide(); Intro *intro = new Intro(this); diff --git a/engines/lab/lab.h b/engines/lab/lab.h index b917da7bce..06e4b7480a 100644 --- a/engines/lab/lab.h +++ b/engines/lab/lab.h @@ -42,6 +42,7 @@ #include "lab/resource.h" #include "lab/anim.h" #include "lab/graphics.h" +#include "lab/labsets.h" struct ADGameDescription; @@ -149,6 +150,8 @@ public: void drawMonText(char *text, TextFont *monitorFont, uint16 x1, uint16 y1, uint16 x2, uint16 y2, bool isinteractive); void processMonitor(char *ntext, TextFont *monitorFont, bool isinteractive, uint16 x1, uint16 y1, uint16 x2, uint16 y2); void doMonitor(char *background, char *textfile, bool isinteractive, uint16 x1, uint16 y1, uint16 x2, uint16 y2); + void doNotes(); + void doWestPaper(); void eatMessages(); void drawStaticMessage(byte index); void drawDirection(CloseDataPtr lcPtr); diff --git a/engines/lab/labfun.h b/engines/lab/labfun.h index 20785f4f4d..d58b27ecc8 100644 --- a/engines/lab/labfun.h +++ b/engines/lab/labfun.h @@ -68,63 +68,13 @@ struct SaveGameHeader { /*----- From graphics.c ------*/ /*----------------------------*/ -/* Reads in pictures */ - bool readMusic(const char *filename, bool waitTillFinished); -void drawStaticMessage(byte index); - -/* Double Buffer stuff */ - -void newFlipViews(void *scrPtr, uint16 *newpal, uint16 numcolors); -void flipViews(void *scrPtr); - -/*----------------------------*/ -/*----- From Interface.c -----*/ -/*----------------------------*/ - -Gadget *addGadButton(uint16 x, uint16 y, void *UpImage, void *DownImage, uint16 id); -void gadgetsOnOff(void *gptr, void *win, int32 num, bool on); - -/*----------------------*/ -/*----- From Lab.c -----*/ -/*----------------------*/ - -void eatMessages(); -bool quitPlaying(); - -void readBlock(void *Buffer, uint32 Size, byte **File); - -/*---------------------------*/ -/*----- From LabSets.c ------*/ -/*---------------------------*/ - -class LargeSet { -public: - LargeSet(uint16 last, LabEngine *vm); - ~LargeSet(); - bool in(uint16 element); - void inclElement(uint16 element); - void exclElement(uint16 element); - bool readInitialConditions(const char *fileName); - -private: - LabEngine *_vm; - -public: - uint16 _lastElement; - uint16 *_array; -}; /*---------------------------*/ /*-------- From Map.c -------*/ /*---------------------------*/ void fade(bool fadein, uint16 res); -void doMap(uint16 CurRoom); -void doJournal(); -void doNotes(); -void doWestPaper(); -void doMonitor(char *background, char *textfile, bool isinteractive, uint16 x1, uint16 y1, uint16 x2, uint16 y2); /*--------------------------*/ /*----- From saveGame.c ----*/ @@ -134,12 +84,6 @@ bool saveGame(uint16 Direction, uint16 Quarters, int slot, Common::String desc); bool loadGame(uint16 *Direction, uint16 *Quarters, int slot); bool readSaveGameHeader(Common::InSaveFile *in, SaveGameHeader &header); -/*--------------------------*/ -/*----- From Special.c -----*/ -/*--------------------------*/ - -void showCombination(const char *filename); - } // End of namespace Lab #endif /* LAB_LABFUN_H */ diff --git a/engines/lab/labsets.h b/engines/lab/labsets.h new file mode 100644 index 0000000000..3251ee18a3 --- /dev/null +++ b/engines/lab/labsets.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. + * + */ + + /* + * This code is based on Labyrinth of Time code with assistance of + * + * Copyright (c) 1993 Terra Nova Development + * Copyright (c) 2004 The Wyrmkeep Entertainment Co. + * + */ + +#ifndef LAB_LABSETS_H +#define LAB_LABSETS_H + +namespace Lab { + +/*---------------------------*/ +/*----- From LabSets.c ------*/ +/*---------------------------*/ + +class LabEngine; + +class LargeSet { +public: + LargeSet(uint16 last, LabEngine *vm); + ~LargeSet(); + bool in(uint16 element); + void inclElement(uint16 element); + void exclElement(uint16 element); + bool readInitialConditions(const char *fileName); + +private: + LabEngine *_vm; + +public: + uint16 _lastElement; + uint16 *_array; +}; + +} // End of namespace Lab + +#endif // LAB_LABSETS_H diff --git a/engines/lab/savegame.cpp b/engines/lab/savegame.cpp index d97a03688f..cfb636fa58 100644 --- a/engines/lab/savegame.cpp +++ b/engines/lab/savegame.cpp @@ -42,14 +42,7 @@ namespace Lab { #define SAVEGAME_ID MKTAG('L', 'O', 'T', 'S') #define SAVEGAME_VERSION 1 -#define BOOKMARK 0 -#define CARDMARK 1 -#define FLOPPY 2 - - /*----- The machine independent section of saveGame.c -----*/ - - /* Lab: Labyrinth specific */ extern char *getPictName(CloseDataPtr *lcptr); diff --git a/engines/lab/special.cpp b/engines/lab/special.cpp index 4143ad6d73..7c7dcb1477 100644 --- a/engines/lab/special.cpp +++ b/engines/lab/special.cpp @@ -101,7 +101,7 @@ static byte *loadBackPict(const char *fileName, bool tomem) { /*****************************************************************************/ /* Does the things to properly set up the detective notes. */ /*****************************************************************************/ -void doNotes() { +void LabEngine::doNotes() { TextFont *noteFont = g_lab->_resource->getFont("P:Note.fon"); char *ntext = g_lab->_resource->getText("Lab:Rooms/Notes"); @@ -117,7 +117,7 @@ void doNotes() { /* Does the things to properly set up the old west newspaper. Assumes that */ /* OpenHiRes already called. */ /*****************************************************************************/ -void doWestPaper() { +void LabEngine::doWestPaper() { char *ntext; TextFont *paperFont; int32 FileLen, CharsPrinted; -- cgit v1.2.3 From 438e7a24f5f362c383269cca41ced901a98f284e Mon Sep 17 00:00:00 2001 From: Strangerke Date: Sun, 6 Dec 2015 17:24:25 +0100 Subject: LAB: Get rid of some global variables --- engines/lab/engine.cpp | 114 +++++++++++++++++++++----------------------- engines/lab/graphics.cpp | 6 +-- engines/lab/graphics.h | 1 + engines/lab/lab.cpp | 11 ++++- engines/lab/lab.h | 7 +++ engines/lab/map.cpp | 10 ++-- engines/lab/processroom.cpp | 43 ++++++++--------- engines/lab/resource.cpp | 17 ++++--- engines/lab/special.cpp | 5 +- 9 files changed, 109 insertions(+), 105 deletions(-) diff --git a/engines/lab/engine.cpp b/engines/lab/engine.cpp index ed4908bb25..158286fdfb 100644 --- a/engines/lab/engine.cpp +++ b/engines/lab/engine.cpp @@ -40,14 +40,10 @@ namespace Lab { -extern bool DoNotDrawMessage; - /* Global parser data */ - extern RoomData *_rooms; -extern uint16 NumInv, ManyRooms, HighestCondition, Direction; -bool ispal = false, noupdatediff = false, MainDisplay = true, QuitLab = false; +bool ispal = false, MainDisplay = true; /* LAB: Labyrinth specific code for the special puzzles */ #define SPECIALLOCK 100 @@ -103,7 +99,7 @@ void LabEngine::drawRoomMessage(uint16 curInv, CloseDataPtr closePtr) { } if (_alternate) { - if ((curInv <= NumInv) && _conditions->in(curInv) && _inventory[curInv].BInvName) { + if ((curInv <= _numInv) && _conditions->in(curInv) && _inventory[curInv].BInvName) { if ((curInv == LAMPNUM) && _conditions->in(LAMPON)) /* LAB: Labyrinth specific */ drawStaticMessage(kTextLampOn); else if (_inventory[curInv].Many > 1) { @@ -358,7 +354,7 @@ void LabEngine::decIncInv(uint16 *CurInv, bool dec) { else (*CurInv)++; - while (*CurInv && (*CurInv <= NumInv)) { + while (*CurInv && (*CurInv <= _numInv)) { if (_conditions->in(*CurInv) && _inventory[*CurInv].BInvName) { _nextFileName = getInvName(*CurInv); break; @@ -370,13 +366,13 @@ void LabEngine::decIncInv(uint16 *CurInv, bool dec) { (*CurInv)++; } - if ((*CurInv == 0) || (*CurInv > NumInv)) { + if ((*CurInv == 0) || (*CurInv > _numInv)) { if (dec) - *CurInv = NumInv; + *CurInv = _numInv; else *CurInv = 1; - while (*CurInv && (*CurInv <= NumInv)) { + while (*CurInv && (*CurInv <= _numInv)) { if (_conditions->in(*CurInv) && _inventory[*CurInv].BInvName) { _nextFileName = getInvName(*CurInv); break; @@ -404,16 +400,16 @@ void LabEngine::mainGameLoop() { _cptr = NULL; _roomNum = 1; - Direction = NORTH; + _direction = NORTH; _resource->readRoomData("LAB:Doors"); if (!(_inventory = _resource->readInventory("LAB:Inventor"))) return; - if (!(_conditions = new LargeSet(HighestCondition + 1, this))) + if (!(_conditions = new LargeSet(_highestCondition + 1, this))) return; - if (!(_roomsFound = new LargeSet(ManyRooms + 1, this))) + if (!(_roomsFound = new LargeSet(_manyRooms + 1, this))) return; _conditions->readInitialConditions("LAB:Conditio"); @@ -429,7 +425,7 @@ void LabEngine::mainGameLoop() { _event->processInput(true); if (GotMessage) { - if (QuitLab || g_engine->shouldQuit()) { + if (_quitLab || g_engine->shouldQuit()) { _anim->stopDiff(); break; } @@ -448,11 +444,11 @@ void LabEngine::mainGameLoop() { if (MainDisplay) _nextFileName = getPictName(&_cptr); - if (noupdatediff) { + if (_noUpdateDiff) { _roomsFound->inclElement(_roomNum); /* Potentially entered another room */ forceDraw |= (strcmp(_nextFileName, _curFileName) != 0); - noupdatediff = false; + _noUpdateDiff = false; _curFileName = _nextFileName; } else if (strcmp(_nextFileName, _curFileName) != 0) { interfaceOff(); @@ -542,7 +538,7 @@ void LabEngine::mainGameLoop() { } if (_inventory) { - for (int i = 1; i <= NumInv; i++) { + for (int i = 1; i <= _numInv; i++) { if (_inventory[i].name) free(_inventory[i].name); @@ -558,8 +554,8 @@ bool LabEngine::from_crumbs(uint32 tmpClass, uint16 code, uint16 Qualifier, Comm uint32 msgClass = tmpClass; Common::Point curPos = tmpPos; - uint16 OldRoomNum, OldDirection = 0; - uint16 LastInv = MAPNUM, Old; + uint16 oldDirection = 0; + uint16 lastInv = MAPNUM; CloseDataPtr oldcptr, tempcptr, hcptr = NULL; ViewData *VPtr; bool doit; @@ -593,7 +589,7 @@ bool LabEngine::from_crumbs(uint32 tmpClass, uint16 code, uint16 Qualifier, Comm eatMessages(); _alternate = false; _anim->_doBlack = true; - DoNotDrawMessage = false; + _graphics->_doNotDrawMessage = false; MainDisplay = true; interfaceOn(); /* Sets the correct gadget list */ @@ -612,7 +608,7 @@ bool LabEngine::from_crumbs(uint32 tmpClass, uint16 code, uint16 Qualifier, Comm } } else if ((code == 315) || (code == 'x') || (code == 'X') || (code == 'q') || (code == 'Q')) { /* Quit? */ - DoNotDrawMessage = false; + _graphics->_doNotDrawMessage = false; _graphics->drawMessage("Do you want to quit? (Y/N)"); doit = false; eatMessages(); @@ -661,7 +657,7 @@ bool LabEngine::from_crumbs(uint32 tmpClass, uint16 code, uint16 Qualifier, Comm ((IEQUALIFIER_LEFTBUTTON & Qualifier) || (IEQUALIFIER_RBUTTON & Qualifier)))) { _graphics->_longWinInFront = false; - DoNotDrawMessage = false; + _graphics->_doNotDrawMessage = false; _graphics->drawPanel(); drawRoomMessage(curInv, _cptr); _graphics->screenUpdate(); @@ -681,13 +677,13 @@ bool LabEngine::from_crumbs(uint32 tmpClass, uint16 code, uint16 Qualifier, Comm _alternate = true; _anim->_doBlack = true; - DoNotDrawMessage = false; + _graphics->_doNotDrawMessage = false; interfaceOn(); /* Sets the correct gadget list */ MainDisplay = false; - if (LastInv && _conditions->in(LastInv)) { - curInv = LastInv; + if (lastInv && _conditions->in(lastInv)) { + curInv = lastInv; _nextFileName = getInvName(curInv); } else decIncInv(&curInv, false); @@ -698,11 +694,11 @@ bool LabEngine::from_crumbs(uint32 tmpClass, uint16 code, uint16 Qualifier, Comm mayShowCrumbIndicator(); _graphics->screenUpdate(); } else { - Old = actionMode; + uint16 oldActionMode = actionMode; actionMode = gadgetId; - if (Old < 5) - perFlipGadget(Old); + if (oldActionMode < 5) + perFlipGadget(oldActionMode); perFlipGadget(actionMode); @@ -727,28 +723,28 @@ bool LabEngine::from_crumbs(uint32 tmpClass, uint16 code, uint16 Qualifier, Comm _curFileName = " "; - OldDirection = Direction; + oldDirection = _direction; - NewDir = Direction; + NewDir = _direction; processArrow(&NewDir, gadgetId - 6); - doTurn(Direction, NewDir, &_cptr); + doTurn(_direction, NewDir, &_cptr); _anim->_doBlack = true; - Direction = NewDir; + _direction = NewDir; forceDraw = true; mayShowCrumbIndicator(); _graphics->screenUpdate(); } else if (gadgetId == 7) { - OldRoomNum = _roomNum; + uint16 oldRoomNum = _roomNum; if (doGoForward(&_cptr)) { - if (OldRoomNum == _roomNum) + if (oldRoomNum == _roomNum) _anim->_doBlack = true; } else { _anim->_doBlack = true; - processArrow(&Direction, gadgetId - 6); + processArrow(&_direction, gadgetId - 6); - if (OldRoomNum != _roomNum) { + if (oldRoomNum != _roomNum) { drawStaticMessage(kTextGoForward); _roomsFound->inclElement(_roomNum); /* Potentially entered a new room */ _curFileName = " "; @@ -761,15 +757,15 @@ bool LabEngine::from_crumbs(uint32 tmpClass, uint16 code, uint16 Qualifier, Comm if (_followingCrumbs) { if (_isCrumbTurning) { - if (Direction == OldDirection) { + if (_direction == oldDirection) { _followingCrumbs = false; } } else { - if (_roomNum == OldRoomNum) { // didn't get there? + if (_roomNum == oldRoomNum) { // didn't get there? _followingCrumbs = false; } } - } else if (_droppingCrumbs && OldRoomNum != _roomNum) { + } else if (_droppingCrumbs && oldRoomNum != _roomNum) { // If in surreal maze, turn off DroppingCrumbs. // Note: These numbers were generated by parsing the // "Maps" file, which is why they are hard-coded. Bleh! @@ -795,7 +791,7 @@ bool LabEngine::from_crumbs(uint32 tmpClass, uint16 code, uint16 Qualifier, Comm } _breadCrumbs[_numCrumbs]._roomNum = _roomNum; - _breadCrumbs[_numCrumbs++]._direction = Direction; + _breadCrumbs[_numCrumbs++]._direction = _direction; } } } @@ -811,7 +807,7 @@ bool LabEngine::from_crumbs(uint32 tmpClass, uint16 code, uint16 Qualifier, Comm eatMessages(); _alternate = false; _anim->_doBlack = true; - DoNotDrawMessage = false; + _graphics->_doNotDrawMessage = false; MainDisplay = true; interfaceOn(); /* Sets the correct gadget list */ @@ -834,7 +830,7 @@ bool LabEngine::from_crumbs(uint32 tmpClass, uint16 code, uint16 Qualifier, Comm MainDisplay = true; curInv = MAPNUM; - LastInv = MAPNUM; + lastInv = MAPNUM; _nextFileName = getInvName(curInv); @@ -848,11 +844,11 @@ bool LabEngine::from_crumbs(uint32 tmpClass, uint16 code, uint16 Qualifier, Comm _graphics->screenUpdate(); } else if (gadgetId == 1) { if (!doUse(curInv)) { - Old = actionMode; + uint16 oldActionMode = actionMode; actionMode = 5; /* Use button */ - if (Old < 5) - perFlipGadget(Old); + if (oldActionMode < 5) + perFlipGadget(oldActionMode); drawStaticMessage(kTextUseOnWhat); MainDisplay = true; @@ -862,29 +858,29 @@ bool LabEngine::from_crumbs(uint32 tmpClass, uint16 code, uint16 Qualifier, Comm } else if (gadgetId == 2) { MainDisplay = !MainDisplay; - if ((curInv == 0) || (curInv > NumInv)) { + if ((curInv == 0) || (curInv > _numInv)) { curInv = 1; - while ((curInv <= NumInv) && (!_conditions->in(curInv))) + while ((curInv <= _numInv) && (!_conditions->in(curInv))) curInv++; } - if ((curInv <= NumInv) && _conditions->in(curInv) && + if ((curInv <= _numInv) && _conditions->in(curInv) && _inventory[curInv].BInvName) _nextFileName = getInvName(curInv); _graphics->screenUpdate(); } else if (gadgetId == 3) { /* Left gadget */ decIncInv(&curInv, true); - LastInv = curInv; - DoNotDrawMessage = false; + lastInv = curInv; + _graphics->_doNotDrawMessage = false; drawRoomMessage(curInv, _cptr); _graphics->screenUpdate(); } else if (gadgetId == 4) { /* Right gadget */ decIncInv(&curInv, false); - LastInv = curInv; - DoNotDrawMessage = false; + lastInv = curInv; + _graphics->_doNotDrawMessage = false; drawRoomMessage(curInv, _cptr); _graphics->screenUpdate(); @@ -906,7 +902,7 @@ bool LabEngine::from_crumbs(uint32 tmpClass, uint16 code, uint16 Qualifier, Comm eatMessages(); _alternate = false; _anim->_doBlack = true; - DoNotDrawMessage = false; + _graphics->_doNotDrawMessage = false; MainDisplay = true; interfaceOn(); /* Sets the correct gadget list */ @@ -994,7 +990,7 @@ bool LabEngine::from_crumbs(uint32 tmpClass, uint16 code, uint16 Qualifier, Comm mayShowCrumbIndicator(); _graphics->screenUpdate(); } else if (msgClass == DELTAMOVE) { - VPtr = getViewData(_roomNum, Direction); + VPtr = getViewData(_roomNum, _direction); oldcptr = VPtr->closeUps; if (hcptr == NULL) { @@ -1025,13 +1021,13 @@ bool LabEngine::from_crumbs(uint32 tmpClass, uint16 code, uint16 Qualifier, Comm eatMessages(); _alternate = !_alternate; _anim->_doBlack = true; - DoNotDrawMessage = false; + _graphics->_doNotDrawMessage = false; MainDisplay = true; interfaceOn(); /* Sets the correct gadget list */ if (_alternate) { - if (LastInv && _conditions->in(LastInv)) - curInv = LastInv; + if (lastInv && _conditions->in(lastInv)) + curInv = lastInv; else decIncInv(&curInv, false); } @@ -1064,7 +1060,7 @@ void LabEngine::go() { _event->mouseShow(); mainGameLoop(); - if (QuitLab) { /* Won the game */ + if (_quitLab) { /* Won the game */ _graphics->blackAllScreen(); _graphics->readPict("P:End/L2In.1", true); @@ -1141,7 +1137,7 @@ int LabEngine::followCrumbs() { else exitDir = NORTH; - int moveDir = movement[Direction][exitDir]; + int moveDir = movement[_direction][exitDir]; if (_numCrumbs == 0) { _isCrumbTurning = false; diff --git a/engines/lab/graphics.cpp b/engines/lab/graphics.cpp index a10512df55..babc5502dd 100644 --- a/engines/lab/graphics.cpp +++ b/engines/lab/graphics.cpp @@ -45,6 +45,7 @@ BitMap bit1, bit2, *DispBitMap = &bit1, *DrawBitMap = &bit1; DisplayMan::DisplayMan(LabEngine *vm) : _vm(vm) { _longWinInFront = false; _lastMessageLong = false; + _doNotDrawMessage = false; _screenBytesPerPage = 65536; _curapen = 0; @@ -199,7 +200,6 @@ bool readMusic(const char *filename, bool waitTillFinished) { /*---------------------------------------------------------------------------*/ /*------------ Does all the text rendering to the message boxes. ------------*/ /*---------------------------------------------------------------------------*/ -bool DoNotDrawMessage = false; /*----- The flowText routines -----*/ @@ -404,8 +404,8 @@ int32 DisplayMan::longDrawMessage(const char *str) { /* Draws a message to the message box. */ /******************************************************************************/ void DisplayMan::drawMessage(const char *str) { - if (DoNotDrawMessage) { - DoNotDrawMessage = false; + if (_doNotDrawMessage) { + _doNotDrawMessage = false; return; } diff --git a/engines/lab/graphics.h b/engines/lab/graphics.h index 4a69a599dd..979d73ff17 100644 --- a/engines/lab/graphics.h +++ b/engines/lab/graphics.h @@ -133,6 +133,7 @@ public: int _screenHeight; byte *_displayBuffer; byte *_currentDisplayBuffer; + bool _doNotDrawMessage; }; } // End of namespace Lab diff --git a/engines/lab/lab.cpp b/engines/lab/lab.cpp index 6781a8acc0..f9de51b41f 100644 --- a/engines/lab/lab.cpp +++ b/engines/lab/lab.cpp @@ -70,6 +70,13 @@ LabEngine::LabEngine(OSystem *syst, const ADGameDescription *gameDesc) _followCrumbsFast = false; _isCrumbTurning = false; _isCrumbWaiting = false; + _noUpdateDiff = false; + _quitLab = false; + _numInv = 0; + _manyRooms = 0; + _direction = 0; + _highestCondition = 0; + _crumbSecs = 0; _crumbMicros = 0; @@ -98,8 +105,8 @@ LabEngine::LabEngine(OSystem *syst, const ADGameDescription *gameDesc) _newFileName = nullptr; _curFileName = " "; - _msgFont = 0; - _inventory = 0; + _msgFont = nullptr; + _inventory = nullptr; initTilePuzzle(); diff --git a/engines/lab/lab.h b/engines/lab/lab.h index 06e4b7480a..5675a0ccaf 100644 --- a/engines/lab/lab.h +++ b/engines/lab/lab.h @@ -88,6 +88,8 @@ public: private: uint32 _extraGameFeatures; bool _interfaceOff; + bool _noUpdateDiff; + bool _quitLab; // timing.cpp void microDelay(uint32 secs, uint32 micros); @@ -110,6 +112,11 @@ public: bool _isCrumbWaiting; bool _alternate; bool _isHiRes; + uint16 _numInv; + uint16 _manyRooms; + uint16 _direction; + uint16 _highestCondition; + const char *_curFileName; const char *_nextFileName; const char *_newFileName; /* When ProcessRoom.c decides to change the filename diff --git a/engines/lab/map.cpp b/engines/lab/map.cpp index 3f20feae8f..8281a498d2 100644 --- a/engines/lab/map.cpp +++ b/engines/lab/map.cpp @@ -41,8 +41,6 @@ namespace Lab { -extern uint16 Direction; - /*---------------------------------------------------------------------------*/ /*------------------------------ The Map stuff ------------------------------*/ /*---------------------------------------------------------------------------*/ @@ -713,13 +711,13 @@ void LabEngine::doMap(uint16 CurRoom) { loadMapData(); _graphics->blackAllScreen(); - if (Direction == NORTH) + if (_direction == NORTH) XMark = MapNorth; - else if (Direction == SOUTH) + else if (_direction == SOUTH) XMark = MapSouth; - else if (Direction == EAST) + else if (_direction == EAST) XMark = MapEast; - else if (Direction == WEST) + else if (_direction == WEST) XMark = MapWest; drawMap(CurRoom, CurRoom, Maps[CurRoom].PageNumber, false, true); diff --git a/engines/lab/processroom.cpp b/engines/lab/processroom.cpp index 45d5584f83..a4d3da293d 100644 --- a/engines/lab/processroom.cpp +++ b/engines/lab/processroom.cpp @@ -45,9 +45,6 @@ namespace Lab { #define NOFILE "no file" RoomData *_rooms; -uint16 NumInv, ManyRooms, HighestCondition, Direction; - -extern bool DoNotDrawMessage, noupdatediff, QuitLab, MusicOn; /*****************************************************************************/ /* Generates a random number. */ @@ -104,7 +101,7 @@ ViewData *getViewData(uint16 roomNum, uint16 direction) { /*****************************************************************************/ static CloseData *getObject(uint16 x, uint16 y, CloseDataPtr lcptr) { if (lcptr == NULL) { - lcptr = getViewData(g_lab->_roomNum, Direction)->closeUps; + lcptr = getViewData(g_lab->_roomNum, g_lab->_direction)->closeUps; } else { lcptr = lcptr->SubCloseUps; } @@ -150,7 +147,7 @@ static CloseDataPtr findCPtrMatch(CloseDataPtr cpmain, CloseDataPtr list) { /* Returns the current picture name. */ /*****************************************************************************/ char *getPictName(CloseDataPtr *lcptr) { - ViewData *viewPtr = getViewData(g_lab->_roomNum, Direction); + ViewData *viewPtr = getViewData(g_lab->_roomNum, g_lab->_direction); if (*lcptr != NULL) { *lcptr = findCPtrMatch(*lcptr, viewPtr->closeUps); @@ -178,13 +175,13 @@ void LabEngine::drawDirection(CloseDataPtr lcptr) { message += ", "; } - if (Direction == NORTH) + if (_direction == NORTH) message += _resource->getStaticText(kTextFacingNorth); - else if (Direction == EAST) + else if (_direction == EAST) message += _resource->getStaticText(kTextFacingEast); - else if (Direction == SOUTH) + else if (_direction == SOUTH) message += _resource->getStaticText(kTextFacingSouth); - else if (Direction == WEST) + else if (_direction == WEST) message += _resource->getStaticText(kTextFacingWest); _graphics->drawMessage(message.c_str()); @@ -241,7 +238,7 @@ void setCurClose(Common::Point pos, CloseDataPtr *cptr, bool useAbsoluteCoords) uint16 x1, y1, x2, y2; if (*cptr == NULL) { - lcptr = getViewData(g_lab->_roomNum, Direction)->closeUps; + lcptr = getViewData(g_lab->_roomNum, g_lab->_direction)->closeUps; } else lcptr = (*cptr)->SubCloseUps; @@ -274,7 +271,7 @@ bool takeItem(uint16 x, uint16 y, CloseDataPtr *cptr) { CloseDataPtr lcptr; if (*cptr == NULL) { - lcptr = getViewData(g_lab->_roomNum, Direction)->closeUps; + lcptr = getViewData(g_lab->_roomNum, g_lab->_direction)->closeUps; } else if ((*cptr)->CloseUpType < 0) { g_lab->_conditions->inclElement(abs((*cptr)->CloseUpType)); return true; @@ -342,7 +339,7 @@ void LabEngine::doActions(Action *aptr, CloseDataPtr *lcptr) { break; case NOUPDATE: - noupdatediff = true; + _noUpdateDiff = true; _anim->_doBlack = false; break; @@ -369,30 +366,30 @@ void LabEngine::doActions(Action *aptr, CloseDataPtr *lcptr) { break; case SHOWMESSAGE: - DoNotDrawMessage = false; + _graphics->_doNotDrawMessage = false; if (_graphics->_longWinInFront) _graphics->longDrawMessage((char *)aptr->Data); else _graphics->drawMessage((char *)aptr->Data); - DoNotDrawMessage = true; + _graphics->_doNotDrawMessage = true; break; case CSHOWMESSAGE: if (*lcptr == NULL) { - DoNotDrawMessage = false; + _graphics->_doNotDrawMessage = false; _graphics->drawMessage((char *)aptr->Data); - DoNotDrawMessage = true; + _graphics->_doNotDrawMessage = true; } break; case SHOWMESSAGES: { char **str = (char **)aptr->Data; - DoNotDrawMessage = false; + _graphics->_doNotDrawMessage = false; _graphics->drawMessage(str[getRandom(aptr->Param1)]); - DoNotDrawMessage = true; + _graphics->_doNotDrawMessage = true; } break; @@ -408,7 +405,7 @@ void LabEngine::doActions(Action *aptr, CloseDataPtr *lcptr) { } _roomNum = aptr->Param1; - Direction = aptr->Param2 - 1; + _direction = aptr->Param2 - 1; *lcptr = NULL; _anim->_doBlack = true; break; @@ -440,7 +437,7 @@ void LabEngine::doActions(Action *aptr, CloseDataPtr *lcptr) { break; case SHOWDIR: - DoNotDrawMessage = false; + _graphics->_doNotDrawMessage = false; break; case WAITSECS: { @@ -509,11 +506,11 @@ void LabEngine::doActions(Action *aptr, CloseDataPtr *lcptr) { break; case WINGAME: - QuitLab = true; + _quitLab = true; break; case LOSTGAME: - QuitLab = true; + _quitLab = true; break; case RESETBUFFER: @@ -695,7 +692,7 @@ bool doGoForward(CloseDataPtr *lcptr) { RuleList *rules = _rooms[g_lab->_roomNum]._rules; for (RuleList::iterator rule = rules->begin(); rule != rules->end(); ++rule) { - if (((*rule)->RuleType == GOFORWARD) && ((*rule)->Param1 == (Direction + 1))) { + if (((*rule)->RuleType == GOFORWARD) && ((*rule)->Param1 == (g_lab->_direction + 1))) { if (checkConditions((*rule)->Condition)) { g_lab->doActions((*rule)->ActionList, lcptr); return true; diff --git a/engines/lab/resource.cpp b/engines/lab/resource.cpp index aaac1cd261..654ce97b24 100644 --- a/engines/lab/resource.cpp +++ b/engines/lab/resource.cpp @@ -35,7 +35,6 @@ namespace Lab { extern RoomData *_rooms; -extern uint16 NumInv, ManyRooms, HighestCondition; Resource::Resource(LabEngine *vm) : _vm(vm) { readStaticText(); @@ -92,12 +91,12 @@ char *Resource::getText(const char *fileName) { bool Resource::readRoomData(const char *fileName) { Common::File *dataFile = openDataFile(fileName, MKTAG('D', 'O', 'R', '1')); - ManyRooms = dataFile->readUint16LE(); - HighestCondition = dataFile->readUint16LE(); - _rooms = (RoomData *)malloc((ManyRooms + 1) * sizeof(RoomData)); - memset(_rooms, 0, (ManyRooms + 1) * sizeof(RoomData)); + _vm->_manyRooms = dataFile->readUint16LE(); + _vm->_highestCondition = dataFile->readUint16LE(); + _rooms = (RoomData *)malloc((_vm->_manyRooms + 1) * sizeof(RoomData)); + memset(_rooms, 0, (_vm->_manyRooms + 1) * sizeof(RoomData)); - for (uint16 i = 1; i <= ManyRooms; i++) { + for (uint16 i = 1; i <= _vm->_manyRooms; i++) { _rooms[i]._northDoor = dataFile->readUint16LE(); _rooms[i]._southDoor = dataFile->readUint16LE(); _rooms[i]._eastDoor = dataFile->readUint16LE(); @@ -119,10 +118,10 @@ bool Resource::readRoomData(const char *fileName) { InventoryData *Resource::readInventory(const char *fileName) { Common::File *dataFile = openDataFile(fileName, MKTAG('I', 'N', 'V', '1')); - NumInv = dataFile->readUint16LE(); - InventoryData *inventory = (InventoryData *)malloc((NumInv + 1) * sizeof(InventoryData)); + _vm->_numInv = dataFile->readUint16LE(); + InventoryData *inventory = (InventoryData *)malloc((_vm->_numInv + 1) * sizeof(InventoryData)); - for (uint16 i = 1; i <= NumInv; i++) { + for (uint16 i = 1; i <= _vm->_numInv; i++) { inventory[i].Many = dataFile->readUint16LE(); inventory[i].name = readString(dataFile); inventory[i].BInvName = readString(dataFile); diff --git a/engines/lab/special.cpp b/engines/lab/special.cpp index 7c7dcb1477..01b114fede 100644 --- a/engines/lab/special.cpp +++ b/engines/lab/special.cpp @@ -63,7 +63,6 @@ Image *MonButton; extern uint16 *FadePalette; extern BitMap *DispBitMap, *DrawBitMap; -extern uint16 Direction; #define INCL(BITSET,BIT) ((BITSET) |= (BIT)) #define SETBIT(BITSET,BITNUM) INCL(BITSET, (1 << (BITNUM))) @@ -431,14 +430,14 @@ bool LabEngine::saveRestoreGame() { desc = dialog->createDefaultSaveDescription(slot); } - isOK = saveGame(Direction, _inventory[QUARTERNUM].Many, slot, desc); + isOK = saveGame(_direction, _inventory[QUARTERNUM].Many, slot, desc); } } else { // Restore GUI::SaveLoadChooser *dialog = new GUI::SaveLoadChooser(_("Restore game:"), _("Restore"), false); int slot = dialog->runModalWithCurrentTarget(); if (slot >= 0) { - isOK = loadGame(&Direction, &(_inventory[QUARTERNUM].Many), slot); + isOK = loadGame(&_direction, &(_inventory[QUARTERNUM].Many), slot); if (isOK) _music->resetMusic(); } -- cgit v1.2.3 From 785772e86f2f1a15a0f5154e25203b5b94e5087a Mon Sep 17 00:00:00 2001 From: Strangerke Date: Sun, 6 Dec 2015 18:16:26 +0100 Subject: LAB: Move fade functions to DisplayMan, some renaming --- engines/lab/engine.cpp | 4 +-- engines/lab/graphics.cpp | 33 ++++++++++++++++++ engines/lab/graphics.h | 5 +++ engines/lab/intro.cpp | 24 ++++++------- engines/lab/lab.cpp | 7 ++-- engines/lab/lab.h | 8 ++--- engines/lab/labfun.h | 6 ---- engines/lab/map.cpp | 86 +++++++++++++--------------------------------- engines/lab/savegame.cpp | 8 ++--- engines/lab/special.cpp | 18 +++++----- engines/lab/tilepuzzle.cpp | 58 +++++++++++++++---------------- 11 files changed, 124 insertions(+), 133 deletions(-) diff --git a/engines/lab/engine.cpp b/engines/lab/engine.cpp index 158286fdfb..8af38d86b6 100644 --- a/engines/lab/engine.cpp +++ b/engines/lab/engine.cpp @@ -122,8 +122,8 @@ void LabEngine::freeScreens() { for (uint16 imgIdx = 0; imgIdx < 10; imgIdx++) { delete _invImages[imgIdx]; - delete Images[imgIdx]; - _invImages[imgIdx] = Images[imgIdx] = nullptr; + delete _numberImages[imgIdx]; + _invImages[imgIdx] = _numberImages[imgIdx] = nullptr; } } diff --git a/engines/lab/graphics.cpp b/engines/lab/graphics.cpp index babc5502dd..52f92e5b9e 100644 --- a/engines/lab/graphics.cpp +++ b/engines/lab/graphics.cpp @@ -53,6 +53,7 @@ DisplayMan::DisplayMan(LabEngine *vm) : _vm(vm) { _displayBuffer = nullptr; _currentDisplayBuffer = nullptr; _tempScrollData = nullptr; + FadePalette = nullptr; _screenWidth = 0; _screenHeight = 0; @@ -1164,4 +1165,36 @@ void DisplayMan::scrollDisplayY(int16 dy, uint16 x1, uint16 y1, uint16 x2, uint1 rectFill(x1, y1, x2, y1 + dy - 1); } +/*****************************************************************************/ +/* Does the fading of the Palette on the screen. */ +/*****************************************************************************/ +uint16 DisplayMan::fadeNumIn(uint16 num, uint16 res, uint16 counter) { + return (num - ((((int32)(15 - counter)) * ((int32)(num - res))) / 15)); +} + + +uint16 DisplayMan::fadeNumOut(uint16 num, uint16 res, uint16 counter) { + return (num - ((((int32) counter) * ((int32)(num - res))) / 15)); +} + +void DisplayMan::fade(bool fadein, uint16 res) { + uint16 newpal[16]; + + for (uint16 i = 0; i < 16; i++) { + for (uint16 palIdx = 0; palIdx < 16; palIdx++) { + if (fadein) + newpal[palIdx] = (0x00F & fadeNumIn(0x00F & FadePalette[palIdx], 0x00F & res, i)) + + (0x0F0 & fadeNumIn(0x0F0 & FadePalette[palIdx], 0x0F0 & res, i)) + + (0xF00 & fadeNumIn(0xF00 & FadePalette[palIdx], 0xF00 & res, i)); + else + newpal[palIdx] = (0x00F & fadeNumOut(0x00F & FadePalette[palIdx], 0x00F & res, i)) + + (0x0F0 & fadeNumOut(0x0F0 & FadePalette[palIdx], 0x0F0 & res, i)) + + (0xF00 & fadeNumOut(0xF00 & FadePalette[palIdx], 0xF00 & res, i)); + } + + g_lab->_graphics->setAmigaPal(newpal, 16); + g_lab->waitTOF(); + g_lab->_music->updateMusic(); + } +} } // End of namespace Lab diff --git a/engines/lab/graphics.h b/engines/lab/graphics.h index 979d73ff17..564f041607 100644 --- a/engines/lab/graphics.h +++ b/engines/lab/graphics.h @@ -41,6 +41,9 @@ class DisplayMan { private: LabEngine *_vm; + uint16 fadeNumIn(uint16 num, uint16 res, uint16 counter); + uint16 fadeNumOut(uint16 num, uint16 res, uint16 counter); + byte _curapen; byte *_curBitmap; byte _curvgapal[256 * 3]; @@ -125,6 +128,7 @@ public: byte *getCurrentDrawingBuffer(); void scrollDisplayX(int16 dx, uint16 x1, uint16 y1, uint16 x2, uint16 y2); void scrollDisplayY(int16 dy, uint16 x1, uint16 y1, uint16 x2, uint16 y2); + void fade(bool fadein, uint16 res); bool _longWinInFront; bool _lastMessageLong; @@ -134,6 +138,7 @@ public: byte *_displayBuffer; byte *_currentDisplayBuffer; bool _doNotDrawMessage; + uint16 *FadePalette; }; } // End of namespace Lab diff --git a/engines/lab/intro.cpp b/engines/lab/intro.cpp index 0313733084..070b03fd3c 100644 --- a/engines/lab/intro.cpp +++ b/engines/lab/intro.cpp @@ -33,8 +33,6 @@ #include "lab/anim.h" namespace Lab { -extern uint16 *FadePalette; - Intro::Intro(LabEngine *vm) : _vm(vm) { _quitIntro = false; } @@ -101,14 +99,14 @@ void Intro::doPictText(const char *filename, TextFont *msgFont, bool isScreen) { if (begin) begin = false; else if (isScreen) - fade(false, 0); + _vm->_graphics->fade(false, 0); if (isScreen) { _vm->_graphics->setAPen(7); _vm->_graphics->rectFillScaled(10, 10, 310, 190); Drawn = _vm->_graphics->flowTextScaled(msgFont, (!_vm->_isHiRes) * -1, 5, 7, false, false, true, true, 14, 11, 306, 189, (char *)curText); - fade(true, 0); + _vm->_graphics->fade(true, 0); } else { Drawn = _vm->_graphics->longDrawMessage((char *)curText); } @@ -122,7 +120,7 @@ void Intro::doPictText(const char *filename, TextFont *msgFont, bool isScreen) { if (_quitIntro) { if (isScreen) - fade(false, 0); + _vm->_graphics->fade(false, 0); delete[] textBuffer; return; @@ -142,7 +140,7 @@ void Intro::doPictText(const char *filename, TextFont *msgFont, bool isScreen) { if (secs > timeDelay) { if (end) { if (isScreen) - fade(false, 0); + _vm->_graphics->fade(false, 0); delete[] textBuffer; return; @@ -162,7 +160,7 @@ void Intro::doPictText(const char *filename, TextFont *msgFont, bool isScreen) { _quitIntro = true; if (isScreen) - fade(false, 0); + _vm->_graphics->fade(false, 0); delete[] textBuffer; return; @@ -172,7 +170,7 @@ void Intro::doPictText(const char *filename, TextFont *msgFont, bool isScreen) { if (IEQUALIFIER_LEFTBUTTON & qualifier) { if (end) { if (isScreen) - fade(false, 0); + _vm->_graphics->fade(false, 0); delete[] textBuffer; return; @@ -184,7 +182,7 @@ void Intro::doPictText(const char *filename, TextFont *msgFont, bool isScreen) { if (_quitIntro) { if (isScreen) - fade(false, 0); + _vm->_graphics->fade(false, 0); delete[] textBuffer; return; @@ -193,7 +191,7 @@ void Intro::doPictText(const char *filename, TextFont *msgFont, bool isScreen) { if (end) { if (isScreen) - fade(false, 0); + _vm->_graphics->fade(false, 0); delete[] textBuffer; return; @@ -273,7 +271,7 @@ void Intro::introSequence() { nReadPict("TNDcycle2.pic", true); _vm->_anim->_noPalChange = false; - FadePalette = palette; + _vm->_graphics->FadePalette = palette; for (uint16 i = 0; i < 16; i++) { if (_quitIntro) @@ -285,7 +283,7 @@ void Intro::introSequence() { } _vm->_music->updateMusic(); - fade(true, 0); + _vm->_graphics->fade(true, 0); for (int times = 0; times < 150; times++) { if (_quitIntro) @@ -303,7 +301,7 @@ void Intro::introSequence() { _vm->waitTOF(); } - fade(false, 0); + _vm->_graphics->fade(false, 0); _vm->_graphics->blackAllScreen(); _vm->_music->updateMusic(); diff --git a/engines/lab/lab.cpp b/engines/lab/lab.cpp index f9de51b41f..5f2a4d5f10 100644 --- a/engines/lab/lab.cpp +++ b/engines/lab/lab.cpp @@ -95,9 +95,12 @@ LabEngine::LabEngine(OSystem *syst, const ADGameDescription *gameDesc) for (int i = 0; i < 10; i++) { _invImages[i] = nullptr; - Images[i] = nullptr; + _numberImages[i] = nullptr; } + for (int i = 0; i < 16; i++) + _tiles[i] = nullptr; + _moveGadgetList = nullptr; _invGadgetList = nullptr; _curFileName = nullptr; @@ -128,7 +131,7 @@ LabEngine::~LabEngine() { delete _graphics; for (int i = 0; i < 16; i++) - delete Tiles[i]; + delete _tiles[i]; } Common::Error LabEngine::run() { diff --git a/engines/lab/lab.h b/engines/lab/lab.h index 5675a0ccaf..384b5599ed 100644 --- a/engines/lab/lab.h +++ b/engines/lab/lab.h @@ -126,16 +126,16 @@ public: Gadget *_invGadgetList; Image *_moveImages[20]; Image *_invImages[10]; - Image *Images[10]; - uint16 CurTile[4][4]; - byte combination[6]; + Image *_numberImages[10]; + uint16 _curTile[4][4]; + byte _combination[6]; private: int _lastWaitTOFTicks; bool _lastTooLong; CloseDataPtr _cptr; InventoryData *_inventory; - Image *Tiles[16]; + Image *_tiles[16]; private: bool from_crumbs(uint32 tmpClass, uint16 code, uint16 Qualifier, Common::Point tmpPos, uint16 &curInv, IntuiMessage * curMsg, bool &forceDraw, uint16 gadgetId, uint16 &actionMode); diff --git a/engines/lab/labfun.h b/engines/lab/labfun.h index d58b27ecc8..c56dbcdd5b 100644 --- a/engines/lab/labfun.h +++ b/engines/lab/labfun.h @@ -70,12 +70,6 @@ struct SaveGameHeader { bool readMusic(const char *filename, bool waitTillFinished); -/*---------------------------*/ -/*-------- From Map.c -------*/ -/*---------------------------*/ - -void fade(bool fadein, uint16 res); - /*--------------------------*/ /*----- From saveGame.c ----*/ /*--------------------------*/ diff --git a/engines/lab/map.cpp b/engines/lab/map.cpp index 8281a498d2..218aae4213 100644 --- a/engines/lab/map.cpp +++ b/engines/lab/map.cpp @@ -56,8 +56,6 @@ static MapData *Maps; extern char *LOWERFLOORS, *MIDDLEFLOORS, *UPPERFLOORS, *MEDMAZEFLOORS, *HEDGEMAZEFLOORS, *SURMAZEFLOORS, *CARNIVALFLOOR, *SURMAZEMSG; -uint16 *FadePalette; - static uint16 MapGadX[3] = {101, 55, 8}, MapGadY[3] = {105, 105, 105}; static Gadget downgadget = { 101, 105, 2, VKEY_DNARROW, 0L, NULL, NULL, NULL }, @@ -66,14 +64,6 @@ static Gadget downgadget = { 101, 105, 2, VKEY_DNARROW, 0L, NULL, NULL, NULL }, static Gadget *MapGadgetList = &backgadget; -static uint16 AmigaMapPalette[] = { - 0x0BA8, 0x0C11, 0x0A74, 0x0076, - 0x0A96, 0x0DCB, 0x0CCA, 0x0222, - 0x0444, 0x0555, 0x0777, 0x0999, - 0x0AAA, 0x0ED0, 0x0EEE, 0x0694 -}; - - #define LOWERFLOOR 1 #define MIDDLEFLOOR 2 #define UPPERFLOOR 3 @@ -167,48 +157,11 @@ static bool loadMapData() { return true; } - static void freeMapData() { delete[] Maps; Maps = NULL; } - -static uint16 fadeNumIn(uint16 num, uint16 res, uint16 counter) { - return (num - ((((int32)(15 - counter)) * ((int32)(num - res))) / 15)); -} - - -static uint16 fadeNumOut(uint16 num, uint16 res, uint16 counter) { - return (num - ((((int32) counter) * ((int32)(num - res))) / 15)); -} - - - -/*****************************************************************************/ -/* Does the fading of the Palette on the screen. */ -/*****************************************************************************/ -void fade(bool fadein, uint16 res) { - uint16 newpal[16]; - - for (uint16 i = 0; i < 16; i++) { - for (uint16 palIdx = 0; palIdx < 16; palIdx++) { - if (fadein) - newpal[palIdx] = (0x00F & fadeNumIn(0x00F & FadePalette[palIdx], 0x00F & res, i)) + - (0x0F0 & fadeNumIn(0x0F0 & FadePalette[palIdx], 0x0F0 & res, i)) + - (0xF00 & fadeNumIn(0xF00 & FadePalette[palIdx], 0xF00 & res, i)); - else - newpal[palIdx] = (0x00F & fadeNumOut(0x00F & FadePalette[palIdx], 0x00F & res, i)) + - (0x0F0 & fadeNumOut(0x0F0 & FadePalette[palIdx], 0x0F0 & res, i)) + - (0xF00 & fadeNumOut(0xF00 & FadePalette[palIdx], 0xF00 & res, i)); - } - - g_lab->_graphics->setAmigaPal(newpal, 16); - g_lab->waitTOF(); - g_lab->_music->updateMusic(); - } -} - /*****************************************************************************/ /* Figures out what a room's coordinates should be. */ /*****************************************************************************/ @@ -460,7 +413,7 @@ void LabEngine::drawMap(uint16 CurRoom, uint16 CurMsg, uint16 Floor, bool fadeou _event->mouseHide(); if (fadeout) - fade(false, 0); + _graphics->fade(false, 0); _graphics->setAPen(0); _graphics->rectFill(0, 0, _graphics->_screenWidth - 1, _graphics->_screenHeight - 1); @@ -523,7 +476,7 @@ void LabEngine::drawMap(uint16 CurRoom, uint16 CurMsg, uint16 Floor, bool fadeou _graphics->flowTextScaled(_msgFont, 0, 5, 3, true, true, true, true, 14, 148, 134, 186, sptr); if (fadein) - fade(true, 0); + _graphics->fade(true, 0); _event->mouseShow(); } @@ -594,9 +547,9 @@ void LabEngine::processMap(uint16 CurRoom) { getUpFloor(&CurFloor, &drawmap); if (drawmap) { - fade(false, 0); + _graphics->fade(false, 0); drawMap(CurRoom, CurMsg, CurFloor, false, false); - fade(true, 0); + _graphics->fade(true, 0); } else CurFloor = OldFloor; } else if (GadgetID == 2) { /* Down arrow */ @@ -604,9 +557,9 @@ void LabEngine::processMap(uint16 CurRoom) { getDownFloor(&CurFloor, &drawmap); if (drawmap) { - fade(false, 0); + _graphics->fade(false, 0); drawMap(CurRoom, CurMsg, CurFloor, false, false); - fade(true, 0); + _graphics->fade(true, 0); } else CurFloor = OldFloor; } @@ -618,9 +571,9 @@ void LabEngine::processMap(uint16 CurRoom) { && onFloor(SURMAZEFLOOR)) { CurFloor = SURMAZEFLOOR; - fade(false, 0); + _graphics->fade(false, 0); drawMap(CurRoom, CurMsg, CurFloor, false, false); - fade(true, 0); + _graphics->fade(true, 0); } else if ((CurFloor == MIDDLEFLOOR) && (MouseX >= mapScaleX(358)) && (MouseY >= mapScaleY(71)) @@ -628,9 +581,9 @@ void LabEngine::processMap(uint16 CurRoom) { && onFloor(CARNIVAL)) { CurFloor = CARNIVAL; - fade(false, 0); + _graphics->fade(false, 0); drawMap(CurRoom, CurMsg, CurFloor, false, false); - fade(true, 0); + _graphics->fade(true, 0); } else if ((CurFloor == MIDDLEFLOOR) && (MouseX >= mapScaleX(557)) && (MouseY >= mapScaleY(325)) @@ -638,9 +591,9 @@ void LabEngine::processMap(uint16 CurRoom) { && onFloor(MEDMAZEFLOOR)) { CurFloor = MEDMAZEFLOOR; - fade(false, 0); + _graphics->fade(false, 0); drawMap(CurRoom, CurMsg, CurFloor, false, false); - fade(true, 0); + _graphics->fade(true, 0); } else if ((CurFloor == UPPERFLOOR) && (MouseX >= mapScaleX(524)) && (MouseY >= mapScaleY(97)) @@ -648,9 +601,9 @@ void LabEngine::processMap(uint16 CurRoom) { && onFloor(HEDGEMAZEFLOOR)) { CurFloor = HEDGEMAZEFLOOR; - fade(false, 0); + _graphics->fade(false, 0); drawMap(CurRoom, CurMsg, CurFloor, false, false); - fade(true, 0); + _graphics->fade(true, 0); } else if (MouseX > mapScaleX(314)) { @@ -705,7 +658,14 @@ void LabEngine::processMap(uint16 CurRoom) { /* Does the map processing. */ /*****************************************************************************/ void LabEngine::doMap(uint16 CurRoom) { - FadePalette = AmigaMapPalette; + static uint16 AmigaMapPalette[] = { + 0x0BA8, 0x0C11, 0x0A74, 0x0076, + 0x0A96, 0x0DCB, 0x0CCA, 0x0222, + 0x0444, 0x0555, 0x0777, 0x0999, + 0x0AAA, 0x0ED0, 0x0EEE, 0x0694 + }; + + _graphics->FadePalette = AmigaMapPalette; _music->updateMusic(); loadMapData(); @@ -726,7 +686,7 @@ void LabEngine::doMap(uint16 CurRoom) { _graphics->screenUpdate(); processMap(CurRoom); _event->attachGadgetList(NULL); - fade(false, 0); + _graphics->fade(false, 0); _graphics->blackAllScreen(); _event->mouseHide(); _graphics->setAPen(0); diff --git a/engines/lab/savegame.cpp b/engines/lab/savegame.cpp index cfb636fa58..133e4b1d70 100644 --- a/engines/lab/savegame.cpp +++ b/engines/lab/savegame.cpp @@ -146,12 +146,12 @@ bool saveGame(uint16 Direction, uint16 Quarters, int slot, Common::String desc) // Combination lock and tile stuff for (i = 0; i < 6; i++) - file->writeByte(g_lab->combination[i]); + file->writeByte(g_lab->_combination[i]); // Tiles for (i = 0; i < 4; i++) for (j = 0; j < 4; j++) - file->writeUint16LE(g_lab->CurTile[i][j]); + file->writeUint16LE(g_lab->_curTile[i][j]); // Breadcrumbs for (i = 0; i < sizeof(g_lab->_breadCrumbs); i++) { @@ -196,12 +196,12 @@ bool loadGame(uint16 *Direction, uint16 *Quarters, int slot) { // Combination lock and tile stuff for (i = 0; i < 6; i++) - g_lab->combination[i] = file->readByte(); + g_lab->_combination[i] = file->readByte(); // Tiles for (i = 0; i < 4; i++) for (j = 0; j < 4; j++) - g_lab->CurTile[i][j] = file->readUint16LE(); + g_lab->_curTile[i][j] = file->readUint16LE(); // Breadcrumbs for (i = 0; i < 128; i++) { diff --git a/engines/lab/special.cpp b/engines/lab/special.cpp index 01b114fede..c4751ce9b6 100644 --- a/engines/lab/special.cpp +++ b/engines/lab/special.cpp @@ -60,8 +60,6 @@ static uint16 monitorPage; static const char *TextFileName; Image *MonButton; - -extern uint16 *FadePalette; extern BitMap *DispBitMap, *DrawBitMap; #define INCL(BITSET,BIT) ((BITSET) |= (BIT)) @@ -78,7 +76,7 @@ extern BitMap *DispBitMap, *DrawBitMap; static byte *loadBackPict(const char *fileName, bool tomem) { byte *res = nullptr; - FadePalette = hipal; + g_lab->_graphics->FadePalette = hipal; g_lab->_anim->_noPalChange = true; if (tomem) @@ -316,7 +314,7 @@ void LabEngine::drawJournal(uint16 wipenum, bool needFade) { if (needFade) - fade(true, 0); + _graphics->fade(true, 0); g_lab->_anim->_noPalChange = true; JBackImage._imageData = _graphics->readPictToMem("P:Journal.pic", _graphics->_screenWidth, _graphics->_screenHeight); @@ -398,7 +396,7 @@ void LabEngine::doJournal() { _event->mouseShow(); processJournal(); _event->attachGadgetList(NULL); - fade(false, 0); + _graphics->fade(false, 0); _event->mouseHide(); ScreenImage._imageData = _graphics->getCurrentDrawingBuffer(); @@ -536,9 +534,9 @@ void LabEngine::processMonitor(char *ntext, TextFont *monitorFont, bool isintera TextFileName = Test; ntext = g_lab->_resource->getText(TextFileName); - fade(false, 0); + _graphics->fade(false, 0); drawMonText(ntext, monitorFont, x1, y1, x2, y2, isinteractive); - fade(true, 0); + _graphics->fade(true, 0); delete[] ntext; } } @@ -624,7 +622,7 @@ void LabEngine::doMonitor(char *background, char *textfile, bool isinteractive, monitorPage = 0; lastpage = false; - FadePalette = hipal; + _graphics->FadePalette = hipal; TextFont *monitorFont = _resource->getFont("P:Map.fon"); Common::File *buttonFile = g_lab->_resource->openDataFile("P:MonImage"); @@ -635,9 +633,9 @@ void LabEngine::doMonitor(char *background, char *textfile, bool isinteractive, loadBackPict(background, false); drawMonText(ntext, monitorFont, x1, y1, x2, y2, isinteractive); _event->mouseShow(); - fade(true, 0); + _graphics->fade(true, 0); processMonitor(ntext, monitorFont, isinteractive, x1, y1, x2, y2); - fade(false, 0); + _graphics->fade(false, 0); _event->mouseHide(); delete[] ntext; closeFont(monitorFont); diff --git a/engines/lab/tilepuzzle.cpp b/engines/lab/tilepuzzle.cpp index 1cee9d3fde..5ab0454086 100644 --- a/engines/lab/tilepuzzle.cpp +++ b/engines/lab/tilepuzzle.cpp @@ -51,15 +51,15 @@ const int COMBINATION_X[6] = { 45, 83, 129, 166, 211, 248 }; void LabEngine::initTilePuzzle() { for (int i = 0; i < 16; i++) - Tiles[i] = nullptr; + _tiles[i] = nullptr; for (int i = 0; i < 4; i++) { for (int j = 0; j < 4; j++) - CurTile[i][j] = INIT_TILE[i][j]; + _curTile[i][j] = INIT_TILE[i][j]; } for (int i = 0; i < 6; i++) - combination[i] = 0; + _combination[i] = 0; } /*****************************************************************************/ @@ -106,33 +106,33 @@ void LabEngine::changeTile(uint16 col, uint16 row) { int16 scrolltype = -1; if (row > 0) { - if (CurTile[col] [row - 1] == 0) { - CurTile[col] [row - 1] = CurTile[col] [row]; - CurTile[col] [row] = 0; + if (_curTile[col] [row - 1] == 0) { + _curTile[col] [row - 1] = _curTile[col] [row]; + _curTile[col] [row] = 0; scrolltype = DOWNSCROLL; } } if (col > 0) { - if (CurTile[col - 1] [row] == 0) { - CurTile[col - 1] [row] = CurTile[col] [row]; - CurTile[col] [row] = 0; + if (_curTile[col - 1] [row] == 0) { + _curTile[col - 1] [row] = _curTile[col] [row]; + _curTile[col] [row] = 0; scrolltype = RIGHTSCROLL; } } if (row < 3) { - if (CurTile[col] [row + 1] == 0) { - CurTile[col] [row + 1] = CurTile[col] [row]; - CurTile[col] [row] = 0; + if (_curTile[col] [row + 1] == 0) { + _curTile[col] [row + 1] = _curTile[col] [row]; + _curTile[col] [row] = 0; scrolltype = UPSCROLL; } } if (col < 3) { - if (CurTile[col + 1] [row] == 0) { - CurTile[col + 1] [row] = CurTile[col] [row]; - CurTile[col] [row] = 0; + if (_curTile[col + 1] [row] == 0) { + _curTile[col + 1] [row] = _curTile[col] [row]; + _curTile[col] [row] = 0; scrolltype = LEFTSCROLL; } } @@ -152,7 +152,7 @@ void LabEngine::changeTile(uint16 col, uint16 row) { while (row < 4) { while (col < 4) { - check = check && (CurTile[row] [col] == SOLUTION[row] [col]); + check = check && (_curTile[row] [col] == SOLUTION[row] [col]); col++; } @@ -226,10 +226,10 @@ void LabEngine::doTile(bool showsolution) { if (showsolution) num = SOLUTION[col] [row]; else - num = CurTile[col] [row]; + num = _curTile[col] [row]; if (showsolution || num) - Tiles[num]->drawImage(cols + (col * colm), rows + (row * rowm)); + _tiles[num]->drawImage(cols + (col * colm), rows + (row * rowm)); col++; } @@ -254,7 +254,7 @@ void LabEngine::showTile(const char *filename, bool showsolution) { Common::File *tileFile = tileFile = _resource->openDataFile(showsolution ? "P:TileSolution" : "P:Tile"); for (uint16 curBit = start; curBit < 16; curBit++) - Tiles[curBit] = new Image(tileFile); + _tiles[curBit] = new Image(tileFile); delete tileFile; @@ -312,18 +312,18 @@ void LabEngine::changeCombination(uint16 number) { uint16 combnum; bool unlocked = true; - if (combination[number] < 9) - (combination[number])++; + if (_combination[number] < 9) + (_combination[number])++; else - combination[number] = 0; + _combination[number] = 0; - combnum = combination[number]; + combnum = _combination[number]; display._imageData = _graphics->getCurrentDrawingBuffer(); display._width = _graphics->_screenWidth; display._height = _graphics->_screenHeight; - for (uint16 i = 1; i <= (Images[combnum]->_height / 2); i++) { + for (uint16 i = 1; i <= (_numberImages[combnum]->_height / 2); i++) { if (_isHiRes) { if (i & 1) waitTOF(); @@ -331,12 +331,12 @@ void LabEngine::changeCombination(uint16 number) { waitTOF(); display._imageData = _graphics->getCurrentDrawingBuffer(); - _graphics->scrollDisplayY(2, _graphics->VGAScaleX(COMBINATION_X[number]), _graphics->VGAScaleY(65), _graphics->VGAScaleX(COMBINATION_X[number]) + (Images[combnum])->_width - 1, _graphics->VGAScaleY(65) + (Images[combnum])->_height); - Images[combnum]->blitBitmap(0, (Images[combnum])->_height - (2 * i), &(display), _graphics->VGAScaleX(COMBINATION_X[number]), _graphics->VGAScaleY(65), (Images[combnum])->_width, 2, false); + _graphics->scrollDisplayY(2, _graphics->VGAScaleX(COMBINATION_X[number]), _graphics->VGAScaleY(65), _graphics->VGAScaleX(COMBINATION_X[number]) + (_numberImages[combnum])->_width - 1, _graphics->VGAScaleY(65) + (_numberImages[combnum])->_height); + _numberImages[combnum]->blitBitmap(0, (_numberImages[combnum])->_height - (2 * i), &(display), _graphics->VGAScaleX(COMBINATION_X[number]), _graphics->VGAScaleY(65), (_numberImages[combnum])->_width, 2, false); } for (uint16 i = 0; i < 6; i++) - unlocked = (combination[i] == solution[i]) && unlocked; + unlocked = (_combination[i] == solution[i]) && unlocked; if (unlocked) _conditions->inclElement(COMBINATIONUNLOCKED); @@ -357,7 +357,7 @@ void LabEngine::scrollRaster(int16 dx, int16 dy, uint16 x1, uint16 y1, uint16 x2 /*****************************************************************************/ void LabEngine::doCombination() { for (uint16 i = 0; i <= 5; i++) - Images[combination[i]]->drawImage(_graphics->VGAScaleX(COMBINATION_X[i]), _graphics->VGAScaleY(65)); + _numberImages[_combination[i]]->drawImage(_graphics->VGAScaleX(COMBINATION_X[i]), _graphics->VGAScaleY(65)); } /*****************************************************************************/ @@ -374,7 +374,7 @@ void LabEngine::showCombination(const char *filename) { Common::File *numFile = _resource->openDataFile("P:Numbers"); for (uint16 CurBit = 0; CurBit < 10; CurBit++) - Images[CurBit] = new Image(numFile); + _numberImages[CurBit] = new Image(numFile); delete numFile; -- cgit v1.2.3 From a9dc3a930241e0d6bb878d70dd98a5511572cc1c Mon Sep 17 00:00:00 2001 From: Strangerke Date: Sun, 6 Dec 2015 18:31:57 +0100 Subject: LAB: Remove some useless uses of g_lab --- engines/lab/engine.cpp | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/engines/lab/engine.cpp b/engines/lab/engine.cpp index 8af38d86b6..e371858e9a 100644 --- a/engines/lab/engine.cpp +++ b/engines/lab/engine.cpp @@ -1105,7 +1105,7 @@ int LabEngine::followCrumbs() { uint32 Secs; uint32 Micros; - g_lab->timeDiff(_crumbSecs, _crumbMicros, &Secs, &Micros); + timeDiff(_crumbSecs, _crumbMicros, &Secs, &Micros); if (Secs != 0 || Micros != 0) return 0; @@ -1117,7 +1117,7 @@ int LabEngine::followCrumbs() { _breadCrumbs[_numCrumbs--]._roomNum = 0; // Is the current crumb this room? If not, logic error. - if (g_lab->_roomNum != _breadCrumbs[_numCrumbs]._roomNum) { + if (_roomNum != _breadCrumbs[_numCrumbs]._roomNum) { _numCrumbs = 0; _breadCrumbs[0]._roomNum = 0; _droppingCrumbs = false; @@ -1150,7 +1150,7 @@ int LabEngine::followCrumbs() { _isCrumbTurning = (moveDir != VKEY_UPARROW); _isCrumbWaiting = true; - g_lab->addCurTime(theDelay / ONESECOND, theDelay % ONESECOND, &_crumbSecs, &_crumbMicros); + addCurTime(theDelay / ONESECOND, theDelay % ONESECOND, &_crumbSecs, &_crumbMicros); } return moveDir; -- cgit v1.2.3 From b3269dc80d2a2e1dca9ac24854578befe5004f4f Mon Sep 17 00:00:00 2001 From: Strangerke Date: Sun, 6 Dec 2015 18:32:48 +0100 Subject: LAB: Move readMusic to the Music class --- engines/lab/graphics.cpp | 17 ----------------- engines/lab/labfun.h | 6 ------ engines/lab/music.cpp | 18 ++++++++++++++++++ engines/lab/music.h | 1 + engines/lab/processroom.cpp | 6 +++--- 5 files changed, 22 insertions(+), 26 deletions(-) diff --git a/engines/lab/graphics.cpp b/engines/lab/graphics.cpp index 52f92e5b9e..6c93b516fa 100644 --- a/engines/lab/graphics.cpp +++ b/engines/lab/graphics.cpp @@ -181,23 +181,6 @@ void DisplayMan::freePict() { _curBitmap = NULL; } -/*****************************************************************************/ -/* Reads in a music file. Ignores any graphics. */ -/*****************************************************************************/ -bool readMusic(const char *filename, bool waitTillFinished) { - Common::File *file = g_lab->_resource->openDataFile(filename, MKTAG('D', 'I', 'F', 'F')); - g_lab->_music->updateMusic(); - if (!g_lab->_music->_doNotFilestopSoundEffect) - g_lab->_music->stopSoundEffect(); - if (!file) - return false; - - g_lab->_anim->_doBlack = false; - g_lab->_anim->readSound(waitTillFinished, file); - - return true; -} - /*---------------------------------------------------------------------------*/ /*------------ Does all the text rendering to the message boxes. ------------*/ /*---------------------------------------------------------------------------*/ diff --git a/engines/lab/labfun.h b/engines/lab/labfun.h index c56dbcdd5b..80291f617b 100644 --- a/engines/lab/labfun.h +++ b/engines/lab/labfun.h @@ -64,12 +64,6 @@ struct SaveGameHeader { uint16 _direction; }; -/*----------------------------*/ -/*----- From graphics.c ------*/ -/*----------------------------*/ - -bool readMusic(const char *filename, bool waitTillFinished); - /*--------------------------*/ /*----- From saveGame.c ----*/ /*--------------------------*/ diff --git a/engines/lab/music.cpp b/engines/lab/music.cpp index 0f42064a5c..66db0d8493 100644 --- a/engines/lab/music.cpp +++ b/engines/lab/music.cpp @@ -308,4 +308,22 @@ void Music::resetMusic() { _tFile = 0; } +/*****************************************************************************/ +/* Reads in a music file. Ignores any graphics. */ +/*****************************************************************************/ +bool Music::readMusic(const char *filename, bool waitTillFinished) { + Common::File *file = _vm->_resource->openDataFile(filename, MKTAG('D', 'I', 'F', 'F')); + updateMusic(); + if (!_doNotFilestopSoundEffect) + stopSoundEffect(); + + if (!file) + return false; + + _vm->_anim->_doBlack = false; + _vm->_anim->readSound(waitTillFinished, file); + + return true; +} + } // End of namespace Lab diff --git a/engines/lab/music.h b/engines/lab/music.h index a94fae589e..d292e9ed9c 100644 --- a/engines/lab/music.h +++ b/engines/lab/music.h @@ -67,6 +67,7 @@ public: void playSoundEffect(uint16 SampleSpeed, uint32 Length, void *Data); void stopSoundEffect(); bool isSoundEffectActive() const; + bool readMusic(const char *filename, bool waitTillFinished); bool _winmusic, _doNotFilestopSoundEffect; bool _musicOn; diff --git a/engines/lab/processroom.cpp b/engines/lab/processroom.cpp index a4d3da293d..932649cb7e 100644 --- a/engines/lab/processroom.cpp +++ b/engines/lab/processroom.cpp @@ -304,20 +304,20 @@ void LabEngine::doActions(Action *aptr, CloseDataPtr *lcptr) { case PLAYSOUND: _music->_loopSoundEffect = false; _music->_waitTillFinished = true; - readMusic((char *)aptr->Data, true); + _music->readMusic((char *)aptr->Data, true); _music->_waitTillFinished = false; break; case PLAYSOUNDB: _music->_loopSoundEffect = false; _music->_waitTillFinished = false; - readMusic((char *)aptr->Data, false); + _music->readMusic((char *)aptr->Data, false); break; case PLAYSOUNDCONT: _music->_doNotFilestopSoundEffect = true; _music->_loopSoundEffect = true; - readMusic((char *)aptr->Data, _music->_waitTillFinished); + _music->readMusic((char *)aptr->Data, _music->_waitTillFinished); break; case SHOWDIFF: -- cgit v1.2.3 From 803dbcee90bad321532dea54219697aaec34608a Mon Sep 17 00:00:00 2001 From: Strangerke Date: Sun, 6 Dec 2015 21:39:41 +0100 Subject: LAB: Move _rooms to LabEngine, some renaming --- engines/lab/engine.cpp | 132 ++++++++++++++++++++++---------------------- engines/lab/lab.cpp | 5 +- engines/lab/lab.h | 3 +- engines/lab/map.cpp | 2 - engines/lab/music.cpp | 4 +- engines/lab/music.h | 2 +- engines/lab/parsetypes.h | 9 +-- engines/lab/processroom.cpp | 28 +++++----- engines/lab/resource.cpp | 42 +++++++------- 9 files changed, 109 insertions(+), 118 deletions(-) diff --git a/engines/lab/engine.cpp b/engines/lab/engine.cpp index e371858e9a..f3d13610e3 100644 --- a/engines/lab/engine.cpp +++ b/engines/lab/engine.cpp @@ -41,9 +41,7 @@ namespace Lab { /* Global parser data */ -extern RoomData *_rooms; - -bool ispal = false, MainDisplay = true; +bool ispal = false; /* LAB: Labyrinth specific code for the special puzzles */ #define SPECIALLOCK 100 @@ -226,31 +224,31 @@ bool LabEngine::doCloseUp(CloseDataPtr closePtr) { /******************************************************************************/ /* Gets the current inventory name. */ /******************************************************************************/ -const char *LabEngine::getInvName(uint16 CurInv) { - if (MainDisplay) - return _inventory[CurInv].BInvName; +const char *LabEngine::getInvName(uint16 curInv) { + if (_mainDisplay) + return _inventory[curInv].BInvName; - if ((CurInv == LAMPNUM) && _conditions->in(LAMPON)) + if ((curInv == LAMPNUM) && _conditions->in(LAMPON)) return "P:Mines/120"; - if ((CurInv == BELTNUM) && _conditions->in(BELTGLOW)) + if ((curInv == BELTNUM) && _conditions->in(BELTGLOW)) return "P:Future/BeltGlow"; - if (CurInv == WESTPAPERNUM) { - _curFileName = _inventory[CurInv].BInvName; + if (curInv == WESTPAPERNUM) { + _curFileName = _inventory[curInv].BInvName; _anim->_noPalChange = true; _graphics->readPict(_curFileName, false); _anim->_noPalChange = false; doWestPaper(); - } else if (CurInv == NOTESNUM) { - _curFileName = _inventory[CurInv].BInvName; + } else if (curInv == NOTESNUM) { + _curFileName = _inventory[curInv].BInvName; _anim->_noPalChange = true; _graphics->readPict(_curFileName, false); _anim->_noPalChange = false; doNotes(); } - return _inventory[CurInv].BInvName; + return _inventory[curInv].BInvName; } /******************************************************************************/ @@ -274,7 +272,7 @@ void LabEngine::interfaceOn() { } if (_graphics->_longWinInFront) - _event->attachGadgetList(NULL); + _event->attachGadgetList(nullptr); else if (_alternate) _event->attachGadgetList(_invGadgetList); else @@ -284,8 +282,8 @@ void LabEngine::interfaceOn() { /******************************************************************************/ /* If the user hits the "Use" gadget; things that can get used on themselves. */ /******************************************************************************/ -bool LabEngine::doUse(uint16 CurInv) { - if (CurInv == MAPNUM) { /* LAB: Labyrinth specific */ +bool LabEngine::doUse(uint16 curInv) { + if (curInv == MAPNUM) { /* LAB: Labyrinth specific */ drawStaticMessage(kTextUseMap); interfaceOff(); _anim->stopDiff(); @@ -295,7 +293,7 @@ bool LabEngine::doUse(uint16 CurInv) { _graphics->setPalette(initcolors, 8); _graphics->drawMessage(NULL); _graphics->drawPanel(); - } else if (CurInv == JOURNALNUM) { /* LAB: Labyrinth specific */ + } else if (curInv == JOURNALNUM) { /* LAB: Labyrinth specific */ drawStaticMessage(kTextUseJournal); interfaceOff(); _anim->stopDiff(); @@ -304,7 +302,7 @@ bool LabEngine::doUse(uint16 CurInv) { doJournal(); _graphics->drawPanel(); _graphics->drawMessage(NULL); - } else if (CurInv == LAMPNUM) { /* LAB: Labyrinth specific */ + } else if (curInv == LAMPNUM) { /* LAB: Labyrinth specific */ interfaceOff(); if (_conditions->in(LAMPON)) { @@ -321,20 +319,20 @@ bool LabEngine::doUse(uint16 CurInv) { _anim->_waitForEffect = false; _anim->_doBlack = false; - _nextFileName = getInvName(CurInv); - } else if (CurInv == BELTNUM) { /* LAB: Labyrinth specific */ + _nextFileName = getInvName(curInv); + } else if (curInv == BELTNUM) { /* LAB: Labyrinth specific */ if (!_conditions->in(BELTGLOW)) _conditions->inclElement(BELTGLOW); _anim->_doBlack = false; - _nextFileName = getInvName(CurInv); - } else if (CurInv == WHISKEYNUM) { /* LAB: Labyrinth specific */ + _nextFileName = getInvName(curInv); + } else if (curInv == WHISKEYNUM) { /* LAB: Labyrinth specific */ _conditions->inclElement(USEDHELMET); drawStaticMessage(kTextUseWhiskey); - } else if (CurInv == PITHHELMETNUM) { /* LAB: Labyrinth specific */ + } else if (curInv == PITHHELMETNUM) { /* LAB: Labyrinth specific */ _conditions->inclElement(USEDHELMET); drawStaticMessage(kTextUsePith); - } else if (CurInv == HELMETNUM) { /* LAB: Labyrinth specific */ + } else if (curInv == HELMETNUM) { /* LAB: Labyrinth specific */ _conditions->inclElement(USEDHELMET); drawStaticMessage(kTextUseHelmet); } else @@ -346,47 +344,46 @@ bool LabEngine::doUse(uint16 CurInv) { /******************************************************************************/ /* Decrements the current inventory number. */ /******************************************************************************/ -void LabEngine::decIncInv(uint16 *CurInv, bool dec) { +void LabEngine::decIncInv(uint16 *curInv, bool decreaseFl) { interfaceOff(); - if (dec) - (*CurInv)--; + if (decreaseFl) + (*curInv)--; else - (*CurInv)++; + (*curInv)++; - while (*CurInv && (*CurInv <= _numInv)) { - if (_conditions->in(*CurInv) && _inventory[*CurInv].BInvName) { - _nextFileName = getInvName(*CurInv); + while (*curInv && (*curInv <= _numInv)) { + if (_conditions->in(*curInv) && _inventory[*curInv].BInvName) { + _nextFileName = getInvName(*curInv); break; } - if (dec) - (*CurInv)--; + if (decreaseFl) + (*curInv)--; else - (*CurInv)++; + (*curInv)++; } - if ((*CurInv == 0) || (*CurInv > _numInv)) { - if (dec) - *CurInv = _numInv; + if ((*curInv == 0) || (*curInv > _numInv)) { + if (decreaseFl) + *curInv = _numInv; else - *CurInv = 1; + *curInv = 1; - while (*CurInv && (*CurInv <= _numInv)) { - if (_conditions->in(*CurInv) && _inventory[*CurInv].BInvName) { - _nextFileName = getInvName(*CurInv); + while (*curInv && (*curInv <= _numInv)) { + if (_conditions->in(*curInv) && _inventory[*curInv].BInvName) { + _nextFileName = getInvName(*curInv); break; } - if (dec) - (*CurInv)--; + if (decreaseFl) + (*curInv)--; else - (*CurInv)++; + (*curInv)++; } } } - /******************************************************************************/ /* The main game loop */ /******************************************************************************/ @@ -394,7 +391,8 @@ void LabEngine::mainGameLoop() { uint16 actionMode = 4; uint16 curInv = MAPNUM; - bool forceDraw = false, GotMessage = true; + bool forceDraw = false; + bool gotMessage = true; _graphics->setPalette(initcolors, 8); @@ -424,7 +422,7 @@ void LabEngine::mainGameLoop() { while (1) { _event->processInput(true); - if (GotMessage) { + if (gotMessage) { if (_quitLab || g_engine->shouldQuit()) { _anim->stopDiff(); break; @@ -441,7 +439,7 @@ void LabEngine::mainGameLoop() { } /* Sets the current picture properly on the screen */ - if (MainDisplay) + if (_mainDisplay) _nextFileName = getPictName(&_cptr); if (_noUpdateDiff) { @@ -456,11 +454,11 @@ void LabEngine::mainGameLoop() { _curFileName = _nextFileName; if (_cptr) { - if ((_cptr->CloseUpType == SPECIALLOCK) && MainDisplay) /* LAB: Labyrinth specific code */ + if ((_cptr->CloseUpType == SPECIALLOCK) && _mainDisplay) /* LAB: Labyrinth specific code */ showCombination(_curFileName); else if (((_cptr->CloseUpType == SPECIALBRICK) || (_cptr->CloseUpType == SPECIALBRICKNOMOUSE)) && - MainDisplay) /* LAB: Labyrinth specific code */ + _mainDisplay) /* LAB: Labyrinth specific code */ showTile(_curFileName, (bool)(_cptr->CloseUpType == SPECIALBRICKNOMOUSE)); else _graphics->readPict(_curFileName, false); @@ -489,7 +487,7 @@ void LabEngine::mainGameLoop() { IntuiMessage *curMsg = getMsg(); if (curMsg == NULL) { /* Does music load and next animation frame when you've run out of messages */ - GotMessage = false; + gotMessage = false; _music->checkRoomMusic(); _music->updateMusic(); _anim->diffNextFrame(); @@ -506,7 +504,7 @@ void LabEngine::mainGameLoop() { else if (result == VKEY_RTARROW) code = 8; - GotMessage = true; + gotMessage = true; mayShowCrumbIndicator(); _graphics->screenUpdate(); if (!from_crumbs(GADGETUP, code, 0, _event->updateAndGetMousePos(), curInv, curMsg, forceDraw, code, actionMode)) @@ -517,7 +515,7 @@ void LabEngine::mainGameLoop() { mayShowCrumbIndicator(); _graphics->screenUpdate(); } else { - GotMessage = true; + gotMessage = true; Common::Point curPos; curPos.x = curMsg->mouseX; @@ -591,7 +589,7 @@ bool LabEngine::from_crumbs(uint32 tmpClass, uint16 code, uint16 Qualifier, Comm _anim->_doBlack = true; _graphics->_doNotDrawMessage = false; - MainDisplay = true; + _mainDisplay = true; interfaceOn(); /* Sets the correct gadget list */ _graphics->drawPanel(); drawRoomMessage(curInv, _cptr); @@ -680,7 +678,7 @@ bool LabEngine::from_crumbs(uint32 tmpClass, uint16 code, uint16 Qualifier, Comm _graphics->_doNotDrawMessage = false; interfaceOn(); /* Sets the correct gadget list */ - MainDisplay = false; + _mainDisplay = false; if (lastInv && _conditions->in(lastInv)) { curInv = lastInv; @@ -809,7 +807,7 @@ bool LabEngine::from_crumbs(uint32 tmpClass, uint16 code, uint16 Qualifier, Comm _anim->_doBlack = true; _graphics->_doNotDrawMessage = false; - MainDisplay = true; + _mainDisplay = true; interfaceOn(); /* Sets the correct gadget list */ _graphics->drawPanel(); drawRoomMessage(curInv, _cptr); @@ -827,7 +825,7 @@ bool LabEngine::from_crumbs(uint32 tmpClass, uint16 code, uint16 Qualifier, Comm doit = !saveRestoreGame(); _cptr = NULL; - MainDisplay = true; + _mainDisplay = true; curInv = MAPNUM; lastInv = MAPNUM; @@ -851,12 +849,12 @@ bool LabEngine::from_crumbs(uint32 tmpClass, uint16 code, uint16 Qualifier, Comm perFlipGadget(oldActionMode); drawStaticMessage(kTextUseOnWhat); - MainDisplay = true; + _mainDisplay = true; _graphics->screenUpdate(); } } else if (gadgetId == 2) { - MainDisplay = !MainDisplay; + _mainDisplay = !_mainDisplay; if ((curInv == 0) || (curInv > _numInv)) { curInv = 1; @@ -904,7 +902,7 @@ bool LabEngine::from_crumbs(uint32 tmpClass, uint16 code, uint16 Qualifier, Comm _anim->_doBlack = true; _graphics->_doNotDrawMessage = false; - MainDisplay = true; + _mainDisplay = true; interfaceOn(); /* Sets the correct gadget list */ _graphics->drawPanel(); drawRoomMessage(curInv, _cptr); @@ -919,16 +917,16 @@ bool LabEngine::from_crumbs(uint32 tmpClass, uint16 code, uint16 Qualifier, Comm } } } - } else if ((msgClass == MOUSEBUTTONS) && (IEQUALIFIER_LEFTBUTTON & Qualifier) && MainDisplay) { + } else if ((msgClass == MOUSEBUTTONS) && (IEQUALIFIER_LEFTBUTTON & Qualifier) && _mainDisplay) { interfaceOff(); - MainDisplay = true; + _mainDisplay = true; doit = false; if (_cptr) { - if ((_cptr->CloseUpType == SPECIALLOCK) && MainDisplay) /* LAB: Labyrinth specific code */ + if ((_cptr->CloseUpType == SPECIALLOCK) && _mainDisplay) /* LAB: Labyrinth specific code */ mouseCombination(curPos); - else if ((_cptr->CloseUpType == SPECIALBRICK) && MainDisplay) + else if ((_cptr->CloseUpType == SPECIALBRICK) && _mainDisplay) mouseTile(curPos); else doit = true; @@ -1022,7 +1020,7 @@ bool LabEngine::from_crumbs(uint32 tmpClass, uint16 code, uint16 Qualifier, Comm _alternate = !_alternate; _anim->_doBlack = true; _graphics->_doNotDrawMessage = false; - MainDisplay = true; + _mainDisplay = true; interfaceOn(); /* Sets the correct gadget list */ if (_alternate) { @@ -1163,7 +1161,7 @@ void LabEngine::mayShowCrumbIndicator() { if (getPlatform() != Common::kPlatformWindows) return; - if (_droppingCrumbs && MainDisplay) { + if (_droppingCrumbs && _mainDisplay) { _event->mouseHide(); dropCrumbsImage.drawMaskImage(612, 4); _event->mouseShow(); @@ -1177,7 +1175,7 @@ void LabEngine::mayShowCrumbIndicatorOff() { if (getPlatform() != Common::kPlatformWindows) return; - if (MainDisplay) { + if (_mainDisplay) { _event->mouseHide(); dropCrumbsOffImage.drawMaskImage(612, 4); _event->mouseShow(); diff --git a/engines/lab/lab.cpp b/engines/lab/lab.cpp index 5f2a4d5f10..83f09cdf87 100644 --- a/engines/lab/lab.cpp +++ b/engines/lab/lab.cpp @@ -72,11 +72,12 @@ LabEngine::LabEngine(OSystem *syst, const ADGameDescription *gameDesc) _isCrumbWaiting = false; _noUpdateDiff = false; _quitLab = false; + _mainDisplay = true; + _numInv = 0; _manyRooms = 0; _direction = 0; _highestCondition = 0; - _crumbSecs = 0; _crumbMicros = 0; @@ -85,6 +86,7 @@ LabEngine::LabEngine(OSystem *syst, const ADGameDescription *gameDesc) _music = nullptr; _anim = nullptr; _graphics = nullptr; + _rooms = nullptr; _lastTooLong = false; _interfaceOff = false; @@ -129,6 +131,7 @@ LabEngine::~LabEngine() { delete _music; delete _anim; delete _graphics; + free(_rooms); for (int i = 0; i < 16; i++) delete _tiles[i]; diff --git a/engines/lab/lab.h b/engines/lab/lab.h index 384b5599ed..27bae37d0d 100644 --- a/engines/lab/lab.h +++ b/engines/lab/lab.h @@ -90,7 +90,7 @@ private: bool _interfaceOff; bool _noUpdateDiff; bool _quitLab; - + bool _mainDisplay; // timing.cpp void microDelay(uint32 secs, uint32 micros); @@ -100,6 +100,7 @@ public: Music *_music; Anim *_anim; DisplayMan *_graphics; + RoomData *_rooms; int _roomNum; CrumbData _breadCrumbs[MAX_CRUMBS]; diff --git a/engines/lab/map.cpp b/engines/lab/map.cpp index 218aae4213..40e8eb9d49 100644 --- a/engines/lab/map.cpp +++ b/engines/lab/map.cpp @@ -45,8 +45,6 @@ namespace Lab { /*------------------------------ The Map stuff ------------------------------*/ /*---------------------------------------------------------------------------*/ -extern RoomData *_rooms; - static Image *Map, *Room, *UpArrowRoom, *DownArrowRoom, *Bridge, *HRoom, *VRoom, *Maze, *HugeMaze, *Path, *MapNorth, *MapEast, *MapSouth, *MapWest, *XMark; diff --git a/engines/lab/music.cpp b/engines/lab/music.cpp index 66db0d8493..ddc6cbdaa6 100644 --- a/engines/lab/music.cpp +++ b/engines/lab/music.cpp @@ -146,13 +146,13 @@ void Music::fillbuffer(byte *musicBuffer) { /*****************************************************************************/ /* Starts up the music initially. */ /*****************************************************************************/ -void Music::startMusic(bool startatbegin) { +void Music::startMusic(bool restartFl) { if (!_musicOn) return; stopSoundEffect(); - if (startatbegin) { + if (restartFl) { _file->seek(0); _leftinfile = _file->size(); } diff --git a/engines/lab/music.h b/engines/lab/music.h index d292e9ed9c..7905da74a5 100644 --- a/engines/lab/music.h +++ b/engines/lab/music.h @@ -79,7 +79,7 @@ public: private: LabEngine *_vm; void fillbuffer(byte *musicBuffer); - void startMusic(bool startatbegin); + void startMusic(bool restartFl); Common::File *_file; Common::File *_tFile; diff --git a/engines/lab/parsetypes.h b/engines/lab/parsetypes.h index 6be1ba2482..9bfc2b094d 100644 --- a/engines/lab/parsetypes.h +++ b/engines/lab/parsetypes.h @@ -103,8 +103,7 @@ namespace Lab { typedef struct closeData { uint16 x1, y1, x2, y2; - int16 CloseUpType; /* if > 0, an object. If < 0, - an item */ + int16 CloseUpType; /* if > 0, an object. If < 0, an item */ uint16 depth; /* Level of the closeup. */ char *GraphicName, *Message; closeData *NextCloseUp, *SubCloseUps; @@ -121,14 +120,12 @@ struct ViewData { struct Action { int16 ActionType, Param1, Param2, Param3; - byte *Data; /* Message, or a pointer to array - of messages. */ + byte *Data; /* Message, or a pointer to array of messages. */ Action *NextAction; }; struct Rule { int16 RuleType, Param1, Param2, *Condition; - Action *ActionList; Rule *NextRule; }; @@ -150,8 +147,6 @@ struct InventoryData { char *name, *BInvName; }; - - /* Map Flags */ /* Where the doors are; in a corridor, assumed to be left doors */ diff --git a/engines/lab/processroom.cpp b/engines/lab/processroom.cpp index 932649cb7e..f254d4b753 100644 --- a/engines/lab/processroom.cpp +++ b/engines/lab/processroom.cpp @@ -44,8 +44,6 @@ namespace Lab { #define NOFILE "no file" -RoomData *_rooms; - /*****************************************************************************/ /* Generates a random number. */ /*****************************************************************************/ @@ -81,10 +79,10 @@ static bool checkConditions(int16 *condition) { /* Gets the current ViewDataPointer. */ /*****************************************************************************/ ViewData *getViewData(uint16 roomNum, uint16 direction) { - if (!_rooms[roomNum]._roomMsg) + if (!g_lab->_rooms[roomNum]._roomMsg) g_lab->_resource->readViews(roomNum); - ViewData *view = _rooms[roomNum]._view[direction]; + ViewData *view = g_lab->_rooms[roomNum]._view[direction]; do { if (checkConditions(view->Condition)) @@ -195,13 +193,13 @@ bool processArrow(uint16 *direction, uint16 arrow) { uint16 room = 1; if (*direction == NORTH) - room = _rooms[g_lab->_roomNum]._northDoor; + room = g_lab->_rooms[g_lab->_roomNum]._northDoor; else if (*direction == SOUTH) - room = _rooms[g_lab->_roomNum]._southDoor; + room = g_lab->_rooms[g_lab->_roomNum]._southDoor; else if (*direction == EAST) - room = _rooms[g_lab->_roomNum]._eastDoor; + room = g_lab->_rooms[g_lab->_roomNum]._eastDoor; else if (*direction == WEST) - room = _rooms[g_lab->_roomNum]._westDoor; + room = g_lab->_rooms[g_lab->_roomNum]._westDoor; if (room == 0) return false; @@ -574,11 +572,11 @@ static bool doActionRuleSub(int16 action, int16 roomNum, CloseDataPtr lcptr, Clo action++; if (lcptr) { - RuleList *rules = _rooms[g_lab->_roomNum]._rules; + RuleList *rules = g_lab->_rooms[g_lab->_roomNum]._rules; if ((rules == NULL) && (roomNum == 0)) { g_lab->_resource->readViews(roomNum); - rules = _rooms[roomNum]._rules; + rules = g_lab->_rooms[roomNum]._rules; } for (RuleList::iterator rule = rules->begin(); rule != rules->end(); ++rule) { @@ -629,11 +627,11 @@ bool doActionRule(Common::Point pos, int16 action, int16 roomNum, CloseDataPtr * static bool doOperateRuleSub(int16 itemNum, int16 roomNum, CloseDataPtr lcptr, CloseDataPtr *set, bool allowDefaults) { if (lcptr) if (lcptr->CloseUpType > 0) { - RuleList *rules = _rooms[roomNum]._rules; + RuleList *rules = g_lab->_rooms[roomNum]._rules; if ((rules == NULL) && (roomNum == 0)) { g_lab->_resource->readViews(roomNum); - rules = _rooms[roomNum]._rules; + rules = g_lab->_rooms[roomNum]._rules; } for (RuleList::iterator rule = rules->begin(); rule != rules->end(); ++rule) { @@ -689,7 +687,7 @@ bool doOperateRule(int16 x, int16 y, int16 ItemNum, CloseDataPtr *lcptr) { /* Goes thru the rules if the user tries to go forward. */ /*****************************************************************************/ bool doGoForward(CloseDataPtr *lcptr) { - RuleList *rules = _rooms[g_lab->_roomNum]._rules; + RuleList *rules = g_lab->_rooms[g_lab->_roomNum]._rules; for (RuleList::iterator rule = rules->begin(); rule != rules->end(); ++rule) { if (((*rule)->RuleType == GOFORWARD) && ((*rule)->Param1 == (g_lab->_direction + 1))) { @@ -710,7 +708,7 @@ bool doTurn(uint16 from, uint16 to, CloseDataPtr *lcptr) { from++; to++; - RuleList *rules = _rooms[g_lab->_roomNum]._rules; + RuleList *rules = g_lab->_rooms[g_lab->_roomNum]._rules; for (RuleList::iterator rule = rules->begin(); rule != rules->end(); ++rule) { if (((*rule)->RuleType == TURN) || @@ -730,7 +728,7 @@ bool doTurn(uint16 from, uint16 to, CloseDataPtr *lcptr) { /* Goes thru the rules if the user tries to go to the main view */ /*****************************************************************************/ bool doMainView(CloseDataPtr *lcptr) { - RuleList *rules = _rooms[g_lab->_roomNum]._rules; + RuleList *rules = g_lab->_rooms[g_lab->_roomNum]._rules; for (RuleList::iterator rule = rules->begin(); rule != rules->end(); ++rule) { if ((*rule)->RuleType == GOMAINVIEW) { if (checkConditions((*rule)->Condition)) { diff --git a/engines/lab/resource.cpp b/engines/lab/resource.cpp index 654ce97b24..f8a70cc7c2 100644 --- a/engines/lab/resource.cpp +++ b/engines/lab/resource.cpp @@ -34,8 +34,6 @@ namespace Lab { -extern RoomData *_rooms; - Resource::Resource(LabEngine *vm) : _vm(vm) { readStaticText(); } @@ -93,22 +91,22 @@ bool Resource::readRoomData(const char *fileName) { _vm->_manyRooms = dataFile->readUint16LE(); _vm->_highestCondition = dataFile->readUint16LE(); - _rooms = (RoomData *)malloc((_vm->_manyRooms + 1) * sizeof(RoomData)); - memset(_rooms, 0, (_vm->_manyRooms + 1) * sizeof(RoomData)); + _vm->_rooms = (RoomData *)malloc((_vm->_manyRooms + 1) * sizeof(RoomData)); + memset(_vm->_rooms, 0, (_vm->_manyRooms + 1) * sizeof(RoomData)); for (uint16 i = 1; i <= _vm->_manyRooms; i++) { - _rooms[i]._northDoor = dataFile->readUint16LE(); - _rooms[i]._southDoor = dataFile->readUint16LE(); - _rooms[i]._eastDoor = dataFile->readUint16LE(); - _rooms[i]._westDoor = dataFile->readUint16LE(); - _rooms[i]._wipeType = dataFile->readByte(); - - _rooms[i]._view[NORTH] = nullptr; - _rooms[i]._view[SOUTH] = nullptr; - _rooms[i]._view[EAST] = nullptr; - _rooms[i]._view[WEST] = nullptr; - _rooms[i]._rules = nullptr; - _rooms[i]._roomMsg = nullptr; + _vm->_rooms[i]._northDoor = dataFile->readUint16LE(); + _vm->_rooms[i]._southDoor = dataFile->readUint16LE(); + _vm->_rooms[i]._eastDoor = dataFile->readUint16LE(); + _vm->_rooms[i]._westDoor = dataFile->readUint16LE(); + _vm->_rooms[i]._wipeType = dataFile->readByte(); + + _vm->_rooms[i]._view[NORTH] = nullptr; + _vm->_rooms[i]._view[SOUTH] = nullptr; + _vm->_rooms[i]._view[EAST] = nullptr; + _vm->_rooms[i]._view[WEST] = nullptr; + _vm->_rooms[i]._rules = nullptr; + _vm->_rooms[i]._roomMsg = nullptr; } delete dataFile; @@ -136,12 +134,12 @@ bool Resource::readViews(uint16 roomNum) { Common::String fileName = "LAB:Rooms/" + Common::String::format("%d", roomNum); Common::File *dataFile = openDataFile(fileName.c_str(), MKTAG('R', 'O', 'M', '4')); - _rooms[roomNum]._roomMsg = readString(dataFile); - _rooms[roomNum]._view[NORTH] = readView(dataFile); - _rooms[roomNum]._view[SOUTH] = readView(dataFile); - _rooms[roomNum]._view[EAST] = readView(dataFile); - _rooms[roomNum]._view[WEST] = readView(dataFile); - _rooms[roomNum]._rules = readRule(dataFile); + _vm->_rooms[roomNum]._roomMsg = readString(dataFile); + _vm->_rooms[roomNum]._view[NORTH] = readView(dataFile); + _vm->_rooms[roomNum]._view[SOUTH] = readView(dataFile); + _vm->_rooms[roomNum]._view[EAST] = readView(dataFile); + _vm->_rooms[roomNum]._view[WEST] = readView(dataFile); + _vm->_rooms[roomNum]._rules = readRule(dataFile); _vm->_music->updateMusic(); -- cgit v1.2.3 From 62c4acc6b36639ebcbd2d9161af9b563e0c561f1 Mon Sep 17 00:00:00 2001 From: Filippos Karapetis Date: Sun, 6 Dec 2015 22:50:41 +0200 Subject: LAB: Change the gadget lists to use Common::List --- engines/lab/engine.cpp | 14 +++++------- engines/lab/eventman.cpp | 25 ++++++++++----------- engines/lab/eventman.h | 6 ++--- engines/lab/graphics.cpp | 56 +++++++++++++++++------------------------------ engines/lab/interface.cpp | 48 +++++++++++++++++++--------------------- engines/lab/interface.h | 7 +++--- engines/lab/lab.cpp | 2 -- engines/lab/lab.h | 8 ++++--- engines/lab/map.cpp | 26 +++++++++++++--------- engines/lab/resource.cpp | 2 +- engines/lab/special.cpp | 29 ++++++++++++++---------- 11 files changed, 106 insertions(+), 117 deletions(-) diff --git a/engines/lab/engine.cpp b/engines/lab/engine.cpp index f3d13610e3..d300f474ab 100644 --- a/engines/lab/engine.cpp +++ b/engines/lab/engine.cpp @@ -130,9 +130,8 @@ void LabEngine::freeScreens() { /* Permanently flips the imagery of a gadget. */ /******************************************************************************/ void LabEngine::perFlipGadget(uint16 gadgetId) { - Gadget *topGadget = _moveGadgetList; - - while (topGadget) { + for (GadgetList::iterator gadget = _moveGadgetList.begin(); gadget != _moveGadgetList.end(); ++gadget) { + Gadget *topGadget = *gadget; if (topGadget->GadgetID == gadgetId) { Image *tmpImage = topGadget->_image; topGadget->_image = topGadget->_altImage; @@ -144,9 +143,8 @@ void LabEngine::perFlipGadget(uint16 gadgetId) { _event->mouseShow(); } - return; - } else - topGadget = topGadget->NextGadget; + break; + } } } @@ -274,9 +272,9 @@ void LabEngine::interfaceOn() { if (_graphics->_longWinInFront) _event->attachGadgetList(nullptr); else if (_alternate) - _event->attachGadgetList(_invGadgetList); + _event->attachGadgetList(&_invGadgetList); else - _event->attachGadgetList(_moveGadgetList); + _event->attachGadgetList(&_moveGadgetList); } /******************************************************************************/ diff --git a/engines/lab/eventman.cpp b/engines/lab/eventman.cpp index 0b3f71eb63..aeb6fa3b44 100644 --- a/engines/lab/eventman.cpp +++ b/engines/lab/eventman.cpp @@ -57,30 +57,29 @@ static byte MouseData[] = {1, 1, 0, 0, 0, 0, 0, 0, 0, 0, /* Checks whether or not the cords fall within one of the gadgets in a list */ /* of gadgets. */ /*****************************************************************************/ -Gadget *EventManager::checkGadgetHit(Gadget *gadgetList, Common::Point pos) { - while (gadgetList != NULL) { - if ((pos.x >= gadgetList->x) && (pos.y >= gadgetList->y) && - (pos.x <= (gadgetList->x + gadgetList->_image->_width)) && - (pos.y <= (gadgetList->y + gadgetList->_image->_height)) && - !(GADGETOFF & gadgetList->GadgetFlags)) { +Gadget *EventManager::checkGadgetHit(GadgetList *gadgetList, Common::Point pos) { + for (GadgetList::iterator gadgetItr = gadgetList->begin(); gadgetItr != gadgetList->end(); ++gadgetItr) { + Gadget *gadget = *gadgetItr; + if ((pos.x >= gadget->x) && (pos.y >= gadget->y) && + (pos.x <= (gadget->x + gadget->_image->_width)) && + (pos.y <= (gadget->y + gadget->_image->_height)) && + !(GADGETOFF & gadget->GadgetFlags)) { if (_vm->_isHiRes) { - _hitGadget = gadgetList; + _hitGadget = gadget; } else { mouseHide(); - gadgetList->_altImage->drawImage(gadgetList->x, gadgetList->y); + gadget->_altImage->drawImage(gadget->x, gadget->y); mouseShow(); for (uint16 i = 0; i < 3; i++) _vm->waitTOF(); mouseHide(); - gadgetList->_image->drawImage(gadgetList->x, gadgetList->y); + gadget->_image->drawImage(gadget->x, gadget->y); mouseShow(); } - return gadgetList; - } else { - gadgetList = gadgetList->NextGadget; + return gadget; } } @@ -89,7 +88,7 @@ Gadget *EventManager::checkGadgetHit(Gadget *gadgetList, Common::Point pos) { -void EventManager::attachGadgetList(Gadget *gadgetList) { +void EventManager::attachGadgetList(GadgetList *gadgetList) { if (_screenGadgetList != gadgetList) _lastGadgetHit = nullptr; diff --git a/engines/lab/eventman.h b/engines/lab/eventman.h index 156fb96adc..a156a8a823 100644 --- a/engines/lab/eventman.h +++ b/engines/lab/eventman.h @@ -55,10 +55,10 @@ private: public: EventManager (LabEngine *vm); - Gadget *_screenGadgetList; + GadgetList *_screenGadgetList; Gadget *_hitGadget; - Gadget *checkGadgetHit(Gadget *gadgetList, Common::Point pos); + Gadget *checkGadgetHit(GadgetList *gadgetList, Common::Point pos); void initMouse(); void updateMouse(); void mouseShow(); @@ -67,7 +67,7 @@ public: void setMousePos(Common::Point pos); bool mouseButton(uint16 *x, uint16 *y, bool leftButton); Gadget *mouseGadget(); - void attachGadgetList(Gadget *gadgetList); + void attachGadgetList(GadgetList *gadgetList); void mouseHandler(int flag, Common::Point pos); bool keyPress(uint16 *keyCode); bool haveNextChar(); diff --git a/engines/lab/graphics.cpp b/engines/lab/graphics.cpp index 6c93b516fa..375ab228c6 100644 --- a/engines/lab/graphics.cpp +++ b/engines/lab/graphics.cpp @@ -806,7 +806,7 @@ void DisplayMan::drawPanel() { if (!_vm->_alternate) { setAPen(4); drawHLine(0, VGAScaleY(170) + 1, VGAScaleX(319)); /* The horizontal lines under the black one */ - drawGadgetList(_vm->_moveGadgetList); + drawGadgetList(&_vm->_moveGadgetList); } else { if (_vm->getPlatform() != Common::kPlatformWindows) { drawVLine(VGAScaleX(124), VGAScaleY(170) + 1, VGAScaleY(199)); /* Vertical Black lines */ @@ -832,7 +832,7 @@ void DisplayMan::drawPanel() { drawVLine(VGAScaleX(232), VGAScaleY(170) + 2, VGAScaleY(198)); } - drawGadgetList(_vm->_invGadgetList); + drawGadgetList(&_vm->_invGadgetList); } _vm->_event->mouseShow(); @@ -856,25 +856,16 @@ bool DisplayMan::setUpScreens() { // The key mapping was only set for the Windows version. // It's very convenient to have those shortcut, so I added them // for all versions. (Strangerke) - _vm->_moveGadgetList = createButton(1, y, 0, 't', _vm->_moveImages[0], _vm->_moveImages[1]); - Gadget *curGadget = _vm->_moveGadgetList; - curGadget->NextGadget = createButton(33, y, 1, 'm', _vm->_moveImages[2], _vm->_moveImages[3]); - curGadget = curGadget->NextGadget; - curGadget->NextGadget = createButton(65, y, 2, 'o', _vm->_moveImages[4], _vm->_moveImages[5]); - curGadget = curGadget->NextGadget; - curGadget->NextGadget = createButton(97, y, 3, 'c', _vm->_moveImages[6], _vm->_moveImages[7]); - curGadget = curGadget->NextGadget; - curGadget->NextGadget = createButton(129, y, 4, 'l', _vm->_moveImages[8], _vm->_moveImages[9]); - curGadget = curGadget->NextGadget; - curGadget->NextGadget = createButton(161, y, 5, 'i', _vm->_moveImages[12], _vm->_moveImages[13]); - curGadget = curGadget->NextGadget; - curGadget->NextGadget = createButton(193, y, 6, VKEY_LTARROW, _vm->_moveImages[14], _vm->_moveImages[15]); - curGadget = curGadget->NextGadget; - curGadget->NextGadget = createButton(225, y, 7, VKEY_UPARROW, _vm->_moveImages[16], _vm->_moveImages[17]); - curGadget = curGadget->NextGadget; - curGadget->NextGadget = createButton(257, y, 8, VKEY_RTARROW, _vm->_moveImages[18], _vm->_moveImages[19]); - curGadget = curGadget->NextGadget; - curGadget->NextGadget = createButton(289, y, 9, 'p', _vm->_moveImages[10], _vm->_moveImages[11]); + _vm->_moveGadgetList.push_back(createButton( 1, y, 0, 't', _vm->_moveImages[0], _vm->_moveImages[1])); + _vm->_moveGadgetList.push_back(createButton( 33, y, 1, 'm', _vm->_moveImages[2], _vm->_moveImages[3])); + _vm->_moveGadgetList.push_back(createButton( 65, y, 2, 'o', _vm->_moveImages[4], _vm->_moveImages[5])); + _vm->_moveGadgetList.push_back(createButton( 97, y, 3, 'c', _vm->_moveImages[6], _vm->_moveImages[7])); + _vm->_moveGadgetList.push_back(createButton(129, y, 4, 'l', _vm->_moveImages[8], _vm->_moveImages[9])); + _vm->_moveGadgetList.push_back(createButton(161, y, 5, 'i', _vm->_moveImages[12], _vm->_moveImages[13])); + _vm->_moveGadgetList.push_back(createButton(193, y, 6, VKEY_LTARROW, _vm->_moveImages[14], _vm->_moveImages[15])); + _vm->_moveGadgetList.push_back(createButton(225, y, 7, VKEY_UPARROW, _vm->_moveImages[16], _vm->_moveImages[17])); + _vm->_moveGadgetList.push_back(createButton(257, y, 8, VKEY_RTARROW, _vm->_moveImages[18], _vm->_moveImages[19])); + _vm->_moveGadgetList.push_back(createButton(289, y, 9, 'p', _vm->_moveImages[10], _vm->_moveImages[11])); Common::File *invFile = _vm->_resource->openDataFile("P:Inv"); if (_vm->getPlatform() == Common::kPlatformWindows) { @@ -884,25 +875,18 @@ bool DisplayMan::setUpScreens() { for (uint16 imgIdx = 0; imgIdx < 6; imgIdx++) _vm->_invImages[imgIdx] = new Image(invFile); } - _vm->_invGadgetList = createButton(24, y, 0, 'm', _vm->_invImages[0], _vm->_invImages[1]); - curGadget = _vm->_invGadgetList; - curGadget->NextGadget = createButton(56, y, 1, 'g', _vm->_invImages[2], _vm->_invImages[3]); - curGadget = curGadget->NextGadget; - curGadget->NextGadget = createButton(94, y, 2, 'u', _vm->_invImages[4], _vm->_invImages[5]); - curGadget = curGadget->NextGadget; - curGadget->NextGadget = createButton(126, y, 3, 'l', _vm->_moveImages[8], _vm->_moveImages[9]); - curGadget = curGadget->NextGadget; - curGadget->NextGadget = createButton(164, y, 4, VKEY_LTARROW, _vm->_moveImages[14], _vm->_moveImages[15]); - curGadget = curGadget->NextGadget; - curGadget->NextGadget = createButton(196, y, 5, VKEY_RTARROW, _vm->_moveImages[18], _vm->_moveImages[19]); + _vm->_invGadgetList.push_back(createButton( 24, y, 0, 'm', _vm->_invImages[0], _vm->_invImages[1])); + _vm->_invGadgetList.push_back(createButton( 56, y, 1, 'g', _vm->_invImages[2], _vm->_invImages[3])); + _vm->_invGadgetList.push_back(createButton( 94, y, 2, 'u', _vm->_invImages[4], _vm->_invImages[5])); + _vm->_invGadgetList.push_back(createButton(126, y, 3, 'l', _vm->_moveImages[8], _vm->_moveImages[9])); + _vm->_invGadgetList.push_back(createButton(164, y, 4, VKEY_LTARROW, _vm->_moveImages[14], _vm->_moveImages[15])); + _vm->_invGadgetList.push_back(createButton(196, y, 5, VKEY_RTARROW, _vm->_moveImages[18], _vm->_moveImages[19])); // The windows version has 2 extra gadgets for breadcrumb trail // TODO: the game is really hard to play without those, maybe we could add something to enable that. if (_vm->getPlatform() == Common::kPlatformWindows) { - curGadget = curGadget->NextGadget; - curGadget->NextGadget = createButton(234, y, 6, 'b', _vm->_invImages[6], _vm->_invImages[7]); - curGadget = curGadget->NextGadget; - curGadget->NextGadget = createButton(266, y, 7, 'f', _vm->_invImages[8], _vm->_invImages[9]); + _vm->_invGadgetList.push_back(createButton(234, y, 6, 'b', _vm->_invImages[6], _vm->_invImages[7])); + _vm->_invGadgetList.push_back(createButton(266, y, 7, 'f', _vm->_invImages[8], _vm->_invImages[9])); } delete invFile; diff --git a/engines/lab/interface.cpp b/engines/lab/interface.cpp index 61cfc6c365..d437fd233e 100644 --- a/engines/lab/interface.cpp +++ b/engines/lab/interface.cpp @@ -52,7 +52,6 @@ Gadget *createButton(uint16 x, uint16 y, uint16 id, uint16 key, Image *im, Image gptr->KeyEquiv = key; gptr->_image = im; gptr->_altImage = imalt; - gptr->NextGadget = NULL; return gptr; } else @@ -62,15 +61,12 @@ Gadget *createButton(uint16 x, uint16 y, uint16 id, uint16 key, Image *im, Image -void freeButtonList(Gadget *gptrlist) { - Gadget *next = gptrlist; - - while (next) { - Gadget *gptr = next; - next = next->NextGadget; - - free(gptr); +void freeButtonList(GadgetList *gadgetList) { + for (GadgetList::iterator gadget = gadgetList->begin(); gadget != gadgetList->end(); ++gadget) { + free(*gadget); } + + gadgetList->clear(); } @@ -79,14 +75,12 @@ void freeButtonList(Gadget *gptrlist) { /*****************************************************************************/ /* Draws a gadget list to the screen. */ /*****************************************************************************/ -void drawGadgetList(Gadget *gadlist) { - while (gadlist) { - gadlist->_image->drawImage(gadlist->x, gadlist->y); +void drawGadgetList(GadgetList *gadgetList) { + for (GadgetList::iterator gadget = gadgetList->begin(); gadget != gadgetList->end(); ++gadget) { + (*gadget)->_image->drawImage((*gadget)->x, (*gadget)->y); - if (GADGETOFF & gadlist->GadgetFlags) - disableGadget(gadlist, 1); - - gadlist = gadlist->NextGadget; + if (GADGETOFF & (*gadget)->GadgetFlags) + disableGadget((*gadget), 1); } } @@ -124,24 +118,26 @@ uint16 makeGadgetKeyEquiv(uint16 key) { /* Checks whether or not the cords fall within one of the gadgets in a list */ /* of gadgets. */ /*****************************************************************************/ -Gadget *LabEngine::checkNumGadgetHit(Gadget *gadlist, uint16 key) { +Gadget *LabEngine::checkNumGadgetHit(GadgetList *gadgetList, uint16 key) { uint16 gkey = key - '0'; - while (gadlist != NULL) { - if ((gkey - 1 == gadlist->GadgetID || (gkey == 0 && gadlist->GadgetID == 9) || - (gadlist->KeyEquiv != 0 && makeGadgetKeyEquiv(key) == gadlist->KeyEquiv)) - && !(GADGETOFF & gadlist->GadgetFlags)) { + if (!gadgetList) + return NULL; + + for (GadgetList::iterator gadgetItr = gadgetList->begin(); gadgetItr != gadgetList->end(); ++gadgetItr) { + Gadget *gadget = *gadgetItr; + if ((gkey - 1 == gadget->GadgetID || (gkey == 0 && gadget->GadgetID == 9) || + (gadget->KeyEquiv != 0 && makeGadgetKeyEquiv(key) == gadget->KeyEquiv)) + && !(GADGETOFF & gadget->GadgetFlags)) { _event->mouseHide(); - gadlist->_altImage->drawImage(gadlist->x, gadlist->y); + gadget->_altImage->drawImage(gadget->x, gadget->y); _event->mouseShow(); g_system->delayMillis(80); _event->mouseHide(); - gadlist->_image->drawImage(gadlist->x, gadlist->y); + gadget->_image->drawImage(gadget->x, gadget->y); _event->mouseShow(); - return gadlist; - } else { - gadlist = gadlist->NextGadget; + return gadget; } } diff --git a/engines/lab/interface.h b/engines/lab/interface.h index 42cfb2f0a9..83c8badc15 100644 --- a/engines/lab/interface.h +++ b/engines/lab/interface.h @@ -48,7 +48,6 @@ struct Gadget { uint16 KeyEquiv; // if not zero, a key that activates gadget uint32 GadgetFlags; Image *_image, *_altImage; - Gadget *NextGadget; }; extern Common::KeyState _keyPressed; @@ -57,7 +56,7 @@ extern Common::KeyState _keyPressed; #define GADGETOFF 0x01 - +typedef Common::List GadgetList; /* Defines for the Class variable in IntuiMessage */ #define SIZEVERIFY 0x00000001 @@ -112,8 +111,8 @@ extern Common::KeyState _keyPressed; /*---------------------------------------------------------------------------*/ Gadget *createButton(uint16 x, uint16 y, uint16 id, uint16 key, Image *im, Image *imalt); -void freeButtonList(void *gptrlist); -void drawGadgetList(Gadget *gadlist); +void freeButtonList(GadgetList *gadgetList); +void drawGadgetList(GadgetList *gadgetList); void disableGadget(Gadget *curgad, uint16 pencolor); void enableGadget(Gadget *curgad); IntuiMessage *getMsg(); diff --git a/engines/lab/lab.cpp b/engines/lab/lab.cpp index 83f09cdf87..02abf800f5 100644 --- a/engines/lab/lab.cpp +++ b/engines/lab/lab.cpp @@ -103,8 +103,6 @@ LabEngine::LabEngine(OSystem *syst, const ADGameDescription *gameDesc) for (int i = 0; i < 16; i++) _tiles[i] = nullptr; - _moveGadgetList = nullptr; - _invGadgetList = nullptr; _curFileName = nullptr; _nextFileName = nullptr; _newFileName = nullptr; diff --git a/engines/lab/lab.h b/engines/lab/lab.h index 27bae37d0d..656406d146 100644 --- a/engines/lab/lab.h +++ b/engines/lab/lab.h @@ -61,6 +61,8 @@ enum GameFeatures { #define UPSCROLL 3 #define DOWNSCROLL 4 +typedef Common::List GadgetList; + class LabEngine : public Engine { public: LabEngine(OSystem *syst, const ADGameDescription *gameDesc); @@ -123,8 +125,8 @@ public: const char *_newFileName; /* When ProcessRoom.c decides to change the filename of the current picture. */ TextFont *_msgFont; - Gadget *_moveGadgetList; - Gadget *_invGadgetList; + GadgetList _moveGadgetList; + GadgetList _invGadgetList; Image *_moveImages[20]; Image *_invImages[10]; Image *_numberImages[10]; @@ -147,7 +149,7 @@ public: void interfaceOff(); void interfaceOn(); void decIncInv(uint16 *CurInv, bool dec); - Gadget *checkNumGadgetHit(Gadget *gadlist, uint16 key); + Gadget *checkNumGadgetHit(GadgetList *gadgetList, uint16 key); IntuiMessage *getMsg(); void drawMap(uint16 CurRoom, uint16 CurMsg, uint16 Floor, bool fadeout, bool fadein); void processMap(uint16 CurRoom); diff --git a/engines/lab/map.cpp b/engines/lab/map.cpp index 40e8eb9d49..a565f31d06 100644 --- a/engines/lab/map.cpp +++ b/engines/lab/map.cpp @@ -56,11 +56,12 @@ extern char *LOWERFLOORS, *MIDDLEFLOORS, *UPPERFLOORS, *MEDMAZEFLOORS, *HEDGEMAZ static uint16 MapGadX[3] = {101, 55, 8}, MapGadY[3] = {105, 105, 105}; -static Gadget downgadget = { 101, 105, 2, VKEY_DNARROW, 0L, NULL, NULL, NULL }, - upgadget = { 55, 105, 1, VKEY_UPARROW, 0L, NULL, NULL, &downgadget }, - backgadget = { 8, 105, 0, 0, 0L, NULL, NULL, &upgadget }; +static Gadget + backgadget = { 8, 105, 0, 0, 0L, NULL, NULL }, + upgadget = { 55, 105, 1, VKEY_UPARROW, 0L, NULL, NULL }, + downgadget = { 101, 105, 2, VKEY_DNARROW, 0L, NULL, NULL }; -static Gadget *MapGadgetList = &backgadget; +static GadgetList *MapGadgetList; #define LOWERFLOOR 1 #define MIDDLEFLOOR 2 @@ -93,9 +94,13 @@ static uint16 mapScaleY(uint16 y) { /* Loads in the map data. */ /*****************************************************************************/ static bool loadMapData() { - Gadget *gptr; uint16 counter; + MapGadgetList = new GadgetList(); + MapGadgetList->push_back(&backgadget); + MapGadgetList->push_back(&upgadget); + MapGadgetList->push_back(&downgadget); + Common::File *mapImages = g_lab->_resource->openDataFile("P:MapImage"); Map = new Image(mapImages); @@ -126,12 +131,10 @@ static bool loadMapData() { delete mapImages; counter = 0; - gptr = MapGadgetList; - while (gptr) { - gptr->x = g_lab->_graphics->VGAScaleX(MapGadX[counter]); - gptr->y = g_lab->_graphics->VGAScaleY(MapGadY[counter]); - gptr = gptr->NextGadget; + for (GadgetList::iterator gadget = MapGadgetList->begin(); gadget != MapGadgetList->end(); ++gadget) { + (*gadget)->x = g_lab->_graphics->VGAScaleX(MapGadX[counter]); + (*gadget)->y = g_lab->_graphics->VGAScaleY(MapGadY[counter]); counter++; } @@ -156,6 +159,9 @@ static bool loadMapData() { } static void freeMapData() { + MapGadgetList->clear(); + delete MapGadgetList; + delete[] Maps; Maps = NULL; } diff --git a/engines/lab/resource.cpp b/engines/lab/resource.cpp index f8a70cc7c2..c8aea6361c 100644 --- a/engines/lab/resource.cpp +++ b/engines/lab/resource.cpp @@ -225,7 +225,7 @@ int16 *Resource::readConditions(Common::File *file) { RuleList *Resource::readRule(Common::File *file) { char c; - RuleList *rules = new Common::List(); + RuleList *rules = new RuleList(); do { c = file->readByte(); diff --git a/engines/lab/special.cpp b/engines/lab/special.cpp index c4751ce9b6..8afeeeadc6 100644 --- a/engines/lab/special.cpp +++ b/engines/lab/special.cpp @@ -155,7 +155,6 @@ void LabEngine::doWestPaper() { /*****************************************************************************/ static bool loadJournalData() { char filename[20]; - Gadget *TopGadget = &BackG; bool bridge, dirty, news, clean; journalFont = g_lab->_resource->getFont("P:Journal.fon"); // FIXME: memory leak @@ -206,16 +205,21 @@ static bool loadJournalData() { uint16 counter = 0; - while (TopGadget) { - TopGadget->x = g_lab->_graphics->VGAScaleX(JGadX[counter]); + GadgetList journalGadgetList; + journalGadgetList.push_back(&BackG); + journalGadgetList.push_back(&CancelG); + journalGadgetList.push_back(&ForwardG); + + for (GadgetList::iterator gadgetIter = journalGadgetList.begin(); gadgetIter != journalGadgetList.end(); ++gadgetIter) { + Gadget *gadget = *gadgetIter; + gadget->x = g_lab->_graphics->VGAScaleX(JGadX[counter]); if (counter == 1) - TopGadget->y = g_lab->_graphics->VGAScaleY(JGadY[counter]) + g_lab->_graphics->SVGACord(1); + gadget->y = g_lab->_graphics->VGAScaleY(JGadY[counter]) + g_lab->_graphics->SVGACord(1); else - TopGadget->y = g_lab->_graphics->VGAScaleY(JGadY[counter]) - g_lab->_graphics->SVGACord(1); + gadget->y = g_lab->_graphics->VGAScaleY(JGadY[counter]) - g_lab->_graphics->SVGACord(1); - TopGadget->GadgetID = counter; - TopGadget = TopGadget->NextGadget; + gadget->GadgetID = counter; counter++; } @@ -372,6 +376,11 @@ void LabEngine::processJournal() { /* Does the journal processing. */ /*****************************************************************************/ void LabEngine::doJournal() { + GadgetList journalGadgetList; + journalGadgetList.push_back(&BackG); + journalGadgetList.push_back(&CancelG); + journalGadgetList.push_back(&ForwardG); + _graphics->blackAllScreen(); lastpage = false; @@ -381,9 +390,6 @@ void LabEngine::doJournal() { JBackImage._height = _graphics->_screenHeight; JBackImage._imageData = NULL; - BackG.NextGadget = &CancelG; - CancelG.NextGadget = &ForwardG; - ScreenImage = JBackImage; ScreenImage._imageData = _graphics->getCurrentDrawingBuffer(); @@ -392,12 +398,13 @@ void LabEngine::doJournal() { drawJournal(0, true); - _event->attachGadgetList(&BackG); + _event->attachGadgetList(&journalGadgetList); _event->mouseShow(); processJournal(); _event->attachGadgetList(NULL); _graphics->fade(false, 0); _event->mouseHide(); + journalGadgetList.clear(); ScreenImage._imageData = _graphics->getCurrentDrawingBuffer(); -- cgit v1.2.3 From 2611b62d5ec07868d52b8a014932c937eddfceea Mon Sep 17 00:00:00 2001 From: Strangerke Date: Sun, 6 Dec 2015 21:53:57 +0100 Subject: LAB: Rename parse types --- engines/lab/engine.cpp | 76 ++++++++++---------- engines/lab/parsetypes.h | 56 ++++++++------- engines/lab/processroom.cpp | 168 ++++++++++++++++++++++---------------------- engines/lab/resource.cpp | 62 ++++++++-------- engines/lab/savegame.cpp | 2 +- engines/lab/special.cpp | 6 +- 6 files changed, 187 insertions(+), 183 deletions(-) diff --git a/engines/lab/engine.cpp b/engines/lab/engine.cpp index d300f474ab..17ae4cc560 100644 --- a/engines/lab/engine.cpp +++ b/engines/lab/engine.cpp @@ -97,14 +97,14 @@ void LabEngine::drawRoomMessage(uint16 curInv, CloseDataPtr closePtr) { } if (_alternate) { - if ((curInv <= _numInv) && _conditions->in(curInv) && _inventory[curInv].BInvName) { + if ((curInv <= _numInv) && _conditions->in(curInv) && _inventory[curInv]._bitmapName) { if ((curInv == LAMPNUM) && _conditions->in(LAMPON)) /* LAB: Labyrinth specific */ drawStaticMessage(kTextLampOn); - else if (_inventory[curInv].Many > 1) { - Common::String roomMessage = Common::String(_inventory[curInv].name) + " (" + Common::String::format("%d", _inventory[curInv].Many) + ")"; + else if (_inventory[curInv]._many > 1) { + Common::String roomMessage = Common::String(_inventory[curInv]._name) + " (" + Common::String::format("%d", _inventory[curInv]._many) + ")"; _graphics->drawMessage(roomMessage.c_str()); } else - _graphics->drawMessage(_inventory[curInv].name); + _graphics->drawMessage(_inventory[curInv]._name); } } else drawDirection(closePtr); @@ -182,32 +182,32 @@ bool LabEngine::doCloseUp(CloseDataPtr closePtr) { lutertmargin = 128; } - switch (closePtr->CloseUpType) { + switch (closePtr->_closeUpType) { case MUSEUMMONITOR: case LIBRARYMONITOR: case WINDOWMONITOR: - doMonitor(closePtr->GraphicName, closePtr->Message, false, monltmargin, montopmargin, monrtmargin, 165); + doMonitor(closePtr->_graphicName, closePtr->_message, false, monltmargin, montopmargin, monrtmargin, 165); break; case GRAMAPHONEMONITOR: - doMonitor(closePtr->GraphicName, closePtr->Message, false, monltmargin, montopmargin, 171, 165); + doMonitor(closePtr->_graphicName, closePtr->_message, false, monltmargin, montopmargin, 171, 165); break; case UNICYCLEMONITOR: - doMonitor(closePtr->GraphicName, closePtr->Message, false, 100, montopmargin, monrtmargin, 165); + doMonitor(closePtr->_graphicName, closePtr->_message, false, 100, montopmargin, monrtmargin, 165); break; case STATUEMONITOR: - doMonitor(closePtr->GraphicName, closePtr->Message, false, 117, montopmargin, monrtmargin, 165); + doMonitor(closePtr->_graphicName, closePtr->_message, false, 117, montopmargin, monrtmargin, 165); break; case TALISMANMONITOR: - doMonitor(closePtr->GraphicName, closePtr->Message, false, monltmargin, montopmargin, 184, 165); + doMonitor(closePtr->_graphicName, closePtr->_message, false, monltmargin, montopmargin, 184, 165); break; case LUTEMONITOR: - doMonitor(closePtr->GraphicName, closePtr->Message, false, monltmargin, montopmargin, lutertmargin, 165); + doMonitor(closePtr->_graphicName, closePtr->_message, false, monltmargin, montopmargin, lutertmargin, 165); break; case CLOCKMONITOR: - doMonitor(closePtr->GraphicName, closePtr->Message, false, monltmargin, montopmargin, 206, 165); + doMonitor(closePtr->_graphicName, closePtr->_message, false, monltmargin, montopmargin, 206, 165); break; case TERMINALMONITOR: - doMonitor(closePtr->GraphicName, closePtr->Message, true, monltmargin, montopmargin, monrtmargin, 165); + doMonitor(closePtr->_graphicName, closePtr->_message, true, monltmargin, montopmargin, monrtmargin, 165); break; default: return false; @@ -224,7 +224,7 @@ bool LabEngine::doCloseUp(CloseDataPtr closePtr) { /******************************************************************************/ const char *LabEngine::getInvName(uint16 curInv) { if (_mainDisplay) - return _inventory[curInv].BInvName; + return _inventory[curInv]._bitmapName; if ((curInv == LAMPNUM) && _conditions->in(LAMPON)) return "P:Mines/120"; @@ -233,20 +233,20 @@ const char *LabEngine::getInvName(uint16 curInv) { return "P:Future/BeltGlow"; if (curInv == WESTPAPERNUM) { - _curFileName = _inventory[curInv].BInvName; + _curFileName = _inventory[curInv]._bitmapName; _anim->_noPalChange = true; _graphics->readPict(_curFileName, false); _anim->_noPalChange = false; doWestPaper(); } else if (curInv == NOTESNUM) { - _curFileName = _inventory[curInv].BInvName; + _curFileName = _inventory[curInv]._bitmapName; _anim->_noPalChange = true; _graphics->readPict(_curFileName, false); _anim->_noPalChange = false; doNotes(); } - return _inventory[curInv].BInvName; + return _inventory[curInv]._bitmapName; } /******************************************************************************/ @@ -351,7 +351,7 @@ void LabEngine::decIncInv(uint16 *curInv, bool decreaseFl) { (*curInv)++; while (*curInv && (*curInv <= _numInv)) { - if (_conditions->in(*curInv) && _inventory[*curInv].BInvName) { + if (_conditions->in(*curInv) && _inventory[*curInv]._bitmapName) { _nextFileName = getInvName(*curInv); break; } @@ -369,7 +369,7 @@ void LabEngine::decIncInv(uint16 *curInv, bool decreaseFl) { *curInv = 1; while (*curInv && (*curInv <= _numInv)) { - if (_conditions->in(*curInv) && _inventory[*curInv].BInvName) { + if (_conditions->in(*curInv) && _inventory[*curInv]._bitmapName) { _nextFileName = getInvName(*curInv); break; } @@ -452,12 +452,12 @@ void LabEngine::mainGameLoop() { _curFileName = _nextFileName; if (_cptr) { - if ((_cptr->CloseUpType == SPECIALLOCK) && _mainDisplay) /* LAB: Labyrinth specific code */ + if ((_cptr->_closeUpType == SPECIALLOCK) && _mainDisplay) /* LAB: Labyrinth specific code */ showCombination(_curFileName); - else if (((_cptr->CloseUpType == SPECIALBRICK) || - (_cptr->CloseUpType == SPECIALBRICKNOMOUSE)) && + else if (((_cptr->_closeUpType == SPECIALBRICK) || + (_cptr->_closeUpType == SPECIALBRICKNOMOUSE)) && _mainDisplay) /* LAB: Labyrinth specific code */ - showTile(_curFileName, (bool)(_cptr->CloseUpType == SPECIALBRICKNOMOUSE)); + showTile(_curFileName, (bool)(_cptr->_closeUpType == SPECIALBRICKNOMOUSE)); else _graphics->readPict(_curFileName, false); } else @@ -535,11 +535,11 @@ void LabEngine::mainGameLoop() { if (_inventory) { for (int i = 1; i <= _numInv; i++) { - if (_inventory[i].name) - free(_inventory[i].name); + if (_inventory[i]._name) + free(_inventory[i]._name); - if (_inventory[i].BInvName) - free(_inventory[i].BInvName); + if (_inventory[i]._bitmapName) + free(_inventory[i]._bitmapName); } free(_inventory); @@ -552,7 +552,7 @@ bool LabEngine::from_crumbs(uint32 tmpClass, uint16 code, uint16 Qualifier, Comm uint16 oldDirection = 0; uint16 lastInv = MAPNUM; - CloseDataPtr oldcptr, tempcptr, hcptr = NULL; + CloseDataPtr oldcptr, tempcptr, hcptr = nullptr; ViewData *VPtr; bool doit; uint16 NewDir; @@ -862,7 +862,7 @@ bool LabEngine::from_crumbs(uint32 tmpClass, uint16 code, uint16 Qualifier, Comm } if ((curInv <= _numInv) && _conditions->in(curInv) && - _inventory[curInv].BInvName) + _inventory[curInv]._bitmapName) _nextFileName = getInvName(curInv); _graphics->screenUpdate(); @@ -922,9 +922,9 @@ bool LabEngine::from_crumbs(uint32 tmpClass, uint16 code, uint16 Qualifier, Comm doit = false; if (_cptr) { - if ((_cptr->CloseUpType == SPECIALLOCK) && _mainDisplay) /* LAB: Labyrinth specific code */ + if ((_cptr->_closeUpType == SPECIALLOCK) && _mainDisplay) /* LAB: Labyrinth specific code */ mouseCombination(curPos); - else if ((_cptr->CloseUpType == SPECIALBRICK) && _mainDisplay) + else if ((_cptr->_closeUpType == SPECIALBRICK) && _mainDisplay) mouseTile(curPos); else doit = true; @@ -963,8 +963,8 @@ bool LabEngine::from_crumbs(uint32 tmpClass, uint16 code, uint16 Qualifier, Comm if (_cptr == tempcptr) { if (curPos.y < (_graphics->VGAScaleY(149) + _graphics->SVGACord(2))) drawStaticMessage(kTextNothing); - } else if (tempcptr->GraphicName) { - if (*(tempcptr->GraphicName)) { + } else if (tempcptr->_graphicName) { + if (*(tempcptr->_graphicName)) { _anim->_doBlack = true; _cptr = tempcptr; } else if (curPos.y < (_graphics->VGAScaleY(149) + _graphics->SVGACord(2))) @@ -987,7 +987,7 @@ bool LabEngine::from_crumbs(uint32 tmpClass, uint16 code, uint16 Qualifier, Comm _graphics->screenUpdate(); } else if (msgClass == DELTAMOVE) { VPtr = getViewData(_roomNum, _direction); - oldcptr = VPtr->closeUps; + oldcptr = VPtr->_closeUps; if (hcptr == NULL) { tempcptr = _cptr; @@ -997,18 +997,18 @@ bool LabEngine::from_crumbs(uint32 tmpClass, uint16 code, uint16 Qualifier, Comm if (_cptr == NULL) hcptr = oldcptr; else - hcptr = _cptr->SubCloseUps; + hcptr = _cptr->_subCloseUps; } else - hcptr = tempcptr->NextCloseUp; + hcptr = tempcptr->_nextCloseUp; } else - hcptr = hcptr->NextCloseUp; + hcptr = hcptr->_nextCloseUp; if (hcptr == NULL) { if (_cptr == NULL) hcptr = oldcptr; else - hcptr = _cptr->SubCloseUps; + hcptr = _cptr->_subCloseUps; } if (hcptr) diff --git a/engines/lab/parsetypes.h b/engines/lab/parsetypes.h index 9bfc2b094d..b345e1e056 100644 --- a/engines/lab/parsetypes.h +++ b/engines/lab/parsetypes.h @@ -37,8 +37,6 @@ namespace Lab { #define MAXFILELEN 31 - - /*------------------------------- Action types ------------------------------*/ #define PLAYSOUND 1 #define PLAYSOUNDCONT 2 @@ -77,8 +75,6 @@ namespace Lab { #define CSHOWMESSAGE 35 #define PLAYSOUNDB 36 - - /* Rule Types */ #define ACTION 1 #define OPERATE 2 @@ -88,8 +84,6 @@ namespace Lab { #define GOMAINVIEW 6 #define TURNFROMTO 7 - - /*----------------------------- Rule Type Action ----------------------------*/ #define TAKE 1 #define MOVE 2 @@ -101,50 +95,60 @@ namespace Lab { #pragma pack(push, 1) #endif -typedef struct closeData { +typedef struct CloseData { uint16 x1, y1, x2, y2; - int16 CloseUpType; /* if > 0, an object. If < 0, an item */ - uint16 depth; /* Level of the closeup. */ - char *GraphicName, *Message; - closeData *NextCloseUp, *SubCloseUps; + int16 _closeUpType; /* if > 0, an object. If < 0, an item */ + uint16 _depth; /* Level of the closeup. */ + char *_graphicName; + char *_message; + CloseData *_nextCloseUp; + CloseData *_subCloseUps; } CloseData; typedef CloseData *CloseDataPtr; struct ViewData { - int16 *Condition; - char *GraphicName; - struct ViewData *NextCondition; - CloseDataPtr closeUps; + int16 *_condition; + char *_graphicName; + struct ViewData *_nextCondition; + CloseDataPtr _closeUps; }; struct Action { - int16 ActionType, Param1, Param2, Param3; - byte *Data; /* Message, or a pointer to array of messages. */ - Action *NextAction; + int16 _actionType; + int16 _param1; + int16 _param2; + int16 _param3; + byte *_data; /* Message, or a pointer to array of messages. */ + Action *_nextAction; }; struct Rule { - int16 RuleType, Param1, Param2, *Condition; - Action *ActionList; - Rule *NextRule; + int16 _ruleType; + int16 _param1; + int16 _param2; + int16 *_condition; + Action *_actionList; + Rule *_nextRule; }; typedef Common::List RuleList; struct RoomData { - uint16 _northDoor, _southDoor, _eastDoor, _westDoor; - + uint16 _northDoor; + uint16 _southDoor; + uint16 _eastDoor; + uint16 _westDoor; byte _wipeType; - ViewData *_view[4]; RuleList *_rules; char *_roomMsg; }; struct InventoryData { - uint16 Many; - char *name, *BInvName; + uint16 _many; + char *_name; + char *_bitmapName; }; /* Map Flags */ diff --git a/engines/lab/processroom.cpp b/engines/lab/processroom.cpp index f254d4b753..015b854b75 100644 --- a/engines/lab/processroom.cpp +++ b/engines/lab/processroom.cpp @@ -85,10 +85,10 @@ ViewData *getViewData(uint16 roomNum, uint16 direction) { ViewData *view = g_lab->_rooms[roomNum]._view[direction]; do { - if (checkConditions(view->Condition)) + if (checkConditions(view->_condition)) break; - view = view->NextCondition; + view = view->_nextCondition; } while (true); return view; @@ -99,9 +99,9 @@ ViewData *getViewData(uint16 roomNum, uint16 direction) { /*****************************************************************************/ static CloseData *getObject(uint16 x, uint16 y, CloseDataPtr lcptr) { if (lcptr == NULL) { - lcptr = getViewData(g_lab->_roomNum, g_lab->_direction)->closeUps; + lcptr = getViewData(g_lab->_roomNum, g_lab->_direction)->_closeUps; } else { - lcptr = lcptr->SubCloseUps; + lcptr = lcptr->_subCloseUps; } while (lcptr != NULL) { @@ -109,7 +109,7 @@ static CloseData *getObject(uint16 x, uint16 y, CloseDataPtr lcptr) { (x <= g_lab->_graphics->scaleX(lcptr->x2)) && (y <= g_lab->_graphics->scaleY(lcptr->y2))) return lcptr; - lcptr = lcptr->NextCloseUp; + lcptr = lcptr->_nextCloseUp; } return NULL; @@ -127,15 +127,15 @@ static CloseDataPtr findCPtrMatch(CloseDataPtr cpmain, CloseDataPtr list) { while (list) { if ((cpmain->x1 == list->x1) && (cpmain->x2 == list->x2) && (cpmain->y1 == list->y1) && (cpmain->y2 == list->y2) && - (cpmain->depth == list->depth)) + (cpmain->_depth == list->_depth)) return list; - cptr = findCPtrMatch(cpmain, list->SubCloseUps); + cptr = findCPtrMatch(cpmain, list->_subCloseUps); if (cptr) return cptr; else - list = list->NextCloseUp; + list = list->_nextCloseUp; } return NULL; @@ -148,21 +148,21 @@ char *getPictName(CloseDataPtr *lcptr) { ViewData *viewPtr = getViewData(g_lab->_roomNum, g_lab->_direction); if (*lcptr != NULL) { - *lcptr = findCPtrMatch(*lcptr, viewPtr->closeUps); + *lcptr = findCPtrMatch(*lcptr, viewPtr->_closeUps); if (*lcptr) - return (*lcptr)->GraphicName; + return (*lcptr)->_graphicName; } - return viewPtr->GraphicName; + return viewPtr->_graphicName; } /*****************************************************************************/ /* Draws the current direction to the screen. */ /*****************************************************************************/ void LabEngine::drawDirection(CloseDataPtr lcptr) { - if (lcptr != NULL && lcptr->Message) { - _graphics->drawMessage(lcptr->Message); + if (lcptr != NULL && lcptr->_message) { + _graphics->drawMessage(lcptr->_message); return; } @@ -236,9 +236,9 @@ void setCurClose(Common::Point pos, CloseDataPtr *cptr, bool useAbsoluteCoords) uint16 x1, y1, x2, y2; if (*cptr == NULL) { - lcptr = getViewData(g_lab->_roomNum, g_lab->_direction)->closeUps; + lcptr = getViewData(g_lab->_roomNum, g_lab->_direction)->_closeUps; } else - lcptr = (*cptr)->SubCloseUps; + lcptr = (*cptr)->_subCloseUps; while (lcptr != NULL) { if (!useAbsoluteCoords) { @@ -253,12 +253,12 @@ void setCurClose(Common::Point pos, CloseDataPtr *cptr, bool useAbsoluteCoords) y2 = g_lab->_graphics->scaleY(lcptr->y2); } - if (pos.x >= x1 && pos.y >= y1 && pos.x <= x2 && pos.y <= y2 && lcptr->GraphicName) { + if (pos.x >= x1 && pos.y >= y1 && pos.x <= x2 && pos.y <= y2 && lcptr->_graphicName) { *cptr = lcptr; return; } - lcptr = lcptr->NextCloseUp; + lcptr = lcptr->_nextCloseUp; } } @@ -269,23 +269,23 @@ bool takeItem(uint16 x, uint16 y, CloseDataPtr *cptr) { CloseDataPtr lcptr; if (*cptr == NULL) { - lcptr = getViewData(g_lab->_roomNum, g_lab->_direction)->closeUps; - } else if ((*cptr)->CloseUpType < 0) { - g_lab->_conditions->inclElement(abs((*cptr)->CloseUpType)); + lcptr = getViewData(g_lab->_roomNum, g_lab->_direction)->_closeUps; + } else if ((*cptr)->_closeUpType < 0) { + g_lab->_conditions->inclElement(abs((*cptr)->_closeUpType)); return true; } else - lcptr = (*cptr)->SubCloseUps; + lcptr = (*cptr)->_subCloseUps; while (lcptr != NULL) { if ((x >= g_lab->_graphics->scaleX(lcptr->x1)) && (y >= g_lab->_graphics->scaleY(lcptr->y1)) && (x <= g_lab->_graphics->scaleX(lcptr->x2)) && (y <= g_lab->_graphics->scaleY(lcptr->y2)) && - (lcptr->CloseUpType < 0)) { - g_lab->_conditions->inclElement(abs(lcptr->CloseUpType)); + (lcptr->_closeUpType < 0)) { + g_lab->_conditions->inclElement(abs(lcptr->_closeUpType)); return true; } - lcptr = lcptr->NextCloseUp; + lcptr = lcptr->_nextCloseUp; } return false; @@ -298,42 +298,42 @@ void LabEngine::doActions(Action *aptr, CloseDataPtr *lcptr) { while (aptr) { _music->updateMusic(); - switch (aptr->ActionType) { + switch (aptr->_actionType) { case PLAYSOUND: _music->_loopSoundEffect = false; _music->_waitTillFinished = true; - _music->readMusic((char *)aptr->Data, true); + _music->readMusic((char *)aptr->_data, true); _music->_waitTillFinished = false; break; case PLAYSOUNDB: _music->_loopSoundEffect = false; _music->_waitTillFinished = false; - _music->readMusic((char *)aptr->Data, false); + _music->readMusic((char *)aptr->_data, false); break; case PLAYSOUNDCONT: _music->_doNotFilestopSoundEffect = true; _music->_loopSoundEffect = true; - _music->readMusic((char *)aptr->Data, _music->_waitTillFinished); + _music->readMusic((char *)aptr->_data, _music->_waitTillFinished); break; case SHOWDIFF: - _graphics->readPict((char *)aptr->Data, true); + _graphics->readPict((char *)aptr->_data, true); break; case SHOWDIFFCONT: - _graphics->readPict((char *)aptr->Data, false); + _graphics->readPict((char *)aptr->_data, false); break; case LOADDIFF: - if (aptr->Data) - _graphics->loadPict((char *)aptr->Data); /* Puts a file into memory */ + if (aptr->_data) + _graphics->loadPict((char *)aptr->_data); /* Puts a file into memory */ break; case WIPECMD: - _graphics->doWipe(aptr->Param1, lcptr, (char *)aptr->Data); + _graphics->doWipe(aptr->_param1, lcptr, (char *)aptr->_data); break; case NOUPDATE: @@ -356,20 +356,20 @@ void LabEngine::doActions(Action *aptr, CloseDataPtr *lcptr) { break; case SETELEMENT: - _conditions->inclElement(aptr->Param1); + _conditions->inclElement(aptr->_param1); break; case UNSETELEMENT: - _conditions->exclElement(aptr->Param1); + _conditions->exclElement(aptr->_param1); break; case SHOWMESSAGE: _graphics->_doNotDrawMessage = false; if (_graphics->_longWinInFront) - _graphics->longDrawMessage((char *)aptr->Data); + _graphics->longDrawMessage((char *)aptr->_data); else - _graphics->drawMessage((char *)aptr->Data); + _graphics->drawMessage((char *)aptr->_data); _graphics->_doNotDrawMessage = true; break; @@ -377,22 +377,22 @@ void LabEngine::doActions(Action *aptr, CloseDataPtr *lcptr) { case CSHOWMESSAGE: if (*lcptr == NULL) { _graphics->_doNotDrawMessage = false; - _graphics->drawMessage((char *)aptr->Data); + _graphics->drawMessage((char *)aptr->_data); _graphics->_doNotDrawMessage = true; } break; case SHOWMESSAGES: { - char **str = (char **)aptr->Data; + char **str = (char **)aptr->_data; _graphics->_doNotDrawMessage = false; - _graphics->drawMessage(str[getRandom(aptr->Param1)]); + _graphics->drawMessage(str[getRandom(aptr->_param1)]); _graphics->_doNotDrawMessage = true; } break; case SETPOSITION: - if (aptr->Param1 & 0x8000) { + if (aptr->_param1 & 0x8000) { // This is a Wyrmkeep Windows trial version, thus stop at this // point, since we can't check for game payment status _graphics->readPict(getPictName(lcptr), true); @@ -402,14 +402,14 @@ void LabEngine::doActions(Action *aptr, CloseDataPtr *lcptr) { continue; } - _roomNum = aptr->Param1; - _direction = aptr->Param2 - 1; + _roomNum = aptr->_param1; + _direction = aptr->_param2 - 1; *lcptr = NULL; _anim->_doBlack = true; break; case SETCLOSEUP: { - CloseDataPtr tlcptr = getObject(g_lab->_graphics->scaleX(aptr->Param1), g_lab->_graphics->scaleY(aptr->Param2), *lcptr); + CloseDataPtr tlcptr = getObject(g_lab->_graphics->scaleX(aptr->_param1), g_lab->_graphics->scaleY(aptr->_param2), *lcptr); if (tlcptr) *lcptr = tlcptr; @@ -421,17 +421,17 @@ void LabEngine::doActions(Action *aptr, CloseDataPtr *lcptr) { break; case SUBINV: - if (_inventory[aptr->Param1].Many) - (_inventory[aptr->Param1].Many)--; + if (_inventory[aptr->_param1]._many) + (_inventory[aptr->_param1]._many)--; - if (_inventory[aptr->Param1].Many == 0) - _conditions->exclElement(aptr->Param1); + if (_inventory[aptr->_param1]._many == 0) + _conditions->exclElement(aptr->_param1); break; case ADDINV: - (_inventory[aptr->Param1].Many) += aptr->Param2; - _conditions->inclElement(aptr->Param1); + (_inventory[aptr->_param1]._many) += aptr->_param2; + _conditions->inclElement(aptr->_param1); break; case SHOWDIR: @@ -441,7 +441,7 @@ void LabEngine::doActions(Action *aptr, CloseDataPtr *lcptr) { case WAITSECS: { uint32 startSecs, startMicros, curSecs, curMicros; - addCurTime(aptr->Param1, 0, &startSecs, &startMicros); + addCurTime(aptr->_param1, 0, &startSecs, &startMicros); _graphics->screenUpdate(); @@ -466,7 +466,7 @@ void LabEngine::doActions(Action *aptr, CloseDataPtr *lcptr) { break; case CHANGEMUSIC: - _music->changeMusic((const char *)aptr->Data); + _music->changeMusic((const char *)aptr->_data); _music->setMusicReset(false); break; @@ -516,13 +516,13 @@ void LabEngine::doActions(Action *aptr, CloseDataPtr *lcptr) { break; case SPECIALCMD: - if (aptr->Param1 == 0) + if (aptr->_param1 == 0) _anim->_doBlack = true; - else if (aptr->Param1 == 1) + else if (aptr->_param1 == 1) _anim->_doBlack = (_cptr == NULL); - else if (aptr->Param1 == 2) + else if (aptr->_param1 == 2) _anim->_doBlack = (_cptr != NULL); - else if (aptr->Param1 == 5) { /* inverse the palette */ + else if (aptr->_param1 == 5) { /* inverse the palette */ for (uint16 idx = (8 * 3); idx < (255 * 3); idx++) _anim->_diffPalette[idx] = 255 - _anim->_diffPalette[idx]; @@ -530,16 +530,16 @@ void LabEngine::doActions(Action *aptr, CloseDataPtr *lcptr) { _graphics->setPalette(_anim->_diffPalette, 256); waitTOF(); waitTOF(); - } else if (aptr->Param1 == 4) { /* white the palette */ + } else if (aptr->_param1 == 4) { /* white the palette */ _graphics->whiteScreen(); waitTOF(); waitTOF(); - } else if (aptr->Param1 == 6) { /* Restore the palette */ + } else if (aptr->_param1 == 6) { /* Restore the palette */ waitTOF(); _graphics->setPalette(_anim->_diffPalette, 256); waitTOF(); waitTOF(); - } else if (aptr->Param1 == 7) { /* Quick pause */ + } else if (aptr->_param1 == 7) { /* Quick pause */ waitTOF(); waitTOF(); waitTOF(); @@ -548,7 +548,7 @@ void LabEngine::doActions(Action *aptr, CloseDataPtr *lcptr) { break; } - aptr = aptr->NextAction; + aptr = aptr->_nextAction; } if (_music->_loopSoundEffect) { @@ -580,14 +580,14 @@ static bool doActionRuleSub(int16 action, int16 roomNum, CloseDataPtr lcptr, Clo } for (RuleList::iterator rule = rules->begin(); rule != rules->end(); ++rule) { - if (((*rule)->RuleType == ACTION) && - (((*rule)->Param1 == action) || (((*rule)->Param1 == 0) && allowDefaults))) { - if ((((*rule)->Param2 == lcptr->CloseUpType) || - (((*rule)->Param2 == 0) && allowDefaults)) + if (((*rule)->_ruleType == ACTION) && + (((*rule)->_param1 == action) || (((*rule)->_param1 == 0) && allowDefaults))) { + if ((((*rule)->_param2 == lcptr->_closeUpType) || + (((*rule)->_param2 == 0) && allowDefaults)) || - ((action == 1) && ((*rule)->Param2 == (-lcptr->CloseUpType)))) { - if (checkConditions((*rule)->Condition)) { - g_lab->doActions((*rule)->ActionList, set); + ((action == 1) && ((*rule)->_param2 == (-lcptr->_closeUpType)))) { + if (checkConditions((*rule)->_condition)) { + g_lab->doActions((*rule)->_actionList, set); return true; } } @@ -626,7 +626,7 @@ bool doActionRule(Common::Point pos, int16 action, int16 roomNum, CloseDataPtr * /*****************************************************************************/ static bool doOperateRuleSub(int16 itemNum, int16 roomNum, CloseDataPtr lcptr, CloseDataPtr *set, bool allowDefaults) { if (lcptr) - if (lcptr->CloseUpType > 0) { + if (lcptr->_closeUpType > 0) { RuleList *rules = g_lab->_rooms[roomNum]._rules; if ((rules == NULL) && (roomNum == 0)) { @@ -635,11 +635,11 @@ static bool doOperateRuleSub(int16 itemNum, int16 roomNum, CloseDataPtr lcptr, C } for (RuleList::iterator rule = rules->begin(); rule != rules->end(); ++rule) { - if (((*rule)->RuleType == OPERATE) && - (((*rule)->Param1 == itemNum) || (((*rule)->Param1 == 0) && allowDefaults)) && - (((*rule)->Param2 == lcptr->CloseUpType) || (((*rule)->Param2 == 0) && allowDefaults))) { - if (checkConditions((*rule)->Condition)) { - g_lab->doActions((*rule)->ActionList, set); + if (((*rule)->_ruleType == OPERATE) && + (((*rule)->_param1 == itemNum) || (((*rule)->_param1 == 0) && allowDefaults)) && + (((*rule)->_param2 == lcptr->_closeUpType) || (((*rule)->_param2 == 0) && allowDefaults))) { + if (checkConditions((*rule)->_condition)) { + g_lab->doActions((*rule)->_actionList, set); return true; } } @@ -690,9 +690,9 @@ bool doGoForward(CloseDataPtr *lcptr) { RuleList *rules = g_lab->_rooms[g_lab->_roomNum]._rules; for (RuleList::iterator rule = rules->begin(); rule != rules->end(); ++rule) { - if (((*rule)->RuleType == GOFORWARD) && ((*rule)->Param1 == (g_lab->_direction + 1))) { - if (checkConditions((*rule)->Condition)) { - g_lab->doActions((*rule)->ActionList, lcptr); + if (((*rule)->_ruleType == GOFORWARD) && ((*rule)->_param1 == (g_lab->_direction + 1))) { + if (checkConditions((*rule)->_condition)) { + g_lab->doActions((*rule)->_actionList, lcptr); return true; } } @@ -711,11 +711,11 @@ bool doTurn(uint16 from, uint16 to, CloseDataPtr *lcptr) { RuleList *rules = g_lab->_rooms[g_lab->_roomNum]._rules; for (RuleList::iterator rule = rules->begin(); rule != rules->end(); ++rule) { - if (((*rule)->RuleType == TURN) || - (((*rule)->RuleType == TURNFROMTO) && - ((*rule)->Param1 == from) && ((*rule)->Param2 == to))) { - if (checkConditions((*rule)->Condition)) { - g_lab->doActions((*rule)->ActionList, lcptr); + if (((*rule)->_ruleType == TURN) || + (((*rule)->_ruleType == TURNFROMTO) && + ((*rule)->_param1 == from) && ((*rule)->_param2 == to))) { + if (checkConditions((*rule)->_condition)) { + g_lab->doActions((*rule)->_actionList, lcptr); return true; } } @@ -730,9 +730,9 @@ bool doTurn(uint16 from, uint16 to, CloseDataPtr *lcptr) { bool doMainView(CloseDataPtr *lcptr) { RuleList *rules = g_lab->_rooms[g_lab->_roomNum]._rules; for (RuleList::iterator rule = rules->begin(); rule != rules->end(); ++rule) { - if ((*rule)->RuleType == GOMAINVIEW) { - if (checkConditions((*rule)->Condition)) { - g_lab->doActions((*rule)->ActionList, lcptr); + if ((*rule)->_ruleType == GOMAINVIEW) { + if (checkConditions((*rule)->_condition)) { + g_lab->doActions((*rule)->_actionList, lcptr); return true; } } diff --git a/engines/lab/resource.cpp b/engines/lab/resource.cpp index c8aea6361c..538b6f6023 100644 --- a/engines/lab/resource.cpp +++ b/engines/lab/resource.cpp @@ -120,9 +120,9 @@ InventoryData *Resource::readInventory(const char *fileName) { InventoryData *inventory = (InventoryData *)malloc((_vm->_numInv + 1) * sizeof(InventoryData)); for (uint16 i = 1; i <= _vm->_numInv; i++) { - inventory[i].Many = dataFile->readUint16LE(); - inventory[i].name = readString(dataFile); - inventory[i].BInvName = readString(dataFile); + inventory[i]._many = dataFile->readUint16LE(); + inventory[i]._name = readString(dataFile); + inventory[i]._bitmapName = readString(dataFile); } delete dataFile; @@ -232,11 +232,11 @@ RuleList *Resource::readRule(Common::File *file) { if (c == 1) { Rule *rule = new Rule();; - rule->RuleType = file->readSint16LE(); - rule->Param1 = file->readSint16LE(); - rule->Param2 = file->readSint16LE(); - rule->Condition = readConditions(file); - rule->ActionList = readAction(file); + rule->_ruleType = file->readSint16LE(); + rule->_param1 = file->readSint16LE(); + rule->_param2 = file->readSint16LE(); + rule->_condition = readConditions(file); + rule->_actionList = readAction(file); rules->push_back(rule); } } while (c == 1); @@ -259,24 +259,24 @@ Action *Resource::readAction(Common::File *file) { if (!head) head = action; if (prev) - prev->NextAction = action; - action->ActionType = file->readSint16LE(); - action->Param1 = file->readSint16LE(); - action->Param2 = file->readSint16LE(); - action->Param3 = file->readSint16LE(); + prev->_nextAction = action; + action->_actionType = file->readSint16LE(); + action->_param1 = file->readSint16LE(); + action->_param2 = file->readSint16LE(); + action->_param3 = file->readSint16LE(); - if (action->ActionType == SHOWMESSAGES) { - messages = (char **)malloc(action->Param1 * 4); + if (action->_actionType == SHOWMESSAGES) { + messages = (char **)malloc(action->_param1 * 4); - for (int i = 0; i < action->Param1; i++) + for (int i = 0; i < action->_param1; i++) messages[i] = readString(file); - action->Data = (byte *)messages; + action->_data = (byte *)messages; } else { - action->Data = (byte *)readString(file); + action->_data = (byte *)readString(file); } - action->NextAction = NULL; + action->_nextAction = NULL; prev = action; } } while (c == 1); @@ -298,17 +298,17 @@ CloseData *Resource::readCloseUps(uint16 depth, Common::File *file) { if (!head) head = closeup; if (prev) - prev->NextCloseUp = closeup; + prev->_nextCloseUp = closeup; closeup->x1 = file->readUint16LE(); closeup->y1 = file->readUint16LE(); closeup->x2 = file->readUint16LE(); closeup->y2 = file->readUint16LE(); - closeup->CloseUpType = file->readSint16LE(); - closeup->depth = depth; - closeup->GraphicName = readString(file); - closeup->Message = readString(file); - closeup->SubCloseUps = readCloseUps(depth + 1, file); - closeup->NextCloseUp = NULL; + closeup->_closeUpType = file->readSint16LE(); + closeup->_depth = depth; + closeup->_graphicName = readString(file); + closeup->_message = readString(file); + closeup->_subCloseUps = readCloseUps(depth + 1, file); + closeup->_nextCloseUp = NULL; prev = closeup; } } while (c != '\0'); @@ -330,11 +330,11 @@ ViewData *Resource::readView(Common::File *file) { if (!head) head = view; if (prev) - prev->NextCondition = view; - view->Condition = readConditions(file); - view->GraphicName = readString(file); - view->closeUps = readCloseUps(0, file); - view->NextCondition = NULL; + prev->_nextCondition = view; + view->_condition = readConditions(file); + view->_graphicName = readString(file); + view->_closeUps = readCloseUps(0, file); + view->_nextCondition = NULL; prev = view; } } while (c == 1); diff --git a/engines/lab/savegame.cpp b/engines/lab/savegame.cpp index 133e4b1d70..b28d1a2652 100644 --- a/engines/lab/savegame.cpp +++ b/engines/lab/savegame.cpp @@ -128,7 +128,7 @@ bool saveGame(uint16 Direction, uint16 Quarters, int slot, Common::String desc) return false; // Load scene pic - CloseDataPtr cPtr = NULL; + CloseDataPtr cPtr = nullptr; g_lab->_graphics->readPict(getPictName(&cPtr), true); writeSaveGameHeader(file, desc); diff --git a/engines/lab/special.cpp b/engines/lab/special.cpp index 8afeeeadc6..f4c8439a57 100644 --- a/engines/lab/special.cpp +++ b/engines/lab/special.cpp @@ -435,14 +435,14 @@ bool LabEngine::saveRestoreGame() { desc = dialog->createDefaultSaveDescription(slot); } - isOK = saveGame(_direction, _inventory[QUARTERNUM].Many, slot, desc); + isOK = saveGame(_direction, _inventory[QUARTERNUM]._many, slot, desc); } } else { // Restore GUI::SaveLoadChooser *dialog = new GUI::SaveLoadChooser(_("Restore game:"), _("Restore"), false); int slot = dialog->runModalWithCurrentTarget(); if (slot >= 0) { - isOK = loadGame(&_direction, &(_inventory[QUARTERNUM].Many), slot); + isOK = loadGame(&_direction, &(_inventory[QUARTERNUM]._many), slot); if (isOK) _music->resetMusic(); } @@ -534,7 +534,7 @@ void LabEngine::processMonitor(char *ntext, TextFont *monitorFont, bool isintera if (_cptr == startcptr) Test = StartFileName; else - Test = _cptr->GraphicName; + Test = _cptr->_graphicName; if (strcmp(Test, TextFileName)) { monitorPage = 0; -- cgit v1.2.3 From 0f41d8894ca14f7ab4de3adae09576425bd634ea Mon Sep 17 00:00:00 2001 From: Filippos Karapetis Date: Mon, 7 Dec 2015 01:06:04 +0200 Subject: LAB: Simplify usage of the DIFF file buffer --- engines/lab/anim.cpp | 117 ++++++++++++++++++++++++--------------------------- engines/lab/anim.h | 4 +- 2 files changed, 55 insertions(+), 66 deletions(-) diff --git a/engines/lab/anim.cpp b/engines/lab/anim.cpp index edf677b670..545b487320 100644 --- a/engines/lab/anim.cpp +++ b/engines/lab/anim.cpp @@ -58,8 +58,7 @@ Anim::Anim(LabEngine *vm) : _vm(vm) { _frameNum = 0; _playOnce = false; _buffer = nullptr; - _storeDiffFile = nullptr; - _diffFile = &_storeDiffFile; + _diffFile = nullptr; _size = 0; _rawDiffBM._bytesPerRow = 0; _rawDiffBM._flags = 0; @@ -70,7 +69,6 @@ Anim::Anim(LabEngine *vm) : _vm(vm) { _stopPlayingEnd = false; _sampleSpeed = 0; _doBlack = false; - _start = nullptr; _diffWidth = 0; _diffHeight = 0; _stopSound = false; @@ -461,7 +459,7 @@ void Anim::diffNextFrame() { _frameNum++; if ((_frameNum == 1) && (_continuous || (!_playOnce))) - _buffer = *_diffFile; + _buffer = _diffFile; _isAnim = (_frameNum >= 3) && (!_playOnce); _curBit = 0; @@ -473,54 +471,54 @@ void Anim::diffNextFrame() { } _vm->_music->updateMusic(); - _header = READ_LE_UINT32(*_diffFile); - *_diffFile += 4; + _header = READ_LE_UINT32(_diffFile); + _diffFile += 4; - _size = READ_LE_UINT32(*_diffFile); - *_diffFile += 4; + _size = READ_LE_UINT32(_diffFile); + _diffFile += 4; switch (_header) { case 8L: - readBlock(_diffPalette, _size, _diffFile); + readBlock(_diffPalette, _size, &_diffFile); _isPal = true; break; case 10L: - _rawDiffBM._planes[_curBit] = *_diffFile; + _rawDiffBM._planes[_curBit] = _diffFile; if (_isBM) - (*_diffFile) += _size; + _diffFile += _size; else { - readBlock(DrawBitMap->_planes[_curBit], _size, _diffFile); + readBlock(DrawBitMap->_planes[_curBit], _size, &_diffFile); } _curBit++; break; case 11L: - (*_diffFile) += 4; - runLengthDecode(DrawBitMap->_planes[_curBit], *_diffFile); + _diffFile += 4; + runLengthDecode(DrawBitMap->_planes[_curBit], _diffFile); _curBit++; - (*_diffFile) += _size - 4; + _diffFile += _size - 4; break; case 12L: - (*_diffFile) += 4; - VRunLengthDecode(DrawBitMap->_planes[_curBit], *_diffFile, DrawBitMap->_bytesPerRow); + _diffFile += 4; + VRunLengthDecode(DrawBitMap->_planes[_curBit], _diffFile, DrawBitMap->_bytesPerRow); _curBit++; - (*_diffFile) += _size - 4; + _diffFile += _size - 4; break; case 20L: - unDiff(DrawBitMap->_planes[_curBit], DispBitMap->_planes[_curBit], *_diffFile, DrawBitMap->_bytesPerRow, false); + unDiff(DrawBitMap->_planes[_curBit], DispBitMap->_planes[_curBit], _diffFile, DrawBitMap->_bytesPerRow, false); _curBit++; - (*_diffFile) += _size; + _diffFile += _size; break; case 21L: - unDiff(DrawBitMap->_planes[_curBit], DispBitMap->_planes[_curBit], *_diffFile, DrawBitMap->_bytesPerRow, true); + unDiff(DrawBitMap->_planes[_curBit], DispBitMap->_planes[_curBit], _diffFile, DrawBitMap->_bytesPerRow, true); _curBit++; - (*_diffFile) += _size; + _diffFile += _size; break; case 25L: @@ -543,13 +541,13 @@ void Anim::diffNextFrame() { _size -= 8L; - (*_diffFile) += 4; - _sampleSpeed = READ_LE_UINT16(*_diffFile); - (*_diffFile) += 4; + _diffFile += 4; + _sampleSpeed = READ_LE_UINT16(_diffFile); + _diffFile += 4; - byte *music = *_diffFile; + byte *music = _diffFile; uint32 musicsize = _size; - (*_diffFile) += _size; + _diffFile += _size; _vm->_music->playSoundEffect(_sampleSpeed, musicsize, music); break; @@ -578,11 +576,11 @@ void Anim::diffNextFrame() { } _frameNum = 4; /* Random frame number so it never gets back to 2 */ - *_diffFile = _buffer; + _diffFile = _buffer; break; default: - (*_diffFile) += _size; + _diffFile += _size; break; } } @@ -601,7 +599,6 @@ void Anim::playDiff(byte *buffer) { _numChunks = 1; _donePal = false; _stopPlayingEnd = false; - _diffFile = &_storeDiffFile; _isPlaying = true; @@ -610,52 +607,46 @@ void Anim::playDiff(byte *buffer) { _vm->_graphics->blackScreen(); } - _start = buffer; /* Make a copy of the pointer to the start of the file */ - *_diffFile = _start; /* Now can modify the file without modifying the original */ - - if (_start == NULL) { - _isPlaying = false; - return; - } + _diffFile = buffer; _continuous = false; - uint32 signature = READ_BE_UINT32(*_diffFile); - (*_diffFile) += 4; + uint32 signature = READ_BE_UINT32(_diffFile); + _diffFile += 4; - _header = READ_LE_UINT32(*_diffFile); - (*_diffFile) += 4; + _header = READ_LE_UINT32(_diffFile); + _diffFile += 4; if ((signature != MKTAG('D', 'I', 'F', 'F')) || (_header != 1219009121L)) { _isPlaying = false; return; } - _header = READ_LE_UINT32(*_diffFile); - (*_diffFile) += 4; + _header = READ_LE_UINT32(_diffFile); + _diffFile += 4; - _size = READ_LE_UINT32(*_diffFile); - (*_diffFile) += 4; + _size = READ_LE_UINT32(_diffFile); + _diffFile += 4; if (_header == 0) { // sizeof(headerdata) != 18, but the padding might be at the end - _headerdata._version = READ_LE_UINT16(*_diffFile); - (*_diffFile) += 2; - _headerdata._width = READ_LE_UINT16(*_diffFile); - (*_diffFile) += 2; - _headerdata._height = READ_LE_UINT16(*_diffFile); - (*_diffFile) += 2; - _headerdata._depth = *_diffFile[0]; - (*_diffFile)++; - _headerdata._fps = *_diffFile[0]; - (*_diffFile)++; - _headerdata._bufferSize = READ_LE_UINT32(*_diffFile); - (*_diffFile) += 4; - _headerdata._machine = READ_LE_UINT16(*_diffFile); - (*_diffFile) += 2; - _headerdata._flags = READ_LE_UINT32(*_diffFile); - (*_diffFile) += 4; - - (*_diffFile) += _size - 18; + _headerdata._version = READ_LE_UINT16(_diffFile); + _diffFile += 2; + _headerdata._width = READ_LE_UINT16(_diffFile); + _diffFile += 2; + _headerdata._height = READ_LE_UINT16(_diffFile); + _diffFile += 2; + _headerdata._depth = _diffFile[0]; + _diffFile++; + _headerdata._fps = _diffFile[0]; + _diffFile++; + _headerdata._bufferSize = READ_LE_UINT32(_diffFile); + _diffFile += 4; + _headerdata._machine = READ_LE_UINT16(_diffFile); + _diffFile += 2; + _headerdata._flags = READ_LE_UINT32(_diffFile); + _diffFile += 4; + + _diffFile += _size - 18; _continuous = CONTINUOUS & _headerdata._flags; _diffWidth = _headerdata._width; diff --git a/engines/lab/anim.h b/engines/lab/anim.h index 6c4c8bed60..f799ae42a7 100644 --- a/engines/lab/anim.h +++ b/engines/lab/anim.h @@ -77,12 +77,10 @@ private: uint16 _frameNum; bool _playOnce; byte *_buffer; - byte *_storeDiffFile; - byte **_diffFile; + byte *_diffFile; uint32 _size; bool _stopPlayingEnd; uint16 _sampleSpeed; - byte *_start; uint32 _diffWidth; uint32 _diffHeight; bool _stopSound; -- cgit v1.2.3 From 2eb430dcff861bfe1809e10d57e26e79b8beb9ed Mon Sep 17 00:00:00 2001 From: Filippos Karapetis Date: Mon, 7 Dec 2015 01:11:29 +0200 Subject: LAB: Simplify the calling code of playSoundEffect() --- engines/lab/anim.cpp | 8 ++------ 1 file changed, 2 insertions(+), 6 deletions(-) diff --git a/engines/lab/anim.cpp b/engines/lab/anim.cpp index 545b487320..7d2d171ae7 100644 --- a/engines/lab/anim.cpp +++ b/engines/lab/anim.cpp @@ -530,7 +530,7 @@ void Anim::diffNextFrame() { break; case 30L: - case 31L: { + case 31L: if (_waitForEffect) { while (_vm->_music->isSoundEffectActive()) { _vm->_music->updateMusic(); @@ -545,13 +545,9 @@ void Anim::diffNextFrame() { _sampleSpeed = READ_LE_UINT16(_diffFile); _diffFile += 4; - byte *music = _diffFile; - uint32 musicsize = _size; + _vm->_music->playSoundEffect(_sampleSpeed, _size, _diffFile); _diffFile += _size; - - _vm->_music->playSoundEffect(_sampleSpeed, musicsize, music); break; - } case 65535L: if ((_frameNum == 1) || _playOnce || _stopPlayingEnd) { int didTOF = 0; -- cgit v1.2.3 From d264621832bbfe99cb1232f7fd8165cdc2ecc475 Mon Sep 17 00:00:00 2001 From: Eugene Sandulenko Date: Mon, 7 Dec 2015 06:46:41 +0100 Subject: LAB: Fix compilation --- engines/lab/resource.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/engines/lab/resource.cpp b/engines/lab/resource.cpp index 538b6f6023..c6c11059a4 100644 --- a/engines/lab/resource.cpp +++ b/engines/lab/resource.cpp @@ -179,13 +179,13 @@ Common::File *Resource::openDataFile(const char *fileName, uint32 fileHeader) { Common::File *dataFile = new Common::File(); dataFile->open(translateFileName(fileName)); if (!dataFile->isOpen()) - error("openDataFile: Couldn't open %s (%s)", translateFileName(fileName), fileName); + error("openDataFile: Couldn't open %s (%s)", translateFileName(fileName).c_str(), fileName); if (fileHeader > 0) { uint32 headerTag = dataFile->readUint32BE(); if (headerTag != fileHeader) { dataFile->close(); - error("openDataFile: Unexpected header in %s (%s) - expected: %d, got: %d", translateFileName(fileName), fileName, fileHeader, headerTag); + error("openDataFile: Unexpected header in %s (%s) - expected: %d, got: %d", translateFileName(fileName).c_str(), fileName, fileHeader, headerTag); } } -- cgit v1.2.3 From 895d29c1ae411d6a28135451e91e88eba1693f99 Mon Sep 17 00:00:00 2001 From: Strangerke Date: Mon, 7 Dec 2015 07:18:16 +0100 Subject: LAB: Some more renaming, remove useless variables --- engines/lab/engine.cpp | 16 +++++++-------- engines/lab/eventman.cpp | 2 +- engines/lab/interface.cpp | 50 +++++++++++++++++++++++------------------------ engines/lab/interface.h | 12 ++++++------ engines/lab/intro.cpp | 10 +++++----- engines/lab/map.cpp | 19 ++++++------------ engines/lab/special.cpp | 22 ++++++++++----------- 7 files changed, 62 insertions(+), 69 deletions(-) diff --git a/engines/lab/engine.cpp b/engines/lab/engine.cpp index 17ae4cc560..80035f3877 100644 --- a/engines/lab/engine.cpp +++ b/engines/lab/engine.cpp @@ -132,7 +132,7 @@ void LabEngine::freeScreens() { void LabEngine::perFlipGadget(uint16 gadgetId) { for (GadgetList::iterator gadget = _moveGadgetList.begin(); gadget != _moveGadgetList.end(); ++gadget) { Gadget *topGadget = *gadget; - if (topGadget->GadgetID == gadgetId) { + if (topGadget->_gadgetID == gadgetId) { Image *tmpImage = topGadget->_image; topGadget->_image = topGadget->_altImage; topGadget->_altImage = tmpImage; @@ -516,11 +516,11 @@ void LabEngine::mainGameLoop() { gotMessage = true; Common::Point curPos; - curPos.x = curMsg->mouseX; - curPos.y = curMsg->mouseY; + curPos.x = curMsg->_mouseX; + curPos.y = curMsg->_mouseY; _followingCrumbs = false; - if (!from_crumbs(curMsg->msgClass, curMsg->code, curMsg->qualifier, curPos, curInv, curMsg, forceDraw, curMsg->gadgetID, actionMode)) + if (!from_crumbs(curMsg->_msgClass, curMsg->_code, curMsg->_qualifier, curPos, curInv, curMsg, forceDraw, curMsg->_gadgetID, actionMode)) break; } } @@ -618,14 +618,14 @@ bool LabEngine::from_crumbs(uint32 tmpClass, uint16 code, uint16 Qualifier, Comm _music->updateMusic(); _anim->diffNextFrame(); } else { - if (curMsg->msgClass == RAWKEY) { - if ((curMsg->code == 'Y') || (curMsg->code == 'y') || (curMsg->code == 'Q') || (curMsg->code == 'q')) { + if (curMsg->_msgClass == RAWKEY) { + if ((curMsg->_code == 'Y') || (curMsg->_code == 'y') || (curMsg->_code == 'Q') || (curMsg->_code == 'q')) { doit = true; break; - } else if (curMsg->code < 128) { + } else if (curMsg->_code < 128) { break; } - } else if (curMsg->msgClass == MOUSEBUTTONS) { + } else if (curMsg->_msgClass == MOUSEBUTTONS) { break; } } diff --git a/engines/lab/eventman.cpp b/engines/lab/eventman.cpp index aeb6fa3b44..b1b1a68e70 100644 --- a/engines/lab/eventman.cpp +++ b/engines/lab/eventman.cpp @@ -63,7 +63,7 @@ Gadget *EventManager::checkGadgetHit(GadgetList *gadgetList, Common::Point pos) if ((pos.x >= gadget->x) && (pos.y >= gadget->y) && (pos.x <= (gadget->x + gadget->_image->_width)) && (pos.y <= (gadget->y + gadget->_image->_height)) && - !(GADGETOFF & gadget->GadgetFlags)) { + !(GADGETOFF & gadget->_flags)) { if (_vm->_isHiRes) { _hitGadget = gadget; } else { diff --git a/engines/lab/interface.cpp b/engines/lab/interface.cpp index d437fd233e..a044fda849 100644 --- a/engines/lab/interface.cpp +++ b/engines/lab/interface.cpp @@ -48,8 +48,8 @@ Gadget *createButton(uint16 x, uint16 y, uint16 id, uint16 key, Image *im, Image if ((gptr = new Gadget())) { gptr->x = x; gptr->y = y; - gptr->GadgetID = id; - gptr->KeyEquiv = key; + gptr->_gadgetID = id; + gptr->_keyEquiv = key; gptr->_image = im; gptr->_altImage = imalt; @@ -79,7 +79,7 @@ void drawGadgetList(GadgetList *gadgetList) { for (GadgetList::iterator gadget = gadgetList->begin(); gadget != gadgetList->end(); ++gadget) { (*gadget)->_image->drawImage((*gadget)->x, (*gadget)->y); - if (GADGETOFF & (*gadget)->GadgetFlags) + if (GADGETOFF & (*gadget)->_flags) disableGadget((*gadget), 1); } } @@ -90,7 +90,7 @@ void drawGadgetList(GadgetList *gadgetList) { /*****************************************************************************/ void disableGadget(Gadget *curgad, uint16 pencolor) { g_lab->_graphics->overlayRect(pencolor, curgad->x, curgad->y, curgad->x + curgad->_image->_width - 1, curgad->y + curgad->_image->_height - 1); - curgad->GadgetFlags |= GADGETOFF; + curgad->_flags |= GADGETOFF; } @@ -100,7 +100,7 @@ void disableGadget(Gadget *curgad, uint16 pencolor) { /*****************************************************************************/ void enableGadget(Gadget *curgad) { curgad->_image->drawImage(curgad->x, curgad->y); - curgad->GadgetFlags &= !(GADGETOFF); + curgad->_flags &= !(GADGETOFF); } @@ -126,9 +126,9 @@ Gadget *LabEngine::checkNumGadgetHit(GadgetList *gadgetList, uint16 key) { for (GadgetList::iterator gadgetItr = gadgetList->begin(); gadgetItr != gadgetList->end(); ++gadgetItr) { Gadget *gadget = *gadgetItr; - if ((gkey - 1 == gadget->GadgetID || (gkey == 0 && gadget->GadgetID == 9) || - (gadget->KeyEquiv != 0 && makeGadgetKeyEquiv(key) == gadget->KeyEquiv)) - && !(GADGETOFF & gadget->GadgetFlags)) { + if ((gkey - 1 == gadget->_gadgetID || (gkey == 0 && gadget->_gadgetID == 9) || + (gadget->_keyEquiv != 0 && makeGadgetKeyEquiv(key) == gadget->_keyEquiv)) + && !(GADGETOFF & gadget->_flags)) { _event->mouseHide(); gadget->_altImage->drawImage(gadget->x, gadget->y); _event->mouseShow(); @@ -156,30 +156,30 @@ IntuiMessage *LabEngine::getMsg() { if ((curgad = _event->mouseGadget()) != NULL) { _event->updateMouse(); - IMessage.msgClass = GADGETUP; - IMessage.code = curgad->GadgetID; - IMessage.gadgetID = curgad->GadgetID; - IMessage.qualifier = Qualifiers; + IMessage._msgClass = GADGETUP; + IMessage._code = curgad->_gadgetID; + IMessage._gadgetID = curgad->_gadgetID; + IMessage._qualifier = Qualifiers; return &IMessage; - } else if (_event->mouseButton(&IMessage.mouseX, &IMessage.mouseY, true)) { /* Left Button */ - IMessage.qualifier = IEQUALIFIER_LEFTBUTTON | Qualifiers; - IMessage.msgClass = MOUSEBUTTONS; + } else if (_event->mouseButton(&IMessage._mouseX, &IMessage._mouseY, true)) { /* Left Button */ + IMessage._qualifier = IEQUALIFIER_LEFTBUTTON | Qualifiers; + IMessage._msgClass = MOUSEBUTTONS; return &IMessage; - } else if (_event->mouseButton(&IMessage.mouseX, &IMessage.mouseY, false)) { /* Right Button */ - IMessage.qualifier = IEQUALIFIER_RBUTTON | Qualifiers; - IMessage.msgClass = MOUSEBUTTONS; + } else if (_event->mouseButton(&IMessage._mouseX, &IMessage._mouseY, false)) { /* Right Button */ + IMessage._qualifier = IEQUALIFIER_RBUTTON | Qualifiers; + IMessage._msgClass = MOUSEBUTTONS; return &IMessage; - } else if (_event->keyPress(&IMessage.code)) { /* Keyboard key */ - curgad = checkNumGadgetHit(_event->_screenGadgetList, IMessage.code); + } else if (_event->keyPress(&IMessage._code)) { /* Keyboard key */ + curgad = checkNumGadgetHit(_event->_screenGadgetList, IMessage._code); if (curgad) { - IMessage.msgClass = GADGETUP; - IMessage.code = curgad->GadgetID; - IMessage.gadgetID = curgad->GadgetID; + IMessage._msgClass = GADGETUP; + IMessage._code = curgad->_gadgetID; + IMessage._gadgetID = curgad->_gadgetID; } else - IMessage.msgClass = RAWKEY; + IMessage._msgClass = RAWKEY; - IMessage.qualifier = Qualifiers; + IMessage._qualifier = Qualifiers; return &IMessage; } else return NULL; diff --git a/engines/lab/interface.h b/engines/lab/interface.h index 83c8badc15..a8d1140959 100644 --- a/engines/lab/interface.h +++ b/engines/lab/interface.h @@ -37,16 +37,16 @@ namespace Lab { struct IntuiMessage { - uint32 msgClass; - uint16 code, qualifier, mouseX, mouseY, gadgetID; - uint32 seconds, micros; + uint32 _msgClass; + uint16 _code, _qualifier, _mouseX, _mouseY, _gadgetID; + uint32 _seconds, _micros; }; struct Gadget { - uint16 x, y, GadgetID; - uint16 KeyEquiv; // if not zero, a key that activates gadget - uint32 GadgetFlags; + uint16 x, y, _gadgetID; + uint16 _keyEquiv; // if not zero, a key that activates gadget + uint32 _flags; Image *_image, *_altImage; }; diff --git a/engines/lab/intro.cpp b/engines/lab/intro.cpp index 070b03fd3c..7727ac1f93 100644 --- a/engines/lab/intro.cpp +++ b/engines/lab/intro.cpp @@ -53,8 +53,8 @@ void Intro::introEatMessages() { if (msg == NULL) return; else { - if (((msg->msgClass == MOUSEBUTTONS) && (IEQUALIFIER_RBUTTON & msg->qualifier)) || - ((msg->msgClass == RAWKEY) && (msg->code == 27)) + if (((msg->_msgClass == MOUSEBUTTONS) && (IEQUALIFIER_RBUTTON & msg->_qualifier)) || + ((msg->_msgClass == RAWKEY) && (msg->_code == 27)) ) _quitIntro = true; } @@ -151,9 +151,9 @@ void Intro::doPictText(const char *filename, TextFont *msgFont, bool isScreen) { _vm->waitTOF(); } else { - cls = msg->msgClass; - qualifier = msg->qualifier; - code = msg->code; + cls = msg->_msgClass; + qualifier = msg->_qualifier; + code = msg->_code; if (((cls == MOUSEBUTTONS) && (IEQUALIFIER_RBUTTON & qualifier)) || ((cls == RAWKEY) && (code == 27))) { diff --git a/engines/lab/map.cpp b/engines/lab/map.cpp index a565f31d06..7256562988 100644 --- a/engines/lab/map.cpp +++ b/engines/lab/map.cpp @@ -52,8 +52,6 @@ static Image *Map, *Room, *UpArrowRoom, *DownArrowRoom, *Bridge, static uint16 MaxRooms; static MapData *Maps; -extern char *LOWERFLOORS, *MIDDLEFLOORS, *UPPERFLOORS, *MEDMAZEFLOORS, *HEDGEMAZEFLOORS, *SURMAZEFLOORS, *CARNIVALFLOOR, *SURMAZEMSG; - static uint16 MapGadX[3] = {101, 55, 8}, MapGadY[3] = {105, 105, 105}; static Gadget @@ -71,8 +69,6 @@ static GadgetList *MapGadgetList; #define SURMAZEFLOOR 6 #define CARNIVAL 7 - - static uint16 mapScaleX(uint16 x) { if (g_lab->_isHiRes) return (x - 45); @@ -80,8 +76,6 @@ static uint16 mapScaleX(uint16 x) { return ((x - 45) >> 1); } - - static uint16 mapScaleY(uint16 y) { if (g_lab->_isHiRes) return y; @@ -89,7 +83,6 @@ static uint16 mapScaleY(uint16 y) { return ((y - 35) >> 1) - (y >> 6); } - /*****************************************************************************/ /* Loads in the map data. */ /*****************************************************************************/ @@ -532,12 +525,12 @@ void LabEngine::processMap(uint16 CurRoom) { place = 1; } else { - Class = Msg->msgClass; - Code = Msg->code; - GadgetID = Msg->gadgetID; - Qualifier = Msg->qualifier; - MouseX = Msg->mouseX; - MouseY = Msg->mouseY; + Class = Msg->_msgClass; + Code = Msg->_code; + GadgetID = Msg->_gadgetID; + Qualifier = Msg->_qualifier; + MouseX = Msg->_mouseX; + MouseY = Msg->_mouseY; if (((Class == MOUSEBUTTONS) && (IEQUALIFIER_RBUTTON & Qualifier)) || ((Class == RAWKEY) && (Code == 27))) diff --git a/engines/lab/special.cpp b/engines/lab/special.cpp index f4c8439a57..0bed4181dd 100644 --- a/engines/lab/special.cpp +++ b/engines/lab/special.cpp @@ -200,8 +200,8 @@ static bool loadJournalData() { delete journalFile; - BackG.KeyEquiv = VKEY_LTARROW; - ForwardG.KeyEquiv = VKEY_RTARROW; + BackG._keyEquiv = VKEY_LTARROW; + ForwardG._keyEquiv = VKEY_RTARROW; uint16 counter = 0; @@ -219,7 +219,7 @@ static bool loadJournalData() { else gadget->y = g_lab->_graphics->VGAScaleY(JGadY[counter]) - g_lab->_graphics->SVGACord(1); - gadget->GadgetID = counter; + gadget->_gadgetID = counter; counter++; } @@ -345,9 +345,9 @@ void LabEngine::processJournal() { if (Msg == NULL) { _music->updateMusic(); } else { - Class = Msg->msgClass; - Qualifier = Msg->qualifier; - GadID = Msg->code; + Class = Msg->_msgClass; + Qualifier = Msg->_qualifier; + GadID = Msg->_code; if (((Class == MOUSEBUTTONS) && (IEQUALIFIER_RBUTTON & Qualifier)) || ((Class == RAWKEY) && (GadID == 27))) @@ -554,11 +554,11 @@ void LabEngine::processMonitor(char *ntext, TextFont *monitorFont, bool isintera if (Msg == NULL) { _music->updateMusic(); } else { - Class = Msg->msgClass; - Qualifier = Msg->qualifier; - MouseX = Msg->mouseX; - MouseY = Msg->mouseY; - Code = Msg->code; + Class = Msg->_msgClass; + Qualifier = Msg->_qualifier; + MouseX = Msg->_mouseX; + MouseY = Msg->_mouseY; + Code = Msg->_code; if (((Class == MOUSEBUTTONS) && (IEQUALIFIER_RBUTTON & Qualifier)) || ((Class == RAWKEY) && (Code == 27))) -- cgit v1.2.3 From 5636181b78bcffa934cb00b14edb68c2d3319139 Mon Sep 17 00:00:00 2001 From: Strangerke Date: Mon, 7 Dec 2015 07:48:54 +0100 Subject: LAB: Move text functions to DisplayMan, some renaming --- engines/lab/engine.cpp | 4 +- engines/lab/graphics.cpp | 128 ++++++++++++++++++++++++++++++++++++-- engines/lab/graphics.h | 13 ++++ engines/lab/intro.cpp | 2 +- engines/lab/intro.h | 1 - engines/lab/map.cpp | 2 - engines/lab/module.mk | 1 - engines/lab/resource.cpp | 13 ++-- engines/lab/resource.h | 1 - engines/lab/special.cpp | 13 ++-- engines/lab/text.cpp | 156 ----------------------------------------------- engines/lab/text.h | 59 ------------------ engines/lab/vga.cpp | 33 ---------- 13 files changed, 150 insertions(+), 276 deletions(-) delete mode 100644 engines/lab/text.cpp delete mode 100644 engines/lab/text.h delete mode 100644 engines/lab/vga.cpp diff --git a/engines/lab/engine.cpp b/engines/lab/engine.cpp index 80035f3877..ce89225560 100644 --- a/engines/lab/engine.cpp +++ b/engines/lab/engine.cpp @@ -32,7 +32,6 @@ #include "lab/labfun.h" #include "lab/anim.h" #include "lab/image.h" -#include "lab/text.h" #include "lab/intro.h" #include "lab/parsefun.h" #include "lab/interface.h" @@ -1076,8 +1075,7 @@ void LabEngine::go() { } } - closeFont(_msgFont); - + _graphics->closeFont(_msgFont); _graphics->freePict(); freeScreens(); diff --git a/engines/lab/graphics.cpp b/engines/lab/graphics.cpp index 375ab228c6..857c25291d 100644 --- a/engines/lab/graphics.cpp +++ b/engines/lab/graphics.cpp @@ -34,7 +34,6 @@ #include "lab/image.h" #include "lab/labfun.h" #include "lab/parsefun.h" -#include "lab/text.h" #include "lab/resource.h" #include "lab/graphics.h" @@ -208,7 +207,7 @@ static void getWord(char *wordBuffer, const char *mainBuffer, uint16 *wordWidth) /* Gets a line of text for flowText; makes sure that its length is less than */ /* or equal to the maximum width. */ /******************************************************************************/ -static void getLine(TextFont *tf, char *lineBuffer, const char **mainBuffer, uint16 lineWidth) { +void DisplayMan::getLine(TextFont *tf, char *lineBuffer, const char **mainBuffer, uint16 lineWidth) { uint16 curWidth = 0, wordWidth; char wordBuffer[100]; bool doit = true; @@ -1159,9 +1158,128 @@ void DisplayMan::fade(bool fadein, uint16 res) { (0xF00 & fadeNumOut(0xF00 & FadePalette[palIdx], 0xF00 & res, i)); } - g_lab->_graphics->setAmigaPal(newpal, 16); - g_lab->waitTOF(); - g_lab->_music->updateMusic(); + setAmigaPal(newpal, 16); + _vm->waitTOF(); + _vm->_music->updateMusic(); + } +} + +/*****************************************************************************/ +/* Closes a font and frees all memory associated with it. */ +/*****************************************************************************/ +void DisplayMan::closeFont(TextFont *tf) { + if (tf) { + if (tf->_data && tf->_dataLength) + delete[] tf->_data; + + delete tf; + } +} + +/*****************************************************************************/ +/* Returns the length of a text in the specified font. */ +/*****************************************************************************/ +uint16 DisplayMan::textLength(TextFont *tf, const char *text, uint16 numchars) { + uint16 length = 0; + + if (tf) { + for (uint16 i = 0; i < numchars; i++) { + length += tf->_widths[(uint)*text]; + text++; + } + } + + return length; +} + +/*****************************************************************************/ +/* Returns the height of a specified font. */ +/*****************************************************************************/ +uint16 DisplayMan::textHeight(TextFont *tf) { + return (tf) ? tf->_height : 0; +} + +/*****************************************************************************/ +/* Draws the text to the screen. */ +/*****************************************************************************/ +void DisplayMan::text(TextFont *tf, uint16 x, uint16 y, uint16 color, const char *text, uint16 numchars) { + byte *VGATop, *VGACur, *VGATemp, *VGATempLine, *cdata; + uint32 RealOffset, SegmentOffset; + int32 templeft, LeftInSegment; + uint16 bwidth, mask, curpage, data; + + VGATop = getCurrentDrawingBuffer(); + + for (uint16 i = 0; i < numchars; i++) { + RealOffset = (_screenWidth * y) + x; + curpage = RealOffset / _screenBytesPerPage; + SegmentOffset = RealOffset - (curpage * _screenBytesPerPage); + LeftInSegment = _screenBytesPerPage - SegmentOffset; + VGACur = VGATop + SegmentOffset; + + if (tf->_widths[(uint)*text]) { + cdata = tf->_data + tf->_offsets[(uint)*text]; + bwidth = *cdata++; + VGATemp = VGACur; + VGATempLine = VGACur; + + for (uint16 rows = 0; rows < tf->_height; rows++) { + VGATemp = VGATempLine; + templeft = LeftInSegment; + + for (uint16 cols = 0; cols < bwidth; cols++) { + data = *cdata++; + + if (data && (templeft >= 8)) { + for (int j = 7; j >= 0; j--) { + if ((1 << j) & data) + *VGATemp = color; + VGATemp++; + } + + templeft -= 8; + } else if (data) { + mask = 0x80; + templeft = LeftInSegment; + + for (uint16 counterb = 0; counterb < 8; counterb++) { + if (templeft <= 0) { + curpage++; + VGATemp = (byte *)(VGATop - templeft); + /* Set up VGATempLine for next line */ + VGATempLine -= _screenBytesPerPage; + /* Set up LeftInSegment for next line */ + LeftInSegment += _screenBytesPerPage + templeft; + templeft += _screenBytesPerPage; + } + + if (mask & data) + *VGATemp = color; + + VGATemp++; + + mask = mask >> 1; + templeft--; + } + } else { + templeft -= 8; + VGATemp += 8; + } + } + + VGATempLine += _screenWidth; + LeftInSegment -= _screenWidth; + + if (LeftInSegment <= 0) { + curpage++; + VGATempLine -= _screenBytesPerPage; + LeftInSegment += _screenBytesPerPage; + } + } + } + + x += tf->_widths[(int)*text]; + text++; } } } // End of namespace Lab diff --git a/engines/lab/graphics.h b/engines/lab/graphics.h index 564f041607..5d97507c19 100644 --- a/engines/lab/graphics.h +++ b/engines/lab/graphics.h @@ -37,6 +37,14 @@ namespace Lab { class LabEngine; +struct TextFont { + uint32 _dataLength; + uint16 _height; + byte _widths[256]; + uint16 _offsets[256]; + byte *_data; +}; + class DisplayMan { private: LabEngine *_vm; @@ -129,6 +137,11 @@ public: void scrollDisplayX(int16 dx, uint16 x1, uint16 y1, uint16 x2, uint16 y2); void scrollDisplayY(int16 dy, uint16 x1, uint16 y1, uint16 x2, uint16 y2); void fade(bool fadein, uint16 res); + void closeFont(TextFont *tf); + uint16 textLength(TextFont *tf, const char *text, uint16 numchars); + uint16 textHeight(TextFont *tf); + void text(TextFont *tf, uint16 x, uint16 y, uint16 color, const char *text, uint16 numchars); + void getLine(TextFont *tf, char *lineBuffer, const char **mainBuffer, uint16 lineWidth); bool _longWinInFront; bool _lastMessageLong; diff --git a/engines/lab/intro.cpp b/engines/lab/intro.cpp index 7727ac1f93..4b0ed66f56 100644 --- a/engines/lab/intro.cpp +++ b/engines/lab/intro.cpp @@ -444,7 +444,7 @@ void Intro::introSequence() { _vm->_anim->_doBlack = true; } - closeFont(msgFont); + _vm->_graphics->closeFont(msgFont); } } // End of namespace Lab diff --git a/engines/lab/intro.h b/engines/lab/intro.h index 47b61daeca..c532bdfa1e 100644 --- a/engines/lab/intro.h +++ b/engines/lab/intro.h @@ -32,7 +32,6 @@ #define LAB_INTRO_H #include "lab/intro.h" -#include "lab/text.h" namespace Lab { diff --git a/engines/lab/map.cpp b/engines/lab/map.cpp index 7256562988..b7006a3dc9 100644 --- a/engines/lab/map.cpp +++ b/engines/lab/map.cpp @@ -32,12 +32,10 @@ #include "lab/labfun.h" #include "lab/anim.h" #include "lab/image.h" -#include "lab/text.h" #include "lab/parsefun.h" #include "lab/parsetypes.h" #include "lab/resource.h" #include "lab/interface.h" -#include "lab/text.h" namespace Lab { diff --git a/engines/lab/module.mk b/engines/lab/module.mk index 3985b1415f..5c0aed5783 100644 --- a/engines/lab/module.mk +++ b/engines/lab/module.mk @@ -17,7 +17,6 @@ MODULE_OBJS := \ resource.o \ savegame.o \ special.o \ - text.o \ tilepuzzle.o \ timing.o diff --git a/engines/lab/resource.cpp b/engines/lab/resource.cpp index c6c11059a4..f76aea0087 100644 --- a/engines/lab/resource.cpp +++ b/engines/lab/resource.cpp @@ -29,7 +29,6 @@ */ #include "lab/lab.h" -#include "lab/text.h" #include "lab/resource.h" namespace Lab { @@ -58,14 +57,14 @@ TextFont *Resource::getFont(const char *fileName) { _vm->_music->updateMusic(); TextFont *textfont = new TextFont(); - textfont->DataLength = fileSize - headerSize; - textfont->Height = dataFile->readUint16LE(); - dataFile->read(textfont->Widths, 256); + textfont->_dataLength = fileSize - headerSize; + textfont->_height = dataFile->readUint16LE(); + dataFile->read(textfont->_widths, 256); for (int i = 0; i < 256; i++) - textfont->Offsets[i] = dataFile->readUint16LE(); + textfont->_offsets[i] = dataFile->readUint16LE(); dataFile->skip(4); - textfont->data = new byte[textfont->DataLength + 4]; - dataFile->read(textfont->data, textfont->DataLength); + textfont->_data = new byte[textfont->_dataLength + 4]; + dataFile->read(textfont->_data, textfont->_dataLength); return textfont; } diff --git a/engines/lab/resource.h b/engines/lab/resource.h index 99996a1475..e050a156cb 100644 --- a/engines/lab/resource.h +++ b/engines/lab/resource.h @@ -32,7 +32,6 @@ #define LAB_RESOURCE_H #include "lab/labfun.h" -#include "lab/text.h" namespace Lab { diff --git a/engines/lab/special.cpp b/engines/lab/special.cpp index 0bed4181dd..6642865cda 100644 --- a/engines/lab/special.cpp +++ b/engines/lab/special.cpp @@ -39,7 +39,6 @@ #include "lab/parsefun.h" #include "lab/interface.h" #include "lab/anim.h" -#include "lab/text.h" #include "lab/parsetypes.h" #include "lab/resource.h" @@ -105,7 +104,7 @@ void LabEngine::doNotes() { g_lab->_graphics->flowText(noteFont, -2 + g_lab->_graphics->SVGACord(1), 0, 0, false, false, true, true, g_lab->_graphics->VGAScaleX(25) + g_lab->_graphics->SVGACord(15), g_lab->_graphics->VGAScaleY(50), g_lab->_graphics->VGAScaleX(295) - g_lab->_graphics->SVGACord(15), g_lab->_graphics->VGAScaleY(148), ntext); g_lab->_graphics->setPalette(g_lab->_anim->_diffPalette, 256); - closeFont(noteFont); + g_lab->_graphics->closeFont(noteFont); delete[] ntext; } @@ -123,7 +122,7 @@ void LabEngine::doWestPaper() { paperFont = g_lab->_resource->getFont("P:News22.fon"); ntext = g_lab->_resource->getText("Lab:Rooms/Date"); g_lab->_graphics->flowText(paperFont, 0, 0, 0, false, true, false, true, g_lab->_graphics->VGAScaleX(57), g_lab->_graphics->VGAScaleY(77) + g_lab->_graphics->SVGACord(2), g_lab->_graphics->VGAScaleX(262), g_lab->_graphics->VGAScaleY(91), ntext); - closeFont(paperFont); + g_lab->_graphics->closeFont(paperFont); delete[] ntext; paperFont = g_lab->_resource->getFont("P:News32.fon"); @@ -135,7 +134,7 @@ void LabEngine::doWestPaper() { g_lab->_graphics->flowText(paperFont, -8 - g_lab->_graphics->SVGACord(1), 0, 0, false, true, false, true, g_lab->_graphics->VGAScaleX(57), g_lab->_graphics->VGAScaleY(86) - g_lab->_graphics->SVGACord(2), g_lab->_graphics->VGAScaleX(262), g_lab->_graphics->VGAScaleY(132), ntext); } else y = 115 - g_lab->_graphics->SVGACord(5); - closeFont(paperFont); + g_lab->_graphics->closeFont(paperFont); delete[] ntext; paperFont = g_lab->_resource->getFont("P:Note.fon"); @@ -145,7 +144,7 @@ void LabEngine::doWestPaper() { ntext = g_lab->_resource->getText("Lab:Rooms/Col2"); CharsPrinted = g_lab->_graphics->flowTextScaled(paperFont, -4, 0, 0, false, false, false, true, 162, y, 275, 148, ntext); delete[] ntext; - closeFont(paperFont); + g_lab->_graphics->closeFont(paperFont); g_lab->_graphics->setPalette(g_lab->_anim->_diffPalette, 256); } @@ -470,7 +469,7 @@ void LabEngine::drawMonText(char *text, TextFont *monitorFont, uint16 x1, uint16 numlines += (*text - '0'); text += 2; - fheight = textHeight(monitorFont); + fheight = g_lab->_graphics->textHeight(monitorFont); x1 = MonButton->_width + _graphics->VGAScaleX(3); MonGadHeight = MonButton->_height + _graphics->VGAScaleY(3); @@ -645,7 +644,7 @@ void LabEngine::doMonitor(char *background, char *textfile, bool isinteractive, _graphics->fade(false, 0); _event->mouseHide(); delete[] ntext; - closeFont(monitorFont); + g_lab->_graphics->closeFont(monitorFont); _graphics->setAPen(0); _graphics->rectFill(0, 0, _graphics->_screenWidth - 1, _graphics->_screenHeight - 1); diff --git a/engines/lab/text.cpp b/engines/lab/text.cpp deleted file mode 100644 index f784c2126d..0000000000 --- a/engines/lab/text.cpp +++ /dev/null @@ -1,156 +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. - * - */ - -/* - * This code is based on Labyrinth of Time code with assistance of - * - * Copyright (c) 1993 Terra Nova Development - * Copyright (c) 2004 The Wyrmkeep Entertainment Co. - * - */ - -#include "lab/lab.h" -#include "lab/labfun.h" -#include "lab/text.h" - -namespace Lab { - -/*****************************************************************************/ -/* Closes a font and frees all memory associated with it. */ -/*****************************************************************************/ -void closeFont(TextFont *tf) { - if (tf) { - if (tf->data && tf->DataLength) - delete[] tf->data; - - delete tf; - } -} - -/*****************************************************************************/ -/* Returns the length of a text in the specified font. */ -/*****************************************************************************/ -uint16 textLength(TextFont *tf, const char *text, uint16 numchars) { - uint16 length = 0; - - if (tf) { - for (uint16 i = 0; i < numchars; i++) { - length += tf->Widths[(uint)*text]; - text++; - } - } - - return length; -} - -/*****************************************************************************/ -/* Returns the height of a specified font. */ -/*****************************************************************************/ -uint16 textHeight(TextFont *tf) { - return (tf) ? tf->Height : 0; -} - -/*****************************************************************************/ -/* Draws the text to the screen. */ -/*****************************************************************************/ -void text(TextFont *tf, uint16 x, uint16 y, uint16 color, const char *text, uint16 numchars) { - byte *VGATop, *VGACur, *VGATemp, *VGATempLine, *cdata; - uint32 RealOffset, SegmentOffset; - int32 templeft, LeftInSegment; - uint16 bwidth, mask, curpage, data; - - VGATop = g_lab->_graphics->getCurrentDrawingBuffer(); - - for (uint16 i = 0; i < numchars; i++) { - RealOffset = (g_lab->_graphics->_screenWidth * y) + x; - curpage = RealOffset / g_lab->_graphics->_screenBytesPerPage; - SegmentOffset = RealOffset - (curpage * g_lab->_graphics->_screenBytesPerPage); - LeftInSegment = g_lab->_graphics->_screenBytesPerPage - SegmentOffset; - VGACur = VGATop + SegmentOffset; - - if (tf->Widths[(uint)*text]) { - cdata = tf->data + tf->Offsets[(uint)*text]; - bwidth = *cdata++; - VGATemp = VGACur; - VGATempLine = VGACur; - - for (uint16 rows = 0; rows < tf->Height; rows++) { - VGATemp = VGATempLine; - templeft = LeftInSegment; - - for (uint16 cols = 0; cols < bwidth; cols++) { - data = *cdata++; - - if (data && (templeft >= 8)) { - for (int j = 7; j >= 0; j--) { - if ((1 << j) & data) - *VGATemp = color; - VGATemp++; - } - - templeft -= 8; - } else if (data) { - mask = 0x80; - templeft = LeftInSegment; - - for (uint16 counterb = 0; counterb < 8; counterb++) { - if (templeft <= 0) { - curpage++; - VGATemp = (byte *)(VGATop - templeft); - /* Set up VGATempLine for next line */ - VGATempLine -= g_lab->_graphics->_screenBytesPerPage; - /* Set up LeftInSegment for next line */ - LeftInSegment += g_lab->_graphics->_screenBytesPerPage + templeft; - templeft += g_lab->_graphics->_screenBytesPerPage; - } - - if (mask & data) - *VGATemp = color; - - VGATemp++; - - mask = mask >> 1; - templeft--; - } - } else { - templeft -= 8; - VGATemp += 8; - } - } - - VGATempLine += g_lab->_graphics->_screenWidth; - LeftInSegment -= g_lab->_graphics->_screenWidth; - - if (LeftInSegment <= 0) { - curpage++; - VGATempLine -= g_lab->_graphics->_screenBytesPerPage; - LeftInSegment += g_lab->_graphics->_screenBytesPerPage; - } - } - } - - x += tf->Widths[(int)*text]; - text++; - } -} - -} // End of namespace Lab diff --git a/engines/lab/text.h b/engines/lab/text.h deleted file mode 100644 index 7401f02661..0000000000 --- a/engines/lab/text.h +++ /dev/null @@ -1,59 +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. - * - */ - -/* - * This code is based on Labyrinth of Time code with assistance of - * - * Copyright (c) 1993 Terra Nova Development - * Copyright (c) 2004 The Wyrmkeep Entertainment Co. - * - */ - -#ifndef LAB_TEXT_H -#define LAB_TEXT_H - -namespace Lab { - -#if defined(WIN32) -#pragma pack(push, 1) -#endif - -struct TextFont { - uint32 DataLength; - uint16 Height; - byte Widths[256]; - uint16 Offsets[256]; - byte *data; -}; - -#if defined(WIN32) -#pragma pack(pop) -#endif - -void closeFont(TextFont *tf); -uint16 textLength(TextFont *tf, const char *text, uint16 numchars); -uint16 textHeight(TextFont *tf); -void text(TextFont *tf, uint16 x, uint16 y, uint16 color, const char *text, uint16 numchars); - -} // End of namespace Lab - -#endif /* LAB_TEXT_H */ diff --git a/engines/lab/vga.cpp b/engines/lab/vga.cpp deleted file mode 100644 index b80f338c1e..0000000000 --- a/engines/lab/vga.cpp +++ /dev/null @@ -1,33 +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. - * - */ - -/* - * This code is based on Labyrinth of Time code with assistance of - * - * Copyright (c) 1993 Terra Nova Development - * Copyright (c) 2004 The Wyrmkeep Entertainment Co. - * - */ - -namespace Lab { - -} // End of namespace Lab -- cgit v1.2.3 From f3a24ff593024e3a997ed1a9160d32a84eb42d74 Mon Sep 17 00:00:00 2001 From: Strangerke Date: Mon, 7 Dec 2015 08:21:27 +0100 Subject: LAB: Some refactoring, remove dead code and a useless return value --- engines/lab/anim.cpp | 64 +++++++++++++++++++--------------------------- engines/lab/anim.h | 32 +++++++++++------------ engines/lab/graphics.cpp | 30 ++++++++++------------ engines/lab/graphics.h | 5 +++- engines/lab/special.cpp | 1 - engines/lab/tilepuzzle.cpp | 2 +- 6 files changed, 62 insertions(+), 72 deletions(-) diff --git a/engines/lab/anim.cpp b/engines/lab/anim.cpp index 7d2d171ae7..ee636604e8 100644 --- a/engines/lab/anim.cpp +++ b/engines/lab/anim.cpp @@ -33,9 +33,7 @@ namespace Lab { -extern BitMap *DrawBitMap; extern byte **startoffile; -extern BitMap *DispBitMap; Anim::Anim(LabEngine *vm) : _vm(vm) { _header = 0; @@ -71,12 +69,11 @@ Anim::Anim(LabEngine *vm) : _vm(vm) { _doBlack = false; _diffWidth = 0; _diffHeight = 0; - _stopSound = false; _dataBytesPerRow = 0; + DrawBitMap = &bit2; for (int i = 0; i < 3 * 256; i++) _diffPalette[i] = 0; - } /*------------------------ unDiff Horizontal Memory -------------------------*/ @@ -85,7 +82,7 @@ Anim::Anim(LabEngine *vm) : _vm(vm) { /* Undiffs a piece of memory when header size is a byte, and copy/skip size */ /* is also a byte. */ /*****************************************************************************/ -void Anim::unDIFFByteByte(byte *dest, byte *diff) { +void Anim::unDiffByteByte(byte *dest, byte *diff) { uint16 skip, copy; while (1) { @@ -115,7 +112,7 @@ void Anim::unDIFFByteByte(byte *dest, byte *diff) { /* Undiffs a piece of memory when header size is a byte, and copy/skip size */ /* is a word. */ /*****************************************************************************/ -void Anim::unDIFFByteWord(uint16 *dest, uint16 *diff) { +void Anim::unDiffByteWord(uint16 *dest, uint16 *diff) { uint16 skip, copy; while (1) { @@ -168,13 +165,13 @@ void Anim::unDIFFByteWord(uint16 *dest, uint16 *diff) { /*****************************************************************************/ /* UnDiffs a coded DIFF string onto an already initialized piece of memory. */ /*****************************************************************************/ -bool Anim::unDIFFMemory(byte *dest, byte *diff, uint16 headerSize, uint16 copySize) { +bool Anim::unDiffMemory(byte *dest, byte *diff, uint16 headerSize, uint16 copySize) { if (headerSize == 1) { if (copySize == 1) - unDIFFByteByte(dest, diff); + unDiffByteByte(dest, diff); else if (copySize == 2) - unDIFFByteWord((uint16 *)dest, (uint16 *)diff); + unDiffByteWord((uint16 *)dest, (uint16 *)diff); else return false; @@ -190,7 +187,7 @@ bool Anim::unDIFFMemory(byte *dest, byte *diff, uint16 headerSize, uint16 copySi /* Undiffs a piece of memory when header size is a byte, and copy/skip size */ /* is a byte. */ /*****************************************************************************/ -void Anim::VUnDIFFByteByte(byte *dest, byte *diff, uint16 bytesPerRow) { +void Anim::VUnDiffByteByte(byte *dest, byte *diff, uint16 bytesPerRow) { byte *curPtr; uint16 skip, copy; uint16 counter = 0; @@ -228,7 +225,7 @@ void Anim::VUnDIFFByteByte(byte *dest, byte *diff, uint16 bytesPerRow) { /* Undiffs a piece of memory when header size is a byte, and copy/skip size */ /* is a word. */ /*****************************************************************************/ -void Anim::VUnDIFFByteWord(uint16 *dest, uint16 *diff, uint16 bytesPerRow) { +void Anim::VUnDiffByteWord(uint16 *dest, uint16 *diff, uint16 bytesPerRow) { uint16 *curPtr; uint16 skip, copy; uint16 counter = 0; @@ -268,7 +265,7 @@ void Anim::VUnDIFFByteWord(uint16 *dest, uint16 *diff, uint16 bytesPerRow) { /* Undiffs a piece of memory when header size is a byte, and copy/skip size */ /* is a long. */ /*****************************************************************************/ -void Anim::VUnDIFFByteLong(uint32 *dest, uint32 *diff, uint16 bytesPerRow) { +void Anim::VUnDiffByteLong(uint32 *dest, uint32 *diff, uint16 bytesPerRow) { uint32 *_curPtr; uint16 skip, copy; @@ -310,14 +307,14 @@ void Anim::VUnDIFFByteLong(uint32 *dest, uint32 *diff, uint16 bytesPerRow) { /*****************************************************************************/ /* UnDiffs a coded DIFF string onto an already initialized piece of memory. */ /*****************************************************************************/ -bool Anim::VUnDIFFMemory(byte *dest, byte *diff, uint16 headerSize, uint16 copySize, uint16 bytesPerRow) { +bool Anim::VUnDiffMemory(byte *dest, byte *diff, uint16 headerSize, uint16 copySize, uint16 bytesPerRow) { if (headerSize == 1) { if (copySize == 1) - VUnDIFFByteByte(dest, diff, bytesPerRow); + VUnDiffByteByte(dest, diff, bytesPerRow); else if (copySize == 2) - VUnDIFFByteWord((uint16 *)dest, (uint16 *)diff, bytesPerRow); + VUnDiffByteWord((uint16 *)dest, (uint16 *)diff, bytesPerRow); else if (copySize == 4) - VUnDIFFByteLong((uint32 *)dest, (uint32 *)diff, bytesPerRow); + VUnDiffByteLong((uint32 *)dest, (uint32 *)diff, bytesPerRow); else return false; } else @@ -407,9 +404,9 @@ void Anim::unDiff(byte *newBuf, byte *oldBuf, byte *diffData, uint16 bytesPerRow diffData++; if (isV) - VUnDIFFMemory(newBuf, diffData, 1, bufType + 1, bytesPerRow); + VUnDiffMemory(newBuf, diffData, 1, bufType + 1, bytesPerRow); else - unDIFFMemory(newBuf, diffData, 1, bufType + 1); + unDiffMemory(newBuf, diffData, 1, bufType + 1); } void Anim::readBlock(void *Buffer, uint32 Size, byte **File) { @@ -421,12 +418,12 @@ void Anim::diffNextFrame() { if (_header == 65535) /* Already done. */ return; - if (DispBitMap->_flags & BITMAPF_VIDEO) { - DispBitMap->_planes[0] = _vm->_graphics->getCurrentDrawingBuffer(); - DispBitMap->_planes[1] = DispBitMap->_planes[0] + 0x10000; - DispBitMap->_planes[2] = DispBitMap->_planes[1] + 0x10000; - DispBitMap->_planes[3] = DispBitMap->_planes[2] + 0x10000; - DispBitMap->_planes[4] = DispBitMap->_planes[3] + 0x10000; + if (_vm->_graphics->_dispBitMap->_flags & BITMAPF_VIDEO) { + _vm->_graphics->_dispBitMap->_planes[0] = _vm->_graphics->getCurrentDrawingBuffer(); + _vm->_graphics->_dispBitMap->_planes[1] = _vm->_graphics->_dispBitMap->_planes[0] + 0x10000; + _vm->_graphics->_dispBitMap->_planes[2] = _vm->_graphics->_dispBitMap->_planes[1] + 0x10000; + _vm->_graphics->_dispBitMap->_planes[3] = _vm->_graphics->_dispBitMap->_planes[2] + 0x10000; + _vm->_graphics->_dispBitMap->_planes[4] = _vm->_graphics->_dispBitMap->_planes[3] + 0x10000; } _vm->_event->mouseHide(); @@ -464,7 +461,7 @@ void Anim::diffNextFrame() { _isAnim = (_frameNum >= 3) && (!_playOnce); _curBit = 0; - if (DispBitMap->_flags & BITMAPF_VIDEO) + if (_vm->_graphics->_dispBitMap->_flags & BITMAPF_VIDEO) _vm->_graphics->screenUpdate(); return; /* done with the next frame. */ @@ -510,13 +507,13 @@ void Anim::diffNextFrame() { break; case 20L: - unDiff(DrawBitMap->_planes[_curBit], DispBitMap->_planes[_curBit], _diffFile, DrawBitMap->_bytesPerRow, false); + unDiff(DrawBitMap->_planes[_curBit], _vm->_graphics->_dispBitMap->_planes[_curBit], _diffFile, DrawBitMap->_bytesPerRow, false); _curBit++; _diffFile += _size; break; case 21L: - unDiff(DrawBitMap->_planes[_curBit], DispBitMap->_planes[_curBit], _diffFile, DrawBitMap->_bytesPerRow, true); + unDiff(DrawBitMap->_planes[_curBit], _vm->_graphics->_dispBitMap->_planes[_curBit], _diffFile, DrawBitMap->_bytesPerRow, true); _curBit++; _diffFile += _size; break; @@ -550,15 +547,15 @@ void Anim::diffNextFrame() { break; case 65535L: if ((_frameNum == 1) || _playOnce || _stopPlayingEnd) { - int didTOF = 0; + bool didTOF = false; if (_waitForEffect) { while (_vm->_music->isSoundEffectActive()) { _vm->_music->updateMusic(); _vm->waitTOF(); - if (DispBitMap->_flags & BITMAPF_VIDEO) - didTOF = 1; + if (_vm->_graphics->_dispBitMap->_flags & BITMAPF_VIDEO) + didTOF = true; } } @@ -691,13 +688,6 @@ void Anim::stopDiffEnd() { } } -/*****************************************************************************/ -/* Stops the continuous sound from playing. */ -/*****************************************************************************/ -void Anim::stopSound() { - _stopSound = true; -} - /*****************************************************************************/ /* Reads in a DIFF file. */ /*****************************************************************************/ diff --git a/engines/lab/anim.h b/engines/lab/anim.h index f799ae42a7..54efa4fcfa 100644 --- a/engines/lab/anim.h +++ b/engines/lab/anim.h @@ -83,15 +83,25 @@ private: uint16 _sampleSpeed; uint32 _diffWidth; uint32 _diffHeight; - bool _stopSound; uint16 _dataBytesPerRow; + BitMap bit2; + BitMap *DrawBitMap; - void unDIFFByteByte(byte *dest, byte *diff); - void unDIFFByteWord(uint16 *dest, uint16 *diff); - void VUnDIFFByteByte(byte *Dest, byte *diff, uint16 bytesperrow); - void VUnDIFFByteWord(uint16 *Dest, uint16 *diff, uint16 bytesperrow); - void VUnDIFFByteLong(uint32 *Dest, uint32 *diff, uint16 bytesperrow); + bool unDiffMemory(byte *dest, /* Where to Un-DIFF */ + byte *diff, /* The DIFFed code. */ + uint16 headerSize, /* Size of header (1, 2 or 4 bytes) (only supports 1 currently */ + uint16 copySize); /* Size of minimum copy or skip. (1, 2 or 4 bytes) */ + + void runLengthDecode(byte *dest, byte *source); + void VRunLengthDecode(byte *dest, byte *source, uint16 bytesPerRow); + void unDiffByteByte(byte *dest, byte *diff); + void unDiffByteWord(uint16 *dest, uint16 *diff); + bool VUnDiffMemory(byte *dest, byte *diff, uint16 headerSize, uint16 copySize, uint16 bytesPerRow); + void VUnDiffByteByte(byte *Dest, byte *diff, uint16 bytesperrow); + void VUnDiffByteWord(uint16 *Dest, uint16 *diff, uint16 bytesperrow); + void VUnDiffByteLong(uint32 *Dest, uint32 *diff, uint16 bytesperrow); void readBlock(void *Buffer, uint32 Size, byte **File); + void playDiff(byte *buffer); public: Anim(LabEngine *vm); @@ -105,21 +115,11 @@ public: BitMap _rawDiffBM; void unDiff(byte *newBuf, byte *oldBuf, byte *diffData, uint16 bytesperrow, bool isV); - bool unDIFFMemory(byte *dest, /* Where to Un-DIFF */ - byte *diff, /* The DIFFed code. */ - uint16 headerSize, /* Size of header (1, 2 or 4 bytes) (only supports 1 currently */ - uint16 copySize); /* Size of minimum copy or skip. (1, 2 or 4 bytes) */ - - bool VUnDIFFMemory(byte *dest, byte *diff, uint16 headerSize, uint16 copySize, uint16 bytesPerRow); - void runLengthDecode(byte *dest, byte *source); - void VRunLengthDecode(byte *dest, byte *source, uint16 bytesPerRow); bool readDiff(byte *buffer, bool playOnce); - void playDiff(byte *buffer); void diffNextFrame(); void readSound(bool waitTillFinished, Common::File *file); void stopDiff(); void stopDiffEnd(); - void stopSound(); }; } // End of namespace Lab diff --git a/engines/lab/graphics.cpp b/engines/lab/graphics.cpp index 857c25291d..5147ac3654 100644 --- a/engines/lab/graphics.cpp +++ b/engines/lab/graphics.cpp @@ -39,8 +39,6 @@ namespace Lab { -BitMap bit1, bit2, *DispBitMap = &bit1, *DrawBitMap = &bit1; - DisplayMan::DisplayMan(LabEngine *vm) : _vm(vm) { _longWinInFront = false; _lastMessageLong = false; @@ -57,6 +55,8 @@ DisplayMan::DisplayMan(LabEngine *vm) : _vm(vm) { _screenWidth = 0; _screenHeight = 0; + _dispBitMap = &bit1; + for (int i = 0; i < 256 * 3; i++) _curvgapal[i] = 0; } @@ -129,7 +129,7 @@ void DisplayMan::loadPict(const char *filename) { /*****************************************************************************/ /* Reads in a picture into the dest bitmap. */ /*****************************************************************************/ -bool DisplayMan::readPict(const char *filename, bool playOnce) { +void DisplayMan::readPict(const char *filename, bool playOnce) { _vm->_anim->stopDiff(); loadPict(filename); @@ -139,13 +139,11 @@ bool DisplayMan::readPict(const char *filename, bool playOnce) { if (!_vm->_music->_doNotFilestopSoundEffect) _vm->_music->stopSoundEffect(); - DispBitMap->_bytesPerRow = _screenWidth; - DispBitMap->_rows = _screenHeight; - DispBitMap->_flags = BITMAPF_VIDEO; + _dispBitMap->_bytesPerRow = _screenWidth; + _dispBitMap->_rows = _screenHeight; + _dispBitMap->_flags = BITMAPF_VIDEO; _vm->_anim->readDiff(_curBitmap, playOnce); - - return true; } /*****************************************************************************/ @@ -161,14 +159,14 @@ byte *DisplayMan::readPictToMem(const char *filename, uint16 x, uint16 y) { if (!_vm->_music->_doNotFilestopSoundEffect) _vm->_music->stopSoundEffect(); - DispBitMap->_bytesPerRow = x; - DispBitMap->_rows = y; - DispBitMap->_flags = BITMAPF_NONE; - DispBitMap->_planes[0] = _curBitmap; - DispBitMap->_planes[1] = DispBitMap->_planes[0] + 0x10000; - DispBitMap->_planes[2] = DispBitMap->_planes[1] + 0x10000; - DispBitMap->_planes[3] = DispBitMap->_planes[2] + 0x10000; - DispBitMap->_planes[4] = DispBitMap->_planes[3] + 0x10000; + _dispBitMap->_bytesPerRow = x; + _dispBitMap->_rows = y; + _dispBitMap->_flags = BITMAPF_NONE; + _dispBitMap->_planes[0] = _curBitmap; + _dispBitMap->_planes[1] = _dispBitMap->_planes[0] + 0x10000; + _dispBitMap->_planes[2] = _dispBitMap->_planes[1] + 0x10000; + _dispBitMap->_planes[3] = _dispBitMap->_planes[2] + 0x10000; + _dispBitMap->_planes[4] = _dispBitMap->_planes[3] + 0x10000; _vm->_anim->readDiff(_curBitmap, true); diff --git a/engines/lab/graphics.h b/engines/lab/graphics.h index 5d97507c19..8e67cd2366 100644 --- a/engines/lab/graphics.h +++ b/engines/lab/graphics.h @@ -32,6 +32,7 @@ #define LAB_GRAPHICS_H #include "graphics/palette.h" +#include "lab/anim.h" namespace Lab { @@ -67,7 +68,7 @@ public: int16 VGAScaleY(int16 y); uint16 SVGACord(uint16 cord); void loadPict(const char *filename); - bool readPict(const char *filename, bool playOnce); + void readPict(const char *filename, bool playOnce); void freePict(); byte *readPictToMem(const char *filename, uint16 x, uint16 y); void doScrollBlack(); @@ -152,6 +153,8 @@ public: byte *_currentDisplayBuffer; bool _doNotDrawMessage; uint16 *FadePalette; + BitMap bit1; + BitMap *_dispBitMap; }; } // End of namespace Lab diff --git a/engines/lab/special.cpp b/engines/lab/special.cpp index 6642865cda..e49119634a 100644 --- a/engines/lab/special.cpp +++ b/engines/lab/special.cpp @@ -59,7 +59,6 @@ static uint16 monitorPage; static const char *TextFileName; Image *MonButton; -extern BitMap *DispBitMap, *DrawBitMap; #define INCL(BITSET,BIT) ((BITSET) |= (BIT)) #define SETBIT(BITSET,BITNUM) INCL(BITSET, (1 << (BITNUM))) diff --git a/engines/lab/tilepuzzle.cpp b/engines/lab/tilepuzzle.cpp index 5ab0454086..0d050cc6bc 100644 --- a/engines/lab/tilepuzzle.cpp +++ b/engines/lab/tilepuzzle.cpp @@ -163,7 +163,7 @@ void LabEngine::changeTile(uint16 col, uint16 row) { if (check) { _conditions->inclElement(BRICKOPEN); /* unlocked combination */ _anim->_doBlack = true; - check = _graphics->readPict("p:Up/BDOpen", true); + _graphics->readPict("p:Up/BDOpen", true); } } } -- cgit v1.2.3 From 87201cfed25e2b145d55c5d77fe0988d32444395 Mon Sep 17 00:00:00 2001 From: Filippos Karapetis Date: Mon, 7 Dec 2015 09:58:46 +0200 Subject: LAB: Rename and clean up some of the scene transition code --- engines/lab/graphics.cpp | 38 +++++++++++++++++++------------------- engines/lab/graphics.h | 13 ++++++++++++- engines/lab/parsetypes.h | 4 ++-- engines/lab/processroom.cpp | 4 ++-- engines/lab/resource.cpp | 2 +- 5 files changed, 36 insertions(+), 25 deletions(-) diff --git a/engines/lab/graphics.cpp b/engines/lab/graphics.cpp index 5147ac3654..95551040c2 100644 --- a/engines/lab/graphics.cpp +++ b/engines/lab/graphics.cpp @@ -409,18 +409,6 @@ void DisplayMan::drawMessage(const char *str) { } } -/*---------------------------------------------------------------------------*/ -/*--------------------------- All the wipe stuff. ---------------------------*/ -/*---------------------------------------------------------------------------*/ - -#define TRANSWIPE 1 -#define SCROLLWIPE 2 -#define SCROLLBLACK 3 -#define SCROLLBOUNCE 4 -#define TRANSPORTER 5 -#define READFIRSTFRAME 6 -#define READNEXTFRAME 7 - /*****************************************************************************/ /* Scrolls the display to black. */ /*****************************************************************************/ @@ -736,19 +724,31 @@ void DisplayMan::doTransWipe(CloseDataPtr *cPtr, char *filename) { /*****************************************************************************/ /* Does a certain number of pre-programmed wipes. */ /*****************************************************************************/ -void DisplayMan::doWipe(uint16 wipeType, CloseDataPtr *cPtr, char *filename) { - if ((wipeType == TRANSWIPE) || (wipeType == TRANSPORTER)) +void DisplayMan::doTransition(TransitionType transitionType, CloseDataPtr *cPtr, char *filename) { + switch (transitionType) { + case kTransitionWipe: + case kTransitionTransporter: doTransWipe(cPtr, filename); - else if (wipeType == SCROLLWIPE) + break; + case kTransitionScrollWipe: doScrollWipe(filename); - else if (wipeType == SCROLLBLACK) + break; + case kTransitionScrollBlack: doScrollBlack(); - else if (wipeType == SCROLLBOUNCE) + break; + case kTransitionScrollBounce: doScrollBounce(); - else if (wipeType == READFIRSTFRAME) + break; + case kTransitionReadFirstFrame: readPict(filename, false); - else if (wipeType == READNEXTFRAME) + break; + case kTransitionReadNextFrame: _vm->_anim->diffNextFrame(); + break; + case kTransitionNone: + default: + break; + } } /*****************************************************************************/ diff --git a/engines/lab/graphics.h b/engines/lab/graphics.h index 8e67cd2366..9011b22c83 100644 --- a/engines/lab/graphics.h +++ b/engines/lab/graphics.h @@ -46,6 +46,17 @@ struct TextFont { byte *_data; }; +enum TransitionType { + kTransitionNone, + kTransitionWipe, + kTransitionScrollWipe, + kTransitionScrollBlack, + kTransitionScrollBounce, + kTransitionTransporter, + kTransitionReadFirstFrame, + kTransitionReadNextFrame +}; + class DisplayMan { private: LabEngine *_vm; @@ -76,7 +87,7 @@ public: void doScrollWipe(char *filename); void doScrollBounce(); void doTransWipe(CloseDataPtr *cPtr, char *filename); - void doWipe(uint16 wipeType, CloseDataPtr *cPtr, char *filename); + void doTransition(TransitionType transitionType, CloseDataPtr *cPtr, char *filename); void blackScreen(); void whiteScreen(); void blackAllScreen(); diff --git a/engines/lab/parsetypes.h b/engines/lab/parsetypes.h index b345e1e056..42c7269d7c 100644 --- a/engines/lab/parsetypes.h +++ b/engines/lab/parsetypes.h @@ -45,7 +45,7 @@ namespace Lab { #define LOADDIFF 5 #define LOADBM 6 #define SHOWBM 7 -#define WIPECMD 8 +#define TRANSITION 8 #define NOUPDATE 9 #define FORCEUPDATE 10 #define SHOWCURPICT 11 @@ -139,7 +139,7 @@ struct RoomData { uint16 _southDoor; uint16 _eastDoor; uint16 _westDoor; - byte _wipeType; + byte _transitionType; ViewData *_view[4]; RuleList *_rules; char *_roomMsg; diff --git a/engines/lab/processroom.cpp b/engines/lab/processroom.cpp index 015b854b75..d467c21cb5 100644 --- a/engines/lab/processroom.cpp +++ b/engines/lab/processroom.cpp @@ -332,8 +332,8 @@ void LabEngine::doActions(Action *aptr, CloseDataPtr *lcptr) { break; - case WIPECMD: - _graphics->doWipe(aptr->_param1, lcptr, (char *)aptr->_data); + case TRANSITION: + _graphics->doTransition((TransitionType)aptr->_param1, lcptr, (char *)aptr->_data); break; case NOUPDATE: diff --git a/engines/lab/resource.cpp b/engines/lab/resource.cpp index f76aea0087..f99ab82a53 100644 --- a/engines/lab/resource.cpp +++ b/engines/lab/resource.cpp @@ -98,7 +98,7 @@ bool Resource::readRoomData(const char *fileName) { _vm->_rooms[i]._southDoor = dataFile->readUint16LE(); _vm->_rooms[i]._eastDoor = dataFile->readUint16LE(); _vm->_rooms[i]._westDoor = dataFile->readUint16LE(); - _vm->_rooms[i]._wipeType = dataFile->readByte(); + _vm->_rooms[i]._transitionType = dataFile->readByte(); _vm->_rooms[i]._view[NORTH] = nullptr; _vm->_rooms[i]._view[SOUTH] = nullptr; -- cgit v1.2.3 From 9cc30c3c6d6edb616bb76d15b46391bacf3e2052 Mon Sep 17 00:00:00 2001 From: Filippos Karapetis Date: Mon, 7 Dec 2015 10:08:01 +0200 Subject: LAB: Clean up processArrow() --- engines/lab/engine.cpp | 5 ++--- engines/lab/parsefun.h | 2 +- engines/lab/processroom.cpp | 53 +++++++++++++++++++++++---------------------- 3 files changed, 30 insertions(+), 30 deletions(-) diff --git a/engines/lab/engine.cpp b/engines/lab/engine.cpp index ce89225560..726a10365f 100644 --- a/engines/lab/engine.cpp +++ b/engines/lab/engine.cpp @@ -720,8 +720,7 @@ bool LabEngine::from_crumbs(uint32 tmpClass, uint16 code, uint16 Qualifier, Comm oldDirection = _direction; - NewDir = _direction; - processArrow(&NewDir, gadgetId - 6); + NewDir = processArrow(_direction, gadgetId - 6); doTurn(_direction, NewDir, &_cptr); _anim->_doBlack = true; _direction = NewDir; @@ -737,7 +736,7 @@ bool LabEngine::from_crumbs(uint32 tmpClass, uint16 code, uint16 Qualifier, Comm _anim->_doBlack = true; } else { _anim->_doBlack = true; - processArrow(&_direction, gadgetId - 6); + _direction = processArrow(_direction, gadgetId - 6); if (oldRoomNum != _roomNum) { drawStaticMessage(kTextGoForward); diff --git a/engines/lab/parsefun.h b/engines/lab/parsefun.h index 7f8895176b..c45727d907 100644 --- a/engines/lab/parsefun.h +++ b/engines/lab/parsefun.h @@ -45,7 +45,7 @@ bool parse(const char *inputFile); ViewData *getViewData(uint16 roomNum, uint16 direction); char *getPictName(CloseDataPtr *lcptr); void drawDirection(CloseDataPtr lcptr); -bool processArrow(uint16 *direction, uint16 arrow); +uint16 processArrow(uint16 curDirection, uint16 arrow); void setCurClose(Common::Point pos, CloseDataPtr *cptr, bool useAbsoluteCoords = false); bool takeItem(uint16 x, uint16 y, CloseDataPtr *cptr); bool doActionRule(Common::Point pos, int16 action, int16 roomNum, CloseDataPtr *lcptr); diff --git a/engines/lab/processroom.cpp b/engines/lab/processroom.cpp index d467c21cb5..1487888b27 100644 --- a/engines/lab/processroom.cpp +++ b/engines/lab/processroom.cpp @@ -188,44 +188,45 @@ void LabEngine::drawDirection(CloseDataPtr lcptr) { /*****************************************************************************/ /* process a arrow gadget movement. */ /*****************************************************************************/ -bool processArrow(uint16 *direction, uint16 arrow) { - if (arrow == 1) { /* Forward */ +uint16 processArrow(uint16 curDirection, uint16 arrow) { + if (arrow == 1) { // Forward uint16 room = 1; - if (*direction == NORTH) + if (curDirection == NORTH) room = g_lab->_rooms[g_lab->_roomNum]._northDoor; - else if (*direction == SOUTH) + else if (curDirection == SOUTH) room = g_lab->_rooms[g_lab->_roomNum]._southDoor; - else if (*direction == EAST) + else if (curDirection == EAST) room = g_lab->_rooms[g_lab->_roomNum]._eastDoor; - else if (*direction == WEST) + else if (curDirection == WEST) room = g_lab->_rooms[g_lab->_roomNum]._westDoor; - if (room == 0) - return false; - else + if (room != 0) g_lab->_roomNum = room; - } else if (arrow == 0) { /* Left */ - if (*direction == NORTH) - *direction = WEST; - else if (*direction == WEST) - *direction = SOUTH; - else if (*direction == SOUTH) - *direction = EAST; + + return curDirection; + } else if (arrow == 0) { // Left + if (curDirection == NORTH) + return WEST; + else if (curDirection == WEST) + return SOUTH; + else if (curDirection == SOUTH) + return EAST; else - *direction = NORTH; - } else if (arrow == 2) { /* Right */ - if (*direction == NORTH) - *direction = EAST; - else if (*direction == EAST) - *direction = SOUTH; - else if (*direction == SOUTH) - *direction = WEST; + return NORTH; + } else if (arrow == 2) { // Right + if (curDirection == NORTH) + return EAST; + else if (curDirection == EAST) + return SOUTH; + else if (curDirection == SOUTH) + return WEST; else - *direction = NORTH; + return NORTH; } - return true; + // Should never reach here! + return curDirection; } /*****************************************************************************/ -- cgit v1.2.3 From 75c9d0b585b8468489e350f885b89af37b79b543 Mon Sep 17 00:00:00 2001 From: Filippos Karapetis Date: Mon, 7 Dec 2015 10:15:19 +0200 Subject: LAB: Fix spelling --- engines/lab/intro.cpp | 4 ++-- engines/lab/processroom.cpp | 8 ++++---- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/engines/lab/intro.cpp b/engines/lab/intro.cpp index 4b0ed66f56..da44916a92 100644 --- a/engines/lab/intro.cpp +++ b/engines/lab/intro.cpp @@ -38,8 +38,8 @@ Intro::Intro(LabEngine *vm) : _vm(vm) { } /******************************************************************************/ -/* Goes thru, and responds to all the intuition messages currently in the */ -/* the message port. */ +/* Goes through, and responds to all the intuition messages currently in the */ +/* message queue. */ /******************************************************************************/ void Intro::introEatMessages() { while (1) { diff --git a/engines/lab/processroom.cpp b/engines/lab/processroom.cpp index 1487888b27..0b43966d98 100644 --- a/engines/lab/processroom.cpp +++ b/engines/lab/processroom.cpp @@ -651,7 +651,7 @@ static bool doOperateRuleSub(int16 itemNum, int16 roomNum, CloseDataPtr lcptr, C } /*****************************************************************************/ -/* Goes thru the rules if the user tries to operate an item on an object. */ +/* Goes through the rules if the user tries to operate an item on an object. */ /*****************************************************************************/ bool doOperateRule(int16 x, int16 y, int16 ItemNum, CloseDataPtr *lcptr) { CloseDataPtr tlcptr; @@ -685,7 +685,7 @@ bool doOperateRule(int16 x, int16 y, int16 ItemNum, CloseDataPtr *lcptr) { } /*****************************************************************************/ -/* Goes thru the rules if the user tries to go forward. */ +/* Goes through the rules if the user tries to go forward. */ /*****************************************************************************/ bool doGoForward(CloseDataPtr *lcptr) { RuleList *rules = g_lab->_rooms[g_lab->_roomNum]._rules; @@ -703,7 +703,7 @@ bool doGoForward(CloseDataPtr *lcptr) { } /*****************************************************************************/ -/* Goes thru the rules if the user tries to turn. */ +/* Goes through the rules if the user tries to turn. */ /*****************************************************************************/ bool doTurn(uint16 from, uint16 to, CloseDataPtr *lcptr) { from++; @@ -726,7 +726,7 @@ bool doTurn(uint16 from, uint16 to, CloseDataPtr *lcptr) { } /*****************************************************************************/ -/* Goes thru the rules if the user tries to go to the main view */ +/* Goes through the rules if the user tries to go to the main view */ /*****************************************************************************/ bool doMainView(CloseDataPtr *lcptr) { RuleList *rules = g_lab->_rooms[g_lab->_roomNum]._rules; -- cgit v1.2.3 From 1e11090edc2c6e253fcae3a5f2c3c52e62f9a0a0 Mon Sep 17 00:00:00 2001 From: Filippos Karapetis Date: Mon, 7 Dec 2015 10:15:36 +0200 Subject: LAB: Remove useless return --- engines/lab/engine.cpp | 2 -- 1 file changed, 2 deletions(-) diff --git a/engines/lab/engine.cpp b/engines/lab/engine.cpp index 726a10365f..53e61c4aa6 100644 --- a/engines/lab/engine.cpp +++ b/engines/lab/engine.cpp @@ -156,8 +156,6 @@ void LabEngine::eatMessages() { do { msg = getMsg(); } while (msg); - - return; } /******************************************************************************/ -- cgit v1.2.3 From 4f1a8f9fa4bdd1ae11460ac89463772c4814a1e1 Mon Sep 17 00:00:00 2001 From: Filippos Karapetis Date: Mon, 7 Dec 2015 10:24:07 +0200 Subject: LAB: Merge the uniffMemory() code into unDiff() --- engines/lab/anim.cpp | 55 +++++++++++++--------------------------------------- engines/lab/anim.h | 6 ------ 2 files changed, 13 insertions(+), 48 deletions(-) diff --git a/engines/lab/anim.cpp b/engines/lab/anim.cpp index ee636604e8..bb5c5e9e88 100644 --- a/engines/lab/anim.cpp +++ b/engines/lab/anim.cpp @@ -162,25 +162,6 @@ void Anim::unDiffByteWord(uint16 *dest, uint16 *diff) { } } -/*****************************************************************************/ -/* UnDiffs a coded DIFF string onto an already initialized piece of memory. */ -/*****************************************************************************/ -bool Anim::unDiffMemory(byte *dest, byte *diff, uint16 headerSize, uint16 copySize) { - if (headerSize == 1) { - if (copySize == 1) - unDiffByteByte(dest, diff); - - else if (copySize == 2) - unDiffByteWord((uint16 *)dest, (uint16 *)diff); - - else - return false; - } else - error("unDIFFMemory: HeaderSize is %d", headerSize); - - return true; -} - /*------------------------- unDiff Vertical Memory --------------------------*/ /*****************************************************************************/ @@ -304,25 +285,6 @@ void Anim::VUnDiffByteLong(uint32 *dest, uint32 *diff, uint16 bytesPerRow) { } } -/*****************************************************************************/ -/* UnDiffs a coded DIFF string onto an already initialized piece of memory. */ -/*****************************************************************************/ -bool Anim::VUnDiffMemory(byte *dest, byte *diff, uint16 headerSize, uint16 copySize, uint16 bytesPerRow) { - if (headerSize == 1) { - if (copySize == 1) - VUnDiffByteByte(dest, diff, bytesPerRow); - else if (copySize == 2) - VUnDiffByteWord((uint16 *)dest, (uint16 *)diff, bytesPerRow); - else if (copySize == 4) - VUnDiffByteLong((uint32 *)dest, (uint32 *)diff, bytesPerRow); - else - return false; - } else - return (false); - - return true; -} - /*****************************************************************************/ /* Runlength decodes a chunk of memory. */ /*****************************************************************************/ @@ -403,10 +365,19 @@ void Anim::unDiff(byte *newBuf, byte *oldBuf, byte *diffData, uint16 bytesPerRow byte bufType = *diffData; diffData++; - if (isV) - VUnDiffMemory(newBuf, diffData, 1, bufType + 1, bytesPerRow); - else - unDiffMemory(newBuf, diffData, 1, bufType + 1); + if (isV) { + if (bufType == 0) + VUnDiffByteByte(newBuf, diffData, bytesPerRow); + else if (bufType == 1) + VUnDiffByteWord((uint16 *)newBuf, (uint16 *)diffData, bytesPerRow); + else if (bufType == 3) + VUnDiffByteLong((uint32 *)newBuf, (uint32 *)diffData, bytesPerRow); + } else { + if (bufType == 0) + unDiffByteByte(newBuf, diffData); + else if (bufType == 1) + unDiffByteWord((uint16 *)newBuf, (uint16 *)diffData); + } } void Anim::readBlock(void *Buffer, uint32 Size, byte **File) { diff --git a/engines/lab/anim.h b/engines/lab/anim.h index 54efa4fcfa..98413472ea 100644 --- a/engines/lab/anim.h +++ b/engines/lab/anim.h @@ -87,16 +87,10 @@ private: BitMap bit2; BitMap *DrawBitMap; - bool unDiffMemory(byte *dest, /* Where to Un-DIFF */ - byte *diff, /* The DIFFed code. */ - uint16 headerSize, /* Size of header (1, 2 or 4 bytes) (only supports 1 currently */ - uint16 copySize); /* Size of minimum copy or skip. (1, 2 or 4 bytes) */ - void runLengthDecode(byte *dest, byte *source); void VRunLengthDecode(byte *dest, byte *source, uint16 bytesPerRow); void unDiffByteByte(byte *dest, byte *diff); void unDiffByteWord(uint16 *dest, uint16 *diff); - bool VUnDiffMemory(byte *dest, byte *diff, uint16 headerSize, uint16 copySize, uint16 bytesPerRow); void VUnDiffByteByte(byte *Dest, byte *diff, uint16 bytesperrow); void VUnDiffByteWord(uint16 *Dest, uint16 *diff, uint16 bytesperrow); void VUnDiffByteLong(uint32 *Dest, uint32 *diff, uint16 bytesperrow); -- cgit v1.2.3 From 5ccc0fd7c6469e1b1bac6b32a4624a88e0c78278 Mon Sep 17 00:00:00 2001 From: Filippos Karapetis Date: Mon, 7 Dec 2015 10:31:46 +0200 Subject: LAB: Clean up checkGadgetHit() a bit --- engines/lab/eventman.cpp | 10 ++++------ 1 file changed, 4 insertions(+), 6 deletions(-) diff --git a/engines/lab/eventman.cpp b/engines/lab/eventman.cpp index b1b1a68e70..1c204b75eb 100644 --- a/engines/lab/eventman.cpp +++ b/engines/lab/eventman.cpp @@ -60,10 +60,10 @@ static byte MouseData[] = {1, 1, 0, 0, 0, 0, 0, 0, 0, 0, Gadget *EventManager::checkGadgetHit(GadgetList *gadgetList, Common::Point pos) { for (GadgetList::iterator gadgetItr = gadgetList->begin(); gadgetItr != gadgetList->end(); ++gadgetItr) { Gadget *gadget = *gadgetItr; - if ((pos.x >= gadget->x) && (pos.y >= gadget->y) && - (pos.x <= (gadget->x + gadget->_image->_width)) && - (pos.y <= (gadget->y + gadget->_image->_height)) && - !(GADGETOFF & gadget->_flags)) { + Common::Rect gadgetRect(gadget->x, gadget->y, gadget->x + gadget->_image->_width - 1, gadget->y + gadget->_image->_height - 1); + bool gadgetIsEnabled = !(gadget->_flags & GADGETOFF); + + if (gadgetRect.contains(pos) && gadgetIsEnabled) { if (_vm->_isHiRes) { _hitGadget = gadget; } else { @@ -86,8 +86,6 @@ Gadget *EventManager::checkGadgetHit(GadgetList *gadgetList, Common::Point pos) return NULL; } - - void EventManager::attachGadgetList(GadgetList *gadgetList) { if (_screenGadgetList != gadgetList) _lastGadgetHit = nullptr; -- cgit v1.2.3 From 6bba608fc06658cec8f0bc09874739ae8b4bc9e4 Mon Sep 17 00:00:00 2001 From: Filippos Karapetis Date: Mon, 7 Dec 2015 10:40:40 +0200 Subject: LAB: Get rid of _numHidden --- engines/lab/eventman.cpp | 13 ++----------- engines/lab/eventman.h | 1 - 2 files changed, 2 insertions(+), 12 deletions(-) diff --git a/engines/lab/eventman.cpp b/engines/lab/eventman.cpp index 1c204b75eb..4c50cb78c3 100644 --- a/engines/lab/eventman.cpp +++ b/engines/lab/eventman.cpp @@ -98,7 +98,6 @@ EventManager::EventManager(LabEngine *vm) : _vm(vm) { _rightClick = false; _mouseHidden = true; - _numHidden = 1; _lastGadgetHit = nullptr; _screenGadgetList = nullptr; _hitGadget = nullptr; @@ -113,9 +112,6 @@ EventManager::EventManager(LabEngine *vm) : _vm(vm) { } void EventManager::mouseHandler(int flag, Common::Point pos) { - if (_numHidden >= 2) - return; - if (flag & 0x02) { /* Left mouse button click */ Gadget *tmp = NULL; if (_screenGadgetList) @@ -172,10 +168,7 @@ void EventManager::initMouse() { /* Shows the mouse. */ /*****************************************************************************/ void EventManager::mouseShow() { - if (_numHidden) - _numHidden--; - - if ((_numHidden == 0) && _mouseHidden) { + if (_mouseHidden) { processInput(); _mouseHidden = false; } @@ -187,9 +180,7 @@ void EventManager::mouseShow() { /* Hides the mouse. */ /*****************************************************************************/ void EventManager::mouseHide() { - _numHidden++; - - if (_numHidden && !_mouseHidden) { + if (!_mouseHidden) { _mouseHidden = true; g_system->showMouse(false); diff --git a/engines/lab/eventman.h b/engines/lab/eventman.h index a156a8a823..11d8dfd7e1 100644 --- a/engines/lab/eventman.h +++ b/engines/lab/eventman.h @@ -44,7 +44,6 @@ private: bool _rightClick; bool _mouseHidden; - int32 _numHidden; Gadget *_lastGadgetHit; uint16 _nextKeyIn; uint16 _nextKeyOut; -- cgit v1.2.3 From 156ad539ffe30c9a09952f7b97e285a5a5096b0d Mon Sep 17 00:00:00 2001 From: Filippos Karapetis Date: Mon, 7 Dec 2015 10:44:54 +0200 Subject: LAB: Move readSound() into the Music class --- engines/lab/anim.cpp | 44 -------------------------------------------- engines/lab/anim.h | 1 - engines/lab/music.cpp | 49 ++++++++++++++++++++++++++++++++++++++++++++++++- engines/lab/music.h | 4 +++- 4 files changed, 51 insertions(+), 47 deletions(-) diff --git a/engines/lab/anim.cpp b/engines/lab/anim.cpp index bb5c5e9e88..c5493e03e6 100644 --- a/engines/lab/anim.cpp +++ b/engines/lab/anim.cpp @@ -668,48 +668,4 @@ bool Anim::readDiff(byte *buffer, bool playOnce) { return true; } -void Anim::readSound(bool waitTillFinished, Common::File *file) { - uint32 magicBytes = file->readUint32LE(); - if (magicBytes != 1219009121L) - return; - - uint32 soundTag = file->readUint32LE(); - uint32 soundSize = file->readUint32LE(); - - if (soundTag == 0) - file->skip(soundSize); // skip the header - else - return; - - while (soundTag != 65535) { - _vm->_music->updateMusic(); - soundTag = file->readUint32LE(); - soundSize = file->readUint32LE() - 8; - - if ((soundTag == 30) || (soundTag == 31)) { - if (waitTillFinished) { - while (_vm->_music->isSoundEffectActive()) { - _vm->_music->updateMusic(); - _vm->waitTOF(); - } - } - - file->skip(4); - - uint16 sampleRate = file->readUint16LE(); - file->skip(2); - byte *soundData = (byte *)malloc(soundSize); - file->read(soundData, soundSize); - _vm->_music->playSoundEffect(sampleRate, soundSize, soundData); - } else if (soundTag == 65535L) { - if (waitTillFinished) { - while (_vm->_music->isSoundEffectActive()) { - _vm->_music->updateMusic(); - _vm->waitTOF(); - } - } - } else - file->skip(soundSize); - } -} } // End of namespace Lab diff --git a/engines/lab/anim.h b/engines/lab/anim.h index 98413472ea..a0438d862d 100644 --- a/engines/lab/anim.h +++ b/engines/lab/anim.h @@ -111,7 +111,6 @@ public: void unDiff(byte *newBuf, byte *oldBuf, byte *diffData, uint16 bytesperrow, bool isV); bool readDiff(byte *buffer, bool playOnce); void diffNextFrame(); - void readSound(bool waitTillFinished, Common::File *file); void stopDiff(); void stopDiffEnd(); }; diff --git a/engines/lab/music.cpp b/engines/lab/music.cpp index ddc6cbdaa6..1260fd81fe 100644 --- a/engines/lab/music.cpp +++ b/engines/lab/music.cpp @@ -321,9 +321,56 @@ bool Music::readMusic(const char *filename, bool waitTillFinished) { return false; _vm->_anim->_doBlack = false; - _vm->_anim->readSound(waitTillFinished, file); + readSound(waitTillFinished, file); return true; } +void Music::readSound(bool waitTillFinished, Common::File *file) { + uint32 magicBytes = file->readUint32LE(); + if (magicBytes != 1219009121L) + return; + + uint32 soundTag = file->readUint32LE(); + uint32 soundSize = file->readUint32LE(); + + if (soundTag == 0) + file->skip(soundSize); // skip the header + else + return; + + while (soundTag != 65535) { + updateMusic(); + soundTag = file->readUint32LE(); + soundSize = file->readUint32LE() - 8; + + if ((soundTag == 30) || (soundTag == 31)) { + if (waitTillFinished) { + while (isSoundEffectActive()) { + updateMusic(); + _vm->waitTOF(); + } + } + + file->skip(4); + + uint16 sampleRate = file->readUint16LE(); + file->skip(2); + byte *soundData = (byte *)malloc(soundSize); + file->read(soundData, soundSize); + playSoundEffect(sampleRate, soundSize, soundData); + } + else if (soundTag == 65535L) { + if (waitTillFinished) { + while (isSoundEffectActive()) { + updateMusic(); + _vm->waitTOF(); + } + } + } + else + file->skip(soundSize); + } +} + } // End of namespace Lab diff --git a/engines/lab/music.h b/engines/lab/music.h index 7905da74a5..942f7372ce 100644 --- a/engines/lab/music.h +++ b/engines/lab/music.h @@ -77,9 +77,11 @@ public: bool _doReset; private: - LabEngine *_vm; void fillbuffer(byte *musicBuffer); void startMusic(bool restartFl); + void readSound(bool waitTillFinished, Common::File *file); + + LabEngine *_vm; Common::File *_file; Common::File *_tFile; -- cgit v1.2.3 From 0e886461d0c60f1d3f1f790da8755e35ed2883d3 Mon Sep 17 00:00:00 2001 From: Filippos Karapetis Date: Mon, 7 Dec 2015 11:00:54 +0200 Subject: LAB: Replace some uses of malloc() with new --- engines/lab/engine.cpp | 8 ++++---- engines/lab/interface.cpp | 2 +- engines/lab/lab.cpp | 2 +- engines/lab/labsets.cpp | 5 +++-- engines/lab/music.cpp | 2 ++ engines/lab/resource.cpp | 15 +++++++-------- 6 files changed, 18 insertions(+), 16 deletions(-) diff --git a/engines/lab/engine.cpp b/engines/lab/engine.cpp index 53e61c4aa6..ee61e2ff26 100644 --- a/engines/lab/engine.cpp +++ b/engines/lab/engine.cpp @@ -526,20 +526,20 @@ void LabEngine::mainGameLoop() { delete _roomsFound; if (_rooms) { - free(_rooms); + delete[] _rooms; _rooms = nullptr; } if (_inventory) { for (int i = 1; i <= _numInv; i++) { if (_inventory[i]._name) - free(_inventory[i]._name); + delete _inventory[i]._name; if (_inventory[i]._bitmapName) - free(_inventory[i]._bitmapName); + delete _inventory[i]._bitmapName; } - free(_inventory); + delete[] _inventory; } } diff --git a/engines/lab/interface.cpp b/engines/lab/interface.cpp index a044fda849..9ab570ad02 100644 --- a/engines/lab/interface.cpp +++ b/engines/lab/interface.cpp @@ -63,7 +63,7 @@ Gadget *createButton(uint16 x, uint16 y, uint16 id, uint16 key, Image *im, Image void freeButtonList(GadgetList *gadgetList) { for (GadgetList::iterator gadget = gadgetList->begin(); gadget != gadgetList->end(); ++gadget) { - free(*gadget); + delete *gadget; } gadgetList->clear(); diff --git a/engines/lab/lab.cpp b/engines/lab/lab.cpp index 02abf800f5..3def00339c 100644 --- a/engines/lab/lab.cpp +++ b/engines/lab/lab.cpp @@ -129,7 +129,7 @@ LabEngine::~LabEngine() { delete _music; delete _anim; delete _graphics; - free(_rooms); + delete[] _rooms; for (int i = 0; i < 16; i++) delete _tiles[i]; diff --git a/engines/lab/labsets.cpp b/engines/lab/labsets.cpp index 259858763e..f09f669b7f 100644 --- a/engines/lab/labsets.cpp +++ b/engines/lab/labsets.cpp @@ -37,12 +37,13 @@ namespace Lab { LargeSet::LargeSet(uint16 last, LabEngine *vm) : _vm(vm) { last = (((last + 15) >> 4) << 4); - _array = (uint16 *)calloc(last >> 3, 2); + _array = new uint16[last >> 3]; + memset(_array, 0, last >> 3); _lastElement = last; } LargeSet::~LargeSet() { - free(_array); + delete[] _array; } bool LargeSet::in(uint16 element) { diff --git a/engines/lab/music.cpp b/engines/lab/music.cpp index 1260fd81fe..8fd88ff3e6 100644 --- a/engines/lab/music.cpp +++ b/engines/lab/music.cpp @@ -356,6 +356,8 @@ void Music::readSound(bool waitTillFinished, Common::File *file) { uint16 sampleRate = file->readUint16LE(); file->skip(2); + // NOTE: We need to use malloc(), cause this will be freed with free() + // by the music code byte *soundData = (byte *)malloc(soundSize); file->read(soundData, soundSize); playSoundEffect(sampleRate, soundSize, soundData); diff --git a/engines/lab/resource.cpp b/engines/lab/resource.cpp index f99ab82a53..de1e9dc714 100644 --- a/engines/lab/resource.cpp +++ b/engines/lab/resource.cpp @@ -90,7 +90,7 @@ bool Resource::readRoomData(const char *fileName) { _vm->_manyRooms = dataFile->readUint16LE(); _vm->_highestCondition = dataFile->readUint16LE(); - _vm->_rooms = (RoomData *)malloc((_vm->_manyRooms + 1) * sizeof(RoomData)); + _vm->_rooms = new RoomData[_vm->_manyRooms + 1]; memset(_vm->_rooms, 0, (_vm->_manyRooms + 1) * sizeof(RoomData)); for (uint16 i = 1; i <= _vm->_manyRooms; i++) { @@ -116,7 +116,7 @@ InventoryData *Resource::readInventory(const char *fileName) { Common::File *dataFile = openDataFile(fileName, MKTAG('I', 'N', 'V', '1')); _vm->_numInv = dataFile->readUint16LE(); - InventoryData *inventory = (InventoryData *)malloc((_vm->_numInv + 1) * sizeof(InventoryData)); + InventoryData *inventory = new InventoryData[_vm->_numInv + 1]; for (uint16 i = 1; i <= _vm->_numInv; i++) { inventory[i]._many = dataFile->readUint16LE(); @@ -195,7 +195,7 @@ char *Resource::readString(Common::File *file) { byte size = file->readByte(); if (!size) return NULL; - char *str = (char *)malloc(size); + char *str = new char[size]; char *c = str; for (int i = 0; i < size; i++) { *c = file->readByte(); @@ -209,8 +209,7 @@ char *Resource::readString(Common::File *file) { int16 *Resource::readConditions(Common::File *file) { int16 i = 0, cond; - //int16 *list = new int16[25]; - int16 *list = (int16 *)malloc(25 * 2); + int16 *list = new int16[25]; memset(list, 0, 25 * 2); do { @@ -254,7 +253,7 @@ Action *Resource::readAction(Common::File *file) { c = file->readByte(); if (c == 1) { - action = (Action *)malloc(sizeof(Action)); + action = new Action(); if (!head) head = action; if (prev) @@ -293,7 +292,7 @@ CloseData *Resource::readCloseUps(uint16 depth, Common::File *file) { c = file->readByte(); if (c != '\0') { - closeup = (CloseData *)malloc(sizeof(CloseData)); + closeup = new CloseData(); if (!head) head = closeup; if (prev) @@ -325,7 +324,7 @@ ViewData *Resource::readView(Common::File *file) { c = file->readByte(); if (c == 1) { - view = (ViewData *)malloc(sizeof(ViewData)); + view = new ViewData(); if (!head) head = view; if (prev) -- cgit v1.2.3 From b6397c0af78e6cfecd1f1f7fe9c0686cd6e27daa Mon Sep 17 00:00:00 2001 From: Filippos Karapetis Date: Mon, 7 Dec 2015 11:16:49 +0200 Subject: LAB: Use the correct bitmap buffer in the Anim class --- engines/lab/anim.cpp | 2 +- engines/lab/anim.h | 1 - engines/lab/lab.cpp | 2 +- 3 files changed, 2 insertions(+), 3 deletions(-) diff --git a/engines/lab/anim.cpp b/engines/lab/anim.cpp index c5493e03e6..b28222c4b4 100644 --- a/engines/lab/anim.cpp +++ b/engines/lab/anim.cpp @@ -70,7 +70,7 @@ Anim::Anim(LabEngine *vm) : _vm(vm) { _diffWidth = 0; _diffHeight = 0; _dataBytesPerRow = 0; - DrawBitMap = &bit2; + DrawBitMap = &_vm->_graphics->bit1; for (int i = 0; i < 3 * 256; i++) _diffPalette[i] = 0; diff --git a/engines/lab/anim.h b/engines/lab/anim.h index a0438d862d..28927ba82d 100644 --- a/engines/lab/anim.h +++ b/engines/lab/anim.h @@ -84,7 +84,6 @@ private: uint32 _diffWidth; uint32 _diffHeight; uint16 _dataBytesPerRow; - BitMap bit2; BitMap *DrawBitMap; void runLengthDecode(byte *dest, byte *source); diff --git a/engines/lab/lab.cpp b/engines/lab/lab.cpp index 3def00339c..ec81fdf427 100644 --- a/engines/lab/lab.cpp +++ b/engines/lab/lab.cpp @@ -144,8 +144,8 @@ Common::Error LabEngine::run() { _event = new EventManager(this); _resource = new Resource(this); _music = new Music(this); - _anim = new Anim(this); _graphics = new DisplayMan(this); + _anim = new Anim(this); if (getPlatform() == Common::kPlatformWindows) { // Check if this is the Wyrmkeep trial -- cgit v1.2.3 From 320e658cb1e1d266cb3bf91ad9202ff83f88a9ad Mon Sep 17 00:00:00 2001 From: Filippos Karapetis Date: Mon, 7 Dec 2015 11:25:13 +0200 Subject: LAB: Get rid of the intermediate display bitmap pointer --- engines/lab/anim.cpp | 22 +++++++++++----------- engines/lab/graphics.cpp | 24 +++++++++++------------- engines/lab/graphics.h | 3 +-- 3 files changed, 23 insertions(+), 26 deletions(-) diff --git a/engines/lab/anim.cpp b/engines/lab/anim.cpp index b28222c4b4..6e12e92197 100644 --- a/engines/lab/anim.cpp +++ b/engines/lab/anim.cpp @@ -70,7 +70,7 @@ Anim::Anim(LabEngine *vm) : _vm(vm) { _diffWidth = 0; _diffHeight = 0; _dataBytesPerRow = 0; - DrawBitMap = &_vm->_graphics->bit1; + DrawBitMap = &_vm->_graphics->_dispBitMap; for (int i = 0; i < 3 * 256; i++) _diffPalette[i] = 0; @@ -389,12 +389,12 @@ void Anim::diffNextFrame() { if (_header == 65535) /* Already done. */ return; - if (_vm->_graphics->_dispBitMap->_flags & BITMAPF_VIDEO) { - _vm->_graphics->_dispBitMap->_planes[0] = _vm->_graphics->getCurrentDrawingBuffer(); - _vm->_graphics->_dispBitMap->_planes[1] = _vm->_graphics->_dispBitMap->_planes[0] + 0x10000; - _vm->_graphics->_dispBitMap->_planes[2] = _vm->_graphics->_dispBitMap->_planes[1] + 0x10000; - _vm->_graphics->_dispBitMap->_planes[3] = _vm->_graphics->_dispBitMap->_planes[2] + 0x10000; - _vm->_graphics->_dispBitMap->_planes[4] = _vm->_graphics->_dispBitMap->_planes[3] + 0x10000; + if (_vm->_graphics->_dispBitMap._flags & BITMAPF_VIDEO) { + _vm->_graphics->_dispBitMap._planes[0] = _vm->_graphics->getCurrentDrawingBuffer(); + _vm->_graphics->_dispBitMap._planes[1] = _vm->_graphics->_dispBitMap._planes[0] + 0x10000; + _vm->_graphics->_dispBitMap._planes[2] = _vm->_graphics->_dispBitMap._planes[1] + 0x10000; + _vm->_graphics->_dispBitMap._planes[3] = _vm->_graphics->_dispBitMap._planes[2] + 0x10000; + _vm->_graphics->_dispBitMap._planes[4] = _vm->_graphics->_dispBitMap._planes[3] + 0x10000; } _vm->_event->mouseHide(); @@ -432,7 +432,7 @@ void Anim::diffNextFrame() { _isAnim = (_frameNum >= 3) && (!_playOnce); _curBit = 0; - if (_vm->_graphics->_dispBitMap->_flags & BITMAPF_VIDEO) + if (_vm->_graphics->_dispBitMap._flags & BITMAPF_VIDEO) _vm->_graphics->screenUpdate(); return; /* done with the next frame. */ @@ -478,13 +478,13 @@ void Anim::diffNextFrame() { break; case 20L: - unDiff(DrawBitMap->_planes[_curBit], _vm->_graphics->_dispBitMap->_planes[_curBit], _diffFile, DrawBitMap->_bytesPerRow, false); + unDiff(DrawBitMap->_planes[_curBit], _vm->_graphics->_dispBitMap._planes[_curBit], _diffFile, DrawBitMap->_bytesPerRow, false); _curBit++; _diffFile += _size; break; case 21L: - unDiff(DrawBitMap->_planes[_curBit], _vm->_graphics->_dispBitMap->_planes[_curBit], _diffFile, DrawBitMap->_bytesPerRow, true); + unDiff(DrawBitMap->_planes[_curBit], _vm->_graphics->_dispBitMap._planes[_curBit], _diffFile, DrawBitMap->_bytesPerRow, true); _curBit++; _diffFile += _size; break; @@ -525,7 +525,7 @@ void Anim::diffNextFrame() { _vm->_music->updateMusic(); _vm->waitTOF(); - if (_vm->_graphics->_dispBitMap->_flags & BITMAPF_VIDEO) + if (_vm->_graphics->_dispBitMap._flags & BITMAPF_VIDEO) didTOF = true; } } diff --git a/engines/lab/graphics.cpp b/engines/lab/graphics.cpp index 95551040c2..9dd23073b9 100644 --- a/engines/lab/graphics.cpp +++ b/engines/lab/graphics.cpp @@ -55,8 +55,6 @@ DisplayMan::DisplayMan(LabEngine *vm) : _vm(vm) { _screenWidth = 0; _screenHeight = 0; - _dispBitMap = &bit1; - for (int i = 0; i < 256 * 3; i++) _curvgapal[i] = 0; } @@ -139,9 +137,9 @@ void DisplayMan::readPict(const char *filename, bool playOnce) { if (!_vm->_music->_doNotFilestopSoundEffect) _vm->_music->stopSoundEffect(); - _dispBitMap->_bytesPerRow = _screenWidth; - _dispBitMap->_rows = _screenHeight; - _dispBitMap->_flags = BITMAPF_VIDEO; + _dispBitMap._bytesPerRow = _screenWidth; + _dispBitMap._rows = _screenHeight; + _dispBitMap._flags = BITMAPF_VIDEO; _vm->_anim->readDiff(_curBitmap, playOnce); } @@ -159,14 +157,14 @@ byte *DisplayMan::readPictToMem(const char *filename, uint16 x, uint16 y) { if (!_vm->_music->_doNotFilestopSoundEffect) _vm->_music->stopSoundEffect(); - _dispBitMap->_bytesPerRow = x; - _dispBitMap->_rows = y; - _dispBitMap->_flags = BITMAPF_NONE; - _dispBitMap->_planes[0] = _curBitmap; - _dispBitMap->_planes[1] = _dispBitMap->_planes[0] + 0x10000; - _dispBitMap->_planes[2] = _dispBitMap->_planes[1] + 0x10000; - _dispBitMap->_planes[3] = _dispBitMap->_planes[2] + 0x10000; - _dispBitMap->_planes[4] = _dispBitMap->_planes[3] + 0x10000; + _dispBitMap._bytesPerRow = x; + _dispBitMap._rows = y; + _dispBitMap._flags = BITMAPF_NONE; + _dispBitMap._planes[0] = _curBitmap; + _dispBitMap._planes[1] = _dispBitMap._planes[0] + 0x10000; + _dispBitMap._planes[2] = _dispBitMap._planes[1] + 0x10000; + _dispBitMap._planes[3] = _dispBitMap._planes[2] + 0x10000; + _dispBitMap._planes[4] = _dispBitMap._planes[3] + 0x10000; _vm->_anim->readDiff(_curBitmap, true); diff --git a/engines/lab/graphics.h b/engines/lab/graphics.h index 9011b22c83..9975cf39c1 100644 --- a/engines/lab/graphics.h +++ b/engines/lab/graphics.h @@ -164,8 +164,7 @@ public: byte *_currentDisplayBuffer; bool _doNotDrawMessage; uint16 *FadePalette; - BitMap bit1; - BitMap *_dispBitMap; + BitMap _dispBitMap; }; } // End of namespace Lab -- cgit v1.2.3 From 5bc48cbbddc47ba3d1893776178c19bd33dbee4c Mon Sep 17 00:00:00 2001 From: Strangerke Date: Mon, 7 Dec 2015 17:46:37 +0100 Subject: LAB: Move utility functions to a separate class --- engines/lab/anim.cpp | 315 +-------------------------------- engines/lab/anim.h | 9 - engines/lab/engine.cpp | 14 +- engines/lab/graphics.cpp | 165 +++++++----------- engines/lab/graphics.h | 5 - engines/lab/interface.cpp | 2 +- engines/lab/lab.cpp | 3 + engines/lab/lab.h | 4 +- engines/lab/map.cpp | 4 +- engines/lab/module.mk | 3 +- engines/lab/processroom.cpp | 18 +- engines/lab/special.cpp | 46 ++--- engines/lab/tilepuzzle.cpp | 78 ++++----- engines/lab/utils.cpp | 413 ++++++++++++++++++++++++++++++++++++++++++++ engines/lab/utils.h | 66 +++++++ 15 files changed, 621 insertions(+), 524 deletions(-) create mode 100644 engines/lab/utils.cpp create mode 100644 engines/lab/utils.h diff --git a/engines/lab/anim.cpp b/engines/lab/anim.cpp index 6e12e92197..777a09ef3f 100644 --- a/engines/lab/anim.cpp +++ b/engines/lab/anim.cpp @@ -69,317 +69,12 @@ Anim::Anim(LabEngine *vm) : _vm(vm) { _doBlack = false; _diffWidth = 0; _diffHeight = 0; - _dataBytesPerRow = 0; DrawBitMap = &_vm->_graphics->_dispBitMap; for (int i = 0; i < 3 * 256; i++) _diffPalette[i] = 0; } -/*------------------------ unDiff Horizontal Memory -------------------------*/ - -/*****************************************************************************/ -/* Undiffs a piece of memory when header size is a byte, and copy/skip size */ -/* is also a byte. */ -/*****************************************************************************/ -void Anim::unDiffByteByte(byte *dest, byte *diff) { - uint16 skip, copy; - - while (1) { - skip = *diff; - diff++; - copy = *diff; - diff++; - - if (skip == 255) { - if (copy == 0) { - skip = READ_LE_UINT16(diff); - diff += 2; - copy = READ_LE_UINT16(diff); - diff += 2; - } else if (copy == 255) - return; - } - - dest += skip; - memcpy(dest, diff, copy); - dest += copy; - diff += copy; - } -} - -/*****************************************************************************/ -/* Undiffs a piece of memory when header size is a byte, and copy/skip size */ -/* is a word. */ -/*****************************************************************************/ -void Anim::unDiffByteWord(uint16 *dest, uint16 *diff) { - uint16 skip, copy; - - while (1) { - skip = ((byte *)diff)[0]; - copy = ((byte *)diff)[1]; - - diff++; - - if (skip == 255) { - if (copy == 0) { - skip = READ_LE_UINT16(diff); - diff++; - copy = READ_LE_UINT16(diff); - diff++; - } else if (copy == 255) - return; - } - - dest += skip; - - while (copy > 3) { - *dest = READ_LE_UINT16(diff); - dest++; - diff++; - - *dest = READ_LE_UINT16(diff); - dest++; - diff++; - - *dest = READ_LE_UINT16(diff); - dest++; - diff++; - - *dest = READ_LE_UINT16(diff); - dest++; - diff++; - - copy -= 4; - } - - while (copy) { - *dest = READ_LE_UINT16(diff); - dest++; - diff++; - copy--; - } - } -} - -/*------------------------- unDiff Vertical Memory --------------------------*/ - -/*****************************************************************************/ -/* Undiffs a piece of memory when header size is a byte, and copy/skip size */ -/* is a byte. */ -/*****************************************************************************/ -void Anim::VUnDiffByteByte(byte *dest, byte *diff, uint16 bytesPerRow) { - byte *curPtr; - uint16 skip, copy; - uint16 counter = 0; - - - while (counter < _dataBytesPerRow) { - curPtr = dest + counter; - - for (;;) { - skip = *diff; - diff++; - copy = *diff; - diff++; - - if (skip == 255) { - counter += copy; - break; - } - - else { - curPtr += (skip * bytesPerRow); - - while (copy) { - copy--; - *curPtr = *diff; - curPtr += bytesPerRow; - diff++; - } - } - } - } -} - -/*****************************************************************************/ -/* Undiffs a piece of memory when header size is a byte, and copy/skip size */ -/* is a word. */ -/*****************************************************************************/ -void Anim::VUnDiffByteWord(uint16 *dest, uint16 *diff, uint16 bytesPerRow) { - uint16 *curPtr; - uint16 skip, copy; - uint16 counter = 0; - - uint16 wordsPerRow = bytesPerRow / 2; - - while (counter < (_dataBytesPerRow >> 1)) { - curPtr = dest + counter; - - for (;;) { - skip = ((byte *)diff)[0]; - copy = ((byte *)diff)[1]; - - diff++; - - - if (skip == 255) { - counter += copy; - break; - } - - else { - curPtr += (skip * wordsPerRow); - - while (copy) { - *curPtr = *diff; //swapUShort(*diff); - curPtr += wordsPerRow; - diff++; - copy--; - } - } - } - } -} - -/*****************************************************************************/ -/* Undiffs a piece of memory when header size is a byte, and copy/skip size */ -/* is a long. */ -/*****************************************************************************/ -void Anim::VUnDiffByteLong(uint32 *dest, uint32 *diff, uint16 bytesPerRow) { - uint32 *_curPtr; - uint16 skip, copy; - - uint16 counter = 0; - byte *diff1 = (byte *)diff; - - uint16 longsperrow = bytesPerRow / 4; - - while (counter < (_dataBytesPerRow >> 2)) { - _curPtr = dest + counter; - - for (;;) { - skip = *diff1; - diff1++; - - copy = *diff1; - diff1++; - - - if (skip == 255) { - counter += copy; - break; - } - - else { - _curPtr += (skip * longsperrow); - - while (copy) { - *_curPtr = *(uint32 *)diff1; //swapULong(*diff); - _curPtr += longsperrow; - diff1 += 4; - copy--; - } - } - } - } -} - -/*****************************************************************************/ -/* Runlength decodes a chunk of memory. */ -/*****************************************************************************/ -void Anim::runLengthDecode(byte *dest, byte *source) { - int8 num; - int16 count; - - while (1) { - num = (int8)*source; - source++; - - if (num == 127) { - return; - } else if (num > '\0') { - memcpy(dest, source, num); - source += num; - dest += num; - } else { - count = (int16)(-num); - num = *source; - source++; - - while (count) { - *dest = num; - dest++; - count--; - } - } - } -} - -/*****************************************************************************/ -/* Does a vertical run length decode. */ -/*****************************************************************************/ -void Anim::VRunLengthDecode(byte *dest, byte *source, uint16 bytesPerRow) { - int8 num; - int16 count; - byte *top = dest; - - for (uint16 i = 0; i < _dataBytesPerRow; i++) { - dest = top; - dest += i; - - num = (int8)*source; - source++; - - while (num != 127) { - if (num > '\0') { - while (num) { - *dest = *source; - source++; - dest += bytesPerRow; - num--; - } - } else { - count = (int16)(-num); - num = (int8)*source; - source++; - - while (count) { - *dest = num; - dest += bytesPerRow; - count--; - } - } - - num = *source; - source++; - } - } -} - -/*****************************************************************************/ -/* Does the undiffing between the bitmaps. */ -/*****************************************************************************/ -void Anim::unDiff(byte *newBuf, byte *oldBuf, byte *diffData, uint16 bytesPerRow, bool isV) { - diffData++; - byte bufType = *diffData; - diffData++; - - if (isV) { - if (bufType == 0) - VUnDiffByteByte(newBuf, diffData, bytesPerRow); - else if (bufType == 1) - VUnDiffByteWord((uint16 *)newBuf, (uint16 *)diffData, bytesPerRow); - else if (bufType == 3) - VUnDiffByteLong((uint32 *)newBuf, (uint32 *)diffData, bytesPerRow); - } else { - if (bufType == 0) - unDiffByteByte(newBuf, diffData); - else if (bufType == 1) - unDiffByteWord((uint16 *)newBuf, (uint16 *)diffData); - } -} - void Anim::readBlock(void *Buffer, uint32 Size, byte **File) { memcpy(Buffer, *File, (size_t)Size); (*File) += Size; @@ -465,26 +160,26 @@ void Anim::diffNextFrame() { case 11L: _diffFile += 4; - runLengthDecode(DrawBitMap->_planes[_curBit], _diffFile); + _vm->_utils->runLengthDecode(DrawBitMap->_planes[_curBit], _diffFile); _curBit++; _diffFile += _size - 4; break; case 12L: _diffFile += 4; - VRunLengthDecode(DrawBitMap->_planes[_curBit], _diffFile, DrawBitMap->_bytesPerRow); + _vm->_utils->VRunLengthDecode(DrawBitMap->_planes[_curBit], _diffFile, DrawBitMap->_bytesPerRow); _curBit++; _diffFile += _size - 4; break; case 20L: - unDiff(DrawBitMap->_planes[_curBit], _vm->_graphics->_dispBitMap._planes[_curBit], _diffFile, DrawBitMap->_bytesPerRow, false); + _vm->_utils->unDiff(DrawBitMap->_planes[_curBit], _vm->_graphics->_dispBitMap._planes[_curBit], _diffFile, DrawBitMap->_bytesPerRow, false); _curBit++; _diffFile += _size; break; case 21L: - unDiff(DrawBitMap->_planes[_curBit], _vm->_graphics->_dispBitMap._planes[_curBit], _diffFile, DrawBitMap->_bytesPerRow, true); + _vm->_utils->unDiff(DrawBitMap->_planes[_curBit], _vm->_graphics->_dispBitMap._planes[_curBit], _diffFile, DrawBitMap->_bytesPerRow, true); _curBit++; _diffFile += _size; break; @@ -615,7 +310,7 @@ void Anim::playDiff(byte *buffer) { _continuous = CONTINUOUS & _headerdata._flags; _diffWidth = _headerdata._width; _diffHeight = _headerdata._height; - _dataBytesPerRow = _diffWidth; + _vm->_utils->setBytesPerRow(_diffWidth); _numChunks = (((int32) _diffWidth) * _diffHeight) / 0x10000; diff --git a/engines/lab/anim.h b/engines/lab/anim.h index 28927ba82d..121edea20e 100644 --- a/engines/lab/anim.h +++ b/engines/lab/anim.h @@ -83,16 +83,8 @@ private: uint16 _sampleSpeed; uint32 _diffWidth; uint32 _diffHeight; - uint16 _dataBytesPerRow; BitMap *DrawBitMap; - void runLengthDecode(byte *dest, byte *source); - void VRunLengthDecode(byte *dest, byte *source, uint16 bytesPerRow); - void unDiffByteByte(byte *dest, byte *diff); - void unDiffByteWord(uint16 *dest, uint16 *diff); - void VUnDiffByteByte(byte *Dest, byte *diff, uint16 bytesperrow); - void VUnDiffByteWord(uint16 *Dest, uint16 *diff, uint16 bytesperrow); - void VUnDiffByteLong(uint32 *Dest, uint32 *diff, uint16 bytesperrow); void readBlock(void *Buffer, uint32 Size, byte **File); void playDiff(byte *buffer); @@ -107,7 +99,6 @@ public: bool _noPalChange; /* Don't change the palette. */ BitMap _rawDiffBM; - void unDiff(byte *newBuf, byte *oldBuf, byte *diffData, uint16 bytesperrow, bool isV); bool readDiff(byte *buffer, bool playOnce); void diffNextFrame(); void stopDiff(); diff --git a/engines/lab/engine.cpp b/engines/lab/engine.cpp index ee61e2ff26..07c49d5a05 100644 --- a/engines/lab/engine.cpp +++ b/engines/lab/engine.cpp @@ -941,7 +941,7 @@ bool LabEngine::from_crumbs(uint32 tmpClass, uint16 code, uint16 Qualifier, Comm _curFileName = _newFileName; else if (doActionRule(curPos, TAKE - 1, 0, &_cptr)) _curFileName = _newFileName; - else if (curPos.y < (_graphics->VGAScaleY(149) + _graphics->SVGACord(2))) + else if (curPos.y < (_utils->vgaScaleY(149) + _utils->svgaCord(2))) drawStaticMessage(kTextNothing); } else if ((actionMode == 1) /* Manipulate an object */ || (actionMode == 2) /* Open up a "door" */ || @@ -949,7 +949,7 @@ bool LabEngine::from_crumbs(uint32 tmpClass, uint16 code, uint16 Qualifier, Comm if (doActionRule(curPos, actionMode, _roomNum, &_cptr)) _curFileName = _newFileName; else if (!doActionRule(curPos, actionMode, 0, &_cptr)) { - if (curPos.y < (_graphics->VGAScaleY(149) + _graphics->SVGACord(2))) + if (curPos.y < (_utils->vgaScaleY(149) + _utils->svgaCord(2))) drawStaticMessage(kTextNothing); } } else if (actionMode == 4) { /* Look at closeups */ @@ -957,15 +957,15 @@ bool LabEngine::from_crumbs(uint32 tmpClass, uint16 code, uint16 Qualifier, Comm setCurClose(curPos, &tempcptr); if (_cptr == tempcptr) { - if (curPos.y < (_graphics->VGAScaleY(149) + _graphics->SVGACord(2))) + if (curPos.y < (_utils->vgaScaleY(149) + _utils->svgaCord(2))) drawStaticMessage(kTextNothing); } else if (tempcptr->_graphicName) { if (*(tempcptr->_graphicName)) { _anim->_doBlack = true; _cptr = tempcptr; - } else if (curPos.y < (_graphics->VGAScaleY(149) + _graphics->SVGACord(2))) + } else if (curPos.y < (_utils->vgaScaleY(149) + _utils->svgaCord(2))) drawStaticMessage(kTextNothing); - } else if (curPos.y < (_graphics->VGAScaleY(149) + _graphics->SVGACord(2))) + } else if (curPos.y < (_utils->vgaScaleY(149) + _utils->svgaCord(2))) drawStaticMessage(kTextNothing); } else if ((actionMode == 5) && _conditions->in(curInv)) { /* Use an item on something else */ @@ -974,7 +974,7 @@ bool LabEngine::from_crumbs(uint32 tmpClass, uint16 code, uint16 Qualifier, Comm if (!_conditions->in(curInv)) decIncInv(&curInv, false); - } else if (curPos.y < (_graphics->VGAScaleY(149) + _graphics->SVGACord(2))) + } else if (curPos.y < (_utils->vgaScaleY(149) + _utils->svgaCord(2))) drawStaticMessage(kTextNothing); } } @@ -1008,7 +1008,7 @@ bool LabEngine::from_crumbs(uint32 tmpClass, uint16 code, uint16 Qualifier, Comm } if (hcptr) - _event->setMousePos(Common::Point(_graphics->scaleX((hcptr->x1 + hcptr->x2) / 2), _graphics->scaleY((hcptr->y1 + hcptr->y2) / 2))); + _event->setMousePos(Common::Point(_utils->scaleX((hcptr->x1 + hcptr->x2) / 2), _utils->scaleY((hcptr->y1 + hcptr->y2) / 2))); } else if ((msgClass == MOUSEBUTTONS) && (IEQUALIFIER_RBUTTON & Qualifier)) { eatMessages(); _alternate = !_alternate; diff --git a/engines/lab/graphics.cpp b/engines/lab/graphics.cpp index 9dd23073b9..97ec7cceaf 100644 --- a/engines/lab/graphics.cpp +++ b/engines/lab/graphics.cpp @@ -63,55 +63,6 @@ DisplayMan::~DisplayMan() { freePict(); } -/*****************************************************************************/ -/* Scales the x co-ordinates to that of the new display. In the room parser */ -/* file, co-ordinates are set up on a 360x336 display. */ -/*****************************************************************************/ -uint16 DisplayMan::scaleX(uint16 x) { - if (_vm->_isHiRes) - return (uint16)((x * 16) / 9); - else - return (uint16)((x * 8) / 9); -} - -/*****************************************************************************/ -/* Scales the y co-ordinates to that of the new display. In the room parser */ -/* file, co-ordinates are set up on a 368x336 display. */ -/*****************************************************************************/ -uint16 DisplayMan::scaleY(uint16 y) { - if (_vm->_isHiRes) - return (y + (y / 14)); - else - return ((y * 10) / 24); -} - -/*****************************************************************************/ -/* Scales the VGA cords to SVGA if necessary; otherwise, returns VGA cords. */ -/*****************************************************************************/ -int16 DisplayMan::VGAScaleX(int16 x) { - if (_vm->_isHiRes) - return (x * 2); - else - return x; -} - -/*****************************************************************************/ -/* Scales the VGA cords to SVGA if necessary; otherwise, returns VGA cords. */ -/*****************************************************************************/ -int16 DisplayMan::VGAScaleY(int16 y) { - if (_vm->_isHiRes) - return ((y * 12) / 5); - else - return y; -} - -uint16 DisplayMan::SVGACord(uint16 cord) { - if (_vm->_isHiRes) - return cord; - else - return 0; -} - /*---------------------------------------------------------------------------*/ /*------ From readPict.c. Reads in pictures and animations from disk. ------*/ /*---------------------------------------------------------------------------*/ @@ -305,16 +256,18 @@ uint32 DisplayMan::flowText(void *font, /* the TextAttr pointer */ } uint32 DisplayMan::flowTextScaled(void *font, /* the TextAttr pointer */ - int16 spacing, /* How much vertical spacing between the lines */ - byte pencolor, /* pen number to use for text */ - byte backpen, /* the background color */ - bool fillback, /* Whether to fill the background */ - bool centerh, /* Whether to center the text horizontally */ - bool centerv, /* Whether to center the text vertically */ + int16 spacing, /* How much vertical spacing between the lines */ + byte penColor, /* pen number to use for text */ + byte backPen, /* the background color */ + bool fillBack, /* Whether to fill the background */ + bool centerX, /* Whether to center the text horizontally */ + bool centerY, /* Whether to center the text vertically */ bool output, /* Whether to output any text */ - uint16 x1, /* Cords */ - uint16 y1, uint16 x2, uint16 y2, const char *str) { - return flowText(font, spacing, pencolor, backpen, fillback, centerh, centerv, output, VGAScaleX(x1), VGAScaleY(y1), VGAScaleX(x2), VGAScaleY(y2), str); + uint16 x1, uint16 y1, /* Cords */ + uint16 x2, uint16 y2, const char *str) { + return flowText(font, spacing, penColor, backPen, fillBack, centerX, centerY, output, + _vm->_utils->vgaScaleX(x1), _vm->_utils->vgaScaleY(y1), + _vm->_utils->vgaScaleX(x2), _vm->_utils->vgaScaleY(y2), str); } /******************************************************************************/ @@ -351,10 +304,10 @@ void DisplayMan::createBox(uint16 y2) { rectFillScaled(4, 154, 315, y2 - 2); setAPen(0); /* Box around message area */ - drawHLine(VGAScaleX(2), VGAScaleY(152), VGAScaleX(317)); - drawVLine(VGAScaleX(317), VGAScaleY(152), VGAScaleY(y2)); - drawHLine(VGAScaleX(2), VGAScaleY(y2), VGAScaleX(317)); - drawVLine(VGAScaleX(2), VGAScaleY(152), VGAScaleY(y2)); + drawHLine(_vm->_utils->vgaScaleX(2), _vm->_utils->vgaScaleY(152), _vm->_utils->vgaScaleX(317)); + drawVLine(_vm->_utils->vgaScaleX(317), _vm->_utils->vgaScaleY(152), _vm->_utils->vgaScaleY(y2)); + drawHLine(_vm->_utils->vgaScaleX(2), _vm->_utils->vgaScaleY(y2), _vm->_utils->vgaScaleX(317)); + drawVLine(_vm->_utils->vgaScaleX(2), _vm->_utils->vgaScaleY(152), _vm->_utils->vgaScaleY(y2)); } int32 DisplayMan::longDrawMessage(const char *str) { @@ -370,7 +323,7 @@ int32 DisplayMan::longDrawMessage(const char *str) { if (!_longWinInFront) { _longWinInFront = true; setAPen(3); /* Clear Area */ - rectFill(0, VGAScaleY(149) + SVGACord(2), VGAScaleX(319), VGAScaleY(199)); + rectFill(0, _vm->_utils->vgaScaleY(149) + _vm->_utils->svgaCord(2), _vm->_utils->vgaScaleX(319), _vm->_utils->vgaScaleY(199)); } createBox(198); @@ -389,7 +342,7 @@ void DisplayMan::drawMessage(const char *str) { } if (str) { - if ((textLength(_vm->_msgFont, str, strlen(str)) > VGAScaleX(306))) { + if ((textLength(_vm->_msgFont, str, strlen(str)) > _vm->_utils->vgaScaleX(306))) { longDrawMessage(str); _lastMessageLong = true; } else { @@ -400,7 +353,7 @@ void DisplayMan::drawMessage(const char *str) { _vm->_event->mouseHide(); createBox(168); - text(_vm->_msgFont, VGAScaleX(7), VGAScaleY(155) + SVGACord(2), 1, str, strlen(str)); + text(_vm->_msgFont, _vm->_utils->vgaScaleX(7), _vm->_utils->vgaScaleY(155) + _vm->_utils->svgaCord(2), 1, str, strlen(str)); _vm->_event->mouseShow(); _lastMessageLong = false; } @@ -415,8 +368,8 @@ void DisplayMan::doScrollBlack() { Image im; uint32 size, copysize; byte *baseAddr; - uint16 width = VGAScaleX(320); - uint16 height = VGAScaleY(149) + SVGACord(2); + uint16 width = _vm->_utils->vgaScaleX(320); + uint16 height = _vm->_utils->vgaScaleY(149) + _vm->_utils->svgaCord(2); byte *mem = new byte[width * height]; _vm->_event->mouseHide(); @@ -430,7 +383,7 @@ void DisplayMan::doScrollBlack() { baseAddr = getCurrentDrawingBuffer(); - uint16 by = VGAScaleX(4); + uint16 by = _vm->_utils->vgaScaleX(4); uint16 nheight = height; while (nheight) { @@ -512,8 +465,8 @@ void DisplayMan::doScrollWipe(char *filename) { uint16 startline = 0, onrow = 0; _vm->_event->mouseHide(); - uint16 width = VGAScaleX(320); - uint16 height = VGAScaleY(149) + SVGACord(2); + uint16 width = _vm->_utils->vgaScaleX(320); + uint16 height = _vm->_utils->vgaScaleY(149) + _vm->_utils->svgaCord(2); while (_vm->_music->isSoundEffectActive()) { _vm->_music->updateMusic(); @@ -527,7 +480,7 @@ void DisplayMan::doScrollWipe(char *filename) { byte *mem = _vm->_anim->_rawDiffBM._planes[0]; _vm->_music->updateMusic(); - uint16 by = VGAScaleX(3); + uint16 by = _vm->_utils->vgaScaleX(3); uint16 nheight = height; while (onrow < _vm->_anim->_headerdata._height) { @@ -552,11 +505,11 @@ void DisplayMan::doScrollWipe(char *filename) { onrow += by; if (nheight <= (height / 4)) - by = VGAScaleX(5); + by = _vm->_utils->vgaScaleX(5); else if (nheight <= (height / 3)) - by = VGAScaleX(4); + by = _vm->_utils->vgaScaleX(4); else if (nheight <= (height / 2)) - by = VGAScaleX(3); + by = _vm->_utils->vgaScaleX(3); } _vm->_event->mouseShow(); @@ -580,8 +533,8 @@ void DisplayMan::doScrollBounce() { } _vm->_event->mouseHide(); - int width = VGAScaleX(320); - int height = VGAScaleY(149) + SVGACord(2); + int width = _vm->_utils->vgaScaleX(320); + int height = _vm->_utils->vgaScaleY(149) + _vm->_utils->svgaCord(2); byte *mem = _vm->_anim->_rawDiffBM._planes[0]; _vm->_music->updateMusic(); @@ -787,44 +740,44 @@ void DisplayMan::drawPanel() { _vm->_event->mouseHide(); setAPen(3); /* Clear Area */ - rectFill(0, VGAScaleY(149) + SVGACord(2), VGAScaleX(319), VGAScaleY(199)); + rectFill(0, _vm->_utils->vgaScaleY(149) + _vm->_utils->svgaCord(2), _vm->_utils->vgaScaleX(319), _vm->_utils->vgaScaleY(199)); setAPen(0); /* First Line */ - drawHLine(0, VGAScaleY(149) + SVGACord(2), VGAScaleX(319)); + drawHLine(0, _vm->_utils->vgaScaleY(149) + _vm->_utils->svgaCord(2), _vm->_utils->vgaScaleX(319)); setAPen(5); /* Second Line */ - drawHLine(0, VGAScaleY(149) + 1 + SVGACord(2), VGAScaleX(319)); + drawHLine(0, _vm->_utils->vgaScaleY(149) + 1 + _vm->_utils->svgaCord(2), _vm->_utils->vgaScaleX(319)); /* Gadget Separators */ setAPen(0); - drawHLine(0, VGAScaleY(170), VGAScaleX(319)); /* First black line to separate buttons */ + drawHLine(0, _vm->_utils->vgaScaleY(170), _vm->_utils->vgaScaleX(319)); /* First black line to separate buttons */ if (!_vm->_alternate) { setAPen(4); - drawHLine(0, VGAScaleY(170) + 1, VGAScaleX(319)); /* The horizontal lines under the black one */ + drawHLine(0, _vm->_utils->vgaScaleY(170) + 1, _vm->_utils->vgaScaleX(319)); /* The horizontal lines under the black one */ drawGadgetList(&_vm->_moveGadgetList); } else { if (_vm->getPlatform() != Common::kPlatformWindows) { - drawVLine(VGAScaleX(124), VGAScaleY(170) + 1, VGAScaleY(199)); /* Vertical Black lines */ - drawVLine(VGAScaleX(194), VGAScaleY(170) + 1, VGAScaleY(199)); + drawVLine(_vm->_utils->vgaScaleX(124), _vm->_utils->vgaScaleY(170) + 1, _vm->_utils->vgaScaleY(199)); /* Vertical Black lines */ + drawVLine(_vm->_utils->vgaScaleX(194), _vm->_utils->vgaScaleY(170) + 1, _vm->_utils->vgaScaleY(199)); } else { - drawVLine(VGAScaleX(90), VGAScaleY(170) + 1, VGAScaleY(199)); /* Vertical Black lines */ - drawVLine(VGAScaleX(160), VGAScaleY(170) + 1, VGAScaleY(199)); - drawVLine(VGAScaleX(230), VGAScaleY(170) + 1, VGAScaleY(199)); + drawVLine(_vm->_utils->vgaScaleX(90), _vm->_utils->vgaScaleY(170) + 1, _vm->_utils->vgaScaleY(199)); /* Vertical Black lines */ + drawVLine(_vm->_utils->vgaScaleX(160), _vm->_utils->vgaScaleY(170) + 1, _vm->_utils->vgaScaleY(199)); + drawVLine(_vm->_utils->vgaScaleX(230), _vm->_utils->vgaScaleY(170) + 1, _vm->_utils->vgaScaleY(199)); } setAPen(4); - drawHLine(0, VGAScaleY(170) + 1, VGAScaleX(122)); /* The horizontal lines under the black one */ - drawHLine(VGAScaleX(126), VGAScaleY(170) + 1, VGAScaleX(192)); - drawHLine(VGAScaleX(196), VGAScaleY(170) + 1, VGAScaleX(319)); + drawHLine(0, _vm->_utils->vgaScaleY(170) + 1, _vm->_utils->vgaScaleX(122)); /* The horizontal lines under the black one */ + drawHLine(_vm->_utils->vgaScaleX(126), _vm->_utils->vgaScaleY(170) + 1, _vm->_utils->vgaScaleX(192)); + drawHLine(_vm->_utils->vgaScaleX(196), _vm->_utils->vgaScaleY(170) + 1, _vm->_utils->vgaScaleX(319)); + drawVLine(_vm->_utils->vgaScaleX(1), _vm->_utils->vgaScaleY(170) + 2, _vm->_utils->vgaScaleY(198)); /* The vertical high light lines */ - drawVLine(VGAScaleX(1), VGAScaleY(170) + 2, VGAScaleY(198)); /* The vertical high light lines */ if (_vm->getPlatform() != Common::kPlatformWindows) { - drawVLine(VGAScaleX(126), VGAScaleY(170) + 2, VGAScaleY(198)); - drawVLine(VGAScaleX(196), VGAScaleY(170) + 2, VGAScaleY(198)); + drawVLine(_vm->_utils->vgaScaleX(126), _vm->_utils->vgaScaleY(170) + 2, _vm->_utils->vgaScaleY(198)); + drawVLine(_vm->_utils->vgaScaleX(196), _vm->_utils->vgaScaleY(170) + 2, _vm->_utils->vgaScaleY(198)); } else { - drawVLine(VGAScaleX(92), VGAScaleY(170) + 2, VGAScaleY(198)); - drawVLine(VGAScaleX(162), VGAScaleY(170) + 2, VGAScaleY(198)); - drawVLine(VGAScaleX(232), VGAScaleY(170) + 2, VGAScaleY(198)); + drawVLine(_vm->_utils->vgaScaleX(92), _vm->_utils->vgaScaleY(170) + 2, _vm->_utils->vgaScaleY(198)); + drawVLine(_vm->_utils->vgaScaleX(162), _vm->_utils->vgaScaleY(170) + 2, _vm->_utils->vgaScaleY(198)); + drawVLine(_vm->_utils->vgaScaleX(232), _vm->_utils->vgaScaleY(170) + 2, _vm->_utils->vgaScaleY(198)); } drawGadgetList(&_vm->_invGadgetList); @@ -846,16 +799,16 @@ bool DisplayMan::setUpScreens() { delete controlFile; /* Creates the gadgets for the movement control panel */ - uint16 y = VGAScaleY(173) - SVGACord(2); + uint16 y = _vm->_utils->vgaScaleY(173) - _vm->_utils->svgaCord(2); // The key mapping was only set for the Windows version. // It's very convenient to have those shortcut, so I added them // for all versions. (Strangerke) - _vm->_moveGadgetList.push_back(createButton( 1, y, 0, 't', _vm->_moveImages[0], _vm->_moveImages[1])); - _vm->_moveGadgetList.push_back(createButton( 33, y, 1, 'm', _vm->_moveImages[2], _vm->_moveImages[3])); - _vm->_moveGadgetList.push_back(createButton( 65, y, 2, 'o', _vm->_moveImages[4], _vm->_moveImages[5])); - _vm->_moveGadgetList.push_back(createButton( 97, y, 3, 'c', _vm->_moveImages[6], _vm->_moveImages[7])); - _vm->_moveGadgetList.push_back(createButton(129, y, 4, 'l', _vm->_moveImages[8], _vm->_moveImages[9])); + _vm->_moveGadgetList.push_back(createButton( 1, y, 0, 't', _vm->_moveImages[0], _vm->_moveImages[1])); + _vm->_moveGadgetList.push_back(createButton( 33, y, 1, 'm', _vm->_moveImages[2], _vm->_moveImages[3])); + _vm->_moveGadgetList.push_back(createButton( 65, y, 2, 'o', _vm->_moveImages[4], _vm->_moveImages[5])); + _vm->_moveGadgetList.push_back(createButton( 97, y, 3, 'c', _vm->_moveImages[6], _vm->_moveImages[7])); + _vm->_moveGadgetList.push_back(createButton(129, y, 4, 'l', _vm->_moveImages[8], _vm->_moveImages[9])); _vm->_moveGadgetList.push_back(createButton(161, y, 5, 'i', _vm->_moveImages[12], _vm->_moveImages[13])); _vm->_moveGadgetList.push_back(createButton(193, y, 6, VKEY_LTARROW, _vm->_moveImages[14], _vm->_moveImages[15])); _vm->_moveGadgetList.push_back(createButton(225, y, 7, VKEY_UPARROW, _vm->_moveImages[16], _vm->_moveImages[17])); @@ -870,10 +823,10 @@ bool DisplayMan::setUpScreens() { for (uint16 imgIdx = 0; imgIdx < 6; imgIdx++) _vm->_invImages[imgIdx] = new Image(invFile); } - _vm->_invGadgetList.push_back(createButton( 24, y, 0, 'm', _vm->_invImages[0], _vm->_invImages[1])); - _vm->_invGadgetList.push_back(createButton( 56, y, 1, 'g', _vm->_invImages[2], _vm->_invImages[3])); - _vm->_invGadgetList.push_back(createButton( 94, y, 2, 'u', _vm->_invImages[4], _vm->_invImages[5])); - _vm->_invGadgetList.push_back(createButton(126, y, 3, 'l', _vm->_moveImages[8], _vm->_moveImages[9])); + _vm->_invGadgetList.push_back(createButton( 24, y, 0, 'm', _vm->_invImages[0], _vm->_invImages[1])); + _vm->_invGadgetList.push_back(createButton( 56, y, 1, 'g', _vm->_invImages[2], _vm->_invImages[3])); + _vm->_invGadgetList.push_back(createButton( 94, y, 2, 'u', _vm->_invImages[4], _vm->_invImages[5])); + _vm->_invGadgetList.push_back(createButton(126, y, 3, 'l', _vm->_moveImages[8], _vm->_moveImages[9])); _vm->_invGadgetList.push_back(createButton(164, y, 4, VKEY_LTARROW, _vm->_moveImages[14], _vm->_moveImages[15])); _vm->_invGadgetList.push_back(createButton(196, y, 5, VKEY_RTARROW, _vm->_moveImages[18], _vm->_moveImages[19])); @@ -926,7 +879,7 @@ void DisplayMan::rectFill(uint16 x1, uint16 y1, uint16 x2, uint16 y2) { } void DisplayMan::rectFillScaled(uint16 x1, uint16 y1, uint16 x2, uint16 y2) { - rectFill(VGAScaleX(x1), VGAScaleY(y1), VGAScaleX(x2), VGAScaleY(y2)); + rectFill(_vm->_utils->vgaScaleX(x1), _vm->_utils->vgaScaleY(y1), _vm->_utils->vgaScaleX(x2), _vm->_utils->vgaScaleY(y2)); } /*****************************************************************************/ diff --git a/engines/lab/graphics.h b/engines/lab/graphics.h index 9975cf39c1..1bfc0278e5 100644 --- a/engines/lab/graphics.h +++ b/engines/lab/graphics.h @@ -73,11 +73,6 @@ public: DisplayMan(LabEngine *lab); virtual ~DisplayMan(); - uint16 scaleX(uint16 x); - uint16 scaleY(uint16 y); - int16 VGAScaleX(int16 x); - int16 VGAScaleY(int16 y); - uint16 SVGACord(uint16 cord); void loadPict(const char *filename); void readPict(const char *filename, bool playOnce); void freePict(); diff --git a/engines/lab/interface.cpp b/engines/lab/interface.cpp index 9ab570ad02..6aba1510f7 100644 --- a/engines/lab/interface.cpp +++ b/engines/lab/interface.cpp @@ -43,7 +43,7 @@ Common::KeyState _keyPressed; Gadget *createButton(uint16 x, uint16 y, uint16 id, uint16 key, Image *im, Image *imalt) { Gadget *gptr; - x = g_lab->_graphics->VGAScaleX(x); + x = g_lab->_utils->vgaScaleX(x); if ((gptr = new Gadget())) { gptr->x = x; diff --git a/engines/lab/lab.cpp b/engines/lab/lab.cpp index ec81fdf427..d1de3e11f0 100644 --- a/engines/lab/lab.cpp +++ b/engines/lab/lab.cpp @@ -87,6 +87,7 @@ LabEngine::LabEngine(OSystem *syst, const ADGameDescription *gameDesc) _anim = nullptr; _graphics = nullptr; _rooms = nullptr; + _utils = nullptr; _lastTooLong = false; _interfaceOff = false; @@ -130,6 +131,7 @@ LabEngine::~LabEngine() { delete _anim; delete _graphics; delete[] _rooms; + delete _utils; for (int i = 0; i < 16; i++) delete _tiles[i]; @@ -146,6 +148,7 @@ Common::Error LabEngine::run() { _music = new Music(this); _graphics = new DisplayMan(this); _anim = new Anim(this); + _utils = new Utils(this); if (getPlatform() == Common::kPlatformWindows) { // Check if this is the Wyrmkeep trial diff --git a/engines/lab/lab.h b/engines/lab/lab.h index 656406d146..44104fc1e6 100644 --- a/engines/lab/lab.h +++ b/engines/lab/lab.h @@ -43,6 +43,7 @@ #include "lab/anim.h" #include "lab/graphics.h" #include "lab/labsets.h" +#include "lab/utils.h" struct ADGameDescription; @@ -103,6 +104,7 @@ public: Anim *_anim; DisplayMan *_graphics; RoomData *_rooms; + Utils *_utils; int _roomNum; CrumbData _breadCrumbs[MAX_CRUMBS]; @@ -179,8 +181,6 @@ private: void mayShowCrumbIndicator(); void mayShowCrumbIndicatorOff(); const char *getInvName(uint16 curInv); - int VGAUnScaleX(int x); - int VGAUnScaleY(int y); void mouseTile(Common::Point pos); void changeTile(uint16 col, uint16 row); void mouseCombination(Common::Point pos); diff --git a/engines/lab/map.cpp b/engines/lab/map.cpp index b7006a3dc9..4136b28bab 100644 --- a/engines/lab/map.cpp +++ b/engines/lab/map.cpp @@ -124,8 +124,8 @@ static bool loadMapData() { counter = 0; for (GadgetList::iterator gadget = MapGadgetList->begin(); gadget != MapGadgetList->end(); ++gadget) { - (*gadget)->x = g_lab->_graphics->VGAScaleX(MapGadX[counter]); - (*gadget)->y = g_lab->_graphics->VGAScaleY(MapGadY[counter]); + (*gadget)->x = g_lab->_utils->vgaScaleX(MapGadX[counter]); + (*gadget)->y = g_lab->_utils->vgaScaleY(MapGadY[counter]); counter++; } diff --git a/engines/lab/module.mk b/engines/lab/module.mk index 5c0aed5783..fccc438a74 100644 --- a/engines/lab/module.mk +++ b/engines/lab/module.mk @@ -18,7 +18,8 @@ MODULE_OBJS := \ savegame.o \ special.o \ tilepuzzle.o \ - timing.o + timing.o \ + utils.o # This module can be built as a plugin ifeq ($(ENABLE_LAB), DYNAMIC_PLUGIN) diff --git a/engines/lab/processroom.cpp b/engines/lab/processroom.cpp index 0b43966d98..b033c69945 100644 --- a/engines/lab/processroom.cpp +++ b/engines/lab/processroom.cpp @@ -105,8 +105,8 @@ static CloseData *getObject(uint16 x, uint16 y, CloseDataPtr lcptr) { } while (lcptr != NULL) { - if ((x >= g_lab->_graphics->scaleX(lcptr->x1)) && (y >= g_lab->_graphics->scaleY(lcptr->y1)) && - (x <= g_lab->_graphics->scaleX(lcptr->x2)) && (y <= g_lab->_graphics->scaleY(lcptr->y2))) + if ((x >= g_lab->_utils->scaleX(lcptr->x1)) && (y >= g_lab->_utils->scaleY(lcptr->y1)) && + (x <= g_lab->_utils->scaleX(lcptr->x2)) && (y <= g_lab->_utils->scaleY(lcptr->y2))) return lcptr; lcptr = lcptr->_nextCloseUp; @@ -248,10 +248,10 @@ void setCurClose(Common::Point pos, CloseDataPtr *cptr, bool useAbsoluteCoords) x2 = lcptr->x2; y2 = lcptr->y2; } else { - x1 = g_lab->_graphics->scaleX(lcptr->x1); - y1 = g_lab->_graphics->scaleY(lcptr->y1); - x2 = g_lab->_graphics->scaleX(lcptr->x2); - y2 = g_lab->_graphics->scaleY(lcptr->y2); + x1 = g_lab->_utils->scaleX(lcptr->x1); + y1 = g_lab->_utils->scaleY(lcptr->y1); + x2 = g_lab->_utils->scaleX(lcptr->x2); + y2 = g_lab->_utils->scaleY(lcptr->y2); } if (pos.x >= x1 && pos.y >= y1 && pos.x <= x2 && pos.y <= y2 && lcptr->_graphicName) { @@ -279,8 +279,8 @@ bool takeItem(uint16 x, uint16 y, CloseDataPtr *cptr) { while (lcptr != NULL) { - if ((x >= g_lab->_graphics->scaleX(lcptr->x1)) && (y >= g_lab->_graphics->scaleY(lcptr->y1)) && - (x <= g_lab->_graphics->scaleX(lcptr->x2)) && (y <= g_lab->_graphics->scaleY(lcptr->y2)) && + if ((x >= g_lab->_utils->scaleX(lcptr->x1)) && (y >= g_lab->_utils->scaleY(lcptr->y1)) && + (x <= g_lab->_utils->scaleX(lcptr->x2)) && (y <= g_lab->_utils->scaleY(lcptr->y2)) && (lcptr->_closeUpType < 0)) { g_lab->_conditions->inclElement(abs(lcptr->_closeUpType)); return true; @@ -410,7 +410,7 @@ void LabEngine::doActions(Action *aptr, CloseDataPtr *lcptr) { break; case SETCLOSEUP: { - CloseDataPtr tlcptr = getObject(g_lab->_graphics->scaleX(aptr->_param1), g_lab->_graphics->scaleY(aptr->_param2), *lcptr); + CloseDataPtr tlcptr = getObject(g_lab->_utils->scaleX(aptr->_param1), g_lab->_utils->scaleY(aptr->_param2), *lcptr); if (tlcptr) *lcptr = tlcptr; diff --git a/engines/lab/special.cpp b/engines/lab/special.cpp index e49119634a..41fcad7a86 100644 --- a/engines/lab/special.cpp +++ b/engines/lab/special.cpp @@ -100,7 +100,7 @@ void LabEngine::doNotes() { TextFont *noteFont = g_lab->_resource->getFont("P:Note.fon"); char *ntext = g_lab->_resource->getText("Lab:Rooms/Notes"); - g_lab->_graphics->flowText(noteFont, -2 + g_lab->_graphics->SVGACord(1), 0, 0, false, false, true, true, g_lab->_graphics->VGAScaleX(25) + g_lab->_graphics->SVGACord(15), g_lab->_graphics->VGAScaleY(50), g_lab->_graphics->VGAScaleX(295) - g_lab->_graphics->SVGACord(15), g_lab->_graphics->VGAScaleY(148), ntext); + g_lab->_graphics->flowText(noteFont, -2 + g_lab->_utils->svgaCord(1), 0, 0, false, false, true, true, g_lab->_utils->vgaScaleX(25) + g_lab->_utils->svgaCord(15), g_lab->_utils->vgaScaleY(50), g_lab->_utils->vgaScaleX(295) - g_lab->_utils->svgaCord(15), g_lab->_utils->vgaScaleY(148), ntext); g_lab->_graphics->setPalette(g_lab->_anim->_diffPalette, 256); g_lab->_graphics->closeFont(noteFont); @@ -120,19 +120,19 @@ void LabEngine::doWestPaper() { paperFont = g_lab->_resource->getFont("P:News22.fon"); ntext = g_lab->_resource->getText("Lab:Rooms/Date"); - g_lab->_graphics->flowText(paperFont, 0, 0, 0, false, true, false, true, g_lab->_graphics->VGAScaleX(57), g_lab->_graphics->VGAScaleY(77) + g_lab->_graphics->SVGACord(2), g_lab->_graphics->VGAScaleX(262), g_lab->_graphics->VGAScaleY(91), ntext); + g_lab->_graphics->flowText(paperFont, 0, 0, 0, false, true, false, true, g_lab->_utils->vgaScaleX(57), g_lab->_utils->vgaScaleY(77) + g_lab->_utils->svgaCord(2), g_lab->_utils->vgaScaleX(262), g_lab->_utils->vgaScaleY(91), ntext); g_lab->_graphics->closeFont(paperFont); delete[] ntext; paperFont = g_lab->_resource->getFont("P:News32.fon"); ntext = g_lab->_resource->getText("Lab:Rooms/Headline"); FileLen = strlen(ntext) - 1; - CharsPrinted = g_lab->_graphics->flowText(paperFont, -8, 0, 0, false, true, false, true, g_lab->_graphics->VGAScaleX(57), g_lab->_graphics->VGAScaleY(86) - g_lab->_graphics->SVGACord(2), g_lab->_graphics->VGAScaleX(262), g_lab->_graphics->VGAScaleY(118), ntext); + CharsPrinted = g_lab->_graphics->flowText(paperFont, -8, 0, 0, false, true, false, true, g_lab->_utils->vgaScaleX(57), g_lab->_utils->vgaScaleY(86) - g_lab->_utils->svgaCord(2), g_lab->_utils->vgaScaleX(262), g_lab->_utils->vgaScaleY(118), ntext); if (CharsPrinted < FileLen) { - y = 130 - g_lab->_graphics->SVGACord(5); - g_lab->_graphics->flowText(paperFont, -8 - g_lab->_graphics->SVGACord(1), 0, 0, false, true, false, true, g_lab->_graphics->VGAScaleX(57), g_lab->_graphics->VGAScaleY(86) - g_lab->_graphics->SVGACord(2), g_lab->_graphics->VGAScaleX(262), g_lab->_graphics->VGAScaleY(132), ntext); + y = 130 - g_lab->_utils->svgaCord(5); + g_lab->_graphics->flowText(paperFont, -8 - g_lab->_utils->svgaCord(1), 0, 0, false, true, false, true, g_lab->_utils->vgaScaleX(57), g_lab->_utils->vgaScaleY(86) - g_lab->_utils->svgaCord(2), g_lab->_utils->vgaScaleX(262), g_lab->_utils->vgaScaleY(132), ntext); } else - y = 115 - g_lab->_graphics->SVGACord(5); + y = 115 - g_lab->_utils->svgaCord(5); g_lab->_graphics->closeFont(paperFont); delete[] ntext; @@ -210,12 +210,12 @@ static bool loadJournalData() { for (GadgetList::iterator gadgetIter = journalGadgetList.begin(); gadgetIter != journalGadgetList.end(); ++gadgetIter) { Gadget *gadget = *gadgetIter; - gadget->x = g_lab->_graphics->VGAScaleX(JGadX[counter]); + gadget->x = g_lab->_utils->vgaScaleX(JGadX[counter]); if (counter == 1) - gadget->y = g_lab->_graphics->VGAScaleY(JGadY[counter]) + g_lab->_graphics->SVGACord(1); + gadget->y = g_lab->_utils->vgaScaleY(JGadY[counter]) + g_lab->_utils->svgaCord(1); else - gadget->y = g_lab->_graphics->VGAScaleY(JGadY[counter]) - g_lab->_graphics->SVGACord(1); + gadget->y = g_lab->_utils->vgaScaleY(JGadY[counter]) - g_lab->_utils->svgaCord(1); gadget->_gadgetID = counter; counter++; @@ -247,16 +247,16 @@ static void drawJournalText() { if (JPage <= 1) { CurText = journaltexttitle; - g_lab->_graphics->flowTextToMem(&JBackImage, journalFont, -2, 2, 0, false, true, true, true, g_lab->_graphics->VGAScaleX(52), g_lab->_graphics->VGAScaleY(32), g_lab->_graphics->VGAScaleX(152), g_lab->_graphics->VGAScaleY(148), CurText); + g_lab->_graphics->flowTextToMem(&JBackImage, journalFont, -2, 2, 0, false, true, true, true, g_lab->_utils->vgaScaleX(52), g_lab->_utils->vgaScaleY(32), g_lab->_utils->vgaScaleX(152), g_lab->_utils->vgaScaleY(148), CurText); } else { CurText = (char *)(journaltext + CharsDrawn); - CharsDrawn += g_lab->_graphics->flowTextToMem(&JBackImage, journalFont, -2, 2, 0, false, false, false, true, g_lab->_graphics->VGAScaleX(52), g_lab->_graphics->VGAScaleY(32), g_lab->_graphics->VGAScaleX(152), g_lab->_graphics->VGAScaleY(148), CurText); + CharsDrawn += g_lab->_graphics->flowTextToMem(&JBackImage, journalFont, -2, 2, 0, false, false, false, true, g_lab->_utils->vgaScaleX(52), g_lab->_utils->vgaScaleY(32), g_lab->_utils->vgaScaleX(152), g_lab->_utils->vgaScaleY(148), CurText); } g_lab->_music->updateMusic(); CurText = (char *)(journaltext + CharsDrawn); lastpage = (*CurText == 0); - g_lab->_graphics->flowTextToMem(&JBackImage, journalFont, -2, 2, 0, false, false, false, true, g_lab->_graphics->VGAScaleX(171), g_lab->_graphics->VGAScaleY(32), g_lab->_graphics->VGAScaleX(271), g_lab->_graphics->VGAScaleY(148), CurText); + g_lab->_graphics->flowTextToMem(&JBackImage, journalFont, -2, 2, 0, false, false, false, true, g_lab->_utils->vgaScaleX(171), g_lab->_utils->vgaScaleY(32), g_lab->_utils->vgaScaleX(271), g_lab->_utils->vgaScaleY(148), CurText); CurText = (char *)(journaltext + CharsDrawn); lastpage = lastpage || (*CurText == 0); @@ -469,8 +469,8 @@ void LabEngine::drawMonText(char *text, TextFont *monitorFont, uint16 x1, uint16 text += 2; fheight = g_lab->_graphics->textHeight(monitorFont); - x1 = MonButton->_width + _graphics->VGAScaleX(3); - MonGadHeight = MonButton->_height + _graphics->VGAScaleY(3); + x1 = MonButton->_width + _utils->vgaScaleX(3); + MonGadHeight = MonButton->_height + _utils->vgaScaleY(3); if (MonGadHeight > fheight) yspacing = MonGadHeight - fheight; @@ -563,20 +563,20 @@ void LabEngine::processMonitor(char *ntext, TextFont *monitorFont, bool isintera return; else if ((Class == MOUSEBUTTONS) && (IEQUALIFIER_LEFTBUTTON & Qualifier)) { - if ((MouseY >= g_lab->_graphics->VGAScaleY(171)) && (MouseY <= g_lab->_graphics->VGAScaleY(200))) { - if ((MouseX >= g_lab->_graphics->VGAScaleX(259)) && (MouseX <= g_lab->_graphics->VGAScaleX(289))) { + if ((MouseY >= g_lab->_utils->vgaScaleY(171)) && (MouseY <= g_lab->_utils->vgaScaleY(200))) { + if ((MouseX >= g_lab->_utils->vgaScaleX(259)) && (MouseX <= g_lab->_utils->vgaScaleX(289))) { if (!lastpage) { monitorPage += 1; drawMonText(ntext, monitorFont, x1, y1, x2, y2, isinteractive); } - } else if ((MouseX >= g_lab->_graphics->VGAScaleX(0)) && (MouseX <= g_lab->_graphics->VGAScaleX(31))) { + } else if ((MouseX >= g_lab->_utils->vgaScaleX(0)) && (MouseX <= g_lab->_utils->vgaScaleX(31))) { return; - } else if ((MouseX >= g_lab->_graphics->VGAScaleX(290)) && (MouseX <= g_lab->_graphics->VGAScaleX(320))) { + } else if ((MouseX >= g_lab->_utils->vgaScaleX(290)) && (MouseX <= g_lab->_utils->vgaScaleX(320))) { if (monitorPage >= 1) { monitorPage -= 1; drawMonText(ntext, monitorFont, x1, y1, x2, y2, isinteractive); } - } else if ((MouseX >= g_lab->_graphics->VGAScaleX(31)) && (MouseX <= g_lab->_graphics->VGAScaleX(59))) { + } else if ((MouseX >= g_lab->_utils->vgaScaleX(31)) && (MouseX <= g_lab->_utils->vgaScaleX(59))) { if (isinteractive) { monitorPage = 0; @@ -611,10 +611,10 @@ void LabEngine::processMonitor(char *ntext, TextFont *monitorFont, bool isintera void LabEngine::doMonitor(char *background, char *textfile, bool isinteractive, uint16 x1, uint16 y1, uint16 x2, uint16 y2) { char *ntext; - x1 = _graphics->VGAScaleX(x1); - x2 = _graphics->VGAScaleX(x2); - y1 = _graphics->VGAScaleY(y1); - y2 = _graphics->VGAScaleY(y2); + x1 = _utils->vgaScaleX(x1); + x2 = _utils->vgaScaleX(x2); + y1 = _utils->vgaScaleY(y1); + y2 = _utils->vgaScaleY(y2); TextFileName = textfile; diff --git a/engines/lab/tilepuzzle.cpp b/engines/lab/tilepuzzle.cpp index 0d050cc6bc..3b7d5ceb61 100644 --- a/engines/lab/tilepuzzle.cpp +++ b/engines/lab/tilepuzzle.cpp @@ -62,32 +62,12 @@ void LabEngine::initTilePuzzle() { _combination[i] = 0; } -/*****************************************************************************/ -/* Converts SVGA cords to VGA if necessary, otherwise returns VGA cords. */ -/*****************************************************************************/ -int LabEngine::VGAUnScaleX(int x) { - if (_isHiRes) - return (x / 2); - else - return x; -} - -/*****************************************************************************/ -/* Converts SVGA cords to VGA if necessary, otherwise returns VGA cords. */ -/*****************************************************************************/ -int LabEngine::VGAUnScaleY(int y) { - if (_isHiRes) - return ((y * 5) / 12); - else - return y; -} - /*****************************************************************************/ /* Processes mouse clicks and changes the combination. */ /*****************************************************************************/ void LabEngine::mouseTile(Common::Point pos) { - int x = VGAUnScaleX(pos.x); - int y = VGAUnScaleY(pos.y); + int x = _utils->vgaUnscaleX(pos.x); + int y = _utils->vgaUnscaleY(pos.y); if ((x < 101) || (y < 26)) return; @@ -174,8 +154,8 @@ void LabEngine::changeTile(uint16 col, uint16 row) { void LabEngine::mouseCombination(Common::Point pos) { uint16 number; - int x = VGAUnScaleX(pos.x); - int y = VGAUnScaleY(pos.y); + int x = _utils->vgaUnscaleX(pos.x); + int y = _utils->vgaUnscaleY(pos.y); if ((y >= 63) && (y <= 99)) { if ((x >= 44) && (x < 83)) @@ -205,20 +185,20 @@ void LabEngine::doTile(bool showsolution) { int16 rows, cols; if (showsolution) { - rowm = _graphics->VGAScaleY(23); - colm = _graphics->VGAScaleX(27); + rowm = _utils->vgaScaleY(23); + colm = _utils->vgaScaleX(27); - rows = _graphics->VGAScaleY(31); - cols = _graphics->VGAScaleX(105); + rows = _utils->vgaScaleY(31); + cols = _utils->vgaScaleX(105); } else { _graphics->setAPen(0); _graphics->rectFillScaled(97, 22, 220, 126); - rowm = _graphics->VGAScaleY(25); - colm = _graphics->VGAScaleX(30); + rowm = _utils->vgaScaleY(25); + colm = _utils->vgaScaleX(30); - rows = _graphics->VGAScaleY(25); - cols = _graphics->VGAScaleX(100); + rows = _utils->vgaScaleY(25); + cols = _utils->vgaScaleX(100); } while (row < 4) { @@ -270,33 +250,33 @@ void LabEngine::doTileScroll(uint16 col, uint16 row, uint16 scrolltype) { uint16 last = 0, x1, y1; if (scrolltype == LEFTSCROLL) { - dX = _graphics->VGAScaleX(5); - sx = _graphics->VGAScaleX(5); + dX = _utils->vgaScaleX(5); + sx = _utils->vgaScaleX(5); last = 6; } else if (scrolltype == RIGHTSCROLL) { - dX = _graphics->VGAScaleX(-5); - dx = _graphics->VGAScaleX(-5); - sx = _graphics->VGAScaleX(5); + dX = _utils->vgaScaleX(-5); + dx = _utils->vgaScaleX(-5); + sx = _utils->vgaScaleX(5); last = 6; } else if (scrolltype == UPSCROLL) { - dY = _graphics->VGAScaleY(5); - sy = _graphics->VGAScaleY(5); + dY = _utils->vgaScaleY(5); + sy = _utils->vgaScaleY(5); last = 5; } else if (scrolltype == DOWNSCROLL) { - dY = _graphics->VGAScaleY(-5); - dy = _graphics->VGAScaleY(-5); - sy = _graphics->VGAScaleY(5); + dY = _utils->vgaScaleY(-5); + dy = _utils->vgaScaleY(-5); + sy = _utils->vgaScaleY(5); last = 5; } - sx += _graphics->SVGACord(2); + sx += _utils->svgaCord(2); - x1 = _graphics->VGAScaleX(100) + (col * _graphics->VGAScaleX(30)) + dx; - y1 = _graphics->VGAScaleY(25) + (row * _graphics->VGAScaleY(25)) + dy; + x1 = _utils->vgaScaleX(100) + (col * _utils->vgaScaleX(30)) + dx; + y1 = _utils->vgaScaleY(25) + (row * _utils->vgaScaleY(25)) + dy; for (uint16 i = 0; i < last; i++) { waitTOF(); - scrollRaster(dX, dY, x1, y1, x1 + _graphics->VGAScaleX(28) + sx, y1 + _graphics->VGAScaleY(23) + sy); + scrollRaster(dX, dY, x1, y1, x1 + _utils->vgaScaleX(28) + sx, y1 + _utils->vgaScaleY(23) + sy); x1 += dX; y1 += dY; } @@ -331,8 +311,8 @@ void LabEngine::changeCombination(uint16 number) { waitTOF(); display._imageData = _graphics->getCurrentDrawingBuffer(); - _graphics->scrollDisplayY(2, _graphics->VGAScaleX(COMBINATION_X[number]), _graphics->VGAScaleY(65), _graphics->VGAScaleX(COMBINATION_X[number]) + (_numberImages[combnum])->_width - 1, _graphics->VGAScaleY(65) + (_numberImages[combnum])->_height); - _numberImages[combnum]->blitBitmap(0, (_numberImages[combnum])->_height - (2 * i), &(display), _graphics->VGAScaleX(COMBINATION_X[number]), _graphics->VGAScaleY(65), (_numberImages[combnum])->_width, 2, false); + _graphics->scrollDisplayY(2, _utils->vgaScaleX(COMBINATION_X[number]), _utils->vgaScaleY(65), _utils->vgaScaleX(COMBINATION_X[number]) + (_numberImages[combnum])->_width - 1, _utils->vgaScaleY(65) + (_numberImages[combnum])->_height); + _numberImages[combnum]->blitBitmap(0, (_numberImages[combnum])->_height - (2 * i), &(display), _utils->vgaScaleX(COMBINATION_X[number]), _utils->vgaScaleY(65), (_numberImages[combnum])->_width, 2, false); } for (uint16 i = 0; i < 6; i++) @@ -357,7 +337,7 @@ void LabEngine::scrollRaster(int16 dx, int16 dy, uint16 x1, uint16 y1, uint16 x2 /*****************************************************************************/ void LabEngine::doCombination() { for (uint16 i = 0; i <= 5; i++) - _numberImages[_combination[i]]->drawImage(_graphics->VGAScaleX(COMBINATION_X[i]), _graphics->VGAScaleY(65)); + _numberImages[_combination[i]]->drawImage(_utils->vgaScaleX(COMBINATION_X[i]), _utils->vgaScaleY(65)); } /*****************************************************************************/ diff --git a/engines/lab/utils.cpp b/engines/lab/utils.cpp new file mode 100644 index 0000000000..9e057f8a70 --- /dev/null +++ b/engines/lab/utils.cpp @@ -0,0 +1,413 @@ +/* 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. + * + */ + +/* + * This code is based on Labyrinth of Time code with assistance of + * + * Copyright (c) 1993 Terra Nova Development + * Copyright (c) 2004 The Wyrmkeep Entertainment Co. + * + */ + +#include "lab/lab.h" +#include "lab/utils.h" + +namespace Lab { +Utils::Utils(LabEngine *vm) : _vm(vm) { + _dataBytesPerRow = 0; +} + +/*****************************************************************************/ +/* Scales the x co-ordinates to that of the new display. In the room parser */ +/* file, co-ordinates are set up on a 360x336 display. */ +/*****************************************************************************/ +uint16 Utils::scaleX(uint16 x) { + if (_vm->_isHiRes) + return (uint16)((x * 16) / 9); + else + return (uint16)((x * 8) / 9); +} + +/*****************************************************************************/ +/* Scales the y co-ordinates to that of the new display. In the room parser */ +/* file, co-ordinates are set up on a 368x336 display. */ +/*****************************************************************************/ +uint16 Utils::scaleY(uint16 y) { + if (_vm->_isHiRes) + return (y + (y / 14)); + else + return ((y * 10) / 24); +} + +/*****************************************************************************/ +/* Scales the VGA cords to SVGA if necessary; otherwise, returns VGA cords. */ +/*****************************************************************************/ +int16 Utils::vgaScaleX(int16 x) { + if (_vm->_isHiRes) + return (x * 2); + else + return x; +} + +/*****************************************************************************/ +/* Scales the VGA cords to SVGA if necessary; otherwise, returns VGA cords. */ +/*****************************************************************************/ +int16 Utils::vgaScaleY(int16 y) { + if (_vm->_isHiRes) + return ((y * 12) / 5); + else + return y; +} + +uint16 Utils::svgaCord(uint16 cord) { + if (_vm->_isHiRes) + return cord; + else + return 0; +} + +/*****************************************************************************/ +/* Converts SVGA cords to VGA if necessary, otherwise returns VGA cords. */ +/*****************************************************************************/ +int Utils::vgaUnscaleX(int x) { + if (_vm->_isHiRes) + return (x / 2); + else + return x; +} + +/*****************************************************************************/ +/* Converts SVGA cords to VGA if necessary, otherwise returns VGA cords. */ +/*****************************************************************************/ +int Utils::vgaUnscaleY(int y) { + if (_vm->_isHiRes) + return ((y * 5) / 12); + else + return y; +} + +/*****************************************************************************/ +/* Undiffs a piece of memory when header size is a byte, and copy/skip size */ +/* is also a byte. */ +/*****************************************************************************/ +void Utils::unDiffByteByte(byte *dest, byte *diff) { + uint16 skip, copy; + + while (1) { + skip = *diff; + diff++; + copy = *diff; + diff++; + + if (skip == 255) { + if (copy == 0) { + skip = READ_LE_UINT16(diff); + diff += 2; + copy = READ_LE_UINT16(diff); + diff += 2; + } else if (copy == 255) + return; + } + + dest += skip; + memcpy(dest, diff, copy); + dest += copy; + diff += copy; + } +} + +/*****************************************************************************/ +/* Undiffs a piece of memory when header size is a byte, and copy/skip size */ +/* is a word. */ +/*****************************************************************************/ +void Utils::unDiffByteWord(uint16 *dest, uint16 *diff) { + uint16 skip, copy; + + while (1) { + skip = ((byte *)diff)[0]; + copy = ((byte *)diff)[1]; + + diff++; + + if (skip == 255) { + if (copy == 0) { + skip = READ_LE_UINT16(diff); + diff++; + copy = READ_LE_UINT16(diff); + diff++; + } else if (copy == 255) + return; + } + + dest += skip; + + while (copy > 3) { + *dest = READ_LE_UINT16(diff); + dest++; + diff++; + + *dest = READ_LE_UINT16(diff); + dest++; + diff++; + + *dest = READ_LE_UINT16(diff); + dest++; + diff++; + + *dest = READ_LE_UINT16(diff); + dest++; + diff++; + + copy -= 4; + } + + while (copy) { + *dest = READ_LE_UINT16(diff); + dest++; + diff++; + copy--; + } + } +} + +/*------------------------- unDiff Vertical Memory --------------------------*/ + +/*****************************************************************************/ +/* Undiffs a piece of memory when header size is a byte, and copy/skip size */ +/* is a byte. */ +/*****************************************************************************/ +void Utils::VUnDiffByteByte(byte *dest, byte *diff, uint16 bytesPerRow) { + byte *curPtr; + uint16 skip, copy; + uint16 counter = 0; + + + while (counter < _dataBytesPerRow) { + curPtr = dest + counter; + + for (;;) { + skip = *diff; + diff++; + copy = *diff; + diff++; + + if (skip == 255) { + counter += copy; + break; + } + + else { + curPtr += (skip * bytesPerRow); + + while (copy) { + copy--; + *curPtr = *diff; + curPtr += bytesPerRow; + diff++; + } + } + } + } +} + +/*****************************************************************************/ +/* Undiffs a piece of memory when header size is a byte, and copy/skip size */ +/* is a word. */ +/*****************************************************************************/ +void Utils::VUnDiffByteWord(uint16 *dest, uint16 *diff, uint16 bytesPerRow) { + uint16 *curPtr; + uint16 skip, copy; + uint16 counter = 0; + + uint16 wordsPerRow = bytesPerRow / 2; + + while (counter < (_dataBytesPerRow >> 1)) { + curPtr = dest + counter; + + for (;;) { + skip = ((byte *)diff)[0]; + copy = ((byte *)diff)[1]; + + diff++; + + + if (skip == 255) { + counter += copy; + break; + } + + else { + curPtr += (skip * wordsPerRow); + + while (copy) { + *curPtr = *diff; //swapUShort(*diff); + curPtr += wordsPerRow; + diff++; + copy--; + } + } + } + } +} + +/*****************************************************************************/ +/* Undiffs a piece of memory when header size is a byte, and copy/skip size */ +/* is a long. */ +/*****************************************************************************/ +void Utils::VUnDiffByteLong(uint32 *dest, uint32 *diff, uint16 bytesPerRow) { + uint32 *_curPtr; + uint16 skip, copy; + + uint16 counter = 0; + byte *diff1 = (byte *)diff; + + uint16 longsperrow = bytesPerRow / 4; + + while (counter < (_dataBytesPerRow >> 2)) { + _curPtr = dest + counter; + + for (;;) { + skip = *diff1; + diff1++; + + copy = *diff1; + diff1++; + + + if (skip == 255) { + counter += copy; + break; + } + + else { + _curPtr += (skip * longsperrow); + + while (copy) { + *_curPtr = *(uint32 *)diff1; //swapULong(*diff); + _curPtr += longsperrow; + diff1 += 4; + copy--; + } + } + } + } +} + +/*****************************************************************************/ +/* Runlength decodes a chunk of memory. */ +/*****************************************************************************/ +void Utils::runLengthDecode(byte *dest, byte *source) { + int8 num; + int16 count; + + while (1) { + num = (int8)*source; + source++; + + if (num == 127) { + return; + } else if (num > '\0') { + memcpy(dest, source, num); + source += num; + dest += num; + } else { + count = (int16)(-num); + num = *source; + source++; + + while (count) { + *dest = num; + dest++; + count--; + } + } + } +} + +/*****************************************************************************/ +/* Does a vertical run length decode. */ +/*****************************************************************************/ +void Utils::VRunLengthDecode(byte *dest, byte *source, uint16 bytesPerRow) { + int8 num; + int16 count; + byte *top = dest; + + for (uint16 i = 0; i < _dataBytesPerRow; i++) { + dest = top; + dest += i; + + num = (int8)*source; + source++; + + while (num != 127) { + if (num > '\0') { + while (num) { + *dest = *source; + source++; + dest += bytesPerRow; + num--; + } + } else { + count = (int16)(-num); + num = (int8)*source; + source++; + + while (count) { + *dest = num; + dest += bytesPerRow; + count--; + } + } + + num = *source; + source++; + } + } +} + +/*****************************************************************************/ +/* Does the undiffing between the bitmaps. */ +/*****************************************************************************/ +void Utils::unDiff(byte *newBuf, byte *oldBuf, byte *diffData, uint16 bytesPerRow, bool isV) { + diffData++; + byte bufType = *diffData; + diffData++; + + if (isV) { + if (bufType == 0) + VUnDiffByteByte(newBuf, diffData, bytesPerRow); + else if (bufType == 1) + VUnDiffByteWord((uint16 *)newBuf, (uint16 *)diffData, bytesPerRow); + else if (bufType == 3) + VUnDiffByteLong((uint32 *)newBuf, (uint32 *)diffData, bytesPerRow); + } else { + if (bufType == 0) + unDiffByteByte(newBuf, diffData); + else if (bufType == 1) + unDiffByteWord((uint16 *)newBuf, (uint16 *)diffData); + } +} + +void Utils::setBytesPerRow(int num) { + _dataBytesPerRow = num; +} +} // End of namespace Lab diff --git a/engines/lab/utils.h b/engines/lab/utils.h new file mode 100644 index 0000000000..4fa168dd54 --- /dev/null +++ b/engines/lab/utils.h @@ -0,0 +1,66 @@ +/* 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. + * + */ + +/* + * This code is based on Labyrinth of Time code with assistance of + * + * Copyright (c) 1993 Terra Nova Development + * Copyright (c) 2004 The Wyrmkeep Entertainment Co. + * + */ + +#ifndef LAB_UTILS_H +#define LAB_UTILS_H + +namespace Lab { + +class Utils { +private: + LabEngine *_vm; + uint16 _dataBytesPerRow; + + void unDiffByteByte(byte *dest, byte *diff); + void unDiffByteWord(uint16 *dest, uint16 *diff); + void VUnDiffByteByte(byte *Dest, byte *diff, uint16 bytesperrow); + void VUnDiffByteWord(uint16 *Dest, uint16 *diff, uint16 bytesperrow); + void VUnDiffByteLong(uint32 *Dest, uint32 *diff, uint16 bytesperrow); + +public: + Utils(LabEngine *vm); + + uint16 scaleX(uint16 x); + uint16 scaleY(uint16 y); + int16 vgaScaleX(int16 x); + int16 vgaScaleY(int16 y); + uint16 svgaCord(uint16 cord); + int vgaUnscaleX(int x); + int vgaUnscaleY(int y); + void unDiff(byte *newBuf, byte *oldBuf, byte *diffData, uint16 bytesperrow, bool isV); + void runLengthDecode(byte *dest, byte *source); + void VRunLengthDecode(byte *dest, byte *source, uint16 bytesPerRow); + void setBytesPerRow(int num); +}; + + +} // End of namespace Lab + +#endif // LAB_UTILS_H -- cgit v1.2.3 From 743b492ac796b1c3048a611681e21e7040dc1c0c Mon Sep 17 00:00:00 2001 From: Strangerke Date: Mon, 7 Dec 2015 17:49:22 +0100 Subject: LAB: Add safeguards in unDiff() --- engines/lab/utils.cpp | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/engines/lab/utils.cpp b/engines/lab/utils.cpp index 9e057f8a70..6d4784d0ac 100644 --- a/engines/lab/utils.cpp +++ b/engines/lab/utils.cpp @@ -399,11 +399,15 @@ void Utils::unDiff(byte *newBuf, byte *oldBuf, byte *diffData, uint16 bytesPerRo VUnDiffByteWord((uint16 *)newBuf, (uint16 *)diffData, bytesPerRow); else if (bufType == 3) VUnDiffByteLong((uint32 *)newBuf, (uint32 *)diffData, bytesPerRow); + else + error("Unexpected variable compression scheme %d", bufType); } else { if (bufType == 0) unDiffByteByte(newBuf, diffData); else if (bufType == 1) unDiffByteWord((uint16 *)newBuf, (uint16 *)diffData); + else + error("Unexpected compression scheme %d", bufType); } } -- cgit v1.2.3 From 80592779289461d42e166a40f8a1204e6159e62b Mon Sep 17 00:00:00 2001 From: Strangerke Date: Mon, 7 Dec 2015 18:02:29 +0100 Subject: LAB: remove some useless forward references and includes --- engines/lab/labfun.h | 8 -------- engines/lab/music.h | 1 - engines/lab/parsetypes.h | 2 -- engines/lab/processroom.cpp | 1 - engines/lab/resource.h | 1 + 5 files changed, 1 insertion(+), 12 deletions(-) diff --git a/engines/lab/labfun.h b/engines/lab/labfun.h index 80291f617b..e67d0f786a 100644 --- a/engines/lab/labfun.h +++ b/engines/lab/labfun.h @@ -34,11 +34,6 @@ #include "common/events.h" #include "lab/parsetypes.h" -// For the Music class - TODO: Move to another header file -#include "audio/mixer.h" -#include "audio/audiostream.h" -#include "audio/decoders/raw.h" - #include "common/file.h" #include "common/savefile.h" @@ -54,9 +49,6 @@ class LabEngine; #define EAST 2 #define WEST 3 -struct TextFont; -struct Gadget; - struct SaveGameHeader { byte _version; SaveStateDescriptor _descr; diff --git a/engines/lab/music.h b/engines/lab/music.h index 942f7372ce..3114817ba3 100644 --- a/engines/lab/music.h +++ b/engines/lab/music.h @@ -33,7 +33,6 @@ #include "common/events.h" -// For the Music class - TODO: Move to another header file #include "audio/mixer.h" #include "audio/audiostream.h" #include "audio/decoders/raw.h" diff --git a/engines/lab/parsetypes.h b/engines/lab/parsetypes.h index 42c7269d7c..c7780ae09a 100644 --- a/engines/lab/parsetypes.h +++ b/engines/lab/parsetypes.h @@ -35,8 +35,6 @@ namespace Lab { -#define MAXFILELEN 31 - /*------------------------------- Action types ------------------------------*/ #define PLAYSOUND 1 #define PLAYSOUNDCONT 2 diff --git a/engines/lab/processroom.cpp b/engines/lab/processroom.cpp index b033c69945..7acf683247 100644 --- a/engines/lab/processroom.cpp +++ b/engines/lab/processroom.cpp @@ -41,7 +41,6 @@ namespace Lab { /* Global parser data */ - #define NOFILE "no file" /*****************************************************************************/ diff --git a/engines/lab/resource.h b/engines/lab/resource.h index e050a156cb..cf7f3505ec 100644 --- a/engines/lab/resource.h +++ b/engines/lab/resource.h @@ -32,6 +32,7 @@ #define LAB_RESOURCE_H #include "lab/labfun.h" +#include "lab/graphics.h" namespace Lab { -- cgit v1.2.3 From 6aff1b450d60507d1ebe49ea7a3d2ce76a3e3ea5 Mon Sep 17 00:00:00 2001 From: Filippos Karapetis Date: Mon, 7 Dec 2015 20:56:54 +0200 Subject: LAB: Move scene transition functions into a separate file --- engines/lab/graphics.cpp | 470 ---------------------------------------- engines/lab/module.mk | 1 + engines/lab/transitions.cpp | 507 ++++++++++++++++++++++++++++++++++++++++++++ 3 files changed, 508 insertions(+), 470 deletions(-) create mode 100644 engines/lab/transitions.cpp diff --git a/engines/lab/graphics.cpp b/engines/lab/graphics.cpp index 97ec7cceaf..80eae97ab0 100644 --- a/engines/lab/graphics.cpp +++ b/engines/lab/graphics.cpp @@ -360,379 +360,6 @@ void DisplayMan::drawMessage(const char *str) { } } -/*****************************************************************************/ -/* Scrolls the display to black. */ -/*****************************************************************************/ -void DisplayMan::doScrollBlack() { - byte *tempmem; - Image im; - uint32 size, copysize; - byte *baseAddr; - uint16 width = _vm->_utils->vgaScaleX(320); - uint16 height = _vm->_utils->vgaScaleY(149) + _vm->_utils->svgaCord(2); - byte *mem = new byte[width * height]; - - _vm->_event->mouseHide(); - - im._width = width; - im._height = height; - im._imageData = mem; - _vm->_music->updateMusic(); - im.readScreenImage(0, 0); - _vm->_music->updateMusic(); - - baseAddr = getCurrentDrawingBuffer(); - - uint16 by = _vm->_utils->vgaScaleX(4); - uint16 nheight = height; - - while (nheight) { - _vm->_music->updateMusic(); - - if (!_vm->_isHiRes) - _vm->waitTOF(); - - baseAddr = getCurrentDrawingBuffer(); - - if (by > nheight) - by = nheight; - - mem += by * width; - nheight -= by; - size = (int32)nheight * (int32)width; - tempmem = mem; - - while (size) { - if (size > _screenBytesPerPage) - copysize = _screenBytesPerPage; - else - copysize = size; - - size -= copysize; - - memcpy(baseAddr, tempmem, copysize); - tempmem += copysize; - } - - setAPen(0); - rectFill(0, nheight, width - 1, nheight + by - 1); - - screenUpdate(); - - if (!_vm->_isHiRes) { - if (nheight <= (height / 8)) - by = 1; - else if (nheight <= (height / 4)) - by = 2; - else if (nheight <= (height / 2)) - by = 3; - } - } - - delete[] mem; - freePict(); - _vm->_event->mouseShow(); -} - -void DisplayMan::copyPage(uint16 width, uint16 height, uint16 nheight, uint16 startline, byte *mem) { - byte *baseAddr = getCurrentDrawingBuffer(); - - uint32 size = (int32)(height - nheight) * (int32)width; - mem += startline * width; - uint16 curPage = ((int32)nheight * (int32)width) / _screenBytesPerPage; - uint32 offSet = ((int32)nheight * (int32)width) - (curPage * _screenBytesPerPage); - - while (size) { - uint32 copysize; - if (size > (_screenBytesPerPage - offSet)) - copysize = _screenBytesPerPage - offSet; - else - copysize = size; - - size -= copysize; - - memcpy(baseAddr + (offSet >> 2), mem, copysize); - mem += copysize; - curPage++; - offSet = 0; - } -} - -/*****************************************************************************/ -/* Scrolls the display to a new picture from a black screen. */ -/*****************************************************************************/ -void DisplayMan::doScrollWipe(char *filename) { - uint16 startline = 0, onrow = 0; - - _vm->_event->mouseHide(); - uint16 width = _vm->_utils->vgaScaleX(320); - uint16 height = _vm->_utils->vgaScaleY(149) + _vm->_utils->svgaCord(2); - - while (_vm->_music->isSoundEffectActive()) { - _vm->_music->updateMusic(); - _vm->waitTOF(); - } - - _vm->_anim->_isBM = true; - readPict(filename, true); - setPalette(_vm->_anim->_diffPalette, 256); - _vm->_anim->_isBM = false; - byte *mem = _vm->_anim->_rawDiffBM._planes[0]; - - _vm->_music->updateMusic(); - uint16 by = _vm->_utils->vgaScaleX(3); - uint16 nheight = height; - - while (onrow < _vm->_anim->_headerdata._height) { - _vm->_music->updateMusic(); - - if ((by > nheight) && nheight) - by = nheight; - - if ((startline + by) > (_vm->_anim->_headerdata._height - height - 1)) - break; - - if (nheight) - nheight -= by; - - copyPage(width, height, nheight, startline, mem); - - screenUpdate(); - - if (!nheight) - startline += by; - - onrow += by; - - if (nheight <= (height / 4)) - by = _vm->_utils->vgaScaleX(5); - else if (nheight <= (height / 3)) - by = _vm->_utils->vgaScaleX(4); - else if (nheight <= (height / 2)) - by = _vm->_utils->vgaScaleX(3); - } - - _vm->_event->mouseShow(); -} - -/*****************************************************************************/ -/* Does the scroll bounce. Assumes bitmap already in memory. */ -/*****************************************************************************/ -void DisplayMan::doScrollBounce() { - const uint16 *newby, *newby1; - - const uint16 newbyd[5] = {5, 4, 3, 2, 1}, newby1d[8] = {3, 3, 2, 2, 2, 1, 1, 1}; - const uint16 newbyw[5] = {10, 8, 6, 4, 2}, newby1w[8] = {6, 6, 4, 4, 4, 2, 2, 2}; - - if (_vm->getPlatform() != Common::kPlatformWindows) { - newby = newbyd; - newby1 = newby1d; - } else { - newby = newbyw; - newby1 = newby1w; - } - - _vm->_event->mouseHide(); - int width = _vm->_utils->vgaScaleX(320); - int height = _vm->_utils->vgaScaleY(149) + _vm->_utils->svgaCord(2); - byte *mem = _vm->_anim->_rawDiffBM._planes[0]; - - _vm->_music->updateMusic(); - int startline = _vm->_anim->_headerdata._height - height - 1; - - for (int i = 0; i < 5; i++) { - _vm->_music->updateMusic(); - startline -= newby[i]; - copyPage(width, height, 0, startline, mem); - - screenUpdate(); - _vm->waitTOF(); - } - - for (int i = 8; i > 0; i--) { - _vm->_music->updateMusic(); - startline += newby1[i - 1]; - copyPage(width, height, 0, startline, mem); - - screenUpdate(); - _vm->waitTOF(); - } - - _vm->_event->mouseShow(); -} - -/*****************************************************************************/ -/* Does the transporter wipe. */ -/*****************************************************************************/ -void DisplayMan::doTransWipe(CloseDataPtr *cPtr, char *filename) { - uint16 lastY, curY, linesdone = 0, lineslast; - Image imSource, imDest; - - if (_vm->_isHiRes) { - lineslast = 3; - lastY = 358; - } else { - lineslast = 1; - lastY = 148; - } - - for (uint16 i = 0; i < 2; i++) { - curY = i * 2; - - while (curY < lastY) { - if (linesdone >= lineslast) { - _vm->_music->updateMusic(); - _vm->waitTOF(); - linesdone = 0; - } - - overlayRect(0, 0, curY, _screenWidth - 1, curY + 1); - curY += 4; - linesdone++; - } - } - - setAPen(0); - - for (uint16 i = 0; i < 2; i++) { - curY = i * 2; - - while (curY <= lastY) { - if (linesdone >= lineslast) { - _vm->_music->updateMusic(); - _vm->waitTOF(); - linesdone = 0; - } - - rectFill(0, curY, _screenWidth - 1, curY + 1); - curY += 4; - linesdone++; - } - } - - if (filename == NULL) - _vm->_curFileName = getPictName(cPtr); - else if (filename[0] > ' ') - _vm->_curFileName = filename; - else - _vm->_curFileName = getPictName(cPtr); - - byte *BitMapMem = readPictToMem(_vm->_curFileName, _screenWidth, lastY + 5); - setPalette(_vm->_anim->_diffPalette, 256); - - if (BitMapMem) { - imSource._width = _screenWidth; - imSource._height = lastY; - imSource._imageData = BitMapMem; - - imDest._width = _screenWidth; - imDest._height = _screenHeight; - imDest._imageData = getCurrentDrawingBuffer(); - - for (uint16 i = 0; i < 2; i++) { - curY = i * 2; - - while (curY < lastY) { - if (linesdone >= lineslast) { - _vm->_music->updateMusic(); - _vm->waitTOF(); - linesdone = 0; - } - - imDest._imageData = getCurrentDrawingBuffer(); - - imSource.blitBitmap(0, curY, &imDest, 0, curY, _screenWidth, 2, false); - overlayRect(0, 0, curY, _screenWidth - 1, curY + 1); - curY += 4; - linesdone++; - } - } - - for (uint16 i = 0; i < 2; i++) { - curY = i * 2; - - while (curY <= lastY) { - if (linesdone >= lineslast) { - _vm->_music->updateMusic(); - _vm->waitTOF(); - linesdone = 0; - } - - imDest._imageData = getCurrentDrawingBuffer(); - - if (curY == lastY) - imSource.blitBitmap(0, curY, &imDest, 0, curY, _screenWidth, 1, false); - else - imSource.blitBitmap(0, curY, &imDest, 0, curY, _screenWidth, 2, false); - - curY += 4; - linesdone++; - } - } - } -} - -/*****************************************************************************/ -/* Does a certain number of pre-programmed wipes. */ -/*****************************************************************************/ -void DisplayMan::doTransition(TransitionType transitionType, CloseDataPtr *cPtr, char *filename) { - switch (transitionType) { - case kTransitionWipe: - case kTransitionTransporter: - doTransWipe(cPtr, filename); - break; - case kTransitionScrollWipe: - doScrollWipe(filename); - break; - case kTransitionScrollBlack: - doScrollBlack(); - break; - case kTransitionScrollBounce: - doScrollBounce(); - break; - case kTransitionReadFirstFrame: - readPict(filename, false); - break; - case kTransitionReadNextFrame: - _vm->_anim->diffNextFrame(); - break; - case kTransitionNone: - default: - break; - } -} - -/*****************************************************************************/ -/* Changes the front screen to black. */ -/*****************************************************************************/ -void DisplayMan::blackScreen() { - byte pal[256 * 3]; - memset(pal, 0, 248 * 3); - writeColorRegs(pal, 8, 248); - - g_system->delayMillis(32); -} - -/*****************************************************************************/ -/* Changes the front screen to white. */ -/*****************************************************************************/ -void DisplayMan::whiteScreen() { - byte pal[256 * 3]; - memset(pal, 255, 248 * 3); - writeColorRegs(pal, 8, 248); -} - -/*****************************************************************************/ -/* Changes the entire screen to black. */ -/*****************************************************************************/ -void DisplayMan::blackAllScreen() { - byte pal[256 * 3]; - memset(pal, 0, 256 * 3); - writeColorRegs(pal, 0, 256); - - g_system->delayMillis(32); -} - /******************************************************************************/ /* Draws the control panel display. */ /******************************************************************************/ @@ -1016,103 +643,6 @@ void DisplayMan::overlayRect(uint16 pencolor, uint16 x1, uint16 y1, uint16 x2, u } } -/*****************************************************************************/ -/* Scrolls the display in the x direction by blitting. */ -/* The _tempScrollData variable must be initialized to some memory, or this */ -/* function will fail. */ -/*****************************************************************************/ -void DisplayMan::scrollDisplayX(int16 dx, uint16 x1, uint16 y1, uint16 x2, uint16 y2) { - Image im; - uint16 temp; - - im._imageData = _tempScrollData; - - if (x1 > x2) { - temp = x2; - x2 = x1; - x1 = temp; - } - - if (y1 > y2) { - temp = y2; - y2 = y1; - y1 = temp; - } - - im._width = x2 - x1 + 1 - dx; - im._height = y2 - y1 + 1; - - im.readScreenImage(x1, y1); - im.drawImage(x1 + dx, y1); - - setAPen(0); - rectFill(x1, y1, x1 + dx - 1, y2); -} - -/*****************************************************************************/ -/* Scrolls the display in the y direction by blitting. */ -/*****************************************************************************/ -void DisplayMan::scrollDisplayY(int16 dy, uint16 x1, uint16 y1, uint16 x2, uint16 y2) { - Image im; - uint16 temp; - - im._imageData = _tempScrollData; - - if (x1 > x2) { - temp = x2; - x2 = x1; - x1 = temp; - } - - if (y1 > y2) { - temp = y2; - y2 = y1; - y1 = temp; - } - - im._width = x2 - x1 + 1; - im._height = y2 - y1 + 1 - dy; - - im.readScreenImage(x1, y1); - im.drawImage(x1, y1 + dy); - - setAPen(0); - rectFill(x1, y1, x2, y1 + dy - 1); -} - -/*****************************************************************************/ -/* Does the fading of the Palette on the screen. */ -/*****************************************************************************/ -uint16 DisplayMan::fadeNumIn(uint16 num, uint16 res, uint16 counter) { - return (num - ((((int32)(15 - counter)) * ((int32)(num - res))) / 15)); -} - - -uint16 DisplayMan::fadeNumOut(uint16 num, uint16 res, uint16 counter) { - return (num - ((((int32) counter) * ((int32)(num - res))) / 15)); -} - -void DisplayMan::fade(bool fadein, uint16 res) { - uint16 newpal[16]; - - for (uint16 i = 0; i < 16; i++) { - for (uint16 palIdx = 0; palIdx < 16; palIdx++) { - if (fadein) - newpal[palIdx] = (0x00F & fadeNumIn(0x00F & FadePalette[palIdx], 0x00F & res, i)) + - (0x0F0 & fadeNumIn(0x0F0 & FadePalette[palIdx], 0x0F0 & res, i)) + - (0xF00 & fadeNumIn(0xF00 & FadePalette[palIdx], 0xF00 & res, i)); - else - newpal[palIdx] = (0x00F & fadeNumOut(0x00F & FadePalette[palIdx], 0x00F & res, i)) + - (0x0F0 & fadeNumOut(0x0F0 & FadePalette[palIdx], 0x0F0 & res, i)) + - (0xF00 & fadeNumOut(0xF00 & FadePalette[palIdx], 0xF00 & res, i)); - } - - setAmigaPal(newpal, 16); - _vm->waitTOF(); - _vm->_music->updateMusic(); - } -} - /*****************************************************************************/ /* Closes a font and frees all memory associated with it. */ /*****************************************************************************/ diff --git a/engines/lab/module.mk b/engines/lab/module.mk index fccc438a74..f4cb284813 100644 --- a/engines/lab/module.mk +++ b/engines/lab/module.mk @@ -19,6 +19,7 @@ MODULE_OBJS := \ special.o \ tilepuzzle.o \ timing.o \ + transitions.o \ utils.o # This module can be built as a plugin diff --git a/engines/lab/transitions.cpp b/engines/lab/transitions.cpp new file mode 100644 index 0000000000..caf52dc287 --- /dev/null +++ b/engines/lab/transitions.cpp @@ -0,0 +1,507 @@ +/* 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. + * + */ + +/* + * This code is based on Labyrinth of Time code with assistance of + * + * Copyright (c) 1993 Terra Nova Development + * Copyright (c) 2004 The Wyrmkeep Entertainment Co. + * + */ + +#include "lab/lab.h" +#include "lab/parsefun.h" +#include "lab/graphics.h" + +namespace Lab { + +/*****************************************************************************/ +/* Scrolls the display to black. */ +/*****************************************************************************/ +void DisplayMan::doScrollBlack() { + byte *tempmem; + Image im; + uint32 size, copysize; + byte *baseAddr; + uint16 width = _vm->_utils->vgaScaleX(320); + uint16 height = _vm->_utils->vgaScaleY(149) + _vm->_utils->svgaCord(2); + byte *mem = new byte[width * height]; + + _vm->_event->mouseHide(); + + im._width = width; + im._height = height; + im._imageData = mem; + _vm->_music->updateMusic(); + im.readScreenImage(0, 0); + _vm->_music->updateMusic(); + + baseAddr = getCurrentDrawingBuffer(); + + uint16 by = _vm->_utils->vgaScaleX(4); + uint16 nheight = height; + + while (nheight) { + _vm->_music->updateMusic(); + + if (!_vm->_isHiRes) + _vm->waitTOF(); + + baseAddr = getCurrentDrawingBuffer(); + + if (by > nheight) + by = nheight; + + mem += by * width; + nheight -= by; + size = (int32)nheight * (int32)width; + tempmem = mem; + + while (size) { + if (size > _screenBytesPerPage) + copysize = _screenBytesPerPage; + else + copysize = size; + + size -= copysize; + + memcpy(baseAddr, tempmem, copysize); + tempmem += copysize; + } + + setAPen(0); + rectFill(0, nheight, width - 1, nheight + by - 1); + + screenUpdate(); + + if (!_vm->_isHiRes) { + if (nheight <= (height / 8)) + by = 1; + else if (nheight <= (height / 4)) + by = 2; + else if (nheight <= (height / 2)) + by = 3; + } + } + + delete[] mem; + freePict(); + _vm->_event->mouseShow(); +} + +void DisplayMan::copyPage(uint16 width, uint16 height, uint16 nheight, uint16 startline, byte *mem) { + byte *baseAddr = getCurrentDrawingBuffer(); + + uint32 size = (int32)(height - nheight) * (int32)width; + mem += startline * width; + uint16 curPage = ((int32)nheight * (int32)width) / _screenBytesPerPage; + uint32 offSet = ((int32)nheight * (int32)width) - (curPage * _screenBytesPerPage); + + while (size) { + uint32 copysize; + if (size > (_screenBytesPerPage - offSet)) + copysize = _screenBytesPerPage - offSet; + else + copysize = size; + + size -= copysize; + + memcpy(baseAddr + (offSet >> 2), mem, copysize); + mem += copysize; + curPage++; + offSet = 0; + } +} + +/*****************************************************************************/ +/* Scrolls the display to a new picture from a black screen. */ +/*****************************************************************************/ +void DisplayMan::doScrollWipe(char *filename) { + uint16 startline = 0, onrow = 0; + + _vm->_event->mouseHide(); + uint16 width = _vm->_utils->vgaScaleX(320); + uint16 height = _vm->_utils->vgaScaleY(149) + _vm->_utils->svgaCord(2); + + while (_vm->_music->isSoundEffectActive()) { + _vm->_music->updateMusic(); + _vm->waitTOF(); + } + + _vm->_anim->_isBM = true; + readPict(filename, true); + setPalette(_vm->_anim->_diffPalette, 256); + _vm->_anim->_isBM = false; + byte *mem = _vm->_anim->_rawDiffBM._planes[0]; + + _vm->_music->updateMusic(); + uint16 by = _vm->_utils->vgaScaleX(3); + uint16 nheight = height; + + while (onrow < _vm->_anim->_headerdata._height) { + _vm->_music->updateMusic(); + + if ((by > nheight) && nheight) + by = nheight; + + if ((startline + by) > (_vm->_anim->_headerdata._height - height - 1)) + break; + + if (nheight) + nheight -= by; + + copyPage(width, height, nheight, startline, mem); + + screenUpdate(); + + if (!nheight) + startline += by; + + onrow += by; + + if (nheight <= (height / 4)) + by = _vm->_utils->vgaScaleX(5); + else if (nheight <= (height / 3)) + by = _vm->_utils->vgaScaleX(4); + else if (nheight <= (height / 2)) + by = _vm->_utils->vgaScaleX(3); + } + + _vm->_event->mouseShow(); +} + +/*****************************************************************************/ +/* Does the scroll bounce. Assumes bitmap already in memory. */ +/*****************************************************************************/ +void DisplayMan::doScrollBounce() { + const uint16 *newby, *newby1; + + const uint16 newbyd[5] = {5, 4, 3, 2, 1}, newby1d[8] = {3, 3, 2, 2, 2, 1, 1, 1}; + const uint16 newbyw[5] = {10, 8, 6, 4, 2}, newby1w[8] = {6, 6, 4, 4, 4, 2, 2, 2}; + + if (_vm->getPlatform() != Common::kPlatformWindows) { + newby = newbyd; + newby1 = newby1d; + } else { + newby = newbyw; + newby1 = newby1w; + } + + _vm->_event->mouseHide(); + int width = _vm->_utils->vgaScaleX(320); + int height = _vm->_utils->vgaScaleY(149) + _vm->_utils->svgaCord(2); + byte *mem = _vm->_anim->_rawDiffBM._planes[0]; + + _vm->_music->updateMusic(); + int startline = _vm->_anim->_headerdata._height - height - 1; + + for (int i = 0; i < 5; i++) { + _vm->_music->updateMusic(); + startline -= newby[i]; + copyPage(width, height, 0, startline, mem); + + screenUpdate(); + _vm->waitTOF(); + } + + for (int i = 8; i > 0; i--) { + _vm->_music->updateMusic(); + startline += newby1[i - 1]; + copyPage(width, height, 0, startline, mem); + + screenUpdate(); + _vm->waitTOF(); + } + + _vm->_event->mouseShow(); +} + +/*****************************************************************************/ +/* Does the transporter wipe. */ +/*****************************************************************************/ +void DisplayMan::doTransWipe(CloseDataPtr *cPtr, char *filename) { + uint16 lastY, curY, linesdone = 0, lineslast; + Image imSource, imDest; + + if (_vm->_isHiRes) { + lineslast = 3; + lastY = 358; + } else { + lineslast = 1; + lastY = 148; + } + + for (uint16 i = 0; i < 2; i++) { + curY = i * 2; + + while (curY < lastY) { + if (linesdone >= lineslast) { + _vm->_music->updateMusic(); + _vm->waitTOF(); + linesdone = 0; + } + + overlayRect(0, 0, curY, _screenWidth - 1, curY + 1); + curY += 4; + linesdone++; + } + } + + setAPen(0); + + for (uint16 i = 0; i < 2; i++) { + curY = i * 2; + + while (curY <= lastY) { + if (linesdone >= lineslast) { + _vm->_music->updateMusic(); + _vm->waitTOF(); + linesdone = 0; + } + + rectFill(0, curY, _screenWidth - 1, curY + 1); + curY += 4; + linesdone++; + } + } + + if (filename == NULL) + _vm->_curFileName = getPictName(cPtr); + else if (filename[0] > ' ') + _vm->_curFileName = filename; + else + _vm->_curFileName = getPictName(cPtr); + + byte *BitMapMem = readPictToMem(_vm->_curFileName, _screenWidth, lastY + 5); + setPalette(_vm->_anim->_diffPalette, 256); + + if (BitMapMem) { + imSource._width = _screenWidth; + imSource._height = lastY; + imSource._imageData = BitMapMem; + + imDest._width = _screenWidth; + imDest._height = _screenHeight; + imDest._imageData = getCurrentDrawingBuffer(); + + for (uint16 i = 0; i < 2; i++) { + curY = i * 2; + + while (curY < lastY) { + if (linesdone >= lineslast) { + _vm->_music->updateMusic(); + _vm->waitTOF(); + linesdone = 0; + } + + imDest._imageData = getCurrentDrawingBuffer(); + + imSource.blitBitmap(0, curY, &imDest, 0, curY, _screenWidth, 2, false); + overlayRect(0, 0, curY, _screenWidth - 1, curY + 1); + curY += 4; + linesdone++; + } + } + + for (uint16 i = 0; i < 2; i++) { + curY = i * 2; + + while (curY <= lastY) { + if (linesdone >= lineslast) { + _vm->_music->updateMusic(); + _vm->waitTOF(); + linesdone = 0; + } + + imDest._imageData = getCurrentDrawingBuffer(); + + if (curY == lastY) + imSource.blitBitmap(0, curY, &imDest, 0, curY, _screenWidth, 1, false); + else + imSource.blitBitmap(0, curY, &imDest, 0, curY, _screenWidth, 2, false); + + curY += 4; + linesdone++; + } + } + } +} + +/*****************************************************************************/ +/* Does a certain number of pre-programmed wipes. */ +/*****************************************************************************/ +void DisplayMan::doTransition(TransitionType transitionType, CloseDataPtr *cPtr, char *filename) { + switch (transitionType) { + case kTransitionWipe: + case kTransitionTransporter: + doTransWipe(cPtr, filename); + break; + case kTransitionScrollWipe: + doScrollWipe(filename); + break; + case kTransitionScrollBlack: + doScrollBlack(); + break; + case kTransitionScrollBounce: + doScrollBounce(); + break; + case kTransitionReadFirstFrame: + readPict(filename, false); + break; + case kTransitionReadNextFrame: + _vm->_anim->diffNextFrame(); + break; + case kTransitionNone: + default: + break; + } +} + +/*****************************************************************************/ +/* Changes the front screen to black. */ +/*****************************************************************************/ +void DisplayMan::blackScreen() { + byte pal[256 * 3]; + memset(pal, 0, 248 * 3); + writeColorRegs(pal, 8, 248); + + g_system->delayMillis(32); +} + +/*****************************************************************************/ +/* Changes the front screen to white. */ +/*****************************************************************************/ +void DisplayMan::whiteScreen() { + byte pal[256 * 3]; + memset(pal, 255, 248 * 3); + writeColorRegs(pal, 8, 248); +} + +/*****************************************************************************/ +/* Changes the entire screen to black. */ +/*****************************************************************************/ +void DisplayMan::blackAllScreen() { + byte pal[256 * 3]; + memset(pal, 0, 256 * 3); + writeColorRegs(pal, 0, 256); + + g_system->delayMillis(32); +} + +/*****************************************************************************/ +/* Scrolls the display in the x direction by blitting. */ +/* The _tempScrollData variable must be initialized to some memory, or this */ +/* function will fail. */ +/*****************************************************************************/ +void DisplayMan::scrollDisplayX(int16 dx, uint16 x1, uint16 y1, uint16 x2, uint16 y2) { + Image im; + uint16 temp; + + im._imageData = _tempScrollData; + + if (x1 > x2) { + temp = x2; + x2 = x1; + x1 = temp; + } + + if (y1 > y2) { + temp = y2; + y2 = y1; + y1 = temp; + } + + im._width = x2 - x1 + 1 - dx; + im._height = y2 - y1 + 1; + + im.readScreenImage(x1, y1); + im.drawImage(x1 + dx, y1); + + setAPen(0); + rectFill(x1, y1, x1 + dx - 1, y2); +} + +/*****************************************************************************/ +/* Scrolls the display in the y direction by blitting. */ +/*****************************************************************************/ +void DisplayMan::scrollDisplayY(int16 dy, uint16 x1, uint16 y1, uint16 x2, uint16 y2) { + Image im; + uint16 temp; + + im._imageData = _tempScrollData; + + if (x1 > x2) { + temp = x2; + x2 = x1; + x1 = temp; + } + + if (y1 > y2) { + temp = y2; + y2 = y1; + y1 = temp; + } + + im._width = x2 - x1 + 1; + im._height = y2 - y1 + 1 - dy; + + im.readScreenImage(x1, y1); + im.drawImage(x1, y1 + dy); + + setAPen(0); + rectFill(x1, y1, x2, y1 + dy - 1); +} + +/*****************************************************************************/ +/* Does the fading of the Palette on the screen. */ +/*****************************************************************************/ +uint16 DisplayMan::fadeNumIn(uint16 num, uint16 res, uint16 counter) { + return (num - ((((int32)(15 - counter)) * ((int32)(num - res))) / 15)); +} + + +uint16 DisplayMan::fadeNumOut(uint16 num, uint16 res, uint16 counter) { + return (num - ((((int32) counter) * ((int32)(num - res))) / 15)); +} + +void DisplayMan::fade(bool fadein, uint16 res) { + uint16 newpal[16]; + + for (uint16 i = 0; i < 16; i++) { + for (uint16 palIdx = 0; palIdx < 16; palIdx++) { + if (fadein) + newpal[palIdx] = (0x00F & fadeNumIn(0x00F & FadePalette[palIdx], 0x00F & res, i)) + + (0x0F0 & fadeNumIn(0x0F0 & FadePalette[palIdx], 0x0F0 & res, i)) + + (0xF00 & fadeNumIn(0xF00 & FadePalette[palIdx], 0xF00 & res, i)); + else + newpal[palIdx] = (0x00F & fadeNumOut(0x00F & FadePalette[palIdx], 0x00F & res, i)) + + (0x0F0 & fadeNumOut(0x0F0 & FadePalette[palIdx], 0x0F0 & res, i)) + + (0xF00 & fadeNumOut(0xF00 & FadePalette[palIdx], 0xF00 & res, i)); + } + + setAmigaPal(newpal, 16); + _vm->waitTOF(); + _vm->_music->updateMusic(); + } +} + +} // End of namespace Lab -- cgit v1.2.3 From dcefb696eddb21120648ea5f8f9514ca368f958d Mon Sep 17 00:00:00 2001 From: Strangerke Date: Mon, 7 Dec 2015 23:58:18 +0100 Subject: LAB: Remove more extern variables --- engines/lab/anim.cpp | 2 -- engines/lab/interface.cpp | 2 -- engines/lab/interface.h | 3 --- engines/lab/lab.h | 8 ++++++++ engines/lab/parsefun.h | 1 - engines/lab/parsetypes.h | 7 ------- engines/lab/processroom.cpp | 2 +- engines/lab/savegame.cpp | 4 +--- engines/lab/transitions.cpp | 4 ++-- 9 files changed, 12 insertions(+), 21 deletions(-) diff --git a/engines/lab/anim.cpp b/engines/lab/anim.cpp index 777a09ef3f..a9e7860e55 100644 --- a/engines/lab/anim.cpp +++ b/engines/lab/anim.cpp @@ -33,8 +33,6 @@ namespace Lab { -extern byte **startoffile; - Anim::Anim(LabEngine *vm) : _vm(vm) { _header = 0; _curBit = 0; diff --git a/engines/lab/interface.cpp b/engines/lab/interface.cpp index 6aba1510f7..09c3fc80f8 100644 --- a/engines/lab/interface.cpp +++ b/engines/lab/interface.cpp @@ -36,8 +36,6 @@ namespace Lab { -extern bool IsHiRes; - Common::KeyState _keyPressed; Gadget *createButton(uint16 x, uint16 y, uint16 id, uint16 key, Image *im, Image *imalt) { diff --git a/engines/lab/interface.h b/engines/lab/interface.h index a8d1140959..3e0460be1c 100644 --- a/engines/lab/interface.h +++ b/engines/lab/interface.h @@ -50,10 +50,7 @@ struct Gadget { Image *_image, *_altImage; }; -extern Common::KeyState _keyPressed; - /* Defines for the GadgetFlags portion */ - #define GADGETOFF 0x01 typedef Common::List GadgetList; diff --git a/engines/lab/lab.h b/engines/lab/lab.h index 44104fc1e6..af93367295 100644 --- a/engines/lab/lab.h +++ b/engines/lab/lab.h @@ -64,6 +64,13 @@ enum GameFeatures { typedef Common::List GadgetList; +struct CrumbData { + uint16 _roomNum; + uint16 _direction; +}; + +#define MAX_CRUMBS 128 + class LabEngine : public Engine { public: LabEngine(OSystem *syst, const ADGameDescription *gameDesc); @@ -170,6 +177,7 @@ public: int followCrumbs(); void changeVolume(int delta); + char *getPictName(CloseDataPtr *lcptr); private: // engine.cpp diff --git a/engines/lab/parsefun.h b/engines/lab/parsefun.h index c45727d907..78f7904e0b 100644 --- a/engines/lab/parsefun.h +++ b/engines/lab/parsefun.h @@ -43,7 +43,6 @@ bool parse(const char *inputFile); /* From ProcessRoom.c */ ViewData *getViewData(uint16 roomNum, uint16 direction); -char *getPictName(CloseDataPtr *lcptr); void drawDirection(CloseDataPtr lcptr); uint16 processArrow(uint16 curDirection, uint16 arrow); void setCurClose(Common::Point pos, CloseDataPtr *cptr, bool useAbsoluteCoords = false); diff --git a/engines/lab/parsetypes.h b/engines/lab/parsetypes.h index c7780ae09a..1f03bc3564 100644 --- a/engines/lab/parsetypes.h +++ b/engines/lab/parsetypes.h @@ -191,13 +191,6 @@ struct MapData { #pragma pack(pop) #endif -struct CrumbData { - uint16 _roomNum; - uint16 _direction; -}; - -#define MAX_CRUMBS 128 - } // End of namespace Lab #endif /* LAB_PARSETYPES_H */ diff --git a/engines/lab/processroom.cpp b/engines/lab/processroom.cpp index 7acf683247..8afa543cfe 100644 --- a/engines/lab/processroom.cpp +++ b/engines/lab/processroom.cpp @@ -143,7 +143,7 @@ static CloseDataPtr findCPtrMatch(CloseDataPtr cpmain, CloseDataPtr list) { /*****************************************************************************/ /* Returns the current picture name. */ /*****************************************************************************/ -char *getPictName(CloseDataPtr *lcptr) { +char *LabEngine::getPictName(CloseDataPtr *lcptr) { ViewData *viewPtr = getViewData(g_lab->_roomNum, g_lab->_direction); if (*lcptr != NULL) { diff --git a/engines/lab/savegame.cpp b/engines/lab/savegame.cpp index b28d1a2652..23e73c5bfb 100644 --- a/engines/lab/savegame.cpp +++ b/engines/lab/savegame.cpp @@ -43,8 +43,6 @@ namespace Lab { #define SAVEGAME_VERSION 1 /*----- The machine independent section of saveGame.c -----*/ -/* Lab: Labyrinth specific */ -extern char *getPictName(CloseDataPtr *lcptr); void writeSaveGameHeader(Common::OutSaveFile *out, const Common::String &saveName) { out->writeUint32BE(SAVEGAME_ID); @@ -129,7 +127,7 @@ bool saveGame(uint16 Direction, uint16 Quarters, int slot, Common::String desc) // Load scene pic CloseDataPtr cPtr = nullptr; - g_lab->_graphics->readPict(getPictName(&cPtr), true); + g_lab->_graphics->readPict(g_lab->getPictName(&cPtr), true); writeSaveGameHeader(file, desc); file->writeUint16LE(g_lab->_roomNum); diff --git a/engines/lab/transitions.cpp b/engines/lab/transitions.cpp index caf52dc287..11064c14ed 100644 --- a/engines/lab/transitions.cpp +++ b/engines/lab/transitions.cpp @@ -285,11 +285,11 @@ void DisplayMan::doTransWipe(CloseDataPtr *cPtr, char *filename) { } if (filename == NULL) - _vm->_curFileName = getPictName(cPtr); + _vm->_curFileName = _vm->getPictName(cPtr); else if (filename[0] > ' ') _vm->_curFileName = filename; else - _vm->_curFileName = getPictName(cPtr); + _vm->_curFileName = _vm->getPictName(cPtr); byte *BitMapMem = readPictToMem(_vm->_curFileName, _screenWidth, lastY + 5); setPalette(_vm->_anim->_diffPalette, 256); -- cgit v1.2.3 From fb86132314f7da2ea35d0f7c73b28102823a0049 Mon Sep 17 00:00:00 2001 From: Strangerke Date: Tue, 8 Dec 2015 00:16:17 +0100 Subject: LAB: Fix some coding style in tilepuzzle --- engines/lab/tilepuzzle.cpp | 32 ++++++++++++++++---------------- 1 file changed, 16 insertions(+), 16 deletions(-) diff --git a/engines/lab/tilepuzzle.cpp b/engines/lab/tilepuzzle.cpp index 3b7d5ceb61..cdc6735de3 100644 --- a/engines/lab/tilepuzzle.cpp +++ b/engines/lab/tilepuzzle.cpp @@ -86,33 +86,33 @@ void LabEngine::changeTile(uint16 col, uint16 row) { int16 scrolltype = -1; if (row > 0) { - if (_curTile[col] [row - 1] == 0) { - _curTile[col] [row - 1] = _curTile[col] [row]; - _curTile[col] [row] = 0; + if (_curTile[col][row - 1] == 0) { + _curTile[col][row - 1] = _curTile[col][row]; + _curTile[col][row] = 0; scrolltype = DOWNSCROLL; } } if (col > 0) { - if (_curTile[col - 1] [row] == 0) { - _curTile[col - 1] [row] = _curTile[col] [row]; - _curTile[col] [row] = 0; + if (_curTile[col - 1][row] == 0) { + _curTile[col - 1][row] = _curTile[col][row]; + _curTile[col][row] = 0; scrolltype = RIGHTSCROLL; } } if (row < 3) { - if (_curTile[col] [row + 1] == 0) { - _curTile[col] [row + 1] = _curTile[col] [row]; - _curTile[col] [row] = 0; + if (_curTile[col][row + 1] == 0) { + _curTile[col][row + 1] = _curTile[col][row]; + _curTile[col][row] = 0; scrolltype = UPSCROLL; } } if (col < 3) { - if (_curTile[col + 1] [row] == 0) { - _curTile[col + 1] [row] = _curTile[col] [row]; - _curTile[col] [row] = 0; + if (_curTile[col + 1][row] == 0) { + _curTile[col + 1][row] = _curTile[col][row]; + _curTile[col][row] = 0; scrolltype = LEFTSCROLL; } } @@ -132,7 +132,7 @@ void LabEngine::changeTile(uint16 col, uint16 row) { while (row < 4) { while (col < 4) { - check = check && (_curTile[row] [col] == SOLUTION[row] [col]); + check &= (_curTile[row][col] == SOLUTION[row][col]); col++; } @@ -204,9 +204,9 @@ void LabEngine::doTile(bool showsolution) { while (row < 4) { while (col < 4) { if (showsolution) - num = SOLUTION[col] [row]; + num = SOLUTION[col][row]; else - num = _curTile[col] [row]; + num = _curTile[col][row]; if (showsolution || num) _tiles[num]->drawImage(cols + (col * colm), rows + (row * rowm)); @@ -316,7 +316,7 @@ void LabEngine::changeCombination(uint16 number) { } for (uint16 i = 0; i < 6; i++) - unlocked = (_combination[i] == solution[i]) && unlocked; + unlocked &= (_combination[i] == solution[i]); if (unlocked) _conditions->inclElement(COMBINATIONUNLOCKED); -- cgit v1.2.3 From 2d21f51c34e3cdb8dd2aa4d0364600e4bf7e488a Mon Sep 17 00:00:00 2001 From: Filippos Karapetis Date: Tue, 8 Dec 2015 01:33:08 +0200 Subject: LAB: Some cleanup of the transition code --- engines/lab/transitions.cpp | 102 ++++++++++++++++---------------------------- 1 file changed, 37 insertions(+), 65 deletions(-) diff --git a/engines/lab/transitions.cpp b/engines/lab/transitions.cpp index 11064c14ed..80a24ddf2d 100644 --- a/engines/lab/transitions.cpp +++ b/engines/lab/transitions.cpp @@ -250,59 +250,48 @@ void DisplayMan::doTransWipe(CloseDataPtr *cPtr, char *filename) { lastY = 148; } - for (uint16 i = 0; i < 2; i++) { - curY = i * 2; - - while (curY < lastY) { - if (linesdone >= lineslast) { - _vm->_music->updateMusic(); - _vm->waitTOF(); - linesdone = 0; - } - - overlayRect(0, 0, curY, _screenWidth - 1, curY + 1); - curY += 4; - linesdone++; - } - } - - setAPen(0); + for (uint16 j = 0; j < 2; j++) { + for (uint16 i = 0; i < 2; i++) { + curY = i * 2; - for (uint16 i = 0; i < 2; i++) { - curY = i * 2; + while (curY < lastY) { + if (linesdone >= lineslast) { + _vm->_music->updateMusic(); + _vm->waitTOF(); + linesdone = 0; + } - while (curY <= lastY) { - if (linesdone >= lineslast) { - _vm->_music->updateMusic(); - _vm->waitTOF(); - linesdone = 0; - } + if (j == 9) + overlayRect(0, 0, curY, _screenWidth - 1, curY + 1); + else + rectFill(0, curY, _screenWidth - 1, curY + 1); + curY += 4; + linesdone++; + } // while + } // for i - rectFill(0, curY, _screenWidth - 1, curY + 1); - curY += 4; - linesdone++; - } - } + setAPen(0); + } // for j if (filename == NULL) - _vm->_curFileName = _vm->getPictName(cPtr); + _vm->_curFileName = g_lab->getPictName(cPtr); else if (filename[0] > ' ') _vm->_curFileName = filename; else - _vm->_curFileName = _vm->getPictName(cPtr); + _vm->_curFileName = g_lab->getPictName(cPtr); byte *BitMapMem = readPictToMem(_vm->_curFileName, _screenWidth, lastY + 5); setPalette(_vm->_anim->_diffPalette, 256); - if (BitMapMem) { - imSource._width = _screenWidth; - imSource._height = lastY; - imSource._imageData = BitMapMem; + imSource._width = _screenWidth; + imSource._height = lastY; + imSource._imageData = BitMapMem; - imDest._width = _screenWidth; - imDest._height = _screenHeight; - imDest._imageData = getCurrentDrawingBuffer(); + imDest._width = _screenWidth; + imDest._height = _screenHeight; + imDest._imageData = getCurrentDrawingBuffer(); + for (uint16 j = 0; j < 2; j++) { for (uint16 i = 0; i < 2; i++) { curY = i * 2; @@ -315,35 +304,18 @@ void DisplayMan::doTransWipe(CloseDataPtr *cPtr, char *filename) { imDest._imageData = getCurrentDrawingBuffer(); - imSource.blitBitmap(0, curY, &imDest, 0, curY, _screenWidth, 2, false); - overlayRect(0, 0, curY, _screenWidth - 1, curY + 1); - curY += 4; - linesdone++; - } - } - - for (uint16 i = 0; i < 2; i++) { - curY = i * 2; - - while (curY <= lastY) { - if (linesdone >= lineslast) { - _vm->_music->updateMusic(); - _vm->waitTOF(); - linesdone = 0; - } - - imDest._imageData = getCurrentDrawingBuffer(); - - if (curY == lastY) - imSource.blitBitmap(0, curY, &imDest, 0, curY, _screenWidth, 1, false); - else + if (j == 0) { imSource.blitBitmap(0, curY, &imDest, 0, curY, _screenWidth, 2, false); - + overlayRect(0, 0, curY, _screenWidth - 1, curY + 1); + } else { + uint16 bitmapHeight = (curY == lastY) ? 1 : 2; + imSource.blitBitmap(0, curY, &imDest, 0, curY, _screenWidth, bitmapHeight, false); + } curY += 4; linesdone++; - } - } - } + } // while + } // for i + } // for j } /*****************************************************************************/ -- cgit v1.2.3 From daf06557547066b1068f974ee37f69ecee975e7c Mon Sep 17 00:00:00 2001 From: Filippos Karapetis Date: Tue, 8 Dec 2015 01:33:59 +0200 Subject: LAB: Use SWAP<> to simplify the transition code --- engines/lab/transitions.cpp | 30 ++++++++---------------------- 1 file changed, 8 insertions(+), 22 deletions(-) diff --git a/engines/lab/transitions.cpp b/engines/lab/transitions.cpp index 80a24ddf2d..b7d8e8c6a1 100644 --- a/engines/lab/transitions.cpp +++ b/engines/lab/transitions.cpp @@ -386,21 +386,14 @@ void DisplayMan::blackAllScreen() { /*****************************************************************************/ void DisplayMan::scrollDisplayX(int16 dx, uint16 x1, uint16 y1, uint16 x2, uint16 y2) { Image im; - uint16 temp; im._imageData = _tempScrollData; - if (x1 > x2) { - temp = x2; - x2 = x1; - x1 = temp; - } + if (x1 > x2) + SWAP(x1, x2); - if (y1 > y2) { - temp = y2; - y2 = y1; - y1 = temp; - } + if (y1 > y2) + SWAP(y1, y2); im._width = x2 - x1 + 1 - dx; im._height = y2 - y1 + 1; @@ -417,21 +410,14 @@ void DisplayMan::scrollDisplayX(int16 dx, uint16 x1, uint16 y1, uint16 x2, uint1 /*****************************************************************************/ void DisplayMan::scrollDisplayY(int16 dy, uint16 x1, uint16 y1, uint16 x2, uint16 y2) { Image im; - uint16 temp; im._imageData = _tempScrollData; - if (x1 > x2) { - temp = x2; - x2 = x1; - x1 = temp; - } + if (x1 > x2) + SWAP(x1, x2); - if (y1 > y2) { - temp = y2; - y2 = y1; - y1 = temp; - } + if (y1 > y2) + SWAP(y1, y2); im._width = x2 - x1 + 1; im._height = y2 - y1 + 1 - dy; -- cgit v1.2.3 From 00d61638ac02f54de21664303af3a726bc921860 Mon Sep 17 00:00:00 2001 From: Filippos Karapetis Date: Tue, 8 Dec 2015 01:36:16 +0200 Subject: LAB: Merge parsetypes.h and parsefun.h into processroom.h --- engines/lab/detection.cpp | 1 - engines/lab/engine.cpp | 2 +- engines/lab/graphics.cpp | 3 +- engines/lab/graphics.h | 1 + engines/lab/lab.h | 1 + engines/lab/labfun.h | 3 - engines/lab/map.cpp | 3 +- engines/lab/parsefun.h | 58 ------------- engines/lab/parsetypes.h | 196 ----------------------------------------- engines/lab/processroom.cpp | 3 +- engines/lab/processroom.h | 206 ++++++++++++++++++++++++++++++++++++++++++++ engines/lab/special.cpp | 3 +- engines/lab/transitions.cpp | 2 +- 13 files changed, 214 insertions(+), 268 deletions(-) delete mode 100644 engines/lab/parsefun.h delete mode 100644 engines/lab/parsetypes.h create mode 100644 engines/lab/processroom.h diff --git a/engines/lab/detection.cpp b/engines/lab/detection.cpp index 3b01d77568..b61b4e4313 100644 --- a/engines/lab/detection.cpp +++ b/engines/lab/detection.cpp @@ -30,7 +30,6 @@ #include "engines/advancedDetector.h" -#include "common/system.h" #include "common/str-array.h" #include "common/savefile.h" diff --git a/engines/lab/engine.cpp b/engines/lab/engine.cpp index 07c49d5a05..d2e7a55cc6 100644 --- a/engines/lab/engine.cpp +++ b/engines/lab/engine.cpp @@ -33,7 +33,7 @@ #include "lab/anim.h" #include "lab/image.h" #include "lab/intro.h" -#include "lab/parsefun.h" +#include "lab/processroom.h" #include "lab/interface.h" #include "lab/resource.h" diff --git a/engines/lab/graphics.cpp b/engines/lab/graphics.cpp index 80eae97ab0..8da54cc90a 100644 --- a/engines/lab/graphics.cpp +++ b/engines/lab/graphics.cpp @@ -30,10 +30,9 @@ #include "lab/lab.h" #include "lab/anim.h" -#include "lab/parsetypes.h" #include "lab/image.h" #include "lab/labfun.h" -#include "lab/parsefun.h" +#include "lab/processroom.h" #include "lab/resource.h" #include "lab/graphics.h" diff --git a/engines/lab/graphics.h b/engines/lab/graphics.h index 1bfc0278e5..9c25295343 100644 --- a/engines/lab/graphics.h +++ b/engines/lab/graphics.h @@ -33,6 +33,7 @@ #include "graphics/palette.h" #include "lab/anim.h" +#include "lab/processroom.h" namespace Lab { diff --git a/engines/lab/lab.h b/engines/lab/lab.h index af93367295..fb2d20d5a4 100644 --- a/engines/lab/lab.h +++ b/engines/lab/lab.h @@ -33,6 +33,7 @@ #include "common/array.h" #include "common/events.h" +#include "common/system.h" #include "engines/engine.h" #include "lab/labfun.h" diff --git a/engines/lab/labfun.h b/engines/lab/labfun.h index e67d0f786a..e0a3b089c6 100644 --- a/engines/lab/labfun.h +++ b/engines/lab/labfun.h @@ -32,11 +32,8 @@ #define LAB_LABFUN_H #include "common/events.h" -#include "lab/parsetypes.h" - #include "common/file.h" #include "common/savefile.h" - #include "engines/savestate.h" namespace Lab { diff --git a/engines/lab/map.cpp b/engines/lab/map.cpp index 4136b28bab..8c71d1a6a6 100644 --- a/engines/lab/map.cpp +++ b/engines/lab/map.cpp @@ -32,8 +32,7 @@ #include "lab/labfun.h" #include "lab/anim.h" #include "lab/image.h" -#include "lab/parsefun.h" -#include "lab/parsetypes.h" +#include "lab/processroom.h" #include "lab/resource.h" #include "lab/interface.h" diff --git a/engines/lab/parsefun.h b/engines/lab/parsefun.h deleted file mode 100644 index 78f7904e0b..0000000000 --- a/engines/lab/parsefun.h +++ /dev/null @@ -1,58 +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. - * - */ - -/* - * This code is based on Labyrinth of Time code with assistance of - * - * Copyright (c) 1993 Terra Nova Development - * Copyright (c) 2004 The Wyrmkeep Entertainment Co. - * - */ - -#ifndef LAB_PARSEFUN_H -#define LAB_PARSEFUN_H - -#include "lab/labfun.h" -#include "lab/parsetypes.h" - -namespace Lab { - -/* From Parser.c */ - -bool parse(const char *inputFile); - -/* From ProcessRoom.c */ - -ViewData *getViewData(uint16 roomNum, uint16 direction); -void drawDirection(CloseDataPtr lcptr); -uint16 processArrow(uint16 curDirection, uint16 arrow); -void setCurClose(Common::Point pos, CloseDataPtr *cptr, bool useAbsoluteCoords = false); -bool takeItem(uint16 x, uint16 y, CloseDataPtr *cptr); -bool doActionRule(Common::Point pos, int16 action, int16 roomNum, CloseDataPtr *lcptr); -bool doOperateRule(int16 x, int16 y, int16 itemNum, CloseDataPtr *lcptr); -bool doGoForward(CloseDataPtr *lcptr); -bool doTurn(uint16 from, uint16 to, CloseDataPtr *lcptr); -bool doMainView(CloseDataPtr *lcptr); - -} // End of namespace Lab - -#endif /* LAB_PARSEFUN_H */ diff --git a/engines/lab/parsetypes.h b/engines/lab/parsetypes.h deleted file mode 100644 index 1f03bc3564..0000000000 --- a/engines/lab/parsetypes.h +++ /dev/null @@ -1,196 +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. - * - */ - -/* - * This code is based on Labyrinth of Time code with assistance of - * - * Copyright (c) 1993 Terra Nova Development - * Copyright (c) 2004 The Wyrmkeep Entertainment Co. - * - */ - -#ifndef LAB_PARSETYPES_H -#define LAB_PARSETYPES_H - -#include "common/system.h" - -namespace Lab { - -/*------------------------------- Action types ------------------------------*/ -#define PLAYSOUND 1 -#define PLAYSOUNDCONT 2 -#define SHOWDIFF 3 -#define SHOWDIFFCONT 4 -#define LOADDIFF 5 -#define LOADBM 6 -#define SHOWBM 7 -#define TRANSITION 8 -#define NOUPDATE 9 -#define FORCEUPDATE 10 -#define SHOWCURPICT 11 -#define SETELEMENT 12 -#define UNSETELEMENT 13 -#define SHOWMESSAGE 14 -#define SHOWMESSAGES 15 -#define SETPOSITION 16 -#define SETCLOSEUP 17 -#define MAINVIEW 18 -#define SUBINV 19 -#define ADDINV 20 -#define SHOWDIR 21 -#define WAITSECS 22 -#define STOPMUSIC 23 -#define STARTMUSIC 24 -#define CHANGEMUSIC 25 -#define RESETMUSIC 26 -#define FILLMUSIC 27 -#define WAITSOUND 28 -#define CLEARSOUND 29 -#define WINMUSIC 30 -#define WINGAME 31 -#define LOSTGAME 32 -#define RESETBUFFER 33 -#define SPECIALCMD 34 -#define CSHOWMESSAGE 35 -#define PLAYSOUNDB 36 - -/* Rule Types */ -#define ACTION 1 -#define OPERATE 2 -#define GOFORWARD 3 -#define CONDITIONS 4 -#define TURN 5 -#define GOMAINVIEW 6 -#define TURNFROMTO 7 - -/*----------------------------- Rule Type Action ----------------------------*/ -#define TAKE 1 -#define MOVE 2 -#define OPENDOOR 3 -#define CLOSEDOOR 4 -#define TAKEDEF 5 - -#if defined(WIN32) -#pragma pack(push, 1) -#endif - -typedef struct CloseData { - uint16 x1, y1, x2, y2; - int16 _closeUpType; /* if > 0, an object. If < 0, an item */ - uint16 _depth; /* Level of the closeup. */ - char *_graphicName; - char *_message; - CloseData *_nextCloseUp; - CloseData *_subCloseUps; -} CloseData; - -typedef CloseData *CloseDataPtr; - -struct ViewData { - int16 *_condition; - char *_graphicName; - struct ViewData *_nextCondition; - CloseDataPtr _closeUps; -}; - -struct Action { - int16 _actionType; - int16 _param1; - int16 _param2; - int16 _param3; - byte *_data; /* Message, or a pointer to array of messages. */ - Action *_nextAction; -}; - -struct Rule { - int16 _ruleType; - int16 _param1; - int16 _param2; - int16 *_condition; - Action *_actionList; - Rule *_nextRule; -}; - -typedef Common::List RuleList; - -struct RoomData { - uint16 _northDoor; - uint16 _southDoor; - uint16 _eastDoor; - uint16 _westDoor; - byte _transitionType; - ViewData *_view[4]; - RuleList *_rules; - char *_roomMsg; -}; - -struct InventoryData { - uint16 _many; - char *_name; - char *_bitmapName; -}; - -/* Map Flags */ - -/* Where the doors are; in a corridor, assumed to be left doors */ -#define NORTHDOOR 1L -#define EASTDOOR 2L -#define SOUTHDOOR 4L -#define WESTDOOR 8L - -/* Where the doors are in corridors; M means middle, R means right, B means bottom */ -#define NORTHMDOOR 16L -#define NORTHRDOOR 32L -#define SOUTHMDOOR 64L -#define SOUTHRDOOR 128L - -#define EASTMDOOR 16L -#define EASTBDOOR 32L -#define WESTMDOOR 64L -#define WESTBDOOR 128L - -/* Special Map ID's */ -#define NORMAL 0 -#define UPARROWROOM 1 -#define DOWNARROWROOM 2 -#define BRIDGEROOM 3 -#define VCORRIDOR 4 -#define HCORRIDOR 5 -#define MEDMAZE 6 -#define HEDGEMAZE 7 -#define SURMAZE 8 -#define MULTIMAZEF1 9 -#define MULTIMAZEF2 10 -#define MULTIMAZEF3 11 - -struct MapData { - uint16 x, y, PageNumber, SpecialID; - uint32 MapFlags; -}; - -#if defined(WIN32) -#pragma pack(pop) -#endif - -} // End of namespace Lab - -#endif /* LAB_PARSETYPES_H */ diff --git a/engines/lab/processroom.cpp b/engines/lab/processroom.cpp index 8afa543cfe..fa270ded61 100644 --- a/engines/lab/processroom.cpp +++ b/engines/lab/processroom.cpp @@ -32,8 +32,7 @@ #include "lab/lab.h" #include "lab/labfun.h" -#include "lab/parsetypes.h" -#include "lab/parsefun.h" +#include "lab/processroom.h" #include "lab/resource.h" #include "lab/anim.h" #include "lab/interface.h" diff --git a/engines/lab/processroom.h b/engines/lab/processroom.h new file mode 100644 index 0000000000..d69dae1f55 --- /dev/null +++ b/engines/lab/processroom.h @@ -0,0 +1,206 @@ +/* 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. + * + */ + +/* + * This code is based on Labyrinth of Time code with assistance of + * + * Copyright (c) 1993 Terra Nova Development + * Copyright (c) 2004 The Wyrmkeep Entertainment Co. + * + */ + +#ifndef LAB_PROCESSROOM_H +#define LAB_PROCESSROOM_H + +namespace Lab { + + /*------------------------------- Action types ------------------------------*/ +#define PLAYSOUND 1 +#define PLAYSOUNDCONT 2 +#define SHOWDIFF 3 +#define SHOWDIFFCONT 4 +#define LOADDIFF 5 +#define LOADBM 6 +#define SHOWBM 7 +#define TRANSITION 8 +#define NOUPDATE 9 +#define FORCEUPDATE 10 +#define SHOWCURPICT 11 +#define SETELEMENT 12 +#define UNSETELEMENT 13 +#define SHOWMESSAGE 14 +#define SHOWMESSAGES 15 +#define SETPOSITION 16 +#define SETCLOSEUP 17 +#define MAINVIEW 18 +#define SUBINV 19 +#define ADDINV 20 +#define SHOWDIR 21 +#define WAITSECS 22 +#define STOPMUSIC 23 +#define STARTMUSIC 24 +#define CHANGEMUSIC 25 +#define RESETMUSIC 26 +#define FILLMUSIC 27 +#define WAITSOUND 28 +#define CLEARSOUND 29 +#define WINMUSIC 30 +#define WINGAME 31 +#define LOSTGAME 32 +#define RESETBUFFER 33 +#define SPECIALCMD 34 +#define CSHOWMESSAGE 35 +#define PLAYSOUNDB 36 + + /* Rule Types */ +#define ACTION 1 +#define OPERATE 2 +#define GOFORWARD 3 +#define CONDITIONS 4 +#define TURN 5 +#define GOMAINVIEW 6 +#define TURNFROMTO 7 + + /*----------------------------- Rule Type Action ----------------------------*/ +#define TAKE 1 +#define MOVE 2 +#define OPENDOOR 3 +#define CLOSEDOOR 4 +#define TAKEDEF 5 + +#if defined(WIN32) +#pragma pack(push, 1) +#endif + +typedef struct CloseData { + uint16 x1, y1, x2, y2; + int16 _closeUpType; /* if > 0, an object. If < 0, an item */ + uint16 _depth; /* Level of the closeup. */ + char *_graphicName; + char *_message; + CloseData *_nextCloseUp; + CloseData *_subCloseUps; +} CloseData; + +typedef CloseData *CloseDataPtr; + +struct ViewData { + int16 *_condition; + char *_graphicName; + struct ViewData *_nextCondition; + CloseDataPtr _closeUps; +}; + +struct Action { + int16 _actionType; + int16 _param1; + int16 _param2; + int16 _param3; + byte *_data; /* Message, or a pointer to array of messages. */ + Action *_nextAction; +}; + +struct Rule { + int16 _ruleType; + int16 _param1; + int16 _param2; + int16 *_condition; + Action *_actionList; + Rule *_nextRule; +}; + +typedef Common::List RuleList; + +struct RoomData { + uint16 _northDoor; + uint16 _southDoor; + uint16 _eastDoor; + uint16 _westDoor; + byte _transitionType; + ViewData *_view[4]; + RuleList *_rules; + char *_roomMsg; +}; + +struct InventoryData { + uint16 _many; + char *_name; + char *_bitmapName; +}; + +/* Map Flags */ + +/* Where the doors are; in a corridor, assumed to be left doors */ +#define NORTHDOOR 1L +#define EASTDOOR 2L +#define SOUTHDOOR 4L +#define WESTDOOR 8L + +/* Where the doors are in corridors; M means middle, R means right, B means bottom */ +#define NORTHMDOOR 16L +#define NORTHRDOOR 32L +#define SOUTHMDOOR 64L +#define SOUTHRDOOR 128L + +#define EASTMDOOR 16L +#define EASTBDOOR 32L +#define WESTMDOOR 64L +#define WESTBDOOR 128L + +/* Special Map ID's */ +#define NORMAL 0 +#define UPARROWROOM 1 +#define DOWNARROWROOM 2 +#define BRIDGEROOM 3 +#define VCORRIDOR 4 +#define HCORRIDOR 5 +#define MEDMAZE 6 +#define HEDGEMAZE 7 +#define SURMAZE 8 +#define MULTIMAZEF1 9 +#define MULTIMAZEF2 10 +#define MULTIMAZEF3 11 + +struct MapData { + uint16 x, y, PageNumber, SpecialID; + uint32 MapFlags; +}; + +#if defined(WIN32) +#pragma pack(pop) +#endif + +bool parse(const char *inputFile); +ViewData *getViewData(uint16 roomNum, uint16 direction); +void drawDirection(CloseDataPtr lcptr); +uint16 processArrow(uint16 curDirection, uint16 arrow); +void setCurClose(Common::Point pos, CloseDataPtr *cptr, bool useAbsoluteCoords = false); +bool takeItem(uint16 x, uint16 y, CloseDataPtr *cptr); +bool doActionRule(Common::Point pos, int16 action, int16 roomNum, CloseDataPtr *lcptr); +bool doOperateRule(int16 x, int16 y, int16 itemNum, CloseDataPtr *lcptr); +bool doGoForward(CloseDataPtr *lcptr); +bool doTurn(uint16 from, uint16 to, CloseDataPtr *lcptr); +bool doMainView(CloseDataPtr *lcptr); + +} // End of namespace Lab + +#endif /* LAB_PROCESSROOM_H */ diff --git a/engines/lab/special.cpp b/engines/lab/special.cpp index 41fcad7a86..469d8ab9d8 100644 --- a/engines/lab/special.cpp +++ b/engines/lab/special.cpp @@ -36,10 +36,9 @@ #include "lab/lab.h" #include "lab/labfun.h" #include "lab/image.h" -#include "lab/parsefun.h" +#include "lab/processroom.h" #include "lab/interface.h" #include "lab/anim.h" -#include "lab/parsetypes.h" #include "lab/resource.h" namespace Lab { diff --git a/engines/lab/transitions.cpp b/engines/lab/transitions.cpp index b7d8e8c6a1..c8a497cab0 100644 --- a/engines/lab/transitions.cpp +++ b/engines/lab/transitions.cpp @@ -29,7 +29,7 @@ */ #include "lab/lab.h" -#include "lab/parsefun.h" +#include "lab/processroom.h" #include "lab/graphics.h" namespace Lab { -- cgit v1.2.3 From 73eb0d2f284809d6bec2336d0647e9905368c3cd Mon Sep 17 00:00:00 2001 From: Filippos Karapetis Date: Tue, 8 Dec 2015 01:47:47 +0200 Subject: LAB: Revert incorrect change --- engines/lab/transitions.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/engines/lab/transitions.cpp b/engines/lab/transitions.cpp index c8a497cab0..7090181d32 100644 --- a/engines/lab/transitions.cpp +++ b/engines/lab/transitions.cpp @@ -274,11 +274,11 @@ void DisplayMan::doTransWipe(CloseDataPtr *cPtr, char *filename) { } // for j if (filename == NULL) - _vm->_curFileName = g_lab->getPictName(cPtr); + _vm->_curFileName = _vm->getPictName(cPtr); else if (filename[0] > ' ') _vm->_curFileName = filename; else - _vm->_curFileName = g_lab->getPictName(cPtr); + _vm->_curFileName = _vm->getPictName(cPtr); byte *BitMapMem = readPictToMem(_vm->_curFileName, _screenWidth, lastY + 5); setPalette(_vm->_anim->_diffPalette, 256); -- cgit v1.2.3 From 6b9264d9da41d8be08ea46076026901374d3d106 Mon Sep 17 00:00:00 2001 From: Strangerke Date: Tue, 8 Dec 2015 08:42:08 +0100 Subject: LAB: Refactoring the vgaUnscale code and the way it's used --- engines/lab/tilepuzzle.cpp | 54 +++++++++++++++++++++------------------------- engines/lab/utils.cpp | 29 +++++++++++-------------- engines/lab/utils.h | 3 +-- 3 files changed, 38 insertions(+), 48 deletions(-) diff --git a/engines/lab/tilepuzzle.cpp b/engines/lab/tilepuzzle.cpp index cdc6735de3..2739473d47 100644 --- a/engines/lab/tilepuzzle.cpp +++ b/engines/lab/tilepuzzle.cpp @@ -66,17 +66,16 @@ void LabEngine::initTilePuzzle() { /* Processes mouse clicks and changes the combination. */ /*****************************************************************************/ void LabEngine::mouseTile(Common::Point pos) { - int x = _utils->vgaUnscaleX(pos.x); - int y = _utils->vgaUnscaleY(pos.y); + Common::Point realPos = _utils->vgaUnscale(pos); - if ((x < 101) || (y < 26)) + if ((realPos.x < 101) || (realPos.y < 26)) return; - x = (x - 101) / 30; - y = (y - 26) / 25; + int tileX = (realPos.x - 101) / 30; + int tileY = (realPos.y - 26) / 25; - if ((x < 4) && (y < 4)) - changeTile(x, y); + if ((tileX < 4) && (tileY < 4)) + changeTile(tileX, tileY); } /*****************************************************************************/ @@ -152,29 +151,26 @@ void LabEngine::changeTile(uint16 col, uint16 row) { /* Processes mouse clicks and changes the combination. */ /*****************************************************************************/ void LabEngine::mouseCombination(Common::Point pos) { - uint16 number; - - int x = _utils->vgaUnscaleX(pos.x); - int y = _utils->vgaUnscaleY(pos.y); - - if ((y >= 63) && (y <= 99)) { - if ((x >= 44) && (x < 83)) - number = 0; - else if (x < 127) - number = 1; - else if (x < 165) - number = 2; - else if (x < 210) - number = 3; - else if (x < 245) - number = 4; - else if (x < 286) - number = 5; - else - return; + Common::Point realPos = _utils->vgaUnscale(pos); - changeCombination(number); - } + if (!Common::Rect(44, 63, 285, 99).contains(realPos)) + return; + + uint16 number = 0; + if (realPos.x < 83) + number = 0; + else if (realPos.x < 127) + number = 1; + else if (realPos.x < 165) + number = 2; + else if (realPos.x < 210) + number = 3; + else if (realPos.x < 245) + number = 4; + else if (realPos.x < 286) + number = 5; + + changeCombination(number); } /*****************************************************************************/ diff --git a/engines/lab/utils.cpp b/engines/lab/utils.cpp index 6d4784d0ac..041a970eff 100644 --- a/engines/lab/utils.cpp +++ b/engines/lab/utils.cpp @@ -59,7 +59,7 @@ uint16 Utils::scaleY(uint16 y) { } /*****************************************************************************/ -/* Scales the VGA cords to SVGA if necessary; otherwise, returns VGA cords. */ +/* Scales the VGA coords to SVGA if necessary; otherwise, returns VGA coords.*/ /*****************************************************************************/ int16 Utils::vgaScaleX(int16 x) { if (_vm->_isHiRes) @@ -69,7 +69,7 @@ int16 Utils::vgaScaleX(int16 x) { } /*****************************************************************************/ -/* Scales the VGA cords to SVGA if necessary; otherwise, returns VGA cords. */ +/* Scales the VGA coords to SVGA if necessary; otherwise, returns VGA coords.*/ /*****************************************************************************/ int16 Utils::vgaScaleY(int16 y) { if (_vm->_isHiRes) @@ -86,23 +86,18 @@ uint16 Utils::svgaCord(uint16 cord) { } /*****************************************************************************/ -/* Converts SVGA cords to VGA if necessary, otherwise returns VGA cords. */ +/* Converts SVGA coords to VGA if necessary, otherwise returns VGA coords. */ /*****************************************************************************/ -int Utils::vgaUnscaleX(int x) { - if (_vm->_isHiRes) - return (x / 2); - else - return x; -} +Common::Point Utils::vgaUnscale(Common::Point pos) { + Common::Point result; + if (_vm->_isHiRes) { + result.x = pos.x / 2; + result.y = (pos.y * 5) / 12; + } else { + result = pos; + } -/*****************************************************************************/ -/* Converts SVGA cords to VGA if necessary, otherwise returns VGA cords. */ -/*****************************************************************************/ -int Utils::vgaUnscaleY(int y) { - if (_vm->_isHiRes) - return ((y * 5) / 12); - else - return y; + return result; } /*****************************************************************************/ diff --git a/engines/lab/utils.h b/engines/lab/utils.h index 4fa168dd54..441473672c 100644 --- a/engines/lab/utils.h +++ b/engines/lab/utils.h @@ -52,8 +52,7 @@ public: int16 vgaScaleX(int16 x); int16 vgaScaleY(int16 y); uint16 svgaCord(uint16 cord); - int vgaUnscaleX(int x); - int vgaUnscaleY(int y); + Common::Point vgaUnscale(Common::Point pos); void unDiff(byte *newBuf, byte *oldBuf, byte *diffData, uint16 bytesperrow, bool isV); void runLengthDecode(byte *dest, byte *source); void VRunLengthDecode(byte *dest, byte *source, uint16 bytesPerRow); -- cgit v1.2.3 From 9cc70b6f03ecaafdf8696a03e74dce11942cb07e Mon Sep 17 00:00:00 2001 From: Strangerke Date: Tue, 8 Dec 2015 08:53:35 +0100 Subject: LAB: Some more refactoring and renaming --- engines/lab/interface.cpp | 42 ++++++++++++++---------------------------- engines/lab/tilepuzzle.cpp | 6 +++--- 2 files changed, 17 insertions(+), 31 deletions(-) diff --git a/engines/lab/interface.cpp b/engines/lab/interface.cpp index 09c3fc80f8..7f6776a054 100644 --- a/engines/lab/interface.cpp +++ b/engines/lab/interface.cpp @@ -39,12 +39,10 @@ namespace Lab { Common::KeyState _keyPressed; Gadget *createButton(uint16 x, uint16 y, uint16 id, uint16 key, Image *im, Image *imalt) { - Gadget *gptr; + Gadget *gptr = new Gadget(); - x = g_lab->_utils->vgaScaleX(x); - - if ((gptr = new Gadget())) { - gptr->x = x; + if (gptr) { + gptr->x = g_lab->_utils->vgaScaleX(x); gptr->y = y; gptr->_gadgetID = id; gptr->_keyEquiv = key; @@ -53,12 +51,9 @@ Gadget *createButton(uint16 x, uint16 y, uint16 id, uint16 key, Image *im, Image return gptr; } else - return NULL; + return nullptr; } - - - void freeButtonList(GadgetList *gadgetList) { for (GadgetList::iterator gadget = gadgetList->begin(); gadget != gadgetList->end(); ++gadget) { delete *gadget; @@ -67,9 +62,6 @@ void freeButtonList(GadgetList *gadgetList) { gadgetList->clear(); } - - - /*****************************************************************************/ /* Draws a gadget list to the screen. */ /*****************************************************************************/ @@ -82,7 +74,6 @@ void drawGadgetList(GadgetList *gadgetList) { } } - /*****************************************************************************/ /* Dims a gadget, and makes it unavailable for using. */ /*****************************************************************************/ @@ -91,8 +82,6 @@ void disableGadget(Gadget *curgad, uint16 pencolor) { curgad->_flags |= GADGETOFF; } - - /*****************************************************************************/ /* Undims a gadget, and makes it available again. */ /*****************************************************************************/ @@ -101,7 +90,6 @@ void enableGadget(Gadget *curgad) { curgad->_flags &= !(GADGETOFF); } - /*****************************************************************************/ /* Make a key press have the right case for a gadget KeyEquiv value. */ /*****************************************************************************/ @@ -113,14 +101,14 @@ uint16 makeGadgetKeyEquiv(uint16 key) { } /*****************************************************************************/ -/* Checks whether or not the cords fall within one of the gadgets in a list */ +/* Checks whether or not the coords fall within one of the gadgets in a list */ /* of gadgets. */ /*****************************************************************************/ Gadget *LabEngine::checkNumGadgetHit(GadgetList *gadgetList, uint16 key) { uint16 gkey = key - '0'; if (!gadgetList) - return NULL; + return nullptr; for (GadgetList::iterator gadgetItr = gadgetList->begin(); gadgetItr != gadgetList->end(); ++gadgetItr) { Gadget *gadget = *gadgetItr; @@ -145,26 +133,24 @@ Gadget *LabEngine::checkNumGadgetHit(GadgetList *gadgetList, uint16 key) { IntuiMessage IMessage; IntuiMessage *LabEngine::getMsg() { - Gadget *curgad; - int Qualifiers; - _event->updateMouse(); - Qualifiers = _keyPressed.flags; + int qualifiers = _keyPressed.flags; + Gadget *curgad = _event->mouseGadget(); - if ((curgad = _event->mouseGadget()) != NULL) { + if (curgad) { _event->updateMouse(); IMessage._msgClass = GADGETUP; IMessage._code = curgad->_gadgetID; IMessage._gadgetID = curgad->_gadgetID; - IMessage._qualifier = Qualifiers; + IMessage._qualifier = qualifiers; return &IMessage; } else if (_event->mouseButton(&IMessage._mouseX, &IMessage._mouseY, true)) { /* Left Button */ - IMessage._qualifier = IEQUALIFIER_LEFTBUTTON | Qualifiers; + IMessage._qualifier = IEQUALIFIER_LEFTBUTTON | qualifiers; IMessage._msgClass = MOUSEBUTTONS; return &IMessage; } else if (_event->mouseButton(&IMessage._mouseX, &IMessage._mouseY, false)) { /* Right Button */ - IMessage._qualifier = IEQUALIFIER_RBUTTON | Qualifiers; + IMessage._qualifier = IEQUALIFIER_RBUTTON | qualifiers; IMessage._msgClass = MOUSEBUTTONS; return &IMessage; } else if (_event->keyPress(&IMessage._code)) { /* Keyboard key */ @@ -177,10 +163,10 @@ IntuiMessage *LabEngine::getMsg() { } else IMessage._msgClass = RAWKEY; - IMessage._qualifier = Qualifiers; + IMessage._qualifier = qualifiers; return &IMessage; } else - return NULL; + return nullptr; } } // End of namespace Lab diff --git a/engines/lab/tilepuzzle.cpp b/engines/lab/tilepuzzle.cpp index 2739473d47..4d95d4c4b5 100644 --- a/engines/lab/tilepuzzle.cpp +++ b/engines/lab/tilepuzzle.cpp @@ -243,7 +243,7 @@ void LabEngine::showTile(const char *filename, bool showsolution) { /*****************************************************************************/ void LabEngine::doTileScroll(uint16 col, uint16 row, uint16 scrolltype) { int16 dX = 0, dY = 0, dx = 0, dy = 0, sx = 0, sy = 0; - uint16 last = 0, x1, y1; + uint16 last = 0; if (scrolltype == LEFTSCROLL) { dX = _utils->vgaScaleX(5); @@ -267,8 +267,8 @@ void LabEngine::doTileScroll(uint16 col, uint16 row, uint16 scrolltype) { sx += _utils->svgaCord(2); - x1 = _utils->vgaScaleX(100) + (col * _utils->vgaScaleX(30)) + dx; - y1 = _utils->vgaScaleY(25) + (row * _utils->vgaScaleY(25)) + dy; + uint16 x1 = _utils->vgaScaleX(100) + (col * _utils->vgaScaleX(30)) + dx; + uint16 y1 = _utils->vgaScaleY(25) + (row * _utils->vgaScaleY(25)) + dy; for (uint16 i = 0; i < last; i++) { waitTOF(); -- cgit v1.2.3 From 3a1ee647610efa61a053d7f2fc0951e6248cb915 Mon Sep 17 00:00:00 2001 From: Strangerke Date: Tue, 8 Dec 2015 09:19:00 +0100 Subject: LAB: Review spacing --- engines/lab/anim.cpp | 11 ++++----- engines/lab/detection.cpp | 57 +++++++++++++++++++++---------------------- engines/lab/engine.cpp | 29 +++++++++------------- engines/lab/eventman.cpp | 36 +++++++++++++-------------- engines/lab/graphics.cpp | 47 +++++++++++++++++++----------------- engines/lab/image.h | 13 +++++----- engines/lab/interface.cpp | 4 +-- engines/lab/intro.cpp | 13 +++++----- engines/lab/lab.h | 3 +-- engines/lab/labsets.h | 16 ++++++------ engines/lab/map.cpp | 59 +++++++++++++++------------------------------ engines/lab/processroom.cpp | 24 +++++++++--------- engines/lab/savegame.cpp | 2 -- engines/lab/special.cpp | 23 +++++++++--------- engines/lab/timing.cpp | 10 ++++---- 15 files changed, 157 insertions(+), 190 deletions(-) diff --git a/engines/lab/anim.cpp b/engines/lab/anim.cpp index a9e7860e55..d8b3b2feb3 100644 --- a/engines/lab/anim.cpp +++ b/engines/lab/anim.cpp @@ -247,17 +247,16 @@ void Anim::diffNextFrame() { /* A separate task launched by readDiff. Plays the DIFF. */ /*****************************************************************************/ void Anim::playDiff(byte *buffer) { - _waitSec = 0L; + _waitSec = 0L; _waitMicros = 0L; _delayMicros = 0L; - _header = 0; + _header = 0; _curBit = 0; _frameNum = 0; - _numChunks = 1; - _donePal = false; + _numChunks = 1; + _donePal = false; _stopPlayingEnd = false; - - _isPlaying = true; + _isPlaying = true; if (_doBlack) { _doBlack = false; diff --git a/engines/lab/detection.cpp b/engines/lab/detection.cpp index b61b4e4313..67890da1ea 100644 --- a/engines/lab/detection.cpp +++ b/engines/lab/detection.cpp @@ -102,14 +102,14 @@ static const ADGameDescription labDescriptions[] = { }; static const char *const directoryGlobs[] = { - "fonts", + "fonts", "game", "pict", "spict", "rooms", "h2", "intro", - 0 + 0 }; namespace Lab { @@ -167,10 +167,9 @@ bool LabMetaEngine::hasFeature(MetaEngineFeature f) const { } bool Lab::LabEngine::hasFeature(EngineFeature f) const { - return - (f == kSupportsRTL); - //(f == kSupportsLoadingDuringRuntime) || - //(f == kSupportsSavingDuringRuntime); + return (f == kSupportsRTL); + //(f == kSupportsLoadingDuringRuntime) || + //(f == kSupportsSavingDuringRuntime); } SaveStateList LabMetaEngine::listSaves(const char *target) const { @@ -186,17 +185,17 @@ SaveStateList LabMetaEngine::listSaves(const char *target) const { SaveStateList saveList; for (Common::StringArray::const_iterator file = filenames.begin(); file != filenames.end(); ++file) { - // Obtain the last 3 digits of the filename, since they correspond to the save slot - int slotNum = atoi(file->c_str() + file->size() - 3); + // Obtain the last 3 digits of the filename, since they correspond to the save slot + int slotNum = atoi(file->c_str() + file->size() - 3); - if (slotNum >= 0 && slotNum <= 999) { - Common::InSaveFile *in = saveFileMan->openForLoading(file->c_str()); - if (in) { + if (slotNum >= 0 && slotNum <= 999) { + Common::InSaveFile *in = saveFileMan->openForLoading(file->c_str()); + if (in) { if (Lab::readSaveGameHeader(in, header)) - saveList.push_back(SaveStateDescriptor(slotNum, header._descr.getDescription())); - delete in; - } - } + saveList.push_back(SaveStateDescriptor(slotNum, header._descr.getDescription())); + delete in; + } + } } return saveList; @@ -219,14 +218,14 @@ void LabMetaEngine::removeSaveState(const char *target, int slot) const { Common::sort(filenames.begin(), filenames.end()); // Sort (hopefully ensuring we are sorted numerically..) for (Common::StringArray::const_iterator file = filenames.begin(); file != filenames.end(); ++file) { - // Obtain the last 3 digits of the filename, since they correspond to the save slot - int slotNum = atoi(file->c_str() + file->size() - 3); - - // Rename every slot greater than the deleted slot, - if (slotNum > slot) { - saveFileMan->renameSavefile(file->c_str(), filename.c_str()); - filename = Common::String::format("%s.%03u", target, ++slot); - } + // Obtain the last 3 digits of the filename, since they correspond to the save slot + int slotNum = atoi(file->c_str() + file->size() - 3); + + // Rename every slot greater than the deleted slot, + if (slotNum > slot) { + saveFileMan->renameSavefile(file->c_str(), filename.c_str()); + filename = Common::String::format("%s.%03u", target, ++slot); + } } } @@ -235,20 +234,20 @@ SaveStateDescriptor LabMetaEngine::querySaveMetaInfos(const char *target, int sl Common::InSaveFile *in = g_system->getSavefileManager()->openForLoading(filename.c_str()); if (in) { - Lab::SaveGameHeader header; + Lab::SaveGameHeader header; bool successfulRead = Lab::readSaveGameHeader(in, header); - delete in; + delete in; - if (successfulRead) { - SaveStateDescriptor desc(slot, header._descr.getDescription()); + if (successfulRead) { + SaveStateDescriptor desc(slot, header._descr.getDescription()); // Do not allow save slot 0 (used for auto-saving) to be deleted or // overwritten. //desc.setDeletableFlag(slot != 0); //desc.setWriteProtectedFlag(slot == 0); - return header._descr; - } + return header._descr; + } } return SaveStateDescriptor(); diff --git a/engines/lab/engine.cpp b/engines/lab/engine.cpp index d2e7a55cc6..3e76e161e8 100644 --- a/engines/lab/engine.cpp +++ b/engines/lab/engine.cpp @@ -452,8 +452,8 @@ void LabEngine::mainGameLoop() { if ((_cptr->_closeUpType == SPECIALLOCK) && _mainDisplay) /* LAB: Labyrinth specific code */ showCombination(_curFileName); else if (((_cptr->_closeUpType == SPECIALBRICK) || - (_cptr->_closeUpType == SPECIALBRICKNOMOUSE)) && - _mainDisplay) /* LAB: Labyrinth specific code */ + (_cptr->_closeUpType == SPECIALBRICKNOMOUSE)) && + _mainDisplay) /* LAB: Labyrinth specific code */ showTile(_curFileName, (bool)(_cptr->_closeUpType == SPECIALBRICKNOMOUSE)); else _graphics->readPict(_curFileName, false); @@ -558,7 +558,7 @@ bool LabEngine::from_crumbs(uint32 tmpClass, uint16 code, uint16 Qualifier, Comm if ((msgClass == RAWKEY) && (!_graphics->_longWinInFront)) { if (code == 13) { /* The return key */ - msgClass = MOUSEBUTTONS; + msgClass = MOUSEBUTTONS; Qualifier = IEQUALIFIER_LEFTBUTTON; curPos = _event->getMousePos(); } else if (getPlatform() == Common::kPlatformWindows && @@ -568,8 +568,7 @@ bool LabEngine::from_crumbs(uint32 tmpClass, uint16 code, uint16 Qualifier, Comm _droppingCrumbs = true; mayShowCrumbIndicator(); _graphics->screenUpdate(); - } else if (code == 'f' || code == 'F' || - code == 'r' || code == 'R') { /* Follow bread crumbs */ + } else if (code == 'f' || code == 'F' || code == 'r' || code == 'R') { /* Follow bread crumbs */ if (_droppingCrumbs) { if (_numCrumbs > 0) { _followingCrumbs = true; @@ -599,8 +598,7 @@ bool LabEngine::from_crumbs(uint32 tmpClass, uint16 code, uint16 Qualifier, Comm _graphics->screenUpdate(); } } - } else if ((code == 315) || (code == 'x') || (code == 'X') - || (code == 'q') || (code == 'Q')) { /* Quit? */ + } else if ((code == 315) || (code == 'x') || (code == 'X') || (code == 'q') || (code == 'Q')) { /* Quit? */ _graphics->_doNotDrawMessage = false; _graphics->drawMessage("Do you want to quit? (Y/N)"); doit = false; @@ -645,10 +643,9 @@ bool LabEngine::from_crumbs(uint32 tmpClass, uint16 code, uint16 Qualifier, Comm } if (_graphics->_longWinInFront) { - if ((msgClass == RAWKEY) || - ((msgClass == MOUSEBUTTONS) && - ((IEQUALIFIER_LEFTBUTTON & Qualifier) || - (IEQUALIFIER_RBUTTON & Qualifier)))) { + if ((msgClass == RAWKEY) || ((msgClass == MOUSEBUTTONS) && + ((IEQUALIFIER_LEFTBUTTON & Qualifier) || + (IEQUALIFIER_RBUTTON & Qualifier)))) { _graphics->_longWinInFront = false; _graphics->_doNotDrawMessage = false; _graphics->drawPanel(); @@ -857,8 +854,7 @@ bool LabEngine::from_crumbs(uint32 tmpClass, uint16 code, uint16 Qualifier, Comm curInv++; } - if ((curInv <= _numInv) && _conditions->in(curInv) && - _inventory[curInv]._bitmapName) + if ((curInv <= _numInv) && _conditions->in(curInv) && _inventory[curInv]._bitmapName) _nextFileName = getInvName(curInv); _graphics->screenUpdate(); @@ -944,8 +940,8 @@ bool LabEngine::from_crumbs(uint32 tmpClass, uint16 code, uint16 Qualifier, Comm else if (curPos.y < (_utils->vgaScaleY(149) + _utils->svgaCord(2))) drawStaticMessage(kTextNothing); } else if ((actionMode == 1) /* Manipulate an object */ || - (actionMode == 2) /* Open up a "door" */ || - (actionMode == 3)) { /* Close a "door" */ + (actionMode == 2) /* Open up a "door" */ || + (actionMode == 3)) { /* Close a "door" */ if (doActionRule(curPos, actionMode, _roomNum, &_cptr)) _curFileName = _newFileName; else if (!doActionRule(curPos, actionMode, 0, &_cptr)) { @@ -967,8 +963,7 @@ bool LabEngine::from_crumbs(uint32 tmpClass, uint16 code, uint16 Qualifier, Comm drawStaticMessage(kTextNothing); } else if (curPos.y < (_utils->vgaScaleY(149) + _utils->svgaCord(2))) drawStaticMessage(kTextNothing); - } else if ((actionMode == 5) && - _conditions->in(curInv)) { /* Use an item on something else */ + } else if ((actionMode == 5) && _conditions->in(curInv)) { /* Use an item on something else */ if (doOperateRule(curPos.x, curPos.y, curInv, &_cptr)) { _curFileName = _newFileName; diff --git a/engines/lab/eventman.cpp b/engines/lab/eventman.cpp index 4c50cb78c3..b840c0a720 100644 --- a/engines/lab/eventman.cpp +++ b/engines/lab/eventman.cpp @@ -34,21 +34,23 @@ namespace Lab { -static byte MouseData[] = {1, 1, 0, 0, 0, 0, 0, 0, 0, 0, - 1, 7, 1, 0, 0, 0, 0, 0, 0, 0, - 1, 7, 7, 1, 0, 0, 0, 0, 0, 0, - 1, 7, 7, 7, 1, 0, 0, 0, 0, 0, - 1, 7, 7, 7, 7, 1, 0, 0, 0, 0, - 1, 7, 7, 7, 7, 7, 1, 0, 0, 0, - 1, 7, 7, 7, 7, 7, 7, 1, 0, 0, - 1, 7, 7, 7, 7, 7, 7, 7, 1, 0, - 1, 7, 7, 7, 7, 7, 1, 1, 1, 1, - 1, 7, 7, 1, 7, 7, 1, 0, 0, 0, - 1, 7, 1, 0, 1, 7, 7, 1, 0, 0, - 1, 1, 0, 0, 1, 7, 7, 1, 0, 0, - 0, 0, 0, 0, 0, 1, 7, 7, 1, 0, - 0, 0, 0, 0, 0, 1, 7, 7, 1, 0, - 0, 0, 0, 0, 0, 0, 1, 1, 0, 0}; +static byte MouseData[] = { + 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, + 1, 7, 1, 0, 0, 0, 0, 0, 0, 0, + 1, 7, 7, 1, 0, 0, 0, 0, 0, 0, + 1, 7, 7, 7, 1, 0, 0, 0, 0, 0, + 1, 7, 7, 7, 7, 1, 0, 0, 0, 0, + 1, 7, 7, 7, 7, 7, 1, 0, 0, 0, + 1, 7, 7, 7, 7, 7, 7, 1, 0, 0, + 1, 7, 7, 7, 7, 7, 7, 7, 1, 0, + 1, 7, 7, 7, 7, 7, 1, 1, 1, 1, + 1, 7, 7, 1, 7, 7, 1, 0, 0, 0, + 1, 7, 1, 0, 1, 7, 7, 1, 0, 0, + 1, 1, 0, 0, 1, 7, 7, 1, 0, 0, + 0, 0, 0, 0, 0, 1, 7, 7, 1, 0, + 0, 0, 0, 0, 0, 1, 7, 7, 1, 0, + 0, 0, 0, 0, 0, 0, 1, 1, 0, 0 +}; #define MOUSE_WIDTH 10 #define MOUSE_HEIGHT 15 @@ -152,7 +154,6 @@ void EventManager::updateMouse() { _vm->_graphics->screenUpdate(); } - /*****************************************************************************/ /* Initializes the mouse. */ /*****************************************************************************/ @@ -163,7 +164,6 @@ void EventManager::initMouse() { setMousePos(Common::Point(0, 0)); } - /*****************************************************************************/ /* Shows the mouse. */ /*****************************************************************************/ @@ -198,7 +198,6 @@ Common::Point EventManager::getMousePos() { return Common::Point(_mousePos.x / 2, _mousePos.y); } - /*****************************************************************************/ /* Moves the mouse to new co-ordinates. */ /*****************************************************************************/ @@ -212,7 +211,6 @@ void EventManager::setMousePos(Common::Point pos) { processInput(); } - /*****************************************************************************/ /* Checks whether or not the mouse buttons have been pressed, and the last */ /* co-ordinates of the button press. leftbutton tells whether to check the */ diff --git a/engines/lab/graphics.cpp b/engines/lab/graphics.cpp index 8da54cc90a..aa118eb420 100644 --- a/engines/lab/graphics.cpp +++ b/engines/lab/graphics.cpp @@ -138,8 +138,7 @@ void DisplayMan::freePict() { static void getWord(char *wordBuffer, const char *mainBuffer, uint16 *wordWidth) { uint16 width = 0; - while ((mainBuffer[width] != ' ') && mainBuffer[width] && - (mainBuffer[width] != '\n')) { + while ((mainBuffer[width] != ' ') && mainBuffer[width] && (mainBuffer[width] != '\n')) { wordBuffer[width] = mainBuffer[width]; width++; } @@ -190,16 +189,18 @@ void DisplayMan::getLine(TextFont *tf, char *lineBuffer, const char **mainBuffer /* Note: Every individual word MUST be int16 enough to fit on a line, and */ /* each line less than 255 characters. */ /******************************************************************************/ -uint32 DisplayMan::flowText(void *font, /* the TextAttr pointer */ - int16 spacing, /* How much vertical spacing between the lines */ - byte pencolor, /* pen number to use for text */ - byte backpen, /* the background color */ - bool fillback, /* Whether to fill the background */ - bool centerh, /* Whether to center the text horizontally */ - bool centerv, /* Whether to center the text vertically */ - bool output, /* Whether to output any text */ - uint16 x1, /* Cords */ - uint16 y1, uint16 x2, uint16 y2, const char *str) { /* The text itself */ +uint32 DisplayMan::flowText( + void *font, /* the TextAttr pointer */ + int16 spacing, /* How much vertical spacing between the lines */ + byte pencolor, /* pen number to use for text */ + byte backpen, /* the background color */ + bool fillback, /* Whether to fill the background */ + bool centerh, /* Whether to center the text horizontally */ + bool centerv, /* Whether to center the text vertically */ + bool output, /* Whether to output any text */ + uint16 x1, uint16 y1, /* Cords */ + uint16 x2, uint16 y2, + const char *str) { /* The text itself */ TextFont *_msgFont = (TextFont *)font; char linebuffer[256]; const char *temp; @@ -272,16 +273,18 @@ uint32 DisplayMan::flowTextScaled(void *font, /* the TextAttr pointer */ /******************************************************************************/ /* Calls flowText, but flows it to memory. Same restrictions as flowText. */ /******************************************************************************/ -uint32 DisplayMan::flowTextToMem(Image *destIm, void *font, /* the TextAttr pointer */ - int16 spacing, /* How much vertical spacing between the lines */ - byte pencolor, /* pen number to use for text */ - byte backpen, /* the background color */ - bool fillback, /* Whether to fill the background */ - bool centerh, /* Whether to center the text horizontally */ - bool centerv, /* Whether to center the text vertically */ - bool output, /* Whether to output any text */ - uint16 x1, /* Cords */ - uint16 y1, uint16 x2, uint16 y2, const char *str) { /* The text itself */ +uint32 DisplayMan::flowTextToMem(Image *destIm, + void *font, /* the TextAttr pointer */ + int16 spacing, /* How much vertical spacing between the lines */ + byte pencolor, /* pen number to use for text */ + byte backpen, /* the background color */ + bool fillback, /* Whether to fill the background */ + bool centerh, /* Whether to center the text horizontally */ + bool centerv, /* Whether to center the text vertically */ + bool output, /* Whether to output any text */ + uint16 x1, uint16 y1, /* Cords */ + uint16 x2, uint16 y2, + const char *str) { /* The text itself */ uint32 res, vgabyte = _screenBytesPerPage; byte *tmp = _currentDisplayBuffer; diff --git a/engines/lab/image.h b/engines/lab/image.h index f443f4c1c3..7f2c1ed5c5 100644 --- a/engines/lab/image.h +++ b/engines/lab/image.h @@ -36,20 +36,19 @@ namespace Lab { class Image { public: uint16 _width; - uint16 _height; + uint16 _height; byte *_imageData; - Image() : _width(0), _height(0), _imageData(0) {} - Image(int w, int h, byte *d) : _width(w), _height(h), _imageData(d) {} + Image() : _width(0), _height(0), _imageData(0) {} + Image(int w, int h, byte *d) : _width(w), _height(h), _imageData(d) {} Image(Common::File *s); - void drawImage(uint16 x, uint16 y); - void drawMaskImage(uint16 x, uint16 y); - void readScreenImage(uint16 x, uint16 y); + void drawImage(uint16 x, uint16 y); + void drawMaskImage(uint16 x, uint16 y); + void readScreenImage(uint16 x, uint16 y); void blitBitmap(uint16 xs, uint16 ys, Image *ImDest, uint16 xd, uint16 yd, uint16 width, uint16 height, byte masked); }; - } // End of namespace Lab #endif // LAB_H diff --git a/engines/lab/interface.cpp b/engines/lab/interface.cpp index 7f6776a054..4e514ea652 100644 --- a/engines/lab/interface.cpp +++ b/engines/lab/interface.cpp @@ -113,8 +113,8 @@ Gadget *LabEngine::checkNumGadgetHit(GadgetList *gadgetList, uint16 key) { for (GadgetList::iterator gadgetItr = gadgetList->begin(); gadgetItr != gadgetList->end(); ++gadgetItr) { Gadget *gadget = *gadgetItr; if ((gkey - 1 == gadget->_gadgetID || (gkey == 0 && gadget->_gadgetID == 9) || - (gadget->_keyEquiv != 0 && makeGadgetKeyEquiv(key) == gadget->_keyEquiv)) - && !(GADGETOFF & gadget->_flags)) { + (gadget->_keyEquiv != 0 && makeGadgetKeyEquiv(key) == gadget->_keyEquiv)) + && !(GADGETOFF & gadget->_flags)) { _event->mouseHide(); gadget->_altImage->drawImage(gadget->x, gadget->y); _event->mouseShow(); diff --git a/engines/lab/intro.cpp b/engines/lab/intro.cpp index da44916a92..2af4f448a2 100644 --- a/engines/lab/intro.cpp +++ b/engines/lab/intro.cpp @@ -54,14 +54,13 @@ void Intro::introEatMessages() { return; else { if (((msg->_msgClass == MOUSEBUTTONS) && (IEQUALIFIER_RBUTTON & msg->_qualifier)) || - ((msg->_msgClass == RAWKEY) && (msg->_code == 27)) + ((msg->_msgClass == RAWKEY) && (msg->_code == 27)) ) _quitIntro = true; } } } - /*****************************************************************************/ /* Reads in a picture. */ /*****************************************************************************/ @@ -156,7 +155,7 @@ void Intro::doPictText(const char *filename, TextFont *msgFont, bool isScreen) { code = msg->_code; if (((cls == MOUSEBUTTONS) && (IEQUALIFIER_RBUTTON & qualifier)) || - ((cls == RAWKEY) && (code == 27))) { + ((cls == RAWKEY) && (code == 27))) { _quitIntro = true; if (isScreen) @@ -278,8 +277,8 @@ void Intro::introSequence() { break; palette[i] = ((_vm->_anim->_diffPalette[i * 3] >> 2) << 8) + - ((_vm->_anim->_diffPalette[i * 3 + 1] >> 2) << 4) + - (_vm->_anim->_diffPalette[i * 3 + 2] >> 2); + ((_vm->_anim->_diffPalette[i * 3 + 1] >> 2) << 4) + + (_vm->_anim->_diffPalette[i * 3 + 2] >> 2); } _vm->_music->updateMusic(); @@ -337,8 +336,8 @@ void Intro::introSequence() { for (uint16 i = 0; i < 16; i++) { palette[i] = ((_vm->_anim->_diffPalette[i * 3] >> 2) << 8) + - ((_vm->_anim->_diffPalette[i * 3 + 1] >> 2) << 4) + - (_vm->_anim->_diffPalette[i * 3 + 2] >> 2); + ((_vm->_anim->_diffPalette[i * 3 + 1] >> 2) << 4) + + (_vm->_anim->_diffPalette[i * 3 + 2] >> 2); } doPictText("i.1", msgFont, true); diff --git a/engines/lab/lab.h b/engines/lab/lab.h index fb2d20d5a4..7dec75f0a6 100644 --- a/engines/lab/lab.h +++ b/engines/lab/lab.h @@ -132,8 +132,7 @@ public: const char *_curFileName; const char *_nextFileName; - const char *_newFileName; /* When ProcessRoom.c decides to change the filename - of the current picture. */ + const char *_newFileName; /* When ProcessRoom.c decides to change the filename of the current picture. */ TextFont *_msgFont; GadgetList _moveGadgetList; GadgetList _invGadgetList; diff --git a/engines/lab/labsets.h b/engines/lab/labsets.h index 3251ee18a3..647730db6e 100644 --- a/engines/lab/labsets.h +++ b/engines/lab/labsets.h @@ -41,19 +41,19 @@ class LabEngine; class LargeSet { public: - LargeSet(uint16 last, LabEngine *vm); - ~LargeSet(); - bool in(uint16 element); - void inclElement(uint16 element); - void exclElement(uint16 element); - bool readInitialConditions(const char *fileName); + LargeSet(uint16 last, LabEngine *vm); + ~LargeSet(); + bool in(uint16 element); + void inclElement(uint16 element); + void exclElement(uint16 element); + bool readInitialConditions(const char *fileName); private: LabEngine *_vm; public: - uint16 _lastElement; - uint16 *_array; + uint16 _lastElement; + uint16 *_array; }; } // End of namespace Lab diff --git a/engines/lab/map.cpp b/engines/lab/map.cpp index 8c71d1a6a6..405d7b82ea 100644 --- a/engines/lab/map.cpp +++ b/engines/lab/map.cpp @@ -357,9 +357,6 @@ static void getUpFloor(uint16 *Floor, bool *isfloor) { } while ((!onFloor(*Floor)) && (*Floor <= CARNIVAL)); } - - - /*****************************************************************************/ /* Figures out which floor, if any, should be gone to if the down arrow is */ /* hit. */ @@ -391,10 +388,6 @@ static void getDownFloor(uint16 *Floor, bool *isfloor) { } while ((!onFloor(*Floor)) && *Floor); } - - - - /*****************************************************************************/ /* Draws the map */ /*****************************************************************************/ @@ -422,9 +415,9 @@ void LabEngine::drawMap(uint16 CurRoom, uint16 CurMsg, uint16 Floor, bool fadeou } } - if ((Maps[CurRoom].PageNumber == Floor) /* Makes sure the X is drawn in corridors */ - && _roomsFound->in(CurRoom) /* NOTE: this here on purpose just in case there's some weird condition, like the surreal maze where there are no rooms */ - && Maps[CurRoom].x) + /* Makes sure the X is drawn in corridors */ + /* NOTE: this here on purpose just in case there's some weird condition, like the surreal maze where there are no rooms */ + if ((Maps[CurRoom].PageNumber == Floor) && _roomsFound->in(CurRoom) && Maps[CurRoom].x) drawRoom(CurRoom, true); tempfloor = Floor; @@ -529,8 +522,7 @@ void LabEngine::processMap(uint16 CurRoom) { MouseX = Msg->_mouseX; MouseY = Msg->_mouseY; - if (((Class == MOUSEBUTTONS) && (IEQUALIFIER_RBUTTON & Qualifier)) || - ((Class == RAWKEY) && (Code == 27))) + if (((Class == MOUSEBUTTONS) && (IEQUALIFIER_RBUTTON & Qualifier)) || ((Class == RAWKEY) && (Code == 27))) return; if (Class == GADGETUP) { @@ -557,59 +549,49 @@ void LabEngine::processMap(uint16 CurRoom) { } else CurFloor = OldFloor; } - } - - else if ((Class == MOUSEBUTTONS) && (IEQUALIFIER_LEFTBUTTON & Qualifier)) { + } else if ((Class == MOUSEBUTTONS) && (IEQUALIFIER_LEFTBUTTON & Qualifier)) { if ((CurFloor == LOWERFLOOR) && (MouseX >= mapScaleX(538)) && (MouseY >= mapScaleY(277)) - && (MouseX <= mapScaleX(633)) && (MouseY <= mapScaleY(352)) - && onFloor(SURMAZEFLOOR)) { + && (MouseX <= mapScaleX(633)) && (MouseY <= mapScaleY(352)) + && onFloor(SURMAZEFLOOR)) { CurFloor = SURMAZEFLOOR; _graphics->fade(false, 0); drawMap(CurRoom, CurMsg, CurFloor, false, false); _graphics->fade(true, 0); - } - - else if ((CurFloor == MIDDLEFLOOR) && (MouseX >= mapScaleX(358)) && (MouseY >= mapScaleY(71)) - && (MouseX <= mapScaleX(452)) && (MouseY <= mapScaleY(147)) - && onFloor(CARNIVAL)) { + } else if ((CurFloor == MIDDLEFLOOR) && (MouseX >= mapScaleX(358)) && (MouseY >= mapScaleY(71)) + && (MouseX <= mapScaleX(452)) && (MouseY <= mapScaleY(147)) + && onFloor(CARNIVAL)) { CurFloor = CARNIVAL; _graphics->fade(false, 0); drawMap(CurRoom, CurMsg, CurFloor, false, false); _graphics->fade(true, 0); - } - - else if ((CurFloor == MIDDLEFLOOR) && (MouseX >= mapScaleX(557)) && (MouseY >= mapScaleY(325)) - && (MouseX <= mapScaleX(653)) && (MouseY <= mapScaleY(401)) - && onFloor(MEDMAZEFLOOR)) { + } else if ((CurFloor == MIDDLEFLOOR) && (MouseX >= mapScaleX(557)) && (MouseY >= mapScaleY(325)) + && (MouseX <= mapScaleX(653)) && (MouseY <= mapScaleY(401)) + && onFloor(MEDMAZEFLOOR)) { CurFloor = MEDMAZEFLOOR; _graphics->fade(false, 0); drawMap(CurRoom, CurMsg, CurFloor, false, false); _graphics->fade(true, 0); - } - - else if ((CurFloor == UPPERFLOOR) && (MouseX >= mapScaleX(524)) && (MouseY >= mapScaleY(97)) - && (MouseX <= mapScaleX(645)) && (MouseY <= mapScaleY(207)) - && onFloor(HEDGEMAZEFLOOR)) { + } else if ((CurFloor == UPPERFLOOR) && (MouseX >= mapScaleX(524)) && (MouseY >= mapScaleY(97)) + && (MouseX <= mapScaleX(645)) && (MouseY <= mapScaleY(207)) + && onFloor(HEDGEMAZEFLOOR)) { CurFloor = HEDGEMAZEFLOOR; _graphics->fade(false, 0); drawMap(CurRoom, CurMsg, CurFloor, false, false); _graphics->fade(true, 0); - } - - else if (MouseX > mapScaleX(314)) { + } else if (MouseX > mapScaleX(314)) { OldMsg = CurMsg; for (uint16 i = 1; i <= MaxRooms; i++) { roomCoords(i, &x1, &y1, &x2, &y2); if ((Maps[i].PageNumber == CurFloor) - && _roomsFound->in(i) - && (MouseX >= x1) && (MouseX <= x2) - && (MouseY >= y1) && (MouseY <= y2)) { + && _roomsFound->in(i) + && (MouseX >= x1) && (MouseX <= x2) + && (MouseY >= y1) && (MouseY <= y2)) { CurMsg = i; } } @@ -647,7 +629,6 @@ void LabEngine::processMap(uint16 CurRoom) { } } - /*****************************************************************************/ /* Does the map processing. */ /*****************************************************************************/ diff --git a/engines/lab/processroom.cpp b/engines/lab/processroom.cpp index fa270ded61..e037522acf 100644 --- a/engines/lab/processroom.cpp +++ b/engines/lab/processroom.cpp @@ -104,7 +104,7 @@ static CloseData *getObject(uint16 x, uint16 y, CloseDataPtr lcptr) { while (lcptr != NULL) { if ((x >= g_lab->_utils->scaleX(lcptr->x1)) && (y >= g_lab->_utils->scaleY(lcptr->y1)) && - (x <= g_lab->_utils->scaleX(lcptr->x2)) && (y <= g_lab->_utils->scaleY(lcptr->y2))) + (x <= g_lab->_utils->scaleX(lcptr->x2)) && (y <= g_lab->_utils->scaleY(lcptr->y2))) return lcptr; lcptr = lcptr->_nextCloseUp; @@ -124,8 +124,8 @@ static CloseDataPtr findCPtrMatch(CloseDataPtr cpmain, CloseDataPtr list) { while (list) { if ((cpmain->x1 == list->x1) && (cpmain->x2 == list->x2) && - (cpmain->y1 == list->y1) && (cpmain->y2 == list->y2) && - (cpmain->_depth == list->_depth)) + (cpmain->y1 == list->y1) && (cpmain->y2 == list->y2) && + (cpmain->_depth == list->_depth)) return list; cptr = findCPtrMatch(cpmain, list->_subCloseUps); @@ -278,8 +278,8 @@ bool takeItem(uint16 x, uint16 y, CloseDataPtr *cptr) { while (lcptr != NULL) { if ((x >= g_lab->_utils->scaleX(lcptr->x1)) && (y >= g_lab->_utils->scaleY(lcptr->y1)) && - (x <= g_lab->_utils->scaleX(lcptr->x2)) && (y <= g_lab->_utils->scaleY(lcptr->y2)) && - (lcptr->_closeUpType < 0)) { + (x <= g_lab->_utils->scaleX(lcptr->x2)) && (y <= g_lab->_utils->scaleY(lcptr->y2)) && + (lcptr->_closeUpType < 0)) { g_lab->_conditions->inclElement(abs(lcptr->_closeUpType)); return true; } @@ -449,8 +449,7 @@ void LabEngine::doActions(Action *aptr, CloseDataPtr *lcptr) { _anim->diffNextFrame(); getTime(&curSecs, &curMicros); - if ((curSecs > startSecs) || ((curSecs == startSecs) && - (curMicros >= startMicros))) + if ((curSecs > startSecs) || ((curSecs == startSecs) && (curMicros >= startMicros))) break; } } @@ -582,9 +581,8 @@ static bool doActionRuleSub(int16 action, int16 roomNum, CloseDataPtr lcptr, Clo if (((*rule)->_ruleType == ACTION) && (((*rule)->_param1 == action) || (((*rule)->_param1 == 0) && allowDefaults))) { if ((((*rule)->_param2 == lcptr->_closeUpType) || - (((*rule)->_param2 == 0) && allowDefaults)) - || - ((action == 1) && ((*rule)->_param2 == (-lcptr->_closeUpType)))) { + (((*rule)->_param2 == 0) && allowDefaults)) || + ((action == 1) && ((*rule)->_param2 == (-lcptr->_closeUpType)))) { if (checkConditions((*rule)->_condition)) { g_lab->doActions((*rule)->_actionList, set); return true; @@ -635,7 +633,7 @@ static bool doOperateRuleSub(int16 itemNum, int16 roomNum, CloseDataPtr lcptr, C for (RuleList::iterator rule = rules->begin(); rule != rules->end(); ++rule) { if (((*rule)->_ruleType == OPERATE) && - (((*rule)->_param1 == itemNum) || (((*rule)->_param1 == 0) && allowDefaults)) && + (((*rule)->_param1 == itemNum) || (((*rule)->_param1 == 0) && allowDefaults)) && (((*rule)->_param2 == lcptr->_closeUpType) || (((*rule)->_param2 == 0) && allowDefaults))) { if (checkConditions((*rule)->_condition)) { g_lab->doActions((*rule)->_actionList, set); @@ -711,8 +709,8 @@ bool doTurn(uint16 from, uint16 to, CloseDataPtr *lcptr) { for (RuleList::iterator rule = rules->begin(); rule != rules->end(); ++rule) { if (((*rule)->_ruleType == TURN) || - (((*rule)->_ruleType == TURNFROMTO) && - ((*rule)->_param1 == from) && ((*rule)->_param2 == to))) { + (((*rule)->_ruleType == TURNFROMTO) && + ((*rule)->_param1 == from) && ((*rule)->_param2 == to))) { if (checkConditions((*rule)->_condition)) { g_lab->doActions((*rule)->_actionList, lcptr); return true; diff --git a/engines/lab/savegame.cpp b/engines/lab/savegame.cpp index 23e73c5bfb..bf3f8a4504 100644 --- a/engines/lab/savegame.cpp +++ b/engines/lab/savegame.cpp @@ -164,8 +164,6 @@ bool saveGame(uint16 Direction, uint16 Quarters, int slot, Common::String desc) return true; } - - /*****************************************************************************/ /* Reads the game from disk. */ /*****************************************************************************/ diff --git a/engines/lab/special.cpp b/engines/lab/special.cpp index 469d8ab9d8..0d92772a39 100644 --- a/engines/lab/special.cpp +++ b/engines/lab/special.cpp @@ -62,12 +62,12 @@ Image *MonButton; #define INCL(BITSET,BIT) ((BITSET) |= (BIT)) #define SETBIT(BITSET,BITNUM) INCL(BITSET, (1 << (BITNUM))) #define INBIT(BITSET,BITNUM) ( ((1 << (BITNUM)) & (BITSET)) > 0 ) -#define BRIDGE0 148 -#define BRIDGE1 104 -#define DIRTY 175 -#define NONEWS 135 -#define NOCLEAN 152 -#define QUARTERNUM 30 +#define BRIDGE0 148 +#define BRIDGE1 104 +#define DIRTY 175 +#define NONEWS 135 +#define NOCLEAN 152 +#define QUARTERNUM 30 static byte *loadBackPict(const char *fileName, bool tomem) { @@ -83,8 +83,8 @@ static byte *loadBackPict(const char *fileName, bool tomem) { for (uint16 i = 0; i < 16; i++) { hipal[i] = ((g_lab->_anim->_diffPalette[i * 3] >> 2) << 8) + - ((g_lab->_anim->_diffPalette[i * 3 + 1] >> 2) << 4) + - ((g_lab->_anim->_diffPalette[i * 3 + 2] >> 2)); + ((g_lab->_anim->_diffPalette[i * 3 + 1] >> 2) << 4) + + ((g_lab->_anim->_diffPalette[i * 3 + 2] >> 2)); } g_lab->_anim->_noPalChange = false; @@ -282,7 +282,6 @@ static void turnPage(bool FromLeft) { } } - /*****************************************************************************/ /* Draws the journal from page x. */ /*****************************************************************************/ @@ -347,7 +346,7 @@ void LabEngine::processJournal() { GadID = Msg->_code; if (((Class == MOUSEBUTTONS) && (IEQUALIFIER_RBUTTON & Qualifier)) || - ((Class == RAWKEY) && (GadID == 27))) + ((Class == RAWKEY) && (GadID == 27))) return; else if (Class == GADGETUP) { @@ -385,7 +384,7 @@ void LabEngine::doJournal() { JBackImage._width = _graphics->_screenWidth; JBackImage._height = _graphics->_screenHeight; - JBackImage._imageData = NULL; + JBackImage._imageData = NULL; ScreenImage = JBackImage; ScreenImage._imageData = _graphics->getCurrentDrawingBuffer(); @@ -558,7 +557,7 @@ void LabEngine::processMonitor(char *ntext, TextFont *monitorFont, bool isintera Code = Msg->_code; if (((Class == MOUSEBUTTONS) && (IEQUALIFIER_RBUTTON & Qualifier)) || - ((Class == RAWKEY) && (Code == 27))) + ((Class == RAWKEY) && (Code == 27))) return; else if ((Class == MOUSEBUTTONS) && (IEQUALIFIER_LEFTBUTTON & Qualifier)) { diff --git a/engines/lab/timing.cpp b/engines/lab/timing.cpp index ba3dd40846..63a2b946bc 100644 --- a/engines/lab/timing.cpp +++ b/engines/lab/timing.cpp @@ -56,7 +56,7 @@ void LabEngine::microDelay(uint32 secs, uint32 micros) { void LabEngine::getTime(uint32 *secs, uint32 *micros) { uint32 t = g_system->getMillis(); - *secs = t / 1000; + *secs = t / 1000; *micros = t % 1000; } @@ -66,7 +66,7 @@ void LabEngine::getTime(uint32 *secs, uint32 *micros) { void LabEngine::addCurTime(uint32 sec, uint32 micros, uint32 *timeSec, uint32 *timeMicros) { getTime(timeSec, timeMicros); - (*timeSec) += sec; + (*timeSec) += sec; (*timeMicros) += micros; if (*timeMicros >= ONESECOND) { @@ -80,7 +80,7 @@ void LabEngine::addCurTime(uint32 sec, uint32 micros, uint32 *timeSec, uint32 *t /* time2, returns 0. */ /*****************************************************************************/ void LabEngine::anyTimeDiff(uint32 sec1, uint32 micros1, uint32 sec2, uint32 micros2, uint32 *diffSecs, uint32 *diffMicros) { - *diffSecs = 0; + *diffSecs = 0; *diffMicros = 0; if (sec1 > sec2) @@ -89,10 +89,10 @@ void LabEngine::anyTimeDiff(uint32 sec1, uint32 micros1, uint32 sec2, uint32 mic return; if (micros1 > micros2) { - *diffSecs = sec2 - sec1 - 1; + *diffSecs = sec2 - sec1 - 1; *diffMicros = (ONESECOND - micros1) + micros2; } else { - *diffSecs = sec2 - sec1; + *diffSecs = sec2 - sec1; *diffMicros = micros2 - micros1; } } -- cgit v1.2.3 From ae056a767ba8c983b7d38afd2532ba18fd3cb724 Mon Sep 17 00:00:00 2001 From: Strangerke Date: Tue, 8 Dec 2015 09:46:54 +0100 Subject: LAB: Use doxygen format for function comments --- engines/lab/anim.cpp | 24 +++---- engines/lab/engine.cpp | 67 +++++++++--------- engines/lab/eventman.cpp | 56 +++++++-------- engines/lab/graphics.cpp | 161 ++++++++++++++++++++++---------------------- engines/lab/image.cpp | 30 ++++----- engines/lab/interface.cpp | 32 ++++----- engines/lab/intro.cpp | 26 +++---- engines/lab/map.cpp | 56 +++++++-------- engines/lab/music.cpp | 68 +++++++++---------- engines/lab/savegame.cpp | 12 ++-- engines/lab/special.cpp | 68 +++++++++---------- engines/lab/tilepuzzle.cpp | 54 +++++++-------- engines/lab/timing.cpp | 42 ++++++------ engines/lab/transitions.cpp | 70 +++++++++---------- engines/lab/utils.cpp | 92 ++++++++++++------------- 15 files changed, 427 insertions(+), 431 deletions(-) diff --git a/engines/lab/anim.cpp b/engines/lab/anim.cpp index d8b3b2feb3..4927b25eae 100644 --- a/engines/lab/anim.cpp +++ b/engines/lab/anim.cpp @@ -243,9 +243,9 @@ void Anim::diffNextFrame() { } } -/*****************************************************************************/ -/* A separate task launched by readDiff. Plays the DIFF. */ -/*****************************************************************************/ +/** + * A separate task launched by readDiff. Plays the DIFF. + */ void Anim::playDiff(byte *buffer) { _waitSec = 0L; _waitMicros = 0L; @@ -330,17 +330,17 @@ void Anim::playDiff(byte *buffer) { diffNextFrame(); } -/*****************************************************************************/ -/* Stops an animation from running. */ -/*****************************************************************************/ +/** + * Stops an animation from running. + */ void Anim::stopDiff() { if (_isPlaying && _isAnim) _vm->_graphics->blackScreen(); } -/*****************************************************************************/ -/* Stops an animation from running. */ -/*****************************************************************************/ +/** + * Stops an animation from running. + */ void Anim::stopDiffEnd() { if (_isPlaying) { _stopPlayingEnd = true; @@ -351,9 +351,9 @@ void Anim::stopDiffEnd() { } } -/*****************************************************************************/ -/* Reads in a DIFF file. */ -/*****************************************************************************/ +/** + * Reads in a DIFF file. + */ bool Anim::readDiff(byte *buffer, bool playOnce) { _playOnce = playOnce; playDiff(buffer); diff --git a/engines/lab/engine.cpp b/engines/lab/engine.cpp index 3e76e161e8..6fb4c700d9 100644 --- a/engines/lab/engine.cpp +++ b/engines/lab/engine.cpp @@ -86,9 +86,9 @@ static char initcolors[] = { '\x00', '\x00', '\x00', '\x30', '\x24', '\x24', '\x2c', '\x2c', '\x2c', '\x08', '\x08', '\x08'}; -/******************************************************************************/ -/* Draws the message for the room. */ -/******************************************************************************/ +/** + * Draws the message for the room. + */ void LabEngine::drawRoomMessage(uint16 curInv, CloseDataPtr closePtr) { if (_lastTooLong) { _lastTooLong = false; @@ -124,10 +124,9 @@ void LabEngine::freeScreens() { } } - -/******************************************************************************/ -/* Permanently flips the imagery of a gadget. */ -/******************************************************************************/ +/** + * Permanently flips the imagery of a gadget. + */ void LabEngine::perFlipGadget(uint16 gadgetId) { for (GadgetList::iterator gadget = _moveGadgetList.begin(); gadget != _moveGadgetList.end(); ++gadget) { Gadget *topGadget = *gadget; @@ -147,9 +146,9 @@ void LabEngine::perFlipGadget(uint16 gadgetId) { } } -/******************************************************************************/ -/* Eats all the available messages. */ -/******************************************************************************/ +/** + * Eats all the available messages. + */ void LabEngine::eatMessages() { IntuiMessage *msg; @@ -158,9 +157,9 @@ void LabEngine::eatMessages() { } while (msg); } -/******************************************************************************/ -/* Checks whether the close up is one of the special case closeups. */ -/******************************************************************************/ +/** + * Checks whether the close up is one of the special case closeups. + */ bool LabEngine::doCloseUp(CloseDataPtr closePtr) { if (closePtr == NULL) return false; @@ -216,9 +215,9 @@ bool LabEngine::doCloseUp(CloseDataPtr closePtr) { return true; } -/******************************************************************************/ -/* Gets the current inventory name. */ -/******************************************************************************/ +/** + * Gets the current inventory name. + */ const char *LabEngine::getInvName(uint16 curInv) { if (_mainDisplay) return _inventory[curInv]._bitmapName; @@ -246,9 +245,9 @@ const char *LabEngine::getInvName(uint16 curInv) { return _inventory[curInv]._bitmapName; } -/******************************************************************************/ -/* Turns the interface off. */ -/******************************************************************************/ +/** + * Turns the interface off. + */ void LabEngine::interfaceOff() { if (!_interfaceOff) { _event->attachGadgetList(NULL); @@ -257,9 +256,9 @@ void LabEngine::interfaceOff() { } } -/******************************************************************************/ -/* Turns the interface on. */ -/******************************************************************************/ +/** + * Turns the interface on. + */ void LabEngine::interfaceOn() { if (_interfaceOff) { _interfaceOff = false; @@ -274,9 +273,9 @@ void LabEngine::interfaceOn() { _event->attachGadgetList(&_moveGadgetList); } -/******************************************************************************/ -/* If the user hits the "Use" gadget; things that can get used on themselves. */ -/******************************************************************************/ +/** + * If the user hits the "Use" gadget; things that can get used on themselves. + */ bool LabEngine::doUse(uint16 curInv) { if (curInv == MAPNUM) { /* LAB: Labyrinth specific */ drawStaticMessage(kTextUseMap); @@ -336,9 +335,9 @@ bool LabEngine::doUse(uint16 curInv) { return true; } -/******************************************************************************/ -/* Decrements the current inventory number. */ -/******************************************************************************/ +/** + * Decrements the current inventory number. + */ void LabEngine::decIncInv(uint16 *curInv, bool decreaseFl) { interfaceOff(); @@ -379,9 +378,9 @@ void LabEngine::decIncInv(uint16 *curInv, bool decreaseFl) { } } -/******************************************************************************/ -/* The main game loop */ -/******************************************************************************/ +/** + * The main game loop. + */ void LabEngine::mainGameLoop() { uint16 actionMode = 4; uint16 curInv = MAPNUM; @@ -1075,9 +1074,9 @@ void LabEngine::go() { _music->freeMusic(); } -/*****************************************************************************/ -/* New code to allow quick(er) return navigation in game. */ -/*****************************************************************************/ +/** + * New code to allow quick(er) return navigation in game. + */ int LabEngine::followCrumbs() { // NORTH, SOUTH, EAST, WEST static int movement[4][4] = { diff --git a/engines/lab/eventman.cpp b/engines/lab/eventman.cpp index b840c0a720..5b55ed4102 100644 --- a/engines/lab/eventman.cpp +++ b/engines/lab/eventman.cpp @@ -55,10 +55,10 @@ static byte MouseData[] = { #define MOUSE_WIDTH 10 #define MOUSE_HEIGHT 15 -/*****************************************************************************/ -/* Checks whether or not the cords fall within one of the gadgets in a list */ -/* of gadgets. */ -/*****************************************************************************/ +/** + * Checks whether or not the cords fall within one of the gadgets in a list + * of gadgets. + */ Gadget *EventManager::checkGadgetHit(GadgetList *gadgetList, Common::Point pos) { for (GadgetList::iterator gadgetItr = gadgetList->begin(); gadgetItr != gadgetList->end(); ++gadgetItr) { Gadget *gadget = *gadgetItr; @@ -154,9 +154,9 @@ void EventManager::updateMouse() { _vm->_graphics->screenUpdate(); } -/*****************************************************************************/ -/* Initializes the mouse. */ -/*****************************************************************************/ +/** + * Initializes the mouse. + */ void EventManager::initMouse() { g_system->setMouseCursor(MouseData, MOUSE_WIDTH, MOUSE_HEIGHT, 0, 0, 0); g_system->showMouse(false); @@ -164,9 +164,9 @@ void EventManager::initMouse() { setMousePos(Common::Point(0, 0)); } -/*****************************************************************************/ -/* Shows the mouse. */ -/*****************************************************************************/ +/** + * Shows the mouse. + */ void EventManager::mouseShow() { if (_mouseHidden) { processInput(); @@ -176,9 +176,9 @@ void EventManager::mouseShow() { g_system->showMouse(true); } -/*****************************************************************************/ -/* Hides the mouse. */ -/*****************************************************************************/ +/** + * Hides the mouse. + */ void EventManager::mouseHide() { if (!_mouseHidden) { _mouseHidden = true; @@ -187,10 +187,10 @@ void EventManager::mouseHide() { } } -/*****************************************************************************/ -/* Gets the current mouse co-ordinates. NOTE: On IBM version, will scale */ -/* from virtual to screen co-ordinates automatically. */ -/*****************************************************************************/ +/** + * Gets the current mouse co-ordinates. NOTE: On IBM version, will scale + * from virtual to screen co-ordinates automatically. + */ Common::Point EventManager::getMousePos() { if (_vm->_isHiRes) return _mousePos; @@ -198,9 +198,9 @@ Common::Point EventManager::getMousePos() { return Common::Point(_mousePos.x / 2, _mousePos.y); } -/*****************************************************************************/ -/* Moves the mouse to new co-ordinates. */ -/*****************************************************************************/ +/** + * Moves the mouse to new co-ordinates. + */ void EventManager::setMousePos(Common::Point pos) { if (_vm->_isHiRes) g_system->warpMouse(pos.x, pos.y); @@ -211,11 +211,11 @@ void EventManager::setMousePos(Common::Point pos) { processInput(); } -/*****************************************************************************/ -/* Checks whether or not the mouse buttons have been pressed, and the last */ -/* co-ordinates of the button press. leftbutton tells whether to check the */ -/* left or right button. */ -/*****************************************************************************/ +/** + * Checks whether or not the mouse buttons have been pressed, and the last + * co-ordinates of the button press. leftbutton tells whether to check the + * left or right button. + */ bool EventManager::mouseButton(uint16 *x, uint16 *y, bool leftbutton) { if (leftbutton) { if (_leftClick) { @@ -243,9 +243,9 @@ Gadget *EventManager::mouseGadget() { return temp; } -/*****************************************************************************/ -/* Checks whether or not a key has been pressed. */ -/*****************************************************************************/ +/** + * Checks whether or not a key has been pressed. + */ bool EventManager::keyPress(uint16 *keyCode) { if (haveNextChar()) { *keyCode = getNextChar(); diff --git a/engines/lab/graphics.cpp b/engines/lab/graphics.cpp index aa118eb420..926dc7ce6d 100644 --- a/engines/lab/graphics.cpp +++ b/engines/lab/graphics.cpp @@ -74,9 +74,9 @@ void DisplayMan::loadPict(const char *filename) { delete bitmapFile; } -/*****************************************************************************/ -/* Reads in a picture into the dest bitmap. */ -/*****************************************************************************/ +/** + * Reads in a picture into the dest bitmap. + */ void DisplayMan::readPict(const char *filename, bool playOnce) { _vm->_anim->stopDiff(); @@ -94,9 +94,9 @@ void DisplayMan::readPict(const char *filename, bool playOnce) { _vm->_anim->readDiff(_curBitmap, playOnce); } -/*****************************************************************************/ -/* Reads in a picture into buffer memory. */ -/*****************************************************************************/ +/** + * Reads in a picture into buffer memory. + */ byte *DisplayMan::readPictToMem(const char *filename, uint16 x, uint16 y) { _vm->_anim->stopDiff(); @@ -132,9 +132,9 @@ void DisplayMan::freePict() { /*----- The flowText routines -----*/ -/******************************************************************************/ -/* Extracts the first word from a string. */ -/******************************************************************************/ +/** + * Extracts the first word from a string. + */ static void getWord(char *wordBuffer, const char *mainBuffer, uint16 *wordWidth) { uint16 width = 0; @@ -148,10 +148,10 @@ static void getWord(char *wordBuffer, const char *mainBuffer, uint16 *wordWidth) *wordWidth = width; } -/******************************************************************************/ -/* Gets a line of text for flowText; makes sure that its length is less than */ -/* or equal to the maximum width. */ -/******************************************************************************/ +/** + * Gets a line of text for flowText; makes sure that its length is less than + * or equal to the maximum width. + */ void DisplayMan::getLine(TextFont *tf, char *lineBuffer, const char **mainBuffer, uint16 lineWidth) { uint16 curWidth = 0, wordWidth; char wordBuffer[100]; @@ -181,14 +181,13 @@ void DisplayMan::getLine(TextFont *tf, char *lineBuffer, const char **mainBuffer } } -/******************************************************************************/ -/* Dumps a chunk of text to an arbitrary box; flows it within that box and */ -/* optionally centers it. Returns the number of characters that were */ -/* processed. */ -/* */ -/* Note: Every individual word MUST be int16 enough to fit on a line, and */ -/* each line less than 255 characters. */ -/******************************************************************************/ +/** + * Dumps a chunk of text to an arbitrary box; flows it within that box and + * optionally centers it. Returns the number of characters that were + * processed. + * Note: Every individual word MUST be int16 enough to fit on a line, and + * each line less than 255 characters. + */ uint32 DisplayMan::flowText( void *font, /* the TextAttr pointer */ int16 spacing, /* How much vertical spacing between the lines */ @@ -270,9 +269,9 @@ uint32 DisplayMan::flowTextScaled(void *font, /* the TextAttr pointer */ _vm->_utils->vgaScaleX(x2), _vm->_utils->vgaScaleY(y2), str); } -/******************************************************************************/ -/* Calls flowText, but flows it to memory. Same restrictions as flowText. */ -/******************************************************************************/ +/** + * Calls flowText, but flows it to memory. Same restrictions as flowText. + */ uint32 DisplayMan::flowTextToMem(Image *destIm, void *font, /* the TextAttr pointer */ int16 spacing, /* How much vertical spacing between the lines */ @@ -334,9 +333,9 @@ int32 DisplayMan::longDrawMessage(const char *str) { return flowTextScaled(_vm->_msgFont, 0, 1, 7, false, true, true, true, 6, 155, 313, 195, str); } -/******************************************************************************/ -/* Draws a message to the message box. */ -/******************************************************************************/ +/** + * Draws a message to the message box. + */ void DisplayMan::drawMessage(const char *str) { if (_doNotDrawMessage) { _doNotDrawMessage = false; @@ -362,9 +361,9 @@ void DisplayMan::drawMessage(const char *str) { } } -/******************************************************************************/ -/* Draws the control panel display. */ -/******************************************************************************/ +/** + * Draws the control panel display. + */ void DisplayMan::drawPanel() { _vm->_event->mouseHide(); @@ -415,9 +414,9 @@ void DisplayMan::drawPanel() { _vm->_event->mouseShow(); } -/******************************************************************************/ -/* Sets up the Labyrinth screens, and opens up the initial windows. */ -/******************************************************************************/ +/** + * Sets up the Labyrinth screens, and opens up the initial windows. + */ bool DisplayMan::setUpScreens() { if (!createScreen(_vm->_isHiRes)) return false; @@ -471,16 +470,16 @@ bool DisplayMan::setUpScreens() { return true; } -/*****************************************************************************/ -/* Sets the pen number to use on all the drawing operations. */ -/*****************************************************************************/ +/** + * Sets the pen number to use on all the drawing operations. + */ void DisplayMan::setAPen(byte pennum) { _curapen = pennum; } -/*****************************************************************************/ -/* Fills in a rectangle. */ -/*****************************************************************************/ +/** + * Fills in a rectangle. + */ void DisplayMan::rectFill(uint16 x1, uint16 y1, uint16 x2, uint16 y2) { int w = x2 - x1 + 1; int h = y2 - y1 + 1; @@ -511,16 +510,16 @@ void DisplayMan::rectFillScaled(uint16 x1, uint16 y1, uint16 x2, uint16 y2) { rectFill(_vm->_utils->vgaScaleX(x1), _vm->_utils->vgaScaleY(y1), _vm->_utils->vgaScaleX(x2), _vm->_utils->vgaScaleY(y2)); } -/*****************************************************************************/ -/* Draws a horizontal line. */ -/*****************************************************************************/ +/** + * Draws a horizontal line. + */ void DisplayMan::drawVLine(uint16 x, uint16 y1, uint16 y2) { rectFill(x, y1, x, y2); } -/*****************************************************************************/ -/* Draws a vertical line. */ -/*****************************************************************************/ +/** + * Draws a vertical line. + */ void DisplayMan::drawHLine(uint16 x1, uint16 y, uint16 x2) { rectFill(x1, y, x2, y); } @@ -532,9 +531,9 @@ void DisplayMan::screenUpdate() { _vm->_event->processInput(); } -/*****************************************************************************/ -/* Sets up either a low-res or a high-res 256 color screen. */ -/*****************************************************************************/ +/** + * Sets up either a low-res or a high-res 256 color screen. + */ bool DisplayMan::createScreen(bool hiRes) { if (hiRes) { _screenWidth = 640; @@ -549,10 +548,10 @@ bool DisplayMan::createScreen(bool hiRes) { return true; } -/*****************************************************************************/ -/* Converts an Amiga palette (up to 16 colors) to a VGA palette, then sets */ -/* the VGA palette. */ -/*****************************************************************************/ +/** + * Converts an Amiga palette (up to 16 colors) to a VGA palette, then sets + * the VGA palette. + */ void DisplayMan::setAmigaPal(uint16 *pal, uint16 numColors) { byte vgaPal[16 * 3]; uint16 vgaIdx = 0; @@ -570,17 +569,17 @@ void DisplayMan::setAmigaPal(uint16 *pal, uint16 numColors) { _vm->waitTOF(); } -/*****************************************************************************/ -/* Writes any number of the 256 color registers. */ -/* first: the number of the first color register to write. */ -/* numreg: the number of registers to write */ -/* buf: a char pointer which contains the selected color registers. */ -/* Each value representing a color register occupies 3 bytes in */ -/* the array. The order is red, green then blue. The first byte */ -/* in the array is the red component of the first element selected.*/ -/* The length of the buffer is 3 times the number of registers */ -/* selected. */ -/*****************************************************************************/ +/** + * Writes any number of the 256 color registers. + * first: the number of the first color register to write. + * numreg: the number of registers to write + * buf: a char pointer which contains the selected color registers. + * Each value representing a color register occupies 3 bytes in + * the array. The order is red, green then blue. The first byte + * in the array is the red component of the first element selected. + * The length of the buffer is 3 times the number of registers + * selected. + */ void DisplayMan::writeColorRegs(byte *buf, uint16 first, uint16 numreg) { byte tmp[256 * 3]; @@ -598,9 +597,9 @@ void DisplayMan::setPalette(void *cmap, uint16 numcolors) { writeColorRegs((byte *)cmap, 0, numcolors); } -/*****************************************************************************/ -/* Returns the base address of the current VGA display. */ -/*****************************************************************************/ +/** + * Returns the base address of the current VGA display. + */ byte *DisplayMan::getCurrentDrawingBuffer() { if (_currentDisplayBuffer) return _currentDisplayBuffer; @@ -608,9 +607,9 @@ byte *DisplayMan::getCurrentDrawingBuffer() { return _displayBuffer; } -/*****************************************************************************/ -/* Overlays a region on the screen using the desired pen color. */ -/*****************************************************************************/ +/** + * Overlays a region on the screen using the desired pen color. + */ void DisplayMan::overlayRect(uint16 pencolor, uint16 x1, uint16 y1, uint16 x2, uint16 y2) { int w = x2 - x1 + 1; int h = y2 - y1 + 1; @@ -645,9 +644,9 @@ void DisplayMan::overlayRect(uint16 pencolor, uint16 x1, uint16 y1, uint16 x2, u } } -/*****************************************************************************/ -/* Closes a font and frees all memory associated with it. */ -/*****************************************************************************/ +/** + * Closes a font and frees all memory associated with it. + */ void DisplayMan::closeFont(TextFont *tf) { if (tf) { if (tf->_data && tf->_dataLength) @@ -657,9 +656,9 @@ void DisplayMan::closeFont(TextFont *tf) { } } -/*****************************************************************************/ -/* Returns the length of a text in the specified font. */ -/*****************************************************************************/ +/** + * Returns the length of a text in the specified font. + */ uint16 DisplayMan::textLength(TextFont *tf, const char *text, uint16 numchars) { uint16 length = 0; @@ -673,16 +672,16 @@ uint16 DisplayMan::textLength(TextFont *tf, const char *text, uint16 numchars) { return length; } -/*****************************************************************************/ -/* Returns the height of a specified font. */ -/*****************************************************************************/ +/** + * Returns the height of a specified font. + */ uint16 DisplayMan::textHeight(TextFont *tf) { return (tf) ? tf->_height : 0; } -/*****************************************************************************/ -/* Draws the text to the screen. */ -/*****************************************************************************/ +/** + * Draws the text to the screen. + */ void DisplayMan::text(TextFont *tf, uint16 x, uint16 y, uint16 color, const char *text, uint16 numchars) { byte *VGATop, *VGACur, *VGATemp, *VGATempLine, *cdata; uint32 RealOffset, SegmentOffset; diff --git a/engines/lab/image.cpp b/engines/lab/image.cpp index ab63e96def..29459b1fcc 100644 --- a/engines/lab/image.cpp +++ b/engines/lab/image.cpp @@ -33,9 +33,9 @@ namespace Lab { -/*****************************************************************************/ -/* Reads in an image from disk. */ -/*****************************************************************************/ +/** + * Reads in an image from disk. + */ Image::Image(Common::File *s) { _width = s->readUint16LE(); _height = s->readUint16LE(); @@ -49,9 +49,9 @@ Image::Image(Common::File *s) { s->read(_imageData, size); } -/*****************************************************************************/ -/* Blits a piece of one image to another. */ -/*****************************************************************************/ +/** + * Blits a piece of one image to another. + */ void Image::blitBitmap(uint16 xs, uint16 ys, Image *imDest, uint16 xd, uint16 yd, uint16 width, uint16 height, byte masked) { int w = width; @@ -96,23 +96,23 @@ void Image::blitBitmap(uint16 xs, uint16 ys, Image *imDest, } } -/*****************************************************************************/ -/* Draws an image to the screen. */ -/*****************************************************************************/ +/** + * Draws an image to the screen. + */ void Image::drawImage(uint16 x, uint16 y) { blitBitmap(0, 0, NULL, x, y, _width, _height, false); } -/*****************************************************************************/ -/* Draws an image to the screen with transparency. */ -/*****************************************************************************/ +/** + * Draws an image to the screen with transparency. + */ void Image::drawMaskImage(uint16 x, uint16 y) { blitBitmap(0, 0, NULL, x, y, _width, _height, true); } -/*****************************************************************************/ -/* Reads an image from the screen. */ -/*****************************************************************************/ +/** + * Reads an image from the screen. + */ void Image::readScreenImage(uint16 x, uint16 y) { int w = _width; int h = _height; diff --git a/engines/lab/interface.cpp b/engines/lab/interface.cpp index 4e514ea652..ade5f69a9e 100644 --- a/engines/lab/interface.cpp +++ b/engines/lab/interface.cpp @@ -62,9 +62,9 @@ void freeButtonList(GadgetList *gadgetList) { gadgetList->clear(); } -/*****************************************************************************/ -/* Draws a gadget list to the screen. */ -/*****************************************************************************/ +/** + * Draws a gadget list to the screen. + */ void drawGadgetList(GadgetList *gadgetList) { for (GadgetList::iterator gadget = gadgetList->begin(); gadget != gadgetList->end(); ++gadget) { (*gadget)->_image->drawImage((*gadget)->x, (*gadget)->y); @@ -74,25 +74,25 @@ void drawGadgetList(GadgetList *gadgetList) { } } -/*****************************************************************************/ -/* Dims a gadget, and makes it unavailable for using. */ -/*****************************************************************************/ +/** + * Dims a gadget, and makes it unavailable for using. + */ void disableGadget(Gadget *curgad, uint16 pencolor) { g_lab->_graphics->overlayRect(pencolor, curgad->x, curgad->y, curgad->x + curgad->_image->_width - 1, curgad->y + curgad->_image->_height - 1); curgad->_flags |= GADGETOFF; } -/*****************************************************************************/ -/* Undims a gadget, and makes it available again. */ -/*****************************************************************************/ +/** + * Undims a gadget, and makes it available again. + */ void enableGadget(Gadget *curgad) { curgad->_image->drawImage(curgad->x, curgad->y); curgad->_flags &= !(GADGETOFF); } -/*****************************************************************************/ -/* Make a key press have the right case for a gadget KeyEquiv value. */ -/*****************************************************************************/ +/** + * Make a key press have the right case for a gadget KeyEquiv value. + */ uint16 makeGadgetKeyEquiv(uint16 key) { if (Common::isAlnum(key)) key = tolower(key); @@ -100,10 +100,10 @@ uint16 makeGadgetKeyEquiv(uint16 key) { return key; } -/*****************************************************************************/ -/* Checks whether or not the coords fall within one of the gadgets in a list */ -/* of gadgets. */ -/*****************************************************************************/ +/** + * Checks whether or not the coords fall within one of the gadgets in a list + * of gadgets. + */ Gadget *LabEngine::checkNumGadgetHit(GadgetList *gadgetList, uint16 key) { uint16 gkey = key - '0'; diff --git a/engines/lab/intro.cpp b/engines/lab/intro.cpp index 2af4f448a2..b75a215025 100644 --- a/engines/lab/intro.cpp +++ b/engines/lab/intro.cpp @@ -37,10 +37,10 @@ Intro::Intro(LabEngine *vm) : _vm(vm) { _quitIntro = false; } -/******************************************************************************/ -/* Goes through, and responds to all the intuition messages currently in the */ -/* message queue. */ -/******************************************************************************/ +/** + * Goes through, and responds to all the intuition messages currently in the + * message queue. + */ void Intro::introEatMessages() { while (1) { IntuiMessage *msg = _vm->getMsg(); @@ -61,9 +61,9 @@ void Intro::introEatMessages() { } } -/*****************************************************************************/ -/* Reads in a picture. */ -/*****************************************************************************/ +/** + * Reads in a picture. + */ void Intro::doPictText(const char *filename, TextFont *msgFont, bool isScreen) { char path[50] = "Lab:rooms/Intro/"; strcat(path, filename); @@ -200,9 +200,9 @@ void Intro::doPictText(const char *filename, TextFont *msgFont, bool isScreen) { } // while(1) } -/*****************************************************************************/ -/* Does a one second delay, but checks the music while doing it. */ -/*****************************************************************************/ +/** + * Does a one second delay, but checks the music while doing it. + */ void Intro::musicDelay() { _vm->_music->updateMusic(); @@ -231,9 +231,9 @@ void Intro::nReadPict(const char *filename, bool playOnce) { _vm->_graphics->readPict(finalFileName.c_str(), playOnce); } -/*****************************************************************************/ -/* Does the introduction sequence for Labyrinth. */ -/*****************************************************************************/ +/** + * Does the introduction sequence for Labyrinth. + */ void Intro::introSequence() { uint16 palette[16] = { 0x0000, 0x0855, 0x0FF9, 0x0EE7, diff --git a/engines/lab/map.cpp b/engines/lab/map.cpp index 405d7b82ea..b86e2b6846 100644 --- a/engines/lab/map.cpp +++ b/engines/lab/map.cpp @@ -80,9 +80,9 @@ static uint16 mapScaleY(uint16 y) { return ((y - 35) >> 1) - (y >> 6); } -/*****************************************************************************/ -/* Loads in the map data. */ -/*****************************************************************************/ +/** + * Loads in the map data. + */ static bool loadMapData() { uint16 counter; @@ -156,9 +156,9 @@ static void freeMapData() { Maps = NULL; } -/*****************************************************************************/ -/* Figures out what a room's coordinates should be. */ -/*****************************************************************************/ +/** + * Figures out what a room's coordinates should be. + */ static void roomCoords(uint16 CurRoom, uint16 *x1, uint16 *y1, uint16 *x2, uint16 *y2) { Image *curRoomImg = NULL; @@ -193,9 +193,9 @@ static void roomCoords(uint16 CurRoom, uint16 *x1, uint16 *y1, uint16 *x2, uint1 } } -/*****************************************************************************/ -/* Draws a room to the bitmap. */ -/*****************************************************************************/ +/** + * Draws a room to the bitmap. + */ static void drawRoom(uint16 CurRoom, bool drawx) { uint16 x, y, xx, xy, offset; uint32 flags; @@ -328,9 +328,9 @@ static void drawRoom(uint16 CurRoom, bool drawx) { XMark->drawImage(xx, xy); } -/*****************************************************************************/ -/* Checks if a floor has been visitted. */ -/*****************************************************************************/ +/** + * Checks if a floor has been visitted. + */ static bool onFloor(uint16 Floor) { for (uint16 i = 1; i <= MaxRooms; i++) { if ((Maps[i].PageNumber == Floor) && g_lab->_roomsFound->in(i) && Maps[i].x) @@ -340,9 +340,9 @@ static bool onFloor(uint16 Floor) { return false; } -/*****************************************************************************/ -/* Figures out which floor, if any, should be gone to if the up arrow is hit */ -/*****************************************************************************/ +/** + * Figures out which floor, if any, should be gone to if the up arrow is hit + */ static void getUpFloor(uint16 *Floor, bool *isfloor) { do { *isfloor = true; @@ -357,10 +357,10 @@ static void getUpFloor(uint16 *Floor, bool *isfloor) { } while ((!onFloor(*Floor)) && (*Floor <= CARNIVAL)); } -/*****************************************************************************/ -/* Figures out which floor, if any, should be gone to if the down arrow is */ -/* hit. */ -/*****************************************************************************/ +/** + * Figures out which floor, if any, should be gone to if the down arrow is + * hit. + */ static void getDownFloor(uint16 *Floor, bool *isfloor) { do { *isfloor = true; @@ -388,9 +388,9 @@ static void getDownFloor(uint16 *Floor, bool *isfloor) { } while ((!onFloor(*Floor)) && *Floor); } -/*****************************************************************************/ -/* Draws the map */ -/*****************************************************************************/ +/** + * Draws the map + */ void LabEngine::drawMap(uint16 CurRoom, uint16 CurMsg, uint16 Floor, bool fadeout, bool fadein) { char *sptr; @@ -468,9 +468,9 @@ void LabEngine::drawMap(uint16 CurRoom, uint16 CurMsg, uint16 Floor, bool fadeou _event->mouseShow(); } -/*****************************************************************************/ -/* Processes the map. */ -/*****************************************************************************/ +/** + * Processes the map. + */ void LabEngine::processMap(uint16 CurRoom) { uint32 Class, place = 1; uint16 Code, Qualifier, MouseX, MouseY, GadgetID, CurFloor, OldFloor, OldMsg, CurMsg, x1, y1, x2, y2; @@ -629,9 +629,9 @@ void LabEngine::processMap(uint16 CurRoom) { } } -/*****************************************************************************/ -/* Does the map processing. */ -/*****************************************************************************/ +/** + * Does the map processing. + */ void LabEngine::doMap(uint16 CurRoom) { static uint16 AmigaMapPalette[] = { 0x0BA8, 0x0C11, 0x0A74, 0x0076, diff --git a/engines/lab/music.cpp b/engines/lab/music.cpp index 8fd88ff3e6..1c043efdb7 100644 --- a/engines/lab/music.cpp +++ b/engines/lab/music.cpp @@ -62,10 +62,10 @@ Music::Music(LabEngine *vm) : _vm(vm) { _waitTillFinished = false; } -/*****************************************************************************/ -/* Figures out which buffer is currently playing based on messages sent to */ -/* it from the Audio device. */ -/*****************************************************************************/ +/** + * Figures out which buffer is currently playing based on messages sent to + * it from the Audio device. + */ void Music::updateMusic() { _vm->_event->processInput(); _vm->_event->updateMouse(); @@ -143,9 +143,9 @@ void Music::fillbuffer(byte *musicBuffer) { } } -/*****************************************************************************/ -/* Starts up the music initially. */ -/*****************************************************************************/ +/** + * Starts up the music initially. + */ void Music::startMusic(bool restartFl) { if (!_musicOn) return; @@ -161,9 +161,9 @@ void Music::startMusic(bool restartFl) { updateMusic(); } -/*****************************************************************************/ -/* Initializes the music buffers. */ -/*****************************************************************************/ +/** + * Initializes the music buffers. + */ bool Music::initMusic() { _musicOn = true; _musicPaused = false; @@ -180,9 +180,9 @@ bool Music::initMusic() { return true; } -/*****************************************************************************/ -/* Frees up the music buffers and closes the file. */ -/*****************************************************************************/ +/** + * Frees up the music buffers and closes the file. + */ void Music::freeMusic() { _musicOn = false; @@ -195,9 +195,9 @@ void Music::freeMusic() { _file = NULL; } -/*****************************************************************************/ -/* Pauses the background music. */ -/*****************************************************************************/ +/** + * Pauses the background music. + */ void Music::pauseBackMusic() { if (!_musicPaused && _musicOn) { updateMusic(); @@ -210,9 +210,9 @@ void Music::pauseBackMusic() { } } -/*****************************************************************************/ -/* Resumes the paused background music. */ -/*****************************************************************************/ +/** + * Resumes the paused background music. + */ void Music::resumeBackMusic() { if (_musicPaused) { stopSoundEffect(); @@ -225,9 +225,9 @@ void Music::resumeBackMusic() { } } -/*****************************************************************************/ -/* Turns the music on and off. */ -/*****************************************************************************/ +/** + * Turns the music on and off. + */ void Music::setMusic(bool on) { stopSoundEffect(); @@ -241,9 +241,9 @@ void Music::setMusic(bool on) { _musicOn = on; } -/******************************************************************************/ -/* Checks the music that should be playing in a particular room. */ -/******************************************************************************/ +/** + * Checks the music that should be playing in a particular room. + */ void Music::checkRoomMusic() { if ((_lastMusicRoom == _vm->_roomNum) || !_musicOn) return; @@ -258,9 +258,9 @@ void Music::checkRoomMusic() { _lastMusicRoom = _vm->_roomNum; } -/*****************************************************************************/ -/* Changes the background music to something else. */ -/*****************************************************************************/ +/** + * Changes the background music to something else. + */ void Music::changeMusic(const char *newmusic) { if (!_tFile) { _tFile = _file; @@ -278,9 +278,9 @@ void Music::changeMusic(const char *newmusic) { setMusic(true); } -/*****************************************************************************/ -/* Changes the background music to the original piece playing. */ -/*****************************************************************************/ +/** + * Changes the background music to the original piece playing. + */ void Music::resetMusic() { if (!_tFile) return; @@ -308,9 +308,9 @@ void Music::resetMusic() { _tFile = 0; } -/*****************************************************************************/ -/* Reads in a music file. Ignores any graphics. */ -/*****************************************************************************/ +/** + * Reads in a music file. Ignores any graphics. + */ bool Music::readMusic(const char *filename, bool waitTillFinished) { Common::File *file = _vm->_resource->openDataFile(filename, MKTAG('D', 'I', 'F', 'F')); updateMusic(); diff --git a/engines/lab/savegame.cpp b/engines/lab/savegame.cpp index bf3f8a4504..10f52a2582 100644 --- a/engines/lab/savegame.cpp +++ b/engines/lab/savegame.cpp @@ -113,9 +113,9 @@ bool readSaveGameHeader(Common::InSaveFile *in, SaveGameHeader &header) { return true; } -/*****************************************************************************/ -/* Writes the game out to disk. */ -/*****************************************************************************/ +/** + * Writes the game out to disk. + */ bool saveGame(uint16 Direction, uint16 Quarters, int slot, Common::String desc) { uint16 i, j; Common::String fileName = g_lab->generateSaveFileName(slot); @@ -164,9 +164,9 @@ bool saveGame(uint16 Direction, uint16 Quarters, int slot, Common::String desc) return true; } -/*****************************************************************************/ -/* Reads the game from disk. */ -/*****************************************************************************/ +/** + * Reads the game from disk. + */ bool loadGame(uint16 *Direction, uint16 *Quarters, int slot) { uint16 i, j; Common::String fileName = g_lab->generateSaveFileName(slot); diff --git a/engines/lab/special.cpp b/engines/lab/special.cpp index 0d92772a39..62d45d12b3 100644 --- a/engines/lab/special.cpp +++ b/engines/lab/special.cpp @@ -92,9 +92,9 @@ static byte *loadBackPict(const char *fileName, bool tomem) { return res; } -/*****************************************************************************/ -/* Does the things to properly set up the detective notes. */ -/*****************************************************************************/ +/** + * Does the things to properly set up the detective notes. + */ void LabEngine::doNotes() { TextFont *noteFont = g_lab->_resource->getFont("P:Note.fon"); char *ntext = g_lab->_resource->getText("Lab:Rooms/Notes"); @@ -107,10 +107,10 @@ void LabEngine::doNotes() { } -/*****************************************************************************/ -/* Does the things to properly set up the old west newspaper. Assumes that */ -/* OpenHiRes already called. */ -/*****************************************************************************/ +/** + * Does the things to properly set up the old west newspaper. Assumes that + * OpenHiRes already called. + */ void LabEngine::doWestPaper() { char *ntext; TextFont *paperFont; @@ -147,9 +147,9 @@ void LabEngine::doWestPaper() { g_lab->_graphics->setPalette(g_lab->_anim->_diffPalette, 256); } -/*****************************************************************************/ -/* Loads in the data for the journal. */ -/*****************************************************************************/ +/** + * Loads in the data for the journal. + */ static bool loadJournalData() { char filename[20]; bool bridge, dirty, news, clean; @@ -223,9 +223,9 @@ static bool loadJournalData() { return true; } -/*****************************************************************************/ -/* Draws the text to the back journal screen to the appropriate Page number */ -/*****************************************************************************/ +/** + * Draws the text to the back journal screen to the appropriate Page number + */ static void drawJournalText() { uint16 DrawingToPage = 1; int32 CharsDrawn = 0L; @@ -261,9 +261,9 @@ static void drawJournalText() { lastpage = lastpage || (*CurText == 0); } -/*****************************************************************************/ -/* Does the turn page wipe. */ -/*****************************************************************************/ +/** + * Does the turn page wipe. + */ static void turnPage(bool FromLeft) { if (FromLeft) { for (int i = 0; i < g_lab->_graphics->_screenWidth; i += 8) { @@ -282,9 +282,9 @@ static void turnPage(bool FromLeft) { } } -/*****************************************************************************/ -/* Draws the journal from page x. */ -/*****************************************************************************/ +/** + * Draws the journal from page x. + */ void LabEngine::drawJournal(uint16 wipenum, bool needFade) { _event->mouseHide(); @@ -326,9 +326,9 @@ void LabEngine::drawJournal(uint16 wipenum, bool needFade) { g_lab->_anim->_noPalChange = false; } -/*****************************************************************************/ -/* Processes user input. */ -/*****************************************************************************/ +/** + * Processes user input. + */ void LabEngine::processJournal() { IntuiMessage *Msg; uint32 Class; @@ -368,9 +368,9 @@ void LabEngine::processJournal() { } } -/*****************************************************************************/ -/* Does the journal processing. */ -/*****************************************************************************/ +/** + * Does the journal processing. + */ void LabEngine::doJournal() { GadgetList journalGadgetList; journalGadgetList.push_back(&BackG); @@ -449,9 +449,9 @@ bool LabEngine::saveRestoreGame() { return isOK; } -/*****************************************************************************/ -/* Draws the text for the monitor. */ -/*****************************************************************************/ +/** + * Draws the text for the monitor. + */ void LabEngine::drawMonText(char *text, TextFont *monitorFont, uint16 x1, uint16 y1, uint16 x2, uint16 y2, bool isinteractive) { uint16 DrawingToPage = 0, yspacing = 0, numlines, fheight; int32 CharsDrawn = 0L; @@ -509,9 +509,9 @@ void LabEngine::drawMonText(char *text, TextFont *monitorFont, uint16 x1, uint16 _event->mouseShow(); } -/*****************************************************************************/ -/* Processes user input. */ -/*****************************************************************************/ +/** + * Processes user input. + */ void LabEngine::processMonitor(char *ntext, TextFont *monitorFont, bool isinteractive, uint16 x1, uint16 y1, uint16 x2, uint16 y2) { IntuiMessage *Msg; uint32 Class; @@ -603,9 +603,9 @@ void LabEngine::processMonitor(char *ntext, TextFont *monitorFont, bool isintera } } -/*****************************************************************************/ -/* Does what's necessary for the monitor. */ -/*****************************************************************************/ +/** + * Does what's necessary for the monitor. + */ void LabEngine::doMonitor(char *background, char *textfile, bool isinteractive, uint16 x1, uint16 y1, uint16 x2, uint16 y2) { char *ntext; diff --git a/engines/lab/tilepuzzle.cpp b/engines/lab/tilepuzzle.cpp index 4d95d4c4b5..c6997c5ed2 100644 --- a/engines/lab/tilepuzzle.cpp +++ b/engines/lab/tilepuzzle.cpp @@ -62,9 +62,9 @@ void LabEngine::initTilePuzzle() { _combination[i] = 0; } -/*****************************************************************************/ -/* Processes mouse clicks and changes the combination. */ -/*****************************************************************************/ +/** + * Processes mouse clicks and changes the combination. + */ void LabEngine::mouseTile(Common::Point pos) { Common::Point realPos = _utils->vgaUnscale(pos); @@ -78,9 +78,9 @@ void LabEngine::mouseTile(Common::Point pos) { changeTile(tileX, tileY); } -/*****************************************************************************/ -/* Changes the combination number of one of the slots */ -/*****************************************************************************/ +/** + * Changes the combination number of one of the slots + */ void LabEngine::changeTile(uint16 col, uint16 row) { int16 scrolltype = -1; @@ -147,9 +147,9 @@ void LabEngine::changeTile(uint16 col, uint16 row) { } } -/*****************************************************************************/ -/* Processes mouse clicks and changes the combination. */ -/*****************************************************************************/ +/** + * Processes mouse clicks and changes the combination. + */ void LabEngine::mouseCombination(Common::Point pos) { Common::Point realPos = _utils->vgaUnscale(pos); @@ -173,9 +173,9 @@ void LabEngine::mouseCombination(Common::Point pos) { changeCombination(number); } -/*****************************************************************************/ -/* Draws the images of the combination lock to the display bitmap. */ -/*****************************************************************************/ +/** + * Draws the images of the combination lock to the display bitmap. + */ void LabEngine::doTile(bool showsolution) { uint16 row = 0, col = 0, rowm, colm, num; int16 rows, cols; @@ -215,9 +215,9 @@ void LabEngine::doTile(bool showsolution) { } } -/*****************************************************************************/ -/* Reads in a backdrop picture. */ -/*****************************************************************************/ +/** + * Reads in a backdrop picture. + */ void LabEngine::showTile(const char *filename, bool showsolution) { uint16 start = showsolution ? 0 : 1; @@ -238,9 +238,9 @@ void LabEngine::showTile(const char *filename, bool showsolution) { _graphics->setPalette(_anim->_diffPalette, 256); } -/*****************************************************************************/ -/* Does the scrolling for the tiles on the tile puzzle. */ -/*****************************************************************************/ +/** + * Does the scrolling for the tiles on the tile puzzle. + */ void LabEngine::doTileScroll(uint16 col, uint16 row, uint16 scrolltype) { int16 dX = 0, dY = 0, dx = 0, dy = 0, sx = 0, sy = 0; uint16 last = 0; @@ -278,9 +278,9 @@ void LabEngine::doTileScroll(uint16 col, uint16 row, uint16 scrolltype) { } } -/*****************************************************************************/ -/* Changes the combination number of one of the slots */ -/*****************************************************************************/ +/** + * Changes the combination number of one of the slots + */ void LabEngine::changeCombination(uint16 number) { static const int solution[6] = { 0, 4, 0, 8, 7, 2 }; @@ -328,17 +328,17 @@ void LabEngine::scrollRaster(int16 dx, int16 dy, uint16 x1, uint16 y1, uint16 x2 _graphics->scrollDisplayY(dy, x1, y1, x2, y2); } -/*****************************************************************************/ -/* Draws the images of the combination lock to the display bitmap. */ -/*****************************************************************************/ +/** + * Draws the images of the combination lock to the display bitmap. + */ void LabEngine::doCombination() { for (uint16 i = 0; i <= 5; i++) _numberImages[_combination[i]]->drawImage(_utils->vgaScaleX(COMBINATION_X[i]), _utils->vgaScaleY(65)); } -/*****************************************************************************/ -/* Reads in a backdrop picture. */ -/*****************************************************************************/ +/** + * Reads in a backdrop picture. + */ void LabEngine::showCombination(const char *filename) { _anim->_doBlack = true; _anim->_noPalChange = true; diff --git a/engines/lab/timing.cpp b/engines/lab/timing.cpp index 63a2b946bc..1cbe6d328a 100644 --- a/engines/lab/timing.cpp +++ b/engines/lab/timing.cpp @@ -32,12 +32,11 @@ namespace Lab { -/*****************************************************************************/ -/* Waits for for Secs seconds and Micros microseconds to pass. */ -/*****************************************************************************/ +/** + * Waits for for Secs seconds and Micros microseconds to pass. + */ void LabEngine::microDelay(uint32 secs, uint32 micros) { uint32 waitSecs, waitMicros; - addCurTime(secs, micros, &waitSecs, &waitMicros); while (1) { @@ -50,9 +49,9 @@ void LabEngine::microDelay(uint32 secs, uint32 micros) { } } -/*****************************************************************************/ -/* Gets the current system time. */ -/*****************************************************************************/ +/** + * Gets the current system time. + */ void LabEngine::getTime(uint32 *secs, uint32 *micros) { uint32 t = g_system->getMillis(); @@ -60,9 +59,9 @@ void LabEngine::getTime(uint32 *secs, uint32 *micros) { *micros = t % 1000; } -/*****************************************************************************/ -/* Adds seconds and microseconds to current time to get a new time. */ -/*****************************************************************************/ +/** + * Adds seconds and microseconds to current time to get a new time. + */ void LabEngine::addCurTime(uint32 sec, uint32 micros, uint32 *timeSec, uint32 *timeMicros) { getTime(timeSec, timeMicros); @@ -75,10 +74,10 @@ void LabEngine::addCurTime(uint32 sec, uint32 micros, uint32 *timeSec, uint32 *t } } -/*****************************************************************************/ -/* Finds the difference between time1 and time2. If time1 is later than */ -/* time2, returns 0. */ -/*****************************************************************************/ +/** + * Finds the difference between time1 and time2. If time1 is later than + * time2, returns 0. + */ void LabEngine::anyTimeDiff(uint32 sec1, uint32 micros1, uint32 sec2, uint32 micros2, uint32 *diffSecs, uint32 *diffMicros) { *diffSecs = 0; *diffMicros = 0; @@ -97,22 +96,21 @@ void LabEngine::anyTimeDiff(uint32 sec1, uint32 micros1, uint32 sec2, uint32 mic } } -/*****************************************************************************/ -/* Finds the difference between the current time, and a future time. Returns */ -/* 0 if the future time is actually before the current time. */ -/*****************************************************************************/ +/** + * Finds the difference between the current time, and a future time. Returns + * 0 if the future time is actually before the current time. + */ void LabEngine::timeDiff(uint32 sec, uint32 micros, uint32 *diffSec, uint32 *diffMicros) { uint32 curSec, curMicros; getTime(&curSec, &curMicros); anyTimeDiff(curSec, curMicros, sec, micros, diffSec, diffMicros); } -/*****************************************************************************/ -/* Waits for a specified time to occur. */ -/*****************************************************************************/ +/** + * Waits for a specified time to occur. + */ void LabEngine::waitForTime(uint32 sec, uint32 micros) { uint32 curSec, curMicros; - getTime(&curSec, &curMicros); if (curSec > sec) diff --git a/engines/lab/transitions.cpp b/engines/lab/transitions.cpp index 7090181d32..6f90718eda 100644 --- a/engines/lab/transitions.cpp +++ b/engines/lab/transitions.cpp @@ -34,9 +34,9 @@ namespace Lab { -/*****************************************************************************/ -/* Scrolls the display to black. */ -/*****************************************************************************/ +/** + * Scrolls the display to black. + */ void DisplayMan::doScrollBlack() { byte *tempmem; Image im; @@ -132,9 +132,9 @@ void DisplayMan::copyPage(uint16 width, uint16 height, uint16 nheight, uint16 st } } -/*****************************************************************************/ -/* Scrolls the display to a new picture from a black screen. */ -/*****************************************************************************/ +/** + * Scrolls the display to a new picture from a black screen. + */ void DisplayMan::doScrollWipe(char *filename) { uint16 startline = 0, onrow = 0; @@ -189,9 +189,9 @@ void DisplayMan::doScrollWipe(char *filename) { _vm->_event->mouseShow(); } -/*****************************************************************************/ -/* Does the scroll bounce. Assumes bitmap already in memory. */ -/*****************************************************************************/ +/** + * Does the scroll bounce. Assumes bitmap already in memory. + */ void DisplayMan::doScrollBounce() { const uint16 *newby, *newby1; @@ -235,9 +235,9 @@ void DisplayMan::doScrollBounce() { _vm->_event->mouseShow(); } -/*****************************************************************************/ -/* Does the transporter wipe. */ -/*****************************************************************************/ +/** + * Does the transporter wipe. + */ void DisplayMan::doTransWipe(CloseDataPtr *cPtr, char *filename) { uint16 lastY, curY, linesdone = 0, lineslast; Image imSource, imDest; @@ -318,9 +318,9 @@ void DisplayMan::doTransWipe(CloseDataPtr *cPtr, char *filename) { } // for j } -/*****************************************************************************/ -/* Does a certain number of pre-programmed wipes. */ -/*****************************************************************************/ +/** + * Does a certain number of pre-programmed wipes. + */ void DisplayMan::doTransition(TransitionType transitionType, CloseDataPtr *cPtr, char *filename) { switch (transitionType) { case kTransitionWipe: @@ -348,9 +348,9 @@ void DisplayMan::doTransition(TransitionType transitionType, CloseDataPtr *cPtr, } } -/*****************************************************************************/ -/* Changes the front screen to black. */ -/*****************************************************************************/ +/** + * Changes the front screen to black. + */ void DisplayMan::blackScreen() { byte pal[256 * 3]; memset(pal, 0, 248 * 3); @@ -359,18 +359,18 @@ void DisplayMan::blackScreen() { g_system->delayMillis(32); } -/*****************************************************************************/ -/* Changes the front screen to white. */ -/*****************************************************************************/ +/** + * Changes the front screen to white. + */ void DisplayMan::whiteScreen() { byte pal[256 * 3]; memset(pal, 255, 248 * 3); writeColorRegs(pal, 8, 248); } -/*****************************************************************************/ -/* Changes the entire screen to black. */ -/*****************************************************************************/ +/** + * Changes the entire screen to black. +*/ void DisplayMan::blackAllScreen() { byte pal[256 * 3]; memset(pal, 0, 256 * 3); @@ -379,11 +379,11 @@ void DisplayMan::blackAllScreen() { g_system->delayMillis(32); } -/*****************************************************************************/ -/* Scrolls the display in the x direction by blitting. */ -/* The _tempScrollData variable must be initialized to some memory, or this */ -/* function will fail. */ -/*****************************************************************************/ +/** + * Scrolls the display in the x direction by blitting. + * The _tempScrollData variable must be initialized to some memory, or this + * function will fail. + */ void DisplayMan::scrollDisplayX(int16 dx, uint16 x1, uint16 y1, uint16 x2, uint16 y2) { Image im; @@ -405,9 +405,9 @@ void DisplayMan::scrollDisplayX(int16 dx, uint16 x1, uint16 y1, uint16 x2, uint1 rectFill(x1, y1, x1 + dx - 1, y2); } -/*****************************************************************************/ -/* Scrolls the display in the y direction by blitting. */ -/*****************************************************************************/ +/** + * Scrolls the display in the y direction by blitting. + */ void DisplayMan::scrollDisplayY(int16 dy, uint16 x1, uint16 y1, uint16 x2, uint16 y2) { Image im; @@ -429,9 +429,9 @@ void DisplayMan::scrollDisplayY(int16 dy, uint16 x1, uint16 y1, uint16 x2, uint1 rectFill(x1, y1, x2, y1 + dy - 1); } -/*****************************************************************************/ -/* Does the fading of the Palette on the screen. */ -/*****************************************************************************/ +/** + * Does the fading of the Palette on the screen. + */ uint16 DisplayMan::fadeNumIn(uint16 num, uint16 res, uint16 counter) { return (num - ((((int32)(15 - counter)) * ((int32)(num - res))) / 15)); } diff --git a/engines/lab/utils.cpp b/engines/lab/utils.cpp index 041a970eff..d5d0734268 100644 --- a/engines/lab/utils.cpp +++ b/engines/lab/utils.cpp @@ -36,10 +36,10 @@ Utils::Utils(LabEngine *vm) : _vm(vm) { _dataBytesPerRow = 0; } -/*****************************************************************************/ -/* Scales the x co-ordinates to that of the new display. In the room parser */ -/* file, co-ordinates are set up on a 360x336 display. */ -/*****************************************************************************/ +/** + * Scales the x co-ordinates to that of the new display. In the room parser + * file, co-ordinates are set up on a 360x336 display. + */ uint16 Utils::scaleX(uint16 x) { if (_vm->_isHiRes) return (uint16)((x * 16) / 9); @@ -47,10 +47,10 @@ uint16 Utils::scaleX(uint16 x) { return (uint16)((x * 8) / 9); } -/*****************************************************************************/ -/* Scales the y co-ordinates to that of the new display. In the room parser */ -/* file, co-ordinates are set up on a 368x336 display. */ -/*****************************************************************************/ +/** + * Scales the y co-ordinates to that of the new display. In the room parser + * file, co-ordinates are set up on a 368x336 display. + */ uint16 Utils::scaleY(uint16 y) { if (_vm->_isHiRes) return (y + (y / 14)); @@ -58,9 +58,9 @@ uint16 Utils::scaleY(uint16 y) { return ((y * 10) / 24); } -/*****************************************************************************/ -/* Scales the VGA coords to SVGA if necessary; otherwise, returns VGA coords.*/ -/*****************************************************************************/ +/** + * Scales the VGA coords to SVGA if necessary; otherwise, returns VGA coords. + */ int16 Utils::vgaScaleX(int16 x) { if (_vm->_isHiRes) return (x * 2); @@ -68,9 +68,9 @@ int16 Utils::vgaScaleX(int16 x) { return x; } -/*****************************************************************************/ -/* Scales the VGA coords to SVGA if necessary; otherwise, returns VGA coords.*/ -/*****************************************************************************/ +/** + * Scales the VGA coords to SVGA if necessary; otherwise, returns VGA coords. + */ int16 Utils::vgaScaleY(int16 y) { if (_vm->_isHiRes) return ((y * 12) / 5); @@ -85,9 +85,9 @@ uint16 Utils::svgaCord(uint16 cord) { return 0; } -/*****************************************************************************/ -/* Converts SVGA coords to VGA if necessary, otherwise returns VGA coords. */ -/*****************************************************************************/ +/** + * Converts SVGA coords to VGA if necessary, otherwise returns VGA coords. + */ Common::Point Utils::vgaUnscale(Common::Point pos) { Common::Point result; if (_vm->_isHiRes) { @@ -100,10 +100,10 @@ Common::Point Utils::vgaUnscale(Common::Point pos) { return result; } -/*****************************************************************************/ -/* Undiffs a piece of memory when header size is a byte, and copy/skip size */ -/* is also a byte. */ -/*****************************************************************************/ +/** + * Undiffs a piece of memory when header size is a byte, and copy/skip size + * is also a byte. + */ void Utils::unDiffByteByte(byte *dest, byte *diff) { uint16 skip, copy; @@ -130,10 +130,10 @@ void Utils::unDiffByteByte(byte *dest, byte *diff) { } } -/*****************************************************************************/ -/* Undiffs a piece of memory when header size is a byte, and copy/skip size */ -/* is a word. */ -/*****************************************************************************/ +/** + * Undiffs a piece of memory when header size is a byte, and copy/skip size + * is a word. + */ void Utils::unDiffByteWord(uint16 *dest, uint16 *diff) { uint16 skip, copy; @@ -186,10 +186,10 @@ void Utils::unDiffByteWord(uint16 *dest, uint16 *diff) { /*------------------------- unDiff Vertical Memory --------------------------*/ -/*****************************************************************************/ -/* Undiffs a piece of memory when header size is a byte, and copy/skip size */ -/* is a byte. */ -/*****************************************************************************/ +/** + * Undiffs a piece of memory when header size is a byte, and copy/skip size + * is a byte. + */ void Utils::VUnDiffByteByte(byte *dest, byte *diff, uint16 bytesPerRow) { byte *curPtr; uint16 skip, copy; @@ -224,10 +224,10 @@ void Utils::VUnDiffByteByte(byte *dest, byte *diff, uint16 bytesPerRow) { } } -/*****************************************************************************/ -/* Undiffs a piece of memory when header size is a byte, and copy/skip size */ -/* is a word. */ -/*****************************************************************************/ +/** + * Undiffs a piece of memory when header size is a byte, and copy/skip size + * is a word. + */ void Utils::VUnDiffByteWord(uint16 *dest, uint16 *diff, uint16 bytesPerRow) { uint16 *curPtr; uint16 skip, copy; @@ -264,10 +264,10 @@ void Utils::VUnDiffByteWord(uint16 *dest, uint16 *diff, uint16 bytesPerRow) { } } -/*****************************************************************************/ -/* Undiffs a piece of memory when header size is a byte, and copy/skip size */ -/* is a long. */ -/*****************************************************************************/ +/** + * Undiffs a piece of memory when header size is a byte, and copy/skip size + * is a long. + */ void Utils::VUnDiffByteLong(uint32 *dest, uint32 *diff, uint16 bytesPerRow) { uint32 *_curPtr; uint16 skip, copy; @@ -307,9 +307,9 @@ void Utils::VUnDiffByteLong(uint32 *dest, uint32 *diff, uint16 bytesPerRow) { } } -/*****************************************************************************/ -/* Runlength decodes a chunk of memory. */ -/*****************************************************************************/ +/** + * Runlength decodes a chunk of memory. + */ void Utils::runLengthDecode(byte *dest, byte *source) { int8 num; int16 count; @@ -338,9 +338,9 @@ void Utils::runLengthDecode(byte *dest, byte *source) { } } -/*****************************************************************************/ -/* Does a vertical run length decode. */ -/*****************************************************************************/ +/** + * Does a vertical run length decode. + */ void Utils::VRunLengthDecode(byte *dest, byte *source, uint16 bytesPerRow) { int8 num; int16 count; @@ -379,9 +379,9 @@ void Utils::VRunLengthDecode(byte *dest, byte *source, uint16 bytesPerRow) { } } -/*****************************************************************************/ -/* Does the undiffing between the bitmaps. */ -/*****************************************************************************/ +/** + * Does the undiffing between the bitmaps. + */ void Utils::unDiff(byte *newBuf, byte *oldBuf, byte *diffData, uint16 bytesPerRow, bool isV) { diffData++; byte bufType = *diffData; -- cgit v1.2.3 From 21fc36bfad679426f19e77c4d783ba809038735c Mon Sep 17 00:00:00 2001 From: Filippos Karapetis Date: Tue, 8 Dec 2015 11:29:23 +0200 Subject: LAB: Get rid of _isBM --- engines/lab/anim.cpp | 19 +++++++++---------- engines/lab/anim.h | 7 +++---- engines/lab/graphics.cpp | 4 ++-- engines/lab/graphics.h | 2 +- engines/lab/transitions.cpp | 4 +--- 5 files changed, 16 insertions(+), 20 deletions(-) diff --git a/engines/lab/anim.cpp b/engines/lab/anim.cpp index 4927b25eae..fef1edfa4c 100644 --- a/engines/lab/anim.cpp +++ b/engines/lab/anim.cpp @@ -37,7 +37,6 @@ Anim::Anim(LabEngine *vm) : _vm(vm) { _header = 0; _curBit = 0; _numChunks = 1; - _isBM = false; _headerdata._width = 0; _headerdata._height = 0; _headerdata._fps = 0; @@ -78,7 +77,7 @@ void Anim::readBlock(void *Buffer, uint32 Size, byte **File) { (*File) += Size; } -void Anim::diffNextFrame() { +void Anim::diffNextFrame(bool onlyDiffData) { if (_header == 65535) /* Already done. */ return; @@ -96,7 +95,7 @@ void Anim::diffNextFrame() { if (_curBit >= _numChunks) { _vm->_event->mouseShow(); - if (!_isBM) { + if (!onlyDiffData) { if (_headerdata._fps) { _vm->waitForTime(_waitSec, _waitMicros); _vm->addCurTime(0L, _delayMicros, &_waitSec, &_waitMicros); @@ -110,7 +109,7 @@ void Anim::diffNextFrame() { _donePal = true; } - if (_isPal && !_noPalChange && !_isBM && !_donePal) { + if (_isPal && !_noPalChange && !onlyDiffData && !_donePal) { _vm->_graphics->setPalette(_diffPalette, 256); _isPal = false; } @@ -147,7 +146,7 @@ void Anim::diffNextFrame() { case 10L: _rawDiffBM._planes[_curBit] = _diffFile; - if (_isBM) + if (onlyDiffData) _diffFile += _size; else { readBlock(DrawBitMap->_planes[_curBit], _size, &_diffFile); @@ -246,7 +245,7 @@ void Anim::diffNextFrame() { /** * A separate task launched by readDiff. Plays the DIFF. */ -void Anim::playDiff(byte *buffer) { +void Anim::playDiff(byte *buffer, bool onlyDiffData) { _waitSec = 0L; _waitMicros = 0L; _delayMicros = 0L; @@ -325,9 +324,9 @@ void Anim::playDiff(byte *buffer) { if (_playOnce) { while (_header != 65535) - diffNextFrame(); + diffNextFrame(onlyDiffData); } else - diffNextFrame(); + diffNextFrame(onlyDiffData); } /** @@ -354,9 +353,9 @@ void Anim::stopDiffEnd() { /** * Reads in a DIFF file. */ -bool Anim::readDiff(byte *buffer, bool playOnce) { +bool Anim::readDiff(byte *buffer, bool playOnce, bool onlyDiffData) { _playOnce = playOnce; - playDiff(buffer); + playDiff(buffer, onlyDiffData); return true; } diff --git a/engines/lab/anim.h b/engines/lab/anim.h index 121edea20e..82732f063f 100644 --- a/engines/lab/anim.h +++ b/engines/lab/anim.h @@ -86,21 +86,20 @@ private: BitMap *DrawBitMap; void readBlock(void *Buffer, uint32 Size, byte **File); - void playDiff(byte *buffer); + void playDiff(byte *buffer, bool onlyDiffData = false); public: Anim(LabEngine *vm); DIFFHeader _headerdata; char _diffPalette[256 * 3]; - bool _isBM; /* Just fill in the RawDIFFBM structure */ bool _waitForEffect; /* Wait for each sound effect to finish before continuing. */ bool _doBlack; /* Black the screen before new picture */ bool _noPalChange; /* Don't change the palette. */ BitMap _rawDiffBM; - bool readDiff(byte *buffer, bool playOnce); - void diffNextFrame(); + bool readDiff(byte *buffer, bool playOnce, bool onlyDiffData = false); + void diffNextFrame(bool onlyDiffData = false); void stopDiff(); void stopDiffEnd(); }; diff --git a/engines/lab/graphics.cpp b/engines/lab/graphics.cpp index 926dc7ce6d..0d4501ea52 100644 --- a/engines/lab/graphics.cpp +++ b/engines/lab/graphics.cpp @@ -77,7 +77,7 @@ void DisplayMan::loadPict(const char *filename) { /** * Reads in a picture into the dest bitmap. */ -void DisplayMan::readPict(const char *filename, bool playOnce) { +void DisplayMan::readPict(const char *filename, bool playOnce, bool onlyDiffData) { _vm->_anim->stopDiff(); loadPict(filename); @@ -91,7 +91,7 @@ void DisplayMan::readPict(const char *filename, bool playOnce) { _dispBitMap._rows = _screenHeight; _dispBitMap._flags = BITMAPF_VIDEO; - _vm->_anim->readDiff(_curBitmap, playOnce); + _vm->_anim->readDiff(_curBitmap, playOnce, onlyDiffData); } /** diff --git a/engines/lab/graphics.h b/engines/lab/graphics.h index 9c25295343..8798718529 100644 --- a/engines/lab/graphics.h +++ b/engines/lab/graphics.h @@ -75,7 +75,7 @@ public: virtual ~DisplayMan(); void loadPict(const char *filename); - void readPict(const char *filename, bool playOnce); + void readPict(const char *filename, bool playOnce, bool onlyDiffData = false); void freePict(); byte *readPictToMem(const char *filename, uint16 x, uint16 y); void doScrollBlack(); diff --git a/engines/lab/transitions.cpp b/engines/lab/transitions.cpp index 6f90718eda..c611266020 100644 --- a/engines/lab/transitions.cpp +++ b/engines/lab/transitions.cpp @@ -147,10 +147,8 @@ void DisplayMan::doScrollWipe(char *filename) { _vm->waitTOF(); } - _vm->_anim->_isBM = true; - readPict(filename, true); + readPict(filename, true, true); setPalette(_vm->_anim->_diffPalette, 256); - _vm->_anim->_isBM = false; byte *mem = _vm->_anim->_rawDiffBM._planes[0]; _vm->_music->updateMusic(); -- cgit v1.2.3 From 2d0fab7f4c1e4c7f8e88aee6a867a98a8917de86 Mon Sep 17 00:00:00 2001 From: Strangerke Date: Tue, 8 Dec 2015 11:27:34 +0100 Subject: LAB: Use // for comments --- engines/lab/anim.cpp | 9 ++- engines/lab/anim.h | 8 +-- engines/lab/engine.cpp | 135 ++++++++++++++++++++++++++++---------------- engines/lab/eventman.cpp | 8 ++- engines/lab/eventman.h | 2 +- engines/lab/graphics.cpp | 121 +++++++++++++++++++++------------------ engines/lab/graphics.h | 71 +++++++++++------------ engines/lab/interface.cpp | 9 ++- engines/lab/interface.h | 16 +++--- engines/lab/lab.h | 3 +- engines/lab/labfun.h | 10 ++-- engines/lab/labsets.h | 6 +- engines/lab/map.cpp | 17 ++++-- engines/lab/music.cpp | 7 ++- engines/lab/music.h | 8 +-- engines/lab/processroom.cpp | 130 +++++++++++++++++++++--------------------- engines/lab/processroom.h | 22 ++++---- engines/lab/resource.h | 2 +- engines/lab/savegame.cpp | 4 -- engines/lab/special.cpp | 6 +- engines/lab/tilepuzzle.cpp | 3 +- 21 files changed, 331 insertions(+), 266 deletions(-) diff --git a/engines/lab/anim.cpp b/engines/lab/anim.cpp index fef1edfa4c..523bfc06bb 100644 --- a/engines/lab/anim.cpp +++ b/engines/lab/anim.cpp @@ -78,7 +78,8 @@ void Anim::readBlock(void *Buffer, uint32 Size, byte **File) { } void Anim::diffNextFrame(bool onlyDiffData) { - if (_header == 65535) /* Already done. */ + if (_header == 65535) + // Already done. return; if (_vm->_graphics->_dispBitMap._flags & BITMAPF_VIDEO) { @@ -127,7 +128,8 @@ void Anim::diffNextFrame(bool onlyDiffData) { if (_vm->_graphics->_dispBitMap._flags & BITMAPF_VIDEO) _vm->_graphics->screenUpdate(); - return; /* done with the next frame. */ + // done with the next frame. + return; } _vm->_music->updateMusic(); @@ -231,7 +233,8 @@ void Anim::diffNextFrame(bool onlyDiffData) { return; } - _frameNum = 4; /* Random frame number so it never gets back to 2 */ + // Random frame number so it never gets back to 2 + _frameNum = 4; _diffFile = _buffer; break; diff --git a/engines/lab/anim.h b/engines/lab/anim.h index 82732f063f..b5df6e2f65 100644 --- a/engines/lab/anim.h +++ b/engines/lab/anim.h @@ -93,9 +93,9 @@ public: DIFFHeader _headerdata; char _diffPalette[256 * 3]; - bool _waitForEffect; /* Wait for each sound effect to finish before continuing. */ - bool _doBlack; /* Black the screen before new picture */ - bool _noPalChange; /* Don't change the palette. */ + bool _waitForEffect; // Wait for each sound effect to finish before continuing. + bool _doBlack; // Black the screen before new picture + bool _noPalChange; // Don't change the palette. BitMap _rawDiffBM; bool readDiff(byte *buffer, bool playOnce, bool onlyDiffData = false); @@ -106,6 +106,6 @@ public: } // End of namespace Lab -#endif /* LAB_DIFF_H */ +#endif // LAB_DIFF_H diff --git a/engines/lab/engine.cpp b/engines/lab/engine.cpp index 6fb4c700d9..5ea7df8c67 100644 --- a/engines/lab/engine.cpp +++ b/engines/lab/engine.cpp @@ -39,10 +39,10 @@ namespace Lab { -/* Global parser data */ +// Global parser data bool ispal = false; -/* LAB: Labyrinth specific code for the special puzzles */ +// LAB: Labyrinth specific code for the special puzzles #define SPECIALLOCK 100 #define SPECIALBRICK 101 #define SPECIALBRICKNOMOUSE 102 @@ -97,7 +97,8 @@ void LabEngine::drawRoomMessage(uint16 curInv, CloseDataPtr closePtr) { if (_alternate) { if ((curInv <= _numInv) && _conditions->in(curInv) && _inventory[curInv]._bitmapName) { - if ((curInv == LAMPNUM) && _conditions->in(LAMPON)) /* LAB: Labyrinth specific */ + if ((curInv == LAMPNUM) && _conditions->in(LAMPON)) + // LAB: Labyrinth specific drawStaticMessage(kTextLampOn); else if (_inventory[curInv]._many > 1) { Common::String roomMessage = Common::String(_inventory[curInv]._name) + " (" + Common::String::format("%d", _inventory[curInv]._many) + ")"; @@ -277,7 +278,8 @@ void LabEngine::interfaceOn() { * If the user hits the "Use" gadget; things that can get used on themselves. */ bool LabEngine::doUse(uint16 curInv) { - if (curInv == MAPNUM) { /* LAB: Labyrinth specific */ + if (curInv == MAPNUM) { + // LAB: Labyrinth specific drawStaticMessage(kTextUseMap); interfaceOff(); _anim->stopDiff(); @@ -287,7 +289,8 @@ bool LabEngine::doUse(uint16 curInv) { _graphics->setPalette(initcolors, 8); _graphics->drawMessage(NULL); _graphics->drawPanel(); - } else if (curInv == JOURNALNUM) { /* LAB: Labyrinth specific */ + } else if (curInv == JOURNALNUM) { + // LAB: Labyrinth specific drawStaticMessage(kTextUseJournal); interfaceOff(); _anim->stopDiff(); @@ -296,7 +299,8 @@ bool LabEngine::doUse(uint16 curInv) { doJournal(); _graphics->drawPanel(); _graphics->drawMessage(NULL); - } else if (curInv == LAMPNUM) { /* LAB: Labyrinth specific */ + } else if (curInv == LAMPNUM) { + // LAB: Labyrinth specific interfaceOff(); if (_conditions->in(LAMPON)) { @@ -314,19 +318,23 @@ bool LabEngine::doUse(uint16 curInv) { _anim->_doBlack = false; _nextFileName = getInvName(curInv); - } else if (curInv == BELTNUM) { /* LAB: Labyrinth specific */ + } else if (curInv == BELTNUM) { + // LAB: Labyrinth specific if (!_conditions->in(BELTGLOW)) _conditions->inclElement(BELTGLOW); _anim->_doBlack = false; _nextFileName = getInvName(curInv); - } else if (curInv == WHISKEYNUM) { /* LAB: Labyrinth specific */ + } else if (curInv == WHISKEYNUM) { + // LAB: Labyrinth specific _conditions->inclElement(USEDHELMET); drawStaticMessage(kTextUseWhiskey); - } else if (curInv == PITHHELMETNUM) { /* LAB: Labyrinth specific */ + } else if (curInv == PITHHELMETNUM) { + // LAB: Labyrinth specific _conditions->inclElement(USEDHELMET); drawStaticMessage(kTextUsePith); - } else if (curInv == HELMETNUM) { /* LAB: Labyrinth specific */ + } else if (curInv == HELMETNUM) { + // LAB: Labyrinth specific _conditions->inclElement(USEDHELMET); drawStaticMessage(kTextUseHelmet); } else @@ -411,8 +419,7 @@ void LabEngine::mainGameLoop() { perFlipGadget(actionMode); - /* Set up initial picture. */ - + // Set up initial picture. while (1) { _event->processInput(true); @@ -424,7 +431,7 @@ void LabEngine::mainGameLoop() { _music->resumeBackMusic(); - /* Sees what kind of close up we're in and does the appropriate stuff, if any. */ + // Sees what kind of close up we're in and does the appropriate stuff, if any. if (doCloseUp(_cptr)) { _cptr = NULL; @@ -432,27 +439,31 @@ void LabEngine::mainGameLoop() { _graphics->screenUpdate(); } - /* Sets the current picture properly on the screen */ + // Sets the current picture properly on the screen if (_mainDisplay) _nextFileName = getPictName(&_cptr); if (_noUpdateDiff) { - _roomsFound->inclElement(_roomNum); /* Potentially entered another room */ + // Potentially entered another room + _roomsFound->inclElement(_roomNum); forceDraw |= (strcmp(_nextFileName, _curFileName) != 0); _noUpdateDiff = false; _curFileName = _nextFileName; } else if (strcmp(_nextFileName, _curFileName) != 0) { interfaceOff(); - _roomsFound->inclElement(_roomNum); /* Potentially entered another room */ + // Potentially entered another room + _roomsFound->inclElement(_roomNum); _curFileName = _nextFileName; if (_cptr) { - if ((_cptr->_closeUpType == SPECIALLOCK) && _mainDisplay) /* LAB: Labyrinth specific code */ + if ((_cptr->_closeUpType == SPECIALLOCK) && _mainDisplay) + // LAB: Labyrinth specific code showCombination(_curFileName); else if (((_cptr->_closeUpType == SPECIALBRICK) || (_cptr->_closeUpType == SPECIALBRICKNOMOUSE)) && - _mainDisplay) /* LAB: Labyrinth specific code */ + _mainDisplay) + // LAB: Labyrinth specific code showTile(_curFileName, (bool)(_cptr->_closeUpType == SPECIALBRICKNOMOUSE)); else _graphics->readPict(_curFileName, false); @@ -476,11 +487,13 @@ void LabEngine::mainGameLoop() { } } - _music->updateMusic(); /* Make sure we check the music at least after every message */ + // Make sure we check the music at least after every message + _music->updateMusic(); interfaceOn(); IntuiMessage *curMsg = getMsg(); - if (curMsg == NULL) { /* Does music load and next animation frame when you've run out of messages */ + if (curMsg == NULL) { + // Does music load and next animation frame when you've run out of messages gotMessage = false; _music->checkRoomMusic(); _music->updateMusic(); @@ -556,18 +569,20 @@ bool LabEngine::from_crumbs(uint32 tmpClass, uint16 code, uint16 Qualifier, Comm _anim->_doBlack = false; if ((msgClass == RAWKEY) && (!_graphics->_longWinInFront)) { - if (code == 13) { /* The return key */ + if (code == 13) { + // The return key msgClass = MOUSEBUTTONS; Qualifier = IEQUALIFIER_LEFTBUTTON; curPos = _event->getMousePos(); - } else if (getPlatform() == Common::kPlatformWindows && - (code == 'b' || code == 'B')) { /* Start bread crumbs */ + } else if (getPlatform() == Common::kPlatformWindows && (code == 'b' || code == 'B')) { + // Start bread crumbs _breadCrumbs[0]._roomNum = 0; _numCrumbs = 0; _droppingCrumbs = true; mayShowCrumbIndicator(); _graphics->screenUpdate(); - } else if (code == 'f' || code == 'F' || code == 'r' || code == 'R') { /* Follow bread crumbs */ + } else if (code == 'f' || code == 'F' || code == 'r' || code == 'R') { + // Follow bread crumbs if (_droppingCrumbs) { if (_numCrumbs > 0) { _followingCrumbs = true; @@ -583,7 +598,8 @@ bool LabEngine::from_crumbs(uint32 tmpClass, uint16 code, uint16 Qualifier, Comm _graphics->_doNotDrawMessage = false; _mainDisplay = true; - interfaceOn(); /* Sets the correct gadget list */ + // Sets the correct gadget list + interfaceOn(); _graphics->drawPanel(); drawRoomMessage(curInv, _cptr); _graphics->screenUpdate(); @@ -597,7 +613,8 @@ bool LabEngine::from_crumbs(uint32 tmpClass, uint16 code, uint16 Qualifier, Comm _graphics->screenUpdate(); } } - } else if ((code == 315) || (code == 'x') || (code == 'X') || (code == 'q') || (code == 'Q')) { /* Quit? */ + } else if ((code == 315) || (code == 'x') || (code == 'X') || (code == 'q') || (code == 'Q')) { + // Quit? _graphics->_doNotDrawMessage = false; _graphics->drawMessage("Do you want to quit? (Y/N)"); doit = false; @@ -605,10 +622,12 @@ bool LabEngine::from_crumbs(uint32 tmpClass, uint16 code, uint16 Qualifier, Comm interfaceOff(); while (1) { - _music->updateMusic(); /* Make sure we check the music at least after every message */ + // Make sure we check the music at least after every message + _music->updateMusic(); curMsg = getMsg(); - if (curMsg == NULL) { /* Does music load and next animation frame when you've run out of messages */ + if (curMsg == NULL) { + // Does music load and next animation frame when you've run out of messages _music->updateMusic(); _anim->diffNextFrame(); } else { @@ -632,9 +651,11 @@ bool LabEngine::from_crumbs(uint32 tmpClass, uint16 code, uint16 Qualifier, Comm forceDraw = true; interfaceOn(); } - } else if (code == 9) { /* TAB key */ + } else if (code == 9) { + // TAB key msgClass = DELTAMOVE; - } else if (code == 27) { /* ESC key */ + } else if (code == 27) { + // ESC key _cptr = NULL; } @@ -667,8 +688,8 @@ bool LabEngine::from_crumbs(uint32 tmpClass, uint16 code, uint16 Qualifier, Comm _alternate = true; _anim->_doBlack = true; _graphics->_doNotDrawMessage = false; - interfaceOn(); /* Sets the correct gadget list */ - + // Sets the correct gadget list + interfaceOn(); _mainDisplay = false; if (lastInv && _conditions->in(lastInv)) { @@ -700,7 +721,8 @@ bool LabEngine::from_crumbs(uint32 tmpClass, uint16 code, uint16 Qualifier, Comm mayShowCrumbIndicator(); _graphics->screenUpdate(); - } else if (gadgetId >= 6) { /* Arrow Gadgets */ + } else if (gadgetId >= 6) { + // Arrow Gadgets _cptr = NULL; hcptr = NULL; @@ -734,7 +756,8 @@ bool LabEngine::from_crumbs(uint32 tmpClass, uint16 code, uint16 Qualifier, Comm if (oldRoomNum != _roomNum) { drawStaticMessage(kTextGoForward); - _roomsFound->inclElement(_roomNum); /* Potentially entered a new room */ + // Potentially entered a new room + _roomsFound->inclElement(_roomNum); _curFileName = " "; forceDraw = true; } else { @@ -798,7 +821,8 @@ bool LabEngine::from_crumbs(uint32 tmpClass, uint16 code, uint16 Qualifier, Comm _graphics->_doNotDrawMessage = false; _mainDisplay = true; - interfaceOn(); /* Sets the correct gadget list */ + // Sets the correct gadget list + interfaceOn(); _graphics->drawPanel(); drawRoomMessage(curInv, _cptr); @@ -833,7 +857,8 @@ bool LabEngine::from_crumbs(uint32 tmpClass, uint16 code, uint16 Qualifier, Comm } else if (gadgetId == 1) { if (!doUse(curInv)) { uint16 oldActionMode = actionMode; - actionMode = 5; /* Use button */ + // Use button + actionMode = 5; if (oldActionMode < 5) perFlipGadget(oldActionMode); @@ -857,27 +882,31 @@ bool LabEngine::from_crumbs(uint32 tmpClass, uint16 code, uint16 Qualifier, Comm _nextFileName = getInvName(curInv); _graphics->screenUpdate(); - } else if (gadgetId == 3) { /* Left gadget */ + } else if (gadgetId == 3) { + // Left gadget decIncInv(&curInv, true); lastInv = curInv; _graphics->_doNotDrawMessage = false; drawRoomMessage(curInv, _cptr); _graphics->screenUpdate(); - } else if (gadgetId == 4) { /* Right gadget */ + } else if (gadgetId == 4) { + // Right gadget decIncInv(&curInv, false); lastInv = curInv; _graphics->_doNotDrawMessage = false; drawRoomMessage(curInv, _cptr); _graphics->screenUpdate(); - } else if (gadgetId == 5) { /* bread crumbs */ + } else if (gadgetId == 5) { + // bread crumbs _breadCrumbs[0]._roomNum = 0; _numCrumbs = 0; _droppingCrumbs = true; mayShowCrumbIndicator(); _graphics->screenUpdate(); - } else if (gadgetId == 6) { /* follow crumbs */ + } else if (gadgetId == 6) { + // follow crumbs if (_droppingCrumbs) { if (_numCrumbs > 0) { _followingCrumbs = true; @@ -892,7 +921,8 @@ bool LabEngine::from_crumbs(uint32 tmpClass, uint16 code, uint16 Qualifier, Comm _graphics->_doNotDrawMessage = false; _mainDisplay = true; - interfaceOn(); /* Sets the correct gadget list */ + // Sets the correct gadget list + interfaceOn(); _graphics->drawPanel(); drawRoomMessage(curInv, _cptr); _graphics->screenUpdate(); @@ -913,7 +943,8 @@ bool LabEngine::from_crumbs(uint32 tmpClass, uint16 code, uint16 Qualifier, Comm doit = false; if (_cptr) { - if ((_cptr->_closeUpType == SPECIALLOCK) && _mainDisplay) /* LAB: Labyrinth specific code */ + if ((_cptr->_closeUpType == SPECIALLOCK) && _mainDisplay) + // LAB: Labyrinth specific code mouseCombination(curPos); else if ((_cptr->_closeUpType == SPECIALBRICK) && _mainDisplay) mouseTile(curPos); @@ -927,7 +958,8 @@ bool LabEngine::from_crumbs(uint32 tmpClass, uint16 code, uint16 Qualifier, Comm hcptr = NULL; eatMessages(); - if (actionMode == 0) { /* Take something. */ + if (actionMode == 0) { + // Take something. if (doActionRule(Common::Point(curPos.x, curPos.y), actionMode, _roomNum, &_cptr)) _curFileName = _newFileName; else if (takeItem(curPos.x, curPos.y, &_cptr)) @@ -938,16 +970,16 @@ bool LabEngine::from_crumbs(uint32 tmpClass, uint16 code, uint16 Qualifier, Comm _curFileName = _newFileName; else if (curPos.y < (_utils->vgaScaleY(149) + _utils->svgaCord(2))) drawStaticMessage(kTextNothing); - } else if ((actionMode == 1) /* Manipulate an object */ || - (actionMode == 2) /* Open up a "door" */ || - (actionMode == 3)) { /* Close a "door" */ + } else if ((actionMode == 1) || (actionMode == 2) || (actionMode == 3)) { + // Manipulate an object, Open up a "door" or Close a "door" if (doActionRule(curPos, actionMode, _roomNum, &_cptr)) _curFileName = _newFileName; else if (!doActionRule(curPos, actionMode, 0, &_cptr)) { if (curPos.y < (_utils->vgaScaleY(149) + _utils->svgaCord(2))) drawStaticMessage(kTextNothing); } - } else if (actionMode == 4) { /* Look at closeups */ + } else if (actionMode == 4) { + // Look at closeups tempcptr = _cptr; setCurClose(curPos, &tempcptr); @@ -962,7 +994,8 @@ bool LabEngine::from_crumbs(uint32 tmpClass, uint16 code, uint16 Qualifier, Comm drawStaticMessage(kTextNothing); } else if (curPos.y < (_utils->vgaScaleY(149) + _utils->svgaCord(2))) drawStaticMessage(kTextNothing); - } else if ((actionMode == 5) && _conditions->in(curInv)) { /* Use an item on something else */ + } else if ((actionMode == 5) && _conditions->in(curInv)) { + // Use an item on something else if (doOperateRule(curPos.x, curPos.y, curInv, &_cptr)) { _curFileName = _newFileName; @@ -1009,7 +1042,8 @@ bool LabEngine::from_crumbs(uint32 tmpClass, uint16 code, uint16 Qualifier, Comm _anim->_doBlack = true; _graphics->_doNotDrawMessage = false; _mainDisplay = true; - interfaceOn(); /* Sets the correct gadget list */ + // Sets the correct gadget list + interfaceOn(); if (_alternate) { if (lastInv && _conditions->in(lastInv)) @@ -1046,7 +1080,8 @@ void LabEngine::go() { _event->mouseShow(); mainGameLoop(); - if (_quitLab) { /* Won the game */ + if (_quitLab) { + // Won the game _graphics->blackAllScreen(); _graphics->readPict("P:End/L2In.1", true); diff --git a/engines/lab/eventman.cpp b/engines/lab/eventman.cpp index 5b55ed4102..ad56b46fbc 100644 --- a/engines/lab/eventman.cpp +++ b/engines/lab/eventman.cpp @@ -114,7 +114,8 @@ EventManager::EventManager(LabEngine *vm) : _vm(vm) { } void EventManager::mouseHandler(int flag, Common::Point pos) { - if (flag & 0x02) { /* Left mouse button click */ + if (flag & 0x02) { + // Left mouse button click Gadget *tmp = NULL; if (_screenGadgetList) tmp = checkGadgetHit(_screenGadgetList, _vm->_isHiRes ? pos : Common::Point(pos.x / 2, pos.y)); @@ -125,7 +126,8 @@ void EventManager::mouseHandler(int flag, Common::Point pos) { _leftClick = true; } - if (flag & 0x08) /* Right mouse button click */ + if (flag & 0x08) + // Right mouse button click _rightClick = true; } @@ -263,7 +265,7 @@ bool EventManager::haveNextChar() { void EventManager::processInput(bool can_delay) { Common::Event event; - if (1 /*!g_IgnoreProcessInput*/) { + if (1) { //!g_IgnoreProcessInput int flags = 0; while (g_system->getEventManager()->pollEvent(event)) { switch (event.type) { diff --git a/engines/lab/eventman.h b/engines/lab/eventman.h index 11d8dfd7e1..f87d7ee2db 100644 --- a/engines/lab/eventman.h +++ b/engines/lab/eventman.h @@ -77,4 +77,4 @@ public: } // End of namespace Lab -#endif /* LAB_EVENTMAN_H */ +#endif // LAB_EVENTMAN_H diff --git a/engines/lab/graphics.cpp b/engines/lab/graphics.cpp index 0d4501ea52..3d0bbe16db 100644 --- a/engines/lab/graphics.cpp +++ b/engines/lab/graphics.cpp @@ -62,9 +62,7 @@ DisplayMan::~DisplayMan() { freePict(); } -/*---------------------------------------------------------------------------*/ -/*------ From readPict.c. Reads in pictures and animations from disk. ------*/ -/*---------------------------------------------------------------------------*/ +// From readPict.c. Reads in pictures and animations from disk. void DisplayMan::loadPict(const char *filename) { Common::File *bitmapFile = _vm->_resource->openDataFile(filename); @@ -126,11 +124,9 @@ void DisplayMan::freePict() { _curBitmap = NULL; } -/*---------------------------------------------------------------------------*/ -/*------------ Does all the text rendering to the message boxes. ------------*/ -/*---------------------------------------------------------------------------*/ - -/*----- The flowText routines -----*/ +//--------------------------------------------------------------------------- +//------------ Does all the text rendering to the message boxes. ------------ +//--------------------------------------------------------------------------- /** * Extracts the first word from a string. @@ -189,17 +185,17 @@ void DisplayMan::getLine(TextFont *tf, char *lineBuffer, const char **mainBuffer * each line less than 255 characters. */ uint32 DisplayMan::flowText( - void *font, /* the TextAttr pointer */ - int16 spacing, /* How much vertical spacing between the lines */ - byte pencolor, /* pen number to use for text */ - byte backpen, /* the background color */ - bool fillback, /* Whether to fill the background */ - bool centerh, /* Whether to center the text horizontally */ - bool centerv, /* Whether to center the text vertically */ - bool output, /* Whether to output any text */ - uint16 x1, uint16 y1, /* Cords */ + void *font, // the TextAttr pointer + int16 spacing, // How much vertical spacing between the lines + byte pencolor, // pen number to use for text + byte backpen, // the background color + bool fillback, // Whether to fill the background + bool centerh, // Whether to center the text horizontally + bool centerv, // Whether to center the text vertically + bool output, // Whether to output any text + uint16 x1, uint16 y1, // Cords uint16 x2, uint16 y2, - const char *str) { /* The text itself */ + const char *str) { // The text itself TextFont *_msgFont = (TextFont *)font; char linebuffer[256]; const char *temp; @@ -254,16 +250,18 @@ uint32 DisplayMan::flowText( return (str - temp); } -uint32 DisplayMan::flowTextScaled(void *font, /* the TextAttr pointer */ - int16 spacing, /* How much vertical spacing between the lines */ - byte penColor, /* pen number to use for text */ - byte backPen, /* the background color */ - bool fillBack, /* Whether to fill the background */ - bool centerX, /* Whether to center the text horizontally */ - bool centerY, /* Whether to center the text vertically */ - bool output, /* Whether to output any text */ - uint16 x1, uint16 y1, /* Cords */ - uint16 x2, uint16 y2, const char *str) { +uint32 DisplayMan::flowTextScaled( + void *font, // the TextAttr pointer + int16 spacing, // How much vertical spacing between the lines + byte penColor, // pen number to use for text + byte backPen, // the background color + bool fillBack, // Whether to fill the background + bool centerX, // Whether to center the text horizontally + bool centerY, // Whether to center the text vertically + bool output, // Whether to output any text + uint16 x1, uint16 y1, // Cords + uint16 x2, uint16 y2, + const char *str) { return flowText(font, spacing, penColor, backPen, fillBack, centerX, centerY, output, _vm->_utils->vgaScaleX(x1), _vm->_utils->vgaScaleY(y1), _vm->_utils->vgaScaleX(x2), _vm->_utils->vgaScaleY(y2), str); @@ -273,17 +271,17 @@ uint32 DisplayMan::flowTextScaled(void *font, /* the TextAttr pointer */ * Calls flowText, but flows it to memory. Same restrictions as flowText. */ uint32 DisplayMan::flowTextToMem(Image *destIm, - void *font, /* the TextAttr pointer */ - int16 spacing, /* How much vertical spacing between the lines */ - byte pencolor, /* pen number to use for text */ - byte backpen, /* the background color */ - bool fillback, /* Whether to fill the background */ - bool centerh, /* Whether to center the text horizontally */ - bool centerv, /* Whether to center the text vertically */ - bool output, /* Whether to output any text */ - uint16 x1, uint16 y1, /* Cords */ + void *font, // the TextAttr pointer + int16 spacing, // How much vertical spacing between the lines + byte pencolor, // pen number to use for text + byte backpen, // the background color + bool fillback, // Whether to fill the background + bool centerh, // Whether to center the text horizontally + bool centerv, // Whether to center the text vertically + bool output, // Whether to output any text + uint16 x1, uint16 y1, // Cords uint16 x2, uint16 y2, - const char *str) { /* The text itself */ + const char *str) { // The text itself uint32 res, vgabyte = _screenBytesPerPage; byte *tmp = _currentDisplayBuffer; @@ -298,13 +296,15 @@ uint32 DisplayMan::flowTextToMem(Image *destIm, return res; } -/*----- The control panel stuff -----*/ +//----- The control panel stuff ----- void DisplayMan::createBox(uint16 y2) { - setAPen(7); /* Message box area */ + // Message box area + setAPen(7); rectFillScaled(4, 154, 315, y2 - 2); - setAPen(0); /* Box around message area */ + // Box around message area + setAPen(0); drawHLine(_vm->_utils->vgaScaleX(2), _vm->_utils->vgaScaleY(152), _vm->_utils->vgaScaleX(317)); drawVLine(_vm->_utils->vgaScaleX(317), _vm->_utils->vgaScaleY(152), _vm->_utils->vgaScaleY(y2)); drawHLine(_vm->_utils->vgaScaleX(2), _vm->_utils->vgaScaleY(y2), _vm->_utils->vgaScaleX(317)); @@ -323,7 +323,8 @@ int32 DisplayMan::longDrawMessage(const char *str) { if (!_longWinInFront) { _longWinInFront = true; - setAPen(3); /* Clear Area */ + // Clear Area + setAPen(3); rectFill(0, _vm->_utils->vgaScaleY(149) + _vm->_utils->svgaCord(2), _vm->_utils->vgaScaleX(319), _vm->_utils->vgaScaleY(199)); } @@ -367,37 +368,45 @@ void DisplayMan::drawMessage(const char *str) { void DisplayMan::drawPanel() { _vm->_event->mouseHide(); - setAPen(3); /* Clear Area */ + // Clear Area + setAPen(3); rectFill(0, _vm->_utils->vgaScaleY(149) + _vm->_utils->svgaCord(2), _vm->_utils->vgaScaleX(319), _vm->_utils->vgaScaleY(199)); - setAPen(0); /* First Line */ + // First Line + setAPen(0); drawHLine(0, _vm->_utils->vgaScaleY(149) + _vm->_utils->svgaCord(2), _vm->_utils->vgaScaleX(319)); - setAPen(5); /* Second Line */ + // Second Line + setAPen(5); drawHLine(0, _vm->_utils->vgaScaleY(149) + 1 + _vm->_utils->svgaCord(2), _vm->_utils->vgaScaleX(319)); - - /* Gadget Separators */ + // Gadget Separators setAPen(0); - drawHLine(0, _vm->_utils->vgaScaleY(170), _vm->_utils->vgaScaleX(319)); /* First black line to separate buttons */ + // First black line to separate buttons + drawHLine(0, _vm->_utils->vgaScaleY(170), _vm->_utils->vgaScaleX(319)); if (!_vm->_alternate) { setAPen(4); - drawHLine(0, _vm->_utils->vgaScaleY(170) + 1, _vm->_utils->vgaScaleX(319)); /* The horizontal lines under the black one */ + // The horizontal lines under the black one + drawHLine(0, _vm->_utils->vgaScaleY(170) + 1, _vm->_utils->vgaScaleX(319)); drawGadgetList(&_vm->_moveGadgetList); } else { if (_vm->getPlatform() != Common::kPlatformWindows) { - drawVLine(_vm->_utils->vgaScaleX(124), _vm->_utils->vgaScaleY(170) + 1, _vm->_utils->vgaScaleY(199)); /* Vertical Black lines */ + // Vertical Black lines + drawVLine(_vm->_utils->vgaScaleX(124), _vm->_utils->vgaScaleY(170) + 1, _vm->_utils->vgaScaleY(199)); drawVLine(_vm->_utils->vgaScaleX(194), _vm->_utils->vgaScaleY(170) + 1, _vm->_utils->vgaScaleY(199)); } else { - drawVLine(_vm->_utils->vgaScaleX(90), _vm->_utils->vgaScaleY(170) + 1, _vm->_utils->vgaScaleY(199)); /* Vertical Black lines */ + // Vertical Black lines + drawVLine(_vm->_utils->vgaScaleX(90), _vm->_utils->vgaScaleY(170) + 1, _vm->_utils->vgaScaleY(199)); drawVLine(_vm->_utils->vgaScaleX(160), _vm->_utils->vgaScaleY(170) + 1, _vm->_utils->vgaScaleY(199)); drawVLine(_vm->_utils->vgaScaleX(230), _vm->_utils->vgaScaleY(170) + 1, _vm->_utils->vgaScaleY(199)); } setAPen(4); - drawHLine(0, _vm->_utils->vgaScaleY(170) + 1, _vm->_utils->vgaScaleX(122)); /* The horizontal lines under the black one */ + // The horizontal lines under the black one + drawHLine(0, _vm->_utils->vgaScaleY(170) + 1, _vm->_utils->vgaScaleX(122)); drawHLine(_vm->_utils->vgaScaleX(126), _vm->_utils->vgaScaleY(170) + 1, _vm->_utils->vgaScaleX(192)); drawHLine(_vm->_utils->vgaScaleX(196), _vm->_utils->vgaScaleY(170) + 1, _vm->_utils->vgaScaleX(319)); - drawVLine(_vm->_utils->vgaScaleX(1), _vm->_utils->vgaScaleY(170) + 2, _vm->_utils->vgaScaleY(198)); /* The vertical high light lines */ + // The vertical high light lines + drawVLine(_vm->_utils->vgaScaleX(1), _vm->_utils->vgaScaleY(170) + 2, _vm->_utils->vgaScaleY(198)); if (_vm->getPlatform() != Common::kPlatformWindows) { drawVLine(_vm->_utils->vgaScaleX(126), _vm->_utils->vgaScaleY(170) + 2, _vm->_utils->vgaScaleY(198)); @@ -426,7 +435,7 @@ bool DisplayMan::setUpScreens() { _vm->_moveImages[i] = new Image(controlFile); delete controlFile; - /* Creates the gadgets for the movement control panel */ + // Creates the gadgets for the movement control panel uint16 y = _vm->_utils->vgaScaleY(173) - _vm->_utils->svgaCord(2); // The key mapping was only set for the Windows version. @@ -726,9 +735,9 @@ void DisplayMan::text(TextFont *tf, uint16 x, uint16 y, uint16 color, const char if (templeft <= 0) { curpage++; VGATemp = (byte *)(VGATop - templeft); - /* Set up VGATempLine for next line */ + // Set up VGATempLine for next line VGATempLine -= _screenBytesPerPage; - /* Set up LeftInSegment for next line */ + // Set up LeftInSegment for next line LeftInSegment += _screenBytesPerPage + templeft; templeft += _screenBytesPerPage; } diff --git a/engines/lab/graphics.h b/engines/lab/graphics.h index 8798718529..71c824618b 100644 --- a/engines/lab/graphics.h +++ b/engines/lab/graphics.h @@ -95,43 +95,44 @@ public: void setAPen(byte pennum); void rectFill(uint16 x1, uint16 y1, uint16 x2, uint16 y2); void rectFillScaled(uint16 x1, uint16 y1, uint16 x2, uint16 y2); - /* Window text stuff */ - uint32 flowText(void *font, /* the TextAttr pointer */ - int16 spacing, /* How much vertical spacing between the lines */ - byte pencolor, /* pen number to use for text */ - byte backpen, /* the background color */ - bool fillback, /* Whether to fill the background */ - bool centerh, /* Whether to center the text horizontally */ - bool centerv, /* Whether to center the text vertically */ - bool output, /* Whether to output any text */ - uint16 x1, uint16 y1, /* Cords */ - uint16 x2, uint16 y2, - const char *text); /* The text itself */ - - uint32 flowTextScaled(void *font, /* the TextAttr pointer */ - int16 spacing, /* How much vertical spacing between the lines */ - byte pencolor, /* pen number to use for text */ - byte backpen, /* the background color */ - bool fillback, /* Whether to fill the background */ - bool centerh, /* Whether to center the text horizontally */ - bool centerv, /* Whether to center the text vertically */ - bool output, /* Whether to output any text */ - uint16 x1, uint16 y1, /* Cords */ - uint16 x2, uint16 y2, - const char *text); /* The text itself */ + // Window text stuff + uint32 flowText(void *font, // the TextAttr pointer + int16 spacing, // How much vertical spacing between the lines + byte pencolor, // pen number to use for text + byte backpen, // the background color + bool fillback, // Whether to fill the background + bool centerh, // Whether to center the text horizontally + bool centerv, // Whether to center the text vertically + bool output, // Whether to output any text + uint16 x1, uint16 y1, // Cords + uint16 x2, uint16 y2, + const char *text); // The text itself + + uint32 flowTextScaled( + void *font, // the TextAttr pointer + int16 spacing, // How much vertical spacing between the lines + byte pencolor, // pen number to use for text + byte backpen, // the background color + bool fillback, // Whether to fill the background + bool centerh, // Whether to center the text horizontally + bool centerv, // Whether to center the text vertically + bool output, // Whether to output any text + uint16 x1, uint16 y1, // Cords + uint16 x2, uint16 y2, + const char *text); // The text itself uint32 flowTextToMem(Image *destIm, - void *font, /* the TextAttr pointer */ - int16 spacing, /* How much vertical spacing between the lines */ - byte pencolor, /* pen number to use for text */ - byte backpen, /* the background color */ - bool fillback, /* Whether to fill the background */ - bool centerh, /* Whether to center the text horizontally */ - bool centerv, /* Whether to center the text vertically */ - bool output, /* Whether to output any text */ - uint16 x1, uint16 y1, /* Cords */ - uint16 x2, uint16 y2, - const char *str); /* The text itself */ + void *font, // the TextAttr pointer + int16 spacing, // How much vertical spacing between the lines + byte pencolor, // pen number to use for text + byte backpen, // the background color + bool fillback, // Whether to fill the background + bool centerh, // Whether to center the text horizontally + bool centerv, // Whether to center the text vertically + bool output, // Whether to output any text + uint16 x1, uint16 y1, // Cords + uint16 x2, uint16 y2, + const char *str); // The text itself void drawHLine(uint16 x, uint16 y1, uint16 y2); void drawVLine(uint16 x1, uint16 y, uint16 x2); diff --git a/engines/lab/interface.cpp b/engines/lab/interface.cpp index ade5f69a9e..13cbd1e581 100644 --- a/engines/lab/interface.cpp +++ b/engines/lab/interface.cpp @@ -145,15 +145,18 @@ IntuiMessage *LabEngine::getMsg() { IMessage._gadgetID = curgad->_gadgetID; IMessage._qualifier = qualifiers; return &IMessage; - } else if (_event->mouseButton(&IMessage._mouseX, &IMessage._mouseY, true)) { /* Left Button */ + } else if (_event->mouseButton(&IMessage._mouseX, &IMessage._mouseY, true)) { + // Left Button IMessage._qualifier = IEQUALIFIER_LEFTBUTTON | qualifiers; IMessage._msgClass = MOUSEBUTTONS; return &IMessage; - } else if (_event->mouseButton(&IMessage._mouseX, &IMessage._mouseY, false)) { /* Right Button */ + } else if (_event->mouseButton(&IMessage._mouseX, &IMessage._mouseY, false)) { + // Right Button IMessage._qualifier = IEQUALIFIER_RBUTTON | qualifiers; IMessage._msgClass = MOUSEBUTTONS; return &IMessage; - } else if (_event->keyPress(&IMessage._code)) { /* Keyboard key */ + } else if (_event->keyPress(&IMessage._code)) { + // Keyboard key curgad = checkNumGadgetHit(_event->_screenGadgetList, IMessage._code); if (curgad) { diff --git a/engines/lab/interface.h b/engines/lab/interface.h index 3e0460be1c..bd9c3c9697 100644 --- a/engines/lab/interface.h +++ b/engines/lab/interface.h @@ -50,12 +50,12 @@ struct Gadget { Image *_image, *_altImage; }; -/* Defines for the GadgetFlags portion */ +// Defines for the GadgetFlags portion #define GADGETOFF 0x01 typedef Common::List GadgetList; -/* Defines for the Class variable in IntuiMessage */ +// Defines for the Class variable in IntuiMessage #define SIZEVERIFY 0x00000001 #define NEWSIZE 0x00000002 #define REFRESHWINDOW 0x00000004 @@ -73,14 +73,14 @@ typedef Common::List GadgetList; #define NEWPREFS 0x00004000 #define DISKINSERTED 0x00008000 #define DISKREMOVED 0x00010000 -#define WBENCHMESSAGE 0x00020000 /* System use only */ +#define WBENCHMESSAGE 0x00020000 // System use only #define ACTIVEWINDOW 0x00040000 #define INACTIVEWINDOW 0x00080000 #define DELTAMOVE 0x00100000 #define VANULLLAKEY 0x00200000 -/* Defines for the Qualifier variable in IntuiMessage */ +// Defines for the Qualifier variable in IntuiMessage #define IEQUALIFIER_LSHIFT 0x0001 #define IEQUALIFIER_RSHIFT 0x0002 #define IEQUALIFIER_CAPSLOCK 0x0004 @@ -103,9 +103,9 @@ typedef Common::List GadgetList; #define VKEY_LTARROW 276 -/*---------------------------------------------------------------------------*/ -/*--------------------------- Function Prototypes ---------------------------*/ -/*---------------------------------------------------------------------------*/ +//--------------------------------------------------------------------------- +//--------------------------- Function Prototypes --------------------------- +//--------------------------------------------------------------------------- Gadget *createButton(uint16 x, uint16 y, uint16 id, uint16 key, Image *im, Image *imalt); void freeButtonList(GadgetList *gadgetList); @@ -116,4 +116,4 @@ IntuiMessage *getMsg(); } // End of namespace Lab -#endif /* LAB_INTEFACE_H */ +#endif // LAB_INTEFACE_H diff --git a/engines/lab/lab.h b/engines/lab/lab.h index 7dec75f0a6..6b2efdae54 100644 --- a/engines/lab/lab.h +++ b/engines/lab/lab.h @@ -132,7 +132,8 @@ public: const char *_curFileName; const char *_nextFileName; - const char *_newFileName; /* When ProcessRoom.c decides to change the filename of the current picture. */ + // When ProcessRoom.c decides to change the filename of the current picture. + const char *_newFileName; TextFont *_msgFont; GadgetList _moveGadgetList; GadgetList _invGadgetList; diff --git a/engines/lab/labfun.h b/engines/lab/labfun.h index e0a3b089c6..4edb263eee 100644 --- a/engines/lab/labfun.h +++ b/engines/lab/labfun.h @@ -40,7 +40,7 @@ namespace Lab { class LabEngine; -/* Direction defines */ +// Direction defines #define NORTH 0 #define SOUTH 1 #define EAST 2 @@ -53,9 +53,9 @@ struct SaveGameHeader { uint16 _direction; }; -/*--------------------------*/ -/*----- From saveGame.c ----*/ -/*--------------------------*/ +//-------------------------- +//----- From saveGame.c ---- +//-------------------------- bool saveGame(uint16 Direction, uint16 Quarters, int slot, Common::String desc); bool loadGame(uint16 *Direction, uint16 *Quarters, int slot); @@ -63,4 +63,4 @@ bool readSaveGameHeader(Common::InSaveFile *in, SaveGameHeader &header); } // End of namespace Lab -#endif /* LAB_LABFUN_H */ +#endif // LAB_LABFUN_H diff --git a/engines/lab/labsets.h b/engines/lab/labsets.h index 647730db6e..0c1af77de1 100644 --- a/engines/lab/labsets.h +++ b/engines/lab/labsets.h @@ -33,9 +33,9 @@ namespace Lab { -/*---------------------------*/ -/*----- From LabSets.c ------*/ -/*---------------------------*/ +//--------------------------- +//----- From LabSets.c ------ +//--------------------------- class LabEngine; diff --git a/engines/lab/map.cpp b/engines/lab/map.cpp index b86e2b6846..b09ca506f2 100644 --- a/engines/lab/map.cpp +++ b/engines/lab/map.cpp @@ -415,8 +415,9 @@ void LabEngine::drawMap(uint16 CurRoom, uint16 CurMsg, uint16 Floor, bool fadeou } } - /* Makes sure the X is drawn in corridors */ - /* NOTE: this here on purpose just in case there's some weird condition, like the surreal maze where there are no rooms */ + // Makes sure the X is drawn in corridors + // NOTE: this here on purpose just in case there's some weird + // condition, like the surreal maze where there are no rooms if ((Maps[CurRoom].PageNumber == Floor) && _roomsFound->in(CurRoom) && Maps[CurRoom].x) drawRoom(CurRoom, true); @@ -483,7 +484,8 @@ void LabEngine::processMap(uint16 CurRoom) { CurFloor = Maps[CurRoom].PageNumber; while (1) { - _music->updateMusic(); /* Make sure we check the music at least after every message */ + // Make sure we check the music at least after every message + _music->updateMusic(); Msg = getMsg(); if (Msg == NULL) { @@ -526,9 +528,11 @@ void LabEngine::processMap(uint16 CurRoom) { return; if (Class == GADGETUP) { - if (GadgetID == 0) { /* Quit menu button */ + if (GadgetID == 0) { + // Quit menu button return; - } else if (GadgetID == 1) { /* Up arrow */ + } else if (GadgetID == 1) { + // Up arrow OldFloor = CurFloor; getUpFloor(&CurFloor, &drawmap); @@ -538,7 +542,8 @@ void LabEngine::processMap(uint16 CurRoom) { _graphics->fade(true, 0); } else CurFloor = OldFloor; - } else if (GadgetID == 2) { /* Down arrow */ + } else if (GadgetID == 2) { + // Down arrow OldFloor = CurFloor; getDownFloor(&CurFloor, &drawmap); diff --git a/engines/lab/music.cpp b/engines/lab/music.cpp index 1c043efdb7..4bf15027c5 100644 --- a/engines/lab/music.cpp +++ b/engines/lab/music.cpp @@ -272,9 +272,12 @@ void Music::changeMusic(const char *newmusic) { } _file = g_lab->_resource->openDataFile(newmusic); - _musicOn = true; /* turn it off */ + // turn music off + _musicOn = true; setMusic(false); - _musicOn = false; /* turn it back on */ + + // turn it back on + _musicOn = false; setMusic(true); } diff --git a/engines/lab/music.h b/engines/lab/music.h index 3114817ba3..6d102e7783 100644 --- a/engines/lab/music.h +++ b/engines/lab/music.h @@ -41,9 +41,9 @@ namespace Lab { class LabEngine; -/*---------------------------*/ -/*----- From LabMusic.c -----*/ -/*---------------------------*/ +//--------------------------- +//----- From LabMusic.c ----- +//--------------------------- #define MAXBUFFERS 5L @@ -98,4 +98,4 @@ private: } // End of namespace Lab -#endif /* LAB_MUSIC_H */ +#endif // LAB_MUSIC_H diff --git a/engines/lab/processroom.cpp b/engines/lab/processroom.cpp index e037522acf..26e91e5688 100644 --- a/engines/lab/processroom.cpp +++ b/engines/lab/processroom.cpp @@ -39,12 +39,11 @@ namespace Lab { -/* Global parser data */ #define NOFILE "no file" -/*****************************************************************************/ -/* Generates a random number. */ -/*****************************************************************************/ +/** + * Generates a random number. + */ uint16 getRandom(uint16 max) { uint32 secs, micros; @@ -52,9 +51,9 @@ uint16 getRandom(uint16 max) { return ((micros + secs) % max); } -/*****************************************************************************/ -/* Checks whether all the conditions in a condition list are met. */ -/*****************************************************************************/ +/** + * Checks whether all the conditions in a condition list are met. + */ static bool checkConditions(int16 *condition) { if (condition == NULL) return true; @@ -73,9 +72,9 @@ static bool checkConditions(int16 *condition) { return res; } -/*****************************************************************************/ -/* Gets the current ViewDataPointer. */ -/*****************************************************************************/ +/** + * Gets the current ViewDataPointer. + */ ViewData *getViewData(uint16 roomNum, uint16 direction) { if (!g_lab->_rooms[roomNum]._roomMsg) g_lab->_resource->readViews(roomNum); @@ -92,9 +91,9 @@ ViewData *getViewData(uint16 roomNum, uint16 direction) { return view; } -/*****************************************************************************/ -/* Gets an object, if any, from the user's click on the screen. */ -/*****************************************************************************/ +/** + * Gets an object, if any, from the user's click on the screen. + */ static CloseData *getObject(uint16 x, uint16 y, CloseDataPtr lcptr) { if (lcptr == NULL) { lcptr = getViewData(g_lab->_roomNum, g_lab->_direction)->_closeUps; @@ -113,12 +112,12 @@ static CloseData *getObject(uint16 x, uint16 y, CloseDataPtr lcptr) { return NULL; } -/*****************************************************************************/ -/* Goes through the list of closeups to find a match. */ -/* NYI: Known bug here. If there are two objects that have closeups, and */ -/* some of the closeups have the same hit boxes, then this returns the */ -/* first occurence of the object with the same hit box. */ -/*****************************************************************************/ +/** + * Goes through the list of closeups to find a match. + * NYI: Known bug here. If there are two objects that have closeups, and + * some of the closeups have the same hit boxes, then this returns the + * first occurence of the object with the same hit box. + */ static CloseDataPtr findCPtrMatch(CloseDataPtr cpmain, CloseDataPtr list) { CloseDataPtr cptr; @@ -139,9 +138,9 @@ static CloseDataPtr findCPtrMatch(CloseDataPtr cpmain, CloseDataPtr list) { return NULL; } -/*****************************************************************************/ -/* Returns the current picture name. */ -/*****************************************************************************/ +/** + * Returns the current picture name. + */ char *LabEngine::getPictName(CloseDataPtr *lcptr) { ViewData *viewPtr = getViewData(g_lab->_roomNum, g_lab->_direction); @@ -155,9 +154,9 @@ char *LabEngine::getPictName(CloseDataPtr *lcptr) { return viewPtr->_graphicName; } -/*****************************************************************************/ -/* Draws the current direction to the screen. */ -/*****************************************************************************/ +/** + * Draws the current direction to the screen. + */ void LabEngine::drawDirection(CloseDataPtr lcptr) { if (lcptr != NULL && lcptr->_message) { _graphics->drawMessage(lcptr->_message); @@ -183,9 +182,9 @@ void LabEngine::drawDirection(CloseDataPtr lcptr) { _graphics->drawMessage(message.c_str()); } -/*****************************************************************************/ -/* process a arrow gadget movement. */ -/*****************************************************************************/ +/** + * process a arrow gadget movement. + */ uint16 processArrow(uint16 curDirection, uint16 arrow) { if (arrow == 1) { // Forward uint16 room = 1; @@ -227,9 +226,9 @@ uint16 processArrow(uint16 curDirection, uint16 arrow) { return curDirection; } -/*****************************************************************************/ -/* Sets the current close up data. */ -/*****************************************************************************/ +/** + * Sets the current close up data. + */ void setCurClose(Common::Point pos, CloseDataPtr *cptr, bool useAbsoluteCoords) { CloseDataPtr lcptr; uint16 x1, y1, x2, y2; @@ -261,9 +260,9 @@ void setCurClose(Common::Point pos, CloseDataPtr *cptr, bool useAbsoluteCoords) } } -/*****************************************************************************/ -/* Takes the currently selected item. */ -/*****************************************************************************/ +/** + * Takes the currently selected item. + */ bool takeItem(uint16 x, uint16 y, CloseDataPtr *cptr) { CloseDataPtr lcptr; @@ -290,9 +289,9 @@ bool takeItem(uint16 x, uint16 y, CloseDataPtr *cptr) { return false; } -/*****************************************************************************/ -/* Processes the action list. */ -/*****************************************************************************/ +/** + * Processes the action list. + */ void LabEngine::doActions(Action *aptr, CloseDataPtr *lcptr) { while (aptr) { _music->updateMusic(); @@ -327,7 +326,8 @@ void LabEngine::doActions(Action *aptr, CloseDataPtr *lcptr) { case LOADDIFF: if (aptr->_data) - _graphics->loadPict((char *)aptr->_data); /* Puts a file into memory */ + // Puts a file into memory + _graphics->loadPict((char *)aptr->_data); break; @@ -520,7 +520,8 @@ void LabEngine::doActions(Action *aptr, CloseDataPtr *lcptr) { _anim->_doBlack = (_cptr == NULL); else if (aptr->_param1 == 2) _anim->_doBlack = (_cptr != NULL); - else if (aptr->_param1 == 5) { /* inverse the palette */ + else if (aptr->_param1 == 5) { + // inverse the palette for (uint16 idx = (8 * 3); idx < (255 * 3); idx++) _anim->_diffPalette[idx] = 255 - _anim->_diffPalette[idx]; @@ -528,16 +529,19 @@ void LabEngine::doActions(Action *aptr, CloseDataPtr *lcptr) { _graphics->setPalette(_anim->_diffPalette, 256); waitTOF(); waitTOF(); - } else if (aptr->_param1 == 4) { /* white the palette */ + } else if (aptr->_param1 == 4) { + // white the palette _graphics->whiteScreen(); waitTOF(); waitTOF(); - } else if (aptr->_param1 == 6) { /* Restore the palette */ + } else if (aptr->_param1 == 6) { + // Restore the palette waitTOF(); _graphics->setPalette(_anim->_diffPalette, 256); waitTOF(); waitTOF(); - } else if (aptr->_param1 == 7) { /* Quick pause */ + } else if (aptr->_param1 == 7) { + // Quick pause waitTOF(); waitTOF(); waitTOF(); @@ -563,9 +567,9 @@ void LabEngine::doActions(Action *aptr, CloseDataPtr *lcptr) { _music->_doNotFilestopSoundEffect = false; } -/*****************************************************************************/ -/* Does the work for doActionRule. */ -/*****************************************************************************/ +/** + * Does the work for doActionRule. + */ static bool doActionRuleSub(int16 action, int16 roomNum, CloseDataPtr lcptr, CloseDataPtr *set, bool allowDefaults) { action++; @@ -595,9 +599,9 @@ static bool doActionRuleSub(int16 action, int16 roomNum, CloseDataPtr lcptr, Clo return false; } -/*****************************************************************************/ -/* Goes through the rules if an action is taken. */ -/*****************************************************************************/ +/** + * Goes through the rules if an action is taken. + */ bool doActionRule(Common::Point pos, int16 action, int16 roomNum, CloseDataPtr *lcptr) { if (roomNum) g_lab->_newFileName = NOFILE; @@ -618,9 +622,9 @@ bool doActionRule(Common::Point pos, int16 action, int16 roomNum, CloseDataPtr * return false; } -/*****************************************************************************/ -/* Does the work for doActionRule. */ -/*****************************************************************************/ +/** + * Does the work for doActionRule. + */ static bool doOperateRuleSub(int16 itemNum, int16 roomNum, CloseDataPtr lcptr, CloseDataPtr *set, bool allowDefaults) { if (lcptr) if (lcptr->_closeUpType > 0) { @@ -646,9 +650,9 @@ static bool doOperateRuleSub(int16 itemNum, int16 roomNum, CloseDataPtr lcptr, C return false; } -/*****************************************************************************/ -/* Goes through the rules if the user tries to operate an item on an object. */ -/*****************************************************************************/ +/** + * Goes through the rules if the user tries to operate an item on an object. + */ bool doOperateRule(int16 x, int16 y, int16 ItemNum, CloseDataPtr *lcptr) { CloseDataPtr tlcptr; @@ -680,9 +684,9 @@ bool doOperateRule(int16 x, int16 y, int16 ItemNum, CloseDataPtr *lcptr) { return false; } -/*****************************************************************************/ -/* Goes through the rules if the user tries to go forward. */ -/*****************************************************************************/ +/** + * Goes through the rules if the user tries to go forward. + */ bool doGoForward(CloseDataPtr *lcptr) { RuleList *rules = g_lab->_rooms[g_lab->_roomNum]._rules; @@ -698,9 +702,9 @@ bool doGoForward(CloseDataPtr *lcptr) { return false; } -/*****************************************************************************/ -/* Goes through the rules if the user tries to turn. */ -/*****************************************************************************/ +/** + * Goes through the rules if the user tries to turn. + */ bool doTurn(uint16 from, uint16 to, CloseDataPtr *lcptr) { from++; to++; @@ -721,9 +725,9 @@ bool doTurn(uint16 from, uint16 to, CloseDataPtr *lcptr) { return false; } -/*****************************************************************************/ -/* Goes through the rules if the user tries to go to the main view */ -/*****************************************************************************/ +/** + * Goes through the rules if the user tries to go to the main view + */ bool doMainView(CloseDataPtr *lcptr) { RuleList *rules = g_lab->_rooms[g_lab->_roomNum]._rules; for (RuleList::iterator rule = rules->begin(); rule != rules->end(); ++rule) { diff --git a/engines/lab/processroom.h b/engines/lab/processroom.h index d69dae1f55..e4cb84e644 100644 --- a/engines/lab/processroom.h +++ b/engines/lab/processroom.h @@ -33,7 +33,7 @@ namespace Lab { - /*------------------------------- Action types ------------------------------*/ +//------------------------------- Action types ------------------------------ #define PLAYSOUND 1 #define PLAYSOUNDCONT 2 #define SHOWDIFF 3 @@ -71,7 +71,7 @@ namespace Lab { #define CSHOWMESSAGE 35 #define PLAYSOUNDB 36 - /* Rule Types */ +// Rule Types #define ACTION 1 #define OPERATE 2 #define GOFORWARD 3 @@ -80,7 +80,7 @@ namespace Lab { #define GOMAINVIEW 6 #define TURNFROMTO 7 - /*----------------------------- Rule Type Action ----------------------------*/ +//----------------------------- Rule Type Action ---------------------------- #define TAKE 1 #define MOVE 2 #define OPENDOOR 3 @@ -93,8 +93,8 @@ namespace Lab { typedef struct CloseData { uint16 x1, y1, x2, y2; - int16 _closeUpType; /* if > 0, an object. If < 0, an item */ - uint16 _depth; /* Level of the closeup. */ + int16 _closeUpType; // if > 0, an object. If < 0, an item + uint16 _depth; // Level of the closeup. char *_graphicName; char *_message; CloseData *_nextCloseUp; @@ -115,7 +115,7 @@ struct Action { int16 _param1; int16 _param2; int16 _param3; - byte *_data; /* Message, or a pointer to array of messages. */ + byte *_data; // Message, or a pointer to array of messages. Action *_nextAction; }; @@ -147,15 +147,15 @@ struct InventoryData { char *_bitmapName; }; -/* Map Flags */ +// Map Flags -/* Where the doors are; in a corridor, assumed to be left doors */ +// Where the doors are; in a corridor, assumed to be left doors #define NORTHDOOR 1L #define EASTDOOR 2L #define SOUTHDOOR 4L #define WESTDOOR 8L -/* Where the doors are in corridors; M means middle, R means right, B means bottom */ +// Where the doors are in corridors; M means middle, R means right, B means bottom #define NORTHMDOOR 16L #define NORTHRDOOR 32L #define SOUTHMDOOR 64L @@ -166,7 +166,7 @@ struct InventoryData { #define WESTMDOOR 64L #define WESTBDOOR 128L -/* Special Map ID's */ +// Special Map ID's #define NORMAL 0 #define UPARROWROOM 1 #define DOWNARROWROOM 2 @@ -203,4 +203,4 @@ bool doMainView(CloseDataPtr *lcptr); } // End of namespace Lab -#endif /* LAB_PROCESSROOM_H */ +#endif // LAB_PROCESSROOM_H diff --git a/engines/lab/resource.h b/engines/lab/resource.h index cf7f3505ec..cfba7abd57 100644 --- a/engines/lab/resource.h +++ b/engines/lab/resource.h @@ -122,4 +122,4 @@ private: } // End of namespace Lab -#endif /* LAB_RESOURCE_H */ +#endif // LAB_RESOURCE_H diff --git a/engines/lab/savegame.cpp b/engines/lab/savegame.cpp index 10f52a2582..5924d884b9 100644 --- a/engines/lab/savegame.cpp +++ b/engines/lab/savegame.cpp @@ -37,13 +37,9 @@ #include "lab/labfun.h" namespace Lab { - -// Labyrinth of Time ScummVM #define SAVEGAME_ID MKTAG('L', 'O', 'T', 'S') #define SAVEGAME_VERSION 1 -/*----- The machine independent section of saveGame.c -----*/ - void writeSaveGameHeader(Common::OutSaveFile *out, const Common::String &saveName) { out->writeUint32BE(SAVEGAME_ID); diff --git a/engines/lab/special.cpp b/engines/lab/special.cpp index 62d45d12b3..6395ee9a7c 100644 --- a/engines/lab/special.cpp +++ b/engines/lab/special.cpp @@ -335,7 +335,8 @@ void LabEngine::processJournal() { uint16 Qualifier, GadID; while (1) { - _music->updateMusic(); /* Make sure we check the music at least after every message */ + // Make sure we check the music at least after every message + _music->updateMusic(); Msg = getMsg(); if (Msg == NULL) { @@ -544,7 +545,8 @@ void LabEngine::processMonitor(char *ntext, TextFont *monitorFont, bool isintera } } - _music->updateMusic(); /* Make sure we check the music at least after every message */ + // Make sure we check the music at least after every message + _music->updateMusic(); Msg = getMsg(); if (Msg == NULL) { diff --git a/engines/lab/tilepuzzle.cpp b/engines/lab/tilepuzzle.cpp index c6997c5ed2..68f4771833 100644 --- a/engines/lab/tilepuzzle.cpp +++ b/engines/lab/tilepuzzle.cpp @@ -140,7 +140,8 @@ void LabEngine::changeTile(uint16 col, uint16 row) { } if (check) { - _conditions->inclElement(BRICKOPEN); /* unlocked combination */ + // unlocked combination + _conditions->inclElement(BRICKOPEN); _anim->_doBlack = true; _graphics->readPict("p:Up/BDOpen", true); } -- cgit v1.2.3 From 0b2bf45a09ba2b5d1fc1593e629118c03b99f38f Mon Sep 17 00:00:00 2001 From: Filippos Karapetis Date: Tue, 8 Dec 2015 16:50:44 +0200 Subject: LAB: Simplify the gadget enabling/disabling code --- engines/lab/eventman.cpp | 3 +-- engines/lab/interface.cpp | 9 +++++---- engines/lab/interface.h | 5 +---- 3 files changed, 7 insertions(+), 10 deletions(-) diff --git a/engines/lab/eventman.cpp b/engines/lab/eventman.cpp index ad56b46fbc..7760ba2085 100644 --- a/engines/lab/eventman.cpp +++ b/engines/lab/eventman.cpp @@ -63,9 +63,8 @@ Gadget *EventManager::checkGadgetHit(GadgetList *gadgetList, Common::Point pos) for (GadgetList::iterator gadgetItr = gadgetList->begin(); gadgetItr != gadgetList->end(); ++gadgetItr) { Gadget *gadget = *gadgetItr; Common::Rect gadgetRect(gadget->x, gadget->y, gadget->x + gadget->_image->_width - 1, gadget->y + gadget->_image->_height - 1); - bool gadgetIsEnabled = !(gadget->_flags & GADGETOFF); - if (gadgetRect.contains(pos) && gadgetIsEnabled) { + if (gadgetRect.contains(pos) && gadget->isEnabled) { if (_vm->_isHiRes) { _hitGadget = gadget; } else { diff --git a/engines/lab/interface.cpp b/engines/lab/interface.cpp index 13cbd1e581..d041160349 100644 --- a/engines/lab/interface.cpp +++ b/engines/lab/interface.cpp @@ -48,6 +48,7 @@ Gadget *createButton(uint16 x, uint16 y, uint16 id, uint16 key, Image *im, Image gptr->_keyEquiv = key; gptr->_image = im; gptr->_altImage = imalt; + gptr->isEnabled = true; return gptr; } else @@ -69,7 +70,7 @@ void drawGadgetList(GadgetList *gadgetList) { for (GadgetList::iterator gadget = gadgetList->begin(); gadget != gadgetList->end(); ++gadget) { (*gadget)->_image->drawImage((*gadget)->x, (*gadget)->y); - if (GADGETOFF & (*gadget)->_flags) + if (!(*gadget)->isEnabled) disableGadget((*gadget), 1); } } @@ -79,7 +80,7 @@ void drawGadgetList(GadgetList *gadgetList) { */ void disableGadget(Gadget *curgad, uint16 pencolor) { g_lab->_graphics->overlayRect(pencolor, curgad->x, curgad->y, curgad->x + curgad->_image->_width - 1, curgad->y + curgad->_image->_height - 1); - curgad->_flags |= GADGETOFF; + curgad->isEnabled = false; } /** @@ -87,7 +88,7 @@ void disableGadget(Gadget *curgad, uint16 pencolor) { */ void enableGadget(Gadget *curgad) { curgad->_image->drawImage(curgad->x, curgad->y); - curgad->_flags &= !(GADGETOFF); + curgad->isEnabled = true; } /** @@ -114,7 +115,7 @@ Gadget *LabEngine::checkNumGadgetHit(GadgetList *gadgetList, uint16 key) { Gadget *gadget = *gadgetItr; if ((gkey - 1 == gadget->_gadgetID || (gkey == 0 && gadget->_gadgetID == 9) || (gadget->_keyEquiv != 0 && makeGadgetKeyEquiv(key) == gadget->_keyEquiv)) - && !(GADGETOFF & gadget->_flags)) { + && gadget->isEnabled) { _event->mouseHide(); gadget->_altImage->drawImage(gadget->x, gadget->y); _event->mouseShow(); diff --git a/engines/lab/interface.h b/engines/lab/interface.h index bd9c3c9697..50e89e38f7 100644 --- a/engines/lab/interface.h +++ b/engines/lab/interface.h @@ -46,13 +46,10 @@ struct IntuiMessage { struct Gadget { uint16 x, y, _gadgetID; uint16 _keyEquiv; // if not zero, a key that activates gadget - uint32 _flags; + bool isEnabled; Image *_image, *_altImage; }; -// Defines for the GadgetFlags portion -#define GADGETOFF 0x01 - typedef Common::List GadgetList; // Defines for the Class variable in IntuiMessage -- cgit v1.2.3 From 6230fcbeb9e19c1db8bf50dd06fc02ffee925c01 Mon Sep 17 00:00:00 2001 From: Filippos Karapetis Date: Tue, 8 Dec 2015 16:53:30 +0200 Subject: LAB: Simplify the journal and map gadget handling --- engines/lab/eventman.cpp | 10 ++++++++ engines/lab/eventman.h | 1 + engines/lab/lab.h | 5 ++++ engines/lab/map.cpp | 58 +++++++++++++------------------------------- engines/lab/special.cpp | 62 ++++++++++++------------------------------------ 5 files changed, 47 insertions(+), 89 deletions(-) diff --git a/engines/lab/eventman.cpp b/engines/lab/eventman.cpp index 7760ba2085..53361c9e8a 100644 --- a/engines/lab/eventman.cpp +++ b/engines/lab/eventman.cpp @@ -94,6 +94,16 @@ void EventManager::attachGadgetList(GadgetList *gadgetList) { _screenGadgetList = gadgetList; } +Gadget *EventManager::getGadget(uint16 id) { + for (GadgetList::iterator gadgetItr = _screenGadgetList->begin(); gadgetItr != _screenGadgetList->end(); ++gadgetItr) { + Gadget *gadget = *gadgetItr; + if (gadget->_gadgetID == id) + return gadget; + } + + return nullptr; +} + EventManager::EventManager(LabEngine *vm) : _vm(vm) { _leftClick = false; _rightClick = false; diff --git a/engines/lab/eventman.h b/engines/lab/eventman.h index f87d7ee2db..420c7d03df 100644 --- a/engines/lab/eventman.h +++ b/engines/lab/eventman.h @@ -67,6 +67,7 @@ public: bool mouseButton(uint16 *x, uint16 *y, bool leftButton); Gadget *mouseGadget(); void attachGadgetList(GadgetList *gadgetList); + Gadget *getGadget(uint16 id); void mouseHandler(int flag, Common::Point pos); bool keyPress(uint16 *keyCode); bool haveNextChar(); diff --git a/engines/lab/lab.h b/engines/lab/lab.h index 6b2efdae54..2604579ca9 100644 --- a/engines/lab/lab.h +++ b/engines/lab/lab.h @@ -149,6 +149,8 @@ private: CloseDataPtr _cptr; InventoryData *_inventory; Image *_tiles[16]; + GadgetList _journalGadgetList; + GadgetList _mapGadgetList; private: bool from_crumbs(uint32 tmpClass, uint16 code, uint16 Qualifier, Common::Point tmpPos, uint16 &curInv, IntuiMessage * curMsg, bool &forceDraw, uint16 gadgetId, uint16 &actionMode); @@ -161,9 +163,12 @@ public: void decIncInv(uint16 *CurInv, bool dec); Gadget *checkNumGadgetHit(GadgetList *gadgetList, uint16 key); IntuiMessage *getMsg(); + void loadMapData(); void drawMap(uint16 CurRoom, uint16 CurMsg, uint16 Floor, bool fadeout, bool fadein); void processMap(uint16 CurRoom); void doMap(uint16 CurRoom); + void freeMapData(); + void loadJournalData(); void drawJournal(uint16 wipenum, bool needFade); void processJournal(); void doJournal(); diff --git a/engines/lab/map.cpp b/engines/lab/map.cpp index b09ca506f2..b509039277 100644 --- a/engines/lab/map.cpp +++ b/engines/lab/map.cpp @@ -49,15 +49,6 @@ static Image *Map, *Room, *UpArrowRoom, *DownArrowRoom, *Bridge, static uint16 MaxRooms; static MapData *Maps; -static uint16 MapGadX[3] = {101, 55, 8}, MapGadY[3] = {105, 105, 105}; - -static Gadget - backgadget = { 8, 105, 0, 0, 0L, NULL, NULL }, - upgadget = { 55, 105, 1, VKEY_UPARROW, 0L, NULL, NULL }, - downgadget = { 101, 105, 2, VKEY_DNARROW, 0L, NULL, NULL }; - -static GadgetList *MapGadgetList; - #define LOWERFLOOR 1 #define MIDDLEFLOOR 2 #define UPPERFLOOR 3 @@ -83,14 +74,8 @@ static uint16 mapScaleY(uint16 y) { /** * Loads in the map data. */ -static bool loadMapData() { - uint16 counter; - - MapGadgetList = new GadgetList(); - MapGadgetList->push_back(&backgadget); - MapGadgetList->push_back(&upgadget); - MapGadgetList->push_back(&downgadget); - +void LabEngine::loadMapData() { + Utils *utils = g_lab->_utils; Common::File *mapImages = g_lab->_resource->openDataFile("P:MapImage"); Map = new Image(mapImages); @@ -111,23 +96,12 @@ static bool loadMapData() { Path = new Image(mapImages); Bridge = new Image(mapImages); - backgadget._image = new Image(mapImages); - backgadget._altImage = new Image(mapImages); - upgadget._image = new Image(mapImages); - upgadget._altImage = new Image(mapImages); - downgadget._image = new Image(mapImages); - downgadget._altImage = new Image(mapImages); + _mapGadgetList.push_back(createButton( 8, utils->vgaScaleY(105), 0, VKEY_LTARROW, new Image(mapImages), new Image(mapImages))); // back + _mapGadgetList.push_back(createButton( 55, utils->vgaScaleY(105), 1, VKEY_UPARROW, new Image(mapImages), new Image(mapImages))); // up + _mapGadgetList.push_back(createButton(101, utils->vgaScaleY(105), 2, VKEY_DNARROW, new Image(mapImages), new Image(mapImages))); // down delete mapImages; - counter = 0; - - for (GadgetList::iterator gadget = MapGadgetList->begin(); gadget != MapGadgetList->end(); ++gadget) { - (*gadget)->x = g_lab->_utils->vgaScaleX(MapGadX[counter]); - (*gadget)->y = g_lab->_utils->vgaScaleY(MapGadY[counter]); - counter++; - } - Common::File *mapFile = g_lab->_resource->openDataFile("Lab:Maps", MKTAG('M', 'A', 'P', '0')); g_lab->_music->updateMusic(); if (!g_lab->_music->_doNotFilestopSoundEffect) @@ -144,13 +118,10 @@ static bool loadMapData() { } delete mapFile; - - return true; } -static void freeMapData() { - MapGadgetList->clear(); - delete MapGadgetList; +void LabEngine::freeMapData() { + freeButtonList(&_mapGadgetList); delete[] Maps; Maps = NULL; @@ -406,7 +377,7 @@ void LabEngine::drawMap(uint16 CurRoom, uint16 CurMsg, uint16 Floor, bool fadeou _graphics->rectFill(0, 0, _graphics->_screenWidth - 1, _graphics->_screenHeight - 1); Map->drawImage(0, 0); - drawGadgetList(MapGadgetList); + drawGadgetList(&_mapGadgetList); for (uint16 i = 1; i <= MaxRooms; i++) { if ((Maps[i].PageNumber == Floor) && _roomsFound->in(i) && Maps[i].x) { @@ -424,18 +395,21 @@ void LabEngine::drawMap(uint16 CurRoom, uint16 CurMsg, uint16 Floor, bool fadeou tempfloor = Floor; getUpFloor(&tempfloor, &noOverlay); + Gadget *upGadget = _event->getGadget(1); + Gadget *downGadget = _event->getGadget(2); + if (noOverlay) - enableGadget(&upgadget); + enableGadget(upGadget); else - disableGadget(&upgadget, 12); + disableGadget(upGadget, 12); tempfloor = Floor; getDownFloor(&tempfloor, &noOverlay); if (noOverlay) - enableGadget(&downgadget); + enableGadget(downGadget); else - disableGadget(&downgadget, 12); + disableGadget(downGadget, 12); // Labyrinth specific code if (Floor == LOWERFLOOR) { @@ -660,9 +634,9 @@ void LabEngine::doMap(uint16 CurRoom) { else if (_direction == WEST) XMark = MapWest; + _event->attachGadgetList(&_mapGadgetList); drawMap(CurRoom, CurRoom, Maps[CurRoom].PageNumber, false, true); _event->mouseShow(); - _event->attachGadgetList(MapGadgetList); _graphics->screenUpdate(); processMap(CurRoom); _event->attachGadgetList(NULL); diff --git a/engines/lab/special.cpp b/engines/lab/special.cpp index 6395ee9a7c..5aa8db5181 100644 --- a/engines/lab/special.cpp +++ b/engines/lab/special.cpp @@ -51,8 +51,6 @@ static char *journaltext, *journaltexttitle; static uint16 JPage = 0; static bool lastpage = false; static Image JBackImage, ScreenImage; -static uint16 JGadX[3] = { 80, 144, 194 }, JGadY[3] = { 162, 164, 162 }; -static Gadget ForwardG, CancelG, BackG; static bool GotBackImage = false; static uint16 monitorPage; static const char *TextFileName; @@ -150,7 +148,7 @@ void LabEngine::doWestPaper() { /** * Loads in the data for the journal. */ -static bool loadJournalData() { +void LabEngine::loadJournalData() { char filename[20]; bool bridge, dirty, news, clean; @@ -187,40 +185,11 @@ static bool loadJournalData() { journaltexttitle = g_lab->_resource->getText("Lab:Rooms/jt"); Common::File *journalFile = g_lab->_resource->openDataFile("P:JImage"); - - BackG._image = new Image(journalFile); - BackG._altImage = new Image(journalFile); - ForwardG._image = new Image(journalFile); - ForwardG._altImage = new Image(journalFile); - CancelG._image = new Image(journalFile); - CancelG._altImage = new Image(journalFile); - + Utils *utils = g_lab->_utils; + _journalGadgetList.push_back(createButton( 80, utils->vgaScaleY(162) + utils->svgaCord(1), 0, VKEY_LTARROW, new Image(journalFile), new Image(journalFile))); // back + _journalGadgetList.push_back(createButton(144, utils->vgaScaleY(164) - utils->svgaCord(1), 1, VKEY_RTARROW, new Image(journalFile), new Image(journalFile))); // foward + _journalGadgetList.push_back(createButton(194, utils->vgaScaleY(162) + utils->svgaCord(1), 2, 0, new Image(journalFile), new Image(journalFile))); // cancel delete journalFile; - - BackG._keyEquiv = VKEY_LTARROW; - ForwardG._keyEquiv = VKEY_RTARROW; - - uint16 counter = 0; - - GadgetList journalGadgetList; - journalGadgetList.push_back(&BackG); - journalGadgetList.push_back(&CancelG); - journalGadgetList.push_back(&ForwardG); - - for (GadgetList::iterator gadgetIter = journalGadgetList.begin(); gadgetIter != journalGadgetList.end(); ++gadgetIter) { - Gadget *gadget = *gadgetIter; - gadget->x = g_lab->_utils->vgaScaleX(JGadX[counter]); - - if (counter == 1) - gadget->y = g_lab->_utils->vgaScaleY(JGadY[counter]) + g_lab->_utils->svgaCord(1); - else - gadget->y = g_lab->_utils->vgaScaleY(JGadY[counter]) - g_lab->_utils->svgaCord(1); - - gadget->_gadgetID = counter; - counter++; - } - - return true; } /** @@ -302,15 +271,18 @@ void LabEngine::drawJournal(uint16 wipenum, bool needFade) { else turnPage((bool)(wipenum == 1)); + Gadget *backGadget = _event->getGadget(0); + Gadget *forwardGadget = _event->getGadget(1); + if (JPage == 0) - disableGadget(&BackG, 15); + disableGadget(backGadget, 15); else - enableGadget(&BackG); + enableGadget(backGadget); if (lastpage) - disableGadget(&ForwardG, 15); + disableGadget(forwardGadget, 15); else - enableGadget(&ForwardG); + enableGadget(forwardGadget); if (needFade) @@ -373,11 +345,6 @@ void LabEngine::processJournal() { * Does the journal processing. */ void LabEngine::doJournal() { - GadgetList journalGadgetList; - journalGadgetList.push_back(&BackG); - journalGadgetList.push_back(&CancelG); - journalGadgetList.push_back(&ForwardG); - _graphics->blackAllScreen(); lastpage = false; @@ -395,13 +362,13 @@ void LabEngine::doJournal() { drawJournal(0, true); - _event->attachGadgetList(&journalGadgetList); + _event->attachGadgetList(&_journalGadgetList); _event->mouseShow(); processJournal(); _event->attachGadgetList(NULL); _graphics->fade(false, 0); _event->mouseHide(); - journalGadgetList.clear(); + freeButtonList(&_journalGadgetList); ScreenImage._imageData = _graphics->getCurrentDrawingBuffer(); @@ -445,6 +412,7 @@ bool LabEngine::saveRestoreGame() { } } + //_event->attachGadgetList(&_moveGadgetList); _graphics->screenUpdate(); return isOK; -- cgit v1.2.3 From c4ca8223b73060d8ae38977fe0624ed7a3d920aa Mon Sep 17 00:00:00 2001 From: Filippos Karapetis Date: Tue, 8 Dec 2015 16:55:04 +0200 Subject: LAB: Plug a memory leak in freeButtonList() --- engines/lab/interface.cpp | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/engines/lab/interface.cpp b/engines/lab/interface.cpp index d041160349..dae822b8ff 100644 --- a/engines/lab/interface.cpp +++ b/engines/lab/interface.cpp @@ -56,8 +56,11 @@ Gadget *createButton(uint16 x, uint16 y, uint16 id, uint16 key, Image *im, Image } void freeButtonList(GadgetList *gadgetList) { - for (GadgetList::iterator gadget = gadgetList->begin(); gadget != gadgetList->end(); ++gadget) { - delete *gadget; + for (GadgetList::iterator gadgetIter = gadgetList->begin(); gadgetIter != gadgetList->end(); ++gadgetIter) { + Gadget *gadget = *gadgetIter; + delete gadget->_image; + delete gadget->_altImage; + delete gadget; } gadgetList->clear(); -- cgit v1.2.3 From 4340295fbfe767d5248390f9f1b154c22127e549 Mon Sep 17 00:00:00 2001 From: Filippos Karapetis Date: Tue, 8 Dec 2015 17:08:04 +0200 Subject: LAB: Rename floor defines --- engines/lab/map.cpp | 91 +++++++++++++++++++++++++++-------------------------- 1 file changed, 47 insertions(+), 44 deletions(-) diff --git a/engines/lab/map.cpp b/engines/lab/map.cpp index b509039277..8cd0ed93a7 100644 --- a/engines/lab/map.cpp +++ b/engines/lab/map.cpp @@ -49,13 +49,16 @@ static Image *Map, *Room, *UpArrowRoom, *DownArrowRoom, *Bridge, static uint16 MaxRooms; static MapData *Maps; -#define LOWERFLOOR 1 -#define MIDDLEFLOOR 2 -#define UPPERFLOOR 3 -#define MEDMAZEFLOOR 4 -#define HEDGEMAZEFLOOR 5 -#define SURMAZEFLOOR 6 -#define CARNIVAL 7 +enum MapFloor { + kFloorNone, + kFloorLower, + kFloorMiddle, + kFloorUpper, + kFloorMedMaze, + kFloorHedgeMaze, + kFloorSurMaze, + kFloorCarnival +}; static uint16 mapScaleX(uint16 x) { if (g_lab->_isHiRes) @@ -165,9 +168,9 @@ static void roomCoords(uint16 CurRoom, uint16 *x1, uint16 *y1, uint16 *x2, uint1 } /** - * Draws a room to the bitmap. + * Draws a room map. */ -static void drawRoom(uint16 CurRoom, bool drawx) { +static void drawRoomMap(uint16 CurRoom, bool drawx) { uint16 x, y, xx, xy, offset; uint32 flags; @@ -318,14 +321,14 @@ static void getUpFloor(uint16 *Floor, bool *isfloor) { do { *isfloor = true; - if (*Floor < UPPERFLOOR) + if (*Floor < kFloorUpper) (*Floor)++; else { - *Floor = CARNIVAL + 1; + *Floor = kFloorCarnival + 1; *isfloor = false; return; } - } while ((!onFloor(*Floor)) && (*Floor <= CARNIVAL)); + } while ((!onFloor(*Floor)) && (*Floor <= kFloorCarnival)); } /** @@ -336,18 +339,18 @@ static void getDownFloor(uint16 *Floor, bool *isfloor) { do { *isfloor = true; - if ((*Floor == LOWERFLOOR) || (*Floor == 0)) { + if ((*Floor == kFloorLower) || (*Floor == 0)) { *Floor = 0; *isfloor = false; return; - } else if (*Floor > UPPERFLOOR) { + } else if (*Floor > kFloorUpper) { // Labyrinth specific code - if (*Floor == HEDGEMAZEFLOOR) - *Floor = UPPERFLOOR; - else if ((*Floor == CARNIVAL) || (*Floor == MEDMAZEFLOOR)) - *Floor = MIDDLEFLOOR; - else if (*Floor == SURMAZEFLOOR) - *Floor = LOWERFLOOR; + if (*Floor == kFloorHedgeMaze) + *Floor = kFloorUpper; + else if ((*Floor == kFloorCarnival) || (*Floor == kFloorMedMaze)) + *Floor = kFloorMiddle; + else if (*Floor == kFloorSurMaze) + *Floor = kFloorLower; else { *Floor = 0; *isfloor = false; @@ -381,7 +384,7 @@ void LabEngine::drawMap(uint16 CurRoom, uint16 CurMsg, uint16 Floor, bool fadeou for (uint16 i = 1; i <= MaxRooms; i++) { if ((Maps[i].PageNumber == Floor) && _roomsFound->in(i) && Maps[i].x) { - drawRoom(i, (bool)(i == CurRoom)); + drawRoomMap(i, (bool)(i == CurRoom)); _music->updateMusic(); } } @@ -390,7 +393,7 @@ void LabEngine::drawMap(uint16 CurRoom, uint16 CurMsg, uint16 Floor, bool fadeou // NOTE: this here on purpose just in case there's some weird // condition, like the surreal maze where there are no rooms if ((Maps[CurRoom].PageNumber == Floor) && _roomsFound->in(CurRoom) && Maps[CurRoom].x) - drawRoom(CurRoom, true); + drawRoomMap(CurRoom, true); tempfloor = Floor; getUpFloor(&tempfloor, &noOverlay); @@ -412,24 +415,24 @@ void LabEngine::drawMap(uint16 CurRoom, uint16 CurMsg, uint16 Floor, bool fadeou disableGadget(downGadget, 12); // Labyrinth specific code - if (Floor == LOWERFLOOR) { - if (onFloor(SURMAZEFLOOR)) + if (Floor == kFloorLower) { + if (onFloor(kFloorSurMaze)) Maze->drawImage(mapScaleX(538), mapScaleY(277)); - } else if (Floor == MIDDLEFLOOR) { - if (onFloor(CARNIVAL)) + } else if (Floor == kFloorMiddle) { + if (onFloor(kFloorCarnival)) Maze->drawImage(mapScaleX(358), mapScaleY(72)); - if (onFloor(MEDMAZEFLOOR)) + if (onFloor(kFloorMedMaze)) Maze->drawImage(mapScaleX(557), mapScaleY(325)); - } else if (Floor == UPPERFLOOR) { - if (onFloor(HEDGEMAZEFLOOR)) + } else if (Floor == kFloorUpper) { + if (onFloor(kFloorHedgeMaze)) HugeMaze->drawImage(mapScaleX(524), mapScaleY(97)); - } else if (Floor == SURMAZEFLOOR) { + } else if (Floor == kFloorSurMaze) { sptr = (char *)_resource->getStaticText(kTextSurmazeMessage).c_str(); _graphics->flowText(_msgFont, 0, 7, 0, true, true, true, true, mapScaleX(360), 0, mapScaleX(660), mapScaleY(450), sptr); } - if (Floor >= LOWERFLOOR && Floor <= CARNIVAL) { + if (Floor >= kFloorLower && Floor <= kFloorCarnival) { sptr = (char *)_resource->getStaticText(Floor - 1).c_str(); _graphics->flowTextScaled(_msgFont, 0, 5, 3, true, true, true, true, 14, 75, 134, 97, sptr); } @@ -529,34 +532,34 @@ void LabEngine::processMap(uint16 CurRoom) { CurFloor = OldFloor; } } else if ((Class == MOUSEBUTTONS) && (IEQUALIFIER_LEFTBUTTON & Qualifier)) { - if ((CurFloor == LOWERFLOOR) && (MouseX >= mapScaleX(538)) && (MouseY >= mapScaleY(277)) + if ((CurFloor == kFloorLower) && (MouseX >= mapScaleX(538)) && (MouseY >= mapScaleY(277)) && (MouseX <= mapScaleX(633)) && (MouseY <= mapScaleY(352)) - && onFloor(SURMAZEFLOOR)) { - CurFloor = SURMAZEFLOOR; + && onFloor(kFloorSurMaze)) { + CurFloor = kFloorSurMaze; _graphics->fade(false, 0); drawMap(CurRoom, CurMsg, CurFloor, false, false); _graphics->fade(true, 0); - } else if ((CurFloor == MIDDLEFLOOR) && (MouseX >= mapScaleX(358)) && (MouseY >= mapScaleY(71)) + } else if ((CurFloor == kFloorMiddle) && (MouseX >= mapScaleX(358)) && (MouseY >= mapScaleY(71)) && (MouseX <= mapScaleX(452)) && (MouseY <= mapScaleY(147)) - && onFloor(CARNIVAL)) { - CurFloor = CARNIVAL; + && onFloor(kFloorCarnival)) { + CurFloor = kFloorCarnival; _graphics->fade(false, 0); drawMap(CurRoom, CurMsg, CurFloor, false, false); _graphics->fade(true, 0); - } else if ((CurFloor == MIDDLEFLOOR) && (MouseX >= mapScaleX(557)) && (MouseY >= mapScaleY(325)) + } else if ((CurFloor == kFloorMiddle) && (MouseX >= mapScaleX(557)) && (MouseY >= mapScaleY(325)) && (MouseX <= mapScaleX(653)) && (MouseY <= mapScaleY(401)) - && onFloor(MEDMAZEFLOOR)) { - CurFloor = MEDMAZEFLOOR; + && onFloor(kFloorMedMaze)) { + CurFloor = kFloorMedMaze; _graphics->fade(false, 0); drawMap(CurRoom, CurMsg, CurFloor, false, false); _graphics->fade(true, 0); - } else if ((CurFloor == UPPERFLOOR) && (MouseX >= mapScaleX(524)) && (MouseY >= mapScaleY(97)) + } else if ((CurFloor == kFloorUpper) && (MouseX >= mapScaleX(524)) && (MouseY >= mapScaleY(97)) && (MouseX <= mapScaleX(645)) && (MouseY <= mapScaleY(207)) - && onFloor(HEDGEMAZEFLOOR)) { - CurFloor = HEDGEMAZEFLOOR; + && onFloor(kFloorHedgeMaze)) { + CurFloor = kFloorHedgeMaze; _graphics->fade(false, 0); drawMap(CurRoom, CurMsg, CurFloor, false, false); @@ -586,7 +589,7 @@ void LabEngine::processMap(uint16 CurRoom) { _graphics->flowTextScaled(_msgFont, 0, 5, 3, true, true, true, true, 14, 148, 134, 186, sptr); if (Maps[OldMsg].PageNumber == CurFloor) - drawRoom(OldMsg, (bool)(OldMsg == CurRoom)); + drawRoomMap(OldMsg, (bool)(OldMsg == CurRoom)); roomCoords(CurMsg, &x1, &y1, &x2, &y2); x1 = (x1 + x2) / 2; -- cgit v1.2.3 From ff6dfee221ac017caeb3c10389766129b0339e5e Mon Sep 17 00:00:00 2001 From: Filippos Karapetis Date: Tue, 8 Dec 2015 17:14:27 +0200 Subject: LAB: Initialize the game interface correctly after saving/loading --- engines/lab/special.cpp | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/engines/lab/special.cpp b/engines/lab/special.cpp index 5aa8db5181..502520a588 100644 --- a/engines/lab/special.cpp +++ b/engines/lab/special.cpp @@ -412,7 +412,8 @@ bool LabEngine::saveRestoreGame() { } } - //_event->attachGadgetList(&_moveGadgetList); + _alternate = false; + _mainDisplay = true; _graphics->screenUpdate(); return isOK; -- cgit v1.2.3 From c9ca5a0dd02bd83c1ed78a3f387206f69c8ebbab Mon Sep 17 00:00:00 2001 From: Filippos Karapetis Date: Tue, 8 Dec 2015 17:19:08 +0200 Subject: LAB: Remove unused return values --- engines/lab/engine.cpp | 6 +----- engines/lab/graphics.cpp | 11 +++-------- engines/lab/graphics.h | 4 ++-- 3 files changed, 6 insertions(+), 15 deletions(-) diff --git a/engines/lab/engine.cpp b/engines/lab/engine.cpp index 5ea7df8c67..fe334f4e7e 100644 --- a/engines/lab/engine.cpp +++ b/engines/lab/engine.cpp @@ -1063,11 +1063,7 @@ bool LabEngine::from_crumbs(uint32 tmpClass, uint16 code, uint16 Qualifier, Comm void LabEngine::go() { _isHiRes = ((getFeatures() & GF_LOWRES) == 0); - - if (!_graphics->setUpScreens()) { - _isHiRes = false; - _graphics->setUpScreens(); - } + _graphics->setUpScreens(); _event->initMouse(); _msgFont = _resource->getFont("P:AvanteG.12"); diff --git a/engines/lab/graphics.cpp b/engines/lab/graphics.cpp index 3d0bbe16db..efd24b294d 100644 --- a/engines/lab/graphics.cpp +++ b/engines/lab/graphics.cpp @@ -426,9 +426,8 @@ void DisplayMan::drawPanel() { /** * Sets up the Labyrinth screens, and opens up the initial windows. */ -bool DisplayMan::setUpScreens() { - if (!createScreen(_vm->_isHiRes)) - return false; +void DisplayMan::setUpScreens() { + createScreen(_vm->_isHiRes); Common::File *controlFile = _vm->_resource->openDataFile("P:Control"); for (uint16 i = 0; i < 20; i++) @@ -475,8 +474,6 @@ bool DisplayMan::setUpScreens() { } delete invFile; - - return true; } /** @@ -543,7 +540,7 @@ void DisplayMan::screenUpdate() { /** * Sets up either a low-res or a high-res 256 color screen. */ -bool DisplayMan::createScreen(bool hiRes) { +void DisplayMan::createScreen(bool hiRes) { if (hiRes) { _screenWidth = 640; _screenHeight = 480; @@ -553,8 +550,6 @@ bool DisplayMan::createScreen(bool hiRes) { } _screenBytesPerPage = _screenWidth * _screenHeight; _displayBuffer = new byte[_screenBytesPerPage]; // FIXME: Memory leak! - - return true; } /** diff --git a/engines/lab/graphics.h b/engines/lab/graphics.h index 71c824618b..c2c3e824fd 100644 --- a/engines/lab/graphics.h +++ b/engines/lab/graphics.h @@ -89,7 +89,7 @@ public: void blackAllScreen(); void createBox(uint16 y2); void drawPanel(); - bool setUpScreens(); + void setUpScreens(); int32 longDrawMessage(const char *str); void drawMessage(const char *str); void setAPen(byte pennum); @@ -137,7 +137,7 @@ public: void drawHLine(uint16 x, uint16 y1, uint16 y2); void drawVLine(uint16 x1, uint16 y, uint16 x2); void screenUpdate(); - bool createScreen(bool HiRes); + void createScreen(bool HiRes); void setAmigaPal(uint16 *pal, uint16 numColors); void writeColorRegs(byte *buf, uint16 first, uint16 numreg); void setPalette(void *cmap, uint16 numcolors); -- cgit v1.2.3 From 90e221a570bf684dee016a0aaa5e8ca968465390 Mon Sep 17 00:00:00 2001 From: Filippos Karapetis Date: Tue, 8 Dec 2015 17:34:12 +0200 Subject: LAB: Plug a memory leak --- engines/lab/special.cpp | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/engines/lab/special.cpp b/engines/lab/special.cpp index 502520a588..cce06e69dc 100644 --- a/engines/lab/special.cpp +++ b/engines/lab/special.cpp @@ -152,7 +152,7 @@ void LabEngine::loadJournalData() { char filename[20]; bool bridge, dirty, news, clean; - journalFont = g_lab->_resource->getFont("P:Journal.fon"); // FIXME: memory leak + journalFont = g_lab->_resource->getFont("P:Journal.fon"); g_lab->_music->updateMusic(); @@ -368,7 +368,9 @@ void LabEngine::doJournal() { _event->attachGadgetList(NULL); _graphics->fade(false, 0); _event->mouseHide(); + freeButtonList(&_journalGadgetList); + g_lab->_graphics->closeFont(journalFont); ScreenImage._imageData = _graphics->getCurrentDrawingBuffer(); -- cgit v1.2.3 From 53de3143f636486b89380e3b2ce245e2606b98e0 Mon Sep 17 00:00:00 2001 From: Filippos Karapetis Date: Tue, 8 Dec 2015 18:23:27 +0200 Subject: LAB: Cleanup doGoForward() --- engines/lab/processroom.cpp | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/engines/lab/processroom.cpp b/engines/lab/processroom.cpp index 26e91e5688..ed28e87453 100644 --- a/engines/lab/processroom.cpp +++ b/engines/lab/processroom.cpp @@ -690,10 +690,11 @@ bool doOperateRule(int16 x, int16 y, int16 ItemNum, CloseDataPtr *lcptr) { bool doGoForward(CloseDataPtr *lcptr) { RuleList *rules = g_lab->_rooms[g_lab->_roomNum]._rules; - for (RuleList::iterator rule = rules->begin(); rule != rules->end(); ++rule) { - if (((*rule)->_ruleType == GOFORWARD) && ((*rule)->_param1 == (g_lab->_direction + 1))) { - if (checkConditions((*rule)->_condition)) { - g_lab->doActions((*rule)->_actionList, lcptr); + for (RuleList::iterator ruleIter = rules->begin(); ruleIter != rules->end(); ++ruleIter) { + Rule *rule = *ruleIter; + if ((rule->_ruleType == GOFORWARD) && (rule->_param1 == (g_lab->_direction + 1))) { + if (checkConditions(rule->_condition)) { + g_lab->doActions(rule->_actionList, lcptr); return true; } } -- cgit v1.2.3 From 151e27f4b1d5a98a3867c46d770b9b2a41f8905c Mon Sep 17 00:00:00 2001 From: Filippos Karapetis Date: Tue, 8 Dec 2015 18:24:44 +0200 Subject: LAB: Fix regression in setCurClose(). Fixes closeups A regression from 78e8896ce7583fbd1feee8e3e9c1aca0f11c2392 --- engines/lab/processroom.h | 2 +- engines/lab/special.cpp | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/engines/lab/processroom.h b/engines/lab/processroom.h index e4cb84e644..fae4c2f0a9 100644 --- a/engines/lab/processroom.h +++ b/engines/lab/processroom.h @@ -193,7 +193,7 @@ bool parse(const char *inputFile); ViewData *getViewData(uint16 roomNum, uint16 direction); void drawDirection(CloseDataPtr lcptr); uint16 processArrow(uint16 curDirection, uint16 arrow); -void setCurClose(Common::Point pos, CloseDataPtr *cptr, bool useAbsoluteCoords = false); +void setCurClose(Common::Point pos, CloseDataPtr *cptr, bool useAbsoluteCoords = true); bool takeItem(uint16 x, uint16 y, CloseDataPtr *cptr); bool doActionRule(Common::Point pos, int16 action, int16 roomNum, CloseDataPtr *lcptr); bool doOperateRule(int16 x, int16 y, int16 itemNum, CloseDataPtr *lcptr); diff --git a/engines/lab/special.cpp b/engines/lab/special.cpp index cce06e69dc..5a0348c2ca 100644 --- a/engines/lab/special.cpp +++ b/engines/lab/special.cpp @@ -564,7 +564,7 @@ void LabEngine::processMonitor(char *ntext, TextFont *monitorFont, bool isintera testcptr = _cptr; MouseY = 64 + (MouseY / MonGadHeight) * 42; MouseX = 101; - setCurClose(Common::Point(MouseX, MouseY), &_cptr, true); + setCurClose(Common::Point(MouseX, MouseY), &_cptr, false); if (testcptr != _cptr) { lastcptr[depth] = testcptr; -- cgit v1.2.3 From d2a540ea557f1b0a2f8e1abc00ec82a068855796 Mon Sep 17 00:00:00 2001 From: Eugene Sandulenko Date: Tue, 8 Dec 2015 20:10:26 +0100 Subject: LAB: Rename graphics.* to dispman.* --- engines/lab/dispman.cpp | 768 +++++++++++++++++++++++++++++++++++++++++++ engines/lab/dispman.h | 169 ++++++++++ engines/lab/graphics.cpp | 769 -------------------------------------------- engines/lab/graphics.h | 169 ---------- engines/lab/lab.cpp | 1 - engines/lab/lab.h | 1 - engines/lab/module.mk | 2 +- engines/lab/resource.h | 2 +- engines/lab/transitions.cpp | 1 - 9 files changed, 939 insertions(+), 943 deletions(-) create mode 100644 engines/lab/dispman.cpp create mode 100644 engines/lab/dispman.h delete mode 100644 engines/lab/graphics.cpp delete mode 100644 engines/lab/graphics.h diff --git a/engines/lab/dispman.cpp b/engines/lab/dispman.cpp new file mode 100644 index 0000000000..a7c71f2214 --- /dev/null +++ b/engines/lab/dispman.cpp @@ -0,0 +1,768 @@ +/* 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. + * + */ + +/* + * This code is based on Labyrinth of Time code with assistance of + * + * Copyright (c) 1993 Terra Nova Development + * Copyright (c) 2004 The Wyrmkeep Entertainment Co. + * + */ + +#include "lab/lab.h" +#include "lab/anim.h" +#include "lab/image.h" +#include "lab/labfun.h" +#include "lab/processroom.h" +#include "lab/resource.h" + +namespace Lab { + +DisplayMan::DisplayMan(LabEngine *vm) : _vm(vm) { + _longWinInFront = false; + _lastMessageLong = false; + _doNotDrawMessage = false; + + _screenBytesPerPage = 65536; + _curapen = 0; + _curBitmap = nullptr; + _displayBuffer = nullptr; + _currentDisplayBuffer = nullptr; + _tempScrollData = nullptr; + FadePalette = nullptr; + + _screenWidth = 0; + _screenHeight = 0; + + for (int i = 0; i < 256 * 3; i++) + _curvgapal[i] = 0; +} + +DisplayMan::~DisplayMan() { + freePict(); +} + +// From readPict.c. Reads in pictures and animations from disk. + +void DisplayMan::loadPict(const char *filename) { + Common::File *bitmapFile = _vm->_resource->openDataFile(filename); + freePict(); + _curBitmap = new byte[bitmapFile->size()]; + bitmapFile->read(_curBitmap, bitmapFile->size()); + delete bitmapFile; +} + +/** + * Reads in a picture into the dest bitmap. + */ +void DisplayMan::readPict(const char *filename, bool playOnce, bool onlyDiffData) { + _vm->_anim->stopDiff(); + + loadPict(filename); + + _vm->_music->updateMusic(); + + if (!_vm->_music->_doNotFilestopSoundEffect) + _vm->_music->stopSoundEffect(); + + _dispBitMap._bytesPerRow = _screenWidth; + _dispBitMap._rows = _screenHeight; + _dispBitMap._flags = BITMAPF_VIDEO; + + _vm->_anim->readDiff(_curBitmap, playOnce, onlyDiffData); +} + +/** + * Reads in a picture into buffer memory. + */ +byte *DisplayMan::readPictToMem(const char *filename, uint16 x, uint16 y) { + _vm->_anim->stopDiff(); + + loadPict(filename); + + _vm->_music->updateMusic(); + + if (!_vm->_music->_doNotFilestopSoundEffect) + _vm->_music->stopSoundEffect(); + + _dispBitMap._bytesPerRow = x; + _dispBitMap._rows = y; + _dispBitMap._flags = BITMAPF_NONE; + _dispBitMap._planes[0] = _curBitmap; + _dispBitMap._planes[1] = _dispBitMap._planes[0] + 0x10000; + _dispBitMap._planes[2] = _dispBitMap._planes[1] + 0x10000; + _dispBitMap._planes[3] = _dispBitMap._planes[2] + 0x10000; + _dispBitMap._planes[4] = _dispBitMap._planes[3] + 0x10000; + + _vm->_anim->readDiff(_curBitmap, true); + + return _curBitmap; +} + +void DisplayMan::freePict() { + delete _curBitmap; + _curBitmap = NULL; +} + +//--------------------------------------------------------------------------- +//------------ Does all the text rendering to the message boxes. ------------ +//--------------------------------------------------------------------------- + +/** + * Extracts the first word from a string. + */ +static void getWord(char *wordBuffer, const char *mainBuffer, uint16 *wordWidth) { + uint16 width = 0; + + while ((mainBuffer[width] != ' ') && mainBuffer[width] && (mainBuffer[width] != '\n')) { + wordBuffer[width] = mainBuffer[width]; + width++; + } + + wordBuffer[width] = 0; + + *wordWidth = width; +} + +/** + * Gets a line of text for flowText; makes sure that its length is less than + * or equal to the maximum width. + */ +void DisplayMan::getLine(TextFont *tf, char *lineBuffer, const char **mainBuffer, uint16 lineWidth) { + uint16 curWidth = 0, wordWidth; + char wordBuffer[100]; + bool doit = true; + + lineWidth += textLength(tf, " ", 1); + + lineBuffer[0] = 0; + + while ((*mainBuffer)[0] && doit) { + getWord(wordBuffer, *mainBuffer, &wordWidth); + strcat(wordBuffer, " "); + + if ((curWidth + textLength(tf, wordBuffer, wordWidth + 1)) <= lineWidth) { + strcat(lineBuffer, wordBuffer); + (*mainBuffer) += wordWidth; + + if ((*mainBuffer)[0] == '\n') + doit = false; + + if ((*mainBuffer)[0]) + (*mainBuffer)++; + + curWidth = textLength(tf, lineBuffer, strlen(lineBuffer)); + } else + doit = false; + } +} + +/** + * Dumps a chunk of text to an arbitrary box; flows it within that box and + * optionally centers it. Returns the number of characters that were + * processed. + * Note: Every individual word MUST be int16 enough to fit on a line, and + * each line less than 255 characters. + */ +uint32 DisplayMan::flowText( + void *font, // the TextAttr pointer + int16 spacing, // How much vertical spacing between the lines + byte pencolor, // pen number to use for text + byte backpen, // the background color + bool fillback, // Whether to fill the background + bool centerh, // Whether to center the text horizontally + bool centerv, // Whether to center the text vertically + bool output, // Whether to output any text + uint16 x1, uint16 y1, // Cords + uint16 x2, uint16 y2, + const char *str) { // The text itself + TextFont *_msgFont = (TextFont *)font; + char linebuffer[256]; + const char *temp; + uint16 numlines, actlines, fontheight, width; + uint16 x, y; + + if (fillback) { + setAPen(backpen); + rectFill(x1, y1, x2, y2); + } + + if (str == NULL) + return 0L; + + setAPen(pencolor); + + fontheight = textHeight(_msgFont) + spacing; + numlines = (y2 - y1 + 1) / fontheight; + width = x2 - x1 + 1; + y = y1; + + if (centerv && output) { + temp = str; + actlines = 0; + + while (temp[0]) { + getLine(_msgFont, linebuffer, &temp, width); + actlines++; + } + + if (actlines <= numlines) + y += ((y2 - y1 + 1) - (actlines * fontheight)) / 2; + } + + temp = str; + + while (numlines && str[0]) { + getLine(_msgFont, linebuffer, &str, width); + + x = x1; + + if (centerh) + x += (width - textLength(_msgFont, linebuffer, strlen(linebuffer))) / 2; + + if (output) + text(_msgFont, x, y, pencolor, linebuffer, strlen(linebuffer)); + + numlines--; + y += fontheight; + } + + return (str - temp); +} + +uint32 DisplayMan::flowTextScaled( + void *font, // the TextAttr pointer + int16 spacing, // How much vertical spacing between the lines + byte penColor, // pen number to use for text + byte backPen, // the background color + bool fillBack, // Whether to fill the background + bool centerX, // Whether to center the text horizontally + bool centerY, // Whether to center the text vertically + bool output, // Whether to output any text + uint16 x1, uint16 y1, // Cords + uint16 x2, uint16 y2, + const char *str) { + return flowText(font, spacing, penColor, backPen, fillBack, centerX, centerY, output, + _vm->_utils->vgaScaleX(x1), _vm->_utils->vgaScaleY(y1), + _vm->_utils->vgaScaleX(x2), _vm->_utils->vgaScaleY(y2), str); +} + +/** + * Calls flowText, but flows it to memory. Same restrictions as flowText. + */ +uint32 DisplayMan::flowTextToMem(Image *destIm, + void *font, // the TextAttr pointer + int16 spacing, // How much vertical spacing between the lines + byte pencolor, // pen number to use for text + byte backpen, // the background color + bool fillback, // Whether to fill the background + bool centerh, // Whether to center the text horizontally + bool centerv, // Whether to center the text vertically + bool output, // Whether to output any text + uint16 x1, uint16 y1, // Cords + uint16 x2, uint16 y2, + const char *str) { // The text itself + uint32 res, vgabyte = _screenBytesPerPage; + byte *tmp = _currentDisplayBuffer; + + _currentDisplayBuffer = destIm->_imageData; + _screenBytesPerPage = (uint32)destIm->_width * (int32)destIm->_height; + + res = flowText(font, spacing, pencolor, backpen, fillback, centerh, centerv, output, x1, y1, x2, y2, str); + + _screenBytesPerPage = vgabyte; + _currentDisplayBuffer = tmp; + + return res; +} + +//----- The control panel stuff ----- + +void DisplayMan::createBox(uint16 y2) { + // Message box area + setAPen(7); + rectFillScaled(4, 154, 315, y2 - 2); + + // Box around message area + setAPen(0); + drawHLine(_vm->_utils->vgaScaleX(2), _vm->_utils->vgaScaleY(152), _vm->_utils->vgaScaleX(317)); + drawVLine(_vm->_utils->vgaScaleX(317), _vm->_utils->vgaScaleY(152), _vm->_utils->vgaScaleY(y2)); + drawHLine(_vm->_utils->vgaScaleX(2), _vm->_utils->vgaScaleY(y2), _vm->_utils->vgaScaleX(317)); + drawVLine(_vm->_utils->vgaScaleX(2), _vm->_utils->vgaScaleY(152), _vm->_utils->vgaScaleY(y2)); +} + +int32 DisplayMan::longDrawMessage(const char *str) { + char newText[512]; + + if (str == NULL) + return 0; + + _vm->_event->attachGadgetList(NULL); + _vm->_event->mouseHide(); + strcpy(newText, str); + + if (!_longWinInFront) { + _longWinInFront = true; + // Clear Area + setAPen(3); + rectFill(0, _vm->_utils->vgaScaleY(149) + _vm->_utils->svgaCord(2), _vm->_utils->vgaScaleX(319), _vm->_utils->vgaScaleY(199)); + } + + createBox(198); + _vm->_event->mouseShow(); + + return flowTextScaled(_vm->_msgFont, 0, 1, 7, false, true, true, true, 6, 155, 313, 195, str); +} + +/** + * Draws a message to the message box. + */ +void DisplayMan::drawMessage(const char *str) { + if (_doNotDrawMessage) { + _doNotDrawMessage = false; + return; + } + + if (str) { + if ((textLength(_vm->_msgFont, str, strlen(str)) > _vm->_utils->vgaScaleX(306))) { + longDrawMessage(str); + _lastMessageLong = true; + } else { + if (_longWinInFront) { + _longWinInFront = false; + drawPanel(); + } + + _vm->_event->mouseHide(); + createBox(168); + text(_vm->_msgFont, _vm->_utils->vgaScaleX(7), _vm->_utils->vgaScaleY(155) + _vm->_utils->svgaCord(2), 1, str, strlen(str)); + _vm->_event->mouseShow(); + _lastMessageLong = false; + } + } +} + +/** + * Draws the control panel display. + */ +void DisplayMan::drawPanel() { + _vm->_event->mouseHide(); + + // Clear Area + setAPen(3); + rectFill(0, _vm->_utils->vgaScaleY(149) + _vm->_utils->svgaCord(2), _vm->_utils->vgaScaleX(319), _vm->_utils->vgaScaleY(199)); + + // First Line + setAPen(0); + drawHLine(0, _vm->_utils->vgaScaleY(149) + _vm->_utils->svgaCord(2), _vm->_utils->vgaScaleX(319)); + // Second Line + setAPen(5); + drawHLine(0, _vm->_utils->vgaScaleY(149) + 1 + _vm->_utils->svgaCord(2), _vm->_utils->vgaScaleX(319)); + // Gadget Separators + setAPen(0); + // First black line to separate buttons + drawHLine(0, _vm->_utils->vgaScaleY(170), _vm->_utils->vgaScaleX(319)); + + if (!_vm->_alternate) { + setAPen(4); + // The horizontal lines under the black one + drawHLine(0, _vm->_utils->vgaScaleY(170) + 1, _vm->_utils->vgaScaleX(319)); + drawGadgetList(&_vm->_moveGadgetList); + } else { + if (_vm->getPlatform() != Common::kPlatformWindows) { + // Vertical Black lines + drawVLine(_vm->_utils->vgaScaleX(124), _vm->_utils->vgaScaleY(170) + 1, _vm->_utils->vgaScaleY(199)); + drawVLine(_vm->_utils->vgaScaleX(194), _vm->_utils->vgaScaleY(170) + 1, _vm->_utils->vgaScaleY(199)); + } else { + // Vertical Black lines + drawVLine(_vm->_utils->vgaScaleX(90), _vm->_utils->vgaScaleY(170) + 1, _vm->_utils->vgaScaleY(199)); + drawVLine(_vm->_utils->vgaScaleX(160), _vm->_utils->vgaScaleY(170) + 1, _vm->_utils->vgaScaleY(199)); + drawVLine(_vm->_utils->vgaScaleX(230), _vm->_utils->vgaScaleY(170) + 1, _vm->_utils->vgaScaleY(199)); + } + + setAPen(4); + // The horizontal lines under the black one + drawHLine(0, _vm->_utils->vgaScaleY(170) + 1, _vm->_utils->vgaScaleX(122)); + drawHLine(_vm->_utils->vgaScaleX(126), _vm->_utils->vgaScaleY(170) + 1, _vm->_utils->vgaScaleX(192)); + drawHLine(_vm->_utils->vgaScaleX(196), _vm->_utils->vgaScaleY(170) + 1, _vm->_utils->vgaScaleX(319)); + // The vertical high light lines + drawVLine(_vm->_utils->vgaScaleX(1), _vm->_utils->vgaScaleY(170) + 2, _vm->_utils->vgaScaleY(198)); + + if (_vm->getPlatform() != Common::kPlatformWindows) { + drawVLine(_vm->_utils->vgaScaleX(126), _vm->_utils->vgaScaleY(170) + 2, _vm->_utils->vgaScaleY(198)); + drawVLine(_vm->_utils->vgaScaleX(196), _vm->_utils->vgaScaleY(170) + 2, _vm->_utils->vgaScaleY(198)); + } else { + drawVLine(_vm->_utils->vgaScaleX(92), _vm->_utils->vgaScaleY(170) + 2, _vm->_utils->vgaScaleY(198)); + drawVLine(_vm->_utils->vgaScaleX(162), _vm->_utils->vgaScaleY(170) + 2, _vm->_utils->vgaScaleY(198)); + drawVLine(_vm->_utils->vgaScaleX(232), _vm->_utils->vgaScaleY(170) + 2, _vm->_utils->vgaScaleY(198)); + } + + drawGadgetList(&_vm->_invGadgetList); + } + + _vm->_event->mouseShow(); +} + +/** + * Sets up the Labyrinth screens, and opens up the initial windows. + */ +void DisplayMan::setUpScreens() { + createScreen(_vm->_isHiRes); + + Common::File *controlFile = _vm->_resource->openDataFile("P:Control"); + for (uint16 i = 0; i < 20; i++) + _vm->_moveImages[i] = new Image(controlFile); + delete controlFile; + + // Creates the gadgets for the movement control panel + uint16 y = _vm->_utils->vgaScaleY(173) - _vm->_utils->svgaCord(2); + + // The key mapping was only set for the Windows version. + // It's very convenient to have those shortcut, so I added them + // for all versions. (Strangerke) + _vm->_moveGadgetList.push_back(createButton( 1, y, 0, 't', _vm->_moveImages[0], _vm->_moveImages[1])); + _vm->_moveGadgetList.push_back(createButton( 33, y, 1, 'm', _vm->_moveImages[2], _vm->_moveImages[3])); + _vm->_moveGadgetList.push_back(createButton( 65, y, 2, 'o', _vm->_moveImages[4], _vm->_moveImages[5])); + _vm->_moveGadgetList.push_back(createButton( 97, y, 3, 'c', _vm->_moveImages[6], _vm->_moveImages[7])); + _vm->_moveGadgetList.push_back(createButton(129, y, 4, 'l', _vm->_moveImages[8], _vm->_moveImages[9])); + _vm->_moveGadgetList.push_back(createButton(161, y, 5, 'i', _vm->_moveImages[12], _vm->_moveImages[13])); + _vm->_moveGadgetList.push_back(createButton(193, y, 6, VKEY_LTARROW, _vm->_moveImages[14], _vm->_moveImages[15])); + _vm->_moveGadgetList.push_back(createButton(225, y, 7, VKEY_UPARROW, _vm->_moveImages[16], _vm->_moveImages[17])); + _vm->_moveGadgetList.push_back(createButton(257, y, 8, VKEY_RTARROW, _vm->_moveImages[18], _vm->_moveImages[19])); + _vm->_moveGadgetList.push_back(createButton(289, y, 9, 'p', _vm->_moveImages[10], _vm->_moveImages[11])); + + Common::File *invFile = _vm->_resource->openDataFile("P:Inv"); + if (_vm->getPlatform() == Common::kPlatformWindows) { + for (uint16 imgIdx = 0; imgIdx < 10; imgIdx++) + _vm->_invImages[imgIdx] = new Image(invFile); + } else { + for (uint16 imgIdx = 0; imgIdx < 6; imgIdx++) + _vm->_invImages[imgIdx] = new Image(invFile); + } + _vm->_invGadgetList.push_back(createButton( 24, y, 0, 'm', _vm->_invImages[0], _vm->_invImages[1])); + _vm->_invGadgetList.push_back(createButton( 56, y, 1, 'g', _vm->_invImages[2], _vm->_invImages[3])); + _vm->_invGadgetList.push_back(createButton( 94, y, 2, 'u', _vm->_invImages[4], _vm->_invImages[5])); + _vm->_invGadgetList.push_back(createButton(126, y, 3, 'l', _vm->_moveImages[8], _vm->_moveImages[9])); + _vm->_invGadgetList.push_back(createButton(164, y, 4, VKEY_LTARROW, _vm->_moveImages[14], _vm->_moveImages[15])); + _vm->_invGadgetList.push_back(createButton(196, y, 5, VKEY_RTARROW, _vm->_moveImages[18], _vm->_moveImages[19])); + + // The windows version has 2 extra gadgets for breadcrumb trail + // TODO: the game is really hard to play without those, maybe we could add something to enable that. + if (_vm->getPlatform() == Common::kPlatformWindows) { + _vm->_invGadgetList.push_back(createButton(234, y, 6, 'b', _vm->_invImages[6], _vm->_invImages[7])); + _vm->_invGadgetList.push_back(createButton(266, y, 7, 'f', _vm->_invImages[8], _vm->_invImages[9])); + } + + delete invFile; +} + +/** + * Sets the pen number to use on all the drawing operations. + */ +void DisplayMan::setAPen(byte pennum) { + _curapen = pennum; +} + +/** + * Fills in a rectangle. + */ +void DisplayMan::rectFill(uint16 x1, uint16 y1, uint16 x2, uint16 y2) { + int w = x2 - x1 + 1; + int h = y2 - y1 + 1; + + if (x1 + w > _screenWidth) + w = _screenWidth - x1; + + if (y1 + h > _screenHeight) + h = _screenHeight - y1; + + if ((w > 0) && (h > 0)) { + char *d = (char *)getCurrentDrawingBuffer() + y1 * _screenWidth + x1; + + while (h-- > 0) { + char *dd = d; + int ww = w; + + while (ww-- > 0) { + *dd++ = _curapen; + } + + d += _screenWidth; + } + } +} + +void DisplayMan::rectFillScaled(uint16 x1, uint16 y1, uint16 x2, uint16 y2) { + rectFill(_vm->_utils->vgaScaleX(x1), _vm->_utils->vgaScaleY(y1), _vm->_utils->vgaScaleX(x2), _vm->_utils->vgaScaleY(y2)); +} + +/** + * Draws a horizontal line. + */ +void DisplayMan::drawVLine(uint16 x, uint16 y1, uint16 y2) { + rectFill(x, y1, x, y2); +} + +/** + * Draws a vertical line. + */ +void DisplayMan::drawHLine(uint16 x1, uint16 y, uint16 x2) { + rectFill(x1, y, x2, y); +} + +void DisplayMan::screenUpdate() { + g_system->copyRectToScreen(_displayBuffer, _screenWidth, 0, 0, _screenWidth, _screenHeight); + g_system->updateScreen(); + + _vm->_event->processInput(); +} + +/** + * Sets up either a low-res or a high-res 256 color screen. + */ +void DisplayMan::createScreen(bool hiRes) { + if (hiRes) { + _screenWidth = 640; + _screenHeight = 480; + } else { + _screenWidth = 320; + _screenHeight = 200; + } + _screenBytesPerPage = _screenWidth * _screenHeight; + _displayBuffer = new byte[_screenBytesPerPage]; // FIXME: Memory leak! +} + +/** + * Converts an Amiga palette (up to 16 colors) to a VGA palette, then sets + * the VGA palette. + */ +void DisplayMan::setAmigaPal(uint16 *pal, uint16 numColors) { + byte vgaPal[16 * 3]; + uint16 vgaIdx = 0; + + if (numColors > 16) + numColors = 16; + + for (uint16 i = 0; i < numColors; i++) { + vgaPal[vgaIdx++] = (byte)(((pal[i] & 0xf00) >> 8) << 2); + vgaPal[vgaIdx++] = (byte)(((pal[i] & 0x0f0) >> 4) << 2); + vgaPal[vgaIdx++] = (byte)(((pal[i] & 0x00f)) << 2); + } + + writeColorRegs(vgaPal, 0, 16); + _vm->waitTOF(); +} + +/** + * Writes any number of the 256 color registers. + * first: the number of the first color register to write. + * numreg: the number of registers to write + * buf: a char pointer which contains the selected color registers. + * Each value representing a color register occupies 3 bytes in + * the array. The order is red, green then blue. The first byte + * in the array is the red component of the first element selected. + * The length of the buffer is 3 times the number of registers + * selected. + */ +void DisplayMan::writeColorRegs(byte *buf, uint16 first, uint16 numreg) { + byte tmp[256 * 3]; + + for (int i = 0; i < 256 * 3; i++) { + tmp[i] = buf[i] * 4; + } + + g_system->getPaletteManager()->setPalette(tmp, first, numreg); + + memcpy(&(_curvgapal[first * 3]), buf, numreg * 3); +} + +void DisplayMan::setPalette(void *cmap, uint16 numcolors) { + if (memcmp(cmap, _curvgapal, numcolors * 3) != 0) + writeColorRegs((byte *)cmap, 0, numcolors); +} + +/** + * Returns the base address of the current VGA display. + */ +byte *DisplayMan::getCurrentDrawingBuffer() { + if (_currentDisplayBuffer) + return _currentDisplayBuffer; + + return _displayBuffer; +} + +/** + * Overlays a region on the screen using the desired pen color. + */ +void DisplayMan::overlayRect(uint16 pencolor, uint16 x1, uint16 y1, uint16 x2, uint16 y2) { + int w = x2 - x1 + 1; + int h = y2 - y1 + 1; + + if (x1 + w > _screenWidth) + w = _screenWidth - x1; + + if (y1 + h > _screenHeight) + h = _screenHeight - y1; + + if ((w > 0) && (h > 0)) { + char *d = (char *)getCurrentDrawingBuffer() + y1 * _screenWidth + x1; + + while (h-- > 0) { + char *dd = d; + int ww = w; + + if (y1 & 1) { + dd++; + ww--; + } + + while (ww > 0) { + *dd = pencolor; + dd += 2; + ww -= 2; + } + + d += _screenWidth; + y1++; + } + } +} + +/** + * Closes a font and frees all memory associated with it. + */ +void DisplayMan::closeFont(TextFont *tf) { + if (tf) { + if (tf->_data && tf->_dataLength) + delete[] tf->_data; + + delete tf; + } +} + +/** + * Returns the length of a text in the specified font. + */ +uint16 DisplayMan::textLength(TextFont *tf, const char *text, uint16 numchars) { + uint16 length = 0; + + if (tf) { + for (uint16 i = 0; i < numchars; i++) { + length += tf->_widths[(uint)*text]; + text++; + } + } + + return length; +} + +/** + * Returns the height of a specified font. + */ +uint16 DisplayMan::textHeight(TextFont *tf) { + return (tf) ? tf->_height : 0; +} + +/** + * Draws the text to the screen. + */ +void DisplayMan::text(TextFont *tf, uint16 x, uint16 y, uint16 color, const char *text, uint16 numchars) { + byte *VGATop, *VGACur, *VGATemp, *VGATempLine, *cdata; + uint32 RealOffset, SegmentOffset; + int32 templeft, LeftInSegment; + uint16 bwidth, mask, curpage, data; + + VGATop = getCurrentDrawingBuffer(); + + for (uint16 i = 0; i < numchars; i++) { + RealOffset = (_screenWidth * y) + x; + curpage = RealOffset / _screenBytesPerPage; + SegmentOffset = RealOffset - (curpage * _screenBytesPerPage); + LeftInSegment = _screenBytesPerPage - SegmentOffset; + VGACur = VGATop + SegmentOffset; + + if (tf->_widths[(uint)*text]) { + cdata = tf->_data + tf->_offsets[(uint)*text]; + bwidth = *cdata++; + VGATemp = VGACur; + VGATempLine = VGACur; + + for (uint16 rows = 0; rows < tf->_height; rows++) { + VGATemp = VGATempLine; + templeft = LeftInSegment; + + for (uint16 cols = 0; cols < bwidth; cols++) { + data = *cdata++; + + if (data && (templeft >= 8)) { + for (int j = 7; j >= 0; j--) { + if ((1 << j) & data) + *VGATemp = color; + VGATemp++; + } + + templeft -= 8; + } else if (data) { + mask = 0x80; + templeft = LeftInSegment; + + for (uint16 counterb = 0; counterb < 8; counterb++) { + if (templeft <= 0) { + curpage++; + VGATemp = (byte *)(VGATop - templeft); + // Set up VGATempLine for next line + VGATempLine -= _screenBytesPerPage; + // Set up LeftInSegment for next line + LeftInSegment += _screenBytesPerPage + templeft; + templeft += _screenBytesPerPage; + } + + if (mask & data) + *VGATemp = color; + + VGATemp++; + + mask = mask >> 1; + templeft--; + } + } else { + templeft -= 8; + VGATemp += 8; + } + } + + VGATempLine += _screenWidth; + LeftInSegment -= _screenWidth; + + if (LeftInSegment <= 0) { + curpage++; + VGATempLine -= _screenBytesPerPage; + LeftInSegment += _screenBytesPerPage; + } + } + } + + x += tf->_widths[(int)*text]; + text++; + } +} +} // End of namespace Lab diff --git a/engines/lab/dispman.h b/engines/lab/dispman.h new file mode 100644 index 0000000000..bbbbe35126 --- /dev/null +++ b/engines/lab/dispman.h @@ -0,0 +1,169 @@ +/* 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. + * + */ + +/* + * This code is based on Labyrinth of Time code with assistance of + * + * Copyright (c) 1993 Terra Nova Development + * Copyright (c) 2004 The Wyrmkeep Entertainment Co. + * + */ + +#ifndef LAB_DISPMAN_H +#define LAB_DISPMAN_H + +#include "graphics/palette.h" +#include "lab/anim.h" +#include "lab/processroom.h" + +namespace Lab { + +class LabEngine; + +struct TextFont { + uint32 _dataLength; + uint16 _height; + byte _widths[256]; + uint16 _offsets[256]; + byte *_data; +}; + +enum TransitionType { + kTransitionNone, + kTransitionWipe, + kTransitionScrollWipe, + kTransitionScrollBlack, + kTransitionScrollBounce, + kTransitionTransporter, + kTransitionReadFirstFrame, + kTransitionReadNextFrame +}; + +class DisplayMan { +private: + LabEngine *_vm; + + uint16 fadeNumIn(uint16 num, uint16 res, uint16 counter); + uint16 fadeNumOut(uint16 num, uint16 res, uint16 counter); + + byte _curapen; + byte *_curBitmap; + byte _curvgapal[256 * 3]; + byte *_tempScrollData; + +public: + DisplayMan(LabEngine *lab); + virtual ~DisplayMan(); + + void loadPict(const char *filename); + void readPict(const char *filename, bool playOnce, bool onlyDiffData = false); + void freePict(); + byte *readPictToMem(const char *filename, uint16 x, uint16 y); + void doScrollBlack(); + void copyPage(uint16 width, uint16 height, uint16 nheight, uint16 startline, byte *mem); + void doScrollWipe(char *filename); + void doScrollBounce(); + void doTransWipe(CloseDataPtr *cPtr, char *filename); + void doTransition(TransitionType transitionType, CloseDataPtr *cPtr, char *filename); + void blackScreen(); + void whiteScreen(); + void blackAllScreen(); + void createBox(uint16 y2); + void drawPanel(); + void setUpScreens(); + int32 longDrawMessage(const char *str); + void drawMessage(const char *str); + void setAPen(byte pennum); + void rectFill(uint16 x1, uint16 y1, uint16 x2, uint16 y2); + void rectFillScaled(uint16 x1, uint16 y1, uint16 x2, uint16 y2); + // Window text stuff + uint32 flowText(void *font, // the TextAttr pointer + int16 spacing, // How much vertical spacing between the lines + byte pencolor, // pen number to use for text + byte backpen, // the background color + bool fillback, // Whether to fill the background + bool centerh, // Whether to center the text horizontally + bool centerv, // Whether to center the text vertically + bool output, // Whether to output any text + uint16 x1, uint16 y1, // Cords + uint16 x2, uint16 y2, + const char *text); // The text itself + + uint32 flowTextScaled( + void *font, // the TextAttr pointer + int16 spacing, // How much vertical spacing between the lines + byte pencolor, // pen number to use for text + byte backpen, // the background color + bool fillback, // Whether to fill the background + bool centerh, // Whether to center the text horizontally + bool centerv, // Whether to center the text vertically + bool output, // Whether to output any text + uint16 x1, uint16 y1, // Cords + uint16 x2, uint16 y2, + const char *text); // The text itself + + uint32 flowTextToMem(Image *destIm, + void *font, // the TextAttr pointer + int16 spacing, // How much vertical spacing between the lines + byte pencolor, // pen number to use for text + byte backpen, // the background color + bool fillback, // Whether to fill the background + bool centerh, // Whether to center the text horizontally + bool centerv, // Whether to center the text vertically + bool output, // Whether to output any text + uint16 x1, uint16 y1, // Cords + uint16 x2, uint16 y2, + const char *str); // The text itself + + void drawHLine(uint16 x, uint16 y1, uint16 y2); + void drawVLine(uint16 x1, uint16 y, uint16 x2); + void screenUpdate(); + void createScreen(bool HiRes); + void setAmigaPal(uint16 *pal, uint16 numColors); + void writeColorRegs(byte *buf, uint16 first, uint16 numreg); + void setPalette(void *cmap, uint16 numcolors); + void overlayRect(uint16 pencolor, uint16 x1, uint16 y1, uint16 x2, uint16 y2); + byte *getCurrentDrawingBuffer(); + void scrollDisplayX(int16 dx, uint16 x1, uint16 y1, uint16 x2, uint16 y2); + void scrollDisplayY(int16 dy, uint16 x1, uint16 y1, uint16 x2, uint16 y2); + void fade(bool fadein, uint16 res); + void closeFont(TextFont *tf); + uint16 textLength(TextFont *tf, const char *text, uint16 numchars); + uint16 textHeight(TextFont *tf); + void text(TextFont *tf, uint16 x, uint16 y, uint16 color, const char *text, uint16 numchars); + void getLine(TextFont *tf, char *lineBuffer, const char **mainBuffer, uint16 lineWidth); + + bool _longWinInFront; + bool _lastMessageLong; + uint32 _screenBytesPerPage; + int _screenWidth; + int _screenHeight; + byte *_displayBuffer; + byte *_currentDisplayBuffer; + bool _doNotDrawMessage; + uint16 *FadePalette; + BitMap _dispBitMap; +}; + +} // End of namespace Lab + +#endif // LAB_DISPMAN_H diff --git a/engines/lab/graphics.cpp b/engines/lab/graphics.cpp deleted file mode 100644 index efd24b294d..0000000000 --- a/engines/lab/graphics.cpp +++ /dev/null @@ -1,769 +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. - * - */ - -/* - * This code is based on Labyrinth of Time code with assistance of - * - * Copyright (c) 1993 Terra Nova Development - * Copyright (c) 2004 The Wyrmkeep Entertainment Co. - * - */ - -#include "lab/lab.h" -#include "lab/anim.h" -#include "lab/image.h" -#include "lab/labfun.h" -#include "lab/processroom.h" -#include "lab/resource.h" -#include "lab/graphics.h" - -namespace Lab { - -DisplayMan::DisplayMan(LabEngine *vm) : _vm(vm) { - _longWinInFront = false; - _lastMessageLong = false; - _doNotDrawMessage = false; - - _screenBytesPerPage = 65536; - _curapen = 0; - _curBitmap = nullptr; - _displayBuffer = nullptr; - _currentDisplayBuffer = nullptr; - _tempScrollData = nullptr; - FadePalette = nullptr; - - _screenWidth = 0; - _screenHeight = 0; - - for (int i = 0; i < 256 * 3; i++) - _curvgapal[i] = 0; -} - -DisplayMan::~DisplayMan() { - freePict(); -} - -// From readPict.c. Reads in pictures and animations from disk. - -void DisplayMan::loadPict(const char *filename) { - Common::File *bitmapFile = _vm->_resource->openDataFile(filename); - freePict(); - _curBitmap = new byte[bitmapFile->size()]; - bitmapFile->read(_curBitmap, bitmapFile->size()); - delete bitmapFile; -} - -/** - * Reads in a picture into the dest bitmap. - */ -void DisplayMan::readPict(const char *filename, bool playOnce, bool onlyDiffData) { - _vm->_anim->stopDiff(); - - loadPict(filename); - - _vm->_music->updateMusic(); - - if (!_vm->_music->_doNotFilestopSoundEffect) - _vm->_music->stopSoundEffect(); - - _dispBitMap._bytesPerRow = _screenWidth; - _dispBitMap._rows = _screenHeight; - _dispBitMap._flags = BITMAPF_VIDEO; - - _vm->_anim->readDiff(_curBitmap, playOnce, onlyDiffData); -} - -/** - * Reads in a picture into buffer memory. - */ -byte *DisplayMan::readPictToMem(const char *filename, uint16 x, uint16 y) { - _vm->_anim->stopDiff(); - - loadPict(filename); - - _vm->_music->updateMusic(); - - if (!_vm->_music->_doNotFilestopSoundEffect) - _vm->_music->stopSoundEffect(); - - _dispBitMap._bytesPerRow = x; - _dispBitMap._rows = y; - _dispBitMap._flags = BITMAPF_NONE; - _dispBitMap._planes[0] = _curBitmap; - _dispBitMap._planes[1] = _dispBitMap._planes[0] + 0x10000; - _dispBitMap._planes[2] = _dispBitMap._planes[1] + 0x10000; - _dispBitMap._planes[3] = _dispBitMap._planes[2] + 0x10000; - _dispBitMap._planes[4] = _dispBitMap._planes[3] + 0x10000; - - _vm->_anim->readDiff(_curBitmap, true); - - return _curBitmap; -} - -void DisplayMan::freePict() { - delete _curBitmap; - _curBitmap = NULL; -} - -//--------------------------------------------------------------------------- -//------------ Does all the text rendering to the message boxes. ------------ -//--------------------------------------------------------------------------- - -/** - * Extracts the first word from a string. - */ -static void getWord(char *wordBuffer, const char *mainBuffer, uint16 *wordWidth) { - uint16 width = 0; - - while ((mainBuffer[width] != ' ') && mainBuffer[width] && (mainBuffer[width] != '\n')) { - wordBuffer[width] = mainBuffer[width]; - width++; - } - - wordBuffer[width] = 0; - - *wordWidth = width; -} - -/** - * Gets a line of text for flowText; makes sure that its length is less than - * or equal to the maximum width. - */ -void DisplayMan::getLine(TextFont *tf, char *lineBuffer, const char **mainBuffer, uint16 lineWidth) { - uint16 curWidth = 0, wordWidth; - char wordBuffer[100]; - bool doit = true; - - lineWidth += textLength(tf, " ", 1); - - lineBuffer[0] = 0; - - while ((*mainBuffer)[0] && doit) { - getWord(wordBuffer, *mainBuffer, &wordWidth); - strcat(wordBuffer, " "); - - if ((curWidth + textLength(tf, wordBuffer, wordWidth + 1)) <= lineWidth) { - strcat(lineBuffer, wordBuffer); - (*mainBuffer) += wordWidth; - - if ((*mainBuffer)[0] == '\n') - doit = false; - - if ((*mainBuffer)[0]) - (*mainBuffer)++; - - curWidth = textLength(tf, lineBuffer, strlen(lineBuffer)); - } else - doit = false; - } -} - -/** - * Dumps a chunk of text to an arbitrary box; flows it within that box and - * optionally centers it. Returns the number of characters that were - * processed. - * Note: Every individual word MUST be int16 enough to fit on a line, and - * each line less than 255 characters. - */ -uint32 DisplayMan::flowText( - void *font, // the TextAttr pointer - int16 spacing, // How much vertical spacing between the lines - byte pencolor, // pen number to use for text - byte backpen, // the background color - bool fillback, // Whether to fill the background - bool centerh, // Whether to center the text horizontally - bool centerv, // Whether to center the text vertically - bool output, // Whether to output any text - uint16 x1, uint16 y1, // Cords - uint16 x2, uint16 y2, - const char *str) { // The text itself - TextFont *_msgFont = (TextFont *)font; - char linebuffer[256]; - const char *temp; - uint16 numlines, actlines, fontheight, width; - uint16 x, y; - - if (fillback) { - setAPen(backpen); - rectFill(x1, y1, x2, y2); - } - - if (str == NULL) - return 0L; - - setAPen(pencolor); - - fontheight = textHeight(_msgFont) + spacing; - numlines = (y2 - y1 + 1) / fontheight; - width = x2 - x1 + 1; - y = y1; - - if (centerv && output) { - temp = str; - actlines = 0; - - while (temp[0]) { - getLine(_msgFont, linebuffer, &temp, width); - actlines++; - } - - if (actlines <= numlines) - y += ((y2 - y1 + 1) - (actlines * fontheight)) / 2; - } - - temp = str; - - while (numlines && str[0]) { - getLine(_msgFont, linebuffer, &str, width); - - x = x1; - - if (centerh) - x += (width - textLength(_msgFont, linebuffer, strlen(linebuffer))) / 2; - - if (output) - text(_msgFont, x, y, pencolor, linebuffer, strlen(linebuffer)); - - numlines--; - y += fontheight; - } - - return (str - temp); -} - -uint32 DisplayMan::flowTextScaled( - void *font, // the TextAttr pointer - int16 spacing, // How much vertical spacing between the lines - byte penColor, // pen number to use for text - byte backPen, // the background color - bool fillBack, // Whether to fill the background - bool centerX, // Whether to center the text horizontally - bool centerY, // Whether to center the text vertically - bool output, // Whether to output any text - uint16 x1, uint16 y1, // Cords - uint16 x2, uint16 y2, - const char *str) { - return flowText(font, spacing, penColor, backPen, fillBack, centerX, centerY, output, - _vm->_utils->vgaScaleX(x1), _vm->_utils->vgaScaleY(y1), - _vm->_utils->vgaScaleX(x2), _vm->_utils->vgaScaleY(y2), str); -} - -/** - * Calls flowText, but flows it to memory. Same restrictions as flowText. - */ -uint32 DisplayMan::flowTextToMem(Image *destIm, - void *font, // the TextAttr pointer - int16 spacing, // How much vertical spacing between the lines - byte pencolor, // pen number to use for text - byte backpen, // the background color - bool fillback, // Whether to fill the background - bool centerh, // Whether to center the text horizontally - bool centerv, // Whether to center the text vertically - bool output, // Whether to output any text - uint16 x1, uint16 y1, // Cords - uint16 x2, uint16 y2, - const char *str) { // The text itself - uint32 res, vgabyte = _screenBytesPerPage; - byte *tmp = _currentDisplayBuffer; - - _currentDisplayBuffer = destIm->_imageData; - _screenBytesPerPage = (uint32)destIm->_width * (int32)destIm->_height; - - res = flowText(font, spacing, pencolor, backpen, fillback, centerh, centerv, output, x1, y1, x2, y2, str); - - _screenBytesPerPage = vgabyte; - _currentDisplayBuffer = tmp; - - return res; -} - -//----- The control panel stuff ----- - -void DisplayMan::createBox(uint16 y2) { - // Message box area - setAPen(7); - rectFillScaled(4, 154, 315, y2 - 2); - - // Box around message area - setAPen(0); - drawHLine(_vm->_utils->vgaScaleX(2), _vm->_utils->vgaScaleY(152), _vm->_utils->vgaScaleX(317)); - drawVLine(_vm->_utils->vgaScaleX(317), _vm->_utils->vgaScaleY(152), _vm->_utils->vgaScaleY(y2)); - drawHLine(_vm->_utils->vgaScaleX(2), _vm->_utils->vgaScaleY(y2), _vm->_utils->vgaScaleX(317)); - drawVLine(_vm->_utils->vgaScaleX(2), _vm->_utils->vgaScaleY(152), _vm->_utils->vgaScaleY(y2)); -} - -int32 DisplayMan::longDrawMessage(const char *str) { - char newText[512]; - - if (str == NULL) - return 0; - - _vm->_event->attachGadgetList(NULL); - _vm->_event->mouseHide(); - strcpy(newText, str); - - if (!_longWinInFront) { - _longWinInFront = true; - // Clear Area - setAPen(3); - rectFill(0, _vm->_utils->vgaScaleY(149) + _vm->_utils->svgaCord(2), _vm->_utils->vgaScaleX(319), _vm->_utils->vgaScaleY(199)); - } - - createBox(198); - _vm->_event->mouseShow(); - - return flowTextScaled(_vm->_msgFont, 0, 1, 7, false, true, true, true, 6, 155, 313, 195, str); -} - -/** - * Draws a message to the message box. - */ -void DisplayMan::drawMessage(const char *str) { - if (_doNotDrawMessage) { - _doNotDrawMessage = false; - return; - } - - if (str) { - if ((textLength(_vm->_msgFont, str, strlen(str)) > _vm->_utils->vgaScaleX(306))) { - longDrawMessage(str); - _lastMessageLong = true; - } else { - if (_longWinInFront) { - _longWinInFront = false; - drawPanel(); - } - - _vm->_event->mouseHide(); - createBox(168); - text(_vm->_msgFont, _vm->_utils->vgaScaleX(7), _vm->_utils->vgaScaleY(155) + _vm->_utils->svgaCord(2), 1, str, strlen(str)); - _vm->_event->mouseShow(); - _lastMessageLong = false; - } - } -} - -/** - * Draws the control panel display. - */ -void DisplayMan::drawPanel() { - _vm->_event->mouseHide(); - - // Clear Area - setAPen(3); - rectFill(0, _vm->_utils->vgaScaleY(149) + _vm->_utils->svgaCord(2), _vm->_utils->vgaScaleX(319), _vm->_utils->vgaScaleY(199)); - - // First Line - setAPen(0); - drawHLine(0, _vm->_utils->vgaScaleY(149) + _vm->_utils->svgaCord(2), _vm->_utils->vgaScaleX(319)); - // Second Line - setAPen(5); - drawHLine(0, _vm->_utils->vgaScaleY(149) + 1 + _vm->_utils->svgaCord(2), _vm->_utils->vgaScaleX(319)); - // Gadget Separators - setAPen(0); - // First black line to separate buttons - drawHLine(0, _vm->_utils->vgaScaleY(170), _vm->_utils->vgaScaleX(319)); - - if (!_vm->_alternate) { - setAPen(4); - // The horizontal lines under the black one - drawHLine(0, _vm->_utils->vgaScaleY(170) + 1, _vm->_utils->vgaScaleX(319)); - drawGadgetList(&_vm->_moveGadgetList); - } else { - if (_vm->getPlatform() != Common::kPlatformWindows) { - // Vertical Black lines - drawVLine(_vm->_utils->vgaScaleX(124), _vm->_utils->vgaScaleY(170) + 1, _vm->_utils->vgaScaleY(199)); - drawVLine(_vm->_utils->vgaScaleX(194), _vm->_utils->vgaScaleY(170) + 1, _vm->_utils->vgaScaleY(199)); - } else { - // Vertical Black lines - drawVLine(_vm->_utils->vgaScaleX(90), _vm->_utils->vgaScaleY(170) + 1, _vm->_utils->vgaScaleY(199)); - drawVLine(_vm->_utils->vgaScaleX(160), _vm->_utils->vgaScaleY(170) + 1, _vm->_utils->vgaScaleY(199)); - drawVLine(_vm->_utils->vgaScaleX(230), _vm->_utils->vgaScaleY(170) + 1, _vm->_utils->vgaScaleY(199)); - } - - setAPen(4); - // The horizontal lines under the black one - drawHLine(0, _vm->_utils->vgaScaleY(170) + 1, _vm->_utils->vgaScaleX(122)); - drawHLine(_vm->_utils->vgaScaleX(126), _vm->_utils->vgaScaleY(170) + 1, _vm->_utils->vgaScaleX(192)); - drawHLine(_vm->_utils->vgaScaleX(196), _vm->_utils->vgaScaleY(170) + 1, _vm->_utils->vgaScaleX(319)); - // The vertical high light lines - drawVLine(_vm->_utils->vgaScaleX(1), _vm->_utils->vgaScaleY(170) + 2, _vm->_utils->vgaScaleY(198)); - - if (_vm->getPlatform() != Common::kPlatformWindows) { - drawVLine(_vm->_utils->vgaScaleX(126), _vm->_utils->vgaScaleY(170) + 2, _vm->_utils->vgaScaleY(198)); - drawVLine(_vm->_utils->vgaScaleX(196), _vm->_utils->vgaScaleY(170) + 2, _vm->_utils->vgaScaleY(198)); - } else { - drawVLine(_vm->_utils->vgaScaleX(92), _vm->_utils->vgaScaleY(170) + 2, _vm->_utils->vgaScaleY(198)); - drawVLine(_vm->_utils->vgaScaleX(162), _vm->_utils->vgaScaleY(170) + 2, _vm->_utils->vgaScaleY(198)); - drawVLine(_vm->_utils->vgaScaleX(232), _vm->_utils->vgaScaleY(170) + 2, _vm->_utils->vgaScaleY(198)); - } - - drawGadgetList(&_vm->_invGadgetList); - } - - _vm->_event->mouseShow(); -} - -/** - * Sets up the Labyrinth screens, and opens up the initial windows. - */ -void DisplayMan::setUpScreens() { - createScreen(_vm->_isHiRes); - - Common::File *controlFile = _vm->_resource->openDataFile("P:Control"); - for (uint16 i = 0; i < 20; i++) - _vm->_moveImages[i] = new Image(controlFile); - delete controlFile; - - // Creates the gadgets for the movement control panel - uint16 y = _vm->_utils->vgaScaleY(173) - _vm->_utils->svgaCord(2); - - // The key mapping was only set for the Windows version. - // It's very convenient to have those shortcut, so I added them - // for all versions. (Strangerke) - _vm->_moveGadgetList.push_back(createButton( 1, y, 0, 't', _vm->_moveImages[0], _vm->_moveImages[1])); - _vm->_moveGadgetList.push_back(createButton( 33, y, 1, 'm', _vm->_moveImages[2], _vm->_moveImages[3])); - _vm->_moveGadgetList.push_back(createButton( 65, y, 2, 'o', _vm->_moveImages[4], _vm->_moveImages[5])); - _vm->_moveGadgetList.push_back(createButton( 97, y, 3, 'c', _vm->_moveImages[6], _vm->_moveImages[7])); - _vm->_moveGadgetList.push_back(createButton(129, y, 4, 'l', _vm->_moveImages[8], _vm->_moveImages[9])); - _vm->_moveGadgetList.push_back(createButton(161, y, 5, 'i', _vm->_moveImages[12], _vm->_moveImages[13])); - _vm->_moveGadgetList.push_back(createButton(193, y, 6, VKEY_LTARROW, _vm->_moveImages[14], _vm->_moveImages[15])); - _vm->_moveGadgetList.push_back(createButton(225, y, 7, VKEY_UPARROW, _vm->_moveImages[16], _vm->_moveImages[17])); - _vm->_moveGadgetList.push_back(createButton(257, y, 8, VKEY_RTARROW, _vm->_moveImages[18], _vm->_moveImages[19])); - _vm->_moveGadgetList.push_back(createButton(289, y, 9, 'p', _vm->_moveImages[10], _vm->_moveImages[11])); - - Common::File *invFile = _vm->_resource->openDataFile("P:Inv"); - if (_vm->getPlatform() == Common::kPlatformWindows) { - for (uint16 imgIdx = 0; imgIdx < 10; imgIdx++) - _vm->_invImages[imgIdx] = new Image(invFile); - } else { - for (uint16 imgIdx = 0; imgIdx < 6; imgIdx++) - _vm->_invImages[imgIdx] = new Image(invFile); - } - _vm->_invGadgetList.push_back(createButton( 24, y, 0, 'm', _vm->_invImages[0], _vm->_invImages[1])); - _vm->_invGadgetList.push_back(createButton( 56, y, 1, 'g', _vm->_invImages[2], _vm->_invImages[3])); - _vm->_invGadgetList.push_back(createButton( 94, y, 2, 'u', _vm->_invImages[4], _vm->_invImages[5])); - _vm->_invGadgetList.push_back(createButton(126, y, 3, 'l', _vm->_moveImages[8], _vm->_moveImages[9])); - _vm->_invGadgetList.push_back(createButton(164, y, 4, VKEY_LTARROW, _vm->_moveImages[14], _vm->_moveImages[15])); - _vm->_invGadgetList.push_back(createButton(196, y, 5, VKEY_RTARROW, _vm->_moveImages[18], _vm->_moveImages[19])); - - // The windows version has 2 extra gadgets for breadcrumb trail - // TODO: the game is really hard to play without those, maybe we could add something to enable that. - if (_vm->getPlatform() == Common::kPlatformWindows) { - _vm->_invGadgetList.push_back(createButton(234, y, 6, 'b', _vm->_invImages[6], _vm->_invImages[7])); - _vm->_invGadgetList.push_back(createButton(266, y, 7, 'f', _vm->_invImages[8], _vm->_invImages[9])); - } - - delete invFile; -} - -/** - * Sets the pen number to use on all the drawing operations. - */ -void DisplayMan::setAPen(byte pennum) { - _curapen = pennum; -} - -/** - * Fills in a rectangle. - */ -void DisplayMan::rectFill(uint16 x1, uint16 y1, uint16 x2, uint16 y2) { - int w = x2 - x1 + 1; - int h = y2 - y1 + 1; - - if (x1 + w > _screenWidth) - w = _screenWidth - x1; - - if (y1 + h > _screenHeight) - h = _screenHeight - y1; - - if ((w > 0) && (h > 0)) { - char *d = (char *)getCurrentDrawingBuffer() + y1 * _screenWidth + x1; - - while (h-- > 0) { - char *dd = d; - int ww = w; - - while (ww-- > 0) { - *dd++ = _curapen; - } - - d += _screenWidth; - } - } -} - -void DisplayMan::rectFillScaled(uint16 x1, uint16 y1, uint16 x2, uint16 y2) { - rectFill(_vm->_utils->vgaScaleX(x1), _vm->_utils->vgaScaleY(y1), _vm->_utils->vgaScaleX(x2), _vm->_utils->vgaScaleY(y2)); -} - -/** - * Draws a horizontal line. - */ -void DisplayMan::drawVLine(uint16 x, uint16 y1, uint16 y2) { - rectFill(x, y1, x, y2); -} - -/** - * Draws a vertical line. - */ -void DisplayMan::drawHLine(uint16 x1, uint16 y, uint16 x2) { - rectFill(x1, y, x2, y); -} - -void DisplayMan::screenUpdate() { - g_system->copyRectToScreen(_displayBuffer, _screenWidth, 0, 0, _screenWidth, _screenHeight); - g_system->updateScreen(); - - _vm->_event->processInput(); -} - -/** - * Sets up either a low-res or a high-res 256 color screen. - */ -void DisplayMan::createScreen(bool hiRes) { - if (hiRes) { - _screenWidth = 640; - _screenHeight = 480; - } else { - _screenWidth = 320; - _screenHeight = 200; - } - _screenBytesPerPage = _screenWidth * _screenHeight; - _displayBuffer = new byte[_screenBytesPerPage]; // FIXME: Memory leak! -} - -/** - * Converts an Amiga palette (up to 16 colors) to a VGA palette, then sets - * the VGA palette. - */ -void DisplayMan::setAmigaPal(uint16 *pal, uint16 numColors) { - byte vgaPal[16 * 3]; - uint16 vgaIdx = 0; - - if (numColors > 16) - numColors = 16; - - for (uint16 i = 0; i < numColors; i++) { - vgaPal[vgaIdx++] = (byte)(((pal[i] & 0xf00) >> 8) << 2); - vgaPal[vgaIdx++] = (byte)(((pal[i] & 0x0f0) >> 4) << 2); - vgaPal[vgaIdx++] = (byte)(((pal[i] & 0x00f)) << 2); - } - - writeColorRegs(vgaPal, 0, 16); - _vm->waitTOF(); -} - -/** - * Writes any number of the 256 color registers. - * first: the number of the first color register to write. - * numreg: the number of registers to write - * buf: a char pointer which contains the selected color registers. - * Each value representing a color register occupies 3 bytes in - * the array. The order is red, green then blue. The first byte - * in the array is the red component of the first element selected. - * The length of the buffer is 3 times the number of registers - * selected. - */ -void DisplayMan::writeColorRegs(byte *buf, uint16 first, uint16 numreg) { - byte tmp[256 * 3]; - - for (int i = 0; i < 256 * 3; i++) { - tmp[i] = buf[i] * 4; - } - - g_system->getPaletteManager()->setPalette(tmp, first, numreg); - - memcpy(&(_curvgapal[first * 3]), buf, numreg * 3); -} - -void DisplayMan::setPalette(void *cmap, uint16 numcolors) { - if (memcmp(cmap, _curvgapal, numcolors * 3) != 0) - writeColorRegs((byte *)cmap, 0, numcolors); -} - -/** - * Returns the base address of the current VGA display. - */ -byte *DisplayMan::getCurrentDrawingBuffer() { - if (_currentDisplayBuffer) - return _currentDisplayBuffer; - - return _displayBuffer; -} - -/** - * Overlays a region on the screen using the desired pen color. - */ -void DisplayMan::overlayRect(uint16 pencolor, uint16 x1, uint16 y1, uint16 x2, uint16 y2) { - int w = x2 - x1 + 1; - int h = y2 - y1 + 1; - - if (x1 + w > _screenWidth) - w = _screenWidth - x1; - - if (y1 + h > _screenHeight) - h = _screenHeight - y1; - - if ((w > 0) && (h > 0)) { - char *d = (char *)getCurrentDrawingBuffer() + y1 * _screenWidth + x1; - - while (h-- > 0) { - char *dd = d; - int ww = w; - - if (y1 & 1) { - dd++; - ww--; - } - - while (ww > 0) { - *dd = pencolor; - dd += 2; - ww -= 2; - } - - d += _screenWidth; - y1++; - } - } -} - -/** - * Closes a font and frees all memory associated with it. - */ -void DisplayMan::closeFont(TextFont *tf) { - if (tf) { - if (tf->_data && tf->_dataLength) - delete[] tf->_data; - - delete tf; - } -} - -/** - * Returns the length of a text in the specified font. - */ -uint16 DisplayMan::textLength(TextFont *tf, const char *text, uint16 numchars) { - uint16 length = 0; - - if (tf) { - for (uint16 i = 0; i < numchars; i++) { - length += tf->_widths[(uint)*text]; - text++; - } - } - - return length; -} - -/** - * Returns the height of a specified font. - */ -uint16 DisplayMan::textHeight(TextFont *tf) { - return (tf) ? tf->_height : 0; -} - -/** - * Draws the text to the screen. - */ -void DisplayMan::text(TextFont *tf, uint16 x, uint16 y, uint16 color, const char *text, uint16 numchars) { - byte *VGATop, *VGACur, *VGATemp, *VGATempLine, *cdata; - uint32 RealOffset, SegmentOffset; - int32 templeft, LeftInSegment; - uint16 bwidth, mask, curpage, data; - - VGATop = getCurrentDrawingBuffer(); - - for (uint16 i = 0; i < numchars; i++) { - RealOffset = (_screenWidth * y) + x; - curpage = RealOffset / _screenBytesPerPage; - SegmentOffset = RealOffset - (curpage * _screenBytesPerPage); - LeftInSegment = _screenBytesPerPage - SegmentOffset; - VGACur = VGATop + SegmentOffset; - - if (tf->_widths[(uint)*text]) { - cdata = tf->_data + tf->_offsets[(uint)*text]; - bwidth = *cdata++; - VGATemp = VGACur; - VGATempLine = VGACur; - - for (uint16 rows = 0; rows < tf->_height; rows++) { - VGATemp = VGATempLine; - templeft = LeftInSegment; - - for (uint16 cols = 0; cols < bwidth; cols++) { - data = *cdata++; - - if (data && (templeft >= 8)) { - for (int j = 7; j >= 0; j--) { - if ((1 << j) & data) - *VGATemp = color; - VGATemp++; - } - - templeft -= 8; - } else if (data) { - mask = 0x80; - templeft = LeftInSegment; - - for (uint16 counterb = 0; counterb < 8; counterb++) { - if (templeft <= 0) { - curpage++; - VGATemp = (byte *)(VGATop - templeft); - // Set up VGATempLine for next line - VGATempLine -= _screenBytesPerPage; - // Set up LeftInSegment for next line - LeftInSegment += _screenBytesPerPage + templeft; - templeft += _screenBytesPerPage; - } - - if (mask & data) - *VGATemp = color; - - VGATemp++; - - mask = mask >> 1; - templeft--; - } - } else { - templeft -= 8; - VGATemp += 8; - } - } - - VGATempLine += _screenWidth; - LeftInSegment -= _screenWidth; - - if (LeftInSegment <= 0) { - curpage++; - VGATempLine -= _screenBytesPerPage; - LeftInSegment += _screenBytesPerPage; - } - } - } - - x += tf->_widths[(int)*text]; - text++; - } -} -} // End of namespace Lab diff --git a/engines/lab/graphics.h b/engines/lab/graphics.h deleted file mode 100644 index c2c3e824fd..0000000000 --- a/engines/lab/graphics.h +++ /dev/null @@ -1,169 +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. - * - */ - -/* - * This code is based on Labyrinth of Time code with assistance of - * - * Copyright (c) 1993 Terra Nova Development - * Copyright (c) 2004 The Wyrmkeep Entertainment Co. - * - */ - -#ifndef LAB_GRAPHICS_H -#define LAB_GRAPHICS_H - -#include "graphics/palette.h" -#include "lab/anim.h" -#include "lab/processroom.h" - -namespace Lab { - -class LabEngine; - -struct TextFont { - uint32 _dataLength; - uint16 _height; - byte _widths[256]; - uint16 _offsets[256]; - byte *_data; -}; - -enum TransitionType { - kTransitionNone, - kTransitionWipe, - kTransitionScrollWipe, - kTransitionScrollBlack, - kTransitionScrollBounce, - kTransitionTransporter, - kTransitionReadFirstFrame, - kTransitionReadNextFrame -}; - -class DisplayMan { -private: - LabEngine *_vm; - - uint16 fadeNumIn(uint16 num, uint16 res, uint16 counter); - uint16 fadeNumOut(uint16 num, uint16 res, uint16 counter); - - byte _curapen; - byte *_curBitmap; - byte _curvgapal[256 * 3]; - byte *_tempScrollData; - -public: - DisplayMan(LabEngine *lab); - virtual ~DisplayMan(); - - void loadPict(const char *filename); - void readPict(const char *filename, bool playOnce, bool onlyDiffData = false); - void freePict(); - byte *readPictToMem(const char *filename, uint16 x, uint16 y); - void doScrollBlack(); - void copyPage(uint16 width, uint16 height, uint16 nheight, uint16 startline, byte *mem); - void doScrollWipe(char *filename); - void doScrollBounce(); - void doTransWipe(CloseDataPtr *cPtr, char *filename); - void doTransition(TransitionType transitionType, CloseDataPtr *cPtr, char *filename); - void blackScreen(); - void whiteScreen(); - void blackAllScreen(); - void createBox(uint16 y2); - void drawPanel(); - void setUpScreens(); - int32 longDrawMessage(const char *str); - void drawMessage(const char *str); - void setAPen(byte pennum); - void rectFill(uint16 x1, uint16 y1, uint16 x2, uint16 y2); - void rectFillScaled(uint16 x1, uint16 y1, uint16 x2, uint16 y2); - // Window text stuff - uint32 flowText(void *font, // the TextAttr pointer - int16 spacing, // How much vertical spacing between the lines - byte pencolor, // pen number to use for text - byte backpen, // the background color - bool fillback, // Whether to fill the background - bool centerh, // Whether to center the text horizontally - bool centerv, // Whether to center the text vertically - bool output, // Whether to output any text - uint16 x1, uint16 y1, // Cords - uint16 x2, uint16 y2, - const char *text); // The text itself - - uint32 flowTextScaled( - void *font, // the TextAttr pointer - int16 spacing, // How much vertical spacing between the lines - byte pencolor, // pen number to use for text - byte backpen, // the background color - bool fillback, // Whether to fill the background - bool centerh, // Whether to center the text horizontally - bool centerv, // Whether to center the text vertically - bool output, // Whether to output any text - uint16 x1, uint16 y1, // Cords - uint16 x2, uint16 y2, - const char *text); // The text itself - - uint32 flowTextToMem(Image *destIm, - void *font, // the TextAttr pointer - int16 spacing, // How much vertical spacing between the lines - byte pencolor, // pen number to use for text - byte backpen, // the background color - bool fillback, // Whether to fill the background - bool centerh, // Whether to center the text horizontally - bool centerv, // Whether to center the text vertically - bool output, // Whether to output any text - uint16 x1, uint16 y1, // Cords - uint16 x2, uint16 y2, - const char *str); // The text itself - - void drawHLine(uint16 x, uint16 y1, uint16 y2); - void drawVLine(uint16 x1, uint16 y, uint16 x2); - void screenUpdate(); - void createScreen(bool HiRes); - void setAmigaPal(uint16 *pal, uint16 numColors); - void writeColorRegs(byte *buf, uint16 first, uint16 numreg); - void setPalette(void *cmap, uint16 numcolors); - void overlayRect(uint16 pencolor, uint16 x1, uint16 y1, uint16 x2, uint16 y2); - byte *getCurrentDrawingBuffer(); - void scrollDisplayX(int16 dx, uint16 x1, uint16 y1, uint16 x2, uint16 y2); - void scrollDisplayY(int16 dy, uint16 x1, uint16 y1, uint16 x2, uint16 y2); - void fade(bool fadein, uint16 res); - void closeFont(TextFont *tf); - uint16 textLength(TextFont *tf, const char *text, uint16 numchars); - uint16 textHeight(TextFont *tf); - void text(TextFont *tf, uint16 x, uint16 y, uint16 color, const char *text, uint16 numchars); - void getLine(TextFont *tf, char *lineBuffer, const char **mainBuffer, uint16 lineWidth); - - bool _longWinInFront; - bool _lastMessageLong; - uint32 _screenBytesPerPage; - int _screenWidth; - int _screenHeight; - byte *_displayBuffer; - byte *_currentDisplayBuffer; - bool _doNotDrawMessage; - uint16 *FadePalette; - BitMap _dispBitMap; -}; - -} // End of namespace Lab - -#endif // LAB_GRAPHICS_H diff --git a/engines/lab/lab.cpp b/engines/lab/lab.cpp index d1de3e11f0..a5ae97c9b5 100644 --- a/engines/lab/lab.cpp +++ b/engines/lab/lab.cpp @@ -45,7 +45,6 @@ #include "lab/labfun.h" #include "lab/resource.h" #include "lab/anim.h" -#include "lab/graphics.h" namespace Lab { diff --git a/engines/lab/lab.h b/engines/lab/lab.h index 2604579ca9..110e47008c 100644 --- a/engines/lab/lab.h +++ b/engines/lab/lab.h @@ -42,7 +42,6 @@ #include "lab/music.h" #include "lab/resource.h" #include "lab/anim.h" -#include "lab/graphics.h" #include "lab/labsets.h" #include "lab/utils.h" diff --git a/engines/lab/module.mk b/engines/lab/module.mk index f4cb284813..0d05de275e 100644 --- a/engines/lab/module.mk +++ b/engines/lab/module.mk @@ -3,9 +3,9 @@ MODULE := engines/lab MODULE_OBJS := \ anim.o \ detection.o \ + dispman.o \ engine.o \ eventman.o \ - graphics.o \ image.o \ interface.o \ intro.o \ diff --git a/engines/lab/resource.h b/engines/lab/resource.h index cfba7abd57..c51e744e03 100644 --- a/engines/lab/resource.h +++ b/engines/lab/resource.h @@ -32,7 +32,7 @@ #define LAB_RESOURCE_H #include "lab/labfun.h" -#include "lab/graphics.h" +#include "lab/dispman.h" namespace Lab { diff --git a/engines/lab/transitions.cpp b/engines/lab/transitions.cpp index c611266020..53749e8dc7 100644 --- a/engines/lab/transitions.cpp +++ b/engines/lab/transitions.cpp @@ -30,7 +30,6 @@ #include "lab/lab.h" #include "lab/processroom.h" -#include "lab/graphics.h" namespace Lab { -- cgit v1.2.3 From eccb8527497e7f50d2de9c026e1c4c194096bc5f Mon Sep 17 00:00:00 2001 From: Eugene Sandulenko Date: Tue, 8 Dec 2015 20:31:21 +0100 Subject: LAB: Removed unnecessary includes --- engines/lab/anim.cpp | 1 - engines/lab/anim.h | 4 ---- engines/lab/detection.cpp | 8 -------- engines/lab/dispman.cpp | 6 +----- engines/lab/dispman.h | 1 - engines/lab/engine.cpp | 6 ------ engines/lab/eventman.cpp | 2 -- engines/lab/image.cpp | 1 - engines/lab/interface.cpp | 4 ---- engines/lab/intro.cpp | 1 - engines/lab/intro.h | 2 -- engines/lab/lab.cpp | 11 ----------- engines/lab/lab.h | 2 -- engines/lab/labsets.cpp | 2 -- engines/lab/map.cpp | 6 ------ engines/lab/music.cpp | 4 +--- engines/lab/music.h | 3 --- engines/lab/processroom.cpp | 5 ----- engines/lab/resource.cpp | 1 - engines/lab/resource.h | 1 - engines/lab/savegame.cpp | 4 ---- engines/lab/special.cpp | 6 ------ engines/lab/transitions.cpp | 1 - engines/lab/utils.cpp | 1 - 24 files changed, 2 insertions(+), 81 deletions(-) diff --git a/engines/lab/anim.cpp b/engines/lab/anim.cpp index 523bfc06bb..5391957d9a 100644 --- a/engines/lab/anim.cpp +++ b/engines/lab/anim.cpp @@ -28,7 +28,6 @@ * */ -#include "common/endian.h" #include "lab/lab.h" namespace Lab { diff --git a/engines/lab/anim.h b/engines/lab/anim.h index b5df6e2f65..91bc0d724a 100644 --- a/engines/lab/anim.h +++ b/engines/lab/anim.h @@ -31,8 +31,6 @@ #ifndef LAB_DIFF_H #define LAB_DIFF_H -#include "common/file.h" - namespace Lab { class LabEngine; @@ -107,5 +105,3 @@ public: } // End of namespace Lab #endif // LAB_DIFF_H - - diff --git a/engines/lab/detection.cpp b/engines/lab/detection.cpp index 67890da1ea..18d73ce27c 100644 --- a/engines/lab/detection.cpp +++ b/engines/lab/detection.cpp @@ -30,15 +30,7 @@ #include "engines/advancedDetector.h" -#include "common/str-array.h" -#include "common/savefile.h" - -#include "base/plugins.h" - -#include "graphics/surface.h" - #include "lab/lab.h" -#include "lab/labfun.h" static const PlainGameDescriptor lab_setting[] = { { "lab", "Labyrith of Time" }, diff --git a/engines/lab/dispman.cpp b/engines/lab/dispman.cpp index a7c71f2214..eb26f81e93 100644 --- a/engines/lab/dispman.cpp +++ b/engines/lab/dispman.cpp @@ -28,12 +28,8 @@ * */ +#include "graphics/palette.h" #include "lab/lab.h" -#include "lab/anim.h" -#include "lab/image.h" -#include "lab/labfun.h" -#include "lab/processroom.h" -#include "lab/resource.h" namespace Lab { diff --git a/engines/lab/dispman.h b/engines/lab/dispman.h index bbbbe35126..01d1def134 100644 --- a/engines/lab/dispman.h +++ b/engines/lab/dispman.h @@ -31,7 +31,6 @@ #ifndef LAB_DISPMAN_H #define LAB_DISPMAN_H -#include "graphics/palette.h" #include "lab/anim.h" #include "lab/processroom.h" diff --git a/engines/lab/engine.cpp b/engines/lab/engine.cpp index fe334f4e7e..4ef3436492 100644 --- a/engines/lab/engine.cpp +++ b/engines/lab/engine.cpp @@ -29,13 +29,7 @@ */ #include "lab/lab.h" -#include "lab/labfun.h" -#include "lab/anim.h" -#include "lab/image.h" #include "lab/intro.h" -#include "lab/processroom.h" -#include "lab/interface.h" -#include "lab/resource.h" namespace Lab { diff --git a/engines/lab/eventman.cpp b/engines/lab/eventman.cpp index 53361c9e8a..c68149f056 100644 --- a/engines/lab/eventman.cpp +++ b/engines/lab/eventman.cpp @@ -29,8 +29,6 @@ */ #include "lab/lab.h" -#include "lab/image.h" -#include "lab/interface.h" namespace Lab { diff --git a/engines/lab/image.cpp b/engines/lab/image.cpp index 29459b1fcc..f4ad01538f 100644 --- a/engines/lab/image.cpp +++ b/engines/lab/image.cpp @@ -29,7 +29,6 @@ */ #include "lab/lab.h" -#include "lab/image.h" namespace Lab { diff --git a/engines/lab/interface.cpp b/engines/lab/interface.cpp index dae822b8ff..286ff7fe12 100644 --- a/engines/lab/interface.cpp +++ b/engines/lab/interface.cpp @@ -29,10 +29,6 @@ */ #include "lab/lab.h" -#include "lab/labfun.h" -#include "lab/image.h" -#include "lab/interface.h" -#include "common/util.h" namespace Lab { diff --git a/engines/lab/intro.cpp b/engines/lab/intro.cpp index b75a215025..71c5fc83d0 100644 --- a/engines/lab/intro.cpp +++ b/engines/lab/intro.cpp @@ -30,7 +30,6 @@ #include "lab/lab.h" #include "lab/intro.h" -#include "lab/anim.h" namespace Lab { Intro::Intro(LabEngine *vm) : _vm(vm) { diff --git a/engines/lab/intro.h b/engines/lab/intro.h index c532bdfa1e..323859c152 100644 --- a/engines/lab/intro.h +++ b/engines/lab/intro.h @@ -31,8 +31,6 @@ #ifndef LAB_INTRO_H #define LAB_INTRO_H -#include "lab/intro.h" - namespace Lab { class Intro { diff --git a/engines/lab/lab.cpp b/engines/lab/lab.cpp index a5ae97c9b5..4252033ba8 100644 --- a/engines/lab/lab.cpp +++ b/engines/lab/lab.cpp @@ -28,23 +28,12 @@ * */ -#include "common/config-manager.h" #include "common/debug-channels.h" -#include "common/scummsys.h" -#include "common/error.h" -#include "common/fs.h" -#include "common/rect.h" -#include "engines/dialogs.h" -#include "engines/engine.h" #include "engines/util.h" #include "gui/message.h" -#include "engines/advancedDetector.h" #include "lab/lab.h" -#include "lab/labfun.h" -#include "lab/resource.h" -#include "lab/anim.h" namespace Lab { diff --git a/engines/lab/lab.h b/engines/lab/lab.h index 110e47008c..93f3796eac 100644 --- a/engines/lab/lab.h +++ b/engines/lab/lab.h @@ -31,8 +31,6 @@ #ifndef LAB_H #define LAB_H -#include "common/array.h" -#include "common/events.h" #include "common/system.h" #include "engines/engine.h" diff --git a/engines/lab/labsets.cpp b/engines/lab/labsets.cpp index f09f669b7f..2b860ad820 100644 --- a/engines/lab/labsets.cpp +++ b/engines/lab/labsets.cpp @@ -29,8 +29,6 @@ */ #include "lab/lab.h" -#include "lab/labfun.h" -#include "lab/resource.h" namespace Lab { diff --git a/engines/lab/map.cpp b/engines/lab/map.cpp index 8cd0ed93a7..4406fae2d0 100644 --- a/engines/lab/map.cpp +++ b/engines/lab/map.cpp @@ -29,12 +29,6 @@ */ #include "lab/lab.h" -#include "lab/labfun.h" -#include "lab/anim.h" -#include "lab/image.h" -#include "lab/processroom.h" -#include "lab/resource.h" -#include "lab/interface.h" namespace Lab { diff --git a/engines/lab/music.cpp b/engines/lab/music.cpp index 4bf15027c5..d1031a006f 100644 --- a/engines/lab/music.cpp +++ b/engines/lab/music.cpp @@ -28,10 +28,8 @@ * */ -#include "audio/mixer.h" +#include "audio/decoders/raw.h" -#include "lab/labfun.h" -#include "lab/music.h" #include "lab/lab.h" namespace Lab { diff --git a/engines/lab/music.h b/engines/lab/music.h index 6d102e7783..d257d27462 100644 --- a/engines/lab/music.h +++ b/engines/lab/music.h @@ -31,11 +31,8 @@ #ifndef LAB_MUSIC_H #define LAB_MUSIC_H -#include "common/events.h" - #include "audio/mixer.h" #include "audio/audiostream.h" -#include "audio/decoders/raw.h" namespace Lab { diff --git a/engines/lab/processroom.cpp b/engines/lab/processroom.cpp index ed28e87453..e541aa08d7 100644 --- a/engines/lab/processroom.cpp +++ b/engines/lab/processroom.cpp @@ -31,11 +31,6 @@ #include "gui/message.h" #include "lab/lab.h" -#include "lab/labfun.h" -#include "lab/processroom.h" -#include "lab/resource.h" -#include "lab/anim.h" -#include "lab/interface.h" namespace Lab { diff --git a/engines/lab/resource.cpp b/engines/lab/resource.cpp index de1e9dc714..b49afa02ab 100644 --- a/engines/lab/resource.cpp +++ b/engines/lab/resource.cpp @@ -29,7 +29,6 @@ */ #include "lab/lab.h" -#include "lab/resource.h" namespace Lab { diff --git a/engines/lab/resource.h b/engines/lab/resource.h index c51e744e03..1c733d8fba 100644 --- a/engines/lab/resource.h +++ b/engines/lab/resource.h @@ -31,7 +31,6 @@ #ifndef LAB_RESOURCE_H #define LAB_RESOURCE_H -#include "lab/labfun.h" #include "lab/dispman.h" namespace Lab { diff --git a/engines/lab/savegame.cpp b/engines/lab/savegame.cpp index 5924d884b9..986e910b91 100644 --- a/engines/lab/savegame.cpp +++ b/engines/lab/savegame.cpp @@ -28,13 +28,9 @@ * */ -#include "common/savefile.h" - -#include "graphics/surface.h" #include "graphics/thumbnail.h" #include "lab/lab.h" -#include "lab/labfun.h" namespace Lab { #define SAVEGAME_ID MKTAG('L', 'O', 'T', 'S') diff --git a/engines/lab/special.cpp b/engines/lab/special.cpp index 5a0348c2ca..ee454bf70c 100644 --- a/engines/lab/special.cpp +++ b/engines/lab/special.cpp @@ -34,12 +34,6 @@ #include "gui/saveload.h" #include "lab/lab.h" -#include "lab/labfun.h" -#include "lab/image.h" -#include "lab/processroom.h" -#include "lab/interface.h" -#include "lab/anim.h" -#include "lab/resource.h" namespace Lab { diff --git a/engines/lab/transitions.cpp b/engines/lab/transitions.cpp index 53749e8dc7..14753fbc72 100644 --- a/engines/lab/transitions.cpp +++ b/engines/lab/transitions.cpp @@ -29,7 +29,6 @@ */ #include "lab/lab.h" -#include "lab/processroom.h" namespace Lab { diff --git a/engines/lab/utils.cpp b/engines/lab/utils.cpp index d5d0734268..198e1ab624 100644 --- a/engines/lab/utils.cpp +++ b/engines/lab/utils.cpp @@ -29,7 +29,6 @@ */ #include "lab/lab.h" -#include "lab/utils.h" namespace Lab { Utils::Utils(LabEngine *vm) : _vm(vm) { -- cgit v1.2.3 From d8e01fe23a569e60e9cacf7b29fa69e7cab03eb5 Mon Sep 17 00:00:00 2001 From: Eugene Sandulenko Date: Tue, 8 Dec 2015 20:36:05 +0100 Subject: LAB: Reduce header dependency from music.h --- engines/lab/anim.cpp | 1 + engines/lab/dispman.cpp | 2 ++ engines/lab/engine.cpp | 2 ++ engines/lab/intro.cpp | 1 + engines/lab/lab.cpp | 1 + engines/lab/lab.h | 4 +++- engines/lab/map.cpp | 1 + engines/lab/music.cpp | 1 + engines/lab/processroom.cpp | 1 + engines/lab/resource.cpp | 1 + engines/lab/special.cpp | 1 + engines/lab/transitions.cpp | 1 + 12 files changed, 16 insertions(+), 1 deletion(-) diff --git a/engines/lab/anim.cpp b/engines/lab/anim.cpp index 5391957d9a..d4abc34c27 100644 --- a/engines/lab/anim.cpp +++ b/engines/lab/anim.cpp @@ -29,6 +29,7 @@ */ #include "lab/lab.h" +#include "lab/music.h" namespace Lab { diff --git a/engines/lab/dispman.cpp b/engines/lab/dispman.cpp index eb26f81e93..75e61b4dfe 100644 --- a/engines/lab/dispman.cpp +++ b/engines/lab/dispman.cpp @@ -29,7 +29,9 @@ */ #include "graphics/palette.h" + #include "lab/lab.h" +#include "lab/music.h" namespace Lab { diff --git a/engines/lab/engine.cpp b/engines/lab/engine.cpp index 4ef3436492..2b51e34463 100644 --- a/engines/lab/engine.cpp +++ b/engines/lab/engine.cpp @@ -30,6 +30,8 @@ #include "lab/lab.h" #include "lab/intro.h" +#include "lab/music.h" + namespace Lab { diff --git a/engines/lab/intro.cpp b/engines/lab/intro.cpp index 71c5fc83d0..47dc6713a7 100644 --- a/engines/lab/intro.cpp +++ b/engines/lab/intro.cpp @@ -30,6 +30,7 @@ #include "lab/lab.h" #include "lab/intro.h" +#include "lab/music.h" namespace Lab { Intro::Intro(LabEngine *vm) : _vm(vm) { diff --git a/engines/lab/lab.cpp b/engines/lab/lab.cpp index 4252033ba8..9ff8ce5ba3 100644 --- a/engines/lab/lab.cpp +++ b/engines/lab/lab.cpp @@ -34,6 +34,7 @@ #include "gui/message.h" #include "lab/lab.h" +#include "lab/music.h" namespace Lab { diff --git a/engines/lab/lab.h b/engines/lab/lab.h index 93f3796eac..52a8df9b10 100644 --- a/engines/lab/lab.h +++ b/engines/lab/lab.h @@ -37,7 +37,7 @@ #include "lab/labfun.h" #include "lab/interface.h" #include "lab/eventman.h" -#include "lab/music.h" +//#include "lab/music.h" #include "lab/resource.h" #include "lab/anim.h" #include "lab/labsets.h" @@ -47,6 +47,8 @@ struct ADGameDescription; namespace Lab { +class Music; + enum GameFeatures { GF_LOWRES = 1 << 0, GF_WINDOWS_TRIAL = 1 << 1 diff --git a/engines/lab/map.cpp b/engines/lab/map.cpp index 4406fae2d0..6d09a99739 100644 --- a/engines/lab/map.cpp +++ b/engines/lab/map.cpp @@ -29,6 +29,7 @@ */ #include "lab/lab.h" +#include "lab/music.h" namespace Lab { diff --git a/engines/lab/music.cpp b/engines/lab/music.cpp index d1031a006f..de4ac8ee0c 100644 --- a/engines/lab/music.cpp +++ b/engines/lab/music.cpp @@ -31,6 +31,7 @@ #include "audio/decoders/raw.h" #include "lab/lab.h" +#include "lab/music.h" namespace Lab { diff --git a/engines/lab/processroom.cpp b/engines/lab/processroom.cpp index e541aa08d7..8876740e1b 100644 --- a/engines/lab/processroom.cpp +++ b/engines/lab/processroom.cpp @@ -31,6 +31,7 @@ #include "gui/message.h" #include "lab/lab.h" +#include "lab/music.h" namespace Lab { diff --git a/engines/lab/resource.cpp b/engines/lab/resource.cpp index b49afa02ab..d21efaff01 100644 --- a/engines/lab/resource.cpp +++ b/engines/lab/resource.cpp @@ -29,6 +29,7 @@ */ #include "lab/lab.h" +#include "lab/music.h" namespace Lab { diff --git a/engines/lab/special.cpp b/engines/lab/special.cpp index ee454bf70c..f9eb0db87c 100644 --- a/engines/lab/special.cpp +++ b/engines/lab/special.cpp @@ -34,6 +34,7 @@ #include "gui/saveload.h" #include "lab/lab.h" +#include "lab/music.h" namespace Lab { diff --git a/engines/lab/transitions.cpp b/engines/lab/transitions.cpp index 14753fbc72..aad9b3dd8e 100644 --- a/engines/lab/transitions.cpp +++ b/engines/lab/transitions.cpp @@ -29,6 +29,7 @@ */ #include "lab/lab.h" +#include "lab/music.h" namespace Lab { -- cgit v1.2.3 From 8e9798a0bce3fb6fac55a85c7f9e54176d4cbc85 Mon Sep 17 00:00:00 2001 From: Eugene Sandulenko Date: Tue, 8 Dec 2015 20:46:13 +0100 Subject: LAB: Reduce header intra-dependency. Reduced image.h dependency --- engines/lab/dispman.cpp | 1 + engines/lab/dispman.h | 4 +--- engines/lab/engine.cpp | 2 +- engines/lab/eventman.cpp | 1 + engines/lab/image.cpp | 1 + engines/lab/interface.cpp | 1 + engines/lab/interface.h | 5 ++--- engines/lab/lab.cpp | 1 + engines/lab/lab.h | 5 ++++- engines/lab/labfun.h | 1 - engines/lab/map.cpp | 1 + engines/lab/resource.h | 2 -- engines/lab/special.cpp | 1 + engines/lab/tilepuzzle.cpp | 1 + engines/lab/transitions.cpp | 1 + 15 files changed, 17 insertions(+), 11 deletions(-) diff --git a/engines/lab/dispman.cpp b/engines/lab/dispman.cpp index 75e61b4dfe..42007a4ca1 100644 --- a/engines/lab/dispman.cpp +++ b/engines/lab/dispman.cpp @@ -32,6 +32,7 @@ #include "lab/lab.h" #include "lab/music.h" +#include "lab/image.h" namespace Lab { diff --git a/engines/lab/dispman.h b/engines/lab/dispman.h index 01d1def134..a04d142f8d 100644 --- a/engines/lab/dispman.h +++ b/engines/lab/dispman.h @@ -31,12 +31,10 @@ #ifndef LAB_DISPMAN_H #define LAB_DISPMAN_H -#include "lab/anim.h" -#include "lab/processroom.h" - namespace Lab { class LabEngine; +class Image; struct TextFont { uint32 _dataLength; diff --git a/engines/lab/engine.cpp b/engines/lab/engine.cpp index 2b51e34463..f8658a4ec0 100644 --- a/engines/lab/engine.cpp +++ b/engines/lab/engine.cpp @@ -31,7 +31,7 @@ #include "lab/lab.h" #include "lab/intro.h" #include "lab/music.h" - +#include "lab/image.h" namespace Lab { diff --git a/engines/lab/eventman.cpp b/engines/lab/eventman.cpp index c68149f056..edc2588700 100644 --- a/engines/lab/eventman.cpp +++ b/engines/lab/eventman.cpp @@ -29,6 +29,7 @@ */ #include "lab/lab.h" +#include "lab/image.h" namespace Lab { diff --git a/engines/lab/image.cpp b/engines/lab/image.cpp index f4ad01538f..29459b1fcc 100644 --- a/engines/lab/image.cpp +++ b/engines/lab/image.cpp @@ -29,6 +29,7 @@ */ #include "lab/lab.h" +#include "lab/image.h" namespace Lab { diff --git a/engines/lab/interface.cpp b/engines/lab/interface.cpp index 286ff7fe12..f536c22dd6 100644 --- a/engines/lab/interface.cpp +++ b/engines/lab/interface.cpp @@ -29,6 +29,7 @@ */ #include "lab/lab.h" +#include "lab/image.h" namespace Lab { diff --git a/engines/lab/interface.h b/engines/lab/interface.h index 50e89e38f7..c4b2341871 100644 --- a/engines/lab/interface.h +++ b/engines/lab/interface.h @@ -28,14 +28,13 @@ * */ -#include "common/keyboard.h" -#include "lab/image.h" - #ifndef LAB_INTEFACE_H #define LAB_INTEFACE_H namespace Lab { +class Image; + struct IntuiMessage { uint32 _msgClass; uint16 _code, _qualifier, _mouseX, _mouseY, _gadgetID; diff --git a/engines/lab/lab.cpp b/engines/lab/lab.cpp index 9ff8ce5ba3..6b328e1e99 100644 --- a/engines/lab/lab.cpp +++ b/engines/lab/lab.cpp @@ -35,6 +35,7 @@ #include "lab/lab.h" #include "lab/music.h" +#include "lab/image.h" namespace Lab { diff --git a/engines/lab/lab.h b/engines/lab/lab.h index 52a8df9b10..0290a36298 100644 --- a/engines/lab/lab.h +++ b/engines/lab/lab.h @@ -32,12 +32,15 @@ #define LAB_H #include "common/system.h" +#include "common/events.h" #include "engines/engine.h" +#include "lab/anim.h" #include "lab/labfun.h" +#include "lab/processroom.h" #include "lab/interface.h" #include "lab/eventman.h" -//#include "lab/music.h" +#include "lab/dispman.h" #include "lab/resource.h" #include "lab/anim.h" #include "lab/labsets.h" diff --git a/engines/lab/labfun.h b/engines/lab/labfun.h index 4edb263eee..08f7cda81c 100644 --- a/engines/lab/labfun.h +++ b/engines/lab/labfun.h @@ -31,7 +31,6 @@ #ifndef LAB_LABFUN_H #define LAB_LABFUN_H -#include "common/events.h" #include "common/file.h" #include "common/savefile.h" #include "engines/savestate.h" diff --git a/engines/lab/map.cpp b/engines/lab/map.cpp index 6d09a99739..8a0bec42e5 100644 --- a/engines/lab/map.cpp +++ b/engines/lab/map.cpp @@ -30,6 +30,7 @@ #include "lab/lab.h" #include "lab/music.h" +#include "lab/image.h" namespace Lab { diff --git a/engines/lab/resource.h b/engines/lab/resource.h index 1c733d8fba..89303e1a66 100644 --- a/engines/lab/resource.h +++ b/engines/lab/resource.h @@ -31,8 +31,6 @@ #ifndef LAB_RESOURCE_H #define LAB_RESOURCE_H -#include "lab/dispman.h" - namespace Lab { enum StaticText { diff --git a/engines/lab/special.cpp b/engines/lab/special.cpp index f9eb0db87c..8b1e426de2 100644 --- a/engines/lab/special.cpp +++ b/engines/lab/special.cpp @@ -35,6 +35,7 @@ #include "lab/lab.h" #include "lab/music.h" +#include "lab/image.h" namespace Lab { diff --git a/engines/lab/tilepuzzle.cpp b/engines/lab/tilepuzzle.cpp index 68f4771833..7afb7c06ad 100644 --- a/engines/lab/tilepuzzle.cpp +++ b/engines/lab/tilepuzzle.cpp @@ -30,6 +30,7 @@ #include "lab/lab.h" #include "gui/message.h" +#include "lab/image.h" namespace Lab { diff --git a/engines/lab/transitions.cpp b/engines/lab/transitions.cpp index aad9b3dd8e..5b2ef2b1cf 100644 --- a/engines/lab/transitions.cpp +++ b/engines/lab/transitions.cpp @@ -30,6 +30,7 @@ #include "lab/lab.h" #include "lab/music.h" +#include "lab/image.h" namespace Lab { -- cgit v1.2.3 From d2cf293e4abb19f2e15b7a69931a2723bcdbeaad Mon Sep 17 00:00:00 2001 From: Eugene Sandulenko Date: Tue, 8 Dec 2015 20:49:17 +0100 Subject: LAB: More intra-header dependency reduction --- engines/lab/lab.h | 3 +++ engines/lab/labfun.h | 4 ---- 2 files changed, 3 insertions(+), 4 deletions(-) diff --git a/engines/lab/lab.h b/engines/lab/lab.h index 0290a36298..b8a5ad458b 100644 --- a/engines/lab/lab.h +++ b/engines/lab/lab.h @@ -33,6 +33,9 @@ #include "common/system.h" #include "common/events.h" +#include "common/file.h" +#include "common/savefile.h" +#include "engines/savestate.h" #include "engines/engine.h" #include "lab/anim.h" diff --git a/engines/lab/labfun.h b/engines/lab/labfun.h index 08f7cda81c..9307deae6a 100644 --- a/engines/lab/labfun.h +++ b/engines/lab/labfun.h @@ -31,10 +31,6 @@ #ifndef LAB_LABFUN_H #define LAB_LABFUN_H -#include "common/file.h" -#include "common/savefile.h" -#include "engines/savestate.h" - namespace Lab { class LabEngine; -- cgit v1.2.3 From a53045626db463327ba87301f271d62f7ac16b40 Mon Sep 17 00:00:00 2001 From: Eugene Sandulenko Date: Tue, 8 Dec 2015 20:50:11 +0100 Subject: LAB: Moved direction defines to lab.h --- engines/lab/lab.h | 6 ++++++ engines/lab/labfun.h | 6 ------ 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/engines/lab/lab.h b/engines/lab/lab.h index b8a5ad458b..d50261ef2d 100644 --- a/engines/lab/lab.h +++ b/engines/lab/lab.h @@ -77,6 +77,12 @@ struct CrumbData { #define MAX_CRUMBS 128 +// Direction defines +#define NORTH 0 +#define SOUTH 1 +#define EAST 2 +#define WEST 3 + class LabEngine : public Engine { public: LabEngine(OSystem *syst, const ADGameDescription *gameDesc); diff --git a/engines/lab/labfun.h b/engines/lab/labfun.h index 9307deae6a..d8595af823 100644 --- a/engines/lab/labfun.h +++ b/engines/lab/labfun.h @@ -35,12 +35,6 @@ namespace Lab { class LabEngine; -// Direction defines -#define NORTH 0 -#define SOUTH 1 -#define EAST 2 -#define WEST 3 - struct SaveGameHeader { byte _version; SaveStateDescriptor _descr; -- cgit v1.2.3 From bb80b6d46b2661b6184a048025428aab3858b417 Mon Sep 17 00:00:00 2001 From: Eugene Sandulenko Date: Tue, 8 Dec 2015 20:52:07 +0100 Subject: LAB: Rename labfun.h to savegame.h --- engines/lab/lab.h | 2 +- engines/lab/labfun.h | 55 -------------------------------------------------- engines/lab/savegame.h | 51 ++++++++++++++++++++++++++++++++++++++++++++++ 3 files changed, 52 insertions(+), 56 deletions(-) delete mode 100644 engines/lab/labfun.h create mode 100644 engines/lab/savegame.h diff --git a/engines/lab/lab.h b/engines/lab/lab.h index d50261ef2d..f9e8a0a500 100644 --- a/engines/lab/lab.h +++ b/engines/lab/lab.h @@ -39,7 +39,7 @@ #include "engines/engine.h" #include "lab/anim.h" -#include "lab/labfun.h" +#include "lab/savegame.h" #include "lab/processroom.h" #include "lab/interface.h" #include "lab/eventman.h" diff --git a/engines/lab/labfun.h b/engines/lab/labfun.h deleted file mode 100644 index d8595af823..0000000000 --- a/engines/lab/labfun.h +++ /dev/null @@ -1,55 +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. - * - */ - -/* - * This code is based on Labyrinth of Time code with assistance of - * - * Copyright (c) 1993 Terra Nova Development - * Copyright (c) 2004 The Wyrmkeep Entertainment Co. - * - */ - -#ifndef LAB_LABFUN_H -#define LAB_LABFUN_H - -namespace Lab { - -class LabEngine; - -struct SaveGameHeader { - byte _version; - SaveStateDescriptor _descr; - uint16 _roomNumber; - uint16 _direction; -}; - -//-------------------------- -//----- From saveGame.c ---- -//-------------------------- - -bool saveGame(uint16 Direction, uint16 Quarters, int slot, Common::String desc); -bool loadGame(uint16 *Direction, uint16 *Quarters, int slot); -bool readSaveGameHeader(Common::InSaveFile *in, SaveGameHeader &header); - -} // End of namespace Lab - -#endif // LAB_LABFUN_H diff --git a/engines/lab/savegame.h b/engines/lab/savegame.h new file mode 100644 index 0000000000..82f93e7a6a --- /dev/null +++ b/engines/lab/savegame.h @@ -0,0 +1,51 @@ +/* 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. + * + */ + +/* + * This code is based on Labyrinth of Time code with assistance of + * + * Copyright (c) 1993 Terra Nova Development + * Copyright (c) 2004 The Wyrmkeep Entertainment Co. + * + */ + +#ifndef LAB_SAVEGAME_H +#define LAB_SAVEGAME_H + +namespace Lab { + +class LabEngine; + +struct SaveGameHeader { + byte _version; + SaveStateDescriptor _descr; + uint16 _roomNumber; + uint16 _direction; +}; + +bool saveGame(uint16 Direction, uint16 Quarters, int slot, Common::String desc); +bool loadGame(uint16 *Direction, uint16 *Quarters, int slot); +bool readSaveGameHeader(Common::InSaveFile *in, SaveGameHeader &header); + +} // End of namespace Lab + +#endif // LAB_SAVEGAME_H -- cgit v1.2.3 From b1585b2c62c1d45ef22e5f08a1a434ec78c2fd3e Mon Sep 17 00:00:00 2001 From: Eugene Sandulenko Date: Tue, 8 Dec 2015 20:53:44 +0100 Subject: LAB: Reduced header dependency: savegame.h --- engines/lab/detection.cpp | 1 + engines/lab/lab.h | 1 - engines/lab/savegame.cpp | 1 + engines/lab/special.cpp | 1 + 4 files changed, 3 insertions(+), 1 deletion(-) diff --git a/engines/lab/detection.cpp b/engines/lab/detection.cpp index 18d73ce27c..afdf5a1625 100644 --- a/engines/lab/detection.cpp +++ b/engines/lab/detection.cpp @@ -31,6 +31,7 @@ #include "engines/advancedDetector.h" #include "lab/lab.h" +#include "lab/savegame.h" static const PlainGameDescriptor lab_setting[] = { { "lab", "Labyrith of Time" }, diff --git a/engines/lab/lab.h b/engines/lab/lab.h index f9e8a0a500..4242780ff7 100644 --- a/engines/lab/lab.h +++ b/engines/lab/lab.h @@ -39,7 +39,6 @@ #include "engines/engine.h" #include "lab/anim.h" -#include "lab/savegame.h" #include "lab/processroom.h" #include "lab/interface.h" #include "lab/eventman.h" diff --git a/engines/lab/savegame.cpp b/engines/lab/savegame.cpp index 986e910b91..c9cb831513 100644 --- a/engines/lab/savegame.cpp +++ b/engines/lab/savegame.cpp @@ -31,6 +31,7 @@ #include "graphics/thumbnail.h" #include "lab/lab.h" +#include "lab/savegame.h" namespace Lab { #define SAVEGAME_ID MKTAG('L', 'O', 'T', 'S') diff --git a/engines/lab/special.cpp b/engines/lab/special.cpp index 8b1e426de2..11af40a609 100644 --- a/engines/lab/special.cpp +++ b/engines/lab/special.cpp @@ -36,6 +36,7 @@ #include "lab/lab.h" #include "lab/music.h" #include "lab/image.h" +#include "lab/savegame.h" namespace Lab { -- cgit v1.2.3 From 5fad5cece3704f8e4267da4610a014017d32db1d Mon Sep 17 00:00:00 2001 From: Eugene Sandulenko Date: Tue, 8 Dec 2015 21:00:50 +0100 Subject: LAB: Reduced header dependency: labsets.h, utils.h --- engines/lab/anim.cpp | 1 + engines/lab/dispman.cpp | 1 + engines/lab/engine.cpp | 4 +++- engines/lab/interface.cpp | 1 + engines/lab/lab.cpp | 1 + engines/lab/lab.h | 5 ++--- engines/lab/labsets.cpp | 1 + engines/lab/map.cpp | 2 ++ engines/lab/processroom.cpp | 2 ++ engines/lab/savegame.cpp | 1 + engines/lab/special.cpp | 2 ++ engines/lab/tilepuzzle.cpp | 5 ++++- engines/lab/transitions.cpp | 1 + engines/lab/utils.cpp | 1 + 14 files changed, 23 insertions(+), 5 deletions(-) diff --git a/engines/lab/anim.cpp b/engines/lab/anim.cpp index d4abc34c27..db8e8c614f 100644 --- a/engines/lab/anim.cpp +++ b/engines/lab/anim.cpp @@ -30,6 +30,7 @@ #include "lab/lab.h" #include "lab/music.h" +#include "lab/utils.h" namespace Lab { diff --git a/engines/lab/dispman.cpp b/engines/lab/dispman.cpp index 42007a4ca1..b80ef07f9d 100644 --- a/engines/lab/dispman.cpp +++ b/engines/lab/dispman.cpp @@ -33,6 +33,7 @@ #include "lab/lab.h" #include "lab/music.h" #include "lab/image.h" +#include "lab/utils.h" namespace Lab { diff --git a/engines/lab/engine.cpp b/engines/lab/engine.cpp index f8658a4ec0..13f3ae64de 100644 --- a/engines/lab/engine.cpp +++ b/engines/lab/engine.cpp @@ -29,9 +29,11 @@ */ #include "lab/lab.h" +#include "lab/image.h" #include "lab/intro.h" +#include "lab/labsets.h" #include "lab/music.h" -#include "lab/image.h" +#include "lab/utils.h" namespace Lab { diff --git a/engines/lab/interface.cpp b/engines/lab/interface.cpp index f536c22dd6..62b0f80b2f 100644 --- a/engines/lab/interface.cpp +++ b/engines/lab/interface.cpp @@ -30,6 +30,7 @@ #include "lab/lab.h" #include "lab/image.h" +#include "lab/utils.h" namespace Lab { diff --git a/engines/lab/lab.cpp b/engines/lab/lab.cpp index 6b328e1e99..04a689848d 100644 --- a/engines/lab/lab.cpp +++ b/engines/lab/lab.cpp @@ -36,6 +36,7 @@ #include "lab/lab.h" #include "lab/music.h" #include "lab/image.h" +#include "lab/utils.h" namespace Lab { diff --git a/engines/lab/lab.h b/engines/lab/lab.h index 4242780ff7..7e5f33e236 100644 --- a/engines/lab/lab.h +++ b/engines/lab/lab.h @@ -44,15 +44,14 @@ #include "lab/eventman.h" #include "lab/dispman.h" #include "lab/resource.h" -#include "lab/anim.h" -#include "lab/labsets.h" -#include "lab/utils.h" struct ADGameDescription; namespace Lab { class Music; +class Utils; +class LargeSet; enum GameFeatures { GF_LOWRES = 1 << 0, diff --git a/engines/lab/labsets.cpp b/engines/lab/labsets.cpp index 2b860ad820..ca37a395cd 100644 --- a/engines/lab/labsets.cpp +++ b/engines/lab/labsets.cpp @@ -29,6 +29,7 @@ */ #include "lab/lab.h" +#include "lab/labsets.h" namespace Lab { diff --git a/engines/lab/map.cpp b/engines/lab/map.cpp index 8a0bec42e5..7bcfd80df7 100644 --- a/engines/lab/map.cpp +++ b/engines/lab/map.cpp @@ -29,8 +29,10 @@ */ #include "lab/lab.h" +#include "lab/labsets.h" #include "lab/music.h" #include "lab/image.h" +#include "lab/utils.h" namespace Lab { diff --git a/engines/lab/processroom.cpp b/engines/lab/processroom.cpp index 8876740e1b..472c0e477e 100644 --- a/engines/lab/processroom.cpp +++ b/engines/lab/processroom.cpp @@ -31,7 +31,9 @@ #include "gui/message.h" #include "lab/lab.h" +#include "lab/labsets.h" #include "lab/music.h" +#include "lab/utils.h" namespace Lab { diff --git a/engines/lab/savegame.cpp b/engines/lab/savegame.cpp index c9cb831513..244f119f59 100644 --- a/engines/lab/savegame.cpp +++ b/engines/lab/savegame.cpp @@ -31,6 +31,7 @@ #include "graphics/thumbnail.h" #include "lab/lab.h" +#include "lab/labsets.h" #include "lab/savegame.h" namespace Lab { diff --git a/engines/lab/special.cpp b/engines/lab/special.cpp index 11af40a609..274e9870d4 100644 --- a/engines/lab/special.cpp +++ b/engines/lab/special.cpp @@ -34,9 +34,11 @@ #include "gui/saveload.h" #include "lab/lab.h" +#include "lab/labsets.h" #include "lab/music.h" #include "lab/image.h" #include "lab/savegame.h" +#include "lab/utils.h" namespace Lab { diff --git a/engines/lab/tilepuzzle.cpp b/engines/lab/tilepuzzle.cpp index 7afb7c06ad..f989b1ab2e 100644 --- a/engines/lab/tilepuzzle.cpp +++ b/engines/lab/tilepuzzle.cpp @@ -28,9 +28,12 @@ * */ -#include "lab/lab.h" #include "gui/message.h" + +#include "lab/lab.h" +#include "lab/labsets.h" #include "lab/image.h" +#include "lab/utils.h" namespace Lab { diff --git a/engines/lab/transitions.cpp b/engines/lab/transitions.cpp index 5b2ef2b1cf..89ce54f28d 100644 --- a/engines/lab/transitions.cpp +++ b/engines/lab/transitions.cpp @@ -31,6 +31,7 @@ #include "lab/lab.h" #include "lab/music.h" #include "lab/image.h" +#include "lab/utils.h" namespace Lab { diff --git a/engines/lab/utils.cpp b/engines/lab/utils.cpp index 198e1ab624..d5d0734268 100644 --- a/engines/lab/utils.cpp +++ b/engines/lab/utils.cpp @@ -29,6 +29,7 @@ */ #include "lab/lab.h" +#include "lab/utils.h" namespace Lab { Utils::Utils(LabEngine *vm) : _vm(vm) { -- cgit v1.2.3 From 9a9b752c0e0e14d35e99cd5475bfa2138fff4d4a Mon Sep 17 00:00:00 2001 From: Eugene Sandulenko Date: Tue, 8 Dec 2015 21:10:54 +0100 Subject: LAB: More header dependency redux --- engines/lab/dispman.cpp | 1 + engines/lab/engine.cpp | 2 ++ engines/lab/image.cpp | 2 ++ engines/lab/image.h | 4 ++++ engines/lab/intro.cpp | 2 ++ engines/lab/lab.cpp | 3 +++ engines/lab/lab.h | 7 ++----- engines/lab/labsets.cpp | 4 ++++ engines/lab/map.cpp | 4 +++- engines/lab/music.cpp | 2 ++ engines/lab/music.h | 1 + engines/lab/processroom.cpp | 2 ++ engines/lab/resource.cpp | 2 ++ engines/lab/savegame.cpp | 1 + engines/lab/savegame.h | 2 ++ engines/lab/special.cpp | 4 +++- engines/lab/tilepuzzle.cpp | 4 +++- engines/lab/utils.cpp | 2 ++ 18 files changed, 41 insertions(+), 8 deletions(-) diff --git a/engines/lab/dispman.cpp b/engines/lab/dispman.cpp index b80ef07f9d..ee9d5bc6a0 100644 --- a/engines/lab/dispman.cpp +++ b/engines/lab/dispman.cpp @@ -33,6 +33,7 @@ #include "lab/lab.h" #include "lab/music.h" #include "lab/image.h" +#include "lab/resource.h" #include "lab/utils.h" namespace Lab { diff --git a/engines/lab/engine.cpp b/engines/lab/engine.cpp index 13f3ae64de..2759f8a354 100644 --- a/engines/lab/engine.cpp +++ b/engines/lab/engine.cpp @@ -29,10 +29,12 @@ */ #include "lab/lab.h" + #include "lab/image.h" #include "lab/intro.h" #include "lab/labsets.h" #include "lab/music.h" +#include "lab/resource.h" #include "lab/utils.h" namespace Lab { diff --git a/engines/lab/image.cpp b/engines/lab/image.cpp index 29459b1fcc..2fac5a6d1a 100644 --- a/engines/lab/image.cpp +++ b/engines/lab/image.cpp @@ -28,6 +28,8 @@ * */ +#include "common/file.h" + #include "lab/lab.h" #include "lab/image.h" diff --git a/engines/lab/image.h b/engines/lab/image.h index 7f2c1ed5c5..0e2f831705 100644 --- a/engines/lab/image.h +++ b/engines/lab/image.h @@ -31,6 +31,10 @@ #ifndef LAB_IMAGE_H #define LAB_IMAGE_H +namespace Common { + class File; +} + namespace Lab { class Image { diff --git a/engines/lab/intro.cpp b/engines/lab/intro.cpp index 47dc6713a7..8e5986fbd9 100644 --- a/engines/lab/intro.cpp +++ b/engines/lab/intro.cpp @@ -29,8 +29,10 @@ */ #include "lab/lab.h" + #include "lab/intro.h" #include "lab/music.h" +#include "lab/resource.h" namespace Lab { Intro::Intro(LabEngine *vm) : _vm(vm) { diff --git a/engines/lab/lab.cpp b/engines/lab/lab.cpp index 04a689848d..5ce053a6ae 100644 --- a/engines/lab/lab.cpp +++ b/engines/lab/lab.cpp @@ -29,13 +29,16 @@ */ #include "common/debug-channels.h" +#include "common/error.h" #include "engines/util.h" #include "gui/message.h" #include "lab/lab.h" + #include "lab/music.h" #include "lab/image.h" +#include "lab/resource.h" #include "lab/utils.h" namespace Lab { diff --git a/engines/lab/lab.h b/engines/lab/lab.h index 7e5f33e236..7aaa548f0e 100644 --- a/engines/lab/lab.h +++ b/engines/lab/lab.h @@ -33,9 +33,6 @@ #include "common/system.h" #include "common/events.h" -#include "common/file.h" -#include "common/savefile.h" -#include "engines/savestate.h" #include "engines/engine.h" #include "lab/anim.h" @@ -43,15 +40,15 @@ #include "lab/interface.h" #include "lab/eventman.h" #include "lab/dispman.h" -#include "lab/resource.h" struct ADGameDescription; namespace Lab { +class LargeSet; class Music; +class Resource; class Utils; -class LargeSet; enum GameFeatures { GF_LOWRES = 1 << 0, diff --git a/engines/lab/labsets.cpp b/engines/lab/labsets.cpp index ca37a395cd..b19755e622 100644 --- a/engines/lab/labsets.cpp +++ b/engines/lab/labsets.cpp @@ -28,8 +28,12 @@ * */ +#include "common/file.h" + #include "lab/lab.h" + #include "lab/labsets.h" +#include "lab/resource.h" namespace Lab { diff --git a/engines/lab/map.cpp b/engines/lab/map.cpp index 7bcfd80df7..accd56d320 100644 --- a/engines/lab/map.cpp +++ b/engines/lab/map.cpp @@ -29,9 +29,11 @@ */ #include "lab/lab.h" + +#include "lab/image.h" #include "lab/labsets.h" #include "lab/music.h" -#include "lab/image.h" +#include "lab/resource.h" #include "lab/utils.h" namespace Lab { diff --git a/engines/lab/music.cpp b/engines/lab/music.cpp index de4ac8ee0c..722ec9959c 100644 --- a/engines/lab/music.cpp +++ b/engines/lab/music.cpp @@ -31,7 +31,9 @@ #include "audio/decoders/raw.h" #include "lab/lab.h" + #include "lab/music.h" +#include "lab/resource.h" namespace Lab { diff --git a/engines/lab/music.h b/engines/lab/music.h index d257d27462..5efd2e3045 100644 --- a/engines/lab/music.h +++ b/engines/lab/music.h @@ -31,6 +31,7 @@ #ifndef LAB_MUSIC_H #define LAB_MUSIC_H +#include "common/file.h" #include "audio/mixer.h" #include "audio/audiostream.h" diff --git a/engines/lab/processroom.cpp b/engines/lab/processroom.cpp index 472c0e477e..4df7e20528 100644 --- a/engines/lab/processroom.cpp +++ b/engines/lab/processroom.cpp @@ -31,8 +31,10 @@ #include "gui/message.h" #include "lab/lab.h" + #include "lab/labsets.h" #include "lab/music.h" +#include "lab/resource.h" #include "lab/utils.h" namespace Lab { diff --git a/engines/lab/resource.cpp b/engines/lab/resource.cpp index d21efaff01..65b14782ff 100644 --- a/engines/lab/resource.cpp +++ b/engines/lab/resource.cpp @@ -29,7 +29,9 @@ */ #include "lab/lab.h" + #include "lab/music.h" +#include "lab/resource.h" namespace Lab { diff --git a/engines/lab/savegame.cpp b/engines/lab/savegame.cpp index 244f119f59..13932788d8 100644 --- a/engines/lab/savegame.cpp +++ b/engines/lab/savegame.cpp @@ -29,6 +29,7 @@ */ #include "graphics/thumbnail.h" +#include "engines/savestate.h" #include "lab/lab.h" #include "lab/labsets.h" diff --git a/engines/lab/savegame.h b/engines/lab/savegame.h index 82f93e7a6a..608da99d47 100644 --- a/engines/lab/savegame.h +++ b/engines/lab/savegame.h @@ -31,6 +31,8 @@ #ifndef LAB_SAVEGAME_H #define LAB_SAVEGAME_H +#include "common/savefile.h" + namespace Lab { class LabEngine; diff --git a/engines/lab/special.cpp b/engines/lab/special.cpp index 274e9870d4..55825a734a 100644 --- a/engines/lab/special.cpp +++ b/engines/lab/special.cpp @@ -34,9 +34,11 @@ #include "gui/saveload.h" #include "lab/lab.h" + +#include "lab/image.h" #include "lab/labsets.h" #include "lab/music.h" -#include "lab/image.h" +#include "lab/resource.h" #include "lab/savegame.h" #include "lab/utils.h" diff --git a/engines/lab/tilepuzzle.cpp b/engines/lab/tilepuzzle.cpp index f989b1ab2e..bf435be348 100644 --- a/engines/lab/tilepuzzle.cpp +++ b/engines/lab/tilepuzzle.cpp @@ -31,8 +31,10 @@ #include "gui/message.h" #include "lab/lab.h" -#include "lab/labsets.h" + #include "lab/image.h" +#include "lab/labsets.h" +#include "lab/resource.h" #include "lab/utils.h" namespace Lab { diff --git a/engines/lab/utils.cpp b/engines/lab/utils.cpp index d5d0734268..b552a40675 100644 --- a/engines/lab/utils.cpp +++ b/engines/lab/utils.cpp @@ -28,6 +28,8 @@ * */ +#include "common/file.h" + #include "lab/lab.h" #include "lab/utils.h" -- cgit v1.2.3 From 66f2935a2282521f77062ad42d3308699f087cb5 Mon Sep 17 00:00:00 2001 From: Eugene Sandulenko Date: Tue, 8 Dec 2015 21:19:41 +0100 Subject: LAB: Reduced header dependency: dispman.h, eventman.h --- engines/lab/anim.cpp | 3 +++ engines/lab/dispman.cpp | 3 +++ engines/lab/engine.cpp | 2 ++ engines/lab/eventman.cpp | 3 +++ engines/lab/image.cpp | 2 ++ engines/lab/interface.cpp | 3 +++ engines/lab/intro.cpp | 1 + engines/lab/lab.cpp | 4 +++- engines/lab/lab.h | 6 ++++-- engines/lab/map.cpp | 2 ++ engines/lab/music.cpp | 1 + engines/lab/processroom.cpp | 1 + engines/lab/resource.cpp | 1 + engines/lab/savegame.cpp | 2 ++ engines/lab/special.cpp | 2 ++ engines/lab/tilepuzzle.cpp | 3 +++ engines/lab/transitions.cpp | 5 ++++- 17 files changed, 40 insertions(+), 4 deletions(-) diff --git a/engines/lab/anim.cpp b/engines/lab/anim.cpp index db8e8c614f..7411dcb794 100644 --- a/engines/lab/anim.cpp +++ b/engines/lab/anim.cpp @@ -29,6 +29,9 @@ */ #include "lab/lab.h" + +#include "lab/dispman.h" +#include "lab/eventman.h" #include "lab/music.h" #include "lab/utils.h" diff --git a/engines/lab/dispman.cpp b/engines/lab/dispman.cpp index ee9d5bc6a0..f78e55d8d9 100644 --- a/engines/lab/dispman.cpp +++ b/engines/lab/dispman.cpp @@ -31,6 +31,9 @@ #include "graphics/palette.h" #include "lab/lab.h" + +#include "lab/dispman.h" +#include "lab/eventman.h" #include "lab/music.h" #include "lab/image.h" #include "lab/resource.h" diff --git a/engines/lab/engine.cpp b/engines/lab/engine.cpp index 2759f8a354..af6d4c4ad1 100644 --- a/engines/lab/engine.cpp +++ b/engines/lab/engine.cpp @@ -30,6 +30,8 @@ #include "lab/lab.h" +#include "lab/dispman.h" +#include "lab/eventman.h" #include "lab/image.h" #include "lab/intro.h" #include "lab/labsets.h" diff --git a/engines/lab/eventman.cpp b/engines/lab/eventman.cpp index edc2588700..176f008bf1 100644 --- a/engines/lab/eventman.cpp +++ b/engines/lab/eventman.cpp @@ -29,6 +29,9 @@ */ #include "lab/lab.h" + +#include "lab/dispman.h" +#include "lab/eventman.h" #include "lab/image.h" namespace Lab { diff --git a/engines/lab/image.cpp b/engines/lab/image.cpp index 2fac5a6d1a..20c893dfd5 100644 --- a/engines/lab/image.cpp +++ b/engines/lab/image.cpp @@ -31,6 +31,8 @@ #include "common/file.h" #include "lab/lab.h" + +#include "lab/dispman.h" #include "lab/image.h" namespace Lab { diff --git a/engines/lab/interface.cpp b/engines/lab/interface.cpp index 62b0f80b2f..d56f485706 100644 --- a/engines/lab/interface.cpp +++ b/engines/lab/interface.cpp @@ -29,6 +29,9 @@ */ #include "lab/lab.h" + +#include "lab/dispman.h" +#include "lab/eventman.h" #include "lab/image.h" #include "lab/utils.h" diff --git a/engines/lab/intro.cpp b/engines/lab/intro.cpp index 8e5986fbd9..89e030ce1b 100644 --- a/engines/lab/intro.cpp +++ b/engines/lab/intro.cpp @@ -30,6 +30,7 @@ #include "lab/lab.h" +#include "lab/dispman.h" #include "lab/intro.h" #include "lab/music.h" #include "lab/resource.h" diff --git a/engines/lab/lab.cpp b/engines/lab/lab.cpp index 5ce053a6ae..dc77acb4f0 100644 --- a/engines/lab/lab.cpp +++ b/engines/lab/lab.cpp @@ -36,8 +36,10 @@ #include "lab/lab.h" -#include "lab/music.h" +#include "lab/dispman.h" +#include "lab/eventman.h" #include "lab/image.h" +#include "lab/music.h" #include "lab/resource.h" #include "lab/utils.h" diff --git a/engines/lab/lab.h b/engines/lab/lab.h index 7aaa548f0e..4d9cb7bd05 100644 --- a/engines/lab/lab.h +++ b/engines/lab/lab.h @@ -38,16 +38,18 @@ #include "lab/anim.h" #include "lab/processroom.h" #include "lab/interface.h" -#include "lab/eventman.h" -#include "lab/dispman.h" +//#include "lab/eventman.h" struct ADGameDescription; namespace Lab { +class DisplayMan; +class EventManager; class LargeSet; class Music; class Resource; +struct TextFont; class Utils; enum GameFeatures { diff --git a/engines/lab/map.cpp b/engines/lab/map.cpp index accd56d320..21763918ff 100644 --- a/engines/lab/map.cpp +++ b/engines/lab/map.cpp @@ -30,6 +30,8 @@ #include "lab/lab.h" +#include "lab/dispman.h" +#include "lab/eventman.h" #include "lab/image.h" #include "lab/labsets.h" #include "lab/music.h" diff --git a/engines/lab/music.cpp b/engines/lab/music.cpp index 722ec9959c..66963daf20 100644 --- a/engines/lab/music.cpp +++ b/engines/lab/music.cpp @@ -32,6 +32,7 @@ #include "lab/lab.h" +#include "lab/eventman.h" #include "lab/music.h" #include "lab/resource.h" diff --git a/engines/lab/processroom.cpp b/engines/lab/processroom.cpp index 4df7e20528..894bdeaa9a 100644 --- a/engines/lab/processroom.cpp +++ b/engines/lab/processroom.cpp @@ -32,6 +32,7 @@ #include "lab/lab.h" +#include "lab/dispman.h" #include "lab/labsets.h" #include "lab/music.h" #include "lab/resource.h" diff --git a/engines/lab/resource.cpp b/engines/lab/resource.cpp index 65b14782ff..6f5964f940 100644 --- a/engines/lab/resource.cpp +++ b/engines/lab/resource.cpp @@ -30,6 +30,7 @@ #include "lab/lab.h" +#include "lab/dispman.h" #include "lab/music.h" #include "lab/resource.h" diff --git a/engines/lab/savegame.cpp b/engines/lab/savegame.cpp index 13932788d8..1e2c8afc7b 100644 --- a/engines/lab/savegame.cpp +++ b/engines/lab/savegame.cpp @@ -32,6 +32,8 @@ #include "engines/savestate.h" #include "lab/lab.h" + +#include "lab/dispman.h" #include "lab/labsets.h" #include "lab/savegame.h" diff --git a/engines/lab/special.cpp b/engines/lab/special.cpp index 55825a734a..690dc293a3 100644 --- a/engines/lab/special.cpp +++ b/engines/lab/special.cpp @@ -35,6 +35,8 @@ #include "lab/lab.h" +#include "lab/dispman.h" +#include "lab/eventman.h" #include "lab/image.h" #include "lab/labsets.h" #include "lab/music.h" diff --git a/engines/lab/tilepuzzle.cpp b/engines/lab/tilepuzzle.cpp index bf435be348..c4e5da9f18 100644 --- a/engines/lab/tilepuzzle.cpp +++ b/engines/lab/tilepuzzle.cpp @@ -28,10 +28,13 @@ * */ +#include "common/file.h" + #include "gui/message.h" #include "lab/lab.h" +#include "lab/dispman.h" #include "lab/image.h" #include "lab/labsets.h" #include "lab/resource.h" diff --git a/engines/lab/transitions.cpp b/engines/lab/transitions.cpp index 89ce54f28d..cc0efb2d85 100644 --- a/engines/lab/transitions.cpp +++ b/engines/lab/transitions.cpp @@ -29,8 +29,11 @@ */ #include "lab/lab.h" -#include "lab/music.h" + +#include "lab/dispman.h" +#include "lab/eventman.h" #include "lab/image.h" +#include "lab/music.h" #include "lab/utils.h" namespace Lab { -- cgit v1.2.3 From 9015cf72a326e5bac2eeb311b257690a01d4bc26 Mon Sep 17 00:00:00 2001 From: Eugene Sandulenko Date: Tue, 8 Dec 2015 21:28:45 +0100 Subject: LAB: Reduced header dependency: interface.h --- engines/lab/anim.cpp | 1 + engines/lab/dispman.cpp | 2 ++ engines/lab/engine.cpp | 1 + engines/lab/eventman.cpp | 1 + engines/lab/interface.cpp | 1 + engines/lab/intro.cpp | 1 + engines/lab/lab.h | 6 ++++-- engines/lab/map.cpp | 1 + engines/lab/special.cpp | 1 + 9 files changed, 13 insertions(+), 2 deletions(-) diff --git a/engines/lab/anim.cpp b/engines/lab/anim.cpp index 7411dcb794..ac1ab3e3ef 100644 --- a/engines/lab/anim.cpp +++ b/engines/lab/anim.cpp @@ -30,6 +30,7 @@ #include "lab/lab.h" +#include "lab/anim.h" #include "lab/dispman.h" #include "lab/eventman.h" #include "lab/music.h" diff --git a/engines/lab/dispman.cpp b/engines/lab/dispman.cpp index f78e55d8d9..d3ad191f64 100644 --- a/engines/lab/dispman.cpp +++ b/engines/lab/dispman.cpp @@ -32,8 +32,10 @@ #include "lab/lab.h" +#include "lab/anim.h" #include "lab/dispman.h" #include "lab/eventman.h" +#include "lab/interface.h" #include "lab/music.h" #include "lab/image.h" #include "lab/resource.h" diff --git a/engines/lab/engine.cpp b/engines/lab/engine.cpp index af6d4c4ad1..a22c19ff17 100644 --- a/engines/lab/engine.cpp +++ b/engines/lab/engine.cpp @@ -33,6 +33,7 @@ #include "lab/dispman.h" #include "lab/eventman.h" #include "lab/image.h" +#include "lab/interface.h" #include "lab/intro.h" #include "lab/labsets.h" #include "lab/music.h" diff --git a/engines/lab/eventman.cpp b/engines/lab/eventman.cpp index 176f008bf1..967a6f0cee 100644 --- a/engines/lab/eventman.cpp +++ b/engines/lab/eventman.cpp @@ -33,6 +33,7 @@ #include "lab/dispman.h" #include "lab/eventman.h" #include "lab/image.h" +#include "lab/interface.h" namespace Lab { diff --git a/engines/lab/interface.cpp b/engines/lab/interface.cpp index d56f485706..41f7e37971 100644 --- a/engines/lab/interface.cpp +++ b/engines/lab/interface.cpp @@ -33,6 +33,7 @@ #include "lab/dispman.h" #include "lab/eventman.h" #include "lab/image.h" +#include "lab/interface.h" #include "lab/utils.h" namespace Lab { diff --git a/engines/lab/intro.cpp b/engines/lab/intro.cpp index 89e030ce1b..df575bde5f 100644 --- a/engines/lab/intro.cpp +++ b/engines/lab/intro.cpp @@ -31,6 +31,7 @@ #include "lab/lab.h" #include "lab/dispman.h" +#include "lab/interface.h" #include "lab/intro.h" #include "lab/music.h" #include "lab/resource.h" diff --git a/engines/lab/lab.h b/engines/lab/lab.h index 4d9cb7bd05..4031fe62f1 100644 --- a/engines/lab/lab.h +++ b/engines/lab/lab.h @@ -37,15 +37,17 @@ #include "engines/engine.h" #include "lab/anim.h" #include "lab/processroom.h" -#include "lab/interface.h" -//#include "lab/eventman.h" struct ADGameDescription; namespace Lab { +class Anim; class DisplayMan; class EventManager; +struct Gadget; +class Image; +struct IntuiMessage; class LargeSet; class Music; class Resource; diff --git a/engines/lab/map.cpp b/engines/lab/map.cpp index 21763918ff..cec9c4c334 100644 --- a/engines/lab/map.cpp +++ b/engines/lab/map.cpp @@ -33,6 +33,7 @@ #include "lab/dispman.h" #include "lab/eventman.h" #include "lab/image.h" +#include "lab/interface.h" #include "lab/labsets.h" #include "lab/music.h" #include "lab/resource.h" diff --git a/engines/lab/special.cpp b/engines/lab/special.cpp index 690dc293a3..24db6ce076 100644 --- a/engines/lab/special.cpp +++ b/engines/lab/special.cpp @@ -38,6 +38,7 @@ #include "lab/dispman.h" #include "lab/eventman.h" #include "lab/image.h" +#include "lab/interface.h" #include "lab/labsets.h" #include "lab/music.h" #include "lab/resource.h" -- cgit v1.2.3 From cf020db741294c54dab66a0ed652bdee565d44d5 Mon Sep 17 00:00:00 2001 From: Eugene Sandulenko Date: Tue, 8 Dec 2015 21:33:03 +0100 Subject: LAB: Converted DisplayMan::_dispBitMap to a pointer. --- engines/lab/anim.cpp | 22 +++++++++++----------- engines/lab/dispman.cpp | 25 ++++++++++++++----------- engines/lab/dispman.h | 3 ++- 3 files changed, 27 insertions(+), 23 deletions(-) diff --git a/engines/lab/anim.cpp b/engines/lab/anim.cpp index ac1ab3e3ef..5f7797493b 100644 --- a/engines/lab/anim.cpp +++ b/engines/lab/anim.cpp @@ -71,7 +71,7 @@ Anim::Anim(LabEngine *vm) : _vm(vm) { _doBlack = false; _diffWidth = 0; _diffHeight = 0; - DrawBitMap = &_vm->_graphics->_dispBitMap; + DrawBitMap = _vm->_graphics->_dispBitMap; for (int i = 0; i < 3 * 256; i++) _diffPalette[i] = 0; @@ -87,12 +87,12 @@ void Anim::diffNextFrame(bool onlyDiffData) { // Already done. return; - if (_vm->_graphics->_dispBitMap._flags & BITMAPF_VIDEO) { - _vm->_graphics->_dispBitMap._planes[0] = _vm->_graphics->getCurrentDrawingBuffer(); - _vm->_graphics->_dispBitMap._planes[1] = _vm->_graphics->_dispBitMap._planes[0] + 0x10000; - _vm->_graphics->_dispBitMap._planes[2] = _vm->_graphics->_dispBitMap._planes[1] + 0x10000; - _vm->_graphics->_dispBitMap._planes[3] = _vm->_graphics->_dispBitMap._planes[2] + 0x10000; - _vm->_graphics->_dispBitMap._planes[4] = _vm->_graphics->_dispBitMap._planes[3] + 0x10000; + if (_vm->_graphics->_dispBitMap->_flags & BITMAPF_VIDEO) { + _vm->_graphics->_dispBitMap->_planes[0] = _vm->_graphics->getCurrentDrawingBuffer(); + _vm->_graphics->_dispBitMap->_planes[1] = _vm->_graphics->_dispBitMap->_planes[0] + 0x10000; + _vm->_graphics->_dispBitMap->_planes[2] = _vm->_graphics->_dispBitMap->_planes[1] + 0x10000; + _vm->_graphics->_dispBitMap->_planes[3] = _vm->_graphics->_dispBitMap->_planes[2] + 0x10000; + _vm->_graphics->_dispBitMap->_planes[4] = _vm->_graphics->_dispBitMap->_planes[3] + 0x10000; } _vm->_event->mouseHide(); @@ -130,7 +130,7 @@ void Anim::diffNextFrame(bool onlyDiffData) { _isAnim = (_frameNum >= 3) && (!_playOnce); _curBit = 0; - if (_vm->_graphics->_dispBitMap._flags & BITMAPF_VIDEO) + if (_vm->_graphics->_dispBitMap->_flags & BITMAPF_VIDEO) _vm->_graphics->screenUpdate(); // done with the next frame. @@ -177,13 +177,13 @@ void Anim::diffNextFrame(bool onlyDiffData) { break; case 20L: - _vm->_utils->unDiff(DrawBitMap->_planes[_curBit], _vm->_graphics->_dispBitMap._planes[_curBit], _diffFile, DrawBitMap->_bytesPerRow, false); + _vm->_utils->unDiff(DrawBitMap->_planes[_curBit], _vm->_graphics->_dispBitMap->_planes[_curBit], _diffFile, DrawBitMap->_bytesPerRow, false); _curBit++; _diffFile += _size; break; case 21L: - _vm->_utils->unDiff(DrawBitMap->_planes[_curBit], _vm->_graphics->_dispBitMap._planes[_curBit], _diffFile, DrawBitMap->_bytesPerRow, true); + _vm->_utils->unDiff(DrawBitMap->_planes[_curBit], _vm->_graphics->_dispBitMap->_planes[_curBit], _diffFile, DrawBitMap->_bytesPerRow, true); _curBit++; _diffFile += _size; break; @@ -224,7 +224,7 @@ void Anim::diffNextFrame(bool onlyDiffData) { _vm->_music->updateMusic(); _vm->waitTOF(); - if (_vm->_graphics->_dispBitMap._flags & BITMAPF_VIDEO) + if (_vm->_graphics->_dispBitMap->_flags & BITMAPF_VIDEO) didTOF = true; } } diff --git a/engines/lab/dispman.cpp b/engines/lab/dispman.cpp index d3ad191f64..df42f173ef 100644 --- a/engines/lab/dispman.cpp +++ b/engines/lab/dispman.cpp @@ -61,10 +61,13 @@ DisplayMan::DisplayMan(LabEngine *vm) : _vm(vm) { for (int i = 0; i < 256 * 3; i++) _curvgapal[i] = 0; + + _dispBitMap = new BitMap; } DisplayMan::~DisplayMan() { freePict(); + delete _dispBitMap; } // From readPict.c. Reads in pictures and animations from disk. @@ -90,9 +93,9 @@ void DisplayMan::readPict(const char *filename, bool playOnce, bool onlyDiffData if (!_vm->_music->_doNotFilestopSoundEffect) _vm->_music->stopSoundEffect(); - _dispBitMap._bytesPerRow = _screenWidth; - _dispBitMap._rows = _screenHeight; - _dispBitMap._flags = BITMAPF_VIDEO; + _dispBitMap->_bytesPerRow = _screenWidth; + _dispBitMap->_rows = _screenHeight; + _dispBitMap->_flags = BITMAPF_VIDEO; _vm->_anim->readDiff(_curBitmap, playOnce, onlyDiffData); } @@ -110,14 +113,14 @@ byte *DisplayMan::readPictToMem(const char *filename, uint16 x, uint16 y) { if (!_vm->_music->_doNotFilestopSoundEffect) _vm->_music->stopSoundEffect(); - _dispBitMap._bytesPerRow = x; - _dispBitMap._rows = y; - _dispBitMap._flags = BITMAPF_NONE; - _dispBitMap._planes[0] = _curBitmap; - _dispBitMap._planes[1] = _dispBitMap._planes[0] + 0x10000; - _dispBitMap._planes[2] = _dispBitMap._planes[1] + 0x10000; - _dispBitMap._planes[3] = _dispBitMap._planes[2] + 0x10000; - _dispBitMap._planes[4] = _dispBitMap._planes[3] + 0x10000; + _dispBitMap->_bytesPerRow = x; + _dispBitMap->_rows = y; + _dispBitMap->_flags = BITMAPF_NONE; + _dispBitMap->_planes[0] = _curBitmap; + _dispBitMap->_planes[1] = _dispBitMap->_planes[0] + 0x10000; + _dispBitMap->_planes[2] = _dispBitMap->_planes[1] + 0x10000; + _dispBitMap->_planes[3] = _dispBitMap->_planes[2] + 0x10000; + _dispBitMap->_planes[4] = _dispBitMap->_planes[3] + 0x10000; _vm->_anim->readDiff(_curBitmap, true); diff --git a/engines/lab/dispman.h b/engines/lab/dispman.h index a04d142f8d..5ce4923ec4 100644 --- a/engines/lab/dispman.h +++ b/engines/lab/dispman.h @@ -33,6 +33,7 @@ namespace Lab { +struct BitMap; class LabEngine; class Image; @@ -158,7 +159,7 @@ public: byte *_currentDisplayBuffer; bool _doNotDrawMessage; uint16 *FadePalette; - BitMap _dispBitMap; + BitMap *_dispBitMap; }; } // End of namespace Lab -- cgit v1.2.3 From 9af853b6ab7c998910d2212206fab1a14c8b5818 Mon Sep 17 00:00:00 2001 From: Eugene Sandulenko Date: Tue, 8 Dec 2015 21:35:31 +0100 Subject: LAB: Reduced last reducable header: anim.h --- engines/lab/engine.cpp | 1 + engines/lab/intro.cpp | 1 + engines/lab/lab.cpp | 1 + engines/lab/lab.h | 1 - engines/lab/music.cpp | 1 + engines/lab/processroom.cpp | 1 + engines/lab/special.cpp | 1 + engines/lab/tilepuzzle.cpp | 1 + engines/lab/transitions.cpp | 1 + 9 files changed, 8 insertions(+), 1 deletion(-) diff --git a/engines/lab/engine.cpp b/engines/lab/engine.cpp index a22c19ff17..b7f69e46e6 100644 --- a/engines/lab/engine.cpp +++ b/engines/lab/engine.cpp @@ -30,6 +30,7 @@ #include "lab/lab.h" +#include "lab/anim.h" #include "lab/dispman.h" #include "lab/eventman.h" #include "lab/image.h" diff --git a/engines/lab/intro.cpp b/engines/lab/intro.cpp index df575bde5f..4518a27eef 100644 --- a/engines/lab/intro.cpp +++ b/engines/lab/intro.cpp @@ -30,6 +30,7 @@ #include "lab/lab.h" +#include "lab/anim.h" #include "lab/dispman.h" #include "lab/interface.h" #include "lab/intro.h" diff --git a/engines/lab/lab.cpp b/engines/lab/lab.cpp index dc77acb4f0..ff4a2904ac 100644 --- a/engines/lab/lab.cpp +++ b/engines/lab/lab.cpp @@ -36,6 +36,7 @@ #include "lab/lab.h" +#include "lab/anim.h" #include "lab/dispman.h" #include "lab/eventman.h" #include "lab/image.h" diff --git a/engines/lab/lab.h b/engines/lab/lab.h index 4031fe62f1..fb23bcc03a 100644 --- a/engines/lab/lab.h +++ b/engines/lab/lab.h @@ -35,7 +35,6 @@ #include "common/events.h" #include "engines/engine.h" -#include "lab/anim.h" #include "lab/processroom.h" struct ADGameDescription; diff --git a/engines/lab/music.cpp b/engines/lab/music.cpp index 66963daf20..feddea5895 100644 --- a/engines/lab/music.cpp +++ b/engines/lab/music.cpp @@ -32,6 +32,7 @@ #include "lab/lab.h" +#include "lab/anim.h" #include "lab/eventman.h" #include "lab/music.h" #include "lab/resource.h" diff --git a/engines/lab/processroom.cpp b/engines/lab/processroom.cpp index 894bdeaa9a..7f0197080f 100644 --- a/engines/lab/processroom.cpp +++ b/engines/lab/processroom.cpp @@ -32,6 +32,7 @@ #include "lab/lab.h" +#include "lab/anim.h" #include "lab/dispman.h" #include "lab/labsets.h" #include "lab/music.h" diff --git a/engines/lab/special.cpp b/engines/lab/special.cpp index 24db6ce076..3578a650b6 100644 --- a/engines/lab/special.cpp +++ b/engines/lab/special.cpp @@ -35,6 +35,7 @@ #include "lab/lab.h" +#include "lab/anim.h" #include "lab/dispman.h" #include "lab/eventman.h" #include "lab/image.h" diff --git a/engines/lab/tilepuzzle.cpp b/engines/lab/tilepuzzle.cpp index c4e5da9f18..db3027765b 100644 --- a/engines/lab/tilepuzzle.cpp +++ b/engines/lab/tilepuzzle.cpp @@ -34,6 +34,7 @@ #include "lab/lab.h" +#include "lab/anim.h" #include "lab/dispman.h" #include "lab/image.h" #include "lab/labsets.h" diff --git a/engines/lab/transitions.cpp b/engines/lab/transitions.cpp index cc0efb2d85..b2f07fc60b 100644 --- a/engines/lab/transitions.cpp +++ b/engines/lab/transitions.cpp @@ -30,6 +30,7 @@ #include "lab/lab.h" +#include "lab/anim.h" #include "lab/dispman.h" #include "lab/eventman.h" #include "lab/image.h" -- cgit v1.2.3 From c062dee369216f9ce5573e8a98334aef25a72117 Mon Sep 17 00:00:00 2001 From: Eugene Sandulenko Date: Tue, 8 Dec 2015 21:39:30 +0100 Subject: LAB: Optimized dependency on common headers --- engines/lab/eventman.cpp | 2 ++ engines/lab/interface.cpp | 2 ++ engines/lab/lab.h | 2 +- 3 files changed, 5 insertions(+), 1 deletion(-) diff --git a/engines/lab/eventman.cpp b/engines/lab/eventman.cpp index 967a6f0cee..967596c5fc 100644 --- a/engines/lab/eventman.cpp +++ b/engines/lab/eventman.cpp @@ -28,6 +28,8 @@ * */ +#include "common/events.h" + #include "lab/lab.h" #include "lab/dispman.h" diff --git a/engines/lab/interface.cpp b/engines/lab/interface.cpp index 41f7e37971..0ccbd48fec 100644 --- a/engines/lab/interface.cpp +++ b/engines/lab/interface.cpp @@ -28,6 +28,8 @@ * */ +#include "common/events.h" + #include "lab/lab.h" #include "lab/dispman.h" diff --git a/engines/lab/lab.h b/engines/lab/lab.h index fb23bcc03a..2fd60c73e7 100644 --- a/engines/lab/lab.h +++ b/engines/lab/lab.h @@ -32,7 +32,7 @@ #define LAB_H #include "common/system.h" -#include "common/events.h" +#include "common/rect.h" #include "engines/engine.h" #include "lab/processroom.h" -- cgit v1.2.3 From e5f753749fc55beb0d48180d1d649fc81412182c Mon Sep 17 00:00:00 2001 From: Eugene Sandulenko Date: Tue, 8 Dec 2015 21:47:36 +0100 Subject: LAB: Reduced dependency on processroom.h. Yay! --- engines/lab/engine.cpp | 1 + engines/lab/lab.cpp | 1 + engines/lab/lab.h | 9 ++++++++- engines/lab/map.cpp | 1 + engines/lab/processroom.cpp | 1 + engines/lab/processroom.h | 4 ---- engines/lab/resource.cpp | 1 + engines/lab/resource.h | 2 ++ engines/lab/special.cpp | 1 + 9 files changed, 16 insertions(+), 5 deletions(-) diff --git a/engines/lab/engine.cpp b/engines/lab/engine.cpp index b7f69e46e6..46e60dc4e5 100644 --- a/engines/lab/engine.cpp +++ b/engines/lab/engine.cpp @@ -38,6 +38,7 @@ #include "lab/intro.h" #include "lab/labsets.h" #include "lab/music.h" +#include "lab/processroom.h" #include "lab/resource.h" #include "lab/utils.h" diff --git a/engines/lab/lab.cpp b/engines/lab/lab.cpp index ff4a2904ac..4bf9aa3155 100644 --- a/engines/lab/lab.cpp +++ b/engines/lab/lab.cpp @@ -41,6 +41,7 @@ #include "lab/eventman.h" #include "lab/image.h" #include "lab/music.h" +#include "lab/processroom.h" #include "lab/resource.h" #include "lab/utils.h" diff --git a/engines/lab/lab.h b/engines/lab/lab.h index 2fd60c73e7..2cbea65269 100644 --- a/engines/lab/lab.h +++ b/engines/lab/lab.h @@ -35,21 +35,25 @@ #include "common/rect.h" #include "engines/engine.h" -#include "lab/processroom.h" struct ADGameDescription; namespace Lab { +struct Action; class Anim; +struct CloseData; class DisplayMan; class EventManager; struct Gadget; class Image; struct IntuiMessage; +struct InventoryData; class LargeSet; class Music; class Resource; +struct RoomData; +struct Rule; struct TextFont; class Utils; @@ -75,6 +79,9 @@ struct CrumbData { #define MAX_CRUMBS 128 +typedef CloseData *CloseDataPtr; +typedef Common::List RuleList; + // Direction defines #define NORTH 0 #define SOUTH 1 diff --git a/engines/lab/map.cpp b/engines/lab/map.cpp index cec9c4c334..af61c85738 100644 --- a/engines/lab/map.cpp +++ b/engines/lab/map.cpp @@ -36,6 +36,7 @@ #include "lab/interface.h" #include "lab/labsets.h" #include "lab/music.h" +#include "lab/processroom.h" #include "lab/resource.h" #include "lab/utils.h" diff --git a/engines/lab/processroom.cpp b/engines/lab/processroom.cpp index 7f0197080f..31a4cdd4e4 100644 --- a/engines/lab/processroom.cpp +++ b/engines/lab/processroom.cpp @@ -36,6 +36,7 @@ #include "lab/dispman.h" #include "lab/labsets.h" #include "lab/music.h" +#include "lab/processroom.h" #include "lab/resource.h" #include "lab/utils.h" diff --git a/engines/lab/processroom.h b/engines/lab/processroom.h index fae4c2f0a9..cf2f8df019 100644 --- a/engines/lab/processroom.h +++ b/engines/lab/processroom.h @@ -101,8 +101,6 @@ typedef struct CloseData { CloseData *_subCloseUps; } CloseData; -typedef CloseData *CloseDataPtr; - struct ViewData { int16 *_condition; char *_graphicName; @@ -128,8 +126,6 @@ struct Rule { Rule *_nextRule; }; -typedef Common::List RuleList; - struct RoomData { uint16 _northDoor; uint16 _southDoor; diff --git a/engines/lab/resource.cpp b/engines/lab/resource.cpp index 6f5964f940..281f9a22cc 100644 --- a/engines/lab/resource.cpp +++ b/engines/lab/resource.cpp @@ -32,6 +32,7 @@ #include "lab/dispman.h" #include "lab/music.h" +#include "lab/processroom.h" #include "lab/resource.h" namespace Lab { diff --git a/engines/lab/resource.h b/engines/lab/resource.h index 89303e1a66..2273d79d70 100644 --- a/engines/lab/resource.h +++ b/engines/lab/resource.h @@ -33,6 +33,8 @@ namespace Lab { +struct ViewData; + enum StaticText { kTextLowerFloor, kTextMiddleFloor, diff --git a/engines/lab/special.cpp b/engines/lab/special.cpp index 3578a650b6..8bb57adfed 100644 --- a/engines/lab/special.cpp +++ b/engines/lab/special.cpp @@ -42,6 +42,7 @@ #include "lab/interface.h" #include "lab/labsets.h" #include "lab/music.h" +#include "lab/processroom.h" #include "lab/resource.h" #include "lab/savegame.h" #include "lab/utils.h" -- cgit v1.2.3 From c1fc1687fc4fb271871a9c02c4cb3ffe2c00d158 Mon Sep 17 00:00:00 2001 From: Eugene Sandulenko Date: Tue, 8 Dec 2015 21:53:42 +0100 Subject: LAB: Code naming standards --- engines/lab/engine.cpp | 27 ++++++++++++++------------- engines/lab/lab.h | 3 ++- 2 files changed, 16 insertions(+), 14 deletions(-) diff --git a/engines/lab/engine.cpp b/engines/lab/engine.cpp index 46e60dc4e5..57383ec6dd 100644 --- a/engines/lab/engine.cpp +++ b/engines/lab/engine.cpp @@ -560,16 +560,17 @@ void LabEngine::mainGameLoop() { } } -bool LabEngine::from_crumbs(uint32 tmpClass, uint16 code, uint16 Qualifier, Common::Point tmpPos, uint16 &curInv, IntuiMessage *curMsg, bool &forceDraw, uint16 gadgetId, uint16 &actionMode) { +bool LabEngine::from_crumbs(uint32 tmpClass, uint16 code, uint16 qualifier, Common::Point tmpPos, + uint16 &curInv, IntuiMessage *curMsg, bool &forceDraw, uint16 gadgetId, uint16 &actionMode) { uint32 msgClass = tmpClass; Common::Point curPos = tmpPos; uint16 oldDirection = 0; uint16 lastInv = MAPNUM; CloseDataPtr oldcptr, tempcptr, hcptr = nullptr; - ViewData *VPtr; + ViewData *vptr; bool doit; - uint16 NewDir; + uint16 newDir; _anim->_doBlack = false; @@ -577,7 +578,7 @@ bool LabEngine::from_crumbs(uint32 tmpClass, uint16 code, uint16 Qualifier, Comm if (code == 13) { // The return key msgClass = MOUSEBUTTONS; - Qualifier = IEQUALIFIER_LEFTBUTTON; + qualifier = IEQUALIFIER_LEFTBUTTON; curPos = _event->getMousePos(); } else if (getPlatform() == Common::kPlatformWindows && (code == 'b' || code == 'B')) { // Start bread crumbs @@ -669,8 +670,8 @@ bool LabEngine::from_crumbs(uint32 tmpClass, uint16 code, uint16 Qualifier, Comm if (_graphics->_longWinInFront) { if ((msgClass == RAWKEY) || ((msgClass == MOUSEBUTTONS) && - ((IEQUALIFIER_LEFTBUTTON & Qualifier) || - (IEQUALIFIER_RBUTTON & Qualifier)))) { + ((IEQUALIFIER_LEFTBUTTON & qualifier) || + (IEQUALIFIER_RBUTTON & qualifier)))) { _graphics->_longWinInFront = false; _graphics->_doNotDrawMessage = false; _graphics->drawPanel(); @@ -741,10 +742,10 @@ bool LabEngine::from_crumbs(uint32 tmpClass, uint16 code, uint16 Qualifier, Comm oldDirection = _direction; - NewDir = processArrow(_direction, gadgetId - 6); - doTurn(_direction, NewDir, &_cptr); + newDir = processArrow(_direction, gadgetId - 6); + doTurn(_direction, newDir, &_cptr); _anim->_doBlack = true; - _direction = NewDir; + _direction = newDir; forceDraw = true; mayShowCrumbIndicator(); @@ -941,7 +942,7 @@ bool LabEngine::from_crumbs(uint32 tmpClass, uint16 code, uint16 Qualifier, Comm } } } - } else if ((msgClass == MOUSEBUTTONS) && (IEQUALIFIER_LEFTBUTTON & Qualifier) && _mainDisplay) { + } else if ((msgClass == MOUSEBUTTONS) && (IEQUALIFIER_LEFTBUTTON & qualifier) && _mainDisplay) { interfaceOff(); _mainDisplay = true; @@ -1014,8 +1015,8 @@ bool LabEngine::from_crumbs(uint32 tmpClass, uint16 code, uint16 Qualifier, Comm mayShowCrumbIndicator(); _graphics->screenUpdate(); } else if (msgClass == DELTAMOVE) { - VPtr = getViewData(_roomNum, _direction); - oldcptr = VPtr->_closeUps; + vptr = getViewData(_roomNum, _direction); + oldcptr = vptr->_closeUps; if (hcptr == NULL) { tempcptr = _cptr; @@ -1041,7 +1042,7 @@ bool LabEngine::from_crumbs(uint32 tmpClass, uint16 code, uint16 Qualifier, Comm if (hcptr) _event->setMousePos(Common::Point(_utils->scaleX((hcptr->x1 + hcptr->x2) / 2), _utils->scaleY((hcptr->y1 + hcptr->y2) / 2))); - } else if ((msgClass == MOUSEBUTTONS) && (IEQUALIFIER_RBUTTON & Qualifier)) { + } else if ((msgClass == MOUSEBUTTONS) && (IEQUALIFIER_RBUTTON & qualifier)) { eatMessages(); _alternate = !_alternate; _anim->_doBlack = true; diff --git a/engines/lab/lab.h b/engines/lab/lab.h index 2cbea65269..a1a5bb0617 100644 --- a/engines/lab/lab.h +++ b/engines/lab/lab.h @@ -169,7 +169,8 @@ private: GadgetList _mapGadgetList; private: - bool from_crumbs(uint32 tmpClass, uint16 code, uint16 Qualifier, Common::Point tmpPos, uint16 &curInv, IntuiMessage * curMsg, bool &forceDraw, uint16 gadgetId, uint16 &actionMode); + bool from_crumbs(uint32 tmpClass, uint16 code, uint16 qualifier, Common::Point tmpPos, + uint16 &curInv, IntuiMessage *curMsg, bool &forceDraw, uint16 gadgetId, uint16 &actionMode); public: void waitTOF(); -- cgit v1.2.3 From 23bbd70aac37e36f6863da3326704e10fdcfb1a9 Mon Sep 17 00:00:00 2001 From: Eugene Sandulenko Date: Tue, 8 Dec 2015 22:00:19 +0100 Subject: LAB: Reduced variables scope --- engines/lab/engine.cpp | 19 +++++++------------ 1 file changed, 7 insertions(+), 12 deletions(-) diff --git a/engines/lab/engine.cpp b/engines/lab/engine.cpp index 57383ec6dd..0b353b521e 100644 --- a/engines/lab/engine.cpp +++ b/engines/lab/engine.cpp @@ -44,9 +44,6 @@ namespace Lab { -// Global parser data -bool ispal = false; - // LAB: Labyrinth specific code for the special puzzles #define SPECIALLOCK 100 #define SPECIALBRICK 101 @@ -89,7 +86,7 @@ static char initcolors[] = { '\x00', '\x00', '\x00', '\x30', '\x10', '\x14', '\x14', '\x14', '\x20', '\x20', '\x20', '\x24', '\x24', '\x24', '\x2c', '\x2c', - '\x2c', '\x08', '\x08', '\x08'}; + '\x2c', '\x08', '\x08', '\x08' }; /** * Draws the message for the room. @@ -567,10 +564,8 @@ bool LabEngine::from_crumbs(uint32 tmpClass, uint16 code, uint16 qualifier, Comm uint16 oldDirection = 0; uint16 lastInv = MAPNUM; - CloseDataPtr oldcptr, tempcptr, hcptr = nullptr; - ViewData *vptr; + CloseDataPtr hcptr = nullptr; bool doit; - uint16 newDir; _anim->_doBlack = false; @@ -742,7 +737,7 @@ bool LabEngine::from_crumbs(uint32 tmpClass, uint16 code, uint16 qualifier, Comm oldDirection = _direction; - newDir = processArrow(_direction, gadgetId - 6); + uint16 newDir = processArrow(_direction, gadgetId - 6); doTurn(_direction, newDir, &_cptr); _anim->_doBlack = true; _direction = newDir; @@ -986,7 +981,7 @@ bool LabEngine::from_crumbs(uint32 tmpClass, uint16 code, uint16 qualifier, Comm } } else if (actionMode == 4) { // Look at closeups - tempcptr = _cptr; + CloseDataPtr tempcptr = _cptr; setCurClose(curPos, &tempcptr); if (_cptr == tempcptr) { @@ -1015,11 +1010,11 @@ bool LabEngine::from_crumbs(uint32 tmpClass, uint16 code, uint16 qualifier, Comm mayShowCrumbIndicator(); _graphics->screenUpdate(); } else if (msgClass == DELTAMOVE) { - vptr = getViewData(_roomNum, _direction); - oldcptr = vptr->_closeUps; + ViewData *vptr = getViewData(_roomNum, _direction); + CloseDataPtr oldcptr = vptr->_closeUps; if (hcptr == NULL) { - tempcptr = _cptr; + CloseDataPtr tempcptr = _cptr; setCurClose(curPos, &tempcptr); if ((tempcptr == NULL) || (tempcptr == _cptr)) { -- cgit v1.2.3 From f137e1af151e0c3838bd5182022e5293468da03f Mon Sep 17 00:00:00 2001 From: Filippos Karapetis Date: Wed, 9 Dec 2015 01:41:51 +0200 Subject: LAB: Use a local buffer for moving tiles in the tile puzzle This fixes the crash when a tile is moved --- engines/lab/dispman.cpp | 1 - engines/lab/dispman.h | 5 ++--- engines/lab/lab.h | 2 +- engines/lab/tilepuzzle.cpp | 20 ++++++++++++++------ engines/lab/transitions.cpp | 8 ++++---- 5 files changed, 21 insertions(+), 15 deletions(-) diff --git a/engines/lab/dispman.cpp b/engines/lab/dispman.cpp index df42f173ef..199c9e04c8 100644 --- a/engines/lab/dispman.cpp +++ b/engines/lab/dispman.cpp @@ -53,7 +53,6 @@ DisplayMan::DisplayMan(LabEngine *vm) : _vm(vm) { _curBitmap = nullptr; _displayBuffer = nullptr; _currentDisplayBuffer = nullptr; - _tempScrollData = nullptr; FadePalette = nullptr; _screenWidth = 0; diff --git a/engines/lab/dispman.h b/engines/lab/dispman.h index 5ce4923ec4..dbeeefc1c1 100644 --- a/engines/lab/dispman.h +++ b/engines/lab/dispman.h @@ -66,7 +66,6 @@ private: byte _curapen; byte *_curBitmap; byte _curvgapal[256 * 3]; - byte *_tempScrollData; public: DisplayMan(LabEngine *lab); @@ -141,8 +140,8 @@ public: void setPalette(void *cmap, uint16 numcolors); void overlayRect(uint16 pencolor, uint16 x1, uint16 y1, uint16 x2, uint16 y2); byte *getCurrentDrawingBuffer(); - void scrollDisplayX(int16 dx, uint16 x1, uint16 y1, uint16 x2, uint16 y2); - void scrollDisplayY(int16 dy, uint16 x1, uint16 y1, uint16 x2, uint16 y2); + void scrollDisplayX(int16 dx, uint16 x1, uint16 y1, uint16 x2, uint16 y2, byte *buffer); + void scrollDisplayY(int16 dy, uint16 x1, uint16 y1, uint16 x2, uint16 y2, byte *buffer); void fade(bool fadein, uint16 res); void closeFont(TextFont *tf); uint16 textLength(TextFont *tf, const char *text, uint16 numchars); diff --git a/engines/lab/lab.h b/engines/lab/lab.h index a1a5bb0617..ac27c94d93 100644 --- a/engines/lab/lab.h +++ b/engines/lab/lab.h @@ -219,7 +219,7 @@ private: void showTile(const char *filename, bool showsolution); void doTileScroll(uint16 col, uint16 row, uint16 scrolltype); void changeCombination(uint16 number); - void scrollRaster(int16 dx, int16 dy, uint16 x1, uint16 y1, uint16 x2, uint16 y2); + void scrollRaster(int16 dx, int16 dy, uint16 x1, uint16 y1, uint16 x2, uint16 y2, byte *buffer); void doCombination(); void showCombination(const char *filename); void initTilePuzzle(); diff --git a/engines/lab/tilepuzzle.cpp b/engines/lab/tilepuzzle.cpp index db3027765b..652c633c61 100644 --- a/engines/lab/tilepuzzle.cpp +++ b/engines/lab/tilepuzzle.cpp @@ -281,19 +281,23 @@ void LabEngine::doTileScroll(uint16 col, uint16 row, uint16 scrolltype) { uint16 x1 = _utils->vgaScaleX(100) + (col * _utils->vgaScaleX(30)) + dx; uint16 y1 = _utils->vgaScaleY(25) + (row * _utils->vgaScaleY(25)) + dy; + byte *buffer = new byte[_tiles[1]->_width * _tiles[1]->_height * 2L]; + for (uint16 i = 0; i < last; i++) { waitTOF(); - scrollRaster(dX, dY, x1, y1, x1 + _utils->vgaScaleX(28) + sx, y1 + _utils->vgaScaleY(23) + sy); + scrollRaster(dX, dY, x1, y1, x1 + _utils->vgaScaleX(28) + sx, y1 + _utils->vgaScaleY(23) + sy, buffer); x1 += dX; y1 += dY; } + + delete[] buffer; } /** * Changes the combination number of one of the slots */ void LabEngine::changeCombination(uint16 number) { - static const int solution[6] = { 0, 4, 0, 8, 7, 2 }; + const int solution[6] = { 0, 4, 0, 8, 7, 2 }; Image display; uint16 combnum; @@ -310,6 +314,8 @@ void LabEngine::changeCombination(uint16 number) { display._width = _graphics->_screenWidth; display._height = _graphics->_screenHeight; + byte *buffer = new byte[_tiles[1]->_width * _tiles[1]->_height * 2L]; + for (uint16 i = 1; i <= (_numberImages[combnum]->_height / 2); i++) { if (_isHiRes) { if (i & 1) @@ -318,10 +324,12 @@ void LabEngine::changeCombination(uint16 number) { waitTOF(); display._imageData = _graphics->getCurrentDrawingBuffer(); - _graphics->scrollDisplayY(2, _utils->vgaScaleX(COMBINATION_X[number]), _utils->vgaScaleY(65), _utils->vgaScaleX(COMBINATION_X[number]) + (_numberImages[combnum])->_width - 1, _utils->vgaScaleY(65) + (_numberImages[combnum])->_height); + _graphics->scrollDisplayY(2, _utils->vgaScaleX(COMBINATION_X[number]), _utils->vgaScaleY(65), _utils->vgaScaleX(COMBINATION_X[number]) + (_numberImages[combnum])->_width - 1, _utils->vgaScaleY(65) + (_numberImages[combnum])->_height, buffer); _numberImages[combnum]->blitBitmap(0, (_numberImages[combnum])->_height - (2 * i), &(display), _utils->vgaScaleX(COMBINATION_X[number]), _utils->vgaScaleY(65), (_numberImages[combnum])->_width, 2, false); } + delete[] buffer; + for (uint16 i = 0; i < 6; i++) unlocked &= (_combination[i] == solution[i]); @@ -331,12 +339,12 @@ void LabEngine::changeCombination(uint16 number) { _conditions->exclElement(COMBINATIONUNLOCKED); } -void LabEngine::scrollRaster(int16 dx, int16 dy, uint16 x1, uint16 y1, uint16 x2, uint16 y2) { +void LabEngine::scrollRaster(int16 dx, int16 dy, uint16 x1, uint16 y1, uint16 x2, uint16 y2, byte *buffer) { if (dx) - _graphics->scrollDisplayX(dx, x1, y1, x2, y2); + _graphics->scrollDisplayX(dx, x1, y1, x2, y2, buffer); if (dy) - _graphics->scrollDisplayY(dy, x1, y1, x2, y2); + _graphics->scrollDisplayY(dy, x1, y1, x2, y2, buffer); } /** diff --git a/engines/lab/transitions.cpp b/engines/lab/transitions.cpp index b2f07fc60b..7c0b99dc53 100644 --- a/engines/lab/transitions.cpp +++ b/engines/lab/transitions.cpp @@ -387,10 +387,10 @@ void DisplayMan::blackAllScreen() { * The _tempScrollData variable must be initialized to some memory, or this * function will fail. */ -void DisplayMan::scrollDisplayX(int16 dx, uint16 x1, uint16 y1, uint16 x2, uint16 y2) { +void DisplayMan::scrollDisplayX(int16 dx, uint16 x1, uint16 y1, uint16 x2, uint16 y2, byte *buffer) { Image im; - im._imageData = _tempScrollData; + im._imageData = buffer; if (x1 > x2) SWAP(x1, x2); @@ -411,10 +411,10 @@ void DisplayMan::scrollDisplayX(int16 dx, uint16 x1, uint16 y1, uint16 x2, uint1 /** * Scrolls the display in the y direction by blitting. */ -void DisplayMan::scrollDisplayY(int16 dy, uint16 x1, uint16 y1, uint16 x2, uint16 y2) { +void DisplayMan::scrollDisplayY(int16 dy, uint16 x1, uint16 y1, uint16 x2, uint16 y2, byte *buffer) { Image im; - im._imageData = _tempScrollData; + im._imageData = buffer; if (x1 > x2) SWAP(x1, x2); -- cgit v1.2.3 From 23f73c32440b8ff638920f214e3d8f0a75aafd70 Mon Sep 17 00:00:00 2001 From: Filippos Karapetis Date: Wed, 9 Dec 2015 01:43:44 +0200 Subject: LAB: Fix regression when scrolling tiles A regression of 28991ed1224ed3d0dbaf345a065a0bf79fa70ea9 --- engines/lab/transitions.cpp | 46 +++++++++++++++++++++++++++++++++------------ 1 file changed, 34 insertions(+), 12 deletions(-) diff --git a/engines/lab/transitions.cpp b/engines/lab/transitions.cpp index 7c0b99dc53..df3c777924 100644 --- a/engines/lab/transitions.cpp +++ b/engines/lab/transitions.cpp @@ -398,14 +398,25 @@ void DisplayMan::scrollDisplayX(int16 dx, uint16 x1, uint16 y1, uint16 x2, uint1 if (y1 > y2) SWAP(y1, y2); - im._width = x2 - x1 + 1 - dx; - im._height = y2 - y1 + 1; + if (dx > 0) { + im._width = x2 - x1 + 1 - dx; + im._height = y2 - y1 + 1; - im.readScreenImage(x1, y1); - im.drawImage(x1 + dx, y1); + im.readScreenImage(x1, y1); + im.drawImage(x1 + dx, y1); - setAPen(0); - rectFill(x1, y1, x1 + dx - 1, y2); + setAPen(0); + rectFill(x1, y1, x1 + dx - 1, y2); + } else if (dx < 0) { + im._width = x2 - x1 + 1 + dx; + im._height = y2 - y1 + 1; + + im.readScreenImage(x1 - dx, y1); + im.drawImage(x1, y1); + + setAPen(0); + rectFill(x2 + dx + 1, y1, x2, y2); + } } /** @@ -422,14 +433,25 @@ void DisplayMan::scrollDisplayY(int16 dy, uint16 x1, uint16 y1, uint16 x2, uint1 if (y1 > y2) SWAP(y1, y2); - im._width = x2 - x1 + 1; - im._height = y2 - y1 + 1 - dy; + if (dy > 0) { + im._width = x2 - x1 + 1; + im._height = y2 - y1 + 1 - dy; - im.readScreenImage(x1, y1); - im.drawImage(x1, y1 + dy); + im.readScreenImage(x1, y1); + im.drawImage(x1, y1 + dy); - setAPen(0); - rectFill(x1, y1, x2, y1 + dy - 1); + setAPen(0); + rectFill(x1, y1, x2, y1 + dy - 1); + } else if (dy < 0) { + im._width = x2 - x1 + 1; + im._height = y2 - y1 + 1 + dy; + + im.readScreenImage(x1, y1 - dy); + im.drawImage(x1, y1); + + setAPen(0); + rectFill(x1, y2 + dy + 1, x2, y2); + } } /** -- cgit v1.2.3 From c42629674bc58f46a27a91c3c8325f68ed9f222c Mon Sep 17 00:00:00 2001 From: Eugene Sandulenko Date: Wed, 9 Dec 2015 06:07:34 +0100 Subject: LAB: Code naming, reduced variable scope --- engines/lab/eventman.cpp | 4 +- engines/lab/intro.cpp | 1 + engines/lab/map.cpp | 252 +++++++++++++++++++++++------------------------ 3 files changed, 126 insertions(+), 131 deletions(-) diff --git a/engines/lab/eventman.cpp b/engines/lab/eventman.cpp index 967596c5fc..2b39397c1d 100644 --- a/engines/lab/eventman.cpp +++ b/engines/lab/eventman.cpp @@ -39,7 +39,7 @@ namespace Lab { -static byte MouseData[] = { +static byte mouseData[] = { 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 1, 7, 1, 0, 0, 0, 0, 0, 0, 0, 1, 7, 7, 1, 0, 0, 0, 0, 0, 0, @@ -174,7 +174,7 @@ void EventManager::updateMouse() { * Initializes the mouse. */ void EventManager::initMouse() { - g_system->setMouseCursor(MouseData, MOUSE_WIDTH, MOUSE_HEIGHT, 0, 0, 0); + g_system->setMouseCursor(mouseData, MOUSE_WIDTH, MOUSE_HEIGHT, 0, 0, 0); g_system->showMouse(false); setMousePos(Common::Point(0, 0)); diff --git a/engines/lab/intro.cpp b/engines/lab/intro.cpp index 4518a27eef..d0406bc192 100644 --- a/engines/lab/intro.cpp +++ b/engines/lab/intro.cpp @@ -38,6 +38,7 @@ #include "lab/resource.h" namespace Lab { + Intro::Intro(LabEngine *vm) : _vm(vm) { _quitIntro = false; } diff --git a/engines/lab/map.cpp b/engines/lab/map.cpp index af61c85738..bc95304369 100644 --- a/engines/lab/map.cpp +++ b/engines/lab/map.cpp @@ -137,10 +137,10 @@ void LabEngine::freeMapData() { /** * Figures out what a room's coordinates should be. */ -static void roomCoords(uint16 CurRoom, uint16 *x1, uint16 *y1, uint16 *x2, uint16 *y2) { +static void roomCoords(uint16 curRoom, uint16 *x1, uint16 *y1, uint16 *x2, uint16 *y2) { Image *curRoomImg = NULL; - switch (Maps[CurRoom].SpecialID) { + switch (Maps[curRoom].SpecialID) { case NORMAL: case UPARROWROOM: case DOWNARROWROOM: @@ -160,8 +160,8 @@ static void roomCoords(uint16 CurRoom, uint16 *x1, uint16 *y1, uint16 *x2, uint1 break; } - *x1 = mapScaleX(Maps[CurRoom].x); - *y1 = mapScaleY(Maps[CurRoom].y); + *x1 = mapScaleX(Maps[curRoom].x); + *y1 = mapScaleY(Maps[curRoom].y); *x2 = *x1; *y2 = *y1; @@ -174,21 +174,21 @@ static void roomCoords(uint16 CurRoom, uint16 *x1, uint16 *y1, uint16 *x2, uint1 /** * Draws a room map. */ -static void drawRoomMap(uint16 CurRoom, bool drawx) { +static void drawRoomMap(uint16 curRoom, bool drawx) { uint16 x, y, xx, xy, offset; uint32 flags; - x = mapScaleX(Maps[CurRoom].x); - y = mapScaleY(Maps[CurRoom].y); - flags = Maps[CurRoom].MapFlags; + x = mapScaleX(Maps[curRoom].x); + y = mapScaleY(Maps[curRoom].y); + flags = Maps[curRoom].MapFlags; - switch (Maps[CurRoom].SpecialID) { + switch (Maps[curRoom].SpecialID) { case NORMAL: case UPARROWROOM: case DOWNARROWROOM: - if (Maps[CurRoom].SpecialID == NORMAL) + if (Maps[curRoom].SpecialID == NORMAL) Room->drawImage(x, y); - else if (Maps[CurRoom].SpecialID == DOWNARROWROOM) + else if (Maps[curRoom].SpecialID == DOWNARROWROOM) DownArrowRoom->drawImage(x, y); else UpArrowRoom->drawImage(x, y); @@ -309,9 +309,9 @@ static void drawRoomMap(uint16 CurRoom, bool drawx) { /** * Checks if a floor has been visitted. */ -static bool onFloor(uint16 Floor) { +static bool onFloor(uint16 flr) { for (uint16 i = 1; i <= MaxRooms; i++) { - if ((Maps[i].PageNumber == Floor) && g_lab->_roomsFound->in(i) && Maps[i].x) + if ((Maps[i].PageNumber == flr) && g_lab->_roomsFound->in(i) && Maps[i].x) return true; } @@ -321,60 +321,52 @@ static bool onFloor(uint16 Floor) { /** * Figures out which floor, if any, should be gone to if the up arrow is hit */ -static void getUpFloor(uint16 *Floor, bool *isfloor) { +static bool getUpFloor(uint16 *flr) { do { - *isfloor = true; - - if (*Floor < kFloorUpper) - (*Floor)++; + if (*flr < kFloorUpper) + (*flr)++; else { - *Floor = kFloorCarnival + 1; - *isfloor = false; - return; + *flr = kFloorCarnival + 1; + return false; } - } while ((!onFloor(*Floor)) && (*Floor <= kFloorCarnival)); + } while ((!onFloor(*flr)) && (*flr <= kFloorCarnival)); + + return true; } /** * Figures out which floor, if any, should be gone to if the down arrow is * hit. */ -static void getDownFloor(uint16 *Floor, bool *isfloor) { +static bool getDownFloor(uint16 *flr) { do { - *isfloor = true; - - if ((*Floor == kFloorLower) || (*Floor == 0)) { - *Floor = 0; - *isfloor = false; - return; - } else if (*Floor > kFloorUpper) { + if ((*flr == kFloorLower) || (*flr == 0)) { + *flr = 0; + return false; + } else if (*flr > kFloorUpper) { // Labyrinth specific code - if (*Floor == kFloorHedgeMaze) - *Floor = kFloorUpper; - else if ((*Floor == kFloorCarnival) || (*Floor == kFloorMedMaze)) - *Floor = kFloorMiddle; - else if (*Floor == kFloorSurMaze) - *Floor = kFloorLower; + if (*flr == kFloorHedgeMaze) + *flr = kFloorUpper; + else if ((*flr == kFloorCarnival) || (*flr == kFloorMedMaze)) + *flr = kFloorMiddle; + else if (*flr == kFloorSurMaze) + *flr = kFloorLower; else { - *Floor = 0; - *isfloor = false; - return; + *flr = 0; + return false; } } else - (*Floor)--; + (*flr)--; - } while ((!onFloor(*Floor)) && *Floor); + } while ((!onFloor(*flr)) && *flr); + + return true; } /** * Draws the map */ -void LabEngine::drawMap(uint16 CurRoom, uint16 CurMsg, uint16 Floor, bool fadeout, bool fadein) { - char *sptr; - - uint16 tempfloor; - bool noOverlay; - +void LabEngine::drawMap(uint16 curRoom, uint16 curMsg, uint16 flr, bool fadeout, bool fadein) { _event->mouseHide(); if (fadeout) @@ -387,8 +379,8 @@ void LabEngine::drawMap(uint16 CurRoom, uint16 CurMsg, uint16 Floor, bool fadeou drawGadgetList(&_mapGadgetList); for (uint16 i = 1; i <= MaxRooms; i++) { - if ((Maps[i].PageNumber == Floor) && _roomsFound->in(i) && Maps[i].x) { - drawRoomMap(i, (bool)(i == CurRoom)); + if ((Maps[i].PageNumber == flr) && _roomsFound->in(i) && Maps[i].x) { + drawRoomMap(i, (bool)(i == curRoom)); _music->updateMusic(); } } @@ -396,11 +388,12 @@ void LabEngine::drawMap(uint16 CurRoom, uint16 CurMsg, uint16 Floor, bool fadeou // Makes sure the X is drawn in corridors // NOTE: this here on purpose just in case there's some weird // condition, like the surreal maze where there are no rooms - if ((Maps[CurRoom].PageNumber == Floor) && _roomsFound->in(CurRoom) && Maps[CurRoom].x) - drawRoomMap(CurRoom, true); + if ((Maps[curRoom].PageNumber == flr) && _roomsFound->in(curRoom) && Maps[curRoom].x) + drawRoomMap(curRoom, true); + + uint16 tempfloor = flr; - tempfloor = Floor; - getUpFloor(&tempfloor, &noOverlay); + bool noOverlay = getUpFloor(&tempfloor); Gadget *upGadget = _event->getGadget(1); Gadget *downGadget = _event->getGadget(2); @@ -410,38 +403,40 @@ void LabEngine::drawMap(uint16 CurRoom, uint16 CurMsg, uint16 Floor, bool fadeou else disableGadget(upGadget, 12); - tempfloor = Floor; - getDownFloor(&tempfloor, &noOverlay); + tempfloor = flr; + noOverlay = getDownFloor(&tempfloor); if (noOverlay) enableGadget(downGadget); else disableGadget(downGadget, 12); + char *sptr; + // Labyrinth specific code - if (Floor == kFloorLower) { + if (flr == kFloorLower) { if (onFloor(kFloorSurMaze)) Maze->drawImage(mapScaleX(538), mapScaleY(277)); - } else if (Floor == kFloorMiddle) { + } else if (flr == kFloorMiddle) { if (onFloor(kFloorCarnival)) Maze->drawImage(mapScaleX(358), mapScaleY(72)); if (onFloor(kFloorMedMaze)) Maze->drawImage(mapScaleX(557), mapScaleY(325)); - } else if (Floor == kFloorUpper) { + } else if (flr == kFloorUpper) { if (onFloor(kFloorHedgeMaze)) HugeMaze->drawImage(mapScaleX(524), mapScaleY(97)); - } else if (Floor == kFloorSurMaze) { + } else if (flr == kFloorSurMaze) { sptr = (char *)_resource->getStaticText(kTextSurmazeMessage).c_str(); _graphics->flowText(_msgFont, 0, 7, 0, true, true, true, true, mapScaleX(360), 0, mapScaleX(660), mapScaleY(450), sptr); } - if (Floor >= kFloorLower && Floor <= kFloorCarnival) { - sptr = (char *)_resource->getStaticText(Floor - 1).c_str(); + if (flr >= kFloorLower && flr <= kFloorCarnival) { + sptr = (char *)_resource->getStaticText(flr - 1).c_str(); _graphics->flowTextScaled(_msgFont, 0, 5, 3, true, true, true, true, 14, 75, 134, 97, sptr); } - if ((sptr = _rooms[CurMsg]._roomMsg)) + if ((sptr = _rooms[curMsg]._roomMsg)) _graphics->flowTextScaled(_msgFont, 0, 5, 3, true, true, true, true, 14, 148, 134, 186, sptr); if (fadein) @@ -453,25 +448,22 @@ void LabEngine::drawMap(uint16 CurRoom, uint16 CurMsg, uint16 Floor, bool fadeou /** * Processes the map. */ -void LabEngine::processMap(uint16 CurRoom) { - uint32 Class, place = 1; - uint16 Code, Qualifier, MouseX, MouseY, GadgetID, CurFloor, OldFloor, OldMsg, CurMsg, x1, y1, x2, y2; - char *sptr; - byte newcolor[3]; - bool drawmap; - IntuiMessage *Msg; +void LabEngine::processMap(uint16 curRoom) { + uint32 place = 1; - CurMsg = CurRoom; - CurFloor = Maps[CurRoom].PageNumber; + uint16 curMsg = curRoom; + uint16 curFloor = Maps[curRoom].PageNumber; while (1) { // Make sure we check the music at least after every message _music->updateMusic(); - Msg = getMsg(); + IntuiMessage *msg = getMsg(); - if (Msg == NULL) { + if (msg == NULL) { _music->updateMusic(); + byte newcolor[3]; + if (place <= 14) { newcolor[0] = 14 << 2; newcolor[1] = place << 2; @@ -498,108 +490,110 @@ void LabEngine::processMap(uint16 CurRoom) { place = 1; } else { - Class = Msg->_msgClass; - Code = Msg->_code; - GadgetID = Msg->_gadgetID; - Qualifier = Msg->_qualifier; - MouseX = Msg->_mouseX; - MouseY = Msg->_mouseY; - - if (((Class == MOUSEBUTTONS) && (IEQUALIFIER_RBUTTON & Qualifier)) || ((Class == RAWKEY) && (Code == 27))) + uint32 msgClass = msg->_msgClass; + uint16 msgCode = msg->_code; + uint16 gadgetID = msg->_gadgetID; + uint16 qualifier = msg->_qualifier; + uint16 mouseX = msg->_mouseX; + uint16 mouseY = msg->_mouseY; + + if (((msgClass == MOUSEBUTTONS) && (IEQUALIFIER_RBUTTON & qualifier)) || ((msgClass == RAWKEY) && (msgCode == 27))) return; - if (Class == GADGETUP) { - if (GadgetID == 0) { + if (msgClass == GADGETUP) { + if (gadgetID == 0) { // Quit menu button return; - } else if (GadgetID == 1) { + } else if (gadgetID == 1) { // Up arrow - OldFloor = CurFloor; - getUpFloor(&CurFloor, &drawmap); + uint16 oldFloor = curFloor; + bool drawmap = getUpFloor(&curFloor); if (drawmap) { _graphics->fade(false, 0); - drawMap(CurRoom, CurMsg, CurFloor, false, false); + drawMap(curRoom, curMsg, curFloor, false, false); _graphics->fade(true, 0); } else - CurFloor = OldFloor; - } else if (GadgetID == 2) { + curFloor = oldFloor; + } else if (gadgetID == 2) { // Down arrow - OldFloor = CurFloor; - getDownFloor(&CurFloor, &drawmap); + uint16 oldFloor = curFloor; + bool drawmap = getDownFloor(&curFloor); if (drawmap) { _graphics->fade(false, 0); - drawMap(CurRoom, CurMsg, CurFloor, false, false); + drawMap(curRoom, curMsg, curFloor, false, false); _graphics->fade(true, 0); } else - CurFloor = OldFloor; + curFloor = oldFloor; } - } else if ((Class == MOUSEBUTTONS) && (IEQUALIFIER_LEFTBUTTON & Qualifier)) { - if ((CurFloor == kFloorLower) && (MouseX >= mapScaleX(538)) && (MouseY >= mapScaleY(277)) - && (MouseX <= mapScaleX(633)) && (MouseY <= mapScaleY(352)) + } else if ((msgClass == MOUSEBUTTONS) && (IEQUALIFIER_LEFTBUTTON & qualifier)) { + if ((curFloor == kFloorLower) && (mouseX >= mapScaleX(538)) && (mouseY >= mapScaleY(277)) + && (mouseX <= mapScaleX(633)) && (mouseY <= mapScaleY(352)) && onFloor(kFloorSurMaze)) { - CurFloor = kFloorSurMaze; + curFloor = kFloorSurMaze; _graphics->fade(false, 0); - drawMap(CurRoom, CurMsg, CurFloor, false, false); + drawMap(curRoom, curMsg, curFloor, false, false); _graphics->fade(true, 0); - } else if ((CurFloor == kFloorMiddle) && (MouseX >= mapScaleX(358)) && (MouseY >= mapScaleY(71)) - && (MouseX <= mapScaleX(452)) && (MouseY <= mapScaleY(147)) + } else if ((curFloor == kFloorMiddle) && (mouseX >= mapScaleX(358)) && (mouseY >= mapScaleY(71)) + && (mouseX <= mapScaleX(452)) && (mouseY <= mapScaleY(147)) && onFloor(kFloorCarnival)) { - CurFloor = kFloorCarnival; + curFloor = kFloorCarnival; _graphics->fade(false, 0); - drawMap(CurRoom, CurMsg, CurFloor, false, false); + drawMap(curRoom, curMsg, curFloor, false, false); _graphics->fade(true, 0); - } else if ((CurFloor == kFloorMiddle) && (MouseX >= mapScaleX(557)) && (MouseY >= mapScaleY(325)) - && (MouseX <= mapScaleX(653)) && (MouseY <= mapScaleY(401)) + } else if ((curFloor == kFloorMiddle) && (mouseX >= mapScaleX(557)) && (mouseY >= mapScaleY(325)) + && (mouseX <= mapScaleX(653)) && (mouseY <= mapScaleY(401)) && onFloor(kFloorMedMaze)) { - CurFloor = kFloorMedMaze; + curFloor = kFloorMedMaze; _graphics->fade(false, 0); - drawMap(CurRoom, CurMsg, CurFloor, false, false); + drawMap(curRoom, curMsg, curFloor, false, false); _graphics->fade(true, 0); - } else if ((CurFloor == kFloorUpper) && (MouseX >= mapScaleX(524)) && (MouseY >= mapScaleY(97)) - && (MouseX <= mapScaleX(645)) && (MouseY <= mapScaleY(207)) + } else if ((curFloor == kFloorUpper) && (mouseX >= mapScaleX(524)) && (mouseY >= mapScaleY(97)) + && (mouseX <= mapScaleX(645)) && (mouseY <= mapScaleY(207)) && onFloor(kFloorHedgeMaze)) { - CurFloor = kFloorHedgeMaze; + curFloor = kFloorHedgeMaze; _graphics->fade(false, 0); - drawMap(CurRoom, CurMsg, CurFloor, false, false); + drawMap(curRoom, curMsg, curFloor, false, false); _graphics->fade(true, 0); - } else if (MouseX > mapScaleX(314)) { - OldMsg = CurMsg; + } else if (mouseX > mapScaleX(314)) { + uint16 oldMsg = curMsg; + uint16 x1, y1, x2, y2; for (uint16 i = 1; i <= MaxRooms; i++) { roomCoords(i, &x1, &y1, &x2, &y2); - if ((Maps[i].PageNumber == CurFloor) + if ((Maps[i].PageNumber == curFloor) && _roomsFound->in(i) - && (MouseX >= x1) && (MouseX <= x2) - && (MouseY >= y1) && (MouseY <= y2)) { - CurMsg = i; + && (mouseX >= x1) && (mouseX <= x2) + && (mouseY >= y1) && (mouseY <= y2)) { + curMsg = i; } } - if (OldMsg != CurMsg) { - if (_rooms[CurMsg]._roomMsg == nullptr) - _resource->readViews(CurMsg); + if (oldMsg != curMsg) { + if (_rooms[curMsg]._roomMsg == nullptr) + _resource->readViews(curMsg); - if ((sptr = _rooms[CurMsg]._roomMsg)) { + char *sptr; + if ((sptr = _rooms[curMsg]._roomMsg)) { _event->mouseHide(); _graphics->setAPen(3); _graphics->rectFillScaled(13, 148, 135, 186); _graphics->flowTextScaled(_msgFont, 0, 5, 3, true, true, true, true, 14, 148, 134, 186, sptr); - if (Maps[OldMsg].PageNumber == CurFloor) - drawRoomMap(OldMsg, (bool)(OldMsg == CurRoom)); + if (Maps[oldMsg].PageNumber == curFloor) + drawRoomMap(oldMsg, (bool)(oldMsg == curRoom)); - roomCoords(CurMsg, &x1, &y1, &x2, &y2); + roomCoords(curMsg, &x1, &y1, &x2, &y2); x1 = (x1 + x2) / 2; y1 = (y1 + y2) / 2; - if ((CurMsg != CurRoom) && (Maps[CurMsg].PageNumber == CurFloor)) { + if ((curMsg != curRoom) && (Maps[curMsg].PageNumber == curFloor)) { _graphics->setAPen(1); _graphics->rectFill(x1 - 1, y1, x1, y1); } @@ -618,15 +612,15 @@ void LabEngine::processMap(uint16 CurRoom) { /** * Does the map processing. */ -void LabEngine::doMap(uint16 CurRoom) { - static uint16 AmigaMapPalette[] = { +void LabEngine::doMap(uint16 curRoom) { + static uint16 amigaMapPalette[] = { 0x0BA8, 0x0C11, 0x0A74, 0x0076, 0x0A96, 0x0DCB, 0x0CCA, 0x0222, 0x0444, 0x0555, 0x0777, 0x0999, 0x0AAA, 0x0ED0, 0x0EEE, 0x0694 }; - _graphics->FadePalette = AmigaMapPalette; + _graphics->FadePalette = amigaMapPalette; _music->updateMusic(); loadMapData(); @@ -642,10 +636,10 @@ void LabEngine::doMap(uint16 CurRoom) { XMark = MapWest; _event->attachGadgetList(&_mapGadgetList); - drawMap(CurRoom, CurRoom, Maps[CurRoom].PageNumber, false, true); + drawMap(curRoom, curRoom, Maps[curRoom].PageNumber, false, true); _event->mouseShow(); _graphics->screenUpdate(); - processMap(CurRoom); + processMap(curRoom); _event->attachGadgetList(NULL); _graphics->fade(false, 0); _graphics->blackAllScreen(); -- cgit v1.2.3 From 0af299d3c78d59de20fe5ad41169f755fda297f4 Mon Sep 17 00:00:00 2001 From: Eugene Sandulenko Date: Wed, 9 Dec 2015 06:17:16 +0100 Subject: LAB: Move saveRestoreGame() to saveload.cpp --- engines/lab/lab.h | 2 ++ engines/lab/savegame.cpp | 49 ++++++++++++++++++++++++++++++++++++++++++++++++ engines/lab/special.cpp | 49 ------------------------------------------------ 3 files changed, 51 insertions(+), 49 deletions(-) diff --git a/engines/lab/lab.h b/engines/lab/lab.h index ac27c94d93..3e545cc4b1 100644 --- a/engines/lab/lab.h +++ b/engines/lab/lab.h @@ -70,6 +70,8 @@ enum GameFeatures { #define UPSCROLL 3 #define DOWNSCROLL 4 +#define QUARTERNUM 30 + typedef Common::List GadgetList; struct CrumbData { diff --git a/engines/lab/savegame.cpp b/engines/lab/savegame.cpp index 1e2c8afc7b..0f0c772e4d 100644 --- a/engines/lab/savegame.cpp +++ b/engines/lab/savegame.cpp @@ -28,6 +28,11 @@ * */ +#include "common/translation.h" + +#include "gui/message.h" +#include "gui/saveload.h" + #include "graphics/thumbnail.h" #include "engines/savestate.h" @@ -35,9 +40,12 @@ #include "lab/dispman.h" #include "lab/labsets.h" +#include "lab/music.h" +#include "lab/processroom.h" #include "lab/savegame.h" namespace Lab { + #define SAVEGAME_ID MKTAG('L', 'O', 'T', 'S') #define SAVEGAME_VERSION 1 @@ -216,5 +224,46 @@ bool loadGame(uint16 *Direction, uint16 *Quarters, int slot) { return true; } +bool LabEngine::saveRestoreGame() { + bool isOK = false; + + //g_lab->showMainMenu(); + + // The original had one screen for saving/loading. We have two. + // Ask the user which screen to use. + GUI::MessageDialog saveOrLoad(_("Would you like to save or restore a game?"), _("Save"), _("Restore")); + + int choice = saveOrLoad.runModal(); + if (choice == GUI::kMessageOK) { + // Save + GUI::SaveLoadChooser *dialog = new GUI::SaveLoadChooser(_("Save game:"), _("Save"), true); + int slot = dialog->runModalWithCurrentTarget(); + if (slot >= 0) { + Common::String desc = dialog->getResultString(); + + if (desc.empty()) { + // create our own description for the saved game, the user didn't enter it + desc = dialog->createDefaultSaveDescription(slot); + } + + isOK = saveGame(_direction, _inventory[QUARTERNUM]._many, slot, desc); + } + } else { + // Restore + GUI::SaveLoadChooser *dialog = new GUI::SaveLoadChooser(_("Restore game:"), _("Restore"), false); + int slot = dialog->runModalWithCurrentTarget(); + if (slot >= 0) { + isOK = loadGame(&_direction, &(_inventory[QUARTERNUM]._many), slot); + if (isOK) + _music->resetMusic(); + } + } + + _alternate = false; + _mainDisplay = true; + _graphics->screenUpdate(); + + return isOK; +} } // End of namespace Lab diff --git a/engines/lab/special.cpp b/engines/lab/special.cpp index 8bb57adfed..63b8109e2f 100644 --- a/engines/lab/special.cpp +++ b/engines/lab/special.cpp @@ -28,11 +28,6 @@ * */ -#include "common/translation.h" - -#include "gui/message.h" -#include "gui/saveload.h" - #include "lab/lab.h" #include "lab/anim.h" @@ -44,7 +39,6 @@ #include "lab/music.h" #include "lab/processroom.h" #include "lab/resource.h" -#include "lab/savegame.h" #include "lab/utils.h" namespace Lab { @@ -71,7 +65,6 @@ Image *MonButton; #define DIRTY 175 #define NONEWS 135 #define NOCLEAN 152 -#define QUARTERNUM 30 static byte *loadBackPict(const char *fileName, bool tomem) { @@ -385,48 +378,6 @@ void LabEngine::doJournal() { _graphics->blackScreen(); } -bool LabEngine::saveRestoreGame() { - bool isOK = false; - - //g_lab->showMainMenu(); - - // The original had one screen for saving/loading. We have two. - // Ask the user which screen to use. - GUI::MessageDialog saveOrLoad(_("Would you like to save or restore a game?"), _("Save"), _("Restore")); - - int choice = saveOrLoad.runModal(); - if (choice == GUI::kMessageOK) { - // Save - GUI::SaveLoadChooser *dialog = new GUI::SaveLoadChooser(_("Save game:"), _("Save"), true); - int slot = dialog->runModalWithCurrentTarget(); - if (slot >= 0) { - Common::String desc = dialog->getResultString(); - - if (desc.empty()) { - // create our own description for the saved game, the user didn't enter it - desc = dialog->createDefaultSaveDescription(slot); - } - - isOK = saveGame(_direction, _inventory[QUARTERNUM]._many, slot, desc); - } - } else { - // Restore - GUI::SaveLoadChooser *dialog = new GUI::SaveLoadChooser(_("Restore game:"), _("Restore"), false); - int slot = dialog->runModalWithCurrentTarget(); - if (slot >= 0) { - isOK = loadGame(&_direction, &(_inventory[QUARTERNUM]._many), slot); - if (isOK) - _music->resetMusic(); - } - } - - _alternate = false; - _mainDisplay = true; - _graphics->screenUpdate(); - - return isOK; -} - /** * Draws the text for the monitor. */ -- cgit v1.2.3 From 199fa254f9be4d7cb4395b871755557024926b9d Mon Sep 17 00:00:00 2001 From: Strangerke Date: Wed, 9 Dec 2015 11:22:41 +0100 Subject: LAB: Rename CloseDataPtr pointers, some refactoring --- engines/lab/dispman.h | 4 +- engines/lab/engine.cpp | 150 ++++++++++----------- engines/lab/lab.h | 14 +- engines/lab/map.cpp | 44 +++--- engines/lab/processroom.cpp | 322 +++++++++++++++++++++----------------------- engines/lab/processroom.h | 21 ++- engines/lab/resource.cpp | 8 +- engines/lab/savegame.cpp | 4 +- engines/lab/special.cpp | 64 ++++----- engines/lab/transitions.cpp | 10 +- engines/lab/utils.cpp | 10 ++ engines/lab/utils.h | 1 + 12 files changed, 319 insertions(+), 333 deletions(-) diff --git a/engines/lab/dispman.h b/engines/lab/dispman.h index dbeeefc1c1..5b6217bb60 100644 --- a/engines/lab/dispman.h +++ b/engines/lab/dispman.h @@ -79,8 +79,8 @@ public: void copyPage(uint16 width, uint16 height, uint16 nheight, uint16 startline, byte *mem); void doScrollWipe(char *filename); void doScrollBounce(); - void doTransWipe(CloseDataPtr *cPtr, char *filename); - void doTransition(TransitionType transitionType, CloseDataPtr *cPtr, char *filename); + void doTransWipe(CloseDataPtr *closePtrList, char *filename); + void doTransition(TransitionType transitionType, CloseDataPtr *closePtrList, char *filename); void blackScreen(); void whiteScreen(); void blackAllScreen(); diff --git a/engines/lab/engine.cpp b/engines/lab/engine.cpp index 0b353b521e..5f6f9f96e9 100644 --- a/engines/lab/engine.cpp +++ b/engines/lab/engine.cpp @@ -164,7 +164,7 @@ void LabEngine::eatMessages() { * Checks whether the close up is one of the special case closeups. */ bool LabEngine::doCloseUp(CloseDataPtr closePtr) { - if (closePtr == NULL) + if (!closePtr) return false; int monltmargin, monrtmargin, montopmargin, lutertmargin; @@ -253,7 +253,7 @@ const char *LabEngine::getInvName(uint16 curInv) { */ void LabEngine::interfaceOff() { if (!_interfaceOff) { - _event->attachGadgetList(NULL); + _event->attachGadgetList(nullptr); _event->mouseHide(); _interfaceOff = true; } @@ -286,10 +286,10 @@ bool LabEngine::doUse(uint16 curInv) { interfaceOff(); _anim->stopDiff(); _curFileName = " "; - _cptr = NULL; + _closeDataPtr = nullptr; doMap(_roomNum); _graphics->setPalette(initcolors, 8); - _graphics->drawMessage(NULL); + _graphics->drawMessage(nullptr); _graphics->drawPanel(); } else if (curInv == JOURNALNUM) { // LAB: Labyrinth specific @@ -297,10 +297,10 @@ bool LabEngine::doUse(uint16 curInv) { interfaceOff(); _anim->stopDiff(); _curFileName = " "; - _cptr = NULL; + _closeDataPtr = nullptr; doJournal(); _graphics->drawPanel(); - _graphics->drawMessage(NULL); + _graphics->drawMessage(nullptr); } else if (curInv == LAMPNUM) { // LAB: Labyrinth specific interfaceOff(); @@ -400,7 +400,7 @@ void LabEngine::mainGameLoop() { _graphics->setPalette(initcolors, 8); - _cptr = NULL; + _closeDataPtr = nullptr; _roomNum = 1; _direction = NORTH; @@ -434,16 +434,15 @@ void LabEngine::mainGameLoop() { _music->resumeBackMusic(); // Sees what kind of close up we're in and does the appropriate stuff, if any. - if (doCloseUp(_cptr)) { - _cptr = NULL; - + if (doCloseUp(_closeDataPtr)) { + _closeDataPtr = nullptr; mayShowCrumbIndicator(); _graphics->screenUpdate(); } // Sets the current picture properly on the screen if (_mainDisplay) - _nextFileName = getPictName(&_cptr); + _nextFileName = getPictName(&_closeDataPtr); if (_noUpdateDiff) { // Potentially entered another room @@ -458,21 +457,21 @@ void LabEngine::mainGameLoop() { _roomsFound->inclElement(_roomNum); _curFileName = _nextFileName; - if (_cptr) { - if ((_cptr->_closeUpType == SPECIALLOCK) && _mainDisplay) + if (_closeDataPtr) { + if ((_closeDataPtr->_closeUpType == SPECIALLOCK) && _mainDisplay) // LAB: Labyrinth specific code showCombination(_curFileName); - else if (((_cptr->_closeUpType == SPECIALBRICK) || - (_cptr->_closeUpType == SPECIALBRICKNOMOUSE)) && + else if (((_closeDataPtr->_closeUpType == SPECIALBRICK) || + (_closeDataPtr->_closeUpType == SPECIALBRICKNOMOUSE)) && _mainDisplay) // LAB: Labyrinth specific code - showTile(_curFileName, (bool)(_cptr->_closeUpType == SPECIALBRICKNOMOUSE)); + showTile(_curFileName, (bool)(_closeDataPtr->_closeUpType == SPECIALBRICKNOMOUSE)); else _graphics->readPict(_curFileName, false); } else _graphics->readPict(_curFileName, false); - drawRoomMessage(curInv, _cptr); + drawRoomMessage(curInv, _closeDataPtr); forceDraw = false; mayShowCrumbIndicator(); @@ -483,7 +482,7 @@ void LabEngine::mainGameLoop() { } if (forceDraw) { - drawRoomMessage(curInv, _cptr); + drawRoomMessage(curInv, _closeDataPtr); forceDraw = false; _graphics->screenUpdate(); } @@ -494,7 +493,7 @@ void LabEngine::mainGameLoop() { interfaceOn(); IntuiMessage *curMsg = getMsg(); - if (curMsg == NULL) { + if (!curMsg) { // Does music load and next animation frame when you've run out of messages gotMessage = false; _music->checkRoomMusic(); @@ -516,7 +515,7 @@ void LabEngine::mainGameLoop() { gotMessage = true; mayShowCrumbIndicator(); _graphics->screenUpdate(); - if (!from_crumbs(GADGETUP, code, 0, _event->updateAndGetMousePos(), curInv, curMsg, forceDraw, code, actionMode)) + if (!fromCrumbs(GADGETUP, code, 0, _event->updateAndGetMousePos(), curInv, curMsg, forceDraw, code, actionMode)) break; } } @@ -531,7 +530,7 @@ void LabEngine::mainGameLoop() { curPos.y = curMsg->_mouseY; _followingCrumbs = false; - if (!from_crumbs(curMsg->_msgClass, curMsg->_code, curMsg->_qualifier, curPos, curInv, curMsg, forceDraw, curMsg->_gadgetID, actionMode)) + if (!fromCrumbs(curMsg->_msgClass, curMsg->_code, curMsg->_qualifier, curPos, curInv, curMsg, forceDraw, curMsg->_gadgetID, actionMode)) break; } } @@ -557,14 +556,14 @@ void LabEngine::mainGameLoop() { } } -bool LabEngine::from_crumbs(uint32 tmpClass, uint16 code, uint16 qualifier, Common::Point tmpPos, +bool LabEngine::fromCrumbs(uint32 tmpClass, uint16 code, uint16 qualifier, Common::Point tmpPos, uint16 &curInv, IntuiMessage *curMsg, bool &forceDraw, uint16 gadgetId, uint16 &actionMode) { uint32 msgClass = tmpClass; Common::Point curPos = tmpPos; uint16 oldDirection = 0; uint16 lastInv = MAPNUM; - CloseDataPtr hcptr = nullptr; + CloseDataPtr wrkClosePtr = nullptr; bool doit; _anim->_doBlack = false; @@ -602,7 +601,7 @@ bool LabEngine::from_crumbs(uint32 tmpClass, uint16 code, uint16 qualifier, Comm // Sets the correct gadget list interfaceOn(); _graphics->drawPanel(); - drawRoomMessage(curInv, _cptr); + drawRoomMessage(curInv, _closeDataPtr); _graphics->screenUpdate(); } } else { @@ -627,7 +626,7 @@ bool LabEngine::from_crumbs(uint32 tmpClass, uint16 code, uint16 qualifier, Comm _music->updateMusic(); curMsg = getMsg(); - if (curMsg == NULL) { + if (!curMsg) { // Does music load and next animation frame when you've run out of messages _music->updateMusic(); _anim->diffNextFrame(); @@ -657,7 +656,7 @@ bool LabEngine::from_crumbs(uint32 tmpClass, uint16 code, uint16 qualifier, Comm msgClass = DELTAMOVE; } else if (code == 27) { // ESC key - _cptr = NULL; + _closeDataPtr = nullptr; } eatMessages(); @@ -670,17 +669,17 @@ bool LabEngine::from_crumbs(uint32 tmpClass, uint16 code, uint16 qualifier, Comm _graphics->_longWinInFront = false; _graphics->_doNotDrawMessage = false; _graphics->drawPanel(); - drawRoomMessage(curInv, _cptr); + drawRoomMessage(curInv, _closeDataPtr); _graphics->screenUpdate(); } } else if ((msgClass == GADGETUP) && !_alternate) { if (gadgetId <= 5) { - if ((actionMode == 4) && (gadgetId == 4) && (_cptr != NULL)) { - doMainView(&_cptr); + if ((actionMode == 4) && (gadgetId == 4) && _closeDataPtr) { + doMainView(&_closeDataPtr); _anim->_doBlack = true; - hcptr = NULL; - _cptr = NULL; + wrkClosePtr = nullptr; + _closeDataPtr = nullptr; mayShowCrumbIndicator(); _graphics->screenUpdate(); } else if (gadgetId == 5) { @@ -700,7 +699,7 @@ bool LabEngine::from_crumbs(uint32 tmpClass, uint16 code, uint16 qualifier, Comm decIncInv(&curInv, false); _graphics->drawPanel(); - drawRoomMessage(curInv, _cptr); + drawRoomMessage(curInv, _closeDataPtr); mayShowCrumbIndicator(); _graphics->screenUpdate(); @@ -724,8 +723,8 @@ bool LabEngine::from_crumbs(uint32 tmpClass, uint16 code, uint16 qualifier, Comm _graphics->screenUpdate(); } else if (gadgetId >= 6) { // Arrow Gadgets - _cptr = NULL; - hcptr = NULL; + _closeDataPtr = nullptr; + wrkClosePtr = nullptr; if ((gadgetId == 6) || (gadgetId == 8)) { if (gadgetId == 6) @@ -738,7 +737,7 @@ bool LabEngine::from_crumbs(uint32 tmpClass, uint16 code, uint16 qualifier, Comm oldDirection = _direction; uint16 newDir = processArrow(_direction, gadgetId - 6); - doTurn(_direction, newDir, &_cptr); + doTurn(_direction, newDir, &_closeDataPtr); _anim->_doBlack = true; _direction = newDir; forceDraw = true; @@ -748,7 +747,7 @@ bool LabEngine::from_crumbs(uint32 tmpClass, uint16 code, uint16 qualifier, Comm } else if (gadgetId == 7) { uint16 oldRoomNum = _roomNum; - if (doGoForward(&_cptr)) { + if (doGoForward(&_closeDataPtr)) { if (oldRoomNum == _roomNum) _anim->_doBlack = true; } else { @@ -825,7 +824,7 @@ bool LabEngine::from_crumbs(uint32 tmpClass, uint16 code, uint16 qualifier, Comm // Sets the correct gadget list interfaceOn(); _graphics->drawPanel(); - drawRoomMessage(curInv, _cptr); + drawRoomMessage(curInv, _closeDataPtr); _graphics->screenUpdate(); } @@ -838,8 +837,7 @@ bool LabEngine::from_crumbs(uint32 tmpClass, uint16 code, uint16 qualifier, Comm _curFileName = " "; doit = !saveRestoreGame(); - _cptr = NULL; - + _closeDataPtr = nullptr; _mainDisplay = true; curInv = MAPNUM; @@ -888,7 +886,7 @@ bool LabEngine::from_crumbs(uint32 tmpClass, uint16 code, uint16 qualifier, Comm decIncInv(&curInv, true); lastInv = curInv; _graphics->_doNotDrawMessage = false; - drawRoomMessage(curInv, _cptr); + drawRoomMessage(curInv, _closeDataPtr); _graphics->screenUpdate(); } else if (gadgetId == 4) { @@ -896,7 +894,7 @@ bool LabEngine::from_crumbs(uint32 tmpClass, uint16 code, uint16 qualifier, Comm decIncInv(&curInv, false); lastInv = curInv; _graphics->_doNotDrawMessage = false; - drawRoomMessage(curInv, _cptr); + drawRoomMessage(curInv, _closeDataPtr); _graphics->screenUpdate(); } else if (gadgetId == 5) { @@ -925,7 +923,7 @@ bool LabEngine::from_crumbs(uint32 tmpClass, uint16 code, uint16 qualifier, Comm // Sets the correct gadget list interfaceOn(); _graphics->drawPanel(); - drawRoomMessage(curInv, _cptr); + drawRoomMessage(curInv, _closeDataPtr); _graphics->screenUpdate(); } else { _breadCrumbs[0]._roomNum = 0; @@ -943,11 +941,11 @@ bool LabEngine::from_crumbs(uint32 tmpClass, uint16 code, uint16 qualifier, Comm doit = false; - if (_cptr) { - if ((_cptr->_closeUpType == SPECIALLOCK) && _mainDisplay) + if (_closeDataPtr) { + if ((_closeDataPtr->_closeUpType == SPECIALLOCK) && _mainDisplay) // LAB: Labyrinth specific code mouseCombination(curPos); - else if ((_cptr->_closeUpType == SPECIALBRICK) && _mainDisplay) + else if ((_closeDataPtr->_closeUpType == SPECIALBRICK) && _mainDisplay) mouseTile(curPos); else doit = true; @@ -956,48 +954,48 @@ bool LabEngine::from_crumbs(uint32 tmpClass, uint16 code, uint16 qualifier, Comm if (doit) { - hcptr = NULL; + wrkClosePtr = nullptr; eatMessages(); if (actionMode == 0) { // Take something. - if (doActionRule(Common::Point(curPos.x, curPos.y), actionMode, _roomNum, &_cptr)) + if (doActionRule(Common::Point(curPos.x, curPos.y), actionMode, _roomNum, &_closeDataPtr)) _curFileName = _newFileName; - else if (takeItem(curPos.x, curPos.y, &_cptr)) + else if (takeItem(curPos.x, curPos.y, &_closeDataPtr)) drawStaticMessage(kTextTakeItem); - else if (doActionRule(curPos, TAKEDEF - 1, _roomNum, &_cptr)) + else if (doActionRule(curPos, TAKEDEF - 1, _roomNum, &_closeDataPtr)) _curFileName = _newFileName; - else if (doActionRule(curPos, TAKE - 1, 0, &_cptr)) + else if (doActionRule(curPos, TAKE - 1, 0, &_closeDataPtr)) _curFileName = _newFileName; else if (curPos.y < (_utils->vgaScaleY(149) + _utils->svgaCord(2))) drawStaticMessage(kTextNothing); } else if ((actionMode == 1) || (actionMode == 2) || (actionMode == 3)) { // Manipulate an object, Open up a "door" or Close a "door" - if (doActionRule(curPos, actionMode, _roomNum, &_cptr)) + if (doActionRule(curPos, actionMode, _roomNum, &_closeDataPtr)) _curFileName = _newFileName; - else if (!doActionRule(curPos, actionMode, 0, &_cptr)) { + else if (!doActionRule(curPos, actionMode, 0, &_closeDataPtr)) { if (curPos.y < (_utils->vgaScaleY(149) + _utils->svgaCord(2))) drawStaticMessage(kTextNothing); } } else if (actionMode == 4) { // Look at closeups - CloseDataPtr tempcptr = _cptr; - setCurClose(curPos, &tempcptr); + CloseDataPtr tmpClosePtr = _closeDataPtr; + setCurrentClose(curPos, &tmpClosePtr); - if (_cptr == tempcptr) { + if (_closeDataPtr == tmpClosePtr) { if (curPos.y < (_utils->vgaScaleY(149) + _utils->svgaCord(2))) drawStaticMessage(kTextNothing); - } else if (tempcptr->_graphicName) { - if (*(tempcptr->_graphicName)) { + } else if (tmpClosePtr->_graphicName) { + if (*(tmpClosePtr->_graphicName)) { _anim->_doBlack = true; - _cptr = tempcptr; + _closeDataPtr = tmpClosePtr; } else if (curPos.y < (_utils->vgaScaleY(149) + _utils->svgaCord(2))) drawStaticMessage(kTextNothing); } else if (curPos.y < (_utils->vgaScaleY(149) + _utils->svgaCord(2))) drawStaticMessage(kTextNothing); } else if ((actionMode == 5) && _conditions->in(curInv)) { // Use an item on something else - if (doOperateRule(curPos.x, curPos.y, curInv, &_cptr)) { + if (doOperateRule(curPos, curInv, &_closeDataPtr)) { _curFileName = _newFileName; if (!_conditions->in(curInv)) @@ -1011,32 +1009,32 @@ bool LabEngine::from_crumbs(uint32 tmpClass, uint16 code, uint16 qualifier, Comm _graphics->screenUpdate(); } else if (msgClass == DELTAMOVE) { ViewData *vptr = getViewData(_roomNum, _direction); - CloseDataPtr oldcptr = vptr->_closeUps; + CloseDataPtr oldClosePtr = vptr->_closeUps; - if (hcptr == NULL) { - CloseDataPtr tempcptr = _cptr; - setCurClose(curPos, &tempcptr); + if (!wrkClosePtr) { + CloseDataPtr tmpClosePtr = _closeDataPtr; + setCurrentClose(curPos, &tmpClosePtr); - if ((tempcptr == NULL) || (tempcptr == _cptr)) { - if (_cptr == NULL) - hcptr = oldcptr; + if (!tmpClosePtr || (tmpClosePtr == _closeDataPtr)) { + if (!_closeDataPtr) + wrkClosePtr = oldClosePtr; else - hcptr = _cptr->_subCloseUps; + wrkClosePtr = _closeDataPtr->_subCloseUps; } else - hcptr = tempcptr->_nextCloseUp; + wrkClosePtr = tmpClosePtr->_nextCloseUp; } else - hcptr = hcptr->_nextCloseUp; + wrkClosePtr = wrkClosePtr->_nextCloseUp; - if (hcptr == NULL) { - if (_cptr == NULL) - hcptr = oldcptr; + if (!wrkClosePtr) { + if (!_closeDataPtr) + wrkClosePtr = oldClosePtr; else - hcptr = _cptr->_subCloseUps; + wrkClosePtr = _closeDataPtr->_subCloseUps; } - if (hcptr) - _event->setMousePos(Common::Point(_utils->scaleX((hcptr->x1 + hcptr->x2) / 2), _utils->scaleY((hcptr->y1 + hcptr->y2) / 2))); + if (wrkClosePtr) + _event->setMousePos(Common::Point(_utils->scaleX((wrkClosePtr->_x1 + wrkClosePtr->_x2) / 2), _utils->scaleY((wrkClosePtr->_y1 + wrkClosePtr->_y2) / 2))); } else if ((msgClass == MOUSEBUTTONS) && (IEQUALIFIER_RBUTTON & qualifier)) { eatMessages(); _alternate = !_alternate; @@ -1054,7 +1052,7 @@ bool LabEngine::from_crumbs(uint32 tmpClass, uint16 code, uint16 qualifier, Comm } _graphics->drawPanel(); - drawRoomMessage(curInv, _cptr); + drawRoomMessage(curInv, _closeDataPtr); mayShowCrumbIndicator(); _graphics->screenUpdate(); diff --git a/engines/lab/lab.h b/engines/lab/lab.h index 3e545cc4b1..a490ad7d08 100644 --- a/engines/lab/lab.h +++ b/engines/lab/lab.h @@ -164,19 +164,19 @@ public: private: int _lastWaitTOFTicks; bool _lastTooLong; - CloseDataPtr _cptr; + CloseDataPtr _closeDataPtr; InventoryData *_inventory; Image *_tiles[16]; GadgetList _journalGadgetList; GadgetList _mapGadgetList; private: - bool from_crumbs(uint32 tmpClass, uint16 code, uint16 qualifier, Common::Point tmpPos, + bool fromCrumbs(uint32 tmpClass, uint16 code, uint16 qualifier, Common::Point tmpPos, uint16 &curInv, IntuiMessage *curMsg, bool &forceDraw, uint16 gadgetId, uint16 &actionMode); public: void waitTOF(); - void drawRoomMessage(uint16 CurInv, CloseDataPtr cptr); + void drawRoomMessage(uint16 curInv, CloseDataPtr closePtr); void interfaceOff(); void interfaceOn(); void decIncInv(uint16 *CurInv, bool dec); @@ -198,17 +198,17 @@ public: void doWestPaper(); void eatMessages(); void drawStaticMessage(byte index); - void drawDirection(CloseDataPtr lcPtr); + void drawDirection(CloseDataPtr closePtr); int followCrumbs(); void changeVolume(int delta); - char *getPictName(CloseDataPtr *lcptr); + char *getPictName(CloseDataPtr *closePtrList); private: // engine.cpp void freeScreens(); void perFlipGadget(uint16 gadID); - bool doCloseUp(CloseDataPtr cptr); + bool doCloseUp(CloseDataPtr closePtr); void mainGameLoop(); bool doUse(uint16 curInv); void mayShowCrumbIndicator(); @@ -229,7 +229,7 @@ private: bool saveRestoreGame(); public: - void doActions(Action *aPtr, CloseDataPtr *lcptr); + void doActions(Action *actionList, CloseDataPtr *closePtrList); }; diff --git a/engines/lab/map.cpp b/engines/lab/map.cpp index bc95304369..6bf77c48fe 100644 --- a/engines/lab/map.cpp +++ b/engines/lab/map.cpp @@ -117,11 +117,11 @@ void LabEngine::loadMapData() { MaxRooms = mapFile->readUint16LE(); Maps = new MapData[MaxRooms]; // will be freed when the user exits the map for (int i = 0; i < MaxRooms; i++) { - Maps[i].x = mapFile->readUint16LE(); - Maps[i].y = mapFile->readUint16LE(); - Maps[i].PageNumber = mapFile->readUint16LE(); - Maps[i].SpecialID = mapFile->readUint16LE(); - Maps[i].MapFlags = mapFile->readUint32LE(); + Maps[i]._x = mapFile->readUint16LE(); + Maps[i]._y = mapFile->readUint16LE(); + Maps[i]._pageNumber = mapFile->readUint16LE(); + Maps[i]._specialID = mapFile->readUint16LE(); + Maps[i]._mapFlags = mapFile->readUint32LE(); } delete mapFile; @@ -140,7 +140,7 @@ void LabEngine::freeMapData() { static void roomCoords(uint16 curRoom, uint16 *x1, uint16 *y1, uint16 *x2, uint16 *y2) { Image *curRoomImg = NULL; - switch (Maps[curRoom].SpecialID) { + switch (Maps[curRoom]._specialID) { case NORMAL: case UPARROWROOM: case DOWNARROWROOM: @@ -160,8 +160,8 @@ static void roomCoords(uint16 curRoom, uint16 *x1, uint16 *y1, uint16 *x2, uint1 break; } - *x1 = mapScaleX(Maps[curRoom].x); - *y1 = mapScaleY(Maps[curRoom].y); + *x1 = mapScaleX(Maps[curRoom]._x); + *y1 = mapScaleY(Maps[curRoom]._y); *x2 = *x1; *y2 = *y1; @@ -178,17 +178,17 @@ static void drawRoomMap(uint16 curRoom, bool drawx) { uint16 x, y, xx, xy, offset; uint32 flags; - x = mapScaleX(Maps[curRoom].x); - y = mapScaleY(Maps[curRoom].y); - flags = Maps[curRoom].MapFlags; + x = mapScaleX(Maps[curRoom]._x); + y = mapScaleY(Maps[curRoom]._y); + flags = Maps[curRoom]._mapFlags; - switch (Maps[curRoom].SpecialID) { + switch (Maps[curRoom]._specialID) { case NORMAL: case UPARROWROOM: case DOWNARROWROOM: - if (Maps[curRoom].SpecialID == NORMAL) + if (Maps[curRoom]._specialID == NORMAL) Room->drawImage(x, y); - else if (Maps[curRoom].SpecialID == DOWNARROWROOM) + else if (Maps[curRoom]._specialID == DOWNARROWROOM) DownArrowRoom->drawImage(x, y); else UpArrowRoom->drawImage(x, y); @@ -311,7 +311,7 @@ static void drawRoomMap(uint16 curRoom, bool drawx) { */ static bool onFloor(uint16 flr) { for (uint16 i = 1; i <= MaxRooms; i++) { - if ((Maps[i].PageNumber == flr) && g_lab->_roomsFound->in(i) && Maps[i].x) + if ((Maps[i]._pageNumber == flr) && g_lab->_roomsFound->in(i) && Maps[i]._x) return true; } @@ -379,7 +379,7 @@ void LabEngine::drawMap(uint16 curRoom, uint16 curMsg, uint16 flr, bool fadeout, drawGadgetList(&_mapGadgetList); for (uint16 i = 1; i <= MaxRooms; i++) { - if ((Maps[i].PageNumber == flr) && _roomsFound->in(i) && Maps[i].x) { + if ((Maps[i]._pageNumber == flr) && _roomsFound->in(i) && Maps[i]._x) { drawRoomMap(i, (bool)(i == curRoom)); _music->updateMusic(); } @@ -388,7 +388,7 @@ void LabEngine::drawMap(uint16 curRoom, uint16 curMsg, uint16 flr, bool fadeout, // Makes sure the X is drawn in corridors // NOTE: this here on purpose just in case there's some weird // condition, like the surreal maze where there are no rooms - if ((Maps[curRoom].PageNumber == flr) && _roomsFound->in(curRoom) && Maps[curRoom].x) + if ((Maps[curRoom]._pageNumber == flr) && _roomsFound->in(curRoom) && Maps[curRoom]._x) drawRoomMap(curRoom, true); uint16 tempfloor = flr; @@ -452,7 +452,7 @@ void LabEngine::processMap(uint16 curRoom) { uint32 place = 1; uint16 curMsg = curRoom; - uint16 curFloor = Maps[curRoom].PageNumber; + uint16 curFloor = Maps[curRoom]._pageNumber; while (1) { // Make sure we check the music at least after every message @@ -567,7 +567,7 @@ void LabEngine::processMap(uint16 curRoom) { for (uint16 i = 1; i <= MaxRooms; i++) { roomCoords(i, &x1, &y1, &x2, &y2); - if ((Maps[i].PageNumber == curFloor) + if ((Maps[i]._pageNumber == curFloor) && _roomsFound->in(i) && (mouseX >= x1) && (mouseX <= x2) && (mouseY >= y1) && (mouseY <= y2)) { @@ -586,14 +586,14 @@ void LabEngine::processMap(uint16 curRoom) { _graphics->rectFillScaled(13, 148, 135, 186); _graphics->flowTextScaled(_msgFont, 0, 5, 3, true, true, true, true, 14, 148, 134, 186, sptr); - if (Maps[oldMsg].PageNumber == curFloor) + if (Maps[oldMsg]._pageNumber == curFloor) drawRoomMap(oldMsg, (bool)(oldMsg == curRoom)); roomCoords(curMsg, &x1, &y1, &x2, &y2); x1 = (x1 + x2) / 2; y1 = (y1 + y2) / 2; - if ((curMsg != curRoom) && (Maps[curMsg].PageNumber == curFloor)) { + if ((curMsg != curRoom) && (Maps[curMsg]._pageNumber == curFloor)) { _graphics->setAPen(1); _graphics->rectFill(x1 - 1, y1, x1, y1); } @@ -636,7 +636,7 @@ void LabEngine::doMap(uint16 curRoom) { XMark = MapWest; _event->attachGadgetList(&_mapGadgetList); - drawMap(curRoom, curRoom, Maps[curRoom].PageNumber, false, true); + drawMap(curRoom, curRoom, Maps[curRoom]._pageNumber, false, true); _event->mouseShow(); _graphics->screenUpdate(); processMap(curRoom); diff --git a/engines/lab/processroom.cpp b/engines/lab/processroom.cpp index 31a4cdd4e4..be03a0dcaf 100644 --- a/engines/lab/processroom.cpp +++ b/engines/lab/processroom.cpp @@ -44,21 +44,11 @@ namespace Lab { #define NOFILE "no file" -/** - * Generates a random number. - */ -uint16 getRandom(uint16 max) { - uint32 secs, micros; - - g_lab->getTime(&secs, µs); - return ((micros + secs) % max); -} - /** * Checks whether all the conditions in a condition list are met. */ static bool checkConditions(int16 *condition) { - if (condition == NULL) + if (!condition) return true; if (condition[0] == 0) @@ -97,61 +87,60 @@ ViewData *getViewData(uint16 roomNum, uint16 direction) { /** * Gets an object, if any, from the user's click on the screen. */ -static CloseData *getObject(uint16 x, uint16 y, CloseDataPtr lcptr) { - if (lcptr == NULL) { - lcptr = getViewData(g_lab->_roomNum, g_lab->_direction)->_closeUps; - } else { - lcptr = lcptr->_subCloseUps; - } +static CloseData *getObject(Common::Point pos, CloseDataPtr closePtr) { + if (closePtr == nullptr) + closePtr = getViewData(g_lab->_roomNum, g_lab->_direction)->_closeUps; + else + closePtr = closePtr->_subCloseUps; - while (lcptr != NULL) { - if ((x >= g_lab->_utils->scaleX(lcptr->x1)) && (y >= g_lab->_utils->scaleY(lcptr->y1)) && - (x <= g_lab->_utils->scaleX(lcptr->x2)) && (y <= g_lab->_utils->scaleY(lcptr->y2))) - return lcptr; + while (closePtr) { + if ((pos.x >= g_lab->_utils->scaleX(closePtr->_x1)) && (pos.y >= g_lab->_utils->scaleY(closePtr->_y1)) && + (pos.x <= g_lab->_utils->scaleX(closePtr->_x2)) && (pos.y <= g_lab->_utils->scaleY(closePtr->_y2))) + return closePtr; - lcptr = lcptr->_nextCloseUp; + closePtr = closePtr->_nextCloseUp; } - return NULL; + return nullptr; } /** * Goes through the list of closeups to find a match. * NYI: Known bug here. If there are two objects that have closeups, and * some of the closeups have the same hit boxes, then this returns the - * first occurence of the object with the same hit box. + * first occurrence of the object with the same hit box. */ -static CloseDataPtr findCPtrMatch(CloseDataPtr cpmain, CloseDataPtr list) { - CloseDataPtr cptr; +static CloseDataPtr findClosePtrMatch(CloseDataPtr closePtr, CloseDataPtr closePtrList) { + CloseDataPtr resClosePtr; - while (list) { - if ((cpmain->x1 == list->x1) && (cpmain->x2 == list->x2) && - (cpmain->y1 == list->y1) && (cpmain->y2 == list->y2) && - (cpmain->_depth == list->_depth)) - return list; + while (closePtrList) { + if ((closePtr->_x1 == closePtrList->_x1) && (closePtr->_x2 == closePtrList->_x2) && + (closePtr->_y1 == closePtrList->_y1) && (closePtr->_y2 == closePtrList->_y2) && + (closePtr->_depth == closePtrList->_depth)) + return closePtrList; - cptr = findCPtrMatch(cpmain, list->_subCloseUps); + resClosePtr = findClosePtrMatch(closePtr, closePtrList->_subCloseUps); - if (cptr) - return cptr; + if (resClosePtr) + return resClosePtr; else - list = list->_nextCloseUp; + closePtrList = closePtrList->_nextCloseUp; } - return NULL; + return nullptr; } /** * Returns the current picture name. */ -char *LabEngine::getPictName(CloseDataPtr *lcptr) { - ViewData *viewPtr = getViewData(g_lab->_roomNum, g_lab->_direction); +char *LabEngine::getPictName(CloseDataPtr *closePtrList) { + ViewData *viewPtr = getViewData(_roomNum, _direction); - if (*lcptr != NULL) { - *lcptr = findCPtrMatch(*lcptr, viewPtr->_closeUps); + if (*closePtrList) { + *closePtrList = findClosePtrMatch(*closePtrList, viewPtr->_closeUps); - if (*lcptr) - return (*lcptr)->_graphicName; + if (*closePtrList) + return (*closePtrList)->_graphicName; } return viewPtr->_graphicName; @@ -160,9 +149,9 @@ char *LabEngine::getPictName(CloseDataPtr *lcptr) { /** * Draws the current direction to the screen. */ -void LabEngine::drawDirection(CloseDataPtr lcptr) { - if (lcptr != NULL && lcptr->_message) { - _graphics->drawMessage(lcptr->_message); +void LabEngine::drawDirection(CloseDataPtr closePtr) { + if (closePtr && closePtr->_message) { + _graphics->drawMessage(closePtr->_message); return; } @@ -232,61 +221,53 @@ uint16 processArrow(uint16 curDirection, uint16 arrow) { /** * Sets the current close up data. */ -void setCurClose(Common::Point pos, CloseDataPtr *cptr, bool useAbsoluteCoords) { - CloseDataPtr lcptr; - uint16 x1, y1, x2, y2; +void setCurrentClose(Common::Point pos, CloseDataPtr *closePtrList, bool useAbsoluteCoords) { + CloseDataPtr closePtr; - if (*cptr == NULL) { - lcptr = getViewData(g_lab->_roomNum, g_lab->_direction)->_closeUps; - } else - lcptr = (*cptr)->_subCloseUps; - - while (lcptr != NULL) { - if (!useAbsoluteCoords) { - x1 = lcptr->x1; - y1 = lcptr->y1; - x2 = lcptr->x2; - y2 = lcptr->y2; - } else { - x1 = g_lab->_utils->scaleX(lcptr->x1); - y1 = g_lab->_utils->scaleY(lcptr->y1); - x2 = g_lab->_utils->scaleX(lcptr->x2); - y2 = g_lab->_utils->scaleY(lcptr->y2); - } + if (!*closePtrList) + closePtr = getViewData(g_lab->_roomNum, g_lab->_direction)->_closeUps; + else + closePtr = (*closePtrList)->_subCloseUps; + + Common::Rect target; + while (closePtr) { + if (!useAbsoluteCoords) + target = Common::Rect(closePtr->_x1, closePtr->_y1, closePtr->_x2, closePtr->_y2); + else + target = Common::Rect(g_lab->_utils->scaleX(closePtr->_x1), g_lab->_utils->scaleY(closePtr->_y1), g_lab->_utils->scaleX(closePtr->_x2), g_lab->_utils->scaleY(closePtr->_y2)); - if (pos.x >= x1 && pos.y >= y1 && pos.x <= x2 && pos.y <= y2 && lcptr->_graphicName) { - *cptr = lcptr; + if (target.contains(pos) && closePtr->_graphicName) { + *closePtrList = closePtr; return; } - lcptr = lcptr->_nextCloseUp; + closePtr = closePtr->_nextCloseUp; } } /** * Takes the currently selected item. */ -bool takeItem(uint16 x, uint16 y, CloseDataPtr *cptr) { - CloseDataPtr lcptr; +bool takeItem(uint16 x, uint16 y, CloseDataPtr *closePtrList) { + CloseDataPtr closePtr; - if (*cptr == NULL) { - lcptr = getViewData(g_lab->_roomNum, g_lab->_direction)->_closeUps; - } else if ((*cptr)->_closeUpType < 0) { - g_lab->_conditions->inclElement(abs((*cptr)->_closeUpType)); + if (!*closePtrList) { + closePtr = getViewData(g_lab->_roomNum, g_lab->_direction)->_closeUps; + } else if ((*closePtrList)->_closeUpType < 0) { + g_lab->_conditions->inclElement(abs((*closePtrList)->_closeUpType)); return true; } else - lcptr = (*cptr)->_subCloseUps; + closePtr = (*closePtrList)->_subCloseUps; - - while (lcptr != NULL) { - if ((x >= g_lab->_utils->scaleX(lcptr->x1)) && (y >= g_lab->_utils->scaleY(lcptr->y1)) && - (x <= g_lab->_utils->scaleX(lcptr->x2)) && (y <= g_lab->_utils->scaleY(lcptr->y2)) && - (lcptr->_closeUpType < 0)) { - g_lab->_conditions->inclElement(abs(lcptr->_closeUpType)); + while (closePtr) { + if ((x >= g_lab->_utils->scaleX(closePtr->_x1)) && (y >= g_lab->_utils->scaleY(closePtr->_y1)) && + (x <= g_lab->_utils->scaleX(closePtr->_x2)) && (y <= g_lab->_utils->scaleY(closePtr->_y2)) && + (closePtr->_closeUpType < 0)) { + g_lab->_conditions->inclElement(abs(closePtr->_closeUpType)); return true; } - lcptr = lcptr->_nextCloseUp; + closePtr = closePtr->_nextCloseUp; } return false; @@ -295,47 +276,47 @@ bool takeItem(uint16 x, uint16 y, CloseDataPtr *cptr) { /** * Processes the action list. */ -void LabEngine::doActions(Action *aptr, CloseDataPtr *lcptr) { - while (aptr) { +void LabEngine::doActions(Action *actionList, CloseDataPtr *closePtrList) { + while (actionList) { _music->updateMusic(); - switch (aptr->_actionType) { + switch (actionList->_actionType) { case PLAYSOUND: _music->_loopSoundEffect = false; _music->_waitTillFinished = true; - _music->readMusic((char *)aptr->_data, true); + _music->readMusic((char *)actionList->_data, true); _music->_waitTillFinished = false; break; case PLAYSOUNDB: _music->_loopSoundEffect = false; _music->_waitTillFinished = false; - _music->readMusic((char *)aptr->_data, false); + _music->readMusic((char *)actionList->_data, false); break; case PLAYSOUNDCONT: _music->_doNotFilestopSoundEffect = true; _music->_loopSoundEffect = true; - _music->readMusic((char *)aptr->_data, _music->_waitTillFinished); + _music->readMusic((char *)actionList->_data, _music->_waitTillFinished); break; case SHOWDIFF: - _graphics->readPict((char *)aptr->_data, true); + _graphics->readPict((char *)actionList->_data, true); break; case SHOWDIFFCONT: - _graphics->readPict((char *)aptr->_data, false); + _graphics->readPict((char *)actionList->_data, false); break; case LOADDIFF: - if (aptr->_data) + if (actionList->_data) // Puts a file into memory - _graphics->loadPict((char *)aptr->_data); + _graphics->loadPict((char *)actionList->_data); break; case TRANSITION: - _graphics->doTransition((TransitionType)aptr->_param1, lcptr, (char *)aptr->_data); + _graphics->doTransition((TransitionType)actionList->_param1, closePtrList, (char *)actionList->_data); break; case NOUPDATE: @@ -348,92 +329,93 @@ void LabEngine::doActions(Action *aptr, CloseDataPtr *lcptr) { break; case SHOWCURPICT: { - char *test = getPictName(lcptr); + char *test = getPictName(closePtrList); - if (strcmp(test, _curFileName) != 0) { - _curFileName = test; - _graphics->readPict(_curFileName, true); - } + if (strcmp(test, _curFileName) != 0) { + _curFileName = test; + _graphics->readPict(_curFileName, true); + } } break; case SETELEMENT: - _conditions->inclElement(aptr->_param1); + _conditions->inclElement(actionList->_param1); break; case UNSETELEMENT: - _conditions->exclElement(aptr->_param1); + _conditions->exclElement(actionList->_param1); break; case SHOWMESSAGE: _graphics->_doNotDrawMessage = false; if (_graphics->_longWinInFront) - _graphics->longDrawMessage((char *)aptr->_data); + _graphics->longDrawMessage((char *)actionList->_data); else - _graphics->drawMessage((char *)aptr->_data); + _graphics->drawMessage((char *)actionList->_data); _graphics->_doNotDrawMessage = true; break; case CSHOWMESSAGE: - if (*lcptr == NULL) { + if (!*closePtrList) { _graphics->_doNotDrawMessage = false; - _graphics->drawMessage((char *)aptr->_data); + _graphics->drawMessage((char *)actionList->_data); _graphics->_doNotDrawMessage = true; } break; case SHOWMESSAGES: { - char **str = (char **)aptr->_data; + char **str = (char **)actionList->_data; _graphics->_doNotDrawMessage = false; - _graphics->drawMessage(str[getRandom(aptr->_param1)]); + _graphics->drawMessage(str[_utils->getRandom(actionList->_param1)]); _graphics->_doNotDrawMessage = true; } break; case SETPOSITION: - if (aptr->_param1 & 0x8000) { + if (actionList->_param1 & 0x8000) { // This is a Wyrmkeep Windows trial version, thus stop at this // point, since we can't check for game payment status - _graphics->readPict(getPictName(lcptr), true); - aptr = NULL; + _graphics->readPict(getPictName(closePtrList), true); + actionList = nullptr; GUI::MessageDialog trialMessage("This is the end of the trial version. You can play the full game using the original interpreter from Wyrmkeep"); trialMessage.runModal(); continue; } - _roomNum = aptr->_param1; - _direction = aptr->_param2 - 1; - *lcptr = NULL; + _roomNum = actionList->_param1; + _direction = actionList->_param2 - 1; + *closePtrList = nullptr; _anim->_doBlack = true; break; case SETCLOSEUP: { - CloseDataPtr tlcptr = getObject(g_lab->_utils->scaleX(aptr->_param1), g_lab->_utils->scaleY(aptr->_param2), *lcptr); + Common::Point curPos = Common::Point(g_lab->_utils->scaleX(actionList->_param1), g_lab->_utils->scaleY(actionList->_param2)); + CloseDataPtr tmpClosePtr = getObject(curPos, *closePtrList); - if (tlcptr) - *lcptr = tlcptr; + if (tmpClosePtr) + *closePtrList = tmpClosePtr; } break; case MAINVIEW: - *lcptr = NULL; + *closePtrList = nullptr; break; case SUBINV: - if (_inventory[aptr->_param1]._many) - (_inventory[aptr->_param1]._many)--; + if (_inventory[actionList->_param1]._many) + (_inventory[actionList->_param1]._many)--; - if (_inventory[aptr->_param1]._many == 0) - _conditions->exclElement(aptr->_param1); + if (_inventory[actionList->_param1]._many == 0) + _conditions->exclElement(actionList->_param1); break; case ADDINV: - (_inventory[aptr->_param1]._many) += aptr->_param2; - _conditions->inclElement(aptr->_param1); + (_inventory[actionList->_param1]._many) += actionList->_param2; + _conditions->inclElement(actionList->_param1); break; case SHOWDIR: @@ -442,8 +424,7 @@ void LabEngine::doActions(Action *aptr, CloseDataPtr *lcptr) { case WAITSECS: { uint32 startSecs, startMicros, curSecs, curMicros; - - addCurTime(aptr->_param1, 0, &startSecs, &startMicros); + addCurTime(actionList->_param1, 0, &startSecs, &startMicros); _graphics->screenUpdate(); @@ -467,7 +448,7 @@ void LabEngine::doActions(Action *aptr, CloseDataPtr *lcptr) { break; case CHANGEMUSIC: - _music->changeMusic((const char *)aptr->_data); + _music->changeMusic((const char *)actionList->_data); _music->setMusicReset(false); break; @@ -517,13 +498,13 @@ void LabEngine::doActions(Action *aptr, CloseDataPtr *lcptr) { break; case SPECIALCMD: - if (aptr->_param1 == 0) + if (actionList->_param1 == 0) _anim->_doBlack = true; - else if (aptr->_param1 == 1) - _anim->_doBlack = (_cptr == NULL); - else if (aptr->_param1 == 2) - _anim->_doBlack = (_cptr != NULL); - else if (aptr->_param1 == 5) { + else if (actionList->_param1 == 1) + _anim->_doBlack = (_closeDataPtr == nullptr); + else if (actionList->_param1 == 2) + _anim->_doBlack = (_closeDataPtr != nullptr); + else if (actionList->_param1 == 5) { // inverse the palette for (uint16 idx = (8 * 3); idx < (255 * 3); idx++) _anim->_diffPalette[idx] = 255 - _anim->_diffPalette[idx]; @@ -532,18 +513,18 @@ void LabEngine::doActions(Action *aptr, CloseDataPtr *lcptr) { _graphics->setPalette(_anim->_diffPalette, 256); waitTOF(); waitTOF(); - } else if (aptr->_param1 == 4) { + } else if (actionList->_param1 == 4) { // white the palette _graphics->whiteScreen(); waitTOF(); waitTOF(); - } else if (aptr->_param1 == 6) { + } else if (actionList->_param1 == 6) { // Restore the palette waitTOF(); _graphics->setPalette(_anim->_diffPalette, 256); waitTOF(); waitTOF(); - } else if (aptr->_param1 == 7) { + } else if (actionList->_param1 == 7) { // Quick pause waitTOF(); waitTOF(); @@ -553,7 +534,7 @@ void LabEngine::doActions(Action *aptr, CloseDataPtr *lcptr) { break; } - aptr = aptr->_nextAction; + actionList = actionList->_nextAction; } if (_music->_loopSoundEffect) { @@ -573,13 +554,13 @@ void LabEngine::doActions(Action *aptr, CloseDataPtr *lcptr) { /** * Does the work for doActionRule. */ -static bool doActionRuleSub(int16 action, int16 roomNum, CloseDataPtr lcptr, CloseDataPtr *set, bool allowDefaults) { +static bool doActionRuleSub(int16 action, int16 roomNum, CloseDataPtr closePtr, CloseDataPtr *setCloseList, bool allowDefaults) { action++; - if (lcptr) { + if (closePtr) { RuleList *rules = g_lab->_rooms[g_lab->_roomNum]._rules; - if ((rules == NULL) && (roomNum == 0)) { + if (!rules && (roomNum == 0)) { g_lab->_resource->readViews(roomNum); rules = g_lab->_rooms[roomNum]._rules; } @@ -587,11 +568,11 @@ static bool doActionRuleSub(int16 action, int16 roomNum, CloseDataPtr lcptr, Clo for (RuleList::iterator rule = rules->begin(); rule != rules->end(); ++rule) { if (((*rule)->_ruleType == ACTION) && (((*rule)->_param1 == action) || (((*rule)->_param1 == 0) && allowDefaults))) { - if ((((*rule)->_param2 == lcptr->_closeUpType) || + if ((((*rule)->_param2 == closePtr->_closeUpType) || (((*rule)->_param2 == 0) && allowDefaults)) || - ((action == 1) && ((*rule)->_param2 == (-lcptr->_closeUpType)))) { + ((action == 1) && ((*rule)->_param2 == (-closePtr->_closeUpType)))) { if (checkConditions((*rule)->_condition)) { - g_lab->doActions((*rule)->_actionList, set); + g_lab->doActions((*rule)->_actionList, setCloseList); return true; } } @@ -605,21 +586,21 @@ static bool doActionRuleSub(int16 action, int16 roomNum, CloseDataPtr lcptr, Clo /** * Goes through the rules if an action is taken. */ -bool doActionRule(Common::Point pos, int16 action, int16 roomNum, CloseDataPtr *lcptr) { +bool doActionRule(Common::Point pos, int16 action, int16 roomNum, CloseDataPtr *closePtrList) { if (roomNum) g_lab->_newFileName = NOFILE; else g_lab->_newFileName = g_lab->_curFileName; - CloseDataPtr tlcptr = getObject(pos.x, pos.y, *lcptr); + CloseDataPtr curClosePtr = getObject(pos, *closePtrList); - if (doActionRuleSub(action, roomNum, tlcptr, lcptr, false)) + if (doActionRuleSub(action, roomNum, curClosePtr, closePtrList, false)) return true; - else if (doActionRuleSub(action, roomNum, *lcptr, lcptr, false)) + else if (doActionRuleSub(action, roomNum, *closePtrList, closePtrList, false)) return true; - else if (doActionRuleSub(action, roomNum, tlcptr, lcptr, true)) + else if (doActionRuleSub(action, roomNum, curClosePtr, closePtrList, true)) return true; - else if (doActionRuleSub(action, roomNum, *lcptr, lcptr, true)) + else if (doActionRuleSub(action, roomNum, *closePtrList, closePtrList, true)) return true; return false; @@ -628,12 +609,12 @@ bool doActionRule(Common::Point pos, int16 action, int16 roomNum, CloseDataPtr * /** * Does the work for doActionRule. */ -static bool doOperateRuleSub(int16 itemNum, int16 roomNum, CloseDataPtr lcptr, CloseDataPtr *set, bool allowDefaults) { - if (lcptr) - if (lcptr->_closeUpType > 0) { +static bool doOperateRuleSub(int16 itemNum, int16 roomNum, CloseDataPtr closePtr, CloseDataPtr *setCloseList, bool allowDefaults) { + if (closePtr) + if (closePtr->_closeUpType > 0) { RuleList *rules = g_lab->_rooms[roomNum]._rules; - if ((rules == NULL) && (roomNum == 0)) { + if (!rules && (roomNum == 0)) { g_lab->_resource->readViews(roomNum); rules = g_lab->_rooms[roomNum]._rules; } @@ -641,9 +622,9 @@ static bool doOperateRuleSub(int16 itemNum, int16 roomNum, CloseDataPtr lcptr, C for (RuleList::iterator rule = rules->begin(); rule != rules->end(); ++rule) { if (((*rule)->_ruleType == OPERATE) && (((*rule)->_param1 == itemNum) || (((*rule)->_param1 == 0) && allowDefaults)) && - (((*rule)->_param2 == lcptr->_closeUpType) || (((*rule)->_param2 == 0) && allowDefaults))) { + (((*rule)->_param2 == closePtr->_closeUpType) || (((*rule)->_param2 == 0) && allowDefaults))) { if (checkConditions((*rule)->_condition)) { - g_lab->doActions((*rule)->_actionList, set); + g_lab->doActions((*rule)->_actionList, setCloseList); return true; } } @@ -656,31 +637,28 @@ static bool doOperateRuleSub(int16 itemNum, int16 roomNum, CloseDataPtr lcptr, C /** * Goes through the rules if the user tries to operate an item on an object. */ -bool doOperateRule(int16 x, int16 y, int16 ItemNum, CloseDataPtr *lcptr) { - CloseDataPtr tlcptr; - +bool doOperateRule(Common::Point pos, int16 ItemNum, CloseDataPtr *closePtrList) { g_lab->_newFileName = NOFILE; + CloseDataPtr closePtr = getObject(pos, *closePtrList); - tlcptr = getObject(x, y, *lcptr); - - if (doOperateRuleSub(ItemNum, g_lab->_roomNum, tlcptr, lcptr, false)) + if (doOperateRuleSub(ItemNum, g_lab->_roomNum, closePtr, closePtrList, false)) return true; - else if (doOperateRuleSub(ItemNum, g_lab->_roomNum, *lcptr, lcptr, false)) + else if (doOperateRuleSub(ItemNum, g_lab->_roomNum, *closePtrList, closePtrList, false)) return true; - else if (doOperateRuleSub(ItemNum, g_lab->_roomNum, tlcptr, lcptr, true)) + else if (doOperateRuleSub(ItemNum, g_lab->_roomNum, closePtr, closePtrList, true)) return true; - else if (doOperateRuleSub(ItemNum, g_lab->_roomNum, *lcptr, lcptr, true)) + else if (doOperateRuleSub(ItemNum, g_lab->_roomNum, *closePtrList, closePtrList, true)) return true; else { g_lab->_newFileName = g_lab->_curFileName; - if (doOperateRuleSub(ItemNum, 0, tlcptr, lcptr, false)) + if (doOperateRuleSub(ItemNum, 0, closePtr, closePtrList, false)) return true; - else if (doOperateRuleSub(ItemNum, 0, *lcptr, lcptr, false)) + else if (doOperateRuleSub(ItemNum, 0, *closePtrList, closePtrList, false)) return true; - else if (doOperateRuleSub(ItemNum, 0, tlcptr, lcptr, true)) + else if (doOperateRuleSub(ItemNum, 0, closePtr, closePtrList, true)) return true; - else if (doOperateRuleSub(ItemNum, 0, *lcptr, lcptr, true)) + else if (doOperateRuleSub(ItemNum, 0, *closePtrList, closePtrList, true)) return true; } @@ -690,14 +668,14 @@ bool doOperateRule(int16 x, int16 y, int16 ItemNum, CloseDataPtr *lcptr) { /** * Goes through the rules if the user tries to go forward. */ -bool doGoForward(CloseDataPtr *lcptr) { +bool doGoForward(CloseDataPtr *closePtrList) { RuleList *rules = g_lab->_rooms[g_lab->_roomNum]._rules; for (RuleList::iterator ruleIter = rules->begin(); ruleIter != rules->end(); ++ruleIter) { Rule *rule = *ruleIter; if ((rule->_ruleType == GOFORWARD) && (rule->_param1 == (g_lab->_direction + 1))) { if (checkConditions(rule->_condition)) { - g_lab->doActions(rule->_actionList, lcptr); + g_lab->doActions(rule->_actionList, closePtrList); return true; } } @@ -709,7 +687,7 @@ bool doGoForward(CloseDataPtr *lcptr) { /** * Goes through the rules if the user tries to turn. */ -bool doTurn(uint16 from, uint16 to, CloseDataPtr *lcptr) { +bool doTurn(uint16 from, uint16 to, CloseDataPtr *closePtrList) { from++; to++; @@ -720,7 +698,7 @@ bool doTurn(uint16 from, uint16 to, CloseDataPtr *lcptr) { (((*rule)->_ruleType == TURNFROMTO) && ((*rule)->_param1 == from) && ((*rule)->_param2 == to))) { if (checkConditions((*rule)->_condition)) { - g_lab->doActions((*rule)->_actionList, lcptr); + g_lab->doActions((*rule)->_actionList, closePtrList); return true; } } @@ -732,12 +710,12 @@ bool doTurn(uint16 from, uint16 to, CloseDataPtr *lcptr) { /** * Goes through the rules if the user tries to go to the main view */ -bool doMainView(CloseDataPtr *lcptr) { +bool doMainView(CloseDataPtr *closePtrList) { RuleList *rules = g_lab->_rooms[g_lab->_roomNum]._rules; for (RuleList::iterator rule = rules->begin(); rule != rules->end(); ++rule) { if ((*rule)->_ruleType == GOMAINVIEW) { if (checkConditions((*rule)->_condition)) { - g_lab->doActions((*rule)->_actionList, lcptr); + g_lab->doActions((*rule)->_actionList, closePtrList); return true; } } diff --git a/engines/lab/processroom.h b/engines/lab/processroom.h index cf2f8df019..20b6946607 100644 --- a/engines/lab/processroom.h +++ b/engines/lab/processroom.h @@ -92,7 +92,7 @@ namespace Lab { #endif typedef struct CloseData { - uint16 x1, y1, x2, y2; + uint16 _x1, _y1, _x2, _y2; int16 _closeUpType; // if > 0, an object. If < 0, an item uint16 _depth; // Level of the closeup. char *_graphicName; @@ -177,8 +177,8 @@ struct InventoryData { #define MULTIMAZEF3 11 struct MapData { - uint16 x, y, PageNumber, SpecialID; - uint32 MapFlags; + uint16 _x, _y, _pageNumber, _specialID; + uint32 _mapFlags; }; #if defined(WIN32) @@ -187,15 +187,14 @@ struct MapData { bool parse(const char *inputFile); ViewData *getViewData(uint16 roomNum, uint16 direction); -void drawDirection(CloseDataPtr lcptr); uint16 processArrow(uint16 curDirection, uint16 arrow); -void setCurClose(Common::Point pos, CloseDataPtr *cptr, bool useAbsoluteCoords = true); -bool takeItem(uint16 x, uint16 y, CloseDataPtr *cptr); -bool doActionRule(Common::Point pos, int16 action, int16 roomNum, CloseDataPtr *lcptr); -bool doOperateRule(int16 x, int16 y, int16 itemNum, CloseDataPtr *lcptr); -bool doGoForward(CloseDataPtr *lcptr); -bool doTurn(uint16 from, uint16 to, CloseDataPtr *lcptr); -bool doMainView(CloseDataPtr *lcptr); +void setCurrentClose(Common::Point pos, CloseDataPtr *closePtrList, bool useAbsoluteCoords = true); +bool takeItem(uint16 x, uint16 y, CloseDataPtr *closePtrList); +bool doActionRule(Common::Point pos, int16 action, int16 roomNum, CloseDataPtr *closePtrList); +bool doOperateRule(Common::Point pos, int16 itemNum, CloseDataPtr *closePtrList); +bool doGoForward(CloseDataPtr *closePtrList); +bool doTurn(uint16 from, uint16 to, CloseDataPtr *closePtrList); +bool doMainView(CloseDataPtr *closePtrList); } // End of namespace Lab diff --git a/engines/lab/resource.cpp b/engines/lab/resource.cpp index 281f9a22cc..1d9a1aedfa 100644 --- a/engines/lab/resource.cpp +++ b/engines/lab/resource.cpp @@ -301,10 +301,10 @@ CloseData *Resource::readCloseUps(uint16 depth, Common::File *file) { head = closeup; if (prev) prev->_nextCloseUp = closeup; - closeup->x1 = file->readUint16LE(); - closeup->y1 = file->readUint16LE(); - closeup->x2 = file->readUint16LE(); - closeup->y2 = file->readUint16LE(); + closeup->_x1 = file->readUint16LE(); + closeup->_y1 = file->readUint16LE(); + closeup->_x2 = file->readUint16LE(); + closeup->_y2 = file->readUint16LE(); closeup->_closeUpType = file->readSint16LE(); closeup->_depth = depth; closeup->_graphicName = readString(file); diff --git a/engines/lab/savegame.cpp b/engines/lab/savegame.cpp index 0f0c772e4d..686b537182 100644 --- a/engines/lab/savegame.cpp +++ b/engines/lab/savegame.cpp @@ -131,8 +131,8 @@ bool saveGame(uint16 Direction, uint16 Quarters, int slot, Common::String desc) return false; // Load scene pic - CloseDataPtr cPtr = nullptr; - g_lab->_graphics->readPict(g_lab->getPictName(&cPtr), true); + CloseDataPtr closePtr = nullptr; + g_lab->_graphics->readPict(g_lab->getPictName(&closePtr), true); writeSaveGameHeader(file, desc); file->writeUint16LE(g_lab->_roomNum); diff --git a/engines/lab/special.cpp b/engines/lab/special.cpp index 63b8109e2f..d015c4e263 100644 --- a/engines/lab/special.cpp +++ b/engines/lab/special.cpp @@ -442,24 +442,24 @@ void LabEngine::drawMonText(char *text, TextFont *monitorFont, uint16 x1, uint16 * Processes user input. */ void LabEngine::processMonitor(char *ntext, TextFont *monitorFont, bool isinteractive, uint16 x1, uint16 y1, uint16 x2, uint16 y2) { - IntuiMessage *Msg; - uint32 Class; - uint16 Qualifier, Code, MouseX, MouseY; + IntuiMessage *msg; + uint32 msgClass; + uint16 qualifier, code, mouseX, mouseY; const char *Test = " ", *StartFileName = TextFileName; - CloseDataPtr startcptr = _cptr, testcptr, lastcptr[10]; + CloseDataPtr startClosePtr = _closeDataPtr, lastClosePtr[10]; uint16 depth = 0; - lastcptr[0] = _cptr; + lastClosePtr[0] = _closeDataPtr; while (1) { if (isinteractive) { - if (_cptr == NULL) - _cptr = startcptr; + if (_closeDataPtr == NULL) + _closeDataPtr = startClosePtr; - if (_cptr == startcptr) + if (_closeDataPtr == startClosePtr) Test = StartFileName; else - Test = _cptr->_graphicName; + Test = _closeDataPtr->_graphicName; if (strcmp(Test, TextFileName)) { monitorPage = 0; @@ -475,42 +475,42 @@ void LabEngine::processMonitor(char *ntext, TextFont *monitorFont, bool isintera // Make sure we check the music at least after every message _music->updateMusic(); - Msg = getMsg(); + msg = getMsg(); - if (Msg == NULL) { + if (msg == NULL) { _music->updateMusic(); } else { - Class = Msg->_msgClass; - Qualifier = Msg->_qualifier; - MouseX = Msg->_mouseX; - MouseY = Msg->_mouseY; - Code = Msg->_code; - - if (((Class == MOUSEBUTTONS) && (IEQUALIFIER_RBUTTON & Qualifier)) || - ((Class == RAWKEY) && (Code == 27))) + msgClass = msg->_msgClass; + qualifier = msg->_qualifier; + mouseX = msg->_mouseX; + mouseY = msg->_mouseY; + code = msg->_code; + + if (((msgClass == MOUSEBUTTONS) && (IEQUALIFIER_RBUTTON & qualifier)) || + ((msgClass == RAWKEY) && (code == 27))) return; - else if ((Class == MOUSEBUTTONS) && (IEQUALIFIER_LEFTBUTTON & Qualifier)) { - if ((MouseY >= g_lab->_utils->vgaScaleY(171)) && (MouseY <= g_lab->_utils->vgaScaleY(200))) { - if ((MouseX >= g_lab->_utils->vgaScaleX(259)) && (MouseX <= g_lab->_utils->vgaScaleX(289))) { + else if ((msgClass == MOUSEBUTTONS) && (IEQUALIFIER_LEFTBUTTON & qualifier)) { + if ((mouseY >= g_lab->_utils->vgaScaleY(171)) && (mouseY <= g_lab->_utils->vgaScaleY(200))) { + if ((mouseX >= g_lab->_utils->vgaScaleX(259)) && (mouseX <= g_lab->_utils->vgaScaleX(289))) { if (!lastpage) { monitorPage += 1; drawMonText(ntext, monitorFont, x1, y1, x2, y2, isinteractive); } - } else if ((MouseX >= g_lab->_utils->vgaScaleX(0)) && (MouseX <= g_lab->_utils->vgaScaleX(31))) { + } else if ((mouseX >= g_lab->_utils->vgaScaleX(0)) && (mouseX <= g_lab->_utils->vgaScaleX(31))) { return; - } else if ((MouseX >= g_lab->_utils->vgaScaleX(290)) && (MouseX <= g_lab->_utils->vgaScaleX(320))) { + } else if ((mouseX >= g_lab->_utils->vgaScaleX(290)) && (mouseX <= g_lab->_utils->vgaScaleX(320))) { if (monitorPage >= 1) { monitorPage -= 1; drawMonText(ntext, monitorFont, x1, y1, x2, y2, isinteractive); } - } else if ((MouseX >= g_lab->_utils->vgaScaleX(31)) && (MouseX <= g_lab->_utils->vgaScaleX(59))) { + } else if ((mouseX >= g_lab->_utils->vgaScaleX(31)) && (mouseX <= g_lab->_utils->vgaScaleX(59))) { if (isinteractive) { monitorPage = 0; if (depth) { depth--; - _cptr = lastcptr[depth]; + _closeDataPtr = lastClosePtr[depth]; } } else if (monitorPage > 0) { monitorPage = 0; @@ -518,13 +518,13 @@ void LabEngine::processMonitor(char *ntext, TextFont *monitorFont, bool isintera } } } else if (isinteractive) { - testcptr = _cptr; - MouseY = 64 + (MouseY / MonGadHeight) * 42; - MouseX = 101; - setCurClose(Common::Point(MouseX, MouseY), &_cptr, false); + CloseDataPtr tmpClosePtr = _closeDataPtr; + mouseY = 64 + (mouseY / MonGadHeight) * 42; + mouseX = 101; + setCurrentClose(Common::Point(mouseX, mouseY), &_closeDataPtr, false); - if (testcptr != _cptr) { - lastcptr[depth] = testcptr; + if (tmpClosePtr != _closeDataPtr) { + lastClosePtr[depth] = tmpClosePtr; depth++; } } diff --git a/engines/lab/transitions.cpp b/engines/lab/transitions.cpp index df3c777924..d70da5c548 100644 --- a/engines/lab/transitions.cpp +++ b/engines/lab/transitions.cpp @@ -241,7 +241,7 @@ void DisplayMan::doScrollBounce() { /** * Does the transporter wipe. */ -void DisplayMan::doTransWipe(CloseDataPtr *cPtr, char *filename) { +void DisplayMan::doTransWipe(CloseDataPtr *closePtrList, char *filename) { uint16 lastY, curY, linesdone = 0, lineslast; Image imSource, imDest; @@ -277,11 +277,11 @@ void DisplayMan::doTransWipe(CloseDataPtr *cPtr, char *filename) { } // for j if (filename == NULL) - _vm->_curFileName = _vm->getPictName(cPtr); + _vm->_curFileName = _vm->getPictName(closePtrList); else if (filename[0] > ' ') _vm->_curFileName = filename; else - _vm->_curFileName = _vm->getPictName(cPtr); + _vm->_curFileName = _vm->getPictName(closePtrList); byte *BitMapMem = readPictToMem(_vm->_curFileName, _screenWidth, lastY + 5); setPalette(_vm->_anim->_diffPalette, 256); @@ -324,11 +324,11 @@ void DisplayMan::doTransWipe(CloseDataPtr *cPtr, char *filename) { /** * Does a certain number of pre-programmed wipes. */ -void DisplayMan::doTransition(TransitionType transitionType, CloseDataPtr *cPtr, char *filename) { +void DisplayMan::doTransition(TransitionType transitionType, CloseDataPtr *closePtrList, char *filename) { switch (transitionType) { case kTransitionWipe: case kTransitionTransporter: - doTransWipe(cPtr, filename); + doTransWipe(closePtrList, filename); break; case kTransitionScrollWipe: doScrollWipe(filename); diff --git a/engines/lab/utils.cpp b/engines/lab/utils.cpp index b552a40675..c7f19cf5ff 100644 --- a/engines/lab/utils.cpp +++ b/engines/lab/utils.cpp @@ -411,4 +411,14 @@ void Utils::unDiff(byte *newBuf, byte *oldBuf, byte *diffData, uint16 bytesPerRo void Utils::setBytesPerRow(int num) { _dataBytesPerRow = num; } + +/** + * Generates a random number. + */ +uint16 Utils::getRandom(uint16 max) { + uint32 secs, micros; + + g_lab->getTime(&secs, µs); + return ((micros + secs) % max); +} } // End of namespace Lab diff --git a/engines/lab/utils.h b/engines/lab/utils.h index 441473672c..59a0d4be56 100644 --- a/engines/lab/utils.h +++ b/engines/lab/utils.h @@ -57,6 +57,7 @@ public: void runLengthDecode(byte *dest, byte *source); void VRunLengthDecode(byte *dest, byte *source, uint16 bytesPerRow); void setBytesPerRow(int num); + uint16 getRandom(uint16 max); }; -- cgit v1.2.3 From 72c08cfc8c3d9f19e21592206995578b90345f8a Mon Sep 17 00:00:00 2001 From: Strangerke Date: Wed, 9 Dec 2015 11:30:12 +0100 Subject: LAB: Move mapScale functions to the utility class --- engines/lab/map.cpp | 50 ++++++++++++++++++-------------------------------- engines/lab/utils.cpp | 17 ++++++++++++++++- engines/lab/utils.h | 2 ++ 3 files changed, 36 insertions(+), 33 deletions(-) diff --git a/engines/lab/map.cpp b/engines/lab/map.cpp index 6bf77c48fe..544627cf55 100644 --- a/engines/lab/map.cpp +++ b/engines/lab/map.cpp @@ -64,20 +64,6 @@ enum MapFloor { kFloorCarnival }; -static uint16 mapScaleX(uint16 x) { - if (g_lab->_isHiRes) - return (x - 45); - else - return ((x - 45) >> 1); -} - -static uint16 mapScaleY(uint16 y) { - if (g_lab->_isHiRes) - return y; - else - return ((y - 35) >> 1) - (y >> 6); -} - /** * Loads in the map data. */ @@ -160,8 +146,8 @@ static void roomCoords(uint16 curRoom, uint16 *x1, uint16 *y1, uint16 *x2, uint1 break; } - *x1 = mapScaleX(Maps[curRoom]._x); - *y1 = mapScaleY(Maps[curRoom]._y); + *x1 = g_lab->_utils->mapScaleX(Maps[curRoom]._x); + *y1 = g_lab->_utils->mapScaleY(Maps[curRoom]._y); *x2 = *x1; *y2 = *y1; @@ -178,8 +164,8 @@ static void drawRoomMap(uint16 curRoom, bool drawx) { uint16 x, y, xx, xy, offset; uint32 flags; - x = mapScaleX(Maps[curRoom]._x); - y = mapScaleY(Maps[curRoom]._y); + x = g_lab->_utils->mapScaleX(Maps[curRoom]._x); + y = g_lab->_utils->mapScaleY(Maps[curRoom]._y); flags = Maps[curRoom]._mapFlags; switch (Maps[curRoom]._specialID) { @@ -416,19 +402,19 @@ void LabEngine::drawMap(uint16 curRoom, uint16 curMsg, uint16 flr, bool fadeout, // Labyrinth specific code if (flr == kFloorLower) { if (onFloor(kFloorSurMaze)) - Maze->drawImage(mapScaleX(538), mapScaleY(277)); + Maze->drawImage(_utils->mapScaleX(538), _utils->mapScaleY(277)); } else if (flr == kFloorMiddle) { if (onFloor(kFloorCarnival)) - Maze->drawImage(mapScaleX(358), mapScaleY(72)); + Maze->drawImage(_utils->mapScaleX(358), _utils->mapScaleY(72)); if (onFloor(kFloorMedMaze)) - Maze->drawImage(mapScaleX(557), mapScaleY(325)); + Maze->drawImage(_utils->mapScaleX(557), _utils->mapScaleY(325)); } else if (flr == kFloorUpper) { if (onFloor(kFloorHedgeMaze)) - HugeMaze->drawImage(mapScaleX(524), mapScaleY(97)); + HugeMaze->drawImage(_utils->mapScaleX(524), _utils->mapScaleY(97)); } else if (flr == kFloorSurMaze) { sptr = (char *)_resource->getStaticText(kTextSurmazeMessage).c_str(); - _graphics->flowText(_msgFont, 0, 7, 0, true, true, true, true, mapScaleX(360), 0, mapScaleX(660), mapScaleY(450), sptr); + _graphics->flowText(_msgFont, 0, 7, 0, true, true, true, true, _utils->mapScaleX(360), 0, _utils->mapScaleX(660), _utils->mapScaleY(450), sptr); } if (flr >= kFloorLower && flr <= kFloorCarnival) { @@ -528,39 +514,39 @@ void LabEngine::processMap(uint16 curRoom) { curFloor = oldFloor; } } else if ((msgClass == MOUSEBUTTONS) && (IEQUALIFIER_LEFTBUTTON & qualifier)) { - if ((curFloor == kFloorLower) && (mouseX >= mapScaleX(538)) && (mouseY >= mapScaleY(277)) - && (mouseX <= mapScaleX(633)) && (mouseY <= mapScaleY(352)) + if ((curFloor == kFloorLower) && (mouseX >= _utils->mapScaleX(538)) && (mouseY >= _utils->mapScaleY(277)) + && (mouseX <= _utils->mapScaleX(633)) && (mouseY <= _utils->mapScaleY(352)) && onFloor(kFloorSurMaze)) { curFloor = kFloorSurMaze; _graphics->fade(false, 0); drawMap(curRoom, curMsg, curFloor, false, false); _graphics->fade(true, 0); - } else if ((curFloor == kFloorMiddle) && (mouseX >= mapScaleX(358)) && (mouseY >= mapScaleY(71)) - && (mouseX <= mapScaleX(452)) && (mouseY <= mapScaleY(147)) + } else if ((curFloor == kFloorMiddle) && (mouseX >= _utils->mapScaleX(358)) && (mouseY >= _utils->mapScaleY(71)) + && (mouseX <= _utils->mapScaleX(452)) && (mouseY <= _utils->mapScaleY(147)) && onFloor(kFloorCarnival)) { curFloor = kFloorCarnival; _graphics->fade(false, 0); drawMap(curRoom, curMsg, curFloor, false, false); _graphics->fade(true, 0); - } else if ((curFloor == kFloorMiddle) && (mouseX >= mapScaleX(557)) && (mouseY >= mapScaleY(325)) - && (mouseX <= mapScaleX(653)) && (mouseY <= mapScaleY(401)) + } else if ((curFloor == kFloorMiddle) && (mouseX >= _utils->mapScaleX(557)) && (mouseY >= _utils->mapScaleY(325)) + && (mouseX <= _utils->mapScaleX(653)) && (mouseY <= _utils->mapScaleY(401)) && onFloor(kFloorMedMaze)) { curFloor = kFloorMedMaze; _graphics->fade(false, 0); drawMap(curRoom, curMsg, curFloor, false, false); _graphics->fade(true, 0); - } else if ((curFloor == kFloorUpper) && (mouseX >= mapScaleX(524)) && (mouseY >= mapScaleY(97)) - && (mouseX <= mapScaleX(645)) && (mouseY <= mapScaleY(207)) + } else if ((curFloor == kFloorUpper) && (mouseX >= _utils->mapScaleX(524)) && (mouseY >= _utils->mapScaleY(97)) + && (mouseX <= _utils->mapScaleX(645)) && (mouseY <= _utils->mapScaleY(207)) && onFloor(kFloorHedgeMaze)) { curFloor = kFloorHedgeMaze; _graphics->fade(false, 0); drawMap(curRoom, curMsg, curFloor, false, false); _graphics->fade(true, 0); - } else if (mouseX > mapScaleX(314)) { + } else if (mouseX > _utils->mapScaleX(314)) { uint16 oldMsg = curMsg; uint16 x1, y1, x2, y2; diff --git a/engines/lab/utils.cpp b/engines/lab/utils.cpp index c7f19cf5ff..a9429de4c2 100644 --- a/engines/lab/utils.cpp +++ b/engines/lab/utils.cpp @@ -418,7 +418,22 @@ void Utils::setBytesPerRow(int num) { uint16 Utils::getRandom(uint16 max) { uint32 secs, micros; - g_lab->getTime(&secs, µs); + _vm->getTime(&secs, µs); return ((micros + secs) % max); } + +uint16 Utils::mapScaleX(uint16 x) { + if (_vm->_isHiRes) + return (x - 45); + else + return ((x - 45) >> 1); +} + +uint16 Utils::mapScaleY(uint16 y) { + if (_vm->_isHiRes) + return y; + else + return ((y - 35) >> 1) - (y >> 6); +} + } // End of namespace Lab diff --git a/engines/lab/utils.h b/engines/lab/utils.h index 59a0d4be56..ac036adf2d 100644 --- a/engines/lab/utils.h +++ b/engines/lab/utils.h @@ -52,6 +52,8 @@ public: int16 vgaScaleX(int16 x); int16 vgaScaleY(int16 y); uint16 svgaCord(uint16 cord); + uint16 mapScaleX(uint16 x); + uint16 mapScaleY(uint16 y); Common::Point vgaUnscale(Common::Point pos); void unDiff(byte *newBuf, byte *oldBuf, byte *diffData, uint16 bytesperrow, bool isV); void runLengthDecode(byte *dest, byte *source); -- cgit v1.2.3 From 1e9ee6ef4a6fca9f268cf642a239f88a5cc1ec84 Mon Sep 17 00:00:00 2001 From: Strangerke Date: Wed, 9 Dec 2015 11:49:10 +0100 Subject: LAB: Some refactoring and renaming in map.cpp --- engines/lab/lab.h | 2 +- engines/lab/map.cpp | 69 +++++++++++++++++++++++++++-------------------------- 2 files changed, 36 insertions(+), 35 deletions(-) diff --git a/engines/lab/lab.h b/engines/lab/lab.h index a490ad7d08..8f3e00f4cc 100644 --- a/engines/lab/lab.h +++ b/engines/lab/lab.h @@ -225,8 +225,8 @@ private: void doCombination(); void showCombination(const char *filename); void initTilePuzzle(); - bool saveRestoreGame(); + Common::Rect roomCoords(uint16 curRoom); public: void doActions(Action *actionList, CloseDataPtr *closePtrList); diff --git a/engines/lab/map.cpp b/engines/lab/map.cpp index 544627cf55..2bf261da7a 100644 --- a/engines/lab/map.cpp +++ b/engines/lab/map.cpp @@ -123,8 +123,8 @@ void LabEngine::freeMapData() { /** * Figures out what a room's coordinates should be. */ -static void roomCoords(uint16 curRoom, uint16 *x1, uint16 *y1, uint16 *x2, uint16 *y2) { - Image *curRoomImg = NULL; +Common::Rect LabEngine::roomCoords(uint16 curRoom) { + Image *curRoomImg = nullptr; switch (Maps[curRoom]._specialID) { case NORMAL: @@ -146,27 +146,28 @@ static void roomCoords(uint16 curRoom, uint16 *x1, uint16 *y1, uint16 *x2, uint1 break; } - *x1 = g_lab->_utils->mapScaleX(Maps[curRoom]._x); - *y1 = g_lab->_utils->mapScaleY(Maps[curRoom]._y); - *x2 = *x1; - *y2 = *y1; + int x1 = _utils->mapScaleX(Maps[curRoom]._x); + int y1 = _utils->mapScaleY(Maps[curRoom]._y); + int x2 = x1; + int y2 = y1; if (curRoomImg) { - *x2 += curRoomImg->_width; - *y2 += curRoomImg->_height; + x2 += curRoomImg->_width; + y2 += curRoomImg->_height; } + + return Common::Rect(x1, y1, x2, y2); } /** * Draws a room map. */ -static void drawRoomMap(uint16 curRoom, bool drawx) { - uint16 x, y, xx, xy, offset; - uint32 flags; +static void drawRoomMap(uint16 curRoom, bool drawMarkFl) { + uint16 drawX, drawY, offset; - x = g_lab->_utils->mapScaleX(Maps[curRoom]._x); - y = g_lab->_utils->mapScaleY(Maps[curRoom]._y); - flags = Maps[curRoom]._mapFlags; + uint16 x = g_lab->_utils->mapScaleX(Maps[curRoom]._x); + uint16 y = g_lab->_utils->mapScaleY(Maps[curRoom]._y); + uint32 flags = Maps[curRoom]._mapFlags; switch (Maps[curRoom]._specialID) { case NORMAL: @@ -195,16 +196,16 @@ static void drawRoomMap(uint16 curRoom, bool drawx) { if (WESTDOOR & flags) Path->drawImage(x - Path->_width, y + offset); - xx = x + (Room->_width - XMark->_width) / 2; - xy = y + (Room->_height - XMark->_height) / 2; + drawX = x + (Room->_width - XMark->_width) / 2; + drawY = y + (Room->_height - XMark->_height) / 2; break; case BRIDGEROOM: Bridge->drawImage(x, y); - xx = x + (Bridge->_width - XMark->_width) / 2; - xy = y + (Bridge->_height - XMark->_height) / 2; + drawX = x + (Bridge->_width - XMark->_width) / 2; + drawY = y + (Bridge->_height - XMark->_height) / 2; break; @@ -241,8 +242,8 @@ static void drawRoomMap(uint16 curRoom, bool drawx) { if (WESTMDOOR & flags) Path->drawImage(x - Path->_width, y - offset - Path->_height + VRoom->_height); - xx = x + (VRoom->_width - XMark->_width) / 2; - xy = y + (VRoom->_height - XMark->_height) / 2; + drawX = x + (VRoom->_width - XMark->_width) / 2; + drawY = y + (VRoom->_height - XMark->_height) / 2; break; @@ -279,8 +280,8 @@ static void drawRoomMap(uint16 curRoom, bool drawx) { if (WESTDOOR & flags) Path->drawImage(x - Path->_width, y + offset); - xx = x + (HRoom->_width - XMark->_width) / 2; - xy = y + (HRoom->_height - XMark->_height) / 2; + drawX = x + (HRoom->_width - XMark->_width) / 2; + drawY = y + (HRoom->_height - XMark->_height) / 2; break; @@ -288,12 +289,12 @@ static void drawRoomMap(uint16 curRoom, bool drawx) { return; } - if (drawx) - XMark->drawImage(xx, xy); + if (drawMarkFl) + XMark->drawImage(drawX, drawY); } /** - * Checks if a floor has been visitted. + * Checks if a floor has been visited. */ static bool onFloor(uint16 flr) { for (uint16 i = 1; i <= MaxRooms; i++) { @@ -548,15 +549,13 @@ void LabEngine::processMap(uint16 curRoom) { _graphics->fade(true, 0); } else if (mouseX > _utils->mapScaleX(314)) { uint16 oldMsg = curMsg; - uint16 x1, y1, x2, y2; + Common::Rect curCoords; for (uint16 i = 1; i <= MaxRooms; i++) { - roomCoords(i, &x1, &y1, &x2, &y2); + curCoords = roomCoords(i); if ((Maps[i]._pageNumber == curFloor) - && _roomsFound->in(i) - && (mouseX >= x1) && (mouseX <= x2) - && (mouseY >= y1) && (mouseY <= y2)) { + && _roomsFound->in(i) && curCoords.contains(Common::Point(mouseX, mouseY))) { curMsg = i; } } @@ -575,13 +574,15 @@ void LabEngine::processMap(uint16 curRoom) { if (Maps[oldMsg]._pageNumber == curFloor) drawRoomMap(oldMsg, (bool)(oldMsg == curRoom)); - roomCoords(curMsg, &x1, &y1, &x2, &y2); - x1 = (x1 + x2) / 2; - y1 = (y1 + y2) / 2; + curCoords = roomCoords(curMsg); + int right = (curCoords.left + curCoords.right) / 2; + int left = right - 1; + int top, bottom; + top = bottom = (curCoords.top + curCoords.bottom) / 2; if ((curMsg != curRoom) && (Maps[curMsg]._pageNumber == curFloor)) { _graphics->setAPen(1); - _graphics->rectFill(x1 - 1, y1, x1, y1); + _graphics->rectFill(left, top, right, bottom); } _event->mouseShow(); -- cgit v1.2.3 From 2d90f8a08daf6a6b89ce2c4dd2ac11c03c4c4532 Mon Sep 17 00:00:00 2001 From: Strangerke Date: Wed, 9 Dec 2015 18:09:46 +0100 Subject: LAB: Move map function to LabEngine class, some renaming --- engines/lab/lab.cpp | 34 ++++++ engines/lab/lab.h | 30 +++-- engines/lab/map.cpp | 346 +++++++++++++++++++++++++++------------------------- 3 files changed, 236 insertions(+), 174 deletions(-) diff --git a/engines/lab/lab.cpp b/engines/lab/lab.cpp index 4bf9aa3155..7a80f64f9c 100644 --- a/engines/lab/lab.cpp +++ b/engines/lab/lab.cpp @@ -78,6 +78,7 @@ LabEngine::LabEngine(OSystem *syst, const ADGameDescription *gameDesc) _highestCondition = 0; _crumbSecs = 0; _crumbMicros = 0; + _maxRooms = 0; _event = nullptr; _resource = nullptr; @@ -110,6 +111,23 @@ LabEngine::LabEngine(OSystem *syst, const ADGameDescription *gameDesc) _msgFont = nullptr; _inventory = nullptr; + _imgMap = nullptr; + _imgRoom = nullptr; + _imgUpArrowRoom = nullptr; + _imgDownArrowRoom = nullptr; + _imgBridge = nullptr; + _imgHRoom = nullptr; + _imgVRoom = nullptr; + _imgMaze = nullptr; + _imgHugeMaze = nullptr; + _imgPath = nullptr; + _imgMapNorth = nullptr; + _imgMapEast = nullptr; + _imgMapSouth = nullptr; + _imgMapWest = nullptr; + _imgXMark = nullptr; + _maps = nullptr; + initTilePuzzle(); //const Common::FSNode gameDataDir(ConfMan.get("path")); @@ -130,6 +148,22 @@ LabEngine::~LabEngine() { delete _graphics; delete[] _rooms; delete _utils; + delete _imgMap; + delete _imgRoom; + delete _imgUpArrowRoom; + delete _imgDownArrowRoom; + delete _imgBridge; + delete _imgHRoom; + delete _imgVRoom; + delete _imgMaze; + delete _imgHugeMaze; + delete _imgPath; + delete _imgMapNorth; + delete _imgMapEast; + delete _imgMapSouth; + delete _imgMapWest; + delete _imgXMark; + delete _maps; for (int i = 0; i < 16; i++) delete _tiles[i]; diff --git a/engines/lab/lab.h b/engines/lab/lab.h index 8f3e00f4cc..4170f09077 100644 --- a/engines/lab/lab.h +++ b/engines/lab/lab.h @@ -40,21 +40,22 @@ struct ADGameDescription; namespace Lab { +struct MapData; struct Action; -class Anim; struct CloseData; -class DisplayMan; -class EventManager; struct Gadget; -class Image; struct IntuiMessage; struct InventoryData; -class LargeSet; -class Music; -class Resource; struct RoomData; struct Rule; struct TextFont; +class Anim; +class DisplayMan; +class EventManager; +class Image; +class LargeSet; +class Music; +class Resource; class Utils; enum GameFeatures { @@ -169,6 +170,11 @@ private: Image *_tiles[16]; GadgetList _journalGadgetList; GadgetList _mapGadgetList; + Image *_imgMap, *_imgRoom, *_imgUpArrowRoom, *_imgDownArrowRoom, *_imgBridge; + Image *_imgHRoom, *_imgVRoom, *_imgMaze, *_imgHugeMaze, *_imgPath, *_imgMapNorth; + Image *_imgMapEast, *_imgMapSouth, *_imgMapWest, *_imgXMark; + uint16 _maxRooms; + MapData *_maps; private: bool fromCrumbs(uint32 tmpClass, uint16 code, uint16 qualifier, Common::Point tmpPos, @@ -183,9 +189,9 @@ public: Gadget *checkNumGadgetHit(GadgetList *gadgetList, uint16 key); IntuiMessage *getMsg(); void loadMapData(); - void drawMap(uint16 CurRoom, uint16 CurMsg, uint16 Floor, bool fadeout, bool fadein); - void processMap(uint16 CurRoom); - void doMap(uint16 CurRoom); + void drawMap(uint16 curRoom, uint16 curMsg, uint16 floorNum, bool fadeOut, bool fadeIn); + void processMap(uint16 curRoom); + void doMap(uint16 curRoom); void freeMapData(); void loadJournalData(); void drawJournal(uint16 wipenum, bool needFade); @@ -227,6 +233,10 @@ private: void initTilePuzzle(); bool saveRestoreGame(); Common::Rect roomCoords(uint16 curRoom); + void drawRoomMap(uint16 curRoom, bool drawMarkFl); + bool onFloor(uint16 floorNum); + bool getUpFloor(uint16 *floorNum); + bool getDownFloor(uint16 *floorNum); public: void doActions(Action *actionList, CloseDataPtr *closePtrList); diff --git a/engines/lab/map.cpp b/engines/lab/map.cpp index 2bf261da7a..c6b2277280 100644 --- a/engines/lab/map.cpp +++ b/engines/lab/map.cpp @@ -46,13 +46,6 @@ namespace Lab { /*------------------------------ The Map stuff ------------------------------*/ /*---------------------------------------------------------------------------*/ -static Image *Map, *Room, *UpArrowRoom, *DownArrowRoom, *Bridge, - *HRoom, *VRoom, *Maze, *HugeMaze, *Path, *MapNorth, - *MapEast, *MapSouth, *MapWest, *XMark; - -static uint16 MaxRooms; -static MapData *Maps; - enum MapFloor { kFloorNone, kFloorLower, @@ -68,46 +61,43 @@ enum MapFloor { * Loads in the map data. */ void LabEngine::loadMapData() { - Utils *utils = g_lab->_utils; - Common::File *mapImages = g_lab->_resource->openDataFile("P:MapImage"); - - Map = new Image(mapImages); - - Room = new Image(mapImages); - UpArrowRoom = new Image(mapImages); - DownArrowRoom = new Image(mapImages); - HRoom = new Image(mapImages); - VRoom = new Image(mapImages); - Maze = new Image(mapImages); - HugeMaze = new Image(mapImages); - - MapNorth = new Image(mapImages); - MapEast = new Image(mapImages); - MapSouth = new Image(mapImages); - MapWest = new Image(mapImages); - - Path = new Image(mapImages); - Bridge = new Image(mapImages); - - _mapGadgetList.push_back(createButton( 8, utils->vgaScaleY(105), 0, VKEY_LTARROW, new Image(mapImages), new Image(mapImages))); // back - _mapGadgetList.push_back(createButton( 55, utils->vgaScaleY(105), 1, VKEY_UPARROW, new Image(mapImages), new Image(mapImages))); // up - _mapGadgetList.push_back(createButton(101, utils->vgaScaleY(105), 2, VKEY_DNARROW, new Image(mapImages), new Image(mapImages))); // down + Common::File *mapImages = _resource->openDataFile("P:MapImage"); + + _imgMap = new Image(mapImages); + _imgRoom = new Image(mapImages); + _imgUpArrowRoom = new Image(mapImages); + _imgDownArrowRoom = new Image(mapImages); + _imgHRoom = new Image(mapImages); + _imgVRoom = new Image(mapImages); + _imgMaze = new Image(mapImages); + _imgHugeMaze = new Image(mapImages); + + _imgMapNorth = new Image(mapImages); + _imgMapEast = new Image(mapImages); + _imgMapSouth = new Image(mapImages); + _imgMapWest = new Image(mapImages); + _imgPath = new Image(mapImages); + _imgBridge = new Image(mapImages); + + _mapGadgetList.push_back(createButton( 8, _utils->vgaScaleY(105), 0, VKEY_LTARROW, new Image(mapImages), new Image(mapImages))); // back + _mapGadgetList.push_back(createButton( 55, _utils->vgaScaleY(105), 1, VKEY_UPARROW, new Image(mapImages), new Image(mapImages))); // up + _mapGadgetList.push_back(createButton(101, _utils->vgaScaleY(105), 2, VKEY_DNARROW, new Image(mapImages), new Image(mapImages))); // down delete mapImages; - Common::File *mapFile = g_lab->_resource->openDataFile("Lab:Maps", MKTAG('M', 'A', 'P', '0')); - g_lab->_music->updateMusic(); - if (!g_lab->_music->_doNotFilestopSoundEffect) - g_lab->_music->stopSoundEffect(); - - MaxRooms = mapFile->readUint16LE(); - Maps = new MapData[MaxRooms]; // will be freed when the user exits the map - for (int i = 0; i < MaxRooms; i++) { - Maps[i]._x = mapFile->readUint16LE(); - Maps[i]._y = mapFile->readUint16LE(); - Maps[i]._pageNumber = mapFile->readUint16LE(); - Maps[i]._specialID = mapFile->readUint16LE(); - Maps[i]._mapFlags = mapFile->readUint32LE(); + Common::File *mapFile = _resource->openDataFile("Lab:Maps", MKTAG('M', 'A', 'P', '0')); + _music->updateMusic(); + if (!_music->_doNotFilestopSoundEffect) + _music->stopSoundEffect(); + + _maxRooms = mapFile->readUint16LE(); + _maps = new MapData[_maxRooms]; // will be freed when the user exits the map + for (int i = 0; i < _maxRooms; i++) { + _maps[i]._x = mapFile->readUint16LE(); + _maps[i]._y = mapFile->readUint16LE(); + _maps[i]._pageNumber = mapFile->readUint16LE(); + _maps[i]._specialID = mapFile->readUint16LE(); + _maps[i]._mapFlags = mapFile->readUint32LE(); } delete mapFile; @@ -116,8 +106,40 @@ void LabEngine::loadMapData() { void LabEngine::freeMapData() { freeButtonList(&_mapGadgetList); - delete[] Maps; - Maps = NULL; + delete[] _maps; + delete _imgMap; + delete _imgRoom; + delete _imgUpArrowRoom; + delete _imgDownArrowRoom; + delete _imgBridge; + delete _imgHRoom; + delete _imgVRoom; + delete _imgMaze; + delete _imgHugeMaze; + delete _imgPath; + delete _imgMapNorth; + delete _imgMapEast; + delete _imgMapSouth; + delete _imgMapWest; + delete _imgXMark; + delete _maps; + + _imgMap = nullptr; + _imgRoom = nullptr; + _imgUpArrowRoom = nullptr; + _imgDownArrowRoom = nullptr; + _imgBridge = nullptr; + _imgHRoom = nullptr; + _imgVRoom = nullptr; + _imgMaze = nullptr; + _imgHugeMaze = nullptr; + _imgPath = nullptr; + _imgMapNorth = nullptr; + _imgMapEast = nullptr; + _imgMapSouth = nullptr; + _imgMapWest = nullptr; + _imgXMark = nullptr; + _maps = nullptr; } /** @@ -126,28 +148,28 @@ void LabEngine::freeMapData() { Common::Rect LabEngine::roomCoords(uint16 curRoom) { Image *curRoomImg = nullptr; - switch (Maps[curRoom]._specialID) { + switch (_maps[curRoom]._specialID) { case NORMAL: case UPARROWROOM: case DOWNARROWROOM: - curRoomImg = Room; + curRoomImg = _imgRoom; break; case BRIDGEROOM: - curRoomImg = Bridge; + curRoomImg = _imgBridge; break; case VCORRIDOR: - curRoomImg = VRoom; + curRoomImg = _imgVRoom; break; case HCORRIDOR: - curRoomImg = HRoom; + curRoomImg = _imgHRoom; break; default: // Some rooms (like the map) do not have an image break; } - int x1 = _utils->mapScaleX(Maps[curRoom]._x); - int y1 = _utils->mapScaleY(Maps[curRoom]._y); + int x1 = _utils->mapScaleX(_maps[curRoom]._x); + int y1 = _utils->mapScaleY(_maps[curRoom]._y); int x2 = x1; int y2 = y1; @@ -162,126 +184,126 @@ Common::Rect LabEngine::roomCoords(uint16 curRoom) { /** * Draws a room map. */ -static void drawRoomMap(uint16 curRoom, bool drawMarkFl) { +void LabEngine::drawRoomMap(uint16 curRoom, bool drawMarkFl) { uint16 drawX, drawY, offset; - uint16 x = g_lab->_utils->mapScaleX(Maps[curRoom]._x); - uint16 y = g_lab->_utils->mapScaleY(Maps[curRoom]._y); - uint32 flags = Maps[curRoom]._mapFlags; + uint16 x = _utils->mapScaleX(_maps[curRoom]._x); + uint16 y = _utils->mapScaleY(_maps[curRoom]._y); + uint32 flags = _maps[curRoom]._mapFlags; - switch (Maps[curRoom]._specialID) { + switch (_maps[curRoom]._specialID) { case NORMAL: case UPARROWROOM: case DOWNARROWROOM: - if (Maps[curRoom]._specialID == NORMAL) - Room->drawImage(x, y); - else if (Maps[curRoom]._specialID == DOWNARROWROOM) - DownArrowRoom->drawImage(x, y); + if (_maps[curRoom]._specialID == NORMAL) + _imgRoom->drawImage(x, y); + else if (_maps[curRoom]._specialID == DOWNARROWROOM) + _imgDownArrowRoom->drawImage(x, y); else - UpArrowRoom->drawImage(x, y); + _imgUpArrowRoom->drawImage(x, y); - offset = (Room->_width - Path->_width) / 2; + offset = (_imgRoom->_width - _imgPath->_width) / 2; - if ((NORTHDOOR & flags) && (y >= Path->_height)) - Path->drawImage(x + offset, y - Path->_height); + if ((NORTHDOOR & flags) && (y >= _imgPath->_height)) + _imgPath->drawImage(x + offset, y - _imgPath->_height); if (SOUTHDOOR & flags) - Path->drawImage(x + offset, y + Room->_height); + _imgPath->drawImage(x + offset, y + _imgRoom->_height); - offset = (Room->_height - Path->_height) / 2; + offset = (_imgRoom->_height - _imgPath->_height) / 2; if (EASTDOOR & flags) - Path->drawImage(x + Room->_width, y + offset); + _imgPath->drawImage(x + _imgRoom->_width, y + offset); if (WESTDOOR & flags) - Path->drawImage(x - Path->_width, y + offset); + _imgPath->drawImage(x - _imgPath->_width, y + offset); - drawX = x + (Room->_width - XMark->_width) / 2; - drawY = y + (Room->_height - XMark->_height) / 2; + drawX = x + (_imgRoom->_width - _imgXMark->_width) / 2; + drawY = y + (_imgRoom->_height - _imgXMark->_height) / 2; break; case BRIDGEROOM: - Bridge->drawImage(x, y); + _imgBridge->drawImage(x, y); - drawX = x + (Bridge->_width - XMark->_width) / 2; - drawY = y + (Bridge->_height - XMark->_height) / 2; + drawX = x + (_imgBridge->_width - _imgXMark->_width) / 2; + drawY = y + (_imgBridge->_height - _imgXMark->_height) / 2; break; case VCORRIDOR: - VRoom->drawImage(x, y); + _imgVRoom->drawImage(x, y); - offset = (VRoom->_width - Path->_width) / 2; + offset = (_imgVRoom->_width - _imgPath->_width) / 2; if (NORTHDOOR & flags) - Path->drawImage(x + offset, y - Path->_height); + _imgPath->drawImage(x + offset, y - _imgPath->_height); if (SOUTHDOOR & flags) - Path->drawImage(x + offset, y + VRoom->_height); + _imgPath->drawImage(x + offset, y + _imgVRoom->_height); - offset = (Room->_height - Path->_height) / 2; + offset = (_imgRoom->_height - _imgPath->_height) / 2; if (EASTDOOR & flags) - Path->drawImage(x + VRoom->_width, y + offset); + _imgPath->drawImage(x + _imgVRoom->_width, y + offset); if (WESTDOOR & flags) - Path->drawImage(x - Path->_width, y + offset); + _imgPath->drawImage(x - _imgPath->_width, y + offset); if (EASTBDOOR & flags) - Path->drawImage(x + VRoom->_width, y - offset - Path->_height + VRoom->_height); + _imgPath->drawImage(x + _imgVRoom->_width, y - offset - _imgPath->_height + _imgVRoom->_height); if (WESTBDOOR & flags) - Path->drawImage(x - Path->_width, y - offset - Path->_height + VRoom->_height); + _imgPath->drawImage(x - _imgPath->_width, y - offset - _imgPath->_height + _imgVRoom->_height); - offset = (VRoom->_height - Path->_height) / 2; + offset = (_imgVRoom->_height - _imgPath->_height) / 2; if (EASTMDOOR & flags) - Path->drawImage(x + VRoom->_width, y - offset - Path->_height + VRoom->_height); + _imgPath->drawImage(x + _imgVRoom->_width, y - offset - _imgPath->_height + _imgVRoom->_height); if (WESTMDOOR & flags) - Path->drawImage(x - Path->_width, y - offset - Path->_height + VRoom->_height); + _imgPath->drawImage(x - _imgPath->_width, y - offset - _imgPath->_height + _imgVRoom->_height); - drawX = x + (VRoom->_width - XMark->_width) / 2; - drawY = y + (VRoom->_height - XMark->_height) / 2; + drawX = x + (_imgVRoom->_width - _imgXMark->_width) / 2; + drawY = y + (_imgVRoom->_height - _imgXMark->_height) / 2; break; case HCORRIDOR: - HRoom->drawImage(x, y); + _imgHRoom->drawImage(x, y); - offset = (Room->_width - Path->_width) / 2; + offset = (_imgRoom->_width - _imgPath->_width) / 2; if (NORTHDOOR & flags) - Path->drawImage(x + offset, y - Path->_height); + _imgPath->drawImage(x + offset, y - _imgPath->_height); if (SOUTHDOOR & flags) - Path->drawImage(x + offset, y + Room->_height); + _imgPath->drawImage(x + offset, y + _imgRoom->_height); if (NORTHRDOOR & flags) - Path->drawImage(x - offset - Path->_width + HRoom->_width, y - Path->_height); + _imgPath->drawImage(x - offset - _imgPath->_width + _imgHRoom->_width, y - _imgPath->_height); if (SOUTHRDOOR & flags) - Path->drawImage(x - offset - Path->_width + HRoom->_width, y + Room->_height); + _imgPath->drawImage(x - offset - _imgPath->_width + _imgHRoom->_width, y + _imgRoom->_height); - offset = (HRoom->_width - Path->_width) / 2; + offset = (_imgHRoom->_width - _imgPath->_width) / 2; if (NORTHMDOOR & flags) - Path->drawImage(x - offset - Path->_width + HRoom->_width, y - Path->_height); + _imgPath->drawImage(x - offset - _imgPath->_width + _imgHRoom->_width, y - _imgPath->_height); if (SOUTHMDOOR & flags) - Path->drawImage(x - offset - Path->_width + HRoom->_width, y + Room->_height); + _imgPath->drawImage(x - offset - _imgPath->_width + _imgHRoom->_width, y + _imgRoom->_height); - offset = (Room->_height - Path->_height) / 2; + offset = (_imgRoom->_height - _imgPath->_height) / 2; if (EASTDOOR & flags) - Path->drawImage(x + HRoom->_width, y + offset); + _imgPath->drawImage(x + _imgHRoom->_width, y + offset); if (WESTDOOR & flags) - Path->drawImage(x - Path->_width, y + offset); + _imgPath->drawImage(x - _imgPath->_width, y + offset); - drawX = x + (HRoom->_width - XMark->_width) / 2; - drawY = y + (HRoom->_height - XMark->_height) / 2; + drawX = x + (_imgHRoom->_width - _imgXMark->_width) / 2; + drawY = y + (_imgHRoom->_height - _imgXMark->_height) / 2; break; @@ -290,15 +312,15 @@ static void drawRoomMap(uint16 curRoom, bool drawMarkFl) { } if (drawMarkFl) - XMark->drawImage(drawX, drawY); + _imgXMark->drawImage(drawX, drawY); } /** * Checks if a floor has been visited. */ -static bool onFloor(uint16 flr) { - for (uint16 i = 1; i <= MaxRooms; i++) { - if ((Maps[i]._pageNumber == flr) && g_lab->_roomsFound->in(i) && Maps[i]._x) +bool LabEngine::onFloor(uint16 floorNum) { + for (uint16 i = 1; i <= _maxRooms; i++) { + if ((_maps[i]._pageNumber == floorNum) && _roomsFound->in(i) && _maps[i]._x) return true; } @@ -308,15 +330,15 @@ static bool onFloor(uint16 flr) { /** * Figures out which floor, if any, should be gone to if the up arrow is hit */ -static bool getUpFloor(uint16 *flr) { +bool LabEngine::getUpFloor(uint16 *floorNum) { do { - if (*flr < kFloorUpper) - (*flr)++; + if (*floorNum < kFloorUpper) + (*floorNum)++; else { - *flr = kFloorCarnival + 1; + *floorNum = kFloorCarnival + 1; return false; } - } while ((!onFloor(*flr)) && (*flr <= kFloorCarnival)); + } while ((!onFloor(*floorNum)) && (*floorNum <= kFloorCarnival)); return true; } @@ -325,27 +347,27 @@ static bool getUpFloor(uint16 *flr) { * Figures out which floor, if any, should be gone to if the down arrow is * hit. */ -static bool getDownFloor(uint16 *flr) { +bool LabEngine::getDownFloor(uint16 *floorNum) { do { - if ((*flr == kFloorLower) || (*flr == 0)) { - *flr = 0; + if ((*floorNum == kFloorLower) || (*floorNum == kFloorNone)) { + *floorNum = kFloorNone; return false; - } else if (*flr > kFloorUpper) { + } else if (*floorNum > kFloorUpper) { // Labyrinth specific code - if (*flr == kFloorHedgeMaze) - *flr = kFloorUpper; - else if ((*flr == kFloorCarnival) || (*flr == kFloorMedMaze)) - *flr = kFloorMiddle; - else if (*flr == kFloorSurMaze) - *flr = kFloorLower; + if (*floorNum == kFloorHedgeMaze) + *floorNum = kFloorUpper; + else if ((*floorNum == kFloorCarnival) || (*floorNum == kFloorMedMaze)) + *floorNum = kFloorMiddle; + else if (*floorNum == kFloorSurMaze) + *floorNum = kFloorLower; else { - *flr = 0; + *floorNum = kFloorNone; return false; } } else - (*flr)--; + (*floorNum)--; - } while ((!onFloor(*flr)) && *flr); + } while ((!onFloor(*floorNum)) && (*floorNum != kFloorNone)); return true; } @@ -353,20 +375,20 @@ static bool getDownFloor(uint16 *flr) { /** * Draws the map */ -void LabEngine::drawMap(uint16 curRoom, uint16 curMsg, uint16 flr, bool fadeout, bool fadein) { +void LabEngine::drawMap(uint16 curRoom, uint16 curMsg, uint16 floorNum, bool fadeOut, bool fadeIn) { _event->mouseHide(); - if (fadeout) + if (fadeOut) _graphics->fade(false, 0); _graphics->setAPen(0); _graphics->rectFill(0, 0, _graphics->_screenWidth - 1, _graphics->_screenHeight - 1); - Map->drawImage(0, 0); + _imgMap->drawImage(0, 0); drawGadgetList(&_mapGadgetList); - for (uint16 i = 1; i <= MaxRooms; i++) { - if ((Maps[i]._pageNumber == flr) && _roomsFound->in(i) && Maps[i]._x) { + for (uint16 i = 1; i <= _maxRooms; i++) { + if ((_maps[i]._pageNumber == floorNum) && _roomsFound->in(i) && _maps[i]._x) { drawRoomMap(i, (bool)(i == curRoom)); _music->updateMusic(); } @@ -375,11 +397,10 @@ void LabEngine::drawMap(uint16 curRoom, uint16 curMsg, uint16 flr, bool fadeout, // Makes sure the X is drawn in corridors // NOTE: this here on purpose just in case there's some weird // condition, like the surreal maze where there are no rooms - if ((Maps[curRoom]._pageNumber == flr) && _roomsFound->in(curRoom) && Maps[curRoom]._x) + if ((_maps[curRoom]._pageNumber == floorNum) && _roomsFound->in(curRoom) && _maps[curRoom]._x) drawRoomMap(curRoom, true); - uint16 tempfloor = flr; - + uint16 tempfloor = floorNum; bool noOverlay = getUpFloor(&tempfloor); Gadget *upGadget = _event->getGadget(1); @@ -390,7 +411,7 @@ void LabEngine::drawMap(uint16 curRoom, uint16 curMsg, uint16 flr, bool fadeout, else disableGadget(upGadget, 12); - tempfloor = flr; + tempfloor = floorNum; noOverlay = getDownFloor(&tempfloor); if (noOverlay) @@ -398,35 +419,33 @@ void LabEngine::drawMap(uint16 curRoom, uint16 curMsg, uint16 flr, bool fadeout, else disableGadget(downGadget, 12); - char *sptr; - // Labyrinth specific code - if (flr == kFloorLower) { + if (floorNum == kFloorLower) { if (onFloor(kFloorSurMaze)) - Maze->drawImage(_utils->mapScaleX(538), _utils->mapScaleY(277)); - } else if (flr == kFloorMiddle) { + _imgMaze->drawImage(_utils->mapScaleX(538), _utils->mapScaleY(277)); + } else if (floorNum == kFloorMiddle) { if (onFloor(kFloorCarnival)) - Maze->drawImage(_utils->mapScaleX(358), _utils->mapScaleY(72)); + _imgMaze->drawImage(_utils->mapScaleX(358), _utils->mapScaleY(72)); if (onFloor(kFloorMedMaze)) - Maze->drawImage(_utils->mapScaleX(557), _utils->mapScaleY(325)); - } else if (flr == kFloorUpper) { + _imgMaze->drawImage(_utils->mapScaleX(557), _utils->mapScaleY(325)); + } else if (floorNum == kFloorUpper) { if (onFloor(kFloorHedgeMaze)) - HugeMaze->drawImage(_utils->mapScaleX(524), _utils->mapScaleY(97)); - } else if (flr == kFloorSurMaze) { - sptr = (char *)_resource->getStaticText(kTextSurmazeMessage).c_str(); + _imgHugeMaze->drawImage(_utils->mapScaleX(524), _utils->mapScaleY(97)); + } else if (floorNum == kFloorSurMaze) { + char *sptr = (char *)_resource->getStaticText(kTextSurmazeMessage).c_str(); _graphics->flowText(_msgFont, 0, 7, 0, true, true, true, true, _utils->mapScaleX(360), 0, _utils->mapScaleX(660), _utils->mapScaleY(450), sptr); } - if (flr >= kFloorLower && flr <= kFloorCarnival) { - sptr = (char *)_resource->getStaticText(flr - 1).c_str(); + if ((floorNum >= kFloorLower) && (floorNum <= kFloorCarnival)) { + char *sptr = (char *)_resource->getStaticText(floorNum - 1).c_str(); _graphics->flowTextScaled(_msgFont, 0, 5, 3, true, true, true, true, 14, 75, 134, 97, sptr); } - if ((sptr = _rooms[curMsg]._roomMsg)) - _graphics->flowTextScaled(_msgFont, 0, 5, 3, true, true, true, true, 14, 148, 134, 186, sptr); + if (_rooms[curMsg]._roomMsg) + _graphics->flowTextScaled(_msgFont, 0, 5, 3, true, true, true, true, 14, 148, 134, 186, _rooms[curMsg]._roomMsg); - if (fadein) + if (fadeIn) _graphics->fade(true, 0); _event->mouseShow(); @@ -437,16 +456,15 @@ void LabEngine::drawMap(uint16 curRoom, uint16 curMsg, uint16 flr, bool fadeout, */ void LabEngine::processMap(uint16 curRoom) { uint32 place = 1; - - uint16 curMsg = curRoom; - uint16 curFloor = Maps[curRoom]._pageNumber; + uint16 curMsg = curRoom; + uint16 curFloor = _maps[curRoom]._pageNumber; while (1) { // Make sure we check the music at least after every message _music->updateMusic(); IntuiMessage *msg = getMsg(); - if (msg == NULL) { + if (!msg) { _music->updateMusic(); byte newcolor[3]; @@ -551,10 +569,10 @@ void LabEngine::processMap(uint16 curRoom) { uint16 oldMsg = curMsg; Common::Rect curCoords; - for (uint16 i = 1; i <= MaxRooms; i++) { + for (uint16 i = 1; i <= _maxRooms; i++) { curCoords = roomCoords(i); - if ((Maps[i]._pageNumber == curFloor) + if ((_maps[i]._pageNumber == curFloor) && _roomsFound->in(i) && curCoords.contains(Common::Point(mouseX, mouseY))) { curMsg = i; } @@ -571,7 +589,7 @@ void LabEngine::processMap(uint16 curRoom) { _graphics->rectFillScaled(13, 148, 135, 186); _graphics->flowTextScaled(_msgFont, 0, 5, 3, true, true, true, true, 14, 148, 134, 186, sptr); - if (Maps[oldMsg]._pageNumber == curFloor) + if (_maps[oldMsg]._pageNumber == curFloor) drawRoomMap(oldMsg, (bool)(oldMsg == curRoom)); curCoords = roomCoords(curMsg); @@ -580,7 +598,7 @@ void LabEngine::processMap(uint16 curRoom) { int top, bottom; top = bottom = (curCoords.top + curCoords.bottom) / 2; - if ((curMsg != curRoom) && (Maps[curMsg]._pageNumber == curFloor)) { + if ((curMsg != curRoom) && (_maps[curMsg]._pageNumber == curFloor)) { _graphics->setAPen(1); _graphics->rectFill(left, top, right, bottom); } @@ -614,20 +632,20 @@ void LabEngine::doMap(uint16 curRoom) { _graphics->blackAllScreen(); if (_direction == NORTH) - XMark = MapNorth; + _imgXMark = _imgMapNorth; else if (_direction == SOUTH) - XMark = MapSouth; + _imgXMark = _imgMapSouth; else if (_direction == EAST) - XMark = MapEast; + _imgXMark = _imgMapEast; else if (_direction == WEST) - XMark = MapWest; + _imgXMark = _imgMapWest; _event->attachGadgetList(&_mapGadgetList); - drawMap(curRoom, curRoom, Maps[curRoom]._pageNumber, false, true); + drawMap(curRoom, curRoom, _maps[curRoom]._pageNumber, false, true); _event->mouseShow(); _graphics->screenUpdate(); processMap(curRoom); - _event->attachGadgetList(NULL); + _event->attachGadgetList(nullptr); _graphics->fade(false, 0); _graphics->blackAllScreen(); _event->mouseHide(); -- cgit v1.2.3 From 4a9286ef2784f7fb73de3f5ce2d8f972b3da9237 Mon Sep 17 00:00:00 2001 From: Strangerke Date: Wed, 9 Dec 2015 19:52:34 +0100 Subject: LAB: Move getWord to DisplayMan --- engines/lab/dispman.cpp | 2 +- engines/lab/dispman.h | 1 + 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/engines/lab/dispman.cpp b/engines/lab/dispman.cpp index 199c9e04c8..13ffd07b59 100644 --- a/engines/lab/dispman.cpp +++ b/engines/lab/dispman.cpp @@ -138,7 +138,7 @@ void DisplayMan::freePict() { /** * Extracts the first word from a string. */ -static void getWord(char *wordBuffer, const char *mainBuffer, uint16 *wordWidth) { +void DisplayMan::getWord(char *wordBuffer, const char *mainBuffer, uint16 *wordWidth) { uint16 width = 0; while ((mainBuffer[width] != ' ') && mainBuffer[width] && (mainBuffer[width] != '\n')) { diff --git a/engines/lab/dispman.h b/engines/lab/dispman.h index 5b6217bb60..5938198b87 100644 --- a/engines/lab/dispman.h +++ b/engines/lab/dispman.h @@ -62,6 +62,7 @@ private: uint16 fadeNumIn(uint16 num, uint16 res, uint16 counter); uint16 fadeNumOut(uint16 num, uint16 res, uint16 counter); + void getWord(char *wordBuffer, const char *mainBuffer, uint16 *wordWidth); byte _curapen; byte *_curBitmap; -- cgit v1.2.3 From 8e88d3102541683595865b0c9bac59a854c6cdba Mon Sep 17 00:00:00 2001 From: Strangerke Date: Wed, 9 Dec 2015 19:53:23 +0100 Subject: LAB: Move processroom functions to LabEngine --- engines/lab/engine.cpp | 4 +- engines/lab/lab.h | 16 ++++++ engines/lab/processroom.cpp | 129 ++++++++++++++++++++++---------------------- engines/lab/processroom.h | 11 ---- 4 files changed, 83 insertions(+), 77 deletions(-) diff --git a/engines/lab/engine.cpp b/engines/lab/engine.cpp index 5f6f9f96e9..4cfdd454f9 100644 --- a/engines/lab/engine.cpp +++ b/engines/lab/engine.cpp @@ -980,7 +980,7 @@ bool LabEngine::fromCrumbs(uint32 tmpClass, uint16 code, uint16 qualifier, Commo } else if (actionMode == 4) { // Look at closeups CloseDataPtr tmpClosePtr = _closeDataPtr; - setCurrentClose(curPos, &tmpClosePtr); + setCurrentClose(curPos, &tmpClosePtr, true); if (_closeDataPtr == tmpClosePtr) { if (curPos.y < (_utils->vgaScaleY(149) + _utils->svgaCord(2))) @@ -1013,7 +1013,7 @@ bool LabEngine::fromCrumbs(uint32 tmpClass, uint16 code, uint16 qualifier, Commo if (!wrkClosePtr) { CloseDataPtr tmpClosePtr = _closeDataPtr; - setCurrentClose(curPos, &tmpClosePtr); + setCurrentClose(curPos, &tmpClosePtr, true); if (!tmpClosePtr || (tmpClosePtr == _closeDataPtr)) { if (!_closeDataPtr) diff --git a/engines/lab/lab.h b/engines/lab/lab.h index 4170f09077..b407f319bf 100644 --- a/engines/lab/lab.h +++ b/engines/lab/lab.h @@ -49,6 +49,8 @@ struct InventoryData; struct RoomData; struct Rule; struct TextFont; +struct ViewData; + class Anim; class DisplayMan; class EventManager; @@ -237,6 +239,20 @@ private: bool onFloor(uint16 floorNum); bool getUpFloor(uint16 *floorNum); bool getDownFloor(uint16 *floorNum); + bool checkConditions(int16 *condition); + ViewData *getViewData(uint16 roomNum, uint16 direction); + CloseData *getObject(Common::Point pos, CloseDataPtr closePtr); + CloseDataPtr findClosePtrMatch(CloseDataPtr closePtr, CloseDataPtr closePtrList); + uint16 processArrow(uint16 curDirection, uint16 arrow); + void setCurrentClose(Common::Point pos, CloseDataPtr *closePtrList, bool useAbsoluteCoords); + bool takeItem(uint16 x, uint16 y, CloseDataPtr *closePtrList); + bool doActionRuleSub(int16 action, int16 roomNum, CloseDataPtr closePtr, CloseDataPtr *setCloseList, bool allowDefaults); + bool doActionRule(Common::Point pos, int16 action, int16 roomNum, CloseDataPtr *closePtrList); + bool doOperateRuleSub(int16 itemNum, int16 roomNum, CloseDataPtr closePtr, CloseDataPtr *setCloseList, bool allowDefaults); + bool doOperateRule(Common::Point pos, int16 ItemNum, CloseDataPtr *closePtrList); + bool doGoForward(CloseDataPtr *closePtrList); + bool doTurn(uint16 from, uint16 to, CloseDataPtr *closePtrList); + bool doMainView(CloseDataPtr *closePtrList); public: void doActions(Action *actionList, CloseDataPtr *closePtrList); diff --git a/engines/lab/processroom.cpp b/engines/lab/processroom.cpp index be03a0dcaf..49287aeeba 100644 --- a/engines/lab/processroom.cpp +++ b/engines/lab/processroom.cpp @@ -47,7 +47,7 @@ namespace Lab { /** * Checks whether all the conditions in a condition list are met. */ -static bool checkConditions(int16 *condition) { +bool LabEngine::checkConditions(int16 *condition) { if (!condition) return true; @@ -55,10 +55,10 @@ static bool checkConditions(int16 *condition) { return true; int counter = 1; - bool res = g_lab->_conditions->in(condition[0]); + bool res = _conditions->in(condition[0]); while (condition[counter] && res) { - res = g_lab->_conditions->in(condition[counter]); + res = _conditions->in(condition[counter]); counter++; } @@ -68,11 +68,11 @@ static bool checkConditions(int16 *condition) { /** * Gets the current ViewDataPointer. */ -ViewData *getViewData(uint16 roomNum, uint16 direction) { - if (!g_lab->_rooms[roomNum]._roomMsg) - g_lab->_resource->readViews(roomNum); +ViewData *LabEngine::getViewData(uint16 roomNum, uint16 direction) { + if (!_rooms[roomNum]._roomMsg) + _resource->readViews(roomNum); - ViewData *view = g_lab->_rooms[roomNum]._view[direction]; + ViewData *view = _rooms[roomNum]._view[direction]; do { if (checkConditions(view->_condition)) @@ -87,18 +87,19 @@ ViewData *getViewData(uint16 roomNum, uint16 direction) { /** * Gets an object, if any, from the user's click on the screen. */ -static CloseData *getObject(Common::Point pos, CloseDataPtr closePtr) { - if (closePtr == nullptr) - closePtr = getViewData(g_lab->_roomNum, g_lab->_direction)->_closeUps; +CloseData *LabEngine::getObject(Common::Point pos, CloseDataPtr closePtr) { + CloseDataPtr wrkClosePtr; + if (!closePtr) + wrkClosePtr = getViewData(_roomNum, _direction)->_closeUps; else - closePtr = closePtr->_subCloseUps; + wrkClosePtr = closePtr->_subCloseUps; - while (closePtr) { - if ((pos.x >= g_lab->_utils->scaleX(closePtr->_x1)) && (pos.y >= g_lab->_utils->scaleY(closePtr->_y1)) && - (pos.x <= g_lab->_utils->scaleX(closePtr->_x2)) && (pos.y <= g_lab->_utils->scaleY(closePtr->_y2))) - return closePtr; + while (wrkClosePtr) { + if ((pos.x >= _utils->scaleX(wrkClosePtr->_x1)) && (pos.y >= _utils->scaleY(wrkClosePtr->_y1)) && + (pos.x <= _utils->scaleX(wrkClosePtr->_x2)) && (pos.y <= _utils->scaleY(wrkClosePtr->_y2))) + return wrkClosePtr; - closePtr = closePtr->_nextCloseUp; + wrkClosePtr = wrkClosePtr->_nextCloseUp; } return nullptr; @@ -110,7 +111,7 @@ static CloseData *getObject(Common::Point pos, CloseDataPtr closePtr) { * some of the closeups have the same hit boxes, then this returns the * first occurrence of the object with the same hit box. */ -static CloseDataPtr findClosePtrMatch(CloseDataPtr closePtr, CloseDataPtr closePtrList) { +CloseDataPtr LabEngine::findClosePtrMatch(CloseDataPtr closePtr, CloseDataPtr closePtrList) { CloseDataPtr resClosePtr; while (closePtrList) { @@ -177,21 +178,21 @@ void LabEngine::drawDirection(CloseDataPtr closePtr) { /** * process a arrow gadget movement. */ -uint16 processArrow(uint16 curDirection, uint16 arrow) { +uint16 LabEngine::processArrow(uint16 curDirection, uint16 arrow) { if (arrow == 1) { // Forward uint16 room = 1; if (curDirection == NORTH) - room = g_lab->_rooms[g_lab->_roomNum]._northDoor; + room = _rooms[_roomNum]._northDoor; else if (curDirection == SOUTH) - room = g_lab->_rooms[g_lab->_roomNum]._southDoor; + room = _rooms[_roomNum]._southDoor; else if (curDirection == EAST) - room = g_lab->_rooms[g_lab->_roomNum]._eastDoor; + room = _rooms[_roomNum]._eastDoor; else if (curDirection == WEST) - room = g_lab->_rooms[g_lab->_roomNum]._westDoor; + room = _rooms[_roomNum]._westDoor; if (room != 0) - g_lab->_roomNum = room; + _roomNum = room; return curDirection; } else if (arrow == 0) { // Left @@ -221,11 +222,11 @@ uint16 processArrow(uint16 curDirection, uint16 arrow) { /** * Sets the current close up data. */ -void setCurrentClose(Common::Point pos, CloseDataPtr *closePtrList, bool useAbsoluteCoords) { +void LabEngine::setCurrentClose(Common::Point pos, CloseDataPtr *closePtrList, bool useAbsoluteCoords) { CloseDataPtr closePtr; if (!*closePtrList) - closePtr = getViewData(g_lab->_roomNum, g_lab->_direction)->_closeUps; + closePtr = getViewData(_roomNum, _direction)->_closeUps; else closePtr = (*closePtrList)->_subCloseUps; @@ -234,7 +235,7 @@ void setCurrentClose(Common::Point pos, CloseDataPtr *closePtrList, bool useAbso if (!useAbsoluteCoords) target = Common::Rect(closePtr->_x1, closePtr->_y1, closePtr->_x2, closePtr->_y2); else - target = Common::Rect(g_lab->_utils->scaleX(closePtr->_x1), g_lab->_utils->scaleY(closePtr->_y1), g_lab->_utils->scaleX(closePtr->_x2), g_lab->_utils->scaleY(closePtr->_y2)); + target = Common::Rect(_utils->scaleX(closePtr->_x1), _utils->scaleY(closePtr->_y1), _utils->scaleX(closePtr->_x2), _utils->scaleY(closePtr->_y2)); if (target.contains(pos) && closePtr->_graphicName) { *closePtrList = closePtr; @@ -248,22 +249,22 @@ void setCurrentClose(Common::Point pos, CloseDataPtr *closePtrList, bool useAbso /** * Takes the currently selected item. */ -bool takeItem(uint16 x, uint16 y, CloseDataPtr *closePtrList) { +bool LabEngine::takeItem(uint16 x, uint16 y, CloseDataPtr *closePtrList) { CloseDataPtr closePtr; if (!*closePtrList) { - closePtr = getViewData(g_lab->_roomNum, g_lab->_direction)->_closeUps; + closePtr = getViewData(_roomNum, _direction)->_closeUps; } else if ((*closePtrList)->_closeUpType < 0) { - g_lab->_conditions->inclElement(abs((*closePtrList)->_closeUpType)); + _conditions->inclElement(abs((*closePtrList)->_closeUpType)); return true; } else closePtr = (*closePtrList)->_subCloseUps; while (closePtr) { - if ((x >= g_lab->_utils->scaleX(closePtr->_x1)) && (y >= g_lab->_utils->scaleY(closePtr->_y1)) && - (x <= g_lab->_utils->scaleX(closePtr->_x2)) && (y <= g_lab->_utils->scaleY(closePtr->_y2)) && + if ((x >= _utils->scaleX(closePtr->_x1)) && (y >= _utils->scaleY(closePtr->_y1)) && + (x <= _utils->scaleX(closePtr->_x2)) && (y <= _utils->scaleY(closePtr->_y2)) && (closePtr->_closeUpType < 0)) { - g_lab->_conditions->inclElement(abs(closePtr->_closeUpType)); + _conditions->inclElement(abs(closePtr->_closeUpType)); return true; } @@ -392,7 +393,7 @@ void LabEngine::doActions(Action *actionList, CloseDataPtr *closePtrList) { break; case SETCLOSEUP: { - Common::Point curPos = Common::Point(g_lab->_utils->scaleX(actionList->_param1), g_lab->_utils->scaleY(actionList->_param2)); + Common::Point curPos = Common::Point(_utils->scaleX(actionList->_param1), _utils->scaleY(actionList->_param2)); CloseDataPtr tmpClosePtr = getObject(curPos, *closePtrList); if (tmpClosePtr) @@ -494,7 +495,7 @@ void LabEngine::doActions(Action *actionList, CloseDataPtr *closePtrList) { break; case RESETBUFFER: - g_lab->_graphics->freePict(); + _graphics->freePict(); break; case SPECIALCMD: @@ -554,15 +555,15 @@ void LabEngine::doActions(Action *actionList, CloseDataPtr *closePtrList) { /** * Does the work for doActionRule. */ -static bool doActionRuleSub(int16 action, int16 roomNum, CloseDataPtr closePtr, CloseDataPtr *setCloseList, bool allowDefaults) { +bool LabEngine::doActionRuleSub(int16 action, int16 roomNum, CloseDataPtr closePtr, CloseDataPtr *setCloseList, bool allowDefaults) { action++; if (closePtr) { - RuleList *rules = g_lab->_rooms[g_lab->_roomNum]._rules; + RuleList *rules = _rooms[_roomNum]._rules; if (!rules && (roomNum == 0)) { - g_lab->_resource->readViews(roomNum); - rules = g_lab->_rooms[roomNum]._rules; + _resource->readViews(roomNum); + rules = _rooms[roomNum]._rules; } for (RuleList::iterator rule = rules->begin(); rule != rules->end(); ++rule) { @@ -572,7 +573,7 @@ static bool doActionRuleSub(int16 action, int16 roomNum, CloseDataPtr closePtr, (((*rule)->_param2 == 0) && allowDefaults)) || ((action == 1) && ((*rule)->_param2 == (-closePtr->_closeUpType)))) { if (checkConditions((*rule)->_condition)) { - g_lab->doActions((*rule)->_actionList, setCloseList); + doActions((*rule)->_actionList, setCloseList); return true; } } @@ -586,11 +587,11 @@ static bool doActionRuleSub(int16 action, int16 roomNum, CloseDataPtr closePtr, /** * Goes through the rules if an action is taken. */ -bool doActionRule(Common::Point pos, int16 action, int16 roomNum, CloseDataPtr *closePtrList) { +bool LabEngine::doActionRule(Common::Point pos, int16 action, int16 roomNum, CloseDataPtr *closePtrList) { if (roomNum) - g_lab->_newFileName = NOFILE; + _newFileName = NOFILE; else - g_lab->_newFileName = g_lab->_curFileName; + _newFileName = _curFileName; CloseDataPtr curClosePtr = getObject(pos, *closePtrList); @@ -609,14 +610,14 @@ bool doActionRule(Common::Point pos, int16 action, int16 roomNum, CloseDataPtr * /** * Does the work for doActionRule. */ -static bool doOperateRuleSub(int16 itemNum, int16 roomNum, CloseDataPtr closePtr, CloseDataPtr *setCloseList, bool allowDefaults) { +bool LabEngine::doOperateRuleSub(int16 itemNum, int16 roomNum, CloseDataPtr closePtr, CloseDataPtr *setCloseList, bool allowDefaults) { if (closePtr) if (closePtr->_closeUpType > 0) { - RuleList *rules = g_lab->_rooms[roomNum]._rules; + RuleList *rules = _rooms[roomNum]._rules; if (!rules && (roomNum == 0)) { - g_lab->_resource->readViews(roomNum); - rules = g_lab->_rooms[roomNum]._rules; + _resource->readViews(roomNum); + rules = _rooms[roomNum]._rules; } for (RuleList::iterator rule = rules->begin(); rule != rules->end(); ++rule) { @@ -624,7 +625,7 @@ static bool doOperateRuleSub(int16 itemNum, int16 roomNum, CloseDataPtr closePtr (((*rule)->_param1 == itemNum) || (((*rule)->_param1 == 0) && allowDefaults)) && (((*rule)->_param2 == closePtr->_closeUpType) || (((*rule)->_param2 == 0) && allowDefaults))) { if (checkConditions((*rule)->_condition)) { - g_lab->doActions((*rule)->_actionList, setCloseList); + doActions((*rule)->_actionList, setCloseList); return true; } } @@ -637,20 +638,20 @@ static bool doOperateRuleSub(int16 itemNum, int16 roomNum, CloseDataPtr closePtr /** * Goes through the rules if the user tries to operate an item on an object. */ -bool doOperateRule(Common::Point pos, int16 ItemNum, CloseDataPtr *closePtrList) { - g_lab->_newFileName = NOFILE; +bool LabEngine::doOperateRule(Common::Point pos, int16 ItemNum, CloseDataPtr *closePtrList) { + _newFileName = NOFILE; CloseDataPtr closePtr = getObject(pos, *closePtrList); - if (doOperateRuleSub(ItemNum, g_lab->_roomNum, closePtr, closePtrList, false)) + if (doOperateRuleSub(ItemNum, _roomNum, closePtr, closePtrList, false)) return true; - else if (doOperateRuleSub(ItemNum, g_lab->_roomNum, *closePtrList, closePtrList, false)) + else if (doOperateRuleSub(ItemNum, _roomNum, *closePtrList, closePtrList, false)) return true; - else if (doOperateRuleSub(ItemNum, g_lab->_roomNum, closePtr, closePtrList, true)) + else if (doOperateRuleSub(ItemNum, _roomNum, closePtr, closePtrList, true)) return true; - else if (doOperateRuleSub(ItemNum, g_lab->_roomNum, *closePtrList, closePtrList, true)) + else if (doOperateRuleSub(ItemNum, _roomNum, *closePtrList, closePtrList, true)) return true; else { - g_lab->_newFileName = g_lab->_curFileName; + _newFileName = _curFileName; if (doOperateRuleSub(ItemNum, 0, closePtr, closePtrList, false)) return true; @@ -668,14 +669,14 @@ bool doOperateRule(Common::Point pos, int16 ItemNum, CloseDataPtr *closePtrList) /** * Goes through the rules if the user tries to go forward. */ -bool doGoForward(CloseDataPtr *closePtrList) { - RuleList *rules = g_lab->_rooms[g_lab->_roomNum]._rules; +bool LabEngine::doGoForward(CloseDataPtr *closePtrList) { + RuleList *rules = _rooms[_roomNum]._rules; for (RuleList::iterator ruleIter = rules->begin(); ruleIter != rules->end(); ++ruleIter) { Rule *rule = *ruleIter; - if ((rule->_ruleType == GOFORWARD) && (rule->_param1 == (g_lab->_direction + 1))) { + if ((rule->_ruleType == GOFORWARD) && (rule->_param1 == (_direction + 1))) { if (checkConditions(rule->_condition)) { - g_lab->doActions(rule->_actionList, closePtrList); + doActions(rule->_actionList, closePtrList); return true; } } @@ -687,18 +688,18 @@ bool doGoForward(CloseDataPtr *closePtrList) { /** * Goes through the rules if the user tries to turn. */ -bool doTurn(uint16 from, uint16 to, CloseDataPtr *closePtrList) { +bool LabEngine::doTurn(uint16 from, uint16 to, CloseDataPtr *closePtrList) { from++; to++; - RuleList *rules = g_lab->_rooms[g_lab->_roomNum]._rules; + RuleList *rules = _rooms[_roomNum]._rules; for (RuleList::iterator rule = rules->begin(); rule != rules->end(); ++rule) { if (((*rule)->_ruleType == TURN) || (((*rule)->_ruleType == TURNFROMTO) && ((*rule)->_param1 == from) && ((*rule)->_param2 == to))) { if (checkConditions((*rule)->_condition)) { - g_lab->doActions((*rule)->_actionList, closePtrList); + doActions((*rule)->_actionList, closePtrList); return true; } } @@ -710,12 +711,12 @@ bool doTurn(uint16 from, uint16 to, CloseDataPtr *closePtrList) { /** * Goes through the rules if the user tries to go to the main view */ -bool doMainView(CloseDataPtr *closePtrList) { - RuleList *rules = g_lab->_rooms[g_lab->_roomNum]._rules; +bool LabEngine::doMainView(CloseDataPtr *closePtrList) { + RuleList *rules = _rooms[_roomNum]._rules; for (RuleList::iterator rule = rules->begin(); rule != rules->end(); ++rule) { if ((*rule)->_ruleType == GOMAINVIEW) { if (checkConditions((*rule)->_condition)) { - g_lab->doActions((*rule)->_actionList, closePtrList); + doActions((*rule)->_actionList, closePtrList); return true; } } diff --git a/engines/lab/processroom.h b/engines/lab/processroom.h index 20b6946607..ff594dadc7 100644 --- a/engines/lab/processroom.h +++ b/engines/lab/processroom.h @@ -185,17 +185,6 @@ struct MapData { #pragma pack(pop) #endif -bool parse(const char *inputFile); -ViewData *getViewData(uint16 roomNum, uint16 direction); -uint16 processArrow(uint16 curDirection, uint16 arrow); -void setCurrentClose(Common::Point pos, CloseDataPtr *closePtrList, bool useAbsoluteCoords = true); -bool takeItem(uint16 x, uint16 y, CloseDataPtr *closePtrList); -bool doActionRule(Common::Point pos, int16 action, int16 roomNum, CloseDataPtr *closePtrList); -bool doOperateRule(Common::Point pos, int16 itemNum, CloseDataPtr *closePtrList); -bool doGoForward(CloseDataPtr *closePtrList); -bool doTurn(uint16 from, uint16 to, CloseDataPtr *closePtrList); -bool doMainView(CloseDataPtr *closePtrList); - } // End of namespace Lab #endif // LAB_PROCESSROOM_H -- cgit v1.2.3 From b586f76f94a33627a2a578539001860a7ff62297 Mon Sep 17 00:00:00 2001 From: Strangerke Date: Wed, 9 Dec 2015 20:04:32 +0100 Subject: LAB: Review struct definitions in processroom --- engines/lab/processroom.h | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/engines/lab/processroom.h b/engines/lab/processroom.h index ff594dadc7..97c7cdce4f 100644 --- a/engines/lab/processroom.h +++ b/engines/lab/processroom.h @@ -91,7 +91,7 @@ namespace Lab { #pragma pack(push, 1) #endif -typedef struct CloseData { +struct CloseData { uint16 _x1, _y1, _x2, _y2; int16 _closeUpType; // if > 0, an object. If < 0, an item uint16 _depth; // Level of the closeup. @@ -99,12 +99,12 @@ typedef struct CloseData { char *_message; CloseData *_nextCloseUp; CloseData *_subCloseUps; -} CloseData; +}; struct ViewData { int16 *_condition; char *_graphicName; - struct ViewData *_nextCondition; + ViewData *_nextCondition; CloseDataPtr _closeUps; }; -- cgit v1.2.3 From e7a0e05301b0f08c0c3271d20fd24a2a4d0f2e71 Mon Sep 17 00:00:00 2001 From: Filippos Karapetis Date: Thu, 10 Dec 2015 03:15:13 +0200 Subject: LAB: Merge playDiff() into readDiff() --- engines/lab/anim.cpp | 63 +++++++++++++++++++++++----------------------------- engines/lab/anim.h | 3 +-- 2 files changed, 29 insertions(+), 37 deletions(-) diff --git a/engines/lab/anim.cpp b/engines/lab/anim.cpp index 5f7797493b..f60c1e1be7 100644 --- a/engines/lab/anim.cpp +++ b/engines/lab/anim.cpp @@ -251,9 +251,31 @@ void Anim::diffNextFrame(bool onlyDiffData) { } /** - * A separate task launched by readDiff. Plays the DIFF. + * Stops an animation from running. + */ +void Anim::stopDiff() { + if (_isPlaying && _isAnim) + _vm->_graphics->blackScreen(); +} + +/** + * Stops an animation from running. + */ +void Anim::stopDiffEnd() { + if (_isPlaying) { + _stopPlayingEnd = true; + while (_isPlaying) { + _vm->_music->updateMusic(); + diffNextFrame(); + } + } +} + +/** + * Reads in a DIFF file. */ -void Anim::playDiff(byte *buffer, bool onlyDiffData) { +void Anim::readDiff(byte *buffer, bool playOnce, bool onlyDiffData) { + _playOnce = playOnce; _waitSec = 0L; _waitMicros = 0L; _delayMicros = 0L; @@ -316,9 +338,9 @@ void Anim::playDiff(byte *buffer, bool onlyDiffData) { _diffHeight = _headerdata._height; _vm->_utils->setBytesPerRow(_diffWidth); - _numChunks = (((int32) _diffWidth) * _diffHeight) / 0x10000; + _numChunks = (((int32)_diffWidth) * _diffHeight) / 0x10000; - if ((uint32)(_numChunks * 0x10000) < (uint32)(((int32) _diffWidth) * _diffHeight)) + if ((uint32)(_numChunks * 0x10000) < (uint32)(((int32)_diffWidth) * _diffHeight)) _numChunks++; } else { return; @@ -333,38 +355,9 @@ void Anim::playDiff(byte *buffer, bool onlyDiffData) { if (_playOnce) { while (_header != 65535) diffNextFrame(onlyDiffData); - } else - diffNextFrame(onlyDiffData); -} - -/** - * Stops an animation from running. - */ -void Anim::stopDiff() { - if (_isPlaying && _isAnim) - _vm->_graphics->blackScreen(); -} - -/** - * Stops an animation from running. - */ -void Anim::stopDiffEnd() { - if (_isPlaying) { - _stopPlayingEnd = true; - while (_isPlaying) { - _vm->_music->updateMusic(); - diffNextFrame(); - } } -} - -/** - * Reads in a DIFF file. - */ -bool Anim::readDiff(byte *buffer, bool playOnce, bool onlyDiffData) { - _playOnce = playOnce; - playDiff(buffer, onlyDiffData); - return true; + else + diffNextFrame(onlyDiffData); } } // End of namespace Lab diff --git a/engines/lab/anim.h b/engines/lab/anim.h index 91bc0d724a..207b3e3e8a 100644 --- a/engines/lab/anim.h +++ b/engines/lab/anim.h @@ -84,7 +84,6 @@ private: BitMap *DrawBitMap; void readBlock(void *Buffer, uint32 Size, byte **File); - void playDiff(byte *buffer, bool onlyDiffData = false); public: Anim(LabEngine *vm); @@ -96,7 +95,7 @@ public: bool _noPalChange; // Don't change the palette. BitMap _rawDiffBM; - bool readDiff(byte *buffer, bool playOnce, bool onlyDiffData = false); + void readDiff(byte *buffer, bool playOnce, bool onlyDiffData = false); void diffNextFrame(bool onlyDiffData = false); void stopDiff(); void stopDiffEnd(); -- cgit v1.2.3 From f59ceebad92a3a04ad8e22535ce45eb6b0a34d31 Mon Sep 17 00:00:00 2001 From: Strangerke Date: Thu, 10 Dec 2015 07:04:17 +0100 Subject: LAB: Move readBlock to the utility class --- engines/lab/anim.cpp | 63 +++++++++++++++++++++++---------------------------- engines/lab/anim.h | 2 -- engines/lab/utils.cpp | 30 ++++++++++++++---------- engines/lab/utils.h | 1 + 4 files changed, 47 insertions(+), 49 deletions(-) diff --git a/engines/lab/anim.cpp b/engines/lab/anim.cpp index f60c1e1be7..563b5fe597 100644 --- a/engines/lab/anim.cpp +++ b/engines/lab/anim.cpp @@ -77,11 +77,6 @@ Anim::Anim(LabEngine *vm) : _vm(vm) { _diffPalette[i] = 0; } -void Anim::readBlock(void *Buffer, uint32 Size, byte **File) { - memcpy(Buffer, *File, (size_t)Size); - (*File) += Size; -} - void Anim::diffNextFrame(bool onlyDiffData) { if (_header == 65535) // Already done. @@ -145,59 +140,58 @@ void Anim::diffNextFrame(bool onlyDiffData) { _diffFile += 4; switch (_header) { - case 8L: - readBlock(_diffPalette, _size, &_diffFile); + case 8: + _vm->_utils->readBlock(_diffPalette, _size, &_diffFile); _isPal = true; break; - case 10L: + case 10: _rawDiffBM._planes[_curBit] = _diffFile; if (onlyDiffData) _diffFile += _size; - else { - readBlock(DrawBitMap->_planes[_curBit], _size, &_diffFile); - } + else + _vm->_utils->readBlock(DrawBitMap->_planes[_curBit], _size, &_diffFile); _curBit++; break; - case 11L: + case 11: _diffFile += 4; _vm->_utils->runLengthDecode(DrawBitMap->_planes[_curBit], _diffFile); _curBit++; _diffFile += _size - 4; break; - case 12L: + case 12: _diffFile += 4; _vm->_utils->VRunLengthDecode(DrawBitMap->_planes[_curBit], _diffFile, DrawBitMap->_bytesPerRow); _curBit++; _diffFile += _size - 4; break; - case 20L: + case 20: _vm->_utils->unDiff(DrawBitMap->_planes[_curBit], _vm->_graphics->_dispBitMap->_planes[_curBit], _diffFile, DrawBitMap->_bytesPerRow, false); _curBit++; _diffFile += _size; break; - case 21L: + case 21: _vm->_utils->unDiff(DrawBitMap->_planes[_curBit], _vm->_graphics->_dispBitMap->_planes[_curBit], _diffFile, DrawBitMap->_bytesPerRow, true); _curBit++; _diffFile += _size; break; - case 25L: + case 25: _curBit++; break; - case 26L: + case 26: _curBit++; break; - case 30L: - case 31L: + case 30: + case 31: if (_waitForEffect) { while (_vm->_music->isSoundEffectActive()) { _vm->_music->updateMusic(); @@ -205,8 +199,7 @@ void Anim::diffNextFrame(bool onlyDiffData) { } } - _size -= 8L; - + _size -= 8; _diffFile += 4; _sampleSpeed = READ_LE_UINT16(_diffFile); @@ -215,7 +208,8 @@ void Anim::diffNextFrame(bool onlyDiffData) { _vm->_music->playSoundEffect(_sampleSpeed, _size, _diffFile); _diffFile += _size; break; - case 65535L: + + case 65535: if ((_frameNum == 1) || _playOnce || _stopPlayingEnd) { bool didTOF = false; @@ -262,12 +256,13 @@ void Anim::stopDiff() { * Stops an animation from running. */ void Anim::stopDiffEnd() { - if (_isPlaying) { - _stopPlayingEnd = true; - while (_isPlaying) { - _vm->_music->updateMusic(); - diffNextFrame(); - } + if (!_isPlaying) + return; + + _stopPlayingEnd = true; + while (_isPlaying) { + _vm->_music->updateMusic(); + diffNextFrame(); } } @@ -276,9 +271,9 @@ void Anim::stopDiffEnd() { */ void Anim::readDiff(byte *buffer, bool playOnce, bool onlyDiffData) { _playOnce = playOnce; - _waitSec = 0L; - _waitMicros = 0L; - _delayMicros = 0L; + _waitSec = 0; + _waitMicros = 0; + _delayMicros = 0; _header = 0; _curBit = 0; _frameNum = 0; @@ -342,9 +337,8 @@ void Anim::readDiff(byte *buffer, bool playOnce, bool onlyDiffData) { if ((uint32)(_numChunks * 0x10000) < (uint32)(((int32)_diffWidth) * _diffHeight)) _numChunks++; - } else { + } else return; - } for (_header = 0; _header < 8; _header++) _rawDiffBM._planes[_header] = NULL; @@ -355,8 +349,7 @@ void Anim::readDiff(byte *buffer, bool playOnce, bool onlyDiffData) { if (_playOnce) { while (_header != 65535) diffNextFrame(onlyDiffData); - } - else + } else diffNextFrame(onlyDiffData); } diff --git a/engines/lab/anim.h b/engines/lab/anim.h index 207b3e3e8a..7669dc58da 100644 --- a/engines/lab/anim.h +++ b/engines/lab/anim.h @@ -83,8 +83,6 @@ private: uint32 _diffHeight; BitMap *DrawBitMap; - void readBlock(void *Buffer, uint32 Size, byte **File); - public: Anim(LabEngine *vm); diff --git a/engines/lab/utils.cpp b/engines/lab/utils.cpp index a9429de4c2..f9a6656174 100644 --- a/engines/lab/utils.cpp +++ b/engines/lab/utils.cpp @@ -60,6 +60,21 @@ uint16 Utils::scaleY(uint16 y) { return ((y * 10) / 24); } + +uint16 Utils::mapScaleX(uint16 x) { + if (_vm->_isHiRes) + return (x - 45); + else + return ((x - 45) >> 1); +} + +uint16 Utils::mapScaleY(uint16 y) { + if (_vm->_isHiRes) + return y; + else + return ((y - 35) >> 1) - (y >> 6); +} + /** * Scales the VGA coords to SVGA if necessary; otherwise, returns VGA coords. */ @@ -422,18 +437,9 @@ uint16 Utils::getRandom(uint16 max) { return ((micros + secs) % max); } -uint16 Utils::mapScaleX(uint16 x) { - if (_vm->_isHiRes) - return (x - 45); - else - return ((x - 45) >> 1); -} - -uint16 Utils::mapScaleY(uint16 y) { - if (_vm->_isHiRes) - return y; - else - return ((y - 35) >> 1) - (y >> 6); +void Utils::readBlock(void *Buffer, uint32 Size, byte **File) { + memcpy(Buffer, *File, (size_t)Size); + (*File) += Size; } } // End of namespace Lab diff --git a/engines/lab/utils.h b/engines/lab/utils.h index ac036adf2d..ea6f378957 100644 --- a/engines/lab/utils.h +++ b/engines/lab/utils.h @@ -60,6 +60,7 @@ public: void VRunLengthDecode(byte *dest, byte *source, uint16 bytesPerRow); void setBytesPerRow(int num); uint16 getRandom(uint16 max); + void readBlock(void *Buffer, uint32 Size, byte **File); }; -- cgit v1.2.3 From 67b3960968b71d529236ab667bad0de5632fa5ea Mon Sep 17 00:00:00 2001 From: Strangerke Date: Thu, 10 Dec 2015 07:04:59 +0100 Subject: LAB: Remove some useless use of g_lab --- engines/lab/resource.cpp | 4 +-- engines/lab/special.cpp | 90 ++++++++++++++++++++++++------------------------ 2 files changed, 47 insertions(+), 47 deletions(-) diff --git a/engines/lab/resource.cpp b/engines/lab/resource.cpp index 1d9a1aedfa..3f615c7a7a 100644 --- a/engines/lab/resource.cpp +++ b/engines/lab/resource.cpp @@ -75,7 +75,7 @@ TextFont *Resource::getFont(const char *fileName) { char *Resource::getText(const char *fileName) { Common::File *dataFile = openDataFile(fileName); - g_lab->_music->updateMusic(); + _vm->_music->updateMusic(); uint32 count = dataFile->size(); byte *buffer = new byte[count]; @@ -155,7 +155,7 @@ Common::String Resource::translateFileName(Common::String filename) { Common::String fileNameStrFinal; if (filename.hasPrefix("P:")) { - if (g_lab->_isHiRes) + if (_vm->_isHiRes) fileNameStrFinal = "GAME/SPICT/"; else fileNameStrFinal = "GAME/PICT/"; diff --git a/engines/lab/special.cpp b/engines/lab/special.cpp index d015c4e263..f100cba4cd 100644 --- a/engines/lab/special.cpp +++ b/engines/lab/special.cpp @@ -93,13 +93,13 @@ static byte *loadBackPict(const char *fileName, bool tomem) { * Does the things to properly set up the detective notes. */ void LabEngine::doNotes() { - TextFont *noteFont = g_lab->_resource->getFont("P:Note.fon"); - char *ntext = g_lab->_resource->getText("Lab:Rooms/Notes"); + TextFont *noteFont = _resource->getFont("P:Note.fon"); + char *ntext = _resource->getText("Lab:Rooms/Notes"); - g_lab->_graphics->flowText(noteFont, -2 + g_lab->_utils->svgaCord(1), 0, 0, false, false, true, true, g_lab->_utils->vgaScaleX(25) + g_lab->_utils->svgaCord(15), g_lab->_utils->vgaScaleY(50), g_lab->_utils->vgaScaleX(295) - g_lab->_utils->svgaCord(15), g_lab->_utils->vgaScaleY(148), ntext); - g_lab->_graphics->setPalette(g_lab->_anim->_diffPalette, 256); + _graphics->flowText(noteFont, -2 + _utils->svgaCord(1), 0, 0, false, false, true, true, _utils->vgaScaleX(25) + _utils->svgaCord(15), _utils->vgaScaleY(50), _utils->vgaScaleX(295) - _utils->svgaCord(15), _utils->vgaScaleY(148), ntext); + _graphics->setPalette(_anim->_diffPalette, 256); - g_lab->_graphics->closeFont(noteFont); + _graphics->closeFont(noteFont); delete[] ntext; } @@ -114,34 +114,34 @@ void LabEngine::doWestPaper() { int32 FileLen, CharsPrinted; uint16 y = 268; - paperFont = g_lab->_resource->getFont("P:News22.fon"); - ntext = g_lab->_resource->getText("Lab:Rooms/Date"); - g_lab->_graphics->flowText(paperFont, 0, 0, 0, false, true, false, true, g_lab->_utils->vgaScaleX(57), g_lab->_utils->vgaScaleY(77) + g_lab->_utils->svgaCord(2), g_lab->_utils->vgaScaleX(262), g_lab->_utils->vgaScaleY(91), ntext); - g_lab->_graphics->closeFont(paperFont); + paperFont = _resource->getFont("P:News22.fon"); + ntext = _resource->getText("Lab:Rooms/Date"); + _graphics->flowText(paperFont, 0, 0, 0, false, true, false, true, _utils->vgaScaleX(57), _utils->vgaScaleY(77) + _utils->svgaCord(2), _utils->vgaScaleX(262), _utils->vgaScaleY(91), ntext); + _graphics->closeFont(paperFont); delete[] ntext; - paperFont = g_lab->_resource->getFont("P:News32.fon"); - ntext = g_lab->_resource->getText("Lab:Rooms/Headline"); + paperFont = _resource->getFont("P:News32.fon"); + ntext = _resource->getText("Lab:Rooms/Headline"); FileLen = strlen(ntext) - 1; - CharsPrinted = g_lab->_graphics->flowText(paperFont, -8, 0, 0, false, true, false, true, g_lab->_utils->vgaScaleX(57), g_lab->_utils->vgaScaleY(86) - g_lab->_utils->svgaCord(2), g_lab->_utils->vgaScaleX(262), g_lab->_utils->vgaScaleY(118), ntext); + CharsPrinted = _graphics->flowText(paperFont, -8, 0, 0, false, true, false, true, _utils->vgaScaleX(57), _utils->vgaScaleY(86) - _utils->svgaCord(2), _utils->vgaScaleX(262), _utils->vgaScaleY(118), ntext); if (CharsPrinted < FileLen) { - y = 130 - g_lab->_utils->svgaCord(5); - g_lab->_graphics->flowText(paperFont, -8 - g_lab->_utils->svgaCord(1), 0, 0, false, true, false, true, g_lab->_utils->vgaScaleX(57), g_lab->_utils->vgaScaleY(86) - g_lab->_utils->svgaCord(2), g_lab->_utils->vgaScaleX(262), g_lab->_utils->vgaScaleY(132), ntext); + y = 130 - _utils->svgaCord(5); + _graphics->flowText(paperFont, -8 - _utils->svgaCord(1), 0, 0, false, true, false, true, _utils->vgaScaleX(57), _utils->vgaScaleY(86) - _utils->svgaCord(2), _utils->vgaScaleX(262), _utils->vgaScaleY(132), ntext); } else - y = 115 - g_lab->_utils->svgaCord(5); - g_lab->_graphics->closeFont(paperFont); + y = 115 - _utils->svgaCord(5); + _graphics->closeFont(paperFont); delete[] ntext; - paperFont = g_lab->_resource->getFont("P:Note.fon"); - ntext = g_lab->_resource->getText("Lab:Rooms/Col1"); - CharsPrinted = g_lab->_graphics->flowTextScaled(paperFont, -4, 0, 0, false, false, false, true, 45, y, 158, 148, ntext); + paperFont = _resource->getFont("P:Note.fon"); + ntext = _resource->getText("Lab:Rooms/Col1"); + CharsPrinted = _graphics->flowTextScaled(paperFont, -4, 0, 0, false, false, false, true, 45, y, 158, 148, ntext); delete[] ntext; - ntext = g_lab->_resource->getText("Lab:Rooms/Col2"); - CharsPrinted = g_lab->_graphics->flowTextScaled(paperFont, -4, 0, 0, false, false, false, true, 162, y, 275, 148, ntext); + ntext = _resource->getText("Lab:Rooms/Col2"); + CharsPrinted = _graphics->flowTextScaled(paperFont, -4, 0, 0, false, false, false, true, 162, y, 275, 148, ntext); delete[] ntext; - g_lab->_graphics->closeFont(paperFont); + _graphics->closeFont(paperFont); - g_lab->_graphics->setPalette(g_lab->_anim->_diffPalette, 256); + _graphics->setPalette(_anim->_diffPalette, 256); } /** @@ -151,15 +151,15 @@ void LabEngine::loadJournalData() { char filename[20]; bool bridge, dirty, news, clean; - journalFont = g_lab->_resource->getFont("P:Journal.fon"); + journalFont = _resource->getFont("P:Journal.fon"); - g_lab->_music->updateMusic(); + _music->updateMusic(); strcpy(filename, "Lab:Rooms/j0"); - bridge = g_lab->_conditions->in(BRIDGE0) || g_lab->_conditions->in(BRIDGE1); - dirty = g_lab->_conditions->in(DIRTY); - news = !g_lab->_conditions->in(NONEWS); - clean = !g_lab->_conditions->in(NOCLEAN); + bridge = _conditions->in(BRIDGE0) || _conditions->in(BRIDGE1); + dirty = _conditions->in(DIRTY); + news = !_conditions->in(NONEWS); + clean = !_conditions->in(NOCLEAN); if (bridge && clean && news) filename[11] = '8'; @@ -180,11 +180,11 @@ void LabEngine::loadJournalData() { else if (bridge) filename[11] = '1'; - journaltext = g_lab->_resource->getText(filename); - journaltexttitle = g_lab->_resource->getText("Lab:Rooms/jt"); + journaltext = _resource->getText(filename); + journaltexttitle = _resource->getText("Lab:Rooms/jt"); - Common::File *journalFile = g_lab->_resource->openDataFile("P:JImage"); - Utils *utils = g_lab->_utils; + Common::File *journalFile = _resource->openDataFile("P:JImage"); + Utils *utils = _utils; _journalGadgetList.push_back(createButton( 80, utils->vgaScaleY(162) + utils->svgaCord(1), 0, VKEY_LTARROW, new Image(journalFile), new Image(journalFile))); // back _journalGadgetList.push_back(createButton(144, utils->vgaScaleY(164) - utils->svgaCord(1), 1, VKEY_RTARROW, new Image(journalFile), new Image(journalFile))); // foward _journalGadgetList.push_back(createButton(194, utils->vgaScaleY(162) + utils->svgaCord(1), 2, 0, new Image(journalFile), new Image(journalFile))); // cancel @@ -287,14 +287,14 @@ void LabEngine::drawJournal(uint16 wipenum, bool needFade) { if (needFade) _graphics->fade(true, 0); - g_lab->_anim->_noPalChange = true; + _anim->_noPalChange = true; JBackImage._imageData = _graphics->readPictToMem("P:Journal.pic", _graphics->_screenWidth, _graphics->_screenHeight); GotBackImage = true; eatMessages(); _event->mouseShow(); - g_lab->_anim->_noPalChange = false; + _anim->_noPalChange = false; } /** @@ -369,7 +369,7 @@ void LabEngine::doJournal() { _event->mouseHide(); freeButtonList(&_journalGadgetList); - g_lab->_graphics->closeFont(journalFont); + _graphics->closeFont(journalFont); ScreenImage._imageData = _graphics->getCurrentDrawingBuffer(); @@ -395,7 +395,7 @@ void LabEngine::drawMonText(char *text, TextFont *monitorFont, uint16 x1, uint16 numlines += (*text - '0'); text += 2; - fheight = g_lab->_graphics->textHeight(monitorFont); + fheight = _graphics->textHeight(monitorFont); x1 = MonButton->_width + _utils->vgaScaleX(3); MonGadHeight = MonButton->_height + _utils->vgaScaleY(3); @@ -465,7 +465,7 @@ void LabEngine::processMonitor(char *ntext, TextFont *monitorFont, bool isintera monitorPage = 0; TextFileName = Test; - ntext = g_lab->_resource->getText(TextFileName); + ntext = _resource->getText(TextFileName); _graphics->fade(false, 0); drawMonText(ntext, monitorFont, x1, y1, x2, y2, isinteractive); _graphics->fade(true, 0); @@ -491,20 +491,20 @@ void LabEngine::processMonitor(char *ntext, TextFont *monitorFont, bool isintera return; else if ((msgClass == MOUSEBUTTONS) && (IEQUALIFIER_LEFTBUTTON & qualifier)) { - if ((mouseY >= g_lab->_utils->vgaScaleY(171)) && (mouseY <= g_lab->_utils->vgaScaleY(200))) { - if ((mouseX >= g_lab->_utils->vgaScaleX(259)) && (mouseX <= g_lab->_utils->vgaScaleX(289))) { + if ((mouseY >= _utils->vgaScaleY(171)) && (mouseY <= _utils->vgaScaleY(200))) { + if ((mouseX >= _utils->vgaScaleX(259)) && (mouseX <= _utils->vgaScaleX(289))) { if (!lastpage) { monitorPage += 1; drawMonText(ntext, monitorFont, x1, y1, x2, y2, isinteractive); } - } else if ((mouseX >= g_lab->_utils->vgaScaleX(0)) && (mouseX <= g_lab->_utils->vgaScaleX(31))) { + } else if ((mouseX >= _utils->vgaScaleX(0)) && (mouseX <= _utils->vgaScaleX(31))) { return; - } else if ((mouseX >= g_lab->_utils->vgaScaleX(290)) && (mouseX <= g_lab->_utils->vgaScaleX(320))) { + } else if ((mouseX >= _utils->vgaScaleX(290)) && (mouseX <= _utils->vgaScaleX(320))) { if (monitorPage >= 1) { monitorPage -= 1; drawMonText(ntext, monitorFont, x1, y1, x2, y2, isinteractive); } - } else if ((mouseX >= g_lab->_utils->vgaScaleX(31)) && (mouseX <= g_lab->_utils->vgaScaleX(59))) { + } else if ((mouseX >= _utils->vgaScaleX(31)) && (mouseX <= _utils->vgaScaleX(59))) { if (isinteractive) { monitorPage = 0; @@ -558,7 +558,7 @@ void LabEngine::doMonitor(char *background, char *textfile, bool isinteractive, _graphics->FadePalette = hipal; TextFont *monitorFont = _resource->getFont("P:Map.fon"); - Common::File *buttonFile = g_lab->_resource->openDataFile("P:MonImage"); + Common::File *buttonFile = _resource->openDataFile("P:MonImage"); MonButton = new Image(buttonFile); delete buttonFile; @@ -571,7 +571,7 @@ void LabEngine::doMonitor(char *background, char *textfile, bool isinteractive, _graphics->fade(false, 0); _event->mouseHide(); delete[] ntext; - g_lab->_graphics->closeFont(monitorFont); + _graphics->closeFont(monitorFont); _graphics->setAPen(0); _graphics->rectFill(0, 0, _graphics->_screenWidth - 1, _graphics->_screenHeight - 1); -- cgit v1.2.3 From 9c94d140dbf33e0cf29bc1d3791ecdc477e091c4 Mon Sep 17 00:00:00 2001 From: Filippos Karapetis Date: Thu, 10 Dec 2015 10:53:15 +0200 Subject: LAB: Simplify bitmap flags --- engines/lab/anim.cpp | 8 ++++---- engines/lab/anim.h | 5 +---- engines/lab/dispman.cpp | 10 +++++----- 3 files changed, 10 insertions(+), 13 deletions(-) diff --git a/engines/lab/anim.cpp b/engines/lab/anim.cpp index 563b5fe597..936c49223c 100644 --- a/engines/lab/anim.cpp +++ b/engines/lab/anim.cpp @@ -61,7 +61,7 @@ Anim::Anim(LabEngine *vm) : _vm(vm) { _diffFile = nullptr; _size = 0; _rawDiffBM._bytesPerRow = 0; - _rawDiffBM._flags = 0; + _rawDiffBM._drawOnScreen = false; for (int i = 0; i < 16; i++) _rawDiffBM._planes[i] = nullptr; _rawDiffBM._rows = 0; @@ -82,7 +82,7 @@ void Anim::diffNextFrame(bool onlyDiffData) { // Already done. return; - if (_vm->_graphics->_dispBitMap->_flags & BITMAPF_VIDEO) { + if (_vm->_graphics->_dispBitMap->_drawOnScreen) { _vm->_graphics->_dispBitMap->_planes[0] = _vm->_graphics->getCurrentDrawingBuffer(); _vm->_graphics->_dispBitMap->_planes[1] = _vm->_graphics->_dispBitMap->_planes[0] + 0x10000; _vm->_graphics->_dispBitMap->_planes[2] = _vm->_graphics->_dispBitMap->_planes[1] + 0x10000; @@ -125,7 +125,7 @@ void Anim::diffNextFrame(bool onlyDiffData) { _isAnim = (_frameNum >= 3) && (!_playOnce); _curBit = 0; - if (_vm->_graphics->_dispBitMap->_flags & BITMAPF_VIDEO) + if (_vm->_graphics->_dispBitMap->_drawOnScreen) _vm->_graphics->screenUpdate(); // done with the next frame. @@ -218,7 +218,7 @@ void Anim::diffNextFrame(bool onlyDiffData) { _vm->_music->updateMusic(); _vm->waitTOF(); - if (_vm->_graphics->_dispBitMap->_flags & BITMAPF_VIDEO) + if (_vm->_graphics->_dispBitMap->_drawOnScreen) didTOF = true; } } diff --git a/engines/lab/anim.h b/engines/lab/anim.h index 7669dc58da..797c5536f4 100644 --- a/engines/lab/anim.h +++ b/engines/lab/anim.h @@ -50,13 +50,10 @@ struct DIFFHeader { struct BitMap { uint16 _bytesPerRow; uint16 _rows; // unused - byte _flags; + bool _drawOnScreen; byte *_planes[16]; }; -#define BITMAPF_NONE 0 -#define BITMAPF_VIDEO (1<<7) - class Anim { private: LabEngine *_vm; diff --git a/engines/lab/dispman.cpp b/engines/lab/dispman.cpp index 13ffd07b59..ba2cfc846b 100644 --- a/engines/lab/dispman.cpp +++ b/engines/lab/dispman.cpp @@ -94,7 +94,7 @@ void DisplayMan::readPict(const char *filename, bool playOnce, bool onlyDiffData _dispBitMap->_bytesPerRow = _screenWidth; _dispBitMap->_rows = _screenHeight; - _dispBitMap->_flags = BITMAPF_VIDEO; + _dispBitMap->_drawOnScreen = true; _vm->_anim->readDiff(_curBitmap, playOnce, onlyDiffData); } @@ -102,7 +102,7 @@ void DisplayMan::readPict(const char *filename, bool playOnce, bool onlyDiffData /** * Reads in a picture into buffer memory. */ -byte *DisplayMan::readPictToMem(const char *filename, uint16 x, uint16 y) { +byte *DisplayMan::readPictToMem(const char *filename, uint16 width, uint16 height) { _vm->_anim->stopDiff(); loadPict(filename); @@ -112,9 +112,9 @@ byte *DisplayMan::readPictToMem(const char *filename, uint16 x, uint16 y) { if (!_vm->_music->_doNotFilestopSoundEffect) _vm->_music->stopSoundEffect(); - _dispBitMap->_bytesPerRow = x; - _dispBitMap->_rows = y; - _dispBitMap->_flags = BITMAPF_NONE; + _dispBitMap->_bytesPerRow = width; + _dispBitMap->_rows = height; + _dispBitMap->_drawOnScreen = false; _dispBitMap->_planes[0] = _curBitmap; _dispBitMap->_planes[1] = _dispBitMap->_planes[0] + 0x10000; _dispBitMap->_planes[2] = _dispBitMap->_planes[1] + 0x10000; -- cgit v1.2.3 From 165c0b3b49dbbe5b5758b1ba34667a6f8dd44987 Mon Sep 17 00:00:00 2001 From: Eugene Sandulenko Date: Thu, 10 Dec 2015 10:51:02 +0100 Subject: LAB: More vars renaming --- engines/lab/special.cpp | 159 +++++++++++++++++++++++------------------------- 1 file changed, 76 insertions(+), 83 deletions(-) diff --git a/engines/lab/special.cpp b/engines/lab/special.cpp index f100cba4cd..f0b8152a34 100644 --- a/engines/lab/special.cpp +++ b/engines/lab/special.cpp @@ -109,35 +109,35 @@ void LabEngine::doNotes() { * OpenHiRes already called. */ void LabEngine::doWestPaper() { - char *ntext; - TextFont *paperFont; - int32 FileLen, CharsPrinted; - uint16 y = 268; - - paperFont = _resource->getFont("P:News22.fon"); - ntext = _resource->getText("Lab:Rooms/Date"); + TextFont *paperFont = _resource->getFont("P:News22.fon"); + char *ntext = _resource->getText("Lab:Rooms/Date"); _graphics->flowText(paperFont, 0, 0, 0, false, true, false, true, _utils->vgaScaleX(57), _utils->vgaScaleY(77) + _utils->svgaCord(2), _utils->vgaScaleX(262), _utils->vgaScaleY(91), ntext); _graphics->closeFont(paperFont); delete[] ntext; paperFont = _resource->getFont("P:News32.fon"); ntext = _resource->getText("Lab:Rooms/Headline"); - FileLen = strlen(ntext) - 1; - CharsPrinted = _graphics->flowText(paperFont, -8, 0, 0, false, true, false, true, _utils->vgaScaleX(57), _utils->vgaScaleY(86) - _utils->svgaCord(2), _utils->vgaScaleX(262), _utils->vgaScaleY(118), ntext); - if (CharsPrinted < FileLen) { + + int fileLen = strlen(ntext) - 1; + int charsPrinted = _graphics->flowText(paperFont, -8, 0, 0, false, true, false, true, _utils->vgaScaleX(57), _utils->vgaScaleY(86) - _utils->svgaCord(2), _utils->vgaScaleX(262), _utils->vgaScaleY(118), ntext); + + uint16 y; + + if (charsPrinted < fileLen) { y = 130 - _utils->svgaCord(5); _graphics->flowText(paperFont, -8 - _utils->svgaCord(1), 0, 0, false, true, false, true, _utils->vgaScaleX(57), _utils->vgaScaleY(86) - _utils->svgaCord(2), _utils->vgaScaleX(262), _utils->vgaScaleY(132), ntext); } else y = 115 - _utils->svgaCord(5); + _graphics->closeFont(paperFont); delete[] ntext; paperFont = _resource->getFont("P:Note.fon"); ntext = _resource->getText("Lab:Rooms/Col1"); - CharsPrinted = _graphics->flowTextScaled(paperFont, -4, 0, 0, false, false, false, true, 45, y, 158, 148, ntext); + charsPrinted = _graphics->flowTextScaled(paperFont, -4, 0, 0, false, false, false, true, 45, y, 158, 148, ntext); delete[] ntext; ntext = _resource->getText("Lab:Rooms/Col2"); - CharsPrinted = _graphics->flowTextScaled(paperFont, -4, 0, 0, false, false, false, true, 162, y, 275, 148, ntext); + charsPrinted = _graphics->flowTextScaled(paperFont, -4, 0, 0, false, false, false, true, 162, y, 275, 148, ntext); delete[] ntext; _graphics->closeFont(paperFont); @@ -148,18 +148,17 @@ void LabEngine::doWestPaper() { * Loads in the data for the journal. */ void LabEngine::loadJournalData() { - char filename[20]; - bool bridge, dirty, news, clean; - journalFont = _resource->getFont("P:Journal.fon"); _music->updateMusic(); + char filename[20]; strcpy(filename, "Lab:Rooms/j0"); - bridge = _conditions->in(BRIDGE0) || _conditions->in(BRIDGE1); - dirty = _conditions->in(DIRTY); - news = !_conditions->in(NONEWS); - clean = !_conditions->in(NOCLEAN); + + bool bridge = _conditions->in(BRIDGE0) || _conditions->in(BRIDGE1); + bool dirty = _conditions->in(DIRTY); + bool news = !_conditions->in(NONEWS); + bool clean = !_conditions->in(NOCLEAN); if (bridge && clean && news) filename[11] = '8'; @@ -185,9 +184,11 @@ void LabEngine::loadJournalData() { Common::File *journalFile = _resource->openDataFile("P:JImage"); Utils *utils = _utils; + _journalGadgetList.push_back(createButton( 80, utils->vgaScaleY(162) + utils->svgaCord(1), 0, VKEY_LTARROW, new Image(journalFile), new Image(journalFile))); // back _journalGadgetList.push_back(createButton(144, utils->vgaScaleY(164) - utils->svgaCord(1), 1, VKEY_RTARROW, new Image(journalFile), new Image(journalFile))); // foward _journalGadgetList.push_back(createButton(194, utils->vgaScaleY(162) + utils->svgaCord(1), 2, 0, new Image(journalFile), new Image(journalFile))); // cancel + delete journalFile; } @@ -195,45 +196,45 @@ void LabEngine::loadJournalData() { * Draws the text to the back journal screen to the appropriate Page number */ static void drawJournalText() { - uint16 DrawingToPage = 1; - int32 CharsDrawn = 0L; - char *CurText = journaltext; + uint16 drawingToPage = 1; + int32 charsDrawn = 0L; + char *curText = journaltext; - while (DrawingToPage < JPage) { + while (drawingToPage < JPage) { g_lab->_music->updateMusic(); - CurText = (char *)(journaltext + CharsDrawn); - CharsDrawn += g_lab->_graphics->flowTextScaled(journalFont, -2, 2, 0, false, false, false, false, 52, 32, 152, 148, CurText); + curText = (char *)(journaltext + charsDrawn); + charsDrawn += g_lab->_graphics->flowTextScaled(journalFont, -2, 2, 0, false, false, false, false, 52, 32, 152, 148, curText); - lastpage = (*CurText == 0); + lastpage = (*curText == 0); if (lastpage) - JPage = (DrawingToPage / 2) * 2; + JPage = (drawingToPage / 2) * 2; else - DrawingToPage++; + drawingToPage++; } if (JPage <= 1) { - CurText = journaltexttitle; - g_lab->_graphics->flowTextToMem(&JBackImage, journalFont, -2, 2, 0, false, true, true, true, g_lab->_utils->vgaScaleX(52), g_lab->_utils->vgaScaleY(32), g_lab->_utils->vgaScaleX(152), g_lab->_utils->vgaScaleY(148), CurText); + curText = journaltexttitle; + g_lab->_graphics->flowTextToMem(&JBackImage, journalFont, -2, 2, 0, false, true, true, true, g_lab->_utils->vgaScaleX(52), g_lab->_utils->vgaScaleY(32), g_lab->_utils->vgaScaleX(152), g_lab->_utils->vgaScaleY(148), curText); } else { - CurText = (char *)(journaltext + CharsDrawn); - CharsDrawn += g_lab->_graphics->flowTextToMem(&JBackImage, journalFont, -2, 2, 0, false, false, false, true, g_lab->_utils->vgaScaleX(52), g_lab->_utils->vgaScaleY(32), g_lab->_utils->vgaScaleX(152), g_lab->_utils->vgaScaleY(148), CurText); + curText = (char *)(journaltext + charsDrawn); + charsDrawn += g_lab->_graphics->flowTextToMem(&JBackImage, journalFont, -2, 2, 0, false, false, false, true, g_lab->_utils->vgaScaleX(52), g_lab->_utils->vgaScaleY(32), g_lab->_utils->vgaScaleX(152), g_lab->_utils->vgaScaleY(148), curText); } g_lab->_music->updateMusic(); - CurText = (char *)(journaltext + CharsDrawn); - lastpage = (*CurText == 0); - g_lab->_graphics->flowTextToMem(&JBackImage, journalFont, -2, 2, 0, false, false, false, true, g_lab->_utils->vgaScaleX(171), g_lab->_utils->vgaScaleY(32), g_lab->_utils->vgaScaleX(271), g_lab->_utils->vgaScaleY(148), CurText); + curText = (char *)(journaltext + charsDrawn); + lastpage = (*curText == 0); + g_lab->_graphics->flowTextToMem(&JBackImage, journalFont, -2, 2, 0, false, false, false, true, g_lab->_utils->vgaScaleX(171), g_lab->_utils->vgaScaleY(32), g_lab->_utils->vgaScaleX(271), g_lab->_utils->vgaScaleY(148), curText); - CurText = (char *)(journaltext + CharsDrawn); - lastpage = lastpage || (*CurText == 0); + curText = (char *)(journaltext + charsDrawn); + lastpage = lastpage || (*curText == 0); } /** * Does the turn page wipe. */ -static void turnPage(bool FromLeft) { - if (FromLeft) { +static void turnPage(bool fromLeft) { + if (fromLeft) { for (int i = 0; i < g_lab->_graphics->_screenWidth; i += 8) { g_lab->_music->updateMusic(); g_lab->waitTOF(); @@ -301,35 +302,30 @@ void LabEngine::drawJournal(uint16 wipenum, bool needFade) { * Processes user input. */ void LabEngine::processJournal() { - IntuiMessage *Msg; - uint32 Class; - uint16 Qualifier, GadID; - while (1) { // Make sure we check the music at least after every message _music->updateMusic(); - Msg = getMsg(); + IntuiMessage *msg = getMsg(); - if (Msg == NULL) { + if (msg == NULL) { _music->updateMusic(); } else { - Class = Msg->_msgClass; - Qualifier = Msg->_qualifier; - GadID = Msg->_code; + uint32 msgClass = msg->_msgClass; + uint16 qualifier = msg->_qualifier; + uint16 gadID = msg->_code; - if (((Class == MOUSEBUTTONS) && (IEQUALIFIER_RBUTTON & Qualifier)) || - ((Class == RAWKEY) && (GadID == 27))) + if (((msgClass == MOUSEBUTTONS) && (IEQUALIFIER_RBUTTON & qualifier)) || + ((msgClass == RAWKEY) && (gadID == 27))) return; - - else if (Class == GADGETUP) { - if (GadID == 0) { + else if (msgClass == GADGETUP) { + if (gadID == 0) { if (JPage >= 2) { JPage -= 2; drawJournal(1, false); } - } else if (GadID == 1) { + } else if (gadID == 1) { return; - } else if (GadID == 2) { + } else if (gadID == 2) { if (!lastpage) { JPage += 2; drawJournal(2, false); @@ -382,9 +378,9 @@ void LabEngine::doJournal() { * Draws the text for the monitor. */ void LabEngine::drawMonText(char *text, TextFont *monitorFont, uint16 x1, uint16 y1, uint16 x2, uint16 y2, bool isinteractive) { - uint16 DrawingToPage = 0, yspacing = 0, numlines, fheight; - int32 CharsDrawn = 0L; - char *CurText = text; + uint16 drawingToPage = 0, yspacing = 0, numlines, fheight; + int32 charsDrawn = 0L; + char *curText = text; _event->mouseHide(); @@ -417,23 +413,23 @@ void LabEngine::drawMonText(char *text, TextFont *monitorFont, uint16 x1, uint16 _graphics->rectFill(x1, y1, x2, y2); } - while (DrawingToPage < monitorPage) { + while (drawingToPage < monitorPage) { _music->updateMusic(); - CurText = (char *)(text + CharsDrawn); - CharsDrawn += _graphics->flowText(monitorFont, yspacing, 0, 0, false, false, false, false, x1, y1, x2, y2, CurText); - lastpage = (*CurText == 0); + curText = (char *)(text + charsDrawn); + charsDrawn += _graphics->flowText(monitorFont, yspacing, 0, 0, false, false, false, false, x1, y1, x2, y2, curText); + lastpage = (*curText == 0); if (lastpage) - monitorPage = DrawingToPage; + monitorPage = drawingToPage; else - DrawingToPage++; + drawingToPage++; } - CurText = (char *)(text + CharsDrawn); - lastpage = (*CurText == 0); - CharsDrawn = _graphics->flowText(monitorFont, yspacing, 2, 0, false, false, false, true, x1, y1, x2, y2, CurText); - CurText += CharsDrawn; - lastpage = lastpage || (*CurText == 0); + curText = (char *)(text + charsDrawn); + lastpage = (*curText == 0); + charsDrawn = _graphics->flowText(monitorFont, yspacing, 2, 0, false, false, false, true, x1, y1, x2, y2, curText); + curText += charsDrawn; + lastpage = lastpage || (*curText == 0); _event->mouseShow(); } @@ -442,10 +438,7 @@ void LabEngine::drawMonText(char *text, TextFont *monitorFont, uint16 x1, uint16 * Processes user input. */ void LabEngine::processMonitor(char *ntext, TextFont *monitorFont, bool isinteractive, uint16 x1, uint16 y1, uint16 x2, uint16 y2) { - IntuiMessage *msg; - uint32 msgClass; - uint16 qualifier, code, mouseX, mouseY; - const char *Test = " ", *StartFileName = TextFileName; + const char *test = " ", *startFileName = TextFileName; CloseDataPtr startClosePtr = _closeDataPtr, lastClosePtr[10]; uint16 depth = 0; @@ -457,13 +450,13 @@ void LabEngine::processMonitor(char *ntext, TextFont *monitorFont, bool isintera _closeDataPtr = startClosePtr; if (_closeDataPtr == startClosePtr) - Test = StartFileName; + test = startFileName; else - Test = _closeDataPtr->_graphicName; + test = _closeDataPtr->_graphicName; - if (strcmp(Test, TextFileName)) { + if (strcmp(test, TextFileName)) { monitorPage = 0; - TextFileName = Test; + TextFileName = test; ntext = _resource->getText(TextFileName); _graphics->fade(false, 0); @@ -475,16 +468,16 @@ void LabEngine::processMonitor(char *ntext, TextFont *monitorFont, bool isintera // Make sure we check the music at least after every message _music->updateMusic(); - msg = getMsg(); + IntuiMessage *msg = getMsg(); if (msg == NULL) { _music->updateMusic(); } else { - msgClass = msg->_msgClass; - qualifier = msg->_qualifier; - mouseX = msg->_mouseX; - mouseY = msg->_mouseY; - code = msg->_code; + uint32 msgClass = msg->_msgClass; + uint16 qualifier = msg->_qualifier; + uint16 mouseX = msg->_mouseX; + uint16 mouseY = msg->_mouseY; + uint16 code = msg->_code; if (((msgClass == MOUSEBUTTONS) && (IEQUALIFIER_RBUTTON & qualifier)) || ((msgClass == RAWKEY) && (code == 27))) -- cgit v1.2.3 From 9f7ad4b5f25e3c9d6437f0ac0e5e26dba4cab330 Mon Sep 17 00:00:00 2001 From: Filippos Karapetis Date: Thu, 10 Dec 2015 12:39:32 +0200 Subject: LAB: Fix crash when closing the map --- engines/lab/map.cpp | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/engines/lab/map.cpp b/engines/lab/map.cpp index c6b2277280..b484a1e323 100644 --- a/engines/lab/map.cpp +++ b/engines/lab/map.cpp @@ -106,7 +106,6 @@ void LabEngine::loadMapData() { void LabEngine::freeMapData() { freeButtonList(&_mapGadgetList); - delete[] _maps; delete _imgMap; delete _imgRoom; delete _imgUpArrowRoom; @@ -121,8 +120,8 @@ void LabEngine::freeMapData() { delete _imgMapEast; delete _imgMapSouth; delete _imgMapWest; - delete _imgXMark; - delete _maps; + // _imgXMark is a pointer to one of the four buffers above + delete[] _maps; _imgMap = nullptr; _imgRoom = nullptr; -- cgit v1.2.3 From aa7ec3654dfc8a01c734c41946db5d8e79f3cf9b Mon Sep 17 00:00:00 2001 From: Filippos Karapetis Date: Thu, 10 Dec 2015 12:45:21 +0200 Subject: LAB: Refactor readPictToMem() This fixes crashes in the teleporter and the journal, and plugs several memory leaks --- engines/lab/anim.cpp | 14 ++++++------ engines/lab/dispman.cpp | 39 ++++++------------------------- engines/lab/dispman.h | 3 +-- engines/lab/special.cpp | 56 ++++++++++++++++++++------------------------- engines/lab/transitions.cpp | 8 +++++-- 5 files changed, 46 insertions(+), 74 deletions(-) diff --git a/engines/lab/anim.cpp b/engines/lab/anim.cpp index 936c49223c..20d1473c67 100644 --- a/engines/lab/anim.cpp +++ b/engines/lab/anim.cpp @@ -82,13 +82,13 @@ void Anim::diffNextFrame(bool onlyDiffData) { // Already done. return; - if (_vm->_graphics->_dispBitMap->_drawOnScreen) { - _vm->_graphics->_dispBitMap->_planes[0] = _vm->_graphics->getCurrentDrawingBuffer(); - _vm->_graphics->_dispBitMap->_planes[1] = _vm->_graphics->_dispBitMap->_planes[0] + 0x10000; - _vm->_graphics->_dispBitMap->_planes[2] = _vm->_graphics->_dispBitMap->_planes[1] + 0x10000; - _vm->_graphics->_dispBitMap->_planes[3] = _vm->_graphics->_dispBitMap->_planes[2] + 0x10000; - _vm->_graphics->_dispBitMap->_planes[4] = _vm->_graphics->_dispBitMap->_planes[3] + 0x10000; - } + if (_vm->_graphics->_dispBitMap->_drawOnScreen) + _vm->_graphics->_dispBitMap->_planes[0] = _vm->_graphics->getCurrentDrawingBuffer(); + + _vm->_graphics->_dispBitMap->_planes[1] = _vm->_graphics->_dispBitMap->_planes[0] + 0x10000; + _vm->_graphics->_dispBitMap->_planes[2] = _vm->_graphics->_dispBitMap->_planes[1] + 0x10000; + _vm->_graphics->_dispBitMap->_planes[3] = _vm->_graphics->_dispBitMap->_planes[2] + 0x10000; + _vm->_graphics->_dispBitMap->_planes[4] = _vm->_graphics->_dispBitMap->_planes[3] + 0x10000; _vm->_event->mouseHide(); diff --git a/engines/lab/dispman.cpp b/engines/lab/dispman.cpp index ba2cfc846b..df35f9f29d 100644 --- a/engines/lab/dispman.cpp +++ b/engines/lab/dispman.cpp @@ -80,9 +80,9 @@ void DisplayMan::loadPict(const char *filename) { } /** - * Reads in a picture into the dest bitmap. + * Reads in a picture into the display bitmap. */ -void DisplayMan::readPict(const char *filename, bool playOnce, bool onlyDiffData) { +void DisplayMan::readPict(const char *filename, bool playOnce, bool onlyDiffData, byte *memoryBuffer, uint16 maxHeight) { _vm->_anim->stopDiff(); loadPict(filename); @@ -92,40 +92,15 @@ void DisplayMan::readPict(const char *filename, bool playOnce, bool onlyDiffData if (!_vm->_music->_doNotFilestopSoundEffect) _vm->_music->stopSoundEffect(); - _dispBitMap->_bytesPerRow = _screenWidth; - _dispBitMap->_rows = _screenHeight; - _dispBitMap->_drawOnScreen = true; + _dispBitMap->_bytesPerRow = _screenWidth; + _dispBitMap->_rows = (maxHeight > 0) ? maxHeight : _screenHeight; + _dispBitMap->_drawOnScreen = (memoryBuffer == nullptr); + if (memoryBuffer) + _dispBitMap->_planes[0] = memoryBuffer; _vm->_anim->readDiff(_curBitmap, playOnce, onlyDiffData); } -/** - * Reads in a picture into buffer memory. - */ -byte *DisplayMan::readPictToMem(const char *filename, uint16 width, uint16 height) { - _vm->_anim->stopDiff(); - - loadPict(filename); - - _vm->_music->updateMusic(); - - if (!_vm->_music->_doNotFilestopSoundEffect) - _vm->_music->stopSoundEffect(); - - _dispBitMap->_bytesPerRow = width; - _dispBitMap->_rows = height; - _dispBitMap->_drawOnScreen = false; - _dispBitMap->_planes[0] = _curBitmap; - _dispBitMap->_planes[1] = _dispBitMap->_planes[0] + 0x10000; - _dispBitMap->_planes[2] = _dispBitMap->_planes[1] + 0x10000; - _dispBitMap->_planes[3] = _dispBitMap->_planes[2] + 0x10000; - _dispBitMap->_planes[4] = _dispBitMap->_planes[3] + 0x10000; - - _vm->_anim->readDiff(_curBitmap, true); - - return _curBitmap; -} - void DisplayMan::freePict() { delete _curBitmap; _curBitmap = NULL; diff --git a/engines/lab/dispman.h b/engines/lab/dispman.h index 5938198b87..ad506c4cdf 100644 --- a/engines/lab/dispman.h +++ b/engines/lab/dispman.h @@ -73,9 +73,8 @@ public: virtual ~DisplayMan(); void loadPict(const char *filename); - void readPict(const char *filename, bool playOnce, bool onlyDiffData = false); + void readPict(const char *filename, bool playOnce, bool onlyDiffData = false, byte *memoryBuffer = nullptr, uint16 maxHeight = 0); void freePict(); - byte *readPictToMem(const char *filename, uint16 x, uint16 y); void doScrollBlack(); void copyPage(uint16 width, uint16 height, uint16 nheight, uint16 startline, byte *mem); void doScrollWipe(char *filename); diff --git a/engines/lab/special.cpp b/engines/lab/special.cpp index f0b8152a34..6289cf2583 100644 --- a/engines/lab/special.cpp +++ b/engines/lab/special.cpp @@ -51,7 +51,7 @@ static char *journaltext, *journaltexttitle; static uint16 JPage = 0; static bool lastpage = false; static Image JBackImage, ScreenImage; -static bool GotBackImage = false; +static byte *_blankJournal; static uint16 monitorPage; static const char *TextFileName; @@ -67,16 +67,11 @@ Image *MonButton; #define NOCLEAN 152 -static byte *loadBackPict(const char *fileName, bool tomem) { - byte *res = nullptr; - +static void loadBackPict(const char *fileName) { g_lab->_graphics->FadePalette = hipal; - g_lab->_anim->_noPalChange = true; - if (tomem) - res = g_lab->_graphics->readPictToMem(fileName, g_lab->_graphics->_screenWidth, g_lab->_graphics->_screenHeight); - else - g_lab->_graphics->readPict(fileName, true); + g_lab->_anim->_noPalChange = true; + g_lab->_graphics->readPict(fileName, true); for (uint16 i = 0; i < 16; i++) { hipal[i] = ((g_lab->_anim->_diffPalette[i * 3] >> 2) << 8) + @@ -85,8 +80,6 @@ static byte *loadBackPict(const char *fileName, bool tomem) { } g_lab->_anim->_noPalChange = false; - - return res; } /** @@ -184,12 +177,21 @@ void LabEngine::loadJournalData() { Common::File *journalFile = _resource->openDataFile("P:JImage"); Utils *utils = _utils; - _journalGadgetList.push_back(createButton( 80, utils->vgaScaleY(162) + utils->svgaCord(1), 0, VKEY_LTARROW, new Image(journalFile), new Image(journalFile))); // back - _journalGadgetList.push_back(createButton(144, utils->vgaScaleY(164) - utils->svgaCord(1), 1, VKEY_RTARROW, new Image(journalFile), new Image(journalFile))); // foward _journalGadgetList.push_back(createButton(194, utils->vgaScaleY(162) + utils->svgaCord(1), 2, 0, new Image(journalFile), new Image(journalFile))); // cancel - + _journalGadgetList.push_back(createButton(144, utils->vgaScaleY(164) - utils->svgaCord(1), 1, VKEY_RTARROW, new Image(journalFile), new Image(journalFile))); // forward delete journalFile; + + _anim->_noPalChange = true; + JBackImage._imageData = new byte[_graphics->_screenWidth * _graphics->_screenHeight]; + _graphics->readPict("P:Journal.pic", true, false, JBackImage._imageData); + _anim->_noPalChange = false; + + // Keep a copy of the blank journal + _blankJournal = new byte[_graphics->_screenWidth * _graphics->_screenHeight]; + memcpy(_blankJournal, JBackImage._imageData, _graphics->_screenWidth * _graphics->_screenHeight); + + ScreenImage._imageData = _graphics->getCurrentDrawingBuffer(); } /** @@ -256,15 +258,11 @@ static void turnPage(bool fromLeft) { */ void LabEngine::drawJournal(uint16 wipenum, bool needFade) { _event->mouseHide(); - _music->updateMusic(); - - if (!GotBackImage) - JBackImage._imageData = loadBackPict("P:Journal.pic", true); - drawJournalText(); - ScreenImage._imageData = _graphics->getCurrentDrawingBuffer(); + // TODO: This is only called to set the palette correctly. Refactor, if possible + loadBackPict("P:Journal.pic"); if (wipenum == 0) JBackImage.blitBitmap(0, 0, &ScreenImage, 0, 0, _graphics->_screenWidth, _graphics->_screenHeight, false); @@ -272,7 +270,7 @@ void LabEngine::drawJournal(uint16 wipenum, bool needFade) { turnPage((bool)(wipenum == 1)); Gadget *backGadget = _event->getGadget(0); - Gadget *forwardGadget = _event->getGadget(1); + Gadget *forwardGadget = _event->getGadget(2); if (JPage == 0) disableGadget(backGadget, 15); @@ -284,18 +282,14 @@ void LabEngine::drawJournal(uint16 wipenum, bool needFade) { else enableGadget(forwardGadget); - if (needFade) _graphics->fade(true, 0); - _anim->_noPalChange = true; - JBackImage._imageData = _graphics->readPictToMem("P:Journal.pic", _graphics->_screenWidth, _graphics->_screenHeight); - GotBackImage = true; + // Reset the journal background, so that all the text that has been blitted on it is erased + memcpy(JBackImage._imageData, _blankJournal, _graphics->_screenWidth * _graphics->_screenHeight); eatMessages(); _event->mouseShow(); - - _anim->_noPalChange = false; } /** @@ -343,7 +337,6 @@ void LabEngine::doJournal() { _graphics->blackAllScreen(); lastpage = false; - GotBackImage = false; JBackImage._width = _graphics->_screenWidth; JBackImage._height = _graphics->_screenHeight; @@ -355,15 +348,16 @@ void LabEngine::doJournal() { _music->updateMusic(); loadJournalData(); - drawJournal(0, true); - _event->attachGadgetList(&_journalGadgetList); + drawJournal(0, true); _event->mouseShow(); processJournal(); _event->attachGadgetList(NULL); _graphics->fade(false, 0); _event->mouseHide(); + delete[] _blankJournal; + delete[] JBackImage._imageData; freeButtonList(&_journalGadgetList); _graphics->closeFont(journalFont); @@ -556,7 +550,7 @@ void LabEngine::doMonitor(char *background, char *textfile, bool isinteractive, delete buttonFile; ntext = _resource->getText(textfile); - loadBackPict(background, false); + loadBackPict(background); drawMonText(ntext, monitorFont, x1, y1, x2, y2, isinteractive); _event->mouseShow(); _graphics->fade(true, 0); diff --git a/engines/lab/transitions.cpp b/engines/lab/transitions.cpp index d70da5c548..5f0f419d62 100644 --- a/engines/lab/transitions.cpp +++ b/engines/lab/transitions.cpp @@ -283,12 +283,14 @@ void DisplayMan::doTransWipe(CloseDataPtr *closePtrList, char *filename) { else _vm->_curFileName = _vm->getPictName(closePtrList); - byte *BitMapMem = readPictToMem(_vm->_curFileName, _screenWidth, lastY + 5); + byte *bitMapBuffer = new byte[_screenWidth * (lastY + 5)]; + readPict(_vm->_curFileName, true, false, bitMapBuffer, lastY + 5); + setPalette(_vm->_anim->_diffPalette, 256); imSource._width = _screenWidth; imSource._height = lastY; - imSource._imageData = BitMapMem; + imSource._imageData = bitMapBuffer; imDest._width = _screenWidth; imDest._height = _screenHeight; @@ -319,6 +321,8 @@ void DisplayMan::doTransWipe(CloseDataPtr *closePtrList, char *filename) { } // while } // for i } // for j + + delete[] bitMapBuffer; } /** -- cgit v1.2.3 From e0d546a4eb704bc2cc1f2d130c28bc73e7767408 Mon Sep 17 00:00:00 2001 From: Filippos Karapetis Date: Thu, 10 Dec 2015 12:47:05 +0200 Subject: LAB: Remove extra whitespace --- engines/lab/anim.cpp | 2 +- engines/lab/utils.h | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/engines/lab/anim.cpp b/engines/lab/anim.cpp index 20d1473c67..a461996e4a 100644 --- a/engines/lab/anim.cpp +++ b/engines/lab/anim.cpp @@ -83,7 +83,7 @@ void Anim::diffNextFrame(bool onlyDiffData) { return; if (_vm->_graphics->_dispBitMap->_drawOnScreen) - _vm->_graphics->_dispBitMap->_planes[0] = _vm->_graphics->getCurrentDrawingBuffer(); + _vm->_graphics->_dispBitMap->_planes[0] = _vm->_graphics->getCurrentDrawingBuffer(); _vm->_graphics->_dispBitMap->_planes[1] = _vm->_graphics->_dispBitMap->_planes[0] + 0x10000; _vm->_graphics->_dispBitMap->_planes[2] = _vm->_graphics->_dispBitMap->_planes[1] + 0x10000; diff --git a/engines/lab/utils.h b/engines/lab/utils.h index ea6f378957..da1f89af7d 100644 --- a/engines/lab/utils.h +++ b/engines/lab/utils.h @@ -46,7 +46,7 @@ private: public: Utils(LabEngine *vm); - + uint16 scaleX(uint16 x); uint16 scaleY(uint16 y); int16 vgaScaleX(int16 x); -- cgit v1.2.3 From b77f726469fd6ff3ccad633b75fe432392c3201d Mon Sep 17 00:00:00 2001 From: Strangerke Date: Fri, 11 Dec 2015 02:00:04 +0100 Subject: LAB: Reduce some variable scopes, some renaming --- engines/lab/transitions.cpp | 95 +++++++++++++++++++++------------------------ 1 file changed, 45 insertions(+), 50 deletions(-) diff --git a/engines/lab/transitions.cpp b/engines/lab/transitions.cpp index 5f0f419d62..d7adff33fb 100644 --- a/engines/lab/transitions.cpp +++ b/engines/lab/transitions.cpp @@ -43,25 +43,21 @@ namespace Lab { * Scrolls the display to black. */ void DisplayMan::doScrollBlack() { - byte *tempmem; - Image im; - uint32 size, copysize; - byte *baseAddr; uint16 width = _vm->_utils->vgaScaleX(320); uint16 height = _vm->_utils->vgaScaleY(149) + _vm->_utils->svgaCord(2); byte *mem = new byte[width * height]; _vm->_event->mouseHide(); - im._width = width; - im._height = height; - im._imageData = mem; + Image img; + img._width = width; + img._height = height; + img._imageData = mem; _vm->_music->updateMusic(); - im.readScreenImage(0, 0); + img.readScreenImage(0, 0); _vm->_music->updateMusic(); - baseAddr = getCurrentDrawingBuffer(); - + byte *baseAddr = getCurrentDrawingBuffer(); uint16 by = _vm->_utils->vgaScaleX(4); uint16 nheight = height; @@ -78,8 +74,9 @@ void DisplayMan::doScrollBlack() { mem += by * width; nheight -= by; - size = (int32)nheight * (int32)width; - tempmem = mem; + uint32 copysize; + uint32 size = (int32)nheight * (int32)width; + byte *tempmem = mem; while (size) { if (size > _screenBytesPerPage) @@ -113,25 +110,25 @@ void DisplayMan::doScrollBlack() { _vm->_event->mouseShow(); } -void DisplayMan::copyPage(uint16 width, uint16 height, uint16 nheight, uint16 startline, byte *mem) { +void DisplayMan::copyPage(uint16 width, uint16 height, uint16 nheight, uint16 startLine, byte *mem) { byte *baseAddr = getCurrentDrawingBuffer(); uint32 size = (int32)(height - nheight) * (int32)width; - mem += startline * width; + mem += startLine * width; uint16 curPage = ((int32)nheight * (int32)width) / _screenBytesPerPage; uint32 offSet = ((int32)nheight * (int32)width) - (curPage * _screenBytesPerPage); while (size) { - uint32 copysize; + uint32 copySize; if (size > (_screenBytesPerPage - offSet)) - copysize = _screenBytesPerPage - offSet; + copySize = _screenBytesPerPage - offSet; else - copysize = size; + copySize = size; - size -= copysize; + size -= copySize; - memcpy(baseAddr + (offSet >> 2), mem, copysize); - mem += copysize; + memcpy(baseAddr + (offSet >> 2), mem, copySize); + mem += copySize; curPage++; offSet = 0; } @@ -141,7 +138,7 @@ void DisplayMan::copyPage(uint16 width, uint16 height, uint16 nheight, uint16 st * Scrolls the display to a new picture from a black screen. */ void DisplayMan::doScrollWipe(char *filename) { - uint16 startline = 0, onrow = 0; + uint16 startLine = 0, onRow = 0; _vm->_event->mouseHide(); uint16 width = _vm->_utils->vgaScaleX(320); @@ -160,26 +157,26 @@ void DisplayMan::doScrollWipe(char *filename) { uint16 by = _vm->_utils->vgaScaleX(3); uint16 nheight = height; - while (onrow < _vm->_anim->_headerdata._height) { + while (onRow < _vm->_anim->_headerdata._height) { _vm->_music->updateMusic(); if ((by > nheight) && nheight) by = nheight; - if ((startline + by) > (_vm->_anim->_headerdata._height - height - 1)) + if ((startLine + by) > (_vm->_anim->_headerdata._height - height - 1)) break; if (nheight) nheight -= by; - copyPage(width, height, nheight, startline, mem); + copyPage(width, height, nheight, startLine, mem); screenUpdate(); if (!nheight) - startline += by; + startLine += by; - onrow += by; + onRow += by; if (nheight <= (height / 4)) by = _vm->_utils->vgaScaleX(5); @@ -215,12 +212,12 @@ void DisplayMan::doScrollBounce() { byte *mem = _vm->_anim->_rawDiffBM._planes[0]; _vm->_music->updateMusic(); - int startline = _vm->_anim->_headerdata._height - height - 1; + int startLine = _vm->_anim->_headerdata._height - height - 1; for (int i = 0; i < 5; i++) { _vm->_music->updateMusic(); - startline -= newby[i]; - copyPage(width, height, 0, startline, mem); + startLine -= newby[i]; + copyPage(width, height, 0, startLine, mem); screenUpdate(); _vm->waitTOF(); @@ -228,8 +225,8 @@ void DisplayMan::doScrollBounce() { for (int i = 8; i > 0; i--) { _vm->_music->updateMusic(); - startline += newby1[i - 1]; - copyPage(width, height, 0, startline, mem); + startLine += newby1[i - 1]; + copyPage(width, height, 0, startLine, mem); screenUpdate(); _vm->waitTOF(); @@ -242,14 +239,13 @@ void DisplayMan::doScrollBounce() { * Does the transporter wipe. */ void DisplayMan::doTransWipe(CloseDataPtr *closePtrList, char *filename) { - uint16 lastY, curY, linesdone = 0, lineslast; - Image imSource, imDest; + uint16 lastY, curY, linesDone = 0, linesLast; if (_vm->_isHiRes) { - lineslast = 3; + linesLast = 3; lastY = 358; } else { - lineslast = 1; + linesLast = 1; lastY = 148; } @@ -258,10 +254,10 @@ void DisplayMan::doTransWipe(CloseDataPtr *closePtrList, char *filename) { curY = i * 2; while (curY < lastY) { - if (linesdone >= lineslast) { + if (linesDone >= linesLast) { _vm->_music->updateMusic(); _vm->waitTOF(); - linesdone = 0; + linesDone = 0; } if (j == 9) @@ -269,7 +265,7 @@ void DisplayMan::doTransWipe(CloseDataPtr *closePtrList, char *filename) { else rectFill(0, curY, _screenWidth - 1, curY + 1); curY += 4; - linesdone++; + linesDone++; } // while } // for i @@ -288,10 +284,12 @@ void DisplayMan::doTransWipe(CloseDataPtr *closePtrList, char *filename) { setPalette(_vm->_anim->_diffPalette, 256); + Image imSource; imSource._width = _screenWidth; imSource._height = lastY; imSource._imageData = bitMapBuffer; + Image imDest; imDest._width = _screenWidth; imDest._height = _screenHeight; imDest._imageData = getCurrentDrawingBuffer(); @@ -301,10 +299,10 @@ void DisplayMan::doTransWipe(CloseDataPtr *closePtrList, char *filename) { curY = i * 2; while (curY < lastY) { - if (linesdone >= lineslast) { + if (linesDone >= linesLast) { _vm->_music->updateMusic(); _vm->waitTOF(); - linesdone = 0; + linesDone = 0; } imDest._imageData = getCurrentDrawingBuffer(); @@ -317,7 +315,7 @@ void DisplayMan::doTransWipe(CloseDataPtr *closePtrList, char *filename) { imSource.blitBitmap(0, curY, &imDest, 0, curY, _screenWidth, bitmapHeight, false); } curY += 4; - linesdone++; + linesDone++; } // while } // for i } // for j @@ -393,7 +391,6 @@ void DisplayMan::blackAllScreen() { */ void DisplayMan::scrollDisplayX(int16 dx, uint16 x1, uint16 y1, uint16 x2, uint16 y2, byte *buffer) { Image im; - im._imageData = buffer; if (x1 > x2) @@ -428,7 +425,6 @@ void DisplayMan::scrollDisplayX(int16 dx, uint16 x1, uint16 y1, uint16 x2, uint1 */ void DisplayMan::scrollDisplayY(int16 dy, uint16 x1, uint16 y1, uint16 x2, uint16 y2, byte *buffer) { Image im; - im._imageData = buffer; if (x1 > x2) @@ -465,27 +461,26 @@ uint16 DisplayMan::fadeNumIn(uint16 num, uint16 res, uint16 counter) { return (num - ((((int32)(15 - counter)) * ((int32)(num - res))) / 15)); } - uint16 DisplayMan::fadeNumOut(uint16 num, uint16 res, uint16 counter) { return (num - ((((int32) counter) * ((int32)(num - res))) / 15)); } -void DisplayMan::fade(bool fadein, uint16 res) { - uint16 newpal[16]; +void DisplayMan::fade(bool fadeIn, uint16 res) { + uint16 newPal[16]; for (uint16 i = 0; i < 16; i++) { for (uint16 palIdx = 0; palIdx < 16; palIdx++) { - if (fadein) - newpal[palIdx] = (0x00F & fadeNumIn(0x00F & FadePalette[palIdx], 0x00F & res, i)) + + if (fadeIn) + newPal[palIdx] = (0x00F & fadeNumIn(0x00F & FadePalette[palIdx], 0x00F & res, i)) + (0x0F0 & fadeNumIn(0x0F0 & FadePalette[palIdx], 0x0F0 & res, i)) + (0xF00 & fadeNumIn(0xF00 & FadePalette[palIdx], 0xF00 & res, i)); else - newpal[palIdx] = (0x00F & fadeNumOut(0x00F & FadePalette[palIdx], 0x00F & res, i)) + + newPal[palIdx] = (0x00F & fadeNumOut(0x00F & FadePalette[palIdx], 0x00F & res, i)) + (0x0F0 & fadeNumOut(0x0F0 & FadePalette[palIdx], 0x0F0 & res, i)) + (0xF00 & fadeNumOut(0xF00 & FadePalette[palIdx], 0xF00 & res, i)); } - setAmigaPal(newpal, 16); + setAmigaPal(newPal, 16); _vm->waitTOF(); _vm->_music->updateMusic(); } -- cgit v1.2.3 From 8f5c91ee07b65f977ec556e22a5ddf8a916f776d Mon Sep 17 00:00:00 2001 From: Filippos Karapetis Date: Sat, 12 Dec 2015 03:28:06 +0200 Subject: LAB: Move all the tile puzzle related functionality into its own class --- engines/lab/engine.cpp | 15 ++-- engines/lab/lab.cpp | 13 +--- engines/lab/lab.h | 18 +---- engines/lab/savegame.cpp | 24 ++---- engines/lab/tilepuzzle.cpp | 185 +++++++++++++++++++++++++++------------------ engines/lab/tilepuzzle.h | 70 +++++++++++++++++ 6 files changed, 200 insertions(+), 125 deletions(-) create mode 100644 engines/lab/tilepuzzle.h diff --git a/engines/lab/engine.cpp b/engines/lab/engine.cpp index 4cfdd454f9..b80910e091 100644 --- a/engines/lab/engine.cpp +++ b/engines/lab/engine.cpp @@ -40,6 +40,7 @@ #include "lab/music.h" #include "lab/processroom.h" #include "lab/resource.h" +#include "lab/tilepuzzle.h" #include "lab/utils.h" namespace Lab { @@ -122,8 +123,7 @@ void LabEngine::freeScreens() { for (uint16 imgIdx = 0; imgIdx < 10; imgIdx++) { delete _invImages[imgIdx]; - delete _numberImages[imgIdx]; - _invImages[imgIdx] = _numberImages[imgIdx] = nullptr; + _invImages[imgIdx] = nullptr; } } @@ -459,13 +459,11 @@ void LabEngine::mainGameLoop() { if (_closeDataPtr) { if ((_closeDataPtr->_closeUpType == SPECIALLOCK) && _mainDisplay) - // LAB: Labyrinth specific code - showCombination(_curFileName); + _tilePuzzle->showCombination(_curFileName); else if (((_closeDataPtr->_closeUpType == SPECIALBRICK) || (_closeDataPtr->_closeUpType == SPECIALBRICKNOMOUSE)) && _mainDisplay) - // LAB: Labyrinth specific code - showTile(_curFileName, (bool)(_closeDataPtr->_closeUpType == SPECIALBRICKNOMOUSE)); + _tilePuzzle->showTile(_curFileName, (bool)(_closeDataPtr->_closeUpType == SPECIALBRICKNOMOUSE)); else _graphics->readPict(_curFileName, false); } else @@ -943,10 +941,9 @@ bool LabEngine::fromCrumbs(uint32 tmpClass, uint16 code, uint16 qualifier, Commo if (_closeDataPtr) { if ((_closeDataPtr->_closeUpType == SPECIALLOCK) && _mainDisplay) - // LAB: Labyrinth specific code - mouseCombination(curPos); + _tilePuzzle->mouseCombination(curPos); else if ((_closeDataPtr->_closeUpType == SPECIALBRICK) && _mainDisplay) - mouseTile(curPos); + _tilePuzzle->mouseTile(curPos); else doit = true; } else diff --git a/engines/lab/lab.cpp b/engines/lab/lab.cpp index 7a80f64f9c..be5b9556e1 100644 --- a/engines/lab/lab.cpp +++ b/engines/lab/lab.cpp @@ -43,6 +43,7 @@ #include "lab/music.h" #include "lab/processroom.h" #include "lab/resource.h" +#include "lab/tilepuzzle.h" #include "lab/utils.h" namespace Lab { @@ -86,6 +87,7 @@ LabEngine::LabEngine(OSystem *syst, const ADGameDescription *gameDesc) _anim = nullptr; _graphics = nullptr; _rooms = nullptr; + _tilePuzzle = nullptr; _utils = nullptr; _lastTooLong = false; @@ -97,12 +99,8 @@ LabEngine::LabEngine(OSystem *syst, const ADGameDescription *gameDesc) for (int i = 0; i < 10; i++) { _invImages[i] = nullptr; - _numberImages[i] = nullptr; } - for (int i = 0; i < 16; i++) - _tiles[i] = nullptr; - _curFileName = nullptr; _nextFileName = nullptr; _newFileName = nullptr; @@ -128,8 +126,6 @@ LabEngine::LabEngine(OSystem *syst, const ADGameDescription *gameDesc) _imgXMark = nullptr; _maps = nullptr; - initTilePuzzle(); - //const Common::FSNode gameDataDir(ConfMan.get("path")); //SearchMan.addSubDirectoryMatching(gameDataDir, "game"); //SearchMan.addSubDirectoryMatching(gameDataDir, "game/pict"); @@ -147,6 +143,7 @@ LabEngine::~LabEngine() { delete _anim; delete _graphics; delete[] _rooms; + delete _tilePuzzle; delete _utils; delete _imgMap; delete _imgRoom; @@ -164,9 +161,6 @@ LabEngine::~LabEngine() { delete _imgMapWest; delete _imgXMark; delete _maps; - - for (int i = 0; i < 16; i++) - delete _tiles[i]; } Common::Error LabEngine::run() { @@ -180,6 +174,7 @@ Common::Error LabEngine::run() { _music = new Music(this); _graphics = new DisplayMan(this); _anim = new Anim(this); + _tilePuzzle = new TilePuzzle(this); _utils = new Utils(this); if (getPlatform() == Common::kPlatformWindows) { diff --git a/engines/lab/lab.h b/engines/lab/lab.h index b407f319bf..7160df51f9 100644 --- a/engines/lab/lab.h +++ b/engines/lab/lab.h @@ -58,6 +58,7 @@ class Image; class LargeSet; class Music; class Resource; +class TilePuzzle; class Utils; enum GameFeatures { @@ -133,6 +134,7 @@ public: Anim *_anim; DisplayMan *_graphics; RoomData *_rooms; + TilePuzzle *_tilePuzzle; Utils *_utils; int _roomNum; @@ -160,16 +162,12 @@ public: GadgetList _invGadgetList; Image *_moveImages[20]; Image *_invImages[10]; - Image *_numberImages[10]; - uint16 _curTile[4][4]; - byte _combination[6]; private: int _lastWaitTOFTicks; bool _lastTooLong; CloseDataPtr _closeDataPtr; InventoryData *_inventory; - Image *_tiles[16]; GadgetList _journalGadgetList; GadgetList _mapGadgetList; Image *_imgMap, *_imgRoom, *_imgUpArrowRoom, *_imgDownArrowRoom, *_imgBridge; @@ -213,7 +211,6 @@ public: char *getPictName(CloseDataPtr *closePtrList); private: - // engine.cpp void freeScreens(); void perFlipGadget(uint16 gadID); bool doCloseUp(CloseDataPtr closePtr); @@ -222,17 +219,6 @@ private: void mayShowCrumbIndicator(); void mayShowCrumbIndicatorOff(); const char *getInvName(uint16 curInv); - void mouseTile(Common::Point pos); - void changeTile(uint16 col, uint16 row); - void mouseCombination(Common::Point pos); - void doTile(bool showsolution); - void showTile(const char *filename, bool showsolution); - void doTileScroll(uint16 col, uint16 row, uint16 scrolltype); - void changeCombination(uint16 number); - void scrollRaster(int16 dx, int16 dy, uint16 x1, uint16 y1, uint16 x2, uint16 y2, byte *buffer); - void doCombination(); - void showCombination(const char *filename); - void initTilePuzzle(); bool saveRestoreGame(); Common::Rect roomCoords(uint16 curRoom); void drawRoomMap(uint16 curRoom, bool drawMarkFl); diff --git a/engines/lab/savegame.cpp b/engines/lab/savegame.cpp index 686b537182..622c1a5cdb 100644 --- a/engines/lab/savegame.cpp +++ b/engines/lab/savegame.cpp @@ -28,6 +28,7 @@ * */ +#include "common/savefile.h" #include "common/translation.h" #include "gui/message.h" @@ -43,6 +44,7 @@ #include "lab/music.h" #include "lab/processroom.h" #include "lab/savegame.h" +#include "lab/tilepuzzle.h" namespace Lab { @@ -122,7 +124,7 @@ bool readSaveGameHeader(Common::InSaveFile *in, SaveGameHeader &header) { * Writes the game out to disk. */ bool saveGame(uint16 Direction, uint16 Quarters, int slot, Common::String desc) { - uint16 i, j; + uint16 i; Common::String fileName = g_lab->generateSaveFileName(slot); Common::SaveFileManager *saveFileManager = g_system->getSavefileManager(); Common::OutSaveFile *file = saveFileManager->openForSaving(fileName); @@ -147,14 +149,7 @@ bool saveGame(uint16 Direction, uint16 Quarters, int slot, Common::String desc) for (i = 0; i < g_lab->_roomsFound->_lastElement / (8 * 2); i++) file->writeUint16LE(g_lab->_roomsFound->_array[i]); - // Combination lock and tile stuff - for (i = 0; i < 6; i++) - file->writeByte(g_lab->_combination[i]); - - // Tiles - for (i = 0; i < 4; i++) - for (j = 0; j < 4; j++) - file->writeUint16LE(g_lab->_curTile[i][j]); + g_lab->_tilePuzzle->save(file); // Breadcrumbs for (i = 0; i < sizeof(g_lab->_breadCrumbs); i++) { @@ -173,7 +168,7 @@ bool saveGame(uint16 Direction, uint16 Quarters, int slot, Common::String desc) * Reads the game from disk. */ bool loadGame(uint16 *Direction, uint16 *Quarters, int slot) { - uint16 i, j; + uint16 i; Common::String fileName = g_lab->generateSaveFileName(slot); Common::SaveFileManager *saveFileManager = g_system->getSavefileManager(); Common::InSaveFile *file = saveFileManager->openForLoading(fileName); @@ -195,14 +190,7 @@ bool loadGame(uint16 *Direction, uint16 *Quarters, int slot) { for (i = 0; i < g_lab->_roomsFound->_lastElement / (8 * 2); i++) g_lab->_roomsFound->_array[i] = file->readUint16LE(); - // Combination lock and tile stuff - for (i = 0; i < 6; i++) - g_lab->_combination[i] = file->readByte(); - - // Tiles - for (i = 0; i < 4; i++) - for (j = 0; j < 4; j++) - g_lab->_curTile[i][j] = file->readUint16LE(); + g_lab->_tilePuzzle->load(file); // Breadcrumbs for (i = 0; i < 128; i++) { diff --git a/engines/lab/tilepuzzle.cpp b/engines/lab/tilepuzzle.cpp index 652c633c61..782bcda483 100644 --- a/engines/lab/tilepuzzle.cpp +++ b/engines/lab/tilepuzzle.cpp @@ -33,12 +33,12 @@ #include "gui/message.h" #include "lab/lab.h" - #include "lab/anim.h" #include "lab/dispman.h" #include "lab/image.h" #include "lab/labsets.h" #include "lab/resource.h" +#include "lab/tilepuzzle.h" #include "lab/utils.h" namespace Lab { @@ -59,7 +59,7 @@ const uint16 SOLUTION[4][4] = { const int COMBINATION_X[6] = { 45, 83, 129, 166, 211, 248 }; -void LabEngine::initTilePuzzle() { +TilePuzzle::TilePuzzle(LabEngine *vm) : _vm(vm) { for (int i = 0; i < 16; i++) _tiles[i] = nullptr; @@ -70,13 +70,26 @@ void LabEngine::initTilePuzzle() { for (int i = 0; i < 6; i++) _combination[i] = 0; + + for (int i = 0; i < 10; i++) + _numberImages[i] = nullptr; +} + +TilePuzzle::~TilePuzzle() { + for (int i = 0; i < 16; i++) + delete _tiles[i]; + + for (uint16 imgIdx = 0; imgIdx < 10; imgIdx++) { + delete _numberImages[imgIdx]; + _numberImages[imgIdx] = nullptr; + } } /** * Processes mouse clicks and changes the combination. */ -void LabEngine::mouseTile(Common::Point pos) { - Common::Point realPos = _utils->vgaUnscale(pos); +void TilePuzzle::mouseTile(Common::Point pos) { + Common::Point realPos = _vm->_utils->vgaUnscale(pos); if ((realPos.x < 101) || (realPos.y < 26)) return; @@ -91,7 +104,7 @@ void LabEngine::mouseTile(Common::Point pos) { /** * Changes the combination number of one of the slots */ -void LabEngine::changeTile(uint16 col, uint16 row) { +void TilePuzzle::changeTile(uint16 col, uint16 row) { int16 scrolltype = -1; if (row > 0) { @@ -129,7 +142,7 @@ void LabEngine::changeTile(uint16 col, uint16 row) { if (scrolltype != -1) { doTileScroll(col, row, scrolltype); - if (getFeatures() & GF_WINDOWS_TRIAL) { + if (_vm->getFeatures() & GF_WINDOWS_TRIAL) { GUI::MessageDialog trialMessage("This puzzle is not available in the trial version of the game"); trialMessage.runModal(); return; @@ -151,9 +164,9 @@ void LabEngine::changeTile(uint16 col, uint16 row) { if (check) { // unlocked combination - _conditions->inclElement(BRICKOPEN); - _anim->_doBlack = true; - _graphics->readPict("p:Up/BDOpen", true); + _vm->_conditions->inclElement(BRICKOPEN); + _vm->_anim->_doBlack = true; + _vm->_graphics->readPict("p:Up/BDOpen", true); } } } @@ -161,8 +174,8 @@ void LabEngine::changeTile(uint16 col, uint16 row) { /** * Processes mouse clicks and changes the combination. */ -void LabEngine::mouseCombination(Common::Point pos) { - Common::Point realPos = _utils->vgaUnscale(pos); +void TilePuzzle::mouseCombination(Common::Point pos) { + Common::Point realPos = _vm->_utils->vgaUnscale(pos); if (!Common::Rect(44, 63, 285, 99).contains(realPos)) return; @@ -187,25 +200,25 @@ void LabEngine::mouseCombination(Common::Point pos) { /** * Draws the images of the combination lock to the display bitmap. */ -void LabEngine::doTile(bool showsolution) { +void TilePuzzle::doTile(bool showsolution) { uint16 row = 0, col = 0, rowm, colm, num; int16 rows, cols; if (showsolution) { - rowm = _utils->vgaScaleY(23); - colm = _utils->vgaScaleX(27); + rowm = _vm->_utils->vgaScaleY(23); + colm = _vm->_utils->vgaScaleX(27); - rows = _utils->vgaScaleY(31); - cols = _utils->vgaScaleX(105); + rows = _vm->_utils->vgaScaleY(31); + cols = _vm->_utils->vgaScaleX(105); } else { - _graphics->setAPen(0); - _graphics->rectFillScaled(97, 22, 220, 126); + _vm->_graphics->setAPen(0); + _vm->_graphics->rectFillScaled(97, 22, 220, 126); - rowm = _utils->vgaScaleY(25); - colm = _utils->vgaScaleX(30); + rowm = _vm->_utils->vgaScaleY(25); + colm = _vm->_utils->vgaScaleX(30); - rows = _utils->vgaScaleY(25); - cols = _utils->vgaScaleX(100); + rows = _vm->_utils->vgaScaleY(25); + cols = _vm->_utils->vgaScaleX(100); } while (row < 4) { @@ -229,63 +242,63 @@ void LabEngine::doTile(bool showsolution) { /** * Reads in a backdrop picture. */ -void LabEngine::showTile(const char *filename, bool showsolution) { - uint16 start = showsolution ? 0 : 1; +void TilePuzzle::showTile(const char *filename, bool showSolution) { + uint16 start = showSolution ? 0 : 1; - _anim->_doBlack = true; - _anim->_noPalChange = true; - _graphics->readPict(filename, true); - _anim->_noPalChange = false; - _graphics->blackScreen(); + _vm->_anim->_doBlack = true; + _vm->_anim->_noPalChange = true; + _vm->_graphics->readPict(filename, true); + _vm->_anim->_noPalChange = false; + _vm->_graphics->blackScreen(); - Common::File *tileFile = tileFile = _resource->openDataFile(showsolution ? "P:TileSolution" : "P:Tile"); + Common::File *tileFile = _vm->_resource->openDataFile(showSolution ? "P:TileSolution" : "P:Tile"); for (uint16 curBit = start; curBit < 16; curBit++) _tiles[curBit] = new Image(tileFile); delete tileFile; - doTile(showsolution); - _graphics->setPalette(_anim->_diffPalette, 256); + doTile(showSolution); + _vm->_graphics->setPalette(_vm->_anim->_diffPalette, 256); } /** * Does the scrolling for the tiles on the tile puzzle. */ -void LabEngine::doTileScroll(uint16 col, uint16 row, uint16 scrolltype) { +void TilePuzzle::doTileScroll(uint16 col, uint16 row, uint16 scrolltype) { int16 dX = 0, dY = 0, dx = 0, dy = 0, sx = 0, sy = 0; uint16 last = 0; if (scrolltype == LEFTSCROLL) { - dX = _utils->vgaScaleX(5); - sx = _utils->vgaScaleX(5); + dX = _vm->_utils->vgaScaleX(5); + sx = _vm->_utils->vgaScaleX(5); last = 6; } else if (scrolltype == RIGHTSCROLL) { - dX = _utils->vgaScaleX(-5); - dx = _utils->vgaScaleX(-5); - sx = _utils->vgaScaleX(5); + dX = _vm->_utils->vgaScaleX(-5); + dx = _vm->_utils->vgaScaleX(-5); + sx = _vm->_utils->vgaScaleX(5); last = 6; } else if (scrolltype == UPSCROLL) { - dY = _utils->vgaScaleY(5); - sy = _utils->vgaScaleY(5); + dY = _vm->_utils->vgaScaleY(5); + sy = _vm->_utils->vgaScaleY(5); last = 5; } else if (scrolltype == DOWNSCROLL) { - dY = _utils->vgaScaleY(-5); - dy = _utils->vgaScaleY(-5); - sy = _utils->vgaScaleY(5); + dY = _vm->_utils->vgaScaleY(-5); + dy = _vm->_utils->vgaScaleY(-5); + sy = _vm->_utils->vgaScaleY(5); last = 5; } - sx += _utils->svgaCord(2); + sx += _vm->_utils->svgaCord(2); - uint16 x1 = _utils->vgaScaleX(100) + (col * _utils->vgaScaleX(30)) + dx; - uint16 y1 = _utils->vgaScaleY(25) + (row * _utils->vgaScaleY(25)) + dy; + uint16 x1 = _vm->_utils->vgaScaleX(100) + (col * _vm->_utils->vgaScaleX(30)) + dx; + uint16 y1 = _vm->_utils->vgaScaleY(25) + (row * _vm->_utils->vgaScaleY(25)) + dy; byte *buffer = new byte[_tiles[1]->_width * _tiles[1]->_height * 2L]; for (uint16 i = 0; i < last; i++) { - waitTOF(); - scrollRaster(dX, dY, x1, y1, x1 + _utils->vgaScaleX(28) + sx, y1 + _utils->vgaScaleY(23) + sy, buffer); + _vm->waitTOF(); + scrollRaster(dX, dY, x1, y1, x1 + _vm->_utils->vgaScaleX(28) + sx, y1 + _vm->_utils->vgaScaleY(23) + sy, buffer); x1 += dX; y1 += dY; } @@ -296,7 +309,7 @@ void LabEngine::doTileScroll(uint16 col, uint16 row, uint16 scrolltype) { /** * Changes the combination number of one of the slots */ -void LabEngine::changeCombination(uint16 number) { +void TilePuzzle::changeCombination(uint16 number) { const int solution[6] = { 0, 4, 0, 8, 7, 2 }; Image display; @@ -310,22 +323,22 @@ void LabEngine::changeCombination(uint16 number) { combnum = _combination[number]; - display._imageData = _graphics->getCurrentDrawingBuffer(); - display._width = _graphics->_screenWidth; - display._height = _graphics->_screenHeight; + display._imageData = _vm->_graphics->getCurrentDrawingBuffer(); + display._width = _vm->_graphics->_screenWidth; + display._height = _vm->_graphics->_screenHeight; byte *buffer = new byte[_tiles[1]->_width * _tiles[1]->_height * 2L]; for (uint16 i = 1; i <= (_numberImages[combnum]->_height / 2); i++) { - if (_isHiRes) { + if (_vm->_isHiRes) { if (i & 1) - waitTOF(); + _vm->waitTOF(); } else - waitTOF(); + _vm->waitTOF(); - display._imageData = _graphics->getCurrentDrawingBuffer(); - _graphics->scrollDisplayY(2, _utils->vgaScaleX(COMBINATION_X[number]), _utils->vgaScaleY(65), _utils->vgaScaleX(COMBINATION_X[number]) + (_numberImages[combnum])->_width - 1, _utils->vgaScaleY(65) + (_numberImages[combnum])->_height, buffer); - _numberImages[combnum]->blitBitmap(0, (_numberImages[combnum])->_height - (2 * i), &(display), _utils->vgaScaleX(COMBINATION_X[number]), _utils->vgaScaleY(65), (_numberImages[combnum])->_width, 2, false); + display._imageData = _vm->_graphics->getCurrentDrawingBuffer(); + _vm->_graphics->scrollDisplayY(2, _vm->_utils->vgaScaleX(COMBINATION_X[number]), _vm->_utils->vgaScaleY(65), _vm->_utils->vgaScaleX(COMBINATION_X[number]) + (_numberImages[combnum])->_width - 1, _vm->_utils->vgaScaleY(65) + (_numberImages[combnum])->_height, buffer); + _numberImages[combnum]->blitBitmap(0, (_numberImages[combnum])->_height - (2 * i), &(display), _vm->_utils->vgaScaleX(COMBINATION_X[number]), _vm->_utils->vgaScaleY(65), (_numberImages[combnum])->_width, 2, false); } delete[] buffer; @@ -334,39 +347,39 @@ void LabEngine::changeCombination(uint16 number) { unlocked &= (_combination[i] == solution[i]); if (unlocked) - _conditions->inclElement(COMBINATIONUNLOCKED); + _vm->_conditions->inclElement(COMBINATIONUNLOCKED); else - _conditions->exclElement(COMBINATIONUNLOCKED); + _vm->_conditions->exclElement(COMBINATIONUNLOCKED); } -void LabEngine::scrollRaster(int16 dx, int16 dy, uint16 x1, uint16 y1, uint16 x2, uint16 y2, byte *buffer) { +void TilePuzzle::scrollRaster(int16 dx, int16 dy, uint16 x1, uint16 y1, uint16 x2, uint16 y2, byte *buffer) { if (dx) - _graphics->scrollDisplayX(dx, x1, y1, x2, y2, buffer); + _vm->_graphics->scrollDisplayX(dx, x1, y1, x2, y2, buffer); if (dy) - _graphics->scrollDisplayY(dy, x1, y1, x2, y2, buffer); + _vm->_graphics->scrollDisplayY(dy, x1, y1, x2, y2, buffer); } /** * Draws the images of the combination lock to the display bitmap. */ -void LabEngine::doCombination() { +void TilePuzzle::doCombination() { for (uint16 i = 0; i <= 5; i++) - _numberImages[_combination[i]]->drawImage(_utils->vgaScaleX(COMBINATION_X[i]), _utils->vgaScaleY(65)); + _numberImages[_combination[i]]->drawImage(_vm->_utils->vgaScaleX(COMBINATION_X[i]), _vm->_utils->vgaScaleY(65)); } /** * Reads in a backdrop picture. */ -void LabEngine::showCombination(const char *filename) { - _anim->_doBlack = true; - _anim->_noPalChange = true; - _graphics->readPict(filename, true); - _anim->_noPalChange = false; +void TilePuzzle::showCombination(const char *filename) { + _vm->_anim->_doBlack = true; + _vm->_anim->_noPalChange = true; + _vm->_graphics->readPict(filename, true); + _vm->_anim->_noPalChange = false; - _graphics->blackScreen(); + _vm->_graphics->blackScreen(); - Common::File *numFile = _resource->openDataFile("P:Numbers"); + Common::File *numFile = _vm->_resource->openDataFile("P:Numbers"); for (uint16 CurBit = 0; CurBit < 10; CurBit++) _numberImages[CurBit] = new Image(numFile); @@ -375,7 +388,33 @@ void LabEngine::showCombination(const char *filename) { doCombination(); - _graphics->setPalette(_anim->_diffPalette, 256); + _vm->_graphics->setPalette(_vm->_anim->_diffPalette, 256); +} + +void TilePuzzle::save(Common::OutSaveFile *file) { + uint16 i, j; + + // Combination lock and tile stuff + for (i = 0; i < 6; i++) + file->writeByte(_combination[i]); + + // Tiles + for (i = 0; i < 4; i++) + for (j = 0; j < 4; j++) + file->writeUint16LE(_curTile[i][j]); +} + +void TilePuzzle::load(Common::InSaveFile *file) { + uint16 i, j; + + // Combination lock and tile stuff + for (i = 0; i < 6; i++) + _combination[i] = file->readByte(); + + // Tiles + for (i = 0; i < 4; i++) + for (j = 0; j < 4; j++) + _curTile[i][j] = file->readUint16LE(); } } // End of namespace Lab diff --git a/engines/lab/tilepuzzle.h b/engines/lab/tilepuzzle.h new file mode 100644 index 0000000000..a20f4ce04a --- /dev/null +++ b/engines/lab/tilepuzzle.h @@ -0,0 +1,70 @@ +/* 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. + * + */ + +/* + * This code is based on Labyrinth of Time code with assistance of + * + * Copyright (c) 1993 Terra Nova Development + * Copyright (c) 2004 The Wyrmkeep Entertainment Co. + * + */ + +#ifndef LAB_TILEPUZZLE_H +#define LAB_TILEPUZZLE_H + +#include "common/savefile.h" + +namespace Lab { + +class LabEngine; + +class TilePuzzle { +private: + LabEngine *_vm; + Image *_tiles[16]; + Image *_numberImages[10]; + uint16 _curTile[4][4]; + byte _combination[6]; + +public: + TilePuzzle(LabEngine *vm); + virtual ~TilePuzzle(); + + void mouseTile(Common::Point pos); + void showTile(const char *filename, bool showSolution); + void mouseCombination(Common::Point pos); + void showCombination(const char *filename); + void save(Common::OutSaveFile *file); + void load(Common::InSaveFile *file); + +private: + void doTile(bool showsolution); + void doTileScroll(uint16 col, uint16 row, uint16 scrolltype); + void changeCombination(uint16 number); + void scrollRaster(int16 dx, int16 dy, uint16 x1, uint16 y1, uint16 x2, uint16 y2, byte *buffer); + void doCombination(); + void changeTile(uint16 col, uint16 row); +}; + +} // End of namespace Lab + +#endif // LAB_TILEPUZZLE_H -- cgit v1.2.3 From 46a25b93abc8b44cc2c1e44f7ba73f86de64399b Mon Sep 17 00:00:00 2001 From: Filippos Karapetis Date: Sat, 12 Dec 2015 16:33:01 +0200 Subject: LAB: Rewrite some code using switch statements --- engines/lab/engine.cpp | 89 ++++++++++++++++++++++++++++++-------------------- 1 file changed, 54 insertions(+), 35 deletions(-) diff --git a/engines/lab/engine.cpp b/engines/lab/engine.cpp index b80910e091..c9e1348115 100644 --- a/engines/lab/engine.cpp +++ b/engines/lab/engine.cpp @@ -280,8 +280,8 @@ void LabEngine::interfaceOn() { * If the user hits the "Use" gadget; things that can get used on themselves. */ bool LabEngine::doUse(uint16 curInv) { - if (curInv == MAPNUM) { - // LAB: Labyrinth specific + switch (curInv) { + case MAPNUM: drawStaticMessage(kTextUseMap); interfaceOff(); _anim->stopDiff(); @@ -291,8 +291,8 @@ bool LabEngine::doUse(uint16 curInv) { _graphics->setPalette(initcolors, 8); _graphics->drawMessage(nullptr); _graphics->drawPanel(); - } else if (curInv == JOURNALNUM) { - // LAB: Labyrinth specific + return true; + case JOURNALNUM: drawStaticMessage(kTextUseJournal); interfaceOff(); _anim->stopDiff(); @@ -301,14 +301,15 @@ bool LabEngine::doUse(uint16 curInv) { doJournal(); _graphics->drawPanel(); _graphics->drawMessage(nullptr); - } else if (curInv == LAMPNUM) { - // LAB: Labyrinth specific + return true; + case LAMPNUM: interfaceOff(); if (_conditions->in(LAMPON)) { drawStaticMessage(kTextTurnLampOff); _conditions->exclElement(LAMPON); - } else { + } + else { drawStaticMessage(kTextTurnLampOn); _conditions->inclElement(LAMPON); } @@ -320,29 +321,29 @@ bool LabEngine::doUse(uint16 curInv) { _anim->_doBlack = false; _nextFileName = getInvName(curInv); - } else if (curInv == BELTNUM) { - // LAB: Labyrinth specific + return true; + case BELTNUM: if (!_conditions->in(BELTGLOW)) _conditions->inclElement(BELTGLOW); _anim->_doBlack = false; _nextFileName = getInvName(curInv); - } else if (curInv == WHISKEYNUM) { - // LAB: Labyrinth specific + return true; + case WHISKEYNUM: _conditions->inclElement(USEDHELMET); drawStaticMessage(kTextUseWhiskey); - } else if (curInv == PITHHELMETNUM) { - // LAB: Labyrinth specific + return true; + case PITHHELMETNUM: _conditions->inclElement(USEDHELMET); drawStaticMessage(kTextUsePith); - } else if (curInv == HELMETNUM) { - // LAB: Labyrinth specific + return true; + case HELMETNUM: _conditions->inclElement(USEDHELMET); drawStaticMessage(kTextUseHelmet); - } else + return true; + default: return false; - - return true; + } } /** @@ -458,14 +459,20 @@ void LabEngine::mainGameLoop() { _curFileName = _nextFileName; if (_closeDataPtr) { - if ((_closeDataPtr->_closeUpType == SPECIALLOCK) && _mainDisplay) - _tilePuzzle->showCombination(_curFileName); - else if (((_closeDataPtr->_closeUpType == SPECIALBRICK) || - (_closeDataPtr->_closeUpType == SPECIALBRICKNOMOUSE)) && - _mainDisplay) - _tilePuzzle->showTile(_curFileName, (bool)(_closeDataPtr->_closeUpType == SPECIALBRICKNOMOUSE)); - else + switch (_closeDataPtr->_closeUpType) { + case SPECIALLOCK: + if (_mainDisplay) + _tilePuzzle->showCombination(_curFileName); + break; + case SPECIALBRICK: + case SPECIALBRICKNOMOUSE: + if (_mainDisplay) + _tilePuzzle->showTile(_curFileName, (_closeDataPtr->_closeUpType == SPECIALBRICKNOMOUSE)); + break; + default: _graphics->readPict(_curFileName, false); + break; + } } else _graphics->readPict(_curFileName, false); @@ -503,12 +510,19 @@ void LabEngine::mainGameLoop() { if (result != 0) { uint16 code = 0; - if (result == VKEY_UPARROW) + switch (result) { + case VKEY_UPARROW: code = 7; - else if (result == VKEY_LTARROW) + break; + case VKEY_LTARROW: code = 6; - else if (result == VKEY_RTARROW) + break; + case VKEY_RTARROW: code = 8; + break; + default: + break; + } gotMessage = true; mayShowCrumbIndicator(); @@ -776,8 +790,6 @@ bool LabEngine::fromCrumbs(uint32 tmpClass, uint16 code, uint16 qualifier, Commo } } else if (_droppingCrumbs && oldRoomNum != _roomNum) { // If in surreal maze, turn off DroppingCrumbs. - // Note: These numbers were generated by parsing the - // "Maps" file, which is why they are hard-coded. Bleh! if (_roomNum >= 245 && _roomNum <= 280) { _followingCrumbs = false; _droppingCrumbs = false; @@ -940,12 +952,19 @@ bool LabEngine::fromCrumbs(uint32 tmpClass, uint16 code, uint16 qualifier, Commo doit = false; if (_closeDataPtr) { - if ((_closeDataPtr->_closeUpType == SPECIALLOCK) && _mainDisplay) - _tilePuzzle->mouseCombination(curPos); - else if ((_closeDataPtr->_closeUpType == SPECIALBRICK) && _mainDisplay) - _tilePuzzle->mouseTile(curPos); - else + switch (_closeDataPtr->_closeUpType) { + case SPECIALLOCK: + if (_mainDisplay) + _tilePuzzle->mouseCombination(curPos); + break; + case SPECIALBRICK: + if (_mainDisplay) + _tilePuzzle->mouseTile(curPos); + break; + default: doit = true; + break; + } } else doit = true; -- cgit v1.2.3 From 7d4e71d29e9b97f3991b3264c509369ec8a91122 Mon Sep 17 00:00:00 2001 From: Filippos Karapetis Date: Sat, 12 Dec 2015 18:24:47 +0200 Subject: LAB: Change the map floor showing code, when changing floors This greatly simplifies the code that shows a floor when an arrow is pressed. Also, it changes the behavior of the arrows to show all of the visited floors, instead of a specific subset. I believe that this makes the map better, more usable and less confusing than the original --- engines/lab/lab.h | 6 ++-- engines/lab/map.cpp | 101 ++++++++++++++++++++-------------------------------- 2 files changed, 41 insertions(+), 66 deletions(-) diff --git a/engines/lab/lab.h b/engines/lab/lab.h index 7160df51f9..b7491acc40 100644 --- a/engines/lab/lab.h +++ b/engines/lab/lab.h @@ -222,9 +222,9 @@ private: bool saveRestoreGame(); Common::Rect roomCoords(uint16 curRoom); void drawRoomMap(uint16 curRoom, bool drawMarkFl); - bool onFloor(uint16 floorNum); - bool getUpFloor(uint16 *floorNum); - bool getDownFloor(uint16 *floorNum); + bool floorVisited(uint16 floorNum); + uint16 getUpperFloor(uint16 floorNum); + uint16 getLowerFloor(uint16 floorNum); bool checkConditions(int16 *condition); ViewData *getViewData(uint16 roomNum, uint16 direction); CloseData *getObject(Common::Point pos, CloseDataPtr closePtr); diff --git a/engines/lab/map.cpp b/engines/lab/map.cpp index b484a1e323..db995504a2 100644 --- a/engines/lab/map.cpp +++ b/engines/lab/map.cpp @@ -317,7 +317,7 @@ void LabEngine::drawRoomMap(uint16 curRoom, bool drawMarkFl) { /** * Checks if a floor has been visited. */ -bool LabEngine::onFloor(uint16 floorNum) { +bool LabEngine::floorVisited(uint16 floorNum) { for (uint16 i = 1; i <= _maxRooms; i++) { if ((_maps[i]._pageNumber == floorNum) && _roomsFound->in(i) && _maps[i]._x) return true; @@ -327,48 +327,33 @@ bool LabEngine::onFloor(uint16 floorNum) { } /** - * Figures out which floor, if any, should be gone to if the up arrow is hit + * Returns the floor to show when the up arrow is pressed + * Note: The original did not show all the visited floors, but we do */ -bool LabEngine::getUpFloor(uint16 *floorNum) { - do { - if (*floorNum < kFloorUpper) - (*floorNum)++; - else { - *floorNum = kFloorCarnival + 1; - return false; - } - } while ((!onFloor(*floorNum)) && (*floorNum <= kFloorCarnival)); +uint16 LabEngine::getUpperFloor(uint16 floorNum) { + if (floorNum == kFloorCarnival || floorNum == kFloorNone) + return kFloorNone; + + for (uint16 i = floorNum; i < kFloorCarnival; i++) + if (floorVisited(i + 1)) + return i + 1; - return true; + return kFloorNone; } /** - * Figures out which floor, if any, should be gone to if the down arrow is - * hit. + * Returns the floor to show when the down arrow is pressed + * Note: The original did not show all the visited floors, but we do */ -bool LabEngine::getDownFloor(uint16 *floorNum) { - do { - if ((*floorNum == kFloorLower) || (*floorNum == kFloorNone)) { - *floorNum = kFloorNone; - return false; - } else if (*floorNum > kFloorUpper) { - // Labyrinth specific code - if (*floorNum == kFloorHedgeMaze) - *floorNum = kFloorUpper; - else if ((*floorNum == kFloorCarnival) || (*floorNum == kFloorMedMaze)) - *floorNum = kFloorMiddle; - else if (*floorNum == kFloorSurMaze) - *floorNum = kFloorLower; - else { - *floorNum = kFloorNone; - return false; - } - } else - (*floorNum)--; +uint16 LabEngine::getLowerFloor(uint16 floorNum) { + if (floorNum == kFloorLower || floorNum == kFloorNone) + return kFloorNone; - } while ((!onFloor(*floorNum)) && (*floorNum != kFloorNone)); + for (uint16 i = floorNum; i > kFloorLower; i--) + if (floorVisited(i - 1)) + return i - 1; - return true; + return kFloorNone; } /** @@ -399,37 +384,31 @@ void LabEngine::drawMap(uint16 curRoom, uint16 curMsg, uint16 floorNum, bool fad if ((_maps[curRoom]._pageNumber == floorNum) && _roomsFound->in(curRoom) && _maps[curRoom]._x) drawRoomMap(curRoom, true); - uint16 tempfloor = floorNum; - bool noOverlay = getUpFloor(&tempfloor); - Gadget *upGadget = _event->getGadget(1); Gadget *downGadget = _event->getGadget(2); - if (noOverlay) + if (getUpperFloor(floorNum) != kFloorNone) enableGadget(upGadget); else disableGadget(upGadget, 12); - tempfloor = floorNum; - noOverlay = getDownFloor(&tempfloor); - - if (noOverlay) + if (getLowerFloor(floorNum) != kFloorNone) enableGadget(downGadget); else disableGadget(downGadget, 12); // Labyrinth specific code if (floorNum == kFloorLower) { - if (onFloor(kFloorSurMaze)) + if (floorVisited(kFloorSurMaze)) _imgMaze->drawImage(_utils->mapScaleX(538), _utils->mapScaleY(277)); } else if (floorNum == kFloorMiddle) { - if (onFloor(kFloorCarnival)) + if (floorVisited(kFloorCarnival)) _imgMaze->drawImage(_utils->mapScaleX(358), _utils->mapScaleY(72)); - if (onFloor(kFloorMedMaze)) + if (floorVisited(kFloorMedMaze)) _imgMaze->drawImage(_utils->mapScaleX(557), _utils->mapScaleY(325)); } else if (floorNum == kFloorUpper) { - if (onFloor(kFloorHedgeMaze)) + if (floorVisited(kFloorHedgeMaze)) _imgHugeMaze->drawImage(_utils->mapScaleX(524), _utils->mapScaleY(97)); } else if (floorNum == kFloorSurMaze) { char *sptr = (char *)_resource->getStaticText(kTextSurmazeMessage).c_str(); @@ -510,31 +489,27 @@ void LabEngine::processMap(uint16 curRoom) { return; } else if (gadgetID == 1) { // Up arrow - uint16 oldFloor = curFloor; - bool drawmap = getUpFloor(&curFloor); - - if (drawmap) { + uint16 upperFloor = getUpperFloor(curFloor); + if (upperFloor != kFloorNone) { + curFloor = upperFloor; _graphics->fade(false, 0); drawMap(curRoom, curMsg, curFloor, false, false); _graphics->fade(true, 0); - } else - curFloor = oldFloor; + } } else if (gadgetID == 2) { // Down arrow - uint16 oldFloor = curFloor; - bool drawmap = getDownFloor(&curFloor); - - if (drawmap) { + uint16 lowerFloor = getLowerFloor(curFloor); + if (lowerFloor != kFloorNone) { + curFloor = lowerFloor; _graphics->fade(false, 0); drawMap(curRoom, curMsg, curFloor, false, false); _graphics->fade(true, 0); - } else - curFloor = oldFloor; + } } } else if ((msgClass == MOUSEBUTTONS) && (IEQUALIFIER_LEFTBUTTON & qualifier)) { if ((curFloor == kFloorLower) && (mouseX >= _utils->mapScaleX(538)) && (mouseY >= _utils->mapScaleY(277)) && (mouseX <= _utils->mapScaleX(633)) && (mouseY <= _utils->mapScaleY(352)) - && onFloor(kFloorSurMaze)) { + && floorVisited(kFloorSurMaze)) { curFloor = kFloorSurMaze; _graphics->fade(false, 0); @@ -542,7 +517,7 @@ void LabEngine::processMap(uint16 curRoom) { _graphics->fade(true, 0); } else if ((curFloor == kFloorMiddle) && (mouseX >= _utils->mapScaleX(358)) && (mouseY >= _utils->mapScaleY(71)) && (mouseX <= _utils->mapScaleX(452)) && (mouseY <= _utils->mapScaleY(147)) - && onFloor(kFloorCarnival)) { + && floorVisited(kFloorCarnival)) { curFloor = kFloorCarnival; _graphics->fade(false, 0); @@ -550,7 +525,7 @@ void LabEngine::processMap(uint16 curRoom) { _graphics->fade(true, 0); } else if ((curFloor == kFloorMiddle) && (mouseX >= _utils->mapScaleX(557)) && (mouseY >= _utils->mapScaleY(325)) && (mouseX <= _utils->mapScaleX(653)) && (mouseY <= _utils->mapScaleY(401)) - && onFloor(kFloorMedMaze)) { + && floorVisited(kFloorMedMaze)) { curFloor = kFloorMedMaze; _graphics->fade(false, 0); @@ -558,7 +533,7 @@ void LabEngine::processMap(uint16 curRoom) { _graphics->fade(true, 0); } else if ((curFloor == kFloorUpper) && (mouseX >= _utils->mapScaleX(524)) && (mouseY >= _utils->mapScaleY(97)) && (mouseX <= _utils->mapScaleX(645)) && (mouseY <= _utils->mapScaleY(207)) - && onFloor(kFloorHedgeMaze)) { + && floorVisited(kFloorHedgeMaze)) { curFloor = kFloorHedgeMaze; _graphics->fade(false, 0); -- cgit v1.2.3 From 4fb53ad170f483bbce2e27643cd3ee1fa604cebd Mon Sep 17 00:00:00 2001 From: Filippos Karapetis Date: Sat, 12 Dec 2015 19:11:30 +0200 Subject: LAB: Some renames, simplified saveGame() and loadGame() --- engines/lab/engine.cpp | 146 +++++++++++++++++++++++++---------------------- engines/lab/lab.h | 7 ++- engines/lab/resource.h | 4 +- engines/lab/savegame.cpp | 16 +++--- engines/lab/savegame.h | 4 +- 5 files changed, 94 insertions(+), 83 deletions(-) diff --git a/engines/lab/engine.cpp b/engines/lab/engine.cpp index c9e1348115..17518fb750 100644 --- a/engines/lab/engine.cpp +++ b/engines/lab/engine.cpp @@ -50,37 +50,37 @@ namespace Lab { #define SPECIALBRICK 101 #define SPECIALBRICKNOMOUSE 102 -#define MAPNUM 28 -#define JOURNALNUM 9 -#define WESTPAPERNUM 18 -#define NOTESNUM 12 -#define WHISKEYNUM 25 -#define PITHHELMETNUM 7 -#define HELMETNUM 1 - -#define LAMPNUM 27 -#define LAMPON 151 - -#define BELTNUM 3 -#define BELTGLOW 70 - -#define USEDHELMET 184 - -#define QUARTERNUM 30 - - -#define MUSEUMMONITOR 71 -#define GRAMAPHONEMONITOR 72 -#define UNICYCLEMONITOR 73 -#define STATUEMONITOR 74 -#define TALISMANMONITOR 75 -#define LUTEMONITOR 76 -#define CLOCKMONITOR 77 -#define WINDOWMONITOR 78 -#define BELTMONITOR 79 -#define LIBRARYMONITOR 80 -#define TERMINALMONITOR 81 -#define LEVERSMONITOR 82 +enum Items { + kItemHelmet = 1, + kItemBelt = 3, + kItemPithHelmet = 7, + kItemJournal = 9, + kItemNotes = 12, + kItemWestPaper = 18, + kItemWhiskey = 25, + kItemLamp = 27, + kItemMap = 28, + kItemQuarter = 30 +}; + +#define kCondLampOn 151 +#define kCondBeltGlowing 70 +#define kCondUsedHelmet 184 + +enum Monitors { + kMonitorMuseum = 71, + kMonitorGramophone = 72, + kMonitorUnicycle = 73, + kMonitorStatue = 74, + kMonitorTalisman = 75, + kMonitorLute = 76, + kMonitorClock = 77, + kMonitorWindow = 78, + //kMonitorBelt = 79, + kMonitorLibrary = 80, + kMonitorTerminal = 81 + //kMonitorLevers = 82 +}; static char initcolors[] = { '\x00', '\x00', '\x00', '\x30', '\x30', '\x30', '\x10', '\x10', @@ -89,6 +89,14 @@ static char initcolors[] = { '\x00', '\x00', '\x00', '\x30', '\x24', '\x24', '\x2c', '\x2c', '\x2c', '\x08', '\x08', '\x08' }; +uint16 LabEngine::getQuarters() { + return _inventory[kItemQuarter]._many; +} + +void LabEngine::setQuarters(uint16 quarters) { + _inventory[kItemQuarter]._many = quarters; +} + /** * Draws the message for the room. */ @@ -100,9 +108,9 @@ void LabEngine::drawRoomMessage(uint16 curInv, CloseDataPtr closePtr) { if (_alternate) { if ((curInv <= _numInv) && _conditions->in(curInv) && _inventory[curInv]._bitmapName) { - if ((curInv == LAMPNUM) && _conditions->in(LAMPON)) + if ((curInv == kItemLamp) && _conditions->in(kCondLampOn)) // LAB: Labyrinth specific - drawStaticMessage(kTextLampOn); + drawStaticMessage(kTextkLampOn); else if (_inventory[curInv]._many > 1) { Common::String roomMessage = Common::String(_inventory[curInv]._name) + " (" + Common::String::format("%d", _inventory[curInv]._many) + ")"; _graphics->drawMessage(roomMessage.c_str()); @@ -182,30 +190,30 @@ bool LabEngine::doCloseUp(CloseDataPtr closePtr) { } switch (closePtr->_closeUpType) { - case MUSEUMMONITOR: - case LIBRARYMONITOR: - case WINDOWMONITOR: + case kMonitorMuseum: + case kMonitorLibrary: + case kMonitorWindow: doMonitor(closePtr->_graphicName, closePtr->_message, false, monltmargin, montopmargin, monrtmargin, 165); break; - case GRAMAPHONEMONITOR: + case kMonitorGramophone: doMonitor(closePtr->_graphicName, closePtr->_message, false, monltmargin, montopmargin, 171, 165); break; - case UNICYCLEMONITOR: + case kMonitorUnicycle: doMonitor(closePtr->_graphicName, closePtr->_message, false, 100, montopmargin, monrtmargin, 165); break; - case STATUEMONITOR: + case kMonitorStatue: doMonitor(closePtr->_graphicName, closePtr->_message, false, 117, montopmargin, monrtmargin, 165); break; - case TALISMANMONITOR: + case kMonitorTalisman: doMonitor(closePtr->_graphicName, closePtr->_message, false, monltmargin, montopmargin, 184, 165); break; - case LUTEMONITOR: + case kMonitorLute: doMonitor(closePtr->_graphicName, closePtr->_message, false, monltmargin, montopmargin, lutertmargin, 165); break; - case CLOCKMONITOR: + case kMonitorClock: doMonitor(closePtr->_graphicName, closePtr->_message, false, monltmargin, montopmargin, 206, 165); break; - case TERMINALMONITOR: + case kMonitorTerminal: doMonitor(closePtr->_graphicName, closePtr->_message, true, monltmargin, montopmargin, monrtmargin, 165); break; default: @@ -225,19 +233,19 @@ const char *LabEngine::getInvName(uint16 curInv) { if (_mainDisplay) return _inventory[curInv]._bitmapName; - if ((curInv == LAMPNUM) && _conditions->in(LAMPON)) + if ((curInv == kItemLamp) && _conditions->in(kCondLampOn)) return "P:Mines/120"; - if ((curInv == BELTNUM) && _conditions->in(BELTGLOW)) - return "P:Future/BeltGlow"; + if ((curInv == kItemBelt) && _conditions->in(kCondBeltGlowing)) + return "P:Future/kCondBeltGlowing"; - if (curInv == WESTPAPERNUM) { + if (curInv == kItemWestPaper) { _curFileName = _inventory[curInv]._bitmapName; _anim->_noPalChange = true; _graphics->readPict(_curFileName, false); _anim->_noPalChange = false; doWestPaper(); - } else if (curInv == NOTESNUM) { + } else if (curInv == kItemNotes) { _curFileName = _inventory[curInv]._bitmapName; _anim->_noPalChange = true; _graphics->readPict(_curFileName, false); @@ -281,7 +289,7 @@ void LabEngine::interfaceOn() { */ bool LabEngine::doUse(uint16 curInv) { switch (curInv) { - case MAPNUM: + case kItemMap: drawStaticMessage(kTextUseMap); interfaceOff(); _anim->stopDiff(); @@ -292,7 +300,7 @@ bool LabEngine::doUse(uint16 curInv) { _graphics->drawMessage(nullptr); _graphics->drawPanel(); return true; - case JOURNALNUM: + case kItemJournal: drawStaticMessage(kTextUseJournal); interfaceOff(); _anim->stopDiff(); @@ -302,16 +310,16 @@ bool LabEngine::doUse(uint16 curInv) { _graphics->drawPanel(); _graphics->drawMessage(nullptr); return true; - case LAMPNUM: + case kItemLamp: interfaceOff(); - if (_conditions->in(LAMPON)) { + if (_conditions->in(kCondLampOn)) { drawStaticMessage(kTextTurnLampOff); - _conditions->exclElement(LAMPON); + _conditions->exclElement(kCondLampOn); } else { - drawStaticMessage(kTextTurnLampOn); - _conditions->inclElement(LAMPON); + drawStaticMessage(kTextTurnkLampOn); + _conditions->inclElement(kCondLampOn); } _anim->_doBlack = false; @@ -322,23 +330,23 @@ bool LabEngine::doUse(uint16 curInv) { _anim->_doBlack = false; _nextFileName = getInvName(curInv); return true; - case BELTNUM: - if (!_conditions->in(BELTGLOW)) - _conditions->inclElement(BELTGLOW); + case kItemBelt: + if (!_conditions->in(kCondBeltGlowing)) + _conditions->inclElement(kCondBeltGlowing); _anim->_doBlack = false; _nextFileName = getInvName(curInv); return true; - case WHISKEYNUM: - _conditions->inclElement(USEDHELMET); + case kItemWhiskey: + _conditions->inclElement(kCondUsedHelmet); drawStaticMessage(kTextUseWhiskey); return true; - case PITHHELMETNUM: - _conditions->inclElement(USEDHELMET); + case kItemPithHelmet: + _conditions->inclElement(kCondUsedHelmet); drawStaticMessage(kTextUsePith); return true; - case HELMETNUM: - _conditions->inclElement(USEDHELMET); + case kItemHelmet: + _conditions->inclElement(kCondUsedHelmet); drawStaticMessage(kTextUseHelmet); return true; default: @@ -394,7 +402,7 @@ void LabEngine::decIncInv(uint16 *curInv, bool decreaseFl) { */ void LabEngine::mainGameLoop() { uint16 actionMode = 4; - uint16 curInv = MAPNUM; + uint16 curInv = kItemMap; bool forceDraw = false; bool gotMessage = true; @@ -574,7 +582,7 @@ bool LabEngine::fromCrumbs(uint32 tmpClass, uint16 code, uint16 qualifier, Commo Common::Point curPos = tmpPos; uint16 oldDirection = 0; - uint16 lastInv = MAPNUM; + uint16 lastInv = kItemMap; CloseDataPtr wrkClosePtr = nullptr; bool doit; @@ -729,7 +737,7 @@ bool LabEngine::fromCrumbs(uint32 tmpClass, uint16 code, uint16 qualifier, Commo _graphics->screenUpdate(); } } else if (gadgetId == 9) { - doUse(MAPNUM); + doUse(kItemMap); mayShowCrumbIndicator(); _graphics->screenUpdate(); @@ -850,8 +858,8 @@ bool LabEngine::fromCrumbs(uint32 tmpClass, uint16 code, uint16 qualifier, Commo _closeDataPtr = nullptr; _mainDisplay = true; - curInv = MAPNUM; - lastInv = MAPNUM; + curInv = kItemMap; + lastInv = kItemMap; _nextFileName = getInvName(curInv); diff --git a/engines/lab/lab.h b/engines/lab/lab.h index b7491acc40..9581925146 100644 --- a/engines/lab/lab.h +++ b/engines/lab/lab.h @@ -74,8 +74,6 @@ enum GameFeatures { #define UPSCROLL 3 #define DOWNSCROLL 4 -#define QUARTERNUM 30 - typedef Common::List GadgetList; struct CrumbData { @@ -210,6 +208,11 @@ public: void changeVolume(int delta); char *getPictName(CloseDataPtr *closePtrList); + uint16 getQuarters(); + void setQuarters(uint16 quarters); + uint16 getDirection() { return _direction; } + void setDirection(uint16 direction) { _direction = direction; }; + private: void freeScreens(); void perFlipGadget(uint16 gadID); diff --git a/engines/lab/resource.h b/engines/lab/resource.h index 2273d79d70..4826558af0 100644 --- a/engines/lab/resource.h +++ b/engines/lab/resource.h @@ -51,7 +51,7 @@ enum StaticText { kTextFacingSouth, kTextFacingWest, - kTextLampOn, + kTextkLampOn, kTextTurnLeft, kTextTurnRight, @@ -85,7 +85,7 @@ enum StaticText { kTextUseMap, kTextUseJournal, - kTextTurnLampOn, + kTextTurnkLampOn, kTextTurnLampOff, kTextUseWhiskey, kTextUsePith, diff --git a/engines/lab/savegame.cpp b/engines/lab/savegame.cpp index 622c1a5cdb..9ead742200 100644 --- a/engines/lab/savegame.cpp +++ b/engines/lab/savegame.cpp @@ -123,7 +123,7 @@ bool readSaveGameHeader(Common::InSaveFile *in, SaveGameHeader &header) { /** * Writes the game out to disk. */ -bool saveGame(uint16 Direction, uint16 Quarters, int slot, Common::String desc) { +bool saveGame(int slot, Common::String desc) { uint16 i; Common::String fileName = g_lab->generateSaveFileName(slot); Common::SaveFileManager *saveFileManager = g_system->getSavefileManager(); @@ -138,8 +138,8 @@ bool saveGame(uint16 Direction, uint16 Quarters, int slot, Common::String desc) writeSaveGameHeader(file, desc); file->writeUint16LE(g_lab->_roomNum); - file->writeUint16LE(Direction); - file->writeUint16LE(Quarters); + file->writeUint16LE(g_lab->getDirection()); + file->writeUint16LE(g_lab->getQuarters()); // Conditions for (i = 0; i < g_lab->_conditions->_lastElement / (8 * 2); i++) @@ -167,7 +167,7 @@ bool saveGame(uint16 Direction, uint16 Quarters, int slot, Common::String desc) /** * Reads the game from disk. */ -bool loadGame(uint16 *Direction, uint16 *Quarters, int slot) { +bool loadGame(int slot) { uint16 i; Common::String fileName = g_lab->generateSaveFileName(slot); Common::SaveFileManager *saveFileManager = g_system->getSavefileManager(); @@ -179,8 +179,8 @@ bool loadGame(uint16 *Direction, uint16 *Quarters, int slot) { SaveGameHeader header; readSaveGameHeader(file, header); g_lab->_roomNum = file->readUint16LE(); - *Direction = file->readUint16LE(); - *Quarters = file->readUint16LE(); + g_lab->setDirection(file->readUint16LE()); + g_lab->setQuarters(file->readUint16LE()); // Conditions for (i = 0; i < g_lab->_conditions->_lastElement / (8 * 2); i++) @@ -234,14 +234,14 @@ bool LabEngine::saveRestoreGame() { desc = dialog->createDefaultSaveDescription(slot); } - isOK = saveGame(_direction, _inventory[QUARTERNUM]._many, slot, desc); + isOK = saveGame(slot, desc); } } else { // Restore GUI::SaveLoadChooser *dialog = new GUI::SaveLoadChooser(_("Restore game:"), _("Restore"), false); int slot = dialog->runModalWithCurrentTarget(); if (slot >= 0) { - isOK = loadGame(&_direction, &(_inventory[QUARTERNUM]._many), slot); + isOK = loadGame(slot); if (isOK) _music->resetMusic(); } diff --git a/engines/lab/savegame.h b/engines/lab/savegame.h index 608da99d47..f4f08b6368 100644 --- a/engines/lab/savegame.h +++ b/engines/lab/savegame.h @@ -44,8 +44,8 @@ struct SaveGameHeader { uint16 _direction; }; -bool saveGame(uint16 Direction, uint16 Quarters, int slot, Common::String desc); -bool loadGame(uint16 *Direction, uint16 *Quarters, int slot); +bool saveGame(int slot, Common::String desc); +bool loadGame(int slot); bool readSaveGameHeader(Common::InSaveFile *in, SaveGameHeader &header); } // End of namespace Lab -- cgit v1.2.3 From 0c0b2da235bfbbc3a11ef9677137d5a77f5b35a2 Mon Sep 17 00:00:00 2001 From: Filippos Karapetis Date: Sat, 12 Dec 2015 19:21:38 +0200 Subject: LAB: Move some defines which are only used in the tile puzzle --- engines/lab/lab.h | 6 ------ engines/lab/tilepuzzle.cpp | 26 ++++++++++++++++++-------- 2 files changed, 18 insertions(+), 14 deletions(-) diff --git a/engines/lab/lab.h b/engines/lab/lab.h index 9581925146..639983b55e 100644 --- a/engines/lab/lab.h +++ b/engines/lab/lab.h @@ -67,12 +67,6 @@ enum GameFeatures { }; #define ONESECOND 1000 -#define BRICKOPEN 115 -#define COMBINATIONUNLOCKED 130 -#define LEFTSCROLL 1 -#define RIGHTSCROLL 2 -#define UPSCROLL 3 -#define DOWNSCROLL 4 typedef Common::List GadgetList; diff --git a/engines/lab/tilepuzzle.cpp b/engines/lab/tilepuzzle.cpp index 782bcda483..4d461a8c07 100644 --- a/engines/lab/tilepuzzle.cpp +++ b/engines/lab/tilepuzzle.cpp @@ -43,6 +43,16 @@ namespace Lab { +#define BRICKOPEN 115 +#define COMBINATIONUNLOCKED 130 + +enum TileScroll { + kScrollLeft = 1, + kScrollRight = 2, + kScrollUp = 3, + kScrollDown = 4 +}; + const uint16 INIT_TILE[4][4] = { { 1, 5, 9, 13 }, { 2, 6, 10, 14 }, @@ -111,7 +121,7 @@ void TilePuzzle::changeTile(uint16 col, uint16 row) { if (_curTile[col][row - 1] == 0) { _curTile[col][row - 1] = _curTile[col][row]; _curTile[col][row] = 0; - scrolltype = DOWNSCROLL; + scrolltype = kScrollDown; } } @@ -119,7 +129,7 @@ void TilePuzzle::changeTile(uint16 col, uint16 row) { if (_curTile[col - 1][row] == 0) { _curTile[col - 1][row] = _curTile[col][row]; _curTile[col][row] = 0; - scrolltype = RIGHTSCROLL; + scrolltype = kScrollRight; } } @@ -127,7 +137,7 @@ void TilePuzzle::changeTile(uint16 col, uint16 row) { if (_curTile[col][row + 1] == 0) { _curTile[col][row + 1] = _curTile[col][row]; _curTile[col][row] = 0; - scrolltype = UPSCROLL; + scrolltype = kScrollUp; } } @@ -135,7 +145,7 @@ void TilePuzzle::changeTile(uint16 col, uint16 row) { if (_curTile[col + 1][row] == 0) { _curTile[col + 1][row] = _curTile[col][row]; _curTile[col][row] = 0; - scrolltype = LEFTSCROLL; + scrolltype = kScrollLeft; } } @@ -269,20 +279,20 @@ void TilePuzzle::doTileScroll(uint16 col, uint16 row, uint16 scrolltype) { int16 dX = 0, dY = 0, dx = 0, dy = 0, sx = 0, sy = 0; uint16 last = 0; - if (scrolltype == LEFTSCROLL) { + if (scrolltype == kScrollLeft) { dX = _vm->_utils->vgaScaleX(5); sx = _vm->_utils->vgaScaleX(5); last = 6; - } else if (scrolltype == RIGHTSCROLL) { + } else if (scrolltype == kScrollRight) { dX = _vm->_utils->vgaScaleX(-5); dx = _vm->_utils->vgaScaleX(-5); sx = _vm->_utils->vgaScaleX(5); last = 6; - } else if (scrolltype == UPSCROLL) { + } else if (scrolltype == kScrollUp) { dY = _vm->_utils->vgaScaleY(5); sy = _vm->_utils->vgaScaleY(5); last = 5; - } else if (scrolltype == DOWNSCROLL) { + } else if (scrolltype == kScrollDown) { dY = _vm->_utils->vgaScaleY(-5); dy = _vm->_utils->vgaScaleY(-5); sy = _vm->_utils->vgaScaleY(5); -- cgit v1.2.3 From 7bb45a8eaaf663cca9d0765d84b38967c3cc3275 Mon Sep 17 00:00:00 2001 From: Strangerke Date: Sat, 12 Dec 2015 19:38:00 +0100 Subject: LAB: Move timing functions to the utility class --- engines/lab/anim.cpp | 4 +- engines/lab/engine.cpp | 8 +-- engines/lab/intro.cpp | 7 +-- engines/lab/lab.h | 8 --- engines/lab/module.mk | 1 - engines/lab/processroom.cpp | 4 +- engines/lab/timing.cpp | 127 -------------------------------------------- engines/lab/utils.cpp | 93 +++++++++++++++++++++++++++++++- engines/lab/utils.h | 6 +++ 9 files changed, 110 insertions(+), 148 deletions(-) delete mode 100644 engines/lab/timing.cpp diff --git a/engines/lab/anim.cpp b/engines/lab/anim.cpp index a461996e4a..3bed3656d3 100644 --- a/engines/lab/anim.cpp +++ b/engines/lab/anim.cpp @@ -98,8 +98,8 @@ void Anim::diffNextFrame(bool onlyDiffData) { if (!onlyDiffData) { if (_headerdata._fps) { - _vm->waitForTime(_waitSec, _waitMicros); - _vm->addCurTime(0L, _delayMicros, &_waitSec, &_waitMicros); + _vm->_utils->waitForTime(_waitSec, _waitMicros); + _vm->_utils->addCurTime(0L, _delayMicros, &_waitSec, &_waitMicros); } if (_isPal && !_noPalChange) { diff --git a/engines/lab/engine.cpp b/engines/lab/engine.cpp index 17518fb750..f0d3ab7a5b 100644 --- a/engines/lab/engine.cpp +++ b/engines/lab/engine.cpp @@ -609,7 +609,7 @@ bool LabEngine::fromCrumbs(uint32 tmpClass, uint16 code, uint16 qualifier, Commo _followCrumbsFast = (code == 'r' || code == 'R'); _isCrumbTurning = false; _isCrumbWaiting = false; - getTime(&_crumbSecs, &_crumbMicros); + _utils->getTime(&_crumbSecs, &_crumbMicros); if (_alternate) { eatMessages(); @@ -930,7 +930,7 @@ bool LabEngine::fromCrumbs(uint32 tmpClass, uint16 code, uint16 qualifier, Commo _followCrumbsFast = false; _isCrumbTurning = false; _isCrumbWaiting = false; - getTime(&_crumbSecs, &_crumbMicros); + _utils->getTime(&_crumbSecs, &_crumbMicros); eatMessages(); _alternate = false; @@ -1144,7 +1144,7 @@ int LabEngine::followCrumbs() { uint32 Secs; uint32 Micros; - timeDiff(_crumbSecs, _crumbMicros, &Secs, &Micros); + _utils->timeDiff(_crumbSecs, _crumbMicros, &Secs, &Micros); if (Secs != 0 || Micros != 0) return 0; @@ -1189,7 +1189,7 @@ int LabEngine::followCrumbs() { _isCrumbTurning = (moveDir != VKEY_UPARROW); _isCrumbWaiting = true; - addCurTime(theDelay / ONESECOND, theDelay % ONESECOND, &_crumbSecs, &_crumbMicros); + _utils->addCurTime(theDelay / ONESECOND, theDelay % ONESECOND, &_crumbSecs, &_crumbMicros); } return moveDir; diff --git a/engines/lab/intro.cpp b/engines/lab/intro.cpp index d0406bc192..633691c820 100644 --- a/engines/lab/intro.cpp +++ b/engines/lab/intro.cpp @@ -36,6 +36,7 @@ #include "lab/intro.h" #include "lab/music.h" #include "lab/resource.h" +#include "lab/utils.h" namespace Lab { @@ -131,7 +132,7 @@ void Intro::doPictText(const char *filename, TextFont *msgFont, bool isScreen) { return; } - _vm->getTime(&lastSecs, &lastMicros); + _vm->_utils->getTime(&lastSecs, &lastMicros); } msg = _vm->getMsg(); @@ -139,8 +140,8 @@ void Intro::doPictText(const char *filename, TextFont *msgFont, bool isScreen) { if (msg == NULL) { _vm->_music->updateMusic(); _vm->_anim->diffNextFrame(); - _vm->getTime(&secs, µs); - _vm->anyTimeDiff(lastSecs, lastMicros, secs, micros, &secs, µs); + _vm->_utils->getTime(&secs, µs); + _vm->_utils->anyTimeDiff(lastSecs, lastMicros, secs, micros, &secs, µs); if (secs > timeDelay) { if (end) { diff --git a/engines/lab/lab.h b/engines/lab/lab.h index 639983b55e..d9f59f0c0e 100644 --- a/engines/lab/lab.h +++ b/engines/lab/lab.h @@ -103,13 +103,6 @@ public: LargeSet *_conditions, *_roomsFound; - // timing.cpp - void getTime(uint32 *secs, uint32 *micros); - void addCurTime(uint32 sec, uint32 micros, uint32 *timeSec, uint32 *timeMicros); - void anyTimeDiff(uint32 sec1, uint32 micros1, uint32 sec2, uint32 micros2, uint32 *diffSecs, uint32 *diffMicros); - void timeDiff(uint32 sec, uint32 micros, uint32 *diffSec, uint32 *diffMicros); - void waitForTime(uint32 sec, uint32 micros); - private: uint32 _extraGameFeatures; bool _interfaceOff; @@ -117,7 +110,6 @@ private: bool _quitLab; bool _mainDisplay; // timing.cpp - void microDelay(uint32 secs, uint32 micros); public: EventManager *_event; diff --git a/engines/lab/module.mk b/engines/lab/module.mk index 0d05de275e..a0dcfde512 100644 --- a/engines/lab/module.mk +++ b/engines/lab/module.mk @@ -18,7 +18,6 @@ MODULE_OBJS := \ savegame.o \ special.o \ tilepuzzle.o \ - timing.o \ transitions.o \ utils.o diff --git a/engines/lab/processroom.cpp b/engines/lab/processroom.cpp index 49287aeeba..b997942879 100644 --- a/engines/lab/processroom.cpp +++ b/engines/lab/processroom.cpp @@ -425,14 +425,14 @@ void LabEngine::doActions(Action *actionList, CloseDataPtr *closePtrList) { case WAITSECS: { uint32 startSecs, startMicros, curSecs, curMicros; - addCurTime(actionList->_param1, 0, &startSecs, &startMicros); + _utils->addCurTime(actionList->_param1, 0, &startSecs, &startMicros); _graphics->screenUpdate(); while (1) { _music->updateMusic(); _anim->diffNextFrame(); - getTime(&curSecs, &curMicros); + _utils->getTime(&curSecs, &curMicros); if ((curSecs > startSecs) || ((curSecs == startSecs) && (curMicros >= startMicros))) break; diff --git a/engines/lab/timing.cpp b/engines/lab/timing.cpp deleted file mode 100644 index 1cbe6d328a..0000000000 --- a/engines/lab/timing.cpp +++ /dev/null @@ -1,127 +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. - * - */ - -/* - * This code is based on Labyrinth of Time code with assistance of - * - * Copyright (c) 1993 Terra Nova Development - * Copyright (c) 2004 The Wyrmkeep Entertainment Co. - * - */ - -#include "lab/lab.h" - -namespace Lab { - -/** - * Waits for for Secs seconds and Micros microseconds to pass. - */ -void LabEngine::microDelay(uint32 secs, uint32 micros) { - uint32 waitSecs, waitMicros; - addCurTime(secs, micros, &waitSecs, &waitMicros); - - while (1) { - getTime(&secs, µs); - - if ((secs > waitSecs) || ((secs == waitSecs) && (micros >= waitMicros))) - return; - - g_system->delayMillis(10); - } -} - -/** - * Gets the current system time. - */ -void LabEngine::getTime(uint32 *secs, uint32 *micros) { - uint32 t = g_system->getMillis(); - - *secs = t / 1000; - *micros = t % 1000; -} - -/** - * Adds seconds and microseconds to current time to get a new time. - */ -void LabEngine::addCurTime(uint32 sec, uint32 micros, uint32 *timeSec, uint32 *timeMicros) { - getTime(timeSec, timeMicros); - - (*timeSec) += sec; - (*timeMicros) += micros; - - if (*timeMicros >= ONESECOND) { - (*timeSec)++; - (*timeMicros) -= ONESECOND; - } -} - -/** - * Finds the difference between time1 and time2. If time1 is later than - * time2, returns 0. - */ -void LabEngine::anyTimeDiff(uint32 sec1, uint32 micros1, uint32 sec2, uint32 micros2, uint32 *diffSecs, uint32 *diffMicros) { - *diffSecs = 0; - *diffMicros = 0; - - if (sec1 > sec2) - return; - else if ((sec1 == sec2) && (micros1 >= micros2)) - return; - - if (micros1 > micros2) { - *diffSecs = sec2 - sec1 - 1; - *diffMicros = (ONESECOND - micros1) + micros2; - } else { - *diffSecs = sec2 - sec1; - *diffMicros = micros2 - micros1; - } -} - -/** - * Finds the difference between the current time, and a future time. Returns - * 0 if the future time is actually before the current time. - */ -void LabEngine::timeDiff(uint32 sec, uint32 micros, uint32 *diffSec, uint32 *diffMicros) { - uint32 curSec, curMicros; - getTime(&curSec, &curMicros); - anyTimeDiff(curSec, curMicros, sec, micros, diffSec, diffMicros); -} - -/** - * Waits for a specified time to occur. - */ -void LabEngine::waitForTime(uint32 sec, uint32 micros) { - uint32 curSec, curMicros; - getTime(&curSec, &curMicros); - - if (curSec > sec) - return; - else if ((curSec == sec) && (curMicros >= micros)) - return; - - if (curMicros > micros) - microDelay(sec - curSec - 1, (ONESECOND - curMicros) + micros - 1); - else - microDelay(sec - curSec, micros - curMicros - 1); -} - -} // End of namespace Lab diff --git a/engines/lab/utils.cpp b/engines/lab/utils.cpp index f9a6656174..1ac083790e 100644 --- a/engines/lab/utils.cpp +++ b/engines/lab/utils.cpp @@ -433,7 +433,7 @@ void Utils::setBytesPerRow(int num) { uint16 Utils::getRandom(uint16 max) { uint32 secs, micros; - _vm->getTime(&secs, µs); + getTime(&secs, µs); return ((micros + secs) % max); } @@ -442,4 +442,95 @@ void Utils::readBlock(void *Buffer, uint32 Size, byte **File) { (*File) += Size; } +/** + * Waits for for Secs seconds and Micros microseconds to pass. + */ +void Utils::microDelay(uint32 secs, uint32 micros) { + uint32 waitSecs, waitMicros; + addCurTime(secs, micros, &waitSecs, &waitMicros); + + while (1) { + getTime(&secs, µs); + + if ((secs > waitSecs) || ((secs == waitSecs) && (micros >= waitMicros))) + return; + + g_system->delayMillis(10); + } +} + +/** + * Gets the current system time. + */ +void Utils::getTime(uint32 *secs, uint32 *micros) { + uint32 t = g_system->getMillis(); + + *secs = t / 1000; + *micros = t % 1000; +} + +/** + * Adds seconds and microseconds to current time to get a new time. + */ +void Utils::addCurTime(uint32 sec, uint32 micros, uint32 *timeSec, uint32 *timeMicros) { + getTime(timeSec, timeMicros); + + (*timeSec) += sec; + (*timeMicros) += micros; + + if (*timeMicros >= ONESECOND) { + (*timeSec)++; + (*timeMicros) -= ONESECOND; + } +} + +/** + * Finds the difference between time1 and time2. If time1 is later than + * time2, returns 0. + */ +void Utils::anyTimeDiff(uint32 sec1, uint32 micros1, uint32 sec2, uint32 micros2, uint32 *diffSecs, uint32 *diffMicros) { + *diffSecs = 0; + *diffMicros = 0; + + if (sec1 > sec2) + return; + else if ((sec1 == sec2) && (micros1 >= micros2)) + return; + + if (micros1 > micros2) { + *diffSecs = sec2 - sec1 - 1; + *diffMicros = (ONESECOND - micros1) + micros2; + } else { + *diffSecs = sec2 - sec1; + *diffMicros = micros2 - micros1; + } +} + +/** + * Finds the difference between the current time, and a future time. Returns + * 0 if the future time is actually before the current time. + */ +void Utils::timeDiff(uint32 sec, uint32 micros, uint32 *diffSec, uint32 *diffMicros) { + uint32 curSec, curMicros; + getTime(&curSec, &curMicros); + anyTimeDiff(curSec, curMicros, sec, micros, diffSec, diffMicros); +} + +/** + * Waits for a specified time to occur. + */ +void Utils::waitForTime(uint32 sec, uint32 micros) { + uint32 curSec, curMicros; + getTime(&curSec, &curMicros); + + if (curSec > sec) + return; + else if ((curSec == sec) && (curMicros >= micros)) + return; + + if (curMicros > micros) + microDelay(sec - curSec - 1, (ONESECOND - curMicros) + micros - 1); + else + microDelay(sec - curSec, micros - curMicros - 1); +} } // End of namespace Lab diff --git a/engines/lab/utils.h b/engines/lab/utils.h index da1f89af7d..9d6e1872d4 100644 --- a/engines/lab/utils.h +++ b/engines/lab/utils.h @@ -43,6 +43,7 @@ private: void VUnDiffByteByte(byte *Dest, byte *diff, uint16 bytesperrow); void VUnDiffByteWord(uint16 *Dest, uint16 *diff, uint16 bytesperrow); void VUnDiffByteLong(uint32 *Dest, uint32 *diff, uint16 bytesperrow); + void microDelay(uint32 secs, uint32 micros); public: Utils(LabEngine *vm); @@ -61,6 +62,11 @@ public: void setBytesPerRow(int num); uint16 getRandom(uint16 max); void readBlock(void *Buffer, uint32 Size, byte **File); + void addCurTime(uint32 sec, uint32 micros, uint32 *timeSec, uint32 *timeMicros); + void getTime(uint32 *secs, uint32 *micros); + void waitForTime(uint32 sec, uint32 micros); + void anyTimeDiff(uint32 sec1, uint32 micros1, uint32 sec2, uint32 micros2, uint32 *diffSecs, uint32 *diffMicros); + void timeDiff(uint32 sec, uint32 micros, uint32 *diffSec, uint32 *diffMicros); }; -- cgit v1.2.3 From f47d41930f84d61b5cb2de4685d798e3b8aaca6b Mon Sep 17 00:00:00 2001 From: Strangerke Date: Sat, 12 Dec 2015 20:07:04 +0100 Subject: LAB: Review LabEngine definition, make private a lot of members --- engines/lab/lab.h | 207 +++++++++++++++++++++++++++--------------------------- 1 file changed, 102 insertions(+), 105 deletions(-) diff --git a/engines/lab/lab.h b/engines/lab/lab.h index d9f59f0c0e..970ca3512b 100644 --- a/engines/lab/lab.h +++ b/engines/lab/lab.h @@ -87,151 +87,148 @@ typedef Common::List RuleList; #define WEST 3 class LabEngine : public Engine { -public: - LabEngine(OSystem *syst, const ADGameDescription *gameDesc); - ~LabEngine(); - - virtual Common::Error run(); - void go(); - - const ADGameDescription *_gameDescription; - Common::Platform getPlatform() const; - uint32 getFeatures() const; - - bool hasFeature(EngineFeature f) const; - Common::String generateSaveFileName(uint slot); - - LargeSet *_conditions, *_roomsFound; - private: - uint32 _extraGameFeatures; bool _interfaceOff; + bool _isCrumbWaiting; + bool _mainDisplay; bool _noUpdateDiff; bool _quitLab; - bool _mainDisplay; - // timing.cpp + bool _lastTooLong; -public: - EventManager *_event; - Resource *_resource; - Music *_music; - Anim *_anim; - DisplayMan *_graphics; - RoomData *_rooms; - TilePuzzle *_tilePuzzle; - Utils *_utils; + int _lastWaitTOFTicks; - int _roomNum; - CrumbData _breadCrumbs[MAX_CRUMBS]; - uint16 _numCrumbs; - bool _droppingCrumbs; - bool _followingCrumbs; - bool _followCrumbsFast; - bool _isCrumbTurning; - uint32 _crumbSecs, _crumbMicros; - bool _isCrumbWaiting; - bool _alternate; - bool _isHiRes; - uint16 _numInv; - uint16 _manyRooms; uint16 _direction; - uint16 _highestCondition; + uint16 _maxRooms; + + uint32 _extraGameFeatures; - const char *_curFileName; const char *_nextFileName; - // When ProcessRoom.c decides to change the filename of the current picture. const char *_newFileName; - TextFont *_msgFont; - GadgetList _moveGadgetList; - GadgetList _invGadgetList; - Image *_moveImages[20]; - Image *_invImages[10]; -private: - int _lastWaitTOFTicks; - bool _lastTooLong; CloseDataPtr _closeDataPtr; - InventoryData *_inventory; GadgetList _journalGadgetList; GadgetList _mapGadgetList; Image *_imgMap, *_imgRoom, *_imgUpArrowRoom, *_imgDownArrowRoom, *_imgBridge; Image *_imgHRoom, *_imgVRoom, *_imgMaze, *_imgHugeMaze, *_imgPath, *_imgMapNorth; Image *_imgMapEast, *_imgMapSouth, *_imgMapWest, *_imgXMark; - uint16 _maxRooms; + InventoryData *_inventory; MapData *_maps; -private: - bool fromCrumbs(uint32 tmpClass, uint16 code, uint16 qualifier, Common::Point tmpPos, - uint16 &curInv, IntuiMessage *curMsg, bool &forceDraw, uint16 gadgetId, uint16 &actionMode); +public: + bool _alternate; + bool _droppingCrumbs; + bool _followingCrumbs; + bool _followCrumbsFast; + bool _isCrumbTurning; + bool _isHiRes; + + int _roomNum; + + uint16 _highestCondition; + uint16 _manyRooms; + uint16 _numCrumbs; + uint16 _numInv; + + uint32 _crumbSecs, _crumbMicros; + + const char *_curFileName; + + Anim *_anim; + CrumbData _breadCrumbs[MAX_CRUMBS]; + DisplayMan *_graphics; + EventManager *_event; + GadgetList _invGadgetList; + GadgetList _moveGadgetList; + Image *_invImages[10]; + Image *_moveImages[20]; + LargeSet *_conditions, *_roomsFound; + Music *_music; + Resource *_resource; + RoomData *_rooms; + TextFont *_msgFont; + TilePuzzle *_tilePuzzle; + Utils *_utils; public: + LabEngine(OSystem *syst, const ADGameDescription *gameDesc); + ~LabEngine(); + + virtual Common::Error run(); + void go(); + + const ADGameDescription *_gameDescription; + Common::Platform getPlatform() const; + uint32 getFeatures() const; + + bool hasFeature(EngineFeature f) const; + Common::String generateSaveFileName(uint slot); + + void changeVolume(int delta); + uint16 getDirection() { return _direction; } + IntuiMessage *getMsg(); + char *getPictName(CloseDataPtr *closePtrList); + uint16 getQuarters(); + void setDirection(uint16 direction) { _direction = direction; }; + void setQuarters(uint16 quarters); void waitTOF(); - void drawRoomMessage(uint16 curInv, CloseDataPtr closePtr); - void interfaceOff(); - void interfaceOn(); - void decIncInv(uint16 *CurInv, bool dec); + +private: Gadget *checkNumGadgetHit(GadgetList *gadgetList, uint16 key); - IntuiMessage *getMsg(); - void loadMapData(); - void drawMap(uint16 curRoom, uint16 curMsg, uint16 floorNum, bool fadeOut, bool fadeIn); - void processMap(uint16 curRoom); - void doMap(uint16 curRoom); - void freeMapData(); - void loadJournalData(); - void drawJournal(uint16 wipenum, bool needFade); - void processJournal(); + void decIncInv(uint16 *CurInv, bool dec); void doJournal(); - void drawMonText(char *text, TextFont *monitorFont, uint16 x1, uint16 y1, uint16 x2, uint16 y2, bool isinteractive); - void processMonitor(char *ntext, TextFont *monitorFont, bool isinteractive, uint16 x1, uint16 y1, uint16 x2, uint16 y2); + void doMap(uint16 curRoom); void doMonitor(char *background, char *textfile, bool isinteractive, uint16 x1, uint16 y1, uint16 x2, uint16 y2); void doNotes(); void doWestPaper(); - void eatMessages(); - void drawStaticMessage(byte index); void drawDirection(CloseDataPtr closePtr); + void drawJournal(uint16 wipenum, bool needFade); + void drawMap(uint16 curRoom, uint16 curMsg, uint16 floorNum, bool fadeOut, bool fadeIn); + void drawMonText(char *text, TextFont *monitorFont, uint16 x1, uint16 y1, uint16 x2, uint16 y2, bool isinteractive); + void drawRoomMessage(uint16 curInv, CloseDataPtr closePtr); + void drawStaticMessage(byte index); + void eatMessages(); int followCrumbs(); - - void changeVolume(int delta); - char *getPictName(CloseDataPtr *closePtrList); - - uint16 getQuarters(); - void setQuarters(uint16 quarters); - uint16 getDirection() { return _direction; } - void setDirection(uint16 direction) { _direction = direction; }; + void freeMapData(); + bool fromCrumbs(uint32 tmpClass, uint16 code, uint16 qualifier, Common::Point tmpPos, + uint16 &curInv, IntuiMessage *curMsg, bool &forceDraw, uint16 gadgetId, uint16 &actionMode); + void interfaceOff(); + void interfaceOn(); + void loadJournalData(); + void loadMapData(); + void processJournal(); + void processMap(uint16 curRoom); + void processMonitor(char *ntext, TextFont *monitorFont, bool isinteractive, uint16 x1, uint16 y1, uint16 x2, uint16 y2); private: - void freeScreens(); - void perFlipGadget(uint16 gadID); + bool checkConditions(int16 *condition); + void doActions(Action *actionList, CloseDataPtr *closePtrList); + bool doActionRule(Common::Point pos, int16 action, int16 roomNum, CloseDataPtr *closePtrList); + bool doActionRuleSub(int16 action, int16 roomNum, CloseDataPtr closePtr, CloseDataPtr *setCloseList, bool allowDefaults); bool doCloseUp(CloseDataPtr closePtr); - void mainGameLoop(); + bool doGoForward(CloseDataPtr *closePtrList); + bool doMainView(CloseDataPtr *closePtrList); + bool doOperateRuleSub(int16 itemNum, int16 roomNum, CloseDataPtr closePtr, CloseDataPtr *setCloseList, bool allowDefaults); + bool doOperateRule(Common::Point pos, int16 ItemNum, CloseDataPtr *closePtrList); + bool doTurn(uint16 from, uint16 to, CloseDataPtr *closePtrList); bool doUse(uint16 curInv); - void mayShowCrumbIndicator(); - void mayShowCrumbIndicatorOff(); - const char *getInvName(uint16 curInv); - bool saveRestoreGame(); - Common::Rect roomCoords(uint16 curRoom); void drawRoomMap(uint16 curRoom, bool drawMarkFl); + CloseDataPtr findClosePtrMatch(CloseDataPtr closePtr, CloseDataPtr closePtrList); bool floorVisited(uint16 floorNum); - uint16 getUpperFloor(uint16 floorNum); + void freeScreens(); + const char *getInvName(uint16 curInv); uint16 getLowerFloor(uint16 floorNum); - bool checkConditions(int16 *condition); - ViewData *getViewData(uint16 roomNum, uint16 direction); CloseData *getObject(Common::Point pos, CloseDataPtr closePtr); - CloseDataPtr findClosePtrMatch(CloseDataPtr closePtr, CloseDataPtr closePtrList); + uint16 getUpperFloor(uint16 floorNum); + ViewData *getViewData(uint16 roomNum, uint16 direction); + void mainGameLoop(); + void mayShowCrumbIndicator(); + void mayShowCrumbIndicatorOff(); + void perFlipGadget(uint16 gadID); uint16 processArrow(uint16 curDirection, uint16 arrow); + Common::Rect roomCoords(uint16 curRoom); + bool saveRestoreGame(); void setCurrentClose(Common::Point pos, CloseDataPtr *closePtrList, bool useAbsoluteCoords); bool takeItem(uint16 x, uint16 y, CloseDataPtr *closePtrList); - bool doActionRuleSub(int16 action, int16 roomNum, CloseDataPtr closePtr, CloseDataPtr *setCloseList, bool allowDefaults); - bool doActionRule(Common::Point pos, int16 action, int16 roomNum, CloseDataPtr *closePtrList); - bool doOperateRuleSub(int16 itemNum, int16 roomNum, CloseDataPtr closePtr, CloseDataPtr *setCloseList, bool allowDefaults); - bool doOperateRule(Common::Point pos, int16 ItemNum, CloseDataPtr *closePtrList); - bool doGoForward(CloseDataPtr *closePtrList); - bool doTurn(uint16 from, uint16 to, CloseDataPtr *closePtrList); - bool doMainView(CloseDataPtr *closePtrList); - -public: - void doActions(Action *actionList, CloseDataPtr *closePtrList); - }; extern LabEngine *g_lab; -- cgit v1.2.3 From a01f0689693363bf7a46ef36c9e3885670fb657b Mon Sep 17 00:00:00 2001 From: Strangerke Date: Sat, 12 Dec 2015 21:51:31 +0100 Subject: LAB: Merge transitions in dispman --- engines/lab/dispman.cpp | 448 ++++++++++++++++++++++++++++++++++++++++ engines/lab/module.mk | 1 - engines/lab/transitions.cpp | 489 -------------------------------------------- 3 files changed, 448 insertions(+), 490 deletions(-) delete mode 100644 engines/lab/transitions.cpp diff --git a/engines/lab/dispman.cpp b/engines/lab/dispman.cpp index df35f9f29d..d2f5f8d778 100644 --- a/engines/lab/dispman.cpp +++ b/engines/lab/dispman.cpp @@ -748,4 +748,452 @@ void DisplayMan::text(TextFont *tf, uint16 x, uint16 y, uint16 color, const char text++; } } + +/** + * Scrolls the display to black. + */ +void DisplayMan::doScrollBlack() { + uint16 width = _vm->_utils->vgaScaleX(320); + uint16 height = _vm->_utils->vgaScaleY(149) + _vm->_utils->svgaCord(2); + byte *mem = new byte[width * height]; + + _vm->_event->mouseHide(); + + Image img; + img._width = width; + img._height = height; + img._imageData = mem; + _vm->_music->updateMusic(); + img.readScreenImage(0, 0); + _vm->_music->updateMusic(); + + byte *baseAddr = getCurrentDrawingBuffer(); + uint16 by = _vm->_utils->vgaScaleX(4); + uint16 nheight = height; + + while (nheight) { + _vm->_music->updateMusic(); + + if (!_vm->_isHiRes) + _vm->waitTOF(); + + baseAddr = getCurrentDrawingBuffer(); + + if (by > nheight) + by = nheight; + + mem += by * width; + nheight -= by; + uint32 copysize; + uint32 size = (int32)nheight * (int32)width; + byte *tempmem = mem; + + while (size) { + if (size > _screenBytesPerPage) + copysize = _screenBytesPerPage; + else + copysize = size; + + size -= copysize; + + memcpy(baseAddr, tempmem, copysize); + tempmem += copysize; + } + + setAPen(0); + rectFill(0, nheight, width - 1, nheight + by - 1); + + screenUpdate(); + + if (!_vm->_isHiRes) { + if (nheight <= (height / 8)) + by = 1; + else if (nheight <= (height / 4)) + by = 2; + else if (nheight <= (height / 2)) + by = 3; + } + } + + delete[] mem; + freePict(); + _vm->_event->mouseShow(); +} + +void DisplayMan::copyPage(uint16 width, uint16 height, uint16 nheight, uint16 startLine, byte *mem) { + byte *baseAddr = getCurrentDrawingBuffer(); + + uint32 size = (int32)(height - nheight) * (int32)width; + mem += startLine * width; + uint16 curPage = ((int32)nheight * (int32)width) / _screenBytesPerPage; + uint32 offSet = ((int32)nheight * (int32)width) - (curPage * _screenBytesPerPage); + + while (size) { + uint32 copySize; + if (size > (_screenBytesPerPage - offSet)) + copySize = _screenBytesPerPage - offSet; + else + copySize = size; + + size -= copySize; + + memcpy(baseAddr + (offSet >> 2), mem, copySize); + mem += copySize; + curPage++; + offSet = 0; + } +} + +/** + * Scrolls the display to a new picture from a black screen. + */ +void DisplayMan::doScrollWipe(char *filename) { + uint16 startLine = 0, onRow = 0; + + _vm->_event->mouseHide(); + uint16 width = _vm->_utils->vgaScaleX(320); + uint16 height = _vm->_utils->vgaScaleY(149) + _vm->_utils->svgaCord(2); + + while (_vm->_music->isSoundEffectActive()) { + _vm->_music->updateMusic(); + _vm->waitTOF(); + } + + readPict(filename, true, true); + setPalette(_vm->_anim->_diffPalette, 256); + byte *mem = _vm->_anim->_rawDiffBM._planes[0]; + + _vm->_music->updateMusic(); + uint16 by = _vm->_utils->vgaScaleX(3); + uint16 nheight = height; + + while (onRow < _vm->_anim->_headerdata._height) { + _vm->_music->updateMusic(); + + if ((by > nheight) && nheight) + by = nheight; + + if ((startLine + by) > (_vm->_anim->_headerdata._height - height - 1)) + break; + + if (nheight) + nheight -= by; + + copyPage(width, height, nheight, startLine, mem); + + screenUpdate(); + + if (!nheight) + startLine += by; + + onRow += by; + + if (nheight <= (height / 4)) + by = _vm->_utils->vgaScaleX(5); + else if (nheight <= (height / 3)) + by = _vm->_utils->vgaScaleX(4); + else if (nheight <= (height / 2)) + by = _vm->_utils->vgaScaleX(3); + } + + _vm->_event->mouseShow(); +} + +/** + * Does the scroll bounce. Assumes bitmap already in memory. + */ +void DisplayMan::doScrollBounce() { + const uint16 *newby, *newby1; + + const uint16 newbyd[5] = {5, 4, 3, 2, 1}, newby1d[8] = {3, 3, 2, 2, 2, 1, 1, 1}; + const uint16 newbyw[5] = {10, 8, 6, 4, 2}, newby1w[8] = {6, 6, 4, 4, 4, 2, 2, 2}; + + if (_vm->getPlatform() != Common::kPlatformWindows) { + newby = newbyd; + newby1 = newby1d; + } else { + newby = newbyw; + newby1 = newby1w; + } + + _vm->_event->mouseHide(); + int width = _vm->_utils->vgaScaleX(320); + int height = _vm->_utils->vgaScaleY(149) + _vm->_utils->svgaCord(2); + byte *mem = _vm->_anim->_rawDiffBM._planes[0]; + + _vm->_music->updateMusic(); + int startLine = _vm->_anim->_headerdata._height - height - 1; + + for (int i = 0; i < 5; i++) { + _vm->_music->updateMusic(); + startLine -= newby[i]; + copyPage(width, height, 0, startLine, mem); + + screenUpdate(); + _vm->waitTOF(); + } + + for (int i = 8; i > 0; i--) { + _vm->_music->updateMusic(); + startLine += newby1[i - 1]; + copyPage(width, height, 0, startLine, mem); + + screenUpdate(); + _vm->waitTOF(); + } + + _vm->_event->mouseShow(); +} + +/** + * Does the transporter wipe. + */ +void DisplayMan::doTransWipe(CloseDataPtr *closePtrList, char *filename) { + uint16 lastY, curY, linesDone = 0, linesLast; + + if (_vm->_isHiRes) { + linesLast = 3; + lastY = 358; + } else { + linesLast = 1; + lastY = 148; + } + + for (uint16 j = 0; j < 2; j++) { + for (uint16 i = 0; i < 2; i++) { + curY = i * 2; + + while (curY < lastY) { + if (linesDone >= linesLast) { + _vm->_music->updateMusic(); + _vm->waitTOF(); + linesDone = 0; + } + + if (j == 9) + overlayRect(0, 0, curY, _screenWidth - 1, curY + 1); + else + rectFill(0, curY, _screenWidth - 1, curY + 1); + curY += 4; + linesDone++; + } // while + } // for i + + setAPen(0); + } // for j + + if (filename == NULL) + _vm->_curFileName = _vm->getPictName(closePtrList); + else if (filename[0] > ' ') + _vm->_curFileName = filename; + else + _vm->_curFileName = _vm->getPictName(closePtrList); + + byte *bitMapBuffer = new byte[_screenWidth * (lastY + 5)]; + readPict(_vm->_curFileName, true, false, bitMapBuffer, lastY + 5); + + setPalette(_vm->_anim->_diffPalette, 256); + + Image imSource; + imSource._width = _screenWidth; + imSource._height = lastY; + imSource._imageData = bitMapBuffer; + + Image imDest; + imDest._width = _screenWidth; + imDest._height = _screenHeight; + imDest._imageData = getCurrentDrawingBuffer(); + + for (uint16 j = 0; j < 2; j++) { + for (uint16 i = 0; i < 2; i++) { + curY = i * 2; + + while (curY < lastY) { + if (linesDone >= linesLast) { + _vm->_music->updateMusic(); + _vm->waitTOF(); + linesDone = 0; + } + + imDest._imageData = getCurrentDrawingBuffer(); + + if (j == 0) { + imSource.blitBitmap(0, curY, &imDest, 0, curY, _screenWidth, 2, false); + overlayRect(0, 0, curY, _screenWidth - 1, curY + 1); + } else { + uint16 bitmapHeight = (curY == lastY) ? 1 : 2; + imSource.blitBitmap(0, curY, &imDest, 0, curY, _screenWidth, bitmapHeight, false); + } + curY += 4; + linesDone++; + } // while + } // for i + } // for j + + delete[] bitMapBuffer; +} + +/** + * Does a certain number of pre-programmed wipes. + */ +void DisplayMan::doTransition(TransitionType transitionType, CloseDataPtr *closePtrList, char *filename) { + switch (transitionType) { + case kTransitionWipe: + case kTransitionTransporter: + doTransWipe(closePtrList, filename); + break; + case kTransitionScrollWipe: + doScrollWipe(filename); + break; + case kTransitionScrollBlack: + doScrollBlack(); + break; + case kTransitionScrollBounce: + doScrollBounce(); + break; + case kTransitionReadFirstFrame: + readPict(filename, false); + break; + case kTransitionReadNextFrame: + _vm->_anim->diffNextFrame(); + break; + case kTransitionNone: + default: + break; + } +} + +/** + * Changes the front screen to black. + */ +void DisplayMan::blackScreen() { + byte pal[256 * 3]; + memset(pal, 0, 248 * 3); + writeColorRegs(pal, 8, 248); + + g_system->delayMillis(32); +} + +/** + * Changes the front screen to white. + */ +void DisplayMan::whiteScreen() { + byte pal[256 * 3]; + memset(pal, 255, 248 * 3); + writeColorRegs(pal, 8, 248); +} + +/** + * Changes the entire screen to black. +*/ +void DisplayMan::blackAllScreen() { + byte pal[256 * 3]; + memset(pal, 0, 256 * 3); + writeColorRegs(pal, 0, 256); + + g_system->delayMillis(32); +} + +/** + * Scrolls the display in the x direction by blitting. + * The _tempScrollData variable must be initialized to some memory, or this + * function will fail. + */ +void DisplayMan::scrollDisplayX(int16 dx, uint16 x1, uint16 y1, uint16 x2, uint16 y2, byte *buffer) { + Image im; + im._imageData = buffer; + + if (x1 > x2) + SWAP(x1, x2); + + if (y1 > y2) + SWAP(y1, y2); + + if (dx > 0) { + im._width = x2 - x1 + 1 - dx; + im._height = y2 - y1 + 1; + + im.readScreenImage(x1, y1); + im.drawImage(x1 + dx, y1); + + setAPen(0); + rectFill(x1, y1, x1 + dx - 1, y2); + } else if (dx < 0) { + im._width = x2 - x1 + 1 + dx; + im._height = y2 - y1 + 1; + + im.readScreenImage(x1 - dx, y1); + im.drawImage(x1, y1); + + setAPen(0); + rectFill(x2 + dx + 1, y1, x2, y2); + } +} + +/** + * Scrolls the display in the y direction by blitting. + */ +void DisplayMan::scrollDisplayY(int16 dy, uint16 x1, uint16 y1, uint16 x2, uint16 y2, byte *buffer) { + Image im; + im._imageData = buffer; + + if (x1 > x2) + SWAP(x1, x2); + + if (y1 > y2) + SWAP(y1, y2); + + if (dy > 0) { + im._width = x2 - x1 + 1; + im._height = y2 - y1 + 1 - dy; + + im.readScreenImage(x1, y1); + im.drawImage(x1, y1 + dy); + + setAPen(0); + rectFill(x1, y1, x2, y1 + dy - 1); + } else if (dy < 0) { + im._width = x2 - x1 + 1; + im._height = y2 - y1 + 1 + dy; + + im.readScreenImage(x1, y1 - dy); + im.drawImage(x1, y1); + + setAPen(0); + rectFill(x1, y2 + dy + 1, x2, y2); + } +} + +/** + * Does the fading of the Palette on the screen. + */ +uint16 DisplayMan::fadeNumIn(uint16 num, uint16 res, uint16 counter) { + return (num - ((((int32)(15 - counter)) * ((int32)(num - res))) / 15)); +} + +uint16 DisplayMan::fadeNumOut(uint16 num, uint16 res, uint16 counter) { + return (num - ((((int32) counter) * ((int32)(num - res))) / 15)); +} + +void DisplayMan::fade(bool fadeIn, uint16 res) { + uint16 newPal[16]; + + for (uint16 i = 0; i < 16; i++) { + for (uint16 palIdx = 0; palIdx < 16; palIdx++) { + if (fadeIn) + newPal[palIdx] = (0x00F & fadeNumIn(0x00F & FadePalette[palIdx], 0x00F & res, i)) + + (0x0F0 & fadeNumIn(0x0F0 & FadePalette[palIdx], 0x0F0 & res, i)) + + (0xF00 & fadeNumIn(0xF00 & FadePalette[palIdx], 0xF00 & res, i)); + else + newPal[palIdx] = (0x00F & fadeNumOut(0x00F & FadePalette[palIdx], 0x00F & res, i)) + + (0x0F0 & fadeNumOut(0x0F0 & FadePalette[palIdx], 0x0F0 & res, i)) + + (0xF00 & fadeNumOut(0xF00 & FadePalette[palIdx], 0xF00 & res, i)); + } + + setAmigaPal(newPal, 16); + _vm->waitTOF(); + _vm->_music->updateMusic(); + } +} + } // End of namespace Lab diff --git a/engines/lab/module.mk b/engines/lab/module.mk index a0dcfde512..6b7932a59e 100644 --- a/engines/lab/module.mk +++ b/engines/lab/module.mk @@ -18,7 +18,6 @@ MODULE_OBJS := \ savegame.o \ special.o \ tilepuzzle.o \ - transitions.o \ utils.o # This module can be built as a plugin diff --git a/engines/lab/transitions.cpp b/engines/lab/transitions.cpp deleted file mode 100644 index d7adff33fb..0000000000 --- a/engines/lab/transitions.cpp +++ /dev/null @@ -1,489 +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. - * - */ - -/* - * This code is based on Labyrinth of Time code with assistance of - * - * Copyright (c) 1993 Terra Nova Development - * Copyright (c) 2004 The Wyrmkeep Entertainment Co. - * - */ - -#include "lab/lab.h" - -#include "lab/anim.h" -#include "lab/dispman.h" -#include "lab/eventman.h" -#include "lab/image.h" -#include "lab/music.h" -#include "lab/utils.h" - -namespace Lab { - -/** - * Scrolls the display to black. - */ -void DisplayMan::doScrollBlack() { - uint16 width = _vm->_utils->vgaScaleX(320); - uint16 height = _vm->_utils->vgaScaleY(149) + _vm->_utils->svgaCord(2); - byte *mem = new byte[width * height]; - - _vm->_event->mouseHide(); - - Image img; - img._width = width; - img._height = height; - img._imageData = mem; - _vm->_music->updateMusic(); - img.readScreenImage(0, 0); - _vm->_music->updateMusic(); - - byte *baseAddr = getCurrentDrawingBuffer(); - uint16 by = _vm->_utils->vgaScaleX(4); - uint16 nheight = height; - - while (nheight) { - _vm->_music->updateMusic(); - - if (!_vm->_isHiRes) - _vm->waitTOF(); - - baseAddr = getCurrentDrawingBuffer(); - - if (by > nheight) - by = nheight; - - mem += by * width; - nheight -= by; - uint32 copysize; - uint32 size = (int32)nheight * (int32)width; - byte *tempmem = mem; - - while (size) { - if (size > _screenBytesPerPage) - copysize = _screenBytesPerPage; - else - copysize = size; - - size -= copysize; - - memcpy(baseAddr, tempmem, copysize); - tempmem += copysize; - } - - setAPen(0); - rectFill(0, nheight, width - 1, nheight + by - 1); - - screenUpdate(); - - if (!_vm->_isHiRes) { - if (nheight <= (height / 8)) - by = 1; - else if (nheight <= (height / 4)) - by = 2; - else if (nheight <= (height / 2)) - by = 3; - } - } - - delete[] mem; - freePict(); - _vm->_event->mouseShow(); -} - -void DisplayMan::copyPage(uint16 width, uint16 height, uint16 nheight, uint16 startLine, byte *mem) { - byte *baseAddr = getCurrentDrawingBuffer(); - - uint32 size = (int32)(height - nheight) * (int32)width; - mem += startLine * width; - uint16 curPage = ((int32)nheight * (int32)width) / _screenBytesPerPage; - uint32 offSet = ((int32)nheight * (int32)width) - (curPage * _screenBytesPerPage); - - while (size) { - uint32 copySize; - if (size > (_screenBytesPerPage - offSet)) - copySize = _screenBytesPerPage - offSet; - else - copySize = size; - - size -= copySize; - - memcpy(baseAddr + (offSet >> 2), mem, copySize); - mem += copySize; - curPage++; - offSet = 0; - } -} - -/** - * Scrolls the display to a new picture from a black screen. - */ -void DisplayMan::doScrollWipe(char *filename) { - uint16 startLine = 0, onRow = 0; - - _vm->_event->mouseHide(); - uint16 width = _vm->_utils->vgaScaleX(320); - uint16 height = _vm->_utils->vgaScaleY(149) + _vm->_utils->svgaCord(2); - - while (_vm->_music->isSoundEffectActive()) { - _vm->_music->updateMusic(); - _vm->waitTOF(); - } - - readPict(filename, true, true); - setPalette(_vm->_anim->_diffPalette, 256); - byte *mem = _vm->_anim->_rawDiffBM._planes[0]; - - _vm->_music->updateMusic(); - uint16 by = _vm->_utils->vgaScaleX(3); - uint16 nheight = height; - - while (onRow < _vm->_anim->_headerdata._height) { - _vm->_music->updateMusic(); - - if ((by > nheight) && nheight) - by = nheight; - - if ((startLine + by) > (_vm->_anim->_headerdata._height - height - 1)) - break; - - if (nheight) - nheight -= by; - - copyPage(width, height, nheight, startLine, mem); - - screenUpdate(); - - if (!nheight) - startLine += by; - - onRow += by; - - if (nheight <= (height / 4)) - by = _vm->_utils->vgaScaleX(5); - else if (nheight <= (height / 3)) - by = _vm->_utils->vgaScaleX(4); - else if (nheight <= (height / 2)) - by = _vm->_utils->vgaScaleX(3); - } - - _vm->_event->mouseShow(); -} - -/** - * Does the scroll bounce. Assumes bitmap already in memory. - */ -void DisplayMan::doScrollBounce() { - const uint16 *newby, *newby1; - - const uint16 newbyd[5] = {5, 4, 3, 2, 1}, newby1d[8] = {3, 3, 2, 2, 2, 1, 1, 1}; - const uint16 newbyw[5] = {10, 8, 6, 4, 2}, newby1w[8] = {6, 6, 4, 4, 4, 2, 2, 2}; - - if (_vm->getPlatform() != Common::kPlatformWindows) { - newby = newbyd; - newby1 = newby1d; - } else { - newby = newbyw; - newby1 = newby1w; - } - - _vm->_event->mouseHide(); - int width = _vm->_utils->vgaScaleX(320); - int height = _vm->_utils->vgaScaleY(149) + _vm->_utils->svgaCord(2); - byte *mem = _vm->_anim->_rawDiffBM._planes[0]; - - _vm->_music->updateMusic(); - int startLine = _vm->_anim->_headerdata._height - height - 1; - - for (int i = 0; i < 5; i++) { - _vm->_music->updateMusic(); - startLine -= newby[i]; - copyPage(width, height, 0, startLine, mem); - - screenUpdate(); - _vm->waitTOF(); - } - - for (int i = 8; i > 0; i--) { - _vm->_music->updateMusic(); - startLine += newby1[i - 1]; - copyPage(width, height, 0, startLine, mem); - - screenUpdate(); - _vm->waitTOF(); - } - - _vm->_event->mouseShow(); -} - -/** - * Does the transporter wipe. - */ -void DisplayMan::doTransWipe(CloseDataPtr *closePtrList, char *filename) { - uint16 lastY, curY, linesDone = 0, linesLast; - - if (_vm->_isHiRes) { - linesLast = 3; - lastY = 358; - } else { - linesLast = 1; - lastY = 148; - } - - for (uint16 j = 0; j < 2; j++) { - for (uint16 i = 0; i < 2; i++) { - curY = i * 2; - - while (curY < lastY) { - if (linesDone >= linesLast) { - _vm->_music->updateMusic(); - _vm->waitTOF(); - linesDone = 0; - } - - if (j == 9) - overlayRect(0, 0, curY, _screenWidth - 1, curY + 1); - else - rectFill(0, curY, _screenWidth - 1, curY + 1); - curY += 4; - linesDone++; - } // while - } // for i - - setAPen(0); - } // for j - - if (filename == NULL) - _vm->_curFileName = _vm->getPictName(closePtrList); - else if (filename[0] > ' ') - _vm->_curFileName = filename; - else - _vm->_curFileName = _vm->getPictName(closePtrList); - - byte *bitMapBuffer = new byte[_screenWidth * (lastY + 5)]; - readPict(_vm->_curFileName, true, false, bitMapBuffer, lastY + 5); - - setPalette(_vm->_anim->_diffPalette, 256); - - Image imSource; - imSource._width = _screenWidth; - imSource._height = lastY; - imSource._imageData = bitMapBuffer; - - Image imDest; - imDest._width = _screenWidth; - imDest._height = _screenHeight; - imDest._imageData = getCurrentDrawingBuffer(); - - for (uint16 j = 0; j < 2; j++) { - for (uint16 i = 0; i < 2; i++) { - curY = i * 2; - - while (curY < lastY) { - if (linesDone >= linesLast) { - _vm->_music->updateMusic(); - _vm->waitTOF(); - linesDone = 0; - } - - imDest._imageData = getCurrentDrawingBuffer(); - - if (j == 0) { - imSource.blitBitmap(0, curY, &imDest, 0, curY, _screenWidth, 2, false); - overlayRect(0, 0, curY, _screenWidth - 1, curY + 1); - } else { - uint16 bitmapHeight = (curY == lastY) ? 1 : 2; - imSource.blitBitmap(0, curY, &imDest, 0, curY, _screenWidth, bitmapHeight, false); - } - curY += 4; - linesDone++; - } // while - } // for i - } // for j - - delete[] bitMapBuffer; -} - -/** - * Does a certain number of pre-programmed wipes. - */ -void DisplayMan::doTransition(TransitionType transitionType, CloseDataPtr *closePtrList, char *filename) { - switch (transitionType) { - case kTransitionWipe: - case kTransitionTransporter: - doTransWipe(closePtrList, filename); - break; - case kTransitionScrollWipe: - doScrollWipe(filename); - break; - case kTransitionScrollBlack: - doScrollBlack(); - break; - case kTransitionScrollBounce: - doScrollBounce(); - break; - case kTransitionReadFirstFrame: - readPict(filename, false); - break; - case kTransitionReadNextFrame: - _vm->_anim->diffNextFrame(); - break; - case kTransitionNone: - default: - break; - } -} - -/** - * Changes the front screen to black. - */ -void DisplayMan::blackScreen() { - byte pal[256 * 3]; - memset(pal, 0, 248 * 3); - writeColorRegs(pal, 8, 248); - - g_system->delayMillis(32); -} - -/** - * Changes the front screen to white. - */ -void DisplayMan::whiteScreen() { - byte pal[256 * 3]; - memset(pal, 255, 248 * 3); - writeColorRegs(pal, 8, 248); -} - -/** - * Changes the entire screen to black. -*/ -void DisplayMan::blackAllScreen() { - byte pal[256 * 3]; - memset(pal, 0, 256 * 3); - writeColorRegs(pal, 0, 256); - - g_system->delayMillis(32); -} - -/** - * Scrolls the display in the x direction by blitting. - * The _tempScrollData variable must be initialized to some memory, or this - * function will fail. - */ -void DisplayMan::scrollDisplayX(int16 dx, uint16 x1, uint16 y1, uint16 x2, uint16 y2, byte *buffer) { - Image im; - im._imageData = buffer; - - if (x1 > x2) - SWAP(x1, x2); - - if (y1 > y2) - SWAP(y1, y2); - - if (dx > 0) { - im._width = x2 - x1 + 1 - dx; - im._height = y2 - y1 + 1; - - im.readScreenImage(x1, y1); - im.drawImage(x1 + dx, y1); - - setAPen(0); - rectFill(x1, y1, x1 + dx - 1, y2); - } else if (dx < 0) { - im._width = x2 - x1 + 1 + dx; - im._height = y2 - y1 + 1; - - im.readScreenImage(x1 - dx, y1); - im.drawImage(x1, y1); - - setAPen(0); - rectFill(x2 + dx + 1, y1, x2, y2); - } -} - -/** - * Scrolls the display in the y direction by blitting. - */ -void DisplayMan::scrollDisplayY(int16 dy, uint16 x1, uint16 y1, uint16 x2, uint16 y2, byte *buffer) { - Image im; - im._imageData = buffer; - - if (x1 > x2) - SWAP(x1, x2); - - if (y1 > y2) - SWAP(y1, y2); - - if (dy > 0) { - im._width = x2 - x1 + 1; - im._height = y2 - y1 + 1 - dy; - - im.readScreenImage(x1, y1); - im.drawImage(x1, y1 + dy); - - setAPen(0); - rectFill(x1, y1, x2, y1 + dy - 1); - } else if (dy < 0) { - im._width = x2 - x1 + 1; - im._height = y2 - y1 + 1 + dy; - - im.readScreenImage(x1, y1 - dy); - im.drawImage(x1, y1); - - setAPen(0); - rectFill(x1, y2 + dy + 1, x2, y2); - } -} - -/** - * Does the fading of the Palette on the screen. - */ -uint16 DisplayMan::fadeNumIn(uint16 num, uint16 res, uint16 counter) { - return (num - ((((int32)(15 - counter)) * ((int32)(num - res))) / 15)); -} - -uint16 DisplayMan::fadeNumOut(uint16 num, uint16 res, uint16 counter) { - return (num - ((((int32) counter) * ((int32)(num - res))) / 15)); -} - -void DisplayMan::fade(bool fadeIn, uint16 res) { - uint16 newPal[16]; - - for (uint16 i = 0; i < 16; i++) { - for (uint16 palIdx = 0; palIdx < 16; palIdx++) { - if (fadeIn) - newPal[palIdx] = (0x00F & fadeNumIn(0x00F & FadePalette[palIdx], 0x00F & res, i)) + - (0x0F0 & fadeNumIn(0x0F0 & FadePalette[palIdx], 0x0F0 & res, i)) + - (0xF00 & fadeNumIn(0xF00 & FadePalette[palIdx], 0xF00 & res, i)); - else - newPal[palIdx] = (0x00F & fadeNumOut(0x00F & FadePalette[palIdx], 0x00F & res, i)) + - (0x0F0 & fadeNumOut(0x0F0 & FadePalette[palIdx], 0x0F0 & res, i)) + - (0xF00 & fadeNumOut(0xF00 & FadePalette[palIdx], 0xF00 & res, i)); - } - - setAmigaPal(newPal, 16); - _vm->waitTOF(); - _vm->_music->updateMusic(); - } -} - -} // End of namespace Lab -- cgit v1.2.3 From 1b0a7db0b604b5dddaa0e01cbafe2f3fdc760ce9 Mon Sep 17 00:00:00 2001 From: Filippos Karapetis Date: Sun, 13 Dec 2015 04:12:29 +0200 Subject: LAB: Get rid of getTime(), readBlock() and getRandom() Also, simplify some time-related functions --- engines/lab/anim.cpp | 12 +++++--- engines/lab/engine.cpp | 8 +++-- engines/lab/intro.cpp | 9 ++++-- engines/lab/lab.cpp | 2 +- engines/lab/lab.h | 3 ++ engines/lab/processroom.cpp | 11 ++----- engines/lab/utils.cpp | 74 +++++++++++++-------------------------------- engines/lab/utils.h | 3 -- 8 files changed, 48 insertions(+), 74 deletions(-) diff --git a/engines/lab/anim.cpp b/engines/lab/anim.cpp index 3bed3656d3..ac51860ed7 100644 --- a/engines/lab/anim.cpp +++ b/engines/lab/anim.cpp @@ -141,18 +141,20 @@ void Anim::diffNextFrame(bool onlyDiffData) { switch (_header) { case 8: - _vm->_utils->readBlock(_diffPalette, _size, &_diffFile); + memcpy(_diffPalette, _diffFile, _size); + _diffFile += _size; _isPal = true; break; case 10: _rawDiffBM._planes[_curBit] = _diffFile; - if (onlyDiffData) + if (onlyDiffData) { _diffFile += _size; - else - _vm->_utils->readBlock(DrawBitMap->_planes[_curBit], _size, &_diffFile); - + } else { + memcpy(DrawBitMap->_planes[_curBit], _diffFile, _size); + _diffFile += _size; + } _curBit++; break; diff --git a/engines/lab/engine.cpp b/engines/lab/engine.cpp index f0d3ab7a5b..1b77d04459 100644 --- a/engines/lab/engine.cpp +++ b/engines/lab/engine.cpp @@ -609,7 +609,9 @@ bool LabEngine::fromCrumbs(uint32 tmpClass, uint16 code, uint16 qualifier, Commo _followCrumbsFast = (code == 'r' || code == 'R'); _isCrumbTurning = false; _isCrumbWaiting = false; - _utils->getTime(&_crumbSecs, &_crumbMicros); + uint32 t = g_system->getMillis(); + _crumbSecs = t / 1000; + _crumbMicros = t % 1000; if (_alternate) { eatMessages(); @@ -930,7 +932,9 @@ bool LabEngine::fromCrumbs(uint32 tmpClass, uint16 code, uint16 qualifier, Commo _followCrumbsFast = false; _isCrumbTurning = false; _isCrumbWaiting = false; - _utils->getTime(&_crumbSecs, &_crumbMicros); + uint32 t = g_system->getMillis(); + _crumbSecs = t / 1000; + _crumbMicros = t % 1000; eatMessages(); _alternate = false; diff --git a/engines/lab/intro.cpp b/engines/lab/intro.cpp index 633691c820..0165116b00 100644 --- a/engines/lab/intro.cpp +++ b/engines/lab/intro.cpp @@ -132,7 +132,9 @@ void Intro::doPictText(const char *filename, TextFont *msgFont, bool isScreen) { return; } - _vm->_utils->getTime(&lastSecs, &lastMicros); + uint32 t = g_system->getMillis(); + lastSecs = t / 1000; + lastMicros = t % 1000; } msg = _vm->getMsg(); @@ -140,7 +142,10 @@ void Intro::doPictText(const char *filename, TextFont *msgFont, bool isScreen) { if (msg == NULL) { _vm->_music->updateMusic(); _vm->_anim->diffNextFrame(); - _vm->_utils->getTime(&secs, µs); + + uint32 t = g_system->getMillis(); + secs = t / 1000; + micros = t % 1000; _vm->_utils->anyTimeDiff(lastSecs, lastMicros, secs, micros, &secs, µs); if (secs > timeDelay) { diff --git a/engines/lab/lab.cpp b/engines/lab/lab.cpp index be5b9556e1..e33c443ee2 100644 --- a/engines/lab/lab.cpp +++ b/engines/lab/lab.cpp @@ -51,7 +51,7 @@ namespace Lab { LabEngine *g_lab; LabEngine::LabEngine(OSystem *syst, const ADGameDescription *gameDesc) - : Engine(syst), _gameDescription(gameDesc), _extraGameFeatures(0) { + : Engine(syst), _gameDescription(gameDesc), _extraGameFeatures(0), _rnd("lab") { g_lab = this; _lastWaitTOFTicks = 0; diff --git a/engines/lab/lab.h b/engines/lab/lab.h index 970ca3512b..b03b4b3605 100644 --- a/engines/lab/lab.h +++ b/engines/lab/lab.h @@ -32,6 +32,7 @@ #define LAB_H #include "common/system.h" +#include "common/random.h" #include "common/rect.h" #include "engines/engine.h" @@ -114,6 +115,8 @@ private: InventoryData *_inventory; MapData *_maps; + Common::RandomSource _rnd; + public: bool _alternate; bool _droppingCrumbs; diff --git a/engines/lab/processroom.cpp b/engines/lab/processroom.cpp index b997942879..bd9d02ef8c 100644 --- a/engines/lab/processroom.cpp +++ b/engines/lab/processroom.cpp @@ -370,7 +370,7 @@ void LabEngine::doActions(Action *actionList, CloseDataPtr *closePtrList) { case SHOWMESSAGES: { char **str = (char **)actionList->_data; _graphics->_doNotDrawMessage = false; - _graphics->drawMessage(str[_utils->getRandom(actionList->_param1)]); + _graphics->drawMessage(str[_rnd.getRandomNumber(actionList->_param1)]); _graphics->_doNotDrawMessage = true; } break; @@ -424,18 +424,13 @@ void LabEngine::doActions(Action *actionList, CloseDataPtr *closePtrList) { break; case WAITSECS: { - uint32 startSecs, startMicros, curSecs, curMicros; - _utils->addCurTime(actionList->_param1, 0, &startSecs, &startMicros); + uint32 targetMillis = g_system->getMillis() + actionList->_param1 * 1000; _graphics->screenUpdate(); - while (1) { + while (g_system->getMillis() < targetMillis) { _music->updateMusic(); _anim->diffNextFrame(); - _utils->getTime(&curSecs, &curMicros); - - if ((curSecs > startSecs) || ((curSecs == startSecs) && (curMicros >= startMicros))) - break; } } break; diff --git a/engines/lab/utils.cpp b/engines/lab/utils.cpp index 1ac083790e..3adcc954c9 100644 --- a/engines/lab/utils.cpp +++ b/engines/lab/utils.cpp @@ -427,56 +427,13 @@ void Utils::setBytesPerRow(int num) { _dataBytesPerRow = num; } -/** - * Generates a random number. - */ -uint16 Utils::getRandom(uint16 max) { - uint32 secs, micros; - - getTime(&secs, µs); - return ((micros + secs) % max); -} - -void Utils::readBlock(void *Buffer, uint32 Size, byte **File) { - memcpy(Buffer, *File, (size_t)Size); - (*File) += Size; -} - -/** - * Waits for for Secs seconds and Micros microseconds to pass. - */ -void Utils::microDelay(uint32 secs, uint32 micros) { - uint32 waitSecs, waitMicros; - addCurTime(secs, micros, &waitSecs, &waitMicros); - - while (1) { - getTime(&secs, µs); - - if ((secs > waitSecs) || ((secs == waitSecs) && (micros >= waitMicros))) - return; - - g_system->delayMillis(10); - } -} - -/** - * Gets the current system time. - */ -void Utils::getTime(uint32 *secs, uint32 *micros) { - uint32 t = g_system->getMillis(); - - *secs = t / 1000; - *micros = t % 1000; -} - /** * Adds seconds and microseconds to current time to get a new time. */ void Utils::addCurTime(uint32 sec, uint32 micros, uint32 *timeSec, uint32 *timeMicros) { - getTime(timeSec, timeMicros); - - (*timeSec) += sec; - (*timeMicros) += micros; + uint32 t = g_system->getMillis(); + *timeSec = (t / 1000) + sec; + *timeMicros = (t % 1000) + micros; if (*timeMicros >= ONESECOND) { (*timeSec)++; @@ -511,21 +468,32 @@ void Utils::anyTimeDiff(uint32 sec1, uint32 micros1, uint32 sec2, uint32 micros2 * 0 if the future time is actually before the current time. */ void Utils::timeDiff(uint32 sec, uint32 micros, uint32 *diffSec, uint32 *diffMicros) { - uint32 curSec, curMicros; - getTime(&curSec, &curMicros); + uint32 t = g_system->getMillis(); + uint32 curSec = t / 1000; + uint32 curMicros = t % 1000; + anyTimeDiff(curSec, curMicros, sec, micros, diffSec, diffMicros); } +/** +* Waits for Secs seconds and Micros microseconds to pass. +*/ +void Utils::microDelay(uint32 secs, uint32 micros) { + uint32 targetMillis = g_system->getMillis() + secs * 1000 + micros; + while (g_system->getMillis() < targetMillis) + g_system->delayMillis(10); +} + /** * Waits for a specified time to occur. */ void Utils::waitForTime(uint32 sec, uint32 micros) { - uint32 curSec, curMicros; - getTime(&curSec, &curMicros); + uint32 targetMillis = sec * 1000 + micros; + uint32 t = g_system->getMillis(); + uint32 curSec = t / 1000; + uint32 curMicros = t % 1000; - if (curSec > sec) - return; - else if ((curSec == sec) && (curMicros >= micros)) + if (t >= targetMillis) return; if (curMicros > micros) diff --git a/engines/lab/utils.h b/engines/lab/utils.h index 9d6e1872d4..65c00a3eec 100644 --- a/engines/lab/utils.h +++ b/engines/lab/utils.h @@ -60,10 +60,7 @@ public: void runLengthDecode(byte *dest, byte *source); void VRunLengthDecode(byte *dest, byte *source, uint16 bytesPerRow); void setBytesPerRow(int num); - uint16 getRandom(uint16 max); - void readBlock(void *Buffer, uint32 Size, byte **File); void addCurTime(uint32 sec, uint32 micros, uint32 *timeSec, uint32 *timeMicros); - void getTime(uint32 *secs, uint32 *micros); void waitForTime(uint32 sec, uint32 micros); void anyTimeDiff(uint32 sec1, uint32 micros1, uint32 sec2, uint32 micros2, uint32 *diffSecs, uint32 *diffMicros); void timeDiff(uint32 sec, uint32 micros, uint32 *diffSec, uint32 *diffMicros); -- cgit v1.2.3 From 452c20ab8abd8f01050e37f355fa2efeb6ef3743 Mon Sep 17 00:00:00 2001 From: Filippos Karapetis Date: Sun, 13 Dec 2015 04:53:12 +0200 Subject: LAB: Get rid of the rest of the custom time delay functions --- engines/lab/anim.cpp | 9 ++---- engines/lab/anim.h | 2 -- engines/lab/engine.cpp | 10 ++----- engines/lab/intro.cpp | 23 ++++------------ engines/lab/utils.cpp | 74 -------------------------------------------------- engines/lab/utils.h | 5 ---- 6 files changed, 12 insertions(+), 111 deletions(-) diff --git a/engines/lab/anim.cpp b/engines/lab/anim.cpp index ac51860ed7..347841d8d1 100644 --- a/engines/lab/anim.cpp +++ b/engines/lab/anim.cpp @@ -46,8 +46,6 @@ Anim::Anim(LabEngine *vm) : _vm(vm) { _headerdata._height = 0; _headerdata._fps = 0; _headerdata._flags = 0; - _waitSec = 0; - _waitMicros = 0; _delayMicros = 0; _continuous = false; _isPlaying = false; @@ -98,8 +96,9 @@ void Anim::diffNextFrame(bool onlyDiffData) { if (!onlyDiffData) { if (_headerdata._fps) { - _vm->_utils->waitForTime(_waitSec, _waitMicros); - _vm->_utils->addCurTime(0L, _delayMicros, &_waitSec, &_waitMicros); + uint32 targetMillis = g_system->getMillis() + _delayMicros; + while (g_system->getMillis() < targetMillis) + g_system->delayMillis(10); } if (_isPal && !_noPalChange) { @@ -273,8 +272,6 @@ void Anim::stopDiffEnd() { */ void Anim::readDiff(byte *buffer, bool playOnce, bool onlyDiffData) { _playOnce = playOnce; - _waitSec = 0; - _waitMicros = 0; _delayMicros = 0; _header = 0; _curBit = 0; diff --git a/engines/lab/anim.h b/engines/lab/anim.h index 797c5536f4..6c18224932 100644 --- a/engines/lab/anim.h +++ b/engines/lab/anim.h @@ -61,8 +61,6 @@ private: uint32 _header; uint16 _curBit; uint16 _numChunks; - uint32 _waitSec; - uint32 _waitMicros; uint32 _delayMicros; bool _continuous; bool _isPlaying; diff --git a/engines/lab/engine.cpp b/engines/lab/engine.cpp index 1b77d04459..a22409e618 100644 --- a/engines/lab/engine.cpp +++ b/engines/lab/engine.cpp @@ -1145,12 +1145,7 @@ int LabEngine::followCrumbs() { }; if (_isCrumbWaiting) { - uint32 Secs; - uint32 Micros; - - _utils->timeDiff(_crumbSecs, _crumbMicros, &Secs, &Micros); - - if (Secs != 0 || Micros != 0) + if (g_system->getMillis() <= _crumbSecs * 1000 + _crumbMicros) return 0; _isCrumbWaiting = false; @@ -1193,7 +1188,8 @@ int LabEngine::followCrumbs() { _isCrumbTurning = (moveDir != VKEY_UPARROW); _isCrumbWaiting = true; - _utils->addCurTime(theDelay / ONESECOND, theDelay % ONESECOND, &_crumbSecs, &_crumbMicros); + _crumbSecs = (theDelay + g_system->getMillis()) / 1000; + _crumbMicros = (theDelay + g_system->getMillis()) % 1000; } return moveDir; diff --git a/engines/lab/intro.cpp b/engines/lab/intro.cpp index 0165116b00..b6fbf04f2b 100644 --- a/engines/lab/intro.cpp +++ b/engines/lab/intro.cpp @@ -75,19 +75,13 @@ void Intro::doPictText(const char *filename, TextFont *msgFont, bool isScreen) { char path[50] = "Lab:rooms/Intro/"; strcat(path, filename); - uint timeDelay; - if (isScreen) { - _vm->_music->updateMusic(); - timeDelay = 35; - } else { - _vm->_music->updateMusic(); - timeDelay = 7; - } + uint timeDelay = (isScreen) ? 35 : 7; + _vm->_music->updateMusic(); if (_quitIntro) return; - uint32 lastSecs = 0L, lastMicros = 0L, secs = 0L, micros = 0L; + uint32 lastMillis = 0; IntuiMessage *msg; bool drawNextText = true, end = false, begin = true; @@ -132,9 +126,7 @@ void Intro::doPictText(const char *filename, TextFont *msgFont, bool isScreen) { return; } - uint32 t = g_system->getMillis(); - lastSecs = t / 1000; - lastMicros = t % 1000; + lastMillis = g_system->getMillis(); } msg = _vm->getMsg(); @@ -143,12 +135,9 @@ void Intro::doPictText(const char *filename, TextFont *msgFont, bool isScreen) { _vm->_music->updateMusic(); _vm->_anim->diffNextFrame(); - uint32 t = g_system->getMillis(); - secs = t / 1000; - micros = t % 1000; - _vm->_utils->anyTimeDiff(lastSecs, lastMicros, secs, micros, &secs, µs); + uint32 elapsedSeconds = (g_system->getMillis() - lastMillis) / 1000; - if (secs > timeDelay) { + if (elapsedSeconds > timeDelay) { if (end) { if (isScreen) _vm->_graphics->fade(false, 0); diff --git a/engines/lab/utils.cpp b/engines/lab/utils.cpp index 3adcc954c9..ec69d81f46 100644 --- a/engines/lab/utils.cpp +++ b/engines/lab/utils.cpp @@ -427,78 +427,4 @@ void Utils::setBytesPerRow(int num) { _dataBytesPerRow = num; } -/** - * Adds seconds and microseconds to current time to get a new time. - */ -void Utils::addCurTime(uint32 sec, uint32 micros, uint32 *timeSec, uint32 *timeMicros) { - uint32 t = g_system->getMillis(); - *timeSec = (t / 1000) + sec; - *timeMicros = (t % 1000) + micros; - - if (*timeMicros >= ONESECOND) { - (*timeSec)++; - (*timeMicros) -= ONESECOND; - } -} - -/** - * Finds the difference between time1 and time2. If time1 is later than - * time2, returns 0. - */ -void Utils::anyTimeDiff(uint32 sec1, uint32 micros1, uint32 sec2, uint32 micros2, uint32 *diffSecs, uint32 *diffMicros) { - *diffSecs = 0; - *diffMicros = 0; - - if (sec1 > sec2) - return; - else if ((sec1 == sec2) && (micros1 >= micros2)) - return; - - if (micros1 > micros2) { - *diffSecs = sec2 - sec1 - 1; - *diffMicros = (ONESECOND - micros1) + micros2; - } else { - *diffSecs = sec2 - sec1; - *diffMicros = micros2 - micros1; - } -} - -/** - * Finds the difference between the current time, and a future time. Returns - * 0 if the future time is actually before the current time. - */ -void Utils::timeDiff(uint32 sec, uint32 micros, uint32 *diffSec, uint32 *diffMicros) { - uint32 t = g_system->getMillis(); - uint32 curSec = t / 1000; - uint32 curMicros = t % 1000; - - anyTimeDiff(curSec, curMicros, sec, micros, diffSec, diffMicros); -} - -/** -* Waits for Secs seconds and Micros microseconds to pass. -*/ -void Utils::microDelay(uint32 secs, uint32 micros) { - uint32 targetMillis = g_system->getMillis() + secs * 1000 + micros; - while (g_system->getMillis() < targetMillis) - g_system->delayMillis(10); -} - -/** - * Waits for a specified time to occur. - */ -void Utils::waitForTime(uint32 sec, uint32 micros) { - uint32 targetMillis = sec * 1000 + micros; - uint32 t = g_system->getMillis(); - uint32 curSec = t / 1000; - uint32 curMicros = t % 1000; - - if (t >= targetMillis) - return; - - if (curMicros > micros) - microDelay(sec - curSec - 1, (ONESECOND - curMicros) + micros - 1); - else - microDelay(sec - curSec, micros - curMicros - 1); -} } // End of namespace Lab diff --git a/engines/lab/utils.h b/engines/lab/utils.h index 65c00a3eec..b0aa58f795 100644 --- a/engines/lab/utils.h +++ b/engines/lab/utils.h @@ -43,7 +43,6 @@ private: void VUnDiffByteByte(byte *Dest, byte *diff, uint16 bytesperrow); void VUnDiffByteWord(uint16 *Dest, uint16 *diff, uint16 bytesperrow); void VUnDiffByteLong(uint32 *Dest, uint32 *diff, uint16 bytesperrow); - void microDelay(uint32 secs, uint32 micros); public: Utils(LabEngine *vm); @@ -60,10 +59,6 @@ public: void runLengthDecode(byte *dest, byte *source); void VRunLengthDecode(byte *dest, byte *source, uint16 bytesPerRow); void setBytesPerRow(int num); - void addCurTime(uint32 sec, uint32 micros, uint32 *timeSec, uint32 *timeMicros); - void waitForTime(uint32 sec, uint32 micros); - void anyTimeDiff(uint32 sec1, uint32 micros1, uint32 sec2, uint32 micros2, uint32 *diffSecs, uint32 *diffMicros); - void timeDiff(uint32 sec, uint32 micros, uint32 *diffSec, uint32 *diffMicros); }; -- cgit v1.2.3 From cd85e5dd34dbf2431778d32be228bde327ddeda1 Mon Sep 17 00:00:00 2001 From: Filippos Karapetis Date: Sun, 13 Dec 2015 05:00:10 +0200 Subject: LAB: Remove unneeded static --- engines/lab/engine.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/engines/lab/engine.cpp b/engines/lab/engine.cpp index a22409e618..367f54163f 100644 --- a/engines/lab/engine.cpp +++ b/engines/lab/engine.cpp @@ -1137,7 +1137,7 @@ void LabEngine::go() { */ int LabEngine::followCrumbs() { // NORTH, SOUTH, EAST, WEST - static int movement[4][4] = { + int movement[4][4] = { { VKEY_UPARROW, VKEY_RTARROW, VKEY_RTARROW, VKEY_LTARROW }, { VKEY_RTARROW, VKEY_UPARROW, VKEY_LTARROW, VKEY_RTARROW }, { VKEY_LTARROW, VKEY_RTARROW, VKEY_UPARROW, VKEY_RTARROW }, -- cgit v1.2.3 From aad3b063b388e3d8cf4b4cc88bfc1d311d800c1b Mon Sep 17 00:00:00 2001 From: Filippos Karapetis Date: Sun, 13 Dec 2015 05:00:28 +0200 Subject: LAB: The mouse cursor data is constant --- engines/lab/eventman.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/engines/lab/eventman.cpp b/engines/lab/eventman.cpp index 2b39397c1d..e44771952a 100644 --- a/engines/lab/eventman.cpp +++ b/engines/lab/eventman.cpp @@ -39,7 +39,7 @@ namespace Lab { -static byte mouseData[] = { +static const byte mouseData[] = { 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 1, 7, 1, 0, 0, 0, 0, 0, 0, 0, 1, 7, 7, 1, 0, 0, 0, 0, 0, 0, -- cgit v1.2.3 From aef304a83b15f5e829341f53b7af02099b2b32d3 Mon Sep 17 00:00:00 2001 From: Strangerke Date: Sun, 13 Dec 2015 11:55:49 +0100 Subject: LAB: Some renaming and refactoring in special.cpp --- engines/lab/dispman.cpp | 14 ++++ engines/lab/dispman.h | 1 + engines/lab/lab.cpp | 13 +++ engines/lab/lab.h | 66 +++++++++------ engines/lab/special.cpp | 207 ++++++++++++++++++++---------------------------- 5 files changed, 154 insertions(+), 147 deletions(-) diff --git a/engines/lab/dispman.cpp b/engines/lab/dispman.cpp index d2f5f8d778..83022ba8dd 100644 --- a/engines/lab/dispman.cpp +++ b/engines/lab/dispman.cpp @@ -79,6 +79,20 @@ void DisplayMan::loadPict(const char *filename) { delete bitmapFile; } +void DisplayMan::loadBackPict(const char *fileName, uint16 *highPal) { + FadePalette = highPal; + _vm->_anim->_noPalChange = true; + readPict(fileName, true); + + for (uint16 i = 0; i < 16; i++) { + highPal[i] = ((_vm->_anim->_diffPalette[i * 3] >> 2) << 8) + + ((_vm->_anim->_diffPalette[i * 3 + 1] >> 2) << 4) + + ((_vm->_anim->_diffPalette[i * 3 + 2] >> 2)); + } + + _vm->_anim->_noPalChange = false; +} + /** * Reads in a picture into the display bitmap. */ diff --git a/engines/lab/dispman.h b/engines/lab/dispman.h index ad506c4cdf..58a517eb31 100644 --- a/engines/lab/dispman.h +++ b/engines/lab/dispman.h @@ -73,6 +73,7 @@ public: virtual ~DisplayMan(); void loadPict(const char *filename); + void loadBackPict(const char *fileName, uint16 *highPal); void readPict(const char *filename, bool playOnce, bool onlyDiffData = false, byte *memoryBuffer = nullptr, uint16 maxHeight = 0); void freePict(); void doScrollBlack(); diff --git a/engines/lab/lab.cpp b/engines/lab/lab.cpp index e33c443ee2..e7df814c5e 100644 --- a/engines/lab/lab.cpp +++ b/engines/lab/lab.cpp @@ -126,6 +126,19 @@ LabEngine::LabEngine(OSystem *syst, const ADGameDescription *gameDesc) _imgXMark = nullptr; _maps = nullptr; + _blankJournal = nullptr; + _journalFont = nullptr; + _journalText = nullptr; + _journalTextTitle = nullptr; + _journalPage = 0; + _lastPage = false; + _monitorPage = 0; + _monitorTextFilename = ""; + _monitorButton = nullptr; + _monitorGadgetHeight = 1; + for (int i = 0; i < 20; i++) + _highPalette[i] = 0; + //const Common::FSNode gameDataDir(ConfMan.get("path")); //SearchMan.addSubDirectoryMatching(gameDataDir, "game"); //SearchMan.addSubDirectoryMatching(gameDataDir, "game/pict"); diff --git a/engines/lab/lab.h b/engines/lab/lab.h index b03b4b3605..08f7fc6174 100644 --- a/engines/lab/lab.h +++ b/engines/lab/lab.h @@ -37,6 +37,8 @@ #include "engines/engine.h" +#include "lab/image.h" + struct ADGameDescription; namespace Lab { @@ -91,20 +93,28 @@ class LabEngine : public Engine { private: bool _interfaceOff; bool _isCrumbWaiting; + bool _lastTooLong; + bool _lastPage; bool _mainDisplay; bool _noUpdateDiff; bool _quitLab; - bool _lastTooLong; int _lastWaitTOFTicks; uint16 _direction; + uint16 _highPalette[20]; + uint16 _journalPage; uint16 _maxRooms; + uint16 _monitorPage; + uint16 _monitorGadgetHeight; uint32 _extraGameFeatures; + char *_journalText; + char *_journalTextTitle; const char *_nextFileName; const char *_newFileName; + const char *_monitorTextFilename; CloseDataPtr _closeDataPtr; GadgetList _journalGadgetList; @@ -114,9 +124,15 @@ private: Image *_imgMapEast, *_imgMapSouth, *_imgMapWest, *_imgXMark; InventoryData *_inventory; MapData *_maps; + byte *_blankJournal; + Image *_monitorButton; + TextFont *_journalFont; Common::RandomSource _rnd; + Image journalBackImage; + Image ScreenImage; + public: bool _alternate; bool _droppingCrumbs; @@ -176,62 +192,62 @@ public: void waitTOF(); private: + bool checkConditions(int16 *condition); Gadget *checkNumGadgetHit(GadgetList *gadgetList, uint16 key); void decIncInv(uint16 *CurInv, bool dec); + void doActions(Action *actionList, CloseDataPtr *closePtrList); + bool doActionRule(Common::Point pos, int16 action, int16 roomNum, CloseDataPtr *closePtrList); + bool doActionRuleSub(int16 action, int16 roomNum, CloseDataPtr closePtr, CloseDataPtr *setCloseList, bool allowDefaults); + bool doCloseUp(CloseDataPtr closePtr); + bool doGoForward(CloseDataPtr *closePtrList); void doJournal(); + bool doMainView(CloseDataPtr *closePtrList); void doMap(uint16 curRoom); void doMonitor(char *background, char *textfile, bool isinteractive, uint16 x1, uint16 y1, uint16 x2, uint16 y2); void doNotes(); + bool doOperateRuleSub(int16 itemNum, int16 roomNum, CloseDataPtr closePtr, CloseDataPtr *setCloseList, bool allowDefaults); + bool doOperateRule(Common::Point pos, int16 ItemNum, CloseDataPtr *closePtrList); + bool doTurn(uint16 from, uint16 to, CloseDataPtr *closePtrList); + bool doUse(uint16 curInv); void doWestPaper(); void drawDirection(CloseDataPtr closePtr); void drawJournal(uint16 wipenum, bool needFade); + void drawJournalText(); void drawMap(uint16 curRoom, uint16 curMsg, uint16 floorNum, bool fadeOut, bool fadeIn); void drawMonText(char *text, TextFont *monitorFont, uint16 x1, uint16 y1, uint16 x2, uint16 y2, bool isinteractive); + void drawRoomMap(uint16 curRoom, bool drawMarkFl); void drawRoomMessage(uint16 curInv, CloseDataPtr closePtr); void drawStaticMessage(byte index); void eatMessages(); + CloseDataPtr findClosePtrMatch(CloseDataPtr closePtr, CloseDataPtr closePtrList); + bool floorVisited(uint16 floorNum); int followCrumbs(); void freeMapData(); + void freeScreens(); bool fromCrumbs(uint32 tmpClass, uint16 code, uint16 qualifier, Common::Point tmpPos, uint16 &curInv, IntuiMessage *curMsg, bool &forceDraw, uint16 gadgetId, uint16 &actionMode); - void interfaceOff(); - void interfaceOn(); - void loadJournalData(); - void loadMapData(); - void processJournal(); - void processMap(uint16 curRoom); - void processMonitor(char *ntext, TextFont *monitorFont, bool isinteractive, uint16 x1, uint16 y1, uint16 x2, uint16 y2); - -private: - bool checkConditions(int16 *condition); - void doActions(Action *actionList, CloseDataPtr *closePtrList); - bool doActionRule(Common::Point pos, int16 action, int16 roomNum, CloseDataPtr *closePtrList); - bool doActionRuleSub(int16 action, int16 roomNum, CloseDataPtr closePtr, CloseDataPtr *setCloseList, bool allowDefaults); - bool doCloseUp(CloseDataPtr closePtr); - bool doGoForward(CloseDataPtr *closePtrList); - bool doMainView(CloseDataPtr *closePtrList); - bool doOperateRuleSub(int16 itemNum, int16 roomNum, CloseDataPtr closePtr, CloseDataPtr *setCloseList, bool allowDefaults); - bool doOperateRule(Common::Point pos, int16 ItemNum, CloseDataPtr *closePtrList); - bool doTurn(uint16 from, uint16 to, CloseDataPtr *closePtrList); - bool doUse(uint16 curInv); - void drawRoomMap(uint16 curRoom, bool drawMarkFl); - CloseDataPtr findClosePtrMatch(CloseDataPtr closePtr, CloseDataPtr closePtrList); - bool floorVisited(uint16 floorNum); - void freeScreens(); const char *getInvName(uint16 curInv); uint16 getLowerFloor(uint16 floorNum); CloseData *getObject(Common::Point pos, CloseDataPtr closePtr); uint16 getUpperFloor(uint16 floorNum); ViewData *getViewData(uint16 roomNum, uint16 direction); + void interfaceOff(); + void interfaceOn(); + void loadJournalData(); + void loadMapData(); void mainGameLoop(); void mayShowCrumbIndicator(); void mayShowCrumbIndicatorOff(); void perFlipGadget(uint16 gadID); uint16 processArrow(uint16 curDirection, uint16 arrow); + void processJournal(); + void processMap(uint16 curRoom); + void processMonitor(char *ntext, TextFont *monitorFont, bool isinteractive, uint16 x1, uint16 y1, uint16 x2, uint16 y2); Common::Rect roomCoords(uint16 curRoom); bool saveRestoreGame(); void setCurrentClose(Common::Point pos, CloseDataPtr *closePtrList, bool useAbsoluteCoords); bool takeItem(uint16 x, uint16 y, CloseDataPtr *closePtrList); + void turnPage(bool fromLeft); }; extern LabEngine *g_lab; diff --git a/engines/lab/special.cpp b/engines/lab/special.cpp index 6289cf2583..90f20b720a 100644 --- a/engines/lab/special.cpp +++ b/engines/lab/special.cpp @@ -42,46 +42,12 @@ #include "lab/utils.h" namespace Lab { - -static uint16 MonGadHeight = 1; -static uint16 hipal[20]; - -static TextFont *journalFont; -static char *journaltext, *journaltexttitle; -static uint16 JPage = 0; -static bool lastpage = false; -static Image JBackImage, ScreenImage; -static byte *_blankJournal; -static uint16 monitorPage; -static const char *TextFileName; - -Image *MonButton; - -#define INCL(BITSET,BIT) ((BITSET) |= (BIT)) -#define SETBIT(BITSET,BITNUM) INCL(BITSET, (1 << (BITNUM))) -#define INBIT(BITSET,BITNUM) ( ((1 << (BITNUM)) & (BITSET)) > 0 ) #define BRIDGE0 148 #define BRIDGE1 104 #define DIRTY 175 #define NONEWS 135 #define NOCLEAN 152 - -static void loadBackPict(const char *fileName) { - g_lab->_graphics->FadePalette = hipal; - - g_lab->_anim->_noPalChange = true; - g_lab->_graphics->readPict(fileName, true); - - for (uint16 i = 0; i < 16; i++) { - hipal[i] = ((g_lab->_anim->_diffPalette[i * 3] >> 2) << 8) + - ((g_lab->_anim->_diffPalette[i * 3 + 1] >> 2) << 4) + - ((g_lab->_anim->_diffPalette[i * 3 + 2] >> 2)); - } - - g_lab->_anim->_noPalChange = false; -} - /** * Does the things to properly set up the detective notes. */ @@ -96,7 +62,6 @@ void LabEngine::doNotes() { delete[] ntext; } - /** * Does the things to properly set up the old west newspaper. Assumes that * OpenHiRes already called. @@ -141,7 +106,7 @@ void LabEngine::doWestPaper() { * Loads in the data for the journal. */ void LabEngine::loadJournalData() { - journalFont = _resource->getFont("P:Journal.fon"); + _journalFont = _resource->getFont("P:Journal.fon"); _music->updateMusic(); @@ -172,8 +137,8 @@ void LabEngine::loadJournalData() { else if (bridge) filename[11] = '1'; - journaltext = _resource->getText(filename); - journaltexttitle = _resource->getText("Lab:Rooms/jt"); + _journalText = _resource->getText(filename); + _journalTextTitle = _resource->getText("Lab:Rooms/jt"); Common::File *journalFile = _resource->openDataFile("P:JImage"); Utils *utils = _utils; @@ -183,13 +148,13 @@ void LabEngine::loadJournalData() { delete journalFile; _anim->_noPalChange = true; - JBackImage._imageData = new byte[_graphics->_screenWidth * _graphics->_screenHeight]; - _graphics->readPict("P:Journal.pic", true, false, JBackImage._imageData); + journalBackImage._imageData = new byte[_graphics->_screenWidth * _graphics->_screenHeight]; + _graphics->readPict("P:Journal.pic", true, false, journalBackImage._imageData); _anim->_noPalChange = false; // Keep a copy of the blank journal _blankJournal = new byte[_graphics->_screenWidth * _graphics->_screenHeight]; - memcpy(_blankJournal, JBackImage._imageData, _graphics->_screenWidth * _graphics->_screenHeight); + memcpy(_blankJournal, journalBackImage._imageData, _graphics->_screenWidth * _graphics->_screenHeight); ScreenImage._imageData = _graphics->getCurrentDrawingBuffer(); } @@ -197,58 +162,58 @@ void LabEngine::loadJournalData() { /** * Draws the text to the back journal screen to the appropriate Page number */ -static void drawJournalText() { +void LabEngine::drawJournalText() { uint16 drawingToPage = 1; - int32 charsDrawn = 0L; - char *curText = journaltext; + int32 charsDrawn = 0; + char *curText = _journalText; - while (drawingToPage < JPage) { - g_lab->_music->updateMusic(); - curText = (char *)(journaltext + charsDrawn); - charsDrawn += g_lab->_graphics->flowTextScaled(journalFont, -2, 2, 0, false, false, false, false, 52, 32, 152, 148, curText); + while (drawingToPage < _journalPage) { + _music->updateMusic(); + curText = (char *)(_journalText + charsDrawn); + charsDrawn += _graphics->flowTextScaled(_journalFont, -2, 2, 0, false, false, false, false, 52, 32, 152, 148, curText); - lastpage = (*curText == 0); + _lastPage = (*curText == 0); - if (lastpage) - JPage = (drawingToPage / 2) * 2; + if (_lastPage) + _journalPage = (drawingToPage / 2) * 2; else drawingToPage++; } - if (JPage <= 1) { - curText = journaltexttitle; - g_lab->_graphics->flowTextToMem(&JBackImage, journalFont, -2, 2, 0, false, true, true, true, g_lab->_utils->vgaScaleX(52), g_lab->_utils->vgaScaleY(32), g_lab->_utils->vgaScaleX(152), g_lab->_utils->vgaScaleY(148), curText); + if (_journalPage <= 1) { + curText = _journalTextTitle; + _graphics->flowTextToMem(&journalBackImage, _journalFont, -2, 2, 0, false, true, true, true, _utils->vgaScaleX(52), _utils->vgaScaleY(32), _utils->vgaScaleX(152), _utils->vgaScaleY(148), curText); } else { - curText = (char *)(journaltext + charsDrawn); - charsDrawn += g_lab->_graphics->flowTextToMem(&JBackImage, journalFont, -2, 2, 0, false, false, false, true, g_lab->_utils->vgaScaleX(52), g_lab->_utils->vgaScaleY(32), g_lab->_utils->vgaScaleX(152), g_lab->_utils->vgaScaleY(148), curText); + curText = (char *)(_journalText + charsDrawn); + charsDrawn += g_lab->_graphics->flowTextToMem(&journalBackImage, _journalFont, -2, 2, 0, false, false, false, true, _utils->vgaScaleX(52), _utils->vgaScaleY(32), _utils->vgaScaleX(152), _utils->vgaScaleY(148), curText); } - g_lab->_music->updateMusic(); - curText = (char *)(journaltext + charsDrawn); - lastpage = (*curText == 0); - g_lab->_graphics->flowTextToMem(&JBackImage, journalFont, -2, 2, 0, false, false, false, true, g_lab->_utils->vgaScaleX(171), g_lab->_utils->vgaScaleY(32), g_lab->_utils->vgaScaleX(271), g_lab->_utils->vgaScaleY(148), curText); + _music->updateMusic(); + curText = (char *)(_journalText + charsDrawn); + _lastPage = (*curText == 0); + _graphics->flowTextToMem(&journalBackImage, _journalFont, -2, 2, 0, false, false, false, true, _utils->vgaScaleX(171), _utils->vgaScaleY(32), _utils->vgaScaleX(271), _utils->vgaScaleY(148), curText); - curText = (char *)(journaltext + charsDrawn); - lastpage = lastpage || (*curText == 0); + curText = (char *)(_journalText + charsDrawn); + _lastPage = _lastPage || (*curText == 0); } /** * Does the turn page wipe. */ -static void turnPage(bool fromLeft) { +void LabEngine::turnPage(bool fromLeft) { if (fromLeft) { - for (int i = 0; i < g_lab->_graphics->_screenWidth; i += 8) { - g_lab->_music->updateMusic(); - g_lab->waitTOF(); - ScreenImage._imageData = g_lab->_graphics->getCurrentDrawingBuffer(); - JBackImage.blitBitmap(i, 0, &ScreenImage, i, 0, 8, g_lab->_graphics->_screenHeight, false); + for (int i = 0; i < _graphics->_screenWidth; i += 8) { + _music->updateMusic(); + waitTOF(); + ScreenImage._imageData = _graphics->getCurrentDrawingBuffer(); + journalBackImage.blitBitmap(i, 0, &ScreenImage, i, 0, 8, _graphics->_screenHeight, false); } } else { - for (int i = (g_lab->_graphics->_screenWidth - 8); i > 0; i -= 8) { - g_lab->_music->updateMusic(); - g_lab->waitTOF(); - ScreenImage._imageData = g_lab->_graphics->getCurrentDrawingBuffer(); - JBackImage.blitBitmap(i, 0, &ScreenImage, i, 0, 8, g_lab->_graphics->_screenHeight, false); + for (int i = (_graphics->_screenWidth - 8); i > 0; i -= 8) { + _music->updateMusic(); + waitTOF(); + ScreenImage._imageData = _graphics->getCurrentDrawingBuffer(); + journalBackImage.blitBitmap(i, 0, &ScreenImage, i, 0, 8, _graphics->_screenHeight, false); } } } @@ -260,24 +225,22 @@ void LabEngine::drawJournal(uint16 wipenum, bool needFade) { _event->mouseHide(); _music->updateMusic(); drawJournalText(); - - // TODO: This is only called to set the palette correctly. Refactor, if possible - loadBackPict("P:Journal.pic"); + _graphics->loadBackPict("P:Journal.pic", _highPalette); if (wipenum == 0) - JBackImage.blitBitmap(0, 0, &ScreenImage, 0, 0, _graphics->_screenWidth, _graphics->_screenHeight, false); + journalBackImage.blitBitmap(0, 0, &ScreenImage, 0, 0, _graphics->_screenWidth, _graphics->_screenHeight, false); else turnPage((bool)(wipenum == 1)); Gadget *backGadget = _event->getGadget(0); Gadget *forwardGadget = _event->getGadget(2); - if (JPage == 0) + if (_journalPage == 0) disableGadget(backGadget, 15); else enableGadget(backGadget); - if (lastpage) + if (_lastPage) disableGadget(forwardGadget, 15); else enableGadget(forwardGadget); @@ -286,7 +249,7 @@ void LabEngine::drawJournal(uint16 wipenum, bool needFade) { _graphics->fade(true, 0); // Reset the journal background, so that all the text that has been blitted on it is erased - memcpy(JBackImage._imageData, _blankJournal, _graphics->_screenWidth * _graphics->_screenHeight); + memcpy(journalBackImage._imageData, _blankJournal, _graphics->_screenWidth * _graphics->_screenHeight); eatMessages(); _event->mouseShow(); @@ -313,15 +276,15 @@ void LabEngine::processJournal() { return; else if (msgClass == GADGETUP) { if (gadID == 0) { - if (JPage >= 2) { - JPage -= 2; + if (_journalPage >= 2) { + _journalPage -= 2; drawJournal(1, false); } } else if (gadID == 1) { return; } else if (gadID == 2) { - if (!lastpage) { - JPage += 2; + if (!_lastPage) { + _journalPage += 2; drawJournal(2, false); } } @@ -336,13 +299,13 @@ void LabEngine::processJournal() { void LabEngine::doJournal() { _graphics->blackAllScreen(); - lastpage = false; + _lastPage = false; - JBackImage._width = _graphics->_screenWidth; - JBackImage._height = _graphics->_screenHeight; - JBackImage._imageData = NULL; + journalBackImage._width = _graphics->_screenWidth; + journalBackImage._height = _graphics->_screenHeight; + journalBackImage._imageData = NULL; - ScreenImage = JBackImage; + ScreenImage = journalBackImage; ScreenImage._imageData = _graphics->getCurrentDrawingBuffer(); _music->updateMusic(); @@ -357,9 +320,9 @@ void LabEngine::doJournal() { _event->mouseHide(); delete[] _blankJournal; - delete[] JBackImage._imageData; + delete[] journalBackImage._imageData; freeButtonList(&_journalGadgetList); - _graphics->closeFont(journalFont); + _graphics->closeFont(_journalFont); ScreenImage._imageData = _graphics->getCurrentDrawingBuffer(); @@ -386,19 +349,19 @@ void LabEngine::drawMonText(char *text, TextFont *monitorFont, uint16 x1, uint16 text += 2; fheight = _graphics->textHeight(monitorFont); - x1 = MonButton->_width + _utils->vgaScaleX(3); - MonGadHeight = MonButton->_height + _utils->vgaScaleY(3); + x1 = _monitorButton->_width + _utils->vgaScaleX(3); + _monitorGadgetHeight = _monitorButton->_height + _utils->vgaScaleY(3); - if (MonGadHeight > fheight) - yspacing = MonGadHeight - fheight; + if (_monitorGadgetHeight > fheight) + yspacing = _monitorGadgetHeight - fheight; else - MonGadHeight = fheight; + _monitorGadgetHeight = fheight; _graphics->setAPen(0); _graphics->rectFill(0, 0, _graphics->_screenWidth - 1, y2); for (uint16 i = 0; i < numlines; i++) - MonButton->drawImage(0, i * MonGadHeight); + _monitorButton->drawImage(0, i * _monitorGadgetHeight); } else if (isinteractive) { _graphics->setAPen(0); _graphics->rectFill(0, 0, _graphics->_screenWidth - 1, y2); @@ -407,23 +370,23 @@ void LabEngine::drawMonText(char *text, TextFont *monitorFont, uint16 x1, uint16 _graphics->rectFill(x1, y1, x2, y2); } - while (drawingToPage < monitorPage) { + while (drawingToPage < _monitorPage) { _music->updateMusic(); curText = (char *)(text + charsDrawn); charsDrawn += _graphics->flowText(monitorFont, yspacing, 0, 0, false, false, false, false, x1, y1, x2, y2, curText); - lastpage = (*curText == 0); + _lastPage = (*curText == 0); - if (lastpage) - monitorPage = drawingToPage; + if (_lastPage) + _monitorPage = drawingToPage; else drawingToPage++; } curText = (char *)(text + charsDrawn); - lastpage = (*curText == 0); + _lastPage = (*curText == 0); charsDrawn = _graphics->flowText(monitorFont, yspacing, 2, 0, false, false, false, true, x1, y1, x2, y2, curText); curText += charsDrawn; - lastpage = lastpage || (*curText == 0); + _lastPage = _lastPage || (*curText == 0); _event->mouseShow(); } @@ -432,7 +395,7 @@ void LabEngine::drawMonText(char *text, TextFont *monitorFont, uint16 x1, uint16 * Processes user input. */ void LabEngine::processMonitor(char *ntext, TextFont *monitorFont, bool isinteractive, uint16 x1, uint16 y1, uint16 x2, uint16 y2) { - const char *test = " ", *startFileName = TextFileName; + const char *test = " ", *startFileName = _monitorTextFilename; CloseDataPtr startClosePtr = _closeDataPtr, lastClosePtr[10]; uint16 depth = 0; @@ -448,11 +411,11 @@ void LabEngine::processMonitor(char *ntext, TextFont *monitorFont, bool isintera else test = _closeDataPtr->_graphicName; - if (strcmp(test, TextFileName)) { - monitorPage = 0; - TextFileName = test; + if (strcmp(test, _monitorTextFilename)) { + _monitorPage = 0; + _monitorTextFilename = test; - ntext = _resource->getText(TextFileName); + ntext = _resource->getText(_monitorTextFilename); _graphics->fade(false, 0); drawMonText(ntext, monitorFont, x1, y1, x2, y2, isinteractive); _graphics->fade(true, 0); @@ -480,33 +443,33 @@ void LabEngine::processMonitor(char *ntext, TextFont *monitorFont, bool isintera else if ((msgClass == MOUSEBUTTONS) && (IEQUALIFIER_LEFTBUTTON & qualifier)) { if ((mouseY >= _utils->vgaScaleY(171)) && (mouseY <= _utils->vgaScaleY(200))) { if ((mouseX >= _utils->vgaScaleX(259)) && (mouseX <= _utils->vgaScaleX(289))) { - if (!lastpage) { - monitorPage += 1; + if (!_lastPage) { + _monitorPage += 1; drawMonText(ntext, monitorFont, x1, y1, x2, y2, isinteractive); } } else if ((mouseX >= _utils->vgaScaleX(0)) && (mouseX <= _utils->vgaScaleX(31))) { return; } else if ((mouseX >= _utils->vgaScaleX(290)) && (mouseX <= _utils->vgaScaleX(320))) { - if (monitorPage >= 1) { - monitorPage -= 1; + if (_monitorPage >= 1) { + _monitorPage -= 1; drawMonText(ntext, monitorFont, x1, y1, x2, y2, isinteractive); } } else if ((mouseX >= _utils->vgaScaleX(31)) && (mouseX <= _utils->vgaScaleX(59))) { if (isinteractive) { - monitorPage = 0; + _monitorPage = 0; if (depth) { depth--; _closeDataPtr = lastClosePtr[depth]; } - } else if (monitorPage > 0) { - monitorPage = 0; + } else if (_monitorPage > 0) { + _monitorPage = 0; drawMonText(ntext, monitorFont, x1, y1, x2, y2, isinteractive); } } } else if (isinteractive) { CloseDataPtr tmpClosePtr = _closeDataPtr; - mouseY = 64 + (mouseY / MonGadHeight) * 42; + mouseY = 64 + (mouseY / _monitorGadgetHeight) * 42; mouseX = 101; setCurrentClose(Common::Point(mouseX, mouseY), &_closeDataPtr, false); @@ -531,7 +494,7 @@ void LabEngine::doMonitor(char *background, char *textfile, bool isinteractive, y1 = _utils->vgaScaleY(y1); y2 = _utils->vgaScaleY(y2); - TextFileName = textfile; + _monitorTextFilename = textfile; _graphics->blackAllScreen(); _graphics->readPict("P:Mon/Monitor.1", true); @@ -540,17 +503,17 @@ void LabEngine::doMonitor(char *background, char *textfile, bool isinteractive, _graphics->readPict("P:Mon/NWD3", true); _graphics->blackAllScreen(); - monitorPage = 0; - lastpage = false; - _graphics->FadePalette = hipal; + _monitorPage = 0; + _lastPage = false; + _graphics->FadePalette = _highPalette; TextFont *monitorFont = _resource->getFont("P:Map.fon"); Common::File *buttonFile = _resource->openDataFile("P:MonImage"); - MonButton = new Image(buttonFile); + _monitorButton = new Image(buttonFile); delete buttonFile; ntext = _resource->getText(textfile); - loadBackPict(background); + _graphics->loadBackPict(background, _highPalette); drawMonText(ntext, monitorFont, x1, y1, x2, y2, isinteractive); _event->mouseShow(); _graphics->fade(true, 0); -- cgit v1.2.3 From ac346869f759475ad00751159a6bad5064f235a2 Mon Sep 17 00:00:00 2001 From: Strangerke Date: Sun, 13 Dec 2015 11:59:05 +0100 Subject: LAB: Remove a useless use of g_lab --- engines/lab/special.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/engines/lab/special.cpp b/engines/lab/special.cpp index 90f20b720a..f043d0ae62 100644 --- a/engines/lab/special.cpp +++ b/engines/lab/special.cpp @@ -185,7 +185,7 @@ void LabEngine::drawJournalText() { _graphics->flowTextToMem(&journalBackImage, _journalFont, -2, 2, 0, false, true, true, true, _utils->vgaScaleX(52), _utils->vgaScaleY(32), _utils->vgaScaleX(152), _utils->vgaScaleY(148), curText); } else { curText = (char *)(_journalText + charsDrawn); - charsDrawn += g_lab->_graphics->flowTextToMem(&journalBackImage, _journalFont, -2, 2, 0, false, false, false, true, _utils->vgaScaleX(52), _utils->vgaScaleY(32), _utils->vgaScaleX(152), _utils->vgaScaleY(148), curText); + charsDrawn += _graphics->flowTextToMem(&journalBackImage, _journalFont, -2, 2, 0, false, false, false, true, _utils->vgaScaleX(52), _utils->vgaScaleY(32), _utils->vgaScaleX(152), _utils->vgaScaleY(148), curText); } _music->updateMusic(); -- cgit v1.2.3 From 6668b76edcb0d0be70314f417c13f535756b0d2c Mon Sep 17 00:00:00 2001 From: Strangerke Date: Sun, 13 Dec 2015 12:06:38 +0100 Subject: LAB: Remove some more useless g_lab --- engines/lab/intro.cpp | 2 +- engines/lab/music.cpp | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/engines/lab/intro.cpp b/engines/lab/intro.cpp index b6fbf04f2b..fbe1facab8 100644 --- a/engines/lab/intro.cpp +++ b/engines/lab/intro.cpp @@ -88,7 +88,7 @@ void Intro::doPictText(const char *filename, TextFont *msgFont, bool isScreen) { int32 cls, code, Drawn; int16 qualifier; - Common::File *textFile = g_lab->_resource->openDataFile(path); + Common::File *textFile = _vm->_resource->openDataFile(path); byte *textBuffer = new byte[textFile->size()]; textFile->read(textBuffer, textFile->size()); delete textFile; diff --git a/engines/lab/music.cpp b/engines/lab/music.cpp index feddea5895..a996f3169c 100644 --- a/engines/lab/music.cpp +++ b/engines/lab/music.cpp @@ -178,7 +178,7 @@ bool Music::initMusic() { else filename = "Music:BackGrou"; - _file = g_lab->_resource->openDataFile(filename); + _file = _vm->_resource->openDataFile(filename); startMusic(true); return true; } @@ -274,7 +274,7 @@ void Music::changeMusic(const char *newmusic) { _tLeftInFile = _leftinfile; } - _file = g_lab->_resource->openDataFile(newmusic); + _file = _vm->_resource->openDataFile(newmusic); // turn music off _musicOn = true; setMusic(false); -- cgit v1.2.3 From 47368c157ebf870248a61de4b81e181fa7713671 Mon Sep 17 00:00:00 2001 From: Strangerke Date: Sun, 13 Dec 2015 13:22:54 +0100 Subject: LAB: Review Music declaration, some refactoring and renaming --- engines/lab/dispman.cpp | 2 +- engines/lab/map.cpp | 2 +- engines/lab/music.cpp | 57 ++++++++++++++++++----------------- engines/lab/music.h | 72 ++++++++++++++++++++++++--------------------- engines/lab/processroom.cpp | 6 ++-- 5 files changed, 71 insertions(+), 68 deletions(-) diff --git a/engines/lab/dispman.cpp b/engines/lab/dispman.cpp index 83022ba8dd..4cc3c24395 100644 --- a/engines/lab/dispman.cpp +++ b/engines/lab/dispman.cpp @@ -103,7 +103,7 @@ void DisplayMan::readPict(const char *filename, bool playOnce, bool onlyDiffData _vm->_music->updateMusic(); - if (!_vm->_music->_doNotFilestopSoundEffect) + if (!_vm->_music->_unstoppableSoundEffect) _vm->_music->stopSoundEffect(); _dispBitMap->_bytesPerRow = _screenWidth; diff --git a/engines/lab/map.cpp b/engines/lab/map.cpp index db995504a2..5d978b72fe 100644 --- a/engines/lab/map.cpp +++ b/engines/lab/map.cpp @@ -87,7 +87,7 @@ void LabEngine::loadMapData() { Common::File *mapFile = _resource->openDataFile("Lab:Maps", MKTAG('M', 'A', 'P', '0')); _music->updateMusic(); - if (!_music->_doNotFilestopSoundEffect) + if (!_music->_unstoppableSoundEffect) _music->stopSoundEffect(); _maxRooms = mapFile->readUint16LE(); diff --git a/engines/lab/music.cpp b/engines/lab/music.cpp index a996f3169c..cca7633e67 100644 --- a/engines/lab/music.cpp +++ b/engines/lab/music.cpp @@ -50,16 +50,16 @@ Music::Music(LabEngine *vm) : _vm(vm) { _tFile = 0; _musicPaused = false; - _tMusicOn = false; + _oldMusicOn = false; _tLeftInFile = 0; - _leftinfile = 0; + _leftInFile = 0; _musicOn = false; - _winmusic = false; + _winMusic = false; _loopSoundEffect = false; _queuingAudioStream = NULL; - _doNotFilestopSoundEffect = false; + _unstoppableSoundEffect = false; _lastMusicRoom = 1; _doReset = true; _waitTillFinished = false; @@ -104,12 +104,12 @@ uint16 Music::getPlayingBufferCount() { return (_queuingAudioStream) ? _queuingAudioStream->numQueuedStreams() : 0; } -void Music::playSoundEffect(uint16 SampleSpeed, uint32 Length, void *Data) { +void Music::playSoundEffect(uint16 sampleSpeed, uint32 length, void *data) { pauseBackMusic(); stopSoundEffect(); - if (SampleSpeed < 4000) - SampleSpeed = 4000; + if (sampleSpeed < 4000) + sampleSpeed = 4000; byte soundFlags = Audio::FLAG_LITTLE_ENDIAN; if (_vm->getPlatform() == Common::kPlatformWindows) @@ -117,7 +117,7 @@ void Music::playSoundEffect(uint16 SampleSpeed, uint32 Length, void *Data) { else soundFlags |= Audio::FLAG_UNSIGNED; - Audio::SeekableAudioStream *audioStream = Audio::makeRawStream((const byte *)Data, Length, SampleSpeed, soundFlags, DisposeAfterUse::NO); + Audio::SeekableAudioStream *audioStream = Audio::makeRawStream((const byte *)data, length, sampleSpeed, soundFlags, DisposeAfterUse::NO); uint loops = (_loopSoundEffect) ? 0 : 1; Audio::LoopingAudioStream *loopingAudioStream = new Audio::LoopingAudioStream(audioStream, loops); _vm->_mixer->playStream(Audio::Mixer::kSFXSoundType, &_sfxHandle, loopingAudioStream); @@ -133,16 +133,16 @@ bool Music::isSoundEffectActive() const { } void Music::fillbuffer(byte *musicBuffer) { - if (MUSICBUFSIZE < _leftinfile) { + if (MUSICBUFSIZE < _leftInFile) { _file->read(musicBuffer, MUSICBUFSIZE); - _leftinfile -= MUSICBUFSIZE; + _leftInFile -= MUSICBUFSIZE; } else { - _file->read(musicBuffer, _leftinfile); + _file->read(musicBuffer, _leftInFile); - memset((char *)musicBuffer + _leftinfile, 0, MUSICBUFSIZE - _leftinfile); + memset((char *)musicBuffer + _leftInFile, 0, MUSICBUFSIZE - _leftInFile); _file->seek(0); - _leftinfile = _file->size(); + _leftInFile = _file->size(); } } @@ -157,7 +157,7 @@ void Music::startMusic(bool restartFl) { if (restartFl) { _file->seek(0); - _leftinfile = _file->size(); + _leftInFile = _file->size(); } _musicOn = true; @@ -173,7 +173,7 @@ bool Music::initMusic() { const char *filename; - if (_winmusic) + if (_winMusic) filename = "Music:WinGame"; else filename = "Music:BackGrou"; @@ -267,11 +267,11 @@ void Music::checkRoomMusic() { void Music::changeMusic(const char *newmusic) { if (!_tFile) { _tFile = _file; - _tMusicOn = _musicOn; - _tLeftInFile = _leftinfile + 65536L; + _oldMusicOn = _musicOn; + _tLeftInFile = _leftInFile + 65536L; if (_tLeftInFile > (uint32)_tFile->size()) - _tLeftInFile = _leftinfile; + _tLeftInFile = _leftInFile; } _file = _vm->_resource->openDataFile(newmusic); @@ -295,20 +295,20 @@ void Music::resetMusic() { _file->close(); _file = _tFile; - _leftinfile = _tLeftInFile; + _leftInFile = _tLeftInFile; - _file->seek(_file->size() - _leftinfile); + _file->seek(_file->size() - _leftInFile); _musicOn = true; setMusic(false); updateMusic(); - if (!_tMusicOn) { + if (!_oldMusicOn) { _tFile = 0; return; } - _musicOn = _tMusicOn; + _musicOn = _oldMusicOn; startMusic(false); _tFile = 0; @@ -320,7 +320,7 @@ void Music::resetMusic() { bool Music::readMusic(const char *filename, bool waitTillFinished) { Common::File *file = _vm->_resource->openDataFile(filename, MKTAG('D', 'I', 'F', 'F')); updateMusic(); - if (!_doNotFilestopSoundEffect) + if (!_unstoppableSoundEffect) stopSoundEffect(); if (!file) @@ -334,9 +334,10 @@ bool Music::readMusic(const char *filename, bool waitTillFinished) { void Music::readSound(bool waitTillFinished, Common::File *file) { uint32 magicBytes = file->readUint32LE(); - if (magicBytes != 1219009121L) + if (magicBytes != 1219009121L) { + warning("readSound: Bad signature, skipping"); return; - + } uint32 soundTag = file->readUint32LE(); uint32 soundSize = file->readUint32LE(); @@ -367,16 +368,14 @@ void Music::readSound(bool waitTillFinished, Common::File *file) { byte *soundData = (byte *)malloc(soundSize); file->read(soundData, soundSize); playSoundEffect(sampleRate, soundSize, soundData); - } - else if (soundTag == 65535L) { + } else if (soundTag == 65535L) { if (waitTillFinished) { while (isSoundEffectActive()) { updateMusic(); _vm->waitTOF(); } } - } - else + } else file->skip(soundSize); } } diff --git a/engines/lab/music.h b/engines/lab/music.h index 5efd2e3045..57524ba953 100644 --- a/engines/lab/music.h +++ b/engines/lab/music.h @@ -46,52 +46,56 @@ class LabEngine; #define MAXBUFFERS 5L class Music { -public: - Music(LabEngine *vm); - - bool initMusic(); - void freeMusic(); - void updateMusic(); - uint16 getPlayingBufferCount(); - void closeMusic(); - void setMusic(bool on); - void resumeBackMusic(); - void pauseBackMusic(); - void changeMusic(const char *newmusic); - void checkRoomMusic(); - void resetMusic(); - void setMusicReset(bool reset) { _doReset = reset; } - void playSoundEffect(uint16 SampleSpeed, uint32 Length, void *Data); - void stopSoundEffect(); - bool isSoundEffectActive() const; - bool readMusic(const char *filename, bool waitTillFinished); - - bool _winmusic, _doNotFilestopSoundEffect; - bool _musicOn; - bool _loopSoundEffect; - bool _waitTillFinished; - uint16 _lastMusicRoom ; - bool _doReset; - private: - void fillbuffer(byte *musicBuffer); - void startMusic(bool restartFl); - void readSound(bool waitTillFinished, Common::File *file); - LabEngine *_vm; Common::File *_file; Common::File *_tFile; + + bool _doReset; + bool _musicOn; bool _musicPaused; + bool _oldMusicOn; + bool _winMusic; + + uint16 _lastMusicRoom ; - bool _tMusicOn; uint32 _tLeftInFile; - uint32 _leftinfile; + uint32 _leftInFile; Audio::SoundHandle _musicHandle; Audio::SoundHandle _sfxHandle; - Audio::QueuingAudioStream *_queuingAudioStream; + +private: + void fillbuffer(byte *musicBuffer); + uint16 getPlayingBufferCount(); + void pauseBackMusic(); + void readSound(bool waitTillFinished, Common::File *file); + void startMusic(bool restartFl); + +public: + bool _unstoppableSoundEffect; + bool _loopSoundEffect; + bool _waitTillFinished; + +public: + Music(LabEngine *vm); + + void changeMusic(const char *newmusic); + void checkRoomMusic(); + void freeMusic(); + bool initMusic(); + bool isSoundEffectActive() const; + void playSoundEffect(uint16 sampleSpeed, uint32 length, void *data); + bool readMusic(const char *filename, bool waitTillFinished); + void resetMusic(); + void resumeBackMusic(); + void setMusic(bool on); + void setMusicReset(bool reset) { _doReset = reset; } + void setWinMusic() { _winMusic = true; } + void stopSoundEffect(); + void updateMusic(); }; } // End of namespace Lab diff --git a/engines/lab/processroom.cpp b/engines/lab/processroom.cpp index bd9d02ef8c..c09d918fcb 100644 --- a/engines/lab/processroom.cpp +++ b/engines/lab/processroom.cpp @@ -296,7 +296,7 @@ void LabEngine::doActions(Action *actionList, CloseDataPtr *closePtrList) { break; case PLAYSOUNDCONT: - _music->_doNotFilestopSoundEffect = true; + _music->_unstoppableSoundEffect = true; _music->_loopSoundEffect = true; _music->readMusic((char *)actionList->_data, _music->_waitTillFinished); break; @@ -476,7 +476,7 @@ void LabEngine::doActions(Action *actionList, CloseDataPtr *closePtrList) { break; case WINMUSIC: - _music->_winmusic = true; + _music->setWinMusic(); _music->freeMusic(); _music->initMusic(); break; @@ -544,7 +544,7 @@ void LabEngine::doActions(Action *actionList, CloseDataPtr *closePtrList) { } } - _music->_doNotFilestopSoundEffect = false; + _music->_unstoppableSoundEffect = false; } /** -- cgit v1.2.3 From 7efd471a92ca6a8d9f7e2c9acdd17be847b7ef73 Mon Sep 17 00:00:00 2001 From: Strangerke Date: Sun, 13 Dec 2015 13:34:37 +0100 Subject: LAB: check header define names, rename a parameter of processMonitor() --- engines/lab/image.h | 2 +- engines/lab/interface.h | 6 +++--- engines/lab/lab.h | 8 ++++---- engines/lab/music.h | 2 +- engines/lab/special.cpp | 16 ++++++++-------- 5 files changed, 17 insertions(+), 17 deletions(-) diff --git a/engines/lab/image.h b/engines/lab/image.h index 0e2f831705..34e3d36658 100644 --- a/engines/lab/image.h +++ b/engines/lab/image.h @@ -55,4 +55,4 @@ public: } // End of namespace Lab -#endif // LAB_H +#endif // LAB_IMAGE_H diff --git a/engines/lab/interface.h b/engines/lab/interface.h index c4b2341871..10e081532b 100644 --- a/engines/lab/interface.h +++ b/engines/lab/interface.h @@ -28,8 +28,8 @@ * */ -#ifndef LAB_INTEFACE_H -#define LAB_INTEFACE_H +#ifndef LAB_INTEFARCE_H +#define LAB_INTEFARCE_H namespace Lab { @@ -112,4 +112,4 @@ IntuiMessage *getMsg(); } // End of namespace Lab -#endif // LAB_INTEFACE_H +#endif // LAB_INTEFARCE_H diff --git a/engines/lab/lab.h b/engines/lab/lab.h index 08f7fc6174..92ffa26591 100644 --- a/engines/lab/lab.h +++ b/engines/lab/lab.h @@ -28,8 +28,8 @@ * */ -#ifndef LAB_H -#define LAB_H +#ifndef LAB_LAB_H +#define LAB_LAB_H #include "common/system.h" #include "common/random.h" @@ -242,7 +242,7 @@ private: uint16 processArrow(uint16 curDirection, uint16 arrow); void processJournal(); void processMap(uint16 curRoom); - void processMonitor(char *ntext, TextFont *monitorFont, bool isinteractive, uint16 x1, uint16 y1, uint16 x2, uint16 y2); + void processMonitor(char *ntext, TextFont *monitorFont, bool isInteractive, uint16 x1, uint16 y1, uint16 x2, uint16 y2); Common::Rect roomCoords(uint16 curRoom); bool saveRestoreGame(); void setCurrentClose(Common::Point pos, CloseDataPtr *closePtrList, bool useAbsoluteCoords); @@ -254,4 +254,4 @@ extern LabEngine *g_lab; } // End of namespace Lab -#endif // LAB_H +#endif // LAB_LAB_H diff --git a/engines/lab/music.h b/engines/lab/music.h index 57524ba953..02c68209eb 100644 --- a/engines/lab/music.h +++ b/engines/lab/music.h @@ -43,7 +43,7 @@ class LabEngine; //----- From LabMusic.c ----- //--------------------------- -#define MAXBUFFERS 5L +#define MAXBUFFERS 5 class Music { private: diff --git a/engines/lab/special.cpp b/engines/lab/special.cpp index f043d0ae62..5b2da2a3be 100644 --- a/engines/lab/special.cpp +++ b/engines/lab/special.cpp @@ -394,7 +394,7 @@ void LabEngine::drawMonText(char *text, TextFont *monitorFont, uint16 x1, uint16 /** * Processes user input. */ -void LabEngine::processMonitor(char *ntext, TextFont *monitorFont, bool isinteractive, uint16 x1, uint16 y1, uint16 x2, uint16 y2) { +void LabEngine::processMonitor(char *ntext, TextFont *monitorFont, bool isInteractive, uint16 x1, uint16 y1, uint16 x2, uint16 y2) { const char *test = " ", *startFileName = _monitorTextFilename; CloseDataPtr startClosePtr = _closeDataPtr, lastClosePtr[10]; uint16 depth = 0; @@ -402,7 +402,7 @@ void LabEngine::processMonitor(char *ntext, TextFont *monitorFont, bool isintera lastClosePtr[0] = _closeDataPtr; while (1) { - if (isinteractive) { + if (isInteractive) { if (_closeDataPtr == NULL) _closeDataPtr = startClosePtr; @@ -417,7 +417,7 @@ void LabEngine::processMonitor(char *ntext, TextFont *monitorFont, bool isintera ntext = _resource->getText(_monitorTextFilename); _graphics->fade(false, 0); - drawMonText(ntext, monitorFont, x1, y1, x2, y2, isinteractive); + drawMonText(ntext, monitorFont, x1, y1, x2, y2, isInteractive); _graphics->fade(true, 0); delete[] ntext; } @@ -445,17 +445,17 @@ void LabEngine::processMonitor(char *ntext, TextFont *monitorFont, bool isintera if ((mouseX >= _utils->vgaScaleX(259)) && (mouseX <= _utils->vgaScaleX(289))) { if (!_lastPage) { _monitorPage += 1; - drawMonText(ntext, monitorFont, x1, y1, x2, y2, isinteractive); + drawMonText(ntext, monitorFont, x1, y1, x2, y2, isInteractive); } } else if ((mouseX >= _utils->vgaScaleX(0)) && (mouseX <= _utils->vgaScaleX(31))) { return; } else if ((mouseX >= _utils->vgaScaleX(290)) && (mouseX <= _utils->vgaScaleX(320))) { if (_monitorPage >= 1) { _monitorPage -= 1; - drawMonText(ntext, monitorFont, x1, y1, x2, y2, isinteractive); + drawMonText(ntext, monitorFont, x1, y1, x2, y2, isInteractive); } } else if ((mouseX >= _utils->vgaScaleX(31)) && (mouseX <= _utils->vgaScaleX(59))) { - if (isinteractive) { + if (isInteractive) { _monitorPage = 0; if (depth) { @@ -464,10 +464,10 @@ void LabEngine::processMonitor(char *ntext, TextFont *monitorFont, bool isintera } } else if (_monitorPage > 0) { _monitorPage = 0; - drawMonText(ntext, monitorFont, x1, y1, x2, y2, isinteractive); + drawMonText(ntext, monitorFont, x1, y1, x2, y2, isInteractive); } } - } else if (isinteractive) { + } else if (isInteractive) { CloseDataPtr tmpClosePtr = _closeDataPtr; mouseY = 64 + (mouseY / _monitorGadgetHeight) * 42; mouseX = 101; -- cgit v1.2.3 From c837e67070913166177a19b2d0d6d925d4569c83 Mon Sep 17 00:00:00 2001 From: Strangerke Date: Sun, 13 Dec 2015 14:04:00 +0100 Subject: LAB: Move interface functions to EventMan --- engines/lab/dispman.cpp | 40 ++++++++--------- engines/lab/eventman.h | 31 +++++++++++++- engines/lab/interface.cpp | 106 +++++++++++++++++++++++----------------------- engines/lab/interface.h | 29 ++----------- engines/lab/intro.cpp | 1 + engines/lab/lab.h | 1 - engines/lab/map.cpp | 18 ++++---- engines/lab/special.cpp | 16 +++---- 8 files changed, 122 insertions(+), 120 deletions(-) diff --git a/engines/lab/dispman.cpp b/engines/lab/dispman.cpp index 4cc3c24395..0aa49f9904 100644 --- a/engines/lab/dispman.cpp +++ b/engines/lab/dispman.cpp @@ -383,7 +383,7 @@ void DisplayMan::drawPanel() { setAPen(4); // The horizontal lines under the black one drawHLine(0, _vm->_utils->vgaScaleY(170) + 1, _vm->_utils->vgaScaleX(319)); - drawGadgetList(&_vm->_moveGadgetList); + _vm->_event->drawGadgetList(&_vm->_moveGadgetList); } else { if (_vm->getPlatform() != Common::kPlatformWindows) { // Vertical Black lines @@ -413,7 +413,7 @@ void DisplayMan::drawPanel() { drawVLine(_vm->_utils->vgaScaleX(232), _vm->_utils->vgaScaleY(170) + 2, _vm->_utils->vgaScaleY(198)); } - drawGadgetList(&_vm->_invGadgetList); + _vm->_event->drawGadgetList(&_vm->_invGadgetList); } _vm->_event->mouseShow(); @@ -436,16 +436,16 @@ void DisplayMan::setUpScreens() { // The key mapping was only set for the Windows version. // It's very convenient to have those shortcut, so I added them // for all versions. (Strangerke) - _vm->_moveGadgetList.push_back(createButton( 1, y, 0, 't', _vm->_moveImages[0], _vm->_moveImages[1])); - _vm->_moveGadgetList.push_back(createButton( 33, y, 1, 'm', _vm->_moveImages[2], _vm->_moveImages[3])); - _vm->_moveGadgetList.push_back(createButton( 65, y, 2, 'o', _vm->_moveImages[4], _vm->_moveImages[5])); - _vm->_moveGadgetList.push_back(createButton( 97, y, 3, 'c', _vm->_moveImages[6], _vm->_moveImages[7])); - _vm->_moveGadgetList.push_back(createButton(129, y, 4, 'l', _vm->_moveImages[8], _vm->_moveImages[9])); - _vm->_moveGadgetList.push_back(createButton(161, y, 5, 'i', _vm->_moveImages[12], _vm->_moveImages[13])); - _vm->_moveGadgetList.push_back(createButton(193, y, 6, VKEY_LTARROW, _vm->_moveImages[14], _vm->_moveImages[15])); - _vm->_moveGadgetList.push_back(createButton(225, y, 7, VKEY_UPARROW, _vm->_moveImages[16], _vm->_moveImages[17])); - _vm->_moveGadgetList.push_back(createButton(257, y, 8, VKEY_RTARROW, _vm->_moveImages[18], _vm->_moveImages[19])); - _vm->_moveGadgetList.push_back(createButton(289, y, 9, 'p', _vm->_moveImages[10], _vm->_moveImages[11])); + _vm->_moveGadgetList.push_back(_vm->_event->createButton( 1, y, 0, 't', _vm->_moveImages[0], _vm->_moveImages[1])); + _vm->_moveGadgetList.push_back(_vm->_event->createButton( 33, y, 1, 'm', _vm->_moveImages[2], _vm->_moveImages[3])); + _vm->_moveGadgetList.push_back(_vm->_event->createButton( 65, y, 2, 'o', _vm->_moveImages[4], _vm->_moveImages[5])); + _vm->_moveGadgetList.push_back(_vm->_event->createButton( 97, y, 3, 'c', _vm->_moveImages[6], _vm->_moveImages[7])); + _vm->_moveGadgetList.push_back(_vm->_event->createButton(129, y, 4, 'l', _vm->_moveImages[8], _vm->_moveImages[9])); + _vm->_moveGadgetList.push_back(_vm->_event->createButton(161, y, 5, 'i', _vm->_moveImages[12], _vm->_moveImages[13])); + _vm->_moveGadgetList.push_back(_vm->_event->createButton(193, y, 6, VKEY_LTARROW, _vm->_moveImages[14], _vm->_moveImages[15])); + _vm->_moveGadgetList.push_back(_vm->_event->createButton(225, y, 7, VKEY_UPARROW, _vm->_moveImages[16], _vm->_moveImages[17])); + _vm->_moveGadgetList.push_back(_vm->_event->createButton(257, y, 8, VKEY_RTARROW, _vm->_moveImages[18], _vm->_moveImages[19])); + _vm->_moveGadgetList.push_back(_vm->_event->createButton(289, y, 9, 'p', _vm->_moveImages[10], _vm->_moveImages[11])); Common::File *invFile = _vm->_resource->openDataFile("P:Inv"); if (_vm->getPlatform() == Common::kPlatformWindows) { @@ -455,18 +455,18 @@ void DisplayMan::setUpScreens() { for (uint16 imgIdx = 0; imgIdx < 6; imgIdx++) _vm->_invImages[imgIdx] = new Image(invFile); } - _vm->_invGadgetList.push_back(createButton( 24, y, 0, 'm', _vm->_invImages[0], _vm->_invImages[1])); - _vm->_invGadgetList.push_back(createButton( 56, y, 1, 'g', _vm->_invImages[2], _vm->_invImages[3])); - _vm->_invGadgetList.push_back(createButton( 94, y, 2, 'u', _vm->_invImages[4], _vm->_invImages[5])); - _vm->_invGadgetList.push_back(createButton(126, y, 3, 'l', _vm->_moveImages[8], _vm->_moveImages[9])); - _vm->_invGadgetList.push_back(createButton(164, y, 4, VKEY_LTARROW, _vm->_moveImages[14], _vm->_moveImages[15])); - _vm->_invGadgetList.push_back(createButton(196, y, 5, VKEY_RTARROW, _vm->_moveImages[18], _vm->_moveImages[19])); + _vm->_invGadgetList.push_back(_vm->_event->createButton( 24, y, 0, 'm', _vm->_invImages[0], _vm->_invImages[1])); + _vm->_invGadgetList.push_back(_vm->_event->createButton( 56, y, 1, 'g', _vm->_invImages[2], _vm->_invImages[3])); + _vm->_invGadgetList.push_back(_vm->_event->createButton( 94, y, 2, 'u', _vm->_invImages[4], _vm->_invImages[5])); + _vm->_invGadgetList.push_back(_vm->_event->createButton(126, y, 3, 'l', _vm->_moveImages[8], _vm->_moveImages[9])); + _vm->_invGadgetList.push_back(_vm->_event->createButton(164, y, 4, VKEY_LTARROW, _vm->_moveImages[14], _vm->_moveImages[15])); + _vm->_invGadgetList.push_back(_vm->_event->createButton(196, y, 5, VKEY_RTARROW, _vm->_moveImages[18], _vm->_moveImages[19])); // The windows version has 2 extra gadgets for breadcrumb trail // TODO: the game is really hard to play without those, maybe we could add something to enable that. if (_vm->getPlatform() == Common::kPlatformWindows) { - _vm->_invGadgetList.push_back(createButton(234, y, 6, 'b', _vm->_invImages[6], _vm->_invImages[7])); - _vm->_invGadgetList.push_back(createButton(266, y, 7, 'f', _vm->_invImages[8], _vm->_invImages[9])); + _vm->_invGadgetList.push_back(_vm->_event->createButton(234, y, 6, 'b', _vm->_invImages[6], _vm->_invImages[7])); + _vm->_invGadgetList.push_back(_vm->_event->createButton(266, y, 7, 'f', _vm->_invImages[8], _vm->_invImages[9])); } delete invFile; diff --git a/engines/lab/eventman.h b/engines/lab/eventman.h index 420c7d03df..f9facd815b 100644 --- a/engines/lab/eventman.h +++ b/engines/lab/eventman.h @@ -31,11 +31,28 @@ #ifndef LAB_EVENTMAN_H #define LAB_EVENTMAN_H -namespace Lab { +#include "common/events.h" -struct Gadget; +namespace Lab { class LabEngine; +class Image; + +struct IntuiMessage { + uint32 _msgClass; + uint16 _code, _qualifier, _mouseX, _mouseY, _gadgetID; + uint32 _seconds, _micros; +}; + + +struct Gadget { + uint16 x, y, _gadgetID; + uint16 _keyEquiv; // if not zero, a key that activates gadget + bool isEnabled; + Image *_image, *_altImage; +}; + +typedef Common::List GadgetList; class EventManager { private: @@ -56,6 +73,7 @@ public: GadgetList *_screenGadgetList; Gadget *_hitGadget; + Common::KeyState _keyPressed; Gadget *checkGadgetHit(GadgetList *gadgetList, Common::Point pos); void initMouse(); @@ -74,6 +92,15 @@ public: void processInput(bool can_delay = false); uint16 getNextChar(); Common::Point updateAndGetMousePos(); + + Gadget *checkNumGadgetHit(GadgetList *gadgetList, uint16 key); + Gadget *createButton(uint16 x, uint16 y, uint16 id, uint16 key, Image *im, Image *imalt); + void freeButtonList(GadgetList *gadgetList); + void drawGadgetList(GadgetList *gadgetList); + void disableGadget(Gadget *curgad, uint16 pencolor); + void enableGadget(Gadget *curgad); + IntuiMessage *getMsg(); + uint16 makeGadgetKeyEquiv(uint16 key); }; } // End of namespace Lab diff --git a/engines/lab/interface.cpp b/engines/lab/interface.cpp index 0ccbd48fec..b540a31357 100644 --- a/engines/lab/interface.cpp +++ b/engines/lab/interface.cpp @@ -40,26 +40,24 @@ namespace Lab { -Common::KeyState _keyPressed; - -Gadget *createButton(uint16 x, uint16 y, uint16 id, uint16 key, Image *im, Image *imalt) { - Gadget *gptr = new Gadget(); - - if (gptr) { - gptr->x = g_lab->_utils->vgaScaleX(x); - gptr->y = y; - gptr->_gadgetID = id; - gptr->_keyEquiv = key; - gptr->_image = im; - gptr->_altImage = imalt; - gptr->isEnabled = true; - - return gptr; +Gadget *EventManager::createButton(uint16 x, uint16 y, uint16 id, uint16 key, Image *image, Image *altImage) { + Gadget *gadget = new Gadget(); + + if (gadget) { + gadget->x = _vm->_utils->vgaScaleX(x); + gadget->y = y; + gadget->_gadgetID = id; + gadget->_keyEquiv = key; + gadget->_image = image; + gadget->_altImage = altImage; + gadget->isEnabled = true; + + return gadget; } else return nullptr; } -void freeButtonList(GadgetList *gadgetList) { +void EventManager::freeButtonList(GadgetList *gadgetList) { for (GadgetList::iterator gadgetIter = gadgetList->begin(); gadgetIter != gadgetList->end(); ++gadgetIter) { Gadget *gadget = *gadgetIter; delete gadget->_image; @@ -73,7 +71,7 @@ void freeButtonList(GadgetList *gadgetList) { /** * Draws a gadget list to the screen. */ -void drawGadgetList(GadgetList *gadgetList) { +void EventManager::drawGadgetList(GadgetList *gadgetList) { for (GadgetList::iterator gadget = gadgetList->begin(); gadget != gadgetList->end(); ++gadget) { (*gadget)->_image->drawImage((*gadget)->x, (*gadget)->y); @@ -85,23 +83,23 @@ void drawGadgetList(GadgetList *gadgetList) { /** * Dims a gadget, and makes it unavailable for using. */ -void disableGadget(Gadget *curgad, uint16 pencolor) { - g_lab->_graphics->overlayRect(pencolor, curgad->x, curgad->y, curgad->x + curgad->_image->_width - 1, curgad->y + curgad->_image->_height - 1); - curgad->isEnabled = false; +void EventManager::disableGadget(Gadget *gadget, uint16 penColor) { + _vm->_graphics->overlayRect(penColor, gadget->x, gadget->y, gadget->x + gadget->_image->_width - 1, gadget->y + gadget->_image->_height - 1); + gadget->isEnabled = false; } /** * Undims a gadget, and makes it available again. */ -void enableGadget(Gadget *curgad) { - curgad->_image->drawImage(curgad->x, curgad->y); - curgad->isEnabled = true; +void EventManager::enableGadget(Gadget *gadget) { + gadget->_image->drawImage(gadget->x, gadget->y); + gadget->isEnabled = true; } /** * Make a key press have the right case for a gadget KeyEquiv value. */ -uint16 makeGadgetKeyEquiv(uint16 key) { +uint16 EventManager::makeGadgetKeyEquiv(uint16 key) { if (Common::isAlnum(key)) key = tolower(key); @@ -112,7 +110,7 @@ uint16 makeGadgetKeyEquiv(uint16 key) { * Checks whether or not the coords fall within one of the gadgets in a list * of gadgets. */ -Gadget *LabEngine::checkNumGadgetHit(GadgetList *gadgetList, uint16 key) { +Gadget *EventManager::checkNumGadgetHit(GadgetList *gadgetList, uint16 key) { uint16 gkey = key - '0'; if (!gadgetList) @@ -123,59 +121,59 @@ Gadget *LabEngine::checkNumGadgetHit(GadgetList *gadgetList, uint16 key) { if ((gkey - 1 == gadget->_gadgetID || (gkey == 0 && gadget->_gadgetID == 9) || (gadget->_keyEquiv != 0 && makeGadgetKeyEquiv(key) == gadget->_keyEquiv)) && gadget->isEnabled) { - _event->mouseHide(); + mouseHide(); gadget->_altImage->drawImage(gadget->x, gadget->y); - _event->mouseShow(); + mouseShow(); g_system->delayMillis(80); - _event->mouseHide(); + mouseHide(); gadget->_image->drawImage(gadget->x, gadget->y); - _event->mouseShow(); + mouseShow(); return gadget; } } - return NULL; + return nullptr; } -IntuiMessage IMessage; - IntuiMessage *LabEngine::getMsg() { + static IntuiMessage message; + _event->updateMouse(); - int qualifiers = _keyPressed.flags; + int qualifiers = _event->_keyPressed.flags; Gadget *curgad = _event->mouseGadget(); if (curgad) { _event->updateMouse(); - IMessage._msgClass = GADGETUP; - IMessage._code = curgad->_gadgetID; - IMessage._gadgetID = curgad->_gadgetID; - IMessage._qualifier = qualifiers; - return &IMessage; - } else if (_event->mouseButton(&IMessage._mouseX, &IMessage._mouseY, true)) { + message._msgClass = GADGETUP; + message._code = curgad->_gadgetID; + message._gadgetID = curgad->_gadgetID; + message._qualifier = qualifiers; + return &message; + } else if (_event->mouseButton(&message._mouseX, &message._mouseY, true)) { // Left Button - IMessage._qualifier = IEQUALIFIER_LEFTBUTTON | qualifiers; - IMessage._msgClass = MOUSEBUTTONS; - return &IMessage; - } else if (_event->mouseButton(&IMessage._mouseX, &IMessage._mouseY, false)) { + message._qualifier = IEQUALIFIER_LEFTBUTTON | qualifiers; + message._msgClass = MOUSEBUTTONS; + return &message; + } else if (_event->mouseButton(&message._mouseX, &message._mouseY, false)) { // Right Button - IMessage._qualifier = IEQUALIFIER_RBUTTON | qualifiers; - IMessage._msgClass = MOUSEBUTTONS; - return &IMessage; - } else if (_event->keyPress(&IMessage._code)) { + message._qualifier = IEQUALIFIER_RBUTTON | qualifiers; + message._msgClass = MOUSEBUTTONS; + return &message; + } else if (_event->keyPress(&message._code)) { // Keyboard key - curgad = checkNumGadgetHit(_event->_screenGadgetList, IMessage._code); + curgad = _event->checkNumGadgetHit(_event->_screenGadgetList, message._code); if (curgad) { - IMessage._msgClass = GADGETUP; - IMessage._code = curgad->_gadgetID; - IMessage._gadgetID = curgad->_gadgetID; + message._msgClass = GADGETUP; + message._code = curgad->_gadgetID; + message._gadgetID = curgad->_gadgetID; } else - IMessage._msgClass = RAWKEY; + message._msgClass = RAWKEY; - IMessage._qualifier = qualifiers; - return &IMessage; + message._qualifier = qualifiers; + return &message; } else return nullptr; } diff --git a/engines/lab/interface.h b/engines/lab/interface.h index 10e081532b..c8ac17180f 100644 --- a/engines/lab/interface.h +++ b/engines/lab/interface.h @@ -28,28 +28,11 @@ * */ -#ifndef LAB_INTEFARCE_H -#define LAB_INTEFARCE_H +#ifndef LAB_INTERFARCE_H +#define LAB_INTERFARCE_H namespace Lab { -class Image; - -struct IntuiMessage { - uint32 _msgClass; - uint16 _code, _qualifier, _mouseX, _mouseY, _gadgetID; - uint32 _seconds, _micros; -}; - - -struct Gadget { - uint16 x, y, _gadgetID; - uint16 _keyEquiv; // if not zero, a key that activates gadget - bool isEnabled; - Image *_image, *_altImage; -}; - -typedef Common::List GadgetList; // Defines for the Class variable in IntuiMessage #define SIZEVERIFY 0x00000001 @@ -103,13 +86,7 @@ typedef Common::List GadgetList; //--------------------------- Function Prototypes --------------------------- //--------------------------------------------------------------------------- -Gadget *createButton(uint16 x, uint16 y, uint16 id, uint16 key, Image *im, Image *imalt); -void freeButtonList(GadgetList *gadgetList); -void drawGadgetList(GadgetList *gadgetList); -void disableGadget(Gadget *curgad, uint16 pencolor); -void enableGadget(Gadget *curgad); -IntuiMessage *getMsg(); } // End of namespace Lab -#endif // LAB_INTEFARCE_H +#endif // LAB_INTERFARCE_H diff --git a/engines/lab/intro.cpp b/engines/lab/intro.cpp index fbe1facab8..d918cb99fc 100644 --- a/engines/lab/intro.cpp +++ b/engines/lab/intro.cpp @@ -32,6 +32,7 @@ #include "lab/anim.h" #include "lab/dispman.h" +#include "lab/eventman.h" #include "lab/interface.h" #include "lab/intro.h" #include "lab/music.h" diff --git a/engines/lab/lab.h b/engines/lab/lab.h index 92ffa26591..1b98c11c27 100644 --- a/engines/lab/lab.h +++ b/engines/lab/lab.h @@ -193,7 +193,6 @@ public: private: bool checkConditions(int16 *condition); - Gadget *checkNumGadgetHit(GadgetList *gadgetList, uint16 key); void decIncInv(uint16 *CurInv, bool dec); void doActions(Action *actionList, CloseDataPtr *closePtrList); bool doActionRule(Common::Point pos, int16 action, int16 roomNum, CloseDataPtr *closePtrList); diff --git a/engines/lab/map.cpp b/engines/lab/map.cpp index 5d978b72fe..c76f3cb357 100644 --- a/engines/lab/map.cpp +++ b/engines/lab/map.cpp @@ -79,9 +79,9 @@ void LabEngine::loadMapData() { _imgPath = new Image(mapImages); _imgBridge = new Image(mapImages); - _mapGadgetList.push_back(createButton( 8, _utils->vgaScaleY(105), 0, VKEY_LTARROW, new Image(mapImages), new Image(mapImages))); // back - _mapGadgetList.push_back(createButton( 55, _utils->vgaScaleY(105), 1, VKEY_UPARROW, new Image(mapImages), new Image(mapImages))); // up - _mapGadgetList.push_back(createButton(101, _utils->vgaScaleY(105), 2, VKEY_DNARROW, new Image(mapImages), new Image(mapImages))); // down + _mapGadgetList.push_back(_event->createButton( 8, _utils->vgaScaleY(105), 0, VKEY_LTARROW, new Image(mapImages), new Image(mapImages))); // back + _mapGadgetList.push_back(_event->createButton( 55, _utils->vgaScaleY(105), 1, VKEY_UPARROW, new Image(mapImages), new Image(mapImages))); // up + _mapGadgetList.push_back(_event->createButton(101, _utils->vgaScaleY(105), 2, VKEY_DNARROW, new Image(mapImages), new Image(mapImages))); // down delete mapImages; @@ -104,7 +104,7 @@ void LabEngine::loadMapData() { } void LabEngine::freeMapData() { - freeButtonList(&_mapGadgetList); + _event->freeButtonList(&_mapGadgetList); delete _imgMap; delete _imgRoom; @@ -369,7 +369,7 @@ void LabEngine::drawMap(uint16 curRoom, uint16 curMsg, uint16 floorNum, bool fad _graphics->rectFill(0, 0, _graphics->_screenWidth - 1, _graphics->_screenHeight - 1); _imgMap->drawImage(0, 0); - drawGadgetList(&_mapGadgetList); + _event->drawGadgetList(&_mapGadgetList); for (uint16 i = 1; i <= _maxRooms; i++) { if ((_maps[i]._pageNumber == floorNum) && _roomsFound->in(i) && _maps[i]._x) { @@ -388,14 +388,14 @@ void LabEngine::drawMap(uint16 curRoom, uint16 curMsg, uint16 floorNum, bool fad Gadget *downGadget = _event->getGadget(2); if (getUpperFloor(floorNum) != kFloorNone) - enableGadget(upGadget); + _event->enableGadget(upGadget); else - disableGadget(upGadget, 12); + _event->disableGadget(upGadget, 12); if (getLowerFloor(floorNum) != kFloorNone) - enableGadget(downGadget); + _event->enableGadget(downGadget); else - disableGadget(downGadget, 12); + _event->disableGadget(downGadget, 12); // Labyrinth specific code if (floorNum == kFloorLower) { diff --git a/engines/lab/special.cpp b/engines/lab/special.cpp index 5b2da2a3be..0024adbc80 100644 --- a/engines/lab/special.cpp +++ b/engines/lab/special.cpp @@ -142,9 +142,9 @@ void LabEngine::loadJournalData() { Common::File *journalFile = _resource->openDataFile("P:JImage"); Utils *utils = _utils; - _journalGadgetList.push_back(createButton( 80, utils->vgaScaleY(162) + utils->svgaCord(1), 0, VKEY_LTARROW, new Image(journalFile), new Image(journalFile))); // back - _journalGadgetList.push_back(createButton(194, utils->vgaScaleY(162) + utils->svgaCord(1), 2, 0, new Image(journalFile), new Image(journalFile))); // cancel - _journalGadgetList.push_back(createButton(144, utils->vgaScaleY(164) - utils->svgaCord(1), 1, VKEY_RTARROW, new Image(journalFile), new Image(journalFile))); // forward + _journalGadgetList.push_back(_event->createButton( 80, utils->vgaScaleY(162) + utils->svgaCord(1), 0, VKEY_LTARROW, new Image(journalFile), new Image(journalFile))); // back + _journalGadgetList.push_back(_event->createButton(194, utils->vgaScaleY(162) + utils->svgaCord(1), 2, 0, new Image(journalFile), new Image(journalFile))); // cancel + _journalGadgetList.push_back(_event->createButton(144, utils->vgaScaleY(164) - utils->svgaCord(1), 1, VKEY_RTARROW, new Image(journalFile), new Image(journalFile))); // forward delete journalFile; _anim->_noPalChange = true; @@ -236,14 +236,14 @@ void LabEngine::drawJournal(uint16 wipenum, bool needFade) { Gadget *forwardGadget = _event->getGadget(2); if (_journalPage == 0) - disableGadget(backGadget, 15); + _event->disableGadget(backGadget, 15); else - enableGadget(backGadget); + _event->enableGadget(backGadget); if (_lastPage) - disableGadget(forwardGadget, 15); + _event->disableGadget(forwardGadget, 15); else - enableGadget(forwardGadget); + _event->enableGadget(forwardGadget); if (needFade) _graphics->fade(true, 0); @@ -321,7 +321,7 @@ void LabEngine::doJournal() { delete[] _blankJournal; delete[] journalBackImage._imageData; - freeButtonList(&_journalGadgetList); + _event->freeButtonList(&_journalGadgetList); _graphics->closeFont(_journalFont); ScreenImage._imageData = _graphics->getCurrentDrawingBuffer(); -- cgit v1.2.3 From 7c1401264ca0da173dfe4de09ca4884d63feeb55 Mon Sep 17 00:00:00 2001 From: Strangerke Date: Sun, 13 Dec 2015 14:12:18 +0100 Subject: LAB: Remove interface.h, get rid of a lot of useless defines --- engines/lab/dispman.cpp | 1 - engines/lab/engine.cpp | 5 ++- engines/lab/eventman.cpp | 1 - engines/lab/eventman.h | 15 ++++++++ engines/lab/interface.cpp | 3 +- engines/lab/interface.h | 92 ----------------------------------------------- engines/lab/intro.cpp | 5 ++- engines/lab/map.cpp | 3 +- engines/lab/special.cpp | 5 ++- 9 files changed, 23 insertions(+), 107 deletions(-) delete mode 100644 engines/lab/interface.h diff --git a/engines/lab/dispman.cpp b/engines/lab/dispman.cpp index 0aa49f9904..0c2f56290e 100644 --- a/engines/lab/dispman.cpp +++ b/engines/lab/dispman.cpp @@ -35,7 +35,6 @@ #include "lab/anim.h" #include "lab/dispman.h" #include "lab/eventman.h" -#include "lab/interface.h" #include "lab/music.h" #include "lab/image.h" #include "lab/resource.h" diff --git a/engines/lab/engine.cpp b/engines/lab/engine.cpp index 367f54163f..47d631c95c 100644 --- a/engines/lab/engine.cpp +++ b/engines/lab/engine.cpp @@ -34,7 +34,6 @@ #include "lab/dispman.h" #include "lab/eventman.h" #include "lab/image.h" -#include "lab/interface.h" #include "lab/intro.h" #include "lab/labsets.h" #include "lab/music.h" @@ -687,7 +686,7 @@ bool LabEngine::fromCrumbs(uint32 tmpClass, uint16 code, uint16 qualifier, Commo if (_graphics->_longWinInFront) { if ((msgClass == RAWKEY) || ((msgClass == MOUSEBUTTONS) && ((IEQUALIFIER_LEFTBUTTON & qualifier) || - (IEQUALIFIER_RBUTTON & qualifier)))) { + (IEQUALIFIER_RIGHTBUTTON & qualifier)))) { _graphics->_longWinInFront = false; _graphics->_doNotDrawMessage = false; _graphics->drawPanel(); @@ -1063,7 +1062,7 @@ bool LabEngine::fromCrumbs(uint32 tmpClass, uint16 code, uint16 qualifier, Commo if (wrkClosePtr) _event->setMousePos(Common::Point(_utils->scaleX((wrkClosePtr->_x1 + wrkClosePtr->_x2) / 2), _utils->scaleY((wrkClosePtr->_y1 + wrkClosePtr->_y2) / 2))); - } else if ((msgClass == MOUSEBUTTONS) && (IEQUALIFIER_RBUTTON & qualifier)) { + } else if ((msgClass == MOUSEBUTTONS) && (IEQUALIFIER_RIGHTBUTTON & qualifier)) { eatMessages(); _alternate = !_alternate; _anim->_doBlack = true; diff --git a/engines/lab/eventman.cpp b/engines/lab/eventman.cpp index e44771952a..7b5d184dc9 100644 --- a/engines/lab/eventman.cpp +++ b/engines/lab/eventman.cpp @@ -35,7 +35,6 @@ #include "lab/dispman.h" #include "lab/eventman.h" #include "lab/image.h" -#include "lab/interface.h" namespace Lab { diff --git a/engines/lab/eventman.h b/engines/lab/eventman.h index f9facd815b..3becfeb693 100644 --- a/engines/lab/eventman.h +++ b/engines/lab/eventman.h @@ -38,6 +38,21 @@ namespace Lab { class LabEngine; class Image; +// Defines for the Class variable in IntuiMessage +#define MOUSEBUTTONS 0x00000008 +#define GADGETUP 0x00000040 +#define RAWKEY 0x00000400 +#define DELTAMOVE 0x00100000 + +// Defines for the Qualifier variable in IntuiMessage +#define IEQUALIFIER_RIGHTBUTTON 0x2000 +#define IEQUALIFIER_LEFTBUTTON 0x4000 + +#define VKEY_UPARROW 273 +#define VKEY_DNARROW 274 +#define VKEY_RTARROW 275 +#define VKEY_LTARROW 276 + struct IntuiMessage { uint32 _msgClass; uint16 _code, _qualifier, _mouseX, _mouseY, _gadgetID; diff --git a/engines/lab/interface.cpp b/engines/lab/interface.cpp index b540a31357..08a53e2c63 100644 --- a/engines/lab/interface.cpp +++ b/engines/lab/interface.cpp @@ -35,7 +35,6 @@ #include "lab/dispman.h" #include "lab/eventman.h" #include "lab/image.h" -#include "lab/interface.h" #include "lab/utils.h" namespace Lab { @@ -158,7 +157,7 @@ IntuiMessage *LabEngine::getMsg() { return &message; } else if (_event->mouseButton(&message._mouseX, &message._mouseY, false)) { // Right Button - message._qualifier = IEQUALIFIER_RBUTTON | qualifiers; + message._qualifier = IEQUALIFIER_RIGHTBUTTON | qualifiers; message._msgClass = MOUSEBUTTONS; return &message; } else if (_event->keyPress(&message._code)) { diff --git a/engines/lab/interface.h b/engines/lab/interface.h deleted file mode 100644 index c8ac17180f..0000000000 --- a/engines/lab/interface.h +++ /dev/null @@ -1,92 +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. - * - */ - -/* - * This code is based on Labyrinth of Time code with assistance of - * - * Copyright (c) 1993 Terra Nova Development - * Copyright (c) 2004 The Wyrmkeep Entertainment Co. - * - */ - -#ifndef LAB_INTERFARCE_H -#define LAB_INTERFARCE_H - -namespace Lab { - - -// Defines for the Class variable in IntuiMessage -#define SIZEVERIFY 0x00000001 -#define NEWSIZE 0x00000002 -#define REFRESHWINDOW 0x00000004 -#define MOUSEBUTTONS 0x00000008 -#define MOUSEMOVE 0x00000010 -#define GADGETDOWN 0x00000020 -#define GADGETUP 0x00000040 -#define REQSET 0x00000080 -#define MENUPICK 0x00000100 -#define CLOSEWINDOW 0x00000200 -#define RAWKEY 0x00000400 -#define REQVERIFY 0x00000800 -#define REQCLEAR 0x00001000 -#define MENUVERIFY 0x00002000 -#define NEWPREFS 0x00004000 -#define DISKINSERTED 0x00008000 -#define DISKREMOVED 0x00010000 -#define WBENCHMESSAGE 0x00020000 // System use only -#define ACTIVEWINDOW 0x00040000 -#define INACTIVEWINDOW 0x00080000 -#define DELTAMOVE 0x00100000 -#define VANULLLAKEY 0x00200000 - - -// Defines for the Qualifier variable in IntuiMessage -#define IEQUALIFIER_LSHIFT 0x0001 -#define IEQUALIFIER_RSHIFT 0x0002 -#define IEQUALIFIER_CAPSLOCK 0x0004 -#define IEQUALIFIER_CONTROL 0x0008 -#define IEQUALIFIER_LALT 0x0010 -#define IEQUALIFIER_RALT 0x0020 -#define IEQUALIFIER_LCOMMAND 0x0040 -#define IEQUALIFIER_RCOMMAND 0x0080 -#define IEQUALIFIER_NUMERICPAD 0x0100 -#define IEQUALIFIER_REPEAT 0x0200 -#define IEQUALIFIER_INTERRUPT 0x0400 -#define IEQUALIFIER_MULTIBROADCAST 0x0800 -#define IEQUALIFIER_MIDBUTTON 0x1000 -#define IEQUALIFIER_RBUTTON 0x2000 -#define IEQUALIFIER_LEFTBUTTON 0x4000 - -#define VKEY_UPARROW 273 -#define VKEY_DNARROW 274 -#define VKEY_RTARROW 275 -#define VKEY_LTARROW 276 - - -//--------------------------------------------------------------------------- -//--------------------------- Function Prototypes --------------------------- -//--------------------------------------------------------------------------- - - -} // End of namespace Lab - -#endif // LAB_INTERFARCE_H diff --git a/engines/lab/intro.cpp b/engines/lab/intro.cpp index d918cb99fc..5b170f54a9 100644 --- a/engines/lab/intro.cpp +++ b/engines/lab/intro.cpp @@ -33,7 +33,6 @@ #include "lab/anim.h" #include "lab/dispman.h" #include "lab/eventman.h" -#include "lab/interface.h" #include "lab/intro.h" #include "lab/music.h" #include "lab/resource.h" @@ -61,7 +60,7 @@ void Intro::introEatMessages() { if (msg == NULL) return; else { - if (((msg->_msgClass == MOUSEBUTTONS) && (IEQUALIFIER_RBUTTON & msg->_qualifier)) || + if (((msg->_msgClass == MOUSEBUTTONS) && (IEQUALIFIER_RIGHTBUTTON & msg->_qualifier)) || ((msg->_msgClass == RAWKEY) && (msg->_code == 27)) ) _quitIntro = true; @@ -156,7 +155,7 @@ void Intro::doPictText(const char *filename, TextFont *msgFont, bool isScreen) { qualifier = msg->_qualifier; code = msg->_code; - if (((cls == MOUSEBUTTONS) && (IEQUALIFIER_RBUTTON & qualifier)) || + if (((cls == MOUSEBUTTONS) && (IEQUALIFIER_RIGHTBUTTON & qualifier)) || ((cls == RAWKEY) && (code == 27))) { _quitIntro = true; diff --git a/engines/lab/map.cpp b/engines/lab/map.cpp index c76f3cb357..d0dce93388 100644 --- a/engines/lab/map.cpp +++ b/engines/lab/map.cpp @@ -33,7 +33,6 @@ #include "lab/dispman.h" #include "lab/eventman.h" #include "lab/image.h" -#include "lab/interface.h" #include "lab/labsets.h" #include "lab/music.h" #include "lab/processroom.h" @@ -480,7 +479,7 @@ void LabEngine::processMap(uint16 curRoom) { uint16 mouseX = msg->_mouseX; uint16 mouseY = msg->_mouseY; - if (((msgClass == MOUSEBUTTONS) && (IEQUALIFIER_RBUTTON & qualifier)) || ((msgClass == RAWKEY) && (msgCode == 27))) + if (((msgClass == MOUSEBUTTONS) && (IEQUALIFIER_RIGHTBUTTON & qualifier)) || ((msgClass == RAWKEY) && (msgCode == 27))) return; if (msgClass == GADGETUP) { diff --git a/engines/lab/special.cpp b/engines/lab/special.cpp index 0024adbc80..b68963706f 100644 --- a/engines/lab/special.cpp +++ b/engines/lab/special.cpp @@ -34,7 +34,6 @@ #include "lab/dispman.h" #include "lab/eventman.h" #include "lab/image.h" -#include "lab/interface.h" #include "lab/labsets.h" #include "lab/music.h" #include "lab/processroom.h" @@ -271,7 +270,7 @@ void LabEngine::processJournal() { uint16 qualifier = msg->_qualifier; uint16 gadID = msg->_code; - if (((msgClass == MOUSEBUTTONS) && (IEQUALIFIER_RBUTTON & qualifier)) || + if (((msgClass == MOUSEBUTTONS) && (IEQUALIFIER_RIGHTBUTTON & qualifier)) || ((msgClass == RAWKEY) && (gadID == 27))) return; else if (msgClass == GADGETUP) { @@ -436,7 +435,7 @@ void LabEngine::processMonitor(char *ntext, TextFont *monitorFont, bool isIntera uint16 mouseY = msg->_mouseY; uint16 code = msg->_code; - if (((msgClass == MOUSEBUTTONS) && (IEQUALIFIER_RBUTTON & qualifier)) || + if (((msgClass == MOUSEBUTTONS) && (IEQUALIFIER_RIGHTBUTTON & qualifier)) || ((msgClass == RAWKEY) && (code == 27))) return; -- cgit v1.2.3 From 577b60d7853156851894430ad8032ed14b353e33 Mon Sep 17 00:00:00 2001 From: Filippos Karapetis Date: Sun, 13 Dec 2015 15:37:39 +0200 Subject: LAB: Move getMsg to the event manager --- engines/lab/engine.cpp | 6 +++--- engines/lab/interface.cpp | 18 +++++++++--------- engines/lab/intro.cpp | 4 ++-- engines/lab/lab.h | 1 - engines/lab/map.cpp | 2 +- engines/lab/special.cpp | 4 ++-- 6 files changed, 17 insertions(+), 18 deletions(-) diff --git a/engines/lab/engine.cpp b/engines/lab/engine.cpp index 47d631c95c..bd625be346 100644 --- a/engines/lab/engine.cpp +++ b/engines/lab/engine.cpp @@ -163,7 +163,7 @@ void LabEngine::eatMessages() { IntuiMessage *msg; do { - msg = getMsg(); + msg = _event->getMsg(); } while (msg); } @@ -503,7 +503,7 @@ void LabEngine::mainGameLoop() { // Make sure we check the music at least after every message _music->updateMusic(); interfaceOn(); - IntuiMessage *curMsg = getMsg(); + IntuiMessage *curMsg = _event->getMsg(); if (!curMsg) { // Does music load and next animation frame when you've run out of messages @@ -645,7 +645,7 @@ bool LabEngine::fromCrumbs(uint32 tmpClass, uint16 code, uint16 qualifier, Commo while (1) { // Make sure we check the music at least after every message _music->updateMusic(); - curMsg = getMsg(); + curMsg = _event->getMsg(); if (!curMsg) { // Does music load and next animation frame when you've run out of messages diff --git a/engines/lab/interface.cpp b/engines/lab/interface.cpp index 08a53e2c63..cd062a8ea3 100644 --- a/engines/lab/interface.cpp +++ b/engines/lab/interface.cpp @@ -135,34 +135,34 @@ Gadget *EventManager::checkNumGadgetHit(GadgetList *gadgetList, uint16 key) { return nullptr; } -IntuiMessage *LabEngine::getMsg() { +IntuiMessage *EventManager::getMsg() { static IntuiMessage message; - _event->updateMouse(); + updateMouse(); - int qualifiers = _event->_keyPressed.flags; - Gadget *curgad = _event->mouseGadget(); + int qualifiers = _keyPressed.flags; + Gadget *curgad = mouseGadget(); if (curgad) { - _event->updateMouse(); + updateMouse(); message._msgClass = GADGETUP; message._code = curgad->_gadgetID; message._gadgetID = curgad->_gadgetID; message._qualifier = qualifiers; return &message; - } else if (_event->mouseButton(&message._mouseX, &message._mouseY, true)) { + } else if (mouseButton(&message._mouseX, &message._mouseY, true)) { // Left Button message._qualifier = IEQUALIFIER_LEFTBUTTON | qualifiers; message._msgClass = MOUSEBUTTONS; return &message; - } else if (_event->mouseButton(&message._mouseX, &message._mouseY, false)) { + } else if (mouseButton(&message._mouseX, &message._mouseY, false)) { // Right Button message._qualifier = IEQUALIFIER_RIGHTBUTTON | qualifiers; message._msgClass = MOUSEBUTTONS; return &message; - } else if (_event->keyPress(&message._code)) { + } else if (keyPress(&message._code)) { // Keyboard key - curgad = _event->checkNumGadgetHit(_event->_screenGadgetList, message._code); + curgad = checkNumGadgetHit(_screenGadgetList, message._code); if (curgad) { message._msgClass = GADGETUP; diff --git a/engines/lab/intro.cpp b/engines/lab/intro.cpp index 5b170f54a9..2e88132da8 100644 --- a/engines/lab/intro.cpp +++ b/engines/lab/intro.cpp @@ -50,7 +50,7 @@ Intro::Intro(LabEngine *vm) : _vm(vm) { */ void Intro::introEatMessages() { while (1) { - IntuiMessage *msg = _vm->getMsg(); + IntuiMessage *msg = _vm->_event->getMsg(); if (g_engine->shouldQuit()) { _quitIntro = true; @@ -129,7 +129,7 @@ void Intro::doPictText(const char *filename, TextFont *msgFont, bool isScreen) { lastMillis = g_system->getMillis(); } - msg = _vm->getMsg(); + msg = _vm->_event->getMsg(); if (msg == NULL) { _vm->_music->updateMusic(); diff --git a/engines/lab/lab.h b/engines/lab/lab.h index 1b98c11c27..eb8db5cbb2 100644 --- a/engines/lab/lab.h +++ b/engines/lab/lab.h @@ -184,7 +184,6 @@ public: void changeVolume(int delta); uint16 getDirection() { return _direction; } - IntuiMessage *getMsg(); char *getPictName(CloseDataPtr *closePtrList); uint16 getQuarters(); void setDirection(uint16 direction) { _direction = direction; }; diff --git a/engines/lab/map.cpp b/engines/lab/map.cpp index d0dce93388..316334f70e 100644 --- a/engines/lab/map.cpp +++ b/engines/lab/map.cpp @@ -439,7 +439,7 @@ void LabEngine::processMap(uint16 curRoom) { while (1) { // Make sure we check the music at least after every message _music->updateMusic(); - IntuiMessage *msg = getMsg(); + IntuiMessage *msg = _event->getMsg(); if (!msg) { _music->updateMusic(); diff --git a/engines/lab/special.cpp b/engines/lab/special.cpp index b68963706f..1fc5c67efd 100644 --- a/engines/lab/special.cpp +++ b/engines/lab/special.cpp @@ -261,7 +261,7 @@ void LabEngine::processJournal() { while (1) { // Make sure we check the music at least after every message _music->updateMusic(); - IntuiMessage *msg = getMsg(); + IntuiMessage *msg = _event->getMsg(); if (msg == NULL) { _music->updateMusic(); @@ -424,7 +424,7 @@ void LabEngine::processMonitor(char *ntext, TextFont *monitorFont, bool isIntera // Make sure we check the music at least after every message _music->updateMusic(); - IntuiMessage *msg = getMsg(); + IntuiMessage *msg = _event->getMsg(); if (msg == NULL) { _music->updateMusic(); -- cgit v1.2.3 From 0dcfd74b840c6bdeb3b5dbd431a1354d9c1f47ce Mon Sep 17 00:00:00 2001 From: Filippos Karapetis Date: Sun, 13 Dec 2015 16:59:52 +0200 Subject: LAB: Simplify fromCrumbs() --- engines/lab/engine.cpp | 27 ++++++++++++--------------- 1 file changed, 12 insertions(+), 15 deletions(-) diff --git a/engines/lab/engine.cpp b/engines/lab/engine.cpp index bd625be346..748b0ef501 100644 --- a/engines/lab/engine.cpp +++ b/engines/lab/engine.cpp @@ -588,24 +588,26 @@ bool LabEngine::fromCrumbs(uint32 tmpClass, uint16 code, uint16 qualifier, Commo _anim->_doBlack = false; if ((msgClass == RAWKEY) && (!_graphics->_longWinInFront)) { + byte codeLower = tolower(code); + if (code == 13) { // The return key msgClass = MOUSEBUTTONS; qualifier = IEQUALIFIER_LEFTBUTTON; curPos = _event->getMousePos(); - } else if (getPlatform() == Common::kPlatformWindows && (code == 'b' || code == 'B')) { + } else if (getPlatform() == Common::kPlatformWindows && codeLower == 'b') { // Start bread crumbs _breadCrumbs[0]._roomNum = 0; _numCrumbs = 0; _droppingCrumbs = true; mayShowCrumbIndicator(); _graphics->screenUpdate(); - } else if (code == 'f' || code == 'F' || code == 'r' || code == 'R') { + } else if (codeLower == 'f' || codeLower == 'r') { // Follow bread crumbs if (_droppingCrumbs) { if (_numCrumbs > 0) { _followingCrumbs = true; - _followCrumbsFast = (code == 'r' || code == 'R'); + _followCrumbsFast = (codeLower == 'r'); _isCrumbTurning = false; _isCrumbWaiting = false; uint32 t = g_system->getMillis(); @@ -634,11 +636,10 @@ bool LabEngine::fromCrumbs(uint32 tmpClass, uint16 code, uint16 qualifier, Commo _graphics->screenUpdate(); } } - } else if ((code == 315) || (code == 'x') || (code == 'X') || (code == 'q') || (code == 'Q')) { + } else if (code == 315 || codeLower == 'x' || codeLower == 'q') { // Quit? _graphics->_doNotDrawMessage = false; _graphics->drawMessage("Do you want to quit? (Y/N)"); - doit = false; eatMessages(); interfaceOff(); @@ -653,9 +654,10 @@ bool LabEngine::fromCrumbs(uint32 tmpClass, uint16 code, uint16 qualifier, Commo _anim->diffNextFrame(); } else { if (curMsg->_msgClass == RAWKEY) { - if ((curMsg->_code == 'Y') || (curMsg->_code == 'y') || (curMsg->_code == 'Q') || (curMsg->_code == 'q')) { - doit = true; - break; + codeLower = tolower(curMsg->_code); + if (codeLower == 'y' || codeLower == 'q') { + _anim->stopDiff(); + return false; } else if (curMsg->_code < 128) { break; } @@ -665,13 +667,8 @@ bool LabEngine::fromCrumbs(uint32 tmpClass, uint16 code, uint16 qualifier, Commo } } - if (doit) { - _anim->stopDiff(); - return false; - } else { - forceDraw = true; - interfaceOn(); - } + forceDraw = true; + interfaceOn(); } else if (code == 9) { // TAB key msgClass = DELTAMOVE; -- cgit v1.2.3 From ff43ec7e868b0b707ee5584bc004c593c3bd70ef Mon Sep 17 00:00:00 2001 From: Filippos Karapetis Date: Sun, 13 Dec 2015 17:00:47 +0200 Subject: LAB: Now that timing works correctly, disable some annoying delays --- engines/lab/anim.cpp | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/engines/lab/anim.cpp b/engines/lab/anim.cpp index 347841d8d1..ae4fb80df2 100644 --- a/engines/lab/anim.cpp +++ b/engines/lab/anim.cpp @@ -314,9 +314,14 @@ void Anim::readDiff(byte *buffer, bool playOnce, bool onlyDiffData) { _diffFile += 2; _headerdata._height = READ_LE_UINT16(_diffFile); _diffFile += 2; - _headerdata._depth = _diffFile[0]; + _headerdata._depth = *_diffFile; _diffFile++; - _headerdata._fps = _diffFile[0]; + _headerdata._fps = *_diffFile; + // HACK: The original game defines a 1 second delay when changing screens, which is + // very annoying. In this case, we just set it to no delay, to make the game a bit + // less frustrating + if (_headerdata._fps == 1) + _headerdata._fps = 0; _diffFile++; _headerdata._bufferSize = READ_LE_UINT32(_diffFile); _diffFile += 4; -- cgit v1.2.3 From ceb5ef18e5490d07c40adb5797f026de05036387 Mon Sep 17 00:00:00 2001 From: Filippos Karapetis Date: Sun, 13 Dec 2015 17:46:39 +0200 Subject: LAB: Get rid of a superfluous global variable --- engines/lab/anim.cpp | 7 ++++--- engines/lab/anim.h | 1 - 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/engines/lab/anim.cpp b/engines/lab/anim.cpp index ae4fb80df2..6762a42357 100644 --- a/engines/lab/anim.cpp +++ b/engines/lab/anim.cpp @@ -55,7 +55,6 @@ Anim::Anim(LabEngine *vm) : _vm(vm) { _donePal = false; _frameNum = 0; _playOnce = false; - _buffer = nullptr; _diffFile = nullptr; _size = 0; _rawDiffBM._bytesPerRow = 0; @@ -76,6 +75,8 @@ Anim::Anim(LabEngine *vm) : _vm(vm) { } void Anim::diffNextFrame(bool onlyDiffData) { + byte *buffer = _diffFile; + if (_header == 65535) // Already done. return; @@ -119,7 +120,7 @@ void Anim::diffNextFrame(bool onlyDiffData) { _frameNum++; if ((_frameNum == 1) && (_continuous || (!_playOnce))) - _buffer = _diffFile; + buffer = _diffFile; _isAnim = (_frameNum >= 3) && (!_playOnce); _curBit = 0; @@ -235,7 +236,7 @@ void Anim::diffNextFrame(bool onlyDiffData) { // Random frame number so it never gets back to 2 _frameNum = 4; - _diffFile = _buffer; + _diffFile = buffer; break; default: diff --git a/engines/lab/anim.h b/engines/lab/anim.h index 6c18224932..e2d79fa430 100644 --- a/engines/lab/anim.h +++ b/engines/lab/anim.h @@ -69,7 +69,6 @@ private: bool _donePal; uint16 _frameNum; bool _playOnce; - byte *_buffer; byte *_diffFile; uint32 _size; bool _stopPlayingEnd; -- cgit v1.2.3 From 40b16afcab183189c32ee697e6e027e734d72542 Mon Sep 17 00:00:00 2001 From: Filippos Karapetis Date: Sun, 13 Dec 2015 17:47:16 +0200 Subject: LAB: Get rid of _unstoppableSoundEffect _loopSoundEffect is used for the exact same purpose --- engines/lab/dispman.cpp | 2 +- engines/lab/map.cpp | 2 +- engines/lab/music.cpp | 3 +-- engines/lab/music.h | 1 - engines/lab/processroom.cpp | 3 --- 5 files changed, 3 insertions(+), 8 deletions(-) diff --git a/engines/lab/dispman.cpp b/engines/lab/dispman.cpp index 0c2f56290e..d5ae0f48b5 100644 --- a/engines/lab/dispman.cpp +++ b/engines/lab/dispman.cpp @@ -102,7 +102,7 @@ void DisplayMan::readPict(const char *filename, bool playOnce, bool onlyDiffData _vm->_music->updateMusic(); - if (!_vm->_music->_unstoppableSoundEffect) + if (!_vm->_music->_loopSoundEffect) _vm->_music->stopSoundEffect(); _dispBitMap->_bytesPerRow = _screenWidth; diff --git a/engines/lab/map.cpp b/engines/lab/map.cpp index 316334f70e..179bba5581 100644 --- a/engines/lab/map.cpp +++ b/engines/lab/map.cpp @@ -86,7 +86,7 @@ void LabEngine::loadMapData() { Common::File *mapFile = _resource->openDataFile("Lab:Maps", MKTAG('M', 'A', 'P', '0')); _music->updateMusic(); - if (!_music->_unstoppableSoundEffect) + if (!_music->_loopSoundEffect) _music->stopSoundEffect(); _maxRooms = mapFile->readUint16LE(); diff --git a/engines/lab/music.cpp b/engines/lab/music.cpp index cca7633e67..1d2527b50e 100644 --- a/engines/lab/music.cpp +++ b/engines/lab/music.cpp @@ -59,7 +59,6 @@ Music::Music(LabEngine *vm) : _vm(vm) { _winMusic = false; _loopSoundEffect = false; _queuingAudioStream = NULL; - _unstoppableSoundEffect = false; _lastMusicRoom = 1; _doReset = true; _waitTillFinished = false; @@ -320,7 +319,7 @@ void Music::resetMusic() { bool Music::readMusic(const char *filename, bool waitTillFinished) { Common::File *file = _vm->_resource->openDataFile(filename, MKTAG('D', 'I', 'F', 'F')); updateMusic(); - if (!_unstoppableSoundEffect) + if (!_loopSoundEffect) stopSoundEffect(); if (!file) diff --git a/engines/lab/music.h b/engines/lab/music.h index 02c68209eb..35fd583ef4 100644 --- a/engines/lab/music.h +++ b/engines/lab/music.h @@ -75,7 +75,6 @@ private: void startMusic(bool restartFl); public: - bool _unstoppableSoundEffect; bool _loopSoundEffect; bool _waitTillFinished; diff --git a/engines/lab/processroom.cpp b/engines/lab/processroom.cpp index c09d918fcb..6000f4abf8 100644 --- a/engines/lab/processroom.cpp +++ b/engines/lab/processroom.cpp @@ -296,7 +296,6 @@ void LabEngine::doActions(Action *actionList, CloseDataPtr *closePtrList) { break; case PLAYSOUNDCONT: - _music->_unstoppableSoundEffect = true; _music->_loopSoundEffect = true; _music->readMusic((char *)actionList->_data, _music->_waitTillFinished); break; @@ -543,8 +542,6 @@ void LabEngine::doActions(Action *actionList, CloseDataPtr *closePtrList) { waitTOF(); } } - - _music->_unstoppableSoundEffect = false; } /** -- cgit v1.2.3 From dffaffdd096d9ee7457a8b3b8f1db78af1b0cff5 Mon Sep 17 00:00:00 2001 From: Filippos Karapetis Date: Sun, 13 Dec 2015 18:41:53 +0200 Subject: LAB: Simplify calls to initMusic() --- engines/lab/intro.cpp | 2 +- engines/lab/music.cpp | 11 +---------- engines/lab/music.h | 4 +--- engines/lab/processroom.cpp | 3 +-- 4 files changed, 4 insertions(+), 16 deletions(-) diff --git a/engines/lab/intro.cpp b/engines/lab/intro.cpp index 2e88132da8..7c77e8a18b 100644 --- a/engines/lab/intro.cpp +++ b/engines/lab/intro.cpp @@ -262,7 +262,7 @@ void Intro::introSequence() { } _vm->_graphics->blackAllScreen(); - _vm->_music->initMusic(); + _vm->_music->initMusic("Music:BackGrou"); _vm->_anim->_noPalChange = true; if (_vm->getPlatform() != Common::kPlatformWindows) diff --git a/engines/lab/music.cpp b/engines/lab/music.cpp index 1d2527b50e..b9a3f10873 100644 --- a/engines/lab/music.cpp +++ b/engines/lab/music.cpp @@ -56,7 +56,6 @@ Music::Music(LabEngine *vm) : _vm(vm) { _leftInFile = 0; _musicOn = false; - _winMusic = false; _loopSoundEffect = false; _queuingAudioStream = NULL; _lastMusicRoom = 1; @@ -166,17 +165,9 @@ void Music::startMusic(bool restartFl) { /** * Initializes the music buffers. */ -bool Music::initMusic() { +bool Music::initMusic(const char *filename) { _musicOn = true; _musicPaused = false; - - const char *filename; - - if (_winMusic) - filename = "Music:WinGame"; - else - filename = "Music:BackGrou"; - _file = _vm->_resource->openDataFile(filename); startMusic(true); return true; diff --git a/engines/lab/music.h b/engines/lab/music.h index 35fd583ef4..d5dd241d6e 100644 --- a/engines/lab/music.h +++ b/engines/lab/music.h @@ -56,7 +56,6 @@ private: bool _musicOn; bool _musicPaused; bool _oldMusicOn; - bool _winMusic; uint16 _lastMusicRoom ; @@ -84,7 +83,7 @@ public: void changeMusic(const char *newmusic); void checkRoomMusic(); void freeMusic(); - bool initMusic(); + bool initMusic(const char *filename); bool isSoundEffectActive() const; void playSoundEffect(uint16 sampleSpeed, uint32 length, void *data); bool readMusic(const char *filename, bool waitTillFinished); @@ -92,7 +91,6 @@ public: void resumeBackMusic(); void setMusic(bool on); void setMusicReset(bool reset) { _doReset = reset; } - void setWinMusic() { _winMusic = true; } void stopSoundEffect(); void updateMusic(); }; diff --git a/engines/lab/processroom.cpp b/engines/lab/processroom.cpp index 6000f4abf8..bdf1d96b45 100644 --- a/engines/lab/processroom.cpp +++ b/engines/lab/processroom.cpp @@ -475,9 +475,8 @@ void LabEngine::doActions(Action *actionList, CloseDataPtr *closePtrList) { break; case WINMUSIC: - _music->setWinMusic(); _music->freeMusic(); - _music->initMusic(); + _music->initMusic("Music:WinGame"); break; case WINGAME: -- cgit v1.2.3 From 231dda2ba989fb2993d3c82f1dd79be34bba436f Mon Sep 17 00:00:00 2001 From: Filippos Karapetis Date: Sun, 13 Dec 2015 19:27:07 +0200 Subject: LAB: Fix regression in animation code in looping animations This fixes Daedalus' flight animation in the ending cutscene --- engines/lab/anim.cpp | 9 ++++----- engines/lab/anim.h | 1 + 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/engines/lab/anim.cpp b/engines/lab/anim.cpp index 6762a42357..842d3d6432 100644 --- a/engines/lab/anim.cpp +++ b/engines/lab/anim.cpp @@ -56,6 +56,7 @@ Anim::Anim(LabEngine *vm) : _vm(vm) { _frameNum = 0; _playOnce = false; _diffFile = nullptr; + _diffFileStart = nullptr; _size = 0; _rawDiffBM._bytesPerRow = 0; _rawDiffBM._drawOnScreen = false; @@ -75,8 +76,6 @@ Anim::Anim(LabEngine *vm) : _vm(vm) { } void Anim::diffNextFrame(bool onlyDiffData) { - byte *buffer = _diffFile; - if (_header == 65535) // Already done. return; @@ -120,7 +119,7 @@ void Anim::diffNextFrame(bool onlyDiffData) { _frameNum++; if ((_frameNum == 1) && (_continuous || (!_playOnce))) - buffer = _diffFile; + _diffFileStart = _diffFile; _isAnim = (_frameNum >= 3) && (!_playOnce); _curBit = 0; @@ -236,7 +235,7 @@ void Anim::diffNextFrame(bool onlyDiffData) { // Random frame number so it never gets back to 2 _frameNum = 4; - _diffFile = buffer; + _diffFile = _diffFileStart; break; default: @@ -287,7 +286,7 @@ void Anim::readDiff(byte *buffer, bool playOnce, bool onlyDiffData) { _vm->_graphics->blackScreen(); } - _diffFile = buffer; + _diffFile = _diffFileStart = buffer; _continuous = false; uint32 signature = READ_BE_UINT32(_diffFile); diff --git a/engines/lab/anim.h b/engines/lab/anim.h index e2d79fa430..6e568a40a3 100644 --- a/engines/lab/anim.h +++ b/engines/lab/anim.h @@ -70,6 +70,7 @@ private: uint16 _frameNum; bool _playOnce; byte *_diffFile; + byte *_diffFileStart; uint32 _size; bool _stopPlayingEnd; uint16 _sampleSpeed; -- cgit v1.2.3 From c883769adc7ca1dcf5c2157a6ea09238ead59a56 Mon Sep 17 00:00:00 2001 From: Filippos Karapetis Date: Sun, 13 Dec 2015 19:27:34 +0200 Subject: LAB: Move the LAB2 teaser screen in a separate function --- engines/lab/engine.cpp | 41 ++++++++++++++++++++--------------------- engines/lab/lab.h | 1 + engines/lab/processroom.cpp | 4 +++- 3 files changed, 24 insertions(+), 22 deletions(-) diff --git a/engines/lab/engine.cpp b/engines/lab/engine.cpp index 748b0ef501..9ae7beb29a 100644 --- a/engines/lab/engine.cpp +++ b/engines/lab/engine.cpp @@ -575,6 +575,26 @@ void LabEngine::mainGameLoop() { } } +void LabEngine::showLab2Teaser() { + _graphics->blackAllScreen(); + _graphics->readPict("P:End/L2In.1", true); + + for (uint16 i = 0; i < 120; i++) { + _music->updateMusic(); + waitTOF(); + } + + _graphics->readPict("P:End/L2In.9", true); + _graphics->readPict("P:End/Lost", true); + + warning("STUB: waitForPress"); + while (!1) { // 1 means ignore SDL_ProcessInput calls + _music->updateMusic(); + _anim->diffNextFrame(); + waitTOF(); + } +} + bool LabEngine::fromCrumbs(uint32 tmpClass, uint16 code, uint16 qualifier, Common::Point tmpPos, uint16 &curInv, IntuiMessage *curMsg, bool &forceDraw, uint16 gadgetId, uint16 &actionMode) { uint32 msgClass = tmpClass; @@ -1099,27 +1119,6 @@ void LabEngine::go() { _event->mouseShow(); mainGameLoop(); - if (_quitLab) { - // Won the game - _graphics->blackAllScreen(); - _graphics->readPict("P:End/L2In.1", true); - - for (uint16 i = 0; i < 120; i++) { - _music->updateMusic(); - waitTOF(); - } - - _graphics->readPict("P:End/L2In.9", true); - _graphics->readPict("P:End/Lost", true); - - warning("STUB: waitForPress"); - while (!1) { // 1 means ignore SDL_ProcessInput calls - _music->updateMusic(); - _anim->diffNextFrame(); - waitTOF(); - } - } - _graphics->closeFont(_msgFont); _graphics->freePict(); diff --git a/engines/lab/lab.h b/engines/lab/lab.h index eb8db5cbb2..7c438c4a6e 100644 --- a/engines/lab/lab.h +++ b/engines/lab/lab.h @@ -234,6 +234,7 @@ private: void loadJournalData(); void loadMapData(); void mainGameLoop(); + void showLab2Teaser(); void mayShowCrumbIndicator(); void mayShowCrumbIndicatorOff(); void perFlipGadget(uint16 gadID); diff --git a/engines/lab/processroom.cpp b/engines/lab/processroom.cpp index bdf1d96b45..7b9e4132c9 100644 --- a/engines/lab/processroom.cpp +++ b/engines/lab/processroom.cpp @@ -481,10 +481,12 @@ void LabEngine::doActions(Action *actionList, CloseDataPtr *closePtrList) { case WINGAME: _quitLab = true; + showLab2Teaser(); break; case LOSTGAME: - _quitLab = true; + // This seems to be unused? + error("Unused opcode LOSTGAME has been called"); break; case RESETBUFFER: -- cgit v1.2.3 From 1524e20ef1f55d4af9ded4e599d3dda26f93e0b7 Mon Sep 17 00:00:00 2001 From: Filippos Karapetis Date: Sun, 13 Dec 2015 19:31:40 +0200 Subject: LAB: Simplify the room doors array --- engines/lab/processroom.cpp | 12 +----------- engines/lab/processroom.h | 5 +---- engines/lab/resource.cpp | 8 ++++---- 3 files changed, 6 insertions(+), 19 deletions(-) diff --git a/engines/lab/processroom.cpp b/engines/lab/processroom.cpp index 7b9e4132c9..c754d288b7 100644 --- a/engines/lab/processroom.cpp +++ b/engines/lab/processroom.cpp @@ -180,17 +180,7 @@ void LabEngine::drawDirection(CloseDataPtr closePtr) { */ uint16 LabEngine::processArrow(uint16 curDirection, uint16 arrow) { if (arrow == 1) { // Forward - uint16 room = 1; - - if (curDirection == NORTH) - room = _rooms[_roomNum]._northDoor; - else if (curDirection == SOUTH) - room = _rooms[_roomNum]._southDoor; - else if (curDirection == EAST) - room = _rooms[_roomNum]._eastDoor; - else if (curDirection == WEST) - room = _rooms[_roomNum]._westDoor; - + uint16 room = _rooms[_roomNum]._doors[curDirection]; if (room != 0) _roomNum = room; diff --git a/engines/lab/processroom.h b/engines/lab/processroom.h index 97c7cdce4f..1d3316ed7e 100644 --- a/engines/lab/processroom.h +++ b/engines/lab/processroom.h @@ -127,10 +127,7 @@ struct Rule { }; struct RoomData { - uint16 _northDoor; - uint16 _southDoor; - uint16 _eastDoor; - uint16 _westDoor; + uint16 _doors[4]; byte _transitionType; ViewData *_view[4]; RuleList *_rules; diff --git a/engines/lab/resource.cpp b/engines/lab/resource.cpp index 3f615c7a7a..cb29bc6407 100644 --- a/engines/lab/resource.cpp +++ b/engines/lab/resource.cpp @@ -98,10 +98,10 @@ bool Resource::readRoomData(const char *fileName) { memset(_vm->_rooms, 0, (_vm->_manyRooms + 1) * sizeof(RoomData)); for (uint16 i = 1; i <= _vm->_manyRooms; i++) { - _vm->_rooms[i]._northDoor = dataFile->readUint16LE(); - _vm->_rooms[i]._southDoor = dataFile->readUint16LE(); - _vm->_rooms[i]._eastDoor = dataFile->readUint16LE(); - _vm->_rooms[i]._westDoor = dataFile->readUint16LE(); + _vm->_rooms[i]._doors[NORTH] = dataFile->readUint16LE(); + _vm->_rooms[i]._doors[SOUTH] = dataFile->readUint16LE(); + _vm->_rooms[i]._doors[EAST] = dataFile->readUint16LE(); + _vm->_rooms[i]._doors[WEST] = dataFile->readUint16LE(); _vm->_rooms[i]._transitionType = dataFile->readByte(); _vm->_rooms[i]._view[NORTH] = nullptr; -- cgit v1.2.3 From 2332fb617c0c26da563cb60625b24d824ad4630b Mon Sep 17 00:00:00 2001 From: Filippos Karapetis Date: Sun, 13 Dec 2015 19:36:56 +0200 Subject: LAB: Rename gadget to button --- engines/lab/dispman.cpp | 50 ++++++++++---------- engines/lab/engine.cpp | 106 ++++++++++++++++++++--------------------- engines/lab/eventman.cpp | 68 +++++++++++++-------------- engines/lab/eventman.h | 40 ++++++++-------- engines/lab/interface.cpp | 112 ++++++++++++++++++++++---------------------- engines/lab/lab.cpp | 2 +- engines/lab/lab.h | 18 +++---- engines/lab/map.cpp | 36 +++++++------- engines/lab/processroom.cpp | 2 +- engines/lab/special.cpp | 38 +++++++-------- 10 files changed, 236 insertions(+), 236 deletions(-) diff --git a/engines/lab/dispman.cpp b/engines/lab/dispman.cpp index d5ae0f48b5..736b7ea043 100644 --- a/engines/lab/dispman.cpp +++ b/engines/lab/dispman.cpp @@ -312,7 +312,7 @@ int32 DisplayMan::longDrawMessage(const char *str) { if (str == NULL) return 0; - _vm->_event->attachGadgetList(NULL); + _vm->_event->attachButtonList(NULL); _vm->_event->mouseHide(); strcpy(newText, str); @@ -373,7 +373,7 @@ void DisplayMan::drawPanel() { // Second Line setAPen(5); drawHLine(0, _vm->_utils->vgaScaleY(149) + 1 + _vm->_utils->svgaCord(2), _vm->_utils->vgaScaleX(319)); - // Gadget Separators + // Button Separators setAPen(0); // First black line to separate buttons drawHLine(0, _vm->_utils->vgaScaleY(170), _vm->_utils->vgaScaleX(319)); @@ -382,7 +382,7 @@ void DisplayMan::drawPanel() { setAPen(4); // The horizontal lines under the black one drawHLine(0, _vm->_utils->vgaScaleY(170) + 1, _vm->_utils->vgaScaleX(319)); - _vm->_event->drawGadgetList(&_vm->_moveGadgetList); + _vm->_event->drawButtonList(&_vm->_moveButtonList); } else { if (_vm->getPlatform() != Common::kPlatformWindows) { // Vertical Black lines @@ -412,7 +412,7 @@ void DisplayMan::drawPanel() { drawVLine(_vm->_utils->vgaScaleX(232), _vm->_utils->vgaScaleY(170) + 2, _vm->_utils->vgaScaleY(198)); } - _vm->_event->drawGadgetList(&_vm->_invGadgetList); + _vm->_event->drawButtonList(&_vm->_invButtonList); } _vm->_event->mouseShow(); @@ -429,22 +429,22 @@ void DisplayMan::setUpScreens() { _vm->_moveImages[i] = new Image(controlFile); delete controlFile; - // Creates the gadgets for the movement control panel + // Creates the buttons for the movement control panel uint16 y = _vm->_utils->vgaScaleY(173) - _vm->_utils->svgaCord(2); // The key mapping was only set for the Windows version. // It's very convenient to have those shortcut, so I added them // for all versions. (Strangerke) - _vm->_moveGadgetList.push_back(_vm->_event->createButton( 1, y, 0, 't', _vm->_moveImages[0], _vm->_moveImages[1])); - _vm->_moveGadgetList.push_back(_vm->_event->createButton( 33, y, 1, 'm', _vm->_moveImages[2], _vm->_moveImages[3])); - _vm->_moveGadgetList.push_back(_vm->_event->createButton( 65, y, 2, 'o', _vm->_moveImages[4], _vm->_moveImages[5])); - _vm->_moveGadgetList.push_back(_vm->_event->createButton( 97, y, 3, 'c', _vm->_moveImages[6], _vm->_moveImages[7])); - _vm->_moveGadgetList.push_back(_vm->_event->createButton(129, y, 4, 'l', _vm->_moveImages[8], _vm->_moveImages[9])); - _vm->_moveGadgetList.push_back(_vm->_event->createButton(161, y, 5, 'i', _vm->_moveImages[12], _vm->_moveImages[13])); - _vm->_moveGadgetList.push_back(_vm->_event->createButton(193, y, 6, VKEY_LTARROW, _vm->_moveImages[14], _vm->_moveImages[15])); - _vm->_moveGadgetList.push_back(_vm->_event->createButton(225, y, 7, VKEY_UPARROW, _vm->_moveImages[16], _vm->_moveImages[17])); - _vm->_moveGadgetList.push_back(_vm->_event->createButton(257, y, 8, VKEY_RTARROW, _vm->_moveImages[18], _vm->_moveImages[19])); - _vm->_moveGadgetList.push_back(_vm->_event->createButton(289, y, 9, 'p', _vm->_moveImages[10], _vm->_moveImages[11])); + _vm->_moveButtonList.push_back(_vm->_event->createButton( 1, y, 0, 't', _vm->_moveImages[0], _vm->_moveImages[1])); + _vm->_moveButtonList.push_back(_vm->_event->createButton( 33, y, 1, 'm', _vm->_moveImages[2], _vm->_moveImages[3])); + _vm->_moveButtonList.push_back(_vm->_event->createButton( 65, y, 2, 'o', _vm->_moveImages[4], _vm->_moveImages[5])); + _vm->_moveButtonList.push_back(_vm->_event->createButton( 97, y, 3, 'c', _vm->_moveImages[6], _vm->_moveImages[7])); + _vm->_moveButtonList.push_back(_vm->_event->createButton(129, y, 4, 'l', _vm->_moveImages[8], _vm->_moveImages[9])); + _vm->_moveButtonList.push_back(_vm->_event->createButton(161, y, 5, 'i', _vm->_moveImages[12], _vm->_moveImages[13])); + _vm->_moveButtonList.push_back(_vm->_event->createButton(193, y, 6, VKEY_LTARROW, _vm->_moveImages[14], _vm->_moveImages[15])); + _vm->_moveButtonList.push_back(_vm->_event->createButton(225, y, 7, VKEY_UPARROW, _vm->_moveImages[16], _vm->_moveImages[17])); + _vm->_moveButtonList.push_back(_vm->_event->createButton(257, y, 8, VKEY_RTARROW, _vm->_moveImages[18], _vm->_moveImages[19])); + _vm->_moveButtonList.push_back(_vm->_event->createButton(289, y, 9, 'p', _vm->_moveImages[10], _vm->_moveImages[11])); Common::File *invFile = _vm->_resource->openDataFile("P:Inv"); if (_vm->getPlatform() == Common::kPlatformWindows) { @@ -454,18 +454,18 @@ void DisplayMan::setUpScreens() { for (uint16 imgIdx = 0; imgIdx < 6; imgIdx++) _vm->_invImages[imgIdx] = new Image(invFile); } - _vm->_invGadgetList.push_back(_vm->_event->createButton( 24, y, 0, 'm', _vm->_invImages[0], _vm->_invImages[1])); - _vm->_invGadgetList.push_back(_vm->_event->createButton( 56, y, 1, 'g', _vm->_invImages[2], _vm->_invImages[3])); - _vm->_invGadgetList.push_back(_vm->_event->createButton( 94, y, 2, 'u', _vm->_invImages[4], _vm->_invImages[5])); - _vm->_invGadgetList.push_back(_vm->_event->createButton(126, y, 3, 'l', _vm->_moveImages[8], _vm->_moveImages[9])); - _vm->_invGadgetList.push_back(_vm->_event->createButton(164, y, 4, VKEY_LTARROW, _vm->_moveImages[14], _vm->_moveImages[15])); - _vm->_invGadgetList.push_back(_vm->_event->createButton(196, y, 5, VKEY_RTARROW, _vm->_moveImages[18], _vm->_moveImages[19])); - - // The windows version has 2 extra gadgets for breadcrumb trail + _vm->_invButtonList.push_back(_vm->_event->createButton( 24, y, 0, 'm', _vm->_invImages[0], _vm->_invImages[1])); + _vm->_invButtonList.push_back(_vm->_event->createButton( 56, y, 1, 'g', _vm->_invImages[2], _vm->_invImages[3])); + _vm->_invButtonList.push_back(_vm->_event->createButton( 94, y, 2, 'u', _vm->_invImages[4], _vm->_invImages[5])); + _vm->_invButtonList.push_back(_vm->_event->createButton(126, y, 3, 'l', _vm->_moveImages[8], _vm->_moveImages[9])); + _vm->_invButtonList.push_back(_vm->_event->createButton(164, y, 4, VKEY_LTARROW, _vm->_moveImages[14], _vm->_moveImages[15])); + _vm->_invButtonList.push_back(_vm->_event->createButton(196, y, 5, VKEY_RTARROW, _vm->_moveImages[18], _vm->_moveImages[19])); + + // The windows version has 2 extra buttons for breadcrumb trail // TODO: the game is really hard to play without those, maybe we could add something to enable that. if (_vm->getPlatform() == Common::kPlatformWindows) { - _vm->_invGadgetList.push_back(_vm->_event->createButton(234, y, 6, 'b', _vm->_invImages[6], _vm->_invImages[7])); - _vm->_invGadgetList.push_back(_vm->_event->createButton(266, y, 7, 'f', _vm->_invImages[8], _vm->_invImages[9])); + _vm->_invButtonList.push_back(_vm->_event->createButton(234, y, 6, 'b', _vm->_invImages[6], _vm->_invImages[7])); + _vm->_invButtonList.push_back(_vm->_event->createButton(266, y, 7, 'f', _vm->_invImages[8], _vm->_invImages[9])); } delete invFile; diff --git a/engines/lab/engine.cpp b/engines/lab/engine.cpp index 9ae7beb29a..ed08d85665 100644 --- a/engines/lab/engine.cpp +++ b/engines/lab/engine.cpp @@ -135,19 +135,19 @@ void LabEngine::freeScreens() { } /** - * Permanently flips the imagery of a gadget. + * Permanently flips the imagery of a button. */ -void LabEngine::perFlipGadget(uint16 gadgetId) { - for (GadgetList::iterator gadget = _moveGadgetList.begin(); gadget != _moveGadgetList.end(); ++gadget) { - Gadget *topGadget = *gadget; - if (topGadget->_gadgetID == gadgetId) { - Image *tmpImage = topGadget->_image; - topGadget->_image = topGadget->_altImage; - topGadget->_altImage = tmpImage; +void LabEngine::perFlipButton(uint16 buttonId) { + for (ButtonList::iterator button = _moveButtonList.begin(); button != _moveButtonList.end(); ++button) { + Button *topButton = *button; + if (topButton->_buttonID == buttonId) { + Image *tmpImage = topButton->_image; + topButton->_image = topButton->_altImage; + topButton->_altImage = tmpImage; if (!_alternate) { _event->mouseHide(); - topGadget->_image->drawImage(topGadget->x, topGadget->y); + topButton->_image->drawImage(topButton->x, topButton->y); _event->mouseShow(); } @@ -260,7 +260,7 @@ const char *LabEngine::getInvName(uint16 curInv) { */ void LabEngine::interfaceOff() { if (!_interfaceOff) { - _event->attachGadgetList(nullptr); + _event->attachButtonList(nullptr); _event->mouseHide(); _interfaceOff = true; } @@ -276,15 +276,15 @@ void LabEngine::interfaceOn() { } if (_graphics->_longWinInFront) - _event->attachGadgetList(nullptr); + _event->attachButtonList(nullptr); else if (_alternate) - _event->attachGadgetList(&_invGadgetList); + _event->attachButtonList(&_invButtonList); else - _event->attachGadgetList(&_moveGadgetList); + _event->attachButtonList(&_moveButtonList); } /** - * If the user hits the "Use" gadget; things that can get used on themselves. + * If the user hits the "Use" button; things that can get used on themselves. */ bool LabEngine::doUse(uint16 curInv) { switch (curInv) { @@ -427,7 +427,7 @@ void LabEngine::mainGameLoop() { _graphics->_longWinInFront = false; _graphics->drawPanel(); - perFlipGadget(actionMode); + perFlipButton(actionMode); // Set up initial picture. while (1) { @@ -534,7 +534,7 @@ void LabEngine::mainGameLoop() { gotMessage = true; mayShowCrumbIndicator(); _graphics->screenUpdate(); - if (!fromCrumbs(GADGETUP, code, 0, _event->updateAndGetMousePos(), curInv, curMsg, forceDraw, code, actionMode)) + if (!fromCrumbs(BUTTONUP, code, 0, _event->updateAndGetMousePos(), curInv, curMsg, forceDraw, code, actionMode)) break; } } @@ -549,7 +549,7 @@ void LabEngine::mainGameLoop() { curPos.y = curMsg->_mouseY; _followingCrumbs = false; - if (!fromCrumbs(curMsg->_msgClass, curMsg->_code, curMsg->_qualifier, curPos, curInv, curMsg, forceDraw, curMsg->_gadgetID, actionMode)) + if (!fromCrumbs(curMsg->_msgClass, curMsg->_code, curMsg->_qualifier, curPos, curInv, curMsg, forceDraw, curMsg->_buttonID, actionMode)) break; } } @@ -596,7 +596,7 @@ void LabEngine::showLab2Teaser() { } bool LabEngine::fromCrumbs(uint32 tmpClass, uint16 code, uint16 qualifier, Common::Point tmpPos, - uint16 &curInv, IntuiMessage *curMsg, bool &forceDraw, uint16 gadgetId, uint16 &actionMode) { + uint16 &curInv, IntuiMessage *curMsg, bool &forceDraw, uint16 buttonId, uint16 &actionMode) { uint32 msgClass = tmpClass; Common::Point curPos = tmpPos; @@ -641,7 +641,7 @@ bool LabEngine::fromCrumbs(uint32 tmpClass, uint16 code, uint16 qualifier, Commo _graphics->_doNotDrawMessage = false; _mainDisplay = true; - // Sets the correct gadget list + // Sets the correct button list interfaceOn(); _graphics->drawPanel(); drawRoomMessage(curInv, _closeDataPtr); @@ -710,9 +710,9 @@ bool LabEngine::fromCrumbs(uint32 tmpClass, uint16 code, uint16 qualifier, Commo drawRoomMessage(curInv, _closeDataPtr); _graphics->screenUpdate(); } - } else if ((msgClass == GADGETUP) && !_alternate) { - if (gadgetId <= 5) { - if ((actionMode == 4) && (gadgetId == 4) && _closeDataPtr) { + } else if ((msgClass == BUTTONUP) && !_alternate) { + if (buttonId <= 5) { + if ((actionMode == 4) && (buttonId == 4) && _closeDataPtr) { doMainView(&_closeDataPtr); _anim->_doBlack = true; @@ -720,13 +720,13 @@ bool LabEngine::fromCrumbs(uint32 tmpClass, uint16 code, uint16 qualifier, Commo _closeDataPtr = nullptr; mayShowCrumbIndicator(); _graphics->screenUpdate(); - } else if (gadgetId == 5) { + } else if (buttonId == 5) { eatMessages(); _alternate = true; _anim->_doBlack = true; _graphics->_doNotDrawMessage = false; - // Sets the correct gadget list + // Sets the correct button list interfaceOn(); _mainDisplay = false; @@ -743,29 +743,29 @@ bool LabEngine::fromCrumbs(uint32 tmpClass, uint16 code, uint16 qualifier, Commo _graphics->screenUpdate(); } else { uint16 oldActionMode = actionMode; - actionMode = gadgetId; + actionMode = buttonId; if (oldActionMode < 5) - perFlipGadget(oldActionMode); + perFlipButton(oldActionMode); - perFlipGadget(actionMode); + perFlipButton(actionMode); - if (gadgetId <= 4) - drawStaticMessage(kTextTakeWhat + gadgetId); + if (buttonId <= 4) + drawStaticMessage(kTextTakeWhat + buttonId); _graphics->screenUpdate(); } - } else if (gadgetId == 9) { + } else if (buttonId == 9) { doUse(kItemMap); mayShowCrumbIndicator(); _graphics->screenUpdate(); - } else if (gadgetId >= 6) { - // Arrow Gadgets + } else if (buttonId >= 6) { + // Arrow Buttons _closeDataPtr = nullptr; wrkClosePtr = nullptr; - if ((gadgetId == 6) || (gadgetId == 8)) { - if (gadgetId == 6) + if ((buttonId == 6) || (buttonId == 8)) { + if (buttonId == 6) drawStaticMessage(kTextTurnLeft); else drawStaticMessage(kTextTurnRight); @@ -774,7 +774,7 @@ bool LabEngine::fromCrumbs(uint32 tmpClass, uint16 code, uint16 qualifier, Commo oldDirection = _direction; - uint16 newDir = processArrow(_direction, gadgetId - 6); + uint16 newDir = processArrow(_direction, buttonId - 6); doTurn(_direction, newDir, &_closeDataPtr); _anim->_doBlack = true; _direction = newDir; @@ -782,7 +782,7 @@ bool LabEngine::fromCrumbs(uint32 tmpClass, uint16 code, uint16 qualifier, Commo mayShowCrumbIndicator(); _graphics->screenUpdate(); - } else if (gadgetId == 7) { + } else if (buttonId == 7) { uint16 oldRoomNum = _roomNum; if (doGoForward(&_closeDataPtr)) { @@ -790,7 +790,7 @@ bool LabEngine::fromCrumbs(uint32 tmpClass, uint16 code, uint16 qualifier, Commo _anim->_doBlack = true; } else { _anim->_doBlack = true; - _direction = processArrow(_direction, gadgetId - 6); + _direction = processArrow(_direction, buttonId - 6); if (oldRoomNum != _roomNum) { drawStaticMessage(kTextGoForward); @@ -847,17 +847,17 @@ bool LabEngine::fromCrumbs(uint32 tmpClass, uint16 code, uint16 qualifier, Commo _graphics->screenUpdate(); } } - } else if ((msgClass == GADGETUP) && _alternate) { + } else if ((msgClass == BUTTONUP) && _alternate) { _anim->_doBlack = true; - if (gadgetId == 0) { + if (buttonId == 0) { eatMessages(); _alternate = false; _anim->_doBlack = true; _graphics->_doNotDrawMessage = false; _mainDisplay = true; - // Sets the correct gadget list + // Sets the correct button list interfaceOn(); _graphics->drawPanel(); drawRoomMessage(curInv, _closeDataPtr); @@ -865,9 +865,9 @@ bool LabEngine::fromCrumbs(uint32 tmpClass, uint16 code, uint16 qualifier, Commo _graphics->screenUpdate(); } - gadgetId--; + buttonId--; - if (gadgetId == 0) { + if (buttonId == 0) { interfaceOff(); _anim->stopDiff(); _curFileName = " "; @@ -889,21 +889,21 @@ bool LabEngine::fromCrumbs(uint32 tmpClass, uint16 code, uint16 qualifier, Commo g_system->delayMillis(1000); } _graphics->screenUpdate(); - } else if (gadgetId == 1) { + } else if (buttonId == 1) { if (!doUse(curInv)) { uint16 oldActionMode = actionMode; // Use button actionMode = 5; if (oldActionMode < 5) - perFlipGadget(oldActionMode); + perFlipButton(oldActionMode); drawStaticMessage(kTextUseOnWhat); _mainDisplay = true; _graphics->screenUpdate(); } - } else if (gadgetId == 2) { + } else if (buttonId == 2) { _mainDisplay = !_mainDisplay; if ((curInv == 0) || (curInv > _numInv)) { @@ -917,30 +917,30 @@ bool LabEngine::fromCrumbs(uint32 tmpClass, uint16 code, uint16 qualifier, Commo _nextFileName = getInvName(curInv); _graphics->screenUpdate(); - } else if (gadgetId == 3) { - // Left gadget + } else if (buttonId == 3) { + // Left button decIncInv(&curInv, true); lastInv = curInv; _graphics->_doNotDrawMessage = false; drawRoomMessage(curInv, _closeDataPtr); _graphics->screenUpdate(); - } else if (gadgetId == 4) { - // Right gadget + } else if (buttonId == 4) { + // Right button decIncInv(&curInv, false); lastInv = curInv; _graphics->_doNotDrawMessage = false; drawRoomMessage(curInv, _closeDataPtr); _graphics->screenUpdate(); - } else if (gadgetId == 5) { + } else if (buttonId == 5) { // bread crumbs _breadCrumbs[0]._roomNum = 0; _numCrumbs = 0; _droppingCrumbs = true; mayShowCrumbIndicator(); _graphics->screenUpdate(); - } else if (gadgetId == 6) { + } else if (buttonId == 6) { // follow crumbs if (_droppingCrumbs) { if (_numCrumbs > 0) { @@ -958,7 +958,7 @@ bool LabEngine::fromCrumbs(uint32 tmpClass, uint16 code, uint16 qualifier, Commo _graphics->_doNotDrawMessage = false; _mainDisplay = true; - // Sets the correct gadget list + // Sets the correct button list interfaceOn(); _graphics->drawPanel(); drawRoomMessage(curInv, _closeDataPtr); @@ -1085,7 +1085,7 @@ bool LabEngine::fromCrumbs(uint32 tmpClass, uint16 code, uint16 qualifier, Commo _anim->_doBlack = true; _graphics->_doNotDrawMessage = false; _mainDisplay = true; - // Sets the correct gadget list + // Sets the correct button list interfaceOn(); if (_alternate) { diff --git a/engines/lab/eventman.cpp b/engines/lab/eventman.cpp index 7b5d184dc9..63ca63a7b4 100644 --- a/engines/lab/eventman.cpp +++ b/engines/lab/eventman.cpp @@ -60,49 +60,49 @@ static const byte mouseData[] = { #define MOUSE_HEIGHT 15 /** - * Checks whether or not the cords fall within one of the gadgets in a list - * of gadgets. + * Checks whether or not the cords fall within one of the buttons in a list + * of buttons. */ -Gadget *EventManager::checkGadgetHit(GadgetList *gadgetList, Common::Point pos) { - for (GadgetList::iterator gadgetItr = gadgetList->begin(); gadgetItr != gadgetList->end(); ++gadgetItr) { - Gadget *gadget = *gadgetItr; - Common::Rect gadgetRect(gadget->x, gadget->y, gadget->x + gadget->_image->_width - 1, gadget->y + gadget->_image->_height - 1); +Button *EventManager::checkButtonHit(ButtonList *buttonList, Common::Point pos) { + for (ButtonList::iterator buttonItr = buttonList->begin(); buttonItr != buttonList->end(); ++buttonItr) { + Button *button = *buttonItr; + Common::Rect buttonRect(button->x, button->y, button->x + button->_image->_width - 1, button->y + button->_image->_height - 1); - if (gadgetRect.contains(pos) && gadget->isEnabled) { + if (buttonRect.contains(pos) && button->isEnabled) { if (_vm->_isHiRes) { - _hitGadget = gadget; + _hitButton = button; } else { mouseHide(); - gadget->_altImage->drawImage(gadget->x, gadget->y); + button->_altImage->drawImage(button->x, button->y); mouseShow(); for (uint16 i = 0; i < 3; i++) _vm->waitTOF(); mouseHide(); - gadget->_image->drawImage(gadget->x, gadget->y); + button->_image->drawImage(button->x, button->y); mouseShow(); } - return gadget; + return button; } } return NULL; } -void EventManager::attachGadgetList(GadgetList *gadgetList) { - if (_screenGadgetList != gadgetList) - _lastGadgetHit = nullptr; +void EventManager::attachButtonList(ButtonList *buttonList) { + if (_screenButtonList != buttonList) + _lastButtonHit = nullptr; - _screenGadgetList = gadgetList; + _screenButtonList = buttonList; } -Gadget *EventManager::getGadget(uint16 id) { - for (GadgetList::iterator gadgetItr = _screenGadgetList->begin(); gadgetItr != _screenGadgetList->end(); ++gadgetItr) { - Gadget *gadget = *gadgetItr; - if (gadget->_gadgetID == id) - return gadget; +Button *EventManager::getButton(uint16 id) { + for (ButtonList::iterator buttonItr = _screenButtonList->begin(); buttonItr != _screenButtonList->end(); ++buttonItr) { + Button *button = *buttonItr; + if (button->_buttonID == id) + return button; } return nullptr; @@ -113,9 +113,9 @@ EventManager::EventManager(LabEngine *vm) : _vm(vm) { _rightClick = false; _mouseHidden = true; - _lastGadgetHit = nullptr; - _screenGadgetList = nullptr; - _hitGadget = nullptr; + _lastButtonHit = nullptr; + _screenButtonList = nullptr; + _hitButton = nullptr; _nextKeyIn = 0; _nextKeyOut = 0; _mousePos = Common::Point(0, 0); @@ -129,12 +129,12 @@ EventManager::EventManager(LabEngine *vm) : _vm(vm) { void EventManager::mouseHandler(int flag, Common::Point pos) { if (flag & 0x02) { // Left mouse button click - Gadget *tmp = NULL; - if (_screenGadgetList) - tmp = checkGadgetHit(_screenGadgetList, _vm->_isHiRes ? pos : Common::Point(pos.x / 2, pos.y)); + Button *tmp = NULL; + if (_screenButtonList) + tmp = checkButtonHit(_screenButtonList, _vm->_isHiRes ? pos : Common::Point(pos.x / 2, pos.y)); if (tmp) - _lastGadgetHit = tmp; + _lastButtonHit = tmp; else _leftClick = true; } @@ -150,19 +150,19 @@ void EventManager::updateMouse() { if (!_mouseHidden) doUpdateDisplay = true; - if (_hitGadget) { + if (_hitButton) { mouseHide(); - _hitGadget->_altImage->drawImage(_hitGadget->x, _hitGadget->y); + _hitButton->_altImage->drawImage(_hitButton->x, _hitButton->y); mouseShow(); for (uint16 i = 0; i < 3; i++) _vm->waitTOF(); mouseHide(); - _hitGadget->_image->drawImage(_hitGadget->x, _hitGadget->y); + _hitButton->_image->drawImage(_hitButton->x, _hitButton->y); mouseShow(); doUpdateDisplay = true; - _hitGadget = nullptr; + _hitButton = nullptr; } if (doUpdateDisplay) @@ -251,10 +251,10 @@ bool EventManager::mouseButton(uint16 *x, uint16 *y, bool leftbutton) { return false; } -Gadget *EventManager::mouseGadget() { - Gadget *temp = _lastGadgetHit; +Button *EventManager::mouseButton() { + Button *temp = _lastButtonHit; - _lastGadgetHit = nullptr; + _lastButtonHit = nullptr; return temp; } diff --git a/engines/lab/eventman.h b/engines/lab/eventman.h index 3becfeb693..cf61c40c19 100644 --- a/engines/lab/eventman.h +++ b/engines/lab/eventman.h @@ -40,7 +40,7 @@ class Image; // Defines for the Class variable in IntuiMessage #define MOUSEBUTTONS 0x00000008 -#define GADGETUP 0x00000040 +#define BUTTONUP 0x00000040 #define RAWKEY 0x00000400 #define DELTAMOVE 0x00100000 @@ -55,19 +55,19 @@ class Image; struct IntuiMessage { uint32 _msgClass; - uint16 _code, _qualifier, _mouseX, _mouseY, _gadgetID; + uint16 _code, _qualifier, _mouseX, _mouseY, _buttonID; uint32 _seconds, _micros; }; -struct Gadget { - uint16 x, y, _gadgetID; - uint16 _keyEquiv; // if not zero, a key that activates gadget +struct Button { + uint16 x, y, _buttonID; + uint16 _keyEquiv; // if not zero, a key that activates button bool isEnabled; Image *_image, *_altImage; }; -typedef Common::List GadgetList; +typedef Common::List