mirror of
https://github.com/OpenDiablo2/OpenDiablo2
synced 2024-10-01 15:46:17 -04:00
Merge pull request #1079 from gucio321/anim-data-encoder
animation data: methods for editing
This commit is contained in:
commit
b72017dbd9
@ -13,11 +13,21 @@ func (r *AnimationDataRecord) FramesPerDirection() int {
|
||||
return int(r.framesPerDirection)
|
||||
}
|
||||
|
||||
// SetFramesPerDirection sets frames per direction value
|
||||
func (r *AnimationDataRecord) SetFramesPerDirection(fpd uint32) {
|
||||
r.framesPerDirection = fpd
|
||||
}
|
||||
|
||||
// Speed returns animation's speed
|
||||
func (r *AnimationDataRecord) Speed() int {
|
||||
return int(r.speed)
|
||||
}
|
||||
|
||||
// SetSpeed sets record's speed
|
||||
func (r *AnimationDataRecord) SetSpeed(s uint16) {
|
||||
r.speed = s
|
||||
}
|
||||
|
||||
// FPS returns the frames per second for this animation record
|
||||
func (r *AnimationDataRecord) FPS() float64 {
|
||||
speedf := float64(r.speed)
|
||||
@ -31,3 +41,23 @@ func (r *AnimationDataRecord) FPS() float64 {
|
||||
func (r *AnimationDataRecord) FrameDurationMS() float64 {
|
||||
return milliseconds / r.FPS()
|
||||
}
|
||||
|
||||
// Events returns events map
|
||||
func (r *AnimationDataRecord) Events() map[int]AnimationEvent {
|
||||
return r.events
|
||||
}
|
||||
|
||||
// Event returns specific event
|
||||
func (r *AnimationDataRecord) Event(idx int) AnimationEvent {
|
||||
event, found := r.events[idx]
|
||||
if found {
|
||||
return event
|
||||
}
|
||||
|
||||
return AnimationEventNone
|
||||
}
|
||||
|
||||
// SetEvent sets event on specific index to given
|
||||
func (r *AnimationDataRecord) SetEvent(index int, event AnimationEvent) {
|
||||
r.events[index] = event
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user