?? magiceff.pas
字號:
steptime := GetTickCount;
Inc (curframe);
if curframe > start+frame-1 then begin
curframe := start+frame-1;
if RepeatCount > 0 then begin
Dec (RepeatCount);
curframe := start;
end else
Result := FALSE;
end;
end;
end;
procedure TMapEffect.DrawEff (surface: TDirectDrawSurface);
var
d: TDirectDrawSurface;
begin
Rx := TargetX;
Ry := TargetY;
PlayScene.ScreenXYfromMCXY (Rx, Ry, FlyX, FlyY);
d := ImgLib.GetCachedImage (EffectBase + curframe, px, py);
if d <> nil then begin
DrawBlend (surface,
FlyX + px - UNITX div 2,
FlyY + py - UNITY div 2,
d, 1);
end;
end;
{--------------------------------------------------------}
constructor TScrollHideEffect.Create (effbase, effframe: integer; x, y: integer; target: TObject);
begin
inherited Create (effbase, effframe, x, y);
TargetCret := TActor(target);
end;
function TScrollHideEffect.Run: Boolean;
begin
Result := inherited Run;
if frame = 7 then
if TargetCret <> nil then
PlayScene.DeleteActor (TargetCret.RecogId);
end;
{--------------------------------------------------------}
constructor TLightingEffect.Create (effbase, effframe: integer; x, y: integer);
begin
end;
function TLightingEffect.Run: Boolean;
begin
end;
{--------------------------------------------------------}
constructor TFireGunEffect.Create (effbase, sx, sy, tx, ty: integer);
begin
inherited Create (111, effbase,
sx, sy,
tx, ty, //TActor(target).XX, TActor(target).YY,
mtFireGun,
TRUE,
0);
NextFrameTime := 50;
FillChar (FireNodes, sizeof(TFireNode)*FIREGUNFRAME, #0);
OutofOil := FALSE;
firetime := GetTickCount;
end;
function TFireGunEffect.Run: Boolean;
var
i, fx, fy: integer;
allgone: Boolean;
begin
Result := TRUE;
if GetTickCount - steptime > longword(NextFrameTime) then begin
Shift;
steptime := GetTickCount;
//if not FixedEffect then begin //格釬俊 嘎瘤 臼疽欄擱
if not OutofOil then begin
if (abs(RX-TActor(MagOwner).RX) >= 5) or (abs(RY-TActor(MagOwner).RY) >= 5) or (GetTickCount - firetime > 800) then
OutofOil := TRUE;
for i:=FIREGUNFRAME-2 downto 0 do begin
FireNodes[i].FireNumber := FireNodes[i].FireNumber + 1;
FireNodes[i+1] := FireNodes[i];
end;
FireNodes[0].FireNumber := 1;
FireNodes[0].x := FlyX;
FireNodes[0].y := FlyY;
end else begin
allgone := TRUE;
for i:=FIREGUNFRAME-2 downto 0 do begin
if FireNodes[i].FireNumber <= FIREGUNFRAME then begin
FireNodes[i].FireNumber := FireNodes[i].FireNumber + 1;
FireNodes[i+1] := FireNodes[i];
allgone := FALSE;
end;
end;
if allgone then Result := FALSE;
end;
end;
end;
procedure TFireGunEffect.DrawEff (surface: TDirectDrawSurface);
var
i, num, shx, shy, firex, firey, prx, pry, img: integer;
d: TDirectDrawSurface;
begin
prx := -1;
pry := -1;
for i:=0 to FIREGUNFRAME-1 do begin
if (FireNodes[i].FireNumber <= FIREGUNFRAME) and (FireNodes[i].FireNumber > 0) then begin
shx := (Myself.RX*UNITX + Myself.ShiftX) - FireMyselfX;
shy := (Myself.RY*UNITY + Myself.ShiftY) - FireMyselfY;
img := EffectBase + (FireNodes[i].FireNumber - 1);
d := ImgLib.GetCachedImage (img, px, py);
if d <> nil then begin
firex := FireNodes[i].x + px - UNITX div 2 - shx;
firey := FireNodes[i].y + py - UNITY div 2 - shy;
if (firex <> prx) or (firey <> pry) then begin
prx := firex;
pry := firey;
DrawBlend (surface, firex, firey, d, 1);
end;
end;
end;
end;
end;
{--------------------------------------------------------}
constructor TThuderEffect.Create (effbase, tx, ty: integer; target: TObject);
begin
inherited Create (111, effbase,
tx, ty,
tx, ty, //TActor(target).XX, TActor(target).YY,
mtThunder,
FALSE,
0);
TargetActor := target;
end;
procedure TThuderEffect.DrawEff (surface: TDirectDrawSurface);
var
img, px, py: integer;
d: TDirectDrawSurface;
begin
img := EffectBase;
d := ImgLib.GetCachedImage (img + curframe, px, py);
if d <> nil then begin
DrawBlend (surface,
FlyX + px - UNITX div 2,
FlyY + py - UNITY div 2,
d, 1);
end;
end;
{--------------------------------------------------------}
constructor TLightingThunder.Create (effbase, sx, sy, tx, ty: integer; target: TObject);
begin
inherited Create (111, effbase,
sx, sy,
tx, ty, //TActor(target).XX, TActor(target).YY,
mtLightingThunder,
FALSE,
0);
TargetActor := target;
end;
procedure TLightingThunder.DrawEff (surface: TDirectDrawSurface);
var
img, sx, sy, px, py, shx, shy: integer;
d: TDirectDrawSurface;
begin
img := EffectBase + Dir16 * 10;
if curframe < 6 then begin
shx := (Myself.RX*UNITX + Myself.ShiftX) - FireMyselfX;
shy := (Myself.RY*UNITY + Myself.ShiftY) - FireMyselfY;
d := ImgLib.GetCachedImage (img + curframe, px, py);
if d <> nil then begin
PlayScene.ScreenXYfromMCXY (TActor(MagOwner).RX,
TActor(MagOwner).RY,
sx,
sy);
DrawBlend (surface,
sx + px - UNITX div 2,
sy + py - UNITY div 2,
d, 1);
end;
end;
{if (curframe < 10) and (TargetActor <> nil) then begin
d := ImgLib.GetCachedImage (EffectBase + 17*10 + curframe, px, py);
if d <> nil then begin
PlayScene.ScreenXYfromMCXY (TActor(TargetActor).RX,
TActor(TargetActor).RY,
sx,
sy);
DrawBlend (surface,
sx + px - UNITX div 2,
sy + py - UNITY div 2,
d, 1);
end;
end;}
end;
{--------------------------------------------------------}
constructor TExploBujaukEffect.Create (effbase, sx, sy, tx, ty: integer; target: TObject);
begin
inherited Create (111, effbase,
sx, sy,
tx, ty,
mtExploBujauk,
TRUE,
0);
frame := 3;
TargetActor := target;
NextFrameTime := 50;
end;
procedure TExploBujaukEffect.DrawEff (surface: TDirectDrawSurface);
var
img: integer;
d: TDirectDrawSurface;
shx, shy: integer;
meff: TMapEffect;
begin
if Active and ((Abs(FlyX-fireX) > 30) or (Abs(FlyY-fireY) > 30) or FixedEffect) then begin
shx := (Myself.RX*UNITX + Myself.ShiftX) - FireMyselfX;
shy := (Myself.RY*UNITY + Myself.ShiftY) - FireMyselfY;
if not FixedEffect then begin
//朝酒啊綽芭
img := EffectBase + Dir16 * 10;
d := ImgLib.GetCachedImage (img + curframe, px, py);
if d <> nil then begin
//舅頗喉琺爹竅瘤 臼瀾
surface.Draw (FlyX + px - UNITX div 2 - shx,
FlyY + py - UNITY div 2 - shy,
d.ClientRect, d, TRUE);
end;
end else begin
//氣慣
img := MagExplosionBase + curframe;
d := ImgLib.GetCachedImage (img, px, py);
if d <> nil then begin
DrawBlend (surface,
FLyX + px - UNITX div 2,
FlyY + py - UNITY div 2,
d, 1);
end;
end;
end;
end;
{--------------------------------------------------------}
constructor TBujaukGroundEffect.Create (effbase, magicnumb, sx, sy, tx, ty: integer);
begin
inherited Create (111, effbase,
sx, sy,
tx, ty,
mtBujaukGroundEffect,
TRUE,
0);
frame := 3;
MagicNumber := magicnumb;
BoGroundEffect := FALSE;
NextFrameTime := 50;
end;
function TBujaukGroundEffect.Run: Boolean;
begin
Result := inherited Run;
if not FixedEffect then begin
if ((abs(TargetX-FlyX) <= 15) and (abs(TargetY-FlyY) <= 15)) or
((abs(TargetX-FlyX) >= prevdisx) and (abs(TargetY-FlyY) >= prevdisy)) then begin
FixedEffect := TRUE; //氣慣
start := 0;
frame := ExplosionFrame;
curframe := start;
Repetition := FALSE;
//磐瘤綽 葷款靛
PlaySound (TActor(MagOwner).magicexplosionsound);
Result := TRUE;
end else begin
prevdisx := abs(TargetX-FlyX);
prevdisy := abs(TargetY-FlyY);
end;
end;
end;
procedure TBujaukGroundEffect.DrawEff (surface: TDirectDrawSurface);
var
img: integer;
d: TDirectDrawSurface;
shx, shy: integer;
meff: TMapEffect;
begin
if Active and ((Abs(FlyX-fireX) > 30) or (Abs(FlyY-fireY) > 30) or FixedEffect) then begin
shx := (Myself.RX*UNITX + Myself.ShiftX) - FireMyselfX;
shy := (Myself.RY*UNITY + Myself.ShiftY) - FireMyselfY;
if not FixedEffect then begin
//朝酒啊綽芭
img := EffectBase + Dir16 * 10;
d := ImgLib.GetCachedImage (img + curframe, px, py);
if d <> nil then begin
//舅頗喉琺爹竅瘤 臼瀾
surface.Draw (FlyX + px - UNITX div 2 - shx,
FlyY + py - UNITY div 2 - shy,
d.ClientRect, d, TRUE);
end;
end else begin
//氣慣
if MagicNumber = 11 then //付
img := EffectBase + 16 * 10 + curframe
else //規
img := EffectBase + 18 * 10 + curframe;
d := ImgLib.GetCachedImage (img, px, py);
if d <> nil then begin
DrawBlend (surface,
FLyX + px - UNITX div 2, // - shx,
FlyY + py - UNITY div 2, // - shy,
d, 1);
end;
{if not BoGroundEffect and (curframe = 8) then begin
BoGroundEffect := TRUE;
meff := TMapEffect.Create (img+2, 6, TargetRx, TargetRy);
meff.NextFrameTime := 100;
//meff.RepeatCount := 1;
PlayScene.GroundEffectList.Add (meff);
end; }
end;
end;
end;
end.
?? 快捷鍵說明
復制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號
Ctrl + =
減小字號
Ctrl + -