示例#1
0
        // Function from file: beam.dm
        public void Draw(  )
        {
            double? Angle      = null;
            Matrix  rot_matrix = null;
            double  DX         = 0;
            double  DY         = 0;
            double  N          = 0;
            double  length     = 0;
            dynamic X          = null;
            Icon    II         = null;
            double? Pixel_x    = null;
            double? Pixel_y    = null;
            int?    a          = null;

            Angle      = Num13.Floor(GlobalFuncs.Get_Angle(this.origin, this.target));
            rot_matrix = Num13.Matrix();
            rot_matrix.Turn(Angle);
            DX     = Convert.ToDouble(this.target.x * 32 + this.target.pixel_x - (this.origin.x * 32 + this.origin.pixel_x));
            DY     = Convert.ToDouble(this.target.y * 32 + this.target.pixel_y - (this.origin.y * 32 + this.origin.pixel_y));
            N      = 0;
            length = Num13.Floor(Math.Sqrt(Math.Pow(DX, 2) + Math.Pow(DY, 2)));

            foreach (dynamic _a in Lang13.IterateRange(0, length - 1, 32))
            {
                N = _a;

                X       = Lang13.Call(this.beam_type, this.origin_oldloc);
                X.owner = this;
                this.elements.Or(X);

                if (N + 32 > length)
                {
                    II = new Icon(this.icon, this.icon_state);
                    II.DrawBox(null, 1, length - N, 32, 32);
                    X.icon = II;
                }
                else
                {
                    X.icon = this.base_icon;
                }
                X.transform = rot_matrix;
                Pixel_x     = null;
                Pixel_y     = null;

                if (DX == 0)
                {
                    Pixel_x = 0;
                }
                else
                {
                    Pixel_x = Num13.Floor(Math.Sin(Angle ?? 0) + Math.Sin(Angle ?? 0) * (N + 16) * 32 / 32);
                }

                if (DY == 0)
                {
                    Pixel_y = 0;
                }
                else
                {
                    Pixel_y = Num13.Floor(Math.Cos(Angle ?? 0) + Math.Cos(Angle ?? 0) * (N + 16) * 32 / 32);
                }
                a = null;

                if (Math.Abs(Pixel_x ?? 0) > 32)
                {
                    a        = ((Pixel_x ?? 0) > 0 ? Num13.Floor((Pixel_x ?? 0) / 32) : GlobalFuncs.Ceiling((Pixel_x ?? 0) / 32));
                    X.x     += a;
                    Pixel_x %= 32;
                }

                if (Math.Abs(Pixel_y ?? 0) > 32)
                {
                    a        = ((Pixel_y ?? 0) > 0 ? Num13.Floor((Pixel_y ?? 0) / 32) : GlobalFuncs.Ceiling((Pixel_y ?? 0) / 32));
                    X.y     += a;
                    Pixel_y %= 32;
                }
                X.pixel_x = Pixel_x;
                X.pixel_y = Pixel_y;
            }
            return;
        }
示例#2
0
        // Function from file: overview.dm
        public void drawmap(Mob user = null)
        {
            int        icx         = 0;
            int        icy         = 0;
            int        xoff        = 0;
            int        yoff        = 0;
            int?       icount      = null;
            ByTable    imap        = null;
            int?       i           = null;
            int?       wx          = null;
            int?       wy          = null;
            Tile       T           = null;
            string     colour      = null;
            bool       sense       = false;
            GasMixture environment = null;
            double     turf_total  = 0;
            double     t1          = 0;
            Ent_Static AM          = null;
            Ent_Static A           = null;
            int        red         = 0;
            int        green       = 0;
            int        blue        = 0;
            int        ix          = 0;
            int        iy          = 0;
            double?    rx          = null;
            double?    ry          = null;
            Icon       I           = null;
            int?       i2          = null;
            Obj_Screen H           = null;
            dynamic    I2          = null;

            icx    = Num13.Floor(Game13.map_size_x / 16) + 1;
            icy    = Num13.Floor(Game13.map_size_y / 16) + 1;
            xoff   = Num13.Floor(icx * 16 - Game13.map_size_x - 2);
            yoff   = Num13.Floor(icy * 16 - Game13.map_size_y - 2);
            icount = icx * icy;
            imap   = new ByTable();
            i      = null;
            i      = 0;

            while ((i ?? 0) < (icount ?? 0))
            {
                imap.Add(new Icon("icons/misc/imap.dmi", "blank"));
                i++;
            }
            wx = null;
            wx = 1;

            while ((wx ?? 0) <= Game13.map_size_x)
            {
                wy = null;
                wy = 1;

                while ((wy ?? 0) <= Game13.map_size_y)
                {
                    T      = Map13.GetTile(wx ?? 0, wy ?? 0, this.z);
                    colour = null;

                    if (!(T != null))
                    {
                        colour = "#000000";
                    }
                    else
                    {
                        sense = true;

                        switch ((string)("" + T.type))
                        {
                        case "/turf/space":
                            colour = "#0a0a0a";
                            sense  = false;
                            break;

                        case "/turf/simulated/floor":
                        case "/turf/simulated/floor/engine":
                            environment = T.return_air();
                            turf_total  = environment.total_moles();
                            t1          = turf_total / 103.98379516601562 * 175;

                            if (t1 <= 100)
                            {
                                colour = String13.ColorCode(0, 0, ((int)(t1 * 2.41)));
                            }
                            else
                            {
                                t1     = Num13.MinInt(100, ((int)(t1 - 100)));
                                colour = String13.ColorCode(((int)(t1 * 2.41)), ((int)(t1 * 2.41)), 255);
                            }
                            break;

                        case "/turf/simulated/wall":
                            colour = "#606060";
                            break;

                        case "/turf/simulated/wall/r_wall":
                            colour = "#806060";
                            break;

                        default:
                            colour = "#002800";
                            break;
                        }

                        if (sense)
                        {
                            foreach (dynamic _b in Lang13.Enumerate(T.contents, typeof(Ent_Static)))
                            {
                                AM = _b;


                                if (AM is Obj_Machinery_Door && !(AM is Obj_Machinery_Door_Window))
                                {
                                    if (AM.density)
                                    {
                                        colour = "#0060c0";
                                    }
                                    else
                                    {
                                        colour = "#60c080";
                                    }
                                }

                                if (AM is Obj_Machinery_Airalarm)
                                {
                                    colour = "#00ff00";

                                    if (AM.icon_state == "alarm:1")
                                    {
                                        colour = "#ffff00";
                                    }
                                }

                                if (AM is Mob)
                                {
                                    if (Lang13.Bool(((dynamic)AM).client))
                                    {
                                        colour = "#ff0000";
                                    }
                                    else
                                    {
                                        colour = "#ff8080";
                                    }
                                }
                            }
                        }
                        A = T.loc;

                        if (Lang13.Bool(((dynamic)A).fire))
                        {
                            red    = GlobalFuncs.getr(colour);
                            green  = GlobalFuncs.getg(colour);
                            blue   = GlobalFuncs.getb(colour);
                            green  = Num13.MinInt(255, green + 40);
                            blue   = Num13.MinInt(255, blue + 40);
                            colour = String13.ColorCode(red, green, blue);
                        }
                    }
                    ix = Num13.Floor(((wx ?? 0) * 2 + xoff) / 32);
                    iy = Num13.Floor(((wy ?? 0) * 2 + yoff) / 32);
                    rx = ((wx ?? 0) * 2 + xoff) % 32 + 1;
                    ry = ((wy ?? 0) * 2 + yoff) % 32 + 1;
                    I  = imap[ix + icx * iy + 1];
                    I.DrawBox(colour, rx, ry, rx, ry);
                    wy++;
                }
                wx++;
            }
            user.clearmap();
            user.mapobjs = new ByTable();
            i2           = null;
            i2           = 0;

            while ((i2 ?? 0) < (icount ?? 0))
            {
                H            = new Obj_Screen();
                H.screen_loc = "" + ((i2 ?? 0) % icx + 5) + "," + (Num13.Floor((i2 ?? 0) / icx) + 6);
                H.name       = (i2 == 0 ? "maprefresh" : "map");
                I2           = imap[(i2 ?? 0) + 1];
                H.icon       = I2;
                GlobalFuncs.qdel(I2);
                H.layer = 25;
                Task13.User.mapobjs.Add(H);
                i2++;
            }
            user.client.screen.Add(user.mapobjs);
            this.close(user);
            return;
        }