From d17ccb1258c40fbd6767c4e2c98b6e2462cb8987 Mon Sep 17 00:00:00 2001 From: Pixel Date: Thu, 25 Oct 2012 21:15:03 -0700 Subject: More scripts types. --- VP-miscwork.lua | 49 ++++++++++++++++++++++++++++++++++++++++++++++--- VP-roomwork.lua | 2 +- 2 files changed, 47 insertions(+), 4 deletions(-) diff --git a/VP-miscwork.lua b/VP-miscwork.lua index 31f7e92..cb111f3 100644 --- a/VP-miscwork.lua +++ b/VP-miscwork.lua @@ -31,11 +31,54 @@ function process_arcgfx(fname, h, size, ext) index[i].size = h:readU32() end - local tell local outfile = {} + local script = nil + local font = nil for i = 1, nfiles do - tell = h:tell() - outfile[i] = process_single_file(fname .. string.format("/%04i-%08X", i, index[i].extra), h, index[i].size, ext) + local tell = h:tell() + local handler = nil + local counter = 1 + local f1 = andB(index[i].extra, 0xffffff00) + if dump_mode and f1 == 0x00300900 then + if script then error "Can't have two scripts" end + handler = function(fname, h, size, ext) + if counter == 1 then + log "taking script" + script = Buffer(true) + script:copyfrom(h) + else + error "Too many files" + end + counter = counter + 1 + end + elseif dump_mode and f1 == 0x00300800 then + if font then error "Can't have two fonts" end + handler = function(fname, h, size, ext) + if counter == 1 then + log "taking font" + font = Buffer(true) + font:copyfrom(h) + else + error "Too many files" + end + counter = counter + 1 + end + elseif not dump_mode and f1 == 0x00300900 then + error "Not written yet" + elseif not dump_mode and f1 == 0x00300800 then + error "Not written yet" + end + outfile[i] = process_single_file(fname .. string.format("/%04i-%08X", i, index[i].extra), h, index[i].size, ext, handler) + + if handler and script and font then + if dump_mode then + extract_simple_script(fname .. string.format("/%04i", i), script, font) + end + script:destroy() + font:destroy() + script = nil + font = nil + end h:seek(tell + index[i].size) end diff --git a/VP-roomwork.lua b/VP-roomwork.lua index 4349ca4..b4724f4 100644 --- a/VP-roomwork.lua +++ b/VP-roomwork.lua @@ -223,7 +223,7 @@ function process_arcroom(fname, h, size, ext) if handler and script and font then if dump_mode and counter == 3 then extract_room_script(fname .. string.format("/%04i", i), script, font) - else + elseif dump_mode then extract_simple_script(fname .. string.format("/%04i", i), script, font) end script:destroy() -- cgit v1.2.3