map file addons: embedded config file; persistent undo/redo data

This commit establishes an extensible way of storing additional data in
map file headers. Those header extras can be permanent, like the embedded
config file or be used only once after map load like the undo/redo data.

Additional extra data can be easily added and will not break backward
compatibility, so this map format should hold up for quite some time.

To make things easier for mappers, maps can now be saved without invoking
the various optimisations. That, in combination with the stored undo data,
means, that editing a map can be picked up at exactly the same state, as
the map was saved in.

Maps will automatically be written in the appropriate fashion, depending
on the situation:
 1) for sendmap: no optimisation, no undo data
 2) savemap during editing: no optimisation, with undo data
 3) savemap when not editing: optimised, no undo data
 4) savemapoptimised: optimised, no undo data
(For savemap to save different maps during editing, the variable
 preserveundosonsave has to be "1". It is "0" by default.)

All of the above map files can be played without problems - they only
differ in file size. (However, maps with undo data may be too big to send)

The new command "embedconfigfile" will load the config file, include it in
the map header and rename the original text file.

"extractconfigfile" will write an embedded config file to a separate file
and remove it from the map header.

Embedded config files take precedence over regular config files and
therefore make it harder for cheaters to play with modified config files.

further changes: cleaned up some debugging code; more ASSERTs
This commit is contained in:
ac-stef
2014-05-15 16:07:52 +02:00
parent f4a4b843de
commit d3bda71212
9 changed files with 281 additions and 39 deletions
+1 -3
View File
@@ -8,8 +8,6 @@ sqr *world = NULL;
int sfactor, ssize, cubicsize, mipsize;
header hdr;
uchar *headerextra = NULL;
int headerextrasize;
// main geometric mipmapping routine, recursively rebuild mipmaps within block b.
// tries to produce cube out of 4 lower level mips as well as possible,
@@ -501,7 +499,7 @@ bool empty_world(int factor, bool force) // main empty world creation routine
ents.shrink(0);
block b = { 8, 8, ssize-16, ssize - 16};
edittypexy(SPACE, b);
DELETEA(headerextra);
clearheaderextras();
}
strncpy(hdr.head, "ACMP", 4);
hdr.version = MAPVERSION;