Moves drawing of map borders to WML and improves the fake map border

This makes both the standard map border as well as the fake map border terrain be drawn using the same WML rules, which allows them to connect seamlessly with each other.

A dummy IPF ~NO_TOD_SHIFT() is added and used as an easy way to prevent the ToD color-shifting of the border images. This can and probably should be implemented differently in the future, but for now it's a very simple and effective workaround.

This does remove themability of the map border, but that feature is currently unused (even in UMC) and it can be re-implemented differently if the feature is needed. There is also other cleanup still needed regarding themes; the off-map background still remains themable, and the WML for specifying the border tiles still remains in the theme .cfg files.

The call to display::draw_border() which was used to draw the hard-coded map borders is now commented out but not yet removed.
This commit is contained in:
ln-zookeeper 2017-03-11 20:27:08 +02:00
parent d4fcbc73c2
commit 781276709d
43 changed files with 384 additions and 34 deletions

View file

@ -20,6 +20,8 @@ Version 1.13.6+dev:
* Support ability now only lowers adjacent upkeep costs by 1.
* Graphics:
* Improved terrain graphics: lava, volcano.
* Improved the fake map border terrain so that it now connects with the real
map borders and can better be used to change the apparent shape of the map.
* Smoother fade transitions between differently colored time areas.
* Adjacent castles of different types now have fewer glitches between them.
* Fixed glitches between various mountain tiles (introduced in 1.13.3).

Binary file not shown.

Before

Width:  |  Height:  |  Size: 796 B

After

Width:  |  Height:  |  Size: 757 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.5 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.5 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.5 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.5 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.5 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.5 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.5 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.5 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.5 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 5.6 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 2.1 KiB

After

Width:  |  Height:  |  Size: 2.5 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 2.2 KiB

After

Width:  |  Height:  |  Size: 1.8 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 4.2 KiB

After

Width:  |  Height:  |  Size: 3 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 2.5 KiB

After

Width:  |  Height:  |  Size: 2.2 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 2.2 KiB

After

Width:  |  Height:  |  Size: 2.1 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 4.2 KiB

After

Width:  |  Height:  |  Size: 2.3 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 2.2 KiB

After

Width:  |  Height:  |  Size: 1.8 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 3.1 KiB

After

Width:  |  Height:  |  Size: 3.3 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 4.6 KiB

After

Width:  |  Height:  |  Size: 3.1 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 4 KiB

After

Width:  |  Height:  |  Size: 2.2 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.7 KiB

After

Width:  |  Height:  |  Size: 1.9 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 4.2 KiB

After

Width:  |  Height:  |  Size: 2.9 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 4.6 KiB

After

Width:  |  Height:  |  Size: 3.1 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 2.1 KiB

After

Width:  |  Height:  |  Size: 2.5 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 2.3 KiB

After

Width:  |  Height:  |  Size: 1.8 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 4.2 KiB

After

Width:  |  Height:  |  Size: 2.9 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 2.5 KiB

After

Width:  |  Height:  |  Size: 2.2 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 4.1 KiB

After

Width:  |  Height:  |  Size: 2.2 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.7 KiB

After

Width:  |  Height:  |  Size: 1.9 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 4.2 KiB

After

Width:  |  Height:  |  Size: 2.9 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 4.6 KiB

After

Width:  |  Height:  |  Size: 3.2 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 4 KiB

After

Width:  |  Height:  |  Size: 2.2 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 2.2 KiB

After

Width:  |  Height:  |  Size: 1.8 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 3 KiB

After

Width:  |  Height:  |  Size: 3.4 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 4.6 KiB

After

Width:  |  Height:  |  Size: 3.2 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 969 B

After

Width:  |  Height:  |  Size: 781 B

View file

@ -17,34 +17,6 @@
# NOTE the terrain _off^_usr gets its definition from the code since it's
# themable
# These are temporary rules for developing and testing a new fake map edge
# terrain
[terrain_graphics]
map="
, 2
2 , 2
, 1
2 , 2
, 2"
[tile]
pos=1
type=*^_fme
set_no_flag=fakemapedge
[/tile]
[tile]
pos=2
type=*^_fme
[/tile]
[image]
layer=1000
name=off-map/border.png
center=90,144
[/image]
[/terrain_graphics]
{NEW:TRANSITION (!,*^_fme) (*^_fme) 1000 off-map/border}
# Editor overlays - for overlays that should only be visible in the editor
{EDITOR_OVERLAY *^Xo impassable-editor}
{EDITOR_OVERLAY *^Qov unwalkable-editor}

View file

@ -0,0 +1,369 @@
# This file contains rules responsible for drawing both the standard map border
# as well as the fake map border terrain.
#
# Note that this relies on the _border and _board flags set by the engine.
[terrain_graphics]
[tile]
x,y=0,0
type=*^_fme
set_flag=_border
[/tile]
[/terrain_graphics]
[terrain_graphics]
map="
, 2
1 , 2
, 3
2"
[tile]
pos=1
has_flag=_border
set_no_flag=map_border_drawn
[image]
layer=1000
name=off-map/border-@R0.png~NO_TOD_SHIFT()
[/image]
[/tile]
[tile]
pos=2
has_flag=_border
[/tile]
[tile]
pos=3
no_flag=_border
[/tile]
rotations=corner_top_left_even,skip,skip,corner_bottom_right_even,skip,skip
[/terrain_graphics]
[terrain_graphics]
map="
2
, 3
1 , 2
, 2"
[tile]
pos=1
has_flag=_border
set_no_flag=map_border_drawn
[image]
layer=1000
name=off-map/border-@R0.png~NO_TOD_SHIFT()
[/image]
[/tile]
[tile]
pos=2
has_flag=_border
[/tile]
[tile]
pos=3
no_flag=_border
[/tile]
rotations=corner_bottom_left_even,skip,skip,corner_top_right_even,skip,skip
[/terrain_graphics]
[terrain_graphics]
map="
1 , 2
, 4 , 2
5 , 3
, 3
2"
[tile]
pos=1
has_flag=_border
set_no_flag=map_border_drawn
[image]
layer=1000
name=off-map/border-corner_top_left_odd.png~NO_TOD_SHIFT()
[/image]
[/tile]
[tile]
pos=2
has_flag=_border
[/tile]
[tile]
pos=3
no_flag=_border
[/tile]
[tile]
pos=4
has_flag=_border
set_no_flag=map_border_drawn
[image]
layer=1000
name=off-map/border-se-s-sw.png~NO_TOD_SHIFT()
[/image]
[/tile]
[tile]
pos=5
has_flag=_border
set_no_flag=map_border_drawn
[image]
layer=1000
name=off-map/border-ne-se.png~NO_TOD_SHIFT()
[/image]
[/tile]
[/terrain_graphics]
[terrain_graphics]
map="
, 2 , 1
2 , 4
, 3 , 5
. , 3
, . , 2"
[tile]
pos=1
has_flag=_border
set_no_flag=map_border_drawn
[image]
layer=1000
name=off-map/border-corner_top_right_odd.png~NO_TOD_SHIFT()
[/image]
[/tile]
[tile]
pos=2
has_flag=_border
[/tile]
[tile]
pos=3
no_flag=_border
[/tile]
[tile]
pos=4
has_flag=_border
set_no_flag=map_border_drawn
[image]
layer=1000
name=off-map/border-se-s-sw.png~NO_TOD_SHIFT()
[/image]
[/tile]
[tile]
pos=5
has_flag=_border
set_no_flag=map_border_drawn
[image]
layer=1000
name=off-map/border-sw-nw.png~NO_TOD_SHIFT()
[/image]
[/tile]
[/terrain_graphics]
[terrain_graphics]
map="
2
, 3
4 , 3
, 5 , 2
1 , 2"
[tile]
pos=1
has_flag=_border
set_no_flag=map_border_drawn
[image]
layer=1000
name=off-map/border-corner_bottom_left_odd.png~NO_TOD_SHIFT()
[/image]
[/tile]
[tile]
pos=2
has_flag=_border
[/tile]
[tile]
pos=3
no_flag=_border
[/tile]
[tile]
pos=4
has_flag=_border
set_no_flag=map_border_drawn
[image]
layer=1000
name=off-map/border-ne-se.png~NO_TOD_SHIFT()
[/image]
[/tile]
[tile]
pos=5
has_flag=_border
set_no_flag=map_border_drawn
[image]
layer=1000
name=off-map/border-nw-n-ne.png~NO_TOD_SHIFT()
[/image]
[/tile]
[/terrain_graphics]
[terrain_graphics]
map="
, . , 2
. , 3
, 3 , 4
2 , 5
, 2 , 1"
[tile]
pos=1
has_flag=_border
set_no_flag=map_border_drawn
[image]
layer=1000
name=off-map/border-corner_bottom_right_odd.png~NO_TOD_SHIFT()
[/image]
[/tile]
[tile]
pos=2
has_flag=_border
[/tile]
[tile]
pos=3
no_flag=_border
[/tile]
[tile]
pos=4
has_flag=_border
set_no_flag=map_border_drawn
[image]
layer=1000
name=off-map/border-sw-nw.png~NO_TOD_SHIFT()
[/image]
[/tile]
[tile]
pos=5
has_flag=_border
set_no_flag=map_border_drawn
[image]
layer=1000
name=off-map/border-nw-n-ne.png~NO_TOD_SHIFT()
[/image]
[/tile]
[/terrain_graphics]
[terrain_graphics]
map="
, 2
2 , 2
, 1
2 , 2
, 2"
[tile]
pos=1
has_flag=_border
set_no_flag=map_border_drawn
[image]
name=off-map/border-ne-se-s-sw-nw-n.png~NO_TOD_SHIFT()
layer=1000
[/image]
[/tile]
[tile]
pos=2
no_flag=_border
has_flag=_board
[/tile]
[/terrain_graphics]
[terrain_graphics]
map="
, 2
. , 2
, 1
. , 2
, 2"
[tile]
pos=1
has_flag=_border
set_no_flag=map_border_drawn
[image]
name=off-map/border-@R0-@R1-@R2-@R3.png~NO_TOD_SHIFT()
layer=1000
[/image]
[/tile]
[tile]
pos=2
no_flag=_border
has_flag=_board
[/tile]
rotations=n,ne,se,s,sw,nw
[/terrain_graphics]
[terrain_graphics]
map="
, 2
. , 2
, 1
. , 2
, ."
[tile]
pos=1
has_flag=_border
set_no_flag=map_border_drawn
[image]
name=off-map/border-@R0-@R1-@R2.png~NO_TOD_SHIFT()
layer=1000
[/image]
[/tile]
[tile]
pos=2
no_flag=_border
has_flag=_board
[/tile]
rotations=n,ne,se,s,sw,nw
[/terrain_graphics]
[terrain_graphics]
map="
, 2
. , 2
, 1
. , .
, ."
[tile]
pos=1
has_flag=_border
set_no_flag=map_border_drawn
[image]
name=off-map/border-@R0-@R1.png~NO_TOD_SHIFT()
layer=1000
[/image]
[/tile]
[tile]
pos=2
no_flag=_border
has_flag=_board
[/tile]
rotations=n,ne,se,s,sw,nw
[/terrain_graphics]
[terrain_graphics]
map="
, 2
. , .
, 1
. , .
, ."
[tile]
pos=1
has_flag=_border
set_no_flag=map_border_drawn
[image]
name=off-map/border-@R0.png~NO_TOD_SHIFT()
layer=1000
[/image]
[/tile]
[tile]
pos=2
no_flag=_border
has_flag=_board
[/tile]
rotations=n,ne,se,s,sw,nw
[/terrain_graphics]
[terrain_graphics]
[tile]
x,y=0,0
has_flag=_border
set_no_flag=map_border_drawn
[image]
layer=1000
name=off-map/border.png~NO_TOD_SHIFT()
[/image]
[/tile]
[/terrain_graphics]

View file

@ -2401,10 +2401,10 @@ For those who go by land or sea, a bridge is the best of both worlds — for gam
[terrain_type]
symbol_image=off-map/symbol
editor_image=off-map/border-ne-se-s-sw-nw-n
editor_image=off-map/border-editor
id=off_map2
name= _ "Void"
editor_name= _ "Experimental Fake Map Edge"
name=""
editor_name= _ "Fake Map Border"
string=^_fme # wmllint: ignore
editor_group=special, obstacle
hide_help=yes

View file

@ -1168,7 +1168,8 @@ std::vector<surface> display::get_terrain_images(const map_location &loc,
// not the location, since the transitions are rendered
// over the offmap-terrain and these need a ToD coloring.
surface surf;
const bool off_map = image.get_filename() == off_map_name;
const bool off_map = (image.get_filename() == off_map_name || image.get_modifications().find("NO_TOD_SHIFT()") != std::string::npos);
if(off_map) {
surf = image::get_image(image, off_map ? image::SCALED_TO_HEX : image_type);
} else if(lt.empty()) {
@ -2533,9 +2534,9 @@ void display::draw_invalidated() {
draw_hex(loc);
drawn_hexes_+=1;
// If the tile is at the border, we start to blend it
if(!on_map) {
/*if(!on_map) {
draw_border(loc, xpos, ypos);
}
}*/
}
invalidated_hexes_ += invalidated_.size();

View file

@ -1239,6 +1239,12 @@ REGISTER_MOD_PARSER(NOP, )
return nullptr;
}
// Only used to tag terrain images which should not be color-shifted by ToD
REGISTER_MOD_PARSER(NO_TOD_SHIFT, )
{
return nullptr;
}
// Fake image function used by GUI2 portraits until
// Mordante gets rid of it. *tsk* *tsk*
REGISTER_MOD_PARSER(RIGHT, )