refactor: major refactor of dc6 package#1
Conversation
merge changes from gucio321/d2dc6
| // Package dc6 provides a DC6 animation decoder, used by diablo 2. | ||
| package dc6 |
There was a problem hiding this comment.
should we delete this file, then?
There was a problem hiding this comment.
not sure. I suppose that if there are no go package in main dir, this file isn't necessary.
It could be inside of pkg dir
| Directions []*Direction | ||
| palette color.Palette | ||
| } | ||
| Termination [terminationSize]byte |
There was a problem hiding this comment.
I think these termination bytes are also artifacts of the encoding, and likely not needed in the decoded struct.
There was a problem hiding this comment.
the problem is, that this value isn't the same in certain dc6 files.
from documentation, we can see, that:
UBYTE termination[4]; // EE EE EE EE or CD CD CD CD and it may be of importance for d2 game
|
|
||
| for dir := 0; dir < d.Frames.NumberOfDirections(); dir++ { | ||
| for f := 0; f < d.Frames.FramesPerDirection(); f++ { | ||
| err = d.Frames.Direction(dir).Frame(f).Load(r, &d.palette) |
There was a problem hiding this comment.
I'm not sure about this.
Why would you need to pass the palette in?
Why is the palette a data member of each frame?
The DC6 should only have a single palette, and the frames should not need a palette to be loaded...
There was a problem hiding this comment.
please note that it is a pointer to the palette used by dc6, not palette itself.
Maybe the better solution is to add (*Frame).Palette method to set it?
| palette *color.Palette | ||
|
|
||
| FrameData []byte | ||
| Terminator []byte |
There was a problem hiding this comment.
This is an artifact of the encoding, we don't need to store the termination bytes.
replace pdc6lib -> dc6lib
- replace github.com/gravestanch/bitstream with OpenDiablo2 upstream - fix broken tests
|
@gravestench thanks for your reviews! just fixed most of them |
Hi,
some time ago I attempted to refactor d2dc6 package (see https://github.com/gucio321/d2dc6).
In this PR i'm merging the changes, I did.
changelog:
framespackageI hope, that these changes will make the code faster and cleaner.