- change wall parameter of checkhitwall.

This commit is contained in:
Christoph Oelckers 2021-11-17 23:49:49 +01:00
parent c410b1be45
commit 09e75ddca2
8 changed files with 55 additions and 57 deletions

View file

@ -379,7 +379,7 @@ void hitradius_d(DDukeActor* actor, int r, int hp1, int hp2, int hp3, int h
int sect;
updatesector(x1, y1, &sect);
if (sect >= 0 && cansee(x1, y1, spri->z, sect, spri->x, spri->y, spri->z, spri->sectnum))
fi.checkhitwall(actor, wallnum(&wal), wal.x, wal.y, spri->z, spri->picnum);
fi.checkhitwall(actor, &wal, wal.x, wal.y, spri->z, spri->picnum);
}
}
}
@ -1658,7 +1658,7 @@ static bool weaponhitwall(DDukeActor *proj, walltype* wal, const vec3_t &oldpos)
else
{
setsprite(proj, oldpos);
fi.checkhitwall(proj, wallnum(wal), s->x, s->y, s->z, s->picnum);
fi.checkhitwall(proj, wal, s->x, s->y, s->z, s->picnum);
if (s->picnum == FREEZEBLAST)
{
@ -2765,7 +2765,7 @@ static void flamethrowerflame(DDukeActor *actor)
else if (coll.type == kHitWall)
{
setsprite(actor, dax, day, daz);
fi.checkhitwall(actor, coll.index, s->x, s->y, s->z, s->picnum);
fi.checkhitwall(actor, coll.wall(), s->x, s->y, s->z, s->picnum);
}
else if (coll.type == kHitSector)
{
@ -2895,7 +2895,7 @@ static void heavyhbomb(DDukeActor *actor)
if (coll.type== kHitWall)
{
auto wal = coll.wall();
fi.checkhitwall(actor, wallnum(wal), s->x, s->y, s->z, s->picnum);
fi.checkhitwall(actor, wal, s->x, s->y, s->z, s->picnum);
auto delta = wal->delta();
int k = getangle(delta.x, delta.y);

View file

@ -257,7 +257,7 @@ void hitradius_r(DDukeActor* actor, int r, int hp1, int hp2, int hp3, int h
int sect;
updatesector(x1, y1, &sect);
if (sect >= 0 && cansee(x1, y1, spri->z, sect, spri->x, spri->y, spri->z, spri->sectnum))
fi.checkhitwall(actor, wallnum(&wal), wal.x, wal.y, spri->z, spri->picnum);
fi.checkhitwall(actor, &wal, wal.x, wal.y, spri->z, spri->picnum);
}
}
}
@ -1225,7 +1225,7 @@ static bool weaponhitwall(DDukeActor *proj, walltype* wal, const vec3_t& oldpos)
else
{
setsprite(proj, oldpos);
fi.checkhitwall(proj, wallnum(wal), s->x, s->y, s->z, s->picnum);
fi.checkhitwall(proj, wal, s->x, s->y, s->z, s->picnum);
if (!isRRRA() && s->picnum == FREEZEBLAST)
{
@ -2611,7 +2611,7 @@ static void heavyhbomb(DDukeActor *actor)
if (coll.type == kHitWall)
{
auto wal = coll.wall();
fi.checkhitwall(actor, wallnum(wal), s->x, s->y, s->z, s->picnum);
fi.checkhitwall(actor, wal, s->x, s->y, s->z, s->picnum);
auto delta = wal->delta();
int k = getangle(delta.x, delta.y);

View file

@ -47,8 +47,8 @@ bool checkhitswitch_d(int snum, int w, DDukeActor *act);
bool checkhitswitch_r(int snum, int w, DDukeActor* act);
void activatebysector_d(int sect, DDukeActor* j);
void activatebysector_r(int sect, DDukeActor* j);
void checkhitwall_d(DDukeActor* spr, int dawallnum, int x, int y, int z, int atwith);
void checkhitwall_r(DDukeActor* spr, int dawallnum, int x, int y, int z, int atwith);
void checkhitwall_d(DDukeActor* spr, walltype* dawall, int x, int y, int z, int atwith);
void checkhitwall_r(DDukeActor* spr, walltype* dawall, int x, int y, int z, int atwith);
bool checkhitceiling_d(int sn);
bool checkhitceiling_r(int sn);
void checkhitsprite_d(DDukeActor* i, DDukeActor* sn);

View file

@ -84,7 +84,7 @@ struct Dispatcher
void (*operateforcefields)(DDukeActor* act, int low);
bool (*checkhitswitch)(int snum, int w, DDukeActor* act);
void (*activatebysector)(int sect, DDukeActor* j);
void (*checkhitwall)(DDukeActor* spr, int dawallnum, int x, int y, int z, int atwith);
void (*checkhitwall)(DDukeActor* spr, walltype* dawall, int x, int y, int z, int atwith);
bool (*checkhitceiling)(int sn);
void (*checkhitsprite)(DDukeActor* i, DDukeActor* sn);
void (*checksectors)(int low);

View file

@ -290,7 +290,7 @@ static void shootknee(DDukeActor* actor, int p, int sx, int sy, int sz, int sa)
if (wal->picnum != ACCESSSWITCH && wal->picnum != ACCESSSWITCH2)
{
fi.checkhitwall(knee, wallnum(wal), hitx, hity, hitz, KNEE);
fi.checkhitwall(knee, wal, hitx, hity, hitz, KNEE);
if (p >= 0) fi.checkhitswitch(p, wallnum(wal), nullptr);
}
}
@ -526,9 +526,9 @@ static void shootweapon(DDukeActor *actor, int p, int sx, int sy, int sz, int sa
if (wal->cstat & 2)
if (wal->nextsector >= 0)
if (hitz >= (wal->nextSector()->floorz))
hitwall = wal->nextwall;
wal = wal->nextWall();
fi.checkhitwall(spark, hitwall, hitx, hity, hitz, SHOTSPARK1);
fi.checkhitwall(spark, wal, hitx, hity, hitz, SHOTSPARK1);
}
}
else
@ -544,7 +544,7 @@ static void shootweapon(DDukeActor *actor, int p, int sx, int sy, int sz, int sa
else spark->s->xrepeat = spark->s->yrepeat = 0;
}
else if (hitwall >= 0)
fi.checkhitwall(spark, hitwall, hitx, hity, hitz, SHOTSPARK1);
fi.checkhitwall(spark, &wall[hitwall], hitx, hity, hitz, SHOTSPARK1);
}
if ((krand() & 255) < 4)
@ -985,9 +985,13 @@ static void shootgrowspark(DDukeActor* actor, int p, int sx, int sy, int sz, int
fi.checkhitceiling(hitsect);
}
else if (hitsprt != nullptr) fi.checkhitsprite(hitsprt, spark);
else if (hitwall >= 0 && wall[hitwall].picnum != ACCESSSWITCH && wall[hitwall].picnum != ACCESSSWITCH2)
else if (hitwall >= 0)
{
fi.checkhitwall(spark, hitwall, hitx, hity, hitz, GROWSPARK);
auto wal = &wall[hitwall];
if (wal->picnum != ACCESSSWITCH && wal->picnum != ACCESSSWITCH2)
{
fi.checkhitwall(spark, wal, hitx, hity, hitz, GROWSPARK);
}
}
}

View file

@ -182,7 +182,7 @@ static void shootmelee(DDukeActor *actor, int p, int sx, int sy, int sz, int sa,
if (/*hitwall >= 0 &&*/ wal->picnum != ACCESSSWITCH && wal->picnum != ACCESSSWITCH2)
{
fi.checkhitwall(wpn, wallnum(wal), hitx, hity, hitz, atwith);
fi.checkhitwall(wpn, wal, hitx, hity, hitz, atwith);
if (p >= 0) fi.checkhitswitch(p, wallnum(wal), nullptr);
}
}
@ -426,9 +426,9 @@ static void shootweapon(DDukeActor* actor, int p, int sx, int sy, int sz, int sa
if (wal->cstat & 2)
if (wal->nextsector >= 0)
if (hitz >= (wal->nextSector()->floorz))
hitwall = wal->nextwall;
wal = wal->nextWall();
fi.checkhitwall(spark, hitwall, hitx, hity, hitz, SHOTSPARK1);
fi.checkhitwall(spark, wal, hitx, hity, hitz, SHOTSPARK1);
}
}
else
@ -444,7 +444,7 @@ static void shootweapon(DDukeActor* actor, int p, int sx, int sy, int sz, int sa
else spark->s->xrepeat = spark->s->yrepeat = 0;
}
else if (hitwall >= 0)
fi.checkhitwall(spark, hitwall, hitx, hity, hitz, SHOTSPARK1);
fi.checkhitwall(spark, &wall[hitwall], hitx, hity, hitz, SHOTSPARK1);
}
if ((krand() & 255) < 10)

View file

@ -640,12 +640,9 @@ void activatebysector_d(int sect, DDukeActor* activator)
//
//---------------------------------------------------------------------------
void checkhitwall_d(DDukeActor* spr, int dawallnum, int x, int y, int z, int atwith)
void checkhitwall_d(DDukeActor* spr, walltype* wal, int x, int y, int z, int atwith)
{
int j, sn = -1, darkestwall;
walltype* wal;
wal = &wall[dawallnum];
if (wal->overpicnum == MIRROR)
{
@ -658,7 +655,7 @@ void checkhitwall_d(DDukeActor* spr, int dawallnum, int x, int y, int z, int atw
case SEENINE:
case OOZFILTER:
case EXPLODINGBARREL:
lotsofglass(spr, dawallnum, 70);
lotsofglass(spr, wallnum(wal), 70);
wal->cstat &= ~16;
wal->overpicnum = MIRRORBROKE;
wal->portalflags = 0;
@ -715,7 +712,7 @@ void checkhitwall_d(DDukeActor* spr, int dawallnum, int x, int y, int z, int atw
{
updatesector(x, y, &sn); if (sn < 0) return;
wal->overpicnum = GLASS2;
lotsofglass(spr, dawallnum, 10);
lotsofglass(spr, wallnum(wal), 10);
wal->cstat = 0;
if (wal->nextwall >= 0)
@ -730,7 +727,7 @@ void checkhitwall_d(DDukeActor* spr, int dawallnum, int x, int y, int z, int atw
}
case STAINGLASS1:
updatesector(x, y, &sn); if (sn < 0) return;
lotsofcolourglass(spr, dawallnum, 80);
lotsofcolourglass(spr, wallnum(wal), 80);
wal->cstat = 0;
if (wal->nextwall >= 0)
wal->nextWall()->cstat = 0;
@ -743,7 +740,7 @@ void checkhitwall_d(DDukeActor* spr, int dawallnum, int x, int y, int z, int atw
{
case COLAMACHINE:
case VENDMACHINE:
breakwall(wal->picnum + 2, spr, dawallnum);
breakwall(wal->picnum + 2, spr, wallnum(wal));
S_PlayActorSound(VENT_BUST, spr);
return;
@ -774,7 +771,7 @@ void checkhitwall_d(DDukeActor* spr, int dawallnum, int x, int y, int z, int atw
case SCREENBREAK19:
case BORNTOBEWILDSCREEN:
lotsofglass(spr, dawallnum, 30);
lotsofglass(spr, wallnum(wal), 30);
wal->picnum = W_SCREENBREAK + (krand() % 3);
S_PlayActorSound(GLASS_HEAVYBREAK, spr);
return;
@ -784,14 +781,14 @@ void checkhitwall_d(DDukeActor* spr, int dawallnum, int x, int y, int z, int atw
case W_TECHWALL7:
case W_TECHWALL8:
case W_TECHWALL9:
breakwall(wal->picnum + 1, spr, dawallnum);
breakwall(wal->picnum + 1, spr, wallnum(wal));
return;
case W_MILKSHELF:
breakwall(W_MILKSHELFBROKE, spr, dawallnum);
breakwall(W_MILKSHELFBROKE, spr, wallnum(wal));
return;
case W_TECHWALL10:
breakwall(W_HITTECHWALL10, spr, dawallnum);
breakwall(W_HITTECHWALL10, spr, wallnum(wal));
return;
case W_TECHWALL1:
@ -799,27 +796,27 @@ void checkhitwall_d(DDukeActor* spr, int dawallnum, int x, int y, int z, int atw
case W_TECHWALL12:
case W_TECHWALL13:
case W_TECHWALL14:
breakwall(W_HITTECHWALL1, spr, dawallnum);
breakwall(W_HITTECHWALL1, spr, wallnum(wal));
return;
case W_TECHWALL15:
breakwall(W_HITTECHWALL15, spr, dawallnum);
breakwall(W_HITTECHWALL15, spr, wallnum(wal));
return;
case W_TECHWALL16:
breakwall(W_HITTECHWALL16, spr, dawallnum);
breakwall(W_HITTECHWALL16, spr, wallnum(wal));
return;
case W_TECHWALL2:
breakwall(W_HITTECHWALL2, spr, dawallnum);
breakwall(W_HITTECHWALL2, spr, wallnum(wal));
return;
case W_TECHWALL3:
breakwall(W_HITTECHWALL3, spr, dawallnum);
breakwall(W_HITTECHWALL3, spr, wallnum(wal));
return;
case W_TECHWALL4:
breakwall(W_HITTECHWALL4, spr, dawallnum);
breakwall(W_HITTECHWALL4, spr, wallnum(wal));
return;
case ATM:
@ -838,7 +835,7 @@ void checkhitwall_d(DDukeActor* spr, int dawallnum, int x, int y, int z, int atw
if (rnd(128))
S_PlayActorSound(GLASS_HEAVYBREAK, spr);
else S_PlayActorSound(GLASS_BREAKING, spr);
lotsofglass(spr, dawallnum, 30);
lotsofglass(spr, wallnum(wal), 30);
if (wal->picnum == WALLLIGHT1)
wal->picnum = WALLLIGHTBUST1;
@ -873,7 +870,7 @@ void checkhitwall_d(DDukeActor* spr, int dawallnum, int x, int y, int z, int atw
DukeStatIterator it(STAT_EFFECTOR);
while (auto effector = it.Next())
{
if (effector->s->hitag == wall[dawallnum].lotag && effector->s->lotag == 3)
if (effector->s->hitag == wal->lotag && effector->s->lotag == 3)
{
effector->temp_data[2] = j;
effector->temp_data[3] = darkestwall;
@ -927,7 +924,7 @@ void checkplayerhurt_d(struct player_struct* p, const Collision& coll)
p->posyv = -p->angle.ang.bsin(8);
S_PlayActorSound(DUKE_LONGTERM_PAIN, p->GetActor());
fi.checkhitwall(p->GetActor(), wallnum(wal),
fi.checkhitwall(p->GetActor(), wal,
p->pos.x + p->angle.ang.bcos(-9),
p->pos.y + p->angle.ang.bsin(-9),
p->pos.z, -1);
@ -936,7 +933,7 @@ void checkplayerhurt_d(struct player_struct* p, const Collision& coll)
case BIGFORCE:
p->hurt_delay = 26;
fi.checkhitwall(p->GetActor(), wallnum(wal),
fi.checkhitwall(p->GetActor(), wal,
p->pos.x + p->angle.ang.bcos(-9),
p->pos.y + p->angle.ang.bsin(-9),
p->pos.z, -1);

View file

@ -980,15 +980,12 @@ static void lotsofpopcorn(DDukeActor *actor, int wallnum, int n)
//
//---------------------------------------------------------------------------
void checkhitwall_r(DDukeActor* spr, int dawallnum, int x, int y, int z, int atwith)
void checkhitwall_r(DDukeActor* spr, walltype* wal, int x, int y, int z, int atwith)
{
int j, i;
int sn = -1, darkestwall;
walltype* wal;
spritetype* s;
wal = &wall[dawallnum];
if (wal->overpicnum == MIRROR)
{
switch (atwith)
@ -1003,7 +1000,7 @@ void checkhitwall_r(DDukeActor* spr, int dawallnum, int x, int y, int z, int atw
case SEENINE:
case OOZFILTER:
case EXPLODINGBARREL:
lotsofglass(spr, dawallnum, 70);
lotsofglass(spr, wallnum(wal), 70);
wal->cstat &= ~16;
wal->overpicnum = MIRRORBROKE;
wal->portalflags = 0;
@ -1033,7 +1030,7 @@ void checkhitwall_r(DDukeActor* spr, int dawallnum, int x, int y, int z, int atw
{
updatesector(x, y, &sn); if (sn < 0) return;
wal->overpicnum = GLASS2;
lotsofpopcorn(spr, dawallnum, 64);
lotsofpopcorn(spr, wallnum(wal), 64);
wal->cstat = 0;
if (wal->nextwall >= 0)
@ -1050,7 +1047,7 @@ void checkhitwall_r(DDukeActor* spr, int dawallnum, int x, int y, int z, int atw
{
updatesector(x, y, &sn); if (sn < 0) return;
wal->overpicnum = GLASS2;
lotsofglass(spr, dawallnum, 10);
lotsofglass(spr, wallnum(wal), 10);
wal->cstat = 0;
if (wal->nextwall >= 0)
@ -1065,7 +1062,7 @@ void checkhitwall_r(DDukeActor* spr, int dawallnum, int x, int y, int z, int atw
}
case STAINGLASS1:
updatesector(x, y, &sn); if (sn < 0) return;
lotsofcolourglass(spr, dawallnum, 80);
lotsofcolourglass(spr, wallnum(wal), 80);
wal->cstat = 0;
if (wal->nextwall >= 0)
wal->nextWall()->cstat = 0;
@ -1245,7 +1242,7 @@ void checkhitwall_r(DDukeActor* spr, int dawallnum, int x, int y, int z, int atw
case COLAMACHINE:
case VENDMACHINE:
breakwall(wal->picnum + 2, spr, dawallnum);
breakwall(wal->picnum + 2, spr, wallnum(wal));
S_PlayActorSound(GLASS_BREAKING, spr);
return;
@ -1255,7 +1252,7 @@ void checkhitwall_r(DDukeActor* spr, int dawallnum, int x, int y, int z, int atw
case SCREENBREAK7:
case SCREENBREAK8:
lotsofglass(spr, dawallnum, 30);
lotsofglass(spr, wallnum(wal), 30);
wal->picnum = W_SCREENBREAK + (krand() % (isRRRA() ? 2 : 3));
S_PlayActorSound(GLASS_HEAVYBREAK, spr);
return;
@ -1289,7 +1286,7 @@ void checkhitwall_r(DDukeActor* spr, int dawallnum, int x, int y, int z, int atw
if (rnd(128))
S_PlayActorSound(GLASS_HEAVYBREAK, spr);
else S_PlayActorSound(GLASS_BREAKING, spr);
lotsofglass(spr, dawallnum, 30);
lotsofglass(spr, wallnum(wal), 30);
if (wal->picnum == RRTILE1814)
wal->picnum = RRTILE1817;
@ -1363,7 +1360,7 @@ void checkhitwall_r(DDukeActor* spr, int dawallnum, int x, int y, int z, int atw
DukeStatIterator it(STAT_EFFECTOR);
while (auto act = it.Next())
{
if (act->s->hitag == wall[dawallnum].lotag && act->s->lotag == 3)
if (act->s->hitag == wal->lotag && act->s->lotag == 3)
{
act->temp_data[2] = j;
act->temp_data[3] = darkestwall;
@ -1415,14 +1412,14 @@ void checkplayerhurt_r(struct player_struct* p, const Collision &coll)
}
if (coll.type != kHitWall) return;
int j = coll.index;
auto wal = coll.wall();
if (p->hurt_delay > 0) p->hurt_delay--;
else if (wall[j].cstat & 85) switch (wall[j].overpicnum)
else if (wal->cstat & 85) switch (wal->overpicnum)
{
case BIGFORCE:
p->hurt_delay = 26;
fi.checkhitwall(p->GetActor(), j,
fi.checkhitwall(p->GetActor(), wal,
p->pos.x + p->angle.ang.bcos(-9),
p->pos.y + p->angle.ang.bsin(-9),
p->pos.z, -1);