- checkhitceiling + ceilingglass are sector[] free.

This commit is contained in:
Christoph Oelckers 2021-11-18 17:55:08 +01:00
parent 747fc11eb7
commit 3d05020f4c
10 changed files with 25 additions and 26 deletions

View file

@ -355,13 +355,13 @@ void hitradius_d(DDukeActor* actor, int r, int hp1, int hp2, int hp3, int h
auto wal = dasectp->firstWall();
int d = abs(wal->x - spri->x) + abs(wal->y - spri->y);
if (d < r)
fi.checkhitceiling(dasect);
fi.checkhitceiling(dasectp);
else
{
auto thirdpoint = wal->point2Wall()->point2Wall();
d = abs(thirdpoint->x - spri->x) + abs(thirdpoint->y - spri->y);
if (d < r)
fi.checkhitceiling(dasect);
fi.checkhitceiling(dasectp);
}
}
@ -1697,7 +1697,7 @@ static bool weaponhitsector(DDukeActor* proj, const vec3_t& oldpos, bool firebal
return true;
}
fi.checkhitceiling(s->sectnum);
fi.checkhitceiling(s->sector());
}
else if (fireball)
{
@ -2771,7 +2771,7 @@ static void flamethrowerflame(DDukeActor *actor)
{
setsprite(actor, dax, day, daz);
if (s->zvel < 0)
fi.checkhitceiling(s->sectnum);
fi.checkhitceiling(s->sector());
}
if (s->xrepeat >= 10)

View file

@ -233,13 +233,13 @@ void hitradius_r(DDukeActor* actor, int r, int hp1, int hp2, int hp3, int h
auto wal = dasectp->firstWall();
int d = abs(wal->x - spri->x) + abs(wal->y - spri->y);
if (d < r)
fi.checkhitceiling(dasect);
fi.checkhitceiling(dasectp);
else
{
auto thirdpoint = wal->point2Wall()->point2Wall();
d = abs(thirdpoint->x - spri->x) + abs(thirdpoint->y - spri->y);
if (d < r)
fi.checkhitceiling(dasect);
fi.checkhitceiling(dasectp);
}
}
@ -1310,7 +1310,7 @@ bool weaponhitsector(DDukeActor *proj, const vec3_t& oldpos)
return true;
}
fi.checkhitceiling(s->sectnum);
fi.checkhitceiling(s->sector());
}
if (!isRRRA() && s->picnum == FREEZEBLAST)

View file

@ -49,8 +49,8 @@ void activatebysector_d(int sect, DDukeActor* j);
void activatebysector_r(int 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);
bool checkhitceiling_d(int sn);
bool checkhitceiling_r(int sn);
bool checkhitceiling_d(sectortype* sn);
bool checkhitceiling_r(sectortype* sn);
void checkhitsprite_d(DDukeActor* i, DDukeActor* sn);
void checkhitsprite_r(DDukeActor* i, DDukeActor* sn);
void checksectors_d(int snum);

View file

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

View file

@ -170,7 +170,8 @@ void getglobalz(DDukeActor* s);
void OnEvent(int id, int pnum = -1, DDukeActor* snum = nullptr, int dist = -1);
DDukeActor* EGS(int whatsect, int s_x, int s_y, int s_z, int s_pn, int8_t s_s, int8_t s_xr, int8_t s_yr, int s_a, int s_ve, int s_zv, DDukeActor* s_ow, int8_t s_ss);
void ceilingglass(DDukeActor* snum, int sectnum, int cnt);
void ceilingglass(DDukeActor* snum, sectortype* sectnum, int cnt);
void spriteglass(DDukeActor* snum, int cnt);
void lotsofcolourglass(DDukeActor* snum, walltype* wallNum, int cnt);
void lotsofglass(DDukeActor* snum, walltype* wallnum, int cnt);

View file

@ -436,7 +436,7 @@ static void shootweapon(DDukeActor *actor, int p, int sx, int sy, int sz, int sa
return;
}
else
fi.checkhitceiling(sectnum(hitsectp));
fi.checkhitceiling(hitsectp);
}
spawn(spark, SMALLSMOKE);
}
@ -987,7 +987,7 @@ static void shootgrowspark(DDukeActor* actor, int p, int sx, int sy, int sz, int
if (wal == nullptr && hitsprt == nullptr && hitsectp != nullptr)
{
if (zvel < 0 && (hitsectp->ceilingstat & 1) == 0)
fi.checkhitceiling(sectnum(hitsectp));
fi.checkhitceiling(hitsectp);
}
else if (hitsprt != nullptr) fi.checkhitsprite(hitsprt, spark);
else if (wal != nullptr)

View file

@ -326,7 +326,7 @@ static void shootweapon(DDukeActor* actor, int p, int sx, int sy, int sz, int sa
return;
}
else
fi.checkhitceiling(sectnum(hitsectp));
fi.checkhitceiling(hitsectp);
}
if (hitsectp->lotag != 1)
spawn(spark, SMALLSMOKE);

View file

@ -944,9 +944,8 @@ void checkplayerhurt_d(struct player_struct* p, const Collision& coll)
//
//---------------------------------------------------------------------------
bool checkhitceiling_d(int sn)
bool checkhitceiling_d(sectortype* sectp)
{
auto sectp = &sector[sn];
int j;
switch (sectp->ceilingpicnum)
@ -958,7 +957,7 @@ bool checkhitceiling_d(int sn)
case TECHLIGHT2:
case TECHLIGHT4:
ceilingglass(ps[myconnectindex].GetActor(), sn, 10);
ceilingglass(ps[myconnectindex].GetActor(), sectp, 10);
S_PlayActorSound(GLASS_BREAKING, ps[screenpeek].GetActor());
if (sectp->ceilingpicnum == WALLLIGHT1)
@ -982,7 +981,7 @@ bool checkhitceiling_d(int sn)
if (!sectp->hitag)
{
DukeSectIterator it(sn);
DukeSectIterator it(sectp);
while (auto act = it.Next())
{
if (act->s->picnum == SECTOREFFECTOR && act->s->lotag == 12)

View file

@ -1428,9 +1428,8 @@ void checkplayerhurt_r(struct player_struct* p, const Collision &coll)
//
//---------------------------------------------------------------------------
bool checkhitceiling_r(int sn)
bool checkhitceiling_r(sectortype* sectp)
{
auto sectp = &sector[sn];
int j;
switch (sectp->ceilingpicnum)
@ -1449,7 +1448,7 @@ bool checkhitceiling_r(int sn)
case RRTILE2898:
ceilingglass(ps[myconnectindex].GetActor(), sn, 10);
ceilingglass(ps[myconnectindex].GetActor(), sectp, 10);
S_PlayActorSound(GLASS_BREAKING, ps[screenpeek].GetActor());
if (sectp->ceilingpicnum == WALLLIGHT1)
@ -1491,7 +1490,7 @@ bool checkhitceiling_r(int sn)
if (!sectp->hitag)
{
DukeSectIterator it(sn);
DukeSectIterator it(sectp);
while (auto act1 = it.Next())
{
auto spr1 = act1->s;

View file

@ -1148,12 +1148,12 @@ void spriteglass(DDukeActor* actor, int n)
//
//---------------------------------------------------------------------------
void ceilingglass(DDukeActor* actor, int sectnum, int n)
void ceilingglass(DDukeActor* actor, sectortype* sectp, int n)
{
int j, z;
int a;
for (auto& wal : wallsofsector(sectnum))
for (auto& wal : wallsofsector(sectp))
{
int x1 = wal.x;
int y1 = wal.y;
@ -1165,8 +1165,8 @@ void ceilingglass(DDukeActor* actor, int sectnum, int n)
x1 += delta.x;
y1 += delta.y;
a = krand() & 2047;
z = sector[sectnum].ceilingz + ((krand() & 15) << 8);
EGS(sectnum, x1, y1, z, TILE_GLASSPIECES + (j % 3), -32, 36, 36, a, (krand() & 31), 0, actor, 5);
z = sectp->ceilingz + ((krand() & 15) << 8);
EGS(sectnum(sectp), x1, y1, z, TILE_GLASSPIECES + (j % 3), -32, 36, 36, a, (krand() & 31), 0, actor, 5);
}
}
}