aboutsummaryrefslogtreecommitdiff
path: root/engines
diff options
context:
space:
mode:
authorGregory Montoir2007-05-19 21:12:10 +0000
committerGregory Montoir2007-05-19 21:12:10 +0000
commit3afd0d95576b2578b6d56fcc62c283a0c1261035 (patch)
tree0699f047e8c914de790b521c169d9d8106b4458a /engines
parent6e76e46e0ee46b8d7817bcc39b7217a4f36f565d (diff)
downloadscummvm-rg350-3afd0d95576b2578b6d56fcc62c283a0c1261035.tar.gz
scummvm-rg350-3afd0d95576b2578b6d56fcc62c283a0c1261035.tar.bz2
scummvm-rg350-3afd0d95576b2578b6d56fcc62c283a0c1261035.zip
removed 4 unused offscreen buffers ; also changed several 64k buffers to be dynamically allocated.
svn-id: r26879
Diffstat (limited to 'engines')
-rw-r--r--engines/cine/bg.cpp2
-rw-r--r--engines/cine/cine.cpp2
-rw-r--r--engines/cine/gfx.cpp39
-rw-r--r--engines/cine/gfx.h14
-rw-r--r--engines/cine/main_loop.cpp2
5 files changed, 27 insertions, 32 deletions
diff --git a/engines/cine/bg.cpp b/engines/cine/bg.cpp
index badb8bb888..41291dea92 100644
--- a/engines/cine/bg.cpp
+++ b/engines/cine/bg.cpp
@@ -105,7 +105,7 @@ byte loadBg(const char *bgName) {
return 0;
}
-byte *additionalBgTable[9] = { page2Raw, NULL, NULL, NULL, NULL, NULL, NULL, NULL, page3Raw };
+byte *additionalBgTable[9];
byte currentAdditionalBgIdx = 0;
byte currentAdditionalBgIdx2 = 0;
diff --git a/engines/cine/cine.cpp b/engines/cine/cine.cpp
index 224721b096..aa180a0a32 100644
--- a/engines/cine/cine.cpp
+++ b/engines/cine/cine.cpp
@@ -122,7 +122,7 @@ void CineEngine::initialize() {
setupOpcodes();
initLanguage(g_cine->getLanguage());
- init_video();
+ gfxInit();
textDataPtr = (byte *)malloc(8000);
diff --git a/engines/cine/gfx.cpp b/engines/cine/gfx.cpp
index 0435060595..71aa33b28b 100644
--- a/engines/cine/gfx.cpp
+++ b/engines/cine/gfx.cpp
@@ -23,6 +23,7 @@
*/
#include "cine/cine.h"
+#include "cine/bg.h"
#include "cine/various.h"
#include "common/system.h"
@@ -31,19 +32,12 @@
namespace Cine {
-byte *screenBuffer;
-
uint16 c_palette[256];
-byte *page0;
-byte *page0c;
-byte *page1;
-byte *page2;
-byte *page3;
-
-byte page1Raw[320 * 200];
-byte page2Raw[320 * 200];
-byte page3Raw[320 * 200];
+byte *screenBuffer;
+byte *page1Raw;
+byte *page2Raw;
+byte *page3Raw;
static const byte mouseCursorNormal[] = {
0x00, 0x00, 0x40, 0x00, 0x60, 0x00, 0x70, 0x00,
@@ -93,14 +87,21 @@ static const byte cursorPalette[] = {
0xff, 0xff, 0xff, 0xff
};
-void init_video() {
- screenBuffer = (byte *)malloc(320 * 200 * 3);
- assert(screenBuffer);
-
- page0 = (byte *)malloc(0x8000);
- page1 = (byte *)malloc(0x8000);
- page2 = (byte *)malloc(0x8000);
- page3 = (byte *)malloc(0x8000);
+void gfxInit() {
+ screenBuffer = (byte *)malloc(320 * 200);
+ page1Raw = (byte *)malloc(320 * 200);
+ page2Raw = (byte *)malloc(320 * 200);
+ page3Raw = (byte *)malloc(320 * 200);
+ if (!screenBuffer || !page1Raw || !page2Raw || !page3Raw) {
+ error("Unable to allocate offscreen buffers");
+ }
+ memset(page1Raw, 0, 320 * 200);
+ memset(page2Raw, 0, 320 * 200);
+ memset(page3Raw, 0, 320 * 200);
+
+ memset(additionalBgTable, 0, sizeof(additionalBgTable));
+ additionalBgTable[0] = page2Raw;
+ additionalBgTable[8] = page3Raw;
}
void setMouseCursor(int cursor) {
diff --git a/engines/cine/gfx.h b/engines/cine/gfx.h
index 30841b6cb1..d46a033363 100644
--- a/engines/cine/gfx.h
+++ b/engines/cine/gfx.h
@@ -29,15 +29,13 @@ namespace Cine {
void gfxDrawSprite(byte *src4, uint16 sw, uint16 sh, byte *dst4, int16 sx, int16 sy);
-extern byte *page0;
-extern byte *page0c;
-extern byte *page1;
-extern byte *page2;
-extern byte *page3;
+extern byte *page1Raw;
+extern byte *page2Raw;
+extern byte *page3Raw;
extern uint16 c_palette[256];
-void init_video();
+void gfxInit();
void setMouseCursor(int cursor);
void convertGfx(byte *source, byte *dest, const uint16 width, const uint16 height);
void convertGfx2(byte *source, byte *dest, const uint16 width, const uint16 height);
@@ -59,10 +57,6 @@ void gfxResetPage(byte *pagePtr);
int16 gfxGetBit(int16 x, int16 y, byte *ptr, int16 width);
-extern byte page1Raw[320 * 200];
-extern byte page2Raw[320 * 200];
-extern byte page3Raw[320 * 200];
-
void gfxResetRawPage(byte *pageRaw);
void gfxConvertSpriteToRaw(byte *dest, byte *source, uint16 width, uint16 height);
void gfxCopyRawPage(byte *source, byte * dest);
diff --git a/engines/cine/main_loop.cpp b/engines/cine/main_loop.cpp
index face2628dd..5f601b8aa7 100644
--- a/engines/cine/main_loop.cpp
+++ b/engines/cine/main_loop.cpp
@@ -210,7 +210,7 @@ void CineEngine::mainLoop(int bootScriptIdx) {
menuVar = 0;
- gfxFuncGen1(page0c, page0, page0c, page0, -1);
+// gfxFuncGen1(page0c, page0, page0c, page0, -1);
ptrGfxFunc13();