Ignore:
Timestamp:
Jan 7, 2017, 11:32:14 AM (7 years ago)
Author:
chronos
Message:
  • Modified: Formated all project source files using Delphi formatter as original indentation and other formatting was really bad.
File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/LocalPlayer/Battle.pas

    r2 r6  
    55
    66uses
    7   ScreenTools,Protocol,Messg,ButtonBase, ButtonA,
     7  ScreenTools, Protocol, Messg, ButtonBase, ButtonA,
    88
    99  Windows, Messages, SysUtils, Classes, Graphics, Controls, Forms;
     
    1717      Shift: TShiftState; X, Y: Integer);
    1818    procedure FormDeactivate(Sender: TObject);
    19     procedure FormKeyDown(Sender: TObject; var Key: Word;
    20       Shift: TShiftState);
     19    procedure FormKeyDown(Sender: TObject; var Key: Word; Shift: TShiftState);
    2120    procedure FormCreate(Sender: TObject);
    2221    procedure FormShow(Sender: TObject);
     
    2423    procedure CancelBtnClick(Sender: TObject);
    2524  public
    26     uix,ToLoc: integer;
     25    uix, ToLoc: Integer;
    2726    Forecast: TBattleForecastEx;
    2827    IsSuicideQuery: boolean;
     
    3231  BattleDlg: TBattleDlg;
    3332
    34 procedure PaintBattleOutcome(ca: TCanvas; xm,ym,uix,ToLoc: integer;
     33procedure PaintBattleOutcome(ca: TCanvas; xm, ym, uix, ToLoc: Integer;
    3534  Forecast: TBattleForecastEx);
    3635
    37 
    3836implementation
    3937
    4038uses
    41 Term,ClientTools,IsoEngine;
     39  Term, ClientTools, IsoEngine;
    4240
    4341{$R *.DFM}
    4442
    4543const
    46 Border=3;
    47 MessageLineSpacing=20;
    48 
    49 DamageColor=$0000E0;
    50 FanaticColor=$800080;
    51 FirstStrikeColor=$A0A0A0;
    52 
    53 
    54 procedure PaintBattleOutcome(ca: TCanvas; xm,ym,uix,ToLoc: integer;
     44  Border = 3;
     45  MessageLineSpacing = 20;
     46
     47  DamageColor = $0000E0;
     48  FanaticColor = $800080;
     49  FirstStrikeColor = $A0A0A0;
     50
     51procedure PaintBattleOutcome(ca: TCanvas; xm, ym, uix, ToLoc: Integer;
    5552  Forecast: TBattleForecastEx);
    5653var
    57 euix,ADamage,DDamage,StrMax,DamageMax,MaxBar,LAStr,LDStr,
    58   LADamage,LDDamage,LABaseDamage,LAAvoidedDamage,LDBaseDamage: integer;
    59 //TerrType: Cardinal;
    60 UnitInfo: TUnitInfo;
    61 TextSize: TSize;
    62 LabelText: string;
    63 FirstStrike: boolean;
    64 begin
    65 MaxBar:=65;
    66 
    67 //TerrType:=MyMap[ToLoc] and fTerrain;
    68 GetUnitInfo(ToLoc,euix,UnitInfo);
    69 
    70 FirstStrike:=(MyModel[MyUn[uix].mix].Cap[mcFirst]>0)
    71   and (Forecast.DBaseDamage>=UnitInfo.Health);
    72 ADamage:=MyUn[uix].Health-Forecast.EndHealthAtt;
    73 if FirstStrike then
    74   ADamage:=ADamage+Forecast.ABaseDamage div 2;
    75 DDamage:=UnitInfo.Health-Forecast.EndHealthDef;
    76 if Forecast.AStr>Forecast.DStr then
    77   StrMax:=Forecast.AStr
    78 else StrMax:=Forecast.DStr;
    79 if ADamage>DDamage then
    80   DamageMax:=ADamage
    81 else DamageMax:=DDamage;
    82 if Forecast.ABaseDamage>Forecast.DBaseDamage then
    83   StrMax:=StrMax*DamageMax div Forecast.ABaseDamage
    84 else StrMax:=StrMax*DamageMax div Forecast.DBaseDamage;
    85 
    86 LAStr:=Forecast.AStr*MaxBar div StrMax;
    87 LDStr:=Forecast.DStr*MaxBar div StrMax;
    88 LADamage:=ADamage*MaxBar div DamageMax;
    89 LABaseDamage:=Forecast.ABaseDamage*MaxBar div DamageMax;
    90 if FirstStrike then
    91   LAAvoidedDamage:=LABaseDamage div 2
    92 else LAAvoidedDamage:=0;
    93 LDDamage:=DDamage*MaxBar div DamageMax;
    94 LDBaseDamage:=Forecast.DBaseDamage*MaxBar div DamageMax;
    95 
    96 DarkGradient(ca,xm-8-LAStr,ym-8,LAStr,2);
    97 VDarkGradient(ca,xm-8,ym-8-LDStr,LDStr,2);
    98 LightGradient(ca,xm+8,ym-8,LDBaseDamage,DamageColor);
    99 if LDDamage>LDBaseDamage then
    100   LightGradient(ca,xm+8+LDBaseDamage,ym-8,LDDamage-LDBaseDamage,FanaticColor);
    101 if LAAvoidedDamage>0 then
    102   VLightGradient(ca,xm-8,ym+8,LAAvoidedDamage,FirstStrikeColor);
    103 VLightGradient(ca,xm-8,ym+8+LAAvoidedDamage,LABaseDamage-LAAvoidedDamage,
    104   DamageColor);
    105 if LADamage>LABaseDamage then
    106   VLightGradient(ca,xm-8,ym+8+LABaseDamage,LADamage-LABaseDamage,FanaticColor);
    107 BitBlt(ca.Handle,xm-12,ym-12,24,24,
    108   GrExt[HGrSystem].Mask.Canvas.Handle,26,146,SRCAND);
    109 BitBlt(ca.Handle,xm-12,ym-12,24,24,
    110   GrExt[HGrSystem].Data.Canvas.Handle,26,146,SRCPAINT);
    111 
    112 LabelText:=Format('%d', [Forecast.AStr]);
    113 TextSize:=ca.TextExtent(LabelText);
    114 if TextSize.cx div 2+2>LAStr div 2 then
    115   RisedTextOut(ca,xm-10-TextSize.cx,ym-(TextSize.cy+1) div 2, LabelText)
    116 else RisedTextOut(ca,xm-8-(LAStr+TextSize.cx) div 2,ym-(TextSize.cy+1) div 2, LabelText);
    117 
    118 LabelText:=Format('%d', [Forecast.DStr]);
    119 TextSize:=ca.TextExtent(LabelText);
    120 if TextSize.cy div 2>LDStr div 2 then
    121   RisedTextOut(ca,xm-(TextSize.cx+1) div 2, ym-8-TextSize.cy,LabelText)
    122 else RisedTextOut(ca,xm-(TextSize.cx+1) div 2, ym-8-(LDStr+TextSize.cy) div 2,LabelText);
    123 
    124 if Forecast.EndHealthDef<=0 then
    125   begin
    126   BitBlt(ca.Handle,xm+9+LDDamage-7,ym-6,14,17,
    127     GrExt[HGrSystem].Mask.Canvas.Handle,51,153,SRCAND);
    128   BitBlt(ca.Handle,xm+8+LDDamage-7,ym-7,14,17,
    129     GrExt[HGrSystem].Mask.Canvas.Handle,51,153,SRCAND);
    130   BitBlt(ca.Handle,xm+8+LDDamage-7,ym-7,14,17,
    131     GrExt[HGrSystem].Data.Canvas.Handle,51,153,SRCPAINT);
    132   end;
    133 LabelText:=Format('%d', [DDamage]);
    134 TextSize:=ca.TextExtent(LabelText);
    135 if TextSize.cx div 2+2>LDDamage div 2 then
    136   begin
    137   if Forecast.EndHealthDef>0 then
    138     RisedTextOut(ca,xm+10,ym-(TextSize.cy+1) div 2, LabelText)
    139   end
    140 else RisedTextOut(ca,xm+8+(LDDamage-TextSize.cx) div 2,ym-(TextSize.cy+1) div 2, LabelText);
    141 
    142 if Forecast.EndHealthAtt<=0 then
    143   begin
    144   BitBlt(ca.Handle,xm-6,ym+9+LADamage-7,14,17,
    145     GrExt[HGrSystem].Mask.Canvas.Handle,51,153,SRCAND);
    146   BitBlt(ca.Handle,xm-7,ym+8+LADamage-7,14,17,
    147     GrExt[HGrSystem].Mask.Canvas.Handle,51,153,SRCAND);
    148   BitBlt(ca.Handle,xm-7,ym+8+LADamage-7,14,17,
    149     GrExt[HGrSystem].Data.Canvas.Handle,51,153,SRCPAINT);
    150   end;
    151 LabelText:=Format('%d', [MyUn[uix].Health-Forecast.EndHealthAtt]);
    152 TextSize:=ca.TextExtent(LabelText);
    153 if TextSize.cy div 2>(LADamage-LAAvoidedDamage) div 2+LAAvoidedDamage then
    154   begin
    155   if Forecast.EndHealthAtt>0 then
    156     RisedTextOut(ca,xm-(TextSize.cx+1) div 2, ym+8+LAAvoidedDamage,LabelText)
    157   end
    158 else RisedTextOut(ca,xm-(TextSize.cx+1) div 2, ym+8+LAAvoidedDamage+(LADamage-LAAvoidedDamage-TextSize.cy) div 2,LabelText);
    159 
    160 NoMap.SetOutput(Buffer);
    161 BitBlt(Buffer.Canvas.Handle,0,0,66,48,ca.Handle,xm+8+4,ym-8-12-48,SRCCOPY);
    162 {if TerrType<fForest then
    163   Sprite(Buffer,HGrTerrain,0,16,66,32,1+TerrType*(xxt*2+1),1+yyt)
    164 else
    165   begin
    166   Sprite(Buffer,HGrTerrain,0,16,66,32,1+2*(xxt*2+1),1+yyt+2*(yyt*3+1));
    167   if (TerrType=fForest) and IsJungle(ToLoc div G.lx) then
     54  euix, ADamage, DDamage, StrMax, DamageMax, MaxBar, LAStr, LDStr, LADamage,
     55    LDDamage, LABaseDamage, LAAvoidedDamage, LDBaseDamage: Integer;
     56  // TerrType: Cardinal;
     57  UnitInfo: TUnitInfo;
     58  TextSize: TSize;
     59  LabelText: string;
     60  FirstStrike: boolean;
     61begin
     62  MaxBar := 65;
     63
     64  // TerrType:=MyMap[ToLoc] and fTerrain;
     65  GetUnitInfo(ToLoc, euix, UnitInfo);
     66
     67  FirstStrike := (MyModel[MyUn[uix].mix].Cap[mcFirst] > 0) and
     68    (Forecast.DBaseDamage >= UnitInfo.Health);
     69  ADamage := MyUn[uix].Health - Forecast.EndHealthAtt;
     70  if FirstStrike then
     71    ADamage := ADamage + Forecast.ABaseDamage div 2;
     72  DDamage := UnitInfo.Health - Forecast.EndHealthDef;
     73  if Forecast.AStr > Forecast.DStr then
     74    StrMax := Forecast.AStr
     75  else
     76    StrMax := Forecast.DStr;
     77  if ADamage > DDamage then
     78    DamageMax := ADamage
     79  else
     80    DamageMax := DDamage;
     81  if Forecast.ABaseDamage > Forecast.DBaseDamage then
     82    StrMax := StrMax * DamageMax div Forecast.ABaseDamage
     83  else
     84    StrMax := StrMax * DamageMax div Forecast.DBaseDamage;
     85
     86  LAStr := Forecast.AStr * MaxBar div StrMax;
     87  LDStr := Forecast.DStr * MaxBar div StrMax;
     88  LADamage := ADamage * MaxBar div DamageMax;
     89  LABaseDamage := Forecast.ABaseDamage * MaxBar div DamageMax;
     90  if FirstStrike then
     91    LAAvoidedDamage := LABaseDamage div 2
     92  else
     93    LAAvoidedDamage := 0;
     94  LDDamage := DDamage * MaxBar div DamageMax;
     95  LDBaseDamage := Forecast.DBaseDamage * MaxBar div DamageMax;
     96
     97  DarkGradient(ca, xm - 8 - LAStr, ym - 8, LAStr, 2);
     98  VDarkGradient(ca, xm - 8, ym - 8 - LDStr, LDStr, 2);
     99  LightGradient(ca, xm + 8, ym - 8, LDBaseDamage, DamageColor);
     100  if LDDamage > LDBaseDamage then
     101    LightGradient(ca, xm + 8 + LDBaseDamage, ym - 8, LDDamage - LDBaseDamage,
     102      FanaticColor);
     103  if LAAvoidedDamage > 0 then
     104    VLightGradient(ca, xm - 8, ym + 8, LAAvoidedDamage, FirstStrikeColor);
     105  VLightGradient(ca, xm - 8, ym + 8 + LAAvoidedDamage,
     106    LABaseDamage - LAAvoidedDamage, DamageColor);
     107  if LADamage > LABaseDamage then
     108    VLightGradient(ca, xm - 8, ym + 8 + LABaseDamage, LADamage - LABaseDamage,
     109      FanaticColor);
     110  BitBlt(ca.Handle, xm - 12, ym - 12, 24, 24,
     111    GrExt[HGrSystem].Mask.Canvas.Handle, 26, 146, SRCAND);
     112  BitBlt(ca.Handle, xm - 12, ym - 12, 24, 24,
     113    GrExt[HGrSystem].Data.Canvas.Handle, 26, 146, SRCPAINT);
     114
     115  LabelText := Format('%d', [Forecast.AStr]);
     116  TextSize := ca.TextExtent(LabelText);
     117  if TextSize.cx div 2 + 2 > LAStr div 2 then
     118    RisedTextOut(ca, xm - 10 - TextSize.cx, ym - (TextSize.cy + 1) div 2,
     119      LabelText)
     120  else
     121    RisedTextOut(ca, xm - 8 - (LAStr + TextSize.cx) div 2,
     122      ym - (TextSize.cy + 1) div 2, LabelText);
     123
     124  LabelText := Format('%d', [Forecast.DStr]);
     125  TextSize := ca.TextExtent(LabelText);
     126  if TextSize.cy div 2 > LDStr div 2 then
     127    RisedTextOut(ca, xm - (TextSize.cx + 1) div 2, ym - 8 - TextSize.cy,
     128      LabelText)
     129  else
     130    RisedTextOut(ca, xm - (TextSize.cx + 1) div 2,
     131      ym - 8 - (LDStr + TextSize.cy) div 2, LabelText);
     132
     133  if Forecast.EndHealthDef <= 0 then
     134  begin
     135    BitBlt(ca.Handle, xm + 9 + LDDamage - 7, ym - 6, 14, 17,
     136      GrExt[HGrSystem].Mask.Canvas.Handle, 51, 153, SRCAND);
     137    BitBlt(ca.Handle, xm + 8 + LDDamage - 7, ym - 7, 14, 17,
     138      GrExt[HGrSystem].Mask.Canvas.Handle, 51, 153, SRCAND);
     139    BitBlt(ca.Handle, xm + 8 + LDDamage - 7, ym - 7, 14, 17,
     140      GrExt[HGrSystem].Data.Canvas.Handle, 51, 153, SRCPAINT);
     141  end;
     142  LabelText := Format('%d', [DDamage]);
     143  TextSize := ca.TextExtent(LabelText);
     144  if TextSize.cx div 2 + 2 > LDDamage div 2 then
     145  begin
     146    if Forecast.EndHealthDef > 0 then
     147      RisedTextOut(ca, xm + 10, ym - (TextSize.cy + 1) div 2, LabelText)
     148  end
     149  else
     150    RisedTextOut(ca, xm + 8 + (LDDamage - TextSize.cx) div 2,
     151      ym - (TextSize.cy + 1) div 2, LabelText);
     152
     153  if Forecast.EndHealthAtt <= 0 then
     154  begin
     155    BitBlt(ca.Handle, xm - 6, ym + 9 + LADamage - 7, 14, 17,
     156      GrExt[HGrSystem].Mask.Canvas.Handle, 51, 153, SRCAND);
     157    BitBlt(ca.Handle, xm - 7, ym + 8 + LADamage - 7, 14, 17,
     158      GrExt[HGrSystem].Mask.Canvas.Handle, 51, 153, SRCAND);
     159    BitBlt(ca.Handle, xm - 7, ym + 8 + LADamage - 7, 14, 17,
     160      GrExt[HGrSystem].Data.Canvas.Handle, 51, 153, SRCPAINT);
     161  end;
     162  LabelText := Format('%d', [MyUn[uix].Health - Forecast.EndHealthAtt]);
     163  TextSize := ca.TextExtent(LabelText);
     164  if TextSize.cy div 2 > (LADamage - LAAvoidedDamage) div 2 + LAAvoidedDamage
     165  then
     166  begin
     167    if Forecast.EndHealthAtt > 0 then
     168      RisedTextOut(ca, xm - (TextSize.cx + 1) div 2, ym + 8 + LAAvoidedDamage,
     169        LabelText)
     170  end
     171  else
     172    RisedTextOut(ca, xm - (TextSize.cx + 1) div 2, ym + 8 + LAAvoidedDamage +
     173      (LADamage - LAAvoidedDamage - TextSize.cy) div 2, LabelText);
     174
     175  NoMap.SetOutput(Buffer);
     176  BitBlt(Buffer.Canvas.Handle, 0, 0, 66, 48, ca.Handle, xm + 8 + 4,
     177    ym - 8 - 12 - 48, SRCCOPY);
     178  { if TerrType<fForest then
     179    Sprite(Buffer,HGrTerrain,0,16,66,32,1+TerrType*(xxt*2+1),1+yyt)
     180    else
     181    begin
     182    Sprite(Buffer,HGrTerrain,0,16,66,32,1+2*(xxt*2+1),1+yyt+2*(yyt*3+1));
     183    if (TerrType=fForest) and IsJungle(ToLoc div G.lx) then
    168184    Sprite(Buffer,HGrTerrain,0,16,66,32,1+7*(xxt*2+1),1+yyt+19*(yyt*3+1))
    169   else Sprite(Buffer,HGrTerrain,0,16,66,32,1+7*(xxt*2+1),1+yyt+2*(2+TerrType-fForest)*(yyt*3+1));
    170   end;}
    171 NoMap.PaintUnit(1,0,UnitInfo,0);
    172 BitBlt(ca.Handle,xm+8+4,ym-8-12-48,66,48,Buffer.Canvas.Handle,0,0,SRCCOPY);
    173 
    174 BitBlt(Buffer.Canvas.Handle,0,0,66,48,ca.Handle,xm-8-4-66,ym+8+12,SRCCOPY);
    175 MakeUnitInfo(me,MyUn[uix],UnitInfo);
    176 UnitInfo.Flags:=UnitInfo.Flags and not unFortified;
    177 NoMap.PaintUnit(1,0,UnitInfo,0);
    178 BitBlt(ca.Handle,xm-8-4-66,ym+8+12,66,48,Buffer.Canvas.Handle,0,0,SRCCOPY);
    179 end; {PaintBattleOutcome}
    180 
     185    else Sprite(Buffer,HGrTerrain,0,16,66,32,1+7*(xxt*2+1),1+yyt+2*(2+TerrType-fForest)*(yyt*3+1));
     186    end; }
     187  NoMap.PaintUnit(1, 0, UnitInfo, 0);
     188  BitBlt(ca.Handle, xm + 8 + 4, ym - 8 - 12 - 48, 66, 48, Buffer.Canvas.Handle,
     189    0, 0, SRCCOPY);
     190
     191  BitBlt(Buffer.Canvas.Handle, 0, 0, 66, 48, ca.Handle, xm - 8 - 4 - 66,
     192    ym + 8 + 12, SRCCOPY);
     193  MakeUnitInfo(me, MyUn[uix], UnitInfo);
     194  UnitInfo.Flags := UnitInfo.Flags and not unFortified;
     195  NoMap.PaintUnit(1, 0, UnitInfo, 0);
     196  BitBlt(ca.Handle, xm - 8 - 4 - 66, ym + 8 + 12, 66, 48, Buffer.Canvas.Handle,
     197    0, 0, SRCCOPY);
     198end; { PaintBattleOutcome }
    181199
    182200procedure TBattleDlg.FormCreate(Sender: TObject);
    183201begin
    184 OKBtn.Caption:=Phrases.Lookup('BTN_YES');
    185 CancelBtn.Caption:=Phrases.Lookup('BTN_NO');
    186 InitButtons();
     202  OKBtn.Caption := Phrases.Lookup('BTN_YES');
     203  CancelBtn.Caption := Phrases.Lookup('BTN_NO');
     204  InitButtons();
    187205end;
    188206
    189207procedure TBattleDlg.FormShow(Sender: TObject);
    190208begin
    191 if IsSuicideQuery then
    192   begin
    193   ClientWidth:=300;
    194   ClientHeight:=288;
    195   OKBtn.Visible:=true;
    196   CancelBtn.Visible:=true;
    197   Left:=(Screen.Width-ClientWidth) div 2; // center on screen
    198   Top:=(Screen.Height-ClientHeight) div 2;
    199   end
    200 else
    201   begin
    202   ClientWidth:=178;
    203   ClientHeight:=178;
    204   OKBtn.Visible:=false;
    205   CancelBtn.Visible:=false;
     209  if IsSuicideQuery then
     210  begin
     211    ClientWidth := 300;
     212    ClientHeight := 288;
     213    OKBtn.Visible := true;
     214    CancelBtn.Visible := true;
     215    Left := (Screen.Width - ClientWidth) div 2; // center on screen
     216    Top := (Screen.Height - ClientHeight) div 2;
     217  end
     218  else
     219  begin
     220    ClientWidth := 178;
     221    ClientHeight := 178;
     222    OKBtn.Visible := false;
     223    CancelBtn.Visible := false;
    206224  end;
    207225end;
     
    209227procedure TBattleDlg.FormPaint(Sender: TObject);
    210228var
    211 ym,cix,p: integer;
    212 s,s1: string;
    213 begin
    214 with Canvas do
    215   begin
    216   Brush.Color:=0;
    217   FillRect(Rect(0,0,ClientWidth,ClientHeight));
    218   Brush.Style:=bsClear;
    219   PaintBackground(self,3+Border,3+Border,ClientWidth-(6+2*Border),
    220     ClientHeight-(6+2*Border))
    221   end;
    222 Frame(Canvas,Border+1,Border+1,ClientWidth-(2+Border),ClientHeight-(2+Border),
    223   MainTexture.clBevelLight,MainTexture.clBevelShade);
    224 Frame(Canvas,2+Border,2+Border,ClientWidth-(3+Border),ClientHeight-(3+Border),
    225   MainTexture.clBevelLight,MainTexture.clBevelShade);
    226 
    227 if IsSuicideQuery then
    228   begin
    229   Canvas.Font.Assign(UniFont[ftCaption]);
    230   s:=Phrases.Lookup('TITLE_SUICIDE');
    231   RisedTextout(Canvas,(ClientWidth-BiColorTextWidth(Canvas,s)) div 2, 7+Border, s);
    232   Canvas.Font.Assign(UniFont[ftNormal]);
    233   s:=Phrases.Lookup('SUICIDE');
    234   p:=pos('\',s);
    235   if p=0 then
    236     RisedTextout(Canvas,(ClientWidth-BiColorTextWidth(Canvas,s)) div 2, 205, s)
    237   else
     229  ym, cix, p: Integer;
     230  s, s1: string;
     231begin
     232  with Canvas do
     233  begin
     234    Brush.Color := 0;
     235    FillRect(Rect(0, 0, ClientWidth, ClientHeight));
     236    Brush.Style := bsClear;
     237    PaintBackground(self, 3 + Border, 3 + Border,
     238      ClientWidth - (6 + 2 * Border), ClientHeight - (6 + 2 * Border))
     239  end;
     240  Frame(Canvas, Border + 1, Border + 1, ClientWidth - (2 + Border),
     241    ClientHeight - (2 + Border), MainTexture.clBevelLight,
     242    MainTexture.clBevelShade);
     243  Frame(Canvas, 2 + Border, 2 + Border, ClientWidth - (3 + Border),
     244    ClientHeight - (3 + Border), MainTexture.clBevelLight,
     245    MainTexture.clBevelShade);
     246
     247  if IsSuicideQuery then
     248  begin
     249    Canvas.Font.Assign(UniFont[ftCaption]);
     250    s := Phrases.Lookup('TITLE_SUICIDE');
     251    RisedTextOut(Canvas, (ClientWidth - BiColorTextWidth(Canvas, s)) div 2,
     252      7 + Border, s);
     253    Canvas.Font.Assign(UniFont[ftNormal]);
     254    s := Phrases.Lookup('SUICIDE');
     255    p := pos('\', s);
     256    if p = 0 then
     257      RisedTextOut(Canvas, (ClientWidth - BiColorTextWidth(Canvas, s))
     258        div 2, 205, s)
     259    else
    238260    begin
    239     s1:=copy(s,1,p-1);
    240     RisedTextout(Canvas,(ClientWidth-BiColorTextWidth(Canvas,s1)) div 2,
    241       205-MessageLineSpacing div 2, s1);
    242     s1:=copy(s,p+1,255);
    243     RisedTextout(Canvas,(ClientWidth-BiColorTextWidth(Canvas,s1)) div 2,
    244       205+(MessageLineSpacing-MessageLineSpacing div 2), s1);
     261      s1 := copy(s, 1, p - 1);
     262      RisedTextOut(Canvas, (ClientWidth - BiColorTextWidth(Canvas, s1)) div 2,
     263        205 - MessageLineSpacing div 2, s1);
     264      s1 := copy(s, p + 1, 255);
     265      RisedTextOut(Canvas, (ClientWidth - BiColorTextWidth(Canvas, s1)) div 2,
     266        205 + (MessageLineSpacing - MessageLineSpacing div 2), s1);
    245267    end;
    246   ym:=110
    247   end
    248 else ym:=ClientHeight div 2;
    249 Canvas.Font.Assign(UniFont[ftSmall]);
    250 PaintBattleOutcome(Canvas, ClientWidth div 2, ym, uix, ToLoc, Forecast);
    251 
    252 for cix:=0 to ControlCount-1 do
    253   if (Controls[cix].Visible) and (Controls[cix] is TButtonBase) then
    254     BtnFrame(Canvas,Controls[cix].BoundsRect,MainTexture);
     268    ym := 110
     269  end
     270  else
     271    ym := ClientHeight div 2;
     272  Canvas.Font.Assign(UniFont[ftSmall]);
     273  PaintBattleOutcome(Canvas, ClientWidth div 2, ym, uix, ToLoc, Forecast);
     274
     275  for cix := 0 to ControlCount - 1 do
     276    if (Controls[cix].Visible) and (Controls[cix] is TButtonBase) then
     277      BtnFrame(Canvas, Controls[cix].BoundsRect, MainTexture);
    255278end;
    256279
     
    258281  Shift: TShiftState; X, Y: Integer);
    259282begin
    260 if not IsSuicideQuery then
    261   Close;
     283  if not IsSuicideQuery then
     284    Close;
    262285end;
    263286
    264287procedure TBattleDlg.FormDeactivate(Sender: TObject);
    265288begin
    266 if not IsSuicideQuery then
    267   Close
     289  if not IsSuicideQuery then
     290    Close
    268291end;
    269292
     
    271294  Shift: TShiftState);
    272295begin
    273 if not IsSuicideQuery and (Key<>VK_SHIFT) then
    274   begin
    275   Close;
    276   MainScreen.Update;
    277   if Key<>VK_ESCAPE then
    278     MainScreen.FormKeyDown(Sender, Key, Shift);
     296  if not IsSuicideQuery and (Key <> VK_SHIFT) then
     297  begin
     298    Close;
     299    MainScreen.Update;
     300    if Key <> VK_ESCAPE then
     301      MainScreen.FormKeyDown(Sender, Key, Shift);
    279302  end
    280303end;
     
    282305procedure TBattleDlg.OKBtnClick(Sender: TObject);
    283306begin
    284 ModalResult:=mrOK;
     307  ModalResult := mrOK;
    285308end;
    286309
    287310procedure TBattleDlg.CancelBtnClick(Sender: TObject);
    288311begin
    289 ModalResult:=mrCancel;
     312  ModalResult := mrCancel;
    290313end;
    291314
    292315end.
    293 
Note: See TracChangeset for help on using the changeset viewer.