Start displaying characters on maps
This commit is contained in:
@@ -1,6 +1,9 @@
|
||||
package assetstore
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
|
||||
"code.ur.gs/lupine/ordoor/internal/data"
|
||||
"code.ur.gs/lupine/ordoor/internal/idx"
|
||||
)
|
||||
|
||||
@@ -76,3 +79,50 @@ func (a *AssetStore) Animation(groupIdx, recIdx int) (*Animation, error) {
|
||||
|
||||
return &Animation{Frames: sprites}, nil
|
||||
}
|
||||
|
||||
func (a *AssetStore) CharacterAnimation(ctype data.CharacterType, action data.AnimAction) (*Animation, error) {
|
||||
ha, err := a.HasAction()
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
if !ha.Check(ctype, action) {
|
||||
return nil, fmt.Errorf("character %s: animation %s: not available", ctype, action)
|
||||
}
|
||||
|
||||
// FIXME: we still need to be able to go from CTYPE to GROUP. In particular,
|
||||
// squad leaders seem to be a modification on top of a previous group, which
|
||||
// is a bit awkward. For now, hardcode it. How are captain modifiers stored?
|
||||
group, ok := map[data.CharacterType]int{
|
||||
data.CharacterTypeTactical: 1, // Has captain
|
||||
data.CharacterTypeAssault: 3, // Has captain
|
||||
data.CharacterTypeDevastator: 5,
|
||||
data.CharacterTypeTerminator: 6, // Has captain
|
||||
data.CharacterTypeApothecary: 8,
|
||||
data.CharacterTypeTechmarine: 9,
|
||||
data.CharacterTypeChaplain: 10,
|
||||
data.CharacterTypeLibrarian: 11,
|
||||
data.CharacterTypeCaptain: 12,
|
||||
data.CharacterTypeChaosMarine: 13,
|
||||
data.CharacterTypeChaosLord: 14,
|
||||
data.CharacterTypeChaosChaplain: 15,
|
||||
data.CharacterTypeChaosSorcerer: 16,
|
||||
data.CharacterTypeChaosTerminator: 17,
|
||||
data.CharacterTypeKhorneBerserker: 18,
|
||||
data.CharacterTypeBloodThirster: 19, // This is a rotating thing?
|
||||
data.CharacterTypeBloodLetter: 20,
|
||||
data.CharacterTypeFleshHound: 21,
|
||||
data.CharacterTypeLordOfChange: 22, // Another rotating thing?
|
||||
data.CharacterTypeFlamer: 23,
|
||||
data.CharacterTypePinkHorror: 24,
|
||||
data.CharacterTypeBlueHorror: 25,
|
||||
data.CharacterTypeChaosCultist: 26,
|
||||
}[ctype]
|
||||
if !ok {
|
||||
return nil, fmt.Errorf("Unknown character type: %s", ctype)
|
||||
}
|
||||
|
||||
rec := ha.Index(ctype, action)
|
||||
|
||||
return a.Animation(group, rec)
|
||||
}
|
||||
|
Reference in New Issue
Block a user