home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
DOS/V Power Report 1998 March
/
VPR9803A.ISO
/
Ffilly
/
Ss01p
/
神経衰弱.tfy
< prev
next >
Wrap
Text File
|
1997-12-26
|
5KB
|
178 lines
int pBack, pBase, pButton[], pCard[];
int cBase, cCard[], cButton[];
int pCard00;
int nCardMax;
int nRow, nColumn;
int cDown;
int wCard, hCard;
int wBack, hBack;
main(){
init();
game();
}
init(){
int pButton00, pButton01;
int wButton, hButton;
int xButton, yButton;
nRow=7;
nColumn = 4;
nCardMax = nRow * nColumn-2;
CapTitle( " 神経衰弱 Version 0.1" );
pBack = LoadPic( "back.bmp" );
wBack = PicWidth( pBack );
hBack = PicHeight( pBack );
pBase = CreatePic( pBack );
pCard[ nCardMax ] = LoadPic( "card0.bmp" );
pCard00 = LoadPic( "cardpic.bmp" );
wCard = PicWidth( pCard[ nCardMax ] );
hCard = PicHeight( pCard[ nCardMax ] );
pButton00 = LoadPic( "button0.bmp");
pButton01 = LoadPic( "button1.bmp");
wButton = PicWidth( pButton00 );
hButton = PicHeight( pButton00 ) / 2;
pButton[0] = CreatePic( pButton00, wButton, hButton );
pButton[10] = CreatePic( pButton01, wButton, hButton );
MovePic( pButton00, 0, 0, wButton, hButton, pButton[ 0 ] );
MovePic( pButton01, 0, 0, wButton, hButton, pButton[ 10 ] );
pButton[ 1 ] = CreatePic( pButton00, wButton, hButton );
pButton[ 11 ] = CreatePic( pButton01, wButton, hButton );
MovePic( pButton00, 0, hButton, wButton, hButton, pButton[ 1 ] );
MovePic( pButton01, 0, hButton, wButton, hButton, pButton[ 11 ] );
cBase = PutCast( pBack, pBase );
xButton = wBack - wButton - 10;
yButton = hBack - hButton * 2 - 30;
cButton[0] = PutCast( pButton[ 0 ], pBase, xButton, yButton );
cButton[1] = PutCast( pButton[ 1 ], pBase, xButton, yButton + hButton );
DelPic( pButton00 );
DelPic( pButton01 );
OpenWin( pBase );
}
int game(){
int nCard, xCard[], yCard[];
int nDown[];
int sCard[],i;
int xOff, yOff;
int nScore, nHiScore, nPair, nCount, nMessage;
int cOldDown, nOldCard;
cOldDown = cBase;
xOff = 20;
yOff = 36;
for( nCard = 0; nCard < nCardMax; nCard = nCard + 1 ){
xCard[ nCard ] = ( nCard % nRow ) * ( wCard + 4 ) + xOff;
yCard[ nCard ] = ( nCard / nRow ) * ( hCard + 8 ) + yOff;
cCard[ nCard ] = PutCast( pCard[ nCardMax ], pBase, xCard[ nCard ], yCard[ nCard ], 0x00ff00, 0, 1, 1 );
repeat:;
sCard[ nCard ] = Random( nCardMax );
for(i = 0; i < nCard; i = i + 1 ){
if( sCard[ nCard ] == sCard[ i ] ) goto repeat;
}
pCard[ nCard ] = CreatePic( pCard00, wCard, hCard );
MovePic( pCard00, ( sCard[nCard] % 13 ) * wCard, ( sCard[nCard] / 13 ) * hCard, wCard, hCard, pCard[ nCard ] );
nDown[ nCard ] = 0;
}
RepaintCast( pBase, 0, 0, wBack, hBack );
nCount = 0;
nPair = 0;
nScore = 0;
nHiScore = GetIniInt( "record", "hiscore", 0, ".\神経衰弱.ini" );
BackMode( 0 );
SetFont( 28, "MSP ゴシック", 128 );
TextColor( 255, 255, 0 );
BgColor( 0, 0, 0 );
TextWrite( StrPrint( "%4ld", nScore ), pBase, 550, 226 );
TextWrite( StrPrint( "%4ld", nHiScore ), pBase, 550, 151 );
TextWrite( "normal", pBase, 530, 297 );
mes( LBDOWN ){
nMessage = GetMesNo( 0 );
cDown = HitCast( pBase, MesP2, MesP3);
if( cDown == cButton[ 0 ] ){
mes(TIME){
step( 8 ){
del_us;
MoveCast( cButton[ 0 ], pButton[ 10 ] );
,
MoveCast( cButton[ 0 ], pButton[ 0 ] );
,,
for( nCard = 0; nCard < nCardMax; nCard = nCard + 1 ){
DelCast( cCard[ nCard], 1 );
}
RepaintCast( pBase, 0, 0, wBack, hBack );
game();
del_me;
}
}
}
else if( cDown == cButton[ 1 ] ){
mes(TIME){
step( 8 ){
del_us;
MoveCast( cButton[ 1 ], pButton[ 11 ] );
,
MoveCast( cButton[ 1 ], pButton[ 1 ] );
,,
CloseWinAll();
del_me;
}
}
}
else if( cDown != cBase && cDown != cOldDown ){
FreezeMes( nMessage );
nCount = nCount + 1;
nCard = ( MesP2 - xOff ) / ( wCard + 4 ) + ( MesP3 - yOff ) / ( hCard + 8 ) * nRow;
nDown[ nCard ] = nDown[ nCard ] + 1;
MoveCast( cDown, pCard[ nCard ] );
if( nCount % 2 == 0 ){
mes(TIME){
step( 8 ){
,,,
if(sCard[ nCard ] % 13 == sCard[ nOldCard ] % 13 ){
MoveCast( cDown, pCard[ nCard ], wBack, 0 );
MoveCast( cOldDown, pCard[ nOldCard ], wBack, 0 );
nPair = nPair + 1;
nScore = nScore + 2000 / ( nDown[ nCard ] + nDown[ nOldCard ] );
BackMode( 0 );
SetFont( 28, "MSP ゴシック", 128 );
TextColor( 255, 255, 0 );
BgColor( 0, 0, 0 );
TextWrite( StrPrint( "%4ld", nScore ), pBase, 550, 226 );
// if( nPair == 1 ){
if( nPair == nCardMax / 2 ){
BackMode( 1 );
SetFont( 42, "MSP ゴシック", 128 );
TextColor( 255, 255, 255 );
TextWrite( "Congratulations!", pBase, 102, 212 );
TextColor( 255, 0, 0 );
TextWrite( "Congratulations!", pBase, 100, 210 );
if( nScore > nHiScore ){
nHiScore = nScore;
WriteIniInt( "record", "hiscore", nHiScore, ".\神経衰弱.ini" );
BackMode( 0 );
SetFont( 28, "MSP ゴシック", 128 );
TextColor( 255, 255, 0 );
BgColor( 0, 0, 0 );
TextWrite( StrPrint( "%4ld", nHiScore ), pBase, 550, 151 );
}
}
}
else{
MoveCast( cDown, pCard[ nCardMax ] );
MoveCast( cOldDown, pCard[ nCardMax ] );
cOldDown = cBase;
}
ActivateMes( nMessage );
del_me;
}
}
}
else{
nOldCard = nCard;
cOldDown = cDown;
ActivateMes( nMessage );
}
}
}
}