• R/O
  • SSH

dwaddle: Commit

Main Dwaddle repository


Commit MetaInfo

Revision82d76bf71e707cb552b12341b6c864d27c6818b2 (tree)
Time2021-05-26 14:57:05
AuthorRemilia Scarlet <remilia@post...>
CommiterRemilia Scarlet

Log Message

Allow initialization of a Flat from a Lump, and remove an unused
parameter.

Change Summary

Incremental Difference

diff -r b8a632373b5d -r 82d76bf71e70 src/graphics/flat.cr
--- a/src/graphics/flat.cr Tue May 25 23:56:34 2021 -0600
+++ b/src/graphics/flat.cr Tue May 25 23:57:05 2021 -0600
@@ -23,6 +23,15 @@
2323 @data = Array.new(4096) { |_| 0u8 }
2424 end
2525
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+
2635 def initialize(@name : String, data : Bytes)
2736 unless data.size == 4096
2837 raise DwaddleError.new("Cannot create Flat: data size is incorrect")
@@ -39,7 +48,7 @@
3948 @data = Array.new(4096) { |idx| lmp.data[idx] }
4049 end
4150
42- def toImage(wad : WadFile, palette : Palette) : Image
51+ def toImage(palette : Palette) : Image
4352 unless @data.size == 4096
4453 raise DwaddleError.new("Cannot convert Flat to Image: data size is not 4096")
4554 end
Show on old repository browser