//仱仴仱仴仱仴仱仴仱仴仱仴仱仴仱仴仱仴仱仴仱仴仱仴仱仴仱仴仱仴仱仴仱仴仱仴仱仴仱
//  僗僥乕僞僗No.23 - MISSION儌乕僪 僙儗僋僩夋柺
//仯仮仯仮仯仮仯仮仯仮仯仮仯仮仯仮仯仮仯仮仯仮仯仮仯仮仯仮仯仮仯仮仯仮仯仮仯仮仯
void statMissionSelect(int player) {
	padRepeat(player);
	padRepeat2(player);
	if( (!IsPlayWave(62)) && (wavebgm >= 1) ) {
		PlayWave(62);
	}
	if(statc[player * 10 + 4] > 0){
		statc[player * 10 + 4]--;
		if(statc[player * 10 + 4] == 0) PlaySE(5);
	} else if(statc[player * 10 + 4] < 0){
		statc[player * 10 + 4]++;
		if(statc[player * 10 + 4] == 0) PlaySE(5);
	}
	
	printFont(15 + 24 * player - 12 * maxPlay, 5, "START!", (vslevel[0] <= 1) * count % 9);
	ExBltRect(77, 120 + 192 * player -96 * maxPlay , 52,  (count % 40) * 3, 28, 60, 8);
	
		printFont(15 + 24 * player - 12 * maxPlay, 10, "<        >", (vslevel[0] == 0) * count % 9);
		if(statc[player * 10 + 4] < 0){
			ExBltRect(55,128 + ((16+statc[player * 10 + 4]) * 4) + 192 * player -96 * maxPlay , 63, 
				(64*(rots[player]+1))*(rots[player]<8),32*(fontc[(rots[player]+1)*(rots[player]<8)]),
				(statc[player * 10 + 4]* -4),32);
			ExBltRect(55,128 + 192 * player -96 * maxPlay , 63, 
				(64*rots[player])+(statc[player * 10 + 4] * -4),32*fontc[rots[player]],((16+statc[player * 10 + 4])* 4),32);
		} else if(statc[player * 10 + 4] > 0){
			ExBltRect(55,128 + (statc[player * 10 + 4] * 4) + 192 * player -96 * maxPlay , 63, 
				(64*rots[player]),32*fontc[rots[player]],((16-statc[player * 10 + 4])* 4),32);
			ExBltRect(55,128 + 192 * player -96 * maxPlay , 63, 
				(64*(rots[player]-1))+576*(rots[player]==0)+((16-statc[player * 10 + 4]) * 4),
				32*fontc[rots[player]-1+(9*(rots[player]==0))],(statc[player * 10 + 4] * 4),32);
		} else ExBltRect(55,128 + 192 * player -96 * maxPlay , 63, 64*rots[player] ,32*fontc[rots[player]],64,32);
		ExBltRect(55,158 + 192 * player -96 * maxPlay , 40, (64*rots[player]) ,384,64,21);

//		ExBltRect(55,128 + 192 * player -96 * maxPlay , 55, 64*rots[player] ,32*fontc[rots[player]],64,32);
		if(!english)	//棊壓摿惈乮擔杮岅乯
			ExBltRect(55,128 + 192 * player -96 * maxPlay , 96, 64*rots[player] ,320,64,32);
		else			//棊壓摿惈乮English乯
			ExBltRect(55,128 + 192 * player -96 * maxPlay , 96, 64*rots[player] ,352,64,32);
	printFont(15 + 24 * player - 12 * maxPlay, 16, "FILE", fontc[rots[player]]);

	getRoadName(mission_file);
	printFont(14 + 24 * player - 12 * maxPlay, 17, string[0], (vslevel[0] == 1) * count % 9 );

	printFont(15 + 24 * player - 12 * maxPlay, 19, "STAGE", fontc[rots[player]]);
	sprintf(string[0], "NO.%02d", c_mission);
	printFont(15 + 24 * player - 12 * maxPlay, 20, string[0], (vslevel[0] == 2) * count % 9 );
	
	if((mission_file >= 25) || (debug)){
		printFont(15 + 24 * player - 12 * maxPlay, 22, "LOAD", (vslevel[0] == 3) * count % 9);
		printFont(15 + 24 * player - 12 * maxPlay, 24, "SAVE", (vslevel[0] == 4) * count % 9);
	}else{
		ExBltRect(77, 120 + 192 * player -96 * maxPlay , 176,  160 - ((count % 40) * 3), 20, 80, 8);
	}
	
	// 仾
	if( (mpc2[player] == 1) || ((mpc2[player] > tame3) && (mpc2[player] % tame4 == 0)) )
	if( getPressState(player, 0) ) {
		PlaySE(5);
		vslevel[0]--;
		if(vslevel[0] < 0) vslevel[0] = 4 - (2 * ((mission_file < 25) && (!debug)));
	}
	
	// 伀
	if( (mpc2[player] == 1) || ((mpc2[player] > tame3) && (mpc2[player] % tame4 == 0)) )
	if( getPressState(player, 1) ) {
		PlaySE(5);
		vslevel[0]++;
		if(vslevel[0] > 4 - (2 * ((mission_file < 25) && (!debug)))) vslevel[0] = 0;
	}
	
	// 仼
	if((mpc[player] == 1) || ((mpc[player] > tame1) && (mpc[player] % tame2 == 0)) || (getPressState(player, 6)))
	if( getPressState(player, 2) ) {
		PlaySE(3);
		
		if(vslevel[0] == 0) {
			rots[player]--;
			if(rots[player] < 0) rots[player] = 8;
			statc[player * 10 + 4] = -16;
			setNextBlockColors(player, 1);
		}
		if(vslevel[0] == 1) {
			mission_file--;
			if(mission_file < 0) mission_file = 99;
			loadMissionData(mission_file);
		}
		if(vslevel[0] == 2) {
			c_mission--;
			if(c_mission < 0) c_mission = 29;
		}
		
	}
	
	// 仺
	if((mpc[player] == 1) || ((mpc[player] > tame1) && (mpc[player] % tame2 == 0)) || (getPressState(player, 6)))
	if( getPressState(player, 3) ) {
		PlaySE(3);
		
		if(vslevel[0] == 0) {
			rots[player]++;
			if(rots[player] > 8) rots[player] = 0;
			statc[player * 10 + 4] = 16;
			setNextBlockColors(player, 1);
		}
		if(vslevel[0] == 1) {
			mission_file++;
			if(mission_file > 99) mission_file = 0;
			loadMissionData(mission_file);
		}
		if(vslevel[0] == 2) {
			c_mission++;
			if(c_mission > 29) c_mission = 0;
		}
	}
	
	// B儃僞儞
	if( getPushState(player, 5) ) {
		gameMode[0] = 0;
		vslevel[0] = 0;
		flag = 1;	// 僞僀僩儖傊
	}
	
	// A儃僞儞
	if( getPushState(player, 4) ) {
		PlaySE(10);
		
		if(vslevel[0] <= 1) {
			// START!
			start_mission = c_mission;
			if(((mission_file == 6) || (mission_file == 18) || (mission_file == 24)) && (start_mission == 0)) PlaySE(18);
			StopAllBGM();
			//攚宨傪愝掕
			if(mission_type[c_mission] == 19)
				backno = 10;
			else if((mission_type[c_mission] == 20) || (mission_type[c_mission] == 22) || (mission_type[c_mission] == 29))
				backno = 11;
			else {
			backno = ((c_mission+1) % 10)-1;
			if(backno < 0)
				backno = 9;
			}
			if(backno >= bg_max) backno = bg_max;
			if(mission_bgm[c_mission] != -1)
				bgmlv = mission_bgm[c_mission];
			else fadelv[0] = 10;
			if(repversw < 54)missionSetStatus();
			stat[player] = 1;				// 僽儘僢僋僔儍僢僞乕幚峴
			statc[player * 10] = 0;			// 僗僥乕僞僗僇僂儞僞傪0偵
			statc[player * 10 + 1] = 3;		// 僔儍僢僞乕屻偼僗僥乕僞僗No.3
			statc[player * 10 + 4] = 0;
			return;
		}
		if((vslevel[0] == 2) && ((mission_file >= 25) || (debug))) {
			// EDIT
			StopAllBGM();
			statc[player * 10 + 4] = 0;
			stat[player] = 24;
		}
		if(vslevel[0] == 3) {
			// LOAD
			loadMissionData(mission_file);
		}
		if(vslevel[0] == 4) {
			// SAVE
			saveMissionData(mission_file);
		}
	}
}

//仱仴仱仴仱仴仱仴仱仴仱仴仱仴仱仴仱仴仱仴仱仴仱仴仱仴仱仴仱仴仱仴仱仴仱仴仱仴仱
//  僗僥乕僞僗No.24 - MISSION儌乕僪 僄僨傿僢僩夋柺
//仯仮仯仮仯仮仯仮仯仮仯仮仯仮仯仮仯仮仯仮仯仮仯仮仯仮仯仮仯仮仯仮仯仮仯仮仯仮仯
void statMissionEditor(int player) {
	padRepeat(player);
	padRepeat2(player);
	
	// 栤戣偺庬椶
	printFont(15 + 24 * player - 12 * maxPlay, 5, "TYPE", fontc[rots[player]]);

	printFont(15 + 24 * player - 12 * maxPlay, 6, mission_name_editor[mission_type[c_mission]], (statc[0 + player * 10] == 0) * count % 9);

	// 僲儖儅
	printFont(15 + 24 * player - 12 * maxPlay, 7, "NORM", fontc[rots[player]]);
	sprintf(string[0], "%d", mission_norm[c_mission]);
	printFont(15 + 24 * player - 12 * maxPlay, 8, string[0], (statc[0 + player * 10] == 1) * count % 9);
	
	// 惂尷帪娫
	printFont(15 + 24 * player - 12 * maxPlay, 9, "TIME", fontc[rots[player]]);
	getTime(mission_time[c_mission]);
	printFont(15 + 24 * player - 12 * maxPlay, 10, string[0], (statc[0 + player * 10] == 2) * count % 9);
	
	// 儗儀儖
	printFont(15 + 24 * player - 12 * maxPlay, 11, "LEVEL", fontc[rots[player]]);
	if(mission_lv[c_mission] >= 15)
		sprintf(string[0], "PLUS %d", mission_lv[c_mission] + 1 - 15);
	else
		sprintf(string[0], "%d", mission_lv[c_mission] + 1);
	printFont(15 + 24 * player - 12 * maxPlay, 12, string[0], (statc[0 + player * 10] == 3) * count % 9);
	
	// 僄儞僨傿儞僌
	printFont(15 + 24 * player - 12 * maxPlay, 13, "ENDING", fontc[rots[player]]);
	if(mission_end[c_mission] == 0) {
		sprintf(string[0], "NO");
	} else if(mission_end[c_mission] == 1) {
		sprintf(string[0], "END");
	} else if(mission_end[c_mission] == 2) {
		sprintf(string[0], "EXTRA");
	} else if(mission_end[c_mission] == 3) {
		sprintf(string[0], "EXTRA+");
	} else if(mission_end[c_mission] == 4) {
		sprintf(string[0], "STAFF ROLL");
	} else if(mission_end[c_mission] == 5) {
		sprintf(string[0], "M ROLL");
	} else if(mission_end[c_mission] == 6) {
		sprintf(string[0], "DEVIL+M ROLL");
	}
	printFont(15 + 24 * player - 12 * maxPlay, 14, string[0], (statc[0 + player * 10] == 4) * count % 9);
	
	// 徚嫀儔僀儞悢
	if(mission_erase[c_mission] < -20){
		printFont(15 + 24 * player - 12 * maxPlay, 15, "RISEE LINE", fontc[rots[player]]);
		sprintf(string[0], "%d", abs_YGS2K(mission_erase[c_mission]+20));
	}else if(mission_erase[c_mission] < 0){
		printFont(15 + 24 * player - 12 * maxPlay, 15, "RISEH LINE", fontc[rots[player]]);
		sprintf(string[0], "%d", abs_YGS2K(mission_erase[c_mission]));
	}else{
		printFont(15 + 24 * player - 12 * maxPlay, 15, "ERASE LINE", fontc[rots[player]]);
		sprintf(string[0], "%d", mission_erase[c_mission]);
	}
	printFont(15 + 24 * player - 12 * maxPlay, 16, string[0], (statc[0 + player * 10] == 5) * count % 9);
	// 捛壛忣曬
	// 18峴栚MAX 19峴栚MIN 20峴栚OPT(僞乕僎僢僩偩偲夝愢)丂21峴栚夝愢
	printFont(15 + 24 * player - 12 * maxPlay, 17, "OPTIONS", fontc[rots[player]]);
	if((mission_type[c_mission] == 2)||(mission_type[c_mission] == 3)){
		sprintf(string[0], "GRADE:%d",mission_opt_1[c_mission]);
		printFont(15 + 24 * player - 12 * maxPlay, 18, string[0], (statc[0 + player * 10] == 6) * count % 9);
		sprintf(string[0], "0=N1=E2=H");
		printFont(15 + 24 * player - 12 * maxPlay, 19, string[0], (statc[0 + player * 10] == 7) * count % 9);
		sprintf(string[0], "NO OPTION");
		printFont(15 + 24 * player - 12 * maxPlay, 20, string[0], (statc[0 + player * 10] == 8) * count % 9);

	}
	else if(mission_type[c_mission] == 6){   //僞乕僎僢僩
		sprintf(string[0], "MINSTAGE:%d", mission_opt_1[c_mission]);
		printFont(15 + 24 * player - 12 * maxPlay, 18, string[0], (statc[0 + player * 10] == 6) * count % 9);
		sprintf(string[0], "MAXSTAGE:%d", mission_opt_2[c_mission]);
		printFont(15 + 24 * player - 12 * maxPlay, 19, string[0], (statc[0 + player * 10] == 7) * count % 9);
		if((statc[0 + player * 10] == 6) || (statc[0 + player * 10] == 7)){
			sprintf(string[0], "0-26=TI ");
			printFont(15 + 24 * player - 12 * maxPlay, 20, string[0], 3);
			sprintf(string[0], "27-44=EH");
			printFont(15 + 24 * player - 12 * maxPlay, 21, string[0], 3);
			sprintf(string[0], "45-71=ACE");
			printFont(15 + 24 * player - 12 * maxPlay, 22, string[0], 3);
			sprintf(string[0], "100-199=FP");
			printFont(15 + 24 * player - 12 * maxPlay, 23, string[0], 3);
		}else{
			if(!mission_opt_3[c_mission]){
				sprintf(string[0], "RANDTGT:OFF", 0);
			}else if(mission_opt_3[c_mission] == 99){
				sprintf(string[0], "RANDTGT:FULL", 0);
			}else{
				sprintf(string[0], "RANDTGT:%d", mission_opt_3[c_mission]);
			}
			printFont(15 + 24 * player - 12 * maxPlay, 21, string[0], (statc[0 + player * 10] == 8) * count % 9);
		}
	}
	else if((mission_type[c_mission] == 7)||(mission_type[c_mission] == 39)){   //僀儗僀偝乕
		sprintf(string[0], "MINLINE:%d", mission_opt_1[c_mission]);
		printFont(15 + 24 * player - 12 * maxPlay, 18, string[0], (statc[0 + player * 10] == 6) * count % 9);
		sprintf(string[0], "MAXLINE:%d", mission_opt_2[c_mission]);
		printFont(15 + 24 * player - 12 * maxPlay, 19, string[0], (statc[0 + player * 10] == 7) * count % 9);
		sprintf(string[0], "VIEWLINE:%d", mission_opt_3[c_mission]);
		printFont(15 + 24 * player - 12 * maxPlay, 20, string[0], (statc[0 + player * 10] == 8) * count % 9);
		sprintf(string[0], "MAX:3");
		printFont(15 + 24 * player - 12 * maxPlay, 21, string[0], (statc[0 + player * 10] == 8) * count % 9);
		sprintf(string[0], "MIN:0");
		printFont(15 + 24 * player - 12 * maxPlay, 22, string[0], (statc[0 + player * 10] == 8) * count % 9);
	}
	else if(mission_type[c_mission] == 10){  //傾僫僓乕
		sprintf(string[0], "NO OPTION");
		printFont(15 + 24 * player - 12 * maxPlay, 18, string[0], (statc[0 + player * 10] == 6) * count % 9);
		sprintf(string[0], "NO OPTION");
		printFont(15 + 24 * player - 12 * maxPlay, 19, string[0], (statc[0 + player * 10] == 7) * count % 9);
		sprintf(string[0], "BLINDON:%d", mission_opt_3[c_mission]);
		printFont(15 + 24 * player - 12 * maxPlay, 20, string[0], (statc[0 + player * 10] == 8) * count % 9);
		sprintf(string[0], "0:OFF 1:ON");
		printFont(15 + 24 * player - 12 * maxPlay, 21, string[0], (statc[0 + player * 10] == 8) * count % 9);
	}
	else if(mission_type[c_mission] == 19){  //DEVIL 800
		sprintf(string[0], "NO OPTION");
		printFont(15 + 24 * player - 12 * maxPlay, 18, string[0], (statc[0 + player * 10] == 6) * count % 9);
		sprintf(string[0], "NO OPTION");
		printFont(15 + 24 * player - 12 * maxPlay, 19, string[0], (statc[0 + player * 10] == 7) * count % 9);
		sprintf(string[0], "RISEPACE:%d", mission_opt_3[c_mission]);
		printFont(15 + 24 * player - 12 * maxPlay, 20, string[0], (statc[0 + player * 10] == 8) * count % 9);
		sprintf(string[0], "MAX:20");
		printFont(15 + 24 * player - 12 * maxPlay, 21, string[0], (statc[0 + player * 10] == 8) * count % 9);
		sprintf(string[0], "MIN:1");
		printFont(15 + 24 * player - 12 * maxPlay, 22, string[0], (statc[0 + player * 10] == 8) * count % 9);
	}
	else if(mission_type[c_mission] == 20){  //DEVIL 1200
		sprintf(string[0], "NO OPTION");
		printFont(15 + 24 * player - 12 * maxPlay, 18, string[0], (statc[0 + player * 10] == 6) * count % 9);
		sprintf(string[0], "NO OPTION");
		printFont(15 + 24 * player - 12 * maxPlay, 19, string[0], (statc[0 + player * 10] == 7) * count % 9);
		sprintf(string[0], "SPEED:%d", mission_opt_3[c_mission]);
		printFont(15 + 24 * player - 12 * maxPlay, 20, string[0], (statc[0 + player * 10] == 8) * count % 9);
		sprintf(string[0], "0:OLD");
		printFont(15 + 24 * player - 12 * maxPlay, 21, string[0], (statc[0 + player * 10] == 8) * count % 9);
		sprintf(string[0], "1:DOOM");
		printFont(15 + 24 * player - 12 * maxPlay, 22, string[0], (statc[0 + player * 10] == 8) * count % 9);
	}
	else if(mission_type[c_mission] == 21){  //GARBAGE
		sprintf(string[0], "NO OPTION");
		printFont(15 + 24 * player - 12 * maxPlay, 18, string[0], (statc[0 + player * 10] == 6) * count % 9);
		sprintf(string[0], "NO OPTION");
		printFont(15 + 24 * player - 12 * maxPlay, 19, string[0], (statc[0 + player * 10] == 7) * count % 9);
		sprintf(string[0], "RISELINE:%d", mission_opt_3[c_mission]);
		printFont(15 + 24 * player - 12 * maxPlay, 20, string[0], (statc[0 + player * 10] == 8) * count % 9);
		sprintf(string[0], "MAX:18");
		printFont(15 + 24 * player - 12 * maxPlay, 21, string[0], (statc[0 + player * 10] == 8) * count % 9);
	}
	else if(mission_type[c_mission] == 26){  //ALLCLEAR
		sprintf(string[0], "NO OPTION");
		printFont(15 + 24 * player - 12 * maxPlay, 18, string[0], (statc[0 + player * 10] == 6) * count % 9);
		sprintf(string[0], "NO OPTION");
		printFont(15 + 24 * player - 12 * maxPlay, 19, string[0], (statc[0 + player * 10] == 7) * count % 9);
		sprintf(string[0], "NOBIG:%d", mission_opt_3[c_mission]);
		printFont(15 + 24 * player - 12 * maxPlay, 20, string[0], (statc[0 + player * 10] == 8) * count % 9);
		sprintf(string[0], "0:OFF 1:ON");
		printFont(15 + 24 * player - 12 * maxPlay, 21, string[0], (statc[0 + player * 10] == 8) * count % 9);
	}
	else if(mission_type[c_mission] == 27){  //COMBO
		sprintf(string[0], "NO OPTION");
		printFont(15 + 24 * player - 12 * maxPlay, 18, string[0], (statc[0 + player * 10] == 6) * count % 9);
		sprintf(string[0], "NO OPTION");
		printFont(15 + 24 * player - 12 * maxPlay, 19, string[0], (statc[0 + player * 10] == 7) * count % 9);
		sprintf(string[0], "NOT1LINE:%d", mission_opt_3[c_mission]);
		printFont(15 + 24 * player - 12 * maxPlay, 20, string[0], (statc[0 + player * 10] == 8) * count % 9);
		sprintf(string[0], "0:OFF 1:ON");
		printFont(15 + 24 * player - 12 * maxPlay, 21, string[0], (statc[0 + player * 10] == 8) * count % 9);	
	}
	else if((mission_type[c_mission] >= 30) && (mission_type[c_mission] <= 33)||(mission_type[c_mission] == 38)){
		sprintf(string[0], "NO OPTION");
		printFont(15 + 24 * player - 12 * maxPlay, 18, string[0], (statc[0 + player * 10] == 6) * count % 9);
		sprintf(string[0], "HOLD USE:%d",mission_opt_2[c_mission]);
		printFont(15 + 24 * player - 12 * maxPlay, 19, string[0], (statc[0 + player * 10] == 7) * count % 9);
		sprintf(string[0], "BLOCK:%d", mission_opt_3[c_mission]);
		printFont(15 + 24 * player - 12 * maxPlay, 20, string[0], (statc[0 + player * 10] == 8) * count % 9);
		printFont(15 + 24 * player - 12 * maxPlay, 21, "(0-8)", (statc[0 + player * 10] == 8) * count % 9);
	}
	// 偦偺懠
	else {
		sprintf(string[0], "NO OPTION");
		printFont(15 + 24 * player - 12 * maxPlay, 18, string[0], (statc[0 + player * 10] == 6) * count % 9);
		sprintf(string[0], "NO OPTION");
		printFont(15 + 24 * player - 12 * maxPlay, 19, string[0], (statc[0 + player * 10] == 7) * count % 9);
		sprintf(string[0], "NO OPTION");
		printFont(15 + 24 * player - 12 * maxPlay, 20, string[0], (statc[0 + player * 10] == 8) * count % 9);
	}
	printFont(15 + 24 * player - 12 * maxPlay, 24, "BGM", fontc[rots[player]]);
	if(mission_bgm[c_mission] == -1)
		sprintf(string[0], "FADE", mission_bgm[c_mission]);
	else
		sprintf(string[0], "%d", mission_bgm[c_mission]);	
	printFont(19 + 24 * player - 12 * maxPlay, 24, string[0], (statc[0 + player * 10] == 9) * count % 9);

	// 仾
	if( (mpc2[player] == 1) || ((mpc2[player] > tame3) && (mpc2[player] % tame4 == 0)) )
	if( getPressState(player, 0) ) {
		PlaySE(5);
		statc[0 + player * 10]--;
		if(statc[0 + player * 10] < 0) statc[0 + player * 10] = 9;
	}
	
	// 伀
	if( (mpc2[player] == 1) || ((mpc2[player] > tame3) && (mpc2[player] % tame4 == 0)) )
	if( getPressState(player, 1) ) {
		PlaySE(5);
		statc[0 + player * 10]++;
		if(statc[0 + player * 10] > 9) statc[0 + player * 10] = 0;
	}
	
	// 仼
	if((mpc[player] == 1) || ((mpc[player] > tame1) && (mpc[player] % tame2 == 0)) || (getPressState(player, 6)))
	if( getPressState(player, 2) ) {
		PlaySE(3);
		
		// TYPE
		if(statc[0 + player * 10] == 0) {
			mission_type[c_mission]--;
			if(mission_type[c_mission] < 0) mission_type[c_mission] = 41;
		}
		// NORM
		if(statc[0 + player * 10] == 1) {
			mission_norm[c_mission]--;
			if(mission_norm[c_mission] < 0) mission_norm[c_mission] = 99;
		}
		// TIME
		if(statc[0 + player * 10] == 2) {
			mission_time[c_mission] = mission_time[c_mission] - 60;
			if(mission_time[c_mission] < 0) mission_time[c_mission] = 60 * 60 * 20;
		}
		// LEVEL
		if(statc[0 + player * 10] == 3) {
			mission_lv[c_mission]--;
			if(mission_lv[c_mission] < 0) mission_lv[c_mission] = 29;
		}
		// ENDING
		if(statc[0 + player * 10] == 4) {
			mission_end[c_mission]--;
			if(mission_end[c_mission] < 0) mission_end[c_mission] = 6;
		}
		// ERASE LINE
		if(statc[0 + player * 10] == 5) {
			mission_erase[c_mission]--;
			if(mission_erase[c_mission] < -40) mission_erase[c_mission] = 21;
		}
		// OPTIONS
		if(statc[0 + player * 10] == 6) {
			mission_opt_1[c_mission]--;
			if(mission_opt_1[c_mission] < 0) mission_opt_1[c_mission] = 199;
		}
		if(statc[0 + player * 10] == 7) {
			mission_opt_2[c_mission]--;
			if(mission_opt_2[c_mission] < 0) mission_opt_2[c_mission] = 199;
		}
		if(statc[0 + player * 10] == 8) {
			mission_opt_3[c_mission]--;
			if(mission_opt_3[c_mission] < 0) mission_opt_3[c_mission] = 99;
		}
		if(statc[0 + player * 10] == 9) {
			mission_bgm[c_mission]--;
			if(mission_bgm[c_mission] < -1) mission_bgm[c_mission] = 19;
		}
	}
	
	// 仺
	if((mpc[player] == 1) || ((mpc[player] > tame1) && (mpc[player] % tame2 == 0)) || (getPressState(player, 6)))
	if( getPressState(player, 3) ) {
		PlaySE(3);
		
		// TYPE
		if(statc[0 + player * 10] == 0) {
			mission_type[c_mission]++;
			if(mission_type[c_mission] > 41) mission_type[c_mission] = 0;
		}
		// NORM
		if(statc[0 + player * 10] == 1) {
			mission_norm[c_mission]++;
			if(mission_norm[c_mission] > 99) mission_norm[c_mission] = 0;
		}
		// TIME
		if(statc[0 + player * 10] == 2) {
			mission_time[c_mission] = mission_time[c_mission] + 60;
			if(mission_time[c_mission] > 60 * 60 * 20) mission_time[c_mission] = 0;
		}
		// LEVEL
		if(statc[0 + player * 10] == 3) {
			mission_lv[c_mission]++;
			if(mission_lv[c_mission] > 29) mission_lv[c_mission] = 0;
		}
		// ENDING
		if(statc[0 + player * 10] == 4) {
			mission_end[c_mission]++;
			if(mission_end[c_mission] > 6) mission_end[c_mission] = 0;
		}
		// ERASE LINE
		if(statc[0 + player * 10] == 5) {
			mission_erase[c_mission]++;
			if(mission_erase[c_mission] > 21) mission_erase[c_mission] = -40;
		}
		// OPTIONS
		if(statc[0 + player * 10] == 6) {
			mission_opt_1[c_mission]++;
			if(mission_opt_1[c_mission] > 199) mission_opt_1[c_mission] = 0;
		}
		if(statc[0 + player * 10] == 7) {
			mission_opt_2[c_mission]++;
			if(mission_opt_2[c_mission] > 199) mission_opt_2[c_mission] = 0;
		}
		if(statc[0 + player * 10] == 8) {
			mission_opt_3[c_mission]++;
			if(mission_opt_3[c_mission] > 99) mission_opt_3[c_mission] = 0;
		}
		if(statc[0 + player * 10] == 9) {
			mission_bgm[c_mission]++;
			if(mission_bgm[c_mission] > 19) mission_bgm[c_mission] = -1;
		}
	}
	
	// A傑偨偼B儃僞儞
	if( getPushState(player, 4) || getPushState(player, 5) ) {
		stat[player] = 23;	// 僙儗僋僩夋柺偵栠傞
		statc[0 + player * 10] = 0;
	}
}

//仱仴仱仴仱仴仱仴仱仴仱仴仱仴仱仴仱仴仱仴仱仴仱仴仱仴仱仴仱仴仱仴仱仴仱仴仱仴仱
//  栤戣偺昞帵
//仯仮仯仮仯仮仯仮仯仮仯仮仯仮仯仮仯仮仯仮仯仮仯仮仯仮仯仮仯仮仯仮仯仮仯仮仯仮仯
void viewMission() {
	int i,tmp,minus,c_tmp,c_tmp1,c_tmp2;
	tmp = 0;
	minus = 0;
	
	// BltFastRect(僾儗乕儞僫儞僶乕,dx,dy,sx,sy,hx,hy);
	
	// 榞
	if(getDrawRate() == 1) {
		if(mission_file <= 24) BltFastRect(44, maxPlay * 208, 12, 160, (20 * mission_file) + (10 * (english)), 80, 10);
		BltFastRect(44, 208 * maxPlay, 112, 288, 368, 112, 128);
	} else {
		if(mission_file <= 24) BltFastRect(44, 8 + maxPlay * 408, 24, 32, (32 * mission_file) + (16 * (english)), 128, 16);
		BltFastRect(44, 16 + maxPlay * 400, 224, 448, 288, 192, 192);
	}
	
	// 栤戣偺庬椶
	if((ending[0] <= 1) || (ending[0] >= 4)){
	if(getDrawRate() == 1) {
		TextLayerOn(0, 6 + 208 * maxPlay, 8 + 112);
		TextSize(0, 10);
	} else {
		TextLayerOn(0, 10 + 16 + maxPlay * 400, 8 + 228);
		TextSize(0, 16);
	}
	TextColor(0, 0, 0, 0);
	TextBackColorDisable(0);
	
	getMissionName(mission_type[c_mission],c_mission);
	
	// 棊壓懍搙儗儀儖
	if((mission_type[c_mission] != 19) && (mission_type[c_mission] != 20) && (mission_type[c_mission] != 29)){
		sprintf(string[70], " LV%02d", mission_lv[c_mission] + 1 - 15 * (mission_lv[c_mission] >= 15));
		strcat(string[0], string[70]);
	}else if(mission_type[c_mission] == 20){
		if(!mission_opt_3[c_mission])
			strcat(string[0]," OLD");
		else
			strcat(string[0], " REAL");
	}
	
	// 昤夋
	TextOut(0, string[0]);
	TextBlt(0);
	
	// 惂尷帪娫
	if(getDrawRate() == 1) {
		TextMove(0, 6 + 208 * maxPlay, 30 + 112);
	} else {
		TextMove(0, 10 + 16 + maxPlay * 400, 30 + 228);
	}
	
	if(!english) strcpy(string[70], "惂尷帪娫 ");
	else strcpy(string[70], "Time ");
	
	getTime(mission_time[c_mission]);
	if(mission_time[c_mission]>0){
	strcat(string[70], string[0]);
	}else{
		if(!english) strcat(string[70], "柍惂尷");
		else strcat(string[70], "NoLimit");
	}
	
	// 昤夋
	TextOut(0, string[70]);
	TextBlt(0);
	
	// 巜椷暥
	if(getDrawRate() == 1) {
		TextMove(0, 6 + 208 * maxPlay, 52 + 112);
	} else {
		TextMove(0, 10 + 16 + maxPlay * 400, 52 + 228);
	}
	// LITE斉傪嶲峫偵惍棟
	if(!english) {//"\n\n傪巊偭偰\n%d儔僀儞徚偣両",
		sprintf(string[0], mission_info_jp[mission_type[c_mission]], mission_norm[c_mission]);
		if(((mission_type[c_mission] >= 30) && (mission_type[c_mission] <= 33)||(mission_type[c_mission] == 38))&&(mission_opt_2[c_mission]==1))strcat(string[0], "\n\n徚偡慜偵偦偺僽儘僢僋\n傪堦搙儂乕儖僪偵擖傟傠");
		if(((mission_type[c_mission] == 2) || (mission_type[c_mission] == 3))&&(mission_opt_1[c_mission]==1))strcat(string[0], "\n\n巜掕埲忋偱傕僇僂儞僩!");
		if(((mission_type[c_mission] == 2) || (mission_type[c_mission] == 3))&&(mission_opt_1[c_mission]==2))strcat(string[0], "\n\n巜掕埲奜偱\n僲儖儅儕僙僢僩!");
		if((mission_end[c_mission] == 2) || (mission_end[c_mission] == 3))strcat(string[0], "\n\n嵟屻偺儔僀儞偼\n僟僽儖偱徚偣両");
	} else {
		sprintf(string[0], mission_info_en[mission_type[c_mission]], mission_norm[c_mission]);
		if(((mission_type[c_mission] >= 30) && (mission_type[c_mission] <= 33)||(mission_type[c_mission] == 38))&&(mission_opt_2[c_mission]==1))strcat(string[0], "\n\nBefore Erase \ninto HOLD");
		if(((mission_type[c_mission] == 2) || (mission_type[c_mission] == 3))&&(mission_opt_1[c_mission]==1))strcat(string[0], "\n\nErase over lines count");
		if(((mission_type[c_mission] == 2) || (mission_type[c_mission] == 3))&&(mission_opt_1[c_mission]==2))strcat(string[0], "\n\nDo not erase\n other lines!");
		if((mission_end[c_mission] == 2) || (mission_end[c_mission] == 3))strcat(string[0], "\n\nlast erase 2 lines");
		
	}
	
	//僽儘僢僋僆乕僟乕宯偺僽儘僢僋偺奊
	if((mission_type[c_mission] >= 30) && (mission_type[c_mission] <= 33)||(mission_type[c_mission] == 38)){
		if(mission_opt_3[c_mission]<=6){
			if( isWRule(0) ) {
				// 儚乕儖僪
				c_tmp = wcol[mission_opt_3[c_mission]];
			} else if( (rots[0] >= 4 ) && (rots[0] != 8)) {
				// ARS
				c_tmp = acol[mission_opt_3[c_mission]];
			} else {
				// 僋儔僔僢僋
				c_tmp = ccol[mission_opt_3[c_mission]];
			}
			//7JL 8SZ
			if ( getDrawRate() == 1 ){
				if(!english){
					drawBlockFast(2 + 25 * maxPlay, 20 + isWRule(0) * (mission_opt_3[c_mission] != 0) + 
					((mission_opt_3[c_mission] == 0) && (rots[0] != 8)), mission_opt_3[c_mission], 0, c_tmp, 0, -1, 0, 0 ,0);
				}else{
					drawBlockFast(3 - (mission_type[c_mission] == 33) + 25 * maxPlay, 21 + (mission_type[c_mission] >= 31) + 
					(mission_type[c_mission] == 33) + isWRule(0) * (mission_opt_3[c_mission] != 0) + 
					((mission_opt_3[c_mission] == 0) && (rots[0] != 8)), mission_opt_3[c_mission], 0, c_tmp, 0, 1, 0, 0, 0);
				}
			}else{
				if(!english){
					drawBlockFast(2 + 25 * maxPlay, 16 + isWRule(0) * (mission_opt_3[c_mission] != 0) + 
					((mission_opt_3[c_mission] == 0) && (rots[0] != 8)), mission_opt_3[c_mission], 0, c_tmp, 0, 2, 0, 0, 0);
				}else{
					drawBlockFast(3 - (mission_type[c_mission] == 33) + 25 * maxPlay, 17 + (mission_type[c_mission] >= 31) + 
					(mission_type[c_mission] == 33) + isWRule(0) * (mission_opt_3[c_mission] != 0) + 
					((mission_opt_3[c_mission] == 0) && (rots[0] != 8)), mission_opt_3[c_mission], 0, c_tmp, 0, 4, 0, 0, 0);
				}
			}
		}else if(mission_opt_3[c_mission]==7){//LJ
			if( isWRule(0) ) {
				// 儚乕儖僪
				c_tmp1 = wcol[1];
				c_tmp2 = wcol[5];
			} else if( (rots[0] >= 4 ) && (rots[0] != 8)) {
				// ARS
				c_tmp1 = acol[1];
				c_tmp2 = acol[5];
			} else {
				// 僋儔僔僢僋
				c_tmp1 = ccol[1];
				c_tmp2 = ccol[5];
			}
			//7JL 8SZ
			if ( getDrawRate() == 1 ){
				if(!english){
					drawBlockFast(2 + 25 * maxPlay, 20 + isWRule(0) * (mission_opt_3[c_mission] != 0) + 
					((mission_opt_3[c_mission] == 0) && (rots[0] != 8)), 1, 0, c_tmp1, 0, -1, 0, 0, 0);
					drawBlockFast(6 + 25 * maxPlay, 20 + isWRule(0) * (mission_opt_3[c_mission] != 0) + 
					((mission_opt_3[c_mission] == 0) && (rots[0] != 8)), 5, 0, c_tmp2, 0, -1, 0, 0, 0);
				}else{
					drawBlockFast(3 - (mission_type[c_mission] == 33) + 25 * maxPlay, 21 + (mission_type[c_mission] >= 31) + 
					(mission_type[c_mission] == 33) + isWRule(0) * (mission_opt_3[c_mission] != 0) + 
					((mission_opt_3[c_mission] == 0) && (rots[0] != 8)),1, 0, c_tmp1, 0, 1, 0, 0, 0);
					drawBlockFast(7 - (mission_type[c_mission] == 33) + 25 * maxPlay, 21 + (mission_type[c_mission] >= 31) + 
					(mission_type[c_mission] == 33) + isWRule(0) * (mission_opt_3[c_mission] != 0) + 
					((mission_opt_3[c_mission] == 0) && (rots[0] != 8)),5, 0, c_tmp2, 0, 1, 0, 0, 0);
				}
			}else{
				if(!english){
					drawBlockFast(2 + 25 * maxPlay, 16 + isWRule(0) * (mission_opt_3[c_mission] != 0) + 
					((mission_opt_3[c_mission] == 0) && (rots[0] != 8)), 1, 0, c_tmp1, 0, 2, 0, 0, 0);
					drawBlockFast(6 + 25 * maxPlay, 16 + isWRule(0) * (mission_opt_3[c_mission] != 0) + 
					((mission_opt_3[c_mission] == 0) && (rots[0] != 8)), 5, 0, c_tmp2, 0, 2, 0, 0, 0);
				}else{
					drawBlockFast(3 - (mission_type[c_mission] == 33) + 25 * maxPlay, 17 + (mission_type[c_mission] >= 31) + 
					(mission_type[c_mission] == 33) + isWRule(0) * (mission_opt_3[c_mission] != 0) + 
					((mission_opt_3[c_mission] == 0) && (rots[0] != 8)), 1, 0, c_tmp1, 0, 4, 0, 0, 0);
					drawBlockFast(7 - (mission_type[c_mission] == 33) + 25 * maxPlay, 17 + (mission_type[c_mission] >= 31) + 
					(mission_type[c_mission] == 33) + isWRule(0) * (mission_opt_3[c_mission] != 0) + 
					((mission_opt_3[c_mission] == 0) && (rots[0] != 8)), 5, 0, c_tmp2, 0, 4, 0, 0, 0);
				}
			}
		}else if(mission_opt_3[c_mission]==8){//SZ
			if( isWRule(0) ) {
				// 儚乕儖僪
				c_tmp1 = wcol[3];
				c_tmp2 = wcol[6];
			} else if( (rots[0] >= 4 ) && (rots[0] != 8)) {
				// ARS
				c_tmp1 = acol[3];
				c_tmp2 = acol[6];
			} else {
				// 僋儔僔僢僋
				c_tmp1 = ccol[3];
				c_tmp2 = ccol[6];
			}
			//7JL 8SZ
			if ( getDrawRate() == 1 ){
				if(!english){
					drawBlockFast(2 + 25 * maxPlay, 20 + isWRule(0) * (mission_opt_3[c_mission] != 0) + 
					((mission_opt_3[c_mission] == 0) && (rots[0] != 8)), 3, 0, c_tmp1, 0, -1, 0, 0, 0);
					drawBlockFast(6 + 25 * maxPlay, 20 + isWRule(0) * (mission_opt_3[c_mission] != 0) + 
					((mission_opt_3[c_mission] == 0) && (rots[0] != 8)), 6, 0, c_tmp2, 0, -1, 0, 0, 0);
				}else{
					drawBlockFast(3 - (mission_type[c_mission] == 33) + 25 * maxPlay, 21 + (mission_type[c_mission] >= 31) + 
					(mission_type[c_mission] == 33) + isWRule(0) * (mission_opt_3[c_mission] != 0) + 
					((mission_opt_3[c_mission] == 0) && (rots[0] != 8)), 3, 0, c_tmp1, 0, 1, 0, 0, 0);
					drawBlockFast(7 - (mission_type[c_mission] == 33) + 25 * maxPlay, 21 + (mission_type[c_mission] >= 31) + 
					(mission_type[c_mission] == 33) + isWRule(0) * (mission_opt_3[c_mission] != 0) + 
					((mission_opt_3[c_mission] == 0) && (rots[0] != 8)), 6, 0, c_tmp2, 0, 1, 0, 0, 0);
				}
			}else{
				if(!english){
					drawBlockFast(2 + 25 * maxPlay, 16 + isWRule(0) * (mission_opt_3[c_mission] != 0) + 
					((mission_opt_3[c_mission] == 0) && (rots[0] != 8)), 3, 0, c_tmp1, 0, 2, 0, 0, 0);
					drawBlockFast(6 + 25 * maxPlay, 16 + isWRule(0) * (mission_opt_3[c_mission] != 0) + 
					((mission_opt_3[c_mission] == 0) && (rots[0] != 8)), 6, 0, c_tmp2, 0, 2, 0, 0, 0);
				}else{
					drawBlockFast(3 - (mission_type[c_mission] == 33) + 25 * maxPlay, 17 + (mission_type[c_mission] >= 31) + 
					(mission_type[c_mission] == 33) + isWRule(0) * (mission_opt_3[c_mission] != 0) + 
					((mission_opt_3[c_mission] == 0) && (rots[0] != 8)), 3, 0, c_tmp1, 0, 4, 0, 0, 0);
					drawBlockFast(7 - (mission_type[c_mission] == 33) + 25 * maxPlay, 17 + (mission_type[c_mission] >= 31) + 
					(mission_type[c_mission] == 33) + isWRule(0) * (mission_opt_3[c_mission] != 0) + 
					((mission_opt_3[c_mission] == 0) && (rots[0] != 8)), 6, 0, c_tmp2, 0, 4, 0, 0, 0);
				}
			}
		}
	}
	
	// 昤夋
	TextOut(0, string[0]);
	TextBlt(0);
	
	// 巊梡廔椆
	TextLayerOff(0);
	while(c_mission - tmp > 4){
		tmp = tmp + 5;
	}
	
	// 儈僢僔儑儞堦棗
	for(i = tmp; i < (tmp+5); i++) {
		if(getDrawRate() == 1) {
			BltFastRect(44, 208 * maxPlay, 32 + (i-tmp) * 16, 288, 304 + (((c_mission == i) && (ending[0] == 0)) * 16) + ((c_mission > i) || (ending[0] != 0)) * 32, 112, 13);
			TextLayerOn(0, 1 + 208 * maxPlay, 1 + 32 + (i-tmp) * 16);
			TextSize(0, 10);
		} else {
			BltFastRect(44, 16 + maxPlay * 400, 64 + (i-tmp) * 32, 448, 224 + (((c_mission == i) && (ending[0] == 0)) * 16) + ((c_mission > i) || (ending[0] != 0)) * 32, 160, 16);
			TextLayerOn(0, 1 + 16 + maxPlay * 400, 1 + 64 + (i-tmp) * 32);
			TextSize(0, 14);
		}
		TextColor(0, 0, 0, 0);
		TextBackColorDisable(0);
		
		getMissionName(mission_type[i],i);
		
		// 昤夋
		TextOut(0, string[0]);
		TextBlt(0);
		
		// 巊梡廔椆
		TextLayerOff(0);
		
		// 廔椆僼儔僌偑偁傞応崌偼偙偙偱儖乕僾傪敳偗傞
		if(mission_end[i]) break;
	}
	}	//if(!ending[0])
}

// 儈僢僔儑儞柤傪庢摼
void getMissionName(int mtype,int number) {
	if(!english) {
		strcpy(string[0], mission_name_jp[mtype]);
	} else {
		strcpy(string[0], mission_name_en[mtype]);
	}
	if(mission_lv[number] >= 15)
		strcat(string[0],"+");
}
// 儘乕僪柤傪庢摼
void getRoadName(int no){
	if(no == 0)
		sprintf(string[0], " BIG ROAD", 0);
	else if(no == 1)
		sprintf(string[0], " TRICKY ROAD", 0);
	else if(no == 2)
		sprintf(string[0], " GRAND ROAD", 0);
	else if(no == 3)
		sprintf(string[0], " STAR ROAD", 0);
	else if(no == 4)
		sprintf(string[0], "ANOTHER ROAD", 0);
	else if(no == 5)
		sprintf(string[0], " DS ROAD", 0);
	else if(no == 6)
		sprintf(string[0], " DEVIL ROAD", 0);
	else if(no <= 16)
		sprintf(string[0], " TRIAL S%d", no - 6);
	else if(no == 17)
		sprintf(string[0], " TRIAL HM", 0);
	else if(no == 18)
		sprintf(string[0], " TRIAL GOD", 0);
	else if(no == 19)
		sprintf(string[0], "HEBO AMATEUR", 0);
	else if(no == 20)
		sprintf(string[0], " HEBO PRO", 0);
	else if(no == 21)
		sprintf(string[0], " HEBO BRONZE", 0);
	else if(no == 22)
		sprintf(string[0], " HEBO SILVER ", 0);
	else if(no == 23)
		sprintf(string[0], " HEBO GOLD", 0);
	else if(no == 24)
		sprintf(string[0], "HEBO PLATINUM", 0);
	else 
		sprintf(string[0], " NO.%02d", no);
}
/* 儈僢僔儑儞儌乕僪偺僲儖儅忋徃 */
void missionNormUp(int lines) {
	int i, j,gap;
	int by2, tmp;
	
	// 儗儀儖僗僞乕宯楍乮價僢僌S1&2A僫僓乕-RAYJ儔乕丒儘乕儖儘乕儖丒儈儔乕乯
	if( (mission_type[c_mission] == 0) || (mission_type[c_mission] == 1) || (mission_type[c_mission] == 8) ||
		(mission_type[c_mission] == 9) || (mission_type[c_mission] == 10) ||
		(mission_type[c_mission] == 12) || (mission_type[c_mission] == 13) || (mission_type[c_mission] == 14) ||
		(mission_type[c_mission] == 15) || (mission_type[c_mission] == 17) || (mission_type[c_mission] == 18) ||
		(mission_type[c_mission] == 19) || (mission_type[c_mission] == 20) || (mission_type[c_mission] == 21) ||
		(mission_type[c_mission] == 22) || (mission_type[c_mission] == 24) || (mission_type[c_mission] == 25))
	{
		c_norm[0] = c_norm[0] + lines;
	}
	
	// 僟僽儖
	if( mission_type[c_mission] == 2 ) {
		if(mission_opt_1[c_mission] == 1){
			if(lines >= 2) c_norm[0]++;//僟僽儖埲忋傕擣傔傞
		}else if(mission_opt_1[c_mission] == 2){
			if(lines == 2)c_norm[0]++;
			else if(c_norm[0] > 0){
			c_norm[0] = 0;
			PlaySE(45);
			}
		}
		else if(lines == 2) c_norm[0]++;
	}
	
	// 僩儕僾儖
	if( mission_type[c_mission] == 3 ) {
		if(mission_opt_1[c_mission] == 1){
			if(lines >= 3) c_norm[0]++;//僩儕僾儖埲忋傕擣傔傞
		}else if(mission_opt_1[c_mission] == 2){
			if(lines == 3)c_norm[0]++;
			else if(c_norm[0] > 0){
			c_norm[0] = 0;
			PlaySE(45);
			}
		}
		else if(lines == 3) c_norm[0]++;
	}
	
	// 僿儃儕僗
	if( mission_type[c_mission] == 4 ) {
		if(lines == 4) c_norm[0]++;
	}
	
	// 僒僀僋儖
	if( mission_type[c_mission] == 5 ) {
		if(!cycle[lines - 1]) {
			cycle[lines - 1] = 1;
			c_norm[0]++;
		}
	}
	
	// 僞乕僎僢僩
	if( mission_type[c_mission] == 6 ) {
		// 僾儔僠僫僽儘僢僋偑0
		if(getPlatinumBlock(0) == 0) {
			PlaySE(31);
			c_norm[0]++;
			
			// 師偺僗僥乕僕傊
			if(c_norm[0] < mission_norm[c_mission]) {
				upLineNo[0] = 0;
				upLines[0] = 0;
				timeOn[0] = 0;
				
				for(i = 0; i < 22; i++) erase[i] = 1;
				
				stat[0] = 25;	// 慡儔僀儞徚嫀
				statc[0 * 10 + 0] = wait1[0];	//懸偪帪娫僗僉僢僾
				statc[0 * 10 + 1] = 3;	// Ready
				statc[0 * 10 + 2] = 1;	// 僗僥乕僕撉傒崬傒偁傝
			}
		}
	}
	
	// 僀儗僀僒乕
	if( (mission_type[c_mission] == 7 )||(mission_type[c_mission] == 39)) {
		if((lines >= 4)||(mission_type[c_mission] != 39)){
			for(i = 0; i < 4; i++) {
				// 挷傋傞Y嵗昗傪寛傔傞
				if(rots[0] == 8){
					by2 = (by[0] + blkDDataY[blk[0] * 16 + rt[0] * 4 + i]);
				} else if( isWRule(0) ) {
					by2 = (by[0] + blkWDataY[blk[0] * 16 + rt[0] * 4 + i]);
				} else {
					by2 = (by[0] + blkDataY[blk[0] * 16 + rt[0] * 4 + i]);
				}
				
				// 徚偡傋偒儔僀儞偐挷傋傞
				for(j = 0; j < eraser_now_lines; j++) {
					if(j >= 4) break;
					
					if( (by2 == eraser_lines[j]) && (erase[by2]) && (!eraser_cleared[j]) ) {
						eraser_cleared[j] = 1;
						c_norm[0]++;
					}
				}
			}
			
			// 慡晹徚偊偰偄傞偺偵僲儖儅払惉偟偰偄側偄応崌偼怴偨側僷僞乕儞弌尰
			if(c_norm[0] < mission_norm[c_mission]) {
				tmp = 1;
				
				for(i = 0; i < eraser_now_lines; i++) {
					if(i >= 4) break;
					
					if(!eraser_cleared[i]) {
						tmp = 0;
						break;
					}
				}
				
				if(tmp) {
					eraser_now_pattern++;
					setEraserLines();
				}
			}
		}
	}
	
	// 僔儞僌儖
	if( mission_type[c_mission] == 11 ) {
		if(lines == 1) c_norm[0]++;
	}
	
	// T-spin
	if( mission_type[c_mission] == 16 ) {
		if(tspin_flag[0] != 0) c_norm[0]++;
	}
	
	//懴媣
	if((ltime[0] <= 0) && (mission_type[c_mission] == 23))
		c_norm[0] = mission_norm[c_mission];
	
	// 慡徚偟
	if( mission_type[c_mission] == 26 ) {
		c_norm[0]++;
	}
	//僐儞儃
	if( mission_type[c_mission] == 27 ) {
		if(mission_opt_3[c_mission] == 1) c_norm[0] = combo2[0];
		else c_norm[0] = combo[0];
	}
	// B to B僿儃儕僗
	if( mission_type[c_mission] == 28 ) {
		if(lines == 4) c_norm[0]++;
		else if(c_norm[0] > 0){
			c_norm[0] = 0;
			gflash[0] = 120;
			gup_down[0] = 0;//regret
			PlaySE(45);
		}
	}
	
	// OOBAKA
	if( (mission_type[c_mission] == 29) && (stat[0] == 6) && ((timeOn[0]) || (repversw < 58)) ) {
		c_norm[0]++;
	}
	
	// 僽儘僢僋僆乕僟乕
	if( mission_type[c_mission] == 30 ) { 
		if( (mission_opt_2[c_mission] == 0) || 
		    ((mission_opt_2[c_mission] == 1) && (dhold2[0]) && (hold_used[0] >= 2)) ){
			if((mission_opt_3[c_mission]>=0)&&(mission_opt_3[c_mission]<=6)){//扨昳
				if(blk[0] == mission_opt_3[c_mission]) c_norm[0] = c_norm[0] + lines;
			}else if(mission_opt_3[c_mission]==7){//LJ
				if((blk[0] == 1)||(blk[0] == 5)) c_norm[0] = c_norm[0] + lines;
			}else if(mission_opt_3[c_mission]==8){//SZ
				if((blk[0] == 3)||(blk[0] == 6)) c_norm[0] = c_norm[0] + lines;
			}
		}
	}
	
	// 僽儘僢僋僆乕僟乕僔儞僌儖SP
	if( mission_type[c_mission] == 31 ) {//0-6
		if( (mission_opt_2[c_mission] == 0) || 
		    ((mission_opt_2[c_mission] == 1) && (dhold2[0]) && (hold_used[0] >= 2)) ){
			if((mission_opt_3[c_mission]>=0)&&(mission_opt_3[c_mission]<=6)){//扨昳
				if((lines == 1) && (blk[0] == mission_opt_3[c_mission])) c_norm[0]++;
			}else if(mission_opt_3[c_mission]==7){//LJ
				if((lines == 1) && ((blk[0] == 1)||(blk[0] == 5))) c_norm[0]++;
			}else if(mission_opt_3[c_mission]==8){//SZ
				if((lines == 1) && ((blk[0] == 3)||(blk[0] == 6))) c_norm[0]++;
			}
		}
	}
	// 僟僽儖僆乕僟乕
	if( mission_type[c_mission] == 32 ) {//0-6
		if( (mission_opt_2[c_mission] == 0) || 
		((mission_opt_2[c_mission] == 1) && (dhold2[0]) && (hold_used[0] >= 2)) ){
			if(mission_opt_1[c_mission]){
				if((mission_opt_3[c_mission]>=0)&&(mission_opt_3[c_mission]<=6)){//扨昳
					if((lines >= 2) && (blk[0] == mission_opt_3[c_mission])) c_norm[0]++;
				}else if(mission_opt_3[c_mission]==7){//LJ
					if((lines >= 2) && ((blk[0] == 1)||(blk[0] == 5))) c_norm[0]++;
				}else if(mission_opt_3[c_mission]==8){//SZ
					if((lines >= 2) && ((blk[0] == 3)||(blk[0] == 6))) c_norm[0]++;
				}
			}else{
				if((mission_opt_3[c_mission]>=0)&&(mission_opt_3[c_mission]<=6)){//扨昳
					if((lines == 2) && (blk[0] == mission_opt_3[c_mission])) c_norm[0]++;
				}else if(mission_opt_3[c_mission]==7){//LJ
					if((lines == 2) && ((blk[0] == 1)||(blk[0] == 5))) c_norm[0]++;
				}else if(mission_opt_3[c_mission]==8){//SZ
					if((lines == 2) && ((blk[0] == 3)||(blk[0] == 6))) c_norm[0]++;
				}
			}
		}
	}
	// 棤僩儕僾儖SP
	if( mission_type[c_mission] == 33 ) {
		if( (mission_opt_2[c_mission] == 0) || 
		    ((mission_opt_2[c_mission] == 1) && (dhold2[0]) && (hold_used[0] >= 2)) ){
			if((mission_opt_3[c_mission]>=0)&&(mission_opt_3[c_mission]<=6)){//扨昳
				if((lines == 3) && (blk[0] != mission_opt_3[c_mission])) c_norm[0]++;
			}else if(mission_opt_3[c_mission]==7){//LJ
				if((lines == 3) && ((blk[0] != 1)||(blk[0] != 5))) c_norm[0]++;
			}else if(mission_opt_3[c_mission]==8){//SZ
				if((lines == 3) && ((blk[0] != 3)||(blk[0] != 6))) c_norm[0]++;
			}
		}
	}

	// 拞敳偒僟僽儖
	if( mission_type[c_mission] == 34 ) {
		if(lines == 2){
			gap=0;	// 拞敳偒敾掕
			j=0;	// 拞敳偒敾掕僼儔僌
			for(i=0;i<22;i++){
				if(erase[i])
					j++;
				else if(j!=0)
					gap++;
				if(j>=lines) break;
			}
			if(gap != 0) c_norm[0]++;
		}
	}
	
	// 拞敳偒僩儕僾儖
	if( mission_type[c_mission] == 35 ) {
		if(lines == 3){
			gap=0;	// 拞敳偒敾掕
			j=0;	// 拞敳偒敾掕僼儔僌
			for(i=0;i<22;i++){
				if(erase[i])
					j++;
				else if(j!=0)
					gap++;
				if(j>=lines) break;
			}
			if(gap != 0) c_norm[0]++;
		}
	}
	
	// 2抜敳偒僟僽儖
	if( mission_type[c_mission] == 36 ) {
		if(lines == 2){
			gap=0;	// 拞敳偒敾掕
			j=0;	// 拞敳偒敾掕僼儔僌
			for(i=0;i<22;i++){
				if(erase[i])
					j++;
				else if(j!=0)
					gap++;
				if(j>=lines) break;
			}
			if(gap == 2) c_norm[0]++;
		}
	}
	
	// TSD
	if( mission_type[c_mission] == 37 ) {
		if((tspin_flag[0] == 2) && (lines >= 2)) c_norm[0]++;
	}
	// 僩儕僾儖SP
	if( mission_type[c_mission] == 38 ) {
		if( (mission_opt_2[c_mission] == 0) || 
		    ((mission_opt_2[c_mission] == 1) && (dhold2[0]) && (hold_used[0] >= 2)) ){
			if((mission_opt_3[c_mission]>=0)&&(mission_opt_3[c_mission]<=6)){//扨昳
				if((lines == 3) && (blk[0] == mission_opt_3[c_mission])) c_norm[0]++;
			}else if(mission_opt_3[c_mission]==7){//LJ
				if((lines == 3) && ((blk[0] == 1)||(blk[0] == 5))) c_norm[0]++;
			}else if(mission_opt_3[c_mission]==8){//SZ
				if((lines == 3) && ((blk[0] == 3)||(blk[0] == 6))) c_norm[0]++;
			}
		}
	}
		// 僗僋僂僃傾乛僑乕儖僪僗僋僂僃傾
	if((mission_type[c_mission] == 40) || (mission_type[c_mission] == 41))
	{
		 c_norm[0]++;
	}

	// 儈僢僔儑儞僋儕傾丂EX撍擖帪
	if((c_norm[0] >= mission_norm[c_mission]) && ((mission_end[c_mission] == 2) || (mission_end[c_mission] == 3)) && (lines == 2)) {
		PlaySE(43);//levelup.wav偺戙傢傝偵stgstar.wav
		StopSE(32);
		if(mission_end[c_mission] == 3)
			PlaySE(18);
		objectCreate2(0, 8, Rand(20) + 180 + 192 * 0 - 96 * maxPlay, 20 + Rand(10), 0, 0, 0, 0); 
		timeOn[0] = 0;
		c_mission++;
		clear_mission++;
		bgfadesw = 1;
		missionSetStatus();
		if(mission_bgm[c_mission] == -1)
			fadelv[0] = 10;
		else if(mission_bgm[c_mission] != mission_bgm[c_mission - 1]){
			StopAllBGM();
			bgmlv = mission_bgm[c_mission];
			changeBGM(0);
		}
	} else if(c_norm[0] >= mission_norm[c_mission]) { //晛捠僋儕傾
		PlaySE(19);
		StopSE(32);
		
		timeOn[0] = 0;
		c_mission++;
		clear_mission++;
		
		// 僄儞僨傿儞僌撍擖僠僃僢僋
		if((c_mission > 29) || (mission_end[c_mission - 1] == 1) || (mission_end[c_mission - 1] >= 4) || (((mission_end[c_mission - 1] == 2) || (mission_end[c_mission - 1] == 3)) && (lines != 2))) {
			c_mission = c_mission - 1;
			c_norm[0] = mission_norm[c_mission];
			if(((mission_end[c_mission] == 2) || (mission_end[c_mission] == 3)) && (lines != 2))
				ending[0] = 4;
			else
				ending[0] = 1;
			pinch[0] = 0;
			if(mission_end[c_mission] < 4)	//僗僞僢僼儘乕儖奐巒偺偨傔丄onRecord傪偦偺傑傑偵
				onRecord[0] = 2;
			pinch[0] = 0;
		} else {
			bgfadesw = 1;
			missionSetStatus();
			if(mission_bgm[c_mission] == -1)
				fadelv[0] = 10;
			else if(mission_bgm[c_mission] != mission_bgm[c_mission - 1]){
				StopAllBGM();
				bgmlv = mission_bgm[c_mission];
				changeBGM(0);
			}
		}
	}
}

/* 栤戣偺愝掕乮棊壓懍搙etc乯傪僎乕儉偵斀塮偝偣傞 */
void missionSetStatus() {
	int i;
	int tmp;
	// 僲儖儅
	c_norm[0] = 0;
	
	upLineNo[0] = 0;
	
	// 僞僀儉
	ltime[0] = mission_time[c_mission];
	
	// 儗儀儖
	lv[0] = mission_lv[c_mission] + 1;
	
	// 懍搙
	if(mission_lv[c_mission] < 15){
	if(mission_type[c_mission] <= 7){
		// 捠忢
		if((repversw < 56) || (mission_file == 6))
			sp[0] = lvTableAce55[mission_lv[c_mission]];
		else
			sp[0] = lvTableAce[mission_lv[c_mission]];
		wait1[0] = wait1_Ace;
		wait2[0] = wait2_Ace;
		wait3[0] = wait3_Ace;
		waitt[0] = waitt_Ace;
	} else if(mission_type[c_mission] == 8) {
		// 僴僀僗僺乕僪侾
		sp[0] = lvTableHiSpeed1[mission_lv[c_mission]];
		wait1[0] = wait1_HiSpeed1;
		wait2[0] = wait2_HiSpeed1;
		wait3[0] = wait3_HiSpeed1;
		waitt[0] = waitt_HiSpeed1;
	} else if(mission_type[c_mission] == 9) {
		// 僴僀僗僺乕僪俀
		sp[0] = 1200;
		wait1[0] = wait1_HiSpeed2;
		wait2[0] = wait2_HiSpeed2;
		wait3[0] = wait3_HiSpeed2;
		waitt[0] = waitt_HiSpeed2;
	} else if((mission_type[c_mission] == 10) || (mission_type[c_mission] == 23)) {
		// 傾僫僓乕&懴媣
		sp[0] = 1200;
		wait1[0] = wait1_Acea_tbl[mission_lv[c_mission]];
		wait2[0] = wait2_Acea_tbl[mission_lv[c_mission]];
		wait3[0] = wait3_Acea_tbl[mission_lv[c_mission]];
		waitt[0] = waitt_Acea_tbl[mission_lv[c_mission]];
	} else if((mission_type[c_mission] >= 11) && (mission_type[c_mission] <= 18) || (mission_type[c_mission] == 21)) {
		// X-RAY埲崀丅僥僉僩乕
		if((repversw < 56) || (mission_file == 6))
			sp[0] = lvTableAce55[mission_lv[c_mission]];
		else
			sp[0] = lvTableAce[mission_lv[c_mission]];
		wait1[0] = wait1_Ace;
		wait2[0] = wait2_Ace;
		wait3[0] = wait3_Ace;
		waitt[0] = waitt_Ace;
	} else if(mission_type[c_mission] == 19) {
		// DEVIL 800
		sp[0] = 1200;
		wait1[0] = wait1_devil_tbl32[8];
		wait2[0] = wait2_devil_tbl32[8];
		wait3[0] = wait3_devil_tbl32[8];
		waitt[0] = waitt_devil_tbl32[8];
	} else if(mission_type[c_mission] == 20) {
		// DEVIL 1200
		sp[0] = 1200;
		if(!mission_opt_3[c_mission]){
			wait1[0] = wait1_devil_tbl32[12];
			wait2[0] = wait2_devil_tbl32[12];
			wait3[0] = wait3_devil_tbl32[12];
			waitt[0] = waitt_devil_tbl32[12];
		} else {
			if(repversw < 60){
				wait1[0] = wait1_devil_tbl[12];
				wait2[0] = wait2_devil_tbl[12];
				wait3[0] = wait3_devil_tbl[12];
				waitt[0] = waitt_devil_tbl[12];
			}else{
				wait1[0] = wait1_doom_tbl[12];
				wait2[0] = wait2_doom_tbl[12];
				wait3[0] = wait3_doom_tbl[12];
				waitt[0] = waitt_doom_tbl[12];
			}
		}
	} else if(mission_type[c_mission] == 22) {
		// 僆乕儖僪僗僞僀儖
		sp[0] = lvTableHeboGB[mission_lv[c_mission]];
		wait1[0] = wait1_HeboGB;
		wait2[0] = wait2_HeboGB;
		wait3[0] = wait3_HeboGB_tbl[mission_lv[c_mission]];
		waitt[0] = waitt_HeboGB_tbl[mission_lv[c_mission]];
	} else if(mission_type[c_mission] >= 24) {
		// 偲傝偁偊偢懴媣埲崀
		if((repversw < 56) || (mission_file == 6))
			sp[0] = lvTableAce55[mission_lv[c_mission]];
		else
			sp[0] = lvTableAce[mission_lv[c_mission]];
		wait1[0] = wait1_Ace;
		wait2[0] = wait2_Ace;
		wait3[0] = wait3_Ace;
		waitt[0] = waitt_Ace;
	}
	}
	//+
	if((mission_lv[c_mission] >= 15) && (mission_type[c_mission] != 20)){
		sp[0] = 1200;
		wait1[0] = wait1_Acea_tbl[mission_lv[c_mission] - 15];
		wait2[0] = wait2_Acea_tbl[mission_lv[c_mission] - 15];
		wait3[0] = wait3_Acea_tbl[mission_lv[c_mission] - 15];
		waitt[0] = waitt_Acea_tbl[mission_lv[c_mission] - 15];
		if(mission_type[c_mission] == 19){
			if(repversw < 60){
				wait1[0] = wait1_devil_tbl[8];
				wait2[0] = wait2_devil_tbl[8];
				wait3[0] = wait3_devil_tbl[8];
				waitt[0] = waitt_devil_tbl[8];
			}else{
				wait1[0] = wait1_doom_tbl[8];
				wait2[0] = wait2_doom_tbl[8];
				wait3[0] = wait3_doom_tbl[8];
				waitt[0] = waitt_doom_tbl[8];
			}
		}
	}
	// OOBAKA
	if(mission_type[c_mission] == 29){
		sp[0] = 1200;
		wait1[0] = (repversw >= 60);
		wait2[0] = 0;
		wait3[0] = 0;
		waitt[0] = 5;
	}
	
	// 僒僀僋儖梡僼儔僌
	if(mission_type[c_mission] == 5) {
		for(i = 0; i < 4; i++) cycle[i] = 0;
	}
	// 僞乕僎僢僩梡
	if(mission_type[c_mission] == 6) {
	//僗僥乕僕26傑偱偟偐弶婜壔偟偰偄側偐偭偨栤戣傪廋惓
		for(i = 0; i < 200; i++) target_cleared[i] = 0;
	}
	// 僀儗僀僒乕梡
	if((mission_type[c_mission] == 7)||(mission_type[c_mission] == 39)) {
		eraser_now_pattern = 0;
		setEraserLines();
	}
	
	//傾僫僓乕偱opt傪1埲忋偵偟偨帪丂傑偨偼僽儔僀儞僪
	if(((mission_type[c_mission] == 10) && (mission_opt_3[c_mission])) || (mission_type[c_mission] == 25)){
		isblind[0] = 1;
		blind_flag[0] = 1;
	} else {
		isblind[0] = 0;
		blind_flag[0] = 0;
	}
	// X-RAY梡
	if(mission_type[c_mission] == 12) {
		isxray[0] = 1;
		xray_flag[0] = 1;;
		xray_counter[0] = 0;
	} else {
		isxray[0] = 0;
		xray_flag[0] = 0;
	}
	
	// 僇儔乕梡
	if(mission_type[c_mission] == 13) {
		iscolor[0] = 1;
		color_flag[0] = 1;
	} else {
		iscolor[0] = 0;
		color_flag[0] = 0;
	}
	
	// 儘乕儖儘乕儖梡
	if(mission_type[c_mission] == 14) {
		rollroll_flag[0] = 1;
		isrollroll[0] = 1;
	} else {
		rollroll_flag[0] = 0;
		isrollroll[0] = 0;
	}
	
	// 儈儔乕梡
	if(mission_type[c_mission] == 15) {
		isfmirror[0] = 1;
	} else {
		isfmirror[0] = 0;
	}
	
	//夞揮晄壜
	if(mission_type[c_mission] == 17) {
		isrotatelock[0] = 1;
		rt_nblk[0 + 6 * 0] = rand(4,0);
		rt_nblk[1 + 6 * 0] = rand(4,0);
		rt_nblk[2 + 6 * 0] = rand(4,0);
		rt_nblk[3 + 6 * 0] = rand(4,0);
		rt_nblk[4 + 6 * 0] = rand(4,0);
		rt_nblk[5 + 6 * 0] = rand(4,0);
	} else {
		isrotatelock[0] = 0;
		rt_nblk[0 + 6 * 0] = 0;
		rt_nblk[1 + 6 * 0] = 0;
		rt_nblk[2 + 6 * 0] = 0;
		rt_nblk[3 + 6 * 0] = 0;
		rt_nblk[4 + 6 * 0] = 0;
		rt_nblk[5 + 6 * 0] = 0;
	}
	
	//NEXT晄壜帇
	if(mission_type[c_mission] == 18) {
		ishidenext[0] = 1;
	} else {
		ishidenext[0] = 0;
	}
	//DEVIL 800(COPY RISING)
	if(mission_type[c_mission] == 19) {
		st_bdowncnt[0] = 0;
		upLineT[0] = 0;
		if(mission_opt_3[c_mission] == 0)
			mission_opt_3[c_mission] = 20;
		shirase[0] = mission_opt_3[c_mission];
	}else{
		st_bdowncnt[0] = 0;
	}

	//DEVIL 1200([ ])
	if(mission_type[c_mission] == 20) {
		over1000_block[0] = 2;
	} else {
		over1000_block[0] = 0;
	}
	//GARBAGE
	if(mission_type[c_mission] == 21){
		upLineT[0] = 2;
		upLines[0] = mission_opt_3[c_mission];
		if(repversw < 41){
			if(upLines[0] > 18-(2*(!spawn_y_type)))
				upLines[0] = 18-(2*(!spawn_y_type));
		}else{
			if(upLines[0] > 18)
				upLines[0] = 18;
			upLines[0] = upLines[0]-(2*(!spawn_y_type));
		}
	} else {
		upLineT[0] = uplinetype;
		if(repversw >= 40) upLines[0] = 0;
	}
	//僆乕儖僪僗僞僀儖
	if(mission_type[c_mission] == 22) {
		heboGB[0] = 1;
		ishidenext[0] = 2;
		isholdlock[0] = 1;
	} else {
		heboGB[0] = 0;
		isholdlock[0] = 0;
	}
	//忋壓嵍塃媡揮
	if(mission_type[c_mission] == 24) {
		isLRreverse[0] = 1;
		isUDreverse[0] = 1;
	} else {
		isLRreverse[0] = 0;
		isUDreverse[0] = 0;
	}

	//價僢僌仌慡徚偟
	if((mission_type[c_mission] == 1) || ((mission_type[c_mission] == 26) && (mission_opt_3[c_mission] == 0))) {
		IsBig[0] = 1;
	} else {
		IsBig[0] = 0;
	}

	if((mission_type[c_mission] == 40) || (mission_type[c_mission] == 41)) {
		squaremode[0] = 1;
	} else {
		squaremode[0] = 0;
	}
}
// 僼傿乕儖僪偺嵟忋抜傪曉偡
//gamestart.c偵堏摦 C7U0.8


// 僀儗僀僒乕梡弶婜壔
void setEraserLines() {
	int i, tmp,max,min;
	int line[22];	// 儔僀儞偺廳暋杊巭梡
	
	for(i = 0; i < 22; i++) line[i] = 0;
	
	eraser_now_lines = 0;
	// 榞撪弌尰帪偼嵟崅18抜傑偱
	max = mission_opt_2[c_mission];
	min = mission_opt_1[c_mission];
	
	if((!spawn_y_type) && (mission_opt_1[c_mission] <= 2))
		min = 3;
	if(max >= fldsizeh[0])
		max = fldsizeh[0];
		
	if(min > max){
		min = i;
		min = max;
		i = max;
	}
	
	for(i = 0; i <= mission_opt_3[c_mission]; i++) {
		if(i >= 4) break;	// 嵟戝偱4杮傑偱
		if(i >= mission_norm[c_mission] - c_norm[0]) break;
		if((eraser_now_pattern >= 2) && (i >= 1)) break;
		
		eraser_now_lines++;
		
		if(min == max) {
			// 埵抲屌掕
			tmp = min+1;
		}else if((i >= mission_norm[c_mission] - c_norm[0] - 1) && (mission_norm[c_mission] > 1) && (line[min + 1] != 1) && (repversw >= 54)){
			// 嵟屻偺1杮
			tmp = min+1;
		}else{
			do {
				tmp = rand(22,0);
			} while( (tmp < min+1) || (tmp > max+1) || (line[tmp] == 1) );
		}
		line[tmp] = 1;
		eraser_lines[i] = tmp;
		eraser_cleared[i] = 0;
	}
}

// 僀儗僀僒乕偺慄傪昞帵
void viewEraserLines() {
	int i;
	
	for(i = 0; i < eraser_now_lines; i++) {
		if(i >= 4) break;	// 嵟戝偱4杮傑偱
		
		if(getDrawRate() == 1)
			BltRect(44, (14 - 12 * maxPlay) * 8, (eraser_lines[i] + 3) * 8, 288, 256 - 64 * (mission_type[c_mission] == 39) + eraser_cleared[i] * 32, 96, 8);
		else
			BltRect(44, (14 - 12 * maxPlay) * 16, (eraser_lines[i] + 3) * 16, 448, 160 - 64 * (mission_type[c_mission] == 39)+ eraser_cleared[i] * 32, 192, 16);
	}
}

// 僞乕僎僢僩偱偺僗僥乕僕撉傒崬傒
void loadTargetStage() {
	int tmp;
statc[0 * 10 + 6] = mission_opt_3[c_mission];
	if(mission_opt_1[c_mission] == mission_opt_2[c_mission]){	//僗僥乕僕偑1偮偩偗
		tmp = mission_opt_1[c_mission];
	}else{
		// 捛壛忣曬偱弌尰僗僥乕僕偺斖埻傪巜掕壜擻 #1.60c7s2
		do {
			if(repversw < 46) tmp = rand(100,0);
			else tmp = rand(mission_opt_2[c_mission] + 1,0);
		} while( (tmp < mission_opt_1[c_mission]) || (tmp > mission_opt_2[c_mission]) || (target_cleared[tmp] == 1) );
	target_cleared[tmp] = 1;	// 弌尰嵪傒僼儔僌ON
	}
	loadTomoyoStage(0, tmp);
	// 僾儔僠僫僽儘僢僋儔儞僟儉壔乮偣傝忋偑傞僗僥乕僕偼儔儞僟儉偵偟側偄乯
	if((repversw >= 58) && (tomoyo_rise[0] == 0) && (mission_opt_3[c_mission] != 0)) randPlatinum(0, mission_opt_3[c_mission]);
}

//仱仴仱仴仱仴仱仴仱仴仱仴仱仴仱仴仱仴仱仴仱仴仱仴仱仴仱仴仱仴仱仴仱仴仱仴仱仴仱
//  栤戣僨乕僞偺撉傒崬傒乛曐懚
//仯仮仯仮仯仮仯仮仯仮仯仮仯仮仯仮仯仮仯仮仯仮仯仮仯仮仯仮仯仮仯仮仯仮仯仮仯仮仯
// 僼傽僀儖僼僅乕儅僢僩 (4byte扨埵)
//   0       僶乕僕儑儞 (0=柍岠 1=c7r8)
//   1乣  19 枹巊梡
//  20乣  39 栤戣侾
//  40乣  59 栤戣俀

/* 儘乕僪 */
void loadMissionData(int number) {
	int i;
	
	FillMemory(&saveBuf, 50000 * 4, 0);
	
	sprintf(string[0], "stage/mission%02d.sav", number);
	
	LoadFile(string[0], &saveBuf, 930 * 4);
	
	// 栤戣僨乕僞傪撉傒崬傒
	for(i = 0; i < 30; i++) {
		mission_type[i]  = saveBuf[(i + 1) * 20 + 0];	// 庬椶
		mission_norm[i]  = saveBuf[(i + 1) * 20 + 1];	// 僲儖儅
		mission_time[i]  = saveBuf[(i + 1) * 20 + 2];	// 惂尷帪娫
		mission_end[i]   = saveBuf[(i + 1) * 20 + 3];	// 廔椆僼儔僌
		mission_lv[i]    = saveBuf[(i + 1) * 20 + 4];	// 儗儀儖
		mission_erase[i] = saveBuf[(i + 1) * 20 + 5];	// 僋儕傾帪偵忋偐傜徚嫀偡傞儔僀儞悢
		mission_opt_1[i] = saveBuf[(i + 1) * 20 + 6];	// 捛壛忣曬侾乮壓尷乯
		mission_opt_2[i] = saveBuf[(i + 1) * 20 + 7];	// 捛壛忣曬俀乮忋尷乯
		mission_opt_3[i] = saveBuf[(i + 1) * 20 + 8];	// 捛壛忣曬俁乮僀儗僀僒乕偩偲杮悢丄SHIRASE800偼偣傝忋偑傝娫妘丄懠偼枹巊梡乯
		mission_bgm[i]   = saveBuf[(i + 1) * 20 + 9];	// BGM
	}
}

/* 僙乕僽 */
void saveMissionData(int number) {
	int i;
	
	FillMemory(&saveBuf, 50000 * 4, 0);
	
	// 僿僢僟
	saveBuf[0] = 1;
	
	// 栤戣僨乕僞
	for(i = 0; i < 30; i++) {
		saveBuf[(i + 1) * 20 + 0] = mission_type[i];	// 庬椶
		saveBuf[(i + 1) * 20 + 1] = mission_norm[i];	// 僲儖儅
		saveBuf[(i + 1) * 20 + 2] = mission_time[i];	// 惂尷帪娫
		saveBuf[(i + 1) * 20 + 3] = mission_end[i];		// 廔椆僼儔僌
		saveBuf[(i + 1) * 20 + 4] = mission_lv[i];		// 儗儀儖
		saveBuf[(i + 1) * 20 + 5] = mission_erase[i];	// 僋儕傾帪偵忋偐傜徚嫀偡傞儔僀儞悢
		saveBuf[(i + 1) * 20 + 6] = mission_opt_1[i];	// 捛壛忣曬侾
		saveBuf[(i + 1) * 20 + 7] = mission_opt_2[i];	// 捛壛忣曬俀
		saveBuf[(i + 1) * 20 + 8] = mission_opt_3[i];	// 捛壛忣曬俁
		saveBuf[(i + 1) * 20 + 9] = mission_bgm[i];		// BGM
	}
	
	sprintf(string[0], "stage/mission%02d.sav", number);
	SaveFile(string[0], &saveBuf, 930 * 4);
}
