Merge branch 'master' of https://github.com/rheit/zdoom into zscript

This commit is contained in:
Christoph Oelckers 2016-10-15 10:52:35 +02:00
commit 5f5da26321
12 changed files with 69 additions and 17 deletions

View file

@ -87,14 +87,16 @@ conversation // Starts a dialog.
page // Starts a new page. Pages are automatically numbered starting at 1. page // Starts a new page. Pages are automatically numbered starting at 1.
{ {
name = <string>; // Name that goes in the upper left hand corner name = <string>; // Name that goes in the upper left hand corner
panel = <string>; // Name of lump to render as the background. panel = <string>; // Name of lump to render as the background.
voice = <string>; // Narration sound lump. voice = <string>; // Narration sound lump.
dialog = <string>; // Dialog of the page. dialog = <string>; // Dialog of the page.
drop = <integer>; // mobj for the object to drop if the actor is goodbye = <string>; // Custom goodbye message. If omitted then the
// killed. // generic goodbyes will be displayed instead.
link = <integer>; // Page to jump to if all ifitem conditions are drop = <integer>; // mobj for the object to drop if the actor is
// satisified. // killed.
link = <integer>; // Page to jump to if all ifitem conditions are
// satisified.
// jumps to the specified page if the player has the specified amount // 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 // or more of item in their inventory. This can be repeated as many

View file

@ -584,6 +584,7 @@ xx(Dialog)
xx(Ifitem) xx(Ifitem)
xx(Choice) xx(Choice)
xx(Link) xx(Link)
xx(Goodbye)
// Special menus // Special menus
xx(Mainmenu) xx(Mainmenu)

View file

@ -556,6 +556,7 @@ FStrifeDialogueNode::~FStrifeDialogueNode ()
{ {
if (SpeakerName != NULL) delete[] SpeakerName; if (SpeakerName != NULL) delete[] SpeakerName;
if (Dialogue != NULL) delete[] Dialogue; if (Dialogue != NULL) delete[] Dialogue;
if (Goodbye != nullptr) delete[] Goodbye;
FStrifeDialogueReply *tokill = Children; FStrifeDialogueReply *tokill = Children;
while (tokill != NULL) while (tokill != NULL)
{ {
@ -743,10 +744,25 @@ public:
++i; ++i;
V_FreeBrokenLines (ReplyLines); V_FreeBrokenLines (ReplyLines);
} }
char goodbye[25]; const char *goodbyestr = CurNode->Goodbye;
mysnprintf(goodbye, countof(goodbye), "TXT_RANDOMGOODBYE_%d", 1+(pr_randomspeech() % NUM_RANDOM_GOODBYES)); if (goodbyestr == nullptr)
const char *goodbyestr = GStrings[goodbye]; {
if (goodbyestr == NULL) goodbyestr = "Bye."; char goodbye[25];
mysnprintf(goodbye, countof(goodbye), "TXT_RANDOMGOODBYE_%d", 1 + (pr_randomspeech() % NUM_RANDOM_GOODBYES));
goodbyestr = GStrings[goodbye];
}
else if (strncmp(goodbyestr, "RANDOM_", 7) == 0)
{
FString byetext;
byetext.Format("TXT_%s_%02d", goodbyestr, 1 + (pr_randomspeech() % NUM_RANDOM_LINES));
goodbyestr = GStrings[byetext];
}
else if (goodbyestr[0] == '$')
{
goodbyestr = GStrings(goodbyestr + 1);
}
if (goodbyestr == nullptr) goodbyestr = "Bye.";
mResponses.Push(mResponseLines.Size()); mResponses.Push(mResponseLines.Size());
mResponseLines.Push(FString(goodbyestr)); mResponseLines.Push(FString(goodbyestr));

View file

@ -30,6 +30,7 @@ struct FStrifeDialogueNode
FSoundID SpeakerVoice; FSoundID SpeakerVoice;
FTextureID Backdrop; FTextureID Backdrop;
char *Dialogue; char *Dialogue;
char *Goodbye = nullptr; // must init to null for binary scripts to work as intended
FStrifeDialogueReply *Children; FStrifeDialogueReply *Children;
}; };

View file

@ -286,6 +286,7 @@ class USDFParser : public UDMFParserBase
FString SpeakerName; FString SpeakerName;
FString Dialogue; FString Dialogue;
FString Goodbye;
while (!sc.CheckToken('}')) while (!sc.CheckToken('}'))
{ {
@ -331,7 +332,9 @@ class USDFParser : public UDMFParserBase
node->ItemCheckNode = CheckInt(key); node->ItemCheckNode = CheckInt(key);
break; break;
case NAME_Goodbye:
Goodbye = CheckString(key);
break;
} }
} }
else else
@ -354,6 +357,7 @@ class USDFParser : public UDMFParserBase
} }
node->SpeakerName = ncopystring(SpeakerName); node->SpeakerName = ncopystring(SpeakerName);
node->Dialogue = ncopystring(Dialogue); node->Dialogue = ncopystring(Dialogue);
node->Goodbye = ncopystring(Goodbye);
return true; return true;
} }

View file

@ -265,7 +265,6 @@ void DMovePoly::Serialize(FSerializer &arc)
{ {
Super::Serialize (arc); Super::Serialize (arc);
arc("angle", m_Angle) arc("angle", m_Angle)
("speed", m_Speed);
("speedv", m_Speedv); ("speedv", m_Speedv);
} }

View file

@ -1207,6 +1207,10 @@ int R_FindCustomTranslation(const char *name)
{ {
return TRANSLATION(TRANSLATION_Standard, 7); return TRANSLATION(TRANSLATION_Standard, 7);
} }
else if (!stricmp(name, "None"))
{
return 0;
}
int *t = customTranslationMap.CheckKey(FName(name, true)); int *t = customTranslationMap.CheckKey(FName(name, true));
return (t != nullptr)? *t : -1; return (t != nullptr)? *t : -1;
} }

View file

@ -1314,7 +1314,7 @@ void R_DrawPortals ()
vissprite_p = firstvissprite; vissprite_p = firstvissprite;
visplaneStack.Pop (pl); visplaneStack.Pop (pl);
if (pl->Alpha > 0) if (pl->Alpha > 0 && pl->picnum != skyflatnum)
{ {
R_DrawSinglePlane (pl, pl->Alpha, pl->Additive, true); R_DrawSinglePlane (pl, pl->Alpha, pl->Additive, true);
} }

View file

@ -408,7 +408,7 @@ void R_DrawVisSprite (vissprite_t *vis)
ESPSResult mode; ESPSResult mode;
bool ispsprite = (!vis->sector && vis->gpos != FVector3(0, 0, 0)); 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 { // scaled to 0; can't see
return; return;
} }

View file

@ -442,7 +442,7 @@ IMPLEMENT_CLASS (DSeqPolyNode)
void DSeqPolyNode::Serialize(FSerializer &arc) void DSeqPolyNode::Serialize(FSerializer &arc)
{ {
Super::Serialize (arc); Super::Serialize (arc);
//arc << m_Poly; arc("poly", m_Poly);
} }
IMPLEMENT_CLASS (DSeqSectorNode) IMPLEMENT_CLASS (DSeqSectorNode)

View file

@ -199,7 +199,9 @@ struct rule {
int index; /* An index number for this rule */ int index; /* An index number for this rule */
int iRule; /* Rule number as used in the generated tables */ int iRule; /* Rule number as used in the generated tables */
Boolean canReduce; /* True if this rule is ever reduced */ Boolean canReduce; /* True if this rule is ever reduced */
#if 0
Boolean doesReduce; /* Reduce actions occur after optimization */ Boolean doesReduce; /* Reduce actions occur after optimization */
#endif
struct rule *nextlhs; /* Next rule with the same LHS */ struct rule *nextlhs; /* Next rule with the same LHS */
struct rule *next; /* Next rule in the global list */ struct rule *next; /* Next rule in the global list */
}; };
@ -4156,6 +4158,7 @@ void ReportTable(
} }
free(ax); free(ax);
#if 0
/* Mark rules that are actually used for reduce actions after all /* Mark rules that are actually used for reduce actions after all
** optimizations have been applied ** optimizations have been applied
*/ */
@ -4168,6 +4171,7 @@ void ReportTable(
} }
} }
} }
#endif
/* Finish rendering the constants now that the action table has /* Finish rendering the constants now that the action table has
** been computed */ ** been computed */
@ -4462,12 +4466,16 @@ void ReportTable(
assert( rp->noCode ); assert( rp->noCode );
fprintf(out," /* (%d) ", rp->iRule); fprintf(out," /* (%d) ", rp->iRule);
writeRuleText(out, rp); writeRuleText(out, rp);
#if 0
if( rp->doesReduce ){ if( rp->doesReduce ){
#endif
fprintf(out, " */ yytestcase(yyruleno==%d);\n", rp->iRule); lineno++; fprintf(out, " */ yytestcase(yyruleno==%d);\n", rp->iRule); lineno++;
#if 0
}else{ }else{
fprintf(out, " (OPTIMIZED OUT) */ assert(yyruleno!=%d);\n", fprintf(out, " (OPTIMIZED OUT) */ assert(yyruleno!=%d);\n",
rp->iRule); lineno++; rp->iRule); lineno++;
} }
#endif
} }
fprintf(out," break;\n"); lineno++; fprintf(out," break;\n"); lineno++;
tplt_xfer(lemp->name,in,out,&lineno); tplt_xfer(lemp->name,in,out,&lineno);

View file

@ -308,6 +308,7 @@ static int yyGrowStack(yyParser *p){
if( yyTraceFILE ){ if( yyTraceFILE ){
fprintf(yyTraceFILE,"%sStack grows from %d to %d entries.\n", fprintf(yyTraceFILE,"%sStack grows from %d to %d entries.\n",
yyTracePrompt, p->yystksz, newSize); yyTracePrompt, p->yystksz, newSize);
fflush(yyTraceFILE);
} }
#endif #endif
p->yystksz = newSize; p->yystksz = newSize;
@ -410,6 +411,7 @@ static void yy_pop_parser_stack(yyParser *pParser){
fprintf(yyTraceFILE,"%sPopping %s\n", fprintf(yyTraceFILE,"%sPopping %s\n",
yyTracePrompt, yyTracePrompt,
yyTokenName[yytos->major]); yyTokenName[yytos->major]);
fflush(yyTraceFILE);
} }
#endif #endif
yy_destructor(pParser, yytos->major, &yytos->minor); yy_destructor(pParser, yytos->major, &yytos->minor);
@ -474,6 +476,7 @@ static unsigned int yy_find_shift_action(
if( yyTraceFILE ){ if( yyTraceFILE ){
fprintf(yyTraceFILE, "%sFALLBACK %s => %s\n", fprintf(yyTraceFILE, "%sFALLBACK %s => %s\n",
yyTracePrompt, yyTokenName[iLookAhead], yyTokenName[iFallback]); yyTracePrompt, yyTokenName[iLookAhead], yyTokenName[iFallback]);
fflush(yyTraceFILE);
} }
#endif #endif
assert( yyFallback[iFallback]==0 ); /* Fallback loop must terminate */ 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", fprintf(yyTraceFILE, "%sWILDCARD %s => %s\n",
yyTracePrompt, yyTokenName[iLookAhead], yyTracePrompt, yyTokenName[iLookAhead],
yyTokenName[YYWILDCARD]); yyTokenName[YYWILDCARD]);
fflush(yyTraceFILE);
} }
#endif /* NDEBUG */ #endif /* NDEBUG */
return yy_action[j]; return yy_action[j];
@ -551,6 +555,7 @@ static void yyStackOverflow(yyParser *yypParser){
#ifndef NDEBUG #ifndef NDEBUG
if( yyTraceFILE ){ if( yyTraceFILE ){
fprintf(yyTraceFILE,"%sStack Overflow!\n",yyTracePrompt); fprintf(yyTraceFILE,"%sStack Overflow!\n",yyTracePrompt);
fflush(yyTraceFILE);
} }
#endif #endif
while( yypParser->yytos>yypParser->yystack ) yy_pop_parser_stack(yypParser); 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", fprintf(yyTraceFILE,"%sShift '%s'\n",
yyTracePrompt,yyTokenName[yypParser->yytos->major]); yyTracePrompt,yyTokenName[yypParser->yytos->major]);
} }
fflush(yyTraceFILE);
} }
} }
#else #else
@ -653,6 +659,7 @@ static void yy_reduce(
yysize = yyRuleInfo[yyruleno].nrhs; yysize = yyRuleInfo[yyruleno].nrhs;
fprintf(yyTraceFILE, "%sReduce [%s], go to state %d.\n", yyTracePrompt, fprintf(yyTraceFILE, "%sReduce [%s], go to state %d.\n", yyTracePrompt,
yyRuleName[yyruleno], yymsp[-yysize].stateno); yyRuleName[yyruleno], yymsp[-yysize].stateno);
fflush(yyTraceFILE);
} }
#endif /* NDEBUG */ #endif /* NDEBUG */
@ -726,6 +733,7 @@ static void yy_parse_failed(
#ifndef NDEBUG #ifndef NDEBUG
if( yyTraceFILE ){ if( yyTraceFILE ){
fprintf(yyTraceFILE,"%sFail!\n",yyTracePrompt); fprintf(yyTraceFILE,"%sFail!\n",yyTracePrompt);
fflush(yyTraceFILE);
} }
#endif #endif
while( yypParser->yytos>yypParser->yystack ) yy_pop_parser_stack(yypParser); while( yypParser->yytos>yypParser->yystack ) yy_pop_parser_stack(yypParser);
@ -764,12 +772,17 @@ static void yy_accept(
#ifndef NDEBUG #ifndef NDEBUG
if( yyTraceFILE ){ if( yyTraceFILE ){
fprintf(yyTraceFILE,"%sAccept!\n",yyTracePrompt); fprintf(yyTraceFILE,"%sAccept!\n",yyTracePrompt);
fflush(yyTraceFILE);
} }
#endif #endif
#ifndef YYNOERRORRECOVERY #ifndef YYNOERRORRECOVERY
yypParser->yyerrcnt = -1; yypParser->yyerrcnt = -1;
#endif #endif
#if 0
assert( yypParser->yytos==yypParser->yystack ); 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 /* Here code is inserted which will be executed whenever the
** parser accepts */ ** parser accepts */
/*********** Begin %parse_accept code *****************************************/ /*********** Begin %parse_accept code *****************************************/
@ -823,6 +836,7 @@ void Parse(
#ifndef NDEBUG #ifndef NDEBUG
if( yyTraceFILE ){ if( yyTraceFILE ){
fprintf(yyTraceFILE,"%sInput '%s'\n",yyTracePrompt,yyTokenName[yymajor]); fprintf(yyTraceFILE,"%sInput '%s'\n",yyTracePrompt,yyTokenName[yymajor]);
fflush(yyTraceFILE);
} }
#endif #endif
@ -845,6 +859,7 @@ void Parse(
#ifndef NDEBUG #ifndef NDEBUG
if( yyTraceFILE ){ if( yyTraceFILE ){
fprintf(yyTraceFILE,"%sSyntax Error!\n",yyTracePrompt); fprintf(yyTraceFILE,"%sSyntax Error!\n",yyTracePrompt);
fflush(yyTraceFILE);
} }
#endif #endif
#ifdef YYERRORSYMBOL #ifdef YYERRORSYMBOL
@ -876,6 +891,7 @@ void Parse(
if( yyTraceFILE ){ if( yyTraceFILE ){
fprintf(yyTraceFILE,"%sDiscard input token %s\n", fprintf(yyTraceFILE,"%sDiscard input token %s\n",
yyTracePrompt,yyTokenName[yymajor]); yyTracePrompt,yyTokenName[yymajor]);
fflush(yyTraceFILE);
} }
#endif #endif
yy_destructor(yypParser, (YYCODETYPE)yymajor, &yyminorunion); yy_destructor(yypParser, (YYCODETYPE)yymajor, &yyminorunion);
@ -949,6 +965,7 @@ void Parse(
cDiv = ' '; cDiv = ' ';
} }
fprintf(yyTraceFILE,"]\n"); fprintf(yyTraceFILE,"]\n");
fflush(yyTraceFILE);
} }
#endif #endif
return; return;