lipk's TerrainWML problems

The place to post your WML questions and answers.

Moderator: Forum Moderators

Forum rules
  • Please use [code] BBCode tags in your posts for embedding WML snippets.
  • To keep your code readable so that others can easily help you, make sure to indent it following our conventions.
Post Reply
User avatar
lipk
Posts: 637
Joined: July 18th, 2011, 1:42 pm

lipk's TerrainWML problems

Post by lipk »

I'm working on some custom terrain.
I have the following code:

Code: Select all

[terrain_graphics]
  [tile]
    x,y=0,0
    type=Zzzz
    has_flag=Custom_flag
    [image]
      name=anim-1.png,anim-2.png,anim-3.png
      center=36,36
    [/image]
  [/tile]
[/terrain_graphics]
Now the problem is: the center key inside image seems to be completely ignored, the overlay is put on the top left corner. If I include the image tag directly in terrain_graphics, it just works fine. Why it does not this way?
Last edited by lipk on January 15th, 2012, 3:58 pm, edited 1 time in total.
User avatar
Alarantalara
Art Contributor
Posts: 786
Joined: April 23rd, 2010, 8:17 pm
Location: Canada

Re: engine ignores 'center' key inside 'image' tag?

Post by Alarantalara »

I'm not sure what the reason is, but it is a deliberate decision and not a bug (check out line 383-386 of builder.cpp if you're interested). It should probably be documented though - I'll go do that now.
User avatar
lipk
Posts: 637
Joined: July 18th, 2011, 1:42 pm

Re: engine ignores 'center' key inside 'image' tag?

Post by lipk »

Ummm.... bad news for me. Btw, the water animation macros do use tile-image-center structures, so those should be changed then too. (Although it certainly doesn't make a difference there, or we'd have noticed it already :wink: )
User avatar
lipk
Posts: 637
Joined: July 18th, 2011, 1:42 pm

Re: lipk's TerrainWML problems

Post by lipk »

Now this really smells like a bug.

Code: Select all

[terrain_graphics]
    map="
 , 2,
 1,  1
 , 2
 1,  1
 , 2,"
 	probability=1
    [tile]
       pos=2
       type=Qxga
       set_no_flag=comet
    [/tile]
    rotations=n,ne,se,s,sw,nw
    [image]
    	name=comet-@R0.png
    [/image]
[/terrain_graphics]
wesnoth-terrain-bug.png
As you can see, image centering works fine for every direction but north-east.
User avatar
Alarantalara
Art Contributor
Posts: 786
Joined: April 23rd, 2010, 8:17 pm
Location: Canada

Re: lipk's TerrainWML problems

Post by Alarantalara »

Given the probability = 1 you have there, I am assuming that what you posted is not a copy of what's producing the results.

Can you post a copy of the relevant pieces of the add-on in an archive? (terrain, terrain graphics and images)
User avatar
lipk
Posts: 637
Joined: July 18th, 2011, 1:42 pm

Re: lipk's TerrainWML problems

Post by lipk »

Here you go.
Just extract it to your add-on folder, the incriminated terrain should appear in the editor.
Attachments
terrain_bug_addon.tar.gz
(12.71 KiB) Downloaded 123 times
User avatar
Alarantalara
Art Contributor
Posts: 786
Joined: April 23rd, 2010, 8:17 pm
Location: Canada

Re: lipk's TerrainWML problems

Post by Alarantalara »

This prevents the problem you're having.

Code: Select all

#comet overlays
[terrain_graphics]
    map="
 1,
 ,.
 1
 ,.
 1"
 	probability=50
    [tile]
       pos=1
       type=Qxga
       set_no_flag=comet
    [/tile]
    rotations=n,ne,se,s,sw,nw
    [image]
    	name=comet_t-@R0-7.png
    [/image]
[/terrain_graphics]
Post Reply