1
1
mirror of https://github.com/OpenDiablo2/OpenDiablo2 synced 2024-06-13 11:10:43 +00:00
Commit Graph

194 Commits

Author SHA1 Message Date
juander-ux
12821147ce
Ui panel refactor part 2 (#921)
* d2ui/skilltree: Don't render availSPLabel

this is handled by the ui_manager now.

* d2ui/custom_widget: Allow them to be cached into static images

* d2player/hero_stats_panel: Remove render() function from game_controls

all ui elements are now grouped into a WidgetGroup, thus rendering is
done by the ui manager.

* d2player/hero_stats_panel: Remove unnecessary widgets from struct

we don't need to store them in the HeroStatsPanel struct anymore as they
are completly handled by the uiManager.

* d2ui/widget_group: Remove priority member

this is already defined by the BaseWidget.

* d2ui/widget: Move uiManager.contains() to the baseWidgets

this method makes more sense on a widget anyways.

* d2ui/widget: Add methods to handle widget hovering

* d2ui/custom_widget: Require define width/height

since the custom render() method can do whatever, we need the user to specify
the width/height such that GetSize() calls are meaningful.

* d2ui/widget: Allow widgets to return the uiManager

* d2player/HUD: Refactor health/mana globe into its own widget

* d2player/hud: Refactor load()

seperate each type of loading into its own method.

* d2player/HUD: Move stamina/exp bar into widgets

* d2player/HUD: Refactor left/right skills into widget

* d2ui/custom_widget: cached custom widgets should use widget.x/y

since we render to an image, we use widget.x/y to position the cached
image.

* d2player/HUD: User cached custom widget for all static images
2020-11-13 12:08:43 -08: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
Tim Sarbin
ef6f90c01c
Merge pull request #920 from juander-ux/fix-singleplayer-button-crash
d2gamescreen/char_select: Fix crash on double clicking singleplayer
2020-11-13 09:43:25 -05:00
juander
dbbfdd6acf d2gamescreen/char_select: Fix crash on double clicking singleplayer
if we clicked twice on the single player button of the main menu, then
the first click would set the current screen to the
character_select. The second click directly after that will be
handled by the character_select screen. It's OnLoad() method was not
called yet, which initialized all widgets. The click handler of
character_select screen referenced the nil scrollbar and crashes.
2020-11-13 13:46:40 +01:00
gucio321
40dcd18487
added user IP in TCPIP menu (#916)
* added user IP in TCPIP menu
2020-11-12 02:43:05 -08:00
juander
976431c8e5 Revert "d2ui/sprite: Refactor Render() to RenderNoError()"
This reverts commit 77cd538c2f.

Since we removed the return of errors from the Render() method, we no
longer require the RenderNoError() method.
2020-11-11 15:05:04 +01:00
juander
606fc028ac Revert "d2ui/label: Refactor Render() to RenderNoError()"
This reverts commit f2a55312e4.

Since we removed the return of errors from the Render() method, we no
longer require the RenderNoError() method.
2020-11-11 15:01:36 +01:00
juander
c148941194 d2ui/drawable: Refactor render() method to not return error
this simplifies error handling statements all over the ui code. Before
we had to write:

if err := foo.Render(target); err != nil {
    return err
}

which simplifies now to foo.Render(target)
2020-11-11 14:55:59 +01:00
M. Sz
60566b3b0d fixed lint errors 2020-11-10 15:09:25 +01:00
M. Sz
3e6ec4c1cc removed some unused lines 2020-11-10 15:00:40 +01:00
M. Sz
a19d83ca7b fixed black screen in IPServer menu 2020-11-10 15:00:40 +01:00
M. Sz
15b2e7613f cinematics menu final commit 2020-11-10 15:00:40 +01:00
M. Sz
03ab084b42 fixed some lint errors 2020-11-10 15:00:40 +01:00
M. Sz
9ab694b6f6 Music in cinematics menu 2020-11-10 15:00:40 +01:00
M. Sz
c1ad9025f9 Label in cinematics menu 2020-11-10 15:00:40 +01:00
M. Sz
2eda3827ce cinematics select background 2020-11-10 15:00:40 +01:00
M. Sz
e20d544a8c Buttons in cinematics menu 2020-11-10 15:00:40 +01:00
M. Sz
bd4cf1a334 cinematics menu init 2020-11-10 15:00:40 +01:00
juander
622bc832d3 d2player/skilltree: Move every element to widgets
the uiManager now handles every element of the ui, so we don't need to
render elements manually in game_controls. Now we can also use
widget_groups to simplify handling the opening/closing of the panel.
2020-11-09 18:26:34 +01:00
juander
83acaefea2 d2player/game_controls: learnskills cmd not always creating new skill objects
when we ran the command before we would always throw away old skill
objects and create a new one. This is nasty if we have a pointer to the
old object. By throwing it away we have to update all these pointers.

Now we rather increase the skillpoint, if the hero already has this
skill.
2020-11-09 18:26:32 +01:00
juander
77cd538c2f d2ui/sprite: Refactor Render() to RenderNoError()
this allows us to create a Render() method that implements the Widget
interface without killing us with linter warnings.
2020-11-09 18:26:32 +01:00
juander
f2a55312e4 d2ui/label: Refactor Render() to RenderNoError()
this allows us to create a Render() method that implements the Widget
interface without killing us with linter warnings.
2020-11-09 18:26:28 +01:00
juander
01927d0f3b d2core/d2ui: Add checks to all widgets if they implement Widget
this also adds missing methods to elements not implementing widget. Note
here that we do not enable sprite and label, as this would produce a
crazy amount of linter warnings due to render() requiering error
handling then, which non of the callers handle. Since we remove the
render calls later anyways, we can postpone this static check for now.
2020-11-09 18:13:17 +01:00
juander
881d5f1f71 d2ui: Create default base widget
this encapsulates all the repeating functions defined for all widgets in
the same way, like Set/GetPosition().
2020-11-09 18:13:17 +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
gucio321
d5a26fd495
Hotkeys in Main Menu (#903)
* Escape in MainMenu cause game exit

* Escape in MainMenu cause game exit

* Shortcuts in d2 main menu

* Shortcuts in Main Menu

* Shortcuts in Main Menu

* hotfix for "Shortcuts in Main Menu"

* hotfix for "Shortcuts in Main Menu" - removet some lint error

* fix lint errors

Co-authored-by: M. Sz <mszeptuch@protonmail.com>
Co-authored-by: gravestench <dknuth0101@gmail.com>
2020-11-06 11:44:40 -05:00
juander-ux
9e89d5b891
game_control: HUD refactor (#904)
* d2player/game_controls: Refactor HUD into it's own class

game_controls slowly becomes a superclass that does too many things.
So move HUD into it's own class. This is the first step of getting the
renderer out of game_controls (#798)

* d2ui/tooltip: Allow background box to be disabled

* d2ui/tooltip: Make GetSize() a public function

* d2player: Move const from game_controls to hud

* d2player: Fix missing entity hover tooltip
2020-11-05 11:55:09 -08:00
gravestench
af1f0a0eda
removed string table singleton from d2common/d2fileformats/d2tbl/ (#900) 2020-11-03 11:10:11 -08:00
Julien Ganichot
8365400ff5
Feat(KeyMapping): Adds a configurable keymap to GameControls, resolves #793 (#893)
* Feat(KeyMapping): Adds a configurable keymap to GameControls + Updates help overlay to use it

Co-authored-by: gravestench <dknuth0101@gmail.com>
2020-11-01 19:43:23 -08:00
Thomas Christlieb
40cc421f51
Saving and loading game data, Fixes #868 #799 (#883)
* saving of player should be done on the server. That's also where the loading happens.

* refactor nearly everything, but this time it looks not that bad...

* MAke Linter happy

* Typo... uuups
2020-10-31 14:30:08 -04:00
Stephen Horan
fb8e25ebdb
Code Cleanup for #790 (#870)
* Return errors for #790

* Fixing lint issues

* Returning nil instead of empty struct pointer
2020-10-30 20:19:06 -04:00
juander-ux
4506380dbb
d2player/game_controls: Fix health/mana globe text locking (#882)
when you click on a either of the globes the values should appear
above them.
2020-10-29 09:59:07 -04:00
juander-ux
b1058d6085
Add labels for skill levels (#881)
* d2player/skilltree: Add label for skillpoints

this also darkens the skillicon if no skillpoint was invested yet.

* d2player/gamecontrols: learnskills <class> should only learn class
specific skills

the character would learn skills of enemies as well, like DiabWall. I
wasn't expecting the command to do that.
2020-10-29 09:50:15 -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
juander-ux
79c147866e
Tooltip refactor (#872)
* d2ui: Add tooltip class

we reimplemented tooltips in several places
(inventory/skill_select_panel). Let's make it its own ui element.

* d2player: Refactor skill_select_panel to use the tooltip class

* d2player: Refactor inventory to use the tooltip class

* Make linter happy

* Make golangci-lint 1.27.0 happy as well

* tooltip: Remove const and rather disable linter
2020-10-28 13:54:55 -04:00
gravestench
33368e5aa3
Lint cleanup funlen (#854)
* d2ui/button.go: refactored button state prerender to fix funlen lint error

* d2player/help/help.go: break up Load method to reduce complexity

* d2game/d2player/game_controls.go: refactored renderHUD method, fixed funlen lint error

* d2player/skilltree.go: fixed funlen lint error

* map_engine_test.go: fixed funlen lint error
2020-10-26 15:55:13 -07:00
Zaprit
7d5cd10850
Added an OnKeyUp method to the main menu to emulate retail behavior (#853)
any keyboard event will navigate from trademark screen to the main menu
2020-10-26 12:50:38 -07:00
gravestench
7f19f7e970
another bugfix (#851) 2020-10-26 05:00:30 -07:00
gravestench
0bd774aaa6
fixed some of the remaining funlen lint errors (#850)
* d2records/: suppressing function legnth lint errors for record loaders

* d2gamescreen/character_select.go: broke up OnLoad method to reduce complexity

* d2ui/button.go: suppressing funlen lint error, can't reduce function size
2020-10-26 04:39:10 -07:00
gravestench
aa9f6be411
Lint cleanup gocyclo (#847)
* d2player/inventory.go: fixed gocyclo error, broke up render method to smaller methods

* d2client/game_client.go: suppressing gocyclo error for OnPacketReceived, doesnt make sense to split

* d2remoteclient/remote_client_connection.go: suppressing gocyclo error for decodeToPacket, doesnt make sense to split

* d2dcc/dcc_direction.go: suppressing gocyclo error in generateFrames
2020-10-26 02:24:04 -07:00
gravestench
6f8b43f8d6
Various lint error fixes and suppressions (#846)
* suppressing the magic number lint errors in mapgen, it will get a heavy refactor soon, hopefully...

* adding string token constants for SkillClass

* adding panic on error to left/right skill select render

* fixed cuddle lint error

* fixed unnecessary conversion, unused func param lint errors in dcc_animation.go

* adding comment for skill class tokens

* fixed typo in comment

* removed unused parameter in dcc/dc6 animations

* supress warning about Object.setMode always being passed direction value of 0

* fixed all invalid golint directives

* fixed a couple gocritic lint errors
2020-10-26 02:04:50 -07:00
gravestench
49c1985dcc
removed all 'structcheck' and 'unused' lint errors (#839) 2020-10-25 17:49:41 -07:00
gravestench
02acba231b
removed all 'wsl' lint errors (#836) 2020-10-25 17:28:40 -07:00
gravestench
1ce2af19bf
removed all 'gocritic' lint errors (#835) 2020-10-25 17:03:23 -07:00
gravestench
6b5c2a1fc5
removed all 'govet' type lint errors (#834) 2020-10-25 16:50:13 -07:00
gravestench
a1380bc264
removed all golint lint errors (#833)
* removed all 'golint' type lint errors
2020-10-25 16:23:55 -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
Thomas Christlieb
2b469d302b
fix miniPanelGameMenu wrong rendering (#810) 2020-10-25 13:37:07 -04:00
Thomas Christlieb
bb9789d700
Red stamina bar (#809)
* Fixed a typo. Make stamina bar red wehan below 25%

* make linter happy
2020-10-25 13:15:28 -04:00
juander-ux
bbc716f682
Add close buttons to all panels (#808)
* d2player/panels: Add close button to hero/inventory/skilltree panel

we require a OnClose callback here, as we need to update the perspective
of the view which is handled by gamecontrols.updateLayout().

* d2player/skilltree: Fix using the same tab label for all tabs

* d2player/game_controls: Fix wrong position of left/right menu

the character would not detect that a click was in a menu and start
walking.
2020-10-25 10:54:39 -04:00