432
|
1 |
#summary Short description of the file format of hand-drawn maps
|
|
2 |
|
748
|
3 |
= Hand-drawn maps =
|
666
|
4 |
== Introduction ==
|
|
5 |
Hand-drawn maps are maps which are created by the player using the in-game map editor.
|
|
6 |
|
2113
|
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 |
|
1621
|
10 |
== File format (outdated) ==
|
|
11 |
*NOTE*: This section is outdated.
|
|
12 |
|
2113
|
13 |
The raw format is defines as follows:
|
666
|
14 |
|
2113
|
15 |
A drawn map is described by a sequence of points, which define polylines to draw and format of each polyline.
|
226
|
16 |
|
2113
|
17 |
A point is defined as
|
226
|
18 |
|| Big-endian int16 || Big-endian int16 || Byte ||
|
|
19 |
|| *X* coordinate || *Y* coordinate || *flags* ||
|
|
20 |
|
|
21 |
where *flags* are:
|
|
22 |
|| 8th bit || 7th bit || 6th-1st bits ||
|
2113
|
23 |
|| if set, this is a first point of polyline (“start” bit) || if set, polyline is erasing || *width* (thickness) of line ||
|
226
|
24 |
|
1222
|
25 |
… where *width* defines `(width * 10) + 6` pixels width line to draw.
|
226
|
26 |
|
1222
|
27 |
Second and further points of polyline have 8th bit of *flags* unset, the content of others are ignored for those.
|
226
|
28 |
|
2113
|
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].
|
666
|
34 |
|
|
35 |
== Sharing hand-drawn maps ==
|
|
36 |
Hand-drawn maps will be automatically transferred when playing online.
|
|
37 |
|
1681
|
38 |
But if you wish you can still share your creations in the [https://www.hedgewars.org/node/2849 Hand-Drawn Maps Submission Thread].
|