Inheritance: XCImageCollection
Example #1
0
		public Cursor(PckFile cursorFile)
		{
			state = CursorState.Select;	
			this.cursorFile=cursorFile;

			foreach(PckImage pi in cursorFile)
				pi.Image.MakeTransparent(cursorFile.Pal.Transparent);
		}
Example #2
0
		internal PckImage(int imageNum,byte[] idx,Palette pal,PckFile pFile,int height,int width)
		{
			Palette=pal;
			pckFile = pFile;
			this.fileNum=imageNum;
			//this.imageNum=imageNum;
			//this.idx=idx;
			staticID=globalStaticID++;

			Height=height;
			Width=width;

			//image = new Bitmap(Width,Height,PixelFormat.Format8bppIndexed);
			expanded = new byte[Width*Height];

			for(int i=0;i<expanded.Length;i++)
				expanded[i] = TransparentIndex;

			int ex=0;
			int startIdx=0;

			if(idx[0]!=254)
				ex = idx[startIdx++]*Width;		

			for(int i=startIdx;i<idx.Length;i++)
			{
				switch(idx[i])
				{
					case 254: //skip required pixels
					{
						if(moveIdx==-1)
						{
							moveIdx=i+1;
							moveVal=idx[i+1];
						}
						ex+=idx[i+1];
						i++;
					}
						break;
					case 255: //end of image
						break;
					default:
						expanded[ex++]=idx[i];
						break;
				}					
			}
			this.idx=expanded;
		
			image = Bmp.MakeBitmap8(Width,Height,expanded,pal.Colors);
			gray = Bmp.MakeBitmap8(Width,Height,expanded,pal.Grayscale.Colors);
		}
Example #3
0
 internal PckImage(
     int imageNum,
     byte[] idx,
     Palette pal,
     PckFile pFile)
     :
     this(
         imageNum,
         idx,
         pal,
         pFile,
         40,
         32)
 {
 }
Example #4
0
		public XCTile(int id,PckFile file, McdEntry info,McdFile mFile):base(id)
		{
			this.info = info;
			myFile = file;
			mcdFile = mFile;

			image = new PckImage[numImages];	
	
			if(!info.UFODoor && !info.HumanDoor)
				MakeAnimate();
			else
				StopAnimate();

			dead =null;
			alternate = null;
		}
Example #5
0
//		internal McdFile(string basename, string directory)
//		{
//			BufferedStream file = new BufferedStream(File.OpenRead(directory+basename+".MCD"));
//			int diff = 0;
//			if(basename == "XBASES05")
//				diff=3;
//			tiles = new Tile[(file.Length/62)-diff];
//			PckFile f = GameInfo.GetPckFile(basename,directory,2);
//			for(int i=0;i<tiles.Length;i++)
//			{
//				byte[] info = new byte[62];
//				file.Read(info,0,62);
//				tiles[i] = new Tile(i,f,new McdEntry(info),this);
//			}
//
//			foreach(Tile t in tiles)
//				t.Tiles = tiles;
//			file.Close();
//		}

		internal McdFile(string basename, string directory, PckFile f)
		{
			BufferedStream file = new BufferedStream(File.OpenRead(directory+basename+".MCD"));
			int diff = 0;
			if(basename == "XBASES05")
				diff=3;
			tiles = new XCTile[(((int)file.Length)/62)-diff];
	
			for(int i=0;i<tiles.Length;i++)
			{
				byte[] info = new byte[62];
				file.Read(info,0,62); 
				tiles[i] = new XCTile(i,f,new McdEntry(info),this);
			}

			foreach(XCTile t in tiles)
				t.Tiles = tiles;
			file.Close();
		}
Example #6
0
        public XCTile(int id, PckFile file, McdEntry info, XCTile[] tiles) : base(id)
        {
            this.info = info;
            _info     = info;
            Tiles     = tiles;
            _myFile   = file;

            image = new XCImage[NUM_IMAGES];

            if (!info.UFODoor && !info.HumanDoor)
            {
                MakeAnimate();
            }
            else
            {
                StopAnimate();
            }

            Dead      = null;
            Alternate = null;
        }
Example #7
0
        internal PckImage(
            int imageNum,
            byte[] idx,
            Palette pal,
            PckFile pFile,
            int height,
            int width)
        {
            Palette      = pal;
            pckFile      = pFile;
            this.fileNum = imageNum;
//			this.imageNum = imageNum;
//			this.idx = idx;
            staticID = globalStaticID++;

            Height = height;
            Width  = width;

//			image = new Bitmap(Width,Height,PixelFormat.Format8bppIndexed);
            expanded = new byte[Width * Height];

            for (int i = 0; i < expanded.Length; i++)
            {
                expanded[i] = TransparentIndex;
            }

            int ex       = 0;
            int startIdx = 0;

            if (idx[0] != 254)
            {
                ex = idx[startIdx++] * Width;
            }

            for (int i = startIdx; i < idx.Length; i++)
            {
                switch (idx[i])
                {
                case 254:                         // skip required pixels
                    if (moveIdx == -1)
                    {
                        moveIdx = i + 1;
                        moveVal = idx[i + 1];
                    }
                    ex += idx[i + 1];
                    i++;
                    break;

                case 255:                         // end of image
                    break;

                default:
                    expanded[ex++] = idx[i];
                    break;
                }
            }
            this.idx = expanded;

            image = Bmp.MakeBitmap8(
                Width,
                Height,
                expanded,
                pal.Colors);
            gray = Bmp.MakeBitmap8(
                Width,
                Height,
                expanded,
                pal.Grayscale.Colors);
        }
Example #8
0
		internal PckImage(int imageNum,byte[] idx,Palette pal,PckFile pFile):this(imageNum,idx,pal,pFile,40,32){}