mirror of
https://github.com/ZDoom/Raze.git
synced 2025-01-18 14:41:55 +00:00
- WallBreakPosition
This commit is contained in:
parent
d6cd291030
commit
de5377cb2c
3 changed files with 17 additions and 17 deletions
|
@ -729,15 +729,15 @@ bool UserBreakWall(WALLp wp)
|
|||
return false;
|
||||
}
|
||||
|
||||
int WallBreakPosition(walltype* wp, int *sectnum, int *x, int *y, int *z, int *ang)
|
||||
int WallBreakPosition(walltype* wp, sectortype** sectp, int *x, int *y, int *z, int *ang)
|
||||
{
|
||||
int nx,ny;
|
||||
int wall_ang;
|
||||
|
||||
wall_ang = NORM_ANGLE(getangle(wp->delta())+512);
|
||||
|
||||
*sectnum = wp->sector;
|
||||
ASSERT(*sectnum >= 0);
|
||||
*sectp = wp->sectorp();
|
||||
ASSERT(*sectp);
|
||||
|
||||
// midpoint of wall
|
||||
*x = (wp->x + wp->x) >> 1;
|
||||
|
@ -746,7 +746,7 @@ int WallBreakPosition(walltype* wp, int *sectnum, int *x, int *y, int *z, int *a
|
|||
if (!wp->twoSided())
|
||||
{
|
||||
// white wall
|
||||
*z = (sector[*sectnum].floorz + sector[*sectnum].ceilingz) >> 1;
|
||||
*z = ((*sectp)->floorz + (*sectp)->ceilingz) >> 1;
|
||||
}
|
||||
else
|
||||
{
|
||||
|
@ -757,15 +757,15 @@ int WallBreakPosition(walltype* wp, int *sectnum, int *x, int *y, int *z, int *a
|
|||
|
||||
// floor and ceiling meet
|
||||
if (next_sect->floorz == next_sect->ceilingz)
|
||||
*z = (sector[*sectnum].floorz + sector[*sectnum].ceilingz) >> 1;
|
||||
*z = ((*sectp)->floorz + (*sectp)->ceilingz) >> 1;
|
||||
else
|
||||
// floor is above other sector
|
||||
if (next_sect->floorz < sector[*sectnum].floorz)
|
||||
*z = (next_sect->floorz + sector[*sectnum].floorz) >> 1;
|
||||
if (next_sect->floorz < (*sectp)->floorz)
|
||||
*z = (next_sect->floorz + (*sectp)->floorz) >> 1;
|
||||
else
|
||||
// ceiling is below other sector
|
||||
if (next_sect->ceilingz > sector[*sectnum].ceilingz)
|
||||
*z = (next_sect->ceilingz + sector[*sectnum].ceilingz) >> 1;
|
||||
if (next_sect->ceilingz > (*sectp)->ceilingz)
|
||||
*z = (next_sect->ceilingz + (*sectp)->ceilingz) >> 1;
|
||||
}
|
||||
|
||||
*ang = wall_ang;
|
||||
|
@ -776,8 +776,8 @@ int WallBreakPosition(walltype* wp, int *sectnum, int *x, int *y, int *z, int *a
|
|||
*x += nx;
|
||||
*y += ny;
|
||||
|
||||
updatesectorz(*x,*y,*z,sectnum);
|
||||
if (*sectnum < 0)
|
||||
updatesectorz(*x,*y,*z,sectp);
|
||||
if (*sectp == nullptr)
|
||||
{
|
||||
*x = INT32_MAX; // don't spawn shrap, just change wall
|
||||
return false;
|
||||
|
@ -799,7 +799,7 @@ bool HitBreakWall(WALLp wp, int hit_x, int hit_y, int hit_z, int ang, int type)
|
|||
|
||||
//if (hit_x == INT32_MAX)
|
||||
{
|
||||
int sectnum;
|
||||
sectortype* sectnum = nullptr;
|
||||
WallBreakPosition(wp, §num, &hit_x, &hit_y, &hit_z, &ang);
|
||||
}
|
||||
|
||||
|
@ -1030,7 +1030,7 @@ int HitBreakSprite(DSWActor* breakActor, int type)
|
|||
|
||||
void DoWallBreakMatch(int match)
|
||||
{
|
||||
int sectnum;
|
||||
sectortype* sectnum = nullptr;
|
||||
int x,y,z;
|
||||
int wall_ang;
|
||||
|
||||
|
|
|
@ -52,7 +52,7 @@ BREAK_INFOp SetupWallForBreak(WALLp wallp);
|
|||
BREAK_INFOp SetupSpriteForBreak(DSWActor* actor);
|
||||
bool HitBreakWall(WALLp wp, int, int, int, int ang, int type);
|
||||
bool CheckBreakToughness(BREAK_INFOp break_info, int ID);
|
||||
int WallBreakPosition(walltype* hit_wall, int *sectnum, int *x, int *y, int *z, int *ang);
|
||||
int WallBreakPosition(walltype* wp, sectortype** sectp, int* x, int* y, int* z, int* ang);
|
||||
void SortBreakInfo(void);
|
||||
void DoWallBreakMatch(int match);
|
||||
|
||||
|
|
|
@ -7302,7 +7302,6 @@ void TraverseBreakableWalls(short start_sect, int x, int y, int z, short ang, in
|
|||
int dist;
|
||||
int break_count;
|
||||
|
||||
int sectnum;
|
||||
int wall_ang;
|
||||
int hit_x,hit_y,hit_z;
|
||||
|
||||
|
@ -7331,9 +7330,10 @@ void TraverseBreakableWalls(short start_sect, int x, int y, int z, short ang, in
|
|||
if (dist > radius)
|
||||
continue;
|
||||
|
||||
if (WallBreakPosition(&wal, §num, &hit_x, &hit_y, &hit_z, &wall_ang))
|
||||
sectortype* sectp = nullptr;
|
||||
if (WallBreakPosition(&wal, §p, &hit_x, &hit_y, &hit_z, &wall_ang))
|
||||
{
|
||||
if (hit_x != INT32_MAX && sectnum >= 0 && FAFcansee(x, y, z, §or[start_sect], hit_x, hit_y, hit_z, §or[sectnum]))
|
||||
if (hit_x != INT32_MAX && sectp != nullptr && FAFcansee(x, y, z, §or[start_sect], hit_x, hit_y, hit_z, sectp))
|
||||
{
|
||||
HitBreakWall(&wal, INT32_MAX, INT32_MAX, INT32_MAX, ang, 0);
|
||||
|
||||
|
|
Loading…
Reference in a new issue