1
1
mirror of https://github.com/OpenDiablo2/OpenDiablo2 synced 2024-11-07 18:57:18 -05:00
OpenDiablo2/d2common/d2fileformats/d2animdata/hash.go
lord 65cce60eab
adding animdata loader (#718)
* adding animdata loader

* utility methods, more tests, export record struct

- added methods for fps and frame duration calculation to the AnimationDataRecord
- exported AnimationDataRecord
- split the various structs into their own files
- added getter methods for retrieving records by name
- added tests for the new utility methods
2020-09-08 15:59:38 -04:00

19 lines
290 B
Go

package d2animdata
import "strings"
type hashTable [numBlocks]byte
func hashName(name string) byte {
hashBytes := []byte(strings.ToUpper(name))
var hash uint32
for hashByteIdx := range hashBytes {
hash += uint32(hashBytes[hashByteIdx])
}
hash %= numBlocks
return byte(hash)
}