mirror of
https://github.com/OpenDiablo2/OpenDiablo2
synced 2024-10-01 15:46:17 -04:00
removed WIP code
This commit is contained in:
parent
157f110105
commit
d0288e309f
@ -1,9 +1,6 @@
|
||||
package d2dcc
|
||||
|
||||
import (
|
||||
//"fmt"
|
||||
//"os"
|
||||
|
||||
"errors"
|
||||
|
||||
"github.com/OpenDiablo2/OpenDiablo2/d2common/d2datautils"
|
||||
@ -21,7 +18,6 @@ type DCC struct {
|
||||
Directions []*DCCDirection
|
||||
directionOffsets []int
|
||||
fileData []byte
|
||||
size int32
|
||||
}
|
||||
|
||||
// Load loads a DCC file.
|
||||
@ -48,8 +44,7 @@ func Load(fileData []byte) (*DCC, error) {
|
||||
return nil, errors.New("this value isn't 1. It has to be 1")
|
||||
}
|
||||
|
||||
size := bm.GetInt32() // TotalSizeCoded
|
||||
result.size = size
|
||||
bm.GetInt32() // TotalSizeCoded
|
||||
|
||||
result.directionOffsets = make([]int, result.NumberOfDirections)
|
||||
|
||||
@ -58,31 +53,9 @@ func Load(fileData []byte) (*DCC, error) {
|
||||
result.Directions[i] = result.decodeDirection(i)
|
||||
}
|
||||
|
||||
/*fmt.Println(fileData)
|
||||
fmt.Println("\n\n\n")
|
||||
fmt.Println(result.Encode())
|
||||
os.Exit(0)*/
|
||||
|
||||
return result, nil
|
||||
}
|
||||
|
||||
func (d *DCC) Encode() []byte {
|
||||
var result []byte
|
||||
|
||||
result = append(result, byte(d.Signature))
|
||||
result = append(result, byte(d.Version))
|
||||
result = append(result, byte(d.NumberOfDirections))
|
||||
result = append(result, byte(d.FramesPerDirection))
|
||||
result = append(result, 0, 0, 0, 1)
|
||||
result = append(result, 0, 0, 0, byte(d.size), 84, 4, 0)
|
||||
|
||||
for i := 0; i < d.NumberOfDirections; i++ {
|
||||
result = append(result, byte(d.directionOffsets[i]))
|
||||
}
|
||||
|
||||
return result
|
||||
}
|
||||
|
||||
// decodeDirection decodes and returns the given direction
|
||||
func (d *DCC) decodeDirection(direction int) *DCCDirection {
|
||||
return CreateDCCDirection(d2datautils.CreateBitMuncher(d.fileData,
|
||||
|
Loading…
Reference in New Issue
Block a user