From 123e8fdf53ffb40c7464d0559a49e048fed79d7d Mon Sep 17 00:00:00 2001 From: Perttu Ahola Date: Mon, 20 Dec 2010 22:03:49 +0200 Subject: framework for modifying textures --- src/tile.cpp | 43 +++++++++++++++++++++++++++---------------- 1 file changed, 27 insertions(+), 16 deletions(-) (limited to 'src/tile.cpp') diff --git a/src/tile.cpp b/src/tile.cpp index 5161b2284..174c72fdf 100644 --- a/src/tile.cpp +++ b/src/tile.cpp @@ -18,36 +18,40 @@ with this program; if not, write to the Free Software Foundation, Inc., */ #include "tile.h" +#include "irrlichtwrapper.h" -const char * g_tile_texture_names[TILES_COUNT] = +// A mapping from tiles to paths of textures +const char * g_tile_texture_paths[TILES_COUNT] = { NULL, - "stone", - "water", - "grass", - "tree", - "leaves", - "grass_footsteps", - "mese", - "mud", - "tree_top", - "mud_with_grass", - "cloud", + "../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", }; +// A mapping from tiles to materials +// Initialized at run-time. video::SMaterial g_tile_materials[TILES_COUNT]; -void tile_materials_preload(TextureCache &cache) +void tile_materials_preload(IrrlichtWrapper *irrlicht) { for(s32 i=0; igetTexture(path); assert(t != NULL); } @@ -68,3 +72,10 @@ void tile_materials_preload(TextureCache &cache) //g_tile_materials[TILE_WATER].MaterialType = video::EMT_TRANSPARENT_ADD_COLOR; } +video::SMaterial & tile_material_get(u32 i) +{ + assert(i < TILES_COUNT); + + return g_tile_materials[i]; +} + -- cgit v1.2.3