-
Notifications
You must be signed in to change notification settings - Fork 0
/
remove_custom_sprites.jl
47 lines (36 loc) · 1.17 KB
/
remove_custom_sprites.jl
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
#!/usr/bin/env julia
"""
Remove levels that contain non-standard sprite values.
It is possible that false positives remain.
"""
module RemoveCustomSprites
include(joinpath("..", "src", "sprites.jl"))
function removenonvanillaspritelevels(nonvanilla::Dict{UInt8, Dict{String, Vector{String}}}
= Sprites.findnonvanillasprites())
for dirdict in values(nonvanilla)
for (dir, levels) in dirdict
for level in levels
baselevel = level[1:findlast('.', level)]
basepath = joinpath(dir, baselevel)
rm(joinpath(dir, level))
for ext in ("bg", "ent", "ent2", "exits", "map")
rm(basepath * ext)
end
end
end
end
end
function main()
local answer
while true
println("Really delete all levels with custom sprites? (y/n)")
answer = lowercase(readline())
answer ∉ ("y", "n") && break
println("Please answer only with 'y' or 'n'.")
end
answer == "y" && (removenonvanillaspritelevels(); println("Done."))
end
if abspath(PROGRAM_FILE) == @__FILE__
main()
end
end # module