diff --git a/DataSpec/DNAMP1/CMDLMaterials.hpp b/DataSpec/DNAMP1/CMDLMaterials.hpp index 64f7ab0de..d64f1d4fc 100644 --- a/DataSpec/DNAMP1/CMDLMaterials.hpp +++ b/DataSpec/DNAMP1/CMDLMaterials.hpp @@ -28,28 +28,28 @@ struct MaterialSet : BigDNA { DECL_DNA Value flags; - inline bool konstValuesEnabled() const {return flags & 0x8;} - inline void setKonstValuesEnabled(bool enabled) {flags &= ~0x8; flags |= enabled << 3;} - inline bool depthSorting() const {return flags & 0x10;} - inline void setDepthSorting(bool enabled) {flags &= ~0x10; flags |= enabled << 4;} - inline bool punchthroughAlpha() const {return flags & 0x20;} - inline void setPunchthroughAlpha(bool enabled) {flags &= ~0x20; flags |= enabled << 5;} - inline bool samusReflection() const {return flags & 0x40;} - inline void setSamusReflection(bool enabled) {flags &= ~0x40; flags |= enabled << 6;} - inline bool depthWrite() const {return flags & 0x80;} - inline void setDepthWrite(bool enabled) {flags &= ~0x80; flags |= enabled << 7;} - inline bool samusReflectionSurfaceEye() const {return flags & 0x100;} - inline void setSamusReflectionSurfaceEye(bool enabled) {flags &= ~0x100; flags |= enabled << 8;} - inline bool shadowOccluderMesh() const {return flags & 0x200;} - inline void setShadowOccluderMesh(bool enabled) {flags &= ~0x200; flags |= enabled << 9;} - inline bool samusReflectionIndirectTexture() const {return flags & 0x400;} - inline void setSamusReflectionIndirectTexture(bool enabled) {flags &= ~0x400; flags |= enabled << 10;} - inline bool lightmap() const {return flags & 0x800;} - inline void setLightmap(bool enabled) {flags &= ~0x800; flags |= enabled << 11;} - inline bool lightmapUVArray() const {return flags & 0x2000;} - inline void setLightmapUVArray(bool enabled) {flags &= ~0x2000; flags |= enabled << 13;} - inline atUint16 textureSlots() const {return flags >> 16;} - inline void setTextureSlots(atUint16 texslots) {flags &= ~0xffff0000; flags |= (atUint32)texslots << 16;} + inline bool konstValuesEnabled() const {return (flags & 0x8) != 0;} + inline void setKonstValuesEnabled(bool enabled) {flags &= ~0x8; flags |= atUint32(enabled) << 3;} + inline bool depthSorting() const {return (flags & 0x10) != 0;} + inline void setDepthSorting(bool enabled) {flags &= ~0x10; flags |= atUint32(enabled) << 4;} + inline bool punchthroughAlpha() const {return (flags & 0x20) != 0;} + inline void setPunchthroughAlpha(bool enabled) {flags &= ~0x20; flags |= atUint32(enabled) << 5;} + inline bool samusReflection() const {return (flags & 0x40) != 0;} + inline void setSamusReflection(bool enabled) {flags &= ~0x40; flags |= atUint32(enabled) << 6;} + inline bool depthWrite() const {return (flags & 0x80) != 0;} + inline void setDepthWrite(bool enabled) {flags &= ~0x80; flags |= atUint32(enabled) << 7;} + inline bool samusReflectionSurfaceEye() const {return (flags & 0x100) != 0;} + inline void setSamusReflectionSurfaceEye(bool enabled) {flags &= ~0x100; flags |= atUint32(enabled) << 8;} + inline bool shadowOccluderMesh() const {return (flags & 0x200) != 0;} + inline void setShadowOccluderMesh(bool enabled) {flags &= ~0x200; flags |= atUint32(enabled) << 9;} + inline bool samusReflectionIndirectTexture() const {return (flags & 0x400) != 0;} + inline void setSamusReflectionIndirectTexture(bool enabled) {flags &= ~0x400; flags |= atUint32(enabled) << 10;} + inline bool lightmap() const {return (flags & 0x800) != 0;} + inline void setLightmap(bool enabled) {flags &= ~0x800; flags |= atUint32(enabled) << 11;} + inline bool lightmapUVArray() const {return (flags & 0x2000) != 0;} + inline void setLightmapUVArray(bool enabled) {flags &= ~0x2000; flags |= atUint32(enabled) << 13;} + inline atUint16 textureSlots() const {return (flags >> 16) != 0;} + inline void setTextureSlots(atUint16 texslots) {flags &= ~0xffff0000; flags |= atUint32(texslots) << 16;} } flags; Value textureCount; @@ -59,27 +59,27 @@ struct MaterialSet : BigDNA DECL_DNA Value vaFlags; inline GX::AttrType position() const {return GX::AttrType(vaFlags & 0x3);} - inline void setPosition(GX::AttrType val) {vaFlags &= ~0x3; vaFlags |= val;} + inline void setPosition(GX::AttrType val) {vaFlags &= ~0x3; vaFlags |= atUint32(val);} inline GX::AttrType normal() const {return GX::AttrType(vaFlags >> 2 & 0x3);} - inline void setNormal(GX::AttrType val) {vaFlags &= ~0xC; vaFlags |= val << 2;} + inline void setNormal(GX::AttrType val) {vaFlags &= ~0xC; vaFlags |= atUint32(val) << 2;} inline GX::AttrType color0() const {return GX::AttrType(vaFlags >> 4 & 0x3);} - inline void setColor0(GX::AttrType val) {vaFlags &= ~0x30; vaFlags |= val << 4;} + inline void setColor0(GX::AttrType val) {vaFlags &= ~0x30; vaFlags |= atUint32(val) << 4;} inline GX::AttrType color1() const {return GX::AttrType(vaFlags >> 6 & 0x3);} - inline void setColor1(GX::AttrType val) {vaFlags &= ~0xC0; vaFlags |= val << 6;} + inline void setColor1(GX::AttrType val) {vaFlags &= ~0xC0; vaFlags |= atUint32(val) << 6;} inline GX::AttrType tex0() const {return GX::AttrType(vaFlags >> 8 & 0x3);} - inline void setTex0(GX::AttrType val) {vaFlags &= ~0x300; vaFlags |= val << 8;} + inline void setTex0(GX::AttrType val) {vaFlags &= ~0x300; vaFlags |= atUint32(val) << 8;} inline GX::AttrType tex1() const {return GX::AttrType(vaFlags >> 10 & 0x3);} - inline void setTex1(GX::AttrType val) {vaFlags &= ~0xC00; vaFlags |= val << 10;} + inline void setTex1(GX::AttrType val) {vaFlags &= ~0xC00; vaFlags |= atUint32(val) << 10;} inline GX::AttrType tex2() const {return GX::AttrType(vaFlags >> 12 & 0x3);} - inline void setTex2(GX::AttrType val) {vaFlags &= ~0x3000; vaFlags |= val << 12;} + inline void setTex2(GX::AttrType val) {vaFlags &= ~0x3000; vaFlags |= atUint32(val) << 12;} inline GX::AttrType tex3() const {return GX::AttrType(vaFlags >> 14 & 0x3);} - inline void setTex3(GX::AttrType val) {vaFlags &= ~0xC000; vaFlags |= val << 14;} + inline void setTex3(GX::AttrType val) {vaFlags &= ~0xC000; vaFlags |= atUint32(val) << 14;} inline GX::AttrType tex4() const {return GX::AttrType(vaFlags >> 16 & 0x3);} - inline void setTex4(GX::AttrType val) {vaFlags &= ~0x30000; vaFlags |= val << 16;} + inline void setTex4(GX::AttrType val) {vaFlags &= ~0x30000; vaFlags |= atUint32(val) << 16;} inline GX::AttrType tex5() const {return GX::AttrType(vaFlags >> 18 & 0x3);} - inline void setTex5(GX::AttrType val) {vaFlags &= ~0xC0000; vaFlags |= val << 18;} + inline void setTex5(GX::AttrType val) {vaFlags &= ~0xC0000; vaFlags |= atUint32(val) << 18;} inline GX::AttrType tex6() const {return GX::AttrType(vaFlags >> 20 & 0x3);} - inline void setTex6(GX::AttrType val) {vaFlags &= ~0x300000; vaFlags |= val << 20;} + inline void setTex6(GX::AttrType val) {vaFlags &= ~0x300000; vaFlags |= atUint32(val) << 20;} } vaFlags; Value groupIdx; @@ -111,18 +111,18 @@ struct MaterialSet : BigDNA { DECL_DNA Value flags; - inline bool lighting() const {return flags & 0x1;} - inline void setLighting(bool enabled) {flags &= ~0x1; flags |= enabled;} - inline bool useAmbient() const {return flags & 0x2;} - inline void setUseAmbient(bool enabled) {flags &= ~0x2; flags |= enabled << 1;} - inline bool useMaterial() const {return flags & 0x4;} - inline void setUseMaterial(bool enabled) {flags &= ~0x4; flags |= enabled << 2;} - inline bool lightmask() const {return flags >> 3 & 0xff;} - inline void setLightmask(atUint8 mask) {flags &= ~0x7f8; flags |= (atUint32)mask << 3;} - inline bool diffuseFn() const {return flags >> 11 & 0x3;} - inline void setDiffuseFn(atUint8 fn) {flags &= ~0x1800; flags |= (atUint32)fn << 11;} - inline bool attenuationFn() const {return flags >> 13 & 0x3;} - inline void setAttenuationFn(atUint8 fn) {flags &= ~0x6000; flags |= (atUint32)fn << 13;} + inline bool lighting() const {return (flags & 0x1) != 0;} + inline void setLighting(bool enabled) {flags &= ~0x1; flags |= atUint32(enabled);} + inline bool useAmbient() const {return (flags & 0x2) != 0;} + inline void setUseAmbient(bool enabled) {flags &= ~0x2; flags |= atUint32(enabled) << 1;} + inline bool useMaterial() const {return (flags & 0x4) != 0;} + inline void setUseMaterial(bool enabled) {flags &= ~0x4; flags |= atUint32(enabled) << 2;} + inline atUint8 lightmask() const {return atUint8(flags >> 3 & 0xff);} + inline void setLightmask(atUint8 mask) {flags &= ~0x7f8; flags |= atUint32(mask) << 3;} + inline atUint8 diffuseFn() const {return atUint8(flags >> 11 & 0x3);} + inline void setDiffuseFn(atUint8 fn) {flags &= ~0x1800; flags |= atUint32(fn) << 11;} + inline atUint8 attenuationFn() const {return atUint8(flags >> 13 & 0x3);} + inline void setAttenuationFn(atUint8 fn) {flags &= ~0x6000; flags |= atUint32(fn) << 13;} }; Vector colorChannels; @@ -140,44 +140,44 @@ struct MaterialSet : BigDNA Value rascInput; inline GX::TevColorArg colorInA() const {return GX::TevColorArg(ciFlags & 0xf);} - inline void setColorInA(GX::TevColorArg val) {ciFlags &= ~0x1f; ciFlags |= val;} + inline void setColorInA(GX::TevColorArg val) {ciFlags &= ~0x1f; ciFlags |= atUint32(val);} inline GX::TevColorArg colorInB() const {return GX::TevColorArg(ciFlags >> 5 & 0xf);} - inline void setColorInB(GX::TevColorArg val) {ciFlags &= ~0x3e0; ciFlags |= val << 5;} + inline void setColorInB(GX::TevColorArg val) {ciFlags &= ~0x3e0; ciFlags |= atUint32(val) << 5;} inline GX::TevColorArg colorInC() const {return GX::TevColorArg(ciFlags >> 10 & 0xf);} - inline void setColorInC(GX::TevColorArg val) {ciFlags &= ~0x7c00; ciFlags |= val << 10;} + inline void setColorInC(GX::TevColorArg val) {ciFlags &= ~0x7c00; ciFlags |= atUint32(val) << 10;} inline GX::TevColorArg colorInD() const {return GX::TevColorArg(ciFlags >> 15 & 0xf);} - inline void setColorInD(GX::TevColorArg val) {ciFlags &= ~0xf8000; ciFlags |= val << 15;} + inline void setColorInD(GX::TevColorArg val) {ciFlags &= ~0xf8000; ciFlags |= atUint32(val) << 15;} inline GX::TevAlphaArg alphaInA() const {return GX::TevAlphaArg(aiFlags & 0x7);} - inline void setAlphaInA(GX::TevAlphaArg val) {aiFlags &= ~0x1f; aiFlags |= val;} + inline void setAlphaInA(GX::TevAlphaArg val) {aiFlags &= ~0x1f; aiFlags |= atUint32(val);} inline GX::TevAlphaArg alphaInB() const {return GX::TevAlphaArg(aiFlags >> 5 & 0x7);} - inline void setAlphaInB(GX::TevAlphaArg val) {aiFlags &= ~0x3e0; aiFlags |= val << 5;} + inline void setAlphaInB(GX::TevAlphaArg val) {aiFlags &= ~0x3e0; aiFlags |= atUint32(val) << 5;} inline GX::TevAlphaArg alphaInC() const {return GX::TevAlphaArg(aiFlags >> 10 & 0x7);} - inline void setAlphaInC(GX::TevAlphaArg val) {aiFlags &= ~0x7c00; aiFlags |= val << 10;} + inline void setAlphaInC(GX::TevAlphaArg val) {aiFlags &= ~0x7c00; aiFlags |= atUint32(val) << 10;} inline GX::TevAlphaArg alphaInD() const {return GX::TevAlphaArg(aiFlags >> 15 & 0x7);} - inline void setAlphaInD(GX::TevAlphaArg val) {aiFlags &= ~0xf8000; aiFlags |= val << 15;} + inline void setAlphaInD(GX::TevAlphaArg val) {aiFlags &= ~0xf8000; aiFlags |= atUint32(val) << 15;} inline GX::TevOp colorOp() const {return GX::TevOp(ccFlags & 0xf);} - inline void setColorOp(GX::TevOp val) {ccFlags &= ~0x1; ccFlags |= val;} + inline void setColorOp(GX::TevOp val) {ccFlags &= ~0x1; ccFlags |= atUint32(val);} inline GX::TevBias colorOpBias() const {return GX::TevBias(ccFlags >> 4 & 0x3);} - inline void setColorOpBias(GX::TevBias val) {ccFlags &= ~0x30; ccFlags |= val << 4;} + inline void setColorOpBias(GX::TevBias val) {ccFlags &= ~0x30; ccFlags |= atUint32(val) << 4;} inline GX::TevScale colorOpScale() const {return GX::TevScale(ccFlags >> 6 & 0x3);} - inline void setColorOpScale(GX::TevScale val) {ccFlags &= ~0xc0; ccFlags |= val << 6;} + inline void setColorOpScale(GX::TevScale val) {ccFlags &= ~0xc0; ccFlags |= atUint32(val) << 6;} inline bool colorOpClamp() const {return ccFlags >> 8 & 0x1;} - inline void setColorOpClamp(bool val) {ccFlags &= ~0x100; ccFlags |= val << 8;} + inline void setColorOpClamp(bool val) {ccFlags &= ~0x100; ccFlags |= atUint32(val) << 8;} inline GX::TevRegID colorOpOutReg() const {return GX::TevRegID(ccFlags >> 9 & 0x3);} - inline void setColorOpOutReg(GX::TevRegID val) {ccFlags &= ~0x600; ccFlags |= val << 9;} + inline void setColorOpOutReg(GX::TevRegID val) {ccFlags &= ~0x600; ccFlags |= atUint32(val) << 9;} inline GX::TevOp alphaOp() const {return GX::TevOp(acFlags & 0xf);} - inline void setAlphaOp(GX::TevOp val) {acFlags &= ~0x1; acFlags |= val;} + inline void setAlphaOp(GX::TevOp val) {acFlags &= ~0x1; acFlags |= atUint32(val);} inline GX::TevBias alphaOpBias() const {return GX::TevBias(acFlags >> 4 & 0x3);} - inline void setAlphaOpBias(GX::TevBias val) {acFlags &= ~0x30; acFlags |= val << 4;} + inline void setAlphaOpBias(GX::TevBias val) {acFlags &= ~0x30; acFlags |= atUint32(val) << 4;} inline GX::TevScale alphaOpScale() const {return GX::TevScale(acFlags >> 6 & 0x3);} - inline void setAlphaOpScale(GX::TevScale val) {acFlags &= ~0xc0; acFlags |= val << 6;} + inline void setAlphaOpScale(GX::TevScale val) {acFlags &= ~0xc0; acFlags |= atUint32(val) << 6;} inline bool alphaOpClamp() const {return acFlags >> 8 & 0x1;} - inline void setAlphaOpClamp(bool val) {acFlags &= ~0x100; acFlags |= val << 8;} + inline void setAlphaOpClamp(bool val) {acFlags &= ~0x100; acFlags |= atUint32(val) << 8;} inline GX::TevRegID alphaOpOutReg() const {return GX::TevRegID(acFlags >> 9 & 0x3);} - inline void setAlphaOpOutReg(GX::TevRegID val) {acFlags &= ~0x600; acFlags |= val << 9;} + inline void setAlphaOpOutReg(GX::TevRegID val) {acFlags &= ~0x600; acFlags |= atUint32(val) << 9;} }; Vector tevStages; struct TEVStageTexInfo : BigDNA @@ -196,15 +196,15 @@ struct MaterialSet : BigDNA Value flags; inline GX::TexGenType type() const {return GX::TexGenType(flags & 0xf);} - inline void setType(GX::TexGenType val) {flags &= ~0xf; flags |= val;} + inline void setType(GX::TexGenType val) {flags &= ~0xf; flags |= atUint32(val);} inline GX::TexGenSrc source() const {return GX::TexGenSrc(flags >> 4 & 0x1f);} - inline void setSource(GX::TexGenSrc val) {flags &= ~0x1f0; flags |= val << 4;} + inline void setSource(GX::TexGenSrc val) {flags &= ~0x1f0; flags |= atUint32(val) << 4;} inline GX::TexMtx mtxIdx() const {return GX::TexMtx(flags >> 9 & 0x1f + 30);} - inline void setMtxIdx(GX::TexMtx val) {flags &= ~0x3e00; flags |= (val-30) << 9;} + inline void setMtxIdx(GX::TexMtx val) {flags &= ~0x3e00; flags |= (atUint32(val)-30) << 9;} inline bool normalize() const {return flags >> 14 & 0x1;} - inline void setNormalize(bool val) {flags &= ~0x4000; flags |= val << 14;} + inline void setNormalize(bool val) {flags &= ~0x4000; flags |= atUint32(val) << 14;} inline GX::PTTexMtx postMtxIdx() const {return GX::PTTexMtx(flags >> 15 & 0x3f + 64);} - inline void setPostMtxIdx(GX::PTTexMtx val) {flags &= ~0x1f8000; flags |= (val-64) << 15;} + inline void setPostMtxIdx(GX::PTTexMtx val) {flags &= ~0x1f8000; flags |= (atUint32(val)-64) << 15;} }; Vector tgcs; diff --git a/DataSpec/DNAMP1/CMakeLists.txt b/DataSpec/DNAMP1/CMakeLists.txt index f9cfd951c..fc0650bb1 100644 --- a/DataSpec/DNAMP1/CMakeLists.txt +++ b/DataSpec/DNAMP1/CMakeLists.txt @@ -1,11 +1,10 @@ make_dnalist(liblist PAK MLVL - STRG CMDL CMDLMaterials) add_library(DNAMP1 DNAMP1.hpp DNAMP1.cpp ${liblist} PAK.cpp - STRG.cpp) + STRG.hpp STRG.cpp) diff --git a/DataSpec/DNAMP2/CMDLMaterials.hpp b/DataSpec/DNAMP2/CMDLMaterials.hpp index 7aeacece3..1f22b81b7 100644 --- a/DataSpec/DNAMP2/CMDLMaterials.hpp +++ b/DataSpec/DNAMP2/CMDLMaterials.hpp @@ -32,15 +32,12 @@ struct MaterialSet : BigDNA Vector konstColors; Value _blendDstFac; - inline DNAMP1::MaterialSet::Material::BlendFactor blendDestFactor() const - {return DNAMP1::MaterialSet::Material::BlendFactor(_blendDstFac);} - inline void setBlendDestFactor(DNAMP1::MaterialSet::Material::BlendFactor fac) - {_blendDstFac = fac;} + using BlendFactor = DNAMP1::MaterialSet::Material::BlendFactor; + inline BlendFactor blendDestFactor() const {return BlendFactor(_blendDstFac);} + inline void setBlendDestFactor(BlendFactor fac) {_blendDstFac = fac;} Value _blendSrcFac; - inline DNAMP1::MaterialSet::Material::BlendFactor blendSrcFactor() const - {return DNAMP1::MaterialSet::Material::BlendFactor(_blendSrcFac);} - inline void setBlendSrcFactor(DNAMP1::MaterialSet::Material::BlendFactor fac) - {_blendSrcFac = fac;} + inline BlendFactor blendSrcFactor() const {return BlendFactor(_blendSrcFac);} + inline void setBlendSrcFactor(BlendFactor fac) {_blendSrcFac = fac;} Vector indTexSlot; Value colorChannelCount; diff --git a/DataSpec/DNAMP2/CMakeLists.txt b/DataSpec/DNAMP2/CMakeLists.txt index e6804c575..ab3e5894e 100644 --- a/DataSpec/DNAMP2/CMakeLists.txt +++ b/DataSpec/DNAMP2/CMakeLists.txt @@ -1,8 +1,7 @@ make_dnalist(liblist MLVL - STRG CMDLMaterials) add_library(DNAMP2 DNAMP2.hpp DNAMP2.cpp ${liblist} - STRG.cpp) + STRG.hpp STRG.cpp) diff --git a/DataSpec/DNAMP3/CMakeLists.txt b/DataSpec/DNAMP3/CMakeLists.txt index 027b62f61..34f3956ac 100644 --- a/DataSpec/DNAMP3/CMakeLists.txt +++ b/DataSpec/DNAMP3/CMakeLists.txt @@ -1,9 +1,8 @@ make_dnalist(liblist PAK - MLVL - STRG) + MLVL) add_library(DNAMP3 DNAMP3.hpp DNAMP3.cpp ${liblist} PAK.cpp - STRG.cpp) + STRG.hpp STRG.cpp) diff --git a/NODLib b/NODLib index 9e7e0979b..7fafe3ce0 160000 --- a/NODLib +++ b/NODLib @@ -1 +1 @@ -Subproject commit 9e7e0979bd3fcdcd1930a477c96838f9d8418f70 +Subproject commit 7fafe3ce0c14f9e244bb47572f5448e82b597a68