Skip to content

Commit

Permalink
Fix incorrect sector min max
Browse files Browse the repository at this point in the history
  • Loading branch information
pudingus committed Nov 28, 2020
1 parent 17642a1 commit 7286e51
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 8 deletions.
15 changes: 9 additions & 6 deletions scripts/max4ds/4ds_export.ms
Original file line number Diff line number Diff line change
Expand Up @@ -472,16 +472,11 @@ rollout MafiaTools_4dsExport "" ( --module
sector.flags2 = 0
if version == #mafia then (
sector.mesh = snapshotAsMesh mnode.baseNode
sector.dmin = mnode.baseNode.min * unitscale
sector.dmax = mnode.baseNode.max * unitscale

util.TransformVerts sector.mesh unitscale
)
else (
sector.mesh = copy mnode.baseNode.mesh
sector.dmin = in coordsys local mnode.baseNode.min * unitscale
sector.dmax = in coordsys local mnode.baseNode.max * unitscale

local baseNode = mnode.baseNode

local scl = scaleMatrix [unitscale,unitscale,unitscale]
Expand All @@ -496,7 +491,15 @@ rollout MafiaTools_4dsExport "" ( --module
sector.flags1 = sgp.sectorFlags1
sector.flags2 = sgp.sectorFlags2
)


local size = 1.0e16
sector.dmin = [size, size, size]
sector.dmax = [-size, -size, -size]

for vertId = 1 to sector.mesh.numverts do (
local vert = getVert sector.mesh vertId
MinMax sector.dmin sector.dmax vert
)


for portalNode in mnode.portals do (
Expand Down
4 changes: 2 additions & 2 deletions scripts/max4ds/4ds_parser.ms
Original file line number Diff line number Diff line change
Expand Up @@ -1127,7 +1127,7 @@ rollout MafiaTools_4dsParser "" ( --module

struct TGlow (
position, --float, screen offset
unknown = 0.0, --float, only HD2 and Chameleon
unknown = 1.0, --float, only HD2 and Chameleon

-- u16, 0 == no_texture, 1..N == materials
-- zero is invalid here, crashes the game
Expand All @@ -1154,7 +1154,7 @@ rollout MafiaTools_4dsParser "" ( --module
WriteU8 f mglows.count
for mglow in mglows do (
WriteFloatSafe f mglow.position
if version != #mafia do WriteFloatSafe f 0.0
if version != #mafia do WriteFloatSafe f mglow.unknown
WriteU16 f mglow.matId
if mglow.matId == 0 do throw "TGlow.matId cannot be zero"
)
Expand Down

0 comments on commit 7286e51

Please sign in to comment.