Ticket #8619: agipalNew.diff

File agipalNew.diff, 2.1 KB (added by SF/mthreepwood, 17 years ago)

Updated Patch x2

  • graphics.cpp

     
    2222 *
    2323 */
    2424
     25#include "common/file.h"
    2526#include "common/stdafx.h"
    2627
    2728#include "graphics/cursorman.h"
     
    375376        g_system->setPalette(pal, 0, 32);
    376377}
    377378
     379//Gets AGIPAL Data
     380void 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 < 8 * 3; i++)
     395                _agipalPalette[i] = palData[i];
     396       
     397
     398        //Chunk1 is the same as the chunk0
     399        //Chunk2 chunk holds colors 8-15
     400        int pos = 8 * 3 * 2;
     401        for (int i = 24; i < 8 * 3 * 2; i++)
     402                _agipalPalette[i] = palData[pos + i];
     403
     404        //Chunk3 is the same as the chunk2
     405        //Chunks4-7 are duplicates of chunks0-3
     406
     407        initPalette(_agipalPalette);
     408        gfxSetPalette();
     409        free(palData);
     410        palData = 0;
     411}
     412
    378413/* put a block onto the screen */
    379414void GfxMgr::gfxPutBlock(int x1, int y1, int x2, int y2) {
    380415        if (x1 >= GFX_WIDTH)
  • graphics.h

     
    4646
    4747        uint8 *_shakeH, *_shakeV;
    4848
     49        uint8 _agipalPalette[16 * 3];
     50
    4951public:
    5052        GfxMgr(AgiEngine *vm) {
    5153                _vm = vm;
     
    8082        void saveBlock(int, int, int, int, uint8 *);
    8183        void restoreBlock(int, int, int, int, uint8 *);
    8284        void initPalette(uint8 *);
     85        void setAGIPal(int);
    8386        void drawFrame(int x1, int y1, int x2, int y2, int c1, int c2);
    8487
    8588        void putPixel(int, int, int);
  • op_cmd.cpp

     
    12311231         * set the palette.
    12321232         */
    12331233        if ((g_agi->getFeatures() & GF_AGIPAL) && p0 >= 100 && p0 < 110) {
    1234                 report("not implemented: AGIPAL palettes\n");
     1234                g_gfx->setAGIPal(p0);
    12351235                return;
    12361236        } else
    12371237                g_gfx->shakeStart();