forked from Mirrorlandia_minetest/minetest
tinkering around
This commit is contained in:
parent
be2c7dfb97
commit
f501cfd799
@ -40,6 +40,10 @@ cp -r data/torch_on_ceiling.png $PACKAGEPATH/data/
|
||||
cp -r data/skybox1.png $PACKAGEPATH/data/
|
||||
cp -r data/skybox2.png $PACKAGEPATH/data/
|
||||
cp -r data/skybox3.png $PACKAGEPATH/data/
|
||||
cp -r data/tree_top.png $PACKAGEPATH/data/
|
||||
cp -r data/mud_with_grass.png $PACKAGEPATH/data/
|
||||
|
||||
cp -r data/pauseMenu.gui $PACKAGEPATH/data/
|
||||
|
||||
cp -r doc/README.txt $PACKAGEPATH/doc/README.txt
|
||||
|
||||
|
@ -194,6 +194,10 @@
|
||||
RelativePath=".\src\filesys.cpp"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath=".\src\guiPauseMenu.cpp"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath=".\src\heightmap.cpp"
|
||||
>
|
||||
|
@ -1401,11 +1401,11 @@ void Client::addNodeFromInventory(v3s16 nodepos, u16 i)
|
||||
}
|
||||
#endif
|
||||
|
||||
void Client::clickGround(u8 button, v3s16 nodepos_undersurface,
|
||||
void Client::pressGround(u8 button, v3s16 nodepos_undersurface,
|
||||
v3s16 nodepos_oversurface, u16 item)
|
||||
{
|
||||
if(connectedAndInitialized() == false){
|
||||
dout_client<<DTIME<<"Client::clickGround() "
|
||||
dout_client<<DTIME<<"Client::pressGround() "
|
||||
"cancelled (not connected)"
|
||||
<<std::endl;
|
||||
return;
|
||||
@ -1421,7 +1421,7 @@ void Client::clickGround(u8 button, v3s16 nodepos_undersurface,
|
||||
*/
|
||||
u8 datasize = 2 + 1 + 6 + 6 + 2;
|
||||
SharedBuffer<u8> data(datasize);
|
||||
writeU16(&data[0], TOSERVER_CLICK_GROUND);
|
||||
writeU16(&data[0], TOSERVER_PRESS_GROUND);
|
||||
writeU8(&data[2], button);
|
||||
writeV3S16(&data[3], nodepos_undersurface);
|
||||
writeV3S16(&data[9], nodepos_oversurface);
|
||||
|
@ -193,7 +193,7 @@ public:
|
||||
|
||||
/*void removeNode(v3s16 nodepos);
|
||||
void addNodeFromInventory(v3s16 nodepos, u16 i);*/
|
||||
void clickGround(u8 button, v3s16 nodepos_undersurface,
|
||||
void pressGround(u8 button, v3s16 nodepos_undersurface,
|
||||
v3s16 nodepos_oversurface, u16 item);
|
||||
void clickObject(u8 button, v3s16 blockpos, s16 id, u16 item);
|
||||
void release(u8 button);
|
||||
|
@ -159,7 +159,7 @@ enum ToServerCommand
|
||||
[11] u16 item
|
||||
*/
|
||||
|
||||
TOSERVER_CLICK_GROUND = 0x28,
|
||||
TOSERVER_PRESS_GROUND = 0x28,
|
||||
/*
|
||||
length: 17
|
||||
[0] u16 command
|
||||
|
@ -45,6 +45,7 @@ with this program; if not, write to the Free Software Foundation, Inc.,
|
||||
#define SERVER_MAP_SAVE_INTERVAL (10)*/
|
||||
|
||||
#define FOV_ANGLE (PI/2.5)
|
||||
//#define FOV_ANGLE (PI/2.25)
|
||||
|
||||
// The absolute working limit is (2^15 - viewing_range).
|
||||
#define MAP_GENERATION_LIMIT (31000)
|
||||
|
107
src/main.cpp
107
src/main.cpp
@ -280,6 +280,7 @@ JMutex g_range_mutex;
|
||||
|
||||
// Blocks are viewed in this range from the player
|
||||
s16 g_viewing_range_nodes = 60;
|
||||
//s16 g_viewing_range_nodes = 0;
|
||||
|
||||
// This is updated by the client's fetchBlocks routine
|
||||
//s16 g_actual_viewing_range_nodes = VIEWING_RANGE_NODES_DEFAULT;
|
||||
@ -311,7 +312,7 @@ void set_default_settings()
|
||||
g_settings.set("wanted_fps", "30");
|
||||
g_settings.set("fps_max", "60");
|
||||
g_settings.set("viewing_range_nodes_max", "300");
|
||||
g_settings.set("viewing_range_nodes_min", "50");
|
||||
g_settings.set("viewing_range_nodes_min", "35");
|
||||
g_settings.set("screenW", "");
|
||||
g_settings.set("screenH", "");
|
||||
g_settings.set("host_game", "");
|
||||
@ -796,7 +797,8 @@ void updateViewingRange(f32 frametime, Client *client)
|
||||
static bool fraction_is_good = false;
|
||||
|
||||
float fraction_good_threshold = 0.1;
|
||||
float fraction_bad_threshold = 0.25;
|
||||
//float fraction_bad_threshold = 0.25;
|
||||
float fraction_bad_threshold = 0.1;
|
||||
float fraction_limit;
|
||||
// Use high limit if fraction is good AND the fraction would
|
||||
// lower the range. We want to keep the range fairly high.
|
||||
@ -1294,48 +1296,6 @@ int main(int argc, char *argv[])
|
||||
guienv->drawAll();
|
||||
driver->endScene();
|
||||
|
||||
/*
|
||||
Initialize material array
|
||||
*/
|
||||
|
||||
/*//video::SMaterial g_materials[MATERIALS_COUNT];
|
||||
for(u16 i=0; i<MATERIALS_COUNT; i++)
|
||||
{
|
||||
g_materials[i].Lighting = false;
|
||||
g_materials[i].BackfaceCulling = false;
|
||||
|
||||
const char *filename = g_content_filenames[i];
|
||||
if(filename != NULL){
|
||||
video::ITexture *t = driver->getTexture(filename);
|
||||
if(t == NULL){
|
||||
std::cout<<DTIME<<"Texture could not be loaded: \""
|
||||
<<filename<<"\""<<std::endl;
|
||||
return 1;
|
||||
}
|
||||
g_materials[i].setTexture(0, driver->getTexture(filename));
|
||||
}
|
||||
//g_materials[i].setFlag(video::EMF_TEXTURE_WRAP, video::ETC_REPEAT);
|
||||
g_materials[i].setFlag(video::EMF_BILINEAR_FILTER, false);
|
||||
//g_materials[i].setFlag(video::EMF_ANISOTROPIC_FILTER, false);
|
||||
//g_materials[i].setFlag(video::EMF_FOG_ENABLE, true);
|
||||
}
|
||||
|
||||
g_materials[CONTENT_WATER].MaterialType = video::EMT_TRANSPARENT_VERTEX_ALPHA;
|
||||
//g_materials[CONTENT_WATER].MaterialType = video::EMT_TRANSPARENT_ADD_COLOR;
|
||||
g_materials[CONTENT_OCEAN].MaterialType = video::EMT_TRANSPARENT_VERTEX_ALPHA;
|
||||
*/
|
||||
|
||||
/*g_mesh_materials[0].setTexture(0, driver->getTexture("../data/water.png"));
|
||||
g_mesh_materials[1].setTexture(0, driver->getTexture("../data/grass.png"));
|
||||
g_mesh_materials[2].setTexture(0, driver->getTexture("../data/stone.png"));
|
||||
for(u32 i=0; i<3; i++)
|
||||
{
|
||||
g_mesh_materials[i].Lighting = false;
|
||||
g_mesh_materials[i].BackfaceCulling = false;
|
||||
g_mesh_materials[i].setFlag(video::EMF_BILINEAR_FILTER, false);
|
||||
g_mesh_materials[i].setFlag(video::EMF_FOG_ENABLE, true);
|
||||
}*/
|
||||
|
||||
/*
|
||||
Preload some random textures that are used in threads
|
||||
*/
|
||||
@ -1463,9 +1423,15 @@ int main(int argc, char *argv[])
|
||||
|
||||
f32 camera_yaw = 0; // "right/left"
|
||||
f32 camera_pitch = 0; // "up/down"
|
||||
|
||||
/*
|
||||
Move into game
|
||||
*/
|
||||
|
||||
gui_loadingtext->remove();
|
||||
|
||||
pauseMenu.setVisible(true);
|
||||
|
||||
/*
|
||||
Add some gui stuff
|
||||
*/
|
||||
@ -1473,12 +1439,12 @@ int main(int argc, char *argv[])
|
||||
// First line of debug text
|
||||
gui::IGUIStaticText *guitext = guienv->addStaticText(
|
||||
L"Minetest-c55",
|
||||
core::rect<s32>(5, 5, 5+600, 5+textsize.Y),
|
||||
core::rect<s32>(5, 5, 795, 5+textsize.Y),
|
||||
false, false);
|
||||
// Second line of debug text
|
||||
gui::IGUIStaticText *guitext2 = guienv->addStaticText(
|
||||
L"",
|
||||
core::rect<s32>(5, 5+(textsize.Y+5)*1, 5+600, (5+textsize.Y)*2),
|
||||
core::rect<s32>(5, 5+(textsize.Y+5)*1, 795, (5+textsize.Y)*2),
|
||||
false, false);
|
||||
|
||||
// At the middle of the screen
|
||||
@ -1498,6 +1464,7 @@ int main(int argc, char *argv[])
|
||||
Some statistics are collected in these
|
||||
*/
|
||||
u32 drawtime = 0;
|
||||
u32 beginscenetime = 0;
|
||||
u32 scenetime = 0;
|
||||
u32 endscenetime = 0;
|
||||
|
||||
@ -2063,14 +2030,14 @@ int main(int argc, char *argv[])
|
||||
//std::cout<<DTIME<<"Removing node"<<std::endl;
|
||||
//client.removeNode(nodepos);
|
||||
std::cout<<DTIME<<"Ground left-clicked"<<std::endl;
|
||||
client.clickGround(0, nodepos, neighbourpos, g_selected_item);
|
||||
client.pressGround(0, nodepos, neighbourpos, g_selected_item);
|
||||
}
|
||||
if(g_input->getRightClicked())
|
||||
{
|
||||
//std::cout<<DTIME<<"Placing node"<<std::endl;
|
||||
//client.addNodeFromInventory(neighbourpos, g_selected_item);
|
||||
std::cout<<DTIME<<"Ground right-clicked"<<std::endl;
|
||||
client.clickGround(1, nodepos, neighbourpos, g_selected_item);
|
||||
client.pressGround(1, nodepos, neighbourpos, g_selected_item);
|
||||
}
|
||||
}
|
||||
else{
|
||||
@ -2089,6 +2056,21 @@ int main(int argc, char *argv[])
|
||||
|
||||
camera->setAspectRatio((f32)screensize.X / (f32)screensize.Y);
|
||||
|
||||
/*f32 range = g_viewing_range_nodes * BS;
|
||||
if(g_viewing_range_all)
|
||||
range = 100000*BS;
|
||||
|
||||
driver->setFog(
|
||||
skycolor,
|
||||
video::EFT_FOG_LINEAR,
|
||||
range*0.6,
|
||||
range,
|
||||
0.01,
|
||||
false, // pixel fog
|
||||
false // range fog
|
||||
);*/
|
||||
|
||||
|
||||
/*
|
||||
Update gui stuff (0ms)
|
||||
*/
|
||||
@ -2096,23 +2078,26 @@ int main(int argc, char *argv[])
|
||||
//TimeTaker guiupdatetimer("Gui updating", device);
|
||||
|
||||
{
|
||||
wchar_t temptext[100];
|
||||
wchar_t temptext[150];
|
||||
|
||||
static float drawtime_avg = 0;
|
||||
drawtime_avg = drawtime_avg * 0.98 + (float)drawtime*0.02;
|
||||
static float beginscenetime_avg = 0;
|
||||
beginscenetime_avg = beginscenetime_avg * 0.98 + (float)beginscenetime*0.02;
|
||||
static float scenetime_avg = 0;
|
||||
scenetime_avg = scenetime_avg * 0.98 + (float)scenetime*0.02;
|
||||
static float endscenetime_avg = 0;
|
||||
endscenetime_avg = endscenetime_avg * 0.98 + (float)endscenetime*0.02;
|
||||
|
||||
swprintf(temptext, 100, L"Minetest-c55 ("
|
||||
swprintf(temptext, 150, L"Minetest-c55 ("
|
||||
L"F: item=%i"
|
||||
L", R: range_all=%i"
|
||||
L")"
|
||||
L" drawtime=%.0f, scenetime=%.0f, endscenetime=%.0f",
|
||||
L" drawtime=%.0f, beginscenetime=%.0f, scenetime=%.0f, endscenetime=%.0f",
|
||||
g_selected_item,
|
||||
g_viewing_range_all,
|
||||
drawtime_avg,
|
||||
beginscenetime_avg,
|
||||
scenetime_avg,
|
||||
endscenetime_avg
|
||||
);
|
||||
@ -2121,19 +2106,8 @@ int main(int argc, char *argv[])
|
||||
}
|
||||
|
||||
{
|
||||
wchar_t temptext[100];
|
||||
/*swprintf(temptext, 100,
|
||||
L"("
|
||||
L"% .3f < btime_jitter < % .3f"
|
||||
L", dtime_jitter = % .1f %%"
|
||||
//L", ftime_ratio = % .3f"
|
||||
L")",
|
||||
busytime_jitter1_min_sample,
|
||||
busytime_jitter1_max_sample,
|
||||
dtime_jitter1_max_fraction * 100.0
|
||||
//g_freetime_ratio
|
||||
);*/
|
||||
swprintf(temptext, 100,
|
||||
wchar_t temptext[150];
|
||||
swprintf(temptext, 150,
|
||||
L"(% .1f, % .1f, % .1f)"
|
||||
L" (% .3f < btime_jitter < % .3f"
|
||||
L", dtime_jitter = % .1f %%)",
|
||||
@ -2232,8 +2206,11 @@ int main(int argc, char *argv[])
|
||||
//video::SColor bgcolor = video::SColor(255,90,140,200);
|
||||
video::SColor bgcolor = skycolor;
|
||||
|
||||
// 0ms
|
||||
{
|
||||
TimeTaker timer("beginScene", device);
|
||||
driver->beginScene(true, true, bgcolor);
|
||||
beginscenetime = timer.stop(true);
|
||||
}
|
||||
|
||||
//timer3.stop();
|
||||
|
||||
|
13
src/map.cpp
13
src/map.cpp
@ -2835,6 +2835,17 @@ void ClientMap::deSerializeSector(v2s16 p2d, std::istream &is)
|
||||
sector->deSerialize(is);
|
||||
}
|
||||
|
||||
void ClientMap::OnRegisterSceneNode()
|
||||
{
|
||||
if(IsVisible)
|
||||
{
|
||||
SceneManager->registerNodeForRendering(this, scene::ESNRP_SOLID);
|
||||
SceneManager->registerNodeForRendering(this, scene::ESNRP_TRANSPARENT);
|
||||
}
|
||||
|
||||
ISceneNode::OnRegisterSceneNode();
|
||||
}
|
||||
|
||||
void ClientMap::renderMap(video::IVideoDriver* driver, s32 pass)
|
||||
{
|
||||
//m_dout<<DTIME<<"Rendering map..."<<std::endl;
|
||||
@ -2971,6 +2982,8 @@ void ClientMap::renderMap(video::IVideoDriver* driver, s32 pass)
|
||||
{
|
||||
// If block is far away, don't draw it
|
||||
if(d > viewing_range_nodes * BS)
|
||||
// This is nicer when fog is used
|
||||
//if((dforward+d)/2 > viewing_range_nodes * BS)
|
||||
continue;
|
||||
}
|
||||
|
||||
|
12
src/map.h
12
src/map.h
@ -545,17 +545,7 @@ public:
|
||||
ISceneNode methods
|
||||
*/
|
||||
|
||||
virtual void OnRegisterSceneNode()
|
||||
{
|
||||
if(IsVisible)
|
||||
{
|
||||
//SceneManager->registerNodeForRendering(this, scene::ESNRP_SKY_BOX);
|
||||
SceneManager->registerNodeForRendering(this, scene::ESNRP_SOLID);
|
||||
SceneManager->registerNodeForRendering(this, scene::ESNRP_TRANSPARENT);
|
||||
}
|
||||
|
||||
ISceneNode::OnRegisterSceneNode();
|
||||
}
|
||||
virtual void OnRegisterSceneNode();
|
||||
|
||||
virtual void render()
|
||||
{
|
||||
|
@ -118,9 +118,6 @@ FastFace * MapBlock::makeFastFace(u16 tile, u8 light, v3f p,
|
||||
|
||||
u8 alpha = 255;
|
||||
|
||||
//if(material == CONTENT_WATER || material == CONTENT_OCEAN)
|
||||
//TODO: Umm?
|
||||
//if(tile == CONTENT_WATER || tile == CONTENT_OCEAN)
|
||||
if(tile == TILE_WATER)
|
||||
{
|
||||
alpha = 128;
|
||||
@ -139,7 +136,7 @@ FastFace * MapBlock::makeFastFace(u16 tile, u8 light, v3f p,
|
||||
|
||||
f->tile = tile;
|
||||
//DEBUG
|
||||
//f->tile = TILE_GRASS;
|
||||
//f->tile = TILE_STONE;
|
||||
|
||||
return f;
|
||||
}
|
||||
|
@ -1466,7 +1466,7 @@ void Server::ProcessData(u8 *data, u32 datasize, u16 peer_id)
|
||||
block->removeObject(id);
|
||||
}
|
||||
}
|
||||
else if(command == TOSERVER_CLICK_GROUND)
|
||||
else if(command == TOSERVER_PRESS_GROUND)
|
||||
{
|
||||
if(datasize < 17)
|
||||
return;
|
||||
|
@ -53,9 +53,17 @@ void tile_materials_preload(TextureCache &cache)
|
||||
g_tile_materials[i].Lighting = false;
|
||||
g_tile_materials[i].BackfaceCulling = false;
|
||||
g_tile_materials[i].setFlag(video::EMF_BILINEAR_FILTER, false);
|
||||
g_tile_materials[i].setFlag(video::EMF_ANTI_ALIASING, video::EAAM_OFF);
|
||||
//if(i != TILE_WATER)
|
||||
//g_tile_materials[i].setFlag(video::EMF_FOG_ENABLE, true);
|
||||
|
||||
//g_tile_materials[i].setFlag(video::EMF_TEXTURE_WRAP, video::ETC_REPEAT);
|
||||
//g_tile_materials[i].setFlag(video::EMF_ANISOTROPIC_FILTER, false);
|
||||
|
||||
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;
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user