2 |
2 |
3 = Hand-drawn maps = |
3 = Hand-drawn maps = |
4 == Introduction == |
4 == Introduction == |
5 Hand-drawn maps are maps which are created by the player using the in-game map editor. |
5 Hand-drawn maps are maps which are created by the player using the in-game map editor. |
6 |
6 |
|
7 == File storage == |
|
8 Hand-drawn maps are saved with a file name suffix of “.hwmap”. By default, drawn maps are stored in a directory called “DrawnMaps” in the user directory, but the player could choose any location. |
|
9 |
7 == File format (outdated) == |
10 == File format (outdated) == |
8 *NOTE*: This section is outdated. |
11 *NOTE*: This section is outdated. |
9 |
12 |
10 Hand-drawn maps are saved with a file name suffix of “.hwmap”. By default, drawn maps are stored in a directory called “DrawnMaps” in the user directory, but the player could choose any location. |
13 The raw format is defines as follows: |
11 |
14 |
12 Drawn map is described by a list of points, which define polylines to draw and format of each polyline. |
15 A drawn map is described by a sequence of points, which define polylines to draw and format of each polyline. |
13 |
16 |
14 Point is defined as |
17 A point is defined as |
15 || Big-endian int16 || Big-endian int16 || Byte || |
18 || Big-endian int16 || Big-endian int16 || Byte || |
16 || *X* coordinate || *Y* coordinate || *flags* || |
19 || *X* coordinate || *Y* coordinate || *flags* || |
17 |
20 |
18 where *flags* are: |
21 where *flags* are: |
19 || 8th bit || 7th bit || 6th-1st bits || |
22 || 8th bit || 7th bit || 6th-1st bits || |
20 || if set, this is a first point of polyline || if set, polyline is erasing || *width* (thickness) of line || |
23 || if set, this is a first point of polyline (“start” bit) || if set, polyline is erasing || *width* (thickness) of line || |
21 |
24 |
22 … where *width* defines `(width * 10) + 6` pixels width line to draw. |
25 … where *width* defines `(width * 10) + 6` pixels width line to draw. |
23 |
26 |
24 Second and further points of polyline have 8th bit of *flags* unset, the content of others are ignored for those. |
27 Second and further points of polyline have 8th bit of *flags* unset, the content of others are ignored for those. |
25 |
28 |
26 A single-point polyline defines a circle. |
29 A polyline begins when a point with the 8th bit in flags was set. Subsequent points will extend the line as long the “start” bit of those is not set. A new line starts when another point appears with the “start” bit being set. A single-point polyline defines a circle. |
|
30 |
|
31 === Compression === |
|
32 |
|
33 Above description describes the raw data, but the final file will be changed. The raw data is first base64-encoded and then compressed with [https://doc.qt.io/qt-5/qbytearray.html#qCompress Qt's `qCompress` function]. |
27 |
34 |
28 == Sharing hand-drawn maps == |
35 == Sharing hand-drawn maps == |
29 Hand-drawn maps will be automatically transferred when playing online. |
36 Hand-drawn maps will be automatically transferred when playing online. |
30 |
37 |
31 But if you wish you can still share your creations in the [https://www.hedgewars.org/node/2849 Hand-Drawn Maps Submission Thread]. |
38 But if you wish you can still share your creations in the [https://www.hedgewars.org/node/2849 Hand-Drawn Maps Submission Thread]. |