- Fixed: ACS's GetActorX, GetActorY, GetActorZ, GetActorFloorZ, GetActorCeilingZ, GetActorAngle,

and GetActorPitch did not have NULL pointer checks for the TID == 0 case.

SVN r2845 (trunk)
This commit is contained in:
Randy Heit 2010-09-23 01:51:00 +00:00
parent 16fa8cc249
commit b8fa340986

View file

@ -5827,107 +5827,42 @@ int DLevelScript::RunScript ()
case PCD_GETACTORX: case PCD_GETACTORX:
case PCD_GETACTORY: case PCD_GETACTORY:
case PCD_GETACTORZ: case PCD_GETACTORZ:
{
if(STACK(1) == 0)
{
STACK(1) = (&activator->x)[pcd - PCD_GETACTORX];
}
else
{ {
AActor *actor = SingleActorFromTID(STACK(1), activator); AActor *actor = SingleActorFromTID(STACK(1), activator);
STACK(1) = actor == NULL ? 0 : (&actor->x)[pcd - PCD_GETACTORX];
if (actor == NULL)
{
STACK(1) = 0;
}
else
{
STACK(1) = (&actor->x)[pcd - PCD_GETACTORX];
}
}
} }
break; break;
case PCD_GETACTORFLOORZ: case PCD_GETACTORFLOORZ:
case PCD_GETACTORCEILINGZ:
{
if(STACK(1) == 0)
{
if (pcd == PCD_GETACTORFLOORZ)
{
STACK(1) = activator->floorz;
}
else if(STACK(1) == 0)
{
STACK(1) = activator->ceilingz;
}
}
else
{ {
AActor *actor = SingleActorFromTID(STACK(1), activator); AActor *actor = SingleActorFromTID(STACK(1), activator);
STACK(1) = actor == NULL ? 0 : actor->floorz;
}
break;
if (actor == NULL) case PCD_GETACTORCEILINGZ:
{ {
STACK(1) = 0; AActor *actor = SingleActorFromTID(STACK(1), activator);
} STACK(1) = actor == NULL ? 0 : actor->ceilingz;
else if (pcd == PCD_GETACTORFLOORZ)
{
STACK(1) = actor->floorz;
}
else
{
STACK(1) = actor->ceilingz;
}
}
} }
break; break;
case PCD_GETACTORANGLE: case PCD_GETACTORANGLE:
{
if(STACK(1) == 0)
{
STACK(1) = activator->angle >> 16;
}
else
{ {
AActor *actor = SingleActorFromTID(STACK(1), activator); AActor *actor = SingleActorFromTID(STACK(1), activator);
STACK(1) = actor == NULL ? 0 : actor->angle >> 16;
if (actor == NULL)
{
STACK(1) = 0;
}
else
{
STACK(1) = actor->angle >> 16;
}
}
} }
break; break;
case PCD_GETACTORPITCH: case PCD_GETACTORPITCH:
{
if(STACK(1) == 0)
{
STACK(1) = activator->pitch >> 16;
}
else
{ {
AActor *actor = SingleActorFromTID(STACK(1), activator); AActor *actor = SingleActorFromTID(STACK(1), activator);
STACK(1) = actor == NULL ? 0 : actor->pitch >> 16;
if (actor == NULL)
{
STACK(1) = 0;
}
else
{
STACK(1) = actor->pitch >> 16;
}
}
} }
break; break;
case PCD_GETLINEROWOFFSET: case PCD_GETLINEROWOFFSET:
if (activationline) if (activationline != NULL)
{ {
PushToStack (activationline->sidedef[0]->GetTextureYOffset(side_t::mid) >> FRACBITS); PushToStack (activationline->sidedef[0]->GetTextureYOffset(side_t::mid) >> FRACBITS);
} }