Browse Source

Add comments for the logic used when drawing voice buttons

pull/5986/head
ephphatha 3 years ago committed by Anders Jenbo
parent
commit
3690759eb9
  1. 17
      Source/control.cpp

17
Source/control.cpp

@ -1342,15 +1342,22 @@ void DrawTalkPan(const Surface &out)
UiFlags color = player.friendlyMode ? UiFlags::ColorWhitegold : UiFlags::ColorRed;
const Point talkPanPosition = mainPanelPosition + Displacement { 172, 84 + 18 * talkBtn };
if (WhisperList[i]) {
if (TalkButtonsDown[talkBtn]) {
ClxDraw(out, talkPanPosition, (*talkButtons)[talkBtn != 0 ? 3 : 2]);
if (TalkButtonsDown[talkBtn]) { // the normal (unpressed) voice button is pre-rendered on the panel, only need to draw over it when the button is held
unsigned spriteIndex = talkBtn == 0 ? 2 : 3; // the first button sprite includes a tip from the devils wing so is different to the rest.
ClxDraw(out, talkPanPosition, (*talkButtons)[spriteIndex]);
// Draw the translated string over the top of the default (english) button. This graphic is inset to avoid overlapping the wingtip, letting
// the first button be treated the same as the other two further down the panel.
RenderClxSprite(out, (*TalkButton)[2], talkPanPosition + Displacement { 4, -15 });
}
} else {
int nCel = talkBtn != 0 ? 1 : 0;
unsigned spriteIndex = talkBtn == 0 ? 0 : 1; // the first button sprite includes a tip from the devils wing so is different to the rest.
if (TalkButtonsDown[talkBtn])
nCel += 4;
ClxDraw(out, talkPanPosition, (*talkButtons)[nCel]);
spriteIndex += 4; // held button sprites are at index 4 and 5 (with and without wingtip respectively)
ClxDraw(out, talkPanPosition, (*talkButtons)[spriteIndex]);
// Draw the translated string over the top of the default (english) button. This graphic is inset to avoid overlapping the wingtip, letting
// the first button be treated the same as the other two further down the panel.
RenderClxSprite(out, (*TalkButton)[TalkButtonsDown[talkBtn] ? 1 : 0], talkPanPosition + Displacement { 4, -15 });
}
if (player.plractive) {

Loading…
Cancel
Save