- 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;
}
//---------------------------------------------------------------------------
//
//
//
//---------------------------------------------------------------------------
void moveweapons_d(void)
bool weaponcommon_d(int i)
{
int j, k, p;
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;
auto s = &sprite[i];
if (s->picnum == COOLEXPLOSION1)
if (!S_CheckSoundPlaying(i, WIERDSHOT_FLY))
S_PlayActorSound(WIERDSHOT_FLY, i);
p = -1;
int p = -1;
int k, ll;
if (s->picnum == RPG && sector[s->sectnum].lotag == 2)
{
@ -1739,27 +1692,29 @@ void moveweapons_d(void)
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);
qq = CLIPMASK1;
unsigned qq = CLIPMASK1;
switch (s->picnum)
{
case RPG:
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);
}
break;
case FIREBALL:
if (movefireball(i)) continue;
if (movefireball(i)) return;
break;
}
j = fi.movesprite(i,
int j = fi.movesprite(i,
(k * (sintable[(s->ang + 512) & 2047])) >> 14,
(k * (sintable[s->ang & 2047])) >> 14, ll, qq);
@ -1770,7 +1725,7 @@ void moveweapons_d(void)
if (s->sectnum < 0)
{
deletesprite(i);
continue;
return;
}
if ((j & 49152) != 49152 && s->picnum != FREEZEBLAST)
@ -1794,7 +1749,7 @@ void moveweapons_d(void)
{
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->y + ((k * sintable[s->ang & 2047]) >> 9),
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)
{
continue;
return;
}
s->xvel = 0;
s->zvel = 0;
@ -1834,7 +1789,7 @@ void moveweapons_d(void)
sprite[j].yrepeat = 32;
deletesprite(i);
continue;
return;
}
if (!isWorldTour() || s->picnum != FIREBALL || fireball)
@ -1864,7 +1819,7 @@ void moveweapons_d(void)
j = 3 + (krand() & 3);
ps[p].numloogs = j;
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].loogiey[x] = krand() % 200;
@ -1887,7 +1842,7 @@ void moveweapons_d(void)
s->ang = ((k << 1) - s->ang) & 2047;
s->owner = i;
fi.spawn(i, TRANSPORTERSTAR);
continue;
return;
}
else
{
@ -1906,7 +1861,7 @@ void moveweapons_d(void)
wall[wall[j].point2].x - wall[j].x,
wall[wall[j].point2].y - wall[j].y);
s->ang = ((k << 1) - s->ang) & 2047;
continue;
return;
}
}
}
@ -1920,7 +1875,7 @@ void moveweapons_d(void)
if (sector[s->sectnum].ceilingpal == 0)
{
deletesprite(i);
continue;
return;
}
fi.checkhitceiling(s->sectnum);
@ -1932,7 +1887,7 @@ void moveweapons_d(void)
sprite[j].yvel = sprite[i].yvel;
hittype[j].owner = sprite[i].owner;
deletesprite(i);
continue;
return;
}
if (s->picnum == FREEZEBLAST)
@ -1945,7 +1900,7 @@ void moveweapons_d(void)
if (s->yrepeat > 8)
s->yrepeat -= 2;
s->yvel--;
continue;
return;
}
@ -1996,12 +1951,12 @@ void moveweapons_d(void)
if (s->xrepeat >= 10)
{
x = s->extra;
int x = s->extra;
fi.hitradius(i, rpgblastradius, x >> 2, x >> 1, x - (x >> 2), x);
}
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);
}
}
@ -2014,7 +1969,7 @@ void moveweapons_d(void)
if (s->picnum != COOLEXPLOSION1)
{
deletesprite(i);
continue;
return;
}
}
if (s->picnum == COOLEXPLOSION1)
@ -2023,20 +1978,78 @@ void moveweapons_d(void)
if (s->shade >= 40)
{
deletesprite(i);
continue;
return;
}
}
else if (s->picnum == RPG && sector[s->sectnum].lotag == 2 && s->xrepeat >= 10 && rnd(140))
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;
case SHOTSPARK1:
p = findplayer(s,&x);
{
int x;
int p = findplayer(s, &x);
execute(i, p, x);
break;
}
}
}
}
//---------------------------------------------------------------------------
//