📄 playscn.pas
字号:
i, j, light, defx, defy, lx, ly, lxx, lyy, lcount: integer;
begin
defx := -UNITX*2 + AAX + 14 - g_MySelf.m_nShiftX;
defy := -UNITY*3 - g_MySelf.m_nShiftY;
lcount := 0;
for i:=1 to LMX-1 do
for j:=1 to LMY-1 do begin
light := m_LightMap[i, j].light;
if light >= 0 then begin
lx := (i + g_MySelf.m_nRx - LMX div 2);
ly := (j + g_MySelf.m_nRy - LMY div 2);
lxx := (lx-Map.m_ClientRect.Left)*UNITX + defx + m_LightMap[i, j].ShiftX;
lyy := (ly-Map.m_ClientRect.Top)*UNITY + defy + m_LightMap[i, j].ShiftY;
FogCopy (m_Lights[light].PFog,
0,
0,
m_Lights[light].Width,
m_Lights[light].Height,
m_PFogScreen,
lxx - (m_Lights[light].Width-UNITX) div 2,
lyy - (m_Lights[light].Height-UNITY) div 2 - 5,
m_nFogWidth,
m_nFogHeight,
20);
inc (lcount);
end;
end;
end;
procedure TPlayScene.DrawLightEffect (lx, ly, bright: integer);
begin
if (bright > 0) and (bright <= MAXLIGHT) then
FogCopy (m_Lights[bright].PFog,
0,
0,
m_Lights[bright].Width,
m_Lights[bright].Height,
m_PFogScreen,
lx - (m_Lights[bright].Width-UNITX) div 2,
ly - (m_Lights[bright].Height-UNITY) div 2,
m_nFogWidth,
m_nFogHeight,
15);
end;
{-----------------------------------------------------------------------}
procedure TPlayScene.DrawMiniMap (surface: TDirectDrawSurface);
var
d: TDirectDrawSurface;
v: Boolean;
mx, my,nx,ny, i: integer;
rc: TRect;
actor:TActor;
x,y:integer;
btColor:Byte;
begin
if GetTickCount > m_dwBlinkTime + 300 then begin
m_dwBlinkTime := GetTickCount;
m_boViewBlink := not m_boViewBlink;
end;
if g_nMiniMapIndex < 0 then exit; //Jacky
d := g_WMMapImages.Images[g_nMiniMapIndex];
if d = nil then exit;
mx := (g_MySelf.m_nCurrX*48) div 32;
my := (g_MySelf.m_nCurrY*32) div 32;
rc.Left := _MAX(0, mx-60);
rc.Top := _MAX(0, my-60);
rc.Right := _MIN(d.ClientRect.Right, rc.Left + 120);
rc.Bottom := _MIN(d.ClientRect.Bottom, rc.Top + 120);
if g_nViewMinMapLv = 1 then
DrawBlendEx (surface, (SCREENWIDTH-120), 0, d, rc.Left, rc.Top, 120, 120, 0)
else surface.Draw ((SCREENWIDTH-120), 0, rc, d, FALSE);
//雷达
if not m_boViewBlink then exit;
mx := (SCREENWIDTH-120) + (g_MySelf.m_nCurrX * 48) div 32 - rc.Left;
my := (g_MySelf.m_nCurrY * 32) div 32 - rc.Top;
surface.Pixels[mx, my] := 255;
for nx:=g_MySelf.m_nCurrX - 10 to g_MySelf.m_nCurrX + 10 do begin
for ny:=g_MySelf.m_nCurrY - 10 to g_MySelf.m_nCurrY + 10 do begin
actor := FindActorXY(nx,ny);
if (actor <> nil) and (actor <> g_MySelf) and (not actor.m_boDeath) then begin
mx := (SCREENWIDTH-120) + (actor.m_nCurrX * 48) div 32 - rc.Left;
my := (actor.m_nCurrY * 32) div 32 - rc.Top;
case actor.m_btRace of //
50,45,12: btColor:=218;
0: btColor:=255;
else btColor:=249;
end; // case
for x:=0 to 1 do
for y:=0 to 1 do
surface.Pixels[mx+x, my+y] := btColor
end;
end;
end;
end;
{-----------------------------------------------------------------------}
procedure TPlayScene.PlayScene (MSurface: TDirectDrawSurface);
function CheckOverlappedObject (myrc, obrc: TRect): Boolean;
begin
if (obrc.Right > myrc.Left) and (obrc.Left < myrc.Right) and
(obrc.Bottom > myrc.Top) and (obrc.Top < myrc.Bottom) then
Result := TRUE
else Result := FALSE;
end;
var
i, j, k, n, m, mmm, ix, iy, line, defx, defy, wunit, fridx, ani, anitick, ax, ay, idx, drawingbottomline: integer;
DSurface, d: TDirectDrawSurface;
blend, movetick: Boolean;
//myrc, obrc: TRect;
DropItem: PTDropItem;
evn: TClEvent;
actor: TActor;
meff: TMagicEff;
msgstr: string;
ShowItem:pTShowItem;
nFColor,nBColor:Integer;
begin
drawingbottomline:=0;//jacky
if (g_MySelf = nil) then begin
msgstr := 'Please wait just for a little while.';
with MSurface.Canvas do begin
SetBkMode (Handle, TRANSPARENT);
BoldTextOut (MSurface, (SCREENWIDTH-TextWidth(msgstr)) div 2, (SCREENHEIGHT - 600) +200,
clWhite, clBlack, msgstr);
Release;
end;
exit;
end;
g_boDoFastFadeOut := FALSE;
//某腐磐俊甸俊霸 皋技瘤甫 傈崔
movetick := FALSE;
if GetTickCount - m_dwMoveTime >= 100 then begin
m_dwMoveTime := GetTickCount; //捞悼狼 悼扁拳
movetick := TRUE; //捞悼 平
Inc (m_nMoveStepCount);
if m_nMoveStepCount > 1 then m_nMoveStepCount := 0;
end;
if GetTickCount - m_dwAniTime >= 50 then begin
m_dwAniTime := GetTickCount;
Inc (m_nAniCount);
if m_nAniCount > 100000 then m_nAniCount := 0;
end;
try
i := 0; //咯扁绰 皋技瘤父 贸府窃
while TRUE do begin //Frame 贸府绰 咯扁辑 救窃.
if i >= m_ActorList.Count then break;
actor := m_ActorList[i];
if movetick then actor.m_boLockEndFrame := FALSE;
if not actor.m_boLockEndFrame then begin
actor.ProcMsg; //皋技瘤 贸府窍搁辑 actor啊 瘤况龙 荐 乐澜.
if movetick then
if actor.Move(m_nMoveStepCount) then begin //悼扁拳秦辑 框流烙
Inc (i);
continue;
end;
actor.Run; //
if actor <> g_MySelf then actor.ProcHurryMsg;
end;
if actor = g_MySelf then actor.ProcHurryMsg;
//
if actor.m_nWaitForRecogId <> 0 then begin
if actor.IsIdle then begin
DelChangeFace (actor.m_nWaitForRecogId);
NewActor (actor.m_nWaitForRecogId, actor.m_nCurrX, actor.m_nCurrY, actor.m_btDir, actor.m_nWaitForFeature, actor.m_nWaitForStatus);
actor.m_nWaitForRecogId := 0;
actor.m_boDelActor := TRUE;
end;
end;
if actor.m_boDelActor then begin
//actor.Free;
g_FreeActorList.Add (actor);
m_ActorList.Delete (i);
if g_TargetCret = actor then g_TargetCret := nil;
if g_FocusCret = actor then g_FocusCret := nil;
if g_MagicTarget = actor then g_MagicTarget := nil;
end else
Inc (i);
end;
except
DebugOutStr ('101');
end;
try
i := 0;
while TRUE do begin
if i >= m_GroundEffectList.Count then break;
meff := m_GroundEffectList[i];
if meff.m_boActive then begin
if not meff.Run then begin //付过瓤苞
meff.Free;
m_GroundEffectList.Delete (i);
continue;
end;
end;
Inc (i);
end;
i := 0;
while TRUE do begin
if i >= m_EffectList.Count then break;
meff := m_EffectList[i];
if meff.m_boActive then begin
if not meff.Run then begin //付过瓤苞
meff.Free;
m_EffectList.Delete (i);
continue;
end;
end;
Inc (i);
end;
i := 0;
while TRUE do begin
if i >= m_FlyList.Count then break;
meff := m_FlyList[i];
if meff.m_boActive then begin
if not meff.Run then begin //档尝,拳混殿 朝酒啊绰巴
meff.Free;
m_FlyList.Delete (i);
continue;
end;
end;
Inc (i);
end;
EventMan.Execute;
except
DebugOutStr ('102');
end;
try
ClearDropItem();
{
//清除超过显示范围的物品数据
for k:=0 to g_DropedItemList.Count - 1 do begin
DropItem:= PTDropItem(g_DropedItemList[k]);
if DropItem <> nil then begin
if (Abs(DropItem.x - Myself.m_nCurrX) > 30) and (Abs(DropItem.y - Myself.m_nCurrY) > 30) then begin
Dispose (PTDropItem (g_DropedItemList[k]));
g_DropedItemList.Delete (k);
break; //茄锅俊 茄俺究..
end;
end;
end;
}
//荤扼柳 促捞唱雇坷宏璃飘 八荤
for k:=0 to EventMan.EventList.Count-1 do begin
evn := TClEvent (EventMan.EventList[k]);
if (Abs(evn.m_nX-g_MySelf.m_nCurrX) > 30) and (Abs(evn.m_nY-g_MySelf.m_nCurrY) > 30) then begin
evn.Free;
EventMan.EventList.Delete (k);
break; //茄锅俊 茄俺究
end;
end;
except
DebugOutStr ('103');
end;
try
with Map.m_ClientRect do begin
{$IF SWH = SWH800}
Left := g_MySelf.m_nRx - 9;
Top := g_MySelf.m_nRy - 9;
Right := g_MySelf.m_nRx + 9; // 坷弗率 楼捧府 弊覆
Bottom := g_MySelf.m_nRy + 8;
{$ELSEIF SWH = SWH1024}
Left := g_MySelf.m_nRx - 12;
Top := g_MySelf.m_nRy - 12;
Right := g_MySelf.m_nRx + 12; //
Bottom := g_MySelf.m_nRy + 15;
{$IFEND}
end;
Map.UpdateMapPos (g_MySelf.m_nRx, g_MySelf.m_nRy);
///////////////////////
//ViewFog := FALSE;
///////////////////////
if g_boNoDarkness or (g_MySelf.m_boDeath) then begin
g_boViewFog := FALSE;
end;
if g_boViewFog then begin //器弊
ZeroMemory (m_PFogScreen, MAPSURFACEHEIGHT * MAPSURFACEWIDTH);
ClearLightMap;
end;
// drawingbottomline := 450;
drawingbottomline := SCREENHEIGHT;
m_ObjSurface.Fill(0);
DrawTileMap;
m_ObjSurface.Draw (0, 0,
Rect(UNITX*3 + g_MySelf.m_nShiftX,
UNITY*2 + g_MySelf.m_nShiftY,
UNITX*3 + g_MySelf.m_nShiftX + MAPSURFACEWIDTH,
UNITY*2 + g_MySelf.m_nShiftY + MAPSURFACEHEIGHT),
m_MapSurface,
FALSE);
except
DebugOutStr ('104');
end;
defx := -UNITX*2 - g_MySelf.m_nShiftX + AAX + 14;
defy := -UNITY*2 - g_MySelf.m_nShiftY;
m_nDefXX := defx;
m_nDefYY := defy;
try
m := defy - UNITY;
for j:=(Map.m_ClientRect.Top - Map.m_nBlockTop) to (Map.m_ClientRect.Bottom - Map.m_nBlockTop + LONGHEIGHT_IMAGE) do begin
if j < 0 then begin Inc (m, UNITY); continue; end;
n := defx-UNITX*2;
//*** 48*32 鸥老屈 坷宏璃飘 弊府扁
for i:=(Map.m_ClientRect.Left - Map.m_nBlockLeft-2) to (Map.m_ClientRect.Right - Map.m_nBlockLeft+2) do begin
if (i >= 0) and (i < LOGICALMAPUNIT*3) and (j >= 0) and (j < LOGICALMAPUNIT*3) then begin
fridx := (Map.m_MArr[i, j].wFrImg) and $7FFF;
if fridx > 0 then begin
ani := Map.m_MArr[i, j].btAniFrame;
wunit := Map.m_MArr[i, j].btArea;
if (ani and $80) > 0 then begin
blend := TRUE;
ani := ani and $7F;
end;
if ani > 0 then begin
anitick := Map.m_MArr[i, j].btAniTick;
fridx := fridx + (m_nAniCount mod (ani + (ani*anitick))) div (1+anitick);
end;
if (Map.m_MArr[i, j].btDoorOffset and $80) > 0 then begin //凯覆
if (Map.m_MArr[i, j].btDoorIndex and $7F) > 0 then //巩栏肺 钎矫等 巴父
fridx := fridx + (Map.m_MArr[i, j].btDoorOffset and $7F); //凯赴 巩
end;
fridx := fridx - 1;
// 拱眉 弊覆
DSurface := GetObjs (wunit, fridx);
if DSurface <> nil then begin
if (DSurface.Width = 48) and (DSurface.Height = 32) then begin
mmm := m + UNITY - DSurface.Height;
if (n+DSurface.Width > 0) and (n <= SCREENWIDTH) and (mmm + DSurface.Height > 0) and (mmm < drawingbottomline) then begin
m_ObjSurface.Draw (n, mmm, DSurface.ClientRect, Dsurface, TRUE)
end else begin
if mmm < drawingbottomline then begin //阂鞘夸窍霸 弊府绰 巴阑 乔窃
m_ObjSurface.Draw (n, mmm, DSurface.ClientRect, DSurface, TRUE)
end;
end;
end;
end;
end;
end;
Inc (n, UNITX);
end;
Inc (m, UNITY);
end;
//顶官蹿俊 弊妨瘤绰 付过
for k:=0 to m_GroundEffectList.Count-1 do begin
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -