mirror of
https://github.com/ZDoom/raze-gles.git
synced 2024-12-29 13:00:43 +00:00
- wrapped hitscan in a variant returning an actor.
This commit is contained in:
parent
768487584e
commit
17737eea85
5 changed files with 93 additions and 79 deletions
|
@ -5125,8 +5125,9 @@ int dodge(DDukeActor* actor)
|
|||
int furthestangle(DDukeActor *actor, int angs)
|
||||
{
|
||||
auto s = &actor->s;
|
||||
short j, hitsect, hitwall, hitspr, furthest_angle, angincs;
|
||||
short j, hitsect, hitwall, furthest_angle, angincs;
|
||||
int hx, hy, hz, d, greatestd;
|
||||
DDukeActor* dd;
|
||||
|
||||
greatestd = -(1 << 30);
|
||||
angincs = 2048 / angs;
|
||||
|
@ -5136,10 +5137,7 @@ int furthestangle(DDukeActor *actor, int angs)
|
|||
|
||||
for (j = s->ang; j < (2048 + s->ang); j += angincs)
|
||||
{
|
||||
hitscan(s->x, s->y, s->z - (8 << 8), s->sectnum,
|
||||
sintable[(j + 512) & 2047],
|
||||
sintable[j & 2047], 0,
|
||||
&hitsect, &hitwall, &hitspr, &hx, &hy, &hz, CLIPMASK1);
|
||||
hitscan(s->x, s->y, s->z - (8 << 8), s->sectnum, sintable[(j + 512) & 2047], sintable[j & 2047], 0, &hitsect, &hitwall, &dd, &hx, &hy, &hz, CLIPMASK1);
|
||||
|
||||
d = abs(hx - s->x) + abs(hy - s->y);
|
||||
|
||||
|
@ -5161,8 +5159,9 @@ int furthestangle(DDukeActor *actor, int angs)
|
|||
int furthestcanseepoint(DDukeActor *actor, DDukeActor* tosee, int* dax, int* day)
|
||||
{
|
||||
auto s = &actor->s;
|
||||
short j, hitsect, hitwall, hitspr, angincs;
|
||||
short j, hitsect, hitwall, angincs;
|
||||
int hx, hy, hz, d, da;//, d, cd, ca,tempx,tempy,cx,cy;
|
||||
DDukeActor* dd;
|
||||
|
||||
if ((actor->temp_data[0] & 63)) return -1;
|
||||
|
||||
|
@ -5173,10 +5172,8 @@ int furthestcanseepoint(DDukeActor *actor, DDukeActor* tosee, int* dax, int* day
|
|||
auto ts = &tosee->s;
|
||||
for (j = ts->ang; j < (2048 + ts->ang); j += (angincs - (krand() & 511)))
|
||||
{
|
||||
hitscan(ts->x, ts->y, ts->z - (16 << 8), ts->sectnum,
|
||||
sintable[(j + 512) & 2047],
|
||||
sintable[j & 2047], 16384 - (krand() & 32767),
|
||||
&hitsect, &hitwall, &hitspr, &hx, &hy, &hz, CLIPMASK1);
|
||||
hitscan(ts->x, ts->y, ts->z - (16 << 8), ts->sectnum, sintable[(j + 512) & 2047], sintable[j & 2047], 16384 - (krand() & 32767),
|
||||
&hitsect, &hitwall, &dd, &hx, &hy, &hz, CLIPMASK1);
|
||||
|
||||
d = abs(hx - ts->x) + abs(hy - ts->y);
|
||||
da = abs(hx - s->x) + abs(hy - s->y);
|
||||
|
|
|
@ -274,4 +274,13 @@ inline int callsound(int sect, int a)
|
|||
return callsound(sect, a == -1? nullptr : &hittype[a]);
|
||||
}
|
||||
|
||||
inline int hitscan(int x, int y, int z, int16_t sectnum, int32_t vx, int32_t vy, int32_t vz,
|
||||
short* hitsect, short* hitwall, DDukeActor** hitspr, int* hitx, int* hity, int* hitz, uint32_t cliptype)
|
||||
{
|
||||
short hitsprt;
|
||||
int res = ::hitscan(x, y, z, sectnum, vx, vy, vz, hitsect, hitwall, &hitsprt, hitx, hity, hitz, cliptype);
|
||||
if (hitspr) *hitspr = hitsprt == -1 ? nullptr : &hittype[hitsprt];
|
||||
return res;
|
||||
}
|
||||
|
||||
END_DUKE_NS
|
||||
|
|
|
@ -218,13 +218,14 @@ int hits(DDukeActor* actor)
|
|||
auto sp = &actor->s;
|
||||
int sx, sy, sz;
|
||||
short sect;
|
||||
short hw, hs;
|
||||
short hw;
|
||||
int zoff;
|
||||
DDukeActor* d;
|
||||
|
||||
if (sp->picnum == TILE_APLAYER) zoff = (40 << 8);
|
||||
else zoff = 0;
|
||||
|
||||
hitscan(sp->x, sp->y, sp->z - zoff, sp->sectnum, sintable[(sp->ang + 512) & 2047], sintable[sp->ang & 2047], 0, §, &hw, &hs, &sx, &sy, &sz, CLIPMASK1);
|
||||
hitscan(sp->x, sp->y, sp->z - zoff, sp->sectnum, sintable[(sp->ang + 512) & 2047], sintable[sp->ang & 2047], 0, §, &hw, &d, &sx, &sy, &sz, CLIPMASK1);
|
||||
|
||||
return (FindDistance2D(sx - sp->x, sy - sp->y));
|
||||
}
|
||||
|
@ -246,9 +247,7 @@ int hitasprite(DDukeActor* actor, DDukeActor** hitsp)
|
|||
else if (sp->picnum == TILE_APLAYER) zoff = (39 << 8);
|
||||
else zoff = 0;
|
||||
|
||||
short hitthis = -1;
|
||||
hitscan(sp->x, sp->y, sp->z - zoff, sp->sectnum, sintable[(sp->ang + 512) & 2047], sintable[sp->ang & 2047], 0, §, &hw, &hitthis, &sx, &sy, &sz, CLIPMASK1);
|
||||
if (hitsp) *hitsp = (hitthis == -1 ? nullptr : &hittype[hitthis]);
|
||||
hitscan(sp->x, sp->y, sp->z - zoff, sp->sectnum, sintable[(sp->ang + 512) & 2047], sintable[sp->ang & 2047], 0, §, &hw, hitsp, &sx, &sy, &sz, CLIPMASK1);
|
||||
|
||||
if (hw >= 0 && (wall[hw].cstat & 16) && badguy(actor))
|
||||
return((1 << 30));
|
||||
|
@ -265,10 +264,11 @@ int hitasprite(DDukeActor* actor, DDukeActor** hitsp)
|
|||
int hitawall(struct player_struct* p, int* hitw)
|
||||
{
|
||||
int sx, sy, sz;
|
||||
short sect, hs, hitw1;
|
||||
short sect, hitw1;
|
||||
DDukeActor* d;
|
||||
|
||||
hitscan(p->posx, p->posy, p->posz, p->cursectnum,
|
||||
sintable[(p->angle.ang.asbuild() + 512) & 2047], sintable[p->angle.ang.asbuild() & 2047], 0, §, &hitw1, &hs, &sx, &sy, &sz, CLIPMASK0);
|
||||
sintable[(p->angle.ang.asbuild() + 512) & 2047], sintable[p->angle.ang.asbuild() & 2047], 0, §, &hitw1, &d, &sx, &sy, &sz, CLIPMASK0);
|
||||
*hitw = hitw1;
|
||||
|
||||
return (FindDistance2D(sx - p->posx, sy - p->posy));
|
||||
|
@ -1074,8 +1074,9 @@ void shootbloodsplat(DDukeActor* actor, int p, int sx, int sy, int sz, int sa, i
|
|||
spritetype* const s = &actor->s;
|
||||
int sect = s->sectnum;
|
||||
int zvel;
|
||||
short hitsect, hitspr, hitwall;
|
||||
short hitsect, hitwall;
|
||||
int hitx, hity, hitz;
|
||||
DDukeActor* d;
|
||||
|
||||
if (p >= 0)
|
||||
sa += 64 - (krand() & 127);
|
||||
|
@ -1086,7 +1087,7 @@ void shootbloodsplat(DDukeActor* actor, int p, int sx, int sy, int sz, int sa, i
|
|||
hitscan(sx, sy, sz, sect,
|
||||
sintable[(sa + 512) & 2047],
|
||||
sintable[sa & 2047], zvel << 6,
|
||||
&hitsect, &hitwall, &hitspr, &hitx, &hity, &hitz, CLIPMASK1);
|
||||
&hitsect, &hitwall, &d, &hitx, &hity, &hitz, CLIPMASK1);
|
||||
|
||||
// oh my...
|
||||
if (FindDistance2D(sx - hitx, sy - hity) < 1024 &&
|
||||
|
@ -1143,7 +1144,8 @@ bool view(struct player_struct* pp, int* vx, int* vy, int* vz, short* vsectnum,
|
|||
{
|
||||
spritetype* sp;
|
||||
int i, nx, ny, nz, hx, hy, hitx, hity, hitz;
|
||||
short bakcstat, hitsect, hitwall, hitsprite, daang;
|
||||
short bakcstat, hitsect, hitwall, daang;
|
||||
DDukeActor* hitsprt;
|
||||
|
||||
nx = (sintable[(ang + 1536) & 2047] >> 4);
|
||||
ny = (sintable[(ang + 1024) & 2047] >> 4);
|
||||
|
@ -1155,7 +1157,7 @@ bool view(struct player_struct* pp, int* vx, int* vy, int* vz, short* vsectnum,
|
|||
sp->cstat &= (short)~0x101;
|
||||
|
||||
updatesectorz(*vx, *vy, *vz, vsectnum);
|
||||
hitscan(*vx, *vy, *vz, *vsectnum, nx, ny, nz, &hitsect, &hitwall, &hitsprite, &hitx, &hity, &hitz, CLIPMASK1);
|
||||
hitscan(*vx, *vy, *vz, *vsectnum, nx, ny, nz, &hitsect, &hitwall, &hitsprt, &hitx, &hity, &hitz, CLIPMASK1);
|
||||
|
||||
if (*vsectnum < 0)
|
||||
{
|
||||
|
@ -1176,7 +1178,7 @@ bool view(struct player_struct* pp, int* vx, int* vy, int* vz, short* vsectnum,
|
|||
if (abs(nx) > abs(ny)) hx -= mulscale28(nx, i);
|
||||
else hy -= mulscale28(ny, i);
|
||||
}
|
||||
else if (hitsprite < 0)
|
||||
else if (!hitsprt)
|
||||
{
|
||||
if (abs(nx) > abs(ny)) hx -= (nx >> 5);
|
||||
else hy -= (ny >> 5);
|
||||
|
|
|
@ -232,8 +232,9 @@ static void shootknee(DDukeActor* actor, int p, int sx, int sy, int sz, int sa)
|
|||
auto s = &actor->s;
|
||||
int sect = s->sectnum;
|
||||
int zvel;
|
||||
short hitsect, hitspr, hitwall;
|
||||
short hitsect, hitwall;
|
||||
int hitx, hity, hitz;
|
||||
DDukeActor* hitsprt;
|
||||
|
||||
if (p >= 0)
|
||||
{
|
||||
|
@ -252,14 +253,14 @@ static void shootknee(DDukeActor* actor, int p, int sx, int sy, int sz, int sa)
|
|||
hitscan(sx, sy, sz, sect,
|
||||
sintable[(sa + 512) & 2047],
|
||||
sintable[sa & 2047], zvel << 6,
|
||||
&hitsect, &hitwall, &hitspr, &hitx, &hity, &hitz, CLIPMASK1);
|
||||
&hitsect, &hitwall, &hitsprt, &hitx, &hity, &hitz, CLIPMASK1);
|
||||
|
||||
|
||||
if (hitsect < 0) return;
|
||||
|
||||
if ((abs(sx - hitx) + abs(sy - hity)) < 1024)
|
||||
{
|
||||
if (hitwall >= 0 || hitspr >= 0)
|
||||
if (hitwall >= 0 || hitsprt)
|
||||
{
|
||||
auto knee = EGS(hitsect, hitx, hity, hitz, KNEE, -15, 0, 0, sa, 32, 0, actor, 4);
|
||||
knee->s.extra += (krand() & 7);
|
||||
|
@ -273,10 +274,10 @@ static void shootknee(DDukeActor* actor, int p, int sx, int sy, int sz, int sa)
|
|||
if (p >= 0 && ps[p].steroids_amount > 0 && ps[p].steroids_amount < 400)
|
||||
knee->s.extra += (max_player_health >> 2);
|
||||
|
||||
if (hitspr >= 0 && sprite[hitspr].picnum != ACCESSSWITCH && sprite[hitspr].picnum != ACCESSSWITCH2)
|
||||
if (hitsprt && hitsprt->s.picnum != ACCESSSWITCH && hitsprt->s.picnum != ACCESSSWITCH2)
|
||||
{
|
||||
fi.checkhitsprite(hitspr, knee->GetIndex());
|
||||
if (p >= 0) fi.checkhitswitch(p, hitspr, 1);
|
||||
fi.checkhitsprite(hitsprt->GetIndex(), knee->GetIndex());
|
||||
if (p >= 0) fi.checkhitswitch(p, hitsprt->GetIndex(), 1);
|
||||
}
|
||||
|
||||
else if (hitwall >= 0)
|
||||
|
@ -319,8 +320,9 @@ static void shootweapon(int i, int p, int sx, int sy, int sz, int sa, int atwith
|
|||
auto s = &actor->s;
|
||||
int sect = s->sectnum;
|
||||
int zvel;
|
||||
short hitsect, hitspr, hitwall, l, k;
|
||||
short hitsect, hitwall, l, k;
|
||||
int hitx, hity, hitz;
|
||||
DDukeActor* hitact;
|
||||
|
||||
if (s->extra >= 0) s->shade = -96;
|
||||
|
||||
|
@ -405,12 +407,11 @@ static void shootweapon(int i, int p, int sx, int sy, int sz, int sa, int atwith
|
|||
hitscan(sx, sy, sz, sect,
|
||||
sintable[(sa + 512) & 2047],
|
||||
sintable[sa & 2047],
|
||||
zvel << 6, &hitsect, &hitwall, &hitspr, &hitx, &hity, &hitz, CLIPMASK1);
|
||||
zvel << 6, &hitsect, &hitwall, &hitact, &hitx, &hity, &hitz, CLIPMASK1);
|
||||
s->cstat |= 257;
|
||||
|
||||
|
||||
if (hitsect < 0) return;
|
||||
auto hitact = &hittype[hitspr];
|
||||
|
||||
if ((krand() & 15) == 0 && sector[hitsect].lotag == 2)
|
||||
tracers(hitx, hity, hitz, sx, sy, sz, 8 - (ud.multimode >> 1));
|
||||
|
@ -421,7 +422,7 @@ static void shootweapon(int i, int p, int sx, int sy, int sz, int sa, int atwith
|
|||
spark->s.extra = ScriptCode[actorinfo[atwith].scriptaddress];
|
||||
spark->s.extra += (krand() % 6);
|
||||
|
||||
if (hitwall == -1 && hitspr == -1)
|
||||
if (hitwall == -1 && hitact == nullptr)
|
||||
{
|
||||
if (zvel < 0)
|
||||
{
|
||||
|
@ -437,10 +438,10 @@ static void shootweapon(int i, int p, int sx, int sy, int sz, int sa, int atwith
|
|||
spawn(spark, SMALLSMOKE);
|
||||
}
|
||||
|
||||
if (hitspr >= 0)
|
||||
if (hitact)
|
||||
{
|
||||
fi.checkhitsprite(hitspr, spark->GetIndex());
|
||||
if (sprite[hitspr].picnum == TILE_APLAYER && (ud.coop != 1 || ud.ffire == 1))
|
||||
fi.checkhitsprite(hitact->GetIndex(), spark->GetIndex());
|
||||
if (hitact->s.picnum == TILE_APLAYER && (ud.coop != 1 || ud.ffire == 1))
|
||||
{
|
||||
auto jib = spawn(spark, JIBS6);
|
||||
spark->s.xrepeat = spark->s.yrepeat = 0;
|
||||
|
@ -461,7 +462,7 @@ static void shootweapon(int i, int p, int sx, int sy, int sz, int sa, int atwith
|
|||
hitact->s.picnum == HANDSWITCH ||
|
||||
hitact->s.picnum == HANDSWITCH + 1))
|
||||
{
|
||||
fi.checkhitswitch(p, hitspr, 1);
|
||||
fi.checkhitswitch(p, hitact->GetIndex(), 1);
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
@ -533,10 +534,10 @@ static void shootweapon(int i, int p, int sx, int sy, int sz, int sa, int atwith
|
|||
k = EGS(hitsect, hitx, hity, hitz, SHOTSPARK1, -15, 24, 24, sa, 0, 0, i, 4);
|
||||
sprite[k].extra = ScriptCode[actorinfo[atwith].scriptaddress];
|
||||
|
||||
if (hitspr >= 0)
|
||||
if (hitact)
|
||||
{
|
||||
fi.checkhitsprite(hitspr, k);
|
||||
if (sprite[hitspr].picnum != TILE_APLAYER)
|
||||
fi.checkhitsprite(hitact->GetIndex(), k);
|
||||
if (hitact->s.picnum != TILE_APLAYER)
|
||||
fi.spawn(k, SMALLSMOKE);
|
||||
else sprite[k].xrepeat = sprite[k].yrepeat = 0;
|
||||
}
|
||||
|
@ -846,8 +847,9 @@ static void shootlaser(int i, int p, int sx, int sy, int sz, int sa)
|
|||
spritetype* const s = &sprite[i];
|
||||
int sect = s->sectnum;
|
||||
int zvel;
|
||||
short hitsect, hitspr, hitwall, j, k;
|
||||
short hitsect, hitwall, j, k;
|
||||
int hitx, hity, hitz;
|
||||
DDukeActor* hitsprt;
|
||||
|
||||
if (p >= 0)
|
||||
zvel = -ps[p].horizon.sum().asq16() >> 11;
|
||||
|
@ -856,10 +858,10 @@ static void shootlaser(int i, int p, int sx, int sy, int sz, int sa)
|
|||
hitscan(sx, sy, sz - ps[p].pyoff, sect,
|
||||
sintable[(sa + 512) & 2047],
|
||||
sintable[sa & 2047],
|
||||
zvel << 6, &hitsect, &hitwall, &hitspr, &hitx, &hity, &hitz, CLIPMASK1);
|
||||
zvel << 6, &hitsect, &hitwall, &hitsprt, &hitx, &hity, &hitz, CLIPMASK1);
|
||||
|
||||
j = 0;
|
||||
if (hitspr >= 0) return;
|
||||
if (hitsprt) return;
|
||||
|
||||
if (hitwall >= 0 && hitsect >= 0)
|
||||
if (((hitx - sx) * (hitx - sx) + (hity - sy) * (hity - sy)) < (290 * 290))
|
||||
|
@ -914,8 +916,9 @@ static void shootgrowspark(int i, int p, int sx, int sy, int sz, int sa)
|
|||
auto s = &actor->s;
|
||||
int sect = s->sectnum;
|
||||
int zvel;
|
||||
short hitsect, hitspr, hitwall, k;
|
||||
short hitsect, hitwall, k;
|
||||
int hitx, hity, hitz;
|
||||
DDukeActor* hitsprt;
|
||||
|
||||
if (p >= 0)
|
||||
{
|
||||
|
@ -967,7 +970,7 @@ static void shootgrowspark(int i, int p, int sx, int sy, int sz, int sa)
|
|||
hitscan(sx, sy, sz, sect,
|
||||
sintable[(sa + 512) & 2047],
|
||||
sintable[sa & 2047],
|
||||
zvel << 6, &hitsect, &hitwall, &hitspr, &hitx, &hity, &hitz, CLIPMASK1);
|
||||
zvel << 6, &hitsect, &hitwall, &hitsprt, &hitx, &hity, &hitz, CLIPMASK1);
|
||||
|
||||
s->cstat |= 257;
|
||||
|
||||
|
@ -977,12 +980,12 @@ static void shootgrowspark(int i, int p, int sx, int sy, int sz, int sa)
|
|||
sprite[j].cstat |= 130;
|
||||
sprite[j].xrepeat = sprite[j].yrepeat = 1;
|
||||
|
||||
if (hitwall == -1 && hitspr == -1 && hitsect >= 0)
|
||||
if (hitwall == -1 && hitsprt == nullptr && hitsect >= 0)
|
||||
{
|
||||
if (zvel < 0 && (sector[hitsect].ceilingstat & 1) == 0)
|
||||
fi.checkhitceiling(hitsect);
|
||||
}
|
||||
else if (hitspr >= 0) fi.checkhitsprite(hitspr, j);
|
||||
else if (hitsprt != nullptr) fi.checkhitsprite(hitsprt->GetIndex(), j);
|
||||
else if (hitwall >= 0 && wall[hitwall].picnum != ACCESSSWITCH && wall[hitwall].picnum != ACCESSSWITCH2)
|
||||
{
|
||||
fi.checkhitwall(j, hitwall, hitx, hity, hitz, GROWSPARK);
|
||||
|
@ -1993,14 +1996,15 @@ int operateTripbomb(int snum)
|
|||
int pi = p->i;
|
||||
|
||||
int sx, sy, sz;
|
||||
short sect, hw, hitsp;
|
||||
short sect, hw;
|
||||
DDukeActor* hitsprt;
|
||||
|
||||
hitscan(p->posx, p->posy, p->posz,
|
||||
p->cursectnum, sintable[(p->angle.ang.asbuild() + 512) & 2047],
|
||||
sintable[p->angle.ang.asbuild() & 2047], -p->horizon.sum().asq16() >> 11,
|
||||
§, &hw, &hitsp, &sx, &sy, &sz, CLIPMASK1);
|
||||
§, &hw, &hitsprt, &sx, &sy, &sz, CLIPMASK1);
|
||||
|
||||
if (sect < 0 || hitsp >= 0)
|
||||
if (sect < 0 || hitsprt)
|
||||
return 0;
|
||||
|
||||
if (hw >= 0 && sector[sect].lotag > 2)
|
||||
|
|
|
@ -93,8 +93,9 @@ static void shootmelee(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, j, k;
|
||||
short hitsect, hitwall, j, k;
|
||||
int hitx, hity, hitz;
|
||||
DDukeActor* hitsprt;
|
||||
|
||||
if (p >= 0)
|
||||
{
|
||||
|
@ -113,10 +114,10 @@ static void shootmelee(int i, int p, int sx, int sy, int sz, int sa, int atwith)
|
|||
hitscan(sx, sy, sz, sect,
|
||||
sintable[(sa + 512) & 2047],
|
||||
sintable[sa & 2047], zvel << 6,
|
||||
&hitsect, &hitwall, &hitspr, &hitx, &hity, &hitz, CLIPMASK1);
|
||||
&hitsect, &hitwall, &hitsprt, &hitx, &hity, &hitz, CLIPMASK1);
|
||||
|
||||
if (isRRRA() && ((sector[hitsect].lotag == 160 && zvel > 0) || (sector[hitsect].lotag == 161 && zvel < 0))
|
||||
&& hitspr == -1 && hitwall == -1)
|
||||
&& hitsprt == nullptr && hitwall == -1)
|
||||
{
|
||||
short ii;
|
||||
for (ii = 0; ii < MAXSPRITES; ii++)
|
||||
|
@ -138,7 +139,7 @@ static void shootmelee(int i, int p, int sx, int sy, int sz, int sa, int atwith)
|
|||
hitscan(nx, ny, nz, sprite[sprite[ii].owner].sectnum,
|
||||
sintable[(sa + 512) & 2047],
|
||||
sintable[sa & 2047], zvel << 6,
|
||||
&hitsect, &hitwall, &hitspr, &hitx, &hity, &hitz, CLIPMASK1);
|
||||
&hitsect, &hitwall, &hitsprt, &hitx, &hity, &hitz, CLIPMASK1);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
@ -148,7 +149,7 @@ static void shootmelee(int i, int p, int sx, int sy, int sz, int sa, int atwith)
|
|||
|
||||
if ((abs(sx - hitx) + abs(sy - hity)) < 1024)
|
||||
{
|
||||
if (hitwall >= 0 || hitspr >= 0)
|
||||
if (hitwall >= 0 || hitsprt)
|
||||
{
|
||||
if (isRRRA() && atwith == SLINGBLADE)
|
||||
{
|
||||
|
@ -173,10 +174,10 @@ static void shootmelee(int i, int p, int sx, int sy, int sz, int sa, int atwith)
|
|||
if (p >= 0 && ps[p].steroids_amount > 0 && ps[p].steroids_amount < 400)
|
||||
sprite[j].extra += (max_player_health >> 2);
|
||||
|
||||
if (hitspr >= 0 && sprite[hitspr].picnum != ACCESSSWITCH && sprite[hitspr].picnum != ACCESSSWITCH2)
|
||||
if (hitsprt && hitsprt->s.picnum != ACCESSSWITCH && hitsprt->s.picnum != ACCESSSWITCH2)
|
||||
{
|
||||
fi.checkhitsprite(hitspr, j);
|
||||
if (p >= 0) fi.checkhitswitch(p, hitspr, 1);
|
||||
fi.checkhitsprite(hitsprt->GetIndex(), j);
|
||||
if (p >= 0) fi.checkhitswitch(p, hitsprt->GetIndex(), 1);
|
||||
}
|
||||
else if (hitwall >= 0)
|
||||
{
|
||||
|
@ -217,8 +218,9 @@ static void shootweapon(int i, int p, int sx, int sy, int sz, int sa, int atwith
|
|||
auto s = &actor->s;
|
||||
int sect = s->sectnum;
|
||||
int zvel;
|
||||
short hitsect, hitspr, hitwall, l, k;
|
||||
short hitsect, hitwall, l, k;
|
||||
int hitx, hity, hitz;
|
||||
DDukeActor* hitsprt;
|
||||
|
||||
if (s->extra >= 0) s->shade = -96;
|
||||
|
||||
|
@ -274,10 +276,10 @@ static void shootweapon(int i, int p, int sx, int sy, int sz, int sa, int atwith
|
|||
hitscan(sx, sy, sz, sect,
|
||||
sintable[(sa + 512) & 2047],
|
||||
sintable[sa & 2047],
|
||||
zvel << 6, &hitsect, &hitwall, &hitspr, &hitx, &hity, &hitz, CLIPMASK1);
|
||||
zvel << 6, &hitsect, &hitwall, &hitsprt, &hitx, &hity, &hitz, CLIPMASK1);
|
||||
|
||||
if (isRRRA() && (((sector[hitsect].lotag == 160 && zvel > 0) || (sector[hitsect].lotag == 161 && zvel < 0))
|
||||
&& hitspr == -1 && hitwall == -1))
|
||||
&& hitsprt == nullptr && hitwall == -1))
|
||||
{
|
||||
short ii;
|
||||
for (ii = 0; ii < MAXSPRITES; ii++)
|
||||
|
@ -299,7 +301,7 @@ static void shootweapon(int i, int p, int sx, int sy, int sz, int sa, int atwith
|
|||
hitscan(nx, ny, nz, sprite[sprite[ii].owner].sectnum,
|
||||
sintable[(sa + 512) & 2047],
|
||||
sintable[sa & 2047], zvel << 6,
|
||||
&hitsect, &hitwall, &hitspr, &hitx, &hity, &hitz, CLIPMASK1);
|
||||
&hitsect, &hitwall, &hitsprt, &hitx, &hity, &hitz, CLIPMASK1);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
@ -323,7 +325,7 @@ static void shootweapon(int i, int p, int sx, int sy, int sz, int sa, int atwith
|
|||
sprite[k].extra = ScriptCode[actorinfo[atwith].scriptaddress];
|
||||
sprite[k].extra += (krand() % 6);
|
||||
|
||||
if (hitwall == -1 && hitspr == -1)
|
||||
if (hitwall == -1 && hitsprt == nullptr)
|
||||
{
|
||||
if (zvel < 0)
|
||||
{
|
||||
|
@ -340,12 +342,12 @@ static void shootweapon(int i, int p, int sx, int sy, int sz, int sa, int atwith
|
|||
fi.spawn(k, SMALLSMOKE);
|
||||
}
|
||||
|
||||
if (hitspr >= 0)
|
||||
if (hitsprt)
|
||||
{
|
||||
if (sprite[hitspr].picnum == 1930)
|
||||
if (hitsprt->s.picnum == 1930)
|
||||
return;
|
||||
fi.checkhitsprite(hitspr, k);
|
||||
if (sprite[hitspr].picnum == TILE_APLAYER && (ud.coop != 1 || ud.ffire == 1))
|
||||
fi.checkhitsprite(hitsprt->GetIndex(), k);
|
||||
if (hitsprt->s.picnum == TILE_APLAYER && (ud.coop != 1 || ud.ffire == 1))
|
||||
{
|
||||
l = fi.spawn(k, JIBS6);
|
||||
sprite[k].xrepeat = sprite[k].yrepeat = 0;
|
||||
|
@ -357,17 +359,17 @@ static void shootweapon(int i, int p, int sx, int sy, int sz, int sa, int atwith
|
|||
else fi.spawn(k, SMALLSMOKE);
|
||||
|
||||
if (p >= 0 && (
|
||||
sprite[hitspr].picnum == DIPSWITCH ||
|
||||
sprite[hitspr].picnum == DIPSWITCH + 1 ||
|
||||
sprite[hitspr].picnum == DIPSWITCH2 ||
|
||||
sprite[hitspr].picnum == DIPSWITCH2 + 1 ||
|
||||
sprite[hitspr].picnum == DIPSWITCH3 ||
|
||||
sprite[hitspr].picnum == DIPSWITCH3 + 1 ||
|
||||
(isRRRA() && sprite[hitspr].picnum == RRTILE8660) ||
|
||||
sprite[hitspr].picnum == HANDSWITCH ||
|
||||
sprite[hitspr].picnum == HANDSWITCH + 1))
|
||||
hitsprt->s.picnum == DIPSWITCH ||
|
||||
hitsprt->s.picnum == DIPSWITCH + 1 ||
|
||||
hitsprt->s.picnum == DIPSWITCH2 ||
|
||||
hitsprt->s.picnum == DIPSWITCH2 + 1 ||
|
||||
hitsprt->s.picnum == DIPSWITCH3 ||
|
||||
hitsprt->s.picnum == DIPSWITCH3 + 1 ||
|
||||
(isRRRA() && hitsprt->s.picnum == RRTILE8660) ||
|
||||
hitsprt->s.picnum == HANDSWITCH ||
|
||||
hitsprt->s.picnum == HANDSWITCH + 1))
|
||||
{
|
||||
fi.checkhitswitch(p, hitspr, 1);
|
||||
fi.checkhitswitch(p, hitsprt->GetIndex(), 1);
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
@ -442,10 +444,10 @@ static void shootweapon(int i, int p, int sx, int sy, int sz, int sa, int atwith
|
|||
k = EGS(hitsect, hitx, hity, hitz, SHOTSPARK1, -15, 24, 24, sa, 0, 0, i, 4);
|
||||
sprite[k].extra = ScriptCode[actorinfo[atwith].scriptaddress];
|
||||
|
||||
if (hitspr >= 0)
|
||||
if (hitsprt)
|
||||
{
|
||||
fi.checkhitsprite(hitspr, k);
|
||||
if (sprite[hitspr].picnum != TILE_APLAYER)
|
||||
fi.checkhitsprite(hitsprt->GetIndex(), k);
|
||||
if (hitsprt->s.picnum != TILE_APLAYER)
|
||||
fi.spawn(k, SMALLSMOKE);
|
||||
else sprite[k].xrepeat = sprite[k].yrepeat = 0;
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue