aboutsummaryrefslogtreecommitdiff
path: root/engines
diff options
context:
space:
mode:
authorNicola Mettifogo2007-03-15 21:56:21 +0000
committerNicola Mettifogo2007-03-15 21:56:21 +0000
commit18fb5b485b84f8b129571c11abf04b06009f3e93 (patch)
tree13e4fdcf6d29a6cb6340066a6eda3c3c0e50968d /engines
parent62a5f783eeea84520d4bbcee9ce40e466739baf7 (diff)
downloadscummvm-rg350-18fb5b485b84f8b129571c11abf04b06009f3e93.tar.gz
scummvm-rg350-18fb5b485b84f8b129571c11abf04b06009f3e93.tar.bz2
scummvm-rg350-18fb5b485b84f8b129571c11abf04b06009f3e93.zip
moved remaining background related functions to disk.cpp, and changed Gfx accordingly
svn-id: r26145
Diffstat (limited to 'engines')
-rw-r--r--engines/parallaction/callables.cpp6
-rw-r--r--engines/parallaction/disk.cpp36
-rw-r--r--engines/parallaction/disk.h2
-rw-r--r--engines/parallaction/graphics.cpp41
-rw-r--r--engines/parallaction/graphics.h6
-rw-r--r--engines/parallaction/location.cpp4
-rw-r--r--engines/parallaction/menu.cpp12
-rw-r--r--engines/parallaction/parallaction.cpp2
8 files changed, 52 insertions, 57 deletions
diff --git a/engines/parallaction/callables.cpp b/engines/parallaction/callables.cpp
index cdbde2367e..1cdf9550b3 100644
--- a/engines/parallaction/callables.cpp
+++ b/engines/parallaction/callables.cpp
@@ -220,7 +220,7 @@ void _c_frankenstein(void *parm) {
byte pal0[PALETTE_SIZE], pal1[PALETTE_SIZE];
for (uint16 i = 0; i <= PALETTE_COLORS; i++) {
- pal0[i] = _palette[i];
+ pal0[i] = _vm->_gfx->_palette[i];
pal0[i*3+1] = 0;
pal0[i*3+2] = 0;
}
@@ -234,7 +234,7 @@ void _c_frankenstein(void *parm) {
_vm->_gfx->setPalette(pal1);
}
- _vm->_gfx->setPalette(_palette);
+ _vm->_gfx->setPalette(_vm->_gfx->_palette);
return;
}
@@ -282,7 +282,7 @@ void _c_finito(void *parm) {
cleanInventory();
refreshInventory(_vm->_characterName);
- _vm->_gfx->palUnk0(_palette);
+ _vm->_gfx->palUnk0(_vm->_gfx->_palette);
if (gameCompleted) {
_vm->_gfx->setFont("slide");
diff --git a/engines/parallaction/disk.cpp b/engines/parallaction/disk.cpp
index 5a72800b7a..49d80215cc 100644
--- a/engines/parallaction/disk.cpp
+++ b/engines/parallaction/disk.cpp
@@ -388,13 +388,45 @@ void Disk::unpackBackgroundScanline(byte *src, byte *screen, byte *mask, byte *p
return;
}
+void Disk::parseDepths(Common::SeekableReadStream &stream) {
+ _vm->_gfx->_bgLayers[0] = stream.readByte();
+ _vm->_gfx->_bgLayers[1] = stream.readByte();
+ _vm->_gfx->_bgLayers[2] = stream.readByte();
+ _vm->_gfx->_bgLayers[3] = stream.readByte();
+}
+
+
+void Disk::parseBackground(Common::SeekableReadStream &stream) {
+
+ stream.read(_vm->_gfx->_palette, PALETTE_SIZE);
+
+ parseDepths(stream);
+
+ for (uint32 _si = 0; _si < 6; _si++) {
+ _vm->_gfx->_palettefx[_si]._timer = stream.readUint16BE();
+ _vm->_gfx->_palettefx[_si]._step = stream.readUint16BE();
+ _vm->_gfx->_palettefx[_si]._flags = stream.readUint16BE();
+ _vm->_gfx->_palettefx[_si]._first = stream.readByte();
+ _vm->_gfx->_palettefx[_si]._last = stream.readByte();
+ }
+
+#if 0
+ uint16 v147;
+ for (v147 = 0; v147 < PALETTE_SIZE; v147++) {
+ byte _al = _vm->_gfx->_palette[v147];
+ _vm->_gfx->_palette[PALETTE_SIZE+v147] = _al / 2;
+ }
+#endif
+
+}
+
void Disk::loadBackground(const char *filename) {
// printf("Gfx::loadBackground(%s)\n", filename);
if (!_archive.openArchivedFile(filename))
errorFileNotFound(filename);
- _vm->_gfx->parseBackground(_archive);
+ parseBackground(_archive);
byte *bg = (byte*)calloc(1, SCREEN_WIDTH*SCREEN_HEIGHT);
byte *mask = (byte*)calloc(1, SCREENMASK_WIDTH*SCREEN_HEIGHT);
@@ -440,7 +472,7 @@ void Disk::loadMaskAndPath(const char *name) {
byte *maskBuf = (byte*)calloc(1, SCREENMASK_WIDTH*SCREEN_HEIGHT);
byte *pathBuf = (byte*)calloc(1, SCREENPATH_WIDTH*SCREEN_HEIGHT);
- _vm->_gfx->parseDepths(_archive);
+ parseDepths(_archive);
_archive.read(pathBuf, SCREENPATH_WIDTH*SCREEN_HEIGHT);
_archive.read(maskBuf, SCREENMASK_WIDTH*SCREEN_HEIGHT);
diff --git a/engines/parallaction/disk.h b/engines/parallaction/disk.h
index ae9e448a3c..d5bac325a1 100644
--- a/engines/parallaction/disk.h
+++ b/engines/parallaction/disk.h
@@ -86,6 +86,8 @@ private:
void loadExternalStaticCnv(const char *filename, StaticCnv *cnv);
void loadBackground(const char *filename);
void loadMaskAndPath(const char *name);
+ void parseDepths(Common::SeekableReadStream &stream);
+ void parseBackground(Common::SeekableReadStream &stream);
protected:
Archive _archive;
diff --git a/engines/parallaction/graphics.cpp b/engines/parallaction/graphics.cpp
index 054731cf4a..8411f34883 100644
--- a/engines/parallaction/graphics.cpp
+++ b/engines/parallaction/graphics.cpp
@@ -34,7 +34,6 @@ extern OSystem *g_system;
namespace Parallaction {
-uint16 _bgLayers[4];
//
// proportional font glyphs width
@@ -57,16 +56,6 @@ byte * Gfx::_buffers[];
#define PALETTE_BACKUP PALETTE_SIZE
-PaletteFxRange _palettefx[6];
-byte _palette[PALETTE_SIZE] = {
- 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0
-};
-
byte _black_palette[PALETTE_SIZE] = {
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
@@ -874,37 +863,7 @@ void Gfx::freeStaticCnv(StaticCnv *cnv) {
return;
}
-void Gfx::parseDepths(Common::SeekableReadStream &stream) {
- _bgLayers[0] = stream.readByte();
- _bgLayers[1] = stream.readByte();
- _bgLayers[2] = stream.readByte();
- _bgLayers[3] = stream.readByte();
-}
-
-void Gfx::parseBackground(Common::SeekableReadStream &stream) {
-
- stream.read(_palette, PALETTE_SIZE);
-
- parseDepths(stream);
-
- for (uint32 _si = 0; _si < 6; _si++) {
- _palettefx[_si]._timer = stream.readUint16BE();
- _palettefx[_si]._step = stream.readUint16BE();
- _palettefx[_si]._flags = stream.readUint16BE();
- _palettefx[_si]._first = stream.readByte();
- _palettefx[_si]._last = stream.readByte();
- }
-
-#if 0
- uint16 v147;
- for (v147 = 0; v147 < PALETTE_SIZE; v147++) {
- byte _al = _palette[v147];
- _palette[PALETTE_SIZE+v147] = _al / 2;
- }
-#endif
-
-}
void Gfx::setBackground(byte *background) {
memcpy(_buffers[kBitBack], background, SCREEN_WIDTH*SCREEN_HEIGHT);
diff --git a/engines/parallaction/graphics.h b/engines/parallaction/graphics.h
index 6b078fb42d..7091aa39a3 100644
--- a/engines/parallaction/graphics.h
+++ b/engines/parallaction/graphics.h
@@ -97,8 +97,6 @@ public:
// location
void setBackground(byte *background);
void setMask(byte *mask);
- void parseDepths(Common::SeekableReadStream &stream);
- void parseBackground(Common::SeekableReadStream &stream);
int16 queryMask(int16 v);
void intGrottaHackMask();
void restoreBackground(const Common::Rect& r);
@@ -139,6 +137,10 @@ public:
static Point _labelPosition[2];
static bool _proportionalFont;
+ uint16 _bgLayers[4];
+ PaletteFxRange _palettefx[6];
+ byte _palette[PALETTE_SIZE];
+
protected:
Parallaction* _vm;
diff --git a/engines/parallaction/location.cpp b/engines/parallaction/location.cpp
index e0ee7b4a81..5cec348e80 100644
--- a/engines/parallaction/location.cpp
+++ b/engines/parallaction/location.cpp
@@ -282,7 +282,7 @@ extern Job *_jEraseLabel;
void Parallaction::showSlide(const char *name) {
_disk->loadSlide(name);
- _gfx->palUnk0(_palette);
+ _gfx->palUnk0(_vm->_gfx->_palette);
_gfx->copyScreen(Gfx::kBitBack, Gfx::kBitFront);
debugC(1, kDebugLocation, "changeLocation: new background set");
@@ -418,7 +418,7 @@ void Parallaction::changeLocation(char *location) {
runJobs();
_gfx->swapBuffers();
- _gfx->palUnk0(_palette);
+ _gfx->palUnk0(_vm->_gfx->_palette);
if (_location._aCommands) {
runCommands(_location._aCommands);
debugC(1, kDebugLocation, "changeLocation: location acommands run");
diff --git a/engines/parallaction/menu.cpp b/engines/parallaction/menu.cpp
index d1b3b96e79..28d5eb1faf 100644
--- a/engines/parallaction/menu.cpp
+++ b/engines/parallaction/menu.cpp
@@ -106,19 +106,19 @@ void Menu::start() {
_vm->_gfx->setFont("slide");
_vm->_disk->loadSlide("intro");
- _vm->_gfx->palUnk0(_palette);
+ _vm->_gfx->palUnk0(_vm->_gfx->_palette);
_vm->_gfx->copyScreen(Gfx::kBitBack, Gfx::kBitFront);
g_system->delayMillis(2000);
_vm->_disk->loadSlide("minintro");
- _vm->_gfx->palUnk0(_palette);
+ _vm->_gfx->palUnk0(_vm->_gfx->_palette);
_vm->_gfx->copyScreen(Gfx::kBitBack, Gfx::kBitFront);
g_system->delayMillis(2000);
_vm->_disk->loadSlide("lingua");
- _vm->_gfx->palUnk0(_palette);
+ _vm->_gfx->palUnk0(_vm->_gfx->_palette);
_vm->_gfx->copyScreen(Gfx::kBitBack, Gfx::kBitFront);
_vm->_gfx->displayString(60, 30, "SELECT LANGUAGE");
@@ -130,7 +130,7 @@ void Menu::start() {
_vm->_disk->setLanguage(_language);
_vm->_disk->loadSlide("restore");
- _vm->_gfx->palUnk0(_palette);
+ _vm->_gfx->palUnk0(_vm->_gfx->_palette);
_vm->_gfx->copyScreen(Gfx::kBitBack, Gfx::kBitFront);
_vm->_gfx->copyScreen(Gfx::kBitBack, Gfx::kBit2);
@@ -147,7 +147,7 @@ void Menu::newGame() {
const char **v14 = introMsg3;
_vm->_disk->loadScenery("test", NULL);
- _vm->_gfx->palUnk0(_palette);
+ _vm->_gfx->palUnk0(_vm->_gfx->_palette);
_vm->_gfx->swapBuffers();
uint16 _ax = (SCREEN_WIDTH - _vm->_gfx->getStringWidth(v14[0])) / 2;
@@ -294,7 +294,7 @@ void Menu::selectCharacter() {
_vm->_gfx->copyScreen(Gfx::kBitBack, Gfx::kBitFront); //
_vm->_gfx->copyScreen(Gfx::kBitBack, Gfx::kBit2); //
- _vm->_gfx->palUnk0(_palette);
+ _vm->_gfx->palUnk0(_vm->_gfx->_palette);
while (askPassword == true) {
diff --git a/engines/parallaction/parallaction.cpp b/engines/parallaction/parallaction.cpp
index 680f7a83ad..3aecef69ab 100644
--- a/engines/parallaction/parallaction.cpp
+++ b/engines/parallaction/parallaction.cpp
@@ -458,7 +458,7 @@ void Parallaction::runGame() {
if ((_engineFlags & kEnginePauseJobs) == 0 || (_engineFlags & kEngineInventory)) {
_gfx->swapBuffers();
byte palette[PALETTE_SIZE];
- memcpy(palette, _palette, sizeof(palette));
+ memcpy(palette, _vm->_gfx->_palette, sizeof(palette));
_gfx->animatePalette(palette);
_gfx->setPalette(palette);
}