-
Notifications
You must be signed in to change notification settings - Fork 2.1k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[WIP] Basic pause menu settings #6965
[WIP] Basic pause menu settings #6965
Conversation
The minimum normal FOV allowable needs to be tuned to avoid normal FOV being treated as a zoom and triggering the loading of distant world. |
src/camera.cpp
Outdated
@@ -457,6 +457,8 @@ void Camera::update(LocalPlayer* player, f32 frametime, f32 busytime, f32 tool_r | |||
fov_degrees = player->getZoomFOV(); | |||
} else { | |||
fov_degrees = m_cache_fov; | |||
//if the callback(see line 63) gets added then this won't need to be here. | |||
m_cache_fov = g_settings->getFloat("fov"); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I guess this is temporary as we can't fetch this from settings this often.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
right, all it needs to do is be able to be reset when the FOV gets changed, but as there is no callback yet, this has to be here. As far as I have checked, it doesn't affect my performance at all.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The performance impact is probably not very noticeable, but these small efforts add up.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
true, which is why the callbacks would need to be added
233d2a2
to
612e1db
Compare
612e1db
to
cb3f4a0
Compare
@paramat I got the fov to use a callback 😃 |
Enabling fog doesn't need to be in an in-game menu because we have F3 for that, neither does enable 3D clouds, that is something a user sets very rarely. |
Or fast mode, there is a key for that. |
@paramat the reason I added fast, fly, etc is because a server owner asked if it would be possible because they are getting tired of explaining exactly how to go fast, fly, etc step-by-step. |
@TekhnaeRaav I would like the feature discussion to be on #6722 while the code gets discussed here |
From IRC this refers to touchscreens: 20:48 ThomasMonroe paramat I added fast, fly, and noclip because of a convo I had with aerozoic in which he said: I'm not sure what controls Android users have access to, and i suggest we wait for discussion of Android controls before adding them in this PR. So for this PR i suggest only being concerned about desktop MT. This still stands so i am 👎 for now:
'enable build where you stand' might be justified if builders need to switch often between those modes while building, @Sokomine |
IRC: So no need for those. Any new controls added for Android could be added to that 'gear' menu. |
Ok I will do that |
Why are 'fall bobbing' and 'view bobbing' present in the code changes? |
erm idk, I think I just did all of them XD |
Does the engine actively prevent this from happening, even if set in |
It might be better to make the minimum FOV 55 or 60 degrees because 51 is a weird number. |
I agree, 51 is kind of odd |
We have a key for autoforward already. How about just adding FOV for now? |
ok, sounds good to me, as I already re-adjusted the files to make it easier to add new settings. |
src/camera.cpp
Outdated
@@ -40,6 +40,20 @@ with this program; if not, write to the Free Software Foundation, Inc., | |||
#define WIELDMESH_OFFSET_X 55.0f | |||
#define WIELDMESH_OFFSET_Y -35.0f | |||
|
|||
void Camera::onSettingsChange(const std::string &name){ | |||
if (name == "fov"){ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
brace removal in this whole block.
src/camera.h
Outdated
@@ -165,6 +168,8 @@ class Camera | |||
void drawNametags(); | |||
|
|||
inline void addArmInertia(f32 player_yaw); | |||
|
|||
//f32 m_cache_fov; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
what is this?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
leftover from an experiment
src/game.cpp
Outdated
@@ -139,7 +139,7 @@ struct LocalFormspecHandler : public TextDest | |||
void gotText(const StringMap &fields) | |||
{ | |||
if (m_formname == "MT_PAUSE_MENU") { | |||
if (fields.find("btn_sound") != fields.end()) { | |||
if (fields.find("btn_options") != fields.end()) { | |||
g_gamecallback->changeVolume(); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
rename the callback
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
ah good catch, thanks
@@ -0,0 +1,259 @@ | |||
/* | |||
Part of Minetest | |||
Copyright (C) 2013 celeron55, Perttu Ahola <[email protected]> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Add yourself to the copyright headers?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
are you sure?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes.
Also, the filename could be better, maybe something like 'guiPauseSettings'?
src/gui/guiOptionsChange.h
Outdated
void removeChildren(); | ||
/* | ||
Remove and re-add (or reposition) stuff | ||
*/ | ||
void addCheckBox(const std::string name,const std::string setting, int ID, int xoff, int yoff); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
These helper functions should be put in GUIModalMenu imo.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
No I don't that would be a good idea because these functions work only with GUIOptionsChange as they use m_size.
src/gui/guiOptionsChange.cpp
Outdated
e->setPos(init); | ||
} | ||
|
||
void GUIOptionsChange::addDynText(const std::string name, int value, const std::string ending, int ID, int xoff, int yoff){ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
whitespace issues
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
name and ending can be const references.
src/gui/guiOptionsChange.cpp
Outdated
core::stringw temp_text = text; | ||
delete[] text; | ||
|
||
temp_text += core::stringw(value)+core::stringw(wgettext(ending.c_str())); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
space after +
src/gui/guiOptionsChange.cpp
Outdated
true, this, ID); | ||
} | ||
|
||
void GUIOptionsChange::addText(const std::string name, int ID, int xoff, int yoff){ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
space
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
name can be a const reference.
src/gui/guiOptionsChange.cpp
Outdated
true, this, ID); | ||
} | ||
|
||
void GUIOptionsChange::updateDynText(const SEvent& event, const std::string setting, int scale, int ID, const std::string beginning, const std::string ending){ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
space and const references to strings
src/gui/mainmenumanager.h
Outdated
@@ -140,7 +140,7 @@ class MainGameCallback : public IGameCallback | |||
|
|||
virtual void changeVolume() |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
rename this
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
good catch, I had forgotten about doing that.
src/camera.cpp
Outdated
m_cache_fov = g_settings->getFloat("fov"); | ||
}else if(name == "view_bobbing_amount"){ | ||
m_cache_view_bobbing_amount = g_settings->getFloat("view_bobbing_amount"); | ||
}else if(name == "fall_bobbing_amount"){ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm wondering why 'view/fall bobbing' settings are included here if they are not being changed in-game?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm removing those in the next commit
src/gui/guiOptionsChange.cpp
Outdated
|
||
if (gui::IGUIElement *e = getElementFromId(ID_forwardButton)) | ||
e->remove(); | ||
GUIModalMenu::removeChildren(); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
just removeChildren();
not GUIModalMenu::removeChildren();
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
🤦♂️ I knew that
|
@paramat updated screenshot. |
@paramat @ThomasMonroe314 almost all modern game engines have FOV sliders in pause menu under settings though but i havent had any need myself to change fov ingame but some other settings could be usefull though |
See #7234 the lowest settable FOV is 45 degrees, not 55 as i stated before. |
row+=spacing; | ||
addDynText("Field Of View: ", FOV, "", ID_fovText, column_pos, row); | ||
row+=spacing; | ||
addSlider(ID_fovSlider, 160, 51, FOV, column_pos, row); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Minimum can be 45 degrees, i tested the lowest that does not trigger loading of distant world.
Closing for now due to inactivity but should be reopened on progress. |
@ThomasMonroe314 Any progress? Are you still interested in working on this? |
This is a work in progress of issue #6722
Please give suggestions for settings you would like to see in #6722
WIP Screenshots(will be updated as work gets done):