Skip to content

Commit

Permalink
- fixed mouse coordinate checks when using the generic VGA font with …
Browse files Browse the repository at this point in the history
…Strife conversations.
  • Loading branch information
coelckers committed Aug 7, 2019
1 parent 3c449f3 commit 352d5d0
Showing 1 changed file with 7 additions and 2 deletions.
9 changes: 7 additions & 2 deletions wadsrc/static/zscript/ui/menu/conversationmenu.zs
Expand Up @@ -93,6 +93,7 @@ class ConversationMenu : Menu
int fontScale;
int refwidth;
int refheight;
double fontfactor;

int SpeechWidth;
int ReplyWidth;
Expand Down Expand Up @@ -125,6 +126,7 @@ class ConversationMenu : Menu
displayWidth = CleanWidth;
displayHeight = CleanHeight;
fontScale = CleanXfac;
fontFactor = 1;
refwidth = 320;
refheight = 200;
ReplyWidth = 320-50-10;
Expand All @@ -137,6 +139,7 @@ class ConversationMenu : Menu
{
displayFont = NewSmallFont;
fontScale = (CleanXfac+1) / 2;
fontFactor = double(CleanXfac) / fontScale;
refwidth = 640;
refheight = 400;
ReplyWidth = 640-100-20;
Expand Down Expand Up @@ -363,10 +366,12 @@ class ConversationMenu : Menu
// convert x/y from screen to virtual coordinates, according to CleanX/Yfac use in DrawTexture
x = ((x - (screen.GetWidth() / 2)) / fontScale) + refWidth/2;
y = ((y - (screen.GetHeight() / 2)) / fontScale) + refHeight/2;

int ypos = int(mYpos * FontFactor);

if (x >= 24 && x <= refWidth-24 && y >= mYpos && y < mYpos + fh * mResponseLines.Size())
if (x >= 24 && x <= refWidth-24 && y >= ypos && y < ypos + fh * mResponseLines.Size())
{
sel = (y - mYpos) / fh;
sel = (y - ypos) / fh;
for(int i = 0; i < mResponses.Size(); i++)
{
if (mResponses[i] > sel)
Expand Down

0 comments on commit 352d5d0

Please sign in to comment.