mirror of
https://github.com/ZDoom/raze-gles.git
synced 2024-12-26 03:30:46 +00:00
SW: Fix crash issues when Track sprites are set up incorrectly
git-svn-id: https://svn.eduke32.com/eduke32@8485 1a8010ca-5511-0410-912e-c29ae57300e0
This commit is contained in:
parent
e50cdbad0c
commit
f4fda7e646
3 changed files with 14 additions and 3 deletions
|
@ -817,6 +817,8 @@ KillSprite(int16_t SpriteNum)
|
||||||
void ChangeState(short SpriteNum, STATEp statep)
|
void ChangeState(short SpriteNum, STATEp statep)
|
||||||
{
|
{
|
||||||
USERp u = User[SpriteNum];
|
USERp u = User[SpriteNum];
|
||||||
|
if (u == nullptr)
|
||||||
|
return;
|
||||||
|
|
||||||
u->Tics = 0;
|
u->Tics = 0;
|
||||||
u->State = u->StateStart = statep;
|
u->State = u->StateStart = statep;
|
||||||
|
|
|
@ -642,7 +642,7 @@ TrackSetup(void)
|
||||||
{
|
{
|
||||||
int i, nexti;
|
int i, nexti;
|
||||||
auto const sp = (uspritetype const *)&sprite[headspritestat[STAT_TRACK+ndx]];
|
auto const sp = (uspritetype const *)&sprite[headspritestat[STAT_TRACK+ndx]];
|
||||||
buildprintf("WARNING: Did not find first point of Track Number %d, x %d, y %d", ndx, sp->x, sp->y);
|
buildprintf("WARNING: Did not find first point of Track Number %d, x %d, y %d\n", ndx, sp->x, sp->y);
|
||||||
for (i=headspritestat[STAT_TRACK+ndx]; i>=0; i=nexti)
|
for (i=headspritestat[STAT_TRACK+ndx]; i>=0; i=nexti)
|
||||||
{
|
{
|
||||||
// neuter the track's sprite list
|
// neuter the track's sprite list
|
||||||
|
@ -1598,6 +1598,12 @@ PlaceActorsOnTracks(void)
|
||||||
|
|
||||||
NextActorTrackPoint(i);
|
NextActorTrackPoint(i);
|
||||||
|
|
||||||
|
if (Track[u->track].NumPoints == 0)
|
||||||
|
{
|
||||||
|
buildprintf("WARNING: Sprite %d (%d, %d) placed on track %d with no points!\n", i, TrackerCast(sp->x), TrackerCast(sp->y), u->track);
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
// check angle in the "forward" direction
|
// check angle in the "forward" direction
|
||||||
sp->ang = getangle((tpoint + u->point)->x - sp->x, (tpoint + u->point)->y - sp->y);
|
sp->ang = getangle((tpoint + u->point)->x - sp->x, (tpoint + u->point)->y - sp->y);
|
||||||
}
|
}
|
||||||
|
|
|
@ -4949,8 +4949,11 @@ SetSuicide(short SpriteNum)
|
||||||
SPRITEp sp = &sprite[SpriteNum];
|
SPRITEp sp = &sprite[SpriteNum];
|
||||||
USERp u = User[SpriteNum];
|
USERp u = User[SpriteNum];
|
||||||
|
|
||||||
SET(u->Flags, SPR_SUICIDE);
|
if (u != nullptr)
|
||||||
u->RotNum = 0;
|
{
|
||||||
|
SET(u->Flags, SPR_SUICIDE);
|
||||||
|
u->RotNum = 0;
|
||||||
|
}
|
||||||
ChangeState(SpriteNum, s_Suicide);
|
ChangeState(SpriteNum, s_Suicide);
|
||||||
#else
|
#else
|
||||||
// this will NOT work because
|
// this will NOT work because
|
||||||
|
|
Loading…
Reference in a new issue