using System;
using Assets.src.rpg;

public class BackgroundNew
{
	public const int MOUTAIN_FOREST = 0;

	public const int FOREST = 1;

	public const int BEACH = 2;

	public const int SNOW_MOUNTAIN = 6;

	public const int ISLAND = 7;

	public const int HOADIEMSON = 8;

	public const int CEMETERY = 11;

	public const int KAMISAMA = 12;

	public const int NUCLEAR = 14;

	public const int METAL_SLUG = 15;

	public const int CITY = 16;

	public const int IRAC = 17;

	public const int fogw = 287;

	public static Image tam;

	public static int[] mapBgID = new int[40]
	{
		6, 2, 14, 14, 7, 8, 0, 6, 11, 7,
		7, 12, 12, 2, 15, 15, 15, 15, 2, 2,
		1, 8, 0, 0, 12, 12, 12, -1, 8, 11,
		14, 2, 1, 15, 7, 1, 6, 8, 11, 11
	};

	public static bool paintBG;

	public static int gsskyHeight;

	public static int gsgreenField1Y;

	public static int gsgreenField2Y;

	public static int gshouseY;

	public static int gsmountainY;

	public static int bgLayer0y;

	public static int bgLayer1y;

	public static Image imgCloud;

	public static Image imgSun;

	public static Image imgSun2;

	public static Image[] imgBorder = new Image[3];

	public static int borderConnerW;

	public static int borderConnerH;

	public static int borderCenterW;

	public static int borderCenterH;

	public static int[] cloudX;

	public static int[] cloudY;

	public static int sunX;

	public static int sunY;

	public static int sunX2;

	public static int sunY2;

	public static bool lowGraphic;

	public static int typeBg = -1;

	public static int transY;

	public static int[] yb = new int[5];

	public static int[] colorTop;

	public static int[] colorBotton;

	public static int yb1;

	public static int yb2;

	public static int yb3;

	public static Image[] imgBG;

	public static int[] layerSpeed;

	public static float[] moveX;

	public static float[] moveXSpeed;

	public static int nBg = 0;

	public static int lastBg = -1;

	public static sbyte mapID;

	public static sbyte lastBgID = -1;

	public static sbyte zoneID;

	public static sbyte bgID;

	public static sbyte bgType;

	public static sbyte lastType = -1;

	public static sbyte typeMap;

	public static int[] bgRain = new int[3] { 1, 4, 11 };

	public static int[] bgRainFont = new int[1] { -1 };

	public static int skyColor;

	public static int[] bgW;

	public static int[] bgH;

	public static int gW;

	public static int gH;

	public static int gW2;

	public static int gssw;

	public static int gssh;

	public static int gH34;

	public static int gW3;

	public static int gH3;

	public static int gH23;

	public static int gW23;

	public static int gH2;

	public static int csPadMaxH;

	public static int cmdBarH;

	public static int gW34;

	public static int gW6;

	public static int gH6;

	public static int firstY;

	private static int fw;

	public static bool isFog;

	public static int nCloud;

	public static Image imgCloud1;

	public static Image imgFog;

	public static int cloudw;

	public static int xfog;

	public static int yfog;

	public static bool isBoltEff;

	public static bool boltActive;

	public static int tBolt;

	public static void initCloud()
	{
		if (mSystem.clientType == mSystem.JAVA || mSystem.clientType == mSystem.WINDOWS_PHONE)
		{
			imgCloud1 = null;
			imgFog = null;
			return;
		}
		if (lowGraphic)
		{
			imgCloud1 = null;
			imgFog = null;
			return;
		}
		if (nCloud > 0)
		{
			if (imgCloud1 == null)
			{
				imgCloud1 = CCanvas.loadImage("/gui2/fog1.png");
				cloudw = imgCloud1.getWidth();
			}
		}
		else
		{
			imgCloud1 = null;
		}
		if (!isFog)
		{
			imgFog = null;
		}
		else if (imgFog == null)
		{
			imgFog = CCanvas.loadImage("/gui2/fog0.png");
		}
	}

	public static void updateCloud2()
	{
		if (mSystem.clientType == mSystem.JAVA || mSystem.clientType == mSystem.WINDOWS_PHONE || lowGraphic || nCloud <= 0)
		{
			return;
		}
		int num = Camera.x + CCanvas.w;
		if (CCanvas.curScr == CCanvas.gameScr)
		{
			num = MM.mapWidth;
		}
		if (CCanvas.curScr == CCanvas.gameScrRPG)
		{
			num = CMapRPG.pxw;
		}
		for (int i = 0; i < nCloud; i++)
		{
			int num2 = i + 1;
			cloudX[i] -= num2;
			if (cloudX[i] < -cloudw)
			{
				cloudX[i] = num + 100;
			}
		}
	}

	public static void updateFog()
	{
		if (mSystem.clientType != mSystem.JAVA && mSystem.clientType != mSystem.WINDOWS_PHONE && !lowGraphic && isFog)
		{
			xfog--;
			if (xfog < -287)
			{
				xfog = 0;
			}
		}
	}

	public static void paintCloud2(mGraphics g)
	{
		if (mSystem.clientType == mSystem.JAVA || mSystem.clientType == mSystem.WINDOWS_PHONE || lowGraphic || nCloud == 0 || imgCloud1 == null)
		{
			return;
		}
		for (int i = 0; i < nCloud; i++)
		{
			int num = i;
			if (num > 3)
			{
				num = 3;
			}
			if (num == 0)
			{
				num = 1;
			}
			g.drawImage(imgCloud1, cloudX[i], cloudY[i], 3, false);
		}
	}

	public static void paintFog(mGraphics g)
	{
		if (mSystem.clientType == mSystem.JAVA || mSystem.clientType == mSystem.WINDOWS_PHONE || lowGraphic || !isFog || imgFog == null)
		{
			return;
		}
		for (int i = xfog; i < MM.mapWidth; i += 287)
		{
			if (i >= Camera.x - 287)
			{
				g.drawImage(imgFog, i, yfog, 0, false);
			}
		}
	}

	public static void randomCloudFog()
	{
		if (CRes.abs(CRes.random(0, 2)) == 0)
		{
			nCloud = CRes.abs(CRes.random(2, 5));
			initCloud();
		}
		if (CRes.abs(CRes.random(0, 2)) == 0)
		{
			isFog = true;
			initCloud();
		}
	}

	public static void loadBG(int typeBG)
	{
		gW = CScreen.w;
		gH = CScreen.h;
		gW2 = gW >> 1;
		gH2 = gH >> 1;
		gW3 = gW / 3;
		gH3 = gH / 3;
		gW23 = gH - 120;
		gH23 = gH * 2 / 3;
		gW34 = 3 * gW / 4;
		gH34 = 3 * gH / 4;
		gW6 = gW / 6;
		gH6 = gH / 6;
		CRes.outz("load bg id= " + typeBG + " lastBgID= " + lastBgID + " last type= " + lastType);
		BackgroudEffect.clearImage();
		if ((lastBgID == typeBG && lastType == bgType) || typeBG == -1)
		{
			return;
		}
		transY = 12;
		lastBgID = (sbyte)typeBG;
		lastType = bgType;
		layerSpeed = new int[5] { 1, 2, 3, 7, 8 };
		moveX = new float[5];
		moveXSpeed = new float[5];
		typeBg = typeBG;
		isBoltEff = false;
		firstY = Camera.y;
		imgBG = null;
		imgCloud = null;
		imgSun = null;
		firstY = -1;
		EffecMn.vEff.removeAllElements();
		GameScr.aniBack = null;
		GameScr.aniFront = null;
		isFog = false;
		nCloud = 0;
		switch (typeBg)
		{
		case 0:
			randomCloudFog();
			if (!lowGraphic)
			{
				GameScr.aniBack = new AnimateEffect(1, true, 5, 0);
				GameScr.aniFront = new AnimateEffect(1, true, 5, 0);
			}
			BackgroudEffect.keyValueAction("eff", "12.0.300.137.-1.1");
			BackgroudEffect.keyValueAction("eff", "12.0.800.200.-1.1");
			layerSpeed = new int[4] { 1, 3, 5, 7 };
			nBg = 4;
			nCloud = 3;
			if (bgType == 2)
			{
				transY = 8;
			}
			break;
		case 1:
			if (!lowGraphic)
			{
				GameScr.aniBack = new AnimateEffect(1, true, 5, 0);
				GameScr.aniFront = new AnimateEffect(1, true, 5, 0);
			}
			BackgroudEffect.keyValueAction("eff", "11.0.300.137.-1.1");
			BackgroudEffect.keyValueAction("eff", "11.0.800.200.-1.1");
			transY = 7;
			nBg = 4;
			break;
		case 2:
			randomCloudFog();
			BackgroudEffect.keyValueAction("eff", "4.0.240.237.-1.50.3");
			BackgroudEffect.keyValueAction("eff", "4.0.1000.237.-1.70.3");
			moveX = new float[5] { 0f, 0f, 1f, 0f, 0f };
			moveXSpeed = new float[5] { 0f, 0f, 2f, 0f, 0f };
			nBg = 5;
			break;
		case 6:
			randomCloudFog();
			if (!lowGraphic)
			{
				GameScr.aniBack = new AnimateEffect(3, true, 40, 0);
				GameScr.aniFront = new AnimateEffect(3, true, 20, 0);
			}
			BackgroudEffect.keyValueAction("eff", "4.0.180.260.-1.50.3");
			BackgroudEffect.keyValueAction("eff", "4.0.830.250.-1.70.3");
			moveX = new float[5] { 1f, 0f, 0f, 0f, 0f };
			moveXSpeed = new float[5] { 1f, 0f, 0f, 0f, 0f };
			nBg = 5;
			break;
		case 7:
			randomCloudFog();
			if (!lowGraphic)
			{
				GameScr.aniBack = new AnimateEffect(1, true, 5, 0);
				GameScr.aniFront = new AnimateEffect(1, true, 5, 0);
			}
			BackgroudEffect.keyValueAction("eff", "15.0.340.300.-1.100.3");
			BackgroudEffect.keyValueAction("eff", "15.0.900.280.-1.120.3");
			nBg = 4;
			break;
		case 8:
			BackgroudEffect.keyValueAction("eff", "14.0.240.360.-1.70.3");
			BackgroudEffect.keyValueAction("eff", "14.0.1000.360.-1.50.3");
			transY = 8;
			moveX = new float[5] { 0f, 1f, 0f, 0f, 0f };
			moveXSpeed = new float[5] { 0f, 1f, 0f, 0f, 0f };
			nBg = 5;
			break;
		case 11:
			transY = 7;
			nBg = 4;
			break;
		case 12:
			randomCloudFog();
			moveX = new float[5] { 1f, 1f, 0f, 0f, 0f };
			moveXSpeed = new float[5] { 2f, 1f, 0f, 0f, 0f };
			nBg = 3;
			nCloud = 5;
			break;
		case 14:
			BackgroudEffect.keyValueAction("eff", "13.0.300.250.-1.60.3");
			BackgroudEffect.keyValueAction("eff", "13.0.800.250.-1.50.3");
			nBg = 4;
			break;
		case 15:
			randomCloudFog();
			BackgroudEffect.keyValueAction("eff", "13.0.270.232.-1.50.3");
			BackgroudEffect.keyValueAction("eff", "13.0.780.232.-1.60.3");
			nBg = 4;
			break;
		case 16:
			nBg = 3;
			break;
		case 17:
			randomCloudFog();
			nBg = 3;
			break;
		}
		skyColor = CRes.SKYCOLOR[typeBg];
		if (lowGraphic)
		{
			tam = CCanvas.loadImageRMS("/bg/b151.png");
			return;
		}
		try
		{
			if (!lowGraphic)
			{
				imgBG = new Image[nBg];
				bgW = new int[nBg];
				bgH = new int[nBg];
				colorBotton = new int[nBg];
				colorTop = new int[nBg];
				for (int i = 0; i < nBg; i++)
				{
					if (bgType == 0)
					{
						imgBG[i] = CCanvas.loadImageRMS("/bg/b" + typeBg + i + ".png");
					}
					else
					{
						CRes.outz("link type= /bg/b" + typeBg + i + "-" + bgType + ".png");
						imgBG[i] = CCanvas.loadImageRMS("/bg/b" + typeBg + i + "-" + bgType + ".png");
					}
					if (imgBG[i] != null)
					{
						int[] rgbData = new int[1];
						imgBG[i].getRGB(ref rgbData, 0, 1, mGraphics.getRealImageWidth(imgBG[i]) / 2, 0, 1, 1);
						colorTop[i] = rgbData[0];
						rgbData = new int[1];
						imgBG[i].getRGB(ref rgbData, 0, 1, mGraphics.getRealImageWidth(imgBG[i]) / 2, mGraphics.getRealImageHeight(imgBG[i]) - 1, 1, 1);
						colorBotton[i] = rgbData[0];
						bgW[i] = mGraphics.getImageWidth(imgBG[i]);
						bgH[i] = mGraphics.getImageHeight(imgBG[i]);
					}
					else if (nBg > 1)
					{
						imgBG[i] = CCanvas.loadImageRMS("/bg/b" + typeBg + "0.png");
						bgW[i] = mGraphics.getImageWidth(imgBG[i]);
						bgH[i] = mGraphics.getImageHeight(imgBG[i]);
					}
				}
			}
			getYBackground(typeBg);
			cloudX = new int[5]
			{
				gW / 2 - 40,
				gW / 2 + 40,
				gW / 2 - 100,
				gW / 2 - 80,
				gW / 2 - 120
			};
			cloudY = new int[5] { 130, 100, 150, 140, 80 };
			if (typeBg != 6 && typeBg != 0 && typeBg != 2)
			{
				if (typeBg == 8)
				{
					imgSun = CCanvas.loadImageRMS("/bg/sun9" + ((bgType != 0) ? ("-" + bgType) : string.Empty) + ".png");
					imgSun2 = CCanvas.loadImageRMS("/bg/sun10" + ((bgType != 0) ? ("-" + bgType) : string.Empty) + ".png");
					sunX = gW / 2 - 30;
					sunY = yb[3] + 60;
					sunX2 = gW / 2 + 20;
					sunY2 = yb[3] + 10;
				}
				else if (typeBG == 12)
				{
					imgCloud = CCanvas.loadImageRMS("/bg/cl2.png");
				}
				else if (typeBg != 11 && typeBg != 7 && typeBg != 17 && typeBg != 15)
				{
					imgCloud = null;
					imgSun = null;
					imgSun2 = null;
				}
			}
		}
		catch (Exception)
		{
			Cout.LogTryCatch("BG ERR");
		}
		paintBG = false;
		if (!paintBG)
		{
			paintBG = true;
		}
	}

	public static void paintBackgroundtLayer(mGraphics g, int layer, int deltaY, int color1, int color2)
	{
		try
		{
			int num = layer - 1;
			if (moveX[num] != 0f)
			{
				moveX[num] += moveXSpeed[num] / (float)mGraphics.zoomLevel;
			}
			int y = Camera.y;
			float num2 = Camera.x;
			if (layerSpeed[num] != 0)
			{
				int num3 = 0;
				for (float num4 = 0f - (num2 + moveX[num]) / (float)(layerSpeed[num] * 2) % (float)bgW[num]; num4 < (float)gW; num4 += (float)(bgW[num] - 1))
				{
					g.drawImage(imgBG[num], num4, yb[num] - ((deltaY > 0) ? (y >> deltaY) : 0), 0, false);
					num3++;
				}
			}
			else
			{
				for (int i = 0; i < gW; i += bgW[num])
				{
					g.drawImage(imgBG[num], i, yb[num] - ((deltaY > 0) ? (y >> deltaY) : 0), 0, false);
				}
			}
			if (color1 != -1)
			{
				if (num == nBg - 1)
				{
					fillRect2(g, color1, 0, -(y >> deltaY), gW, yb[num], deltaY);
				}
				else
				{
					fillRect(g, color1, 0, yb[num - 1] + bgH[num - 1], gW, yb[num] - (yb[num - 1] + bgH[num - 1]), deltaY);
				}
			}
			if (color2 != -1)
			{
				if (num == 0)
				{
					fillRect(g, color2, 0, yb[num] + bgH[num], gW, gH - (yb[num] + bgH[num]), deltaY);
				}
				else
				{
					fillRect(g, color2, 0, yb[num] + bgH[num], gW, yb[num - 1] - (yb[num] + bgH[num]) + 200, deltaY);
				}
			}
		}
		catch (Exception)
		{
			Cout.LogTryCatch("paintBackgroundtLayer");
		}
	}

	public static void paintBGGameScr2(mGraphics g)
	{
		g.setColor(7196404);
		g.fillRect(0, 0, CCanvas.w, CCanvas.h, false);
	}

	public static void paintBGGameScr(mGraphics g)
	{
		try
		{
			if (CCanvas.curScr != LoginScr.gI())
			{
				g.translate(-g.getTranslateX(), -g.getTranslateY());
				g.setClip(0, 0, CScreen.w, CScreen.h);
			}
			if (Camera.shaking == 4)
			{
				g.setColor((CCanvas.gameTick % 4 <= 1) ? 16777215 : 0);
				g.fillRect(0, 0, CCanvas.w, CCanvas.h, false);
				if (!lowGraphic)
				{
					g.translate(-Camera.x, -Camera.y);
					paintCloud2(g);
					g.translate(-g.getTranslateX(), -g.getTranslateY());
				}
				return;
			}
			if (paintBG && !lowGraphic && ServerListScreen.bigOk && ServerListScreen.loadScreen)
			{
				if (typeBg == 0)
				{
					paintBackgroundtLayer(g, 4, 12, colorTop[3], colorBotton[3]);
					paintBackgroundtLayer(g, 3, 8, -1, colorBotton[2]);
					paintBackgroundtLayer(g, 2, 6, -1, colorBotton[1]);
					paintBackgroundtLayer(g, 1, 4, -1, -1);
					fillRect(g, 734785, 0, yb[0] + bgH[0], gW, 200, 4);
				}
				if (typeBg == 1)
				{
					int num = Camera.y >> 3;
					if (Camera.y < -50)
					{
						num = Camera.y >> 2;
					}
					paintBackgroundtLayer(g, 4, 6, -1, -1);
					fillRect(g, colorBotton[3], 0, yb[3] + bgH[3], gW, 200, 6);
					paintBackgroundtLayer(g, 3, 3, -1, -1);
					fillRect2(g, colorTop[2], 0, -num, gW, yb[2], 3);
					fillRect(g, colorBotton[2], 0, yb[2] + bgH[2], gW, 200, 3);
					paintBackgroundtLayer(g, 2, 2, -1, -1);
					paintBackgroundtLayer(g, 1, 1, -1, colorBotton[0]);
				}
				if (typeBg == 2)
				{
					paintBackgroundtLayer(g, 5, 20, colorTop[4], colorBotton[4]);
					paintBackgroundtLayer(g, 4, 16, -1, colorTop[2]);
					paintBackgroundtLayer(g, 3, 10, -1, colorBotton[2]);
					paintBackgroundtLayer(g, 2, 4, -1, colorBotton[1]);
					paintBackgroundtLayer(g, 1, 2, -1, colorBotton[0]);
					drawSun1(g);
					paintCloud(g);
				}
				if (typeBg == 6)
				{
					paintBackgroundtLayer(g, 5, 10, colorTop[4], colorBotton[4]);
					BackgroudEffect.paintFarAll(g);
					paintBackgroundtLayer(g, 4, 7, -1, colorBotton[3]);
					paintBackgroundtLayer(g, 3, 4, -1, colorBotton[2]);
					paintBackgroundtLayer(g, 2, 3, -1, colorBotton[1]);
					paintBackgroundtLayer(g, 1, 2, -1, colorBotton[0]);
				}
				if (typeBg == 7)
				{
					paintBackgroundtLayer(g, 4, 12, colorTop[3], colorBotton[3]);
					paintBackgroundtLayer(g, 3, 10, -1, colorBotton[2]);
					paintBackgroundtLayer(g, 2, 8, -1, colorBotton[1]);
					paintBackgroundtLayer(g, 1, 6, -1, colorBotton[0]);
				}
				if (typeBg == 8)
				{
					paintBackgroundtLayer(g, 5, 10, colorTop[4], colorBotton[4]);
					BackgroudEffect.paintFarAll(g);
					paintBackgroundtLayer(g, 4, 7, -1, colorBotton[3]);
					paintBackgroundtLayer(g, 3, 4, -1, colorBotton[2]);
					paintBackgroundtLayer(g, 2, 3, -1, colorBotton[1]);
					paintBackgroundtLayer(g, 1, 2, -1, colorBotton[0]);
				}
				if (typeBg == 11)
				{
					paintBackgroundtLayer(g, 4, 6, colorTop[3], colorBotton[3]);
					paintBackgroundtLayer(g, 3, 5, -1, colorBotton[2]);
					paintBackgroundtLayer(g, 2, 4, -1, colorBotton[1]);
					paintBackgroundtLayer(g, 1, 3, -1, colorBotton[0]);
				}
				if (typeBg == 12)
				{
					g.setColor(9161471);
					g.fillRect(0, 0, CCanvas.w, CCanvas.h, false);
					paintBackgroundtLayer(g, 3, 4, -1, 14417919);
					paintBackgroundtLayer(g, 2, 3, -1, 14417919);
					paintBackgroundtLayer(g, 1, 2, -1, 14417919);
					paintCloud(g);
				}
				if (typeBg == 14)
				{
					paintBackgroundtLayer(g, 4, 6, colorTop[3], colorBotton[3]);
					paintBackgroundtLayer(g, 3, 5, -1, colorBotton[2]);
					paintBackgroundtLayer(g, 2, 4, -1, colorBotton[1]);
					paintBackgroundtLayer(g, 1, 3, -1, colorBotton[0]);
				}
				if (typeBg == 15)
				{
					paintBackgroundtLayer(g, 4, 6, colorTop[3], colorBotton[3]);
					paintBackgroundtLayer(g, 3, 5, -1, colorBotton[2]);
					paintBackgroundtLayer(g, 2, 4, -1, colorBotton[1]);
					paintBackgroundtLayer(g, 1, 3, -1, colorBotton[0]);
				}
				if (typeBg == 16)
				{
					paintBackgroundtLayer(g, 3, 5, colorTop[2], colorBotton[2]);
					paintBackgroundtLayer(g, 2, 4, -1, colorBotton[1]);
					paintBackgroundtLayer(g, 1, 3, -1, colorBotton[0]);
				}
				if (typeBg == 17)
				{
					paintBackgroundtLayer(g, 3, 5, colorTop[2], colorBotton[2]);
					paintBackgroundtLayer(g, 2, 4, -1, colorBotton[1]);
					paintBackgroundtLayer(g, 1, 3, -1, colorBotton[0]);
				}
				g.translate(-Camera.x, -Camera.y);
				paintCloud2(g);
				g.translate(-g.getTranslateX(), -g.getTranslateY());
				return;
			}
			g.setColor(8567981);
			g.fillRect(0, 0, CCanvas.w, CCanvas.h, false);
			if (tam != null)
			{
				for (int i = -((Camera.x >> 2) % mGraphics.getImageWidth(tam)); i < CCanvas.w; i += mGraphics.getImageWidth(tam))
				{
					g.drawImage(tam, i, (Camera.y >> 3) + CCanvas.h / 2, 0, false);
				}
			}
			g.setColor(5014416);
			g.fillRect(0, (Camera.y >> 3) + CCanvas.h / 2 + mGraphics.getImageHeight(tam), gW, CCanvas.h, false);
		}
		catch (Exception)
		{
			g.setColor(8567981);
			g.fillRect(0, 0, CCanvas.w, CCanvas.h, false);
		}
	}

	public static void drawSun1(mGraphics g)
	{
		if (imgSun != null)
		{
			g.drawImage(imgSun, sunX, sunY, 0, false);
		}
		if (!isBoltEff)
		{
			return;
		}
		if (CCanvas.gameTick % 200 == 0)
		{
			boltActive = true;
		}
		if (boltActive)
		{
			tBolt++;
			if (tBolt == 10)
			{
				tBolt = 0;
				boltActive = false;
			}
			if (tBolt % 2 == 0)
			{
				g.setColor(16777215);
				g.fillRect(0, 0, CCanvas.w, CCanvas.h, false);
			}
		}
	}

	public static void drawSun2(mGraphics g)
	{
		if (imgSun2 != null)
		{
			g.drawImage(imgSun2, sunX2, sunY2, 0, false);
		}
	}

	public static void getYBackground(int typeBg)
	{
		int num = gH23;
		switch (typeBg)
		{
		case 0:
			yb[0] = num - bgH[0] + 50;
			yb[1] = yb[0] - bgH[1] + 30;
			yb[2] = yb[1] - bgH[2] + 40;
			yb[3] = yb[2] - bgH[3] + 40;
			break;
		case 1:
			yb[0] = num - bgH[0] + 200;
			yb[1] = yb[0] - bgH[1];
			yb[2] = yb[1] - 90;
			yb[3] = yb[2] - 25;
			break;
		case 2:
			yb[0] = num - bgH[0] + 150;
			yb[1] = yb[0] - bgH[1] - 60;
			yb[2] = yb[1] - bgH[2] - 40;
			yb[3] = yb[2] - bgH[3] - 10;
			yb[4] = yb[3] - bgH[4];
			break;
		case 6:
			yb[0] = num - bgH[0] + 100;
			yb[1] = yb[0] - bgH[1] - 30;
			yb[2] = yb[1] - bgH[2] + 10;
			yb[3] = yb[2] - bgH[3] + 15;
			yb[4] = yb[3] - bgH[4] + 15;
			break;
		case 7:
			yb[0] = num - bgH[0] + 20;
			yb[1] = yb[0] - bgH[1] + 10;
			yb[2] = yb[1] - bgH[2] + 20;
			yb[3] = yb[1] - bgH[2] - 60;
			break;
		case 8:
			yb[0] = num - bgH[0] + 150;
			yb[1] = yb[0] - bgH[1];
			yb[2] = yb[1] - bgH[2];
			yb[3] = yb[2] - bgH[3] + 40;
			yb[4] = yb[3] - bgH[4];
			break;
		case 11:
			yb[0] = num - bgH[0] + 80;
			yb[1] = yb[0] - bgH[1];
			yb[2] = yb[1] - bgH[2] + 10;
			yb[3] = yb[2] - bgH[3] + 70;
			break;
		case 12:
			yb[0] = num + 40;
			yb[1] = yb[0] - 40;
			yb[2] = yb[1] - 40;
			break;
		case 14:
			yb[0] = num - bgH[0] + 80;
			yb[1] = yb[0] - bgH[1] - 5;
			yb[2] = yb[1] - bgH[2] + 10;
			yb[3] = yb[2] - bgH[3] + 20;
			break;
		case 15:
			yb[0] = num - bgH[0] + 60;
			yb[1] = yb[0] - bgH[1] - 15;
			yb[2] = yb[1] - bgH[2] + 10;
			yb[3] = yb[2] - bgH[3] - 30;
			break;
		case 16:
			yb[0] = num - bgH[0] + 90;
			yb[1] = yb[0] - bgH[1];
			yb[2] = yb[1] - bgH[2] - 50;
			break;
		case 17:
			yb[0] = num - 60;
			yb[1] = yb[0] - 40;
			yb[2] = yb[1] - 40;
			break;
		case 3:
		case 4:
		case 5:
		case 9:
		case 10:
		case 13:
			break;
		}
	}

	public static void fillRect2(mGraphics g, int color, int x, int y, int w, int h, int detalY)
	{
		g.setColor(color);
		int y2 = Camera.y;
		g.fillRect(x, y - (Math.abs(y2) >> detalY), w, h + ((detalY != 0) ? (Math.abs(y2) >> detalY) : 0), false);
	}

	public static void fillRect(mGraphics g, int color, int x, int y, int w, int h, int detalY)
	{
		g.setColor(color);
		int y2 = Camera.y;
		g.fillRect(x, y - ((detalY != 0) ? (y2 >> detalY) : 0), w, h + ((detalY != 0) ? (y2 >> detalY) : 0), false);
	}

	public static void paintCloud(mGraphics g)
	{
	}

	public static bool isHDVersion()
	{
		if (mGraphics.zoomLevel > 1)
		{
			return true;
		}
		return false;
	}
}
