mirror of
https://github.com/OpenDiablo2/OpenDiablo2
synced 2024-11-05 09:47:18 -05:00
3757ff1ac5
* Move MapEntity to d2interface * New package d2object, first object initFun Moves objects out to their own package and implements the very first init function, torches/braziers now gets their animation mode set at creation. * Apply name again * Turn on waypoints
38 lines
725 B
Go
38 lines
725 B
Go
package d2object
|
|
|
|
import (
|
|
"github.com/OpenDiablo2/OpenDiablo2/d2common/d2enum"
|
|
)
|
|
|
|
// Finds an init function for the given object
|
|
func initObject(ob *Object) bool {
|
|
funcs := map[int]func(*Object){
|
|
8: initTorch,
|
|
14: initTorch,
|
|
17: initWaypoint,
|
|
}
|
|
|
|
fun, ok := funcs[ob.objectRecord.InitFn]
|
|
if !ok {
|
|
return false
|
|
}
|
|
|
|
fun(ob)
|
|
|
|
return true
|
|
}
|
|
|
|
// Initializes torch/brazier type objects
|
|
func initTorch(ob *Object) {
|
|
if ob.objectRecord.HasAnimationMode[d2enum.AnimationModeObjectOperating] {
|
|
ob.setMode("ON", 0)
|
|
}
|
|
}
|
|
|
|
func initWaypoint(ob *Object) {
|
|
// Turn these on unconditionally for now, they look nice :)
|
|
if ob.objectRecord.HasAnimationMode[d2enum.AnimationModeObjectOperating] {
|
|
ob.setMode("ON", 0)
|
|
}
|
|
}
|