Commit Graph

436 Commits (master)

Author SHA1 Message Date
Karl F 9e44b09314 Happy new year!
HAPPY MERRY 2021!
2021-01-03 19:40:16 +01:00
Gliese852 3b76572336 Remove SetDepthRange calls from SectorView.cpp
This function was used to prevent the indicators from overlapping the
stars, Now they just move a little beyond the stars.
2020-12-19 15:22:52 -05:00
Andrew Copland 6f1e8e6c99
Optimise route rendering (#5033)
* Build all of the lines into a single buffer once, render as necessary and offset using the transform

* Added an optimisation during sector selection to reduce the number of sectors generated. Reserving the size of some vectors.

* Stupid formatting

* DistanceBetweenSqr to avoid sqrts

* Avoid more square roots and reserve the nodes array size with a guess at it's required capacity
2020-12-10 16:42:13 -05:00
Gliese852 8bb5d451e9 Some map fixes
- fix segfault in the system map if a centered ship is removed
- reset the system map view if the centered ship is hidden
- if the mission target is a specific systembody, when you press the "set
  as nav target" button, the sector map is set to the correct star of the
  multiple system
- shrink the searchbar window in the sector map when nothing is shown on
  it
2020-12-03 16:56:31 -05:00
Webster Sheets d288b6375a Port LuaConsole to pigui
Still not as perfect as I'd like it, but it runs, works correctly, and closes with ESC.

Need to double-press the console binding to close it due to some state tracking being lost when re-adding the input frame.
2020-12-01 13:02:34 -05:00
Webster Sheets e16b978fca Use PiGuiView instead of UIView 2020-11-25 13:57:52 -05:00
Webster Sheets aeebf6e514 Fix a few bugs with the Input system
- Refactor InputFrame add/remove to support the console better.
- Remove the unneeded HandleSDLEvent virtual method on View.
- Fix a binding name mismatch issue.
- Add a (disabled) PerfInfo debug tab for debugging the input system.
2020-11-15 01:51:34 -05:00
Webster Sheets f5d7038d69 Refactor to InputFrame 2.0
Significantly refactored the Input class, added Input::Manager to handle
most duties of the Input system.

Replaced the legacy KeyBindings system with the new InputBindings
(namespace subject to change) system for handling key state and key
chords - among other improvements, there is no longer a hardcoded
dependency on Pi::input anymore, as well as storing the binding state in
the binding itself, completely decoupling InputBindings from the input
system that handles input events and significantly reducing the
complexity of the binding system.

Input::Manager now is totally responsible for generating binding events,
removing the need for WorldView::HandleSDLEvent and its ilk - interested
parties can simply bind to the onPressed event and they will only be
notified when the binding in question is part of an active input frame
and nothing else has grabbed the input event, vastly simplifying control
flow.

Among other effects, this almost totally eradicates the need for
Pi::IsConsoleActive().

The lua Console widget is slightly broken as a result of this change,
it doesn't handle activation/deactivation state changes properly. The
solution to this seems to simply be a direct rewrite in PiGui, which
I don't expect to cause too many issues.

I've added a CMake option to use LLD to speed up incremental build link
times; this seems to be somewhat platform dependent and is not
implemented for windows at this time.

Serialization of key bindings to the config file is totally completed,
although support for a graphical method of binding multi-key chords is
not anticipated for this pull request.
2020-11-11 18:41:34 -05:00
Webster Sheets e45dd8dbbb Support GL_NV_depth_buffer_float extension
Allows older cards without support for GL_ARB_clip_control to use the reverse-Z buffer
Introduced a ResetDepthRange function to allow SectorView to clean up after itself.
2020-11-03 14:04:41 -05:00
Webster Sheets d3fd88a9ec Add Graphics::ProjectToScreen
This is intended to replace Gui::Screen::Project in 90% of cases
It's a much better function to use especially in the case of a resizing screen.
Rewrite part of SystemView to take advantage of this function.

Fix directional indicators not screen-culling
2020-10-22 16:38:34 -04:00
Webster Sheets ca6d23a71a
Merge pull request #4907 from Gliese852/safe-hyperspace
No more crashes when hyperjumping
2020-09-09 11:30:19 -04:00
Webster Sheets 5490eb55ad Move easing to AnimationCurves.h 2020-09-09 11:29:31 -04:00
Webster Sheets 4d3fcb5b84 Deprecate matrix4x4d renderer methods, add better Viewport handling 2020-09-07 15:31:15 -04:00
Webster Sheets e83dd6c887 Matrix state must(did!) die
Remove all OpenGL 2.x like methods from the renderer API, now the matrix state
is the responsibility of the caller via MatrixTicket / StateTicket.

Still TODO is improving the viewport state tracking, although that should be
rather simple to fix.
2020-09-07 15:31:15 -04:00
Gliese852 aeeea56e97 Fix crashes when hyperjump with a map opened
Fixes #4901

System map: add a check to see if we are in hyperspace

Sector map:
 - move the drawing of the player's indicator from DrawNearSector up to
Draw3D
 - calculate the interpolated position of the player's indicator during
a hyperjump
 - don't display current system during hyperjump (lua-side)
 - fix selected system indicator (green circle), it pointed not to
the the selected system, but to the current system

Also:
 - add easing function into utils.cpp to smooth the movement of the
player indicator
 - move fuel reduction from the start of the hyperjump to the end
 - force handling of lua events immediately after entering system
2020-09-06 13:00:19 +03:00
Webster Sheets f748b0a2e9 Cleanup SectorView, move nav target sound to pigui
- Moved playing the 'target selected' sound to PiGui instead of C++
- Removed several unused functions/methods from SectorView
- Removed the WorldView method handler previously responsible for playing the target selected sound
- Better documentation and behavior for pigui.playSfx
2020-08-02 17:35:29 -04:00
Gliese852 548ce5ec01 Another 2 fixes to the sector map
- fix that Auto Route button crashes game when no hyperdrive fitted. Add
3 possible options - successful route building, no drive, no valid
route. Also turn the last static function in LuaSectorView.cpp into a
lambda, because it turned out that it was not needed in other functions.

- fix that when moving the SectorView camera by entering coordinates to
the search field, the camera position gets "locked" to the coordinates
and you can't move it (now it moves only when the search bar changes)
2020-07-10 16:09:45 +03:00
Gliese852 3643130a8d Fix some things with regards to the sector map
- clear route strings when enging the game, otherwise, when the game
restarts, a segfault occurs

- fix that the "remove jump" button continued to remove jumps even
when the route became empty

- reordered sections in the object information widget, added icons to
the names of stars in the multisystem

- it turns out that a hyper jump is possible not only to the stars, but
also to the "substellar objects", but they do not return in the method
GetStars. Since a specific body should be shown in the route planner,
implemented an additional method GetJumpable, that gets all the bodies
available for jumping (IsJumpable == true), and this is synchronized
with what you can click in the systeminfo view

- also I had to change the route check, now it’s not the star index that
is checked, but just the path (this check is performed for multisystems,
so that only the specific body that registered in the route is always
selected)

- remove method SectorView::SwapSelectedHyperspaceTarget, because it is
not used anywhere

- clang satisfaction
2020-07-05 21:03:56 +03:00
Gliese852 5330100577 Additional minor tweaks to the maps
- move detailed route calculation to a separate function, now it does
not execute every frame, only when changing the route or when changing
the equipment
- attach lambda functions to the OnPressed callbacks of these input actions
instead of the generic OnKeyPressed callback
- add some comments
2020-06-30 21:15:25 +03:00
Webster Sheets de88ea05b5 Final SectorView improvements
- Change view movement mode to XY-constrained planar movement
- Rename map movement axes, invert key bindings for consistency
- Fix axis colorations in Drawables::Axes3D
2020-06-23 18:56:33 -04:00
Gliese852 9a37b54816 Final indentation of modified files
- indent data/pigui/modules/map-sector-view.lua
- indent data/pigui/modules/system-view-ui.lua
- indent src/SectorView.cpp
2020-06-05 22:45:49 +03:00
Gliese852 17e850e3a3 Add input bindings for the maps to the settings
- Used the previously defined lines in /core/*.json, so I added an
additional line search for this directory
- Add some strings to input-core/en.json
- Convert key pairs in axis
- Remove unused bindings in KeyBindings.h
- Completely remove several bindings that became irrelevant
- Use some input bindings for the sector map in the system map
2020-06-05 22:45:44 +03:00
Gliese852 1e2e471e42 Redesign the sector map buttons and windows
- redo the hyperjump planner from a separate module to a part of the
system map module, so that its position and size could be controlled by
system map module
- add a button bar on the right
- add handler functions for the zooming and rotation buttons to the
SectorView class, and LuaSectorView.cpp
- add the actual measurement of the size of the windows, or rather their
simplified counterparts (dummies) to precisely align the windows
relative to each other
- add button for centering on the selected object
- add function SwitchToPath, that only selects the system or also moves
to it, depending on the settings
- replace "SetHyperSpaceTarget" function to "SwitchToPath" function, when
player click "Set As Navigation Target" in mission briefing
- draw legs for all systems in the route
- draw lines to the selected system from the current system and from the
end of the route
- set visibility params from button states every game start

Bold decisions to simplify the interface:

- remove the description of the current system and the hyperjump target,
now there is a description of only the selected system
- hyperjump is done *only* to the next waypoint
- not a system is remembered in the route, but a specific star, and the
jump is carried out on it
2020-06-05 22:45:34 +03:00
Edoardo Morandi e6b9cd8d71 Remove many warnings 2020-04-25 01:31:42 +02:00
Webster Sheets 0c67f400c9 Clean up header dependencies
A lot of source files were depending on utils.h being included by other headers
Cleaned up code that was depending on Input.h being included in Pi.h
2020-03-27 16:45:17 -04:00
Webster Sheets 64e768e9c5 Change Pi::input to a pointer
Pi.cpp is not included because it's currently being gutted
Decoupled Input::Init() from Pi::config to better support headless mode
2020-03-26 00:34:04 -04:00
Webster Sheets ec410f31d8 Update includes to point to new lua/ directory 2020-01-20 18:13:45 -05:00
Karl F 436db08636 Happy new decade!
May you live long and prosper!
2020-01-01 10:47:46 +01:00
Andrew Copland 9d3d3572cb Avoid checking labels when we don't need too 2019-10-13 17:16:53 +01:00
mike-f1 ea4594bfb8 Address some warnings 2019-05-21 17:50:50 +02:00
mike-f1 75956b9fd0 Decouple includes of Sfx.* and trade dependency from Ship with dependency from ModelBody
Forward declare Space in Ship.h; Make things compiling again

Decouple WorldView.h; Some other decouple here and there

Decouple Renderer no more included in RenderState; Model not including directly its childs
2019-05-21 17:50:50 +02:00
mike-f1 1de66bf587 Include decouple, second round 2019-02-15 21:57:17 +01:00
Peter 8244015609 Search for and show additional system names on map. 2019-02-07 17:53:41 +01:00
mike-f1 f1a53cffd6 Remove some inludes from Pi and get things right in order to compile 2019-01-22 20:10:28 +01:00
Webster Sheets 5cdaefad6a Run clang-format over the entire code base.
Fix hidden header-inclusion-order dependency errors.
Update .clang-format for v7.0.1.
2019-01-05 17:09:05 -05:00
Karl F d2ab921b62 Happy New Year!
Awesome sauce (for next year):
find . -type f -exec sed -i 's/2008-2018 Pioneer Developers'/'2008-2019 Pioneer Developers/g' {} \;

closes #4507
2019-01-03 15:28:42 +01:00
Andrew Copland 4be499f98f Fix the unused variable warnings caused by (Json::type_error &e) 2018-10-17 21:38:23 +01:00
Webster Sheets 3a3a13edec Update pioneer to use the new save system. 2018-10-11 11:45:57 -04:00
Webster Sheets e8a98c2b6a Improve Joystick / Input Handling (#4432)
* Get input handling into its own class, get it out of the core monolith.

* Started work on implementing the input refactor.

Don't even bother compiling this one, it is absolutely broken.

* Continue upgrading and implementing.

Still don't try to compile this.

* IT'S ALIVE!

Or, in other words, it compiles and runs just fine. Still need to re-implement
axis binding and finish moving away from KeyBindings.inc.h, but we're most of
the way there.

* Moved the lua-side code over to the new system.

Still needs changes to work with the localization system and properly
implement axis deadzone and inversion, but it's most of the way there.

* Finalized the new Input changes.
2018-09-06 12:15:17 +01:00
Joscha 857838ed4d Fix issue #4383 2018-07-13 18:32:51 +00:00
Andrew Copland 5f4295d041 Remove unused variable and update the comment 2018-01-24 11:26:33 +00:00
Andrew Copland b59a97c0ef DistanceFromLine for lines of infinite length. unordered_set replaces set. use of range based for loops. 2018-01-20 14:41:18 +00:00
Andrew Copland 20257162b0 DistanceFromLine test added to MathUtil, used to constrain Sectors used for route planning. 2018-01-19 23:16:32 +00:00
Andrew Copland c12238c5af Avoid GetSector is sector out of maxRange, limited sectors to tighter bounds, return route as parameter. 2018-01-19 22:34:55 +00:00
Taylor Talkington 9d09681980 Add HyperJump Planner to Sector Map
Hyperjump Planner also includes an 'auto-route' feature
that selects the shortest duration route based on Dijkstra's algorithm.

Changes in addition to the hyperjump planner:
Reduced font size (declutters the sector map)
Expose ui.isItemClicked
Added a yellow line to the sector map for the selected route
Reduced the squares in the 'far' sector map to 0.25 size
Reduced alpha of the squares in the 'far' sector map
2018-01-17 16:34:04 -05:00
Peter 4a694e21e6 Move sector view to imgui/lua 2018-01-16 14:29:00 +01:00
Andrew Copland 40f6cf6ef7
Merge pull request #4245 from joonicks/prettier-homeworld-labels
sectorview zoomout prettier homeworld labels
2018-01-09 10:02:24 +00:00
joonicks a5abfd1e5e sectorview zoomout prettier homeworld labels
no more quick and dirty labels. made the point stand out from the background clutter with contrast background. centered the label and decreased the margins slightly. label no longer overlaps the star.
2018-01-01 23:08:43 +01:00
Karl F 7225e9c723 Happy New Year!
Ten years in the making now, but how can we improve upon perfection
for ten more years?
2018-01-01 21:22:12 +01:00
joonicks e81babded5 UnexploredGray
zoomed out sectorview shows unexplored stars as gray instead of independent yellow.
2017-12-29 21:38:51 +01:00