Add an additional AGI screen for 256 color data (For use with AGI256 and AGI256-2).

svn-id: r27564
This commit is contained in:
Kari Salminen 2007-06-20 22:54:51 +00:00
parent 9f1ec5cb7a
commit ae74b06756
3 changed files with 21 additions and 4 deletions

View File

@ -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;

View File

@ -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];

View File

@ -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