Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

rebase upstream master #1

Open
wants to merge 37 commits into
base: 311_dt1-widget-dropdown
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
37 commits
Select commit Hold shift + click to select a range
2d701b2
Add IRC link to readme
DarthGandalf Jun 8, 2021
270fa82
Merge pull request #316 from DarthGandalf/patch-1
gravestench Jun 10, 2021
5695562
fixing the makefile
gravestench Jul 2, 2021
d511332
Merge pull request #322 from gravestench/unfuck_build
gravestench Jul 2, 2021
592820d
corrected typo in abysswrapper
gravestench Jul 2, 2021
7718393
correct typo in comment
gravestench Jul 2, 2021
461261f
make FileType method private, should not be exported
gravestench Jul 2, 2021
f65fa2f
fixed typo is named constant
gravestench Jul 2, 2021
e4ef67a
fixed typo is comment
gravestench Jul 2, 2021
2d784e7
fixed typo is comment
gravestench Jul 2, 2021
02ea486
reworded doc string
gravestench Jul 2, 2021
07aa949
removed unnecessary parenthesis
gravestench Jul 2, 2021
7df109f
removed unnecessary type conversion, unnecessary parenthesis
gravestench Jul 2, 2021
92a958b
use unused parameter passed into NewSelectPaleteWidget
gravestench Jul 2, 2021
142fee5
hscofeditor.Create: renaming unused argument to _
gravestench Jul 2, 2021
a1abf8d
reworded misleading doc string for hseditor
gravestench Jul 2, 2021
105767a
reworded misleading doc string for hsconsole
gravestench Jul 2, 2021
403559d
reworded misleading hsmpqexplorer doc string
gravestench Jul 2, 2021
357d60d
reword misleading hsprojectexplorer doc string
gravestench Jul 2, 2021
21318fb
reword hsnode doc string
gravestench Jul 2, 2021
790fc27
reword dccwidget doc string
gravestench Jul 2, 2021
31cfbfa
reword ds1widget doc string
gravestench Jul 2, 2021
b3b2fb0
reword dt1widget doc string
gravestench Jul 2, 2021
44e9e63
reword fonttablewidget doc string
gravestench Jul 2, 2021
2016497
reword palettegrideditorwidget doc string
gravestench Jul 2, 2021
325a2b1
reword palettemapwidget doc string
gravestench Jul 2, 2021
a5175fa
reword hswidget doc string
gravestench Jul 2, 2021
732ff17
reword misleading hsaboutdialog doc string
gravestench Jul 2, 2021
3e62832
change go version in build.yml to v1.16.5
gravestench Jul 3, 2021
2dc5997
removed magic number from hsutil/datautils.go
gravestench Jul 3, 2021
0b4b752
fix all lint errors
gravestench Jul 3, 2021
e227805
Merge pull request #324 from gravestench/code_cleanup2
gravestench Jul 3, 2021
726cd35
remove checkboxes from dt1 widget
gravestench Jun 7, 2021
8e812e3
bugfix: subtile index lookup was backwards
gravestench Jun 7, 2021
59760ac
remove nolints, add colornames
gravestench Jun 7, 2021
12f895f
Merge pull request #310 from gravestench/issue307
gravestench Jul 3, 2021
2b43be6
Reworks dt1widget makeSubtileFlags to use dropdown menu
bbrucee Jun 7, 2021
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ jobs:
- name: Set up Go environment
uses: actions/[email protected]
with:
go-version: 1.16
go-version: 1.16.5
id: go

- name: Cache Go modules
Expand Down
1 change: 1 addition & 0 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@ setup:
@git submodule update --init --recursive
@$(GOCMD) get -v -t -d ./...
@$(GOCMD) mod download -x
@$(GOCMD) get golang.org/x/tools/cmd/stringer
@$(GOCMD) install golang.org/x/tools/cmd/stringer
@$(GOCMD) generate -v ./...

Expand Down
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
![Logo](hsassets/images/d2logo.png)

[Join us on Discord!](https://discord.gg/pRy8tdc)\
[Join us on IRC!](ircs://irc.libera.chat/#opendiablo2)\
[Development Live stream](https://www.twitch.tv/essial/)\
[Support us on Patreon](https://www.patreon.com/bePatron?u=37261055)

Expand Down
2 changes: 1 addition & 1 deletion abysswrapper/abysswrapper.go
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ func (a *AbyssWrapper) Write(p []byte) (n int, err error) {
return n, nil
}

// Launch launchs abyss wrapper
// Launch launches abyss wrapper
func (a *AbyssWrapper) Launch(config *hsconfig.Config, output io.Writer) error {
a.mutex.RLock()
if a.running {
Expand Down
2 changes: 1 addition & 1 deletion hsassets/assets.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import (
_ "embed" // this is standard solution for embed
)

// these variables are links to existing icones used in project
// these variables are links to existing icons used in project
// nolint:gochecknoglobals // go:embed directive works only for globals
// https://github.com/golangci/golangci-lint/issues/1727
var (
Expand Down
6 changes: 3 additions & 3 deletions hscommon/hsfiletypes/filetype.go
Original file line number Diff line number Diff line change
Expand Up @@ -94,9 +94,9 @@ func (f FileType) FileExtension() string {

type fileTypeCheckFn = func(data *[]byte) FileType

// SubtypeCheckFn returns a function to check a file. This is important for
// subtypeCheckFn returns a function to check a file. This is important for
// distinguishing between files that share a common file extension.
func (f FileType) SubtypeCheckFn() fileTypeCheckFn {
func (f FileType) subtypeCheckFn() fileTypeCheckFn {
table := map[FileType]fileTypeCheckFn{
FileTypeTBL: determineSubtypeTBL,
FileTypeTBLFontTable: determineSubtypeTBL,
Expand All @@ -114,7 +114,7 @@ func GetFileTypeFromExtension(extension string, data *[]byte) (FileType, error)
continue
}

fnDetermine := fileType.SubtypeCheckFn()
fnDetermine := fileType.subtypeCheckFn()
if fnDetermine == nil {
return fileType, nil
}
Expand Down
2 changes: 1 addition & 1 deletion hscommon/hsnode/node.go
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// Package hsnode contains game nodes
// Package hsnode contains an implementation of a node graph, as parent and child nodes.
package hsnode

import "strings"
Expand Down
10 changes: 5 additions & 5 deletions hscommon/hsutil/datautils.go
Original file line number Diff line number Diff line change
Expand Up @@ -12,9 +12,9 @@ import (
"github.com/OpenDiablo2/dialog"
)

const miliseconds = 1000
const milliseconds = 1000

// BoolToInt converts bool into 32-bit intager
// BoolToInt converts bool into 32-bit integer
// if b is true, then returns 1, else 0
func BoolToInt(b bool) int32 {
if b {
Expand Down Expand Up @@ -48,7 +48,7 @@ func ExportToGif(images []*image.RGBA, delay int32) error {
// reload static image and construct outGif
for _, img := range images {
// FROM TUTORIAL:
// Read each frame GIF image with gif.Decode. If we read JPEG images, we have to convert them programatically
// Read each frame GIF image with gif.Decode. If we read JPEG images, we have to convert them programmatically
// (goanigiffy does this by calling gif.Encode and gif.Decode).
g := bytes.NewBuffer([]byte{})

Expand All @@ -63,11 +63,11 @@ func ExportToGif(images []*image.RGBA, delay int32) error {
}

outGif.Image = append(outGif.Image, inGif.(*image.Paletted))
outGif.Delay = append(outGif.Delay, int(delay/miliseconds))
outGif.Delay = append(outGif.Delay, int(delay/milliseconds))
}

// save gif image
file, err := os.OpenFile(filepath.Clean(filePath), os.O_WRONLY|os.O_CREATE, 0o600)
file, err := os.OpenFile(filepath.Clean(filePath), os.O_WRONLY|os.O_CREATE, defaultFilePermissions)
if err != nil {
return fmt.Errorf("error creating a new file: %w", err)
}
Expand Down
2 changes: 1 addition & 1 deletion hsconfig/doc.go
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
// Package hsconfig contains app configs
// Package hsconfig provides the Hellspawner application config file implementation.
package hsconfig
4 changes: 3 additions & 1 deletion hswidget/animdatawidget/widget.go
Original file line number Diff line number Diff line change
Expand Up @@ -73,12 +73,14 @@ func (p *widget) buildAnimationsList() {

list := make([]giu.Widget, len(keys))

const imageButtonSize = 13

for idx, name := range keys {
currentIdx := idx
list[idx] = giu.Row(
hswidget.MakeImageButton(
"##"+p.id+"deleteEntry"+strconv.Itoa(currentIdx),
13, 13,
imageButtonSize, imageButtonSize,
state.deleteIcon,
func() {
p.deleteEntry(state.mapKeys[currentIdx])
Expand Down
4 changes: 2 additions & 2 deletions hswidget/cofwidget/state.go
Original file line number Diff line number Diff line change
Expand Up @@ -130,7 +130,7 @@ func (s *widgetState) Decode(data []byte) {
return
}

s.selectable = (selectable == 1)
s.selectable = selectable == 1

transparent, err := sr.ReadByte()
if err != nil {
Expand All @@ -139,7 +139,7 @@ func (s *widgetState) Decode(data []byte) {
return
}

s.transparent = (transparent == 1)
s.transparent = transparent == 1

s.drawEffect, err = sr.ReadInt32()
if err != nil {
Expand Down
4 changes: 2 additions & 2 deletions hswidget/cofwidget/widget.go
Original file line number Diff line number Diff line change
Expand Up @@ -421,12 +421,12 @@ func (p *widget) makeAddLayerLayout() giu.Layout {

drawEffectList := make([]string, d2enum.DrawEffectNone+1)
for i := d2enum.DrawEffectPctTransparency25; i <= d2enum.DrawEffectNone; i++ {
drawEffectList[int(i)] = strconv.Itoa(int(i)) + " (" + i.String() + ")"
drawEffectList[i] = strconv.Itoa(int(i)) + " (" + i.String() + ")"
}

weaponClassList := make([]string, d2enum.WeaponClassTwoHandToHand+1)
for i := d2enum.WeaponClassNone; i <= d2enum.WeaponClassTwoHandToHand; i++ {
weaponClassList[int(i)] = i.String() + " (" + i.Name() + ")"
weaponClassList[i] = i.String() + " (" + i.Name() + ")"
}

return giu.Layout{
Expand Down
4 changes: 3 additions & 1 deletion hswidget/dc6widget/widget.go
Original file line number Diff line number Diff line change
Expand Up @@ -118,7 +118,9 @@ func (p *widget) makeViewerLayout() giu.Layout {
imgui.SliderInt("Frames", &viewerState.controls.frame, 0, int32(p.dc6.FramesPerDirection-1))
}

imgui.SliderInt("Scale", &viewerState.controls.scale, 1, 8)
const minScale, maxScale = 1, 8

imgui.SliderInt("Scale", &viewerState.controls.scale, minScale, maxScale)

imgui.EndGroup()
}),
Expand Down
3 changes: 1 addition & 2 deletions hswidget/dccwidget/doc.go
Original file line number Diff line number Diff line change
@@ -1,3 +1,2 @@
// Package dccwidget contains stuff responsible for
// viewing and editing DCC structures
// Package dccwidget contains stuff responsible for viewing and editing the DCC data structure
package dccwidget
4 changes: 2 additions & 2 deletions hswidget/dccwidget/state.go
Original file line number Diff line number Diff line change
Expand Up @@ -114,15 +114,15 @@ func (s *widgetState) Decode(data []byte) {
return
}

s.isPlaying = (isPlaying == 1)
s.isPlaying = isPlaying == 1

repeat, err := sr.ReadByte()
if err != nil {
log.Print(err)
return
}

s.repeat = (repeat == 1)
s.repeat = repeat == 1

s.tickTime, err = sr.ReadInt32()
if err != nil {
Expand Down
4 changes: 3 additions & 1 deletion hswidget/dccwidget/widget.go
Original file line number Diff line number Diff line change
Expand Up @@ -105,7 +105,9 @@ func (p *widget) Build() {
imgui.SliderInt("Frames", &viewerState.controls.frame, 0, int32(p.dcc.FramesPerDirection-1))
}

imgui.SliderInt("Scale", &viewerState.controls.scale, 1, 8)
const minScale, maxScale = 1, 8

imgui.SliderInt("Scale", &viewerState.controls.scale, minScale, maxScale)

imgui.EndGroup()
}),
Expand Down
2 changes: 1 addition & 1 deletion hswidget/doc.go
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
// Package hswidget contains widgets for each editor
// Package hswidget contains a generic editor widget implementation, along with with concrete editor implementations.
package hswidget
3 changes: 1 addition & 2 deletions hswidget/ds1widget/doc.go
Original file line number Diff line number Diff line change
@@ -1,3 +1,2 @@
// Package ds1widget provides a giu.Widget implementation for viewing and editing
// the DS1 files.
// Package ds1widget provides a giu.Widget for viewing and editing the DS1 data structure.
package ds1widget
9 changes: 4 additions & 5 deletions hswidget/ds1widget/widget.go
Original file line number Diff line number Diff line change
Expand Up @@ -333,11 +333,10 @@ func (p *widget) makeObjectLayout(state *widgetState) giu.Layout {
}

if len(obj.Paths) > 0 {
l = append(
l,
giu.Dummy(1, 16),
p.makePathLayout(state, obj),
)
const spacerHeight = 16

vspace := giu.Dummy(1, spacerHeight)
l = append(l, vspace, p.makePathLayout(state, obj))
}

return l
Expand Down
3 changes: 1 addition & 2 deletions hswidget/dt1widget/doc.go
Original file line number Diff line number Diff line change
@@ -1,3 +1,2 @@
// Package dt1widget contains data about dt1 widget, necessary to
// edit and view dt1 file structure
// Package dt1widget contains a giu widget implementation for viewing and editing the dt1 data structure
package dt1widget
6 changes: 3 additions & 3 deletions hswidget/dt1widget/state.go
Original file line number Diff line number Diff line change
Expand Up @@ -91,7 +91,7 @@ func (s *widgetState) Decode(data []byte) {
return
}

s.showGrid = (showGrid == 1)
s.showGrid = showGrid == 1

showFloor, err := sr.ReadByte()
if err != nil {
Expand All @@ -100,7 +100,7 @@ func (s *widgetState) Decode(data []byte) {
return
}

s.showFloor = (showFloor == 1)
s.showFloor = showFloor == 1

showWall, err := sr.ReadByte()
if err != nil {
Expand All @@ -109,7 +109,7 @@ func (s *widgetState) Decode(data []byte) {
return
}

s.showWall = (showWall == 1)
s.showWall = showWall == 1

s.subtileFlag, err = sr.ReadInt32()
if err != nil {
Expand Down
8 changes: 4 additions & 4 deletions hswidget/dt1widget/sub_tile_flags.go
Original file line number Diff line number Diff line change
Expand Up @@ -33,11 +33,11 @@ func subTileString(subtile int32) string {

func getFlagFromPos(x, y int) int {
var subtileLookup = [5][5]int{
{20, 21, 22, 23, 24},
{15, 16, 17, 18, 19},
{10, 11, 12, 13, 14},
{5, 6, 7, 8, 9},
{0, 1, 2, 3, 4},
{5, 6, 7, 8, 9},
{10, 11, 12, 13, 14},
{15, 16, 17, 18, 19},
{20, 21, 22, 23, 24},
}

return subtileLookup[y][x]
Expand Down
Loading