* removing objects records from d2datadict
* removing Overlay singleton from d2datadict
* remove PetTypes singleton from d2datadict
* remove PlayerClass singleton from d2datadict
* removed PlrModes singleton from d2datadict
* removed Properties singleton from d2datadict
* removed ItemQuality singleton from d2datadict
* removed RarePrefix and RareSuffix singletons from d2datadict
* removed States singleton from d2datadict
* removed Runewords singleton from d2datadict
* removed Sets and SetItems singletons from d2datadict
* remoed Shrines singleton from d2datadict
* removed UniqueItems singleton from d2datadict
* removed SuperUniques singleton from d2datadict
* removed TreasureClass singleton from d2datadict
* removed UniqueAppellation singleton from d2datadict
* removed d2datadict
* removed data dict init from d2app, this has moved to asset manager init
* Remove weapons, armor, misc, itemCommon, itemTyps datadict singletons
- removed loader calls from d2app
- removed the HeroObjects singleton from `d2core/d2inventory`
- added an InventoryItemFactory in d2inventory
- package-level functions that use data records are now methods of the InventoryItemFactory
- renamed ItemGenerator in d2item to ItemFactory
- package-level functions that use records are now methods of ItemFactory
- d2map.MapEntityFactory now has an item factory instance for creating items
- fixed a bug in unique item record loader where it loaded an empty record
- added a PlayerStateFactory for creating a player state (uses the asset manager)
- updated the test inventory/equipment code in d2player to handle errors from the ItemFactory
- character select and character creation screens have a player state and inventory item factory
- updated item tests to use the item factory
* minor edit
* Removed d2datadict.Experience singleton
added a HeroStatsFactory, much like the other factories. The factory gets an
asset manager reference in order to use data records.
* removed d2datadict.AutoMagic singleton
* removed d2datadict.AutoMap singleton
* removed d2datadict.BodyLocations singleton
* removed d2datadict.Books singleton
* Removed singletons for level records
- removed loader calls in d2app
- changed type references from d2datadict to d2records
- added a `MapGenerator` in d2mapgen which uses thew asset manager and map engine
- package-level map generation functions are now MapGenerator methods
- `d2datadict.GetLevelDetails(id int)` is now a method of the RecordManager
* remove SkillCalc and MissileCalc singletons
* Removed CharStats and ItemStatCost singletons
- added an ItemStatFactory which uses the asset manager to create stats
- package-level functions for stats in d2item are now StatFactory methods
- changed type references from d2datadict to d2records
- `d2player.GetAllPlayerStates` is now a method of the `PlayerStateFactory`
* Removed DkillDesc and Skills singletons from d2datadict
- removed loader calls from d2app
- diablo2stats.Stat instances are given a reference to the factory for doing record lookups
* update the stats test to use mock a asset manager and stat factory
* fixed diablo2stats tests and diablo2item tests
* removed CompCodes singleton from d2datadict
* remove cubemain singleton from d2datadict
* removed DifficultyLevels singleton from d2datadict
* removed ElemTypes singleton from d2datadict
* removed events.go loader from d2datadict (was unused)
* removed Gems singleton from d2datadict
* removed Hireling and Inventory singletons from d2datadict
* removed MagicPrefix and MagicSuffix singletons from d2datadict
* removed ItemRatios singleton from d2datadict
* removed Missiles singleton from d2datadict
* removed MonModes singleton
* Removed all monster and npc singletons from d2datadict
- MapStamp instances now get a reference to their factory for doing record lookups
* removed SoundEntry and SoundEnviron singletons from d2datadict
* Initial player Left skill and Right skill handling
* Handle empty skill names in charStats.BaseSkils + add Attack skill for all classes.
Co-authored-by: Presiyan Ivanov <presiyan-ivanov@users.noreply.github.com>
* finishing up help overlay
* fixes help overlay close button,
adds hack to prevent buysellbtn from rendering all 24 unrelated frames on top of eachother
* 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
* d2loader refactor
- export sources
- asset and source both have a Path method
- make asset and source implement fmt.Stringer, which just calls Path method
- Loader.AddSource now returns the source and an error
* Update loader.go
* adding animdata loader
* utility methods, more tests, export record struct
- added methods for fps and frame duration calculation to the AnimationDataRecord
- exported AnimationDataRecord
- split the various structs into their own files
- added getter methods for retrieving records by name
- added tests for the new utility methods
* 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 logger implementation to d2common
* Adding file loader implementation
The file loader works in terms of `Sources` and `Assets`. A `Source` is
something like a filesystem that has a cache. An `Asset` is something
that implements `io.ReadSeeker` and has a few methods of its own.
There are currently `Source` implementations for MPQ archives and for the
host filesystem, meaning that one can specify a directory on the host fs to
load files from.
`Sources` are added to a loader with `loader.AddSource(path)`, where `path`
resolves somewhere on disk. In the case that the path points to an MPQ,
then an MPQ `Source` is created and added to the loader. If `path` resolves
to a directory, then a filesystem source is added.
Files are loaded with `loader.Load("data/global/excel/monstats.txt")`, and the
sources are searched in the order that they were added.
* adding tests for d2common/logger_test.go
* adding tests and testdata for d2loader
* logger lint fixes, fixed missing test case
* minor edits, lint fixes, changes some comments, embedded Logger into Loader
* moved d2loader into d2common (I dont think it belonged in d2core)
* removed my simple cache implementation in favor of our existing cache in d2common
* Set HP/Mana stats when globes are clicked
* Display HP or Mana stat when hovering over globe
* Display HP/Mana stats when hovering globe or when toggling by clicking the respective globe. Rename internal to assets and move assets package into folder.
* Adding .bmp to assets folder
* Networking refactor
* Networking refactor
* Networking refactor
* Networking refactor
* Refactor netpacket for json.Rawmessages as the data type and client side JSON decoder.
* Move game server connection handler to json decoder.
* Move game server connection handler to json decoder.
* 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