- added a few NULL checks.

This commit is contained in:
Christoph Oelckers 2020-11-03 07:12:11 +01:00
parent b2497b346c
commit cd70818d54
2 changed files with 13 additions and 11 deletions

View file

@ -215,7 +215,7 @@ void animatesprites_d(int x, int y, int a, int smoothratio)
case TRIPBOMB: case TRIPBOMB:
continue; continue;
case FORCESPHERE: case FORCESPHERE:
if (t->statnum == 5) if (t->statnum == STAT_MISC && Owner)
{ {
short sqa, sqb; short sqa, sqb;
@ -235,7 +235,7 @@ void animatesprites_d(int x, int y, int a, int smoothratio)
continue; continue;
case BURNING: case BURNING:
case BURNING2: case BURNING2:
if (Owner->statnum == 10) if (Owner && Owner->statnum == STAT_PLAYER)
{ {
if (display_mirror == 0 && Owner->yvel == screenpeek && ps[Owner->yvel].over_shoulder_on == 0) if (display_mirror == 0 && Owner->yvel == screenpeek && ps[Owner->yvel].over_shoulder_on == 0)
t->xrepeat = 0; t->xrepeat = 0;
@ -633,6 +633,7 @@ void animatesprites_d(int x, int y, int a, int smoothratio)
switch (s->picnum) switch (s->picnum)
{ {
case LASERLINE: case LASERLINE:
if (!Owner) break;
if (sector[t->sectnum].lotag == 2) t->pal = 8; if (sector[t->sectnum].lotag == 2) t->pal = 8;
t->z = Owner->z - (3 << 8); t->z = Owner->z - (3 << 8);
if (lasermode == 2 && ps[screenpeek].heat_on == 0) if (lasermode == 2 && ps[screenpeek].heat_on == 0)
@ -660,6 +661,7 @@ void animatesprites_d(int x, int y, int a, int smoothratio)
t->cstat |= 128; t->cstat |= 128;
case BURNING: case BURNING:
case BURNING2: case BURNING2:
if (!Owner) break;
if (Owner->picnum != TREE1 && Owner->picnum != TREE2) if (Owner->picnum != TREE1 && Owner->picnum != TREE2)
t->z = sector[t->sectnum].floorz; t->z = sector[t->sectnum].floorz;
t->shade = -127; t->shade = -127;
@ -683,7 +685,7 @@ void animatesprites_d(int x, int y, int a, int smoothratio)
} }
t->picnum = s->picnum + k + ((h->temp_data[0] < 4) * 5); t->picnum = s->picnum + k + ((h->temp_data[0] < 4) * 5);
t->shade = Owner->shade; if (Owner) t->shade = Owner->shade;
break; break;
@ -701,7 +703,7 @@ void animatesprites_d(int x, int y, int a, int smoothratio)
if (h->temp_data[0] > 2) t->cstat &= ~12; if (h->temp_data[0] > 2) t->cstat &= ~12;
break; break;
case FRAMEEFFECT1: case FRAMEEFFECT1:
if (s->owner >= 0 && Owner->statnum < MAXSTATUS) if (Owner && Owner->statnum < MAXSTATUS)
{ {
if (Owner->picnum == APLAYER) if (Owner->picnum == APLAYER)
if (ud.camerasprite == -1) if (ud.camerasprite == -1)

View file

@ -213,7 +213,7 @@ void animatesprites_r(int x, int y, int a, int smoothratio)
case TRIPBOMBSPRITE: case TRIPBOMBSPRITE:
continue; continue;
case FORCESPHERE: case FORCESPHERE:
if (t->statnum == 5) if (t->statnum == STAT_MISC && Owner)
{ {
short sqa, sqb; short sqa, sqb;
@ -232,7 +232,7 @@ void animatesprites_r(int x, int y, int a, int smoothratio)
} }
continue; continue;
case BURNING: case BURNING:
if (Owner->statnum == 10) if (Owner && Owner->statnum == STAT_PLAYER)
{ {
if (display_mirror == 0 && Owner->yvel == screenpeek && ps[Owner->yvel].over_shoulder_on == 0) if (display_mirror == 0 && Owner->yvel == screenpeek && ps[Owner->yvel].over_shoulder_on == 0)
t->xrepeat = 0; t->xrepeat = 0;
@ -254,7 +254,7 @@ void animatesprites_r(int x, int y, int a, int smoothratio)
t->shade = (sintable[(ud.levelclock << 4) & 2047] >> 10); t->shade = (sintable[(ud.levelclock << 4) & 2047] >> 10);
break; break;
case SHRINKSPARK: case SHRINKSPARK:
if ((Owner->picnum == CHEER || Owner->picnum == CHEERSTAYPUT) && isRRRA()) if (Owner && (Owner->picnum == CHEER || Owner->picnum == CHEERSTAYPUT) && isRRRA())
{ {
t->picnum = CHEERBLADE + ((ud.levelclock >> 4) & 3); t->picnum = CHEERBLADE + ((ud.levelclock >> 4) & 3);
t->shade = -127; t->shade = -127;
@ -270,7 +270,7 @@ void animatesprites_r(int x, int y, int a, int smoothratio)
} }
else goto default_case; else goto default_case;
case SPIT: case SPIT:
if (isRRRA()) if (isRRRA() && Owner)
{ {
if (Owner->picnum == MINION && Owner->pal == 8) if (Owner->picnum == MINION && Owner->pal == 8)
t->picnum = RRTILE3500 + ((ud.levelclock >> 4) % 6); t->picnum = RRTILE3500 + ((ud.levelclock >> 4) % 6);
@ -819,7 +819,7 @@ void animatesprites_r(int x, int y, int a, int smoothratio)
break; break;
case FIRE: case FIRE:
case BURNING: case BURNING:
if (Owner->picnum != TREE1 && Owner->picnum != TREE2) if (Owner && Owner->picnum != TREE1 && Owner->picnum != TREE2)
t->z = sector[t->sectnum].floorz; t->z = sector[t->sectnum].floorz;
t->shade = -127; t->shade = -127;
break; break;
@ -917,7 +917,7 @@ void animatesprites_r(int x, int y, int a, int smoothratio)
else t->cstat &= ~4; else t->cstat &= ~4;
t->picnum = s->picnum + k + ((h->temp_data[0] < 4) * 5); t->picnum = s->picnum + k + ((h->temp_data[0] < 4) * 5);
t->shade = Owner->shade; if (Owner) t->shade = Owner->shade;
break; break;
case MUD: case MUD:
t->picnum = MUD + t1; t->picnum = MUD + t1;
@ -936,7 +936,7 @@ void animatesprites_r(int x, int y, int a, int smoothratio)
if (h->temp_data[0] > 2) t->cstat &= ~12; if (h->temp_data[0] > 2) t->cstat &= ~12;
break; break;
case FRAMEEFFECT1: case FRAMEEFFECT1:
if (s->owner >= 0 && Owner->statnum < MAXSTATUS) if (Owner && Owner->statnum < MAXSTATUS)
{ {
if (Owner->picnum == APLAYER) if (Owner->picnum == APLAYER)
if (ud.camerasprite == -1) if (ud.camerasprite == -1)