View of the Roblox plugin:
^raw WAD
In the end, Doom WADs can now be imported to Roblox perfectly without much work.
Data such as actor and entity position is also readable and is being worked on
lump = {}
lump.__index = lump
function lump:unpack16(index, endian) --unpack INT16, undecoded
local result = ""
for push = index, index + (1*endian), endian do
result = result
.. string.format("%x", self.data:byte(index-math.max(0,endian)+push,index-math.max(0,endian)+push+1))
end
return tonumber("0x" .. result)
end
function lump:new(_name, _game, _file, _processed)
local self = setmetatable({}, {
header = function(_)
for _1 in self.data:gmatch("[%a%d]+") do
if _1:len() == self.header_size then
local a, b = string.find(self.data, _1)
if not a then return end
if self.data:sub(a, b) == self.name then
self.header.Index = a
return self.header.Index
end
end
end
end;
});
self.name = _name;
self.packet_size = game_data[_game].packet_size
self.header_size = game_data[_game].header_size
self.data = _file;
self.header = {};
self.header.index, _ = string.find(self.data, self.name)
self.header.size_index = self.data:sub(self.header.index-(dir.filepos),self.header.index-(dir.size))
self.header.off_index = self.data:sub(self.header.index-(dir.name), self.header.index-(dir.filepos))
self.processed = {}
if typeof(_processed) == "table" then
self.processed = _processed
end
return self;
end
--[[ example
local vert = lump:new( "VERTEXES", "Doom", raw, {} )
local v_off = vert:unpack16(vert.header.off_index, -1)
for r = 0, vert:unpack16(vert.header.size_index, -1) - vert.packet_size, vert.packet_size do
table.insert(vert.processed,
{x = vert:unpack16(v_off+r+2), y = vert:unpack16(v_off+r+4)})
--]]
function lump:unpack32(index, endian) --unpack INT32, undecoded
local result = ""
for push = index, index + (3*endian), endian do
result = result
.. string.format("%x", self.data:byte(index-math.max(0,endian)+push,index-math.max(0,endian)+push+1))
end
return tonumber("0x" .. result)
end
dir = { size = 0, filepos = 4, name = 8}
game_data = {
Doom = {
packet_size = 16,
vertex_size = 4,
linedef_size = 14,
sidedef_size = 30,
sector_size = 26,
header_size = 16,
},
}```