home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
DOS/V Power Report 1996 February
/
VPR9602A.ISO
/
ffilly
/
hb_test
/
hb_main.tfy
< prev
next >
Wrap
Text File
|
1995-09-15
|
28KB
|
1,108 lines
#include "hb_info.tfy"
int nPic0, nPic1, nPic2, nWin0, nMax, nYouNum, nComNum, nTurn, nUso, nWav, nWP_a, nWP_b, nLevel, nHit3a, nHit3b, nMax2, nUseWave, nLoop;
int SRCCOPY, SRCERASE, SRCINVERT, SRCAND;
int nTable[], nWAV_Buf[], nTable2[];
int nNum[];
str sKachiMake;
main(){
SRCCOPY = 0xCC0020;
SRCERASE = 0x440328;
SRCINVERT = 0x660046;
SRCAND = 0x8800C6;
nLoop = 1;
nUseWave = 1; // 0以外でWAV使用。
nPic0 = LoadPic( "hb_back.bmp" ); // 実際に表示される画面
nPic1 = LoadPic( "hb_back.bmp" ); // 文字消去用
voice( -1 ); // 引数が-1だと初期化
mes( TIME ){
if( nLoop ){
nLoop = 0;
main00();
}
}
}
main00(){
int nI;
nYouNum = 0;
nComNum = 0;
nTurn = 0;
nHit3a = 0;
nHit3b = 0;
nUso = 0;
sKachiMake = "";
CapTitle( "対戦型数当てゲーム「ヒット・アンド・ブロー」" );
nWin0 = OpenWin( nPic0 );
BackMode( 1 );
SetFont( 16, "MS ゴシック", 128, 0, 0, 0, 0 );
MovePic( nPic1, 0, 238, 640, 52, nPic0, 0, 240 );
center_print( "しばらくお待ちください。", nPic0, 256 );
voice( 20 );
MovePic( nPic1, 112, 16, 192, 208, nPic0, 112, 16 );
MovePic( nPic1, 112, 16, 192, 208, nPic0, 332, 16 );
MovePic( nPic1, 16, 56, 65, 160, nPic0, 16, 40 );
MovePic( nPic1, 16, 56, 65, 160, nPic0, 560, 40 );
make_table();
if( nUseWave ){
mes( TIME ){
if( nWav == 0 ){
main_01();
del_me;
}
}
} else {
main_01();
}
}
main_01(){
int nI, nJ, nK, nN, nNumNew, nNumOld;
str sMode[];
nNumNew = -2;
nNumOld = nNumNew;
nN = 0;
sMode[ 0 ] = "特訓";
sMode[ 1 ] = "標準";
sMode[ 2 ] = "上級";
SetFont( 16, "MS ゴシック", 128, 0, 0, 0, 800 );
MovePic( nPic1, 0, 238, 640, 52, nPic0, 0, 240 );
shadow_print( "あなた", nPic0, 576, 16, 2, "R" );
shadow_print( "COM", nPic0, 16, 16, 2, "R" );
SetFont( 16, "MS ゴシック", 128, 0, 0, 0, 0 );
center_print( "0:特訓モード、1:標準モード、2:上級モード", nPic0, 240 );
center_print( "“0”か“1”か“2”をクリックして下さい。", nPic0, 272 );
SetFont( 128, "MS ゴシック", 0, 0, 0, 0, 0 );
for( nI = 0 ; nI <= 9 ; nI = nI + 1 ){
shadow_print( StrPrint( "%ld", nI ), nPic0, nI * 64, 288, 4 );
}
mes( MOUSEMOVE ){
if( MesP2 < 192 && MesP3 >= 308 ){
nNumNew = MesP2 / 64;
} else {
nNumNew = -2;
}
if( nNumNew != nNumOld ){
TextColor( 255, 255, 255 );
TextWrite( StrPrint( "%ld", nNumOld ), nPic0, nNumOld * 64, 288 );
TextColor( 255, 255, 0 );
TextWrite( StrPrint( "%ld", nNumNew ), nPic0, nNumNew * 64, 288 );
nNumOld = nNumNew;
}
}
mes( LBDOWN ){
if( MesP2 < 192 && MesP3 >= 308 ){
TextColor( 255, 0, 0 );
TextWrite( StrPrint( "%ld", nNumNew ), nPic0, nNumNew * 64, 288 );
nLevel = nNumNew;
CloseWin( nWin0 );
CapTitle( "対戦型数当てゲーム「ヒット・アンド・ブロー」(" + sMode[ nLevel ] + ")" );
nWin0 = OpenWin( nPic0 );
if( nNumNew <= 1 ){
del_us;
main_02a();
del_me;
} else {
del_us;
main_02b();
del_me;
}
}
}
}
main_02a(){
int nFlag_02a, nNumNew, nNumOld, nCount;
// int nNum[];
nFlag_02a = 0;
nNumNew = -2;
nNumOld = nNumNew;
nCount = 0;
for( nI = 0 ; nI <= 9 ; nI = nI + 1 ){
nNum[ nI ] = -1;
}
MovePic( nPic1, 0, 238, 640, 52, nPic0, 0, 240 );
SetFont( 16, "MS ゴシック", 128, 0, 0, 0, 0 );
center_print( "あなたの考えた3桁の数字を入力してください。(最初が0でも可)", nPic0, 240 );
center_print( "同じ数字を2度以上使ってはいけません。", nPic0, 272 );
SetFont( 128, "MS ゴシック", 0, 0, 0, 0, 0 );
for( nI = 0 ; nI <= 9 ; nI = nI + 1 ){
shadow_print( StrPrint( "%ld", nI ), nPic0, nI * 64, 288, 4 );
}
mes( MOUSEMOVE ){
if( MesP3 >= 308 ){
nNumNew = MesP2 / 64;
if( nNum[ nNumNew ] == 0 ){
nNumNew = -2;
}
} else {
nNumNew = -2;
}
if( nNumNew != nNumOld ){
TextColor( 255, 255, 255 );
TextWrite( StrPrint( "%ld", nNumOld ), nPic0, nNumOld * 64, 288 );
TextColor( 255, 255, 0 );
TextWrite( StrPrint( "%ld", nNumNew ), nPic0, nNumNew * 64, 288 );
nNumOld = nNumNew;
}
}
mes( LBUP ){
nFlag_02a = -1;
}
mes( LBDOWN ){
if( nFlag_02a && MesP3 >= 308 && nNumNew >= 0 && nNum[ nNumNew ] ){
nNum[ nNumNew ] = 0;
nNumOld = -2;
TextColor( 255, 255, 255 );
TextWrite( StrPrint( "%ld", nNumNew ), nPic0, nNumNew * 64, 288 );
for( nI = 0 ; nI <= 96 ; nI = nI + 4 ){
MovePic( nPic0, nNumNew * 64, 304, 64, 96, nPic0, nNumNew * 64, 308 );
}
MovePic( nPic1, 8, 8, 64, 128, nPic1, 332, 8 );
shadow_print( StrPrint( "%ld", nNumNew ), nPic1, 332, 8, 4 );
for( nI =0 ; nI <= 96 ; nI = nI + 4 ){
MovePic( nPic1, 332, 120 - nI, 64, nI, nPic0, 332 + nCount * 64, 16 );
}
nCount = nCount + 1;
if( nCount == 1 ){
nYouNum = nYouNum + nNumNew * 100;
} else { if( nCount == 2 ){
nYouNum = nYouNum + nNumNew * 10;
} else { if( nCount == 3 ){
nYouNum = nYouNum + nNumNew;
del_us;
main_03();
del_me;
} } }
}
}
}
main_02b(){
int nFlag_02b;
nFlag_02b = 0;
SetFont( 128, "MS ゴシック", 0, 0, 0, 0, 0 );
for( nI = 0 ; nI <= 9 ; nI = nI + 1 ){
shadow_print( StrPrint( "%ld", nI ), nPic0, nI * 64, 288, 4 );
}
MovePic( nPic1, 0, 238, 640, 52, nPic0, 0, 240 );
SetFont( 16, "MS ゴシック", 128, 0, 0, 0, 0 );
center_print( "3桁の数字を思い浮かべてください。(最初が0でも可)", nPic0, 240 );
center_print( "同じ数字を2度以上使ってはいけません。", nPic0, 256 );
center_print( "数字を思い浮かべたらどこかをクリックしてください。", nPic0, 272 );
SetFont( 128, "MS ゴシック", 0, 0, 0, 0, 0 );
MovePic( nPic1, 8, 8, 64, 128, nPic1, 332, 8 );
shadow_print( "?", nPic1, 332, 8, 4 );
mes( LBUP ){
nFlag_02b = -1;
}
mes( LBDOWN ){
if( nFlag_02b ){
for( nCount = 0 ; nCount <= 2 ; nCount = nCount + 1 ){
for( nI =0 ; nI <= 96 ; nI = nI + 4 ){
MovePic( nPic1, 332, 120 - nI, 64, nI, nPic0, 332 + nCount * 64, 16 );
}
}
del_us;
main_03();
del_me;
}
}
}
main_03(){
int nFlag_03;
nFlag_03 = 0;
nComNum = nTable[ Random( 720 ) ];
MovePic( nPic1, 0, 238, 640, 52, nPic0, 0, 240 );
SetFont( 16, "MS ゴシック", 128, 0, 0, 0, 0 );
center_print( "コンピュータも3桁の数字を考えました。", nPic0, 240 );
center_print( "次へ進むにはどこかをクリックしてください。", nPic0, 272 );
SetFont( 128, "MS ゴシック", 0, 0, 0, 0, 0 );
MovePic( nPic1, 8, 8, 64, 128, nPic1, 332, 8 );
shadow_print( "?", nPic1, 332, 8, 4 );
mes( LBUP ){
nFlag_03 = -1;
}
mes( LBDOWN ){
if( nFlag_03 ){
for( nCount = 0 ; nCount <= 2 ; nCount = nCount + 1 ){
for( nI =0 ; nI <= 96 ; nI = nI + 4 ){
MovePic( nPic1, 332, 120 - nI, 64, nI, nPic0, 112 + nCount * 64, 16 );
}
}
del_us;
main_04();
del_me;
}
}
}
main_04(){
int nFlag_04, nI, nNumNew, nNumOld;
nFlag_04 = 0;
nNumNew = -2;
nNumOld = nNumNew;
MovePic( nPic1, 0, 238, 640, 52, nPic0, 0, 240 );
SetFont( 16, "MS ゴシック", 128, 0, 0, 0, 0 );
center_print( "どちらから先に答えますか?", nPic0, 240 );
center_print( "あなたの場合は“1”コンピュータの場合は“0”をクリックして下さい", nPic0, 272 );
SetFont( 128, "MS ゴシック", 0, 0, 0, 0, 0 );
for( nI = 0 ; nI <= 9 ; nI = nI + 1 ){
shadow_print( StrPrint( "%ld", nI ), nPic0, nI * 64, 288, 4 );
}
mes( MOUSEMOVE ){
if( MesP2 < 128 && MesP3 >= 308 ){
nFlag_04 = -1;
nNumNew = MesP2 / 64;
} else {
nNumNew = -2;
}
if( nNumNew != nNumOld ){
TextColor( 255, 255, 255 );
TextWrite( StrPrint( "%ld", nNumOld ), nPic0, nNumOld * 64, 288 );
TextColor( 255, 255, 0 );
TextWrite( StrPrint( "%ld", nNumNew ), nPic0, nNumNew * 64, 288 );
nNumOld = nNumNew;
}
}
mes( LBUP ){
if( MesP2 < 128 && MesP3 >= 308 ){
nFlag_04 = -1;
nNumNew = MesP2 / 64;
} else {
nNumNew = -2;
}
if( nNumNew != nNumOld ){
TextColor( 255, 255, 255 );
TextWrite( StrPrint( "%ld", nNumOld ), nPic0, nNumOld * 64, 288 );
TextColor( 255, 255, 0 );
TextWrite( StrPrint( "%ld", nNumNew ), nPic0, nNumNew * 64, 288 );
nNumOld = nNumNew;
}
}
mes( LBDOWN ){
if( nFlag_04 && MesP2 < 128 && MesP3 >= 308 ){
nNumNew = MesP2 / 64;
TextColor( 255, 0, 0 );
TextWrite( StrPrint( "%ld", nNumNew ), nPic0, nNumNew * 64, 288 );
del_us;
if( nNumNew == 1 ){
main_05();
del_me;
} else {
main_06();
del_me;
}
}
}
}
main_05(){
int nFlag_05, nNumNew, nNumOld, nCount, nAnser, nHB, nH, nB, nX0, nY0, nX1, nY1;
// int nNum[];
nFlag_05 = 0;
nNumNew = -2;
nNumOld = nNumNew;
nCount = 0;
for( nI = 0 ; nI <= 9 ; nI = nI + 1 ){
nNum[ nI ] = -1;
}
MovePic( nPic1, 0, 238, 640, 52, nPic0, 0, 240 );
SetFont( 16, "MS ゴシック", 128, 0, 0, 0, 0 );
turn_print();
center_print( "コンピュータが考えていると思われる", nPic0, 256 );
center_print( "3桁の数字を入力してください。", nPic0, 272 );
SetFont( 128, "MS ゴシック", 0, 0, 0, 0, 0 );
for( nI = 0 ; nI <= 9 ; nI = nI + 1 ){
shadow_print( StrPrint( "%ld", nI ), nPic0, nI * 64, 288, 4 );
}
for( nI = 0 ; nI <= 96 ; nI = nI + 4 ){
MovePic( nPic0, 112, 124 + nI, 192, 96 - nI, nPic0, 112, 128 + nI );
}
mes( MOUSEMOVE ){
if( MesP3 >= 308 ){
nFlag_05 = -1;
nNumNew = MesP2 / 64;
if( nNum[ nNumNew ] == 0 ){
nNumNew = -2;
}
} else {
nNumNew = -2;
}
if( nNumNew != nNumOld ){
TextColor( 255, 255, 255 );
TextWrite( StrPrint( "%ld", nNumOld ), nPic0, nNumOld * 64, 288 );
TextColor( 255, 255, 0 );
TextWrite( StrPrint( "%ld", nNumNew ), nPic0, nNumNew * 64, 288 );
nNumOld = nNumNew;
}
}
mes( LBUP ){
if( MesP3 >= 308 ){
nFlag_05 = -1;
nNumNew = MesP2 / 64;
if( nNum[ nNumNew ] == 0 ){
nNumNew = -2;
}
} else {
nNumNew = -2;
}
if( nNumNew != nNumOld ){
TextColor( 255, 255, 255 );
TextWrite( StrPrint( "%ld", nNumOld ), nPic0, nNumOld * 64, 288 );
TextColor( 255, 255, 0 );
TextWrite( StrPrint( "%ld", nNumNew ), nPic0, nNumNew * 64, 288 );
nNumOld = nNumNew;
}
}
mes( LBDOWN ){
if( nFlag_05 && MesP3 >= 308 && nNumNew >= 0 && nNum[ nNumNew ] ){
nNumNew = MesP2 / 64;
nNum[ nNumNew ] = 0;
nNumOld = -2;
nX0 = nNumNew * 64;
nY0 = 304;
nX1 = nX0;
nY1 = nY0;
BackMode( 0 );
TextColor( 255, 255, 255 );
BgColor( 255, 255, 255 );
TextWrite( "O", nPic1, 0, 288 );
BgColor( 0, 0, 0 );
TextWrite( StrPrint( "%ld", nNumNew ), nPic1, 64, 288 );
BackMode( 1 );
TextColor( 0, 0, 0 );
TextWrite( StrPrint( "%ld", nNumNew ), nPic1, 4, 292 );
TextWrite( StrPrint( "%ld", nNumNew ), nPic1, 0, 288 );
MovePic( nPic1, 192, 304, 63, 96, nPic0, nX0, nY0 );
MovePic( nPic0, nX0, nY0, 63, 96, nPic1, 128, 304 );
for( nI = 176 ; nI >= 0 ; nI = nI - 16 ){
nX0 = ( nCount * 64 + 112 ) - ( ( ( ( ( nCount * 64 + 112 ) - ( nNumNew * 64 ) ) * 1000000 ) / 176 ) * nI ) / 1000000;
nY0 = nI + 128;
MovePic( nPic1, 128, 304, 63, 96, nPic0, nX1, nY1 );
MovePic( nPic0, nX0, nY0, 63, 96, nPic1, 128, 304 );
MovePic( nPic1, 0, 308, 63, 96, nPic0, nX0, nY0, SRCAND );
MovePic( nPic1, 64, 308, 63, 96, nPic0, nX0, nY0, SRCINVERT );
nX1 = nX0;
nY1 = nY0;
}
nCount = nCount + 1;
if( nCount == 1 ){
nAnser = nAnser + nNumNew * 100;
} else { if( nCount == 2 ){
nAnser = nAnser + nNumNew * 10;
} else { if( nCount == 3 ){
del_us;
nAnser = nAnser + nNumNew;
nHB = judge( nComNum, nAnser );
nH = nHB / 10;
nB = nHB % 10;
nFlag_05 = 0;
voice( nH );
voice( 17 );
voice( nB );
voice( 18 );
MovePic( nPic1, 192, 288, 192, 112, nPic1, 0, 288 );
MovePic( nPic1, 0, 238, 640, 52, nPic0, 0, 240 );
SetFont( 16, "MS ゴシック", 128, 0, 0, 0, 0 );
center_print( StrPrint( "%ld ヒット、%ld ブロー、だそうです。", nH, nB ), nPic0, 240 );
center_print( "どこかをクリックすると次へ進みます。", nPic0, 272 );
auto_memo( nAnser, nH, nB, 560 );
choice2( nAnser, nH, nB );
if( sKachiMake == "" ){
if( nH == 3 ){
if( ( nTurn % 2 ) == 1 ){
if( nHit3b ){
sKachiMake = "引き分け";
} else {
sKachiMake = "あなたの勝ち";
}
}
} else {
if( nHit3b ){
sKachiMake = "COMの勝ち";
}
}
}
if( nH == 3 ){
nHit3a = -1;
center_print( "当たりです。", nPic0, 256 );
}
if( nLevel < 1 ){
if( nHit3a && ( sKachiMake != "" ) ){
del_us;
main_07( sKachiMake );
del_me;
}
} else {
if( sKachiMake != "" ){
del_us;
main_07( sKachiMake );
del_me;
}
}
mes( LBUP ){
nFlag_05 = -1;
}
mes( LBDOWN ){
if( nFlag_05 ){
nTurn = nTurn + 1;
del_us;
main_06();
del_me;
}
}
del_me;
} } }
}
}
}
main_06(){
if( nHit3b ){
nTurn = nTurn + 1;
main_05();
return;
}
int nFlag_06, nI, nJ, nNum, nNumNew, nNumOld, nCount, nRange, nAnser, nHB, nH, nB, nX0, nY0, nX1, nY1;
nFlag_06 = 0;
nNumNew = -2;
nNumOld = nNumNew;
nCount = 0;
nRange = 256;
voice( 13 );
MovePic( nPic1, 0, 238, 640, 52, nPic0, 0, 240 );
SetFont( 16, "MS ゴシック", 128, 0, 0, 0, 0 );
turn_print();
center_print( "コンピュータは、あなたが考えていると思われる", nPic0, 256 );
center_print( "3桁の数字を表示します。", nPic0, 272 );
SetFont( 128, "MS ゴシック", 0, 0, 0, 0, 0 );
for( nI = 0 ; nI <= 9 ; nI = nI + 1 ){
shadow_print( StrPrint( "%ld", nI ), nPic0, nI * 64, 288, 4 );
}
nAnser = nTable[ Random( nMax ) ];
for( nI = 0 ; nI <= 96 ; nI = nI + 4 ){
MovePic( nPic0, 332, 124 + nI, 192, 96 - nI, nPic0, 332, 128 + nI );
}
for( nJ = 0 ; nJ <= 2 ; nJ = nJ + 1 ){
if( nJ == 0 ){ nNum = nAnser / 100; }
if( nJ == 1 ){ nNum = nAnser / 10 % 10; }
if( nJ == 2 ){ nNum = nAnser % 10; }
if( nNum ){
voice( nNum + 3 );
} else {
voice( nNum );
}
nX0 = nNum * 64;
nY0 = 304;
nX1 = nX0;
nY1 = nY0;
SetFont( 128, "MS ゴシック", 0, 0, 0, 0, 0 );
BackMode( 0 );
TextColor( 255, 255, 255 );
BgColor( 255, 255, 255 );
TextWrite( "O", nPic1, 0, 288 );
BgColor( 0, 0, 0 );
TextWrite( StrPrint( "%ld", nNum ), nPic1, 64, 288 );
BackMode( 1 );
TextColor( 0, 0, 0 );
TextWrite( StrPrint( "%ld", nNum ), nPic1, 4, 292 );
TextWrite( StrPrint( "%ld", nNum ), nPic1, 0, 288 );
MovePic( nPic1, 192, 304, 63, 96, nPic0, nX0, nY0 );
MovePic( nPic0, nX0, nY0, 63, 96, nPic1, 128, 304 );
for( nI = 176 ; nI >= 0 ; nI = nI - 16 ){
nX0 = ( nJ * 64 + 332 ) - ( ( ( ( ( nJ * 64 + 332 ) - ( nNum * 64 ) ) * 1000000 ) / 176 ) * nI ) / 1000000;
nY0 = nI + 128;
MovePic( nPic1, 128, 304, 63, 96, nPic0, nX1, nY1 );
MovePic( nPic0, nX0, nY0, 63, 96, nPic1, 128, 304 );
MovePic( nPic1, 0, 308, 63, 96, nPic0, nX0, nY0, SRCAND );
MovePic( nPic1, 64, 308, 63, 96, nPic0, nX0, nY0, SRCINVERT );
nX1 = nX0;
nY1 = nY0;
}
}
nHB = judge( nYouNum, nAnser );
nH = nHB / 10;
nB = nHB % 10;
voice( 14 );
MovePic( nPic1, 192, 288, 192, 112, nPic1, 0, 288 );
MovePic( nPic1, 0, 238, 640, 52, nPic0, 0, 240 );
SetFont( 16, "MS ゴシック", 128, 0, 0, 0, 0 );
center_print( "あなたが考えている数字と照らし合わせて", nPic0, 240 );
if( nYouNum ){
center_print( "ヒットの数とプローの数を順に入力して下さい。" + StrPrint( "( %ldヒット %ldブロー )", nH, nB ), nPic0, 256 );
} else {
center_print( "ヒットの数とプローの数を順に入力して下さい。", nPic0, 256 );
}
SetFont( 128, "MS ゴシック", 0, 0, 0, 0, 0 );
for( nI = 0 ; nI <= 9 ; nI = nI + 1 ){
shadow_print( StrPrint( "%ld", nI ), nPic0, nI * 64, 288, 4 );
}
mes( MOUSEMOVE ){
if( MesP2 < nRange && MesP3 >= 308 ){
nFlag_06 = -1;
nNumNew = MesP2 / 64;
} else {
nNumNew = -2;
}
if( nNumNew != nNumOld ){
SetFont( 128, "MS ゴシック", 0, 0, 0, 0, 0 );
TextColor( 255, 255, 255 );
TextWrite( StrPrint( "%ld", nNumOld ), nPic0, nNumOld * 64, 288 );
TextColor( 255, 255, 0 );
TextWrite( StrPrint( "%ld", nNumNew ), nPic0, nNumNew * 64, 288 );
nNumOld = nNumNew;
}
}
mes( LBUP ){
if( MesP2 < nRange && MesP3 >= 308 ){
nFlag_06 = -1;
nNumNew = MesP2 / 64;
} else {
nNumNew = -2;
}
if( nNumNew != nNumOld ){
SetFont( 128, "MS ゴシック", 0, 0, 0, 0, 0 );
TextColor( 255, 255, 255 );
TextWrite( StrPrint( "%ld", nNumOld ), nPic0, nNumOld * 64, 288 );
TextColor( 255, 255, 0 );
TextWrite( StrPrint( "%ld", nNumNew ), nPic0, nNumNew * 64, 288 );
nNumOld = nNumNew;
}
}
mes( LBDOWN ){
if( nFlag_06 && MesP2 < nRange && MesP3 >= 308 ){
SetFont( 128, "MS ゴシック", 0, 0, 0, 0, 0 );
TextColor( 255, 0, 0 );
TextWrite( StrPrint( "%ld", nNumNew ), nPic0, nNumNew * 64, 288 );
if( nCount == 0 ){
nCount = nCount + 1;
if( nNumNew == 2 ){
nRange = 64;
} else {
nRange = ( 4 - nNumNew ) * 64;
}
if( MesP2 < nRange ){
TextColor( 255, 255, 0 );
} else {
TextColor( 255, 255, 255 );
}
TextWrite( StrPrint( "%ld", nNumNew ), nPic0, nNumNew * 64, 288 );
nH = nNumNew;
SetFont( 16, "MS ゴシック", 128, 0, 0, 0, 0 );
shadow_print( StrPrint( "%ld ヒット", nH ), nPic0, 248, 272, 2 );
} else {
del_us;
nB = nNumNew;
TextColor( 255, 255, 255 );
TextWrite( StrPrint( "%ld", nNumNew ), nPic0, nNumNew * 64, 288 );
SetFont( 16, "MS ゴシック", 128, 0, 0, 0, 0 );
shadow_print( StrPrint( "%ld プロー", nB ), nPic0, 328, 272, 2 );
auto_memo( nAnser, nH, nB, 16 );
if( sKachiMake == "" ){
if( nH == 3 ){
if( ( nTurn % 2 ) == 1 ){
if( nHit3a ){
sKachiMake = "引き分け";
} else {
sKachiMake = "COMの勝ち";
}
}
} else {
if( nHit3a ){
sKachiMake = "あなたの勝ち";
}
}
}
if( nH == 3 ){
nHit3b = -1;
}
if( nLevel < 1 ){
if( nHit3a && ( sKachiMake != "" ) ){
del_us;
main_07( sKachiMake );
del_me;
}
} else {
if( sKachiMake != "" ){
del_us;
main_07( sKachiMake );
del_me;
}
}
if( choice( nAnser, nH, nB ) == -1 ){
nUso = -1;
}
nTurn = nTurn + 1;
main_05();
del_me;
}
}
}
}
main_07( str sHantei ){
int nFlag_07, nCount, nN, nI, nYouWin, nComWin, nDraw;
str sMode[];
nFlag_07 = 0;
sMode[ 0 ] = "(特訓モード)";
sMode[ 1 ] = "(標準モード)";
sMode[ 2 ] = "(上級モード)";
if( nLevel && sHantei == "COMの勝ち" ){
voice( 15 );
}
for( nCount = 0 ; nCount <= 2 ; nCount = nCount + 1 ){
if( nCount == 0 ){
nN = nComNum / 100;
} else { if( nCount == 1 ){
nN = nComNum / 10 % 10;
} else {
nN = nComNum % 10;
} }
SetFont( 128, "MS ゴシック", 0, 0, 0, 0, 0 );
MovePic( nPic1, 8, 8, 64, 128, nPic1, 332, 8 );
shadow_print( StrPrint( "%ld", nN ), nPic1, 332, 8, 4 );
for( nI =0 ; nI <= 96 ; nI = nI + 4 ){
MovePic( nPic1, 332, 120 - nI, 64, nI, nPic0, 112 + nCount * 64, 16 );
}
if( nLevel && sHantei == "COMの勝ち" ){
if( nN ){
voice( nN + 3 );
} else {
voice( nN );
}
}
}
if( nLevel && sHantei == "COMの勝ち" ){
voice( 16 );
}
nYouWin = GetIniInt( StrPrint( "Level%ld", nLevel ), "YouWin", 0, "hb_log.ini" );
nComWin = GetIniInt( StrPrint( "Level%ld", nLevel ), "ComWin", 0, "hb_log.ini" );
nDraw = GetIniInt( StrPrint( "Level%ld", nLevel ), "Draw", 0, "hb_log.ini" );
MovePic( nPic1, 0, 238, 640, 52, nPic0, 0, 240 );
SetFont( 16, "MS ゴシック", 128, 0, 0, 0, 0 );
if( sHantei == "あなたの勝ち" ){
nYouWin = nYouWin + 1;
center_print( StrPrint( "あなたの勝ちです。 %s あなた%ld勝 COM%ld勝 引き分け%ld", sMode[ nLevel ], nYouWin, nComWin, nDraw ), nPic0, 240 );
if( nUso ){
center_print("でも、どこかでウソをついているのではないかと", nPic0, 256 );
center_print("コンピュータは疑っています。(^_^;", nPic0, 272 );
}
voice( 21 );
} else { if( sHantei == "COMの勝ち" ){
nComWin = nComWin + 1;
SetFont( 16, "MS ゴシック", 128, 0, 0, 0, 0 );
center_print( StrPrint( "コンピュータの勝ちです。 %s COM%ld勝 あなた%ld勝 引き分け%ld", sMode[ nLevel ], nComWin, nYouWin, nDraw ), nPic0, 240 );
voice( 22 );
} else { if( sHantei == "引き分け" ){
nDraw = nDraw + 1;
center_print( StrPrint( "引き分けです。 %s あなた%ld勝 COM%ld勝 引き分け%ld", sMode[ nLevel ], nYouWin, nComWin, nDraw ), nPic0, 240 );
if( nUso ){
center_print("でも、どこかでウソをついているのではないかと", nPic0, 256 );
center_print("コンピュータは疑っています。(^_^;", nPic0, 272 );
}
} } }
WriteIniInt( StrPrint( "Level%ld", nLevel ), "YouWin", nYouWin, "hb_log.ini" );
WriteIniInt( StrPrint( "Level%ld", nLevel ), "ComWin", nComWin, "hb_log.ini" );
WriteIniInt( StrPrint( "Level%ld", nLevel ), "Draw", nDraw, "hb_log.ini" );
mes( LBUP ){
nFlag_07 = -1;
}
mes( LBDOWN ){
if( nFlag_07 ){
main_08();
del_me;
}
}
}
main_08(){
int nFlag_08, nI, nNumNew, nNumOld;
nFlag_08 = 0;
nNumNew = -2;
nNumOld = nNumNew;
MovePic( nPic1, 0, 238, 640, 52, nPic0, 0, 240 );
SetFont( 16, "MS ゴシック", 128, 0, 0, 0, 0 );
center_print( "もう一度ゲームをしますか?", nPic0, 240 );
center_print( "する場合は“1”やめる場合は“0”をクリックして下さい", nPic0, 272 );
SetFont( 128, "MS ゴシック", 0, 0, 0, 0, 0 );
for( nI = 0 ; nI <= 9 ; nI = nI + 1 ){
shadow_print( StrPrint( "%ld", nI ), nPic0, nI * 64, 288, 4 );
}
mes( MOUSEMOVE ){
if( MesP2 < 128 && MesP3 >= 308 ){
nFlag_08 = -1;
nNumNew = MesP2 / 64;
} else {
nNumNew = -2;
}
if( nNumNew != nNumOld ){
TextColor( 255, 255, 255 );
TextWrite( StrPrint( "%ld", nNumOld ), nPic0, nNumOld * 64, 288 );
TextColor( 255, 255, 0 );
TextWrite( StrPrint( "%ld", nNumNew ), nPic0, nNumNew * 64, 288 );
nNumOld = nNumNew;
}
}
mes( LBUP ){
if( MesP2 < 128 && MesP3 >= 308 ){
nFlag_08 = -1;
nNumNew = MesP2 / 64;
} else {
nNumNew = -2;
}
if( nNumNew != nNumOld ){
TextColor( 255, 255, 255 );
TextWrite( StrPrint( "%ld", nNumOld ), nPic0, nNumOld * 64, 288 );
TextColor( 255, 255, 0 );
TextWrite( StrPrint( "%ld", nNumNew ), nPic0, nNumNew * 64, 288 );
nNumOld = nNumNew;
}
}
mes( LBDOWN ){
if( nFlag_08 && MesP2 < 128 && MesP3 >= 308 ){
nNumNew = MesP2 / 64;
TextColor( 255, 0, 0 );
TextWrite( StrPrint( "%ld", nNumNew ), nPic0, nNumNew * 64, 288 );
del_us;
if( nNumNew == 1 ){
mes( LBUP ){
nLoop = 1;
CloseWin( nWin0 );
del_us;
del_me;
}
} else {
CloseWin( nWin0 );
del_all;
del_me;
}
}
}
}
make_table(){
int nI, nJ, nK;
nMax = 0;
for( nI = 0 ; nI <= 9 ; nI = nI + 1 ){
for( nJ = 0 ; nJ <= 9 ; nJ = nJ + 1 ){
if( nJ != nI ){
for( nK = 0 ; nK <= 9 ; nK = nK + 1 ){
if( nK != nJ && nK != nI ){
nTable[ nMax ] = nI * 100 + nJ * 10 + nK;
nTable2[ nMax ] = nTable[ nMax ];
nMax = nMax + 1;
}
}
}
}
}
nMax2 = nMax;
}
choice( int nNum0, nHit, nBlow ){
int nI, nHB, nH, nB, nEnd, nTmp;
nEnd = nMax - 1;
for( nI = 0 ; nI <= nEnd ; nI = nI + 1 ){
while( nI < nMax ){
nHB = judge( nNum0, nTable[ nI ] );
nH = nHB / 10;
nB = nHB % 10;
if( nHit != nH || nBlow != nB ){
nTmp = nTable[ nI ];
nTable[ nI ] = nTable[ nMax - 1 ];
nTable[ nMax - 1 ] = nTmp;
nMax = nMax - 1;
if( nMax == 0 ){
nMax = 720;
return( -1 );
}
} else {
break;
}
}
}
return( 0 );
}
choice2( int nNum0, nHit, nBlow ){
int nI, nHB, nH, nB, nEnd, nTmp;
nEnd = nMax2 - 1;
for( nI = 0 ; nI <= nEnd ; nI = nI + 1 ){
while( nI < nMax2 ){
nHB = judge( nNum0, nTable2[ nI ] );
nH = nHB / 10;
nB = nHB % 10;
if( nHit != nH || nBlow != nB ){
nTmp = nTable2[ nI ];
nTable2[ nI ] = nTable2[ nMax2 - 1 ];
nTable2[ nMax2 - 1 ] = nTmp;
nMax2 = nMax2 - 1;
if( nMax2 == 0 ){
nMax2 = 720;
return( -1 );
}
} else {
break;
}
}
}
return( 0 );
}
judge( int nNum0, nNum1 ){
int nHit, nBlow;
nHit = 0;
nBlow = 0;
nH0 = nNum0 / 100;
nM0 = ( nNum0 / 10 ) % 10;
nL0 = nNum0 % 10;
nH1 = nNum1 / 100;
nM1 = ( nNum1 / 10 ) % 10;
nL1 = nNum1 % 10;
if( nH0 == nH1 ){
nHit = nHit +1;
}else{if( nH0 == nM1 || nH0 == nL1 ){
nBlow = nBlow +1;
}}
if( nM0 == nM1 ){
nHit = nHit +1;
}else{if( nM0 == nH1 || nM0 == nL1 ){
nBlow = nBlow +1;
}}
if( nL0 == nL1 ){
nHit = nHit +1;
}else{if( nL0 == nH1 || nL0 == nM1 ){
nBlow = nBlow +1;
}}
return( nHit * 10 + nBlow );
}
center_print( str sString, int nPicNo, int nYpos ){
shadow_print( sString, nPicNo, ( 640 - StrLen( sString ) * 8 ) / 2, nYpos, 2 );
}
shadow_print( str sString, int nPicNo, int nXpos, int nYpos, int nOffset, str sColor = "W" ){
TextColor( 0, 0, 0 );
TextWrite( sString, nPicNo, nXpos + nOffset, nYpos + nOffset );
if( sColor == "W" ){
TextColor( 255, 255, 255 );
} else { if( sColor == "R" ){
TextColor( 255, 0, 0 );
} else { if( sColor == "G" ){
TextColor( 0, 255, 0 );
} else { if( sColor == "B" ){
TextColor( 0, 0, 255 );
} else { if( sColor == "Y" ){
TextColor( 255, 255, 0 );
} else { if( sColor == "C" ){
TextColor( 0, 255, 255 );
} else { if( sColor == "M" ){
TextColor( 255, 0, 255 );
} } } } } } }
TextWrite( sString, nPicNo, nXpos, nYpos );
}
auto_memo( int nAnser, nH, nB, nX ){
int nY, nI, nIN;
str sCol;
if( nTurn / 2 > 9 ){
nY = 184;
MovePic( nPic0, nX, 56, 65, 160, nPic0, nX, 40 );
} else {
nY = nTurn / 2 * 16 + 40;
}
SetFont( 16, "MS ゴシック", 128, 0, 0, 0, 400 );
if( nH == 3 ){
sCol = "Y";
voice( 19 );
} else {
sCol = "B";
}
if( nX == 560 && nLevel == 0 ){
nIN = -1;
for( nI = 0 ; nI <= nMax2 ; nI = nI + 1 ){
if( nAnser == nTable2[ nI ] ){
nIN = 0;
break;
}
}
if( nIN ){
sCol = "R";
}
}
shadow_print( StrPrint( "%03ld:", nAnser ), nPic0, nX, nY, 1, sCol );
shadow_print( StrPrint( "%ldH", nH ), nPic0, nX + 32, nY, 1, sCol );
shadow_print( StrPrint( "%ldB", nB ), nPic0, nX + 48, nY, 1, sCol );
}
turn_print(){
if( nLevel == 0 && nHit3b ){
center_print( StrPrint( "ターン %ld です。", nTurn / 2 + 1 ), nPic0, 240 );
} else {
if( nTurn % 2 == 0 ){
center_print( StrPrint( "ターン %ld 前半です。", nTurn / 2 + 1 ), nPic0, 240 );
} else {
center_print( StrPrint( "ターン %ld 後半です。", nTurn / 2 + 1 ), nPic0, 240 );
}
}
}
voice( int nVoiceNo ){
int nI;
if( nUseWave == 0 ){
return;
}
if( nVoiceNo >= 0 ){
if( nWav == 0 ){
PlayWAVE( "voice_" + StrPrint( "%02ld", nVoiceNo ) + ".wav" );
}
nWAV_Buf[ nWP_a ] = nVoiceNo;
nWP_a = ( nWP_a + 1 ) % 16;
nWav = nWav + 1;
} else {
nWav = 0;
nWP_a = 0;
nWP_b = 0;
for( nI=0 ; nI<=15 ; nI=nI+1 ){
nWAV_Buf[ nI ] = -1;
}
mes( WAVE_END ){
if( nWP_a == ( ( nWP_b + nWav ) % 16 ) ){
nWAV_Buf[ nWP_b ] = -1;
nWP_b = ( nWP_b + 1 ) % 16;
nWav = nWav - 1;
if( nWav ){
PlayWAVE( "voice_" + StrPrint( "%02ld", nWAV_Buf[ nWP_b ] ) + ".wav" );
}
}
}
}
}