示例#1
0
        public bool CopyAndTile(byte[] data, uint texSize, TerrainTex terrainTex)
        {
            var baseTexture = terrainTex.BaseTexture;

            if (baseTexture != null)
            {
                ImgTex.CopyCSI(data, texSize, texSize, baseTexture, terrainTex.TexTiling);
                return(true);
            }

            if (terrainTex.TexGID != 0) // stru_841760
            {
                var qdid = new QualifiedDataID(11, terrainTex.TexGID);

                var surfaceTexture = DBObj.GetSurfaceTexture(terrainTex.TexGID);
                terrainTex.BaseTexture = new ImgTex(surfaceTexture);
            }
            baseTexture = terrainTex.BaseTexture;

            if (baseTexture != null)
            {
                ImgTex.CopyCSI(data, texSize, texSize, baseTexture, terrainTex.TexTiling);
                return(true);
            }
            else
            {
                ImgTex.CopyCSI(data, texSize, texSize, null, 1);
                return(false);
            }
        }
示例#2
0
        public TerrainAlphaMap FindTerrainAlpha(uint pcode, uint tcode, out LandDefs.Rotation rot, out int alphaIdx)
        {
            List <TerrainAlphaMap> terrainMaps = null;
            var baseIdx = 0;

            // corner tcodes - sw / se / ne / nw
            if (tcode != 1 && tcode != 2 && tcode != 4 && tcode != 8)
            {
                baseIdx     = 4;
                terrainMaps = SideTerrainMaps;   // common tcode: 9
            }
            else
            {
                terrainMaps = CornerTerrainMaps; // common tcode: 8
            }
            var numTerrains = terrainMaps.Count;

            var prng = (int)Math.Floor((1379576222 * pcode - 1372186442) * 2.3283064e-10 * numTerrains);

            if (prng >= numTerrains)
            {
                prng = 0;
            }

            var alpha = terrainMaps[prng];

            alphaIdx = baseIdx + prng;

            rot = LandDefs.Rotation.Rot0;

            var i         = 0;
            var alphaCode = alpha.TCode;

            while (alphaCode != tcode)
            {
                // corners: 8 -> 1 -> 2 -> 4
                // sides: 9 -> 3 -> 6 -> 12
                // west / south / east / north?
                alphaCode *= 2;
                if (alphaCode >= 16)
                {
                    alphaCode -= 15;
                }
                if (++i >= 4)
                {
                    return(null);
                }
            }
            rot = (LandDefs.Rotation)i;

            if (alpha.Texture == null && alpha.TexGID != 0)
            {
                var qdid = new QualifiedDataID(11, alpha.TexGID);
                alpha.Texture = new ImgTex(DBObj.GetSurfaceTexture(alpha.TexGID));
            }
            return(alpha);
        }
示例#3
0
文件: DBObj.cs 项目: jacobtipp/trACE
        public static Object Get(QualifiedDataID qualifiedDID)
        {
            // TODO: map to ACE datloaders
            // return static or mutable?

            if (qualifiedDID.Type == 1)
            {
                return(GetCellLandblock(qualifiedDID.ID));
            }

            if (qualifiedDID.Type == 2)
            {
                return(GetLandblockInfo(qualifiedDID.ID));
            }

            if (qualifiedDID.Type == 3)
            {
                return(GetEnvCell(qualifiedDID.ID));
            }

            if (qualifiedDID.Type == 6)
            {
                return(GetGfxObj(qualifiedDID.ID));
            }

            if (qualifiedDID.Type == 7)
            {
                return(GetSetup(qualifiedDID.ID));
            }

            if (qualifiedDID.Type == 8)
            {
                return(GetAnimation(qualifiedDID.ID));
            }

            if (qualifiedDID.Type == 11)
            {
                return(GetSurfaceTexture(qualifiedDID.ID));
            }

            if (qualifiedDID.Type == 16)
            {
                return(GetEnvironment(qualifiedDID.ID));
            }

            if (qualifiedDID.Type == 42)
            {
                return(GetParticleEmitterInfo(qualifiedDID.ID));
            }

            return(-1);
        }
示例#4
0
 public static Object Get(QualifiedDataID qualifiedDID)
 {
     // TODO: map to ACE datloaders
     // return static or mutable?
     if (qualifiedDID.Type == 1)
     {
         var landblock = DatManager.CellDat.ReadFromDat <CellLandblock>(qualifiedDID.ID);
         return(landblock);
     }
     else if (qualifiedDID.Type == 2)
     {
         var landblockInfo = DatManager.CellDat.ReadFromDat <LandblockInfo>(qualifiedDID.ID);
         return(landblockInfo);
     }
     else if (qualifiedDID.Type == 3)
     {
         var envCell = DatManager.CellDat.ReadFromDat <DatLoader.FileTypes.EnvCell>(qualifiedDID.ID);
         return(new EnvCell(envCell));
     }
     else if (qualifiedDID.Type == 6)
     {
         var gfxObj = DatManager.PortalDat.ReadFromDat <GfxObj>(qualifiedDID.ID);
         return(gfxObj);
     }
     else if (qualifiedDID.Type == 7)
     {
         var setupModel = DatManager.PortalDat.ReadFromDat <SetupModel>(qualifiedDID.ID);
         return(new Setup(setupModel));
     }
     else if (qualifiedDID.Type == 8)
     {
         var animation = DatManager.PortalDat.ReadFromDat <DatLoader.FileTypes.Animation>(qualifiedDID.ID);
         return(animation);
     }
     else if (qualifiedDID.Type == 16)
     {
         var environment = DatManager.PortalDat.ReadFromDat <DatLoader.FileTypes.Environment>(qualifiedDID.ID);
         return(environment);
     }
     return(-1);
 }
示例#5
0
文件: DBObj.cs 项目: roidzilla/ACE
 public static Object Get(QualifiedDataID qualifiedDID)
 {
     // TODO: map to ACE datloaders
     // return static or mutable?
     if (qualifiedDID.Type == 6)
     {
         var gfxObj = DatManager.PortalDat.ReadFromDat <GfxObj>(qualifiedDID.ID);
         return(gfxObj);
     }
     else if (qualifiedDID.Type == 7)
     {
         var setupModel = DatManager.PortalDat.ReadFromDat <SetupModel>(qualifiedDID.ID);
         return(new Setup(setupModel));
     }
     else if (qualifiedDID.Type == 8)
     {
         var animation = DatManager.PortalDat.ReadFromDat <DatLoader.FileTypes.Animation>(qualifiedDID.ID);
         return(animation);
     }
     return(-1);
 }
示例#6
0
 public static Object Get(QualifiedDataID id)
 {
     return(null);
 }