Skip to content

Commit f8290cd

Browse files
committed
(graphics) Also patch up foundation offsets
1 parent 9e663ad commit f8290cd

File tree

2 files changed

+10
-7
lines changed

2 files changed

+10
-7
lines changed

agrf/graphics/sprites/foundation.py

Lines changed: 9 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -15,10 +15,8 @@ def __init__(self, solid_sprite, ground_sprite, foundation_id, style, cut_inside
1515
representative.w,
1616
representative.h,
1717
zoom=representative.zoom,
18-
xofs=representative.xofs,
19-
yofs=representative.yofs
20-
+ (8 * ZOOM_TO_SCALE[representative.zoom] if style == "ground" else 0)
21-
+ (zshift * ZOOM_TO_SCALE[representative.zoom]),
18+
xofs=0,
19+
yofs=0,
2220
bpp=representative.bpp,
2321
crop=representative.crop,
2422
)
@@ -61,4 +59,11 @@ def get_data_layers(self, context):
6159
)
6260
timer.count_composing()
6361

62+
self.xofs = ret.xofs
63+
self.yofs = (
64+
ret.yofs
65+
+ (8 * ZOOM_TO_SCALE[self.zoom] if self.style == "ground" else 0)
66+
+ (self.zshift * ZOOM_TO_SCALE[self.zoom])
67+
)
68+
6469
return ret.w, ret.h, ret.rgb, ret.alpha, ret.mask

agrf/graphics/sprites/map.py

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -10,9 +10,7 @@ class MapSprite(grf.Sprite):
1010
def __init__(self, a, f, name, xofs=0, yofs=0):
1111
if not isinstance(a, tuple):
1212
a = (a,)
13-
super().__init__(
14-
a[0].w, a[0].h, zoom=a[0].zoom, xofs=a[0].xofs, yofs=a[0].yofs, bpp=a[0].bpp, crop=a[0].crop
15-
)
13+
super().__init__(a[0].w, a[0].h, zoom=a[0].zoom, xofs=a[0].xofs, yofs=a[0].yofs, bpp=a[0].bpp, crop=a[0].crop)
1614
self.a = a
1715
self.f = f
1816
self._fname = name

0 commit comments

Comments
 (0)