mirror of
https://github.com/OpenDiablo2/OpenDiablo2
synced 2024-12-28 13:06:55 -05:00
hotfix: cof encoder: coding weapon class
This commit is contained in:
parent
227bc9fcb1
commit
8a15c0b074
@ -121,7 +121,6 @@ func (c *COF) Unmarshal(fileData []byte) error {
|
|||||||
layer.Transparent = b[layerTransparent] > 0
|
layer.Transparent = b[layerTransparent] > 0
|
||||||
layer.DrawEffect = d2enum.DrawEffect(b[layerDrawEffect])
|
layer.DrawEffect = d2enum.DrawEffect(b[layerDrawEffect])
|
||||||
|
|
||||||
layer.weaponClassByte = b[layerWeaponClass:]
|
|
||||||
layer.WeaponClass = d2enum.WeaponClassFromString(strings.TrimSpace(strings.ReplaceAll(
|
layer.WeaponClass = d2enum.WeaponClassFromString(strings.TrimSpace(strings.ReplaceAll(
|
||||||
string(b[layerWeaponClass:]), badCharacter, "")))
|
string(b[layerWeaponClass:]), badCharacter, "")))
|
||||||
|
|
||||||
@ -193,7 +192,15 @@ func (c *COF) Marshal() []byte {
|
|||||||
|
|
||||||
sw.PushBytes(byte(c.CofLayers[i].DrawEffect))
|
sw.PushBytes(byte(c.CofLayers[i].DrawEffect))
|
||||||
|
|
||||||
sw.PushBytes(c.CofLayers[i].weaponClassByte...)
|
s := c.CofLayers[i].WeaponClass.String()
|
||||||
|
|
||||||
|
for j := 0; j < 4; j++ {
|
||||||
|
if j < len(s) {
|
||||||
|
sw.PushBytes(s[j])
|
||||||
|
} else {
|
||||||
|
sw.PushBytes(0)
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
for _, i := range c.AnimationFrames {
|
for _, i := range c.AnimationFrames {
|
||||||
|
@ -4,11 +4,10 @@ import "github.com/OpenDiablo2/OpenDiablo2/d2common/d2enum"
|
|||||||
|
|
||||||
// CofLayer is a structure that represents a single layer in a COF file.
|
// CofLayer is a structure that represents a single layer in a COF file.
|
||||||
type CofLayer struct {
|
type CofLayer struct {
|
||||||
Type d2enum.CompositeType
|
Type d2enum.CompositeType
|
||||||
Shadow byte
|
Shadow byte
|
||||||
Selectable bool
|
Selectable bool
|
||||||
Transparent bool
|
Transparent bool
|
||||||
DrawEffect d2enum.DrawEffect
|
DrawEffect d2enum.DrawEffect
|
||||||
WeaponClass d2enum.WeaponClass
|
WeaponClass d2enum.WeaponClass
|
||||||
weaponClassByte []byte
|
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user