Changeset 447 for trunk/LocalPlayer/UnitStat.pas
- Timestamp:
- May 19, 2022, 10:39:34 PM (2 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/LocalPlayer/UnitStat.pas
r442 r447 28 28 public 29 29 procedure CheckAge; 30 procedure ShowNewContent_OwnModel(NewMode: TWindowMode; mix: integer);31 procedure ShowNewContent_OwnUnit(NewMode: TWindowMode; uix: integer);32 procedure ShowNewContent_EnemyUnit(NewMode: TWindowMode; euix: integer);33 procedure ShowNewContent_EnemyLoc(NewMode: TWindowMode; Loc: integer);34 procedure ShowNewContent_EnemyModel(NewMode: TWindowMode; emix: integer);35 procedure ShowNewContent_EnemyCity(NewMode: TWindowMode; Loc: integer);30 procedure ShowNewContent_OwnModel(NewMode: TWindowMode; mix: Integer); 31 procedure ShowNewContent_OwnUnit(NewMode: TWindowMode; uix: Integer); 32 procedure ShowNewContent_EnemyUnit(NewMode: TWindowMode; euix: Integer); 33 procedure ShowNewContent_EnemyLoc(NewMode: TWindowMode; Loc: Integer); 34 procedure ShowNewContent_EnemyModel(NewMode: TWindowMode; emix: Integer); 35 procedure ShowNewContent_EnemyCity(NewMode: TWindowMode; Loc: Integer); 36 36 37 37 protected 38 38 mixShow, // for dkOwnModel 39 uixShow, euixShow, ecixShow, UnitLoc, AgePrepared: integer;39 uixShow, euixShow, ecixShow, UnitLoc, AgePrepared: Integer; 40 40 // for dkEnemyUnit, euixShow=-1 -> 41 41 mox: ^TModelInfo; // for dkEnemyModel … … 121 121 procedure TUnitStatDlg.FormShow(Sender: TObject); 122 122 var 123 owner, mix: integer;124 IsSpecialUnit: boolean;123 owner, mix: Integer; 124 IsSpecialUnit: Boolean; 125 125 begin 126 126 if Kind in [dkEnemyUnit, dkEnemyCityDefense, dkEnemyCity] then … … 132 132 euixShow := MyRO.nEnemyUn - 1; 133 133 while (euixShow >= 0) and (MyRO.EnemyUn[euixShow].Loc <> UnitLoc) do 134 dec(euixShow);135 assert(euixShow >= 0);134 Dec(euixShow); 135 Assert(euixShow >= 0); 136 136 end; 137 137 with MyRO.EnemyUn[euixShow] do … … 148 148 ecixShow := MyRO.nEnemyCity - 1; 149 149 while (ecixShow >= 0) and (MyRO.EnemyCity[ecixShow].Loc <> UnitLoc) do 150 dec(ecixShow);151 assert(ecixShow >= 0);150 Dec(ecixShow); 151 Assert(ecixShow >= 0); 152 152 end; 153 153 end; … … 178 178 end; 179 179 180 SwitchBtn.Visible := not supervising and (Kind = dkOwnModel);181 ConscriptsBtn.Visible := not supervising and (Kind = dkOwnModel) and180 SwitchBtn.Visible := not Supervising and (Kind = dkOwnModel); 181 ConscriptsBtn.Visible := not Supervising and (Kind = dkOwnModel) and 182 182 (MyRO.Tech[adConscription] >= tsApplicable) and 183 183 (MyModel[mixShow].Domain = dGround) and (MyModel[mixShow].Kind < mkScout); 184 IsSpecialUnit := false;184 IsSpecialUnit := False; 185 185 if Kind in [dkEnemyCity, dkEnemyCityDefense] then 186 186 Caption := CityName(MyRO.EnemyCity[ecixShow].ID) … … 190 190 dkOwnModel: 191 191 begin 192 owner := me;192 owner := Me; 193 193 mix := mixShow; 194 194 IsSpecialUnit := MyModel[mix].Kind >= $10; … … 196 196 dkOwnUnit: 197 197 begin 198 owner := me;198 owner := Me; 199 199 mix := MyUn[uixShow].mix; 200 200 IsSpecialUnit := MyModel[mix].Kind >= $10; … … 218 218 end; 219 219 220 procedure TUnitStatDlg.ShowNewContent_OwnModel(NewMode: TWindowMode; mix: integer);220 procedure TUnitStatDlg.ShowNewContent_OwnModel(NewMode: TWindowMode; mix: Integer); 221 221 begin 222 222 Kind := dkOwnModel; … … 225 225 end; 226 226 227 procedure TUnitStatDlg.ShowNewContent_OwnUnit(NewMode: TWindowMode; uix: integer);227 procedure TUnitStatDlg.ShowNewContent_OwnUnit(NewMode: TWindowMode; uix: Integer); 228 228 begin 229 229 Kind := dkOwnUnit; … … 232 232 end; 233 233 234 procedure TUnitStatDlg.ShowNewContent_EnemyUnit(NewMode: TWindowMode; euix: integer);234 procedure TUnitStatDlg.ShowNewContent_EnemyUnit(NewMode: TWindowMode; euix: Integer); 235 235 begin 236 236 Kind := dkEnemyUnit; … … 240 240 end; 241 241 242 procedure TUnitStatDlg.ShowNewContent_EnemyLoc(NewMode: TWindowMode; Loc: integer);242 procedure TUnitStatDlg.ShowNewContent_EnemyLoc(NewMode: TWindowMode; Loc: Integer); 243 243 begin 244 244 Kind := dkEnemyUnit; … … 248 248 end; 249 249 250 procedure TUnitStatDlg.ShowNewContent_EnemyModel(NewMode: TWindowMode; emix: integer);250 procedure TUnitStatDlg.ShowNewContent_EnemyModel(NewMode: TWindowMode; emix: Integer); 251 251 begin 252 252 Kind := dkEnemyModel; … … 255 255 end; 256 256 257 procedure TUnitStatDlg.ShowNewContent_EnemyCity(NewMode: TWindowMode; Loc: integer);257 procedure TUnitStatDlg.ShowNewContent_EnemyCity(NewMode: TWindowMode; Loc: Integer); 258 258 begin 259 259 if MyMap[Loc] and fUnit <> 0 then … … 286 286 PPicture: ^TModelPicture; 287 287 288 function IsToCount(emix: integer): boolean;288 function IsToCount(emix: Integer): Boolean; 289 289 var 290 290 PTestPicture: ^TModelPicture; … … 294 294 PTestPicture := @Tribe[MyRO.EnemyModel[emix].owner].ModelPicture 295 295 [MyRO.EnemyModel[emix].mix]; 296 result := (PPicture.HGr = PTestPicture.HGr) and296 Result := (PPicture.HGr = PTestPicture.HGr) and 297 297 (PPicture.pix = PTestPicture.pix) and 298 298 (ModelHash(mox^) = ModelHash(MyRO.EnemyModel[emix])); 299 299 end 300 300 else 301 result := (MyRO.EnemyModel[emix].owner = mox.owner) and301 Result := (MyRO.EnemyModel[emix].owner = mox.owner) and 302 302 (MyRO.EnemyModel[emix].mix = mox.mix); 303 303 end; 304 304 305 procedure FeatureBar(dst: TBitmap; x, y: integer; const mi: TModelInfo;305 procedure FeatureBar(dst: TBitmap; X, Y: Integer; const mi: TModelInfo; 306 306 T: TTexture); 307 307 var 308 i, w, dx, num: integer;309 s: string;310 begin 311 DarkGradient(dst.Canvas, x - 6, y+ 1, 180, 1);308 I, W, dx, num: Integer; 309 S: string; 310 begin 311 DarkGradient(dst.Canvas, X - 6, Y + 1, 180, 1); 312 312 with dst.Canvas do 313 313 if mi.Kind >= $10 then 314 314 begin 315 s:= Phrases.Lookup('UNITSPECIAL');315 S := Phrases.Lookup('UNITSPECIAL'); 316 316 Font.Color := $000000; 317 Textout( x - 1, y + 1, s);317 Textout(X - 1, Y + 1, S); 318 318 Font.Color := $B0B0B0; 319 Textout( x - 2, y, s);319 Textout(X - 2, Y, S); 320 320 end 321 321 else … … 323 323 Font.Color := $000000; 324 324 dx := 2; 325 for i:= 3 to nFeature - 1 do325 for I := 3 to nFeature - 1 do 326 326 begin 327 327 num := 0; 328 case iof328 case I of 329 329 mcSeaTrans: 330 330 if mi.Domain = dSea then … … 342 342 num := mi.TTrans; 343 343 mcFirstNonCap .. nFeature - 1: 344 if mi.Cap and (1 shl ( i- mcFirstNonCap)) <> 0 then344 if mi.Cap and (1 shl (I - mcFirstNonCap)) <> 0 then 345 345 num := 1 346 346 end; 347 347 if (num > 0) and 348 (( i<> mcSE) or (mi.Cap and (1 shl (mcNP - mcFirstNonCap)) = 0))348 ((I <> mcSE) or (mi.Cap and (1 shl (mcNP - mcFirstNonCap)) = 0)) 349 349 then 350 350 begin 351 351 if num > 1 then 352 352 begin 353 s:= IntToStr(num);354 w := TextWidth(s);353 S := IntToStr(num); 354 W := TextWidth(S); 355 355 Brush.Color := $FFFFFF; 356 FillRect(Rect( x - 3 + dx, y + 2, x + w - 1 + dx, y+ 16));356 FillRect(Rect(X - 3 + dx, Y + 2, X + W - 1 + dx, Y + 16)); 357 357 Brush.Style := bsClear; 358 Textout( x - 3 + dx + 1, y, s);359 inc(dx, w+ 1)358 Textout(X - 3 + dx + 1, Y, S); 359 Inc(dx, W + 1) 360 360 end; 361 361 Brush.Color := $C0C0C0; 362 FrameRect(Rect( x - 3 + dx, y + 2, x + 11 + dx, y+ 16));362 FrameRect(Rect(X - 3 + dx, Y + 2, X + 11 + dx, Y + 16)); 363 363 Brush.Style := bsClear; 364 Sprite(dst, HGrSystem, x - 1 + dx, y+ 4, 10, 10,365 66 + i mod 11 * 11, 137 + idiv 11 * 11);366 inc(dx, 15)364 Sprite(dst, HGrSystem, X - 1 + dx, Y + 4, 10, 10, 365 66 + I mod 11 * 11, 137 + I div 11 * 11); 366 Inc(dx, 15) 367 367 end; 368 368 end; … … 370 370 end; { featurebar } 371 371 372 procedure NumberBarS(dst: TBitmap; x, y: integer; Cap, s: string; T: TTexture);373 begin 374 DLine(dst.Canvas, x - 2, x + 170, y+ 16, T.ColorBevelShade, T.ColorBevelLight);375 LoweredTextOut(dst.Canvas, -1, T, x - 2, y, Cap);376 RisedTextout(dst.Canvas, x + 170 - BiColorTextWidth(dst.Canvas, s), y, s);372 procedure NumberBarS(dst: TBitmap; X, Y: Integer; Cap, S: string; T: TTexture); 373 begin 374 DLine(dst.Canvas, X - 2, X + 170, Y + 16, T.ColorBevelShade, T.ColorBevelLight); 375 LoweredTextOut(dst.Canvas, -1, T, X - 2, Y, Cap); 376 RisedTextout(dst.Canvas, X + 170 - BiColorTextWidth(dst.Canvas, S), Y, S); 377 377 end; 378 378 379 379 var 380 i, j, x, y, cix, uix, emix, InProd, Available, Destroyed, Loc, Cnt, yView,381 yTotal, yCaption: integer;382 s: string;380 I, J, X, Y, cix, uix, emix, InProd, Available, Destroyed, Loc, Cnt, yView, 381 yTotal, yCaption: Integer; 382 S: string; 383 383 ui: TUnitInfo; 384 384 mi: TModelInfo; … … 389 389 dkOwnModel: 390 390 begin 391 BitBltCanvas( offscreen.Canvas, 0, 0, wCommon, hOwnModel,391 BitBltCanvas(Offscreen.Canvas, 0, 0, wCommon, hOwnModel, 392 392 Back.Canvas, 0, 0); 393 393 yView := 13; … … 396 396 dkEnemyModel: 397 397 begin 398 BitBltCanvas( offscreen.Canvas, 0, 0, wCommon, hEnemyModel,398 BitBltCanvas(Offscreen.Canvas, 0, 0, wCommon, hEnemyModel, 399 399 Back.Canvas, wCommon, 0); 400 400 yView := 13; … … 403 403 dkEnemyUnit, dkOwnUnit: 404 404 begin 405 BitBltCanvas( offscreen.Canvas, 0, 0, wCommon, hEnemyUnit,405 BitBltCanvas(Offscreen.Canvas, 0, 0, wCommon, hEnemyUnit, 406 406 Back.Canvas, 2 * wCommon, 0); 407 407 yView := 13; … … 410 410 dkEnemyCityDefense: 411 411 begin 412 BitBltCanvas( offscreen.Canvas, 0, 0, wCommon, hEnemyCityDefense,412 BitBltCanvas(Offscreen.Canvas, 0, 0, wCommon, hEnemyCityDefense, 413 413 Back.Canvas, 3 * wCommon, 0); 414 414 yView := 171; … … 417 417 dkEnemyCity: 418 418 begin 419 BitBltCanvas( offscreen.Canvas, 0, 0, wCommon, hEnemyCity,419 BitBltCanvas(Offscreen.Canvas, 0, 0, wCommon, hEnemyCity, 420 420 Back.Canvas, 4 * wCommon, 0); 421 421 end; … … 427 427 begin // show city defense facilities 428 428 Cnt := 0; 429 for i:= 0 to 3 do430 if MyRO.EnemyCity[ecixShow].Flags and (2 shl i) <> 0 then431 inc(Cnt);432 x:= (wCommon - Cnt * xSizeSmall) div 2 - (Cnt - 1) * 2;433 for i:= 0 to 3 do434 if MyRO.EnemyCity[ecixShow].Flags and (2 shl i) <> 0 then435 begin 436 case iof437 0: j:= imWalls;438 1: j:= imCoastalFort;439 2: j:= imMissileBat;440 3: j:= imBunker429 for I := 0 to 3 do 430 if MyRO.EnemyCity[ecixShow].Flags and (2 shl I) <> 0 then 431 Inc(Cnt); 432 X := (wCommon - Cnt * xSizeSmall) div 2 - (Cnt - 1) * 2; 433 for I := 0 to 3 do 434 if MyRO.EnemyCity[ecixShow].Flags and (2 shl I) <> 0 then 435 begin 436 case I of 437 0: J := imWalls; 438 1: J := imCoastalFort; 439 2: J := imMissileBat; 440 3: J := imBunker 441 441 end; 442 Frame( offscreen.Canvas, x - 1, yImp - 1, x+ xSizeSmall,442 Frame(Offscreen.Canvas, X - 1, yImp - 1, X + xSizeSmall, 443 443 yImp + ySizeSmall, MainTexture.ColorBevelLight, 444 444 MainTexture.ColorBevelShade); 445 BitBltCanvas( offscreen.Canvas, x, yImp, xSizeSmall, ySizeSmall,446 SmallImp.Canvas, jmod 7 * xSizeSmall,447 ( j+ SystemIconLines * 7) div 7 * ySizeSmall);448 inc(x, xSizeSmall + 4);445 BitBltCanvas(Offscreen.Canvas, X, yImp, xSizeSmall, ySizeSmall, 446 SmallImp.Canvas, J mod 7 * xSizeSmall, 447 (J + SystemIconLines * 7) div 7 * ySizeSmall); 448 Inc(X, xSizeSmall + 4); 449 449 end; 450 450 end; … … 454 454 PPicture := @Tribe[mox.owner].ModelPicture[mox.mix]; 455 455 Available := 0; 456 if G.Difficulty[ me] = 0 then // supervisor -- count stacked units too456 if G.Difficulty[Me] = 0 then // supervisor -- count stacked units too 457 457 for Loc := 0 to G.lx * G.ly - 1 do 458 458 begin 459 459 if MyMap[Loc] and fUnit <> 0 then 460 460 begin 461 Server(sGetUnits, me, Loc, Cnt);461 Server(sGetUnits, Me, Loc, Cnt); 462 462 for uix := 0 to Cnt - 1 do 463 463 if IsToCount(MyRO.EnemyUn[MyRO.nEnemyUn + uix].emix) then 464 inc(Available);464 Inc(Available); 465 465 end; 466 466 end … … 469 469 if (MyRO.EnemyUn[uix].Loc >= 0) and IsToCount(MyRO.EnemyUn[uix].emix) 470 470 then 471 inc(Available);471 Inc(Available); 472 472 Destroyed := 0; 473 473 for emix := 0 to MyRO.nEnemyModel - 1 do 474 474 if IsToCount(emix) then 475 inc(Destroyed, MyRO.EnemyModel[emix].Lost);475 Inc(Destroyed, MyRO.EnemyModel[emix].Lost); 476 476 end 477 477 else … … 480 480 for uix := 0 to MyRO.nUn - 1 do 481 481 if (MyUn[uix].Loc >= 0) and (MyUn[uix].mix = mixShow) then 482 inc(Available);482 Inc(Available); 483 483 InProd := 0; 484 484 for cix := 0 to MyRO.nCity - 1 do 485 485 if (MyCity[cix].Loc >= 0) and 486 486 (MyCity[cix].Project and (cpImp + cpIndex) = mixShow) then 487 inc(InProd);488 end; 489 490 offscreen.Canvas.Font.Assign(UniFont[ftSmall]);487 Inc(InProd); 488 end; 489 490 Offscreen.Canvas.Font.Assign(UniFont[ftSmall]); 491 491 if Kind in [dkEnemyCityDefense, dkEnemyCity] then 492 492 begin 493 NoMap.SetOutput( offscreen);494 NoMap.PaintCity(ClientWidth div 2, 53, MyRO.EnemyCity[ecixShow], false);495 496 s:= Tribe[MyRO.EnemyCity[ecixShow].owner].TPhrase('UNITOWNER');497 LoweredTextOut( offscreen.Canvas, -1, MainTexture,498 (ClientWidth - BiColorTextWidth( offscreen.Canvas, s)) div 2, 105, s);493 NoMap.SetOutput(Offscreen); 494 NoMap.PaintCity(ClientWidth div 2, 53, MyRO.EnemyCity[ecixShow], False); 495 496 S := Tribe[MyRO.EnemyCity[ecixShow].owner].TPhrase('UNITOWNER'); 497 LoweredTextOut(Offscreen.Canvas, -1, MainTexture, 498 (ClientWidth - BiColorTextWidth(Offscreen.Canvas, S)) div 2, 105, S); 499 499 end; 500 500 … … 502 502 begin // show unit stats 503 503 if Kind = dkOwnModel then 504 MakeModelInfo( me, mixShow, MyModel[mixShow], mi)504 MakeModelInfo(Me, mixShow, MyModel[mixShow], mi) 505 505 else if Kind = dkOwnUnit then 506 506 begin 507 MakeUnitInfo( me, MyUn[uixShow], ui);508 MakeModelInfo( me, MyUn[uixShow].mix, MyModel[MyUn[uixShow].mix], mi);507 MakeUnitInfo(Me, MyUn[uixShow], ui); 508 MakeModelInfo(Me, MyUn[uixShow].mix, MyModel[MyUn[uixShow].mix], mi); 509 509 end 510 510 else … … 522 522 { Frame(offscreen.canvas,xView-1,yView-1,xView+64,yView+48, 523 523 MainTexture.ColorBevelShade,MainTexture.ColorBevelLight); 524 RFrame( offscreen.canvas,xView-2,yView-2,xView+65,yView+49,524 RFrame(Offscreen.Canvas,xView-2,yView-2,xView+65,yView+49, 525 525 MainTexture.ColorBevelShade,MainTexture.ColorBevelLight); } 526 with offscreen.Canvas do526 with Offscreen.Canvas do 527 527 begin 528 528 Brush.Color := HGrSystem.Data.Canvas.Pixels[98, 67]; 529 offscreen.Canvas.FillRect(Rect(xView, yView, xView + 64,529 Offscreen.Canvas.FillRect(Rect(xView, yView, xView + 64, 530 530 yView + 16)); 531 531 Brush.Style := bsClear; … … 534 534 if MyMap[Loc] and fTerrain >= fForest then 535 535 begin 536 x:= 1 + 2 * (xxt * 2 + 1);537 y:= 1 + yyt + 2 * (yyt * 3 + 1);536 X := 1 + 2 * (xxt * 2 + 1); 537 Y := 1 + yyt + 2 * (yyt * 3 + 1); 538 538 end 539 539 else 540 540 begin 541 x := integer(MyMap[Loc] and fTerrain) * (xxt * 2 + 1) + 1;542 y:= 1 + yyt;541 X := Integer(MyMap[Loc] and fTerrain) * (xxt * 2 + 1) + 1; 542 Y := 1 + yyt; 543 543 end; 544 for j:= -1 to 1 do545 for i:= -1 to 1 do546 if ( i + j) and 1 = 0 then544 for J := -1 to 1 do 545 for I := -1 to 1 do 546 if (I + J) and 1 = 0 then 547 547 begin 548 Sprite(Buffer, HGrTerrain, i * xxt, j* yyt, xxt * 2,549 yyt * 2, x, y);548 Sprite(Buffer, HGrTerrain, I * xxt, J * yyt, xxt * 2, 549 yyt * 2, X, Y); 550 550 if MyMap[Loc] and (fTerrain or fSpecial) = fGrass or fSpecial1 551 551 then 552 Sprite(Buffer, HGrTerrain, i * xxt, j* yyt, xxt * 2, yyt * 2,552 Sprite(Buffer, HGrTerrain, I * xxt, J * yyt, xxt * 2, yyt * 2, 553 553 1 + 2 * (xxt * 2 + 1), 1 + yyt + 1 * (yyt * 3 + 1)) 554 554 else if (MyMap[Loc] and fTerrain = fForest) and 555 555 IsJungle(Loc div G.lx) then 556 Sprite(Buffer, HGrTerrain, i * xxt, j* yyt, xxt * 2, yyt * 2,556 Sprite(Buffer, HGrTerrain, I * xxt, J * yyt, xxt * 2, yyt * 2, 557 557 1 + 7 * (xxt * 2 + 1), 1 + yyt + 19 * (yyt * 3 + 1)) 558 558 else if MyMap[Loc] and fTerrain >= fForest then 559 Sprite(Buffer, HGrTerrain, i * xxt, j* yyt, xxt * 2, yyt * 2,559 Sprite(Buffer, HGrTerrain, I * xxt, J * yyt, xxt * 2, yyt * 2, 560 560 1 + 7 * (xxt * 2 + 1), 561 1 + yyt + 2 * integer(2 + MyMap[Loc] and fTerrain - fForest)561 1 + yyt + 2 * Integer(2 + MyMap[Loc] and fTerrain - fForest) 562 562 * (yyt * 3 + 1)); 563 563 end; 564 BitBltCanvas( offscreen.Canvas, xView, yView + 16, 64, 32,564 BitBltCanvas(Offscreen.Canvas, xView, yView + 16, 64, 32, 565 565 Buffer.Canvas, 1, 0); 566 566 567 567 // show unit, experience and health 568 Sprite( offscreen, HGr, xView, yView, 64, 48, pix mod 10 * 65 + 1,568 Sprite(Offscreen, HGr, xView, yView, 64, 48, pix mod 10 * 65 + 1, 569 569 pix div 10 * 49 + 1); 570 570 if Flags and unFortified <> 0 then 571 Sprite( offscreen, HGrStdUnits, xView, yView, xxu * 2, yyu * 2,571 Sprite(Offscreen, HGrStdUnits, xView, yView, xxu * 2, yyu * 2, 572 572 1 + 6 * (xxu * 2 + 1), 1); 573 FrameImage( offscreen.Canvas, HGrSystem.Data, xView - 20,573 FrameImage(Offscreen.Canvas, HGrSystem.Data, xView - 20, 574 574 yView + 5, 12, 14, 121 + Exp div ExpCost * 13, 28); 575 575 if Health < 100 then 576 576 begin 577 s:= IntToStr(Health) + '%';578 LightGradient( offscreen.Canvas, xView - 45, yView + 24, 38,577 S := IntToStr(Health) + '%'; 578 LightGradient(Offscreen.Canvas, xView - 45, yView + 24, 38, 579 579 (ColorOfHealth(Health) and $FEFEFE shr 2) * 3); 580 RisedTextout( offscreen.Canvas, xView - 45 + 20 -581 BiColorTextWidth( offscreen.Canvas, s) div 2, yView + 23, s);580 RisedTextout(Offscreen.Canvas, xView - 45 + 20 - 581 BiColorTextWidth(Offscreen.Canvas, S) div 2, yView + 23, S); 582 582 end; 583 583 584 584 if Kind = dkEnemyUnit then 585 585 begin 586 s:= Tribe[mox.owner].TPhrase('UNITOWNER');587 LoweredTextOut( offscreen.Canvas, -1, MainTexture,588 (ClientWidth - BiColorTextWidth( offscreen.Canvas, s)) div 2,589 yView + 80, s);586 S := Tribe[mox.owner].TPhrase('UNITOWNER'); 587 LoweredTextOut(Offscreen.Canvas, -1, MainTexture, 588 (ClientWidth - BiColorTextWidth(Offscreen.Canvas, S)) div 2, 589 yView + 80, S); 590 590 end; 591 591 end 592 592 else 593 593 begin 594 FrameImage( offscreen.Canvas, BigImp, xView + 4, yView, 56, 40, 0, 0);595 Sprite( offscreen, HGr, xView, yView - 4, 64, 44, pix mod 10 * 65 + 1,594 FrameImage(Offscreen.Canvas, BigImp, xView + 4, yView, 56, 40, 0, 0); 595 Sprite(Offscreen, HGr, xView, yView - 4, 64, 44, pix mod 10 * 65 + 1, 596 596 pix div 10 * 49 + 1); 597 597 end; 598 598 599 DarkGradient( offscreen.Canvas, xTotal - 6, yTotal + 1, 180, 2);600 RisedTextout( offscreen.Canvas, xTotal - 2, yTotal,599 DarkGradient(Offscreen.Canvas, xTotal - 6, yTotal + 1, 180, 2); 600 RisedTextout(Offscreen.Canvas, xTotal - 2, yTotal, 601 601 Phrases.Lookup('UNITSTRENGTH')); 602 s:= IntToStr(mi.Attack) + '/' + IntToStr(mi.Defense);603 RisedTextout( offscreen.Canvas,604 xTotal + 170 - BiColorTextWidth( offscreen.Canvas, s), yTotal, s);605 FeatureBar( offscreen, xTotal, yTotal + 19, mi, MainTexture);606 NumberBarS( offscreen, xTotal, yTotal + 38, Phrases.Lookup('UNITSPEED'),602 S := IntToStr(mi.Attack) + '/' + IntToStr(mi.Defense); 603 RisedTextout(Offscreen.Canvas, 604 xTotal + 170 - BiColorTextWidth(Offscreen.Canvas, S), yTotal, S); 605 FeatureBar(Offscreen, xTotal, yTotal + 19, mi, MainTexture); 606 NumberBarS(Offscreen, xTotal, yTotal + 38, Phrases.Lookup('UNITSPEED'), 607 607 MovementToString(mi.Speed), MainTexture); 608 LoweredTextOut( offscreen.Canvas, -1, MainTexture, xTotal - 2, yTotal + 57,608 LoweredTextOut(Offscreen.Canvas, -1, MainTexture, xTotal - 2, yTotal + 57, 609 609 Phrases.Lookup('UNITCOST')); 610 DLine( offscreen.Canvas, xTotal - 2, xTotal + 170, yTotal + 57 + 16,610 DLine(Offscreen.Canvas, xTotal - 2, xTotal + 170, yTotal + 57 + 16, 611 611 MainTexture.ColorBevelShade, MainTexture.ColorBevelLight); 612 if G.Difficulty[ me] = 0 then613 s:= IntToStr(mi.cost)612 if G.Difficulty[Me] = 0 then 613 S := IntToStr(mi.cost) 614 614 else 615 s := IntToStr(mi.cost * BuildCostMod[G.Difficulty[me]] div 12);616 RisedTextout( offscreen.Canvas,617 xTotal + 159 - BiColorTextWidth( offscreen.Canvas, s), yTotal + 57, s);618 Sprite( offscreen, HGrSystem, xTotal + 160, yTotal + 57 + 5, 10,615 S := IntToStr(mi.cost * BuildCostMod[G.Difficulty[Me]] div 12); 616 RisedTextout(Offscreen.Canvas, 617 xTotal + 159 - BiColorTextWidth(Offscreen.Canvas, S), yTotal + 57, S); 618 Sprite(Offscreen, HGrSystem, xTotal + 160, yTotal + 57 + 5, 10, 619 619 10, 88, 115); 620 620 … … 624 624 begin 625 625 if MyModel[mixShow].Kind = mkEnemyDeveloped then 626 LoweredTextOut( offscreen.Canvas, -1, MainTexture, xTotal - 2,626 LoweredTextOut(Offscreen.Canvas, -1, MainTexture, xTotal - 2, 627 627 (yTotal + StatDown - 19), Phrases.Lookup('UNITADOPT')) 628 628 else 629 LoweredTextOut( offscreen.Canvas, -1, MainTexture, xTotal - 2,629 LoweredTextOut(Offscreen.Canvas, -1, MainTexture, xTotal - 2, 630 630 (yTotal + StatDown - 19), Phrases.Lookup('UNITINTRO')); 631 DLine( offscreen.Canvas, xTotal - 2, xTotal + 170,631 DLine(Offscreen.Canvas, xTotal - 2, xTotal + 170, 632 632 (yTotal + StatDown - 19) + 16, MainTexture.ColorTextShade, 633 633 MainTexture.ColorTextLight); 634 s:= TurnToString(MyModel[mixShow].IntroTurn);635 RisedTextout( offscreen.Canvas,636 xTotal + 170 - BiColorTextWidth( offscreen.Canvas, s),637 (yTotal + StatDown - 19), s);634 S := TurnToString(MyModel[mixShow].IntroTurn); 635 RisedTextout(Offscreen.Canvas, 636 xTotal + 170 - BiColorTextWidth(Offscreen.Canvas, S), 637 (yTotal + StatDown - 19), S); 638 638 end; 639 639 640 NumberBar( offscreen, xTotal, yTotal + StatDown,640 NumberBar(Offscreen, xTotal, yTotal + StatDown, 641 641 Phrases.Lookup('UNITBUILT'), MyModel[mixShow].Built, MainTexture); 642 642 if MyModel[mixShow].Lost > 0 then 643 NumberBar( offscreen, xTotal, yTotal + StatDown + 19,643 NumberBar(Offscreen, xTotal, yTotal + StatDown + 19, 644 644 Phrases.Lookup('UNITLOST'), MyModel[mixShow].Lost, MainTexture); 645 645 if InProd > 0 then 646 NumberBar( offscreen, xTotal, yTotal + StatDown + 57,646 NumberBar(Offscreen, xTotal, yTotal + StatDown + 57, 647 647 Phrases.Lookup('UNITINPROD'), InProd, MainTexture); 648 648 if Available > 0 then 649 NumberBar( offscreen, xTotal, yTotal + StatDown + 38,649 NumberBar(Offscreen, xTotal, yTotal + StatDown + 38, 650 650 Phrases.Lookup('UNITAVAILABLE'), Available, MainTexture); 651 651 … … 674 674 begin 675 675 if Destroyed > 0 then 676 NumberBar( offscreen, xTotal, yTotal + StatDown - 19,676 NumberBar(Offscreen, xTotal, yTotal + StatDown - 19, 677 677 Phrases.Lookup('UNITDESTROYED'), Destroyed, MainTexture); 678 678 if Available > 0 then 679 NumberBar( offscreen, xTotal, yTotal + StatDown,679 NumberBar(Offscreen, xTotal, yTotal + StatDown, 680 680 Phrases.Lookup('UNITKNOWN'), Available, MainTexture); 681 681 end; … … 683 683 end; 684 684 685 offscreen.Canvas.Font.Assign(UniFont[ftNormal]);685 Offscreen.Canvas.Font.Assign(UniFont[ftNormal]); 686 686 case Kind of 687 687 dkOwnModel, dkEnemyModel: … … 692 692 yCaption := 79; 693 693 end; 694 RisedTextout( offscreen.Canvas,695 (ClientWidth - BiColorTextWidth( offscreen.Canvas, Caption)) div 2,694 RisedTextout(Offscreen.Canvas, 695 (ClientWidth - BiColorTextWidth(Offscreen.Canvas, Caption)) div 2, 696 696 yCaption, Caption); 697 697 end;
Note:
See TracChangeset
for help on using the changeset viewer.