szapp / GothicFreeAim

Free aiming for the video game series Gothic
https://gfa.szapp.de
MIT License
34 stars 4 forks source link

Enabled GFA breaks dialog system in G1 #176

Closed nicodex closed 6 years ago

nicodex commented 6 years ago

During dialogs in the Old Camp, sooner or later, the cancel key and/or right mouse button is closing the subtitle window, but no longer stops the speech (the dialog system still waits for the end of the sound), sometimes the output text is shown in a noise window (red caption, as if talking to himself), and sometimes the dialog just ends.

This issue goes away as soon as GFA is disabled in the game menu (same game session, neither restart nor reload required).

All the smalltalk in the Old Camp might be an issue here, because it does not happen at the starting area.

edit: Also testing again with Beta 16, 17, and 18 - seems to be an older problem. No suspicious output in the zSpy. Will retest it with the German release (should be no difference, just to be sure).

szapp commented 6 years ago

I can reproduce the bug with Gothic 1 (German version), but have never encountered it in Gothic 2. It seems to be connected to the free aiming feature only (GFA_Init(GFA_RANGED) and/or GFA_Init(GFA_SPELLS), but none of the other sub-features).

Additionally I found that cancelling OUs once sometimes cancels all consecutive lines of dialog.

So far, I am clueless. The zSpy on maximum level does not give much info. GFA hooks the oCGame::HandleEvent to manipulate the cancellation of OUs, but only for Gothic 2. In Gothic 1 this hook is not present. I will start investigating in CGameManager::HandleCancelKey.

UPDATE: I could pinpoint the problem to be related to GFA_STRAFING, a setting in config/setting.d. That explains why I haven't encountered the issue in my Gothic 1 test run a few weeks ago when the aim movement feature was not yet implemented.

szapp commented 6 years ago

I found the problem: For some frequent checks on active aim movement, the player instance is retrieved with

var oCNpc her; her = Hlp_GetNpc(hero);

This external function seems to overwrite the active talking NPC. Would you be willing to try if the problem is fixed for you if you replace this assignment in line 34 in GFA_AimMovement like so:

const int oCNpc__player = 9288624; //0x8DBBB0 // Gothic 1
var oCNpc her; her = _^(MEM_ReadInt(oCNpc__player));

For me this fixes the issue. Let me know it works for you as well.

nicodex commented 6 years ago

Hlp_GetNpc() isn't doing anything tricky, but it overrides the global variable 'ÿINSTANCE_HELP' (symbol index 0) that is internally used by every External that returns an instance object. This might conflict with other script code that is currently running.

Currently I'm using the VDF release of the beta and I'm not prepared to re-compile the scripts (will take a while to test the changes).

szapp commented 6 years ago

Thanks for the info.

Since this small change does not hurt, I will implement it in the next beta release. Then you can test it without the need to compile the scripts yourself.

nicodex commented 6 years ago

This ZenGin behavior is documented (in German) here: World of Gothic - Editing - Compiled ZenGin Script Format

szapp commented 6 years ago

Was this issue resolved with the new version (beta 20)?