Commit Graph

44 Commits

Author SHA1 Message Date
gravestench 1fc787023d fixed lint errors 2021-01-11 01:31:57 -08:00
Tim Sarbin c99810ad0e Fixed various bugs, crashes, and slowdowns. 2021-01-10 02:44:42 -05:00
Intyre 04ec879035 Cleaned up d2term 2020-12-21 21:46:58 +01:00
gucio321 9ffbf1320c
D2core logger (#934)
* logger for d2audio & d2map

* logger for d2ui e.t.c

* d2inventory now passes on error messages

* no more importing log in d2core

* implemented #925

* added logger to part of d2networking & fixed "need to be changed" comments

* fixed lints

* fixed errors

Co-authored-by: M. Sz <mszeptuch@protonmail.com>
2020-11-21 02:33:22 -08: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 1046fb6137
bugifx (#849) 2020-10-26 04:35:23 -07: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 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 18c9e85cbc
`d2game/d2player/` lint error cleanup (#788)
* d2game/d2player/inventory.go: magic number lint cleanup

* d2game/d2player/mini_panel.go: magic number lint cleanup

* d2game/d2player/skill_select_panel.go: lint cleanup

* d2game/d2player/skilltree.go: removed all lint errors

* removed the rest of the magic number errors from d2game

* hotfix for bug i added in map engine test

* all magic numbers removed (excluding  mapgen)
2020-10-25 00:42:31 -07:00
gravestench 16a82442bb
removed a bunch of magic number lint errors (#785)
* removed magic numbers from d2ui/button.go

* removed a bunch of magic number lint errors
2020-10-23 09:00:51 -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
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
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
Ziemas 8d87c19532
Draw entities back to front within tiles (#705)
* Draw entities per subtile for correct depth order

* Use a temporary entity slice for depth sorting

Speeds things up quite a bit
2020-08-16 14:59:03 -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 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
Tim Sarbin 856043d8ac
Updated music logic (#629) 2020-07-26 15:17:00 -04:00
Tim Sarbin 7da1843f49
Lint cleanup (#628) 2020-07-26 14:52:54 -04:00
danhale-git 259c6e7e76
Vector method pointers (#621)
* All Vector methods which operate on the vector return pointers to it.

* All Vector methods which take vectors take Vector pointers.
2020-07-25 09:36:54 -04:00
Benjamin Maisonnas 89b031d2b7
fix(camera): focus the local player on viewport init (#620)
Thanks!
2020-07-25 09:36:15 -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
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
Ziemas d0c6cd61dd
Simple LOS pathfinding without walkmesh (#610)
* Reorganize MapEngine

This is already turning into a mess...

* Map engine selects tile index to use

Still very ugly

* Fix subtile flag combination

* Prepare randomly generated base tiles

* Restore collision viewer

* Movement works again, searches for straight paths

Paths are now d2vector slices

* Fix LOS calculation

* Fix test (I think)
2020-07-21 08:50:45 -04:00
lord aadfa35e6b
Smooth camera targetting (#607)
* smooth camera with vectors

* add smooth cam  support to map engine test

smooth cam now works in map engine test.
clicking or holding the left-mouse button will move the camera.

also works with freecam mode in single-player.

* Update ebiten_renderer.go

did not mean to edit this file
2020-07-18 23:37:35 -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
Ziemas 09a6869aea
Use vectors for object positioning (#587)
* Use d2vector.Position in objects

* Remove arbitrary render offset

If things are actually wrong lets figure out why

* Remove arbitrary wall offset

This broke maggot lair
2020-07-14 00:25:23 -04:00
Intyre 9e58b134e5
Refactored d2enum (#567)
* Refactored animation mode enum

* More d2enum changes

* Refactored tile enum

* Refactored weapon class enum

* Refactored more enums

* Refactored item event enum

* Fixed init_functions animation mode

* Removed string2enum from MonsterAnimationMode

* Refactored ItemStatCost description

* Last enum lint errors

* Regenerated monster stringer file
2020-07-09 23:12:28 -04:00
danhale-git 6104adc700
D2map lint warnings (#566)
* Comments and newlines in engine.go

* Comments and newlines in object.go

* Comments and newlines in animated_entity.go

* Comments and newlines in missile.go

* Comments and newlines in npc.go

* Comments and newlines in player.go

* Removed object.go (incorrectly merged it in during rebase).

* Comments and newlines in renderer.go.

* Comments and newlines in map_entity.go.

* Comments and newlines in walk_mesh.go.

* Comments and newlines in viewport.go and tile_cache.go.

* Comments and newlines in stamp.go and wilderness_tile_types.go.

* Comments and newlines in everything else.
2020-07-09 16:11:01 -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
Ziemas aae565d528
Monstat2 loading and a bunch of lint issues (#491)
* MonStat2 loader

* Fix a bunch of lint issues in d2datadict
2020-06-29 12:37:11 -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
Ziemas 9f7f1ae072
Actually use renderpass2 (#485) 2020-06-29 00:30:27 -04:00
dk 09a28c2822
removed d2term singleton (#483) 2020-06-28 21:40:52 -04:00
Ziemas 11f743aa42
Get and use draw order and animation speed for objects (#473)
* String2enum ObjectAnimationMode

* Render objects at their assigned layer

Gets the orderflag from the object record and assign it to the mapentity
so the renderer can get at it.

This adds another render pass that loops through the objects.

* Get object animation speed from their txt entry
2020-06-27 14:30:23 -04:00
Tim Sarbin 6dae0097b9
Added npc labels. More mapgen stuff. (#449) 2020-06-25 00:39:09 -04:00
Tim Sarbin c2db7ede66
Added basic map generation for first area of south town (#408)
* Map engine updates. Limited rendering to specific area.

* Added south town border generation
2020-06-23 01:05:01 -04:00
Haashi 5e1725dd7d
385/lintissues (#391)
* camera offset for ui panels :

added maprenderer viewport to be aligned left or right

calling alignement on keyPress in game_controls

* check if already aligned

* fix bugs

-forgot to assign alignement
-defaultScreenRect instead of screenRect because of issue mentionned in original comment

* remove config.json and replace go.mod line

* removing duplicate import of d2common

replacing all dh to d2common

* remove useless breaks from switch statement

* better range when value unused + prettying import

* item_affix rewrite

using return values instead of pointer references in arguments

* ebiten deprecated calls

* small fixes
2020-06-22 11:53:44 -04:00
Haashi 711cae2d69
fix for #358 from recent PRs (#390)
* camera offset for ui panels :

added maprenderer viewport to be aligned left or right

calling alignement on keyPress in game_controls

* check if already aligned

* fix bugs

-forgot to assign alignement
-defaultScreenRect instead of screenRect because of issue mentionned in original comment

* remove config.json and replace go.mod line

* update with new renderer and escape menu
2020-06-22 09:23:56 -04:00
Ziemas 75112ec736
Show special tiles in mapdebug (#386)
More useful than the floor stuff

Also method for testing if special
2020-06-21 22:14:06 -04:00
Tim Sarbin 912aaf044c
Re-tooled rendering engine (#379) 2020-06-21 18:40:37 -04:00