Skip to content

Commit

Permalink
Hopefully avoided 'wanna fight popups' after map change, game over, etc
Browse files Browse the repository at this point in the history
  • Loading branch information
Pyrdacor committed Jul 12, 2022
1 parent e583721 commit 04cf37b
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 0 deletions.
3 changes: 3 additions & 0 deletions Ambermoon.Core/Game.cs
Original file line number Diff line number Diff line change
Expand Up @@ -383,6 +383,7 @@ Position LimitPartyPosition(Position position)
bool allInputDisabled = false;
bool inputEnable = true;
bool paused = false;
public bool Fading { get; private set; } = false;
internal bool ConversationTextActive { get; private set; } = false;
Func<MouseButtons, bool> nextClickHandler = null;
/// <summary>
Expand Down Expand Up @@ -4737,12 +4738,14 @@ void Shake()

void Fade(Action midFadeAction, bool changeInputEnableState = true)
{
Fading = true;
if (changeInputEnableState)
allInputDisabled = true;
layout.AddFadeEffect(new Rect(0, 36, Global.VirtualScreenWidth, Global.VirtualScreenHeight - 36), Render.Color.Black, FadeEffectType.FadeInAndOut, FadeTime);
AddTimedEvent(TimeSpan.FromMilliseconds(FadeTime / 2), midFadeAction);
if (changeInputEnableState)
AddTimedEvent(TimeSpan.FromMilliseconds(FadeTime), () => allInputDisabled = false);
AddTimedEvent(TimeSpan.FromMilliseconds(FadeTime + 1), () => Fading = false);
}

internal void DamageAllPartyMembers(Func<PartyMember, uint> damageProvider, Func<PartyMember, bool> affectChecker = null,
Expand Down
3 changes: 3 additions & 0 deletions Ambermoon.Core/Render/MapCharacter2D.cs
Original file line number Diff line number Diff line change
Expand Up @@ -464,6 +464,9 @@ bool HandleConversation(IConversationPartner conversationPartner)
if (game.Teleporting || game.Map != Map.Map)
return false;

if (game.Fading || game.PopupActive || game.CurrentWindow.Window != UI.Window.MapView)
return false;

// First set this to max so we won't trigger this again while we are interacting.
lastInteractionTicks = uint.MaxValue;
interacting = true;
Expand Down
3 changes: 3 additions & 0 deletions Ambermoon.Core/Render/RenderMap3D.cs
Original file line number Diff line number Diff line change
Expand Up @@ -312,6 +312,9 @@ bool TriggerCharacterEvents(uint eventIndex)
if (game.Teleporting || game.Map != map.Map)
return false;

if (game.Fading || game.PopupActive || game.CurrentWindow.Window != UI.Window.MapView)
return false;

// First set this to max so we won't trigger this again while we are interacting.
lastInteractionTicks = uint.MaxValue;
interacting = true;
Expand Down

0 comments on commit 04cf37b

Please sign in to comment.