- little bit of array access removal.

(It's going to be a long way to refactor the sprite system to not rely on indices...)
This commit is contained in:
Christoph Oelckers 2020-10-14 00:30:14 +02:00
parent a34525574c
commit bfed4e179b

View file

@ -1848,25 +1848,26 @@ void reactor(int i, int REACTOR, int REACTOR2, int REACTORBURNT, int REACTOR2BUR
int j = headspritesect[sect]; int j = headspritesect[sect];
while (j >= 0) while (j >= 0)
{ {
if (sprite[j].picnum == SECTOREFFECTOR) auto sprj = &sprite[j];
if (sprj->picnum == SECTOREFFECTOR)
{ {
if (sprite[j].lotag == 1) if (sprj->lotag == 1)
{ {
sprite[j].lotag = (short)65535; sprj->lotag = (short)65535;
sprite[j].hitag = (short)65535; sprj->hitag = (short)65535;
} }
} }
else if (sprite[j].picnum == REACTOR) else if (sprj->picnum == REACTOR)
{ {
sprite[j].picnum = REACTORBURNT; sprj->picnum = REACTORBURNT;
} }
else if (sprite[j].picnum == REACTOR2) else if (sprj->picnum == REACTOR2)
{ {
sprite[j].picnum = REACTOR2BURNT; sprj->picnum = REACTOR2BURNT;
} }
else if (sprite[j].picnum == REACTORSPARK || sprite[j].picnum == REACTOR2SPARK) else if (sprj->picnum == REACTORSPARK || sprj->picnum == REACTOR2SPARK)
{ {
sprite[j].cstat = (short)32768; sprj->cstat = (short)32768;
} }
j = nextspritesect[j]; j = nextspritesect[j];
} }
@ -2952,12 +2953,13 @@ void handle_se14(int i, bool checkstat, int RPG, int JIBS6)
j = headspritesect[sprite[sprite[i].owner].sectnum]; j = headspritesect[sprite[sprite[i].owner].sectnum];
while (j >= 0) while (j >= 0)
{ {
auto spj = &sprite[j];
int l = nextspritesect[j]; int l = nextspritesect[j];
if (sprite[j].statnum == 1 && badguy(&sprite[j]) && sprite[j].picnum != SECTOREFFECTOR && sprite[j].picnum != LOCATORS) if (spj->statnum == 1 && badguy(spj) && spj->picnum != SECTOREFFECTOR && spj->picnum != LOCATORS)
{ {
short k = sprite[j].sectnum; short k = spj->sectnum;
updatesector(sprite[j].x, sprite[j].y, &k); updatesector(spj->x, spj->y, &k);
if (sprite[j].extra >= 0 && k == s->sectnum) if (spj->extra >= 0 && k == s->sectnum)
{ {
fi.gutsdir(&sprite[j], JIBS6, 72, myconnectindex); fi.gutsdir(&sprite[j], JIBS6, 72, myconnectindex);
S_PlayActorSound(SQUISHED, i); S_PlayActorSound(SQUISHED, i);
@ -3087,21 +3089,23 @@ void handle_se30(int i, int JIBS6)
int j = headspritesect[s->sectnum]; int j = headspritesect[s->sectnum];
while (j >= 0) while (j >= 0)
{ {
if (sprite[j].picnum != SECTOREFFECTOR && sprite[j].picnum != LOCATORS) auto sprj = &sprite[j];
auto htj = &hittype[j];
if (sprj->picnum != SECTOREFFECTOR && sprj->picnum != LOCATORS)
{ {
if (numplayers < 2) if (numplayers < 2)
{ {
hittype[j].bposx = sprite[j].x; htj->bposx = sprj->x;
hittype[j].bposy = sprite[j].y; htj->bposy = sprj->y;
} }
sprite[j].x += l; sprj->x += l;
sprite[j].y += x; sprj->y += x;
if (numplayers > 1) if (numplayers > 1)
{ {
hittype[j].bposx = sprite[j].x; htj->bposx = sprj->x;
hittype[j].bposy = sprite[j].y; htj->bposy = sprj->y;
} }
} }
j = nextspritesect[j]; j = nextspritesect[j];
@ -3245,7 +3249,7 @@ void handle_se02(int i)
void handle_se03(int i) void handle_se03(int i)
{ {
spritetype* s = &sprite[i]; auto s = &sprite[i];
auto t = &hittype[i].temp_data[0]; auto t = &hittype[i].temp_data[0];
auto sc = &sector[s->sectnum]; auto sc = &sector[s->sectnum];
int st = s->lotag; int st = s->lotag;
@ -3297,7 +3301,7 @@ void handle_se03(int i)
void handle_se04(int i) void handle_se04(int i)
{ {
spritetype* s = &sprite[i]; auto s = &sprite[i];
auto t = &hittype[i].temp_data[0]; auto t = &hittype[i].temp_data[0];
auto sc = &sector[s->sectnum]; auto sc = &sector[s->sectnum];
int st = s->lotag; int st = s->lotag;