1
1
mirror of https://github.com/OpenDiablo2/OpenDiablo2 synced 2024-06-04 23:10:42 +00:00
Commit Graph

28 Commits

Author SHA1 Message Date
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
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
Gürkan Kaymak
858fa18068
lint fixes (#703) 2020-08-11 18:01:33 -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
Tim Sarbin
460e821a5e
Started work on shadows (#630) 2020-07-26 19:29:37 -04:00
Gürkan Kaymak
7a49f3637f
lint fixes (#615) 2020-07-23 12:56:50 -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
5212270c44
Split up DCC/DC6 animation implementations, decode directions on demand (#548)
* Split DCC and decode direction on demand

* Clean up

* More cleanup

* Make dc6 animation it's own type

* Make base animation private

* Also decode DC6 directions on demand
2020-07-06 20:13:06 -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
Tim Sarbin
5bfec3ccb0 Removed render singleton. Updated refs. 2020-07-03 14:00:56 -04:00
David Carrell
c8ec4c018e
first pass at resolving linting issues in d2asset (#518) 2020-07-01 14:09:18 -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
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
Tim Sarbin
255ffc75da
Fixed lint issues (#484) 2020-06-28 22:32:34 -04:00
Tim Sarbin
1b614ddb3a
Made animation loaders public. (#481)
* Updated ebiten reference

* Made animation loaders public
2020-06-28 12:10:25 -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
Alex Yatskov
418c798c2c
Add RenderFromOrigin method to Animation (#317)
* Configuration cleanup

* Cleanup

* Add RenderFromOrigin option
2020-02-24 23:04:01 -05:00
nicholas-eden
f6014498ba
Use missile range and subloop (#311)
Turn on blending.  Calculate target using based on range and angle of hero to click.
2020-02-23 03:23:18 -05:00
Ziemas
e4c84c4fb9
Direction changes. (#309)
* Take directions in the range of 0-63

* Shift direction handling in animation further back

* Don't need to get the DCC direction here.

Because it was added to animation.

* Check direction is within range
2020-02-22 22:33:58 -05:00
Alex Yatskov
1983ec395d Cleanup error handling (#303) 2020-02-09 14:12:04 -05:00
Tim Sarbin
6606774ece
Refectoring to reduce code warnings (#283) 2020-02-01 21:51:49 -05:00
Alex Yatskov
ea4450f207
Move d2config to d2core, remove d2helper (#282) 2020-02-01 21:06:22 -05: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
Alex Yatskov
8a547ebf0e
Moving files around to make more sense (#279)
* Prevent input fighting between terminal and other input listeners.

* Moving files around, removing exports

* Add missing line
2020-02-01 18:55:56 -05:00