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

📄 drawscrn.pas

📁 传奇源代码的delphi版本
💻 PAS
📖 第 1 页 / 共 2 页
字号:
         //显示人物血量(数字显示)
         if g_boShowHPNumber and (actor.m_Abil.MaxHP > 1) and not actor.m_boDeath then begin
           SetBkMode (Canvas.Handle, TRANSPARENT);
           infoMsg:=IntToStr(actor.m_Abil.HP) + '/' + IntToStr(actor.m_Abil.MaxHP);
           BoldTextOut (MSurface,actor.m_nSayX - 15 ,actor.m_nSayY - 5, clWhite, clBlack,infoMsg );
           Canvas.Release;
         end;

          if (frmMain.IsGroupMember(actor.m_sUserName))  and (not actor.m_boDeath) and (Actor <> g_MySelf) then begin
            d := g_WMain2Images.Images[HEALTHBAR_BLACK];
            if d <> nil then
              MSurface.Draw (actor.m_nSayX - d.Width div 2, actor.m_nSayY - 10, d.ClientRect, d, TRUE);

            d := g_WMain2Images.Images[HEALTHBAR_BLUE];
            if d <> nil then begin
              rc := d.ClientRect;
              if (actor.m_Abil.MaxHP > 0) and (actor.m_Abil.HP <> 0) then
                rc.Right := Round((rc.Right-rc.Left) / actor.m_Abil.MaxHP * actor.m_Abil.HP)
              else
                rc.Right := Round((rc.Right-rc.Left) / 1);
              MSurface.Draw (actor.m_nSayX - d.Width div 2, actor.m_nSayY - 10, rc, d, TRUE);
            end;
          end else begin
            if g_boShowRedHPLable then actor.m_boOpenHealth:=True; //显示血条

            if (actor.m_boOpenHealth or actor.m_noInstanceOpenHealth) and not actor.m_boDeath then begin
              if actor.m_noInstanceOpenHealth then
                if GetTickCount - actor.m_dwOpenHealthStart > actor.m_dwOpenHealthTime then
                  actor.m_noInstanceOpenHealth := FALSE;
              d := g_WMain2Images.Images[HEALTHBAR_BLACK];
              if d <> nil then
                MSurface.Draw (actor.m_nSayX - d.Width div 2, actor.m_nSayY - 10, d.ClientRect, d, TRUE);
              d := g_WMain2Images.Images[HEALTHBAR_RED];
              if d <> nil then begin
                rc := d.ClientRect;
                if actor.m_Abil.MaxHP > 0 then
                  rc.Right := Round((rc.Right-rc.Left) / actor.m_Abil.MaxHP * actor.m_Abil.HP);
                MSurface.Draw (actor.m_nSayX - d.Width div 2, actor.m_nSayY - 10, rc, d, TRUE);
              end;
            end;
          end;
        end;
end;

         SetBkMode (Canvas.Handle, TRANSPARENT);
         if (g_FocusCret <> nil) and PlayScene.IsValidActor (g_FocusCret) then begin
            //if FocusCret.Grouped then uname := char(7) + FocusCret.UserName
            //else
            uname := g_FocusCret.m_sDescUserName + '\' + g_FocusCret.m_sUserName;
            NameTextOut (MSurface,
                      g_FocusCret.m_nSayX, // - Canvas.TextWidth(uname) div 2,
                      g_FocusCret.m_nSayY + 30,
                      g_FocusCret.m_nNameColor, clBlack,
                      uname);
         end;
         if g_boSelectMyself and not g_boNameAllView then begin
            uname := g_MySelf.m_sDescUserName + '\' + g_MySelf.m_sUserName;
            NameTextOut (MSurface,
                      g_MySelf.m_nSayX, // - Canvas.TextWidth(uname) div 2,
                      g_MySelf.m_nSayY + 30,
                      g_MySelf.m_nNameColor, clBlack,
                      uname);
         end;

         if g_boNameAllView then begin
            with PlayScene do begin
              for k:=0 to m_ActorList.Count-1 do begin
                 actor := m_ActorList[k];
                 NameTextOut (MSurface,
                      actor.m_nSayX, // - Canvas.TextWidth(uname) div 2,
                      actor.m_nSayY + 30,
                      actor.m_nNameColor, clBlack,
                      actor.m_sUserName);
                end;
             end;
         end;

         Canvas.Font.Color := clWhite;

         //显示角色说话文字
         with PlayScene do begin
            for k:=0 to m_ActorList.Count-1 do begin
               actor := m_ActorList[k];
               if actor.m_SayingArr[0] <> '' then begin
                  if GetTickCount - actor.m_dwSayTime < 4 * 1000 then begin
                     for i:=0 to actor.m_nSayLineCount - 1 do
                        if actor.m_boDeath then
                           BoldTextOut (MSurface,
                                     actor.m_nSayX - (actor.m_SayWidthsArr[i] div 2),
                                     actor.m_nSayY - (actor.m_nSayLineCount*16) + i*14,
                                     clGray, clBlack,
                                     actor.m_SayingArr[i])
                        else
                           BoldTextOut (MSurface,
                                     actor.m_nSayX - (actor.m_SayWidthsArr[i] div 2),
                                     actor.m_nSayY - (actor.m_nSayLineCount*16) + i*14,
                                     clWhite, clBlack,
                                     actor.m_SayingArr[i]);
                  end else
                     actor.m_SayingArr[0] := '';
               end;
            end;
         end;

         //BoldTextOut (MSurface, 0, 0, clWhite, clBlack, IntToStr(SendCount) + ' : ' + IntToStr(ReceiveCount));
         //BoldTextOut (MSurface, 0, 0, clWhite, clBlack, 'HITSPEED=' + IntToStr(Myself.HitSpeed));
         //BoldTextOut (MSurface, 0, 0, clWhite, clBlack, 'DupSel=' + IntToStr(DupSelection));
         //BoldTextOut (MSurface, 0, 0, clWhite, clBlack, IntToStr(LastHookKey));
         //BoldTextOut (MSurface, 0, 0, clWhite, clBlack,
         //             IntToStr(
         //                int64(GetTickCount - LatestSpellTime) - int64(700 + MagicDelayTime)
         //                ));
         //BoldTextOut (MSurface, 0, 0, clWhite, clBlack, IntToStr(PlayScene.EffectList.Count));
         //BoldTextOut (MSurface, 0, 0, clWhite, clBlack,
         //                  IntToStr(Myself.XX) + ',' + IntToStr(Myself.m_nCurrY) + '  ' +
         //                  IntToStr(Myself.ShiftX) + ',' + IntToStr(Myself.ShiftY));

         //System Message

         if (g_nAreaStateValue and $04) <> 0 then begin
            BoldTextOut (MSurface, 0, 0, clWhite, clBlack, '攻城区域');
         end;

         Canvas.Release;

         k := 0;
         for i:=0 to 15 do begin
            if g_nAreaStateValue and ($01 shr i) <> 0 then begin
               d := g_WMainImages.Images[AREASTATEICONBASE + i];
               if d <> nil then begin
                  k := k + d.Width;
                  MSurface.Draw (SCREENWIDTH-k, 0, d.ClientRect, d, TRUE);
               end;
            end;
         end;

      end;
   end;
end;
//显示左上角信息文字
procedure TDrawScreen.DrawScreenTop (MSurface: TDirectDrawSurface);
var
   i, sx, sy: integer;
begin
   if g_MySelf = nil then exit;

   if CurrentScene = PlayScene then begin
      with MSurface do begin
         SetBkMode (Canvas.Handle, TRANSPARENT);
         if m_SysMsgList.Count > 0 then begin
            sx := 30;
            sy := 40;
            for i:=0 to m_SysMsgList.Count-1 do begin
               BoldTextOut (MSurface, sx, sy, clGreen, clBlack, m_SysMsgList[i]);
               inc (sy, 16);
            end;
            if GetTickCount - longword(m_SysMsgList.Objects[0]) >= 3000 then
               m_SysMsgList.Delete (0);
         end;
         Canvas.Release;
      end;
   end;
end;

procedure TDrawScreen.DrawHint (MSurface: TDirectDrawSurface);
var
   d: TDirectDrawSurface;
   i, hx, hy, old: integer;
   str: string;
begin
   hx:=0;
   hy:=0;
   if HintList.Count > 0 then begin
      d := g_WMainImages.Images[394];
      if d <> nil then begin
         if HintWidth > d.Width then HintWidth := d.Width;
         if HintHeight > d.Height then HintHeight := d.Height;
         if HintX + HintWidth > SCREENWIDTH then hx := SCREENWIDTH - HintWidth
         else hx := HintX;
         if HintY < 0 then hy := 0
         else hy := HintY;
         if hx < 0 then hx := 0;

         DrawBlendEx (MSurface, hx, hy, d, 0, 0, HintWidth, HintHeight, 0);
      end;
   end;
   with MSurface do begin
      SetBkMode (Canvas.Handle, TRANSPARENT);
      if HintList.Count > 0 then begin
         Canvas.Font.Color := HintColor;
         for i:=0 to HintList.Count-1 do begin
            Canvas.TextOut (hx+4, hy+3+(Canvas.TextHeight('A')+1)*i, HintList[i]);
         end;
      end;

      if g_MySelf <> nil then begin
         
         //显示人物血量
         //BoldTextOut (MSurface, 15, SCREENHEIGHT - 120, clWhite, clBlack, IntToStr(g_MySelf.m_Abil.HP) + '/' + IntToStr(g_MySelf.m_Abil.MaxHP));
         //人物MP值
         //BoldTextOut (MSurface, 115, SCREENHEIGHT - 120, clWhite, clBlack, IntToStr(g_MySelf.m_Abil.MP) + '/' + IntToStr(g_MySelf.m_Abil.MaxMP));
         //人物经验值
         //BoldTextOut (MSurface, 655, SCREENHEIGHT - 55, clWhite, clBlack, IntToStr(g_MySelf.Abil.Exp) + '/' + IntToStr(g_MySelf.Abil.MaxExp));
         //人物背包重量
         //BoldTextOut (MSurface, 655, SCREENHEIGHT - 25, clWhite, clBlack, IntToStr(g_MySelf.Abil.Weight) + '/' + IntToStr(g_MySelf.Abil.MaxWeight));


         {if g_boShowGreenHint then begin
          str:= '时间:' + TimeToStr(Time) +
                ' 检验值:' + IntToStr(g_MySelf.m_Abil.Exp) + '/' + IntToStr(g_MySelf.m_Abil.MaxExp) +
                ' 重量:' + IntToStr(g_MySelf.m_Abil.Weight) + '/' + IntToStr(g_MySelf.m_Abil.MaxWeight) +
                ' ' + g_sGoldName + ': ' + IntToStr(g_MySelf.m_nGold) +
                ' 鼠标坐标:' + IntToStr(g_nMouseCurrX) + ':' + IntToStr(g_nMouseCurrY) + '(' + IntToStr(g_nMouseX) + ':' + IntToStr(g_nMouseY) + ')';
          if g_FocusCret <> nil then begin
            str:= str + ' 目标:' + g_FocusCret.m_sUserName + '(' + IntToStr(g_FocusCret.m_Abil.HP) + '/' + IntToStr(g_FocusCret.m_Abil.MaxHP) + ')';
          end else begin
            str:= str + ' 目标:-/-';
          end;

          BoldTextOut (MSurface, 10, 0, clLime , clBlack, str);

          str:='';
         end;}

         if g_boCheckBadMapMode then begin
              str := IntToStr(m_dwDrawFrameCount) +  ' '
              + '  Mouse ' + IntToStr(g_nMouseX) + ':' + IntToStr(g_nMouseY) + '(' + IntToStr(g_nMouseCurrX) + ':' + IntToStr(g_nMouseCurrY) + ')'
              + '  HP' + IntToStr(g_MySelf.m_Abil.HP) + '/' + IntToStr(g_MySelf.m_Abil.MaxHP)
              + '  D0 ' + IntToStr(g_nDebugCount)
              + ' D1 ' + IntToStr(g_nDebugCount1) + ' D2 '
              + IntToStr(g_nDebugCount2);
              BoldTextOut (MSurface, 10, 0, clWhite, clBlack, str);
         end;

         //old := Canvas.Font.Size;
         //Canvas.Font.Size := 8;
         //BoldTextOut (MSurface, 8, SCREENHEIGHT-42, clWhite, clBlack, ServerName);

         {if g_boShowWhiteHint then begin
         if g_MySelf.m_nGameGold > 10 then begin
           BoldTextOut (MSurface, 8, SCREENHEIGHT-42, clWhite, clBlack, g_sGameGoldName + ' ' + IntToStr(g_MySelf.m_nGameGold));
         end else begin
           BoldTextOut (MSurface, 8, SCREENHEIGHT-42, clRed, clBlack, g_sGameGoldName + ' ' + IntToStr(g_MySelf.m_nGameGold));
         end;
         if g_MySelf.m_nGamePoint > 10 then begin
           BoldTextOut (MSurface, 8, SCREENHEIGHT-58, clWhite, clBlack, g_sGamePointName + ' ' + IntToStr(g_MySelf.m_nGamePoint));
         end else begin
           BoldTextOut (MSurface, 8, SCREENHEIGHT-58, clRed, clBlack, g_sGamePointName + ' ' + IntToStr(g_MySelf.m_nGamePoint));
         end;

         //鼠标所指坐标
         //BoldTextOut (MSurface, 115, SCREENHEIGHT - 40, clWhite, clBlack, IntToStr(g_nMouseCurrX) + ':' + IntToStr(g_nMouseCurrY));
         //显示时间
         //BoldTextOut (MSurface, 410, SCREENHEIGHT - 147, clWhite, clBlack, FormatDateTime('dddddd hh:mm:ss ampm', Now));
         end;}

//         BoldTextOut (MSurface, 8, SCREENHEIGHT- 74, clWhite, clBlack, format('AllocMemCount:%d',[AllocMemCount]));
//         BoldTextOut (MSurface, 8, SCREENHEIGHT- 90, clWhite, clBlack, format('AllocMemSize:%d',[AllocMemSize div 1024]));


{  if not(g_boSkillSetting) then begin
    if (g_boViewMiniMap = TRUE) and (g_nMiniMapIndex <> -1) then
      BoldTextOut (MSurface, 706, 139, clYellow, clBlack, '[全体]')
    else
      BoldTextOut (MSurface, 706, 20, clYellow, clBlack, '[全体]')
  end else begin
    if (g_boViewMiniMap = TRUE) and (g_nMiniMapIndex <> -1) then
      BoldTextOut (MSurface, 706, 139, clYellow, clBlack, '[全体]')
    else
      BoldTextOut (MSurface, 706, 20, clYellow, clBlack, '[全体]');
  end; }

         BoldTextOut (MSurface, 15, SCREENHEIGHT-17, clWhite, clBlack, g_sMapTitle + ' ' + IntToStr(g_MySelf.m_nCurrX) + ':' + IntToStr(g_MySelf.m_nCurrY));
         //Canvas.Font.Size := old;
      end;
      //BoldTextOut (MSurface, 10, 20, clWhite, clBlack, IntToStr(DebugCount) + ' / ' + IntToStr(DebugCount1));
      Canvas.Release;
   end;
end;

{---- Adjust global SVN revision ----}
initialization
  SVNRevision('$Id: DrawScrn.pas 499 2006-10-31 21:26:22Z sean $');
end.

⌨️ 快捷键说明

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