HUD: forced installation of MC stylized HUD bar. Mobile: minor settings improvements

master
MoNTE48 2019-08-24 00:43:31 +02:00 committed by MoNTE48
parent d5f858d4f6
commit e6f077c576
5 changed files with 31 additions and 41 deletions

View File

@ -41,7 +41,6 @@
EB4367AE23CAD13A43ADF4B1 /* libPods-MultiCraft.a in Frameworks */ = {isa = PBXBuildFile; fileRef = 8758CE009FCB7E91F4C84C28 /* libPods-MultiCraft.a */; };
F810D7052080E48100D109B8 /* en.lproj in Resources */ = {isa = PBXBuildFile; fileRef = F810D7042080E48000D109B8 /* en.lproj */; };
F84D3A951DE79AB400ADE1A0 /* ads.mm in Sources */ = {isa = PBXBuildFile; fileRef = F84D3A941DE79AB400ADE1A0 /* ads.mm */; };
F85119A71F4476FC00BFA9AF /* libcurl.a in Frameworks */ = {isa = PBXBuildFile; fileRef = F85119A61F4476FC00BFA9AF /* libcurl.a */; };
F856B5C31F55F7EE00FE9494 /* bg.png in Resources */ = {isa = PBXBuildFile; fileRef = F856B5C21F55F7EE00FE9494 /* bg.png */; };
F87DC8BA210887C700393B64 /* mapgen_v7p.cpp in Sources */ = {isa = PBXBuildFile; fileRef = F87DC8B9210887C700393B64 /* mapgen_v7p.cpp */; };
F8E6C4E91DCA3B7900F64426 /* Assets.xcassets in Resources */ = {isa = PBXBuildFile; fileRef = F8E6C4E81DCA3B7900F64426 /* Assets.xcassets */; };
@ -257,9 +256,6 @@
F8E6C7D11DCA433E00F64426 /* libiconv.tbd in Frameworks */ = {isa = PBXBuildFile; fileRef = F8E6C7D01DCA433E00F64426 /* libiconv.tbd */; };
F8E6C7D51DCA476800F64426 /* libIrrlicht.a in Frameworks */ = {isa = PBXBuildFile; fileRef = F8E6C7D41DCA476800F64426 /* libIrrlicht.a */; };
F8E6C7D71DCA477600F64426 /* libfreetype.a in Frameworks */ = {isa = PBXBuildFile; fileRef = F8E6C7D61DCA477600F64426 /* libfreetype.a */; };
F8E6C7DB1DCA479200F64426 /* libogg.a in Frameworks */ = {isa = PBXBuildFile; fileRef = F8E6C7DA1DCA479200F64426 /* libogg.a */; };
F8E6C7DD1DCA47A300F64426 /* libvorbis.a in Frameworks */ = {isa = PBXBuildFile; fileRef = F8E6C7DC1DCA47A300F64426 /* libvorbis.a */; };
F8E6C7DF1DCA47AF00F64426 /* libvorbisfile.a in Frameworks */ = {isa = PBXBuildFile; fileRef = F8E6C7DE1DCA47AF00F64426 /* libvorbisfile.a */; };
F8E6C7E11DCA4EB300F64426 /* assets.zip in Resources */ = {isa = PBXBuildFile; fileRef = F8E6C7E01DCA4EB300F64426 /* assets.zip */; };
F8E6C7E31DCA511700F64426 /* worlds.zip in Resources */ = {isa = PBXBuildFile; fileRef = F8E6C7E21DCA511700F64426 /* worlds.zip */; };
/* End PBXBuildFile section */
@ -803,10 +799,6 @@
F8E6C7D11DCA433E00F64426 /* libiconv.tbd in Frameworks */,
F8E6C7D51DCA476800F64426 /* libIrrlicht.a in Frameworks */,
F8E6C7D71DCA477600F64426 /* libfreetype.a in Frameworks */,
F8E6C7DB1DCA479200F64426 /* libogg.a in Frameworks */,
F8E6C7DD1DCA47A300F64426 /* libvorbis.a in Frameworks */,
F8E6C7DF1DCA47AF00F64426 /* libvorbisfile.a in Frameworks */,
F85119A71F4476FC00BFA9AF /* libcurl.a in Frameworks */,
EB4367AE23CAD13A43ADF4B1 /* libPods-MultiCraft.a in Frameworks */,
);
runOnlyForDeploymentPostprocessing = 0;

View File

@ -153,7 +153,7 @@ void set_default_settings(Settings *settings)
settings->setDefault("view_bobbing_amount", "1.0");
settings->setDefault("fall_bobbing_amount", "1.0");
settings->setDefault("enable_3d_clouds", "true");
settings->setDefault("cloud_height", "120");
settings->setDefault("cloud_height", "128");
settings->setDefault("cloud_radius", "12");
settings->setDefault("menu_clouds", "false");
settings->setDefault("opaque_water", "false");
@ -172,6 +172,7 @@ void set_default_settings(Settings *settings)
settings->setDefault("desynchronize_mapblock_texture_animation", "true");
settings->setDefault("hud_hotbar_max_width", "1.0");
settings->setDefault("hud_move_upwards", "0");
settings->setDefault("hud_small", "false");
settings->setDefault("round_screen", "0");
settings->setDefault("enable_local_map_saving", "false");
settings->setDefault("show_entity_selectionbox", "false");
@ -430,10 +431,12 @@ void set_default_settings(Settings *settings)
// small 4" phones
settings->setDefault("hud_scaling", "0.55");
settings->setDefault("mouse_sensitivity", "0.25");
settings->setDefault("hud_small", "true");
} else if (x_inches > 3.7 && x_inches < 5) {
// all phones
settings->setDefault("hud_scaling", "0.7");
settings->setDefault("mouse_sensitivity", "0.15");
settings->setDefault("hud_small", "true");
} else if (x_inches >= 5) {
// tablets
settings->setDefault("hud_scaling", "0.9");
@ -452,23 +455,28 @@ void set_default_settings(Settings *settings)
// set the size of the elements depending on the screen size
if ([SDVersion deviceSize] == Screen3Dot5inch) {
// 3.5" (old iPhone's)
settings->setDefault("hud_scaling", "0.55");
settings->setDefault("hud_scaling", "0.5");
settings->setDefault("hud_small", "true");
} else if ([SDVersion deviceSize] == Screen4inch) {
// 4" (iPhone 5)
settings->setDefault("hud_scaling", "0.55");
settings->setDefault("mouse_sensitivity", "0.3");
settings->setDefault("mouse_sensitivity", "0.33");
settings->setDefault("hud_small", "true");
} else if ([SDVersion deviceSize] == Screen4Dot7inch) {
// 4.7" (iPhone)
settings->setDefault("hud_scaling", "0.65");
settings->setDefault("mouse_sensitivity", "0.25");
settings->setDefault("mouse_sensitivity", "0.27");
settings->setDefault("hud_small", "true");
} else if ([SDVersion deviceSize] == Screen5Dot5inch) {
// 5.5" (iPhone Plus)
settings->setDefault("hud_scaling", "0.75");
settings->setDefault("mouse_sensitivity", "0.3");
settings->setDefault("hud_small", "true");
} else if (([SDVersion deviceSize] == Screen5Dot8inch) || ([SDVersion deviceSize] == Screen6Dot1inch) || ([SDVersion deviceSize] == Screen6Dot5inch)) {
// 5.8+" (iPhone X-series)
settings->setDefault("hud_scaling", "0.85");
settings->setDefault("mouse_sensitivity", "0.35");
settings->setDefault("hud_small", "true");
} else {
// iPad
settings->setDefault("hud_scaling", "0.9");
@ -489,7 +497,7 @@ void set_default_settings(Settings *settings)
settings->setDefault("cloud_radius", "6");
settings->setDefault("pause_fps_max", "5");
settings->setDefault("chunksize", "3");
settings->setDefault("client_mapblock_limit", "250");
settings->setDefault("client_mapblock_limit", "200");
settings->setDefault("active_block_range", "1");
settings->setDefault("max_block_generate_distance", "2");
} else if (([SDVersion deviceVersion] == iPhone6S) || ([SDVersion deviceVersion] == iPhone6SPlus) || ([SDVersion deviceVersion] == iPhoneSE) || ([SDVersion deviceVersion] == iPhone7) || ([SDVersion deviceVersion] == iPhone7Plus) || ([SDVersion deviceVersion] == iPad4) || ([SDVersion deviceVersion] == iPadMini3) || ([SDVersion deviceVersion] == iPadMini4) || ([SDVersion deviceVersion] == iPadAir)) {
@ -499,13 +507,12 @@ void set_default_settings(Settings *settings)
settings->setDefault("cloud_radius", "6");
settings->setDefault("pause_fps_max", "10");
settings->setDefault("client_mapblock_limit", "500");
settings->setDefault("active_block_range", "1");
settings->setDefault("active_block_range", "2");
settings->setDefault("max_block_generate_distance", "3");
} else {
// high settings
settings->setDefault("viewing_range", "75");
settings->setDefault("client_mapblock_limit", "1000");
settings->setDefault("active_block_range", "2");
settings->setDefault("max_block_generate_distance", "5");
}
#endif

View File

@ -1161,43 +1161,34 @@ void Client::handleCommand_HudSetParam(NetworkPacket* pkt)
LocalPlayer *player = m_env.getLocalPlayer();
assert(player != NULL);
bool hud_small = g_settings->getBool("hud_small");
if (param == HUD_PARAM_HOTBAR_ITEMCOUNT && value.size() == 4) {
s32 hotbar_itemcount = readS32((u8*) value.c_str());
if (hotbar_itemcount > 0 && hotbar_itemcount <= HUD_HOTBAR_ITEMCOUNT_MAX) {
// Hotbar over 8 is not supported by touch controls. This is not a hack, but a quick fix
#if defined(__ANDROID__) || defined(__IOS__)
player->hud_hotbar_itemcount = 8;
#else
player->hud_hotbar_itemcount = hotbar_itemcount;
#endif
if (param == HUD_PARAM_HOTBAR_ITEMCOUNT /*&& value.size() == 4*/) {
/* // ToDo: detect hotbar_itemcount and set 8 or 9 image
s32 hotbar_itemcount = readS32((u8*) value.c_str());
if (hotbar_itemcount > 0 && hotbar_itemcount <= HUD_HOTBAR_ITEMCOUNT_MAX) {
player->hud_hotbar_itemcount = hotbar_itemcount;
*/
player->hud_hotbar_itemcount = 9;
// Hotbar over 8 does not fit on a small screen
if (hud_small) {
player->hud_hotbar_itemcount = 8;
}
}
else if (param == HUD_PARAM_HOTBAR_IMAGE) {
// Set the touch interface to fit the size
#if defined(__ANDROID__) || defined(__IOS__)
std::string value = "gui_hotbar_touch.png";
#endif
// If value not empty verify image exists in texture source
/* // If value not empty verify image exists in texture source
if (value != "" && !getTextureSource()->isKnownSourceImage(value)) {
errorstream << "Server sent wrong Hud hotbar image (sent value: '"
<< value << "')" << std::endl;
return;
*/
player->hotbar_image = "gui_hotbar.png";
if (hud_small) {
player->hotbar_image = "gui_hotbar_small.png";
}
player->hotbar_image = value;
}
else if (param == HUD_PARAM_HOTBAR_SELECTED_IMAGE) {
// Selection texture too...
#if defined(__ANDROID__) || defined(__IOS__)
std::string value = "gui_hotbar_selected.png";
#endif
// If value not empty verify image exists in texture source
if (value != "" && !getTextureSource()->isKnownSourceImage(value)) {
errorstream << "Server sent wrong Hud hotbar selected image (sent value: '"
<< value << "')" << std::endl;
return;
}
player->hotbar_selected_image = value;
player->hotbar_selected_image = "gui_hotbar_selected.png";
}
}

Binary file not shown.

After

Width:  |  Height:  |  Size: 385 B

View File

Before

Width:  |  Height:  |  Size: 380 B

After

Width:  |  Height:  |  Size: 380 B