std::string ntext = wide_to_narrow(text);
infostream << "Submitting 'text' field of node at (" << m_p.X << ","
<< m_p.Y << "," << m_p.Z << "): " << ntext << std::endl;
- std::map<std::string, std::string> fields;
+ StringMap fields;
fields["text"] = ntext;
m_client->sendNodemetaFields(m_p, "", fields);
}
- void gotText(std::map<std::string, std::string> fields)
+ void gotText(const StringMap &fields)
{
m_client->sendNodemetaFields(m_p, "", fields);
}
m_client = client;
m_formname = formname;
}
- void gotText(std::map<std::string, std::string> fields)
+ void gotText(const StringMap &fields)
{
m_client->sendInventoryFields(m_formname, fields);
}
errorstream << "LocalFormspecHandler::gotText old style message received" << std::endl;
}
- void gotText(std::map<std::string, std::string> fields)
+ void gotText(const StringMap &fields)
{
if (m_formname == "MT_PAUSE_MENU") {
if (fields.find("btn_sound") != fields.end()) {
if ((fields.find("btn_send") != fields.end()) ||
(fields.find("quit") != fields.end())) {
- if (fields.find("f_text") != fields.end()) {
- m_client->typeChatMessage(narrow_to_wide(fields["f_text"]));
- }
+ StringMap::const_iterator it = fields.find("f_text");
+ if (it != fields.end())
+ m_client->typeChatMessage(narrow_to_wide(it->second));
return;
}
return;
}
- errorstream << "LocalFormspecHandler::gotText unhandled >" << m_formname << "< event" << std::endl;
- int i = 0;
+ errorstream << "LocalFormspecHandler::gotText unhandled >"
+ << m_formname << "< event" << std::endl;
- for (std::map<std::string, std::string>::iterator iter = fields.begin();
- iter != fields.end(); iter++) {
- errorstream << "\t" << i << ": " << iter->first << "=" << iter->second << std::endl;
+ int i = 0;
+ StringMap::const_iterator it;
+ for (it = fields.begin(); it != fields.end(); ++it) {
+ errorstream << "\t" << i << ": " << it->first
+ << "=" << it->second << std::endl;
i++;
}
}
os << "button_exit[4," << (ypos++) << ";3,0.5;btn_exit_os;"
<< wide_to_narrow(wstrgettext("Exit to OS")) << "]"
<< "textarea[7.5,0.25;3.9,6.25;;" << control_text << ";]"
- << "textarea[0.4,0.25;3.5,6;;" << PROJECT_NAME "\n"
+ << "textarea[0.4,0.25;3.5,6;;" << PROJECT_NAME_C "\n"
<< g_build_info << "\n"
<< "path_user = " << wrap_rows(porting::path_user, 20)
<< "\n;]";
bool m_cache_enable_fog;
f32 m_cache_mouse_sensitivity;
f32 m_repeat_right_click_time;
+
+#ifdef __ANDROID__
+ bool m_cache_hold_aux1;
+#endif
+
};
Game::Game() :
m_repeat_right_click_time = g_settings->getFloat("repeat_rightclick_time");
m_cache_mouse_sensitivity = rangelim(m_cache_mouse_sensitivity, 0.001, 100.0);
+
+#ifdef __ANDROID__
+ m_cache_hold_aux1 = false; // This is initialised properly later
+#endif
+
}
set_light_table(g_settings->getFloat("display_gamma"));
+#ifdef __ANDROID__
+ m_cache_hold_aux1 = g_settings->getBool("fast_move")
+ && client->checkPrivilege("fast");
+#endif
+
while (device->run() && !(*kill || g_gamecallback->shutdown_requested)) {
/* Must be called immediately after a device->run() call because it
cam_view.camera_pitch) * cam_smoothing;
updatePlayerControl(cam_view);
step(&dtime);
- processClientEvents(&cam_view, &runData.damage_flash);
+ processClientEvents(&cam_view_target, &runData.damage_flash);
updateCamera(&flags, draw_times.busy_time, dtime,
runData.time_from_last_punch);
updateSound(dtime);
/* Set window caption
*/
- std::wstring str = narrow_to_wide(PROJECT_NAME);
+ std::wstring str = narrow_to_wide(PROJECT_NAME_C);
str += L" [";
str += driver->getName();
str += L"]";
{
// First line of debug text
guitext = guienv->addStaticText(
- narrow_to_wide(PROJECT_NAME).c_str(),
+ narrow_to_wide(PROJECT_NAME_C).c_str(),
core::rect<s32>(0, 0, 0, 0),
false, false, guiroot);
input->clear();
FpsControl fps_control = { 0 };
- f32 dtime; // in seconds
+ f32 dtime;
+ f32 wait_time = 0; // in seconds
+
+ fps_control.last_time = device->getTimer()->getTime();
while (device->run()) {
break;
}
+ wait_time += dtime;
+ // Only time out if we aren't waiting for the server we started
+ if ((*address != "") && (wait_time > 10)) {
+ *error_message = "Connection timed out.";
+ errorstream << *error_message << std::endl;
+ break;
+ }
+
// Update status
showOverlayMessage(wgettext("Connecting to server..."), dtime, 20);
}
FpsControl fps_control = { 0 };
f32 dtime; // in seconds
+ fps_control.last_time = device->getTimer()->getTime();
+
while (device->run()) {
limitFps(&fps_control, &dtime);
if ((USE_CURL == 0) ||
(!g_settings->getBool("enable_remote_media_server"))) {
float cur = client->getCurRate();
- std::string cur_unit = gettext(" KB/s");
+ std::string cur_unit = gettext("KiB/s");
if (cur > 900) {
cur /= 1024.0;
- cur_unit = gettext(" MB/s");
+ cur_unit = gettext("MiB/s");
}
- message << " ( " << cur << cur_unit << " )";
+ message << " (" << cur << ' ' << cur_unit << ")";
}
progress = 30 + client->mediaReceiveProgress() * 35 + 0.5;
*statustext_time = 0;
statustext = msg[fast_move];
- if (fast_move && !client->checkPrivilege("fast"))
+ bool has_fast_privs = client->checkPrivilege("fast");
+
+ if (fast_move && !has_fast_privs)
statustext += L" (note: no 'fast' privilege)";
+
+#ifdef __ANDROID__
+ m_cache_hold_aux1 = fast_move && has_fast_privs;
+#endif
}
);
#ifdef ANDROID
- /* For Android, invert the meaning of holding down the fast button (i.e.
- * holding down the fast button -- if there is one -- means walk), unless
- * performing an action, sneaking or jumping.
+ /* For Android, simulate holding down AUX1 (fast move) if the user has
+ * the fast_move setting toggled on. If there is an aux1 key defined for
+ * Android then its meaning is inverted (i.e. holding aux1 means walk and
+ * not fast)
*/
- const u32 autofast_exludebits =
- (1U << 4) | (1U << 6) // jump, sneak
- | (1U << 7) | (1U << 8); // left state, right state
-
- if ((keypress_bits & autofast_exludebits) == 0) {
+ if (m_cache_hold_aux1) {
control.aux1 = control.aux1 ^ true;
keypress_bits ^= ((u32)(1U << 5));
}
event.set_sky.params->size() == 6) {
sky->setFallbackBgColor(*event.set_sky.bgcolor);
skybox = smgr->addSkyBoxSceneNode(
- texture_src->getTexture((*event.set_sky.params)[0]),
- texture_src->getTexture((*event.set_sky.params)[1]),
- texture_src->getTexture((*event.set_sky.params)[2]),
- texture_src->getTexture((*event.set_sky.params)[3]),
- texture_src->getTexture((*event.set_sky.params)[4]),
- texture_src->getTexture((*event.set_sky.params)[5]));
+ texture_src->getTextureForMesh((*event.set_sky.params)[0]),
+ texture_src->getTextureForMesh((*event.set_sky.params)[1]),
+ texture_src->getTextureForMesh((*event.set_sky.params)[2]),
+ texture_src->getTextureForMesh((*event.set_sky.params)[3]),
+ texture_src->getTextureForMesh((*event.set_sky.params)[4]),
+ texture_src->getTextureForMesh((*event.set_sky.params)[5]));
}
// Handle everything else as plain color
else {
std::ostringstream os(std::ios_base::binary);
os << std::fixed
- << PROJECT_NAME " " << g_version_hash
+ << PROJECT_NAME_C " " << g_version_hash
<< " FPS = " << fps
<< " (R: range_all=" << draw_control->range_all << ")"
<< std::setprecision(0)
guitext->setVisible(true);
} else if (flags.show_hud || flags.show_chat) {
std::ostringstream os(std::ios_base::binary);
- os << PROJECT_NAME " " << g_version_hash;
+ os << PROJECT_NAME_C " " << g_version_hash;
guitext->setText(narrow_to_wide(os.str()).c_str());
guitext->setVisible(true);
} else {
// not using getRealTime is necessary for wine
device->getTimer()->tick(); // Maker sure device time is up-to-date
u32 time = device->getTimer()->getTime();
-
u32 last_time = fps_timings->last_time;
if (time > last_time) // Make sure time hasn't overflowed
} catch (SerializationError &e) {
error_message = std::string("A serialization error occurred:\n")
+ e.what() + "\n\nThe server is probably "
- " running a different version of " PROJECT_NAME ".";
+ " running a different version of " PROJECT_NAME_C ".";
errorstream << error_message << std::endl;
} catch (ServerError &e) {
error_message = e.what();