aboutsummaryrefslogtreecommitdiff
path: root/engines
diff options
context:
space:
mode:
authorNicola Mettifogo2007-04-21 12:51:40 +0000
committerNicola Mettifogo2007-04-21 12:51:40 +0000
commitc9970a8005c8ea31dc7dcc2ca5e8da82f42321c1 (patch)
tree14d02e678d116300070a7f2739a5d6ae711c720d /engines
parent82d7f4afa905d128334a6ee726d613b0928141cc (diff)
downloadscummvm-rg350-c9970a8005c8ea31dc7dcc2ca5e8da82f42321c1.tar.gz
scummvm-rg350-c9970a8005c8ea31dc7dcc2ca5e8da82f42321c1.tar.bz2
scummvm-rg350-c9970a8005c8ea31dc7dcc2ca5e8da82f42321c1.zip
- Implemented Amiga halfbrite mode in palette code, though usage is limited to displayItemComment() for the moment.
- Some changes to palette routines to make them fit with the new scheme. svn-id: r26553
Diffstat (limited to 'engines')
-rw-r--r--engines/parallaction/callables.cpp2
-rw-r--r--engines/parallaction/graphics.cpp64
-rw-r--r--engines/parallaction/graphics.h7
-rw-r--r--engines/parallaction/location.cpp10
-rw-r--r--engines/parallaction/menu.cpp12
-rw-r--r--engines/parallaction/zone.cpp4
6 files changed, 68 insertions, 31 deletions
diff --git a/engines/parallaction/callables.cpp b/engines/parallaction/callables.cpp
index ec3f713b7f..340ee08951 100644
--- a/engines/parallaction/callables.cpp
+++ b/engines/parallaction/callables.cpp
@@ -362,7 +362,7 @@ void _c_finito(void *parm) {
cleanInventory();
refreshInventory(_vm->_characterName);
- _vm->_gfx->extendPalette(_vm->_gfx->_palette);
+ _vm->_gfx->setPalette(_vm->_gfx->_palette);
if (gameCompleted) {
_vm->_gfx->setFont(kFontMenu);
diff --git a/engines/parallaction/graphics.cpp b/engines/parallaction/graphics.cpp
index 818befaa95..3d8bddff7f 100644
--- a/engines/parallaction/graphics.cpp
+++ b/engines/parallaction/graphics.cpp
@@ -119,19 +119,44 @@ void Gfx::drawBalloon(const Common::Rect& r, uint16 winding) {
void Gfx::setPalette(Palette pal, uint32 first, uint32 num) {
// printf("setPalette(%i, %i)\n", first, num);
- if (first + num > PALETTE_COLORS)
+ if (first + num > BASE_PALETTE_COLORS)
error("wrong parameters for setPalette()");
- byte syspal[PALETTE_COLORS*4];
+ byte sysBasePal[EHB_PALETTE_COLORS*4];
+ byte sysExtraPal[BASE_PALETTE_COLORS*4];
+ byte r, g, b;
+ uint32 j = 0;
for (uint32 i = first; i < first+num; i++) {
- syspal[i*4] = (pal[i*3] << 2) | (pal[i*3] >> 4);
- syspal[i*4+1] = (pal[i*3+1] << 2) | (pal[i*3+1] >> 4);
- syspal[i*4+2] = (pal[i*3+2] << 2) | (pal[i*3+2] >> 4);
- syspal[i*4+3] = 0;
+ r = (pal[i*3] << 2) | (pal[i*3] >> 4);
+ g = (pal[i*3+1] << 2) | (pal[i*3+1] >> 4);
+ b = (pal[i*3+2] << 2) | (pal[i*3+2] >> 4);
+
+ sysBasePal[j*4] = r;
+ sysBasePal[j*4+1] = g;
+ sysBasePal[j*4+2] = b;
+ sysBasePal[j*4+3] = 0;
+
+ if (_vm->getPlatform() == Common::kPlatformAmiga) {
+ sysExtraPal[j*4] = r >> 1;
+ sysExtraPal[j*4+1] = g >> 1;
+ sysExtraPal[j*4+2] = b >> 1;
+ sysExtraPal[j*4+3] = 0;
+ } else {
+ sysExtraPal[j*4] = 0;
+ sysExtraPal[j*4+1] = 0;
+ sysExtraPal[j*4+2] = 0;
+ sysExtraPal[j*4+3] = 0;
+ }
+
+ j++;
}
- g_system->setPalette(syspal, first, num);
+ g_system->setPalette(sysBasePal, first, num);
+
+ if (_vm->getPlatform() == Common::kPlatformAmiga)
+ g_system->setPalette(sysExtraPal, first+FIRST_EHB_COLOR, num);
+
g_system->updateScreen();
return;
@@ -197,7 +222,7 @@ void Gfx::animatePalette() {
}
void Gfx::fadePalette(Palette pal) {
- for (uint16 i = 0; i < PALETTE_SIZE; i++)
+ for (uint16 i = 0; i < BASE_PALETTE_COLORS * 3; i++)
if (pal[i] < _palette[i]) pal[i]++;
return;
@@ -221,7 +246,7 @@ void Gfx::buildBWPalette(Palette pal) {
void Gfx::quickFadePalette(Palette pal) {
- for (uint16 i = 0; i < PALETTE_SIZE; i++) {
+ for (uint16 i = 0; i < BASE_PALETTE_COLORS * 3; i++) {
if (pal[i] == _palette[i]) continue;
pal[i] += (pal[i] < _palette[i] ? 4 : -4);
}
@@ -229,17 +254,20 @@ void Gfx::quickFadePalette(Palette pal) {
return;
}
-void Gfx::extendPalette(Palette pal) {
+void Gfx::setHalfbriteMode(bool enable) {
+ if (_vm->getPlatform() != Common::kPlatformAmiga) return;
+ if (enable == _halfbrite) return;
- for (uint16 i = 0; i < BASE_PALETTE_COLORS; i++) {
- pal[(i+FIRST_EHB_COLOR)*3] = pal[i*3] / 2;
- pal[(i+FIRST_EHB_COLOR)*3+1] = pal[i*3+1] / 2;
- pal[(i+FIRST_EHB_COLOR)*3+2] = pal[i*3+2] / 2;
- }
+ byte *buf = _buffers[kBitBack];
+ for (uint32 i = 0; i < SCREEN_SIZE; i++)
+ *buf++ ^= 0x20;
- setPalette(pal);
-}
+ buf = _buffers[kBitFront];
+ for (uint32 i = 0; i < SCREEN_SIZE; i++)
+ *buf++ ^= 0x20;
+ _halfbrite = !_halfbrite;
+}
void Gfx::updateScreen() {
@@ -804,6 +832,8 @@ Gfx::Gfx(Parallaction* vm) :
initMouse( 0 );
initFonts();
+ _halfbrite = false;
+
_font = NULL;
return;
diff --git a/engines/parallaction/graphics.h b/engines/parallaction/graphics.h
index 67226000e1..31cf475f19 100644
--- a/engines/parallaction/graphics.h
+++ b/engines/parallaction/graphics.h
@@ -201,13 +201,15 @@ public:
void blitCnv(StaticCnv *cnv, int16 x, int16 y, uint16 z, Gfx::Buffers buffer);
// palette
- void setPalette(Palette palette, uint32 first = FIRST_BASE_COLOR, uint32 num = PALETTE_COLORS);
+ void setPalette(Palette palette, uint32 first = FIRST_BASE_COLOR, uint32 num = BASE_PALETTE_COLORS);
void setBlackPalette();
void animatePalette();
void fadePalette(Palette palette);
void buildBWPalette(Palette palette);
void quickFadePalette(Palette palette);
- void extendPalette(Palette palette);
+
+ // amiga specific
+ void setHalfbriteMode(bool enable);
// init
Gfx(Parallaction* vm);
@@ -232,6 +234,7 @@ protected:
StaticCnv *_mouseComposedArrow;
Font *_font;
Font *_fonts[3];
+ bool _halfbrite;
protected:
byte mapChar(byte c);
diff --git a/engines/parallaction/location.cpp b/engines/parallaction/location.cpp
index c07ea94297..93c26e8671 100644
--- a/engines/parallaction/location.cpp
+++ b/engines/parallaction/location.cpp
@@ -252,7 +252,7 @@ void Parallaction::switchBackground(const char* background, const char* mask) {
_si += 3;
}
- _gfx->extendPalette(pal);
+ _gfx->setPalette(pal);
}
_disk->loadScenery(background, mask);
@@ -267,7 +267,7 @@ extern Job *_jEraseLabel;
void Parallaction::showSlide(const char *name) {
_disk->loadSlide(name);
- _gfx->extendPalette(_gfx->_palette);
+ _gfx->setPalette(_gfx->_palette);
_gfx->copyScreen(Gfx::kBitBack, Gfx::kBitFront);
debugC(1, kDebugLocation, "changeLocation: new background set");
@@ -385,7 +385,7 @@ void Parallaction::changeLocation(char *location) {
byte palette[PALETTE_SIZE];
for (uint16 _si = 0; _si < PALETTE_SIZE; _si++) palette[_si] = 0;
- _gfx->extendPalette(palette);
+ _gfx->setPalette(palette);
_gfx->copyScreen(Gfx::kBitBack, Gfx::kBitFront);
if (_location._commands.size() > 0) {
@@ -404,7 +404,7 @@ void Parallaction::changeLocation(char *location) {
runJobs();
_gfx->swapBuffers();
- _gfx->extendPalette(_gfx->_palette);
+ _gfx->setPalette(_gfx->_palette);
if (_location._aCommands.size() > 0) {
runCommands(_location._aCommands);
debugC(1, kDebugLocation, "changeLocation: location acommands run");
@@ -432,7 +432,7 @@ void Parallaction::doLocationEnterTransition() {
byte pal[PALETTE_SIZE];
_gfx->buildBWPalette(pal);
- _gfx->setPalette(pal, FIRST_BASE_COLOR, BASE_PALETTE_COLORS);
+ _gfx->setPalette(pal);
jobRunScripts(NULL, NULL);
jobEraseAnimations(NULL, NULL);
diff --git a/engines/parallaction/menu.cpp b/engines/parallaction/menu.cpp
index 0214779d90..31afcaab0d 100644
--- a/engines/parallaction/menu.cpp
+++ b/engines/parallaction/menu.cpp
@@ -108,12 +108,12 @@ void Menu::start() {
_vm->_gfx->_proportionalFont = false;
_vm->_disk->loadSlide("intro");
- _vm->_gfx->extendPalette(_vm->_gfx->_palette);
+ _vm->_gfx->setPalette(_vm->_gfx->_palette);
_vm->_gfx->copyScreen(Gfx::kBitBack, Gfx::kBitFront);
g_system->delayMillis(2000);
_vm->_disk->loadSlide("minintro");
- _vm->_gfx->extendPalette(_vm->_gfx->_palette);
+ _vm->_gfx->setPalette(_vm->_gfx->_palette);
_vm->_gfx->copyScreen(Gfx::kBitBack, Gfx::kBitFront);
g_system->delayMillis(2000);
@@ -121,7 +121,7 @@ void Menu::start() {
_vm->_gfx->setFont(kFontMenu);
_vm->_disk->loadSlide("lingua");
- _vm->_gfx->extendPalette(_vm->_gfx->_palette);
+ _vm->_gfx->setPalette(_vm->_gfx->_palette);
_vm->_gfx->copyScreen(Gfx::kBitBack, Gfx::kBitFront);
_vm->_gfx->displayString(60, 30, "SELECT LANGUAGE");
@@ -147,7 +147,7 @@ void Menu::newGame() {
const char **v14 = introMsg3;
_vm->_disk->loadScenery("test", NULL);
- _vm->_gfx->extendPalette(_vm->_gfx->_palette);
+ _vm->_gfx->setPalette(_vm->_gfx->_palette);
_vm->_gfx->swapBuffers();
uint16 _ax = (SCREEN_WIDTH - _vm->_gfx->getStringWidth(v14[0])) / 2;
@@ -221,7 +221,7 @@ uint16 Menu::selectGame() {
_vm->_disk->loadSlide("restore");
- _vm->_gfx->extendPalette(_vm->_gfx->_palette);
+ _vm->_gfx->setPalette(_vm->_gfx->_palette);
_vm->_gfx->copyScreen(Gfx::kBitBack, Gfx::kBitFront);
_vm->_gfx->copyScreen(Gfx::kBitBack, Gfx::kBit2);
@@ -302,7 +302,7 @@ void Menu::selectCharacter() {
_vm->_gfx->copyScreen(Gfx::kBitBack, Gfx::kBitFront); //
_vm->_gfx->copyScreen(Gfx::kBitBack, Gfx::kBit2); //
- _vm->_gfx->extendPalette(_vm->_gfx->_palette);
+ _vm->_gfx->setPalette(_vm->_gfx->_palette);
while (askPassword == true) {
diff --git a/engines/parallaction/zone.cpp b/engines/parallaction/zone.cpp
index 08ba5d20d2..f3cb12f7ca 100644
--- a/engines/parallaction/zone.cpp
+++ b/engines/parallaction/zone.cpp
@@ -336,6 +336,8 @@ void Parallaction::displayItemComment(ExamineData *data) {
if (data->_description == NULL) return;
+ _gfx->setHalfbriteMode(true);
+
char v68[PATH_LEN];
strcpy(v68, data->_filename);
data->_cnv = _disk->loadStatic(v68);
@@ -357,6 +359,8 @@ void Parallaction::displayItemComment(ExamineData *data) {
_gfx->updateScreen();
waitUntilLeftClick();
+
+ _gfx->setHalfbriteMode(false);
_gfx->copyScreen(Gfx::kBitBack, Gfx::kBitFront);
return;