diff --git a/polymer/eduke32/source/lunatic/util/build.lua b/polymer/eduke32/source/lunatic/util/build.lua index 2aed89561..64ea0becd 100644 --- a/polymer/eduke32/source/lunatic/util/build.lua +++ b/polymer/eduke32/source/lunatic/util/build.lua @@ -76,12 +76,8 @@ MAX = } local function doread(fh, basectype, numelts) - if (numelts==0) then - return nil - end - + assert(numelts > 0) local cd = ffi.new(basectype.."[?]", numelts) - local size = ffi.sizeof(basectype)*numelts if (C.fread(cd, ffi.sizeof(basectype), numelts, fh) ~= numelts) then fh:close() @@ -206,7 +202,7 @@ end -- } -- } function loadboard(filename, do_canonicalize_sprite) - local fh, errmsg = io.open(filename) + local fh, errmsg = io.open(filename, "rb") if (fh==nil) then return nil, errmsg @@ -340,7 +336,7 @@ function loadarts(filenames) for fni=1,#filenames do local fn = filenames[fni] - local fh, errmsg = io.open(fn) + local fh, errmsg = io.open(fn, "rb") if (fh==nil) then return nil, errmsg diff --git a/polymer/eduke32/source/lunatic/util/findmaps.sh b/polymer/eduke32/source/lunatic/util/findmaps.sh index ad8f24f7a..74a4752bc 100755 --- a/polymer/eduke32/source/lunatic/util/findmaps.sh +++ b/polymer/eduke32/source/lunatic/util/findmaps.sh @@ -1,4 +1,4 @@ -#!/bin/sh +#!/bin/bash ok=yes if [ -z "$1" ]; then @@ -13,4 +13,10 @@ if [ -z "$ok" ]; then exit 1 fi -find -L "$1" -iname '*.map' -print0 | xargs -0 ./foreachmap.lua "-e$2" +LOPT=-L +idx=$(expr match `uname -s` '[mM][iI][nN][gG][wW]') +if [ "$idx" != 0 ]; then + LOPT= +fi + +find $LOPT "$1" -iname '*.map' -print0 | xargs -0 ./foreachmap.lua "-e$2" diff --git a/polymer/eduke32/source/lunatic/util/foreachmap.lua b/polymer/eduke32/source/lunatic/util/foreachmap.lua index c006b2a82..dff20ab74 100755 --- a/polymer/eduke32/source/lunatic/util/foreachmap.lua +++ b/polymer/eduke32/source/lunatic/util/foreachmap.lua @@ -20,6 +20,8 @@ -- The local 'd' provides defs loaded from ../../names.h, example: -- $ ./findmaps.sh ~/.eduke32/ "sprite: .picnum>=d. CRACK1 and .picnum<=d. CRACK4" +-- (The space between "d." and "CRACK" is because ".xxx" is translated to +-- "sprite[].xxx".) -- Print all V9 maps along with their number of bunches and max(ceilings of a bunch) -- $ prog='if (map.version==9) then print(map.numbunches.." ".. math.max(unpack(map.sectsperbunch[0],0)) .." "..fn) end'