mirror of
https://github.com/ddnet/ddnet.git
synced 2024-11-10 01:58:19 +00:00
parent
3857096a20
commit
5ff7836638
|
@ -1,7 +1,8 @@
|
|||
#include <stdio.h>
|
||||
#include <engine/graphics.h>
|
||||
#include <engine/keys.h> //temp
|
||||
#include <engine/keys.h>
|
||||
#include <engine/serverbrowser.h>
|
||||
#include <engine/shared/config.h>
|
||||
#include <engine/storage.h>
|
||||
|
||||
#include <game/layers.h>
|
||||
#include <game/client/gameclient.h>
|
||||
|
@ -126,20 +127,30 @@ void CMapLayers::OnRender()
|
|||
Render = true;
|
||||
}
|
||||
|
||||
if(pLayer->m_Type == LAYERTYPE_TILES && Input()->KeyPressed(KEY_KP0))
|
||||
if(Render && pLayer->m_Type == LAYERTYPE_TILES && Input()->KeyPressed(KEY_LCTRL) && Input()->KeyPressed(KEY_LSHIFT) && Input()->KeyDown(KEY_KP0))
|
||||
{
|
||||
CMapItemLayerTilemap *pTMap = (CMapItemLayerTilemap *)pLayer;
|
||||
CTile *pTiles = (CTile *)m_pLayers->Map()->GetData(pTMap->m_Data);
|
||||
char buf[256];
|
||||
str_format(buf, sizeof(buf), "%d%d_%dx%d", g, l, pTMap->m_Width, pTMap->m_Height);
|
||||
FILE *f = fopen(buf, "w");
|
||||
for(int y = 0; y < pTMap->m_Height; y++)
|
||||
CServerInfo CurrentServerInfo;
|
||||
Client()->GetServerInfo(&CurrentServerInfo);
|
||||
char aFilename[256];
|
||||
str_format(aFilename, sizeof(aFilename), "dumps/tilelayer_dump_%s-%d-%d-%dx%d.txt", CurrentServerInfo.m_aMap, g, l, pTMap->m_Width, pTMap->m_Height);
|
||||
IOHANDLE File = Storage()->OpenFile(aFilename, IOFLAG_WRITE);
|
||||
if(File)
|
||||
{
|
||||
for(int x = 0; x < pTMap->m_Width; x++)
|
||||
fprintf(f, "%d,", pTiles[y*pTMap->m_Width + x].m_Index);
|
||||
fprintf(f, "\n");
|
||||
#if defined(CONF_FAMILY_WINDOWS)
|
||||
static const char Newline[] = "\r\n";
|
||||
#else
|
||||
static const char Newline[] = "\n";
|
||||
#endif
|
||||
for(int y = 0; y < pTMap->m_Height; y++)
|
||||
{
|
||||
for(int x = 0; x < pTMap->m_Width; x++)
|
||||
io_write(File, &(pTiles[y*pTMap->m_Width + x].m_Index), sizeof(pTiles[y*pTMap->m_Width + x].m_Index));
|
||||
io_write(File, Newline, sizeof(Newline)-1);
|
||||
}
|
||||
io_close(File);
|
||||
}
|
||||
fclose(f);
|
||||
}
|
||||
|
||||
if(Render && !IsGameLayer)
|
||||
|
|
Loading…
Reference in a new issue