示例#1
0
        public void DrawMap(int nv)
        {
            lv = nv;
            gb.Clear(Color.Gray); int x1, y1, x2, y2;
            int em=0, wm=0, nm=0, sm=0;
            Brush[] br = new Brush[] { Brushes.Blue, Brushes.Green, Brushes.Cyan, Brushes.Red, Brushes.Purple, Brushes.Yellow, Brushes.DarkGray, Brushes.White, Brushes.SkyBlue, Brushes.LimeGreen, Brushes.Pink };
            for(int x = 0 ; x < map.lvs[lv].sqx ; x++) {
                for(int y = 0 ; y < map.lvs[lv].sqy ; y++) {
                    x1 = x * 11; x2 = x1 + 10; y1 = 34 + ((89 - y) * 11); y2 = y1 + 10; csq = map.lvs[lv].sq[x, y]; cgp = map.gps[csq.g];

                    // Floor
                    if(csq.tf == 0) {
                        gb.FillRectangle(Brushes.Black, x1, y1, 11, 11);
                        if(lv < 40 && map.lvs[lv + 1].sq[x, y].tf == 0 &&
                            map.lvs[lv + 2].sq[x, y].tf == 0 && map.lvs[lv + 3].sq[x, y].tf == 0)
                            gb.FillRectangle(Brushes.Red, x1 + 3, y1 + 3, 7, 7);
                    }

                    // Rock?
                    if(csq.r) gb.FillRectangle(Brushes.White, x1, y1, 11, 11);

                    if(cgp.sm > sm) sm = cgp.sm;
                    if(cgp.sm > 0) gb.FillRectangle(br[cgp.sm-1], x1 + 3, y1 + 3, 7, 7);
                    if(x < 89 && (csq.g != map.lvs[lv].sq[x + 1, y].g)) gb.DrawLine(Pens.Violet, x2, y1, x2, y2);
                    if(x > 0 && (csq.g != map.lvs[lv].sq[x - 1, y].g)) gb.DrawLine(Pens.Violet, x1, y1, x1, y2);
                    if(y < 89 && (csq.g != map.lvs[lv].sq[x, y + 1].g)) gb.DrawLine(Pens.Violet, x1, y1, x2, y1);
                    if(y > 0 && (csq.g != map.lvs[lv].sq[x, y - 1].g)) gb.DrawLine(Pens.Violet, x1, y2, x2, y2);

                    if(cgp.type != 0) {
                        if((cgp.type & 0x8000) != 0) gb.FillRectangle(Brushes.Blue, x1 + 4, y1 + 4, 3, 3);
                        if((cgp.type & 0x0040) != 0) gb.FillRectangle(Brushes.Red, x1 + 4, y1 + 4, 3, 3);
                        if((cgp.type | 0x8040) == 0x8040) gb.FillRectangle(Brushes.Green, x1 + 4, y1 + 4, 3, 3);
                    }

                    // Wals exist
                    if(csq.te > 0) gb.DrawLine(Pens.Blue, x2, y1, x2, y2); if(csq.te > em) em = csq.te;
                    if(csq.tw > 0) gb.DrawLine(Pens.Blue, x1, y1, x1, y2); if(csq.tw > wm) wm = csq.tw;
                    if(csq.tn > 0) gb.DrawLine(Pens.Blue, x1, y1, x2, y1); if(csq.tn > nm) nm = csq.tn;
                    if(csq.ts > 0) gb.DrawLine(Pens.Blue, x1, y2, x2, y2); //if(csq.ts > sm) sm = csq.ts;
                    //Invisible doors?
                    if(csq.te == 107) gb.DrawLine(Pens.Green, x2, y1, x2, y2);
                    if(csq.tw == 107) gb.DrawLine(Pens.Green, x1, y1, x1, y2);
                    if(csq.tn == 107) gb.DrawLine(Pens.Green, x1, y1, x2, y1);
                    if(csq.ts == 107) gb.DrawLine(Pens.Green, x1, y2, x2, y2);
                    // Doors?
                    if(csq.te == 98) gb.DrawLine(Pens.Yellow, x2, y1, x2, y2);
                    if(csq.tw == 98) gb.DrawLine(Pens.Yellow, x1, y1, x1, y2);
                    if(csq.tn == 98) gb.DrawLine(Pens.Yellow, x1, y1, x2, y1);
                    if(csq.ts == 98) gb.DrawLine(Pens.Yellow, x1, y2, x2, y2);
                    // Negative textures, maybe invisible doors?
                    if(csq.te < 0) gb.DrawLine(Pens.Red, x2, y1, x2, y2);
                    if(csq.tw < 0) gb.DrawLine(Pens.Red, x1, y1, x1, y2);
                    if(csq.tn < 0) gb.DrawLine(Pens.Red, x1, y1, x2, y1);
                    if(csq.ts < 0) gb.DrawLine(Pens.Red, x1, y2, x2, y2);
                }
            }
            //MessageBox.Show(em + ", " + wm + ", " + nm + ", " + sm);
            gb.DrawString(em + ", " + wm + ", " + nm + ", " + sm, Font, Brushes.Black, 650, 0);

            for(int q = 0 ; q < 45 ; q++) {
                gb.DrawString("Lv " + (q + 1), Font, (q == lv) ? Brushes.White : Brushes.Black, 990, q * 21 + 5 + 34);
                gb.DrawLine(Pens.Black, 990, q * 21 + 34, fx, q * 21 + 34);

            }

                gf.DrawImage(gi, 0, 0);
        }
示例#2
0
        private void Form1_MouseMove(object sender, MouseEventArgs e)
        {
            int x=0, y=0; if(nomouse) return;
            switch(mode) {
                case "DEMISEDungeon":
                    x = e.X / 11; y = 89-(e.Y-34)/11;
                    if(x < 0 || y < 0 || x > 89 || y > 89) return;
                    csq = map.lvs[lv].sq[x, y]; cgp = map.gps[csq.g];
                    gf.FillRectangle(Brushes.Black, 0, 0, 500, 30);

                    gf.DrawString("XYZ: (" + (x+1) + "," + (y+1) + "," + (lv+1) + "); TE: " + csq.te + "; TW: " + csq.tw + "; TN: " + csq.tn + "; TS: " + csq.ts +
                        "; TF: " + csq.tf + "; TC: " + csq.tc + "; M: " + csq.m + "; G: " + csq.g + "; R: " + csq.r, Font, Brushes.White, 0, 0);
                    gf.DrawString("Types: " + cgp.type.ToString("X8") + "; GID: " + cgp.id + "; LF: " + cgp.lf + "; LM: " + cgp.lm + "; GF: " + cgp.gf +
                        "; SM: " + cgp.sm + "; MV: " + cgp.mv + "; T: " + cgp.t + "; R: " + cgp.r + "; S: " + cgp.s + "; SQ: " + cgp.sq

                        , Font, Brushes.White, 0, 10);

                    break;

            }
        }