home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
DOS/V Power Report 1996 August
/
VPR9608A.BIN
/
ffilly
/
kirameki
/
mmtext.tfy
< prev
next >
Wrap
Text File
|
1996-04-18
|
16KB
|
551 lines
//TOFFYシナリオのひな型
//作品情報(""内を書き換えて下さい)
#info INAM "まるちめでぃあ★てきすと"
#info ISBJ "文芸を手軽にタイトルに、、、"
#info VIDO "640x480,256色"
#info WRIT "ともゆん"
#info ICOP "ともゆん"
int Win_No, FontSize,BaseX,BaseY, BlackPic,IsInPage,CPic, MaxPage, Page[], Sect[], MaxSect,base_pic_x, base_pic_y,PicLeft,PicTop;
int CPico, CPic2, CCast,transparency_color, PageNo, mtext[], mtpage[], Pic[], Cast[], Xoff[], Yoff[];
str BaseFont, IniName, Title[];
//シナリオ本体
main(){
//ここからシナリオを書き始めて下さい
int i, j;
int BackPic;
str TmpStr;
Debug(1);
IniName="mmtext.ini"; //////////////////////////////////////読み込みファイル名指定
BlackPic=LoadPic("black.bmp");//フェードイン用背景を読み込みまーす
CPico=CreatePic(BlackPic);
CPic=CreatePic(BlackPic);
CPic2=CreatePic(BlackPic);
mtext[0]=CreatePic(BlackPic);
mtext[1]=CreatePic(BlackPic);
mtext[2]=CreatePic(BlackPic);
mtext[3]=CreatePic(BlackPic);
mtext[4]=CreatePic(BlackPic);
MovePic(BlackPic,0,0,640,480,CPico,0,0);
base_pic_x=PicWidth(BlackPic);
base_pic_y=PicHeight(BlackPic);
PicLeft=(WinInfo(0)-base_pic_x)/2-1;
// PicRight=(WinInfo(0)+base_pic_x)/2-1;
PicTop=(WinInfo(1)-base_pic_y)/2-1;
// PicBottom=(WinInfo(1)+base_pic_y)/2-1;
CapTitle(""); //ウィンドウの上のキャプションバーを消します。
CCast = PutCast( CPico, CPic );
OpenWin(CPic,
-1, //スクリーンの左上隅からちょっとだけ左
-1, //スクリーンの左上隅からちょっとだけ上 (ウィンドウの枠を消したいので)
WinInfo(0), //スクリーンの横幅と同じ大きさのサイズ
WinInfo(1), //縦の高さのサイズ
-PicLeft+1, //ピクチャーの表示を画面の中央に、、、
-PicTop+1, //同じく
0); //バックグラウンドを黒に
// OpenWin( CPic );
BaseFont =GetIniStr("system","basefont","MS 明朝",IniName);
FontSize=GetIniInt("system","fontsize",16,IniName);
BaseX=GetIniInt("system","startx", 38,IniName);
BaseY=GetIniInt("system","starty", 84,IniName);
j=0; Title[0]=" "; Sect[0]=1;
for(i=1;GetIniStr(StrPrint("Page%ld",i),"Text1","/E",IniName)!="/E";i=i+1){
if((TmpStr=GetIniStr(StrPrint("Page%ld",i),"Title","/E",IniName))!="/E"){
j=j+1;
Sect[j]=i;
Title[j]=TmpStr;
}
Page[i]=j;
}
MaxPage=i-1;
MaxSect=j;
IsInPage=0;//背景がページモードなら1
transparency_color = GetIniInt( "system", "transparency_color", 0xffff, IniName );
PageNo = 1;
mtpage[0] = -1;
mtpage[1] = -1;
mtpage[2] = -1;
mtpage[3] = -1;
mtpage[4] = -1;
Opening();
//ここまでに書いてください
}
Opening()
{
int i;
Pic[0]=LoadPic(GetIniStr("system","startpic","open.bmp",IniName));
Pic[1]=LoadPic(GetIniStr("system","start_pb","open_p.bmp",IniName));
Xoff[1]=GetIniInt("system","start_pbx",450,IniName);
Yoff[1]=GetIniInt("system","start_pby",392,IniName);
Pic[2]=LoadPic(GetIniStr("system","start_sb","open_s.bmp",IniName));
Xoff[2]=GetIniInt("system","start_sbx",497,IniName);
Yoff[2]=GetIniInt("system","start_sby",393,IniName);
Pic[3]=LoadPic(GetIniStr("system","start_eb","open_e.bmp",IniName));
Xoff[3]=GetIniInt("system","start_ebx",544,IniName);
Yoff[3]=GetIniInt("system","start_eby",392,IniName);
MovePic( Pic[0], 0, 0, 640, 480, CPic2 );
for( i = 1; i <= 3; i = i + 1 ) {
MovePic( Pic[i], 0, 0, PicWidth( Pic[i] ), PicHeight( Pic[i] ), CPic2, Xoff[i], Yoff[i], 0, transparency_color );
}
MovePic( CPic2, 0, 0, 640, 480, CPic, 0, 0, 2, 20 );
mes( TIME ) {
step( 20 ) {
,
for( i = 1; i <= 3; i = i + 1 ) {
Cast[i] = PutCast( Pic[i], CPic, Xoff[i], Yoff[i], transparency_color, 0, 10, 1 );
}
Cast[i] = 0;
MovePic( Pic[0], 0, 0, 640, 480, CPico );
MoveCast( CCast, CPico );
butproc1( 0 );
del_me;
}
}
}
butproc1( int offset )
{
int i;
int cast2;
int x, y;
mes( LBDOWN ){
x = MesP2 - PicLeft + 1;
y = MesP3 - PicTop + 1;
cast2 = HitCast( CPic, x, y );
for( i = 1; ; i = i + 1 ) {
if( Cast[i] == 0 ) {
break;
}
if( cast2 == Cast[i] ) {
del_us;
if( offset == 10 ) {
PlayWAVE("pachi.wav");
} else {
PlayWAVE("kachi.wav");
}
butproc2( offset, i );
del_me;
}
}
PlayWAVE("shuu.wav");
}
}
butproc2( int offset, int i )
{
int cast2, hitflag;
int j;
int x, y;
j = i + offset;
MoveCast( Cast[i], Pic[i], Xoff[i] + 2, Yoff[i] + 2 );
hitflag = 1;
mes( MOUSEMOVE ) {
x = MesP2 - PicLeft + 1;
y = MesP3 - PicTop + 1;
//TextWrite( StrPrint( "MesP2=%04ld MesP3=%04ld", x, y ), CPic, 0, 0 );
cast2 = HitCast( CPic, x, y );
if( cast2 != Cast[i] && hitflag == 1 ) {
MoveCast( Cast[i], Pic[i], Xoff[i], Yoff[i] );
hitflag = 0;
} else if( cast2 == Cast[i] && hitflag == 0 ) {
MoveCast( Cast[i], Pic[i], Xoff[i] + 2, Yoff[i] + 2 );
hitflag = 1;
}
}
mes( LBUP ) {
del_us;
if( hitflag == 1 ) {
MoveCast( Cast[i], Pic[i], Xoff[i], Yoff[i] );
if( offset != 10 ) {
for( i = 1; ; i = i + 1 ) {
if( Cast[i] == 0 ) {
break;
}
DelCast( Cast[i], 1 );
DelPic( Pic[i] );
}
MovePic( CPic2, 0, 0, 640, 480, CPico );
MoveCast( CCast, CPico );
DelPic( Pic[0] );
}
i = PageNo;
//TextWrite( StrPrint( "page[%ld]=%ld", PageNo, Page[PageNo] ), CPic, 0, 0 );
if( j == 1 ) {
// profile
// PlayWAVE("kachi.wav");
Prof();
del_me;
} else if( j == 2 ) {
// start
// PlayWAVE("kachi.wav");
WritePage( i, 1 );
del_me;
} else if( j == 3 ) {
// end
// PlayWAVE("kachi.wav");
BackMode(1);
TextColor(255,255,255);
SetFont( 80, "Times New Roman", 0, 0, 0, 0, 800,1 ,0,0,0,0,0,2,1);
TextWrite("Fin.",BlackPic,260,180);
MovePic(BlackPic,0,0,640,480,CPic,0,0,3,20);
mes(TIME){step(30){,
CloseWinAll();
del_all;
del_me;
}}
del_me;
} else if( j == 6 ) {
// PlayWAVE("kachi.wav");
Opening();
del_me;
} else if( j == 11 ) {
if( Page[PageNo] > 0 && i != Sect[Page[PageNo] - 1] ) {
// PlayWAVE("pachi.wav");
WritePage( i, Sect[Page[PageNo] - 1] );
del_me;
}
} else if( j == 12 ) {
if( PageNo > 1 && i != PageNo - 1 ) {
// PlayWAVE("pachi.wav");
WritePage( i, PageNo - 1 );
del_me;
}
} else if( j == 13 ) {
if( PageNo < MaxPage && i != PageNo + 1 ) {
// PlayWAVE("pachi.wav");
WritePage( i, PageNo + 1 );
del_me;
}
} else if( j == 14 ) {
if( Page[PageNo] < MaxSect && i != Sect[Page[PageNo] + 1] ) {
// PlayWAVE("pachi.wav");
WritePage( i, Sect[Page[PageNo] + 1] );
del_me;
}
} else if( j == 15 ) {
// PlayWAVE("kachi.wav");
PageNo = 1;
MovePic( mtext[0], 0, 0, 640, 480, CPic2 );
for( i = 1; i <= 5; i = i + 1 ) {
MovePic( Pic[i], 0, 0, PicWidth( Pic[i] ), PicHeight( Pic[i] ), CPic2, Xoff[i], Yoff[i], 0, transparency_color );
}
for( i = 1; ; i = i + 1 ) {
if( Cast[i] == 0 ) {
break;
}
DelCast( Cast[i], 1 );
DelPic( Pic[i] );
}
MovePic( CPic2, 0, 0, 640, 480, CPico );
MoveCast( CCast, CPico );
DelPic( Pic[0] );
Opening();
IsInPage = 0;
del_me;
}
}
PlayWAVE("shuu.wav");
butproc1( offset );
del_me;
}
}
Prof()
{
int i;
Pic[0]=LoadPic(GetIniStr("system","profpic","prof.bmp",IniName));
Pic[1]=LoadPic(GetIniStr("system","prof_eb","back_e.bmp",IniName));
Xoff[1]=GetIniInt("system","prof_ebx",590,IniName);
Yoff[1]=GetIniInt("system","prof_eby",414,IniName);
MovePic( Pic[0], 0, 0, 640, 480, CPic2 );
MovePic( Pic[1], 0, 0, PicWidth( Pic[1] ), PicHeight( Pic[1] ), CPic2, Xoff[1], Yoff[1], 0, transparency_color );
MovePic( CPic2, 0, 0, 640, 480, CPic, 0, 0, 2, 20 );
MovePic( CPic2, 0, 0, 640, 480, CPic, 0, 0, 2, 20 );
mes( TIME ) {
step( 20 ) {
,
Cast[1] = PutCast( Pic[1], CPic, Xoff[1], Yoff[1], transparency_color, 0, 10, 1 );
Cast[2] = 0;
MovePic( Pic[0], 0, 0, 640, 480, CPico );
MoveCast( CCast, CPico );
butproc1( 5 );
del_me;
}
}
}
WritePage( int old, int new )
{
int i, j;
str sect,text;
//TextWrite( StrPrint( "old=%ld, new=%ld", old, new ), CPic, 0, 20 );
if( IsInPage != 1 ) {
Pic[0]=LoadPic(GetIniStr("system","backpic","back.bmp",IniName));
Pic[1]=LoadPic(GetIniStr("system","back_u2b","back_u2.bmp",IniName));
Xoff[1]=GetIniInt("system","back_u2bx",594,IniName);
Yoff[1]=GetIniInt("system","back_u2by",87,IniName);
Pic[2]=LoadPic(GetIniStr("system","back_ub","back_u.bmp",IniName));
Xoff[2]=GetIniInt("system","back_ubx",594,IniName);
Yoff[2]=GetIniInt("system","back_uby",164,IniName);
Pic[3]=LoadPic(GetIniStr("system","back_db","back_d.bmp",IniName));
Xoff[3]=GetIniInt("system","back_dbx",594,IniName);
Yoff[3]=GetIniInt("system","back_dby",258,IniName);
Pic[4]=LoadPic(GetIniStr("system","back_d2b","back_d2.bmp",IniName));
Xoff[4]=GetIniInt("system","back_d2bx",594,IniName);
Yoff[4]=GetIniInt("system","back_d2by",336,IniName);
Pic[5]=LoadPic(GetIniStr("system","back_eb","back_e.bmp",IniName));
Xoff[5]=GetIniInt("system","back_ebx",590,IniName);
Yoff[5]=GetIniInt("system","back_eby",414,IniName);
PageNo = new;
textcreate( mtext[0], PageNo );
mtpage[0] = PageNo;
MovePic( mtext[0], 0, 0, 640, 480, CPic2 );
for( i = 1; i <= 5; i = i + 1 ) {
MovePic( Pic[i], 0, 0, PicWidth( Pic[i] ), PicHeight( Pic[i] ), CPic2, Xoff[i], Yoff[i], 0, transparency_color );
}
MovePic( CPic2, 0, 0, 640, 480, CPic, 0, 0, 2, 20 );
IsInPage=1;
mes( TIME ) {
step( 20 ) {
,
for( i = 1; i <= 5; i = i + 1 ) {
Cast[i] = PutCast( Pic[i], CPic, Xoff[i], Yoff[i], transparency_color, 0, 10, 1 );
}
Cast[i] = 0;
MovePic( mtext[0], 0, 0, 640, 480, CPico );
MoveCast( CCast, CPico );
sect=StrPrint("Page%ld",PageNo);
if((text=GetIniStr(sect,"wave","/E",IniName))!="/E"){PlayWAVE(text);}
if((text=GetIniStr(sect,"midi","/E",IniName))!="/E"){PlayMIDI(text);}
mes( USER ) {
if( MesP1 == 1 ) {
if(Page[PageNo]>0){
textcreate( mtext[1], Sect[Page[PageNo]-1] );
mtpage[1] = Sect[Page[PageNo]-1];
} else {
mtpage[1] = -1;
}
if(PageNo>1){
textcreate( mtext[2], PageNo-1 );
mtpage[2] = PageNo - 1;
} else {
mtpage[2] = -1;
}
if(PageNo<MaxPage){
textcreate( mtext[3], PageNo+1 );
mtpage[3] = PageNo + 1;
} else {
mtpage[3] = -1;
}
if(Page[PageNo]<MaxSect){
textcreate( mtext[4], Sect[Page[PageNo]+1] );
mtpage[4] = Sect[Page[PageNo]+1];
} else {
mtpage[4] = -1;
}
del_me;
}
}
mes( TIME ) {
step( 10 ) {
,
PostMes( USER, 1 );
del_me;
}
}
butproc1( 10 );
del_me;
}
}
} else {
/* if( old == new ) {
butproc1( 10 );
return;
}
*/ for( i = 1; i <= 5; i = i + 1 ) {
if( mtpage[i] == new ) {
MovePic( mtext[i], 0, 0, 640, 480, mtext[0] );
mtpage[0] = mtpage[i];
/* j = mtext[0];
mtext[0] = mtext[i];
mtext[i] = j;
mtpage[0] = new;
mtpage[i] = mtpage[0];
*/ break;
}
}
PageNo = new;
if( i == 6 ) {
textcreate( mtext[0], PageNo );
mtpage[0] = new;
}
MovePic( mtext[0], 0, 0, 640, 480, CPico );
MoveCast( CCast, CPico );
sect=StrPrint("Page%ld",PageNo);
if((text=GetIniStr(sect,"wave","/E",IniName))!="/E"){PlayWAVE(text);}
if((text=GetIniStr(sect,"midi","/E",IniName))!="/E"){PlayMIDI(text);}
mes( USER ) {
if( MesP1 == 1 ) {
if( Page[PageNo] > 0 ) {
if( mtpage[1] != Sect[Page[PageNo] - 1] ) {
for( i = 1; i <= 5; i = i + 1 ) {
if( mtpage[i] == Sect[Page[PageNo] - 1] ) {
MovePic( mtext[i], 0, 0, 640, 480, mtext[1] );
mtpage[1] = mtpage[i];
break;
}
}
if( i == 6 ) {
textcreate( mtext[1], Sect[Page[PageNo] - 1] );
mtpage[1] = Sect[Page[PageNo] - 1];
}
}
} else {
mtpage[1] = -1;
}
if( PageNo > 1 ){
if( mtpage[2] != PageNo - 1 ) {
for( i = 1; i <= 5; i = i + 1 ) {
if( mtpage[i] == PageNo - 1 ) {
MovePic( mtext[i], 0, 0, 640, 480, mtext[2] );
mtpage[2] = mtpage[i];
break;
}
}
if( i == 6 ) {
textcreate( mtext[2], PageNo - 1 );
mtpage[2] = PageNo - 1;
}
}
} else {
mtpage[2] = -1;
}
if( PageNo < MaxPage ) {
if( mtpage[3] != PageNo + 1 ) {
for( i = 1; i <= 5; i = i + 1 ) {
if( mtpage[i] == PageNo + 1 ) {
MovePic( mtext[i], 0, 0, 640, 480, mtext[3] );
mtpage[3] = mtpage[i];
break;
}
}
if( i == 6 ) {
textcreate( mtext[3], PageNo + 1 );
mtpage[3] = PageNo + 1;
}
}
} else {
mtpage[3] = -1;
}
if( Page[PageNo] < MaxSect ) {
if( mtpage[4] != Sect[Page[PageNo] + 1] ) {
for( i = 1; i <= 5; i = i + 1 ) {
if( mtpage[i] == Sect[Page[PageNo] + 1] ) {
MovePic( mtext[i], 0, 0, 640, 480, mtext[4] );
mtpage[4] = mtpage[i];
break;
}
}
if( i == 6 ) {
textcreate( mtext[4], Sect[Page[PageNo] + 1] );
mtpage[4] = Sect[Page[PageNo] + 1];
}
}
} else {
mtpage[4] = -1;
}
del_me;
}
}
mes( TIME ) {
step( 10 ) {
,
PostMes( USER, 1 );
del_me;
}
}
butproc1( 10 );
}
}
textcreate( int mp, int num )
{
str sect,text;
int x,y,i,p;
MovePic( Pic[0], 0, 0, 640, 480, mp, 0, 0 );
sect=StrPrint("Page%ld",num);
x=GetIniInt(sect, "startx", BaseX,IniName);
y=GetIniInt(sect, "starty", BaseY,IniName);
BackMode(1);
SetFont( 24, "MS ゴシック", 128, 0, 0, 0, 800 );
TextColor(0,0,0);
TextWrite(Title[Page[num]],mp,61,21);
TextColor(0,0,255);
TextWrite(Title[Page[num]],mp,60,20);
SetFont( 20, "MS 明朝", 128, 0, 0, 0, 400 );
TextColor(0,0,0);
TextWrite(StrPrint("P.%ld",num),mp,511,24);
TextColor(255,0,0);
TextWrite(StrPrint("P.%ld",num),mp,510,23);
TextColor(0,0,95);
SetFont(GetIniInt(sect,"fontsize",FontSize,IniName),GetIniInt(sect,"fontname",BaseFont,IniName),128, 0, 0, 0, 400);
// if((text=GetIniStr(sect,"wave","/E",IniName))!="/E"){PlayWAVE(text);}
// if((text=GetIniStr(sect,"midi","/E",IniName))!="/E"){PlayMIDI(text);}
for(i=1;(text=GetIniStr(sect,StrPrint("Pic%ld",i),"/E",IniName))!="/E";i=i+1){
p=LoadPic(text);
MovePic(p,0,0,PicWidth(p),PicHeight(p),mp,GetIniInt(sect,StrPrint("Pic%ldx",i),27,IniName),GetIniInt(sect,StrPrint("Pic%ldy",i),73,IniName));
DelPic(p);
}
for(i=1;(text=GetIniStr(sect,StrPrint("Text%ld",i),"/E",IniName))!="/E";i=i+1){
if(StrFind(text,"/EM")==0){
TextColor(0,0,0);
SetFont( GetIniInt(sect,"fontsize",FontSize,IniName)+4, "MS ゴシック", 128, 0, 0, 0, 800 );
TextWrite(SubStr(text,3,StrLen(text)-3),mp,x+1,y-1);
TextColor(0,50,200);
//SetFont( GetIniInt(sect,"fontsize",FontSize,IniName)+4, "MS ゴシック", 128, 0, 0, 0, 800 );
TextWrite(SubStr(text,3,StrLen(text)-3),mp,x,y-2);
y=y+4;
TextColor(0,0,95);
SetFont(GetIniInt(sect,"fontsize",FontSize,IniName),GetIniInt(sect,"fontname",BaseFont,IniName),128, 0, 0, 0, 400);
}else{
TextWrite(text,mp,x,y);
}
y=y+FontSize+3;
}
}