Exemple #1
0
    static int ChooseSpell(gamebook.Scenario SC)
    {
        //{Create a menu from the PC's spell list. Query for a spell.}
        //{Return whatever spell was chosen, or -1 for Cancel.}

        string instr = "[SPACE] to cast, [/] to quickmark";
        int    QMval = -10;

        rpgtext.DCPointMessage(" which spell?");

        int it = QMval;

        do
        {
            //{Display instructions}
            rpgtext.GameMessage(instr, MX1, DY2, MX2, DY2 + 2, IColor, BColor);

            //{Create the menu.}
            rpgmenus.RPGMenu RPM = rpgmenus.CreateRPGMenu(BColor, SColor, IColor, MX1, MY1, MX2, MY2);
            RPM.dx1 = MX1;
            RPM.dy1 = DY1;
            RPM.dx2 = MX2;
            RPM.dy2 = DY2;

            rpgmenus.AddRPGMenuKey(RPM, '/', QMval);
            spells.SpellMem S = SC.PC.spell;
            while (S != null)
            {
                if (S.mnem == ' ')
                {
                    rpgmenus.AddRPGMenuItem(RPM, spells.SpellMan[S.code - 1].name, S.code, spells.SpellMan[S.code - 1].Desc);
                }
                else
                {
                    rpgmenus.AddRPGMenuItem(RPM, spells.SpellMan[S.code - 1].name + " [" + S.mnem + "]", S.code, spells.SpellMan[S.code - 1].Desc);
                    rpgmenus.AddRPGMenuKey(RPM, S.mnem, S.code);
                }

                S = S.next;
            }

            rpgmenus.RPMSortAlpha(RPM);

            //{Make a menu selection.}
            it = rpgmenus.SelectMenu(RPM, rpgmenus.RPMNoCleanup);

            //{Check to see if the PC wants to QuickMark a spell.}
            if (it == QMval)
            {
                SetQuickLink(SC, rpgmenus.RPMLocateByPosition(RPM, RPM.selectItem).value);
            }
        }while (it == QMval);

        //{Redisplay the map.}
        texmaps.DisplayMap(SC.gb);
        rpgtext.DCPointMessage(" ");

        return(it);
    }
Exemple #2
0
    static void SetQuickLink(gamebook.Scenario SC, int SCode)
    {
        //{Assign a letter to one of the PC's spells, for quick}
        //{casting later.}

        string instr = "Select a letter to represent this spell.";
        string qmerr = "Invalid character.";

        //var
        // S: SpellMemPtr;
        // C: Char;

        //{Display instructions}
        rpgtext.GameMessage(instr, MX1, MY2, MX2, MY2 + 2, IColor, BColor);

        char C  = rpgtext.RPGKey();
        char uC = char.ToUpper(C);

        if (uC >= 'A' && uC <= 'Z')
        {
            //{Make sure no other spellmem has this key linked.}
            spells.SpellMem S = SC.PC.spell;
            while (S != null)
            {
                if (S.mnem == C)
                {
                    S.mnem = ' ';
                }

                S = S.next;
            }

            S = spells.LocateSpellMem(SC.PC.spell, SCode);
            if (S != null)
            {
                S.mnem = C;
            }
        }
        else
        {
            rpgtext.GameMessage(qmerr, MX1, MY2, MX2, MY2 + 2, IColor, BColor);
            rpgtext.RPGKey();
        }
    }