1
1
mirror of https://github.com/OpenDiablo2/OpenDiablo2 synced 2024-06-26 00:55:23 +00:00
Commit Graph

469 Commits

Author SHA1 Message Date
M. Sz
8a4c138835 ds1 encoder: layerStreamTypes and npcIndexes are now exported 2021-02-15 15:01:14 +01:00
M. Sz
bbeb4b48e2 hotfix: rename hidden -> HiddenBytes in wall_record.go and floor_shadow_record.go 2021-02-15 08:34:12 +01:00
gravestench
298fc786b8
Merge branch 'master' into date-encoder-font 2021-02-10 12:14:41 -08:00
gravestench
d268a987f3
Merge branch 'master' into data-encoder-dat 2021-02-10 12:05:10 -08:00
gravestench
0c5a3ae54c
Merge branch 'master' into data-encoding2 2021-02-10 11:52:00 -08:00
gucio321
025a172500 fixed lint errors in stream_writter 2021-02-10 19:53:11 +01:00
gucio321
004787597e
Merge branch 'master' into data-encoder-dt1 2021-02-10 19:43:32 +01:00
M. Sz
8a087dba6c stream writer and stream writer test:
- fixed typo
- cut PushBits... methods
- removed magic number
2021-02-10 14:00:03 +01:00
gucio321
6c230f66d7
d2dat encoder: removed typo in comment 2021-02-10 13:03:59 +01:00
M. Sz
7d0eeb0fd3 hotfix: d2cof encoder: changed way of pushing weapon class 2021-02-10 12:59:07 +01:00
M. Sz
1010353071 hotfix: d2cof encoder: removed magic number (len of weapon class) 2021-02-10 12:35:35 +01:00
M. Sz
8a15c0b074 hotfix: cof encoder: coding weapon class 2021-02-10 08:33:29 +01:00
M. Sz
d9cfe7f435 d2font: removed d2interface.Animation argument from d2font.Load; added height reading in glyphs loader 2021-02-09 08:53:34 +01:00
M. Sz
622e54dfce dc6 refactor: lintfix 2021-02-08 18:50:58 +01:00
M. Sz
6d098de778 d2dc6 refactor + unit test for it 2021-02-08 18:50:58 +01:00
gucio321
b74bc3d0b6
Merge branch 'master' into data-encoder-dat 2021-02-08 18:43:58 +01:00
gucio321
98c38b0dbf
Merge branch 'master' into data-encoder-dt1 2021-02-08 18:40:27 +01:00
gucio321
51833ed2de
Merge branch 'master' into date-encoder-font 2021-02-08 18:40:07 +01:00
Tim Sarbin
a85a7a18c1
Merge branch 'master' into master 2021-02-08 12:37:46 -05:00
M. Sz
e2ec1c6613 d2font: fixed lint errors 2021-02-08 17:25:02 +01:00
M. Sz
662d4489c4 d2font: encoder 2021-02-08 15:03:59 +01:00
M. Sz
6df66b51c1 d2font: rewritten initGlyphs ethod to use stream reader 2021-02-08 14:11:51 +01:00
M. Sz
721a67b404 font table interpreter: moved d stuff responsible for font table into d2fileformats/d2font 2021-02-08 13:21:50 +01:00
gucio321
ac50f8274a
Merge branch 'master' into data-encoder-dat 2021-02-08 12:05:40 +01:00
gucio321
bcfb0fb5c2
Merge branch 'master' into data-encoder-dt1 2021-02-08 12:04:55 +01:00
M. Sz
a76ce059e8 dat decoder: fixed lints 2021-02-08 10:03:34 +01:00
gucio321
794c246f64 fixed lint error in bitmuncher_test.go 2021-02-08 09:57:43 +01:00
M. Sz
b6cb6f88a6 data encoder: d2dat 2021-02-08 09:49:43 +01:00
M. Sz
5caa93a399 unit test: bitmuncher 2021-02-08 08:23:43 +01:00
M. Sz
8e1ca1dd7f stream writer test: added test for pushing bits 2021-02-06 20:43:04 +01:00
M. Sz
20f0d8a3d5 removed some of nolint:govet 2021-02-06 19:10:15 +01:00
M. Sz
215ac8cfc5 ds1: splited loading function 2021-02-06 18:58:15 +01:00
M. Sz
32570d6ae5 replaced nolint:gomnd directives with "magic numbers'" names 2021-02-06 18:28:01 +01:00
gucio321
ac8794015e Merge branch 'master' into data-encoder-dt1 2021-02-06 17:30:10 +01:00
M. Sz
aadfbbc8a6 stream writer: added warnings when bits count is greater then possible input size (in PUshBits... methods) 2021-02-06 17:23:11 +01:00
gravestench
248eaf9d79 Minor refactor of d2cof
* Changed `Load` to `Unmarshal`
* made `Marshal` and `Unmarshal` into methods of `COF`
* added `New` function which creates a new, empty COF instance
* added helper functions `Marshal` and `Unmarshal`
* Changed `StreamReader.ReadBytes` to account for edge case of reading 0
bytes (this was returning an error when it should not have)
* added really simple unit tests for COF
2021-02-05 14:43:42 -08:00
M. Sz
b3a754a4a6 ds1 encoder: Marshal method was splited to avoid nolint directive 2021-02-05 15:05:11 +01:00
M. Sz
9227de3418 d2ds1 encoder: fixed lint errors 2021-02-05 14:54:35 +01:00
M. Sz
5702d96cac ds1 encoder: fixed bug, when decoded and encoded back data wasn't the same = records' encoding methods was rewritten to use streamWriter.Pushbit 2021-02-05 14:45:22 +01:00
M. Sz
3dafb3ebcd dt1 encoder: moved record encoders and decoders to appropriate files 2021-02-05 14:07:51 +01:00
M. Sz
9f56574066 data encoder: ds1 2021-02-05 12:52:51 +01:00
gucio321
1b8da9ec8e
Merge branch 'master' into data-encoding2 2021-02-03 16:28:10 +01:00
Tim Sarbin
ffe4e68108
Merge branch 'master' into data-encoder-dt1 2021-02-03 09:57:46 -05:00
Tim Sarbin
89595329a5
Merge branch 'master' into data-converting 2021-02-03 09:48:54 -05:00
M. Sz
9f9c882653 data encoder: dt1 2021-02-02 19:25:27 +01:00
gucio321
73ca325a6b
Merge branch 'master' into data-converting 2021-02-02 17:01:05 +01:00
gucio321
5aded8de66
Merge branch 'master' into data-encoding2 2021-02-02 17:00:19 +01:00
Tim Sarbin
42a41d4817
Merge branch 'master' into hotfix2 2021-02-02 08:54:17 -05:00
M. Sz
909a0a9939 lintfix: gomnd 2021-02-02 12:02:11 +01:00
M. Sz
20f2649b65 asset manager: merged TranslateLabel to TranslateString 2021-02-02 10:15:18 +01:00
M. Sz
5a0571763e data encoding: tbl 2021-02-02 10:08:32 +01:00
M. Sz
2ebb36eba8 fixed stream-writer's test bug 2021-02-01 20:58:29 +01:00
M. Sz
84c87b2eb8 data encoding: DC6 2021-02-01 12:57:02 +01:00
M. Sz
7781b2cd6b removed PushByte method from StreamWriter 2021-02-01 11:20:44 +01:00
M. Sz
0fec9473ed rename: PushBytes(b []byte) -> PushBytes(b ...byte) 2021-02-01 11:15:42 +01:00
M. Sz
0f32ad5d62 data encoder: COF remade Cof encoder to use stream writter 2021-01-31 19:14:18 +01:00
gucio321
c5eb602de0
Update cof.go 2021-01-31 12:11:54 +01:00
gucio321
d0288e309f
removed WIP code 2021-01-30 18:31:44 +01:00
M. Sz
157f110105 data encoding: added COF encoder 2021-01-30 18:23:00 +01:00
M. Sz
b25bbe31f4 d2ui: rename NewCustomButton -> NewDefaultButton; lintfix 2021-01-19 17:47:42 +01:00
M. Sz
07eeec4827 party panel: rearranged constants (moved part of them into d2enum) 2021-01-19 17:39:40 +01:00
M. Sz
71e4470c25 party panel: colored labels; d2ui improvement: SwitchableButton.SetState() method; lintfix 2021-01-17 20:47:40 +01:00
M. Sz
bd3fc4bb25 party panel: switchers creator, party indexes (name, classs labels and switchers) 2021-01-16 21:59:44 +01:00
M. Sz
0de3aeabd3 Rename partyScreen->partyPanel 2021-01-16 21:59:44 +01:00
M. Sz
d74e171313 Party screen: frame, panel, close btn 2021-01-16 21:59:44 +01:00
gravestench
87d531814d d2datautil.StreamReader refactor
*`StreamReader.Read` methods now return errors

The other edits in this commit are related to cleaning up lint errors
caused by the changes to StreamReader
2021-01-12 10:26:27 -08:00
gravestench
1fc787023d fixed lint errors 2021-01-11 01:31:57 -08:00
gravestench
aa8525ff31 removed commented code 2021-01-11 01:16:29 -08:00
gravestench
2c0f3d9cd9 d2tbl.LoadTextDictionary now returns an error 2021-01-11 01:12:46 -08:00
Tim Sarbin
c99810ad0e Fixed various bugs, crashes, and slowdowns. 2021-01-10 02:44:42 -05:00
Intyre
db83814527
d2mpq refactored (#1020)
* d2mpq refactor

* d2mpq refactor last standing lint error

* d2mpq refactor: less linter noise

* d2mpq refactor: more linter issues
2021-01-08 12:46:11 -08:00
gucio321
6addf7a243
removed links to closed issues from code (#1005)
Co-authored-by: M. Sz <mszeptuch@protonmail.com>
Co-authored-by: gravestench <dknuth0101@gmail.com>
2021-01-06 21:48:12 -08:00
Tim Sarbin
92989d6d7a Removed improper ebiten dependency in d2interface. 2020-12-30 02:08:32 -05:00
Intyre
1e91df996c Refactor StreamReader 2020-12-23 10:43:33 +01:00
Intyre
b78dca52c2 Refactor StreamWriter 2020-12-23 10:43:33 +01:00
Tim Sarbin
b4f1e8cbbd
Merge pull request #1000 from gucio321/multi-language-support
ckecked value of italian modifier
2020-12-22 09:25:20 -05:00
M. Sz
bc17f2c422 ckecked value of italian modifier 2020-12-22 10:45:30 +01:00
Tim Sarbin
0f658d5dec
Merge pull request #999 from Intyre/term
Cleaned up d2term
2020-12-21 20:21:20 -05:00
Intyre
04ec879035 Cleaned up d2term 2020-12-21 21:46:58 +01:00
M. Sz
0c04e9b3d5 skill select menu dependencies (when we open skillselect menu, other panels are closed) 2020-12-21 17:37:59 +01:00
Tim Sarbin
c79c2a8c89
Merge pull request #983 from gucio321/quest-log-part2
Quest Log - quest completion animation
2020-12-17 11:35:25 -05:00
M. Sz
be8b3e3157 stats changing: hero stats panel 2020-12-16 16:49:50 +01:00
M. Sz
08e590f3e4 quest animation initial. 2020-12-16 15:08:39 +01:00
gucio321
2e31f3d1ec
Move Gold Panel (#962)
* move gold panel
2020-12-12 01:39:26 -08:00
M. Sz
dffa8ff865 moved max quests acts to d2enum 2020-12-04 10:43:33 +01:00
M. Sz
ed89d91ae4 code cleanup 2020-12-04 09:20:38 +01:00
M. Sz
2c303d74f2 quest status init 2020-12-03 10:40:01 +01:00
M. Sz
c7a841fe5a Merge branch 'hotfix' of https://github.com/gucio321/OpenDiablo2 into hotfix 2020-12-02 09:41:52 +01:00
gucio321
96916863ff
Quest log initial (#956)
* Adding character quest panel
2020-12-01 23:19:15 -08:00
M. Sz
fa1e86acc3 added quest log items to d2resources and modified player movement speed 2020-11-29 17:08:46 +01:00
M. Sz
b0af051f4c d2resource - escape menu labels 2020-11-28 19:58:22 +01:00
Tim Sarbin
73d381215e
Merge pull request #951 from gucio321/multi-language-labels
Multi language labels
2020-11-27 11:47:54 -05:00
M. Sz
640a9e043d code cleanup 2020-11-26 12:25:47 +01:00
M. Sz
1dcd63a238 fixed lint errors 2020-11-26 11:30:11 +01:00
M. Sz
76257ca351 moved some stuff 2020-11-26 11:13:35 +01:00
M. Sz
6f6516ae33 a bit updated comments 2020-11-25 20:57:52 +01:00
M. Sz
91f28516ff fixed lints 2020-11-25 19:25:19 +01:00
M. Sz
56787b13b8 Opimalisation 2020-11-25 12:37:16 +01:00
Thomas Christlieb
320583b5d4 save act and difficulty. Fixes #866 2020-11-25 11:51:20 +01:00
M. Sz
d87e4a846a init of multi-language main menu 2020-11-25 10:03:50 +01:00
gucio321
33bc9fe434
locale strings for character select & hero stat panel (#948)
* character select screen's hero descriptions & hero stat panel

* cinematics names

* buttons on character select screen and "resistances" labels on hero stats panel

Co-authored-by: M. Sz <mszeptuch@protonmail.com>
2020-11-24 23:45:30 -08:00
M. Sz
0f2c5cecb1 fixed lints 2020-11-24 17:50:31 +01:00
M. Sz
c704cc4c45 buttons on character select screen and "resistances" labels on hero stats panel 2020-11-24 17:44:15 +01:00
gucio321
2153f5ce64
implemented logger in d2gamescreen (#925)
* implemented logger in d2gamescreen

* logger in d2game/d2player

* logger for app.go
2020-11-18 13:02:49 -08:00
Michał Mrówka
2a36c956a4
Label fix (#931) 2020-11-17 23:50:31 -08:00
Michał Mrówka
bbba67487d
Added support for charset 2020-11-16 21:39:48 +01:00
Michał Mrówka
5d5e10f229
Remove language option from config file 2020-11-16 12:47:11 +01:00
Julien Ganichot
0d691dbffa
Key binding menu (#918)
* Feat(KeyBindingMenu): Adds dynamic box system with scrollbar

* Feat(Hotkeys): WIP Adds a lot of things

* Feat(KeyBindingMenu): WIP Adds logic to binding

* Feat(KeyBindingMenu): Fixes assignment logic

* Feat(KeyBindingMenu): Adds buttons logic

* Feat(KeyBindingMenu): Fixes sprites positions+add padding to Box

* Feat(KeyBindingMenu): Adds label blinking cap

* Feat(KeyBindingMenu): Removes commented func

* Feat(KeyBindingMenu): Fixes lint errors and refactors a bit

* Feat(KeyBindingMenu): Corrects few minor things from Grave

* Feat(KeyBindingMenu): removes forgotten key to string mapping
2020-11-13 12:03:30 -08:00
M. Sz
2eda3827ce cinematics select background 2020-11-10 15:00:40 +01:00
M. Sz
e20d544a8c Buttons in cinematics menu 2020-11-10 15:00:40 +01:00
M. Sz
bd4cf1a334 cinematics menu init 2020-11-10 15:00:40 +01:00
Gürkan Kaymak
e99fbf5c4b
showed an error message if the client cannot connect to a host (#910) 2020-11-08 14:03:51 -05:00
gravestench
be9c29e9d2
Unfuck asset manager init (#906)
* moved loader bootstrap logic into d2app
2020-11-08 01:24:35 -08:00
gravestench
f7fb35a4ec
removed debug printer singleton from d2util (#901)
resolves #504
2020-11-03 11:19:59 -08:00
gravestench
af1f0a0eda
removed string table singleton from d2common/d2fileformats/d2tbl/ (#900) 2020-11-03 11:10:11 -08:00
gravestench
5ac03d6f49
refactored game bootstrap, removed d2config.Config singleton (#899)
* Remove d2config.Config singleton

* refactored config file bootstrap
* `d2loader.Loader` adds the config directories during init
* `d2asset.AssetManager` loads the config file during init
* mpq verification logic removed from d2config; this is done by d2loader
* added `errorMessage` to `d2app.App` for setting the error message for the error screen.

* fixed loader test
2020-11-03 07:54:15 -05:00
gravestench
d6c9748fef
refactored logging in d2loader, d2record, and d2asset (#898)
* refactored logging in d2config, d2record, and d2asset

* asset manager, record manager, and file loader now utilitize d2util.Logger
* added colored logging to d2util.Logger (excluding windows platforms)
* removed mpq file verification from d2config; d2loader handles this
* record loaders now use the record manager's logger for printing info
* added command line argument for setting log level (`--loglevel 4`, `-l4`, or `-l 4`
* added `LogLevel` parameter to config file
* default log level will show errors, warnings, and info log messages
* specifying log level as an argument overrides setting from config file

* fixed log level tests
2020-11-02 21:23:07 -05:00
gravestench
b052006922
add comment explaining significance of input handler return value (#895) 2020-11-02 01:14:03 -08:00
Julien Ganichot
8365400ff5
Feat(KeyMapping): Adds a configurable keymap to GameControls, resolves #793 (#893)
* Feat(KeyMapping): Adds a configurable keymap to GameControls + Updates help overlay to use it

Co-authored-by: gravestench <dknuth0101@gmail.com>
2020-11-01 19:43:23 -08:00
Julien Ganichot
1f2771e8bc
Resolves #874 and #892 (#894)
* Move engine initialization to d2app
* adding debug print of error returned from `App.Run`
* adding ClampInt utility function to d2math
* cleaned up argument parsing in app.go, dedicated server no longer starts a renderer

Co-authored-by: gravestench <dknuth0101@gmail.com>
2020-11-01 16:05:50 -08:00
Tim Sarbin
1a6c6b8e9f
Add panic screen (#878)
* Add panic screen

* Fixed lint error. Updated all module references
2020-10-28 21:02:12 -04:00
gravestench
6e31cfb52a
migrate to ebiten v2.0 API (#860)
* migrate to ebiten v2.0 API

* fixed lint errors
2020-10-28 14:17:42 -04:00
gravestench
4a62101b96
adding the rest of the data dictionary loaders (#869) 2020-10-28 13:52:15 -04:00
Gürkan Kaymak
ec9c0c3d95
fixes #767, implemented deepCopy for the dcc_animation and dc6_animation (#852) 2020-10-26 09:13:08 -04:00
gravestench
dd0c148784
fixed all gocognit lint errors (#848)
* reduced ItemFactory.NewItem complexity

* d2compression/wav.go: suppressing gocognit lint error, suppressing gocyclo lint error

* d2maprenderer/renderer.go: reducing complexity of rnderPass2 and renderPass3
2020-10-26 03:53:42 -07:00
gravestench
aa9f6be411
Lint cleanup gocyclo (#847)
* d2player/inventory.go: fixed gocyclo error, broke up render method to smaller methods

* d2client/game_client.go: suppressing gocyclo error for OnPacketReceived, doesnt make sense to split

* d2remoteclient/remote_client_connection.go: suppressing gocyclo error for decodeToPacket, doesnt make sense to split

* d2dcc/dcc_direction.go: suppressing gocyclo error in generateFrames
2020-10-26 02:24:04 -07:00
gravestench
6f8b43f8d6
Various lint error fixes and suppressions (#846)
* suppressing the magic number lint errors in mapgen, it will get a heavy refactor soon, hopefully...

* adding string token constants for SkillClass

* adding panic on error to left/right skill select render

* fixed cuddle lint error

* fixed unnecessary conversion, unused func param lint errors in dcc_animation.go

* adding comment for skill class tokens

* fixed typo in comment

* removed unused parameter in dcc/dc6 animations

* supress warning about Object.setMode always being passed direction value of 0

* fixed all invalid golint directives

* fixed a couple gocritic lint errors
2020-10-26 02:04:50 -07:00
gravestench
622186e350
fixed 'dupl' lint errors (#845)
* removed dupl lint errors in d2compression/huffman.go

* remove duplicate code for set/unique item properties

This is a more involved edit. I've added a `PropertyDescriptor`
which is a common struct that should have existed already. The
`PropertyDescriptor` is used to generate property instances, and is common
to item affixes, set items, sets, unique items, and runewords.

This was all to remove duplicate code in d2item/

* removed duplicate code for rare item affixes
2020-10-26 00:38:18 -07:00
gravestench
815cfa09cb
fix all gosec lint errors (#844) 2020-10-25 23:38:15 -07:00
gravestench
02acba231b
removed all 'wsl' lint errors (#836) 2020-10-25 17:28:40 -07:00
gravestench
1ce2af19bf
removed all 'gocritic' lint errors (#835) 2020-10-25 17:03:23 -07:00
gravestench
a1380bc264
removed all golint lint errors (#833)
* removed all 'golint' type lint errors
2020-10-25 16:23:55 -07:00
gravestench
025ee94e50
Removed all TODO's in project (#831)
* removed the rest of the magic number errors from d2game

* hotfix for bug i added in map engine test

* removed all TODO's in project, made issues on github for each one
2020-10-25 18:36:12 -04:00
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
presiyan-ivanov
7661b81576
Initial left & right skill select panel implementation. HeroSkill serialization cleanup. (#783)
- Clicking the active left/right skill now opens a skill select panel.
Only the available skills for the hero, which are valid for the panel type are shown.
Clicking on a skill from the skill select panel makes it the new active skill for the hero.

- Hovering a skill in the skill select panel shows the skill name +
skill description.

- New command which learns all skills for a specific
class(not persisted to a save file yet) - e.g. `learnskills ama` will learn
skills for the Amazon class.

- Initialize HeroSkill.shallowHeroSkill struct in the hero state factory, so we can use it
when we serialize the HeroSkill to packets/game save files.

- The parsed Skill.ListRow is now a number instead  of string.

Co-authored-by: Presiyan Ivanov <presiyan-ivanov@users.noreply.github.com>
2020-10-22 16:53:18 -04:00
juander-ux
e5dae4e5d8
Inital skilltree panel implementation (#782)
* d2ui/UIFrame: Refactor into its own class

it's not useful to have the handling of frames for the
inventory/herostate/skilltree/quest panels individually in each of
those.

* d2ui/button: Fix crash when a buttonlayout was not allowing FrameChange

When AllowFrameChange is false we do not create pressedSurface. So if we
press the button the game will crash.

* d2ui/button: Allow label-only buttons

At least for the skillmenu we need buttons were the graphic size does
not match the buttonsize. So let's render the graphic in there and make
the button label only.

* d2hero/hero_state_factory: Give all heroes their class specific skills

* d2player/gamecontrols: Fix wrong inventory/stats layouts for exp chars

For Druid/Assassin the inventory frame was rendered for a 640x480
resolution. This brings it in line with all other characters.

* d2player: Add inital Skilltree panel

* d2player/game_controls: Enable skilltree

Note here, that the inventory panel and skilltree panel can overlap.

* d2player/skilltree: Add skillicon rendering

Note here, that I couldn't figure out how to render them dark if no
skillpoints are invested.

Signed-off-by: juander <juander@rumtueddeln.de>
2020-10-22 12:54:45 -04:00
gravestench
e274260787
fixed all golint type lint errors (#780) 2020-10-21 23:41:21 -07: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
Albin
8b2cc76c30
Added ObjectMode, StorePage and Colors.txt resource loaders (#771)
* add ObjMode.txt loader

* add colors.txt loader

* added storepage loader

* Update storepage_loader.go

removed printline

Co-authored-by: kottz <edward.kallstedt@gmail.com>
2020-10-21 11:05:53 -04:00
presiyan-ivanov
88326b5278
Initial cast overlay implementation. Fix HeroSkill deserialization & map entities processing crashing for remote client. (#766)
* Casting a skill now plays the corresponding overlay(if any).

* Prevent a crash caused by nil pointer in HeroSkill deserialization, happening when
unmarshalling HeroSkill from packets as a remote client.

* Add PlayerAnimationModeNone to handle some of the Skills(e.g.
Paladin auras) having "" as animation mode.

* Joining a game as remote client now waits for map generation to finish
before rendering map or processing map entities. This is temporary hack to prevent the game from
crashing due to concurrent map read & write exception.

* Send CastSkill packet to other clients.

Co-authored-by: Presiyan Ivanov <presiyan-ivanov@users.noreply.github.com>
2020-10-10 18:47:51 -04:00
kottz
b5e052fc81
Add gamble.txt loader (#764) 2020-10-10 18:45:28 -04:00
Josh Jordan
b1cdb47302
Help and Escape Menu click through and close behavior (#761)
* Disallow clicking through the help menu to control the game

* Move Navigator and EscapeMenu up in package tree to be accessible by GameControls. Disallow GameControls input when EscapeMenu is open

* Make ESC key behavior more consistent with D2
2020-10-07 21:20:05 -04:00
nicholas-eden
24556f62fc
Add belt loader (#757)
Add loader and record type for belts #634
2020-09-26 02:13:01 -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
presiyan-ivanov
a4e9797431
Initial player Left skill and Right skill handling (#741)
* 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>
2020-09-20 11:55:44 -04:00
Brendan Porter
f4d78549c5
Helpv3 (#739)
* finishing up help overlay

* fixes help overlay close button,
adds hack to prevent buysellbtn from rendering all 24 unrelated frames on top of eachother
2020-09-20 02:54:24 -04:00
gravestench
271673851a
Added RecordManager implementation to remove d2datadict singletons (#736)
* Added RecordManager implementation to remove d2datadict singletons

* fix object lookup test
2020-09-19 14:33:40 -04:00
lord
7e3aff557b
Decouple asset manager from renderer (#730)
* 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)
```
2020-09-14 17:31:45 -04:00