diff options
author | Stijn Buys <ingar@osirion.org> | 2013-10-15 19:57:27 +0000 |
---|---|---|
committer | Stijn Buys <ingar@osirion.org> | 2013-10-15 19:57:27 +0000 |
commit | ce62661012a167d48bd6117940a551355eb6773b (patch) | |
tree | 67fa5c937559e16e367f069007e825548ad57573 /src/client | |
parent | aabb379d84afab3679acc6dc4472d886dae88f39 (diff) |
Added ship autopilot, removed entity_controlflags, added goto ui button.
Diffstat (limited to 'src/client')
-rw-r--r-- | src/client/gamewindow.cc | 18 | ||||
-rw-r--r-- | src/client/gamewindow.h | 1 | ||||
-rw-r--r-- | src/client/input.cc | 17 | ||||
-rw-r--r-- | src/client/keyboard.cc | 2 |
4 files changed, 25 insertions, 13 deletions
diff --git a/src/client/gamewindow.cc b/src/client/gamewindow.cc index 929cfe4..fb6c88d 100644 --- a/src/client/gamewindow.cc +++ b/src/client/gamewindow.cc @@ -42,6 +42,7 @@ GameWindow::GameWindow(ui::Widget *parent) : ui::Window(parent) gamewindow_menubutton = new ui::IconButton(this, "bitmaps/icons/button_menu", "ui_menu"); gamewindow_launchbutton = new ui::IconButton(this, "bitmaps/icons/button_launch", "launch"); + gamewindow_gotobutton = new TargetIconButton(this, "bitmaps/icons/button_goto", "goto"); gamewindow_dockbutton = new TargetIconButton(this, "bitmaps/icons/button_dock", "dock", core::Entity::Dockable); gamewindow_homebutton = new ui::IconButton(this, "bitmaps/icons/button_home", "view main"); @@ -268,17 +269,18 @@ void GameWindow::resize() // icons const float icon_margin = 4.0f; const float icon_size = 48.0f; - const float icon_count = 7; + const float icon_count = 8; const float l = (width() - ((icon_count + 1) * icon_margin) - (icon_count * icon_size)) * 0.5f; gamewindow_menubutton->set_geometry(l, icon_margin, icon_size, icon_size); // spacer - gamewindow_dockbutton->set_geometry(l + 2.0f *(icon_margin + icon_size), icon_margin, icon_size, icon_size); - gamewindow_launchbutton->set_geometry(l + 2.0f *(icon_margin + icon_size), icon_margin, icon_size, icon_size); - gamewindow_homebutton->set_geometry(l + 3.0f *(icon_margin + icon_size), icon_margin, icon_size, icon_size); - gamewindow_inventorybutton->set_geometry(l + 4.0f *(icon_margin + icon_size), icon_margin, icon_size, icon_size); - gamewindow_chatbutton->set_geometry(l + 5.0f *(icon_margin + icon_size), icon_margin, icon_size, icon_size); - gamewindow_mapbutton->set_geometry(l + 6.0f *(icon_margin + icon_size), icon_margin, icon_size, icon_size); + gamewindow_gotobutton->set_geometry(l + 2.0f *(icon_margin + icon_size), icon_margin, icon_size, icon_size); + gamewindow_dockbutton->set_geometry(l + 3.0f *(icon_margin + icon_size), icon_margin, icon_size, icon_size); + gamewindow_launchbutton->set_geometry(l + 4.0f *(icon_margin + icon_size), icon_margin, icon_size, icon_size); + gamewindow_homebutton->set_geometry(l + 5.0f *(icon_margin + icon_size), icon_margin, icon_size, icon_size); + gamewindow_inventorybutton->set_geometry(l + 6.0f *(icon_margin + icon_size), icon_margin, icon_size, icon_size); + gamewindow_chatbutton->set_geometry(l + 7.0f *(icon_margin + icon_size), icon_margin, icon_size, icon_size); + gamewindow_mapbutton->set_geometry(l + 8.0f *(icon_margin + icon_size), icon_margin, icon_size, icon_size); // reposition buy menu gamewindow_buymenu->event_resize(); @@ -311,9 +313,11 @@ void GameWindow::draw() if (core::localcontrol()->state() == core::Entity::Docked) { gamewindow_launchbutton->show(); + gamewindow_gotobutton->hide(); gamewindow_dockbutton->hide(); } else { gamewindow_launchbutton->hide(); + gamewindow_gotobutton->show(); gamewindow_dockbutton->show(); } diff --git a/src/client/gamewindow.h b/src/client/gamewindow.h index d6e36db..24bc311 100644 --- a/src/client/gamewindow.h +++ b/src/client/gamewindow.h @@ -92,6 +92,7 @@ private: TradeMenu *gamewindow_trademenu; ui::IconButton *gamewindow_menubutton; + ui::IconButton *gamewindow_gotobutton; ui::IconButton *gamewindow_dockbutton; ui::IconButton *gamewindow_launchbutton; ui::IconButton *gamewindow_homebutton; diff --git a/src/client/input.cc b/src/client/input.cc index fcf33f8..fed76c9 100644 --- a/src/client/input.cc +++ b/src/client/input.cc @@ -889,19 +889,26 @@ void frame() if ((render::Camera::mode() == render::Camera::Track) || (render::Camera::mode() == render::Camera::Cockpit)) { - //local_direction = mouse_direction * math::absf(mouse_direction); - //local_pitch = mouse_pitch * math::absf(mouse_pitch); local_direction = mouse_direction; local_pitch = mouse_pitch; + + // enable autopilot override + local_controlflags = local_controlflags | core::EntityControlable::ControlFlagOverride; } else if (render::Camera::mode() == render::Camera::Free) { - // squared values to smoothen camera movement + render::Camera::set_direction(-mouse_direction * math::absf(mouse_direction)); render::Camera::set_pitch(-mouse_pitch * math::absf(mouse_pitch)); + + // disable autopilot override + local_controlflags = local_controlflags & ~core::EntityControlable::ControlFlagOverride; } + } else { + // disable autopilot override + local_controlflags = local_controlflags & ~core::EntityControlable::ControlFlagOverride; } - + math::clamp(local_direction, -1.0f, 1.0f); math::clamp(local_pitch, -1.0f, 1.0f); math::clamp(local_roll, -1.0f, 1.0f); @@ -929,7 +936,7 @@ void frame() local_vstrafe = 0.0f; local_strafe = 0.0f; local_afterburner = 0.0f; - local_controlflags = 0; + local_controlflags = core::EntityControlable::ControlFlagNone; render::Camera::set_direction(0.0f); render::Camera::set_pitch(0.0f); diff --git a/src/client/keyboard.cc b/src/client/keyboard.cc index d5a14ec..43d4e7e 100644 --- a/src/client/keyboard.cc +++ b/src/client/keyboard.cc @@ -179,7 +179,7 @@ Keyboard::Keyboard() add_key("pagedown", SDLK_PAGEDOWN); add_key("f1", SDLK_F1); - add_key("f2", SDLK_F2); + add_key("f2", SDLK_F2, 0, "@goto"); add_key("f3", SDLK_F3, 0, "@dock"); key = add_key("f4", SDLK_F4); #ifdef _WIN32 |