| 82 | } |
| 83 | |
| 84 | header *peekmapheader(uchar *data, int len) // extract the header from an in-memory mapfile (doesn't process all values: only used to get the map revision and timestamp) |
| 85 | { |
| 86 | static header h; |
| 87 | uLongf rawsize = (int)sizeof(header); |
| 88 | if(uncompress((Bytef*)&h, &rawsize, data, len) == Z_BUF_ERROR && (!strncmp(h.head, "CUBE", 4) || !strncmp(h.head, "ACMP",4))) |
| 89 | { |
| 90 | lilswap(&h.version, 4); // version, headersize, sfactor, numents |
| 91 | if(h.version < 4) memset(&h.waterlevel, 0, sizeof(int) * 16); |
| 92 | else lilswap(&h.maprevision, 4); // maprevision, ambient, flags, timestamp |
| 93 | return &h; |
| 94 | } |
| 95 | return NULL; |
| 96 | } |
| 97 | |
| 98 | // map geometry statistics |
| 99 | |