Beispiel #1
0
        public void method354(IndexedImage background, int x, int y)
        {
            if (!isValid)
            {
                return;
            }

            y += offsetX;
            x += offsetY;
            int k  = y + x * DrawingArea.width;
            int l  = 0;
            int i1 = height;
            int j1 = width;
            int k1 = DrawingArea.width - j1;
            int l1 = 0;

            if (x < DrawingArea.topY)
            {
                int i2 = DrawingArea.topY - x;
                i1 -= i2;
                x   = DrawingArea.topY;
                l  += i2 * j1;
                k  += i2 * DrawingArea.width;
            }

            if (x + i1 > DrawingArea.bottomY)
            {
                i1 -= (x + i1) - DrawingArea.bottomY;
            }
            if (y < DrawingArea.topX)
            {
                int j2 = DrawingArea.topX - y;
                j1 -= j2;
                y   = DrawingArea.topX;
                l  += j2;
                k  += j2;
                l1 += j2;
                k1 += j2;
            }

            if (y + j1 > DrawingArea.bottomX)
            {
                int k2 = (y + j1) - DrawingArea.bottomX;
                j1 -= k2;
                l1 += k2;
                k1 += k2;
            }

            if (!(j1 <= 0 || i1 <= 0))
            {
                method355(pixels, j1, background.pixels, i1, DrawingArea.pixels, 0, k1, k, l1, l);
            }
        }
        internal async Task LoadMediaContentAsync()
        {
            Archive          archiveMedia   = requestArchive(4, "2d graphics", "media", 0, 40);
            Default317Buffer metadataBuffer = new Default317Buffer(archiveMedia.decompressFile("index.dat"));

            inventoryBackgroundImage = new IndexedImage(archiveMedia, "invback", 0, metadataBuffer);
            chatBackgroundImage      = new IndexedImage(archiveMedia, "chatback", 0, metadataBuffer);
            minimapBackgroundImage   = new IndexedImage(archiveMedia, "mapback", 0, metadataBuffer);
            backBase1Image           = new IndexedImage(archiveMedia, "backbase1", 0, metadataBuffer);
            backBase2Image           = new IndexedImage(archiveMedia, "backbase2", 0, metadataBuffer);
            backHmid1Image           = new IndexedImage(archiveMedia, "backhmid1", 0, metadataBuffer);
            for (int icon = 0; icon < 13; icon++)
            {
                sideIconImage[icon] = new IndexedImage(archiveMedia, "sideicons", icon, metadataBuffer);
            }

            minimapCompassImage = new Sprite(archiveMedia, "compass", 0, metadataBuffer);
            minimapEdgeImage    = new Sprite(archiveMedia, "mapedge", 0, metadataBuffer);
            minimapEdgeImage.trim();

            await TaskDelayFactory.Create(1);

            try
            {
                for (int i = 0; i < 100; i++)
                {
                    mapSceneImage[i] = new IndexedImage(archiveMedia, "mapscene", i, metadataBuffer);
                }

                await TaskDelayFactory.Create(1);
            }
            catch (Exception _ex)
            {
                signlink.reporterror($"Unexpected Exception: {_ex.Message} \n\n Stack: {_ex.StackTrace}");
            }

            try
            {
                for (int i = 0; i < 100; i++)
                {
                    mapFunctionImage[i] = new Sprite(archiveMedia, "mapfunction", i, metadataBuffer);
                }

                await TaskDelayFactory.Create(1);
            }
            catch (Exception _ex)
            {
                signlink.reporterror($"Unexpected Exception: {_ex.Message} \n\n Stack: {_ex.StackTrace}");
            }

            try
            {
                for (int i = 0; i < 20; i++)
                {
                    hitMarkImage[i] = new Sprite(archiveMedia, "hitmarks", i, metadataBuffer);
                }

                await TaskDelayFactory.Create(1);
            }
            catch (Exception _ex)
            {
                signlink.reporterror($"Unexpected Exception: {_ex.Message} \n\n Stack: {_ex.StackTrace}");
            }

            try
            {
                for (int i = 0; i < 20; i++)
                {
                    headIcons[i] = new Sprite(archiveMedia, "headicons", i, metadataBuffer);
                }

                await TaskDelayFactory.Create(1);
            }
            catch (Exception _ex)
            {
                signlink.reporterror($"Unexpected Exception: {_ex.Message} \n\n Stack: {_ex.StackTrace}");
                throw;
            }

            mapFlag   = new Sprite(archiveMedia, "mapmarker", 0, metadataBuffer);
            mapMarker = new Sprite(archiveMedia, "mapmarker", 1, metadataBuffer);
            for (int i = 0; i < 8; i++)
            {
                crosses[i] = new Sprite(archiveMedia, "cross", i, metadataBuffer);
            }

            mapDotItem    = new Sprite(archiveMedia, "mapdots", 0, metadataBuffer);
            mapDotNPC     = new Sprite(archiveMedia, "mapdots", 1, metadataBuffer);
            mapDotPlayer  = new Sprite(archiveMedia, "mapdots", 2, metadataBuffer);
            mapDotFriend  = new Sprite(archiveMedia, "mapdots", 3, metadataBuffer);
            mapDotTeam    = new Sprite(archiveMedia, "mapdots", 4, metadataBuffer);
            scrollBarUp   = new IndexedImage(archiveMedia, "scrollbar", 0, metadataBuffer);
            scrollBarDown = new IndexedImage(archiveMedia, "scrollbar", 1, metadataBuffer);
            redStone1     = new IndexedImage(archiveMedia, "redstone1", 0, metadataBuffer);
            redStone2     = new IndexedImage(archiveMedia, "redstone2", 0, metadataBuffer);
            redStone3     = new IndexedImage(archiveMedia, "redstone3", 0, metadataBuffer);
            redStone1_2   = new IndexedImage(archiveMedia, "redstone1", 0, metadataBuffer);
            redStone1_2.flipHorizontally();
            redStone2_2 = new IndexedImage(archiveMedia, "redstone2", 0, metadataBuffer);
            redStone2_2.flipHorizontally();
            redStone1_3 = new IndexedImage(archiveMedia, "redstone1", 0, metadataBuffer);
            redStone1_3.flipVertically();
            redStone2_3 = new IndexedImage(archiveMedia, "redstone2", 0, metadataBuffer);
            redStone2_3.flipVertically();
            redStone3_2 = new IndexedImage(archiveMedia, "redstone3", 0, metadataBuffer);
            redStone3_2.flipVertically();
            redStone1_4 = new IndexedImage(archiveMedia, "redstone1", 0, metadataBuffer);
            redStone1_4.flipHorizontally();
            redStone1_4.flipVertically();
            redStone2_4 = new IndexedImage(archiveMedia, "redstone2", 0, metadataBuffer);
            redStone2_4.flipHorizontally();
            redStone2_4.flipVertically();
            for (int i = 0; i < 2; i++)
            {
                modIcons[i] = new IndexedImage(archiveMedia, "mod_icons", i, metadataBuffer);
            }

            await TaskDelayFactory.Create(1);

            Sprite sprite = new Sprite(archiveMedia, "backleft1", 0, metadataBuffer);

            backLeftIP1 = CreateNewImageProducer(sprite.width, sprite.height, nameof(backLeftIP1));
            sprite.drawInverse(0, 0);
            sprite      = new Sprite(archiveMedia, "backleft2", 0, metadataBuffer);
            backLeftIP2 = CreateNewImageProducer(sprite.width, sprite.height, nameof(backLeftIP2));
            sprite.drawInverse(0, 0);
            sprite       = new Sprite(archiveMedia, "backright1", 0, metadataBuffer);
            backRightIP1 = CreateNewImageProducer(sprite.width, sprite.height, nameof(backRightIP1));
            sprite.drawInverse(0, 0);
            sprite       = new Sprite(archiveMedia, "backright2", 0, metadataBuffer);
            backRightIP2 = CreateNewImageProducer(sprite.width, sprite.height, nameof(backRightIP2));
            sprite.drawInverse(0, 0);
            sprite     = new Sprite(archiveMedia, "backtop1", 0, metadataBuffer);
            backTopIP1 = CreateNewImageProducer(sprite.width, sprite.height, nameof(backTopIP1));
            sprite.drawInverse(0, 0);
            sprite      = new Sprite(archiveMedia, "backvmid1", 0, metadataBuffer);
            backVmidIP1 = CreateNewImageProducer(sprite.width, sprite.height, nameof(backVmidIP1));
            sprite.drawInverse(0, 0);
            sprite      = new Sprite(archiveMedia, "backvmid2", 0, metadataBuffer);
            backVmidIP2 = CreateNewImageProducer(sprite.width, sprite.height, nameof(backVmidIP2));
            sprite.drawInverse(0, 0);
            sprite      = new Sprite(archiveMedia, "backvmid3", 0, metadataBuffer);
            backVmidIP3 = CreateNewImageProducer(sprite.width, sprite.height, nameof(backVmidIP3));
            sprite.drawInverse(0, 0);
            sprite        = new Sprite(archiveMedia, "backhmid2", 0, metadataBuffer);
            backVmidIP2_2 = CreateNewImageProducer(sprite.width, sprite.height, nameof(backVmidIP2_2));
            sprite.drawInverse(0, 0);

            await TaskDelayFactory.Create(1);

            int randomRed    = (int)(StaticRandomGenerator.Next() * 21D) - 10;
            int randomGreen  = (int)(StaticRandomGenerator.Next() * 21D) - 10;
            int randomBlue   = (int)(StaticRandomGenerator.Next() * 21D) - 10;
            int randomColour = (int)(StaticRandomGenerator.Next() * 41D) - 20;

            for (int i = 0; i < 100; i++)
            {
                if (mapFunctionImage[i] != null)
                {
                    mapFunctionImage[i].adjustRGB(randomRed + randomColour, randomGreen + randomColour,
                                                  randomBlue + randomColour);
                }
                if (mapSceneImage[i] != null)
                {
                    mapSceneImage[i].mixPalette(randomRed + randomColour, randomGreen + randomColour,
                                                randomBlue + randomColour);
                }
            }
        }