Menu Background, Dynamic Zoom

● ARCHIVED · READ-ONLY
Started by Kevin Moluf 1 posts View original ↗
  1. I want to force the map camera to zoom out before taking the snapshot used as the background for the main menu and possibly tint the image in a sepia tone before displaying the menu choices.

    Looking at Yanfly's Core engine plugin, it seems simple enough to modify SceneManager.snapForBackground().

    Alternatively, looking at Scene_Map and how it handles battle transitions, it seems I should add or modify the the steps between Scene_Map.updateCallMenu() and Scene_Map.callMenu().

    Less desirably, I could use HimeWorks Window Background Designer to specify what image appears in the background, but I don't know if it's possible to dynamically assign an image based on the map you're on. SumRndmDde's Kingdom Hearts menu screen has parsing for a map that gives area information and could provide a framework for a dynamic picture, but both those sound like more coding than should be necessary.

    To the best of my knowledge, the procedure would be something like:

    [Map is running, player calls menu]

    1. Map stores current zoom size, preferably as a property of Scene_Map
    var mapZoom = Game_Screen.zoomScale;

    2a. Map zooms out in preparation for snapping background;
    Game_Screen.setZoom(SceneManager._screenWidth/2,SceneManager._screenHeight/2, 0.25)
    2b. Sepia tint applied to map

    3. Menu opens, zoomed out picture of map is displayed in background
    SceneManager.snapForBackground();

    4. Player does stuff in the menu, closes menu. Map returns to zoom before opening menu
    Game_Screen.setZoom(SceneManager._screenWidth/2,SceneManager._screenHeight/2, mapZoom);

    I can't seem to figure out where and how to have the zoom effects though. Any help is appreciated.

    Edit: I neglected to mention I was also using MBS Map Zoom. Anyway, I solved the problem using the following in a custom plugin function:

    Code:
        Game_Map.prototype._mapZoom = {
            x: 1,
            y: 1,
            is: false,
            ratio : 0.5,
        };
    
        var _Scene_Map_callMenu = Scene_Map.prototype.callMenu;
        Scene_Map.prototype.callMenu = function() {
            $gameMap._mapZoom.x = $gameMap._zoom.x;
            $gameMap._mapZoom.y = $gameMap._zoom.y;
            $gameMap._mapZoom.is = true;
            $gameMap.setZoom($gameMap._mapZoom.ratio, $gameMap._mapZoom.ratio, 10);
            _Scene_Map_callMenu.call(this);
            this._waitCount = 11;
        };
    
        var _Scene_Map_update = Scene_Map.prototype.update;
        Scene_Map.prototype.update = function() {
            if (($gameMap._mapZoom.is)&&(!SceneManager.isNextScene(Scene_Menu))) {
                $gameMap._mapZoom.is = false;
                $gameMap.setZoom($gameMap._mapZoom.x,$gameMap._mapZoom.y);
            }
            _Scene_Map_update.call(this);
        };

    This thread can be closed.