Skip to content

[Bugfix] Fix Missile obstruction checks#8351

Merged
StephenCWills merged 2 commits intodiasurgical:masterfrom
kphoenix137:fix-missile-obstruction-checks
Jan 31, 2026
Merged

[Bugfix] Fix Missile obstruction checks#8351
StephenCWills merged 2 commits intodiasurgical:masterfrom
kphoenix137:fix-missile-obstruction-checks

Conversation

@kphoenix137
Copy link
Copy Markdown
Collaborator

@kphoenix137 kphoenix137 commented Dec 12, 2025

Fixes: #6693


LineClearMissile()
Monsters ask:

"Can I shoot the player?"

  1. LineClear(PosOkMissile, start, end)
  2. PosOkMissile(tile) = true if the tile is not BlockMissile.

CheckMissileCol()
Missiles ask:

"Can I move through this tile?"

  1. !IsMissileBlockedByTile(tile)
  2. false if:
    • out of bounds
    • tile has BlockMissile
    • there’s an object with _oMissFlag == false

To remedy this, this PR adds a variant function called LineClearMovingMissile(), which is exclusively used when we need to check if a missile would be able to make it between 2 points without hitting an obstruction according to CheckMissileCol(). LineClearMissile() continues to be used for missiles that do not need to travel, such as Leoric summoning a minion at a position, or the player casting a Guardian at a position.

This fix has edge cases due to differing logic between LineClear() and how a missile moves along a path with MoveMissile(). This is the 2nd of the 4 needed fixes for the the problems with ranged monsters/ranged spells (like Guardian), and the 1st already has been merged back in 2023.

1. Missile Space Distortion fix
2. Same checks for missile path success and confirming missile path has no obstructions (This PR)
3. Same logic for missile path and confirming missile path has no obstructions
4. Ranged monster AI tweaks to prevent standing still with no valid line of sight for missiles

@kphoenix137 kphoenix137 marked this pull request as draft December 12, 2025 01:02
@kphoenix137 kphoenix137 marked this pull request as ready for review December 12, 2025 22:10
@kphoenix137 kphoenix137 changed the title Fix Missile obstruction checks [Bugfix] Fix Missile obstruction checks Jan 8, 2026
@yuripourre yuripourre added the fix fix for a bug label Jan 28, 2026
Copy link
Copy Markdown
Collaborator

@strich strich left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Code changes look good to me. It is unclear yet if this fully resolves the linked bug, though it is mentioned more work needs to be done after this as well in the OP post.

StephenCWills
StephenCWills previously approved these changes Jan 31, 2026
Comment thread Source/missiles.cpp Outdated
@StephenCWills StephenCWills enabled auto-merge (squash) January 31, 2026 01:54
@StephenCWills StephenCWills merged commit 74170ac into diasurgical:master Jan 31, 2026
26 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

fix fix for a bug

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Issue Report]: LineClearMissile() not consistent with missile travel path

4 participants