Drag flow into view-map
This is pretty awful, but will let me wire up items more easily without needing to do the big refactor into independent menu handlers
This commit is contained in:
@@ -102,18 +102,27 @@ func (m *Map) SpritesForCell(x, y, z int) ([]*Sprite, error) {
|
||||
|
||||
sprites = append(sprites, sprite)
|
||||
}
|
||||
|
||||
for _, chr := range m.raw.Characters {
|
||||
if chr.XPos == x && chr.YPos == y && z == 1 { // FIXME: sort out ZPos
|
||||
// Look up the correct animation, get the frame, boom
|
||||
anim, err := m.assets.CharacterAnimation(chr.Type, data.AnimActionNone)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
sprites = append(sprites, anim.Frames[0])
|
||||
if chr := m.CharacterAt(x, y, z); chr != nil {
|
||||
// Look up the correct animation, get the frame, boom
|
||||
anim, err := m.assets.CharacterAnimation(chr.Type, data.AnimActionNone)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
sprites = append(sprites, anim.Frames[0])
|
||||
}
|
||||
|
||||
return sprites, nil
|
||||
}
|
||||
|
||||
func (m *Map) CharacterAt(x, y, z int) *maps.Character {
|
||||
// FIXME: don't iterate
|
||||
for i, _ := range m.raw.Characters {
|
||||
chr := &m.raw.Characters[i]
|
||||
if chr.XPos == x && chr.YPos == y && z == 1 { // FIXME: sort out ZPos
|
||||
return chr
|
||||
}
|
||||
}
|
||||
|
||||
return nil
|
||||
}
|
||||
|
Reference in New Issue
Block a user