Ticket #9019: 16bit_step3.patch
File 16bit_step3.patch, 6.6 KB (added by , 15 years ago) |
---|
-
dists/msvc8/scumm.vcproj
1 1 <?xml version="1.0" encoding="windows-1252"?> 2 2 <VisualStudioProject 3 3 ProjectType="Visual C++" 4 Version="8 ,00"4 Version="8.00" 5 5 Name="scumm" 6 6 ProjectGUID="{B6AFD548-63D2-40CD-A652-E87095AFCBAF}" 7 7 RootNamespace="scumm" … … 43 43 Optimization="0" 44 44 InlineFunctionExpansion="0" 45 45 AdditionalIncludeDirectories="../../;../../engines" 46 PreprocessorDefinitions="WIN32;_DEBUG;ENABLE_SCUMM_7_8;ENABLE_HE;USE_ZLIB;USE_MAD;USE_VORBIS "46 PreprocessorDefinitions="WIN32;_DEBUG;ENABLE_SCUMM_7_8;ENABLE_HE;USE_ZLIB;USE_MAD;USE_VORBIS; ENABLE_16BIT" 47 47 MinimalRebuild="true" 48 48 ExceptionHandling="1" 49 49 BasicRuntimeChecks="3" -
engines/scumm/gfx.cpp
341 341 vs->hasTwoBuffers = twobufs; 342 342 vs->xstart = 0; 343 343 vs->backBuf = NULL; 344 #ifdef ENABLE_16BIT 345 vs->bytesPerPixel = 2; 346 vs->pitch = width * 2; 347 #else 344 348 vs->bytesPerPixel = 1; 345 349 vs->pitch = width; 350 #endif 346 351 347 352 if (_game.version >= 7) { 348 353 // Increase the pitch by one; needed to accomodate the extra screen … … 586 591 vsPitch = _screenWidth * m - width * m; 587 592 588 593 } else { 594 #ifdef ENABLE_16BIT 595 vsPitch = vs->pitch - width * 2; 596 #else 589 597 vsPitch = vs->pitch - width; 598 #endif 590 599 } 591 600 592 601 … … 616 625 uint32 *dst32 = (uint32 *)_compositeBuf; 617 626 618 627 vsPitch >>= 2; 628 #ifdef ENABLE_16BIT 629 const int textPitch = (_textSurface.pitch - width * 2 * m) >> 2; 630 for (int h = height * m; h > 0; --h) { 631 for (int w = width*m; w > 0; w-=2) { 632 *dst32++ = *src32++; 633 } 634 src32 += vsPitch; 635 text32 += textPitch; 636 } 637 #else 619 638 const int textPitch = (_textSurface.pitch - width * m) >> 2; 620 639 for (int h = height * m; h > 0; --h) { 621 640 for (int w = width*m; w > 0; w-=4) { … … 640 659 text32 += textPitch; 641 660 } 642 661 #endif 662 #endif 643 663 src = _compositeBuf; 664 #ifdef ENABLE_16BIT 665 pitch = width * 2; 666 #else 644 667 pitch = width; 668 #endif 645 669 646 670 if (_renderMode == Common::kRenderHercA || _renderMode == Common::kRenderHercG) { 647 671 ditherHerc(_compositeBuf, _herculesBuf, width, &x, &y, &width, &height); … … 1053 1077 assert(src != NULL); 1054 1078 assert(dst != NULL); 1055 1079 1080 #ifdef ENABLE_16BIT 1081 if (w == srcPitch * 2 && w == dstPitch * 2) { 1082 memcpy(dst, src, w*h*2); 1083 } else { 1084 do { 1085 memcpy(dst, src, w * 2); 1086 dst += dstPitch; 1087 src += srcPitch; 1088 } while (--h); 1089 } 1090 #else 1056 1091 if (w == srcPitch && w == dstPitch) { 1057 1092 memcpy(dst, src, w*h); 1058 1093 } else { … … 1062 1097 src += srcPitch; 1063 1098 } while (--h); 1064 1099 } 1100 #endif 1065 1101 } 1066 1102 1067 1103 static void fill(byte *dst, int dstPitch, byte color, int w, int h) { -
engines/scumm/gfx.h
155 155 } 156 156 157 157 byte *getPixels(int x, int y) const { 158 #ifdef ENABLE_16BIT 159 return (byte *)pixels + xstart * 2 + y * pitch + x * 2; 160 #else 158 161 return (byte *)pixels + xstart + y * pitch + x; 162 #endif 159 163 } 160 164 161 165 byte *getBackPixels(int x, int y) const { 166 #ifdef ENABLE_16BIT 167 return (byte *)backBuf + xstart * 2 + y * pitch + x * 2; 168 #else 162 169 return (byte *)backBuf + xstart + y * pitch + x; 170 #endif 163 171 } 164 172 }; 165 173 -
engines/scumm/he/intern_he.h
543 543 byte _debugInputBuffer[256]; 544 544 public: 545 545 ScummEngine_v100he(OSystem *syst, const DetectorResult &dr) : ScummEngine_v99he(syst, dr) {} 546 547 546 virtual void resetScumm(); 547 #ifdef ENABLE_16BIT 548 //HACK: This is a temporary hack to override the normal class methods to get 549 //an engine that just renders the desired freddicove demo background instead 550 virtual Common::Error run(); 551 virtual Common::Error go(); 552 #endif 548 553 549 554 protected: 550 555 virtual void setupOpcodes(); -
engines/scumm/he/wiz_he.cpp
567 567 int h = r1.height(); 568 568 int w = r1.width(); 569 569 src += r1.left + r1.top * srcw * 2; 570 #ifdef ENABLE_16BIT 571 uint16 *dst16 = (uint16 *) dst; 572 dst16 += r2.left + r2.top * dstw; 573 while (h--) { 574 for (int i = 0; i < w; ++ i) { 575 dst16[i] = READ_LE_UINT16(src + 2 * i); 576 } 577 src += srcw * 2; 578 dst16 += dstw; 579 } 580 #else 570 581 dst += r2.left + r2.top * dstw; 571 582 while (h--) { 572 583 for (int i = 0; i < w; ++i) { … … 583 594 src += srcw * 2; 584 595 dst += dstw; 585 596 } 597 #endif 586 598 } 587 599 } 588 600 -
engines/scumm/scumm.cpp
523 523 524 524 // Allocate gfx compositing buffer (not needed for V7/V8 games). 525 525 if (_game.version < 7) 526 #ifdef ENABLE_16BIT 527 _compositeBuf = (byte *)malloc(_screenWidth * _screenHeight * 2); 528 #else 526 529 _compositeBuf = (byte *)malloc(_screenWidth * _screenHeight); 530 #endif 527 531 else 528 532 _compositeBuf = 0; 529 533 … … 1201 1205 } 1202 1206 1203 1207 free(_compositeBuf); 1208 #ifdef ENABLE_16BIT 1209 _compositeBuf = (byte *)malloc(_screenWidth * _textSurfaceMultiplier * _screenHeight * _textSurfaceMultiplier * 2); 1210 #else 1204 1211 _compositeBuf = (byte *)malloc(_screenWidth * _textSurfaceMultiplier * _screenHeight * _textSurfaceMultiplier); 1212 #endif 1205 1213 } 1206 1214 1207 1215 #ifdef ENABLE_SCUMM_7_8 … … 1564 1572 1565 1573 memset(_debugInputBuffer, 0, sizeof(_debugInputBuffer)); 1566 1574 } 1575 #ifdef ENABLE_16BIT 1576 Common::Error ScummEngine_v100he::run() { 1577 Common::Error err; 1578 err = init(); 1579 if (err != Common::kNoError) 1580 return err; 1581 return go(); 1582 } 1583 Common::Error ScummEngine_v100he::go() { 1584 if (_game.features & GF_16BIT_COLOR) { 1585 1586 int diff = 0; // Duration of one loop iteration 1587 1588 // Get the background resource 1589 uint16 t = 0; 1590 while (!shouldQuit()) { 1591 //Draw the background 1592 for (int16 i = 316, x = 0; x < 640; i++, x += 80) 1593 _wiz->drawWizImage(i, 0, x, 0, 0, 0, 0, 0, 0, 0, 0); 1594 1595 //Update the screen 1596 drawStripToScreen(&_virtscr[kMainVirtScreen],0,640,0,480); 1597 _system->updateScreen(); 1598 1599 // Don't use 100% cpu time 1600 _system->delayMillis(17); // approx 60 fps 1601 parseEvents(); 1602 } 1603 1604 return Common::kNoError; 1605 } 1606 return ScummEngine_v99he::go(); 1607 } 1567 1608 #endif 1609 #endif 1568 1610 1569 1611 void ScummEngine::setupMusic(int midi) { 1570 1612 int midiDriver = MidiDriver::detectMusicDriver(midi);