Commit Graph

57 Commits

Author SHA1 Message Date
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
Tim Sarbin 92989d6d7a Removed improper ebiten dependency in d2interface. 2020-12-30 02:08:32 -05:00
Intyre 04ec879035 Cleaned up d2term 2020-12-21 21:46:58 +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 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 f7fb35a4ec
removed debug printer singleton from d2util (#901)
resolves #504
2020-11-03 11:19:59 -08:00
gravestench b052006922
add comment explaining significance of input handler return value (#895) 2020-11-02 01:14:03 -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 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 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
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
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
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
Ziemas dccb930f5c
Only draw shadows for layers that should have them (#704)
* Don't draw shadows for transparent layers

* Also use cof shadow setting
2020-08-16 14:59:34 -04:00
lord 8b2b991b12
D2mapengine remove entity, minor edits (#694)
* implement entity removal

* add rgba color func, fix some lint errors in d2map

* bugfix for map entity tests
2020-08-05 21:27:45 -04:00
lord fe992699b5
fix lint errors in d2interface (#684)
- 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
2020-08-04 22:53:36 -04:00
lord 524132c122
D2datadict unique items bugfix (#669)
* d2ui.Label: add support for color tokens in labels, multiple colors per label

* unique items should use the item name as the map key
2020-08-02 21:26:07 -04:00
lord 6a8b9aada1
Minor edits: debug entity frame bounds, debug `spawnmon` command (#666)
* 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
2020-08-01 19:03:09 -04:00
Ziemas c840e140f7
Stereo panning for sound effects (#654)
Randomly pan event sounds

Adapted from ebiten example
2020-07-30 21:50:27 -04:00
Ziemas 29ea71489d
Sound engine and sound environments (#652)
* 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
2020-07-30 16:17:26 -04:00
Tim Sarbin 460e821a5e
Started work on shadows (#630) 2020-07-26 19:29:37 -04:00
lord 362147848d
entity debug rendering (#609)
* 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
2020-07-21 08:51:09 -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
danhale-git 029cb62972
Vector float64 (#565)
* Fixed nil pointer in Copy()

* Position added

Added Floor() and String() methods to Vector.

Also added Position which declares an embedded Vector2 and returns various forms of it.

* d2vector.Vector2 renamed to d2vector.BigFloat

* vector.go renamed to big_float.go

* Float64 stub and more renaming

* Vector value getters

* Separate vector types with initial methods.

* Divide and lint warnings.

* Distance and Length.

* Scale, Abs and Negate.

* CompareFloat64Fuzzy delta direction reversed.

* Refactor vector_test.go.

* Renamed Approx methods.

* Distance and Length.

* Distance and Length.

* Removed BigFloat and Vector, renamed Float64 to Vector, simplified tests.

* Angle, SignedAngle and other small functions.

* Receiver rename.

* SingedAngle and test fixed

* Rotate.

* SetLength.

* Cross.

* NinetyAnti and NinetyClock.

* Lerp and Clamp.

* Reflect and ReflectSurface.

* Cardinal convenience functions.

* Comments.

* Panic on NaN and Inf in Position.

* Lint warnings and comments.
2020-07-09 08:30:55 -04:00
Ziemas e2e8a303c2
Use our own DrawEffects enum for draw effects (#564)
* Add PushEffect, handle effects in renderer

* Set effects instead of blend

* Stop using PushCompositeMode, use PushEffect

* Remove remaining composite mode things
2020-07-08 21:57:35 -04:00
Ziemas 1ad3c72211
Standardize indexed color to RGBA conversion to one function (#562)
* Common function for indexed color to rgba

* Use ImgIndexToRGBA when decoding tiles

* Pass DrawEffect down to animation
2020-07-08 17:46:45 -04:00
Maxime Lavigne (malavv) f18ede6e66
Removing Clone of Font() since all material is sharable, Fixes #515 (#561)
* Removing Clone of Font() since all material is sharable, Fixes #515

* Removed Clone() from the Font interface, as deep copies are not needed.
2020-07-08 11:25:40 -04:00
Intyre db5e844aac
Removed Configuration interface (#560) 2020-07-08 09:16:16 -04:00
dk 60e6fcb7ac
moving enumerations out of d2interface (#552)
* moved filter constants back to d2enum

* moving key and mouse button enums into d2enum

* moving render type enum into d2enum

* moving input even priority enums into d2enum

* moving terminal enums into d2enum
2020-07-06 21:26:08 -04:00
dk 321a353461
Font manager abstraction (#545)
* abstracted palettes, colors, and palette manager

* make asset manager use the palette manager interface

* added BGRA setter/getter, fixed lint errors

* abstraction for animation and animation manager

* abstracted font and font manager
2020-07-05 15:56:48 -04:00
dk c1a88c9cf7
Animation manager abstraction (#544)
* abstracted palettes, colors, and palette manager

* make asset manager use the palette manager interface

* added BGRA setter/getter, fixed lint errors

* abstraction for animation and animation manager
2020-07-05 13:01:44 -04:00
dk 8809fb2c22
Made abstractiong for the file manager (#542)
I realized that the file manager is actually managing file access
to the archives, but it's doing so through the archive manager.

I've renamed it, it's now called ArchivedFileManager because that
is really what it is.
2020-07-05 00:00:00 -04:00
dk 0a72ccaf16
Abstraction for archives and archive manager (#541)
* archive abstraction

* archive manager abstraction

* fixinglint errors

* archive abstraction

* archive manager abstraction

* fixinglint errors
2020-07-04 22:37:13 -04:00
danhale-git 07d90e9681
Position struct for managing world coordinates (#540)
* Fixed nil pointer in Copy()

* Position added

Added Floor() and String() methods to Vector.

Also added Position which declares an embedded Vector2 and returns various forms of it.

* Position tests improved
2020-07-04 19:25:53 -04:00
dk cf35285b48
abstracted d2config to an interface (still have a singleton, though) (#538) 2020-07-04 00:49:16 -04:00
Ziemas 3757ff1ac5
New package d2object, first object initFun (#537)
* Move MapEntity to d2interface

* New package d2object, first object initFun

Moves objects out to their own package and implements the very first
init function, torches/braziers now gets their animation mode set at creation.

* Apply name again

* Turn on waypoints
2020-07-04 00:48:31 -04:00
dk 4c3ff12cba
abstracted cache to an interface (#535) 2020-07-03 21:23:44 -04:00
dk de116e8367
moving package comments into doc.go files (#534) 2020-07-03 18:33:46 -04:00
dk 62b8a610c0
D2input abstraction (#532)
* abstract d2input manager/service/events/keys/buttons to interface

* abstract d2input manager/service/events/keys/buttons to interface

* fixing lint error
2020-07-03 15:09:16 -04:00
dk 48bde64a7e
vector implementation with big.Float (#527) 2020-07-03 02:26:59 -04:00
Gürkan Kaymak ae6bfb839e
Lint fixes for the following packages (#505)
* fixed lint issues of the package d2core/d2inventory

* fixed lint issues of the d2script package

* fixed lint issues of the d2common/d2interface package

* fixed lint issues of the d2common/d2resource package

* fixed lint issues of the d2core/d2term package

* fixed conflict errors
2020-06-30 17:04:41 -04:00
Maxime Lavigne (malavv) 3990df3bac
Fixes #496 and improves memory consumption on render of game_controls (#501)
* Fixes #496 using ebiten.SubImage to Render Section of a Surface.

I had to add matching functions to both animation and sprite to get it to be called
for a sprite object.

* Fixed linter warning on comments for Sprite and Animation.

* Removing what's remaining of the old Sprite re-generation and caching.
2020-06-30 12:43:13 -04:00
Tim Sarbin e2572b8745
More linting (#500) 2020-06-30 09:58:53 -04:00
dk 691368cba7
Decouple bitmuncher (#495)
* adding comments to d2interface for linter

* moved d2render renderer interfaces and types into d2interface

* fixed most lint errors for monstats loader

* decouple bitmuncher to interface
2020-06-29 20:21:09 -04:00
dk 55dc3e42ed
minor edits (#486)
* adding comments to d2interface for linter

* moved d2render renderer interfaces and types into d2interface
2020-06-29 00:41:58 -04:00
dk 09a28c2822
removed d2term singleton (#483) 2020-06-28 21:40:52 -04:00
Tim Sarbin 3f575cf1d8
Removed audio singleton (#482) 2020-06-28 19:31:10 -04:00
Alex Yatskov b5c1f5222d
Move rendering stuff out of d2common into d2render (#281)
* Move rendering stuff out of d2common into d2render

* Remove d2interface
2020-02-01 20:39:28 -05:00