Beispiel #1
0
    public static void RunGame()
    {
        rpgtext.SetKeyMap();

        rpgmenus.RPGMenu menu = rpgmenus.CreateRPGMenu(Crt.Color.LightBlue, Crt.Color.Green, Crt.Color.LightGreen, 20, 8, 60, 23);
        rpgmenus.AddRPGMenuItem(menu, "Start New Game", 1);
        rpgmenus.AddRPGMenuItem(menu, "Load Saved Game", 2);
        rpgmenus.AddRPGMenuItem(menu, "Quit DeadCold", -1);

        int N = 0;

        do
        {
            //{ Set up the screen display. }
            Crt.ClrScr();
            Crt.CursorOff();

            //{ Get a selection from the menu. }
            N = rpgmenus.SelectMenu(menu, rpgmenus.RPMNoCancel);

            switch (N)
            {
            case 1:
                dcplay.StartGame();
                break;

            case 2:
                dcplay.RestoreGame();
                break;
            }
        }while (N > 0);
    }
Beispiel #2
0
    public static dcchars.DCChar RollNewChar()
    {
        //{We're going to generate a new game character from scratch.}
        //{Return NIL if the character creation process was cancelled.}
        const string instructions = "Select one of the avaliable jobs from the menu. Press ESC to reroll stats, or select Cancel to exit.";
        //var
        // pc: dccharptr;
        // opt: rpgmenuptr;	{The menu holding avaliable jobs.}
        // t,tt: Integer;		{Loop counters}
        // q: boolean;		{Apparently, for this procedure, I've forgotten about useful variable names. It's hot and I'm tired.}
        // I: DCItemPtr;

        int t, tt;

        //{Allocate memory for the character.}
        dcchars.DCChar PC = new dcchars.DCChar();

        //{Initilize Job to -1}
        PC.job = -1;

        //{Clear the screen}
        Crt.ClrScr();

        //{Display the stat names}
        Crt.TextColor(Crt.Color.Cyan);
        for (t = 1; t <= 8; ++t)
        {
            Crt.GotoXY(12, t * 2 + 3);
            Crt.Write(dcchars.StatName[t - 1] + " :");
        }

        //{Start a loop. We'll stay in the loop until a character is selected.}
        while (PC.job == -1)
        {
            //{Give a short message on how to use the character generator}
            rpgtext.GameMessage(instructions, 2, 1, 79, 4, Crt.Color.Green, Crt.Color.LightBlue);

            //{Set the text color}
            Crt.TextColor(Crt.Color.White);

            //{Roll the character's stats.}
            RollGHStats(PC, 100 + rpgdice.Random(20));
            for (t = 1; t <= 8; ++t)
            {
                //{display the stat onscreen.}
                Crt.GotoXY(35, t * 2 + 3);
                Crt.Write("   ");
                Crt.GotoXY(35, t * 2 + 3);
                Crt.Write(PC.stat[t - 1].ToString());
            }

            //{determine which jobs are open to this character, and}
            //{add them to our RPGMenu.}

            //{First, allocate the menu.}
            rpgmenus.RPGMenu opt = rpgmenus.CreateRPGMenu(Crt.Color.LightBlue, Crt.Color.Blue, Crt.Color.LightCyan, 46, 7, 65, 17);

            //{Initialize the description elements.}
            opt.dx1       = 2;
            opt.dx2       = 79;
            opt.dy1       = 20;
            opt.dy2       = 24;
            opt.dTexColor = Crt.Color.Green;

            for (t = 1; t <= dcchars.NumJobs; ++t)
            {
                //{Initialize q to true}
                bool q = true;

                //{Check each stat}
                for (tt = 1; tt <= 8; ++tt)
                {
                    if (PC.stat[tt - 1] < dcchars.JobStat[t - 1, tt - 1])
                    {
                        q = false;
                    }
                }

                //{If q is still true, this job may be chosen.}
                if (q)
                {
                    rpgmenus.AddRPGMenuItem(opt, dcchars.JobName[t - 1], t, dcchars.JobDesc[t - 1]);
                }
            }

            //{Get the jobs in alphabetical order}
            rpgmenus.RPMSortAlpha(opt);

            //{Add a CANCEL to the list}
            rpgmenus.AddRPGMenuItem(opt, "  Cancel", 0, null);

            //{Ask for a selection}
            PC.job = rpgmenus.SelectMenu(opt, rpgmenus.RPMNoCleanup);

            PC.m = null;
        }

        //{If the player selected cancel, dispose of the PC record.}
        if (PC.job == 0)
        {
            PC = null;
        }
        else
        {
            //{Copy skill ranks}
            for (t = 1; t <= dcchars.NumSkill; t++)
            {
                PC.skill[t - 1] = dcchars.JobSkill[PC.job - 1, t - 1];
            }

            //{Set HP, HPMax, and other initial values.}
            PC.HPMax    = PC.stat[dcchars.STAT_Toughness] + dcchars.JobHitDie[PC.job - 1] + dcchars.BaseHP;
            PC.HP       = PC.HPMax;
            PC.MPMax    = PC.stat[dcchars.STAT_Willpower] / 2 + dcchars.JobMojoDie[PC.job - 1] + rpgdice.Random(dcchars.JobMojoDie[PC.job - 1]);
            PC.MP       = PC.MPMax;
            PC.target   = null;
            PC.carbs    = 50;
            PC.lvl      = 1;
            PC.XP       = 0;
            PC.repCount = 0;

            PC.inv = null;
            for (t = 1; t <= dcchars.NumEquipSlots; ++t)
            {
                PC.eqp[t - 1] = null;
            }
            PC.SF    = null;
            PC.spell = null;

            //{Give some basic equipment.}
            DoleEquipment(PC);

            //{Add the PC's meals.}
            for (t = 1; t <= 5; ++t)
            {
                dcitems.DCItem I = new dcitems.DCItem();
                I.ikind  = dcitems.IKIND_Food;
                I.icode  = JobXFood[PC.job, rpgdice.Random(10)];
                I.charge = 1;
                dcitems.MergeDCItem(ref PC.inv, I);
            }

            //{Add the PC's snacks.}
            int total = rpgdice.Random(5) + 1;
            for (t = 1; t <= total; ++t)
            {
                dcitems.DCItem I = new dcitems.DCItem();
                I.ikind = dcitems.IKIND_Food;

                //{Decide upon what kind of food to give, based on job.}
                if (rpgdice.Random(3) == 2)
                {
                    I.icode = JobXFood[0, rpgdice.Random(10)];
                }
                else
                {
                    I.icode = JobXFood[PC.job, rpgdice.Random(10)];
                }

                I.charge = rpgdice.Random(3) + 1;
                dcitems.MergeDCItem(ref PC.inv, I);
            }

            //{ Input a name. }
            rpgtext.GameMessage("NAME: ", 2, 1, 79, 4, Crt.Color.LightGreen, Crt.Color.LightBlue);
            Crt.GotoXY(9, 2);
            Crt.CursorOn();
            PC.name = rpgtext.ReadLine();
            Crt.CursorOff();

            if (PC.name != "")
            {
                //{ Generate an introduction. }
                IntroStory(PC);

                //{Add spells, if appropriate.}
                if (PC.skill[dcchars.SKILL_LearnSpell] > 0)
                {
                    SelectPCSpells(PC);
                }
            }
            else
            {
                PC = null;
            }
        }

        return(PC);
    }