forked from oerkki/voxelands
darken world behind menus/forms, and fix that old ungrabbed mouse bug when inventory is closed
This commit is contained in:
parent
526672a259
commit
25ab63591a
|
@ -233,6 +233,7 @@ Client::Client(
|
||||||
m_pointed_node(-32768,-32768,-32768),
|
m_pointed_node(-32768,-32768,-32768),
|
||||||
m_pointed_content(CONTENT_IGNORE),
|
m_pointed_content(CONTENT_IGNORE),
|
||||||
m_time_of_day(0),
|
m_time_of_day(0),
|
||||||
|
m_form_open(false),
|
||||||
m_map_seed(0),
|
m_map_seed(0),
|
||||||
m_map_type(MGT_DEFAULT),
|
m_map_type(MGT_DEFAULT),
|
||||||
m_password(password),
|
m_password(password),
|
||||||
|
|
|
@ -341,6 +341,9 @@ public:
|
||||||
bool getServerSuffocation() {return m_server_suffocation;}
|
bool getServerSuffocation() {return m_server_suffocation;}
|
||||||
bool getServerHunger() {return m_server_hunger;}
|
bool getServerHunger() {return m_server_hunger;}
|
||||||
|
|
||||||
|
bool getFormState() {return m_form_open;}
|
||||||
|
void setFormState(bool state) {m_form_open = state;}
|
||||||
|
|
||||||
private:
|
private:
|
||||||
|
|
||||||
// Virtual methods from con::PeerHandler
|
// Virtual methods from con::PeerHandler
|
||||||
|
@ -394,9 +397,7 @@ private:
|
||||||
// Received from the server. 0-23999
|
// Received from the server. 0-23999
|
||||||
u32 m_time_of_day;
|
u32 m_time_of_day;
|
||||||
|
|
||||||
// 0 <= m_daynight_i < DAYNIGHT_CACHE_COUNT
|
bool m_form_open;
|
||||||
//s32 m_daynight_i;
|
|
||||||
//u32 m_daynight_ratio;
|
|
||||||
|
|
||||||
Queue<std::wstring> m_chat_queue;
|
Queue<std::wstring> m_chat_queue;
|
||||||
|
|
||||||
|
|
11
src/game.cpp
11
src/game.cpp
|
@ -1672,6 +1672,7 @@ void the_game(
|
||||||
// Launch pause menu
|
// Launch pause menu
|
||||||
(new GUIPauseMenu(guienv, guiroot, -1, g_gamecallback,
|
(new GUIPauseMenu(guienv, guiroot, -1, g_gamecallback,
|
||||||
&g_menumgr))->drop();
|
&g_menumgr))->drop();
|
||||||
|
client.setFormState(true);
|
||||||
|
|
||||||
/*
|
/*
|
||||||
Some statistics are collected in these
|
Some statistics are collected in these
|
||||||
|
@ -1754,6 +1755,7 @@ void the_game(
|
||||||
(new GUIPasswordChange(guienv, guiroot, -1,
|
(new GUIPasswordChange(guienv, guiroot, -1,
|
||||||
&g_menumgr, &client))->drop();
|
&g_menumgr, &client))->drop();
|
||||||
g_gamecallback->changepassword_requested = false;
|
g_gamecallback->changepassword_requested = false;
|
||||||
|
client.setFormState(true);
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
@ -1952,6 +1954,7 @@ void the_game(
|
||||||
menu->setFormSpec(fio->getForm(), inventoryloc);
|
menu->setFormSpec(fio->getForm(), inventoryloc);
|
||||||
menu->setFormIO(fio);
|
menu->setFormIO(fio);
|
||||||
menu->drop();
|
menu->drop();
|
||||||
|
client.setFormState(true);
|
||||||
}else if (input->wasKeyDown(EscapeKey)) {
|
}else if (input->wasKeyDown(EscapeKey)) {
|
||||||
infostream<<"the_game: Launching pause menu"<<std::endl;
|
infostream<<"the_game: Launching pause menu"<<std::endl;
|
||||||
// It will delete itself by itself
|
// It will delete itself by itself
|
||||||
|
@ -1959,6 +1962,7 @@ void the_game(
|
||||||
|
|
||||||
// Move mouse cursor on top of the disconnect button
|
// Move mouse cursor on top of the disconnect button
|
||||||
input->setMousePos(displaycenter.X, displaycenter.Y+25);
|
input->setMousePos(displaycenter.X, displaycenter.Y+25);
|
||||||
|
client.setFormState(true);
|
||||||
}else if (input->wasKeyDown(getKeySetting(VLKC_CHAT))) {
|
}else if (input->wasKeyDown(getKeySetting(VLKC_CHAT))) {
|
||||||
FormIO *fio = new ChatFormIO(&client);
|
FormIO *fio = new ChatFormIO(&client);
|
||||||
|
|
||||||
|
@ -2593,6 +2597,7 @@ void the_game(
|
||||||
sound = "open-menu";
|
sound = "open-menu";
|
||||||
client.playSound(sound,0);
|
client.playSound(sound,0);
|
||||||
}
|
}
|
||||||
|
client.setFormState(true);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (input->getRightClicked()) {
|
if (input->getRightClicked()) {
|
||||||
|
@ -3006,8 +3011,10 @@ void the_game(
|
||||||
int crosshair = 1;
|
int crosshair = 1;
|
||||||
if (g_menumgr.menuCount() > 0) {
|
if (g_menumgr.menuCount() > 0) {
|
||||||
crosshair = 0;
|
crosshair = 0;
|
||||||
}else if (client.getPointedContent() != CONTENT_IGNORE) {
|
}else{
|
||||||
crosshair = 2;
|
client.setFormState(false);
|
||||||
|
if (client.getPointedContent() != CONTENT_IGNORE)
|
||||||
|
crosshair = 2;
|
||||||
}
|
}
|
||||||
MapNode snode;
|
MapNode snode;
|
||||||
v3s16 spos = v3s16(0,0,0);
|
v3s16 spos = v3s16(0,0,0);
|
||||||
|
|
|
@ -681,6 +681,7 @@ bool GUIFormSpecMenu::OnEvent(const SEvent& event)
|
||||||
KeyPress kp(event.KeyInput);
|
KeyPress kp(event.KeyInput);
|
||||||
if (event.KeyInput.PressedDown && (kp == EscapeKey || kp == getKeySetting(VLKC_INVENTORY))) {
|
if (event.KeyInput.PressedDown && (kp == EscapeKey || kp == getKeySetting(VLKC_INVENTORY))) {
|
||||||
m_tooltip_element->setVisible(false);
|
m_tooltip_element->setVisible(false);
|
||||||
|
acceptInput();
|
||||||
quitMenu();
|
quitMenu();
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
19
src/map.cpp
19
src/map.cpp
|
@ -3557,15 +3557,20 @@ void ClientMap::renderPostFx()
|
||||||
m_camera_mutex.Lock();
|
m_camera_mutex.Lock();
|
||||||
v3f camera_position = m_camera_position;
|
v3f camera_position = m_camera_position;
|
||||||
m_camera_mutex.Unlock();
|
m_camera_mutex.Unlock();
|
||||||
|
video::SColor post_effect_color(0,0,0,0);
|
||||||
|
|
||||||
MapNode n = getNodeNoEx(floatToInt(camera_position, BS));
|
if (m_client->getFormState()) {
|
||||||
|
post_effect_color = video::SColor(128,0,0,0);
|
||||||
|
}else{
|
||||||
|
MapNode n = getNodeNoEx(floatToInt(camera_position, BS));
|
||||||
|
|
||||||
// - If the player is in a solid node, make everything black.
|
// - If the player is in a solid node, make everything black.
|
||||||
// - If the player is in liquid, draw a semi-transparent overlay.
|
// - If the player is in liquid, draw a semi-transparent overlay.
|
||||||
ContentFeatures& features = content_features(n);
|
ContentFeatures& features = content_features(n);
|
||||||
video::SColor post_effect_color = features.post_effect_color;
|
post_effect_color = features.post_effect_color;
|
||||||
if (features.solidness == 2 && m_client->getLocalPlayer()->control.free == false) {
|
if (features.solidness == 2 && m_client->getLocalPlayer()->control.free == false) {
|
||||||
post_effect_color = video::SColor(255, 0, 0, 0);
|
post_effect_color = video::SColor(255, 0, 0, 0);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
if (post_effect_color.getAlpha() != 0) {
|
if (post_effect_color.getAlpha() != 0) {
|
||||||
// Draw a full-screen rectangle
|
// Draw a full-screen rectangle
|
||||||
|
|
|
@ -105,6 +105,7 @@ public:
|
||||||
allowFocusRemoval(true);
|
allowFocusRemoval(true);
|
||||||
// This removes Environment's grab on us
|
// This removes Environment's grab on us
|
||||||
Environment->removeFocus(this);
|
Environment->removeFocus(this);
|
||||||
|
m_menumgr->deletingMenu(this);
|
||||||
this->remove();
|
this->remove();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue