/// <summary> /// The main function. /// </summary> /// <param name="args"></param> private static void Main(string[] args) { try { /* Print startup message. */ Console.WriteLine("\nQuickHack Version 0.1"); Console.WriteLine("(C) Copyright 1996, 1997 by Thomas Biskup.\n"); if (args.Length > 1) return; Terminal.StandardPrintString("Setting up the game..."); /* Initialize everything. */ Terminal.StandardPrintString("."); Terminal.InitRand(); Terminal.StandardPrintString("."); var player = new Player(); var dungeon = new Dungeon(); var monsters = new Monsters(); var game = new Game(dungeon, monsters); monsters.InitMonsters(dungeon); Terminal.StandardPrintString("."); dungeon.InitDungeon(monsters, player); Terminal.StandardPrintString("."); player.InitPlayer(game); Terminal.StandardPrintString("."); InitScreen(); /* Play the game. */ game.Play(); /* Clean up. */ Terminal.CleanUpIO(); /* Be done. */ return; } catch (Exception ex) { try { Terminal.CleanUpIO(); } catch { } Console.WriteLine(ex); Console.ReadLine(); } }
/// <summary> /// Initialize the monster structures. Basically we have to notify all slots that they are empty. Also the general index map needs to be initialized. /// </summary> internal void InitMonsters(Dungeon dungeon) { _dungeon = dungeon; dungeonLevel = _dungeon.TheComplex.DungeonLevel; int i; int j; All = new MonsterCollection(); /* Initialize the monster index map as 'empty'. */ for (i = 0; i < Config.MapW; i++) for (j = 0; j < Config.MapH; j++) _midx[i, j] = 255; }
public Game(Dungeon dungeon, Monsters monsters) { _dungeon = dungeon; _d = dungeon.TheComplex; _monsters = monsters; }