From b48f4032d8930b26638903984f91660be62c0a87 Mon Sep 17 00:00:00 2001 From: Christoph Oelckers Date: Mon, 18 Mar 2019 14:27:42 +0100 Subject: [PATCH 1/8] - draw the FPS counter with the new console font. With the current scale settings the original one is simply too small. --- src/v_framebuffer.cpp | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/v_framebuffer.cpp b/src/v_framebuffer.cpp index c026133c0..ec53fc7e8 100644 --- a/src/v_framebuffer.cpp +++ b/src/v_framebuffer.cpp @@ -156,9 +156,9 @@ void DFrameBuffer::DrawRateStuff () int textScale = active_con_scale(); chars = mysnprintf (fpsbuff, countof(fpsbuff), "%2llu ms (%3llu fps)", (unsigned long long)howlong, (unsigned long long)LastCount); - rate_x = Width / textScale - ConFont->StringWidth(&fpsbuff[0]); - Clear (rate_x * textScale, 0, Width, ConFont->GetHeight() * textScale, GPalette.BlackIndex, 0); - DrawText (ConFont, CR_WHITE, rate_x, 0, (char *)&fpsbuff[0], + rate_x = Width / textScale - NewConsoleFont->StringWidth(&fpsbuff[0]); + Clear (rate_x * textScale, 0, Width, NewConsoleFont->GetHeight() * textScale, GPalette.BlackIndex, 0); + DrawText (NewConsoleFont, CR_WHITE, rate_x, 0, (char *)&fpsbuff[0], DTA_VirtualWidth, screen->GetWidth() / textScale, DTA_VirtualHeight, screen->GetHeight() / textScale, DTA_KeepRatio, true, TAG_DONE); From e07d4130950bf8c3674a5eb7e86678a1f1e550d2 Mon Sep 17 00:00:00 2001 From: Christoph Oelckers Date: Mon, 18 Mar 2019 23:46:13 +0100 Subject: [PATCH 2/8] - fixed: A pusher thinker must destroy itself if the point pusher/puller thing is gone. --- src/g_shared/a_pusher.cpp | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/src/g_shared/a_pusher.cpp b/src/g_shared/a_pusher.cpp index bd9a40e5f..92cb502f7 100644 --- a/src/g_shared/a_pusher.cpp +++ b/src/g_shared/a_pusher.cpp @@ -193,6 +193,11 @@ void DPusher::Tick () if (m_Type == p_push) { + if (m_Source == nullptr) + { + Destroy(); + return; + } // Seek out all pushable things within the force radius of this // point pusher. Crosses sectors, so use blockmap. From cda248df66c97b4d296ac1350cab50e0999cefba Mon Sep 17 00:00:00 2001 From: Christoph Oelckers Date: Tue, 19 Mar 2019 00:37:43 +0100 Subject: [PATCH 3/8] - localized some user-facing texts that were still string literals. --- src/c_cvars.cpp | 2 +- src/d_net.cpp | 8 +++ src/d_netinfo.cpp | 15 +++- src/g_game.cpp | 59 +++++++-------- src/m_cheat.cpp | 72 +++++++++++-------- src/m_misc.cpp | 3 +- .../zscript/actors/player/player_cheat.zs | 3 - 7 files changed, 95 insertions(+), 67 deletions(-) diff --git a/src/c_cvars.cpp b/src/c_cvars.cpp index bda309361..a62f2fa95 100644 --- a/src/c_cvars.cpp +++ b/src/c_cvars.cpp @@ -1855,7 +1855,7 @@ CCMD (toggle) val = var->GetGenericRep (CVAR_Bool); val.Bool = !val.Bool; var->SetGenericRep (val, CVAR_Bool); - Printf ("\"%s\" is \"%s\"\n", var->GetName(), + Printf ("\"%s\" = \"%s\"\n", var->GetName(), val.Bool ? "true" : "false"); } } diff --git a/src/d_net.cpp b/src/d_net.cpp index b1240a332..ec0a90deb 100644 --- a/src/d_net.cpp +++ b/src/d_net.cpp @@ -66,6 +66,7 @@ #include "i_time.h" #include "i_system.h" #include "vm.h" +#include "gstrings.h" EXTERN_CVAR (Int, disableautosave) EXTERN_CVAR (Int, autosavecount) @@ -2187,6 +2188,13 @@ void Net_DoCommand (int type, uint8_t **stream, int player) case DEM_GIVECHEAT: s = ReadString (stream); cht_Give (&players[player], s, ReadLong (stream)); + if (player != consoleplayer) + { + FString message = GStrings("TXT_X_CHEATS"); + message.Substitute("%s", players[player].userinfo.GetName()); + Printf("%s: give %s\n", message.GetChars(), s); + } + break; case DEM_TAKECHEAT: diff --git a/src/d_netinfo.cpp b/src/d_netinfo.cpp index 9c938f43b..6c449f852 100644 --- a/src/d_netinfo.cpp +++ b/src/d_netinfo.cpp @@ -49,6 +49,7 @@ #include "cmdlib.h" #include "serializer.h" #include "vm.h" +#include "gstrings.h" static FRandom pr_pickteam ("PickRandomTeam"); @@ -314,7 +315,7 @@ static void UpdateTeam (int pnum, int team, bool update) if ((dmflags2 & DF2_NO_TEAM_SWITCH) && (alwaysapplydmflags || deathmatch) && TeamLibrary.IsValidTeam (info->GetTeam())) { - Printf ("Team changing has been disabled!\n"); + Printf ("%s\n", GStrings("TXT_NO_TEAM_CHANGE")); return; } @@ -329,10 +330,18 @@ static void UpdateTeam (int pnum, int team, bool update) if (update && oldteam != team) { + FString message; if (TeamLibrary.IsValidTeam (team)) - Printf ("%s joined the %s team\n", info->GetName(), Teams[team].GetName ()); + { + message = GStrings("TXT_JOINED_TEAM"); + message.Substitute("%t", Teams[team].GetName()); + } else - Printf ("%s is now a loner\n", info->GetName()); + { + message = GStrings("TXT_LONER"); + } + message.Substitute("%s", info->GetName()); + Printf("%s\n", message.GetChars()); } // Let the player take on the team's color R_BuildPlayerTranslation (pnum); diff --git a/src/g_game.cpp b/src/g_game.cpp index cfdfc2a45..0f783ad07 100644 --- a/src/g_game.cpp +++ b/src/g_game.cpp @@ -1673,16 +1673,9 @@ void G_DoPlayerPop(int playernum) { playeringame[playernum] = false; - if (deathmatch) - { - Printf("%s left the game with %d frags\n", - players[playernum].userinfo.GetName(), - players[playernum].fragcount); - } - else - { - Printf("%s left the game\n", players[playernum].userinfo.GetName()); - } + FString message = GStrings(deathmatch? "TXT_LEFTWITHFRAGS" : "TXT_LEFTTHEGAME"); + message.Substitute("%s", players[playernum].userinfo.GetName()); + message.Substitute("%d", FStringf("%d", players[playernum].fragcount)); // [RH] Revert each player to their own view if spying through the player who left for (int ii = 0; ii < MAXPLAYERS; ++ii) @@ -1754,7 +1747,7 @@ static bool CheckSingleWad (const char *name, bool &printRequires, bool printwar { if (!printRequires) { - Printf ("This savegame needs these wads:\n%s", name); + Printf ("%s:\n%s", GStrings("TXT_SAVEGAMENEEDS"), name); } else { @@ -1790,6 +1783,12 @@ bool G_CheckSaveGameWads (FSerializer &arc, bool printwarn) return true; } +static void LoadGameError(const char *label, const char *append = "") +{ + FString message = GStrings(label); + message.Substitute("%s", savename); + Printf ("%s %s\n", message.GetChars(), append); +} void G_DoLoadGame () { @@ -1805,13 +1804,13 @@ void G_DoLoadGame () std::unique_ptr resfile(FResourceFile::OpenResourceFile(savename.GetChars(), true, true)); if (resfile == nullptr) { - Printf ("Could not read savegame '%s'\n", savename.GetChars()); + LoadGameError("TXT_COULDNOTREAD"); return; } FResourceLump *info = resfile->FindLump("info.json"); if (info == nullptr) { - Printf("'%s' is not a valid savegame: Missing 'info.json'.\n", savename.GetChars()); + LoadGameError("TXT_NOINFOJSON"); return; } @@ -1821,7 +1820,7 @@ void G_DoLoadGame () FSerializer arc(nullptr); if (!arc.OpenReader((const char *)data, info->LumpSize)) { - Printf("Failed to access savegame info\n"); + LoadGameError("TXT_FAILEDTOREADSG"); return; } @@ -1839,27 +1838,30 @@ void G_DoLoadGame () // have this information. if (engine.IsEmpty()) { - Printf("Savegame is from an incompatible version\n"); + LoadGameError("TXT_INCOMPATIBLESG"); } else { - Printf("Savegame is from another ZDoom-based engine: %s\n", engine.GetChars()); + LoadGameError("TXT_IOTHERENGINESG", engine.GetChars()); } return; } if (SaveVersion < MINSAVEVER || SaveVersion > SAVEVER) { - Printf("Savegame is from an incompatible version"); + FString message; if (SaveVersion < MINSAVEVER) { - Printf(": %d (%d is the oldest supported)", SaveVersion, MINSAVEVER); + message = GStrings("TXT_TOOOLDSG"); + message.Substitute("%e", FStringf("%d", MINSAVEVER)); } else { - Printf(": %d (%d is the highest supported)", SaveVersion, SAVEVER); + message = GStrings("TXT_TOONEWSG"); + message.Substitute("%e", FStringf("%d", SAVEVER)); } - Printf("\n"); + message.Substitute("%d", FStringf("%d", SaveVersion)); + LoadGameError(message); return; } @@ -1870,7 +1872,7 @@ void G_DoLoadGame () if (map.IsEmpty()) { - Printf("Savegame is missing the current map\n"); + LoadGameError("TXT_NOMAPSG"); return; } @@ -1886,14 +1888,14 @@ void G_DoLoadGame () info = resfile->FindLump("globals.json"); if (info == nullptr) { - Printf("'%s' is not a valid savegame: Missing 'globals.json'.\n", savename.GetChars()); + LoadGameError("TXT_NOGLOBALSJSON"); return; } data = info->CacheLump(); if (!arc.OpenReader((const char *)data, info->LumpSize)) { - Printf("Failed to access savegame info\n"); + LoadGameError("TXT_SGINFOERR"); return; } @@ -1959,20 +1961,19 @@ void G_SaveGame (const char *filename, const char *description) { if (sendsave || gameaction == ga_savegame) { - Printf ("A game save is still pending.\n"); - return; + Printf ("%s\n", GStrings("TXT_SAVEPENDING")); } else if (!usergame) { - Printf ("not in a saveable game\n"); + Printf ("%s\n", GStrings("TXT_NOTSAVEABLE")); } else if (gamestate != GS_LEVEL) { - Printf ("not in a level\n"); + Printf ("%s\n", GStrings("TXT_NOTINLEVEL")); } else if (players[consoleplayer].health <= 0 && !multiplayer) { - Printf ("player is dead in a single-player game\n"); + Printf ("%s\n", GStrings("TXT_SPPLAYERDEAD")); } else { @@ -2291,7 +2292,7 @@ void G_DoSaveGame (bool okForQuicksave, FString filename, const char *descriptio if (longsavemessages) Printf ("%s (%s)\n", GStrings("GGSAVED"), filename.GetChars()); else Printf ("%s\n", GStrings("GGSAVED")); } - else Printf(PRINT_HIGH, "Save failed\n"); + else Printf(PRINT_HIGH, "%s\n", GStrings("TXT_SAVEFAILED")); BackupSaveName = filename; diff --git a/src/m_cheat.cpp b/src/m_cheat.cpp index 6d47dd2fc..c8256dda4 100644 --- a/src/m_cheat.cpp +++ b/src/m_cheat.cpp @@ -64,7 +64,7 @@ void cht_DoMDK(player_t *player, const char *mod) { if (player->mo == NULL) { - Printf("What do you want to kill outside of a game?\n"); + Printf("%s\n", GStrings("TXT_WHAT_KILL")); } else if (!deathmatch) { @@ -94,7 +94,6 @@ void cht_DoCheat (player_t *player, int cheat) AActor *item; FString smsg; const char *msg = ""; - char msgbuild[32]; int i; // No cheating when not having a pawn attached. @@ -204,25 +203,25 @@ void cht_DoCheat (player_t *player, int cheat) case CHT_NOTARGET: player->cheats ^= CF_NOTARGET; if (player->cheats & CF_NOTARGET) - msg = "notarget ON"; + msg = GStrings("TXT_NOTARGET_ON"); else - msg = "notarget OFF"; + msg = GStrings("TXT_NOTARGET_OFF"); break; case CHT_ANUBIS: player->cheats ^= CF_FRIGHTENING; if (player->cheats & CF_FRIGHTENING) - msg = "\"Quake with fear!\""; + msg = GStrings("TXT_ANUBIS_ON"); else - msg = "No more ogre armor"; + msg = GStrings("TXT_ANUBIS_OFF"); break; case CHT_CHASECAM: player->cheats ^= CF_CHASECAM; if (player->cheats & CF_CHASECAM) - msg = "chasecam ON"; + msg = GStrings("TXT_CHASECAM_ON"); else - msg = "chasecam OFF"; + msg = GStrings("TXT_CHASECAM_OFF"); R_ResetViewInterpolation (); break; @@ -326,10 +325,18 @@ void cht_DoCheat (player_t *player, int cheat) { int killcount = primaryLevel->Massacre (cheat == CHT_MASSACRE2); // killough 3/22/98: make more intelligent about plural - // Ty 03/27/98 - string(s) *not* externalized - mysnprintf (msgbuild, countof(msgbuild), "%d %s%s Killed", killcount, - cheat==CHT_MASSACRE2 ? "Baddie" : "Monster", killcount==1 ? "" : "s"); - msg = msgbuild; + if (killcount == 1) + { + msg = GStrings(cheat == CHT_MASSACRE? "TXT_MONSTER_KILLED" : "TXT_BADDIE_KILLED"); + } + else + { + // Note: Do not use the language string directly as a format template! + smsg = GStrings(cheat == CHT_MASSACRE? "TXT_MONSTERS_KILLED" : "TXT_BADDIES_KILLED"); + FStringf countstr("%d", killcount); + smsg.Substitute("%d", countstr); + msg = smsg.GetChars(); + } } break; @@ -352,64 +359,64 @@ void cht_DoCheat (player_t *player, int cheat) { if (player->mo->IsKindOf("PlayerChunk")) { - Printf("Unable to resurrect. Player is no longer connected to its body.\n"); + Printf("%s\n", GStrings("TXT_NO_RESURRECT")); + return; } else { player->Resurrect(); - } } break; case CHT_GIMMIEA: cht_Give (player, "ArtiInvulnerability"); - msg = "Valador's Ring of Invunerability"; + msg = GStrings("TAG_ARTIINVULNERABILITY"); break; case CHT_GIMMIEB: cht_Give (player, "ArtiInvisibility"); - msg = "Shadowsphere"; + msg = GStrings("TAG_ARTIINVISIBILITY"); break; case CHT_GIMMIEC: cht_Give (player, "ArtiHealth"); - msg = "Quartz Flask"; + msg = GStrings("TAG_ARTIHEALTH"); break; case CHT_GIMMIED: cht_Give (player, "ArtiSuperHealth"); - msg = "Mystic Urn"; + msg = GStrings("TAG_ARTISUPERHEALTH"); break; case CHT_GIMMIEE: cht_Give (player, "ArtiTomeOfPower"); - msg = "Tyketto's Tome of Power"; + msg = GStrings("TAG_ARTITOMEOFPOWER"); break; case CHT_GIMMIEF: cht_Give (player, "ArtiTorch"); - msg = "Torch"; + msg = GStrings("TAG_ARTITORCH"); break; case CHT_GIMMIEG: cht_Give (player, "ArtiTimeBomb"); - msg = "Delmintalintar's Time Bomb of the Ancients"; + msg = GStrings("TAG_ARTIFIREBOMB"); break; case CHT_GIMMIEH: cht_Give (player, "ArtiEgg"); - msg = "Torpol's Morph Ovum"; + msg = GStrings("TAG_ARTIEGG"); break; case CHT_GIMMIEI: cht_Give (player, "ArtiFly"); - msg = "Inhilicon's Wings of Wrath"; + msg = GStrings("TAG_ARTIFLY"); break; case CHT_GIMMIEJ: cht_Give (player, "ArtiTeleport"); - msg = "Darchala's Chaos Device"; + msg = GStrings("TAG_ARTITELEPORT"); break; case CHT_GIMMIEZ: @@ -417,7 +424,7 @@ void cht_DoCheat (player_t *player, int cheat) { cht_Give (player, "artifacts"); } - msg = "All artifacts!"; + msg = GStrings("TAG_ALL_ARTIFACTS"); break; case CHT_TAKEWEAPS: @@ -444,9 +451,10 @@ void cht_DoCheat (player_t *player, int cheat) break; case CHT_MDK: - if (player->mo == NULL) + if (player->mo == nullptr) { - Printf ("What do you want to kill outside of a game?\n"); + Printf ("%s\n", GStrings("TXT_WHAT_KILL")); + return; } else if (!deathmatch) { @@ -512,7 +520,7 @@ void cht_DoCheat (player_t *player, int cheat) case CHT_CLEARFROZENPROPS: player->cheats &= ~(CF_FROZEN|CF_TOTALLYFROZEN); - msg = "Frozen player properties turned off"; + msg = GStrings("TXT_NOT_FROZEN"); break; case CHT_FREEZE: @@ -528,13 +536,17 @@ void cht_DoCheat (player_t *player, int cheat) break; } - if (!*msg) // [SO] Don't print blank lines! + if (!msg || !*msg) // [SO] Don't print blank lines! return; if (player == &players[consoleplayer]) Printf ("%s\n", msg); else if (cheat != CHT_CHASECAM) - Printf ("%s cheats: %s\n", player->userinfo.GetName(), msg); + { + FString message = GStrings("TXT_X_CHEATS"); + message.Substitute("%s", player->userinfo.GetName()); + Printf("%s: %s\n", message.GetChars(), msg); + } } FString cht_Morph(player_t *player, PClassActor *morphclass, bool quickundo) diff --git a/src/m_misc.cpp b/src/m_misc.cpp index 4b3438bc4..42938fb80 100644 --- a/src/m_misc.cpp +++ b/src/m_misc.cpp @@ -65,6 +65,7 @@ #include "gi.h" #include "gameconfigfile.h" +#include "gstrings.h" FGameConfigFile *GameConfig; @@ -511,7 +512,7 @@ void WritePNGfile (FileWriter *file, const uint8_t *buffer, const PalEntry *pale !M_AppendPNGText (file, "Software", software) || !M_FinishPNG (file)) { - Printf ("Could not create screenshot.\n"); + Printf ("%s\n", GStrings("TXT_SCREENSHOTERR")); } } diff --git a/wadsrc/static/zscript/actors/player/player_cheat.zs b/wadsrc/static/zscript/actors/player/player_cheat.zs index 506a60480..d1e8d2694 100644 --- a/wadsrc/static/zscript/actors/player/player_cheat.zs +++ b/wadsrc/static/zscript/actors/player/player_cheat.zs @@ -49,9 +49,6 @@ extend class PlayerPawn Class type; let player = self.player; - if (PlayerNumber() != consoleplayer) - A_Log(String.Format ("%s is a cheater: give %s\n", player.GetUserName(), name)); - if (player.mo == NULL || player.health <= 0) { return; From be7d6241c297f5e2bca3e6a83cd21d7b62ad539e Mon Sep 17 00:00:00 2001 From: Christoph Oelckers Date: Tue, 19 Mar 2019 01:23:54 +0100 Subject: [PATCH 4/8] - localize 'By' --- src/d_main.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/d_main.cpp b/src/d_main.cpp index 81ce4b8a3..dc79c4858 100644 --- a/src/d_main.cpp +++ b/src/d_main.cpp @@ -863,7 +863,7 @@ void D_Display () { FTexture *tex; int x; - FString pstring = "By "; + FString pstring = GStrings("TXT_BY"); tex = TexMan.GetTextureByName(gameinfo.PauseSign, true); x = (SCREENWIDTH - tex->GetDisplayWidth() * CleanXfac)/2 + @@ -871,7 +871,7 @@ void D_Display () screen->DrawTexture (tex, x, 4, DTA_CleanNoMove, true, TAG_DONE); if (paused && multiplayer) { - pstring += players[paused - 1].userinfo.GetName(); + pstring << ' ' << players[paused - 1].userinfo.GetName(); screen->DrawText(SmallFont, CR_RED, (screen->GetWidth() - SmallFont->StringWidth(pstring)*CleanXfac) / 2, (tex->GetDisplayHeight() * CleanYfac) + 4, pstring, DTA_CleanNoMove, true, TAG_DONE); From a1acc4adc49d7ff5ee03bf383d81c53ce8c54762 Mon Sep 17 00:00:00 2001 From: Christoph Oelckers Date: Tue, 19 Mar 2019 17:46:59 +0100 Subject: [PATCH 5/8] - 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. --- src/menu/menu.cpp | 6 +++++- src/menu/menu.h | 2 +- src/p_conversation.cpp | 2 +- wadsrc/static/zscript/ui/menu/conversationmenu.zs | 14 ++++++++------ 4 files changed, 15 insertions(+), 9 deletions(-) diff --git a/src/menu/menu.cpp b/src/menu/menu.cpp index 008f13b55..fa36a9b55 100644 --- a/src/menu/menu.cpp +++ b/src/menu/menu.cpp @@ -56,6 +56,7 @@ #include "scripting/types.h" int DMenu::InMenu; +static ScaleOverrider *CurrentScaleOverrider; // // 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 if (CurrentMenu != nullptr) @@ -372,6 +373,7 @@ void M_StartControlPanel (bool makeSound) } BackbuttonTime = 0; BackbuttonAlpha = 0; + if (scaleoverride && !CurrentScaleOverrider) CurrentScaleOverrider = new ScaleOverrider; } //============================================================================= @@ -912,6 +914,8 @@ void M_ClearMenus() CurrentMenu = parent; } menuactive = MENU_Off; + if (CurrentScaleOverrider) delete CurrentScaleOverrider; + CurrentScaleOverrider = nullptr; } //============================================================================= diff --git a/src/menu/menu.h b/src/menu/menu.h index 21b10d785..cabf526ac 100644 --- a/src/menu/menu.h +++ b/src/menu/menu.h @@ -347,7 +347,7 @@ void M_PreviousMenu (); void M_ParseMenuDefs(); void M_StartupEpisodeMenu(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_StartMessage(const char *message, int messagemode, FName action = NAME_None); DMenu *StartPickerMenu(DMenu *parent, const char *name, FColorCVar *cvar); diff --git a/src/p_conversation.cpp b/src/p_conversation.cpp index 6f3bec89b..9dad979eb 100644 --- a/src/p_conversation.cpp +++ b/src/p_conversation.cpp @@ -381,6 +381,7 @@ void P_StartConversation (AActor *npc, AActor *pc, bool facetalker, bool saveang I_SetMusicVolume (dlg_musicvolume); 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. FName cls = CurNode->MenuClassName; @@ -405,7 +406,6 @@ void P_StartConversation (AActor *npc, AActor *pc, bool facetalker, bool saveang } // And open the menu - M_StartControlPanel (false); M_ActivateMenu((DMenu*)cmenu); menuactive = MENU_OnNoPause; } diff --git a/wadsrc/static/zscript/ui/menu/conversationmenu.zs b/wadsrc/static/zscript/ui/menu/conversationmenu.zs index 1c5043512..76b280578 100644 --- a/wadsrc/static/zscript/ui/menu/conversationmenu.zs +++ b/wadsrc/static/zscript/ui/menu/conversationmenu.zs @@ -82,6 +82,7 @@ class ConversationMenu : Menu PlayerInfo mPlayer; int mSelection; int ConversationPauseTic; + int LineHeight; int SpeechWidth; int ReplyWidth; @@ -107,6 +108,7 @@ class ConversationMenu : Menu ReplyWidth = 320-50-10; SpeechWidth = screen.GetWidth()/CleanXfac - 24*2; + LineHeight = SmallFont.GetHeight(); FormatSpeakerMessage(); return FormatReplies(activereply); @@ -174,8 +176,8 @@ class ConversationMenu : Menu mResponseLines.Push(goodbyestr); // Determine where the top of the reply list should be positioned. - mYpos = MIN (140, 192 - mResponseLines.Size() * OptionMenuSettings.mLinespacing); - i = 44 + mResponseLines.Size() * OptionMenuSettings.mLinespacing; + mYpos = MIN (140, 192 - mResponseLines.Size() * LineHeight); + i = 44 + mResponseLines.Size() * LineHeight; if (mYpos - 100 < i - screen.GetHeight() / CleanYfac / 2) { mYpos = i - screen.GetHeight() / CleanYfac / 2 + 100; @@ -305,7 +307,7 @@ class ConversationMenu : Menu override bool MouseEvent(int type, int x, int y) { 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 x = ((x - (screen.GetWidth() / 2)) / CleanXfac) + 160; @@ -382,7 +384,7 @@ class ConversationMenu : Menu virtual void DrawSpeakerText(bool dimbg) { String speakerName; - int linesize = OptionMenuSettings.mLinespacing * CleanYfac; + int linesize = LineHeight * CleanYfac; int cnt = mDialogueLines.Count(); // Who is talking to you? @@ -434,10 +436,10 @@ class ConversationMenu : Menu { // 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, - 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 fontheight = OptionMenuSettings.mLinespacing; + int fontheight = LineHeight; int response = 0; for (int i = 0; i < mResponseLines.Size(); i++) From 561ce41723549cc1634be5af3ff5ee51cfb20457 Mon Sep 17 00:00:00 2001 From: Christoph Oelckers Date: Tue, 19 Mar 2019 18:46:20 +0100 Subject: [PATCH 6/8] - fixed lifetime of ScaleOverrider for Strife dialogues. --- src/menu/menu.cpp | 1 + 1 file changed, 1 insertion(+) diff --git a/src/menu/menu.cpp b/src/menu/menu.cpp index fa36a9b55..e6cf53a89 100644 --- a/src/menu/menu.cpp +++ b/src/menu/menu.cpp @@ -374,6 +374,7 @@ void M_StartControlPanel (bool makeSound, bool scaleoverride) BackbuttonTime = 0; BackbuttonAlpha = 0; if (scaleoverride && !CurrentScaleOverrider) CurrentScaleOverrider = new ScaleOverrider; + else if (!scaleoverride && CurrentScaleOverrider) delete CurrentScaleOverrider; } //============================================================================= From 0abd9d4aec5f26cda73574130cf949cb6a5ef3fb Mon Sep 17 00:00:00 2001 From: Christoph Oelckers Date: Tue, 19 Mar 2019 18:50:38 +0100 Subject: [PATCH 7/8] - fixed slider scaling. --- wadsrc/static/zscript/ui/menu/menu.zs | 2 +- wadsrc/static/zscript/ui/menu/optionmenuitems.zs | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/wadsrc/static/zscript/ui/menu/menu.zs b/wadsrc/static/zscript/ui/menu/menu.zs index 6feee5467..6a6c96a80 100644 --- a/wadsrc/static/zscript/ui/menu/menu.zs +++ b/wadsrc/static/zscript/ui/menu/menu.zs @@ -285,7 +285,7 @@ class Menu : Object native ui version("2.4") static void DrawConText (int color, int x, int y, String str) { - screen.DrawText (ConFont, color, x, y, str, DTA_CellX, 8 * CleanXfac, DTA_CellY, 8 * CleanYfac); + screen.DrawText (ConFont, color, x, y, str, DTA_CellX, 16 * CleanXfac_1, DTA_CellY, 16 * CleanYfac_1); } static int OptionColor(int color) diff --git a/wadsrc/static/zscript/ui/menu/optionmenuitems.zs b/wadsrc/static/zscript/ui/menu/optionmenuitems.zs index 19fb0429d..f9aaec029 100644 --- a/wadsrc/static/zscript/ui/menu/optionmenuitems.zs +++ b/wadsrc/static/zscript/ui/menu/optionmenuitems.zs @@ -744,13 +744,13 @@ class OptionMenuSliderBase : OptionMenuItem if (!mSliderShort) { Menu.DrawConText(Font.CR_WHITE, x, cy, "\x10\x11\x11\x11\x11\x11\x11\x11\x11\x11\x11\x12"); - Menu.DrawConText(Font.FindFontColor(gameinfo.mSliderColor), x + int((5 + ((ccur * 78) / range)) * CleanXfac_1), cy, "\x13"); + Menu.DrawConText(Font.FindFontColor(gameinfo.mSliderColor), x + int((5 + ((ccur * 78) / range)) * 2 * CleanXfac_1), cy, "\x13"); } else { // On 320x200 we need a shorter slider Menu.DrawConText(Font.CR_WHITE, x, cy, "\x10\x11\x11\x11\x11\x11\x12"); - Menu.DrawConText(Font.FindFontColor(gameinfo.mSliderColor), x + int((5 + ((ccur * 38) / range)) * CleanXfac_1), cy, "\x13"); + Menu.DrawConText(Font.FindFontColor(gameinfo.mSliderColor), x + int((5 + ((ccur * 38) / range)) * 2 * CleanXfac_1), cy, "\x13"); right -= 5*8*CleanXfac; } From 6e0e221804189a7e6ac63f7edb9c89498ac3a268 Mon Sep 17 00:00:00 2001 From: Christoph Oelckers Date: Tue, 19 Mar 2019 19:54:46 +0100 Subject: [PATCH 8/8] - give Hexen's PoisonCloud the OLDRADIUSDMG flag. This actor has such oddball semantics that it's better not subjected to the revised radius damage code. --- wadsrc/static/zscript/actors/hexen/flechette.zs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/wadsrc/static/zscript/actors/hexen/flechette.zs b/wadsrc/static/zscript/actors/hexen/flechette.zs index 2d01b173c..f21a334ce 100644 --- a/wadsrc/static/zscript/actors/hexen/flechette.zs +++ b/wadsrc/static/zscript/actors/hexen/flechette.zs @@ -436,7 +436,7 @@ class PoisonCloud : Actor Mass 0x7fffffff; +NOBLOCKMAP +NOGRAVITY +DROPOFF +NODAMAGETHRUST - +DONTSPLASH +FOILINVUL +CANBLAST +BLOODLESSIMPACT +BLOCKEDBYSOLIDACTORS +FORCEZERORADIUSDMG + +DONTSPLASH +FOILINVUL +CANBLAST +BLOODLESSIMPACT +BLOCKEDBYSOLIDACTORS +FORCEZERORADIUSDMG +OLDRADIUSDMG RenderStyle "Translucent"; Alpha 0.6; DeathSound "PoisonShroomDeath";