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 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); }
/*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 EmergencyStatus(gamebook.Scenario SC, cwords.MPU MP, int Sec) { /* Determine current alert status, and create menu accordingly. */ int N = plotbase.NAttValue(SC.NA, plotbase.NAG_ScriptVar, 4); rpgmenus.RPGMenu RPM; switch (N) { case 1: RPM = rpgmenus.CreateRPGMenu(Crt.Color.LightRed, Crt.Color.Cyan, Crt.Color.Yellow, WDM.UCM_X + 3, WDM.UCM_Y + 3, WDM.UCM_X2 - 3, WDM.UCM_Y2 - 3); break; case 0: RPM = rpgmenus.CreateRPGMenu(Crt.Color.Yellow, Crt.Color.Cyan, Crt.Color.Yellow, WDM.UCM_X + 3, WDM.UCM_Y + 3, WDM.UCM_X2 - 3, WDM.UCM_Y2 - 3); break; default: RPM = rpgmenus.CreateRPGMenu(Crt.Color.LightGreen, Crt.Color.Cyan, Crt.Color.Yellow, WDM.UCM_X + 3, WDM.UCM_Y + 3, WDM.UCM_X2 - 3, WDM.UCM_Y2 - 3); break; } rpgmenus.AddRPGMenuItem(RPM, "Alert Status: Red", 2); rpgmenus.AddRPGMenuItem(RPM, "Alert Status: Yellow", 1); rpgmenus.AddRPGMenuItem(RPM, "Alert Status: Green", 0); N = rpgmenus.SelectMenu(RPM, rpgmenus.RPMNormal); if (N > -1 && Sec > 0) { rpgtext.DCGameMessage("Alert status changed."); plotbase.SetNAtt(ref SC.NA, plotbase.NAG_ScriptVar, 4, N - 1); /* If the alert has been turned off, set the trigger. */ if (N == 0) { gamebook.SetTrigger(SC, "GotoTURNOFFFIELD"); } /* If, on the other hand, the player set red alert... */ /* alert all robots. */ else if (N == 2) { gamebook.SetTrigger(SC, "ALARM"); } } else if (Sec == 0) { /* Lock up the terminal, then exit with an alarm. */ rpgtext.DCGameMessage("Denied! Unauthorized use of security systems is prohibited."); MP.Attr = "X" + MP.Attr; gamebook.SetTrigger(SC, "ALARM"); } }
static void AttemptHack(gamebook.Scenario SC, cwords.MPU MP, ref int Sec) { /* The player wants to hack this terminal. Give it a try, and hope */ /* there are no disasterous results... */ rpgtext.DCGameMessage("Attempting to hack " + cwords.MPUMan[MP.kind - 1].name + "..."); /* Do the animation for hacking. */ Crt.Window(WDM.MCM_X + 1, WDM.MCM_Y + 1, WDM.MCM_X2 - 1, WDM.MCM_Y2 - 1); Crt.ClrScr(); Crt.TextColor(Crt.Color.Blue); int N = rpgdice.Random(250) + 250; for (int t = 1; t <= N; ++t) { Crt.Write(rpgdice.Random(256).ToString("X2") + " "); } texfx.Delay(); N = rpgdice.Random(250) + 250; for (int t = 1; t <= N; ++t) { Crt.Write(rpgdice.Random(256).ToString("X2") + " "); } texfx.Delay(); /* Actually figure out if it worked. */ int R = rpgdice.RollStep(dcchars.PCTechSkill(SC.PC)); int T = Sec + cwords.MPUMan[MP.kind - 1].SecPass; if (R > cwords.MPUMan[MP.kind - 1].SecPass && R > T) { rpgtext.DCAppendMessage(" You did it."); Sec = R - cwords.MPUMan[MP.kind - 1].SecPass; } else { rpgtext.DCAppendMessage(" You failed."); if (R < T - 5) { MP.Attr = "X" + MP.Attr; if (R < T - 10) { gamebook.SetTrigger(SC, "ALARM"); } } } }
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 void DoUserTerminal(gamebook.Scenario SC, cwords.MPU MP, int Sec) { /* The player wants to use the user terminal. Branch to an appropriate */ /* procedure. */ /* If this terminal has locked up, it cannot be used. */ if (MP.Attr[0] == 'X') { DoCrashedTerminal(); } else { switch (MP.kind) { case 1: DoInfoKiosk(SC, MP, Sec); break; case 2: DoMedUnit(SC, MP, Sec); break; case 3: DoMorgan(SC, MP, Sec); break; case 4: DoDescartes(SC, MP, Sec); break; } } }
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); }