- further splitting of moveweapons_d.

Progress with this but still not enough yet to break it down into manageable parts.
This commit is contained in:
Christoph Oelckers 2020-10-18 08:38:29 +02:00
parent 94e8213caf
commit 2b79b29fef

View file

@ -1663,70 +1663,23 @@ bool movefireball(int i)
return false; return false;
} }
//--------------------------------------------------------------------------- //---------------------------------------------------------------------------
// //
// //
// //
//--------------------------------------------------------------------------- //---------------------------------------------------------------------------
void moveweapons_d(void) bool weaponcommon_d(int i)
{ {
int j, k, p; auto s = &sprite[i];
int dax, day, daz, x, ll;
unsigned int qq;
spritetype* s;
StatIterator it(STAT_PROJECTILE);
int i;
while ((i = it.NextIndex()) >= 0)
{
s = &sprite[i];
if (s->sectnum < 0)
{
deletesprite(i);
continue;
}
hittype[i].bposx = s->x;
hittype[i].bposy = s->y;
hittype[i].bposz = s->z;
switch(s->picnum)
{
case RADIUSEXPLOSION:
case KNEE:
deletesprite(i);
continue;
case TONGUE:
movetongue(i, TONGUE, INNERJAW);
continue;
case FREEZEBLAST:
if (s->yvel < 1 || s->extra < 2 || (s->xvel|s->zvel) == 0)
{
j = fi.spawn(i,TRANSPORTERSTAR);
sprite[j].pal = 1;
sprite[j].xrepeat = 32;
sprite[j].yrepeat = 32;
deletesprite(i);
continue;
}
case SHRINKSPARK:
case RPG:
case FIRELASER:
case SPIT:
case COOLEXPLOSION1:
case FIREBALL:
// Twentieth Anniversary World Tour
if (s->picnum == FIREBALL && !isWorldTour())
break;
if (s->picnum == COOLEXPLOSION1) if (s->picnum == COOLEXPLOSION1)
if (!S_CheckSoundPlaying(i, WIERDSHOT_FLY)) if (!S_CheckSoundPlaying(i, WIERDSHOT_FLY))
S_PlayActorSound(WIERDSHOT_FLY, i); S_PlayActorSound(WIERDSHOT_FLY, i);
p = -1; int p = -1;
int k, ll;
if (s->picnum == RPG && sector[s->sectnum].lotag == 2) if (s->picnum == RPG && sector[s->sectnum].lotag == 2)
{ {
@ -1739,27 +1692,29 @@ void moveweapons_d(void)
ll = s->zvel; ll = s->zvel;
} }
dax = s->x; day = s->y; daz = s->z; int dax = s->x;
int day = s->y;
int daz = s->z;
getglobalz(i); getglobalz(i);
qq = CLIPMASK1; unsigned qq = CLIPMASK1;
switch (s->picnum) switch (s->picnum)
{ {
case RPG: case RPG:
if (hittype[i].picnum != BOSS2 && s->xrepeat >= 10 && sector[s->sectnum].lotag != 2) if (hittype[i].picnum != BOSS2 && s->xrepeat >= 10 && sector[s->sectnum].lotag != 2)
{ {
j = fi.spawn(i,SMALLSMOKE); int j = fi.spawn(i, SMALLSMOKE);
sprite[j].z += (1 << 8); sprite[j].z += (1 << 8);
} }
break; break;
case FIREBALL: case FIREBALL:
if (movefireball(i)) continue; if (movefireball(i)) return;
break; break;
} }
j = fi.movesprite(i, int j = fi.movesprite(i,
(k * (sintable[(s->ang + 512) & 2047])) >> 14, (k * (sintable[(s->ang + 512) & 2047])) >> 14,
(k * (sintable[s->ang & 2047])) >> 14, ll, qq); (k * (sintable[s->ang & 2047])) >> 14, ll, qq);
@ -1770,7 +1725,7 @@ void moveweapons_d(void)
if (s->sectnum < 0) if (s->sectnum < 0)
{ {
deletesprite(i); deletesprite(i);
continue; return;
} }
if ((j & 49152) != 49152 && s->picnum != FREEZEBLAST) if ((j & 49152) != 49152 && s->picnum != FREEZEBLAST)
@ -1794,7 +1749,7 @@ void moveweapons_d(void)
{ {
for (k = -3; k < 2; k++) for (k = -3; k < 2; k++)
{ {
x = EGS(s->sectnum, int x = EGS(s->sectnum,
s->x + ((k * sintable[(s->ang + 512) & 2047]) >> 9), s->x + ((k * sintable[(s->ang + 512) & 2047]) >> 9),
s->y + ((k * sintable[s->ang & 2047]) >> 9), s->y + ((k * sintable[s->ang & 2047]) >> 9),
s->z + ((k * ksgn(s->zvel)) * abs(s->zvel / 24)), FIRELASER, -40 + (k << 2), s->z + ((k * ksgn(s->zvel)) * abs(s->zvel / 24)), FIRELASER, -40 + (k << 2),
@ -1813,7 +1768,7 @@ void moveweapons_d(void)
{ {
if ((j & 49152) == 49152 && sprite[j & (MAXSPRITES - 1)].picnum != APLAYER) if ((j & 49152) == 49152 && sprite[j & (MAXSPRITES - 1)].picnum != APLAYER)
{ {
continue; return;
} }
s->xvel = 0; s->xvel = 0;
s->zvel = 0; s->zvel = 0;
@ -1834,7 +1789,7 @@ void moveweapons_d(void)
sprite[j].yrepeat = 32; sprite[j].yrepeat = 32;
deletesprite(i); deletesprite(i);
continue; return;
} }
if (!isWorldTour() || s->picnum != FIREBALL || fireball) if (!isWorldTour() || s->picnum != FIREBALL || fireball)
@ -1864,7 +1819,7 @@ void moveweapons_d(void)
j = 3 + (krand() & 3); j = 3 + (krand() & 3);
ps[p].numloogs = j; ps[p].numloogs = j;
ps[p].loogcnt = 24 * 4; ps[p].loogcnt = 24 * 4;
for(x=0;x < j;x++) for (int x = 0; x < j; x++)
{ {
ps[p].loogiex[x] = krand() % 320; ps[p].loogiex[x] = krand() % 320;
ps[p].loogiey[x] = krand() % 200; ps[p].loogiey[x] = krand() % 200;
@ -1887,7 +1842,7 @@ void moveweapons_d(void)
s->ang = ((k << 1) - s->ang) & 2047; s->ang = ((k << 1) - s->ang) & 2047;
s->owner = i; s->owner = i;
fi.spawn(i, TRANSPORTERSTAR); fi.spawn(i, TRANSPORTERSTAR);
continue; return;
} }
else else
{ {
@ -1906,7 +1861,7 @@ void moveweapons_d(void)
wall[wall[j].point2].x - wall[j].x, wall[wall[j].point2].x - wall[j].x,
wall[wall[j].point2].y - wall[j].y); wall[wall[j].point2].y - wall[j].y);
s->ang = ((k << 1) - s->ang) & 2047; s->ang = ((k << 1) - s->ang) & 2047;
continue; return;
} }
} }
} }
@ -1920,7 +1875,7 @@ void moveweapons_d(void)
if (sector[s->sectnum].ceilingpal == 0) if (sector[s->sectnum].ceilingpal == 0)
{ {
deletesprite(i); deletesprite(i);
continue; return;
} }
fi.checkhitceiling(s->sectnum); fi.checkhitceiling(s->sectnum);
@ -1932,7 +1887,7 @@ void moveweapons_d(void)
sprite[j].yvel = sprite[i].yvel; sprite[j].yvel = sprite[i].yvel;
hittype[j].owner = sprite[i].owner; hittype[j].owner = sprite[i].owner;
deletesprite(i); deletesprite(i);
continue; return;
} }
if (s->picnum == FREEZEBLAST) if (s->picnum == FREEZEBLAST)
@ -1945,7 +1900,7 @@ void moveweapons_d(void)
if (s->yrepeat > 8) if (s->yrepeat > 8)
s->yrepeat -= 2; s->yrepeat -= 2;
s->yvel--; s->yvel--;
continue; return;
} }
@ -1996,12 +1951,12 @@ void moveweapons_d(void)
if (s->xrepeat >= 10) if (s->xrepeat >= 10)
{ {
x = s->extra; int x = s->extra;
fi.hitradius(i, rpgblastradius, x >> 2, x >> 1, x - (x >> 2), x); fi.hitradius(i, rpgblastradius, x >> 2, x >> 1, x - (x >> 2), x);
} }
else else
{ {
x = s->extra+(global_random&3); int x = s->extra + (global_random & 3);
fi.hitradius(i, (rpgblastradius >> 1), x >> 2, x >> 1, x - (x >> 2), x); fi.hitradius(i, (rpgblastradius >> 1), x >> 2, x >> 1, x - (x >> 2), x);
} }
} }
@ -2014,7 +1969,7 @@ void moveweapons_d(void)
if (s->picnum != COOLEXPLOSION1) if (s->picnum != COOLEXPLOSION1)
{ {
deletesprite(i); deletesprite(i);
continue; return;
} }
} }
if (s->picnum == COOLEXPLOSION1) if (s->picnum == COOLEXPLOSION1)
@ -2023,20 +1978,78 @@ void moveweapons_d(void)
if (s->shade >= 40) if (s->shade >= 40)
{ {
deletesprite(i); deletesprite(i);
continue; return;
} }
} }
else if (s->picnum == RPG && sector[s->sectnum].lotag == 2 && s->xrepeat >= 10 && rnd(140)) else if (s->picnum == RPG && sector[s->sectnum].lotag == 2 && s->xrepeat >= 10 && rnd(140))
fi.spawn(i, WATERBUBBLE); fi.spawn(i, WATERBUBBLE);
}
//---------------------------------------------------------------------------
//
//
//
//---------------------------------------------------------------------------
void moveweapons_d(void)
{
StatIterator it(STAT_PROJECTILE);
int i;
while ((i = it.NextIndex()) >= 0)
{
auto s = &sprite[i];
if (s->sectnum < 0)
{
deletesprite(i);
continue;
}
hittype[i].bposx = s->x;
hittype[i].bposy = s->y;
hittype[i].bposz = s->z;
switch(s->picnum)
{
case RADIUSEXPLOSION:
case KNEE:
deletesprite(i);
continue;
case TONGUE:
movetongue(i, TONGUE, INNERJAW);
continue;
case FREEZEBLAST:
if (s->yvel < 1 || s->extra < 2 || (s->xvel|s->zvel) == 0)
{
int j = fi.spawn(i,TRANSPORTERSTAR);
sprite[j].pal = 1;
sprite[j].xrepeat = 32;
sprite[j].yrepeat = 32;
deletesprite(i);
continue;
}
case FIREBALL:
// Twentieth Anniversary World Tour
if (!isWorldTour()) break;
case SHRINKSPARK:
case RPG:
case FIRELASER:
case SPIT:
case COOLEXPLOSION1:
weaponcommon_d(i);
break; break;
case SHOTSPARK1: case SHOTSPARK1:
p = findplayer(s,&x); {
int x;
int p = findplayer(s, &x);
execute(i, p, x); execute(i, p, x);
break; break;
} }
} }
} }
}
//--------------------------------------------------------------------------- //---------------------------------------------------------------------------
// //