This little tool converts
Quake's .bsp to
Wrack's .map format.
The converter includes geometry, entity and texture conversion.
Entity and texture references can be found in two separate text files.
So far I've only done Quake's shareware textures, you'll have to add licensed and custom textures yourself.
This looks awfully familiar.
The first step is to dissect Quake's level format. Thankfully this format was published centuries ago and can be found
here. The converter will break down every vertex, brush, and entity. Now we have a collection of data we'd like to convert to Wrack's level format.
Wrack's level format had to be reverse engineered. It's not completely documented yet, but below is a table of all the relevant data required for the converter. Keep note that Wrack strings use a 2-byte prefix indicating its length and is then followed by that number of characters.
| uint32_t | magic_number | MMAP |
| uint32_t | map_version | 25 |
| wrack_string_t | map_name | |
| wrack_string_t | storyboard_name | |
| wrack_string_t | skybox_name | |
| wrack_string_t | next_map_name | |
| uint16_t | par_time | |
| uint32_t | par_score | |
| uint16_t | quickplay_order | |
| wrack_string_t | author_name | |
| wrack_string_t | music_file_name | |
| wrack_string_t | boss_music_file_name | |
| wrack_string_t | ambient_sound_file_name | |
| float | ambient_sound_volume | |
| boolean | is_fog_enabled | |
| uint32_t | rgba_fog_colour | Alpha is unused |
| float | fog_start | |
| float | fog_end | |
| uint32_t | map_flags | |
| uint32_t | vertex_count | |
| uint32_t | face_count | |
| uint32_t | zone_count | |
| uint32_t | ground_count | |
| uint32_t | thing_count | |
Next up is all the vertex data. Wrack vertices are all stored sequentially as 22-byte structs.
The number of vertices stored is based on the vertex count variable found in the header, so you're gonna have to iterate through these.
| int16_t | x | |
| int16_t | y | |
| int16_t | z | |
| float | texture_coord_u | |
| float | texture_coord_v | |
| float | lightmap_coord_u | |
| float | lightmap_coord_v | |
After vertices comes the face data. A Wrack face is a collection of vertices that form a polygon.
Just like vertices, these are stored sequentially and must be iterated through.
| uint32_t | vertex_count | |
| uint32_t* | vertex_index | One index for every vertex |
| uint32_t | face_flags | |
| wrack_string_t | texture_file_name | |
| float | texture_rotation | |
| float | texture_x_scale | |
| float | texture_y_scale | |
| float | texture_x_offset | |
| float | texture_y_offset | |
| boolean | is_texture_x_flipped | |
| boolean | is_texture_y_flipped | |
| uint8_t | texture_plane_type | |
| uint8_t | light | |
| uint32_t | rgba_light_colour | |
| float | friction | |
| uint32_t | unknown_1 | Unknown |
| wrack_string_t | action | |
| uint8_t | activation_type | |
| uint8_t | activated_by | |
| uint8_t | tag | |
| uint8_t | unknown_2 | Unknown |
| wrack_string_t | argument_1 | |
| wrack_string_t | argument_2 | |
| wrack_string_t | argument_3 | |
| wrack_string_t | argument_4 | |
| wrack_string_t | argument_5 | |
| uint32_t | fx_flags | |
| uint32_t | rgba_fog_colour | Actually saved as BGRA |
| float | fx_start | |
| float | fx_end | |
Whew, that was a big one. Up next are non-geometry data collections. The converter currently does nothing with these and just writes 20 empty bytes, so it's up to you whether to use it or not.
| uint32_t | face_count | |
| uint32_t* | face_index | One index for every face |
| uint16_t | type | |
| uint16_t | tag | |
And the other one.
| uint32_t | face_count | |
| uint32_t* | face_index | One index for every face |
Now back to some more interesting data: things. In the Wrack universe a thing is an entity in the world, like a monster or weapon. Just like vertices, faces, zones and groups, these must be stored
sequentially.
| wrack_string_t | name | |
| wrack_string_t | data | Unknown behaviour |
As you can see the serialisable data string for things hasn't been figured out yet. It's best to just keep it empty since Wrack is sufficient with the thing name alone.
Up next comes a big collection of map scripts, collision data, lightmap information, etc. We'll just let the level editor take care of this, so just write 5 empty bytes to finish it off.
The converter is not perfect. For example, Quake uses more precise coordinates for its vertices, causing some broken vertices and faces in Wrack.
Somehow there's also some convex shapes that are allowed in Quake, but not in Wrack. You'll have to fix these faces manually through WrackEd, Wrack's level editor.
This tool only converts geometry, entities and textures.
Logic behind doors, buttons, spawners, etc. are ignored.
It will also only work for Quake .bsp files. Quake II, Half-Life, and other games that use the same format are not supported.
A cool thing you can do is define the entity and texture conversion.
By editing EntityList and TextureList you decide what you're converting.
You could change all Quake Zombies into Wrack Bazookas if you want to.
Below is a download link if you'd like to give it a whirl.
Download Quake2Wrack
Source code
And here are Steam workshop items for Wrack made with Quake2Wrack and its predecessor.
Back