Exemplo n.º 1
0
        } /* cyclop_ */

        /* THIEFP-	THIEF FUNCTION */

        /* DECLARATIONS */

        public static bool thiefp_(Game game, int arg)
        {
            /* System generated locals */
            int  i__1;
            bool ret_val;

            /* Local variables */
            int i, j;

            ret_val = true;
            /*                      !ASSUME WINS. */
            if (game.ParserVectors.prsa != (int)VIndices.fightw)
            {
                goto L100;
            }
            /*                      !FIGHT? */
            if (game.Objects.ocan[(int)ObjectIndices.still - 1] == (int)ObjectIndices.thief)
            {
                goto L10;
            }
            /*                      !GOT STILLETTO?  F. */
            if (ObjectHandler.qhere_(game, (int)ObjectIndices.still, game.Hack.thfpos))
            {
                goto L50;
            }
            /*                      !CAN HE RECOVER IT? */
            ObjectHandler.newsta_(game, (int)ObjectIndices.thief, 0, 0, 0, 0);
            /*                      !NO, VANISH. */
            if (ObjectHandler.qhere_(game, (int)ObjectIndices.thief, game.Player.Here))
            {
                MessageHandler.rspeak_(game, 498);
            }
            /*                      !IF HERO, TELL. */
            return(ret_val);

L50:
            ObjectHandler.newsta_(game, (int)ObjectIndices.still, 0, 0, (int)ObjectIndices.thief, 0);
            /*                      !YES, RECOVER. */
            if (ObjectHandler.qhere_(game, (int)ObjectIndices.thief, game.Player.Here))
            {
                MessageHandler.rspeak_(game, 499);
            }
            /*                      !IF HERO, TELL. */
            return(ret_val);

L100:
            if (game.ParserVectors.prsa != (int)VIndices.deadxw)
            {
                goto L200;
            }
            /*                      !DEAD? */
            game.Hack.thfact = false;
            /*                      !DISABLE DEMON. */
            game.Objects.oflag1[(int)ObjectIndices.chali - 1] |= ObjectFlags.TAKEBT;
            j    = 0;
            i__1 = game.Objects.Count;
            for (i = 1; i <= i__1; ++i)
            {
                /*                      !CARRYING ANYTHING? */
                /* L125: */
                if (game.Objects.oadv[i - 1] == -(int)ObjectIndices.thief)
                {
                    j = 500;
                }
            }
            MessageHandler.rspeak_(game, j);
            /*                      !TELL IF BOOTY REAPPEARS. */

            j    = 501;
            i__1 = game.Objects.Count;
            for (i = 1; i <= i__1; ++i)
            {
                /*                      !LOOP. */
                if (i == (int)ObjectIndices.chali ||
                    i == (int)ObjectIndices.thief ||
                    game.Player.Here != (int)RoomIndices.treas ||
                    !ObjectHandler.qhere_(game, i, game.Player.Here))
                {
                    goto L135;
                }
                game.Objects.oflag1[i - 1] |= ObjectFlags.VISIBT;
                MessageHandler.rspsub_(game, j, game.Objects.odesc2[i - 1]);
                /*                      !DESCRIBE. */
                j = 502;
                goto L150;

L135:
                if (game.Objects.oadv[i - 1] == -(int)ObjectIndices.thief)
                {
                    ObjectHandler.newsta_(game, i, 0, game.Player.Here, 0, 0);
                }
L150:
                ;
            }
            return(ret_val);

L200:
            if (game.ParserVectors.prsa != (int)VIndices.frstqw)
            {
                goto L250;
            }
            /*                      !FIRST ENCOUNTER? */
            ret_val = RoomHandler.prob_(game, 20, 75);
            return(ret_val);

L250:
            if (game.ParserVectors.prsa != (int)VIndices.hellow || game.Objects.odesc1[(int)ObjectIndices.thief -
                                                                                       1] != 504)
            {
                goto L300;
            }
            MessageHandler.rspeak_(game, 626);
            return(ret_val);

L300:
            if (game.ParserVectors.prsa != (int)VIndices.outxw)
            {
                goto L400;
            }
            /*                      !OUT? */
            game.Hack.thfact = false;
            /*                      !DISABLE DEMON. */
            game.Objects.odesc1[(int)ObjectIndices.thief - 1] = 504;
            /*                      !CHANGE DESCRIPTION. */
            game.Objects.oflag1[(int)ObjectIndices.still - 1] &= ~ObjectFlags.VISIBT;
            game.Objects.oflag1[(int)ObjectIndices.chali - 1] |= ObjectFlags.TAKEBT;
            return(ret_val);

L400:
            if (game.ParserVectors.prsa != (int)VIndices.inxw)
            {
                goto L500;
            }
            /*                      !IN? */
            if (ObjectHandler.qhere_(game, (int)ObjectIndices.thief, game.Player.Here))
            {
                MessageHandler.rspeak_(game, 505);
            }
            /*                      !CAN HERO SEE? */
            game.Hack.thfact = true;
            /*                      !ENABLE DEMON. */
            game.Objects.odesc1[(int)ObjectIndices.thief - 1] = 503;
            /*                      !CHANGE DESCRIPTION. */
            game.Objects.oflag1[(int)ObjectIndices.still - 1] |= ObjectFlags.VISIBT;
            if (game.Player.Here == (int)RoomIndices.treas &&
                ObjectHandler.qhere_(game, (int)ObjectIndices.chali, game.Player.Here))
            {
                game.Objects.oflag1[(int)ObjectIndices.chali - 1] &= ~ObjectFlags.TAKEBT;
            }
            return(ret_val);

L500:
            if (game.ParserVectors.prsa != (int)VIndices.takew)
            {
                goto L600;
            }
            /*                      !TAKE? */
            MessageHandler.rspeak_(game, 506);
            /*                      !JOKE. */
            return(ret_val);

L600:
            if (game.ParserVectors.prsa != (int)VIndices.throww || game.ParserVectors.prso != (int)ObjectIndices.knife ||
                (game.Objects.oflag2[(int)ObjectIndices.thief - 1] & ObjectFlags2.FITEBT) != 0)
            {
                goto L700;
            }
            if (RoomHandler.prob_(game, 10, 10))
            {
                goto L650;
            }
            /*                      !THREW KNIFE, 10%? */
            MessageHandler.rspeak_(game, 507);
            /*                      !NO, JUST MAKES */
            game.Objects.oflag2[(int)ObjectIndices.thief - 1] |= ObjectFlags2.FITEBT;
            return(ret_val);

L650:
            j = 508;
            /*                      !THIEF DROPS STUFF. */
            i__1 = game.Objects.Count;
            for (i = 1; i <= i__1; ++i)
            {
                if (game.Objects.oadv[i - 1] != -(int)ObjectIndices.thief)
                {
                    goto L675;
                }
                /*                      !THIEF CARRYING? */
                j = 509;
                ObjectHandler.newsta_(game, i, 0, game.Player.Here, 0, 0);
L675:
                ;
            }
            ObjectHandler.newsta_(game, (int)ObjectIndices.thief, j, 0, 0, 0);
            /*                      !THIEF VANISHES. */
            return(ret_val);

L700:
            if (game.ParserVectors.prsa != (int)VIndices.throww && game.ParserVectors.prsa != (int)VIndices.givew ||
                game.ParserVectors.prso == 0 || game.ParserVectors.prso == (int)ObjectIndices.thief)
            {
                goto L10;
            }
            if (game.Objects.ocapac[(int)ObjectIndices.thief - 1] >= 0)
            {
                goto L750;
            }
            /*                      !WAKE HIM UP. */
            game.Objects.ocapac[(int)ObjectIndices.thief - 1] = -game.Objects.ocapac[(int)ObjectIndices.thief - 1];
            game.Hack.thfact = true;
            game.Objects.oflag1[(int)ObjectIndices.still - 1] |= ObjectFlags.VISIBT;
            game.Objects.odesc1[(int)ObjectIndices.thief - 1]  = 503;
            MessageHandler.rspeak_(game, 510);

L750:
            if (game.ParserVectors.prso != (int)ObjectIndices.brick || game.Objects.ocan[(int)ObjectIndices.fuse - 1] !=
                (int)ObjectIndices.brick || game.Clock.Ticks[(int)ClockIndices.cevfus - 1] == 0)
            {
                goto L800;
            }
            MessageHandler.rspsub_(game, 511);
            /*                      !THIEF REFUSES BOMB. */
            return(ret_val);

L800:
            i__1 = -(int)ObjectIndices.thief;
            ObjectHandler.newsta_(game, game.ParserVectors.prso, 0, 0, 0, i__1);
            /*                      !THIEF TAKES GIFT. */
            if (game.Objects.otval[game.ParserVectors.prso - 1] > 0)
            {
                goto L900;
            }
            /*                      !A TREASURE? */
            MessageHandler.rspsub_(game, 512, game.Objects.odesc2[game.ParserVectors.prso - 1]);
            return(ret_val);

L900:
            MessageHandler.rspsub_(game, 627, game.Objects.odesc2[game.ParserVectors.prso - 1]);
            /*                      !THIEF ENGROSSED. */
            game.Flags.thfenf = true;
            return(ret_val);

L10:
            ret_val = false;
            return(ret_val);
        }
Exemplo n.º 2
0
        /* CPINFO--	DESCRIBE PUZZLE ROOM */

        public static void cpinfo_(Game game, int rmk, int st)
        {
            int[]  dgmoft = { -9, -8, -7, -1, 1, 7, 8, 9 };
            string pict   = "SSS M";

            int i, j, k, l;

            char[] dgm = new char[1 * 8];

            MessageHandler.rspeak_(game, rmk);
            for (i = 1; i <= 8; ++i)
            {
                j          = dgmoft[i - 1];
                dgm[i - 1] = pict[PuzzleHandler.cpvec[st + j - 1] + 3];
                /*                      !GET PICTURE ELEMENT. */
                if (Math.Abs(j) == 1 || Math.Abs(j) == 8)
                {
                    goto L100;
                }
                k = 8;
                if (j < 0)
                {
                    k = -8;
                }
                /*                      !GET ORTHO DIR. */
                l = j - k;
                if (PuzzleHandler.cpvec[st + k - 1] != 0 && PuzzleHandler.cpvec[st + l - 1] !=
                    0)
                {
                    dgm[i - 1] = '?';
                }
L100:
                ;
            }

            // more_output(NULL);
            // Console.Write("       |%c%c %c%c %c%c|\n", dgm[0], dgm[0], dgm[1], dgm[1], dgm[2], dgm[2]);
            // more_output(NULL);
            // Console.Write(" West  |%c%c .. %c%c| East\n", dgm[3], dgm[3], dgm[4], dgm[4]);
            // more_output(NULL);
            // Console.Write("       |%c%c %c%c %c%c|\n", dgm[5], dgm[5], dgm[6], dgm[6], dgm[7], dgm[7]);

            if (st == 10)
            {
                MessageHandler.rspeak_(game, 870);
            }
            /*                      !AT HOLE? */
            if (st == 37)
            {
                MessageHandler.rspeak_(game, 871);
            }
            /*                      !AT NICHE? */
            i = 872;
            /*                      !DOOR OPEN? */
            if (game.Flags.cpoutf)
            {
                i = 873;
            }

            if (st == 52)
            {
                MessageHandler.rspeak_(game, i);
            }

            /*                      !AT DOOR? */
            if (PuzzleHandler.cpvec[st] == -2)
            {
                MessageHandler.rspeak_(game, 874);
            }

            /*                      !EAST LADDER? */
            if (PuzzleHandler.cpvec[st - 2] == -3)
            {
                MessageHandler.rspeak_(game, 875);
            }
            /*                      !WEST LADDER? */
        }
Exemplo n.º 3
0
        /* TROLLP-	TROLL FUNCTION */

        public static bool trollp_(Game game, int arg)
        {
            /* System generated locals */
            bool ret_val;

            /* Local variables */
            int i;

            ret_val = true;
            /*                      !ASSUME WINS. */
            if (game.ParserVectors.prsa != (int)VIndices.fightw)
            {
                goto L1100;
            }
            /*                      !FIGHT? */
            if (game.Objects.ocan[(int)ObjectIndices.axe - 1] == (int)ObjectIndices.troll)
            {
                goto L10;
            }
            /*                      !GOT AXE?  NOTHING. */
            i = 433;
            /*                      !ASSUME CANT GET. */
            if (!ObjectHandler.qhere_(game, (int)ObjectIndices.axe, game.Player.Here))
            {
                goto L1050;
            }
            /*                      !HERE? */
            i = 434;
            /*                      !YES, RECOVER. */
            ObjectHandler.newsta_(game, (int)ObjectIndices.axe, 0, 0, (int)ObjectIndices.troll, 0);
L1050:
            if (ObjectHandler.qhere_(game, (int)ObjectIndices.troll, game.Player.Here))
            {
                MessageHandler.rspsub_(game, i);
            }
            /*                      !IF PLAYER HERE. */
            return(ret_val);

L1100:
            if (game.ParserVectors.prsa != (int)VIndices.deadxw)
            {
                goto L1200;
            }
            /*                      !DEAD? */
            game.Flags.trollf = true;
            /*                      !PERMIT EXITS. */
            return(ret_val);

L1200:
            if (game.ParserVectors.prsa != (int)VIndices.outxw)
            {
                goto L1300;
            }
            /*                      !OUT? */
            game.Flags.trollf = true;
            /*                      !PERMIT EXITS. */
            game.Objects.oflag1[(int)ObjectIndices.axe - 1]  &= ~ObjectFlags.VISIBT;
            game.Objects.odesc1[(int)ObjectIndices.troll - 1] = 435;
            /*                      !TROLL OUT. */
            return(ret_val);

L1300:
            if (game.ParserVectors.prsa != (int)VIndices.inxw)
            {
                goto L1400;
            }
            /*                      !WAKE UP? */
            game.Flags.trollf = false;
            /*                      !FORBID EXITS. */
            game.Objects.oflag1[(int)ObjectIndices.axe - 1]  |= ObjectFlags.VISIBT;
            game.Objects.odesc1[(int)ObjectIndices.troll - 1] = 436;
            /*                      !TROLL IN. */
            if (ObjectHandler.qhere_(game, (int)ObjectIndices.troll, game.Player.Here))
            {
                MessageHandler.rspsub_(game, 437);
            }
            return(ret_val);

L1400:
            if (game.ParserVectors.prsa != (int)VIndices.frstqw)
            {
                goto L1500;
            }
            /*                      !FIRST ENCOUNTER? */
            ret_val = RoomHandler.prob_(game, 33, 66);
            /*                      !33% TRUE UNLESS BADLK. */
            return(ret_val);

L1500:
            if (game.ParserVectors.prsa != (int)VIndices.movew && game.ParserVectors.prsa != (int)VIndices.takew &&
                game.ParserVectors.prsa != (int)VIndices.mungw && game.ParserVectors.prsa !=
                (int)VIndices.throww && game.ParserVectors.prsa != (int)VIndices.givew)
            {
                goto L2000;
            }
            if (game.Objects.ocapac[(int)ObjectIndices.troll - 1] >= 0)
            {
                goto L1550;
            }
            /*                      !TROLL OUT? */
            game.Objects.ocapac[(int)ObjectIndices.troll - 1] = -game.Objects.ocapac[(int)ObjectIndices.troll - 1]
            ;
            /*                      !YES, WAKE HIM. */
            game.Objects.oflag1[(int)ObjectIndices.axe - 1] |= ObjectFlags.VISIBT;
            game.Flags.trollf = false;
            game.Objects.odesc1[(int)ObjectIndices.troll - 1] = 436;
            MessageHandler.rspsub_(game, 437);

L1550:
            if (game.ParserVectors.prsa != (int)VIndices.takew && game.ParserVectors.prsa != (int)VIndices.movew)
            {
                goto L1600;
            }
            MessageHandler.rspsub_(game, 438);
            /*                      !JOKE. */
            return(ret_val);

L1600:
            if (game.ParserVectors.prsa != (int)VIndices.mungw)
            {
                goto L1700;
            }
            /*                      !MUNG? */
            MessageHandler.rspeak_(game, 439);
            /*                      !JOKE. */
            return(ret_val);

L1700:
            if (game.ParserVectors.prso == 0)
            {
                goto L10;
            }
            /*                      !NO OBJECT? */
            i = 440;
            /*                      !ASSUME THROW. */
            if (game.ParserVectors.prsa == (int)VIndices.givew)
            {
                i = 441;
            }
            /*                      !GIVE? */
            MessageHandler.rspsub_(game, i, game.Objects.odesc2[game.ParserVectors.prso - 1]);
            /*                      !TROLL TAKES. */
            if (game.ParserVectors.prso == (int)ObjectIndices.knife)
            {
                goto L1900;
            }
            /*                      !OBJ KNIFE? */
            ObjectHandler.newsta_(game, game.ParserVectors.prso, 442, 0, 0, 0);
            /*                      !NO, EATS IT. */
            return(ret_val);

L1900:
            MessageHandler.rspeak_(game, 443);
            /*                      !KNIFE, THROWS IT BACK */
            game.Objects.oflag2[(int)ObjectIndices.troll - 1] |= ObjectFlags2.FITEBT;
            return(ret_val);

L2000:
            if (!game.Flags.trollf || game.ParserVectors.prsa != (int)VIndices.hellow)
            {
                goto L10;
            }
            MessageHandler.rspeak_(game, 366);
            /*                      !TROLL OUT. */
            return(ret_val);

L10:
            ret_val = false;
            /*                      !COULDNT HANDLE IT. */
            return(ret_val);
        } /* trollp_ */
Exemplo n.º 4
0
        } /* trollp_ */

        /* CYCLOP-	CYCLOPS FUNCTION */

        /* DECLARATIONS */

        public static bool cyclop_(Game game, int arg)
        {
            /* System generated locals */
            int  i__1, i__2;
            bool ret_val;

            /* Local variables */
            int i;

            ret_val = true;
            /*                      !ASSUME WINS. */
            if (!game.Flags.cyclof)
            {
                goto L100;
            }

            /*                      !ASLEEP? */
            if (game.ParserVectors.prsa != (int)VIndices.alarmw && game.ParserVectors.prsa != (int)VIndices.mungw &&
                game.ParserVectors.prsa != (int)VIndices.hellow && game.ParserVectors.prsa !=
                (int)VIndices.burnw && game.ParserVectors.prsa != (int)VIndices.killw &&
                game.ParserVectors.prsa != (int)VIndices.attacw)
            {
                goto L10;
            }
            game.Flags.cyclof = false;
            /*                      !WAKE CYCLOPS. */
            MessageHandler.rspsub_(game, 187);
            /*                      !DESCRIBE. */
            game.Switches.rvcyc = Math.Abs(game.Switches.rvcyc);
            game.Objects.oflag2[(int)ObjectIndices.cyclo - 1] = (game.Objects.oflag2[(int)ObjectIndices.cyclo - 1] | ObjectFlags2.FITEBT) & ~ObjectFlags2.SLEPBT;
            return(ret_val);

L100:
            if (game.ParserVectors.prsa == (int)VIndices.fightw || game.ParserVectors.prsa == (int)VIndices.frstqw)
            {
                goto L10;
            }
            if (Math.Abs(game.Switches.rvcyc) <= 5)
            {
                goto L200;
            }
            /*                      !ANNOYED TOO MUCH? */
            game.Switches.rvcyc = 0;
            /*                      !RESTART COUNT. */
            AdventurerHandler.jigsup_(game, 188);
            /*                      !YES, EATS PLAYER. */
            return(ret_val);

L200:
            if (game.ParserVectors.prsa != (int)VIndices.givew)
            {
                goto L500;
            }
            /*                      !GIVE? */
            if (game.ParserVectors.prso != (int)ObjectIndices.food || game.Switches.rvcyc < 0)
            {
                goto L300;
            }
            /*                      !FOOD WHEN HUNGRY? */
            ObjectHandler.newsta_(game, (int)ObjectIndices.food, 189, 0, 0, 0);
            /*                      !EATS PEPPERS. */
            /* Computing MIN */
            i__1 = -1;
            i__2 = -game.Switches.rvcyc;
            game.Switches.rvcyc = Math.Min(i__1, i__2);
            /*                      !GETS THIRSTY. */
            return(ret_val);

L300:
            if (game.ParserVectors.prso != (int)ObjectIndices.water)
            {
                goto L400;
            }
            /*                      !DRINK WHEN THIRSTY? */
            if (game.Switches.rvcyc >= 0)
            {
                goto L350;
            }
            ObjectHandler.newsta_(game, game.ParserVectors.prso, 190, 0, 0, 0);
            /*                      !DRINKS AND */
            game.Flags.cyclof = true;
            /*                      !FALLS ASLEEP. */
            game.Objects.oflag2[(int)ObjectIndices.cyclo - 1] = (game.Objects.oflag2[(int)ObjectIndices.cyclo - 1] | ObjectFlags2.SLEPBT) & ~ObjectFlags2.FITEBT;
            return(ret_val);

L350:
            MessageHandler.rspeak_(game, 191);
            /*                      !NOT THIRSTY. */
L10:
            ret_val = false;
            /*                      !FAILS. */
            return(ret_val);

L400:
            i = 192;
            /*                      !ASSUME INEDIBLE. */
            if (game.ParserVectors.prso == (int)ObjectIndices.garli)
            {
                i = 193;
            }
            /*                      !GARLIC IS JOKE. */
L450:
            MessageHandler.rspeak_(game, i);
            /*                      !DISDAIN IT. */
            if (game.Switches.rvcyc < 0)
            {
                --game.Switches.rvcyc;
            }
            if (game.Switches.rvcyc >= 0)
            {
                ++game.Switches.rvcyc;
            }
            if (!game.Flags.cyclof)
            {
                i__1 = Math.Abs(game.Switches.rvcyc) + 193;
                MessageHandler.rspeak_(game, i__1);
            }
            return(ret_val);

L500:
            i = 0;
            /*                      !ASSUME NOT HANDLED. */
            if (game.ParserVectors.prsa == (int)VIndices.hellow)
            {
                goto L450;
            }
            /*                      !HELLO IS NO GO. */
            if (game.ParserVectors.prsa == (int)VIndices.throww || game.ParserVectors.prsa == (int)VIndices.mungw)
            {
                i = game.rnd_(2) + 200;
            }
            if (game.ParserVectors.prsa == (int)VIndices.takew)
            {
                i = 202;
            }
            if (game.ParserVectors.prsa == (int)VIndices.tiew)
            {
                i = 203;
            }
            if (i <= 0)
            {
                goto L10;
            }
            else
            {
                goto L450;
            }
            /*                      !SEE IF HANDLED. */
        } /* cyclop_ */
Exemplo n.º 5
0
        /* WALK- MOVE IN SPECIFIED DIRECTION */
        public static bool walk_(Game game)
        {
            /* System generated locals */
            bool ret_val;

            ret_val = true;
            /*                      !ASSUME WINS. */
            if (game.Player.Winner != (int)AIndices.player || RoomHandler.IsRoomLit(game.Player.Here, game) || RoomHandler.prob_(game, 25, 25))
            {
                goto L500;
            }

            if (!dso3.findxt_(game, game.ParserVectors.prso, game.Player.Here))
            {
                goto L450;
            }
            /*                      !INVALID EXIT? GRUE */
            /*                      ! */
            switch (game.curxt_.xtype)
            {
            case 1: goto L400;

            case 2: goto L200;

            case 3: goto L100;

            case 4: goto L300;
            }
            /*                      !DECODE EXIT TYPE. */
            throw new InvalidOperationException();
            //bug_(9, game.curxt_.xtype);

L100:
            if (cxappl_(game, game.curxt_.xactio) != 0)
            {
                goto L400;
            }
            /*                      !CEXIT... RETURNED ROOM? */
            // TODO: chadj: figure out how to do this
            //if (game.Flags[game.curxt_.xobj - 1])
            {
                //  goto L400;
            }
            /*                      !NO, FLAG ON? */
L200:
            AdventurerHandler.jigsup_(game, 523);
            /*                      !BAD EXIT, GRUE */
            /*                      ! */
            return(ret_val);

L300:
            if (cxappl_(game, game.curxt_.xactio) != 0)
            {
                goto L400;
            }
            /*                      !DOOR... RETURNED ROOM? */
            if ((game.Objects.oflag2[game.curxt_.xobj - 1] & ObjectFlags2.OPENBT) != 0)
            {
                goto L400;
            }
            /*                      !NO, DOOR OPEN? */
            AdventurerHandler.jigsup_(game, 523);
            /*                      !BAD EXIT, GRUE */
            /*                      ! */
            return(ret_val);

L400:
            if (RoomHandler.IsRoomLit(game.curxt_.xroom1, game))
            {
                goto L900;
            }
            /*                      !VALID ROOM, IS IT LIT? */
L450:
            AdventurerHandler.jigsup_(game, 522);
            /*                      !NO, GRUE */
            /*                      ! */
            return(ret_val);

            /* ROOM IS LIT, OR WINNER IS NOT PLAYER (NO GRUE). */

L500:
            if (dso3.findxt_(game, game.ParserVectors.prso, game.Player.Here))
            {
                goto L550;
            }
            /*                      !EXIT EXIST? */
L525:
            game.curxt_.xstrng = 678;
            /*                      !ASSUME WALL. */
            if (game.ParserVectors.prso == (int)XSearch.xup)
            {
                game.curxt_.xstrng = 679;
            }
            /*                      !IF UP, CANT. */
            if (game.ParserVectors.prso == (int)XSearch.xdown)
            {
                game.curxt_.xstrng = 680;
            }
            /*                      !IF DOWN, CANT. */
            if ((game.Rooms.RoomFlags[game.Player.Here - 1] & RoomFlags.RNWALL) != 0)
            {
                game.curxt_.xstrng = 524;
            }

            MessageHandler.rspeak_(game, game.curxt_.xstrng);
            game.ParserVectors.prscon = 1;
            /*                      !STOP CMD STREAM. */
            return(ret_val);

L550:
            switch (game.curxt_.xtype)
            {
            case 1: goto L900;

            case 2: goto L600;

            case 3: goto L700;

            case 4: goto L800;
            }
            /*                      !BRANCH ON EXIT TYPE. */
            throw new InvalidOperationException();
            //bug_(9, curxt_.xtype);

L700:
            if (cxappl_(game, game.curxt_.xactio) != 0)
            {
                goto L900;
            }
            /*                      !CEXIT... RETURNED ROOM? */
            // TODO: chadj figure this out
            //if (game.Flags[game.curxt_.xobj - 1])
            {
                //  goto L900;
            }
            /*                      !NO, FLAG ON? */
L600:
            if (game.curxt_.xstrng == 0)
            {
                goto L525;
            }
            /*                      !IF NO REASON, USE STD. */
            MessageHandler.rspeak_(game, game.curxt_.xstrng);
            /*                      !DENY EXIT. */
            game.ParserVectors.prscon = 1;
            /*                      !STOP CMD STREAM. */
            return(ret_val);

L800:
            if (cxappl_(game, game.curxt_.xactio) != 0)
            {
                goto L900;
            }
            /*                      !DOOR... RETURNED ROOM? */
            if ((game.Objects.oflag2[game.curxt_.xobj - 1] & ObjectFlags2.OPENBT) != 0)
            {
                goto L900;
            }
            /*                      !NO, DOOR OPEN? */
            if (game.curxt_.xstrng == 0)
            {
                game.curxt_.xstrng = 525;
            }
            /*                      !IF NO REASON, USE STD. */
            MessageHandler.rspsub_(game.curxt_.xstrng, game.Objects.odesc2[game.curxt_.xobj - 1], game);
            game.ParserVectors.prscon = 1;
            /*                      !STOP CMD STREAM. */
            return(ret_val);

L900:
            ret_val = AdventurerHandler.moveto_(game, game.curxt_.xroom1, game.Player.Winner);
            /*                      !MOVE TO ROOM. */
            if (ret_val)
            {
                ret_val = RoomHandler.RoomDescription(0, game);
            }
            /*                      !DESCRIBE ROOM. */
            return(ret_val);
        } /* walk_ */
Exemplo n.º 6
0
        } /* walk_ */

        /* CXAPPL- CONDITIONAL EXIT PROCESSORS */
        public static int cxappl_(Game game, int ri)
        {
            /* System generated locals */
            int ret_val, i__1;

            /* Local variables */
            int i, j, k;
            int nxt;
            int ldir;

            ret_val = 0;
            /*                      !NO RETURN. */
            if (ri == 0)
            {
                return(ret_val);
            }
            /*                      !IF NO ACTION, DONE. */
            switch (ri)
            {
            case 1: goto L1000;

            case 2: goto L2000;

            case 3: goto L3000;

            case 4: goto L4000;

            case 5: goto L5000;

            case 6: goto L6000;

            case 7: goto L7000;

            case 8: goto L8000;

            case 9: goto L9000;

            case 10: goto L10000;

            case 11: goto L11000;

            case 12: goto L12000;

            case 13: goto L13000;

            case 14: goto L14000;
            }
            throw new InvalidOperationException();
            //bug_(5, ri);

            /* C1- COFFIN-CURE */

L1000:
            game.Flags.egyptf = game.Objects.oadv[(int)ObjectIndices.coffi - 1] != game.Player.Winner;
            /*                      !T IF NO COFFIN. */
            return(ret_val);

            /* C2- CAROUSEL EXIT */
            /* C5- CAROUSEL OUT */

L2000:
            if (game.Flags.caroff)
            {
                return(ret_val);
            }
            /*                      !IF FLIPPED, NOTHING. */
L2500:
            MessageHandler.rspeak_(game, 121);
            /*                      !SPIN THE COMPASS. */
L5000:
            i = xpars_.xelnt[xpars_.xcond - 1] * game.rnd_(8);
            /*                      !CHOOSE RANDOM EXIT. */
            game.curxt_.xroom1 = game.Exits.Travel[game.Rooms.RoomExits[game.Player.Here - 1] + i - 1] & xpars_.xrmask;
            ret_val            = game.curxt_.xroom1;
            /*                      !RETURN EXIT. */
            return(ret_val);

            /* C3- CHIMNEY FUNCTION */

L3000:
            game.Flags.litldf = false;
            /*                      !ASSUME HEAVY LOAD. */
            j    = 0;
            i__1 = game.Objects.Count;
            for (i = 1; i <= i__1; ++i)
            {
                /*                      !COUNT OBJECTS. */
                if (game.Objects.oadv[i - 1] == game.Player.Winner)
                {
                    ++j;
                }
                /* L3100: */
            }

            if (j > 2)
            {
                return(ret_val);
            }
            /*                      !CARRYING TOO MUCH? */
            game.curxt_.xstrng = 446;
            /*                      !ASSUME NO LAMP. */
            if (game.Objects.oadv[(int)ObjectIndices.lamp - 1] != game.Player.Winner)
            {
                return(ret_val);
            }
            /*                      !NO LAMP? */
            game.Flags.litldf = true;
            /*                      !HE CAN DO IT. */
            if ((game.Objects.oflag2[(int)ObjectIndices.door - 1] & ObjectFlags2.OPENBT) == 0)
            {
                game.Objects.oflag2[(int)ObjectIndices.door - 1] &= ~ObjectFlags2.TCHBT;
            }
            return(ret_val);

            /* C4-	FROBOZZ FLAG (MAGNET ROOM, FAKE EXIT) */
            /* C6-	FROBOZZ FLAG (MAGNET ROOM, REAL EXIT) */

L4000:
            if (game.Flags.caroff)
            {
                goto L2500;
            }
            /*                      !IF FLIPPED, GO SPIN. */
            game.Flags.frobzf = false;
            /*                      !OTHERWISE, NOT AN EXIT. */
            return(ret_val);

L6000:
            if (game.Flags.caroff)
            {
                goto L2500;
            }
            /*                      !IF FLIPPED, GO SPIN. */
            game.Flags.frobzf = true;
            /*                      !OTHERWISE, AN EXIT. */
            return(ret_val);

            /* C7-	FROBOZZ FLAG (BANK ALARM) */

L7000:
            game.Flags.frobzf = game.Objects.oroom[(int)ObjectIndices.bills - 1] != 0 &
                                game.Objects.oroom[(int)ObjectIndices.portr - 1] != 0;
            return(ret_val);

            /* CXAPPL, PAGE 3 */

            /* C8-	FROBOZZ FLAG (MRGO) */

L8000:
            game.Flags.frobzf = false;
            /*                      !ASSUME CANT MOVE. */
            if (game.Switches.mloc != game.curxt_.xroom1)
            {
                goto L8100;
            }
            /*                      !MIRROR IN WAY? */
            if (game.ParserVectors.prso == (int)XSearch.xnorth || game.ParserVectors.prso == (int)XSearch.xsouth)
            {
                goto L8200;
            }
            if (game.Switches.mdir % 180 != 0)
            {
                goto L8300;
            }

            /*                      !MIRROR MUST BE N-S. */
            game.curxt_.xroom1 = (game.curxt_.xroom1 - (int)RoomIndices.mra << 1) + (int)RoomIndices.mrae;
            /*                      !CALC EAST ROOM. */
            if (game.ParserVectors.prso > (int)XSearch.xsouth)
            {
                ++game.curxt_.xroom1;
            }
            /*                      !IF SW/NW, CALC WEST. */
L8100:
            ret_val = game.curxt_.xroom1;
            return(ret_val);

L8200:
            game.curxt_.xstrng = 814;
            /*                      !ASSUME STRUC BLOCKS. */
            if (game.Switches.mdir % 180 == 0)
            {
                return(ret_val);
            }
            /*                      !IF MIRROR N-S, DONE. */
L8300:
            ldir = game.Switches.mdir;
            /*                      !SEE WHICH MIRROR. */
            if (game.ParserVectors.prso == (int)XSearch.xsouth)
            {
                ldir = 180;
            }

            game.curxt_.xstrng = 815;
            /*                      !MIRROR BLOCKS. */
            if (ldir > 180 && !game.Flags.mr1f || ldir < 180 && !game.Flags.mr2f)
            {
                game.curxt_.xstrng = 816;
            }

            return(ret_val);

            /* C9-	FROBOZZ FLAG (MIRIN) */

L9000:
            if (RoomHandler.mrhere_(game, game.Player.Here) != 1)
            {
                goto L9100;
            }

            /*                      !MIRROR 1 HERE? */
            if (game.Flags.mr1f)
            {
                game.curxt_.xstrng = 805;
            }

            /*                      !SEE IF BROKEN. */
            game.Flags.frobzf = game.Flags.mropnf;
            /*                      !ENTER IF OPEN. */
            return(ret_val);

L9100:
            game.Flags.frobzf = false;
            /*                      !NOT HERE, */
            game.curxt_.xstrng = 817;
            /*                      !LOSE. */
            return(ret_val);

            /* CXAPPL, PAGE 4 */

            /* C10-	FROBOZZ FLAG (MIRROR EXIT) */

L10000:
            game.Flags.frobzf = false;
            /*                      !ASSUME CANT. */
            ldir = (game.ParserVectors.prso - (int)XSearch.xnorth) / (int)XSearch.xnorth * 45;
            /*                      !XLATE DIR TO DEGREES. */
            if (!game.Flags.mropnf || (game.Switches.mdir + 270) % 360 != ldir && game.ParserVectors.prso != (int)XSearch.xexit)
            {
                goto L10200;
            }

            game.curxt_.xroom1 = (game.Switches.mloc - (int)RoomIndices.mra << 1) + (int)RoomIndices.mrae + 1
                                 - game.Switches.mdir / 180;
            /*                      !ASSUME E-W EXIT. */
            if (game.Switches.mdir % 180 == 0)
            {
                goto L10100;
            }

            /*                      !IF N-S, OK. */
            game.curxt_.xroom1 = game.Switches.mloc + 1;
            /*                      !ASSUME N EXIT. */
            if (game.Switches.mdir > 180)
            {
                game.curxt_.xroom1 = game.Switches.mloc - 1;
            }
            /*                      !IF SOUTH. */
L10100:
            ret_val = game.curxt_.xroom1;
            return(ret_val);

L10200:
            if (!game.Flags.wdopnf || (game.Switches.mdir + 180) % 360 != ldir &&
                game.ParserVectors.prso != (int)XSearch.xexit)
            {
                return(ret_val);
            }
            game.curxt_.xroom1 = game.Switches.mloc + 1;
            /*                      !ASSUME N. */
            if (game.Switches.mdir == 0)
            {
                game.curxt_.xroom1 = game.Switches.mloc - 1;
            }
            /*                      !IF S. */
            MessageHandler.rspeak_(game, 818);
            /*                      !CLOSE DOOR. */
            game.Flags.wdopnf = false;
            ret_val           = game.curxt_.xroom1;
            return(ret_val);

            /* C11-	MAYBE DOOR.  NORMAL MESSAGE IS THAT DOOR IS CLOSED. */
            /*  BUT IF LCELL.NE.4, DOOR ISNT THERE. */

L11000:
            if (game.Switches.lcell != 4)
            {
                game.curxt_.xstrng = 678;
            }
            /*                      !SET UP MSG. */
            return(ret_val);

            /* C12-	FROBZF (PUZZLE ROOM MAIN ENTRANCE) */

L12000:
            game.Flags.frobzf = true;
            /*                      !ALWAYS ENTER. */
            game.Switches.cphere = 10;
            /*                      !SET SUBSTATE. */
            return(ret_val);

            /* C13-	CPOUTF (PUZZLE ROOM SIZE ENTRANCE) */

L13000:
            game.Switches.cphere = 52;
            /*                      !SET SUBSTATE. */
            return(ret_val);

            /* CXAPPL, PAGE 5 */

            /* C14-	FROBZF (PUZZLE ROOM TRANSITIONS) */

L14000:
            game.Flags.frobzf = false;
            /*                      !ASSSUME LOSE. */
            if (game.ParserVectors.prso != (int)XSearch.xup)
            {
                goto L14100;
            }
            /*                      !UP? */
            if (game.Switches.cphere != 10)
            {
                return(ret_val);
            }
            /*                      !AT EXIT? */
            game.curxt_.xstrng = 881;
            /*                      !ASSUME NO LADDER. */
            if (PuzzleHandler.cpvec[game.Switches.cphere] != -2)
            {
                return(ret_val);
            }
            /*                      !LADDER HERE? */
            MessageHandler.rspeak_(game, 882);
            /*                      !YOU WIN. */
            game.Flags.frobzf = true;
            /*                      !LET HIM OUT. */
            return(ret_val);

L14100:
            if (game.Switches.cphere != 52 || game.ParserVectors.prso != (int)XSearch.xwest || !
                game.Flags.cpoutf)
            {
                goto L14200;
            }
            game.Flags.frobzf = true;
            /*                      !YES, LET HIM OUT. */
            return(ret_val);

L14200:
            for (i = 1; i <= 16; i += 2)
            {
                /*                      !LOCATE EXIT. */
                if (game.ParserVectors.prso == PuzzleHandler.cpdr[i - 1])
                {
                    goto L14400;
                }
                /* L14300: */
            }
            return(ret_val);

            /*                      !NO SUCH EXIT. */

L14400:
            j = PuzzleHandler.cpdr[i];
            /*                      !GET DIRECTIONAL OFFSET. */
            nxt = game.Switches.cphere + j;
            /*                      !GET NEXT STATE. */
            k = 8;
            /*                      !GET ORTHOGONAL DIR. */
            if (j < 0)
            {
                k = -8;
            }
            if ((Math.Abs(j) == 1 || Math.Abs(j) == 8 || (PuzzleHandler.cpvec[game.Switches.cphere + k - 1] == 0 || PuzzleHandler.cpvec[nxt - k - 1] == 0)) && PuzzleHandler.cpvec[nxt - 1] == 0)
            {
                goto L14500;
            }
            return(ret_val);

L14500:
            dso7.cpgoto_(game, nxt);
            /*                      !MOVE TO STATE. */
            game.curxt_.xroom1 = (int)RoomIndices.cpuzz;
            /*                      !STAY IN ROOM. */
            ret_val = game.curxt_.xroom1;
            return(ret_val);
        }
Exemplo n.º 7
0
        /* SAVE- SAVE GAME STATE */
        public static void savegm_(Game game)
        {
            /* Local variables */
            int i;

            //FILE* e;

            game.ParserVectors.prswon = false;
            /*                      !DISABLE GAME. */
            /* Note: save file format is different for PDP vs. non-PDP versions */

            //if ((e = fopen("dsave.dat", BINWRITE)) == NULL)
            //    goto L100;

            //gttime_(&i);
            /*                      !GET TIME. */

//#define do_uio(i, zbuf, cbytes) \
            //(void)fwrite((const char*)(zbuf), (cbytes), (i), e)

            //do_uio(1, &vers_1.vmaj, sizeof(int));
            //do_uio(1, &vers_1.vmin, sizeof(int));
            //do_uio(1, &vers_1.vedit, sizeof(int));
            //
            //do_uio(1, &game.Player.Winner, sizeof(int));
            //do_uio(1, &game.Player.Here, sizeof(int));
            //do_uio(1, &game.Hack.thfpos, sizeof(int));
            //do_uio(1, &game.Player.TelFlag, sizeof(bool));
            //do_uio(1, &game.Hack.thfflg, sizeof(bool));
            //do_uio(1, &game.Hack.thfact, sizeof(bool));
            //do_uio(1, &game.Hack.swdact, sizeof(bool));
            //do_uio(1, &game.Hack.swdsta, sizeof(int));
            //do_uio(64, &PuzzleHandler.cpvec[0], sizeof(int));
            //
            //do_uio(1, &i, sizeof(int));
            //do_uio(1, &game.State.moves, sizeof(int));
            //do_uio(1, &game.State.Deaths, sizeof(int));
            //do_uio(1, &game.State.rwscor, sizeof(int));
            //do_uio(1, &game.State.egscor, sizeof(int));
            //do_uio(1, &game.State.mxload, sizeof(int));
            //do_uio(1, &game.State.ltshft, sizeof(int));
            //do_uio(1, &game.State.bloc, sizeof(int));
            //do_uio(1, &game.State.mungrm, sizeof(int));
            //do_uio(1, &game.State.hs, sizeof(int));
            //do_uio(1, &game.Screen.fromdr, sizeof(int));
            //do_uio(1, &game.Screen.scolrm, sizeof(int));
            //do_uio(1, &game.Screen.scolac, sizeof(int));
            //
            //do_uio(220, &game.Objects.odesc1[0], sizeof(int));
            //do_uio(220, &game.Objects.odesc2[0], sizeof(int));
            //do_uio(220, &game.Objects.oflag1[0], sizeof(int));
            //do_uio(220, &game.Objects.oflag2[0], sizeof(int));
            //do_uio(220, &game.Objects.ofval[0], sizeof(int));
            //do_uio(220, &game.Objects.otval[0], sizeof(int));
            //do_uio(220, &game.Objects.osize[0], sizeof(int));
            //do_uio(220, &game.Objects.ocapac[0], sizeof(int));
            //do_uio(220, &game.Objects.oroom[0], sizeof(int));
            //do_uio(220, &game.Objects.oadv[0], sizeof(int));
            //do_uio(220, &game.Objects.ocan[0], sizeof(int));
            //
            //do_uio(200, &game.Rooms.rval[0], sizeof(int));
            //do_uio(200, &game.Rooms.RoomFlags[0], sizeof(int));
            //
            //do_uio(4, &game.Adventurers.aroom[0], sizeof(int));
            //do_uio(4, &game.Adventurers.ascore[0], sizeof(int));
            //do_uio(4, &game.Adventurers.avehic[0], sizeof(int));
            //do_uio(4, &game.Adventurers.astren[0], sizeof(int));
            //do_uio(4, &game.Adventurers.aflag[0], sizeof(int));
            //
            //do_uio(46, &game.Flags[0], sizeof(bool));
            //do_uio(22, &switch_[0], sizeof(int));
            //do_uio(4, &game.Villians.vprob[0], sizeof(int));
            //do_uio(25, &game.Clock.Flags[0], sizeof(bool));
            //do_uio(25, &game.Clock.Ticks[0], sizeof(int));

            //if (fclose(e) == EOF)
            {
                //    goto L100;
            }

            MessageHandler.rspeak_(game, 597);
            return;

L100:
            MessageHandler.rspeak_(game, 598);
            /*                      !CANT DO IT. */
        } /* savegm_ */
Exemplo n.º 8
0
        } /* savegm_ */

        /* RESTORE- RESTORE GAME STATE */
        public static void rstrgm_(Game game)
        {
            /* Local variables */
            int i, j, k;

//            FILE* e;

            game.ParserVectors.prswon = false;
            /*                      !DISABLE GAME. */
            /* Note: save file format is different for PDP vs. non-PDP versions */

//            if ((e = fopen("dsave.dat", BINREAD)) == NULL)
            {
//                goto L100;
            }

//#define do_uio(i, zbuf, cbytes) \
            //(void)fread((char*)(zbuf), (cbytes), (i), e)

            //do_uio(1, &i, sizeof(int));
            //do_uio(1, &j, sizeof(int));
            //do_uio(1, &k, sizeof(int));

            //if (i != vers_1.vmaj | j != vers_1.vmin)
            {
                //    goto L200;
            }

            //do_uio(1, game.Player.Winner, sizeof(int));
            //do_uio(1, game.Player.Here, sizeof(int));
            //do_uio(1, game.Hack.thfpos, sizeof(int));
            //do_uio(1, game.Player.TelFlag, sizeof(bool));
            //do_uio(1, game.Hack.thfflg, sizeof(bool));
            //do_uio(1, game.Hack.thfact, sizeof(bool));
            //do_uio(1, game.Hack.swdact, sizeof(bool));
            //do_uio(1, game.Hack.swdsta, sizeof(int));
            //do_uio(64, PuzzleHandler.cpvec[0], sizeof(int));
            //
            //do_uio(1, time_1.pltime, sizeof(int));
            //do_uio(1, game.State.moves, sizeof(int));
            //do_uio(1, game.State.Deaths, sizeof(int));
            //do_uio(1, game.State.rwscor, sizeof(int));
            //do_uio(1, game.State.egscor, sizeof(int));
            //do_uio(1, game.State.mxload, sizeof(int));
            //do_uio(1, game.State.ltshft, sizeof(int));
            //do_uio(1, game.State.bloc, sizeof(int));
            //do_uio(1, game.State.mungrm, sizeof(int));
            //do_uio(1, game.State.hs, sizeof(int));
            //do_uio(1, game.Screen.fromdr, sizeof(int));
            //do_uio(1, game.Screen.scolrm, sizeof(int));
            //do_uio(1, game.Screen.scolac, sizeof(int));
            //
            //do_uio(220, game.Objects.odesc1[0], sizeof(int));
            //do_uio(220, game.Objects.odesc2[0], sizeof(int));
            //do_uio(220, game.Objects.oflag1[0], sizeof(int));
            //do_uio(220, game.Objects.oflag2[0], sizeof(int));
            //do_uio(220, game.Objects.ofval[0], sizeof(int));
            //do_uio(220, game.Objects.otval[0], sizeof(int));
            //do_uio(220, game.Objects.osize[0], sizeof(int));
            //do_uio(220, game.Objects.ocapac[0], sizeof(int));
            //do_uio(220, game.Objects.oroom[0], sizeof(int));
            //do_uio(220, game.Objects.oadv[0], sizeof(int));
            //do_uio(220, game.Objects.ocan[0], sizeof(int));
            //
            //do_uio(200, game.Rooms.rval[0], sizeof(int));
            //do_uio(200, game.Rooms.RoomFlags[0], sizeof(int));

            //do_uio(4, game.Adventurers.aroom[0], sizeof(int));
            //do_uio(4, game.Adventurers.ascore[0], sizeof(int));
            //do_uio(4, game.Adventurers.avehic[0], sizeof(int));
            //do_uio(4, game.Adventurers.astren[0], sizeof(int));
            //do_uio(4, game.Adventurers.aflag[0], sizeof(int));
            //
            //do_uio(46, game.Flags[0], sizeof(bool));
            //do_uio(22, switch_[0], sizeof(int));
            //do_uio(4, game.Villians.vprob[0], sizeof(int));
            //do_uio(25, game.Clock.Flags[0], sizeof(bool));
            //do_uio(25, game.Clock.Ticks[0], sizeof(int));

            //(void)fclose(e);

            MessageHandler.rspeak_(game, 599);
            return;

L100:
            MessageHandler.rspeak_(game, 598);
            /*                      !CANT DO IT. */
            return;

L200:
            MessageHandler.rspeak_(game, 600);
            /*                      !OBSOLETE VERSION */
            //(void)fclose(e);
        }
Exemplo n.º 9
0
        } /* aappli_ */

        /* THIEFD-	INTERMOVE THIEF DEMON */
        public static void thiefd_(Game game)
        {
            /* System generated locals */
            int i__1, i__2;

            /* Local variables */
            int  i, j, nr;
            bool once;
            int  rhere;

            /*                      !SET UP DETAIL FLAG. */
            once = false;
            /*                      !INIT FLAG. */
L1025:
            rhere = game.Objects.oroom[(int)ObjectIndices.thief - 1];
            /*                      !VISIBLE POS. */
            if (rhere != 0)
            {
                game.Hack.thfpos = rhere;
            }

            if (game.Hack.thfpos == game.Player.Here)
            {
                goto L1100;
            }
            /*                      !THIEF IN WIN RM? */
            if (game.Hack.thfpos != (int)RoomIndices.treas)
            {
                goto L1400;
            }
            /*                      !THIEF NOT IN TREAS? */

            /* THIEF IS IN TREASURE ROOM, AND WINNER IS NOT. */

            if (rhere == 0)
            {
                goto L1050;
            }
            /*                      !VISIBLE? */
            ObjectHandler.newsta_(game, (int)ObjectIndices.thief, 0, 0, 0, 0);
            /*                      !YES, VANISH. */
            rhere = 0;
            if (ObjectHandler.qhere_(game, (int)ObjectIndices.still, (int)RoomIndices.treas) || game.Objects.oadv[
                    (int)ObjectIndices.still - 1] == -(int)ObjectIndices.thief)
            {
                ObjectHandler.newsta_(game, (int)ObjectIndices.still, 0, 0, (int)ObjectIndices.thief, 0);
            }
L1050:
            i__1 = -(int)ObjectIndices.thief;
            i    = dso4.robadv_(game, i__1, game.Hack.thfpos, 0, 0);
            /*                      !DROP VALUABLES. */
            if (ObjectHandler.qhere_(game, (int)ObjectIndices.egg, game.Hack.thfpos))
            {
                game.Objects.oflag2[(int)ObjectIndices.egg - 1] |= ObjectFlags2.OPENBT;
            }
            goto L1700;

            /* THIEF AND WINNER IN SAME ROOM. */

L1100:
            if (game.Hack.thfpos == (int)RoomIndices.treas)
            {
                goto L1700;
            }
            /*                      !IF TREAS ROOM, NOTHING. */
            if ((game.Rooms.RoomFlags[game.Hack.thfpos - 1] & RoomFlags.RLIGHT) != 0)
            {
                goto L1400;
            }
            if (game.Hack.thfflg)
            {
                goto L1300;
            }
            /*                      !THIEF ANNOUNCED? */
            if (rhere != 0 || RoomHandler.prob_(game, 70, 70))
            {
                goto L1150;
            }
            /*                      !IF INVIS AND 30%. */
            if (game.Objects.ocan[(int)ObjectIndices.still - 1] != (int)ObjectIndices.thief)
            {
                goto L1700;
            }
            /*                      !ABORT IF NO STILLETTO. */
            ObjectHandler.newsta_(game, (int)ObjectIndices.thief, 583, game.Hack.thfpos, 0, 0);
            /*                      !INSERT THIEF INTO ROOM. */
            game.Hack.thfflg = true;
            /*                      !THIEF IS ANNOUNCED. */
            return;

L1150:
            if (rhere == 0 || (game.Objects.oflag2[(int)ObjectIndices.thief - 1] & ObjectFlags2.FITEBT)
                == 0)
            {
                goto L1200;
            }
            if (dso4.winnin_(game, (int)ObjectIndices.thief, game.Player.Winner))
            {
                goto L1175;
            }
            /*                      !WINNING? */
            ObjectHandler.newsta_(game, (int)ObjectIndices.thief, 584, 0, 0, 0);
            /*                      !NO, VANISH THIEF. */
            game.Objects.oflag2[(int)ObjectIndices.thief - 1] &= ~ObjectFlags2.FITEBT;
            if (ObjectHandler.qhere_(game, (int)ObjectIndices.still, game.Hack.thfpos) ||
                game.Objects.oadv[(int)ObjectIndices.still - 1] == -(int)ObjectIndices.thief)
            {
                ObjectHandler.newsta_(game, (int)ObjectIndices.still, 0, 0, (int)ObjectIndices.thief, 0);
            }
            return;

L1175:
            if (RoomHandler.prob_(game, 90, 90))
            {
                goto L1700;
            }
            /*                      !90% CHANCE TO STAY. */

L1200:
            if (rhere == 0 || RoomHandler.prob_(game, 70, 70))
            {
                goto L1250;
            }
            /*                      !IF VISIBLE AND 30% */
            ObjectHandler.newsta_(game, (int)ObjectIndices.thief, 585, 0, 0, 0);
            /*                      !VANISH THIEF. */
            if (ObjectHandler.qhere_(game, (int)ObjectIndices.still, game.Hack.thfpos) || game.Objects.oadv[
                    (int)ObjectIndices.still - 1] == -(int)ObjectIndices.thief)
            {
                ObjectHandler.newsta_(game, (int)ObjectIndices.still, 0, 0, (int)ObjectIndices.thief, 0);
            }
            return;

L1300:
            if (rhere == 0)
            {
                goto L1700;
            }
            /*                      !ANNOUNCED.  VISIBLE? */
L1250:
            if (RoomHandler.prob_(game, 70, 70))
            {
                return;
            }
            /*                      !70% CHANCE TO DO NOTHING. */
            game.Hack.thfflg = true;
            i__1             = -(int)ObjectIndices.thief;
            i__2             = -(int)ObjectIndices.thief;
            nr = dso4.robrm_(game, game.Hack.thfpos, 100, 0, 0, i__1) + dso4.robadv_(game, game.Player.Winner, 0, 0, i__2);
            i  = 586;
            /*                      !ROBBED EM. */
            if (rhere != 0)
            {
                i = 588;
            }
            /*                      !WAS HE VISIBLE? */
            if (nr != 0)
            {
                ++i;
            }
            /*                      !DID HE GET ANYTHING? */
            ObjectHandler.newsta_(game, (int)ObjectIndices.thief, i, 0, 0, 0);
            /*                      !VANISH THIEF. */
            if (ObjectHandler.qhere_(game, (int)ObjectIndices.still, game.Hack.thfpos) || game.Objects.oadv[
                    (int)ObjectIndices.still - 1] == -(int)ObjectIndices.thief)
            {
                ObjectHandler.newsta_(game, (int)ObjectIndices.still, 0, 0, (int)ObjectIndices.thief, 0);
            }
            if (nr != 0 && !RoomHandler.IsRoomLit(game.Hack.thfpos, game))
            {
                MessageHandler.rspsub_(game, 406);
            }
            rhere = 0;
            goto L1700;
            /*                      !ONWARD. */

            /* NOT IN ADVENTURERS ROOM. */

L1400:
            ObjectHandler.newsta_(game, (int)ObjectIndices.thief, 0, 0, 0, 0);
            /*                      !VANISH. */
            rhere = 0;
            if (ObjectHandler.qhere_(game, (int)ObjectIndices.still, game.Hack.thfpos) || game.Objects.oadv[
                    (int)ObjectIndices.still - 1] == -(int)ObjectIndices.thief)
            {
                ObjectHandler.newsta_(game, (int)ObjectIndices.still, 0, 0, (int)ObjectIndices.thief, 0);
            }
            if ((game.Rooms.RoomFlags[game.Hack.thfpos - 1] & RoomFlags.RSEEN) == 0)
            {
                goto L1700;
            }

            i__1 = -(int)ObjectIndices.thief;
            i    = dso4.robrm_(game, game.Hack.thfpos, 75, 0, 0, i__1);
            /*                      !ROB ROOM 75%. */
            if (game.Hack.thfpos < (int)RoomIndices.maze1 || game.Hack.thfpos > (int)RoomIndices.maz15 ||
                game.Player.Here < (int)RoomIndices.maze1 || game.Player.Here > (int)RoomIndices.maz15)
            {
                goto L1500;
            }
            i__1 = game.Objects.Count;
            for (i = 1; i <= i__1; ++i)
            {
                /*                      !BOTH IN MAZE. */
                if (!ObjectHandler.qhere_(game, i, game.Hack.thfpos) ||
                    RoomHandler.prob_(game, 60, 60) ||
                    (game.Objects.oflag1[i - 1] & (int)ObjectFlags.VISIBT + ObjectFlags.TAKEBT) != (int)ObjectFlags.VISIBT + ObjectFlags.TAKEBT)
                {
                    goto L1450;
                }

                MessageHandler.rspsub_(game, 590, game.Objects.odesc2[i - 1]);
                /*                      !TAKE OBJECT. */
                if (RoomHandler.prob_(game, 40, 20))
                {
                    goto L1700;
                }
                i__2 = -(int)ObjectIndices.thief;
                ObjectHandler.newsta_(game, i, 0, 0, 0, i__2);
                /*                      !MOST OF THE TIME. */
                game.Objects.oflag2[i - 1] |= ObjectFlags2.TCHBT;
                goto L1700;
L1450:
                ;
            }
            goto L1700;

L1500:
            i__1 = game.Objects.Count;
            for (i = 1; i <= i__1; ++i)
            {
                /*                      !NOT IN MAZE. */
                if (!ObjectHandler.qhere_(game, i, game.Hack.thfpos) ||
                    game.Objects.otval[i - 1] != 0 ||
                    RoomHandler.prob_(game, 80, 60) ||
                    (game.Objects.oflag1[i - 1] & (int)ObjectFlags.VISIBT + ObjectFlags.TAKEBT) != (int)ObjectFlags.VISIBT + ObjectFlags.TAKEBT)
                {
                    goto L1550;
                }
                i__2 = -(int)ObjectIndices.thief;
                ObjectHandler.newsta_(game, i, 0, 0, 0, i__2);
                game.Objects.oflag2[i - 1] |= ObjectFlags2.TCHBT;
                goto L1700;
L1550:
                ;
            }

            /* NOW MOVE TO NEW ROOM. */

L1700:
            if (game.Objects.oadv[(int)ObjectIndices.rope - 1] == -(int)ObjectIndices.thief)
            {
                game.Flags.domef = false;
            }
            if (once)
            {
                goto L1800;
            }
            once = !once;
L1750:
            --game.Hack.thfpos;
            /*                      !NEXT ROOM. */
            if (game.Hack.thfpos <= 0)
            {
                game.Hack.thfpos = game.Rooms.Count;
            }
            if ((game.Rooms.RoomFlags[game.Hack.thfpos - 1] & (int)RoomFlags.RLAND + (int)RoomFlags.RSACRD + RoomFlags.REND) != RoomFlags.RLAND)
            {
                goto L1750;
            }
            game.Hack.thfflg = false;
            /*                      !NOT ANNOUNCED. */
            goto L1025;
            /*                      !ONCE MORE. */

            /* ALL DONE. */

L1800:
            if (game.Hack.thfpos == (int)RoomIndices.treas)
            {
                return;
            }
            /*                      !IN TREASURE ROOM? */
            j = 591;
            /*                      !NO, DROP STUFF. */
            if (game.Hack.thfpos != game.Player.Here)
            {
                j = 0;
            }
            i__1 = game.Objects.Count;
            for (i = 1; i <= i__1; ++i)
            {
                if (game.Objects.oadv[i - 1] != -(int)ObjectIndices.thief ||
                    RoomHandler.prob_(game, 70, 70) ||
                    game.Objects.otval[i - 1] > 0)
                {
                    goto L1850;
                }

                ObjectHandler.newsta_(game, i, j, game.Hack.thfpos, 0, 0);
                j = 0;
L1850:
                ;
            }
            return;
        }
Exemplo n.º 10
0
        /* AAPPLI- APPLICABLES FOR ADVENTURERS */
        public static bool aappli_(Game game, int ri)
        {
            /* System generated locals */
            bool ret_val;

            /* Local variables */
            bool f;
            int  i;

            if (ri == 0)
            {
                goto L10;
            }
            /*                      !IF ZERO, NO APP. */
            ret_val = true;
            /*                      !ASSUME WINS. */
            switch (ri)
            {
            case 1: goto L1000;

            case 2: goto L2000;
            }
            /*                      !BRANCH ON ADV. */
            throw new InvalidOperationException();
            //bug_(11, ri);

            /* COMMON FALSE RETURN. */

L10:
            ret_val = false;
            return(ret_val);

            /* A1--	ROBOT.  PROCESS MOST COMMANDS GIVEN TO ROBOT. */

L1000:
            if (game.ParserVectors.prsa != (int)VIndices.raisew || game.ParserVectors.prso != (int)ObjectIndices.rcage)
            {
                goto L1200;
            }
            game.Clock.Flags[(int)ClockIndices.cevsph - 1] = false;
            /*                      !ROBOT RAISED CAGE. */
            game.Player.Winner = (int)AIndices.player;
            /*                      !RESET FOR PLAYER. */
            f = AdventurerHandler.moveto_(game, (int)RoomIndices.cager, game.Player.Winner);
            /*                      !MOVE TO NEW ROOM. */
            ObjectHandler.newsta_(game, (int)ObjectIndices.cage, 567, (int)RoomIndices.cager, 0, 0);
            /*                      !INSTALL CAGE IN ROOM. */
            ObjectHandler.newsta_(game, (int)ObjectIndices.robot, 0, (int)RoomIndices.cager, 0, 0);
            /*                      !INSTALL ROBOT IN ROOM. */
            game.Adventurers.Rooms[(int)AIndices.arobot - 1] = (int)RoomIndices.cager;
            /*                      !ALSO MOVE ROBOT/ADV. */
            game.Flags.cagesf = true;
            /*                      !CAGE SOLVED. */
            game.Objects.oflag1[(int)ObjectIndices.robot - 1] &= ~ObjectFlags.NDSCBT;
            game.Objects.oflag1[(int)ObjectIndices.spher - 1] |= ObjectFlags.TAKEBT;
            return(ret_val);

L1200:
            if (game.ParserVectors.prsa != (int)VIndices.drinkw && game.ParserVectors.prsa != (int)VIndices.eatw)
            {
                goto L1300;
            }

            MessageHandler.rspeak_(game, 568);
            /*                      !EAT OR DRINK, JOKE. */
            return(ret_val);

L1300:
            if (game.ParserVectors.prsa != (int)VIndices.readw)
            {
                goto L1400;
            }
            /*                      !READ, */
            MessageHandler.rspsub_(game, 569);
            /*                      !JOKE. */
            return(ret_val);

L1400:
            if (game.ParserVectors.prsa == (int)VIndices.walkw || game.ParserVectors.prsa == (int)VIndices.takew ||
                game.ParserVectors.prsa == (int)VIndices.dropw || game.ParserVectors.prsa == (int)VIndices.putw ||
                game.ParserVectors.prsa == (int)VIndices.pushw || game.ParserVectors.prsa ==
                (int)VIndices.throww || game.ParserVectors.prsa == (int)VIndices.turnw ||
                game.ParserVectors.prsa == (int)VIndices.leapw)
            {
                goto L10;
            }
            MessageHandler.rspsub_(game, 570);
            /*                      !JOKE. */
            return(ret_val);

            /* AAPPLI, PAGE 3 */

            /* A2--	MASTER.  PROCESS MOST COMMANDS GIVEN TO MASTER. */

L2000:
            if ((game.Objects.oflag2[(int)ObjectIndices.qdoor - 1] & ObjectFlags2.OPENBT) != 0)
            {
                goto L2100;
            }
            MessageHandler.rspsub_(game, 783);
            /*                      !NO MASTER YET. */
            return(ret_val);

L2100:
            if (game.ParserVectors.prsa != (int)VIndices.walkw)
            {
                goto L2200;
            }
            /*                      !WALK? */
            i = 784;
            /*                      !ASSUME WONT. */
            if (game.Player.Here == (int)RoomIndices.scorr && (game.ParserVectors.prso == (int)XSearch.xnorth ||
                                                               game.ParserVectors.prso == (int)XSearch.xenter) || game.Player.Here == (int)RoomIndices.ncorr &&
                (game.ParserVectors.prso == (int)XSearch.xsouth || game.ParserVectors.prso ==
                 (int)XSearch.xenter))
            {
                i = 785;
            }
            MessageHandler.rspsub_(game, i);
            return(ret_val);

L2200:
            if (game.ParserVectors.prsa == (int)VIndices.takew || game.ParserVectors.prsa == (int)VIndices.dropw ||
                game.ParserVectors.prsa == (int)VIndices.putw || game.ParserVectors.prsa ==
                (int)VIndices.throww || game.ParserVectors.prsa == (int)VIndices.pushw ||
                game.ParserVectors.prsa == (int)VIndices.turnw || game.ParserVectors.prsa ==
                (int)VIndices.spinw || game.ParserVectors.prsa == (int)VIndices.trntow ||
                game.ParserVectors.prsa == (int)VIndices.follow || game.ParserVectors.prsa ==
                (int)VIndices.stayw || game.ParserVectors.prsa == (int)VIndices.openw ||
                game.ParserVectors.prsa == (int)VIndices.closew || game.ParserVectors.prsa ==
                (int)VIndices.killw)
            {
                goto L10;
            }
            MessageHandler.rspsub_(game, 786);
            /*                      !MASTER CANT DO IT. */
            return(ret_val);
        } /* aappli_ */
Exemplo n.º 11
0
        public void Play()
        {
            MessageHandler.Speak(1, this);
            bool result = RoomHandler.RoomDescription(3, this);
            bool f      = false;
            int  i      = 0;

            while (this.isRunning)
            {
L100:
                if (!this.isRunning)
                {
                    // Game is over, exit this game loop.
                    continue;
                }

                this.Player.Winner  = (int)AIndices.player;
                this.Player.TelFlag = false;

                string input = string.Empty;

                if (this.ParserVectors.prscon <= 1)
                {
                    input = Parser.ReadLine(1);
                    this.ParserVectors.prscon = 1;
                }

                ++this.State.Moves;
                this.ParserVectors.prswon = Parser.Parse(input, true, this);

                if (!this.ParserVectors.prswon)
                {
                    goto L400;
                }

                if (xvehic_(1))
                {
                    goto L400;
                }

                if (this.ParserVectors.prsa == (int)VIndices.tellw)
                {
                    //goto L2000;
                }

L300:
                if (this.ParserVectors.prso == (int)ObjectIndices.valua || this.ParserVectors.prso == (int)ObjectIndices.every)
                {
                    goto L900;
                }

                if (!Parser.vappli_(input, this.ParserVectors.prsa, this))
                {
                    goto L400;
                }

L350:
                if (!Flags.echof && this.Player.Here == (int)RoomIndices.echor)
                {
                    goto L1000;
                }

                f = RoomHandler.rappli_(this.Rooms.RoomActions[this.Player.Here - 1], this);

L400:
                xendmv_(this.Player.TelFlag);

                // !DO END OF MOVE.
                if (!RoomHandler.IsRoomLit(this.Player.Here, this))
                {
                    this.ParserVectors.prscon = 1;
                }

                goto L100;

L900:
                dverb1.valuac_(this, (int)ObjectIndices.valua);
                goto L350;
                // GAME, PAGE 3

                // SPECIAL CASE-- ECHO ROOM.
                // IF INPUT IS NOT 'ECHO' OR A DIRECTION, JUST ECHO.

L1000:
                input = Parser.ReadLine(0);

                // !CHARGE FOR MOVES.
                ++this.State.Moves;

                if (input.Equals("ECHO"))
                {
                    goto L1300;
                }

                MessageHandler.Speak(571, this);

                // !KILL THE ECHO.
                Flags.echof = true;
                this.Objects.oflag2[(int)ObjectIndices.bar - 1] &= ~ObjectFlags2.SCRDBT;
                this.ParserVectors.prswon = true;
                // !FAKE OUT PARSER.
                this.ParserVectors.prscon = 1;
                // !FORCE NEW INPUT.
                goto L400;

L1300:
                this.ParserVectors.prswon = Parser.Parse(input, false, this);
                if (!this.ParserVectors.prswon || this.ParserVectors.prsa != (int)VIndices.walkw)
                {
                    goto L1400;
                }
                if (dso3.findxt_(this, this.ParserVectors.prso, this.Player.Here))
                {
                    goto L300;
                }
                // !VALID EXIT?

L1400:
                MessageHandler.more_output(input);
                this.Player.TelFlag = true;
                // !INDICATE OUTPUT.
                goto L1000;
                // !MORE ECHO ROOM.
                // GAME, PAGE 4

                // SPECIAL CASE-- TELL <ACTOR>, NEW COMMAND
                // NOTE THAT WE CANNOT BE IN THE ECHO ROOM.

L2000:
                if ((this.Objects.oflag2[this.ParserVectors.prso - 1] & ObjectFlags2.ACTRBT) != 0)
                {
                    goto L2100;
                }

                MessageHandler.Speak(602, this);
                // !CANT DO IT.
                goto L350;
                // !VAPPLI SUCCEEDS.

L2100:
                this.Player.Winner = ObjectHandler.GetActor(this.ParserVectors.prso, this);
                // !NEW PLAYER.
                this.Player.Here = this.Adventurers.Rooms[this.Player.Winner - 1];

                // !NEW LOCATION.
                if (this.ParserVectors.prscon <= 1)
                {
                    goto L2700;
                }

                // !ANY INPUT?
                if (Parser.Parse(input, true, this))
                {
                    goto L2150;
                }

L2700:
                i = 341;
                // !FAILS.
                if (this.Player.TelFlag)
                {
                    i = 604;
                }
                // !GIVE RESPONSE.
                MessageHandler.Speak(i, this);

L2600:
                this.Player.Winner = (int)AIndices.player;
                // !RESTORE STATE.
                this.Player.Here = this.Adventurers.Rooms[this.Player.Winner - 1];
                goto L350;

L2150:
                //if (ObjectHandler.aappli_(this.Adventurers.Actions[this.Player.Winner - 1], game))
                //{
                //    goto L2400;
                //}

                // !ACTOR HANDLE?
                //if (xvehic_(1))
                //{
                //    goto L2400;
                //}

                // !VEHICLE HANDLE?
                if (this.ParserVectors.prso == (int)ObjectIndices.valua || this.ParserVectors.prso == (int)ObjectIndices.every)
                {
                    goto L2900;
                }
                if (!Parser.vappli_(input, this.ParserVectors.prsa, this))
                {
                    goto L2400;
                }
                // !VERB HANDLE?
                // L2350:
                f = RoomHandler.rappli_(this.Rooms.RoomActions[this.Player.Here - 1], this);

L2400:
                xendmv_(this.Player.TelFlag);
                // !DO END OF MOVE.
                goto L2600;
                // !DONE.

L2900:
                dverb1.valuac_(this, (int)ObjectIndices.valua);
                // !ALL OR VALUABLES.
                goto L350;
            }
        }