Rename CelesteMapReader to CelesteMap because it is r/w, map2xml should be map2json

This commit is contained in:
Madeline Lim 2018-05-20 12:15:30 -07:00
parent 38d45289b3
commit 93e8642bc9
5 changed files with 13 additions and 13 deletions

View file

@ -24,7 +24,7 @@ If you right click on a level it takes you to the level view, where you will als
![Screenshot of Level view for one of the Celestial Resort B-side levels](screenshot/levelview2.png)
For this, I took the levels and used `map2xml.rb` to convert them into JSON for easier JS manipulation and wrote a viewer in p5.js. Here's an [example](http://deltabouche.com/celeste/json/0-Intro.json) of what one of these looks like, which again might get taken down if requested.
For this, I took the levels and used `map2json.rb` to convert them into JSON for easier JS manipulation and wrote a viewer in p5.js. Here's an [example](http://deltabouche.com/celeste/json/0-Intro.json) of what one of these looks like, which again might get taken down if requested.
# Tools used

View file

@ -96,7 +96,7 @@ class Element
end
end
class CelesteMapReader
class CelesteMap
attr_accessor :debug, :rom, :package, :string_lookup, :root, :writer
def initialize fn, fmt: :bin, debug: false
@debug = debug

View file

@ -1,8 +1,8 @@
require "./celeste_map_reader"
require "./celeste_map"
# fn = 'app/Content/Maps/1-ForsakenCity.bin'
ARGV.each do |fn|
base = File.basename(fn, ".json")
a = CelesteMapReader.new(fn, fmt: :json)
a = CelesteMap.new(fn, fmt: :json)
a.write "bin/#{base}.bin"
end

9
map2json.rb Normal file
View file

@ -0,0 +1,9 @@
require "./celeste_map"
# fn = 'app/Content/Maps/1-ForsakenCity.bin'
ARGV.each do |fn|
base = File.basename(fn, ".bin")
a = CelesteMap.new(fn)
File.open("#{base}.xml", "wb") { |f| f.write a.root.inspect } # Note: not valid XML, just for display
a.write_json("#{base}.json")
end

View file

@ -1,9 +0,0 @@
require "./celeste_map_reader"
# fn = 'app/Content/Maps/1-ForsakenCity.bin'
ARGV.each do |fn|
base = File.basename(fn, ".bin")
a = CelesteMapReader.new(fn)
File.open("#{base}.xml", "wb") { |f| f.write a.root.inspect }
a.write_json("#{base}.json")
end