⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 playscn.pas

📁 在网上有很多传奇源程序DELPHI
💻 PAS
📖 第 1 页 / 共 5 页
字号:
   //地面物体运动的计算
   try
   i := 0;
   while TRUE do begin
      if i >= GroundEffectList.Count then break;
      meff := GroundEffectList[i];
      if meff.Active then begin
         if not meff.Run then begin //付过瓤苞
            meff.Free;
            GroundEffectList.Delete (i);
            continue;
         end;
      end;
      Inc (i);
   end;
   //特效物体运动属性的计算
   i := 0;
   while TRUE do begin
      if i >= EffectList.Count then break;
      meff := EffectList[i];
      if meff.Active then begin
         if not meff.Run then begin //付过瓤苞
            meff.Free;
            EffectList.Delete (i);
            continue;
         end;
      end;
      Inc (i);
   end;
   //飞行物体运动的计算
   i := 0;
   while TRUE do begin
      if i >= FlyList.Count then break;
      meff := FlyList[i];
      if meff.Active then begin
         if not meff.Run then begin //档尝,拳混殿 朝酒啊绰巴
            meff.Free;
            FlyList.Delete (i);
            continue;
         end;
      end;
      Inc (i);
   end;
   
   EventMan.Execute;
   except
      DebugOutStr ('102');
   end;

   try
   //跌落物品消隐
   for k:=0 to DropedItemList.Count-1 do begin
      pd := PTDropItem (DropedItemList[k]);
      if pd <> nil then begin
         if (Abs(pd.x-Myself.XX) > 30) and (Abs(pd.y-Myself.YY) > 30) then begin
            Dispose (PTDropItem (DropedItemList[k]));
            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.X-Myself.XX) > 30) and (Abs(evn.Y-Myself.YY) > 30) then begin
         evn.Free;
         EventMan.EventList.Delete (k);
         break;  //茄锅俊 茄俺究
      end;
   end;
   except
      DebugOutStr ('103');
   end;
   //更新地图可见范围
   try
   with Map.ClientRect do begin  //地图的范围是玩家为中心,左右各9
      Left   := MySelf.Rx - 9;
      Top    := MySelf.Ry - 9;
      Right  := MySelf.Rx + 9;                         // 坷弗率 楼捧府 弊覆
      Bottom := MySelf.Ry + 8;
   end;
   //装载地图定义
   Map.UpdateMapPos (Myself.Rx, Myself.Ry);

   ///////////////////////
   //ViewFog := FALSE;
   ///////////////////////

   if NoDarkness or (Myself.Death) then begin
      ViewFog := FALSE;
   end;

   if ViewFog then begin //器弊
      ZeroMemory (PFogScreen, MAPSURFACEHEIGHT * MAPSURFACEWIDTH);
      ClearLightMap;
   end;

   drawingbottomline := 450;
   ObjSurface.Fill(0);//.Erase(0);
   //画地图
   DrawTileMap;
   ObjSurface.Draw (0, 0,
                    Rect(UNITX*3 + Myself.ShiftX,
                         UNITY*2 + Myself.ShiftY,
                         UNITX*3 + Myself.ShiftX + MAPSURFACEWIDTH,
                         UNITY*2 + Myself.ShiftY + MAPSURFACEHEIGHT),
                    MapSurface,
                    FALSE);

   except
      DebugOutStr ('104');
   end;

   defx := -UNITX*2 - Myself.ShiftX + AAX + 14;
   defy := -UNITY*2 - Myself.ShiftY;
   DefXX := defx;
   DefYY := defy;
   //画地面上的物体,如房屋等
   try
   m := defy - UNITY;
   for j:=(Map.ClientRect.Top - Map.BlockTop) to (Map.ClientRect.Bottom - Map.BlockTop + LONGHEIGHT_IMAGE) do begin
      if j < 0 then begin Inc (m, UNITY); continue; end;
      n := defx-UNITX*2;
      //*** 48*32 是一个物体小图片的大小
      for i:=(Map.ClientRect.Left - Map.BlockLeft-2) to (Map.ClientRect.Right - Map.BlockLeft+2) do begin
         if (i >= 0) and (i < LOGICALMAPUNIT*3) and (j >= 0) and (j < LOGICALMAPUNIT*3) then begin
            fridx := (Map.MArr[i, j].FrImg) and $7FFF;
            if fridx > 0 then begin
               ani := Map.MArr[i, j].AniFrame;
               wunit := Map.MArr[i, j].Area;
               if (ani and $80) > 0 then begin
                  blend := TRUE;
                  ani := ani and $7F;
               end;
               if ani > 0 then begin
                  anitick := Map.MArr[i, j].AniTick;
                  fridx := fridx + (AniCount mod (ani + (ani*anitick))) div (1+anitick);
               end;
               if (Map.MArr[i, j].DoorOffset and $80) > 0 then begin //凯覆
                  if (Map.MArr[i, j].DoorIndex and $7F) > 0 then  //巩栏肺 钎矫等 巴父
                     fridx := fridx + (Map.MArr[i, j].DoorOffset and $7F); //凯赴 巩
               end;
               fridx := fridx - 1;
               // 取图片
               DSurface := FrmMain.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
                        ObjSurface.Draw (n, mmm, DSurface.ClientRect, Dsurface, TRUE)
                     end else begin
                        if mmm < drawingbottomline then begin //阂鞘夸窍霸 弊府绰 巴阑 乔窃
                           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 GroundEffectList.Count-1 do begin
      meff := TMagicEff(GroundEffectList[k]);
      //if j = (meff.Ry - Map.BlockTop) then begin
      meff.DrawEff (ObjSurface);
      if ViewFog then begin
         AddLight (meff.Rx, meff.Ry, 0, 0, meff.light, FALSE);
      end;
   end;

   except
      DebugOutStr ('105');
   end;  

   try
   m := defy - UNITY;
   for j:=(Map.ClientRect.Top - Map.BlockTop) to (Map.ClientRect.Bottom - Map.BlockTop + LONGHEIGHT_IMAGE) do begin
      if j < 0 then begin Inc (m, UNITY); continue; end;
      n := defx-UNITX*2;
      //*** 硅版坷宏璃飘 弊府扁
      for i:=(Map.ClientRect.Left - Map.BlockLeft-2) to (Map.ClientRect.Right - Map.BlockLeft+2) do begin
         if (i >= 0) and (i < LOGICALMAPUNIT*3) and (j >= 0) and (j < LOGICALMAPUNIT*3) then begin
            fridx := (Map.MArr[i, j].FrImg) and $7FFF;
            if fridx > 0 then begin
               blend := FALSE;
               wunit := Map.MArr[i, j].Area;
               //俊聪皋捞记
               ani := Map.MArr[i, j].AniFrame;
               if (ani and $80) > 0 then begin
                  blend := TRUE;
                  ani := ani and $7F;
               end;
               if ani > 0 then begin
                  anitick := Map.MArr[i, j].AniTick;
                  fridx := fridx + (AniCount mod (ani + (ani*anitick))) div (1+anitick);
               end;
               if (Map.MArr[i, j].DoorOffset and $80) > 0 then begin //凯覆
                  if (Map.MArr[i, j].DoorIndex and $7F) > 0 then  //巩栏肺 钎矫等 巴父
                     fridx := fridx + (Map.MArr[i, j].DoorOffset and $7F); //凯赴 巩
               end;
               fridx := fridx - 1;
               // 拱眉 弊覆
               if not blend then begin
                  DSurface := FrmMain.GetObjs (wunit, fridx);
                  if DSurface <> nil then begin
                     if (DSurface.Width<>48) or (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
                           ObjSurface.Draw (n, mmm, DSurface.ClientRect, Dsurface, TRUE)
                        end else begin
                           if mmm < drawingbottomline then begin //阂鞘夸窍霸 弊府绰 巴阑 乔窃
                              ObjSurface.Draw (n, mmm, DSurface.ClientRect, DSurface, TRUE)
                           end;
                        end;
                     end;
                  end;
               end else begin
                  DSurface := FrmMain.GetObjsEx (wunit, fridx, ax, ay);
                  if DSurface <> nil then begin
                     mmm := m + ay - 68; //UNITY - DSurface.Height;
                     if (n > 0) and (mmm + DSurface.Height > 0) and (n + Dsurface.Width < SCREENWIDTH) and (mmm < drawingbottomline) then begin
                        DrawBlend (ObjSurface, n+ax-2, mmm, DSurface, 1);
                     end else begin
                        if mmm < drawingbottomline then begin //阂鞘夸窍霸 弊府绰 巴阑 乔窃
                           DrawBlend (ObjSurface, n+ax-2, mmm, DSurface, 1);
                        end;
                     end;
                  end;
               end;
            end;

         end;
         Inc (n, UNITX);
      end;

      if (j <= (Map.ClientRect.Bottom - Map.BlockTop)) and (not BoServerChanging) then begin

         //*** 官蹿俊 函版等 入狼 如利
         for k:=0 to EventMan.EventList.Count-1 do begin
            evn := TClEvent (EventMan.EventList[k]);
            if j = (evn.Y - Map.BlockTop) then begin
               evn.DrawEvent (ObjSurface,
                              (evn.X-Map.ClientRect.Left)*UNITX + defx,
                              m);
            end;
         end;

         //*** 官蹿俊 冻绢柳 酒捞袍 弊府扁
         for k:=0 to DropedItemList.Count-1 do begin
            pd := PTDropItem (DropedItemList[k]);
            if pd <> nil then begin
               if j = (pd.y - Map.BlockTop) then begin
                  d := FrmMain.WDnItem.Images[pd.Looks];
                  if d <> nil then begin
                     ix := (pd.x-Map.ClientRect.Left)*UNITX+defx + SOFFX; // + actor.ShiftX;
                     iy := m; // + actor.ShiftY;
                     if pd = FocusItem then begin
                        ImgMixSurface.Draw (0, 0, d.ClientRect, d, FALSE);
                        DrawEffect (0, 0, d.Width, d.Height, ImgMixSurface, ceBright);
                        ObjSurface.Draw (ix + HALFX-(d.Width div 2),
                                      iy + HALFY-(d.Height div 2),
                                      d.ClientRect,
                                      ImgMixSurface, TRUE);
                     end else
                        ObjSurface.Draw (ix + HALFX-(d.Width div 2),
                                      iy + HALFY-(d.Height div 2),
                                      d.ClientRect,
                                      d, TRUE);
                  end;
               end;
            end;
         end;
         //*** 某腐磐 弊府扁
         for k:=0 to ActorList.Count-1 do begin
            actor := ActorList[k];
            if (j = actor.Ry-Map.BlockTop-actor.DownDrawLevel) then begin
               actor.SayX := (actor.Rx-Map.ClientRect.Left)*UNITX + defx + actor.ShiftX + 24;
               if actor.Death then
                  actor.SayY := m + UNITY + actor.ShiftY + 16 - 60  + (actor.DownDrawLevel * UNITY)
               else actor.SayY := m + UNITY + actor.ShiftY + 16 - 95  + (actor.DownDrawLevel * UNITY);
               actor.DrawChr (ObjSurface, (actor.Rx-Map.ClientRect.Left)*UNITX + defx,
                                           m + (actor.DownDrawLevel * UNITY),
                                           FALSE);
            end;
         end;
         for k:=0 to FlyList.Count-1 do begin
            meff := TMagicEff(FlyList[k]);
            if j = (meff.Ry - Map.BlockTop) then
               meff.DrawEff (ObjSurface);
         end;

      end;
      Inc (m, UNITY);
   end;
   except
      DebugOutStr ('106');
   end;

   //画雾的效果(视线)
   try
   if ViewFog then begin
      m := defy - UNITY*4;
      for j:=(Map.ClientRect.Top - Map.BlockTop - 4) to (Map.ClientRect.Bottom - Map.BlockTop + LONGHEIGHT_IMAGE) do begin
         if j < 0 then begin Inc (m, UNITY); continue; end;
         n := defx-UNITX*5;
         //硅版 器弊 弊府扁
         for i:=(Map.ClientRect.Left - Map.BlockLeft-5) to (Map.ClientRect.Right - Map.BlockLeft+5) do begin
            if (i >= 0) and (i < LOGICALMAPUNIT*3) and (j >= 0) and (j < LOGICALMAPUNIT*3) then begin
               idx := Map.MArr[i, j].Light;
               if idx > 0 then begin
                  AddLight (i+Map.BlockLeft, j+Map.BlockTop, 0, 0, idx, FALSE);
               end;
            end;
            Inc (n, UNITX);
         end;
         Inc (m, UNITY);
      end;

      //某腐磐 器弊 弊府扁
      if ActorList.Count > 0 then begin
         for k:=0 to ActorList.Count-1 do begin
            actor := ActorList[k];
            if (actor = Myself) or (actor.Light > 0) then
               AddLight (actor.Rx, actor.Ry, actor.ShiftX, actor.ShiftY, actor.Light, actor=Myself);
         end;
      end else begin
         if Myself <> nil then
            AddLight (Myself.Rx, Myself.Ry, Myself.ShiftX, Myself.ShiftY, Myself.Light, TRUE);
      end;
   end;
   except
      DebugOutStr ('107');
   end;

   if not BoServerChanging then begin
      try
      //**** 林牢傍 某腐磐 弊府扁
      if not CheckBadMapMode then
         if Myself.State and $00800000 = 0 then //捧疙捞 酒聪搁
            Myself.DrawChr (ObjSurface, (Myself.Rx-Map.ClientRect.Left)*UNITX+defx, (Myself.Ry-Map.ClientRect.Top-1)*UNITY+defy, TRUE);

      //**** 付快胶甫 爱促措绊 乐绰 某腐磐
      if (FocusCret <> nil) then begin
         if IsValidActor (FocusCret) and (FocusCret <> Myself) then
            if FocusCret.State and $00800000 = 0 then //捧疙捞 酒聪搁
               FocusCret.DrawChr (ObjSurface,
                           (FocusCret.Rx-Map.ClientRect.Left)*UNITX+defx,
                           (FocusCret.Ry-Map.ClientRect.Top-1)*UNITY+defy, TRUE);
      end;
      if (MagicTarget <> nil) then begin
         if IsValidActor (MagicTarget) and (MagicTarget <> Myself) then
            if MagicTarget.State and $00800000 = 0 then //捧疙捞 酒聪搁
               MagicTarget.DrawChr (ObjSurface,
                           (MagicTarget.Rx-Map.ClientRect.Left)*UNITX+defx,
                           (MagicTarget.Ry-Map.ClientRect.Top-1)*UNITY+defy, TRUE);
      end;
      except
         DebugOutStr ('108');
      end;
   end;
   
   try
   //**** 画角色效果
   for k:=0 to ActorList.Count-1 do begin
      actor := ActorList[k];
      actor.DrawEff (ObjSurface,
                     (actor.Rx-Map.ClientRect.Left)*UNITX + defx,
                     (actor.Ry-Map.ClientRect.Top-1)*UNITY + defy);
   end;
   //画魔法效果
   for k:=0 to EffectList.Count-1 do begin
      meff := TMagicEff(EffectList[k]);

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -