mirror of
https://github.com/ZDoom/raze-gles.git
synced 2024-12-25 03:00:46 +00:00
Add map2text.lua and helper script mapdiff.sh.
git-svn-id: https://svn.eduke32.com/eduke32@2964 1a8010ca-5511-0410-912e-c29ae57300e0
This commit is contained in:
parent
acdb7c139c
commit
f133be4ae8
2 changed files with 110 additions and 0 deletions
83
polymer/eduke32/source/lunatic/map2text.lua
Executable file
83
polymer/eduke32/source/lunatic/map2text.lua
Executable file
|
@ -0,0 +1,83 @@
|
|||
#!/usr/bin/env luajit
|
||||
|
||||
local B = require("build")
|
||||
local string = require("string")
|
||||
|
||||
local fn = arg[1]
|
||||
|
||||
if (fn==nil) then
|
||||
print("Usage: map2text <somefile.map>")
|
||||
return 1
|
||||
end
|
||||
|
||||
local function printf(fmt, ...)
|
||||
print(string.format(fmt, ...))
|
||||
end
|
||||
|
||||
local map, errmsg = B.loadboard(fn)
|
||||
if (map == nil) then
|
||||
printf("Couldn't load \"%s\": %s", fn, errmsg)
|
||||
return 1
|
||||
end
|
||||
|
||||
|
||||
printf("numsectors = %d", map.numsectors)
|
||||
printf("numwalls = %d", map.numwalls)
|
||||
printf("numsprites = %d", map.numsprites)
|
||||
|
||||
printf("startpos = { %d, %d, %d }", map.start.x, map.start.y, map.start.z)
|
||||
printf("startang = %d", map.start.ang)
|
||||
printf("startsectnum = %d", map.start.sectnum)
|
||||
|
||||
local sector_members = {
|
||||
"wallptr", "wallnum",
|
||||
"ceilingz", "floorz",
|
||||
"ceilingstat", "floorstat",
|
||||
"ceilingpicnum", "ceilingheinum",
|
||||
"ceilingshade",
|
||||
"ceilingpal", "ceilingxpanning", "ceilingypanning",
|
||||
"floorpicnum", "floorheinum",
|
||||
"floorshade",
|
||||
"floorpal", "floorxpanning", "floorypanning",
|
||||
"visibility", "filler",
|
||||
"lotag", "hitag", "extra",
|
||||
}
|
||||
|
||||
local wall_members = {
|
||||
"x", "y",
|
||||
"point2", "nextwall", "nextsector",
|
||||
"cstat",
|
||||
"picnum", "overpicnum",
|
||||
"shade",
|
||||
"pal", "xrepeat", "yrepeat", "xpanning", "ypanning",
|
||||
"lotag", "hitag", "extra",
|
||||
}
|
||||
|
||||
local sprite_members = {
|
||||
"x", "y", "z",
|
||||
"cstat", "picnum",
|
||||
"shade",
|
||||
"pal", "clipdist", "filler",
|
||||
"xrepeat", "yrepeat",
|
||||
"xoffset", "yoffset",
|
||||
"sectnum", "statnum",
|
||||
"ang", "owner", "xvel", "yvel", "zvel",
|
||||
"lotag", "hitag", "extra",
|
||||
}
|
||||
|
||||
local function print_members(map, struct, members)
|
||||
printf("%s = {", struct)
|
||||
for i=0,map["num"..struct.."s"]-1 do
|
||||
printf("[%d]={", i)
|
||||
for j=1,#members do
|
||||
local member = members[j]
|
||||
printf("%s = %d", member, map[struct][i][member])
|
||||
end
|
||||
print("}")
|
||||
end
|
||||
print("}")
|
||||
end
|
||||
|
||||
print_members(map, "sector", sector_members)
|
||||
print_members(map, "wall", wall_members)
|
||||
print_members(map, "sprite", sprite_members)
|
27
polymer/eduke32/source/lunatic/mapdiff.sh
Executable file
27
polymer/eduke32/source/lunatic/mapdiff.sh
Executable file
|
@ -0,0 +1,27 @@
|
|||
#!/bin/sh
|
||||
|
||||
DIFF="git diff --no-index --color-words"
|
||||
CMD="/usr/bin/env luajit ./map2text.lua"
|
||||
|
||||
if [ `uname -s` != "Linux" ]; then
|
||||
# I think 'tempfile' isn't in POSIX. Feel free to use 'mktemp' or something
|
||||
# but absolutely test it before.
|
||||
echo "This helper script is for Linux only."
|
||||
return 1
|
||||
fi
|
||||
|
||||
if [ -z "$1" -o -z "$2" ]; then
|
||||
echo "Usage: ./mapdiff.sh <file.map> <file2.map>"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
tf1=`tempfile`
|
||||
tf2=`tempfile`
|
||||
|
||||
$CMD "$1" > "$tf1"
|
||||
$CMD "$2" > "$tf2"
|
||||
|
||||
$DIFF "$tf1" "$tf2"
|
||||
|
||||
rm "$tf1"
|
||||
rm "$tf2"
|
Loading…
Reference in a new issue