forked from 0ad/0ad
Remove CinemaManager input handler to allow user interaction on other GUI pages like message boxes and possibly few selected hotkeys.
Disable gameview/camera hotkeys while cinematic paths are playing.
Differential Revision: https://code.wildfiregames.com/D697
Refs #3301, #3814, 89aef0b6eb
Reviewed By: Vladislav
This was SVN commit r19980.
This commit is contained in:
parent
1eca31cda6
commit
cb18830a81
@ -487,6 +487,9 @@ function getPreferredEntities(ents)
|
||||
|
||||
function handleInputBeforeGui(ev, hoveredObject)
|
||||
{
|
||||
if (GetSimState().cinemaPlaying)
|
||||
return false;
|
||||
|
||||
// Capture mouse position so we can use it for displaying cursors,
|
||||
// and key states
|
||||
switch (ev.type)
|
||||
@ -810,6 +813,9 @@ function handleInputBeforeGui(ev, hoveredObject)
|
||||
|
||||
function handleInputAfterGui(ev)
|
||||
{
|
||||
if (GetSimState().cinemaPlaying)
|
||||
return false;
|
||||
|
||||
if (ev.hotkey === undefined)
|
||||
ev.hotkey = null;
|
||||
|
||||
|
@ -238,31 +238,6 @@ void CCinemaManager::DrawBars() const
|
||||
#endif
|
||||
}
|
||||
|
||||
InReaction cinema_manager_handler(const SDL_Event_* ev)
|
||||
{
|
||||
// put any events that must be processed even if inactive here
|
||||
if (!g_Game || !g_Game->IsGameStarted())
|
||||
return IN_PASS;
|
||||
|
||||
CCinemaManager* pCinemaManager = g_Game->GetView()->GetCinema();
|
||||
|
||||
return pCinemaManager->HandleEvent(ev);
|
||||
}
|
||||
|
||||
InReaction CCinemaManager::HandleEvent(const SDL_Event_* ev) const
|
||||
{
|
||||
switch (ev->ev.type)
|
||||
{
|
||||
case SDL_MOUSEBUTTONDOWN:
|
||||
case SDL_MOUSEBUTTONUP:
|
||||
// Prevent selection of units while the path is playing
|
||||
if (IsPlaying())
|
||||
return IN_HANDLED;
|
||||
default:
|
||||
return IN_PASS;
|
||||
}
|
||||
}
|
||||
|
||||
bool CCinemaManager::IsEnabled() const
|
||||
{
|
||||
CmpPtr<ICmpCinemaManager> cmpCinemaManager(g_Game->GetSimulation2()->GetSimContext().GetSystemEntity());
|
||||
|
@ -51,7 +51,6 @@ public:
|
||||
*/
|
||||
void Update(const float deltaRealTime) const;
|
||||
|
||||
InReaction HandleEvent(const SDL_Event_* ev) const;
|
||||
bool GetPathsDrawing() const;
|
||||
void SetPathsDrawing(const bool drawPath);
|
||||
|
||||
@ -59,6 +58,4 @@ private:
|
||||
bool m_DrawPaths;
|
||||
};
|
||||
|
||||
extern InReaction cinema_manager_handler(const SDL_Event_* ev);
|
||||
|
||||
#endif
|
||||
|
@ -1053,7 +1053,7 @@ void CGameView::SetCameraProjection()
|
||||
InReaction game_view_handler(const SDL_Event_* ev)
|
||||
{
|
||||
// put any events that must be processed even if inactive here
|
||||
if(!g_app_has_focus || !g_Game || !g_Game->IsGameStarted())
|
||||
if (!g_app_has_focus || !g_Game || !g_Game->IsGameStarted() || g_Game->GetView()->GetCinema()->IsEnabled())
|
||||
return IN_PASS;
|
||||
|
||||
CGameView *pView=g_Game->GetView();
|
||||
|
@ -580,8 +580,6 @@ static void InitInput()
|
||||
|
||||
in_add_handler(touch_input_handler);
|
||||
|
||||
in_add_handler(cinema_manager_handler);
|
||||
|
||||
// must be registered after (called before) the GUI which relies on these globals
|
||||
in_add_handler(GlobalsInputHandler);
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user