32bit Graphics Extra Zoom Patch

Discuss, get help with, or post new graphics for TTDPatch and OpenTTD, using the NewGRF system, here. Graphics for plain TTD also acceptable here.

Moderator: Graphics Moderators

Antonio1984
Transport Coordinator
Transport Coordinator
Posts: 282
Joined: 02 Apr 2009 21:57

Re: [32bpp] Extra zoom levels, experimental new CC algorithm

Post by Antonio1984 »

Ok ok I understand..you have all the reasons of th world... :D
Szvengar
Engineer
Engineer
Posts: 29
Joined: 25 Sep 2009 12:25

Re: [32bpp] Extra zoom levels, experimental new CC algorithm

Post by Szvengar »

Sign problem (town name, station name, ...) not working in other zoom than normal:

I've duplicate some of the code you have put in comment in viewport.cpp but not in the same function and it works so I'm wondering if maybe there something I'm missing.

Code: Select all

static bool CheckClickOnViewportSign(const ViewPort *vp, int x, int y, const ViewportSign *sign)
{
	bool small = (vp->zoom >= ZOOM_LVL_OUT_4X);
	int sign_half_width = ScaleByZoom((small ? sign->width_small : sign->width_normal) / 2, vp->zoom);
	int sign_height = ScaleByZoom(VPSM_TOP + (small ? FONT_HEIGHT_SMALL : FONT_HEIGHT_NORMAL) + VPSM_BOTTOM, vp->zoom);

//	x = ScaleByZoom(x - vp->left, vp->zoom) + vp->virtual_left;
//	y = ScaleByZoom(y - vp->top, vp->zoom) + vp->virtual_top;
	x = ScaleByZoom(x - vp->left + vp->virtual_left, vp->zoom);
	y = ScaleByZoom(y - vp->top + vp->virtual_top, vp->zoom);

	return
			y >= sign->top &&
			y <  sign->top + sign_height &&
			x >= sign->center - sign_half_width &&
			x <  sign->center + sign_half_width;
}
User avatar
GeekToo
Tycoon
Tycoon
Posts: 961
Joined: 03 Jun 2007 22:22

Re: [32bpp] Extra zoom levels, experimental new CC algorithm

Post by GeekToo »

Update with the patches of Szvengar.
Seems to work ok, clicking the signs did work ok in the past, but got messed up in one of the syncs, thanks for the fix.
Attachments
32bpp_19519_v13.diff
(86.3 KiB) Downloaded 145 times
Szvengar
Engineer
Engineer
Posts: 29
Joined: 25 Sep 2009 12:25

Re: [32bpp] Extra zoom levels, experimental new CC algorithm

Post by Szvengar »

You forgot to remove from spriteloader.hpp:

Code: Select all

+		uint8 mr;  ///< Remap-red-channel
+		uint8 mg;  ///< Remap-green-channel
+		uint8 mb;  ///< Remap-blue-channel
And you remove a little too much from png.cpp:
20100326_png_19517.diff
(5.07 KiB) Downloaded 129 times
I will have to work a little more on PNG in palette color 1, 2 and 4 bits because I have doubts about the tRNS.
User avatar
GeekToo
Tycoon
Tycoon
Posts: 961
Joined: 03 Jun 2007 22:22

Re: [32bpp] Extra zoom levels, experimental new CC algorithm

Post by GeekToo »

Very possible, because it was a diff against trunk, I did have several chunks failing. I think this one is a little better.
Attachments
32bpp_19519_v13b.diff
(86.49 KiB) Downloaded 172 times
Szvengar
Engineer
Engineer
Posts: 29
Joined: 25 Sep 2009 12:25

Re: [32bpp] Extra zoom levels, experimental new CC algorithm

Post by Szvengar »

I think I may I've found the solution for the sound problem:
20100326_sound_19517.diff
(1.51 KiB) Downloaded 121 times
Your last diff is good for me.
Szvengar
Engineer
Engineer
Posts: 29
Joined: 25 Sep 2009 12:25

Re: [32bpp] Extra zoom levels, experimental new CC algorithm

Post by Szvengar »

Sorry, I forgot a little thing:
20100326_sound_19517.diff
(1.61 KiB) Downloaded 118 times
Might be helpful for the location of the sound!!!
Szvengar
Engineer
Engineer
Posts: 29
Joined: 25 Sep 2009 12:25

Re: [32bpp] Extra zoom levels, experimental new CC algorithm

Post by Szvengar »

OpenTTD fullzoom r19519: Win32
diff file for the fullzoom version.

Fix signs and sounds problem when not in normal zoom.
Jupix
Chief Executive
Chief Executive
Posts: 683
Joined: 19 Feb 2005 09:08
Location: Finland
Contact:

Re: [32bpp] Extra zoom levels, experimental new CC algorithm

Post by Jupix »

GeekToo wrote: Speaking of that, how would you (and everybody else) feel about the idea of taking this patch to an openttdcoop project? Now multiple people are contributing patches, I think it's time to end this being a one man project, and making it a true open project, with the added benefits of having an issue tracker. Then we also have the possibility to compile the windows bins on the compile farm regularly.
I think that would be very healthy for the feature itself and a step that has to be taken before there's hope of the feature getting included in official builds.
#################
User avatar
GeekToo
Tycoon
Tycoon
Posts: 961
Joined: 03 Jun 2007 22:22

Re: [32bpp] Extra zoom levels, experimental new CC algorithm

Post by GeekToo »

OK, I've added a project and filled the code repository up to the latest version:
http://dev.openttdcoop.org/projects/32bpp-ez
Jupix
Chief Executive
Chief Executive
Posts: 683
Joined: 19 Feb 2005 09:08
Location: Finland
Contact:

Re: [32bpp] Extra zoom levels, experimental new CC algorithm

Post by Jupix »

Nice! So, are there now going to be regularly built binaries?
#################
User avatar
GeekToo
Tycoon
Tycoon
Posts: 961
Joined: 03 Jun 2007 22:22

Re: [32bpp] Extra zoom levels, experimental new CC algorithm

Post by GeekToo »

Not yet, I still have to figure out how to let it run on the compile farm regularly.
But we can use the issue tracker, and the project is open now, i.e. other coders like Szvengar or Maquinista could join the project.

Btw, I've added a new feature: follow vehicles in extra zoom levels too, gives a real nice effect.

You can follow the changelogs of the project here:
http://mz.openttdcoop.org/hg/32bpp-ez/
Jupix
Chief Executive
Chief Executive
Posts: 683
Joined: 19 Feb 2005 09:08
Location: Finland
Contact:

Re: [32bpp] Extra zoom levels, experimental new CC algorithm

Post by Jupix »

I was thinking of posting some bug reports but thought I'd hold off till there's a new build to see if they've been fixed. Like the town names unclickable bug, and map screen marker bug.
#################
User avatar
Zephyris
Tycoon
Tycoon
Posts: 2897
Joined: 16 May 2007 16:59

Re: [32bpp] Extra zoom levels, experimental new CC algorithm

Post by Zephyris »

On the subject of bugs... has anyone else noticed that dragging the view at high view levels don't work correctly when you are only trying to move a very short distance? It seems like you have to move the mouse at least 4 pixels or so between each mouse movement step for it to register...
Szvengar
Engineer
Engineer
Posts: 29
Joined: 25 Sep 2009 12:25

Re: [32bpp] Extra zoom levels, experimental new CC algorithm

Post by Szvengar »

Jupix wrote:I was thinking of posting some bug reports but thought I'd hold off till there's a new build to see if they've been fixed. Like the town names unclickable bug, and map screen marker bug.
The "town names unclickable bug" should be solve in the last binary I made.
User avatar
Lord Aro
Tycoon
Tycoon
Posts: 2369
Joined: 25 Jun 2009 16:42
Location: Location, Location
Contact:

Re: [32bpp] Extra zoom levels, experimental new CC algorithm

Post by Lord Aro »

GeekToo wrote:You can follow the changelogs of the project here:
http://mz.openttdcoop.org/hg/32bpp-ez/
are there actually any binaries on the site yet?
a (very) quick check and i couldn't find any ?(
AroAI - A really feeble attempt at an AI

It is practically impossible to teach good programming to students that have had a prior exposure to BASIC: as potential programmers they are mentally mutilated beyond hope of regeneration. --Edsger Dijkstra
Jupix
Chief Executive
Chief Executive
Posts: 683
Joined: 19 Feb 2005 09:08
Location: Finland
Contact:

Re: [32bpp] Extra zoom levels, experimental new CC algorithm

Post by Jupix »

Lord Aro wrote:
GeekToo wrote:You can follow the changelogs of the project here:
http://mz.openttdcoop.org/hg/32bpp-ez/
are there actually any binaries on the site yet?
a (very) quick check and i couldn't find any ?(
Not yet unless there have been changes since this post.
#################
Jupix
Chief Executive
Chief Executive
Posts: 683
Joined: 19 Feb 2005 09:08
Location: Finland
Contact:

Re: [32bpp] Extra zoom levels, experimental new CC algorithm

Post by Jupix »

Can someone compile a 1.0-EZ binary? (Diffs would also be nice I guess)
#################
maquinista
Tycoon
Tycoon
Posts: 1829
Joined: 10 Jul 2006 00:43
Location: Spain

Re: [32bpp] Extra zoom levels, experimental new CC algorithm

Post by maquinista »

I have tried to modify the monorail bridge, but I have found a problem. The far pillar are not drawn in the two upper levels. This is useful in most of briges, but It is a problem in simple bridges, because the column is not continuous. I think that the problem will be fixed drawing a pillar more. The bridge surface could be used to finish the bridge.

I have modified the code to do this:

Code: Select all

static void DrawBridgePillars(const PalSpriteID *psid, const TileInfo *ti, Axis axis, bool drawfarpillar, int x, int y, int z_bridge)
{
	/* Do not draw bridge pillars if they are invisible */
	if (IsInvisibilitySet(TO_BRIDGES)) return;

	SpriteID image = psid->sprite;

	if (image != 0) {
		/* "side" specifies the side the pillars stand on.
		 * The length of the pillars is then set to the height of the bridge over the corners of this edge.
		 *
		 *                axis==AXIS_X  axis==AXIS_Y
		 *   side==false      SW            NW
		 *   side==true       NE            SE
		 *
		 * I have no clue, why this was done this way.
		 */
		bool side = HasBit(image, 0);

		/* "dir" means the edge the pillars stand on */
		DiagDirection dir = AxisToDiagDir(axis);
		if (side != (axis == AXIS_Y)) dir = ReverseDiagDir(dir);

		/* Determine ground height under pillars */
		int front_height = ti->z;
		int back_height = ti->z;
		GetSlopeZOnEdge(ti->tileh, dir, &front_height, &back_height);

		/* x and y size of bounding-box of pillars */
		int w = (axis == AXIS_X ? 16 : 2);
		int h = (axis == AXIS_X ? 2 : 16);
		/* sprite position of back facing pillar */
		int x_back = x - (axis == AXIS_X ? 0 : 9);
		int y_back = y - (axis == AXIS_X ? 9 : 0);

		for (int cur_z = z_bridge; cur_z >= front_height || cur_z >= back_height; cur_z -= TILE_HEIGHT) {
			/* Draw front facing pillar */
			if (cur_z >= front_height) {
				AddSortableSpriteToDraw(image, psid->pal, x, y, w, h, BB_HEIGHT_UNDER_BRIDGE - 5, cur_z, IsTransparencySet(TO_BRIDGES), 0, 0, -5);
			}

			/* Draw back facing pillar, but not the highest part directly under the bridge-floor */
			if (drawfarpillar && cur_z >= back_height && cur_z <= z_bridge - TILE_HEIGHT) {
				AddSortableSpriteToDraw(image, psid->pal, x_back, y_back, w, h, BB_HEIGHT_UNDER_BRIDGE - 5, cur_z, IsTransparencySet(TO_BRIDGES), 0, 0, -5);
			}
		}
	}
}
This is the change:

Code: Select all

if (drawfarpillar && cur_z >= back_height && cur_z <= z_bridge - TILE_HEIGHT)
I have replaced the "<" and now is a "<=".

Maybe this change could be suggested to include It in trunk.
Attachments
Current problem with this bridge. I want to add some pillar to this bridge because It looks very strange without them.
Current problem with this bridge. I want to add some pillar to this bridge because It looks very strange without them.
suggestion_monorail.JPEG (66.28 KiB) Viewed 3500 times
Sorry if my english is too poor, I want learn it, but it isn't too easy.[/list][/size]
compuguy1088
Engineer
Engineer
Posts: 4
Joined: 03 Apr 2010 16:58

Re: [32bpp] Extra zoom levels, experimental new CC algorithm

Post by compuguy1088 »

GeekToo wrote:OK, I've added a project and filled the code repository up to the latest version:
http://dev.openttdcoop.org/projects/32bpp-ez
I should mention that your site currently seems to time out, don't know if its on my end or one the other end.....
Post Reply

Return to “Graphics Development”

Who is online

Users browsing this forum: No registered users and 24 guests