2020-04-18 00:12:15 +01:00
|
|
|
package scenario
|
|
|
|
|
|
|
|
import (
|
2020-06-13 18:11:45 +01:00
|
|
|
"log"
|
|
|
|
|
2020-04-18 00:12:15 +01:00
|
|
|
"code.ur.gs/lupine/ordoor/internal/maps"
|
|
|
|
)
|
|
|
|
|
|
|
|
type CellPoint struct {
|
|
|
|
IsoPt
|
|
|
|
Z int
|
|
|
|
}
|
|
|
|
|
2020-06-09 00:35:57 +01:00
|
|
|
func (s *Scenario) CellAtCursor() (*maps.Cell, CellPoint) {
|
2020-06-13 18:11:45 +01:00
|
|
|
cell := s.area.Cell(int(s.highlightedCell.X), int(s.highlightedCell.Y), 0)
|
|
|
|
return cell, CellPoint{IsoPt: s.highlightedCell, Z: 0}
|
|
|
|
}
|
|
|
|
|
|
|
|
func (s *Scenario) HighlightedCharacter() *maps.Character {
|
|
|
|
// FIXME: characters are always at zIdx 0 right now
|
|
|
|
return s.area.CharacterAt(int(s.highlightedCell.X), int(s.highlightedCell.Y), 0)
|
|
|
|
}
|
|
|
|
|
|
|
|
func (s *Scenario) SelectedCharacter() *maps.Character {
|
|
|
|
return s.selectedCharacter
|
|
|
|
}
|
|
|
|
|
|
|
|
func (s *Scenario) SelectHighlightedCharacter() {
|
|
|
|
chr := s.HighlightedCharacter()
|
|
|
|
log.Printf("Selected character %s", chr)
|
|
|
|
s.selectedCharacter = chr
|
2020-04-18 00:12:15 +01:00
|
|
|
}
|
2020-04-20 00:16:21 +01:00
|
|
|
|
|
|
|
func (s *Scenario) ChangeZIdx(by int) {
|
|
|
|
newZ := s.ZIdx + by
|
|
|
|
if newZ < 0 {
|
|
|
|
newZ = 0
|
|
|
|
}
|
|
|
|
|
|
|
|
if newZ > 6 {
|
|
|
|
newZ = 6
|
|
|
|
}
|
|
|
|
|
|
|
|
s.ZIdx = newZ
|
|
|
|
}
|