mirror of
https://github.com/luanti-org/luanti.git
synced 2025-06-27 16:36:03 +00:00
Added a more flexible path system (and fixed some minor stuff)
This commit is contained in:
parent
dc414091e7
commit
6b6c2d37ea
22 changed files with 356 additions and 111 deletions
53
src/tile.cpp
53
src/tile.cpp
|
@ -18,27 +18,50 @@ with this program; if not, write to the Free Software Foundation, Inc.,
|
|||
*/
|
||||
|
||||
#include "tile.h"
|
||||
#include "porting.h"
|
||||
// For IrrlichtWrapper
|
||||
#include "main.h"
|
||||
#include <string>
|
||||
|
||||
// A mapping from tiles to paths of textures
|
||||
const char * g_tile_texture_paths[TILES_COUNT] =
|
||||
|
||||
const char * g_tile_texture_filenames[TILES_COUNT] =
|
||||
{
|
||||
NULL,
|
||||
"../data/stone.png",
|
||||
"../data/water.png",
|
||||
"../data/grass.png",
|
||||
"../data/tree.png",
|
||||
"../data/leaves.png",
|
||||
"../data/grass_footsteps.png",
|
||||
"../data/mese.png",
|
||||
"../data/mud.png",
|
||||
"../data/tree_top.png",
|
||||
"../data/mud_with_grass.png",
|
||||
"../data/cloud.png",
|
||||
"../data/coalstone.png",
|
||||
"../data/wood.png",
|
||||
"stone.png",
|
||||
"water.png",
|
||||
"grass.png",
|
||||
"tree.png",
|
||||
"leaves.png",
|
||||
"grass_footsteps.png",
|
||||
"mese.png",
|
||||
"mud.png",
|
||||
"tree_top.png",
|
||||
"mud_with_grass.png",
|
||||
"cloud.png",
|
||||
"coalstone.png",
|
||||
"wood.png",
|
||||
};
|
||||
|
||||
std::string g_tile_texture_path_strings[TILES_COUNT];
|
||||
const char * g_tile_texture_paths[TILES_COUNT] = {0};
|
||||
|
||||
void init_tile_texture_paths()
|
||||
{
|
||||
for(s32 i=0; i<TILES_COUNT; i++)
|
||||
{
|
||||
const char *filename = g_tile_texture_filenames[i];
|
||||
|
||||
if(filename != NULL)
|
||||
{
|
||||
g_tile_texture_path_strings[i] =
|
||||
porting::getDataPath(filename);
|
||||
g_tile_texture_paths[i] =
|
||||
g_tile_texture_path_strings[i].c_str();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
const char * tile_texture_path_get(u32 i)
|
||||
{
|
||||
assert(i < TILES_COUNT);
|
||||
|
@ -54,7 +77,7 @@ void tile_materials_preload(IrrlichtWrapper *irrlicht)
|
|||
{
|
||||
for(s32 i=0; i<TILES_COUNT; i++)
|
||||
{
|
||||
const char *path = g_tile_texture_paths[i];
|
||||
const char *path = tile_texture_path_get(i);
|
||||
|
||||
video::ITexture *t = NULL;
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue