////////////////////////////////////////////////////////////////////////////
//  StarSoldier PS-BB				:	“G(5)
//
//	create	2002/12/20	yamamori	:	
//
////////////////////////////////////////////////////////////////////////////

#if 1

/************************/
/*	±ÄØ½				*/
/************************/
AtorisuJob(o)
{
	switch(enemySts[o]){
		case ENE_START:
		{
			enemyY[o] = -8.0;
			if(seaX >= 160.0){
				enemyPat[o] = 0;
				enemyX[o] = 56.0;
			} else {
				enemyPat[o] = 1;
				enemyX[o] = 264.0;
			}
			enemySts[o] = 1;
			SetEnemyTex(o, 0);
		}

		case 1:
		{
			if(!enemyPat[o]){
				enemyX[o] += 6.0;
			} else {
				enemyX[o] -= 6.0;
			}
			enemyY[o] += 2.0;

			if(++enemyWait[o] >= 23){
				enemyWait[o] = 0;
				enemySts[o] = 2;
			}
		}

		case 2:
		{
			if(!enemyPat[o]){
				enemyX[o] -= 6.0;
			} else {
				enemyX[o] += 6.0;
			}
			enemyY[o] += 2.0;

			if(++enemyWait[o] >= 23){
				enemyWait[o] = 0;
				if(++enemyWork[o] > 1){
					enemySts[o] = 3;
				} else {
					enemySts[o] = 1;
				}
			}
		}

		case 3:
		{
			if(!enemyPat[o]){
				enemyX[o] += 6.0;
			} else {
				enemyX[o] -= 6.0;
			}

			if(++enemyWait[o] >= 23){
				enemyWait[o] = 0;
				enemySts[o] = 4;
			}
		}

		case 4:
		{
			if(!enemyPat[o]){
				enemyX[o] -= 6.0;
			} else {
				enemyX[o] += 6.0;
			}
			enemyY[o] -= 2.0;

			if(++enemyWait[o] >= 23){
				enemyWait[o] = 0;
				enemySts[o] = 5;
			}
		}

		case 5:
		{
			if(!enemyPat[o]){
				enemyX[o] += 6.0;
			} else {
				enemyX[o] -= 6.0;
			}
			enemyY[o] -= 2.0;

			if(++enemyWait[o] >= 23){
				enemyWait[o] = 0;
				enemySts[o] = 4;
			}
		}


	}

	if(enemySts[o]){

		EnemyShot(o);

		SetPos(enemy[o], enemyX[o], enemyY[o], BgDist*1.0);

		MoveEnemyCheck(o, -8.0, 999.9, 999.9, 999.9);
	}
}

/************************/
/*	ÌßØÝ¸Þ				*/
/************************/
PringJob(o)
{
	switch(enemySts[o]){
		case ENE_START:
		{
			enemyX[o] = 48.0 + float(random(15)) * 16.0;
			enemyY[o] = -8.0;
			enemySts[o] = 1;
			SetEnemyTex(o, 0);
		}

		case 1,2:
		{
			enemyX[o] += prgMov[enemyWork[o]*2+0] / 2.0;
			enemyY[o] += prgMov[enemyWork[o]*2+1] / 2.0;
			if(enemySts[o]==2){
				if(++enemyWork[o] == 26){
					enemyWork[o] = 0;
				}
				enemySts[o] = 1;
			} else {
				enemySts[o] = 2;
			}
		}
	}

	if(enemySts[o]){

		EnemyShot(o);

		SetPos(enemy[o], enemyX[o], enemyY[o], BgDist*1.0);

		MoveEnemyCheck(o, 999.9, 232.0, 999.9, 999.9);

	}
}


/************************/
/*	¼ÞªØº				*/
/************************/
JerikoJob(o)
{
	switch(enemySts[o]){
		case ENE_START:
		{
			SetLocalScale(enemy[o], 32.0, 32.0, 128.0);

			if(!enemyChNo[o]){
				enemyX[o] = 120.0;
			} else {
				enemyX[o] = 184.0;
			}
			enemyY[o] = -16.0;

			enemyAnPno[o] = 2;
			SetEnemyTex(o, enemyAnPno[o]);

			enemySts[o] = 1;
		}

		case 1:
		{
			enemyY[o] += 1.0;
			if(enemyY[o] >= 80.0){
				enemySts[o] = 2;
			}
		}

		case 2:
		{
			EnemyShot(o);

			if(++enemyAnWait[o] >= enemyAnFrame[o]){
				enemyAnWait[o] = 0;
				if(++enemyAnPno[o] >= enemyAnPat[o]) enemyAnPno[o] = 0;
				SetEnemyTex(o, enemyAnPno[o]);

				if(enemyAnPno[o]==2){
					if(++enemyWork[o]==11) enemySts[o] = 3;
				}
			}
		}

		case 3:
		{
			enemyY[o] -= 1.0;
		}

	}

	if(enemySts[o]){
		SetPos(enemy[o], enemyX[o], enemyY[o], BgDist*1.0);

		if(MoveEnemyCheck(o, -16.0, 999.9, 999.9, 999.9)){
			SetLocalScale(enemy[o], 16.0, 16.0, 128.0);
		}
	}
}

/************************/
/*	¼ÞªØº”š”­			*/
/************************/
JerikoCheck(sw)
{
	new	i, no;

	for(i=0; i<ENEMY_MAX; i++){
		if(enemyNo[i] != E_JERIKO) continue;

		enemyDamege[i] = 0;
		enemyBe[i] = 0;
		Hide(enemy[i]);
		if(enemyCnt) enemyCnt--;

		if(sw) ComSendMessage(so, RW_SCORE, enemyPoint[i]);
		SetComBombL(no, enemyX[i], enemyY[i]);
		no++;
	}
}


#else

AtorisuJob(o){}
PringJob(o){}
JerikoJob(o){}
JerikoCheck(){}

#endif
