- sprite[] in aijudy.cpp

This commit is contained in:
Christoph Oelckers 2021-11-21 11:53:43 +01:00
parent 5cc35461ea
commit 58259d745b

View file

@ -342,16 +342,17 @@ void judyOperate(PLAYER& plr)
short nextsprite; short nextsprite;
for (short i = headspritestat[WITCHSIT]; i >= 0; i = nextsprite) { for (short i = headspritestat[WITCHSIT]; i >= 0; i = nextsprite) {
nextsprite = nextspritestat[i]; nextsprite = nextspritestat[i];
auto& spri = sprite[i];
sprite[i].ang = (short)(getangle(plr.x - sprite[i].x, plr.y - sprite[i].y) & 2047); spri.ang = (short)(getangle(plr.x - spri.x, plr.y - spri.y) & 2047);
if (cansee(plr.x, plr.y, plr.z, plr.sector, sprite[i].x, sprite[i].y, if (cansee(plr.x, plr.y, plr.z, plr.sector, spri.x, spri.y,
sprite[i].z - (tileHeight(sprite[i].picnum) << 7), sprite[i].sectnum)) { spri.z - (tileHeight(spri.picnum) << 7), spri.sectnum)) {
sprite[i].lotag -= TICSPERFRAME; spri.lotag -= TICSPERFRAME;
if (sprite[i].lotag < 0) { if (spri.lotag < 0) {
sprite[i].picnum++; spri.picnum++;
sprite[i].lotag = 12; spri.lotag = 12;
if (sprite[i].picnum == JUDYSIT + 4) { if (spri.picnum == JUDYSIT + 4) {
sprite[i].picnum = JUDY; spri.picnum = JUDY;
newstatus(i, FACE); newstatus(i, FACE);
} }
} }
@ -361,14 +362,15 @@ void judyOperate(PLAYER& plr)
void spawnabaddy(int i, int monster) { void spawnabaddy(int i, int monster) {
short j = insertsprite(sprite[i].sectnum, FACE); short j = insertsprite(sprite[i].sectnum, FACE);
auto& spawned = sprite[j];
sprite[j].x = sprite[i].x + (krand() & 2048) - 1024; spawned.x = sprite[i].x + (krand() & 2048) - 1024;
sprite[j].y = sprite[i].y + (krand() & 2048) - 1024; spawned.y = sprite[i].y + (krand() & 2048) - 1024;
sprite[j].z = sprite[i].z; spawned.z = sprite[i].z;
sprite[j].pal = 0; spawned.pal = 0;
sprite[j].shade = 0; spawned.shade = 0;
sprite[j].cstat = 0; spawned.cstat = 0;
if (monster == WILLOW) if (monster == WILLOW)
premapWillow(j); premapWillow(j);
@ -381,10 +383,10 @@ void spawnabaddy(int i, int monster) {
else if (monster == GONZOGSH) else if (monster == GONZOGSH)
premapGonzo(j); premapGonzo(j);
sprite[j].picnum = (short)monster; spawned.picnum = (short)monster;
killcnt++; killcnt++;
setsprite(j, sprite[j].x, sprite[j].y, sprite[j].z); setsprite(j, spawned.x, spawned.y, spawned.z);
} }