mirror of
https://github.com/AquariaOSE/Aquaria.git
synced 2024-11-29 03:33:48 +00:00
dump obs as png, not as tga. also fix upside-down and memleak
This commit is contained in:
parent
c11d72f8e0
commit
7e93956e9c
1 changed files with 7 additions and 8 deletions
|
@ -3064,14 +3064,13 @@ void SceneEditor::dumpObs()
|
||||||
TileVector tv;
|
TileVector tv;
|
||||||
unsigned char *data = new unsigned char[MAX_GRID * MAX_GRID * sizeof(unsigned)];
|
unsigned char *data = new unsigned char[MAX_GRID * MAX_GRID * sizeof(unsigned)];
|
||||||
unsigned *ptr = (unsigned*)data;
|
unsigned *ptr = (unsigned*)data;
|
||||||
for(tv.y = MAX_GRID - 1; ; --tv.y)
|
for(tv.y = 0; tv.y < MAX_GRID; ++tv.y)
|
||||||
{
|
|
||||||
for(tv.x = 0; tv.x < MAX_GRID; ++tv.x)
|
for(tv.x = 0; tv.x < MAX_GRID; ++tv.x)
|
||||||
*ptr++ = game->isObstructed(tv, OT_MASK_BLACK) ? 0xFF000000 : 0xFFFFFFFF;
|
*ptr++ = game->isObstructed(tv, OT_MASK_BLACK) ? 0xFF000000 : 0xFFFFFFFF;
|
||||||
if(tv.y == 0)
|
std::string outfn = dsq->getUserDataFolder() + "/griddump-" + game->sceneName + ".png";
|
||||||
break;
|
if(pngSaveRGBA(outfn.c_str(), MAX_GRID, MAX_GRID, data, 3))
|
||||||
}
|
dsq->screenMessage("Saved grid image to " + outfn);
|
||||||
std::string outfn = dsq->getUserDataFolder() + "/griddump-" + game->sceneName + ".tga";
|
else
|
||||||
tgaSaveRGBA(outfn.c_str(), MAX_GRID, MAX_GRID, data);
|
dsq->screenMessage("Failed to save grid dump: " + outfn);
|
||||||
dsq->screenMessage("Saved grid image to " + outfn);
|
delete [] data;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue