Commit Graph

46 Commits

Author SHA1 Message Date
gravestench 468f5682ae Merge branch 'd2ds1_refactor' into d2ds1_refactor_wip 2021-03-24 11:55:34 -07:00
gucio321 6e7e7b9d3f
Ds1 refactor (#11)
* Refactoring d2ds1

* Adding setters/getters so that state management can be maintained
internally when the ds1 struct is altered
* Adding unit tests for DS1

* unit tests for ds1 (#4)

* ds1 refactor: added test fore some methods; put tests in right order

* ds1 refactor: unit tests for all methods

* ds1 refactor: fixed build errors

* ds1 refactor: lintfix

* ds1 refactor: fixed bug with SetWidth, SetHeight methods

* ds1 refactor: rename tile_record.go -> tile.go

* ds1 refactor: unit test for SetTiles

Co-authored-by: M. Sz <mszeptuch@protonmail.com>

* renamed some files in d2ds1

* d2ds1.FloorShadow is now private

* renamed another file

* DS1.Tile() now calls update if dirty

* Ds1 refactor: some test improvement (#5)

* ds1 refactor: floor_shadow.go: methods Encode, Decode an Hidden are methods of floorShadow

* ds1 refactor: test checks, if our methods sets all fields correctly

* ds1 refactor: minor bugfixes

* i don't remember what's this, but i commit it ;-)

* ds1 refactor: reverted some pushed by mistake things

Co-authored-by: M. Sz <mszeptuch@protonmail.com>

* Ds1 refactor: test bugs + descriptive errors + SetNumberOfWall/FloorLayers (#6)

* ds1 refactor:
- removed DS1.layerStreamTypes field
- written unit test for setupStreamLayerTypes method
- added more descriptive error messages for LoadDS1 (and submethods)

* ds1 refactor: added some missing error messages

* ds1 refactor: fixed test bugs

* ds1 refactor: removed unnecessary c1. and c2. comments in ds1_test errors

* ds1 refactor: removed fmt from ds1_test

* ds1 refactor: fixed bug with SetTiles test + lintfix

* ds1 refactor: SetNumberOfWalls

* ds1 refactor: SetTile(s) now changes walls/floors length if neccesary

* ds1 refactor: removed unnecessary debugging fmt

* ds1 refactor: added substitution layer and object with paths to example data

Co-authored-by: M. Sz <mszeptuch@protonmail.com>

* Ds1 refactor: removed npcIndexes field+fixed SetNumberOfWalls bug (#7)

* ds1 refactor: removed npcIndexes field
it was unnecessary, because described a number of objects with paths to use in encoder, but we can calculate manually

* ds1 refactor: fixed set number of (layers) bug

* ds1 refactor: SetNumberOf...Layers now returns error if incorrect number given

* ds1 refactor: lintfix

* ds1 refactor: rename: setupStreamLayerTypes -> GetStreamLayerTypes

Co-authored-by: M. Sz <mszeptuch@protonmail.com>

* WIP

* Ds1 refactor - tests (#10)

* ds1 refactor test: example data

* added loader check

* ds1 refactor: fixed bug, with loading substitutions; added descriptive error message in engine.go:118 and changed Logger.Error with Logger.Fatal

* ds1 refactor: fixed loading bug

* ds1 refactor: fixed bug when walls wasn't rendered (now we can see only walls :-)

Co-authored-by: M. Sz <mszeptuch@protonmail.com>

* ds1: floor rendering bugfix

* ds1: implemented encode layers method

* ds1: implemented encoder

* ds1: update of ds1_test

Co-authored-by: gravestench <dknuth0101@gmail.com>
Co-authored-by: M. Sz <mszeptuch@protonmail.com>
2021-03-24 10:28:02 -07:00
gucio321 6f41387e30 Ds1 refactor - tests (#10)
* ds1 refactor test: example data

* added loader check

* ds1 refactor: fixed bug, with loading substitutions; added descriptive error message in engine.go:118 and changed Logger.Error with Logger.Fatal

* ds1 refactor: fixed loading bug

* ds1 refactor: fixed bug when walls wasn't rendered (now we can see only walls :-)

Co-authored-by: M. Sz <mszeptuch@protonmail.com>
2021-03-24 10:10:36 -07:00
gravestench 5dfca5e9f3 WIP 2021-03-24 10:10:36 -07:00
gucio321 a33117fb56 Ds1 refactor: removed npcIndexes field+fixed SetNumberOfWalls bug (#7)
* ds1 refactor: removed npcIndexes field
it was unnecessary, because described a number of objects with paths to use in encoder, but we can calculate manually

* ds1 refactor: fixed set number of (layers) bug

* ds1 refactor: SetNumberOf...Layers now returns error if incorrect number given

* ds1 refactor: lintfix

* ds1 refactor: rename: setupStreamLayerTypes -> GetStreamLayerTypes

Co-authored-by: M. Sz <mszeptuch@protonmail.com>
2021-03-24 10:10:36 -07:00
gucio321 5706a1c19a Ds1 refactor: test bugs + descriptive errors + SetNumberOfWall/FloorLayers (#6)
* ds1 refactor:
- removed DS1.layerStreamTypes field
- written unit test for setupStreamLayerTypes method
- added more descriptive error messages for LoadDS1 (and submethods)

* ds1 refactor: added some missing error messages

* ds1 refactor: fixed test bugs

* ds1 refactor: removed unnecessary c1. and c2. comments in ds1_test errors

* ds1 refactor: removed fmt from ds1_test

* ds1 refactor: fixed bug with SetTiles test + lintfix

* ds1 refactor: SetNumberOfWalls

* ds1 refactor: SetTile(s) now changes walls/floors length if neccesary

* ds1 refactor: removed unnecessary debugging fmt

* ds1 refactor: added substitution layer and object with paths to example data

Co-authored-by: M. Sz <mszeptuch@protonmail.com>
2021-03-24 10:10:36 -07:00
gucio321 ca47018e8a Ds1 refactor: some test improvement (#5)
* ds1 refactor: floor_shadow.go: methods Encode, Decode an Hidden are methods of floorShadow

* ds1 refactor: test checks, if our methods sets all fields correctly

* ds1 refactor: minor bugfixes

* i don't remember what's this, but i commit it ;-)

* ds1 refactor: reverted some pushed by mistake things

Co-authored-by: M. Sz <mszeptuch@protonmail.com>
2021-03-24 10:10:36 -07:00
gravestench 4bc4fa0221 DS1.Tile() now calls update if dirty 2021-03-24 10:10:36 -07:00
gucio321 194c1e467c unit tests for ds1 (#4)
* ds1 refactor: added test fore some methods; put tests in right order

* ds1 refactor: unit tests for all methods

* ds1 refactor: fixed build errors

* ds1 refactor: lintfix

* ds1 refactor: fixed bug with SetWidth, SetHeight methods

* ds1 refactor: rename tile_record.go -> tile.go

* ds1 refactor: unit test for SetTiles

Co-authored-by: M. Sz <mszeptuch@protonmail.com>
2021-03-24 10:10:36 -07:00
gravestench 5e0e51d5e2 Refactoring d2ds1
* Adding setters/getters so that state management can be maintained
internally when the ds1 struct is altered
* Adding unit tests for DS1
2021-03-24 10:10:36 -07:00
gucio321 4e7ec3e843
Ds1 refactor: removed npcIndexes field+fixed SetNumberOfWalls bug (#7)
* ds1 refactor: removed npcIndexes field
it was unnecessary, because described a number of objects with paths to use in encoder, but we can calculate manually

* ds1 refactor: fixed set number of (layers) bug

* ds1 refactor: SetNumberOf...Layers now returns error if incorrect number given

* ds1 refactor: lintfix

* ds1 refactor: rename: setupStreamLayerTypes -> GetStreamLayerTypes

Co-authored-by: M. Sz <mszeptuch@protonmail.com>
2021-02-23 12:35:06 -08:00
gucio321 5e62b12bc4
Ds1 refactor: test bugs + descriptive errors + SetNumberOfWall/FloorLayers (#6)
* ds1 refactor:
- removed DS1.layerStreamTypes field
- written unit test for setupStreamLayerTypes method
- added more descriptive error messages for LoadDS1 (and submethods)

* ds1 refactor: added some missing error messages

* ds1 refactor: fixed test bugs

* ds1 refactor: removed unnecessary c1. and c2. comments in ds1_test errors

* ds1 refactor: removed fmt from ds1_test

* ds1 refactor: fixed bug with SetTiles test + lintfix

* ds1 refactor: SetNumberOfWalls

* ds1 refactor: SetTile(s) now changes walls/floors length if neccesary

* ds1 refactor: removed unnecessary debugging fmt

* ds1 refactor: added substitution layer and object with paths to example data

Co-authored-by: M. Sz <mszeptuch@protonmail.com>
2021-02-22 12:18:35 -08:00
gucio321 46d2bc6559
Ds1 refactor: some test improvement (#5)
* ds1 refactor: floor_shadow.go: methods Encode, Decode an Hidden are methods of floorShadow

* ds1 refactor: test checks, if our methods sets all fields correctly

* ds1 refactor: minor bugfixes

* i don't remember what's this, but i commit it ;-)

* ds1 refactor: reverted some pushed by mistake things

Co-authored-by: M. Sz <mszeptuch@protonmail.com>
2021-02-20 11:28:06 -08:00
gravestench 169521e546 DS1.Tile() now calls update if dirty 2021-02-17 10:57:38 -08:00
gucio321 99908016be
unit tests for ds1 (#4)
* ds1 refactor: added test fore some methods; put tests in right order

* ds1 refactor: unit tests for all methods

* ds1 refactor: fixed build errors

* ds1 refactor: lintfix

* ds1 refactor: fixed bug with SetWidth, SetHeight methods

* ds1 refactor: rename tile_record.go -> tile.go

* ds1 refactor: unit test for SetTiles

Co-authored-by: M. Sz <mszeptuch@protonmail.com>
2021-02-17 10:04:44 -08:00
gravestench ec47f16cc4 Refactoring d2ds1
* Adding setters/getters so that state management can be maintained
internally when the ds1 struct is altered
* Adding unit tests for DS1
2021-02-17 02:36:25 -08:00
gravestench 97708c1349
Revert "hotfix: ds1: method setupLayerTypes is now exported + circleci build job bugfix" 2021-02-16 10:02:34 -08:00
M. Sz 6866a03f34 hotfix: ds1: method setupLayerTypes is now exported 2021-02-16 13:06:12 +01:00
M. Sz 0dd9ae6783 ds1 encoder: fixed build error 2021-02-15 15:07:33 +01:00
M. Sz 8a4c138835 ds1 encoder: layerStreamTypes and npcIndexes are now exported 2021-02-15 15:01:14 +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
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
M. Sz 909a0a9939 lintfix: gomnd 2021-02-02 12:02:11 +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
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 16b8a6467f
fixed most lint errors in d2data (#701)
- moved ds1 object definition into the ds1 dir
- added doc files
- only lint errors remaining are for the unused variables in d2video
2020-08-06 16:45:38 -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
Gürkan Kaymak 1ce81f1aec
fixed Id renaming in strings (#618) 2020-07-24 07:54:52 -04:00
danhale-git 727e8244c6
Implemented Position in Path and PathTile (#605)
* Unnecessary constructor assignments removed.

* Position implemented in d2common.Path

* Position implemented in mapEntity.Step.

* Position implemented in d2common.PathTile.
2020-07-18 18:07:13 -04:00
dk de116e8367
moving package comments into doc.go files (#534) 2020-07-03 18:33:46 -04:00
Ziemas fa20b9ee51
Spawn monster by monstat record (#508)
* DS1 reader no longer looks up objects

* Start of enteties managing their own equipment

* stringer and string2enum CompositeType

String2enum

* Use CompositeType stringer to simplify composite

* Finally fix GetDelimitedList

And lint issues

* NPC selects random equipment
2020-07-01 00:06:06 -04:00
Ziemas 6c56027731
Fix monpreset for other acts (#478) 2020-06-28 00:07:52 -04:00
Ziemas 3f1fe538e2
Load monpreset and use that to find monstat entries for NPC's (#477)
* Load monpreset.txt

* Get monstat for npc's and their name from strings

Using monpreset to grab the key for monstat

* Object name tags
2020-06-27 23:15:20 -04:00
Tim Sarbin 954670da5f
Fixed linting issues (#438) 2020-06-24 10:13:11 -04:00
Tim Sarbin 2da08884c4
Added multiplayer support (#336) 2020-06-18 14:11:04 -04:00
Alex Yatskov a4efd41383
File format cleanup (#320)
* Configuration cleanup

* Cleanup

* cleanup file formats

* make palettes a proper fileformat
2020-02-26 08:39:38 -05:00
nicholas-eden bdfdeda67b
Add support for missiles (#308)
* WIP: Add support for missiles

Break AnimatedEntity into two parts to support single and composite animations.  Summon misssiles on right click.

* Break animated entity down further

Move npc only logic to npc struct, reduce duplication in map entities

* Change a bunch of int32s to int
2020-02-22 20:44:30 -05:00
Tim Sarbin 3412c4338c
Added pathfinding and (buggy) collision data. (#285) 2020-02-02 12:46:19 -05:00
Alex Yatskov ea4450f207
Move d2config to d2core, remove d2helper (#282) 2020-02-01 21:06:22 -05:00
Tim Sarbin 2461142fbd
Minor changes to project layout (#276)
* Minor changes to reduce interdependencies on modules.
2020-01-31 23:18:11 -05:00