Angband.oook.cz
Angband.oook.cz
AboutVariantsLadderForumCompetitionComicScreenshotsFunniesLinks

Go Back   Angband Forums > Angband > Sil

Reply
 
Thread Tools Display Modes
Old January 21, 2014, 08:41   #1
tungtn
Rookie
 
Join Date: Sep 2012
Posts: 8
tungtn is on a distinguished road
Sil 1.2.1 bug - viewport shakes when moving with "center map continuously" option

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:

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 "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:

Code:
	/* Scroll screen vertically when off-center */
	if (center_player)
	{
		if (!p_ptr->running || !run_avoid_center)
		{
			wy = py - SCREEN_HGT / 2;
		}
	}
	else (/* ... */)
	{
		/* ... */
	}
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.
tungtn is offline   Reply With Quote
Reply

Tags
bug, sil


Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
Bug with "Turn" in the "Player History" dump bron Vanilla 3 January 17, 2014 16:35
3.5 key map error "x" Ingwe Ingweron Development 1 January 4, 2014 02:29
in-game map is "squished" runequester Vanilla 6 April 23, 2012 13:08
Can we have the "map remembers torch-lit grids" option back? Max Stats Development 11 March 4, 2011 15:20
"Master" option & variant selection..? Lord Fell Vanilla 15 November 13, 2010 19:45


All times are GMT +1. The time now is 13:42.


Powered by vBulletin® Version 3.8.11
Copyright ©2000 - 2019, vBulletin Solutions Inc.