When the "center map continuously" option is enabled and the player moves, the map will constantly shift its view of the dungeon which is extremely distracting. I think this was reported before, but nobody could work out what was causing it... until now.
The culprit is in verify_panel() in xtra2.c, which adjusts the coords of the visible part of the map based on the player's position. It has a couple of blocks that look like this:
With "center map" off, the game tries to divide the dungeon into a screen-sized grid, which explains what's going on in the second block of the 'if-else' above.
With the option on, the first block of the 'if-else' runs... sometimes. The bug is that the 'if' condition is badly written: it falls through to the 'else' when the player is centered from the previous update, which does its grid alignment thing, and on the next update the view is grid aligned and not centered on the player, hence the oscillation.
The code for the 'if' condition and block should look like this instead:
The position check is superfluous because modify_panel() called at the end of verify_panel() already performs this check, so it can be left out.
Same fix needs to be done for the x position 'if-else' block below that one too.
The culprit is in verify_panel() in xtra2.c, which adjusts the coords of the visible part of the map based on the player's position. It has a couple of blocks that look like this:
Code:
/* Scroll screen vertically when off-center */ if (center_player && (!p_ptr->running || !run_avoid_center) && (py != wy + SCREEN_HGT / 2)) { wy = py - SCREEN_HGT / 2; } // Sil-y: make this an option //by default it is 2 for vertical and 4 for hor //needs to be programmed better //this doesn't do quite what it says on bigscreen //it can end up assymmetric up/down or l/r due to panels /* Scroll screen vertically when 2 grids from top/bottom edge */ else if ((py < wy + 13) || (py >= wy + SCREEN_HGT - 13)) { wy = ((py - PANEL_HGT / 2) / PANEL_HGT) * PANEL_HGT; }
With the option on, the first block of the 'if-else' runs... sometimes. The bug is that the 'if' condition is badly written: it falls through to the 'else' when the player is centered from the previous update, which does its grid alignment thing, and on the next update the view is grid aligned and not centered on the player, hence the oscillation.
The code for the 'if' condition and block should look like this instead:
Code:
/* Scroll screen vertically when off-center */ if (center_player) { if (!p_ptr->running || !run_avoid_center) { wy = py - SCREEN_HGT / 2; } } else (/* ... */) { /* ... */ }
Same fix needs to be done for the x position 'if-else' block below that one too.