Ejemplo n.º 1
0
    static void ZonkCritter(Critter C, texmaps.GameBoard gb)
    {
        //{Delete the critter record at C, along with its associated model.}

        //{Get rid of the model}
        texmaps.GRemoveModel(C.M, gb);
    }
Ejemplo n.º 2
0
 public static void LaserCut(texmaps.GameBoard gb, int X, int Y)
 {
     //{Do the laser cut animation at location X,Y.}
     Stroke(gb, X, Y, Crt.Color.LightGreen);
     Stroke(gb, X, Y, Crt.Color.Yellow);
     Stroke(gb, X, Y, Crt.Color.White);
     texmaps.DisplayTile(gb, X, Y);
 }
Ejemplo n.º 3
0
    static texmodel.Model NextVisibleModel(texmaps.GameBoard gb, texmodel.Model M)
    {
        //{Locate the next visible model in the models list. If}
        //{the end of the list is encountered, start looking again}
        //{at the beginning. If no visible models are found,}
        //{return Nil.}

        //{ERROR CHECK- exit immediately if there are no models present.}
        if (gb.mlist == null)
        {
            return(null);
        }

        texmodel.Model M2 = null;
        texmodel.Model M1 = M;
        if (M == null)
        {
            M = gb.mlist;
        }

        bool GetOutOfLoopFree = false;

        do
        {
            if (M1 != null)
            {
                //{Move to the next model in the list.}
                M = M.next;
                if (M == null)
                {
                    M = gb.mlist;
                }
            }

            if (texmaps.TileLOS(gb.POV, M.x, M.y) && M != gb.POV.m && texmaps.OnTheScreen(gb, M.x, M.y) && M.kind == critters.MKIND_Critter)
            {
                M2 = M;
            }

            if (M1 == null)
            {
                M = M.next;
                if (M == null)
                {
                    GetOutOfLoopFree = true;
                }
            }
            else
            {
                if (M == M1)
                {
                    GetOutOfLoopFree = true;
                }
            }
        }while (M2 == null && !GetOutOfLoopFree);

        return(M2);
    }
Ejemplo n.º 4
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);
    }
Ejemplo n.º 5
0
    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);
    }
Ejemplo n.º 6
0
 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);
 }
Ejemplo n.º 7
0
 public static void CleanCloud(texmaps.GameBoard gb, ref Cloud LList)
 {
     //{Dispose of the list, freeing all associated system resources.}
     //{The models associated with each cloud will also be removed.}
     while (LList != null)
     {
         Cloud LTemp = LList.next;
         texmodel.RemoveModel(LList.M, ref gb.mlist, gb.mog);
         LList = LTemp;
     }
 }
Ejemplo n.º 8
0
 static void MoveMapCursor(texmaps.GameBoard gb, int D, ref texmaps.Point p)
 {
     //{Move the map cursor point. This can be used for the Select}
     //{Target routine, or for the PCLook routine. In any case,}
     //{the big point is to make sure that the point doesn't go off}
     //{the screen.}
     if (texmaps.OnTheScreen(gb, p.x + texmaps.VecDir[D - 1, 0], p.y + texmaps.VecDir[D - 1, 1]))
     {
         p.x += texmaps.VecDir[D - 1, 0];
         p.y += texmaps.VecDir[D - 1, 1];
     }
 }
Ejemplo n.º 9
0
    public static void PikaPikaOuch(texmaps.GameBoard gb, int X, int Y)
    {
        //{Do an electrocution effect at the desired point.}
        for (int t = 1; t <= 5; ++t)
        {
            texmaps.MapSplat(gb, 'X', PikaColor[rpgdice.Random(5)], X, Y, false);
            DelayDiv(2);
            texmaps.MapSplat(gb, '%', PikaColor[rpgdice.Random(5)], X, Y, false);
            DelayDiv(2);
        }

        texmaps.DisplayTile(gb, X, Y);
    }
Ejemplo n.º 10
0
    public static void RemoveMPU(ref MPU LList, MPU LMember, texmaps.GameBoard gb)
    {
        //{Locate and extract member LMember from list LList.}
        //{Then, dispose of LMember.}

        //{Initialize A and B}
        MPU B = LList;
        MPU A = null;

        //{Locate LMember in the list. A will thereafter be either null,}
        //{if LMember if first in the list, or it will be equal to the}
        //{element directly preceding LMember.}
        while (B != LMember && B != null)
        {
            A = B;
            B = B.next;
        }

        if (B == null)
        {
            //{Major FUBAR. The member we were trying to remove can't}
            //{be found in the list.}
            Crt.Write("ERROR- RemoveMPU asked to remove a link that doesnt exist.\n");
            do
            {
                rpgtext.RPGKey();
            } while (true);
        }
        else if (A == null)
        {
            //{There's no element before the one we want to remove,}
            //{i.e. it's the first one in the list.}
            LList = B.next;

            //{Get rid of the model.}
            texmaps.GRemoveModel(B.M, gb);

            B = null;
        }
        else
        {
            //{We found the attribute we want to delete and have another}
            //{one standing before it in line. Go to work.}
            A.next = B.next;

            //{Get rid of the model.}
            texmaps.GRemoveModel(B.M, gb);

            B = null;
        }
    }
Ejemplo n.º 11
0
    public static void DakkaDakka(texmaps.GameBoard gb, int X, int Y)
    {
        //{Do a machinegun type animation at the desired spot.}

        for (int t = 1; t <= 5; ++t)
        {
            texmaps.MapSplat(gb, '+', Crt.Color.Yellow, X, Y, false);
            DelayDiv(2);
            texmaps.MapSplat(gb, 'x', Crt.Color.Yellow, X, Y, false);
            DelayDiv(2);
        }

        texmaps.DisplayTile(gb, X, Y);
    }
Ejemplo n.º 12
0
    public static Critter ReadCritterList(StreamReader f, texmaps.GameBoard gb, int SFV)
    {
        //{Load a bunch of critters from file F and stick them onto}
        //{the Game Board. Return a pointer to the new list.}
        Critter CList = null;

        //{Get rid of the info line.}
        f.ReadLine();

        int N = -1;

        do
        {
            N = int.Parse(f.ReadLine());

            if (N != -1)
            {
                int X = int.Parse(f.ReadLine());
                int Y = int.Parse(f.ReadLine());

                //{Allocate memory for the critter now.}
                Critter C = AddCritter(ref CList, gb, N, X, Y);

                C.HP     = int.Parse(f.ReadLine());
                C.AIType = int.Parse(f.ReadLine());

                C.Eqp = dcitems.ReadItemList(f);

                C.SF = plotbase.ReadNAtt(f);

                //{Determine whether or not the critter has been spotted.}
                C.Spotted = f.ReadLine() == "T";

                C.TX = int.Parse(f.ReadLine());
                C.TY = int.Parse(f.ReadLine());
            }
        }while (N != -1);

        //{Assign all the correct targets for all our critters.}
        Critter Cit = CList;

        while (Cit != null)
        {
            Cit.Target = texmodel.FindModelXY(gb.mlist, Cit.TX, Cit.TY);
            Cit        = Cit.next;
        }

        return(CList);
    }
Ejemplo n.º 13
0
    public static MPU AddMPU(ref MPU CList, texmaps.GameBoard gb, int C, int X, int Y)
    {
        //{Add a MPU to the map at location X,Y.}
        //{Allocate memory for IT.}
        MPU it = new MPU();

        //{Attach IT to the list.}
        it.next = CList;
        CList   = it;

        it.kind = C;
        it.M    = texmaps.GAddModel(gb, MPUGFX, MPUMan[C - 1].color, Crt.Color.White, false, X, Y, MKIND_MPU);

        return(it);
    }
Ejemplo n.º 14
0
    public static Cloud AddCloud(ref Cloud CList, texmaps.GameBoard gb, int C, int X, int Y, int D)
    {
        //{Add a cloud to the map at location X,Y.}

        //{Allocate memory for IT.}
        Cloud it = new Cloud();

        //{Attach IT to the list.}
        it.next = CList;
        CList   = it;

        it.Kind     = C;
        it.Duration = D;
        it.M        = texmaps.GAddModel(gb, CloudGFX, CloudMan[C - 1].color, Crt.Color.White, CloudMan[C - 1].pass, X, Y, MKIND_Cloud);

        //{Set the obscurement for this model.}
        it.M.obs = CloudMan[C - 1].Obscurement;

        return(it);
    }
Ejemplo n.º 15
0
    public static void ModelFlash(texmaps.GameBoard gb, texmodel.Model M)
    {
        //{Flash the POV model, then flash the indicated model.}
        int t;
        for (t = 1; t <= 3; ++t)
        {
            IndicateModel(gb, gb.POV.m);
            DelayDiv(2);
            DeIndicateModel(gb, gb.POV.m);
            DelayDiv(2);
        }

        for (t = 1; t <= 3; ++t)
        {
            IndicateModel(gb, M);
            DelayDiv(2);
            DeIndicateModel(gb, M);
            DelayDiv(2);
        }
    }
Ejemplo n.º 16
0
    public static void IndicatePath(texmaps.GameBoard gb, int X1, int Y1, int X2, int Y2, bool LOS)
    {
        //{Draw a line to indicate the distance between point 1 and}
        //{point 2. Do not indicate the points 1 and 2 themselves,}
        //{just the points in between.}

        //{Calculate Length.}
        int L = 0;
        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);
                texmaps.MapSplat(gb, '-', PathColor, P.x, P.y, LOS);
            }
        }

        //{Indicate the terminus of the line.}
        P = texmaps.SolveLine(X1, Y1, X2, Y2, L);
        if (gb.mog.IsSet(P.x, P.y) && texmaps.TileLOS(gb.POV, P.x, P.y))
        {
            IndicateModel(gb, texmodel.FindModelXY(gb.mlist, P.x, P.y));
        }
        else
        {
            texmaps.MapSplat(gb, '+', PathColor, P.x, P.y, LOS);
        }
    }
Ejemplo n.º 17
0
    public static void DeIndicatePath(texmaps.GameBoard gb, int X1, int Y1, int X2, int Y2)
    {
        //{There's a big line currently marring our screen display.}
        //{Clean it up, wouldja?}

        //{Calculate Length.}
        int L = 0;
        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);
                texmaps.DisplayTile(gb, P.x, P.y);
            }
        }

        //{Indicate the terminus of the line.}
        P = texmaps.SolveLine(X1, Y1, X2, Y2, L);
        if (gb.mog.IsSet(P.x, P.y) && texmaps.TileLOS(gb.POV, P.x, P.y))
        {
            DeIndicateModel(gb, texmodel.FindModelXY(gb.mlist, P.x, P.y));
        }
        else
        {
            texmaps.DisplayTile(gb, P.x, P.y);
        }
    }
Ejemplo n.º 18
0
    public static void RemoveCritter(Critter CP, ref Critter CList, texmaps.GameBoard gb)
    {
        //{Remove critter C from the critter list, also disposing of its}
        //{associated model, and updating screen display if needed.}
        Critter B = CList;
        Critter A = null;

        while (B != CP && B != null)
        {
            A = B;
            B = B.next;
        }

        if (B == null)
        {
            //{Major FUBAR. The critter we were trying to remove can't}
            //{be found in the list.}
            Crt.Write("ERROR- RemoveCritter asked to remove a critter that dont exist.");
            do
            {
                rpgtext.RPGKey();
            } while (true);
        }
        else if (A == null)
        {
            //{There's no critter before the one we want to remove,}
            //{i.e. it's the first one in the list.}
            CList = B.next;
            ZonkCritter(B, gb);
        }
        else
        {
            //{We found the critter we want to delete and have a critter}
            //{standing before it in line. Go to work.}
            A.next = B.next;
            ZonkCritter(B, gb);
        }
    }
Ejemplo n.º 19
0
    public static Cloud ReadClouds(StreamReader f, texmaps.GameBoard gb)
    {
        //{Read a list of clouds from disk.}
        //{Initialize the list to NIL.}
        Cloud CList = null;

        //{Keep reading data until we get a termination value, -1.}
        int N = int.Parse(f.ReadLine());

        while (N != -1)
        {
            //{Read the rest of the cloud data.}
            int X = int.Parse(f.ReadLine());
            int Y = int.Parse(f.ReadLine());
            int D = int.Parse(f.ReadLine());

            //{ Add this cloud to the list.}
            AddCloud(ref CList, gb, N, X, Y, D);

            N = int.Parse(f.ReadLine());
        }

        return(CList);
    }
Ejemplo n.º 20
0
    public static MPU ReadMPU(StreamReader f, texmaps.GameBoard gb)
    {
        //{Read a list of computers from disk.}
        //{Initialize the list to NIL.}
        MPU CList = null;

        //{Keep reading data until we get a termination value, -1.}
        int N = int.Parse(f.ReadLine());

        while (N != -1)
        {
            //{Read the rest of the cloud data.}
            int X = int.Parse(f.ReadLine());
            int Y = int.Parse(f.ReadLine());

            //{Add this computer to the list.}
            MPU Current = AddMPU(ref CList, gb, N, X, Y);
            Current.Attr = f.ReadLine();

            N = int.Parse(f.ReadLine());
        }

        return(CList);
    }
Ejemplo n.º 21
0
    public static DCChar ReadPC(StreamReader f, texmaps.GameBoard gb, int SFV)
    {
        //{F is an open text file. Read in all the data needed for}
        //{a character, as written to the file by the above procedure.}
        //{Also, initialize the model for the PC.}
        //var
        // PC: DCCharPtr;
        // T: Integer;
        // A: String;
        // X,Y: Integer;

        //{Allocate memory for the character to be loaded.}
        DCChar pc = new DCChar();

        pc.target = null;

        //{Read in the identification line.}
        f.ReadLine();

        //{General Data block}
        int x = int.Parse(f.ReadLine());
        int y = int.Parse(f.ReadLine());

        pc.name   = f.ReadLine();
        pc.gender = int.Parse(f.ReadLine());
        pc.job    = int.Parse(f.ReadLine());
        pc.HP     = int.Parse(f.ReadLine());
        pc.HPMax  = int.Parse(f.ReadLine());
        pc.MP     = int.Parse(f.ReadLine());
        pc.MPMax  = int.Parse(f.ReadLine());
        pc.carbs  = int.Parse(f.ReadLine());
        pc.lvl    = int.Parse(f.ReadLine());
        pc.XP     = int.Parse(f.ReadLine());

        int t;

        //{Stats block}
        for (t = 0; t < NumStats; ++t)
        {
            pc.stat[t] = int.Parse(f.ReadLine());
        }

        //{Skills block}
        for (t = 0; t < NumSkill; ++t)
        {
            pc.skill[t] = int.Parse(f.ReadLine());
        }

        //{Equipment Slots block}
        for (t = 0; t < NumEquipSlots; ++t)
        {
            pc.eqp[t] = dcitems.ReadItemList(f);
        }

        //{Inventory block}
        pc.inv = dcitems.ReadItemList(f);

        //{Status block}
        pc.SF = plotbase.ReadNAtt(f);

        //{Spells block}
        pc.spell = spells.ReadSpellMem(f);

        //{Now, finally, we have all the info we need for the PC.}
        //{Let's initialize some values so that things can start working.}
        pc.repCount = 0;
        pc.lastCmd  = '&';

        //{Add the model here, then set the POV data.}
        pc.m = texmodel.AddModel(ref gb.mlist, gb.mog, '@', Crt.Color.LightGreen, Crt.Color.White, false, x, y, MKIND_Character);

        gb.POV.m     = pc.m;
        gb.POV.range = PCVisionRange(pc);
        texmaps.UpdatePOV(gb.POV, gb);

        return(pc);
    }
Ejemplo n.º 22
0
 public static void DeIndicateModel(texmaps.GameBoard gb, texmodel.Model M)
 {
     //{Set the model's color to AColor.}
     M.color = M.aColor;
     texmaps.DisplayTile(gb, M.x, M.y);
 }