static void CreateInvMenu(gamebook.Scenario SC) { /*Create the inventory menu, and store it in InvRPM*/ /*Initialize the menu.*/ InvRPM = rpgmenus.CreateRPGMenu(Crt.Color.Black, Crt.Color.Green, Crt.Color.LightGreen, WDM.InvWin_X, WDM.InvWin_Y, WDM.InvWin_X2, WDM.InvWin_Y2); InvRPM.dBorColor = Crt.Color.White; InvRPM.dTexColor = DscColor; InvRPM.dx1 = WDM.DscWin_X; InvRPM.dy1 = WDM.DscWin_Y; InvRPM.dx2 = WDM.DscWin_X2; InvRPM.dy2 = WDM.DscWin_Y2; /*Add the MenuKeys.*/ rpgmenus.AddRPGMenuKey(InvRPM, BMK_SwitchKey, BMK_SwitchCode); rpgmenus.AddRPGMenuKey(InvRPM, BMK_DropKey, BMK_DropCode); /*Add a MenuItem for each object in the player's inventory.*/ dcitems.DCItem i = SC.PC.inv; int t = 1; while (i != null) { rpgmenus.AddRPGMenuItem(InvRPM, dcitems.ItemNameLong(i), t, dcitems.ItemDesc(i)); i = i.next; t += 1; } /*Sort the menu alphabetically.*/ rpgmenus.RPMSortAlpha(InvRPM); }
static dcitems.DCItem SelectItem(gamebook.Scenario SC, int IK) { /*Create a menu, then query the user for an item which*/ /*corresponds to the kind IK. Return null if either no*/ /*such items are present in the inventory, or if the user*/ /*cancels item selection.*/ //var // RPM: RPGMenuPtr; /*Our menu.*/ // i: DCItemPtr; // t: Integer; /*Create the menu. It's gonna use the InvWindow.*/ rpgmenus.RPGMenu RPM = rpgmenus.CreateRPGMenu(Crt.Color.Black, Crt.Color.Green, Crt.Color.LightGreen, WDM.InvWin_X, WDM.InvWin_Y, WDM.InvWin_X2, WDM.InvWin_Y2); RPM.dBorColor = Crt.Color.White; RPM.dTexColor = DscColor; RPM.dx1 = WDM.DscWin_X; RPM.dy1 = WDM.DscWin_Y; RPM.dx2 = WDM.DscWin_X2; RPM.dy2 = WDM.DscWin_Y2; /*Add one menu item for each appropriate item in the Inventory.*/ dcitems.DCItem i = SC.PC.inv; int t = 1; while (i != null) { if (i.ikind == IK) { rpgmenus.AddRPGMenuItem(RPM, dcitems.ItemNameLong(i), t, dcitems.ItemDesc(i)); } i = i.next; t += 1; } /*Error check- make sure there are items present in the list!!!*/ if (RPM.firstItem == null) { return(null); } /*Sort the menu alphabetically.*/ rpgmenus.RPMSortAlpha(RPM); /*Next, select the item.*/ t = rpgmenus.SelectMenu(RPM, rpgmenus.RPMNormal); if (t == -1) { i = null; } else { i = dcitems.LocateItem(SC.PC.inv, t); } /*Show the complete inventory list again.*/ rpgmenus.DisplayMenu(InvRPM); return(i); }
static void DoMedUnit(gamebook.Scenario SC, cwords.MPU MP, int Sec) { /* The medical unit is the player character's best friend. It will */ /* heal all injuries and status conditions instantly... until the */ /* player crashes it by trying to hack the medical database, that is. */ rpgmenus.RPGMenu RPM = rpgmenus.CreateRPGMenu(Crt.Color.Red, Crt.Color.Red, Crt.Color.LightRed, WDM.UCM_X + 2, WDM.UCM_Y + 2, WDM.UCM_X2 - 2, WDM.UCM_Y2 - 2); rpgmenus.AddRPGMenuItem(RPM, "Treat Injuries", 1); rpgmenus.AddRPGMenuItem(RPM, "View Records", 2); rpgmenus.AddRPGMenuItem(RPM, "Standby Mode", -1); int N; do { N = rpgmenus.SelectMenu(RPM, rpgmenus.RPMNoCleanup); switch (N) { case 1: HealAllInjuries(SC); break; case 2: TexBrowser(SC, MP, Sec, "MEDICAL RECORDS"); break; } }while (N != -1); }
static void CreateEqpMenu(gamebook.Scenario SC) { /*Create the equipment menu, and store it in EqpRPM*/ /*Initialize the menu.*/ EqpRPM = rpgmenus.CreateRPGMenu(Crt.Color.Black, Crt.Color.Green, Crt.Color.LightGreen, WDM.EqpWin_X, WDM.EqpWin_Y, WDM.EqpWin_X2, WDM.EqpWin_Y2); EqpRPM.dBorColor = Crt.Color.White; EqpRPM.dTexColor = DscColor; EqpRPM.dx1 = WDM.DscWin_X; EqpRPM.dy1 = WDM.DscWin_Y; EqpRPM.dx2 = WDM.DscWin_X2; EqpRPM.dy2 = WDM.DscWin_Y2; /*Add the MenuKeys.*/ rpgmenus.AddRPGMenuKey(EqpRPM, BMK_SwitchKey, BMK_SwitchCode); /*Add one MenuItem for each Equipment Slot.*/ for (int t = 1; t <= dcchars.NumEquipSlots; ++t) { string m = dcchars.EquipSlotName[t - 1]; if (SC.PC.eqp[t - 1] != null) { m = m + " " + dcitems.ItemNameLong(SC.PC.eqp[t - 1]); } rpgmenus.AddRPGMenuItem(EqpRPM, m, t, dcitems.ItemDesc(SC.PC.eqp[t - 1])); } }
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); }
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); }
/*When the PC accesses a computer terminal, this procedure*/ /*is the one that's called.*/ /*md stands for MajorDomo, the chief AI on DeadCold. It does not*/ /*mean "Most Dangerous".*/ public static void MDSession(gamebook.Scenario SC, texmodel.Model M) { /* A computer session has two component windows: The metacontrol */ /* window, in the lower right of the screen, and the main display */ /* window in the center. */ /* Set up the display. */ texmaps.ClearMapArea(); rpgtext.LovelyBox(Crt.Color.White, WDM.UCM_X - 1, WDM.UCM_Y - 1, WDM.UCM_X2 + 1, WDM.UCM_Y2 + 1); /* Find the computer we want. */ cwords.MPU MP = SC.Comps; while (MP != null && MP.M != M) { MP = MP.next; } if (MP == null) { return; } /* Tell the player what he's doing. */ rpgtext.DCGameMessage("Using " + cwords.MPUMan[MP.kind - 1].name + "."); /* Create MetaControl Menu */ rpgmenus.RPGMenu MCM = rpgmenus.CreateRPGMenu(Crt.Color.LightGray, Crt.Color.Blue, Crt.Color.Cyan, WDM.MCM_X, WDM.MCM_Y, WDM.MCM_X2, WDM.MCM_Y2); rpgmenus.AddRPGMenuItem(MCM, "Access Terminal", 1); rpgmenus.AddRPGMenuItem(MCM, "Hack Logon System", 2); rpgmenus.AddRPGMenuItem(MCM, "Disconnect", -1); /* Initialize Security Clearance. */ int Sec = 0; /* Start the main access loop. */ int N = -1; do { /* Start with the user terminal itself. */ rpgmenus.DisplayMenu(MCM); DoUserTerminal(SC, MP, Sec); /* Once the user terminal is exited, access metacontrol. */ do { N = rpgmenus.SelectMenu(MCM, rpgmenus.RPMNoCleanup); /* If the player wants to make a hacking attempt, do that here. */ if (N == 2) { AttemptHack(SC, MP, ref Sec); } }while (N == 2); }while (N != -1); texmaps.DisplayMap(SC.gb); }
static void TexBrowser(gamebook.Scenario SC, cwords.MPU MP, int Sec, string Cap) { /* This computer apparently has a list of text messages which the */ /* player might or might not be able to access. */ /* Prepare the display. */ ClearUCM(); int N; /* Create the menu. The items this menu will have in it are determined */ /* by the SEC score that the player achieved. */ rpgmenus.RPGMenu TBM = rpgmenus.CreateRPGMenu(Crt.Color.Black, Crt.Color.Green, Crt.Color.LightGreen, WDM.UCM_X, WDM.UCM_Y + 3, WDM.UCM_X2, WDM.UCM_Y2); string S = MP.Attr; while (S != "") { N = texutil.ExtractValue(ref S); if (N > 0 && N <= rpgtext.NumTex) { /* Only add those messages for which the player */ /* has obtained clearance. */ if (rpgtext.TexMan[N - 1].clearance <= Sec) { rpgmenus.AddRPGMenuItem(TBM, rpgtext.TexMan[N - 1].title, N); } } } rpgmenus.RPMSortAlpha(TBM); /* If the player does not have clearance to see any messages at */ /* all, show a brief message then exit this procedure. */ if (TBM.numItem < 1) { PrintCap("NO AVALIABLE MESSAGES"); rpgtext.RPGKey(); return; } do { PrintCap(Cap); N = rpgmenus.SelectMenu(TBM, rpgmenus.RPMNormal); if (N > -1) { PrintCap(rpgtext.TexMan[N - 1].title); rpgtext.GameMessage(rpgtext.TexMan[N].msg, WDM.UCM_X, WDM.UCM_Y + 3, WDM.UCM_X2, WDM.UCM_Y2, Crt.Color.Green, Crt.Color.Black); rpgtext.RPGKey(); if (!rpgtext.TexMan[N - 1].used) { rpgtext.TexMan[N - 1].used = true; gamebook.DoleExperience(SC, rpgtext.TexMan[N - 1].XPV); } } }while (N != -1); }
static void PowerAllocation(gamebook.Scenario SC) { rpgmenus.RPGMenu PAM = rpgmenus.CreateRPGMenu(Crt.Color.DarkGray, Crt.Color.Blue, Crt.Color.LightBlue, WDM.UCM_X + 2, WDM.UCM_Y + 2, WDM.UCM_X2 - 2, WDM.UCM_Y2 - 2); rpgmenus.AddRPGMenuItem(PAM, "Module \"B\" Emergency Power: Security", 0); rpgmenus.AddRPGMenuItem(PAM, "Module \"B\" Emergency Power: Cryogenics", 0); rpgmenus.AddRPGMenuItem(PAM, "Module \"B\" Emergency Power: Infratap", 0); rpgmenus.AddRPGMenuItem(PAM, "Module \"B\" Emergency power: Life Support", 1); rpgmenus.AddRPGMenuItem(PAM, "Module \"B\" Emergency Power: Network", 0); int N = rpgmenus.SelectMenu(PAM, rpgmenus.RPMNoCancel); plotbase.SetNAtt(ref SC.NA, plotbase.NAG_ScriptVar, 2, N); }
public static dcitems.DCItem PromptItem(gamebook.Scenario SC, int IK) { /*Create a menu, then query the user for an item which*/ /*corresponds to the kind IK. Return null if either no*/ /*such items are present in the inventory, or if the user*/ /*cancels item selection. Retore map display afterwards.*/ /*Create the menu. It's gonna use the InvWindow.*/ rpgmenus.RPGMenu RPM = rpgmenus.CreateRPGMenu(Crt.Color.LightGray, Crt.Color.Green, Crt.Color.LightGreen, 16, 7, 65, 21); /*Add one menu item for each appropriate item in the Inventory.*/ dcitems.DCItem i = SC.PC.inv; int t = 1; while (i != null) { if (i.ikind == IK) { rpgmenus.AddRPGMenuItem(RPM, dcitems.ItemNameLong(i), t, null); } i = i.next; t += 1; } /*Error check- make sure there are items present in the list!!!*/ if (RPM.firstItem == null) { return(null); } /*Sort the menu alphabetically.*/ rpgmenus.RPMSortAlpha(RPM); /*Next, select the item.*/ t = rpgmenus.SelectMenu(RPM, rpgmenus.RPMNormal); if (t == -1) { i = null; } else { i = dcitems.LocateItem(SC.PC.inv, t); } /*Restore the map display.*/ texmaps.DisplayMap(SC.gb); return(i); }
static void DoMapDisplay() { /* This procedure handles the map displayer. */ /* Create the menu. */ rpgmenus.RPGMenu MM = rpgmenus.CreateRPGMenu(Crt.Color.Blue, Crt.Color.Green, Crt.Color.LightGreen, WDM.UCM_X + 19, WDM.UCM_Y + 1, WDM.UCM_X2 - 1, WDM.UCM_Y2 - 1); for (int t = 1; t <= NumNamedLevels; ++t) { rpgmenus.AddRPGMenuItem(MM, LevelName[t - 1], t); } rpgmenus.AddRPGMenuItem(MM, " Exit", -1); /* Display the map itself */ ClearUCM(); Crt.Window(WDM.UCM_X, WDM.UCM_Y, WDM.UCM_X2, WDM.UCM_Y2); Crt.TextColor(Crt.Color.Green); for (int t = 1; t <= NumMapRow; ++t) { Crt.GotoXY(3, t + 2); Crt.Write(StationMap[t - 1]); } Crt.Window(1, 1, WDM.CON_WIDTH, WDM.CON_HEIGHT); /* Enter the main loop. Keep processing until an Exit is recieved. */ int N = -1; do { N = rpgmenus.SelectMenu(MM, rpgmenus.RPMNormal); if (N != -1) { Crt.GotoXY(WDM.UCM_X + LevelLoc[N - 1, 0] + 1, WDM.UCM_Y + LevelLoc[N - 1, 1] + 1); Crt.TextColor(Crt.Color.Yellow); Crt.Write(LevelName[N - 1][0]); rpgtext.GameMessage(LevelDesc[N - 1], WDM.UCM_X + 19, WDM.UCM_Y + 1, WDM.UCM_X2 - 1, WDM.UCM_Y2 - 1, Crt.Color.Green, Crt.Color.Blue); rpgtext.RPGKey(); Crt.GotoXY(WDM.UCM_X + LevelLoc[N - 1, 0] + 1, WDM.UCM_Y + LevelLoc[N - 1, 1] + 1); Crt.TextColor(Crt.Color.Green); Crt.Write(LevelName[N - 1][1]); } }while (N != -1); }
public static void RestoreGame() { /* Load a saved game file from the SAVEGAME directory. */ /* If this action is cancelled, return to the main menu. */ /* If there are no files to load, call the STARTGAME procedure. */ /* Otherwise, pass the scenario data on to PLAYSCENE. */ if (!Directory.Exists("savegame")) { /* No savegame directory, Jump to STARTGAME. */ StartGame(); } else { /* Create the menu. */ rpgmenus.RPGMenu RPM = rpgmenus.CreateRPGMenu(Crt.Color.LightBlue, Crt.Color.Green, Crt.Color.LightGreen, 20, 8, 60, 23); rpgmenus.BuildFileMenu(RPM, "savegame/*.txt"); if (RPM.numItem < 1) { /* No save game files were found. Jump to STARTGAME, */ /* after deallocating the empty menu... */ StartGame(); } else { /* Select a file, then dispose of the menu. */ rpgmenus.RPMSortAlpha(RPM); string FName = rpgmenus.SelectFile(RPM); /* If selection was cancelled, just fall back out to the */ /* main menu. Otherwise, load the file and pass the */ /* scenario to PLAYSCENE. */ if (FName != "") { gamebook.Scenario SC = gamebook.LoadGame("savegame/" + FName + ".txt"); PlayScene(SC); } } } }
static void DoMorgan(gamebook.Scenario SC, cwords.MPU MP, int Sec) { rpgmenus.RPGMenu RPM = rpgmenus.CreateRPGMenu(Crt.Color.DarkGray, Crt.Color.Magenta, Crt.Color.LightMagenta, WDM.UCM_X + 2, WDM.UCM_Y + 2, WDM.UCM_X2 - 2, WDM.UCM_Y2 - 2); rpgmenus.AddRPGMenuItem(RPM, "Power Allocation", 1); rpgmenus.AddRPGMenuItem(RPM, "Mail Core Memory", 2); rpgmenus.AddRPGMenuItem(RPM, "Log Off", -1); int N = -1; do { N = rpgmenus.SelectMenu(RPM, rpgmenus.RPMNoCleanup); switch (N) { case 1: PowerAllocation(SC); break; case 2: TexBrowser(SC, MP, Sec, "MEDICAL RECORDS"); break; } }while (N != -1); }
static void DoDescartes(gamebook.Scenario SC, cwords.MPU MP, int Sec) { /* The player is accessing primary server DESCARTES. */ rpgmenus.RPGMenu RPM = rpgmenus.CreateRPGMenu(Crt.Color.Green, Crt.Color.Cyan, Crt.Color.Yellow, WDM.UCM_X + 2, WDM.UCM_Y + 2, WDM.UCM_X2 - 2, WDM.UCM_Y2 - 2); rpgmenus.AddRPGMenuItem(RPM, "Emergency Status", 1); rpgmenus.AddRPGMenuItem(RPM, "Mail Core Memory", 2); rpgmenus.AddRPGMenuItem(RPM, "Log Off", -1); int N; do { N = rpgmenus.SelectMenu(RPM, rpgmenus.RPMNoCleanup); switch (N) { case 1: EmergencyStatus(SC, MP, Sec); break; case 2: TexBrowser(SC, MP, Sec, "MEDICAL RECORDS"); break; } }while (N != -1 && MP.Attr[0] != 'X'); }
static bool HelpScreen(gamebook.Scenario SC) { /*Just print a list of keys.*/ rpgtext.DCGameMessage("Help - Here are the implemented command keys."); rpgmenus.RPGMenu RPM = rpgmenus.CreateRPGMenu(Crt.Color.LightGray, Crt.Color.Green, Crt.Color.LightGreen, 20, 7, 40, 19); RPM.dx1 = 45; RPM.dy1 = 10; RPM.dx2 = 65; RPM.dy2 = 15; RPM.dBorColor = Crt.Color.LightGray; RPM.dTexColor = Crt.Color.LightBlue; for (int t = 1; t < rpgtext.KMap.Length; ++t) { rpgmenus.AddRPGMenuItem(RPM, rpgtext.KMap[t].key + ": " + rpgtext.KMap[t].name, t, rpgtext.KMap[t].desc); } rpgmenus.SelectMenu(RPM, rpgmenus.RPMNormal); pcaction.PCReCenter(SC); return(false); }
//{This unit contains all of the books which the player} //{can find over the course of the game.} public static void ReadBook(gamebook.Scenario SC, int N) { //{ Read book # N.} // Actually, it looks like this really isn't ready for prime time... since the Scenario and N aren't used yet. //{Set up the screen.} Crt.Window(WDM.Book_X, WDM.Book_Y, WDM.Book_X2, WDM.Book_Y2); Crt.ClrScr(); Crt.Window(1, 1, WDM.CON_WIDTH, WDM.CON_HEIGHT); //{Create the menu.} rpgmenus.RPGMenu menu = rpgmenus.CreateRPGMenu(Crt.Color.LightGray, Crt.Color.Green, Crt.Color.LightGreen, WDM.Book_X2 - 25, WDM.Book_Y + 4, WDM.Book_X2 - 5, WDM.Book_Y2 - 4); for (int i = 0; i < ThePages.Length; ++i) { rpgmenus.AddRPGMenuItem(menu, ThePages[i].name, i); } int p = -1; do { p = rpgmenus.SelectMenu(menu, rpgmenus.RPMNoCleanup); if (p != -1) { Crt.TextColor(Crt.Color.Black); Crt.TextBackground(Crt.Color.Yellow); Crt.Window(WDM.Book_X + 5, WDM.Book_Y + 1, WDM.Book_X + 32, WDM.Book_Y2 - 1); Crt.ClrScr(); Crt.Window(WDM.Book_X + 8, WDM.Book_Y + 3, WDM.Book_X + 30, WDM.Book_Y2 - 2); rpgtext.Delineate(ThePages[p].page, 21, 1); Crt.TextBackground(Crt.Color.Black); Crt.Window(1, 1, WDM.CON_WIDTH, WDM.CON_HEIGHT); } }while (p >= 0); }
static void DoInfoKiosk(gamebook.Scenario SC, cwords.MPU MP, int Sec) { /* This computer contains a list of TEX messages. If the player */ /* has the correct security clearance, let her see them. */ /* Create the menu. */ rpgmenus.RPGMenu IKM = rpgmenus.CreateRPGMenu(Crt.Color.Black, Crt.Color.Green, Crt.Color.LightGreen, WDM.UCM_X, WDM.UCM_Y2 - 4, WDM.UCM_X2, WDM.UCM_Y2); rpgmenus.AddRPGMenuItem(IKM, "Public Service Messages", 2); rpgmenus.AddRPGMenuItem(IKM, "Station Map", 1); int N; do { /* Set up the display. */ ClearUCM(); Crt.TextColor(Crt.Color.Green); for (N = 1; N <= NumLogoRows; ++N) { Crt.GotoXY((WDM.UCM_X + WDM.UCM_X2 - LogoWidth) / 2, WDM.UCM_Y + N); Crt.Write(DCLogo[N - 1]); } N = rpgmenus.SelectMenu(IKM, rpgmenus.RPMNoCleanup); switch (N) { case 1: DoMapDisplay(); break; case 2: TexBrowser(SC, MP, Sec, "STATION NEWS"); break; } }while (N != -1); /* Freeze the display, and dispose of the menu. */ rpgmenus.DisplayMenu(IKM); }
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); }
public static void PlayGame() { string saveFile = "deadcold.sav"; if (File.Exists(saveFile)) { StreamReader r = File.OpenText(saveFile); LoadLogon(r); r.Close(); } SetKeyMap(); Crt.TextColor(Crt.Color.Green); Crt.ClrScr(); rpgmenus.RPGMenu menu = rpgmenus.CreateRPGMenu(Crt.Color.White, Crt.Color.Green, Crt.Color.LightGreen, 5, 3, 60, 14); rpgmenus.BuildFileMenu(menu, "*.*"); string filename = rpgmenus.SelectFile(menu, rpgmenus.RPMNoCancel); Crt.Write("You selected the file: "); Crt.Write(filename); Crt.Write("\n"); Crt.Write("You are about to play the game.\n"); rpgmenus.RPGMenu items = rpgmenus.CreateRPGMenu(Crt.Color.Blue, Crt.Color.Red, Crt.Color.White, 15, 12, 40, 20); rpgmenus.AddRPGMenuItem(items, "World", 5); rpgmenus.AddRPGMenuItem(items, "Hello", 3); rpgmenus.AddRPGMenuItem(items, "Dingus", 2); rpgmenus.AddRPGMenuItem(items, "Cake", 1); rpgmenus.AddRPGMenuItem(items, "ZooFlower", 4); rpgmenus.AddRPGMenuKey(items, 'd', 3); rpgmenus.AddRPGMenuKey(items, 'w', 5); rpgmenus.RPMSortAlpha(items); int value = rpgmenus.SelectMenu(items, rpgmenus.RPMNormal); Crt.Write("You selected the value: "); Crt.Write(value.ToString()); Crt.Write("\n"); bool done = false; while (!done) { Crt.TextColor(Crt.Color.White); Crt.Write("Would you like to quit?\n(Y/N):"); if (YesNo()) { done = true; Crt.TextColor(Crt.Color.Red); Crt.Write("\nOkay... the game is over."); } else { GameMessage("nOh, goody, you've deaalsdjflaskdjfdecided to keep playing the game... That is very good news, we should play and play and play..", 5, 5, 24, 12, Crt.Color.LightGreen, Crt.Color.Blue); RPGKey(); Crt.ClrScr(); GamePause(); Crt.TextColor(Crt.Color.LightGreen); Crt.Write("This is a very long line that is meant to wrap at least once... blah blhal blabhlhaslkdfasdfjalskdfjlakdjf\n\n"); char c; do { c = RPGKey(); Crt.Write(c.ToString()); }while (c != '!'); } } StreamWriter f = File.CreateText(saveFile); SaveLogon(f); f.Close(); }