; blue crystal #define TITLESTR "Blue Crystal v0.04Beta" ;タイトル登録 title TITLESTR ;メモリ確保 sndload "domn.wav",0,0 sndload "kin.wav",1,0 sndload "bit.wav",2,0 sndload "warp.wav",3,0 sndload "kirakira.wav",4,0 ; mci "open tk_g01.mid alias bgm" sdim mapdata,16000 sdim stagedata,145 sdim stagestr,128,100 sdim sdtname,256 sdim editer,18 sdim editer_addr,66 sdim sdtname_real,256 dim clear_flag,100 sdim sdtname_real,256 sdim menustr,256,4 alloc filelist,10000 dim shut,200 dim dx,4 dim dy,4 dx = 0,-1,1,0 dy = 1,0,0,-1 ;画面初期化 screen 0,640,390,1 picload "char.bmp",1 color 0,0,0 boxf 0,0,640,390 gmode 1 buffer 2,640,390,1 picload "char.bmp",1 color 0,0,0 boxf 0,0,640,390 gmode 1 buffer 3,256,256,1 picload "char.bmp",1 onexit *Quit ;変数初期化 *ValInit mapdata="" sdtname="Bc.sdt" sdtname_real="Bc.sdt" dirlist filelist,"*.sdt" files=stat fsel=0 y_pos=0 menustr="Start","Continue","Another World","Exit" ;マップ読み込み *mapload maxstage=0 stage=0 gosub *MapLoad2 if c=999 : goto *ValInit b="" : getstr b,mapdata,a,'\n' a += strsize ;タイトル *TitleDisp gsel 0,1 color 0,0,0 boxf 0,0,640,390 color 0,128,255 line 180,156,440,156 if maxstage!0 : y_pos=1 : menustr.1="Continue ["+stage+"]" repeat 34,1 pos 200,120+35-cnt gcopy 3,0,96,230,cnt await 15 loop color 84,110,110 font "arial",16,1 pos 170,360 mes TITLESTR+" (c) Dateshim 1999." font "MS ゴシック",14,0 color 200,200,180 pos 300,155 if sdtname!"Bc.sdt" : mes "Another World By "+editer : menustr.0="Start ["+sdtname+"]" :else : menustr.0="Start" font "MS 明朝",30,0 color 128,128,144 repeat 4 if (files=0)&(cnt=2) : continue pos 240,40*cnt+180 mes menustr.cnt loop font "MS 明朝",30,0 *MenuLoop await 1 stick a if a&16 : goto *MenuSel if a&32 : goto *MenuSel if a&128 : end redraw 0 color 0,0,0 boxf 200,40*y_pos+180,500,40*y_pos+212 pos 240,40*y_pos+180 color 128,128,144 mes menustr.y_pos if a&1 : if (stage>1)&(y_pos=1) : stage-- : menustr.1="Continue ["+stage+"]" if a&4 : if (stage=b : break loop y_pos=0 : stage=0 : maxstage=0 : menustr.1="Continue" : redraw 1 goto *MapLoad *MenuSel snd 1 redraw 1 pos 240,40*y_pos+180 color 204,255,255 mes menustr.y_pos repeat 3,1 pos 200,40*y_pos+180 gcopy 3,(cnt\3)*32,64,32,32 wait 5 loop if (y_pos=2) : dialog "sdt",16,"BlueCrystal StageFile" : if stat : goto *SelFile : else : goto *MenuLoop wait 50 if y_pos=3 : end if (stage=0)|(y_pos=0) : stage=1 if (y_pos=1)&(stage>maxstage) : gosub *CheckPass : if a=0 : y_pos=0 : menustr.1="Continue" : stage=0 : goto *TitleDisp gsel 0,1 color 0,0,0 boxf 0,0,640,390 gosub *ScrInit ;面・変数初期化 *StageInit if maxstagelimstage : goto *Ending goto *StageInit ;ギブアップルーチン *GiveUP ; mci "stop bgm" snd 2 x_gpos=90 : col=0xffffff :tmpstr="Give up!" gosub *StrDisp2 wait 200 gosub *StrDisp2R left-- : if left=0 : goto *GameOver goto *StageRestart ;ミスルーチン *Miss ; mci "stop bgm" snd 2 x_gpos=126 : col=0xffffff :tmpstr="Miss!!" gosub *StrDisp2 wait 200 gosub *StrDisp2R left-- : if left=0 : goto *GameOver goto *StageRestart ;タイムアウトルーチン *TimeOut ; mci "stop bgm" snd 2 x_gpos=90 : col=0xffffff :tmpstr="Time out!" gosub *StrDisp2 wait 200 gosub *StrDisp2R left-- : if left=0 : goto *GameOver goto *StageRestart ;各種表示ルーチン *ShutOut gsel 0,0 repeat 200 shut.cnt=-1 loop repeat 200,0 a=0 : rnd a,200 if shut.a!-1 : continue cnt shut.a=cnt loop color 20,20,20 repeat 40,0 redraw 1 a=cnt*5 repeat 5,0 line 0,shut.a*2,390,shut.a*2 line 0,shut.a*2+1,390,shut.a*2+1 a++ loop redraw 0 await 20 loop gsel 0,0:color 255,255,255:redraw 1:gmode 1 return *MapDisp gsel 0,0 redraw 0 repeat 12 y_count=cnt repeat 12 x_count=cnt x_gpos=x_count*32 y_gpos=y_count*32 pos x_gpos,y_gpos peek a,stagedata,y_count*12+x_count if (a=4) : a=0 gcopy 3,32*(a\8),32,32,32 loop loop return *CharDisp gsel 0,0 redraw 0 x_gpos=x_pos*32 : y_gpos=y_pos*32 pos x_gpos,y_gpos gmode 1 gcopy 3,0,32,32,32 pos x_gpos,y_gpos gmode 2 gcopy 3,64*dir+(32*mot),0,32,32 x_gpos=x_cpos*32 : y_gpos=y_cpos*32 pos x_gpos,y_gpos gmode 1 gcopy 3,0,32,32,32 pos x_gpos,y_gpos gmode 2 gcopy 3,128,32,32,32 gmode 1 redraw 1 return *StatDisp gsel 0,0 redraw 0 color 0,0,0 boxf 565,70,620,102 boxf 560,125,620,157 boxf 460,310,620,342 font "Century",30,0 color 200,200,200 pos 565,70 mes ""+stage pos 560,125 gcopy 3,32*grav+192,32,32,32 if left<2 : return repeat left-1 pos 35*cnt+460,310 gcopy 3,0,0,32,32 loop redraw 1 return *TimeDisp gsel 0,0 redraw 0 pos 456,222 gcopy 3,14,185,160,26 pos 456,222 gcopy 3,14,140,160*time/120,26 redraw 1 return *ScrInit gsel 0,0 redraw 0 pos 400,20 gcopy 3,0,96,230,35 color 96,96,144 font "Century",30,0 pos 430,70 mes "Stage:" pos 430,120 mes "Gravity:" pos 430,170 mes "Time:" pos 430,270 mes "Left:" pos 440,210 gcopy 3,0,173,196,50 color 100,100,100 font "arial",16,1 pos 440,360 mes "(c) Dateshim 1999." return *CheckPass screen 7,200,40,0 cls 4 title "パスワードを入れてください" pos 20,8 password="" input password,120,24 pos 140,8 : objsize 40,24 button "OK",*PassINP a=0 : objsend 0,$c5,4,a,1 *PassLoop wait 1 stick a:if a&32 : goto *PassINP goto *PassLoop *PassINP b=0 : c=0 strlen a,sdtname repeat a peek c,sdtname,cnt if (c>='A')&(c<='Z') : c-= 32 b=b*5+c loop randomize b int password : a=0 if maxstage=0 : stage=limstage repeat stage,1 rnd b,10000 if b=password : a=1 : stage=cnt : break loop gsel 7,-1 return ;ゲームオーバールーチン *Quit ; mci "stop bgm" ; mci "close bgm" end ;ゲームオーバールーチン *GameOver ; mci "stop bgm" gosub *ShutOut x_gpos=90 : col=0xff0000 :tmpstr="Game Over" gosub *StrDisp2 b=0 : c=0 strlen a,sdtname repeat a peek c,sdtname,cnt if (c>='A')&(c<='Z') : c-= 32 b=b*5+c loop randomize b repeat stage rnd a,10000 loop str a,4 color 100,100,0 font "Century",30,0 pos 150,300 mes "PassWord = "+a *KeyIn wait 1 stick b if b=0 : goto *KeyIn goto *TitleDisp ;エンディング *Ending wait 100 gosub *ShutOut repeat 15,11 palfade cnt*10+5 redraw 1 wait 1 loop redraw 0 palfade 0 color 0,0,0 boxf 0,0,640,400 font "century",50,1 color 80,80,180 pos 190,148 mes "All Clear!!" pos 210,116 gcopy 3,0,96,224,32 repeat 21,1 palfade 255-(cnt*10) redraw 1 wait 1 loop palfade 20 wait 500 gosub *ScrollAll gosub *ScrollAll font "arial",30,0 color 180,180,230 pos 210,300 : text 20 mes "Congratulations!" gosub *Scroll gosub *Scroll color 180,230,230 pos 170,300 mes "Blue Crystal -STAFF-" gosub *Scroll wait 500 gosub *Scroll color 180,180,180 pos 200,300 mes "Program&Sound" gosub *Scroll pos 310,300 mes "Dateshim" wait 300 gosub *Scroll gosub *Scroll pos 200,300 mes "Test player" gosub *Scroll pos 310,300 mes "Eririn" wait 100 pos 310,300 mes "Kiki" wait 100 gosub *Scroll pos 310,300 mes "Mr. Aiba" wait 100 gosub *Scroll pos 310,300 mes "Mr. Sakuraba" wait 500 gosub *Scroll gosub *Scroll pos 200,300 mes "Stage Data" gosub *Scroll font "MS ゴシック",30,1 pos 310,300 mes editer wait 100 gosub *Scroll pos 310,300 mes "("+editer_addr+")" wait 250 gosub *Scroll gosub *Scroll gosub *Scroll gosub *Scroll gosub *Scroll wait 50 color 255,255,255 pos 80,300 mes "Thank you for your playing!" gosub *Scroll pos 190,300 mes "Push space key." gosub *Scroll stage=0 : maxstage=0 : y_pos=0 : text 0 palfade 0 goto *KeyIn *Scroll repeat 20 redraw 0 pos 20,148 gcopy 0,20,150,600,210 await 10 redraw 1 loop return *ScrollAll repeat 10 redraw 0 pos 20,36 gcopy 0,20,40,600,310 await 10 redraw 1 loop return ;マップ読み込み *MapLoad2 stage=0 bload sdtname_real,mapdata getstr a,mapdata : if a="[BC_STAGE_DATA]" : goto *NewLoad a=0 : instr a,mapdata,"stage=" b="" : getstr b,mapdata,(a+6) a += strsize+6 int b : limstage=b if (limstage<1)|(limstage>100) : dialog "ファイルが不正です",1,"読み込みエラー" : goto *LoadERR d = 0 : c = 0 repeat limstage b="" : getstr b,mapdata,a a += strsize stagestr.cnt=b repeat 12 b="" : getstr b,mapdata,a a += strsize repeat 12 peek c,b,cnt c-='0' if (c<0)|(c>0x0c) : dialog "ファイルが不正です",1,"読み込みエラー" : c=999 : break poke mapdata,d,c : d++ loop if c=999 : break loop if c=999 : break loop if c=999 : goto *LoadERR b="" : getstr b,mapdata,a,'\n' a += strsize editer=b stage=1 return *NewLoad getstr a,mapdata,23 : int a : limstage=a getstr editer,mapdata,35 getstr editer_addr,mapdata,58 getstr a,mapdata,128 : int a : map_ver=a c=0:a=0 repeat 144,0 peek a,mapdata,cnt c=c+a loop randomize c a=0 : b=0 : d=limstage*144+111 repeat d,144 peek a,mapdata,cnt rnd b,256 b=b^a poke mapdata,cnt,b loop repeat 100 peek a,mapdata,limstage*144+155+cnt clear_flag.cnt=a loop c=0 repeat limstage*144,144 peek a,mapdata,cnt poke mapdata,cnt-144,a c+=a loop b=0 peek a,mapdata,limstage*144+144 b+=a peek a,mapdata,limstage*144+145 b+=a*256 peek a,mapdata,limstage*144+146 b+=a*256*256 if c=b : stage=1 : return *LoadERR dialog "データが不正です!",1,"エラー" c=999 return