|
procedure TPlayScene.Run();
var
I, k : Integer;
movetick : Boolean;
evn : TEvent;
Actor : TActor;
meff : TMagicEff;
dwCheckTime : LongWord;
dwTestCheckTime : LongWord;
nIdx : Integer;
boCheckTimeLimit : Boolean;
nCheckCode : Integer;
dwStepMoveTime : LongWord;
dwTickTime : LongWord;
begin
if (g_MySelf = nil) then begin
Exit;
end;
g_boDoFastFadeOut := False;
movetick := False;
if g_ServerConfig.boChgSpeed then begin
//dwStepMoveTime := g_Config.dwStepMoveTime;
dwStepMoveTime := _MAX(100 - Trunc((g_MySelf.m_Abil.MoveSpeed * 100) / 100), 5);
end else begin
dwStepMoveTime := 100;
end;
if GetTickCount - m_dwMoveTime >= dwStepMoveTime 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;
for I := 0 to m_ActorList.Count - 1 do
actor := m_ActorList;
try
// nIdx := m_nProcHumIDx;
nIdx := 0;
//dwCheckTime := GetTickCount();
//boCheckTimeLimit := False;
while True do begin
nCheckCode := 0;
if nIdx >= m_ActorList.Count then Break;
Actor := TActor(m_ActorList.Items[nIdx]);
if not Actor.m_boDelActor then begin
nCheckCode := 1;
//dwTestCheckTime := GetTickCount();
//boCanMove := Actor.CanMove;
if movetick then Actor.m_boLockEndFrame := False;
if not Actor.m_boLockEndFrame then begin
nCheckCode := 4;
Actor.ProcMsg;
nCheckCode := 5;
if movetick then begin
nCheckCode := 6;
if Actor.Move(Actor.m_nMoveStepCount) then begin
Inc(nIdx);
nCheckCode := 7;
Continue;
end;
end;
nCheckCode := 8;
Actor.Run;
nCheckCode := 9;
if Actor <> g_MySelf then Actor.ProcHurryMsg;
nCheckCode := 10;
end;
nCheckCode := 11;
if Actor = g_MySelf then Actor.ProcHurryMsg;
nCheckCode := 12;
if Actor.m_nWaitForRecogId <> 0 then begin
nCheckCode := 13;
if Actor.IsIdle then begin
nCheckCode := 14;
DelChangeFace(Actor.m_nWaitForRecogId);
nCheckCode := 15;
NewActor(Actor.m_nWaitForRecogId, Actor.m_nCurrX, Actor.m_nCurrY, Actor.m_btDir, Actor.m_nWaitForFeature, Actor.m_nWaitForStatus);
nCheckCode := 16;
Actor.m_nWaitForRecogId := 0;
Actor.m_boDelActor := True;
end;
end;
end;
nCheckCode := 17;
if Actor.m_boDelActor then begin
nCheckCode := 18;
m_ActorList.Delete(nIdx);
nCheckCode := 19;
UpDataFreeActorList(Actor);
nCheckCode := 20;
if g_TargetCret = Actor then g_TargetCret := nil;
if g_FocusCret = Actor then g_FocusCret := nil;
if g_MagicTarget = Actor then g_MagicTarget := nil;
if g_MyHero = Actor then g_MyHero := nil;
if g_SerieTarget = Actor then g_SerieTarget := nil;
nCheckCode := 21;
end else Inc(nIdx);
end;
except
on E: Exception do begin
DebugOutStr('101 Code:' + IntToStr(nCheckCode));
DebugOutStr('101 ' + E.Message);
if nCheckCode = 4 then
DebugOutStr('101 UserName ' + Actor.m_sUserName);
end;
end;
nCheckCode := 22;
try
nIdx := 0;
while True do begin
nCheckCode := 23;
if nIdx >= m_GroundEffectList.Count then Break;
nCheckCode := 24;
meff := m_GroundEffectList[nIdx];
nCheckCode := 25;
if meff.m_boActive then begin
nCheckCode := 26;
if not meff.Run then begin
nCheckCode := 27;
m_GroundEffectList.Delete(nIdx);
nCheckCode := 28;
meff.Free;
nCheckCode := 29;
Continue;
end;
end;
Inc(nIdx);
end;
nCheckCode := 30;
nIdx := 0;
while True do begin
nCheckCode := 31;
if nIdx >= m_EffectList.Count then Break;
nCheckCode := 32;
meff := m_EffectList[nIdx];
nCheckCode := 33;
if meff.m_boActive then begin
nCheckCode := 34;
if not meff.Run then begin
nCheckCode := 35;
meff.Free;
nCheckCode := 36;
m_EffectList.Delete(nIdx);
nCheckCode := 37;
Continue;
end;
end;
Inc(nIdx);
end;
nCheckCode := 38;
nIdx := 0;
while True do begin
nCheckCode := 39;
if nIdx >= m_FlyList.Count then Break;
nCheckCode := 40;
meff := m_FlyList[nIdx];
nCheckCode := 41;
if meff.m_boActive then begin
nCheckCode := 42;
if not meff.Run then begin
nCheckCode := 43;
meff.Free;
nCheckCode := 44;
m_FlyList.Delete(nIdx);
nCheckCode := 45;
Continue;
end;
end;
Inc(nIdx);
end;
nCheckCode := 46;
EventMan.Execute;
nCheckCode := 47;
except
on E: Exception do begin
DebugOutStr('102 Code:' + IntToStr(nCheckCode));
DebugOutStr('102 ' + E.Message);
end;
end;
try
//清除超过显示范围的物品数据
ClearDropItem();
//清除超过显示范围的魔法数据
for k := EventMan.EventList.Count - 1 downto 0 do begin
evn := TEvent(EventMan.EventList[k]);
if ((abs(evn.m_nX - g_MySelf.m_nCurrX) > 30) and (abs(evn.m_nY - g_MySelf.m_nCurrY) > 30)) or (not evn.m_boVisible) then begin
EventMan.EventList.Delete(k);
evn.Free;
//Break;
end;
end;
end;
end;
|
|
|