Difference between revisions of "Elma 2/Technical"
(→Levels) |
|||
Line 130: | Line 130: | ||
| style="text-align:right;" | ? || ? || style="text-align:right;" | (1+168)*x || <div style="color:red;">?.text:00415B44 Possibly pathing info related - probably the visuals of the platform</div> | | style="text-align:right;" | ? || ? || style="text-align:right;" | (1+168)*x || <div style="color:red;">?.text:00415B44 Possibly pathing info related - probably the visuals of the platform</div> | ||
|- | |- | ||
− | | style="text-align:right;" | | + | | style="text-align:right;" | 16+72*n || byte || style="text-align:right;" | 1 || 1=Beginning of a platform-drawing object. 0=No platform-drawing objects |
+ | |- | ||
+ | | style="text-align:right;" | ? || [[Elma2/Technical#Platform-Drawing Object|platdraw]] || style="text-align:right;" | ? || Sequential list of all platform-drawing objects, as long as previous byte is 1 | ||
|- | |- | ||
|} | |} |
Revision as of 01:27, 17 December 2017
Levels
How to parse a level byte by byte. Remember little-endianess.
WIP
Polygon objects are oriented so for y, up is negative and down is positive. Line objects are inverted so for y, up is positive and down is negative.
Main .lev Structure
Offset | Type | Bytes | Description |
---|---|---|---|
0 | char[5] | 5 | "POT35" for Elma 2 levels |
5 | int | 4 | 30 if unlocked level, 0 if locked level. Otherwise, assertion error |
9 | short | 2 | 1 if topology error, 0 if no topology error. |
11 | int | 4 | 1 if start out facing right (autoturn at level start) |
15 | char[51] | 51 | Unused: Level name/description. "Unnamed". Unused but can be hex-edited |
66 | char[16] | 16 | LGR name. Unchangeable except by hex edit. Always "default" |
82 | char[10] | 10 | Unused: Ground texture name. Unused. Value always overwritten to "texturea" on save. If missing on open, defaults as "ground" |
92 | char[10] | 10 | Unused: Sky texture name. Unused. Value always overwritten to "qgrass" on save. If missing on open, defaults as "sky" |
102 | byte[20] | 20 | Unused: ? Appears to be useless. Can be hex-edited |
122 | int | 4 | Shareware check. Shareware editor always saves this value as 115. Shareware game cannot open any number greater than 120. Full game is probably 135 but to confirm with real game version |
126 | double | 8 | Number of polygons + 0.4643643. Maximum 2000. |
134 | polygon | ? | Sequential list of polygons with data. "Raw" data for editor purposes |
? | compile | ? | Only exists if no topology error, otherwise this object is skipped. "Processed" data for when you actually open a level. |
? | byte | 1 | 0x2B |
? | int | 1 | dec: 192356446 (0x0B77205Eh) |
? | double | 8 | Number of objects + 0.4643643. Maximum 500. |
? | object | ? | Sequential list of objects |
? | double | 8 | Number of pictures + 0.2345672. Maximum 5000. |
? | picture | ? | Sequential list of pictures |
Polygon
Orientation: positive y is down. These polygons are edited by the editor. The editor uses this info to generate Line Objects
Offset | Type | Bytes | Description |
---|---|---|---|
0 | int | 4 | Type: 1=Normal, 2=Inactive, 3=Platform, 4=Path, 5=Autogenerated Border Polygon |
4 | int | 4 | Path Subtype: Door=1, Elevator=2, Falling=3, Continuous Oneway=4, Continuous Twoway=5 |
8 | int | 4 | Platform's Platform ID or Path's Path ID: 0-999 |
12 | int | 4 | Path's Platform ID: 0-999 |
16 | int | 4 | Path's Speed at top |
20 | int | 4 | Path's Speed at bottom |
24 | int | 4 | Path's Open delay |
28 | int | 4 | Path's Close delay |
32 | int | 4 | Path's ReOpen delay |
36 | int | 4 | Path's ReClose delay |
40 | int | 4 | Path's Initially flag: 1=Up, 0=Down |
44 | int | 4 | Path's No of platforms |
48 | int | 4 | Override flag: 1=Polygon interacts with biker |
52 | int | 4 | Style index |
56 | int | 4 | Override flag: 1=Border on |
60 | int | 4 | Override flag: 1=Border off |
64 | int | 4 | Override flag: 1=Whole polygon border colored |
68 | int | 4 | Distance |
72 | int | 4 | Probably always 0. Probably not important as not included in Balazs' debug file (0040F1FB) |
76 | byte[300] | 300 | Probably just padding |
376 | int | 4 | Number of vertices |
380 | vertex (double * 2)[?] | vertices * 16 | X and Y as two doubles. |
Compile Object
Offset | Type | Bytes | Description |
---|---|---|---|
0 | int | 4 | n: Total number of vertices across all polygons of type 1 + 5 only. |
4 | line*n | 72*n | Sequential list of n line objects |
4+72*n | double | 8 | ? value of 60.0 - no effect when hex edited |
12+72*n | int | 4 | Random number based on current time. SIGNED integer; crashes if negative number |
16+72*n | byte | 1 | 1=Beginning of a platform object. 0=No platforms |
? | platform | ? | Sequential list of all platform objects, as long as previous byte is 1 |
? | byte | 1 | 0x58h |
? | double? |
8 | ? -406.64166666666665 |
? | double? |
8 | ? -74.99166666666666 |
? | ? | (1+168)*x | ?.text:00415B44 Possibly pathing info related - probably the visuals of the platform
|
16+72*n | byte | 1 | 1=Beginning of a platform-drawing object. 0=No platform-drawing objects |
? | platdraw | ? | Sequential list of all platform-drawing objects, as long as previous byte is 1 |
Line Object
Orientation: positive y is up. Each line object is used by the game to draw on the screen and to make lines solid/non-solid.
Offset | Type | Bytes | Description |
---|---|---|---|
0 | double | 8 | a: Vertex's x |
8 | double | 8 | b: (-1)*Vertex's y |
16 | double | 8 | c: Delta x to reach the next vertex |
24 | double | 8 | d: (-1)*Delta y to reach the next vertex |
32 | double | 8 | e: Delta x to move one unit towards the next vertex - c/g - 1=sqrt(e^2+f^2) |
40 | double | 8 | f: Delta y to move one unit towards the next vertex - d/g - 1=sqrt(e^2+f^2) |
48 | double | 8 | g: Line length - sqrt(c^2+d^2) |
56 | int | 4 | Texture ID (draws to right of the line) |
60 | int | 4 | 0 if solid, 1 if cannot touch |
64 | int | 4 | Distance (border polygons copy base polygon distance) |
68 | int | 4 | Do not draw to the right of the line if = 1 (equivalent to texture id of 0), otherwise draw texture. Not sure if actually used by the default editor but that's what editing this value does |
Object Object
Offset | Type | Bytes | Description |
---|---|---|---|
0 | double | 8 | x |
8 | double | 8 | y |
16 | int | 4 | Type:
1=Flower 2=Food 3=Killer 4=Start 5=Bonus 6=Card 7=Switch 8=Group switch 9=Platform reference (10="stage") - internal error (11="fordit") "turn" - no object appears ingame (12="ugrat") "jump" - black square with no effect 13=Teleport |
20 | int | 4 | Group id |
24 | int | 4 | Condition 2 Path id |
28 | int | 4 | Opener/Closer: 1=A, 0=B |
32 | int | 4 | Card color: 0=None, 1=Red, 2=Yellow, 3=Blue |
36 | int | 4 | Condition 2 State: 1=Up, 0=Down |
40 | int | 4 | Platform id |
44 | byte[300] | 300 | Padding |
Picture Object
Same as in elma1
Offset | Type | Bytes | Description |
---|---|---|---|
0 | string | 10 | Picture name |
10 | string | 10 | Unused: Texture name |
20 | string | 10 | Unused: Mask name |
30 | double | 8 | X |
38 | double | 8 | Y |
46 | int | 4 | Distance |
50 | int | 4 | Clipping; 0=U, 1=G, 2=S |
Platform Object
This contains info about the lines in a platform for the purposes of collision
Offset | Type | Bytes | Description |
---|---|---|---|
30 | double | 8 | 0 - x_min(2)-0.0500000 |
30 | double | 8 | 1 - y_min(3)-0.0500000 |
30 | double | 8 | 2 - x_min of all point.y-platform_reference_object.y |
30 | double | 8 | 3 - y_min of all point.y-platform_reference_object.y |
30 | double | 8 | 4 - x_max of all point.x-platform_reference_object.x |
30 | double | 8 | 5 - y_max of all point.y-platform_reference_object.y |
30 | double | 8 | 6 - x_min(2)-0.3300000 |
30 | double | 8 | 7 - y_min(3)-0.3300000 |
30 | double | 8 | 8 - same as 2 |
30 | double | 8 | 9 - same as 3 |
30 | double | 8 | 10 - same as 4 |
30 | double | 8 | 11 - same as 5 |
30 | double | 8 | 12 - Platform reference object X |
38 | double | 8 | 13 - Platform reference object Y |
46 | int | 4 | 0 - Width of the polygon image probably |
46 | int | 4 | 1 - Height of the polygon image probably |
46 | int | 4 | 2 - ?Approximately width/6 |
46 | int | 4 | 3 - ?Approximately height/6 |
46 | int | 4 | 4 - Platform ID of the set |
46 | int | 4 | 5 - ? defaults to 0 |
46 | int | 4 | 6 - ? defaults to 0 |
46 | int | 4 | 7 - ? defaults to 0 |
46 | int | 4 | 8 - ? defaults to 0 |
46 | int | 4 | 9 - ? defaults to 0 |
46 | int | 4 | 10 - ? defaults to 0 |
46 | int | 4 | 11 - ? defaults to 0 |
46 | int | 4 | 12 - Texture id of center part |
46 | int | 4 | 13 - Texture id of border |
46 | int | 4 | 14 - ? defaults to large number |
46 | int | 4 | 15 - ? defaults to 0 |
46 | int | 4 | 16 - Number of vertices of all polygons belonging to the same platform, excluding non-solid vertices/lines. |
4 | line*n | 72*n | Sequential list of n line objects. Note that the 4 int variables are ignored and set to 0. The position of these line objects describe the platform's initial position based on the platform reference object, ignoring the path. This data is only used for to make the platforms solid and is not used to draw the platforms. |
30 | byte | 1 | 1=Beginning of another platform object. 0=No more platforms to read |
Data
Texture IDs
Many more ids exist - these are just some examples. Would be better to extract all the images somewhere instead of manually verifying numbers.
Id | Texture |
---|---|
0 | Do not draw |
10 | Default Border (solid medium-colored beige) |
100 | Default ground (sandy rocks) |
102 | Platform texture (striped blue) |
104 | Platform border (dark blue) |
105 | Solid dark green |
.mif
Offset | Type | Bytes | Description |
---|