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
|
/* ScummVM - Graphic Adventure Engine
*
* ScummVM is the legal property of its developers, whose names
* are too numerous to list here. Please refer to the COPYRIGHT
* file distributed with this source distribution.
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version 2
* of the License, or (at your option) any later version.
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*
*/
#include "common/scummsys.h"
#include "common/config-manager.h"
#include "common/debug-channels.h"
#include "common/events.h"
#include "common/file.h"
#include "hopkins/graphics.h"
#include "hopkins/hopkins.h"
#include "hopkins/files.h"
#include "hopkins/saveload.h"
#include "hopkins/sound.h"
#include "hopkins/talk.h"
namespace Hopkins {
HopkinsEngine *g_vm;
HopkinsEngine::HopkinsEngine(OSystem *syst, const HopkinsGameDescription *gameDesc) : Engine(syst),
_gameDescription(gameDesc), _randomSource("Hopkins"), _animationManager() {
g_vm = this;
_debugger.setParent(this);
_animationManager.setParent(this);
_computerManager.setParent(this);
_dialogsManager.setParent(this);
_eventsManager.setParent(this);
_fileManager.setParent(this);
_fontManager.setParent(this);
_globals.setParent(this);
_graphicsManager.setParent(this);
_linesManager.setParent(this);
_menuManager.setParent(this);
_objectsManager.setParent(this);
_saveLoadManager.setParent(this);
_scriptManager.setParent(this);
_soundManager.setParent(this);
_talkManager.setParent(this);
}
HopkinsEngine::~HopkinsEngine() {
}
Common::String HopkinsEngine::generateSaveName(int slot) {
return Common::String::format("%s.%03d", _targetName.c_str(), slot);
}
/**
* Returns true if it is currently okay to restore a game
*/
bool HopkinsEngine::canLoadGameStateCurrently() {
return !_globals._exitId && !_globals._cityMapEnabledFl && _eventsManager._mouseFl;
}
/**
* Returns true if it is currently okay to save the game
*/
bool HopkinsEngine::canSaveGameStateCurrently() {
return !_globals._exitId && !_globals._cityMapEnabledFl && _eventsManager._mouseFl;
}
/**
* Load the savegame at the specified slot index
*/
Common::Error HopkinsEngine::loadGameState(int slot) {
return _saveLoadManager.loadGame(slot);
}
/**
* Save the game to the given slot index, and with the given name
*/
Common::Error HopkinsEngine::saveGameState(int slot, const Common::String &desc) {
return _saveLoadManager.saveGame(slot, desc);
}
Common::Error HopkinsEngine::run() {
_saveLoadManager.initSaves();
_globals.setConfig();
_fileManager.initCensorship();
initializeSystem();
if (!getIsDemo())
runFull();
else if (getPlatform() == Common::kPlatformLinux)
runLinuxDemo();
else if (getPlatform() == Common::kPlatformWindows)
runWin95Demo();
else {
warning("Unhandled version, switching to Linux demo. Please report this version to ScummVM developers");
runLinuxDemo();
}
return Common::kNoError;
}
bool HopkinsEngine::runWin95Demo() {
_globals.loadObjects();
_objectsManager.changeObject(14);
_objectsManager.addObject(14);
_objectsManager._helicopterFl = false;
_globals.iRegul = 1;
_graphicsManager.lockScreen();
_graphicsManager.clearScreen();
_graphicsManager.unlockScreen();
_graphicsManager.clearPalette();
_graphicsManager.loadImage("H2");
_graphicsManager.fadeInLong();
if (!_eventsManager._escKeyFl)
playIntro();
_eventsManager._rateCounter = 0;
_globals.iRegul = 1;
_globals._speed = 1;
for (int i = 1; i < 50; i++) {
_graphicsManager.copySurface(_graphicsManager._vesaScreen, 0, 0, 640, 440, _graphicsManager._vesaBuffer, 0, 0);
_eventsManager.VBL();
}
_globals.iRegul = 0;
if (_eventsManager._rateCounter > 475)
_globals._speed = 2;
if (_eventsManager._rateCounter > 700)
_globals._speed = 3;
_graphicsManager.fadeOutLong();
_globals.iRegul = 1;
_globals.PERSO = _fileManager.loadFile("PERSO.SPR");
_globals.PERSO_TYPE = 0;
_objectsManager._mapCarPosX = _objectsManager._mapCarPosY = 0;
memset(_globals._saveData, 0, 2000);
_globals._exitId = 0;
if (getLanguage() != Common::PL_POL)
if (!displayAdultDisclaimer())
return Common::kNoError;
for (;;) {
if (_globals._exitId == 300)
_globals._exitId = 0;
if (!_globals._exitId) {
_globals._exitId = _menuManager.menu();
if (_globals._exitId == -1) {
_globals.PERSO = _globals.freeMemory(_globals.PERSO);
restoreSystem();
return false;
}
}
if (g_system->getEventManager()->shouldQuit())
return false;
switch (_globals._exitId) {
case 1:
_linesManager.setMaxLineIdx(40);
_globals._characterMaxPosY = 435;
_objectsManager.PERSONAGE2("IM01", "IM01", "ANIM01", "IM01", 2, true);
break;
case 3:
if (!_globals._saveData->_data[svField170]) {
_soundManager.WSOUND(3);
if (getPlatform() == Common::kPlatformOS2 || getPlatform() == Common::kPlatformBeOS)
_graphicsManager.loadImage("fond");
else {
if (_globals._language == LANG_FR)
_graphicsManager.loadImage("fondfr");
else if (_globals._language == LANG_EN)
_graphicsManager.loadImage("fondan");
else if (_globals._language == LANG_SP)
_graphicsManager.loadImage("fondes");
}
_graphicsManager.fadeInLong();
_eventsManager.delay(500);
_graphicsManager.fadeOutLong();
_globals.iRegul = 1;
_soundManager._specialSoundNum = 2;
_graphicsManager.lockScreen();
_graphicsManager.clearScreen();
_graphicsManager.unlockScreen();
_graphicsManager.clearPalette();
if (!_globals._censorshipFl)
_animationManager.playAnim("BANQUE.ANM", 200, 28, 200);
else
_animationManager.playAnim("BANKUK.ANM", 200, 28, 200);
_soundManager._specialSoundNum = 0;
_soundManager.DEL_SAMPLE(1);
_soundManager.DEL_SAMPLE(2);
_soundManager.DEL_SAMPLE(3);
_soundManager.DEL_SAMPLE(4);
_graphicsManager.fadeOutLong();
_globals._saveData->_data[svField170] = 1;
}
_linesManager.setMaxLineIdx(5);
_globals._characterMaxPosY = 450;
_objectsManager.PERSONAGE2("IM03", "IM03", "ANIM03", "IM03", 2, false);
break;
case 4:
_globals._disableInventFl = true;
_objectsManager.handleCityMap();
_globals._disableInventFl = false;
break;
case 5:
_linesManager.setMaxLineIdx(5);
_globals._characterMaxPosY = 455;
if (_globals._saveData->_data[svField80]) {
if (_globals._saveData->_data[svField80] == 1)
_objectsManager.PERSONAGE2("IM05", "IM05A", "ANIM05B", "IM05", 3, false);
} else {
_objectsManager.PERSONAGE2("IM05", "IM05", "ANIM05", "IM05", 3, false);
}
break;
case 6:
_linesManager.setMaxLineIdx(20);
_globals._characterMaxPosY = 460;
_objectsManager.PERSONAGE2("IM06", "IM06", "ANIM06", "IM06", 2, true);
break;
case 7:
if (_globals._saveData->_data[svField220])
_objectsManager.PERSONAGE("BOMBEB", "BOMBE", "BOMBE", "BOMBE", 2, true);
else
_objectsManager.PERSONAGE("BOMBEA", "BOMBE", "BOMBE", "BOMBE", 2, true);
break;
case 8:
_linesManager.setMaxLineIdx(15);
_globals._characterMaxPosY = 450;
_objectsManager.PERSONAGE2("IM08", "IM08", "ANIM08", "IM08", 2, true);
break;
case 9:
_globals._characterMaxPosY = 440;
_linesManager.setMaxLineIdx(20);
if (_globals._saveData->_data[svField225])
_objectsManager.PERSONAGE2("IM09", "IM09", "ANIM09", "IM09", 10, true);
else
bombExplosion();
break;
case 10:
_objectsManager.PERSONAGE("IM10", "IM10", "ANIM10", "IM10", 9, false);
break;
case 11:
_linesManager.setMaxLineIdx(20);
_globals._characterMaxPosY = 450;
_objectsManager.PERSONAGE2("IM11", "IM11", "ANIM11", "IM11", 2, false);
break;
case 12:
_globals._characterMaxPosY = 450;
_linesManager.setMaxLineIdx(20);
if (_globals._saveData->_data[svField225]) {
if (_globals._language == LANG_FR)
_graphicsManager.loadImage("ENDFR");
else
_graphicsManager.loadImage("ENDUK");
_graphicsManager.fadeInLong();
_eventsManager.mouseOn();
do
_eventsManager.VBL();
while (_eventsManager.getMouseButton() != 1);
_graphicsManager.fadeOutLong();
restoreSystem();
}
bombExplosion();
break;
case 13:
case 14:
case 15:
handleNotAvailable(11);
break;
case 16:
case 24:
case 25:
case 26:
case 27:
case 28:
case 29:
case 30:
case 31:
case 33:
case 32:
case 34:
handleNotAvailable(4);
break;
case 17:
handleNotAvailable(1);
break;
case 111:
_objectsManager.PERSONAGE("IM111", "IM111", "ANIM111", "IM111", 10, false);
break;
case 112:
_objectsManager.PERSONAGE("IM112", "IM112", "ANIM112", "IM112", 10, false);
break;
case 113:
_globals._exitId = 0;
_globals._prevScreenId = _globals._screenId;
_globals._saveData->_data[svField6] = _globals._screenId;
_globals._screenId = 113;
_globals._saveData->_data[svField5] = _globals._screenId;
_computerManager.showComputer(COMPUTER_HOPKINS);
_graphicsManager.lockScreen();
_graphicsManager.clearScreen();
_graphicsManager.unlockScreen();
_graphicsManager.DD_VBL();
memset(_graphicsManager._vesaBuffer, 0, 307200);
memset(_graphicsManager._vesaScreen, 0, 307200);
_graphicsManager.clearPalette();
_graphicsManager.RESET_SEGMENT_VESA();
break;
case 114:
_globals._prevScreenId = _globals._screenId;
_globals._saveData->_data[svField6] = _globals._screenId;
_globals._screenId = 114;
_globals._saveData->_data[svField5] = _globals._screenId;
_globals._exitId = 0;
_computerManager.showComputer(COMPUTER_SAMANTHA);
_graphicsManager.lockScreen();
_graphicsManager.clearScreen();
_graphicsManager.unlockScreen();
break;
case 115:
_globals._exitId = 0;
_globals._prevScreenId = _globals._screenId;
_globals._saveData->_data[svField6] = _globals._screenId;
_globals._screenId = 115;
_globals._saveData->_data[svField5] = _globals._screenId;
_computerManager.showComputer(COMPUTER_PUBLIC);
_graphicsManager.lockScreen();
_graphicsManager.clearScreen();
_graphicsManager.unlockScreen();
break;
case 150:
_soundManager.WSOUND(28);
_globals.iRegul = 4; // CHECKME!
_graphicsManager.lockScreen();
_graphicsManager.clearScreen();
_graphicsManager.unlockScreen();
_graphicsManager.clearPalette();
_animationManager.playAnim("JOUR1A.anm", 12, 12, 2000);
_globals.iRegul = 0;
_globals._exitId = 300;
break;
case 151:
_soundManager.WSOUND(28);
_globals.iRegul = 4; // CHECKME!
_graphicsManager.lockScreen();
_graphicsManager.clearScreen();
_graphicsManager.unlockScreen();
_graphicsManager.clearPalette();
_graphicsManager.loadImage("njour3a");
_graphicsManager.fadeInLong();
_eventsManager.delay(5000);
_graphicsManager.fadeOutLong();
_globals._exitId = 300;
_globals.iRegul = 0;
break;
case 152:
_soundManager.WSOUND(28);
_globals.iRegul = 4; // CHECKME!
_graphicsManager.lockScreen();
_graphicsManager.clearScreen();
_graphicsManager.unlockScreen();
_graphicsManager.clearPalette();
_animationManager.playAnim("JOUR4A.anm", 12, 12, 2000);
_globals.iRegul = 0;
_globals._exitId = 300;
break;
}
}
return true;
}
bool HopkinsEngine::runLinuxDemo() {
_globals.loadObjects();
_objectsManager.changeObject(14);
_objectsManager.addObject(14);
_objectsManager._helicopterFl = false;
_eventsManager.mouseOff();
_graphicsManager.lockScreen();
_graphicsManager.clearScreen();
_graphicsManager.unlockScreen();
_graphicsManager.loadImage("LINUX");
_graphicsManager.fadeInLong();
_eventsManager.delay(1500);
_graphicsManager.fadeOutLong();
_graphicsManager.loadImage("H2");
_graphicsManager.fadeInLong();
_eventsManager.delay(500);
_graphicsManager.fadeOutLong();
if (!_eventsManager._escKeyFl)
playIntro();
_globals.iRegul = 0;
_globals.PERSO = _fileManager.loadFile("PERSO.SPR");
_globals.PERSO_TYPE = 0;
_objectsManager._mapCarPosX = _objectsManager._mapCarPosY = 0;
memset(_globals._saveData, 0, 2000);
_globals._exitId = 0;
for (;;) {
if (_globals._exitId == 300)
_globals._exitId = 0;
if (!_globals._exitId) {
_globals._exitId = _menuManager.menu();
if (_globals._exitId == -1) {
if (!g_system->getEventManager()->shouldQuit())
endLinuxDemo();
_globals.PERSO = _globals.freeMemory(_globals.PERSO);
restoreSystem();
}
}
if (g_system->getEventManager()->shouldQuit())
return false;
switch (_globals._exitId) {
case 17:
case 18:
case 19:
case 20:
case 22:
case 23:
case 24:
case 27:
case 28:
case 29:
case 30:
case 31:
case 32:
case 34:
case 38:
displayNotAvailable();
break;
case 1:
_linesManager.setMaxLineIdx(40);
_globals._characterMaxPosY = 435;
_objectsManager.PERSONAGE2("IM01", "IM01", "ANIM01", "IM01", 1, true);
break;
case 3:
if (!_globals._saveData->_data[svField170]) {
_soundManager.WSOUND(3);
if (getPlatform() == Common::kPlatformOS2 || getPlatform() == Common::kPlatformBeOS)
_graphicsManager.loadImage("fond");
else {
if (_globals._language == LANG_FR)
_graphicsManager.loadImage("fondfr");
else if (_globals._language == LANG_EN)
_graphicsManager.loadImage("fondan");
else if (_globals._language == LANG_SP)
_graphicsManager.loadImage("fondes");
}
_graphicsManager.fadeInLong();
_eventsManager.delay(500);
_graphicsManager.fadeOutLong();
_globals.iRegul = 1;
_soundManager._specialSoundNum = 2;
_graphicsManager.lockScreen();
_graphicsManager.clearScreen();
_graphicsManager.unlockScreen();
_graphicsManager.clearPalette();
_graphicsManager.FADE_LINUX = 2;
if (!_globals._censorshipFl)
_animationManager.playAnim("BANQUE.ANM", 200, 28, 200);
else
_animationManager.playAnim("BANKUK.ANM", 200, 28, 200);
_soundManager._specialSoundNum = 0;
_soundManager.DEL_SAMPLE(1);
_soundManager.DEL_SAMPLE(2);
_soundManager.DEL_SAMPLE(3);
_soundManager.DEL_SAMPLE(4);
_globals._saveData->_data[svField170] = 1;
}
_linesManager.setMaxLineIdx(5);
_globals._characterMaxPosY = 450;
_objectsManager.PERSONAGE2("IM03", "IM03", "ANIM03", "IM03", 2, false);
break;
case 4:
_globals._disableInventFl = true;
_objectsManager.handleCityMap();
_globals._disableInventFl = false;
break;
case 5:
_linesManager.setMaxLineIdx(5);
_globals._characterMaxPosY = 455;
if (_globals._saveData->_data[svField80] == 1)
_objectsManager.PERSONAGE2("IM05", "IM05A", "ANIM05B", "IM05", 3, false);
else
_objectsManager.PERSONAGE2("IM05", "IM05", "ANIM05", "IM05", 3, false);
break;
case 6:
_linesManager.setMaxLineIdx(20);
_globals._characterMaxPosY = 460;
_objectsManager.PERSONAGE2("IM06", "IM06", "ANIM06", "IM06", 2, true);
break;
case 7:
if (_globals._saveData->_data[svField220])
_objectsManager.PERSONAGE("BOMBEB", "BOMBE", "BOMBE", "BOMBE", 2, true);
else
_objectsManager.PERSONAGE("BOMBEA", "BOMBE", "BOMBE", "BOMBE", 2, true);
break;
case 8:
_linesManager.setMaxLineIdx(15);
_globals._characterMaxPosY = 450;
_objectsManager.PERSONAGE2("IM08", "IM08", "ANIM08", "IM08", 2, true);
break;
case 9:
_linesManager.setMaxLineIdx(20);
_globals._characterMaxPosY = 440;
if (!_globals._saveData->_data[svField225])
bombExplosion();
_objectsManager.PERSONAGE2("IM09", "IM09", "ANIM09", "IM09", 10, true);
break;
case 10:
_objectsManager.PERSONAGE("IM10", "IM10", "ANIM10", "IM10", 9, false);
break;
case 11:
_linesManager.setMaxLineIdx(20);
_globals._characterMaxPosY = 450;
_objectsManager.PERSONAGE2("IM11", "IM11", "ANIM11", "IM11", 2, false);
break;
case 12:
_linesManager.setMaxLineIdx(20);
_globals._characterMaxPosY = 450;
if (_globals._saveData->_data[svField225])
_objectsManager.PERSONAGE2("IM12", "IM12", "ANIM12", "IM12", 1, false);
else
bombExplosion();
break;
case 13:
_linesManager.setMaxLineIdx(40);
_globals._characterMaxPosY = 440;
_objectsManager.PERSONAGE2("IM13", "IM13", "ANIM13", "IM13", 1, true);
break;
case 14:
_linesManager.setMaxLineIdx(40);
_globals._characterMaxPosY = 440;
_objectsManager.PERSONAGE2("IM14", "IM14", "ANIM14", "IM14", 1, true);
break;
case 15:
_objectsManager.PERSONAGE("IM15", "IM15", "ANIM15", "IM15", 29, false);
break;
case 16:
_linesManager.setMaxLineIdx(5);
_globals._characterMaxPosY = 450;
if (_globals._saveData->_data[svField113] == 1) {
_objectsManager.PERSONAGE2("IM16", "IM16A", "ANIM16", "IM16", 7, true);
} else if (!_globals._saveData->_data[svField113]) {
_objectsManager.PERSONAGE2("IM16", "IM16", "ANIM16", "IM16", 7, true);
}
break;
case 25:
_linesManager.setMaxLineIdx(20);
_globals._characterMaxPosY = 445;
_objectsManager.PERSONAGE2("IM25", "IM25", "ANIM25", "IM25", 30, true);
break;
case 26:
_linesManager.setMaxLineIdx(40);
_globals._characterMaxPosY = 435;
_objectsManager.PERSONAGE2("IM26", "IM26", "ANIM26", "IM26", 30, true);
case 33:
_objectsManager.PERSONAGE("IM33", "IM33", "ANIM33", "IM33", 8, false);
break;
case 35:
displayEndDemo();
break;
case 111:
_objectsManager.PERSONAGE("IM111", "IM111", "ANIM111", "IM111", 10, false);
break;
case 112:
_objectsManager.PERSONAGE("IM112", "IM112", "ANIM112", "IM112", 10, false);
break;
case 113:
_globals._exitId = 0;
_globals._prevScreenId = _globals._screenId;
_globals._saveData->_data[svField6] = _globals._screenId;
_globals._screenId = 113;
_globals._saveData->_data[svField5] = 113;
_computerManager.showComputer(COMPUTER_HOPKINS);
_graphicsManager.lockScreen();
_graphicsManager.clearScreen();
_graphicsManager.unlockScreen();
_graphicsManager.DD_VBL();
memset(_graphicsManager._vesaBuffer, 0, 307200);
memset(_graphicsManager._vesaScreen, 0, 307200);
_graphicsManager.clearPalette();
_graphicsManager.RESET_SEGMENT_VESA();
break;
case 114:
_globals._exitId = 0;
_globals._prevScreenId = _globals._screenId;
_globals._saveData->_data[svField6] = _globals._screenId;
_globals._screenId = 114;
_globals._saveData->_data[svField5] = 114;
_computerManager.showComputer(COMPUTER_SAMANTHA);
_graphicsManager.lockScreen();
_graphicsManager.clearScreen();
_graphicsManager.unlockScreen();
break;
case 115:
_globals._exitId = 0;
_globals._prevScreenId = _globals._screenId;
_globals._saveData->_data[svField6] = _globals._screenId;
_globals._screenId = 115;
_globals._saveData->_data[svField5] = 115;
_computerManager.showComputer(COMPUTER_PUBLIC);
_graphicsManager.lockScreen();
_graphicsManager.clearScreen();
_graphicsManager.unlockScreen();
break;
case 150:
_soundManager.WSOUND(16);
_globals.iRegul = 1;
_graphicsManager.lockScreen();
_graphicsManager.clearScreen();
_graphicsManager.unlockScreen();
_graphicsManager.clearPalette();
_graphicsManager.FADE_LINUX = 2;
_animationManager.playAnim("JOUR1A.anm", 12, 12, 2000);
_globals.iRegul = 0;
_globals._exitId = 300;
break;
case 151:
_soundManager.WSOUND(16);
_globals.iRegul = 1;
_graphicsManager.lockScreen();
_graphicsManager.clearScreen();
_graphicsManager.unlockScreen();
_graphicsManager.clearPalette();
_graphicsManager.FADE_LINUX = 2;
_animationManager.playAnim("JOUR3A.anm", 12, 12, 2000);
_globals.iRegul = 0;
_globals._exitId = 300;
break;
case 152:
_soundManager.WSOUND(16);
_globals.iRegul = 1;
_graphicsManager.lockScreen();
_graphicsManager.clearScreen();
_graphicsManager.unlockScreen();
_graphicsManager.clearPalette();
_graphicsManager.FADE_LINUX = 2;
_animationManager.playAnim("JOUR4A.anm", 12, 12, 2000);
_globals.iRegul = 0;
_globals._exitId = 300;
break;
}
}
return true;
}
bool HopkinsEngine::runFull() {
if (getPlatform() == Common::kPlatformLinux)
_soundManager.WSOUND(16);
_globals.loadObjects();
_objectsManager.changeObject(14);
_objectsManager.addObject(14);
if (getPlatform() == Common::kPlatformLinux) {
_objectsManager._helicopterFl = false;
_eventsManager.mouseOff();
// No code has been added to display the version as it's wrong
// in my copy: it mentions a Win95 version v4 using DirectDraw (Strangerke)
} else if (getPlatform() == Common::kPlatformWindows) {
_objectsManager._helicopterFl = false;
_globals.iRegul = 1;
// This code displays the game version.
// It wasn't present in the original and could be put in the debugger
// It has been added there for debug purposes
_graphicsManager.loadImage("VERSW");
_graphicsManager.fadeInLong();
_eventsManager.delay(500);
_graphicsManager.fadeOutLong();
} else {
// This piece of code, though named "display_version" in the original,
// displays a "loading please wait" screen.
_graphicsManager.loadImage("VERSW");
_graphicsManager.fadeInLong();
_eventsManager.delay(500);
_graphicsManager.fadeOutLong();
_globals.iRegul = 1;
}
_graphicsManager.lockScreen();
_graphicsManager.clearScreen();
_graphicsManager.unlockScreen();
_graphicsManager.clearPalette();
if (getPlatform() == Common::kPlatformLinux) {
_graphicsManager.loadImage("H2");
_graphicsManager.fadeInLong();
_eventsManager.delay(500);
_graphicsManager.fadeOutLong();
_globals._speed = 2;
_globals.iRegul = 1;
_graphicsManager.FADE_LINUX = 2;
_animationManager.playAnim("MP.ANM", 10, 16, 200);
} else {
_animationManager.playAnim("MP.ANM", 10, 16, 200);
_graphicsManager.fadeOutLong();
}
if (!_eventsManager._escKeyFl)
playIntro();
if (getPlatform() != Common::kPlatformLinux) {
_graphicsManager.fadeOutShort();
_graphicsManager.loadImage("H2");
_graphicsManager.fadeInLong();
_eventsManager.delay(500);
_graphicsManager.fadeOutLong();
}
_globals.iRegul = 0;
_globals.PERSO = _fileManager.loadFile("PERSO.SPR");
_globals.PERSO_TYPE = 0;
_objectsManager._mapCarPosX = _objectsManager._mapCarPosY = 0;
memset(_globals._saveData, 0, 2000);
_globals._exitId = 0;
for (;;) {
if (_globals._exitId == 300)
_globals._exitId = 0;
if (!_globals._exitId) {
_globals._exitId = _menuManager.menu();
if (_globals._exitId == -1) {
_globals.PERSO = _globals.freeMemory(_globals.PERSO);
restoreSystem();
return false;
}
}
if (g_system->getEventManager()->shouldQuit())
return false;
switch (_globals._exitId) {
case 1:
_linesManager.setMaxLineIdx(40);
_globals._characterMaxPosY = 435;
_objectsManager.PERSONAGE2("IM01", "IM01", "ANIM01", "IM01", 1, true);
break;
case 3:
if (!_globals._saveData->_data[svField170]) {
_soundManager.WSOUND(3);
if (getPlatform() == Common::kPlatformOS2 || getPlatform() == Common::kPlatformBeOS)
_graphicsManager.loadImage("fond");
else {
if (_globals._language == LANG_FR)
_graphicsManager.loadImage("fondfr");
else if (_globals._language == LANG_EN)
_graphicsManager.loadImage("fondan");
else if (_globals._language == LANG_SP)
_graphicsManager.loadImage("fondes");
}
_graphicsManager.fadeInLong();
_eventsManager.delay(500);
_graphicsManager.fadeOutLong();
_globals.iRegul = 1;
_soundManager._specialSoundNum = 2;
_graphicsManager.lockScreen();
_graphicsManager.clearScreen();
_graphicsManager.unlockScreen();
_graphicsManager.clearPalette();
if (getPlatform() == Common::kPlatformLinux || getPlatform() == Common::kPlatformWindows) {
if (getPlatform() == Common::kPlatformLinux)
_graphicsManager.FADE_LINUX = 2;
if (!_globals._censorshipFl)
_animationManager.playAnim("BANQUE.ANM", 200, 28, 200);
else
_animationManager.playAnim("BANKUK.ANM", 200, 28, 200);
} else {
_animationManager.playAnim("BANQUE.ANM", 200, 28, 200);
}
_soundManager._specialSoundNum = 0;
_soundManager.DEL_SAMPLE(1);
_soundManager.DEL_SAMPLE(2);
_soundManager.DEL_SAMPLE(3);
_soundManager.DEL_SAMPLE(4);
if (getPlatform() != Common::kPlatformLinux)
_graphicsManager.fadeOutLong();
_globals._saveData->_data[svField170] = 1;
}
_linesManager.setMaxLineIdx(5);
_globals._characterMaxPosY = 450;
_objectsManager.PERSONAGE2("IM03", "IM03", "ANIM03", "IM03", 2, false);
break;
case 4:
_globals._disableInventFl = true;
_objectsManager.handleCityMap();
_globals._disableInventFl = false;
break;
case 5:
_linesManager.setMaxLineIdx(5);
_globals._characterMaxPosY = 455;
if (_globals._saveData->_data[svField80] == 1)
_objectsManager.PERSONAGE2("IM05", "IM05A", "ANIM05B", "IM05", 3, false);
else
_objectsManager.PERSONAGE2("IM05", "IM05", "ANIM05", "IM05", 3, false);
break;
case 6:
_linesManager.setMaxLineIdx(20);
_globals._characterMaxPosY = 460;
_objectsManager.PERSONAGE2("IM06", "IM06", "ANIM06", "IM06", 2, true);
break;
case 7:
if (_globals._saveData->_data[svField220])
_objectsManager.PERSONAGE("BOMBEB", "BOMBE", "BOMBE", "BOMBE", 2, true);
else
_objectsManager.PERSONAGE("BOMBEA", "BOMBE", "BOMBE", "BOMBE", 2, true);
break;
case 8:
_linesManager.setMaxLineIdx(15);
_globals._characterMaxPosY = 450;
_objectsManager.PERSONAGE2("IM08", "IM08", "ANIM08", "IM08", 2, true);
break;
case 9:
_linesManager.setMaxLineIdx(20);
_globals._characterMaxPosY = 440;
if (_globals._saveData->_data[svField225])
_objectsManager.PERSONAGE2("IM09", "IM09", "ANIM09", "IM09", 10, true);
else
bombExplosion();
break;
case 10:
_objectsManager.PERSONAGE("IM10", "IM10", "ANIM10", "IM10", 9, false);
break;
case 11:
_linesManager.setMaxLineIdx(20);
_globals._characterMaxPosY = 450;
_objectsManager.PERSONAGE2("IM11", "IM11", "ANIM11", "IM11", 2, false);
break;
case 12:
_linesManager.setMaxLineIdx(20);
_globals._characterMaxPosY = 450;
if (_globals._saveData->_data[svField225])
_objectsManager.PERSONAGE2("IM12", "IM12", "ANIM12", "IM12", 1, false);
else
bombExplosion();
break;
case 13:
_linesManager.setMaxLineIdx(40);
_globals._characterMaxPosY = 440;
_objectsManager.PERSONAGE2("IM13", "IM13", "ANIM13", "IM13", 1, true);
break;
case 14:
_linesManager.setMaxLineIdx(40);
_globals._characterMaxPosY = 440;
_objectsManager.PERSONAGE2("IM14", "IM14", "ANIM14", "IM14", 1, true);
break;
case 15:
if (getPlatform() == Common::kPlatformLinux || getPlatform() == Common::kPlatformWindows)
_objectsManager.PERSONAGE("IM15", "IM15", "ANIM15", "IM15", 29, false);
else
_objectsManager.PERSONAGE("IM15", "IM15", "ANIM15", "IM15", 18, false);
break;
case 16:
_linesManager.setMaxLineIdx(5);
_globals._characterMaxPosY = 450;
if (_globals._saveData->_data[svField113] == 1)
_objectsManager.PERSONAGE2("IM16", "IM16A", "ANIM16", "IM16", 7, true);
else
_objectsManager.PERSONAGE2("IM16", "IM16", "ANIM16", "IM16", 7, true);
break;
case 17:
_linesManager.setMaxLineIdx(40);
_globals._characterMaxPosY = 440;
if (_globals._saveData->_data[svField117] == 1)
_objectsManager.PERSONAGE2("IM17", "IM17A", "ANIM17", "IM17", 11, true);
else if (!_globals._saveData->_data[svField117])
_objectsManager.PERSONAGE2("IM17", "IM17", "ANIM17", "IM17", 11, true);
if (_globals._exitId == 18) {
_globals.iRegul = 1;
_graphicsManager.lockScreen();
_graphicsManager.clearScreen();
_graphicsManager.unlockScreen();
_graphicsManager.clearPalette();
_soundManager.WSOUND_OFF();
if (getPlatform() == Common::kPlatformLinux) {
_soundManager.WSOUND(29);
_graphicsManager.FADE_LINUX = 2;
_animationManager.playAnim("PURG1A.ANM", 12, 18, 50);
} else if (getPlatform() == Common::kPlatformWindows) {
_soundManager.WSOUND(29);
_animationManager.playAnim("PURG1A.ANM", 12, 18, 50);
_graphicsManager.fadeOutShort();
} else {
_soundManager.WSOUND(6);
_animationManager.playAnim("PURG1A.ANM", 12, 18, 50);
_graphicsManager.fadeOutShort();
}
_globals.iRegul = 0;
}
break;
case 18:
_linesManager.setMaxLineIdx(5);
_globals._characterMaxPosY = 450;
if (getPlatform() == Common::kPlatformLinux || getPlatform() == Common::kPlatformWindows)
_objectsManager.PERSONAGE2("IM18", "IM18", "ANIM18", "IM18", 29, false);
else
_objectsManager.PERSONAGE2("IM18", "IM18", "ANIM18", "IM18", 6, false);
break;
case 19:
_linesManager.setMaxLineIdx(40);
_globals._characterMaxPosY = 440;
if (_globals._saveData->_data[svField123])
_objectsManager.PERSONAGE2("IM19", "IM19A", "ANIM19", "IM19", 6, true);
else
_objectsManager.PERSONAGE2("IM19", "IM19", "ANIM19", "IM19", 6, true);
break;
case 20:
_linesManager.setMaxLineIdx(10);
_globals._characterMaxPosY = 440;
_objectsManager.PERSONAGE2("IM20", "IM20", "ANIM20", "IM20", 6, true);
if (_globals._exitId == 17) {
_globals.iRegul = 1;
_soundManager.WSOUND_OFF();
_graphicsManager.lockScreen();
_graphicsManager.clearScreen();
_graphicsManager.unlockScreen();
_graphicsManager.clearPalette();
_soundManager.WSOUND(6);
if (getPlatform() == Common::kPlatformLinux)
_graphicsManager.FADE_LINUX = 2;
_animationManager.playAnim("PURG2A.ANM", 12, 18, 50);
if (getPlatform() != Common::kPlatformLinux)
_graphicsManager.fadeOutShort();
_globals.iRegul = 0;
}
break;
case 22:
_linesManager.setMaxLineIdx(20);
_globals._characterMaxPosY = 445;
_objectsManager.PERSONAGE2("IM22", "IM22", "ANIM22", "IM22", 6, true);
break;
case 23:
_linesManager.setMaxLineIdx(20);
_globals._characterMaxPosY = 440;
_objectsManager.PERSONAGE2("IM23", "IM23", "ANIM23", "IM23", 6, true);
break;
case 24:
_linesManager.setMaxLineIdx(5);
_globals._characterMaxPosY = 450;
if (_globals._saveData->_data[svField181] == 1)
_objectsManager.PERSONAGE2("IM24", "IM24A", "ANIM24", "IM24", 1, true);
else
_objectsManager.PERSONAGE2("IM24", "IM24", "ANIM24", "IM24", 1, true);
break;
case 25:
_linesManager.setMaxLineIdx(20);
_globals._characterMaxPosY = 445;
if (getPlatform() == Common::kPlatformLinux || getPlatform() == Common::kPlatformWindows)
_objectsManager.PERSONAGE2("IM25", "IM25", "ANIM25", "IM25", 30, true);
else
_objectsManager.PERSONAGE2("IM25", "IM25", "ANIM25", "IM25", 8, true);
break;
case 26:
_linesManager.setMaxLineIdx(40);
_globals._characterMaxPosY = 435;
if (getPlatform() == Common::kPlatformLinux || getPlatform() == Common::kPlatformWindows)
_objectsManager.PERSONAGE2("IM26", "IM26", "ANIM26", "IM26", 30, true);
else
_objectsManager.PERSONAGE2("IM26", "IM26", "ANIM26", "IM26", 8, true);
break;
case 27:
_linesManager.setMaxLineIdx(15);
_globals._characterMaxPosY = 440;
if (_globals._saveData->_data[svField177] == 1)
_objectsManager.PERSONAGE2("IM27", "IM27A", "ANIM27", "IM27", 27, true);
else
_objectsManager.PERSONAGE2("IM27", "IM27", "ANIM27", "IM27", 27, true);
break;
case 28:
_linesManager.setMaxLineIdx(5);
_globals._characterMaxPosY = 450;
if (_globals._saveData->_data[svField166] != 1 || _globals._saveData->_data[svField167] != 1)
_objectsManager.PERSONAGE2("IM28", "IM28", "ANIM28", "IM28", 1, false);
else
_objectsManager.PERSONAGE2("IM28A", "IM28", "ANIM28", "IM28", 1, false);
break;
case 29:
_linesManager.setMaxLineIdx(50);
_globals._characterMaxPosY = 445;
_objectsManager.PERSONAGE2("IM29", "IM29", "ANIM29", "IM29", 1, true);
break;
case 30:
_linesManager.setMaxLineIdx(15);
_globals._characterMaxPosY = 440;
_objectsManager.PERSONAGE2("IM30", "IM30", "ANIM30", "IM30", 24, false);
break;
case 31:
_objectsManager.PERSONAGE("IM31", "IM31", "ANIM31", "IM31", 10, true);
break;
case 32:
_linesManager.setMaxLineIdx(20);
_globals._characterMaxPosY = 445;
_objectsManager.PERSONAGE2("IM32", "IM32", "ANIM32", "IM32", 2, true);
break;
case 33:
_objectsManager.PERSONAGE("IM33", "IM33", "ANIM33", "IM33", 8, false);
break;
case 34:
_objectsManager.PERSONAGE("IM34", "IM34", "ANIM34", "IM34", 2, false);
break;
case 35:
case 36:
case 37:
case 38:
case 39:
case 40:
case 41: {
_linesManager.setMaxLineIdx(40);
_globals._characterMaxPosY = 435;
_globals._disableInventFl = false;
_objectsManager._forestFl = true;
Common::String im = Common::String::format("IM%d", _globals._exitId);
_soundManager.WSOUND(13);
if (_objectsManager._forestSprite == g_PTRNUL) {
_objectsManager._forestSprite = _objectsManager.loadSprite("HOPDEG.SPR");
_soundManager.loadSample(1, "SOUND41.WAV");
}
_objectsManager.PERSONAGE2(im, im, "BANDIT", im, 13, false);
if (_globals._exitId < 35 || _globals._exitId > 49) {
_objectsManager._forestSprite = _globals.freeMemory(_objectsManager._forestSprite);
_objectsManager._forestFl = false;
_soundManager.DEL_SAMPLE(1);
}
break;
}
case 50:
displayPlane();
_globals._exitId = 51;
break;
case 51:
_linesManager.setMaxLineIdx(10);
_globals._characterMaxPosY = 440;
_objectsManager.PERSONAGE2("IM51", "IM51", "ANIM51", "IM51", 14, true);
break;
case 52:
_linesManager.setMaxLineIdx(15);
_globals._characterMaxPosY = 445;
_objectsManager.PERSONAGE2("IM52", "IM52", "ANIM52", "IM52", 14, true);
break;
case 54:
_linesManager.setMaxLineIdx(30);
_globals._characterMaxPosY = 440;
_objectsManager.PERSONAGE2("IM54", "IM54", "ANIM54", "IM54", 14, true);
break;
case 55:
_linesManager.setMaxLineIdx(30);
_globals._characterMaxPosY = 460;
_objectsManager.PERSONAGE2("IM55", "IM55", "ANIM55", "IM55", 14, false);
break;
case 56:
_linesManager.setMaxLineIdx(30);
_globals._characterMaxPosY = 440;
_objectsManager.PERSONAGE2("IM56", "IM56", "ANIM56", "IM56", 14, false);
break;
case 57:
_linesManager.setMaxLineIdx(30);
_globals._characterMaxPosY = 440;
_objectsManager.PERSONAGE2("IM57", "IM57", "ANIM57", "IM57", 14, true);
break;
case 58:
_linesManager.setMaxLineIdx(30);
_globals._characterMaxPosY = 440;
_objectsManager.PERSONAGE2("IM58", "IM58", "ANIM58", "IM58", 14, false);
break;
case 59:
_linesManager.setMaxLineIdx(5);
_globals._characterMaxPosY = 445;
_objectsManager.PERSONAGE2("IM59", "IM59", "ANIM59", "IM59", 21, false);
break;
case 60:
_linesManager.setMaxLineIdx(30);
_globals._characterMaxPosY = 440;
_objectsManager.PERSONAGE2("IM60", "IM60", "ANIM60", "IM60", 21, false);
break;
case 61:
if (_globals._saveData->_data[svField311] == 1 && !_globals._saveData->_data[svField312])
handleConflagration();
_objectsManager.PERSONAGE("IM61", "IM61", "ANIM61", "IM61", 21, false);
break;
case 62:
_linesManager.setMaxLineIdx(8);
_globals._characterMaxPosY = 435;
_objectsManager.PERSONAGE2("IM62", "IM62", NULL, "IM62", 21, false);
break;
case 63:
_linesManager.setMaxLineIdx(30);
_globals._characterMaxPosY = 435;
_objectsManager.PERSONAGE2("IM63", "IM63", "ANIM63", "IM63", 21, false);
break;
case 64:
_linesManager.setMaxLineIdx(30);
_globals._characterMaxPosY = 435;
_objectsManager.PERSONAGE2("IM64", "IM64", "ANIM64", "IM64", 21, true);
break;
case 65:
_linesManager.setMaxLineIdx(30);
_globals._characterMaxPosY = 435;
_objectsManager.PERSONAGE2("IM65", "IM65", "ANIM65", "IM65", 21, false);
break;
case 66:
_linesManager.setMaxLineIdx(5);
_globals._characterMaxPosY = 445;
_objectsManager.PERSONAGE2("IM66", "IM66", "ANIM66", "IM66", 21, false);
break;
case 67:
_linesManager.setMaxLineIdx(8);
_globals._characterMaxPosY = 435;
_objectsManager.PERSONAGE2("IM67", "IM67", NULL, "IM67", 21, false);
break;
case 68:
_linesManager.setMaxLineIdx(8);
_globals._characterMaxPosY = 435;
_objectsManager.PERSONAGE2("IM68", "IM68", "ANIM68", "IM68", 21, true);
break;
case 69:
_linesManager.setMaxLineIdx(5);
_globals._characterMaxPosY = 445;
_objectsManager.PERSONAGE2("IM69", "IM69", "ANIM69", "IM69", 21, false);
break;
case 70:
_linesManager.setMaxLineIdx(8);
_globals._characterMaxPosY = 435;
_objectsManager.PERSONAGE2("IM70", "IM70", NULL, "IM70", 21, false);
break;
case 71:
_linesManager.setMaxLineIdx(5);
_globals._characterMaxPosY = 445;
_objectsManager.PERSONAGE2("IM71", "IM71", "ANIM71", "IM71", 21, false);
break;
case 73:
_linesManager.setMaxLineIdx(15);
_globals._characterMaxPosY = 445;
if (_globals._saveData->_data[svField318] == 1)
_objectsManager.PERSONAGE2("IM73", "IM73A", "ANIM73", "IM73", 21, true);
else
_objectsManager.PERSONAGE2("IM73", "IM73", "ANIM73", "IM73", 21, true);
break;
case 75:
BASE();
break;
case 77:
OCEAN(77, "OCEAN01", 3, 0, 84, 0, 0, 25);
break;
case 78:
OCEAN(78, "OCEAN02", 1, 0, 91, 84, 0, 25);
break;
case 79:
OCEAN(79, "OCEAN03", 7, 87, 0, 0, 83, 25);
break;
case 80:
OCEAN(80, "OCEAN04", 1, 86, 88, 0, 81, 25);
break;
case 81:
OCEAN(81, "OCEAN05", 1, 91, 82, 80, 85, 25);
break;
case 82:
OCEAN(82, "OCEAN06", 7, 81, 0, 88, 0, 25);
break;
case 83:
OCEAN(83, "OCEAN07", 1, 89, 0, 79, 88, 25);
break;
case 84:
OCEAN(84, "OCEAN08", 1, 77, 0, 0, 78, 25);
break;
case 85:
OCEAN(85, "OCEAN09", 1, 0, 0, 81, 0, 25);
break;
case 86:
OCEAN(86, "OCEAN10", 1, 0, 80, 0, 91, 25);
break;
case 87:
OCEAN(87, "OCEAN11", 3, 0, 79, 90, 0, 25);
break;
case 88:
OCEAN(88, "OCEAN12", 1, 80, 0, 83, 82, 25);
break;
case 89:
OCEAN(89, "OCEAN13", 3, 0, 83, 0, 0, 25);
break;
case 90:
BASED();
break;
case 91:
OCEAN(91, "OCEAN15", 3, 78, 81, 86, 0, 25);
break;
case 93:
_linesManager.setMaxLineIdx(5);
_globals._characterMaxPosY = 445;
if (_globals._saveData->_data[svField330]) {
if (getPlatform() == Common::kPlatformLinux || getPlatform() == Common::kPlatformWindows)
_objectsManager.PERSONAGE2("IM93", "IM93C", "ANIM93", "IM93", 29, true);
else
_objectsManager.PERSONAGE2("IM93", "IM93C", "ANIM93", "IM93", 26, true);
} else {
if (getPlatform() == Common::kPlatformLinux || getPlatform() == Common::kPlatformWindows)
_objectsManager.PERSONAGE2("IM93", "IM93", "ANIM93", "IM93", 29, true);
else
_objectsManager.PERSONAGE2("IM93", "IM93", "ANIM93", "IM93", 26, true);
}
break;
case 94:
_linesManager.setMaxLineIdx(5);
_globals._characterMaxPosY = 440;
_objectsManager.PERSONAGE2("IM94", "IM94", "ANIM94", "IM94", 19, true);
break;
case 95:
_linesManager.setMaxLineIdx(5);
_globals._characterMaxPosY = 435;
_objectsManager.PERSONAGE2("IM95", "IM95", "ANIM95", "IM95", 19, false);
break;
case 96:
_linesManager.setMaxLineIdx(5);
_globals._characterMaxPosY = 435;
_objectsManager.PERSONAGE2("IM96", "IM96", "ANIM96", "IM96", 19, false);
break;
case 97:
_linesManager.setMaxLineIdx(5);
_globals._characterMaxPosY = 435;
_objectsManager.PERSONAGE2("IM97", "IM97", "ANIM97", "IM97", 19, false);
if (_globals._exitId == 18) {
_globals.iRegul = 1;
_soundManager.WSOUND_OFF();
_graphicsManager.lockScreen();
_graphicsManager.clearScreen();
_graphicsManager.unlockScreen();
_graphicsManager.clearPalette();
_soundManager.WSOUND(6);
_animationManager.playAnim("PURG1A.ANM", 12, 18, 50);
_graphicsManager.fadeOutShort();
_globals.iRegul = 0;
}
break;
case 98:
_linesManager.setMaxLineIdx(5);
_globals._characterMaxPosY = 435;
_objectsManager.PERSONAGE2("IM98", "IM98", "ANIM98", "IM98", 19, true);
break;
case 99:
_linesManager.setMaxLineIdx(5);
_globals._characterMaxPosY = 435;
_objectsManager.PERSONAGE2("IM99", "IM99", "ANIM99", "IM99", 19, true);
break;
case 100:
playEnding();
break;
case 111:
_objectsManager.PERSONAGE("IM111", "IM111", "ANIM111", "IM111", 10, false);
break;
case 112:
_objectsManager.PERSONAGE("IM112", "IM112", "ANIM112", "IM112", 10, false);
break;
case 113:
_globals._prevScreenId = _globals._screenId;
_globals._screenId = 113;
_globals._saveData->_data[svField6] = _globals._prevScreenId;
_globals._saveData->_data[svField5] = _globals._screenId;
_globals._exitId = 0;
_computerManager.showComputer(COMPUTER_HOPKINS);
_graphicsManager.lockScreen();
_graphicsManager.clearScreen();
_graphicsManager.unlockScreen();
_graphicsManager.DD_VBL();
memset(_graphicsManager._vesaBuffer, 0, 307200);
memset(_graphicsManager._vesaScreen, 0, 307200);
_graphicsManager.clearPalette();
_graphicsManager.RESET_SEGMENT_VESA();
break;
case 114:
_globals._exitId = 0;
_globals._prevScreenId = _globals._screenId;
_globals._screenId = 114;
_globals._saveData->_data[svField6] = _globals._prevScreenId;
_globals._saveData->_data[svField5] = _globals._screenId;
_computerManager.showComputer(COMPUTER_SAMANTHA);
_graphicsManager.lockScreen();
_graphicsManager.clearScreen();
_graphicsManager.unlockScreen();
break;
case 115:
_globals._prevScreenId = _globals._screenId;
_globals._screenId = 115;
_globals._saveData->_data[svField6] = _globals._prevScreenId;
_globals._saveData->_data[svField5] = _globals._screenId;
_globals._exitId = 0;
_computerManager.showComputer(COMPUTER_PUBLIC);
_graphicsManager.lockScreen();
_graphicsManager.clearScreen();
_graphicsManager.unlockScreen();
break;
case 150:
_soundManager.WSOUND(16);
_globals.iRegul = 1;
_graphicsManager.lockScreen();
_graphicsManager.clearScreen();
_graphicsManager.unlockScreen();
_graphicsManager.clearPalette();
if (getPlatform() == Common::kPlatformLinux)
_graphicsManager.FADE_LINUX = 2;
_animationManager.playAnim("JOUR1A.ANM", 12, 12, 2000);
_globals.iRegul = 0;
_globals._exitId = 300;
break;
case 151:
_soundManager.WSOUND(16);
_globals.iRegul = 1;
_graphicsManager.lockScreen();
_graphicsManager.clearScreen();
_graphicsManager.unlockScreen();
_graphicsManager.clearPalette();
if (getPlatform() == Common::kPlatformLinux)
_graphicsManager.FADE_LINUX = 2;
_animationManager.playAnim("JOUR3A.ANM", 12, 12, 2000);
_globals.iRegul = 0;
_globals._exitId = 300;
break;
case 152:
_soundManager.WSOUND(16);
_globals.iRegul = 1;
_graphicsManager.lockScreen();
_graphicsManager.clearScreen();
_graphicsManager.unlockScreen();
_graphicsManager.clearPalette();
if (getPlatform() == Common::kPlatformLinux)
_graphicsManager.FADE_LINUX = 2;
_animationManager.playAnim("JOUR4A.ANM", 12, 12, 2000);
_globals.iRegul = 0;
_globals._exitId = 300;
break;
case 194:
case 195:
case 196:
case 197:
case 198:
case 199:
_globals.PERSO = _globals.freeMemory(_globals.PERSO);
_globals.iRegul = 1;
_soundManager.WSOUND_OFF();
_soundManager.WSOUND(23);
_globals._exitId = handleBaseMap(); // Handles the base map (non-Windows)
//_globals._exitId = WBASE(); // Handles the 3D Doom level (Windows)
_soundManager.WSOUND_OFF();
_globals.PERSO = _fileManager.loadFile("PERSO.SPR");
_globals.PERSO_TYPE = 0;
_globals.iRegul = 0;
_graphicsManager._lineNbr = SCREEN_WIDTH;
break;
}
}
_globals.PERSO = _globals.freeMemory(_globals.PERSO);
restoreSystem();
return true;
}
bool HopkinsEngine::shouldQuit() const {
return g_system->getEventManager()->shouldQuit();
}
int HopkinsEngine::getRandomNumber(int maxNumber) {
return _randomSource.getRandomNumber(maxNumber);
}
void HopkinsEngine::initializeSystem() {
// Set graphics mode
_graphicsManager.setGraphicalMode(SCREEN_WIDTH, SCREEN_HEIGHT);
// Synchronize the sound settings from ScummVM
_soundManager.syncSoundSettings();
const Common::FSNode gameDataDir(ConfMan.get("path"));
SearchMan.addSubDirectoryMatching(gameDataDir, "SYSTEM");
SearchMan.addSubDirectoryMatching(gameDataDir, "LINK");
SearchMan.addSubDirectoryMatching(gameDataDir, "BUFFER");
SearchMan.addSubDirectoryMatching(gameDataDir, "ANIM");
SearchMan.addSubDirectoryMatching(gameDataDir, "ANM");
SearchMan.addSubDirectoryMatching(gameDataDir, "BASE");
SearchMan.addSubDirectoryMatching(gameDataDir, "MUSIC");
SearchMan.addSubDirectoryMatching(gameDataDir, "SEQ");
SearchMan.addSubDirectoryMatching(gameDataDir, "SAVE");
SearchMan.addSubDirectoryMatching(gameDataDir, "SOUND");
SearchMan.addSubDirectoryMatching(gameDataDir, "SVGA");
SearchMan.addSubDirectoryMatching(gameDataDir, "VOICE");
SearchMan.addSubDirectoryMatching(gameDataDir, "TSVGA");
_eventsManager.initMouseData();
_globals.clearAll();
_fontManager._font = _fileManager.loadFile("FONTE3.SPR");
_fontManager._fontFixedWidth = 12;
_fontManager._fontFixedHeight = 21;
_dialogsManager._inventoryIcons = _fileManager.loadFile("ICONE.SPR");
_objectsManager._headSprites = _fileManager.loadFile("TETE.SPR");
switch (_globals._language) {
case LANG_EN:
_globals.BUF_ZONE = _fileManager.loadFile("ZONEAN.TXT");
break;
case LANG_FR:
_globals.BUF_ZONE = _fileManager.loadFile("ZONE01.TXT");
break;
case LANG_SP:
_globals.BUF_ZONE = _fileManager.loadFile("ZONEES.TXT");
break;
}
_eventsManager.setMouseOn();
_eventsManager._mouseFl = false;
_globals.loadCharacterData();
_eventsManager._mouseOffset.x = 0;
_eventsManager._mouseOffset.y = 0;
}
/**
* Play the intro of the game
*/
void HopkinsEngine::playIntro() {
// Win95 EN demo doesn't include the intro
if ((getLanguage() == Common::EN_ANY) && (getPlatform() == Common::kPlatformWindows) && (getIsDemo()))
return;
byte paletteData[PALETTE_EXT_BLOCK_SIZE];
byte paletteData2[PALETTE_EXT_BLOCK_SIZE];
memset(&paletteData, 0, PALETTE_EXT_BLOCK_SIZE);
_eventsManager.VBL();
_eventsManager._mouseFl = false;
_globals.iRegul = 1;
_eventsManager.VBL();
_soundManager.WSOUND(16);
_animationManager._clearAnimationFl = true;
_animationManager.playAnim("J1.anm", 12, 12, 50);
if (shouldQuit() || _eventsManager._escKeyFl)
return;
_soundManager.mixVoice(1, 3);
_animationManager.playAnim("J2.anm", 12, 12, 50);
if (shouldQuit() || _eventsManager._escKeyFl)
return;
_soundManager.mixVoice(2, 3);
_animationManager.playAnim("J3.anm", 12, 12, 50);
if (shouldQuit() || _eventsManager._escKeyFl)
return;
_soundManager.mixVoice(3, 3);
_graphicsManager.lockScreen();
_graphicsManager.clearScreen();
_graphicsManager.unlockScreen();
_graphicsManager.clearPalette();
_graphicsManager.DD_VBL();
_soundManager.WSOUND(11);
_graphicsManager.loadImage("intro1");
_graphicsManager.scrollScreen(0);
_graphicsManager._scrollOffset = 0;
_graphicsManager.SETCOLOR3(252, 100, 100, 100);
_graphicsManager.SETCOLOR3(253, 100, 100, 100);
_graphicsManager.SETCOLOR3(251, 100, 100, 100);
_graphicsManager.SETCOLOR3(254, 0, 0, 0);
for (int i = 0; i <= 4; i++)
_eventsManager.VBL();
_globals.iRegul = 1;
_graphicsManager.fadeInLong();
if (_graphicsManager._largeScreenFl) {
_graphicsManager._scrollStatus = 2;
_graphicsManager._scrollPosX = 0;
bool loopCond = false;
do {
_graphicsManager._scrollPosX += 2;
if (_graphicsManager._scrollPosX > (SCREEN_WIDTH - 2)) {
_graphicsManager._scrollPosX = SCREEN_WIDTH;
loopCond = true;
}
if (_eventsManager.getMouseX() < _graphicsManager._scrollPosX + 10)
_eventsManager.setMouseXY(_eventsManager._mousePos.x + 4, _eventsManager.getMouseY());
_eventsManager.VBL();
} while (!shouldQuit() && !loopCond && _graphicsManager._scrollPosX != SCREEN_WIDTH);
_eventsManager.VBL();
_graphicsManager._scrollStatus = 0;
if (shouldQuit())
return;
}
_soundManager.mixVoice(4, 3);
_graphicsManager.fadeOutLong();
_graphicsManager._scrollStatus = 0;
_graphicsManager.loadImage("intro2");
_graphicsManager.scrollScreen(0);
_animationManager.loadAnim("INTRO2");
_graphicsManager.VISU_ALL();
_soundManager.WSOUND(23);
_objectsManager.stopBobAnimation(3);
_objectsManager.stopBobAnimation(5);
_graphicsManager._scrollOffset = 0;
_graphicsManager.SETCOLOR3(252, 100, 100, 100);
_graphicsManager.SETCOLOR3(253, 100, 100, 100);
_graphicsManager.SETCOLOR3(251, 100, 100, 100);
_graphicsManager.SETCOLOR3(254, 0, 0, 0);
for (int i = 0; i <= 4; i++)
_eventsManager.VBL();
_globals.iRegul = 1;
_graphicsManager.fadeInLong();
for (uint i = 0; i < 200 / _globals._speed; ++i)
_eventsManager.VBL();
_objectsManager.setBobAnimation(3);
_soundManager.mixVoice(5, 3);
_objectsManager.stopBobAnimation(3);
_eventsManager.VBL();
memcpy(&paletteData2, _graphicsManager._palette, 796);
_graphicsManager.setPaletteVGA256WithRefresh(paletteData, _graphicsManager._vesaBuffer);
_graphicsManager.FIN_VISU();
if (shouldQuit() || _eventsManager._escKeyFl)
return;
_soundManager._specialSoundNum = 5;
_graphicsManager.FADE_LINUX = 2;
_animationManager.playAnim("ELEC.ANM", 10, 26, 200);
_soundManager._specialSoundNum = 0;
if (shouldQuit() || _eventsManager._escKeyFl)
return;
_graphicsManager.loadImage("intro2");
_graphicsManager.scrollScreen(0);
_animationManager.loadAnim("INTRO2");
_graphicsManager.VISU_ALL();
_soundManager.WSOUND(23);
_objectsManager.stopBobAnimation(3);
_objectsManager.stopBobAnimation(5);
_objectsManager.stopBobAnimation(1);
_graphicsManager._scrollOffset = 0;
_graphicsManager.SETCOLOR3(252, 100, 100, 100);
_graphicsManager.SETCOLOR3(253, 100, 100, 100);
_graphicsManager.SETCOLOR3(251, 100, 100, 100);
_graphicsManager.SETCOLOR3(254, 0, 0, 0);
for (int i = 0; i <= 3; i++)
_eventsManager.VBL();
_globals.iRegul = 1;
_graphicsManager.setPaletteVGA256WithRefresh(paletteData2, _graphicsManager._vesaBuffer);
int introIndex = 0;
while (!shouldQuit() && !_eventsManager._escKeyFl) {
if (introIndex == 12) {
_objectsManager.setBobAnimation(3);
_eventsManager.VBL();
_soundManager.mixVoice(6, 3);
_eventsManager.VBL();
_objectsManager.stopBobAnimation(3);
}
Common::copy(&paletteData2[0], &paletteData2[PALETTE_BLOCK_SIZE], &_graphicsManager._palette[0]);
for (int i = 1, v12 = 4 * introIndex; i <= PALETTE_BLOCK_SIZE; i++) {
if (_graphicsManager._palette[i] > v12)
_graphicsManager._palette[i] -= v12;
}
_graphicsManager.setPaletteVGA256WithRefresh(_graphicsManager._palette, _graphicsManager._vesaBuffer);
for (int i = 1; i < 2 * introIndex; i++)
_eventsManager.VBL();
_graphicsManager.setPaletteVGA256WithRefresh(paletteData2, _graphicsManager._vesaBuffer);
for (int i = 1; i < 20 - introIndex; i++)
_eventsManager.VBL();
introIndex += 2;
if (introIndex > 15) {
_graphicsManager.setPaletteVGA256WithRefresh(paletteData, _graphicsManager._vesaBuffer);
for (uint j = 1; j < 100 / _globals._speed; ++j)
_eventsManager.VBL();
_objectsManager.setBobAnimation(3);
_soundManager.mixVoice(7, 3);
_objectsManager.stopBobAnimation(3);
for (uint k = 1; k < 60 / _globals._speed; ++k)
_eventsManager.VBL();
_objectsManager.setBobAnimation(5);
for (uint l = 0; l < 20 / _globals._speed; ++l)
_eventsManager.VBL();
Common::copy(&paletteData2[0], &paletteData2[PALETTE_BLOCK_SIZE], &_graphicsManager._palette[0]);
_graphicsManager.setPaletteVGA256WithRefresh(_graphicsManager._palette, _graphicsManager._vesaBuffer);
for (uint m = 0; m < 50 / _globals._speed; ++m) {
if (m == 30 / _globals._speed) {
_objectsManager.setBobAnimation(3);
_soundManager.mixVoice(8, 3);
_objectsManager.stopBobAnimation(3);
}
_eventsManager.VBL();
}
_graphicsManager.fadeOutLong();
_graphicsManager.FIN_VISU();
_animationManager._clearAnimationFl = true;
_soundManager.WSOUND(3);
_soundManager._specialSoundNum = 1;
_animationManager.playAnim("INTRO1.anm", 10, 24, 18);
_soundManager._specialSoundNum = 0;
if (shouldQuit() || _eventsManager._escKeyFl)
return;
_animationManager.playAnim("INTRO2.anm", 10, 24, 18);
if (shouldQuit() || _eventsManager._escKeyFl)
return;
_animationManager.playAnim("INTRO3.anm", 10, 24, 200);
if (shouldQuit() || _eventsManager._escKeyFl)
return;
_animationManager._clearAnimationFl = false;
_graphicsManager.FADE_LINUX = 2;
_animationManager.playAnim("J4.anm", 12, 12, 1000);
break;
}
}
_eventsManager._escKeyFl = false;
}
/**
* If in demo, displays a 'not available' screen and returns to the city map
*/
void HopkinsEngine::displayNotAvailable() {
if (!getIsDemo())
return;
if (_globals._language == LANG_FR)
_graphicsManager.loadImage("ndfr");
else
_graphicsManager.loadImage("nduk");
_graphicsManager.fadeInLong();
if (_soundManager._voiceOffFl)
_eventsManager.delay(500);
else
_soundManager.mixVoice(628, 4);
_graphicsManager.fadeOutLong();
_globals._exitId = 4;
}
void HopkinsEngine::handleNotAvailable(int sortie) {
// Use the code of the linux demo instead of the code of the Windows demo.
// The behavior is somewhat better, and common code is easier to maintain.
displayNotAvailable();
_globals._exitId = sortie;
}
void HopkinsEngine::displayEndDemo() {
_soundManager.WSOUND(28);
if (_globals._language == LANG_FR)
_graphicsManager.loadImage("endfr");
else
_graphicsManager.loadImage("enduk");
_graphicsManager.fadeInLong();
_eventsManager.delay(1500);
_graphicsManager.fadeOutLong();
_globals._exitId = 0;
}
void HopkinsEngine::bombExplosion() {
_graphicsManager._lineNbr = SCREEN_WIDTH;
_graphicsManager.SCANLINE(SCREEN_WIDTH);
_graphicsManager.lockScreen();
_graphicsManager.clearScreen();
_graphicsManager.unlockScreen();
_graphicsManager.clearPalette();
_globals.iRegul = 1;
_soundManager._specialSoundNum = 199;
_graphicsManager.FADE_LINUX = 2;
_animationManager.playAnim("BOMBE2A.ANM", 50, 14, 500);
_soundManager._specialSoundNum = 0;
_graphicsManager.loadImage("IM15");
_animationManager.loadAnim("ANIM15");
_graphicsManager.VISU_ALL();
_objectsManager.stopBobAnimation(7);
for (int idx = 0; idx < 5; ++idx) {
_eventsManager.VBL();
}
_graphicsManager.fadeInLong();
_eventsManager.mouseOff();
for (int idx = 0; idx < 20; ++idx) {
_eventsManager.VBL();
}
_globals._introSpeechOffFl = true;
_talkManager.PARLER_PERSO2("vire.pe2");
_globals._introSpeechOffFl = false;
_objectsManager.setBobAnimation(7);
for (int idx = 0; idx < 100; ++idx) {
_eventsManager.VBL();
}
_graphicsManager.fadeOutLong();
_graphicsManager.FIN_VISU();
_globals.iRegul = 0;
_globals._exitId = 151;
}
void HopkinsEngine::restoreSystem() {
quitGame();
_eventsManager.refreshEvents();
}
void HopkinsEngine::endLinuxDemo() {
_globals._linuxEndDemoFl = true;
_graphicsManager.RESET_SEGMENT_VESA();
_objectsManager._forestFl = false;
_eventsManager._breakoutFl = false;
_globals._disableInventFl = true;
_graphicsManager.loadImage("BOX");
_soundManager.WSOUND(28);
_graphicsManager.fadeInLong();
_eventsManager.mouseOn();
_eventsManager.changeMouseCursor(0);
_eventsManager._mouseCursorId = 0;
_eventsManager._mouseSpriteId = 0;
bool mouseClicked = false;
do {
_eventsManager.VBL();
if (_eventsManager.getMouseButton() == 1)
mouseClicked = true;
} while (!mouseClicked && !g_system->getEventManager()->shouldQuit());
// Original tried to open a web browser link here. Since ScummVM doesn't support
// that, it's being skipped in favor of simply exiting
_graphicsManager.fadeOutLong();
}
void HopkinsEngine::handleConflagration() {
_globals._disableInventFl = true;
_globals.iRegul = 1;
_graphicsManager.loadImage("IM71");
_animationManager.loadAnim("ANIM71");
_graphicsManager.SETCOLOR3(252, 100, 100, 100);
_graphicsManager.SETCOLOR3(253, 100, 100, 100);
_graphicsManager.SETCOLOR3(251, 100, 100, 100);
_graphicsManager.SETCOLOR3(254, 0, 0, 0);
_graphicsManager.VISU_ALL();
for (int cpt = 0; cpt <= 4; cpt++)
_eventsManager.VBL();
_graphicsManager.fadeInLong();
_globals.iRegul = 1;
for (int cpt = 0; cpt <= 249; cpt++)
_eventsManager.VBL();
_globals._introSpeechOffFl = true;
_talkManager.PARLER_PERSO("SVGARD1.pe2");
_globals._introSpeechOffFl = false;
for (int cpt = 0; cpt <= 49; cpt++)
_eventsManager.VBL();
_graphicsManager.fadeOutLong();
_graphicsManager.FIN_VISU();
_globals._saveData->_data[svField312] = 1;
_globals._disableInventFl = false;
}
void HopkinsEngine::BASE() {
_globals.iRegul = 1;
_graphicsManager._lineNbr = SCREEN_WIDTH;
_graphicsManager.lockScreen();
_graphicsManager.clearScreen();
_graphicsManager.unlockScreen();
_graphicsManager.clearPalette();
_animationManager._clearAnimationFl = true;
_soundManager.WSOUND(25);
_animationManager.playAnim("base00a.anm", 10, 18, 18);
if (!_eventsManager._escKeyFl)
_animationManager.playAnim("base05a.anm", 10, 18, 18);
if (!_eventsManager._escKeyFl)
_animationManager.playAnim("base10a.anm", 10, 18, 18);
if (!_eventsManager._escKeyFl)
_animationManager.playAnim("base20a.anm", 10, 18, 18);
// CHECKME: The original code was doing the opposite test, which was a bug.
if (!_eventsManager._escKeyFl)
_animationManager.playAnim("base30a.anm", 10, 18, 18);
if (!_eventsManager._escKeyFl)
_animationManager.playAnim("base40a.anm", 10, 18, 18);
if (!_eventsManager._escKeyFl)
_animationManager.playAnim("base50a.anm", 10, 18, 18);
if (!_eventsManager._escKeyFl)
_animationManager.playAnim("OC00a.anm", 10, 18, 18);
if (!_eventsManager._escKeyFl)
_animationManager.playAnim("OC05a.anm", 10, 18, 18);
if (!_eventsManager._escKeyFl)
_animationManager.playAnim("OC10a.anm", 10, 18, 18);
if (!_eventsManager._escKeyFl)
_animationManager.playAnim("OC20a.anm", 10, 18, 18);
if (!_eventsManager._escKeyFl) {
_graphicsManager.FADE_LINUX = 2;
_animationManager.playAnim("OC30a.anm", 10, 18, 18);
}
_eventsManager._escKeyFl = false;
_animationManager._clearAnimationFl = false;
_globals._exitId = 85;
}
void HopkinsEngine::BASED() {
_graphicsManager.lockScreen();
_graphicsManager.clearScreen();
_graphicsManager.unlockScreen();
_graphicsManager.clearPalette();
_animationManager.NO_SEQ = false;
_soundManager.WSOUND(26);
_globals.iRegul = 1;
_globals._disableInventFl = true;
_animationManager.NO_COUL = true;
_graphicsManager.FADE_LINUX = 2;
_animationManager.playSequence("abase.seq", 50, 15, 50);
_animationManager.NO_COUL = false;
_graphicsManager.loadImage("IM92");
_animationManager.loadAnim("ANIM92");
_graphicsManager.VISU_ALL();
_objectsManager.INILINK("IM92");
for (int cpt = 0; cpt <= 4; cpt++)
_eventsManager.VBL();
_graphicsManager.fadeInLong();
_globals.CACHE_ON();
do
_eventsManager.VBL();
while (_objectsManager.getBobAnimDataIdx(8) != 22);
_graphicsManager.fadeOutLong();
_graphicsManager.FIN_VISU();
_globals.resetCache();
_globals._disableInventFl = false;
_globals._exitId = 93;
_globals.iRegul = 0;
}
void HopkinsEngine::playEnding() {
_globals.PERSO = _globals.freeMemory(_globals.PERSO);
_dialogsManager._removeInventFl = true;
_globals._disableInventFl = true;
_graphicsManager._scrollOffset = 0;
_globals._cityMapEnabledFl = false;
_globals.iRegul = 1;
_soundManager.WSOUND(26);
_linesManager._route = (int16 *)g_PTRNUL;
_globals.NOMARCHE = true;
_globals._exitId = 0;
_soundManager.loadSample(1, "SOUND90.WAV");
_graphicsManager.loadImage("IM100");
_animationManager.loadAnim("ANIM100");
_graphicsManager.VISU_ALL();
_eventsManager.mouseOn();
_objectsManager.stopBobAnimation(7);
_objectsManager.stopBobAnimation(8);
_objectsManager.stopBobAnimation(9);
_graphicsManager.SETCOLOR3(252, 100, 100, 100);
_graphicsManager.SETCOLOR3(253, 100, 100, 100);
_graphicsManager.SETCOLOR3(251, 100, 100, 100);
_graphicsManager.SETCOLOR3(254, 0, 0, 0);
_eventsManager.changeMouseCursor(0);
for (int cpt = 0; cpt <= 4; cpt++)
_eventsManager.VBL();
_graphicsManager.fadeInLong();
_globals.iRegul = 1;
do
_eventsManager.VBL();
while (_objectsManager.getBobAnimDataIdx(6) != 54);
_globals._introSpeechOffFl = true;
_talkManager.PARLER_PERSO("GM4.PE2");
_globals._disableInventFl = true;
_objectsManager.stopBobAnimation(6);
_objectsManager.stopBobAnimation(10);
_objectsManager.setBobAnimation(9);
_objectsManager.setBobAnimation(7);
do
_eventsManager.VBL();
while (_objectsManager.getBobAnimDataIdx(7) != 54);
_soundManager.PLAY_SAMPLE2(1);
do
_eventsManager.VBL();
while (_objectsManager.getBobAnimDataIdx(7) != 65);
_globals._introSpeechOffFl = true;
_talkManager.PARLER_PERSO("DUELB4.PE2");
_eventsManager.mouseOff();
_globals._disableInventFl = true;
do
_eventsManager.VBL();
while (_objectsManager.getBobAnimDataIdx(7) != 72);
_globals._introSpeechOffFl = true;
_talkManager.PARLER_PERSO("DUELH1.PE2");
do
_eventsManager.VBL();
while (_objectsManager.getBobAnimDataIdx(7) != 81);
_globals._introSpeechOffFl = true;
_talkManager.PARLER_PERSO("DUELB5.PE2");
do
_eventsManager.VBL();
while (_objectsManager.getBobAnimDataIdx(7) != 120);
_objectsManager.stopBobAnimation(7);
if (_globals._saveData->_data[svField135] == 1) {
_soundManager._specialSoundNum = 200;
_soundManager._skipRefreshFl = true;
_graphicsManager.FADE_LINUX = 2;
_animationManager.playAnim("BERM.ANM", 100, 24, 300);
_graphicsManager.FIN_VISU();
_soundManager.DEL_SAMPLE(1);
_graphicsManager.loadImage("PLAN3");
_graphicsManager.fadeInLong();
_eventsManager._rateCounter = 0;
if (!_eventsManager._escKeyFl) {
do
_eventsManager.refreshEvents();
while (_eventsManager._rateCounter < 2000 / _globals._speed && !_eventsManager._escKeyFl);
}
_eventsManager._escKeyFl = false;
_graphicsManager.fadeOutLong();
_globals.iRegul = 1;
_soundManager._specialSoundNum = 0;
_graphicsManager.FADE_LINUX = 2;
_animationManager.playAnim("JOUR2A.anm", 12, 12, 1000);
_soundManager.WSOUND(11);
_graphicsManager.lockScreen();
_graphicsManager.clearScreen();
_graphicsManager.unlockScreen();
_graphicsManager.clearPalette();
_animationManager.playAnim("FF1a.anm", 18, 18, 9);
_animationManager.playAnim("FF1a.anm", 9, 18, 9);
_animationManager.playAnim("FF1a.anm", 9, 18, 18);
_animationManager.playAnim("FF1a.anm", 9, 18, 9);
_animationManager.playAnim("FF2a.anm", 24, 24, 100);
displayCredits();
_globals.iRegul = 0;
_globals._exitId = 300;
_dialogsManager._removeInventFl = false;
_globals._disableInventFl = false;
} else {
_soundManager._specialSoundNum = 200;
_soundManager._skipRefreshFl = true;
_animationManager.playAnim2("BERM.ANM", 100, 24, 300);
_objectsManager.stopBobAnimation(7);
_objectsManager.setBobAnimation(8);
_globals._introSpeechOffFl = true;
_talkManager.PARLER_PERSO("GM5.PE2");
_globals._disableInventFl = true;
do
_eventsManager.VBL();
while (_objectsManager.getBobAnimDataIdx(8) != 5);
_soundManager.PLAY_SOUND2("SOUND41.WAV");
do
_eventsManager.VBL();
while (_objectsManager.getBobAnimDataIdx(8) != 21);
_graphicsManager.fadeOutLong();
_graphicsManager.FIN_VISU();
_soundManager.DEL_SAMPLE(1);
_soundManager.WSOUND(16);
_globals.iRegul = 1;
_soundManager._specialSoundNum = 0;
_dialogsManager._removeInventFl = false;
_globals._disableInventFl = false;
_animationManager.playAnim("JOUR4A.anm", 12, 12, 1000);
_globals.iRegul = 0;
_globals._exitId = 300;
}
_globals.PERSO = _fileManager.loadFile("PERSO.SPR");
_globals.PERSO_TYPE = 0;
_globals.iRegul = 0;
}
void HopkinsEngine::displayPlane() {
_soundManager.WSOUND(28);
_globals.iRegul = 1;
_globals.nbrligne = SCREEN_WIDTH;
_graphicsManager.lockScreen();
_graphicsManager.clearScreen();
_graphicsManager.unlockScreen();
_graphicsManager.clearPalette();
_animationManager._clearAnimationFl = false;
_animationManager.playAnim("aerop00a.anm", 10, 18, 18);
if (!_eventsManager._escKeyFl)
_animationManager.playAnim("serop10a.anm", 10, 18, 18);
if (!_eventsManager._escKeyFl)
_animationManager.playAnim("aerop20a.anm", 10, 18, 18);
if (!_eventsManager._escKeyFl)
_animationManager.playAnim("aerop30a.anm", 10, 18, 18);
if (!_eventsManager._escKeyFl)
_animationManager.playAnim("aerop40a.anm", 10, 18, 18);
if (!_eventsManager._escKeyFl)
_animationManager.playAnim("aerop50a.anm", 10, 18, 18);
if (!_eventsManager._escKeyFl)
_animationManager.playAnim("aerop60a.anm", 10, 18, 18);
if (!_eventsManager._escKeyFl)
_animationManager.playAnim("aerop70a.anm", 10, 18, 18);
if (!_eventsManager._escKeyFl)
_animationManager.playAnim("trans00a.anm", 10, 18, 18);
if (!_eventsManager._escKeyFl)
_animationManager.playAnim("trans10a.anm", 10, 18, 18);
if (!_eventsManager._escKeyFl)
_animationManager.playAnim("trans15a.anm", 10, 18, 18);
if (!_eventsManager._escKeyFl)
_animationManager.playAnim("trans20a.anm", 10, 18, 18);
if (!_eventsManager._escKeyFl)
_animationManager.playAnim("trans30a.anm", 10, 18, 18);
if (!_eventsManager._escKeyFl)
_animationManager.playAnim("trans40a.anm", 10, 18, 18);
if (!_eventsManager._escKeyFl) {
_graphicsManager.FADE_LINUX = 2;
_animationManager.playAnim("PARA00a.anm", 9, 9, 9);
}
_eventsManager._escKeyFl = false;
_animationManager._clearAnimationFl = false;
}
void HopkinsEngine::loadBaseMap() {
Common::String filename = Common::String::format("%s.PCX", "PBASE");
Common::File f;
if (f.exists(filename)) {
// PBASE file exists, so go ahead and load it
_graphicsManager.loadImage("PBASE");
} else {
// PBASE file doesn't exist, so draw a substitute screen
drawBaseMap();
}
}
void HopkinsEngine::drawBaseMap() {
memset(_graphicsManager._vesaScreen, 0, SCREEN_WIDTH * 2 * SCREEN_HEIGHT);
// List of rectangle areas to draw for exit points
const int rects[] = {
181, 66, 181 + 16, 66 + 22,
353, 116, 353 + 22, 116 + 16,
483, 250, 483 + 20, 250 + 25,
471, 326, 471 + 27, 326 + 20,
162, 365, 162 + 21, 365 + 23,
106, 267, 106 + 20, 267 + 26
};
// Loop through displaying
const int *rectP = &rects[0];
for (int rectIndex = 0; rectIndex < 6; ++rectIndex, rectP += 4) {
Common::Rect r(rectP[0], rectP[1], rectP[2], rectP[3]);
for (int yp = r.top; yp <= r.bottom; ++yp) {
byte *pDest = _graphicsManager._vesaScreen + yp * SCREEN_WIDTH + r.left;
Common::fill(pDest, pDest + r.width(), 0xff);
}
}
// Copy the calculated screen
memcpy(_graphicsManager._vesaBuffer, _graphicsManager._vesaScreen, SCREEN_WIDTH * 2 * SCREEN_HEIGHT);
// Write some explanatory text
_fontManager.displayText(40, 200, "ScummVM base map - select a square for different rooms", 255);
}
int HopkinsEngine::handleBaseMap() {
_globals._disableInventFl = true;
// Load the map image
loadBaseMap();
// Set needed colours
_graphicsManager.SETCOLOR3(252, 100, 100, 100);
_graphicsManager.SETCOLOR3(253, 100, 100, 100);
_graphicsManager.SETCOLOR3(251, 100, 100, 100);
_graphicsManager.SETCOLOR3(254, 0, 0, 0);
_eventsManager.changeMouseCursor(0);
_graphicsManager.fadeInLong();
bool loopCond = false;
int zone;
do {
if (shouldQuit())
return 0;
int mouseButton = _eventsManager.getMouseButton();
int posX = _eventsManager.getMouseX();
int posY = _eventsManager.getMouseY();
zone = 0;
if ((posX - 181 <= 16) && (posY - 66 <= 22) &&
(posX - 181 >= 0) && (posY - 66 >= 0))
zone = 1;
if ((posX - 353 <= 22) && (posY - 116 <= 19) &&
(posX - 353 >= 0) && (posY - 116 >= 0))
zone = 2;
if ((posX - 483 <= 20) && (posY - 250 <= 25) &&
(posX - 483 >= 0) && (posY - 250 >= 0))
zone = 3;
if ((posX - 471 <= 27) && (posY - 326 <= 20) &&
(posX - 471 >= 0) && (posY - 326 >= 0))
zone = 4;
if ((posX - 162 <= 21) && (posY - 365 <= 23) &&
(posX - 162 >= 0) && (posY - 365 >= 0))
zone = 5;
if ((posX - 106 <= 20) && (posY - 267 <= 26) &&
(posX - 106 >= 0) && (posY - 267 >= 0))
zone = 6;
if (zone) {
_eventsManager.changeMouseCursor(4);
_globals._baseMapColor += 25;
if (_globals._baseMapColor > 100)
_globals._baseMapColor = 0;
_graphicsManager.SETCOLOR4(251, _globals._baseMapColor, _globals._baseMapColor, _globals._baseMapColor);
} else {
_eventsManager.changeMouseCursor(0);
_graphicsManager.SETCOLOR4(251, 100, 100, 100);
}
_eventsManager.VBL();
if ((mouseButton == 1) && zone)
loopCond = true;
} while (!loopCond);
_globals._disableInventFl = false;
_graphicsManager.fadeOutLong();
int result;
switch (zone) {
case 1:
result = 94;
break;
case 2:
result = 95;
break;
case 3:
result = 96;
break;
case 4:
result = 97;
break;
case 5:
result = 98;
break;
case 6:
result = 99;
break;
default:
result = 0;
break;
}
return result;
}
void HopkinsEngine::loadCredits() {
_globals._creditsPosY = 440;
_globals._creditsStep = 45;
byte *bufPtr;
switch (_globals._language) {
case LANG_EN:
bufPtr = _fileManager.loadFile("CREAN.TXT");
break;
case LANG_FR:
bufPtr = _fileManager.loadFile("CREFR.TXT");
break;
case LANG_SP:
bufPtr = _fileManager.loadFile("CREES.TXT");
break;
default:
error("Unhandled language");
break;
}
byte *curPtr = bufPtr;
int idxLines = 0;
bool loopCond = false;
do {
if (*curPtr == '%') {
if (curPtr[1] == '%') {
loopCond = true;
break;
}
_globals._creditsItem[idxLines]._colour = curPtr[1];
_globals._creditsItem[idxLines]._actvFl = true;
_globals._creditsItem[idxLines]._linePosY = _globals._creditsPosY + idxLines * _globals._creditsStep;
int idxBuf = 0;
for(; idxBuf < 49; idxBuf++) {
byte curChar = curPtr[idxBuf + 3];
if (curChar == '%' || curChar == 10)
break;
_globals._creditsItem[idxLines]._line[idxBuf] = curChar;
}
_globals._creditsItem[idxLines]._line[idxBuf] = 0;
_globals._creditsItem[idxLines]._lineSize = idxBuf - 1;
curPtr = curPtr + idxBuf + 2;
++idxLines;
} else {
curPtr++;
}
_globals._creditsLineNumb = idxLines;
} while (!loopCond);
_globals.freeMemory(bufPtr);
}
void HopkinsEngine::displayCredits(int startPosY, byte *buffer, char colour) {
byte *bufPtr = buffer;
int strWidth = 0;
byte curChar;
for (;;) {
curChar = *bufPtr++;
if (!curChar)
break;
if (curChar > 31)
strWidth += _objectsManager.getWidth(_fontManager._font, curChar - 32);
}
int startPosX = 320 - strWidth / 2;
int endPosX = strWidth + startPosX;
int endPosY = startPosY + 12;
if ((_globals.Credit_bx == -1) && (_globals.Credit_bx1 == -1) && (_globals.Credit_by == -1) && (_globals.Credit_by1 == -1)) {
_globals.Credit_bx = startPosX;
_globals.Credit_bx1 = endPosX;
_globals.Credit_by = startPosY;
_globals.Credit_by1 = endPosY;
}
if (startPosX < _globals.Credit_bx)
_globals.Credit_bx = startPosX;
if (endPosX > _globals.Credit_bx1)
_globals.Credit_bx1 = endPosX;
if (_globals.Credit_by > startPosY)
_globals.Credit_by = startPosY;
if (endPosY > _globals.Credit_by1)
_globals.Credit_by1 = endPosY;
bufPtr = buffer;
for (;;) {
curChar = *bufPtr++;
if (!curChar)
break;
if (curChar > 31) {
_graphicsManager.displayFont(_graphicsManager._vesaBuffer, _fontManager._font, startPosX, startPosY, curChar - 32, colour);
startPosX += _objectsManager.getWidth(_fontManager._font, curChar - 32);
}
}
}
void HopkinsEngine::displayCredits() {
loadCredits();
_globals._creditsPosY = 436;
_graphicsManager.loadImage("GENERIC");
_graphicsManager.fadeInLong();
_soundManager.WSOUND(28);
_eventsManager._mouseFl = false;
_globals.iRegul = 3;
_globals.Credit_bx = _globals.Credit_bx1 = _globals.Credit_by = _globals.Credit_by1 = -1;
int soundId = 28;
do {
for (int i = 0; i < _globals._creditsLineNumb; ++i) {
if (_globals._creditsItem[i]._actvFl) {
int nextY = _globals._creditsPosY + i * _globals._creditsStep;
_globals._creditsItem[i]._linePosY = nextY;
if ((nextY - 21 >= 0) && (nextY - 21 <= 418)) {
int col = 0;
switch (_globals._creditsItem[i]._colour) {
case '1':
col = 163;
break;
case '2':
col = 161;
break;
case '3':
col = 162;
break;
default:
warning("Unknown colour, default to col #1");
col = 163;
break;
}
if (_globals._creditsItem[i]._lineSize != -1)
displayCredits(nextY, _globals._creditsItem[i]._line, col);
}
}
}
--_globals._creditsPosY;
if (_globals.Credit_bx != -1 || _globals.Credit_bx1 != -1 || _globals.Credit_by != -1 || _globals.Credit_by1 != -1) {
_eventsManager.VBL();
_graphicsManager.copySurface(_graphicsManager._vesaScreen, 60, 50, 520, 380, _graphicsManager._vesaBuffer, 60, 50);
} else {
_eventsManager.VBL();
}
if (_globals._creditsItem[_globals._creditsLineNumb - 1]._linePosY <= 39) {
_globals._creditsPosY = 440;
++soundId;
if (soundId > 31)
soundId = 28;
_soundManager.WSOUND(soundId);
}
_globals.Credit_bx = -1;
_globals.Credit_bx1 = -1;
_globals.Credit_by = -1;
_globals.Credit_by1 = -1;
} while ((_eventsManager.getMouseButton() != 1) && (!g_system->getEventManager()->shouldQuit()));
_graphicsManager.fadeOutLong();
_globals.iRegul = 1;
_eventsManager._mouseFl = true;
}
void HopkinsEngine::BTOCEAN() {
_fontManager.hideText(9);
if (_eventsManager._mouseCursorId != 16)
return;
_eventsManager.getMouseX();
if (_objectsManager._zoneNum <= 0)
return;
int oldPosX = _eventsManager.getMouseX();
int oldPosY = _eventsManager.getMouseY();
bool displAnim = false;
int oldX;
switch (_objectsManager._zoneNum) {
case 1:
switch (_globals._oceanDirection) {
case 1:
_objectsManager.SPACTION(_globals.PERSO, "27,26,25,24,23,22,21,20,19,18,-1,", 0, 0, 6, false);
break;
case 3:
_objectsManager.SPACTION(_globals.PERSO, "0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,-1,", 0, 0, 6, false);
break;
case 5:
_objectsManager.SPACTION(_globals.PERSO, "9,10,11,12,13,14,15,16,17,18,-1,", 0, 0, 6, false);
break;
}
_globals._oceanDirection = 7;
_globals._exitId = 1;
oldX = _objectsManager.getSpriteX(0);
for (;;) {
if (_globals._speed == 1)
oldX -= 2;
else if (_globals._speed == 2)
oldX -= 4;
else if (_globals._speed == 3)
oldX -= 6;
_objectsManager.setSpriteX(0, oldX);
OCEAN_HOME();
_eventsManager.VBL();
if (_eventsManager.getMouseButton() == 1 && oldPosX == _eventsManager.getMouseX() && _eventsManager.getMouseY() == oldPosY) {
displAnim = true;
break;
}
if (oldX <= -100)
break;
}
break;
case 2:
switch (_globals._oceanDirection) {
case 1:
_objectsManager.SPACTION(_globals.PERSO, "27,28,29,30,31,32,33,34,35,36,-1,", 0, 0, 6, false);
break;
case 5:
_objectsManager.SPACTION(_globals.PERSO, "9,8,7,6,5,4,3,2,1,0,-1,", 0, 0, 6, false);
break;
case 7:
_objectsManager.SPACTION(_globals.PERSO, "18,19,20,21,22,23,24,25,26,27,28,29,30,31,32,33,34,35,36,-1,", 0, 0, 6, false);
break;
}
_globals._oceanDirection = 3;
_globals._exitId = 2;
oldX = _objectsManager.getSpriteX(0);
for (;;) {
if (_globals._speed == 1)
oldX += 2;
else if (_globals._speed == 2)
oldX += 4;
else if (_globals._speed == 3)
oldX += 6;
_objectsManager.setSpriteX(0, oldX);
OCEAN_HOME();
_eventsManager.VBL();
if (_eventsManager.getMouseButton() == 1 && oldPosX == _eventsManager.getMouseX() && _eventsManager.getMouseY() == oldPosY) {
displAnim = true;
break;
}
if (oldX > 499)
break;
}
break;
case 3:
switch (_globals._oceanDirection) {
case 3:
oldX = _objectsManager.getSpriteX(0);
do {
if (_globals._speed == 1)
oldX += 2;
else if (_globals._speed == 2)
oldX += 4;
else if (_globals._speed == 3)
oldX += 6;
_objectsManager.setSpriteX(0, oldX);
OCEAN_HOME();
_eventsManager.VBL();
if (_eventsManager.getMouseButton() == 1 && oldPosX == _eventsManager.getMouseX() && _eventsManager.getMouseY() == oldPosY) {
displAnim = true;
break;
}
} while (oldX <= 235);
if (!displAnim)
_objectsManager.SPACTION(_globals.PERSO, "36,35,34,33,32,31,30,29,28,27,-1,", 0, 0, 6, false);
break;
case 5:
_objectsManager.SPACTION(_globals.PERSO, "9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,-1,", 0, 0, 6, false);
break;
case 7:
oldX = _objectsManager.getSpriteX(0);
do {
if (_globals._speed == 1)
oldX -= 2;
else if (_globals._speed == 2)
oldX -= 4;
else if (_globals._speed == 3)
oldX -= 6;
_objectsManager.setSpriteX(0, oldX);
OCEAN_HOME();
_eventsManager.VBL();
if (_eventsManager.getMouseButton() == 1 && oldPosX == _eventsManager.getMouseX() && _eventsManager.getMouseY() == oldPosY) {
displAnim = true;
break;
}
} while (oldX > 236);
if (!displAnim)
_objectsManager.SPACTION(_globals.PERSO, "18,19,20,21,22,23,24,25,26,27,-1,", 0, 0, 6, false);
break;
}
_globals._oceanDirection = 1;
_globals._exitId = 3;
break;
case 4:
switch (_globals._oceanDirection) {
case 1:
_objectsManager.SPACTION(_globals.PERSO, "27,26,25,24,23,22,21,20,19,18,17,16,15,14,13,12,11,10,9,-1,", 0, 0, 6, false);
break;
case 3:
oldX = _objectsManager.getSpriteX(0);
do {
if (_globals._speed == 1)
oldX += 2;
else if (_globals._speed == 2)
oldX += 4;
else if (_globals._speed == 3)
oldX += 6;
_objectsManager.setSpriteX(0, oldX);
OCEAN_HOME();
_eventsManager.VBL();
if (_eventsManager.getMouseButton() == 1 && oldPosX == _eventsManager.getMouseX() && _eventsManager.getMouseY() == oldPosY) {
displAnim = true;
break;
}
} while (oldX <= 235);
if (!displAnim)
_objectsManager.SPACTION(_globals.PERSO, "0,1,2,3,4,5,6,7,8,9,-1,", 0, 0, 6, false);
break;
case 7:
oldX = _objectsManager.getSpriteX(0);
for (;;) {
if (_globals._speed == 1)
oldX -= 2;
else if (_globals._speed == 2)
oldX -= 4;
else if (_globals._speed == 3)
oldX -= 6;
_objectsManager.setSpriteX(0, oldX);
OCEAN_HOME();
_eventsManager.VBL();
if (_eventsManager.getMouseButton() == 1 && oldPosX == _eventsManager.getMouseX() && _eventsManager.getMouseY() == oldPosY)
break;
if (oldX <= 236) {
if (!displAnim)
_objectsManager.SPACTION(_globals.PERSO, "18,17,16,15,14,13,12,11,10,9,-1,", 0, 0, 6, false);
break;
}
}
break;
}
_globals._oceanDirection = 5;
_globals._exitId = 4;
break;
}
}
void HopkinsEngine::OCEAN_HOME() {
if (_globals._oceanDirection == 3)
_objectsManager.setSpriteIndex(0, 0);
else if (_globals._oceanDirection == 7)
_objectsManager.setSpriteIndex(0, 18);
else if (_globals._oceanDirection == 1)
_objectsManager.setSpriteIndex(0, 27);
else if (_globals._oceanDirection == 5)
_objectsManager.setSpriteIndex(0, 9);
}
void HopkinsEngine::OCEAN(int16 curExitId, Common::String backgroundFilename, int16 defaultDirection, int16 exit1, int16 exit2, int16 exit3, int16 exit4, int16 soundId) {
_globals._cityMapEnabledFl = false;
_graphicsManager._noFadingFl = false;
_globals.NOMARCHE = false;
_globals._exitId = 0;
_globals._disableInventFl = true;
_soundManager.WSOUND(soundId);
_globals.PERSO = _fileManager.loadFile("VAISSEAU.SPR");
if (backgroundFilename.size())
_graphicsManager.loadImage(backgroundFilename);
if (curExitId == 77)
_objectsManager.INILINK("IM77");
else if (curExitId == 84)
_objectsManager.INILINK("IM84");
else if (curExitId == 91)
_objectsManager.INILINK("IM91");
else
_objectsManager.INILINK("ocean");
if (!exit1)
_linesManager.disableZone(1);
if (!exit2)
_linesManager.disableZone(2);
if (!exit3)
_linesManager.disableZone(3);
if (!exit4)
_linesManager.disableZone(4);
if (!_globals._oceanDirection)
_globals._oceanDirection = defaultDirection;
switch (_globals._oceanDirection) {
case 1:
_objectsManager._characterPos.x = 236;
_objectsManager._startSpriteIndex = 27;
break;
case 3:
_objectsManager._characterPos.x = -20;
_objectsManager._startSpriteIndex = 0;
break;
case 5:
_objectsManager._characterPos.x = 236;
_objectsManager._startSpriteIndex = 9;
break;
case 7:
_objectsManager._characterPos.x = 415;
_objectsManager._startSpriteIndex = 18;
break;
}
_objectsManager.addStaticSprite(_globals.PERSO, Common::Point(_objectsManager._characterPos.x, 110), 0, _objectsManager._startSpriteIndex, 0, false, 0, 0);
_graphicsManager.SETCOLOR3(252, 100, 100, 100);
_graphicsManager.SETCOLOR3(253, 100, 100, 100);
_graphicsManager.SETCOLOR3(251, 100, 100, 100);
_graphicsManager.SETCOLOR3(254, 0, 0, 0);
_objectsManager.animateSprite(0);
_linesManager._route = (int16 *)g_PTRNUL;
_eventsManager.mouseOn();
_eventsManager.changeMouseCursor(4);
for (int cpt = 0; cpt <= 4; cpt++)
_eventsManager.VBL();
if (!_graphicsManager._noFadingFl)
_graphicsManager.fadeInLong();
_graphicsManager._noFadingFl = false;
_globals.iRegul = 1;
for (;;) {
int mouseButton = _eventsManager.getMouseButton();
if (mouseButton && mouseButton == 1)
BTOCEAN();
_linesManager.checkZone();
OCEAN_HOME();
_eventsManager.VBL();
if (_globals._exitId || g_system->getEventManager()->shouldQuit())
break;
}
if (_globals._exitId == 1)
_globals._exitId = exit1;
else if (_globals._exitId == 2)
_globals._exitId = exit2;
else if (_globals._exitId == 3)
_globals._exitId = exit3;
else if (_globals._exitId == 4)
_globals._exitId = exit4;
_graphicsManager.fadeOutLong();
_objectsManager.removeSprite(0);
_objectsManager.clearScreen();
_globals.PERSO = _fileManager.loadFile("PERSO.SPR");
_globals.PERSO_TYPE = 0;
}
void HopkinsEngine::syncSoundSettings() {
Engine::syncSoundSettings();
_soundManager.syncSoundSettings();
}
bool HopkinsEngine::displayAdultDisclaimer() {
int xp, yp;
int buttonIndex;
_graphicsManager._minX = 0;
_graphicsManager._minY = 0;
_graphicsManager._maxX = SCREEN_WIDTH;
_graphicsManager._maxY = SCREEN_HEIGHT - 1;
_eventsManager._breakoutFl = false;
_objectsManager._forestFl = false;
_globals._disableInventFl = true;
_globals._exitId = 0;
_graphicsManager.loadImage("ADULT");
_graphicsManager.fadeInLong();
_eventsManager.mouseOn();
_eventsManager.changeMouseCursor(0);
_eventsManager._mouseCursorId = 0;
_eventsManager._mouseSpriteId = 0;
do {
xp = _eventsManager.getMouseX();
yp = _eventsManager.getMouseY();
buttonIndex = 0;
if (xp >= 37 && xp <= 169 && yp >= 406 && yp <= 445)
buttonIndex = 2;
else if (xp >= 424 && xp <= 602 && yp >= 406 && yp <= 445)
buttonIndex = 1;
_eventsManager.VBL();
} while (!shouldQuit() && (buttonIndex == 0 || _eventsManager.getMouseButton() != 1));
_globals._disableInventFl = false;
_graphicsManager.fadeOutLong();
if (buttonIndex != 2) {
// Quit game
return false;
} else {
// Continue
_graphicsManager._minX = 0;
_graphicsManager._maxY = 20;
_graphicsManager._maxX = SCREEN_WIDTH;
_graphicsManager._maxY = SCREEN_HEIGHT - 20;
return true;
}
}
} // End of namespace Hopkins
|