From d6b3cbe0c9aae8549670dc6f28dcdff55c10f260 Mon Sep 17 00:00:00 2001 From: "alexey.lysiuk" Date: Fri, 14 Oct 2016 13:39:19 +0300 Subject: [PATCH 1/9] Fixed serialization of MovePoly class objects See http://forum.zdoom.org/viewtopic.php?t=53787 Removed "speed" field which is serialized in the parent class --- src/po_man.cpp | 1 - 1 file changed, 1 deletion(-) diff --git a/src/po_man.cpp b/src/po_man.cpp index 2eed96596..c779a8049 100644 --- a/src/po_man.cpp +++ b/src/po_man.cpp @@ -265,7 +265,6 @@ void DMovePoly::Serialize(FSerializer &arc) { Super::Serialize (arc); arc("angle", m_Angle) - ("speed", m_Speed); ("speedv", m_Speedv); } From 657abb374b8682ea1b36ae89622d11ac697d08f8 Mon Sep 17 00:00:00 2001 From: Magnus Norddahl Date: Fri, 14 Oct 2016 11:24:03 +0200 Subject: [PATCH 2/9] Fix SkyViewpoint skyboxes not being rendered --- src/r_plane.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/r_plane.cpp b/src/r_plane.cpp index ff23492ab..07001bf1b 100644 --- a/src/r_plane.cpp +++ b/src/r_plane.cpp @@ -1314,7 +1314,7 @@ void R_DrawPortals () vissprite_p = firstvissprite; visplaneStack.Pop (pl); - if (pl->Alpha > 0) + if (pl->Alpha > 0 && pl->picnum != skyflatnum) { R_DrawSinglePlane (pl, pl->Alpha, pl->Additive, true); } From 36aff68501d4e21c9ea6d24474dafd7bf68b108b Mon Sep 17 00:00:00 2001 From: Magnus Norddahl Date: Fri, 14 Oct 2016 15:23:23 +0200 Subject: [PATCH 3/9] Fix divide by zero if yscale is too small a number --- src/r_things.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/r_things.cpp b/src/r_things.cpp index ab75c15b0..99ca68b60 100644 --- a/src/r_things.cpp +++ b/src/r_things.cpp @@ -408,7 +408,7 @@ void R_DrawVisSprite (vissprite_t *vis) ESPSResult mode; bool ispsprite = (!vis->sector && vis->gpos != FVector3(0, 0, 0)); - if (vis->xscale == 0 || vis->yscale == 0) + if (vis->xscale == 0 || fabs(vis->yscale) < (1.0f / 32000.0f)) { // scaled to 0; can't see return; } From 0370592422830fcf22796d86977df53d4b5d52b1 Mon Sep 17 00:00:00 2001 From: "alexey.lysiuk" Date: Fri, 14 Oct 2016 14:31:58 +0300 Subject: [PATCH 4/9] Fixed serialization of DSeqPolyNode class objects Polyobject pointer was not serialized at all --- src/s_sndseq.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/s_sndseq.cpp b/src/s_sndseq.cpp index 23837c28b..3b39965ff 100644 --- a/src/s_sndseq.cpp +++ b/src/s_sndseq.cpp @@ -442,7 +442,7 @@ IMPLEMENT_CLASS (DSeqPolyNode) void DSeqPolyNode::Serialize(FSerializer &arc) { Super::Serialize (arc); - //arc << m_Poly; + arc("poly", m_Poly); } IMPLEMENT_CLASS (DSeqSectorNode) From 0df6ba69516d239a3a5f255a72e1b0edb0673c72 Mon Sep 17 00:00:00 2001 From: FishyClockwork Date: Fri, 14 Oct 2016 09:13:31 +0200 Subject: [PATCH 5/9] First, take care of usdf.txt Updated about the new 'goodbye' property. --- specs/usdf.txt | 18 ++++++++++-------- 1 file changed, 10 insertions(+), 8 deletions(-) diff --git a/specs/usdf.txt b/specs/usdf.txt index 1367ccfbf..c3c286f20 100644 --- a/specs/usdf.txt +++ b/specs/usdf.txt @@ -87,14 +87,16 @@ conversation // Starts a dialog. page // Starts a new page. Pages are automatically numbered starting at 1. { - name = ; // Name that goes in the upper left hand corner - panel = ; // Name of lump to render as the background. - voice = ; // Narration sound lump. - dialog = ; // Dialog of the page. - drop = ; // mobj for the object to drop if the actor is - // killed. - link = ; // Page to jump to if all ifitem conditions are - // satisified. + name = ; // Name that goes in the upper left hand corner + panel = ; // Name of lump to render as the background. + voice = ; // Narration sound lump. + dialog = ; // Dialog of the page. + goodbye = ; // Custom goodbye message. If omitted then the + // generic goodbyes will be displayed instead. + drop = ; // mobj for the object to drop if the actor is + // killed. + link = ; // Page to jump to if all ifitem conditions are + // satisified. // jumps to the specified page if the player has the specified amount // or more of item in their inventory. This can be repeated as many From 1ab990f81f2021b4912635cda5321c89e7e0fd84 Mon Sep 17 00:00:00 2001 From: FishyClockwork Date: Fri, 14 Oct 2016 09:17:35 +0200 Subject: [PATCH 6/9] Again... --- specs/usdf.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/specs/usdf.txt b/specs/usdf.txt index c3c286f20..093c9e7d7 100644 --- a/specs/usdf.txt +++ b/specs/usdf.txt @@ -91,7 +91,7 @@ conversation // Starts a dialog. panel = ; // Name of lump to render as the background. voice = ; // Narration sound lump. dialog = ; // Dialog of the page. - goodbye = ; // Custom goodbye message. If omitted then the + goodbye = ; // Custom goodbye message. If omitted then the // generic goodbyes will be displayed instead. drop = ; // mobj for the object to drop if the actor is // killed. From ecffd0bea653e04a5a2deb648c70eee546371336 Mon Sep 17 00:00:00 2001 From: FishyClockwork Date: Fri, 14 Oct 2016 11:55:50 +0200 Subject: [PATCH 7/9] Done the code changes. This time only nulls I've added are nullptrs --- src/namedef.h | 1 + src/p_conversation.cpp | 25 +++++++++++++++++++++---- src/p_conversation.h | 1 + src/p_usdf.cpp | 6 +++++- 4 files changed, 28 insertions(+), 5 deletions(-) diff --git a/src/namedef.h b/src/namedef.h index 36953e385..eab87c503 100644 --- a/src/namedef.h +++ b/src/namedef.h @@ -584,6 +584,7 @@ xx(Dialog) xx(Ifitem) xx(Choice) xx(Link) +xx(Goodbye) // Special menus xx(Mainmenu) diff --git a/src/p_conversation.cpp b/src/p_conversation.cpp index a697223e7..31fa25030 100644 --- a/src/p_conversation.cpp +++ b/src/p_conversation.cpp @@ -556,6 +556,7 @@ FStrifeDialogueNode::~FStrifeDialogueNode () { if (SpeakerName != NULL) delete[] SpeakerName; if (Dialogue != NULL) delete[] Dialogue; + if (Goodbye != nullptr) delete[] Goodbye; FStrifeDialogueReply *tokill = Children; while (tokill != NULL) { @@ -743,10 +744,26 @@ public: ++i; V_FreeBrokenLines (ReplyLines); } - char goodbye[25]; - mysnprintf(goodbye, countof(goodbye), "TXT_RANDOMGOODBYE_%d", 1+(pr_randomspeech() % NUM_RANDOM_GOODBYES)); - const char *goodbyestr = GStrings[goodbye]; - if (goodbyestr == NULL) goodbyestr = "Bye."; + const char *goodbyestr = CurNode->Goodbye; + if (goodbyestr == nullptr) + { + char goodbye[25]; + mysnprintf(goodbye, countof(goodbye), "TXT_RANDOMGOODBYE_%d", 1 + (pr_randomspeech() % NUM_RANDOM_GOODBYES)); + goodbyestr = GStrings[goodbye]; + if (goodbyestr == nullptr) goodbyestr = "Bye."; + } + else if (strncmp(goodbyestr, "RANDOM_", 7) == 0) + { + FString byetext; + + byetext.Format("TXT_%s_%02d", goodbyestr, 1 + (pr_randomspeech() % NUM_RANDOM_LINES)); + goodbyestr = GStrings[byetext]; + if (goodbyestr == nullptr) goodbyestr = "Bye."; + } + else if (goodbyestr[0] == '$') + { + goodbyestr = GStrings(goodbyestr + 1); + } mResponses.Push(mResponseLines.Size()); mResponseLines.Push(FString(goodbyestr)); diff --git a/src/p_conversation.h b/src/p_conversation.h index d6ba65d78..5b068fb04 100644 --- a/src/p_conversation.h +++ b/src/p_conversation.h @@ -30,6 +30,7 @@ struct FStrifeDialogueNode FSoundID SpeakerVoice; FTextureID Backdrop; char *Dialogue; + char *Goodbye = nullptr; // must init to null for binary scripts to work as intended FStrifeDialogueReply *Children; }; diff --git a/src/p_usdf.cpp b/src/p_usdf.cpp index 13a02b964..dccec7c21 100644 --- a/src/p_usdf.cpp +++ b/src/p_usdf.cpp @@ -286,6 +286,7 @@ class USDFParser : public UDMFParserBase FString SpeakerName; FString Dialogue; + FString Goodbye; while (!sc.CheckToken('}')) { @@ -331,7 +332,9 @@ class USDFParser : public UDMFParserBase node->ItemCheckNode = CheckInt(key); break; - + case NAME_Goodbye: + Goodbye = CheckString(key); + break; } } else @@ -354,6 +357,7 @@ class USDFParser : public UDMFParserBase } node->SpeakerName = ncopystring(SpeakerName); node->Dialogue = ncopystring(Dialogue); + node->Goodbye = ncopystring(Goodbye); return true; } From 08504dcbe235415a4243e8c76f26ed54b0255a04 Mon Sep 17 00:00:00 2001 From: FishyClockwork Date: Fri, 14 Oct 2016 15:17:19 +0200 Subject: [PATCH 8/9] Added a small check just in case... --- src/p_conversation.cpp | 1 + 1 file changed, 1 insertion(+) diff --git a/src/p_conversation.cpp b/src/p_conversation.cpp index 31fa25030..1762ae98e 100644 --- a/src/p_conversation.cpp +++ b/src/p_conversation.cpp @@ -763,6 +763,7 @@ public: else if (goodbyestr[0] == '$') { goodbyestr = GStrings(goodbyestr + 1); + if (goodbyestr == nullptr) goodbyestr = "Bye."; } mResponses.Push(mResponseLines.Size()); mResponseLines.Push(FString(goodbyestr)); From 2e882a41a33f0a7d45d229a817e5a9db2ce4e725 Mon Sep 17 00:00:00 2001 From: Christoph Oelckers Date: Fri, 14 Oct 2016 23:13:08 +0200 Subject: [PATCH 9/9] - removed some redundancy. --- src/p_conversation.cpp | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/src/p_conversation.cpp b/src/p_conversation.cpp index 1762ae98e..f216d9d78 100644 --- a/src/p_conversation.cpp +++ b/src/p_conversation.cpp @@ -750,7 +750,6 @@ public: char goodbye[25]; mysnprintf(goodbye, countof(goodbye), "TXT_RANDOMGOODBYE_%d", 1 + (pr_randomspeech() % NUM_RANDOM_GOODBYES)); goodbyestr = GStrings[goodbye]; - if (goodbyestr == nullptr) goodbyestr = "Bye."; } else if (strncmp(goodbyestr, "RANDOM_", 7) == 0) { @@ -758,13 +757,12 @@ public: byetext.Format("TXT_%s_%02d", goodbyestr, 1 + (pr_randomspeech() % NUM_RANDOM_LINES)); goodbyestr = GStrings[byetext]; - if (goodbyestr == nullptr) goodbyestr = "Bye."; } else if (goodbyestr[0] == '$') { goodbyestr = GStrings(goodbyestr + 1); - if (goodbyestr == nullptr) goodbyestr = "Bye."; } + if (goodbyestr == nullptr) goodbyestr = "Bye."; mResponses.Push(mResponseLines.Size()); mResponseLines.Push(FString(goodbyestr));