mirror of
https://github.com/ZDoom/Raze.git
synced 2025-02-28 06:02:13 +00:00
- animateobjs FLOCK block
This commit is contained in:
parent
81bd4f14ae
commit
b5704131eb
1 changed files with 26 additions and 25 deletions
|
@ -406,40 +406,41 @@ void animateobjs(PLAYER& plr) {
|
||||||
// FLOCK
|
// FLOCK
|
||||||
for (i = headspritestat[FLOCK]; i >= 0; i = nextsprite) {
|
for (i = headspritestat[FLOCK]; i >= 0; i = nextsprite) {
|
||||||
nextsprite = nextspritestat[i];
|
nextsprite = nextspritestat[i];
|
||||||
sprite[i].lotag -= TICSPERFRAME;
|
auto& spr = sprite[i];
|
||||||
switch (sprite[i].extra) {
|
spr.lotag -= TICSPERFRAME;
|
||||||
|
switch (spr.extra) {
|
||||||
case 0: // going out of the cave
|
case 0: // going out of the cave
|
||||||
if (sprite[i].lotag < 0) {
|
if (spr.lotag < 0) {
|
||||||
sprite[i].extra = 1;
|
spr.extra = 1;
|
||||||
sprite[i].lotag = 512;
|
spr.lotag = 512;
|
||||||
} else {
|
} else {
|
||||||
movestat = (short) movesprite((short) i,
|
movestat = (short) movesprite((short) i,
|
||||||
(bcos(sprite[i].ang) * TICSPERFRAME) << 3,
|
(bcos(spr.ang) * TICSPERFRAME) << 3,
|
||||||
(bsin(sprite[i].ang) * TICSPERFRAME) << 3, 0, 4 << 8, 4 << 8, 0);
|
(bsin(spr.ang) * TICSPERFRAME) << 3, 0, 4 << 8, 4 << 8, 0);
|
||||||
setsprite(i, sprite[i].x, sprite[i].y, sprite[i].z);
|
setsprite(i, spr.x, spr.y, spr.z);
|
||||||
if (movestat != 0)
|
if (movestat != 0)
|
||||||
sprite[i].ang = (short) (krand() & 2047);
|
spr.ang = (short) (krand() & 2047);
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case 1: // flying in circles
|
case 1: // flying in circles
|
||||||
if (sprite[i].lotag < 0) {
|
if (spr.lotag < 0) {
|
||||||
sprite[i].extra = 2;
|
spr.extra = 2;
|
||||||
sprite[i].lotag = 512;
|
spr.lotag = 512;
|
||||||
sprite[i].ang = (short) (((getangle(sprite[sprite[i].hitag].x - sprite[i].x,
|
spr.ang = (short) (((getangle(sprite[spr.hitag].x - spr.x,
|
||||||
sprite[sprite[i].hitag].y - sprite[i].y) & 2047) - 1024) & 2047);
|
sprite[spr.hitag].y - spr.y) & 2047) - 1024) & 2047);
|
||||||
} else {
|
} else {
|
||||||
sprite[i].z -= TICSPERFRAME << 4;
|
spr.z -= TICSPERFRAME << 4;
|
||||||
sprite[i].ang = (short) ((sprite[i].ang + (TICSPERFRAME << 2)) & 2047);
|
spr.ang = (short) ((spr.ang + (TICSPERFRAME << 2)) & 2047);
|
||||||
movestat = (short) movesprite((short) i,
|
movestat = (short) movesprite((short) i,
|
||||||
(bcos(sprite[i].ang) * TICSPERFRAME) << 3,
|
(bcos(spr.ang) * TICSPERFRAME) << 3,
|
||||||
(bsin(sprite[i].ang) * TICSPERFRAME) << 3, 0, 4 << 8, 4 << 8, 0);
|
(bsin(spr.ang) * TICSPERFRAME) << 3, 0, 4 << 8, 4 << 8, 0);
|
||||||
setsprite(i, sprite[i].x, sprite[i].y, sprite[i].z);
|
setsprite(i, spr.x, spr.y, spr.z);
|
||||||
if (movestat != 0)
|
if (movestat != 0)
|
||||||
sprite[i].ang = (short) (krand() & 2047);
|
spr.ang = (short) (krand() & 2047);
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case 2: // fly to roof and get deleted
|
case 2: // fly to roof and get deleted
|
||||||
if (sprite[i].lotag < 0) {
|
if (spr.lotag < 0) {
|
||||||
if (i == lastbat) {
|
if (i == lastbat) {
|
||||||
soundEngine->StopSound(CHAN_BAT);
|
soundEngine->StopSound(CHAN_BAT);
|
||||||
}
|
}
|
||||||
|
@ -447,9 +448,9 @@ void animateobjs(PLAYER& plr) {
|
||||||
continue;
|
continue;
|
||||||
} else {
|
} else {
|
||||||
movestat = (short) movesprite((short) i,
|
movestat = (short) movesprite((short) i,
|
||||||
(bcos(sprite[i].ang) * TICSPERFRAME) << 3,
|
(bcos(spr.ang) * TICSPERFRAME) << 3,
|
||||||
(bsin(sprite[i].ang) * TICSPERFRAME) << 3, 0, 4 << 8, 4 << 8, 0);
|
(bsin(spr.ang) * TICSPERFRAME) << 3, 0, 4 << 8, 4 << 8, 0);
|
||||||
setsprite(i, sprite[i].x, sprite[i].y, sprite[i].z);
|
setsprite(i, spr.x, spr.y, spr.z);
|
||||||
if ((movestat & 0xc000) == 16384) {// Hits a ceiling / floor
|
if ((movestat & 0xc000) == 16384) {// Hits a ceiling / floor
|
||||||
if (i == lastbat) {
|
if (i == lastbat) {
|
||||||
soundEngine->StopSound(CHAN_BAT);
|
soundEngine->StopSound(CHAN_BAT);
|
||||||
|
@ -458,7 +459,7 @@ void animateobjs(PLAYER& plr) {
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
if (movestat != 0)
|
if (movestat != 0)
|
||||||
sprite[i].ang = (short) (krand() & 2047);
|
spr.ang = (short) (krand() & 2047);
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue