aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorKari Salminen2007-06-20 22:54:51 +0000
committerKari Salminen2007-06-20 22:54:51 +0000
commitae74b067561e72f2804b39eed0cc6279efc32580 (patch)
treeb81160bfcbf711fdcf21ed051b625689e0dda6e8
parent9f1ec5cb7af887372e0ec75c1a668aa55000846f (diff)
downloadscummvm-rg350-ae74b067561e72f2804b39eed0cc6279efc32580.tar.gz
scummvm-rg350-ae74b067561e72f2804b39eed0cc6279efc32580.tar.bz2
scummvm-rg350-ae74b067561e72f2804b39eed0cc6279efc32580.zip
Add an additional AGI screen for 256 color data (For use with AGI256 and AGI256-2).
svn-id: r27564
-rw-r--r--engines/agi/agi.cpp11
-rw-r--r--engines/agi/agi.h9
-rw-r--r--engines/agi/graphics.cpp5
3 files changed, 21 insertions, 4 deletions
diff --git a/engines/agi/agi.cpp b/engines/agi/agi.cpp
index a9f2696880..eebce5f841 100644
--- a/engines/agi/agi.cpp
+++ b/engines/agi/agi.cpp
@@ -412,6 +412,10 @@ int AgiEngine::agiInit() {
if (getFeatures() & GF_AGDS)
_game.gameFlags |= ID_AGDS;
+ // Make the 256 color AGI screen the default AGI screen when AGI256 or AGI256-2 is used
+ if (getFeatures() & (GF_AGI256 | GF_AGI256_2))
+ _game.sbuf = _game.sbuf256c;
+
if (_game.gameFlags & ID_AMIGA)
report("Amiga padded game detected.\n");
@@ -645,7 +649,10 @@ void AgiEngine::initialize() {
_game.name[0] = '\0';
- _game.sbuf = (uint8 *)calloc(_WIDTH, _HEIGHT);
+ _game.sbufOrig = (uint8 *)calloc(_WIDTH, _HEIGHT * 2); // Allocate space for two AGI screens vertically
+ _game.sbuf16c = _game.sbufOrig + SBUF16_OFFSET; // Make sbuf16c point to the 16 color (+control line & priority info) AGI screen
+ _game.sbuf256c = _game.sbufOrig + SBUF256_OFFSET; // Make sbuf256c point to the 256 color AGI screen
+ _game.sbuf = _game.sbuf16c; // Make sbuf point to the 16 color (+control line & priority info) AGI screen by default
_gfx->initVideo();
_sound->initSound();
@@ -673,7 +680,7 @@ AgiEngine::~AgiEngine() {
delete _sound;
_gfx->deinitVideo();
delete _sprites;
- free(_game.sbuf);
+ free(_game.sbufOrig);
_gfx->deinitMachine();
delete _rnd;
delete _console;
diff --git a/engines/agi/agi.h b/engines/agi/agi.h
index 59e0484c4b..56ae1288b8 100644
--- a/engines/agi/agi.h
+++ b/engines/agi/agi.h
@@ -371,7 +371,14 @@ struct AgiGame {
char cursorChar;
unsigned int colorFg;
unsigned int colorBg;
- uint8 *sbuf; /**< 160x168 AGI screen buffer */
+#define SBUF16_OFFSET 0
+#define SBUF256_OFFSET ((_WIDTH) * (_HEIGHT))
+#define FROM_SBUF16_TO_SBUF256_OFFSET ((SBUF256_OFFSET) - (SBUF16_OFFSET))
+#define FROM_SBUF256_TO_SBUF16_OFFSET ((SBUF16_OFFSET) - (SBUF256_OFFSET))
+ uint8 *sbufOrig; /**< Pointer to the 160x336 AGI screen buffer that contains vertically two 160x168 screens (16 color and 256 color). */
+ uint8 *sbuf16c; /**< 160x168 16 color (+control line & priority information) AGI screen buffer. Points at sbufOrig + SBUF16_OFFSET. */
+ uint8 *sbuf256c; /**< 160x168 256 color AGI screen buffer (For AGI256 and AGI256-2 support). Points at sbufOrig + SBUF256_OFFSET. */
+ uint8 *sbuf; /**< Currently chosen AGI screen buffer (sbuf256c if AGI256 or AGI256-2 is used, otherwise sbuf16c). */
/* player command line */
AgiWord egoWords[MAX_WORDS];
diff --git a/engines/agi/graphics.cpp b/engines/agi/graphics.cpp
index 5185031569..266868d454 100644
--- a/engines/agi/graphics.cpp
+++ b/engines/agi/graphics.cpp
@@ -398,7 +398,10 @@ GfxMgr::GfxMgr(AgiEngine *vm) : _vm(vm) {
* |
* Layer 2: 320x200 ================== AGI engine screen (console), put_pixel()
* |
- * Layer 1: 160x168 ================== AGI screen
+ * Layer 1: 160x336 ================== AGI screen
+ *
+ * Upper half (160x168) of Layer 1 is for the normal 16 color & control line/priority info.
+ * Lower half (160x168) of Layer 1 is for the 256 color information (Used with AGI256 & AGI256-2).
*/
#define SHAKE_MAG 3