📄 kota43b.pas
字号:
destructor TSTG.Destroy;
var
iii : Integer;
ff : FILE;
begin
//HiScore偺婰榐
if (DiskFree(0) > 1024)then
begin
assignfile(ff,'hisc.scr');
ReWrite(ff,1);
blockWrite(ff,SCR,600);
closefile(ff);
end;
//AL.SaveBlendTable('BlendDat.btd');
for iii := 0 to 40 do
if (IB[iii].Empty = True)then
begin
IB[iii].img.free;
if (IB[iii].maskEmpty = True)then IB[iii].msk.free;
end;
for iii := 0 to 20 do
if (SB[iii].Empty = True)then SB[iii].WAVData.Free;
STBack.Free;
Pbank.Free;
ENSBit.Free;
BHPBIt.Free;
Layer.Free;
BackGround.free;
BackBuf.free;
TempBuf.Free;
playchar.free;
end;
procedure TSTG.MoveFlash;
var
iii : Integer;
begin
for iii := 0 to 9 do BOD[iii].Hit := 0;
for iii := 0 to 50 do ED[iii].Hit := 0;
end;
procedure TSTG.PutBackFace(src : TDDDDSurFace;x,y : Integer;
rd : Trect; opt : Byte);
var
DDOP : Longint;
begin
DDOP := 0;
if (DDFLG = 1)then DDOP := DDBLTFAST_WAIT;
case opt of
0 : BackBuf.BltFast(src,x,y,rd,DDBLTFAST_SRCCOLORKEY or DDOP); //摟夁
1 : BackBuf.BltFast(src,x,y,rd,DDBLTFAST_NOCOLORKEY or DDOP);
2 : AL.Blend(BackBuf,x,y,src,rd,BM_SCREEN);
end;
end;
procedure TSTG.SurFaceClear(src : TDDDDSurFace; Color : LongInt);
var
fx:DDBLTFX;
rc : TRect;
begin
with rc do
begin
top:=0;
left:=0;
right:=Src.Width;
bottom:=Src.Height;
end;
ZeroMemory(@fx,sizeof(DDBLTFX));
fx.dwFillColor := 0;
fx.dwSize:=sizeof(DDBLTFX);
fx.dwFillColor := color;
src.surface.Blt(rc,nil,rc, //偙偆偟側偄偲徚偣側偄偧
DDBLT_COLORFILL or DDBLT_WAIT,fx);
end;
function TSTG.PlayerLong(x,y : Integer) : Integer;
begin
PlayerLong := abs(PD[0].x-x)+abs(PD[0].y-y);
end;
procedure TSTG.PlaySTG;
begin
MoveFlash;
MoveBackGround;
MoveStage;
MovePlayerShot;
if ((PD[0].HP < 1) and(PD[0].empty=True))then PlayerDestroy;
MoveEnemy;
if (BOD[0].HP < 1)then BossDestroy(BOD[0].Kind)
else MoveBoss;
MoveEnemyShot;
EnemyHit;
BossHit;
MoveBom;
MoveMessage;
MovePText;
MoveEffect;
MoveItem;
//揋揰柵
FlashCount := (FlashCount + 1) mod 2;
BossFlash := (BossFlash + 1) mod 20;
//僾儗僀儎亅揰柵
PD[0].NoHit := PD[0].NoHit - 1;
if (PD[0].NoHit < 0)then PD[0].NoHit := 0;
//Player 1 Up
if ((BackScore div 500000) < (PD[0].Score div 500000))then
if (PD[0].PNo < 9)then
begin
EntrySound(12);
PD[0].PNo := PD[0].PNo + 1;
EntryPText(PD[0].x,PD[0].y-15,'PLAYER 1UP',0);
end;
BackScore := PD[0].Score;
end;
procedure TSTG.DataClear;
var
iii : Integer;
begin
for iii := 0 to 50 do ED[iii].Empty := False;
for iii := 0 to 2 do PD[iii].Empty := False;
for iii := 0 to 200 do ESD[iii].Empty := False;
for iii := 0 to 75 do PSD[iii].Empty := False;
for iii := 0 to 75 do BD[iii].Empty := False;
for iii := 0 to 75 do EFD[iii].Empty := False;
for iii := 0 to 50 do TD[iii].Empty := False;
for iii := 0 to 10 do BOD[iii].Empty := False;
for iii := 0 to 25 do ID[iii].Empty := False;
end;
procedure TSTG.DataClear2;
var
iii : Integer;
begin
for iii := 0 to 50 do ED[iii].Empty := False;
for iii := 0 to 200 do ESD[iii].Empty := False;
for iii := 0 to 75 do PSD[iii].Empty := False;
for iii := 0 to 75 do BD[iii].Empty := False;
for iii := 0 to 75 do EFD[iii].Empty := False;
for iii := 0 to 50 do TD[iii].Empty := False;
for iii := 0 to 10 do BOD[iii].Empty := False;
for iii := 0 to 25 do ID[iii].Empty := False;
MCount := 0;
SPEX := 0; SPEX2 := 0;
MaxComb := 0;
NoMiss := 30000;
end;
procedure TSTG.EnemyShotClear;
var
iii : Integer;
begin
for iii := 0 to 200 do
ESD[iii].empty := False;
end;
procedure TSTG.Masking(x1,x2 : TBitmap);
var
Temp : TBitmap;
begin
Temp := TBitmap.Create;
Temp.assign(x1);
Temp.Mask( x1.canvas.Pixels[0,0] or $02000000 );
x2.assign(Temp);
Temp.free;
end;
//暥帤傪彂偔
procedure TSTG.DrawFont(x,y : Integer; mes : string; opt : Byte);
var
iii,www,aaa : Integer;
sss : string;
begin
www := Length(mes);
for iii := 0 to www-1 do
begin
StrMid1(sss,mes,iii+1,1);
if (opt = 3)then aaa := AnsiPos(sss,'0123456789xABCDEFGHIJKLMNOPQRSTUVWXYZ %')
else aaa := AnsiPos(sss,'0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ (-+');
if (aaa = 0)then aaa := 1;
case opt of
0,1,2 : DrawBank((x-www*8)+iii*16+8,y,aaa,opt+1,28,0);
3 : DrawBank((x-www*4)+iii*8+4,y,aaa,1,27,0);
end;
end;
end;
//ImageBank丒夋憸娭楢---------------------
procedure TSTG.EntryBank(FileName : string;
w,h, c,r, No : Integer; mask,mem : boolean);
var
Height,Width : Integer;
temp : TBitmap;
begin
//File偑側偄傛
if (FileExists(FileName) = False)then begin ErrorCode := 255; exit; end;
temp := TBitmap.Create;
temp.LoadFromFile(FileName);
if (IB[No].Empty = True)then
begin
IB[No].img.free;
if (IB[No].maskEmpty = True)then IB[No].msk.free;
end;
IB[No].Empty := True;
Width := temp.width;
Height := temp.height;
if (mem = true)then IB[No].Img := TDDDDSurFace.Create(DD,width,height,0)
else IB[No].Img := TDDDDSurFace.CreateOnSystemMemory(DD,width,height,0);
IB[No].Img.LoadBMP(FileName);
IB[No].maskEmpty := False;
if (mask = True)then //昁梫側帪偩偗惗惉偟偰Memory愡栺
begin
IB[No].maskEmpty := True;
IB[No].Msk := TDDDDSurFace.Create(DD,width,height,0);
IB[No].Msk.LoadBMP(FileName);
MaskColor(IB[No].Msk,rect(0,0,width,height),44,0);
//AL.BlendRect(IB[No].Msk,rect(0,0,width,height),42,BM_SCREEN);
end;
IB[No].width := w; //侾僙儖偺墶暆
IB[No].Height := h;
IB[No].col := c; //墶悢
IB[No].Row := r; //廲悢
temp.free;
end;
procedure TSTG.DrawBank(x,y : Integer;
c,r, No,opt : Byte);
var
aaa,ac,ar : Byte;
begin
ac := c; ar := r;
if ((IB[No].Width * ac) > 640)then
begin ac := ac - (640 div IB[No].Width); ar := ar + 1; end;
aaa := opt;
if ((IB[No].maskEmpty = false)and(aaa = 1))then aaa := 0;
case aaa of
0 : PutBackFace(IB[no].img,x - (IB[No].Width div 2),
y - (IB[No].Height div 2),
rect((ac-1)*IB[No].Width,(ar-1)*IB[No].Height,
ac*IB[No].Width,ar*IB[No].Height),0);
2: PutBackFace(IB[no].img,x - (IB[No].Width div 2),
y - (IB[No].Height div 2),
rect((ac-1)*IB[No].Width,(ar-1)*IB[No].Height,
ac*IB[No].Width,ar*IB[No].Height),2);
1 : PutBackFace(IB[no].msk,x - (IB[No].Width div 2),
y - (IB[No].Height div 2),
rect((ac-1)*IB[No].Width,(ar-1)*IB[No].Height,
ac*IB[No].Width,ar*IB[No].Height),0);
3 : PutBackFace(IB[no].img,x - (IB[No].Width div 2),
y - (IB[No].Height div 2),
rect((ac-1)*IB[No].Width,(ar-1)*IB[No].Height,
ac*IB[No].Width,ar*IB[No].Height),1);
4 : AL.Blend(BackBuf,x - (IB[No].Width div 2),
y - (IB[No].Height div 2),
IB[no].img,
rect((ac-1)*IB[No].Width,(ar-1)*IB[No].Height,
ac*IB[No].Width,ar*IB[No].Height),BM_SCREEN);
5 : AL.Blend(BackBuf,x - (IB[No].Width div 2),
y - (IB[No].Height div 2),
IB[no].img,
rect((ac-1)*IB[No].Width,(ar-1)*IB[No].Height,
ac*IB[No].Width,ar*IB[No].Height),BM_NORMAL);
11..25 :
AL.AlphBlend(BackBuf,x - (IB[No].Width div 2),
y - (IB[No].Height div 2),
IB[no].img,
rect((ac-1)*IB[No].Width,(ar-1)*IB[No].Height,
ac*IB[No].Width,ar*IB[No].Height),(aaa-10)*16,BM_NORMAL);
31..45 :
AL.AlphBlend(BackBuf,x - (IB[No].Width div 2),
y - (IB[No].Height div 2),
IB[no].img,
rect((ac-1)*IB[No].Width,(ar-1)*IB[No].Height,
ac*IB[No].Width,ar*IB[No].Height),(aaa-30)*16,BM_SCREEN);
end;
end;
//岠壥壒僶儞僋娭學--------------------
procedure TSTG.EntrySoundBank(FileName : String;
OutPut,No : Byte);
begin
SB[No].FileName := FileName;
SB[No].OutPut := OutPut;
SB[No].Empty := True;
SB[No].WAVData :=TDDSDWaveData.Create(DS,FileName);
end;
procedure TSTG.EntrySound(No : Byte);
begin
SB[No].Play := True;
end;
procedure TSTG.PlaySE;
var
iii : Integer;
begin
for iii := 0 to 20 do
begin
if ((SB[iii].PLAY = True) and (SB[iii].Empty = True))then
begin
//WAVData偺揔梡
if (DSoundNo[SB[iii].OutPut] <> iii)then
begin
DSoundNo[SB[iii].OutPut] := iii;
DS.Channels[SB[iii].OutPut].WaveData := SB[iii].WAVData;
end;
DSoundPlay[SB[iii].OutPut] := True;
end;
end;
//WAV Ply
for iii := 0 to 7 do
if ((DSoundPlay[iii] = True)and(SEOff = 0))then
begin
DS[iii].Volume := - WaveVolume * 100;
DS[iii].Play;
end;
for iii := 0 to 20 do
SB[iii].Play := False;
for iii := 0 to 7 do
DSoundPlay[iii] := False;
end;
//僾儗僀儎亅抏偺張棟------------------
//memo
//
procedure TSTG.EntryPlayerShot(x,y,ax,ay,h1,h2,h3,h4 : SmallInt;
kind,pw : Byte);
var
iii : Integer;
begin
iii := 0;
while ((PSD[iii].Empty = True) and (iii<75))do iii := iii + 1;
if (iii = 75)then iii := AL.Rnd(50);
PSD[iii].Empty := True;
PSD[iii].x := x;
PSD[iii].y := y;
PSD[iii].x1 := ax;
PSD[iii].y1 := ay;
PSD[iii].h1 := h1; PSD[iii].h2 := h2;
PSD[iii].h3 := h3; PSD[iii].h4 := h4;
PSD[iii].a1 := 0;
PSD[iii].a2 := 0;
PSD[iii].a3 := 0;
PSD[iii].kind := kind;
PSD[iii].Power := pw;
PSD[iii].HitNo := 0;
end;
procedure TSTG.MovePlayerShot;
var
iii : Integer;
begin
for iii := 0 to 75 do
begin
if (PSD[iii].Empty = True)then
begin
with PSD[iii] do
begin
x := x + x1; y := y + y1;
if ((x<-10) or (x>310))then Empty := False;
if ((y<-10) or (y>310))then Empty := False;
with PSD[iii] do
case kind of
1,2,3 : begin
a3 := 3; //昞帵僶儞僋No
a1 := kind;
end;
4 : begin //堏摦僫僷亅儉
a3 := 5;
a2 := a2 + 1;
a1 := (a2 mod 16)+1;
if (a2 = 12)then
begin
x1 := 0; y1 := 0;
EntryEffect(x,y,0,0,3);
EntryEffect(x,y,0,0,3);
end;
if (a2 > 47)then Empty := False;
end;
5 : begin //BOM梡僫僷亅儉
a3 := 5;
a2 := a2 + 1;
a1 := a2 mod 2 + 1;
EntryPlayerShot(x,y,0,0, 0,0,45,45,4,power);
end;
10 : begin //儗亅僓亅
a3 := a3 + 1;
if (a3 > 1)then Empty := False;
end;
end;
end;
end;
end;
end;
//敋敪丒敋墛偺張棟-----------------------------
procedure TSTG.EntryBom(x,y,ax,ay : SmallInt;
kind : Byte);
var
iii : Integer;
begin
iii := 0;
while ((BD[iii].Empty = True) and (iii<75))do iii := iii + 1;
BD[iii].Empty := True;
BD[iii].x := x;
BD[iii].y := y;
BD[iii].x1 := ax;
BD[iii].y1 := ay;
BD[iii].a1 := 0;
BD[iii].a2 := 0;
BD[iii].a3 := 0;
BD[iii].kind := kind;
end;
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -