Closed Rangi42 closed 3 years ago
This gives better results:
def constant2label(constant):
label = ''
wasletter = False
wasdigit = False
maybeunderscore = False
for c in constant:
if c != '_':
if maybeunderscore and c.isdigit():
label += '_'
if wasletter:
c = c.lower()
label += c
maybeunderscore = False
elif wasdigit:
maybeunderscore = True
wasletter = c.isalpha()
wasdigit = c.isdigit()
return label
Event::warp_map_name
converts the map constant to a label, e.g.UNION_CAVE_1F
toUnionCave1F
. However, it doesn't appropriately handle a case that doesn't come up in pokecrystal, when the constant has an underscore between digits.LUSTER_APARTMENT_1_1F
should convert toLusterApartment1_1F
, notLusterApartment11F
.Here's a Python implementation for testing: