docs/guide: Quake maps and BSP, WAD2 / WAD3, lmp / spr, Quake III shaders and skins; bench lines; q3skin sniff needs a path
This commit is contained in:
1 parent
175ca9e823
commit
1e69799c21
11 files changed
+663
-461
No files matched your search
@@ -25,16 +25,20 @@ function Q3Skin.sniff(r: Bytes.Reader): number
|
||||
if #head < 3 or string.find(head, "[%z\1-\8\14-\31]") then
|
||||
return 0
|
||||
end
|
||||
local lines, good = 0, 0
|
||||
local lines, good, paths = 0, 0, 0
|
||||
for line in string.gmatch(head, "[^\r\n]+") do
|
||||
if not string.match(line, "^%s*$") then
|
||||
lines += 1
|
||||
if string.match(line, "^%s*[%w_%-]+%s*,%s*[^,%s]*%s*$") then
|
||||
local surface, shader = string.match(line, "^%s*([%w_%-]+)%s*,%s*([^,%s]*)%s*$")
|
||||
if surface and shader == "" and string.sub(string.lower(surface), 1, 4) == "tag_" then
|
||||
good += 1
|
||||
elseif shader and string.find(shader, "/", 1, true) then
|
||||
good += 1
|
||||
paths += 1
|
||||
end
|
||||
end
|
||||
end
|
||||
return if lines > 0 and good == lines then 0.5 else 0
|
||||
return if lines > 0 and good == lines and paths > 0 then 0.5 else 0
|
||||
end
|
||||
|
||||
-- ------------------------------------------------------------------------------------------------ decode
|
||||
|
||||
Reference in new issue
Block a user