[Scummvm-git-logs] scummvm master -> 56f53b8191e3e2578c0cd33d4467b28e4fa6af56
bluegr
noreply at scummvm.org
Mon Apr 11 20:28:54 UTC 2022
This automated email contains information about 1 new commit which have been
pushed to the 'scummvm' repo located at https://github.com/scummvm/scummvm .
Summary:
56f53b8191 CHEWY: Merge the screen drawing code and cleanup defines
Commit: 56f53b8191e3e2578c0cd33d4467b28e4fa6af56
https://github.com/scummvm/scummvm/commit/56f53b8191e3e2578c0cd33d4467b28e4fa6af56
Author: Filippos Karapetis (bluegr at gmail.com)
Date: 2022-04-11T23:28:31+03:00
Commit Message:
CHEWY: Merge the screen drawing code and cleanup defines
Changed paths:
R engines/chewy/mcga.cpp
R engines/chewy/mcga.h
R engines/chewy/ngshext.h
engines/chewy/atds.cpp
engines/chewy/debugger.cpp
engines/chewy/detail.cpp
engines/chewy/detail.h
engines/chewy/dialogs/cinema.cpp
engines/chewy/dialogs/credits.cpp
engines/chewy/dialogs/files.cpp
engines/chewy/dialogs/inventory.cpp
engines/chewy/dialogs/main_menu.cpp
engines/chewy/dialogs/options.cpp
engines/chewy/effect.cpp
engines/chewy/effect.h
engines/chewy/events.cpp
engines/chewy/events.h
engines/chewy/inits.cpp
engines/chewy/main.cpp
engines/chewy/mcga_graphics.cpp
engines/chewy/mcga_graphics.h
engines/chewy/menus.cpp
engines/chewy/module.mk
engines/chewy/movclass.cpp
engines/chewy/movclass.h
engines/chewy/room.cpp
engines/chewy/room.h
engines/chewy/rooms/room00.cpp
engines/chewy/rooms/room04.cpp
engines/chewy/rooms/room46.cpp
engines/chewy/rooms/room51.cpp
engines/chewy/rooms/room89.cpp
engines/chewy/rooms/room97.cpp
engines/chewy/sprite.cpp
engines/chewy/t_event.cpp
engines/chewy/video/cfo_decoder.cpp
engines/chewy/video/video_player.cpp
diff --git a/engines/chewy/atds.cpp b/engines/chewy/atds.cpp
index b03dc9acd0f..29d19440ae9 100644
--- a/engines/chewy/atds.cpp
+++ b/engines/chewy/atds.cpp
@@ -20,12 +20,13 @@
*/
#include "common/memstream.h"
-#include "chewy/ngshext.h"
#include "chewy/atds.h"
#include "chewy/defines.h"
#include "chewy/events.h"
#include "chewy/globals.h"
#include "chewy/main.h"
+#include "chewy/mcga_graphics.h"
+#include "chewy/mouse.h"
#include "chewy/ngsdefs.h"
#include "chewy/sound.h"
#include "chewy/text.h"
diff --git a/engines/chewy/debugger.cpp b/engines/chewy/debugger.cpp
index b3f218bd47b..9cbc6ca5519 100644
--- a/engines/chewy/debugger.cpp
+++ b/engines/chewy/debugger.cpp
@@ -22,7 +22,6 @@
#include "common/file.h"
#include "chewy/debugger.h"
#include "chewy/globals.h"
-#include "chewy/ngshext.h"
#include "chewy/chewy.h"
#include "chewy/video/video_player.h"
diff --git a/engines/chewy/detail.cpp b/engines/chewy/detail.cpp
index 82088d8c018..3cd8a96c387 100644
--- a/engines/chewy/detail.cpp
+++ b/engines/chewy/detail.cpp
@@ -21,6 +21,8 @@
#include "chewy/detail.h"
#include "chewy/globals.h"
+#include "chewy/mcga_graphics.h"
+#include "chewy/memory.h"
#include "chewy/ngsdefs.h"
#include "chewy/sound.h"
#include "chewy/resource.h"
diff --git a/engines/chewy/detail.h b/engines/chewy/detail.h
index c92b7823fd4..12ce0c288a6 100644
--- a/engines/chewy/detail.h
+++ b/engines/chewy/detail.h
@@ -22,8 +22,9 @@
#ifndef CHEWY_DETAIL_H
#define CHEWY_DETAIL_H
-#include "chewy/defines.h"
-#include "chewy/ngshext.h"
+#include "common/scummsys.h"
+#include "common/stream.h"
+#include "chewy/ngstypes.h"
namespace Chewy {
diff --git a/engines/chewy/dialogs/cinema.cpp b/engines/chewy/dialogs/cinema.cpp
index b0ad6dff1be..a5fd2ae8281 100644
--- a/engines/chewy/dialogs/cinema.cpp
+++ b/engines/chewy/dialogs/cinema.cpp
@@ -20,9 +20,11 @@
*/
#include "chewy/dialogs/cinema.h"
+#include "chewy/cursor.h"
#include "chewy/events.h"
#include "chewy/globals.h"
#include "chewy/main.h"
+#include "chewy/mcga_graphics.h"
#include "chewy/sound.h"
namespace Chewy {
diff --git a/engines/chewy/dialogs/credits.cpp b/engines/chewy/dialogs/credits.cpp
index dfb289a32c8..46bf073d4cd 100644
--- a/engines/chewy/dialogs/credits.cpp
+++ b/engines/chewy/dialogs/credits.cpp
@@ -23,6 +23,8 @@
#include "chewy/events.h"
#include "chewy/globals.h"
#include "chewy/main.h"
+#include "chewy/mcga_graphics.h"
+#include "chewy/mouse.h"
#include "chewy/text.h"
namespace Chewy {
diff --git a/engines/chewy/dialogs/files.cpp b/engines/chewy/dialogs/files.cpp
index 5075edf9c9c..102da2fde1c 100644
--- a/engines/chewy/dialogs/files.cpp
+++ b/engines/chewy/dialogs/files.cpp
@@ -22,8 +22,11 @@
#include "common/config-manager.h"
#include "chewy/dialogs/files.h"
#include "chewy/dialogs/options.h"
+#include "chewy/cursor.h"
#include "chewy/events.h"
#include "chewy/globals.h"
+#include "chewy/mcga_graphics.h"
+#include "chewy/memory.h"
#include "chewy/ngsdefs.h"
namespace Chewy {
diff --git a/engines/chewy/dialogs/inventory.cpp b/engines/chewy/dialogs/inventory.cpp
index 5be01e06ee1..48b93a565e7 100644
--- a/engines/chewy/dialogs/inventory.cpp
+++ b/engines/chewy/dialogs/inventory.cpp
@@ -22,10 +22,12 @@
#include "chewy/dialogs/inventory.h"
#include "chewy/rooms/room44.h"
#include "chewy/rooms/room58.h"
+#include "chewy/cursor.h"
#include "chewy/events.h"
#include "chewy/globals.h"
#include "chewy/main.h"
#include "chewy/menus.h"
+#include "chewy/mouse.h"
namespace Chewy {
namespace Dialogs {
diff --git a/engines/chewy/dialogs/main_menu.cpp b/engines/chewy/dialogs/main_menu.cpp
index 1b8f4da482d..9c088687dde 100644
--- a/engines/chewy/dialogs/main_menu.cpp
+++ b/engines/chewy/dialogs/main_menu.cpp
@@ -20,15 +20,15 @@
*/
#include "common/config-manager.h"
-#include "common/textconsole.h"
#include "chewy/dialogs/main_menu.h"
#include "chewy/dialogs/cinema.h"
#include "chewy/dialogs/credits.h"
#include "chewy/dialogs/files.h"
+#include "chewy/cursor.h"
#include "chewy/events.h"
#include "chewy/globals.h"
#include "chewy/main.h"
-#include "chewy/ngshext.h"
+#include "chewy/mcga_graphics.h"
#include "chewy/sound.h"
namespace Chewy {
diff --git a/engines/chewy/dialogs/options.cpp b/engines/chewy/dialogs/options.cpp
index e617df7b2ea..7d6828e79a3 100644
--- a/engines/chewy/dialogs/options.cpp
+++ b/engines/chewy/dialogs/options.cpp
@@ -20,8 +20,10 @@
*/
#include "chewy/dialogs/options.h"
+#include "chewy/cursor.h"
#include "chewy/events.h"
#include "chewy/globals.h"
+#include "chewy/mcga_graphics.h"
#include "chewy/sound.h"
namespace Chewy {
diff --git a/engines/chewy/effect.cpp b/engines/chewy/effect.cpp
index 1dc85a66d54..10974bbbe8e 100644
--- a/engines/chewy/effect.cpp
+++ b/engines/chewy/effect.cpp
@@ -19,9 +19,9 @@
*
*/
-#include "chewy/ngshext.h"
#include "chewy/effect.h"
#include "chewy/globals.h"
+#include "chewy/mcga_graphics.h"
namespace Chewy {
@@ -53,7 +53,7 @@ void Effect::rnd_blende(byte *rnd_speicher, byte *sram_speicher, byte *screen, b
else
x = rnd_zeiger[i] * 8;
_G(out)->setPointer(sram_speicher);
- _G(out)->spriteSave(sp, x, y, 8, 8, 0);
+ _G(out)->spriteSave(sp, x, y, 8, 8);
_G(out)->setPointer(screen);
_G(out)->spriteSet(sp, x, y, 0);
}
@@ -82,25 +82,25 @@ void Effect::blende1(byte *memPtr, byte *screen, byte *palette, int16 frames, ui
int16 x, y, x1;
for (x = i; x < 39 - i; x++) {
_G(out)->setPointer(memPtr);
- _G(out)->spriteSave(sp, x * 8, i * 8, 8, 8, 0);
+ _G(out)->spriteSave(sp, x * 8, i * 8, 8, 8);
_G(out)->setPointer(screen);
_G(out)->spriteSet(sp, x * 8, i * 8, 0);
}
for (y = i; y < 24 - i; y++) {
_G(out)->setPointer(memPtr);
- _G(out)->spriteSave(sp, x * 8, y * 8, 8, 8, 0);
+ _G(out)->spriteSave(sp, x * 8, y * 8, 8, 8);
_G(out)->setPointer(screen);
_G(out)->spriteSet(sp, x * 8, y * 8, 0);
}
for (x1 = 39 - i; x1 > i; x1--) {
_G(out)->setPointer(memPtr);
- _G(out)->spriteSave(sp, x1 * 8, y * 8, 8, 8, 0);
+ _G(out)->spriteSave(sp, x1 * 8, y * 8, 8, 8);
_G(out)->setPointer(screen);
_G(out)->spriteSet(sp, x1 * 8, y * 8, 0);
}
for (int16 y1 = 24 - i; y1 > i; y1--) {
_G(out)->setPointer(memPtr);
- _G(out)->spriteSave(sp, x1 * 8, y1 * 8, 8, 8, 0);
+ _G(out)->spriteSave(sp, x1 * 8, y1 * 8, 8, 8);
_G(out)->setPointer(screen);
_G(out)->spriteSet(sp, x1 * 8, y1 * 8, 0);
}
@@ -112,25 +112,25 @@ void Effect::blende1(byte *memPtr, byte *screen, byte *palette, int16 frames, ui
int16 x, y, x1;
for (x = i; x < 39 - i; x++) {
_G(out)->setPointer(memPtr);
- _G(out)->spriteSave(sp, x * 8, i * 8, 8, 8, 0);
+ _G(out)->spriteSave(sp, x * 8, i * 8, 8, 8);
_G(out)->setPointer(screen);
_G(out)->spriteSet(sp, x * 8, i * 8, 0);
}
for (y = i; y < 24 - i; y++) {
_G(out)->setPointer(memPtr);
- _G(out)->spriteSave(sp, x * 8, y * 8, 8, 8, 0);
+ _G(out)->spriteSave(sp, x * 8, y * 8, 8, 8);
_G(out)->setPointer(screen);
_G(out)->spriteSet(sp, x * 8, y * 8, 0);
}
for (x1 = 39 - i; x1 > i; x1--) {
_G(out)->setPointer(memPtr);
- _G(out)->spriteSave(sp, x1 * 8, y * 8, 8, 8, 0);
+ _G(out)->spriteSave(sp, x1 * 8, y * 8, 8, 8);
_G(out)->setPointer(screen);
_G(out)->spriteSet(sp, x1 * 8, y * 8, 0);
}
for (int16 y1 = 24 - i; y1 > i; y1--) {
_G(out)->setPointer(memPtr);
- _G(out)->spriteSave(sp, x1 * 8, y1 * 8, 8, 8, 0);
+ _G(out)->spriteSave(sp, x1 * 8, y1 * 8, 8, 8);
_G(out)->setPointer(screen);
_G(out)->spriteSet(sp, x1 * 8, y1 * 8, 0);
}
diff --git a/engines/chewy/effect.h b/engines/chewy/effect.h
index 61d1dda2bca..b5dfe8af0fa 100644
--- a/engines/chewy/effect.h
+++ b/engines/chewy/effect.h
@@ -22,6 +22,8 @@
#ifndef CHEWY_EFFECT_H
#define CHEWY_EFFECT_H
+#include "common/scummsys.h"
+
namespace Chewy {
enum BlendMode {
diff --git a/engines/chewy/events.cpp b/engines/chewy/events.cpp
index c188bd0c5aa..c6ff6287f61 100644
--- a/engines/chewy/events.cpp
+++ b/engines/chewy/events.cpp
@@ -22,6 +22,7 @@
#include "common/system.h"
#include "chewy/events.h"
#include "chewy/globals.h"
+#include "chewy/mouse.h"
#include "chewy/ngsdefs.h"
namespace Chewy {
@@ -254,8 +255,4 @@ char getch() {
return 0;
}
-void putch(char c) {
- warning("STUB: putch()");
-}
-
} // namespace Chewy
diff --git a/engines/chewy/events.h b/engines/chewy/events.h
index 296f902bb2b..caf315880fd 100644
--- a/engines/chewy/events.h
+++ b/engines/chewy/events.h
@@ -154,7 +154,6 @@ extern void delay(size_t time);
extern bool kbhit();
extern char getch();
-extern void putch(char c);
#define EVENTS_UPDATE g_events->update()
#define EVENTS_CLEAR g_events->clearEvents()
diff --git a/engines/chewy/inits.cpp b/engines/chewy/inits.cpp
index da8a2a30de1..945f33bccaf 100644
--- a/engines/chewy/inits.cpp
+++ b/engines/chewy/inits.cpp
@@ -22,9 +22,12 @@
#include "common/config-manager.h"
#include "common/memstream.h"
#include "chewy/chewy.h"
+#include "chewy/cursor.h"
#include "chewy/defines.h"
#include "chewy/globals.h"
#include "chewy/main.h"
+#include "chewy/mcga_graphics.h"
+#include "chewy/memory.h"
#include "chewy/sound.h"
namespace Chewy {
diff --git a/engines/chewy/main.cpp b/engines/chewy/main.cpp
index 4f5e1f9e81a..70bc4127b3c 100644
--- a/engines/chewy/main.cpp
+++ b/engines/chewy/main.cpp
@@ -22,9 +22,10 @@
#include "common/config-manager.h"
#include "chewy/main.h"
#include "chewy/chewy.h"
+#include "chewy/cursor.h"
#include "chewy/events.h"
+#include "chewy/mcga_graphics.h"
#include "chewy/menus.h"
-#include "chewy/ngshext.h"
#include "chewy/dialogs/files.h"
#include "chewy/dialogs/inventory.h"
#include "chewy/dialogs/main_menu.h"
diff --git a/engines/chewy/mcga.cpp b/engines/chewy/mcga.cpp
deleted file mode 100644
index c5672befd43..00000000000
--- a/engines/chewy/mcga.cpp
+++ /dev/null
@@ -1,410 +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 3 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, see <http://www.gnu.org/licenses/>.
- *
- */
-
-#include "common/system.h"
-#include "graphics/palette.h"
-#include "graphics/surface.h"
-#include "chewy/chewy.h"
-#include "chewy/globals.h"
-#include "chewy/main.h"
-#include "chewy/mcga.h"
-
-namespace Chewy {
-
-#define SCREEN_S _G(currentScreen)
-#define SCREEN _G(currentScreen).getPixels()
-#define VGA_COLOR_TRANS(x) ((x) * 255 / 63)
-
-void init_mcga() {
- _G(currentScreen) = (byte *)g_screen->getPixels();
- _G(spriteWidth) = 0;
-}
-
-byte *get_dispoff() {
- return SCREEN;
-}
-
-void setScummVMPalette(const byte *palette, uint start, uint count) {
- byte tempPal[PALETTE_SIZE];
- byte *dest = &tempPal[0];
-
- for (uint i = 0; i < count * 3; ++i, ++palette, ++dest)
- *dest = VGA_COLOR_TRANS(*palette);
-
- g_system->getPaletteManager()->setPalette(tempPal, start, count);
-}
-
-void set_palette(const byte *palette) {
- setScummVMPalette(palette, 0, PALETTE_COUNT);
-}
-
-void rastercol(int16 color, int16 r, int16 g, int16 b) {
- byte rgb[3];
- rgb[0] = r;
- rgb[1] = g;
- rgb[2] = b;
-
- setScummVMPalette(&rgb[0], color, 1);
-}
-
-void setPartialPalette(const byte *palette, int16 startCol, int16 nr) {
- setScummVMPalette(palette + startCol * 3, startCol, nr);
-}
-
-void clear_mcga() {
- if (SCREEN == (byte *)g_screen->getPixels())
- g_screen->clear();
- else
- Common::fill(SCREEN, SCREEN + SCREEN_WIDTH * SCREEN_HEIGHT, 0);
-}
-
-uint8 getpix(int16 x, int16 y) {
- return *(byte *)SCREEN_S.getBasePtr(x, y);
-}
-
-void line_mcga(int16 x1, int16 y1, int16 x2, int16 y2, int16 color) {
- return SCREEN_S.drawLine(x1, y1, x2, y2, color);
-}
-
-void mem2mcga(const byte *ptr) {
- byte *destP = (byte *)g_screen->getPixels();
- Common::copy(ptr + 4, ptr + 4 + (SCREEN_WIDTH * SCREEN_HEIGHT), destP);
- g_screen->markAllDirty();
-}
-
-void map_spr_2screen(const byte *sptr, int16 x, int16 y) {
- const int width = *((const int16 *)sptr);
- sptr += 4 + y * width + x;
- byte *destP = SCREEN;
-
- for (int row = 0; row < SCREEN_HEIGHT;
- ++row, sptr += width, destP += SCREEN_WIDTH) {
- Common::copy(sptr, sptr + SCREEN_WIDTH, destP);
- }
-}
-
-void spr_save_mcga(byte *sptr, int16 x, int16 y, int16 width, int16 height, int16 scrWidth) {
- *((int16 *)sptr) = width;
- sptr += 2;
- *((int16 *)sptr) = height;
- sptr += 2;
-
- int pitch;
- byte *scrP;
- if (scrWidth == 0) {
- scrP = SCREEN + y * SCREEN_WIDTH + x;
- pitch = SCREEN_WIDTH;
- } else {
- scrP = SCREEN + y * scrWidth + x;
- pitch = scrWidth;
- }
-
- if (width >= 1 && height >= 1) {
- for (int row = 0; row < height; ++row) {
- Common::copy(scrP, scrP + width, sptr);
- scrP += pitch;
- sptr += width;
- }
- }
-}
-
-void spr_set_mcga(const byte *sptr, int16 x, int16 y, int16 scrWidth) {
- const int width = *((const int16 *)sptr);
- sptr += 2;
- const int height = *((const int16 *)sptr);
- sptr += 2;
-
- if (width >= 1 && height >= 1) {
- int pitch;
- byte *scrP;
- if (scrWidth == 0) {
- scrP = SCREEN + y * SCREEN_WIDTH + x;
- pitch = SCREEN_WIDTH;
- } else {
- scrP = SCREEN + y * scrWidth + x;
- pitch = scrWidth;
- }
-
- for (int row = 0; row < height; ++row) {
- Common::copy(sptr, sptr + width, scrP);
- scrP += pitch;
- }
- }
-}
-
-static bool mspr_set_mcga_clip(int x, int y, int pitch, int &width, int &height, const byte *&srcP, byte *&destP) {
- if (y < _G(clipy1)) {
- int yDiff = ABS(_G(clipy1) - y);
- height -= yDiff;
- srcP += yDiff * width;
- y = _G(clipy1);
- }
- if (height < 1)
- return false;
-
- if (x < _G(clipx1)) {
- int xDiff = ABS(_G(clipx1) - x);
- width -= xDiff;
- srcP += xDiff;
- x = _G(clipx1);
- }
- if (width < 1)
- return false;
-
- int x2 = x + width;
- if (x2 > _G(clipx2)) {
- int xDiff = x2 - _G(clipx2);
- width -= xDiff;
- }
- if (width <= 1)
- return false;
-
- int y2 = y + height;
- if (y2 > _G(clipy2)) {
- int yDiff = y2 - _G(clipy2);
- height -= yDiff;
- }
- if (height < 1)
- return false;
-
- destP = SCREEN + pitch * y + x;
- return true;
-}
-
-void mspr_set_mcga(byte *sptr, int16 x, int16 y, int16 scrWidth) {
- if (!sptr)
- return;
-
- byte *destP;
- int width = *((const int16 *)sptr);
- sptr += 2;
- int height = *((const int16 *)sptr);
- sptr += 2;
- const byte *srcP = sptr;
- _G(spriteWidth) = width;
-
- if (!(height >= 1 && width >= 4))
- return;
-
- int pitch = scrWidth ? scrWidth : SCREEN_WIDTH;
- if (!mspr_set_mcga_clip(x, y, pitch, width, height, srcP, destP))
- return;
- int destPitchRemainder = pitch - width;
- int srcPitchRemainder = _G(spriteWidth) - width;
-
- for (int row = 0; row < height; ++row,
- srcP += srcPitchRemainder, destP += destPitchRemainder) {
- for (int col = 0; col < width; ++col, ++srcP, ++destP) {
- if (*srcP != 0)
- *destP = *srcP;
- }
- }
-}
-
-void vors() {
- _G(gcurx) += _G(fontMgr)->getFont()->getDataWidth();
-}
-
-void putcxy(int16 x, int16 y, unsigned char c, int16 fgCol, int16 bgCol, int16 scrWidth) {
- ChewyFont *font = _G(fontMgr)->getFont();
- Graphics::Surface *textSurface = font->getLine(Common::String(c));
- byte *data = (byte *)textSurface->getPixels();
-
- for (int curX = 0; curX < textSurface->pitch; curX++) {
- for (int curY = 0; curY < textSurface->h; curY++) {
- if (curX + x < 320 && curY + y < 200) {
- byte *src = data + (curY * textSurface->pitch) + curX;
- byte *dst = (byte *)_G(currentScreen).getBasePtr(curX + x, curY + y);
- if (*src != 0xFF)
- *dst = fgCol;
- else if (bgCol < 0xFF)
- *dst = bgCol;
- }
- }
- }
-
- g_screen->addDirtyRect(Common::Rect(
- x, y, x + textSurface->pitch, y + textSurface->h));
-
- textSurface->free();
- delete textSurface;
-}
-
-void putz(unsigned char c, int16 fgCol, int16 bgCol, int16 scrWidth) {
- putcxy(_G(gcurx), _G(gcury), c, fgCol, bgCol, scrWidth);
-}
-
-namespace Zoom {
-
-static int spriteHeight;
-static int spriteDeltaX1, spriteDeltaX2;
-static int spriteDeltaY1, spriteDeltaY2;
-static int spriteXVal1, spriteXVal2;
-static int spriteYVal1, spriteYVal2;
-
-static void setXVals() {
- if (spriteDeltaX2 == 0) {
- spriteXVal1 = 0;
- spriteXVal2 = 1;
- } else {
- spriteXVal1 = _G(spriteWidth) / spriteDeltaX2;
- spriteXVal2 = 1000 * (_G(spriteWidth) % spriteDeltaX2);
- if (spriteDeltaX2)
- spriteXVal2 /= spriteDeltaX2;
- }
-}
-
-static void setYVals() {
- if (spriteDeltaY2 == 0) {
- spriteYVal1 = 0;
- spriteYVal2 = 1;
- } else {
- spriteYVal1 = spriteHeight / spriteDeltaY2;
- spriteYVal2 = 1000 * (spriteHeight % spriteDeltaY2);
- spriteYVal2 /= spriteDeltaY2;
- }
-}
-
-void clip(byte *&source, byte *&dest, int16 &x, int16 &y) {
- if (y < _G(clipy1)) {
- int yCount = _G(clipy1) - y;
- spriteDeltaY2 -= yCount;
-
- --yCount;
- if (yCount >= 1) {
- for (int yc = 0, countY = spriteYVal2; yc < yCount; ++yc) {
- source += _G(spriteWidth) * spriteYVal1;
- dest += SCREEN_WIDTH;
-
- while (countY > 1000) {
- countY -= 1000;
- source += _G(spriteWidth);
- }
- }
- }
- }
-
- if (spriteDeltaY2 <= 0) {
- source = nullptr;
- return;
- }
-
- if (x < _G(clipx1)) {
- int xCount = _G(clipx1) - x;
- spriteDeltaX2 -= xCount;
- dest += xCount;
-
- --xCount;
- if (xCount >= 1) {
- for (int xc = 0, countX = spriteXVal2; xc < xCount; ++xc) {
- source += spriteXVal1;
- while (countX >= 1000) {
- countX -= 1000;
- ++source;
- }
- }
- }
- }
-
- if (spriteDeltaX2 > 0) {
- int x2 = x + spriteDeltaX2;
- if (x2 >= _G(clipx2)) {
- spriteDeltaX2 -= x2 - _G(clipx2);
- }
-
- if (spriteDeltaY2 > 0) {
- int y2 = y + spriteDeltaY2;
- if (y2 >= _G(clipy2)) {
- spriteDeltaY2 -= y2 - _G(clipy2);
- }
- if (spriteDeltaY2 <= 0)
- source = nullptr;
- } else {
- source = nullptr;
- }
- } else {
- source = nullptr;
- }
-}
-
-void zoom_set(byte *source, int16 x, int16 y, int16 xDiff, int16 yDiff, int16 scrWidth) {
- _G(spriteWidth) = ((int16 *)source)[0];
- spriteHeight = ((int16 *)source)[1];
- source += 4;
-
- spriteDeltaX1 = xDiff;
- spriteDeltaX2 = _G(spriteWidth) + xDiff;
- spriteDeltaY1 = yDiff;
- spriteDeltaY2 = spriteHeight + yDiff;
-
- setXVals();
- setYVals();
-
- byte *scrP;
- if (scrWidth == 0) {
- scrP = SCREEN + y * SCREEN_WIDTH + x;
- } else {
- scrP = SCREEN + y * scrWidth + x;
- }
-
- clip(source, scrP, x, y);
-
- if (source) {
- for (int yc = spriteDeltaY2, countY = spriteYVal2; yc > 0; --yc) {
- byte *srcLine = source;
- byte *scrLine = scrP;
-
- for (int xc = spriteDeltaX2, countX = spriteXVal2; xc > 0; --xc) {
- if (*source)
- *scrP = *source;
-
- ++scrP;
- source += spriteXVal1;
- countX += spriteXVal2;
- while (countX > 1000) {
- countX -= 1000;
- ++source;
- }
- }
-
- source = srcLine;
- scrP = scrLine + SCREEN_WIDTH;
-
- for (int ySkip = 0; ySkip < spriteYVal1; ++ySkip) {
- source += _G(spriteWidth);
- }
-
- countY += spriteYVal2;
- while (countY > 1000) {
- countY -= 1000;
- source += _G(spriteWidth);
- }
- }
- }
-}
-
-} // namespace Zoom
-
-void zoom_set(byte *source, int16 x, int16 y, int16 xDiff, int16 yDiff, int16 scrWidth) {
- Zoom::zoom_set(source, x, y, xDiff, yDiff, scrWidth);
-}
-
-} // namespace Chewy
diff --git a/engines/chewy/mcga.h b/engines/chewy/mcga.h
deleted file mode 100644
index 16cc6b44eee..00000000000
--- a/engines/chewy/mcga.h
+++ /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 3 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, see <http://www.gnu.org/licenses/>.
- *
- */
-
-#ifndef CHEWY_MCGA_H
-#define CHEWY_MCGA_H
-
-namespace Chewy {
-
-void init_mcga();
-
-byte *get_dispoff();
-
-void setScummVMPalette(const byte *palette, uint start, uint count);
-void set_palette(const byte *palette);
-void rastercol(int16 color, int16 r, int16 g, int16 b);
-void setPartialPalette(const byte *palette, int16 startCol, int16 nr);
-
-void clear_mcga();
-uint8 getpix(int16 x, int16 y);
-void line_mcga(int16 x1, int16 y1, int16 x2, int16 y2, int16 color);
-
-void mem2mcga(const byte *ptr);
-
-void map_spr_2screen(const byte *sptr, int16 x, int16 y);
-void spr_save_mcga(byte *sptr, int16 x, int16 y, int16 width,
- int16 height, int16 scrWidth);
-void spr_set_mcga(const byte *sptr, int16 x, int16 y, int16 scrWidth);
-void mspr_set_mcga(byte *sptr, int16 x, int16 y, int16 scrWidth);
-void zoom_set(byte *source, int16 x, int16 y, int16 xdiff,
- int16 ydiff, int16 scrWidth);
-
-void putcxy(int16 x, int16 y, unsigned char c, int16 fgCol, int16 bgCol, int16 scrWidth);
-void putz(unsigned char c, int16 fgCol, int16 bgCol, int16 scrWidth);
-void vors();
-
-} // namespace Chewy
-
-#endif
diff --git a/engines/chewy/mcga_graphics.cpp b/engines/chewy/mcga_graphics.cpp
index b6e4de54389..0c87b224a98 100644
--- a/engines/chewy/mcga_graphics.cpp
+++ b/engines/chewy/mcga_graphics.cpp
@@ -20,15 +20,18 @@
*/
#include "common/memstream.h"
+#include "common/system.h"
+#include "graphics/palette.h"
#include "chewy/chewy.h"
#include "chewy/events.h"
#include "chewy/globals.h"
#include "chewy/main.h"
#include "chewy/mcga_graphics.h"
-#include "chewy/mcga.h"
namespace Chewy {
+#define VGA_COLOR_TRANS(x) ((x)*255 / 63)
+
McgaGraphics::McgaGraphics() {
}
@@ -36,7 +39,18 @@ McgaGraphics::~McgaGraphics() {
}
void McgaGraphics::init() {
- init_mcga();
+ _G(currentScreen) = (byte *)g_screen->getPixels();
+ _G(spriteWidth) = 0;
+}
+
+void setScummVMPalette(const byte *palette, uint start, uint count) {
+ byte tempPal[PALETTE_SIZE];
+ byte *dest = &tempPal[0];
+
+ for (uint i = 0; i < count * 3; ++i, ++palette, ++dest)
+ *dest = VGA_COLOR_TRANS(*palette);
+
+ g_system->getPaletteManager()->setPalette(tempPal, start, count);
}
void McgaGraphics::setClip(int16 x1, int16 y1, int16 x2, int16 y2) {
@@ -57,15 +71,14 @@ void McgaGraphics::setPointer(byte *ptr) {
void McgaGraphics::setPalette(byte *palette) {
for (int16 i = 0; i < 768; i++)
_palTable[i] = palette[i];
- set_palette(palette);
+ setScummVMPalette(palette, 0, PALETTE_COUNT);
}
void McgaGraphics::raster_col(int16 c, int16 r, int16 g, int16 b) {
- int16 index = c * 3;
- _palTable[index] = r;
- _palTable[index + 1] = g;
- _palTable[index + 2] = b;
- rastercol(c, r, g, b);
+ _palTable[c * 3] = r;
+ _palTable[c * 3 + 1] = g;
+ _palTable[c * 3 + 2] = b;
+ setScummVMPalette(&_palTable[c * 3], c, 1);
}
void McgaGraphics::einblenden(byte *palette, int16 frames) {
@@ -86,7 +99,7 @@ void McgaGraphics::einblenden(byte *palette, int16 frames) {
_palTable[k + 2] = b1;
k += 3;
}
- set_palette(_palTable);
+ setScummVMPalette(_palTable, 0, PALETTE_COUNT);
}
}
@@ -105,7 +118,7 @@ void McgaGraphics::ausblenden(int16 frames) {
_palTable[k + 2] = b;
k += 3;
}
- set_palette(_palTable);
+ setScummVMPalette(_palTable, 0, PALETTE_COUNT);
}
}
@@ -118,22 +131,20 @@ void McgaGraphics::set_partialpalette(const byte *palette, int16 startCol, int16
_palTable[k + 2] = palette[k + 2];
k += 3;
}
- setPartialPalette(_palTable, startCol, nr);
+ setScummVMPalette(_palTable + startCol * 3, startCol, nr);
}
void McgaGraphics::cls() {
- clear_mcga();
+ Common::Rect r(0, 0, _G(currentScreen).pitch, _G(currentScreen).h);
+ _G(currentScreen).fillRect(r, 0);
}
void McgaGraphics::drawLine(int16 x1, int16 y1, int16 x2, int16 y2, int16 color) {
- line_mcga(x1, y1, x2, y2, color);
+ _G(currentScreen).drawLine(x1, y1, x2, y2, color);
}
void McgaGraphics::box(int16 x1, int16 y1, int16 x2, int16 y2, int16 color) {
- line_mcga(x1, y1, x2, y1, color);
- line_mcga(x1, y2 - 1, x2, y2 - 1, color);
- line_mcga(x1, y1, x1, y2, color);
- line_mcga(x2, y1, x2, y2, color);
+ _G(currentScreen).frameRect(Common::Rect(x1, y1, x2, y2), color);
}
void McgaGraphics::boxFill(int16 x1, int16 y1, int16 x2, int16 y2, int16 color) {
@@ -142,7 +153,7 @@ void McgaGraphics::boxFill(int16 x1, int16 y1, int16 x2, int16 y2, int16 color)
if (h == 0)
h = 1;
for (int16 i = 0; i < h; i++)
- line_mcga(x1, y1 + i, x2, y1 + i, color);
+ drawLine(x1, y1 + i, x2, y1 + i, color);
}
void McgaGraphics::pop_box(int16 x, int16 y, int16 x1, int16 y1, int16 col1, int16 col2, int16 back_col) {
@@ -155,10 +166,12 @@ void McgaGraphics::pop_box(int16 x, int16 y, int16 x1, int16 y1, int16 col1, int
}
void McgaGraphics::back2screen(byte *ptr) {
- mem2mcga(ptr);
+ byte *destP = (byte *)g_screen->getPixels();
+ Common::copy(ptr + 4, ptr + 4 + (SCREEN_WIDTH * SCREEN_HEIGHT), destP);
+ g_screen->markAllDirty();
}
-void McgaGraphics::spriteSave(byte *spritePtr, int16 x, int16 y, int16 width, int16 height, int16 screenWidth) {
+void McgaGraphics::spriteSave(byte *spritePtr, int16 x, int16 y, int16 width, int16 height) {
if (width < 4)
width = 4;
if (height <= 0)
@@ -180,18 +193,106 @@ void McgaGraphics::spriteSave(byte *spritePtr, int16 x, int16 y, int16 width, in
if (height <= 0)
height = 0;
- spr_save_mcga(spritePtr, x, y, width, height, screenWidth);
+ *((int16 *)spritePtr) = width;
+ spritePtr += 2;
+ *((int16 *)spritePtr) = height;
+ spritePtr += 2;
+
+ int pitch = SCREEN_WIDTH;
+ byte *scrP = _G(currentScreen).getPixels() + y * SCREEN_WIDTH + x;
+
+ if (width >= 1 && height >= 1) {
+ for (int row = 0; row < height; ++row) {
+ Common::copy(scrP, scrP + width, spritePtr);
+ scrP += pitch;
+ spritePtr += width;
+ }
+ }
+}
+
+static bool mspr_set_mcga_clip(int x, int y, int pitch, int &width, int &height, const byte *&srcP, byte *&destP) {
+ if (y < _G(clipy1)) {
+ int yDiff = ABS(_G(clipy1) - y);
+ height -= yDiff;
+ srcP += yDiff * width;
+ y = _G(clipy1);
+ }
+ if (height < 1)
+ return false;
+
+ if (x < _G(clipx1)) {
+ int xDiff = ABS(_G(clipx1) - x);
+ width -= xDiff;
+ srcP += xDiff;
+ x = _G(clipx1);
+ }
+ if (width < 1)
+ return false;
+
+ int x2 = x + width;
+ if (x2 > _G(clipx2)) {
+ int xDiff = x2 - _G(clipx2);
+ width -= xDiff;
+ }
+ if (width <= 1)
+ return false;
+
+ int y2 = y + height;
+ if (y2 > _G(clipy2)) {
+ int yDiff = y2 - _G(clipy2);
+ height -= yDiff;
+ }
+ if (height < 1)
+ return false;
+
+ destP = _G(currentScreen).getPixels() + pitch * y + x;
+ return true;
}
-void McgaGraphics::spriteSet(byte *sptr, int16 x, int16 y, int16 scrwidth) {
- mspr_set_mcga(sptr, x, y, scrwidth);
+void McgaGraphics::spriteSet(byte *sptr, int16 x, int16 y, int16 scrWidth) {
+ if (!sptr)
+ return;
+
+ byte *destP;
+ int width = *((const int16 *)sptr);
+ sptr += 2;
+ int height = *((const int16 *)sptr);
+ sptr += 2;
+ const byte *srcP = sptr;
+ _G(spriteWidth) = width;
+
+ if (!(height >= 1 && width >= 4))
+ return;
+
+ int pitch = scrWidth ? scrWidth : SCREEN_WIDTH;
+ if (!mspr_set_mcga_clip(x, y, pitch, width, height, srcP, destP))
+ return;
+ const int destPitchRemainder = pitch - width;
+ const int srcPitchRemainder = _G(spriteWidth) - width;
+
+ for (int row = 0; row < height; ++row,
+ srcP += srcPitchRemainder, destP += destPitchRemainder) {
+ for (int col = 0; col < width; ++col, ++srcP, ++destP) {
+ if (*srcP != 0)
+ *destP = *srcP;
+ }
+ }
}
void McgaGraphics::map_spr2screen(byte *sptr, int16 x, int16 y) {
- int16 br = ((int16 *)sptr)[0];
- int16 h = ((int16 *)sptr)[1];
- if ((br >= 320) || (h >= 200))
- map_spr_2screen(sptr, x, y);
+ const int16 width = ((const int16 *)sptr)[0];
+ const int16 height = ((const int16 *)sptr)[1];
+ if (width >= 320 || height >= 200) {
+ sptr += 4 + y * width + x;
+
+ for (int row = 0; row < SCREEN_HEIGHT; ++row, sptr += width) {
+ Common::copy(
+ sptr,
+ sptr + SCREEN_WIDTH,
+ (byte *)_G(currentScreen).getBasePtr(0, row)
+ );
+ }
+ }
}
int16 McgaGraphics::scanxy(int16 x, int16 y, int16 fcol, int16 bcol, int16 cur_col, int16 scrwidth,
@@ -375,10 +476,10 @@ int16 McgaGraphics::scanxy(int16 x, int16 y, int16 fcol, int16 bcol, int16 cur_c
for (i = disp_stelle; i <= disp_stellemax + disp_stelle; ++i) {
if (zstring[i] != 0) {
putz(zstring[i], fcol, bcol, scrwidth);
- vors();
+ _G(gcurx) += _G(fontMgr)->getFont()->getDataWidth();
} else {
putz(zstring[i], fcol, bcol, scrwidth);
- vors();
+ _G(gcurx) += _G(fontMgr)->getFont()->getDataWidth();
break;
}
}
@@ -439,8 +540,6 @@ int16 McgaGraphics::scanxy(int16 x, int16 y, int16 fcol, int16 bcol, int16 cur_c
else if (disp_akt > 0) {
--disp_akt;
}
- } else {
- putch(7);
}
}
@@ -452,9 +551,6 @@ int16 McgaGraphics::scanxy(int16 x, int16 y, int16 fcol, int16 bcol, int16 cur_c
getch();
eing = 1;
if (stelle <= 0) {
- putch(7);
- stelle = 0;
-
} else {
if (disp_akt > 0) {
--disp_akt;
@@ -473,7 +569,6 @@ int16 McgaGraphics::scanxy(int16 x, int16 y, int16 fcol, int16 bcol, int16 cur_c
++j;
if (stelle >= stellemax) {
stelle = stellemax;
- putch(7);
} else {
if (disp_akt < disp_stellemax) {
++disp_akt;
@@ -539,8 +634,6 @@ int16 McgaGraphics::scanxy(int16 x, int16 y, int16 fcol, int16 bcol, int16 cur_c
}
if ((stelle == stellemax) && (stellemax >= zaehler)) {
stellemax = zaehler;
- putch(7);
-
} else {
if (disp_akt < disp_stellemax) {
++disp_akt;
@@ -588,10 +681,10 @@ int16 McgaGraphics::scanxy(int16 x, int16 y, int16 fcol, int16 bcol, int16 cur_c
for (i = disp_stelle; i <= disp_stellemax + disp_stelle; ++i) {
if (zstring[i] != 0) {
putz(zstring[i], fcol, bcol, scrwidth);
- vors();
+ _G(gcurx) += _G(fontMgr)->getFont()->getDataWidth();
} else {
putz(zstring[i], fcol, bcol, scrwidth);
- vors();
+ _G(gcurx) += _G(fontMgr)->getFont()->getDataWidth();
break;
}
}
@@ -671,7 +764,168 @@ void McgaGraphics::scale_set(byte *sptr, int16 x, int16 y, int16 xdiff_, int16 y
if (xdiff_ || ydiff_)
zoom_set(sptr, x, y, xdiff_, ydiff_, scrwidth);
else
- mspr_set_mcga(sptr, x, y, scrwidth);
+ spriteSet(sptr, x, y, scrwidth);
+}
+
+void McgaGraphics::putz(unsigned char c, int16 fgCol, int16 bgCol, int16 scrWidth) {
+ const int16 x = _G(gcurx);
+ const int16 y = _G(gcury);
+ ChewyFont *font = _G(fontMgr)->getFont();
+ Graphics::Surface *textSurface = font->getLine(Common::String(c));
+ byte *data = (byte *)textSurface->getPixels();
+
+ for (int curX = 0; curX < textSurface->pitch; curX++) {
+ for (int curY = 0; curY < textSurface->h; curY++) {
+ if (curX + x < 320 && curY + y < 200) {
+ byte *src = data + (curY * textSurface->pitch) + curX;
+ byte *dst = (byte *)_G(currentScreen).getBasePtr(curX + x, curY + y);
+ if (*src != 0xFF)
+ *dst = fgCol;
+ else if (bgCol < 0xFF)
+ *dst = bgCol;
+ }
+ }
+ }
+
+ g_screen->addDirtyRect(Common::Rect(
+ x, y, x + textSurface->pitch, y + textSurface->h));
+
+ textSurface->free();
+ delete textSurface;
+}
+
+void McgaGraphics::setXVals() {
+ if (_zoomSpriteDeltaX2 == 0) {
+ _zoomSpriteXVal1 = 0;
+ _zoomSpriteXVal2 = 1;
+ } else {
+ _zoomSpriteXVal1 = _G(spriteWidth) / _zoomSpriteDeltaX2;
+ _zoomSpriteXVal2 = 1000 * (_G(spriteWidth) % _zoomSpriteDeltaX2);
+ _zoomSpriteXVal2 /= _zoomSpriteDeltaX2;
+ }
+}
+
+void McgaGraphics::setYVals(int spriteHeight) {
+ if (_zoomSpriteDeltaY2 == 0) {
+ _zoomSpriteYVal1 = 0;
+ _zoomSpriteYVal2 = 1;
+ } else {
+ _zoomSpriteYVal1 = spriteHeight / _zoomSpriteDeltaY2;
+ _zoomSpriteYVal2 = 1000 * (spriteHeight % _zoomSpriteDeltaY2);
+ _zoomSpriteYVal2 /= _zoomSpriteDeltaY2;
+ }
+}
+
+void McgaGraphics::clip(byte *&source, byte *&dest, int16 &x, int16 &y) {
+ if (y < _G(clipy1)) {
+ int yCount = _G(clipy1) - y;
+ _zoomSpriteDeltaY2 -= yCount;
+
+ --yCount;
+ if (yCount >= 1) {
+ for (int yc = 0, countY = _zoomSpriteYVal2; yc < yCount; ++yc) {
+ source += _G(spriteWidth) * _zoomSpriteYVal1;
+ dest += SCREEN_WIDTH;
+
+ while (countY > 1000) {
+ countY -= 1000;
+ source += _G(spriteWidth);
+ }
+ }
+ }
+ }
+
+ if (_zoomSpriteDeltaY2 <= 0) {
+ source = nullptr;
+ return;
+ }
+
+ if (x < _G(clipx1)) {
+ int xCount = _G(clipx1) - x;
+ _zoomSpriteDeltaX2 -= xCount;
+ dest += xCount;
+
+ --xCount;
+ if (xCount >= 1) {
+ for (int xc = 0, countX = _zoomSpriteXVal2; xc < xCount; ++xc) {
+ source += _zoomSpriteXVal1;
+ while (countX >= 1000) {
+ countX -= 1000;
+ ++source;
+ }
+ }
+ }
+ }
+
+ if (_zoomSpriteDeltaX2 > 0) {
+ int x2 = x + _zoomSpriteDeltaX2;
+ if (x2 >= _G(clipx2)) {
+ _zoomSpriteDeltaX2 -= x2 - _G(clipx2);
+ }
+
+ if (_zoomSpriteDeltaY2 > 0) {
+ int y2 = y + _zoomSpriteDeltaY2;
+ if (y2 >= _G(clipy2)) {
+ _zoomSpriteDeltaY2 -= y2 - _G(clipy2);
+ }
+ if (_zoomSpriteDeltaY2 <= 0)
+ source = nullptr;
+ } else {
+ source = nullptr;
+ }
+ } else {
+ source = nullptr;
+ }
+}
+
+void McgaGraphics::zoom_set(byte *source, int16 x, int16 y, int16 xDiff, int16 yDiff, int16 scrWidth) {
+ _G(spriteWidth) = ((int16 *)source)[0];
+ int spriteHeight = ((int16 *)source)[1];
+ source += 4;
+
+ _zoomSpriteDeltaX2 = _G(spriteWidth) + xDiff;
+ _zoomSpriteDeltaY2 = spriteHeight + yDiff;
+
+ setXVals();
+ setYVals(spriteHeight);
+
+ const int16 screenWidth = scrWidth > 0 ? scrWidth : SCREEN_WIDTH;
+ byte *scrP = _G(currentScreen).getPixels() + y * screenWidth + x;
+
+ clip(source, scrP, x, y);
+
+ if (source) {
+ for (int yc = _zoomSpriteDeltaY2, countY = _zoomSpriteYVal2; yc > 0; --yc) {
+ byte *srcLine = source;
+ byte *scrLine = scrP;
+
+ for (int xc = _zoomSpriteDeltaX2, countX = _zoomSpriteXVal2; xc > 0; --xc) {
+ if (*source)
+ *scrP = *source;
+
+ ++scrP;
+ source += _zoomSpriteXVal1;
+ countX += _zoomSpriteXVal2;
+ while (countX > 1000) {
+ countX -= 1000;
+ ++source;
+ }
+ }
+
+ source = srcLine;
+ scrP = scrLine + SCREEN_WIDTH;
+
+ for (int ySkip = 0; ySkip < _zoomSpriteYVal1; ++ySkip) {
+ source += _G(spriteWidth);
+ }
+
+ countY += _zoomSpriteYVal2;
+ while (countY > 1000) {
+ countY -= 1000;
+ source += _G(spriteWidth);
+ }
+ }
+ }
}
} // namespace Chewy
diff --git a/engines/chewy/mcga_graphics.h b/engines/chewy/mcga_graphics.h
index b656e463e2c..10c1c1c32ec 100644
--- a/engines/chewy/mcga_graphics.h
+++ b/engines/chewy/mcga_graphics.h
@@ -52,8 +52,8 @@ public:
void back2screen(byte *ptr);
void spriteSave(byte *spritePtr, int16 x, int16 y, int16 width,
- int16 height, int16 screenWidth);
- void spriteSet(byte *sptr, int16 x, int16 y, int16 scrwidth);
+ int16 height);
+ void spriteSet(byte *sptr, int16 x, int16 y, int16 scrWidth);
void scale_set(byte *sptr, int16 x, int16 y, int16 xdiff,
int16 ydiff, int16 scrwidth);
void map_spr2screen(byte *sptr, int16 x, int16 y);
@@ -67,9 +67,21 @@ public:
private:
int16 devices();
+ void putz(unsigned char c, int16 fgCol, int16 bgCol, int16 scrWidth);
+
+ // Zoom related
+ void setXVals();
+ void setYVals(int spriteHeight);
+ void clip(byte *&source, byte *&dest, int16 &x, int16 &y);
+ void zoom_set(byte *source, int16 x, int16 y, int16 xDiff, int16 yDiff, int16 scrWidth);
byte _palTable[PALETTE_SIZE];
uint8 _einfuegen = 0;
+
+ int _zoomSpriteDeltaX2;
+ int _zoomSpriteDeltaY2;
+ int _zoomSpriteXVal1, _zoomSpriteXVal2;
+ int _zoomSpriteYVal1, _zoomSpriteYVal2;
};
} // namespace Chewy
diff --git a/engines/chewy/menus.cpp b/engines/chewy/menus.cpp
index 7eb8081431f..fa278b19d25 100644
--- a/engines/chewy/menus.cpp
+++ b/engines/chewy/menus.cpp
@@ -24,7 +24,9 @@
#include "chewy/events.h"
#include "chewy/globals.h"
#include "chewy/main.h"
+#include "chewy/mcga_graphics.h"
#include "chewy/menus.h"
+#include "chewy/mouse.h"
#include "chewy/dialogs/inventory.h"
namespace Chewy {
diff --git a/engines/chewy/module.mk b/engines/chewy/module.mk
index 7319a544f85..3b1b68bc9b7 100644
--- a/engines/chewy/module.mk
+++ b/engines/chewy/module.mk
@@ -14,7 +14,6 @@ MODULE_OBJS = \
m_event.o \
main.o \
mouse.o \
- mcga.o \
mcga_graphics.o \
memory.o \
menus.o \
diff --git a/engines/chewy/movclass.cpp b/engines/chewy/movclass.cpp
index 01f68110316..c5b08707ed4 100644
--- a/engines/chewy/movclass.cpp
+++ b/engines/chewy/movclass.cpp
@@ -19,7 +19,6 @@
*
*/
-#include "chewy/ngshext.h"
#include "chewy/movclass.h"
#include "chewy/defines.h"
#include "chewy/globals.h"
diff --git a/engines/chewy/movclass.h b/engines/chewy/movclass.h
index 588bec5ce64..0542d2e5b5a 100644
--- a/engines/chewy/movclass.h
+++ b/engines/chewy/movclass.h
@@ -22,6 +22,8 @@
#ifndef CHEWY_MOVCLASS_H
#define CHEWY_MOVCLASS_H
+#include "common/scummsys.h"
+
namespace Chewy {
#define MAX_KNOTEN_PKT 15
diff --git a/engines/chewy/ngshext.h b/engines/chewy/ngshext.h
deleted file mode 100644
index c914cc4861e..00000000000
--- a/engines/chewy/ngshext.h
+++ /dev/null
@@ -1,30 +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 3 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, see <http://www.gnu.org/licenses/>.
- *
- */
-
-#ifndef CHEWY_NGSHEXT_H
-#define CHEWY_NGSHEXT_H
-
-#include "chewy/memory.h"
-#include "chewy/mcga.h"
-#include "chewy/mouse.h"
-#include "chewy/cursor.h"
-
-#endif
diff --git a/engines/chewy/room.cpp b/engines/chewy/room.cpp
index ebbb1ec44f0..171ff81b275 100644
--- a/engines/chewy/room.cpp
+++ b/engines/chewy/room.cpp
@@ -21,9 +21,9 @@
#include "chewy/defines.h"
#include "chewy/globals.h"
+#include "chewy/memory.h"
#include "chewy/resource.h"
#include "chewy/room.h"
-#include "chewy/ngshext.h"
#include "chewy/sound.h"
namespace Chewy {
diff --git a/engines/chewy/room.h b/engines/chewy/room.h
index 81bf0a43f46..afe7f907021 100644
--- a/engines/chewy/room.h
+++ b/engines/chewy/room.h
@@ -23,6 +23,7 @@
#define CHEWY_ROOM_H
#include "chewy/detail.h"
+#include "chewy/mcga_graphics.h"
#include "chewy/object_extra.h"
namespace Chewy {
diff --git a/engines/chewy/rooms/room00.cpp b/engines/chewy/rooms/room00.cpp
index 861dbba05b7..1873e61090e 100644
--- a/engines/chewy/rooms/room00.cpp
+++ b/engines/chewy/rooms/room00.cpp
@@ -19,6 +19,7 @@
*
*/
+#include "chewy/cursor.h"
#include "chewy/defines.h"
#include "chewy/events.h"
#include "chewy/globals.h"
diff --git a/engines/chewy/rooms/room04.cpp b/engines/chewy/rooms/room04.cpp
index 1581dafba48..7f99ffee691 100644
--- a/engines/chewy/rooms/room04.cpp
+++ b/engines/chewy/rooms/room04.cpp
@@ -19,9 +19,11 @@
*
*/
+#include "chewy/cursor.h"
#include "chewy/defines.h"
#include "chewy/events.h"
#include "chewy/globals.h"
+#include "chewy/mouse.h"
#include "chewy/room.h"
#include "chewy/rooms/room04.h"
#include "chewy/sound.h"
diff --git a/engines/chewy/rooms/room46.cpp b/engines/chewy/rooms/room46.cpp
index 81da4e00dc3..673b1dd2aaa 100644
--- a/engines/chewy/rooms/room46.cpp
+++ b/engines/chewy/rooms/room46.cpp
@@ -19,6 +19,7 @@
*
*/
+#include "chewy/cursor.h"
#include "chewy/defines.h"
#include "chewy/events.h"
#include "chewy/globals.h"
diff --git a/engines/chewy/rooms/room51.cpp b/engines/chewy/rooms/room51.cpp
index d3c1084174b..f4b06e3be28 100644
--- a/engines/chewy/rooms/room51.cpp
+++ b/engines/chewy/rooms/room51.cpp
@@ -19,13 +19,13 @@
*
*/
+#include "chewy/cursor.h"
#include "chewy/defines.h"
#include "chewy/events.h"
#include "chewy/globals.h"
#include "chewy/ani_dat.h"
#include "chewy/room.h"
#include "chewy/rooms/room51.h"
-#include "chewy/rooms/room65.h"
#include "chewy/sound.h"
namespace Chewy {
diff --git a/engines/chewy/rooms/room89.cpp b/engines/chewy/rooms/room89.cpp
index 993e9f92c1f..a87784e226a 100644
--- a/engines/chewy/rooms/room89.cpp
+++ b/engines/chewy/rooms/room89.cpp
@@ -94,7 +94,7 @@ void Room89::entry() {
// Squash screen into a single point at the center
int edi = -20;
int var24 = 0;
- _G(out)->spriteSave(_G(Ci).TempArea, 0, 0, 320, 200, 320);
+ _G(out)->spriteSave(_G(Ci).TempArea, 0, 0, 320, 200);
for (int esi = 0; esi < 100; ++esi) {
edi -= 3;
var24 -= 2;
@@ -113,7 +113,7 @@ void Room89::entry() {
// Those strings are also displayed in the the German version
_G(out)->printxy(70, 80, 15, 0, 0, "Thank you for playing");
_G(out)->printxy(70, 100, 15, 0, 0, " CHEWY Esc from F5");
- _G(out)->spriteSave(_G(Ci).TempArea, 0, 0, 320, 200, 320);
+ _G(out)->spriteSave(_G(Ci).TempArea, 0, 0, 320, 200);
edi = -300;
int var30 = -200;
diff --git a/engines/chewy/rooms/room97.cpp b/engines/chewy/rooms/room97.cpp
index be99baea948..6465340f519 100644
--- a/engines/chewy/rooms/room97.cpp
+++ b/engines/chewy/rooms/room97.cpp
@@ -22,6 +22,7 @@
#include "chewy/defines.h"
#include "chewy/events.h"
#include "chewy/globals.h"
+#include "chewy/mouse.h"
#include "chewy/room.h"
#include "chewy/rooms/room97.h"
#include "chewy/sound.h"
diff --git a/engines/chewy/sprite.cpp b/engines/chewy/sprite.cpp
index 6c2f344bb6c..9ce4e7f2bba 100644
--- a/engines/chewy/sprite.cpp
+++ b/engines/chewy/sprite.cpp
@@ -22,6 +22,7 @@
#include "chewy/defines.h"
#include "chewy/events.h"
#include "chewy/globals.h"
+#include "chewy/memory.h"
#include "chewy/sound.h"
#include "chewy/detail.h"
diff --git a/engines/chewy/t_event.cpp b/engines/chewy/t_event.cpp
index 0ac00391216..4422d6fab3f 100644
--- a/engines/chewy/t_event.cpp
+++ b/engines/chewy/t_event.cpp
@@ -21,9 +21,10 @@
#include "chewy/chewy.h"
#include "chewy/defines.h"
+#include "chewy/dialogs/inventory.h"
#include "chewy/events.h"
#include "chewy/globals.h"
-#include "chewy/dialogs/inventory.h"
+#include "chewy/mouse.h"
#include "chewy/rooms/rooms.h"
namespace Chewy {
diff --git a/engines/chewy/video/cfo_decoder.cpp b/engines/chewy/video/cfo_decoder.cpp
index 0522651142a..70905dedbb1 100644
--- a/engines/chewy/video/cfo_decoder.cpp
+++ b/engines/chewy/video/cfo_decoder.cpp
@@ -26,7 +26,6 @@
#include "graphics/palette.h"
#include "video/flic_decoder.h"
#include "chewy/globals.h"
-#include "chewy/mcga.h"
#include "chewy/sound.h"
#include "chewy/video/cfo_decoder.h"
diff --git a/engines/chewy/video/video_player.cpp b/engines/chewy/video/video_player.cpp
index f057661c4b6..584ee0d805e 100644
--- a/engines/chewy/video/video_player.cpp
+++ b/engines/chewy/video/video_player.cpp
@@ -21,8 +21,10 @@
#include "chewy/video/cfo_decoder.h"
#include "chewy/video/video_player.h"
+#include "chewy/cursor.h"
#include "chewy/events.h"
#include "chewy/globals.h"
+#include "chewy/mouse.h"
#include "chewy/resource.h"
#include "chewy/sound.h"
#include "common/events.h"
@@ -75,7 +77,6 @@ bool VideoPlayer::playVideo(uint num, bool stopMusic) {
if (cfoDecoder->hasDirtyPalette())
g_system->getPaletteManager()->setPalette(cfoDecoder->getPalette(), 0, 256);
- //setScummVMPalette(cfoDecoder->getPalette(), 0, 256);
keepPlaying = handleCustom(num, curFrame, cfoDecoder);
curFrame = cfoDecoder->getCurFrame();
@@ -100,7 +101,6 @@ bool VideoPlayer::playVideo(uint num, bool stopMusic) {
cfoDecoder->close();
g_system->getPaletteManager()->setPalette(curPalette, 0, 256);
- //setScummVMPalette(curPalette, 0, 256);
_G(cur)->show_cur();
delete videoResource;
More information about the Scummvm-git-logs
mailing list