Working on resolving as many UMC references as possible.
This commit is contained in:
parent
a67d072c85
commit
b1a6452c62
2 changed files with 28 additions and 8 deletions
|
@ -128,15 +128,15 @@ class CrossRef:
|
|||
macro_reference = re.compile(r"\{([A-Z_][A-Z0-9_:]*[A-Za-z0-9_])\b")
|
||||
file_reference = re.compile(r"[A-Za-z0-9{}][A-Za-z0-9_/+{}-]*\.(" + "|".join(resource_extensions) + ")")
|
||||
def imagesearch(self, name):
|
||||
# Here is where we implement the funky rules
|
||||
# for image resolution. If we can't identify
|
||||
# a reference to the image name under an image
|
||||
# directory, look for it under an image/units
|
||||
# or image/terrain directory.
|
||||
# Here is where we implement the funky rules for image
|
||||
# resolution. If we can't identify a reference to the image
|
||||
# name under an image directory, look for it under particular
|
||||
# subdirectories.
|
||||
for super in ("units", "terrain", "portraits", "items"):
|
||||
trial = os.path.join(super, name)
|
||||
if trial in self.fileref:
|
||||
return trial
|
||||
for path in self.fileref:
|
||||
if path == trial or path.endswith(os.sep + trial):
|
||||
return path
|
||||
return None
|
||||
def mark_matching_resources(self, pattern, fn, n):
|
||||
"Mark all definitions matching a specified pattern with a reference."
|
||||
|
@ -247,7 +247,8 @@ class CrossRef:
|
|||
key = self.mark_matching_resources(pattern, fn,n+1)
|
||||
if key:
|
||||
self.fileref[key].append(fn, n+1)
|
||||
else:
|
||||
# Might be time to do an image path search
|
||||
elif name.endswith(".png") or name.endswith(".jpg"):
|
||||
key = self.imagesearch(name)
|
||||
if key:
|
||||
self.fileref[key].append(fn, n+1)
|
||||
|
|
|
@ -30,10 +30,26 @@ filemoves = {
|
|||
# don't try to fix include:
|
||||
# - attack/staff.png may map to one of several staves
|
||||
("SOUND_LIST:DAGGER_SWISH", "SOUND_LIST:SWORD_SWISH"),
|
||||
("AMLA_TOUGH_2", "AMLA_TOUGH 2"),
|
||||
("AMLA_TOUGH_3", "AMLA_TOUGH 3"),
|
||||
("bow-hit.ogg", "bow.ogg"),
|
||||
("creepy.ogg", "underground.ogg"),
|
||||
("arrow-miss.wav", "bow-miss.ogg"),
|
||||
("arrow-hit.wav", "bow-hit.ogg"),
|
||||
("attacks/darkstaff.png", "attacks/staff-necromantic.png"),
|
||||
("attacks/sword.png", "attacks/human-sword.png"),
|
||||
("eagle.wav", "gryphon-shriek-1.ogg"),
|
||||
("fist.wav", "fist.ogg"),
|
||||
("knife.wav", "dagger-swish.wav"), # Is this right?
|
||||
("miss.wav", "miss-1.ogg"),
|
||||
("wolf-attack.wav", "wolf-bite.ogg"),
|
||||
("wolf-cry.wav", "wolf-die.ogg"),
|
||||
("items/castle-ruins", "scenery/castle-ruins.png"),
|
||||
("items/leanto", "scenery/leanto.png"),
|
||||
("items/fire1.png", "scenery/fire1.png"),
|
||||
("items/fire2.png", "scenery/fire2.png"),
|
||||
("items/fire3.png", "scenery/fire3.png"),
|
||||
("items/fire4.png", "scenery/fire4.png"),
|
||||
("items/monolith1.png", "scenery/monolith1.png"),
|
||||
("items/monolith2.png", "scenery/monolith2.png"),
|
||||
("items/monolith3.png", "scenery/monolith3.png"),
|
||||
|
@ -45,12 +61,15 @@ filemoves = {
|
|||
("items/rock3.png", "scenery/rock3.png"),
|
||||
("items/rock4.png", "scenery/rock4.png"),
|
||||
("items/signpost.png", "scenery/signpost.png"),
|
||||
("terrain/signpost.png", "scenery/signpost.png"),
|
||||
("terrain/rocks.png", "scenery/rock2.png"),
|
||||
("items/well.png", "scenery/well.png"),
|
||||
("lightning.wav", "lightning.ogg"),
|
||||
("misc/dwarven-doors.png", "scenery/dwarven-doors-closed.png"),
|
||||
("misc/chest.png", "items/chest.png"),
|
||||
("misc/temple.png", "scenery/temple1.png"),
|
||||
("sword-swish.wav", "sword-1.ogg"),
|
||||
("sword.wav", "sword-1.ogg"),
|
||||
("terrain/flag-1.png", "flags/flag-1.png"),
|
||||
("terrain/flag-2.png", "flags/flag-2.png"),
|
||||
("terrain/flag-3.png", "flags/flag-3.png"),
|
||||
|
|
Loading…
Add table
Reference in a new issue