From d6b3cbe0c9aae8549670dc6f28dcdff55c10f260 Mon Sep 17 00:00:00 2001 From: "alexey.lysiuk" Date: Fri, 14 Oct 2016 13:39:19 +0300 Subject: [PATCH 01/11] 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 2eed965969..c779a8049d 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 02/11] 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 ff23492ab9..07001bf1bb 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 03/11] 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 ab75c15b02..99ca68b601 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 04/11] 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 23837c28b8..3b39965ff6 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 05/11] 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 1367ccfbf9..c3c286f20b 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 06/11] Again... --- specs/usdf.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/specs/usdf.txt b/specs/usdf.txt index c3c286f20b..093c9e7d74 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 07/11] 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 36953e385f..eab87c503b 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 a697223e75..31fa25030d 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 d6ba65d780..5b068fb04b 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 13a02b9646..dccec7c210 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 08/11] 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 31fa25030d..1762ae98e5 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 09/11] - 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 1762ae98e5..f216d9d78a 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)); From f23e5d26775c7e5af8f60f9dc66dee2a469c0f46 Mon Sep 17 00:00:00 2001 From: Marisa Heit Date: Fri, 14 Oct 2016 22:02:55 -0500 Subject: [PATCH 10/11] Fixed: XLAT would not parse - Disable the changes from commit 96afce241d6bc08cfdb0018ea6e5f0c23e8ba5c8 because it appears to not recognize default rules that reduce as reducing. - When tracing a parser, flush after every line output in case an assert is hit so you can actually see what it did up to that point. --- tools/lemon/lemon.c | 8 ++++++++ tools/lemon/lempar.c | 17 +++++++++++++++++ 2 files changed, 25 insertions(+) diff --git a/tools/lemon/lemon.c b/tools/lemon/lemon.c index f2da9c6f82..bdc004a17d 100644 --- a/tools/lemon/lemon.c +++ b/tools/lemon/lemon.c @@ -199,7 +199,9 @@ struct rule { int index; /* An index number for this rule */ int iRule; /* Rule number as used in the generated tables */ Boolean canReduce; /* True if this rule is ever reduced */ +#if 0 Boolean doesReduce; /* Reduce actions occur after optimization */ +#endif struct rule *nextlhs; /* Next rule with the same LHS */ struct rule *next; /* Next rule in the global list */ }; @@ -4156,6 +4158,7 @@ void ReportTable( } free(ax); +#if 0 /* Mark rules that are actually used for reduce actions after all ** optimizations have been applied */ @@ -4168,6 +4171,7 @@ void ReportTable( } } } +#endif /* Finish rendering the constants now that the action table has ** been computed */ @@ -4462,12 +4466,16 @@ void ReportTable( assert( rp->noCode ); fprintf(out," /* (%d) ", rp->iRule); writeRuleText(out, rp); +#if 0 if( rp->doesReduce ){ +#endif fprintf(out, " */ yytestcase(yyruleno==%d);\n", rp->iRule); lineno++; +#if 0 }else{ fprintf(out, " (OPTIMIZED OUT) */ assert(yyruleno!=%d);\n", rp->iRule); lineno++; } +#endif } fprintf(out," break;\n"); lineno++; tplt_xfer(lemp->name,in,out,&lineno); diff --git a/tools/lemon/lempar.c b/tools/lemon/lempar.c index 0e360bab98..93b6120174 100644 --- a/tools/lemon/lempar.c +++ b/tools/lemon/lempar.c @@ -308,6 +308,7 @@ static int yyGrowStack(yyParser *p){ if( yyTraceFILE ){ fprintf(yyTraceFILE,"%sStack grows from %d to %d entries.\n", yyTracePrompt, p->yystksz, newSize); + fflush(yyTraceFILE); } #endif p->yystksz = newSize; @@ -410,6 +411,7 @@ static void yy_pop_parser_stack(yyParser *pParser){ fprintf(yyTraceFILE,"%sPopping %s\n", yyTracePrompt, yyTokenName[yytos->major]); + fflush(yyTraceFILE); } #endif yy_destructor(pParser, yytos->major, &yytos->minor); @@ -474,6 +476,7 @@ static unsigned int yy_find_shift_action( if( yyTraceFILE ){ fprintf(yyTraceFILE, "%sFALLBACK %s => %s\n", yyTracePrompt, yyTokenName[iLookAhead], yyTokenName[iFallback]); + fflush(yyTraceFILE); } #endif assert( yyFallback[iFallback]==0 ); /* Fallback loop must terminate */ @@ -498,6 +501,7 @@ static unsigned int yy_find_shift_action( fprintf(yyTraceFILE, "%sWILDCARD %s => %s\n", yyTracePrompt, yyTokenName[iLookAhead], yyTokenName[YYWILDCARD]); + fflush(yyTraceFILE); } #endif /* NDEBUG */ return yy_action[j]; @@ -551,6 +555,7 @@ static void yyStackOverflow(yyParser *yypParser){ #ifndef NDEBUG if( yyTraceFILE ){ fprintf(yyTraceFILE,"%sStack Overflow!\n",yyTracePrompt); + fflush(yyTraceFILE); } #endif while( yypParser->yytos>yypParser->yystack ) yy_pop_parser_stack(yypParser); @@ -576,6 +581,7 @@ static void yyTraceShift(yyParser *yypParser, int yyNewState){ fprintf(yyTraceFILE,"%sShift '%s'\n", yyTracePrompt,yyTokenName[yypParser->yytos->major]); } + fflush(yyTraceFILE); } } #else @@ -653,6 +659,7 @@ static void yy_reduce( yysize = yyRuleInfo[yyruleno].nrhs; fprintf(yyTraceFILE, "%sReduce [%s], go to state %d.\n", yyTracePrompt, yyRuleName[yyruleno], yymsp[-yysize].stateno); + fflush(yyTraceFILE); } #endif /* NDEBUG */ @@ -726,6 +733,7 @@ static void yy_parse_failed( #ifndef NDEBUG if( yyTraceFILE ){ fprintf(yyTraceFILE,"%sFail!\n",yyTracePrompt); + fflush(yyTraceFILE); } #endif while( yypParser->yytos>yypParser->yystack ) yy_pop_parser_stack(yypParser); @@ -764,12 +772,17 @@ static void yy_accept( #ifndef NDEBUG if( yyTraceFILE ){ fprintf(yyTraceFILE,"%sAccept!\n",yyTracePrompt); + fflush(yyTraceFILE); } #endif #ifndef YYNOERRORRECOVERY yypParser->yyerrcnt = -1; #endif +#if 0 assert( yypParser->yytos==yypParser->yystack ); +#else + while (yypParser->yytos>yypParser->yystack) yy_pop_parser_stack(yypParser); +#endif /* Here code is inserted which will be executed whenever the ** parser accepts */ /*********** Begin %parse_accept code *****************************************/ @@ -823,6 +836,7 @@ void Parse( #ifndef NDEBUG if( yyTraceFILE ){ fprintf(yyTraceFILE,"%sInput '%s'\n",yyTracePrompt,yyTokenName[yymajor]); + fflush(yyTraceFILE); } #endif @@ -845,6 +859,7 @@ void Parse( #ifndef NDEBUG if( yyTraceFILE ){ fprintf(yyTraceFILE,"%sSyntax Error!\n",yyTracePrompt); + fflush(yyTraceFILE); } #endif #ifdef YYERRORSYMBOL @@ -876,6 +891,7 @@ void Parse( if( yyTraceFILE ){ fprintf(yyTraceFILE,"%sDiscard input token %s\n", yyTracePrompt,yyTokenName[yymajor]); + fflush(yyTraceFILE); } #endif yy_destructor(yypParser, (YYCODETYPE)yymajor, &yyminorunion); @@ -949,6 +965,7 @@ void Parse( cDiv = ' '; } fprintf(yyTraceFILE,"]\n"); + fflush(yyTraceFILE); } #endif return; From 162da2fcafbb4c9e55d2272470c81b0a29e2ad9a Mon Sep 17 00:00:00 2001 From: Christoph Oelckers Date: Sat, 15 Oct 2016 10:51:48 +0200 Subject: [PATCH 11/11] - allow to specify "none" to set an actor's translation to the identity table. --- src/r_data/r_translate.cpp | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/src/r_data/r_translate.cpp b/src/r_data/r_translate.cpp index bf93650020..983baea58c 100644 --- a/src/r_data/r_translate.cpp +++ b/src/r_data/r_translate.cpp @@ -1207,6 +1207,10 @@ int R_FindCustomTranslation(const char *name) { return TRANSLATION(TRANSLATION_Standard, 7); } + else if (!stricmp(name, "None")) + { + return 0; + } int *t = customTranslationMap.CheckKey(FName(name, true)); return (t != nullptr)? *t : -1; }