Skip to content

Commit 63ed89c

Browse files
committed
..
1 parent 5dea022 commit 63ed89c

File tree

2 files changed

+28
-10
lines changed

2 files changed

+28
-10
lines changed

agrf/graphics/cv/foundation.py

Lines changed: 16 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -9,16 +9,22 @@ def get_left_part(left_parts, r, c, solid, scale):
99
left = np.ones_like(r, dtype=np.uint8) * ((c >= -32 * scale) * (c <= 0 * scale))
1010

1111
# Top limit - not applicable to solid parts
12-
if not solid:
13-
if left_parts[2] == left_parts[3]:
14-
left *= r * 2 + c >= (-16 * left_parts[3]) * scale
15-
elif left_parts[2] == left_parts[3] + 1:
16-
left *= r * 4 + c >= (-16 * left_parts[3]) * 2 * scale
17-
else:
18-
assert left_parts[2] == left_parts[3] - 1
19-
left *= r * 4 + c * 3 >= (-16 * left_parts[3]) * 2 * scale
20-
21-
if left_parts[0] == left_parts[1]:
12+
# special case for None which indicates a quarter-base in simple mode
13+
if left_parts[2] is None:
14+
left *= r >= 8 * scale
15+
else:
16+
if not solid:
17+
if left_parts[2] == left_parts[3]:
18+
left *= r * 2 + c >= (-16 * left_parts[3]) * scale
19+
elif left_parts[2] == left_parts[3] + 1:
20+
left *= r * 4 + c >= (-16 * left_parts[3]) * 2 * scale
21+
else:
22+
assert left_parts[2] == left_parts[3] - 1
23+
left *= r * 4 + c * 3 >= (-16 * left_parts[3]) * 2 * scale
24+
25+
if left_parts[0] is None:
26+
left *= r <= 8 * scale
27+
elif left_parts[0] == left_parts[1]:
2228
left *= r * 2 - c <= (64 - 16 * left_parts[0]) * scale
2329
elif left_parts[0] == left_parts[1] + 1:
2430
left *= r * 4 - c <= (64 - 16 * left_parts[0]) * 2 * scale

agrf/lib/building/foundation.py

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -118,6 +118,18 @@ def get_sprite_conf(self, style, i):
118118
if self.se_shareground:
119119
right[0] = right[1] = min(right[0], right[1]) - 1
120120

121+
if style == "simple":
122+
if i < 6:
123+
if left is not None:
124+
left[2] = left[3] = None
125+
if right is not None:
126+
right[2] = right[3] = None
127+
else:
128+
if left is not None:
129+
left[0] = left[1] = None
130+
if right is not None:
131+
right[0] = right[1] = None
132+
121133
return left, right, y_limit
122134

123135
def make_foundations_subset(self, subset):

0 commit comments

Comments
 (0)