- wall[] in shootknee, shootweapon and shootlaser.

This commit is contained in:
Christoph Oelckers 2021-11-17 22:46:50 +01:00
parent 81894fd831
commit e88047fc45

View file

@ -282,15 +282,16 @@ static void shootknee(DDukeActor* actor, int p, int sx, int sy, int sz, int sa)
else if (hitwall >= 0)
{
if (wall[hitwall].cstat & 2)
if (wall[hitwall].nextsector >= 0)
if (hitz >= (sector[wall[hitwall].nextsector].floorz))
hitwall = wall[hitwall].nextwall;
auto wal = &wall[hitwall];
if (wal->cstat & 2)
if (wal->nextsector >= 0)
if (hitz >= (wal->nextSector()->floorz))
wal =wal->nextWall();
if (hitwall >= 0 && wall[hitwall].picnum != ACCESSSWITCH && wall[hitwall].picnum != ACCESSSWITCH2)
if (/*hitwall >= 0 &&*/ wal->picnum != ACCESSSWITCH && wal->picnum != ACCESSSWITCH2)
{
fi.checkhitwall(knee, hitwall, hitx, hity, hitz, KNEE);
if (p >= 0) fi.checkhitswitch(p, hitwall, nullptr);
fi.checkhitwall(knee, wallnum(wal), hitx, hity, hitz, KNEE);
if (p >= 0) fi.checkhitswitch(p, wallnum(wal), nullptr);
}
}
}
@ -515,8 +516,8 @@ static void shootweapon(DDukeActor *actor, int p, int sx, int sy, int sz, int sa
}
auto hole = spawn(spark, BULLETHOLE);
hole->s->xvel = -1;
hole->s->ang = getangle(wal->x - wall[wal->point2].x,
wal->y - wall[wal->point2].y) + 512;
auto delta = wal->delta();
hole->s->ang = getangle(-delta.x, -delta.y) + 512;
ssp(hole, CLIPMASK0);
}
@ -858,11 +859,13 @@ static void shootlaser(DDukeActor* actor, int p, int sx, int sy, int sz, int sa)
if (hitsprt) return;
if (hitwall >= 0 && hitsect >= 0)
{
auto wal = &wall[hitwall];
if (((hitx - sx) * (hitx - sx) + (hity - sy) * (hity - sy)) < (290 * 290))
{
if (wall[hitwall].nextsector >= 0)
if (wal->nextsector >= 0)
{
if (sector[wall[hitwall].nextsector].lotag <= 2 && sector[hitsect].lotag <= 2)
if (wal->nextSector()->lotag <= 2 && sector[hitsect].lotag <= 2)
j = 1;
}
else if (sector[hitsect].lotag <= 2)
@ -894,11 +897,13 @@ static void shootlaser(DDukeActor* actor, int p, int sx, int sy, int sz, int sa)
bomb->s->xvel = -20;
ssp(bomb, CLIPMASK0);
bomb->s->cstat = 16;
bomb->temp_data[5] = bomb->s->ang = getangle(wall[hitwall].x - wall[wall[hitwall].point2].x, wall[hitwall].y - wall[wall[hitwall].point2].y) - 512;
auto delta = wal->delta();
bomb->temp_data[5] = bomb->s->ang = getangle(-delta.x, -delta.y) - 512;
if (p >= 0)
ps[p].ammo_amount[TRIPBOMB_WEAPON]--;
}
}
}
//---------------------------------------------------------------------------