OpenXcom Forum

Contributions => Programming => Topic started by: kevL on August 03, 2013, 07:47:25 am

Title: Centering X-hairs on the minimap
Post by: kevL on August 03, 2013, 07:47:25 am
the 1x1px offset was really bothering me, so I tracked down the code and this works:

Battlescape/MiniMapView.cpp, ~line 150+

Code: [Select]
drawLine(centerX - CELL_WIDTH -1, centerY - CELL_HEIGHT -1,
centerX - xOffset -1, centerY - yOffset -1,
color); https:// top left
drawLine(centerX + xOffset -1, centerY - yOffset -1,
centerX + CELL_WIDTH -1, centerY - CELL_HEIGHT -1,
color); https:// top right
drawLine(centerX - CELL_WIDTH -1, centerY + CELL_HEIGHT -1,
centerX - xOffset -1, centerY + yOffset -1,
color); https:// bottom left
drawLine(centerX + CELL_WIDTH -1, centerY + CELL_HEIGHT -1,
centerX + xOffset -1, centerY + yOffset -1,
color); https:// bottom right

If someone with git-fu would like to toss it into a nightly build Pls do. All those "-1"s are yours truly,
Title: Re: Centering X-hairs on the minimap
Post by: 54x on August 03, 2013, 10:31:10 am
Pull request made.
Title: Re: Centering X-hairs on the minimap
Post by: kevL on August 04, 2013, 01:14:52 am
thanks but, whoever altered the code mucked things up. It *should* look like this:
Title: Re: Centering X-hairs on the minimap
Post by: kevL on August 05, 2013, 01:58:20 am
here's how to get soldiers properly centered on the main battle map also:

in Battlescape/Camera.cpp, Camera::centerOnPosition()
change

Code: [Select]
_mapOffset.x = -(screenPos.x - (_screenWidth / 2));
_mapOffset.y = -(screenPos.y - (_visibleMapHeight / 2));

to
Code: [Select]
_mapOffset.x = -(screenPos.x - (_screenWidth / 2) +16);
_mapOffset.y = -(screenPos.y - (_visibleMapHeight / 2) +16);


great game. It's really shaping up!!!
Title: Re: Centering X-hairs on the minimap
Post by: Warboy1982 on August 05, 2013, 03:36:07 am
fixt
Title: Re: Centering X-hairs on the minimap
Post by: kevL on August 05, 2013, 10:10:44 am
et tu, brutus




jk
Title: Re: Centering X-hairs on the minimap
Post by: 54x on August 05, 2013, 12:12:21 pm
ah, apologies that I effed it up. :) Cheers for cleaning it, Warboy.