Esempio n. 1
0
        // I really did just type that out instead of wasting cpu on an automata or bothering to write a nifty bit
        // of code that would auto-generate it, figuring it out would have taken just as long
        // what makes this worse is that I realised I'd counted the pixels backwards and had to swap it around
        // for the sanity of the code. Oh, you want to change the player's graphics? Have fun.

        public FoodClockFX(BlitSprite blit, uint deadCol)
        {
            this.blit    = blit;
            spriteSheet  = blit.spriteSheet;
            this.deadCol = deadCol;
            food         = maxFood = pixels.length - 1;
            col          = spriteSheet.getPixel32((int)blit.rect.x, (int)blit.rect.y);
        }
Esempio n. 2
0
        /* Cyclically throw off pixel debris from where white pixels used to be on the blit
         * use dir to specify bitwise flags for directions able to throw debris in */
        public void bitmapDebris(BlitSprite blit, int x, int y, int dir = 15)
        {
            int    r, c;
            var    blitClip     = blit as BlitClip;
            var    source       = blitClip != null ? blitClip.frames[blitClip.frame] : blit.rect;
            var    compassIndex = 0;
            var    speedIndex   = 0;
            Point  compassPoint;
            var    p = new Point();
            double debrisSpeed;
            uint   u;

            for (r = 0; r < source.height; r++)
            {
                for (c = 0; c < source.width; c++)
                {
                    u = blit.spriteSheet.getPixel32((int)source.x + c, (int)source.y + r);
                    if (u == 0xFFFFFFFF || u == WALL_COL)
                    {
                        //u = 0xFFFFFFFF;
                        compassPoint = Room.compassPoints[compassIndex];
                        debrisSpeed  = DEBRIS_SPEEDS[speedIndex];
                        p.x          = compassPoint.x * debrisSpeed;
                        p.y          = compassPoint.y * debrisSpeed;
                        if ((Room.compass[compassIndex] & dir) > 0)
                        {
                            addFX(x * SCALE + c + blit.dx, y * SCALE + r + blit.dy, u == 0xFFFFFFFF ? debrisBlit : wallDebrisBlit, p.clone(), 0, true, true);
                        }
                        speedIndex++;
                        compassIndex++;
                        if (compassIndex >= Room.compassPoints.length)
                        {
                            compassIndex = 0;
                        }
                        if (speedIndex >= DEBRIS_SPEEDS.length)
                        {
                            speedIndex = 0;
                        }
                    }
                }
            }
        }
Esempio n. 3
0
        /* ===============================================================================================================
         *
         *  INIT
         *
         * Initialisation is separated from the constructor to allow reference paths to be complete before all
         * of the graphics are generated - an object is null until its constructor has been exited
         *
         * ===============================================================================================================
         */
        public void init()
        {
            FX.renderer          = this;
            FoodClockFX.renderer = this;
            Level.renderer       = this;
            TitleMenu.renderer   = this;
            RoomPainter.renderer = this;
            RoomPalette.renderer = this;

            var gameSpriteSheetBitmap = GameSpriteSheet;
            var menuSpriteSheetBitmap = MenuSpriteSheet;

            //gameSpriteSheet = gameSpriteSheetBitmap.bitmapData;
            gameSpriteSheet       = new BitmapData(GameSpriteSheet, 0, 0);       //  menuSpriteSheetBitmap.bitmapData);
            menuSpriteSheet       = new BitmapData(MenuSpriteSheet, 0, 0);       //  menuSpriteSheetBitmap.bitmapData);
            backgroundSpriteSheet = new BitmapData(BackgroundSpriteSheet, 0, 0); //  menuSpriteSheetBitmap.bitmapData);

            sparkBlit              = new BlitRect(0, 0, 1, 1, 0xffffffff);
            debrisBlit             = new BlitRect(0, 0, 1, 1, 0xffffffff);
            wallDebrisBlit         = new BlitRect(0, 0, 1, 1, WALL_COL);
            wallBlit               = new BlitSprite(gameSpriteSheet, new Rectangle(24, 0, 8, 8));
            indestructibleWallBlit = new BlitSprite(gameSpriteSheet, new Rectangle(80, 0, 8, 8));
            enemyWallBlit          = new BlitSprite(gameSpriteSheet, new Rectangle(88, 0, 8, 8));
            trapBlit               = new BlitClip(gameSpriteSheet, new Array <Rectangle> {
                new Rectangle(0, 16, 8, 8),
                new Rectangle(8, 16, 8, 8),
                new Rectangle(16, 16, 8, 8),
                new Rectangle(24, 16, 8, 8),
                new Rectangle(32, 16, 8, 8),
                new Rectangle(40, 16, 8, 8),
                new Rectangle(48, 16, 8, 8),
                new Rectangle(56, 16, 8, 8),
                new Rectangle(64, 16, 8, 8),
                new Rectangle(72, 16, 8, 8),
                new Rectangle(80, 16, 8, 8),
                new Rectangle(88, 16, 8, 8),
                new Rectangle(96, 16, 8, 8),
                new Rectangle(104, 16, 8, 8),
                new Rectangle(0, 24, 8, 8)
            });
            generatorBlit        = new BlitSprite(gameSpriteSheet, new Rectangle(96, 0, 8, 8));
            generatorWarningBlit = new BlitRect(0, 0, 7, 7, 0xFFFFFFFF);
            playerBlit           = new BlitSprite(gameSpriteSheet, new Rectangle(16, 0, 8, 8));
            playerBuffer         = new BlitSprite(gameSpriteSheet, new Rectangle(96, 64, 8, 8));
            allyBlit             = new BlitSprite(gameSpriteSheet, new Rectangle(64, 0, 8, 8));
            moverBlit            = new BlitSprite(gameSpriteSheet, new Rectangle(48, 0, 8, 8));
            horizMoverBlit       = new BlitSprite(gameSpriteSheet, new Rectangle(40, 0, 8, 8));
            vertMoverBlit        = new BlitSprite(gameSpriteSheet, new Rectangle(32, 0, 8, 8));
            turnerBlit           = new BlitClip(gameSpriteSheet, new Array <Rectangle> {
                new Rectangle(16, 8, 8, 8),
                new Rectangle(24, 8, 8, 8),
                new Rectangle(32, 8, 8, 8),
                new Rectangle(40, 8, 8, 8),
                new Rectangle(48, 8, 8, 8),
                new Rectangle(56, 8, 8, 8),
                new Rectangle(64, 8, 8, 8),
                new Rectangle(72, 8, 8, 8)
            });
            virusBlit        = new BlitSprite(gameSpriteSheet, new Rectangle(56, 0, 8, 8));
            errorBlit        = new BlitRect(3, 3, 3, 3, 0xFFFF0000);
            swapBlit         = new BlitSprite(gameSpriteSheet, new Rectangle(72, 0, 8, 8));
            numberBlit       = new NumberBlit(gameSpriteSheet, new Rectangle(112, 0, 8, 80), 2, 0.25, -1, -1, 6);
            notCompletedBlit = new BlitRect(-1, -1, 3, 3, UI_COL_BORDER);
            timerCountBlit   = new BlitClip(gameSpriteSheet, new Array <Rectangle> {
                new Rectangle(112, 0, 8, 8),
                new Rectangle(112, 8, 8, 8),
                new Rectangle(112, 16, 8, 8),
                new Rectangle(112, 24, 8, 8)
            });
            checkMarkBlit = new BlitSprite(gameSpriteSheet, new Rectangle(56, 32, 8, 8));
            voidBlit      = new BlitRect(0, 0, (int)SCALE, (int)SCALE, 0xFF000000);
            doorBlit      = new BlitClip(gameSpriteSheet, new Array <Rectangle> {
                new Rectangle(8, 24, 8, 8),
                new Rectangle(16, 24, 8, 8),
                new Rectangle(24, 24, 8, 8),
                new Rectangle(32, 24, 8, 8),
                new Rectangle(40, 24, 8, 8),
                new Rectangle(48, 24, 8, 8),
                new Rectangle(56, 24, 8, 8),
                new Rectangle(64, 24, 8, 8),
                new Rectangle(72, 24, 8, 8),
                new Rectangle(80, 24, 8, 8)
            });
            bombBlit      = new BlitSprite(gameSpriteSheet, new Rectangle(104, 0, 8, 8));
            explosionBlit = new BlitClip(gameSpriteSheet, new Array <Rectangle> {
                new Rectangle(80, 8, 8, 8),
                new Rectangle(80, 8, 8, 8),
                new Rectangle(88, 8, 8, 8),
                new Rectangle(88, 8, 8, 8),
                new Rectangle(96, 8, 8, 8),
                new Rectangle(96, 8, 8, 8),
                new Rectangle(104, 8, 8, 8),
                new Rectangle(104, 8, 8, 8)
            });
            whiteBlit     = new BlitSprite(gameSpriteSheet, new Rectangle(88, 64, 8, 8));
            errorBlit     = new BlitRect(1, 1, 5, 5, 0xFFFF0000);
            incrementBlit = new BlitClip(gameSpriteSheet, new Array <Rectangle> {
                new Rectangle(88, 24, 8, 8),
                new Rectangle(88, 24, 8, 8),
                new Rectangle(96, 24, 8, 8),
                new Rectangle(96, 24, 8, 8),
                new Rectangle(104, 24, 8, 8),
                new Rectangle(104, 24, 8, 8),
                new Rectangle(0, 32, 8, 8),
                new Rectangle(0, 32, 8, 8),
                new Rectangle(8, 32, 8, 8),
                new Rectangle(8, 32, 8, 8),
                new Rectangle(16, 32, 8, 8),
                new Rectangle(16, 32, 8, 8),
                new Rectangle(24, 32, 8, 8),
                new Rectangle(24, 32, 8, 8),
                new Rectangle(32, 32, 8, 8),
                new Rectangle(32, 32, 8, 8),
                new Rectangle(40, 32, 8, 8),
                new Rectangle(40, 32, 8, 8),
                new Rectangle(48, 32, 8, 8),
                new Rectangle(48, 32, 8, 8),
                null,
                null,
                null,
                null,
                null,
                null,
                null,
                null,
                null,
                null
            });
            endingDistBlit = new BlitClip(gameSpriteSheet, new Array <Rectangle> {
                new Rectangle(0, 56, 8, 8),
                new Rectangle(8, 56, 8, 8),
                new Rectangle(16, 56, 8, 8),
                new Rectangle(24, 56, 8, 8),
                new Rectangle(32, 56, 8, 8),
                new Rectangle(40, 56, 8, 8),
                new Rectangle(48, 56, 8, 8),
                new Rectangle(56, 56, 8, 8),
                new Rectangle(64, 56, 8, 8),
                new Rectangle(72, 56, 8, 8)
            });
            settingsButtonBlit = new BlitClip(gameSpriteSheet, new Array <Rectangle> {
                new Rectangle(64, 32, 8, 8),
                new Rectangle(72, 32, 8, 8)
            });
            turnsBlit            = new BlitSprite(menuSpriteSheet, new Rectangle(48, 60, 16, 10));
            propertySelectedBlit = new BlitSprite(menuSpriteSheet, new Rectangle(79, 88, 9, 9), -1, -1);
            roomPaletteBlit      = new BlitSprite(menuSpriteSheet, new Rectangle(44, 72, 35, 67), -1, -1);

            puzzleButtonBlit = new BlitClip(menuSpriteSheet, new Array <Rectangle> {
                new Rectangle(0, 72, 22, 22),
                new Rectangle(22, 72, 22, 22)
            });
            adventureButtonBlit = new BlitClip(menuSpriteSheet, new Array <Rectangle> {
                new Rectangle(0, 94, 22, 22),
                new Rectangle(22, 94, 22, 22)
            });
            editorButtonBlit = new BlitClip(menuSpriteSheet, new Array <Rectangle> {
                new Rectangle(0, 116, 22, 22),
                new Rectangle(22, 116, 22, 22)
            });
            checkButtonBlit = new BlitClip(menuSpriteSheet, new Array <Rectangle> {
                new Rectangle(48, 12, 12, 12),
                new Rectangle(60, 12, 12, 12),
                new Rectangle(72, 12, 12, 12),
                new Rectangle(84, 12, 12, 12)
            });
            playButtonBlit = new BlitClip(menuSpriteSheet, new Array <Rectangle> {
                new Rectangle(48, 48, 12, 12),
                new Rectangle(60, 48, 12, 12)
            });
            propertyButtonBlit = new BlitClip(menuSpriteSheet, new Array <Rectangle> {
                new Rectangle(72, 48, 12, 12),
                new Rectangle(84, 48, 12, 12)
            });
            scrollButtonBlit = new BlitClip(menuSpriteSheet, new Array <Rectangle> {
                new Rectangle(24, 60, 12, 12),
                new Rectangle(36, 60, 12, 12),
                new Rectangle(79, 106, 12, 12),
                new Rectangle(79, 118, 12, 12)
            });
            loadButtonBlit = new BlitClip(menuSpriteSheet, new Array <Rectangle> {
                new Rectangle(0, 36, 12, 12),
                new Rectangle(12, 36, 12, 12)
            });
            saveButtonBlit = new BlitClip(menuSpriteSheet, new Array <Rectangle> {
                new Rectangle(72, 24, 12, 12),
                new Rectangle(84, 24, 12, 12)
            });
            cancelButtonBlit = new BlitClip(menuSpriteSheet, new Array <Rectangle> {
                new Rectangle(0, 0, 12, 12),
                new Rectangle(12, 0, 12, 12)
            });
            confirmButtonBlit = new BlitClip(menuSpriteSheet, new Array <Rectangle> {
                new Rectangle(24, 0, 12, 12),
                new Rectangle(36, 0, 12, 12)
            });
            resetButtonBlit = new BlitClip(menuSpriteSheet, new Array <Rectangle> {
                new Rectangle(0, 12, 12, 12),
                new Rectangle(12, 12, 12, 12)
            });
            controlsButtonBlit = new BlitClip(menuSpriteSheet, new Array <Rectangle> {
                new Rectangle(0, 48, 12, 12),
                new Rectangle(12, 48, 12, 12),
                new Rectangle(24, 48, 12, 12),
                new Rectangle(36, 48, 12, 12)
            });
            orientationButtonBlit = new BlitClip(menuSpriteSheet, new Array <Rectangle> {
                new Rectangle(24, 12, 12, 12),
                new Rectangle(36, 12, 12, 12)
            });
            soundButtonBlit = new BlitClip(menuSpriteSheet, new Array <Rectangle> {
                new Rectangle(24, 36, 12, 12),
                new Rectangle(36, 36, 12, 12),
                new Rectangle(48, 36, 12, 12),
                new Rectangle(36, 36, 12, 12)
            });
            fullscreenButtonBlit = new BlitClip(menuSpriteSheet, new Array <Rectangle> {
                new Rectangle(84, 36, 12, 12),
                new Rectangle(72, 36, 12, 12),
                new Rectangle(60, 36, 12, 12),
                new Rectangle(72, 36, 12, 12)
            });
            editButtonBlit = new BlitClip(menuSpriteSheet, new Array <Rectangle> {
                new Rectangle(0, 60, 12, 12),
                new Rectangle(12, 60, 12, 12)
            });
            numberButtonBlit = new BlitClip(menuSpriteSheet, new Array <Rectangle> {
                new Rectangle(48, 60, 16, 10),
                new Rectangle(64, 60, 16, 10)
            });
            leftButtonBlit = new BlitClip(menuSpriteSheet, new Array <Rectangle> {
                new Rectangle(48, 0, 12, 12),
                new Rectangle(60, 0, 12, 12)
            });
            rightButtonBlit = new BlitClip(menuSpriteSheet, new Array <Rectangle> {
                new Rectangle(72, 0, 12, 12),
                new Rectangle(84, 0, 12, 12)
            });
            swapButtonBlit = new BlitClip(menuSpriteSheet, new Array <Rectangle> {
                new Rectangle(48, 24, 12, 12),
                new Rectangle(60, 24, 12, 12)
            });
            insertBeforeButtonBlit = new BlitClip(menuSpriteSheet, new Array <Rectangle> {
                new Rectangle(0, 24, 12, 12),
                new Rectangle(12, 24, 12, 12)
            });
            insertAfterButtonBlit = new BlitClip(menuSpriteSheet, new Array <Rectangle> {
                new Rectangle(24, 24, 12, 12),
                new Rectangle(36, 24, 12, 12)
            });
            confirmPanelBlit      = new BlitSprite(menuSpriteSheet, new Rectangle(0, 157, 31, 19));
            levelMovePanelBlit    = new BlitSprite(menuSpriteSheet, new Rectangle(0, 139, 70, 18));
            levelPreviewPanelBlit = new BlitSprite(menuSpriteSheet, new Rectangle(79, 72, 16, 16));
            paintBlit             = new BlitClip(menuSpriteSheet, new Array <Rectangle> {
                new Rectangle(79, 97, 9, 9),
                new Rectangle(80, 60, 9, 9)
            }, -1, -1);
            lockedBlit = new BlitSprite(menuSpriteSheet, new Rectangle(89, 60, 7, 7));

            int fade_delay = 10;

            mapFadeBlits = new Array <FadingBlitRect> {
                new FadingBlitRect(0, 0, (int)(Level.MAP_WIDTH * SCALE), (int)((Level.ROOM_HEIGHT - 1) * SCALE), fade_delay),
                new FadingBlitRect((int)(Level.ROOM_WIDTH * SCALE), 0, (int)((Level.ROOM_WIDTH - 1) * SCALE), (int)(Level.MAP_HEIGHT * SCALE), fade_delay),
                new FadingBlitRect(0, (int)(Level.ROOM_HEIGHT * SCALE), (int)(Level.MAP_WIDTH * SCALE), (int)((Level.ROOM_HEIGHT - 1) * SCALE), fade_delay),
                new FadingBlitRect(0, 0, (int)((Level.ROOM_WIDTH - 1) * SCALE), (int)(Level.MAP_HEIGHT * SCALE), fade_delay),
            };
            darkBitmapData = new BitmapData((int)Game.WIDTH, (int)Game.HEIGHT, true, 0x88000000);

            glitchMap = new GlitchMap();

            slideFade = new BlitSprite(new BitmapData((int)Game.WIDTH, (int)Game.HEIGHT, true, 0x08000000), new Rectangle(0, 0, Game.WIDTH, Game.HEIGHT));

            TextBox.init(new Array <Rectangle> {
                new Rectangle(1, 40, 6, 7),     // a
                new Rectangle(9, 40, 6, 7),     // b
                new Rectangle(17, 40, 6, 7),    // c
                new Rectangle(25, 40, 6, 7),    // d
                new Rectangle(33, 40, 6, 7),    // e
                new Rectangle(41, 40, 6, 7),    // f
                new Rectangle(49, 40, 6, 7),    // g
                new Rectangle(57, 40, 6, 7),    // h
                new Rectangle(65, 40, 6, 7),    // i
                new Rectangle(73, 40, 6, 7),    // j
                new Rectangle(81, 40, 6, 7),    // k
                new Rectangle(89, 40, 6, 7),    // l
                new Rectangle(97, 40, 6, 7),    // m
                new Rectangle(105, 40, 6, 7),   // n
                new Rectangle(1, 48, 6, 7),     // o
                new Rectangle(9, 48, 6, 7),     // p
                new Rectangle(17, 48, 6, 7),    // q
                new Rectangle(25, 48, 6, 7),    // r
                new Rectangle(33, 48, 6, 7),    // s
                new Rectangle(41, 48, 6, 7),    // t
                new Rectangle(49, 48, 6, 7),    // u
                new Rectangle(57, 48, 6, 7),    // v
                new Rectangle(65, 48, 6, 7),    // w
                new Rectangle(73, 48, 6, 7),    // x
                new Rectangle(81, 48, 6, 7),    // y
                new Rectangle(89, 48, 6, 7),    // z
                new Rectangle(1, 56, 6, 7),     // 0
                new Rectangle(9, 56, 6, 7),     // 1
                new Rectangle(17, 56, 6, 7),    // 2
                new Rectangle(25, 56, 6, 7),    // 3
                new Rectangle(33, 56, 6, 7),    // 4
                new Rectangle(41, 56, 6, 7),    // 5
                new Rectangle(49, 56, 6, 7),    // 6
                new Rectangle(57, 56, 6, 7),    // 7
                new Rectangle(65, 56, 6, 7),    // 8
                new Rectangle(73, 56, 6, 7),    // 9
                new Rectangle(19, 64, 2, 4),    // '
                new Rectangle(33, 64, 6, 7),    // backslash
                new Rectangle(),                // :
                new Rectangle(3, 64, 2, 8),     // ,
                new Rectangle(73, 64, 6, 7),    // =
                new Rectangle(99, 56, 2, 7),    // !
                new Rectangle(81, 64, 6, 7),    // /
                new Rectangle(41, 64, 6, 7),    // -
                new Rectangle(58, 64, 3, 8),    // (
                new Rectangle(49, 64, 6, 7),    // +
                new Rectangle(89, 56, 6, 7),    // ?
                new Rectangle(66, 64, 3, 8),    // )
                new Rectangle(),                // ;
                new Rectangle(107, 56, 2, 7),   // .
                new Rectangle(8, 64, 8, 7),     // @
                new Rectangle(),                // _
                new Rectangle(81, 56, 6, 7),    // %
                new Rectangle(),                // *
                new Rectangle(26, 64, 4, 4)     // "
            }, gameSpriteSheet);

            fxFilterCallBack = (FX item, int index, Array <FX> list) => {
                item.main();
                return(item.active);
            };
        }
Esempio n. 4
0
        /* Returns a a copy of this object, must be cast into a BlitSprite */
        override public BlitRect clone()
        {
            var blit = new BlitSprite(spriteSheet, rect, dx, dy);

            return(blit);
        }