Skip to content

Commit

Permalink
changes made to support v1100
Browse files Browse the repository at this point in the history
  • Loading branch information
Mario Van Hissenhoven committed Apr 23, 2023
1 parent 65645bf commit d0f5902
Show file tree
Hide file tree
Showing 2 changed files with 23 additions and 9 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@
global _helper = undefined
global _reader = undefined
global _build = undefined
global _mdx_version = undefined
)

STRUCT WC3REF_MDX
Expand Down Expand Up @@ -58,6 +59,7 @@ STRUCT WC3REF_MDX
format "Processing %\n" tag.name

if( tag.Name == "VERS" ) then mdx.vers = _reader.ReadVERS stream tag
_mdx_version = mdx.vers
if( tag.Name == "MODL" ) then mdx.modl = _reader.ReadMODL stream tag
if( tag.Name == "SEQS" ) then mdx.seqs = _reader.ReadSEQS stream tag
if( tag.Name == "MTLS" ) then mdx.mtls = _reader.ReadMTLS stream tag
Expand Down Expand Up @@ -92,5 +94,10 @@ STRUCT WC3REF_MDX
clearSelection()
max tool zoomextents all
setArrowCursor()


)
)
)


--WC3REF_MDX.Import @"G:\Blizzard\Warcraft - Reforged\Extracted 1100\war3.w3mod\_hd.w3mod\units\creeps\archnathid\archnathid.mdx"
Original file line number Diff line number Diff line change
Expand Up @@ -227,7 +227,7 @@ struct Warcraft_3_Ref_Read
fseek stream tag.Offset #seek_set
local version = readLong stream

if (version != 1000) then throw (format "[Error] Incorrect version: %, expected version: 1000\n" version)
if (version != 1000 and version != 1100) then throw (format "[Error] Incorrect version: %, expected version: 1000 or 1100\n" version)

if DEBUG_MODE then format "Version: %\n" version

Expand Down Expand Up @@ -327,7 +327,7 @@ struct Warcraft_3_Ref_Read
(
local shdr = _reader.ReadShader stream
append mtls shdr
if DEBUG_MODE then format "%\n" shdr
--if DEBUG_MODE then format "%\n" shdr
)
return mtls
),
Expand All @@ -339,7 +339,10 @@ struct Warcraft_3_Ref_Read
shdr.Size = readLong stream
shdr.PriorityPlane = readLong stream
shdr.Flags = readLong stream
shdr.Name = _helper.ReadFixedString stream 80

--> version 1100 does not seem to have this name
if ( _mdx_version == 1000 ) then shdr.Name = _helper.ReadFixedString stream 80

shdr.Lays = _helper.ReadFixedString stream 4
shdr.NumberOfLayers = readLong stream

Expand Down Expand Up @@ -380,13 +383,15 @@ struct Warcraft_3_Ref_Read
lay.FresnelMultiplier = readfloat stream
lay.TeamColorMultiplier = readfloat stream




-- unknown for now -> a set of 14 integers
if ( _mdx_version == 1100 ) then _helper.SkipBytes stream 56

if DEBUG_MODE then format " - %\n" lay
local animationsArePresent = false

if (lay.Size > 52 ) then
if ( _mdx_version == 1000 and lay.Size > 52 ) then animationsArePresent = true
if ( _mdx_version == 1100 and lay.Size > 108 ) then animationsArePresent = true

if (animationsArePresent ) then
(
for x=1 to 3 do
(
Expand All @@ -401,6 +406,8 @@ struct Warcraft_3_Ref_Read
if ( lay.KMTF == undefined ) then fseek stream -4 #seek_cur
)

if DEBUG_MODE then format " - %\n" lay

return lay
),
function ReadTEXS stream tag=
Expand Down

0 comments on commit d0f5902

Please sign in to comment.