public static void LovelyBox(Crt.Color edgeColor, int x1, int y1, int x2, int y2) { Crt.AutoScrollOff(); //{ Draw a lovely box!} Crt.TextColor(edgeColor); //{ Print the four corners.} Crt.GotoXY(x1, y1); Crt.Write((char)218); Crt.GotoXY(x2, y1); Crt.Write((char)191); Crt.GotoXY(x1, y2); Crt.Write((char)192); Crt.GotoXY(x2, y2); Crt.Write((char)217); //{ Print the two horizontal edges.} for (int x = x1 + 1; x < x2; ++x) { Crt.GotoXY(x, y1); Crt.Write((char)196); Crt.GotoXY(x, y2); Crt.Write((char)196); } //{ Print the two vertical edges.} for (int y = y1 + 1; y < y2; ++y) { Crt.GotoXY(x1, y); Crt.Write((char)179); Crt.GotoXY(x2, y); Crt.Write((char)179); } }
public static void GameMessage(string msg, int x1, int y1, int x2, int y2, Crt.Color textColor, Crt.Color edgeColor) { //{ Take a text string, MSG, and prettyprint } //{ it within the box defined by X1,Y1 - X2,Y2. } //{ Set the background color to black.} Crt.TextBackground(Crt.Color.Black); //{ Print the border} if (edgeColor != Crt.Color.Black) { LovelyBox(edgeColor, x1, y1, x2, y2); } //{ Set the window to the desired print area, and clear everything.} Crt.Window(x1 + 1, y1 + 1, x2 - 1, y2 - 1); Crt.ClrScr(); //{ call the Delineate procedure to prettyprint it.} Crt.TextColor(textColor); Delineate(msg, x2 - x1 - 1, 1); //{ restore the window to its original, full dimensions.} Crt.Window(1, 1, WDM.CON_WIDTH, WDM.CON_HEIGHT); }
public CloudDesc(string name, Crt.Color color, int Obscurement, bool pass) { this.name = name; this.color = color; this.Obscurement = Obscurement; this.pass = pass; }
public CDesc(string name, string CT, string IntroText, char Gfx, Crt.Color Color, int MaxHP, int Armor, int DefStep, int Mystic, int AIType, int Sense, int Speed, int HitRoll, int Damage, int Range, string AtAt, string ADesc, int TType, int TDrop, int TNum, int EType, int EChance, int XPV) { this.name = name; this.CT = CT; this.IntroText = IntroText; this.Gfx = Gfx; this.Color = Color; this.MaxHP = MaxHP; this.Armor = Armor; this.DefStep = DefStep; this.Mystic = Mystic; this.AIType = AIType; this.Sense = Sense; this.Speed = Speed; this.HitRoll = HitRoll; this.Damage = Damage; this.Range = Range; this.AtAt = AtAt; this.ADesc = ADesc; this.TType = TType; this.TDrop = TDrop; this.TNum = TNum; this.EType = EType; this.EChance = EChance; this.XPV = XPV; }
public RPGMenu(Crt.Color borderColor, Crt.Color itemColor, Crt.Color selColor, int x1, int y1, int x2, int y2) { this.active = false; this.borderColor = borderColor; this.itemColor = itemColor; this.selColor = selColor; this.x1 = x1; this.y1 = y1; this.x2 = x2; this.y2 = y2; this.dBorColor = borderColor; this.dTexColor = itemColor; this.dx1 = 0; //{ A X1 value of 0 means there is no desc window.} this.dy1 = 0; this.dx2 = 0; this.dy2 = 0; //{ TopItem refers to the highest item on the screen display.} this.topItem = 1; //{ SelectItem refers to the item currently being pointed at by the selector.} this.selectItem = 1; //{ NumItem refers to the total number of items currently in the linked list.} this.numItem = 0; }
public static Critter AddCritter(ref Critter CList, texmaps.GameBoard gb, int c, int x, int y) { //{Add a new creature, of type CRIT, to the critter list.} //{Allocate a model for the critter, and place it on the map at position} //{X,Y.} //{Allocate memory for IT} Critter it = new Critter(); //{Initialize all of ITs fields} it.crit = c; it.next = null; it.AIType = MonMan[c - 1].AIType; it.Target = null; it.Spotted = false; it.Eqp = null; it.SF = null; //{Calculate a HitPoint value for the monster. This should be} //{within +-20% of the normal maximum.} it.HP = MonMan[c - 1].MaxHP * (100 + rpgdice.RollStep(7) - rpgdice.Random(20)) / 100; if (it.HP < 1) { it.HP = 1; } //{Generate a model for IT} Crt.Color C2 = Crt.Color.Yellow; if (MonMan[c - 1].Color == Crt.Color.Yellow) { C2 = Crt.Color.White; } it.M = texmaps.GAddModel(gb, MonMan[c - 1].Gfx, MonMan[c - 1].Color, C2, false, x, y, MKIND_Critter); //{If adding a model failed, we're in real trouble. Get rid} //{of the critter altogether.} if (it.M == null) { return(null); } //{Locate a good position to attach IT to.} if (CList == null) { //{the list is currently empty. Attach it as the first model.} CList = it; } else { //{The list has stuff in it. Attach IT to the end.} LastCritter(CList).next = it; } //{Return the address of the new critter, just in case} //{the calling procedure wants to mess around with it.} return(it); }
public static RPGMenu CreateRPGMenu(Crt.Color bColor, Crt.Color iColor, Crt.Color sColor, int x1, int y1, int x2, int y2) { //{ This function creates a new RPGMenu record, and returns the address.} //{Allocate memory for it.} //{Initialize the elements of the record.} RPGMenu menu = new RPGMenu(bColor, iColor, sColor, x1, y1, x2, y2); return(menu); }
static void Stroke(texmaps.GameBoard gb, int X, int Y, Crt.Color C) { texmaps.MapSplat(gb, '|', C, X, Y, false); DelayDiv(2); texmaps.MapSplat(gb, '/', C, X, Y, false); DelayDiv(2); texmaps.MapSplat(gb, '-', C, X, Y, false); DelayDiv(2); texmaps.MapSplat(gb, '/', C, X, Y, false); DelayDiv(2); }
public Model(char gfx, Crt.Color color, Crt.Color bColor, bool coHab, int x, int y, int kind) { this.gfx = gfx; this.color = color; this.aColor = color; this.bColor = bColor; this.obs = 0; //{ Default obscurement} this.coHab = coHab; this.x = x; this.y = y; this.kind = kind; this.next = null; }
public static void SetOverImage(GameBoard gb, int x, int y, char gfx, Crt.Color color) { //{Add an image to the map. Display it if it's currently} //{visible.} if (OnTheMap(x, y)) { gb.itm[x - 1, y - 1].gfx = gfx; gb.itm[x - 1, y - 1].color = color; if (TileLOS(gb.POV, x, y)) { DisplayTile(gb, x, y); } } }
public static texmodel.Model GAddModel(GameBoard gb, char gfx, Crt.Color ac, Crt.Color bc, bool coHab, int x, int y, int kind) { //{Add a model to the game board and update the graphics.} //{That's what the 'G' stands for.} //{Actually add the model to the list. This is the easy part.} texmodel.Model it = texmodel.AddModel(ref gb.mlist, gb.mog, gfx, ac, bc, coHab, x, y, kind); //{Update the display, if within LoS.} if (TileLOS(gb.POV, x, y)) { DisplayTile(gb, x, y); } //{Return a pointer to the model we've added.} return(it); }
public static Model AddModel(ref Model mp, ModelGrid mg, char gfx, Crt.Color color, Crt.Color bColor, bool coHab, int x, int y, int kind) { //{ Add a model to the model list.} //{ Allocate memory for IT} //{ Initialize all of ITs fields} Model it = new Model(gfx, color, bColor, coHab, x, y, kind); //{ Do a range check on X and Y to make sure they lie inside the playfield.} if (x < 1) { x = 1; } else if (x > XMax) { x = XMax; } if (y < 1) { y = 1; } else if (y > YMax) { y = YMax; } //{Modify the model grid to show that the spot is occupied.} mg.Set(x, y, true); //{Locate a good position to attach it to.} if (mp == null) { //{the list is currently empty. Attach it as the first model.} mp = it; } else { //{The list has stuff in it. Attach IT to the end.} LastModel(mp).next = it; } return(it); }
Color CrtColorToColor(Crt.Color c) { switch (c) { case Crt.Color.Cyan: return(colors[0]); case Crt.Color.Black: return(colors[1]); case Crt.Color.Blue: return(colors[2]); case Crt.Color.Brown: return(colors[3]); case Crt.Color.DarkGray: return(colors[4]); case Crt.Color.Green: return(colors[5]); case Crt.Color.LightBlue: return(colors[6]); case Crt.Color.LightCyan: return(colors[7]); case Crt.Color.LightGray: return(colors[8]); case Crt.Color.LightGreen: return(colors[9]); case Crt.Color.LightMagenta: return(colors[10]); case Crt.Color.LightRed: return(colors[11]); case Crt.Color.NearBlack: return(colors[12]); case Crt.Color.Magenta: return(colors[13]); case Crt.Color.Red: return(colors[14]); case Crt.Color.White: return(colors[15]); case Crt.Color.Yellow: return(colors[16]); } return(Color.black); }
public static void MapSplat(GameBoard gb, char gfx, Crt.Color color, int x, int y, bool noLOS) { //{Display a spurious character at location X,Y. Useful for shots,} //{explosions, and other stuff.} //{Set NoLOS to TRUE if you want the image printed regardless} //{of whether the PC can see it or not.} //{Check to make sure the location lies within map bounds.} if (OnTheMap(x, y)) { //{Check to make sure that the location is visible.} if ((noLOS || TileLOS(gb.POV, x, y)) && OnTheScreen(gb, x, y)) { //{Go to the appropriate screen coordinates.} Crt.GotoXY(ScreenX(gb, x), ScreenY(gb, y)); Crt.TextColor(color); Crt.TextBackground(Crt.Color.Black); Crt.Write(gfx); } } }
public SpellDesc(string name, string cdesc, int eff, int step, int p1, int p2, int cost, Crt.Color c, string ATT, string Desc) { this.name = name; this.cdesc = cdesc; this.eff = eff; this.step = step; this.p1 = p1; this.p2 = p2; this.cost = cost; this.c = c; this.ATT = ATT; this.Desc = Desc; }
public static void DisplayShot(texmaps.GameBoard gb, int X1, int Y1, int X2, int Y2, Crt.Color c, bool hit) { //{A projectlie attack has just been launched. Display its} //{trajectory in glorious ASCII graphics.} //{At the terminus of the shot, display a * if the attack} //{hit and a - if it didn't. This info is contained in the} //{parameter named HIT, of course.} //{Calculate Length.} int L; if (Math.Abs(X2 - X1) > Math.Abs(Y2 - Y1)) { L = Math.Abs(X2 - X1); } else { L = Math.Abs(Y2 - Y1); } int t; texmaps.Point P; if (L > 1) { for (t = 1; t <= L - 1; ++t) { P = texmaps.SolveLine(X1, Y1, X2, Y2, t); //{Display bullet...} texmaps.MapSplat(gb, '+', c, P.x, P.y, false); //{Wait a bit...} Delay(); //{Restore the display.} texmaps.DisplayTile(gb, P.x, P.y); } } //{Display the terminus.} if (hit) { texmaps.MapSplat(gb, '*', c, X2, Y2, false); } else { texmaps.MapSplat(gb, '-', c, X2, Y2, false); } //{Wait a bit...} Delay(); Delay(); Delay(); texmaps.DisplayTile(gb, X2, Y2); }
public MPUDesc(string name, Crt.Color color, int SecPass) { this.name = name; this.color = color; this.SecPass = SecPass; }
//{This unit holds the character generator. That's it.} //{Originally, I had that procedure placed in dcchars,} //{but it was pretty big, so I decided to make a spinoff} //{unit just for it.} public static void SelectPCSpells(dcchars.DCChar PC) { //{The PC has just gone up a level. Choose some spells from} //{the appropriate list. const string msg = "You can learn new psi powers"; const Crt.Color BColor = Crt.Color.LightGray; const Crt.Color IColor = Crt.Color.LightMagenta; const Crt.Color SColor = Crt.Color.Magenta; const int MX1 = 16; const int MY1 = 6; const int MX2 = 65; const int MY2 = 18; const int DY1 = 18; const int DY2 = 22; rpgmenus.RPGMenu RPM; //{Set up the screen.} rpgtext.GameMessage(msg, MX1, MY1 - 2, MX2, MY1, SColor, BColor); //{Determine the PC's spell college. If none, pick one at} //{random, just for the hey of it.} int CoP = dcchars.JobSchool[PC.job - 1]; if (CoP == 0) { CoP = rpgdice.Random(1, spells.NumSchool + 1); } //{Keep selecting spells for as long as the PC needs to.} while (PC.skill[dcchars.SKILL_LearnSpell] > 0) { //{Create the spell menu.} RPM = rpgmenus.CreateRPGMenu(BColor, SColor, IColor, MX1, MY1, MX2, MY2); RPM.dx1 = MX1; RPM.dy1 = DY1; RPM.dx2 = MX2; RPM.dy2 = DY2; //{Add an item for each unlearned spell in the PC's} //{school. First, loop through all the spells up to} //{the PC's competency, which is (lvl + 1) div 2.} int Max = (PC.lvl + 1) / 2; if (Max > spells.NumLevel) { Max = spells.NumLevel; } for (int l = 1; l <= Max; ++l) { for (int t = 1; t <= 5; ++t) { //{Does the PC already know this spell?} if (spells.SpellCollege[CoP - 1, l - 1, t - 1] != 0 && spells.LocateSpellMem(PC.spell, spells.SpellCollege[CoP - 1, l - 1, t - 1]) == null) { //{Add a menu item for this spell.} rpgmenus.AddRPGMenuItem(RPM, spells.SpellMan[spells.SpellCollege[CoP - 1, l - 1, t - 1] - 1].name, spells.SpellCollege[CoP - 1, l - 1, t - 1], spells.SpellMan[spells.SpellCollege[CoP - 1, l - 1, t - 1] - 1].Desc); } } } //{If the menu is empty, leave immediately.} if (RPM.numItem == 0) { return; } //{Sort the menu.} rpgmenus.RPMSortAlpha(RPM); //{Select a spell from the menu. No canceling allowed!} int S = rpgmenus.SelectMenu(RPM, rpgmenus.RPMNoCancel); //{Add the selected spell to the PC's list.} spells.AddSpellMem(ref PC.spell, S); //{Decrement the PC's LearnSpell number.} PC.skill[dcchars.SKILL_LearnSpell] -= 1; } }