mirror of
https://github.com/maddievision/Celestial.git
synced 2024-08-14 23:55:37 +00:00
Rename CelesteMapReader to CelesteMap because it is r/w, map2xml should be map2json
This commit is contained in:
parent
38d45289b3
commit
93e8642bc9
5 changed files with 13 additions and 13 deletions
|
@ -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)
|
![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
|
# Tools used
|
||||||
|
|
||||||
|
|
|
@ -96,7 +96,7 @@ class Element
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
class CelesteMapReader
|
class CelesteMap
|
||||||
attr_accessor :debug, :rom, :package, :string_lookup, :root, :writer
|
attr_accessor :debug, :rom, :package, :string_lookup, :root, :writer
|
||||||
def initialize fn, fmt: :bin, debug: false
|
def initialize fn, fmt: :bin, debug: false
|
||||||
@debug = debug
|
@debug = debug
|
|
@ -1,8 +1,8 @@
|
||||||
require "./celeste_map_reader"
|
require "./celeste_map"
|
||||||
# fn = 'app/Content/Maps/1-ForsakenCity.bin'
|
# fn = 'app/Content/Maps/1-ForsakenCity.bin'
|
||||||
|
|
||||||
ARGV.each do |fn|
|
ARGV.each do |fn|
|
||||||
base = File.basename(fn, ".json")
|
base = File.basename(fn, ".json")
|
||||||
a = CelesteMapReader.new(fn, fmt: :json)
|
a = CelesteMap.new(fn, fmt: :json)
|
||||||
a.write "bin/#{base}.bin"
|
a.write "bin/#{base}.bin"
|
||||||
end
|
end
|
||||||
|
|
9
map2json.rb
Normal file
9
map2json.rb
Normal 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
|
|
@ -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
|
|
Loading…
Reference in a new issue