- fixed layout issues with Strife's dialogues.

They were using some settings from the option menu which they never should have used to begin with.
This commit is contained in:
Christoph Oelckers 2019-03-19 17:46:59 +01:00
parent be7d6241c2
commit a1acc4adc4
4 changed files with 15 additions and 9 deletions

View file

@ -56,6 +56,7 @@
#include "scripting/types.h" #include "scripting/types.h"
int DMenu::InMenu; int DMenu::InMenu;
static ScaleOverrider *CurrentScaleOverrider;
// //
// Todo: Move these elsewhere // Todo: Move these elsewhere
// //
@ -348,7 +349,7 @@ bool DMenu::TranslateKeyboardEvents()
// //
//============================================================================= //=============================================================================
void M_StartControlPanel (bool makeSound) void M_StartControlPanel (bool makeSound, bool scaleoverride)
{ {
// intro might call this repeatedly // intro might call this repeatedly
if (CurrentMenu != nullptr) if (CurrentMenu != nullptr)
@ -372,6 +373,7 @@ void M_StartControlPanel (bool makeSound)
} }
BackbuttonTime = 0; BackbuttonTime = 0;
BackbuttonAlpha = 0; BackbuttonAlpha = 0;
if (scaleoverride && !CurrentScaleOverrider) CurrentScaleOverrider = new ScaleOverrider;
} }
//============================================================================= //=============================================================================
@ -912,6 +914,8 @@ void M_ClearMenus()
CurrentMenu = parent; CurrentMenu = parent;
} }
menuactive = MENU_Off; menuactive = MENU_Off;
if (CurrentScaleOverrider) delete CurrentScaleOverrider;
CurrentScaleOverrider = nullptr;
} }
//============================================================================= //=============================================================================

View file

@ -347,7 +347,7 @@ void M_PreviousMenu ();
void M_ParseMenuDefs(); void M_ParseMenuDefs();
void M_StartupEpisodeMenu(FGameStartup *gs); void M_StartupEpisodeMenu(FGameStartup *gs);
void M_StartupSkillMenu(FGameStartup *gs); void M_StartupSkillMenu(FGameStartup *gs);
void M_StartControlPanel (bool makeSound); void M_StartControlPanel (bool makeSound, bool scaleoverride = true);
void M_SetMenu(FName menu, int param = -1); void M_SetMenu(FName menu, int param = -1);
void M_StartMessage(const char *message, int messagemode, FName action = NAME_None); void M_StartMessage(const char *message, int messagemode, FName action = NAME_None);
DMenu *StartPickerMenu(DMenu *parent, const char *name, FColorCVar *cvar); DMenu *StartPickerMenu(DMenu *parent, const char *name, FColorCVar *cvar);

View file

@ -381,6 +381,7 @@ void P_StartConversation (AActor *npc, AActor *pc, bool facetalker, bool saveang
I_SetMusicVolume (dlg_musicvolume); I_SetMusicVolume (dlg_musicvolume);
S_Sound (npc, CHAN_VOICE|CHAN_NOPAUSE, CurNode->SpeakerVoice, 1, ATTN_NORM); S_Sound (npc, CHAN_VOICE|CHAN_NOPAUSE, CurNode->SpeakerVoice, 1, ATTN_NORM);
} }
M_StartControlPanel(false, true);
// Create the menu. This may be a user-defined class so check if it is good to use. // Create the menu. This may be a user-defined class so check if it is good to use.
FName cls = CurNode->MenuClassName; FName cls = CurNode->MenuClassName;
@ -405,7 +406,6 @@ void P_StartConversation (AActor *npc, AActor *pc, bool facetalker, bool saveang
} }
// And open the menu // And open the menu
M_StartControlPanel (false);
M_ActivateMenu((DMenu*)cmenu); M_ActivateMenu((DMenu*)cmenu);
menuactive = MENU_OnNoPause; menuactive = MENU_OnNoPause;
} }

View file

@ -82,6 +82,7 @@ class ConversationMenu : Menu
PlayerInfo mPlayer; PlayerInfo mPlayer;
int mSelection; int mSelection;
int ConversationPauseTic; int ConversationPauseTic;
int LineHeight;
int SpeechWidth; int SpeechWidth;
int ReplyWidth; int ReplyWidth;
@ -107,6 +108,7 @@ class ConversationMenu : Menu
ReplyWidth = 320-50-10; ReplyWidth = 320-50-10;
SpeechWidth = screen.GetWidth()/CleanXfac - 24*2; SpeechWidth = screen.GetWidth()/CleanXfac - 24*2;
LineHeight = SmallFont.GetHeight();
FormatSpeakerMessage(); FormatSpeakerMessage();
return FormatReplies(activereply); return FormatReplies(activereply);
@ -174,8 +176,8 @@ class ConversationMenu : Menu
mResponseLines.Push(goodbyestr); mResponseLines.Push(goodbyestr);
// Determine where the top of the reply list should be positioned. // Determine where the top of the reply list should be positioned.
mYpos = MIN (140, 192 - mResponseLines.Size() * OptionMenuSettings.mLinespacing); mYpos = MIN (140, 192 - mResponseLines.Size() * LineHeight);
i = 44 + mResponseLines.Size() * OptionMenuSettings.mLinespacing; i = 44 + mResponseLines.Size() * LineHeight;
if (mYpos - 100 < i - screen.GetHeight() / CleanYfac / 2) if (mYpos - 100 < i - screen.GetHeight() / CleanYfac / 2)
{ {
mYpos = i - screen.GetHeight() / CleanYfac / 2 + 100; mYpos = i - screen.GetHeight() / CleanYfac / 2 + 100;
@ -305,7 +307,7 @@ class ConversationMenu : Menu
override bool MouseEvent(int type, int x, int y) override bool MouseEvent(int type, int x, int y)
{ {
int sel = -1; int sel = -1;
int fh = OptionMenuSettings.mLinespacing; int fh = LineHeight;
// convert x/y from screen to virtual coordinates, according to CleanX/Yfac use in DrawTexture // convert x/y from screen to virtual coordinates, according to CleanX/Yfac use in DrawTexture
x = ((x - (screen.GetWidth() / 2)) / CleanXfac) + 160; x = ((x - (screen.GetWidth() / 2)) / CleanXfac) + 160;
@ -382,7 +384,7 @@ class ConversationMenu : Menu
virtual void DrawSpeakerText(bool dimbg) virtual void DrawSpeakerText(bool dimbg)
{ {
String speakerName; String speakerName;
int linesize = OptionMenuSettings.mLinespacing * CleanYfac; int linesize = LineHeight * CleanYfac;
int cnt = mDialogueLines.Count(); int cnt = mDialogueLines.Count();
// Who is talking to you? // Who is talking to you?
@ -434,10 +436,10 @@ class ConversationMenu : Menu
{ {
// Dim the screen behind the PC's choices. // Dim the screen behind the PC's choices.
screen.Dim(0, 0.45, (24 - 160) * CleanXfac + screen.GetWidth() / 2, (mYpos - 2 - 100) * CleanYfac + screen.GetHeight() / 2, screen.Dim(0, 0.45, (24 - 160) * CleanXfac + screen.GetWidth() / 2, (mYpos - 2 - 100) * CleanYfac + screen.GetHeight() / 2,
272 * CleanXfac, MIN(mResponseLines.Size() * OptionMenuSettings.mLinespacing + 4, 200 - mYpos) * CleanYfac); 272 * CleanXfac, MIN(mResponseLines.Size() * LineHeight + 4, 200 - mYpos) * CleanYfac);
int y = mYpos; int y = mYpos;
int fontheight = OptionMenuSettings.mLinespacing; int fontheight = LineHeight;
int response = 0; int response = 0;
for (int i = 0; i < mResponseLines.Size(); i++) for (int i = 0; i < mResponseLines.Size(); i++)