mirror of
https://github.com/DrBeef/Raze.git
synced 2025-02-01 05:20:43 +00:00
- Exhumed: wall stuff in AddFlash
This commit is contained in:
parent
c31d8a93fd
commit
7b1345d3e5
2 changed files with 15 additions and 21 deletions
|
@ -140,6 +140,7 @@ struct walltype
|
||||||
walltype* nextWall() const;
|
walltype* nextWall() const;
|
||||||
walltype* point2Wall() const;
|
walltype* point2Wall() const;
|
||||||
vec2_t delta() const { return point2Wall()->pos - pos; }
|
vec2_t delta() const { return point2Wall()->pos - pos; }
|
||||||
|
vec2_t center() const { return(point2Wall()->pos + pos) / 2; }
|
||||||
int deltax() const { return point2Wall()->x - x; }
|
int deltax() const { return point2Wall()->x - x; }
|
||||||
int deltay() const { return point2Wall()->y - y; }
|
int deltay() const { return point2Wall()->y - y; }
|
||||||
bool twoSided() const { return nextsector >= 0; }
|
bool twoSided() const { return nextsector >= 0; }
|
||||||
|
|
|
@ -231,33 +231,26 @@ void AddFlash(int nSector, int x, int y, int z, int val)
|
||||||
|
|
||||||
int var_14 = 0;
|
int var_14 = 0;
|
||||||
|
|
||||||
int startwall = sectp->wallptr;
|
for (auto& wal : wallsofsector(sectp))
|
||||||
int endwall = sectp->wallptr + sectp->wallnum;
|
|
||||||
|
|
||||||
for (int i = startwall; i < endwall; i++)
|
|
||||||
{
|
{
|
||||||
short wall2 = wall[i].point2;
|
auto average = wal.center();
|
||||||
|
|
||||||
int xAverage = (wall[i].x + wall[wall2].x) / 2;
|
|
||||||
int yAverage = (wall[i].y + wall[wall2].y) / 2;
|
|
||||||
|
|
||||||
sectortype *pNextSector = NULL;
|
sectortype *pNextSector = NULL;
|
||||||
if (wall[i].nextsector > -1) {
|
if (wal.nextsector > -1)
|
||||||
pNextSector = §or[wall[i].nextsector];
|
pNextSector = wal.nextSector();
|
||||||
}
|
|
||||||
|
|
||||||
int ebx = -255;
|
int ebx = -255;
|
||||||
|
|
||||||
if (!var_18)
|
if (!var_18)
|
||||||
{
|
{
|
||||||
int x2 = x - xAverage;
|
int x2 = x - average.x;
|
||||||
if (x2 < 0) {
|
if (x2 < 0) {
|
||||||
x2 = -x2;
|
x2 = -x2;
|
||||||
}
|
}
|
||||||
|
|
||||||
ebx = x2;
|
ebx = x2;
|
||||||
|
|
||||||
int y2 = y - yAverage;
|
int y2 = y - average.y;
|
||||||
if (y2 < 0) {
|
if (y2 < 0) {
|
||||||
y2 = -y2;
|
y2 = -y2;
|
||||||
}
|
}
|
||||||
|
@ -270,7 +263,7 @@ void AddFlash(int nSector, int x, int y, int z, int val)
|
||||||
var_14++;
|
var_14++;
|
||||||
var_28 += ebx;
|
var_28 += ebx;
|
||||||
|
|
||||||
if (wall[i].pal < 5)
|
if (wal.pal < 5)
|
||||||
{
|
{
|
||||||
if (!pNextSector || pNextSector->floorz < sectp->floorz)
|
if (!pNextSector || pNextSector->floorz < sectp->floorz)
|
||||||
{
|
{
|
||||||
|
@ -280,23 +273,23 @@ void AddFlash(int nSector, int x, int y, int z, int val)
|
||||||
}
|
}
|
||||||
|
|
||||||
sFlash[nFlash].nType = var_20 | 2;
|
sFlash[nFlash].nType = var_20 | 2;
|
||||||
sFlash[nFlash].shade = wall[i].shade;
|
sFlash[nFlash].shade = wal.shade;
|
||||||
sFlash[nFlash].nIndex = i;
|
sFlash[nFlash].nIndex = wallnum(&wal);
|
||||||
|
|
||||||
wall[i].pal += 7;
|
wal.pal += 7;
|
||||||
|
|
||||||
ebx += wall[i].shade;
|
ebx += wal.shade;
|
||||||
int eax = ebx;
|
int eax = ebx;
|
||||||
|
|
||||||
if (ebx < -127) {
|
if (ebx < -127) {
|
||||||
eax = -127;
|
eax = -127;
|
||||||
}
|
}
|
||||||
|
|
||||||
wall[i].shade = eax;
|
wal.shade = eax;
|
||||||
|
|
||||||
if (!var_1C && !wall[i].overpicnum && pNextSector)
|
if (!var_1C && !wal.overpicnum && pNextSector)
|
||||||
{
|
{
|
||||||
AddFlash(wall[i].nextsector, x, y, z, val);
|
AddFlash(wal.nextsector, x, y, z, val);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue