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.
{
name = <string>; // Name that goes in the upper left hand corner
panel = <string>; // Name of lump to render as the background.
voice = <string>; // Narration sound lump.
dialog = <string>; // Dialog of the page.
drop = <integer>; // mobj for the object to drop if the actor is
// killed.
link = <integer>; // Page to jump to if all ifitem conditions are
// satisified.
name = <string>; // Name that goes in the upper left hand corner
panel = <string>; // Name of lump to render as the background.
voice = <string>; // Narration sound lump.
dialog = <string>; // Dialog of the page.
goodbye = <string>; // Custom goodbye message. If omitted then the
// generic goodbyes will be displayed instead.
drop = <integer>; // mobj for the object to drop if the actor is
// 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
// or more of item in their inventory. This can be repeated as many

View file

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

View file

@ -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,25 @@ 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];
}
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());
mResponseLines.Push(FString(goodbyestr));

View file

@ -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;
};

View file

@ -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;
}

View file

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

View file

@ -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;
}

View file

@ -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);
}

View file

@ -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;
}

View file

@ -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)

View file

@ -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);

View file

@ -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;