mirror of
https://github.com/AquariaOSE/Aquaria.git
synced 2024-11-25 09:44:02 +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;
|
||||
unsigned char *data = new unsigned char[MAX_GRID * MAX_GRID * sizeof(unsigned)];
|
||||
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)
|
||||
*ptr++ = game->isObstructed(tv, OT_MASK_BLACK) ? 0xFF000000 : 0xFFFFFFFF;
|
||||
if(tv.y == 0)
|
||||
break;
|
||||
}
|
||||
std::string outfn = dsq->getUserDataFolder() + "/griddump-" + game->sceneName + ".tga";
|
||||
tgaSaveRGBA(outfn.c_str(), MAX_GRID, MAX_GRID, data);
|
||||
dsq->screenMessage("Saved grid image to " + outfn);
|
||||
std::string outfn = dsq->getUserDataFolder() + "/griddump-" + game->sceneName + ".png";
|
||||
if(pngSaveRGBA(outfn.c_str(), MAX_GRID, MAX_GRID, data, 3))
|
||||
dsq->screenMessage("Saved grid image to " + outfn);
|
||||
else
|
||||
dsq->screenMessage("Failed to save grid dump: " + outfn);
|
||||
delete [] data;
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue