Implement an autosave subsystem and safer save handling, plus related UI and hooks.
- Add autosave state and logic (diablo.cpp): periodic timer, pending queue, priorities (Timer, TownEntry, BossKill, UniquePickup), cooldowns, combat cooldowns, enemy proximity safety checks, and helper APIs (QueueAutoSave, AttemptAutoSave, IsAutoSaveSafe, etc.).
- Integrate autosave triggers: queue on town entry (loadsave), unique item pickup (inv.cpp), boss kills (monster.cpp), and mark combat activity from player actions and hits (player.cpp).
- Add gameplay options to enable autosave and set interval (options.h/.cpp) and display countdown/ready label in the game menu (gamemenu.cpp/gmenu.cpp). Menu text retrieval updated to show remaining seconds or "ready".
- Make SaveGame robust (loadsave.cpp): write hero and stash via new pfile_write_hero_with_backup() and pfile_write_stash_with_backup() that create backups and restore on failure. Add utilities to copy/restore unpacked save directories safely (pfile.cpp) and adjust stash path handling signature.
- Minor fixes and cleanups: restrict mouse-motion handling to KeyboardAndMouse path, small reordering in player sprite width switch, and a few safety/formatting tweaks.
Autosave only runs in single-player and when IsAutoSaveSafe() conditions are met. Backup save logic attempts to preserve the previous save on failure.
,autoRefillBelt("Auto Refill Belt",OptionEntryFlags::None,N_("Auto Refill Belt"),N_("Refill belt from inventory when belt item is consumed."),false)
,disableCripplingShrines("Disable Crippling Shrines",OptionEntryFlags::None,N_("Disable Crippling Shrines"),N_("When enabled Cauldrons, Fascinating Shrines, Goat Shrines, Ornate Shrines, Sacred Shrines and Murphy's Shrines are not able to be clicked on and labeled as disabled."),false)
,quickCast("Quick Cast",OptionEntryFlags::None,N_("Quick Cast"),N_("Spell hotkeys instantly cast the spell, rather than switching the readied spell."),false)
,autoSaveEnabled("Auto Save",OptionEntryFlags::CantChangeInMultiPlayer,N_("Auto Save"),N_("Autosave works only in single player and only at safe moments."),false)
,autoSaveIntervalSeconds("Auto Save Interval",OptionEntryFlags::CantChangeInMultiPlayer,N_("Autosave interval (seconds)"),N_("Time between periodic autosave attempts."),120,{30,60,90,120,180,300,600})
,numHealPotionPickup("Heal Potion Pickup",OptionEntryFlags::None,N_("Heal Potion Pickup"),N_("Number of Healing potions to pick up automatically."),0,{0,1,2,4,8,16})
,numFullHealPotionPickup("Full Heal Potion Pickup",OptionEntryFlags::None,N_("Full Heal Potion Pickup"),N_("Number of Full Healing potions to pick up automatically."),0,{0,1,2,4,8,16})
,numManaPotionPickup("Mana Potion Pickup",OptionEntryFlags::None,N_("Mana Potion Pickup"),N_("Number of Mana potions to pick up automatically."),0,{0,1,2,4,8,16})