- make polyobject setup errors not abort the map.

This commit is contained in:
Christoph Oelckers 2017-04-14 20:27:46 +02:00
parent d014395dae
commit 3d8821ee82

View file

@ -34,6 +34,7 @@
#include "p_blockmap.h"
#include "g_levellocals.h"
#include "actorinlines.h"
#include "v_text.h"
// MACROS ------------------------------------------------------------------
@ -1536,19 +1537,23 @@ static void SpawnPolyobj (int index, int tag, int type)
{
if (po->Sidedefs.Size() > 0)
{
I_Error ("SpawnPolyobj: Polyobj %d already spawned.\n", tag);
Printf (TEXTCOLOR_RED "SpawnPolyobj: Polyobj %d already spawned.\n", tag);
return;
}
sd->linedef->special = 0;
sd->linedef->args[0] = 0;
IterFindPolySides(&polyobjs[index], sd);
po->MirrorNum = sd->linedef->args[1];
po->crush = (type != SMT_PolySpawn) ? 3 : 0;
po->bHurtOnTouch = (type == SMT_PolySpawnHurt);
po->tag = tag;
po->seqType = sd->linedef->args[2];
if (po->seqType < 0 || po->seqType > 63)
else
{
po->seqType = 0;
sd->linedef->special = 0;
sd->linedef->args[0] = 0;
IterFindPolySides(&polyobjs[index], sd);
po->MirrorNum = sd->linedef->args[1];
po->crush = (type != SMT_PolySpawn) ? 3 : 0;
po->bHurtOnTouch = (type == SMT_PolySpawnHurt);
po->tag = tag;
po->seqType = sd->linedef->args[2];
if (po->seqType < 0 || po->seqType > 63)
{
po->seqType = 0;
}
}
break;
}
@ -1570,9 +1575,13 @@ static void SpawnPolyobj (int index, int tag, int type)
{
if (!level.sides[i].linedef->args[1])
{
I_Error("SpawnPolyobj: Explicit line missing order number in poly %d, linedef %d.\n", tag, level.sides[i].linedef->Index());
Printf(TEXTCOLOR_RED "SpawnPolyobj: Explicit line missing order number in poly %d, linedef %d.\n", tag, level.sides[i].linedef->Index());
return;
}
else
{
po->Sidedefs.Push(&level.sides[i]);
}
po->Sidedefs.Push (&level.sides[i]);
}
}
qsort(&po->Sidedefs[0], po->Sidedefs.Size(), sizeof(po->Sidedefs[0]), posicmp);
@ -1585,7 +1594,10 @@ static void SpawnPolyobj (int index, int tag, int type)
po->MirrorNum = po->Sidedefs[0]->linedef->args[2];
}
else
I_Error ("SpawnPolyobj: Poly %d does not exist\n", tag);
{
Printf(TEXTCOLOR_RED "SpawnPolyobj: Poly %d does not exist\n", tag);
return;
}
}
validcount++;
@ -1648,11 +1660,13 @@ static void TranslateToStartSpot (int tag, const DVector2 &origin)
}
if (po == NULL)
{ // didn't match the tag with a polyobj tag
I_Error("TranslateToStartSpot: Unable to match polyobj tag: %d\n", tag);
Printf(TEXTCOLOR_RED "TranslateToStartSpot: Unable to match polyobj tag: %d\n", tag);
return;
}
if (po->Sidedefs.Size() == 0)
{
I_Error ("TranslateToStartSpot: Anchor point located without a StartSpot point: %d\n", tag);
Printf(TEXTCOLOR_RED "TranslateToStartSpot: Anchor point located without a StartSpot point: %d\n", tag);
return;
}
po->OriginalPts.Resize(po->Sidedefs.Size());
po->PrevPts.Resize(po->Sidedefs.Size());
@ -1738,8 +1752,7 @@ void PO_Init (void)
{
if (polyobjs[polyIndex].OriginalPts.Size() == 0)
{
I_Error ("PO_Init: StartSpot located without an Anchor point: %d\n",
polyobjs[polyIndex].tag);
Printf (TEXTCOLOR_RED "PO_Init: StartSpot located without an Anchor point: %d\n", polyobjs[polyIndex].tag);
}
}
InitBlockMap();