Changeset 460 for trunk/LocalPlayer/UnitStat.pas
- Timestamp:
- Nov 28, 2023, 3:16:24 PM (12 months ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/LocalPlayer/UnitStat.pas
r456 r460 5 5 6 6 uses 7 Protocol, ClientTools, Term, ScreenTools, BaseWin, 8 LCLIntf, LCLType, SysUtils, Classes, Graphics, Controls, Forms, 9 ButtonB, ButtonC, IsoEngine; 7 Protocol, ClientTools, ScreenTools, BaseWin, LCLIntf, LCLType, SysUtils, 8 Classes, Graphics, Controls, Forms, ButtonB, ButtonC, IsoEngine; 10 9 11 10 type 11 TUnitStatDialogKind = (dkOwnModel, dkOwnUnit, dkEnemyModel, dkEnemyUnit, 12 dkEnemyCityDefense, dkEnemyCity); 13 12 14 TUnitStatDlg = class(TBufferedDrawDlg) 13 15 SwitchBtn: TButtonB; … … 26 28 private 27 29 NoMap: TIsoMap; 30 protected 31 mixShow, // for dkOwnModel 32 uixShow, euixShow, ecixShow, UnitLoc, AgePrepared: Integer; 33 // for dkEnemyUnit, euixShow=-1 -> 34 mox: ^TModelInfo; // for dkEnemyModel 35 Kind: TUnitStatDialogKind; 36 Back: TBitmap; 37 Template: TBitmap; 38 procedure OffscreenPaint; override; 28 39 public 29 40 procedure CheckAge; … … 34 45 procedure ShowNewContent_EnemyModel(NewMode: TWindowMode; emix: Integer); 35 46 procedure ShowNewContent_EnemyCity(NewMode: TWindowMode; Loc: Integer); 36 37 protected 38 mixShow, // for dkOwnModel 39 uixShow, euixShow, ecixShow, UnitLoc, AgePrepared: Integer; 40 // for dkEnemyUnit, euixShow=-1 -> 41 mox: ^TModelInfo; // for dkEnemyModel 42 Kind: (dkOwnModel, dkOwnUnit, dkEnemyModel, dkEnemyUnit, dkEnemyCityDefense, 43 dkEnemyCity); 44 Back, Template: TBitmap; 45 procedure OffscreenPaint; override; 46 end; 47 48 var 49 UnitStatDlg: TUnitStatDlg; 47 end; 48 50 49 51 50 implementation 52 51 53 52 uses 54 T ribes, Help, Directories, Texture;53 Term, Tribes, Help, Directories, Texture; 55 54 56 55 {$R *.lfm} … … 82 81 Back.PixelFormat := pf24bit; 83 82 Back.SetSize(5 * wCommon, hMax); 84 Back.Canvas.FillRect(0, 0, Back.Width, Back.Height);83 Back.Canvas.FillRect(0, 0, Back.Width, Back.Height); 85 84 Template := TBitmap.Create; 86 85 Template.PixelFormat := pf24bit; … … 121 120 procedure TUnitStatDlg.FormShow(Sender: TObject); 122 121 var 123 owner, mix: Integer;122 Owner, mix: Integer; 124 123 IsSpecialUnit: Boolean; 125 124 begin … … 138 137 begin 139 138 mox := @MyRO.EnemyModel[emix]; 140 if not Assigned(Tribe[ owner].ModelPicture[mix].HGr) then139 if not Assigned(Tribe[Owner].ModelPicture[mix].HGr) then 141 140 InitEnemyModel(emix); 142 end 141 end; 143 142 end 144 143 else … … 153 152 end; 154 153 case Kind of 155 dkOwnModel: 156 ClientHeight := hOwnModel; 157 dkOwnUnit: 158 ClientHeight := hEnemyUnit; 159 dkEnemyModel: 160 ClientHeight := hEnemyModel; 161 dkEnemyUnit: 162 ClientHeight := hEnemyUnit; 163 dkEnemyCityDefense: 164 ClientHeight := hEnemyCityDefense; 165 dkEnemyCity: 166 ClientHeight := hEnemyCity; 154 dkOwnModel: ClientHeight := hOwnModel; 155 dkOwnUnit: ClientHeight := hEnemyUnit; 156 dkEnemyModel: ClientHeight := hEnemyModel; 157 dkEnemyUnit: ClientHeight := hEnemyUnit; 158 dkEnemyCityDefense: ClientHeight := hEnemyCityDefense; 159 dkEnemyCity: ClientHeight := hEnemyCity; 167 160 end; 168 161 … … 171 164 Left := UserLeft; 172 165 Top := UserTop; 173 end 174 else 175 begin 166 end else begin 176 167 Left := (Screen.Width - Width) div 2; 177 168 Top := (Screen.Height - Height) div 2; … … 188 179 begin 189 180 case Kind of 190 dkOwnModel: 191 begin 192 owner := Me; 193 mix := mixShow; 194 IsSpecialUnit := MyModel[mix].Kind >= $10; 195 end; 196 dkOwnUnit: 197 begin 198 owner := Me; 199 mix := MyUn[uixShow].mix; 200 IsSpecialUnit := MyModel[mix].Kind >= $10; 201 end 202 else 203 begin 204 owner := mox.owner; 181 dkOwnModel: begin 182 Owner := Me; 183 mix := mixShow; 184 IsSpecialUnit := MyModel[mix].Kind >= $10; 185 end; 186 dkOwnUnit: begin 187 Owner := Me; 188 mix := MyUn[uixShow].mix; 189 IsSpecialUnit := MyModel[mix].Kind >= $10; 190 end; 191 else begin 192 Owner := mox.Owner; 205 193 mix := mox.mix; 206 194 IsSpecialUnit := mox.Kind >= $10; … … 271 259 begin 272 260 UserLeft := Left; 273 UserTop := Top 274 end; 275 if OffscreenUser = self then261 UserTop := Top; 262 end; 263 if OffscreenUser = Self then 276 264 OffscreenUser := nil; 277 265 end; … … 343 331 mcFirstNonCap .. nFeature - 1: 344 332 if mi.Cap and (1 shl (I - mcFirstNonCap)) <> 0 then 345 num := 1 333 num := 1; 346 334 end; 347 335 if (num > 0) and … … 357 345 Brush.Style := bsClear; 358 346 Textout(X - 3 + dx + 1, Y, S); 359 Inc(dx, W + 1) 347 Inc(dx, W + 1); 360 348 end; 361 349 Brush.Color := $C0C0C0; … … 364 352 Sprite(dst, HGrSystem, X - 1 + dx, Y + 4, 10, 10, 365 353 66 + I mod 11 * 11, 137 + I div 11 * 11); 366 Inc(dx, 15) 354 Inc(dx, 15); 367 355 end; 368 356 end; 369 357 end; 370 end; { featurebar }358 end; 371 359 372 360 procedure NumberBarS(dst: TBitmap; X, Y: Integer; Cap, S: string; T: TTexture); … … 387 375 388 376 case Kind of 389 dkOwnModel: 390 begin 391 BitBltCanvas(Offscreen.Canvas, 0, 0, wCommon, hOwnModel, 392 Back.Canvas, 0, 0); 393 yView := 13; 394 yTotal := 92; 395 end; 396 dkEnemyModel: 397 begin 398 BitBltCanvas(Offscreen.Canvas, 0, 0, wCommon, hEnemyModel, 399 Back.Canvas, wCommon, 0); 400 yView := 13; 401 yTotal := 92; 402 end; 403 dkEnemyUnit, dkOwnUnit: 404 begin 405 BitBltCanvas(Offscreen.Canvas, 0, 0, wCommon, hEnemyUnit, 406 Back.Canvas, 2 * wCommon, 0); 407 yView := 13; 408 yTotal := 123; 409 end; 410 dkEnemyCityDefense: 411 begin 412 BitBltCanvas(Offscreen.Canvas, 0, 0, wCommon, hEnemyCityDefense, 413 Back.Canvas, 3 * wCommon, 0); 414 yView := 171; 415 yTotal := 231; 416 end; 417 dkEnemyCity: 418 begin 419 BitBltCanvas(Offscreen.Canvas, 0, 0, wCommon, hEnemyCity, 420 Back.Canvas, 4 * wCommon, 0); 421 end; 377 dkOwnModel: begin 378 BitBltCanvas(Offscreen.Canvas, 0, 0, wCommon, hOwnModel, 379 Back.Canvas, 0, 0); 380 yView := 13; 381 yTotal := 92; 382 end; 383 dkEnemyModel: begin 384 BitBltCanvas(Offscreen.Canvas, 0, 0, wCommon, hEnemyModel, 385 Back.Canvas, wCommon, 0); 386 yView := 13; 387 yTotal := 92; 388 end; 389 dkEnemyUnit, dkOwnUnit: begin 390 BitBltCanvas(Offscreen.Canvas, 0, 0, wCommon, hEnemyUnit, 391 Back.Canvas, 2 * wCommon, 0); 392 yView := 13; 393 yTotal := 123; 394 end; 395 dkEnemyCityDefense: begin 396 BitBltCanvas(Offscreen.Canvas, 0, 0, wCommon, hEnemyCityDefense, 397 Back.Canvas, 3 * wCommon, 0); 398 yView := 171; 399 yTotal := 231; 400 end; 401 dkEnemyCity: begin 402 BitBltCanvas(Offscreen.Canvas, 0, 0, wCommon, hEnemyCity, 403 Back.Canvas, 4 * wCommon, 0); 404 end; 422 405 end; 423 406 MarkUsedOffscreen(ClientWidth, ClientHeight); … … 438 421 1: J := imCoastalFort; 439 422 2: J := imMissileBat; 440 3: J := imBunker 423 3: J := imBunker; 441 424 end; 442 425 Frame(Offscreen.Canvas, X - 1, yImp - 1, X + xSizeSmall, … … 734 717 procedure TUnitStatDlg.HelpBtnClick(Sender: TObject); 735 718 begin 736 HelpDlg.ShowNewContent(wmPersistent, hkModel, 0);719 MainScreen.HelpDlg.ShowNewContent(wmPersistent, hkModel, 0); 737 720 end; 738 721
Note:
See TracChangeset
for help on using the changeset viewer.