forked from Mirrorlandia_minetest/minetest
Some fiddling around with fog... not much changed
This commit is contained in:
parent
7701753131
commit
467f43d47c
105
src/main.cpp
105
src/main.cpp
@ -277,6 +277,7 @@ Doing now (most important at the top):
|
|||||||
placement and transfer
|
placement and transfer
|
||||||
* only_from_disk might not work anymore - check and fix it.
|
* only_from_disk might not work anymore - check and fix it.
|
||||||
* Check the fixmes in the list above
|
* Check the fixmes in the list above
|
||||||
|
* FIXME: Sneaking doesn't switch sneak node when moving sideways
|
||||||
|
|
||||||
=== Making it more portable
|
=== Making it more portable
|
||||||
* Some MSVC: std::sto* are defined without a namespace and collide
|
* Some MSVC: std::sto* are defined without a namespace and collide
|
||||||
@ -398,6 +399,12 @@ extern void set_default_settings();
|
|||||||
IrrlichtDevice *g_device = NULL;
|
IrrlichtDevice *g_device = NULL;
|
||||||
Client *g_client = NULL;
|
Client *g_client = NULL;
|
||||||
|
|
||||||
|
//const s16 quickinv_size = 48;
|
||||||
|
//const s16 quickinv_spacing = 64;
|
||||||
|
const s16 quickinv_size = 32;
|
||||||
|
const s16 quickinv_spacing = 40;
|
||||||
|
const s16 quickinv_itemcount = 8;
|
||||||
|
|
||||||
/*
|
/*
|
||||||
GUI Stuff
|
GUI Stuff
|
||||||
*/
|
*/
|
||||||
@ -1172,7 +1179,7 @@ void updateViewingRange(f32 frametime_in, Client *client)
|
|||||||
frametime_old = frametime;
|
frametime_old = frametime;
|
||||||
}
|
}
|
||||||
|
|
||||||
class GUIQuickInventory : public IEventReceiver
|
class GUIQuickInventory
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
GUIQuickInventory(
|
GUIQuickInventory(
|
||||||
@ -1184,26 +1191,27 @@ public:
|
|||||||
m_itemcount(itemcount),
|
m_itemcount(itemcount),
|
||||||
m_inventory(inventory)
|
m_inventory(inventory)
|
||||||
{
|
{
|
||||||
core::rect<s32> imgsize(0,0,48,48);
|
core::rect<s32> imgsize(0,0,quickinv_size,quickinv_size);
|
||||||
core::rect<s32> textsize(0,0,48,16);
|
core::rect<s32> textsize(0,0,quickinv_size,quickinv_size);
|
||||||
v2s32 spacing(0, 64);
|
|
||||||
for(s32 i=0; i<m_itemcount; i++)
|
for(s32 i=0; i<m_itemcount; i++)
|
||||||
{
|
{
|
||||||
m_images.push_back(env->addImage(
|
m_images.push_back(env->addImage(
|
||||||
imgsize + pos + spacing*i
|
imgsize
|
||||||
));
|
));
|
||||||
m_images[i]->setScaleImage(true);
|
m_images[i]->setScaleImage(true);
|
||||||
m_texts.push_back(env->addStaticText(
|
m_texts.push_back(env->addStaticText(
|
||||||
L"",
|
L"",
|
||||||
textsize + pos + spacing*i,
|
textsize,
|
||||||
false, false
|
false, false
|
||||||
));
|
));
|
||||||
m_texts[i]->setBackgroundColor(
|
/*m_texts[i]->setBackgroundColor(
|
||||||
video::SColor(128,0,0,0));
|
video::SColor(128,0,0,0));*/
|
||||||
m_texts[i]->setTextAlignment(
|
m_texts[i]->setTextAlignment(
|
||||||
gui::EGUIA_CENTER,
|
gui::EGUIA_LOWERRIGHT,
|
||||||
gui::EGUIA_UPPERLEFT);
|
gui::EGUIA_LOWERRIGHT);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
updatePosition(pos);
|
||||||
}
|
}
|
||||||
|
|
||||||
~GUIQuickInventory()
|
~GUIQuickInventory()
|
||||||
@ -1218,9 +1226,14 @@ public:
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
virtual bool OnEvent(const SEvent& event)
|
void updatePosition(v2s32 pos)
|
||||||
{
|
{
|
||||||
return false;
|
v2s32 spacing(quickinv_spacing, 0);
|
||||||
|
for(s32 i=0; i<m_itemcount; i++)
|
||||||
|
{
|
||||||
|
m_images[i]->setRelativePosition(pos + spacing*i);
|
||||||
|
m_texts[i]->setRelativePosition(pos + spacing*i);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void setSelection(s32 i)
|
void setSelection(s32 i)
|
||||||
@ -1232,7 +1245,7 @@ public:
|
|||||||
{
|
{
|
||||||
s32 start = 0;
|
s32 start = 0;
|
||||||
|
|
||||||
start = m_selection - m_itemcount / 2;
|
//start = m_selection - m_itemcount / 2;
|
||||||
|
|
||||||
InventoryList *mainlist = m_inventory->getList("main");
|
InventoryList *mainlist = m_inventory->getList("main");
|
||||||
|
|
||||||
@ -1766,7 +1779,7 @@ int main(int argc, char *argv[])
|
|||||||
core::rect<s32>(0,0,0,0),
|
core::rect<s32>(0,0,0,0),
|
||||||
false, false); // Disable word wrap as of now
|
false, false); // Disable word wrap as of now
|
||||||
//false, true);
|
//false, true);
|
||||||
guitext_chat->setBackgroundColor(video::SColor(96,0,0,0));
|
//guitext_chat->setBackgroundColor(video::SColor(96,0,0,0));
|
||||||
core::list<ChatLine> chat_lines;
|
core::list<ChatLine> chat_lines;
|
||||||
|
|
||||||
/*
|
/*
|
||||||
@ -2011,7 +2024,8 @@ int main(int argc, char *argv[])
|
|||||||
return 1;
|
return 1;
|
||||||
|
|
||||||
//video::SColor skycolor = video::SColor(255,90,140,200);
|
//video::SColor skycolor = video::SColor(255,90,140,200);
|
||||||
video::SColor skycolor = video::SColor(255,166,202,244);
|
//video::SColor skycolor = video::SColor(255,166,202,244);
|
||||||
|
video::SColor skycolor = video::SColor(255,120,185,244);
|
||||||
|
|
||||||
camera->setFOV(FOV_ANGLE);
|
camera->setFOV(FOV_ANGLE);
|
||||||
|
|
||||||
@ -2031,8 +2045,10 @@ int main(int argc, char *argv[])
|
|||||||
Add some gui stuff
|
Add some gui stuff
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
/*GUIQuickInventory *quick_inventory = new GUIQuickInventory
|
||||||
|
(guienv, NULL, v2s32(10, 70), 5, &local_inventory);*/
|
||||||
GUIQuickInventory *quick_inventory = new GUIQuickInventory
|
GUIQuickInventory *quick_inventory = new GUIQuickInventory
|
||||||
(guienv, NULL, v2s32(10, 70), 5, &local_inventory);
|
(guienv, NULL, v2s32(0, 0), quickinv_itemcount, &local_inventory);
|
||||||
|
|
||||||
// Test the text input system
|
// Test the text input system
|
||||||
/*(new GUITextInputMenu(guienv, guiroot, -1, &g_menumgr,
|
/*(new GUITextInputMenu(guienv, guiroot, -1, &g_menumgr,
|
||||||
@ -2051,6 +2067,11 @@ int main(int argc, char *argv[])
|
|||||||
guitext2->setVisible(true);
|
guitext2->setVisible(true);
|
||||||
guitext_info->setVisible(true);
|
guitext_info->setVisible(true);
|
||||||
guitext_chat->setVisible(true);
|
guitext_chat->setVisible(true);
|
||||||
|
|
||||||
|
//s32 guitext_chat_pad_bottom = 70;
|
||||||
|
|
||||||
|
v2u32 screensize(0,0);
|
||||||
|
v2u32 last_screensize(0,0);
|
||||||
|
|
||||||
/*
|
/*
|
||||||
Some statistics are collected in these
|
Some statistics are collected in these
|
||||||
@ -2097,8 +2118,10 @@ int main(int argc, char *argv[])
|
|||||||
/*
|
/*
|
||||||
Random calculations
|
Random calculations
|
||||||
*/
|
*/
|
||||||
v2u32 screensize = driver->getScreenSize();
|
last_screensize = screensize;
|
||||||
core::vector2d<s32> displaycenter(screensize.X/2,screensize.Y/2);
|
screensize = driver->getScreenSize();
|
||||||
|
v2s32 displaycenter(screensize.X/2,screensize.Y/2);
|
||||||
|
bool screensize_changed = screensize != last_screensize;
|
||||||
|
|
||||||
// Hilight boxes collected during the loop and displayed
|
// Hilight boxes collected during the loop and displayed
|
||||||
core::list< core::aabbox3d<f32> > hilightboxes;
|
core::list< core::aabbox3d<f32> > hilightboxes;
|
||||||
@ -2106,6 +2129,13 @@ int main(int argc, char *argv[])
|
|||||||
// Info text
|
// Info text
|
||||||
std::wstring infotext;
|
std::wstring infotext;
|
||||||
|
|
||||||
|
// When screen size changes, update positions and sizes of stuff
|
||||||
|
if(screensize_changed)
|
||||||
|
{
|
||||||
|
v2s32 pos(displaycenter.X-((quickinv_itemcount-1)*quickinv_spacing+quickinv_size)/2, screensize.Y-quickinv_spacing);
|
||||||
|
quick_inventory->updatePosition(pos);
|
||||||
|
}
|
||||||
|
|
||||||
//TimeTaker //timer1("//timer1");
|
//TimeTaker //timer1("//timer1");
|
||||||
|
|
||||||
// Time of frame without fps limit
|
// Time of frame without fps limit
|
||||||
@ -2767,12 +2797,6 @@ int main(int argc, char *argv[])
|
|||||||
camera->setAspectRatio((f32)screensize.X / (f32)screensize.Y);
|
camera->setAspectRatio((f32)screensize.X / (f32)screensize.Y);
|
||||||
|
|
||||||
u32 daynight_ratio = client.getDayNightRatio();
|
u32 daynight_ratio = client.getDayNightRatio();
|
||||||
/*video::SColor bgcolor = video::SColor(
|
|
||||||
255,
|
|
||||||
skycolor.getRed() * daynight_ratio / 1000,
|
|
||||||
skycolor.getGreen() * daynight_ratio / 1000,
|
|
||||||
skycolor.getBlue() * daynight_ratio / 1000);*/
|
|
||||||
|
|
||||||
u8 l = decode_light((daynight_ratio * LIGHT_SUN) / 1000);
|
u8 l = decode_light((daynight_ratio * LIGHT_SUN) / 1000);
|
||||||
video::SColor bgcolor = video::SColor(
|
video::SColor bgcolor = video::SColor(
|
||||||
255,
|
255,
|
||||||
@ -2787,7 +2811,8 @@ int main(int argc, char *argv[])
|
|||||||
if(g_settings.getBool("enable_fog") == true)
|
if(g_settings.getBool("enable_fog") == true)
|
||||||
{
|
{
|
||||||
//f32 range = draw_control.wanted_range * BS + MAP_BLOCKSIZE/2*BS;
|
//f32 range = draw_control.wanted_range * BS + MAP_BLOCKSIZE/2*BS;
|
||||||
f32 range = draw_control.wanted_range * BS + MAP_BLOCKSIZE/3*BS;
|
f32 range = draw_control.wanted_range * BS + 0.8*MAP_BLOCKSIZE*BS;
|
||||||
|
//f32 range = draw_control.wanted_range * BS + 0.0*MAP_BLOCKSIZE*BS;
|
||||||
if(draw_control.range_all)
|
if(draw_control.range_all)
|
||||||
range = 100000*BS;
|
range = 100000*BS;
|
||||||
|
|
||||||
@ -2795,11 +2820,23 @@ int main(int argc, char *argv[])
|
|||||||
bgcolor,
|
bgcolor,
|
||||||
video::EFT_FOG_LINEAR,
|
video::EFT_FOG_LINEAR,
|
||||||
range*0.6,
|
range*0.6,
|
||||||
range*1.1,
|
range*1.0,
|
||||||
0.01,
|
0.01,
|
||||||
false, // pixel fog
|
false, // pixel fog
|
||||||
false // range fog
|
false // range fog
|
||||||
);
|
);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
driver->setFog(
|
||||||
|
bgcolor,
|
||||||
|
video::EFT_FOG_LINEAR,
|
||||||
|
100000*BS,
|
||||||
|
110000*BS,
|
||||||
|
0.01,
|
||||||
|
false, // pixel fog
|
||||||
|
false // range fog
|
||||||
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -2912,13 +2949,23 @@ int main(int argc, char *argv[])
|
|||||||
chat_lines.erase(it);
|
chat_lines.erase(it);
|
||||||
}
|
}
|
||||||
guitext_chat->setText(whole.c_str());
|
guitext_chat->setText(whole.c_str());
|
||||||
|
|
||||||
// Update gui element size and position
|
// Update gui element size and position
|
||||||
|
|
||||||
|
/*core::rect<s32> rect(
|
||||||
|
10,
|
||||||
|
screensize.Y - guitext_chat_pad_bottom
|
||||||
|
- text_height*chat_lines.size(),
|
||||||
|
screensize.X - 10,
|
||||||
|
screensize.Y - guitext_chat_pad_bottom
|
||||||
|
);*/
|
||||||
core::rect<s32> rect(
|
core::rect<s32> rect(
|
||||||
10,
|
10,
|
||||||
screensize.Y - 10 - text_height*chat_lines.size(),
|
50,
|
||||||
screensize.X - 10,
|
screensize.X - 10,
|
||||||
screensize.Y - 10
|
50 + text_height*chat_lines.size()
|
||||||
);
|
);
|
||||||
|
|
||||||
guitext_chat->setRelativePosition(rect);
|
guitext_chat->setRelativePosition(rect);
|
||||||
|
|
||||||
if(chat_lines.size() == 0)
|
if(chat_lines.size() == 0)
|
||||||
|
@ -5428,10 +5428,15 @@ void ClientMap::renderMap(video::IVideoDriver* driver, s32 pass)
|
|||||||
{
|
{
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// This is ugly
|
||||||
|
/*if(m_control.range_all == false &&
|
||||||
|
d - 0.5*BS*MAP_BLOCKSIZE > range)
|
||||||
|
continue;*/
|
||||||
|
|
||||||
#if 1
|
#if 1
|
||||||
/*
|
/*
|
||||||
Update expired mesh
|
Update expired mesh (used for day/night change)
|
||||||
*/
|
*/
|
||||||
|
|
||||||
bool mesh_expired = false;
|
bool mesh_expired = false;
|
||||||
|
@ -163,6 +163,7 @@ void init_mapnode()
|
|||||||
i = CONTENT_MUD;
|
i = CONTENT_MUD;
|
||||||
f = &g_content_features[i];
|
f = &g_content_features[i];
|
||||||
f->setAllTextures("mud.png");
|
f->setAllTextures("mud.png");
|
||||||
|
f->setInventoryTextureCube("mud.png", "mud.png", "mud.png");
|
||||||
f->param_type = CPT_MINERAL;
|
f->param_type = CPT_MINERAL;
|
||||||
f->is_ground_content = true;
|
f->is_ground_content = true;
|
||||||
f->dug_item = std::string("MaterialItem ")+itos(i)+" 1";
|
f->dug_item = std::string("MaterialItem ")+itos(i)+" 1";
|
||||||
|
Loading…
Reference in New Issue
Block a user