* improve AssetManager implementation
Notable changes are:
* removed the individual managers inside of d2asset, only one asset manager
* AssetManager now has caches for the types of files it loads
* created a type for TextDictionary (the txt file structs)
* fixed a file path bug in d2loader Source
* fixed a asset stream bug in d2loader Asset
* d2loader.Loader now needs a d2config.Config on creation (for resolving locale files)
* updated the mpq file in d2asset test data, added test case for "sub-directory"
* added a Data method to d2asset.Asset. The data is cached on first full read.
* renamed ArchiveDataStream to DataStream in d2interface
* moved palette utility func out of d2asset and into d2util
* bugfix for MacOS mpq loader issue
* lint fixes, added data caching to filesystem asset
* adding comment for mpq asset close
* Decouple d2asset from d2render
Notable changes in d2common:
* d2dcc.Load now fully decodes the dcc and stores the directions/frames in the dcc struct
* un-exported dcc.decodeDirection, it is only used in d2dcc
* removed font interface from d2interface, we only have one font implementation
* added `Renderer` method to d2interface.Surface, animations use this to bind to a renderer and create surfaces as they need
* added `BindRenderer` method to animation interface
Notable changes in d2common/d2asset:
* **d2asset.NewAssetManager only needs to be passed a d2config.Config**, it is decoupled from d2render
* exported Animation
* Animation implementation binds to the renderer to create surfaces only on the first time it is rendered
* font, dcc, dc6 initialization logic moved out of asset_manager.go
* for dc6 and dcc animations, the process of decoding and creating render surfaces has been broken into different methods
* the d2asset.Font struct now stores font table data for initialization purposes
Notable changes in d2core/d2render:
* Surfaces store a renderer reference, this allows animations to bind to the renderer and create a surface just-in-time
**These last changes should have been a separate PR, sorry.**
Notable changes in d2core/d2ui:
* ui.NewSprite now handles creating an animation internally, only needs image and palette path as arguments
Notable Changes in d2game:
Because of the change in d2ui, all instances of this code pattern...
```golang
animation, err := screen.asset.LoadAnimation(imgPath, palettePath)
sprite, err := screen.ui.NewSprite(animation)
```
... becomes this ...
```golang
sprite, err := screen.ui.NewSprite(imgPath, palettePath)
```
* Prevent player movement and casting if current spell cast is not finished yet
* Properly format the fields of Player struct
Co-authored-by: Presiyan Ivanov <presiyan-ivanov@users.noreply.github.com>
* improve AssetManager implementation
Notable changes are:
* removed the individual managers inside of d2asset, only one asset manager
* AssetManager now has caches for the types of files it loads
* created a type for TextDictionary (the txt file structs)
* fixed a file path bug in d2loader Source
* fixed a asset stream bug in d2loader Asset
* d2loader.Loader now needs a d2config.Config on creation (for resolving locale files)
* updated the mpq file in d2asset test data, added test case for "sub-directory"
* added a Data method to d2asset.Asset. The data is cached on first full read.
* renamed ArchiveDataStream to DataStream in d2interface
* moved palette utility func out of d2asset and into d2util
* bugfix for MacOS mpq loader issue
* minor lint fixes
* removed obsolete interfaces from d2interface
* lint fixes, added data caching to filesystem asset
* adding comment for mpq asset close
* adding comment for mpq asset close
* export d2asset singleton
* add *d2asset.AssetManager to d2app
- d2app now has a reference to an asset manager which it will use for loading
- added asset loader methods to the asset manager
- functions in d2asset are now wrappers for asset manager methods
* add asset manager reference to audio provider
- d2app asset manager reference is now passed to audio provider
- asset manager is created in main.go for now to pass into audio provider
- CreateSoundEffect is now a method, no longer exported, uses the asset manager reference
* d2app passes asset manager refence to map engine test
* in d2asset, all calls to LoadFile replaced with call to Singleton.Loadfile
* blizzard intro and credits screen
- d2app passes reference to the asset manager to these screens
* asset manager for d2map
- adding MapStampFactory, takes an asset manager reference
- embedded MapStampFactory into the MapEngine
- LoadStamp is now a method of the MapStampFactory
* d2asset: removed LoadFileStream, LoadFile, and FileExists
* d2gui changes
- singleton now has an asset manager reference
- calls to d2asset loader functions removed
- createButton is now a method of LayoutManager
- moved LayoutEntry to its own file
* map entity factory
- Map engine has an embedded map entity factory
- Map stamp factory gets a reference to the map engine's entity factory
- Stamps are given a reference to the map engine entity factory when created
- Character select gets a map entity factory
- Embedded the stamp factory into the MapEngine
* asset manager for d2ui
- d2ui is passed an asset manager reference when created
- all calls to d2asset loader functions in d2ui now refer to the asset manager
- d2gamescreen gets a ui manager when created
- help overlay is now passed a ui manager when created
* d2gamescreen + d2player: asset manager references
added an asset manager reference to
- inventory panel + inventory grid
- mini panel
- game controls
- help overlay
- character select
- main menu
- select hero class
- hero stats panel
* Removed d2asset.LoadAnimation
all references to this function have been replaced with calls to the asset manager method
* adding asset to help overlay, bugfix for 4d59c91
* Removed d2asset.LoadFont and d2asset.LoadAnimationWithEffect
all references to these have been replaced with calls to the asset manager methods
* MapRenderer now gets an asset manager reference
* removed d2asset.LoadPalette
all references have been replaced with calls to an asset manager instance
* merged d2object with d2mapentity
d2object was only being used to create objects in the map, so the provider
function is now a method of the map entity factory. calls to d2asset have
been removed.
* removed d2asset.LoadComposite
all calls are now made to the asset manager method
* removed d2asset singleton
all singleton references have been removed, a single instance of the
asset manager is passed around the entire app
* rename Initialize to NewAssetManager
* move music path enumerations into d2resource
* move text dictionary (.tbl) loader into d2fileformats sub-package d2tbl
* lint fix, add doc file for d2tbl
* moved data_dictionary.go into d2fileformats sub-package d2txt, added doc file
* added sub-packages d2geom for geometry-related things, and d2path for path-related things
* moved calcstring.go to d2calculation
* move bitmuncher, bitstream, stream reader/writer from d2common into sub-package d2datautils
* fix lint errors in d2datadict loaders (caused by moving stuf around in d2common)
* move size.go into d2geom
* move d2common/cache.go into sub-package d2common/d2cache
* renamed d2debugutil to d2util, moved utility functions from d2common into d2util
* adding loaders for rare prefix/suffix records
* switch to slices instead of maps for storing rare prefix/suffix records
* rare items now use the rare prefix/suffix names
* fixed lint errors in button.go
* fixed lint errors in checkbox.go
* Removed d2ui singleton, fixed nearly all lint errors
- Changed `UI` struct to `UIManager`, removed singleton
- UI element provider functions are now methods of the UI Manager
- Screens now use the UI manager to create UI elements
- game panels in d2player now use the UI Manager to create UI elements
- Only the UI manager knows about "widgets"; calls to `d2ui.AddWidget` in Screen instances have been removed
* changed ui element provider methods from `Create` to `New`
- fixed lint errors in d2interface
- removed `archived_` from interface names, was not necessary
- removed the Bitmuncher and Bitstream interfaces, as they are too specific and unnecessary
* adding debug printing boxes for entity bounds
* minor edits
- adding `spawnmon` command. currently does not have a netpacket, just for debug
- adding `GetSize` method to map entities for getting frame bounds (for debug printing)
* bug fix
* added highlight to animated entity
* moving provider functions for item, missile, npc, player into package export file d2mapentity.go
* changed `Create` to `New` in map entity provider functions
* add item highlight on hover
* add Name method to item entity
* Working sound engine and sound environments
* Clean up sounds.txt loader
* Make global volume settings apply properly
Als shuffle some stuff around
* Reset sound engine on game unload
* wip d2items system and item properties
* added loader for TreasureClassEx.txt
* wip item spawn from treasure class records
* wip items
* add call to init item equivalencies, remove treasure class test from d2app
* made item affix records global var a map of affix codes to the records
* changed how item to item common record equivalency is determined
* changed set items records export to a map of their codes to the records, grouped property params into a struct
* changed property parameter field from calcstring to string
* fixed bug in stat value clone
* adding equipper interface as part of stat context, eventually to be used to resolve set bonus (among other things)
* made the item interface simpler, only needs name and description methods
* adding equipper interface, for anything that will equip or have active items
* handle case where min and max are swapped, removed commented code
* added property/stat resolution for magic, rare, set, and unique items
* adding item generator which can roll for items using treasure class records
* fixed item equivalency func being called in the wrong spot
* added item spawning
- added packet type for spawning items
- added client/server handlers for SpawnItem packets
- added map entity for items
- added simpler item provider function in diablo2item package
- added debug terminal command for spawning items
* wip d2items system and item properties
* added loader for TreasureClassEx.txt
* wip item spawn from treasure class records
* wip items
* add call to init item equivalencies, remove treasure class test from d2app
* made item affix records global var a map of affix codes to the records
* changed how item to item common record equivalency is determined
* changed set items records export to a map of their codes to the records, grouped property params into a struct
* changed property parameter field from calcstring to string
* fixed bug in stat value clone
* adding equipper interface as part of stat context, eventually to be used to resolve set bonus (among other things)
* made the item interface simpler, only needs name and description methods
* adding equipper interface, for anything that will equip or have active items
* handle case where min and max are swapped, removed commented code
* added property/stat resolution for magic, rare, set, and unique items
* adding item generator which can roll for items using treasure class records
* fixed item equivalency func being called in the wrong spot
* add interface for stats, d2 is an implementation
* fix incorrect comment, remove ennecessary int
* simplified description functions, remove duplicates
* moved default stringer functions
* fixed incorrect stat combine method
* change `Create` to `New` in method names
* d2stats + diablo2stats refactored again
- simplified `NewStat` provider function
- added initializer for stat values that sets the stringer functions, value types, and combination types for values when created
- removed redundant description functions
- added stat value combination types `sum` and `static`
`static` stat values which are not altered when stats are combined. this makes sense for stats like proc-on-hit or +skills to class
example:
Stat A: `10% reanimate as: skeleton mage`
Stat B: `8% reanimate as: skeleton archer`
Stat C: `6% reanimate as: skeleton archer`
A and B can not be combined
B and C can be combined to `14% reanimate as: skeleton archer`
* entity debug rendering, with command
needed to add getter method to MapEntity interface, so that's the reasoning for changing objects/npcs/player/etc
this currently brings allocs/s up to 10 (you can check by running `fps` command, se we need to look into d2debugutils and how it handles drawing text
* reverting velocity copy, broke the map entity tests. debug display wont show velocity currently.
* adding velocity debug
* Reorganize MapEngine
This is already turning into a mess...
* Map engine selects tile index to use
Still very ugly
* Fix subtile flag combination
* Prepare randomly generated base tiles
* Restore collision viewer
* Movement works again, searches for straight paths
Paths are now d2vector slices
* Fix LOS calculation
* Fix test (I think)
* smooth camera with vectors
* add smooth cam support to map engine test
smooth cam now works in map engine test.
clicking or holding the left-mouse button will move the camera.
also works with freecam mode in single-player.
* Update ebiten_renderer.go
did not mean to edit this file