- floatified position in checkhitwall

This commit is contained in:
Christoph Oelckers 2022-08-23 22:39:07 +02:00
parent 2aec324a25
commit 3d29c8f3ad
8 changed files with 41 additions and 47 deletions

View file

@ -295,7 +295,7 @@ void hitradius_d(DDukeActor* actor, int r, int hp1, int hp2, int hp3, int h
updatesector(w1, &sect);
if (sect && cansee(w1, sect, actor->spr.pos, actor->sector()))
fi.checkhitwall(actor, &wal, wal.wall_int_pos().X, wal.wall_int_pos().Y, actor->int_pos().Z, actor->spr.picnum);
fi.checkhitwall(actor, &wal, DVector3(wal.pos, actor->spr.pos.Z), actor->spr.picnum);
}
}
}
@ -1425,7 +1425,7 @@ static bool weaponhitwall(DDukeActor *proj, walltype* wal, const DVector3 &oldpo
else
{
SetActor(proj, oldpos);
fi.checkhitwall(proj, wal, proj->int_pos().X, proj->int_pos().Y, proj->int_pos().Z, proj->spr.picnum);
fi.checkhitwall(proj, wal, proj->spr.pos, proj->spr.picnum);
if (proj->spr.picnum == FREEZEBLAST)
{
@ -2513,7 +2513,7 @@ static void flamethrowerflame(DDukeActor *actor)
else if (coll.type == kHitWall)
{
SetActor(actor, dapos);
fi.checkhitwall(actor, coll.hitWall, actor->int_pos().X, actor->int_pos().Y, actor->int_pos().Z, actor->spr.picnum);
fi.checkhitwall(actor, coll.hitWall, actor->spr.pos, actor->spr.picnum);
}
else if (coll.type == kHitSector)
{
@ -2641,7 +2641,7 @@ static void heavyhbomb(DDukeActor *actor)
if (coll.type== kHitWall)
{
auto wal = coll.hitWall;
fi.checkhitwall(actor, wal, actor->int_pos().X, actor->int_pos().Y, actor->int_pos().Z, actor->spr.picnum);
fi.checkhitwall(actor, wal, actor->spr.pos, actor->spr.picnum);
int k = getangle(wal->delta());

View file

@ -253,7 +253,7 @@ void hitradius_r(DDukeActor* actor, int r, int hp1, int hp2, int hp3, int h
updatesector(w1, &sect);
if (sect && cansee(w1, sect, actor->spr.pos, actor->sector()))
fi.checkhitwall(actor, &wal, wal.wall_int_pos().X, wal.wall_int_pos().Y, actor->int_pos().Z, actor->spr.picnum);
fi.checkhitwall(actor, &wal, DVector3(wal.pos, actor->spr.pos.Z), actor->spr.picnum);
}
}
}
@ -1060,7 +1060,7 @@ static bool weaponhitwall(DDukeActor *proj, walltype* wal, const DVector3& oldpo
else
{
SetActor(proj, oldpos);
fi.checkhitwall(proj, wal, proj->int_pos().X, proj->int_pos().Y, proj->int_pos().Z, proj->spr.picnum);
fi.checkhitwall(proj, wal, proj->spr.pos, proj->spr.picnum);
if (!isRRRA() && proj->spr.picnum == FREEZEBLAST)
{
@ -2428,7 +2428,7 @@ static void heavyhbomb(DDukeActor *actor)
if (coll.type == kHitWall)
{
auto wal = coll.hitWall;
fi.checkhitwall(actor, wal, actor->int_pos().X, actor->int_pos().Y, actor->int_pos().Z, actor->spr.picnum);
fi.checkhitwall(actor, wal, actor->spr.pos, actor->spr.picnum);
int k = getangle(wal->delta());

View file

@ -47,8 +47,8 @@ bool checkhitswitch_d(int snum, walltype* w, DDukeActor *act);
bool checkhitswitch_r(int snum, walltype* w, DDukeActor* act);
void activatebysector_d(sectortype* sect, DDukeActor* j);
void activatebysector_r(sectortype* sect, DDukeActor* j);
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);
void checkhitwall_d(DDukeActor* spr, walltype* dawall, const DVector3& pos, int atwith);
void checkhitwall_r(DDukeActor* spr, walltype* dawall, const DVector3& pos, int atwith);
bool checkhitceiling_d(sectortype* sn);
bool checkhitceiling_r(sectortype* sn);
void checkhitsprite_d(DDukeActor* i, DDukeActor* sn);

View file

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

View file

@ -283,7 +283,7 @@ static void shootknee(DDukeActor* actor, int p, int sx, int sy, int sz, int sa)
if (hit.hitWall->picnum != ACCESSSWITCH && hit.hitWall->picnum != ACCESSSWITCH2)
{
fi.checkhitwall(knee, hit.hitWall, hit.int_hitpos().X, hit.int_hitpos().Y, hit.int_hitpos().Z, KNEE);
fi.checkhitwall(knee, hit.hitWall, hit.hitpos, KNEE);
if (p >= 0) fi.checkhitswitch(p, hit.hitWall, nullptr);
}
}
@ -525,7 +525,7 @@ static void shootweapon(DDukeActor *actor, int p, int sx, int sy, int sz, int sa
if (hit.hitpos.Z >= hit.hitWall->nextSector()->floorz)
hit.hitWall = hit.hitWall->nextWall();
fi.checkhitwall(spark, hit.hitWall, hit.int_hitpos().X, hit.int_hitpos().Y, hit.int_hitpos().Z, SHOTSPARK1);
fi.checkhitwall(spark, hit.hitWall, hit.hitpos, SHOTSPARK1);
}
}
else
@ -543,7 +543,7 @@ static void shootweapon(DDukeActor *actor, int p, int sx, int sy, int sz, int sa
else spark->spr.xrepeat = spark->spr.yrepeat = 0;
}
else if (hit.hitWall)
fi.checkhitwall(spark, hit.hitWall, hit.int_hitpos().X, hit.int_hitpos().Y, hit.int_hitpos().Z, SHOTSPARK1);
fi.checkhitwall(spark, hit.hitWall, hit.hitpos, SHOTSPARK1);
}
}
@ -978,7 +978,7 @@ static void shootgrowspark(DDukeActor* actor, int p, int sx, int sy, int sz, int
{
if (hit.hitWall->picnum != ACCESSSWITCH && hit.hitWall->picnum != ACCESSSWITCH2)
{
fi.checkhitwall(spark, hit.hitWall, hit.int_hitpos().X, hit.int_hitpos().Y, hit.int_hitpos().Z, GROWSPARK);
fi.checkhitwall(spark, hit.hitWall, hit.hitpos, GROWSPARK);
}
}
}

View file

@ -175,7 +175,7 @@ static void shootmelee(DDukeActor *actor, int p, int sx, int sy, int sz, int sa,
if (hit.hitWall->picnum != ACCESSSWITCH && hit.hitWall->picnum != ACCESSSWITCH2)
{
fi.checkhitwall(wpn, hit.hitWall, hit.int_hitpos().X, hit.int_hitpos().Y, hit.int_hitpos().Z, atwith);
fi.checkhitwall(wpn, hit.hitWall, hit.hitpos, atwith);
if (p >= 0) fi.checkhitswitch(p, hit.hitWall, nullptr);
}
}
@ -424,7 +424,7 @@ static void shootweapon(DDukeActor* actor, int p, int sx, int sy, int sz, int sa
if (hit.hitpos.Z >= hit.hitWall->nextSector()->floorz)
hit.hitWall = hit.hitWall->nextWall();
fi.checkhitwall(spark, hit.hitWall, hit.int_hitpos().X, hit.int_hitpos().Y, hit.int_hitpos().Z, SHOTSPARK1);
fi.checkhitwall(spark, hit.hitWall, hit.hitpos, SHOTSPARK1);
}
}
else
@ -441,7 +441,7 @@ static void shootweapon(DDukeActor* actor, int p, int sx, int sy, int sz, int sa
else spark->spr.xrepeat = spark->spr.yrepeat = 0;
}
else if (hit.hitWall != nullptr)
fi.checkhitwall(spark, hit.hitWall, hit.int_hitpos().X, hit.int_hitpos().Y, hit.int_hitpos().Z, SHOTSPARK1);
fi.checkhitwall(spark, hit.hitWall, hit.hitpos, SHOTSPARK1);
}
if ((krand() & 255) < 10)

View file

@ -640,7 +640,7 @@ void activatebysector_d(sectortype* sect, DDukeActor* activator)
//
//---------------------------------------------------------------------------
void checkhitwall_d(DDukeActor* spr, walltype* wal, int x, int y, int z, int atwith)
void checkhitwall_d(DDukeActor* spr, walltype* wal, const DVector3& pos, int atwith)
{
int j, sn = -1, darkestwall;
@ -655,7 +655,7 @@ void checkhitwall_d(DDukeActor* spr, walltype* wal, int x, int y, int z, int atw
}
if (((wal->cstat & CSTAT_WALL_MASKED) || wal->overpicnum == BIGFORCE) && wal->twoSided())
if (wal->nextSector()->int_floorz() > z)
if (wal->nextSector()->floorz> pos.Z)
if (wal->nextSector()->floorz - wal->nextSector()->ceilingz)
switch (wal->overpicnum)
{
@ -667,16 +667,16 @@ void checkhitwall_d(DDukeActor* spr, walltype* wal, int x, int y, int z, int atw
case BIGFORCE:
{
sectortype* sptr = nullptr;
updatesector(x, y, &sptr);
updatesector(pos, &sptr);
if (sptr == nullptr) return;
DDukeActor* spawned;
if (atwith == -1)
spawned = EGS(sptr, x, y, z, FORCERIPPLE, -127, 8, 8, 0, 0, 0, spr, 5);
spawned = CreateActor(sptr, pos, FORCERIPPLE, -127, 8, 8, 0, 0, 0, spr, 5);
else
{
if (atwith == CHAINGUN)
spawned = EGS(sptr, x, y, z, FORCERIPPLE, -127, 16 + spr->spr.xrepeat, 16 + spr->spr.yrepeat, 0, 0, 0, spr, 5);
else spawned = EGS(sptr, x, y, z, FORCERIPPLE, -127, 32, 32, 0, 0, 0, spr, 5);
spawned = CreateActor(sptr, pos, FORCERIPPLE, -127, 16 + spr->spr.xrepeat, 16 + spr->spr.yrepeat, 0, 0, 0, spr, 5);
else spawned = CreateActor(sptr, pos, FORCERIPPLE, -127, 32, 32, 0, 0, 0, spr, 5);
}
if (spawned)
{
@ -703,7 +703,7 @@ void checkhitwall_d(DDukeActor* spr, walltype* wal, int x, int y, int z, int atw
case GLASS:
{
sectortype* sptr = nullptr;
updatesector(x, y, &sptr);
updatesector(pos, &sptr);
if (sptr == nullptr) return;
wal->overpicnum = GLASS2;
lotsofglass(spr, wal, 10);
@ -712,7 +712,7 @@ void checkhitwall_d(DDukeActor* spr, walltype* wal, int x, int y, int z, int atw
if (wal->twoSided())
wal->nextWall()->cstat = 0;
auto spawned = EGS(sptr, x, y, z, SECTOREFFECTOR, 0, 0, 0, ps[0].angle.ang.Buildang(), 0, 0, spr, 3);
auto spawned = CreateActor(sptr, pos, SECTOREFFECTOR, 0, 0, 0, ps[0].angle.ang.Buildang(), 0, 0, spr, 3);
if (spawned)
{
spawned->spr.lotag = SE_128_GLASS_BREAKING;
@ -724,7 +724,7 @@ void checkhitwall_d(DDukeActor* spr, walltype* wal, int x, int y, int z, int atw
}
case STAINGLASS1:
sectortype* sptr = nullptr;
updatesector(x, y, &sptr);
updatesector(pos, &sptr);
if (sptr == nullptr) return;
lotsofcolourglass(spr, wal, 80);
wal->cstat = 0;
@ -921,19 +921,12 @@ void checkplayerhurt_d(player_struct* p, const Collision& coll)
p->vel.Y = -p->angle.ang.Sin() * (1 << 22);
S_PlayActorSound(DUKE_LONGTERM_PAIN, p->GetActor());
fi.checkhitwall(p->GetActor(), wal,
p->player_int_pos().X + p->angle.ang.Cos() * (1 << 5),
p->player_int_pos().Y + p->angle.ang.Sin() * (1 << 5),
p->player_int_pos().Z, -1);
fi.checkhitwall(p->GetActor(), wal, p->pos + DVector2(p->angle.ang.Cos() * 2, p->angle.ang.Sin() * 2), -1);
break;
case BIGFORCE:
p->hurt_delay = 26;
fi.checkhitwall(p->GetActor(), wal,
p->player_int_pos().X + p->angle.ang.Cos() * (1 << 5),
p->player_int_pos().Y + p->angle.ang.Sin() * (1 << 5),
p->player_int_pos().Z, -1);
fi.checkhitwall(p->GetActor(), wal, p->pos + DVector2(p->angle.ang.Cos() * 2, p->angle.ang.Sin() * 2), -1);
break;
}

View file

@ -980,10 +980,10 @@ static void lotsofpopcorn(DDukeActor *actor, walltype* wal, int n)
//
//---------------------------------------------------------------------------
void checkhitwall_r(DDukeActor* spr, walltype* wal, int x, int y, int z, int atwith)
void checkhitwall_r(DDukeActor* spr, walltype* wal, const DVector3& pos, int atwith)
{
int j;
int sn = -1, darkestwall;
int darkestwall;
if (wal->overpicnum == MIRROR && gs.actorinfo[atwith].flags2 & SFLAG2_BREAKMIRRORS)
{
@ -996,7 +996,7 @@ void checkhitwall_r(DDukeActor* spr, walltype* wal, int x, int y, int z, int atw
}
if (((wal->cstat & CSTAT_WALL_MASKED) || wal->overpicnum == BIGFORCE) && wal->twoSided())
if (wal->nextSector()->int_floorz() > z)
if (wal->nextSector()->floorz > pos.Z)
if (wal->nextSector()->floorz - wal->nextSector()->ceilingz)
switch (wal->overpicnum)
{
@ -1015,7 +1015,7 @@ void checkhitwall_r(DDukeActor* spr, walltype* wal, int x, int y, int z, int atw
case RRTILE1973:
{
sectortype* sptr = nullptr;
updatesector(x, y, &sptr);
updatesector(pos, &sptr);
if (sptr == nullptr) return;
wal->overpicnum = GLASS2;
lotsofpopcorn(spr, wal, 64);
@ -1024,7 +1024,7 @@ void checkhitwall_r(DDukeActor* spr, walltype* wal, int x, int y, int z, int atw
if (wal->twoSided())
wal->nextWall()->cstat = 0;
auto spawned = EGS(sptr, x, y, z, SECTOREFFECTOR, 0, 0, 0, ps[0].angle.ang.Buildang(), 0, 0, spr, 3);
auto spawned = CreateActor(sptr, pos, SECTOREFFECTOR, 0, 0, 0, ps[0].angle.ang.Buildang(), 0, 0, spr, 3);
if (spawned)
{
spawned->spr.lotag = SE_128_GLASS_BREAKING;
@ -1036,7 +1036,7 @@ void checkhitwall_r(DDukeActor* spr, walltype* wal, int x, int y, int z, int atw
case GLASS:
{
sectortype* sptr = nullptr;
updatesector(x, y, &sptr);
updatesector(pos, &sptr);
if (sptr == nullptr) return;
wal->overpicnum = GLASS2;
lotsofglass(spr, wal, 10);
@ -1045,7 +1045,7 @@ void checkhitwall_r(DDukeActor* spr, walltype* wal, int x, int y, int z, int atw
if (wal->twoSided())
wal->nextWall()->cstat = 0;
auto spawned = EGS(sptr, x, y, z, SECTOREFFECTOR, 0, 0, 0, ps[0].angle.ang.Buildang(), 0, 0, spr, 3);
auto spawned = CreateActor(sptr, pos, SECTOREFFECTOR, 0, 0, 0, ps[0].angle.ang.Buildang(), 0, 0, spr, 3);
if (spawned)
{
spawned->spr.lotag = SE_128_GLASS_BREAKING;
@ -1056,7 +1056,10 @@ void checkhitwall_r(DDukeActor* spr, walltype* wal, int x, int y, int z, int atw
return;
}
case STAINGLASS1:
updatesector(x, y, &sn); if (sn < 0) return;
{
sectortype* sptr = nullptr;
updatesector(pos, &sptr);
if (sptr == nullptr) return;
lotsofcolourglass(spr, wal, 80);
wal->cstat = 0;
if (wal->twoSided())
@ -1065,6 +1068,7 @@ void checkhitwall_r(DDukeActor* spr, walltype* wal, int x, int y, int z, int atw
S_PlayActorSound(GLASS_BREAKING, spr);
return;
}
}
switch (wal->picnum)
{
@ -1408,10 +1412,7 @@ void checkplayerhurt_r(player_struct* p, const Collision &coll)
{
case BIGFORCE:
p->hurt_delay = 26;
fi.checkhitwall(p->GetActor(), wal,
p->player_int_pos().X + p->angle.ang.Cos() * (1 << 5),
p->player_int_pos().Y + p->angle.ang.Sin() * (1 << 5),
p->player_int_pos().Z, -1);
fi.checkhitwall(p->GetActor(), wal, p->pos + DVector2(p->angle.ang.Cos() * 2, p->angle.ang.Sin() * 2), -1);
break;
}