Ticket #8687: agi256_start_v2.patch

File agi256_start_v2.patch, 10.2 KB (added by bluegr, 17 years ago)

AGI256 starting point, version 2

  • detection.cpp

     
    16121612        FANMADE("AGI Quest (v1.46-TJ0)", "1cf1a5307c1a0a405f5039354f679814"),
    16131613        FANMADE_I("tetris", "", "7a874e2db2162e7a4ce31c9130248d8a"),
    16141614        FANMADE_V("AGI Trek (Demo)", "c02882b8a8245b629c91caf7eb78eafe", 0x2440),
    1615         FANMADE("AGI256 Demo", "79261ac143b2e2773b2753674733b0d5"),
    1616         FANMADE("AGI256-2 Demo", "3cad9b3aff1467cebf0c5c5b110985c5"),
     1615        FANMADE_F("AGI256 Demo", "79261ac143b2e2773b2753674733b0d5", GF_AGI256),
     1616        FANMADE_F("AGI256-2 Demo", "3cad9b3aff1467cebf0c5c5b110985c5", GF_AGI256_2),
    16171617        FANMADE_LF("Abrah: L'orphelin de l'espace (v1.2)", "b7b6d1539e14d5a26fa3088288e1badc", Common::FR_FRA, GF_AGIPAL),
    16181618        FANMADE("Acidopolis", "7017db1a4b726d0d59e65e9020f7d9f7"),
    16191619        FANMADE("Agent 0055 (v1.0)", "c2b34a0c77acb05482781dda32895f24"),
     
    16481648        FANMADE("DG: The Adventure Game (English v1.1)", "0d6376d493fa7a21ec4da1a063e12b25"),
    16491649        FANMADE_L("DG: The Adventure Game (French v1.1)", "258bdb3bb8e61c92b71f2f456cc69e23", Common::FR_FRA),
    16501650        FANMADE("Dashiki (16 Colors)", "9b2c7b9b0283ab9f12bedc0cb6770a07"),
    1651         FANMADE_F("Dashiki (256 Colors)", "c68052bb209e23b39b55ff3d759958e6", GF_AGIMOUSE),
     1651        FANMADE_F("Dashiki (256 Colors)", "c68052bb209e23b39b55ff3d759958e6", GF_AGIMOUSE|GF_AGI256),
    16521652        FANMADE("Date Quest 1 (v1.0)", "ba3dcb2600645be53a13170aa1a12e69"),
    16531653        FANMADE("Date Quest 2 (v1.0 Demo)", "1602d6a2874856e928d9a8c8d2d166e9"),
    16541654        FANMADE("Date Quest 2 (v1.0)", "f13f6fc85aa3e6e02b0c20408fb63b47"),
  • graphics.cpp

     
    8989        0x3F, 0x3F, 0x3F
    9090};
    9191
     92uint8 vgaPalette[256 * 3] = {
     93        0x00, 0x00, 0x00,
     94        0x00, 0x00, 0xA8,
     95        0x00, 0xA8, 0x00,
     96        0x00, 0xA8, 0xA8,
     97        0xA8, 0x00, 0x00,
     98        0xA8, 0x00, 0xA8,
     99        0xA8, 0x54, 0x00,
     100        0xA8, 0xA8, 0xA8,
     101        0x54, 0x54, 0x54,
     102        0x54, 0x54, 0xFC,
     103        0x54, 0xFC, 0x54,
     104        0x54, 0xFC, 0xFC,
     105        0xFC, 0x54, 0x54,
     106        0xFC, 0x54, 0xFC,
     107        0xFC, 0xFC, 0x54,
     108        0xFC, 0xFC, 0xFC,
     109        0x00, 0x00, 0x00,
     110        0x14, 0x14, 0x14,
     111        0x20, 0x20, 0x20,
     112        0x2C, 0x2C, 0x2C,
     113        0x38, 0x38, 0x38,
     114        0x44, 0x44, 0x44,
     115        0x50, 0x50, 0x50,
     116        0x60, 0x60, 0x60,
     117        0x70, 0x70, 0x70,
     118        0x80, 0x80, 0x80,
     119        0x90, 0x90, 0x90,
     120        0xA0, 0xA0, 0xA0,
     121        0xB4, 0xB4, 0xB4,
     122        0xC8, 0xC8, 0xC8,
     123        0xE0, 0xE0, 0xE0,
     124        0xFC, 0xFC, 0xFC,
     125        0x00, 0x00, 0xFC,
     126        0x40, 0x00, 0xFC,
     127        0x7C, 0x00, 0xFC,
     128        0xBC, 0x00, 0xFC,
     129        0xFC, 0x00, 0xFC,
     130        0xFC, 0x00, 0xBC,
     131        0xFC, 0x00, 0x7C,
     132        0xFC, 0x00, 0x40,
     133        0xFC, 0x00, 0x00,
     134        0xFC, 0x40, 0x00,
     135        0xFC, 0x7C, 0x00,
     136        0xFC, 0xBC, 0x00,
     137        0xFC, 0xFC, 0x00,
     138        0xBC, 0xFC, 0x00,
     139        0x7C, 0xFC, 0x00,
     140        0x40, 0xFC, 0x00,
     141        0x00, 0xFC, 0x00,
     142        0x00, 0xFC, 0x40,
     143        0x00, 0xFC, 0x7C,
     144        0x00, 0xFC, 0xBC,
     145        0x00, 0xFC, 0xFC,
     146        0x00, 0xBC, 0xFC,
     147        0x00, 0x7C, 0xFC,
     148        0x00, 0x40, 0xFC,
     149        0x7C, 0x7C, 0xFC,
     150        0x9C, 0x7C, 0xFC,
     151        0xBC, 0x7C, 0xFC,
     152        0xDC, 0x7C, 0xFC,
     153        0xFC, 0x7C, 0xFC,
     154        0xFC, 0x7C, 0xDC,
     155        0xFC, 0x7C, 0xBC,
     156        0xFC, 0x7C, 0x9C,
     157        0xFC, 0x7C, 0x7C,
     158        0xFC, 0x9C, 0x7C,
     159        0xFC, 0xBC, 0x7C,
     160        0xFC, 0xDC, 0x7C,
     161        0xFC, 0xFC, 0x7C,
     162        0xDC, 0xFC, 0x7C,
     163        0xBC, 0xFC, 0x7C,
     164        0x9C, 0xFC, 0x7C,
     165        0x7C, 0xFC, 0x7C,
     166        0x7C, 0xFC, 0x9C,
     167        0x7C, 0xFC, 0xBC,
     168        0x7C, 0xFC, 0xDC,
     169        0x7C, 0xFC, 0xFC,
     170        0x7C, 0xDC, 0xFC,
     171        0x7C, 0xBC, 0xFC,
     172        0x7C, 0x9C, 0xFC,
     173        0xB4, 0xB4, 0xFC,
     174        0xC4, 0xB4, 0xFC,
     175        0xD8, 0xB4, 0xFC,
     176        0xE8, 0xB4, 0xFC,
     177        0xFC, 0xB4, 0xFC,
     178        0xFC, 0xB4, 0xE8,
     179        0xFC, 0xB4, 0xD8,
     180        0xFC, 0xB4, 0xC4,
     181        0xFC, 0xB4, 0xB4,
     182        0xFC, 0xC4, 0xB4,
     183        0xFC, 0xD8, 0xB4,
     184        0xFC, 0xE8, 0xB4,
     185        0xFC, 0xFC, 0xB4,
     186        0xE8, 0xFC, 0xB4,
     187        0xD8, 0xFC, 0xB4,
     188        0xC4, 0xFC, 0xB4,
     189        0xB4, 0xFC, 0xB4,
     190        0xB4, 0xFC, 0xC4,
     191        0xB4, 0xFC, 0xD8,
     192        0xB4, 0xFC, 0xE8,
     193        0xB4, 0xFC, 0xFC,
     194        0xB4, 0xE8, 0xFC,
     195        0xB4, 0xD8, 0xFC,
     196        0xB4, 0xC4, 0xFC,
     197        0x00, 0x00, 0x70,
     198        0x1C, 0x00, 0x70,
     199        0x38, 0x00, 0x70,
     200        0x54, 0x00, 0x70,
     201        0x70, 0x00, 0x70,
     202        0x70, 0x00, 0x54,
     203        0x70, 0x00, 0x38,
     204        0x70, 0x00, 0x1C,
     205        0x70, 0x00, 0x00,
     206        0x70, 0x1C, 0x00,
     207        0x70, 0x38, 0x00,
     208        0x70, 0x54, 0x00,
     209        0x70, 0x70, 0x00,
     210        0x54, 0x70, 0x00,
     211        0x38, 0x70, 0x00,
     212        0x1C, 0x70, 0x00,
     213        0x00, 0x70, 0x00,
     214        0x00, 0x70, 0x1C,
     215        0x00, 0x70, 0x38,
     216        0x00, 0x70, 0x54,
     217        0x00, 0x70, 0x70,
     218        0x00, 0x54, 0x70,
     219        0x00, 0x38, 0x70,
     220        0x00, 0x1C, 0x70,
     221        0x38, 0x38, 0x70,
     222        0x44, 0x38, 0x70,
     223        0x54, 0x38, 0x70,
     224        0x60, 0x38, 0x70,
     225        0x70, 0x38, 0x70,
     226        0x70, 0x38, 0x60,
     227        0x70, 0x38, 0x54,
     228        0x70, 0x38, 0x44,
     229        0x70, 0x38, 0x38,
     230        0x70, 0x44, 0x38,
     231        0x70, 0x54, 0x38,
     232        0x70, 0x60, 0x38,
     233        0x70, 0x70, 0x38,
     234        0x60, 0x70, 0x38,
     235        0x54, 0x70, 0x38,
     236        0x44, 0x70, 0x38,
     237        0x38, 0x70, 0x38,
     238        0x38, 0x70, 0x44,
     239        0x38, 0x70, 0x54,
     240        0x38, 0x70, 0x60,
     241        0x38, 0x70, 0x70,
     242        0x38, 0x60, 0x70,
     243        0x38, 0x54, 0x70,
     244        0x38, 0x44, 0x70,
     245        0x50, 0x50, 0x70,
     246        0x58, 0x50, 0x70,
     247        0x60, 0x50, 0x70,
     248        0x68, 0x50, 0x70,
     249        0x70, 0x50, 0x70,
     250        0x70, 0x50, 0x68,
     251        0x70, 0x50, 0x60,
     252        0x70, 0x50, 0x58,
     253        0x70, 0x50, 0x50,
     254        0x70, 0x58, 0x50,
     255        0x70, 0x60, 0x50,
     256        0x70, 0x68, 0x50,
     257        0x70, 0x70, 0x50,
     258        0x68, 0x70, 0x50,
     259        0x60, 0x70, 0x50,
     260        0x58, 0x70, 0x50,
     261        0x50, 0x70, 0x50,
     262        0x50, 0x70, 0x58,
     263        0x50, 0x70, 0x60,
     264        0x50, 0x70, 0x68,
     265        0x50, 0x70, 0x70,
     266        0x50, 0x68, 0x70,
     267        0x50, 0x60, 0x70,
     268        0x50, 0x58, 0x70,
     269        0x00, 0x00, 0x40,
     270        0x10, 0x00, 0x40,
     271        0x20, 0x00, 0x40,
     272        0x30, 0x00, 0x40,
     273        0x40, 0x00, 0x40,
     274        0x40, 0x00, 0x30,
     275        0x40, 0x00, 0x20,
     276        0x40, 0x00, 0x10,
     277        0x40, 0x00, 0x00,
     278        0x40, 0x10, 0x00,
     279        0x40, 0x20, 0x00,
     280        0x40, 0x30, 0x00,
     281        0x40, 0x40, 0x00,
     282        0x30, 0x40, 0x00,
     283        0x20, 0x40, 0x00,
     284        0x10, 0x40, 0x00,
     285        0x00, 0x40, 0x00,
     286        0x00, 0x40, 0x10,
     287        0x00, 0x40, 0x20,
     288        0x00, 0x40, 0x30,
     289        0x00, 0x40, 0x40,
     290        0x00, 0x30, 0x40,
     291        0x00, 0x20, 0x40,
     292        0x00, 0x10, 0x40,
     293        0x20, 0x20, 0x40,
     294        0x28, 0x20, 0x40,
     295        0x30, 0x20, 0x40,
     296        0x38, 0x20, 0x40,
     297        0x40, 0x20, 0x40,
     298        0x40, 0x20, 0x38,
     299        0x40, 0x20, 0x30,
     300        0x40, 0x20, 0x28,
     301        0x40, 0x20, 0x20,
     302        0x40, 0x28, 0x20,
     303        0x40, 0x30, 0x20,
     304        0x40, 0x38, 0x20,
     305        0x40, 0x40, 0x20,
     306        0x38, 0x40, 0x20,
     307        0x30, 0x40, 0x20,
     308        0x28, 0x40, 0x20,
     309        0x20, 0x40, 0x20,
     310        0x20, 0x40, 0x28,
     311        0x20, 0x40, 0x30,
     312        0x20, 0x40, 0x38,
     313        0x20, 0x40, 0x40,
     314        0x20, 0x38, 0x40,
     315        0x20, 0x30, 0x40,
     316        0x20, 0x28, 0x40,
     317        0x2C, 0x2C, 0x40,
     318        0x30, 0x2C, 0x40,
     319        0x34, 0x2C, 0x40,
     320        0x3C, 0x2C, 0x40,
     321        0x40, 0x2C, 0x40,
     322        0x40, 0x2C, 0x3C,
     323        0x40, 0x2C, 0x34,
     324        0x40, 0x2C, 0x30,
     325        0x40, 0x2C, 0x2C,
     326        0x40, 0x30, 0x2C,
     327        0x40, 0x34, 0x2C,
     328        0x40, 0x3C, 0x2C,
     329        0x40, 0x40, 0x2C,
     330        0x3C, 0x40, 0x2C,
     331        0x34, 0x40, 0x2C,
     332        0x30, 0x40, 0x2C,
     333        0x2C, 0x40, 0x2C,
     334        0x2C, 0x40, 0x30,
     335        0x2C, 0x40, 0x34,
     336        0x2C, 0x40, 0x3C,
     337        0x2C, 0x40, 0x40,
     338        0x2C, 0x3C, 0x40,
     339        0x2C, 0x34, 0x40,
     340        0x2C, 0x30, 0x40,
     341        0x40, 0x40, 0x40,
     342        0x38, 0x38, 0x38,
     343        0x30, 0x30, 0x30,
     344        0x28, 0x28, 0x28,
     345        0x24, 0x24, 0x24,
     346        0x1C, 0x1C, 0x1C,
     347        0x14, 0x14, 0x14,
     348        0x0C, 0x0C, 0x0C
     349};
     350
    92351static uint16 cgaMap[16] = {
    93352        0x0000,                 /*  0 - black */
    94353        0x0d00,                 /*  1 - blue */
     
    374633void GfxMgr::gfxSetPalette() {
    375634        int i;
    376635        byte pal[32 * 4];
     636        byte pal256[256 * 4];
    377637
    378         for (i = 0; i < 32; i++) {
    379                 pal[i * 4 + 0] = _palette[i * 3 + 0] << 2;
    380                 pal[i * 4 + 1] = _palette[i * 3 + 1] << 2;
    381                 pal[i * 4 + 2] = _palette[i * 3 + 2] << 2;
    382                 pal[i * 4 + 3] = 0;
     638        if (!(_vm->getFeatures() & GF_AGI256 || _vm->getFeatures() & GF_AGI256_2)) {
     639                for (i = 0; i < 32; i++) {
     640                        pal[i * 4 + 0] = _palette[i * 3 + 0] << 2;
     641                        pal[i * 4 + 1] = _palette[i * 3 + 1] << 2;
     642                        pal[i * 4 + 2] = _palette[i * 3 + 2] << 2;
     643                        pal[i * 4 + 3] = 0;
     644                }
     645                g_system->setPalette(pal, 0, 32);
     646        } else {
     647                for (i = 0; i < 256; i++) {
     648                        pal256[i * 4 + 0] = vgaPalette[i * 3 + 0];
     649                        pal256[i * 4 + 1] = vgaPalette[i * 3 + 1];
     650                        pal256[i * 4 + 2] = vgaPalette[i * 3 + 2];
     651                        pal256[i * 4 + 3] = 0;
     652                }
     653                g_system->setPalette(pal256, 0, 256);
    383654        }
    384         g_system->setPalette(pal, 0, 32);
    385655}
    386656
    387657//Gets AGIPAL Data
  • op_cmd.cpp

     
    515515 * unk_181: Deactivate keypressed control (default control of ego)
    516516 */
    517517cmd(set_simple) {
    518         game.simpleSave = true;
     518        if (!(g_agi->getFeatures() & GF_AGI256 || g_agi->getFeatures() & GF_AGI256_2)) {
     519                game.simpleSave = true;
     520        } else {
     521                // This is the unk_170 command used by AGI256
     522
     523                g_sprites->eraseBoth();
     524                // Load the picture
     525                g_agi->agiLoadResource(rPICTURE, _v[p0]);
     526                // Copy it into the screen buffer
     527                g_picture->decodePicture(_v[p0], false, true);
     528                game.pictureShown = 0;
     529                g_sprites->blitBoth();
     530
     531                // Show the picture
     532                g_agi->setflag(fOutputMode, false);
     533                cmd_close_window(NULL);
     534                g_picture->showPic();
     535                game.pictureShown = 1;
     536        }
    519537}
    520538
    521539cmd(pop_script) {
  • picture.cpp

     
    617617 * This function decodes an AGI picture resource into the correct slot
    618618 * and draws it on the AGI screen, optionally clearing the screen before
    619619 * drawing.
    620  * @param n      AGI picture resource number
    621  * @param clear  clear AGI screen before drawing
     620 * @param n        AGI picture resource number
     621 * @param clear    clear AGI screen before drawing
     622 * @param load256  load an AGI256 picture resource
    622623 */
    623 int PictureMgr::decodePicture(int n, int clear) {
     624int PictureMgr::decodePicture(int n, int clear, bool load256) {
    624625        debugC(8, kDebugLevelResources, "(%d)", n);
    625626
    626627        patCode = 0;
     
    636637        if (clear)
    637638                memset(_vm->_game.sbuf, 0x4f, _WIDTH * _HEIGHT);
    638639
    639         drawPicture();
     640        if (!load256)
     641                drawPicture();
     642        else
     643                memcpy(_vm->_game.sbuf, data, flen);
    640644
    641645        if (clear)
    642646                _vm->clearImageStack();
  • picture.h

     
    6868                _gfx = gfx;
    6969        }
    7070
    71         int decodePicture(int, int);
     71        int decodePicture(int n, int clear, bool load256 = false);
    7272        int unloadPicture(int);
    7373        void showPic();
    7474        uint8 *convertV3Pic(uint8 *src, uint32 len);