[go: up one dir, main page]

Menu

[857d10]: / vpa / vpa2.pas  Maximize  Restore  History

Download this file

3705 lines (3609 with data), 101.7 kB

   1
   2
   3
   4
   5
   6
   7
   8
   9
  10
  11
  12
  13
  14
  15
  16
  17
  18
  19
  20
  21
  22
  23
  24
  25
  26
  27
  28
  29
  30
  31
  32
  33
  34
  35
  36
  37
  38
  39
  40
  41
  42
  43
  44
  45
  46
  47
  48
  49
  50
  51
  52
  53
  54
  55
  56
  57
  58
  59
  60
  61
  62
  63
  64
  65
  66
  67
  68
  69
  70
  71
  72
  73
  74
  75
  76
  77
  78
  79
  80
  81
  82
  83
  84
  85
  86
  87
  88
  89
  90
  91
  92
  93
  94
  95
  96
  97
  98
  99
 100
 101
 102
 103
 104
 105
 106
 107
 108
 109
 110
 111
 112
 113
 114
 115
 116
 117
 118
 119
 120
 121
 122
 123
 124
 125
 126
 127
 128
 129
 130
 131
 132
 133
 134
 135
 136
 137
 138
 139
 140
 141
 142
 143
 144
 145
 146
 147
 148
 149
 150
 151
 152
 153
 154
 155
 156
 157
 158
 159
 160
 161
 162
 163
 164
 165
 166
 167
 168
 169
 170
 171
 172
 173
 174
 175
 176
 177
 178
 179
 180
 181
 182
 183
 184
 185
 186
 187
 188
 189
 190
 191
 192
 193
 194
 195
 196
 197
 198
 199
 200
 201
 202
 203
 204
 205
 206
 207
 208
 209
 210
 211
 212
 213
 214
 215
 216
 217
 218
 219
 220
 221
 222
 223
 224
 225
 226
 227
 228
 229
 230
 231
 232
 233
 234
 235
 236
 237
 238
 239
 240
 241
 242
 243
 244
 245
 246
 247
 248
 249
 250
 251
 252
 253
 254
 255
 256
 257
 258
 259
 260
 261
 262
 263
 264
 265
 266
 267
 268
 269
 270
 271
 272
 273
 274
 275
 276
 277
 278
 279
 280
 281
 282
 283
 284
 285
 286
 287
 288
 289
 290
 291
 292
 293
 294
 295
 296
 297
 298
 299
 300
 301
 302
 303
 304
 305
 306
 307
 308
 309
 310
 311
 312
 313
 314
 315
 316
 317
 318
 319
 320
 321
 322
 323
 324
 325
 326
 327
 328
 329
 330
 331
 332
 333
 334
 335
 336
 337
 338
 339
 340
 341
 342
 343
 344
 345
 346
 347
 348
 349
 350
 351
 352
 353
 354
 355
 356
 357
 358
 359
 360
 361
 362
 363
 364
 365
 366
 367
 368
 369
 370
 371
 372
 373
 374
 375
 376
 377
 378
 379
 380
 381
 382
 383
 384
 385
 386
 387
 388
 389
 390
 391
 392
 393
 394
 395
 396
 397
 398
 399
 400
 401
 402
 403
 404
 405
 406
 407
 408
 409
 410
 411
 412
 413
 414
 415
 416
 417
 418
 419
 420
 421
 422
 423
 424
 425
 426
 427
 428
 429
 430
 431
 432
 433
 434
 435
 436
 437
 438
 439
 440
 441
 442
 443
 444
 445
 446
 447
 448
 449
 450
 451
 452
 453
 454
 455
 456
 457
 458
 459
 460
 461
 462
 463
 464
 465
 466
 467
 468
 469
 470
 471
 472
 473
 474
 475
 476
 477
 478
 479
 480
 481
 482
 483
 484
 485
 486
 487
 488
 489
 490
 491
 492
 493
 494
 495
 496
 497
 498
 499
 500
 501
 502
 503
 504
 505
 506
 507
 508
 509
 510
 511
 512
 513
 514
 515
 516
 517
 518
 519
 520
 521
 522
 523
 524
 525
 526
 527
 528
 529
 530
 531
 532
 533
 534
 535
 536
 537
 538
 539
 540
 541
 542
 543
 544
 545
 546
 547
 548
 549
 550
 551
 552
 553
 554
 555
 556
 557
 558
 559
 560
 561
 562
 563
 564
 565
 566
 567
 568
 569
 570
 571
 572
 573
 574
 575
 576
 577
 578
 579
 580
 581
 582
 583
 584
 585
 586
 587
 588
 589
 590
 591
 592
 593
 594
 595
 596
 597
 598
 599
 600
 601
 602
 603
 604
 605
 606
 607
 608
 609
 610
 611
 612
 613
 614
 615
 616
 617
 618
 619
 620
 621
 622
 623
 624
 625
 626
 627
 628
 629
 630
 631
 632
 633
 634
 635
 636
 637
 638
 639
 640
 641
 642
 643
 644
 645
 646
 647
 648
 649
 650
 651
 652
 653
 654
 655
 656
 657
 658
 659
 660
 661
 662
 663
 664
 665
 666
 667
 668
 669
 670
 671
 672
 673
 674
 675
 676
 677
 678
 679
 680
 681
 682
 683
 684
 685
 686
 687
 688
 689
 690
 691
 692
 693
 694
 695
 696
 697
 698
 699
 700
 701
 702
 703
 704
 705
 706
 707
 708
 709
 710
 711
 712
 713
 714
 715
 716
 717
 718
 719
 720
 721
 722
 723
 724
 725
 726
 727
 728
 729
 730
 731
 732
 733
 734
 735
 736
 737
 738
 739
 740
 741
 742
 743
 744
 745
 746
 747
 748
 749
 750
 751
 752
 753
 754
 755
 756
 757
 758
 759
 760
 761
 762
 763
 764
 765
 766
 767
 768
 769
 770
 771
 772
 773
 774
 775
 776
 777
 778
 779
 780
 781
 782
 783
 784
 785
 786
 787
 788
 789
 790
 791
 792
 793
 794
 795
 796
 797
 798
 799
 800
 801
 802
 803
 804
 805
 806
 807
 808
 809
 810
 811
 812
 813
 814
 815
 816
 817
 818
 819
 820
 821
 822
 823
 824
 825
 826
 827
 828
 829
 830
 831
 832
 833
 834
 835
 836
 837
 838
 839
 840
 841
 842
 843
 844
 845
 846
 847
 848
 849
 850
 851
 852
 853
 854
 855
 856
 857
 858
 859
 860
 861
 862
 863
 864
 865
 866
 867
 868
 869
 870
 871
 872
 873
 874
 875
 876
 877
 878
 879
 880
 881
 882
 883
 884
 885
 886
 887
 888
 889
 890
 891
 892
 893
 894
 895
 896
 897
 898
 899
 900
 901
 902
 903
 904
 905
 906
 907
 908
 909
 910
 911
 912
 913
 914
 915
 916
 917
 918
 919
 920
 921
 922
 923
 924
 925
 926
 927
 928
 929
 930
 931
 932
 933
 934
 935
 936
 937
 938
 939
 940
 941
 942
 943
 944
 945
 946
 947
 948
 949
 950
 951
 952
 953
 954
 955
 956
 957
 958
 959
 960
 961
 962
 963
 964
 965
 966
 967
 968
 969
 970
 971
 972
 973
 974
 975
 976
 977
 978
 979
 980
 981
 982
 983
 984
 985
 986
 987
 988
 989
 990
 991
 992
 993
 994
 995
 996
 997
 998
 999
1000
1001
1002
1003
1004
1005
1006
1007
1008
1009
1010
1011
1012
1013
1014
1015
1016
1017
1018
1019
1020
1021
1022
1023
1024
1025
1026
1027
1028
1029
1030
1031
1032
1033
1034
1035
1036
1037
1038
1039
1040
1041
1042
1043
1044
1045
1046
1047
1048
1049
1050
1051
1052
1053
1054
1055
1056
1057
1058
1059
1060
1061
1062
1063
1064
1065
1066
1067
1068
1069
1070
1071
1072
1073
1074
1075
1076
1077
1078
1079
1080
1081
1082
1083
1084
1085
1086
1087
1088
1089
1090
1091
1092
1093
1094
1095
1096
1097
1098
1099
1100
1101
1102
1103
1104
1105
1106
1107
1108
1109
1110
1111
1112
1113
1114
1115
1116
1117
1118
1119
1120
1121
1122
1123
1124
1125
1126
1127
1128
1129
1130
1131
1132
1133
1134
1135
1136
1137
1138
1139
1140
1141
1142
1143
1144
1145
1146
1147
1148
1149
1150
1151
1152
1153
1154
1155
1156
1157
1158
1159
1160
1161
1162
1163
1164
1165
1166
1167
1168
1169
1170
1171
1172
1173
1174
1175
1176
1177
1178
1179
1180
1181
1182
1183
1184
1185
1186
1187
1188
1189
1190
1191
1192
1193
1194
1195
1196
1197
1198
1199
1200
1201
1202
1203
1204
1205
1206
1207
1208
1209
1210
1211
1212
1213
1214
1215
1216
1217
1218
1219
1220
1221
1222
1223
1224
1225
1226
1227
1228
1229
1230
1231
1232
1233
1234
1235
1236
1237
1238
1239
1240
1241
1242
1243
1244
1245
1246
1247
1248
1249
1250
1251
1252
1253
1254
1255
1256
1257
1258
1259
1260
1261
1262
1263
1264
1265
1266
1267
1268
1269
1270
1271
1272
1273
1274
1275
1276
1277
1278
1279
1280
1281
1282
1283
1284
1285
1286
1287
1288
1289
1290
1291
1292
1293
1294
1295
1296
1297
1298
1299
1300
1301
1302
1303
1304
1305
1306
1307
1308
1309
1310
1311
1312
1313
1314
1315
1316
1317
1318
1319
1320
1321
1322
1323
1324
1325
1326
1327
1328
1329
1330
1331
1332
1333
1334
1335
1336
1337
1338
1339
1340
1341
1342
1343
1344
1345
1346
1347
1348
1349
1350
1351
1352
1353
1354
1355
1356
1357
1358
1359
1360
1361
1362
1363
1364
1365
1366
1367
1368
1369
1370
1371
1372
1373
1374
1375
1376
1377
1378
1379
1380
1381
1382
1383
1384
1385
1386
1387
1388
1389
1390
1391
1392
1393
1394
1395
1396
1397
1398
1399
1400
1401
1402
1403
1404
1405
1406
1407
1408
1409
1410
1411
1412
1413
1414
1415
1416
1417
1418
1419
1420
1421
1422
1423
1424
1425
1426
1427
1428
1429
1430
1431
1432
1433
1434
1435
1436
1437
1438
1439
1440
1441
1442
1443
1444
1445
1446
1447
1448
1449
1450
1451
1452
1453
1454
1455
1456
1457
1458
1459
1460
1461
1462
1463
1464
1465
1466
1467
1468
1469
1470
1471
1472
1473
1474
1475
1476
1477
1478
1479
1480
1481
1482
1483
1484
1485
1486
1487
1488
1489
1490
1491
1492
1493
1494
1495
1496
1497
1498
1499
1500
1501
1502
1503
1504
1505
1506
1507
1508
1509
1510
1511
1512
1513
1514
1515
1516
1517
1518
1519
1520
1521
1522
1523
1524
1525
1526
1527
1528
1529
1530
1531
1532
1533
1534
1535
1536
1537
1538
1539
1540
1541
1542
1543
1544
1545
1546
1547
1548
1549
1550
1551
1552
1553
1554
1555
1556
1557
1558
1559
1560
1561
1562
1563
1564
1565
1566
1567
1568
1569
1570
1571
1572
1573
1574
1575
1576
1577
1578
1579
1580
1581
1582
1583
1584
1585
1586
1587
1588
1589
1590
1591
1592
1593
1594
1595
1596
1597
1598
1599
1600
1601
1602
1603
1604
1605
1606
1607
1608
1609
1610
1611
1612
1613
1614
1615
1616
1617
1618
1619
1620
1621
1622
1623
1624
1625
1626
1627
1628
1629
1630
1631
1632
1633
1634
1635
1636
1637
1638
1639
1640
1641
1642
1643
1644
1645
1646
1647
1648
1649
1650
1651
1652
1653
1654
1655
1656
1657
1658
1659
1660
1661
1662
1663
1664
1665
1666
1667
1668
1669
1670
1671
1672
1673
1674
1675
1676
1677
1678
1679
1680
1681
1682
1683
1684
1685
1686
1687
1688
1689
1690
1691
1692
1693
1694
1695
1696
1697
1698
1699
1700
1701
1702
1703
1704
1705
1706
1707
1708
1709
1710
1711
1712
1713
1714
1715
1716
1717
1718
1719
1720
1721
1722
1723
1724
1725
1726
1727
1728
1729
1730
1731
1732
1733
1734
1735
1736
1737
1738
1739
1740
1741
1742
1743
1744
1745
1746
1747
1748
1749
1750
1751
1752
1753
1754
1755
1756
1757
1758
1759
1760
1761
1762
1763
1764
1765
1766
1767
1768
1769
1770
1771
1772
1773
1774
1775
1776
1777
1778
1779
1780
1781
1782
1783
1784
1785
1786
1787
1788
1789
1790
1791
1792
1793
1794
1795
1796
1797
1798
1799
1800
1801
1802
1803
1804
1805
1806
1807
1808
1809
1810
1811
1812
1813
1814
1815
1816
1817
1818
1819
1820
1821
1822
1823
1824
1825
1826
1827
1828
1829
1830
1831
1832
1833
1834
1835
1836
1837
1838
1839
1840
1841
1842
1843
1844
1845
1846
1847
1848
1849
1850
1851
1852
1853
1854
1855
1856
1857
1858
1859
1860
1861
1862
1863
1864
1865
1866
1867
1868
1869
1870
1871
1872
1873
1874
1875
1876
1877
1878
1879
1880
1881
1882
1883
1884
1885
1886
1887
1888
1889
1890
1891
1892
1893
1894
1895
1896
1897
1898
1899
1900
1901
1902
1903
1904
1905
1906
1907
1908
1909
1910
1911
1912
1913
1914
1915
1916
1917
1918
1919
1920
1921
1922
1923
1924
1925
1926
1927
1928
1929
1930
1931
1932
1933
1934
1935
1936
1937
1938
1939
1940
1941
1942
1943
1944
1945
1946
1947
1948
1949
1950
1951
1952
1953
1954
1955
1956
1957
1958
1959
1960
1961
1962
1963
1964
1965
1966
1967
1968
1969
1970
1971
1972
1973
1974
1975
1976
1977
1978
1979
1980
1981
1982
1983
1984
1985
1986
1987
1988
1989
1990
1991
1992
1993
1994
1995
1996
1997
1998
1999
2000
2001
2002
2003
2004
2005
2006
2007
2008
2009
2010
2011
2012
2013
2014
2015
2016
2017
2018
2019
2020
2021
2022
2023
2024
2025
2026
2027
2028
2029
2030
2031
2032
2033
2034
2035
2036
2037
2038
2039
2040
2041
2042
2043
2044
2045
2046
2047
2048
2049
2050
2051
2052
2053
2054
2055
2056
2057
2058
2059
2060
2061
2062
2063
2064
2065
2066
2067
2068
2069
2070
2071
2072
2073
2074
2075
2076
2077
2078
2079
2080
2081
2082
2083
2084
2085
2086
2087
2088
2089
2090
2091
2092
2093
2094
2095
2096
2097
2098
2099
2100
2101
2102
2103
2104
2105
2106
2107
2108
2109
2110
2111
2112
2113
2114
2115
2116
2117
2118
2119
2120
2121
2122
2123
2124
2125
2126
2127
2128
2129
2130
2131
2132
2133
2134
2135
2136
2137
2138
2139
2140
2141
2142
2143
2144
2145
2146
2147
2148
2149
2150
2151
2152
2153
2154
2155
2156
2157
2158
2159
2160
2161
2162
2163
2164
2165
2166
2167
2168
2169
2170
2171
2172
2173
2174
2175
2176
2177
2178
2179
2180
2181
2182
2183
2184
2185
2186
2187
2188
2189
2190
2191
2192
2193
2194
2195
2196
2197
2198
2199
2200
2201
2202
2203
2204
2205
2206
2207
2208
2209
2210
2211
2212
2213
2214
2215
2216
2217
2218
2219
2220
2221
2222
2223
2224
2225
2226
2227
2228
2229
2230
2231
2232
2233
2234
2235
2236
2237
2238
2239
2240
2241
2242
2243
2244
2245
2246
2247
2248
2249
2250
2251
2252
2253
2254
2255
2256
2257
2258
2259
2260
2261
2262
2263
2264
2265
2266
2267
2268
2269
2270
2271
2272
2273
2274
2275
2276
2277
2278
2279
2280
2281
2282
2283
2284
2285
2286
2287
2288
2289
2290
2291
2292
2293
2294
2295
2296
2297
2298
2299
2300
2301
2302
2303
2304
2305
2306
2307
2308
2309
2310
2311
2312
2313
2314
2315
2316
2317
2318
2319
2320
2321
2322
2323
2324
2325
2326
2327
2328
2329
2330
2331
2332
2333
2334
2335
2336
2337
2338
2339
2340
2341
2342
2343
2344
2345
2346
2347
2348
2349
2350
2351
2352
2353
2354
2355
2356
2357
2358
2359
2360
2361
2362
2363
2364
2365
2366
2367
2368
2369
2370
2371
2372
2373
2374
2375
2376
2377
2378
2379
2380
2381
2382
2383
2384
2385
2386
2387
2388
2389
2390
2391
2392
2393
2394
2395
2396
2397
2398
2399
2400
2401
2402
2403
2404
2405
2406
2407
2408
2409
2410
2411
2412
2413
2414
2415
2416
2417
2418
2419
2420
2421
2422
2423
2424
2425
2426
2427
2428
2429
2430
2431
2432
2433
2434
2435
2436
2437
2438
2439
2440
2441
2442
2443
2444
2445
2446
2447
2448
2449
2450
2451
2452
2453
2454
2455
2456
2457
2458
2459
2460
2461
2462
2463
2464
2465
2466
2467
2468
2469
2470
2471
2472
2473
2474
2475
2476
2477
2478
2479
2480
2481
2482
2483
2484
2485
2486
2487
2488
2489
2490
2491
2492
2493
2494
2495
2496
2497
2498
2499
2500
2501
2502
2503
2504
2505
2506
2507
2508
2509
2510
2511
2512
2513
2514
2515
2516
2517
2518
2519
2520
2521
2522
2523
2524
2525
2526
2527
2528
2529
2530
2531
2532
2533
2534
2535
2536
2537
2538
2539
2540
2541
2542
2543
2544
2545
2546
2547
2548
2549
2550
2551
2552
2553
2554
2555
2556
2557
2558
2559
2560
2561
2562
2563
2564
2565
2566
2567
2568
2569
2570
2571
2572
2573
2574
2575
2576
2577
2578
2579
2580
2581
2582
2583
2584
2585
2586
2587
2588
2589
2590
2591
2592
2593
2594
2595
2596
2597
2598
2599
2600
2601
2602
2603
2604
2605
2606
2607
2608
2609
2610
2611
2612
2613
2614
2615
2616
2617
2618
2619
2620
2621
2622
2623
2624
2625
2626
2627
2628
2629
2630
2631
2632
2633
2634
2635
2636
2637
2638
2639
2640
2641
2642
2643
2644
2645
2646
2647
2648
2649
2650
2651
2652
2653
2654
2655
2656
2657
2658
2659
2660
2661
2662
2663
2664
2665
2666
2667
2668
2669
2670
2671
2672
2673
2674
2675
2676
2677
2678
2679
2680
2681
2682
2683
2684
2685
2686
2687
2688
2689
2690
2691
2692
2693
2694
2695
2696
2697
2698
2699
2700
2701
2702
2703
2704
2705
2706
2707
2708
2709
2710
2711
2712
2713
2714
2715
2716
2717
2718
2719
2720
2721
2722
2723
2724
2725
2726
2727
2728
2729
2730
2731
2732
2733
2734
2735
2736
2737
2738
2739
2740
2741
2742
2743
2744
2745
2746
2747
2748
2749
2750
2751
2752
2753
2754
2755
2756
2757
2758
2759
2760
2761
2762
2763
2764
2765
2766
2767
2768
2769
2770
2771
2772
2773
2774
2775
2776
2777
2778
2779
2780
2781
2782
2783
2784
2785
2786
2787
2788
2789
2790
2791
2792
2793
2794
2795
2796
2797
2798
2799
2800
2801
2802
2803
2804
2805
2806
2807
2808
2809
2810
2811
2812
2813
2814
2815
2816
2817
2818
2819
2820
2821
2822
2823
2824
2825
2826
2827
2828
2829
2830
2831
2832
2833
2834
2835
2836
2837
2838
2839
2840
2841
2842
2843
2844
2845
2846
2847
2848
2849
2850
2851
2852
2853
2854
2855
2856
2857
2858
2859
2860
2861
2862
2863
2864
2865
2866
2867
2868
2869
2870
2871
2872
2873
2874
2875
2876
2877
2878
2879
2880
2881
2882
2883
2884
2885
2886
2887
2888
2889
2890
2891
2892
2893
2894
2895
2896
2897
2898
2899
2900
2901
2902
2903
2904
2905
2906
2907
2908
2909
2910
2911
2912
2913
2914
2915
2916
2917
2918
2919
2920
2921
2922
2923
2924
2925
2926
2927
2928
2929
2930
2931
2932
2933
2934
2935
2936
2937
2938
2939
2940
2941
2942
2943
2944
2945
2946
2947
2948
2949
2950
2951
2952
2953
2954
2955
2956
2957
2958
2959
2960
2961
2962
2963
2964
2965
2966
2967
2968
2969
2970
2971
2972
2973
2974
2975
2976
2977
2978
2979
2980
2981
2982
2983
2984
2985
2986
2987
2988
2989
2990
2991
2992
2993
2994
2995
2996
2997
2998
2999
3000
3001
3002
3003
3004
3005
3006
3007
3008
3009
3010
3011
3012
3013
3014
3015
3016
3017
3018
3019
3020
3021
3022
3023
3024
3025
3026
3027
3028
3029
3030
3031
3032
3033
3034
3035
3036
3037
3038
3039
3040
3041
3042
3043
3044
3045
3046
3047
3048
3049
3050
3051
3052
3053
3054
3055
3056
3057
3058
3059
3060
3061
3062
3063
3064
3065
3066
3067
3068
3069
3070
3071
3072
3073
3074
3075
3076
3077
3078
3079
3080
3081
3082
3083
3084
3085
3086
3087
3088
3089
3090
3091
3092
3093
3094
3095
3096
3097
3098
3099
3100
3101
3102
3103
3104
3105
3106
3107
3108
3109
3110
3111
3112
3113
3114
3115
3116
3117
3118
3119
3120
3121
3122
3123
3124
3125
3126
3127
3128
3129
3130
3131
3132
3133
3134
3135
3136
3137
3138
3139
3140
3141
3142
3143
3144
3145
3146
3147
3148
3149
3150
3151
3152
3153
3154
3155
3156
3157
3158
3159
3160
3161
3162
3163
3164
3165
3166
3167
3168
3169
3170
3171
3172
3173
3174
3175
3176
3177
3178
3179
3180
3181
3182
3183
3184
3185
3186
3187
3188
3189
3190
3191
3192
3193
3194
3195
3196
3197
3198
3199
3200
3201
3202
3203
3204
3205
3206
3207
3208
3209
3210
3211
3212
3213
3214
3215
3216
3217
3218
3219
3220
3221
3222
3223
3224
3225
3226
3227
3228
3229
3230
3231
3232
3233
3234
3235
3236
3237
3238
3239
3240
3241
3242
3243
3244
3245
3246
3247
3248
3249
3250
3251
3252
3253
3254
3255
3256
3257
3258
3259
3260
3261
3262
3263
3264
3265
3266
3267
3268
3269
3270
3271
3272
3273
3274
3275
3276
3277
3278
3279
3280
3281
3282
3283
3284
3285
3286
3287
3288
3289
3290
3291
3292
3293
3294
3295
3296
3297
3298
3299
3300
3301
3302
3303
3304
3305
3306
3307
3308
3309
3310
3311
3312
3313
3314
3315
3316
3317
3318
3319
3320
3321
3322
3323
3324
3325
3326
3327
3328
3329
3330
3331
3332
3333
3334
3335
3336
3337
3338
3339
3340
3341
3342
3343
3344
3345
3346
3347
3348
3349
3350
3351
3352
3353
3354
3355
3356
3357
3358
3359
3360
3361
3362
3363
3364
3365
3366
3367
3368
3369
3370
3371
3372
3373
3374
3375
3376
3377
3378
3379
3380
3381
3382
3383
3384
3385
3386
3387
3388
3389
3390
3391
3392
3393
3394
3395
3396
3397
3398
3399
3400
3401
3402
3403
3404
3405
3406
3407
3408
3409
3410
3411
3412
3413
3414
3415
3416
3417
3418
3419
3420
3421
3422
3423
3424
3425
3426
3427
3428
3429
3430
3431
3432
3433
3434
3435
3436
3437
3438
3439
3440
3441
3442
3443
3444
3445
3446
3447
3448
3449
3450
3451
3452
3453
3454
3455
3456
3457
3458
3459
3460
3461
3462
3463
3464
3465
3466
3467
3468
3469
3470
3471
3472
3473
3474
3475
3476
3477
3478
3479
3480
3481
3482
3483
3484
3485
3486
3487
3488
3489
3490
3491
3492
3493
3494
3495
3496
3497
3498
3499
3500
3501
3502
3503
3504
3505
3506
3507
3508
3509
3510
3511
3512
3513
3514
3515
3516
3517
3518
3519
3520
3521
3522
3523
3524
3525
3526
3527
3528
3529
3530
3531
3532
3533
3534
3535
3536
3537
3538
3539
3540
3541
3542
3543
3544
3545
3546
3547
3548
3549
3550
3551
3552
3553
3554
3555
3556
3557
3558
3559
3560
3561
3562
3563
3564
3565
3566
3567
3568
3569
3570
3571
3572
3573
3574
3575
3576
3577
3578
3579
3580
3581
3582
3583
3584
3585
3586
3587
3588
3589
3590
3591
3592
3593
3594
3595
3596
3597
3598
3599
3600
3601
3602
3603
3604
3605
3606
3607
3608
3609
3610
3611
3612
3613
3614
3615
3616
3617
3618
3619
3620
3621
3622
3623
3624
3625
3626
3627
3628
3629
3630
3631
3632
3633
3634
3635
3636
3637
3638
3639
3640
3641
3642
3643
3644
3645
3646
3647
3648
3649
3650
3651
3652
3653
3654
3655
3656
3657
3658
3659
3660
3661
3662
3663
3664
3665
3666
3667
3668
3669
3670
3671
3672
3673
3674
3675
3676
3677
3678
3679
3680
3681
3682
3683
3684
3685
3686
3687
3688
3689
3690
3691
3692
3693
3694
3695
3696
3697
3698
3699
3700
3701
3702
3703
3704
3705
Unit VPA2; (* VPA Main Part - Display *)
{DEFINE DEBUG} (* include TurnsInMemory *)
Interface
uses AuxF,VPAData;
const ListY = 362;
BL1 = 208;
BL2 = 312;
CY0 = 256;
const dline : boolean = Off;
radius0 : int = 0;
var ObjN,PlanN,ShipN: int;
ObjL0,Obj0 : int;
procedure DrawMap (clr:boolean);
function GoToShipXY (var h:sptr; x,y,k:int) : int;
procedure MouseMove;
function MouseGetTarget (lcolor,lstyle:byte; ctrl:boolean) : boolean; { sets mmx,mmy }
procedure DrawWCircle (x,y,r:int);
procedure DrawPath;
procedure SayMoving;
procedure PlanetInfo;
procedure BaseInfo;
procedure ShipInfo;
procedure InitObjList;
procedure ObjList;
procedure WriteMiningRate;
function ShipNumXY (h:sptr; x,y:int) : word;
procedure Main;
Implementation
uses Graph,Screen,Mouse,StrF,Keyboard,VPA3,Tasks;
var mt0,mt1 : longint;
MineN,IonN,WormN,UfoN : int;
BL0 : int;
bOver : boolean;
AllH,eAllH,hOver: boolean;
ScanH : int;
lsxy : array [1..2,1..2] of int;
dlx,dly : int;
dlship : SRec;
{ dlf0 : long;
dlw,dlc : byte;}
dlf : long;
dlt : int;
dlc : byte;
mEv0 : word;
var DScolorR: byte;
DScolorO: byte;
DScolorT: byte;
DSwm : byte;
const DSdrawn : boolean = No;
SRdrawn : boolean = No;
forceDL : boolean = No;
var SRradius: word;
function UnderTow (id:int) : int; { tower's id or 0 }
var i : int;
h1 : sptr;
begin
UnderTow:=0;
for i:=1 to 999 do
begin
h1:=TTurn^.data^.ship[i];
if (h1<>nil) and (h1^.when=turn) and
(h1^.mission=7) and (h1^.tow_ship=id) then
begin UnderTow:=i; Exit end;
end;
end;
procedure DrawDistLine;
var vp : ViewPortType;
p0 : int;
begin
MouseOff;
GetViewSettings(vp);
SetViewPort(0,0,479,479,ClipOn);
SetLineStyle(DashedLn,0,NormWidth);
SetColor(cmDist);
p0:=GetPixel(lsxy[1,1],lsxy[1,2]);
SetWriteMode(XORPut);
Line(lsxy[1,1],lsxy[1,2],lsxy[2,1],lsxy[2,2]);
SetWriteMode(NormalPut);
PutPixel(lsxy[1,1],lsxy[1,2],p0);
SetViewPort(vp.x1,vp.y1,vp.x2,vp.y2,vp.clip);
MouseOn;
dline:=not dline;
end;
procedure DrawDistLock;
var xx,yy : int;
begin
if distlock<0 then Exit;
MouseOff;
Abs2Scr(dlx,dly,xx,yy);
if xx<476 then PutImage(xx-4,yy-4,BrownC^,XORPut);
MouseOn;
end;
procedure DrawWLine (x1,y1,x2,y2:int; FindMin:boolean);
procedure DrawLine (x1,y1,x2,y2:int);
var p1,p2 : byte;
outta : boolean;
begin
asm
mov outta,Yes
xor cx,cx { cx = 0 }
mov dx,479 { dx = 479 }
mov ax,x1 { ax = Min(x1,x2) }
mov bx,x2 { bx = Max(x1,x2) }
cmp ax,bx
jle @@1
xchg ax,bx
@@1: cmp ax,cx { ax = Max(ax,0) }
jge @@2
mov ax,cx
@@2: cmp bx,dx { bx = Min(bx,479) }
jle @@3
mov bx,dx
@@3: cmp ax,bx { if ax>bx then outta }
jg @@9
mov ax,y1 { ax = Min(y1,y2) }
mov bx,y2 { bx = Max(y1,y2) }
cmp ax,bx
jle @@4
xchg ax,bx
@@4: cmp ax,cx { ax = Max(ax,0) }
jge @@5
mov ax,cx
@@5: cmp bx,dx { bx = Min(bx,479) }
jle @@6
mov bx,dx
@@6: cmp ax,bx { if ax>bx then outta }
jg @@9
mov outta,No
@@9:
end;
if outta then Exit;
p1:=GetPixel(x1,y1); p2:=GetPixel(x2,y2);
Line(x1,y1,x2,y2);
PutPixel(x1,y1,p1); PutPixel(x2,y2,p2);
end;
begin
if MapWrap and FindMin then
begin
if long(Abs(x2-x1))*ratio1 div ratio2>400 then dec(x2,MapSSize*Sign(x2-x1));
if long(Abs(y2-y1))*ratio1 div ratio2>400 then dec(y2,MapSSize*Sign(y2-y1));
end;
DrawLine(x1,y1,x2,y2);
if MapWrap and (ratioN=1) then
begin
if (x1<0) or (x2<0) then DrawLine(x1+480,y1,x2+480,y2)
else if (x1>479) or (x2>479) then DrawLine(x1-480,y1,x2-480,y2);
if (y1<0) or (y2<0) then DrawLine(x1,y1+480,x2,y2+480)
else if (y1>479) or (y2>479) then DrawLine(x1,y1-480,x2,y2-480);
end;
end;
procedure DrawCircle (x,y,r:int);
var x1,y1 : int;
begin
if (x<-r) or (x>479+r) or (y<-r) or (y>479+r) then Exit; {completely outside}
x1:=x-IIF(x<240,479,0);
y1:=y-IIF(y<240,479,0);
if long(r)*r>long(x1)*x1+long(y1)*y1 then Exit; {completely inside}
Circle(x,y,r);
end;
procedure DrawWCircle (x,y,r:int);
var xw,yw : boolean;
begin
DrawCircle(x,y,r);
if MapWrap and (ratioN=1) then
begin
xw:=(x-r<0) or (x+r>479);
yw:=(y-r<0) or (y+r>479);
if xw then DrawCircle(x-Sign(x-r)*480,y,r);
if yw then DrawCircle(x,y-Sign(y-r)*480,r);
if xw and yw then DrawCircle(x-Sign(x-r)*480,y-Sign(y-r)*480,r);
end;
end;
procedure DrawFlyPath (h:sptr; sx1,sy1,heading,warp,wx,wy:int; c:byte);
var sx2,sy2 : int;
i,xx,yy,fc,fa : int;
fh,fh1 : sptr;
if1 : boolean;
hk : single;
_fuel,_eta : int;
begin
sx2:=sx1; sy2:=sy1;
if heading=-2 then
begin
if {(warp>0) and} (wx or wy<>0) then
begin
inc(sx2,long(wx)*ratio2 div ratio1);
dec(sy2,long(wy)*ratio2 div ratio1);
end;
CalcMovement(h,_fuel,_eta);
if Chunnel and chuns and (ltype=LockS) and (_eta<=1) then { check for chunnel }
begin
xx:=h^.x; yy:=h^.y;
if warp>0 then begin inc(xx,wx); inc(yy,wy) end;
if warp>1 then
begin
Location(xx,yy);
xx:=LocationX;
yy:=LocationY;
end;
if1:=(h^.warp=0) or
(h^.mission=10) or ((Race[h^.owner]=3) and (h^.mission=9)) or
(h^.fuel=0) or
(h^.fuel=_fuel);
for i:=1 to 999 do
begin
fh:=TTurn^.data^.ship[i];
with fh^ do
if (fh<>nil) and (when=turn) and (x=xx) and (y=yy) and
(warp=0) and (fuel>=50) and
(IsHullFunc(hull,hfChunneling)<>0) and (UnderTow(i)=0) and
((owner=h^.owner) or (h^.fcode=fcode) or if1) then
begin
Val(fcode,fc,fa);
if (fa=0) and (fc>0) and (fc<=999) then
begin
fh1:=TTurn^.data^.ship[fc];
with fh1^ do
if (fh1<>nil) and (when=turn) and (warp=0) and (owner=fh^.owner) and
(IsHullFunc(hull,hfChunneling)<>0) and (UnderTow(fc)=0) and
(Distance2(xx,yy,x,y)>=10000) then
begin
SetColor(IIF(showT,DScolorO xor DScolorR,DScolorO));
SetLineStyle(SolidLn,0,NormWidth);
Abs2Scr(xx,yy,xx,yy);
Abs2Scr(x,y,fc,fa);
DrawWLine(xx,yy,fc,fa,Yes);
Break;
end;
end;
end;
end;
end;
end
else if warp>0 then
begin
hk:=long(warp*warp)*ratio2/ratio1;
if (h<>nil) and (IsHullFunc(h^.hull,hfGravitonic)<>0) then hk:=hk*2;
inc(sx2,Round(hk*Sin(heading*Pi/180.0)));
dec(sy2,Round(hk*Cos(heading*Pi/180.0)));
end;
if (sx2<>sx1) or (sy2<>sy1) then
begin
SetColor(c);
SetLineStyle(SolidLn,0,NormWidth);
DrawWLine(sx1,sy1,sx2,sy2,No);
end;
end;
procedure DrawPath;
var x,y,px1,py1,px2,py2,wx,wy,heading,warp : int;
sx1,sy1,sx2,sy2 : int;
p1,p2 : byte;
mdr : boolean;
vp : ViewPortType;
h : sptr;
is : iptr;
u : uptr;
function NearBy (x1,y1,x2,y2:int) : boolean;
begin
NearBy:=(Abs(x1-x2)<=3) and (Abs(y1-y2)<=3);
end;
begin
if {showT or} ((ltype<>LockS) and (ltype<>LockI)) then Exit;
mdr:=mdraw;
MouseOff;
SetWriteMode(DSwm);
GetViewSettings(vp);
SetViewPort(0,0,479,479,ClipOn);
repeat { try }
if ltype=LockS then
begin
h:=TTurn^.data^.ship[lock and LockLo];
if h=nil then Break;
x:=h^.x; y:=h^.y;
px1:=h^.px1; py1:=h^.py1;
px2:=h^.px2; py2:=h^.py2;
wx:=h^.wx; wy:=h^.wy;
heading:=IIF(h^.mission=-1,h^.enemy,-2);
warp:=h^.warp;
end else
if ltype=LockI then
begin
is:=TTurn^.data^.ion[lock and LockLo];
if is=nil then Break;
x:=is^.x; y:=is^.y;
px1:=is^.px1; py1:=is^.py1;
px2:=is^.px2; py2:=is^.py2;
wx:=-1; wy:=-1;
heading:=is^.heading;
warp:=is^.warp;
h:=nil; { needed for DrawFlyPath }
end else
if ltype=LockU then
begin
u:=TTurn^.data^.ufo[lock and LockLo];
if u=nil then Break;
x:=u^.x; y:=u^.y;
px1:=u^.px1; py1:=u^.py1;
px2:=u^.px2; py2:=u^.py2;
wx:=-1; wy:=-1;
heading:=u^.heading;
warp:=u^.warp;
h:=nil; { needed for DrawFlyPath }
end;
Abs2Scr(x,y,sx1,sy1);
if heading<>-1 then DrawFlyPath(h,sx1,sy1,heading,warp,wx,wy,IIF(showT,8,DScolorR));
if ltype=LockS then
begin
sx2:=UnderTow(lock and LockLo);
if (sx2<>0) and ((h^.mission<>7) or (lock and LockLo>sx2)) then
begin
h:=TTurn^.data^.ship[sx2]; { h is changed !!! }
DrawFlyPath(h,sx1,sy1,-2,h^.warp,h^.wx,h^.wy,IIF(showT,DScolorO xor DScolorR,DScolorO));
end;
end;
SetColor(IIF(showT,8,DScolorT));
if (px1<>-1) and (not NearBy(x+wx,y+wy,px1,py1)) then
begin
SetLineStyle(UserBitLn,$6666,NormWidth);
Abs2Scr(px1,py1,sx2,sy2);
if (px1<>x+wx) or (py1<>y+wy) then DrawWLine(sx1,sy1,sx2,sy2,Yes);
sx1:=sx2; sy1:=sy2;
end;
if (px2<>-1) and ((px2<>x) or (py2<>y)) and (not NearBy(x+wx,y+wy,px2,py2)) then
begin
SetLineStyle(UserBitLn,$8888,NormWidth);
Abs2Scr(px2,py2,sx2,sy2);
DrawWLine(sx1,sy1,sx2,sy2,Yes);
end;
until True; { finally }
SetViewPort(vp.x1,vp.y1,vp.x2,vp.y2,vp.clip);
SetWriteMode(NormalPut);
if mdr then MouseOn;
DSdrawn:=not DSdrawn;
end;
procedure DrawShipRange;
{ var vp : ViewPortType;
xx,yy : int;
i2,ee,ww,ff,mm,n1 : int;
h1 : sptr;}
begin
(* with lship^ do
begin
if (ltype<>LockS) or (hull<=0) or (mass<=0) then Exit;
MouseOff;
GetViewSettings(vp);
SetViewPort(0,0,479,479,ClipOn);
SetLineStyle(SolidLn,0,NormWidth);
SetColor(DarkGray);
SetWriteMode(XORPut);
if not SRdrawn then
begin
ee:=IIF(El>0,El,9);
ww:=IIF(El>0,IIF(warp=0,El,warp),9);
ff:=IIF(fuel=-1,mass-Hulls[hull].mass,fuel);
mm:=mass;
n1:=IIF(mission=7,tow_ship,0);
if (n1<>-1) and (n1<>0) then { tow }
begin
h1:=TTurn^.data^.ship[n1];
if (h1<>nil) and (h1^.mass<>-1) then mm:=mm+h1^.mass;
end;
i2:=ww*ww;
if Lo(hull) in GraviHulls then i2:=i2*2;
SRradius:=Round(Ln(ff/mm)/Ln(1-Engines[ee].burn[ww]/100000)*i2);
end;
Abs2Scr(x,y,xx,yy);
DrawWCircle(xx,yy,long(SRradius)*ratio2 div ratio1));
SetWriteMode(NormalPut);
SetViewPort(vp.x1,vp.y1,vp.x2,vp.y2,vp.clip);
MouseOn;
end;
SRdrawn:=not SRdrawn;*)
end;
function MarkOffsetX(t:MarkType) : int;
begin
MarkOffsetX:=0;
if t=mrkFlag then
begin
MarkOffsetX:=-1;
end;
end;
function MarkOffsetY(t:MarkType) : int;
begin
MarkOffsetY:=0;
if (t=mrkFlag) or (t=mrkGrave) or (t=mrkCactus) then
begin
MarkOffsetY:=3;
end;
end;
procedure DrawMark (x,y:int; c:byte; t:MarkType); { XREF to VPA 3 }
begin
if t=mrkDLine then SetLineStyle(UserBitLn,$5B5B,NormWidth)
else SetLineStyle(SolidLn,0,NormWidth);
SetWriteMode(NormalPut);
SetColor(c);
case t of
mrkFlag : begin Line(x,y,x,y-7);
Line(x,y-6,x+3,y-5);
Line(x+3,y-5,x,y-4) end;
mrkCircle : Circle(x,y,2); { not DrawCircle! they can be on the right screen }
mrkCross : begin Line(x-2,y-2,x+2,y+2);
Line(x-2,y+2,x+2,y-2) end;
mrkSquare : Rectangle(x-2,y-2,x+2,y+2);
mrkRhombe : begin Line(x-2,y,x,y-2);
Line(x,y-2,x+2,y);
Line(x+2,y,x,y+2);
Line(x,y+2,x-2,y) end;
mrkPoint : PutPixel(x,y,c);
mrkRCircle: Circle(x,y,3); { not DrawCircle! they can be on the right screen }
mrkLine,
mrkDLine : Line(x-3,y-3,x+3,y+3);
mrkGrave : begin Line(x,y,x,y-6);
Line(x-2,y-5,x+2,y-5);
Line(x-1,y-1,x+1,y-2); end;
mrkCactus : begin Line(x,y,x,y-6);
Line(x-2,y-4,x-2,y-5);
Line(x-1,y-3,x+1,y-2);
Line(x+2,y-3,x+2,y-5); end;
end;
end;
procedure DrawMap (clr:boolean);
var xx,yy : int;
x2,y2 : int;
i : int;
l0 : int;
c : byte;
sh0 : boolean;
s : str20;
ls : byte absolute s;
mc : String[1];
begin
MouseOff;
MouseDisabled:=Yes;
SetViewPort(0,0,479,479,ClipOn);
if clr then
begin
ClearViewPort;
DSdrawn:=No;
SRdrawn:=No;
end
else begin
if DSdrawn then DrawPath;
if SRdrawn then DrawShipRange;
if distlock<>0 then DrawDistLock;
if dline then begin dline:=No; DrawDistLine end;
MouseOff; { DrawDistLock and DrawDistLine turn mouse on! }
end;
if MapWrap then
begin
SetColor(DarkGray);
SetLineStyle(DashedLn,0,NormWidth);
Abs2Scr(MapX0,MapY0,xx,yy);
Line(xx,0,xx,479);
Line(0,yy,479,yy);
end;
SetLineStyle(SolidLn,0,NormWidth);
with TTurn^.data^ do
begin
if showT or not clr then
begin
DSwm:=NormalPut;
sh0:=showT; showT:=No;
l0:=lock;
ltype:=LockS;
for i:=1 to 999 do
if ship[i]<>nil then
with ship[i]^ do
if when=turn then
begin
lock:=i or LockS;
DScolorR:=IIF(sh0 and (((showS) and (owner=player)) or ((showE) and (owner<>player))),cmRoute,Black);
DSColorO:=IIF(DSColorR=Black,Black,cmRoute);
DSColorT:=IIF(DSColorR=Black,Black,cmTrace);
DrawPath;
end;
ltype:=LockI;
for i:=1 to 50 do
if ion[i]<>nil then
with ion[i]^ do
begin
lock:=i or LockI;
DScolorR:=IIF(sh0 and showI,cmRoute,Black);
DSColorO:=IIF(DSColorR=Black,Black,cmTow);
DSColorT:=IIF(DSColorR=Black,Black,cmTrace);
DrawPath;
end;
ltype:=LockU;
for i:=1 to 100 do
if ufo[i]<>nil then
with ufo[i]^ do
begin
lock:=i or LockU;
DScolorR:=IIF(sh0 and showU,cmRoute,Black);
DSColorO:=IIF(DSColorR=Black,Black,cmTow);
DSColorT:=IIF(DSColorR=Black,Black,cmTrace);
DrawPath;
end;
lock:=l0; ltype:=lock and LockHi;
showT:=sh0;
end;
DSwm:=XORPut; DScolorR:=cmRoute; DScolorT:=cmTrace; DScolorO:=cmTow; DSdrawn:=No;
if showI or not clr then
for i:=1 to 50 do
if ion[i]<>nil then
with ion[i]^ do
begin
Abs2Scr(x,y,xx,yy);
SetColor(IIF(showI,IIF(voltage<50,cmIWeak,IIF(voltage<150,cmIMod,cmIDang)),Black));
DrawWCircle(xx,yy,long(radius)*ratio2 div ratio1);
end;
if IsMines and (showM or not clr) then
for i:=1 to 500 do
if mines[i]<>nil then
with mines[i]^ do
begin
Abs2Scr(x,y,xx,yy);
SetColor(IIF(showM,RaceColor[owner,_M_],Black));
DrawWCircle(xx,yy,Round(Sqrt(MaxL(units,0))*ratio2/ratio1));
end;
if showP and (ratioN>=PNRatio) then
begin
if UseSmallFont then SetTextStyle(SmallFont,HorizDir,4);
SetTextJustify(CenterText,BottomText);
SetColor(LightGray);
for i:=1 to 500 do
if (xyplan[i,1]<>-1) and Abs2Scr(xyplan[i,1],xyplan[i,2],xx,yy) then
begin
c:=eplan[i].owner;
if c=255 then c:=0;
SetColor(RaceColor[c,_P_]);
OutTextXY(xx,yy-4,PlName(i,No));
end;
for i:=1 to 100 do
if ufo[i]<>nil then
with ufo[i]^ do
if (color<>0) and Abs2Scr(x,y,xx,yy) then
begin
SetColor(color);
s:=name; Trim(s);
OutTextXY(xx,yy-4,s);
end;
if UseSmallFont then SetTextStyle(DefaultFont,HorizDir,1);
SetTextJustify(LeftText,TopText);
end;
if showA then
begin
mc := '*';
if UseSmallFont then SetTextStyle(SmallFont,HorizDir,4);
for i:=1 to nmark do
with mark^[i] do
if (mtype<>mrkNone) and (Abs2Scr(x,y,xx,yy) or
(mtype in [mrkRCircle..mrkDLine])) then begin
mc[1] := MarkGroup[mtype][color];
if (LastMarkMask < 1) or (MarkMask[CurMarkMask]='*') or
(PosInStr(mc,MarkMask[CurMarkMask]) <> 0) then
{ Abs2Scr MUST be executed, therefore, it is first in OR }
begin
if mtype=mrkRCircle then
begin
SetColor(color);
DrawWCircle(xx,yy,long(radius)*ratio2 div ratio1);
end else
if mtype in [mrkLine,mrkDLine] then
begin
SetLineStyle(IIF(mtype=mrkDLine,DashedLn,SolidLn),0,NormWidth);
x2:=xx; y2:=yy;
inc(x2,long(dx)*ratio2 div ratio1);
dec(y2,long(dy)*ratio2 div ratio1);
SetColor(color);
DrawWLine(xx,yy,x2,y2,No);
end
else begin
DrawMark(xx,yy,color,mtype);
s:=GetMarkText(i);
if (ls>0) and (s[1]<>'`') then
begin
SetTextJustify(xalg,yalg);
OutTextXY(xx+(1-xalg)*3+1,yy+(yalg-1)*3-1,s);
end;
end;
end;
end;
if UseSmallFont then SetTextStyle(DefaultFont,HorizDir,1);
SetTextJustify(LeftText,TopText);
end;
if showU or not clr then
begin
for i:=0 to 199 do
if worm[i]<>nil then
with worm[i]^ do
begin
Abs2Scr(x,y,xx,yy);
SetColor(IIF(showU,cmWorm,Black));
DrawWCircle(xx,yy,Round(( Exp(Ln(mass)*WormPower/100)/2 )*ratio2/ratio1));
if (i and 1=1) and (worm[i-1]<>nil) then
begin
MoveTo(xx,yy);
with worm[i-1]^ do Abs2Scr(x,y,xx,yy);
if showU and (cmWorm and 8=8) then SetColor(cmWorm xor 8);
SetLineStyle(DashedLn,0,NormWidth);
LineTo(xx,yy);
end;
end;
for i:=1 to 100 do
if ufo[i]<>nil then
with ufo[i]^ do
begin
Abs2Scr(x,y,xx,yy);
SetColor(IIF(showU,color,Black));
DrawWCircle(xx,yy,long(radius)*ratio2 div ratio1);
end;
end;
for i:=1 to 999 do
if (ship[i]<>nil) and (splan[i]<>0) then
with ship[i]^ do
if when=turn then
if Abs2Scr(x,y,xx,yy) then
begin
c:=RaceColor[owner,_S_];
c:=IIF(((owner=player) and showS) or ((owner<>player) and showE),c,Black);
SetColor(c); Circle(xx,yy,IIF(owner=player,3,2));
end;
for i:=1 to 500 do
if (xyplan[i,1]<>-1) and Abs2Scr(xyplan[i,1],xyplan[i,2],xx,yy) then
begin
c:=eplan[i].owner;
if c=255 then c:=0;
c:=IIF(eplan[i].activity and EP_Base=0,RaceColor[c,_P_],RaceColor[c,_B_]);
PutPixel(xx,yy,c);
if (LargePlanets and (ratioN>1)) or (eplan[i].activity and EP_Base<>0) then
begin
PutPixel(xx-1,yy,c);
PutPixel(xx+1,yy,c);
PutPixel(xx,yy-1,c);
PutPixel(xx,yy+1,c);
end;
end;
for i:=1 to 999 do
if (ship[i]<>nil) and (splan[i]=0) then
with ship[i]^ do
if (when=turn) and (owner<>player) then
if Abs2Scr(x,y,xx,yy) then
PutPixel(xx,yy,IIF(showE,RaceColor[owner,_S_],Black));
for i:=1 to 999 do
if (ship[i]<>nil) and (splan[i]=0) then
with ship[i]^ do
if (when=turn) and (owner=player) then
if Abs2Scr(x,y,xx,yy) then
begin
c:=RaceColor[owner,_S_];
if showS or (GetPixel(xx,yy)=c) then PutPixel(xx,yy,IIF(showS,c,Black));
end;
end;
if distlock<>0 then DrawDistLock;
if dline then begin dline:=No; DrawDistLine end;
{if not showT then} DrawPath;
DrawShipRange;
SetViewPort(0,0,639,479,ClipOn);
MouseDisabled:=No;
MouseOn;
end;
procedure LockDistTarget (xx,yy:int);
var i,n,mm : int;
{ ef,r : long;
i2 : int;}
{nd,}dd : single;
mx,my : int;
s,s1,s2 : string[6];
{ h1 : sptr;}
{ kf : single;}
{ clFB : int;}
dlsh1 : SRec;
lsxy0 : array [1..2,1..2] of int;
begin
if dline then DrawDistLine;
Abs2Scr(xx,yy,mx,my);
Move(lsxy,lsxy0,SizeOf(lsxy));
Abs2Scr(dlx,dly,lsxy[1,1],lsxy[1,2]);
lsxy[2,1]:=mx; lsxy[2,2]:=my;
DrawDistLine;
if forceDL then forceDL:=No
else if not Diff(lsxy,lsxy0,SizeOf(lsxy)) then Exit;
if MapWrap then
begin
if Sign(dlx-xx)<>Sign(lsxy[1,1]-lsxy[2,1]) then inc(xx,MapSize*Sign(lsxy[2,1]-lsxy[1,1]));
if Sign(yy-dly)<>Sign(lsxy[1,2]-lsxy[2,2]) then inc(yy,MapSize*Sign(lsxy[1,2]-lsxy[2,2]));
end;
dd:=Trunc(Sqrt(Distance2(dlx,dly,xx,yy))*10)/10;
Str(dd:4:1,s);
SetColor(LightGray);
Clear(MX0,dll+2,639,479);
if dll>400 then OutTextXY(MX0,472,'Distance = '+s)
else begin
OutTextXY(MX0,370,'Distance = '+s);
OutTextXY(MX0,380,'Warp Time Fuel');
SetLineStyle(SolidLn,0,NormWidth);
Line(MX0,388,623,388);
with dlship do
begin
if (mass=-1) or (hull=-1) or (El=-1) or (fuel=-1) then Exit;
wx:=xx-dlx;
wy:=yy-dly;
dlship.mission:=IIF(dlc=1,10,IIF(dlship.tow_ship=0,0,7));
if dd=0 then
begin
if dlc=1 then
begin
dlsh1:=dlship;
CalcMove(dlsh1,No);
n:=dlship.fuel-dlsh1.fuel;
SetColor(IIF(dlship.fuel>n,LightGray,Brown));
OutTextXY(MX0,392,'Cloaking : '+NStr0(n)+' kt');
end;
if (dlc<>2) and (turn=today) and (dlship.owner=player) then
begin
SetColor(White);
OutTextXY(MX0,392,'C');
end;
Exit;
end;
for i:=1 to 9 do
begin
dlsh1:=dlship;
dlsh1.warp:=i;
CalcMovement(@dlsh1,mm,n);
SetColor(IIF(mm>fuel,IIF(i=dlship.warp,Brown,DarkGray),
IIF(i=dlship.warp,Yellow,LightGray)));
if distlock<0 then inc(n,dlt);
if distlock<0 then inc(mm,dlf);
Str(i:2,s);
if n>=20000 then
begin
s1:=' too';
s2:='long';
end
else begin
Str(n:4,s1);
s2:=NStrMax(mm,4,'+');
for n:=1 to 3 do
if s2[n]='-' then s2[n]:='+';
end;
OutTextXY(MX0+8,380+i*10,s+' '+s1+' '+s2);
Line(MX0,388+i*10,623,388+i*10);
if (i<>dlship.warp) and (turn=today) {and (dlship.owner=player)} then
begin
SetColor(White);
OutTextXY(MX0+8,380+i*10,s);
end;
if dlc=1 then
begin
SetColor(LightGray);
OutTextXY(640-8,380+i*10,Copy('Cloaked',i,1));
end;
end;
if (dlc<>2) and (turn=today) {and (dlship.owner=player)} then
begin
SetColor(White);
OutTextXY(640-8,380+1*10,'C');
end;
end;
end;
end;
(*procedure LockDistTarget (lx,ly:int);
var i,n,mm : int;
ef,r : long;
i2 : int;
nd,dd : single;
mx,my : int;
s,s1,s2 : string[6];
h,h1 : sptr;
kf : single;
clFB : int;
n1 : int;
begin
if dline then DrawDistLine;
Abs2Scr(lx,ly,mx,my);
Abs2Scr(dlx,dly,lsxy[1,1],lsxy[1,2]);
lsxy[2,1]:=mx; lsxy[2,2]:=my;
DrawDistLine;
if MapWrap then
begin
if Sign(dlx-lx)<>Sign(lsxy[1,1]-lsxy[2,1]) then inc(lx,MapSize*Sign(lsxy[2,1]-lsxy[1,1]));
if Sign(ly-dly)<>Sign(lsxy[1,2]-lsxy[2,2]) then inc(ly,MapSize*Sign(lsxy[1,2]-lsxy[2,2]));
end;
dd:=Sqrt(Distance2(dlx,dly,lx,ly));
Str(dd:4:1,s);
SetColor(LightGray);
Clear(MX0,dll+2,639,479);
if dll>400 then OutTextXY(MX0,472,'Distance = '+s)
else begin
OutTextXY(MX0,370,'Distance = '+s);
OutTextXY(MX0,380,'Warp Time Fuel');
SetLineStyle(SolidLn,0,NormWidth);
Line(MX0,388,623,388);
h:=TTurn^.data^.ship[Abs(distlock) and LockLo];
if (h=nil) or (h^.mass=-1) or (h^.hull=-1) or (h^.El=-1) or (h^.fuel=-1) then Exit;
with h^ do
begin
mm:=mass;
n1:=IIF(mission=7,tow_ship,0);
if n1>0 then { tow }
begin
h1:=TTurn^.data^.ship[n1];
if (h1<>nil) and (h1^.mass<>-1) then inc(mm,h1^.mass);
if TSh=n1 then inc(mm,TN+TT+TD+TM+TC+TS);
end;
end;
if dlc=1 then
begin
i:=h^.mission;
h^.mission:=10;
clFB:=CloakFuel(h);
h^.mission:=i;
end
else clFB:=0;
if distlock<0 then dec(mm,MinL(h^.fuel,dlf));
if dd=0 then
begin
if dlc=1 then
begin
SetColor(IIF(h^.fuel>clFB,LightGray,Brown));
OutTextXY(MX0,392,'Cloaking : '+NStr0(clFB)+' kt');
end;
if (dlc<>2) and (turn=today) and (h^.owner=player) then
begin
SetColor(White);
OutTextXY(MX0,392,'C');
end;
Exit;
end;
for i:=1 to 9 do
begin
i2:=i*i; { XREF to CalcFuel }
if IsHullFunc(h^.hull,hfGravitonic)<>0 then i2:=i2*2;
ef:=Engines[h^.El].burn[i];
kf:=ef/100000;
SetColor(IIF(i=dlw{h^.warp},Yellow,LightGray));
Str(i:2,s);
if dd<i2+1 then n:=1 else n:=Ceil(dd/i2); { XREF to ETA }
if distlock<0 then inc(n,dlt);
Str(n:4,s1);
dec(n);
if n>0 then r:=Trunc(long(mm)*(1.0-Exp(Ln(1-kf)*n)))
else r:=0;
nd:=dd-long(i2)*n;
inc( r , long(clFB)*(n+1)+Trunc(nd*((long(mm)-MinL(r,h^.fuel)) div 10)*(ef/i2)/10000) ); {local XREF}
if distlock<0 then inc(r,dlf);
if i=dlw{h^.warp} then
begin
if dd>i2 then nd:=i2 else nd:=dd;
dlf0:=Trunc(nd*(mm div 10)*(ef/i2)/10000)+clFB; { local XREF }
end;
if r>h^.fuel then SetColor(IIF(i=dlw{h^.warp},Brown,DarkGray));
s2:=NStrMax(r,4,'+');
OutTextXY(MX0+8,380+i*10,s+' '+s1+' '+s2);
Line(MX0,388+i*10,623,388+i*10);
if (i<>dlw) and (turn=today) and (h^.owner=player) then
begin
SetColor(White);
OutTextXY(MX0+8,380+i*10,s);
end;
if dlc=1 then
begin
SetColor(LightGray);
OutTextXY(640-8,380+i*10,Copy('Cloaked',i,1));
end;
end;
if (dlc<>2) and (turn=today) and (h^.owner=player) then
begin
SetColor(White);
OutTextXY(640-8,380+1*10,'C');
end;
end;
end;*)
procedure CenterMap (x,y:int; forced:boolean);
var sx,sy : int;
begin
Abs2Scr(x,y,sx,sy);
if forced or (sx<0) or (sy<0) or (sx>479) or (sy>479) then
begin
inc(x0,sx-240); inc(y0,sy-240);
MoveMouseTo(240,240);
DrawMap(Yes);
if distlock<>0 then LockDistTarget(mmx,mmy);
end;
end;
procedure Zoom (k:byte); {0 - ZoomOut, 1 or 255 - enlarge/sqeeze }
var mx,my : int;
w0 : boolean;
begin
Scr2Abs(MouseX,MouseY,mx,my);
if k=0 then ratioN:=1
else begin
inc(ratioN,k);
if ratioN=0 then ratioN:=NRatios;
if ratioN>NRatios then ratioN:=1;
end;
InitRatios;
x0:=0; y0:=0;
w0:=MapWrap; MapWrap:=No;
if ratioN=1 then
begin
Abs2Scr(mx,my,MouseX,MouseY);
MouseX:=Min(Max(MouseX,0),479);
MouseY:=Min(Max(MouseY,0),479);
end
else begin
Abs2Scr(mx,my,x0,y0);
dec(x0,239); dec(y0,239);
MouseX:=240; MouseY:=240;
end;
MapWrap:=w0;
MoveMouseTo(MouseX,MouseY);
DrawMap(Yes);
if lock<>0 then begin force:=lock; ForceKey:=13 end
else MouseMove;
end;
procedure SetScreenPos (n:byte);
begin
if KbdFlags and KbdShft<>0 then { store screen pos }
begin
Move(ratioN,ScreenPos[n],SizeOf(VPAScr)-2);
ScreenPos[n].force:=lock;
end
else if ScreenPos[n].ratioN<>0 then
begin { retrieve screen pos }
MouseMove;
Move(ScreenPos[n],ratioN,SizeOf(VPAScr)-2-NShows); { without showflags }
InitRatios;
force:=ScreenPos[n].force;
DrawMap(Yes);
if force<>0 then ForceKey:=13;
end;
end;
procedure InitObjList;
var i : int;
h : sptr;
p : pptr;
begin
ObjL0:=0;
ObjN:=0;
for i:=1 to 999 do
if ShipIsHere(i,lx,ly) then
begin
if lock=i or LockS then ObjL0:=ObjN div 10; { before increment! }
inc(ObjN);
end;
ShipN:=ObjN;
with TTurn^.data^ do
begin
if showM then
for i:=1 to 500 do
if (mines[i]<>nil) and (mines[i]^.x=lx) and (mines[i]^.y=ly) then
begin
if lock=i or LockM then ObjL0:=ObjN div 10;
inc(ObjN);
end;
MineN:=ObjN;
if showI then
for i:=1 to 50 do
if (ion[i]<>nil) and (ion[i]^.x=lx) and (ion[i]^.y=ly) then
begin
if lock=i or LockI then ObjL0:=ObjN div 10;
inc(ObjN);
end;
IonN:=ObjN;
if showU then
for i:=0 to 199 do
if (worm[i]<>nil) and (worm[i]^.x=lx) and (worm[i]^.y=ly) then
begin
if lock=i or LockW then ObjL0:=ObjN div 10;
inc(ObjN);
end;
WormN:=ObjN;
if showU then
for i:=1 to 100 do
if (ufo[i]<>nil) and (ufo[i]^.x=lx) and (ufo[i]^.y=ly) then
begin
if lock=i or LockU then ObjL0:=ObjN div 10;
inc(ObjN);
end;
UfoN:=ObjN;
if showA then
for i:=1 to nmark do
with mark^[i] do
if ((mtype<>mrkNone) and (x=lx) and (y=ly)) or
((mtype in [mrkLine,mrkDLine]) and (x+dx=lx) and (y+dy=ly)) then
begin
if lock=i or LockA then ObjL0:=ObjN div 10;
inc(ObjN);
end;
end;
if lock=0 then PlanN:=0
else PlanN:=PSearchXY(lx,ly);
end;
function GoToShipXY (var h:sptr; x,y,k:int) : int;
var i : int;
begin
for i:=1 to 999 do
if ShipIsHere(i,x,y) then
begin
h:=TTurn^.data^.ship[i];
dec(k);
if k<=0 then begin GoToShipXY:=i or LockS; Exit end;
end;
h:=nil;
GoToShipXY:=0;
end;
function ShipNumXY (h:sptr; x,y:int) : word;
var i,k : int;
begin
k:=1;
if h<>nil then
begin
for i:=1 to 999 do
if ShipIsHere(i,x,y) then
begin
if TTurn^.data^.ship[i]=h then Break;
inc(k);
end;
end;
ShipNumXY:=k;
end;
function GoToMinesXY (var m:mptr; x,y,k:int) : int;
var i : int;
begin
with TTurn^.data^ do
for i:=1 to 500 do
if (mines[i]<>nil) and (mines[i]^.x=x) and (mines[i]^.y=y) then
begin
m:=mines[i];
dec(k);
if k<=0 then begin GoToMinesXY:=i or LockM; Exit end;
end;
m:=nil;
GoToMinesXY:=0;
end;
function GoToIonXY (var ii:iptr; x,y,k:int) : int;
var i : int;
begin
with TTurn^.data^ do
for i:=1 to 50 do
if (ion[i]<>nil) and (ion[i]^.x=x) and (ion[i]^.y=y) then
begin
ii:=ion[i];
dec(k);
if k<=0 then begin GoToIonXY:=i or LockI; Exit end;
end;
ii:=nil;
GoToIonXY:=0;
end;
function GoToWormXY (var w:wptr; x,y,k:int) : int;
var i : int;
begin
with TTurn^.data^ do
for i:=0 to 199 do
if (worm[i]<>nil) and (worm[i]^.x=x) and (worm[i]^.y=y) then
begin
w:=worm[i];
dec(k);
if k<=0 then begin GoToWormXY:=i or LockW; Exit end;
end;
w:=nil;
GoToWormXY:=0;
end;
function GoToUfoXY (var u:uptr; x,y,k:int) : int;
var i : int;
begin
with TTurn^.data^ do
for i:=1 to 100 do
if (ufo[i]<>nil) and (ufo[i]^.x=x) and (ufo[i]^.y=y) then
begin
u:=ufo[i];
dec(k);
if k<=0 then begin GoToUfoXY:=i or LockU; Exit end;
end;
u:=nil;
GoToUfoXY:=0;
end;
function GoToMarkXY (var a:MapMark; x,y,k:int) : int;
var i : int;
begin
with TTurn^.data^ do
for i:=1 to nmark do
with mark^[i] do
if ((mtype<>mrkNone) and (x=lx) and (y=ly)) or
((mtype in [mrkLine,mrkDLine]) and (x+dx=lx) and (y+dy=ly)) then
begin
a:=mark^[i];
dec(k);
if k<=0 then begin GoToMarkXY:=i or LockA; Exit end;
end;
GoToMarkXY:=0;
end;
procedure ObjList;
var h : sptr;
m : mptr;
ii : iptr;
w : wptr;
u : uptr;
a : MapMark;
k : byte;
l : int;
s : string[8];
n : int;
ms : str20;
mls : byte absolute s;
procedure Highlight;
begin
SetFillStyle(SolidFill,8);
Bar(MX0,l,639,l+7);
Obj0:=k;
end;
begin
if (distlock<>0) and (dll<400) then Exit;
if distlock<>0 then Clear(MX0,ListY,639,dll-2)
else begin
Clear(MX0,ListY,639,479);
DrawHelpPrompt;
end;
if lock=0 then Exit;
Obj0:=0;
k:=ObjL0*10+1; l:=378;
while (k<=ObjN) and (k<=ObjL0*10+10) do
begin
if k<=ShipN then
begin
n:=GoToShipXY(h,lx,ly,k);
if h<>nil then
begin
if n=lock then Highlight;
SetColor(RaceColor[h^.owner,_S_]);
with h^ do
if hull<>-1 then
if owner=player then OutTextXY(MX0+24,l,name)
else OutTextXY(MX0+24,l,Hulls[hull].name)
else begin
if mass=-1 then s:='' else s:=' ('+NStr0(mass)+'kt)';
OutTextXY(MX0+24,l,'Ship '+NStr0(n and LockLo)+s);
end;
end;
end else
if k<=MineN then
begin
n:=GoToMinesXY(m,lx,ly,k-ShipN);
if n=lock then Highlight;
SetColor(RaceColor[m^.owner,_M_]);
if m^.web and 1=0 then s:='field' else s:='WEB';
OutTextXY(MX0+24,l,'Mine '+s+' '+NStr(n and LockLo));
end else
if k<=IonN then
begin
n:=GoToIonXY(ii,lx,ly,k-MineN);
if n=lock then Highlight;
SetColor(cIInfo);
OutTextXY(MX0+24,l,'Ion storm '+NStr(n and LockLo));
end else
if k<=WormN then
begin
n:=GoToWormXY(w,lx,ly,k-IonN);
if n=lock then Highlight;
SetColor(cWInfo);
OutTextXY(MX0+24,l,'Wormhole '+NStr0(n and LockLo));
end else
if k<=UfoN then
begin
n:=GoToUfoXY(u,lx,ly,k-WormN);
if n=lock then Highlight;
SetColor(u^.color);
OutTextXY(MX0+24,l,u^.name);
end
else begin
n:=GoToMarkXY(a,lx,ly,k-UfoN);
if n=lock then Highlight;
SetColor(LightGray);
OutTextXY(MX0+24+16,l,'marker');
DrawMark(MX0+24+4,l+4+MarkOffsetY(a.mtype),a.color,a.mtype);
end;
Str(k:2,s);
SetColor(cSInfo);
OutTextXY(MX0,l,s);
SetColor(White);
OutTextXY(MX0+8,l,s[2]);
inc(l,8);
inc(k);
end;
SetColor(White);
if ObjL0>0 then OutTextXY(MX0+24,ListY+12*8,'PgUp');
if (ObjN>0) and (ObjL0<(ObjN-1) div 10) then OutTextXY(640-4*8,ListY+12*8,'PgDn');
if PlanN<>0 then
begin
if (lbase<>nil) or (ltype<>LockP) then
begin
SetColor(cPInfo);
OutTextXY(640-8*8,ListY,'<Planet>');
SetColor(White);
OutTextXY(640-7*8,ListY,'P');
end;
with TTurn^.data^ do
if (lbase=nil) and (eplan[PlanN].activity and EP_Base<>0) and
(planet[PlanN]<>nil) and (planet[PlanN]^.build<>1) then
begin
k:=IIF(ltype=LockP,6,18);
SetColor(IIF((base[PlanN]<>nil) or (newplan[PlanN] and NP_Base<>0),cPInfo,cOPInfo));
OutTextXY(640-k*8,ListY,'<Base>');
if base[PlanN]<>nil then
begin
SetColor(White);
OutTextXY(640-(k-1)*8,ListY,'B');
end;
end;
end;
end;
procedure WriteMiningRate;
var s : string[3];
begin
if lplan=nil then Exit;
SetColor(IIF((lplan^.when=turn) and (lplan^.when=lplan^.when0),cPInfo,cOPInfo));
with lplan^ do
begin
if (Nc<>-1) and (Nm<>-1) and (Nc<>0) then
begin
Clear(MX0+12*8+1,308,MX0+15*8-1,315);
Str(MiningRate(lplan,Nc,Nm):3,s);
OutTextXY(MX0+12*8,308,s);
end;
if (Tc<>-1) and (Tm<>-1) and (Tc<>0) then
begin
Clear(MX0+12*8+1,318,MX0+15*8-1,325);
Str(MiningRate(lplan,Tc,Tm):3,s);
OutTextXY(MX0+12*8,318,s);
end;
if (Dc<>-1) and (Dm<>-1) and (Dc<>0) then
begin
Clear(MX0+12*8+1,328,MX0+15*8-1,335);
Str(MiningRate(lplan,Dc,Dm):3,s);
OutTextXY(MX0+12*8,328,s);
end;
if (Mc<>-1) and (Mm<>-1) and (Mc<>0) then
begin
Clear(MX0+12*8+1,338,MX0+15*8-1,345);
Str(MiningRate(lplan,Mc,Mm):3,s);
OutTextXY(MX0+12*8,338,s);
end;
end;
end;
procedure WriteMineral (M,y:int; N,Nc:long; Nm:int);
var s,s1,s2,s3 : string[6];
sm : array [1..2] of char absolute M;
begin
s:=''; s1:=' '; s2:='';
if N>-1 then Str(N:5,s);
if (Nc<>-1) and (Nc<>-2) then Str(Nc:5,s1);
if (Nm<>-1) and (Nc<>0) then
begin
Str(MiningRate(lplan,Nc,Nm):3,s3);
s2:=s3+'/'+NStrMax(Nm,2,'+');
end;
OutTextXY(MX0,y,sm+s+s1+s2);
end;
procedure WriteIncome;
var l : long;
begin
Clear(MX0+10*8,272,638,279);
l:=PlanetIncome(lplan);
if l>0 then
begin
SetColor(IIF((lplan^.when=turn) and (lplan^.when=lplan^.when0),cPInfo,cOPInfo));
OutTextXY(MX0,272,'Income : '+NStr0(l));
end;
end;
procedure WriteTaxes (tax,y:int);
var s : string[7];
begin
if tax=0 then s:='No' else s:=NStr(tax)+'%';
OutTextXY(MX0,y,' Taxes: '+s);
end;
procedure WriteActivity (var ep:epln);
var k : byte;
begin
k:=ep.activity and 7;
if k=0 then Exit;
if k>5 then k:=0;
SetColor(IIF(ep.when=turn,cPInfo,cOPInfo));
OutTextXY(MX0,224,Industry[k]);
OutTextXY(MX0,232,' industrial');
OutTextXY(MX0,240,' activity');
end;
procedure PlanetInfo;
var s : string[18];
s1 : string[8];
p : pptr;
ep : EPln;
l : long;
i,t0 : int;
number : word;
c : byte;
newpln : byte;
tsk : taskptr;
begin
if ltype<>LockP then Exit;
number:=lock and LockLo;
if (number=0) or (number>500) then Exit;
Clear(MX0,72,639,358);
SetColor(White);
OutTextXY(MX0,72,'Planet '+NStr(number));
OutTextXY(MX0,80,PlanName[number]);
SetColor(LightGray);
with TTurn^.data^ do
begin
p:=planet[number];
ep:=eplan[number];
newpln:=newplan[number];
end;
if (p=nil) and (ep.activity=0) then OutTextXY(MX0,104,'(No data)') else
if p=nil then
begin
if ep.when=turn then s:='now'
else s:=NStr(turn-ep.when)+Proper(turn-ep.when,' turn')+' ago';
OutTextXY(MX0,88,'('+s+')');
SetColor(IIF(ep.when=turn,cPInfo,cOPInfo));
if ep.owner<>0 then OutTextXY(MX0,104,'Race: '+RaceName[ep.owner]);
WriteActivity(ep);
end
else with p^ do
begin
lplan:=p;
i:=Max(when,ep.when);
t0:=when0;
if (ep.when<>0) and (ep.when<when0) then t0:=ep.when;
if i=turn then s:='now' else s:=NStr(turn-i);
s:='('+s;
if t0<>i then s:=s+' - '+NStr(turn-t0)+' trn ago'
else if t0<>turn then s:=s+Proper(turn-t0,' turn')+' ago';
s:=s+')';
OutTextXY(MX0,88,s);
if (when=turn) and (when=when0) then
begin
c:=cPInfo;
newpln:=newpln or ($FF-NP_Base);
end
else c:=cOPInfo;
if owner<>-1 then
begin
SetColor(IIF(newpln and NP_Owner=0,cOPInfo,cPInfo));
OutTextXY(MX0,104,'Race: '+RaceName[IIF(ep.owner<>0,ep.owner,owner)]);
end;
if fcode<>#$FF#$FF#$FF then
begin
i:=IIF(newpln and NP_MFD_FCode=0,cOPInfo,cPInfo);
SetColor(i);
OutTextXY(MX0,112,'FCode:');
WriteFCode(MX0+7*8,112,i,fcode);
end;
if climate<>-1 then
begin
SetColor(IIF(newpln and NP_Climate=0,cOPInfo,cPInfo));
OutTextXY(MX0,128,'Climate: '+ClimStr[ClimateType(climate)]+' '+NStrMax(100-climate,2,'+'));
end;
if Nrace<>-1 then
begin
SetColor(IIF(newpln and NP_NRace_NPop=0,cOPInfo,cPInfo));
if Nrace<>0 then
begin
OutTextXY(MX0,136,'Natives:');
OutTextXY(MX0,144,' '+NatRace[Nrace]);
if natives<>-1 then OutTextXY(MX0,160,' Pop. : '+NStr(natives)+'00');
SetColor(c);
if Ngovt<>-1 then OutTextXY(MX0,152,' '+NatGovt[Ngovt]);
WriteHChange(Yes);
if Ntax<>-1 then WriteTaxes(Ntax,168);
if Nstat<>-1 then
begin
SetColor(IIF(Nstat>=70,c,IIF(Nstat<30,LightRed,Yellow)));
OutTextXY(MX0,176,' Happy: '+NStr0(Nstat)+'%');
end;
end
else OutTextXY(MX0,144,'(no native life)');
end;
if (ep.owner<>0) and (ep.owner<>owner) and (ep.when>=when) then WriteActivity(ep)
else begin
if colonists<>-1 then
begin
SetColor(IIF(newpln and NP_CPop=0,cOPInfo,cPInfo));
if owner<>0 then
begin
OutTextXY(MX0,184,'Colonists:');
if colonists<>-1 then OutTextXY(MX0,192,' Pop. : '+NStr(colonists)+'00');
SetColor(c);
WriteHChange(No);
if Ctax<>-1 then WriteTaxes(Ctax,200);
end
else begin
OutTextXY(MX0,200,'Colonists: None');
OutTextXY(MX0,208,'( )');
end;
end;
if Cstat<>-1 then
begin
SetColor(IIF(Cstat>=70,c,IIF(Cstat<30,LightRed,Yellow)));
OutTextXY(MX0,208,' Happy: '+NStr0(Cstat)+'%');
end;
if (colonists<>-1) and (mines and factories and defense<>-1) then
begin
i:=IIF(newpln and NP_MFD_FCode=0,cOPInfo,cPInfo);
SetColor(i);
if mines<>-1 then
begin
l:=MaxPlanetStruct(p,200);
Str(mines:3,s); Str(l,s1);
OutTextXY(MX0,224,'Mines : /'+s1);
if mines>l then SetColor(Red);
OutTextXY(MX0+11*8,224,s);
SetColor(i);
end;
if factories<>-1 then
begin
l:=MaxPlanetStruct(p,100);
Str(factories:3,s); Str(l,s1);
OutTextXY(MX0,232,'Factories: /'+s1);
if factories>l then SetColor(Red);
OutTextXY(MX0+11*8,232,s);
SetColor(i);
end;
if defense<>-1 then
begin
l:=MaxPlanetStruct(p,50);
Str(defense:3,s); Str(l,s1);
OutTextXY(MX0,240,'Defense : /'+s1);
if defense>l then SetColor(Red);
OutTextXY(MX0+11*8,240,s);
SetColor(i);
end;
end
else WriteActivity(ep);
if supplies<>-1 then
begin
SetColor(IIF(newpln and NP_Supplies=0,cOPInfo,cPInfo));
{SetColor(c);}
OutTextXY(MX0,256,'Supplies: '+NStr0(supplies));
end;
if funds<>-1 then
begin
SetColor(IIF(newpln and NP_NTDM_Funds=0,cOPInfo,cPInfo));
OutTextXY(MX0,264,'Funds : '+NStr0(funds));
end;
WriteIncome;
end;
if N and T and D and M<>-1 then
begin
SetColor(IIF(newpln and NP_NTDM_Funds=0,cOPInfo,cPInfo));
OutTextXY(MX0,288,'Minerals: ');
SetLineStyle(SolidLn,0,NormWidth);
i:=IIF(Nm and Tm and Dm and Mm<>-1,639,MX0+12*8);
Line(MX0+2*8,306,i,306);
Line(MX0+2*8,316,i,316);
Line(MX0+2*8,326,i,326);
Line(MX0+2*8,336,i,336);
Line(MX0+2*8,346,i,346);
Line(MX0+2*8,307,MX0+2*8,345);
Line(MX0+12*8,307,MX0+12*8,345);
if (Nc and Tc and Dc and Mc<>-1) then
begin
Line(MX0+7*8,307,MX0+7*8,345);
OutTextXY(MX0,298,' Surf Core Extr');
end
else begin
if i=639 then s:=' Ext' else s:='';
OutTextXY(MX0,298,' Surf+Core'+s);
end;
WriteMineral($654E,308,N,Nc,Nm);
WriteMineral($7254,318,T,Tc,Tm);
WriteMineral($7544,328,D,Dc,Dm);
WriteMineral($6F4D,338,M,Mc,Mm);
end;
if build=1 then
begin
SetColor(Yellow);
OutTextXY(MX0,351,'BUILDING STARBASE');
end;
SetColor(White);
if (Nrace>0) and (Ngovt<>-1) and (natives<>-1) and (climate<>-1) then OutTextXY(MX0+8,168,'T');
if RWMode and (turn=today) and (when=today) and (distlock=0) and (owner=player) then
begin
OutTextXY(MX0,112,'F');
OutTextXY(MX0+24,200,'x');
OutTextXY(MX0,224,'M');
OutTextXY(MX0+8,232,'a');
OutTextXY(MX0,240,'D');
OutTextXY(MX0,256,'S');
if build=1 then OutTextXY(MX0,351,'B');
if (ep.activity and EP_Base=0) and (build=0) and (T>=402) and (D>=120) and (M>=340) and (funds+supplies>=900) then
begin
OutTextXY(MX0,351,'B');
SetColor(cPInfo);
OutTextXY(MX0+8,351,'uild Starbase');
end;
tsk:=FindTask(lock);
if tsk<>nil then
begin
SetColor(LightGray);
OutTextXY(640-4*8,72,'< >');
if tsk^.flag and tfDeac=0 then SetColor(White);
OutTextXY(640-3*8,72,'F8');
end;
end;
end;
lbase:=nil;
ObjList;
if (ep.owner<>0) and (ep.owner<>player) and (not IsData[ep.owner]) and
(ep.activity and EP_NoBase<>0) then
begin
SetColor(IIF(newpln and NP_Base=0,cOPInfo,cPInfo));
OutTextXY(640-9*8,ListY,'<No Base>');
end;
end;
procedure BaseStorage;
type str18 = string[18];
var s : string[7];
l,l0 : word;
i,j : byte;
sl0 : int;
myrace : int;
procedure Say (s:str18);
begin
if (l>=BL0) and (l<=BL0+BL2-BL1) then
begin
OutTextXY(MX0,BL1+l-BL0,s);
sl0:=0;
end
else if l>BL0+BL2-BL1 then bOver:=Yes;
inc(l,8);
end;
procedure SLine;
begin
if (l<>l0) and (l>=BL0+8) and (l<=BL0-BL1+BL2+8) then
begin
sl0:=BL1+l-BL0+3;
Line(MX0,sl0,639,sl0);
end;
inc(l,8); l0:=l;
end;
begin
Clear(MX0,BL1,639,BL2+15);
bOver:=No;
sl0:=0;
with lbase^ do
begin
if TrueHullByRace then myrace:=Race[owner]
else myrace:=owner;
l:=BL1; l0:=BL1;
s:='';
for i:=1 to 20 do
for j:=1 to HH[i] do
begin
if (cHl=i) and (s='') then
begin SetColor(Yellow); s:='1' end
else SetColor(cBInfo);
Say(Hulls[RaceHull[myrace,i]].name);
end;
SetColor(cBInfo);
SLine;
for i:=1 to 9 do
if EE[i]<>0 then
begin
SetColor(IIF(cEl=i,Yellow,cBInfo));
Say(NStr(EE[i])+' '+Proper(EE[i],Engines[i].name));
end;
SetColor(cBInfo);
SLine;
for i:=1 to 10 do
if WW[i]<>0 then
begin
SetColor(IIF(cWl=i,Yellow,cBInfo));
Say(NStr(WW[i])+' '+Proper(WW[i],Beams[i].name));
end;
SetColor(cBInfo);
SLine;
for i:=1 to 10 do
if LL[i]<>0 then
begin
SetColor(IIF(cTl=i,Yellow,cBInfo));
Say(NStr(LL[i])+' '+Proper(LL[i],Torps[i].name+' launcher'));
end;
SetColor(cBInfo);
SLine;
for i:=1 to 10 do
if TT[i]<>0 then Say(NStr(TT[i])+' '+Proper(LL[i],Torps[i].name+' torpedo'));
SLine;
end;
if sl0<>0 then
begin
SetColor(Black);
Line(MX0,sl0,639,sl0);
end;
SetColor(cBInfo);
l:=BL0-BL1+BL2+8; l0:=0; SLine;
SetColor(White);
if BL0>BL1 then OutTextXY(MX0,BL2+8,'Home');
if bOver then OutTextXY(640-3*8,BL2+8,'End');
end;
function CheckClone (baseId:int) : int;
{ -1 - impossible, 0 - possible but not active, 1..999 - id being cloned }
var i,x,y,k : int;
h : sptr;
begin
CheckClone:=-1;
if (not Cloning) or (CloneCost[player]=32767) then Exit;
with TTurn^.data^ do
begin
x:=xyplan[baseId,1];
y:=xyplan[baseId,2];
end;
for i:=1 to ShipN do
begin
k:=GoToShipXY(h,x,y,i);
if (h<>nil) and (h^.when=turn) and (h^.owner=player) and not OwnShipDesign(player,h^.hull) then
if h^.fcode<>'cln' then CheckClone:=0
else begin CheckClone:=k and LockLo; Exit end;
end;
end;
procedure BaseInfo;
var l : int;
number : word;
begin
if ltype<>LockP then Exit;
number:=lock and LockLo;
if (number=0) or (number>500) then Exit;
lplan:=TTurn^.data^.planet[number];
lbase:=TTurn^.data^.base[number];
if lbase=nil then Exit;
Clear(MX0,72,639,358);
SetColor(White);
OutTextXY(MX0,72,'Starbase '+NStr(number));
OutTextXY(MX0,80,PlanName[number]);
BL0:=BL1;
with lbase^ do
begin
SetColor(cBInfo);
OutTextXY(MX0,96,'Defense: '+NStr0(defense));
OutTextXY(MX0,104,'Damage:');
if damage>0 then
begin
SetColor(LightRed);
OutTextXY(MX0+10*8,104,NStr(damage)+'%');
SetColor(cBInfo);
end;
OutTextXY(MX0,112,'Fighters: '+NStr(fighters));
OutTextXY(MX0,120,'Primary order:');
OutTextXY(MX0,128,' '+BaseOrd[order]);
OutTextXY(MX0,144,'Tech. levels:');
OutTextXY(MX0,152,' Engines '+NStr(El));
OutTextXY(MX0,160,' Hulls '+NStr(Hl));
OutTextXY(MX0,168,' Weapons '+NStr(Wl));
OutTextXY(MX0,176,' Torpedoes '+NStr(Tl));
OutTextXY(MX0,192,'Base storage:');
SetLineStyle(SolidLn,0,NormWidth);
Line(MX0,203,639,203);
BaseStorage;
l:=CheckClone(number);
SetColor(Yellow);
if cHl<>0 then OutTextXY(MX0,BL2+16,'BUILDING SHIP')
else if l>0 then OutTextXY(MX0+6*8,BL2+16,'CLONING SHIP');
if fOp<>0 then
begin
if fOp=1 then OutTextXY(MX0,BL2+32,'FIXING Ship '+NStr0(fShip));
if fOp=2 then OutTextXY(MX0,BL2+32,'RECYCLING '+NStr0(fShip));
end;
if RWMode and (turn=today) and (distlock=0) then
begin
SetColor(White);
OutTextXY(MX0,96,'D');
OutTextXY(MX0+8*8,120,'o');
OutTextXY(MX0,144,'T');
OutTextXY(MX0,BL2+16,'B');
if (cHl=0) and (l<=0) then
begin
SetColor(cBInfo);
OutTextXY(MX0+8,BL2+16,'uild ship');
end;
if l>=0 then
if cHl<>0 then
begin
SetColor(White);
OutTextXY(632,BL2+16,'C');
end else
if l=0 then
begin
SetColor(cBInfo);
OutTextXY(MX0+13*8,BL2+16,'Clone');
SetColor(White);
OutTextXY(MX0+13*8,BL2+16,'C');
end
else begin
SetColor(White);
OutTextXY(MX0+6*8,BL2+16,'C');
end;
SetColor(cBInfo);
OutTextXY(MX0,BL2+24,'Buy torps/fighters');
SetColor(White);
OutTextXY(MX0+2*8,BL2+24,'y');
if fOp=0 then
begin
SetColor(cBInfo);
OutTextXY(MX0,BL2+32,'Fix ship Recycle');
SetColor(White);
OutTextXY(MX0,BL2+32,'F R');
end
else if fOp<>2 then OutTextXY(MX0,BL2+32,'F R')
else OutTextXY(MX0,BL2+32,'R F');
end;
end;
ObjList;
end;
procedure HullTypes;
const HY0 = 176;
HY1 = 344;
var i,j,l : word;
myrace : int;
procedure ScanAllHulls;
var i,k,j0 : int;
begin
k:=1; j0:=j;
for i:=1 to 105 do
begin
if HullFit(i,lship^.mass1,lship^.mass2) then
begin
if j=HY1 then
if k<ScanH then begin j:=j0; inc(k) end
else begin hOver:=Yes; Break end;
if j<HY1 then
begin
if k=ScanH then OutTextXY(MX0,j,Hulls[i].name);
inc(j,8);
end;
end;
end;
SetColor(White);
if ScanH>1 then OutTextXY(MX0,j,'Home');
if hOver then OutTextXY(640-3*8,j,'End');
end;
begin
Clear(MX0,HY0+16,639,344+7);
eAllH:=No; hOver:=No;
with lship^ do
begin
SetColor(cSInfo);
j:=HY0+16;
if AllH then ScanAllHulls
else begin
if TrueHullByRace then myrace:=Race[owner]
else myrace:=owner;
for i:=1 to 20 do
begin
l:=RaceHull[myrace,i];
if HullFit(l,mass1,mass2) then
begin
OutTextXY(MX0,j,Hulls[l].name);
inc(j,8);
end;
end;
end;
if j>=HY0+24 then
begin
SetColor(White);
OutTextXY(MX0+14*8,HY0,'A');
SetColor(IIF(AllH,cSInfo+8,DarkGray));
OutTextXY(MX0+13*8,HY0,'( ll)');
SetColor(cSInfo);
eAllH:=Yes;
end;
if j>HY0+24 then OutTextXY(MX0,HY0,'It might be:')
else if j=HY0+24 then
begin
if (not AllH) or (ScanH=1) then
OutTextXY(MX0,HY0+8,'I think it is a')
end
else begin
SetColor(Red);
OutTextXY(MX0,HY0,'This ship COUDN''T');
OutTextXY(MX0,HY0+8,'be constructed');
OutTextXY(MX0,HY0+16,'by '+RaceName[owner]);
SetColor(cSInfo);
j:=HY0+48;
ScanAllHulls;
if j>HY0+56 then OutTextXY(MX0,HY0+32,'It might be:')
else if j=HY0+56 then OutTextXY(MX0,HY0+40,'It is SURELY a');
end;
end;
end;
procedure SayMoving; { currently called for lship only }
var e,f : int;
towed : int;
s : string[2];
begin
Clear(MX0,128,639,136+7);
with lship^ do
begin
towed:=UnderTow(lock and LockLo);
if towed<>0 then
begin
SetColor(Yellow);
OutTextXY(MX0,128,'Being towed by '+NStr0(towed));
end;
SetColor(cSInfo);
if ((warp<>-1) and (warp=0)) or (wx or wy=0) then
begin if towed=0 then OutTextXY(MX0,128,'Not moving') end
else begin
if mission=-1 then
begin
if (towed=0) and (enemy<>-1) then OutTextXY(MX0,128,'Heading: '+NStr0(enemy));
end
else if warp<>-1 then
begin
if towed=0 then OutTextXY(MX0,128,'Dest: '+Location(x+wx,y+wy));
CalcMovement(lship,f,e);
if e>0 then OutTextXY(640-7*8,136,'ETA:'+NStrMax(e,3,'+'));
end;
end;
if warp<>-1 then
begin
OutTextXY(MX0,136,'Warp:');
if towed<>0 then
begin if warp>0 then SetColor(Yellow) end
else if (El<>-1) and (warp<>El) then SetColor(IIF(warp>El,LightRed,Yellow));
OutTextXY(MX0+6*8,136,NStr0(warp));
if RWMode and (turn=today) and (distlock=0) and (owner=player) then
begin
SetColor(White);
OutTextXY(MX0,136,'W');
end;
SetColor(cSInfo);
end;
end;
end;
procedure SayMission (h:sptr);
var s : str20;
mp : MITptr;
xx : int;
begin
SetColor(cSInfo);
with h^ do
begin
if mission>=0 then
begin
if mission<=15 then
begin
if mission<>9 then s:=Missions[mission]
else s:=SpecMisn[Race[owner]];
end
else begin
mp:=MIT;
while (mp<>nil) and (mp^.mission<>mission) do mp:=mp^.next;
if mp<>nil then s:=mp^.name
else s:='Mission '+NStr0(mission);
xx:=MX0+6*8;
if (mp=nil) or (mp^.param and MIT_I<>0) then
begin
OutTextXY(xx,200,'I='+NStr0(intr_ship));
inc(xx,6*8);
end;
if (mp=nil) or (mp^.param and MIT_T<>0) then
OutTextXY(xx,200,'T='+NStr0(tow_ship));
end;
if mission in [7,8] then
begin
s:=s+' '+NStr0(IIF(mission=7,tow_ship,intr_ship));
SetColor(Yellow);
if (mission=7) and (not OneEngineTow) and
(Hulls[hull].engines<2) then SetColor(LightRed);
end else
if (mission=10) and (damage>=CloakPreventDamage) and
(Sup<(damage-CloakPreventDamage+1)*5) then SetColor(LightRed);
OutTextXY(MX0+6*8,192,s);
SetColor(cSInfo);
OutTextXY(MX0,192,'Misn:');
end;
end;
end;
procedure ShipInfo;
var s : string[18];
s1 : string[4];
h : sptr;
i,j,l : int;
number : word;
b : bptr;
p : pptr;
tsk : taskptr;
begin
if ltype<>LockS then Exit;
number:=lock and LockLo;
if (number=0) or (number>999) then Exit;
Clear(MX0,72,639,358);
h:=TTurn^.data^.ship[number];
if (h=nil) or (h^.when<>turn) then Exit;
if PlanN<>0 then b:=TTurn^.data^.base[PlanN] else b:=nil;
with h^ do
begin
lship:=h;
SetColor(White);
OutTextXY(MX0,72,'Ship: '+NStr(number));
OutTextXY(MX0,80,'Race: '+RaceName[owner]);
SetColor(cSInfo);
OutTextXY(MX0,112,'at '+Location(x,y));
if name[1]<>#$FF then
begin
SetColor(LightGray);
OutTextXY(MX0,96,name);
end;
SetColor(White);
if hull<>-1 then OutTextXY(MX0,88,Hulls[hull].name);
if mass<>-1 then
if hull<>-1 then
begin
if (owner<>player) and (not IsData[owner]) and (turn=today) then OutTextXY(632,72,'F');
end
else begin
if turn<>today then SetColor(cSInfo);
OutTextXY(MX0+9*8,88,'H');
SetColor(cSInfo);
OutTextXY(MX0,88,'(unknown ull)');
AllH:=No; ScanH:=1; HullTypes;
end;
SayFuel;
SayMoving;
if mass<>-1 then
begin
if hull<>-1 then s:='' else s:='+W';
OutTextXY(MX0,160,'Mass'+s+': '+NStr0(mass)+' kt');
end;
if fcode<>#$FF#$FF#$FF then
begin
OutTextXY(MX0,168,'FCode:');
WriteFCode(MX0+7*8,168,cSInfo,fcode);
end;
if crew<>-1 then
begin
OutTextXY(MX0,176,'Crew :');
SetColor(IIF(crew<>Hulls[hull].crew,Yellow,cSInfo));
OutTextXY(MX0+7*8,176,NStr0(crew));
if (b<>nil) and (b^.fOp=1) and (b^.fShip=number) then
begin
SetColor(LightGreen);
OutTextXY(640-7*8,176,'(fixed)');
end;
SetColor(cSInfo);
end;
if damage<>-1 then
begin
OutTextXY(MX0,184,'Damage:');
if damage>0 then
begin
i:=damage;
SetColor(LightRed);
OutTextXY(MX0+8*8,184,NStr(i)+'%');
if (b<>nil) and (b^.fOp=1) and (b^.fShip=number) then i:=0
else i:=Max(i-Sup div 5-IIF((Race[owner]=6) and (mission=9),10,0),0);
if i<damage then
if i<=0 then
begin
SetColor(LightGreen);
OutTextXY(640-7*8,184,'(fixed)');
end
else begin
SetColor(Yellow);
OutTextXY(640-6*8,184,'('+NStr(i)+'%)');
end;
SetColor(cSInfo);
end;
end;
SayMission(h);
if (mission<>-1) and (enemy<>-1) then
OutTextXY(MX0,200+IIF(mission>15,8,0),'Enemy: '+RaceName[enemy]);
if (hull<>-1) and (El and Wl and Tl<>-1) then
begin
OutTextXY(MX0,215,'Equipment:');
if El<>-1 then
begin
s:='';
if (not OneEngineTow) and (Hulls[hull].engines=1) then s:='1 ';
OutTextXY(MX0,224,' '+s+Proper(Hulls[hull].engines,Engines[El].name));
end;
if (Wl<>-1) and (weapons<>-1) then
begin
if weapons=0 then OutTextXY(MX0,232,' No main weapons')
else OutTextXY(MX0,232,' '+NStr(weapons)+' '+Proper(weapons,Beams[Wl].name));
end;
if bays or launchers=0 then OutTextXY(MX0,240,' No bays/launchers')
else begin
if bays>0 then OutTextXY(MX0,240,' '+NStr(bays)+Proper(bays,' Fighter bay')) else
if launchers>0 then OutTextXY(MX0,240,' '+NStr(launchers)+Proper(launchers,' '+Torps[Tl].name+' tube'));
end;
end;
if (hull<>-1) and (colonists<>-1) and (Sup<>-1) and (credits<>-1) and
(fuel<>-1) and (T<>-1) and (D<>-1) and (M<>-1) and (TFnum<>-1) and
(CN<>-1) and (CT<>-1) and (CD<>-1) and (CM<>-1) and (CC<>-1) and (CS<>-1) and (CPl<>-1) and
(TN<>-1) and (TT<>-1) and (TD<>-1) and (TM<>-1) and (TC<>-1) and (TS<>-1) and (TSh<>-1) then
begin
OutTextXY(MX0,CY0,'Cargo: '+NStr0(colonists+Sup+T+D+M+TFnum)+'/'+NStr0(Hulls[hull].cargo)+' kt');
OutTextXY(MX0,CY0+8,'Ne: '+NStr(fuel));
OutTextXY(MX0,CY0+16,'Tr: '+NStr(T));
OutTextXY(MX0,CY0+24,'Du: '+NStr(D));
OutTextXY(MX0,CY0+32,'Mo: '+NStr(M));
OutTextXY(MX0,CY0+40,'Sp: '+NStr(Sup));
OutTextXY(MX0,CY0+48,'Cl: '+NStr(colonists));
OutTextXY(MX0,CY0+56,'$$: '+NStr(credits));
if bays or launchers<>0 then
begin
if bays=0 then s:='Tp: ' else s:='Fg: ';
OutTextXY(MX0,CY0+64,s+NStr(TFnum));
end;
if CN or CT or CD or CM or CC or CS<>0 then
begin
SetColor(cPInfo);
OutTextXY(MX0+9*8,CY0+8,NStr(CN));
OutTextXY(MX0+9*8,CY0+16,NStr(CT));
OutTextXY(MX0+9*8,CY0+24,NStr(CD));
OutTextXY(MX0+9*8,CY0+32,NStr(CM));
OutTextXY(MX0+9*8,CY0+40,NStr(CS));
OutTextXY(MX0+9*8,CY0+48,NStr(CC));
if CPl=0 then OutTextXY(MX0,CY0+88,'Jettison cargo!')
else OutTextXY(MX0,CY0+88,'Unload to '+NStr0(CPl));
end;
if TN or TT or TD or TM or TC or TS<>0 then
begin
SetColor(LightBlue);
OutTextXY(MX0+14*8,CY0+8,NStr(TN));
OutTextXY(MX0+14*8,CY0+16,NStr(TT));
OutTextXY(MX0+14*8,CY0+24,NStr(TD));
OutTextXY(MX0+14*8,CY0+32,NStr(TM));
OutTextXY(MX0+14*8,CY0+40,NStr(TS));
OutTextXY(MX0+14*8,CY0+48,NStr(TC));
OutTextXY(MX0,CY0+80,'Transfer to '+NStr0(TSh));
end;
end;
if RWMode and (turn=today) and (distlock=0) and (owner=player) then
begin
SetColor(White);
OutTextXY(632,72,'N');
OutTextXY(MX0,136,'W');
OutTextXY(MX0,168,'F');
OutTextXY(MX0,192,'M');
OutTextXY(MX0,200+IIF(mission>15,8,0),'E');
OutTextXY(MX0,CY0,'C');
if ShipN>1 then
begin
if TSh=0 then
begin
SetColor(cSInfo);
OutTextXY(MX0+8,CY0+80,'ransfer');
end;
SetColor(White);
OutTextXY(MX0,CY0+80,'T');
end;
if PlanN<>0 then
begin
p:=TTurn^.data^.planet[PlanN];
if (p<>nil) and (p^.when=turn) and (p^.owner=player) then
begin
if T+D+M+Sup+IIF(Gambling and (IsHullFunc(hull,hfGambling)<>0),0,colonists)+credits>0 then
begin
SetColor(cSInfo);
OutTextXY(MX0,CY0+88,'Unload');
SetColor(White);
OutTextXY(MX0,CY0+88,'U');
end;
if bays or launchers<>0 then
begin
if (b<>nil) and (b^.owner=player) then
begin
SetColor(cSInfo);
OutTextXY(MX0+9*8,CY0+64,'Bu more');
SetColor(White);
OutTextXY(MX0+11*8,CY0+64,'y');
end;
i:=Hulls[hull].cargo-T-D-M-Sup-colonists-TFnum;
if ((launchers>0) and (i>=3) and (p^.T>0) and (p^.D>0) and (p^.M>0) and
(MinL(p^.funds+p^.supplies,10000-credits)>=Torps[Tl].cost)) or
((Race[player] in [9..11]) and (bays>0) and
(i>=10) and (p^.T>=3) and (p^.M>=2) and (p^.supplies>=5)) then
begin
SetColor(cSInfo);
OutTextXY(640-10*8,CY0+88,'Load&Build');
SetColor(White);
OutTextXY(640-10*8,CY0+88,'L');
end;
end;
end;
if (b<>nil) and (b^.owner=player) then
begin
if (b^.fOp=2) and (b^.fShip=number) then
begin
SetColor(Yellow);
OutTextXY(MX0,351,'BEING RECYCLED');
end;
if (damage>0) or (crew<>Hulls[hull].crew) then
begin
SetColor(White);
OutTextXY(MX0+1*8,CY0+72,'i');
SetColor(Yellow);
OutTextXY(MX0,CY0+72,'F x');
if (b^.fOp=1) and (b^.fShip=number) then OutTextXY(MX0+3*8,CY0+72,'ing ship');
end;
end;
end;
tsk:=FindTask(lock);
if tsk<>nil then
begin
SetColor(LightGray);
OutTextXY(640-6*8,72,'< >');
if tsk^.flag and tfDeac=0 then SetColor(White);
OutTextXY(640-5*8,72,'F8');
end;
end;
if (owner<>player) and (not IsData[owner]) and
(mass<>-1) and (mass<>0) and ((mass<MinSM) or (mass>MaxSM) or
((hull<>-1) and (not HullFit(hull,mass,mass)))) then
begin
Clear(MX0,215,639,344+7);
SetColor(LightRed);
OutTextXY(MX0,216,'!!! ATTENTION !!!');
if (hull<>-1) and (owner<>player) then
begin
OutTextXY(MX0,224,' WRONG HULL TYPE');
OutTextXY(MX0,232,' ASSUMPTION!');
if turn=today then
begin
OutTextXY(MX0,272,'Press F to cancel');
OutTextXY(MX0,280,' this assumption');
SetColor(White);
OutTextXY(MX0+6*8,272,'F');
end;
end
else begin
OutTextXY(MX0,224,' DATA ERROR');
OutTextXY(MX0,232,' OR CHEATING!');
end;
if (mass<MinSM) or (mass>MaxSM) then OutTextXY(MX0,248,'NEITHER ship can')
else OutTextXY(MX0,248,'This ship CAN NOT');
OutTextXY(MX0,256,'have such mass');
end;
end;
if not DSdrawn then DrawPath;
if not SRdrawn then DrawShipRange;
ObjList;
end;
procedure MineInfo;
var s : string[12];
m : mptr;
i,k : int;
number : word;
nd,dd : long;
c : byte;
robot : boolean;
begin
if ltype<>LockM then Exit;
number:=lock and LockLo;
if (number=0) or (number>500) then Exit;
m:=TTurn^.data^.mines[number];
if m<>nil then
with m^ do
begin
ClearInfo;
SetColor(White);
if (web and 2=2) and (owner=12) then s:='Someone''s'
else s:=RaceName[owner];
OutTextXY(MX0,72,s);
if web and 1=0 then s:='field ' else s:='WEB ';
OutTextXY(MX0,80,'mine '+s+NStr(number));
SetColor(LightGray);
if when=turn then OutTextXY(MX0,88,'(now)')
else OutTextXY(MX0,88,'('+NStr(turn-when)+Proper(turn-when,' turn')+' ago)');
c:=RaceColor[owner,_M_];
SetColor(c);
OutTextXY(MX0,104,'Center:('+NStr0(x)+','+NStr0(y)+')');
OutTextXY(MX0,112,'Radius: '+NStr0(Trunc(Sqrt(MaxL(units,0)))));
s:=NStr00(units,'SWEPT OUT');
if (web and 2=2) and (units>0) then s:='÷'+s;
OutTextXY(MX0,120,'Units : '+s);
with TTurn^.data^ do
begin
k:=0; nd:=1000000000;
for i:=1 to 500 do
begin
if ( ((owner=player) or IsData[owner]) and ((planet[i]=nil) or (planet[i]^.when<>turn)) ) or
((eplan[i].when=turn) and (eplan[i].owner<>owner)) or
((planet[i]<>nil) and (planet[i]^.when=turn) and (planet[i]^.owner<>owner))
then Continue;
dd:=Distance2(x,y,xyplan[i,1],xyplan[i,2]);
if dd<nd then begin nd:=dd; k:=i end;
end;
if k<>0 then
begin
OutTextXY(MX0,136,'FCode planet: '+NStr(k));
with planet[k]^ do
if (planet[k]<>nil) and (when=turn) and (fcode<>#$FF#$FF#$FF) then
begin
OutTextXY(MX0,144,'FCode :');
WriteFCode(MX0+14*8,144,c,fcode);
end;
end;
k:=0;
for i:=1 to 500 do
if (eplan[i].owner=owner) and (planet[i]<>nil) and (planet[i]^.when=turn) and
(Copy(planet[i]^.fcode,1,2)='mf') then k:=i;
if k<>0 then
begin
OutTextXY(MX0,152,'UniFC planet: '+NStr(k));
OutTextXY(MX0,160,'Universal FC:');
WriteFCode(MX0+14*8,160,c,planet[k]^.fcode);
end;
end;
if units>0 then
begin
robot:=(Race[owner]=9);
OutTextXY(MX0,178,'This is equal to:');
if robot then OutTextXY(MX0,186,'(using 4X bonus)');
for i:=1 to 10 do
begin
Str(units/(i*i*IIF(robot,4,1)):9:2,s);
OutTextXY(MX0,IIF(robot,190,182)+i*8,s+' '+Torps[i].name);
end;
end;
end;
ObjList;
end;
procedure IonInfo;
var ii : iptr;
number : word;
begin
ClearInfo;
if ltype<>LockI then Exit;
number:=lock and LockLo;
if (number=0) or (number>50) then Exit;
ii:=TTurn^.data^.ion[number];
if ii<>nil then
with ii^ do
begin
SetColor(White);
OutTextXY(MX0,72,'Ion storm '+NStr(number));
OutTextXY(MX0,80,StormName[number]);
SetColor(cIInfo);
OutTextXY(MX0,104,'Center:('+NStr0(x)+','+NStr0(y)+')');
OutTextXY(MX0,112,'Radius: '+NStr0(radius));
OutTextXY(MX0,128,'Heading: '+NStr0(heading));
OutTextXY(MX0,136,'Warp : '+NStr0(warp));
OutTextXY(MX0,152,'Voltage: '+NStr0(voltage)+' meV');
OutTextXY(MX0+3*8,168,'and '+IonGrow[grow]);
SetColor(IIF(voltage<50,cmIWeak,IIF(voltage<150,cmIMod,cmIDang)));
OutTextXY(MX0+3*8,160,IonLevel[Min(voltage div 50+1,5)]);
end;
if not DSdrawn then DrawPath;
ObjList;
end;
procedure WormInfo;
var w : wptr;
number : word;
begin
ClearInfo;
if ltype<>LockW then Exit;
number:=lock and LockLo;
if (number<0) or (number>199) then Exit;
w:=TTurn^.data^.worm[number];
if w<>nil then
with w^ do
begin
SetColor(White);
OutTextXY(MX0,72,'Wormhole '+NStr0(number));
SetColor(LightGray);
if when=turn then OutTextXY(MX0,80,'(now)')
else OutTextXY(MX0,80,'('+NStr(turn-when)+Proper(turn-when,' turn')+' ago)');
SetColor(cWInfo);
OutTextXY(MX0,96, 'Center:('+NStr0(x)+','+NStr0(y)+')');
OutTextXY(MX0,104,'Mass : '+NStr0(mass));
OutTextXY(MX0,112,'Radius: '+NStr0(Round( Exp(Ln(mass)*WormPower/100)/2 )));
OutTextXY(640-byte(Stability[stable,0])*8,128,Stability[stable]);
end;
ObjList;
end;
procedure UFOInfo;
var u : uptr;
number : word;
begin
ClearInfo;
if ltype<>LockU then Exit;
number:=lock and LockLo;
if (number<1) or (number>100) then Exit;
u:=TTurn^.data^.ufo[number];
if u<>nil then
with u^ do
begin
SetColor(White);
OutTextXY(MX0,72,u^.name);
SetColor(LightGray);
if when=turn then OutTextXY(MX0,80,'(now)')
else OutTextXY(MX0,80,'('+NStr(turn-when)+Proper(turn-when,' turn')+' ago)');
SetColor(cUInfo);
OutTextXY(MX0,96, 'Center:('+NStr0(x)+','+NStr0(y)+')');
OutTextXY(MX0,104,'Radius: '+NStr0(radius));
OutTextXY(MX0,112,'Visible for:');
OutTextXY(MX0,120,'ships at '+NStr0(rangeS)+' LY');
OutTextXY(MX0,128,'planets at '+NStr0(rangeP)+' LY');
if warp=0 then OutTextXY(MX0,144,'Not moving')
else begin
OutTextXY(MX0,144,'Heading: '+NStr0(heading));
OutTextXY(MX0,152,'Warp : '+NStr(warp));
end;
if RLen(info[1])+RLen(info[2])>0 then
begin
OutTextXY(MX0,168,'Information:');
SetLineStyle(SolidLn,0,NormWidth);
Line(MX0,168+8+1,MX0+12*8-3,168+8+1);
OutTextXY(MX0,180,info[1]);
OutTextXY(MX0,188,info[2]);
end;
end;
ObjList;
end;
procedure MarkInfo;
var number : word;
a : MapMark;
begin
ClearInfo;
if ltype<>LockA then Exit;
number:=lock and LockLo;
if number=0 then Exit;
a:=TTurn^.data^.mark^[number];
DrawMark(MX0+4,80+4+MarkOffsetY(a.mtype),a.color,a.mtype);
SetColor(White);
OutTextXY(MX0+18,80,'marker');
if a.bind>0 then
begin
OutTextXY(640-3*8,80,'F3');
SetColor(LightGray);
OutTextXY(640-4*8,80,'< >');
end;
SetColor(LightGray);
if a.mtype=mrkRCircle then OutTextXY(MX0,104,'Radius: '+NStr0(a.radius)) else
if a.mtype in [mrkLine,mrkDLine] then begin end
else begin
OutTextXY(MX0,104,'Text:');
SetColor(a.color);
OutTextXY(MX0,116,GetMarkText(number));
SetColor(LightGray);
if a.text<>0 then
begin
OutTextXY(MX0,136,'Alignment:');
DrawMark(MX0+5*8-1,156+4+MarkOffsetY(a.mtype),a.color,a.mtype);
SetColor(a.color);
SetTextJustify(a.xalg,a.yalg);
OutTextXY(MX0+5*8-1+(1-a.xalg)*4,156+4+(a.yalg-1)*4,'text');
SetTextJustify(LeftText,TopText);
SetColor(LightGray);
end;
end;
if a.bind<0 then OutTextXY(MX0,184,'Bound to ship '+NStr(-a.bind));
if RWMode and (turn=today) and (distlock=0) then
begin
SetColor(White);
if a.mtype=mrkRCircle then OutTextXY(MX0,104,'R') else
if a.mtype in [mrkLine,mrkDLine] then begin end
else begin
OutTextXY(MX0,104,'T');
if a.text<>0 then OutTextXY(MX0,136,'A');
end;
end;
ObjList;
end;
procedure ObjInfo (k:int);
var h : sptr;
m : mptr;
ii : iptr;
w : wptr;
u : uptr;
a : MapMark;
begin
if DSdrawn then DrawPath;
if SRdrawn then DrawShipRange;
lship:=nil;
lbase:=nil;
if k<=0 then k:=ObjN
else if k>ObjN then k:=1;
ObjL0:=(k-1) div 10;
if k<=ShipN then
begin
lock:=GoToShipXY(h,lx,ly,k) or LockS;
ltype:=LockS;
ShipInfo;
end else
if k<=MineN then
begin
lock:=GoToMinesXY(m,lx,ly,k-ShipN) or LockM;
ltype:=LockM;
MineInfo;
end else
if k<=IonN then
begin
lock:=GoToIonXY(ii,lx,ly,k-MineN) or LockI;
ltype:=LockI;
IonInfo;
end else
if k<=WormN then
begin
lock:=GoToWormXY(w,lx,ly,k-IonN) or LockW;
ltype:=LockW;
WormInfo;
end else
if k<=UfoN then
begin
lock:=GoToUfoXY(u,lx,ly,k-WormN) or LockW;
ltype:=LockU;
UFOInfo;
end
else begin
lock:=GoToMarkXY(a,lx,ly,k-UfoN) or LockA;
ltype:=LockA;
MarkInfo;
end;
end;
procedure MouseMove;
var sx,sy : int;
begin
if lock<>0 then
begin
Abs2Scr(lx,ly,sx,sy);
if (mEv0=EvMouseMove) and StickyMouse and (Abs(MouseX-sx)<2) and (Abs(MouseY-sy)<2) then
begin MoveMouseTo(sx,sy); Exit end;
if DSdrawn then DrawPath;
if SRdrawn then DrawShipRange;
ClearInfo;
lock:=0;
ltype:=0;
lship:=nil;
lplan:=nil;
lbase:=nil;
ObjN:=0; ShipN:=0; ObjL0:=0;
end;
glx:=0; gly:=0;
WriteCoord;
if dline then DrawDistLine;
if distlock<>0 then LockDistTarget(mmx,mmy);
end;
function NearestObject (var mx,my:int) : word; { sets new mx,my }
var shift : boolean;
i,n : int;
nd,dd : long;
nx,ny : int;
lck : int;
procedure Check (x,y:int);
begin
if x=-1 then Exit;
dd:=Distance2(mx,my,x,y);
if dd<nd then
begin
nd:=dd;
nx:=x; ny:=y;
n:=i or lck;
end;
end;
begin
shift:=(showM or showI or showU or showA) and ((KbdFlags and KbdShft)<>0);
n:=0;
nd:=1000000000;
with TTurn^.data^ do
begin
if not shift then
begin
lck:=LockP;
for i:=1 to 500 do Check(xyplan[i,1],xyplan[i,2]);
lck:=LockS;
if showS or showE then
for i:=1 to 999 do
with ship[i]^ do
if (ship[i]<>nil) and (when=turn) and (splan[i]=0) and
((showS and (owner=player)) or (showE and (owner<>player))) then
Check(x,y);
if distlock<0 then
begin
lck:=0; i:=distlock;
Check(dlx,dly);
end;
end;
lck:=LockM;
if showM then
for i:=1 to 500 do
with mines[i]^ do
if mines[i]<>nil then Check(x,y);
lck:=LockI;
if showI then
for i:=1 to 50 do
with ion[i]^ do
if ion[i]<>nil then Check(x,y);
lck:=LockW;
if showU then
for i:=0 to 199 do
with worm[i]^ do
if worm[i]<>nil then Check(x,y);
lck:=LockU;
if showU then
for i:=1 to 100 do
with ufo[i]^ do
if ufo[i]<>nil then Check(x,y);
lck:=LockA;
if showA then
for i:=1 to nmark do
with mark^[i] do
if (mtype<>mrkNone) and ((not shift) or (mtype=mrkRCircle)) then
begin
Check(x,y);
if (mtype in [mrkLine,mrkDLine]) then Check(x+dx,y+dy);
end;
end;
NearestObject:=n;
if n<>0 then begin mx:=nx; my:=ny end;
end;
procedure GetObjectCoord (obj:int; var lx,ly:int);
var nn,otype : int;
h : sptr;
begin
otype:=obj and LockHi;
nn:=obj and LockLo;
if obj<0 then begin lx:=dlx; ly:=dly end else
with TTurn^.data^ do
if (otype=LockA) and (nn>0) and (nn<=nmark) and (mark^[nn].mtype<>mrkNone) then
with mark^[nn] do
begin
lx:=x; ly:=y;
end else
if (otype=LockM) and (mines[nn]<>nil) then
with mines[nn]^ do
begin
lx:=x; ly:=y;
end else
if (otype=LockI) and (ion[nn]<>nil) then
with ion[nn]^ do
begin
lx:=x; ly:=y;
end else
if (otype=LockW) and (worm[nn]<>nil) then
with worm[nn]^ do
begin
lx:=x; ly:=y;
end else
if (otype=LockU) and (ufo[nn]<>nil) then
with ufo[nn]^ do
begin
lx:=x; ly:=y;
end else
if otype=LockP then
begin
lx:=xyplan[nn,1];
ly:=xyplan[nn,2];
end else
if (otype=LockS) and (ship[nn]<>nil) then
begin
h:=ship[nn];
if h<>nil then begin lx:=h^.x; ly:=h^.y end;
end
else lx:=-1;
end;
procedure MouseLtPress;
var mx,my : int;
begin
if DSdrawn then DrawPath;
if SRdrawn then DrawShipRange;
Scr2Abs(MouseX,MouseY,lx,ly);
if force=0 then lock:=NearestObject(lx,ly)
else begin
lock:=force;
force:=0;
GetObjectCoord(lock,mx,my);
if mx=-1 then lock:=0
else begin lx:=mx; ly:=my end;
end;
ltype:=lock and LockHi;
if lock>0 then
begin
InitObjList;
case ltype of
LockA : MarkInfo;
LockM : MineInfo;
LockI : IonInfo;
LockW : WormInfo;
LockU : UFOInfo;
LockP : if lbase<>nil then BaseInfo else PlanetInfo;
LockS : ShipInfo;
else begin lock:=0; ltype:=0 end;
end;
end;
if ltype<>LockS then lship:=nil;
if ltype<>LockP then lplan:=nil;
CenterMap(lx,ly,No);
if dline then DrawDistLine;
if distlock<>0 then LockDistTarget(lx,ly);
Abs2Scr(lx,ly,mx,my);
MoveMouseTo(mx,my); WriteCoord;
if mEvent<>EvLtPress then mEvent:=0;
end;
procedure MouseRtPress;
{ var h : sptr;}
var shift : boolean;
sx1,sy1,sx2,sy2,sr,ss : int;
x00,y00 : int;
enterDM : boolean;
begin
shift:=(KbdFlags and KbdShft)<>0;
if ((lock or distlock=0) and (not shift)) or (mEvent<>0) then
begin
if (MouseX>119) and (MouseX<360) and
(MouseY>119) and (MouseY<360) then Exit;
if not MapWrap then
begin
Scr2Abs(0,0,sx1,sy2);
Scr2Abs(479,479,sx2,sy1);
sr:=(sx2-sx1) div 2;
end;
ss:=IIF(mEvent<>0,20,50);
x00:=x0; y00:=y0;
if (MouseX<120) and (MapWrap or (sx1>MapX0-sr)) then dec(x0,ss);
if (MouseX>359) and (MapWrap or (sx2<MapY0+sr)) then inc(x0,ss);
if (MouseY<120) and (MapWrap or (sy2<MapY0+sr)) then dec(y0,ss);
if (MouseY>359) and (MapWrap or (sy1>MapX0-sr)) then inc(y0,ss);
if MapWrap then
begin
if x0>MapSSize then dec(x0,MapSSize);
if x0<-MapSSize then inc(x0,MapSSize*2);
if y0>MapSSize then dec(y0,MapSSize);
if y0<-MapSSize then inc(y0,MapSSize*2);
end;
if (x0=x00) and (y0=y00) then mEvent:=0
else begin
MouseX:=Min(Max(MouseX,1),478);
MouseY:=Min(Max(MouseY,1),478);
DrawMap(Yes);
MouseMove;
end;
end
else begin
enterDM:=No;
if (lock=0) and shift then
begin
if dline then DrawDistLine;
if distlock<>0 then DrawDistLock;
distlock:=-1;
Scr2Abs(MouseX,MouseY,dlx,dly);
end
else begin
if dline then DrawDistLine;
if (lock=0) or (distlock=lock) then
begin
DrawDistLock;
force:=distlock;
ForceKey:=13;
distlock:=0;
end
else begin
if distlock<>0 then DrawDistLock;
distlock:=lock;
dlx:=lx; dly:=ly;
DrawDistLock;
enterDM:=Yes;
end;
end;
if distlock=0 then Clear(483,dll-1,639,479)
else begin
SetLineStyle(SolidLn,0,ThickWidth);
SetColor(DarkGray);
dll:=468;
if (distlock>0) and (distlock and LockHi=LockS) then
begin
dlship:=TTurn^.data^.ship[distlock and LockLo]^;
if (CloakFuelBurn=0) or (dlship.mission in [7,8]) or
((IsHullFunc(dlship.hull,hfCloak)=0) and
(IsHullFunc(dlship.hull,hfAdvCloak)=0)) then dlc:=2
else if ((dlship.mission=10) or ((Race[dlship.owner]=3) and (dlship.mission=9))) then dlc:=1
else dlc:=0;
dlf:=0;
dlt:=0;
with dlship do
begin
if hull=-1 then hull:=17; {assume LSDF}
if (El=-1) and (warp>0) then El:=warp;
if (fuel=-1) and (hull<>-1) and (mass<>-1) then fuel:=mass-Hulls[hull].mass;
if (mission=-1) and (warp>0) and (enemy>=0) then
begin
ss:=warp*warp;
if (hull<>-1) and (IsHullFunc(hull,hfGravitonic)<>0) then ss:=ss*2;
wx:=Round(Sin(enemy*Pi/180.0)*ss);
wy:=Round(Cos(enemy*Pi/180.0)*ss);
mission:=0;
end;
if (mass<>-1) and (hull<>-1) and (El<>-1) and (fuel<>-1) then dll:=360;
end;
{if dlship.owner=player then dll:=360;}
{ h:=TTurn^.data^.ship[distlock and LockLo];
dlw:=h^.warp;
if (CloakFuelBurn=0) or (h^.mission in [7,8]) or
((IsHullFunc(h^.hull,hfCloak)=0) and
(IsHullFunc(h^.hull,hfAdvCloak)=0)) then dlc:=2
else if ((h^.mission=10) or ((Race[h^.owner]=3) and (h^.mission=9))) then dlc:=1
else dlc:=0;
if h^.owner=player then dll:=360;}
end;
Clear(483,354,639,479);
Line(482,dll,639,dll);
end;
if enterDM and (ltype=LockS) then
{with TTurn^.data^.ship[lock and LockLo]^ do}
with dlship do
if mission<>-1 then
begin
sx2:=x+wx; sy2:=y+wy;
MouseMove; {changes dlship.wx and wy, sets glx=gly=0}
glx:=sx2; gly:=sy2;
CenterMap(glx,gly,No);
Abs2Scr(glx,gly,sx1,sy1);
MoveMouseTo(sx1,sy1);
WriteCoord;
forceDL:=Yes; LockDistTarget(glx,gly);
end;
end;
end;
function MouseGetTarget (lcolor,lstyle:byte; ctrl:boolean) : boolean; { sets mmx,mmy }
var ch,mEv0 : word;
mdis0 : boolean;
lock0,glx0,gly0,lx0,ly0 : int;
x0,y0,x1,y1 : int;
ack : word;
procedure DrawLine;
begin
if lcolor=0 then Exit;
MouseOff;
SetWriteMode(XORPut);
SetColor(lcolor);
Line(x0,y0,x1,y1);
SetWriteMode(NormalPut);
MouseOn;
end;
procedure NewPoint;
begin
DrawLine;
WriteCoord;
x1:=MouseX; y1:=MouseY;
DrawLine;
end;
procedure LockObj;
var mx,my : int;
begin
lx:=mmx; ly:=mmy;
lock:=NearestObject(lx,ly);
Abs2Scr(lx,ly,mx,my);
MoveMouseTo(mx,my);
end;
begin
ack:=IIF(ctrl,10,13);
lock0:=lock; lock:=0;
lx0:=lx; lx:=0;
ly0:=ly; ly:=0;
glx0:=glx; glx:=0;
gly0:=gly; gly:=0;
mdis0:=MouseDisabled;
MouseDisabled:=No;
Abs2Scr(mmx,mmy,x0,y0);
SetLineStyle(lstyle,0,NormWidth);
x1:=x0; y1:=y0;
ch:=0;
DrawLine;
repeat
if KeyPressed then
begin
ch:=ReadKey;
case ch of
{left} $4B00 : if MouseX>0 then MoveMouseTo(MouseX-Max(1,ratio2 div ratio1),MouseY);
{right} $4D00 : if MouseX<479 then MoveMouseTo(MouseX+Max(1,ratio2 div ratio1),MouseY);
{up} $4800 : if MouseY>0 then MoveMouseTo(MouseX,MouseY-Max(1,ratio2 div ratio1));
{down} $5000 : if MouseY<479 then MoveMouseTo(MouseX,MouseY+Max(1,ratio2 div ratio1));
{~lt} $9B00 : if MouseX>9 then MoveMouseTo(MouseX-10,MouseY);
{~rt} $9D00 : if MouseX<470 then MoveMouseTo(MouseX+10,MouseY);
{~up} $9800 : if MouseY>9 then MoveMouseTo(MouseX,MouseY-10);
{~dn} $A000 : if MouseY<470 then MoveMouseTo(MouseX,MouseY+10);
13 : begin LockObj; if ctrl then NewPoint end;
end;
NewPoint;
if (ch<>13) and (ch<>ack) then lock:=0;
end;
if mEvent<>0 then
begin
mEv0:=mEvent; mEvent:=0;
if mEv0=EvMouseMove then begin NewPoint; lock:=0 end;
if mEv0=EvLtPress then
if (not ctrl) or (KbdFlags and KbdCtrl<>0) then ch:=ack
else begin LockObj; NewPoint end;
if mEv0=EvRtPress then ch:=27;
mEv0:=0;
end;
until (ch=ack) or (ch=27);
DrawLine;
MouseDisabled:=mdis0;
lock:=lock0;
lx:=lx0; ly:=ly0;
glx:=glx0; gly:=gly0;
MouseGetTarget:=(ch=ack);
end;
const mtype0 : MarkType = mrkFlag;
mcolor0 : byte = LightRed;
procedure SetMark;
var t : MarkType;
c : byte;
dx,dy : int;
ch : word;
a : MapMark;
s : string[4];
bind : word;
const MDX = (640-MX0) div 15;
procedure DrawS (c:byte);
var x,y : int;
begin
x:=MX0+MDX*(mcolor0-Blue);
y:=88-12+ord(mtype0)*12;
SetColor(c);
SetLineStyle(SolidLn,0,NormWidth);
Rectangle(x,y,x+MDX-1,y+11);
end;
begin
if turn<>today then Exit;
{MouseOff;} {suspendmouse;}
MouseDisabled:=True;
bind:=IIF(ltype=LockS,lock and LockLo,0);
if DSdrawn then DrawPath;
if SRdrawn then DrawShipRange;
lock:=0;
ltype:=0;
lship:=nil;
lplan:=nil;
lbase:=nil;
ClearInfo;
SetColor(White);
OutTextXY(MX0,72,'Choose marker type:');
if bind<>0 then
begin
OutTextXY(MX0,120+ord(LastMark)*12+32,'The marker will be');
OutTextXY(MX0,120+ord(LastMark)*12+32+8,'bound to ship '+NStr(bind));
end;
for t:=MarkType(ord(mrkNone)+1) to LastMark do
begin
dx:=MarkOffsetX(t);
dy:=MarkOffsetY(t);
{if t=mrkFlag then begin dx:=-1; dy:=3 end
else begin dx:=0; dy:=0 end;}
for c:=Blue to White do
DrawMark(MX0+MDX div 2+MDX*(c-Blue)+dx,88-12+6+ord(t)*12+dy,c,t);
end;
repeat
DrawS(White);
ch:=ReadKey;
DrawS(Black);
case ch of
$4B00 : begin dec(mcolor0); if mcolor0<Blue then mcolor0:=White end;
$4D00 : begin inc(mcolor0); if mcolor0>White then mcolor0:=Blue end;
$4800 : begin dec(mtype0); if mtype0=mrkNone then mtype0:=LastMark end;
$5000 : begin inc(mtype0); if mtype0>LastMark then mtype0:=MarkType(ord(mrkNone)+1) end;
end;
until (ch=13) or (ch=27);
{resumemouse;} {MouseOff;}
if ch=13 then
begin
a.x:=mmx;
a.y:=mmy;
a.mtype:=mtype0;
a.color:=mcolor0;
a.bind:=-bind;
a.text:=0;
if mtype0=mrkRCircle then
begin
SetColor(White);
OutTextXY(MX0,88+ord(LastMark)*12+16,'Radius (LY):');
SetColor(LightGray);
OutTextXY(MX0+13*8,88+ord(LastMark)*12+16,NStr0(radius0));
s:=GetStr(MX0+13*8,88+ord(LastMark)*12+16,4);
if GetStrKey<>13 then a.mtype:=mrkNone
else begin
a.radius:=Value(s);
if (a.radius<0) and (radius0=0) then a.mtype:=mrkNone else
if a.radius=0 then a.radius:=radius0 else radius0:=a.radius;
end;
end else
if mtype0 in [mrkLine,mrkDLine] then
begin
SetColor(White);
OutTextXY(MX0,88+ord(LastMark)*12+16,'Move cursor to the');
OutTextXY(MX0,88+ord(LastMark)*12+24,'end point and use');
OutTextXY(MX0,88+ord(LastMark)*12+32,'Ctrl-click or');
OutTextXY(MX0,88+ord(LastMark)*12+40,'Ctrl-Enter');
if not MouseGetTarget(mcolor0,IIF(mtype0=mrkLine,SolidLn,DashedLn),Yes) then a.mtype:=mrkNone
else begin
dx:=mmx; dy:=mmy;
if MapWrap then WrapWayPoint(a.x,a.y,dx,dy);
a.dx:=dx-a.x;
a.dy:=dy-a.y;
end;
end;
if a.mtype<>mrkNone then
begin
lock:=CreateMark(a) or LockA;
ltype:=LockA;
if lock and LockLo=0 then
begin
ClearInfo;
SetColor(LightRed);
OutTextXY(MX0,72,'No more markers');
OutTextXY(MX0,80,' available!');
end
else begin
DataChg:=Yes;
DrawMap(No);
end;
end;
end;
if lock and LockLo=0 then begin lock:=0; ltype:=0 end;
if lock=0 then begin ClearInfo; ObjList end
else begin
lx:=mmx; ly:=mmy;
InitObjList;
MarkInfo;
end;
MouseDisabled:=False;
{MouseOn;}
end;
procedure ClearMark;
var i,xx,yy : int;
s : string[1];
begin
if (turn<>today) or (ltype<>LockA) then Exit;
i:=lock and LockLo;
with TTurn^.data^.mark^[i] do
begin
if bind>0 then Exit;
{MouseOff;}
EraseMark(i);
DataChg:=Yes;
MouseMove;
end;
DrawMap(Yes);
InitObjList; ObjList;
{MouseOn;}
end;
procedure AssignMarkText;
var s0 : string;
s : str20;
number : word;
begin
if (turn<>today) or (ltype<>LockA) then Exit;
number:=lock and LockLo;
with TTurn^.data^ do
begin
if mark^[number].mtype in [mrkRCircle..mrkDLine] then Exit;
{MouseOff;}
MouseDisabled:=True;
s0:=GetMarkText(number);
{Clear(MX0,116,639,116+7);}
s:=GetStr(MX0,116,20);
{MouseOff;}
if (GetStrKey<>27) and (s<>s0) then
begin
if mark^[number].text=0 then
begin
mark^[number].xalg:=MarkXAlg;
mark^[number].yalg:=MarkYAlg;
end;
SetMarkText(number,s);
DrawMap(Yes);
MarkInfo;
DataChg:=Yes;
end
else begin
Clear(MX0,116,639,116+7);
SetColor(mark^[number].color);
OutTextXY(MX0,116,s0);
end;
MouseDisabled:=False;
{MouseOn;}
end;
end;
procedure MarkAlignment;
var number : word;
a : MapMark;
xa,ya : byte;
ch : word;
procedure DrawA (c:byte);
begin
SetColor(c);
SetTextJustify(xa,ya);
OutTextXY(MX0+5*8-1+(1-xa)*4,156+4+(ya-1)*4,'text');
SetTextJustify(LeftText,TopText);
end;
begin
if (turn<>today) or (ltype<>LockA) then Exit;
number:=lock and LockLo;
a:=TTurn^.data^.mark^[number];
if a.mtype in [mrkRCircle..mrkDLine] then Exit;
if a.text=0 then Exit;
{MouseOff;}
MouseDisabled:=True;
SetColor(Yellow);
OutTextXY(640-2*8,156-8,#24);
OutTextXY(640-3*8,156,#27' '#26);
OutTextXY(640-2*8,156+8,#25);
xa:=a.xalg; ya:=a.yalg;
repeat
DrawA(a.color);
ch:=ReadKey;
DrawA(Black);
case ch of
$4B00 : begin inc(xa); if (xa=1) and (ya=1) then inc(xa); if xa>2 then xa:=0 end;
$4D00 : begin dec(xa); if (xa=1) and (ya=1) then dec(xa); if xa>2 then xa:=2 end;
$4800 : begin dec(ya); if (xa=1) and (ya=1) then dec(ya); if ya>2 then ya:=2 end;
$5000 : begin inc(ya); if (xa=1) and (ya=1) then inc(ya); if ya>2 then ya:=0 end;
end;
until (ch=13) or (ch=27);
{MouseOff;}
if ch=27 then begin xa:=a.xalg; ya:=a.yalg end;
Clear(640-3*8,156-8,639,156+8+7);
DrawA(a.color);
if (xa<>a.xalg) or (ya<>a.yalg) then
with TTurn^.data^.mark^[number] do
begin
xalg:=xa;
yalg:=ya;
MarkXAlg:=xalg;
MarkYAlg:=yalg;
DataChg:=Yes;
DrawMap(Yes);
end;
MouseDisabled:=False;
{MouseOn;}
end;
procedure SetMarkRadius;
var number : word;
a : MapMark;
s : string[4];
begin
if (turn<>today) or (ltype<>LockA) then Exit;
number:=lock and LockLo;
a:=TTurn^.data^.mark^[number];
if a.mtype<>mrkRCircle then Exit;
{MouseOff;}
MouseDisabled:=True;
{Clear(MX0+8*8,104,639,104+7);}
s:=GetStr(MX0+8*8,104,4);
{MouseOff;}
if GetStrKey=13 then
begin
a.radius:=Value(s);
if (a.radius>0) or (radius0>0) then
begin
if a.radius>0 then radius0:=a.radius else a.radius:=radius0;
TTurn^.data^.mark^[number].radius:=a.radius;
DataChg:=Yes;
DrawMap(Yes);
end;
end;
MarkInfo;
MouseDisabled:=False;
{MouseOn;}
end;
{procedure NextPoint;
var h : sptr;
d,dd : int;
mx,my : int;
begin
if ((dlx=mmx) and (dly=mmy)) or (dlw=0) then Exit;
mx:=mmx; my:=mmy;
if MapWrap then WrapWayPoint(dlx,dly,mx,my);
if (dlx=mx) and (dly=my) then Exit;
h:=TTurn^.data^.ship[Abs(distlock) and LockLo];
if (h=nil) or (h^.warp=-1) then Exit;
dd:=Trunc(Sqrt(Distance2(dlx,dly,mx,my)));
d:=dlw*dlw;
if IsHullFunc(h^.hull,hfGravitonic)<>0 then d:=d*2;
DrawDistLine;
DrawDistLock;
if dd<=d then
begin dlx:=mx; dly:=my end
else begin
dlx:=dlx+Round((mx-dlx)/dd*d);
dly:=dly+Round((my-dly)/dd*d);
end;
if MapWrap then WrapXY(dlx,dly);
if distlock>0 then begin dlf:=0; dlt:=0 end;
inc(dlf,dlf0); inc(dlt);
distlock:=-Abs(distlock);
if Gravity and (dlw>1) then
begin
Location(dlx,dly);
if LocationPlanet<>0 then
begin
dlx:=LocationX;
dly:=LocationY;
force:=LocationPlanet or LockP;
ForceKey:=13;
Exit;
end;
end;
LockDistTarget(mmx,mmy);
end;}
procedure NextPoint;
var mx,my : int;
f0 : int;
begin
if ((dlx=mmx) and (dly=mmy)) or (dlship.warp<1) then Exit;
mx:=mmx; my:=mmy;
if MapWrap then WrapWayPoint(dlx,dly,mx,my);
if (dlx=mx) and (dly=my) then Exit;
DrawDistLine;
DrawDistLock;
dlship.wx:=mx-dlx;
dlship.wy:=my-dly;
f0:=dlship.fuel;
CalcMove(dlship,Yes);
if MapWrap then WrapXY(dlship.x,dlship.y);
dlx:=dlship.x;
dly:=dlship.y;
inc(dlf,f0-dlship.fuel);
inc(dlt);
distlock:=-Abs(distlock);
LocationPlanet:=PSearchXY(dlx,dly);
if LocationPlanet<>0 then { CalcMove calls Location() }
begin
force:=LocationPlanet or LockP;
ForceKey:=13;
Exit;
end;
LockDistTarget(mmx,mmy);
end;
procedure AlignWayPoint;
var h : sptr;
number : word;
px,py : int;
dx,dy : int;
dl : long;
nomore : boolean;
function Check : boolean;
var x,y : int;
d : long;
begin
Check:=No;
x:=glx+dx;
y:=gly+dy;
d:=Distance2(dlx,dly,x,y);
if d>=dl then Exit;
if RoundWells and (Distance2(px,py,x,y)<=GravityRange*GravityRange) or
(not RoundWells) and (Abs(px-x)<=GravityRange) and (Abs(py-y)<=GravityRange) then
begin
Check:=Yes;
inc(glx,dx);
inc(gly,dy);
end;
end;
begin
if (turn<>today) or (distlock=0) or (not Gravity) or (ltype<>LockP) then Exit;
with TTurn^.data^ do
begin
px:=xyplan[lock and LockLo,1];
py:=xyplan[lock and LockLo,2];
end;
MouseMove;
glx:=lx; gly:=ly;
if MapWrap then
begin
WrapWayPoint(dlx,dly,px,py);
WrapWayPoint(dlx,dly,glx,gly);
end;
repeat
nomore:=Yes;
dl:=Distance2(dlx,dly,glx,gly);
for dx:=-2 to 2 do
begin
for dy:=-2 to 2 do
if Check then begin nomore:=No; Break end;
if not nomore then Break;
end;
until nomore;
if MapWrap then WrapXY(glx,gly);
Abs2Scr(glx,gly,px,py);
MoveMouseTo(px,py);
WriteCoord;
LockDistTarget(glx,gly);
end;
procedure SetWayPoint;
var h : sptr;
dl : single;
mx,my : int;
l : long;
number : word;
cloaked : boolean;
begin
if (turn<>today) or (distlock<0) or (distlock and LockHi<>LockS) then Exit;
number:=distlock and LockLo;
h:=TTurn^.data^.ship[number];
if (h=nil) or (h^.owner<>player) or (h^.when<>turn) then Exit;
if Gravity and AutoUseGravity and (h^.warp<>1) and
((not HyperDrive) or (IsHullFunc(h^.hull,hfHyperDrive)=0) or (h^.fcode<>'HYP')) then
begin
Location(h^.x,h^.y);
if LocationPlanet<>lock and LockLo then AlignWayPoint;
end;
if lock or glx or gly=0 then begin MouseMove; mx:=mmx; my:=mmy end
else if lock<>0 then begin mx:=lx; my:=ly; MouseMove end
else begin mx:=glx; my:=gly; MouseMove end;
with h^ do
begin
if MapWrap then WrapWayPoint(x,y,mx,my);
dl:=Sqrt(Distance2(x,y,mx,my));
if dl>3000 then
begin
l:=mx-x; mx:=x+Trunc(l*3000/dl);
l:=my-y; my:=y+Trunc(l*3000/dl);
end;
cloaked:=(mission=10) or ((player=3) and (mission=9));
if (x+wx<>mx) or (y+wy<>my) or (warp<>dlship.warp) or ( (dlc=1) xor cloaked ) then
begin
wx:=mx-x;
wy:=my-y;
warp:=dlship.warp;
if warp=0 then warp:=El;
if (dlc=1) and (not cloaked) then mission:=IIF(player=3,9,10) else
if (dlc=0) and cloaked then mission:=5;
ChangeData(Sh,number);
end;
MouseRtPress;
if showT then DrawMap(Yes);
force:=number or LockS;
ForceKey:=13;
end;
end;
procedure SetTaxes (nat:boolean; var tax:int); { M.O.T. }
var y,tax0 : int;
ch : word;
begin
if (lplan=nil) or (lplan^.when<>today) or (nat and (lplan^.Nrace=0)) then Exit;
{MouseOff;}
MouseDisabled:=True;
SetLineStyle(SolidLn,0,NormWidth);
y:=IIF(nat,168,200);
Clear(MX0+11*8,y,639,y+7);
tax0:=tax;
repeat
WriteHChange(nat);
Clear(MX0+8*8,y,MX0+12*8-1,y+7);
WriteTaxes(tax,y);
repeat ArrowBlink(624,y) until KeyPressed;
ch:=ReadKey;
case ch of
$4B00 : if tax>0 then
begin
if KbdFlags and KbdShft=0 then dec(tax) else tax:=0;
WriteIncome;
end;
$4D00 : if tax<100 then
begin
if KbdFlags and KbdShft=0 then inc(tax) else tax:=100;
WriteIncome;
end;
$7300 : if tax>=10 then
begin
dec(tax,10);
WriteIncome;
end;
$7400 : if tax<=90 then
begin
inc(tax,10);
WriteIncome;
end;
$3B00 : begin
helpscr:=5;
Help;
helpscr:=0;
DrawMap(Yes);
end;
end;
until (ch=13) or (ch=27);
{if ch=27 then tax:=tax0;}
if tax<>tax0 then ChangeData(Pl,lock and LockLo);
Clear(MX0+8*8,y,639,y+7);
WriteHChange(nat);
WriteTaxes(tax,y);
SetColor(White);
if nat then OutTextXY(MX0+8,168,'T')
else OutTextXY(MX0+24,200,'x');
WriteIncome;
MouseDisabled:=False;
{MouseOn;}
end;
{procedure FindFirst;
var i,k,sx,sy : int;
p : pptr;
l : long;
begin
k:=0; l:=0;
for i:=1 to 500 do
begin
p:=TTurn^.data^.planet[i];
if (p<>nil) and (p^.when=turn) and
(p^.owner=player) and (p^.colonists>l) then
begin k:=i; l:=p^.colonists end;
end;
l:=0;
for i:=1 to 500 do
begin
p:=TTurn^.data^.planet[i];
if (p<>nil) and (p^.when=turn) and (p^.owner=player) and
(TTurn^.data^.eplan[i].activity and EP_Base<>0) and (p^.colonists>l) then
begin k:=i; l:=p^.colonists end;
end;
if k=0 then Exit;
Abs2Scr(Planets[k].x,Planets[k].y,sx,sy);
MoveMouseTo(sx,sy);
end;}
{$IFDEF DEBUG}
procedure TurnsInMemory;
var y,i : int;
t : tptr;
m : long;
begin
MouseMove;
WriteFreeMem;
ClearInfo;
SetColor(White);
OutTextXY(MX0,72,'Turns in memory:');
y:=88;
t:=TRoot;
while t<>nil do
begin
if t^.data<>nil then
begin
m:=SizeOf(TurnData);
with t^.data^ do
begin
for i:=1 to 999 do
begin
if (i<=500) and (planet[i]<>nil) then inc(m,SizeOf(PRec));
if (i<=500) and (base[i]<>nil) then inc(m,SizeOf(BRec));
if ship[i]<>nil then inc(m,SizeOf(SRec));
if (i<=500) and (mines[i]<>nil) then inc(m,SizeOf(MRec));
if (i<=50) and (ion[i]<>nil) then inc(m,SizeOf(IRec));
end;
inc(m,nmark*SizeOf(MapMark));
inc(m,mtsize);
end;
OutTextXY(MX0,y,'turn '+NStr(t^.turn)+' = '+NStr(m));
inc(y,8);
end;
t:=t^.next;
end;
OutTextXY(MX0,y+8,'MaxAvail = '+NStr0(MaxAvail));
end;
{$ENDIF}
procedure ResetMouseAndVideo;
begin
MouseMove;
asm
mov ax,3
int 10h
mov ax,12h
int 10h
end;
ResetMouse;
DrawRightScreen;
DrawMap(Yes);
end;
procedure Main;
begin
mt0:=Timer;
LastActivityTime:=mt0;
repeat
if (ForceKey<>0) or KeyPressed then
begin
if ForceKey<>0 then begin ch:=ForceKey; ForceKey:=0 end
else ch:=ReadKey;
if MousePresent and (lock<>0) and (distlock=0) then
case ch of
$4800 : ch:=$8D00; { Up -> ^Up }
$5000 : ch:=$9100; { Dn -> ^Dn }
$4B00 : ch:=$7300; { Lt -> ^Lt }
$4D00 : ch:=$7400; { Rt -> ^Rt }
end;
case ch of
{esc} 27 : MouseMove;
{left} $4B00 : if MouseX>0 then begin MoveMouseTo(MouseX-Max(1,ratio2 div ratio1),MouseY); MouseMove end;
{right} $4D00 : if MouseX<479 then begin MoveMouseTo(MouseX+Max(1,ratio2 div ratio1),MouseY); MouseMove end;
{up} $4800 : if MouseY>0 then begin MoveMouseTo(MouseX,MouseY-Max(1,ratio2 div ratio1)); MouseMove end;
{down} $5000 : if MouseY<479 then begin MoveMouseTo(MouseX,MouseY+Max(1,ratio2 div ratio1)); MouseMove end;
{~lt} $9B00 : if MouseX>9 then begin MoveMouseTo(MouseX-10,MouseY); MouseMove end;
{~rt} $9D00 : if MouseX<470 then begin MoveMouseTo(MouseX+10,MouseY); MouseMove end;
{~up} $9800 : if MouseY>9 then begin MoveMouseTo(MouseX,MouseY-10); MouseMove end;
{~dn} $A000 : if MouseY<470 then begin MoveMouseTo(MouseX,MouseY+10); MouseMove end;
{^up} $8D00 : if ObjN>0 then ObjInfo(Obj0-1);
{^dn} $9100 : if ObjN>0 then ObjInfo(Obj0+1);
{^lt} $7300 : if (ltype=LockS) and showS then NextShip(-1)
else if ltype=LockP then
if lbase=nil then NextPlanet(-1) else NextBase(-1)
else if (ltype=LockM) and showM then NextMines(-1)
else if (ltype=LockI) and showI then NextIon(-1)
else if (ltype=LockW) and showU then NextWorm(-1)
else if (ltype=LockU) and showU then NextUFO(-1);
{^rt} $7400 : if (ltype=LockS) and showS then NextShip(1)
else if ltype=LockP then
if lbase=nil then NextPlanet(1) else NextBase(1)
else if (ltype=LockM) and showM then NextMines(1)
else if (ltype=LockI) and showI then NextIon(1)
else if (ltype=LockW) and showU then NextWorm(1)
else if (ltype=LockU) and showU then NextUFO(1);
{enter} 13 : MouseLtPress;
{^ent} 10 : if RWMode then SetWayPoint;
{space} ord(' '): MouseRtPress;
{tab} 9 : Zoom(1);
{_tab} $0F00 : Zoom(255);
{^tab} $9400 : Zoom(0);
{~1..0} $7800,$7900,$7A00,$7B00,$7C00,$7D00,$7E00,$7F00,$8000,$8100 :
SetScreenPos(Hi(ch)-$77);
{-} ord('-'): TimeShift(-1);
{+} ord('+'): TimeShift(1);
{^-} $8E00 : if turn<>TRoot^.turn then begin SetTurn(TRoot^.turn); TimeShift(0) end;
{^+} $9000 : if turn<>today then begin SetTurn(today); TimeShift(0) end;
{0..9} ord('0')..ord('9'):
if (turn=today) and (Abs(distlock) and LockHi=LockS) then
begin {dlw}dlship.warp:=ch-ord('0'); forceDL:=Yes; LockDistTarget(mmx,mmy) end
else ObjInfo(ObjL0*10+IIF(ch=ord('0'),ord('9')+1,ch)-ord('0'));
{pgup} $4900 : if ObjL0>0 then
begin
dec(ObjL0);
ObjInfo(Max(Obj0-10,1));
end;
{pgdn} $5100 : if (ObjN>0) and (ObjL0<(ObjN-1) div 10) then
begin
inc(ObjL0);
ObjInfo(Min(Obj0+10,ObjN));
end;
{ins} $5200 : if showA then SetMark;
{del} $5300 : if ltype=LockA then ClearMark;
{home} $4700 : if (lbase<>nil) and (BL0>BL1) then begin dec(BL0,BL2-BL1+8); BaseStorage end
else
if (ltype=LockS) and (lship^.hull=-1) and
eAllH and AllH and (ScanH>1) then
begin dec(ScanH); HullTypes end;
{end} $4F00 : if (lbase<>nil) and bOver then begin inc(BL0,BL2-BL1+8); BaseStorage end
else
if (ltype=LockS) and (lship^.hull=-1) and
eAllH and AllH and hOver then
begin inc(ScanH); HullTypes end;
{_a} ord('A'): begin showA:=not showA; WriteShows; MouseMove; DrawMap(not showA) end;
{~a} $1E00 : if showA then begin
CurMarkMask := (CurMarkMask+1) mod (LastMarkMask+1);
DrawMap(Yes);
end;
{_e} ord('E'): begin showE:=not showE; WriteShows; MouseMove; DrawMap(No) end;
{_i} ord('I'): begin showI:=not showI; WriteShows; MouseMove; DrawMap(No) end;
{_m} ord('M'): begin showM:=not showM; WriteShows; MouseMove; DrawMap(No) end;
{_p} ord('P'): begin showP:=not showP; WriteShows; MouseMove;
if ratioN>=PNRatio then DrawMap(not showP) end;
{_s} ord('S'): begin showS:=not showS; WriteShows; MouseMove; DrawMap(No) end;
{_t} ord('T'): begin showT:=not showT; WriteShows; MouseMove; DrawMap(No) end;
{_u} ord('U'): begin showU:=not showU; WriteShows; MouseMove; DrawMap(No) end;
{_r} ord('R'): ResetMouseAndVideo;
{a} ord('a'): if RWMode and (ltype=LockP) and (lplan<>nil) and (lbase=nil) then BuildStructures(_Factory)
else if (ltype=LockS) and (lship^.hull=-1) and
(lship^.mass<>-1) and eAllH then
begin AllH:=not AllH; HullTypes end
else if (ltype=LockA) and RWMode and (turn=today) and
(distlock=0) then MarkAlignment;
{b} ord('b'): if (ltype=LockS) and (splan[lock and LockLo]<>0) then
begin
force:=splan[lock and LockLo];
lbase:=TTurn^.data^.base[force];
force:=force or LockP;
MouseLtPress;
end
else if ltype=LockP then
if RWMode and (TTurn^.data^.eplan[lock and LockLo].activity and EP_Base=0) then BuildBase
else if RWMode and (lplan^.build=1) then CancelBase
else if lbase=nil then BaseInfo else Exit;
{c} ord('c'): if RWMode and (turn=today) then
if (ltype=LockS) and (distlock=0) then TransferCargo(Pl)
else if (Abs(distlock) and LockHi=LockS) and (dlc<>2) then
begin dlc:=dlc xor 1; forceDL:=Yes; LockDistTarget(mmx,mmy) end
else if (ltype=LockP) and (lbase<>nil) and
(CheckClone(lock and LockLo)>=0) and BuildClone then Exit;
{d} ord('d'): if RWMode and (ltype=LockP) and (lplan<>nil) then
if lbase=nil then BuildStructures(_Defense) else IncreaseBaseDefense;
{e} ord('e'): if RWMode and (distlock=0) and (ltype=LockS) then SetEnemy;
{f} ord('f'): if RWMode and (ltype=LockP) and (lplan<>nil) then
if lbase=nil then SetFCode(Pl,No) else FixOrRecycle(1)
else if (ltype=LockS) then
if (lship^.hull<>-1) and (lship^.owner<>player) and
(not IsData[lship^.owner]) then ForgetShip
else if RWMode and (distlock=0) and
(lship^.owner=player) then SetFCode(Sh,No);
{^f} 6 : if RWMode and ((ltype=LockP) or (ltype=LockS)) then
if (ltype=LockP) and (lplan<>nil) and (lbase=nil) then SetFCode(Pl,No)
else if (distlock=0) and (lship<>nil) and (lship^.owner=player) then SetFCode(Sh,No);
{g} ord('g'): AlignWayPoint;
{h} ord('h'): if (ltype=LockS) and (lship^.hull=-1) and (lship^.mass<>-1) then InputHull;
{^h} 8 : if KbdFlags and KbdCtrl<>0 then DrawHYPCircles;
{i} ord('i'): if RWMode and (turn=today) and (distlock=0) and (ltype=LockS) and (PlanN<>0) and
((lship^.damage>0) or (lship^.crew<>Hulls[lship^.hull].crew)) then
FixOrRecycleShip(PlanN,1,lock and LockLo);
{l} ord('l'): if RWMode and (distlock=0) and (ltype=LockS) then LoadForBuild;
{m} ord('m'): if RWMode and (ltype=LockP) and (lplan<>nil) and (lbase=nil) then BuildStructures(_Mine)
else if RWMode and (distlock=0) and (ltype=LockS) then SetMission;
{n} ord('n'): if Abs(distlock) and LockHi=LockS then NextPoint
else if RWMode and (distlock=0) and (ltype=LockS) then SetName;
{o} ord('o'): if RWMode and (ltype=LockP) and (lbase<>nil) then SetBaseOrder;
{p} ord('p'): if (lock>0) and (PlanN<>0) then
begin lbase:=nil; force:=PlanN or LockP; MouseLtPress end;
{~p} $1900 : if RWMode then ChangePassword;
{r} ord('r'): if RWMode and (ltype=LockP) and (lplan<>nil) then
if lbase=nil then SetFCode(Pl,Yes) else FixOrRecycle(2)
else if RWMode and (ltype=LockS) and
(lship<>nil) and (distlock=0) then SetFCode(Sh,Yes)
else if (ltype=LockA) and RWMode and (turn=today) and
(distlock=0) then SetMarkRadius;
{^r} 18 : if RWMode and ((ltype=LockP) or (ltype<=LockS)) then
if (ltype=LockP) and (lplan<>nil) and (lbase=nil) then SetFCode(Pl,Yes)
else if (distlock=0) and (lship<>nil) and (lship^.owner=player) then SetFCode(Sh,Yes);
{~r} $1300 : if RWMode and (ltype=LockP) and (lplan<>nil) and (lbase=nil) then RandAllPCodes;
{s} ord('s'): if RWMode and (ltype=LockP) and (lplan<>nil) and (lbase=nil) then SellSupp;
{t} ord('t'): if (ltype=LockP) and (lplan<>nil) then
begin
if lbase<>nil then begin if RWMode then UpgradeBaseTech end
else
if RWMode and (turn=today) and (lplan^.owner=player)
then SetTaxes(Yes,lplan^.Ntax)
else CalcTaxes;
end
else if (ltype=LockA) and RWMode and (turn=today) and
(distlock=0) then AssignMarkText
else if RWMode and (turn=today) and (distlock=0) and
(ltype=LockS) and
(ShipN>1) then TransferCargo(Sh);
{^t} 20 : if (ltype=LockP) and (lplan<>nil) and (lbase=nil) then CalcTaxes;
{$IFDEF DEBUG}
{~t} $1400 : TurnsInMemory;
{$ENDIF}
{u} ord('u'): if RWMode and (distlock=0) and (ltype=LockS) then UnloadShip(lock and LockLo);
{~u} $1600 : if RWMode and (ltype=LockP) and (lplan<>nil) and (lbase=nil) then UnloadAllShips;
{w} ord('w'): if RWMode and (distlock=0) and (ltype=LockS) then SetWarp;
{x} ord('x'): if (ltype=LockP) and (lplan<>nil) and (lbase=nil) then
if RWMode and (turn=today) and (lplan^.owner=player)
then SetTaxes(No,lplan^.Ctax);
{~x} $2D00 : Exit;
{y} ord('y'): if RWMode then
if (distlock=0) and (ltype=LockS) then BuyShipTF
else if (ltype=LockP) and (lbase<>nil) then BuyBaseTF;
{z} ord('z'): CenterMap(mmx,mmy,Yes);
{f1} $3B00 : Exit;
{_f1 $5400 : Exit;}
{^f1 $5E00 : ShipList;}
{f2} $3C00 : Exit;
{f3} $3D00 : Exit;
{_f3} $5600 : if RWMode and (lock<>0) then Exit;
{f4} $3E00 : Exit;
{~f4} $6B00 : Exit;
{f5} $3F00 : Exit;
{f6 is reserved for planet sim}
{f7} $4100 : FindPlanet;
{_f7} $5A00 : FindShip;
{f8 $4200 : if (ltype=LockP) or (ltype=LockS) then Exit;}
{f9} $4300 : DrawUserCircle;
{_f9} $5C00 : DrawMineCircle;
{f10} $4400 : Exit;
end;
LastActivityTime:=Timer;
end;
while mEvent<>0 do
begin
ch:=0;
mEv0:=mEvent; mEvent:=0;
if AutoScroll and
((MouseX<2) or (MouseX>477) or (MouseY<2) or (MouseY>477)) then
begin mEv0:=EvRtPress; mEvent:=EvRtPress end;
if (mEv0<>EvMouseMove) and (mEvent=0) then MouseOff;
case mEv0 of
EvMouseMove : if (Timer<mt0) or (Timer>=mt0+5) then MouseMove;
EvLtPress : begin
if RWMode and
( (KbdFlags and KbdCtrl<>0) or
((Timer>=mt1) and (Timer<=mt1+5)) )
then begin SetWayPoint; mEvent:=0 end
else MouseLtPress;
mt0:=Timer;
mt1:=mt0;
end;
EvRtPress : if (Timer<mt0) or (Timer>=mt0+2) then
begin MouseRtPress; mt0:=Timer end;
EvCtPress : begin
if KbdFlags and KbdShft<>0 then Zoom(255) else
if KbdFlags and KbdCtrl<>0 then Zoom(0) else Zoom(1);
mt0:=Timer
end;
end;
if (mEv0<>EvMouseMove) and (mEvent=0) then MouseOn;
mEv0:=0;
LastActivityTime:=Timer;
end;
if (ScreenSaverTime>0) and (Timer>LastActivityTime+ScreenSaverTime) then
begin ch:=13; Exit end;
until False;
end;
End.