MyDebugBreak() public static method

public static MyDebugBreak ( ) : void
return void
Example #1
0
 public void Set(uint x, uint y, MapData v)
 {
     if (x >= 0 && x < Width && y >= 0 && y < Height && v <= MapData.kPlayer3)
     {
         Cell[x + y * Width] = v;
     }
     else
     {
         Debug.MyDebugBreak();
     }
 }
Example #2
0
 public static void MoveCoords(ref byte x, ref byte y, Direction direction)
 {
     if ((int)direction < 8)
     {
         // Up is zero, clockwise
         x = (byte)(x + kOffsets[(int)direction][0]);
         y = (byte)(y + kOffsets[(int)direction][1]);
     }
     else
     {
         Debug.MyDebugBreak();
     }
 }
Example #3
0
        public MapData Get(uint x, uint y, Direction dir)
        {
            MapData b = MapData.kSpace;

            if (x >= 0 && x < Width && y >= 0 && y < Height)
            {
                b = (MapData)Cell[x + y * Width];
            }
            else
            {
                Debug.MyDebugBreak();
            }
            return(b);
        }
Example #4
0
 public void UseSmartBomb(uint index)
 {
     if (index < numPlayers)
     {
         Player p = player[index];
         if (p.bombs > 0)
         {
             --p.bombs;
             DoSmartBomb();
         }
     }
     else
     {
         Debug.MyDebugBreak();
     }
 }
Example #5
0
 public void Fire(uint index)
 {
     if (index < numPlayers)
     {
         Player p = player[index];
         if (!p.arrow.alive)
         {
             p.arrow.alive = true;
             p.arrow.x     = p.x;
             p.arrow.y     = p.y;
             p.arrow.dir   = p.dir;
             DoArrowMove(p, true);
         }
     }
     else
     {
         Debug.MyDebugBreak();
     }
 }
Example #6
0
        public void SetPlayerPositions()
        {
            byte x = 0;
            byte y = 0;

            if (!map.Find(ref x, ref y, MapData.kUp))
            {
                Debug.MyDebugBreak();
                x = 4;
                y = 4;
            }
            for (uint i = 0; i < numPlayers; i++)
            {
                Player p = player[i];
                if (p.IsAlive())
                {
                    byte px = x;
                    byte py = y;
                    MoveCoords(ref px, ref py, (Direction)(i * 2));
                    PlaceInWorld(i, px, py);
                }
            }
        }
Example #7
0
        public void DoArrowMove(Player p, bool isFirstMove)
        {
            if (!p.arrow.alive)
            {
                return;
            }
            byte x = p.arrow.x;
            byte y = p.arrow.y;

            if (!isFirstMove)
            {
                map.Set(x, y, MapData.kSpace);
            }
            MoveCoords(ref x, ref y, p.arrow.dir);
            MapData d = map.Get(x, y);

            if (Arrow.CanHit(d))
            {
                switch (d)
                {
                case MapData.kBomb:
                    DoSmartBomb();
                    map.Set(x, y, MapData.kSpace);
                    break;

                case MapData.kGhost: goto common;

                case MapData.kSmiley: goto common;

                case MapData.kBig: goto common;

                case MapData.kGen1: goto common;

                case MapData.kGen2: goto common;

                case MapData.kGen3:
common:
                    map.Set(x, y, MapData.kSpace);
                    break;

                case MapData.kHeart:
                {
                    bool foundPlayer = false;
                    for (uint i = 0; i < numPlayers; i++)
                    {
                        Player p2 = player[i];
                        if (!p2.IsAlive())
                        {
                            p2.health = 9;
                            p2.state  = PlayerState.kNormal;
                            PlaceInWorld(i, x, y);
                            foundPlayer = true;
                            break;
                        }
                    }
                    if (!foundPlayer)
                    {
                        map.Set(x, y, MapData.kBig);
                    }
                }
                break;

                default:
                    Debug.MyDebugBreak();
                    break;
                }
                p.arrow.alive = false;
            }
            else if (Arrow.CanGo(d))
            {
                p.arrow.x = x;
                p.arrow.y = y;
                int rotatedDir = ((int)(p.arrow.dir + 3) & 7);         // Because font is screwed up
                map.Set(x, y, (MapData)(MapData.kArrow0 + rotatedDir));
            }
            else
            {
                p.arrow.alive = false;
            }
        }
Example #8
0
        public void Move(uint stick, Direction dir)
        {
            if (stick < 4 && dir < (Direction)8)
            {
                if (stick < numPlayers)
                {
                    Player p = player[stick];
                    p.dir = dir;
                    TimeSpan delta = time - p.lastMoveTime;
                    if (p.IsVisible() && delta.Milliseconds >= kMsPerMove)
                    {
                        p.lastMoveTime = time;
                        byte x = p.x;
                        byte y = p.y;
                        MoveCoords(ref x, ref y, dir);
                        MapData d     = map.Get(x, y);
                        bool    bMove = false;
                        switch (d)
                        {
                        case MapData.kSpace:
                            bMove = true;
                            break;

                        case MapData.kLock:
                            if (p.keys > 0)
                            {
                                --p.keys;
                                map.OpenLock(x, y);
                                bMove = true;
                            }
                            break;

                        case MapData.kKey:
                            ++p.keys;
                            bMove = true;
                            break;

                        case MapData.kFood:
                            ++p.food;
                            bMove = true;
                            break;

                        case MapData.kMoney:
                            p.score += 10;
                            bMove    = true;
                            break;

                        case MapData.kBomb:
                            ++p.bombs;
                            bMove = true;
                            break;

                        case MapData.kDown:
                        {
                            p.state = PlayerState.kInWarp;
                            map.Set(p.x, p.y, MapData.kSpace);
                            if (IsPartyInWarp())
                            {
                                ChangeLevel(1);
                            }
                        }
                        break;

                        default:
                            break;
                        }
                        if (bMove)
                        {
                            map.Set(p.x, p.y, MapData.kSpace);
                            map.Set(x, y, (MapData)((int)MapData.kPlayer0 + stick));
                            p.x = x;
                            p.y = y;
                        }
                    }
                }
            }
            else
            {
                Debug.MyDebugBreak();
            }
        }