Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Added WorldHitscanFired and WorldHitscanPreFired #2432

Merged
merged 2 commits into from
Nov 20, 2024

Conversation

jekyllgrim
Copy link
Contributor

@jekyllgrim jekyllgrim commented Mar 4, 2024

This adds WorldHitscanFired and WorldHitscanPreFired events to P_LineAttack and P_RailAttack. The former is called after a hitscan has been fired and provides information about it; the latter before it and allows stopping it. The idea is to allow mod authors universally detect hitscans, and potentially replace them with projectiles, which hasn't been possible so far.

THE PROBLEM is that in its current form, despite compiling properly, it leads to a mysterious crash on startup, presumably tripping up the file system. This is caused by WorldHitscanPrefired specifically; the other features were tested and work fine, but as soon as I added WorldHitscanPrefired, the crashes started happening. Unfortunately, I cannot nail down the issue myself.

UPD: I can't believe my inattention; the whole problem was that WorldHitscanPreFired was defined without a return value in zscript, and apparently that causes a CTD on startup rather than a build error.

Test file. This replaces hitscans with plasma balls and reports on received values.
WorldHitscan.zip

@madame-rachelle
Copy link
Collaborator

Yeah it's hard to pin down the issue with this code since it trips up something else entirely within the new file system.

@MajorCooke
Copy link
Contributor

Report it as a bug. If anything, Graf can take a look at it.

@jekyllgrim
Copy link
Contributor Author

Report it as a bug. If anything, Graf can take a look at it.

That's what I'm doing, more or less? I can't really report it as a bug for the current version of GZDoom because this issue occurs only after my personal changes on the cpp side.

@jekyllgrim jekyllgrim marked this pull request as draft March 13, 2024 18:43
@jekyllgrim jekyllgrim marked this pull request as ready for review March 15, 2024 14:51
@jekyllgrim jekyllgrim marked this pull request as draft March 15, 2024 14:51
@jekyllgrim jekyllgrim changed the title Added bISPUFF, WorldHitscanFired, WorldHitscanPreFired [draft] Added bISPUFF, WorldHitscanFired, WorldHitscanPreFired [compiles but crashes] Mar 29, 2024
src/events.h Outdated Show resolved Hide resolved
src/events.h Outdated Show resolved Hide resolved
@jekyllgrim jekyllgrim marked this pull request as ready for review October 28, 2024 23:22
@jekyllgrim
Copy link
Contributor Author

This is finally fixed and tested. No performance impact that I could see.

@jekyllgrim jekyllgrim changed the title Added bISPUFF, WorldHitscanFired, WorldHitscanPreFired [compiles but crashes] Added WorldHitscanFired and WorldHitscanPreFired Oct 28, 2024
@jekyllgrim
Copy link
Contributor Author

jekyllgrim commented Nov 19, 2024

Replaced DVector3 with const DVector3& following Boondorl's suggestion.

@madame-rachelle madame-rachelle merged commit 99c058d into ZDoom:master Nov 20, 2024
9 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants