Adds baseRange parameter to parabolic queries for combined
2D + parabolic detection. StandGround and Chase stances now
use attack range (parabolic) with vision as baseRange, allowing
units to attack enemies visible through friendly vision.
Buildings benefit as well via BuildingAI.
Introduce CanEverReachTarget in the Attack component to check whether
a target is geometrically reachable at all, accounting for height
offsets and turreted units inside buildings.
For non-parabolic attacks (e.g. melee), a simple 3D distance check
from the closest approach point is used.
For parabolic attacks (e.g. ranged), the parabolic range formula
is used to determine if the height difference is surmountable
from the closest horizontal distance to the target.
Add GetClosestApproachDistanceToTurretPoint to TurretHolder
to estimate the minimum horizontal distance to a turret point,
using its local offset and the holder's obstruction size.
Passable buildings are not considered obstacles.
Fixes units on the ground trying to attack unreachable units on walls
or towers when the projectile's arc cannot reach the required height.
The parabolic range formula in GetEffectiveParabolicRange was only
computating height differences from manual HeightOffset values,
completely ignoring actual terrain elevation.
This meant units on hills received no tactical advantage
despite the UI stat tooltip correctly showing extended ranges.
Fixes#8889
Split mouse wheel scroll handling into horizontal and vertical. Keep
vertical scroll for zooming and use horizontal to rotate around the y
axis replicating the behaviour of the main game.
Signed-off-by: Ralph Sennhauser <ralph.sennhauser@gmail.com>
We don't need to use pointers because we know lifetimes of all
renderers. And its list statically defined. A new renderer should follow
DOD and use a separate submission list with a separate inplace renderer.
Separates submitted models and moder renderer and makes relations
explicit. Now it's clear that we don't need separate ModelRenderer and
ModelVertexRenderer.
We use only shaders to render models so we don't need a separate class.
BatchModelRenderer was renamed in 6bc33fe8bd.
m_Renderer became unused in 0346ba1b18.
CSimulation2 used , CSimulation2Impl mixed /, and
CTurnManager used for the same turn-count concept, forcing a
static_cast<int64_t> at the one place these types already met
(rejoin-test comparison).
Add (alias for std::int32_t) in SimulationCommand.h and use
it consistently for every turn counter in CSimulation2/Impl,
CTurnManager and its subclasses (CLocalTurnManager,
CReplayTurnManager), CNetServerTurnManager/CNetClientTurnManager, and
the network wire format (m_Turn in CEndCommandBatchMessage,
CSimulationMessage, CSyncCheckMessage, CSyncErrorMessage, and
m_CurrentTurn in CLoadedGameMessage).
Turn *duration* fields (m_TurnLength, m_CommandDelay,
DEFAULT_TURN_LENGTH, COMMAND_DELAY_SP/MP, SetTurnLength,
GetSavedTurnLength return type) are left as u32 — they're milliseconds,
not a counter, and out of scope here.
Remaining turn_id_t vs size_t comparisons use std::cmp_equal or
explicit casts, matching the existing pattern in Simulation2.cpp.
Fixes#8718
Doesn't make sense to have the Paths StaticBox inside the Common
settings StaticBox so make it a top-level item as well.
While at it dissolve nested constructors to make the creation of the
widgets more readable.
Signed-off-by: Ralph Sennhauser <ralph.sennhauser@gmail.com>
To follow coding convention rename the vector Node to m_Nodes,
MaxDistance to m_MaxDistance and NodeCount to m_NodeCount.
Signed-off-by: Ralph Sennhauser <ralph.sennhauser@gmail.com>
Commit 81c57e8a28 added support for adding and removing paths.
Reloading path list stores the current selection but it's unused, assume
the idea was to restore it again.
Signed-off-by: Ralph Sennhauser <ralph.sennhauser@gmail.com>
Commit 309ed5ef28 used dynamic events
which prevents some other menu items from working properly. So don't mix
static and dynamic events for top window.
Signed-off-by: Ralph Sennhauser <ralph.sennhauser@gmail.com>
The issue was introduced by 8a2a450686.
It affected GUI text objects (CText) with `scrollbar` set to true; when
their caption was long enough for a scrollbar to be visible and then the
size changed (got bigger) so that no scrollbar was needed anymore, then
for a single frame the text was completely misaligned. This happened
because in `CText::Draw` the scrollbar wasn't updated yet, so the newly
added `GetScrollBar(0).IsVisible()` check still returned true, even
though it wouldn't end up being rendered anyway -- it was updated in
`IGUITextOwner::DrawText` eventually.
This happened to the tutorial info panel in the starting economy
walkthrough, for example. Note: in that case the scrollbar wasn't ever
drawn, but it was temporarily set visible within a frame by the JS
object resizing logic.
966727b52e made the player state an enum and introduced more descriptive
functions to achieve the same thing, but it seems they were forgotten to
be replaced in a few places, which this patch fixes.
WX may still generate mouse events after calling CVideoMode::Shutdown(),
so don't create SDL events triggering assertions.
Signed-off-by: Ralph Sennhauser <ralph.sennhauser@gmail.com>
If we catch the signal we'd have to communicate that we terminated by
signal, which might depend on shell. There is also the issue of various
dialogs blocking regular quit which we don't want, so that would need
extra work as well.
As such just let the SIGINT/SIGTERM do there default action and forgo
cleanup and let the OS handle it.
Fixes: #198
Signed-off-by: Ralph Sennhauser <ralph.sennhauser@gmail.com>
Add a fullscreen toggle to the View menu and with a global hotkey,
reusing the default one from the main game.
Unlike the current implementation this one doesn't need the game canvas
to be focused and also works on GTK.
Signed-off-by: Ralph Sennhauser <ralph.sennhauser@gmail.com>