#define DEBUGFILE "debug.txt"
+#define WATER_ALPHA 160
+
// Define for simulating the quirks of sending through internet.
// Causes the socket class to deliberately drop random packets.
// This disables unit testing of socket and connection.
return newtexture;
}
+video::ITexture * SideGrassTextureMod::make(video::ITexture *original,
+ const char *newname, video::IVideoDriver* driver)
+{
+ // Size of the base image
+ core::dimension2d<u32> dim(16, 16);
+ // Position to copy the grass to in the base image
+ core::position2d<s32> pos_base(0, 0);
+ // Position to copy the grass from in the grass image
+ core::position2d<s32> pos_other(0, 0);
+
+ video::IImage *baseimage = driver->createImage(original, pos_base, dim);
+ assert(baseimage);
+
+ video::IImage *grassimage = driver->createImageFromFile(porting::getDataPath("grass_side.png").c_str());
+ assert(grassimage);
+
+ // Then copy the right part of grassimage to baseimage
+
+ grassimage->copyToWithAlpha(baseimage, v2s32(0,0),
+ core::rect<s32>(pos_other, dim),
+ video::SColor(255,255,255,255),
+ NULL);
+
+ grassimage->drop();
+
+ // Create texture from resulting image
+
+ video::ITexture *newtexture = driver->addTexture(newname, baseimage);
+
+ baseimage->drop();
+
+ return newtexture;
+}
+
video::ITexture * ProgressBarTextureMod::make(video::ITexture *original,
const char *newname, video::IVideoDriver* driver)
{
u16 progression;
};
+struct SideGrassTextureMod: public TextureMod
+{
+ SideGrassTextureMod()
+ {
+ }
+
+ virtual video::ITexture * make(video::ITexture *original,
+ const char *newname, video::IVideoDriver* driver);
+};
+
struct ProgressBarTextureMod: public TextureMod
{
// value is from 0.0 to 1.0
- This will allow saving ages of rats on disk but not sending\r
them to clients\r
\r
-SUGG: Implement lighting using VoxelManipulator\r
- - Would it be significantly faster?\r
-\r
SUGG: MovingObject::move and Player::move are basically the same.\r
combine them.\r
\r
sectors that have very large amounts of blocks (on client)\r
- Is this necessary at all?\r
\r
+TODO: Flowing water animation\r
+\r
Configuration:\r
--------------\r
\r
- TODO: For incoming blocks, time difference is calculated and\r
objects are stepped according to it.\r
\r
-Map generator:\r
---------------\r
+Map:\r
+----\r
\r
NOTE: There are some lighting-related todos and fixmes in\r
ServerMap::emergeBlock. And there always will be. 8)\r
- Cliffs, arcs\r
- There could be a certain height (to which mountains only reach)\r
where some minerals are found\r
+ - Create a system that allows a huge amount of different "map\r
+ generator modules/filters"\r
\r
TODO: Change AttributeList to split the area into smaller sections so\r
that searching won't be as heavy.\r
\r
TODO: Remove HMParams\r
\r
+TODO: Flowing water to actually contain flow direction information\r
+\r
+TODO: Faster lighting using VoxelManipulator\r
+\r
Doing now:\r
----------\r
\r
*/\r
\r
init_content_inventory_texture_paths();\r
- init_tile_texture_paths();\r
- tile_materials_preload(g_irrlicht);\r
+ init_tile_textures();\r
\r
/*\r
GUI stuff\r
}
// If n2_changed to bottom, don't flow anywhere else
- if(to_bottom && flowed)
+ if(to_bottom && flowed && !is_source)
break;
}catch(InvalidPositionException &e)
float randmax = 0;
float randfactor = 0;
- if(myrand()%4 == 0)
+ if(myrand()%5 == 0)
{
baseheight = 100;
randmax = 50;
(float)(myrand()%ued)+0.5
);
s16 min_d = 0;
- s16 max_d = 6;
+ s16 max_d = 4;
s16 rs = (myrand()%(max_d-min_d+1))+min_d;
v3f vec = rp - orp;
if(tile.id == TILE_WATER)
{
- alpha = 128;
+ alpha = WATER_ALPHA;
}
video::SColor c = video::SColor(alpha,li,li,li);
}catch(InvalidPositionException &e){}
u8 l = decode_light(n.getLightBlend(daynight_ratio));
- video::SColor c(128,l,l,l);
+ video::SColor c(WATER_ALPHA,l,l,l);
// Neighbor water levels (key = relative position)
// Includes current node
// A mapping from tiles to paths of textures
-const char * g_tile_texture_filenames[TILES_COUNT] =
+/*const char * g_tile_texture_filenames[TILES_COUNT] =
{
NULL,
"stone.png",
"mese.png",
"mud.png",
"tree_top.png",
- "mud_with_grass.png",
+ "mud.png_sidegrass",
"cloud.png",
"coalstone.png",
"wood.png",
-};
+};*/
+
+/*
+ These can either be real paths or generated names of preloaded
+ textures (like "mud.png_sidegrass")
+*/
+std::string g_tile_texture_paths[TILES_COUNT];
-std::string g_tile_texture_path_strings[TILES_COUNT];
+/*std::string g_tile_texture_path_strings[TILES_COUNT];
const char * g_tile_texture_paths[TILES_COUNT] = {0};
void init_tile_texture_paths()
g_tile_texture_path_strings[i].c_str();
}
}
-}
+}*/
const char * tile_texture_path_get(u32 i)
{
assert(i < TILES_COUNT);
- return g_tile_texture_paths[i];
+ //return g_tile_texture_paths[i];
+ return g_tile_texture_paths[i].c_str();
}
// A mapping from tiles to materials
// Initialized at run-time.
video::SMaterial g_tile_materials[TILES_COUNT];
-void tile_materials_preload(IrrlichtWrapper *irrlicht)
+enum TileTextureModID
+{
+ TTMID_NONE,
+ TTMID_SIDEGRASS,
+};
+
+struct TileTextureSpec
+{
+ const char *filename;
+ enum TileTextureModID mod;
+};
+
+/*
+ Initializes g_tile_texture_paths with paths of textures,
+ generates generated textures and creates the tile material array.
+*/
+void init_tile_textures()
{
+ TileTextureSpec tile_texture_specs[TILES_COUNT] =
+ {
+ {NULL, TTMID_NONE},
+ {"stone.png", TTMID_NONE},
+ {"water.png", TTMID_NONE},
+ {"grass.png", TTMID_NONE},
+ {"tree.png", TTMID_NONE},
+ {"leaves.png", TTMID_NONE},
+ {"grass_footsteps.png", TTMID_NONE},
+ {"mese.png", TTMID_NONE},
+ {"mud.png", TTMID_NONE},
+ {"tree_top.png", TTMID_NONE},
+ {"mud.png", TTMID_SIDEGRASS},
+ {"cloud.png", TTMID_NONE},
+ {"coalstone.png", TTMID_NONE},
+ {"wood.png", TTMID_NONE},
+ };
+
+ for(s32 i=0; i<TILES_COUNT; i++)
+ {
+ const char *filename = tile_texture_specs[i].filename;
+ enum TileTextureModID mod_id = tile_texture_specs[i].mod;
+
+ if(filename != NULL && std::string("") != filename)
+ {
+ std::string path = porting::getDataPath(filename);
+ std::string mod_postfix = "";
+ if(mod_id == TTMID_SIDEGRASS)
+ {
+ mod_postfix = "_sidegrass";
+ // Generate texture
+ TextureMod *mod = new SideGrassTextureMod();
+ g_irrlicht->getTexture(TextureSpec(path + mod_postfix,
+ path, mod));
+ }
+ g_tile_texture_paths[i] = path + mod_postfix;
+ }
+ }
+
for(s32 i=0; i<TILES_COUNT; i++)
{
const char *path = tile_texture_path_get(i);
video::ITexture *t = NULL;
- if(path != NULL)
+ if(path != NULL && std::string("") != path)
{
- t = irrlicht->getTexture(path);
+ t = g_irrlicht->getTexture(path);
assert(t != NULL);
}
g_tile_materials[i].setTexture(0, t);
}
-
+
g_tile_materials[TILE_WATER].MaterialType = video::EMT_TRANSPARENT_VERTEX_ALPHA;
//g_tile_materials[TILE_WATER].MaterialType = video::EMT_TRANSPARENT_ADD_COLOR;
}
Functions
*/
-void init_tile_texture_paths();
+void init_tile_textures();
const char * tile_texture_path_get(u32 i);
-// Initializes g_tile_materials
-void tile_materials_preload(IrrlichtWrapper *irrlicht);
-
video::SMaterial & tile_material_get(u32 i);
#endif