Main Dwaddle repository
Revision | 82d76bf71e707cb552b12341b6c864d27c6818b2 (tree) |
---|---|
Time | 2021-05-26 14:57:05 |
Author | ![]() |
Commiter | Remilia Scarlet |
Allow initialization of a Flat from a Lump, and remove an unused
parameter.
@@ -23,6 +23,15 @@ | ||
23 | 23 | @data = Array.new(4096) { |_| 0u8 } |
24 | 24 | end |
25 | 25 | |
26 | + def initialize(lmp : Lump) | |
27 | + unless lmp.size == 4096 | |
28 | + raise DwaddleError.new("Cannot create Flat from lump #{lmp.name}: data size is incorrect") | |
29 | + end | |
30 | + | |
31 | + @name = lmp.name | |
32 | + @data = Array.new(4096) { |idx| lmp.data[idx] } | |
33 | + end | |
34 | + | |
26 | 35 | def initialize(@name : String, data : Bytes) |
27 | 36 | unless data.size == 4096 |
28 | 37 | raise DwaddleError.new("Cannot create Flat: data size is incorrect") |
@@ -39,7 +48,7 @@ | ||
39 | 48 | @data = Array.new(4096) { |idx| lmp.data[idx] } |
40 | 49 | end |
41 | 50 | |
42 | - def toImage(wad : WadFile, palette : Palette) : Image | |
51 | + def toImage(palette : Palette) : Image | |
43 | 52 | unless @data.size == 4096 |
44 | 53 | raise DwaddleError.new("Cannot convert Flat to Image: data size is not 4096") |
45 | 54 | end |