diff options
author | Eugene Sandulenko | 2005-03-13 23:18:59 +0000 |
---|---|---|
committer | Eugene Sandulenko | 2005-03-13 23:18:59 +0000 |
commit | 654528422dbe9174eaad34bde7bfab5b4c29739d (patch) | |
tree | 07e9547efb98795e349c0ecd775a12673be6c871 /scumm | |
parent | e7ea46c0a3bed29d8f995072c049cfdf2dd39dd6 (diff) | |
download | scummvm-rg350-654528422dbe9174eaad34bde7bfab5b4c29739d.tar.gz scummvm-rg350-654528422dbe9174eaad34bde7bfab5b4c29739d.tar.bz2 scummvm-rg350-654528422dbe9174eaad34bde7bfab5b4c29739d.zip |
Preliminary support for MM NES.
svn-id: r17133
Diffstat (limited to 'scumm')
-rw-r--r-- | scumm/costume.cpp | 194 | ||||
-rw-r--r-- | scumm/costume.h | 1 | ||||
-rw-r--r-- | scumm/gfx.cpp | 101 | ||||
-rw-r--r-- | scumm/gfx.h | 5 | ||||
-rw-r--r-- | scumm/palette.cpp | 70 | ||||
-rw-r--r-- | scumm/resource_v2.cpp | 10 | ||||
-rw-r--r-- | scumm/script_v2.cpp | 7 | ||||
-rw-r--r-- | scumm/scumm.cpp | 46 | ||||
-rw-r--r-- | scumm/scumm.h | 3 |
9 files changed, 409 insertions, 28 deletions
diff --git a/scumm/costume.cpp b/scumm/costume.cpp index 2a43fc38c4..f8946608b8 100644 --- a/scumm/costume.cpp +++ b/scumm/costume.cpp @@ -564,6 +564,185 @@ void CostumeRenderer::proc3_ami(Codec1 &v1) { } while (1); } +static const int v1MMNESLookup[25] = { + 0x00, 0x03, 0x01, 0x06, 0x08, + 0x02, 0x00, 0x07, 0x0C, 0x04, + 0x09, 0x0A, 0x12, 0x0B, 0x14, + 0x0D, 0x11, 0x0F, 0x0E, 0x10, + 0x17, 0x00, 0x01, 0x05, 0x16 +}; + +static const int v1MMNEScostTables[2][6] = { + /* desc lens offs data gfx pal */ + { 25, 27, 29, 31, 33, 35}, + { 26, 28, 30, 32, 34, 36} +}; +/** + * costume ID -> v1MMNESLookup[] -> desc -> lens & offs -> data -> Gfx & pal + */ +void LoadedCostume::loadNEScostume(void) { + const byte *src; + int frameset, framenum; + int offset, numSprites, spritesOffset, maxSprites, numAnims; + byte *table, *ptr, *patTable, *spritesDefs, *spritesOffsetTab, *numSpritesTab; + bool flip; + int palette, tile; + byte patData[16 * 256]; + int len; + int i, j; + byte x, y; + int8 x1, y1; + + _format = 0x01; + _mirror = 0; + _dataOffsets = _baseptr + 4; + + frameset = 0; + framenum = 0; + + src = _baseptr + 4; + // Cost(a) + offset = src[(frameset * 4 + framenum) * 2]; + numAnims = src[(frameset * 4 + framenum) * 2 + 1]; + + // Lookup & desc + table = _vm->getResourceAddress(rtCostume, v1MMNEScostTables[_vm->_v1MMNESCostumeSet][0]); + offset = READ_LE_UINT16(table + v1MMNESLookup[_id] * 2 + 2); + + if (v1MMNESLookup[_id] * 2 >= READ_LE_UINT16(table)) { + _numAnim = (READ_LE_UINT16(table) - v1MMNESLookup[_id] * 2) / 2; // should never happen + } else { + _numAnim = (READ_LE_UINT16(table + v1MMNESLookup[_id] * 2 + 4) - offset) / 2; + } + + // lens + numSpritesTab = _vm->getResourceAddress(rtCostume, v1MMNEScostTables[_vm->_v1MMNESCostumeSet][1]); + + // offs + spritesOffsetTab = _vm->getResourceAddress(rtCostume, v1MMNEScostTables[_vm->_v1MMNESCostumeSet][2]); + + // data + spritesDefs = _vm->getResourceAddress(rtCostume, v1MMNEScostTables[_vm->_v1MMNESCostumeSet][3]); + + // gfx + patTable = _vm->getResourceAddress(rtCostume, v1MMNEScostTables[_vm->_v1MMNESCostumeSet][4]); + + for (int frameNum = 0; frameNum < _numAnim; frameNum++) { + offset = READ_LE_UINT16(table + v1MMNESLookup[_id] * 2 + 2 + frameNum * 2); + numSprites = numSpritesTab[offset + 2] + 1; + spritesOffset = READ_LE_UINT16(spritesOffsetTab + offset * 2 + 2); + + + //printf("spritesOffset: %x", spritesOffset); + ptr = spritesDefs + spritesOffset + 2; + + byte mask; + // decode costumegfx and get data + maxSprites = patTable[3]; + len = READ_LE_UINT16(patTable); + + j = 0; + i = 3; + while (i < len) { + if (patTable[i] > 0x80) { + for (int cnt = (patTable[i++] & ~0x80); cnt > 0; cnt--) + patData[j++] = patTable[i++]; + } else { + for (int cnt = patTable[i++]; cnt > 0; cnt--) + patData[j++] = patTable[i]; + i++; + } + } + /* + printf("extracted len: %d", j); + + for (j = 0; j < 5; j++) { + for (i = 0; i < 16; i++) + printf("%02x ", patData[j * 16 + i]); + printf("\n"); + } + */ + + byte pic[256][256]; + for (i = 0; i < 256; i++) + for(j = 0; j < 256; j++) + pic[i][j] = ' '; + + for (int spr = 0; spr < numSprites; spr++) { + flip = ((*ptr & 0x80) != 0); + + y1 = *ptr++; + y1 |= (int8)0x80; + y1 += (int8)0x80; + y = y1; + + tile = *ptr++; + + x1 = *ptr >> 2; + + if (*ptr & 0x80) + x1 |= (int8)0xc0; + x1 += (int8)0x80; + x = x1; + + palette = *ptr++ & 0x3; + + mask = flip ? 0x01 : 0x80; + +#define SHIFT 0 + + for (i = 0; i < 8; i++) { + byte c = patData[tile * 16 + i]; + for (j = 0; j < 8; j++) { + pic[SHIFT + j + x][SHIFT + i + y] = (c & mask) ? '.' : ' '; + if (flip) + c >>= 1; + else + c <<= 1; + } + } + for (i = 0; i < 8; i++) { + byte c = patData[tile * 16 + i + 8]; + for (j = 0; j < 8; j++) { + if (pic[SHIFT + j + x][SHIFT + i + y] == '.') + pic[SHIFT + j + x][SHIFT + i + y] = (c & mask) ? '#' : '.'; + else + pic[SHIFT + j + x][SHIFT + i + y] = (c & mask) ? '*' : ' '; + if (flip) + c >>= 1; + else + c <<= 1; + } + } + //printf("flip: %d (%d), tile: %x, x: %d, y: %d, pal: %d", flip, (tile % 1) ? flip : !flip, tile, x, y, palette); + } + + int left = 256, top = 256, right = 0, bottom = 0; + + for (i = 0; i < 256; i++) + for(j = 0; j < 256; j++) + if (pic[j][i] != ' ') { + if (left > j) + left = j; + if (right < j) + right = j; + if (top > i) + top = i; + if (bottom < i) + bottom = i; + } + + /* + for (i = top; i <= bottom; i++) { + for(j = left; j <= right; j++) + printf("%c", pic[j][i]); + printf("\n"); + } + */ + } + +} + void LoadedCostume::loadCostume(int id) { _id = id; byte *ptr = _vm->getResourceAddress(rtCostume, id); @@ -579,6 +758,10 @@ void LoadedCostume::loadCostume(int id) { _baseptr = ptr; + if (_vm->_features & GF_NES) { + loadNEScostume(); + return; + } _numAnim = ptr[6]; _format = ptr[7] & 0x7F; _mirror = (ptr[7] & 0x80) != 0; @@ -697,6 +880,13 @@ void ScummEngine::cost_decodeData(Actor *a, int frame, uint usemask) { return; } + if (_features & GF_NES) { + a->_cost.curpos[0] = 0xFFFF; + a->_cost.start[0] = 0; + a->_cost.frame[0] = frame; + return; + } + r = lc._baseptr + READ_LE_UINT16(lc._dataOffsets + anim * 2); if (r == lc._baseptr) { @@ -756,7 +946,9 @@ void CostumeRenderer::setPalette(byte *palette) { int i; byte color; - if (_loaded._format == 0x57) { + if (_vm->_features & GF_NES) { + // TODO + } else if (_loaded._format == 0x57) { memcpy(_palette, palette, 13); } else if (_vm->_features & GF_OLD_BUNDLE) { if ((_vm->VAR(_vm->VAR_CURRENT_LIGHTS) & LIGHTMODE_actor_color)) { diff --git a/scumm/costume.h b/scumm/costume.h index 3307e8a4a4..de1424bff4 100644 --- a/scumm/costume.h +++ b/scumm/costume.h @@ -47,6 +47,7 @@ public: void loadCostume(int id); byte increaseAnims(Actor *a); + void loadNEScostume(void); protected: byte increaseAnim(Actor *a, int slot); diff --git a/scumm/gfx.cpp b/scumm/gfx.cpp index 90b7ea0b8b..d99786af4d 100644 --- a/scumm/gfx.cpp +++ b/scumm/gfx.cpp @@ -184,6 +184,8 @@ Gdi::Gdi(ScummEngine *vm) { _roomPalette = vm->_roomPalette; if ((vm->_features & GF_AMIGA) && (vm->_version >= 4)) _roomPalette += 16; + if (vm->_features & GF_NES) + _NESBaseTiles = 0; _compositeBuf = 0; _textSurface.pixels = 0; @@ -211,7 +213,11 @@ void ScummEngine::initScreens(int b, int h) { initVirtScreen(kUnkVirtScreen, 0, 80, _screenWidth, 13, false, false); } } - initVirtScreen(kMainVirtScreen, 0, b, _screenWidth, h - b, true, true); + + if (_features & GF_NES) // FIXME: is it really one-buffer? + initVirtScreen(kMainVirtScreen, 0, b, _screenWidth, h - b, false, true); + else + initVirtScreen(kMainVirtScreen, 0, b, _screenWidth, h - b, true, true); initVirtScreen(kTextVirtScreen, 0, 0, _screenWidth, b, false, false); initVirtScreen(kVerbVirtScreen, 0, h, _screenWidth, _screenHeight - h, false, false); @@ -1367,7 +1373,9 @@ void Gdi::drawBitmap(const byte *ptr, VirtScreen *vs, int x, int y, const int wi dstPtr = (byte *)vs->pixels + y * vs->pitch + x * 8; if (_vm->_version == 1) { - if (_C64ObjectMode) + if (_vm->_features & GF_NES) + drawStripNES(dstPtr, vs->pitch, stripnr, height); + else if (_C64ObjectMode) drawStripC64Object(dstPtr, vs->pitch, stripnr, width, height); else drawStripC64Background(dstPtr, vs->pitch, stripnr, height); @@ -1414,8 +1422,16 @@ void Gdi::drawBitmap(const byte *ptr, VirtScreen *vs, int x, int y, const int wi useOrDecompress = true; if (_vm->_version == 1) { - mask_ptr = getMaskBuffer(x, y, 1); - drawStripC64Mask(mask_ptr, stripnr, width, height); + if (_vm->_features & GF_NES) { + //mask_ptr = getMaskBuffer(x, y, 1); + for (int ii = 0; ii < height; ii++) { + // *mask_ptr = ? // what sort of data needs to go into the mask? + //mask_ptr += _numStrips; + } + } else { + mask_ptr = getMaskBuffer(x, y, 1); + drawStripC64Mask(mask_ptr, stripnr, width, height); + } } else if (_vm->_version == 2) { // Do nothing here for V2 games - zplane was already handled. } else if (flag & dbDrawMaskOnAll) { @@ -1802,6 +1818,83 @@ void Gdi::decompressMaskImgOr(byte *dst, const byte *src, int height) const { } } +void DecodeNESTileData(const byte *src, byte *dest) { + int len = READ_LE_UINT16(src); src += 2; + const byte *end = src + len; + int numtiles = *src++; + while (src < end) { + byte data = *src++; + for (int j = 0; j < (data & 0x7F); j++) + *dest++ = (data & 0x80) ? (*src++) : (*src); + if (!(data & 0x80)) + src++; + } +} + +void Gdi::decodeNESGfx(const byte *room) { + if (_NESBaseTiles == 0) { + byte *basetiles = _vm->getResourceAddress(rtCostume,37); + _NESBaseTiles = basetiles[2]; + DecodeNESTileData(basetiles,_NESPatTable); + } + const byte *gdata = room + READ_LE_UINT16(room + 0x0A); + int tileset = *gdata++; + int width = READ_LE_UINT16(room + 0x04); + int height = READ_LE_UINT16(room + 0x06); + + DecodeNESTileData(_vm->getResourceAddress(rtCostume, 37 + tileset), _NESPatTable + _NESBaseTiles * 16); + for (int i = 0; i < 16; i++) + _NESPalette[i] = *gdata++; + for (int i = 0; i < 16; i++) { + int n = 0; + _NESNametable[i][0] = _NESNametable[i][1] = 0; + while (n < width) { + byte data = *gdata++; + for (int j = 0; j < (data & 0x7F); j++) + _NESNametable[i][2 + n++] = (data & 0x80) ? (*gdata++) : (*gdata); + if (!(data & 0x80)) + gdata++; + } + _NESNametable[i][width+2] = _NESNametable[i][width+3] = 0; + } + + const byte *adata = room + READ_LE_UINT16(room + 0x0C); + for (int n = 0; n < 64;) { + byte data = *adata++; + for (int j = 0; j < (data & 0x7F); j++) + _NESAttributes[n++] = (data & 0x80) ? (*adata++) : (*adata); + if (!(n & 7) && (width == 0x1C)) + n += 8; + if (!(data & 0x80)) + adata++; + } + + // there's another pointer at room + 0x0E, but I don't know what data it points at +} + +void Gdi::drawStripNES(byte *dst, int dstPitch, int stripnr, int height) { +// printf("drawStripNES, pitch=%i, strip=%i, height=%i\n",dstPitch,stripnr,height); + if (height != 128) + { +// debug(0,"NES room data %i (not 128) pixels high!\n",height); + height = 128; + } + height /= 8; + int x = stripnr + 2; // NES version has a 2 tile gap on each edge + for (int y = 0; y < height; y++) { + int palette = (_NESAttributes[((y << 2) & 0x30) | ((x >> 2) & 0xF)] >> (((y & 2) << 1) | (x & 2))) & 0x3; + int tile = _NESNametable[y][x]; + + for (int i = 0; i < 8; i++) { + byte c0 = _NESPatTable[tile * 16 + i]; + byte c1 = _NESPatTable[tile * 16 + i + 8]; + for (int j = 0; j < 8; j++) + dst[j] = _NESPalette[((c0 >> (7 - j)) & 1) | (((c1 >> (7 - j)) & 1) << 1) | (palette << 2)]; + dst += dstPitch; + } + } +} + void Gdi::drawStripC64Background(byte *dst, int dstPitch, int stripnr, int height) { int charIdx; height /= 8; diff --git a/scumm/gfx.h b/scumm/gfx.h index a715d94651..df55ca8a5b 100644 --- a/scumm/gfx.h +++ b/scumm/gfx.h @@ -229,12 +229,16 @@ protected: byte _C64MaskMap[4096], _C64MaskChar[4096]; bool _C64ObjectMode; + byte _NESPatTable[4096], _NESNametable[16][64], _NESAttributes[64], _NESPalette[16]; + byte _NESBaseTiles; + /* Bitmap decompressors */ bool decompressBitmap(byte *dst, int dstPitch, const byte *src, int numLinesToProcess); void drawStripEGA(byte *dst, int dstPitch, const byte *src, int height) const; void drawStripC64Object(byte *dst, int dstPitch, int stripnr, int width, int height); void drawStripC64Background(byte *dst, int dstPitch, int stripnr, int height); + void drawStripNES(byte *dst, int dstPitch, int stripnr, int height); void drawStripComplex(byte *dst, int dstPitch, const byte *src, int height, const bool transpCheck) const; void drawStripBasicH(byte *dst, int dstPitch, const byte *src, int height, const bool transpCheck) const; @@ -275,6 +279,7 @@ public: StripTable *generateStripTable(const byte *src, int width, int height, StripTable *table) const; void decodeC64Gfx(const byte *src, byte *dst, int size) const; + void decodeNESGfx(const byte *room); void drawBMAPBg(const byte *ptr, VirtScreen *vs, int startstrip); void drawBMAPObject(const byte *ptr, VirtScreen *vs, int obj, int x, int y, int w, int h); diff --git a/scumm/palette.cpp b/scumm/palette.cpp index d6abd699f8..411b4067a3 100644 --- a/scumm/palette.cpp +++ b/scumm/palette.cpp @@ -29,6 +29,76 @@ namespace Scumm { +void ScummEngine::setupNESPalette() { + setPalColor(0x00,0x6D,0x6D,0x6D); + setPalColor(0x01,0x00,0x24,0x92); + setPalColor(0x02,0x00,0x00,0xDB); + setPalColor(0x03,0x6D,0x49,0xDB); + setPalColor(0x04,0x92,0x00,0x6D); + setPalColor(0x05,0xB6,0x00,0x6D); + setPalColor(0x06,0xB6,0x24,0x00); + setPalColor(0x07,0x92,0x49,0x00); + setPalColor(0x08,0x6D,0x49,0x00); + setPalColor(0x09,0x24,0x49,0x00); + setPalColor(0x0A,0x00,0x6D,0x24); + setPalColor(0x0B,0x00,0x92,0x00); + setPalColor(0x0C,0x00,0x49,0x49); + setPalColor(0x0D,0x00,0x00,0x00); + setPalColor(0x0E,0x00,0x00,0x00); + setPalColor(0x0F,0x00,0x00,0x00); + + setPalColor(0x10,0xB6,0xB6,0xB6); + setPalColor(0x11,0x00,0x6D,0xDB); + setPalColor(0x12,0x00,0x49,0xFF); + setPalColor(0x13,0x92,0x00,0xFF); + setPalColor(0x14,0xB6,0x00,0xFF); + setPalColor(0x15,0xFF,0x00,0x92); + setPalColor(0x16,0xFF,0x00,0x00); + setPalColor(0x17,0xDB,0x6D,0x00); + setPalColor(0x18,0x92,0x6D,0x00); + setPalColor(0x19,0x24,0x92,0x00); + setPalColor(0x1A,0x00,0x92,0x00); + setPalColor(0x1B,0x00,0xB6,0x6D); + setPalColor(0x1C,0x00,0x92,0x92); + setPalColor(0x1D,0x00,0x00,0x00); + setPalColor(0x1E,0x00,0x00,0x00); + setPalColor(0x1F,0x00,0x00,0x00); + + setPalColor(0x20,0xFF,0xFF,0xFF); + setPalColor(0x21,0x6D,0xB6,0xFF); + setPalColor(0x22,0x92,0x92,0xFF); + setPalColor(0x23,0xDB,0x6D,0xFF); + setPalColor(0x24,0xFF,0x00,0xFF); + setPalColor(0x25,0xFF,0x6D,0xFF); + setPalColor(0x26,0xFF,0x92,0x00); + setPalColor(0x27,0xFF,0xB6,0x00); + setPalColor(0x28,0xDB,0xDB,0x00); + setPalColor(0x29,0x6D,0xDB,0x00); + setPalColor(0x2A,0x00,0xFF,0x00); + setPalColor(0x2B,0x49,0xFF,0xDB); + setPalColor(0x2C,0x00,0xFF,0xFF); + setPalColor(0x2D,0x00,0x00,0x00); + setPalColor(0x2E,0x00,0x00,0x00); + setPalColor(0x2F,0x00,0x00,0x00); + + setPalColor(0x30,0xFF,0xFF,0xFF); + setPalColor(0x31,0xB6,0xDB,0xFF); + setPalColor(0x32,0xDB,0xB6,0xFF); + setPalColor(0x33,0xFF,0xB6,0xFF); + setPalColor(0x34,0xFF,0x92,0xFF); + setPalColor(0x35,0xFF,0xB6,0xB6); + setPalColor(0x36,0xFF,0xDB,0x92); + setPalColor(0x37,0xFF,0xFF,0x49); + setPalColor(0x38,0xFF,0xFF,0x6D); + setPalColor(0x39,0xB6,0xFF,0x49); + setPalColor(0x3A,0x92,0xFF,0x6D); + setPalColor(0x3B,0x49,0xFF,0xDB); + setPalColor(0x3C,0x92,0xDB,0xFF); + setPalColor(0x3D,0x00,0x00,0x00); + setPalColor(0x3E,0x00,0x00,0x00); + setPalColor(0x3F,0x00,0x00,0x00); +} + void ScummEngine::setupAmigaPalette() { setPalColor( 0, 0, 0, 0); setPalColor( 1, 0, 0, 187); diff --git a/scumm/resource_v2.cpp b/scumm/resource_v2.cpp index 8890febc95..64030a6a84 100644 --- a/scumm/resource_v2.cpp +++ b/scumm/resource_v2.cpp @@ -38,7 +38,14 @@ void ScummEngine_v2::readClassicIndexFile() { _numGlobalObjects = 800; _numRooms = 55; - _numCostumes = 35; + + if (_features & GF_NES) + // costumes 25-37 are special. see v1MMNEScostTables[] in costume.cpp + // costumes 38-77 are room graphics resources, to be referenced in + _numCostumes = 77; + else + _numCostumes = 35; + _numScripts = 200; _numSounds = 100; } else if (_gameId == GID_ZAK) { @@ -165,7 +172,6 @@ void ScummEngine_v2::readIndexFile() { readClassicIndexFile(); break; case 0x4643: - error("No support for NES version"); if (!(_features & GF_NES)) error("Use maniacnes target"); printf("NES V1 game detected\n"); diff --git a/scumm/script_v2.cpp b/scumm/script_v2.cpp index 4f27b74f93..a8a25ad65d 100644 --- a/scumm/script_v2.cpp +++ b/scumm/script_v2.cpp @@ -1534,10 +1534,9 @@ void ScummEngine_v2::o2_dummy() { void ScummEngine_v2::o2_switchCostumeSet() { // NES version of maniac uses this to switch between the two // groups of costumes it has - if (_features & GF_NES) { - warning("stub: o2_switchCostumeSet()"); - fetchScriptByte(); - } else + if (_features & GF_NES) + _v1MMNESCostumeSet = fetchScriptByte(); + else o2_dummy(); } diff --git a/scumm/scumm.cpp b/scumm/scumm.cpp index f7be216687..e4fceacdd7 100644 --- a/scumm/scumm.cpp +++ b/scumm/scumm.cpp @@ -108,8 +108,6 @@ static const ScummGameSettings scumm_settings[] = { {"maniac", "Maniac Mansion", GID_MANIAC, 2, 0, 25, MDT_PCSPK, GF_SMALL_HEADER | GF_USE_KEY | GF_SMALL_NAMES | GF_16COLOR | GF_OLD_BUNDLE | GF_NO_SCALING | GF_MULTIPLE_VERSIONS, 0, 0}, - //{"maniacnes", "Maniac Mansion (NES)", GID_MANIAC, 2, 0, 25, MDT_NONE, - // GF_SMALL_HEADER | GF_USE_KEY | GF_SMALL_NAMES | GF_16COLOR | GF_OLD_BUNDLE | GF_NO_SCALING | GF_NES, 0, 0}, {"zak", "Zak McKracken and the Alien Mindbenders", GID_ZAK, 2, 0, 13, MDT_PCSPK, GF_SMALL_HEADER | GF_USE_KEY | GF_SMALL_NAMES | GF_16COLOR | GF_OLD_BUNDLE | GF_NO_SCALING | GF_MULTIPLE_VERSIONS, 0, 0}, @@ -460,6 +458,8 @@ static const ScummGameSettings multiple_versions_md5_settings[] = { GF_NEW_OPCODES | GF_USE_KEY | GF_HUMONGOUS | GF_NEW_COSTUMES, 0, 0}, {"d37c55388294b66e53e7ced3af88fa68", "Freddi Fish 2: The Case of the Haunted Schoolhouse (Demo Updated)", GID_HEGAME, 6, 100, 30, MDT_NONE, GF_NEW_OPCODES | GF_USE_KEY | GF_HUMONGOUS | GF_NEW_COSTUMES, 0, 0}, // FFHSDemo + {"c4dfc67ef4a841ec99e07bedb4667f3b", "Maniac Mansion (NES)", GID_MANIAC, 1, 0, 25, MDT_NONE, + GF_SMALL_HEADER | GF_USE_KEY | GF_SMALL_NAMES | GF_16COLOR | GF_OLD_BUNDLE | GF_NO_SCALING | GF_NES, 0, 0}, {"d4b8ee426b1afd3e53bc0cf020418cf6", "Putt-Putt and Pep's Dog on a Stick (Updated)", GID_HEGAME, 6, 98, 30, MDT_NONE, GF_NEW_OPCODES | GF_USE_KEY | GF_HUMONGOUS | GF_NEW_COSTUMES, 0, 0}, {"d4cccb5af88f3e77f370896e9ba8c5f9", "Freddi Fish 1: The Case of the Missing Kelp Seeds", GID_HEGAME, 6, 71, 30, MDT_NONE, @@ -1090,7 +1090,7 @@ ScummEngine::ScummEngine(GameDetector *detector, OSystem *syst, const ScummGameS _screenWidth = 640; _screenHeight = 480; } else if (_features & GF_NES) { - _screenWidth = 256; + _screenWidth = 224; _screenHeight = 240; } else if (_renderMode == Common::kRenderHercA || _renderMode == Common::kRenderHercG) { _features |= GF_DEFAULT_TO_1X_SCALER; @@ -1345,9 +1345,12 @@ void ScummEngine::scummInit() { // line // Original games used some kind of dynamic // color table remapping between rooms - if (_gameId == GID_MANIAC) - setupV1ManiacPalette(); - else + if (_gameId == GID_MANIAC) { + if (_features & GF_NES) + setupNESPalette(); + else + setupV1ManiacPalette(); + } else setupV1ZakPalette(); } else if (_features & GF_16COLOR) { for (i = 0; i < 16; i++) @@ -2229,8 +2232,13 @@ void ScummEngine::initRoomSubBlocks() { rmhd = (const RoomHeader *)findResourceData(MKID('RMHD'), roomptr); if (_version == 1) { - _roomWidth = roomptr[4] * 8; - _roomHeight = roomptr[5] * 8; + if (_features & GF_NES) { + _roomWidth = READ_LE_UINT16(roomptr + 4) * 8; + _roomHeight = READ_LE_UINT16(roomptr + 6) * 8; + } else { + _roomWidth = roomptr[4] * 8; + _roomHeight = roomptr[5] * 8; + } } else if (_version == 8) { _roomWidth = READ_LE_UINT32(&(rmhd->v8.width)); _roomHeight = READ_LE_UINT32(&(rmhd->v8.height)); @@ -2246,16 +2254,20 @@ void ScummEngine::initRoomSubBlocks() { // Find the room image data // if (_version == 1) { - _IM00_offs = 0; - for (i = 0; i < 4; i++){ - gdi._C64Colors[i] = roomptr[6 + i]; + if (_features & GF_NES) { + gdi.decodeNESGfx(roomptr); + } else { + _IM00_offs = 0; + for (i = 0; i < 4; i++){ + gdi._C64Colors[i] = roomptr[6 + i]; + } + gdi.decodeC64Gfx(roomptr + READ_LE_UINT16(roomptr + 10), gdi._C64CharMap, 2048); + gdi.decodeC64Gfx(roomptr + READ_LE_UINT16(roomptr + 12), gdi._C64PicMap, roomptr[4] * roomptr[5]); + gdi.decodeC64Gfx(roomptr + READ_LE_UINT16(roomptr + 14), gdi._C64ColorMap, roomptr[4] * roomptr[5]); + gdi.decodeC64Gfx(roomptr + READ_LE_UINT16(roomptr + 16), gdi._C64MaskMap, roomptr[4] * roomptr[5]); + gdi.decodeC64Gfx(roomptr + READ_LE_UINT16(roomptr + 18) + 2, gdi._C64MaskChar, READ_LE_UINT16(roomptr + READ_LE_UINT16(roomptr + 18))); + gdi._C64ObjectMode = true; } - gdi.decodeC64Gfx(roomptr + READ_LE_UINT16(roomptr + 10), gdi._C64CharMap, 2048); - gdi.decodeC64Gfx(roomptr + READ_LE_UINT16(roomptr + 12), gdi._C64PicMap, roomptr[4] * roomptr[5]); - gdi.decodeC64Gfx(roomptr + READ_LE_UINT16(roomptr + 14), gdi._C64ColorMap, roomptr[4] * roomptr[5]); - gdi.decodeC64Gfx(roomptr + READ_LE_UINT16(roomptr + 16), gdi._C64MaskMap, roomptr[4] * roomptr[5]); - gdi.decodeC64Gfx(roomptr + READ_LE_UINT16(roomptr + 18) + 2, gdi._C64MaskChar, READ_LE_UINT16(roomptr + READ_LE_UINT16(roomptr + 18))); - gdi._C64ObjectMode = true; } else if (_features & GF_OLD_BUNDLE) { _IM00_offs = READ_LE_UINT16(roomptr + 0x0A); if (_version == 2) diff --git a/scumm/scumm.h b/scumm/scumm.h index 41c924f22d..34a03aa454 100644 --- a/scumm/scumm.h +++ b/scumm/scumm.h @@ -470,6 +470,8 @@ public: int _numCharsets; // FIXME - should be protected, used by CharsetRenderer BaseCostumeRenderer* _costumeRenderer; + + int _v1MMNESCostumeSet; char *_audioNames; int32 _numAudioNames; @@ -931,6 +933,7 @@ protected: void actorFollowCamera(int act); const byte *getPalettePtr(int palindex, int room); + void setupNESPalette(); void setupAmigaPalette(); void setupHercPalette(); void setupCGAPalette(); |