-
Notifications
You must be signed in to change notification settings - Fork 534
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 bISPUFF, WorldHitscanFired, WorldHitscanPreFired [compiles but crashes] #2432
base: master
Are you sure you want to change the base?
Conversation
Yeah it's hard to pin down the issue with this code since it trips up something else entirely within the new file system. |
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. |
@coelckers Looks like it's not something I can solve on my end. Would you be able to debug this? I'm not sure how to progress, because it's not a draft anymore, all the stuff I wanted to add is there, but it's also not really "ready" because it causes a crash in its current form. |
@@ -311,6 +311,8 @@ class DStaticEventHandler : public DObject // make it a part of normal GC proces | |||
void WorldThingRevived(AActor* actor); | |||
void WorldThingDamaged(AActor* actor, AActor* inflictor, AActor* source, int damage, FName mod, int flags, DAngle angle); | |||
void WorldThingDestroyed(AActor* actor); | |||
bool WorldHitscanPreFired(AActor* actor, DAngle angle, double distance, DAngle pitch, int damage, FName damageType, PClassActor *pufftype, int flags, double sz, double offsetforward, double offsetside); | |||
void WorldHitscanFired(AActor* actor, DVector3 AttackPos, DVector3 DamagePosition, AActor* Inflictor, int flags); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Make sure to pass vectors by reference value (const DVector3&
) to avoid recreating them
double AttackOffsetForward; | ||
double AttackOffsetSide; | ||
double AttackZ; | ||
PClassActor* AttackPuffType; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
double
s and pointers need default initialization values, otherwise they'll be corrupted
This adds
WorldHitscanFired
andWorldHitscanPreFired
events toP_LineAttack
. 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. As an additional minor feature, it also changesP_SpawnPuff
to add a new +ISPUFF flag to actors spawned by it.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.
If this can be debugged, then the plan is to inject
WorldHitscanPrefired
into other functions that need it (P_RailAttack
; not sure if anything else is necessary). I'd appreciate any help.Screenshot from the VS debugger: