Ticket #8619: agipal.diff
File agipal.diff, 2.8 KB (added by , 18 years ago) |
---|
-
graphics.cpp
22 22 * 23 23 */ 24 24 25 #include "common/file.h" 25 26 #include "common/stdafx.h" 26 27 27 28 #include "graphics/cursorman.h" … … 375 376 g_system->setPalette(pal, 0, 32); 376 377 } 377 378 379 //Gets AGIPAL Data 380 void GfxMgr::setAGIPal(int p0) { 381 //report("Using AGIPAL hack\n"); 382 Common::File agipal; 383 384 char filename[15]; 385 uint32 fileSize; 386 sprintf(filename, "pal.%d", p0); 387 agipal.open(filename); 388 fileSize = agipal.size(); 389 byte *_palData = (byte *)malloc(fileSize); 390 agipal.read(_palData, fileSize); 391 agipal.close(); 392 393 //Chunk0 holds colors 0-7 394 for (int i = 0; i <= 23; i++) 395 agipalPalette[i] = _palData[i]; 396 397 //Chunk1 is the same as the chunk0 398 //Chunk2 chunk holds colors 8-15 399 for (int i = 24; i <= 71; i++) 400 agipalPalette[i] = _palData[i+24]; 401 402 //Chunk3 is the same as the chunk2 403 //Chunks4-7 are duplicates of chunks0-3 404 405 useAGIPal = 1; 406 deinitVideo(); 407 initVideo(); 408 free(_palData); 409 _palData = 0; 410 for (int j=0; j<48; j++) 411 agipalPalette[j]=0; 412 } 413 378 414 /* put a block onto the screen */ 379 415 void GfxMgr::gfxPutBlock(int x1, int y1, int x2, int y2) { 380 416 if (x1 >= GFX_WIDTH) … … 407 443 * @see deinit_video() 408 444 */ 409 445 int GfxMgr::initVideo() { 410 if (_vm->_renderMode == Common::kRenderEGA) 411 initPalette(egaPalette); 412 else 413 initPalette(newPalette); 446 if (useAGIPal) { 447 initPalette(agipalPalette); 448 useAGIPal = 0; 449 } else 450 if (_vm->_renderMode == Common::kRenderEGA) 451 initPalette(egaPalette); 452 else 453 initPalette(newPalette); 414 454 415 455 if ((_agiScreen = (uint8 *)calloc(GFX_WIDTH, GFX_HEIGHT)) == NULL) 416 456 return errNotEnoughMemory; -
graphics.h
46 46 47 47 uint8 *_shakeH, *_shakeV; 48 48 49 bool useAGIPal; 50 uint8 agipalPalette[16 * 3]; 51 49 52 public: 50 53 GfxMgr(AgiEngine *vm) { 51 54 _vm = vm; 52 55 _shakeH = NULL; 53 56 _shakeV = NULL; 57 useAGIPal = 0; 54 58 } 55 59 56 60 void gfxPutBlock(int x1, int y1, int x2, int y2); … … 80 84 void saveBlock(int, int, int, int, uint8 *); 81 85 void restoreBlock(int, int, int, int, uint8 *); 82 86 void initPalette(uint8 *); 87 void setAGIPal(int); 83 88 void drawFrame(int x1, int y1, int x2, int y2, int c1, int c2); 84 89 85 90 void putPixel(int, int, int); -
op_cmd.cpp
1231 1231 * set the palette. 1232 1232 */ 1233 1233 if ((g_agi->getFeatures() & GF_AGIPAL) && p0 >= 100 && p0 < 110) { 1234 report("not implemented: AGIPAL palettes\n");1235 1234 g_gfx->setAGIPal(p0); 1235 return; 1236 1236 } else 1237 1237 g_gfx->shakeStart(); 1238 1238