using System;
using Assets.src.player;
using Assets.src.rpg;

public class CPlayer
{
	public const sbyte NUM_GUN = 10;

	public const sbyte GUN_CANNON = 0;

	public const sbyte GUN_AK = 1;

	public const sbyte GUN_PROTON = 2;

	public const sbyte GUN_CHUOI = 3;

	public const sbyte GUN_ROCKET = 4;

	public const sbyte GUN_MORTAR = 5;

	public const sbyte GUN_CHICKEN = 6;

	public const sbyte GUN_BOOMERANG = 7;

	public const sbyte GUN_HAMMER = 8;

	public const sbyte GUN_PINGPONG = 10;

	public const sbyte GUN_LASER_GIRL = 9;

	public const sbyte GUN_BOMB_SMALL = 11;

	public const sbyte GUN_BOMB_BIG = 12;

	public const sbyte GUN_BUG_ROBOT = 13;

	public const sbyte GUN_ROBOT = 14;

	public const sbyte GUN_UFO = 16;

	public const sbyte GUN_BOSS_KHICAU = 17;

	public const sbyte GUN_BOSS_GUNKHICAU = 18;

	public const sbyte GUN_BOSS_BOMBKHICAU = 19;

	public const sbyte GUN_FAN1 = 20;

	public const sbyte GUN_BOSS_EYEKHICAU = 21;

	public const sbyte GUN_BOSS_SPIDER = 22;

	public const sbyte GIFT_1 = 23;

	public const sbyte GIFT_2 = 24;

	public const sbyte GHOST = 25;

	public const sbyte GHOST_2 = 26;

	public const sbyte T_NORMAL_HUMAN = 0;

	public const sbyte T_IRONMAN = 1;

	public const sbyte T_HULK = 2;

	public const sbyte T_THOR = 3;

	public const sbyte T_LOKI = 4;

	public const sbyte T_CAPTAIN = 5;

	public const sbyte T_WINTER_SOLIDIER = 6;

	public const sbyte T_HAWK_EYE = 7;

	public const sbyte T_ULTRON = 8;

	public const sbyte T_MONKEY = 9;

	public const sbyte flySpeed = 2;

	public const int LEFT = 2;

	public const int RIGHT = 0;

	public const int UP = 1;

	public const int DOWN = 3;

	public const sbyte PSTATE_STAND = 0;

	public const sbyte PSTATE_MOVE = 1;

	public const sbyte PSTATE_AIM = 2;

	public const sbyte PSTATE_READYSHOOT = 3;

	public const sbyte PSTATE_SHOOT = 4;

	public const sbyte PSTATE_DIE = 5;

	public const sbyte PSTATE_WIN = 7;

	public const sbyte PSTATE_HURT = 8;

	public const sbyte PSTATE_CAPTURE = 9;

	public const sbyte PSTATE_JUMP = 10;

	public const sbyte S_ALIVE = 0;

	public const sbyte S_BLACK_DEATH = 1;

	public const sbyte S_DIE = 2;

	public const sbyte S_NULL = 3;

	public static bool TEAM_GREEN = true;

	public static bool TEAM_YELLOW = false;

	public bool team;

	private bool isWaterBum;

	public bool isBoss;

	public sbyte type;

	public static int[] angleLock = new int[20]
	{
		-45, -45, -45, 30, 20, 0, -45, 1, -45, 20,
		20, 0, 0, -45, 0, 0, -45, -45, -45, 30
	};

	public static bool isShooting;

	public bool gunBack;

	public int tBack;

	public bool shootFrame;

	public static bool isStopFall;

	public static bool isGetPosition = false;

	public bool isFreeze;

	public static Image[] pImg = new Image[25];

	public bool isPaint = true;

	public bool isFly;

	public bool isBum;

	public string rankValue;

	public bool notPaintNormal;

	public bool flyPlayer;

	public bool earthwakeActive;

	public bool cantSee;

	public int clanID;

	public static sbyte busyHammer;

	public static sbyte nHammer;

	public int xBug;

	public static Image robotArm;

	public static Image robotLeg;

	public static Image robotBody;

	public static Image robotInjured;

	public static Image gunkhicau;

	public static Image bomb;

	public static Image fan1;

	public static Image fan2;

	public static Image bombKhiCau;

	public static Image mainGun;

	public static Image eye;

	public static Image back_fan;

	public static Image front_fan;

	public static Image injured;

	public static Image diamond;

	public static Image diamond2;

	public static Image ghost;

	public static Image ghost2;

	public static Image focus;

	public static Image imgfire;

	public static Image imgUFO;

	public static Image imgUFOFire;

	public static Image spider;

	public static Image web;

	private sbyte critical;

	public int idBullet;

	public bool ghostBit;

	public Image clanIcon;

	public static CPlayer myPlayer;

	public Clan clan;

	public static Image bong;

	public static Image arrow;

	public static Image imgBiaMo;

	public static Image imgDan;

	public static Image[] fireIronMan;

	public bool isExplodeFlag;

	public bool isHawlSpecial;

	public bool isThorSpecial;

	public bool isUltronSpecial;

	public bool isLokiSpecial;

	public sbyte pointSeat;

	public bool captainReturn;

	public int xReturn;

	public int yReturn;

	public CPlayer charFocus;

	public Npc npcFocus;

	public static bool hasDrag;

	public static bool isDrag;

	public static int xDrag;

	public static int yDrag;

	public FrameImage pFrameImg;

	public bool isJump;

	public int framebd_1;

	public int frameleg_1;

	public int x;

	public int y;

	public static int pW = 20;

	public static int pH = 35;

	public bool falling;

	public int[] item;

	public int itemUsed = -1;

	public int CurSelectedItem;

	public bool isUsedItem;

	public bool is2TurnItem;

	public float lastForcePoint;

	public float lastForcePoint_2;

	public float movePoint;

	public int IDDB;

	public sbyte index;

	public int rank;

	public sbyte gun;

	public bool isAllowSendPosAfterShoot;

	public bool isActiveFall;

	public bool activeFallbyEx;

	public bool chophepGuiUpdateXY;

	public bool isSecondPower;

	public bool isDoublePower;

	public float force;

	public float force_2;

	private int maxforce = 30;

	private int radius = 50;

	public int angle;

	public int angle2;

	private int speedChangeAngle = 1;

	public int dx;

	public int dx2;

	public int dx3;

	public int dx4;

	public int dy;

	public int dy2;

	public int dy3;

	public int dy4;

	public int curFrame = 5;

	private int frameDelay;

	public int look = 2;

	public int lookAngle = -1;

	private int hurtLook = 2;

	public sbyte state;

	public int fspider;

	public static int SLEFT = 0;

	public static int SRIGHT = 1;

	public static int SUP = 2;

	public static int SDOWN = 3;

	public int sLook = 1;

	public int MAX_MOVE_POINT;

	public bool active;

	private bool isSendM_autoDie;

	public int hp;

	public int maxhp;

	public int nextHP;

	public string hpText;

	private string expText;

	private string cupText;

	public sbyte bulletType;

	private sbyte nShoot;

	public sbyte currAngry;

	public sbyte angryX;

	public bool isAngry;

	public bool isInvisible;

	public bool isVampire;

	public bool isRunSpeed;

	public bool isStopWind;

	public bool isPoison;

	public bool poisonEff;

	public int tPEff;

	public bool isCom;

	public short lastx;

	public short lasty;

	private int lastUpdateX;

	private int lastUpdateY;

	public string name;

	private int vy;

	private int g = 1;

	public int nextx;

	public int nexty;

	public bool isMove;

	public int isAvenger;

	public sbyte indexOwner;

	public sbyte teamColor;

	public sbyte stateDie;

	public bool dieEffect;

	public int clipDie;

	public int dyDie;

	public bool isLokiCopy;

	public CPlayer pLoki;

	public static Image lua;

	public static short[] angleLockMain = null;

	public static Image buggun;

	public static Image bugbody;

	public static Image bugleg;

	public int[] feStand = new int[4] { 0, 1, 1, 0 };

	public int[] fRun = new int[5] { 2, 3, 4, 5, 6 };

	public int[] fGetGun = new int[4] { 7, 8, 9, 10 };

	public int[] fRemoveGun = new int[4] { 10, 9, 8, 7 };

	public int[] fAngle = new int[7] { 11, 12, 13, 14, 15, 16, 17 };

	public int[] fMove = new int[8] { 18, 19, 20, 21, 22, 21, 20, 19 };

	public int[] fFire = new int[7] { 23, 24, 25, 26, 27, 28, 29 };

	public int dem;

	private int tF;

	private int stat;

	private int tRun;

	private bool isAimUp;

	private int indexAngle;

	private int yGift_1;

	private int yGift_2 = MM.mapHeight + 30;

	public static int headIndex;

	public static int legIndex;

	public static int bodyIndex;

	public static int hatIndex;

	public static int wingIndex;

	public static int wpsIndex;

	public static short[] heads = new short[5] { 0, 6, 11, 16, 21 };

	public static short[] legs = new short[10] { 1, 7, 13, 43, 23, 33, 38, 47, 18, 51 };

	public static short[] bodys = new short[10] { 2, 8, 12, 42, 22, 34, 39, 46, 17, 50 };

	public static short[] hats = new short[10] { 3, 9, 14, 44, 24, 35, 40, 48, 19, 52 };

	public static short[] wings = new short[10] { 4, 10, 15, 45, 25, 36, 41, 49, 20, 53 };

	public static short[] wps = new short[7] { 57, 58, 56, 55, 54, 27, 5 };

	private int smokeDelayWhenDie = 100;

	public bool isCapture;

	private sbyte whoCapture = -1;

	private bool capUp;

	private bool capDown;

	public int capX;

	public int capY;

	public int playerHit;

	private int xTo;

	private int yTo;

	private int xFrom;

	private int yFrom;

	public bool flyActive;

	private int xa;

	private int ya;

	public bool isPointActive;

	public int yPoint;

	private bool outMap;

	private int va;

	private int vx;

	private int camY;

	private bool up = true;

	private bool down;

	public int tMove;

	public int xToNow;

	public int yToNow;

	public bool isSplash;

	public int ySplash;

	private bool isGift_1;

	private bool isGift_2;

	public bool getGift;

	private int toAngle;

	private int timeCount;

	private int delay = 1;

	private int delayCount;

	private bool isDelay;

	private float powerSpeed = ((Main.FPS >= 48) ? 0.25f : 0.5f);

	public bool isHoldFire;

	public bool isHoldAngle;

	public bool isHoldMove;

	private int t;

	public bool isMoveAvenger;

	public bool isPoint;

	public int vJump;

	public int target;

	public int w = 10;

	public int h = 40;

	public int z;

	public bool isPointerMove;

	public static bool keyChatNPC;

	public bool isMe;

	private MyVector pos = new MyVector("pos");

	private int cxSend;

	private int cySend;

	public bool isPointAvenger;

	public bool isExplore = true;

	public int xBugBack;

	public int yBugBack;

	public int bombIndex;

	public short[][] _x;

	public short[][] _y;

	public static int xSuper;

	public static int ySuper;

	public static bool isStopFire;

	public string KD;

	public string KDA;

	public static int xM;

	public static int yM;

	public static int frameM;

	public int frameC;

	public static bool isMirror;

	public static bool closeMirror;

	public static int tCl;

	public int ta;

	public int fa;

	public int yT;

	private int cx;

	private int cy;

	private int cp1;

	public short head;

	public short leg;

	public short body;

	public short wp;

	public short hat;

	public short wing;

	public int bossType;

	public static Image khicau;

	public static Image giatreo;

	public static Image quat1;

	public static Image quat2;

	public static int[][][] CharInfo = new int[30][][]
	{
		new int[7][]
		{
			new int[3] { 0, -9, -33 },
			new int[3] { 0, -5, -8 },
			new int[3] { 0, -6, -15 },
			new int[3] { 5, -17, -24 },
			new int[3] { 0, -9, -33 },
			new int[3] { 0, -14, -20 },
			new int[3] { 0, -17, -33 }
		},
		new int[7][]
		{
			new int[3] { 0, -9, -32 },
			new int[3] { 0, -5, -8 },
			new int[3] { 0, -6, -14 },
			new int[3] { 5, -17, -23 },
			new int[3] { 0, -9, -32 },
			new int[3] { 0, -14, -19 },
			new int[3] { 0, -17, -32 }
		},
		new int[7][]
		{
			new int[3] { 0, -4, -33 },
			new int[3] { 1, -4, -11 },
			new int[3] { 1, -3, -16 },
			new int[3] { 3, -14, -44 },
			new int[3] { 0, -4, -34 },
			new int[3] { 0, -11, -21 },
			new int[3] { 0, -14, -44 }
		},
		new int[7][]
		{
			new int[3] { 0, -6, -32 },
			new int[3] { 2, -7, -9 },
			new int[3] { 2, -7, -16 },
			new int[3] { 3, -16, -44 },
			new int[3] { 0, -6, -33 },
			new int[3] { 0, -13, -22 },
			new int[3] { 0, -16, -44 }
		},
		new int[7][]
		{
			new int[3] { 0, -5, -32 },
			new int[3] { 3, -6, -9 },
			new int[3] { 3, -4, -16 },
			new int[3] { 3, -13, -44 },
			new int[3] { 0, -5, -33 },
			new int[3] { 0, -11, -22 },
			new int[3] { 0, -13, -44 }
		},
		new int[7][]
		{
			new int[3] { 0, -6, -33 },
			new int[3] { 4, -8, -10 },
			new int[3] { 4, -7, -16 },
			new int[3] { 3, -15, -46 },
			new int[3] { 0, -6, -34 },
			new int[3] { 0, -14, -23 },
			new int[3] { 0, -15, -46 }
		},
		new int[7][]
		{
			new int[3] { 0, -8, -33 },
			new int[3] { 5, -7, -10 },
			new int[3] { 5, -6, -17 },
			new int[3] { 3, -17, -46 },
			new int[3] { 0, -8, -34 },
			new int[3] { 0, -15, -22 },
			new int[3] { 0, -17, -46 }
		},
		new int[7][]
		{
			new int[3] { 0, -10, -33 },
			new int[3] { 0, -6, -8 },
			new int[3] { 0, -7, -15 },
			new int[3] { 3, -19, -42 },
			new int[3] { 0, -10, -33 },
			new int[3] { 0, -15, -20 },
			new int[3] { 0, -19, -42 }
		},
		new int[7][]
		{
			new int[3] { 1, -12, -33 },
			new int[3] { 0, -6, -8 },
			new int[3] { 0, -7, -17 },
			new int[3] { 3, -19, -44 },
			new int[3] { 1, -13, -33 },
			new int[3] { 0, -13, -20 },
			new int[3] { 0, -19, -44 }
		},
		new int[7][]
		{
			new int[3] { 1, -12, -33 },
			new int[3] { 0, -6, -8 },
			new int[3] { 5, -6, -17 },
			new int[3] { 3, -16, -48 },
			new int[3] { 1, -13, -33 },
			new int[3] { 0, -13, -20 },
			new int[3] { 0, -16, -48 }
		},
		new int[7][]
		{
			new int[3] { 1, -12, -33 },
			new int[3] { 0, -6, -8 },
			new int[3] { 7, -6, -19 },
			new int[3] { 1, -17, -30 },
			new int[3] { 1, -13, -33 },
			new int[3] { 0, -13, -20 },
			new int[3] { 0, -17, -33 }
		},
		new int[7][]
		{
			new int[3] { 0, -6, -32 },
			new int[3] { 6, -7, -10 },
			new int[3] { 6, -3, -15 },
			new int[3] { 0, -15, -19 },
			new int[3] { 0, -6, -33 },
			new int[3] { 0, -14, -20 },
			new int[3] { 0, -15, -33 }
		},
		new int[7][]
		{
			new int[3] { 1, -8, -33 },
			new int[3] { 6, -7, -10 },
			new int[3] { 7, -3, -18 },
			new int[3] { 1, -10, -27 },
			new int[3] { 1, -10, -33 },
			new int[3] { 0, -13, -19 },
			new int[3] { 0, -12, -33 }
		},
		new int[7][]
		{
			new int[3] { 2, -12, -30 },
			new int[3] { 7, -7, -8 },
			new int[3] { 8, -3, -18 },
			new int[3] { 2, -9, -33 },
			new int[3] { 1, -12, -30 },
			new int[3] { 0, -13, -18 },
			new int[3] { 0, -12, -33 }
		},
		new int[7][]
		{
			new int[3] { 3, -12, -31 },
			new int[3] { 7, -7, -8 },
			new int[3] { 9, -2, -23 },
			new int[3] { 3, -2, -43 },
			new int[3] { 1, -14, -31 },
			new int[3] { 0, -12, -18 },
			new int[3] { 0, -14, -43 }
		},
		new int[7][]
		{
			new int[3] { 3, -12, -32 },
			new int[3] { 7, -7, -8 },
			new int[3] { 9, -4, -24 },
			new int[3] { 4, 2, -45 },
			new int[3] { 1, -14, -32 },
			new int[3] { 0, -11, -18 },
			new int[3] { 0, -14, -43 }
		},
		new int[7][]
		{
			new int[3] { 0, -7, -33 },
			new int[3] { 6, -7, -10 },
			new int[3] { 5, -4, -17 },
			new int[3] { 5, -16, -28 },
			new int[3] { 0, -7, -34 },
			new int[3] { 0, -14, -22 },
			new int[3] { 0, -15, -34 }
		},
		new int[7][]
		{
			new int[3] { 0, -7, -33 },
			new int[3] { 6, -7, -10 },
			new int[3] { 5, -3, -14 },
			new int[3] { 6, -11, -36 },
			new int[3] { 0, -7, -34 },
			new int[3] { 0, -15, -22 },
			new int[3] { 0, -12, -36 }
		},
		new int[7][]
		{
			new int[3] { 0, -6, -31 },
			new int[3] { 6, -7, -10 },
			new int[3] { 6, -3, -14 },
			new int[3] { 0, -15, -18 },
			new int[3] { 0, -6, -32 },
			new int[3] { 0, -14, -19 },
			new int[3] { 0, -15, -31 }
		},
		new int[7][]
		{
			new int[3] { 0, -6, -32 },
			new int[3] { 8, -3, -8 },
			new int[3] { 6, -3, -15 },
			new int[3] { 0, -15, -19 },
			new int[3] { 0, -6, -33 },
			new int[3] { 0, -14, -20 },
			new int[3] { 0, -15, -32 }
		},
		new int[7][]
		{
			new int[3] { 0, -6, -31 },
			new int[3] { 9, -3, -7 },
			new int[3] { 6, -3, -14 },
			new int[3] { 0, -15, -18 },
			new int[3] { 0, -6, -32 },
			new int[3] { 0, -14, -19 },
			new int[3] { 0, -15, -31 }
		},
		new int[7][]
		{
			new int[3] { 0, -6, -30 },
			new int[3] { 7, -7, -8 },
			new int[3] { 6, -3, -13 },
			new int[3] { 0, -15, -17 },
			new int[3] { 0, -6, -31 },
			new int[3] { 0, -14, -18 },
			new int[3] { 0, -15, -30 }
		},
		new int[7][]
		{
			new int[3] { 0, -6, -32 },
			new int[3] { 8, -3, -8 },
			new int[3] { 6, -3, -15 },
			new int[3] { 0, -15, -19 },
			new int[3] { 0, -6, -33 },
			new int[3] { 0, -14, -20 },
			new int[3] { 0, -15, -32 }
		},
		new int[7][]
		{
			new int[3] { 0, -6, -32 },
			new int[3] { 6, -7, -10 },
			new int[3] { 6, -3, -15 },
			new int[3] { 0, -17, -19 },
			new int[3] { 0, -6, -33 },
			new int[3] { 0, -14, -20 },
			new int[3] { 0, -15, -33 }
		},
		new int[7][]
		{
			new int[3] { 1, -8, -33 },
			new int[3] { 6, -7, -10 },
			new int[3] { 7, -3, -18 },
			new int[3] { 1, -12, -26 },
			new int[3] { 1, -10, -33 },
			new int[3] { 0, -13, -19 },
			new int[3] { 0, -12, -33 }
		},
		new int[7][]
		{
			new int[3] { 2, -12, -30 },
			new int[3] { 7, -7, -8 },
			new int[3] { 8, -3, -18 },
			new int[3] { 2, -11, -31 },
			new int[3] { 1, -12, -30 },
			new int[3] { 0, -13, -18 },
			new int[3] { 0, -12, -33 }
		},
		new int[7][]
		{
			new int[3] { 3, -12, -31 },
			new int[3] { 7, -7, -8 },
			new int[3] { 9, -2, -23 },
			new int[3] { 3, -3, -41 },
			new int[3] { 1, -14, -31 },
			new int[3] { 0, -12, -18 },
			new int[3] { 0, -14, -43 }
		},
		new int[7][]
		{
			new int[3] { 3, -12, -32 },
			new int[3] { 7, -7, -8 },
			new int[3] { 9, -4, -24 },
			new int[3] { 4, 2, -43 },
			new int[3] { 1, -14, -32 },
			new int[3] { 0, -11, -18 },
			new int[3] { 0, -14, -43 }
		},
		new int[7][]
		{
			new int[3] { 0, -7, -33 },
			new int[3] { 6, -7, -10 },
			new int[3] { 5, -4, -17 },
			new int[3] { 5, -18, -29 },
			new int[3] { 0, -7, -34 },
			new int[3] { 0, -14, -22 },
			new int[3] { 0, -15, -34 }
		},
		new int[7][]
		{
			new int[3] { 0, -7, -33 },
			new int[3] { 6, -7, -10 },
			new int[3] { 5, -3, -14 },
			new int[3] { 6, -13, -38 },
			new int[3] { 0, -7, -34 },
			new int[3] { 0, -15, -22 },
			new int[3] { 0, -12, -36 }
		}
	};

	public int role;

	public bool isReady;

	public sbyte status;

	private int frameCount;

	public int[] movez = new int[5] { 2, 3, 4, 5, 6 };

	public int pAngle;

	public int cf;

	public static string[] strLevel;

	public static int[] expToLevel;

	public short imgLevel;

	public int perCent;

	public string stringLevel;

	public int currLv;

	public int frame;

	private int[] dbY = new int[18]
	{
		-1, 0, 0, -1, 0, 0, -1, 0, 0, 1,
		0, 0, 1, 0, 0, 1, 0, 0
	};

	private int countB = CRes.random(0, 5);

	public static Image bongbong = CCanvas.loadImage("/item/bongbong.png");

	public static Image gift_1 = CCanvas.loadImage("/item/box.png");

	public static Image gift_2 = CCanvas.loadImage("/item/box2.png");

	public static Image gift_empty = CCanvas.loadImage("/item/boxEmpty.png");

	private int dyGift;

	private int frameG;

	private int tG;

	private int alpha = 250;

	public int xMuiTen;

	public static Image imgCircle;

	public static Image imgCircle_30;

	public static Image imgCircle_20;

	public static Image imgCircle_0;

	public static Image imgCircle_45;

	public int hpRectW = 25;

	public bool hpChangeVisible;

	private bool addExp;

	private bool addCup;

	public int exp;

	public int cup;

	private int hpChangeAmount;

	private int dyhp;

	private int dyExp;

	private int dyCup;

	public int nQuanHam;

	private bool hpTang;

	public int vHP = 10;

	public int hpGoc;

	public int timer1;

	public sbyte runSpeed = 1;

	private int nextX;

	private int nextY;

	public int lastAngle;

	public int currAngle;

	private int angleLimit = 45;

	public bool isRemoveGun;

	public bool isGetGun;

	public float x2;

	public int nQuanHam2;

	public static int deltaY;

	public static int tB;

	private static int deltaX;

	public static int tBalloon;

	public static int deltaBalloon;

	public static Item[][] arrItemShop;

	public static CPlayer[][] arrayTopPlayer;

	public static Item[] arrItemBag;

	public static Item[] arrItemBox;

	public static Item[] arrItemBody;

	public static Item[] arrItemBalo = new Item[0];

	public static Item[] arrItemKhamNam = new Item[4];

	public static Item[] arrItemGhepNgoc = new Item[7];

	public static int[] idItemBalo;

	public static short[] levelImage;

	private bool isChangeGun;

	private short gunChage;

	public int xu;

	public int luong;

	public string strXu;

	public string strLuong;

	public short point;

	public bool isLuaDauNong;

	private int iLua;

	private int xLua;

	private int yLua;

	public static Image[][] imgDust;

	public static Image imgFire;

	public static FrameImage imgFireFlare;

	private int[] dustX;

	private int[] dustY;

	private int[] dustState;

	private Airplane ap;

	private bool isDrop;

	private bool isLanded;

	public int avenger;

	public int power;

	public CPlayer(int IDDB, sbyte index, int X, int Y, bool isCom, int look, sbyte gunType, int maxHP)
	{
	}

	public CPlayer()
	{
		yGift_1 = 0;
		yGift_2 = MM.mapHeight + 30;
		loadDust();
		head = 0;
		body = 17;
		leg = 1;
		wp = 5;
		hat = -1;
		wing = -1;
	}

	public bool isClickChar(int x1, int y1)
	{
		if (CRes.inRect(x1, y1, x - 10, y - 40, 20, 40))
		{
			PM.getMyPlayer2().npcFocus = null;
			PM.getMyPlayer2().charFocus = this;
			PM.getMyPlayer2().target = index;
			return true;
		}
		return false;
	}

	public bool isFlyAvenger()
	{
		if (isAvenger == 1 || isAvenger == 8)
		{
			return true;
		}
		if (GetType() == typeof(BigBoss) && type == 2)
		{
			return true;
		}
		return false;
	}

	public void setLokiToDefault()
	{
		if (isLokiCopy)
		{
			isLokiCopy = false;
			if (pLoki != null)
			{
				head = pLoki.head;
				leg = pLoki.leg;
				body = pLoki.body;
				wp = pLoki.wp;
				hat = pLoki.hat;
				wing = pLoki.wing;
				maxhp = pLoki.maxhp;
				hp = maxhp;
				hpRectW = 25;
				isAvenger = 4;
				pLoki = null;
			}
		}
	}

	public static void initIronMan()
	{
		if (fireIronMan == null)
		{
			fireIronMan = new Image[4];
			for (int i = 0; i < 4; i++)
			{
				fireIronMan[i] = CCanvas.loadImage("/gui2/fire" + i + ".png");
			}
		}
	}

	public void setCaptainReturn(int X, int Y)
	{
		xReturn = X;
		yReturn = Y;
		captainReturn = true;
	}

	public void setBaloonBoss()
	{
		if (khicau == null)
		{
			khicau = CCanvas.loadImage("/boss/than.png");
		}
		if (giatreo == null)
		{
			giatreo = CCanvas.loadImage("/boss/treo.png");
		}
		if (quat1 == null)
		{
			quat1 = CCanvas.loadImage("/boss/quat1.png");
		}
		if (quat2 == null)
		{
			quat2 = CCanvas.loadImage("/boss/quat2.png");
		}
		bossType = 3;
		flyPlayer = true;
		CRes.outz("SET BALOON TOON");
	}

	public void setBaloonGun()
	{
		flyPlayer = true;
		bossType = 4;
	}

	public static void loadImage()
	{
		bong = CCanvas.loadImage("/gui2/bong.png");
		arrow = CCanvas.loadImage("/gui2/arrow.png");
		imgCircle = CCanvas.loadImage("/circle.png");
		imgCircle_30 = CCanvas.loadImage("/circle_60.png");
		imgCircle_20 = CCanvas.loadImage("/circle_70.png");
		imgCircle_0 = CCanvas.loadImage("/circle_90.png");
		imgCircle_45 = CCanvas.loadImage("/circle_135.png");
		lua = CCanvas.loadImage("/eff/lua.png");
		imgBiaMo = CCanvas.loadImage("/Small/Small1299.png");
		imgDan = CCanvas.loadImage("/gui2/dan.png");
	}

	public int randomTime()
	{
		return CRes.random(50, 100);
	}

	public void resetEquip()
	{
		wp = arrItemBody[5].template.part;
	}

	public void action()
	{
		if (stat == 0)
		{
			tF++;
			if (tF > randomTime())
			{
				if (!isFlyAvenger())
				{
					stat = (byte)CRes.random(0, 3);
					switch (stat)
					{
					case 1:
						dem = 0;
						cf = fRemoveGun[0];
						isRemoveGun = true;
						break;
					case 2:
						dem = 0;
						cf = fAngle[0];
						angle = 250;
						isHoldAngle = true;
						isAimUp = true;
						break;
					case 3:
						dem = 0;
						cf = fGetGun[0];
						isGetGun = true;
						break;
					}
				}
				else
				{
					stat = 0;
				}
				tF = 0;
			}
		}
		if (!isFlyAvenger())
		{
			switch (stat)
			{
			case 0:
				updateFrameStand();
				break;
			case 1:
				if (!isRemoveGun)
				{
					stat = 4;
					updateFrameRun();
				}
				else
				{
					updateFrameRemoveGun();
				}
				break;
			case 2:
				if (isAimUp)
				{
					if (angle > 100)
					{
						angle -= 10;
						updateFrameAngle();
					}
					else
					{
						isAimUp = false;
					}
				}
				else if (angle < 250)
				{
					angle += 10;
					updateFrameAngle();
				}
				else
				{
					stat = 0;
					updateFrameStand();
					isHoldAngle = false;
				}
				break;
			case 3:
				if (!isGetGun)
				{
					stat = 0;
					updateFrameStand();
				}
				else
				{
					updateFrameGetGun();
				}
				break;
			case 4:
				tRun++;
				if (tRun > randomTime())
				{
					dem = 0;
					cf = fGetGun[0];
					isGetGun = true;
					tRun = 0;
					stat = 3;
				}
				else
				{
					updateFrameRun();
				}
				break;
			}
		}
		else
		{
			isMoveAvenger = true;
			updateFrameStand();
		}
	}

	public void updateFrameRun()
	{
		int num = ((!CScreen.isUseHighFrameRate()) ? 3 : 6);
		if (dem == 0)
		{
			Music.play(Music.FOOTSTEP, 10f);
		}
		dem++;
		if (dem > (fRun.Length - 1) * num)
		{
			dem = 0;
		}
		cf = fRun[dem / num];
		frame = cf;
	}

	public void updateFrameMove()
	{
		int num = ((!CScreen.isUseHighFrameRate()) ? 4 : 8);
		if (dem == 0)
		{
			Music.play(Music.FOOTSTEP, 10f);
		}
		dem++;
		if (dem > (fMove.Length - 1) * num)
		{
			dem = 0;
		}
		cf = fMove[dem / num];
		frame = cf;
	}

	public void updateFrameStand()
	{
		int num = ((!CScreen.isUseHighFrameRate()) ? 5 : 10);
		dem++;
		if (dem > (feStand.Length - 1) * num)
		{
			dem = 0;
		}
		cf = feStand[dem / num];
		frame = cf;
	}

	public void updateFrameGetGun()
	{
		int num = ((!CScreen.isUseHighFrameRate()) ? 3 : 6);
		dem++;
		if (dem >= fGetGun.Length * num)
		{
			dem = 0;
			isGetGun = false;
			updateFrameAngle();
		}
		else
		{
			cf = fGetGun[dem / num];
		}
	}

	public void updateFrameRemoveGun()
	{
		int num = ((!CScreen.isUseHighFrameRate()) ? 3 : 6);
		dem++;
		if (dem >= fRemoveGun.Length * num)
		{
			dem = 0;
			isRemoveGun = false;
		}
		else
		{
			cf = fRemoveGun[dem / num];
		}
	}

	public bool isFrameWithGun()
	{
		for (int i = 0; i < fAngle.Length; i++)
		{
			if (cf == fAngle[i])
			{
				return true;
			}
		}
		for (int j = 0; j < fMove.Length; j++)
		{
			if (cf == fMove[j])
			{
				return true;
			}
		}
		for (int k = 0; k < fFire.Length; k++)
		{
			if (cf == fMove[k])
			{
				return true;
			}
		}
		return false;
	}

	public int getIndexByFrame(int frame)
	{
		for (int i = 0; i < fAngle.Length; i++)
		{
			if (frame == fAngle[i])
			{
				return i;
			}
		}
		return -1;
	}

	public void updateFrameAngle()
	{
		dem = 0;
		lookAngle = look;
		int num = angle + ((currAngle > 45) ? (-(360 - currAngle)) : currAngle);
		if (BackgroundNew.lowGraphic)
		{
			num = ((lookAngle != 0) ? 180 : 0);
		}
		if (angle <= 255 && angle >= 90)
		{
			if (num > 225)
			{
				cf = 17;
			}
			else if (num > 200)
			{
				cf = 16;
			}
			else if (num > 170)
			{
				cf = 11;
			}
			else if (num > 150)
			{
				cf = 12;
			}
			else if (num > 130)
			{
				cf = 13;
			}
			else if (num > 110)
			{
				cf = 14;
			}
			else
			{
				cf = 15;
				if (num <= 90)
				{
					lookAngle = 0;
				}
			}
			if (lookAngle == 0)
			{
				if (num < 40)
				{
					cf = 12;
				}
				else if (num < 60)
				{
					cf = 13;
				}
				else if (num < 80)
				{
					cf = 14;
				}
			}
		}
		else if (angle >= -45 && angle <= 89)
		{
			if (num > 70)
			{
				CRes.outz("angle = " + num);
				cf = 15;
				if (num > 90)
				{
					lookAngle = 2;
				}
			}
			else if (num > 60)
			{
				cf = 14;
			}
			else if (num > 30)
			{
				cf = 13;
			}
			else if (num > 10)
			{
				cf = 12;
			}
			else if (num > -10)
			{
				cf = 11;
			}
			else if (num > -40)
			{
				cf = 16;
			}
			else
			{
				cf = 17;
			}
			if (lookAngle == 2)
			{
				if (num > 140)
				{
					cf = 12;
				}
				else if (num > 120)
				{
					cf = 13;
				}
				else if (num > 100)
				{
					cf = 14;
				}
			}
		}
		if (angle - 180 >= 0)
		{
			angle2 = angle - 180;
		}
		else
		{
			angle2 = angle + 180;
		}
	}

	public void init(int X, int Y, bool isCom, int look, int maxHP, int maxMove)
	{
		if (isFlyAvenger())
		{
			Y += 10;
		}
		this.isCom = isCom;
		this.look = look;
		team = ((index % 2 != 0) ? TEAM_YELLOW : TEAM_GREEN);
		CRes.outz("ID BULLET = " + idBullet + " gun= " + gun);
		falling = true;
		activeFallbyEx = false;
		chophepGuiUpdateXY = true;
		x = X;
		y = Y;
		xM = x;
		yM = y - 50;
		capX = X;
		capY = Y;
		lastUpdateX = X;
		lastUpdateY = Y;
		nextx = X;
		nexty = Y;
		lastx = (short)x;
		lasty = (short)y;
		itemUsed = -1;
		item = new int[PrepareScr.numCurItemSlot];
		maxhp = maxHP;
		hp = maxhp;
		hpGoc = maxHP;
		isPoison = false;
		MAX_MOVE_POINT = maxMove;
		currAngry = 0;
		isAngry = false;
		hpRectW = 25;
		xToNow = x;
		yToNow = y;
		x2 = x;
		isExplodeFlag = false;
		stateDie = 0;
	}

	public void init2(int X, int Y)
	{
		x = X;
		y = Y;
		xM = x;
		yM = y - 50;
		capX = X;
		capY = Y;
		lastUpdateX = X;
		lastUpdateY = Y;
		x2 = x;
		nextx = X;
		nexty = Y;
		lastx = (short)x;
		lasty = (short)y;
		xToNow = x;
		yToNow = y;
		falling = true;
		isExplodeFlag = false;
	}

	public void initAngle()
	{
		BulletForGun bull = BulletForGun.getBull(wp);
		if (bull != null)
		{
			gun = bull.bullType;
			if (isAvenger > 0)
			{
				gun = (sbyte)(isAvenger + 10);
			}
			angle = ((look != 0) ? (180 - angleLock[gun]) : ((angleLock[gun] >= 0) ? angleLock[gun] : 0));
			CRes.outz("gun= " + gun + "my angle= " + angle + " ----------------------------------------------");
		}
	}

	public void capture(sbyte whoCapture)
	{
		isCapture = true;
		this.whoCapture = whoCapture;
		capDown = true;
		capX = x;
		capY = y;
	}

	public void ghostHit(int player)
	{
		ghostBit = true;
		playerHit = player;
	}

	public void capturePlayer()
	{
		if (!isCapture)
		{
			return;
		}
		falling = false;
		sLook = SDOWN;
		if (capDown)
		{
			y += 6;
			if (y >= PM.p[whoCapture].y - 24)
			{
				y = PM.p[whoCapture].y - 24;
				capDown = false;
				capUp = true;
			}
		}
		if (capUp)
		{
			y -= 6;
			PM.p[whoCapture].y = y + 24;
			PM.p[whoCapture].nexty = y + 24;
			if (y <= capY)
			{
				y = capY;
				nexty = capY;
				capUp = false;
				isCapture = false;
				CCanvas.lockNotify = true;
			}
		}
	}

	public bool checkMapDeep(int deep, int x, int y)
	{
		int num = y;
		for (int i = 0; i < deep; i++)
		{
			if (GameScr.mm.isLand(x, num))
			{
				num++;
				continue;
			}
			return false;
		}
		return true;
	}

	public bool isBestLocation(int x, int y, int width, int height)
	{
		int num = x - width / 2;
		for (int i = 0; i < width; i++)
		{
			if (checkMapDeep(height, num, y))
			{
				num++;
				continue;
			}
			return false;
		}
		return true;
	}

	public bool isChangeLocation()
	{
		if (checkMapDeep(60, x, y))
		{
			return false;
		}
		return true;
	}

	public Position move(int angle, int dis)
	{
		int num = dis * CRes.cos(CRes.fixangle(angle)) >> 10;
		int num2 = -(dis * CRes.sin(CRes.fixangle(angle))) >> 10;
		return new Position(num, num2);
	}

	public void flyToPoint(int xT, int yT)
	{
		flyActive = true;
		xTo = xT;
		yTo = yT;
		xFrom = x;
		yFrom = y;
		if (xTo > xFrom)
		{
			sLook = SRIGHT;
			look = 2;
		}
		else
		{
			sLook = SLEFT;
			look = 0;
		}
	}

	public void flyTo(int speed)
	{
		if (x >= MM.mapWidth)
		{
			x = -100;
			xTo = xFrom;
			yTo = yFrom;
			camY = 0;
		}
		int num = xTo - x;
		int num2 = y - yTo;
		int num3 = CRes.angle(num, num2);
		look = ((num < 0) ? 2 : 0);
		xa = move(num3, speed).x;
		ya = move(num3, speed).y;
		x += xa;
		y += ya;
		if (x < xTo + speed / 2 && x >= xTo - speed / 2 && y < yTo + speed / 2 && y >= yTo - speed / 2)
		{
			x = xTo;
			y = yTo;
			yPoint = yTo;
			while (!GameScr.mm.isLand(x, yPoint) && yPoint < MM.mapHeight)
			{
				yPoint++;
			}
			bulletType = -1;
			isPointActive = true;
			flyActive = false;
			GameScr.time.seconds += 2;
			CCanvas.tToWait = 20;
			CCanvas.tNotify = 0;
			CCanvas.lockNotify = true;
		}
		x2 = x;
	}

	public virtual void update()
	{
		if (dieEffect)
		{
			if (dyDie > 0)
			{
				if (dyDie % 3 == 0)
				{
					startDust(0, x - 6, y + 3);
					startDust(2, x + 6, y + 3);
				}
				dyDie--;
			}
			if (clipDie < 25)
			{
				clipDie++;
			}
		}
		if (isAvenger > 0)
		{
			gun = (sbyte)(isAvenger + 10);
		}
		if (isAvenger == 5 && captainReturn)
		{
			int num = CRes.angle(x - xReturn, yReturn - y);
			int num2 = move(num, 8).x;
			int num3 = move(num, 8).y;
			xReturn += num2;
			yReturn += num3;
			if (CRes.abs(xReturn - x) <= 10 && CRes.abs(yReturn - y) <= 10)
			{
				captainReturn = false;
			}
		}
		if (isFlyAvenger())
		{
			if (isMoveAvenger)
			{
				if (state == 0 || state == 1)
				{
					updateFrameStand();
				}
			}
			else
			{
				updateFrameAngle();
			}
		}
		if (isAvenger == 2 && state == 0)
		{
			frame = 0;
		}
		if (PM.getMyPlayer() != this && BM.isPrepareShooting && toAngle != angle)
		{
			int num4 = toAngle - angle;
			if (num4 < 0)
			{
				angle -= 10;
				if (angle < toAngle)
				{
					angle = toAngle;
				}
			}
			else if (num4 > 0)
			{
				angle += 10;
				if (angle > toAngle)
				{
					angle = toAngle;
				}
			}
			if (isFrameWithGun())
			{
				updateFrameAngle();
			}
		}
		if (isSplash && IDDB >= 2000000000 && y != ySplash)
		{
			updateFrameStand();
			if (y + 5 < ySplash)
			{
				y += 5;
			}
			else
			{
				state = 0;
				updateFrameAngle();
				y = ySplash;
				isSplash = false;
			}
			nexty = y;
			yToNow = y;
			return;
		}
		updateLuaDauNong();
		updateDust();
		updateHPChange();
		if (isChangeGun)
		{
			updateChangeGun();
			return;
		}
		if (PM.curP == GameScr.myIndex)
		{
			if (angryX < currAngry)
			{
				angryX += 2;
			}
			if (angryX > currAngry)
			{
				angryX = currAngry;
			}
		}
		if (bossType == 3)
		{
			if (state == 5)
			{
				y += 3;
				falling = false;
				if (CCanvas.gameTick % 5 == 0)
				{
					new Explosion(CRes.random(x - 50, x + 50), CRes.random(y - 40, y), 0);
				}
			}
			for (int i = 0; i < PM.p.Length; i++)
			{
				if (PM.p[i] == null)
				{
					continue;
				}
				if (PM.p[i].bossType == 4)
				{
					if (PM.p[i].index == index + 1)
					{
						PM.p[i].x = x - 20;
						PM.p[i].y = y + 50 + dbY[countB];
					}
					if (PM.p[i].index == index + 2)
					{
						PM.p[i].x = x + 20;
						PM.p[i].y = y + 50 + dbY[countB];
					}
				}
				if (PM.p[i].index == index + 2)
				{
					PM.p[i].x = x + 20;
					PM.p[i].y = y + 50 + dbY[countB];
				}
			}
		}
		if (bossType == 5)
		{
			if (ap != null)
			{
				if (ap.x < x)
				{
					isDrop = true;
				}
				if (ap.x < Camera.x - 100)
				{
					CCanvas.gameScr.airplanes.removeElement(ap);
					ap = null;
					isLanded = true;
					GameScr.cam.setPlayerMode(PM.curP);
				}
			}
			if (!isLanded)
			{
				if (ap == null && isDrop)
				{
					GameScr.cam.setPlayerMode(PM.curP);
				}
				else
				{
					GameScr.cam.setTargetPointMode(x, y);
				}
				if (isDrop && yGift_1 < y)
				{
					dyGift++;
					if (yGift_1 + dyGift > y)
					{
						dyGift = 0;
						yGift_1 = y;
						new Explosion(x, yGift_1, 1);
					}
					else
					{
						yGift_1 += dyGift;
					}
				}
			}
			if (state == 5 && !getGift)
			{
				getGift = true;
				new Explosion(x, y, 1);
			}
		}
		if (bossType == 6)
		{
			falling = false;
			if (!isGift_2)
			{
				yGift_2 -= 9;
				GameScr.cam.setTargetPointMode(x, yGift_2);
				if (yGift_2 < y)
				{
					dyGift++;
				}
				if (yGift_2 < y)
				{
					yGift_2 = y;
					if (dyGift > 40)
					{
						isGift_2 = true;
						GameScr.cam.setPlayerMode(PM.curP);
					}
				}
			}
			else
			{
				if (up)
				{
					yGift_2--;
				}
				if (down)
				{
					yGift_2++;
				}
				if (yGift_2 < y - 3)
				{
					down = true;
					up = false;
				}
				if (yGift_2 > y + 3)
				{
					down = false;
					up = true;
				}
			}
			if (state == 5 && !getGift)
			{
				getGift = true;
				new Explosion(x, y, 1);
			}
		}
		if (gunBack)
		{
			tBack++;
			updateFrameFire();
			if (tBack == 10)
			{
				tBack = 0;
				gunBack = false;
				updateFrameAngle();
			}
		}
		if (bulletType == 43)
		{
			camY += 2;
			GameScr.cam.setTargetPointMode(x, y + camY);
		}
		if (flyActive && bossType == 3)
		{
			flyTo(5);
			return;
		}
		camY = 0;
		switch (state)
		{
		case 0:
			updateCharStand();
			break;
		case 8:
			animHurt();
			break;
		case 7:
			animWin();
			break;
		}
		if (state != 1)
		{
			x2 = x;
		}
		dx = radius * CRes.cos(angle) >> 10;
		dy = radius * CRes.sin(angle) >> 10;
		dx2 = radius * CRes.cos(angle2) >> 10;
		dy2 = radius * CRes.sin(angle2) >> 10;
		dx3 = 14 * CRes.cos(angle) >> 10;
		dy3 = 14 * CRes.sin(angle) >> 10;
		dx4 = 65 * CRes.cos(angle) >> 10;
		dy4 = 65 * CRes.sin(angle) >> 10;
		if (isCom && !isFlyAvenger() && !flyPlayer && !isJump)
		{
			if (((CRes.abs(nextx - x) == 0 && !isRunSpeed) || (CRes.abs(x - nextx) <= 2 && isRunSpeed)) && ((CRes.abs(nexty - y) == 0 && !isRunSpeed) || (CRes.abs(nexty - y) <= 2 && isRunSpeed)) && (isMove || state == 1 || state == 0))
			{
				state = 0;
				updateFrameStand();
			}
			if (nextx < x && !falling)
			{
				CRes.outz("x= " + x + " nextx= " + nextx);
				move(2);
			}
			else if (nextx > x && !falling)
			{
				move(0);
			}
			if (nextx == x && nexty != y && state == 0 && !falling)
			{
				y = nexty;
			}
		}
		if (activeFallbyEx && !BM.active)
		{
			falling = true;
			activeFallbyEx = false;
			isActiveFall = true;
		}
		if (falling)
		{
			fall();
		}
		if (!isUsedItem && index == GameScr.myIndex)
		{
			angleReset();
		}
		if (poisonEff)
		{
			tPEff++;
			if (tPEff == 20)
			{
				tPEff = 0;
				poisonEff = false;
				CCanvas.lockNotify = true;
			}
			if (CCanvas.gameTick % 2 == 0)
			{
				new Explosion(CRes.random(x - 10, x + 10), CRes.random(y - 20, y + 2), 10);
			}
		}
		if (state == 1 || flyActive)
		{
			if (!isFlyAvenger())
			{
				if (((CRes.abs(x - xToNow) == 0 && !isRunSpeed) || (CRes.abs(x - xToNow) <= 2 && isRunSpeed)) && ((CRes.abs(y - yToNow) == 0 && !isRunSpeed) || (CRes.abs(y - yToNow) <= 2 && isRunSpeed)) && isMove)
				{
					isMove = false;
					state = 0;
					CRes.outz("DA TOI NOI DA TOI NOI DA TOI NOI x= " + x + "y = " + y);
					mSystem.mNotify();
				}
			}
			else if ((CCanvas.isTouch && index == MyMidlet.myInfo.index && GameScr.curFocus != 5 && GameScr.curFocus != 6 && !isPointerMove) || isCom)
			{
				float num5 = runSpeed;
				if (isRunSpeed)
				{
					num5 = 4f;
				}
				if (CScreen.isUseHighFrameRate())
				{
					num5 /= 2f;
					if (num5 < 1f)
					{
						num5 = 1f;
					}
				}
				isPoint = false;
				if ((float)Math.abs((int)((float)xToNow - x2)) <= num5)
				{
					x2 = xToNow;
				}
				else if ((float)xToNow - x2 > num5)
				{
					if (movePoint < (float)MAX_MOVE_POINT)
					{
						if (!isPoint)
						{
							isPoint = true;
							if (!CScreen.highFrameRate())
							{
								movePoint += 2f;
							}
						}
						x2 += num5;
						updateFrameMove2(0);
						isMoveAvenger = true;
					}
				}
				else if ((float)xToNow - x2 < num5 && movePoint < (float)MAX_MOVE_POINT)
				{
					if (!isPoint)
					{
						isPoint = true;
						if (!CScreen.highFrameRate())
						{
							movePoint += 2f;
						}
					}
					x2 -= num5;
					updateFrameMove2(2);
					isMoveAvenger = true;
				}
				if ((float)Math.abs(yToNow - y) <= num5)
				{
					y = yToNow;
					nexty = y;
				}
				else if ((float)(yToNow - y) > num5)
				{
					if (movePoint < (float)MAX_MOVE_POINT)
					{
						if (!isPoint)
						{
							isPoint = true;
							if (!CScreen.highFrameRate())
							{
								movePoint += 2f;
							}
						}
						y += (int)num5;
						nexty = y;
						updateFrameMove2(look);
						isMoveAvenger = true;
					}
				}
				else if ((float)(yToNow - y) < num5 && movePoint < (float)MAX_MOVE_POINT)
				{
					if (!isPoint)
					{
						isPoint = true;
						if (!CScreen.highFrameRate())
						{
							movePoint += 2f;
						}
					}
					updateFrameMove2(look);
					nexty = y;
					y -= (int)num5;
					isMoveAvenger = true;
				}
				x = (int)x2;
				if (((x == xToNow && y == yToNow) || (movePoint >= (float)MAX_MOVE_POINT && index == MyMidlet.myInfo.index)) && !isFreeze)
				{
					xToNow = x;
					yToNow = y;
					flyActive = false;
					CRes.outz("|||||||||||||||| send move");
					if (index == MyMidlet.myInfo.index && ((!CCanvas.keyHold[2] && !CCanvas.keyHold[4] && !CCanvas.keyHold[6] && !CCanvas.keyHold[8]) || CCanvas.keyHasJustRelease))
					{
						GameService.gI().move((short)PM.getMyPlayer().xToNow, (short)PM.getMyPlayer().yToNow);
					}
					state = 0;
					if (CCanvas.isTouch)
					{
						isMoveAvenger = false;
					}
				}
			}
		}
		if (isRemoveGun)
		{
			updateFrameRemoveGun();
		}
		if (isGetGun)
		{
			updateFrameGetGun();
		}
		if (isMove)
		{
			tMove++;
			if (tMove == 200)
			{
				tMove = 0;
				x = xToNow;
				y = yToNow;
				tMove = 0;
				isMove = false;
				mSystem.mNotify();
			}
		}
	}

	private void updateFrameMove2(int directMove)
	{
		if (state == 3)
		{
			return;
		}
		lookAngle = look;
		switch (directMove)
		{
		case 2:
			if (look != 2)
			{
				angle = 180 - angle;
			}
			look = 2;
			break;
		case 0:
			if (look != 0)
			{
				angle = 180 - angle;
			}
			look = 0;
			break;
		}
	}

	public void changeDirection(int x1)
	{
		if (x < x1)
		{
			look = (lookAngle = 0);
		}
		else
		{
			look = (lookAngle = 2);
		}
	}

	private void updateChangeGun()
	{
		int num = ((!CScreen.isUseHighFrameRate()) ? 3 : 6);
		dem++;
		if (dem >= fRemoveGun.Length * num)
		{
			dem = 0;
			isChangeGun = false;
			isGetGun = true;
			wp = gunChage;
			gun = BulletForGun.getBull(wp).bullType;
		}
		else
		{
			cf = fRemoveGun[dem / num];
		}
	}

	public void angleReset()
	{
		if (gun <= 18)
		{
			if (look == 2 && angle > 180 - angleLock[gun])
			{
				angle = 180 - angleLock[gun];
			}
			if (look == 0 && angle < angleLock[gun])
			{
				angle = angleLock[gun];
			}
		}
	}

	public void checkNomarShoot()
	{
		if (look == 2)
		{
			if (angle > 180 - angleLock[gun])
			{
				angle = 180 - angleLock[gun];
			}
			if (angle < 91)
			{
				angle = 91;
			}
		}
		if (look == 0)
		{
			if (angle < angleLock[gun])
			{
				angle = angleLock[gun];
			}
			if (angle > 89)
			{
				angle = 89;
			}
		}
	}

	public void angleUpdate()
	{
		if (!isUsedItem)
		{
			checkNomarShoot();
			return;
		}
		if (look == 2)
		{
			if (itemUsed == 20)
			{
				if (angle > 225)
				{
					angle = 225;
				}
				if (angle < 180)
				{
					angle = 180;
				}
			}
			else if (itemUsed == 22)
			{
				if (angle != 91)
				{
					angle = 91;
					curFrame = 3;
				}
			}
			else if (itemUsed == 23)
			{
				angle = -269;
			}
			else
			{
				checkNomarShoot();
			}
		}
		if (look != 0)
		{
			return;
		}
		if (itemUsed == 20)
		{
			if (angle > 0)
			{
				angle = 0;
			}
			if (angle < -45)
			{
				angle = -45;
			}
		}
		else if (itemUsed == 22)
		{
			if (angle != 89)
			{
				angle = 89;
				curFrame = 3;
			}
		}
		else if (itemUsed == 23)
		{
			angle = -89;
		}
		else
		{
			checkNomarShoot();
		}
	}

	public void fall()
	{
		if (isFlyAvenger() && state != 5)
		{
			return;
		}
		if (flyPlayer || isCapture)
		{
			if (gun == 25 || gun == 26)
			{
				falling = false;
				isActiveFall = false;
				if (state == 5)
				{
					new Explosion(x, y, 1);
					isPaint = false;
				}
				return;
			}
			if (state != 5)
			{
				falling = false;
				isActiveFall = false;
				return;
			}
		}
		if (y > MM.mapHeight + 200)
		{
			isShooting = false;
			if (isActiveFall)
			{
				isAllowSendPosAfterShoot = true;
				isActiveFall = false;
				if (state != 5 && GameScr.myIndex == index && !isSendM_autoDie)
				{
					GameService.gI().requiredUpdateXY((short)x, (short)y);
					isSendM_autoDie = true;
				}
				falling = false;
			}
			nexty = y;
			if (state != 1)
			{
				resetLastUpdateXY(x, y);
			}
		}
		else
		{
			if ((CScreen.isUseHighFrameRate() && CScreen.highFrameRate()) || !CScreen.isUseHighFrameRate())
			{
				vy += g;
			}
			int num = y + vy;
			int num2 = Math.abs(num - y);
			for (int i = 0; i <= num2; i++)
			{
				if (GameScr.mm.isLand(x, y))
				{
					vy = 0;
					falling = false;
					if (isActiveFall)
					{
						isAllowSendPosAfterShoot = true;
						isActiveFall = false;
					}
					nexty = y;
					if (MenuScr.IS_TEST_POS)
					{
						CRes.outz(name + " " + x + " " + y);
					}
					if (state != 1)
					{
						resetLastUpdateXY(x, y);
					}
					if (index == GameScr.myIndex && state != 1 && !BM.active && chophepGuiUpdateXY && itemUsed == 23)
					{
						GameScr.pm.updatePlayerXY(index, (short)x, (short)y);
					}
					return;
				}
				y++;
			}
		}
		if (MM.isHaveWaterOrGlass && !isWaterBum && MM.checkWaterBum(x, y, 2))
		{
			isWaterBum = true;
		}
	}

	private int getDistance(int x1, int y1, int x2, int y2)
	{
		return Math.Sqrt((x2 - x1) * (x2 - x1) + (y2 - y1) * (y2 - y1));
	}

	public void holdFire2()
	{
		int num = 0;
		num = ((imgCircle == null) ? 100 : mGraphics.getImageWidth(imgCircle));
		int num2 = x - 3;
		int y = this.y - 12;
		if (CCanvas.px + Camera.x < num2)
		{
			look = 0;
		}
		else
		{
			look = 2;
		}
		int distance = getDistance(CCanvas.px + Camera.x, CCanvas.py + Camera.y, num2, y);
		distance -= num >> 1;
		if (distance < 0)
		{
			distance = 0;
		}
		if (distance > maxforce)
		{
			distance = maxforce;
		}
		if (!isFrameWithGun())
		{
			isGetGun = true;
		}
		if (isShooting)
		{
			return;
		}
		CCanvas.keyPressed[12] = false;
		CCanvas.keyPressed[13] = false;
		if (state != 3 && distance > 1)
		{
			state = 3;
			initBull();
			if (!isUsedItem)
			{
				isDoublePower = Bullet.isDoubleBull(bulletType);
			}
			else if (itemUsed == 100)
			{
				isDoublePower = Bullet.isDoubleBull(bulletType);
			}
			else if (is2TurnItem)
			{
				isDoublePower = Bullet.isDoubleBull(bulletType);
			}
			else
			{
				isDoublePower = false;
			}
			CRes.outz("READY SHOOT");
		}
		else if (!isDoublePower)
		{
			force = distance;
		}
		else if (!isSecondPower)
		{
			force = distance;
		}
		else
		{
			force_2 = distance;
		}
	}

	public void holdFire()
	{
		if (state == 1)
		{
			return;
		}
		isHoldFire = true;
		if (!isFrameWithGun())
		{
			isGetGun = true;
		}
		if (isShooting)
		{
			return;
		}
		CCanvas.keyPressed[12] = false;
		CCanvas.keyPressed[13] = false;
		if (state != 3 && force > 1f)
		{
			state = 3;
			initBull();
			if (!isUsedItem)
			{
				isDoublePower = Bullet.isDoubleBull(bulletType);
			}
			else if (itemUsed == 100)
			{
				isDoublePower = Bullet.isDoubleBull(bulletType);
			}
			else if (is2TurnItem)
			{
				isDoublePower = Bullet.isDoubleBull(bulletType);
			}
			else
			{
				isDoublePower = false;
			}
			GameScr.time.stop();
			CRes.outz("READY SHOOT");
		}
		else if (!isDoublePower)
		{
			force += powerSpeed;
			if (force >= (float)maxforce)
			{
				shoot();
				if (Bullet.isDoubleBull(bulletType))
				{
					isDoublePower = true;
				}
				CScreen.clearKey();
				isStopFire = true;
			}
		}
		else if (!isSecondPower)
		{
			force += powerSpeed;
			if (force >= (float)maxforce)
			{
				isSecondPower = true;
			}
		}
		else
		{
			force_2 += powerSpeed;
			if (force_2 >= (float)maxforce)
			{
				shoot();
				isSecondPower = false;
				CScreen.clearKey();
				isStopFire = true;
			}
		}
	}

	public void fire()
	{
		if (!isDoublePower)
		{
			if (force > 1f && state == 3)
			{
				state = 2;
				shoot();
				GameScr.time.stop();
				CScreen.clearKey();
				force = 0f;
			}
			else
			{
				force = 0f;
			}
		}
		else if (state == 3)
		{
			if (!isSecondPower)
			{
				isSecondPower = true;
			}
			else if (force_2 > 1f)
			{
				state = 2;
				shoot();
				GameScr.time.stop();
				isSecondPower = false;
				CScreen.clearKey();
				force = 0f;
				force_2 = 0f;
			}
		}
		else
		{
			force = 0f;
			force_2 = 0f;
		}
	}

	public void inputAngle()
	{
		if (GameScr.myIndex != index || state == 8)
		{
			return;
		}
		if (CCanvas.isPointer(CCanvas.hw - 30, CCanvas.h - 46, 33, 33))
		{
			GameScr.curFocus = 12;
			CCanvas.isPointerClick = false;
			CCanvas.isPointerDown = false;
			if (look == 0)
			{
				angle++;
				if (angle > 89)
				{
					angle = 89;
				}
				else
				{
					angle2++;
				}
			}
			else
			{
				angle--;
				if (angle < 90)
				{
					angle = 90;
				}
				else
				{
					angle2--;
				}
			}
			updateFrameAngle();
		}
		if (!CCanvas.isPointer(CCanvas.hw + 30, CCanvas.h - 46, 33, 33))
		{
			return;
		}
		GameScr.curFocus = 13;
		CCanvas.isPointerClick = false;
		CCanvas.isPointerDown = false;
		if (look == 0)
		{
			angle--;
			if (angle < angleLock[gun])
			{
				angle = angleLock[gun];
			}
			else
			{
				angle2--;
			}
		}
		else
		{
			angle++;
			if (angle > 180 - angleLock[gun])
			{
				angle = 180 - angleLock[gun];
			}
			else
			{
				angle2++;
			}
		}
		updateFrameAngle();
	}

	private void moveAvengerRPG(int directMove)
	{
		Camera.setPlayerModeRPG();
		if (CCanvas.curScr == CCanvas.gameScr && this == PM.getMyPlayer2())
		{
			CCanvas.gameScr.iFreeMode = 0;
			GameScr.cam.setPlayerMode(PM.curP);
		}
		runSpeed = 3;
		GameScrRPG.pm.nextTurnTimer = 0;
		PM.getMyPlayer2().target = CCanvas.gameScrRPG.searchNearTarget();
		if (isFrameWithGun() && isRunSpeed && !isRemoveGun)
		{
			isRemoveGun = true;
			cf = fRemoveGun[0];
		}
		if (isRemoveGun)
		{
			getPlayerAngle();
			return;
		}
		getPlayerAngle();
		if (state != 3)
		{
			lookAngle = look;
			switch (directMove)
			{
			case 2:
				if (look != 2)
				{
					angle = 180 - angle;
				}
				look = 2;
				break;
			case 0:
				if (look != 0)
				{
					angle = 180 - angle;
				}
				look = 0;
				break;
			}
		}
		if (state == 0 || state == 2 || state == 8)
		{
			state = 1;
			curFrame = 4;
		}
		if (isFreeze || state != 1)
		{
			return;
		}
		if (index == GameScrRPG.myIndex)
		{
			alpha -= 10;
			if (alpha < 125)
			{
				alpha = 125;
			}
		}
		if (!isActiveFall)
		{
			isActiveFall = true;
		}
		float num = runSpeed;
		updateCharStand();
		switch (directMove)
		{
		case 2:
			x2 -= num;
			break;
		case 0:
			x2 += num;
			break;
		case 1:
			y -= (int)num;
			break;
		case 3:
			y += (int)num;
			break;
		}
		if (x2 < 10f)
		{
			x2 = 10f;
		}
		if (x2 > (float)(CMapRPG.pxw - 10))
		{
			x2 = CMapRPG.pxw - 10;
		}
		if (y < 0)
		{
			y = 0;
		}
		if (y > CMapRPG.pxh - 50)
		{
			y = CMapRPG.pxh - 50;
		}
		x = (int)x2;
		xToNow = x;
		yToNow = y;
	}

	private void moveAvenger(int directMove)
	{
		if (this == PM.getMyPlayer())
		{
			CCanvas.gameScr.iFreeMode = 0;
			GameScr.cam.setPlayerMode(PM.curP);
		}
		CCanvas.keyPressed[5] = false;
		GameScr.pm.nextTurnTimer = 0;
		if (isRemoveGun)
		{
			getPlayerAngle();
			return;
		}
		getPlayerAngle();
		if (state != 3)
		{
			lookAngle = look;
			switch (directMove)
			{
			case 2:
				if (look != 2)
				{
					angle = 180 - angle;
				}
				look = 2;
				break;
			case 0:
				if (look != 0)
				{
					angle = 180 - angle;
				}
				look = 0;
				break;
			}
		}
		if (CCanvas.isTouch && (CCanvas.keyHold[2] || CCanvas.keyHold[4] || CCanvas.keyHold[6] || CCanvas.keyHold[8]))
		{
			return;
		}
		if (state == 0 || state == 2 || state == 8)
		{
			state = 1;
			curFrame = 4;
		}
		if (isFreeze || state != 1)
		{
			return;
		}
		if (index == GameScr.myIndex)
		{
			alpha -= 10;
			if (alpha < 125)
			{
				alpha = 125;
			}
		}
		if (!isActiveFall)
		{
			isActiveFall = true;
		}
		if (MM.isHaveWaterOrGlass && GameScr.exs.size() == 0)
		{
			MM.checkWaterBum(x, y, 0);
		}
		float num = runSpeed;
		if (isRunSpeed)
		{
			num = 4f;
		}
		if (CScreen.isUseHighFrameRate())
		{
			num /= 2f;
		}
		if (!isCom)
		{
			if (movePoint >= (float)MAX_MOVE_POINT)
			{
				return;
			}
			if (!isPoint)
			{
				isPoint = true;
				if (!CScreen.highFrameRate())
				{
					movePoint += 2f;
				}
			}
			if (isPointerMove && !CScreen.highFrameRate())
			{
				movePoint += 2f;
			}
		}
		updateCharStand();
		switch (directMove)
		{
		case 2:
			x2 -= num;
			break;
		case 0:
			x2 += num;
			break;
		case 1:
			y -= (int)num;
			break;
		case 3:
			y += (int)num;
			break;
		}
		if (x2 < 10f)
		{
			if (!CScreen.highFrameRate())
			{
				movePoint -= 2f;
			}
			x2 = 10f;
		}
		if (x2 > (float)(MM.mapWidth - 10))
		{
			if (!CScreen.highFrameRate())
			{
				movePoint -= 2f;
			}
			x2 = MM.mapWidth - 10;
		}
		if (y < 0)
		{
			if (!CScreen.highFrameRate())
			{
				movePoint -= 2f;
			}
			y = 0;
		}
		if (y > MM.mapHeight - 50)
		{
			if (!CScreen.highFrameRate())
			{
				movePoint -= 2f;
			}
			y = MM.mapHeight - 50;
		}
		x = (int)x2;
		if (movePoint >= (float)MAX_MOVE_POINT)
		{
			GameService.gI().move((short)x, (short)y);
			lastx = (short)x;
		}
	}

	public virtual void input()
	{
		if (PM.getMyPlayer() == null || isStopFire || CCanvas.currentDialog != null || Camera.mode == 0 || ((isCom || !active) && !GameScr.trainingMode))
		{
			return;
		}
		if (state != 5 && PM.curP == GameScr.myIndex)
		{
			if (isFlyAvenger())
			{
				if (isMoveAvenger)
				{
					isPoint = false;
					isPointerMove = false;
					if (CCanvas.keyHold[2] && !CCanvas.keyHold[8])
					{
						moveAvenger(1);
					}
					if (CCanvas.keyHold[8] && !CCanvas.keyHold[2])
					{
						moveAvenger(3);
					}
					if (CCanvas.keyHold[4] && !CCanvas.keyHold[6] && !CCanvas.keyHold[5])
					{
						moveAvenger(2);
					}
					if (CCanvas.keyHold[6] && !CCanvas.keyHold[4] && !CCanvas.keyHold[5])
					{
						moveAvenger(0);
					}
				}
				else
				{
					if (CCanvas.keyHold[4] && !CCanvas.keyHold[6] && !CCanvas.keyHold[5] && !CCanvas.keyHold[2] && !CCanvas.keyHold[8])
					{
						moveAvenger(2);
					}
					if (CCanvas.keyHold[6] && !CCanvas.keyHold[4] && !CCanvas.keyHold[5] && !CCanvas.keyHold[2] && !CCanvas.keyHold[8])
					{
						moveAvenger(0);
					}
					if (CCanvas.keyHold[2] && !CCanvas.keyHold[4] && !CCanvas.keyHold[6])
					{
						delayCount++;
						if (look == 0)
						{
							aimUp();
						}
						else
						{
							aimDown();
						}
					}
					if (CCanvas.keyHold[8] && !CCanvas.keyHold[4] && !CCanvas.keyHold[6])
					{
						delayCount++;
						if (look == 0)
						{
							aimDown();
						}
						else
						{
							aimUp();
						}
					}
				}
			}
			else
			{
				if (CCanvas.keyHold[2] && !falling && !CCanvas.keyHold[4] && !CCanvas.keyHold[6])
				{
					delayCount++;
					if (look == 0)
					{
						aimUp();
					}
					else
					{
						aimDown();
					}
				}
				if (CCanvas.keyHold[8] && !falling && !CCanvas.keyHold[4] && !CCanvas.keyHold[6])
				{
					delayCount++;
					if (look == 0)
					{
						aimDown();
					}
					else
					{
						aimUp();
					}
				}
				if (CCanvas.keyHold[4] && !falling && !CCanvas.keyHold[6] && !CCanvas.keyHold[5] && !CCanvas.keyHold[2] && !CCanvas.keyHold[8])
				{
					isHoldMove = true;
					if (!isFlyAvenger())
					{
						move(2);
					}
					else
					{
						moveAvenger(2);
						state = 0;
					}
				}
				if (CCanvas.keyHold[6] && !falling && !CCanvas.keyHold[4] && !CCanvas.keyHold[5] && !CCanvas.keyHold[2] && !CCanvas.keyHold[8])
				{
					isHoldMove = true;
					if (!isFlyAvenger())
					{
						move(0);
					}
					else
					{
						moveAvenger(0);
						state = 0;
					}
				}
			}
			if (CCanvas.keyReleased[2] || CCanvas.keyReleased[8])
			{
				delayCount = 0;
			}
			if (!CCanvas.isTouch || !CCanvas.keyHasJustRelease)
			{
				if (isFlyAvenger())
				{
					if (!isMoveAvenger && !isShooting && CCanvas.keyHold[5] && !CCanvas.keyHold[4] && !CCanvas.keyHold[6])
					{
						holdFire();
						GameScr.pm.nextTurnTimer = 0;
					}
					if (isMoveAvenger && !CCanvas.isTouch && CCanvas.keyPressed[5])
					{
						isMoveAvenger = false;
						CCanvas.keyPressed[5] = false;
						CCanvas.keyHold[5] = false;
					}
				}
				else if (!isShooting && CCanvas.keyHold[5] && !falling && !CCanvas.keyHold[4] && !CCanvas.keyHold[6])
				{
					holdFire();
					GameScr.pm.nextTurnTimer = 0;
				}
			}
			if (state == 1)
			{
				if (!isFlyAvenger() && ((!CCanvas.isTouch && ((!CCanvas.keyHold[4] && look == 2) || (!CCanvas.keyHold[6] && look == 0))) || (CCanvas.isTouch && CCanvas.isPointerJustRelease && !CCanvas.isPointerDown)))
				{
					CRes.outz("REALESAS");
					state = 0;
					if (!isFrameWithGun())
					{
						cf = 7;
					}
					else
					{
						updateFrameAngle();
					}
					if (lastx != x && !CCanvas.isPointerDown)
					{
						GameService.gI().move((short)x, (short)y);
						lastx = (short)x;
					}
					else
					{
						lastx = (short)x;
					}
				}
				if (isFlyAvenger() && !CCanvas.isTouch && ((!CCanvas.keyHold[4] && look == 2 && !CCanvas.keyHold[2] && !CCanvas.keyHold[8]) || (!CCanvas.keyHold[6] && look == 0 && !CCanvas.keyHold[2] && !CCanvas.keyHold[8])))
				{
					state = 0;
					if (!isFrameWithGun())
					{
						cf = 7;
					}
					else
					{
						updateFrameAngle();
					}
					if ((lastx != x || lasty != y) && !CCanvas.isPointerDown && movePoint < (float)MAX_MOVE_POINT)
					{
						GameService.gI().move((short)x, (short)y);
						lastx = (short)x;
						lasty = (short)y;
					}
					else
					{
						lastx = (short)x;
						lasty = (short)y;
					}
				}
			}
			if (!isFlyAvenger())
			{
				if ((CCanvas.keyPressed[2] || CCanvas.keyPressed[8]) && !CCanvas.keyHold[2] && !CCanvas.keyHold[8])
				{
					CCanvas.clearKeyPressed();
					delayCount = 0;
				}
			}
			else if (!isMoveAvenger && (CCanvas.keyPressed[2] || CCanvas.keyPressed[8]) && !CCanvas.keyHold[2] && !CCanvas.keyHold[8])
			{
				CCanvas.clearKeyPressed();
				delayCount = 0;
			}
		}
		if (CCanvas.keyHasJustRelease)
		{
			if (isHoldMove)
			{
				state = 0;
				isHoldMove = false;
				updateFrameAngle();
				if (lastx != x && !CCanvas.isPointerDown)
				{
					GameService.gI().move((short)x, (short)y);
					lastx = (short)x;
				}
				else
				{
					lastx = (short)x;
				}
			}
			if (isHoldFire)
			{
				isHoldFire = false;
				fire();
			}
			CCanvas.keyHasJustRelease = false;
		}
		if (CCanvas.isPointerJustRelease && (isHoldFire || isHoldAngle || isHoldMove || isDrag))
		{
			isHoldAngle = false;
			if (isHoldFire)
			{
				isHoldFire = false;
				if (hasDrag)
				{
					if (isDoublePower)
					{
						if (force > 0f && force_2 > 0f)
						{
							fire();
						}
					}
					else if (force > 0f)
					{
						fire();
					}
				}
				else
				{
					fire();
				}
			}
			if (isHoldMove)
			{
				state = 0;
				isHoldMove = false;
				updateFrameAngle();
				if (lastx != x && !CCanvas.isPointerDown && movePoint < (float)MAX_MOVE_POINT)
				{
					GameService.gI().move((short)x, (short)y);
					lastx = (short)x;
				}
				else
				{
					lastx = (short)x;
				}
			}
			GameScr.curFocus = -1;
			t = 0;
			CCanvas.isPointerJustRelease = false;
		}
		if (!CCanvas.isTouch || Camera.mode == 0 || !GameScr.pm.isYourTurn())
		{
			return;
		}
		if (CCanvas.isPointerDown)
		{
			t++;
			if (t == 1 && CCanvas.isPointer(CScreen.w - 40, CScreen.h - 34, 40, 34))
			{
				isHoldFire = true;
				GameScr.curFocus = 4;
			}
			if (CCanvas.isPointer(0, CCanvas.h - 50, CCanvas.w, 50) && GameScr.pm.isYourTurn())
			{
				if (CCanvas.isPointer(0, CScreen.h - 34, 35, 34))
				{
					isPointerMove = true;
					isHoldMove = true;
					GameScr.curFocus = 5;
					if (!isFlyAvenger())
					{
						move(2);
					}
					else
					{
						moveAvenger(2);
					}
				}
				else if (CCanvas.isPointer(35, CScreen.h - 34, 35, 34))
				{
					isPointerMove = true;
					isHoldMove = true;
					GameScr.curFocus = 6;
					if (!isFlyAvenger())
					{
						move(0);
					}
					else
					{
						moveAvenger(0);
					}
				}
				else
				{
					isPointerMove = false;
				}
			}
		}
		if (!CCanvas.isPointerDown || isHoldAngle || isShooting || !GameScr.pm.isYourTurn())
		{
			return;
		}
		if (isFlyAvenger())
		{
			if (CCanvas.isPointer(CScreen.w - 40, CScreen.h - 34, 40, 34))
			{
				holdFire();
				GameScr.pm.nextTurnTimer = 0;
			}
			else if (isHoldFire)
			{
				isHoldFire = false;
				CCanvas.isPointerJustRelease = true;
				CCanvas.isPointerClick = true;
				CCanvas.isPointerDown = false;
			}
		}
		else if (CCanvas.isPointer(CScreen.w - 40, CScreen.h - 34, 40, 34) && !falling)
		{
			holdFire();
			GameScr.pm.nextTurnTimer = 0;
		}
		else if (isHoldFire)
		{
			isHoldFire = false;
			CCanvas.isPointerJustRelease = true;
			CCanvas.isPointerClick = true;
			CCanvas.isPointerDown = false;
		}
	}

	public void input2()
	{
		if (isStopFire || CCanvas.currentDialog != null || Camera.mode == 0)
		{
			return;
		}
		if (state != 5)
		{
			if (isFlyAvenger())
			{
				isPoint = false;
				isPointerMove = false;
				if (CCanvas.keyHold[2] && !CCanvas.keyHold[8])
				{
					isHoldMove = true;
					moveAvengerRPG(1);
				}
				if (CCanvas.keyHold[8] && !CCanvas.keyHold[2])
				{
					isHoldMove = true;
					moveAvengerRPG(3);
				}
				if (CCanvas.keyHold[4] && !CCanvas.keyHold[6] && !CCanvas.keyHold[5])
				{
					isHoldMove = true;
					moveAvengerRPG(2);
				}
				if (CCanvas.keyHold[6] && !CCanvas.keyHold[4] && !CCanvas.keyHold[5])
				{
					isHoldMove = true;
					moveAvengerRPG(0);
				}
			}
			else
			{
				if (CCanvas.keyHold[4] && !CCanvas.keyHold[6] && !CCanvas.keyHold[5] && !CCanvas.keyHold[8])
				{
					isHoldMove = true;
					if (!isFlyAvenger())
					{
						move2(2);
					}
					else
					{
						moveAvengerRPG(2);
					}
				}
				if (CCanvas.keyHold[6] && !CCanvas.keyHold[4] && !CCanvas.keyHold[5] && !CCanvas.keyHold[8])
				{
					isHoldMove = true;
					if (!isFlyAvenger())
					{
						move2(0);
					}
					else
					{
						moveAvengerRPG(0);
					}
				}
			}
			if (CCanvas.keyReleased[2] || CCanvas.keyReleased[8])
			{
				delayCount = 0;
			}
			if (state == 1)
			{
				if (!isFlyAvenger() && ((!CCanvas.isTouch && ((!CCanvas.keyHold[4] && look == 2) || (!CCanvas.keyHold[6] && look == 0))) || (CCanvas.isTouch && CCanvas.isPointerJustRelease && !CCanvas.isPointerDown)))
				{
					CRes.outz("REALESAS");
					state = 0;
					if (!isFrameWithGun())
					{
						cf = 7;
					}
					else
					{
						updateFrameAngle();
					}
					if (lastx != x && !CCanvas.isPointerDown)
					{
						GameService.gI().moveRPG((short)x, (short)y);
						lastx = (short)x;
					}
					else
					{
						lastx = (short)x;
					}
				}
				if (isFlyAvenger() && !CCanvas.isTouch && ((!CCanvas.keyHold[4] && look == 2 && !CCanvas.keyHold[2] && !CCanvas.keyHold[8]) || (!CCanvas.keyHold[6] && look == 0 && !CCanvas.keyHold[2] && !CCanvas.keyHold[8])))
				{
					state = 0;
					if (!isFrameWithGun())
					{
						cf = 7;
					}
					else
					{
						updateFrameAngle();
					}
					if ((lastx != x || lasty != y) && !CCanvas.isPointerDown)
					{
						GameService.gI().moveRPG((short)x, (short)y);
						lastx = (short)x;
						lasty = (short)y;
					}
					else
					{
						lastx = (short)x;
						lasty = (short)y;
					}
				}
			}
			if (!isFlyAvenger())
			{
				if ((CCanvas.keyPressed[2] || CCanvas.keyPressed[8]) && !CCanvas.keyHold[2] && !CCanvas.keyHold[8])
				{
					CCanvas.clearKeyPressed();
					delayCount = 0;
				}
			}
			else if (!isMoveAvenger && (CCanvas.keyPressed[2] || CCanvas.keyPressed[8]) && !CCanvas.keyHold[2] && !CCanvas.keyHold[8])
			{
				CCanvas.clearKeyPressed();
				delayCount = 0;
			}
		}
		if (CCanvas.keyHasJustRelease)
		{
			if (isHoldMove)
			{
				state = 0;
				isHoldMove = false;
				updateFrameAngle();
				if (!isFlyAvenger())
				{
					if (lastx != x && !CCanvas.isPointerDown)
					{
						GameService.gI().moveRPG((short)x, (short)y);
						lastx = (short)x;
					}
					else
					{
						lastx = (short)x;
					}
				}
				else if ((lastx != x || lasty != y) && !CCanvas.isPointerDown)
				{
					GameService.gI().moveRPG((short)x, (short)y);
					lastx = (short)x;
					lasty = (short)y;
				}
				else
				{
					lastx = (short)x;
					lasty = (short)y;
				}
			}
			if (isHoldFire)
			{
				isHoldFire = false;
			}
			CCanvas.keyHasJustRelease = false;
		}
		if (CCanvas.isPointerJustRelease && isHoldMove)
		{
			isHoldAngle = false;
			if (isHoldMove)
			{
				state = 0;
				isHoldMove = false;
				updateFrameAngle();
				if (lastx != x && !CCanvas.isPointerDown)
				{
					GameService.gI().moveRPG((short)x, (short)y);
					lastx = (short)x;
				}
				else
				{
					lastx = (short)x;
				}
			}
			GameScrRPG.curFocus = -1;
			t = 0;
			CCanvas.isPointerJustRelease = false;
		}
		if (CCanvas.keyPressed[13])
		{
			int num = CCanvas.gameScrRPG.nextTarget(target);
			if (num != -1)
			{
				target = num;
			}
		}
		if (CCanvas.keyPressed[5])
		{
			doFireRPG();
			CCanvas.menu.menuSelectedItem = 0;
			keyChatNPC = true;
		}
		if (!CCanvas.isTouch || Camera.mode == 0)
		{
			return;
		}
		if (CCanvas.isPointerDown)
		{
			t++;
			if (CCanvas.isPointer(0, CCanvas.h - 50, CCanvas.w, 50))
			{
				if (CCanvas.isPointer(0, CScreen.h - 34, 35, 34))
				{
					isPointerMove = true;
					isHoldMove = true;
					GameScrRPG.curFocus = 5;
					if (!isFlyAvenger())
					{
						move2(2);
					}
					else
					{
						moveAvengerRPG(2);
					}
				}
				else if (CCanvas.isPointer(35, CScreen.h - 34, 35, 34))
				{
					isPointerMove = true;
					isHoldMove = true;
					GameScrRPG.curFocus = 6;
					if (!isFlyAvenger())
					{
						move2(0);
					}
					else
					{
						moveAvengerRPG(0);
					}
				}
				else
				{
					isPointerMove = false;
				}
			}
		}
		if (CCanvas.isPointerDown)
		{
			if (isFlyAvenger())
			{
				if (CCanvas.isPointer(CScreen.w - 40, CScreen.h - 34, 40, 34))
				{
					GameScrRPG.curFocus = 4;
				}
			}
			else if (CCanvas.isPointer(CScreen.w - 40, CScreen.h - 34, 40, 34) && !falling)
			{
				GameScrRPG.curFocus = 4;
			}
		}
		if (!CCanvas.isPointerJustRelease)
		{
			return;
		}
		if (isFlyAvenger())
		{
			if (CCanvas.isPointer(CScreen.w - 40, CScreen.h - 34, 40, 34))
			{
				doFireRPG();
				GameScrRPG.curFocus = -1;
				CCanvas.isPointerJustRelease = false;
			}
		}
		else if (CCanvas.isPointer(CScreen.w - 40, CScreen.h - 34, 40, 34) && !falling)
		{
			doFireRPG();
			GameScrRPG.curFocus = -1;
			CCanvas.isPointerJustRelease = false;
		}
	}

	public void doFireRPG()
	{
		if (PM.getMyPlayer2().target == -1)
		{
			return;
		}
		if (PM.getMyPlayer2().npcFocus == null)
		{
			if (PM.p2[PM.getMyPlayer2().target] != null && !CCanvas.menu.showMenu && !PM.p2[PM.getMyPlayer2().target].isMe)
			{
				ChatPopupNR.currChatPopup = null;
				MyVector myVector = new MyVector("menu rpg");
				myVector.addElement(new Command("Giao dịch", CCanvas.gameScrRPG, 6, PM.p2[PM.getMyPlayer2().target]));
				myVector.addElement(new Command("Thách đấu", CCanvas.gameScrRPG, 7, PM.p2[PM.getMyPlayer2().target]));
				myVector.addElement(new Command("Xem thông tin", CCanvas.gameScrRPG, 9, PM.p2[PM.getMyPlayer2().target]));
				myVector.addElement(new Command("Kết bạn", CCanvas.gameScrRPG, 10, PM.p2[PM.getMyPlayer2().target]));
				CCanvas.menu.startAt(myVector, 0);
			}
			return;
		}
		if (PM.getMyPlayer2().npcFocus.x < PM.getMyPlayer2().x)
		{
			PM.getMyPlayer2().npcFocus.look = 0;
			PM.getMyPlayer2().look = (PM.getMyPlayer2().lookAngle = 2);
		}
		else
		{
			PM.getMyPlayer2().npcFocus.look = 2;
			PM.getMyPlayer2().look = (PM.getMyPlayer2().lookAngle = 0);
		}
		if (PM.getMyPlayer2().npcFocus.npcId == 0)
		{
			MyVector myVector2 = new MyVector("menu");
			myVector2.addElement(new Command("Quân dụng", CCanvas.gameScrRPG, 11, null));
			myVector2.addElement(new Command("Quân trang", CCanvas.gameScrRPG, 12, null));
			myVector2.addElement(new Command("Nâng cấp", CCanvas.gameScrRPG, 21, null));
			myVector2.addElement(new Command("Ghép ngọc", CCanvas.gameScrRPG, 22, null));
			if (!CCanvas.menu.showMenu)
			{
				CCanvas.menu.startAt(myVector2, 0);
				ChatPopupNR.addChatPopup(PM.getMyPlayer2().npcFocus.avatar, "Đồng chí cần gì không?", 100000, PM.getMyPlayer2().npcFocus.x, PM.getMyPlayer2().npcFocus.y - 50);
			}
		}
		else if (PM.getMyPlayer2().npcFocus.npcId == 1)
		{
			MyVector myVector3 = new MyVector("menu");
			myVector3.addElement(new Command("Biệt đội", CCanvas.gameScrRPG, 15, null));
			myVector3.addElement(new Command("Bạn bè", CCanvas.gameScrRPG, 16, null));
			myVector3.addElement(new Command("Xếp hạng", CCanvas.gameScrRPG, 17, null));
			myVector3.addElement(new Command("Thành tích", CCanvas.gameScrRPG, 18, null));
			if (!CCanvas.menu.showMenu)
			{
				CCanvas.menu.startAt(myVector3, 0);
				ChatPopupNR.addChatPopup(PM.getMyPlayer2().npcFocus.avatar, "Đồng chí cần tìm thông tin gì?", 100000, PM.getMyPlayer2().npcFocus.x, PM.getMyPlayer2().npcFocus.y - 50);
			}
		}
		else if (PM.getMyPlayer2().npcFocus.npcId == 2)
		{
			MyVector myVector4 = new MyVector("menu");
			if (Rms.loadRMSString("armyUser") == null || Rms.loadRMSString("armyUser").Equals(string.Empty))
			{
				myVector4.addElement(new Command(L.reg(), CCanvas.gameScrRPG, 31, null));
			}
			myVector4.addElement(new Command("Luyện tập", CCanvas.gameScrRPG, 20, null));
			bool flag = false;
			for (int i = 0; i < 4; i++)
			{
				Item[] array;
				switch (i)
				{
				case 0:
					array = arrItemBody;
					break;
				case 1:
					array = arrItemBag;
					break;
				case 2:
					array = arrItemBalo;
					break;
				default:
					array = arrItemBox;
					break;
				}
				for (int j = 0; j < array.Length; j++)
				{
					if (array[j] != null && array[j].HP < 90)
					{
						flag = true;
						break;
					}
				}
				if (flag)
				{
					break;
				}
			}
			if (flag)
			{
				myVector4.addElement(new Command("Sửa tất cả 1 ngọc", CCanvas.gameScrRPG, 30, null));
			}
			if (MenuScr.subMenuString[MenuScr.MENU_CUAHANG].Length == 4)
			{
				myVector4.addElement(new Command("Nạp vàng", CCanvas.gameScrRPG, 13, null));
				myVector4.addElement(new Command("Nạp ngọc", CCanvas.gameScrRPG, 14, null));
			}
			if (!CCanvas.menu.showMenu)
			{
				CCanvas.menu.startAt(myVector4, 0);
				ChatPopupNR.addChatPopup(PM.getMyPlayer2().npcFocus.avatar, "Chúng ta đang cần viện binh!", 100000, PM.getMyPlayer2().npcFocus.x, PM.getMyPlayer2().npcFocus.y - 50);
			}
		}
		else
		{
			GameService.gI().openMenu(PM.getMyPlayer2().npcFocus.npcId);
		}
	}

	public void move2(int directMove)
	{
		PM.getMyPlayer2().target = CCanvas.gameScrRPG.searchNearTarget();
		runSpeed = 4;
		isRunSpeed = true;
		if (isFrameWithGun() && isRunSpeed && !isRemoveGun)
		{
			isRemoveGun = true;
			cf = fRemoveGun[0];
		}
		getPlayerAngle();
		if (state != 10 && (state == 0 || state == 2 || state == 8))
		{
			state = 1;
			curFrame = 4;
		}
		if (state != 3)
		{
			lookAngle = look;
			switch (directMove)
			{
			case 2:
				if (look != 2)
				{
					angle = 180 - angle;
				}
				look = 2;
				break;
			case 0:
				if (look != 0)
				{
					angle = 180 - angle;
				}
				look = 0;
				break;
			}
		}
		if (state != 1 && state != 10)
		{
			return;
		}
		if (index == GameScr.myIndex)
		{
			alpha -= 10;
			if (alpha < 125)
			{
				alpha = 125;
			}
		}
		if (!isActiveFall)
		{
			isActiveFall = true;
		}
		float num = runSpeed;
		if (state == 1)
		{
			if (isRunSpeed)
			{
				updateFrameRun();
			}
			else
			{
				updateFrameMove();
			}
			animMove();
		}
		switch (directMove)
		{
		case 2:
			if (!GameScrRPG.map.checkTileCollisionLR((int)((float)x - num), y))
			{
				x -= (int)num;
			}
			break;
		case 0:
			if (!GameScrRPG.map.checkTileCollisionLR((int)((float)x + num), y))
			{
				x += (int)num;
			}
			break;
		}
		x2 = x;
		if ((GameScrRPG.map.tileTypeAtPixel(x, y) & 4) != 4)
		{
			falling = true;
		}
	}

	public void paint2(mGraphics g)
	{
		bool flag = false;
		if (PM.getMyPlayer2() != null && PM.getMyPlayer2().charFocus != null && PM.getMyPlayer2().target != -1 && PM.getMyPlayer2().target == index)
		{
			flag = true;
			g.drawImage(GameScr.imgHandThang, x, y - 60 + PM.nhun, 3, false);
		}
		painthp(g);
		mFont mFont2 = ((!isMe) ? mFont.tahoma_7_yellow : mFont.tahoma_7_blue1);
		if (name != null)
		{
			if (flag)
			{
				mFont2.drawString(g, name, x, y - 77, 2, mFont.tahoma_7_grey);
			}
			else
			{
				mFont2.drawString(g, name, x, y - 50, 2, mFont.tahoma_7_grey);
			}
		}
		if (isReady)
		{
			mFont.tahoma_7_white.drawString(g, L.ready(), x, y - 60, 2);
		}
		paintBody(g, x, y);
	}

	public bool beHurt(ShotRPG shot)
	{
		if (hp > 0 && shot.collidesWith(x - 10, y - 34, 20, 34))
		{
			if (hp > 0)
			{
				int num = hp - shot.power;
				EffecMn.addEff(new Effect(25, x, y + 20, 3, 1, 1));
				if (num <= 0)
				{
					num = 0;
					PM.getMyPlayer2().target = CCanvas.gameScrRPG.searchNearTarget();
					die();
				}
				updateHP2(num, (byte)((hp != 0) ? ((uint)(num * 25 / hp)) : 0u));
				hp = num;
			}
			return true;
		}
		return false;
	}

	public void updateHP2(int nextHP, byte pixel)
	{
		hpGoc = hp;
		CRes.outz("UPDATE HP nexHP= " + nextHP);
		bool flag = false;
		hpChangeVisible = true;
		hpRectW = pixel;
		if (nextHP < hp)
		{
			hpChangeAmount = Math.abs(hp - nextHP);
			hpText = "- " + hpChangeAmount;
			hpTang = false;
		}
		else
		{
			hpTang = true;
			hpChangeAmount = Math.abs(nextHP - hp);
			hpText = "+ " + hpChangeAmount;
			flag = true;
		}
		vHP = Math.abs(nextHP - hp) / 20;
		if (vHP == 0)
		{
			vHP = 1;
		}
		dyhp = 25;
		this.nextHP = nextHP;
		if (!flag)
		{
		}
	}

	public void update2()
	{
		if (vJump > 0)
		{
			vJump--;
		}
		if (state == 0)
		{
			updateFrameStand();
		}
		if (falling)
		{
			vy++;
			if (vy > 20)
			{
				vy = 20;
			}
			int num = y + vy - vJump;
			if ((GameScrRPG.map.tileTypeAtPixel(x, num) & 4) == 4)
			{
				y = num - num % 24;
				state = 0;
				vy = 0;
				falling = false;
				num = y;
				lasty = (short)y;
			}
			else
			{
				y = num;
			}
		}
		if (isCom && !isFlyAvenger() && !flyPlayer && !isJump)
		{
			if (((CRes.abs(nextx - x) == 0 && !isRunSpeed) || (CRes.abs(x - nextx) <= 2 && isRunSpeed)) && ((CRes.abs(nexty - y) == 0 && !isRunSpeed) || (CRes.abs(nexty - y) <= 2 && isRunSpeed)) && (isMove || state == 1 || state == 0))
			{
				state = 0;
				updateFrameStand();
			}
			if (Math.abs(nextx - x) < 6)
			{
				if (nextx < x)
				{
					look = 2;
				}
				else
				{
					look = 0;
				}
				x = nextx;
				state = 0;
				init2(x, y);
			}
			else if (nextx < x && !falling)
			{
				move2(2);
			}
			else if (nextx > x && !falling)
			{
				move2(0);
			}
			if (nextx == x && nexty != y && state == 0 && !falling)
			{
				y = nexty;
			}
		}
		if (state != 1 && !flyActive)
		{
			return;
		}
		if (!isFlyAvenger())
		{
			if (((CRes.abs(x - xToNow) == 0 && !isRunSpeed) || (CRes.abs(x - xToNow) <= 2 && isRunSpeed)) && ((CRes.abs(y - yToNow) == 0 && !isRunSpeed) || (CRes.abs(y - yToNow) <= 2 && isRunSpeed)) && isMove)
			{
				isMove = false;
				state = 0;
				CRes.outz("DA TOI NOI DA TOI NOI DA TOI NOI x= " + x + "y = " + y);
				mSystem.mNotify();
			}
		}
		else
		{
			if ((!CCanvas.isTouch || GameScrRPG.curFocus == 5 || GameScrRPG.curFocus == 6 || isPointerMove || CCanvas.keyHold[2] || CCanvas.keyHold[4] || CCanvas.keyHold[6] || CCanvas.keyHold[8]) && !isCom)
			{
				return;
			}
			if (isMe)
			{
				PM.getMyPlayer2().target = CCanvas.gameScrRPG.searchNearTarget();
			}
			runSpeed = 3;
			float num2 = runSpeed;
			isPoint = false;
			if ((float)Math.abs((int)((float)xToNow - x2)) <= num2)
			{
				x2 = xToNow;
			}
			else if ((float)xToNow - x2 > num2)
			{
				x2 += num2;
				updateFrameMove2(0);
				isMoveAvenger = true;
			}
			else if ((float)xToNow - x2 < num2)
			{
				x2 -= num2;
				updateFrameMove2(2);
				isMoveAvenger = true;
			}
			if ((float)Math.abs(yToNow - y) <= num2)
			{
				y = yToNow;
				nexty = y;
			}
			else if ((float)(yToNow - y) > num2)
			{
				y += (int)num2;
				nexty = y;
				updateFrameMove2(look);
				isMoveAvenger = true;
			}
			else if ((float)(yToNow - y) < num2)
			{
				updateFrameMove2(look);
				nexty = y;
				y -= (int)num2;
				isMoveAvenger = true;
			}
			x = (int)x2;
			nextx = x;
			lastx = (short)x;
			nexty = y;
			lasty = (short)y;
			if (x == xToNow && y == yToNow && !isFreeze)
			{
				xToNow = x;
				yToNow = y;
				if (isMe)
				{
					GameService.gI().moveRPG((short)PM.getMyPlayer2().xToNow, (short)PM.getMyPlayer2().yToNow);
				}
				state = 0;
			}
		}
	}

	private void shoot()
	{
		active = false;
		isShooting = true;
		shootFrame = true;
		nShoot = 1;
		isGetPosition = true;
		CRes.outz("GUN= " + gun);
		sbyte b = bulletType;
		initBull();
		if (itemUsed == 2)
		{
			nShoot *= 2;
			itemUsed = -1;
			sendWaitForFire(b, nShoot);
		}
		else if (itemUsed == 1)
		{
			itemUsed = -1;
			sendWaitForFire(5, 1);
		}
		else if (itemUsed == 8)
		{
			itemUsed = -1;
			sendWaitForFire(4, 1);
		}
		else if (itemUsed == 11)
		{
			itemUsed = -1;
			sendWaitForFire(16, 1);
		}
		else if (itemUsed == 6)
		{
			itemUsed = -1;
			sendWaitForFire(6, 1);
		}
		else if (itemUsed == 7)
		{
			itemUsed = -1;
			sendWaitForFire(7, 1);
		}
		else if (itemUsed == 8)
		{
			itemUsed = -1;
			sendWaitForFire(4, 1);
		}
		else if (itemUsed == 9)
		{
			itemUsed = -1;
			sendWaitForFire(8, 1);
		}
		else if (itemUsed == 30)
		{
			itemUsed = -1;
			sendWaitForFire(56, 1);
		}
		else if (itemUsed == 16)
		{
			itemUsed = -1;
			sendWaitForFire(14, 1);
		}
		else if (itemUsed == 17)
		{
			itemUsed = -1;
			sendWaitForFire(13, 1);
		}
		else if (itemUsed == 18)
		{
			itemUsed = -1;
			sendWaitForFire(22, 1);
		}
		else if (itemUsed == 19)
		{
			itemUsed = -1;
			sendWaitForFire(26, 1);
		}
		else if (itemUsed == 20)
		{
			itemUsed = -1;
			sendWaitForFire(25, 1);
		}
		else if (itemUsed == 21)
		{
			itemUsed = -1;
			sendWaitForFire(23, 1);
		}
		else if (itemUsed == 22)
		{
			itemUsed = -1;
			sendWaitForFire(28, 1);
		}
		else if (itemUsed == 23)
		{
			itemUsed = -1;
			sendWaitForFire(30, 1);
		}
		else if (itemUsed == 24)
		{
			itemUsed = -1;
			sendWaitForFire(50, 1);
		}
		else if (itemUsed == 25)
		{
			itemUsed = -1;
			sendWaitForFire(51, 1);
		}
		else if (itemUsed == 26)
		{
			itemUsed = -1;
			sendWaitForFire(52, 1);
		}
		else if (itemUsed == 27)
		{
			itemUsed = -1;
			sendWaitForFire(53, 1);
		}
		else if (itemUsed == 28)
		{
			itemUsed = -1;
			sendWaitForFire(54, 1);
		}
		else if (itemUsed == 29)
		{
			itemUsed = -1;
			sendWaitForFire(55, 1);
		}
		else if (itemUsed == 31)
		{
			itemUsed = -1;
			sendWaitForFire(57, 1);
		}
		else if (itemUsed == 42)
		{
			itemUsed = -1;
			sendWaitForFire(58, 1);
		}
		else
		{
			sendWaitForFire(b, nShoot);
		}
		force = 0f;
		force_2 = 0f;
		GameScr.curFocus = -1;
	}

	public void shoot(sbyte critical, sbyte whoShoot, short xP, short yP, sbyte _bullType, short[][] _x, short[][] _y, sbyte _numShoot, sbyte force2, short angle, short[][] _xHit, short[][] _yHit, int xSuperz, int ySuperz)
	{
		if (whoShoot == PM.getMyPlayer().IDDB)
		{
			GameScr.cam.setPlayerMode(index);
		}
		if (PM.p[whoShoot].isFlyAvenger())
		{
			PM.p[whoShoot].isMoveAvenger = false;
		}
		shootFrame = true;
		isShooting = true;
		isPointActive = false;
		gunBack = true;
		tBack = 0;
		indexAngle = getIndexByFrame(cf);
		if (GameScr.pm.isYourTurn() && index == GameScr.myIndex)
		{
			active = false;
		}
		x = (nextx = (lastx = xP));
		y = (nexty = yP);
		xSuper = xSuperz;
		ySuper = ySuperz;
		CRes.outz("ASDASDASD=" + _x.Length);
		resetLastUpdateXY(x, y);
		bulletType = _bullType;
		if (PM.getMyPlayer() == this)
		{
			this.angle = angle;
			CRes.outz("ban goc " + angle + " --------------------------------------------------------------");
			if (isFrameWithGun())
			{
				updateFrameAngle();
			}
		}
		else if (BackgroundNew.lowGraphic)
		{
			this.angle = angle;
			if (isFrameWithGun())
			{
				updateFrameAngle();
			}
		}
		else
		{
			toAngle = angle;
		}
		CRes.outz("sau do angle= " + angle + " ++++++++++++++++++++++++++++++++++++++++");
		GameScr.bm.setBullType(critical, whoShoot, _bullType, _x, _y, _numShoot, force2, _xHit, _yHit, idBullet);
		state = 4;
		if (_bullType == 35)
		{
			isBum = true;
		}
		if (_bullType == 43)
		{
			for (int i = 0; i < _x.Length; i++)
			{
				if (_x[i][0] + MM.mapWidth / 10 >= MM.mapWidth)
				{
					bombIndex = i;
					break;
				}
			}
			this._x = _x;
			this._y = _y;
			GameScr.pm.flyTo(whoShoot, (short)(MM.mapWidth + 100), _y[0][0]);
		}
		if (!BackgroundNew.lowGraphic)
		{
			if (isAvenger == 8)
			{
				xLua = x + ((look != 0) ? (-15) : 15);
				yLua = y - 12;
			}
			else
			{
				xLua = _x[0][0];
				yLua = _y[0][0];
			}
			if (GameScr.pm.isYourTurn())
			{
				isLuaDauNong = true;
			}
		}
		if (!GameScr.pm.isYourTurn())
		{
			BM.isPrepareShooting = true;
		}
	}

	public void check_Spider_look()
	{
		int num = _x[2][3];
		int num2 = _y[2][3];
		switch (Smoke.checkWay(x, y, num, num2))
		{
		case 3:
			sLook = SDOWN;
			break;
		case 2:
			sLook = SUP;
			break;
		case 0:
			sLook = SLEFT;
			break;
		case 1:
			sLook = SRIGHT;
			break;
		}
	}

	public void lucky()
	{
		GameScr.sm.addRock(x, y - 12, CRes.random(4), CRes.random(-8, -5), 20);
		GameScr.sm.addRock(x, y - 12, CRes.random(3), CRes.random(-8, -4), 20);
		GameScr.sm.addRock(x, y - 12, -CRes.random(4), CRes.random(-8, -5), 20);
		GameScr.sm.addRock(x, y - 12, -CRes.random(3), CRes.random(-8, -4), 20);
		CCanvas.tNotify = 0;
		CCanvas.lockNotify = true;
	}

	public void initBull()
	{
		BulletForGun bull = BulletForGun.getBull(wp);
		if (bull != null)
		{
			switch (bull.bullType)
			{
			case 0:
				bulletType = 0;
				break;
			case 1:
				bulletType = 1;
				break;
			case 2:
				bulletType = 2;
				break;
			case 3:
				bulletType = 9;
				break;
			case 4:
				bulletType = 10;
				break;
			case 5:
				bulletType = 11;
				break;
			case 6:
				bulletType = 19;
				break;
			case 8:
				bulletType = 17;
				break;
			case 7:
				bulletType = 21;
				break;
			case 9:
				bulletType = 49;
				break;
			}
		}
	}

	private void sendWaitForFire(sbyte bulletType, sbyte numShoot)
	{
		GameService.gI().waitForFIRE(bulletType, (short)x, (short)y, (short)angle, (sbyte)force, (sbyte)force_2, numShoot);
		lastForcePoint = force;
		lastForcePoint_2 = force_2;
	}

	public void UseItem(int itemID, bool isCOM_Use, int curSlot, short iconUse)
	{
		if (!isCOM_Use)
		{
			if (isUsedItem)
			{
				CRes.outz("ISUSEDITEM");
				return;
			}
			GameService.gI().useItem((sbyte)itemID);
			if (PrepareScr.currLevel != 7)
			{
				item[curSlot] = -1;
			}
			isUsedItem = true;
			return;
		}
		switch (itemID)
		{
		case 4:
		case 34:
			is2TurnItem = true;
			isInvisible = true;
			new Explosion(x, y - pH / 2, 5, index, (sbyte)itemID, iconUse);
			new Explosion(x, y, 4, index, (sbyte)itemID, iconUse);
			break;
		case 3:
			is2TurnItem = true;
			isRunSpeed = true;
			new Explosion(x, y - pH / 2, 5, index, (sbyte)itemID, iconUse);
			if (!isInvisible)
			{
				new Explosion(x, y, 4, index, (sbyte)itemID, iconUse);
			}
			break;
		case 5:
			is2TurnItem = true;
			new Explosion(x, y - pH / 2, 5, index, (sbyte)itemID, iconUse);
			break;
		case 0:
		case 2:
		case 32:
		case 33:
			is2TurnItem = true;
			new Explosion(x, y - pH / 2, 5, index, (sbyte)itemID, iconUse);
			break;
		case 20:
			if (look == 0)
			{
				angle = 0;
			}
			if (look == 2)
			{
				angle = 180;
			}
			is2TurnItem = false;
			new Explosion(x, y - pH / 2, 5, index, (sbyte)itemID, iconUse);
			break;
		case 22:
			angle = 89;
			is2TurnItem = false;
			new Explosion(x, y - pH / 2, 5, index, (sbyte)itemID, iconUse);
			break;
		case 23:
			angle = -89;
			is2TurnItem = false;
			new Explosion(x, y - pH / 2, 5, index, (sbyte)itemID, iconUse);
			break;
		case 10:
			is2TurnItem = true;
			new Explosion(x, y - pH / 2, 5, index, (sbyte)itemID, iconUse);
			break;
		case 1:
		case 6:
		case 7:
		case 8:
		case 9:
		case 11:
		case 16:
		case 17:
		case 18:
		case 19:
		case 21:
		case 24:
		case 25:
		case 26:
		case 27:
		case 28:
		case 29:
		case 30:
		case 42:
			CRes.outz("fly");
			is2TurnItem = false;
			new Explosion(x, y - pH / 2, 5, index, (sbyte)itemID, iconUse);
			break;
		case 35:
			is2TurnItem = true;
			new Explosion(x, y - pH / 2, 5, index, (sbyte)itemID, iconUse);
			new Explosion(x, y, 4, index, (sbyte)itemID, iconUse);
			break;
		case 100:
			new Explosion(x, y - pH / 2, 5, index, 38, iconUse);
			break;
		default:
			new Explosion(x, y, 5, index, (sbyte)itemID, iconUse);
			break;
		}
		itemUsed = itemID;
		CRes.outz("ITEM USE= " + itemUsed);
		state = 0;
		if (!isInvisible)
		{
			new Explosion(x, y - pH / 2, 3, index, (sbyte)itemID, iconUse);
		}
		force = 0f;
		force_2 = 0f;
		isUsedItem = true;
		if (itemUsed != 100 && isSecondPower)
		{
			isSecondPower = false;
		}
		Music.play(Music.SPECIAL, 10f);
	}

	public virtual void paint(mGraphics g)
	{
		if (!isPaint)
		{
			return;
		}
		if (PrepareScr.currLevel != 7 || (PrepareScr.currLevel == 7 && state != 5 && hp != 0))
		{
			if (!GameScr.res.Equals(string.Empty))
			{
				paintPlayer(g);
				painthp(g);
				paintName(g);
			}
			else if (!isInvisible)
			{
				paintPlayer(g);
				painthp(g);
				paintName(g);
			}
			else if (index == GameScr.myIndex || team == PM.getMyPlayer().team)
			{
				paintPlayer(g);
				painthp(g);
				paintName(g);
			}
			painthpChange(g);
			paintExpChange(g);
			g.setColor(0);
		}
		paintDust(g);
		paintLuaDauNong(g);
	}

	public void updateCharRun()
	{
	}

	public void updateCharStand()
	{
	}

	public void updateFrameFire()
	{
		if (indexAngle != -1)
		{
			cf = fFire[indexAngle];
		}
	}

	public string getLevelName()
	{
		string result = strLevel[0];
		for (int i = 0; i < strLevel.Length; i++)
		{
			if (exp >= expToLevel[i])
			{
				result = strLevel[i];
			}
		}
		return result;
	}

	public void getStringLevel()
	{
		currLv = 0;
		for (int i = 0; i < strLevel.Length; i++)
		{
			if (exp < expToLevel[i])
			{
				continue;
			}
			currLv = i;
			if (i < strLevel.Length - 1)
			{
				int num = expToLevel[i + 1];
				int num2 = expToLevel[i + 1] - exp;
				perCent = 100 - num2 * 100 / (num - expToLevel[i]);
				if (perCent == 100)
				{
					perCent = 99;
				}
			}
		}
		imgLevel = levelImage[currLv];
		stringLevel = "Lv " + currLv + "+" + perCent + "%";
	}

	public void paintHeadOnly(mGraphics g, float x, float y)
	{
		Part part = null;
		Part part2 = null;
		if (head != -1)
		{
			part = CCanvas.parts[head];
		}
		if (hat != -1)
		{
			part2 = CCanvas.parts[hat];
		}
		if (head != -1)
		{
			SmallImage.drawSmallImage(g, part.pi[CharInfo[cf][0][0]].id, x, y, 0, 3, true);
		}
		if (hat != -1 && head == -1)
		{
			part = CCanvas.parts[59];
			SmallImage.drawSmallImage(g, part.pi[CharInfo[cf][0][0]].id, x, y, 0, 3, true);
			SmallImage.drawSmallImage(g, part2.pi[CharInfo[cf][4][0]].id, x, y, 0, 3, true);
		}
	}

	public void requestAllImage()
	{
		Part part = null;
		Part part2 = null;
		Part part3 = null;
		Part part4 = null;
		Part part5 = null;
		Part part6 = null;
		if (head != -1)
		{
			part = CCanvas.parts[head];
		}
		if (leg != -1)
		{
			part2 = CCanvas.parts[leg];
		}
		if (body != -1)
		{
			part3 = CCanvas.parts[body];
		}
		if (wp != -1)
		{
			part4 = CCanvas.parts[wp];
		}
		if (hat != -1)
		{
			part5 = CCanvas.parts[hat];
		}
		if (wing != -1)
		{
			part6 = CCanvas.parts[wing];
		}
		for (int i = 0; i < 30; i++)
		{
			cf = i;
			if (wp != -1)
			{
				SmallImage.requestImage(part4.pi[CharInfo[cf][3][0]].id);
			}
			if (wing != -1)
			{
				SmallImage.requestImage(part6.pi[CharInfo[cf][5][0]].id);
			}
			if (head != -1)
			{
				SmallImage.requestImage(part.pi[CharInfo[cf][0][0]].id);
			}
			if (hat != -1 && head == -1)
			{
				part = CCanvas.parts[59];
				SmallImage.requestImage(part.pi[CharInfo[cf][0][0]].id);
				SmallImage.requestImage(part5.pi[CharInfo[cf][4][0]].id);
			}
			if (leg != -1)
			{
				SmallImage.requestImage(part2.pi[CharInfo[cf][1][0]].id);
			}
			if (body != -1)
			{
				SmallImage.requestImage(part3.pi[CharInfo[cf][2][0]].id);
			}
		}
	}

	public void paintKhiCau(mGraphics g, float X, float Y)
	{
		g.drawRegion(khicau, 0, 0, mGraphics.getImageWidth(khicau), mGraphics.getImageHeight(khicau), look, X, Y, 3, false);
	}

	public void paintClanIcon(mGraphics g, int x, int y, int anchor)
	{
		if (clan == null || name == null)
		{
			return;
		}
		if (clan.imgID < 0)
		{
			g.setColor(0);
			if (TabClanIcon.clanColor[-clan.imgID] == 0)
			{
				g.setColor(16777215);
			}
			g.fillRect(x - 1 - 6, y - 1 - 3, 14, 8, true);
			g.setColor(TabClanIcon.clanColor[-clan.imgID]);
			g.fillRect(x - 6, y - 3, 12, 6, true);
		}
		else
		{
			SmallImage.drawSmallImage(g, clan.imgID, x, y, 0, anchor, true);
		}
	}

	public void paintClanIcon(mGraphics g, int x, int y)
	{
		paintClanIcon(g, x, y, 3);
	}

	public void paintBiaMo(mGraphics g)
	{
		if (stateDie == 2)
		{
			if (clipDie < 25)
			{
				g.drawRegion(imgBiaMo, 0, 0, 25, clipDie, 0, x - 12, y + 3 - clipDie, 0, false);
			}
			else
			{
				g.drawImage(imgBiaMo, x - 12, y + 3 + dyDie, mGraphics.BOTTOM | mGraphics.LEFT, false);
			}
		}
	}

	public void paintBody(mGraphics g, float x, float y)
	{
		try
		{
			if (isAvenger == 5 && captainReturn)
			{
				SmallImage.drawSmallImage(g, 1889, xReturn, yReturn, 0, 3, false);
			}
			int num = cf;
			if (isAvenger == 2)
			{
				num = frame;
			}
			if (CCanvas.curScr == CCanvas.gameScrRPG)
			{
				pAngle = 0;
			}
			g.rotate(pAngle, (int)x, (int)y);
			if (state != 5 && gun <= 18 && isAngry)
			{
				ta++;
				if (ta == 2)
				{
					ta = 0;
					fa++;
					if (fa > 3)
					{
						fa = 0;
						yT = 0;
					}
				}
				g.drawRegion(lua, 0, fa * 47, 41, 47, 0, x, y, 33, false);
			}
			Part part = null;
			Part part2 = null;
			Part part3 = null;
			Part part4 = null;
			Part part5 = null;
			Part part6 = null;
			if (head != -1)
			{
				part = CCanvas.parts[head];
			}
			if (leg != -1)
			{
				part2 = CCanvas.parts[leg];
			}
			if (body != -1)
			{
				part3 = CCanvas.parts[body];
			}
			if (wp != -1 && isAvenger == 0)
			{
				part4 = CCanvas.parts[wp];
			}
			if (hat != -1)
			{
				part5 = CCanvas.parts[hat];
			}
			if (wing != -1)
			{
				part6 = CCanvas.parts[wing];
			}
			int num2 = look;
			if (lookAngle != -1)
			{
				num2 = lookAngle;
			}
			if (stateDie == 2)
			{
				g.resetRotate();
				return;
			}
			if (num2 == 0)
			{
				if (stateDie == 1)
				{
					if (lookAngle != -1)
					{
						num2 = lookAngle;
					}
					SmallImage.drawSmallImage(g, 1298, x, y, num2, mGraphics.BOTTOM | mGraphics.HCENTER, false);
					g.resetRotate();
					return;
				}
				if ((state == 8 || state == 5) && isAvenger != 2)
				{
					if (lookAngle != -1)
					{
						num2 = lookAngle;
					}
					SmallImage.drawSmallImage(g, 1298, x, y, num2, mGraphics.BOTTOM | mGraphics.HCENTER, false);
					g.resetRotate();
					return;
				}
				if (wp != -1 && isAvenger == 0)
				{
					SmallImage.drawSmallImage(g, part4.pi[CharInfo[cf][3][0]].id, x + (float)CharInfo[cf][3][1] + (float)part4.pi[CharInfo[cf][3][0]].dx, y + (float)CharInfo[cf][3][2] + (float)part4.pi[CharInfo[cf][3][0]].dy, num2, 0, false);
				}
				if (wing != -1)
				{
					SmallImage.drawSmallImage(g, part6.pi[CharInfo[cf][5][0]].id, x + (float)CharInfo[cf][5][1] + (float)part6.pi[CharInfo[cf][5][0]].dx, y + (float)CharInfo[cf][5][2] + (float)part6.pi[CharInfo[cf][5][0]].dy, num2, 0, false);
				}
				if (head != -1)
				{
					SmallImage.drawSmallImage(g, part.pi[CharInfo[cf][0][0]].id, x + (float)CharInfo[cf][0][1] + (float)part.pi[CharInfo[cf][0][0]].dx, y + (float)CharInfo[cf][0][2] + (float)part.pi[CharInfo[cf][0][0]].dy, num2, 0, false);
				}
				if (hat != -1 && head == -1)
				{
					part = CCanvas.parts[59];
					SmallImage.drawSmallImage(g, part.pi[CharInfo[cf][0][0]].id, x + (float)CharInfo[cf][0][1] + (float)part.pi[CharInfo[cf][0][0]].dx, y + (float)CharInfo[cf][0][2] + (float)part.pi[CharInfo[cf][0][0]].dy, num2, 0, false);
					SmallImage.drawSmallImage(g, part5.pi[CharInfo[cf][4][0]].id, x + (float)CharInfo[cf][4][1] + (float)part5.pi[CharInfo[cf][4][0]].dx, y + (float)CharInfo[cf][4][2] + (float)part5.pi[CharInfo[cf][4][0]].dy, num2, 0, false);
				}
				if (leg != -1)
				{
					SmallImage.drawSmallImage(g, part2.pi[CharInfo[cf][1][0]].id, x + (float)CharInfo[cf][1][1] + (float)part2.pi[CharInfo[cf][1][0]].dx, y + (float)CharInfo[cf][1][2] + (float)part2.pi[CharInfo[cf][1][0]].dy, num2, 0, false);
				}
				if (body != -1)
				{
					SmallImage.drawSmallImage(g, part3.pi[CharInfo[cf][2][0]].id, x + (float)CharInfo[cf][2][1] + (float)part3.pi[CharInfo[cf][2][0]].dx, y + (float)CharInfo[cf][2][2] + (float)part3.pi[CharInfo[cf][2][0]].dy, num2, 0, false);
				}
				if (isFlyAvenger())
				{
					int num3 = ((CCanvas.gameTick % 4 <= 1) ? 1 : 0);
					g.drawImage(fireIronMan[num3], (!isMoveAvenger) ? (x + 6f) : (x + 2f), (!isMoveAvenger) ? (y + 1f) : (y + 3f), mGraphics.TOP | mGraphics.HCENTER, false);
					int num4 = ((CCanvas.gameTick % 4 <= 1) ? 3 : 2);
					g.drawImage(fireIronMan[num4], x - 4f, (!isMoveAvenger) ? (y + 1f) : (y - 2f), mGraphics.TOP | mGraphics.HCENTER, false);
				}
			}
			else
			{
				if (stateDie == 1)
				{
					if (lookAngle != -1)
					{
						num2 = lookAngle;
					}
					SmallImage.drawSmallImage(g, 1298, x, y, num2, mGraphics.BOTTOM | mGraphics.HCENTER, false);
					g.resetRotate();
					return;
				}
				if ((state == 8 || state == 5) && isAvenger != 2)
				{
					if (lookAngle != -1)
					{
						num2 = lookAngle;
					}
					SmallImage.drawSmallImage(g, 1298, x, y, num2, mGraphics.BOTTOM | mGraphics.HCENTER, false);
					g.resetRotate();
					return;
				}
				if (wp != -1 && isAvenger == 0)
				{
					SmallImage.drawSmallImage(g, part4.pi[CharInfo[cf][3][0]].id, x - (float)CharInfo[cf][3][1] - (float)part4.pi[CharInfo[cf][3][0]].dx, y + (float)CharInfo[cf][3][2] + (float)part4.pi[CharInfo[cf][3][0]].dy, num2, 24, false);
				}
				if (wing != -1)
				{
					SmallImage.drawSmallImage(g, part6.pi[CharInfo[cf][5][0]].id, x - (float)CharInfo[cf][5][1] - (float)part6.pi[CharInfo[cf][5][0]].dx, y + (float)CharInfo[cf][5][2] + (float)part6.pi[CharInfo[cf][5][0]].dy, num2, 24, false);
				}
				if (head != -1)
				{
					SmallImage.drawSmallImage(g, part.pi[CharInfo[cf][0][0]].id, x - (float)CharInfo[cf][0][1] - (float)part.pi[CharInfo[cf][0][0]].dx, y + (float)CharInfo[cf][0][2] + (float)part.pi[CharInfo[cf][0][0]].dy, num2, 24, false);
				}
				if (hat != -1 && head == -1)
				{
					part = CCanvas.parts[59];
					SmallImage.drawSmallImage(g, part.pi[CharInfo[cf][0][0]].id, x - (float)CharInfo[cf][0][1] - (float)part.pi[CharInfo[cf][0][0]].dx, y + (float)CharInfo[cf][0][2] + (float)part.pi[CharInfo[cf][0][0]].dy, num2, 24, false);
					SmallImage.drawSmallImage(g, part5.pi[CharInfo[cf][4][0]].id, x - (float)CharInfo[cf][4][1] - (float)part5.pi[CharInfo[cf][4][0]].dx, y + (float)CharInfo[cf][4][2] + (float)part5.pi[CharInfo[cf][4][0]].dy, num2, 24, false);
				}
				if (leg != -1)
				{
					SmallImage.drawSmallImage(g, part2.pi[CharInfo[cf][1][0]].id, x - (float)CharInfo[cf][1][1] - (float)part2.pi[CharInfo[cf][1][0]].dx, y + (float)CharInfo[cf][1][2] + (float)part2.pi[CharInfo[cf][1][0]].dy, num2, 24, false);
				}
				if (body != -1)
				{
					SmallImage.drawSmallImage(g, part3.pi[CharInfo[cf][2][0]].id, x - (float)CharInfo[cf][2][1] - (float)part3.pi[CharInfo[cf][2][0]].dx, y + (float)CharInfo[cf][2][2] + (float)part3.pi[CharInfo[cf][2][0]].dy, num2, 24, false);
				}
				if (isFlyAvenger())
				{
					int num5 = ((CCanvas.gameTick % 4 <= 1) ? 1 : 0);
					g.drawImage(fireIronMan[num5], (!isMoveAvenger) ? (x - 6f) : (x - 2f), (!isMoveAvenger) ? (y + 1f) : (y + 3f), mGraphics.TOP | mGraphics.HCENTER, false);
					int num6 = ((CCanvas.gameTick % 4 <= 1) ? 3 : 2);
					g.drawImage(fireIronMan[num6], x + 4f, (!isMoveAvenger) ? (y + 1f) : (y - 2f), mGraphics.TOP | mGraphics.HCENTER, false);
				}
			}
			g.resetRotate();
		}
		catch (Exception)
		{
		}
	}

	private void paintPlayer(mGraphics g)
	{
		cx = x;
		cy = y + 1;
		if (bossType == 4)
		{
			return;
		}
		if (bossType == 3)
		{
			y += dbY[countB];
			countB++;
			if (countB == dbY.Length)
			{
				countB = 0;
			}
			paintKhiCau(g, x, y);
			for (int i = 0; i < PM.p.Length; i++)
			{
				if (PM.p[i] != null && PM.p[i].bossType == 4 && (PM.p[i].index == index + 1 || PM.p[i].index == index + 2))
				{
					PM.p[i].paintBody(g, PM.p[i].x, PM.p[i].y);
				}
			}
			g.drawRegion(giatreo, 0, 0, mGraphics.getImageWidth(giatreo), mGraphics.getImageHeight(giatreo), look, x, y + 50, 3, false);
			if (CCanvas.gameTick % 2 == 0)
			{
				g.drawRegion(Airplane.mb11, 0, 0, 15, 32, 0, (look != 2) ? (x - 40) : (x + 40), y - 20, 3, false);
			}
			else
			{
				g.drawRegion(Airplane.mb11, 0, 0, 15, 32, 2, (look != 2) ? (x - 40) : (x + 40), y - 20, 3, false);
			}
		}
		else if (bossType == 5)
		{
			if (state != 5 && isDrop)
			{
				SmallImage.drawSmallImage(g, head, x, yGift_1, 0, 33, false);
			}
		}
		else if (bossType == 6)
		{
			if (state != 5)
			{
				tG++;
				if (tG == 10)
				{
					tG = 0;
				}
				if (tG < 5)
				{
					frameG = 0;
				}
				else
				{
					frameG = 1;
				}
				SmallImage.drawSmallImage(g, head, x, yGift_2 - 8, 0, 33, false);
				g.drawRegion(bongbong, 0, frameG * 35, 35, 35, 0, x, yGift_2, 33, false);
			}
		}
		else
		{
			if (GameScr.iconOn)
			{
				paintClanIcon(g, (int)x2 + 14, cy - 52, mGraphics.BOTTOM | mGraphics.LEFT);
			}
			paintBody(g, x2, cy);
		}
	}

	public void paintPlayer3(mGraphics g, int X, int Y)
	{
		paintBody(g, X, Y + 1);
	}

	public void paintLevel(mGraphics g, int x, int y)
	{
		SmallImage.drawSmallImage(g, imgLevel, x, y, 0, 24, false);
	}

	private void paintPlayer2(mGraphics g)
	{
		if (state != 5 && gun <= 18 && isAngry)
		{
			ta++;
			if (ta == 2)
			{
				ta = 0;
				fa++;
				if (fa > 3)
				{
					fa = 0;
					yT = 0;
				}
			}
			g.drawRegion(lua, 0, fa * 47, 41, 47, 0, x, y, 33, false);
		}
		int num = look;
		if (state == 8)
		{
			num = hurtLook;
		}
		if (gun == 16 || gun == 17 || gun == 19 || gun == 21 || gun == 22 || gun == 23 || gun == 24)
		{
			return;
		}
		if ((PrepareScr.currLevel != 7 || (PrepareScr.currLevel == 7 && state != 5 && hp != 0)) && clanIcon != null && GameScr.iconOn)
		{
			g.drawImage(clanIcon, x, y - 47, 33, false);
		}
		if (closeMirror)
		{
			tCl++;
			if (tCl == 10)
			{
				tCl = 0;
				isMirror = false;
				closeMirror = false;
			}
		}
		if (isPoison && CCanvas.gameTick % 5 == 0)
		{
			new Explosion(CRes.random(x - 10, x + 10), CRes.random(y - 20, y + 2), 10);
		}
		if (GameScr.bm.critical == 0 && index == GameScr.myIndex && CCanvas.gameTick % 2 == 0)
		{
			frameC++;
			if (frameC == 2)
			{
				frameC = 0;
			}
		}
	}

	public void drawCircle(mGraphics g, int x, int y)
	{
		if (gun <= angleLock.Length - 1)
		{
			int num = 0;
			int num2 = 0;
			if (imgCircle != null)
			{
				num = mGraphics.getImageWidth(imgCircle);
				num2 = mGraphics.getImageWidth(imgCircle);
			}
			else
			{
				num = 100;
				num2 = 100;
			}
			if (look == 0)
			{
				int num3 = angleLock[gun];
				g.fillArc(stopAngle: (num3 >= 0) ? (90 - num3) : (90 + CRes.abs(num3)), x: x - num / 2 - 3, y: y - num / 2 - 12, imgCircle: imgCircle, startAngle: 270, uClip: true);
			}
			else
			{
				int num4 = angleLock[gun];
				g.fillArc(stopAngle: -((num4 >= 0) ? (90 - num4) : (90 + CRes.abs(num4))), x: x - num / 2 - 3, y: y - num / 2 - 12, imgCircle: imgCircle, startAngle: 270, uClip: true);
			}
		}
	}

	private void paintAngle(mGraphics g)
	{
		if (!CCanvas.isTouch)
		{
			return;
		}
		if (look == 0)
		{
			xMuiTen = x - 85;
			if (xMuiTen < Camera.x)
			{
				xMuiTen = x + 52;
			}
		}
		else
		{
			xMuiTen = x + 52;
			if (xMuiTen > Camera.x + CCanvas.w - 33)
			{
				xMuiTen = x - 85;
			}
		}
	}

	public void paintCrosshair(mGraphics g)
	{
		int num = 0;
		if (imgCircle != null)
		{
			num = mGraphics.getImageWidth(imgCircle);
		}
		else
		{
			num = 100;
		}
		int num2 = x - 3;
		int num3 = y - 12;
		if (state == 1 || Camera.mode == 0)
		{
			return;
		}
		if (hasDrag && CCanvas.isTouch)
		{
			g.drawImage(GameScr.zoom3, xDrag, yDrag, mGraphics.HCENTER | mGraphics.VCENTER, false);
		}
		paintAngle(g);
		int num4 = 12;
		int a = -angle;
		int num5 = CRes.cos(a) * num4 >> 10;
		int num6 = CRes.sin(a) * num4 >> 10;
		int num7 = num2;
		int num8 = num3;
		int num9 = 0;
		int num10 = 0;
		int num11 = 4;
		int num12 = -100;
		int num13 = -100;
		g.setColor(16711680);
		int num14 = ((!isDoublePower) ? ((int)force >> 1) : (isSecondPower ? ((int)force_2 >> 1) : ((int)force >> 1)));
		if (num14 <= 5)
		{
			num14 = (isDrag ? 5 : 0);
		}
		if (num14 > 0)
		{
			for (int i = 0; i < num14; i++)
			{
				int num15 = num7;
				int num16 = num8;
				num7 += num5;
				num8 += num6;
				int num17 = 10;
				num10 += num17;
				num5 += num10 / 100;
				num10 = num17 % 100;
				num9 += num11;
				num6 += num9 / 10;
				num9 %= 10;
				if (i > 4)
				{
					g.drawImage(imgDan, num7 - 2, num8 - 2, 0, false);
				}
			}
		}
		if (mGraphics.zoomLevel == 1)
		{
			if (!CCanvas.isTouch)
			{
				if (isFlyAvenger() && isMoveAvenger)
				{
					return;
				}
			}
			else if (isFlyAvenger() && state == 1)
			{
				return;
			}
			drawCircle(g, x, y);
			g.drawImage(GameScr.crosshair, x + dx, y - dy - 11, 3, false);
			if (!hasDrag && CCanvas.isTouch)
			{
				g.drawImage(GameScr.zoom2, x + dx2, y - dy2 - 11, mGraphics.HCENTER | mGraphics.VCENTER, false);
			}
		}
		else
		{
			g.setAlpha(alpha);
			drawCircle(g, x, y);
			g.rotate(-angle, x, y - 12);
			g.drawImage(arrow, x, y - 12, mGraphics.VCENTER | mGraphics.LEFT, false);
			g.resetRotate();
			if (CCanvas.isTouch)
			{
				g.setAlpha(alpha);
			}
			if (!hasDrag)
			{
				g.drawImage(GameScr.zoom2, x + dx2, y - dy2 - 11, mGraphics.HCENTER | mGraphics.VCENTER, false);
			}
			g.setAlpha(1000);
		}
	}

	private void painthp(mGraphics g)
	{
		if (bossType != 5 && bossType != 6 && GameScr.res.Equals(string.Empty) && state != 5 && hp > 0)
		{
			int num = 60;
			int num2 = x - 16;
			int num3 = y - num;
			g.drawImage(GameScr.frBarHP0, num2, num3, 0, true);
			int num4 = hpRectW * 27 / 25;
			if (num4 <= 1)
			{
				num4 = 2;
			}
			g.drawRegion((!isPoison) ? GameScr.frBarHP1 : GameScr.frBarHP2, 0, 0, num4, 10, 0, num2, num3, 0, false);
			mFont.smallFontYellow.drawString(g, hp + string.Empty, num2 + 13, num3 - 1, 2);
		}
	}

	public void paintName(mGraphics g)
	{
		if (GameScr.pm.isYourTurn() && this == PM.getMyPlayer() && CCanvas.gameTick % 20 < 4)
		{
			return;
		}
		string st = name;
		int num = teamColor;
		if (isLokiCopy && pLoki != null)
		{
			st = pLoki.name;
			num = pLoki.teamColor;
		}
		if (GameScr.res.Equals(string.Empty) && state != 5)
		{
			mFont obj;
			switch (num)
			{
			case 2:
				mFont.tahoma_7_red.drawString(g, st, x, y - 48, 2, mFont.tahoma_7_grey);
				return;
			case 0:
				obj = mFont.tahoma_7_blue1;
				break;
			default:
				obj = mFont.tahoma_7_yellow;
				break;
			}
			mFont mFont2 = obj;
			mFont font = ((num != 0) ? mFont.tahoma_7_grey : mFont.tahoma_7_grey);
			mFont2.drawString(g, st, x, y - 48, 2, font);
		}
	}

	public void updateAngry(sbyte angry)
	{
		currAngry = angry;
		if (currAngry == 100)
		{
			isAngry = true;
		}
		if (currAngry != 100)
		{
			isAngry = false;
		}
		GameScr.bm.critical = (sbyte)(isAngry ? 1 : 0);
	}

	public void updateHP(int nextHP, sbyte pixel)
	{
		CRes.outz("UPDATE HP nexHP= " + nextHP);
		hpGoc = hp;
		bool flag = false;
		hpChangeVisible = true;
		hpRectW = pixel;
		if (nextHP < hp)
		{
			if (GetType() == typeof(BigBoss))
			{
				activeHurt((look == 2) ? 2 : 0);
			}
			hpChangeAmount = Math.abs(hp - nextHP);
			hpText = "- " + hpChangeAmount;
			hpTang = false;
			GameScr.cam.setTargetPointMode(x, y);
		}
		else
		{
			hpTang = true;
			hpChangeAmount = Math.abs(nextHP - hp);
			hpText = "+ " + hpChangeAmount;
			flag = true;
		}
		vHP = Math.abs(nextHP - hp) / 20;
		if (vHP == 0)
		{
			vHP = 1;
		}
		dyhp = 25;
		this.nextHP = nextHP;
		if (nextHP <= 0)
		{
			die();
		}
		if (!flag)
		{
			GameScr.waitting();
		}
	}

	public void updateHPChange()
	{
		if (!hpChangeVisible)
		{
			return;
		}
		int num = nextHP - hp;
		if (num < 0)
		{
			if (hp - vHP > nextHP)
			{
				hp -= vHP;
			}
			else
			{
				hp = nextHP;
			}
		}
		else if (num > 0)
		{
			if (hp + vHP < nextHP)
			{
				hp += vHP;
			}
			else
			{
				hp = nextHP;
			}
		}
	}

	public void updateExp(int exp)
	{
		addExp = true;
		this.exp = exp;
		dyExp = 50;
		if (exp >= 0)
		{
			expText = "exp: +" + exp;
		}
		else
		{
			expText = "exp: " + exp;
		}
		GameScr.waitting();
	}

	public void updateCup(int cup)
	{
		addCup = true;
		this.cup = cup;
		dyCup = 35;
		if (cup >= 0)
		{
			cupText = " +" + cup;
		}
		else
		{
			cupText = string.Empty + cup;
		}
		GameScr.cam.setTargetPointMode(x, y);
		GameScr.waitting();
	}

	public void die()
	{
		state = 5;
		CRes.outz("DIE DIE DIE DIE DIE DIE DIE DIE DIE ");
		hp = 0;
		curFrame = 7;
		if (isInvisible)
		{
			isInvisible = false;
		}
		if (isRunSpeed)
		{
			isRunSpeed = false;
		}
		if (type == 2 || type == 1)
		{
			GameScr.electricEffect2 = true;
			GameScr.xElectric = x;
			GameScr.yElectric = y;
		}
		else
		{
			mSystem.mNotify();
		}
	}

	private void paintExpChange(mGraphics g)
	{
		if (addExp)
		{
			g.setColor(16711680);
			mFont.tahoma_7b_white.drawString(g, expText, x, y - dyExp, mGraphics.VCENTER | mGraphics.HCENTER, mFont.tahoma_7b_dark);
			dyExp++;
			if (dyExp > 200)
			{
				addExp = false;
				expText = string.Empty;
			}
		}
	}

	private void paintCup(mGraphics g)
	{
		if (addCup)
		{
			mFont.tahoma_7b_white.drawString(g, cupText, x, y - dyCup, mGraphics.VCENTER | mGraphics.HCENTER);
			g.drawImage(CScreen.cup, x + 20, y - dyCup + 10, 3, false);
			dyCup++;
			if (dyCup > 200)
			{
				addCup = falling;
				cupText = string.Empty;
			}
		}
	}

	public void painthpChange(mGraphics g)
	{
		if (!hpChangeVisible)
		{
			return;
		}
		g.setColor(16711680);
		int num = hp - hpGoc;
		mFont mFont2 = ((num <= 0) ? mFont.tahoma_7b_red : mFont.tahoma_7b_green);
		if (num != 0)
		{
			mFont2.drawString(g, ((num <= 0) ? string.Empty : "+") + num, x, y - 79, mGraphics.VCENTER | mGraphics.HCENTER, mFont.tahoma_7b_dark);
		}
		if (hp == nextHP)
		{
			timer1++;
			if (timer1 > 30)
			{
				timer1 = 0;
				hpChangeVisible = false;
				hpText = string.Empty;
				CCanvas.lockNotify = true;
			}
		}
	}

	public void getPlayerAngle()
	{
		if (mGraphics.zoomLevel == 1 || CScreen.highFrameRate() || isFlyAvenger() || isAvenger == 2)
		{
			return;
		}
		int num = 3 * mGraphics.zoomLevel;
		lastAngle = currAngle;
		bool flag = true;
		if (look == 2)
		{
			if (nextX == 0 || x <= nextX + num / 2 || state == 0)
			{
				nextX = x - num;
			}
			else
			{
				flag = false;
			}
		}
		else if (look == 0)
		{
			if (nextX == 0 || x >= nextX - num / 2 || state == 0)
			{
				nextX = x + num;
			}
			else
			{
				flag = false;
			}
		}
		if (!flag)
		{
			return;
		}
		nextY = y - 3 * mGraphics.zoomLevel;
		int num2 = 0;
		if (!GameScr.mm.isLand(nextX, nextY))
		{
			while (!GameScr.mm.isLand(nextX, nextY) && num2 < 100)
			{
				num2++;
				nextY += mGraphics.zoomLevel;
			}
		}
		else
		{
			while (GameScr.mm.isLand(nextX, nextY) && num2 < 100)
			{
				num2++;
				nextY -= mGraphics.zoomLevel;
			}
		}
		if (nextY < y - 10 * mGraphics.zoomLevel)
		{
			flag = false;
		}
		else
		{
			if (look == 2)
			{
				currAngle = CRes.angle(x - nextX, y - nextY);
				if (nextY < y && currAngle > angleLimit)
				{
					currAngle = angleLimit;
				}
				else if (nextY > y && currAngle < 360 - angleLimit)
				{
					currAngle = 360 - angleLimit;
				}
			}
			if (look == 0)
			{
				currAngle = CRes.angle(nextX - x, nextY - y);
				if (nextY > y && currAngle > angleLimit)
				{
					currAngle = angleLimit;
				}
				else if (nextY < y && currAngle < 360 - angleLimit)
				{
					currAngle = 360 - angleLimit;
				}
			}
			pAngle = currAngle;
		}
		if (CRes.abs(y - nextY) >= 50)
		{
			pAngle = 0;
		}
		if (CRes.abs(y - nextY) <= mGraphics.zoomLevel)
		{
			pAngle = 0;
		}
		if (index == PM.curP)
		{
			CRes.outz("sttate= " + state + "x= " + x + " next x= " + nextX + " y= " + y + " next y= " + nextY + "p angle= " + currAngle);
		}
	}

	public void move(int directMove)
	{
		if (CCanvas.curScr == CCanvas.gameScr && this == PM.getMyPlayer())
		{
			CCanvas.gameScr.iFreeMode = 0;
			GameScr.cam.setPlayerMode(PM.curP);
		}
		GameScr.pm.nextTurnTimer = 0;
		if (isFrameWithGun() && isRunSpeed && !isRemoveGun && isAvenger != 2)
		{
			isRemoveGun = true;
			cf = fRemoveGun[0];
		}
		if (isRemoveGun)
		{
			getPlayerAngle();
			return;
		}
		getPlayerAngle();
		if (state == 0 || state == 2 || state == 8)
		{
			state = 1;
			curFrame = 4;
		}
		if (state != 3)
		{
			lookAngle = look;
			switch (directMove)
			{
			case 2:
				if (look != 2)
				{
					angle = 180 - angle;
				}
				look = 2;
				break;
			case 0:
				if (look != 0)
				{
					angle = 180 - angle;
				}
				look = 0;
				break;
			}
		}
		if (isFreeze || state != 1)
		{
			return;
		}
		if (index == GameScr.myIndex)
		{
			alpha -= 10;
			if (alpha < 125)
			{
				alpha = 125;
			}
		}
		if (!isActiveFall)
		{
			isActiveFall = true;
		}
		if (MM.isHaveWaterOrGlass && GameScr.exs.size() == 0)
		{
			MM.checkWaterBum(x, y, 0);
		}
		float num = runSpeed;
		if (isRunSpeed)
		{
			num = 2f;
		}
		if (CScreen.isUseHighFrameRate())
		{
			num /= 2f;
		}
		if (!isCom)
		{
			if (movePoint >= (float)MAX_MOVE_POINT)
			{
				return;
			}
			if (!CScreen.highFrameRate())
			{
				movePoint += 1f;
			}
		}
		if (isRunSpeed)
		{
			updateFrameRun();
		}
		else
		{
			updateFrameMove();
		}
		animMove();
		switch (directMove)
		{
		case 2:
			x2 -= num;
			break;
		case 0:
			x2 += num;
			break;
		}
		falling = true;
		x = (int)x2;
		if (GameScr.mm.isLand((int)x2, y - 5))
		{
			if (!isCom && !CScreen.highFrameRate())
			{
				movePoint -= 1f;
			}
			switch (directMove)
			{
			case 2:
				x2 += num;
				break;
			case 0:
				x2 -= num;
				break;
			}
			falling = false;
			x = (int)x2;
			if (isCom && x == nextx && y != nexty)
			{
				y = nexty;
			}
			return;
		}
		for (int num2 = 4; num2 >= 0; num2--)
		{
			if (GameScr.mm.isLand((int)x2, y - num2))
			{
				y -= num2;
				nexty = y;
				falling = false;
				x = (int)x2;
				if (isCom && x2 == (float)nextx && y != nexty)
				{
					y = nexty;
				}
				break;
			}
		}
	}

	public void aimUp()
	{
		if (delayCount < 20)
		{
			speedChangeAngle = 1;
		}
		else
		{
			speedChangeAngle = 2;
		}
		if (state != 1)
		{
			angle += speedChangeAngle;
			angleUpdate();
			updateFrameAngle();
		}
	}

	public void aimDown()
	{
		if (delayCount < 20)
		{
			speedChangeAngle = 1;
		}
		else
		{
			speedChangeAngle = 2;
		}
		if (state != 1)
		{
			angle -= speedChangeAngle;
			angleUpdate();
			updateFrameAngle();
		}
	}

	public void animMove()
	{
		frameDelay++;
		if (frameDelay > 2)
		{
			startDust(look, cx - (((look == 0) ? 1 : (-1)) << 3), cy);
			curFrame++;
			if (curFrame == 6)
			{
				curFrame = 4;
			}
			frameDelay = 0;
		}
		updateCharRun();
	}

	public void animWin()
	{
		frameDelay++;
		if (frameDelay > 4)
		{
			curFrame++;
			if (curFrame == 10)
			{
				curFrame = 8;
			}
			frameDelay = 0;
		}
	}

	public void activeHurt(int direct)
	{
		CRes.outz("active hurt");
		if (state != 8 && state != 5)
		{
			state = 8;
			frameDelay = 0;
		}
	}

	public void checkGhostLook(int xP, int xG)
	{
		if (xP > xG)
		{
			look = 2;
		}
		else
		{
			look = 0;
		}
	}

	public void checkPlayerLook(int xP, int xG)
	{
		if (xP > xG)
		{
			look = 0;
		}
		else
		{
			look = 2;
		}
	}

	public void animHurt()
	{
		frameDelay++;
		if (frameDelay > 25)
		{
			if (hp <= 0)
			{
				die();
				return;
			}
			state = 0;
			updateFrameAngle();
			frameDelay = 0;
		}
	}

	public void setWin()
	{
		curFrame = 8;
		state = 7;
	}

	public static void paintBugRobot(mGraphics g, int x, int y)
	{
		tB++;
		if (tB == 10)
		{
			tB = 0;
		}
		if (tB == 5)
		{
			deltaY = 1;
		}
		if (tB == 0)
		{
			deltaY = 0;
		}
		int num = x + 4;
		int num2 = y - 10 + deltaY;
		int num3 = x - 15;
		int num4 = y - 15 + deltaY;
		g.drawRegion(bugbody, 0, 0, 42, 30, 0, num, num2, mGraphics.BOTTOM | mGraphics.HCENTER, false);
		g.drawRegion(bugleg, 0, 0, 44, 25, 0, x, y, mGraphics.BOTTOM | mGraphics.HCENTER, false);
		g.drawRegion(buggun, 0, 15, 15, 15, 0, num3, num4, mGraphics.BOTTOM | mGraphics.HCENTER, false);
	}

	public static void paintBigRobot(mGraphics g, int x, int y)
	{
		tB++;
		if (tB == 10)
		{
			tB = 0;
		}
		if (tB == 5)
		{
			deltaY = 1;
		}
		if (tB == 0)
		{
			deltaY = 0;
		}
		g.drawImage(robotLeg, x, y, mGraphics.BOTTOM | mGraphics.HCENTER, false);
		int arg = mGraphics.VCENTER | mGraphics.HCENTER;
		deltaX = -20;
		g.drawRegion(robotArm, 0, 0, 35, 40, 0, x + deltaX, y - 22 + deltaY, arg, false);
		g.drawImage(robotBody, x - 1, y - 10 + deltaY, mGraphics.BOTTOM | mGraphics.HCENTER, false);
		g.drawRegion(robotArm, 0, 0, 35, 40, 0, x, y - 20 + deltaY, arg, false);
	}

	public static void paintUFO(mGraphics g, int x, int y)
	{
		g.drawRegion(imgUFO, 0, 0, 51, 46, 0, x, y, 33, false);
		if (CCanvas.gameTick % 3 == 0)
		{
			g.drawRegion(imgUFOFire, 0, 0, 16, 11, 0, x, y + -5, 17, false);
		}
		else
		{
			g.drawRegion(imgUFOFire, 0, 11, 16, 11, 0, x, y - 5, 17, false);
		}
	}

	public static void paintBalloon(mGraphics g, int x, int y)
	{
		tBalloon++;
		if (tBalloon == 20)
		{
			tBalloon = 0;
		}
		if (tBalloon <= 10)
		{
			deltaBalloon = -1;
		}
		else
		{
			deltaBalloon = 0;
		}
	}

	public static void paintSimplePlayer2(int X, int Y, int Look, mGraphics g)
	{
	}

	public static void paintSimplePlayer(int GunType, int X, int Y, mGraphics g)
	{
		int num = ((GunType != 3) ? 24 : 32);
		if (GunType == 7)
		{
			num = 32;
		}
		if (GunType == 10)
		{
			num = 22;
		}
		switch (GunType)
		{
		case 13:
			paintBugRobot(g, X, Y);
			break;
		case 16:
			paintUFO(g, X, Y);
			break;
		case 17:
			paintBalloon(g, X, Y);
			break;
		case 22:
			paintSpider(g, X, Y);
			break;
		case 25:
			paintGhost(g, 0, X, Y);
			break;
		case 26:
			paintGhost(g, 1, X, Y);
			break;
		}
	}

	public static void paintSpider(mGraphics g, int x, int y)
	{
		g.setColor(8026746);
		g.drawRegion(spider, 0, 0, 41, 22, 1, x + 1, y, 33, false);
		g.drawRegion(spider, 0, 0, 41, 22, 0, x, y - 22, 33, false);
	}

	public static void paintGhost(mGraphics g, int type, int x, int y)
	{
		g.drawRegion((type != 0) ? ghost2 : ghost, 0, 0, 35, 32, 0, x, y, 33, false);
	}

	public void resetLastUpdateXY(int x, int y)
	{
		if (index == GameScr.myIndex)
		{
			lastUpdateX = x;
			lastUpdateY = y;
		}
	}

	public void resetXYwhenNEXTTURN()
	{
		if (x != lastUpdateX)
		{
			x = lastUpdateX;
		}
		if (y != lastUpdateY)
		{
			y = lastUpdateY;
		}
	}

	public void getGun()
	{
		isGetGun = true;
		dem = 0;
		cf = fGetGun[0];
	}

	public void moveAngle()
	{
		if (CCanvas.px == CCanvas.pxLast)
		{
			return;
		}
		alpha += 10;
		if (alpha > 250)
		{
			alpha = 250;
		}
		if (isGetGun || isHoldFire)
		{
			return;
		}
		if (!isFrameWithGun() && !isGetGun)
		{
			getGun();
			return;
		}
		int num3;
		if (GameScr.curFocus == 14)
		{
			int num = x - CCanvas.px - Camera.x;
			int num2 = y - CCanvas.py - Camera.y;
			num3 = CRes.angle(-num, num2);
		}
		else
		{
			int num = x - CCanvas.px - Camera.x;
			int num2 = y - CCanvas.py - Camera.y;
			num3 = CRes.angle(num, -num2);
		}
		if (look == 0 && num3 >= 90 && num3 <= 270)
		{
			angle = num3 - 180;
			if (angle < angleLock[gun])
			{
				angle = angleLock[gun];
			}
			if (angle > 89)
			{
				angle = 89;
			}
		}
		if (look == 2 && ((num3 >= 0 && num3 <= 90) || (num3 >= 270 && num3 <= 360)))
		{
			if (num3 - 180 >= 0)
			{
				angle = num3 - 180;
			}
			else
			{
				angle = num3 + 180;
			}
			if (angle > 180 - angleLock[gun])
			{
				angle = 180 - angleLock[gun];
			}
			if (angle < 90)
			{
				angle = 90;
			}
		}
		if (angle - 180 >= 0)
		{
			angle2 = angle - 180;
		}
		else
		{
			angle2 = angle + 180;
		}
		if (state != 1)
		{
			updateFrameAngle();
		}
	}

	public void changeGun(short gun)
	{
		Music.play(Music.GUN_LOADED, 10f);
		gunChage = gun;
		isChangeGun = true;
		angleReset();
	}

	public void setDefaultPart()
	{
	}

	private void updateLuaDauNong()
	{
		if (!BackgroundNew.lowGraphic && isLuaDauNong)
		{
			iLua++;
			if (iLua > 7)
			{
				iLua = 0;
				isLuaDauNong = false;
			}
		}
	}

	private void paintLuaDauNong(mGraphics g)
	{
		if (!BackgroundNew.lowGraphic && isLuaDauNong)
		{
			imgFireFlare.drawFrame(iLua >> 1, xLua, yLua, 0, 3, g, false);
		}
	}

	public void loadDust()
	{
		if (BackgroundNew.lowGraphic)
		{
			return;
		}
		if (imgDust == null)
		{
			imgDust = new Image[2][];
			for (int i = 0; i < imgDust.Length; i++)
			{
				imgDust[i] = new Image[5];
			}
			for (int j = 0; j < 2; j++)
			{
				for (int k = 0; k < 5; k++)
				{
					imgDust[j][k] = CCanvas.loadImage("/e/d" + j + k + ".png");
				}
			}
		}
		if (imgFire == null)
		{
			imgFire = CCanvas.loadImage("/e/khoi.png");
		}
		if (imgFireFlare == null)
		{
			imgFireFlare = new FrameImage(imgFire, 27, 27);
		}
		dustX = new int[2];
		dustY = new int[2];
		dustState = new int[2];
		dustState[0] = (dustState[1] = -1);
	}

	public void paintDust(mGraphics g)
	{
		if (BackgroundNew.lowGraphic)
		{
			return;
		}
		for (int i = 0; i < 2; i++)
		{
			if (dustState[i] != -1)
			{
				g.drawImage(imgDust[i][dustState[i]], dustX[i], dustY[i], 3, false);
			}
		}
	}

	public bool startDust(int dir, int x, int y)
	{
		dir = ((dir != 2) ? 1 : (-1));
		if (BackgroundNew.lowGraphic)
		{
			return false;
		}
		int num = ((dir != 1) ? 1 : 0);
		if (dustState[num] != -1)
		{
			return false;
		}
		dustState[num] = 0;
		dustX[num] = x;
		dustY[num] = y;
		return true;
	}

	public void updateDust()
	{
		if (BackgroundNew.lowGraphic)
		{
			return;
		}
		for (int i = 0; i < 2; i++)
		{
			if (dustState[i] != -1)
			{
				dustState[i]++;
				if (dustState[i] >= 5)
				{
					dustState[i] = -1;
				}
				if (i == 0)
				{
					dustX[i]--;
				}
				else
				{
					dustX[i]++;
				}
				dustY[i]--;
			}
		}
	}

	public void setGift1(bool inBoard)
	{
		bossType = 5;
		if (!inBoard)
		{
			isLanded = true;
			yGift_1 = y;
			isDrop = true;
			return;
		}
		if (CCanvas.gameScr.startTime < 100)
		{
			yGift_1 = y;
			isLanded = true;
			return;
		}
		ap = new Airplane((sbyte)1, (sbyte)0);
		ap.x = x + CCanvas.hw + 50;
		ap.y = y - 140;
		ap.speed = 10;
		if (CCanvas.gameScr == null)
		{
			CCanvas.gameScr = new GameScr();
		}
		CCanvas.gameScr.airplanes.addElement(ap);
		yGift_1 = ap.y + 40;
		if (GameScr.cam != null)
		{
			GameScr.cam.setTargetPointMode(x, y);
		}
	}

	public void setGift2(bool inBoard)
	{
		new Explosion(x, yGift_1, 1);
		bossType = 6;
		if (!inBoard)
		{
			yGift_2 = y;
			isGift_2 = true;
		}
	}
}
