* Fixed NaN on normalize 0 vector.
* Tentative implementation in getStepLength.
* mapEntity.TileX/Y removed.
* Fixed Position and Target not being initialised in createMapEntity.
* mapEntity.Position is no longer embedded.
* mapEntity.LocationX/Y no longer used outside map_entity.go.
* mapEntity.subCellX/Y removed.
* mapEntity.LocationX/Y removed.
* mapEntity.OffsetX/Y and TargetX/Y removed.
* Direction method added to Vector, returns 0-64 direction.
* Moved Vector.Direction() to Position.DirectionTo and refactored.
* Renamed RenderOffset from SubCell and tested IsZero.
* d2math.WrapInt added for use with directions.
* Tidied up position and tests.
* Refactored d2common.AdjustWithRemainder into d2mapEntity.
* Tidying up d2mapEntity.
* Final cleanup.
* Lint warnings.
* Spelling correction.
* lint updates for /d2astar
* png issue
* debug package
* load bmp properly
* debug draft
* 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.
* 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.
* removing inventory grid test for now because it causes builds to fail on github (#570)
* 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
* compressed image
* Replaced restruct with StreamReader (#574)
* Fixed bug in palette.go (#575)
* Javascript console commands (#572)
* Allow the execution of JS from the terminal when hosting a local game or playing a single game
Signed-off-by: William Claude <w.claude@thebeat.co>
* Reorganise imports on edited files
Signed-off-by: William Claude <w.claude@thebeat.co>
* Remove Reset
Signed-off-by: William Claude <w.claude@thebeat.co>
* Add inventory.txt loader, use the records (#573)
* adding resource entry for inventory.txt
* adding loader for inventory.txt
* adding call to inventory.txt loader in d2app
* d2game now uses the inventory.txt records for making the inventory panel
* removed comments
* remove unused files
* update go.mod
* lint updates for /d2astar
* png issue
* update go.mod
Co-authored-by: danhale-git <36298392+danhale-git@users.noreply.github.com>
Co-authored-by: dk <dknuth0101@gmail.com>
Co-authored-by: Intyre <Intyre@gmail.com>
Co-authored-by: William <1004323+aziule@users.noreply.github.com>
* adding resource entry for inventory.txt
* adding loader for inventory.txt
* adding call to inventory.txt loader in d2app
* d2game now uses the inventory.txt records for making the inventory panel
* 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.
* Add PushEffect, handle effects in renderer
* Set effects instead of blend
* Stop using PushCompositeMode, use PushEffect
* Remove remaining composite mode things
* 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
* lint fixes for the game.go
* lint fixes for the gui_testing.go
* lint fixes for the blizzard_intro.go, map_engine_testing.go and select_hero_class.go
* added package comment for the d2gamescreen package
* fixes after merge
* 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
* 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
* 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
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.
* 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
* 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
* Quit using ObjectLookupRecord in composite
* Unexport SetMode in map entities
* Get rid of weaponClass from MapEntity
* Pass ObjectType to composite instead of string
* Use layer weaponclass from cof
* Manage more stuff directly in composite
* Explicitly index when picking equipment
* 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
* 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
* 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.
* adding comments to d2interface for linter
* moved d2render renderer interfaces and types into d2interface
* fixed most lint errors for monstats loader
* de-lint d2data wip
* d2data: resolve linting errors
* 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
* adding comments to d2interface for linter
* moved d2render renderer interfaces and types into d2interface
* fixed most lint errors for monstats loader
* 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
* WIP refactor of d2map stuff
* more d2map refactor
adding realm init to game client
passing map engine from client and server into realm at init
change `generate map packet` to have act and level index as data
* client explodes, but getting there
* realm now initializes, networking works, but map generators dont currently do anything
* changed the way that level type records are loaded
* fixed funcs for level data lookups
* started implementing level generator, currently crashing
* client no longer exploding
* d2networking refactor
put exports into d2client.go and d2server.go
kept GameClient and GameServer methods into their respective files
made methods for packet handlers instead of the giant switch statements
* bugfix: getting first level id by act
* minor refactor of gamescreen for readability
* towns now generate on server start, create player takes act and level id as args, levels have their own map engine
* Save/load hero stats and display them in stats panel.
* Load default hero state for characters created before saving stats was introduced
Co-authored-by: Presiyan Ivanov <presiyan-ivanov@users.noreply.github.com>
* Use integer directions for rotating map entities
* Manage composite directly in npc
* Player manages its own composite
* Split up animation mode types
Players, monsters, objects all have their own types
* Clean up AnimatedEntity
* Rename AnimatedEntity -> Object
* Keep the object txt record on hand in Object
When clicking on the other side of a wall or in an an inaccessible area,
route the player the closest possible node. This allows running along
walls and matches the original closely.
Co-authored-by: Nicholas Eden <neden@zigzagame.com>
* Added automap.go stub
* Handle errors in original AutoMap.txt file
* Completed AutoMapRecord struct and comments
* AutoMap loader implemented
* Update from base repo
* Cel1-4 fields replaced with a slice
* Commented out Type fields as they aren't used
* Add basic EquipmentSlot struct
* Add Load function to EquipmentSlot
* Move EquipmentSlot struct to inventory_grid.go
* Add equipmentSlots arg to ItemGrid struct
* Add basic rendering of equipment slots.
* Change rendering of equipment slots to simply use their static x and y
* Add ChangeEquippedSlot function
* Add initialization to all equipped slots types.
* Fix Y locations of equipment slots
* Move default equipment slots to a genEquipmentSlotsMap function.
* Change Item to item
* Fix coordinates
* Change usage of string to EquippedSlotType when dealing with different slots in rendering.
* Fix import error
* Remove neck example
* Add loading sprites of equipped items.
* Clean code in Inventory rendering
* Clean code in Inventory rendering
* Clean code in Inventory rendering
* Change default items that get rendered.
* Change default items that get rendered.
* Add width and height to EquipementSlot struct
* Fill in width and height to current equipment slots.
* Fix Y setting of equipment slots
* Rename variables for clean code.
* Change handling nil itemSprite to condition instead of loop return.
* Split Render function to 2 functions.
* Add TODO
* Change comment to start with capital I
* added SuperUniques data dictionary
* added a call to LoadSuperUniques() method from the main
* added a call to LoadSuperUniques() method from the main
Copied go-astar into d2common/d2astar, made a few optimizations. Runs
roughly 30% faster according to my benchmarking.
Added a `maxCost` param to prevent searching the entire map for a path.
This probably needs tweaked a bit, but follows the original game more
closely.
Co-authored-by: Nicholas Eden <neden@zigzagame.com>
* make game update at 25fps, ui update at max fps
* minor edits to func names, d2resource constants
* renamed `loadDictionary` to `loadTextDictionary` to avoid confusion with `LoadDataDictionary`
* updated line in main.go that calls `loadTextDictionary`
* added tokens as constants inside of `d2resource/resource_paths.go` that are used in font/language paths
* moved locale string handling stuff into it's own func, now uses tokens defined in d2resource
* minor edits to func names, d2resource constants
* renamed `loadDictionary` to `loadTextDictionary` to avoid confusion with `LoadDataDictionary`
* updated line in main.go that calls `loadTextDictionary`
* added tokens as constants inside of `d2resource/resource_paths.go` that are used in font/language paths
* moved locale string handling stuff into it's own func, now uses tokens defined in d2resource
* fix: accidentally renamed func in d2asset
* git is hard
accidentally added changes not meant for this commit
* 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
* Handle up/down/enter keys and reset menu on toggle
Signed-off-by: William Claude <w.claude@thebeat.co>
* Add sound when selecting an item
Signed-off-by: William Claude <w.claude@thebeat.co>
* Reorganise code and remove unused things (YAGNI)
Signed-off-by: William Claude <w.claude@thebeat.co>
* Group properties
Signed-off-by: William Claude <w.claude@thebeat.co>
* Use switch statements instead of IFs
Signed-off-by: William Claude <w.claude@thebeat.co>
* Prevent opening the escape menu over hero stats or inventory
Signed-off-by: William Claude <w.claude@thebeat.co>
* main, d2common: load Magic/Rare/Unique Affix
* d2common: item affixes only
removed Rare/Unique Prefix/Suffix as those are related to monsters, not items.
* removed debug print from item_affix.go
* changed item affix type names for clarity, removed debug print from data_dictionary
* d2common: item affix datadict and records
Item Affixes are defined in `/data/global/excel/Magic{Prefix,Suffix}.txt`
Rare and Unique Pre/Suffixes seem to be for monsters, not items.
d2common: item affixes only
removed Rare/Unique Prefix/Suffix as those are related to monsters, not items.
removed debug print from item_affix.go
changed item affix type names for clarity, removed debug print from data_dictionary
* reverting to pre-allocating memory for parsing txt lines
* removing the rest of the rare/unique definitions
* removing the rest of the rare/unique definitions
* mend
* adding datadict loader for levels.txt
* adding comments from PK forums in the added d2enum files
* fixed bad naming. doh!
* main, d2common: load Magic/Rare/Unique Affix
* d2common: item affixes only
removed Rare/Unique Prefix/Suffix as those are related to monsters, not items.
* removed debug print from item_affix.go
* changed item affix type names for clarity, removed debug print from data_dictionary
* d2common: item affix datadict and records
Item Affixes are defined in `/data/global/excel/Magic{Prefix,Suffix}.txt`
Rare and Unique Pre/Suffixes seem to be for monsters, not items.
d2common: item affixes only
removed Rare/Unique Prefix/Suffix as those are related to monsters, not items.
removed debug print from item_affix.go
changed item affix type names for clarity, removed debug print from data_dictionary
* reverting to pre-allocating memory for parsing txt lines
* removing the rest of the rare/unique definitions
* removing the rest of the rare/unique definitions
* mend
* adding datadict loader for levels.txt
* adding comments from PK forums in the added d2enum files
* adding rules for swap files to .gitignore
* main, d2common: load Magic/Rare/Unique Affix
* d2common: item affixes only
removed Rare/Unique Prefix/Suffix as those are related to monsters, not items.
* removed debug print from item_affix.go
* changed item affix type names for clarity, removed debug print from data_dictionary
* d2common: item affix datadict and records
Item Affixes are defined in `/data/global/excel/Magic{Prefix,Suffix}.txt`
Rare and Unique Pre/Suffixes seem to be for monsters, not items.
d2common: item affixes only
removed Rare/Unique Prefix/Suffix as those are related to monsters, not items.
removed debug print from item_affix.go
changed item affix type names for clarity, removed debug print from data_dictionary
* reverting to pre-allocating memory for parsing txt lines
* removing the rest of the rare/unique definitions
* removing the rest of the rare/unique definitions
* adding ItemStatCost data dict loader
* adding data dict loader for difficulty levels
Crashes were due to missing translation. This PR temporarily replaces the translateString calls for the default string directly.
in `select_hero_class.go` there is a level of indirection before the call to translateString, and for this reason, its `panic` call got temporarily diverted.
* adding rules for swap files to .gitignore
* main, d2common: load Magic/Rare/Unique Affix
* d2common: item affixes only
removed Rare/Unique Prefix/Suffix as those are related to monsters, not items.
* removed debug print from item_affix.go
* changed item affix type names for clarity, removed debug print from data_dictionary
* d2common: item affix datadict and records
Item Affixes are defined in `/data/global/excel/Magic{Prefix,Suffix}.txt`
Rare and Unique Pre/Suffixes seem to be for monsters, not items.
d2common: item affixes only
removed Rare/Unique Prefix/Suffix as those are related to monsters, not items.
removed debug print from item_affix.go
changed item affix type names for clarity, removed debug print from data_dictionary
* reverting to pre-allocating memory for parsing txt lines
* removing the rest of the rare/unique definitions
* removing the rest of the rare/unique definitions
* adding ItemStatCost data dict loader
* Adding monstats.txt data dict loader
* adding myself to contributors file
* main, d2common: load Magic/Rare/Unique Affix
* d2common: item affixes only
removed Rare/Unique Prefix/Suffix as those are related to monsters, not items.
* removed debug print from item_affix.go
* changed item affix type names for clarity, removed debug print from data_dictionary
* d2common: item affix datadict and records
Item Affixes are defined in `/data/global/excel/Magic{Prefix,Suffix}.txt`
Rare and Unique Pre/Suffixes seem to be for monsters, not items.
d2common: item affixes only
removed Rare/Unique Prefix/Suffix as those are related to monsters, not items.
removed debug print from item_affix.go
changed item affix type names for clarity, removed debug print from data_dictionary
* reverting to pre-allocating memory for parsing txt lines
* removing the rest of the rare/unique definitions
* removing the rest of the rare/unique definitions
* adding charstats datadict loader
* adding rules for swap files to .gitignore
* main, d2common: load Magic/Rare/Unique Affix
* d2common: item affixes only
removed Rare/Unique Prefix/Suffix as those are related to monsters, not items.
* removed debug print from item_affix.go
* changed item affix type names for clarity, removed debug print from data_dictionary
* d2common: item affix datadict and records
Item Affixes are defined in `/data/global/excel/Magic{Prefix,Suffix}.txt`
Rare and Unique Pre/Suffixes seem to be for monsters, not items.
d2common: item affixes only
removed Rare/Unique Prefix/Suffix as those are related to monsters, not items.
removed debug print from item_affix.go
changed item affix type names for clarity, removed debug print from data_dictionary
* adding ItemStatCost data dict loader
* removed call to append, added records to exported array
* adding rules for swap files to .gitignore
* main, d2common: load Magic/Rare/Unique Affix
* d2common: item affixes only
removed Rare/Unique Prefix/Suffix as those are related to monsters, not items.
* removed debug print from item_affix.go
* changed item affix type names for clarity, removed debug print from data_dictionary
* d2common: item affix datadict and records
Item Affixes are defined in `/data/global/excel/Magic{Prefix,Suffix}.txt`
Rare and Unique Pre/Suffixes seem to be for monsters, not items.
d2common: item affixes only
removed Rare/Unique Prefix/Suffix as those are related to monsters, not items.
removed debug print from item_affix.go
changed item affix type names for clarity, removed debug print from data_dictionary
* reverting to pre-allocating memory for parsing txt lines
* removing the rest of the rare/unique definitions
* removing the rest of the rare/unique definitions
* adding ItemStatCost data dict loader
* main, d2common: load Magic/Rare/Unique Affix
* d2common: item affixes only
removed Rare/Unique Prefix/Suffix as those are related to monsters, not items.
* removed debug print from item_affix.go
* changed item affix type names for clarity, removed debug print from data_dictionary
* d2common: item affix datadict and records
Item Affixes are defined in `/data/global/excel/Magic{Prefix,Suffix}.txt`
Rare and Unique Pre/Suffixes seem to be for monsters, not items.
d2common: item affixes only
removed Rare/Unique Prefix/Suffix as those are related to monsters, not items.
removed debug print from item_affix.go
changed item affix type names for clarity, removed debug print from data_dictionary
* reverting to pre-allocating memory for parsing txt lines
* removing the rest of the rare/unique definitions
* removing the rest of the rare/unique definitions
* adding pl2 as a fiel format and an asset manager for pl2 files
* adding pl2 as a file format and an asset manager for pl2 files
* pl2 asset manager and file format
* added call in main.go to load palette transforms
* removed incorrect PaletteTransformType declarations from main.go
* removingn bad resource path for palette transform
* PL2 file format added, added to asset management
PL2 files are beside palette files in the mpq
These files define palette transforms of their respective base palette.
I've bound a command to d2term (in d2asset.go)
load_pl2 <path>
* Clean up PL2 asset stuff
removed pl2 stuff from d2datadict, didn't belong in there
removed d2term debug binding
* minor cleanup for d2pl2
* 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
* 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
* Switch to a 2d array for looking up subtile flags
Also fix up the walkableArea generation
* Check correct tiletype for walls
And fix the subtile tooltip text.
* Switch items to dynamic load with a common struct, add misc.txt loading
* Update Ebiten Reference
* Switch references to point to D2Shared
* Migrate part 2