//----------------------------------------------------- // Draw the current scene to the form, then cycle // through all game elements to update image //----------------------------------------------------- public void PaintForm() { graphics.DrawImage(screenBmp, 0, 0, screenBmp.Width * 2, screenBmp.Height * 2); Graphics g = Graphics.FromImage(screenBmp); g.Clear(Color.LightBlue); Figures.DrawSky(Buffers.XView, 0, Buffers.NH * Buffers.W, Buffers.NV * Buffers.H); //BackGr.StartClouds(); for (int x = Buffers.XView / Buffers.W; x < Buffers.XView / Buffers.W + Buffers.NH; x++) { for (int y = 0; y < 24; y++) { Figures.Redraw(x, y); } } BackGr.DrawBackGr(true); //ReadColorMap(); if (Buffers.Options.Stars != 0) { Stars.ShowStars(); } Enemies.ShowEnemies(); if (!Play.OnlyDraw) { Players.DrawPlayer(); } // ShowPage }
//------------------------------------------------------------------- // Scrolls the screen to move along with mario as he moves. //------------------------------------------------------------------- public static void MoveScreen() { int Scroll; int N1, N2; int OldX, NewX, Page; Random rand = new Random(); Page = FormMarioPort.formRef.CurrentPage(); Scroll = Buffers.XView - Buffers.LastXView[Page]; if (!Players.EarthQuake) { FormMarioPort.formRef.SetView(Buffers.XView, Buffers.YView); } else { Players.EarthQuakeCounter++; if (Players.EarthQuakeCounter > 0) { Players.EarthQuake = false; } int Rand1 = rand.Next(0, 2); int Rand2 = rand.Next(0, 2); FormMarioPort.formRef.SetView(Buffers.XView, Buffers.YView + Rand1 - Rand2); } if (Scroll < 0) { Enemies.StartEnemies((Buffers.XView / Buffers.W) - Enemies.StartEnemiesAt, 1); } else if (Scroll > 0) { Enemies.StartEnemies((Buffers.XView / Buffers.W) + Buffers.NH + Enemies.StartEnemiesAt, -1); } int i = Buffers.Options.Horizon; BackGr.DrawBackGr(false); Buffers.Options.Horizon = (byte)i; if (Scroll > 0) { for (int j = Buffers.LastXView[Page]; j < Buffers.XView; j++) { i = j - Buffers.W - Buffers.W; if (i >= 0) { FormMarioPort.formRef.PutPixel(i, 0, 0); } i = Buffers.W - j % Buffers.W - 1; Figures.Redraw(j / Buffers.W + Buffers.NH + 1, i); } } if (Scroll < 0) { for (int j = Buffers.LastXView[Page]; j > Buffers.XView; j--) { i = Buffers.W - j % Buffers.W - 1; Figures.Redraw(j / Buffers.W - 1, i); } } }