mirror of
https://github.com/ZDoom/raze-gles.git
synced 2025-01-11 18:50:46 +00:00
build.lua: add .sectsperbunch to map table, useful for TROR stats w/ findmaps.sh
Also, sync MAXBUNCHES to new limit in lunatic/defs_common.lua. git-svn-id: https://svn.eduke32.com/eduke32@3665 1a8010ca-5511-0410-912e-c29ae57300e0
This commit is contained in:
parent
ec5cd930e0
commit
0dba35b207
3 changed files with 42 additions and 22 deletions
|
@ -287,7 +287,7 @@ enum {
|
||||||
MAXTILES = 30720,
|
MAXTILES = 30720,
|
||||||
MAXSPRITESONSCREEN = 4096,
|
MAXSPRITESONSCREEN = 4096,
|
||||||
|
|
||||||
MAXBUNCHES = 256,
|
MAXBUNCHES = 512,
|
||||||
CEILING = 0,
|
CEILING = 0,
|
||||||
FLOOR = 1,
|
FLOOR = 1,
|
||||||
|
|
||||||
|
|
|
@ -118,6 +118,7 @@ local function get_numyaxbunches(map)
|
||||||
end
|
end
|
||||||
|
|
||||||
local numbunches = 0
|
local numbunches = 0
|
||||||
|
local sectsperbunch = { [0]={}, [1]={} }
|
||||||
|
|
||||||
for i=0,map.numsectors-1 do
|
for i=0,map.numsectors-1 do
|
||||||
for cf=0,1 do
|
for cf=0,1 do
|
||||||
|
@ -129,11 +130,18 @@ local function get_numyaxbunches(map)
|
||||||
if (xpan+1 > numbunches) then
|
if (xpan+1 > numbunches) then
|
||||||
numbunches = xpan+1
|
numbunches = xpan+1
|
||||||
end
|
end
|
||||||
|
|
||||||
|
if (sectsperbunch[cf][xpan]==nil) then
|
||||||
|
sectsperbunch[cf][xpan] = 1
|
||||||
|
else
|
||||||
|
sectsperbunch[cf][xpan] = sectsperbunch[cf][xpan]+1
|
||||||
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
return numbunches
|
map.numbunches = numbunches
|
||||||
|
map.sectsperbunch = sectsperbunch
|
||||||
end
|
end
|
||||||
|
|
||||||
--== sprite canonicalizer ==--
|
--== sprite canonicalizer ==--
|
||||||
|
@ -195,6 +203,10 @@ end
|
||||||
-- start =
|
-- start =
|
||||||
-- { x=<num>, y=<num>, z=<num>, ang=<num>, sectnum=<num> },
|
-- { x=<num>, y=<num>, z=<num>, ang=<num>, sectnum=<num> },
|
||||||
-- numbunches = <num>,
|
-- numbunches = <num>,
|
||||||
|
-- sectsperbunch = {
|
||||||
|
-- [0] = { [<bunchnum>]=<number of ceilings> },
|
||||||
|
-- [1] = { [<bunchnum>]=<number of floors> }
|
||||||
|
-- }
|
||||||
-- }
|
-- }
|
||||||
function loadboard(filename, do_canonicalize_sprite)
|
function loadboard(filename, do_canonicalize_sprite)
|
||||||
local fh, errmsg = io.open(filename)
|
local fh, errmsg = io.open(filename)
|
||||||
|
@ -284,7 +296,7 @@ function loadboard(filename, do_canonicalize_sprite)
|
||||||
map.wall = set_secwalspr_mt(map.wall, map.numwalls)
|
map.wall = set_secwalspr_mt(map.wall, map.numwalls)
|
||||||
map.sprite = set_secwalspr_mt(map.sprite, map.numsprites)
|
map.sprite = set_secwalspr_mt(map.sprite, map.numsprites)
|
||||||
|
|
||||||
map.numbunches = get_numyaxbunches(map)
|
get_numyaxbunches(map)
|
||||||
|
|
||||||
-- done
|
-- done
|
||||||
return map
|
return map
|
||||||
|
@ -389,11 +401,7 @@ function readdefs(fn)
|
||||||
|
|
||||||
local defs = {}
|
local defs = {}
|
||||||
|
|
||||||
while (true) do
|
for line in fh:lines() do
|
||||||
local line = fh:read()
|
|
||||||
if (line == nil) then
|
|
||||||
break
|
|
||||||
end
|
|
||||||
local defname, numstr = string.match(line, "#?%s*define%s+([%a_][%w_]+)%s+([0-9]+)")
|
local defname, numstr = string.match(line, "#?%s*define%s+([%a_][%w_]+)%s+([0-9]+)")
|
||||||
if (defname) then
|
if (defname) then
|
||||||
defs[defname] = tonumber(numstr)
|
defs[defname] = tonumber(numstr)
|
||||||
|
|
|
@ -16,10 +16,14 @@
|
||||||
|
|
||||||
-- forxcode example: print sprite numbers with lotag < -1 (interpreting lotag it as signed),
|
-- forxcode example: print sprite numbers with lotag < -1 (interpreting lotag it as signed),
|
||||||
-- and for each matching sprite also print its lotag and picnum:
|
-- and for each matching sprite also print its lotag and picnum:
|
||||||
-- ./findmaps.sh ~/.eduke32/ "sprite: .lotag < -1 :: io. write(', '.. .lotag .. ' ' .. .picnum)"
|
-- $ ./findmaps.sh ~/.eduke32/ "sprite: .lotag < -1 :: io. write(', '.. .lotag .. ' ' .. .picnum)"
|
||||||
|
|
||||||
-- The local 'd' provides defs loaded from ../../names.h, example:
|
-- The local 'd' provides defs loaded from ../../names.h, example:
|
||||||
-- ./findmaps.sh ~/.eduke32/ "sprite: .picnum>=d. CRACK1 and .picnum<=d. CRACK4"
|
-- $ ./findmaps.sh ~/.eduke32/ "sprite: .picnum>=d. CRACK1 and .picnum<=d. CRACK4"
|
||||||
|
|
||||||
|
-- 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'
|
||||||
|
-- $ ./findmaps.sh ~/.eduke32 "$prog" |sort -n -k 2
|
||||||
|
|
||||||
local B = require "build"
|
local B = require "build"
|
||||||
local string = require "string"
|
local string = require "string"
|
||||||
|
@ -45,6 +49,14 @@ end
|
||||||
|
|
||||||
local modname = string.gsub(arg[1], "%.lua$", "")
|
local modname = string.gsub(arg[1], "%.lua$", "")
|
||||||
|
|
||||||
|
function sum(tab, initidx)
|
||||||
|
local s = 0
|
||||||
|
for i=(initidx or 1),#tab do
|
||||||
|
s = s + tab[i]
|
||||||
|
end
|
||||||
|
return s
|
||||||
|
end
|
||||||
|
|
||||||
local mod
|
local mod
|
||||||
if (modname:sub(1,2) == "-e") then
|
if (modname:sub(1,2) == "-e") then
|
||||||
local body = modname:sub(3)
|
local body = modname:sub(3)
|
||||||
|
@ -68,25 +80,25 @@ if (modname:sub(1,2) == "-e") then
|
||||||
perxcode = ""
|
perxcode = ""
|
||||||
end
|
end
|
||||||
|
|
||||||
|
assert(what=="sector" or what=="wall" or what=="sprite")
|
||||||
|
|
||||||
body =
|
body =
|
||||||
"for i=0,num"..what.."s-1 do\n"..
|
"for i=0,num"..what.."s-1 do\n"..
|
||||||
" if ("..body..") then\n"..
|
" if ("..body..") then\n"..
|
||||||
(onlyfiles and "io.write(fn); return\n" or "io.write(fn..': '..i)\n") ..
|
(onlyfiles and "io.write(fn); return\n" or "io.write(fn..': '..i)\n") ..
|
||||||
perxcode .. "io.write('\\n')"..
|
perxcode .. "io.write('\\n')\n"..
|
||||||
"\n end\n"..
|
" end\n"..
|
||||||
"end\n"
|
"end\n"
|
||||||
end
|
end
|
||||||
|
|
||||||
local successfunc, errmsg = loadstring(
|
local successfunc, errmsg = loadstring([[
|
||||||
"local d=require('build').readdefs('../../names.h') or error('Need ../../names.h')\n".. -- XXX
|
local d=require('build').readdefs('../../names.h') or error('Need ../../names.h') -- XXX
|
||||||
"local numsectors, numwalls, numsprites\n"
|
local numsectors, numwalls, numsprites, sector, wall, sprite
|
||||||
.."local sector, wall, sprite\n"
|
return function (map, fn)
|
||||||
.."return function (map, fn) \n"
|
numsectors, numwalls, numsprites = map.numsectors, map.numwalls, map.numsprites
|
||||||
.." numsectors, numwalls, numsprites = map.numsectors, map.numwalls, map.numsprites\n"
|
sector, wall, sprite = map.sector, map.wall, map.sprite
|
||||||
.." sector, wall, sprite = map.sector, map.wall, map.sprite\n"
|
]]..body
|
||||||
..body.."\n"
|
.." end")
|
||||||
.."end"
|
|
||||||
)
|
|
||||||
|
|
||||||
if (successfunc==nil) then
|
if (successfunc==nil) then
|
||||||
io.stderr:write("Error loading string: "..errmsg.."\n")
|
io.stderr:write("Error loading string: "..errmsg.."\n")
|
||||||
|
|
Loading…
Reference in a new issue