[BUG] Selected button redrawn after backskip / Skill panel sound muted post-fix

Started by WillLem, April 14, 2023, 03:44:20 AM

Previous topic - Next topic

0 Members and 1 Guest are viewing this topic.

WillLem

This double-bug is present in NeoLemmix as well (mods: by all means merge these topics).

The current fix for the first bug causes the second bug:

1) The 'selected' graphic is re-drawn over the pause button after subsequent backwards framesteps.

2) The skill panel sound (SFX_SKILLBUTTON / 'changeop') doesn't trigger.

WillLem

I think this should do it. This fix for bug 2 keeps the current fix for bug 1 intact:

Moved this...:

(in procedure TBaseSkillPanel.DrawHighlight)

if (fLastHighlitSkill <> spbNone) and (fLastHighlitSkill <> fHighlitSkill) then
    SoundManager.PlaySound(SFX_SKILLBUTTON);


...to here:

procedure TBaseSkillPanel.DrawButtonSelector(aButton: TSkillPanelButton; Highlight: Boolean);
begin
  if fGameWindow.IsHyperSpeed then Exit;
  if aButton = spbNone then Exit;
  if (aButton <= LAST_SKILL_BUTTON) then
  begin
    if (fLastHighlitSkill <> spbNone) and (fLastHighlitSkill <> fHighlitSkill) then      <--------------------------------------
    SoundManager.PlaySound(SFX_SKILLBUTTON);                                             <--------------------------------------
    if (fHighlitSkill = aButton) and Highlight then Exit;
    if (fHighlitSkill = spbNone) and not Highlight then Exit;
  end;
  if fButtonRects[aButton].Left <= 0 then Exit;

  RemoveHighlight(aButton);
  if Highlight then
    DrawHighlight(aButton);
end;

namida

My projects
2D Lemmings: NeoLemmix (engine) | Lemmings Plus Series (level packs) | Doomsday Lemmings (level pack)
3D Lemmings: Loap (engine) | L3DEdit (level / graphics editor) | L3DUtils (replay / etc utility) | Lemmings Plus 3D (level pack)
Non-Lemmings: Commander Keen: Galaxy Reimagined (a Commander Keen fangame)