mirror of
https://github.com/ZDoom/Raze.git
synced 2024-11-15 17:01:28 +00:00
- split up shoot_r as well and consolidated both blood splat functions.
This commit is contained in:
parent
4d1e229734
commit
99e3eeb19e
4 changed files with 832 additions and 808 deletions
|
@ -128,6 +128,7 @@ void quickkill(struct player_struct* p);
|
|||
void setpal(struct player_struct* p);
|
||||
int madenoise(int playerNum);
|
||||
int haskey(int sect, int snum);
|
||||
void shootbloodsplat(int i, int p, int sx, int sy, int sz, int sa, int atwith, int BIGFORCE, int OOZFILTER, int NEWBEAST);
|
||||
|
||||
void breakwall(short newpn, short spr, short dawallnum);
|
||||
void callsound2(int soundNum, int playerNum);
|
||||
|
|
|
@ -1048,6 +1048,76 @@ int haskey(int sect, int snum)
|
|||
return 0;
|
||||
}
|
||||
|
||||
//---------------------------------------------------------------------------
|
||||
//
|
||||
//
|
||||
//
|
||||
//---------------------------------------------------------------------------
|
||||
|
||||
void shootbloodsplat(int i, int p, int sx, int sy, int sz, int sa, int atwith, int BIGFORCE, int OOZFILTER, int NEWBEAST)
|
||||
{
|
||||
spritetype* const s = &sprite[i];
|
||||
int sect = s->sectnum;
|
||||
int zvel;
|
||||
short hitsect, hitspr, hitwall, k;
|
||||
int hitx, hity, hitz;
|
||||
|
||||
if (p >= 0)
|
||||
sa += 64 - (krand() & 127);
|
||||
else sa += 1024 + 64 - (krand() & 127);
|
||||
zvel = 1024 - (krand() & 2047);
|
||||
|
||||
|
||||
hitscan(sx, sy, sz, sect,
|
||||
sintable[(sa + 512) & 2047],
|
||||
sintable[sa & 2047], zvel << 6,
|
||||
&hitsect, &hitwall, &hitspr, &hitx, &hity, &hitz, CLIPMASK1);
|
||||
|
||||
// oh my...
|
||||
if (FindDistance2D(sx - hitx, sy - hity) < 1024 &&
|
||||
(hitwall >= 0 && wall[hitwall].overpicnum != BIGFORCE) &&
|
||||
((wall[hitwall].nextsector >= 0 && hitsect >= 0 &&
|
||||
sector[wall[hitwall].nextsector].lotag == 0 &&
|
||||
sector[hitsect].lotag == 0 &&
|
||||
sector[wall[hitwall].nextsector].lotag == 0 &&
|
||||
(sector[hitsect].floorz - sector[wall[hitwall].nextsector].floorz) > (16 << 8)) ||
|
||||
(wall[hitwall].nextsector == -1 && sector[hitsect].lotag == 0)))
|
||||
{
|
||||
if ((wall[hitwall].cstat & 16) == 0)
|
||||
{
|
||||
if (wall[hitwall].nextsector >= 0)
|
||||
{
|
||||
SectIterator it(wall[hitwall].nextsector);
|
||||
while ((k = it.NextIndex()) >= 0)
|
||||
{
|
||||
if (sprite[k].statnum == 3 && sprite[k].lotag == 13)
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
if (wall[hitwall].nextwall >= 0 &&
|
||||
wall[wall[hitwall].nextwall].hitag != 0)
|
||||
return;
|
||||
|
||||
if (wall[hitwall].hitag == 0)
|
||||
{
|
||||
k = fi.spawn(i, atwith);
|
||||
sprite[k].xvel = -12;
|
||||
sprite[k].ang = getangle(wall[hitwall].x - wall[wall[hitwall].point2].x, wall[hitwall].y - wall[wall[hitwall].point2].y) + 512;
|
||||
sprite[k].x = hitx;
|
||||
sprite[k].y = hity;
|
||||
sprite[k].z = hitz;
|
||||
sprite[k].cstat |= (krand() & 4);
|
||||
ssp(k, CLIPMASK0);
|
||||
setsprite(k, sprite[k].x, sprite[k].y, sprite[k].z);
|
||||
if (s->picnum == OOZFILTER || s->picnum == NEWBEAST)
|
||||
sprite[k].pal = 6;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
//---------------------------------------------------------------------------
|
||||
//
|
||||
// view - as in third person view (stupid name for this function)
|
||||
|
|
|
@ -226,75 +226,6 @@ static void shootflamethrowerflame(int i, int p, int sx, int sy, int sz, int sa)
|
|||
//
|
||||
//---------------------------------------------------------------------------
|
||||
|
||||
static void shootbloodsplat(int i, int p, int sx, int sy, int sz, int sa, int atwith)
|
||||
{
|
||||
spritetype* const s = &sprite[i];
|
||||
int sect = s->sectnum;
|
||||
int zvel;
|
||||
short hitsect, hitspr, hitwall, k;
|
||||
int hitx, hity, hitz;
|
||||
|
||||
if (p >= 0)
|
||||
sa += 64 - (krand() & 127);
|
||||
else sa += 1024 + 64 - (krand() & 127);
|
||||
zvel = 1024 - (krand() & 2047);
|
||||
|
||||
|
||||
hitscan(sx, sy, sz, sect,
|
||||
sintable[(sa + 512) & 2047],
|
||||
sintable[sa & 2047], zvel << 6,
|
||||
&hitsect, &hitwall, &hitspr, &hitx, &hity, &hitz, CLIPMASK1);
|
||||
|
||||
// oh my...
|
||||
if (FindDistance2D(sx - hitx, sy - hity) < 1024 &&
|
||||
(hitwall >= 0 && wall[hitwall].overpicnum != BIGFORCE) &&
|
||||
((wall[hitwall].nextsector >= 0 && hitsect >= 0 &&
|
||||
sector[wall[hitwall].nextsector].lotag == 0 &&
|
||||
sector[hitsect].lotag == 0 &&
|
||||
sector[wall[hitwall].nextsector].lotag == 0 &&
|
||||
(sector[hitsect].floorz - sector[wall[hitwall].nextsector].floorz) > (16 << 8)) ||
|
||||
(wall[hitwall].nextsector == -1 && sector[hitsect].lotag == 0)))
|
||||
{
|
||||
if ((wall[hitwall].cstat & 16) == 0)
|
||||
{
|
||||
if (wall[hitwall].nextsector >= 0)
|
||||
{
|
||||
SectIterator it(wall[hitwall].nextsector);
|
||||
while ((k = it.NextIndex()) >= 0)
|
||||
{
|
||||
if (sprite[k].statnum == 3 && sprite[k].lotag == 13)
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
if (wall[hitwall].nextwall >= 0 &&
|
||||
wall[wall[hitwall].nextwall].hitag != 0)
|
||||
return;
|
||||
|
||||
if (wall[hitwall].hitag == 0)
|
||||
{
|
||||
k = fi.spawn(i, atwith);
|
||||
sprite[k].xvel = -12;
|
||||
sprite[k].ang = getangle(wall[hitwall].x - wall[wall[hitwall].point2].x, wall[hitwall].y - wall[wall[hitwall].point2].y) + 512;
|
||||
sprite[k].x = hitx;
|
||||
sprite[k].y = hity;
|
||||
sprite[k].z = hitz;
|
||||
sprite[k].cstat |= (krand() & 4);
|
||||
ssp(k, CLIPMASK0);
|
||||
setsprite(k, sprite[k].x, sprite[k].y, sprite[k].z);
|
||||
if (s->picnum == OOZFILTER || s->picnum == NEWBEAST)
|
||||
sprite[k].pal = 6;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
//---------------------------------------------------------------------------
|
||||
//
|
||||
//
|
||||
//
|
||||
//---------------------------------------------------------------------------
|
||||
|
||||
static void shootknee(int i, int p, int sx, int sy, int sz, int sa)
|
||||
{
|
||||
spritetype* const s = &sprite[i];
|
||||
|
@ -604,11 +535,9 @@ static void shootweapon(int i, int p, int sx, int sy, int sz, int sa, int atwith
|
|||
fi.spawn(k, SMALLSMOKE);
|
||||
else sprite[k].xrepeat = sprite[k].yrepeat = 0;
|
||||
}
|
||||
else if (hitwall >= 0) {
|
||||
|
||||
else if (hitwall >= 0)
|
||||
fi.checkhitwall(k, hitwall, hitx, hity, hitz, SHOTSPARK1);
|
||||
}
|
||||
}
|
||||
|
||||
if ((krand() & 255) < 4)
|
||||
{
|
||||
|
@ -1144,7 +1073,7 @@ void shoot_d(int i, int atwith)
|
|||
case BLOODSPLAT2:
|
||||
case BLOODSPLAT3:
|
||||
case BLOODSPLAT4:
|
||||
shootbloodsplat(i, p, sx, sy, sz, sa, atwith);
|
||||
shootbloodsplat(i, p, sx, sy, sz, sa, atwith, BIGFORCE, OOZFILTER, NEWBEAST);
|
||||
break;
|
||||
|
||||
case KNEE:
|
||||
|
|
|
@ -87,71 +87,14 @@ void incur_damage_r(struct player_struct* p)
|
|||
//
|
||||
//---------------------------------------------------------------------------
|
||||
|
||||
void shoot_r(int i, int atwith)
|
||||
static void shootmelee(int i, int p, int sx, int sy, int sz, int sa, int atwith)
|
||||
{
|
||||
short sect, hitsect, hitspr, hitwall, l, sa, p, j, k, scount;
|
||||
int sx, sy, sz, vel, zvel, hitx, hity, hitz, x, oldzvel, dal;
|
||||
uint8_t sizx, sizy;
|
||||
spritetype* s;
|
||||
spritetype* const s = &sprite[i];
|
||||
int sect = s->sectnum;
|
||||
int zvel;
|
||||
short hitsect, hitspr, hitwall, j, k;
|
||||
int hitx, hity, hitz;
|
||||
|
||||
s = &sprite[i];
|
||||
sect = s->sectnum;
|
||||
zvel = 0;
|
||||
|
||||
if (s->picnum == TILE_APLAYER)
|
||||
{
|
||||
p = s->yvel;
|
||||
|
||||
sx = ps[p].posx;
|
||||
sy = ps[p].posy;
|
||||
sz = ps[p].posz + ps[p].pyoff + (4 << 8);
|
||||
sa = ps[p].angle.ang.asbuild();
|
||||
|
||||
if (isRRRA()) ps[p].crack_time = CRACK_TIME;
|
||||
}
|
||||
else
|
||||
{
|
||||
p = -1;
|
||||
sa = s->ang;
|
||||
sx = s->x;
|
||||
sy = s->y;
|
||||
sz = s->z - ((s->yrepeat * tilesiz[s->picnum].y) << 1) + (4 << 8);
|
||||
sz -= (7 << 8);
|
||||
if (badguy(s))
|
||||
{
|
||||
sx += (sintable[(sa + 1024 + 96) & 2047] >> 7);
|
||||
sy += (sintable[(sa + 512 + 96) & 2047] >> 7);
|
||||
}
|
||||
}
|
||||
|
||||
SetGameVarID(g_iAtWithVarID, 0, p, atwith);
|
||||
SetGameVarID(g_iReturnVarID, 0, p, i);
|
||||
OnEvent(EVENT_SHOOT, i, p, -1);
|
||||
if (GetGameVarID(g_iReturnVarID, p, i) != 0)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
switch (atwith)
|
||||
{
|
||||
case SLINGBLADE:
|
||||
if (!isRRRA()) break;
|
||||
goto rrra_slingblade;
|
||||
|
||||
case BLOODSPLAT1:
|
||||
case BLOODSPLAT2:
|
||||
case BLOODSPLAT3:
|
||||
case BLOODSPLAT4:
|
||||
|
||||
if (p >= 0)
|
||||
sa += 64 - (krand() & 127);
|
||||
else sa += 1024 + 64 - (krand() & 127);
|
||||
zvel = 1024 - (krand() & 2047);
|
||||
case KNEE:
|
||||
case GROWSPARK:
|
||||
rrra_slingblade:
|
||||
if (atwith == KNEE || atwith == GROWSPARK || atwith == SLINGBLADE)
|
||||
{
|
||||
if (p >= 0)
|
||||
{
|
||||
zvel = -ps[p].horizon.sum().asq16() >> 11;
|
||||
|
@ -160,11 +103,11 @@ void shoot_r(int i, int atwith)
|
|||
}
|
||||
else
|
||||
{
|
||||
int x;
|
||||
j = ps[findplayer(s, &x)].i;
|
||||
zvel = ((sprite[j].z - sz) << 8) / (x + 1);
|
||||
sa = getangle(sprite[j].x - sx, sprite[j].y - sy);
|
||||
}
|
||||
}
|
||||
|
||||
hitscan(sx, sy, sz, sect,
|
||||
sintable[(sa + 512) & 2047],
|
||||
|
@ -200,55 +143,7 @@ void shoot_r(int i, int atwith)
|
|||
}
|
||||
}
|
||||
|
||||
if (atwith == BLOODSPLAT1 ||
|
||||
atwith == BLOODSPLAT2 ||
|
||||
atwith == BLOODSPLAT3 ||
|
||||
atwith == BLOODSPLAT4)
|
||||
{
|
||||
if (FindDistance2D(sx - hitx, sy - hity) < 1024)
|
||||
if (hitwall >= 0 && wall[hitwall].overpicnum != BIGFORCE)
|
||||
if ((wall[hitwall].nextsector >= 0 && hitsect >= 0 &&
|
||||
sector[wall[hitwall].nextsector].lotag == 0 &&
|
||||
sector[hitsect].lotag == 0 &&
|
||||
sector[wall[hitwall].nextsector].lotag == 0 &&
|
||||
(sector[hitsect].floorz - sector[wall[hitwall].nextsector].floorz) > (16 << 8)) ||
|
||||
(wall[hitwall].nextsector == -1 && sector[hitsect].lotag == 0))
|
||||
if ((wall[hitwall].cstat & 16) == 0)
|
||||
{
|
||||
if (wall[hitwall].nextsector >= 0)
|
||||
{
|
||||
SectIterator it(wall[hitwall].nextsector);
|
||||
while ((k = it.NextIndex()) >= 0)
|
||||
{
|
||||
if (sprite[k].statnum == 3 && sprite[k].lotag == 13)
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
if (wall[hitwall].nextwall >= 0 &&
|
||||
wall[wall[hitwall].nextwall].hitag != 0)
|
||||
return;
|
||||
|
||||
if (wall[hitwall].hitag == 0)
|
||||
{
|
||||
k = fi.spawn(i, atwith);
|
||||
sprite[k].xvel = -12;
|
||||
sprite[k].ang = getangle(wall[hitwall].x - wall[wall[hitwall].point2].x,
|
||||
wall[hitwall].y - wall[wall[hitwall].point2].y) + 512;
|
||||
sprite[k].x = hitx;
|
||||
sprite[k].y = hity;
|
||||
sprite[k].z = hitz;
|
||||
sprite[k].cstat |= (krand() & 4);
|
||||
ssp(k, CLIPMASK0);
|
||||
setsprite(k, sprite[k].x, sprite[k].y, sprite[k].z);
|
||||
if (s->picnum == OOZFILTER)
|
||||
sprite[k].pal = 6;
|
||||
}
|
||||
}
|
||||
return;
|
||||
}
|
||||
|
||||
if (hitsect < 0) break;
|
||||
if (hitsect < 0) return;
|
||||
|
||||
if ((abs(sx - hitx) + abs(sy - hity)) < 1024)
|
||||
{
|
||||
|
@ -305,15 +200,23 @@ void shoot_r(int i, int atwith)
|
|||
sprite[j].xvel = 32;
|
||||
ssp(i, 0);
|
||||
sprite[j].xvel = 0;
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
break;
|
||||
//---------------------------------------------------------------------------
|
||||
//
|
||||
//
|
||||
//
|
||||
//---------------------------------------------------------------------------
|
||||
|
||||
case SHOTSPARK1:
|
||||
case SHOTGUN:
|
||||
case CHAINGUN:
|
||||
static void shootweapon(int i, int p, int sx, int sy, int sz, int sa, int atwith)
|
||||
{
|
||||
spritetype* const s = &sprite[i];
|
||||
int sect = s->sectnum;
|
||||
int zvel;
|
||||
short hitsect, hitspr, hitwall, l, j, k;
|
||||
int hitx, hity, hitz;
|
||||
|
||||
if (s->extra >= 0) s->shade = -96;
|
||||
|
||||
|
@ -322,7 +225,7 @@ void shoot_r(int i, int atwith)
|
|||
j = aim(s, AUTO_AIM_ANGLE);
|
||||
if (j >= 0)
|
||||
{
|
||||
dal = ((sprite[j].xrepeat * tilesiz[sprite[j].picnum].y) << 1) + (5 << 8);
|
||||
int dal = ((sprite[j].xrepeat * tilesiz[sprite[j].picnum].y) << 1) + (5 << 8);
|
||||
zvel = ((sprite[j].z - sz - dal) << 8) / ldist(&sprite[ps[p].i], &sprite[j]);
|
||||
sa = getangle(sprite[j].x - sx, sprite[j].y - sy);
|
||||
}
|
||||
|
@ -349,6 +252,7 @@ void shoot_r(int i, int atwith)
|
|||
}
|
||||
else
|
||||
{
|
||||
int x;
|
||||
j = findplayer(s, &x);
|
||||
sz -= (4 << 8);
|
||||
zvel = ((ps[j].posz - sz) << 8) / (ldist(&sprite[ps[j].i], s));
|
||||
|
@ -552,91 +456,20 @@ void shoot_r(int i, int atwith)
|
|||
vec3_t v{ hitx, hity, hitz };
|
||||
S_PlaySound3D(PISTOL_RICOCHET, k, &v);
|
||||
}
|
||||
|
||||
return;
|
||||
|
||||
case TRIPBOMBSPRITE:
|
||||
j = fi.spawn(i, atwith);
|
||||
sprite[j].xvel = 32;
|
||||
sprite[j].ang = sprite[i].ang;
|
||||
sprite[j].z -= (5 << 8);
|
||||
break;
|
||||
|
||||
case BOWLINGBALL:
|
||||
j = fi.spawn(i, atwith);
|
||||
sprite[j].xvel = 250;
|
||||
sprite[j].ang = sprite[i].ang;
|
||||
sprite[j].z -= (15 << 8);
|
||||
break;
|
||||
|
||||
case OWHIP:
|
||||
case UWHIP:
|
||||
|
||||
if (s->extra >= 0) s->shade = -96;
|
||||
|
||||
scount = 1;
|
||||
if (atwith == 3471)
|
||||
{
|
||||
vel = 300;
|
||||
sz -= (15 << 8);
|
||||
scount = 1;
|
||||
}
|
||||
else if (atwith == 3475)
|
||||
{
|
||||
vel = 300;
|
||||
sz += (4 << 8);
|
||||
scount = 1;
|
||||
}
|
||||
|
||||
if (p >= 0)
|
||||
//---------------------------------------------------------------------------
|
||||
//
|
||||
//
|
||||
//
|
||||
//---------------------------------------------------------------------------
|
||||
|
||||
static void shootstuff(int i, int p, int sx, int sy, int sz, int sa, int atwith)
|
||||
{
|
||||
j = aim(s, AUTO_AIM_ANGLE);
|
||||
|
||||
if (j >= 0)
|
||||
{
|
||||
dal = ((sprite[j].xrepeat * tilesiz[sprite[j].picnum].y) << 1) - (12 << 8);
|
||||
zvel = ((sprite[j].z - sz - dal) * vel) / ldist(&sprite[ps[p].i], &sprite[j]);
|
||||
sa = getangle(sprite[j].x - sx, sprite[j].y - sy);
|
||||
}
|
||||
else
|
||||
zvel = -mulscale16(ps[p].horizon.sum().asq16(), 98);
|
||||
}
|
||||
else
|
||||
{
|
||||
j = findplayer(s, &x);
|
||||
// sa = getangle(ps[j].oposx-sx,ps[j].oposy-sy);
|
||||
if (s->picnum == VIXEN)
|
||||
sa -= (krand() & 16);
|
||||
else
|
||||
sa += 16 - (krand() & 31);
|
||||
zvel = (((ps[j].oposz - sz + (3 << 8))) * vel) / ldist(&sprite[ps[j].i], s);
|
||||
}
|
||||
|
||||
oldzvel = zvel;
|
||||
sizx = 18; sizy = 18;
|
||||
|
||||
if (p >= 0) sizx = 7, sizy = 7;
|
||||
else sizx = 8, sizy = 8;
|
||||
|
||||
while (scount > 0)
|
||||
{
|
||||
j = EGS(sect, sx, sy, sz, atwith, -127, sizx, sizy, sa, vel, zvel, i, 4);
|
||||
sprite[j].extra += (krand() & 7);
|
||||
|
||||
sprite[j].cstat = 128;
|
||||
sprite[j].clipdist = 4;
|
||||
|
||||
sa = s->ang + 32 - (krand() & 63);
|
||||
zvel = oldzvel + 512 - (krand() & 1023);
|
||||
|
||||
scount--;
|
||||
}
|
||||
|
||||
return;
|
||||
|
||||
case FIRELASER:
|
||||
case SPIT:
|
||||
case COOLEXPLOSION1:
|
||||
spritetype* const s = &sprite[i];
|
||||
int sect = s->sectnum;
|
||||
int vel, zvel;
|
||||
short l, j, scount;
|
||||
|
||||
if (isRRRA())
|
||||
{
|
||||
|
@ -682,7 +515,7 @@ void shoot_r(int i, int atwith)
|
|||
{
|
||||
sx += sintable[(s->ang + 512 + 160) & 2047] >> 7;
|
||||
sy += sintable[(s->ang + 160) & 2047] >> 7;
|
||||
dal = ((sprite[j].xrepeat * tilesiz[sprite[j].picnum].y) << 1) - (12 << 8);
|
||||
int dal = ((sprite[j].xrepeat * tilesiz[sprite[j].picnum].y) << 1) - (12 << 8);
|
||||
zvel = ((sprite[j].z - sz - dal) * vel) / ldist(&sprite[ps[p].i], &sprite[j]);
|
||||
sa = getangle(sprite[j].x - sx, sprite[j].y - sy);
|
||||
}
|
||||
|
@ -695,6 +528,7 @@ void shoot_r(int i, int atwith)
|
|||
}
|
||||
else
|
||||
{
|
||||
int x;
|
||||
j = findplayer(s, &x);
|
||||
// sa = getangle(ps[j].oposx-sx,ps[j].oposy-sy);
|
||||
if (s->picnum == HULK)
|
||||
|
@ -707,7 +541,8 @@ void shoot_r(int i, int atwith)
|
|||
zvel = (((ps[j].oposz - sz + (3 << 8))) * vel) / ldist(&sprite[ps[j].i], s);
|
||||
}
|
||||
|
||||
oldzvel = zvel;
|
||||
int oldzvel = zvel;
|
||||
int sizx, sizy;
|
||||
|
||||
if (atwith == SPIT)
|
||||
{
|
||||
|
@ -762,20 +597,21 @@ void shoot_r(int i, int atwith)
|
|||
|
||||
scount--;
|
||||
}
|
||||
}
|
||||
|
||||
return;
|
||||
//---------------------------------------------------------------------------
|
||||
//
|
||||
//
|
||||
//
|
||||
//---------------------------------------------------------------------------
|
||||
|
||||
case RPG2:
|
||||
case RRTILE1790:
|
||||
if (isRRRA()) goto rrra_rpg2;
|
||||
else break;
|
||||
|
||||
case FREEZEBLAST:
|
||||
sz += (3 << 8);
|
||||
case RPG:
|
||||
case SHRINKSPARK:
|
||||
rrra_rpg2:
|
||||
static void shootrpg(int i, int p, int sx, int sy, int sz, int sa, int atwith)
|
||||
{
|
||||
spritetype* const s = &sprite[i];
|
||||
int sect = s->sectnum;
|
||||
int vel, zvel;
|
||||
short l, j, scount;
|
||||
|
||||
short var90 = 0;
|
||||
if (s->extra >= 0) s->shade = -96;
|
||||
|
||||
|
@ -796,7 +632,7 @@ void shoot_r(int i, int atwith)
|
|||
else
|
||||
var90 = j;
|
||||
}
|
||||
dal = ((sprite[j].xrepeat * tilesiz[sprite[j].picnum].y) << 1) + (8 << 8);
|
||||
int dal = ((sprite[j].xrepeat * tilesiz[sprite[j].picnum].y) << 1) + (8 << 8);
|
||||
zvel = ((sprite[j].z - sz - dal) * vel) / ldist(&sprite[ps[p].i], &sprite[j]);
|
||||
if (sprite[j].picnum != RECON)
|
||||
sa = getangle(sprite[j].x - sx, sprite[j].y - sy);
|
||||
|
@ -815,6 +651,7 @@ void shoot_r(int i, int atwith)
|
|||
}
|
||||
else
|
||||
{
|
||||
int x;
|
||||
j = findplayer(s, &x);
|
||||
sa = getangle(ps[j].oposx - sx, ps[j].oposy - sy);
|
||||
if (s->picnum == BOSS3)
|
||||
|
@ -913,7 +750,194 @@ void shoot_r(int i, int atwith)
|
|||
else
|
||||
sprite[j].clipdist = 40;
|
||||
|
||||
|
||||
}
|
||||
|
||||
//---------------------------------------------------------------------------
|
||||
//
|
||||
//
|
||||
//
|
||||
//---------------------------------------------------------------------------
|
||||
|
||||
static void shootwhip(int i, int p, int sx, int sy, int sz, int sa, int atwith)
|
||||
{
|
||||
spritetype* const s = &sprite[i];
|
||||
int sect = s->sectnum;
|
||||
int vel, zvel;
|
||||
short l, j, scount;
|
||||
|
||||
if (s->extra >= 0) s->shade = -96;
|
||||
|
||||
scount = 1;
|
||||
if (atwith == 3471)
|
||||
{
|
||||
vel = 300;
|
||||
sz -= (15 << 8);
|
||||
scount = 1;
|
||||
}
|
||||
else if (atwith == 3475)
|
||||
{
|
||||
vel = 300;
|
||||
sz += (4 << 8);
|
||||
scount = 1;
|
||||
}
|
||||
|
||||
if (p >= 0)
|
||||
{
|
||||
j = aim(s, AUTO_AIM_ANGLE);
|
||||
|
||||
if (j >= 0)
|
||||
{
|
||||
int dal = ((sprite[j].xrepeat * tilesiz[sprite[j].picnum].y) << 1) - (12 << 8);
|
||||
zvel = ((sprite[j].z - sz - dal) * vel) / ldist(&sprite[ps[p].i], &sprite[j]);
|
||||
sa = getangle(sprite[j].x - sx, sprite[j].y - sy);
|
||||
}
|
||||
else
|
||||
zvel = -mulscale16(ps[p].horizon.sum().asq16(), 98);
|
||||
}
|
||||
else
|
||||
{
|
||||
int x;
|
||||
j = findplayer(s, &x);
|
||||
// sa = getangle(ps[j].oposx-sx,ps[j].oposy-sy);
|
||||
if (s->picnum == VIXEN)
|
||||
sa -= (krand() & 16);
|
||||
else
|
||||
sa += 16 - (krand() & 31);
|
||||
zvel = (((ps[j].oposz - sz + (3 << 8))) * vel) / ldist(&sprite[ps[j].i], s);
|
||||
}
|
||||
|
||||
int oldzvel = zvel;
|
||||
int sizx = 18;
|
||||
int sizy = 18;
|
||||
|
||||
if (p >= 0) sizx = 7, sizy = 7;
|
||||
else sizx = 8, sizy = 8;
|
||||
|
||||
while (scount > 0)
|
||||
{
|
||||
j = EGS(sect, sx, sy, sz, atwith, -127, sizx, sizy, sa, vel, zvel, i, 4);
|
||||
sprite[j].extra += (krand() & 7);
|
||||
|
||||
sprite[j].cstat = 128;
|
||||
sprite[j].clipdist = 4;
|
||||
|
||||
sa = s->ang + 32 - (krand() & 63);
|
||||
zvel = oldzvel + 512 - (krand() & 1023);
|
||||
|
||||
scount--;
|
||||
}
|
||||
}
|
||||
|
||||
//---------------------------------------------------------------------------
|
||||
//
|
||||
//
|
||||
//
|
||||
//---------------------------------------------------------------------------
|
||||
|
||||
void shoot_r(int i, int atwith)
|
||||
{
|
||||
short sect, hitsect, hitspr, hitwall, l, sa, p, j, k, scount;
|
||||
int sx, sy, sz, vel, zvel, hitx, hity, hitz, x, oldzvel, dal;
|
||||
uint8_t sizx, sizy;
|
||||
spritetype* s;
|
||||
|
||||
s = &sprite[i];
|
||||
sect = s->sectnum;
|
||||
zvel = 0;
|
||||
|
||||
if (s->picnum == TILE_APLAYER)
|
||||
{
|
||||
p = s->yvel;
|
||||
|
||||
sx = ps[p].posx;
|
||||
sy = ps[p].posy;
|
||||
sz = ps[p].posz + ps[p].pyoff + (4 << 8);
|
||||
sa = ps[p].angle.ang.asbuild();
|
||||
|
||||
if (isRRRA()) ps[p].crack_time = CRACK_TIME;
|
||||
}
|
||||
else
|
||||
{
|
||||
p = -1;
|
||||
sa = s->ang;
|
||||
sx = s->x;
|
||||
sy = s->y;
|
||||
sz = s->z - ((s->yrepeat * tilesiz[s->picnum].y) << 1) + (4 << 8);
|
||||
sz -= (7 << 8);
|
||||
if (badguy(s))
|
||||
{
|
||||
sx += (sintable[(sa + 1024 + 96) & 2047] >> 7);
|
||||
sy += (sintable[(sa + 512 + 96) & 2047] >> 7);
|
||||
}
|
||||
}
|
||||
|
||||
SetGameVarID(g_iAtWithVarID, 0, p, atwith);
|
||||
SetGameVarID(g_iReturnVarID, 0, p, i);
|
||||
OnEvent(EVENT_SHOOT, i, p, -1);
|
||||
if (GetGameVarID(g_iReturnVarID, p, i) != 0)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
switch (atwith)
|
||||
{
|
||||
case BLOODSPLAT1:
|
||||
case BLOODSPLAT2:
|
||||
case BLOODSPLAT3:
|
||||
case BLOODSPLAT4:
|
||||
shootbloodsplat(i, p, sx, sy, sz, sa, atwith, BIGFORCE, OOZFILTER, -1);
|
||||
return;
|
||||
|
||||
case SLINGBLADE:
|
||||
if (!isRRRA()) break;
|
||||
case KNEE:
|
||||
case GROWSPARK:
|
||||
shootmelee(i, p, sx, sy, sz, sa, atwith);
|
||||
return;
|
||||
|
||||
case SHOTSPARK1:
|
||||
case SHOTGUN:
|
||||
case CHAINGUN:
|
||||
shootweapon(i, p, sx, sy, sz, sa, atwith);
|
||||
return;
|
||||
|
||||
case TRIPBOMBSPRITE:
|
||||
j = fi.spawn(i, atwith);
|
||||
sprite[j].xvel = 32;
|
||||
sprite[j].ang = sprite[i].ang;
|
||||
sprite[j].z -= (5 << 8);
|
||||
break;
|
||||
|
||||
case BOWLINGBALL:
|
||||
j = fi.spawn(i, atwith);
|
||||
sprite[j].xvel = 250;
|
||||
sprite[j].ang = sprite[i].ang;
|
||||
sprite[j].z -= (15 << 8);
|
||||
break;
|
||||
|
||||
case OWHIP:
|
||||
case UWHIP:
|
||||
shootwhip(i, p, sx, sy, sz, sa, atwith);
|
||||
return;
|
||||
|
||||
case FIRELASER:
|
||||
case SPIT:
|
||||
case COOLEXPLOSION1:
|
||||
shootstuff(i, p, sx, sy, sz, sa, atwith);
|
||||
return;
|
||||
|
||||
case RPG2:
|
||||
case RRTILE1790:
|
||||
if (isRRRA()) goto rrra_rpg2;
|
||||
else break;
|
||||
|
||||
case FREEZEBLAST:
|
||||
sz += (3 << 8);
|
||||
case RPG:
|
||||
case SHRINKSPARK:
|
||||
rrra_rpg2:
|
||||
shootrpg(i, p, sx, sy, sz, sa, atwith);
|
||||
break;
|
||||
|
||||
case CHEERBOMB:
|
||||
|
|
Loading…
Reference in a new issue