mirror of
https://github.com/ddnet/ddnet.git
synced 2024-11-05 15:48:19 +00:00
compressed map support. begun to fix things for ctf
This commit is contained in:
parent
3e23392105
commit
89ccbd4f7b
Binary file not shown.
Binary file not shown.
Binary file not shown.
|
@ -26,13 +26,21 @@ struct ent_type
|
||||||
|
|
||||||
static ent_type ent_types[] = {
|
static ent_type ent_types[] = {
|
||||||
{"spawn", MAPRES_SPAWNPOINT, 0},
|
{"spawn", MAPRES_SPAWNPOINT, 0},
|
||||||
|
{"spawn_red", MAPRES_SPAWNPOINT_RED, 0},
|
||||||
|
{"spawn_blue", MAPRES_SPAWNPOINT_BLUE, 0},
|
||||||
|
{"---", 0, 0},
|
||||||
|
{"flagstand_red", MAPRES_SPAWNPOINT_RED, 0},
|
||||||
|
{"flagstand_blue", MAPRES_SPAWNPOINT_BLUE, 0},
|
||||||
|
{"---", 0, 0},
|
||||||
{"gun", MAPRES_ITEM, ITEM_WEAPON_GUN},
|
{"gun", MAPRES_ITEM, ITEM_WEAPON_GUN},
|
||||||
{"shotgun", MAPRES_ITEM, ITEM_WEAPON_SHOTGUN},
|
{"shotgun", MAPRES_ITEM, ITEM_WEAPON_SHOTGUN},
|
||||||
{"rocket", MAPRES_ITEM, ITEM_WEAPON_ROCKET},
|
{"rocket", MAPRES_ITEM, ITEM_WEAPON_ROCKET},
|
||||||
{"sniper", MAPRES_ITEM, ITEM_WEAPON_SNIPER},
|
{"sniper", MAPRES_ITEM, ITEM_WEAPON_SNIPER},
|
||||||
{"hammer", MAPRES_ITEM, ITEM_WEAPON_HAMMER},
|
{"hammer", MAPRES_ITEM, ITEM_WEAPON_HAMMER},
|
||||||
|
{"---", 0, 0},
|
||||||
{"health", MAPRES_ITEM, ITEM_HEALTH},
|
{"health", MAPRES_ITEM, ITEM_HEALTH},
|
||||||
{"armor", MAPRES_ITEM, ITEM_ARMOR},
|
{"armor", MAPRES_ITEM, ITEM_ARMOR},
|
||||||
|
{"---", 0, 0},
|
||||||
{"ninja", MAPRES_ITEM, ITEM_NINJA},
|
{"ninja", MAPRES_ITEM, ITEM_NINJA},
|
||||||
{0, 0}
|
{0, 0}
|
||||||
};
|
};
|
||||||
|
|
|
@ -375,11 +375,12 @@ static void client_debug_render()
|
||||||
static float frametime_avg = 0;
|
static float frametime_avg = 0;
|
||||||
frametime_avg = frametime_avg*0.9f + frametime*0.1f;
|
frametime_avg = frametime_avg*0.9f + frametime*0.1f;
|
||||||
char buffer[512];
|
char buffer[512];
|
||||||
sprintf(buffer, "send: %6d recv: %6d snaploss: %d latency: %4.0f %c gfxmem: %6dk fps: %3d",
|
sprintf(buffer, "send: %6d recv: %6d snaploss: %d latency: %4.0f %c mem %dk gfxmem: %dk fps: %3d",
|
||||||
(current.send_bytes-prev.send_bytes)*10,
|
(current.send_bytes-prev.send_bytes)*10,
|
||||||
(current.recv_bytes-prev.recv_bytes)*10,
|
(current.recv_bytes-prev.recv_bytes)*10,
|
||||||
snaploss,
|
snaploss,
|
||||||
latency*1000.0f, extra_polating?'E':' ',
|
latency*1000.0f, extra_polating?'E':' ',
|
||||||
|
mem_allocated()/1024,
|
||||||
gfx_memory_usage()/1024,
|
gfx_memory_usage()/1024,
|
||||||
(int)(1.0f/frametime_avg));
|
(int)(1.0f/frametime_avg));
|
||||||
gfx_quads_text(2, 2, 16, buffer);
|
gfx_quads_text(2, 2, 16, buffer);
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
|
|
||||||
#include "system.h"
|
#include "system.h"
|
||||||
#include "datafile.h"
|
#include "datafile.h"
|
||||||
|
#include "external/zlib/zlib.h"
|
||||||
|
|
||||||
static const int DEBUG=0;
|
static const int DEBUG=0;
|
||||||
|
|
||||||
|
@ -19,7 +19,7 @@ typedef struct
|
||||||
|
|
||||||
typedef struct
|
typedef struct
|
||||||
{
|
{
|
||||||
int id;
|
char id[4];
|
||||||
int version;
|
int version;
|
||||||
int size;
|
int size;
|
||||||
int swaplen;
|
int swaplen;
|
||||||
|
@ -45,6 +45,7 @@ typedef struct
|
||||||
DATAFILE_ITEM_TYPE *item_types;
|
DATAFILE_ITEM_TYPE *item_types;
|
||||||
int *item_offsets;
|
int *item_offsets;
|
||||||
int *data_offsets;
|
int *data_offsets;
|
||||||
|
int *data_sizes;
|
||||||
|
|
||||||
char *item_start;
|
char *item_start;
|
||||||
char *data_start;
|
char *data_start;
|
||||||
|
@ -52,17 +53,20 @@ typedef struct
|
||||||
|
|
||||||
struct DATAFILE_t
|
struct DATAFILE_t
|
||||||
{
|
{
|
||||||
|
IOHANDLE file;
|
||||||
DATAFILE_INFO info;
|
DATAFILE_INFO info;
|
||||||
DATAFILE_DATA data;
|
DATAFILE_HEADER header;
|
||||||
|
int data_start_offset;
|
||||||
|
char **data_ptrs;
|
||||||
|
char *data;
|
||||||
};
|
};
|
||||||
|
|
||||||
DATAFILE *datafile_load(const char *filename)
|
DATAFILE *datafile_load(const char *filename)
|
||||||
{
|
{
|
||||||
DATAFILE *df;
|
DATAFILE *df;
|
||||||
IOHANDLE file;
|
IOHANDLE file;
|
||||||
unsigned char header[16];
|
DATAFILE_HEADER header;
|
||||||
int version;
|
unsigned readsize;
|
||||||
unsigned size, swapsize, readsize;
|
|
||||||
|
|
||||||
unsigned *dst;
|
unsigned *dst;
|
||||||
unsigned char *src;
|
unsigned char *src;
|
||||||
|
@ -79,36 +83,56 @@ DATAFILE *datafile_load(const char *filename)
|
||||||
return 0;
|
return 0;
|
||||||
|
|
||||||
/* TODO: change this header */
|
/* TODO: change this header */
|
||||||
io_read(file, header, sizeof(header));
|
io_read(file, &header, sizeof(header));
|
||||||
if(header[3] != 'D' || header[2] != 'A' || header[1] != 'T' || header[0] != 'A')
|
if(header.id[0] != 'A' || header.id[1] != 'T' || header.id[2] != 'A' || header.id[3] != 'D')
|
||||||
{
|
{
|
||||||
dbg_msg("datafile", "wrong signature. %x %x %x %x", header[0], header[1], header[2], header[3]);
|
if(header.id[0] != 'D' || header.id[1] != 'A' || header.id[2] != 'T' || header.id[3] != 'A')
|
||||||
|
{
|
||||||
|
dbg_msg("datafile", "wrong signature. %x %x %x %x", header.id[0], header.id[1], header.id[2], header.id[3]);
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/* TODO: swap the header */
|
||||||
|
if(header.version != 3 && header.version != 4)
|
||||||
|
{
|
||||||
|
dbg_msg("datafile", "wrong version. version=%x", header.version);
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
version = (unsigned)header[4] | (unsigned)header[5]<<8 | (unsigned)header[6]<<16 | (unsigned)header[7]<<24;
|
//if(DEBUG)
|
||||||
if(version != 3)
|
//dbg_msg("datafile", "loading. size=%d", datafile.size);
|
||||||
{
|
|
||||||
dbg_msg("datafile", "wrong version. version=%x", version);
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
size = (unsigned)header[8] | (unsigned)header[9]<<8 | (unsigned)header[10]<<16 | (unsigned)header[11]<<24;
|
/* read in the rest except the data */
|
||||||
swapsize = (unsigned)header[12] | (unsigned)header[13]<<8 | (unsigned)header[14]<<16 | (unsigned)header[15]<<24;
|
int size = 0;
|
||||||
|
size += header.num_item_types*sizeof(DATAFILE_ITEM_TYPE);
|
||||||
|
size += (header.num_items+header.num_raw_data)*sizeof(int);
|
||||||
|
if(header.version == 4)
|
||||||
|
size += header.num_raw_data*sizeof(int); /* v4 has uncompressed data sizes aswell */
|
||||||
|
size += header.item_size;
|
||||||
|
|
||||||
(void)swapsize;
|
int allocsize = size;
|
||||||
|
allocsize += sizeof(DATAFILE); // add space for info structure
|
||||||
|
allocsize += header.num_raw_data*sizeof(void*); // add space for data pointers
|
||||||
|
|
||||||
if(DEBUG)
|
df = (DATAFILE*)mem_alloc(allocsize, 1);
|
||||||
dbg_msg("datafile", "loading. size=%d", size);
|
df->header = header;
|
||||||
|
df->data_start_offset = sizeof(DATAFILE_HEADER) + size;
|
||||||
|
df->data_ptrs = (void*)(df+1);
|
||||||
|
df->data = (char *)(df+1)+header.num_raw_data*sizeof(char *);
|
||||||
|
df->file = file;
|
||||||
|
|
||||||
df = (DATAFILE*)mem_alloc(size+sizeof(DATAFILE_INFO), 1);
|
/* clear the data pointers */
|
||||||
readsize = io_read(file, &df->data, size);
|
mem_zero(df->data_ptrs, header.num_raw_data*sizeof(void*));
|
||||||
|
|
||||||
|
/* read types, offsets, sizes and item data */
|
||||||
|
readsize = io_read(file, df->data, size);
|
||||||
if(readsize != size)
|
if(readsize != size)
|
||||||
{
|
{
|
||||||
dbg_msg("datafile", "couldn't load the whole thing, wanted=%d got=%d", size, readsize);
|
dbg_msg("datafile", "couldn't load the whole thing, wanted=%d got=%d", size, readsize);
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
/*
|
||||||
#if defined(CONF_ARCH_ENDIAN_BIG)
|
#if defined(CONF_ARCH_ENDIAN_BIG)
|
||||||
unsigned *dst = (unsigned*)df;
|
unsigned *dst = (unsigned*)df;
|
||||||
unsigned char *src = (unsigned char*)df;
|
unsigned char *src = (unsigned char*)df;
|
||||||
|
@ -117,17 +141,21 @@ DATAFILE *datafile_load(const char *filename)
|
||||||
unsigned j = i << 2;
|
unsigned j = i << 2;
|
||||||
dst[i] = src[j] | src[j+1]<<8 | src[j+2]<<16 | src[j+3]<<24;
|
dst[i] = src[j] | src[j+1]<<8 | src[j+2]<<16 | src[j+3]<<24;
|
||||||
}
|
}
|
||||||
#endif
|
#endif*/
|
||||||
|
|
||||||
if(DEBUG)
|
if(DEBUG)
|
||||||
dbg_msg("datafile", "item_size=%d", df->data.item_size);
|
dbg_msg("datafile", "item_size=%d", df->header.item_size);
|
||||||
|
|
||||||
df->info.item_types = (DATAFILE_ITEM_TYPE *)df->data.start;
|
df->info.item_types = (DATAFILE_ITEM_TYPE *)df->data;
|
||||||
df->info.item_offsets = (int *)&df->info.item_types[df->data.num_item_types];
|
df->info.item_offsets = (int *)&df->info.item_types[df->header.num_item_types];
|
||||||
df->info.data_offsets = (int *)&df->info.item_offsets[df->data.num_items];
|
df->info.data_offsets = (int *)&df->info.item_offsets[df->header.num_items];
|
||||||
|
df->info.data_sizes = (int *)&df->info.data_offsets[df->header.num_raw_data];
|
||||||
|
|
||||||
df->info.item_start = (char *)&df->info.data_offsets[df->data.num_raw_data];
|
if(header.version == 4)
|
||||||
df->info.data_start = df->info.item_start + df->data.item_size;
|
df->info.item_start = (char *)&df->info.data_sizes[df->header.num_raw_data];
|
||||||
|
else
|
||||||
|
df->info.item_start = (char *)&df->info.data_offsets[df->header.num_raw_data];
|
||||||
|
df->info.data_start = df->info.item_start + df->header.item_size;
|
||||||
|
|
||||||
if(DEBUG)
|
if(DEBUG)
|
||||||
dbg_msg("datafile", "datafile loading done. datafile='%s'", filename);
|
dbg_msg("datafile", "datafile loading done. datafile='%s'", filename);
|
||||||
|
@ -171,9 +199,74 @@ DATAFILE *datafile_load(const char *filename)
|
||||||
return df;
|
return df;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
int datafile_num_data(DATAFILE *df)
|
||||||
|
{
|
||||||
|
return df->header.num_raw_data;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* always returns the size in the file */
|
||||||
|
int datafile_get_datasize(DATAFILE *df, int index)
|
||||||
|
{
|
||||||
|
//if(df->header.version == 4)
|
||||||
|
// return df->info.data_sizes[index];
|
||||||
|
|
||||||
|
if(index == df->header.num_raw_data-1)
|
||||||
|
return df->header.data_size-df->info.data_offsets[index];
|
||||||
|
return df->info.data_offsets[index+1]-df->info.data_offsets[index];
|
||||||
|
}
|
||||||
|
|
||||||
void *datafile_get_data(DATAFILE *df, int index)
|
void *datafile_get_data(DATAFILE *df, int index)
|
||||||
{
|
{
|
||||||
return df->info.data_start+df->info.data_offsets[index];
|
// load it if needed
|
||||||
|
if(!df->data_ptrs[index])
|
||||||
|
{
|
||||||
|
/* fetch the data size */
|
||||||
|
int datasize = datafile_get_datasize(df, index);
|
||||||
|
|
||||||
|
if(df->header.version == 4)
|
||||||
|
{
|
||||||
|
/* v4 has compressed data */
|
||||||
|
dbg_msg("datafile", "loading data index=%d size=%d", index, datasize);
|
||||||
|
void *temp = (char *)mem_alloc(datasize, 1);
|
||||||
|
unsigned long uncompressed_size = df->info.data_sizes[index];
|
||||||
|
df->data_ptrs[index] = (char *)mem_alloc(uncompressed_size, 1);
|
||||||
|
|
||||||
|
/* read the compressed data */
|
||||||
|
io_seek(df->file, df->data_start_offset+df->info.data_offsets[index], IOSEEK_START);
|
||||||
|
io_read(df->file, temp, datasize);
|
||||||
|
|
||||||
|
/* decompress the data, TODO: check for errors */
|
||||||
|
unsigned long s = uncompressed_size;
|
||||||
|
uncompress((void*)df->data_ptrs[index], &s, temp, datasize);
|
||||||
|
|
||||||
|
/* clean up the temporary buffers */
|
||||||
|
mem_free(temp);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
/* load the data */
|
||||||
|
dbg_msg("datafile", "loading data index=%d size=%d", index, datasize);
|
||||||
|
df->data_ptrs[index] = (char *)mem_alloc(datasize, 1);
|
||||||
|
io_seek(df->file, df->data_start_offset+df->info.data_offsets[index], IOSEEK_START);
|
||||||
|
io_read(df->file, df->data_ptrs[index], datasize);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return df->data_ptrs[index];
|
||||||
|
}
|
||||||
|
|
||||||
|
void datafile_unload_data(DATAFILE *df, int index)
|
||||||
|
{
|
||||||
|
/* */
|
||||||
|
mem_free(df->data_ptrs[index]);
|
||||||
|
df->data_ptrs[index] = 0x0;
|
||||||
|
}
|
||||||
|
|
||||||
|
int datafile_get_itemsize(DATAFILE *df, int index)
|
||||||
|
{
|
||||||
|
if(index == df->header.num_items-1)
|
||||||
|
return df->header.item_size-df->info.item_offsets[index];
|
||||||
|
return df->info.item_offsets[index+1]-df->info.item_offsets[index];
|
||||||
}
|
}
|
||||||
|
|
||||||
void *datafile_get_item(DATAFILE *df, int index, int *type, int *id)
|
void *datafile_get_item(DATAFILE *df, int index, int *type, int *id)
|
||||||
|
@ -189,7 +282,7 @@ void *datafile_get_item(DATAFILE *df, int index, int *type, int *id)
|
||||||
void datafile_get_type(DATAFILE *df, int type, int *start, int *num)
|
void datafile_get_type(DATAFILE *df, int type, int *start, int *num)
|
||||||
{
|
{
|
||||||
int i;
|
int i;
|
||||||
for(i = 0; i < df->data.num_item_types; i++)
|
for(i = 0; i < df->header.num_item_types; i++)
|
||||||
{
|
{
|
||||||
if(df->info.item_types[i].type == type)
|
if(df->info.item_types[i].type == type)
|
||||||
{
|
{
|
||||||
|
@ -212,7 +305,6 @@ void *datafile_find_item(DATAFILE *df, int type, int id)
|
||||||
datafile_get_type(df, type, &start, &num);
|
datafile_get_type(df, type, &start, &num);
|
||||||
for(i = 0; i < num; i++)
|
for(i = 0; i < num; i++)
|
||||||
{
|
{
|
||||||
|
|
||||||
item = datafile_get_item(df, start+i,0, &item_id);
|
item = datafile_get_item(df, start+i,0, &item_id);
|
||||||
if(id == item_id)
|
if(id == item_id)
|
||||||
return item;
|
return item;
|
||||||
|
@ -222,20 +314,29 @@ void *datafile_find_item(DATAFILE *df, int type, int id)
|
||||||
|
|
||||||
int datafile_num_items(DATAFILE *df)
|
int datafile_num_items(DATAFILE *df)
|
||||||
{
|
{
|
||||||
return df->data.num_items;
|
return df->header.num_items;
|
||||||
}
|
}
|
||||||
|
|
||||||
void datafile_unload(DATAFILE *df)
|
void datafile_unload(DATAFILE *df)
|
||||||
{
|
{
|
||||||
if(df)
|
if(df)
|
||||||
|
{
|
||||||
|
/* free the data that is loaded */
|
||||||
|
int i;
|
||||||
|
for(i = 0; i < df->header.num_raw_data; i++)
|
||||||
|
mem_free(df->data_ptrs[i]);
|
||||||
|
|
||||||
|
io_close(df->file);
|
||||||
mem_free(df);
|
mem_free(df);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/* DATAFILE output */
|
/* DATAFILE output */
|
||||||
typedef struct
|
typedef struct
|
||||||
{
|
{
|
||||||
int size;
|
int uncompressed_size;
|
||||||
void *data;
|
int compressed_size;
|
||||||
|
void *compressed_data;
|
||||||
} DATA_INFO;
|
} DATA_INFO;
|
||||||
|
|
||||||
typedef struct
|
typedef struct
|
||||||
|
@ -324,8 +425,17 @@ int datafile_add_item(DATAFILE_OUT *df, int type, int id, int size, void *data)
|
||||||
|
|
||||||
int datafile_add_data(DATAFILE_OUT *df, int size, void *data)
|
int datafile_add_data(DATAFILE_OUT *df, int size, void *data)
|
||||||
{
|
{
|
||||||
df->datas[df->num_items].size = size;
|
DATA_INFO *info = &df->datas[df->num_datas];
|
||||||
df->datas[df->num_datas].data = data;
|
void *compdata = mem_alloc(size, 1); /* temporary buffer that we use duing compression */
|
||||||
|
info->uncompressed_size = size;
|
||||||
|
unsigned long s = size;
|
||||||
|
if(compress(compdata, &s, data, size) != Z_OK)
|
||||||
|
dbg_assert(0, "zlib error");
|
||||||
|
info->compressed_size = (int)s;
|
||||||
|
info->compressed_data = mem_alloc(info->compressed_size, 1);
|
||||||
|
mem_copy(info->compressed_data, compdata, info->compressed_size);
|
||||||
|
mem_free(compdata);
|
||||||
|
|
||||||
df->num_datas++;
|
df->num_datas++;
|
||||||
return df->num_datas-1;
|
return df->num_datas-1;
|
||||||
}
|
}
|
||||||
|
@ -353,7 +463,7 @@ int datafile_finish(DATAFILE_OUT *df)
|
||||||
|
|
||||||
|
|
||||||
for(i = 0; i < df->num_datas; i++)
|
for(i = 0; i < df->num_datas; i++)
|
||||||
datasize += df->datas[i].size;
|
datasize += df->datas[i].compressed_size;
|
||||||
|
|
||||||
/* calculate the complete size */
|
/* calculate the complete size */
|
||||||
typessize = df->num_item_types*sizeof(DATAFILE_ITEM_TYPE);
|
typessize = df->num_item_types*sizeof(DATAFILE_ITEM_TYPE);
|
||||||
|
@ -369,8 +479,11 @@ int datafile_finish(DATAFILE_OUT *df)
|
||||||
|
|
||||||
/* construct header */
|
/* construct header */
|
||||||
DATAFILE_HEADER header;
|
DATAFILE_HEADER header;
|
||||||
header.id = ('D'<<24) | ('A'<<16) | ('T'<<8) | ('A');
|
header.id[0] = 'D';
|
||||||
header.version = 3;
|
header.id[1] = 'A';
|
||||||
|
header.id[2] = 'T';
|
||||||
|
header.id[3] = 'A';
|
||||||
|
header.version = 4;
|
||||||
header.size = filesize - 16;
|
header.size = filesize - 16;
|
||||||
header.swaplen = swapsize - 16;
|
header.swaplen = swapsize - 16;
|
||||||
header.num_item_types = df->num_item_types;
|
header.num_item_types = df->num_item_types;
|
||||||
|
@ -427,7 +540,17 @@ int datafile_finish(DATAFILE_OUT *df)
|
||||||
if(DEBUG)
|
if(DEBUG)
|
||||||
dbg_msg("datafile", "writing data offset num=%d offset=%d", i, offset);
|
dbg_msg("datafile", "writing data offset num=%d offset=%d", i, offset);
|
||||||
io_write(df->file, &offset, sizeof(offset));
|
io_write(df->file, &offset, sizeof(offset));
|
||||||
offset += df->datas[i].size;
|
offset += df->datas[i].compressed_size;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* write data uncompressed sizes */
|
||||||
|
for(i = 0, offset = 0; i < df->num_datas; i++)
|
||||||
|
{
|
||||||
|
/*
|
||||||
|
if(DEBUG)
|
||||||
|
dbg_msg("datafile", "writing data offset num=%d offset=%d", i, offset);
|
||||||
|
*/
|
||||||
|
io_write(df->file, &df->datas[i].uncompressed_size, sizeof(int));
|
||||||
}
|
}
|
||||||
|
|
||||||
/* write items */
|
/* write items */
|
||||||
|
@ -457,8 +580,8 @@ int datafile_finish(DATAFILE_OUT *df)
|
||||||
for(i = 0; i < df->num_datas; i++)
|
for(i = 0; i < df->num_datas; i++)
|
||||||
{
|
{
|
||||||
if(DEBUG)
|
if(DEBUG)
|
||||||
dbg_msg("datafile", "writing data id=%d size=%d", i, df->datas[i].size);
|
dbg_msg("datafile", "writing data id=%d size=%d", i, df->datas[i].compressed_size);
|
||||||
io_write(df->file, df->datas[i].data, df->datas[i].size);
|
io_write(df->file, df->datas[i].compressed_data, df->datas[i].compressed_size);
|
||||||
}
|
}
|
||||||
|
|
||||||
/* free data */
|
/* free data */
|
||||||
|
|
|
@ -5,11 +5,15 @@ typedef struct DATAFILE_t DATAFILE;
|
||||||
/* read access */
|
/* read access */
|
||||||
DATAFILE *datafile_load(const char *filename);
|
DATAFILE *datafile_load(const char *filename);
|
||||||
DATAFILE *datafile_load_old(const char *filename);
|
DATAFILE *datafile_load_old(const char *filename);
|
||||||
void *datafile_get_data(DATAFILE *df, int index);
|
void *datafile_get_data(DATAFILE *df, int index); // automaticly load the data for the item
|
||||||
|
int datafile_get_datasize(DATAFILE *df, int index);
|
||||||
|
void datafile_unload_data(DATAFILE *df, int index);
|
||||||
void *datafile_get_item(DATAFILE *df, int index, int *type, int *id);
|
void *datafile_get_item(DATAFILE *df, int index, int *type, int *id);
|
||||||
|
int datafile_get_itemsize(DATAFILE *df, int index);
|
||||||
void datafile_get_type(DATAFILE *df, int type, int *start, int *num);
|
void datafile_get_type(DATAFILE *df, int type, int *start, int *num);
|
||||||
void *datafile_find_item(DATAFILE *df, int type, int id);
|
void *datafile_find_item(DATAFILE *df, int type, int id);
|
||||||
int datafile_num_items(DATAFILE *df);
|
int datafile_num_items(DATAFILE *df);
|
||||||
|
int datafile_num_data(DATAFILE *df);
|
||||||
void datafile_unload(DATAFILE *df);
|
void datafile_unload(DATAFILE *df);
|
||||||
|
|
||||||
/* write access */
|
/* write access */
|
||||||
|
|
|
@ -797,6 +797,9 @@ void gfx_screenshot();
|
||||||
int snap_new_id();
|
int snap_new_id();
|
||||||
void snap_free_id(int id);
|
void snap_free_id(int id);
|
||||||
|
|
||||||
|
/* other */
|
||||||
|
void map_unload_data(int index);
|
||||||
|
|
||||||
#ifdef __cplusplus
|
#ifdef __cplusplus
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
|
@ -8,6 +8,11 @@ void *map_get_data(int index)
|
||||||
return datafile_get_data(map, index);
|
return datafile_get_data(map, index);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void map_unload_data(int index)
|
||||||
|
{
|
||||||
|
datafile_unload_data(map, index);
|
||||||
|
}
|
||||||
|
|
||||||
void *map_get_item(int index, int *type, int *id)
|
void *map_get_item(int index, int *type, int *id)
|
||||||
{
|
{
|
||||||
return datafile_get_item(map, index, type, id);
|
return datafile_get_item(map, index, type, id);
|
||||||
|
|
|
@ -559,6 +559,9 @@ static int server_run()
|
||||||
int64 networktime = 0;
|
int64 networktime = 0;
|
||||||
int64 totaltime = 0;
|
int64 totaltime = 0;
|
||||||
|
|
||||||
|
if(config.debug)
|
||||||
|
dbg_msg("server", "baseline memory usage %dk", mem_allocated()/1024);
|
||||||
|
|
||||||
while(1)
|
while(1)
|
||||||
{
|
{
|
||||||
int64 t = time_get();
|
int64 t = time_get();
|
||||||
|
|
|
@ -94,6 +94,11 @@ struct memtail
|
||||||
|
|
||||||
struct memheader *first = 0;
|
struct memheader *first = 0;
|
||||||
|
|
||||||
|
int mem_allocated()
|
||||||
|
{
|
||||||
|
return memory_alloced;
|
||||||
|
}
|
||||||
|
|
||||||
void *mem_alloc_debug(const char *filename, int line, unsigned size, unsigned alignment)
|
void *mem_alloc_debug(const char *filename, int line, unsigned size, unsigned alignment)
|
||||||
{
|
{
|
||||||
/* TODO: fix alignment */
|
/* TODO: fix alignment */
|
||||||
|
@ -196,13 +201,13 @@ int io_seek(IOHANDLE io, int offset, int origin)
|
||||||
|
|
||||||
switch(origin)
|
switch(origin)
|
||||||
{
|
{
|
||||||
case 0: /*IOSEEK_SET:*/
|
case IOSEEK_START:
|
||||||
real_origin = SEEK_SET;
|
real_origin = SEEK_SET;
|
||||||
break;
|
break;
|
||||||
case 1: /*IOSEEK_CUR:*/
|
case IOSEEK_CUR:
|
||||||
real_origin = SEEK_CUR;
|
real_origin = SEEK_CUR;
|
||||||
break;
|
break;
|
||||||
case 2: /*IOSEEK_END:*/
|
case IOSEEK_END:
|
||||||
real_origin = SEEK_END;
|
real_origin = SEEK_END;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -219,7 +224,7 @@ long int io_length(IOHANDLE io)
|
||||||
long int length;
|
long int length;
|
||||||
io_seek(io, 0, IOSEEK_END);
|
io_seek(io, 0, IOSEEK_END);
|
||||||
length = io_tell(io);
|
length = io_tell(io);
|
||||||
io_seek(io, 0, IOSEEK_SET);
|
io_seek(io, 0, IOSEEK_START);
|
||||||
return length;
|
return length;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -149,7 +149,7 @@ enum {
|
||||||
IOFLAG_WRITE = 2,
|
IOFLAG_WRITE = 2,
|
||||||
IOFLAG_RANDOM = 4,
|
IOFLAG_RANDOM = 4,
|
||||||
|
|
||||||
IOSEEK_SET = 0,
|
IOSEEK_START = 0,
|
||||||
IOSEEK_CUR = 1,
|
IOSEEK_CUR = 1,
|
||||||
IOSEEK_END = 2
|
IOSEEK_END = 2
|
||||||
};
|
};
|
||||||
|
@ -514,7 +514,7 @@ int fs_listdir(const char *dir, fs_listdir_callback cb, void *user);
|
||||||
int net_addr4_cmp(const NETADDR4 *a, const NETADDR4 *b);
|
int net_addr4_cmp(const NETADDR4 *a, const NETADDR4 *b);
|
||||||
|
|
||||||
void mem_debug_dump();
|
void mem_debug_dump();
|
||||||
|
int mem_allocated();
|
||||||
#ifdef __cplusplus
|
#ifdef __cplusplus
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
|
@ -1437,6 +1437,129 @@ int emoticon_selector_render()
|
||||||
return return_now ? selected_emoticon : -1;
|
return return_now ? selected_emoticon : -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void render_scoreboard(obj_game *gameobj, float x, float y, float w, int team, const char *title)
|
||||||
|
{
|
||||||
|
//float w = 550.0f;
|
||||||
|
//float x = width/2-w/2;
|
||||||
|
//;
|
||||||
|
//float y = ystart;
|
||||||
|
//float w = 550.0f;
|
||||||
|
|
||||||
|
animstate idlestate;
|
||||||
|
anim_eval(&data->animations[ANIM_BASE], 0, &idlestate);
|
||||||
|
anim_eval_add(&idlestate, &data->animations[ANIM_IDLE], 0, 1.0f);
|
||||||
|
|
||||||
|
float ystart = y;
|
||||||
|
float h = 600.0f;
|
||||||
|
|
||||||
|
gfx_blend_normal();
|
||||||
|
|
||||||
|
gfx_texture_set(-1);
|
||||||
|
gfx_quads_begin();
|
||||||
|
gfx_quads_setcolor(0,0,0,0.5f);
|
||||||
|
draw_round_rect(x-10.f, y-10.f, w, h, 40.0f);
|
||||||
|
gfx_quads_end();
|
||||||
|
|
||||||
|
// render title
|
||||||
|
if(!title)
|
||||||
|
{
|
||||||
|
if(gameobj->game_over)
|
||||||
|
title = "Game Over";
|
||||||
|
else
|
||||||
|
title = "Score Board";
|
||||||
|
}
|
||||||
|
|
||||||
|
float tw = gfx_pretty_text_width( 64, "Game Over", -1);
|
||||||
|
gfx_pretty_text(x+w/2-tw/2, y, 64, "Game Over", -1);
|
||||||
|
|
||||||
|
|
||||||
|
y += 64.0f;
|
||||||
|
|
||||||
|
// find players
|
||||||
|
const obj_player *players[MAX_CLIENTS] = {0};
|
||||||
|
int num_players = 0;
|
||||||
|
for(int i = 0; i < snap_num_items(SNAP_CURRENT); i++)
|
||||||
|
{
|
||||||
|
SNAP_ITEM item;
|
||||||
|
const void *data = snap_get_item(SNAP_CURRENT, i, &item);
|
||||||
|
|
||||||
|
if(item.type == OBJTYPE_PLAYER)
|
||||||
|
{
|
||||||
|
players[num_players] = (const obj_player *)data;
|
||||||
|
num_players++;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// sort players
|
||||||
|
for(int k = 0; k < num_players; k++) // ffs, bubblesort
|
||||||
|
{
|
||||||
|
for(int i = 0; i < num_players-k-1; i++)
|
||||||
|
{
|
||||||
|
if(players[i]->score < players[i+1]->score)
|
||||||
|
{
|
||||||
|
const obj_player *tmp = players[i];
|
||||||
|
players[i] = players[i+1];
|
||||||
|
players[i+1] = tmp;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// render headlines
|
||||||
|
gfx_pretty_text(x+10, y, 32, "Score", -1);
|
||||||
|
gfx_pretty_text(x+125, y, 32, "Name", -1);
|
||||||
|
gfx_pretty_text(x+w-70, y, 32, "Ping", -1);
|
||||||
|
y += 38.0f;
|
||||||
|
|
||||||
|
// render player scores
|
||||||
|
for(int i = 0; i < num_players; i++)
|
||||||
|
{
|
||||||
|
const obj_player *player = players[i];
|
||||||
|
|
||||||
|
// make sure that we render the correct team
|
||||||
|
if(team != -1 && player->team != team)
|
||||||
|
continue;
|
||||||
|
|
||||||
|
char buf[128];
|
||||||
|
float font_size = 46.0f;
|
||||||
|
if(player->local)
|
||||||
|
{
|
||||||
|
// background so it's easy to find the local player
|
||||||
|
gfx_texture_set(-1);
|
||||||
|
gfx_quads_begin();
|
||||||
|
gfx_quads_setcolor(1,1,1,0.25f);
|
||||||
|
draw_round_rect(x, y, w-20, 48, 20.0f);
|
||||||
|
gfx_quads_end();
|
||||||
|
}
|
||||||
|
|
||||||
|
sprintf(buf, "%4d", player->score);
|
||||||
|
gfx_pretty_text(x+60-gfx_pretty_text_width(font_size,buf,-1), y, font_size, buf, -1);
|
||||||
|
gfx_pretty_text(x+128, y, font_size, client_datas[player->clientid].name, -1);
|
||||||
|
|
||||||
|
sprintf(buf, "%4d", player->latency);
|
||||||
|
float tw = gfx_pretty_text_width(font_size, buf, -1);
|
||||||
|
gfx_pretty_text(x+w-tw-35, y, font_size, buf, -1);
|
||||||
|
|
||||||
|
// render avatar
|
||||||
|
render_tee(&idlestate, player->clientid, EMOTE_NORMAL, vec2(1,0), vec2(x+90, y+28));
|
||||||
|
y += 50.0f;
|
||||||
|
}
|
||||||
|
|
||||||
|
// render goals
|
||||||
|
y = ystart+h-54;
|
||||||
|
if(gameobj && gameobj->time_limit)
|
||||||
|
{
|
||||||
|
char buf[64];
|
||||||
|
sprintf(buf, "Time Limit: %d min", gameobj->time_limit);
|
||||||
|
gfx_pretty_text(x+w/2, y, 32, buf, -1);
|
||||||
|
}
|
||||||
|
if(gameobj && gameobj->score_limit)
|
||||||
|
{
|
||||||
|
char buf[64];
|
||||||
|
sprintf(buf, "Score Limit: %d", gameobj->score_limit);
|
||||||
|
gfx_pretty_text(x+40, y, 32, buf, -1);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
void render_game()
|
void render_game()
|
||||||
{
|
{
|
||||||
animstate idlestate;
|
animstate idlestate;
|
||||||
|
@ -1924,212 +2047,22 @@ void render_game()
|
||||||
{
|
{
|
||||||
gfx_mapscreen(0, 0, width, height);
|
gfx_mapscreen(0, 0, width, height);
|
||||||
|
|
||||||
|
float w = 550.0f;
|
||||||
|
|
||||||
if (gameobj && gameobj->gametype == GAMETYPE_DM)
|
if (gameobj && gameobj->gametype == GAMETYPE_DM)
|
||||||
{
|
{
|
||||||
// Normal deathmatch
|
render_scoreboard(gameobj, width/2-w/2, 150.0f, w, -1, 0);
|
||||||
|
//render_scoreboard(gameobj, 0, 0, -1, 0);
|
||||||
float w = 550.0f;
|
|
||||||
float x = width/2-w/2;
|
|
||||||
float ystart = 150.0f;
|
|
||||||
float y = ystart;
|
|
||||||
float h = 600.0f;
|
|
||||||
|
|
||||||
gfx_blend_normal();
|
|
||||||
|
|
||||||
gfx_texture_set(-1);
|
|
||||||
gfx_quads_begin();
|
|
||||||
gfx_quads_setcolor(0,0,0,0.5f);
|
|
||||||
draw_round_rect(x-10.f, y-10.f, w, h, 40.0f);
|
|
||||||
gfx_quads_end();
|
|
||||||
|
|
||||||
if(gameobj->game_over)
|
|
||||||
{
|
|
||||||
float tw = gfx_pretty_text_width( 64, "Game Over", -1);
|
|
||||||
gfx_pretty_text(x+w/2-tw/2, y, 64, "Game Over", -1);
|
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
float tw = gfx_pretty_text_width( 64, "Score Board", -1);
|
render_scoreboard(gameobj, width/2-w-20, 150.0f, w, 0, "Team A");
|
||||||
gfx_pretty_text(x+w/2-tw/2, y, 64, "Score Board", -1);
|
render_scoreboard(gameobj, width/2 + 20, 150.0f, w, 1, "Team B");
|
||||||
}
|
|
||||||
y += 64.0f;
|
|
||||||
|
|
||||||
// find players
|
|
||||||
const obj_player *players[MAX_CLIENTS] = {0};
|
|
||||||
int num_players = 0;
|
|
||||||
for(int i = 0; i < snap_num_items(SNAP_CURRENT); i++)
|
|
||||||
{
|
|
||||||
SNAP_ITEM item;
|
|
||||||
const void *data = snap_get_item(SNAP_CURRENT, i, &item);
|
|
||||||
|
|
||||||
if(item.type == OBJTYPE_PLAYER)
|
|
||||||
{
|
|
||||||
players[num_players] = (const obj_player *)data;
|
|
||||||
num_players++;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// sort players
|
|
||||||
for(int k = 0; k < num_players; k++) // ffs, bubblesort
|
|
||||||
{
|
|
||||||
for(int i = 0; i < num_players-k-1; i++)
|
|
||||||
{
|
|
||||||
if(players[i]->score < players[i+1]->score)
|
|
||||||
{
|
|
||||||
const obj_player *tmp = players[i];
|
|
||||||
players[i] = players[i+1];
|
|
||||||
players[i+1] = tmp;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
// render headlines
|
|
||||||
gfx_pretty_text(x+10, y, 32, "Score", -1);
|
|
||||||
gfx_pretty_text(x+125, y, 32, "Name", -1);
|
|
||||||
gfx_pretty_text(x+w-70, y, 32, "Ping", -1);
|
|
||||||
y += 38.0f;
|
|
||||||
|
|
||||||
// render player scores
|
|
||||||
for(int i = 0; i < num_players; i++)
|
|
||||||
{
|
|
||||||
const obj_player *player = players[i];
|
|
||||||
char buf[128];
|
|
||||||
float font_size = 46.0f;
|
|
||||||
if(player->local)
|
|
||||||
{
|
|
||||||
// background so it's easy to find the local player
|
|
||||||
gfx_texture_set(-1);
|
|
||||||
gfx_quads_begin();
|
|
||||||
gfx_quads_setcolor(1,1,1,0.25f);
|
|
||||||
draw_round_rect(x, y, w-20, 48, 20.0f);
|
|
||||||
gfx_quads_end();
|
|
||||||
}
|
|
||||||
|
|
||||||
sprintf(buf, "%4d", player->score);
|
|
||||||
gfx_pretty_text(x+60-gfx_pretty_text_width(font_size,buf,-1), y, font_size, buf, -1);
|
|
||||||
gfx_pretty_text(x+128, y, font_size, client_datas[player->clientid].name, -1);
|
|
||||||
|
|
||||||
sprintf(buf, "%4d", player->latency);
|
|
||||||
float tw = gfx_pretty_text_width(font_size, buf, -1);
|
|
||||||
gfx_pretty_text(x+w-tw-35, y, font_size, buf, -1);
|
|
||||||
|
|
||||||
// render avatar
|
|
||||||
render_tee(&idlestate, player->clientid, EMOTE_NORMAL, vec2(1,0), vec2(x+90, y+28));
|
|
||||||
y += 50.0f;
|
|
||||||
}
|
|
||||||
|
|
||||||
// render goals
|
|
||||||
y = ystart+h-54;
|
|
||||||
if(gameobj && gameobj->time_limit)
|
|
||||||
{
|
|
||||||
char buf[64];
|
|
||||||
sprintf(buf, "Time Limit: %d min", gameobj->time_limit);
|
|
||||||
gfx_pretty_text(x+w/2, y, 32, buf, -1);
|
|
||||||
}
|
|
||||||
if(gameobj && gameobj->score_limit)
|
|
||||||
{
|
|
||||||
char buf[64];
|
|
||||||
sprintf(buf, "Score Limit: %d", gameobj->score_limit);
|
|
||||||
gfx_pretty_text(x+40, y, 32, buf, -1);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
/*
|
|
||||||
else if (gameobj->gametype == GAMETYPE_TDM)
|
|
||||||
{
|
|
||||||
// Team deathmatch
|
|
||||||
gfx_blend_normal();
|
|
||||||
|
|
||||||
float w = 650.0f;
|
|
||||||
float x = width-w-50.0f;
|
|
||||||
float y = 150.0f;
|
|
||||||
|
|
||||||
gfx_texture_set(-1);
|
|
||||||
gfx_quads_begin();
|
|
||||||
gfx_quads_setcolor(0,0,0,0.5f);
|
|
||||||
gfx_quads_drawTL(x-10.f, y-10.f, 800.0f, 600.0f);
|
|
||||||
gfx_quads_end();
|
|
||||||
|
|
||||||
gfx_pretty_text(x, y, 64, "Score Board");
|
|
||||||
if(gameobj && gameobj->time_limit)
|
|
||||||
{
|
|
||||||
char buf[64];
|
|
||||||
sprintf(buf, "Time Limit: %d min", gameobj->time_limit);
|
|
||||||
gfx_pretty_text(x + 400, y + 25, 32, buf);
|
|
||||||
}
|
|
||||||
if(gameobj && gameobj->score_limit)
|
|
||||||
{
|
|
||||||
char buf[64];
|
|
||||||
sprintf(buf, "Score Limit: %d", gameobj->score_limit);
|
|
||||||
gfx_pretty_text(x + 400, y + 25, 32, buf);
|
|
||||||
}
|
|
||||||
y += 64.0f;
|
|
||||||
|
|
||||||
// Calculate team scores
|
|
||||||
int teamscore[2] = {0,0};
|
|
||||||
int num = snap_num_items(SNAP_CURRENT);
|
|
||||||
for(int i = 0; i < num; i++)
|
|
||||||
{
|
|
||||||
snap_item item;
|
|
||||||
const void *data = snap_get_item(SNAP_CURRENT, i, &item);
|
|
||||||
|
|
||||||
if(item.type == OBJTYPE_PLAYER)
|
|
||||||
{
|
|
||||||
const obj_player *player = (const obj_player *)data;
|
|
||||||
if(player && player->team >= 0 && player->team < 2)
|
|
||||||
{
|
|
||||||
teamscore[player->team] += player->score;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
char buf[128];
|
|
||||||
gfx_pretty_text(x, y, 40, "Team A - ");
|
|
||||||
sprintf(buf, "%4d", teamscore[0]);
|
|
||||||
gfx_pretty_text(x + 110, y, 40, buf);
|
|
||||||
|
|
||||||
gfx_pretty_text(x + 400, y, 40, "Team B - ");
|
|
||||||
sprintf(buf, "%4d", teamscore[1]);
|
|
||||||
gfx_pretty_text(x + 510, y, 40, buf);
|
|
||||||
|
|
||||||
y += 50.0f;
|
|
||||||
|
|
||||||
float offsets[2];
|
|
||||||
offsets[0] = y;
|
|
||||||
offsets[1] = y;
|
|
||||||
|
|
||||||
for(int i = 0; i < num; i++)
|
|
||||||
{
|
|
||||||
snap_item item;
|
|
||||||
const void *data = snap_get_item(SNAP_CURRENT, i, &item);
|
|
||||||
|
|
||||||
if(item.type == OBJTYPE_PLAYER)
|
|
||||||
{
|
|
||||||
const obj_player *player = (const obj_player *)data;
|
|
||||||
if(player && player->team >= 0 && player->team < 2)
|
|
||||||
{
|
|
||||||
sprintf(buf, "%4d", player->score);
|
|
||||||
float offsetx = player->team ? 400 : 0;
|
|
||||||
gfx_pretty_text(offsetx + x+60-gfx_pretty_text_width(48,buf), offsets[player->team], 48, buf);
|
|
||||||
gfx_pretty_text(offsetx + x+128, offsets[player->team], 48, client_datas[player->clientid].name);
|
|
||||||
|
|
||||||
int skin = skinseed + player->team;
|
|
||||||
render_tee(&idlestate, skin, vec2(1,0), vec2(offsetx + x+90, offsets[player->team]+24));
|
|
||||||
|
|
||||||
sprintf(buf, "%4d", player->latency);
|
|
||||||
//float tw = gfx_pretty_text_width(48.0f, buf);
|
|
||||||
gfx_pretty_text(offsetx + x + 240, offsets[player->team], 48, buf);
|
|
||||||
|
|
||||||
offsets[player->team] += 58.0f;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
* */
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
extern "C" void modc_render()
|
extern "C" void modc_render()
|
||||||
{
|
{
|
||||||
// this should be moved around abit
|
// this should be moved around abit
|
||||||
|
|
|
@ -106,6 +106,7 @@ int img_init()
|
||||||
void *data = map_get_data(img->image_data);
|
void *data = map_get_data(img->image_data);
|
||||||
//calc_mipmaps(data, img->width, img->height, data_res);
|
//calc_mipmaps(data, img->width, img->height, data_res);
|
||||||
map_textures[i] = gfx_load_texture_raw(img->width, img->height, IMG_RGBA, data);
|
map_textures[i] = gfx_load_texture_raw(img->width, img->height, IMG_RGBA, data);
|
||||||
|
map_unload_data(img->image_data);
|
||||||
}
|
}
|
||||||
|
|
||||||
//mem_free(data_res);
|
//mem_free(data_res);
|
||||||
|
|
|
@ -43,6 +43,10 @@ enum
|
||||||
{
|
{
|
||||||
MAPRES_SPAWNPOINT=1,
|
MAPRES_SPAWNPOINT=1,
|
||||||
MAPRES_ITEM=2,
|
MAPRES_ITEM=2,
|
||||||
|
MAPRES_SPAWNPOINT_RED=2,
|
||||||
|
MAPRES_SPAWNPOINT_BLUE=3,
|
||||||
|
MAPRES_FLAGSTAND_RED=4,
|
||||||
|
MAPRES_FLAGSTAND_BLUE=5,
|
||||||
|
|
||||||
ITEM_NULL=0,
|
ITEM_NULL=0,
|
||||||
ITEM_WEAPON_GUN=0x00010001,
|
ITEM_WEAPON_GUN=0x00010001,
|
||||||
|
|
|
@ -409,7 +409,7 @@ game_world world;
|
||||||
gameobject::gameobject()
|
gameobject::gameobject()
|
||||||
: entity(OBJTYPE_GAME)
|
: entity(OBJTYPE_GAME)
|
||||||
{
|
{
|
||||||
gametype = GAMETYPE_DM;
|
gametype = GAMETYPE_TDM;
|
||||||
game_over_tick = -1;
|
game_over_tick = -1;
|
||||||
sudden_death = 0;
|
sudden_death = 0;
|
||||||
round_start_tick = server_tick();
|
round_start_tick = server_tick();
|
||||||
|
|
Loading…
Reference in a new issue