Permalink
Browse files

* Added new altcode alt-914 This dumps out the current tileset

  to a file called 'custom_tiles.bmp' in the savegame directory.
  • Loading branch information...
yuv422 committed May 31, 2017
1 parent 9346dc3 commit 6628799802f8aaffd0d9c2279c65bb5e0adcbdd9
Showing with 60 additions and 3 deletions.
  1. +4 −0 ChangeLog
  2. +2 −2 TileManager.cpp
  3. +1 −1 TileManager.h
  4. +7 −0 data/scripts/common/common.lua
  5. +26 −0 ldoc/index.html
  6. +20 −0 script/Script.cpp
View
@@ -1,3 +1,7 @@
2017-05-31 Eric Fry <efry at users.sourceforge.net>
* Added new altcode alt-914 This dumps out the current tileset
to a file called 'custom_tiles.bmp' in the savegame directory.
2017-05-30 Eric Fry <efry at users.sourceforge.net>
* moved custom actor tiles from data/images/actors/U6 to
data/images/tiles/U6
View
@@ -975,7 +975,7 @@ void TileManager::freeCustomTiles()
}
}
void TileManager::exportTilesetToBmpFile(std::string filename)
void TileManager::exportTilesetToBmpFile(std::string filename, bool fixupU6Shoreline)
{
NuvieBmpFile bmp;
@@ -996,7 +996,7 @@ void TileManager::exportTilesetToBmpFile(std::string filename)
{
for(uint8 j=0;j<32;j++)
{
if(game_type == NUVIE_GAME_U6 && (i*32+j) >= 16 && (i*32+j) < 48) //lay down the base tile for shoreline tiles
if(fixupU6Shoreline && game_type == NUVIE_GAME_U6 && (i*32+j) >= 16 && (i*32+j) < 48) //lay down the base tile for shoreline tiles
{
writeBmpTileData(&data[i*16*512 + j*16], get_anim_base_tile(i*32+j), false);
writeBmpTileData(&data[i*16*512 + j*16], &tile[tileindex[i*32+j]], true);
View
@@ -192,7 +192,7 @@ class TileManager
Tile *loadCustomTiles(const std::string filename, bool overwrite_tiles, bool copy_tileflags, uint16 tile_num_start_offset);
void freeCustomTiles();
void exportTilesetToBmpFile(std::string filename);
void exportTilesetToBmpFile(std::string filename, bool fixupU6Shoreline=true);
protected:
bool loadAnimData();
@@ -307,6 +307,12 @@ function altcode_913_export_tmx_map_files()
end
end
function altcode_914_export_tileset()
print("Exporting tileset to \"custom_tiles.bmp\" in the savegame directory.\n")
tileset_export("custom_tiles.bmp")
print("done.\n\n")
end
function altcode_999_find_objs_on_map()
print("Find Object\nObj_n: ")
local input = input_select(nil, true)
@@ -344,6 +350,7 @@ local altcode_tbl = {
[242]=altcode_242_set_actor_talk_flag,
[250]=altcode_250_create_object,
[913]=altcode_913_export_tmx_map_files,
[914]=altcode_914_export_tileset,
[999]=altcode_999_find_objs_on_map,
}
View
@@ -119,6 +119,10 @@ <h2><a href="#Functions">Functions</a></h2>
<td class="summary">export map to Tiled TMX files.</td>
</tr>
<tr>
<td class="name" nowrap><a href="#tileset_export">tileset_export (filename)</a></td>
<td class="summary">export tileset to a bmp file in the current savegame directory.</td>
</tr>
<tr>
<td class="name" nowrap><a href="#tile_get_flag">tile_get_flag (tile_number, flag_set, bit_number)</a></td>
<td class="summary">get a tile flag for a given tile number</td>
</tr>
@@ -1030,6 +1034,28 @@ <h3>Returns:</h3>
</dd>
<dt>
<a name = "tileset_export"></a>
<strong>tileset_export (filename)</strong>
</dt>
<dd>
export tileset to a bmp file in the current savegame directory.
<h3>Parameters:</h3>
<ul>
<li><span class="parameter">filename</span>
<span class="types"><a class="type" href="http://www.lua.org/manual/5.2/manual.html#6.4">string</a></span>
</li>
</ul>
</dd>
<dt>
<a name = "tile_get_flag"></a>
View
@@ -276,6 +276,8 @@ static int nscript_map_enable_temp_actor_cleaning(lua_State *L);
static int nscript_map_export_tmx_files(lua_State *L);
static int nscript_tileset_export(lua_State *L);
static int nscript_tile_get_flag(lua_State *L);
static int nscript_tile_get_description(lua_State *L);
@@ -753,6 +755,9 @@ Script::Script(Configuration *cfg, GUI *gui, SoundManager *sm, nuvie_game_t type
lua_pushcfunction(L, nscript_map_export_tmx_files);
lua_setglobal(L, "map_export_tmx_files");
lua_pushcfunction(L, nscript_tileset_export);
lua_setglobal(L, "tileset_export");
lua_pushcfunction(L, nscript_game_get_ui_style);
lua_setglobal(L, "game_get_ui_style");
@@ -3437,6 +3442,21 @@ static int nscript_map_export_tmx_files(lua_State *L)
return 1;
}
/***
export tileset to a bmp file in the current savegame directory.
@function tileset_export
@string filename
*/
static int nscript_tileset_export(lua_State *L)
{
Game *game = Game::get_game();
std::string filename(lua_tostring(L, 1));
std::string path;
build_path(game->get_save_manager()->get_savegame_directory(), filename, path);
game->get_tile_manager()->exportTilesetToBmpFile(path, false);
return 0;
}
/***
get a tile flag for a given tile number
@function tile_get_flag

0 comments on commit 6628799

Please sign in to comment.