1
1
mirror of https://github.com/OpenDiablo2/OpenDiablo2 synced 2024-06-09 17:30:43 +00:00
Commit Graph

63 Commits

Author SHA1 Message Date
gravestench
589850a728
Removing TODO comments, making issues for them (#807)
* removed the rest of the magic number errors from d2game

* hotfix for bug i added in map engine test

* removed TODO's from d2mapengine/engine.go, added link to github issue

* removed TODO's and made issues and other minor lint work

* lint cleanup, mostly removing TODO's and putting links to their issues on github
2020-10-25 10:21:14 -04:00
gravestench
783993470e
Lint error cleanup1 (#779)
* fixed lint error in d2app/app.go

* go fmt entire project

* adding doc.go for d2records

* fixed lint issues in d2core/d2map

* fixed lint error in d2interface/palette.go

* fixed lint error in  d2core/d2hero/hero_state_factory.go

* adding dov.go to d2common/d2geom

* fixing lint errors in d2common/d2loader

* adding doc.go to d2common/d2cache

* adding doc files for d2datautils, d2util, d2path

* adding package doc strings for mapgen, in-geam help screen, and tcp client connection

* removed all cuddling lint errors

* changed stamina equality check to '<=' instead of '<'
2020-10-22 01:12:06 -04:00
Brendan Porter
ca45be0948
Adds error handling everywhere (#743)
* adds error handling, returns early from funcs where it makes sense

* fixes build errors

* merge ballresin PR with upstream

* adds error handling, returns early from funcs where it makes sense

* fixes build errors

* merge ballresin PR with upstream

Co-authored-by: dknuth <dknuth0101@gmail.com>
2020-09-23 13:30:54 -04:00
gravestench
be354f139b
Removing the rest of the d2data singletons (#742)
* 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
2020-09-20 20:30:27 -04:00
gravestench
fc87b2be7a
Removing d2datadict singletons (#738)
* 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
2020-09-20 17:52:01 -04:00
Gürkan Kaymak
ef0fbc0581
removed gui manager singleton in d2gui (#735) 2020-09-18 16:10:52 -04:00
presiyan-ivanov
8a670d7482
Prevent player movement and casting if current spell cast is not fini… (#729)
* 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>
2020-09-14 14:49:31 -04:00
lord
7f6ae1b785
improve AssetManager implementation (#728)
* 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
2020-09-14 14:47:11 -04:00
lord
854fce3b14
remove d2asset singleton (#726)
* 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
2020-09-12 16:51:30 -04:00
Gürkan Kaymak
f4a71c72e4
lint fixes (#727) 2020-09-12 16:25:09 -04:00
lord
0218cad717
organize d2common pakage (#716)
* 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
2020-09-08 15:58:35 -04:00
lord
0ea6bd5b92
add rare prefix+suffix loaders, d2items use rare item names (#702)
* 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
2020-08-06 22:32:40 -04:00
lord
acc4c7a13e
d2ui refactor (#699)
* 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`
2020-08-06 10:30:23 -04:00
lord
ca7412aea6
removed singleton screen manager instance (#696) 2020-08-05 22:31:56 -04:00
lord
8e41133f39
lint and minor refactor of d2common (#690)
- moved contents of `d2common/math.go` into `d2math/math.go`
- removed lint errors from files in d2common
2020-08-05 00:03:33 -04:00
AndrejMijic
4a48acb8ba
Add objgroup.txt loader (#677) 2020-08-04 12:12:03 -04:00
lord
466855e5f5
remove lint errors from d2datadict (#676) 2020-08-04 11:16:06 -04:00
AndrejMijic
c216ddab53
Add monpreset.txt loader (#675) 2020-08-04 09:06:33 -04:00
AndrejMijic
efb554c42b
Add PlayerClass.txt loader (#667) 2020-08-02 21:26:57 -04:00
AndrejMijic
6514fd15de
Add monseq.txt loader (#664) 2020-08-01 17:55:34 -04:00
AndrejMijic
3fea5a096d
Add monequip.txt loader (#662) 2020-07-31 18:24:47 -04:00
Bojan Novković
247bda97c6
Added loaders for itemratio.txt, Overlay.txt and UniqueAppellation.txt (#660)
* Added loaders for itemratio.txt, Overlay.txt, UniqueAppellation.txt

* Adjust unique appellation loader for expansion data

* fixes: response to PR comments

* overlay.go: PR comment fixes

Co-authored-by: Bojan Novkovic <bojan.novkovic@kset.org>
2020-07-31 18:14:41 -04:00
Bojan Novković
38852d0285
added loaders for misscalc.txt and skillcalc.txt (#661)
Co-authored-by: BojanoN <bojan.novkovic@kset.org>
2020-07-31 18:00:10 -04:00
AndrejMijic
44e84c8b10
Add MonSounds.txt loader (#658) 2020-07-31 17:56:00 -04:00
AndrejMijic
05fa7d93ce
Add monlvl.txt loader (#655) 2020-07-31 15:00:09 -04:00
AndrejMijic
42cd1e1a3b
Add monumod.txt loader (#653) 2020-07-30 21:49:29 -04:00
AndrejMijic
9789372e8f
Add npc.txt loader (#650) 2020-07-30 14:12:18 -04:00
AndrejMijic
c398c8f1ad
Remove teminal time scaling (#649) 2020-07-30 12:59:17 -04:00
AndrejMijic
333b8610ac
Add pettype.txt loader (#648)
* Add pettype.txt loader

* Remove go.mod replace
2020-07-30 11:31:32 -04:00
lord
bfd3f1046d
D2items WIP (#646)
* 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
2020-07-30 10:14:15 -04:00
AndrejMijic
4dc0aa0f48
Add PlrMode.txt loader (#647) 2020-07-30 09:53:41 -04:00
AndrejMijic
a1ea22c81f
Add reading of ElemTypes.txt (#644) 2020-07-30 02:41:19 -04:00
Andrew Doing
cec3fb91d8
Add shrines.txt loader (#642) 2020-07-29 18:03:06 -04:00
Greg Jones
50fd6608cf
d2datadict: Add books.txt loader (#640) 2020-07-29 17:26:20 -04:00
Huw Griffiths
a31fb173eb
d2datadict: Add Monmode.txt loader (#638) 2020-07-29 08:38:34 -04:00
Andrew Doing
6f30dffa1c
d2datadict: Add soundenviron.txt loader (#639) 2020-07-28 16:35:22 -04:00
Huw Griffiths
78470431d6
d2datadict: Add Montype.txt loader (#637) 2020-07-28 16:34:01 -04:00
Huw Griffiths
b7f8aa8e90
d2datadict: Add Monprop.txt loader (#636) 2020-07-28 07:54:05 -04:00
Huw Griffiths
35d936ac4e
d2datadict: Add runes.txt loader (#635) 2020-07-28 07:53:32 -04:00
Andrew Doing
495301a9b7
Add loading of states.txt (#633)
* Add loading of states.txt

* Lint states.go
2020-07-28 07:52:55 -04:00
Tim Sarbin
b13c581beb
Unlocked map update frame rate (#632)
* Started work on shadows

* Removed fps limiter

* Fixed build info bug
2020-07-27 15:00:50 -04:00
lord
0018044c83
D2data treasure class (#631)
* added loader for TreasureClassEx.txt

* fix lint error
2020-07-27 01:16:37 -04:00
Tim Sarbin
856043d8ac
Updated music logic (#629) 2020-07-26 15:17:00 -04:00
Huw Griffiths
5e395092e7
Add qualityitems.txt loader (#622) 2020-07-25 09:37:43 -04:00
lord
b13175b070
d2data item related loaders (#619)
* added loader for ItemTypes.txt

* added loader for bodylocs.txt

* lint fix for item_types loader

* adding loader for sets.txt

* minor edit

* adding loader for SetItems.txt

* added loader for automagic.txt
2020-07-24 21:56:19 -04:00
Gürkan Kaymak
7a49f3637f
lint fixes (#615) 2020-07-23 12:56:50 -04:00
Gürkan Kaymak
80e655964e
Removed some global variables (#611)
* removed some global variables

* fixed tests
2020-07-22 15:03:03 -04:00
dk
ba89bf965a
removing lint errors from d2render (#598)
The edits outside of d2render or to fix the lint error for `DrawText`.
`DrawText` should be called `DrawTextf` because it formats the string.
2020-07-17 18:51:44 -04:00
dk
cf6029eb95
Stat descriptions + tests, Skilldesc.txt loader (#590)
* adding ranged number type, for use in stats

* Loaded Skills.txt

* asset manager only binds terminal commands if terminal != nil

* WIP stats

* cache getter and clear methods were not implemented

* asset manager handles a nil terminal pointer

* adding skilldesc.txt loader (needs work)

* ctc stat descriptions functions working

* moving description functionality out of itemstatcost loader and into stats

* stats seem like a central part of diablo, moving into d2core.

* stats seem like a central part of diablo, moving into d2core.

* delint

* adding statlist, statlist reduction, unit tests

* minor edits to stat.go

* lint error in statlist.go

* Remove dependency on actual data from mpq files

stats unit tests now use mock data

* fixing some lint errors, formatting

Co-authored-by: Maxime Lavigne (malavv) <duguigne@gmail.com>
2020-07-17 18:50:45 -04:00
David Carrell
3bdbd5c358
rely on App to know how to navigate between screens using a callback interface with explicit methods (#592)
remove unused struct vars that were only stored in order to pass to the next screens

consolidate create game code to single method

export ScreenMode consts and SetScreenMode method to allow app to create the correct screens

Co-authored-by: carrelda <carrelda@git>
2020-07-14 13:11:23 -04:00