Update fmt lib, add recast, wip on recast pathfinder interface (broken atm)

This commit is contained in:
KimLS
2017-07-29 00:11:57 -07:00
parent 7d3f35d48b
commit 80f1c65e1c
68 changed files with 2560 additions and 1662 deletions
+2 -78
View File
@@ -1,5 +1,6 @@
#include "../common/global_define.h"
#include "../common/misc_functions.h"
#include "../common/compression.h"
#include "map.h"
#include "raycast_mesh.h"
@@ -10,83 +11,6 @@
#include <memory>
#include <tuple>
#include <vector>
#include <zlib.h>
uint32 EstimateDeflateBuffer(uint32_t len) {
z_stream zstream;
memset(&zstream, 0, sizeof(zstream));
zstream.zalloc = Z_NULL;
zstream.zfree = Z_NULL;
zstream.opaque = Z_NULL;
if (deflateInit(&zstream, Z_FINISH) != Z_OK)
return 0;
return deflateBound(&zstream, len);
}
uint32_t DeflateData(const char *buffer, uint32_t len, char *out_buffer, uint32_t out_len_max) {
z_stream zstream;
memset(&zstream, 0, sizeof(zstream));
int zerror;
zstream.next_in = const_cast<unsigned char*>(reinterpret_cast<const unsigned char*>(buffer));
zstream.avail_in = len;
zstream.zalloc = Z_NULL;
zstream.zfree = Z_NULL;
zstream.opaque = Z_NULL;
deflateInit(&zstream, Z_FINISH);
zstream.next_out = reinterpret_cast<unsigned char*>(out_buffer);
zstream.avail_out = out_len_max;
zerror = deflate(&zstream, Z_FINISH);
if (zerror == Z_STREAM_END)
{
deflateEnd(&zstream);
return (uint32_t)zstream.total_out;
}
else
{
zerror = deflateEnd(&zstream);
return 0;
}
}
uint32 InflateData(const char* buffer, uint32 len, char* out_buffer, uint32 out_len_max) {
z_stream zstream;
int zerror = 0;
int i;
zstream.next_in = const_cast<unsigned char*>(reinterpret_cast<const unsigned char*>(buffer));
zstream.avail_in = len;
zstream.next_out = reinterpret_cast<unsigned char*>(out_buffer);;
zstream.avail_out = out_len_max;
zstream.zalloc = Z_NULL;
zstream.zfree = Z_NULL;
zstream.opaque = Z_NULL;
i = inflateInit2(&zstream, 15);
if (i != Z_OK) {
return 0;
}
zerror = inflate(&zstream, Z_FINISH);
if (zerror == Z_STREAM_END) {
inflateEnd(&zstream);
return zstream.total_out;
}
else {
if (zerror == -4 && zstream.msg == 0)
{
return 0;
}
zerror = inflateEnd(&zstream);
return 0;
}
}
struct Map::impl
{
@@ -451,7 +375,7 @@ bool Map::LoadV2(FILE *f) {
std::vector<char> buffer;
buffer.resize(buffer_size);
uint32 v = InflateData(&data[0], data_size, &buffer[0], buffer_size);
uint32 v = EQEmu::InflateData(&data[0], data_size, &buffer[0], buffer_size);
char *buf = &buffer[0];
uint32 vert_count;