Skip to content

Commit

Permalink
Fix MBF21 ripper weapons causing too much damage
Browse files Browse the repository at this point in the history
From Woof.
  • Loading branch information
bradharding committed Nov 2, 2024
1 parent a02fba2 commit 4e3b32f
Showing 1 changed file with 16 additions and 4 deletions.
20 changes: 16 additions & 4 deletions src/p_maputl.c
Original file line number Diff line number Diff line change
Expand Up @@ -383,55 +383,67 @@ bool P_BlockThingsIterator(const int x, const int y, bool func(mobj_t *))
for (mobj_t *mobj = blocklinks[(y - 1) * bmapwidth + x - 1]; mobj; mobj = mobj->bnext)
if (x == (mobj->x + mobj->radius - bmaporgx) >> MAPBLOCKSHIFT
&& y == (mobj->y + mobj->radius - bmaporgy) >> MAPBLOCKSHIFT
&& !(mobj->mbf21flags & MF_MBF21_RIP)
&& !func(mobj))
return false;

// (0, -1)
if (y > 0)
for (mobj_t *mobj = blocklinks[(y - 1) * bmapwidth + x]; mobj; mobj = mobj->bnext)
if (y == (mobj->y + mobj->radius - bmaporgy) >> MAPBLOCKSHIFT && !func(mobj))
if (y == (mobj->y + mobj->radius - bmaporgy) >> MAPBLOCKSHIFT
&& !(mobj->mbf21flags & MF_MBF21_RIP)
&& !func(mobj))
return false;

// (1, -1)
if (x < bmapwidth - 1 && y > 0)
for (mobj_t *mobj = blocklinks[(y - 1) * bmapwidth + x + 1]; mobj; mobj = mobj->bnext)
if (x == (mobj->x - mobj->radius - bmaporgx) >> MAPBLOCKSHIFT
&& y == (mobj->y + mobj->radius - bmaporgy) >> MAPBLOCKSHIFT
&& !(mobj->mbf21flags & MF_MBF21_RIP)
&& !func(mobj))
return false;

// (1, 0)
if (x < bmapwidth - 1)
for (mobj_t *mobj = blocklinks[y * bmapwidth + x + 1]; mobj; mobj = mobj->bnext)
if (x == (mobj->x - mobj->radius - bmaporgx) >> MAPBLOCKSHIFT && !func(mobj))
if (x == (mobj->x - mobj->radius - bmaporgx) >> MAPBLOCKSHIFT
&& !(mobj->mbf21flags & MF_MBF21_RIP)
&& !func(mobj))
return false;

// (1, 1)
if (x < bmapwidth - 1 && y < bmapheight - 1)
for (mobj_t *mobj = blocklinks[(y + 1) * bmapwidth + x + 1]; mobj; mobj = mobj->bnext)
if (x == (mobj->x - mobj->radius - bmaporgx) >> MAPBLOCKSHIFT
&& y == (mobj->y - mobj->radius - bmaporgy) >> MAPBLOCKSHIFT
&& !(mobj->mbf21flags & MF_MBF21_RIP)
&& !func(mobj))
return false;

// (0, 1)
if (y < bmapheight - 1)
for (mobj_t *mobj = blocklinks[(y + 1) * bmapwidth + x]; mobj; mobj = mobj->bnext)
if (y == (mobj->y - mobj->radius - bmaporgy) >> MAPBLOCKSHIFT && !func(mobj))
if (y == (mobj->y - mobj->radius - bmaporgy) >> MAPBLOCKSHIFT
&& !(mobj->mbf21flags & MF_MBF21_RIP)
&& !func(mobj))
return false;

// (-1, 1)
if (x > 0 && y < bmapheight - 1)
for (mobj_t *mobj = blocklinks[(y + 1) * bmapwidth + x - 1]; mobj; mobj = mobj->bnext)
if (x == (mobj->x + mobj->radius - bmaporgx) >> MAPBLOCKSHIFT
&& y == (mobj->y - mobj->radius - bmaporgy) >> MAPBLOCKSHIFT
&& !(mobj->mbf21flags & MF_MBF21_RIP)
&& !func(mobj))
return false;

// (-1, 0)
if (x > 0)
for (mobj_t *mobj = blocklinks[y * bmapwidth + x - 1]; mobj; mobj = mobj->bnext)
if (x == (mobj->x + mobj->radius - bmaporgx) >> MAPBLOCKSHIFT && !func(mobj))
if (x == (mobj->x + mobj->radius - bmaporgx) >> MAPBLOCKSHIFT
&& !(mobj->mbf21flags & MF_MBF21_RIP)
&& !func(mobj))
return false;

return true;
Expand Down

0 comments on commit 4e3b32f

Please sign in to comment.