Cataclysm-DDA icon indicating copy to clipboard operation
Cataclysm-DDA copied to clipboard

Firing issues centering screen.

Open Cupidatis opened this issue 1 year ago • 6 comments

Describe the bug

Sometimes there are issues with centering screen after firing with some weapons. It was being corrected with key reset centering, but when I was firing from different Z level (from top of the tree) resetting didn't help, save and quit also didn't help with it. So it shows me black screen, only looking around with x, V or f make you see something.

Attach save file

new-trimmed.tar.gz

Steps to reproduce

  1. Climb at tree
  2. Fire some zombies at different Z level
  3. Center of your screen is on different Z level

Expected behavior

Screen position need to be reseted after finishing firing.

Screenshots

Screenshot_2024-09-04-13-01-46-916_com cleverraven cataclysmdda experimental

Versions and configuration

  • OS: Android
    • OS Version: Manufacturer: Xiaomi; Model: M2101K7BNY; Release: 13; Incremental: V14.0.4.0.TKLRUXM;
  • Game Version: cdda-experimental-2024-08-30-0310 8ebdfc1 [64-bit]
  • Graphics Version: Tiles
  • Game Language: Русский <color_dark_gray>(91.5%) [ru]
  • Mods loaded: [ Тёмные Дни Впереди [dda], Магиклизм [magiclysm], Разум над материей [mindovermatter], <color_cyan>Arcana and Magic Items [Arcana], Aftershock [aftershock], Развитая XEDRA [xedra_evolved], Отключить потребности у НПС [no_npc_food], Медленный рост фунгалоидов [no_fungal_growth], Портальные штормы игнорируют НПС [personal_portal_storms], Magiclysm No Class Limit [magiclysm_no_class_limit], Характеристики за убийства [stats_through_kills], Мифические стили ближнего боя [MMA], <color_cyan>Arcana/Magiclysm Patchmod [Arcana_Magiclysm_Patch], <color_cyan>Arcana/Aftershock Patchmod [Arcana_aftershock_Patch], Помпезные перки [bombastic_perks] ]

Additional context

Edit: maybe it's Aftershock issue, I used v7 laser pistol.

Cupidatis avatar Sep 04 '24 08:09 Cupidatis

I encountered a similar bug after shooting while driving, the center of the screen shifted several tiles to the side.

Agnistel avatar Sep 04 '24 08:09 Agnistel

I got the same bug. Somehow after shooting from a roof to lower z-level, my view offset got permanently fixed on a lower level. Game Version: b38588a. To anyone who encounters this bug and want a fix - just edit your sav file - set "view_offset_z" back to 0 and then load... I wonder why would one even save view_offset_z in a first place...

Anubioz avatar Sep 06 '24 20:09 Anubioz

I did a quick test with a more vanilla mod list. I got into a tree with the V29 laser pistol and shot down at a debug monster on a lower Z level. it didn't even change my view to the Z-level that the debug monster was on, it stayed on the z-level of my character. It looks like a mod issue.

TESTING-trimmed.tar.gz

  • OS: Windows
    • OS Version: 10.0.19045.4651 (22H2)
  • Game Version: cdda-experimental-2024-09-04-0626 0c909b2 [64-bit]
  • Graphics Version: Tiles
  • Game Language: System language []
  • Mods loaded: [ Dark Days Ahead [dda], Disable NPC Needs [no_npc_food], Portal Storms Ignore NPCs [personal_portal_storms], Slowdown Fungal Growth [no_fungal_growth] ]

CoroNaut avatar Sep 06 '24 21:09 CoroNaut

options.json I'm pretty sure it is related to options like snapping to target, try this option set, while I'll dig into the code. (Also the bug happened when I ran out of ammo.)

Anubioz avatar Sep 06 '24 21:09 Anubioz

Tried with vanilla. This bug work with v29 when you're firing to another Z level to moment when laser goes to VNT overheat.

Cupidatis avatar Sep 07 '24 01:09 Cupidatis

I just compiled the latest source code & can confirm the bug is still there. It triggers when you run out of ammo, while having the "snap to target" option enabled and shooting a target on a different z-level.

I presume it can be fixed by replacing:

if( status == Status::OutOfAmmo && new_pos != src ) {
    // range == 0, no sense in moving cursor
    return false;
}

with

if( status == Status::OutOfAmmo && new_pos != src ) {
    set_view_offset(tripoint_zero); // move the view_offset back to player to fix shooting from a different z-layer
    return false;
}

in the ranged.cpp

But maybe a better solution would be implementing shifting view keys for z-level, so one can adjust the view_offset like one needs...

P.S. I can say playing with my code edits, which resets offset on running out of ammo seems much more comfortable for some reason, since you immediately can tell that you run out of ammo, when it snaps back to you, unlike when you needed to specifically look into sidebar log to tell why exactly your gun does not shoot...

Anubioz avatar Sep 08 '24 12:09 Anubioz