Ticket #8599: AGI_MouseInSavegameDialog.patch

File AGI_MouseInSavegameDialog.patch, 1.8 KB (added by spookypeanut, 17 years ago)

Patch against revision 25111

  • savegame.cpp

     
    458458        sprintf(saveLoadSlot, "%s.%.3d", _targetName.c_str(), num);
    459459        return saveLoadSlot;
    460460}
    461 
     461       
    462462int AgiEngine::selectSlot() {
    463463        int i, key, active = 0;
    464464        int rc = -1;
    465465        int hm = 2, vm = 3;     /* box margins */
     466        int xmin, xmax, slotClicked;
    466467        char desc[NUM_SLOTS][40];
    467468
    468469        for (i = 0; i < NUM_SLOTS; i++) {
    469470                char fileName[MAX_PATH];
    470471                Common::InSaveFile *in;
    471472               
    472                 debugC(4, kDebugLevelMain | kDebugLevelSavegame, "Game id seems to be %s", _targetName.c_str());
     473                debugC(4, kDebugLevelMain | kDebugLevelSavegame, "Current game id is %s", _targetName.c_str());
    473474                sprintf(fileName, "%s", getSavegameFilename(i));
    474475                if (!(in = _saveFileMan->openForLoading(fileName))) {
    475476                        debugC(4, kDebugLevelMain | kDebugLevelSavegame, "File %s does not exist", fileName);
     
    496497                        printText(dstr, 0, hm + 1, vm + 4 + i,
    497498                                        (40 - 2 * hm) - 1, i == active ? MSG_BOX_COLOUR : MSG_BOX_TEXT,
    498499                                        i == active ? MSG_BOX_TEXT : MSG_BOX_COLOUR);
    499 
    500500                }
    501501
    502502                _gfx->pollTimer();      /* msdos driver -> does nothing */
     
    510510                        rc = -1;
    511511                        goto getout;
    512512                case BUTTON_LEFT:
     513                        xmin = (hm + 1) * CHAR_COLS;
     514                        xmax = xmin + CHAR_COLS * 34;
     515                        if ((int)g_mouse.x >= xmin && (int)g_mouse.x <= xmax) {
     516                                slotClicked = ((int)g_mouse.y-1)/CHAR_COLS-(vm+4);
     517                                if (slotClicked >= 0 && slotClicked < NUM_SLOTS)
     518                                        active = slotClicked;
     519                        }
    513520                        break;
    514521                case KEY_DOWN:
    515522                        active++;
     
    568575        _gfx->flushBlock(3 * CHAR_COLS, 11 * CHAR_LINES - 1,
    569576                        37 * CHAR_COLS, 12 * CHAR_LINES);
    570577
    571         getString(2, 11, 33, MAX_STRINGS);
     578        getString(2, 11, 31, MAX_STRINGS);
    572579        _gfx->printCharacter(3, 11, _game.cursorChar, MSG_BOX_COLOUR, MSG_BOX_TEXT);
    573580        do {
    574581                mainCycle();