Decoded: Sopwith (1984) by David L. Clark
Source file: SWGROUND.C
Beginner friendly, line-by-line code walkthrough by MaiZure

SWGROUND.C contains a giant array that defines the heightmap of the 3000 pixel
world in Sopwith.

Original code:
http://davidlclark.com/page/sopwith-source-code

Original code with line numbers
http://www.maizure.org/projects/decoded-sopwith/SWGROUND_linenum.txt


1     COMMENT
2     COMMENT
3     BLANK
4     COMMENT
5     COMMENT
6     COMMENT
7     COMMENT
8     COMMENT
9     COMMENT
10    COMMENT
11    COMMENT
12    COMMENT
13    COMMENT
14    BLANK
15    COMMENT
16    BLANK
17    COMMENT
18    COMMENT
19    COMMENT
20    COMMENT
21    COMMENT
22    COMMENT
23    Includes the main game header (sw.h)
24    BLANK
25    BLANK
26    Defines a 3000 byte unsigned integer array to hold the initial ground
      height map
27    BLANK
28    Defines bytes 0 to 15 of the world map height
29    Defines bytes 16 to 31 of the world map height
30    Defines bytes 32 to 47 of the world map height
31    Defines bytes 48 to 63 of the world map height
32    Defines bytes 64 to 79 of the world map height
33    Defines bytes 80 to 95 of the world map height
34    Defines bytes 96 to 111 of the world map height
35    Defines bytes 112 to 127 of the world map height
36    Defines bytes 128 to 143 of the world map height
37    Defines bytes 144 to 159 of the world map height
38    Defines bytes 160 to 175 of the world map height
39    Defines bytes 176 to 191 of the world map height
40    Defines bytes 192 to 207 of the world map height
41    Defines bytes 208 to 223 of the world map height
42    Defines bytes 224 to 239 of the world map height
43    Defines bytes 240 to 255 of the world map height
44    Defines bytes 256 to 271 of the world map height
45    Defines bytes 272 to 287 of the world map height
46    Defines bytes 288 to 303 of the world map height
47    Defines bytes 304 to 319 of the world map height
48    Defines bytes 320 to 335 of the world map height
49    Defines bytes 336 to 351 of the world map height
50    Defines bytes 352 to 367 of the world map height
51    Defines bytes 368 to 383 of the world map height
52    Defines bytes 384 to 399 of the world map height
53    Defines bytes 400 to 415 of the world map height
54    Defines bytes 416 to 431 of the world map height
55    Defines bytes 432 to 447 of the world map height
56    Defines bytes 448 to 463 of the world map height
57    Defines bytes 464 to 479 of the world map height
58    Defines bytes 480 to 495 of the world map height
59    Defines bytes 496 to 511 of the world map height
60    Defines bytes 512 to 527 of the world map height
61    Defines bytes 528 to 543 of the world map height
62    Defines bytes 544 to 559 of the world map height
63    Defines bytes 560 to 575 of the world map height
64    Defines bytes 576 to 591 of the world map height. Computer starts here
65    Defines bytes 592 to 607 of the world map height
66    Defines bytes 608 to 623 of the world map height
67    Defines bytes 624 to 639 of the world map height
68    Defines bytes 640 to 655 of the world map height
69    Defines bytes 656 to 671 of the world map height
70    Defines bytes 672 to 687 of the world map height
71    Defines bytes 688 to 703 of the world map height
72    Defines bytes 704 to 719 of the world map height
73    Defines bytes 720 to 735 of the world map height
74    Defines bytes 736 to 751 of the world map height
75    Defines bytes 752 to 767 of the world map height
76    Defines bytes 768 to 783 of the world map height
77    Defines bytes 784 to 799 of the world map height
78    Defines bytes 800 to 815 of the world map height
79    Defines bytes 816 to 831 of the world map height
80    Defines bytes 832 to 847 of the world map height
81    Defines bytes 848 to 863 of the world map height
82    Defines bytes 864 to 879 of the world map height
83    Defines bytes 880 to 895 of the world map height
84    Defines bytes 896 to 911 of the world map height
85    Defines bytes 912 to 927 of the world map height
86    Defines bytes 928 to 943 of the world map height
87    Defines bytes 944 to 959 of the world map height
88    Defines bytes 960 to 975 of the world map height
89    Defines bytes 976 to 991 of the world map height
90    Defines bytes 992 to 1007 of the world map height
91    Defines bytes 1008 to 1023 of the world map height
92    Defines bytes 1024 to 1039 of the world map height
93    Defines bytes 1040 to 1055 of the world map height
94    Defines bytes 1056 to 1071 of the world map height
95    Defines bytes 1072 to 1087 of the world map height
96    Defines bytes 1088 to 1103 of the world map height
97    Defines bytes 1104 to 1119 of the world map height
98    Defines bytes 1120 to 1135 of the world map height
99    Defines bytes 1136 to 1151 of the world map height
100   Defines bytes 1152 to 1167 of the world map height
101   Defines bytes 1168 to 1183 of the world map height
102   Defines bytes 1184 to 1199 of the world map height
103   Defines bytes 1200 to 1215 of the world map height
104   Defines bytes 1216 to 1231 of the world map height
105   Defines bytes 1232 to 1247 of the world map height
106   Defines bytes 1248 to 1263 of the world map height
107   Defines bytes 1264 to 1279 of the world map height. Player starts here
108   Defines bytes 1280 to 1295 of the world map height
109   Defines bytes 1296 to 1311 of the world map height
110   Defines bytes 1312 to 1327 of the world map height
111   Defines bytes 1328 to 1343 of the world map height
112   Defines bytes 1344 to 1359 of the world map height
113   Defines bytes 1360 to 1375 of the world map height
114   Defines bytes 1376 to 1391 of the world map height
115   Defines bytes 1392 to 1407 of the world map height
116   Defines bytes 1408 to 1423 of the world map height
117   Defines bytes 1424 to 1439 of the world map height
118   Defines bytes 1440 to 1455 of the world map height
119   Defines bytes 1456 to 1471 of the world map height
120   Defines bytes 1472 to 1487 of the world map height
121   Defines bytes 1488 to 1503 of the world map height
122   Defines bytes 1504 to 1519 of the world map height
123   Defines bytes 1520 to 1535 of the world map height
124   Defines bytes 1536 to 1551 of the world map height
125   Defines bytes 1552 to 1567 of the world map height
126   Defines bytes 1568 to 1583 of the world map height
127   Defines bytes 1584 to 1599 of the world map height
128   Defines bytes 1600 to 1615 of the world map height
129   Defines bytes 1616 to 1631 of the world map height
130   Defines bytes 1632 to 1647 of the world map height
131   Defines bytes 1648 to 1663 of the world map height
132   Defines bytes 1664 to 1679 of the world map height
133   Defines bytes 1680 to 1695 of the world map height
134   Defines bytes 1696 to 1711 of the world map height
135   Defines bytes 1712 to 1727 of the world map height. Computer starts here
136   Defines bytes 1728 to 1743 of the world map height
137   Defines bytes 1744 to 1759 of the world map height
138   Defines bytes 1760 to 1775 of the world map height
139   Defines bytes 1776 to 1791 of the world map height
140   Defines bytes 1792 to 1807 of the world map height
141   Defines bytes 1808 to 1823 of the world map height
142   Defines bytes 1824 to 1839 of the world map height
143   Defines bytes 1840 to 1855 of the world map height
144   Defines bytes 1856 to 1871 of the world map height
145   Defines bytes 1872 to 1887 of the world map height
146   Defines bytes 1888 to 1903 of the world map height
147   Defines bytes 1904 to 1919 of the world map height
148   Defines bytes 1920 to 1935 of the world map height
149   Defines bytes 1936 to 1951 of the world map height
150   Defines bytes 1952 to 1967 of the world map height
151   Defines bytes 1968 to 1983 of the world map height
152   Defines bytes 1984 to 1999 of the world map height
153   Defines bytes 2000 to 2015 of the world map height
154   Defines bytes 2016 to 2031 of the world map height
155   Defines bytes 2032 to 2047 of the world map height
156   Defines bytes 2048 to 2063 of the world map height
157   Defines bytes 2064 to 2079 of the world map height
158   Defines bytes 2080 to 2095 of the world map height
159   Defines bytes 2096 to 2111 of the world map height
160   Defines bytes 2112 to 2127 of the world map height
161   Defines bytes 2128 to 2143 of the world map height
162   Defines bytes 2144 to 2159 of the world map height
163   Defines bytes 2160 to 2175 of the world map height
164   Defines bytes 2176 to 2191 of the world map height
165   Defines bytes 2192 to 2207 of the world map height
166   Defines bytes 2208 to 2223 of the world map height
167   Defines bytes 2224 to 2239 of the world map height
168   Defines bytes 2240 to 2255 of the world map height
169   Defines bytes 2256 to 2271 of the world map height
170   Defines bytes 2272 to 2287 of the world map height
171   Defines bytes 2288 to 2303 of the world map height
172   Defines bytes 2304 to 2319 of the world map height
173   Defines bytes 2320 to 2335 of the world map height
174   Defines bytes 2336 to 2351 of the world map height
175   Defines bytes 2352 to 2367 of the world map height
176   Defines bytes 2368 to 2383 of the world map height
177   Defines bytes 2384 to 2399 of the world map height
178   Defines bytes 2400 to 2415 of the world map height
179   Defines bytes 2416 to 2431 of the world map height
180   Defines bytes 2432 to 2447 of the world map height
181   Defines bytes 2448 to 2463 of the world map height. Computer starts here
182   Defines bytes 2464 to 2479 of the world map height
183   Defines bytes 2480 to 2495 of the world map height
184   Defines bytes 2496 to 2511 of the world map height
185   Defines bytes 2512 to 2527 of the world map height
186   Defines bytes 2528 to 2543 of the world map height
187   Defines bytes 2544 to 2559 of the world map height
188   Defines bytes 2560 to 2575 of the world map height
189   Defines bytes 2576 to 2591 of the world map height
190   Defines bytes 2592 to 2607 of the world map height
191   Defines bytes 2608 to 2623 of the world map height
192   Defines bytes 2624 to 2639 of the world map height
193   Defines bytes 2640 to 2655 of the world map height
194   Defines bytes 2656 to 2671 of the world map height
195   Defines bytes 2672 to 2687 of the world map height
196   Defines bytes 2688 to 2703 of the world map height
197   Defines bytes 2704 to 2719 of the world map height
198   Defines bytes 2720 to 2735 of the world map height
199   Defines bytes 2736 to 2751 of the world map height
200   Defines bytes 2752 to 2767 of the world map height
201   Defines bytes 2768 to 2783 of the world map height
202   Defines bytes 2784 to 2799 of the world map height
203   Defines bytes 2800 to 2815 of the world map height
204   Defines bytes 2816 to 2831 of the world map height
205   Defines bytes 2832 to 2847 of the world map height
206   Defines bytes 2848 to 2863 of the world map height
207   Defines bytes 2864 to 2879 of the world map height
208   Defines bytes 2880 to 2895 of the world map height
209   Defines bytes 2896 to 2911 of the world map height
210   Defines bytes 2912 to 2927 of the world map height
211   Defines bytes 2928 to 2943 of the world map height
212   Defines bytes 2944 to 2959 of the world map height
213   Defines bytes 2960 to 2975 of the world map height
214   Defines bytes 2976 to 2991 of the world map height
215   Defines bytes 2992 to 3007 of the world map height
216   End of ground height definition
217   BLANK
218   BLANK
219   Defines the another array of the ground type that holds the current heightmap
      during gameplay
220   EOF