TouchScreenGUI: add Aux1 button
@ -1021,17 +1021,13 @@ void GenericCAO::step(float dtime, ClientEnvironment *env)
|
||||
bool allow_update = false;
|
||||
|
||||
// increase speed if using fast or flying fast
|
||||
if (g_settings->getBool("fast_move") &&
|
||||
m_client->checkLocalPrivilege("fast")) {
|
||||
#ifndef HAVE_TOUCHSCREENGUI
|
||||
// do not require pressing AUX1 for Fast if HAVE_TOUCHSCREENGUI.
|
||||
if ((controls.aux1 ||
|
||||
if((g_settings->getBool("fast_move") &&
|
||||
m_client->checkLocalPrivilege("fast")) &&
|
||||
(controls.aux1 ||
|
||||
(!player->touching_ground &&
|
||||
g_settings->getBool("free_move") &&
|
||||
m_client->checkLocalPrivilege("fly"))))
|
||||
#endif
|
||||
new_speed *= 1.5;
|
||||
}
|
||||
new_speed *= 1.5;
|
||||
// slowdown speed if sneeking
|
||||
if (controls.sneak && walking)
|
||||
new_speed /= 2;
|
||||
|
@ -504,11 +504,7 @@ void LocalPlayer::applyControl(float dtime, Environment *env)
|
||||
bool fast_move = fast_allowed && player_settings.fast_move;
|
||||
bool pitch_move = (free_move || in_liquid) && player_settings.pitch_move;
|
||||
// When aux1_descends is enabled the fast key is used to go down, so fast isn't possible
|
||||
#ifndef HAVE_TOUCHSCREENGUI
|
||||
bool fast_climb = fast_move && control.aux1 && !player_settings.aux1_descends;
|
||||
#else
|
||||
bool fast_climb = fast_move && !player_settings.aux1_descends;
|
||||
#endif
|
||||
bool always_fly_fast = player_settings.always_fly_fast;
|
||||
|
||||
// Whether superspeed mode is used or not
|
||||
@ -547,10 +543,7 @@ void LocalPlayer::applyControl(float dtime, Environment *env)
|
||||
// New minecraft-like descend control
|
||||
|
||||
// Auxiliary button 1 (E)
|
||||
#ifndef HAVE_TOUCHSCREENGUI
|
||||
if (control.aux1)
|
||||
#endif
|
||||
{
|
||||
if (control.aux1) {
|
||||
if (!is_climbing) {
|
||||
// aux1 is "Turbo button"
|
||||
if (fast_move)
|
||||
@ -613,11 +606,7 @@ void LocalPlayer::applyControl(float dtime, Environment *env)
|
||||
else
|
||||
speedV.Y = movement_speed_walk;
|
||||
} else {
|
||||
#ifndef HAVE_TOUCHSCREENGUI
|
||||
if (fast_move && control.aux1)
|
||||
#else
|
||||
if (fast_move)
|
||||
#endif
|
||||
speedV.Y = movement_speed_fast;
|
||||
else
|
||||
speedV.Y = movement_speed_walk;
|
||||
@ -652,11 +641,10 @@ void LocalPlayer::applyControl(float dtime, Environment *env)
|
||||
if (superspeed || (is_climbing && fast_climb) ||
|
||||
((in_liquid || in_liquid_stable) && fast_climb))
|
||||
speedH = speedH.normalize() * movement_speed_fast;
|
||||
else if (control.sneak && !free_move && !in_liquid && !in_liquid_stable) {
|
||||
else if (control.sneak && !free_move && !in_liquid && !in_liquid_stable)
|
||||
speedH = speedH.normalize() * movement_speed_crouch;
|
||||
} else {
|
||||
else
|
||||
speedH = speedH.normalize() * movement_speed_walk;
|
||||
}
|
||||
|
||||
if (!free_move && !in_liquid && !in_liquid_stable && !getParent() && (physics_override_speed != 0)) {
|
||||
if (!m_sneak_offset && control.sneak) {
|
||||
@ -676,11 +664,7 @@ void LocalPlayer::applyControl(float dtime, Environment *env)
|
||||
if ((!touching_ground && !free_move && !is_climbing && !in_liquid) ||
|
||||
(!free_move && m_can_jump && control.jump)) {
|
||||
// Jumping and falling
|
||||
#ifndef HAVE_TOUCHSCREENGUI
|
||||
if (superspeed || (fast_move && control.aux1))
|
||||
#else
|
||||
if (superspeed || fast_move)
|
||||
#endif
|
||||
incH = movement_acceleration_fast * BS * dtime;
|
||||
else
|
||||
incH = movement_acceleration_air * BS * dtime;
|
||||
|
@ -529,6 +529,7 @@ void set_default_settings()
|
||||
settings->setDefault("touchscreen_threshold", "20");
|
||||
settings->setDefault("fixed_virtual_joystick", "true");
|
||||
settings->setDefault("virtual_joystick_triggers_aux", "false");
|
||||
settings->setDefault("fast_move", "true");
|
||||
#endif
|
||||
|
||||
// Mobile Platform
|
||||
|
@ -38,12 +38,12 @@ with this program; if not, write to the Free Software Foundation, Inc.,
|
||||
|
||||
using namespace irr::core;
|
||||
|
||||
const char **button_imagenames = (const char *[]) {
|
||||
const char *button_imagenames[] = {
|
||||
"jump_btn.png",
|
||||
"drop_btn.png",
|
||||
"down_btn.png",
|
||||
//"zoom.png",
|
||||
//"aux_btn.png",
|
||||
"aux_btn.png",
|
||||
"inventory_btn.png",
|
||||
"escape_btn.png",
|
||||
"minimap_btn.png",
|
||||
@ -52,7 +52,7 @@ const char **button_imagenames = (const char *[]) {
|
||||
"chat_btn.png"
|
||||
};
|
||||
|
||||
const char **joystick_imagenames = (const char *[]) {
|
||||
const char *joystick_imagenames[] = {
|
||||
"joystick_off.png",
|
||||
"joystick_bg.png",
|
||||
"joystick_center.png"
|
||||
@ -88,10 +88,10 @@ static irr::EKEY_CODE id2keycode(touch_gui_button_id id)
|
||||
break;
|
||||
/*case zoom_id:
|
||||
key = "zoom";
|
||||
break;
|
||||
break;*/
|
||||
case special1_id:
|
||||
key = "special1";
|
||||
break;*/
|
||||
break;
|
||||
case fly_id:
|
||||
key = "freemove";
|
||||
break;
|
||||
@ -269,7 +269,7 @@ void AutoHideButtonBar::addButton(touch_gui_button_id button_id,
|
||||
m_buttons.push_back(btn);
|
||||
}
|
||||
|
||||
void AutoHideButtonBar::addToggleButton(touch_gui_button_id button_id,
|
||||
/*void AutoHideButtonBar::addToggleButton(touch_gui_button_id button_id,
|
||||
const wchar_t *caption, const char *btn_image_1,
|
||||
const char *btn_image_2)
|
||||
{
|
||||
@ -278,7 +278,7 @@ void AutoHideButtonBar::addToggleButton(touch_gui_button_id button_id,
|
||||
btn->togglable = 1;
|
||||
btn->textures.push_back(btn_image_1);
|
||||
btn->textures.push_back(btn_image_2);
|
||||
}
|
||||
}*/
|
||||
|
||||
bool AutoHideButtonBar::isButton(const SEvent &event)
|
||||
{
|
||||
@ -488,22 +488,22 @@ void TouchScreenGUI::init(ISimpleTextureSource *tsrc)
|
||||
if (m_fixed_joystick) {
|
||||
m_joystick_btn_off = initJoystickButton(joystick_off_id,
|
||||
rect<s32>(button_size / 2,
|
||||
m_screensize.Y - button_size * 4.5,
|
||||
button_size * 4.5,
|
||||
m_screensize.Y - button_size / 2), 0);
|
||||
m_screensize.Y - button_size * 4.5,
|
||||
button_size * 4.5,
|
||||
m_screensize.Y - button_size / 2), 0);
|
||||
} else {
|
||||
m_joystick_btn_off = initJoystickButton(joystick_off_id,
|
||||
rect<s32>(button_size / 2,
|
||||
m_screensize.Y - button_size * 3.5,
|
||||
button_size * 3.5,
|
||||
m_screensize.Y - button_size / 2), 0);
|
||||
m_screensize.Y - button_size * 3.5,
|
||||
button_size * 3.5,
|
||||
m_screensize.Y - button_size / 2), 0);
|
||||
}
|
||||
|
||||
m_joystick_btn_bg = initJoystickButton(joystick_bg_id,
|
||||
rect<s32>(button_size / 2,
|
||||
m_screensize.Y - button_size * 4.5,
|
||||
button_size * 4.5,
|
||||
m_screensize.Y - button_size / 2),
|
||||
m_screensize.Y - button_size * 4.5,
|
||||
button_size * 4.5,
|
||||
m_screensize.Y - button_size / 2),
|
||||
1, false);
|
||||
|
||||
m_joystick_btn_center = initJoystickButton(joystick_center_id,
|
||||
@ -511,10 +511,10 @@ void TouchScreenGUI::init(ISimpleTextureSource *tsrc)
|
||||
|
||||
// init jump button
|
||||
initButton(jump_id,
|
||||
rect<s32>(m_screensize.X - button_size * 3,
|
||||
m_screensize.Y - button_size * 3,
|
||||
m_screensize.X - button_size * 1.5,
|
||||
m_screensize.Y - button_size * 1.5),
|
||||
rect<s32>(m_screensize.X - button_size * 3.37,
|
||||
m_screensize.Y - button_size * 2.75,
|
||||
m_screensize.X - button_size * 1.87,
|
||||
m_screensize.Y - button_size * 1.25),
|
||||
L"x", false);
|
||||
|
||||
// init drop button
|
||||
@ -527,15 +527,15 @@ void TouchScreenGUI::init(ISimpleTextureSource *tsrc)
|
||||
|
||||
// init crunch button
|
||||
initButton(crunch_id,
|
||||
rect<s32>(m_screensize.X - button_size * 3,
|
||||
m_screensize.Y - button_size / 1.5,
|
||||
m_screensize.X - button_size * 1.5,
|
||||
rect<s32>(m_screensize.X - button_size * 3.38,
|
||||
m_screensize.Y - button_size * 0.75,
|
||||
m_screensize.X - button_size * 1.7,
|
||||
m_screensize.Y),
|
||||
L"H", false);
|
||||
|
||||
// init inventory button
|
||||
initButton(inventory_id,
|
||||
rect<s32>(m_screensize.X - button_size * 1.5,
|
||||
rect<s32>(m_screensize.X - button_size * 1.7,
|
||||
m_screensize.Y - button_size * 1.5,
|
||||
m_screensize.X,
|
||||
m_screensize.Y),
|
||||
@ -547,18 +547,18 @@ void TouchScreenGUI::init(ISimpleTextureSource *tsrc)
|
||||
m_screensize.Y - (4 * button_size),
|
||||
m_screensize.X - (0.25 * button_size),
|
||||
m_screensize.Y - (3 * button_size)),
|
||||
L"z", false);
|
||||
L"z", false);*/
|
||||
|
||||
// init special1/aux button
|
||||
if (!m_joystick_triggers_special1)
|
||||
initButton(special1_id,
|
||||
rect<s32>(m_screensize.X - (1.25 * button_size),
|
||||
m_screensize.Y - (2.5 * button_size),
|
||||
m_screensize.X - (0.25 * button_size),
|
||||
m_screensize.Y - (1.5 * button_size)),
|
||||
rect<s32>(m_screensize.X - button_size * 1.8,
|
||||
m_screensize.Y - button_size * 4,
|
||||
m_screensize.X - button_size * 0.3,
|
||||
m_screensize.Y - button_size * 2.5),
|
||||
L"spc1", false);
|
||||
|
||||
m_settingsbar.init(m_texturesource, "gear_icon.png", settings_starter_id,
|
||||
/* m_settingsbar.init(m_texturesource, "gear_icon.png", settings_starter_id,
|
||||
v2s32(m_screensize.X - (1.25 * button_size),
|
||||
m_screensize.Y - ((SETTINGS_BAR_Y_OFFSET + 1.0) * button_size)
|
||||
+ (0.5 * button_size)),
|
||||
@ -590,15 +590,11 @@ void TouchScreenGUI::init(ISimpleTextureSource *tsrc)
|
||||
m_rarecontrolsbar.addButton(inventory_id, L"inv", "inventory_btn.png");
|
||||
m_rarecontrolsbar.addButton(drop_id, L"drop", "drop_btn.png");*/
|
||||
|
||||
double button_075 = 1;
|
||||
s32 button_05 = 1;
|
||||
double button_05b = 0;
|
||||
|
||||
// init pause button [1]
|
||||
initButton(escape_id,
|
||||
rect<s32>(m_screensize.X / 2 - button_size * 2 * button_075,
|
||||
rect<s32>(m_screensize.X / 2 - button_size * 2,
|
||||
0,
|
||||
m_screensize.X / 2 - button_size / button_05,
|
||||
m_screensize.X / 2 - button_size,
|
||||
button_size),
|
||||
L"Exit", false);
|
||||
|
||||
@ -612,17 +608,17 @@ void TouchScreenGUI::init(ISimpleTextureSource *tsrc)
|
||||
|
||||
// init rangeselect button [3]
|
||||
initButton(range_id,
|
||||
rect<s32>(m_screensize.X / 2 - button_05b,
|
||||
rect<s32>(m_screensize.X / 2,
|
||||
0,
|
||||
m_screensize.X / 2 + button_size / button_05,
|
||||
m_screensize.X / 2 + button_size,
|
||||
button_size),
|
||||
L"rangeview", false);
|
||||
|
||||
// init camera button [4]
|
||||
initButton(camera_id,
|
||||
rect<s32>(m_screensize.X / 2 + button_size / button_05,
|
||||
rect<s32>(m_screensize.X / 2 + button_size,
|
||||
0,
|
||||
m_screensize.X / 2 + button_size * 2 * button_075,
|
||||
m_screensize.X / 2 + button_size * 2,
|
||||
button_size),
|
||||
L"camera", false);
|
||||
|
||||
|
@ -40,9 +40,9 @@ typedef enum
|
||||
jump_id = 0,
|
||||
drop_id,
|
||||
crunch_id,
|
||||
inventory_id,
|
||||
// zoom_id,
|
||||
// special1_id,
|
||||
special1_id,
|
||||
inventory_id,
|
||||
escape_id,
|
||||
minimap_id,
|
||||
range_id,
|
||||
@ -90,8 +90,8 @@ typedef enum
|
||||
// Very slow button repeat frequency
|
||||
#define SLOW_BUTTON_REPEAT 1.0f
|
||||
|
||||
extern const char **button_imagenames;
|
||||
extern const char **joystick_imagenames;
|
||||
extern const char *button_imagenames[];
|
||||
extern const char *joystick_imagenames[];
|
||||
|
||||
struct button_info
|
||||
{
|
||||
@ -123,8 +123,8 @@ public:
|
||||
const char *btn_image);
|
||||
|
||||
// add toggle button to be shown
|
||||
void addToggleButton(touch_gui_button_id id, const wchar_t *caption,
|
||||
const char *btn_image_1, const char *btn_image_2);
|
||||
/*void addToggleButton(touch_gui_button_id id, const wchar_t *caption,
|
||||
const char *btn_image_1, const char *btn_image_2);*/
|
||||
|
||||
// detect settings bar button events
|
||||
bool isButton(const SEvent &event);
|
||||
|
Before Width: | Height: | Size: 1.8 KiB After Width: | Height: | Size: 344 B |
Before Width: | Height: | Size: 332 B After Width: | Height: | Size: 346 B |
Before Width: | Height: | Size: 268 B After Width: | Height: | Size: 274 B |
Before Width: | Height: | Size: 259 B After Width: | Height: | Size: 266 B |
Before Width: | Height: | Size: 291 B After Width: | Height: | Size: 291 B |